@twin.org/nft-rest-client 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN NFT REST Client
2
2
 
3
- NFT contract implementation which can connect to REST endpoints.
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
 
@@ -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, recipientIdentity, recipientAddress, metadata) {
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,
94
91
  metadata
95
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nftRestClient.js","sourceRoot":"","sources":["../../src/nftRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAW7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,cAAc;IACh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EAAU,EACV,iBAAyB,EACzB,gBAAwB,EACxB,QAAY;QAEZ,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAC7D,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,uBAA6B,iBAAiB,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,sBAA4B,gBAAgB,CAAC,CAAC;QAEzF,MAAM,IAAI,CAAC,KAAK,CAA6B,eAAe,EAAE,MAAM,EAAE;YACrE,UAAU,EAAE;gBACX,EAAE;aACF;YACD,IAAI,EAAE;gBACL,iBAAiB;gBACjB,gBAAgB;gBAChB,QAAQ;aACR;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAc,EAAU,EAAE,QAAW;QACvD,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAC7D,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;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\towner: 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\towner: 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 recipientIdentity The recipient identity for the NFT.\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\trecipientIdentity: 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(recipientIdentity), recipientIdentity);\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\trecipientIdentity,\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"]}
1
+ {"version":3,"file":"nftRestClient.js","sourceRoot":"","sources":["../../src/nftRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAW7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,cAAc;IAChD;;OAEG;IACI,MAAM,CAAU,UAAU,mBAAmC;IAEpE;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,kBAA0B,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,aAAa,CAAC,UAAU,CAAC;IACjC,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,IAAI,CAChB,GAAW,EACX,iBAAqB,EACrB,QAAY,EACZ,SAAkB;QAElB,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,SAAe,GAAG,CAAC,CAAC;QAE/D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAoC,GAAG,EAAE,MAAM,EAAE;YACjF,IAAI,EAAE;gBACL,GAAG;gBACH,iBAAiB;gBACjB,QAAQ;gBACR,SAAS;aACT;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CACnB,EAAU;QAQV,MAAM,CAAC,WAAW,CAAC,aAAa,CAA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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
- owner: string;
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, recipientIdentity: string, recipientAddress: string, metadata?: T): Promise<void>;
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,4 +1,32 @@
1
- # @twin.org/nft-rest-client - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.4](https://github.com/twinfoundation/nft/compare/nft-rest-client-v0.0.3-next.3...nft-rest-client-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
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/nft-models bumped from 0.0.3-next.3 to 0.0.3-next.4
16
+
17
+ ## [0.0.3-next.3](https://github.com/twinfoundation/nft/compare/nft-rest-client-v0.0.3-next.2...nft-rest-client-v0.0.3-next.3) (2026-03-03)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **nft-rest-client:** Synchronize repo versions
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.2 to 0.0.3-next.3
2
30
 
3
31
  ## [0.0.3-next.2](https://github.com/twinfoundation/nft/compare/nft-rest-client-v0.0.3-next.1...nft-rest-client-v0.0.3-next.2) (2026-02-25)
4
32
 
package/docs/examples.md CHANGED
@@ -1 +1,86 @@
1
- # @twin.org/nft-rest-client - Examples
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`; `owner`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
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`; `owner`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
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`, `recipientIdentity`, `recipientAddress`, `metadata?`): `Promise`\<`void`\>
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@twin.org/nft-rest-client",
3
- "version": "0.0.3-next.2",
4
- "description": "NFT contract implementation which can connect to REST endpoints",
3
+ "version": "0.0.3-next.4",
4
+ "description": "HTTP client for calling NFT service endpoints from applications.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/nft.git",
@@ -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.2",
22
+ "@twin.org/nft-models": "0.0.3-next.4",
23
23
  "@twin.org/web": "next"
24
24
  },
25
25
  "main": "./dist/es/index.js",