@mictonode/widget 0.3.23 → 0.3.24
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/dist/{ConstantsUtil-f9dc60b6.js → ConstantsUtil-69f4aadb.js} +3 -3
- package/dist/{ConstantsUtil-fb0ff2e5.js → ConstantsUtil-ffeefb33.js} +1 -1
- package/dist/{ExchangeController-173fd1dc.js → ExchangeController-920db609.js} +2 -2
- package/dist/{HelpersUtil-4891ff5f.js → HelpersUtil-e60d77c2.js} +4 -4
- package/dist/{ReownAuthentication-bba89dc5.js → ReownAuthentication-a05128a9.js} +2 -2
- package/dist/{SwapController-e8b097ca.js → SwapController-3307b7d5.js} +3 -3
- package/dist/{abis-96fed285.js → abis-5e7391e2.js} +1 -1
- package/dist/{assertCurrentChain-b60aa59f.js → assertCurrentChain-42cdea0e.js} +1 -1
- package/dist/{ccip-8f82ae2a.js → ccip-b3df1d28.js} +6 -6
- package/dist/{data-capture-7009ffa0.js → data-capture-6b7e5c19.js} +8 -8
- package/dist/{email-d6e2da58.js → email-5c6fce3f.js} +12 -12
- package/dist/{embedded-wallet-48284179.js → embedded-wallet-87192e5a.js} +14 -14
- package/dist/{encodeFunctionData-b24a0b2b.js → encodeFunctionData-929ae2a4.js} +2 -2
- package/dist/{fallback-ae0315d4.js → fallback-366fc17d.js} +2 -2
- package/dist/features-cf9f5cda.js +8 -0
- package/dist/{hashTypedData-c13ba550.js → hashTypedData-f86861cf.js} +2 -2
- package/dist/{http-90ef23f3.js → http-b4045adf.js} +2 -2
- package/dist/{index-3de7fa96.js → index-0313c561.js} +3 -3
- package/dist/{index-4bd03aed.js → index-0d05a79e.js} +7 -7
- package/dist/{index-b8e2c282.js → index-1450179f.js} +3 -3
- package/dist/{index-bb5e4071.js → index-20c073be.js} +1 -1
- package/dist/{index-b37b670f.js → index-23d992c9.js} +11 -11
- package/dist/{index-ce6854ef.js → index-2b5ce2e7.js} +14 -14
- package/dist/{index-cb69565e.js → index-2b935b7c.js} +2 -2
- package/dist/{index-bf40b971.js → index-311166f4.js} +2 -2
- package/dist/{index-cbb6096a.js → index-3d20f99e.js} +3 -3
- package/dist/{index-0ac134af.js → index-4552387b.js} +34 -34
- package/dist/{index-2a90711e.js → index-48fbe63e.js} +2 -2
- package/dist/{index-617b2147.js → index-4d538f05.js} +6 -6
- package/dist/{index-577d2709.js → index-4ecd4250.js} +4 -4
- package/dist/{index-95777860.js → index-50a00b25.js} +7 -7
- package/dist/{index-582e4199.js → index-566c48ac.js} +7 -7
- package/dist/{index-270ff8a2.js → index-58f616f1.js} +11 -11
- package/dist/{index-d7e2a4a3.js → index-5ae39b48.js} +2 -2
- package/dist/{index-6d51f24f.js → index-5f3d0c2f.js} +2 -2
- package/dist/{index-6a0902fc.js → index-6f8bfdd4.js} +2 -2
- package/dist/{index-997bc756.js → index-806b59ae.js} +2 -2
- package/dist/{index-96729706.js → index-8327440a.js} +13 -13
- package/dist/{index-80954332.js → index-986ea4f3.js} +3 -3
- package/dist/{index-2de6c5bf.js → index-9ee4129a.js} +4 -4
- package/dist/{index-f886cf92.js → index-a16b0b1a.js} +2 -2
- package/dist/{index-29eb95bd.js → index-a84fb2d4.js} +3 -3
- package/dist/{index-a41841e6.js → index-a8cfb216.js} +3 -3
- package/dist/{index-19f302c4.js → index-acb4d6e1.js} +3 -3
- package/dist/{index-f4cd8dd1.js → index-bc8dc6e6.js} +3 -3
- package/dist/{index-22727038.js → index-be60697a.js} +3 -3
- package/dist/{index-e7fbb597.js → index-cf5dc9e0.js} +4 -4
- package/dist/{index-faade258.js → index-d29e5bfc.js} +3 -3
- package/dist/{index-52edc95a.js → index-d333ef20.js} +2 -2
- package/dist/{index-42a8a5ec.js → index-d5d48d61.js} +15 -15
- package/dist/{index-adaa2ea4.js → index-f706ea18.js} +3 -3
- package/dist/{localBatchGatewayRequest-ade4aa2f.js → localBatchGatewayRequest-bd902016.js} +3 -3
- package/dist/{main-3b573cfc.js → main-cce20875.js} +42707 -42613
- package/dist/{networks-446d3512.js → networks-fcbf0c74.js} +10 -10
- package/dist/{onramp-57d19c5d.js → onramp-eb02e46e.js} +19 -19
- package/dist/{parseSignature-783d626a.js → parseSignature-0f866446.js} +8 -8
- package/dist/{pay-with-exchange-c59a5773.js → pay-with-exchange-5073a468.js} +22 -22
- package/dist/ping-widget.js +1 -1
- package/dist/ping-widget.umd.cjs +727 -727
- package/dist/{query.lcd-447fb91a.js → query.lcd-cefcdaf4.js} +1 -1
- package/dist/{query.rpc.Query-97503d87.js → query.rpc.Query-f2981fc7.js} +1 -1
- package/dist/{receive-3073a49d.js → receive-11a25c5f.js} +6 -6
- package/dist/{ref-6c3aabc7.js → ref-7866a390.js} +2 -2
- package/dist/{send-42403797.js → send-a8333bb0.js} +22 -22
- package/dist/{serializeAuthorizationList-70ec977c.js → serializeAuthorizationList-b5a1a7f6.js} +4 -4
- package/dist/{sha2-249ae7eb.js → sha2-fb4e167b.js} +2 -2
- package/dist/{socials-69b0cf18.js → socials-3184225d.js} +18 -18
- package/dist/{swaps-4e99bb0f.js → swaps-196b9a1a.js} +18 -18
- package/dist/{transactions-1d0c2669.js → transactions-cb14f528.js} +9 -9
- package/dist/{tx.rpc.msg-a26b3557.js → tx.rpc.msg-c784af37.js} +1 -1
- package/dist/{tx.rpc.msg-8aa727ea.js → tx.rpc.msg-ca20b10a.js} +1 -1
- package/dist/{verifyHash-c8962067.js → verifyHash-fa9728b0.js} +5 -5
- package/dist/{vue-9dc93a14.js → vue-634e8253.js} +10 -10
- package/dist/{w3m-modal-291afec4.js → w3m-modal-7b0a1b01.js} +25 -25
- package/dist/{zora-061565b0.js → zora-e0295798.js} +4 -4
- package/lib/components/ConnectWallet/index.vue +38 -18
- package/lib/components/TokenConvert/index.vue +0 -2
- package/lib/components/TxDialog/index.vue +40 -20
- package/lib/components/TxDialog/messages/Delegate.vue +8 -2
- package/lib/components/TxDialog/messages/Deposit.vue +9 -3
- package/lib/components/TxDialog/messages/Redelegate.vue +10 -3
- package/lib/components/TxDialog/messages/Send.vue +7 -2
- package/lib/components/TxDialog/messages/Transfer.vue +8 -2
- package/lib/components/TxDialog/messages/Unbond.vue +9 -3
- package/lib/components/TxDialog/messages/Vote.vue +9 -3
- package/lib/components/TxDialog/messages/Withdraw.vue +7 -2
- package/lib/components/TxDialog/messages/WithdrawCommission.vue +10 -3
- package/lib/components/TxDialog/txParams.ts +30 -0
- package/lib/components/TxDialog/wasm/ClearAdmin.vue +10 -3
- package/lib/components/TxDialog/wasm/ExecuteContract.vue +11 -5
- package/lib/components/TxDialog/wasm/InstantiateContract.vue +9 -3
- package/lib/components/TxDialog/wasm/MigrateContract.vue +10 -3
- package/lib/components/TxDialog/wasm/MigrateContract2.vue +10 -3
- package/lib/components/TxDialog/wasm/StoreCode.vue +6 -2
- package/lib/components/TxDialog/wasm/UpdateAdmin.vue +10 -3
- package/lib/wallet/UniClient.ts +0 -1
- package/lib/wallet/WalletError.ts +110 -29
- package/package.json +1 -1
- package/test/components/ConnectWallet.test.ts +68 -9
- package/test/components/TxDialogParams.test.ts +23 -0
- package/test/components/TxDialogSecurity.test.ts +154 -0
- package/test/wallet/WalletError.test.ts +38 -14
- package/test/wallet/WalletSecurity.test.ts +19 -14
- package/dist/features-82db0d52.js +0 -8
|
@@ -10,10 +10,11 @@ import {
|
|
|
10
10
|
getTxByHash,
|
|
11
11
|
} from '../../utils/http';
|
|
12
12
|
import { BroadcastMode, Coin, CoinMetadata } from '../../utils/type';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { isEvmChain } from '../../../lib/wallet/Wallet';
|
|
14
|
+
import { normalizeWalletError } from '../../../lib/wallet/WalletError';
|
|
15
15
|
import { createSessionClient } from '../../../lib/wallet/SessionClient';
|
|
16
16
|
import { calculateFeeAmount } from './fee';
|
|
17
|
+
import { parseTxParams } from './txParams';
|
|
17
18
|
|
|
18
19
|
// cosmos sdk messages
|
|
19
20
|
import Delegate from './messages/Delegate.vue';
|
|
@@ -90,7 +91,9 @@ const metadatas = ref({} as Record<string, CoinMetadata>);
|
|
|
90
91
|
const emit = defineEmits(['submited', 'confirmed', 'view']);
|
|
91
92
|
|
|
92
93
|
// functional variable
|
|
93
|
-
const
|
|
94
|
+
const parsedParams = computed(() => parseTxParams(props.params));
|
|
95
|
+
const invalidParamsMessage = 'Transaction parameters are invalid';
|
|
96
|
+
const p = ref<{ fees?: Coin }>({});
|
|
94
97
|
const view = ref('input'); // input, submitting
|
|
95
98
|
const open = ref(false);
|
|
96
99
|
const error = ref('');
|
|
@@ -110,10 +113,18 @@ const chainId = ref('cosmoshub-4');
|
|
|
110
113
|
const broadcast = ref(BroadcastMode.SYNC);
|
|
111
114
|
|
|
112
115
|
async function initData() {
|
|
116
|
+
sending.value = false;
|
|
117
|
+
error.value = '';
|
|
118
|
+
p.value = parsedParams.value.value as { fees?: Coin };
|
|
119
|
+
|
|
120
|
+
if (parsedParams.value.issue) {
|
|
121
|
+
error.value = invalidParamsMessage;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
113
125
|
if (open.value && props.endpoint && props.sender) {
|
|
114
126
|
metadatas.value = {}
|
|
115
127
|
view.value = 'input';
|
|
116
|
-
p.value = JSON.parse(props.params || '{}')
|
|
117
128
|
memo.value = props.type?.toLowerCase() === 'send' ? '' : 'mictonode.com'
|
|
118
129
|
|
|
119
130
|
feeAmount.value = Number(p.value?.fees?.amount || 2000)
|
|
@@ -150,9 +161,7 @@ async function initData() {
|
|
|
150
161
|
x.assets.forEach(a => {
|
|
151
162
|
metadatas.value[a.base] = a as CoinMetadata
|
|
152
163
|
})
|
|
153
|
-
}).catch(() => {
|
|
154
|
-
console.log(`Chain: ${props.registryName } was not found on Cosmos Registry`)
|
|
155
|
-
})
|
|
164
|
+
}).catch(() => {})
|
|
156
165
|
}
|
|
157
166
|
getLatestBlock(props.endpoint).then((x) => {
|
|
158
167
|
chainId.value = x.block.header.chain_id;
|
|
@@ -182,13 +191,29 @@ async function initData() {
|
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
async function sendTx() {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (!msgBox.value.isValid.ok)
|
|
190
|
-
throw new Error(msgBox.value.isValid.error);
|
|
194
|
+
if (parsedParams.value.issue) {
|
|
195
|
+
error.value = invalidParamsMessage;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
191
198
|
|
|
199
|
+
if (!props.sender) {
|
|
200
|
+
error.value = 'Sender should not be empty!';
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (!props.endpoint) {
|
|
204
|
+
error.value = 'Endpoint is empty';
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (!feeDenom.value) {
|
|
208
|
+
error.value = 'Fee Denom is empty';
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (!msgBox.value.isValid.ok) {
|
|
212
|
+
error.value = msgBox.value.isValid.error;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
try {
|
|
192
217
|
const client = createSessionClient(props.hdPath, {
|
|
193
218
|
chainId: chainId.value,
|
|
194
219
|
});
|
|
@@ -216,8 +241,6 @@ async function sendTx() {
|
|
|
216
241
|
},
|
|
217
242
|
preserveFee: props.gasPrice !== undefined,
|
|
218
243
|
};
|
|
219
|
-
// console.log('tx:', tx);
|
|
220
|
-
|
|
221
244
|
if(!advance.value) {
|
|
222
245
|
await client.simulate(props.endpoint, tx, broadcast.value).then(gas => {
|
|
223
246
|
// update tx gas
|
|
@@ -248,10 +271,7 @@ async function sendTx() {
|
|
|
248
271
|
});
|
|
249
272
|
} catch (cause) {
|
|
250
273
|
sending.value = false;
|
|
251
|
-
error.value =
|
|
252
|
-
cause,
|
|
253
|
-
readWallet(props.hdPath).wallet
|
|
254
|
-
);
|
|
274
|
+
error.value = normalizeWalletError(cause).message;
|
|
255
275
|
}
|
|
256
276
|
}
|
|
257
277
|
|
|
@@ -324,7 +344,7 @@ function fetchTx(tx: string) {
|
|
|
324
344
|
<div v-if="sender">
|
|
325
345
|
<div v-if="view === 'input'">
|
|
326
346
|
<component :is="msgType" ref="msgBox" :endpoint="endpoint" :sender="sender" :balances="balance"
|
|
327
|
-
:metadata="metadatas" :params="
|
|
347
|
+
:metadata="metadatas" :params="parsedParams.value" />
|
|
328
348
|
<form class="space-y-6" action="#" method="POST">
|
|
329
349
|
<div :class="advance ? '' : 'hidden'">
|
|
330
350
|
<div class="form-control">
|
|
@@ -8,15 +8,21 @@ import {
|
|
|
8
8
|
import { decimal2percent } from '../../../utils/format';
|
|
9
9
|
import { Coin, CoinMetadata } from '../../../utils/type';
|
|
10
10
|
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
11
|
+
import type { TxParams } from '../txParams';
|
|
12
|
+
|
|
13
|
+
type ValidatorParams = { validator_address?: string };
|
|
11
14
|
|
|
12
15
|
const props = defineProps({
|
|
13
16
|
endpoint: { type: String, required: true },
|
|
14
17
|
sender: { type: String, required: true },
|
|
15
18
|
balances: Object as PropType<Coin[]>,
|
|
16
19
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
17
|
-
params:
|
|
20
|
+
params: {
|
|
21
|
+
type: Object as PropType<TxParams>,
|
|
22
|
+
default: () => ({}),
|
|
23
|
+
},
|
|
18
24
|
});
|
|
19
|
-
const params = computed(() =>
|
|
25
|
+
const params = computed(() => props.params as ValidatorParams);
|
|
20
26
|
|
|
21
27
|
const validator = ref('');
|
|
22
28
|
|
|
@@ -3,16 +3,22 @@ import { PropType, computed, onMounted, ref } from 'vue';
|
|
|
3
3
|
import { Coin, CoinMetadata } from '../../../utils/type';
|
|
4
4
|
import { getStakingParam } from '../../../utils/http';
|
|
5
5
|
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
6
|
+
import type { TxParams } from '../txParams';
|
|
7
|
+
|
|
8
|
+
type ProposalParams = { proposal_id?: string | number };
|
|
6
9
|
|
|
7
10
|
const props = defineProps({
|
|
8
11
|
endpoint: {type: String, required: true },
|
|
9
12
|
sender: {type: String, required: true},
|
|
10
13
|
balances: Object as PropType<Coin[]>,
|
|
11
14
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
12
|
-
params:
|
|
15
|
+
params: {
|
|
16
|
+
type: Object as PropType<TxParams>,
|
|
17
|
+
default: () => ({}),
|
|
18
|
+
},
|
|
13
19
|
});
|
|
14
20
|
|
|
15
|
-
const params = computed(() =>
|
|
21
|
+
const params = computed(() => props.params as ProposalParams)
|
|
16
22
|
const denom = ref("")
|
|
17
23
|
const amount = ref("")
|
|
18
24
|
const amountDenom = ref("")
|
|
@@ -94,4 +100,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
94
100
|
</label>
|
|
95
101
|
</div>
|
|
96
102
|
</div>
|
|
97
|
-
</template>
|
|
103
|
+
</template>
|
|
@@ -4,14 +4,21 @@ import { getActiveValidators, getDelegations, getInactiveValidators, getStakingP
|
|
|
4
4
|
import { decimal2percent } from '../../../utils/format'
|
|
5
5
|
import { Coin, CoinMetadata } from '../../../utils/type';
|
|
6
6
|
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
7
|
+
import type { TxParams } from '../txParams';
|
|
8
|
+
|
|
9
|
+
type ValidatorParams = { validator_address?: string };
|
|
10
|
+
|
|
7
11
|
const props = defineProps({
|
|
8
12
|
endpoint: {type: String, required: true },
|
|
9
13
|
sender: {type: String, required: true},
|
|
10
14
|
balances: Object as PropType<Coin[]>,
|
|
11
15
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
12
|
-
params:
|
|
16
|
+
params: {
|
|
17
|
+
type: Object as PropType<TxParams>,
|
|
18
|
+
default: () => ({}),
|
|
19
|
+
},
|
|
13
20
|
});
|
|
14
|
-
const params = computed(() =>
|
|
21
|
+
const params = computed(() => props.params as ValidatorParams)
|
|
15
22
|
|
|
16
23
|
const validator = ref('')
|
|
17
24
|
|
|
@@ -158,4 +165,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
158
165
|
{{ error }}
|
|
159
166
|
</div>
|
|
160
167
|
</div>
|
|
161
|
-
</template>
|
|
168
|
+
</template>
|
|
@@ -5,12 +5,16 @@ import {
|
|
|
5
5
|
} from '../../../utils/http';
|
|
6
6
|
import { Coin, CoinMetadata } from '../../../utils/type';
|
|
7
7
|
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
8
|
+
import type { TxParams } from '../txParams';
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
endpoint: { type: String, required: true },
|
|
10
11
|
sender: { type: String, required: true },
|
|
11
12
|
balances: Object as PropType<Coin[]>,
|
|
12
13
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
13
|
-
params:
|
|
14
|
+
params: {
|
|
15
|
+
type: Object as PropType<TxParams>,
|
|
16
|
+
default: () => ({}),
|
|
17
|
+
},
|
|
14
18
|
});
|
|
15
19
|
|
|
16
20
|
const amount = ref('');
|
|
@@ -85,7 +89,8 @@ const isValid = computed(() => {
|
|
|
85
89
|
|
|
86
90
|
|
|
87
91
|
function initial() {
|
|
88
|
-
denom.value =
|
|
92
|
+
denom.value =
|
|
93
|
+
(props.params.fees as { denom?: string } | undefined)?.denom || '';
|
|
89
94
|
// getStakingParam(props.endpoint).then((x) => {
|
|
90
95
|
// denom.value = x.params?.bond_denom;
|
|
91
96
|
// });
|
|
@@ -7,16 +7,22 @@ import { IBCPath } from '@ping-pub/chain-registry-client/dist/types';
|
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import utc from 'dayjs/plugin/utc';
|
|
9
9
|
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
10
|
+
import type { TxParams } from '../txParams';
|
|
10
11
|
dayjs.extend(utc);
|
|
11
12
|
|
|
13
|
+
type TransferParams = { chain_name?: string };
|
|
14
|
+
|
|
12
15
|
const props = defineProps({
|
|
13
16
|
endpoint: { type: String, required: true },
|
|
14
17
|
sender: { type: String, required: true },
|
|
15
18
|
balances: Object as PropType<Coin[]>,
|
|
16
19
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
17
|
-
params:
|
|
20
|
+
params: {
|
|
21
|
+
type: Object as PropType<TxParams>,
|
|
22
|
+
default: () => ({}),
|
|
23
|
+
},
|
|
18
24
|
});
|
|
19
|
-
const params = computed(() =>
|
|
25
|
+
const params = computed(() => props.params as TransferParams)
|
|
20
26
|
const chainName = params.value.chain_name;
|
|
21
27
|
|
|
22
28
|
const amount = ref('');
|
|
@@ -3,15 +3,21 @@ import { PropType, computed, onMounted, ref } from 'vue';
|
|
|
3
3
|
import { getDelegations } from '../../../utils/http'
|
|
4
4
|
import { Coin, CoinMetadata } from '../../../utils/type';
|
|
5
5
|
import { TokenUnitConverter } from '../../../utils/TokenUnitConverter';
|
|
6
|
+
import type { TxParams } from '../txParams';
|
|
7
|
+
|
|
8
|
+
type ValidatorParams = { validator_address?: string };
|
|
6
9
|
|
|
7
10
|
const props = defineProps({
|
|
8
11
|
endpoint: {type: String, required: true },
|
|
9
12
|
sender: {type: String, required: true},
|
|
10
13
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
11
|
-
params:
|
|
14
|
+
params: {
|
|
15
|
+
type: Object as PropType<TxParams>,
|
|
16
|
+
default: () => ({}),
|
|
17
|
+
},
|
|
12
18
|
});
|
|
13
19
|
|
|
14
|
-
const params = computed(() =>
|
|
20
|
+
const params = computed(() => props.params as ValidatorParams)
|
|
15
21
|
const delegation = ref({} as {balance: Coin, delegation: {delegator_address: string, shares: string, validator_address: string}})
|
|
16
22
|
const amount = ref("")
|
|
17
23
|
const amountDenom = ref("")
|
|
@@ -101,4 +107,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
101
107
|
</div>
|
|
102
108
|
<div class="text-error">{{ error }}</div>
|
|
103
109
|
</div>
|
|
104
|
-
</template>
|
|
110
|
+
</template>
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { PropType, computed, ref } from 'vue';
|
|
3
3
|
import { CoinMetadata } from '../../../utils/type';
|
|
4
|
+
import type { TxParams } from '../txParams';
|
|
5
|
+
|
|
6
|
+
type ProposalParams = { proposal_id?: string | number };
|
|
4
7
|
|
|
5
8
|
const props = defineProps({
|
|
6
9
|
endpoint: { type: String, required: true },
|
|
7
10
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
11
|
+
params: {
|
|
12
|
+
type: Object as PropType<TxParams>,
|
|
13
|
+
default: () => ({}),
|
|
14
|
+
},
|
|
9
15
|
});
|
|
10
16
|
|
|
11
|
-
const params = computed(() =>
|
|
17
|
+
const params = computed(() => props.params as ProposalParams)
|
|
12
18
|
const option = ref("1")
|
|
13
19
|
|
|
14
20
|
const msgs = computed(() => {
|
|
@@ -60,4 +66,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
60
66
|
</div>
|
|
61
67
|
</div>
|
|
62
68
|
</div>
|
|
63
|
-
</template>
|
|
69
|
+
</template>
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, onMounted, ref } from 'vue';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
3
4
|
import { getDelegateRewards } from '../../../utils/http'
|
|
5
|
+
import type { TxParams } from '../txParams';
|
|
4
6
|
|
|
5
7
|
const props = defineProps({
|
|
6
8
|
endpoint: { type: String, required: true },
|
|
7
9
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
10
|
+
params: {
|
|
11
|
+
type: Object as PropType<TxParams>,
|
|
12
|
+
default: () => ({}),
|
|
13
|
+
},
|
|
9
14
|
});
|
|
10
15
|
|
|
11
16
|
const rewards = ref([] as { reward: { amount: string, denom: string }, validator_address: string }[])
|
|
@@ -53,4 +58,4 @@ defineExpose({ msgs, isValid, initial })
|
|
|
53
58
|
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border" />
|
|
54
59
|
</div>
|
|
55
60
|
</div>
|
|
56
|
-
</template>
|
|
61
|
+
</template>
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
3
4
|
import { getDelegateRewards } from '../../../utils/http';
|
|
5
|
+
import type { TxParams } from '../txParams';
|
|
6
|
+
|
|
7
|
+
type ValidatorParams = { validator_address?: string };
|
|
4
8
|
|
|
5
9
|
const props = defineProps({
|
|
6
10
|
endpoint: { type: String, required: true },
|
|
7
11
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
12
|
+
params: {
|
|
13
|
+
type: Object as PropType<TxParams>,
|
|
14
|
+
default: () => ({}),
|
|
15
|
+
},
|
|
9
16
|
});
|
|
10
17
|
|
|
11
|
-
const params = computed(() =>
|
|
18
|
+
const params = computed(() => props.params as ValidatorParams)
|
|
12
19
|
const rewards = ref([] as { reward: { amount: string, denom: string }, validator_address: string }[])
|
|
13
20
|
|
|
14
21
|
const msgs = computed(() => {
|
|
@@ -72,4 +79,4 @@ defineExpose({ msgs, isValid, initial })
|
|
|
72
79
|
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border" />
|
|
73
80
|
</div>
|
|
74
81
|
</div>
|
|
75
|
-
</template>
|
|
82
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type TxParams = Record<string, unknown>;
|
|
2
|
+
export type TxParamsIssue = 'invalid-json' | 'invalid-shape';
|
|
3
|
+
|
|
4
|
+
export interface TxParamsResult {
|
|
5
|
+
value: TxParams;
|
|
6
|
+
issue?: TxParamsIssue;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isTxParams(value: unknown): value is TxParams {
|
|
10
|
+
return (
|
|
11
|
+
typeof value === 'object' &&
|
|
12
|
+
value !== null &&
|
|
13
|
+
!Array.isArray(value)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function parseTxParams(raw?: string): TxParamsResult {
|
|
18
|
+
if (!raw?.trim()) return { value: {} };
|
|
19
|
+
|
|
20
|
+
let parsed: unknown;
|
|
21
|
+
try {
|
|
22
|
+
parsed = JSON.parse(raw);
|
|
23
|
+
} catch {
|
|
24
|
+
return { value: {}, issue: 'invalid-json' };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return isTxParams(parsed)
|
|
28
|
+
? { value: parsed }
|
|
29
|
+
: { value: {}, issue: 'invalid-shape' };
|
|
30
|
+
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
3
4
|
import { toBase64 } from '@cosmjs/encoding'
|
|
5
|
+
import type { TxParams } from '../txParams';
|
|
6
|
+
|
|
7
|
+
type ContractParams = { contract?: string };
|
|
4
8
|
|
|
5
9
|
const props = defineProps({
|
|
6
10
|
endpoint: { type: String, required: true },
|
|
7
11
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
12
|
+
params: {
|
|
13
|
+
type: Object as PropType<TxParams>,
|
|
14
|
+
default: () => ({}),
|
|
15
|
+
},
|
|
9
16
|
});
|
|
10
17
|
|
|
11
|
-
const params = computed(() =>
|
|
18
|
+
const params = computed(() => props.params as ContractParams)
|
|
12
19
|
|
|
13
20
|
const msgs = computed(() => {
|
|
14
21
|
return [{
|
|
@@ -53,4 +60,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
53
60
|
<input type="text" readonly class="text-gray-600 dark:text-white input border" :value="params.contract" />
|
|
54
61
|
</div>
|
|
55
62
|
</div>
|
|
56
|
-
</template>
|
|
63
|
+
</template>
|
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
import { Coin } from '@cosmjs/amino';
|
|
3
3
|
import { PropType, computed, ref } from 'vue';
|
|
4
4
|
import type { CoinMetadata } from '../../../utils/type';
|
|
5
|
+
import type { TxParams } from '../txParams';
|
|
6
|
+
|
|
7
|
+
type ExecuteParams = { contract?: string; execution?: unknown };
|
|
5
8
|
|
|
6
9
|
const props = defineProps({
|
|
7
10
|
endpoint: { type: String, required: true },
|
|
8
11
|
sender: { type: String, required: true },
|
|
9
12
|
balances: Object as PropType<Coin[]>,
|
|
10
13
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
11
|
-
params:
|
|
14
|
+
params: {
|
|
15
|
+
type: Object as PropType<TxParams>,
|
|
16
|
+
default: () => ({}),
|
|
17
|
+
},
|
|
12
18
|
});
|
|
13
19
|
|
|
14
|
-
const
|
|
20
|
+
const params = computed(() => props.params as ExecuteParams)
|
|
15
21
|
|
|
16
|
-
const contract = ref(
|
|
22
|
+
const contract = ref(params.value.contract || "")
|
|
17
23
|
const funds = ref([] as Coin[])
|
|
18
24
|
const msg = ref("")
|
|
19
25
|
|
|
@@ -55,7 +61,7 @@ const isValid = computed(() => {
|
|
|
55
61
|
})
|
|
56
62
|
|
|
57
63
|
function initial() {
|
|
58
|
-
msg.value = JSON.stringify(
|
|
64
|
+
msg.value = JSON.stringify(params.value.execution) || ""
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
defineExpose({msgs, isValid, initial})
|
|
@@ -96,4 +102,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
96
102
|
</label>
|
|
97
103
|
</div>
|
|
98
104
|
</div>
|
|
99
|
-
</template>
|
|
105
|
+
</template>
|
|
@@ -3,16 +3,22 @@ import { Coin } from '@cosmjs/amino';
|
|
|
3
3
|
import { PropType, computed, ref } from 'vue';
|
|
4
4
|
import { toBase64 } from '@cosmjs/encoding'
|
|
5
5
|
import { CoinMetadata } from '../../../utils/type';
|
|
6
|
+
import type { TxParams } from '../txParams';
|
|
7
|
+
|
|
8
|
+
type InstantiateParams = { codeId?: string | number };
|
|
6
9
|
|
|
7
10
|
const props = defineProps({
|
|
8
11
|
endpoint: { type: String, required: true },
|
|
9
12
|
sender: { type: String, required: true },
|
|
10
13
|
balances: Object as PropType<Coin[]>,
|
|
11
14
|
metadata: Object as PropType<Record<string, CoinMetadata>>,
|
|
12
|
-
params:
|
|
15
|
+
params: {
|
|
16
|
+
type: Object as PropType<TxParams>,
|
|
17
|
+
default: () => ({}),
|
|
18
|
+
},
|
|
13
19
|
});
|
|
14
20
|
|
|
15
|
-
const params = computed(() =>
|
|
21
|
+
const params = computed(() => props.params as InstantiateParams)
|
|
16
22
|
|
|
17
23
|
const admin = ref("")
|
|
18
24
|
const label = ref("")
|
|
@@ -106,4 +112,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
106
112
|
</label>
|
|
107
113
|
</div>
|
|
108
114
|
</div>
|
|
109
|
-
</template>
|
|
115
|
+
</template>
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
3
4
|
import { toBase64 } from '@cosmjs/encoding'
|
|
5
|
+
import type { TxParams } from '../txParams';
|
|
6
|
+
|
|
7
|
+
type ContractParams = { contract?: string };
|
|
4
8
|
|
|
5
9
|
const props = defineProps({
|
|
6
10
|
endpoint: { type: String, required: true },
|
|
7
11
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
12
|
+
params: {
|
|
13
|
+
type: Object as PropType<TxParams>,
|
|
14
|
+
default: () => ({}),
|
|
15
|
+
},
|
|
9
16
|
});
|
|
10
17
|
|
|
11
|
-
const params = computed(() =>
|
|
18
|
+
const params = computed(() => props.params as ContractParams)
|
|
12
19
|
|
|
13
20
|
const codeId = ref("")
|
|
14
21
|
const msg = ref("{}")
|
|
@@ -74,4 +81,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
74
81
|
<textarea v-model="msg" placeholder="{config: {}}" class="text-gray-600 dark:text-white textarea border"></textarea>
|
|
75
82
|
</div>
|
|
76
83
|
</div>
|
|
77
|
-
</template>
|
|
84
|
+
</template>
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
3
4
|
import { toBase64 } from '@cosmjs/encoding'
|
|
5
|
+
import type { TxParams } from '../txParams';
|
|
6
|
+
|
|
7
|
+
type ContractParams = { contract?: string };
|
|
4
8
|
|
|
5
9
|
const props = defineProps({
|
|
6
10
|
endpoint: { type: String, required: true },
|
|
7
11
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
12
|
+
params: {
|
|
13
|
+
type: Object as PropType<TxParams>,
|
|
14
|
+
default: () => ({}),
|
|
15
|
+
},
|
|
9
16
|
});
|
|
10
17
|
|
|
11
|
-
const params = computed(() =>
|
|
18
|
+
const params = computed(() => props.params as ContractParams)
|
|
12
19
|
|
|
13
20
|
const codeId = ref("")
|
|
14
21
|
const msg = ref("")
|
|
@@ -74,4 +81,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
74
81
|
<textarea v-model="msg" placeholder="{config: {}}" class="text-gray-600 dark:text-white textarea border"></textarea>
|
|
75
82
|
</div>
|
|
76
83
|
</div>
|
|
77
|
-
</template>
|
|
84
|
+
</template>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { PropType, computed, ref } from 'vue';
|
|
3
3
|
import * as fflate from 'fflate';
|
|
4
|
+
import type { TxParams } from '../txParams';
|
|
4
5
|
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
endpoint: { type: String, required: true },
|
|
7
8
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
9
|
+
params: {
|
|
10
|
+
type: Object as PropType<TxParams>,
|
|
11
|
+
default: () => ({}),
|
|
12
|
+
},
|
|
9
13
|
});
|
|
10
14
|
|
|
11
15
|
const bytecode = ref(new Uint8Array())
|
|
@@ -98,4 +102,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
98
102
|
<input type="file" class="file-input" @change="loadWasm"/>
|
|
99
103
|
</div>
|
|
100
104
|
</div>
|
|
101
|
-
</template>
|
|
105
|
+
</template>
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
3
4
|
import { toBase64 } from '@cosmjs/encoding'
|
|
5
|
+
import type { TxParams } from '../txParams';
|
|
6
|
+
|
|
7
|
+
type ContractParams = { contract?: string };
|
|
4
8
|
|
|
5
9
|
const props = defineProps({
|
|
6
10
|
endpoint: { type: String, required: true },
|
|
7
11
|
sender: { type: String, required: true },
|
|
8
|
-
params:
|
|
12
|
+
params: {
|
|
13
|
+
type: Object as PropType<TxParams>,
|
|
14
|
+
default: () => ({}),
|
|
15
|
+
},
|
|
9
16
|
});
|
|
10
17
|
|
|
11
|
-
const params = computed(() =>
|
|
18
|
+
const params = computed(() => props.params as ContractParams)
|
|
12
19
|
|
|
13
20
|
const newAdmin = ref("")
|
|
14
21
|
const msg = ref("")
|
|
@@ -72,4 +79,4 @@ defineExpose({msgs, isValid, initial})
|
|
|
72
79
|
</div>
|
|
73
80
|
|
|
74
81
|
</div>
|
|
75
|
-
</template>
|
|
82
|
+
</template>
|