You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/sdk/contractkit/MIGRATION-TO-ETHERS.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ provider.getTransaction(...)
60
60
61
61
I'll show the most "basic" interaction, which is a transfer. On CELO, it comes with a twist, you can transfer 4 currencies, CELO, cUSD, cEUR, and cREAL.
62
62
63
-
You can get the addresses on these tokens by heading to the explorer and getting their abi and addresses, or you can also use our [registry contract](https://docs.celo.org/developer/contractkit/contracts-wrappers-registry).
63
+
You can get the addresses on these tokens by heading to the explorer and getting their abi and addresses, or you can also use our [registry contract](https://docs.celo.org/developer/contractkit/contracts-wrappers-registry). You can also use the [`@celo/abis`](https://www.npmjs.com/package/@celo/abis) package to get the ABIs directly.
> [viem does not currently support](<[source](https://viem.sh/docs/ethers-migration.html#viem-11)>) client-side signing (it's coming shortly!) – until then, you can use an Ethers Wallet
40
+
> [viem does not full support](<[source](https://viem.sh/docs/ethers-migration.html#viem-11)>) client-side signing (it's coming shortly!) – until then, you can use an Ethers Wallet, however it does support `signMessage` and `signTypedData` already.
41
41
42
42
```diff
43
+
+ import { privateKeyToAccount } from 'viem/accounts'
44
+
+
45
+
+ const privateKey = "0x...";
43
46
+ const walletClient = createWalletClient({
44
47
+ transport: http(celoAlfajores.rpcUrls.default.http[0] as string),
45
48
+ chain: celoAlfajores,
46
49
+ });
47
-
+ const provider = new JsonRpcProvider(celoAlfajores.rpcUrls.default.http[0]);
48
-
+ const wallet = new Wallet(privateKey, provider);
I'll show the most "basic" interaction, which is a transfer. On CELO, it comes with a twist, you can transfer 4 currencies, CELO, cUSD, cEUR, and cREAL.
75
97
76
-
You can get the addresses on these tokens by heading to the explorer and getting their abi and addresses, or you can also use our [registry contract](https://docs.celo.org/developer/contractkit/contracts-wrappers-registry).
98
+
You can get the addresses on these tokens by heading to the explorer and getting their abi and addresses, or you can also use our [registry contract](https://docs.celo.org/developer/contractkit/contracts-wrappers-registry). You can also use the [`@celo/abis`](https://www.npmjs.com/package/@celo/abis) package to get the ABIs directly.
For more in depth examples, I highly recommend checking out the extensive documentations of both [ethers](https://docs.ethers.org/) and [viem](https://viem.sh/).
162
+
#### Multicall
163
+
164
+
While contractkit didn't directly support multicall, you could use libraries such as `@dopex-io/web3-multicall` as such:
165
+
166
+
```ts
167
+
importMulticallfrom'@dopex-io/web3-multicall'
168
+
const MULTICALL_ADDRESS ='0xcA11bde05977b3631167028862bE2a173976CA11'// same on mainnet and alfajores
For more in depth examples and documentation about viem specifically, I highly recommend checking out the extensive documentations of [viem](https://viem.sh/).
201
+
202
+
Another interesting application to help you migrate could be StCelo-v2.
203
+
You can checkout the changes going from `react-celo` + `contractkit` to `rainbowkit` + `wagmi` + `viem` in [this pull-request](https://github.com/celo-org/staked-celo-web-app/pull/129).
0 commit comments