@xyo-network/etherchain-ethereum-gas-v2-plugin 4.2.0 → 5.0.1
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 +18 -14
- package/src/lib/spec/getV2GasFromEtherchain.spec.ts +23 -0
- package/src/spec/Plugin.spec.ts +18 -0
- package/src/spec/Witness.spec.ts +42 -0
- package/typedoc.json +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/etherchain-ethereum-gas-v2-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -28,22 +28,26 @@
|
|
|
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/axios": "
|
|
33
|
-
"@xyo-network/abstract-witness": "
|
|
34
|
-
"@xyo-network/etherchain-ethereum-gas-v2-payload-plugin": "
|
|
35
|
-
"@xyo-network/module-model": "
|
|
36
|
-
"@xyo-network/payload-model": "
|
|
37
|
-
"@xyo-network/payloadset-plugin": "
|
|
38
|
-
"@xyo-network/witness-model": "
|
|
36
|
+
"@xylabs/axios": "~5.0.7",
|
|
37
|
+
"@xyo-network/abstract-witness": "~5.0.2",
|
|
38
|
+
"@xyo-network/etherchain-ethereum-gas-v2-payload-plugin": "~5.0.1",
|
|
39
|
+
"@xyo-network/module-model": "~5.0.2",
|
|
40
|
+
"@xyo-network/payload-model": "~5.0.2",
|
|
41
|
+
"@xyo-network/payloadset-plugin": "~5.0.2",
|
|
42
|
+
"@xyo-network/witness-model": "~5.0.2"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"@xylabs/ts-scripts-yarn3": "
|
|
42
|
-
"@xylabs/tsconfig": "
|
|
43
|
-
"@xylabs/vitest-extended": "
|
|
44
|
-
"@xyo-network/payload-wrapper": "
|
|
45
|
-
"typescript": "
|
|
46
|
-
"vitest": "
|
|
45
|
+
"@xylabs/ts-scripts-yarn3": "~7.1.0",
|
|
46
|
+
"@xylabs/tsconfig": "~7.1.0",
|
|
47
|
+
"@xylabs/vitest-extended": "~5.0.7",
|
|
48
|
+
"@xyo-network/payload-wrapper": "~5.0.2",
|
|
49
|
+
"typescript": "~5.9.2",
|
|
50
|
+
"vitest": "~3.2.4"
|
|
47
51
|
},
|
|
48
52
|
"publishConfig": {
|
|
49
53
|
"access": "public"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import '@xylabs/vitest-extended'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
describe, expect,
|
|
5
|
+
test,
|
|
6
|
+
} from 'vitest'
|
|
7
|
+
|
|
8
|
+
import { getV2GasFromEtherchain } from '../getV2GasFromEtherchain.ts'
|
|
9
|
+
|
|
10
|
+
describe('getV2GasFromEtherchain', () => {
|
|
11
|
+
test('returns prices', async () => {
|
|
12
|
+
const gas = await getV2GasFromEtherchain()
|
|
13
|
+
expect(gas).toBeObject()
|
|
14
|
+
expect(gas.code).toBeNumber()
|
|
15
|
+
expect(gas.data).toBeObject()
|
|
16
|
+
expect(gas.data.fast).toBeNumber()
|
|
17
|
+
expect(gas.data.priceUSD).toBeNumber()
|
|
18
|
+
expect(gas.data.rapid).toBeNumber()
|
|
19
|
+
expect(gas.data.slow).toBeNumber()
|
|
20
|
+
expect(gas.data.standard).toBeNumber()
|
|
21
|
+
expect(gas.data.timestamp).toBeNumber()
|
|
22
|
+
})
|
|
23
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import '@xylabs/vitest-extended'
|
|
2
|
+
|
|
3
|
+
import { PayloadSetPluginResolver } from '@xyo-network/payloadset-plugin'
|
|
4
|
+
import {
|
|
5
|
+
describe, expect,
|
|
6
|
+
test,
|
|
7
|
+
} from 'vitest'
|
|
8
|
+
|
|
9
|
+
import { EthereumGasEtherchainV2Plugin } from '../Plugin.ts'
|
|
10
|
+
|
|
11
|
+
describe('EthereumGasEtherchainV2Plugin', () => {
|
|
12
|
+
test('Add to Resolver', async () => {
|
|
13
|
+
const plugin = EthereumGasEtherchainV2Plugin()
|
|
14
|
+
const resolver = await new PayloadSetPluginResolver().register(plugin)
|
|
15
|
+
expect(await resolver.resolve(plugin.set)).toBeObject()
|
|
16
|
+
expect(await resolver.witness(plugin.set)).toBeObject()
|
|
17
|
+
})
|
|
18
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import '@xylabs/vitest-extended'
|
|
2
|
+
|
|
3
|
+
import type { EthereumGasEtherchainV2Payload } from '@xyo-network/etherchain-ethereum-gas-v2-payload-plugin'
|
|
4
|
+
import { EthereumGasEtherchainV2Schema } from '@xyo-network/etherchain-ethereum-gas-v2-payload-plugin'
|
|
5
|
+
import { PayloadWrapper } from '@xyo-network/payload-wrapper'
|
|
6
|
+
import {
|
|
7
|
+
describe, expect,
|
|
8
|
+
test,
|
|
9
|
+
} from 'vitest'
|
|
10
|
+
|
|
11
|
+
import { EthereumGasEtherchainV2WitnessConfigSchema } from '../Schema.ts'
|
|
12
|
+
import { EtherchainEthereumGasWitnessV2 } from '../Witness.ts'
|
|
13
|
+
|
|
14
|
+
describe('EtherchainEthereumGasWitnessV2', () => {
|
|
15
|
+
test('returns observation', async () => {
|
|
16
|
+
const sut = await EtherchainEthereumGasWitnessV2.create({
|
|
17
|
+
account: 'random',
|
|
18
|
+
config: { schema: EthereumGasEtherchainV2WitnessConfigSchema },
|
|
19
|
+
})
|
|
20
|
+
const [actual] = (await sut.observe()) as EthereumGasEtherchainV2Payload[]
|
|
21
|
+
expect(actual).toBeObject()
|
|
22
|
+
expect(actual.code).toBeNumber()
|
|
23
|
+
expect(actual.data).toBeObject()
|
|
24
|
+
expect(actual.timestamp).toBeNumber()
|
|
25
|
+
expect(actual.schema).toBe(EthereumGasEtherchainV2Schema)
|
|
26
|
+
|
|
27
|
+
const answerWrapper = PayloadWrapper.wrap(actual)
|
|
28
|
+
expect(await answerWrapper.getValid()).toBe(true)
|
|
29
|
+
})
|
|
30
|
+
test('returns observation [no config]', async () => {
|
|
31
|
+
const sut = await EtherchainEthereumGasWitnessV2.create({ account: 'random' })
|
|
32
|
+
const [actual] = (await sut.observe()) as EthereumGasEtherchainV2Payload[]
|
|
33
|
+
expect(actual).toBeObject()
|
|
34
|
+
expect(actual.code).toBeNumber()
|
|
35
|
+
expect(actual.data).toBeObject()
|
|
36
|
+
expect(actual.timestamp).toBeNumber()
|
|
37
|
+
expect(actual.schema).toBe(EthereumGasEtherchainV2Schema)
|
|
38
|
+
|
|
39
|
+
const answerWrapper = PayloadWrapper.wrap(actual)
|
|
40
|
+
expect(await answerWrapper.getValid()).toBe(true)
|
|
41
|
+
})
|
|
42
|
+
})
|