@twin.org/nft-cli 0.0.1-next.17 → 0.0.1-next.19
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/dist/cjs/index.cjs +28 -28
- package/dist/esm/index.mjs +28 -28
- package/dist/locales/en.json +33 -33
- package/dist/types/commands/nftBurn.d.ts +1 -1
- package/dist/types/commands/nftMint.d.ts +1 -1
- package/dist/types/commands/nftResolve.d.ts +1 -1
- package/dist/types/commands/nftTransfer.d.ts +1 -1
- package/dist/types/models/nftConnectorTypes.d.ts +2 -2
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/CLI.md +1 -1
- package/docs/reference/functions/actionCommandNftBurn.md +3 -3
- package/docs/reference/functions/actionCommandNftTransfer.md +3 -3
- package/docs/reference/functions/setupNftConnector.md +2 -2
- package/docs/reference/variables/NftConnectorTypes.md +3 -3
- package/package.json +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ 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
|
|
10
|
+
var nftConnectorIotaStardust = require('@twin.org/nft-connector-iota-stardust');
|
|
11
11
|
var vaultModels = require('@twin.org/vault-models');
|
|
12
12
|
var commander = require('commander');
|
|
13
13
|
var entityStorageConnectorMemory = require('@twin.org/entity-storage-connector-memory');
|
|
@@ -27,9 +27,9 @@ const NftConnectorTypes = {
|
|
|
27
27
|
*/
|
|
28
28
|
Iota: "iota",
|
|
29
29
|
/**
|
|
30
|
-
* IOTA
|
|
30
|
+
* IOTA Stardust.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
IotaStardust: "iota-stardust"
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -60,8 +60,8 @@ function setupVault() {
|
|
|
60
60
|
function setupNftConnector(options, connector) {
|
|
61
61
|
connector ??= NftConnectorTypes.Iota;
|
|
62
62
|
let instance;
|
|
63
|
-
if (connector === NftConnectorTypes.
|
|
64
|
-
instance = new
|
|
63
|
+
if (connector === NftConnectorTypes.Iota) {
|
|
64
|
+
instance = new nftConnectorIota.IotaNftConnector({
|
|
65
65
|
config: {
|
|
66
66
|
clientOptions: {
|
|
67
67
|
url: options.nodeEndpoint
|
|
@@ -72,7 +72,7 @@ function setupNftConnector(options, connector) {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
instance = new
|
|
75
|
+
instance = new nftConnectorIotaStardust.IotaStardustNftConnector({
|
|
76
76
|
config: {
|
|
77
77
|
clientOptions: {
|
|
78
78
|
nodes: [options.nodeEndpoint],
|
|
@@ -116,14 +116,14 @@ function buildCommandNftBurn() {
|
|
|
116
116
|
* @param opts.id The id of the NFT to burn in urn format.
|
|
117
117
|
* @param opts.connector The connector to perform the operations with.
|
|
118
118
|
* @param opts.node The node URL.
|
|
119
|
-
* @param opts.network The network to use for
|
|
119
|
+
* @param opts.network The network to use for connector.
|
|
120
120
|
* @param opts.explorer The explorer URL.
|
|
121
121
|
*/
|
|
122
122
|
async function actionCommandNftBurn(opts) {
|
|
123
123
|
const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
|
|
124
124
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
125
125
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
126
|
-
const network = opts.connector === NftConnectorTypes.
|
|
126
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
127
127
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
128
128
|
: undefined;
|
|
129
129
|
const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
|
|
@@ -147,9 +147,9 @@ async function actionCommandNftBurn(opts) {
|
|
|
147
147
|
cliCore.CLIDisplay.spinnerStart();
|
|
148
148
|
await nftConnector.burn(localIdentity, id);
|
|
149
149
|
cliCore.CLIDisplay.spinnerStop();
|
|
150
|
-
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
151
|
-
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
152
|
-
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
150
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
151
|
+
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
|
|
152
|
+
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(id)}`);
|
|
153
153
|
cliCore.CLIDisplay.break();
|
|
154
154
|
cliCore.CLIDisplay.done();
|
|
155
155
|
}
|
|
@@ -196,7 +196,7 @@ function buildCommandNftMint() {
|
|
|
196
196
|
* @param opts.mutableJson Filename of the mutable JSON data.
|
|
197
197
|
* @param opts.connector The connector to perform the operations with.
|
|
198
198
|
* @param opts.node The node URL.
|
|
199
|
-
* @param opts.network The network to use for
|
|
199
|
+
* @param opts.network The network to use for connector.
|
|
200
200
|
* @param opts.explorer The explorer URL.
|
|
201
201
|
*/
|
|
202
202
|
async function actionCommandNftMint(opts) {
|
|
@@ -209,7 +209,7 @@ async function actionCommandNftMint(opts) {
|
|
|
209
209
|
? path.resolve(opts.mutableJson)
|
|
210
210
|
: undefined;
|
|
211
211
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
212
|
-
const network = opts.connector === NftConnectorTypes.
|
|
212
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
213
213
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
214
214
|
: undefined;
|
|
215
215
|
const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
|
|
@@ -265,9 +265,9 @@ async function actionCommandNftMint(opts) {
|
|
|
265
265
|
if (core.Is.stringValue(opts?.env)) {
|
|
266
266
|
await cliCore.CLIUtils.writeEnvFile(opts.env, [`NFT_ID="${nftId}"`], opts.mergeEnv);
|
|
267
267
|
}
|
|
268
|
-
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
269
|
-
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
270
|
-
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
268
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
269
|
+
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(nftId)}?network=${network}`
|
|
270
|
+
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(nftId)}`);
|
|
271
271
|
cliCore.CLIDisplay.break();
|
|
272
272
|
cliCore.CLIDisplay.done();
|
|
273
273
|
}
|
|
@@ -308,13 +308,13 @@ function buildCommandNftResolve() {
|
|
|
308
308
|
* @param opts.id The id of the NFT to resolve in urn format.
|
|
309
309
|
* @param opts.connector The connector to perform the operations with.
|
|
310
310
|
* @param opts.node The node URL.
|
|
311
|
-
* @param opts.network The network to use for
|
|
311
|
+
* @param opts.network The network to use for connector.
|
|
312
312
|
* @param opts.explorer The explorer URL.
|
|
313
313
|
*/
|
|
314
314
|
async function actionCommandNftResolve(opts) {
|
|
315
315
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
316
316
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
317
|
-
const network = opts.connector === NftConnectorTypes.
|
|
317
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
318
318
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
319
319
|
: undefined;
|
|
320
320
|
const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
|
|
@@ -339,9 +339,9 @@ async function actionCommandNftResolve(opts) {
|
|
|
339
339
|
if (core.Is.stringValue(opts?.json)) {
|
|
340
340
|
await cliCore.CLIUtils.writeJsonFile(opts.json, nft, opts.mergeJson);
|
|
341
341
|
}
|
|
342
|
-
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
343
|
-
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
344
|
-
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
342
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
343
|
+
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
|
|
344
|
+
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(id)}`);
|
|
345
345
|
cliCore.CLIDisplay.break();
|
|
346
346
|
cliCore.CLIDisplay.done();
|
|
347
347
|
}
|
|
@@ -381,18 +381,18 @@ function buildCommandNftTransfer() {
|
|
|
381
381
|
* @param opts.recipientAddress The recipient address of the NFT.
|
|
382
382
|
* @param opts.connector The connector to perform the operations with.
|
|
383
383
|
* @param opts.node The node URL.
|
|
384
|
-
* @param opts.network The network to use for
|
|
384
|
+
* @param opts.network The network to use for connector.
|
|
385
385
|
* @param opts.explorer The explorer URL.
|
|
386
386
|
*/
|
|
387
387
|
async function actionCommandNftTransfer(opts) {
|
|
388
388
|
const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
|
|
389
389
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
390
390
|
const recipientIdentity = cliCore.CLIParam.stringValue("recipientIdentity", opts.recipientIdentity);
|
|
391
|
-
const recipientAddress = opts.connector === NftConnectorTypes.
|
|
391
|
+
const recipientAddress = opts.connector === NftConnectorTypes.Iota
|
|
392
392
|
? core.Converter.bytesToHex(cliCore.CLIParam.hex("recipientAddress", opts.recipientAddress), true)
|
|
393
393
|
: cliCore.CLIParam.bech32("recipientAddress", opts.recipientAddress);
|
|
394
394
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
395
|
-
const network = opts.connector === NftConnectorTypes.
|
|
395
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
396
396
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
397
397
|
: undefined;
|
|
398
398
|
const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
|
|
@@ -418,9 +418,9 @@ async function actionCommandNftTransfer(opts) {
|
|
|
418
418
|
cliCore.CLIDisplay.spinnerStart();
|
|
419
419
|
await nftConnector.transfer(localIdentity, id, recipientIdentity, recipientAddress);
|
|
420
420
|
cliCore.CLIDisplay.spinnerStop();
|
|
421
|
-
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
422
|
-
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
423
|
-
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
421
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
422
|
+
? `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${nftConnectorIota.IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
|
|
423
|
+
: `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${nftConnectorIotaStardust.IotaStardustNftUtils.nftIdToAddress(id)}`);
|
|
424
424
|
cliCore.CLIDisplay.break();
|
|
425
425
|
cliCore.CLIDisplay.done();
|
|
426
426
|
}
|
|
@@ -443,7 +443,7 @@ class CLI extends cliCore.CLIBase {
|
|
|
443
443
|
return this.execute({
|
|
444
444
|
title: "TWIN NFT",
|
|
445
445
|
appName: "twin-nft",
|
|
446
|
-
version: "0.0.1-next.
|
|
446
|
+
version: "0.0.1-next.19",
|
|
447
447
|
icon: "🌍",
|
|
448
448
|
supportsEnvFiles: true,
|
|
449
449
|
overrideOutputWidth: options?.overrideOutputWidth
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { buildCommandMnemonic, buildCommandAddress } from '@twin.org/crypto-cli'
|
|
|
5
5
|
import { 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 {
|
|
8
|
+
import { IotaStardustNftConnector, IotaStardustNftUtils } from '@twin.org/nft-connector-iota-stardust';
|
|
9
9
|
import { VaultConnectorFactory } from '@twin.org/vault-models';
|
|
10
10
|
import { Command, Option } from 'commander';
|
|
11
11
|
import { MemoryEntityStorageConnector } from '@twin.org/entity-storage-connector-memory';
|
|
@@ -24,9 +24,9 @@ const NftConnectorTypes = {
|
|
|
24
24
|
*/
|
|
25
25
|
Iota: "iota",
|
|
26
26
|
/**
|
|
27
|
-
* IOTA
|
|
27
|
+
* IOTA Stardust.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
IotaStardust: "iota-stardust"
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -57,8 +57,8 @@ function setupVault() {
|
|
|
57
57
|
function setupNftConnector(options, connector) {
|
|
58
58
|
connector ??= NftConnectorTypes.Iota;
|
|
59
59
|
let instance;
|
|
60
|
-
if (connector === NftConnectorTypes.
|
|
61
|
-
instance = new
|
|
60
|
+
if (connector === NftConnectorTypes.Iota) {
|
|
61
|
+
instance = new IotaNftConnector({
|
|
62
62
|
config: {
|
|
63
63
|
clientOptions: {
|
|
64
64
|
url: options.nodeEndpoint
|
|
@@ -69,7 +69,7 @@ function setupNftConnector(options, connector) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
|
-
instance = new
|
|
72
|
+
instance = new IotaStardustNftConnector({
|
|
73
73
|
config: {
|
|
74
74
|
clientOptions: {
|
|
75
75
|
nodes: [options.nodeEndpoint],
|
|
@@ -113,14 +113,14 @@ function buildCommandNftBurn() {
|
|
|
113
113
|
* @param opts.id The id of the NFT to burn in urn format.
|
|
114
114
|
* @param opts.connector The connector to perform the operations with.
|
|
115
115
|
* @param opts.node The node URL.
|
|
116
|
-
* @param opts.network The network to use for
|
|
116
|
+
* @param opts.network The network to use for connector.
|
|
117
117
|
* @param opts.explorer The explorer URL.
|
|
118
118
|
*/
|
|
119
119
|
async function actionCommandNftBurn(opts) {
|
|
120
120
|
const seed = CLIParam.hexBase64("seed", opts.seed);
|
|
121
121
|
const id = CLIParam.stringValue("id", opts.id);
|
|
122
122
|
const nodeEndpoint = CLIParam.url("node", opts.node);
|
|
123
|
-
const network = opts.connector === NftConnectorTypes.
|
|
123
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
124
124
|
? CLIParam.stringValue("network", opts.network)
|
|
125
125
|
: undefined;
|
|
126
126
|
const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
|
|
@@ -144,9 +144,9 @@ async function actionCommandNftBurn(opts) {
|
|
|
144
144
|
CLIDisplay.spinnerStart();
|
|
145
145
|
await nftConnector.burn(localIdentity, id);
|
|
146
146
|
CLIDisplay.spinnerStop();
|
|
147
|
-
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
148
|
-
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
149
|
-
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
147
|
+
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
148
|
+
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
|
|
149
|
+
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(id)}`);
|
|
150
150
|
CLIDisplay.break();
|
|
151
151
|
CLIDisplay.done();
|
|
152
152
|
}
|
|
@@ -193,7 +193,7 @@ function buildCommandNftMint() {
|
|
|
193
193
|
* @param opts.mutableJson Filename of the mutable JSON data.
|
|
194
194
|
* @param opts.connector The connector to perform the operations with.
|
|
195
195
|
* @param opts.node The node URL.
|
|
196
|
-
* @param opts.network The network to use for
|
|
196
|
+
* @param opts.network The network to use for connector.
|
|
197
197
|
* @param opts.explorer The explorer URL.
|
|
198
198
|
*/
|
|
199
199
|
async function actionCommandNftMint(opts) {
|
|
@@ -206,7 +206,7 @@ async function actionCommandNftMint(opts) {
|
|
|
206
206
|
? path.resolve(opts.mutableJson)
|
|
207
207
|
: undefined;
|
|
208
208
|
const nodeEndpoint = CLIParam.url("node", opts.node);
|
|
209
|
-
const network = opts.connector === NftConnectorTypes.
|
|
209
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
210
210
|
? CLIParam.stringValue("network", opts.network)
|
|
211
211
|
: undefined;
|
|
212
212
|
const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
|
|
@@ -262,9 +262,9 @@ async function actionCommandNftMint(opts) {
|
|
|
262
262
|
if (Is.stringValue(opts?.env)) {
|
|
263
263
|
await CLIUtils.writeEnvFile(opts.env, [`NFT_ID="${nftId}"`], opts.mergeEnv);
|
|
264
264
|
}
|
|
265
|
-
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
266
|
-
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
267
|
-
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
265
|
+
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
266
|
+
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(nftId)}?network=${network}`
|
|
267
|
+
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(nftId)}`);
|
|
268
268
|
CLIDisplay.break();
|
|
269
269
|
CLIDisplay.done();
|
|
270
270
|
}
|
|
@@ -305,13 +305,13 @@ function buildCommandNftResolve() {
|
|
|
305
305
|
* @param opts.id The id of the NFT to resolve in urn format.
|
|
306
306
|
* @param opts.connector The connector to perform the operations with.
|
|
307
307
|
* @param opts.node The node URL.
|
|
308
|
-
* @param opts.network The network to use for
|
|
308
|
+
* @param opts.network The network to use for connector.
|
|
309
309
|
* @param opts.explorer The explorer URL.
|
|
310
310
|
*/
|
|
311
311
|
async function actionCommandNftResolve(opts) {
|
|
312
312
|
const id = CLIParam.stringValue("id", opts.id);
|
|
313
313
|
const nodeEndpoint = CLIParam.url("node", opts.node);
|
|
314
|
-
const network = opts.connector === NftConnectorTypes.
|
|
314
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
315
315
|
? CLIParam.stringValue("network", opts.network)
|
|
316
316
|
: undefined;
|
|
317
317
|
const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
|
|
@@ -336,9 +336,9 @@ async function actionCommandNftResolve(opts) {
|
|
|
336
336
|
if (Is.stringValue(opts?.json)) {
|
|
337
337
|
await CLIUtils.writeJsonFile(opts.json, nft, opts.mergeJson);
|
|
338
338
|
}
|
|
339
|
-
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
340
|
-
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
341
|
-
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
339
|
+
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
340
|
+
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
|
|
341
|
+
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(id)}`);
|
|
342
342
|
CLIDisplay.break();
|
|
343
343
|
CLIDisplay.done();
|
|
344
344
|
}
|
|
@@ -378,18 +378,18 @@ function buildCommandNftTransfer() {
|
|
|
378
378
|
* @param opts.recipientAddress The recipient address of the NFT.
|
|
379
379
|
* @param opts.connector The connector to perform the operations with.
|
|
380
380
|
* @param opts.node The node URL.
|
|
381
|
-
* @param opts.network The network to use for
|
|
381
|
+
* @param opts.network The network to use for connector.
|
|
382
382
|
* @param opts.explorer The explorer URL.
|
|
383
383
|
*/
|
|
384
384
|
async function actionCommandNftTransfer(opts) {
|
|
385
385
|
const seed = CLIParam.hexBase64("seed", opts.seed);
|
|
386
386
|
const id = CLIParam.stringValue("id", opts.id);
|
|
387
387
|
const recipientIdentity = CLIParam.stringValue("recipientIdentity", opts.recipientIdentity);
|
|
388
|
-
const recipientAddress = opts.connector === NftConnectorTypes.
|
|
388
|
+
const recipientAddress = opts.connector === NftConnectorTypes.Iota
|
|
389
389
|
? Converter.bytesToHex(CLIParam.hex("recipientAddress", opts.recipientAddress), true)
|
|
390
390
|
: CLIParam.bech32("recipientAddress", opts.recipientAddress);
|
|
391
391
|
const nodeEndpoint = CLIParam.url("node", opts.node);
|
|
392
|
-
const network = opts.connector === NftConnectorTypes.
|
|
392
|
+
const network = opts.connector === NftConnectorTypes.Iota
|
|
393
393
|
? CLIParam.stringValue("network", opts.network)
|
|
394
394
|
: undefined;
|
|
395
395
|
const explorerEndpoint = CLIParam.url("explorer", opts.explorer);
|
|
@@ -415,9 +415,9 @@ async function actionCommandNftTransfer(opts) {
|
|
|
415
415
|
CLIDisplay.spinnerStart();
|
|
416
416
|
await nftConnector.transfer(localIdentity, id, recipientIdentity, recipientAddress);
|
|
417
417
|
CLIDisplay.spinnerStop();
|
|
418
|
-
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.
|
|
419
|
-
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${
|
|
420
|
-
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${
|
|
418
|
+
CLIDisplay.value(I18n.formatMessage("commands.common.labels.explore"), opts.connector === NftConnectorTypes.Iota
|
|
419
|
+
? `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${IotaNftUtils.nftIdToObjectId(id)}?network=${network}`
|
|
420
|
+
: `${StringHelper.trimTrailingSlashes(explorerEndpoint)}/addr/${IotaStardustNftUtils.nftIdToAddress(id)}`);
|
|
421
421
|
CLIDisplay.break();
|
|
422
422
|
CLIDisplay.done();
|
|
423
423
|
}
|
|
@@ -440,7 +440,7 @@ class CLI extends CLIBase {
|
|
|
440
440
|
return this.execute({
|
|
441
441
|
title: "TWIN NFT",
|
|
442
442
|
appName: "twin-nft",
|
|
443
|
-
version: "0.0.1-next.
|
|
443
|
+
version: "0.0.1-next.19",
|
|
444
444
|
icon: "🌍",
|
|
445
445
|
supportsEnvFiles: true,
|
|
446
446
|
overrideOutputWidth: options?.overrideOutputWidth
|
package/dist/locales/en.json
CHANGED
|
@@ -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
|
-
"
|
|
190
|
-
"
|
|
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
|
-
"
|
|
194
|
-
"
|
|
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
|
-
"
|
|
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
|
|
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
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
"
|
|
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
|
-
"
|
|
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": {
|
|
@@ -589,14 +589,14 @@
|
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
591
|
},
|
|
592
|
-
"errorMessages": {
|
|
593
|
-
"fetch": "Fetch"
|
|
594
|
-
},
|
|
595
592
|
"info": {
|
|
596
|
-
"
|
|
593
|
+
"iotaNftConnector": {
|
|
597
594
|
"contractAlreadyDeployed": "Contract already deployed",
|
|
598
595
|
"contractDeploymentStarted": "Contract deployment started",
|
|
599
596
|
"contractDeploymentCompleted": "Contract deployment completed"
|
|
600
597
|
}
|
|
598
|
+
},
|
|
599
|
+
"errorMessages": {
|
|
600
|
+
"fetch": "Fetch"
|
|
601
601
|
}
|
|
602
602
|
}
|
|
@@ -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
|
|
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: {
|
|
@@ -15,7 +15,7 @@ export declare function buildCommandNftMint(): Command;
|
|
|
15
15
|
* @param opts.mutableJson Filename of the mutable JSON data.
|
|
16
16
|
* @param opts.connector The connector to perform the operations with.
|
|
17
17
|
* @param opts.node The node URL.
|
|
18
|
-
* @param opts.network The network to use for
|
|
18
|
+
* @param opts.network The network to use for connector.
|
|
19
19
|
* @param opts.explorer The explorer URL.
|
|
20
20
|
*/
|
|
21
21
|
export declare function actionCommandNftMint(opts: {
|
|
@@ -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
|
|
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
|
|
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: {
|
package/docs/changelog.md
CHANGED
|
@@ -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
|
|
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
|
|
53
|
+
The network to use for connector.
|
|
54
54
|
|
|
55
55
|
#### explorer
|
|
56
56
|
|
|
@@ -12,8 +12,8 @@ The NFT connector types.
|
|
|
12
12
|
|
|
13
13
|
IOTA.
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### IotaStardust
|
|
16
16
|
|
|
17
|
-
> `readonly` **
|
|
17
|
+
> `readonly` **IotaStardust**: `"iota-stardust"` = `"iota-stardust"`
|
|
18
18
|
|
|
19
|
-
IOTA
|
|
19
|
+
IOTA Stardust.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/nft-cli",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.19",
|
|
4
4
|
"description": "A command line interface for interacting with the nft connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
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.
|
|
25
|
-
"@twin.org/nft-connector-iota-
|
|
24
|
+
"@twin.org/nft-connector-iota": "0.0.1-next.19",
|
|
25
|
+
"@twin.org/nft-connector-iota-stardust": "0.0.1-next.19",
|
|
26
26
|
"@twin.org/vault-connector-entity-storage": "next",
|
|
27
27
|
"@twin.org/vault-models": "next",
|
|
28
28
|
"@twin.org/wallet-cli": "next",
|