@twin.org/nft-service 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN NFT Service
2
2
 
3
- NFT contract implementation and REST endpoint definitions.
3
+ This package provides the service layer for NFT operations and exposes route definitions for API integration. It centralises connector usage behind a consistent interface so applications can invoke NFT actions without coupling to a specific backend.
4
4
 
5
5
  ## Installation
6
6
 
@@ -94,8 +94,8 @@ export function generateRestRoutesNft(baseRouteName, componentName) {
94
94
  id: "nftResolveResponseExample",
95
95
  response: {
96
96
  body: {
97
- issuer: "did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
98
- owner: "did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
97
+ issuer: "0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
98
+ issuerIdentityId: "0xa1d80bee7fdb4fd91ae45c6e539209f73cb743b7da9db3e21322ea75af1878c0",
99
99
  tag: "MY-NFT",
100
100
  immutableMetadata: {
101
101
  docName: "bill-of-lading",
@@ -155,7 +155,6 @@ export function generateRestRoutesNft(baseRouteName, componentName) {
155
155
  id: "nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg=="
156
156
  },
157
157
  body: {
158
- recipientIdentity: "did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
159
158
  recipientAddress: "tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv",
160
159
  metadata: {
161
160
  data: "AAAAA"
@@ -277,11 +276,10 @@ export async function nftTransfer(httpRequestContext, componentName, request) {
277
276
  Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
278
277
  Guards.object(ROUTES_SOURCE, "request.body", request.body);
279
278
  Guards.stringValue(ROUTES_SOURCE, "request.body.recipientAddress", request.body.recipientAddress);
280
- Guards.stringValue(ROUTES_SOURCE, "request.body.recipientIdentity", request.body.recipientIdentity);
281
279
  const contextIds = await ContextIdStore.getContextIds();
282
280
  ContextIdHelper.guard(contextIds, ContextIdKeys.Organization);
283
281
  const component = ComponentFactory.get(componentName);
284
- await component.transfer(request.pathParams.id, request.body.recipientIdentity, request.body.recipientAddress, request.body.metadata, contextIds[ContextIdKeys.Organization]);
282
+ await component.transfer(request.pathParams.id, request.body.recipientAddress, request.body.metadata, contextIds[ContextIdKeys.Organization]);
285
283
  return {
286
284
  statusCode: HttpStatusCode.noContent
287
285
  };
@@ -1 +1 @@
1
- {"version":3,"file":"nftRoutes.js","sourceRoot":"","sources":["../../src/nftRoutes.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAW1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,aAAa,GAAG,WAAW,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW;IAC9B;QACC,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,yDAAyD;KACtE;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAqB,EAAE,aAAqB;IACjF,MAAM,SAAS,GAAkD;QAChE,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,aAAa;QACtB,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QACpB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,GAAG,aAAa,GA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AAC,MAAM,CAA4B,aAAa,kBAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,MAAM,CAAC,MAAM,CAAC,aAAa,2BAAiC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnF,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;IACxD,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAE9D,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAgB,aAAa,CAAC,CAAC;IACrE,MAAM,SAAS,CAAC,MAAM,CACrB,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,EACrB,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CACtC,CAAC;IAEF,OAAO;QACN,UAAU,EAAE,cAAc,CAAC,SAAS;KACpC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tICreatedResponse,\n\tIHttpRequestContext,\n\tINoContentResponse,\n\tIRestRoute,\n\tITag\n} from \"@twin.org/api-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { ComponentFactory, Guards } 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, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"nftRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsNft: ITag[] = [\n\t{\n\t\tname: \"NFT\",\n\t\tdescription: \"Endpoints which are modelled to access an NFT contract.\"\n\t}\n];\n\n/**\n * The REST routes for NFT.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesNft(baseRouteName: string, componentName: string): IRestRoute[] {\n\tconst mintRoute: IRestRoute<INftMintRequest, ICreatedResponse> = {\n\t\toperationId: \"nftMint\",\n\t\tsummary: \"Mint an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftMint(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftMintRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftMintExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftMintResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: HttpStatusCode.created,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst resolveRoute: IRestRoute<INftResolveRequest, INftResolveResponse> = {\n\t\toperationId: \"nftResolve\",\n\t\tsummary: \"Resolve an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftResolve(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftResolveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftResolveExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INftResolveResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftResolveResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tissuer:\n\t\t\t\t\t\t\t\t\t\"did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44\",\n\t\t\t\t\t\t\t\towner:\n\t\t\t\t\t\t\t\t\t\"did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44\",\n\t\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst burnRoute: IRestRoute<INftBurnRequest, INoContentResponse> = {\n\t\toperationId: \"nftBurn\",\n\t\tsummary: \"Burn an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftBurn(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftBurnRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftBurnExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst transferRoute: IRestRoute<INftTransferRequest, INoContentResponse> = {\n\t\toperationId: \"nftTransfer\",\n\t\tsummary: \"Transfer an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/:id/transfer`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftTransfer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftTransferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftTransferExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\trecipientIdentity:\n\t\t\t\t\t\t\t\t\"did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44\",\n\t\t\t\t\t\t\trecipientAddress: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\",\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst updateRoute: IRestRoute<INftUpdateRequest, INoContentResponse> = {\n\t\toperationId: \"nftUpdate\",\n\t\tsummary: \"Update an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftUpdateExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [mintRoute, resolveRoute, burnRoute, transferRoute, updateRoute];\n}\n\n/**\n * Mint an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftMint(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftMintRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<INftMintRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftMintRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.body.tag), request.body.tag);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst id = await component.mint(\n\t\trequest.body.tag,\n\t\trequest.body.immutableMetadata,\n\t\trequest.body.metadata,\n\t\trequest.body.namespace,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\t[HeaderTypes.Location]: id\n\t\t}\n\t};\n}\n\n/**\n * Resolve an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftResolve(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftResolveRequest\n): Promise<INftResolveResponse> {\n\tGuards.object<INftResolveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftResolveRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst result = await component.resolve(\n\t\trequest.pathParams.id,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tbody: result\n\t};\n}\n\n/**\n * Burn an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftBurn(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftBurnRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftBurnRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftBurnRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.burn(request.pathParams.id, contextIds[ContextIdKeys.Organization]);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Transfer an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftTransfer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftTransferRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftTransferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftTransferRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftTransferRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body.recipientAddress),\n\t\trequest.body.recipientAddress\n\t);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body.recipientIdentity),\n\t\trequest.body.recipientIdentity\n\t);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.transfer(\n\t\trequest.pathParams.id,\n\t\trequest.body.recipientIdentity,\n\t\trequest.body.recipientAddress,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Update an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftUpdateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftUpdateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body.metadata), request.body.metadata);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.update(\n\t\trequest.pathParams.id,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n"]}
1
+ {"version":3,"file":"nftRoutes.js","sourceRoot":"","sources":["../../src/nftRoutes.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAW1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,aAAa,GAAG,WAAW,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW;IAC9B;QACC,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,yDAAyD;KACtE;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAqB,EAAE,aAAqB;IACjF,MAAM,SAAS,GAAkD;QAChE,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,aAAa;QACtB,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QACpB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,GAAG,aAAa,GAAG;QACzB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EA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;IACxD,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAE9D,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAgB,aAAa,CAAC,CAAC;IACrE,MAAM,SAAS,CAAC,MAAM,CACrB,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,EACrB,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CACtC,CAAC;IAEF,OAAO;QACN,UAAU,EAAE,cAAc,CAAC,SAAS;KACpC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tICreatedResponse,\n\tIHttpRequestContext,\n\tINoContentResponse,\n\tIRestRoute,\n\tITag\n} from \"@twin.org/api-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { ComponentFactory, Guards } 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, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"nftRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsNft: ITag[] = [\n\t{\n\t\tname: \"NFT\",\n\t\tdescription: \"Endpoints which are modelled to access an NFT contract.\"\n\t}\n];\n\n/**\n * The REST routes for NFT.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesNft(baseRouteName: string, componentName: string): IRestRoute[] {\n\tconst mintRoute: IRestRoute<INftMintRequest, ICreatedResponse> = {\n\t\toperationId: \"nftMint\",\n\t\tsummary: \"Mint an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftMint(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftMintRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftMintExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftMintResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: HttpStatusCode.created,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst resolveRoute: IRestRoute<INftResolveRequest, INftResolveResponse> = {\n\t\toperationId: \"nftResolve\",\n\t\tsummary: \"Resolve an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftResolve(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftResolveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftResolveExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INftResolveResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftResolveResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tissuer: \"0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44\",\n\t\t\t\t\t\t\t\tissuerIdentityId:\n\t\t\t\t\t\t\t\t\t\"0xa1d80bee7fdb4fd91ae45c6e539209f73cb743b7da9db3e21322ea75af1878c0\",\n\t\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst burnRoute: IRestRoute<INftBurnRequest, INoContentResponse> = {\n\t\toperationId: \"nftBurn\",\n\t\tsummary: \"Burn an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftBurn(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftBurnRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftBurnExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst transferRoute: IRestRoute<INftTransferRequest, INoContentResponse> = {\n\t\toperationId: \"nftTransfer\",\n\t\tsummary: \"Transfer an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/:id/transfer`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftTransfer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftTransferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftTransferExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\trecipientAddress: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\",\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst updateRoute: IRestRoute<INftUpdateRequest, INoContentResponse> = {\n\t\toperationId: \"nftUpdate\",\n\t\tsummary: \"Update an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftUpdateExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [mintRoute, resolveRoute, burnRoute, transferRoute, updateRoute];\n}\n\n/**\n * Mint an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftMint(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftMintRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<INftMintRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftMintRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.body.tag), request.body.tag);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst id = await component.mint(\n\t\trequest.body.tag,\n\t\trequest.body.immutableMetadata,\n\t\trequest.body.metadata,\n\t\trequest.body.namespace,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\t[HeaderTypes.Location]: id\n\t\t}\n\t};\n}\n\n/**\n * Resolve an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftResolve(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftResolveRequest\n): Promise<INftResolveResponse> {\n\tGuards.object<INftResolveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftResolveRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst result = await component.resolve(\n\t\trequest.pathParams.id,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tbody: result\n\t};\n}\n\n/**\n * Burn an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftBurn(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftBurnRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftBurnRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftBurnRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.burn(request.pathParams.id, contextIds[ContextIdKeys.Organization]);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Transfer an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftTransfer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftTransferRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftTransferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftTransferRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftTransferRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body.recipientAddress),\n\t\trequest.body.recipientAddress\n\t);\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.transfer(\n\t\trequest.pathParams.id,\n\t\trequest.body.recipientAddress,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Update an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftUpdateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftUpdateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body.metadata), request.body.metadata);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.update(\n\t\trequest.pathParams.id,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n"]}
@@ -97,20 +97,18 @@ export class NftService {
97
97
  /**
98
98
  * Transfer an NFT.
99
99
  * @param id The id of the NFT to transfer in urn format.
100
- * @param recipientIdentity The recipient identity for the NFT.
101
100
  * @param recipientAddress The recipient address for the NFT.
102
101
  * @param metadata Optional mutable data to include during the transfer.
103
102
  * @param controllerIdentity The identity to perform the nft operation with.
104
103
  * @returns Nothing.
105
104
  */
106
- async transfer(id, recipientIdentity, recipientAddress, metadata, controllerIdentity) {
105
+ async transfer(id, recipientAddress, metadata, controllerIdentity) {
107
106
  Urn.guard(NftService.CLASS_NAME, "id", id);
108
- Guards.stringValue(NftService.CLASS_NAME, "recipientIdentity", recipientIdentity);
109
107
  Guards.stringValue(NftService.CLASS_NAME, "recipientAddress", recipientAddress);
110
108
  Guards.stringValue(NftService.CLASS_NAME, "controllerIdentity", controllerIdentity);
111
109
  try {
112
110
  const nftConnector = this.getConnector(id);
113
- await nftConnector.transfer(controllerIdentity, id, recipientIdentity, recipientAddress, metadata);
111
+ await nftConnector.transfer(controllerIdentity, id, recipientAddress, metadata);
114
112
  }
115
113
  catch (error) {
116
114
  throw new GeneralError(NftService.CLASS_NAME, "transferFailed", undefined, error);
@@ -1 +1 @@
1
- {"version":3,"file":"nftService.js","sourceRoot":"","sources":["../../src/nftService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAA0C,MAAM,sBAAsB,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,UAAU;IACtB;;OAEG;IACI,MAAM,CAAU,UAAU,gBAAgC;IAEjE;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,KAAK,CAAC;IAEnD;;;OAGG;IACc,iBAAiB,CAAS;IAE3C;;;OAGG;IACH,YAAY,OAAuC;QAClD,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAC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BAAmB,EAAE;gBAClE,SAAS,EAAE,UAAU,CAAC,UAAU;gBAChC,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,mBAAmB,CAAC,GAAG,CAAgB,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;IACxE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { NftConnectorFactory, type INftComponent, type INftConnector } from \"@twin.org/nft-models\";\nimport type { INftServiceConstructorOptions } from \"./models/INftServiceConstructorOptions.js\";\n\n/**\n * Service for performing NFT operations to a connector.\n */\nexport class NftService implements INftComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NftService>();\n\n\t/**\n\t * The namespace supported by the nft service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"nft\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of NftService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: INftServiceConstructorOptions) {\n\t\tconst names = NftConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\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 NftService.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 service configured namespace.\n\t * @param controllerIdentity The identity to perform the nft operation with.\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\tcontrollerIdentity?: string\n\t): Promise<string> {\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(tag), tag);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst nftConnector = NftConnectorFactory.get<INftConnector>(connectorNamespace);\n\n\t\t\tconst nftUrn = await nftConnector.mint(controllerIdentity, tag, immutableMetadata, metadata);\n\n\t\t\treturn nftUrn;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"mintFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The data for the NFT.\n\t */\n\tpublic async resolve<T = unknown, U = unknown>(\n\t\tid: string,\n\t\tcontrollerIdentity?: 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\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tconst result = await nftConnector.resolve<T, U>(id);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"resolveFailed\", undefined, error);\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 * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async burn(id: string, controllerIdentity?: string): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.burn(controllerIdentity, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"burnFailed\", undefined, error);\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 * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async transfer<U = unknown>(\n\t\tid: string,\n\t\trecipientIdentity: string,\n\t\trecipientAddress: string,\n\t\tmetadata?: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(recipientIdentity), recipientIdentity);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(recipientAddress), recipientAddress);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.transfer(\n\t\t\t\tcontrollerIdentity,\n\t\t\t\tid,\n\t\t\t\trecipientIdentity,\n\t\t\t\trecipientAddress,\n\t\t\t\tmetadata\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"transferFailed\", undefined, error);\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 * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async update<U = unknown>(\n\t\tid: string,\n\t\tmetadata: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.object(NftService.CLASS_NAME, nameof(metadata), metadata);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.update(controllerIdentity, id, metadata);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the NFT in urn format.\n\t * @returns The connector.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): INftConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== NftService._NAMESPACE) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: NftService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn NftConnectorFactory.get<INftConnector>(idUri.namespaceMethod());\n\t}\n}\n"]}
1
+ {"version":3,"file":"nftService.js","sourceRoot":"","sources":["../../src/nftService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAA0C,MAAM,sBAAsB,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,UAAU;IACtB;;OAEG;IACI,MAAM,CAAU,UAAU,gBAAgC;IAEjE;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,KAAK,CAAC;IAEnD;;;OAGG;IACc,iBAAiB,CAAS;IAE3C;;;OAGG;IACH,YAAY,OAAuC;QAClD,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC,UAAU,EAAE,cA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n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { NftConnectorFactory, type INftComponent, type INftConnector } from \"@twin.org/nft-models\";\nimport type { INftServiceConstructorOptions } from \"./models/INftServiceConstructorOptions.js\";\n\n/**\n * Service for performing NFT operations to a connector.\n */\nexport class NftService implements INftComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NftService>();\n\n\t/**\n\t * The namespace supported by the nft service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"nft\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of NftService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: INftServiceConstructorOptions) {\n\t\tconst names = NftConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\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 NftService.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 service configured namespace.\n\t * @param controllerIdentity The identity to perform the nft operation with.\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\tcontrollerIdentity?: string\n\t): Promise<string> {\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(tag), tag);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst nftConnector = NftConnectorFactory.get<INftConnector>(connectorNamespace);\n\n\t\t\tconst nftUrn = await nftConnector.mint(controllerIdentity, tag, immutableMetadata, metadata);\n\n\t\t\treturn nftUrn;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"mintFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The data for the NFT.\n\t */\n\tpublic async resolve<T = unknown, U = unknown>(\n\t\tid: string,\n\t\tcontrollerIdentity?: 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\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tconst result = await nftConnector.resolve<T, U>(id);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"resolveFailed\", undefined, error);\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 * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async burn(id: string, controllerIdentity?: string): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.burn(controllerIdentity, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"burnFailed\", undefined, error);\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 * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async transfer<U = unknown>(\n\t\tid: string,\n\t\trecipientAddress: string,\n\t\tmetadata?: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(recipientAddress), recipientAddress);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.transfer(controllerIdentity, id, recipientAddress, metadata);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"transferFailed\", undefined, error);\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 * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async update<U = unknown>(\n\t\tid: string,\n\t\tmetadata: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.object(NftService.CLASS_NAME, nameof(metadata), metadata);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.update(controllerIdentity, id, metadata);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the NFT in urn format.\n\t * @returns The connector.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): INftConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== NftService._NAMESPACE) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: NftService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn NftConnectorFactory.get<INftConnector>(idUri.namespaceMethod());\n\t}\n}\n"]}
@@ -36,7 +36,7 @@ export declare class NftService implements INftComponent {
36
36
  */
37
37
  resolve<T = unknown, U = unknown>(id: string, controllerIdentity?: string): Promise<{
38
38
  issuer: string;
39
- owner: string;
39
+ issuerIdentityId: string;
40
40
  tag: string;
41
41
  immutableMetadata?: T;
42
42
  metadata?: U;
@@ -51,13 +51,12 @@ export declare class NftService implements INftComponent {
51
51
  /**
52
52
  * Transfer an NFT.
53
53
  * @param id The id of the NFT to transfer in urn format.
54
- * @param recipientIdentity The recipient identity for the NFT.
55
54
  * @param recipientAddress The recipient address for the NFT.
56
55
  * @param metadata Optional mutable data to include during the transfer.
57
56
  * @param controllerIdentity The identity to perform the nft operation with.
58
57
  * @returns Nothing.
59
58
  */
60
- transfer<U = unknown>(id: string, recipientIdentity: string, recipientAddress: string, metadata?: U, controllerIdentity?: string): Promise<void>;
59
+ transfer<U = unknown>(id: string, recipientAddress: string, metadata?: U, controllerIdentity?: string): Promise<void>;
61
60
  /**
62
61
  * Update the data of the NFT.
63
62
  * @param id The id of the NFT to update in urn format.
package/docs/changelog.md CHANGED
@@ -1,6 +1,38 @@
1
- # @twin.org/nft-service - Changelog
1
+ # Changelog
2
2
 
3
- ## [0.0.3-next.3](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.3-next.2...nft-service-v0.0.3-next.3) (2026-03-03)
3
+ ## [0.0.3-next.5](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.3-next.4...nft-service-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
+ * devDependencies
17
+ * @twin.org/nft-connector-entity-storage bumped from 0.0.3-next.4 to 0.0.3-next.5
18
+
19
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.3-next.3...nft-service-v0.0.3-next.4) (2026-04-20)
20
+
21
+
22
+ ### Features
23
+
24
+ * 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))
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @twin.org/nft-models bumped from 0.0.3-next.3 to 0.0.3-next.4
32
+ * devDependencies
33
+ * @twin.org/nft-connector-entity-storage bumped from 0.0.3-next.3 to 0.0.3-next.4
34
+
35
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.3-next.2...nft-service-v0.0.3-next.3) (2026-03-03)
4
36
 
5
37
 
6
38
  ### Miscellaneous Chores
@@ -16,7 +48,7 @@
16
48
  * devDependencies
17
49
  * @twin.org/nft-connector-entity-storage bumped from 0.0.3-next.2 to 0.0.3-next.3
18
50
 
19
- ## [0.0.3-next.2](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.3-next.1...nft-service-v0.0.3-next.2) (2026-02-25)
51
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.3-next.1...nft-service-v0.0.3-next.2) (2026-02-25)
20
52
 
21
53
 
22
54
  ### Miscellaneous Chores
@@ -32,25 +64,25 @@
32
64
  * devDependencies
33
65
  * @twin.org/nft-connector-entity-storage bumped from 0.0.3-next.1 to 0.0.3-next.2
34
66
 
35
- ## [0.0.3-next.1](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.3-next.0...nft-service-v0.0.3-next.1) (2025-11-12)
67
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.3-next.0...nft-service-v0.0.3-next.1) (2025-11-12)
36
68
 
37
69
 
38
70
  ### Features
39
71
 
40
- * add context id features ([#50](https://github.com/twinfoundation/nft/issues/50)) ([56c31c7](https://github.com/twinfoundation/nft/commit/56c31c7ba10e3ef8ad44f6463153f90888e64711))
41
- * add validate-locales ([0055a56](https://github.com/twinfoundation/nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
42
- * eslint migration to flat config ([0e6fc12](https://github.com/twinfoundation/nft/commit/0e6fc128c3c8f6cd34db793787437dd4af2c9994))
43
- * iota rebased release ([bfdd233](https://github.com/twinfoundation/nft/commit/bfdd23330e168962f7ad0a6fcd2c9c9a38a11697))
44
- * move to json integration ([#31](https://github.com/twinfoundation/nft/issues/31)) ([89944ba](https://github.com/twinfoundation/nft/commit/89944ba05b955944f84419224c3ae63fef28cc23))
45
- * remove unused namespace ([48d2a92](https://github.com/twinfoundation/nft/commit/48d2a926d610fad0b0407311e71a215d15a99aa5))
46
- * update dependencies ([8660f76](https://github.com/twinfoundation/nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
47
- * update framework core ([f3496b6](https://github.com/twinfoundation/nft/commit/f3496b61bfebbb3479bb92df39ecfa9ac8d90b9b))
48
- * use shared store mechanism ([#16](https://github.com/twinfoundation/nft/issues/16)) ([897bc78](https://github.com/twinfoundation/nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
72
+ * add context id features ([#50](https://github.com/iotaledger/twin-nft/issues/50)) ([56c31c7](https://github.com/iotaledger/twin-nft/commit/56c31c7ba10e3ef8ad44f6463153f90888e64711))
73
+ * add validate-locales ([0055a56](https://github.com/iotaledger/twin-nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
74
+ * eslint migration to flat config ([0e6fc12](https://github.com/iotaledger/twin-nft/commit/0e6fc128c3c8f6cd34db793787437dd4af2c9994))
75
+ * iota rebased release ([bfdd233](https://github.com/iotaledger/twin-nft/commit/bfdd23330e168962f7ad0a6fcd2c9c9a38a11697))
76
+ * move to json integration ([#31](https://github.com/iotaledger/twin-nft/issues/31)) ([89944ba](https://github.com/iotaledger/twin-nft/commit/89944ba05b955944f84419224c3ae63fef28cc23))
77
+ * remove unused namespace ([48d2a92](https://github.com/iotaledger/twin-nft/commit/48d2a926d610fad0b0407311e71a215d15a99aa5))
78
+ * update dependencies ([8660f76](https://github.com/iotaledger/twin-nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
79
+ * update framework core ([f3496b6](https://github.com/iotaledger/twin-nft/commit/f3496b61bfebbb3479bb92df39ecfa9ac8d90b9b))
80
+ * use shared store mechanism ([#16](https://github.com/iotaledger/twin-nft/issues/16)) ([897bc78](https://github.com/iotaledger/twin-nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
49
81
 
50
82
 
51
83
  ### Bug Fixes
52
84
 
53
- * params order modified ([#19](https://github.com/twinfoundation/nft/issues/19)) ([c2ceb30](https://github.com/twinfoundation/nft/commit/c2ceb3040c12286d4fac09d51db77465366ba89d))
85
+ * params order modified ([#19](https://github.com/iotaledger/twin-nft/issues/19)) ([c2ceb30](https://github.com/iotaledger/twin-nft/commit/c2ceb3040c12286d4fac09d51db77465366ba89d))
54
86
 
55
87
 
56
88
  ### Dependencies
@@ -61,12 +93,12 @@
61
93
  * devDependencies
62
94
  * @twin.org/nft-connector-entity-storage bumped from 0.0.3-next.0 to 0.0.3-next.1
63
95
 
64
- ## [0.0.2-next.8](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.7...nft-service-v0.0.2-next.8) (2025-10-09)
96
+ ## [0.0.2-next.8](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.7...nft-service-v0.0.2-next.8) (2025-10-09)
65
97
 
66
98
 
67
99
  ### Features
68
100
 
69
- * add validate-locales ([0055a56](https://github.com/twinfoundation/nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
101
+ * add validate-locales ([0055a56](https://github.com/iotaledger/twin-nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
70
102
 
71
103
 
72
104
  ### Dependencies
@@ -77,7 +109,7 @@
77
109
  * devDependencies
78
110
  * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.7 to 0.0.2-next.8
79
111
 
80
- ## [0.0.2-next.7](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.6...nft-service-v0.0.2-next.7) (2025-09-26)
112
+ ## [0.0.2-next.7](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.6...nft-service-v0.0.2-next.7) (2025-09-26)
81
113
 
82
114
 
83
115
  ### Miscellaneous Chores
@@ -93,7 +125,7 @@
93
125
  * devDependencies
94
126
  * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.6 to 0.0.2-next.7
95
127
 
96
- ## [0.0.2-next.6](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.5...nft-service-v0.0.2-next.6) (2025-09-25)
128
+ ## [0.0.2-next.6](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.5...nft-service-v0.0.2-next.6) (2025-09-25)
97
129
 
98
130
 
99
131
  ### Miscellaneous Chores
@@ -109,7 +141,7 @@
109
141
  * devDependencies
110
142
  * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.5 to 0.0.2-next.6
111
143
 
112
- ## [0.0.2-next.5](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.4...nft-service-v0.0.2-next.5) (2025-09-22)
144
+ ## [0.0.2-next.5](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.4...nft-service-v0.0.2-next.5) (2025-09-22)
113
145
 
114
146
 
115
147
  ### Miscellaneous Chores
@@ -125,12 +157,12 @@
125
157
  * devDependencies
126
158
  * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.4 to 0.0.2-next.5
127
159
 
128
- ## [0.0.2-next.4](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.3...nft-service-v0.0.2-next.4) (2025-09-10)
160
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.3...nft-service-v0.0.2-next.4) (2025-09-10)
129
161
 
130
162
 
131
163
  ### Features
132
164
 
133
- * eslint migration to flat config ([0e6fc12](https://github.com/twinfoundation/nft/commit/0e6fc128c3c8f6cd34db793787437dd4af2c9994))
165
+ * eslint migration to flat config ([0e6fc12](https://github.com/iotaledger/twin-nft/commit/0e6fc128c3c8f6cd34db793787437dd4af2c9994))
134
166
 
135
167
 
136
168
  ### Dependencies
@@ -141,12 +173,12 @@
141
173
  * devDependencies
142
174
  * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.3 to 0.0.2-next.4
143
175
 
144
- ## [0.0.2-next.3](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.2...nft-service-v0.0.2-next.3) (2025-08-20)
176
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.2...nft-service-v0.0.2-next.3) (2025-08-20)
145
177
 
146
178
 
147
179
  ### Features
148
180
 
149
- * update framework core ([f3496b6](https://github.com/twinfoundation/nft/commit/f3496b61bfebbb3479bb92df39ecfa9ac8d90b9b))
181
+ * update framework core ([f3496b6](https://github.com/iotaledger/twin-nft/commit/f3496b61bfebbb3479bb92df39ecfa9ac8d90b9b))
150
182
 
151
183
 
152
184
  ### Dependencies
@@ -157,13 +189,13 @@
157
189
  * devDependencies
158
190
  * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.2 to 0.0.2-next.3
159
191
 
160
- ## [0.0.2-next.2](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.1...nft-service-v0.0.2-next.2) (2025-07-25)
192
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.1...nft-service-v0.0.2-next.2) (2025-07-25)
161
193
 
162
194
 
163
195
  ### Features
164
196
 
165
- * move to json integration ([#31](https://github.com/twinfoundation/nft/issues/31)) ([89944ba](https://github.com/twinfoundation/nft/commit/89944ba05b955944f84419224c3ae63fef28cc23))
166
- * remove unused namespace ([48d2a92](https://github.com/twinfoundation/nft/commit/48d2a926d610fad0b0407311e71a215d15a99aa5))
197
+ * move to json integration ([#31](https://github.com/iotaledger/twin-nft/issues/31)) ([89944ba](https://github.com/iotaledger/twin-nft/commit/89944ba05b955944f84419224c3ae63fef28cc23))
198
+ * remove unused namespace ([48d2a92](https://github.com/iotaledger/twin-nft/commit/48d2a926d610fad0b0407311e71a215d15a99aa5))
167
199
 
168
200
 
169
201
  ### Dependencies
@@ -174,19 +206,19 @@
174
206
  * devDependencies
175
207
  * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.1 to 0.0.2-next.2
176
208
 
177
- ## [0.0.2-next.1](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.0...nft-service-v0.0.2-next.1) (2025-07-16)
209
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.2-next.0...nft-service-v0.0.2-next.1) (2025-07-16)
178
210
 
179
211
 
180
212
  ### Features
181
213
 
182
- * iota rebased release ([bfdd233](https://github.com/twinfoundation/nft/commit/bfdd23330e168962f7ad0a6fcd2c9c9a38a11697))
183
- * update dependencies ([8660f76](https://github.com/twinfoundation/nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
184
- * use shared store mechanism ([#16](https://github.com/twinfoundation/nft/issues/16)) ([897bc78](https://github.com/twinfoundation/nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
214
+ * iota rebased release ([bfdd233](https://github.com/iotaledger/twin-nft/commit/bfdd23330e168962f7ad0a6fcd2c9c9a38a11697))
215
+ * update dependencies ([8660f76](https://github.com/iotaledger/twin-nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
216
+ * use shared store mechanism ([#16](https://github.com/iotaledger/twin-nft/issues/16)) ([897bc78](https://github.com/iotaledger/twin-nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
185
217
 
186
218
 
187
219
  ### Bug Fixes
188
220
 
189
- * params order modified ([#19](https://github.com/twinfoundation/nft/issues/19)) ([c2ceb30](https://github.com/twinfoundation/nft/commit/c2ceb3040c12286d4fac09d51db77465366ba89d))
221
+ * params order modified ([#19](https://github.com/iotaledger/twin-nft/issues/19)) ([c2ceb30](https://github.com/iotaledger/twin-nft/commit/c2ceb3040c12286d4fac09d51db77465366ba89d))
190
222
 
191
223
 
192
224
  ### Dependencies
@@ -202,7 +234,7 @@
202
234
 
203
235
  ### Features
204
236
 
205
- * release to production ([4d338b3](https://github.com/twinfoundation/nft/commit/4d338b3e8a4dbccc61a1d1da3c470ba86cefe535))
237
+ * release to production ([4d338b3](https://github.com/iotaledger/twin-nft/commit/4d338b3e8a4dbccc61a1d1da3c470ba86cefe535))
206
238
 
207
239
 
208
240
  ### Dependencies
@@ -213,7 +245,7 @@
213
245
  * devDependencies
214
246
  * @twin.org/nft-connector-entity-storage bumped from ^0.0.0 to ^0.0.1
215
247
 
216
- ## [0.0.1-next.32](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.31...nft-service-v0.0.1-next.32) (2025-06-24)
248
+ ## [0.0.1-next.32](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.31...nft-service-v0.0.1-next.32) (2025-06-24)
217
249
 
218
250
 
219
251
  ### Miscellaneous Chores
@@ -229,12 +261,12 @@
229
261
  * devDependencies
230
262
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.31 to 0.0.1-next.32
231
263
 
232
- ## [0.0.1-next.31](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.30...nft-service-v0.0.1-next.31) (2025-06-12)
264
+ ## [0.0.1-next.31](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.30...nft-service-v0.0.1-next.31) (2025-06-12)
233
265
 
234
266
 
235
267
  ### Features
236
268
 
237
- * update dependencies ([8660f76](https://github.com/twinfoundation/nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
269
+ * update dependencies ([8660f76](https://github.com/iotaledger/twin-nft/commit/8660f76ca324b0f476e45544cac6bee4b3146c3b))
238
270
 
239
271
 
240
272
  ### Dependencies
@@ -245,7 +277,7 @@
245
277
  * devDependencies
246
278
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.30 to 0.0.1-next.31
247
279
 
248
- ## [0.0.1-next.30](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.29...nft-service-v0.0.1-next.30) (2025-05-22)
280
+ ## [0.0.1-next.30](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.29...nft-service-v0.0.1-next.30) (2025-05-22)
249
281
 
250
282
 
251
283
  ### Miscellaneous Chores
@@ -261,7 +293,7 @@
261
293
  * devDependencies
262
294
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.29 to 0.0.1-next.30
263
295
 
264
- ## [0.0.1-next.29](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.28...nft-service-v0.0.1-next.29) (2025-05-21)
296
+ ## [0.0.1-next.29](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.28...nft-service-v0.0.1-next.29) (2025-05-21)
265
297
 
266
298
 
267
299
  ### Miscellaneous Chores
@@ -277,17 +309,17 @@
277
309
  * devDependencies
278
310
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.28 to 0.0.1-next.29
279
311
 
280
- ## [0.0.1-next.28](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.27...nft-service-v0.0.1-next.28) (2025-05-06)
312
+ ## [0.0.1-next.28](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.27...nft-service-v0.0.1-next.28) (2025-05-06)
281
313
 
282
314
 
283
315
  ### Features
284
316
 
285
- * iota rebased release ([bfdd233](https://github.com/twinfoundation/nft/commit/bfdd23330e168962f7ad0a6fcd2c9c9a38a11697))
317
+ * iota rebased release ([bfdd233](https://github.com/iotaledger/twin-nft/commit/bfdd23330e168962f7ad0a6fcd2c9c9a38a11697))
286
318
 
287
319
 
288
320
  ### Bug Fixes
289
321
 
290
- * params order modified ([#19](https://github.com/twinfoundation/nft/issues/19)) ([c2ceb30](https://github.com/twinfoundation/nft/commit/c2ceb3040c12286d4fac09d51db77465366ba89d))
322
+ * params order modified ([#19](https://github.com/iotaledger/twin-nft/issues/19)) ([c2ceb30](https://github.com/iotaledger/twin-nft/commit/c2ceb3040c12286d4fac09d51db77465366ba89d))
291
323
 
292
324
 
293
325
  ### Dependencies
@@ -298,7 +330,7 @@
298
330
  * devDependencies
299
331
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.27 to 0.0.1-next.28
300
332
 
301
- ## [0.0.1-next.27](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.26...nft-service-v0.0.1-next.27) (2025-04-24)
333
+ ## [0.0.1-next.27](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.26...nft-service-v0.0.1-next.27) (2025-04-24)
302
334
 
303
335
 
304
336
  ### Miscellaneous Chores
@@ -314,12 +346,12 @@
314
346
  * devDependencies
315
347
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.26 to 0.0.1-next.27
316
348
 
317
- ## [0.0.1-next.26](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.25...nft-service-v0.0.1-next.26) (2025-04-17)
349
+ ## [0.0.1-next.26](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.25...nft-service-v0.0.1-next.26) (2025-04-17)
318
350
 
319
351
 
320
352
  ### Features
321
353
 
322
- * use shared store mechanism ([#16](https://github.com/twinfoundation/nft/issues/16)) ([897bc78](https://github.com/twinfoundation/nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
354
+ * use shared store mechanism ([#16](https://github.com/iotaledger/twin-nft/issues/16)) ([897bc78](https://github.com/iotaledger/twin-nft/commit/897bc7805248ba1388b2dd03df24c33f1633f344))
323
355
 
324
356
 
325
357
  ### Dependencies
@@ -330,7 +362,7 @@
330
362
  * devDependencies
331
363
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.25 to 0.0.1-next.26
332
364
 
333
- ## [0.0.1-next.25](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.24...nft-service-v0.0.1-next.25) (2025-04-17)
365
+ ## [0.0.1-next.25](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.24...nft-service-v0.0.1-next.25) (2025-04-17)
334
366
 
335
367
 
336
368
  ### Miscellaneous Chores
@@ -346,7 +378,7 @@
346
378
  * devDependencies
347
379
  * @twin.org/nft-connector-entity-storage bumped from 0.0.1-next.24 to 0.0.1-next.25
348
380
 
349
- ## [0.0.1-next.24](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.1-next.23...nft-service-v0.0.1-next.24) (2025-03-28)
381
+ ## [0.0.1-next.24](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.1-next.23...nft-service-v0.0.1-next.24) (2025-03-28)
350
382
 
351
383
 
352
384
  ### Miscellaneous Chores
package/docs/examples.md CHANGED
@@ -1 +1,103 @@
1
- # @twin.org/nft-service - Examples
1
+ # NFT Service Examples
2
+
3
+ Use these snippets to route NFT operations through a service layer so your application can switch connector backends without changing business logic.
4
+
5
+ ## NftService
6
+
7
+ ```typescript
8
+ import { EntityStorageNftConnector } from '@twin.org/nft-connector-entity-storage';
9
+ import { NftConnectorFactory } from '@twin.org/nft-models';
10
+ import { NftService } from '@twin.org/nft-service';
11
+
12
+ interface ImmutableProfile {
13
+ standard: 'IRC27';
14
+ version: 'v1.0';
15
+ type: string;
16
+ uri: string;
17
+ name: string;
18
+ }
19
+
20
+ interface MutableProfile {
21
+ stage: 'draft' | 'live';
22
+ revisions: number;
23
+ }
24
+
25
+ NftConnectorFactory.register(
26
+ EntityStorageNftConnector.NAMESPACE,
27
+ () => new EntityStorageNftConnector()
28
+ );
29
+
30
+ const service = new NftService({
31
+ config: {
32
+ defaultNamespace: EntityStorageNftConnector.NAMESPACE
33
+ }
34
+ });
35
+
36
+ console.log(service.className()); // NftService
37
+
38
+ const controller = 'did:example:issuer-42';
39
+
40
+ const nftId = await service.mint<ImmutableProfile, MutableProfile>(
41
+ 'release-pass',
42
+ {
43
+ standard: 'IRC27',
44
+ version: 'v1.0',
45
+ type: 'image/jpeg',
46
+ uri: 'ipfs://bafybeie11...',
47
+ name: 'Release Pass'
48
+ },
49
+ {
50
+ stage: 'draft',
51
+ revisions: 1
52
+ },
53
+ EntityStorageNftConnector.NAMESPACE,
54
+ controller
55
+ );
56
+
57
+ const resolved = await service.resolve<ImmutableProfile, MutableProfile>(nftId, controller);
58
+
59
+ console.log(resolved.owner); // did:example:issuer-42
60
+ console.log(resolved.metadata?.revisions); // 1
61
+ ```
62
+
63
+ ```typescript
64
+ import { EntityStorageNftConnector } from '@twin.org/nft-connector-entity-storage';
65
+ import { NftConnectorFactory } from '@twin.org/nft-models';
66
+ import { NftService } from '@twin.org/nft-service';
67
+
68
+ interface MutableProfile {
69
+ stage: 'draft' | 'live';
70
+ revisions: number;
71
+ }
72
+
73
+ NftConnectorFactory.register(
74
+ EntityStorageNftConnector.NAMESPACE,
75
+ () => new EntityStorageNftConnector()
76
+ );
77
+
78
+ const service = new NftService();
79
+ const controller = 'did:example:issuer-42';
80
+
81
+ const nftId = await service.mint(
82
+ 'release-pass',
83
+ { frozen: false },
84
+ { stage: 'draft', revisions: 1 },
85
+ EntityStorageNftConnector.NAMESPACE,
86
+ controller
87
+ );
88
+
89
+ await service.transfer<MutableProfile>(
90
+ nftId,
91
+ 'did:example:collector-24',
92
+ 'addr:example:collector-24',
93
+ {
94
+ stage: 'live',
95
+ revisions: 2
96
+ },
97
+ controller
98
+ );
99
+
100
+ await service.update<MutableProfile>(nftId, { stage: 'live', revisions: 3 }, controller);
101
+
102
+ await service.burn(nftId, controller);
103
+ ```
@@ -167,8 +167,8 @@
167
167
  "examples": {
168
168
  "nftResolveResponseExample": {
169
169
  "value": {
170
- "issuer": "did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
171
- "owner": "did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
170
+ "issuer": "0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
171
+ "issuerIdentityId": "0xa1d80bee7fdb4fd91ae45c6e539209f73cb743b7da9db3e21322ea75af1878c0",
172
172
  "tag": "MY-NFT",
173
173
  "immutableMetadata": {
174
174
  "docName": "bill-of-lading",
@@ -474,7 +474,6 @@
474
474
  "examples": {
475
475
  "nftTransferExample": {
476
476
  "value": {
477
- "recipientIdentity": "did:iota:tst:0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44",
478
477
  "recipientAddress": "tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv",
479
478
  "metadata": {
480
479
  "data": "AAAAA"
@@ -553,6 +552,7 @@
553
552
  "components": {
554
553
  "schemas": {
555
554
  "Error": {
555
+ "description": "Model to describe serialized error.",
556
556
  "type": "object",
557
557
  "properties": {
558
558
  "name": {
@@ -561,7 +561,7 @@
561
561
  },
562
562
  "message": {
563
563
  "type": "string",
564
- "description": "The message for the error."
564
+ "description": "The message for the error as an i18n key."
565
565
  },
566
566
  "source": {
567
567
  "type": "string",
@@ -583,8 +583,7 @@
583
583
  "required": [
584
584
  "name",
585
585
  "message"
586
- ],
587
- "description": "Model to describe serialized error."
586
+ ]
588
587
  },
589
588
  "NftMintRequest": {
590
589
  "type": "object",
@@ -616,9 +615,9 @@
616
615
  "type": "string",
617
616
  "description": "The issuer of the NFT."
618
617
  },
619
- "owner": {
618
+ "issuerIdentityId": {
620
619
  "type": "string",
621
- "description": "The owner of the NFT."
620
+ "description": "The on-chain Object ID of the verified IOTA Identity that minted this NFT.\nEmpty string when not minted with identity verification."
622
621
  },
623
622
  "tag": {
624
623
  "type": "string",
@@ -633,7 +632,7 @@
633
632
  },
634
633
  "required": [
635
634
  "issuer",
636
- "owner",
635
+ "issuerIdentityId",
637
636
  "tag"
638
637
  ],
639
638
  "description": "The data that was resolved."
@@ -641,10 +640,6 @@
641
640
  "NftTransferRequest": {
642
641
  "type": "object",
643
642
  "properties": {
644
- "recipientIdentity": {
645
- "type": "string",
646
- "description": "The recipient identity for the NFT."
647
- },
648
643
  "recipientAddress": {
649
644
  "type": "string",
650
645
  "description": "The recipient address for the NFT."
@@ -654,7 +649,6 @@
654
649
  }
655
650
  },
656
651
  "required": [
657
- "recipientIdentity",
658
652
  "recipientAddress"
659
653
  ],
660
654
  "description": "The data to be used in the transfer."
@@ -28,7 +28,7 @@ The options for the service.
28
28
 
29
29
  ## Properties
30
30
 
31
- ### CLASS\_NAME
31
+ ### CLASS\_NAME {#class_name}
32
32
 
33
33
  > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
@@ -36,7 +36,7 @@ Runtime name for the class.
36
36
 
37
37
  ## Methods
38
38
 
39
- ### className()
39
+ ### className() {#classname}
40
40
 
41
41
  > **className**(): `string`
42
42
 
@@ -54,7 +54,7 @@ The class name of the component.
54
54
 
55
55
  ***
56
56
 
57
- ### mint()
57
+ ### mint() {#mint}
58
58
 
59
59
  > **mint**\<`T`, `U`\>(`tag`, `immutableMetadata?`, `metadata?`, `namespace?`, `controllerIdentity?`): `Promise`\<`string`\>
60
60
 
@@ -114,9 +114,9 @@ The id of the created NFT in urn format.
114
114
 
115
115
  ***
116
116
 
117
- ### resolve()
117
+ ### resolve() {#resolve}
118
118
 
119
- > **resolve**\<`T`, `U`\>(`id`, `controllerIdentity?`): `Promise`\<\{ `issuer`: `string`; `owner`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
119
+ > **resolve**\<`T`, `U`\>(`id`, `controllerIdentity?`): `Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
120
120
 
121
121
  Resolve an NFT.
122
122
 
@@ -146,7 +146,7 @@ The identity to perform the nft operation with.
146
146
 
147
147
  #### Returns
148
148
 
149
- `Promise`\<\{ `issuer`: `string`; `owner`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
149
+ `Promise`\<\{ `issuer`: `string`; `issuerIdentityId`: `string`; `tag`: `string`; `immutableMetadata?`: `T`; `metadata?`: `U`; \}\>
150
150
 
151
151
  The data for the NFT.
152
152
 
@@ -156,7 +156,7 @@ The data for the NFT.
156
156
 
157
157
  ***
158
158
 
159
- ### burn()
159
+ ### burn() {#burn}
160
160
 
161
161
  > **burn**(`id`, `controllerIdentity?`): `Promise`\<`void`\>
162
162
 
@@ -188,9 +188,9 @@ Nothing.
188
188
 
189
189
  ***
190
190
 
191
- ### transfer()
191
+ ### transfer() {#transfer}
192
192
 
193
- > **transfer**\<`U`\>(`id`, `recipientIdentity`, `recipientAddress`, `metadata?`, `controllerIdentity?`): `Promise`\<`void`\>
193
+ > **transfer**\<`U`\>(`id`, `recipientAddress`, `metadata?`, `controllerIdentity?`): `Promise`\<`void`\>
194
194
 
195
195
  Transfer an NFT.
196
196
 
@@ -208,12 +208,6 @@ Transfer an NFT.
208
208
 
209
209
  The id of the NFT to transfer in urn format.
210
210
 
211
- ##### recipientIdentity
212
-
213
- `string`
214
-
215
- The recipient identity for the NFT.
216
-
217
211
  ##### recipientAddress
218
212
 
219
213
  `string`
@@ -244,7 +238,7 @@ Nothing.
244
238
 
245
239
  ***
246
240
 
247
- ### update()
241
+ ### update() {#update}
248
242
 
249
243
  > **update**\<`U`\>(`id`, `metadata`, `controllerIdentity?`): `Promise`\<`void`\>
250
244
 
@@ -4,8 +4,8 @@ Configuration for the NFT Service.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### defaultNamespace?
7
+ ### defaultNamespace? {#defaultnamespace}
8
8
 
9
- > `optional` **defaultNamespace**: `string`
9
+ > `optional` **defaultNamespace?**: `string`
10
10
 
11
11
  What is the default connector to use for NFT. If not provided the first connector from the factory will be used.
@@ -4,8 +4,8 @@ Options for the nft service constructor.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### config?
7
+ ### config? {#config}
8
8
 
9
- > `optional` **config**: [`INftServiceConfig`](INftServiceConfig.md)
9
+ > `optional` **config?**: [`INftServiceConfig`](INftServiceConfig.md)
10
10
 
11
11
  The configuration for the service.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/nft-service",
3
- "version": "0.0.3-next.3",
4
- "description": "NFT contract implementation and REST endpoint definitions",
3
+ "version": "0.0.3-next.5",
4
+ "description": "NFT service orchestration with REST route generation.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/nft.git",
7
+ "url": "git+https://github.com/iotaledger/nft.git",
8
8
  "directory": "packages/nft-service"
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.3",
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",
@@ -53,7 +53,7 @@
53
53
  "business-logic"
54
54
  ],
55
55
  "bugs": {
56
- "url": "git+https://github.com/twinfoundation/nft/issues"
56
+ "url": "git+https://github.com/iotaledger/nft/issues"
57
57
  },
58
58
  "homepage": "https://twindev.org"
59
59
  }