@mictonode/widget 0.3.16 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +3 -3
- package/.github/workflows/npm-publish.yml +34 -34
- package/.prettierrc.json +9 -9
- package/.vscode/extensions.json +3 -3
- package/LICENSE +674 -674
- package/README.md +41 -41
- package/dist/{main-d0e5d1e4.js → main-bbea3e54.js} +155 -153
- package/dist/ping-widget.js +2 -2
- package/dist/ping-widget.umd.cjs +18 -18
- package/dist/{query.lcd-3d4d3495.js → query.lcd-88036522.js} +1 -1
- package/dist/{query.rpc.Query-b7807c29.js → query.rpc.Query-3a2b14f8.js} +1 -1
- package/dist/{tx.rpc.msg-59c3408a.js → tx.rpc.msg-39f0b824.js} +1 -1
- package/example/.vscode/extensions.json +3 -3
- package/example/README.md +7 -7
- package/example/index.html +12 -12
- package/example/package.json +19 -19
- package/example/pnpm-lock.yaml +465 -465
- package/example/public/cdn.html +19 -19
- package/example/src/App.vue +73 -73
- package/example/src/main.js +4 -4
- package/example/vite.config.js +7 -7
- package/index.html +12 -12
- package/lib/components/ConnectWallet/index.vue +262 -262
- package/lib/components/TokenConvert/index.vue +1033 -1033
- package/lib/components/TokenConvert/tokens.ts +36 -36
- package/lib/components/TxDialog/index.vue +422 -422
- package/lib/components/TxDialog/messages/Delegate.vue +174 -174
- package/lib/components/TxDialog/messages/Deposit.vue +96 -96
- package/lib/components/TxDialog/messages/Redelegate.vue +160 -160
- package/lib/components/TxDialog/messages/Send.vue +142 -142
- package/lib/components/TxDialog/messages/Transfer.vue +248 -248
- package/lib/components/TxDialog/messages/Unbond.vue +103 -103
- package/lib/components/TxDialog/messages/Vote.vue +62 -62
- package/lib/components/TxDialog/messages/Withdraw.vue +55 -55
- package/lib/components/TxDialog/messages/WithdrawCommission.vue +74 -74
- package/lib/components/TxDialog/wasm/ClearAdmin.vue +55 -55
- package/lib/components/TxDialog/wasm/ExecuteContract.vue +98 -98
- package/lib/components/TxDialog/wasm/InstantiateContract.vue +108 -108
- package/lib/components/TxDialog/wasm/MigrateContract.vue +76 -76
- package/lib/components/TxDialog/wasm/MigrateContract2.vue +76 -76
- package/lib/components/TxDialog/wasm/StoreCode.vue +100 -100
- package/lib/components/TxDialog/wasm/UpdateAdmin.vue +74 -74
- package/lib/main.css +591 -7
- package/lib/main.ts +24 -23
- package/lib/utils/TokenUnitConverter.ts +44 -44
- package/lib/utils/format.ts +16 -16
- package/lib/utils/http.ts +154 -154
- package/lib/utils/type.ts +56 -56
- package/lib/wallet/EthermintMessageAdapter.ts +135 -135
- package/lib/wallet/UniClient.ts +144 -144
- package/lib/wallet/Wallet.ts +142 -142
- package/lib/wallet/wallets/KeplerWallet.ts +141 -141
- package/lib/wallet/wallets/LeapWallet.ts +141 -141
- package/lib/wallet/wallets/LedgerWallet.ts +202 -202
- package/lib/wallet/wallets/MetamaskSnapWallet.ts +105 -105
- package/lib/wallet/wallets/MetamaskWallet.ts +173 -173
- package/lib/wallet/wallets/OKXWallet.ts +202 -202
- package/lib/wallet/wallets/UnisatWallet.ts +198 -198
- package/package.json +5 -6
- package/postcss.config.js +6 -6
- package/src/App.vue +225 -225
- package/src/main.ts +7 -4
- package/src/styles/design-system.css +184 -0
- package/src/vite-env.d.ts +1 -1
- package/tailwind.config.js +158 -34
- package/tsconfig.json +25 -25
- package/tsconfig.node.json +10 -10
- package/vite.config.ts +62 -62
- package/vue-shim.d.ts +6 -6
|
@@ -1,248 +1,248 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ComputedRef, PropType, computed, onMounted, ref } from 'vue';
|
|
3
|
-
import { getStakingParam, getDenomTraces } from '../../../utils/http';
|
|
4
|
-
import { Coin, CoinMetadata } from '../../../utils/type';
|
|
5
|
-
import ChainRegistryClient from '@ping-pub/chain-registry-client';
|
|
6
|
-
import { IBCPath } from '@ping-pub/chain-registry-client/dist/types';
|
|
7
|
-
import dayjs from 'dayjs';
|
|
8
|
-
import utc from 'dayjs/plugin/utc';
|
|
9
|
-
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
10
|
-
dayjs.extend(utc);
|
|
11
|
-
|
|
12
|
-
const props = defineProps({
|
|
13
|
-
endpoint: { type: String, required: true },
|
|
14
|
-
sender: { type: String, required: true },
|
|
15
|
-
balances: Object as PropType<Coin[]>,
|
|
16
|
-
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
17
|
-
params: String,
|
|
18
|
-
});
|
|
19
|
-
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
20
|
-
const chainName = params.value.chain_name;
|
|
21
|
-
|
|
22
|
-
const amount = ref('');
|
|
23
|
-
const amountDenom = ref('');
|
|
24
|
-
const recipient = ref('');
|
|
25
|
-
const denom = ref('');
|
|
26
|
-
const dest = ref('');
|
|
27
|
-
const chains = ref([] as IBCPath[]);
|
|
28
|
-
const sourceChain = ref(
|
|
29
|
-
{} as { channel_id: string; port_id: string } | undefined
|
|
30
|
-
);
|
|
31
|
-
const ibcDenomTraces = ref(
|
|
32
|
-
{} as Record<string, { path: string; base_denom: string }>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const client = new ChainRegistryClient();
|
|
36
|
-
|
|
37
|
-
const msgs = computed(() => {
|
|
38
|
-
const timeout = dayjs().add(1, 'hour');
|
|
39
|
-
const convert = new TokenUnitConverter(props.metadata);
|
|
40
|
-
return [
|
|
41
|
-
{
|
|
42
|
-
typeUrl: '/ibc.applications.transfer.v1.MsgTransfer',
|
|
43
|
-
value: {
|
|
44
|
-
sourcePort: sourceChain.value?.port_id || '',
|
|
45
|
-
sourceChannel: sourceChain.value?.channel_id || '',
|
|
46
|
-
token: convert.displayToBase(denom.value, {
|
|
47
|
-
amount: String(amount.value),
|
|
48
|
-
denom: amountDenom.value,
|
|
49
|
-
}),
|
|
50
|
-
sender: props.sender,
|
|
51
|
-
receiver: recipient.value,
|
|
52
|
-
timeoutTimestamp: String(timeout.utc().valueOf() * 1000000),
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
});
|
|
57
|
-
const destDisabled = computed(() => {
|
|
58
|
-
const disable = denom.value.startsWith('ibc/');
|
|
59
|
-
if (disable) dest.value = '';
|
|
60
|
-
return disable;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
function selectDest() {
|
|
64
|
-
client.fetchIBCPathInfo(dest.value).then((info) => {
|
|
65
|
-
if (info.chain_1.chain_name === chainName) {
|
|
66
|
-
sourceChain.value = info.channels.find(
|
|
67
|
-
(x) => x.chain_1.port_id === 'transfer'
|
|
68
|
-
)?.chain_1;
|
|
69
|
-
} else {
|
|
70
|
-
sourceChain.value = info.channels.find(
|
|
71
|
-
(x) => x.chain_2.port_id === 'transfer'
|
|
72
|
-
)?.chain_2;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function updateIBCToken() {
|
|
78
|
-
const hash = String(denom.value).replace('ibc/', '');
|
|
79
|
-
if (!denom.value.startsWith('ibc/')) return;
|
|
80
|
-
if (ibcDenomTraces.value[denom.value]) {
|
|
81
|
-
const trace = ibcDenomTraces.value[denom.value];
|
|
82
|
-
const split = trace.path.split('/');
|
|
83
|
-
sourceChain.value = {
|
|
84
|
-
channel_id: split[1],
|
|
85
|
-
port_id: split[0],
|
|
86
|
-
};
|
|
87
|
-
} else {
|
|
88
|
-
getDenomTraces(props.endpoint, hash).then((trace) => {
|
|
89
|
-
ibcDenomTraces.value[denom.value] = trace.denom_trace;
|
|
90
|
-
const split = trace.denom_trace.path.split('/');
|
|
91
|
-
sourceChain.value = {
|
|
92
|
-
channel_id: split[1],
|
|
93
|
-
port_id: split[0],
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const available = computed(() => {
|
|
100
|
-
const base = props.balances?.find((x) => x.denom === denom.value) || {
|
|
101
|
-
amount: '0',
|
|
102
|
-
denom: '-',
|
|
103
|
-
};
|
|
104
|
-
const convert = new TokenUnitConverter(props.metadata);
|
|
105
|
-
return {
|
|
106
|
-
base,
|
|
107
|
-
display: convert.baseToUnit(base, amountDenom.value),
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const showBalances = computed(() => {
|
|
112
|
-
const convert = new TokenUnitConverter(props.metadata);
|
|
113
|
-
return (
|
|
114
|
-
props.balances?.map((b) => ({
|
|
115
|
-
base: b,
|
|
116
|
-
display: convert.baseToDisplay(b),
|
|
117
|
-
})) || []
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
const units = computed(() => {
|
|
122
|
-
if (!props.metadata || !props.metadata[denom.value]) {
|
|
123
|
-
amountDenom.value = denom.value;
|
|
124
|
-
return [{ denom: denom.value, exponent: 0, aliases: [] }];
|
|
125
|
-
}
|
|
126
|
-
const list = props.metadata[denom.value].denom_units.sort(
|
|
127
|
-
(a, b) => b.exponent - a.exponent
|
|
128
|
-
);
|
|
129
|
-
if (list.length > 0) amountDenom.value = list[0].denom;
|
|
130
|
-
return list;
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const isValid = computed(() => {
|
|
134
|
-
let ok = true;
|
|
135
|
-
let error = '';
|
|
136
|
-
if (!sourceChain.value?.channel_id || !sourceChain.value.port_id) {
|
|
137
|
-
ok = false;
|
|
138
|
-
error = 'Destination chain is empty';
|
|
139
|
-
}
|
|
140
|
-
if (!recipient.value) {
|
|
141
|
-
ok = false;
|
|
142
|
-
error = 'Recipient is empty';
|
|
143
|
-
}
|
|
144
|
-
if (!(Number(amount.value) > 0)) {
|
|
145
|
-
ok = false;
|
|
146
|
-
error = 'Amount should be great than 0';
|
|
147
|
-
}
|
|
148
|
-
return { ok, error };
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
function initial() {
|
|
152
|
-
client.fetchIBCPaths().then((paths) => {
|
|
153
|
-
chains.value = paths.filter((x) => x.path.indexOf(chainName) > -1);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
getStakingParam(props.endpoint).then((x) => {
|
|
157
|
-
denom.value = x.params.bond_denom;
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function formatDenom(v: any) {
|
|
162
|
-
return String(v).substring(0, 10)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
defineExpose({ msgs, isValid, initial });
|
|
166
|
-
</script>
|
|
167
|
-
<template>
|
|
168
|
-
<div>
|
|
169
|
-
<div class="form-control">
|
|
170
|
-
<label class="label">
|
|
171
|
-
<span class="label-text">Sender</span>
|
|
172
|
-
</label>
|
|
173
|
-
<input
|
|
174
|
-
:value="sender"
|
|
175
|
-
type="text"
|
|
176
|
-
class="text-gray-600 dark:text-white input border
|
|
177
|
-
/>
|
|
178
|
-
</div>
|
|
179
|
-
<div class="form-control">
|
|
180
|
-
<label class="label">
|
|
181
|
-
<span class="label-text">Balances</span>
|
|
182
|
-
</label>
|
|
183
|
-
<select
|
|
184
|
-
v-model="denom"
|
|
185
|
-
class="select select-bordered dark:
|
|
186
|
-
@change="updateIBCToken"
|
|
187
|
-
>
|
|
188
|
-
<option value="">Select a token</option>
|
|
189
|
-
<option
|
|
190
|
-
v-for="{ base, display } in showBalances"
|
|
191
|
-
:value="base.denom"
|
|
192
|
-
>
|
|
193
|
-
{{ display.amount }} {{ formatDenom(display.denom) }}
|
|
194
|
-
</option>
|
|
195
|
-
</select>
|
|
196
|
-
</div>
|
|
197
|
-
<div class="form-control">
|
|
198
|
-
<label class="label">
|
|
199
|
-
<span class="label-text">Destination</span>
|
|
200
|
-
<span v-if="sourceChain" class="text-xs"
|
|
201
|
-
>{{ sourceChain.channel_id }}/{{
|
|
202
|
-
sourceChain.port_id
|
|
203
|
-
}}</span
|
|
204
|
-
>
|
|
205
|
-
</label>
|
|
206
|
-
<select
|
|
207
|
-
v-model="dest"
|
|
208
|
-
class="select select-bordered capitalize dark:text-white
|
|
209
|
-
@change="selectDest"
|
|
210
|
-
:disabled="destDisabled"
|
|
211
|
-
>
|
|
212
|
-
<option value="">Select Destination</option>
|
|
213
|
-
<option v-for="v in chains" :value="v.path">
|
|
214
|
-
{{ v.from === params.chain_name ? v.to : v.from }}
|
|
215
|
-
</option>
|
|
216
|
-
</select>
|
|
217
|
-
</div>
|
|
218
|
-
<div class="form-control">
|
|
219
|
-
<label class="label">
|
|
220
|
-
<span class="label-text">Recipient</span>
|
|
221
|
-
</label>
|
|
222
|
-
<input
|
|
223
|
-
v-model="recipient"
|
|
224
|
-
type="text"
|
|
225
|
-
class="input border
|
|
226
|
-
/>
|
|
227
|
-
</div>
|
|
228
|
-
<div class="form-control">
|
|
229
|
-
<label class="label">
|
|
230
|
-
<span class="label-text">Amount</span>
|
|
231
|
-
<span>
|
|
232
|
-
{{ available.display.amount}} {{ formatDenom(available.display.denom) }}
|
|
233
|
-
</span>
|
|
234
|
-
</label>
|
|
235
|
-
<label class="input-group">
|
|
236
|
-
<input
|
|
237
|
-
v-model="amount"
|
|
238
|
-
type="number"
|
|
239
|
-
:placeholder="`Available: ${available?.display.amount}`"
|
|
240
|
-
class="input border
|
|
241
|
-
/>
|
|
242
|
-
<select v-model="amountDenom" class="select select-bordered dark:
|
|
243
|
-
<option v-for="u in units" :value="u.denom">{{ formatDenom(u.denom) }}</option>
|
|
244
|
-
</select>
|
|
245
|
-
</label>
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ComputedRef, PropType, computed, onMounted, ref } from 'vue';
|
|
3
|
+
import { getStakingParam, getDenomTraces } from '../../../utils/http';
|
|
4
|
+
import { Coin, CoinMetadata } from '../../../utils/type';
|
|
5
|
+
import ChainRegistryClient from '@ping-pub/chain-registry-client';
|
|
6
|
+
import { IBCPath } from '@ping-pub/chain-registry-client/dist/types';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import utc from 'dayjs/plugin/utc';
|
|
9
|
+
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
10
|
+
dayjs.extend(utc);
|
|
11
|
+
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
endpoint: { type: String, required: true },
|
|
14
|
+
sender: { type: String, required: true },
|
|
15
|
+
balances: Object as PropType<Coin[]>,
|
|
16
|
+
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
17
|
+
params: String,
|
|
18
|
+
});
|
|
19
|
+
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
20
|
+
const chainName = params.value.chain_name;
|
|
21
|
+
|
|
22
|
+
const amount = ref('');
|
|
23
|
+
const amountDenom = ref('');
|
|
24
|
+
const recipient = ref('');
|
|
25
|
+
const denom = ref('');
|
|
26
|
+
const dest = ref('');
|
|
27
|
+
const chains = ref([] as IBCPath[]);
|
|
28
|
+
const sourceChain = ref(
|
|
29
|
+
{} as { channel_id: string; port_id: string } | undefined
|
|
30
|
+
);
|
|
31
|
+
const ibcDenomTraces = ref(
|
|
32
|
+
{} as Record<string, { path: string; base_denom: string }>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const client = new ChainRegistryClient();
|
|
36
|
+
|
|
37
|
+
const msgs = computed(() => {
|
|
38
|
+
const timeout = dayjs().add(1, 'hour');
|
|
39
|
+
const convert = new TokenUnitConverter(props.metadata);
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
typeUrl: '/ibc.applications.transfer.v1.MsgTransfer',
|
|
43
|
+
value: {
|
|
44
|
+
sourcePort: sourceChain.value?.port_id || '',
|
|
45
|
+
sourceChannel: sourceChain.value?.channel_id || '',
|
|
46
|
+
token: convert.displayToBase(denom.value, {
|
|
47
|
+
amount: String(amount.value),
|
|
48
|
+
denom: amountDenom.value,
|
|
49
|
+
}),
|
|
50
|
+
sender: props.sender,
|
|
51
|
+
receiver: recipient.value,
|
|
52
|
+
timeoutTimestamp: String(timeout.utc().valueOf() * 1000000),
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
});
|
|
57
|
+
const destDisabled = computed(() => {
|
|
58
|
+
const disable = denom.value.startsWith('ibc/');
|
|
59
|
+
if (disable) dest.value = '';
|
|
60
|
+
return disable;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
function selectDest() {
|
|
64
|
+
client.fetchIBCPathInfo(dest.value).then((info) => {
|
|
65
|
+
if (info.chain_1.chain_name === chainName) {
|
|
66
|
+
sourceChain.value = info.channels.find(
|
|
67
|
+
(x) => x.chain_1.port_id === 'transfer'
|
|
68
|
+
)?.chain_1;
|
|
69
|
+
} else {
|
|
70
|
+
sourceChain.value = info.channels.find(
|
|
71
|
+
(x) => x.chain_2.port_id === 'transfer'
|
|
72
|
+
)?.chain_2;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function updateIBCToken() {
|
|
78
|
+
const hash = String(denom.value).replace('ibc/', '');
|
|
79
|
+
if (!denom.value.startsWith('ibc/')) return;
|
|
80
|
+
if (ibcDenomTraces.value[denom.value]) {
|
|
81
|
+
const trace = ibcDenomTraces.value[denom.value];
|
|
82
|
+
const split = trace.path.split('/');
|
|
83
|
+
sourceChain.value = {
|
|
84
|
+
channel_id: split[1],
|
|
85
|
+
port_id: split[0],
|
|
86
|
+
};
|
|
87
|
+
} else {
|
|
88
|
+
getDenomTraces(props.endpoint, hash).then((trace) => {
|
|
89
|
+
ibcDenomTraces.value[denom.value] = trace.denom_trace;
|
|
90
|
+
const split = trace.denom_trace.path.split('/');
|
|
91
|
+
sourceChain.value = {
|
|
92
|
+
channel_id: split[1],
|
|
93
|
+
port_id: split[0],
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const available = computed(() => {
|
|
100
|
+
const base = props.balances?.find((x) => x.denom === denom.value) || {
|
|
101
|
+
amount: '0',
|
|
102
|
+
denom: '-',
|
|
103
|
+
};
|
|
104
|
+
const convert = new TokenUnitConverter(props.metadata);
|
|
105
|
+
return {
|
|
106
|
+
base,
|
|
107
|
+
display: convert.baseToUnit(base, amountDenom.value),
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const showBalances = computed(() => {
|
|
112
|
+
const convert = new TokenUnitConverter(props.metadata);
|
|
113
|
+
return (
|
|
114
|
+
props.balances?.map((b) => ({
|
|
115
|
+
base: b,
|
|
116
|
+
display: convert.baseToDisplay(b),
|
|
117
|
+
})) || []
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const units = computed(() => {
|
|
122
|
+
if (!props.metadata || !props.metadata[denom.value]) {
|
|
123
|
+
amountDenom.value = denom.value;
|
|
124
|
+
return [{ denom: denom.value, exponent: 0, aliases: [] }];
|
|
125
|
+
}
|
|
126
|
+
const list = props.metadata[denom.value].denom_units.sort(
|
|
127
|
+
(a, b) => b.exponent - a.exponent
|
|
128
|
+
);
|
|
129
|
+
if (list.length > 0) amountDenom.value = list[0].denom;
|
|
130
|
+
return list;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const isValid = computed(() => {
|
|
134
|
+
let ok = true;
|
|
135
|
+
let error = '';
|
|
136
|
+
if (!sourceChain.value?.channel_id || !sourceChain.value.port_id) {
|
|
137
|
+
ok = false;
|
|
138
|
+
error = 'Destination chain is empty';
|
|
139
|
+
}
|
|
140
|
+
if (!recipient.value) {
|
|
141
|
+
ok = false;
|
|
142
|
+
error = 'Recipient is empty';
|
|
143
|
+
}
|
|
144
|
+
if (!(Number(amount.value) > 0)) {
|
|
145
|
+
ok = false;
|
|
146
|
+
error = 'Amount should be great than 0';
|
|
147
|
+
}
|
|
148
|
+
return { ok, error };
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
function initial() {
|
|
152
|
+
client.fetchIBCPaths().then((paths) => {
|
|
153
|
+
chains.value = paths.filter((x) => x.path.indexOf(chainName) > -1);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
getStakingParam(props.endpoint).then((x) => {
|
|
157
|
+
denom.value = x.params.bond_denom;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function formatDenom(v: any) {
|
|
162
|
+
return String(v).substring(0, 10)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
defineExpose({ msgs, isValid, initial });
|
|
166
|
+
</script>
|
|
167
|
+
<template>
|
|
168
|
+
<div>
|
|
169
|
+
<div class="form-control">
|
|
170
|
+
<label class="label">
|
|
171
|
+
<span class="label-text">Sender</span>
|
|
172
|
+
</label>
|
|
173
|
+
<input
|
|
174
|
+
:value="sender"
|
|
175
|
+
type="text"
|
|
176
|
+
class="text-gray-600 dark:text-white input border"
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
<div class="form-control">
|
|
180
|
+
<label class="label">
|
|
181
|
+
<span class="label-text">Balances</span>
|
|
182
|
+
</label>
|
|
183
|
+
<select
|
|
184
|
+
v-model="denom"
|
|
185
|
+
class="select select-bordered dark:text-white"
|
|
186
|
+
@change="updateIBCToken"
|
|
187
|
+
>
|
|
188
|
+
<option value="">Select a token</option>
|
|
189
|
+
<option
|
|
190
|
+
v-for="{ base, display } in showBalances"
|
|
191
|
+
:value="base.denom"
|
|
192
|
+
>
|
|
193
|
+
{{ display.amount }} {{ formatDenom(display.denom) }}
|
|
194
|
+
</option>
|
|
195
|
+
</select>
|
|
196
|
+
</div>
|
|
197
|
+
<div class="form-control">
|
|
198
|
+
<label class="label">
|
|
199
|
+
<span class="label-text">Destination</span>
|
|
200
|
+
<span v-if="sourceChain" class="text-xs"
|
|
201
|
+
>{{ sourceChain.channel_id }}/{{
|
|
202
|
+
sourceChain.port_id
|
|
203
|
+
}}</span
|
|
204
|
+
>
|
|
205
|
+
</label>
|
|
206
|
+
<select
|
|
207
|
+
v-model="dest"
|
|
208
|
+
class="select select-bordered capitalize dark:text-white"
|
|
209
|
+
@change="selectDest"
|
|
210
|
+
:disabled="destDisabled"
|
|
211
|
+
>
|
|
212
|
+
<option value="">Select Destination</option>
|
|
213
|
+
<option v-for="v in chains" :value="v.path">
|
|
214
|
+
{{ v.from === params.chain_name ? v.to : v.from }}
|
|
215
|
+
</option>
|
|
216
|
+
</select>
|
|
217
|
+
</div>
|
|
218
|
+
<div class="form-control">
|
|
219
|
+
<label class="label">
|
|
220
|
+
<span class="label-text">Recipient</span>
|
|
221
|
+
</label>
|
|
222
|
+
<input
|
|
223
|
+
v-model="recipient"
|
|
224
|
+
type="text"
|
|
225
|
+
class="input border dark:text-white"
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
<div class="form-control">
|
|
229
|
+
<label class="label">
|
|
230
|
+
<span class="label-text">Amount</span>
|
|
231
|
+
<span>
|
|
232
|
+
{{ available.display.amount}} {{ formatDenom(available.display.denom) }}
|
|
233
|
+
</span>
|
|
234
|
+
</label>
|
|
235
|
+
<label class="input-group">
|
|
236
|
+
<input
|
|
237
|
+
v-model="amount"
|
|
238
|
+
type="number"
|
|
239
|
+
:placeholder="`Available: ${available?.display.amount}`"
|
|
240
|
+
class="input border w-full dark:text-white"
|
|
241
|
+
/>
|
|
242
|
+
<select v-model="amountDenom" class="select select-bordered dark:text-white">
|
|
243
|
+
<option v-for="u in units" :value="u.denom">{{ formatDenom(u.denom) }}</option>
|
|
244
|
+
</select>
|
|
245
|
+
</label>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
</template>
|