@twin.org/nft-cli 0.0.1-next.16 → 0.0.1-next.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.
@@ -98,7 +98,6 @@ function buildCommandNftBurn() {
98
98
  .summary(core.I18n.formatMessage("commands.nft-burn.summary"))
99
99
  .description(core.I18n.formatMessage("commands.nft-burn.description"))
100
100
  .requiredOption(core.I18n.formatMessage("commands.nft-burn.options.seed.param"), core.I18n.formatMessage("commands.nft-burn.options.seed.description"))
101
- .requiredOption(core.I18n.formatMessage("commands.nft-burn.options.issuer.param"), core.I18n.formatMessage("commands.nft-burn.options.issuer.description"))
102
101
  .requiredOption(core.I18n.formatMessage("commands.nft-burn.options.id.param"), core.I18n.formatMessage("commands.nft-burn.options.id.description"));
103
102
  command
104
103
  .addOption(new commander.Option(core.I18n.formatMessage("commands.common.options.connector.param"), core.I18n.formatMessage("commands.common.options.connector.description"))
@@ -114,7 +113,6 @@ function buildCommandNftBurn() {
114
113
  * Action the nft burn command.
115
114
  * @param opts The options for the command.
116
115
  * @param opts.seed The seed required for signing by the issuer.
117
- * @param opts.issuer The issuer address of the NFT.
118
116
  * @param opts.id The id of the NFT to burn in urn format.
119
117
  * @param opts.connector The connector to perform the operations with.
120
118
  * @param opts.node The node URL.
@@ -123,16 +121,12 @@ function buildCommandNftBurn() {
123
121
  */
124
122
  async function actionCommandNftBurn(opts) {
125
123
  const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
126
- const issuer = opts.connector === NftConnectorTypes.IotaRebased
127
- ? core.Converter.bytesToHex(cliCore.CLIParam.hex("issuer", opts.issuer), true)
128
- : cliCore.CLIParam.bech32("issuer", opts.issuer);
129
124
  const id = cliCore.CLIParam.stringValue("id", opts.id);
130
125
  const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
131
126
  const network = opts.connector === NftConnectorTypes.IotaRebased
132
127
  ? cliCore.CLIParam.stringValue("network", opts.network)
133
128
  : undefined;
134
129
  const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
135
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-burn.labels.issuer"), issuer);
136
130
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-burn.labels.nftId"), id);
137
131
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
138
132
  if (core.Is.stringValue(network)) {
@@ -173,7 +167,6 @@ function buildCommandNftMint() {
173
167
  .summary(core.I18n.formatMessage("commands.nft-mint.summary"))
174
168
  .description(core.I18n.formatMessage("commands.nft-mint.description"))
175
169
  .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
170
  .requiredOption(core.I18n.formatMessage("commands.nft-mint.options.tag.param"), core.I18n.formatMessage("commands.nft-mint.options.tag.description"))
178
171
  .option(core.I18n.formatMessage("commands.nft-mint.options.immutable-json.param"), core.I18n.formatMessage("commands.nft-mint.options.immutable-json.description"))
179
172
  .option(core.I18n.formatMessage("commands.nft-mint.options.mutable-json.param"), core.I18n.formatMessage("commands.nft-mint.options.mutable-json.description"));
@@ -198,7 +191,6 @@ function buildCommandNftMint() {
198
191
  * Action the nft mint command.
199
192
  * @param opts The options for the command.
200
193
  * @param opts.seed The seed required for signing by the issuer.
201
- * @param opts.issuer The issuer address of the NFT.
202
194
  * @param opts.tag The tag for the NFT.
203
195
  * @param opts.immutableJson Filename of the immutable JSON data.
204
196
  * @param opts.mutableJson Filename of the mutable JSON data.
@@ -209,9 +201,6 @@ function buildCommandNftMint() {
209
201
  */
210
202
  async function actionCommandNftMint(opts) {
211
203
  const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
212
- const issuer = opts.connector === NftConnectorTypes.IotaRebased
213
- ? core.Converter.bytesToHex(cliCore.CLIParam.hex("issuer", opts.issuer), true)
214
- : cliCore.CLIParam.bech32("issuer", opts.issuer);
215
204
  const tag = cliCore.CLIParam.stringValue("tag", opts.tag);
216
205
  const immutableJson = opts.immutableJson
217
206
  ? path.resolve(opts.immutableJson)
@@ -224,7 +213,6 @@ async function actionCommandNftMint(opts) {
224
213
  ? cliCore.CLIParam.stringValue("network", opts.network)
225
214
  : undefined;
226
215
  const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
227
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.issuer"), issuer);
228
216
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.tag"), tag);
229
217
  if (core.Is.stringValue(immutableJson)) {
230
218
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.immutableJsonFilename"), immutableJson);
@@ -265,7 +253,7 @@ async function actionCommandNftMint(opts) {
265
253
  cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.nft-mint.progress.mintingNft"));
266
254
  cliCore.CLIDisplay.break();
267
255
  cliCore.CLIDisplay.spinnerStart();
268
- const nftId = await nftConnector.mint(localIdentity, issuer, tag, immutableJsonData, mutableJsonData);
256
+ const nftId = await nftConnector.mint(localIdentity, tag, immutableJsonData, mutableJsonData);
269
257
  cliCore.CLIDisplay.spinnerStop();
270
258
  if (opts.console) {
271
259
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-mint.labels.nftId"), nftId);
@@ -372,7 +360,8 @@ function buildCommandNftTransfer() {
372
360
  .description(core.I18n.formatMessage("commands.nft-transfer.description"))
373
361
  .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.seed.param"), core.I18n.formatMessage("commands.nft-transfer.options.seed.description"))
374
362
  .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.id.param"), core.I18n.formatMessage("commands.nft-transfer.options.id.description"))
375
- .requiredOption(core.I18n.formatMessage("commands.nft-transfer.options.recipient.param"), core.I18n.formatMessage("commands.nft-transfer.options.recipient.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"));
376
365
  command
377
366
  .addOption(new commander.Option(core.I18n.formatMessage("commands.common.options.connector.param"), core.I18n.formatMessage("commands.common.options.connector.description"))
378
367
  .choices(Object.values(NftConnectorTypes))
@@ -388,7 +377,8 @@ function buildCommandNftTransfer() {
388
377
  * @param opts The options for the command.
389
378
  * @param opts.seed The seed required for signing by the issuer.
390
379
  * @param opts.id The id of the NFT to transfer in urn format.
391
- * @param opts.recipient The recipient address of the NFT.
380
+ * @param opts.recipientIdentity The recipient address of the NFT.
381
+ * @param opts.recipientAddress The recipient address of the NFT.
392
382
  * @param opts.connector The connector to perform the operations with.
393
383
  * @param opts.node The node URL.
394
384
  * @param opts.network The network to use for rebased connector.
@@ -397,16 +387,18 @@ function buildCommandNftTransfer() {
397
387
  async function actionCommandNftTransfer(opts) {
398
388
  const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
399
389
  const id = cliCore.CLIParam.stringValue("id", opts.id);
400
- const recipient = opts.connector === NftConnectorTypes.IotaRebased
401
- ? core.Converter.bytesToHex(cliCore.CLIParam.hex("recipient", opts.recipient), true)
402
- : cliCore.CLIParam.bech32("recipient", opts.recipient);
390
+ const recipientIdentity = cliCore.CLIParam.stringValue("recipientIdentity", opts.recipientIdentity);
391
+ const recipientAddress = opts.connector === NftConnectorTypes.IotaRebased
392
+ ? core.Converter.bytesToHex(cliCore.CLIParam.hex("recipientAddress", opts.recipientAddress), true)
393
+ : cliCore.CLIParam.bech32("recipientAddress", opts.recipientAddress);
403
394
  const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
404
395
  const network = opts.connector === NftConnectorTypes.IotaRebased
405
396
  ? cliCore.CLIParam.stringValue("network", opts.network)
406
397
  : undefined;
407
398
  const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
408
399
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-transfer.labels.nftId"), id);
409
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-transfer.labels.recipient"), recipient);
400
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-transfer.labels.recipientIdentity"), recipientIdentity);
401
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.nft-transfer.labels.recipientAddress"), recipientAddress);
410
402
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
411
403
  if (core.Is.stringValue(network)) {
412
404
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
@@ -424,7 +416,7 @@ async function actionCommandNftTransfer(opts) {
424
416
  cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.nft-transfer.progress.transferringNft"));
425
417
  cliCore.CLIDisplay.break();
426
418
  cliCore.CLIDisplay.spinnerStart();
427
- await nftConnector.transfer(localIdentity, id, recipient);
419
+ await nftConnector.transfer(localIdentity, id, recipientIdentity, recipientAddress);
428
420
  cliCore.CLIDisplay.spinnerStop();
429
421
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
430
422
  ? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIotaRebased.IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
@@ -451,7 +443,7 @@ class CLI extends cliCore.CLIBase {
451
443
  return this.execute({
452
444
  title: "TWIN NFT",
453
445
  appName: "twin-nft",
454
- version: "0.0.1-next.16",
446
+ version: "0.0.1-next.18",
455
447
  icon: "🌍",
456
448
  supportsEnvFiles: true,
457
449
  overrideOutputWidth: options?.overrideOutputWidth
@@ -3,7 +3,7 @@ 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
5
  import { buildCommandFaucet } from '@twin.org/wallet-cli';
6
- import { I18n, Converter, Is, StringHelper } from '@twin.org/core';
6
+ import { I18n, Is, Converter, StringHelper } from '@twin.org/core';
7
7
  import { IotaNftConnector, IotaNftUtils } from '@twin.org/nft-connector-iota';
8
8
  import { IotaRebasedNftConnector, IotaRebasedNftUtils } from '@twin.org/nft-connector-iota-rebased';
9
9
  import { VaultConnectorFactory } from '@twin.org/vault-models';
@@ -95,7 +95,6 @@ function buildCommandNftBurn() {
95
95
  .summary(I18n.formatMessage("commands.nft-burn.summary"))
96
96
  .description(I18n.formatMessage("commands.nft-burn.description"))
97
97
  .requiredOption(I18n.formatMessage("commands.nft-burn.options.seed.param"), I18n.formatMessage("commands.nft-burn.options.seed.description"))
98
- .requiredOption(I18n.formatMessage("commands.nft-burn.options.issuer.param"), I18n.formatMessage("commands.nft-burn.options.issuer.description"))
99
98
  .requiredOption(I18n.formatMessage("commands.nft-burn.options.id.param"), I18n.formatMessage("commands.nft-burn.options.id.description"));
100
99
  command
101
100
  .addOption(new Option(I18n.formatMessage("commands.common.options.connector.param"), I18n.formatMessage("commands.common.options.connector.description"))
@@ -111,7 +110,6 @@ function buildCommandNftBurn() {
111
110
  * Action the nft burn command.
112
111
  * @param opts The options for the command.
113
112
  * @param opts.seed The seed required for signing by the issuer.
114
- * @param opts.issuer The issuer address of the NFT.
115
113
  * @param opts.id The id of the NFT to burn in urn format.
116
114
  * @param opts.connector The connector to perform the operations with.
117
115
  * @param opts.node The node URL.
@@ -120,16 +118,12 @@ function buildCommandNftBurn() {
120
118
  */
121
119
  async function actionCommandNftBurn(opts) {
122
120
  const seed = CLIParam.hexBase64("seed", opts.seed);
123
- const issuer = opts.connector === NftConnectorTypes.IotaRebased
124
- ? Converter.bytesToHex(CLIParam.hex("issuer", opts.issuer), true)
125
- : CLIParam.bech32("issuer", opts.issuer);
126
121
  const id = CLIParam.stringValue("id", opts.id);
127
122
  const nodeEndpoint = CLIParam.url("node", opts.node);
128
123
  const network = opts.connector === NftConnectorTypes.IotaRebased
129
124
  ? CLIParam.stringValue("network", opts.network)
130
125
  : undefined;
131
126
  const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
132
- CLIDisplay.value(I18n.formatMessage("commands.nft-burn.labels.issuer"), issuer);
133
127
  CLIDisplay.value(I18n.formatMessage("commands.nft-burn.labels.nftId"), id);
134
128
  CLIDisplay.value(I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
135
129
  if (Is.stringValue(network)) {
@@ -170,7 +164,6 @@ function buildCommandNftMint() {
170
164
  .summary(I18n.formatMessage("commands.nft-mint.summary"))
171
165
  .description(I18n.formatMessage("commands.nft-mint.description"))
172
166
  .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
167
  .requiredOption(I18n.formatMessage("commands.nft-mint.options.tag.param"), I18n.formatMessage("commands.nft-mint.options.tag.description"))
175
168
  .option(I18n.formatMessage("commands.nft-mint.options.immutable-json.param"), I18n.formatMessage("commands.nft-mint.options.immutable-json.description"))
176
169
  .option(I18n.formatMessage("commands.nft-mint.options.mutable-json.param"), I18n.formatMessage("commands.nft-mint.options.mutable-json.description"));
@@ -195,7 +188,6 @@ function buildCommandNftMint() {
195
188
  * Action the nft mint command.
196
189
  * @param opts The options for the command.
197
190
  * @param opts.seed The seed required for signing by the issuer.
198
- * @param opts.issuer The issuer address of the NFT.
199
191
  * @param opts.tag The tag for the NFT.
200
192
  * @param opts.immutableJson Filename of the immutable JSON data.
201
193
  * @param opts.mutableJson Filename of the mutable JSON data.
@@ -206,9 +198,6 @@ function buildCommandNftMint() {
206
198
  */
207
199
  async function actionCommandNftMint(opts) {
208
200
  const seed = CLIParam.hexBase64("seed", opts.seed);
209
- const issuer = opts.connector === NftConnectorTypes.IotaRebased
210
- ? Converter.bytesToHex(CLIParam.hex("issuer", opts.issuer), true)
211
- : CLIParam.bech32("issuer", opts.issuer);
212
201
  const tag = CLIParam.stringValue("tag", opts.tag);
213
202
  const immutableJson = opts.immutableJson
214
203
  ? path.resolve(opts.immutableJson)
@@ -221,7 +210,6 @@ async function actionCommandNftMint(opts) {
221
210
  ? CLIParam.stringValue("network", opts.network)
222
211
  : undefined;
223
212
  const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
224
- CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.issuer"), issuer);
225
213
  CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.tag"), tag);
226
214
  if (Is.stringValue(immutableJson)) {
227
215
  CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.immutableJsonFilename"), immutableJson);
@@ -262,7 +250,7 @@ async function actionCommandNftMint(opts) {
262
250
  CLIDisplay.task(I18n.formatMessage("commands.nft-mint.progress.mintingNft"));
263
251
  CLIDisplay.break();
264
252
  CLIDisplay.spinnerStart();
265
- const nftId = await nftConnector.mint(localIdentity, issuer, tag, immutableJsonData, mutableJsonData);
253
+ const nftId = await nftConnector.mint(localIdentity, tag, immutableJsonData, mutableJsonData);
266
254
  CLIDisplay.spinnerStop();
267
255
  if (opts.console) {
268
256
  CLIDisplay.value(I18n.formatMessage("commands.nft-mint.labels.nftId"), nftId);
@@ -369,7 +357,8 @@ function buildCommandNftTransfer() {
369
357
  .description(I18n.formatMessage("commands.nft-transfer.description"))
370
358
  .requiredOption(I18n.formatMessage("commands.nft-transfer.options.seed.param"), I18n.formatMessage("commands.nft-transfer.options.seed.description"))
371
359
  .requiredOption(I18n.formatMessage("commands.nft-transfer.options.id.param"), I18n.formatMessage("commands.nft-transfer.options.id.description"))
372
- .requiredOption(I18n.formatMessage("commands.nft-transfer.options.recipient.param"), I18n.formatMessage("commands.nft-transfer.options.recipient.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"));
373
362
  command
374
363
  .addOption(new Option(I18n.formatMessage("commands.common.options.connector.param"), I18n.formatMessage("commands.common.options.connector.description"))
375
364
  .choices(Object.values(NftConnectorTypes))
@@ -385,7 +374,8 @@ function buildCommandNftTransfer() {
385
374
  * @param opts The options for the command.
386
375
  * @param opts.seed The seed required for signing by the issuer.
387
376
  * @param opts.id The id of the NFT to transfer in urn format.
388
- * @param opts.recipient The recipient address of the NFT.
377
+ * @param opts.recipientIdentity The recipient address of the NFT.
378
+ * @param opts.recipientAddress The recipient address of the NFT.
389
379
  * @param opts.connector The connector to perform the operations with.
390
380
  * @param opts.node The node URL.
391
381
  * @param opts.network The network to use for rebased connector.
@@ -394,16 +384,18 @@ function buildCommandNftTransfer() {
394
384
  async function actionCommandNftTransfer(opts) {
395
385
  const seed = CLIParam.hexBase64("seed", opts.seed);
396
386
  const id = CLIParam.stringValue("id", opts.id);
397
- const recipient = opts.connector === NftConnectorTypes.IotaRebased
398
- ? Converter.bytesToHex(CLIParam.hex("recipient", opts.recipient), true)
399
- : CLIParam.bech32("recipient", opts.recipient);
387
+ const recipientIdentity = CLIParam.stringValue("recipientIdentity", opts.recipientIdentity);
388
+ const recipientAddress = opts.connector === NftConnectorTypes.IotaRebased
389
+ ? Converter.bytesToHex(CLIParam.hex("recipientAddress", opts.recipientAddress), true)
390
+ : CLIParam.bech32("recipientAddress", opts.recipientAddress);
400
391
  const nodeEndpoint = CLIParam.url("node", opts.node);
401
392
  const network = opts.connector === NftConnectorTypes.IotaRebased
402
393
  ? CLIParam.stringValue("network", opts.network)
403
394
  : undefined;
404
395
  const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
405
396
  CLIDisplay.value(I18n.formatMessage("commands.nft-transfer.labels.nftId"), id);
406
- CLIDisplay.value(I18n.formatMessage("commands.nft-transfer.labels.recipient"), recipient);
397
+ CLIDisplay.value(I18n.formatMessage("commands.nft-transfer.labels.recipientIdentity"), recipientIdentity);
398
+ CLIDisplay.value(I18n.formatMessage("commands.nft-transfer.labels.recipientAddress"), recipientAddress);
407
399
  CLIDisplay.value(I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
408
400
  if (Is.stringValue(network)) {
409
401
  CLIDisplay.value(I18n.formatMessage("commands.common.labels.network"), network);
@@ -421,7 +413,7 @@ async function actionCommandNftTransfer(opts) {
421
413
  CLIDisplay.task(I18n.formatMessage("commands.nft-transfer.progress.transferringNft"));
422
414
  CLIDisplay.break();
423
415
  CLIDisplay.spinnerStart();
424
- await nftConnector.transfer(localIdentity, id, recipient);
416
+ await nftConnector.transfer(localIdentity, id, recipientIdentity, recipientAddress);
425
417
  CLIDisplay.spinnerStop();
426
418
  CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.IotaRebased
427
419
  ? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaRebasedNftUtils.nftIdToObjectId(id)}?network=${network}`
@@ -448,7 +440,7 @@ class CLI extends CLIBase {
448
440
  return this.execute({
449
441
  title: "TWIN NFT",
450
442
  appName: "twin-nft",
451
- version: "0.0.1-next.16",
443
+ version: "0.0.1-next.18",
452
444
  icon: "🌍",
453
445
  supportsEnvFiles: true,
454
446
  overrideOutputWidth: options?.overrideOutputWidth