Skip to content

Commit 5256203

Browse files
author
Eason Smith
committed
add encoder and convertor
1 parent 8d22b79 commit 5256203

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

examples/ibc-asset-list/hooks/useTx.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import { toast, ToastShape } from '@interchain-ui/react';
55
import { useChain } from '@interchain-kit/react';
66
import { TxRaw } from 'osmo-query/dist/codegen/cosmos/tx/v1beta1/tx';
77
import { assetLists } from '@chain-registry/v2';
8+
import {
9+
toConverters,
10+
toEncoders,
11+
} from '@interchainjs/cosmos/utils';
12+
import { MsgTransfer } from 'interchainjs/ibc/applications/transfer/v1/tx';
813

914
interface Msg {
1015
typeUrl: string;
@@ -47,12 +52,14 @@ export const useTx = (chainName: string) => {
4752
amount: [
4853
{
4954
denom: denomUnit?.denom!,
50-
amount: (BigInt(10 ** (denomUnit?.exponent || 6)) / 100n).toString()
55+
amount: (BigInt(10 ** (denomUnit?.exponent || 6)) / 10n).toString()
5156
}
5257
],
53-
gas: '200000'
58+
gas: '800000'
5459
}
5560
client = await getSigningClient();
61+
client.addEncoders(toEncoders(MsgTransfer))
62+
client.addConverters(toConverters(MsgTransfer))
5663
signed = await client.sign(address, msgs, fee, '');
5764
} catch (e: any) {
5865
console.error(e);
@@ -74,7 +81,7 @@ export const useTx = (chainName: string) => {
7481
if (options.onSuccess) options.onSuccess();
7582
return options.toast?.title || TxStatus.Successful;
7683
} else {
77-
console.error(data?.rawLog);
84+
console.error(data);
7885
return {
7986
message: TxStatus.Failed,
8087
toastType: 'error',

0 commit comments

Comments
 (0)