@xyo-network/etherchain-ethereum-gas-v2-plugin 4.1.1 → 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/dist/browser/index.d.ts +5 -26
- package/dist/neutral/index.d.ts +5 -26
- package/dist/node/index.d.ts +5 -26
- package/package.json +16 -13
- 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/dist/browser/index.d.ts
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
7
|
-
import { Schema, Payload } from '@xyo-network/payload-model';
|
|
8
|
-
|
|
9
|
-
type EthereumGasEtherchainV2WitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.etherchain.v2.witness.config';
|
|
10
|
-
declare const EthereumGasEtherchainV2WitnessConfigSchema: EthereumGasEtherchainV2WitnessConfigSchema;
|
|
11
|
-
|
|
12
|
-
type EthereumGasEtherchainV2WitnessConfig = WitnessConfig<{
|
|
13
|
-
schema: EthereumGasEtherchainV2WitnessConfigSchema;
|
|
14
|
-
}>;
|
|
15
|
-
|
|
16
|
-
declare const EthereumGasEtherchainV2Plugin: () => _xyo_network_payloadset_plugin.PayloadSetWitnessPlugin<_xyo_network_witness_model.WitnessModule<_xyo_network_witness_model.WitnessParams<_xyo_network_module_model.AnyConfigSchema<_xyo_network_witness_model.WitnessConfig>>, _xyo_network_witness_model.WitnessModuleEventData>>;
|
|
17
|
-
|
|
18
|
-
type EtherchainEthereumGasWitnessV2Params = WitnessParams<AnyConfigSchema<EthereumGasEtherchainV2WitnessConfig>>;
|
|
19
|
-
declare class EtherchainEthereumGasWitnessV2 extends AbstractWitness<EtherchainEthereumGasWitnessV2Params> {
|
|
20
|
-
static readonly configSchemas: Schema[];
|
|
21
|
-
static readonly defaultConfigSchema: Schema;
|
|
22
|
-
protected observeHandler(): Promise<Payload[]>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { EtherchainEthereumGasWitnessV2, EthereumGasEtherchainV2Plugin, EthereumGasEtherchainV2WitnessConfigSchema, EthereumGasEtherchainV2Plugin as default };
|
|
26
|
-
export type { EtherchainEthereumGasWitnessV2Params, EthereumGasEtherchainV2WitnessConfig };
|
|
1
|
+
export * from './Config.ts';
|
|
2
|
+
export { EthereumGasEtherchainV2Plugin as default, EthereumGasEtherchainV2Plugin } from './Plugin.ts';
|
|
3
|
+
export * from './Schema.ts';
|
|
4
|
+
export * from './Witness.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
7
|
-
import { Schema, Payload } from '@xyo-network/payload-model';
|
|
8
|
-
|
|
9
|
-
type EthereumGasEtherchainV2WitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.etherchain.v2.witness.config';
|
|
10
|
-
declare const EthereumGasEtherchainV2WitnessConfigSchema: EthereumGasEtherchainV2WitnessConfigSchema;
|
|
11
|
-
|
|
12
|
-
type EthereumGasEtherchainV2WitnessConfig = WitnessConfig<{
|
|
13
|
-
schema: EthereumGasEtherchainV2WitnessConfigSchema;
|
|
14
|
-
}>;
|
|
15
|
-
|
|
16
|
-
declare const EthereumGasEtherchainV2Plugin: () => _xyo_network_payloadset_plugin.PayloadSetWitnessPlugin<_xyo_network_witness_model.WitnessModule<_xyo_network_witness_model.WitnessParams<_xyo_network_module_model.AnyConfigSchema<_xyo_network_witness_model.WitnessConfig>>, _xyo_network_witness_model.WitnessModuleEventData>>;
|
|
17
|
-
|
|
18
|
-
type EtherchainEthereumGasWitnessV2Params = WitnessParams<AnyConfigSchema<EthereumGasEtherchainV2WitnessConfig>>;
|
|
19
|
-
declare class EtherchainEthereumGasWitnessV2 extends AbstractWitness<EtherchainEthereumGasWitnessV2Params> {
|
|
20
|
-
static readonly configSchemas: Schema[];
|
|
21
|
-
static readonly defaultConfigSchema: Schema;
|
|
22
|
-
protected observeHandler(): Promise<Payload[]>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { EtherchainEthereumGasWitnessV2, EthereumGasEtherchainV2Plugin, EthereumGasEtherchainV2WitnessConfigSchema, EthereumGasEtherchainV2Plugin as default };
|
|
26
|
-
export type { EtherchainEthereumGasWitnessV2Params, EthereumGasEtherchainV2WitnessConfig };
|
|
1
|
+
export * from './Config.ts';
|
|
2
|
+
export { EthereumGasEtherchainV2Plugin as default, EthereumGasEtherchainV2Plugin } from './Plugin.ts';
|
|
3
|
+
export * from './Schema.ts';
|
|
4
|
+
export * from './Witness.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
7
|
-
import { Schema, Payload } from '@xyo-network/payload-model';
|
|
8
|
-
|
|
9
|
-
type EthereumGasEtherchainV2WitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.etherchain.v2.witness.config';
|
|
10
|
-
declare const EthereumGasEtherchainV2WitnessConfigSchema: EthereumGasEtherchainV2WitnessConfigSchema;
|
|
11
|
-
|
|
12
|
-
type EthereumGasEtherchainV2WitnessConfig = WitnessConfig<{
|
|
13
|
-
schema: EthereumGasEtherchainV2WitnessConfigSchema;
|
|
14
|
-
}>;
|
|
15
|
-
|
|
16
|
-
declare const EthereumGasEtherchainV2Plugin: () => _xyo_network_payloadset_plugin.PayloadSetWitnessPlugin<_xyo_network_witness_model.WitnessModule<_xyo_network_witness_model.WitnessParams<_xyo_network_module_model.AnyConfigSchema<_xyo_network_witness_model.WitnessConfig>>, _xyo_network_witness_model.WitnessModuleEventData>>;
|
|
17
|
-
|
|
18
|
-
type EtherchainEthereumGasWitnessV2Params = WitnessParams<AnyConfigSchema<EthereumGasEtherchainV2WitnessConfig>>;
|
|
19
|
-
declare class EtherchainEthereumGasWitnessV2 extends AbstractWitness<EtherchainEthereumGasWitnessV2Params> {
|
|
20
|
-
static readonly configSchemas: Schema[];
|
|
21
|
-
static readonly defaultConfigSchema: Schema;
|
|
22
|
-
protected observeHandler(): Promise<Payload[]>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { EtherchainEthereumGasWitnessV2, EthereumGasEtherchainV2Plugin, EthereumGasEtherchainV2WitnessConfigSchema, EthereumGasEtherchainV2Plugin as default };
|
|
26
|
-
export type { EtherchainEthereumGasWitnessV2Params, EthereumGasEtherchainV2WitnessConfig };
|
|
1
|
+
export * from './Config.ts';
|
|
2
|
+
export { EthereumGasEtherchainV2Plugin as default, EthereumGasEtherchainV2Plugin } from './Plugin.ts';
|
|
3
|
+
export * from './Schema.ts';
|
|
4
|
+
export * from './Witness.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
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.0",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -28,21 +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/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.0",
|
|
37
|
+
"@xyo-network/abstract-witness": "^5.0.0",
|
|
38
|
+
"@xyo-network/etherchain-ethereum-gas-v2-payload-plugin": "^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
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.
|
|
42
|
-
"@xylabs/tsconfig": "^7.0.
|
|
43
|
-
"@xylabs/vitest-extended": "^
|
|
44
|
-
"@xyo-network/payload-wrapper": "^
|
|
45
|
-
"knip": "^5.62.0",
|
|
45
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.2",
|
|
46
|
+
"@xylabs/tsconfig": "^7.0.2",
|
|
47
|
+
"@xylabs/vitest-extended": "^5.0.0",
|
|
48
|
+
"@xyo-network/payload-wrapper": "^5.0.0",
|
|
46
49
|
"typescript": "^5.8.3",
|
|
47
50
|
"vitest": "^3.2.4"
|
|
48
51
|
},
|
|
@@ -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
|
+
})
|