@twin.org/nft-rest-client 0.0.2-next.7 → 0.0.2-next.8
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 +12 -12
- package/dist/esm/index.mjs +12 -12
- package/dist/types/index.d.ts +1 -1
- package/dist/types/{nftClient.d.ts → nftRestClient.d.ts} +2 -2
- package/docs/changelog.md +14 -0
- package/docs/reference/classes/{NftClient.md → NftRestClient.md} +4 -8
- package/docs/reference/index.md +1 -1
- package/package.json +18 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -9,17 +9,17 @@ var web = require('@twin.org/web');
|
|
|
9
9
|
/**
|
|
10
10
|
* Client for performing NFT through to REST endpoints.
|
|
11
11
|
*/
|
|
12
|
-
class
|
|
12
|
+
class NftRestClient extends apiCore.BaseRestClient {
|
|
13
13
|
/**
|
|
14
14
|
* Runtime name for the class.
|
|
15
15
|
*/
|
|
16
|
-
CLASS_NAME = "
|
|
16
|
+
static CLASS_NAME = "NftRestClient";
|
|
17
17
|
/**
|
|
18
18
|
* Create a new instance of NftClient.
|
|
19
19
|
* @param config The configuration for the client.
|
|
20
20
|
*/
|
|
21
21
|
constructor(config) {
|
|
22
|
-
super("
|
|
22
|
+
super("NftRestClient", config, "nft");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Mint an NFT.
|
|
@@ -30,7 +30,7 @@ class NftClient extends apiCore.BaseRestClient {
|
|
|
30
30
|
* @returns The id of the created NFT in urn format.
|
|
31
31
|
*/
|
|
32
32
|
async mint(tag, immutableMetadata, metadata, namespace) {
|
|
33
|
-
core.Guards.stringValue(
|
|
33
|
+
core.Guards.stringValue(NftRestClient.CLASS_NAME, "tag", tag);
|
|
34
34
|
const response = await this.fetch("/", "POST", {
|
|
35
35
|
body: {
|
|
36
36
|
tag,
|
|
@@ -47,7 +47,7 @@ class NftClient extends apiCore.BaseRestClient {
|
|
|
47
47
|
* @returns The data for the NFT.
|
|
48
48
|
*/
|
|
49
49
|
async resolve(id) {
|
|
50
|
-
core.Guards.stringValue(
|
|
50
|
+
core.Guards.stringValue(NftRestClient.CLASS_NAME, "id", id);
|
|
51
51
|
const response = await this.fetch("/:id", "GET", {
|
|
52
52
|
pathParams: {
|
|
53
53
|
id
|
|
@@ -61,7 +61,7 @@ class NftClient extends apiCore.BaseRestClient {
|
|
|
61
61
|
* @returns Nothing.
|
|
62
62
|
*/
|
|
63
63
|
async burn(id) {
|
|
64
|
-
core.Urn.guard(
|
|
64
|
+
core.Urn.guard(NftRestClient.CLASS_NAME, "id", id);
|
|
65
65
|
await this.fetch("/:id", "DELETE", {
|
|
66
66
|
pathParams: {
|
|
67
67
|
id
|
|
@@ -77,9 +77,9 @@ class NftClient extends apiCore.BaseRestClient {
|
|
|
77
77
|
* @returns Nothing.
|
|
78
78
|
*/
|
|
79
79
|
async transfer(id, recipientIdentity, recipientAddress, metadata) {
|
|
80
|
-
core.Guards.stringValue(
|
|
81
|
-
core.Guards.stringValue(
|
|
82
|
-
core.Guards.stringValue(
|
|
80
|
+
core.Guards.stringValue(NftRestClient.CLASS_NAME, "id", id);
|
|
81
|
+
core.Guards.stringValue(NftRestClient.CLASS_NAME, "recipientIdentity", recipientIdentity);
|
|
82
|
+
core.Guards.stringValue(NftRestClient.CLASS_NAME, "recipientAddress", recipientAddress);
|
|
83
83
|
await this.fetch("/:id/transfer", "POST", {
|
|
84
84
|
pathParams: {
|
|
85
85
|
id
|
|
@@ -98,8 +98,8 @@ class NftClient extends apiCore.BaseRestClient {
|
|
|
98
98
|
* @returns Nothing.
|
|
99
99
|
*/
|
|
100
100
|
async update(id, metadata) {
|
|
101
|
-
core.Guards.stringValue(
|
|
102
|
-
core.Guards.object(
|
|
101
|
+
core.Guards.stringValue(NftRestClient.CLASS_NAME, "id", id);
|
|
102
|
+
core.Guards.object(NftRestClient.CLASS_NAME, "metadata", metadata);
|
|
103
103
|
await this.fetch("/:id", "PUT", {
|
|
104
104
|
pathParams: {
|
|
105
105
|
id
|
|
@@ -111,4 +111,4 @@ class NftClient extends apiCore.BaseRestClient {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
exports.
|
|
114
|
+
exports.NftRestClient = NftRestClient;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -7,17 +7,17 @@ import { HeaderTypes } from '@twin.org/web';
|
|
|
7
7
|
/**
|
|
8
8
|
* Client for performing NFT through to REST endpoints.
|
|
9
9
|
*/
|
|
10
|
-
class
|
|
10
|
+
class NftRestClient extends BaseRestClient {
|
|
11
11
|
/**
|
|
12
12
|
* Runtime name for the class.
|
|
13
13
|
*/
|
|
14
|
-
CLASS_NAME = "
|
|
14
|
+
static CLASS_NAME = "NftRestClient";
|
|
15
15
|
/**
|
|
16
16
|
* Create a new instance of NftClient.
|
|
17
17
|
* @param config The configuration for the client.
|
|
18
18
|
*/
|
|
19
19
|
constructor(config) {
|
|
20
|
-
super("
|
|
20
|
+
super("NftRestClient", config, "nft");
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Mint an NFT.
|
|
@@ -28,7 +28,7 @@ class NftClient extends BaseRestClient {
|
|
|
28
28
|
* @returns The id of the created NFT in urn format.
|
|
29
29
|
*/
|
|
30
30
|
async mint(tag, immutableMetadata, metadata, namespace) {
|
|
31
|
-
Guards.stringValue(
|
|
31
|
+
Guards.stringValue(NftRestClient.CLASS_NAME, "tag", tag);
|
|
32
32
|
const response = await this.fetch("/", "POST", {
|
|
33
33
|
body: {
|
|
34
34
|
tag,
|
|
@@ -45,7 +45,7 @@ class NftClient extends BaseRestClient {
|
|
|
45
45
|
* @returns The data for the NFT.
|
|
46
46
|
*/
|
|
47
47
|
async resolve(id) {
|
|
48
|
-
Guards.stringValue(
|
|
48
|
+
Guards.stringValue(NftRestClient.CLASS_NAME, "id", id);
|
|
49
49
|
const response = await this.fetch("/:id", "GET", {
|
|
50
50
|
pathParams: {
|
|
51
51
|
id
|
|
@@ -59,7 +59,7 @@ class NftClient extends BaseRestClient {
|
|
|
59
59
|
* @returns Nothing.
|
|
60
60
|
*/
|
|
61
61
|
async burn(id) {
|
|
62
|
-
Urn.guard(
|
|
62
|
+
Urn.guard(NftRestClient.CLASS_NAME, "id", id);
|
|
63
63
|
await this.fetch("/:id", "DELETE", {
|
|
64
64
|
pathParams: {
|
|
65
65
|
id
|
|
@@ -75,9 +75,9 @@ class NftClient extends BaseRestClient {
|
|
|
75
75
|
* @returns Nothing.
|
|
76
76
|
*/
|
|
77
77
|
async transfer(id, recipientIdentity, recipientAddress, metadata) {
|
|
78
|
-
Guards.stringValue(
|
|
79
|
-
Guards.stringValue(
|
|
80
|
-
Guards.stringValue(
|
|
78
|
+
Guards.stringValue(NftRestClient.CLASS_NAME, "id", id);
|
|
79
|
+
Guards.stringValue(NftRestClient.CLASS_NAME, "recipientIdentity", recipientIdentity);
|
|
80
|
+
Guards.stringValue(NftRestClient.CLASS_NAME, "recipientAddress", recipientAddress);
|
|
81
81
|
await this.fetch("/:id/transfer", "POST", {
|
|
82
82
|
pathParams: {
|
|
83
83
|
id
|
|
@@ -96,8 +96,8 @@ class NftClient extends BaseRestClient {
|
|
|
96
96
|
* @returns Nothing.
|
|
97
97
|
*/
|
|
98
98
|
async update(id, metadata) {
|
|
99
|
-
Guards.stringValue(
|
|
100
|
-
Guards.object(
|
|
99
|
+
Guards.stringValue(NftRestClient.CLASS_NAME, "id", id);
|
|
100
|
+
Guards.object(NftRestClient.CLASS_NAME, "metadata", metadata);
|
|
101
101
|
await this.fetch("/:id", "PUT", {
|
|
102
102
|
pathParams: {
|
|
103
103
|
id
|
|
@@ -109,4 +109,4 @@ class NftClient extends BaseRestClient {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
export {
|
|
112
|
+
export { NftRestClient };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./nftRestClient";
|
|
@@ -4,11 +4,11 @@ import type { INftComponent } from "@twin.org/nft-models";
|
|
|
4
4
|
/**
|
|
5
5
|
* Client for performing NFT through to REST endpoints.
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class NftRestClient extends BaseRestClient implements INftComponent {
|
|
8
8
|
/**
|
|
9
9
|
* Runtime name for the class.
|
|
10
10
|
*/
|
|
11
|
-
readonly CLASS_NAME: string;
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
12
|
/**
|
|
13
13
|
* Create a new instance of NftClient.
|
|
14
14
|
* @param config The configuration for the client.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @twin.org/nft-rest-client - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.8](https://github.com/twinfoundation/nft/compare/nft-rest-client-v0.0.2-next.7...nft-rest-client-v0.0.2-next.8) (2025-10-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add validate-locales ([0055a56](https://github.com/twinfoundation/nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/nft-models bumped from 0.0.2-next.7 to 0.0.2-next.8
|
|
16
|
+
|
|
3
17
|
## [0.0.2-next.7](https://github.com/twinfoundation/nft/compare/nft-rest-client-v0.0.2-next.6...nft-rest-client-v0.0.2-next.7) (2025-09-26)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Class:
|
|
1
|
+
# Class: NftRestClient
|
|
2
2
|
|
|
3
3
|
Client for performing NFT through to REST endpoints.
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ Client for performing NFT through to REST endpoints.
|
|
|
14
14
|
|
|
15
15
|
### Constructor
|
|
16
16
|
|
|
17
|
-
> **new
|
|
17
|
+
> **new NftRestClient**(`config`): `NftRestClient`
|
|
18
18
|
|
|
19
19
|
Create a new instance of NftClient.
|
|
20
20
|
|
|
@@ -28,7 +28,7 @@ The configuration for the client.
|
|
|
28
28
|
|
|
29
29
|
#### Returns
|
|
30
30
|
|
|
31
|
-
`
|
|
31
|
+
`NftRestClient`
|
|
32
32
|
|
|
33
33
|
#### Overrides
|
|
34
34
|
|
|
@@ -38,14 +38,10 @@ The configuration for the client.
|
|
|
38
38
|
|
|
39
39
|
### CLASS\_NAME
|
|
40
40
|
|
|
41
|
-
> `readonly` **CLASS\_NAME**: `string`
|
|
41
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
43
43
|
Runtime name for the class.
|
|
44
44
|
|
|
45
|
-
#### Implementation of
|
|
46
|
-
|
|
47
|
-
`INftComponent.CLASS_NAME`
|
|
48
|
-
|
|
49
45
|
## Methods
|
|
50
46
|
|
|
51
47
|
### mint()
|
package/docs/reference/index.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/nft-rest-client",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.8",
|
|
4
4
|
"description": "NFT contract implementation which can connect to REST endpoints",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "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.2-next.
|
|
22
|
+
"@twin.org/nft-models": "0.0.2-next.8",
|
|
23
23
|
"@twin.org/web": "next"
|
|
24
24
|
},
|
|
25
25
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -39,5 +39,20 @@
|
|
|
39
39
|
"dist/types",
|
|
40
40
|
"locales",
|
|
41
41
|
"docs"
|
|
42
|
-
]
|
|
42
|
+
],
|
|
43
|
+
"keywords": [
|
|
44
|
+
"twin",
|
|
45
|
+
"trade",
|
|
46
|
+
"iota",
|
|
47
|
+
"framework",
|
|
48
|
+
"blockchain",
|
|
49
|
+
"nft",
|
|
50
|
+
"tokens",
|
|
51
|
+
"non-fungible",
|
|
52
|
+
"assets"
|
|
53
|
+
],
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "git+https://github.com/twinfoundation/nft/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://twindev.org"
|
|
43
58
|
}
|