Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino committed Mar 6, 2024
1 parent 9d19bb1 commit b40400c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 103 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"anvil": "ETH_MAINNET_RPC=$(grep ETH_MAINNET_RPC .env | cut -d '=' -f2) && anvil --fork-url $ETH_MAINNET_RPC",
"anvil:kill": "lsof -i :8545|tail -n +2|awk '{print $2}'|xargs -r kill -s SIGINT"
},
"type": "module",
"type": "commonjs",
"module": "dist/index.js",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "6.20.0",
Expand All @@ -35,7 +35,6 @@
"@ethersproject/abstract-provider": "5.7.0",
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/providers": "5.7.2",
"@ethersproject/wallet": "^5.7.0",
"@metamask/eth-sig-util": "7.0.1",
"eventemitter3": "5.0.1",
"viem": "1.21.4"
Expand Down
29 changes: 15 additions & 14 deletions src/handleProviderRequest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@ import {
ProviderRequestPayload,
RequestResponse,
} from './references/messengers';
import { Address, isAddress, isHex } from 'viem';
import { Address, isHex } from 'viem';
import { mainnet, optimism } from 'viem/chains';
import { StaticJsonRpcProvider } from '@ethersproject/providers';
import { verifyMessage } from '@ethersproject/wallet';
import {
MessageTypes,
SignTypedDataVersion,
TypedMessage,
recoverTypedSignature,
} from '@metamask/eth-sig-util';

const TESTMAR27_ETH_ADDRESS: Address =
'0x5e087b61aad29559e31565079fcdabe384b44614';
Expand All @@ -24,7 +17,7 @@ const RAINBOWWALLET_ETH_TX_HASH =
'0xfc621a4577ba3398adc0800400b2ba2c408ab76cdc1521dadbfc802dc93a8b37';
const TX_HASH =
'0x43cfbb52ec99192e96f34a42b37354cfabd6845403e9473e921030da9751d12d';
const SIGN_SIGNATURE = '0x123456789'
const SIGN_SIGNATURE = '0x123456789';

const TYPED_MESSAGE = {
domain: {
Expand Down Expand Up @@ -411,7 +404,9 @@ describe('handleProviderRequest', () => {
},
{ id: 1 },
);
expect(response.result).toBe(SIGN_SIGNATURE + 'personal_sign'+ 'personal_sign_message');
expect(response.result).toBe(
SIGN_SIGNATURE + 'personal_sign' + 'personal_sign_message',
);
});

it('should call eth_signTypedData correctly', async () => {
Expand All @@ -427,7 +422,9 @@ describe('handleProviderRequest', () => {
},
{ id: 1 },
);
expect(response.result).toBe(SIGN_SIGNATURE + 'eth_signTypedData'+ 'eth_signTypedData_message');
expect(response.result).toBe(
SIGN_SIGNATURE + 'eth_signTypedData' + 'eth_signTypedData_message',
);
});

it('should call eth_signTypedData_v3 correctly', async () => {
Expand All @@ -443,7 +440,9 @@ describe('handleProviderRequest', () => {
},
{ id: 1 },
);
expect(response.result).toBe(SIGN_SIGNATURE + 'eth_signTypedData_v3'+ 'eth_signTypedData_v3_message');
expect(response.result).toBe(
SIGN_SIGNATURE + 'eth_signTypedData_v3' + 'eth_signTypedData_v3_message',
);
});

it('should call eth_signTypedData_v4 correctly', async () => {
Expand All @@ -459,7 +458,9 @@ describe('handleProviderRequest', () => {
},
{ id: 1 },
);
console.log(response.result)
expect(response.result).toBe(SIGN_SIGNATURE + 'eth_signTypedData_v4'+ TYPED_MESSAGE);
console.log(response.result);
expect(response.result).toBe(
SIGN_SIGNATURE + 'eth_signTypedData_v4' + TYPED_MESSAGE,
);
});
});
87 changes: 0 additions & 87 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -279,43 +279,6 @@
"@ethersproject/properties" "^5.7.0"
"@ethersproject/strings" "^5.7.0"

"@ethersproject/hdnode@^5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf"
integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==
dependencies:
"@ethersproject/abstract-signer" "^5.7.0"
"@ethersproject/basex" "^5.7.0"
"@ethersproject/bignumber" "^5.7.0"
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/logger" "^5.7.0"
"@ethersproject/pbkdf2" "^5.7.0"
"@ethersproject/properties" "^5.7.0"
"@ethersproject/sha2" "^5.7.0"
"@ethersproject/signing-key" "^5.7.0"
"@ethersproject/strings" "^5.7.0"
"@ethersproject/transactions" "^5.7.0"
"@ethersproject/wordlists" "^5.7.0"

"@ethersproject/json-wallets@^5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360"
integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==
dependencies:
"@ethersproject/abstract-signer" "^5.7.0"
"@ethersproject/address" "^5.7.0"
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/hdnode" "^5.7.0"
"@ethersproject/keccak256" "^5.7.0"
"@ethersproject/logger" "^5.7.0"
"@ethersproject/pbkdf2" "^5.7.0"
"@ethersproject/properties" "^5.7.0"
"@ethersproject/random" "^5.7.0"
"@ethersproject/strings" "^5.7.0"
"@ethersproject/transactions" "^5.7.0"
aes-js "3.0.0"
scrypt-js "3.0.1"

"@ethersproject/keccak256@^5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a"
Expand All @@ -336,14 +299,6 @@
dependencies:
"@ethersproject/logger" "^5.7.0"

"@ethersproject/pbkdf2@^5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102"
integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==
dependencies:
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/sha2" "^5.7.0"

"@ethersproject/properties@^5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30"
Expand Down Expand Up @@ -438,27 +393,6 @@
"@ethersproject/rlp" "^5.7.0"
"@ethersproject/signing-key" "^5.7.0"

"@ethersproject/wallet@^5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d"
integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==
dependencies:
"@ethersproject/abstract-provider" "^5.7.0"
"@ethersproject/abstract-signer" "^5.7.0"
"@ethersproject/address" "^5.7.0"
"@ethersproject/bignumber" "^5.7.0"
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/hash" "^5.7.0"
"@ethersproject/hdnode" "^5.7.0"
"@ethersproject/json-wallets" "^5.7.0"
"@ethersproject/keccak256" "^5.7.0"
"@ethersproject/logger" "^5.7.0"
"@ethersproject/properties" "^5.7.0"
"@ethersproject/random" "^5.7.0"
"@ethersproject/signing-key" "^5.7.0"
"@ethersproject/transactions" "^5.7.0"
"@ethersproject/wordlists" "^5.7.0"

"@ethersproject/web@^5.7.0":
version "5.7.1"
resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae"
Expand All @@ -470,17 +404,6 @@
"@ethersproject/properties" "^5.7.0"
"@ethersproject/strings" "^5.7.0"

"@ethersproject/wordlists@^5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5"
integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==
dependencies:
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/hash" "^5.7.0"
"@ethersproject/logger" "^5.7.0"
"@ethersproject/properties" "^5.7.0"
"@ethersproject/strings" "^5.7.0"

"@humanwhocodes/config-array@^0.11.13":
version "0.11.14"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b"
Expand Down Expand Up @@ -895,11 +818,6 @@ acorn@^8.11.3, acorn@^8.9.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a"
integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==

[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d"
integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==

agent-base@^7.0.2, agent-base@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.0.tgz#536802b76bc0b34aa50195eb2442276d613e3434"
Expand Down Expand Up @@ -2187,11 +2105,6 @@ saxes@^6.0.0:
dependencies:
xmlchars "^2.2.0"

[email protected]:
version "3.0.1"
resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312"
integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==

semver@^7.0.0:
version "7.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d"
Expand Down

0 comments on commit b40400c

Please sign in to comment.