Skip to content

Commit

Permalink
feat: migrated to viem and wagmi v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Argeare5 committed Jan 11, 2024
1 parent ed054de commit 69a742a
Show file tree
Hide file tree
Showing 10 changed files with 1,404 additions and 984 deletions.
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"peerDependencies": {
"immer": "^10.0.3",
"react": "^18.2.0",
"viem": "^1.19.15",
"wagmi": "^1.4.12",
"viem": "^2.0.6",
"wagmi": "^2.1.1",
"zustand": "^4.4.7"
},
"devDependencies": {
Expand All @@ -81,19 +81,20 @@
"eslint-plugin-simple-import-sort": "^10.0.0",
"husky": "^8.0.3",
"immer": "^10.0.3",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"prettier": "^3.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"size-limit": "^11.0.1",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"viem": "^1.9.15",
"wagmi": "^1.4.12",
"zustand": "^4.4.7",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21"
"viem": "^2.0.6",
"wagmi": "^2.1.1",
"zustand": "^4.4.7"
},
"dependencies": {
"@tanstack/react-query": "^5.17.9",
"dayjs": "^1.11.10"
}
}
2 changes: 1 addition & 1 deletion src/types/base.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { PublicClient } from '@wagmi/core';
import { PublicClient } from 'viem';

export type ClientsRecord = Record<number, PublicClient>;
7 changes: 4 additions & 3 deletions src/utils/chainInfoHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PublicClient } from '@wagmi/core';
import { Chain, createPublicClient, http } from 'viem';
import { Chain, createPublicClient, fallback, http, PublicClient } from 'viem';
import {
avalanche,
avalancheFuji,
Expand Down Expand Up @@ -43,7 +42,9 @@ export const initChainInformationConfig = (chains?: Record<number, Chain>) => {
multicall: true,
},
chain,
transport: http(),
transport: fallback(
chain.rpcUrls.default.http.map((url) => http(url)),
),
});
initalizedClients[numberChainId] = client;
return client;
Expand Down
4 changes: 2 additions & 2 deletions src/web3/adapters/EthereumAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { produce } from 'immer';
import { Hex, isHex } from 'viem';
import { Hex, isHex, ReplacementReturnType } from 'viem';

import { setLocalStorageTxPool } from '../../utils/localStorage';
import {
Expand Down Expand Up @@ -76,7 +76,7 @@ export class EthereumAdapter<T extends BaseTx> implements AdapterInterface<T> {
const txn = await client.waitForTransactionReceipt({
pollingInterval: 8_000,
hash: txHash,
onReplaced: (replacement) => {
onReplaced: (replacement: ReplacementReturnType) => {
this.updateTXStatus(txHash, {
status: TransactionStatus.Replaced,
replacedTxHash: replacement.transaction.hash,
Expand Down
Loading

0 comments on commit 69a742a

Please sign in to comment.