Skip to content

Commit

Permalink
fix: Update param index verification for address (#460)
Browse files Browse the repository at this point in the history
* fix: Adding param index verification for address

* chore: Adding latest trust-min

* adding optional chaining and ecma 2020
  • Loading branch information
y3fers0n authored Oct 23, 2023
1 parent 45dc5d0 commit 09a0228
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 33 deletions.
4 changes: 2 additions & 2 deletions dist/trust-min.js
Git LFS file not shown
47 changes: 18 additions & 29 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
module.exports = {
"env": {
"browser": true,
"node": true,
"commonjs": true,
"es6": true,
"jest": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2017
},
"rules": {
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"warn",
"double"
],
"semi": [
"error",
"always"
],
"no-console": [
"off"
]
}
env: {
browser: true,
node: true,
commonjs: true,
es6: true,
jest: true,
},
extends: "eslint:recommended",
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
},
rules: {
"linebreak-style": ["error", "unix"],
quotes: ["warn", "double"],
semi: ["error", "always"],
"no-console": ["off"],
},
};
10 changes: 8 additions & 2 deletions src/ethereum_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ class TrustWeb3Provider extends BaseProvider {
var message;
let address;

if (this.address === payload.params[0].toLowerCase()) {
if (
typeof payload.params?.[0].toLowerCase() === "string" &&
this.address === payload.params?.[0].toLowerCase()
) {
message = payload.params[1];
address = payload.params[0];
} else {
Expand Down Expand Up @@ -297,7 +300,10 @@ class TrustWeb3Provider extends BaseProvider {
let address;
let data;

if (this.address === payload.params[0].toLowerCase()) {
if (
typeof payload.params?.[0] === "string" &&
this.address === payload.params?.[0].toLowerCase()
) {
data = payload.params[1];
address = payload.params[0];
} else {
Expand Down

0 comments on commit 09a0228

Please sign in to comment.