@xyo-network/diviner-evm-call-result-to-token-uri 5.1.3 → 5.1.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-evm-call-result-to-token-uri",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,23 +30,26 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"src"
|
|
33
|
+
"src",
|
|
34
|
+
"!**/*.bench.*",
|
|
35
|
+
"!**/*.spec.*",
|
|
36
|
+
"!**/*.test.*"
|
|
34
37
|
],
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"@xyo-network/diviner-abstract": "~5.1.
|
|
37
|
-
"@xyo-network/diviner-model": "~5.1.
|
|
38
|
-
"@xyo-network/evm-call-witness": "~5.1.
|
|
39
|
-
"@xyo-network/evm-nft-id-payload-plugin": "~5.1.
|
|
40
|
-
"@xyo-network/module-model": "~5.1.
|
|
41
|
-
"@xyo-network/payload-model": "~5.1.
|
|
39
|
+
"@xyo-network/diviner-abstract": "~5.1.23",
|
|
40
|
+
"@xyo-network/diviner-model": "~5.1.23",
|
|
41
|
+
"@xyo-network/evm-call-witness": "~5.1.5",
|
|
42
|
+
"@xyo-network/evm-nft-id-payload-plugin": "~5.1.5",
|
|
43
|
+
"@xyo-network/module-model": "~5.1.23",
|
|
44
|
+
"@xyo-network/payload-model": "~5.1.23"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
|
-
"@xylabs/ts-scripts-yarn3": "~7.
|
|
45
|
-
"@xylabs/tsconfig": "~7.
|
|
46
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
47
|
-
"@xyo-network/evm-nft-id-payload-plugin": "~5.1.
|
|
48
|
-
"typescript": "~5.9.
|
|
49
|
-
"vitest": "~
|
|
47
|
+
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
48
|
+
"@xylabs/tsconfig": "~7.2.8",
|
|
49
|
+
"@xylabs/vitest-extended": "~5.0.37",
|
|
50
|
+
"@xyo-network/evm-nft-id-payload-plugin": "~5.1.5",
|
|
51
|
+
"typescript": "~5.9.3",
|
|
52
|
+
"vitest": "~4.0.10"
|
|
50
53
|
},
|
|
51
54
|
"publishConfig": {
|
|
52
55
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Diviner.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
package/src/spec/Diviner.spec.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import '@xylabs/vitest-extended'
|
|
2
|
-
|
|
3
|
-
import { isNftMetadataUri, NftMetadataUriSchema } from '@xyo-network/evm-nft-id-payload-plugin'
|
|
4
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
-
import {
|
|
6
|
-
beforeAll,
|
|
7
|
-
describe, expect, it,
|
|
8
|
-
} from 'vitest'
|
|
9
|
-
|
|
10
|
-
import { EvmCallResultToNftTokenUriDivinerConfigSchema } from '../Config.ts'
|
|
11
|
-
import { EvmCallResultToNftTokenUriDiviner } from '../Diviner.ts'
|
|
12
|
-
import type { EvmTokenUriCallResults } from '../Payload.ts'
|
|
13
|
-
|
|
14
|
-
const validateResult = (evmCallResults: EvmTokenUriCallResults, actual: Payload[]) => {
|
|
15
|
-
const results = actual.filter(isNftMetadataUri)
|
|
16
|
-
expect(results.length).toBe(1)
|
|
17
|
-
const {
|
|
18
|
-
address,
|
|
19
|
-
chainId,
|
|
20
|
-
results: { tokenURI: { args: [tokenId] } },
|
|
21
|
-
} = evmCallResults
|
|
22
|
-
expect(results[0].address).toBe(address)
|
|
23
|
-
expect(results[0].chainId).toBe(chainId)
|
|
24
|
-
expect(results[0].tokenId).toBe(tokenId)
|
|
25
|
-
expect(results[0].schema).toBe(NftMetadataUriSchema)
|
|
26
|
-
expect(results[0].metadataUri).toBeString()
|
|
27
|
-
const num = Number(BigInt(tokenId)).toString()
|
|
28
|
-
// It is not always true that the metadata URI contains the token ID, but
|
|
29
|
-
// it is true for the cases we are testing
|
|
30
|
-
expect(results[0].metadataUri).toContain(num)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
describe('CryptoWalletNftDiviner', () => {
|
|
34
|
-
const cases = [
|
|
35
|
-
{
|
|
36
|
-
address: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
|
|
37
|
-
chainId: 1,
|
|
38
|
-
results: { tokenURI: { args: ['0x0f'], result: 'ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/15' } },
|
|
39
|
-
schema: 'network.xyo.evm.call.results',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
address: '0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452',
|
|
43
|
-
chainId: 1,
|
|
44
|
-
results: { tokenURI: { args: ['0x543'], result: 'https://gutter-cats-metadata.s3.us-east-2.amazonaws.com/metadata/1347' } },
|
|
45
|
-
schema: 'network.xyo.evm.call.results',
|
|
46
|
-
},
|
|
47
|
-
] as EvmTokenUriCallResults[]
|
|
48
|
-
let diviner: EvmCallResultToNftTokenUriDiviner
|
|
49
|
-
beforeAll(async () => {
|
|
50
|
-
diviner = await EvmCallResultToNftTokenUriDiviner.create({
|
|
51
|
-
account: 'random',
|
|
52
|
-
config: { schema: EvmCallResultToNftTokenUriDivinerConfigSchema },
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
describe('divine', () => {
|
|
56
|
-
it.each(cases)('transforms the input to the result', async (evmCallResult) => {
|
|
57
|
-
const result = await diviner.divine([evmCallResult])
|
|
58
|
-
validateResult(evmCallResult, result)
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('replaced values in templatized results', async () => {
|
|
62
|
-
const evmCallResult = {
|
|
63
|
-
address: '0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452',
|
|
64
|
-
chainId: 1,
|
|
65
|
-
results: { tokenURI: { args: ['0x543'], result: 'https://gutter-cats-metadata.s3.us-east-2.amazonaws.com/metadata/{id}' } },
|
|
66
|
-
schema: 'network.xyo.evm.call.results',
|
|
67
|
-
} as EvmTokenUriCallResults
|
|
68
|
-
const result = await diviner.divine([evmCallResult])
|
|
69
|
-
validateResult(evmCallResult, result)
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
})
|