@xyo-network/http-call-witness 5.1.2 → 5.1.4

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/http-call-witness",
3
- "version": "5.1.2",
3
+ "version": "5.1.4",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,32 +30,35 @@
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
- "@xylabs/assert": "~5.0.11",
37
- "@xylabs/axios": "~5.0.11",
38
- "@xylabs/hex": "~5.0.11",
39
- "@xylabs/object": "~5.0.11",
40
- "@xylabs/url": "~5.0.11",
41
- "@xyo-network/abstract-witness": "~5.1.2",
42
- "@xyo-network/hash": "~5.1.2",
43
- "@xyo-network/payload-builder": "~5.1.2",
44
- "@xyo-network/payload-model": "~5.1.2",
45
- "@xyo-network/witness-model": "~5.1.2",
39
+ "@xylabs/assert": "~5.0.33",
40
+ "@xylabs/axios": "~5.0.33",
41
+ "@xylabs/hex": "~5.0.33",
42
+ "@xylabs/object": "~5.0.33",
43
+ "@xylabs/url": "~5.0.33",
44
+ "@xyo-network/abstract-witness": "~5.1.23",
45
+ "@xyo-network/hash": "~5.1.23",
46
+ "@xyo-network/payload-builder": "~5.1.23",
47
+ "@xyo-network/payload-model": "~5.1.23",
48
+ "@xyo-network/witness-model": "~5.1.23",
46
49
  "axios": "~1.11.0",
47
50
  "base64-js": "~1.5.1",
48
51
  "es6-dynamic-template": "~2.0.0"
49
52
  },
50
53
  "devDependencies": {
51
- "@xylabs/ts-scripts-yarn3": "~7.1.7",
52
- "@xylabs/tsconfig": "~7.1.7",
53
- "@xylabs/vitest-extended": "~5.0.11",
54
- "@xyo-network/manifest": "~5.1.2",
55
- "@xyo-network/module-factory-locator": "~5.1.2",
56
- "@xyo-network/module-model": "~5.1.2",
57
- "@xyo-network/sentinel-model": "~5.1.2",
58
- "@xyo-network/wallet": "~5.1.2",
54
+ "@xylabs/ts-scripts-yarn3": "~7.2.8",
55
+ "@xylabs/tsconfig": "~7.2.8",
56
+ "@xylabs/vitest-extended": "~5.0.33",
57
+ "@xyo-network/manifest": "~5.1.23",
58
+ "@xyo-network/module-factory-locator": "~5.1.23",
59
+ "@xyo-network/module-model": "~5.1.23",
60
+ "@xyo-network/sentinel-model": "~5.1.23",
61
+ "@xyo-network/wallet": "~5.1.23",
59
62
  "ethers": "~6.15.0",
60
63
  "typescript": "~5.9.2",
61
64
  "vitest": "~3.2.4"
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=Witness.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Witness.spec.d.ts","sourceRoot":"","sources":["../../../../src/Witness/spec/Witness.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=opensea.nft-call.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opensea.nft-call.spec.d.ts","sourceRoot":"","sources":["../../../../src/Witness/spec/opensea.nft-call.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,27 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect,
5
- it,
6
- } from 'vitest'
7
-
8
- import {
9
- HttpCallResultSchema, HttpCallSchema, isHttpCallErrorResult,
10
- } from '../../Payload/index.ts'
11
- import { HttpCallWitnessConfigSchema } from '../Schema.ts'
12
- import { HttpCallWitness } from '../Witness.ts'
13
-
14
- describe('CryptoWalletNftWitness', () => {
15
- const uri = 'https://cnn.com'
16
- describe('observe', () => {
17
- it('get code from contract', async () => {
18
- const witness = await HttpCallWitness.create({
19
- account: 'random',
20
- config: { accept: 'text/html', schema: HttpCallWitnessConfigSchema },
21
- })
22
- const observation = await witness.observe([{ schema: HttpCallSchema, uri }])
23
- expect(observation[0].schema).toBe(HttpCallResultSchema)
24
- expect(isHttpCallErrorResult(observation[0].schema)).toBe(false)
25
- })
26
- })
27
- })
@@ -1,122 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import type { PackageManifestPayload } from '@xyo-network/manifest'
4
- import { ManifestWrapper } from '@xyo-network/manifest'
5
- import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
6
- import { ModuleFactory } from '@xyo-network/module-model'
7
- import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
8
- import { asSentinelInstance } from '@xyo-network/sentinel-model'
9
- import { HDWallet } from '@xyo-network/wallet'
10
- import { asWitnessInstance } from '@xyo-network/witness-model'
11
- import {
12
- describe, expect,
13
- it,
14
- } from 'vitest'
15
-
16
- import type { HttpCallJsonResult, HttpUriTemplateCall } from '../../Payload/index.ts'
17
- import { HttpCallResultSchema, HttpCallSchema } from '../../Payload/index.ts'
18
- import type { HttpCallWitnessParams } from '../Params.ts'
19
- import { HttpCallWitness } from '../Witness.ts'
20
- import openseaNftsManifest from './opensea.nft-call.json' with { type: 'json' }
21
-
22
- describe('OpenSeaHttp', () => {
23
- const address = '0xECA1bB9c8d3Fd8b926372f42c8D4c6c3ed0669B3' // Random Wallet
24
-
25
- const apiKey = process.env.OPENSEA_API_KEY
26
-
27
- describe.skipIf(!apiKey)('report', () => {
28
- type OpenSeaNft = {
29
- /*
30
- * Collection slug. A unique string to identify a collection on OpenSea
31
- */
32
- collection: string
33
- /*
34
- * The unique public blockchain identifier for the contract
35
- */
36
- contract: string
37
- /**
38
- * @deprecated
39
- */
40
- created_at: string
41
- /*
42
- * Description of the NFT
43
- */
44
- description: string
45
- /*
46
- * The NFT's unique identifier within the smart contract (also referred to as token_id)
47
- */
48
- identifier: string
49
- /*
50
- * Link to the image associated with the NFT
51
- */
52
- image_url: string
53
- /*
54
- * If the item is currently able to be bought or sold using OpenSea
55
- */
56
- is_disabled: boolean
57
- /*
58
- * If the item is currently classified as 'Not Safe for Work' by OpenSea as defined in OpenSea's NSFW Policy.
59
- */
60
- is_nsfw: boolean
61
- /*
62
- * Link to the offchain metadata store
63
- */
64
- metadata_url: string
65
- /*
66
- * Name of the NFT
67
- */
68
- name: string
69
- /*
70
- * ERC standard of the token (erc721, erc1155)
71
- */
72
- token_standard: string
73
- /*
74
- * Last time that the NFT's metadata was updated by OpenSea
75
- */
76
- updated_at: string
77
- }
78
- type OpenSeaListNftsByAccountResponse = {
79
- next: string
80
- nfts: OpenSeaNft[]
81
- }
82
- it('specifying address', async () => {
83
- const mnemonic = 'later puppy sound rebuild rebuild noise ozone amazing hope broccoli crystal grief'
84
- const wallet = await HDWallet.fromPhrase(mnemonic)
85
- const locator = new ModuleFactoryLocator()
86
-
87
- locator.register(
88
- new ModuleFactory(HttpCallWitness, {
89
- config: { uriTemplate: 'https://api.opensea.io/api/v2/chain/ethereum/account/${address}/nfts' },
90
- headers: { 'x-api-key': apiKey },
91
- } as HttpCallWitnessParams),
92
- )
93
-
94
- const manifest = new ManifestWrapper(openseaNftsManifest as PackageManifestPayload, wallet, locator)
95
-
96
- const node = await manifest.loadNodeFromIndex(0)
97
-
98
- const mods = await node.resolve('*')
99
-
100
- expect(mods.length).toBeGreaterThan(1)
101
-
102
- const resolvedWitness = await node.resolve('HttpCallWitness')
103
- expect(resolvedWitness).toBeDefined()
104
-
105
- const witness = asWitnessInstance(resolvedWitness)
106
- expect(witness).toBeDefined()
107
-
108
- const sentinel = asSentinelInstance(await node.resolve('HttpCallSentinel'))
109
- expect(sentinel).toBeDefined()
110
-
111
- const call: HttpUriTemplateCall = { params: { address }, schema: HttpCallSchema }
112
-
113
- const report = await sentinel?.report([call])
114
-
115
- const apiCallResult = report?.find(isPayloadOfSchemaType<HttpCallJsonResult<OpenSeaListNftsByAccountResponse>>(HttpCallResultSchema))
116
- expect(apiCallResult).toBeDefined()
117
- expect(apiCallResult?.schema).toBeString()
118
- expect(apiCallResult?.data.nfts).toBeArrayOfSize(1)
119
- expect(apiCallResult?.data.nfts[0].collection).toBeString()
120
- })
121
- })
122
- })