-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f2bfe8
commit 4c92cde
Showing
80 changed files
with
431 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,54 @@ | ||
import { | ||
BigNumber, | ||
Bytes, | ||
BytesLike, | ||
ethers, | ||
providers, | ||
Signature, | ||
Signer, | ||
UnsignedTransaction, | ||
utils, | ||
} from 'ethers' | ||
import { ethers } from 'ethers' | ||
import { vi } from 'vitest' | ||
|
||
const Contract = vi.fn().mockImplementation(address => ({ | ||
decimals: () => { | ||
switch (address as string) { | ||
case '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': | ||
return 6 | ||
case '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d': | ||
return 18 | ||
case '0x470e8de2eBaef52014A47Cb5E6aF86884947F08c': | ||
return 18 | ||
case '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': | ||
return 18 | ||
default: | ||
throw new Error(`no decimals mock for address: ${address}`) | ||
} | ||
}, | ||
name: () => { | ||
switch (address as string) { | ||
case '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d': | ||
return 'FOX' | ||
case '0x470e8de2eBaef52014A47Cb5E6aF86884947F08c': | ||
return 'Uniswap V2' | ||
case '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': | ||
return 'Wrapped Ether' | ||
default: | ||
throw new Error(`no decimals mock for address: ${address}`) | ||
} | ||
}, | ||
symbol: () => { | ||
switch (address as string) { | ||
case '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d': | ||
return 'FOX' | ||
case '0x470e8de2eBaef52014A47Cb5E6aF86884947F08c': | ||
return 'UNI-V2' | ||
case '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': | ||
return 'WETH' | ||
default: | ||
throw new Error(`no decimals mock for address: ${address}`) | ||
} | ||
}, | ||
})) | ||
|
||
const JsonRpcProvider = vi.fn() | ||
|
||
const ethersMock = { | ||
...ethers, | ||
providers: { | ||
JsonRpcProvider: vi.fn(), | ||
StaticJsonRpcProvider: vi.fn(), | ||
}, | ||
Contract: vi.fn().mockImplementation(address => ({ | ||
decimals: () => { | ||
switch (address as string) { | ||
case '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': | ||
return 6 | ||
case '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d': | ||
return 18 | ||
case '0x470e8de2eBaef52014A47Cb5E6aF86884947F08c': | ||
return 18 | ||
case '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': | ||
return 18 | ||
default: | ||
throw new Error(`no decimals mock for address: ${address}`) | ||
} | ||
}, | ||
name: () => { | ||
switch (address as string) { | ||
case '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d': | ||
return 'FOX' | ||
case '0x470e8de2eBaef52014A47Cb5E6aF86884947F08c': | ||
return 'Uniswap V2' | ||
case '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': | ||
return 'Wrapped Ether' | ||
default: | ||
throw new Error(`no decimals mock for address: ${address}`) | ||
} | ||
}, | ||
symbol: () => { | ||
switch (address as string) { | ||
case '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d': | ||
return 'FOX' | ||
case '0x470e8de2eBaef52014A47Cb5E6aF86884947F08c': | ||
return 'UNI-V2' | ||
case '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': | ||
return 'WETH' | ||
default: | ||
throw new Error(`no decimals mock for address: ${address}`) | ||
} | ||
}, | ||
})), | ||
JsonRpcProvider, | ||
Contract, | ||
} | ||
|
||
export { | ||
ethersMock as ethers, | ||
BigNumber, | ||
Bytes, | ||
BytesLike, | ||
Signature, | ||
Signer, | ||
UnsignedTransaction, | ||
providers, | ||
utils, | ||
} | ||
export * from 'ethers' | ||
export { ethersMock as ethers, Contract, JsonRpcProvider } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,8 @@ | |
"envalid": "^7.3.1", | ||
"eslint-plugin-react-memo": "^0.0.3", | ||
"eth-url-parser": "^1.0.4", | ||
"ethers": "^5.7.2", | ||
"ethers": "^6.11.1", | ||
"ethers5": "npm:[email protected]", | ||
"framer-motion": "^11.0.3", | ||
"friendly-challenge": "0.9.2", | ||
"grapheme-splitter": "^1.0.4", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/bnbsmartchain/parser/abi/bep20.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/foxyStaking.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/shapeShiftRouter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/thorAvalanche.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/thorEthereum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/uniV2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/uniV2StakingRewards.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/weth.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/unchained-client/src/evm/ethereum/parser/abi/yearnVault.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.