@xyo-network/api-graphql-plugin 4.2.0 → 5.0.0
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 +15 -11
- package/src/spec/Witness.spec.ts +43 -0
- package/typedoc.json +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/api-graphql-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -28,20 +28,24 @@
|
|
|
28
28
|
},
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src"
|
|
34
|
+
],
|
|
31
35
|
"dependencies": {
|
|
32
|
-
"@xylabs/assert": "^
|
|
33
|
-
"@xylabs/axios": "^
|
|
34
|
-
"@xyo-network/abstract-witness": "^
|
|
35
|
-
"@xyo-network/module-model": "^
|
|
36
|
-
"@xyo-network/payload-model": "^
|
|
37
|
-
"@xyo-network/payloadset-plugin": "^
|
|
38
|
-
"@xyo-network/witness-model": "^
|
|
36
|
+
"@xylabs/assert": "^5.0.0",
|
|
37
|
+
"@xylabs/axios": "^5.0.0",
|
|
38
|
+
"@xyo-network/abstract-witness": "^5.0.0",
|
|
39
|
+
"@xyo-network/module-model": "^5.0.0",
|
|
40
|
+
"@xyo-network/payload-model": "^5.0.0",
|
|
41
|
+
"@xyo-network/payloadset-plugin": "^5.0.0",
|
|
42
|
+
"@xyo-network/witness-model": "^5.0.0",
|
|
39
43
|
"graphql": "^16.11.0"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.
|
|
43
|
-
"@xylabs/tsconfig": "^7.0.
|
|
44
|
-
"@xylabs/vitest-extended": "^
|
|
46
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.2",
|
|
47
|
+
"@xylabs/tsconfig": "^7.0.2",
|
|
48
|
+
"@xylabs/vitest-extended": "^5.0.0",
|
|
45
49
|
"ethers": "^6.15.0",
|
|
46
50
|
"typescript": "^5.8.3",
|
|
47
51
|
"vitest": "^3.2.4"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import '@xylabs/vitest-extended'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
describe, expect,
|
|
5
|
+
it,
|
|
6
|
+
} from 'vitest'
|
|
7
|
+
|
|
8
|
+
import type { GraphqlQuery } from '../Witness.ts'
|
|
9
|
+
import { ApiGraphqlWitness, GraphqlQuerySchema } from '../Witness.ts'
|
|
10
|
+
|
|
11
|
+
const endpoint = 'https://api.quicknode.com/graphql'
|
|
12
|
+
|
|
13
|
+
describe('ApiGraphqlWitness', () => {
|
|
14
|
+
it('Expected Success', async () => {
|
|
15
|
+
const publicAddress = '0xacdaEEb57ff6886fC8e203B9Dd4C2b241DF89b7a'
|
|
16
|
+
const witness = await ApiGraphqlWitness.create({ account: 'random', endpoint })
|
|
17
|
+
const query: GraphqlQuery = {
|
|
18
|
+
query: `query Query {
|
|
19
|
+
ethereum {
|
|
20
|
+
walletByAddress(address: "${publicAddress}") {
|
|
21
|
+
walletNFTs (first: ${1}) {
|
|
22
|
+
edges {
|
|
23
|
+
node {
|
|
24
|
+
nft {
|
|
25
|
+
contractAddress
|
|
26
|
+
metadata
|
|
27
|
+
tokenId
|
|
28
|
+
externalUrl
|
|
29
|
+
name
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}`,
|
|
37
|
+
schema: GraphqlQuerySchema,
|
|
38
|
+
variables: {},
|
|
39
|
+
}
|
|
40
|
+
const results = await witness.observe([query])
|
|
41
|
+
expect(results).toBeArrayOfSize(1)
|
|
42
|
+
})
|
|
43
|
+
})
|