@twin.org/nft-cli 0.0.1-next.18 → 0.0.1-next.20

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.
@@ -7,8 +7,9 @@ var cryptoCli = require('@twin.org/crypto-cli');
7
7
  var walletCli = require('@twin.org/wallet-cli');
8
8
  var core = require('@twin.org/core');
9
9
  var nftConnectorIota = require('@twin.org/nft-connector-iota');
10
- var nftConnectorIotaRebased = require('@twin.org/nft-connector-iota-rebased');
10
+ var nftConnectorIotaStardust = require('@twin.org/nft-connector-iota-stardust');
11
11
  var vaultModels = require('@twin.org/vault-models');
12
+ var walletModels = require('@twin.org/wallet-models');
12
13
  var commander = require('commander');
13
14
  var entityStorageConnectorMemory = require('@twin.org/entity-storage-connector-memory');
14
15
  var entityStorageModels = require('@twin.org/entity-storage-models');
@@ -27,9 +28,9 @@ const NftConnectorTypes = {
27
28
  */
28
29
  Iota: "iota",
29
30
  /**
30
- * IOTA Rebased.
31
+ * IOTA Stardust.
31
32
  */
32
- IotaRebased: "iota-rebased"
33
+ IotaStardust: "iota-stardust"
33
34
  };
34
35
 
35
36
  // Copyright 2024 IOTA Stiftung.
@@ -54,31 +55,34 @@ function setupVault() {
54
55
  * @param options.nodeEndpoint The node endpoint.
55
56
  * @param options.network The network.
56
57
  * @param options.vaultSeedId The vault seed ID.
58
+ * @param options.walletAddressIndex The wallet address index.
57
59
  * @param connector The connector to use.
58
60
  * @returns The NFT connector.
59
61
  */
60
62
  function setupNftConnector(options, connector) {
61
63
  connector ??= NftConnectorTypes.Iota;
62
64
  let instance;
63
- if (connector === NftConnectorTypes.IotaRebased) {
64
- instance = new nftConnectorIotaRebased.IotaRebasedNftConnector({
65
+ if (connector === NftConnectorTypes.Iota) {
66
+ instance = new nftConnectorIota.IotaNftConnector({
65
67
  config: {
66
68
  clientOptions: {
67
69
  url: options.nodeEndpoint
68
70
  },
69
71
  network: options.network ?? "",
70
- vaultSeedId: options.vaultSeedId
72
+ vaultSeedId: options.vaultSeedId,
73
+ walletAddressIndex: options.walletAddressIndex ?? 0
71
74
  }
72
75
  });
73
76
  }
74
77
  else {
75
- instance = new nftConnectorIota.IotaNftConnector({
78
+ instance = new nftConnectorIotaStardust.IotaStardustNftConnector({
76
79
  config: {
77
80
  clientOptions: {
78
81
  nodes: [options.nodeEndpoint],
79
82
  localPow: true
80
83
  },
81
- vaultSeedId: options.vaultSeedId
84
+ vaultSeedId: options.vaultSeedId,
85
+ walletAddressIndex: options.walletAddressIndex ?? 0
82
86
  }
83
87
  });
84
88
  }
@@ -116,14 +120,14 @@ function buildCommandNftBurn() {
116
120
  * @param opts.id The id of the NFT to burn in urn format.
117
121
  * @param opts.connector The connector to perform the operations with.
118
122
  * @param opts.node The node URL.
119
- * @param opts.network The network to use for rebased connector.
123
+ * @param opts.network The network to use for connector.
120
124
  * @param opts.explorer The explorer URL.
121
125
  */
122
126
  async function actionCommandNftBurn(opts) {
123
127
  const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
124
128
  const id = cliCore.CLIParam.stringValue("id", opts.id);
125
129
  const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
126
- const network = opts.connector === NftConnectorTypes.IotaRebased
130
+ const network = opts.connector === NftConnectorTypes.Iota
127
131
  ? cliCore.CLIParam.stringValue("network", opts.network)
128
132
  : undefined;
129
133
  const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
@@ -138,6 +142,8 @@ async function actionCommandNftBurn(opts) {
138
142
  const vaultSeedId = "local-seed";
139
143
  const vaultConnector = vaultModels.VaultConnectorFactory.get("vault");
140
144
  await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
145
+ const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
146
+ walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
141
147
  const nftConnector = setupNftConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
142
148
  if (core.Is.function(nftConnector.start)) {
143
149
  await nftConnector.start(localIdentity);
@@ -147,9 +153,9 @@ async function actionCommandNftBurn(opts) {
147
153
  cliCore.CLIDisplay.spinnerStart();
148
154
  await nftConnector.burn(localIdentity, id);
149
155
  cliCore.CLIDisplay.spinnerStop();
150
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
151
- ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIotaRebased.IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
152
- : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIota.IotaNftUtils.nftIdToAddress(id)}`);
156
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
157
+ ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
158
+ : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(id)}`);
153
159
  cliCore.CLIDisplay.break();
154
160
  cliCore.CLIDisplay.done();
155
161
  }
@@ -167,6 +173,8 @@ function buildCommandNftMint() {
167
173
  .summary(core.I18n.formatMessage("commands.nft-mint.summary"))
168
174
  .description(core.I18n.formatMessage("commands.nft-mint.description"))
169
175
  .requiredOption(core.I18n.formatMessage("commands.nft-mint.options.seed.param"), core.I18n.formatMessage("commands.nft-mint.options.seed.description"))
176
+ .requiredOption(core.I18n.formatMessage("commands.nft-mint.options.issuer.param"), core.I18n.formatMessage("commands.nft-mint.options.issuer.description"))
177
+ .option(core.I18n.formatMessage("commands.nft-mint.options.wallet-address-index.param"), core.I18n.formatMessage("commands.nft-mint.options.wallet-address-index.description"), "0")
170
178
  .requiredOption(core.I18n.formatMessage("commands.nft-mint.options.tag.param"), core.I18n.formatMessage("commands.nft-mint.options.tag.description"))
171
179
  .option(core.I18n.formatMessage("commands.nft-mint.options.immutable-json.param"), core.I18n.formatMessage("commands.nft-mint.options.immutable-json.description"))
172
180
  .option(core.I18n.formatMessage("commands.nft-mint.options.mutable-json.param"), core.I18n.formatMessage("commands.nft-mint.options.mutable-json.description"));
@@ -191,16 +199,22 @@ function buildCommandNftMint() {
191
199
  * Action the nft mint command.
192
200
  * @param opts The options for the command.
193
201
  * @param opts.seed The seed required for signing by the issuer.
202
+ * @param opts.issuer The identity of the issuer.
203
+ * @param opts.walletAddressIndex The wallet address index.
194
204
  * @param opts.tag The tag for the NFT.
195
205
  * @param opts.immutableJson Filename of the immutable JSON data.
196
206
  * @param opts.mutableJson Filename of the mutable JSON data.
197
207
  * @param opts.connector The connector to perform the operations with.
198
208
  * @param opts.node The node URL.
199
- * @param opts.network The network to use for rebased connector.
209
+ * @param opts.network The network to use for connector.
200
210
  * @param opts.explorer The explorer URL.
201
211
  */
202
212
  async function actionCommandNftMint(opts) {
203
213
  const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
214
+ const issuer = cliCore.CLIParam.stringValue("issuer", opts.issuer);
215
+ const walletAddressIndex = core.Is.empty(opts.walletAddressIndex)
216
+ ? undefined
217
+ : cliCore.CLIParam.integer("wallet-address-index", opts.walletAddressIndex);
204
218
  const tag = cliCore.CLIParam.stringValue("tag", opts.tag);
205
219
  const immutableJson = opts.immutableJson
206
220
  ? path.resolve(opts.immutableJson)
@@ -209,11 +223,15 @@ async function actionCommandNftMint(opts) {
209
223
  ? path.resolve(opts.mutableJson)
210
224
  : undefined;
211
225
  const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
212
- const network = opts.connector === NftConnectorTypes.IotaRebased
226
+ const network = opts.connector === NftConnectorTypes.Iota
213
227
  ? cliCore.CLIParam.stringValue("network", opts.network)
214
228
  : undefined;
215
229
  const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
216
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.tag"), tag);
230
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.issuer"), issuer);
231
+ if (core.Is.number(walletAddressIndex)) {
232
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.tag"), tag);
233
+ }
234
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.walletAddressIndex"), walletAddressIndex);
217
235
  if (core.Is.stringValue(immutableJson)) {
218
236
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.immutableJsonFilename"), immutableJson);
219
237
  }
@@ -226,11 +244,13 @@ async function actionCommandNftMint(opts) {
226
244
  }
227
245
  cliCore.CLIDisplay.break();
228
246
  setupVault();
229
- const localIdentity = "local";
247
+ const localIdentity = issuer;
230
248
  const vaultSeedId = "local-seed";
231
249
  const vaultConnector = vaultModels.VaultConnectorFactory.get("vault");
232
250
  await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
233
- const nftConnector = setupNftConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
251
+ const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
252
+ walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
253
+ const nftConnector = setupNftConnector({ nodeEndpoint, network, vaultSeedId, walletAddressIndex }, opts.connector);
234
254
  if (core.Is.function(nftConnector.start)) {
235
255
  await nftConnector.start(localIdentity);
236
256
  }
@@ -265,9 +285,9 @@ async function actionCommandNftMint(opts) {
265
285
  if (core.Is.stringValue(opts?.env)) {
266
286
  await cliCore.CLIUtils.writeEnvFile(opts.env, [`NFT_ID="${nftId}"`], opts.mergeEnv);
267
287
  }
268
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
269
- ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIotaRebased.IotaRebasedNftUtils.nftIdToObjectId(nftId)}?network=${network}`
270
- : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIota.IotaNftUtils.nftIdToAddress(nftId)}`);
288
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
289
+ ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(nftId)}?network=${network}`
290
+ : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(nftId)}`);
271
291
  cliCore.CLIDisplay.break();
272
292
  cliCore.CLIDisplay.done();
273
293
  }
@@ -308,13 +328,13 @@ function buildCommandNftResolve() {
308
328
  * @param opts.id The id of the NFT to resolve in urn format.
309
329
  * @param opts.connector The connector to perform the operations with.
310
330
  * @param opts.node The node URL.
311
- * @param opts.network The network to use for rebased connector.
331
+ * @param opts.network The network to use for connector.
312
332
  * @param opts.explorer The explorer URL.
313
333
  */
314
334
  async function actionCommandNftResolve(opts) {
315
335
  const id = cliCore.CLIParam.stringValue("id", opts.id);
316
336
  const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
317
- const network = opts.connector === NftConnectorTypes.IotaRebased
337
+ const network = opts.connector === NftConnectorTypes.Iota
318
338
  ? cliCore.CLIParam.stringValue("network", opts.network)
319
339
  : undefined;
320
340
  const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
@@ -325,6 +345,8 @@ async function actionCommandNftResolve(opts) {
325
345
  }
326
346
  cliCore.CLIDisplay.break();
327
347
  setupVault();
348
+ const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, network }, opts.connector);
349
+ walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
328
350
  const nftConnector = setupNftConnector({ nodeEndpoint, network }, opts.connector);
329
351
  cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.nft-resolve.progress.resolvingNft"));
330
352
  cliCore.CLIDisplay.break();
@@ -339,9 +361,9 @@ async function actionCommandNftResolve(opts) {
339
361
  if (core.Is.stringValue(opts?.json)) {
340
362
  await cliCore.CLIUtils.writeJsonFile(opts.json, nft, opts.mergeJson);
341
363
  }
342
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
343
- ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIotaRebased.IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
344
- : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIota.IotaNftUtils.nftIdToAddress(id)}`);
364
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
365
+ ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
366
+ : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(id)}`);
345
367
  cliCore.CLIDisplay.break();
346
368
  cliCore.CLIDisplay.done();
347
369
  }
@@ -360,8 +382,8 @@ function buildCommandNftTransfer() {
360
382
  .description(core.I18n.formatMessage("commands.nft-transfer.description"))
361
383
  .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.seed.param"), core.I18n.formatMessage("commands.nft-transfer.options.seed.description"))
362
384
  .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.id.param"), core.I18n.formatMessage("commands.nft-transfer.options.id.description"))
363
- .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.recipientIdentity.param"), core.I18n.formatMessage("commands.nft-transfer.options.recipientIdentity.description"))
364
- .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.recipientAddress.param"), core.I18n.formatMessage("commands.nft-transfer.options.recipientAddress.description"));
385
+ .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.recipient-identity.param"), core.I18n.formatMessage("commands.nft-transfer.options.recipient-identity.description"))
386
+ .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.recipient-address.param"), core.I18n.formatMessage("commands.nft-transfer.options.recipient-address.description"));
365
387
  command
366
388
  .addOption(new commander.Option(core.I18n.formatMessage("commands.common.options.connector.param"), core.I18n.formatMessage("commands.common.options.connector.description"))
367
389
  .choices(Object.values(NftConnectorTypes))
@@ -381,18 +403,18 @@ function buildCommandNftTransfer() {
381
403
  * @param opts.recipientAddress The recipient address of the NFT.
382
404
  * @param opts.connector The connector to perform the operations with.
383
405
  * @param opts.node The node URL.
384
- * @param opts.network The network to use for rebased connector.
406
+ * @param opts.network The network to use for connector.
385
407
  * @param opts.explorer The explorer URL.
386
408
  */
387
409
  async function actionCommandNftTransfer(opts) {
388
410
  const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
389
411
  const id = cliCore.CLIParam.stringValue("id", opts.id);
390
412
  const recipientIdentity = cliCore.CLIParam.stringValue("recipientIdentity", opts.recipientIdentity);
391
- const recipientAddress = opts.connector === NftConnectorTypes.IotaRebased
413
+ const recipientAddress = opts.connector === NftConnectorTypes.Iota
392
414
  ? core.Converter.bytesToHex(cliCore.CLIParam.hex("recipientAddress", opts.recipientAddress), true)
393
415
  : cliCore.CLIParam.bech32("recipientAddress", opts.recipientAddress);
394
416
  const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
395
- const network = opts.connector === NftConnectorTypes.IotaRebased
417
+ const network = opts.connector === NftConnectorTypes.Iota
396
418
  ? cliCore.CLIParam.stringValue("network", opts.network)
397
419
  : undefined;
398
420
  const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
@@ -405,6 +427,8 @@ async function actionCommandNftTransfer(opts) {
405
427
  }
406
428
  cliCore.CLIDisplay.break();
407
429
  setupVault();
430
+ const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, network }, opts.connector);
431
+ walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
408
432
  const localIdentity = "local";
409
433
  const vaultSeedId = "local-seed";
410
434
  const vaultConnector = vaultModels.VaultConnectorFactory.get("vault");
@@ -418,9 +442,9 @@ async function actionCommandNftTransfer(opts) {
418
442
  cliCore.CLIDisplay.spinnerStart();
419
443
  await nftConnector.transfer(localIdentity, id, recipientIdentity, recipientAddress);
420
444
  cliCore.CLIDisplay.spinnerStop();
421
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
422
- ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIotaRebased.IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
423
- : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIota.IotaNftUtils.nftIdToAddress(id)}`);
445
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
446
+ ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
447
+ : `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(id)}`);
424
448
  cliCore.CLIDisplay.break();
425
449
  cliCore.CLIDisplay.done();
426
450
  }
@@ -443,7 +467,7 @@ class CLI extends cliCore.CLIBase {
443
467
  return this.execute({
444
468
  title: "TWIN NFT",
445
469
  appName: "twin-nft",
446
- version: "0.0.1-next.18",
470
+ version: "0.0.1-next.20",
447
471
  icon: "🌍",
448
472
  supportsEnvFiles: true,
449
473
  overrideOutputWidth: options?.overrideOutputWidth
@@ -2,11 +2,12 @@ import path from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { CLIParam, CLIDisplay, CLIOptions, CLIUtils, CLIBase } from '@twin.org/cli-core';
4
4
  import { buildCommandMnemonic, buildCommandAddress } from '@twin.org/crypto-cli';
5
- import { buildCommandFaucet } from '@twin.org/wallet-cli';
5
+ import { setupWalletConnector, buildCommandFaucet } from '@twin.org/wallet-cli';
6
6
  import { I18n, Is, Converter, StringHelper } from '@twin.org/core';
7
7
  import { IotaNftConnector, IotaNftUtils } from '@twin.org/nft-connector-iota';
8
- import { IotaRebasedNftConnector, IotaRebasedNftUtils } from '@twin.org/nft-connector-iota-rebased';
8
+ import { IotaStardustNftConnector, IotaStardustNftUtils } from '@twin.org/nft-connector-iota-stardust';
9
9
  import { VaultConnectorFactory } from '@twin.org/vault-models';
10
+ import { WalletConnectorFactory } from '@twin.org/wallet-models';
10
11
  import { Command, Option } from 'commander';
11
12
  import { MemoryEntityStorageConnector } from '@twin.org/entity-storage-connector-memory';
12
13
  import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
@@ -24,9 +25,9 @@ const NftConnectorTypes = {
24
25
  */
25
26
  Iota: "iota",
26
27
  /**
27
- * IOTA Rebased.
28
+ * IOTA Stardust.
28
29
  */
29
- IotaRebased: "iota-rebased"
30
+ IotaStardust: "iota-stardust"
30
31
  };
31
32
 
32
33
  // Copyright 2024 IOTA Stiftung.
@@ -51,31 +52,34 @@ function setupVault() {
51
52
  * @param options.nodeEndpoint The node endpoint.
52
53
  * @param options.network The network.
53
54
  * @param options.vaultSeedId The vault seed ID.
55
+ * @param options.walletAddressIndex The wallet address index.
54
56
  * @param connector The connector to use.
55
57
  * @returns The NFT connector.
56
58
  */
57
59
  function setupNftConnector(options, connector) {
58
60
  connector ??= NftConnectorTypes.Iota;
59
61
  let instance;
60
- if (connector === NftConnectorTypes.IotaRebased) {
61
- instance = new IotaRebasedNftConnector({
62
+ if (connector === NftConnectorTypes.Iota) {
63
+ instance = new IotaNftConnector({
62
64
  config: {
63
65
  clientOptions: {
64
66
  url: options.nodeEndpoint
65
67
  },
66
68
  network: options.network ?? "",
67
- vaultSeedId: options.vaultSeedId
69
+ vaultSeedId: options.vaultSeedId,
70
+ walletAddressIndex: options.walletAddressIndex ?? 0
68
71
  }
69
72
  });
70
73
  }
71
74
  else {
72
- instance = new IotaNftConnector({
75
+ instance = new IotaStardustNftConnector({
73
76
  config: {
74
77
  clientOptions: {
75
78
  nodes: [options.nodeEndpoint],
76
79
  localPow: true
77
80
  },
78
- vaultSeedId: options.vaultSeedId
81
+ vaultSeedId: options.vaultSeedId,
82
+ walletAddressIndex: options.walletAddressIndex ?? 0
79
83
  }
80
84
  });
81
85
  }
@@ -113,14 +117,14 @@ function buildCommandNftBurn() {
113
117
  * @param opts.id The id of the NFT to burn in urn format.
114
118
  * @param opts.connector The connector to perform the operations with.
115
119
  * @param opts.node The node URL.
116
- * @param opts.network The network to use for rebased connector.
120
+ * @param opts.network The network to use for connector.
117
121
  * @param opts.explorer The explorer URL.
118
122
  */
119
123
  async function actionCommandNftBurn(opts) {
120
124
  const seed = CLIParam.hexBase64("seed", opts.seed);
121
125
  const id = CLIParam.stringValue("id", opts.id);
122
126
  const nodeEndpoint = CLIParam.url("node", opts.node);
123
- const network = opts.connector === NftConnectorTypes.IotaRebased
127
+ const network = opts.connector === NftConnectorTypes.Iota
124
128
  ? CLIParam.stringValue("network", opts.network)
125
129
  : undefined;
126
130
  const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
@@ -135,6 +139,8 @@ async function actionCommandNftBurn(opts) {
135
139
  const vaultSeedId = "local-seed";
136
140
  const vaultConnector = VaultConnectorFactory.get("vault");
137
141
  await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, Converter.bytesToBase64(seed));
142
+ const walletConnector = setupWalletConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
143
+ WalletConnectorFactory.register("wallet", () => walletConnector);
138
144
  const nftConnector = setupNftConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
139
145
  if (Is.function(nftConnector.start)) {
140
146
  await nftConnector.start(localIdentity);
@@ -144,9 +150,9 @@ async function actionCommandNftBurn(opts) {
144
150
  CLIDisplay.spinnerStart();
145
151
  await nftConnector.burn(localIdentity, id);
146
152
  CLIDisplay.spinnerStop();
147
- CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
148
- ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
149
- : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaNftUtils.nftIdToAddress(id)}`);
153
+ CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
154
+ ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
155
+ : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(id)}`);
150
156
  CLIDisplay.break();
151
157
  CLIDisplay.done();
152
158
  }
@@ -164,6 +170,8 @@ function buildCommandNftMint() {
164
170
  .summary(I18n.formatMessage("commands.nft-mint.summary"))
165
171
  .description(I18n.formatMessage("commands.nft-mint.description"))
166
172
  .requiredOption(I18n.formatMessage("commands.nft-mint.options.seed.param"), I18n.formatMessage("commands.nft-mint.options.seed.description"))
173
+ .requiredOption(I18n.formatMessage("commands.nft-mint.options.issuer.param"), I18n.formatMessage("commands.nft-mint.options.issuer.description"))
174
+ .option(I18n.formatMessage("commands.nft-mint.options.wallet-address-index.param"), I18n.formatMessage("commands.nft-mint.options.wallet-address-index.description"), "0")
167
175
  .requiredOption(I18n.formatMessage("commands.nft-mint.options.tag.param"), I18n.formatMessage("commands.nft-mint.options.tag.description"))
168
176
  .option(I18n.formatMessage("commands.nft-mint.options.immutable-json.param"), I18n.formatMessage("commands.nft-mint.options.immutable-json.description"))
169
177
  .option(I18n.formatMessage("commands.nft-mint.options.mutable-json.param"), I18n.formatMessage("commands.nft-mint.options.mutable-json.description"));
@@ -188,16 +196,22 @@ function buildCommandNftMint() {
188
196
  * Action the nft mint command.
189
197
  * @param opts The options for the command.
190
198
  * @param opts.seed The seed required for signing by the issuer.
199
+ * @param opts.issuer The identity of the issuer.
200
+ * @param opts.walletAddressIndex The wallet address index.
191
201
  * @param opts.tag The tag for the NFT.
192
202
  * @param opts.immutableJson Filename of the immutable JSON data.
193
203
  * @param opts.mutableJson Filename of the mutable JSON data.
194
204
  * @param opts.connector The connector to perform the operations with.
195
205
  * @param opts.node The node URL.
196
- * @param opts.network The network to use for rebased connector.
206
+ * @param opts.network The network to use for connector.
197
207
  * @param opts.explorer The explorer URL.
198
208
  */
199
209
  async function actionCommandNftMint(opts) {
200
210
  const seed = CLIParam.hexBase64("seed", opts.seed);
211
+ const issuer = CLIParam.stringValue("issuer", opts.issuer);
212
+ const walletAddressIndex = Is.empty(opts.walletAddressIndex)
213
+ ? undefined
214
+ : CLIParam.integer("wallet-address-index", opts.walletAddressIndex);
201
215
  const tag = CLIParam.stringValue("tag", opts.tag);
202
216
  const immutableJson = opts.immutableJson
203
217
  ? path.resolve(opts.immutableJson)
@@ -206,11 +220,15 @@ async function actionCommandNftMint(opts) {
206
220
  ? path.resolve(opts.mutableJson)
207
221
  : undefined;
208
222
  const nodeEndpoint = CLIParam.url("node", opts.node);
209
- const network = opts.connector === NftConnectorTypes.IotaRebased
223
+ const network = opts.connector === NftConnectorTypes.Iota
210
224
  ? CLIParam.stringValue("network", opts.network)
211
225
  : undefined;
212
226
  const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
213
- CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.tag"), tag);
227
+ CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.issuer"), issuer);
228
+ if (Is.number(walletAddressIndex)) {
229
+ CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.tag"), tag);
230
+ }
231
+ CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.walletAddressIndex"), walletAddressIndex);
214
232
  if (Is.stringValue(immutableJson)) {
215
233
  CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.immutableJsonFilename"), immutableJson);
216
234
  }
@@ -223,11 +241,13 @@ async function actionCommandNftMint(opts) {
223
241
  }
224
242
  CLIDisplay.break();
225
243
  setupVault();
226
- const localIdentity = "local";
244
+ const localIdentity = issuer;
227
245
  const vaultSeedId = "local-seed";
228
246
  const vaultConnector = VaultConnectorFactory.get("vault");
229
247
  await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, Converter.bytesToBase64(seed));
230
- const nftConnector = setupNftConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
248
+ const walletConnector = setupWalletConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
249
+ WalletConnectorFactory.register("wallet", () => walletConnector);
250
+ const nftConnector = setupNftConnector({ nodeEndpoint, network, vaultSeedId, walletAddressIndex }, opts.connector);
231
251
  if (Is.function(nftConnector.start)) {
232
252
  await nftConnector.start(localIdentity);
233
253
  }
@@ -262,9 +282,9 @@ async function actionCommandNftMint(opts) {
262
282
  if (Is.stringValue(opts?.env)) {
263
283
  await CLIUtils.writeEnvFile(opts.env, [`NFT_ID="${nftId}"`], opts.mergeEnv);
264
284
  }
265
- CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
266
- ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaRebasedNftUtils.nftIdToObjectId(nftId)}?network=${network}`
267
- : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaNftUtils.nftIdToAddress(nftId)}`);
285
+ CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
286
+ ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(nftId)}?network=${network}`
287
+ : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(nftId)}`);
268
288
  CLIDisplay.break();
269
289
  CLIDisplay.done();
270
290
  }
@@ -305,13 +325,13 @@ function buildCommandNftResolve() {
305
325
  * @param opts.id The id of the NFT to resolve in urn format.
306
326
  * @param opts.connector The connector to perform the operations with.
307
327
  * @param opts.node The node URL.
308
- * @param opts.network The network to use for rebased connector.
328
+ * @param opts.network The network to use for connector.
309
329
  * @param opts.explorer The explorer URL.
310
330
  */
311
331
  async function actionCommandNftResolve(opts) {
312
332
  const id = CLIParam.stringValue("id", opts.id);
313
333
  const nodeEndpoint = CLIParam.url("node", opts.node);
314
- const network = opts.connector === NftConnectorTypes.IotaRebased
334
+ const network = opts.connector === NftConnectorTypes.Iota
315
335
  ? CLIParam.stringValue("network", opts.network)
316
336
  : undefined;
317
337
  const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
@@ -322,6 +342,8 @@ async function actionCommandNftResolve(opts) {
322
342
  }
323
343
  CLIDisplay.break();
324
344
  setupVault();
345
+ const walletConnector = setupWalletConnector({ nodeEndpoint, network }, opts.connector);
346
+ WalletConnectorFactory.register("wallet", () => walletConnector);
325
347
  const nftConnector = setupNftConnector({ nodeEndpoint, network }, opts.connector);
326
348
  CLIDisplay.task(I18n.formatMessage("commands.nft-resolve.progress.resolvingNft"));
327
349
  CLIDisplay.break();
@@ -336,9 +358,9 @@ async function actionCommandNftResolve(opts) {
336
358
  if (Is.stringValue(opts?.json)) {
337
359
  await CLIUtils.writeJsonFile(opts.json, nft, opts.mergeJson);
338
360
  }
339
- CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
340
- ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
341
- : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaNftUtils.nftIdToAddress(id)}`);
361
+ CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
362
+ ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
363
+ : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(id)}`);
342
364
  CLIDisplay.break();
343
365
  CLIDisplay.done();
344
366
  }
@@ -357,8 +379,8 @@ function buildCommandNftTransfer() {
357
379
  .description(I18n.formatMessage("commands.nft-transfer.description"))
358
380
  .requiredOption(I18n.formatMessage("commands.nft-transfer.options.seed.param"), I18n.formatMessage("commands.nft-transfer.options.seed.description"))
359
381
  .requiredOption(I18n.formatMessage("commands.nft-transfer.options.id.param"), I18n.formatMessage("commands.nft-transfer.options.id.description"))
360
- .requiredOption(I18n.formatMessage("commands.nft-transfer.options.recipientIdentity.param"), I18n.formatMessage("commands.nft-transfer.options.recipientIdentity.description"))
361
- .requiredOption(I18n.formatMessage("commands.nft-transfer.options.recipientAddress.param"), I18n.formatMessage("commands.nft-transfer.options.recipientAddress.description"));
382
+ .requiredOption(I18n.formatMessage("commands.nft-transfer.options.recipient-identity.param"), I18n.formatMessage("commands.nft-transfer.options.recipient-identity.description"))
383
+ .requiredOption(I18n.formatMessage("commands.nft-transfer.options.recipient-address.param"), I18n.formatMessage("commands.nft-transfer.options.recipient-address.description"));
362
384
  command
363
385
  .addOption(new Option(I18n.formatMessage("commands.common.options.connector.param"), I18n.formatMessage("commands.common.options.connector.description"))
364
386
  .choices(Object.values(NftConnectorTypes))
@@ -378,18 +400,18 @@ function buildCommandNftTransfer() {
378
400
  * @param opts.recipientAddress The recipient address of the NFT.
379
401
  * @param opts.connector The connector to perform the operations with.
380
402
  * @param opts.node The node URL.
381
- * @param opts.network The network to use for rebased connector.
403
+ * @param opts.network The network to use for connector.
382
404
  * @param opts.explorer The explorer URL.
383
405
  */
384
406
  async function actionCommandNftTransfer(opts) {
385
407
  const seed = CLIParam.hexBase64("seed", opts.seed);
386
408
  const id = CLIParam.stringValue("id", opts.id);
387
409
  const recipientIdentity = CLIParam.stringValue("recipientIdentity", opts.recipientIdentity);
388
- const recipientAddress = opts.connector === NftConnectorTypes.IotaRebased
410
+ const recipientAddress = opts.connector === NftConnectorTypes.Iota
389
411
  ? Converter.bytesToHex(CLIParam.hex("recipientAddress", opts.recipientAddress), true)
390
412
  : CLIParam.bech32("recipientAddress", opts.recipientAddress);
391
413
  const nodeEndpoint = CLIParam.url("node", opts.node);
392
- const network = opts.connector === NftConnectorTypes.IotaRebased
414
+ const network = opts.connector === NftConnectorTypes.Iota
393
415
  ? CLIParam.stringValue("network", opts.network)
394
416
  : undefined;
395
417
  const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
@@ -402,6 +424,8 @@ async function actionCommandNftTransfer(opts) {
402
424
  }
403
425
  CLIDisplay.break();
404
426
  setupVault();
427
+ const walletConnector = setupWalletConnector({ nodeEndpoint, network }, opts.connector);
428
+ WalletConnectorFactory.register("wallet", () => walletConnector);
405
429
  const localIdentity = "local";
406
430
  const vaultSeedId = "local-seed";
407
431
  const vaultConnector = VaultConnectorFactory.get("vault");
@@ -415,9 +439,9 @@ async function actionCommandNftTransfer(opts) {
415
439
  CLIDisplay.spinnerStart();
416
440
  await nftConnector.transfer(localIdentity, id, recipientIdentity, recipientAddress);
417
441
  CLIDisplay.spinnerStop();
418
- CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
419
- ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
420
- : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaNftUtils.nftIdToAddress(id)}`);
442
+ CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
443
+ ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
444
+ : `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(id)}`);
421
445
  CLIDisplay.break();
422
446
  CLIDisplay.done();
423
447
  }
@@ -440,7 +464,7 @@ class CLI extends CLIBase {
440
464
  return this.execute({
441
465
  title: "TWIN NFT",
442
466
  appName: "twin-nft",
443
- version: "0.0.1-next.18",
467
+ version: "0.0.1-next.20",
444
468
  icon: "🌍",
445
469
  supportsEnvFiles: true,
446
470
  overrideOutputWidth: options?.overrideOutputWidth
@@ -179,19 +179,28 @@
179
179
  "multipleIsPrimary": "Property \"entitySchema.properties\" contains more than one property with isPrimary set"
180
180
  },
181
181
  "iotaNftConnector": {
182
- "inclusionFailed": "The transaction generated for the NFT was not included in a reasonable amount of time",
183
182
  "mintingFailed": "Minting the NFT failed",
184
183
  "resolvingFailed": "Resolving the NFT failed",
185
184
  "burningFailed": "Burning the NFT failed",
186
185
  "transferFailed": "Transferring the NFT failed",
187
186
  "updateFailed": "Updating the NFT failed",
188
187
  "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the IOTA NFT connector \"{namespace}\"",
189
- "insufficientFunds": "There were insufficient funds to complete the operation",
190
- "walletConnectorMissing": "The wallet connector must be available to perform this operation"
188
+ "failedToGetNftId": "Failed to get NFT ID from mint response",
189
+ "nftNotFound": "The NFT \"{nftId}\" was not found",
190
+ "nftOwnerNftFound": "The owner for NFT \"{nftId}\" was not found",
191
+ "startFailed": "Failed to start the IOTA NFT connector",
192
+ "deployTransactionFailed": "Deploying the contract failed with error: \"{error}\"",
193
+ "connectorNotStarted": "Please call start() before using this connector. Package ID: \"{packageId}\" is missing."
194
+ },
195
+ "iotaNftUtils": {
196
+ "invalidNftIdFormat": "The NFT ID \"{id}\" has an invalid format"
191
197
  },
192
198
  "iota": {
193
- "inclusionFailed": "The transaction generated was not included in a reasonable amount of time",
194
- "insufficientFunds": "There were insufficient funds to complete the operation"
199
+ "insufficientFunds": "There were insufficient funds to complete the operation",
200
+ "packageNotFoundOnNetwork": "The package \"{packageId}\" was not found on the network",
201
+ "packageObjectError": "Failed to fetch the package object \"{packageId}\"",
202
+ "nftTransactionFailed": "The NFT transaction failed",
203
+ "addressNotFound": "The address is missing could not be found from the seed \"{address}\""
195
204
  },
196
205
  "fetchHelper": {
197
206
  "decodingJSON": "Decoding JSON failed for route \"{route}\"",
@@ -204,29 +213,20 @@
204
213
  "noKeyOrSigner": "No key or signer was provided for JWT creation",
205
214
  "noKeyOrVerifier": "No key or verifier was provided for JWT creation"
206
215
  },
207
- "iotaRebasedNftConnector": {
216
+ "iotaStardustNftConnector": {
217
+ "inclusionFailed": "The transaction generated for the NFT was not included in a reasonable amount of time",
208
218
  "mintingFailed": "Minting the NFT failed",
209
219
  "resolvingFailed": "Resolving the NFT failed",
210
220
  "burningFailed": "Burning the NFT failed",
211
221
  "transferFailed": "Transferring the NFT failed",
212
222
  "updateFailed": "Updating the NFT failed",
213
- "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the IOTA Rebased NFT connector \"{namespace}\"",
214
- "failedToGetNftId": "Failed to get NFT ID from mint response",
215
- "nftNotFound": "The NFT \"{nftId}\" was not found",
216
- "nftOwnerNftFound": "The owner for NFT \"{nftId}\" was not found",
217
- "startFailed": "Failed to start the IOTA Rebased NFT connector",
218
- "deployTransactionFailed": "Deploying the contract failed with error: \"{error}\"",
219
- "connectorNotStarted": "Please call start() before using this connector. Package ID: \"{packageId}\" is missing."
220
- },
221
- "iotaRebasedNftUtils": {
222
- "invalidNftIdFormat": "The NFT ID \"{id}\" has an invalid format"
223
- },
224
- "iotaRebased": {
223
+ "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the IOTA NFT connector \"{namespace}\"",
225
224
  "insufficientFunds": "There were insufficient funds to complete the operation",
226
- "packageNotFoundOnNetwork": "The package \"{packageId}\" was not found on the network",
227
- "packageObjectError": "Failed to fetch the package object \"{packageId}\"",
228
- "nftTransactionFailed": "The NFT transaction failed",
229
- "addressNotFound": "The address is missing could not be found from the seed \"{address}\""
225
+ "walletConnectorMissing": "The wallet connector must be available to perform this operation"
226
+ },
227
+ "iotaStardust": {
228
+ "inclusionFailed": "The transaction generated was not included in a reasonable amount of time",
229
+ "insufficientFunds": "There were insufficient funds to complete the operation"
230
230
  },
231
231
  "entityStorageVaultConnector": {
232
232
  "keyAlreadyExists": "The key \"{existingId}\" already exists in the vault",
@@ -236,19 +236,19 @@
236
236
  "keyTypeMismatch": "The key type \"{keyType}\" does not match the requested encryption method \"{encryptionType}\""
237
237
  },
238
238
  "iotaWalletConnector": {
239
+ "transferFailed": "The wallet transfer failed."
240
+ },
241
+ "iotaFaucetConnector": {
242
+ "fundingFailed": "Fund the address from faucet failed"
243
+ },
244
+ "iotaStardustWalletConnector": {
239
245
  "transferFailed": "The wallet transfer failed.",
240
246
  "inclusionFailed": "The transaction generated was not included in a reasonable amount of time",
241
247
  "insufficientFunds": "There were insufficient funds to complete the operation"
242
248
  },
243
- "iotaFaucetConnector": {
249
+ "iotaStardustFaucetConnector": {
244
250
  "fundingFailed": "Fund the address from faucet failed",
245
251
  "insufficientFunds": "There were insufficient funds to complete the operation"
246
- },
247
- "iotaRebasedWalletConnector": {
248
- "transferFailed": "The wallet transfer failed."
249
- },
250
- "iotaRebasedFaucetConnector": {
251
- "fundingFailed": "Fund the address from faucet failed"
252
252
  }
253
253
  },
254
254
  "errorNames": {
@@ -495,6 +495,14 @@
495
495
  "param": "--seed '<'seed'>'",
496
496
  "description": "The seed for the issuer address in hex or base64 used to fund the minting, or start with ! to read environment variable."
497
497
  },
498
+ "issuer": {
499
+ "param": "--issuer '<'issuer'>'",
500
+ "description": "The identity of the NFT issuer, or start with ! to read environment variable."
501
+ },
502
+ "wallet-address-index": {
503
+ "param": "--wallet-address-index '<'wallet-address-index'>'",
504
+ "description": "The wallet address index to use for storing the NFT."
505
+ },
498
506
  "tag": {
499
507
  "param": "--tag '<'tag'>'",
500
508
  "description": "The tag for the NFT."
@@ -512,7 +520,9 @@
512
520
  "mintingNft": "Minting NFT"
513
521
  },
514
522
  "labels": {
523
+ "issuer": "Issuer",
515
524
  "tag": "Tag",
525
+ "walletAddressIndex": "Wallet Address Index",
516
526
  "immutableJsonFilename": "Immutable JSON Filename",
517
527
  "mutableJsonFilename": "Mutable JSON Filename",
518
528
  "immutableJson": "Immutable JSON",
@@ -570,12 +580,12 @@
570
580
  "param": "--id '<'id'>'",
571
581
  "description": "The id for the NFT in urn format."
572
582
  },
573
- "recipientIdentity": {
574
- "param": "--recipientIdentity '<'recipientIdentity'>'",
583
+ "recipient-identity": {
584
+ "param": "--recipient-identity '<'recipient-identity'>'",
575
585
  "description": "The identity of the NFT issuer, or start with ! to read environment variable."
576
586
  },
577
- "recipientAddress": {
578
- "param": "--recipientAddress '<'recipientAddress'>'",
587
+ "recipient-address": {
588
+ "param": "--recipient-address '<'recipient-address'>'",
579
589
  "description": "The address of the NFT recipient, or start with ! to read environment variable."
580
590
  }
581
591
  },
@@ -589,14 +599,14 @@
589
599
  }
590
600
  }
591
601
  },
592
- "errorMessages": {
593
- "fetch": "Fetch"
594
- },
595
602
  "info": {
596
- "iotaRebasedNftConnector": {
603
+ "iotaNftConnector": {
597
604
  "contractAlreadyDeployed": "Contract already deployed",
598
605
  "contractDeploymentStarted": "Contract deployment started",
599
606
  "contractDeploymentCompleted": "Contract deployment completed"
600
607
  }
608
+ },
609
+ "errorMessages": {
610
+ "fetch": "Fetch"
601
611
  }
602
612
  }
@@ -12,7 +12,7 @@ export declare function buildCommandNftBurn(): Command;
12
12
  * @param opts.id The id of the NFT to burn in urn format.
13
13
  * @param opts.connector The connector to perform the operations with.
14
14
  * @param opts.node The node URL.
15
- * @param opts.network The network to use for rebased connector.
15
+ * @param opts.network The network to use for connector.
16
16
  * @param opts.explorer The explorer URL.
17
17
  */
18
18
  export declare function actionCommandNftBurn(opts: {
@@ -10,16 +10,20 @@ export declare function buildCommandNftMint(): Command;
10
10
  * Action the nft mint command.
11
11
  * @param opts The options for the command.
12
12
  * @param opts.seed The seed required for signing by the issuer.
13
+ * @param opts.issuer The identity of the issuer.
14
+ * @param opts.walletAddressIndex The wallet address index.
13
15
  * @param opts.tag The tag for the NFT.
14
16
  * @param opts.immutableJson Filename of the immutable JSON data.
15
17
  * @param opts.mutableJson Filename of the mutable JSON data.
16
18
  * @param opts.connector The connector to perform the operations with.
17
19
  * @param opts.node The node URL.
18
- * @param opts.network The network to use for rebased connector.
20
+ * @param opts.network The network to use for connector.
19
21
  * @param opts.explorer The explorer URL.
20
22
  */
21
23
  export declare function actionCommandNftMint(opts: {
22
24
  seed: string;
25
+ issuer: string;
26
+ walletAddressIndex?: string;
23
27
  tag: string;
24
28
  immutableJson?: string;
25
29
  mutableJson?: string;
@@ -12,7 +12,7 @@ export declare function buildCommandNftResolve(): Command;
12
12
  * @param opts.id The id of the NFT to resolve in urn format.
13
13
  * @param opts.connector The connector to perform the operations with.
14
14
  * @param opts.node The node URL.
15
- * @param opts.network The network to use for rebased connector.
15
+ * @param opts.network The network to use for connector.
16
16
  * @param opts.explorer The explorer URL.
17
17
  */
18
18
  export declare function actionCommandNftResolve(opts: {
@@ -14,7 +14,7 @@ export declare function buildCommandNftTransfer(): Command;
14
14
  * @param opts.recipientAddress The recipient address of the NFT.
15
15
  * @param opts.connector The connector to perform the operations with.
16
16
  * @param opts.node The node URL.
17
- * @param opts.network The network to use for rebased connector.
17
+ * @param opts.network The network to use for connector.
18
18
  * @param opts.explorer The explorer URL.
19
19
  */
20
20
  export declare function actionCommandNftTransfer(opts: {
@@ -10,6 +10,7 @@ export declare function setupVault(): void;
10
10
  * @param options.nodeEndpoint The node endpoint.
11
11
  * @param options.network The network.
12
12
  * @param options.vaultSeedId The vault seed ID.
13
+ * @param options.walletAddressIndex The wallet address index.
13
14
  * @param connector The connector to use.
14
15
  * @returns The NFT connector.
15
16
  */
@@ -17,4 +18,5 @@ export declare function setupNftConnector(options: {
17
18
  nodeEndpoint: string;
18
19
  network?: string;
19
20
  vaultSeedId?: string;
21
+ walletAddressIndex?: number;
20
22
  }, connector?: NftConnectorTypes): INftConnector;
@@ -7,9 +7,9 @@ export declare const NftConnectorTypes: {
7
7
  */
8
8
  readonly Iota: "iota";
9
9
  /**
10
- * IOTA Rebased.
10
+ * IOTA Stardust.
11
11
  */
12
- readonly IotaRebased: "iota-rebased";
12
+ readonly IotaStardust: "iota-stardust";
13
13
  };
14
14
  /**
15
15
  * The NFT connector types.
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/nft-cli - Changelog
2
2
 
3
- ## v0.0.1-next.18
3
+ ## v0.0.1-next.20
4
4
 
5
5
  - Initial Release
@@ -46,7 +46,7 @@ The directory for the locales, default to relative to the script.
46
46
 
47
47
  Additional options for the CLI.
48
48
 
49
- ###### overrideOutputWidth
49
+ ###### overrideOutputWidth?
50
50
 
51
51
  `number`
52
52
 
@@ -22,7 +22,7 @@ The seed required for signing by the issuer.
22
22
 
23
23
  The id of the NFT to burn in urn format.
24
24
 
25
- #### connector
25
+ #### connector?
26
26
 
27
27
  [`NftConnectorTypes`](../type-aliases/NftConnectorTypes.md)
28
28
 
@@ -34,11 +34,11 @@ The connector to perform the operations with.
34
34
 
35
35
  The node URL.
36
36
 
37
- #### network
37
+ #### network?
38
38
 
39
39
  `string`
40
40
 
41
- The network to use for rebased connector.
41
+ The network to use for connector.
42
42
 
43
43
  #### explorer
44
44
 
@@ -34,7 +34,7 @@ The recipient address of the NFT.
34
34
 
35
35
  The recipient address of the NFT.
36
36
 
37
- #### connector
37
+ #### connector?
38
38
 
39
39
  [`NftConnectorTypes`](../type-aliases/NftConnectorTypes.md)
40
40
 
@@ -46,11 +46,11 @@ The connector to perform the operations with.
46
46
 
47
47
  The node URL.
48
48
 
49
- #### network
49
+ #### network?
50
50
 
51
51
  `string`
52
52
 
53
- The network to use for rebased connector.
53
+ The network to use for connector.
54
54
 
55
55
  #### explorer
56
56
 
@@ -16,18 +16,24 @@ The options for the NFT connector.
16
16
 
17
17
  The node endpoint.
18
18
 
19
- #### network
19
+ #### network?
20
20
 
21
21
  `string`
22
22
 
23
23
  The network.
24
24
 
25
- #### vaultSeedId
25
+ #### vaultSeedId?
26
26
 
27
27
  `string`
28
28
 
29
29
  The vault seed ID.
30
30
 
31
+ #### walletAddressIndex?
32
+
33
+ `number`
34
+
35
+ The wallet address index.
36
+
31
37
  ### connector?
32
38
 
33
39
  [`NftConnectorTypes`](../type-aliases/NftConnectorTypes.md)
@@ -12,8 +12,8 @@ The NFT connector types.
12
12
 
13
13
  IOTA.
14
14
 
15
- ### IotaRebased
15
+ ### IotaStardust
16
16
 
17
- > `readonly` **IotaRebased**: `"iota-rebased"` = `"iota-rebased"`
17
+ > `readonly` **IotaStardust**: `"iota-stardust"` = `"iota-stardust"`
18
18
 
19
- IOTA Rebased.
19
+ IOTA Stardust.
package/locales/en.json CHANGED
@@ -8,6 +8,14 @@
8
8
  "param": "--seed '<'seed'>'",
9
9
  "description": "The seed for the issuer address in hex or base64 used to fund the minting, or start with ! to read environment variable."
10
10
  },
11
+ "issuer": {
12
+ "param": "--issuer '<'issuer'>'",
13
+ "description": "The identity of the NFT issuer, or start with ! to read environment variable."
14
+ },
15
+ "wallet-address-index": {
16
+ "param": "--wallet-address-index '<'wallet-address-index'>'",
17
+ "description": "The wallet address index to use for storing the NFT."
18
+ },
11
19
  "tag": {
12
20
  "param": "--tag '<'tag'>'",
13
21
  "description": "The tag for the NFT."
@@ -25,7 +33,9 @@
25
33
  "mintingNft": "Minting NFT"
26
34
  },
27
35
  "labels": {
36
+ "issuer": "Issuer",
28
37
  "tag": "Tag",
38
+ "walletAddressIndex": "Wallet Address Index",
29
39
  "immutableJsonFilename": "Immutable JSON Filename",
30
40
  "mutableJsonFilename": "Mutable JSON Filename",
31
41
  "immutableJson": "Immutable JSON",
@@ -83,12 +93,12 @@
83
93
  "param": "--id '<'id'>'",
84
94
  "description": "The id for the NFT in urn format."
85
95
  },
86
- "recipientIdentity": {
87
- "param": "--recipientIdentity '<'recipientIdentity'>'",
96
+ "recipient-identity": {
97
+ "param": "--recipient-identity '<'recipient-identity'>'",
88
98
  "description": "The identity of the NFT issuer, or start with ! to read environment variable."
89
99
  },
90
- "recipientAddress": {
91
- "param": "--recipientAddress '<'recipientAddress'>'",
100
+ "recipient-address": {
101
+ "param": "--recipient-address '<'recipient-address'>'",
92
102
  "description": "The address of the NFT recipient, or start with ! to read environment variable."
93
103
  }
94
104
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/nft-cli",
3
- "version": "0.0.1-next.18",
3
+ "version": "0.0.1-next.20",
4
4
  "description": "A command line interface for interacting with the nft connectors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,11 +21,12 @@
21
21
  "@twin.org/entity": "next",
22
22
  "@twin.org/entity-storage-connector-memory": "next",
23
23
  "@twin.org/nameof": "next",
24
- "@twin.org/nft-connector-iota": "0.0.1-next.18",
25
- "@twin.org/nft-connector-iota-rebased": "0.0.1-next.18",
24
+ "@twin.org/nft-connector-iota": "0.0.1-next.20",
25
+ "@twin.org/nft-connector-iota-stardust": "0.0.1-next.20",
26
26
  "@twin.org/vault-connector-entity-storage": "next",
27
27
  "@twin.org/vault-models": "next",
28
28
  "@twin.org/wallet-cli": "next",
29
+ "@twin.org/wallet-models": "next",
29
30
  "commander": "13.1.0"
30
31
  },
31
32
  "main": "./dist/cjs/index.cjs",