@twin.org/nft-models 0.0.3-next.2 → 0.0.3-next.4
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/README.md +1 -1
- package/dist/es/models/IIrc27Metadata.js.map +1 -1
- package/dist/es/models/INftComponent.js.map +1 -1
- package/dist/es/models/INftConnector.js.map +1 -1
- package/dist/es/models/api/INftResolveResponse.js.map +1 -1
- package/dist/es/models/api/INftTransferRequest.js.map +1 -1
- package/dist/types/models/IIrc27Metadata.d.ts +1 -1
- package/dist/types/models/INftComponent.d.ts +2 -3
- package/dist/types/models/INftConnector.d.ts +2 -3
- package/dist/types/models/api/INftResolveResponse.d.ts +3 -2
- package/dist/types/models/api/INftTransferRequest.d.ts +0 -4
- package/docs/changelog.md +15 -1
- package/docs/examples.md +90 -1
- package/docs/reference/interfaces/IIrc27Metadata.md +16 -16
- package/docs/reference/interfaces/INftBurnRequest.md +1 -1
- package/docs/reference/interfaces/INftComponent.md +8 -14
- package/docs/reference/interfaces/INftConnector.md +8 -14
- package/docs/reference/interfaces/INftMintRequest.md +4 -4
- package/docs/reference/interfaces/INftResolveRequest.md +1 -1
- package/docs/reference/interfaces/INftResolveResponse.md +7 -6
- package/docs/reference/interfaces/INftTransferRequest.md +3 -9
- package/docs/reference/interfaces/INftUpdateRequest.md +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN NFT Models
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package defines the shared interfaces, factories, and API models used by NFT connectors, services, and clients in this repository. It provides a stable contract layer that keeps implementations interoperable across different runtime environments.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIrc27Metadata.js","sourceRoot":"","sources":["../../../src/models/IIrc27Metadata.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model defining the IRC27 NFT Standards.\n * https://
|
|
1
|
+
{"version":3,"file":"IIrc27Metadata.js","sourceRoot":"","sources":["../../../src/models/IIrc27Metadata.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model defining the IRC27 NFT Standards.\n * https://docs.iota.org/developer/references/framework/stardust/irc27\n */\nexport interface IIrc27Metadata {\n\t/**\n\t * The standard marker.\n\t */\n\tstandard: \"IRC27\";\n\n\t/**\n\t * The version\n\t */\n\tversion: \"v1.0\";\n\n\t/**\n\t * A mime type for the content of the NFT.\n\t */\n\ttype: string;\n\n\t/**\n\t * Url pointing to the NFT file location with MIME type defined in type.\n\t */\n\turi: string;\n\n\t/**\n\t * Alphanumeric text string defining the human identifiable name for the NFT\n\t */\n\tname: string;\n\n\t/**\n\t * Alphanumeric text string defining the human identifiable collection name.\n\t */\n\tcollectionName?: string;\n\n\t/**\n\t * Object containing key value pair where payment address mapped to the payout percentage.\n\t */\n\troyalties?: {\n\t\t[id: string]: number;\n\t};\n\n\t/**\n\t * Alphanumeric text string to define the human identifiable name of the creator.\n\t */\n\tissuerName?: string;\n\n\t/**\n\t * Alphanumeric text string to define a basic description of the NFT.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Array objects defining additional attributes of the NFT\n\t */\n\tattributes?: {\n\t\ttrait_type: string;\n\t\tvalue: unknown;\n\t}[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INftComponent.js","sourceRoot":"","sources":["../../../src/models/INftComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface describing an NFT component.\n */\nexport interface INftComponent extends IComponent {\n\t/**\n\t * Mint an NFT.\n\t * @param tag The tag for the NFT.\n\t * @param immutableMetadata The immutable metadata for the NFT.\n\t * @param metadata The metadata for the NFT.\n\t * @param namespace The namespace of the connector to use for the NFT, defaults to component configured namespace.\n\t * @param identity The identity to perform the nft operation with.\n\t * @returns The id of the created NFT in urn format.\n\t */\n\tmint<T = unknown, U = unknown>(\n\t\ttag: string,\n\t\timmutableMetadata?: T,\n\t\tmetadata?: U,\n\t\tnamespace?: string,\n\t\tidentity?: string\n\t): Promise<string>;\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The data for the NFT.\n\t */\n\tresolve<T = unknown, U = unknown>(\n\t\tid: string,\n\t\tcontrollerIdentity?: string\n\t): Promise<{\n\t\tissuer: string;\n\t\
|
|
1
|
+
{"version":3,"file":"INftComponent.js","sourceRoot":"","sources":["../../../src/models/INftComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface describing an NFT component.\n */\nexport interface INftComponent extends IComponent {\n\t/**\n\t * Mint an NFT.\n\t * @param tag The tag for the NFT.\n\t * @param immutableMetadata The immutable metadata for the NFT.\n\t * @param metadata The metadata for the NFT.\n\t * @param namespace The namespace of the connector to use for the NFT, defaults to component configured namespace.\n\t * @param identity The identity to perform the nft operation with.\n\t * @returns The id of the created NFT in urn format.\n\t */\n\tmint<T = unknown, U = unknown>(\n\t\ttag: string,\n\t\timmutableMetadata?: T,\n\t\tmetadata?: U,\n\t\tnamespace?: string,\n\t\tidentity?: string\n\t): Promise<string>;\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The data for the NFT.\n\t */\n\tresolve<T = unknown, U = unknown>(\n\t\tid: string,\n\t\tcontrollerIdentity?: string\n\t): Promise<{\n\t\tissuer: string;\n\t\tissuerIdentityId: string;\n\t\ttag: string;\n\t\timmutableMetadata?: T;\n\t\tmetadata?: U;\n\t}>;\n\n\t/**\n\t * Burn an NFT.\n\t * @param id The id of the NFT to burn in urn format.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tburn(id: string, controllerIdentity?: string): Promise<void>;\n\n\t/**\n\t * Transfer an NFT.\n\t * @param id The id of the NFT to transfer in urn format.\n\t * @param recipientAddress The recipient address for the NFT.\n\t * @param metadata Optional mutable data to include during the transfer.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\ttransfer<U = unknown>(\n\t\tid: string,\n\t\trecipientAddress: string,\n\t\tmetadata?: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void>;\n\n\t/**\n\t * Update the mutable data of the NFT.\n\t * @param id The id of the NFT to update in urn format.\n\t * @param metadata The mutable data to update.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tupdate<U = unknown>(id: string, metadata: U, controllerIdentity?: string): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INftConnector.js","sourceRoot":"","sources":["../../../src/models/INftConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface describing an NFT connector.\n */\nexport interface INftConnector extends IComponent {\n\t/**\n\t * Mint an NFT.\n\t * @param controllerIdentity The identity of the user to access the vault keys.\n\t * @param tag The tag for the NFT.\n\t * @param immutableMetadata The immutable metadata for the NFT.\n\t * @param metadata The metadata for the NFT.\n\t * @returns The id of the created NFT in urn format.\n\t */\n\tmint<T = unknown, U = unknown>(\n\t\tcontrollerIdentity: string,\n\t\ttag: string,\n\t\timmutableMetadata?: T,\n\t\tmetadata?: U\n\t): Promise<string>;\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @returns The data for the NFT.\n\t */\n\tresolve<T = unknown, U = unknown>(\n\t\tid: string\n\t): Promise<{\n\t\tissuer: string;\n\t\
|
|
1
|
+
{"version":3,"file":"INftConnector.js","sourceRoot":"","sources":["../../../src/models/INftConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface describing an NFT connector.\n */\nexport interface INftConnector extends IComponent {\n\t/**\n\t * Mint an NFT.\n\t * @param controllerIdentity The identity of the user to access the vault keys.\n\t * @param tag The tag for the NFT.\n\t * @param immutableMetadata The immutable metadata for the NFT.\n\t * @param metadata The metadata for the NFT.\n\t * @returns The id of the created NFT in urn format.\n\t */\n\tmint<T = unknown, U = unknown>(\n\t\tcontrollerIdentity: string,\n\t\ttag: string,\n\t\timmutableMetadata?: T,\n\t\tmetadata?: U\n\t): Promise<string>;\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @returns The data for the NFT.\n\t */\n\tresolve<T = unknown, U = unknown>(\n\t\tid: string\n\t): Promise<{\n\t\tissuer: string;\n\t\tissuerIdentityId: string;\n\t\ttag: string;\n\t\timmutableMetadata?: T;\n\t\tmetadata?: U;\n\t}>;\n\n\t/**\n\t * Burn an NFT.\n\t * @param controller The controller of the NFT who can make changes.\n\t * @param id The id of the NFT to burn in urn format.\n\t * @returns Nothing.\n\t */\n\tburn(controller: string, id: string): Promise<void>;\n\n\t/**\n\t * Transfer an NFT.\n\t * @param controllerIdentity The controller of the NFT who can make changes.\n\t * @param id The id of the NFT to transfer in urn format.\n\t * @param recipientAddress The recipient address for the NFT.\n\t * @param metadata Optional mutable data to include during the transfer.\n\t * @returns Nothing.\n\t */\n\ttransfer<U = unknown>(\n\t\tcontrollerIdentity: string,\n\t\tid: string,\n\t\trecipientAddress: string,\n\t\tmetadata?: U\n\t): Promise<void>;\n\n\t/**\n\t * Update the mutable data of the NFT.\n\t * @param controllerIdentity The controller of the NFT who can make changes.\n\t * @param id The id of the NFT to update in urn format.\n\t * @param metadata The mutable data to update.\n\t * @returns Nothing.\n\t */\n\tupdate<U = unknown>(controllerIdentity: string, id: string, metadata: U): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INftResolveResponse.js","sourceRoot":"","sources":["../../../../src/models/api/INftResolveResponse.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Response to resolving the NFT.\n */\nexport interface INftResolveResponse {\n\t/**\n\t * The data that was resolved.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The issuer of the NFT.\n\t\t */\n\t\tissuer: string;\n\n\t\t/**\n\t\t * The
|
|
1
|
+
{"version":3,"file":"INftResolveResponse.js","sourceRoot":"","sources":["../../../../src/models/api/INftResolveResponse.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Response to resolving the NFT.\n */\nexport interface INftResolveResponse {\n\t/**\n\t * The data that was resolved.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The issuer of the NFT.\n\t\t */\n\t\tissuer: string;\n\n\t\t/**\n\t\t * The on-chain Object ID of the verified IOTA Identity that minted this NFT.\n\t\t * Empty string when not minted with identity verification.\n\t\t */\n\t\tissuerIdentityId: string;\n\n\t\t/**\n\t\t * The tag data for the NFT.\n\t\t */\n\t\ttag: string;\n\n\t\t/**\n\t\t * The immutable data for the NFT.\n\t\t */\n\t\timmutableMetadata?: unknown;\n\n\t\t/**\n\t\t * The metadata for the NFT.\n\t\t */\n\t\tmetadata?: unknown;\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INftTransferRequest.js","sourceRoot":"","sources":["../../../../src/models/api/INftTransferRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Transfer the NFT and update the metadata.\n */\nexport interface INftTransferRequest {\n\t/**\n\t * The data to be used in the transfer.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the NFT to transfer in urn format.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The data to be used in the transfer.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The recipient
|
|
1
|
+
{"version":3,"file":"INftTransferRequest.js","sourceRoot":"","sources":["../../../../src/models/api/INftTransferRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Transfer the NFT and update the metadata.\n */\nexport interface INftTransferRequest {\n\t/**\n\t * The data to be used in the transfer.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the NFT to transfer in urn format.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The data to be used in the transfer.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The recipient address for the NFT.\n\t\t */\n\t\trecipientAddress: string;\n\n\t\t/**\n\t\t * The metadata for the NFT.\n\t\t */\n\t\tmetadata?: unknown;\n\t};\n}\n"]}
|
|
@@ -21,7 +21,7 @@ export interface INftComponent extends IComponent {
|
|
|
21
21
|
*/
|
|
22
22
|
resolve<T = unknown, U = unknown>(id: string, controllerIdentity?: string): Promise<{
|
|
23
23
|
issuer: string;
|
|
24
|
-
|
|
24
|
+
issuerIdentityId: string;
|
|
25
25
|
tag: string;
|
|
26
26
|
immutableMetadata?: T;
|
|
27
27
|
metadata?: U;
|
|
@@ -36,13 +36,12 @@ export interface INftComponent extends IComponent {
|
|
|
36
36
|
/**
|
|
37
37
|
* Transfer an NFT.
|
|
38
38
|
* @param id The id of the NFT to transfer in urn format.
|
|
39
|
-
* @param recipientIdentity The recipient identity for the NFT.
|
|
40
39
|
* @param recipientAddress The recipient address for the NFT.
|
|
41
40
|
* @param metadata Optional mutable data to include during the transfer.
|
|
42
41
|
* @param controllerIdentity The identity to perform the nft operation with.
|
|
43
42
|
* @returns Nothing.
|
|
44
43
|
*/
|
|
45
|
-
transfer<U = unknown>(id: string,
|
|
44
|
+
transfer<U = unknown>(id: string, recipientAddress: string, metadata?: U, controllerIdentity?: string): Promise<void>;
|
|
46
45
|
/**
|
|
47
46
|
* Update the mutable data of the NFT.
|
|
48
47
|
* @param id The id of the NFT to update in urn format.
|
|
@@ -19,7 +19,7 @@ export interface INftConnector extends IComponent {
|
|
|
19
19
|
*/
|
|
20
20
|
resolve<T = unknown, U = unknown>(id: string): Promise<{
|
|
21
21
|
issuer: string;
|
|
22
|
-
|
|
22
|
+
issuerIdentityId: string;
|
|
23
23
|
tag: string;
|
|
24
24
|
immutableMetadata?: T;
|
|
25
25
|
metadata?: U;
|
|
@@ -35,12 +35,11 @@ export interface INftConnector extends IComponent {
|
|
|
35
35
|
* Transfer an NFT.
|
|
36
36
|
* @param controllerIdentity The controller of the NFT who can make changes.
|
|
37
37
|
* @param id The id of the NFT to transfer in urn format.
|
|
38
|
-
* @param recipientIdentity The recipient identity for the NFT.
|
|
39
38
|
* @param recipientAddress The recipient address for the NFT.
|
|
40
39
|
* @param metadata Optional mutable data to include during the transfer.
|
|
41
40
|
* @returns Nothing.
|
|
42
41
|
*/
|
|
43
|
-
transfer<U = unknown>(controllerIdentity: string, id: string,
|
|
42
|
+
transfer<U = unknown>(controllerIdentity: string, id: string, recipientAddress: string, metadata?: U): Promise<void>;
|
|
44
43
|
/**
|
|
45
44
|
* Update the mutable data of the NFT.
|
|
46
45
|
* @param controllerIdentity The controller of the NFT who can make changes.
|
|
@@ -11,9 +11,10 @@ export interface INftResolveResponse {
|
|
|
11
11
|
*/
|
|
12
12
|
issuer: string;
|
|
13
13
|
/**
|
|
14
|
-
* The
|
|
14
|
+
* The on-chain Object ID of the verified IOTA Identity that minted this NFT.
|
|
15
|
+
* Empty string when not minted with identity verification.
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
issuerIdentityId: string;
|
|
17
18
|
/**
|
|
18
19
|
* The tag data for the NFT.
|
|
19
20
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/nft/compare/nft-models-v0.0.3-next.3...nft-models-v0.0.3-next.4) (2026-04-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add on-chain identity binding to NFT minting ([#58](https://github.com/twinfoundation/nft/issues/58)) ([730a16d](https://github.com/twinfoundation/nft/commit/730a16d70fc026c920dbede0e4dafc96f37b729a))
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/nft/compare/nft-models-v0.0.3-next.2...nft-models-v0.0.3-next.3) (2026-03-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* update docs ([75dc85e](https://github.com/twinfoundation/nft/commit/75dc85ed0476666d0a1cc5d83ca0a5db29b69992))
|
|
2
16
|
|
|
3
17
|
## [0.0.3-next.2](https://github.com/twinfoundation/nft/compare/nft-models-v0.0.3-next.1...nft-models-v0.0.3-next.2) (2026-02-25)
|
|
4
18
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NFT Models Examples
|
|
2
|
+
|
|
3
|
+
These examples focus on connector contracts and shared request models so multiple implementations can follow the same API surface.
|
|
4
|
+
|
|
5
|
+
## NftConnectorFactory
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { NftConnectorFactory, type INftConnector } from '@twin.org/nft-models';
|
|
9
|
+
|
|
10
|
+
class MockNftConnector implements INftConnector {
|
|
11
|
+
public className(): string {
|
|
12
|
+
return 'MockNftConnector';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public async mint(controllerIdentity: string, tag: string): Promise<string> {
|
|
16
|
+
return `nft:entity-storage:${controllerIdentity}:${tag}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async resolve(id: string): Promise<{ issuer: string; owner: string; tag: string }> {
|
|
20
|
+
return {
|
|
21
|
+
issuer: 'did:example:issuer-1',
|
|
22
|
+
owner: 'did:example:owner-1',
|
|
23
|
+
tag: id
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async burn(): Promise<void> {}
|
|
28
|
+
|
|
29
|
+
public async transfer(): Promise<void> {}
|
|
30
|
+
|
|
31
|
+
public async update(): Promise<void> {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
NftConnectorFactory.register('mock-nft', () => new MockNftConnector());
|
|
35
|
+
|
|
36
|
+
const connectorNames = NftConnectorFactory.names();
|
|
37
|
+
const connector = NftConnectorFactory.get<INftConnector>('mock-nft');
|
|
38
|
+
|
|
39
|
+
console.log(connectorNames.includes('mock-nft')); // true
|
|
40
|
+
console.log(connector.className()); // MockNftConnector
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## INftComponent Request Shapes
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import type {
|
|
47
|
+
IIrc27Metadata,
|
|
48
|
+
INftMintRequest,
|
|
49
|
+
INftTransferRequest,
|
|
50
|
+
INftUpdateRequest
|
|
51
|
+
} from '@twin.org/nft-models';
|
|
52
|
+
|
|
53
|
+
const immutableMetadata: IIrc27Metadata = {
|
|
54
|
+
standard: 'IRC27',
|
|
55
|
+
version: 'v1.0',
|
|
56
|
+
type: 'image/png',
|
|
57
|
+
uri: 'ipfs://bafybeigdyr...',
|
|
58
|
+
name: 'Genesis Badge',
|
|
59
|
+
description: 'A launch collectible'
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const mintRequest: INftMintRequest = {
|
|
63
|
+
tag: 'genesis-badge',
|
|
64
|
+
immutableMetadata,
|
|
65
|
+
metadata: {
|
|
66
|
+
season: 1,
|
|
67
|
+
rarity: 'legendary'
|
|
68
|
+
},
|
|
69
|
+
namespace: 'iota'
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const transferRequest: INftTransferRequest = {
|
|
73
|
+
recipientIdentity: 'did:example:collector-8',
|
|
74
|
+
recipientAddress: '0x5df99c44d4f6f66d5a7f7298f46a0fdb6a4ac23a',
|
|
75
|
+
metadata: {
|
|
76
|
+
transferredAt: '2026-03-10T10:00:00.000Z'
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const updateRequest: INftUpdateRequest = {
|
|
81
|
+
metadata: {
|
|
82
|
+
rarity: 'mythic',
|
|
83
|
+
season: 2
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
console.log(mintRequest.namespace); // iota
|
|
88
|
+
console.log(transferRequest.recipientIdentity); // did:example:collector-8
|
|
89
|
+
console.log(updateRequest.metadata.season); // 2
|
|
90
|
+
```
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Interface: IIrc27Metadata
|
|
2
2
|
|
|
3
3
|
Model defining the IRC27 NFT Standards.
|
|
4
|
-
https://
|
|
4
|
+
https://docs.iota.org/developer/references/framework/stardust/irc27
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
|
8
|
-
### standard
|
|
8
|
+
### standard {#standard}
|
|
9
9
|
|
|
10
10
|
> **standard**: `"IRC27"`
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ The standard marker.
|
|
|
13
13
|
|
|
14
14
|
***
|
|
15
15
|
|
|
16
|
-
### version
|
|
16
|
+
### version {#version}
|
|
17
17
|
|
|
18
18
|
> **version**: `"v1.0"`
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ The version
|
|
|
21
21
|
|
|
22
22
|
***
|
|
23
23
|
|
|
24
|
-
### type
|
|
24
|
+
### type {#type}
|
|
25
25
|
|
|
26
26
|
> **type**: `string`
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ A mime type for the content of the NFT.
|
|
|
29
29
|
|
|
30
30
|
***
|
|
31
31
|
|
|
32
|
-
### uri
|
|
32
|
+
### uri {#uri}
|
|
33
33
|
|
|
34
34
|
> **uri**: `string`
|
|
35
35
|
|
|
@@ -37,7 +37,7 @@ Url pointing to the NFT file location with MIME type defined in type.
|
|
|
37
37
|
|
|
38
38
|
***
|
|
39
39
|
|
|
40
|
-
### name
|
|
40
|
+
### name {#name}
|
|
41
41
|
|
|
42
42
|
> **name**: `string`
|
|
43
43
|
|
|
@@ -45,17 +45,17 @@ Alphanumeric text string defining the human identifiable name for the NFT
|
|
|
45
45
|
|
|
46
46
|
***
|
|
47
47
|
|
|
48
|
-
### collectionName?
|
|
48
|
+
### collectionName? {#collectionname}
|
|
49
49
|
|
|
50
|
-
> `optional` **collectionName
|
|
50
|
+
> `optional` **collectionName?**: `string`
|
|
51
51
|
|
|
52
52
|
Alphanumeric text string defining the human identifiable collection name.
|
|
53
53
|
|
|
54
54
|
***
|
|
55
55
|
|
|
56
|
-
### royalties?
|
|
56
|
+
### royalties? {#royalties}
|
|
57
57
|
|
|
58
|
-
> `optional` **royalties
|
|
58
|
+
> `optional` **royalties?**: `object`
|
|
59
59
|
|
|
60
60
|
Object containing key value pair where payment address mapped to the payout percentage.
|
|
61
61
|
|
|
@@ -65,25 +65,25 @@ Object containing key value pair where payment address mapped to the payout perc
|
|
|
65
65
|
|
|
66
66
|
***
|
|
67
67
|
|
|
68
|
-
### issuerName?
|
|
68
|
+
### issuerName? {#issuername}
|
|
69
69
|
|
|
70
|
-
> `optional` **issuerName
|
|
70
|
+
> `optional` **issuerName?**: `string`
|
|
71
71
|
|
|
72
72
|
Alphanumeric text string to define the human identifiable name of the creator.
|
|
73
73
|
|
|
74
74
|
***
|
|
75
75
|
|
|
76
|
-
### description?
|
|
76
|
+
### description? {#description}
|
|
77
77
|
|
|
78
|
-
> `optional` **description
|
|
78
|
+
> `optional` **description?**: `string`
|
|
79
79
|
|
|
80
80
|
Alphanumeric text string to define a basic description of the NFT.
|
|
81
81
|
|
|
82
82
|
***
|
|
83
83
|
|
|
84
|
-
### attributes?
|
|
84
|
+
### attributes? {#attributes}
|
|
85
85
|
|
|
86
|
-
> `optional` **attributes
|
|
86
|
+
> `optional` **attributes?**: `object`[]
|
|
87
87
|
|
|
88
88
|
Array objects defining additional attributes of the NFT
|
|
89
89
|
|
|
@@ -8,7 +8,7 @@ Interface describing an NFT component.
|
|
|
8
8
|
|
|
9
9
|
## Methods
|
|
10
10
|
|
|
11
|
-
### mint()
|
|
11
|
+
### mint() {#mint}
|
|
12
12
|
|
|
13
13
|
> **mint**\<`T`, `U`\>(`tag`, `immutableMetadata?`, `metadata?`, `namespace?`, `identity?`): `Promise`\<`string`\>
|
|
14
14
|
|
|
@@ -64,9 +64,9 @@ The id of the created NFT in urn format.
|
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
67
|
-
### resolve()
|
|
67
|
+
### resolve() {#resolve}
|
|
68
68
|
|
|
69
|
-
> **resolve**\<`T`, `U`\>(`id`, `controllerIdentity?`): `Promise`\<\{ `issuer`: `string`; `
|
|
69
|
+
> **resolve**\<`T`, `U`\>(`id`, `controllerIdentity?`): `Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
|
|
70
70
|
|
|
71
71
|
Resolve an NFT.
|
|
72
72
|
|
|
@@ -96,13 +96,13 @@ The identity to perform the nft operation with.
|
|
|
96
96
|
|
|
97
97
|
#### Returns
|
|
98
98
|
|
|
99
|
-
`Promise`\<\{ `issuer`: `string`; `
|
|
99
|
+
`Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
|
|
100
100
|
|
|
101
101
|
The data for the NFT.
|
|
102
102
|
|
|
103
103
|
***
|
|
104
104
|
|
|
105
|
-
### burn()
|
|
105
|
+
### burn() {#burn}
|
|
106
106
|
|
|
107
107
|
> **burn**(`id`, `controllerIdentity?`): `Promise`\<`void`\>
|
|
108
108
|
|
|
@@ -130,9 +130,9 @@ Nothing.
|
|
|
130
130
|
|
|
131
131
|
***
|
|
132
132
|
|
|
133
|
-
### transfer()
|
|
133
|
+
### transfer() {#transfer}
|
|
134
134
|
|
|
135
|
-
> **transfer**\<`U`\>(`id`, `
|
|
135
|
+
> **transfer**\<`U`\>(`id`, `recipientAddress`, `metadata?`, `controllerIdentity?`): `Promise`\<`void`\>
|
|
136
136
|
|
|
137
137
|
Transfer an NFT.
|
|
138
138
|
|
|
@@ -150,12 +150,6 @@ Transfer an NFT.
|
|
|
150
150
|
|
|
151
151
|
The id of the NFT to transfer in urn format.
|
|
152
152
|
|
|
153
|
-
##### recipientIdentity
|
|
154
|
-
|
|
155
|
-
`string`
|
|
156
|
-
|
|
157
|
-
The recipient identity for the NFT.
|
|
158
|
-
|
|
159
153
|
##### recipientAddress
|
|
160
154
|
|
|
161
155
|
`string`
|
|
@@ -182,7 +176,7 @@ Nothing.
|
|
|
182
176
|
|
|
183
177
|
***
|
|
184
178
|
|
|
185
|
-
### update()
|
|
179
|
+
### update() {#update}
|
|
186
180
|
|
|
187
181
|
> **update**\<`U`\>(`id`, `metadata`, `controllerIdentity?`): `Promise`\<`void`\>
|
|
188
182
|
|
|
@@ -8,7 +8,7 @@ Interface describing an NFT connector.
|
|
|
8
8
|
|
|
9
9
|
## Methods
|
|
10
10
|
|
|
11
|
-
### mint()
|
|
11
|
+
### mint() {#mint}
|
|
12
12
|
|
|
13
13
|
> **mint**\<`T`, `U`\>(`controllerIdentity`, `tag`, `immutableMetadata?`, `metadata?`): `Promise`\<`string`\>
|
|
14
14
|
|
|
@@ -58,9 +58,9 @@ The id of the created NFT in urn format.
|
|
|
58
58
|
|
|
59
59
|
***
|
|
60
60
|
|
|
61
|
-
### resolve()
|
|
61
|
+
### resolve() {#resolve}
|
|
62
62
|
|
|
63
|
-
> **resolve**\<`T`, `U`\>(`id`): `Promise`\<\{ `issuer`: `string`; `
|
|
63
|
+
> **resolve**\<`T`, `U`\>(`id`): `Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
|
|
64
64
|
|
|
65
65
|
Resolve an NFT.
|
|
66
66
|
|
|
@@ -84,13 +84,13 @@ The id of the NFT to resolve.
|
|
|
84
84
|
|
|
85
85
|
#### Returns
|
|
86
86
|
|
|
87
|
-
`Promise`\<\{ `issuer`: `string`; `
|
|
87
|
+
`Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
|
|
88
88
|
|
|
89
89
|
The data for the NFT.
|
|
90
90
|
|
|
91
91
|
***
|
|
92
92
|
|
|
93
|
-
### burn()
|
|
93
|
+
### burn() {#burn}
|
|
94
94
|
|
|
95
95
|
> **burn**(`controller`, `id`): `Promise`\<`void`\>
|
|
96
96
|
|
|
@@ -118,9 +118,9 @@ Nothing.
|
|
|
118
118
|
|
|
119
119
|
***
|
|
120
120
|
|
|
121
|
-
### transfer()
|
|
121
|
+
### transfer() {#transfer}
|
|
122
122
|
|
|
123
|
-
> **transfer**\<`U`\>(`controllerIdentity`, `id`, `
|
|
123
|
+
> **transfer**\<`U`\>(`controllerIdentity`, `id`, `recipientAddress`, `metadata?`): `Promise`\<`void`\>
|
|
124
124
|
|
|
125
125
|
Transfer an NFT.
|
|
126
126
|
|
|
@@ -144,12 +144,6 @@ The controller of the NFT who can make changes.
|
|
|
144
144
|
|
|
145
145
|
The id of the NFT to transfer in urn format.
|
|
146
146
|
|
|
147
|
-
##### recipientIdentity
|
|
148
|
-
|
|
149
|
-
`string`
|
|
150
|
-
|
|
151
|
-
The recipient identity for the NFT.
|
|
152
|
-
|
|
153
147
|
##### recipientAddress
|
|
154
148
|
|
|
155
149
|
`string`
|
|
@@ -170,7 +164,7 @@ Nothing.
|
|
|
170
164
|
|
|
171
165
|
***
|
|
172
166
|
|
|
173
|
-
### update()
|
|
167
|
+
### update() {#update}
|
|
174
168
|
|
|
175
169
|
> **update**\<`U`\>(`controllerIdentity`, `id`, `metadata`): `Promise`\<`void`\>
|
|
176
170
|
|
|
@@ -4,7 +4,7 @@ Mint the data and return the NFT id.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### body
|
|
7
|
+
### body {#body}
|
|
8
8
|
|
|
9
9
|
> **body**: `object`
|
|
10
10
|
|
|
@@ -18,18 +18,18 @@ The tag for the NFT.
|
|
|
18
18
|
|
|
19
19
|
#### immutableMetadata?
|
|
20
20
|
|
|
21
|
-
> `optional` **immutableMetadata
|
|
21
|
+
> `optional` **immutableMetadata?**: `unknown`
|
|
22
22
|
|
|
23
23
|
The immutable metadata for the NFT.
|
|
24
24
|
|
|
25
25
|
#### metadata?
|
|
26
26
|
|
|
27
|
-
> `optional` **metadata
|
|
27
|
+
> `optional` **metadata?**: `unknown`
|
|
28
28
|
|
|
29
29
|
The metadata for the NFT.
|
|
30
30
|
|
|
31
31
|
#### namespace?
|
|
32
32
|
|
|
33
|
-
> `optional` **namespace
|
|
33
|
+
> `optional` **namespace?**: `string`
|
|
34
34
|
|
|
35
35
|
The namespace of the connector to use for the NFT, defaults to component configured namespace.
|
|
@@ -4,7 +4,7 @@ Response to resolving the NFT.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### body
|
|
7
|
+
### body {#body}
|
|
8
8
|
|
|
9
9
|
> **body**: `object`
|
|
10
10
|
|
|
@@ -16,11 +16,12 @@ The data that was resolved.
|
|
|
16
16
|
|
|
17
17
|
The issuer of the NFT.
|
|
18
18
|
|
|
19
|
-
####
|
|
19
|
+
#### issuerIdentityId
|
|
20
20
|
|
|
21
|
-
> **
|
|
21
|
+
> **issuerIdentityId**: `string`
|
|
22
22
|
|
|
23
|
-
The
|
|
23
|
+
The on-chain Object ID of the verified IOTA Identity that minted this NFT.
|
|
24
|
+
Empty string when not minted with identity verification.
|
|
24
25
|
|
|
25
26
|
#### tag
|
|
26
27
|
|
|
@@ -30,12 +31,12 @@ The tag data for the NFT.
|
|
|
30
31
|
|
|
31
32
|
#### immutableMetadata?
|
|
32
33
|
|
|
33
|
-
> `optional` **immutableMetadata
|
|
34
|
+
> `optional` **immutableMetadata?**: `unknown`
|
|
34
35
|
|
|
35
36
|
The immutable data for the NFT.
|
|
36
37
|
|
|
37
38
|
#### metadata?
|
|
38
39
|
|
|
39
|
-
> `optional` **metadata
|
|
40
|
+
> `optional` **metadata?**: `unknown`
|
|
40
41
|
|
|
41
42
|
The metadata for the NFT.
|
|
@@ -4,7 +4,7 @@ Transfer the NFT and update the metadata.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### pathParams
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
8
|
|
|
9
9
|
> **pathParams**: `object`
|
|
10
10
|
|
|
@@ -18,18 +18,12 @@ The id of the NFT to transfer in urn format.
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### body
|
|
21
|
+
### body {#body}
|
|
22
22
|
|
|
23
23
|
> **body**: `object`
|
|
24
24
|
|
|
25
25
|
The data to be used in the transfer.
|
|
26
26
|
|
|
27
|
-
#### recipientIdentity
|
|
28
|
-
|
|
29
|
-
> **recipientIdentity**: `string`
|
|
30
|
-
|
|
31
|
-
The recipient identity for the NFT.
|
|
32
|
-
|
|
33
27
|
#### recipientAddress
|
|
34
28
|
|
|
35
29
|
> **recipientAddress**: `string`
|
|
@@ -38,6 +32,6 @@ The recipient address for the NFT.
|
|
|
38
32
|
|
|
39
33
|
#### metadata?
|
|
40
34
|
|
|
41
|
-
> `optional` **metadata
|
|
35
|
+
> `optional` **metadata?**: `unknown`
|
|
42
36
|
|
|
43
37
|
The metadata for the NFT.
|
|
@@ -4,7 +4,7 @@ Update the mutable data for the NFT.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### pathParams
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
8
|
|
|
9
9
|
> **pathParams**: `object`
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ The id of the NFT to transfer in urn format.
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### body
|
|
21
|
+
### body {#body}
|
|
22
22
|
|
|
23
23
|
> **body**: `object`
|
|
24
24
|
|
|
@@ -26,6 +26,6 @@ The data to be used in the update.
|
|
|
26
26
|
|
|
27
27
|
#### metadata?
|
|
28
28
|
|
|
29
|
-
> `optional` **metadata
|
|
29
|
+
> `optional` **metadata?**: `unknown`
|
|
30
30
|
|
|
31
31
|
The metadata for the NFT.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/nft-models",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.4",
|
|
4
|
+
"description": "Shared NFT interfaces, request and response models, and connector contracts.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/nft.git",
|