@xyo-network/gas-price-plugin 5.1.3 → 5.1.5

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.
Files changed (43) hide show
  1. package/package.json +28 -25
  2. package/dist/neutral/lib/identities/spec/isXyoEthereumGasBlocknativePayload.spec.d.ts +0 -2
  3. package/dist/neutral/lib/identities/spec/isXyoEthereumGasBlocknativePayload.spec.d.ts.map +0 -1
  4. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEtherchainV2Payload.spec.d.ts +0 -2
  5. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEtherchainV2Payload.spec.d.ts.map +0 -1
  6. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEthersPayload.spec.d.ts +0 -2
  7. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEthersPayload.spec.d.ts.map +0 -1
  8. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEtherscanPayload.spec.d.ts +0 -2
  9. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEtherscanPayload.spec.d.ts.map +0 -1
  10. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEthgasstationPayload.spec.d.ts +0 -2
  11. package/dist/neutral/lib/identities/spec/isXyoEthereumGasEthgasstationPayload.spec.d.ts.map +0 -1
  12. package/dist/neutral/lib/spec/average.spec.d.ts +0 -2
  13. package/dist/neutral/lib/spec/average.spec.d.ts.map +0 -1
  14. package/dist/neutral/lib/spec/divineGas.spec.d.ts +0 -2
  15. package/dist/neutral/lib/spec/divineGas.spec.d.ts.map +0 -1
  16. package/dist/neutral/lib/transforms/spec/transformGasFromBlocknative.spec.d.ts +0 -2
  17. package/dist/neutral/lib/transforms/spec/transformGasFromBlocknative.spec.d.ts.map +0 -1
  18. package/dist/neutral/lib/transforms/spec/transformGasFromEtherchainV2.spec.d.ts +0 -2
  19. package/dist/neutral/lib/transforms/spec/transformGasFromEtherchainV2.spec.d.ts.map +0 -1
  20. package/dist/neutral/lib/transforms/spec/transformGasFromEthers.spec.d.ts +0 -2
  21. package/dist/neutral/lib/transforms/spec/transformGasFromEthers.spec.d.ts.map +0 -1
  22. package/dist/neutral/lib/transforms/spec/transformGasFromEtherscan.spec.d.ts +0 -2
  23. package/dist/neutral/lib/transforms/spec/transformGasFromEtherscan.spec.d.ts.map +0 -1
  24. package/dist/neutral/lib/transforms/spec/transformGasFromEthgasstation.spec.d.ts +0 -2
  25. package/dist/neutral/lib/transforms/spec/transformGasFromEthgasstation.spec.d.ts.map +0 -1
  26. package/dist/neutral/spec/Diviner.spec.d.ts +0 -2
  27. package/dist/neutral/spec/Diviner.spec.d.ts.map +0 -1
  28. package/dist/neutral/spec/Plugin.spec.d.ts +0 -2
  29. package/dist/neutral/spec/Plugin.spec.d.ts.map +0 -1
  30. package/src/lib/identities/spec/isXyoEthereumGasBlocknativePayload.spec.ts +0 -36
  31. package/src/lib/identities/spec/isXyoEthereumGasEtherchainV2Payload.spec.ts +0 -36
  32. package/src/lib/identities/spec/isXyoEthereumGasEthersPayload.spec.ts +0 -36
  33. package/src/lib/identities/spec/isXyoEthereumGasEtherscanPayload.spec.ts +0 -36
  34. package/src/lib/identities/spec/isXyoEthereumGasEthgasstationPayload.spec.ts +0 -36
  35. package/src/lib/spec/average.spec.ts +0 -61
  36. package/src/lib/spec/divineGas.spec.ts +0 -64
  37. package/src/lib/transforms/spec/transformGasFromBlocknative.spec.ts +0 -44
  38. package/src/lib/transforms/spec/transformGasFromEtherchainV2.spec.ts +0 -39
  39. package/src/lib/transforms/spec/transformGasFromEthers.spec.ts +0 -34
  40. package/src/lib/transforms/spec/transformGasFromEtherscan.spec.ts +0 -39
  41. package/src/lib/transforms/spec/transformGasFromEthgasstation.spec.ts +0 -44
  42. package/src/spec/Diviner.spec.ts +0 -100
  43. package/src/spec/Plugin.spec.ts +0 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/gas-price-plugin",
3
- "version": "5.1.3",
3
+ "version": "5.1.5",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,36 +30,39 @@
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/exists": "~5.0.11",
37
- "@xyo-network/blocknative-ethereum-gas-payload-plugin": "~5.1.3",
38
- "@xyo-network/diviner-abstract": "~5.1.2",
39
- "@xyo-network/diviner-model": "~5.1.2",
40
- "@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins": "~5.1.3",
41
- "@xyo-network/ethers-ethereum-gas-payload-plugin": "~5.1.3",
42
- "@xyo-network/etherscan-ethereum-gas-payload-plugin": "~5.1.3",
43
- "@xyo-network/ethgasstation-ethereum-gas-payload-plugin": "~5.1.3",
44
- "@xyo-network/gas-price-payload-plugin": "~5.1.3",
45
- "@xyo-network/module-model": "~5.1.2",
46
- "@xyo-network/payload-builder": "~5.1.2",
47
- "@xyo-network/payload-model": "~5.1.2",
48
- "@xyo-network/payloadset-plugin": "~5.1.2",
39
+ "@xylabs/exists": "~5.0.37",
40
+ "@xyo-network/blocknative-ethereum-gas-payload-plugin": "~5.1.5",
41
+ "@xyo-network/diviner-abstract": "~5.1.23",
42
+ "@xyo-network/diviner-model": "~5.1.23",
43
+ "@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins": "~5.1.5",
44
+ "@xyo-network/ethers-ethereum-gas-payload-plugin": "~5.1.5",
45
+ "@xyo-network/etherscan-ethereum-gas-payload-plugin": "~5.1.5",
46
+ "@xyo-network/ethgasstation-ethereum-gas-payload-plugin": "~5.1.5",
47
+ "@xyo-network/gas-price-payload-plugin": "~5.1.5",
48
+ "@xyo-network/module-model": "~5.1.23",
49
+ "@xyo-network/payload-builder": "~5.1.23",
50
+ "@xyo-network/payload-model": "~5.1.23",
51
+ "@xyo-network/payloadset-plugin": "~5.1.23",
49
52
  "regression": "~2.0.1"
50
53
  },
51
54
  "devDependencies": {
52
55
  "@types/regression": "~2.0.6",
53
- "@xylabs/ts-scripts-yarn3": "~7.1.7",
54
- "@xylabs/tsconfig": "~7.1.7",
55
- "@xylabs/vitest-extended": "~5.0.11",
56
- "@xyo-network/blocknative-ethereum-gas-plugin": "~5.1.3",
57
- "@xyo-network/etherchain-gas-ethereum-blockchain-plugins": "~5.1.3",
58
- "@xyo-network/ethers-ethereum-gas-plugin": "~5.1.3",
59
- "@xyo-network/etherscan-ethereum-gas-plugin": "~5.1.3",
60
- "@xyo-network/witness-blockchain-abstract": "~5.1.2",
61
- "typescript": "~5.9.2",
62
- "vitest": "~3.2.4"
56
+ "@xylabs/ts-scripts-yarn3": "~7.2.8",
57
+ "@xylabs/tsconfig": "~7.2.8",
58
+ "@xylabs/vitest-extended": "~5.0.37",
59
+ "@xyo-network/blocknative-ethereum-gas-plugin": "~5.1.5",
60
+ "@xyo-network/etherchain-gas-ethereum-blockchain-plugins": "~5.1.5",
61
+ "@xyo-network/ethers-ethereum-gas-plugin": "~5.1.5",
62
+ "@xyo-network/etherscan-ethereum-gas-plugin": "~5.1.5",
63
+ "@xyo-network/witness-blockchain-abstract": "~5.1.23",
64
+ "typescript": "~5.9.3",
65
+ "vitest": "~4.0.10"
63
66
  },
64
67
  "publishConfig": {
65
68
  "access": "public"
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=isXyoEthereumGasBlocknativePayload.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isXyoEthereumGasBlocknativePayload.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/identities/spec/isXyoEthereumGasBlocknativePayload.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=isXyoEthereumGasEtherchainV2Payload.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isXyoEthereumGasEtherchainV2Payload.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/identities/spec/isXyoEthereumGasEtherchainV2Payload.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=isXyoEthereumGasEthersPayload.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isXyoEthereumGasEthersPayload.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/identities/spec/isXyoEthereumGasEthersPayload.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=isXyoEthereumGasEtherscanPayload.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isXyoEthereumGasEtherscanPayload.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/identities/spec/isXyoEthereumGasEtherscanPayload.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=isXyoEthereumGasEthgasstationPayload.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isXyoEthereumGasEthgasstationPayload.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/identities/spec/isXyoEthereumGasEthgasstationPayload.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=average.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"average.spec.d.ts","sourceRoot":"","sources":["../../../../src/lib/spec/average.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=divineGas.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"divineGas.spec.d.ts","sourceRoot":"","sources":["../../../../src/lib/spec/divineGas.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=transformGasFromBlocknative.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformGasFromBlocknative.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transforms/spec/transformGasFromBlocknative.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=transformGasFromEtherchainV2.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformGasFromEtherchainV2.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transforms/spec/transformGasFromEtherchainV2.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=transformGasFromEthers.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformGasFromEthers.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transforms/spec/transformGasFromEthers.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=transformGasFromEtherscan.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformGasFromEtherscan.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transforms/spec/transformGasFromEtherscan.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=transformGasFromEthgasstation.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformGasFromEthgasstation.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transforms/spec/transformGasFromEthgasstation.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=Diviner.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Diviner.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Diviner.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=Plugin.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Plugin.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,36 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect,
5
- it,
6
- } from 'vitest'
7
-
8
- import { sampleBlocknativeGas } from '../../../test/index.ts'
9
- import { isEthereumGasBlocknativePayload } from '../isEthereumGasBlocknativePayload.ts'
10
-
11
- describe('isEthereumGasBlocknativePayload', () => {
12
- describe('returns true', () => {
13
- it('when payload schema is EthereumGasBlocknativeSchema', () => {
14
- const result = isEthereumGasBlocknativePayload(sampleBlocknativeGas)
15
- expect(result).toBeTrue()
16
- })
17
- })
18
- describe('returns false', () => {
19
- it('when payload schema is not EthereumGasBlocknativeSchema', () => {
20
- const result = isEthereumGasBlocknativePayload({ schema: 'network.xyo.debug' })
21
- expect(result).toBeFalse()
22
- })
23
- it('when payload is missing', () => {
24
- const result = isEthereumGasBlocknativePayload()
25
- expect(result).toBeFalse()
26
- })
27
- it('when payload is undefined', () => {
28
- const result = isEthereumGasBlocknativePayload()
29
- expect(result).toBeFalse()
30
- })
31
- it('when payload is null', () => {
32
- const result = isEthereumGasBlocknativePayload(null)
33
- expect(result).toBeFalse()
34
- })
35
- })
36
- })
@@ -1,36 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect,
5
- it,
6
- } from 'vitest'
7
-
8
- import { sampleEtherchainGasV2 } from '../../../test/index.ts'
9
- import { isEthereumGasEtherchainV2Payload } from '../isEthereumGasEtherchainV2Payload.ts'
10
-
11
- describe('isEthereumGasEtherchainV2Payload', () => {
12
- describe('returns true', () => {
13
- it('when payload schema is EthereumGasEtherchainV2Schema', () => {
14
- const result = isEthereumGasEtherchainV2Payload(sampleEtherchainGasV2)
15
- expect(result).toBeTrue()
16
- })
17
- })
18
- describe('returns false', () => {
19
- it('when payload schema is not EthereumGasEtherscanSchema', () => {
20
- const result = isEthereumGasEtherchainV2Payload({ schema: 'network.xyo.debug' })
21
- expect(result).toBeFalse()
22
- })
23
- it('when payload is missing', () => {
24
- const result = isEthereumGasEtherchainV2Payload()
25
- expect(result).toBeFalse()
26
- })
27
- it('when payload is undefined', () => {
28
- const result = isEthereumGasEtherchainV2Payload()
29
- expect(result).toBeFalse()
30
- })
31
- it('when payload is null', () => {
32
- const result = isEthereumGasEtherchainV2Payload(null)
33
- expect(result).toBeFalse()
34
- })
35
- })
36
- })
@@ -1,36 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect,
5
- it,
6
- } from 'vitest'
7
-
8
- import { sampleEthersGas } from '../../../test/index.ts'
9
- import { isEthereumGasEthersPayload } from '../isEthereumGasEthersPayload.ts'
10
-
11
- describe('isEthereumGasEthersPayload', () => {
12
- describe('returns true', () => {
13
- it('when payload schema is EthereumGasEthersSchema', () => {
14
- const result = isEthereumGasEthersPayload(sampleEthersGas)
15
- expect(result).toBeTrue()
16
- })
17
- })
18
- describe('returns false', () => {
19
- it('when payload schema is not EthereumGasEthersSchema', () => {
20
- const result = isEthereumGasEthersPayload({ schema: 'network.xyo.debug' })
21
- expect(result).toBeFalse()
22
- })
23
- it('when payload is missing', () => {
24
- const result = isEthereumGasEthersPayload()
25
- expect(result).toBeFalse()
26
- })
27
- it('when payload is undefined', () => {
28
- const result = isEthereumGasEthersPayload()
29
- expect(result).toBeFalse()
30
- })
31
- it('when payload is null', () => {
32
- const result = isEthereumGasEthersPayload(null)
33
- expect(result).toBeFalse()
34
- })
35
- })
36
- })
@@ -1,36 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect,
5
- it,
6
- } from 'vitest'
7
-
8
- import { sampleEtherscanGas } from '../../../test/index.ts'
9
- import { isEthereumGasEtherscanPayload } from '../isEthereumGasEtherscanPayload.ts'
10
-
11
- describe('isEthereumGasEtherscanPayload', () => {
12
- describe('returns true', () => {
13
- it('when payload schema is EthereumGasEtherscanSchema', () => {
14
- const result = isEthereumGasEtherscanPayload(sampleEtherscanGas)
15
- expect(result).toBeTrue()
16
- })
17
- })
18
- describe('returns false', () => {
19
- it('when payload schema is not EthereumGasEtherscanSchema', () => {
20
- const result = isEthereumGasEtherscanPayload({ schema: 'network.xyo.debug' })
21
- expect(result).toBeFalse()
22
- })
23
- it('when payload is missing', () => {
24
- const result = isEthereumGasEtherscanPayload()
25
- expect(result).toBeFalse()
26
- })
27
- it('when payload is undefined', () => {
28
- const result = isEthereumGasEtherscanPayload()
29
- expect(result).toBeFalse()
30
- })
31
- it('when payload is null', () => {
32
- const result = isEthereumGasEtherscanPayload(null)
33
- expect(result).toBeFalse()
34
- })
35
- })
36
- })
@@ -1,36 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect,
5
- it,
6
- } from 'vitest'
7
-
8
- import { sampleEthgasstationGas } from '../../../test/index.ts'
9
- import { isEthereumGasEthgasstationPayload } from '../isEthereumGasEthgasstationPayload.ts'
10
-
11
- describe('isEthereumGasEthgasstationPayload', () => {
12
- describe('returns true', () => {
13
- it('when payload schema is EthereumGasEthgasstationSchema', () => {
14
- const result = isEthereumGasEthgasstationPayload(sampleEthgasstationGas)
15
- expect(result).toBeTrue()
16
- })
17
- })
18
- describe('returns false', () => {
19
- it('when payload schema is not EthereumGasEthgasstationSchema', () => {
20
- const result = isEthereumGasEthgasstationPayload({ schema: 'network.xyo.debug' })
21
- expect(result).toBeFalse()
22
- })
23
- it('when payload is missing', () => {
24
- const result = isEthereumGasEthgasstationPayload()
25
- expect(result).toBeFalse()
26
- })
27
- it('when payload is undefined', () => {
28
- const result = isEthereumGasEthgasstationPayload()
29
- expect(result).toBeFalse()
30
- })
31
- it('when payload is null', () => {
32
- const result = isEthereumGasEthgasstationPayload(null)
33
- expect(result).toBeFalse()
34
- })
35
- })
36
- })
@@ -1,61 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import type { FeeData } from '@xyo-network/gas-price-payload-plugin'
4
- import {
5
- describe, expect,
6
- it,
7
- } from 'vitest'
8
-
9
- import {
10
- sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthgasstationGas,
11
- } from '../../test/index.ts'
12
- import { average } from '../average.ts'
13
- import {
14
- transformGasFromBlocknative, transformGasFromEtherchainV2, transformGasFromEtherscan, transformGasFromEthgasstation,
15
- } from '../transforms/index.ts'
16
-
17
- const results: FeeData[] = [
18
- transformGasFromBlocknative(sampleBlocknativeGas),
19
- transformGasFromEtherchainV2(sampleEtherchainGasV2),
20
- transformGasFromEtherscan(sampleEtherscanGas),
21
- transformGasFromEthgasstation(sampleEthgasstationGas),
22
- ]
23
-
24
- describe('average', () => {
25
- it('averages payloads', () => {
26
- const payloads = results
27
- const result = average(payloads)
28
- expect(result).toBeObject()
29
- expect(result.baseFee).toBeNumber()
30
- expect(result.feePerGas).toBeObject()
31
- expect(result.feePerGas.low).toBeNumber()
32
- expect(result.feePerGas.medium).toBeNumber()
33
- expect(result.feePerGas.high).toBeNumber()
34
- expect(result.feePerGas.veryHigh).toBeNumber()
35
- expect(result.priorityFeePerGas).toBeObject()
36
- expect(result.priorityFeePerGas.low).toBeNumber()
37
- expect(result.priorityFeePerGas.medium).toBeNumber()
38
- expect(result.priorityFeePerGas.high).toBeNumber()
39
- expect(result.priorityFeePerGas.veryHigh).toBeNumber()
40
- })
41
- it('handles single payload', () => {
42
- const payloads = [results[0]]
43
- const result = average(payloads)
44
- expect(result).toBeObject()
45
- })
46
- it('handles no values', () => {
47
- const result = average()
48
- expect(result).toBeObject()
49
- expect(result.baseFee).toBeUndefined()
50
- expect(result.feePerGas).toBeObject()
51
- expect(result.feePerGas.low).toBeUndefined()
52
- expect(result.feePerGas.medium).toBeUndefined()
53
- expect(result.feePerGas.high).toBeUndefined()
54
- expect(result.feePerGas.veryHigh).toBeUndefined()
55
- expect(result.priorityFeePerGas).toBeObject()
56
- expect(result.priorityFeePerGas.low).toBeUndefined()
57
- expect(result.priorityFeePerGas.medium).toBeUndefined()
58
- expect(result.priorityFeePerGas.high).toBeUndefined()
59
- expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
60
- })
61
- })
@@ -1,64 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect,
5
- it,
6
- } from 'vitest'
7
-
8
- import {
9
- sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas,
10
- } from '../../test/index.ts'
11
- import { divineGas } from '../divineGas.ts'
12
-
13
- describe('divineGas', () => {
14
- describe('with no payloads supplied', () => {
15
- it('divines gas', () => {
16
- const result = divineGas([])
17
- expect(result).toBeObject()
18
- expect(result.timestamp).toBeNumber()
19
- })
20
- })
21
- describe('with sparse payloads supplied', () => {
22
- it.each([[sampleEtherscanGas], [sampleEtherchainGasV2], [sampleEtherchainGasV2, sampleEtherscanGas]])('divines gas', (...payloads) => {
23
- const result = divineGas(payloads)
24
- expect(result).toBeObject()
25
- expect(result.timestamp).toBeNumber()
26
- })
27
- })
28
- describe('with one of each supported payload supplied', () => {
29
- it('divines gas', () => {
30
- const result = divineGas([sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas])
31
- expect(result).toBeObject()
32
- expect(result.baseFee).toBeNumber()
33
- expect(result.feePerGas).toBeObject()
34
- expect(result.feePerGas.low).toBeNumber()
35
- expect(result.feePerGas.medium).toBeNumber()
36
- expect(result.feePerGas.high).toBeNumber()
37
- expect(result.feePerGas.veryHigh).toBeNumber()
38
- expect(result.priorityFeePerGas).toBeObject()
39
- expect(result.priorityFeePerGas.low).toBeNumber()
40
- expect(result.priorityFeePerGas.medium).toBeNumber()
41
- expect(result.priorityFeePerGas.high).toBeNumber()
42
- expect(result.priorityFeePerGas.veryHigh).toBeNumber()
43
- expect(result.timestamp).toBeNumber()
44
- })
45
- })
46
- describe('with multiple of each supported payload supplied', () => {
47
- it('divines gas', () => {
48
- const result = divineGas([
49
- sampleBlocknativeGas,
50
- sampleBlocknativeGas,
51
- sampleEtherchainGasV2,
52
- sampleEtherchainGasV2,
53
- sampleEtherscanGas,
54
- sampleEtherscanGas,
55
- sampleEthersGas,
56
- sampleEthersGas,
57
- sampleEthgasstationGas,
58
- sampleEthgasstationGas,
59
- ])
60
- expect(result).toBeObject()
61
- expect(result.timestamp).toBeNumber()
62
- })
63
- })
64
- })
@@ -1,44 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect, it,
5
- } from 'vitest'
6
-
7
- import { sampleBlocknativeGas } from '../../../test/index.ts'
8
- import { transformGasFromBlocknative } from '../transformGasFromBlocknative.ts'
9
-
10
- describe('transformGasFromEtherscan', () => {
11
- it('returns values in the expected format', () => {
12
- const result = transformGasFromBlocknative(sampleBlocknativeGas)
13
- expect(result).toBeObject()
14
- expect(result.baseFee).toBeNumber()
15
- expect(result.feePerGas).toBeObject()
16
- expect(result.feePerGas.low).toBeNumber()
17
- expect(result.feePerGas.medium).toBeNumber()
18
- expect(result.feePerGas.high).toBeNumber()
19
- expect(result.feePerGas.veryHigh).toBeNumber()
20
- expect(result.priorityFeePerGas).toBeObject()
21
- expect(result.priorityFeePerGas.low).toBeNumber()
22
- expect(result.priorityFeePerGas.medium).toBeNumber()
23
- expect(result.priorityFeePerGas.high).toBeNumber()
24
- expect(result.priorityFeePerGas.veryHigh).toBeNumber()
25
- })
26
- it('matches expected output', () => {
27
- const result = transformGasFromBlocknative(sampleBlocknativeGas)
28
- expect(result).toMatchObject({
29
- baseFee: 13.691_764_456,
30
- feePerGas: {
31
- low: 12.95,
32
- medium: 13.25,
33
- high: 13.55,
34
- veryHigh: 13.85,
35
- },
36
- priorityFeePerGas: {
37
- low: 0.14,
38
- medium: 0.37,
39
- high: 0.6,
40
- veryHigh: 0.83,
41
- },
42
- })
43
- })
44
- })
@@ -1,39 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect, it,
5
- } from 'vitest'
6
-
7
- import { sampleEtherchainGasV2 } from '../../../test/index.ts'
8
- import { transformGasFromEtherchainV2 } from '../transformGasFromEtherchainV2.ts'
9
-
10
- describe('transformGasFromEtherchainV2', () => {
11
- it('returns values in the expected format', () => {
12
- const result = transformGasFromEtherchainV2(sampleEtherchainGasV2)
13
- expect(result).toBeObject()
14
- expect(result.baseFee).toBeUndefined()
15
- expect(result.feePerGas).toBeObject()
16
- expect(result.feePerGas.low).toBeNumber()
17
- expect(result.feePerGas.medium).toBeNumber()
18
- expect(result.feePerGas.high).toBeNumber()
19
- expect(result.feePerGas.veryHigh).toBeNumber()
20
- expect(result.priorityFeePerGas).toBeObject()
21
- expect(result.priorityFeePerGas.low).toBeUndefined()
22
- expect(result.priorityFeePerGas.medium).toBeUndefined()
23
- expect(result.priorityFeePerGas.high).toBeUndefined()
24
- expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
25
- })
26
- it('matches expected output', () => {
27
- const result = transformGasFromEtherchainV2(sampleEtherchainGasV2)
28
- expect(result).toMatchObject({
29
- baseFee: undefined,
30
- feePerGas: {
31
- low: 11.2,
32
- medium: 12,
33
- high: 19.803_047_33,
34
- veryHigh: 29.714_286_17,
35
- },
36
- priorityFeePerGas: {},
37
- })
38
- })
39
- })
@@ -1,34 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect, it,
5
- } from 'vitest'
6
-
7
- import { sampleEthersGas } from '../../../test/index.ts'
8
- import { transformGasFromEthers } from '../transformGasFromEthers.ts'
9
-
10
- describe('transformGasFromEthers', () => {
11
- it('returns values in the expected format', () => {
12
- const result = transformGasFromEthers(sampleEthersGas)
13
- expect(result).toBeObject()
14
- expect(result.baseFee).toBeNumber()
15
- expect(result.feePerGas).toBeObject()
16
- expect(result.feePerGas.low).toBeUndefined()
17
- expect(result.feePerGas.medium).toBeUndefined()
18
- expect(result.feePerGas.high).toBeNumber()
19
- expect(result.feePerGas.veryHigh).toBeUndefined()
20
- expect(result.priorityFeePerGas).toBeObject()
21
- expect(result.priorityFeePerGas.low).toBeUndefined()
22
- expect(result.priorityFeePerGas.medium).toBeUndefined()
23
- expect(result.priorityFeePerGas.high).toBeNumber()
24
- expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
25
- })
26
- it('matches expected output', () => {
27
- const result = transformGasFromEthers(sampleEthersGas)
28
- expect(result).toMatchObject({
29
- baseFee: 13.547_863_64,
30
- feePerGas: { high: 28.395_724_162 },
31
- priorityFeePerGas: { high: 1.5 },
32
- })
33
- })
34
- })
@@ -1,39 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect, it,
5
- } from 'vitest'
6
-
7
- import { sampleEtherscanGas } from '../../../test/index.ts'
8
- import { transformGasFromEtherscan } from '../transformGasFromEtherscan.ts'
9
-
10
- describe('transformGasFromEtherscan', () => {
11
- it('returns values in the expected format', () => {
12
- const result = transformGasFromEtherscan(sampleEtherscanGas)
13
- expect(result).toBeObject()
14
- expect(result.baseFee).toBeNumber()
15
- expect(result.feePerGas).toBeObject()
16
- expect(result.feePerGas.low).toBeNumber()
17
- expect(result.feePerGas.medium).toBeNumber()
18
- expect(result.feePerGas.high).toBeNumber()
19
- expect(result.feePerGas.veryHigh).toBeNumber()
20
- expect(result.priorityFeePerGas).toBeObject()
21
- expect(result.priorityFeePerGas.low).toBeUndefined()
22
- expect(result.priorityFeePerGas.medium).toBeUndefined()
23
- expect(result.priorityFeePerGas.high).toBeUndefined()
24
- expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
25
- })
26
- it('matches expected output', () => {
27
- const result = transformGasFromEtherscan(sampleEtherscanGas)
28
- expect(result).toMatchObject({
29
- baseFee: 27.616_709_247,
30
- feePerGas: {
31
- low: 28,
32
- medium: 29,
33
- high: 30,
34
- veryHigh: 31,
35
- },
36
- priorityFeePerGas: {},
37
- })
38
- })
39
- })
@@ -1,44 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import {
4
- describe, expect, it,
5
- } from 'vitest'
6
-
7
- import { sampleEthgasstationGas } from '../../../test/index.ts'
8
- import { transformGasFromEthgasstation } from '../transformGasFromEthgasstation.ts'
9
-
10
- describe('transformGasFromEthgasstation', () => {
11
- it('returns values in the expected format', () => {
12
- const result = transformGasFromEthgasstation(sampleEthgasstationGas)
13
- expect(result).toBeObject()
14
- expect(result.baseFee).toBeNumber()
15
- expect(result.feePerGas).toBeObject()
16
- expect(result.feePerGas.low).toBeNumber()
17
- expect(result.feePerGas.medium).toBeNumber()
18
- expect(result.feePerGas.high).toBeNumber()
19
- expect(result.feePerGas.veryHigh).toBeNumber()
20
- expect(result.priorityFeePerGas).toBeObject()
21
- expect(result.priorityFeePerGas.low).toBeNumber()
22
- expect(result.priorityFeePerGas.medium).toBeNumber()
23
- expect(result.priorityFeePerGas.high).toBeNumber()
24
- expect(result.priorityFeePerGas.veryHigh).toBeNumber()
25
- })
26
- it('matches expected output', () => {
27
- const result = transformGasFromEthgasstation(sampleEthgasstationGas)
28
- expect(result).toMatchObject({
29
- baseFee: 10,
30
- feePerGas: {
31
- low: 11.33,
32
- medium: 12,
33
- high: 12,
34
- veryHigh: 13,
35
- },
36
- priorityFeePerGas: {
37
- low: 2,
38
- medium: 2,
39
- high: 2,
40
- veryHigh: 2,
41
- },
42
- })
43
- })
44
- })
@@ -1,100 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import { EthereumGasBlocknativeWitness, EthereumGasBlocknativeWitnessConfigSchema } from '@xyo-network/blocknative-ethereum-gas-plugin'
4
- import { EtherchainEthereumGasWitnessV2, EthereumGasEtherchainV2WitnessConfigSchema } from '@xyo-network/etherchain-gas-ethereum-blockchain-plugins'
5
- import { EthereumGasEthersWitness, EthereumGasEthersWitnessConfigSchema } from '@xyo-network/ethers-ethereum-gas-plugin'
6
- import { EthereumGasEtherscanWitness, EthereumGasEtherscanWitnessConfigSchema } from '@xyo-network/etherscan-ethereum-gas-plugin'
7
- import type { EthereumGasPayload } from '@xyo-network/gas-price-payload-plugin'
8
- import { EthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'
9
- import type { Payload } from '@xyo-network/payload-model'
10
- import { getProviderFromEnv } from '@xyo-network/witness-blockchain-abstract'
11
- import {
12
- describe, expect, test,
13
- } from 'vitest'
14
-
15
- import { EthereumGasDiviner } from '../Diviner.ts'
16
- import {
17
- sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas,
18
- } from '../test/index.ts'
19
-
20
- describe('Diviner', () => {
21
- const cases: [title: string, data: Payload[]][] = [
22
- ['EthereumGasBlocknativePayload', [sampleBlocknativeGas]],
23
- ['EthereumGasEtherchainV2Payload', [sampleEtherchainGasV2]],
24
- ['EthereumGasEtherscanPayload', [sampleEtherscanGas]],
25
- ['EthereumGasEthersPayload', [sampleEthersGas]],
26
- ['EthereumGasEthgasstationPayload', [sampleEthgasstationGas]],
27
- ['no gas payloads', []],
28
- ['all supported gas payloads', [sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas]],
29
- ]
30
- test.each(cases)('with %s returns divined gas price', async (_title: string, data: Payload[]) => {
31
- const diviner = await EthereumGasDiviner.create({ account: 'random' })
32
- const payloads = await diviner.divine(data)
33
- expect(payloads).toBeArray()
34
- expect(payloads.length).toBe(1)
35
- const gasPayload = payloads.pop() as EthereumGasPayload
36
- expect(gasPayload).toBeObject()
37
- expect(gasPayload.schema).toBe(EthereumGasSchema)
38
- expect(gasPayload.timestamp).toBeNumber()
39
- expect(gasPayload.feePerGas).toBeObject()
40
- expect(gasPayload.priorityFeePerGas).toBeObject()
41
- })
42
- test.skip('diviner calibration', async () => {
43
- const provider = getProviderFromEnv()
44
- // NOTE: This test is for obtaining concurrent witnessed
45
- // results for diviner weighting/calibration
46
- const blocknativeGas = (
47
- await (
48
- await EthereumGasBlocknativeWitness.create({
49
- account: 'random',
50
- config: { schema: EthereumGasBlocknativeWitnessConfigSchema },
51
- })
52
- ).observe()
53
- )?.[0]
54
- const etherchainGasV2 = (
55
- await (
56
- await EtherchainEthereumGasWitnessV2.create({
57
- account: 'random',
58
- config: { schema: EthereumGasEtherchainV2WitnessConfigSchema },
59
- })
60
- ).observe()
61
- )?.[0]
62
- const etherscanGas = (
63
- await (
64
- await EthereumGasEtherscanWitness.create({
65
- account: 'random',
66
- config: {
67
- apiKey: process.env.ETHERSCAN_API_KEY || '',
68
- schema: EthereumGasEtherscanWitnessConfigSchema,
69
- },
70
- })
71
- ).observe()
72
- )?.[0]
73
- const ethersGas = (
74
- await (
75
- await EthereumGasEthersWitness.create({
76
- account: 'random',
77
- config: { schema: EthereumGasEthersWitnessConfigSchema },
78
- provider,
79
- })
80
- ).observe()
81
- )?.[0]
82
-
83
- const observations: Payload[] = [blocknativeGas, etherchainGasV2, etherscanGas, ethersGas]
84
-
85
- const diviner = await EthereumGasDiviner.create({ account: 'random' })
86
-
87
- const payloads = await diviner.divine(observations)
88
-
89
- expect(payloads).toBeArray()
90
- expect(payloads.length).toBe(1)
91
- for (let payload of payloads) {
92
- if (payload?.schema === EthereumGasSchema) {
93
- const gasPayload = payload as EthereumGasPayload
94
- expect(gasPayload).toBeObject()
95
- expect(gasPayload.schema).toBe(EthereumGasSchema)
96
- expect(gasPayload.timestamp).toBeNumber()
97
- }
98
- }
99
- })
100
- })
@@ -1,17 +0,0 @@
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 { EthereumGasPlugin } from '../Plugin.ts'
10
-
11
- describe('CryptoMarketCoinGeckoPlugin', () => {
12
- test('Add to Resolver', async () => {
13
- const plugin = EthereumGasPlugin()
14
- const resolver = await new PayloadSetPluginResolver().register(plugin)
15
- expect(resolver.resolve(plugin.set)).toBeDefined()
16
- })
17
- })