@@ -7,17 +7,13 @@ import BigNumber from 'bignumber.js'
7
7
import { useChainUtils } from ' ../../composables/common/useChainUtils' ;
8
8
import { IProps } from ' ./row-transfer-modal.vue' ;
9
9
import 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' ;
12
11
import { 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' ;
17
13
18
14
interface IBodyProps extends IProps {
19
15
inputValue: string
20
- }
16
+ }
21
17
22
18
const props = defineProps <IBodyProps >()
23
19
const emits = defineEmits <{
@@ -53,8 +49,8 @@ const availableAmount = computed(() => {
53
49
if (! isDeposit .value ) return transferToken .value .available ?? 0
54
50
console .log (' transferInfo.token' , props .transferInfo .token )
55
51
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 ();
58
54
})
59
55
60
56
const dollarValue = computed (() => {
@@ -67,10 +63,10 @@ const dollarValue = computed(() => {
67
63
const sourceChain = computed (() => {
68
64
const logo_URIs = getChainLogo (sourceChainName .value )
69
65
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
+ };
74
70
})
75
71
76
72
const destChain = computed (() => {
@@ -83,18 +79,21 @@ const destChain = computed(() => {
83
79
};
84
80
})
85
81
86
- const handleSubmitTransfer = async () => {
82
+ const handleSubmitTransfer = async () => {
87
83
if (! sourceAddress .value || ! destAddress .value ) return ;
88
84
const transferAmount = new BigNumber (props .inputValue )
89
85
.shiftedBy (getExponentByDenom (symbolToDenom (transferToken .value .symbol )))
90
86
.toString ();
91
- const { sourcePort, sourceChannel } = getIbcInfo (
87
+ const { sourcePort, sourceChannel } = getIbcInfo (
92
88
sourceChainName .value ,
93
89
destChainName .value
94
90
);
95
91
96
92
const fee: StdFee = {
97
- amount: coins (' 1000' , transferToken .value .denom ?? ' ' ),
93
+ amount: [{
94
+ denom: transferToken .value .denom ?? ' ' ,
95
+ amount: ' 1000'
96
+ }],
98
97
gas: ' 250000' ,
99
98
};
100
99
@@ -112,16 +111,19 @@ const handleSubmitTransfer = async() => {
112
111
113
112
let res = await sourceStargazeClient .value .signAndBroadcast (
114
113
sourceAddress .value ,
115
- [transfer ({
116
- sourcePort ,
114
+ [{
115
+ typeUrl: MsgTransfer .typeUrl ,
116
+ value: MsgTransfer .fromPartial ({
117
+ sourcePort ,
117
118
sourceChannel ,
119
+ token ,
118
120
sender: sourceAddress .value ,
119
121
receiver: destAddress .value ,
120
- token ,
121
- // @ts-ignore
122
122
timeoutHeight: undefined ,
123
123
timeoutTimestamp: BigInt (timeoutInNanos ),
124
- })],
124
+ memo: ' ' ,
125
+ }),
126
+ }],
125
127
fee
126
128
)
127
129
console .log (' res>>' , res )
@@ -132,13 +134,8 @@ const handleSubmitTransfer = async() => {
132
134
</script >
133
135
134
136
<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" />
142
139
</template >
143
140
144
141
<style scoped></style >
0 commit comments