@meddleware/token-deployer-ui 0.0.31 → 0.0.32
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meddleware/token-deployer-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "0BSD",
|
|
6
6
|
"repository": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@meddleware/design-tokens": "^0.1.9",
|
|
52
|
-
"@meddleware/sui-token-client": "^0.0.
|
|
52
|
+
"@meddleware/sui-token-client": "^0.0.9",
|
|
53
53
|
"@meddleware/ui": "^0.1.31",
|
|
54
54
|
"@meddleware/walrus-client": "^0.0.26",
|
|
55
55
|
"@meddleware/walrus-relay": "^0.1.29",
|
|
@@ -190,10 +190,10 @@ function onBlur(key: string): void {
|
|
|
190
190
|
<UiFormField id="supply" label="Initial supply" :error="visibleError('initialSupply')">
|
|
191
191
|
<template #label-suffix>
|
|
192
192
|
<UiFieldHint field-id="supply">
|
|
193
|
-
The number of whole tokens
|
|
194
|
-
chosen decimal precision — with 9 decimals, 1 token = 1,000,000,000 base units
|
|
193
|
+
The number of whole tokens minted when the coin is created and sent to the recipient.
|
|
194
|
+
Uses your chosen decimal precision — with 9 decimals, 1 token = 1,000,000,000 base units
|
|
195
195
|
on-chain. Enter <b>0</b> or leave blank for no initial supply. You can mint more later
|
|
196
|
-
if you choose the Mintable supply policy.
|
|
196
|
+
if you choose the Mintable supply policy; a Fixed supply needs an amount above zero.
|
|
197
197
|
</UiFieldHint>
|
|
198
198
|
</template>
|
|
199
199
|
<template #default="{ attrs }">
|
|
@@ -213,7 +213,8 @@ function onBlur(key: string): void {
|
|
|
213
213
|
<template #label-suffix>
|
|
214
214
|
<UiFieldHint field-id="supply-policy">
|
|
215
215
|
<b>Mintable</b>: you keep the TreasuryCap and can mint more tokens at any time.<br />
|
|
216
|
-
<b>Fixed</b>: the
|
|
216
|
+
<b>Fixed</b>: the whole supply is minted when the coin is created and the coin registry
|
|
217
|
+
takes the TreasuryCap — nobody can ever mint more, and wallets can see that.
|
|
217
218
|
</UiFieldHint>
|
|
218
219
|
</template>
|
|
219
220
|
<template #default="{ attrs }">
|
|
@@ -228,7 +229,8 @@ function onBlur(key: string): void {
|
|
|
228
229
|
<UiFieldHint field-id="metadata-policy">
|
|
229
230
|
<b>Updatable</b>: you keep the MetadataCap and can later change the name, symbol,
|
|
230
231
|
description, or icon.<br />
|
|
231
|
-
<b>Frozen</b>: the MetadataCap is
|
|
232
|
+
<b>Frozen</b>: the MetadataCap is deleted when the coin is created — all metadata is
|
|
233
|
+
permanently locked, and wallets can see that.
|
|
232
234
|
</UiFieldHint>
|
|
233
235
|
</template>
|
|
234
236
|
<template #default="{ attrs }">
|
|
@@ -59,6 +59,10 @@ async function downloadPackage(): Promise<void> {
|
|
|
59
59
|
<dd v-if="result.treasuryCapId" class="mono">{{ result.treasuryCapId }}</dd>
|
|
60
60
|
<dt v-if="result.metadataCapId">MetadataCap</dt>
|
|
61
61
|
<dd v-if="result.metadataCapId" class="mono">{{ result.metadataCapId }}</dd>
|
|
62
|
+
<dt v-if="!result.treasuryCapId">Supply</dt>
|
|
63
|
+
<dd v-if="!result.treasuryCapId">Fixed — recorded in the coin registry (no TreasuryCap exists)</dd>
|
|
64
|
+
<dt v-if="!result.metadataCapId">Metadata</dt>
|
|
65
|
+
<dd v-if="!result.metadataCapId">Frozen — recorded in the coin registry (no MetadataCap exists)</dd>
|
|
62
66
|
<dt>Package code</dt>
|
|
63
67
|
<dd>{{ result.upgradeCapId ? 'Upgradeable' : 'Immutable (UpgradeCap burned)' }}</dd>
|
|
64
68
|
</dl>
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
} from '@meddleware/sui-token-client/deploy'
|
|
13
13
|
import type { PublishResult, TokenNetwork } from '@meddleware/sui-token-client'
|
|
14
14
|
import { buildDeployExecutor } from '../lib/deployExecutor.js'
|
|
15
|
-
import { getReadClient } from '../wallet.js'
|
|
16
15
|
import { extractErrorMessage } from '../lib/errors.js'
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -84,8 +83,6 @@ export function useDeploy(executorFor: (network: TokenNetwork) => Promise<Execut
|
|
|
84
83
|
result.value = await finalizeToken({
|
|
85
84
|
pending: p,
|
|
86
85
|
executor: await executorFor(p.result.network),
|
|
87
|
-
// So a retry after an executor error that may have landed checks the supply first.
|
|
88
|
-
client: getReadClient(p.result.network),
|
|
89
86
|
onStep: (s) => (step.value = s),
|
|
90
87
|
})
|
|
91
88
|
pending.value = null
|
package/src/lib/validation.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface ValidatableForm {
|
|
|
29
29
|
iconUrl: string
|
|
30
30
|
decimals: number | string
|
|
31
31
|
initialSupply: string
|
|
32
|
+
/** When 'fixed', an initial supply above zero is required (the framework refuses to fix an empty supply). */
|
|
33
|
+
supplyPolicy?: 'mintable' | 'fixed'
|
|
32
34
|
recipient: string
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -70,6 +72,8 @@ export function validateForm(form: ValidatableForm): FormErrors {
|
|
|
70
72
|
errors.initialSupply = 'Enter a whole number, or leave blank for none'
|
|
71
73
|
} else if (isValidDecimals(decimals) && supply * 10n ** BigInt(decimals) > MAX_U64) {
|
|
72
74
|
errors.initialSupply = 'Supply exceeds the maximum for this decimal precision'
|
|
75
|
+
} else if (form.supplyPolicy === 'fixed' && supply === 0n) {
|
|
76
|
+
errors.initialSupply = 'A fixed supply needs an initial supply above zero'
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
if (form.recipient && !SUI_ADDRESS.test(form.recipient)) {
|
package/src/main.ts
CHANGED
|
@@ -34,6 +34,7 @@ useSeason()
|
|
|
34
34
|
const packageId = '0x' + 'bb'.repeat(32)
|
|
35
35
|
const treasuryCapId = '0x' + 'cc'.repeat(32)
|
|
36
36
|
const metadataCapId = '0x' + 'dd'.repeat(32)
|
|
37
|
+
const currencyId = '0x' + 'ee'.repeat(32)
|
|
37
38
|
const created = (objectId: string) => ({
|
|
38
39
|
objectId,
|
|
39
40
|
outputState: 'ObjectWrite',
|
|
@@ -51,11 +52,13 @@ useSeason()
|
|
|
51
52
|
{ objectId: packageId, outputState: 'PackageWrite', idOperation: 'Created' },
|
|
52
53
|
created(treasuryCapId),
|
|
53
54
|
created(metadataCapId),
|
|
55
|
+
created(currencyId),
|
|
54
56
|
],
|
|
55
57
|
},
|
|
56
58
|
objectTypes: {
|
|
57
59
|
[treasuryCapId]: `0x2::coin::TreasuryCap<${packageId}::mytoken::MYTOKEN>`,
|
|
58
60
|
[metadataCapId]: `0x2::coin_registry::MetadataCap<${packageId}::mytoken::MYTOKEN>`,
|
|
61
|
+
[currencyId]: `0x2::coin_registry::Currency<${packageId}::mytoken::MYTOKEN>`,
|
|
59
62
|
},
|
|
60
63
|
},
|
|
61
64
|
}
|