@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,77 +1,77 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref } from 'vue';
|
|
3
|
-
import { toBase64 } from '@cosmjs/encoding'
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
endpoint: { type: String, required: true },
|
|
7
|
-
sender: { type: String, required: true },
|
|
8
|
-
params: String,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
12
|
-
|
|
13
|
-
const codeId = ref("")
|
|
14
|
-
const msg = ref("{}")
|
|
15
|
-
|
|
16
|
-
const msgs = computed(() => {
|
|
17
|
-
return [{
|
|
18
|
-
typeUrl: '/cosmwasm.wasm.v1.MsgMigrateContract',
|
|
19
|
-
value: {
|
|
20
|
-
/** Sender is the that actor that signed the messages */
|
|
21
|
-
sender: props.sender,
|
|
22
|
-
/** contract address that can execute migrations */
|
|
23
|
-
contract: params.value.contract,
|
|
24
|
-
/** CodeID is the reference to the stored WASM code */
|
|
25
|
-
codeId: codeId.value,
|
|
26
|
-
/** Msg json encoded message to be passed to the contract on instantiation */
|
|
27
|
-
msg: toBase64(new TextEncoder().encode(msg.value)),
|
|
28
|
-
},
|
|
29
|
-
}]
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const isValid = computed(() => {
|
|
33
|
-
let ok = true
|
|
34
|
-
let error = ""
|
|
35
|
-
if( Number(codeId.value) < 1) {
|
|
36
|
-
ok = false
|
|
37
|
-
error = "Code Id is not selected"
|
|
38
|
-
}
|
|
39
|
-
return { ok, error }
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
function initial() {
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
defineExpose({msgs, isValid, initial})
|
|
46
|
-
|
|
47
|
-
</script>
|
|
48
|
-
<template>
|
|
49
|
-
<div>
|
|
50
|
-
<div class="form-control">
|
|
51
|
-
<label class="label">
|
|
52
|
-
<span class="label-text">Sender</span>
|
|
53
|
-
</label>
|
|
54
|
-
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border
|
|
55
|
-
</div>
|
|
56
|
-
<div class="form-control">
|
|
57
|
-
<label class="label">
|
|
58
|
-
<span class="label-text">Contract Address</span>
|
|
59
|
-
</label>
|
|
60
|
-
<input type="text" readonly class="text-gray-600 dark:text-white input border
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div class="form-control">
|
|
64
|
-
<label class="label">
|
|
65
|
-
<span class="label-text">Code Id</span>
|
|
66
|
-
</label>
|
|
67
|
-
<input v-model="codeId" type="text" class="text-gray-600 dark:text-white input border
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div class="form-control">
|
|
71
|
-
<label class="label">
|
|
72
|
-
<span class="label-text">Messages</span>
|
|
73
|
-
</label>
|
|
74
|
-
<textarea v-model="msg" placeholder="{config: {}}" class="text-gray-600 dark:text-white textarea border
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
import { toBase64 } from '@cosmjs/encoding'
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
endpoint: { type: String, required: true },
|
|
7
|
+
sender: { type: String, required: true },
|
|
8
|
+
params: String,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
12
|
+
|
|
13
|
+
const codeId = ref("")
|
|
14
|
+
const msg = ref("{}")
|
|
15
|
+
|
|
16
|
+
const msgs = computed(() => {
|
|
17
|
+
return [{
|
|
18
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgMigrateContract',
|
|
19
|
+
value: {
|
|
20
|
+
/** Sender is the that actor that signed the messages */
|
|
21
|
+
sender: props.sender,
|
|
22
|
+
/** contract address that can execute migrations */
|
|
23
|
+
contract: params.value.contract,
|
|
24
|
+
/** CodeID is the reference to the stored WASM code */
|
|
25
|
+
codeId: codeId.value,
|
|
26
|
+
/** Msg json encoded message to be passed to the contract on instantiation */
|
|
27
|
+
msg: toBase64(new TextEncoder().encode(msg.value)),
|
|
28
|
+
},
|
|
29
|
+
}]
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const isValid = computed(() => {
|
|
33
|
+
let ok = true
|
|
34
|
+
let error = ""
|
|
35
|
+
if( Number(codeId.value) < 1) {
|
|
36
|
+
ok = false
|
|
37
|
+
error = "Code Id is not selected"
|
|
38
|
+
}
|
|
39
|
+
return { ok, error }
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
function initial() {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
defineExpose({msgs, isValid, initial})
|
|
46
|
+
|
|
47
|
+
</script>
|
|
48
|
+
<template>
|
|
49
|
+
<div>
|
|
50
|
+
<div class="form-control">
|
|
51
|
+
<label class="label">
|
|
52
|
+
<span class="label-text">Sender</span>
|
|
53
|
+
</label>
|
|
54
|
+
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border" />
|
|
55
|
+
</div>
|
|
56
|
+
<div class="form-control">
|
|
57
|
+
<label class="label">
|
|
58
|
+
<span class="label-text">Contract Address</span>
|
|
59
|
+
</label>
|
|
60
|
+
<input type="text" readonly class="text-gray-600 dark:text-white input border" :value="params.contract" />
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div class="form-control">
|
|
64
|
+
<label class="label">
|
|
65
|
+
<span class="label-text">Code Id</span>
|
|
66
|
+
</label>
|
|
67
|
+
<input v-model="codeId" type="text" class="text-gray-600 dark:text-white input border" />
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div class="form-control">
|
|
71
|
+
<label class="label">
|
|
72
|
+
<span class="label-text">Messages</span>
|
|
73
|
+
</label>
|
|
74
|
+
<textarea v-model="msg" placeholder="{config: {}}" class="text-gray-600 dark:text-white textarea border"></textarea>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
77
|
</template>
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref } from 'vue';
|
|
3
|
-
import { toBase64 } from '@cosmjs/encoding'
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
endpoint: { type: String, required: true },
|
|
7
|
-
sender: { type: String, required: true },
|
|
8
|
-
params: String,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
12
|
-
|
|
13
|
-
const codeId = ref("")
|
|
14
|
-
const msg = ref("")
|
|
15
|
-
|
|
16
|
-
const msgs = computed(() => {
|
|
17
|
-
return [{
|
|
18
|
-
typeUrl: '/cosmwasm.wasm.v1.MsgMigrateContract',
|
|
19
|
-
value: {
|
|
20
|
-
/** Sender is the that actor that signed the messages */
|
|
21
|
-
sender: props.sender,
|
|
22
|
-
/** contract address that can execute migrations */
|
|
23
|
-
contract: params.value.contract,
|
|
24
|
-
/** CodeID is the reference to the stored WASM code */
|
|
25
|
-
codeId: codeId.value,
|
|
26
|
-
/** Msg json encoded message to be passed to the contract on instantiation */
|
|
27
|
-
msg: toBase64(new TextEncoder().encode(msg.value)),
|
|
28
|
-
},
|
|
29
|
-
}]
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const isValid = computed(() => {
|
|
33
|
-
let ok = true
|
|
34
|
-
let error = ""
|
|
35
|
-
if( Number(codeId.value) < 1) {
|
|
36
|
-
ok = false
|
|
37
|
-
error = "Code Id is not selected"
|
|
38
|
-
}
|
|
39
|
-
return { ok, error }
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
function initial() {
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
defineExpose({msgs, isValid, initial})
|
|
46
|
-
|
|
47
|
-
</script>
|
|
48
|
-
<template>
|
|
49
|
-
<div>
|
|
50
|
-
<div class="form-control">
|
|
51
|
-
<label class="label">
|
|
52
|
-
<span class="label-text">Sender</span>
|
|
53
|
-
</label>
|
|
54
|
-
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border
|
|
55
|
-
</div>
|
|
56
|
-
<div class="form-control">
|
|
57
|
-
<label class="label">
|
|
58
|
-
<span class="label-text">Contract Address</span>
|
|
59
|
-
</label>
|
|
60
|
-
<input type="text" readonly class="text-gray-600 dark:text-white input border
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div class="form-control">
|
|
64
|
-
<label class="label">
|
|
65
|
-
<span class="label-text">Code Id</span>
|
|
66
|
-
</label>
|
|
67
|
-
<input v-model="codeId" type="text" class="text-gray-600 dark:text-white input border
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div class="form-control">
|
|
71
|
-
<label class="label">
|
|
72
|
-
<span class="label-text">Messages</span>
|
|
73
|
-
</label>
|
|
74
|
-
<textarea v-model="msg" placeholder="{config: {}}" class="text-gray-600 dark:text-white textarea border
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
import { toBase64 } from '@cosmjs/encoding'
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
endpoint: { type: String, required: true },
|
|
7
|
+
sender: { type: String, required: true },
|
|
8
|
+
params: String,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
12
|
+
|
|
13
|
+
const codeId = ref("")
|
|
14
|
+
const msg = ref("")
|
|
15
|
+
|
|
16
|
+
const msgs = computed(() => {
|
|
17
|
+
return [{
|
|
18
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgMigrateContract',
|
|
19
|
+
value: {
|
|
20
|
+
/** Sender is the that actor that signed the messages */
|
|
21
|
+
sender: props.sender,
|
|
22
|
+
/** contract address that can execute migrations */
|
|
23
|
+
contract: params.value.contract,
|
|
24
|
+
/** CodeID is the reference to the stored WASM code */
|
|
25
|
+
codeId: codeId.value,
|
|
26
|
+
/** Msg json encoded message to be passed to the contract on instantiation */
|
|
27
|
+
msg: toBase64(new TextEncoder().encode(msg.value)),
|
|
28
|
+
},
|
|
29
|
+
}]
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const isValid = computed(() => {
|
|
33
|
+
let ok = true
|
|
34
|
+
let error = ""
|
|
35
|
+
if( Number(codeId.value) < 1) {
|
|
36
|
+
ok = false
|
|
37
|
+
error = "Code Id is not selected"
|
|
38
|
+
}
|
|
39
|
+
return { ok, error }
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
function initial() {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
defineExpose({msgs, isValid, initial})
|
|
46
|
+
|
|
47
|
+
</script>
|
|
48
|
+
<template>
|
|
49
|
+
<div>
|
|
50
|
+
<div class="form-control">
|
|
51
|
+
<label class="label">
|
|
52
|
+
<span class="label-text">Sender</span>
|
|
53
|
+
</label>
|
|
54
|
+
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border" />
|
|
55
|
+
</div>
|
|
56
|
+
<div class="form-control">
|
|
57
|
+
<label class="label">
|
|
58
|
+
<span class="label-text">Contract Address</span>
|
|
59
|
+
</label>
|
|
60
|
+
<input type="text" readonly class="text-gray-600 dark:text-white input border" :value="params.contract" />
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div class="form-control">
|
|
64
|
+
<label class="label">
|
|
65
|
+
<span class="label-text">Code Id</span>
|
|
66
|
+
</label>
|
|
67
|
+
<input v-model="codeId" type="text" class="text-gray-600 dark:text-white input border" />
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div class="form-control">
|
|
71
|
+
<label class="label">
|
|
72
|
+
<span class="label-text">Messages</span>
|
|
73
|
+
</label>
|
|
74
|
+
<textarea v-model="msg" placeholder="{config: {}}" class="text-gray-600 dark:text-white textarea border"></textarea>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
77
|
</template>
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { PropType, computed, ref } from 'vue';
|
|
3
|
-
import * as fflate from 'fflate';
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
endpoint: { type: String, required: true },
|
|
7
|
-
sender: { type: String, required: true },
|
|
8
|
-
params: String,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const bytecode = ref(new Uint8Array())
|
|
12
|
-
const addresses = ref("")
|
|
13
|
-
const permission = ref('3')
|
|
14
|
-
const zip = ref('gzip')
|
|
15
|
-
|
|
16
|
-
function loadWasm(event) {
|
|
17
|
-
const file = event.target.files[0]
|
|
18
|
-
if(file) {
|
|
19
|
-
var reader = new FileReader();
|
|
20
|
-
reader.addEventListener('load', (e)=>{
|
|
21
|
-
if(e.target) {
|
|
22
|
-
if(zip.value === 'gzip') {
|
|
23
|
-
bytecode.value = fflate.compressSync(new Uint8Array(e.target.result as ArrayBuffer))
|
|
24
|
-
}
|
|
25
|
-
bytecode.value = new Uint8Array(e.target.result as ArrayBuffer)
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
reader.readAsArrayBuffer(file);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const msgs = computed(() => {
|
|
33
|
-
return [{
|
|
34
|
-
typeUrl: '/cosmwasm.wasm.v1.MsgStoreCode',
|
|
35
|
-
value: {
|
|
36
|
-
sender: props.sender,
|
|
37
|
-
wasmByteCode: bytecode.value,
|
|
38
|
-
instantiatePermission: {
|
|
39
|
-
permission: permission.value,
|
|
40
|
-
addresses: addresses.value.split(","),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
}]
|
|
44
|
-
})
|
|
45
|
-
const isValid = computed(() => {
|
|
46
|
-
let ok = true
|
|
47
|
-
let error = ""
|
|
48
|
-
if( bytecode.value.length < 1) {
|
|
49
|
-
ok = false
|
|
50
|
-
error = "No contract is selected"
|
|
51
|
-
}
|
|
52
|
-
return { ok, error }
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
function initial() {
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
defineExpose({msgs, isValid, initial})
|
|
60
|
-
</script>
|
|
61
|
-
<template>
|
|
62
|
-
<div>
|
|
63
|
-
<div class="form-control">
|
|
64
|
-
<label class="label">
|
|
65
|
-
<span class="label-text">Sender</span>
|
|
66
|
-
</label>
|
|
67
|
-
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border
|
|
68
|
-
</div>
|
|
69
|
-
<div class="form-control">
|
|
70
|
-
<label class="label">
|
|
71
|
-
<span class="label-text">Permission</span>
|
|
72
|
-
</label>
|
|
73
|
-
<div class="flex">
|
|
74
|
-
<input v-model="permission" type="radio" id="nobody" value="1" class="radio radio-error mx-2" /><label for="nobody">Nobody</label>
|
|
75
|
-
<input v-model="permission" type="radio" id="everyone" value="3" class="radio radio-success mx-2" /><label for="everyone">Everybody</label>
|
|
76
|
-
<input v-model="permission" type="radio" id="anyofaddress" value="4" class="radio radio-success mx-2" /><label for="anyofaddress">Any Of addresses</label>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
<div v-if="permission === '4'" class="form-control">
|
|
80
|
-
<label class="label">
|
|
81
|
-
<span class="label-text">Addresses</span>
|
|
82
|
-
</label>
|
|
83
|
-
<input v-model="addresses" type="text" placeholder="use ',' for addresses" class="input border
|
|
84
|
-
</div>
|
|
85
|
-
<div class="form-control">
|
|
86
|
-
<label class="label">
|
|
87
|
-
<span class="label-text">Compressing</span>
|
|
88
|
-
</label>
|
|
89
|
-
<div class="flex">
|
|
90
|
-
<input v-model="zip" type="radio" id="raw" value="raw" class="radio mx-2" /><label for="raw">Raw</label>
|
|
91
|
-
<input v-model="zip" type="radio" id="gzip" value="gzip" class="radio mx-2" /><label for="gzip">Gzip</label>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
<div class="form-control">
|
|
95
|
-
<label class="label">
|
|
96
|
-
<span class="label-text">Contract</span>
|
|
97
|
-
</label>
|
|
98
|
-
<input type="file" class="file-input" @change="loadWasm"/>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { PropType, computed, ref } from 'vue';
|
|
3
|
+
import * as fflate from 'fflate';
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
endpoint: { type: String, required: true },
|
|
7
|
+
sender: { type: String, required: true },
|
|
8
|
+
params: String,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const bytecode = ref(new Uint8Array())
|
|
12
|
+
const addresses = ref("")
|
|
13
|
+
const permission = ref('3')
|
|
14
|
+
const zip = ref('gzip')
|
|
15
|
+
|
|
16
|
+
function loadWasm(event) {
|
|
17
|
+
const file = event.target.files[0]
|
|
18
|
+
if(file) {
|
|
19
|
+
var reader = new FileReader();
|
|
20
|
+
reader.addEventListener('load', (e)=>{
|
|
21
|
+
if(e.target) {
|
|
22
|
+
if(zip.value === 'gzip') {
|
|
23
|
+
bytecode.value = fflate.compressSync(new Uint8Array(e.target.result as ArrayBuffer))
|
|
24
|
+
}
|
|
25
|
+
bytecode.value = new Uint8Array(e.target.result as ArrayBuffer)
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
reader.readAsArrayBuffer(file);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const msgs = computed(() => {
|
|
33
|
+
return [{
|
|
34
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgStoreCode',
|
|
35
|
+
value: {
|
|
36
|
+
sender: props.sender,
|
|
37
|
+
wasmByteCode: bytecode.value,
|
|
38
|
+
instantiatePermission: {
|
|
39
|
+
permission: permission.value,
|
|
40
|
+
addresses: addresses.value.split(","),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}]
|
|
44
|
+
})
|
|
45
|
+
const isValid = computed(() => {
|
|
46
|
+
let ok = true
|
|
47
|
+
let error = ""
|
|
48
|
+
if( bytecode.value.length < 1) {
|
|
49
|
+
ok = false
|
|
50
|
+
error = "No contract is selected"
|
|
51
|
+
}
|
|
52
|
+
return { ok, error }
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
function initial() {
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
defineExpose({msgs, isValid, initial})
|
|
60
|
+
</script>
|
|
61
|
+
<template>
|
|
62
|
+
<div>
|
|
63
|
+
<div class="form-control">
|
|
64
|
+
<label class="label">
|
|
65
|
+
<span class="label-text">Sender</span>
|
|
66
|
+
</label>
|
|
67
|
+
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border" />
|
|
68
|
+
</div>
|
|
69
|
+
<div class="form-control">
|
|
70
|
+
<label class="label">
|
|
71
|
+
<span class="label-text">Permission</span>
|
|
72
|
+
</label>
|
|
73
|
+
<div class="flex">
|
|
74
|
+
<input v-model="permission" type="radio" id="nobody" value="1" class="radio radio-error mx-2" /><label for="nobody">Nobody</label>
|
|
75
|
+
<input v-model="permission" type="radio" id="everyone" value="3" class="radio radio-success mx-2" /><label for="everyone">Everybody</label>
|
|
76
|
+
<input v-model="permission" type="radio" id="anyofaddress" value="4" class="radio radio-success mx-2" /><label for="anyofaddress">Any Of addresses</label>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div v-if="permission === '4'" class="form-control">
|
|
80
|
+
<label class="label">
|
|
81
|
+
<span class="label-text">Addresses</span>
|
|
82
|
+
</label>
|
|
83
|
+
<input v-model="addresses" type="text" placeholder="use ',' for addresses" class="input border" />
|
|
84
|
+
</div>
|
|
85
|
+
<div class="form-control">
|
|
86
|
+
<label class="label">
|
|
87
|
+
<span class="label-text">Compressing</span>
|
|
88
|
+
</label>
|
|
89
|
+
<div class="flex">
|
|
90
|
+
<input v-model="zip" type="radio" id="raw" value="raw" class="radio mx-2" /><label for="raw">Raw</label>
|
|
91
|
+
<input v-model="zip" type="radio" id="gzip" value="gzip" class="radio mx-2" /><label for="gzip">Gzip</label>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="form-control">
|
|
95
|
+
<label class="label">
|
|
96
|
+
<span class="label-text">Contract</span>
|
|
97
|
+
</label>
|
|
98
|
+
<input type="file" class="file-input" @change="loadWasm"/>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
101
|
</template>
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref } from 'vue';
|
|
3
|
-
import { toBase64 } from '@cosmjs/encoding'
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
endpoint: { type: String, required: true },
|
|
7
|
-
sender: { type: String, required: true },
|
|
8
|
-
params: String,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
12
|
-
|
|
13
|
-
const newAdmin = ref("")
|
|
14
|
-
const msg = ref("")
|
|
15
|
-
|
|
16
|
-
const msgs = computed(() => {
|
|
17
|
-
return [{
|
|
18
|
-
typeUrl: '/cosmwasm.wasm.v1.MsgUpdateAdmin',
|
|
19
|
-
value: {
|
|
20
|
-
/** Sender is the that actor that signed the messages */
|
|
21
|
-
sender: props.sender,
|
|
22
|
-
/** contract address that can execute migrations */
|
|
23
|
-
contract: params.value.contract,
|
|
24
|
-
/** CodeID is the reference to the stored WASM code */
|
|
25
|
-
newAdmin: newAdmin.value,
|
|
26
|
-
/** Msg json encoded message to be passed to the contract on instantiation */
|
|
27
|
-
msg: toBase64(new TextEncoder().encode(msg.value)),
|
|
28
|
-
},
|
|
29
|
-
}]
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const isValid = computed(() => {
|
|
33
|
-
let ok = true
|
|
34
|
-
let error = ""
|
|
35
|
-
if( !params.value.contract) {
|
|
36
|
-
ok = false
|
|
37
|
-
error = "Contract is not selected!"
|
|
38
|
-
}
|
|
39
|
-
if( !newAdmin.value) {
|
|
40
|
-
ok = false
|
|
41
|
-
error = "Admin should not be empty!"
|
|
42
|
-
}
|
|
43
|
-
return { ok, error }
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
function initial() {
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
defineExpose({msgs, isValid, initial})
|
|
50
|
-
|
|
51
|
-
</script>
|
|
52
|
-
<template>
|
|
53
|
-
<div>
|
|
54
|
-
<div class="form-control">
|
|
55
|
-
<label class="label">
|
|
56
|
-
<span class="label-text">Sender</span>
|
|
57
|
-
</label>
|
|
58
|
-
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border
|
|
59
|
-
</div>
|
|
60
|
-
<div class="form-control">
|
|
61
|
-
<label class="label">
|
|
62
|
-
<span class="label-text">Contract Address</span>
|
|
63
|
-
</label>
|
|
64
|
-
<input type="text" readonly class="text-gray-600 dark:text-white input border
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div class="form-control">
|
|
68
|
-
<label class="label">
|
|
69
|
-
<span class="label-text">New Admin</span>
|
|
70
|
-
</label>
|
|
71
|
-
<input v-model="newAdmin" type="text" class="text-gray-600 dark:text-white input border
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
</div>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
import { toBase64 } from '@cosmjs/encoding'
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
endpoint: { type: String, required: true },
|
|
7
|
+
sender: { type: String, required: true },
|
|
8
|
+
params: String,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const params = computed(() => JSON.parse(props.params || "{}"))
|
|
12
|
+
|
|
13
|
+
const newAdmin = ref("")
|
|
14
|
+
const msg = ref("")
|
|
15
|
+
|
|
16
|
+
const msgs = computed(() => {
|
|
17
|
+
return [{
|
|
18
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgUpdateAdmin',
|
|
19
|
+
value: {
|
|
20
|
+
/** Sender is the that actor that signed the messages */
|
|
21
|
+
sender: props.sender,
|
|
22
|
+
/** contract address that can execute migrations */
|
|
23
|
+
contract: params.value.contract,
|
|
24
|
+
/** CodeID is the reference to the stored WASM code */
|
|
25
|
+
newAdmin: newAdmin.value,
|
|
26
|
+
/** Msg json encoded message to be passed to the contract on instantiation */
|
|
27
|
+
msg: toBase64(new TextEncoder().encode(msg.value)),
|
|
28
|
+
},
|
|
29
|
+
}]
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const isValid = computed(() => {
|
|
33
|
+
let ok = true
|
|
34
|
+
let error = ""
|
|
35
|
+
if( !params.value.contract) {
|
|
36
|
+
ok = false
|
|
37
|
+
error = "Contract is not selected!"
|
|
38
|
+
}
|
|
39
|
+
if( !newAdmin.value) {
|
|
40
|
+
ok = false
|
|
41
|
+
error = "Admin should not be empty!"
|
|
42
|
+
}
|
|
43
|
+
return { ok, error }
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
function initial() {
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
defineExpose({msgs, isValid, initial})
|
|
50
|
+
|
|
51
|
+
</script>
|
|
52
|
+
<template>
|
|
53
|
+
<div>
|
|
54
|
+
<div class="form-control">
|
|
55
|
+
<label class="label">
|
|
56
|
+
<span class="label-text">Sender</span>
|
|
57
|
+
</label>
|
|
58
|
+
<input :value="sender" type="text" class="text-gray-600 dark:text-white input border" />
|
|
59
|
+
</div>
|
|
60
|
+
<div class="form-control">
|
|
61
|
+
<label class="label">
|
|
62
|
+
<span class="label-text">Contract Address</span>
|
|
63
|
+
</label>
|
|
64
|
+
<input type="text" readonly class="text-gray-600 dark:text-white input border" :value="params.contract" />
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="form-control">
|
|
68
|
+
<label class="label">
|
|
69
|
+
<span class="label-text">New Admin</span>
|
|
70
|
+
</label>
|
|
71
|
+
<input v-model="newAdmin" type="text" class="text-gray-600 dark:text-white input border" />
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
</div>
|
|
75
75
|
</template>
|