@twin.org/nft-rest-client 0.0.3-next.3 → 0.0.3-next.5
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/nftRestClient.js +1 -4
- package/dist/es/nftRestClient.js.map +1 -1
- package/dist/types/nftRestClient.d.ts +2 -3
- package/docs/changelog.md +63 -35
- package/docs/examples.md +86 -1
- package/docs/reference/classes/NftRestClient.md +10 -16
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN NFT REST Client
|
|
2
2
|
|
|
3
|
-
NFT
|
|
3
|
+
This package provides a REST client for invoking NFT service endpoints from external applications and automation scripts. It offers a consistent HTTP-facing interface for mint, resolve, transfer, update, and burn operations.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/dist/es/nftRestClient.js
CHANGED
|
@@ -75,21 +75,18 @@ export class NftRestClient extends BaseRestClient {
|
|
|
75
75
|
/**
|
|
76
76
|
* Transfer an NFT.
|
|
77
77
|
* @param id The id of the NFT to transfer in urn format.
|
|
78
|
-
* @param recipientIdentity The recipient identity for the NFT.
|
|
79
78
|
* @param recipientAddress The recipient address for the NFT.
|
|
80
79
|
* @param metadata Optional mutable data to include during the transfer.
|
|
81
80
|
* @returns Nothing.
|
|
82
81
|
*/
|
|
83
|
-
async transfer(id,
|
|
82
|
+
async transfer(id, recipientAddress, metadata) {
|
|
84
83
|
Guards.stringValue(NftRestClient.CLASS_NAME, "id", id);
|
|
85
|
-
Guards.stringValue(NftRestClient.CLASS_NAME, "recipientIdentity", recipientIdentity);
|
|
86
84
|
Guards.stringValue(NftRestClient.CLASS_NAME, "recipientAddress", recipientAddress);
|
|
87
85
|
await this.fetch("/:id/transfer", "POST", {
|
|
88
86
|
pathParams: {
|
|
89
87
|
id
|
|
90
88
|
},
|
|
91
89
|
body: {
|
|
92
|
-
recipientIdentity,
|
|
93
90
|
recipientAddress,
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AC;QAEpE,MAAM,IAAI,CAAC,KAAK,CAA2B,MAAM,EAAE,KAAK,EAAE;YACzD,UAAU,EAAE;gBACX,EAAE;aACF;YACD,IAAI,EAAE;gBACL,QAAQ;aACR;SACD,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, ICreatedResponse } from \"@twin.org/api-models\";\nimport { Guards, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tINftBurnRequest,\n\tINftComponent,\n\tINftMintRequest,\n\tINftResolveRequest,\n\tINftResolveResponse,\n\tINftTransferRequest,\n\tINftUpdateRequest\n} from \"@twin.org/nft-models\";\nimport { HeaderTypes } from \"@twin.org/web\";\n\n/**\n * Client for performing NFT through to REST endpoints.\n */\nexport class NftRestClient extends BaseRestClient implements INftComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NftRestClient>();\n\n\t/**\n\t * Create a new instance of NftRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<NftRestClient>(), config, \"nft\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn NftRestClient.CLASS_NAME;\n\t}\n\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 * @returns The id of the created NFT in urn format.\n\t */\n\tpublic async mint<T = unknown, U = unknown>(\n\t\ttag: string,\n\t\timmutableMetadata?: T,\n\t\tmetadata?: U,\n\t\tnamespace?: string\n\t): Promise<string> {\n\t\tGuards.stringValue(NftRestClient.CLASS_NAME, nameof(tag), tag);\n\n\t\tconst response = await this.fetch<INftMintRequest, ICreatedResponse>(\"/\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\ttag,\n\t\t\t\timmutableMetadata,\n\t\t\t\tmetadata,\n\t\t\t\tnamespace\n\t\t\t}\n\t\t});\n\n\t\treturn response.headers[HeaderTypes.Location];\n\t}\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\tpublic async resolve<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\t\tGuards.stringValue(NftRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<INftResolveRequest, INftResolveResponse>(\"/:id\", \"GET\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t}\n\t\t});\n\n\t\treturn response.body as {\n\t\t\tissuer: string;\n\t\t\tissuerIdentityId: string;\n\t\t\ttag: string;\n\t\t\timmutableMetadata?: T;\n\t\t\tmetadata?: U;\n\t\t};\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 * @returns Nothing.\n\t */\n\tpublic async burn(id: string): Promise<void> {\n\t\tUrn.guard(NftRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<INftBurnRequest, never>(\"/:id\", \"DELETE\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t}\n\t\t});\n\t}\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 * @returns Nothing.\n\t */\n\tpublic async transfer<T = unknown>(\n\t\tid: string,\n\t\trecipientAddress: string,\n\t\tmetadata?: T\n\t): Promise<void> {\n\t\tGuards.stringValue(NftRestClient.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftRestClient.CLASS_NAME, nameof(recipientAddress), recipientAddress);\n\n\t\tawait this.fetch<INftTransferRequest, never>(\"/:id/transfer\", \"POST\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\trecipientAddress,\n\t\t\t\tmetadata\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Update the 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 * @returns Nothing.\n\t */\n\tpublic async update<U = unknown>(id: string, metadata: U): Promise<void> {\n\t\tGuards.stringValue(NftRestClient.CLASS_NAME, nameof(id), id);\n\t\tGuards.object(NftRestClient.CLASS_NAME, nameof(metadata), metadata);\n\n\t\tawait this.fetch<INftUpdateRequest, never>(\"/:id\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\tmetadata\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
|
|
@@ -35,7 +35,7 @@ export declare class NftRestClient extends BaseRestClient implements INftCompone
|
|
|
35
35
|
*/
|
|
36
36
|
resolve<T = unknown, U = unknown>(id: string): Promise<{
|
|
37
37
|
issuer: string;
|
|
38
|
-
|
|
38
|
+
issuerIdentityId: string;
|
|
39
39
|
tag: string;
|
|
40
40
|
immutableMetadata?: T;
|
|
41
41
|
metadata?: U;
|
|
@@ -49,12 +49,11 @@ export declare class NftRestClient extends BaseRestClient implements INftCompone
|
|
|
49
49
|
/**
|
|
50
50
|
* Transfer an NFT.
|
|
51
51
|
* @param id The id of the NFT to transfer in urn format.
|
|
52
|
-
* @param recipientIdentity The recipient identity for the NFT.
|
|
53
52
|
* @param recipientAddress The recipient address for the NFT.
|
|
54
53
|
* @param metadata Optional mutable data to include during the transfer.
|
|
55
54
|
* @returns Nothing.
|
|
56
55
|
*/
|
|
57
|
-
transfer<T = unknown>(id: string,
|
|
56
|
+
transfer<T = unknown>(id: string, recipientAddress: string, metadata?: T): Promise<void>;
|
|
58
57
|
/**
|
|
59
58
|
* Update the data of the NFT.
|
|
60
59
|
* @param id The id of the NFT to update in urn format.
|
package/docs/changelog.md
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.3-next.
|
|
3
|
+
## [0.0.3-next.5](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.3-next.4...nft-rest-client-v0.0.3-next.5) (2026-05-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* typescript 6 update ([91b94b8](https://github.com/iotaledger/twin-nft/commit/91b94b846ea081b09b2228681776ce30f104a36e))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/nft-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.4](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.3-next.3...nft-rest-client-v0.0.3-next.4) (2026-04-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add on-chain identity binding to NFT minting ([#58](https://github.com/iotaledger/twin-nft/issues/58)) ([730a16d](https://github.com/iotaledger/twin-nft/commit/730a16d70fc026c920dbede0e4dafc96f37b729a))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/nft-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.3](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.3-next.2...nft-rest-client-v0.0.3-next.3) (2026-03-03)
|
|
4
32
|
|
|
5
33
|
|
|
6
34
|
### Miscellaneous Chores
|
|
@@ -14,7 +42,7 @@
|
|
|
14
42
|
* dependencies
|
|
15
43
|
* @twin.org/nft-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
16
44
|
|
|
17
|
-
## [0.0.3-next.2](https://github.com/
|
|
45
|
+
## [0.0.3-next.2](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.3-next.1...nft-rest-client-v0.0.3-next.2) (2026-02-25)
|
|
18
46
|
|
|
19
47
|
|
|
20
48
|
### Miscellaneous Chores
|
|
@@ -28,17 +56,17 @@
|
|
|
28
56
|
* dependencies
|
|
29
57
|
* @twin.org/nft-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
30
58
|
|
|
31
|
-
## [0.0.3-next.1](https://github.com/
|
|
59
|
+
## [0.0.3-next.1](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.3-next.0...nft-rest-client-v0.0.3-next.1) (2025-11-12)
|
|
32
60
|
|
|
33
61
|
|
|
34
62
|
### Features
|
|
35
63
|
|
|
36
|
-
* add context id features ([#50](https://github.com/
|
|
37
|
-
* add validate-locales ([0055a56](https://github.com/
|
|
38
|
-
* eslint migration to flat config ([0e6fc12](https://github.com/
|
|
39
|
-
* update dependencies ([8660f76](https://github.com/
|
|
40
|
-
* update framework core ([f3496b6](https://github.com/
|
|
41
|
-
* use shared store mechanism ([#16](https://github.com/
|
|
64
|
+
* add context id features ([#50](https://github.com/iotaledger/twin-nft/issues/50)) ([56c31c7](https://github.com/iotaledger/twin-nft/commit/56c31c7ba10e3ef8ad44f6463153f90888e64711))
|
|
65
|
+
* add validate-locales ([0055a56](https://github.com/iotaledger/twin-nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
|
|
66
|
+
* eslint migration to flat config ([0e6fc12](https://github.com/iotaledger/twin-nft/commit/0e6fc128c3c8f6cd34db793787437dd4af2c9994))
|
|
67
|
+
* update dependencies ([8660f76](https://github.com/iotaledger/twin-nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
|
|
68
|
+
* update framework core ([f3496b6](https://github.com/iotaledger/twin-nft/commit/f3496b61bfebbb3479bb92df39ecfa9ac8d90b9b))
|
|
69
|
+
* use shared store mechanism ([#16](https://github.com/iotaledger/twin-nft/issues/16)) ([897bc78](https://github.com/iotaledger/twin-nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
|
|
42
70
|
|
|
43
71
|
|
|
44
72
|
### Dependencies
|
|
@@ -47,12 +75,12 @@
|
|
|
47
75
|
* dependencies
|
|
48
76
|
* @twin.org/nft-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
49
77
|
|
|
50
|
-
## [0.0.2-next.8](https://github.com/
|
|
78
|
+
## [0.0.2-next.8](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.7...nft-rest-client-v0.0.2-next.8) (2025-10-09)
|
|
51
79
|
|
|
52
80
|
|
|
53
81
|
### Features
|
|
54
82
|
|
|
55
|
-
* add validate-locales ([0055a56](https://github.com/
|
|
83
|
+
* add validate-locales ([0055a56](https://github.com/iotaledger/twin-nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
|
|
56
84
|
|
|
57
85
|
|
|
58
86
|
### Dependencies
|
|
@@ -61,7 +89,7 @@
|
|
|
61
89
|
* dependencies
|
|
62
90
|
* @twin.org/nft-models bumped from 0.0.2-next.7 to 0.0.2-next.8
|
|
63
91
|
|
|
64
|
-
## [0.0.2-next.7](https://github.com/
|
|
92
|
+
## [0.0.2-next.7](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.6...nft-rest-client-v0.0.2-next.7) (2025-09-26)
|
|
65
93
|
|
|
66
94
|
|
|
67
95
|
### Miscellaneous Chores
|
|
@@ -75,7 +103,7 @@
|
|
|
75
103
|
* dependencies
|
|
76
104
|
* @twin.org/nft-models bumped from 0.0.2-next.6 to 0.0.2-next.7
|
|
77
105
|
|
|
78
|
-
## [0.0.2-next.6](https://github.com/
|
|
106
|
+
## [0.0.2-next.6](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.5...nft-rest-client-v0.0.2-next.6) (2025-09-25)
|
|
79
107
|
|
|
80
108
|
|
|
81
109
|
### Miscellaneous Chores
|
|
@@ -89,7 +117,7 @@
|
|
|
89
117
|
* dependencies
|
|
90
118
|
* @twin.org/nft-models bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
91
119
|
|
|
92
|
-
## [0.0.2-next.5](https://github.com/
|
|
120
|
+
## [0.0.2-next.5](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.4...nft-rest-client-v0.0.2-next.5) (2025-09-22)
|
|
93
121
|
|
|
94
122
|
|
|
95
123
|
### Miscellaneous Chores
|
|
@@ -103,12 +131,12 @@
|
|
|
103
131
|
* dependencies
|
|
104
132
|
* @twin.org/nft-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
105
133
|
|
|
106
|
-
## [0.0.2-next.4](https://github.com/
|
|
134
|
+
## [0.0.2-next.4](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.3...nft-rest-client-v0.0.2-next.4) (2025-09-10)
|
|
107
135
|
|
|
108
136
|
|
|
109
137
|
### Features
|
|
110
138
|
|
|
111
|
-
* eslint migration to flat config ([0e6fc12](https://github.com/
|
|
139
|
+
* eslint migration to flat config ([0e6fc12](https://github.com/iotaledger/twin-nft/commit/0e6fc128c3c8f6cd34db793787437dd4af2c9994))
|
|
112
140
|
|
|
113
141
|
|
|
114
142
|
### Dependencies
|
|
@@ -117,12 +145,12 @@
|
|
|
117
145
|
* dependencies
|
|
118
146
|
* @twin.org/nft-models bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
119
147
|
|
|
120
|
-
## [0.0.2-next.3](https://github.com/
|
|
148
|
+
## [0.0.2-next.3](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.2...nft-rest-client-v0.0.2-next.3) (2025-08-20)
|
|
121
149
|
|
|
122
150
|
|
|
123
151
|
### Features
|
|
124
152
|
|
|
125
|
-
* update framework core ([f3496b6](https://github.com/
|
|
153
|
+
* update framework core ([f3496b6](https://github.com/iotaledger/twin-nft/commit/f3496b61bfebbb3479bb92df39ecfa9ac8d90b9b))
|
|
126
154
|
|
|
127
155
|
|
|
128
156
|
### Dependencies
|
|
@@ -131,7 +159,7 @@
|
|
|
131
159
|
* dependencies
|
|
132
160
|
* @twin.org/nft-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
133
161
|
|
|
134
|
-
## [0.0.2-next.2](https://github.com/
|
|
162
|
+
## [0.0.2-next.2](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.1...nft-rest-client-v0.0.2-next.2) (2025-07-25)
|
|
135
163
|
|
|
136
164
|
|
|
137
165
|
### Miscellaneous Chores
|
|
@@ -145,13 +173,13 @@
|
|
|
145
173
|
* dependencies
|
|
146
174
|
* @twin.org/nft-models bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
147
175
|
|
|
148
|
-
## [0.0.2-next.1](https://github.com/
|
|
176
|
+
## [0.0.2-next.1](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.2-next.0...nft-rest-client-v0.0.2-next.1) (2025-07-16)
|
|
149
177
|
|
|
150
178
|
|
|
151
179
|
### Features
|
|
152
180
|
|
|
153
|
-
* update dependencies ([8660f76](https://github.com/
|
|
154
|
-
* use shared store mechanism ([#16](https://github.com/
|
|
181
|
+
* update dependencies ([8660f76](https://github.com/iotaledger/twin-nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
|
|
182
|
+
* use shared store mechanism ([#16](https://github.com/iotaledger/twin-nft/issues/16)) ([897bc78](https://github.com/iotaledger/twin-nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
|
|
155
183
|
|
|
156
184
|
|
|
157
185
|
### Dependencies
|
|
@@ -165,7 +193,7 @@
|
|
|
165
193
|
|
|
166
194
|
### Features
|
|
167
195
|
|
|
168
|
-
* release to production ([4d338b3](https://github.com/
|
|
196
|
+
* release to production ([4d338b3](https://github.com/iotaledger/twin-nft/commit/4d338b3e8a4dbccc61a1d1da3c470ba86cefe535))
|
|
169
197
|
|
|
170
198
|
|
|
171
199
|
### Dependencies
|
|
@@ -174,7 +202,7 @@
|
|
|
174
202
|
* dependencies
|
|
175
203
|
* @twin.org/nft-models bumped from ^0.0.0 to ^0.0.1
|
|
176
204
|
|
|
177
|
-
## [0.0.1-next.32](https://github.com/
|
|
205
|
+
## [0.0.1-next.32](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.31...nft-rest-client-v0.0.1-next.32) (2025-06-24)
|
|
178
206
|
|
|
179
207
|
|
|
180
208
|
### Miscellaneous Chores
|
|
@@ -188,12 +216,12 @@
|
|
|
188
216
|
* dependencies
|
|
189
217
|
* @twin.org/nft-models bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
190
218
|
|
|
191
|
-
## [0.0.1-next.31](https://github.com/
|
|
219
|
+
## [0.0.1-next.31](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.30...nft-rest-client-v0.0.1-next.31) (2025-06-12)
|
|
192
220
|
|
|
193
221
|
|
|
194
222
|
### Features
|
|
195
223
|
|
|
196
|
-
* update dependencies ([8660f76](https://github.com/
|
|
224
|
+
* update dependencies ([8660f76](https://github.com/iotaledger/twin-nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
|
|
197
225
|
|
|
198
226
|
|
|
199
227
|
### Dependencies
|
|
@@ -202,7 +230,7 @@
|
|
|
202
230
|
* dependencies
|
|
203
231
|
* @twin.org/nft-models bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
204
232
|
|
|
205
|
-
## [0.0.1-next.30](https://github.com/
|
|
233
|
+
## [0.0.1-next.30](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.29...nft-rest-client-v0.0.1-next.30) (2025-05-22)
|
|
206
234
|
|
|
207
235
|
|
|
208
236
|
### Miscellaneous Chores
|
|
@@ -216,7 +244,7 @@
|
|
|
216
244
|
* dependencies
|
|
217
245
|
* @twin.org/nft-models bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
218
246
|
|
|
219
|
-
## [0.0.1-next.29](https://github.com/
|
|
247
|
+
## [0.0.1-next.29](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.28...nft-rest-client-v0.0.1-next.29) (2025-05-21)
|
|
220
248
|
|
|
221
249
|
|
|
222
250
|
### Miscellaneous Chores
|
|
@@ -230,7 +258,7 @@
|
|
|
230
258
|
* dependencies
|
|
231
259
|
* @twin.org/nft-models bumped from 0.0.1-next.28 to 0.0.1-next.29
|
|
232
260
|
|
|
233
|
-
## [0.0.1-next.28](https://github.com/
|
|
261
|
+
## [0.0.1-next.28](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.27...nft-rest-client-v0.0.1-next.28) (2025-05-06)
|
|
234
262
|
|
|
235
263
|
|
|
236
264
|
### Miscellaneous Chores
|
|
@@ -244,7 +272,7 @@
|
|
|
244
272
|
* dependencies
|
|
245
273
|
* @twin.org/nft-models bumped from 0.0.1-next.27 to 0.0.1-next.28
|
|
246
274
|
|
|
247
|
-
## [0.0.1-next.27](https://github.com/
|
|
275
|
+
## [0.0.1-next.27](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.26...nft-rest-client-v0.0.1-next.27) (2025-04-24)
|
|
248
276
|
|
|
249
277
|
|
|
250
278
|
### Miscellaneous Chores
|
|
@@ -258,12 +286,12 @@
|
|
|
258
286
|
* dependencies
|
|
259
287
|
* @twin.org/nft-models bumped from 0.0.1-next.26 to 0.0.1-next.27
|
|
260
288
|
|
|
261
|
-
## [0.0.1-next.26](https://github.com/
|
|
289
|
+
## [0.0.1-next.26](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.25...nft-rest-client-v0.0.1-next.26) (2025-04-17)
|
|
262
290
|
|
|
263
291
|
|
|
264
292
|
### Features
|
|
265
293
|
|
|
266
|
-
* use shared store mechanism ([#16](https://github.com/
|
|
294
|
+
* use shared store mechanism ([#16](https://github.com/iotaledger/twin-nft/issues/16)) ([897bc78](https://github.com/iotaledger/twin-nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
|
|
267
295
|
|
|
268
296
|
|
|
269
297
|
### Dependencies
|
|
@@ -272,7 +300,7 @@
|
|
|
272
300
|
* dependencies
|
|
273
301
|
* @twin.org/nft-models bumped from 0.0.1-next.25 to 0.0.1-next.26
|
|
274
302
|
|
|
275
|
-
## [0.0.1-next.25](https://github.com/
|
|
303
|
+
## [0.0.1-next.25](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.24...nft-rest-client-v0.0.1-next.25) (2025-04-17)
|
|
276
304
|
|
|
277
305
|
|
|
278
306
|
### Miscellaneous Chores
|
|
@@ -286,7 +314,7 @@
|
|
|
286
314
|
* dependencies
|
|
287
315
|
* @twin.org/nft-models bumped from 0.0.1-next.24 to 0.0.1-next.25
|
|
288
316
|
|
|
289
|
-
## [0.0.1-next.24](https://github.com/
|
|
317
|
+
## [0.0.1-next.24](https://github.com/iotaledger/twin-nft/compare/nft-rest-client-v0.0.1-next.23...nft-rest-client-v0.0.1-next.24) (2025-03-28)
|
|
290
318
|
|
|
291
319
|
|
|
292
320
|
### Miscellaneous Chores
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NFT REST Client Examples
|
|
2
|
+
|
|
3
|
+
These examples show how to integrate the REST client into application code for common lifecycle operations and endpoint-driven workflows.
|
|
4
|
+
|
|
5
|
+
## NftRestClient
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { NftRestClient } from '@twin.org/nft-rest-client';
|
|
9
|
+
|
|
10
|
+
interface ImmutableProfile {
|
|
11
|
+
standard: 'IRC27';
|
|
12
|
+
version: 'v1.0';
|
|
13
|
+
type: string;
|
|
14
|
+
uri: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface MutableProfile {
|
|
19
|
+
status: 'queued' | 'published';
|
|
20
|
+
rating: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const client = new NftRestClient({
|
|
24
|
+
endpoint: 'https://api.example.org',
|
|
25
|
+
basePath: '/',
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: 'Bearer <token>'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
console.log(client.className()); // NftRestClient
|
|
32
|
+
|
|
33
|
+
const nftId = await client.mint<ImmutableProfile, MutableProfile>(
|
|
34
|
+
'release-token',
|
|
35
|
+
{
|
|
36
|
+
standard: 'IRC27',
|
|
37
|
+
version: 'v1.0',
|
|
38
|
+
type: 'application/json',
|
|
39
|
+
uri: 'ipfs://bafybeie5c...',
|
|
40
|
+
name: 'Release Token'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
status: 'queued',
|
|
44
|
+
rating: 0
|
|
45
|
+
},
|
|
46
|
+
'iota'
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const resolved = await client.resolve<ImmutableProfile, MutableProfile>(nftId);
|
|
50
|
+
|
|
51
|
+
console.log(resolved.tag); // release-token
|
|
52
|
+
console.log(resolved.metadata?.status); // queued
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { NftRestClient } from '@twin.org/nft-rest-client';
|
|
57
|
+
|
|
58
|
+
interface MutableProfile {
|
|
59
|
+
status: 'queued' | 'published';
|
|
60
|
+
rating: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const client = new NftRestClient({
|
|
64
|
+
endpoint: 'https://api.example.org',
|
|
65
|
+
basePath: '/'
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const nftId = 'nft:iota:devnet:0xpackage:0xobject';
|
|
69
|
+
|
|
70
|
+
await client.transfer<MutableProfile>(
|
|
71
|
+
nftId,
|
|
72
|
+
'did:example:collector-7',
|
|
73
|
+
'0x5df99c44d4f6f66d5a7f7298f46a0fdb6a4ac23a',
|
|
74
|
+
{
|
|
75
|
+
status: 'published',
|
|
76
|
+
rating: 5
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
await client.update<MutableProfile>(nftId, {
|
|
81
|
+
status: 'published',
|
|
82
|
+
rating: 8
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
await client.burn(nftId);
|
|
86
|
+
```
|
|
@@ -36,7 +36,7 @@ The configuration for the client.
|
|
|
36
36
|
|
|
37
37
|
## Properties
|
|
38
38
|
|
|
39
|
-
### CLASS\_NAME
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Runtime name for the class.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### className()
|
|
47
|
+
### className() {#classname}
|
|
48
48
|
|
|
49
49
|
> **className**(): `string`
|
|
50
50
|
|
|
@@ -62,7 +62,7 @@ The class name of the component.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### mint()
|
|
65
|
+
### mint() {#mint}
|
|
66
66
|
|
|
67
67
|
> **mint**\<`T`, `U`\>(`tag`, `immutableMetadata?`, `metadata?`, `namespace?`): `Promise`\<`string`\>
|
|
68
68
|
|
|
@@ -116,9 +116,9 @@ The id of the created NFT in urn format.
|
|
|
116
116
|
|
|
117
117
|
***
|
|
118
118
|
|
|
119
|
-
### resolve()
|
|
119
|
+
### resolve() {#resolve}
|
|
120
120
|
|
|
121
|
-
> **resolve**\<`T`, `U`\>(`id`): `Promise`\<\{ `issuer`: `string`; `
|
|
121
|
+
> **resolve**\<`T`, `U`\>(`id`): `Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
|
|
122
122
|
|
|
123
123
|
Resolve an NFT.
|
|
124
124
|
|
|
@@ -142,7 +142,7 @@ The id of the NFT to resolve.
|
|
|
142
142
|
|
|
143
143
|
#### Returns
|
|
144
144
|
|
|
145
|
-
`Promise`\<\{ `issuer`: `string`; `
|
|
145
|
+
`Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
|
|
146
146
|
|
|
147
147
|
The data for the NFT.
|
|
148
148
|
|
|
@@ -152,7 +152,7 @@ The data for the NFT.
|
|
|
152
152
|
|
|
153
153
|
***
|
|
154
154
|
|
|
155
|
-
### burn()
|
|
155
|
+
### burn() {#burn}
|
|
156
156
|
|
|
157
157
|
> **burn**(`id`): `Promise`\<`void`\>
|
|
158
158
|
|
|
@@ -178,9 +178,9 @@ Nothing.
|
|
|
178
178
|
|
|
179
179
|
***
|
|
180
180
|
|
|
181
|
-
### transfer()
|
|
181
|
+
### transfer() {#transfer}
|
|
182
182
|
|
|
183
|
-
> **transfer**\<`T`\>(`id`, `
|
|
183
|
+
> **transfer**\<`T`\>(`id`, `recipientAddress`, `metadata?`): `Promise`\<`void`\>
|
|
184
184
|
|
|
185
185
|
Transfer an NFT.
|
|
186
186
|
|
|
@@ -198,12 +198,6 @@ Transfer an NFT.
|
|
|
198
198
|
|
|
199
199
|
The id of the NFT to transfer in urn format.
|
|
200
200
|
|
|
201
|
-
##### recipientIdentity
|
|
202
|
-
|
|
203
|
-
`string`
|
|
204
|
-
|
|
205
|
-
The recipient identity for the NFT.
|
|
206
|
-
|
|
207
201
|
##### recipientAddress
|
|
208
202
|
|
|
209
203
|
`string`
|
|
@@ -228,7 +222,7 @@ Nothing.
|
|
|
228
222
|
|
|
229
223
|
***
|
|
230
224
|
|
|
231
|
-
### update()
|
|
225
|
+
### update() {#update}
|
|
232
226
|
|
|
233
227
|
> **update**\<`U`\>(`id`, `metadata`): `Promise`\<`void`\>
|
|
234
228
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/nft-rest-client",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.5",
|
|
4
|
+
"description": "HTTP client for calling NFT service endpoints from applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/nft.git",
|
|
8
8
|
"directory": "packages/nft-rest-client"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/entity": "next",
|
|
21
21
|
"@twin.org/nameof": "next",
|
|
22
|
-
"@twin.org/nft-models": "0.0.3-next.
|
|
22
|
+
"@twin.org/nft-models": "0.0.3-next.5",
|
|
23
23
|
"@twin.org/web": "next"
|
|
24
24
|
},
|
|
25
25
|
"main": "./dist/es/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"assets"
|
|
51
51
|
],
|
|
52
52
|
"bugs": {
|
|
53
|
-
"url": "git+https://github.com/
|
|
53
|
+
"url": "git+https://github.com/iotaledger/nft/issues"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://twindev.org"
|
|
56
56
|
}
|