@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.
@@ -8,25 +8,23 @@ Service for performing NFT operations to a connector.
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new NftService()
11
+ ### Constructor
12
12
 
13
- > **new NftService**(`options`?): [`NftService`](NftService.md)
13
+ > **new NftService**(`options?`): `NftService`
14
14
 
15
15
  Create a new instance of NftService.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **options?**
19
+ ##### options?
20
20
 
21
- The options for the service.
22
-
23
- • **options.config?**: [`INftServiceConfig`](../interfaces/INftServiceConfig.md)
21
+ [`INftServiceConstructorOptions`](../interfaces/INftServiceConstructorOptions.md)
24
22
 
25
- The configuration for the service.
23
+ The options for the service.
26
24
 
27
25
  #### Returns
28
26
 
29
- [`NftService`](NftService.md)
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`\>(`issuer`, `tag`, `immutableMetadata`?, `metadata`?, `namespace`?, `identity`?): `Promise`\<`string`\>
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
- **T** = `unknown`
59
+ ##### T
62
60
 
63
- **U** = `unknown`
61
+ `T` = `unknown`
64
62
 
65
- #### Parameters
63
+ ##### U
64
+
65
+ `U` = `unknown`
66
66
 
67
- **issuer**: `string`
67
+ #### Parameters
68
68
 
69
- The issuer for the NFT, will also be the initial owner.
69
+ ##### tag
70
70
 
71
- • **tag**: `string`
71
+ `string`
72
72
 
73
73
  The tag for the NFT.
74
74
 
75
- **immutableMetadata?**: `T`
75
+ ##### immutableMetadata?
76
+
77
+ `T`
76
78
 
77
79
  The immutable metadata for the NFT.
78
80
 
79
- **metadata?**: `U`
81
+ ##### metadata?
82
+
83
+ `U`
80
84
 
81
85
  The metadata for the NFT.
82
86
 
83
- **namespace?**: `string`
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
- **identity?**: `string`
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`?): `Promise`\<`object`\>
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
- **T** = `unknown`
119
+ ##### T
120
+
121
+ `T` = `unknown`
122
+
123
+ ##### U
112
124
 
113
- • **U** = `unknown`
125
+ `U` = `unknown`
114
126
 
115
127
  #### Parameters
116
128
 
117
- **id**: `string`
129
+ ##### id
130
+
131
+ `string`
118
132
 
119
133
  The id of the NFT to resolve.
120
134
 
121
- **identity?**: `string`
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`\<`object`\>
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`?): `Promise`\<`void`\>
155
+ > **burn**(`id`, `identity?`): `Promise`\<`void`\>
160
156
 
161
157
  Burn an NFT.
162
158
 
163
159
  #### Parameters
164
160
 
165
- **id**: `string`
161
+ ##### id
162
+
163
+ `string`
166
164
 
167
165
  The id of the NFT to burn in urn format.
168
166
 
169
- **identity?**: `string`
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**\<`T`\>(`id`, `recipient`, `metadata`?, `identity`?): `Promise`\<`void`\>
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
- **T** = `unknown`
193
+ ##### U
194
+
195
+ `U` = `unknown`
194
196
 
195
197
  #### Parameters
196
198
 
197
- **id**: `string`
199
+ ##### id
200
+
201
+ `string`
198
202
 
199
203
  The id of the NFT to transfer in urn format.
200
204
 
201
- **recipient**: `string`
205
+ ##### recipientIdentity
202
206
 
203
- The recipient of the NFT.
207
+ `string`
204
208
 
205
- **metadata?**: `T`
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
- **identity?**: `string`
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**\<`T`\>(`id`, `metadata`, `identity`?): `Promise`\<`void`\>
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
- **T** = `unknown`
249
+ ##### U
250
+
251
+ `U` = `unknown`
234
252
 
235
253
  #### Parameters
236
254
 
237
- **id**: `string`
255
+ ##### id
256
+
257
+ `string`
238
258
 
239
259
  The id of the NFT to update in urn format.
240
260
 
241
- **metadata**: `T`
261
+ ##### metadata
262
+
263
+ `U`
242
264
 
243
265
  The mutable data to update.
244
266
 
245
- **identity?**: `string`
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
- **baseRouteName**: `string`
9
+ ### baseRouteName
10
+
11
+ `string`
10
12
 
11
13
  Prefix to prepend to the paths.
12
14
 
13
- **componentName**: `string`
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
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `INftBurnRequest`
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
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `INftMintRequest`
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
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `INftResolveRequest`
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
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `INftTransferRequest`
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
- **httpRequestContext**: `IHttpRequestContext`
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
10
12
 
11
13
  The request context for the API.
12
14
 
13
- **componentName**: `string`
15
+ ### componentName
16
+
17
+ `string`
14
18
 
15
19
  The name of the component to use in the routes.
16
20
 
17
- **request**: `INftUpdateRequest`
21
+ ### request
22
+
23
+ `INftUpdateRequest`
18
24
 
19
25
  The request.
20
26
 
@@ -7,6 +7,7 @@
7
7
  ## Interfaces
8
8
 
9
9
  - [INftServiceConfig](interfaces/INftServiceConfig.md)
10
+ - [INftServiceConstructorOptions](interfaces/INftServiceConstructorOptions.md)
10
11
 
11
12
  ## Variables
12
13
 
@@ -0,0 +1,11 @@
1
+ # Interface: INftServiceConstructorOptions
2
+
3
+ Options for the nft service constructor.
4
+
5
+ ## Properties
6
+
7
+ ### config?
8
+
9
+ > `optional` **config**: [`INftServiceConfig`](INftServiceConfig.md)
10
+
11
+ The configuration for the service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/nft-service",
3
- "version": "0.0.1-next.3",
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.3",
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",