@xyo-network/diviner-evm-call-result-to-token-uri 3.2.3 → 3.2.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/dist/neutral/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/Diviner.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Schema.ts","../../src/Config.ts","../../src/Diviner.ts"],"sourcesContent":["/**\n * The schema for the EVM call result to NFT token URI diviner.\n */\nexport const EvmCallResultToNftTokenUriDivinerSchema = 'network.xyo.evm.call.results.metadata.uri.diviner'\n/**\n * The schema for the EVM call result to NFT token URI diviner.\n */\nexport type EvmCallResultToNftTokenUriDivinerSchema = typeof EvmCallResultToNftTokenUriDivinerSchema\n","import type { DivinerConfig } from '@xyo-network/diviner-model'\n\nimport { EvmCallResultToNftTokenUriDivinerSchema } from './Schema.ts'\n\n/**\n * The config schema for the EVM call result to NFT token URI diviner\n */\nexport const EvmCallResultToNftTokenUriDivinerConfigSchema = `${EvmCallResultToNftTokenUriDivinerSchema}.config`\n/**\n * The config schema for the EVM call result to NFT token URI diviner\n */\nexport type EvmCallResultToNftTokenUriDivinerConfigSchema = typeof EvmCallResultToNftTokenUriDivinerConfigSchema\n\n/**\n * The config for the EVM call result to NFT token URI diviner\n */\nexport type EvmCallResultToNftTokenUriDivinerConfig = DivinerConfig<{ schema: EvmCallResultToNftTokenUriDivinerConfigSchema }>\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\n// eslint-disable-next-line workspaces/no-absolute-imports\nimport { type EvmCallResults, EvmCallResultsSchema } from '@xyo-network/evm-call-witness'\nimport type { NftMetadataUri } from '@xyo-network/evm-nft-id-payload-plugin'\nimport { NftMetadataUriSchema } from '@xyo-network/evm-nft-id-payload-plugin'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport { EvmCallResultToNftTokenUriDivinerConfigSchema } from './Config.ts'\nimport type { EvmCallResultToNftTokenUriDivinerParams } from './Params.ts'\nimport type { EvmTokenUriCallResults } from './Payload.ts'\n\nexport class EvmCallResultToNftTokenUriDiviner<\n TParams extends EvmCallResultToNftTokenUriDivinerParams = EvmCallResultToNftTokenUriDivinerParams,\n> extends AbstractDiviner<TParams, Payload, NftMetadataUri> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmCallResultToNftTokenUriDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmCallResultToNftTokenUriDivinerConfigSchema\n\n // TODO: Add support for ERC1155 with `uri` function in addition to current ERC721 `tokenURI` support\n protected override divineHandler(payloads: Payload[] = []): NftMetadataUri[] {\n const evmCallResults = payloads.filter(isPayloadOfSchemaType(EvmCallResultsSchema))
|
|
1
|
+
{"version":3,"sources":["../../src/Schema.ts","../../src/Config.ts","../../src/Diviner.ts"],"sourcesContent":["/**\n * The schema for the EVM call result to NFT token URI diviner.\n */\nexport const EvmCallResultToNftTokenUriDivinerSchema = 'network.xyo.evm.call.results.metadata.uri.diviner'\n/**\n * The schema for the EVM call result to NFT token URI diviner.\n */\nexport type EvmCallResultToNftTokenUriDivinerSchema = typeof EvmCallResultToNftTokenUriDivinerSchema\n","import type { DivinerConfig } from '@xyo-network/diviner-model'\n\nimport { EvmCallResultToNftTokenUriDivinerSchema } from './Schema.ts'\n\n/**\n * The config schema for the EVM call result to NFT token URI diviner\n */\nexport const EvmCallResultToNftTokenUriDivinerConfigSchema = `${EvmCallResultToNftTokenUriDivinerSchema}.config`\n/**\n * The config schema for the EVM call result to NFT token URI diviner\n */\nexport type EvmCallResultToNftTokenUriDivinerConfigSchema = typeof EvmCallResultToNftTokenUriDivinerConfigSchema\n\n/**\n * The config for the EVM call result to NFT token URI diviner\n */\nexport type EvmCallResultToNftTokenUriDivinerConfig = DivinerConfig<{ schema: EvmCallResultToNftTokenUriDivinerConfigSchema }>\n","import { AbstractDiviner } from '@xyo-network/diviner-abstract'\n// eslint-disable-next-line workspaces/no-absolute-imports\nimport { type EvmCallResults, EvmCallResultsSchema } from '@xyo-network/evm-call-witness'\nimport type { NftMetadataUri } from '@xyo-network/evm-nft-id-payload-plugin'\nimport { NftMetadataUriSchema } from '@xyo-network/evm-nft-id-payload-plugin'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport { EvmCallResultToNftTokenUriDivinerConfigSchema } from './Config.ts'\nimport type { EvmCallResultToNftTokenUriDivinerParams } from './Params.ts'\nimport type { EvmTokenUriCallResults } from './Payload.ts'\n\nexport class EvmCallResultToNftTokenUriDiviner<\n TParams extends EvmCallResultToNftTokenUriDivinerParams = EvmCallResultToNftTokenUriDivinerParams,\n> extends AbstractDiviner<TParams, Payload, NftMetadataUri> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmCallResultToNftTokenUriDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmCallResultToNftTokenUriDivinerConfigSchema\n\n // TODO: Add support for ERC1155 with `uri` function in addition to current ERC721 `tokenURI` support\n protected override divineHandler(payloads: Payload[] = []): NftMetadataUri[] {\n const evmCallResults = payloads.filter(isPayloadOfSchemaType<EvmCallResults>(EvmCallResultsSchema))\n const erc721CallResults = evmCallResults\n .filter((p): p is EvmTokenUriCallResults => {\n const casted = p as EvmTokenUriCallResults\n return casted.results?.tokenURI?.result !== undefined && (p.results?.tokenURI?.args?.length ?? 0) > 0\n })\n .map<NftMetadataUri>((p) => {\n const {\n address, chainId, results,\n } = p\n const { args, result } = results.tokenURI\n const tokenId = args[0]\n const num = Number(BigInt(tokenId)).toString()\n const metadataUri = result?.includes('{id}') ? result.replace('{id}', num) : result\n return {\n address, chainId, metadataUri, schema: NftMetadataUriSchema, tokenId,\n }\n })\n return erc721CallResults\n }\n}\n"],"mappings":";AAGO,IAAM,0CAA0C;;;ACIhD,IAAM,gDAAgD,GAAG,uCAAuC;;;ACPvG,SAAS,uBAAuB;AAEhC,SAA8B,4BAA4B;AAE1D,SAAS,4BAA4B;AAErC,SAAS,6BAA6B;AAM/B,IAAM,oCAAN,cAEG,gBAAkD;AAAA,EAC1D,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,6CAA6C;AAAA,EACzH,OAAyB,sBAA8B;AAAA;AAAA,EAGpC,cAAc,WAAsB,CAAC,GAAqB;AAC3E,UAAM,iBAAiB,SAAS,OAAO,sBAAsC,oBAAoB,CAAC;AAClG,UAAM,oBAAoB,eACvB,OAAO,CAAC,MAAmC;AAC1C,YAAM,SAAS;AACf,aAAO,OAAO,SAAS,UAAU,WAAW,WAAc,EAAE,SAAS,UAAU,MAAM,UAAU,KAAK;AAAA,IACtG,CAAC,EACA,IAAoB,CAAC,MAAM;AAC1B,YAAM;AAAA,QACJ;AAAA,QAAS;AAAA,QAAS;AAAA,MACpB,IAAI;AACJ,YAAM,EAAE,MAAM,OAAO,IAAI,QAAQ;AACjC,YAAM,UAAU,KAAK,CAAC;AACtB,YAAM,MAAM,OAAO,OAAO,OAAO,CAAC,EAAE,SAAS;AAC7C,YAAM,cAAc,QAAQ,SAAS,MAAM,IAAI,OAAO,QAAQ,QAAQ,GAAG,IAAI;AAC7E,aAAO;AAAA,QACL;AAAA,QAAS;AAAA,QAAS;AAAA,QAAa,QAAQ;AAAA,QAAsB;AAAA,MAC/D;AAAA,IACF,CAAC;AACH,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-evm-call-result-to-token-uri",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xyo-network/diviner-abstract": "^3.6.
|
|
33
|
-
"@xyo-network/diviner-model": "^3.6.
|
|
34
|
-
"@xyo-network/evm-call-witness": "^3.2.
|
|
35
|
-
"@xyo-network/evm-nft-id-payload-plugin": "^3.2.
|
|
36
|
-
"@xyo-network/module-model": "^3.6.
|
|
37
|
-
"@xyo-network/payload-model": "^3.6.
|
|
32
|
+
"@xyo-network/diviner-abstract": "^3.6.6",
|
|
33
|
+
"@xyo-network/diviner-model": "^3.6.6",
|
|
34
|
+
"@xyo-network/evm-call-witness": "^3.2.5",
|
|
35
|
+
"@xyo-network/evm-nft-id-payload-plugin": "^3.2.5",
|
|
36
|
+
"@xyo-network/module-model": "^3.6.6",
|
|
37
|
+
"@xyo-network/payload-model": "^3.6.6",
|
|
38
38
|
"ethers": "^6.13.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@xylabs/ts-scripts-yarn3": "^4.2.6",
|
|
42
42
|
"@xylabs/tsconfig": "^4.2.6",
|
|
43
|
-
"@xylabs/vitest-extended": "^4.4.
|
|
44
|
-
"@xyo-network/evm-nft-id-payload-plugin": "^3.2.
|
|
43
|
+
"@xylabs/vitest-extended": "^4.4.32",
|
|
44
|
+
"@xyo-network/evm-nft-id-payload-plugin": "^3.2.5",
|
|
45
45
|
"typescript": "^5.7.2",
|
|
46
46
|
"vitest": "^2.1.8"
|
|
47
47
|
},
|
package/src/Diviner.ts
CHANGED
|
@@ -18,7 +18,7 @@ export class EvmCallResultToNftTokenUriDiviner<
|
|
|
18
18
|
|
|
19
19
|
// TODO: Add support for ERC1155 with `uri` function in addition to current ERC721 `tokenURI` support
|
|
20
20
|
protected override divineHandler(payloads: Payload[] = []): NftMetadataUri[] {
|
|
21
|
-
const evmCallResults = payloads.filter(isPayloadOfSchemaType(EvmCallResultsSchema))
|
|
21
|
+
const evmCallResults = payloads.filter(isPayloadOfSchemaType<EvmCallResults>(EvmCallResultsSchema))
|
|
22
22
|
const erc721CallResults = evmCallResults
|
|
23
23
|
.filter((p): p is EvmTokenUriCallResults => {
|
|
24
24
|
const casted = p as EvmTokenUriCallResults
|