@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.
Files changed (69) hide show
  1. package/.github/FUNDING.yml +3 -3
  2. package/.github/workflows/npm-publish.yml +34 -34
  3. package/.prettierrc.json +9 -9
  4. package/.vscode/extensions.json +3 -3
  5. package/LICENSE +674 -674
  6. package/README.md +41 -41
  7. package/dist/{main-d0e5d1e4.js → main-bbea3e54.js} +155 -153
  8. package/dist/ping-widget.js +2 -2
  9. package/dist/ping-widget.umd.cjs +18 -18
  10. package/dist/{query.lcd-3d4d3495.js → query.lcd-88036522.js} +1 -1
  11. package/dist/{query.rpc.Query-b7807c29.js → query.rpc.Query-3a2b14f8.js} +1 -1
  12. package/dist/{tx.rpc.msg-59c3408a.js → tx.rpc.msg-39f0b824.js} +1 -1
  13. package/example/.vscode/extensions.json +3 -3
  14. package/example/README.md +7 -7
  15. package/example/index.html +12 -12
  16. package/example/package.json +19 -19
  17. package/example/pnpm-lock.yaml +465 -465
  18. package/example/public/cdn.html +19 -19
  19. package/example/src/App.vue +73 -73
  20. package/example/src/main.js +4 -4
  21. package/example/vite.config.js +7 -7
  22. package/index.html +12 -12
  23. package/lib/components/ConnectWallet/index.vue +262 -262
  24. package/lib/components/TokenConvert/index.vue +1033 -1033
  25. package/lib/components/TokenConvert/tokens.ts +36 -36
  26. package/lib/components/TxDialog/index.vue +422 -422
  27. package/lib/components/TxDialog/messages/Delegate.vue +174 -174
  28. package/lib/components/TxDialog/messages/Deposit.vue +96 -96
  29. package/lib/components/TxDialog/messages/Redelegate.vue +160 -160
  30. package/lib/components/TxDialog/messages/Send.vue +142 -142
  31. package/lib/components/TxDialog/messages/Transfer.vue +248 -248
  32. package/lib/components/TxDialog/messages/Unbond.vue +103 -103
  33. package/lib/components/TxDialog/messages/Vote.vue +62 -62
  34. package/lib/components/TxDialog/messages/Withdraw.vue +55 -55
  35. package/lib/components/TxDialog/messages/WithdrawCommission.vue +74 -74
  36. package/lib/components/TxDialog/wasm/ClearAdmin.vue +55 -55
  37. package/lib/components/TxDialog/wasm/ExecuteContract.vue +98 -98
  38. package/lib/components/TxDialog/wasm/InstantiateContract.vue +108 -108
  39. package/lib/components/TxDialog/wasm/MigrateContract.vue +76 -76
  40. package/lib/components/TxDialog/wasm/MigrateContract2.vue +76 -76
  41. package/lib/components/TxDialog/wasm/StoreCode.vue +100 -100
  42. package/lib/components/TxDialog/wasm/UpdateAdmin.vue +74 -74
  43. package/lib/main.css +591 -7
  44. package/lib/main.ts +24 -23
  45. package/lib/utils/TokenUnitConverter.ts +44 -44
  46. package/lib/utils/format.ts +16 -16
  47. package/lib/utils/http.ts +154 -154
  48. package/lib/utils/type.ts +56 -56
  49. package/lib/wallet/EthermintMessageAdapter.ts +135 -135
  50. package/lib/wallet/UniClient.ts +144 -144
  51. package/lib/wallet/Wallet.ts +142 -142
  52. package/lib/wallet/wallets/KeplerWallet.ts +141 -141
  53. package/lib/wallet/wallets/LeapWallet.ts +141 -141
  54. package/lib/wallet/wallets/LedgerWallet.ts +202 -202
  55. package/lib/wallet/wallets/MetamaskSnapWallet.ts +105 -105
  56. package/lib/wallet/wallets/MetamaskWallet.ts +173 -173
  57. package/lib/wallet/wallets/OKXWallet.ts +202 -202
  58. package/lib/wallet/wallets/UnisatWallet.ts +198 -198
  59. package/package.json +5 -6
  60. package/postcss.config.js +6 -6
  61. package/src/App.vue +225 -225
  62. package/src/main.ts +7 -4
  63. package/src/styles/design-system.css +184 -0
  64. package/src/vite-env.d.ts +1 -1
  65. package/tailwind.config.js +158 -34
  66. package/tsconfig.json +25 -25
  67. package/tsconfig.node.json +10 -10
  68. package/vite.config.ts +62 -62
  69. 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 !border-gray-300 dark:!border-[#aac7fc]" />
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 !border-gray-300 dark:!border-[#aac7fc]" :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 !border-gray-300 dark:!border-[#aac7fc]" />
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 !border-gray-300 dark:!border-[#aac7fc]"></textarea>
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 !border-gray-300 dark:!border-[#aac7fc]" />
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 !border-gray-300 dark:!border-[#aac7fc]" :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 !border-gray-300 dark:!border-[#aac7fc]" />
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 !border-gray-300 dark:!border-[#aac7fc]"></textarea>
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 !border-gray-300 dark:!border-[#aac7fc]" />
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 border-gray-300 dark:border-[#aac7fc]" />
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 !border-gray-300 dark:!border-[#aac7fc]" />
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 !border-gray-300 dark:!border-[#aac7fc]" :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 !border-gray-300 dark:!border-[#aac7fc]" />
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>