@twin.org/nft-service 0.0.1-next.3 → 0.0.1-next.30
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 +16 -17
- package/dist/esm/index.mjs +16 -17
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/INftServiceConstructorOptions.d.ts +10 -0
- package/dist/types/nftService.d.ts +7 -10
- package/docs/changelog.md +118 -1
- package/docs/open-api/spec.json +684 -684
- package/docs/reference/classes/NftService.md +84 -60
- package/docs/reference/functions/generateRestRoutesNft.md +8 -4
- package/docs/reference/functions/nftBurn.md +9 -3
- package/docs/reference/functions/nftMint.md +9 -3
- package/docs/reference/functions/nftResolve.md +9 -3
- package/docs/reference/functions/nftTransfer.md +9 -3
- package/docs/reference/functions/nftUpdate.md +9 -3
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/INftServiceConstructorOptions.md +11 -0
- package/package.json +5 -34
|
@@ -8,25 +8,23 @@ Service for performing NFT operations to a connector.
|
|
|
8
8
|
|
|
9
9
|
## Constructors
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new NftService**(`options
|
|
13
|
+
> **new NftService**(`options?`): `NftService`
|
|
14
14
|
|
|
15
15
|
Create a new instance of NftService.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **options.config?**: [`INftServiceConfig`](../interfaces/INftServiceConfig.md)
|
|
21
|
+
[`INftServiceConstructorOptions`](../interfaces/INftServiceConstructorOptions.md)
|
|
24
22
|
|
|
25
|
-
The
|
|
23
|
+
The options for the service.
|
|
26
24
|
|
|
27
25
|
#### Returns
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
`NftService`
|
|
30
28
|
|
|
31
29
|
## Properties
|
|
32
30
|
|
|
@@ -52,39 +50,49 @@ Runtime name for the class.
|
|
|
52
50
|
|
|
53
51
|
### mint()
|
|
54
52
|
|
|
55
|
-
> **mint**\<`T`, `U`\>(`
|
|
53
|
+
> **mint**\<`T`, `U`\>(`tag`, `immutableMetadata?`, `metadata?`, `namespace?`, `identity?`): `Promise`\<`string`\>
|
|
56
54
|
|
|
57
55
|
Mint an NFT.
|
|
58
56
|
|
|
59
57
|
#### Type Parameters
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
##### T
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
`T` = `unknown`
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
##### U
|
|
64
|
+
|
|
65
|
+
`U` = `unknown`
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
#### Parameters
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
##### tag
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
`string`
|
|
72
72
|
|
|
73
73
|
The tag for the NFT.
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
##### immutableMetadata?
|
|
76
|
+
|
|
77
|
+
`T`
|
|
76
78
|
|
|
77
79
|
The immutable metadata for the NFT.
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
##### metadata?
|
|
82
|
+
|
|
83
|
+
`U`
|
|
80
84
|
|
|
81
85
|
The metadata for the NFT.
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
##### namespace?
|
|
88
|
+
|
|
89
|
+
`string`
|
|
84
90
|
|
|
85
91
|
The namespace of the connector to use for the NFT, defaults to service configured namespace.
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
##### identity?
|
|
94
|
+
|
|
95
|
+
`string`
|
|
88
96
|
|
|
89
97
|
The identity to perform the nft operation on.
|
|
90
98
|
|
|
@@ -102,52 +110,40 @@ The id of the created NFT in urn format.
|
|
|
102
110
|
|
|
103
111
|
### resolve()
|
|
104
112
|
|
|
105
|
-
> **resolve**\<`T`, `U`\>(`id`, `identity
|
|
113
|
+
> **resolve**\<`T`, `U`\>(`id`, `identity?`): `Promise`\<\{ `issuer`: `string`; `owner`: `string`; `tag`: `string`; `immutableMetadata`: `T`; `metadata`: `U`; \}\>
|
|
106
114
|
|
|
107
115
|
Resolve an NFT.
|
|
108
116
|
|
|
109
117
|
#### Type Parameters
|
|
110
118
|
|
|
111
|
-
|
|
119
|
+
##### T
|
|
120
|
+
|
|
121
|
+
`T` = `unknown`
|
|
122
|
+
|
|
123
|
+
##### U
|
|
112
124
|
|
|
113
|
-
|
|
125
|
+
`U` = `unknown`
|
|
114
126
|
|
|
115
127
|
#### Parameters
|
|
116
128
|
|
|
117
|
-
|
|
129
|
+
##### id
|
|
130
|
+
|
|
131
|
+
`string`
|
|
118
132
|
|
|
119
133
|
The id of the NFT to resolve.
|
|
120
134
|
|
|
121
|
-
|
|
135
|
+
##### identity?
|
|
136
|
+
|
|
137
|
+
`string`
|
|
122
138
|
|
|
123
139
|
The identity to perform the nft operation on.
|
|
124
140
|
|
|
125
141
|
#### Returns
|
|
126
142
|
|
|
127
|
-
`Promise
|
|
143
|
+
`Promise`\<\{ `issuer`: `string`; `owner`: `string`; `tag`: `string`; `immutableMetadata`: `T`; `metadata`: `U`; \}\>
|
|
128
144
|
|
|
129
145
|
The data for the NFT.
|
|
130
146
|
|
|
131
|
-
##### issuer
|
|
132
|
-
|
|
133
|
-
> **issuer**: `string`
|
|
134
|
-
|
|
135
|
-
##### owner
|
|
136
|
-
|
|
137
|
-
> **owner**: `string`
|
|
138
|
-
|
|
139
|
-
##### tag
|
|
140
|
-
|
|
141
|
-
> **tag**: `string`
|
|
142
|
-
|
|
143
|
-
##### immutableMetadata?
|
|
144
|
-
|
|
145
|
-
> `optional` **immutableMetadata**: `T`
|
|
146
|
-
|
|
147
|
-
##### metadata?
|
|
148
|
-
|
|
149
|
-
> `optional` **metadata**: `U`
|
|
150
|
-
|
|
151
147
|
#### Implementation of
|
|
152
148
|
|
|
153
149
|
`INftComponent.resolve`
|
|
@@ -156,17 +152,21 @@ The data for the NFT.
|
|
|
156
152
|
|
|
157
153
|
### burn()
|
|
158
154
|
|
|
159
|
-
> **burn**(`id`, `identity
|
|
155
|
+
> **burn**(`id`, `identity?`): `Promise`\<`void`\>
|
|
160
156
|
|
|
161
157
|
Burn an NFT.
|
|
162
158
|
|
|
163
159
|
#### Parameters
|
|
164
160
|
|
|
165
|
-
|
|
161
|
+
##### id
|
|
162
|
+
|
|
163
|
+
`string`
|
|
166
164
|
|
|
167
165
|
The id of the NFT to burn in urn format.
|
|
168
166
|
|
|
169
|
-
|
|
167
|
+
##### identity?
|
|
168
|
+
|
|
169
|
+
`string`
|
|
170
170
|
|
|
171
171
|
The identity to perform the nft operation on.
|
|
172
172
|
|
|
@@ -184,29 +184,45 @@ Nothing.
|
|
|
184
184
|
|
|
185
185
|
### transfer()
|
|
186
186
|
|
|
187
|
-
> **transfer**\<`
|
|
187
|
+
> **transfer**\<`U`\>(`id`, `recipientIdentity`, `recipientAddress`, `metadata?`, `identity?`): `Promise`\<`void`\>
|
|
188
188
|
|
|
189
189
|
Transfer an NFT.
|
|
190
190
|
|
|
191
191
|
#### Type Parameters
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
##### U
|
|
194
|
+
|
|
195
|
+
`U` = `unknown`
|
|
194
196
|
|
|
195
197
|
#### Parameters
|
|
196
198
|
|
|
197
|
-
|
|
199
|
+
##### id
|
|
200
|
+
|
|
201
|
+
`string`
|
|
198
202
|
|
|
199
203
|
The id of the NFT to transfer in urn format.
|
|
200
204
|
|
|
201
|
-
|
|
205
|
+
##### recipientIdentity
|
|
202
206
|
|
|
203
|
-
|
|
207
|
+
`string`
|
|
204
208
|
|
|
205
|
-
|
|
209
|
+
The recipient identity for the NFT.
|
|
210
|
+
|
|
211
|
+
##### recipientAddress
|
|
212
|
+
|
|
213
|
+
`string`
|
|
214
|
+
|
|
215
|
+
The recipient address for the NFT.
|
|
216
|
+
|
|
217
|
+
##### metadata?
|
|
218
|
+
|
|
219
|
+
`U`
|
|
206
220
|
|
|
207
221
|
Optional mutable data to include during the transfer.
|
|
208
222
|
|
|
209
|
-
|
|
223
|
+
##### identity?
|
|
224
|
+
|
|
225
|
+
`string`
|
|
210
226
|
|
|
211
227
|
The identity to perform the nft operation on.
|
|
212
228
|
|
|
@@ -224,25 +240,33 @@ Nothing.
|
|
|
224
240
|
|
|
225
241
|
### update()
|
|
226
242
|
|
|
227
|
-
> **update**\<`
|
|
243
|
+
> **update**\<`U`\>(`id`, `metadata`, `identity?`): `Promise`\<`void`\>
|
|
228
244
|
|
|
229
245
|
Update the data of the NFT.
|
|
230
246
|
|
|
231
247
|
#### Type Parameters
|
|
232
248
|
|
|
233
|
-
|
|
249
|
+
##### U
|
|
250
|
+
|
|
251
|
+
`U` = `unknown`
|
|
234
252
|
|
|
235
253
|
#### Parameters
|
|
236
254
|
|
|
237
|
-
|
|
255
|
+
##### id
|
|
256
|
+
|
|
257
|
+
`string`
|
|
238
258
|
|
|
239
259
|
The id of the NFT to update in urn format.
|
|
240
260
|
|
|
241
|
-
|
|
261
|
+
##### metadata
|
|
262
|
+
|
|
263
|
+
`U`
|
|
242
264
|
|
|
243
265
|
The mutable data to update.
|
|
244
266
|
|
|
245
|
-
|
|
267
|
+
##### identity?
|
|
268
|
+
|
|
269
|
+
`string`
|
|
246
270
|
|
|
247
271
|
The identity to perform the nft operation on.
|
|
248
272
|
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
# Function: generateRestRoutesNft()
|
|
2
2
|
|
|
3
|
-
> **generateRestRoutesNft**(`baseRouteName`, `componentName`): `IRestRoute`[]
|
|
3
|
+
> **generateRestRoutesNft**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
|
|
4
4
|
|
|
5
5
|
The REST routes for NFT.
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### baseRouteName
|
|
10
|
+
|
|
11
|
+
`string`
|
|
10
12
|
|
|
11
13
|
Prefix to prepend to the paths.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes stored in the ComponentFactory.
|
|
16
20
|
|
|
17
21
|
## Returns
|
|
18
22
|
|
|
19
|
-
`IRestRoute`[]
|
|
23
|
+
`IRestRoute`\<`any`, `any`\>[]
|
|
20
24
|
|
|
21
25
|
The generated routes.
|
|
@@ -6,15 +6,21 @@ Burn an NFT.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`INftBurnRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
|
@@ -6,15 +6,21 @@ Mint an NFT.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`INftMintRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
|
@@ -6,15 +6,21 @@ Resolve an NFT.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`INftResolveRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
|
@@ -6,15 +6,21 @@ Transfer an NFT.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`INftTransferRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
|
@@ -6,15 +6,21 @@ Update an NFT.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`INftUpdateRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
package/docs/reference/index.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/nft-service",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.30",
|
|
4
4
|
"description": "NFT contract implementation and REST endpoint definitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,53 +13,24 @@
|
|
|
13
13
|
"engines": {
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"clean": "rimraf dist coverage docs/reference",
|
|
18
|
-
"build": "tspc",
|
|
19
|
-
"test": "vitest --run --config ./vitest.config.ts --no-cache",
|
|
20
|
-
"coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
|
|
21
|
-
"bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
|
|
22
|
-
"bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
|
|
23
|
-
"bundle": "npm run bundle:esm && npm run bundle:cjs",
|
|
24
|
-
"docs:clean": "rimraf docs/reference",
|
|
25
|
-
"docs:generate": "typedoc",
|
|
26
|
-
"docs:api": "ts-to-openapi ./ts-to-openapi.json ./docs/open-api/spec.json",
|
|
27
|
-
"docs": "npm run docs:clean && npm run docs:generate && npm run docs:api",
|
|
28
|
-
"dist": "npm run clean && npm run build && npm run test && npm run bundle && npm run docs"
|
|
29
|
-
},
|
|
30
16
|
"dependencies": {
|
|
31
17
|
"@twin.org/api-models": "next",
|
|
32
18
|
"@twin.org/core": "next",
|
|
33
19
|
"@twin.org/entity": "next",
|
|
34
20
|
"@twin.org/nameof": "next",
|
|
35
|
-
"@twin.org/nft-models": "0.0.1-next.
|
|
21
|
+
"@twin.org/nft-models": "0.0.1-next.30",
|
|
36
22
|
"@twin.org/web": "next"
|
|
37
23
|
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@twin.org/nameof-transformer": "next",
|
|
40
|
-
"@twin.org/nft-connector-entity-storage": "0.0.1-next.3",
|
|
41
|
-
"@twin.org/ts-to-openapi": "next",
|
|
42
|
-
"@vitest/coverage-v8": "2.1.1",
|
|
43
|
-
"copyfiles": "2.4.1",
|
|
44
|
-
"rimraf": "6.0.1",
|
|
45
|
-
"rollup": "4.22.0",
|
|
46
|
-
"rollup-plugin-typescript2": "0.36.0",
|
|
47
|
-
"ts-patch": "3.2.1",
|
|
48
|
-
"typedoc": "0.26.7",
|
|
49
|
-
"typedoc-plugin-markdown": "4.2.7",
|
|
50
|
-
"typescript": "5.6.2",
|
|
51
|
-
"vitest": "2.1.1"
|
|
52
|
-
},
|
|
53
24
|
"main": "./dist/cjs/index.cjs",
|
|
54
25
|
"module": "./dist/esm/index.mjs",
|
|
55
26
|
"types": "./dist/types/index.d.ts",
|
|
56
27
|
"exports": {
|
|
57
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
58
30
|
"require": "./dist/cjs/index.cjs",
|
|
59
|
-
"import": "./dist/esm/index.mjs"
|
|
60
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
61
32
|
},
|
|
62
|
-
"./locales": "./locales"
|
|
33
|
+
"./locales/*.json": "./locales/*.json"
|
|
63
34
|
},
|
|
64
35
|
"files": [
|
|
65
36
|
"dist/cjs",
|