@@ -7,17 +7,13 @@ import BigNumber from 'bignumber.js'
77import { useChainUtils } from ' ../../composables/common/useChainUtils' ;
88import { IProps } from ' ./row-transfer-modal.vue' ;
99import AssetWithdrawTokens from ' ./asset-withdraw-tokens.vue' ;
10- import { coins , StdFee } from ' @cosmjs/amino' ;
11- import { ibc , cosmos } from ' osmojs' ;
10+ import { StdFee } from ' @interchainjs/cosmos-types/types' ;
1211import { useStargateClient } from ' ../../composables/common/useStargateClient' ;
13-
14- const {
15- transfer
16- } = ibc .applications .transfer .v1 .MessageComposer .withTypeUrl
12+ import { MsgTransfer } from ' interchainjs/ibc/applications/transfer/v1/tx' ;
1713
1814interface IBodyProps extends IProps {
1915 inputValue: string
20- }
16+ }
2117
2218const props = defineProps <IBodyProps >()
2319const emits = defineEmits <{
@@ -53,8 +49,8 @@ const availableAmount = computed(() => {
5349 if (! isDeposit .value ) return transferToken .value .available ?? 0
5450 console .log (' transferInfo.token' , props .transferInfo .token )
5551 return new BigNumber (
56- convRawToDispAmount (props .transferInfo .token .symbol , balance .value ?.amount || ' 0' )
57- ).toNumber ();
52+ convRawToDispAmount (props .transferInfo .token .symbol , balance .value ?.amount || ' 0' )
53+ ).toNumber ();
5854})
5955
6056const dollarValue = computed (() => {
@@ -67,10 +63,10 @@ const dollarValue = computed(() => {
6763const sourceChain = computed (() => {
6864 const logo_URIs = getChainLogo (sourceChainName .value )
6965 return {
70- name: sourceChainInfo .value .prettyName ,
71- address: sourceAddress .value ?? ' ' ,
72- imgSrc: logo_URIs ?.png || logo_URIs ?.svg || ' ' ,
73- };
66+ name: sourceChainInfo .value .prettyName ,
67+ address: sourceAddress .value ?? ' ' ,
68+ imgSrc: logo_URIs ?.png || logo_URIs ?.svg || ' ' ,
69+ };
7470})
7571
7672const destChain = computed (() => {
@@ -83,18 +79,21 @@ const destChain = computed(() => {
8379 };
8480})
8581
86- const handleSubmitTransfer = async () => {
82+ const handleSubmitTransfer = async () => {
8783 if (! sourceAddress .value || ! destAddress .value ) return ;
8884 const transferAmount = new BigNumber (props .inputValue )
8985 .shiftedBy (getExponentByDenom (symbolToDenom (transferToken .value .symbol )))
9086 .toString ();
91- const { sourcePort, sourceChannel } = getIbcInfo (
87+ const { sourcePort, sourceChannel } = getIbcInfo (
9288 sourceChainName .value ,
9389 destChainName .value
9490 );
9591
9692 const fee: StdFee = {
97- amount: coins (' 1000' , transferToken .value .denom ?? ' ' ),
93+ amount: [{
94+ denom: transferToken .value .denom ?? ' ' ,
95+ amount: ' 1000'
96+ }],
9897 gas: ' 250000' ,
9998 };
10099
@@ -112,16 +111,19 @@ const handleSubmitTransfer = async() => {
112111
113112 let res = await sourceStargazeClient .value .signAndBroadcast (
114113 sourceAddress .value ,
115- [transfer ({
116- sourcePort ,
114+ [{
115+ typeUrl: MsgTransfer .typeUrl ,
116+ value: MsgTransfer .fromPartial ({
117+ sourcePort ,
117118 sourceChannel ,
119+ token ,
118120 sender: sourceAddress .value ,
119121 receiver: destAddress .value ,
120- token ,
121- // @ts-ignore
122122 timeoutHeight: undefined ,
123123 timeoutTimestamp: BigInt (timeoutInNanos ),
124- })],
124+ memo: ' ' ,
125+ }),
126+ }],
125127 fee
126128 )
127129 console .log (' res>>' , res )
@@ -132,13 +134,8 @@ const handleSubmitTransfer = async() => {
132134 </script >
133135
134136<template >
135- <AssetWithdrawTokens
136- :fromImgSrc =" sourceChain.imgSrc"
137- :fromAddress =" sourceChain.address"
138- :toImgSrc =" destChain.imgSrc"
139- :toAddress =" destChain.address"
140- @onTransfer =" handleSubmitTransfer"
141- />
137+ <AssetWithdrawTokens :fromImgSrc =" sourceChain.imgSrc" :fromAddress =" sourceChain.address" :toImgSrc =" destChain.imgSrc"
138+ :toAddress =" destChain.address" @onTransfer =" handleSubmitTransfer" />
142139</template >
143140
144141<style scoped></style >
0 commit comments