Closed o-az closed 4 months ago
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L254-L263
we should use the existing evm wagmi config in https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/lib/wallet/evm/config.ts#L40 which uses wagmi/core which handles many things including keeping everything evm-side in sync. Under the hood it uses tanstack query to handle external state.
https://wagmi.sh/core/getting-started
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L269 use this instead: https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/lib/wallet/evm/config.ts#L226 but first include the chains here (bera v2 is also supported https://github.com/wevm/viem/blob/main/src/chains/index.ts): https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/lib/wallet/evm/config.ts#L41
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L259-L263 use this instead: https://wagmi.sh/core/api/actions/getWalletClient
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L254-L257 use this instead: https://wagmi.sh/core/api/actions/getPublicClient
this way it also automatically handles switching chains and this won't be necessary
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L254-L263
we should use the existing evm wagmi config in https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/lib/wallet/evm/config.ts#L40 which uses wagmi/core which handles many things including keeping everything evm-side in sync. Under the hood it uses tanstack query to handle external state.
https://wagmi.sh/core/getting-started
switch chain:
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L269 use this instead: https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/lib/wallet/evm/config.ts#L226 but first include the chains here (bera v2 is also supported https://github.com/wevm/viem/blob/main/src/chains/index.ts): https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/lib/wallet/evm/config.ts#L41
wallet client:
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L259-L263 use this instead: https://wagmi.sh/core/api/actions/getWalletClient
public client:
https://github.com/unionlabs/union/blob/7a9a914ba928c23cefc439ded97b7356350ad272/app/src/routes/transfer/(components)/transfer-form.svelte#L254-L257 use this instead: https://wagmi.sh/core/api/actions/getPublicClient