@xyo-network/api 2.47.7 → 2.47.8
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/docs.json +933 -933
- package/package.json +16 -16
- package/src/Api/Addresses/Address/Api.spec.ts +0 -77
package/package.json
CHANGED
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xylabs/assert": "^2.7.1",
|
|
13
13
|
"@xylabs/delay": "^2.7.1",
|
|
14
|
-
"@xyo-network/account": "^2.47.
|
|
15
|
-
"@xyo-network/api-models": "^2.47.
|
|
16
|
-
"@xyo-network/archivist": "^2.47.
|
|
17
|
-
"@xyo-network/axios": "^2.47.
|
|
18
|
-
"@xyo-network/boundwitness-builder": "^2.47.
|
|
19
|
-
"@xyo-network/boundwitness-model": "^2.47.
|
|
20
|
-
"@xyo-network/core": "^2.47.
|
|
21
|
-
"@xyo-network/diviner": "^2.47.
|
|
22
|
-
"@xyo-network/diviner-model": "^2.47.
|
|
23
|
-
"@xyo-network/huri": "^2.47.
|
|
24
|
-
"@xyo-network/module": "^2.47.
|
|
25
|
-
"@xyo-network/payload-builder": "^2.47.
|
|
26
|
-
"@xyo-network/payload-model": "^2.47.
|
|
27
|
-
"@xyo-network/payload-wrapper": "^2.47.
|
|
28
|
-
"@xyo-network/schema-payload-plugin": "^2.47.
|
|
14
|
+
"@xyo-network/account": "^2.47.8",
|
|
15
|
+
"@xyo-network/api-models": "^2.47.8",
|
|
16
|
+
"@xyo-network/archivist": "^2.47.8",
|
|
17
|
+
"@xyo-network/axios": "^2.47.8",
|
|
18
|
+
"@xyo-network/boundwitness-builder": "^2.47.8",
|
|
19
|
+
"@xyo-network/boundwitness-model": "^2.47.8",
|
|
20
|
+
"@xyo-network/core": "^2.47.8",
|
|
21
|
+
"@xyo-network/diviner": "^2.47.8",
|
|
22
|
+
"@xyo-network/diviner-model": "^2.47.8",
|
|
23
|
+
"@xyo-network/huri": "^2.47.8",
|
|
24
|
+
"@xyo-network/module": "^2.47.8",
|
|
25
|
+
"@xyo-network/payload-builder": "^2.47.8",
|
|
26
|
+
"@xyo-network/payload-model": "^2.47.8",
|
|
27
|
+
"@xyo-network/payload-wrapper": "^2.47.8",
|
|
28
|
+
"@xyo-network/schema-payload-plugin": "^2.47.8",
|
|
29
29
|
"lodash": "^4.17.21"
|
|
30
30
|
},
|
|
31
31
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
},
|
|
69
69
|
"sideEffects": false,
|
|
70
70
|
"types": "dist/types/index.d.ts",
|
|
71
|
-
"version": "2.47.
|
|
71
|
+
"version": "2.47.8"
|
|
72
72
|
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { Account } from '@xyo-network/account'
|
|
3
|
-
import { XyoApiConfig, XyoApiResponseBody } from '@xyo-network/api-models'
|
|
4
|
-
import { XyoBoundWitness } from '@xyo-network/boundwitness-model'
|
|
5
|
-
import { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'
|
|
6
|
-
import { ModuleDescription } from '@xyo-network/module'
|
|
7
|
-
|
|
8
|
-
import { XyoApiSimple } from '../../../Simple'
|
|
9
|
-
import { XyoArchivistApi } from '../../Api'
|
|
10
|
-
import { XyoAddressesApi } from '../Api'
|
|
11
|
-
import { XyoAddressApi } from './Api'
|
|
12
|
-
|
|
13
|
-
const config: XyoApiConfig = {
|
|
14
|
-
apiDomain: process.env.API_DOMAIN || 'http://localhost:8080',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
describe('XyoAddressApi', () => {
|
|
18
|
-
describe('get', () => {
|
|
19
|
-
let api: XyoAddressApi
|
|
20
|
-
let result: XyoApiResponseBody<ModuleDescription>
|
|
21
|
-
beforeAll(async () => {
|
|
22
|
-
const address = assertEx((await new XyoAddressesApi(config).get())?.children?.pop())
|
|
23
|
-
api = new XyoArchivistApi(config).addresses.address(address)
|
|
24
|
-
result = await api.get()
|
|
25
|
-
expect(result).toBeObject()
|
|
26
|
-
})
|
|
27
|
-
it('method exists', () => {
|
|
28
|
-
expect(api).toBeDefined()
|
|
29
|
-
expect(api.get).toBeFunction()
|
|
30
|
-
})
|
|
31
|
-
describe('returns module', () => {
|
|
32
|
-
it('address', () => {
|
|
33
|
-
expect(result?.address).toBeString()
|
|
34
|
-
})
|
|
35
|
-
it('supported queries', () => {
|
|
36
|
-
const queries = result?.queries
|
|
37
|
-
expect(queries).toBeArray()
|
|
38
|
-
expect(queries?.length).toBeGreaterThan(0)
|
|
39
|
-
queries?.map((query) => {
|
|
40
|
-
expect(query).toBeString()
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
describe('boundWitness', () => {
|
|
46
|
-
let address: string
|
|
47
|
-
let api: XyoApiSimple<XyoBoundWitness[]>
|
|
48
|
-
let history: XyoBoundWitness[]
|
|
49
|
-
beforeAll(async () => {
|
|
50
|
-
address = new Account({ phrase: 'test' }).addressValue.hex
|
|
51
|
-
api = new XyoArchivistApi(config).addresses.address(address).boundWitnesses
|
|
52
|
-
const result = await api.get()
|
|
53
|
-
expect(result).toBeArray()
|
|
54
|
-
history = assertEx(result)
|
|
55
|
-
})
|
|
56
|
-
it('method exists', () => {
|
|
57
|
-
expect(api).toBeDefined()
|
|
58
|
-
expect(api.get).toBeFunction()
|
|
59
|
-
})
|
|
60
|
-
describe('return BoundWitnesses', () => {
|
|
61
|
-
it('from the address specified', () => {
|
|
62
|
-
history?.map((block) => expect(block.addresses).toContain(address))
|
|
63
|
-
})
|
|
64
|
-
it('in sequential order', () => {
|
|
65
|
-
verifyBlockChainHistory(history)
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
const verifyBlockChainHistory = (history: XyoBoundWitness[]) => {
|
|
72
|
-
for (let i = 1; i < history.length; i++) {
|
|
73
|
-
const current = history[i - 1]
|
|
74
|
-
const previous = history[i]
|
|
75
|
-
expect(current.previous_hashes).toContain(new BoundWitnessWrapper(previous).hash)
|
|
76
|
-
}
|
|
77
|
-
}
|