@xyo-network/gas-price-plugin 2.47.9 → 2.47.10
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 +19 -19
- package/package.json +13 -13
- package/src/lib/identities/spec/isXyoEthereumGasBlocknativePayload.spec.ts +0 -29
- package/src/lib/identities/spec/isXyoEthereumGasEtherchainV2Payload.spec.ts +0 -29
- package/src/lib/identities/spec/isXyoEthereumGasEthersPayload.spec.ts +0 -29
- package/src/lib/identities/spec/isXyoEthereumGasEtherscanPayload.spec.ts +0 -29
- package/src/lib/identities/spec/isXyoEthereumGasEthgasstationPayload.spec.ts +0 -29
- package/src/lib/spec/average.spec.ts +0 -51
- package/src/lib/spec/divineGas.spec.ts +0 -55
- package/src/lib/transforms/spec/transformGasFromBlocknative.spec.ts +0 -39
- package/src/lib/transforms/spec/transformGasFromEtherchainV2.spec.ts +0 -34
- package/src/lib/transforms/spec/transformGasFromEthers.spec.ts +0 -33
- package/src/lib/transforms/spec/transformGasFromEtherscan.spec.ts +0 -34
- package/src/lib/transforms/spec/transformGasFromEthgasstation.spec.ts +0 -39
- package/src/spec/Diviner.spec.ts +0 -106
- package/src/spec/Plugin.spec.ts +0 -11
package/dist/docs.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/index.ts",
|
|
18
18
|
"line": 9,
|
|
19
19
|
"character": 0,
|
|
20
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
20
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/index.ts#L9"
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
"target": 1
|
|
@@ -1612,7 +1612,7 @@
|
|
|
1612
1612
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
1613
1613
|
"line": 13,
|
|
1614
1614
|
"character": 18,
|
|
1615
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
1615
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L13"
|
|
1616
1616
|
}
|
|
1617
1617
|
],
|
|
1618
1618
|
"type": {
|
|
@@ -1663,7 +1663,7 @@
|
|
|
1663
1663
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
1664
1664
|
"line": 14,
|
|
1665
1665
|
"character": 18,
|
|
1666
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
1666
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L14"
|
|
1667
1667
|
}
|
|
1668
1668
|
],
|
|
1669
1669
|
"type": {
|
|
@@ -3823,7 +3823,7 @@
|
|
|
3823
3823
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
3824
3824
|
"line": 20,
|
|
3825
3825
|
"character": 11,
|
|
3826
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
3826
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L20"
|
|
3827
3827
|
}
|
|
3828
3828
|
],
|
|
3829
3829
|
"signatures": [
|
|
@@ -6492,7 +6492,7 @@
|
|
|
6492
6492
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
6493
6493
|
"line": 16,
|
|
6494
6494
|
"character": 24,
|
|
6495
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
6495
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L16"
|
|
6496
6496
|
}
|
|
6497
6497
|
],
|
|
6498
6498
|
"signatures": [
|
|
@@ -6909,7 +6909,7 @@
|
|
|
6909
6909
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
6910
6910
|
"line": 12,
|
|
6911
6911
|
"character": 13,
|
|
6912
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
6912
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L12"
|
|
6913
6913
|
}
|
|
6914
6914
|
],
|
|
6915
6915
|
"extendedTypes": [
|
|
@@ -6936,7 +6936,7 @@
|
|
|
6936
6936
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
6937
6937
|
"line": 10,
|
|
6938
6938
|
"character": 12,
|
|
6939
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
6939
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L10"
|
|
6940
6940
|
}
|
|
6941
6941
|
],
|
|
6942
6942
|
"type": {
|
|
@@ -6962,7 +6962,7 @@
|
|
|
6962
6962
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
6963
6963
|
"line": 10,
|
|
6964
6964
|
"character": 58,
|
|
6965
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
6965
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L10"
|
|
6966
6966
|
}
|
|
6967
6967
|
],
|
|
6968
6968
|
"type": {
|
|
@@ -6985,7 +6985,7 @@
|
|
|
6985
6985
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts",
|
|
6986
6986
|
"line": 10,
|
|
6987
6987
|
"character": 56,
|
|
6988
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
6988
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Diviner.ts#L10"
|
|
6989
6989
|
}
|
|
6990
6990
|
]
|
|
6991
6991
|
}
|
|
@@ -7005,13 +7005,13 @@
|
|
|
7005
7005
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7006
7006
|
"line": 4,
|
|
7007
7007
|
"character": 12,
|
|
7008
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7008
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L4"
|
|
7009
7009
|
},
|
|
7010
7010
|
{
|
|
7011
7011
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7012
7012
|
"line": 5,
|
|
7013
7013
|
"character": 13,
|
|
7014
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7014
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L5"
|
|
7015
7015
|
}
|
|
7016
7016
|
],
|
|
7017
7017
|
"type": {
|
|
@@ -7030,13 +7030,13 @@
|
|
|
7030
7030
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7031
7031
|
"line": 1,
|
|
7032
7032
|
"character": 12,
|
|
7033
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7033
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L1"
|
|
7034
7034
|
},
|
|
7035
7035
|
{
|
|
7036
7036
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7037
7037
|
"line": 2,
|
|
7038
7038
|
"character": 13,
|
|
7039
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7039
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L2"
|
|
7040
7040
|
}
|
|
7041
7041
|
],
|
|
7042
7042
|
"type": {
|
|
@@ -7055,13 +7055,13 @@
|
|
|
7055
7055
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7056
7056
|
"line": 4,
|
|
7057
7057
|
"character": 12,
|
|
7058
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7058
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L4"
|
|
7059
7059
|
},
|
|
7060
7060
|
{
|
|
7061
7061
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7062
7062
|
"line": 5,
|
|
7063
7063
|
"character": 13,
|
|
7064
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7064
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L5"
|
|
7065
7065
|
}
|
|
7066
7066
|
],
|
|
7067
7067
|
"type": {
|
|
@@ -7080,13 +7080,13 @@
|
|
|
7080
7080
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7081
7081
|
"line": 1,
|
|
7082
7082
|
"character": 12,
|
|
7083
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7083
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L1"
|
|
7084
7084
|
},
|
|
7085
7085
|
{
|
|
7086
7086
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts",
|
|
7087
7087
|
"line": 2,
|
|
7088
7088
|
"character": 13,
|
|
7089
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7089
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Schema.ts#L2"
|
|
7090
7090
|
}
|
|
7091
7091
|
],
|
|
7092
7092
|
"type": {
|
|
@@ -7105,7 +7105,7 @@
|
|
|
7105
7105
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Plugin.ts",
|
|
7106
7106
|
"line": 8,
|
|
7107
7107
|
"character": 13,
|
|
7108
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7108
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/Plugin.ts#L8"
|
|
7109
7109
|
}
|
|
7110
7110
|
],
|
|
7111
7111
|
"signatures": [
|
|
@@ -7477,7 +7477,7 @@
|
|
|
7477
7477
|
"fileName": "plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/index.ts",
|
|
7478
7478
|
"line": 1,
|
|
7479
7479
|
"character": 0,
|
|
7480
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
7480
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/e042f7772ec/packages/plugins/packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/src/index.ts#L1"
|
|
7481
7481
|
}
|
|
7482
7482
|
]
|
|
7483
7483
|
}
|
package/package.json
CHANGED
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@xylabs/exists": "^2.7.1",
|
|
14
|
-
"@xyo-network/blocknative-ethereum-gas-payload-plugin": "^2.47.
|
|
15
|
-
"@xyo-network/diviner": "^2.47.
|
|
16
|
-
"@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins": "^2.47.
|
|
17
|
-
"@xyo-network/ethers-ethereum-gas-payload-plugin": "^2.47.
|
|
18
|
-
"@xyo-network/etherscan-ethereum-gas-payload-plugin": "^2.47.
|
|
19
|
-
"@xyo-network/ethgasstation-ethereum-gas-payload-plugin": "^2.47.
|
|
20
|
-
"@xyo-network/gas-price-payload-plugin": "^2.47.
|
|
21
|
-
"@xyo-network/module": "^2.47.
|
|
22
|
-
"@xyo-network/payload-builder": "^2.47.
|
|
23
|
-
"@xyo-network/payload-model": "^2.47.
|
|
24
|
-
"@xyo-network/payloadset-plugin": "^2.47.
|
|
25
|
-
"@xyo-network/promise": "^2.47.
|
|
14
|
+
"@xyo-network/blocknative-ethereum-gas-payload-plugin": "^2.47.10",
|
|
15
|
+
"@xyo-network/diviner": "^2.47.10",
|
|
16
|
+
"@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins": "^2.47.10",
|
|
17
|
+
"@xyo-network/ethers-ethereum-gas-payload-plugin": "^2.47.10",
|
|
18
|
+
"@xyo-network/etherscan-ethereum-gas-payload-plugin": "^2.47.10",
|
|
19
|
+
"@xyo-network/ethgasstation-ethereum-gas-payload-plugin": "^2.47.10",
|
|
20
|
+
"@xyo-network/gas-price-payload-plugin": "^2.47.10",
|
|
21
|
+
"@xyo-network/module": "^2.47.10",
|
|
22
|
+
"@xyo-network/payload-builder": "^2.47.10",
|
|
23
|
+
"@xyo-network/payload-model": "^2.47.10",
|
|
24
|
+
"@xyo-network/payloadset-plugin": "^2.47.10",
|
|
25
|
+
"@xyo-network/promise": "^2.47.10",
|
|
26
26
|
"regression": "^2.0.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
},
|
|
83
83
|
"sideEffects": false,
|
|
84
84
|
"types": "dist/types/index.d.ts",
|
|
85
|
-
"version": "2.47.
|
|
85
|
+
"version": "2.47.10"
|
|
86
86
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { sampleBlocknativeGas } from '../../../test'
|
|
2
|
-
import { isXyoEthereumGasBlocknativePayload } from '../isXyoEthereumGasBlocknativePayload'
|
|
3
|
-
|
|
4
|
-
describe('isXyoEthereumGasBlocknativePayload', () => {
|
|
5
|
-
describe('returns true', () => {
|
|
6
|
-
it('when payload schema is XyoEthereumGasBlocknativeSchema', () => {
|
|
7
|
-
const result = isXyoEthereumGasBlocknativePayload(sampleBlocknativeGas)
|
|
8
|
-
expect(result).toBeTrue()
|
|
9
|
-
})
|
|
10
|
-
})
|
|
11
|
-
describe('returns false', () => {
|
|
12
|
-
it('when payload schema is not XyoEthereumGasBlocknativeSchema', () => {
|
|
13
|
-
const result = isXyoEthereumGasBlocknativePayload({ schema: 'network.xyo.debug' })
|
|
14
|
-
expect(result).toBeFalse()
|
|
15
|
-
})
|
|
16
|
-
it('when payload is missing', () => {
|
|
17
|
-
const result = isXyoEthereumGasBlocknativePayload()
|
|
18
|
-
expect(result).toBeFalse()
|
|
19
|
-
})
|
|
20
|
-
it('when payload is undefined', () => {
|
|
21
|
-
const result = isXyoEthereumGasBlocknativePayload(undefined)
|
|
22
|
-
expect(result).toBeFalse()
|
|
23
|
-
})
|
|
24
|
-
it('when payload is null', () => {
|
|
25
|
-
const result = isXyoEthereumGasBlocknativePayload(null)
|
|
26
|
-
expect(result).toBeFalse()
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { sampleEtherchainGasV2 } from '../../../test'
|
|
2
|
-
import { isXyoEthereumGasEtherchainV2Payload } from '../isXyoEthereumGasEtherchainV2Payload'
|
|
3
|
-
|
|
4
|
-
describe('isXyoEthereumGasEtherchainV2Payload', () => {
|
|
5
|
-
describe('returns true', () => {
|
|
6
|
-
it('when payload schema is XyoEthereumGasEtherchainV2Schema', () => {
|
|
7
|
-
const result = isXyoEthereumGasEtherchainV2Payload(sampleEtherchainGasV2)
|
|
8
|
-
expect(result).toBeTrue()
|
|
9
|
-
})
|
|
10
|
-
})
|
|
11
|
-
describe('returns false', () => {
|
|
12
|
-
it('when payload schema is not XyoEthereumGasEtherscanSchema', () => {
|
|
13
|
-
const result = isXyoEthereumGasEtherchainV2Payload({ schema: 'network.xyo.debug' })
|
|
14
|
-
expect(result).toBeFalse()
|
|
15
|
-
})
|
|
16
|
-
it('when payload is missing', () => {
|
|
17
|
-
const result = isXyoEthereumGasEtherchainV2Payload()
|
|
18
|
-
expect(result).toBeFalse()
|
|
19
|
-
})
|
|
20
|
-
it('when payload is undefined', () => {
|
|
21
|
-
const result = isXyoEthereumGasEtherchainV2Payload(undefined)
|
|
22
|
-
expect(result).toBeFalse()
|
|
23
|
-
})
|
|
24
|
-
it('when payload is null', () => {
|
|
25
|
-
const result = isXyoEthereumGasEtherchainV2Payload(null)
|
|
26
|
-
expect(result).toBeFalse()
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { sampleEthersGas } from '../../../test'
|
|
2
|
-
import { isXyoEthereumGasEthersPayload } from '../isXyoEthereumGasEthersPayload'
|
|
3
|
-
|
|
4
|
-
describe('isXyoEthereumGasEthersPayload', () => {
|
|
5
|
-
describe('returns true', () => {
|
|
6
|
-
it('when payload schema is XyoEthereumGasEthersSchema', () => {
|
|
7
|
-
const result = isXyoEthereumGasEthersPayload(sampleEthersGas)
|
|
8
|
-
expect(result).toBeTrue()
|
|
9
|
-
})
|
|
10
|
-
})
|
|
11
|
-
describe('returns false', () => {
|
|
12
|
-
it('when payload schema is not XyoEthereumGasEthersSchema', () => {
|
|
13
|
-
const result = isXyoEthereumGasEthersPayload({ schema: 'network.xyo.debug' })
|
|
14
|
-
expect(result).toBeFalse()
|
|
15
|
-
})
|
|
16
|
-
it('when payload is missing', () => {
|
|
17
|
-
const result = isXyoEthereumGasEthersPayload()
|
|
18
|
-
expect(result).toBeFalse()
|
|
19
|
-
})
|
|
20
|
-
it('when payload is undefined', () => {
|
|
21
|
-
const result = isXyoEthereumGasEthersPayload(undefined)
|
|
22
|
-
expect(result).toBeFalse()
|
|
23
|
-
})
|
|
24
|
-
it('when payload is null', () => {
|
|
25
|
-
const result = isXyoEthereumGasEthersPayload(null)
|
|
26
|
-
expect(result).toBeFalse()
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { sampleEtherscanGas } from '../../../test'
|
|
2
|
-
import { isXyoEthereumGasEtherscanPayload } from '../isXyoEthereumGasEtherscanPayload'
|
|
3
|
-
|
|
4
|
-
describe('isXyoEthereumGasEtherscanPayload', () => {
|
|
5
|
-
describe('returns true', () => {
|
|
6
|
-
it('when payload schema is XyoEthereumGasEtherscanSchema', () => {
|
|
7
|
-
const result = isXyoEthereumGasEtherscanPayload(sampleEtherscanGas)
|
|
8
|
-
expect(result).toBeTrue()
|
|
9
|
-
})
|
|
10
|
-
})
|
|
11
|
-
describe('returns false', () => {
|
|
12
|
-
it('when payload schema is not XyoEthereumGasEtherscanSchema', () => {
|
|
13
|
-
const result = isXyoEthereumGasEtherscanPayload({ schema: 'network.xyo.debug' })
|
|
14
|
-
expect(result).toBeFalse()
|
|
15
|
-
})
|
|
16
|
-
it('when payload is missing', () => {
|
|
17
|
-
const result = isXyoEthereumGasEtherscanPayload()
|
|
18
|
-
expect(result).toBeFalse()
|
|
19
|
-
})
|
|
20
|
-
it('when payload is undefined', () => {
|
|
21
|
-
const result = isXyoEthereumGasEtherscanPayload(undefined)
|
|
22
|
-
expect(result).toBeFalse()
|
|
23
|
-
})
|
|
24
|
-
it('when payload is null', () => {
|
|
25
|
-
const result = isXyoEthereumGasEtherscanPayload(null)
|
|
26
|
-
expect(result).toBeFalse()
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { sampleEthgasstationGas } from '../../../test'
|
|
2
|
-
import { isXyoEthereumGasEthgasstationPayload } from '../isXyoEthereumGasEthgasstationPayload'
|
|
3
|
-
|
|
4
|
-
describe('isXyoEthereumGasEthgasstationPayload', () => {
|
|
5
|
-
describe('returns true', () => {
|
|
6
|
-
it('when payload schema is XyoEthereumGasEthgasstationSchema', () => {
|
|
7
|
-
const result = isXyoEthereumGasEthgasstationPayload(sampleEthgasstationGas)
|
|
8
|
-
expect(result).toBeTrue()
|
|
9
|
-
})
|
|
10
|
-
})
|
|
11
|
-
describe('returns false', () => {
|
|
12
|
-
it('when payload schema is not XyoEthereumGasEthgasstationSchema', () => {
|
|
13
|
-
const result = isXyoEthereumGasEthgasstationPayload({ schema: 'network.xyo.debug' })
|
|
14
|
-
expect(result).toBeFalse()
|
|
15
|
-
})
|
|
16
|
-
it('when payload is missing', () => {
|
|
17
|
-
const result = isXyoEthereumGasEthgasstationPayload()
|
|
18
|
-
expect(result).toBeFalse()
|
|
19
|
-
})
|
|
20
|
-
it('when payload is undefined', () => {
|
|
21
|
-
const result = isXyoEthereumGasEthgasstationPayload(undefined)
|
|
22
|
-
expect(result).toBeFalse()
|
|
23
|
-
})
|
|
24
|
-
it('when payload is null', () => {
|
|
25
|
-
const result = isXyoEthereumGasEthgasstationPayload(null)
|
|
26
|
-
expect(result).toBeFalse()
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
})
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { FeeData } from '@xyo-network/gas-price-payload-plugin'
|
|
2
|
-
|
|
3
|
-
import { sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthgasstationGas } from '../../test'
|
|
4
|
-
import { average } from '../average'
|
|
5
|
-
import { transformGasFromBlocknative, transformGasFromEtherchainV2, transformGasFromEtherscan, transformGasFromEthgasstation } from '../transforms'
|
|
6
|
-
|
|
7
|
-
const results: FeeData[] = [
|
|
8
|
-
transformGasFromBlocknative(sampleBlocknativeGas),
|
|
9
|
-
transformGasFromEtherchainV2(sampleEtherchainGasV2),
|
|
10
|
-
transformGasFromEtherscan(sampleEtherscanGas),
|
|
11
|
-
transformGasFromEthgasstation(sampleEthgasstationGas),
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
describe('average', () => {
|
|
15
|
-
it('averages payloads', () => {
|
|
16
|
-
const payloads = results
|
|
17
|
-
const result = average(payloads)
|
|
18
|
-
expect(result).toBeObject()
|
|
19
|
-
expect(result.baseFee).toBeNumber()
|
|
20
|
-
expect(result.feePerGas).toBeObject()
|
|
21
|
-
expect(result.feePerGas.low).toBeNumber()
|
|
22
|
-
expect(result.feePerGas.medium).toBeNumber()
|
|
23
|
-
expect(result.feePerGas.high).toBeNumber()
|
|
24
|
-
expect(result.feePerGas.veryHigh).toBeNumber()
|
|
25
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
26
|
-
expect(result.priorityFeePerGas.low).toBeNumber()
|
|
27
|
-
expect(result.priorityFeePerGas.medium).toBeNumber()
|
|
28
|
-
expect(result.priorityFeePerGas.high).toBeNumber()
|
|
29
|
-
expect(result.priorityFeePerGas.veryHigh).toBeNumber()
|
|
30
|
-
})
|
|
31
|
-
it('handles single payload', () => {
|
|
32
|
-
const payloads = [results[0]]
|
|
33
|
-
const result = average(payloads)
|
|
34
|
-
expect(result).toBeObject()
|
|
35
|
-
})
|
|
36
|
-
it('handles no values', () => {
|
|
37
|
-
const result = average()
|
|
38
|
-
expect(result).toBeObject()
|
|
39
|
-
expect(result.baseFee).toBeUndefined()
|
|
40
|
-
expect(result.feePerGas).toBeObject()
|
|
41
|
-
expect(result.feePerGas.low).toBeUndefined()
|
|
42
|
-
expect(result.feePerGas.medium).toBeUndefined()
|
|
43
|
-
expect(result.feePerGas.high).toBeUndefined()
|
|
44
|
-
expect(result.feePerGas.veryHigh).toBeUndefined()
|
|
45
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
46
|
-
expect(result.priorityFeePerGas.low).toBeUndefined()
|
|
47
|
-
expect(result.priorityFeePerGas.medium).toBeUndefined()
|
|
48
|
-
expect(result.priorityFeePerGas.high).toBeUndefined()
|
|
49
|
-
expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
|
|
50
|
-
})
|
|
51
|
-
})
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas } from '../../test'
|
|
2
|
-
import { divineGas } from '../divineGas'
|
|
3
|
-
|
|
4
|
-
describe('divineGas', () => {
|
|
5
|
-
describe('with no payloads supplied', () => {
|
|
6
|
-
it('divines gas', () => {
|
|
7
|
-
const result = divineGas([])
|
|
8
|
-
expect(result).toBeObject()
|
|
9
|
-
expect(result.timestamp).toBeNumber()
|
|
10
|
-
})
|
|
11
|
-
})
|
|
12
|
-
describe('with sparse payloads supplied', () => {
|
|
13
|
-
it.each([[sampleEtherscanGas], [sampleEtherchainGasV2], [sampleEtherchainGasV2, sampleEtherscanGas]])('divines gas', (...payloads) => {
|
|
14
|
-
const result = divineGas(payloads)
|
|
15
|
-
expect(result).toBeObject()
|
|
16
|
-
expect(result.timestamp).toBeNumber()
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
describe('with one of each supported payload supplied', () => {
|
|
20
|
-
it('divines gas', () => {
|
|
21
|
-
const result = divineGas([sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas])
|
|
22
|
-
expect(result).toBeObject()
|
|
23
|
-
expect(result.baseFee).toBeNumber()
|
|
24
|
-
expect(result.feePerGas).toBeObject()
|
|
25
|
-
expect(result.feePerGas.low).toBeNumber()
|
|
26
|
-
expect(result.feePerGas.medium).toBeNumber()
|
|
27
|
-
expect(result.feePerGas.high).toBeNumber()
|
|
28
|
-
expect(result.feePerGas.veryHigh).toBeNumber()
|
|
29
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
30
|
-
expect(result.priorityFeePerGas.low).toBeNumber()
|
|
31
|
-
expect(result.priorityFeePerGas.medium).toBeNumber()
|
|
32
|
-
expect(result.priorityFeePerGas.high).toBeNumber()
|
|
33
|
-
expect(result.priorityFeePerGas.veryHigh).toBeNumber()
|
|
34
|
-
expect(result.timestamp).toBeNumber()
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
describe('with multiple of each supported payload supplied', () => {
|
|
38
|
-
it('divines gas', () => {
|
|
39
|
-
const result = divineGas([
|
|
40
|
-
sampleBlocknativeGas,
|
|
41
|
-
sampleBlocknativeGas,
|
|
42
|
-
sampleEtherchainGasV2,
|
|
43
|
-
sampleEtherchainGasV2,
|
|
44
|
-
sampleEtherscanGas,
|
|
45
|
-
sampleEtherscanGas,
|
|
46
|
-
sampleEthersGas,
|
|
47
|
-
sampleEthersGas,
|
|
48
|
-
sampleEthgasstationGas,
|
|
49
|
-
sampleEthgasstationGas,
|
|
50
|
-
])
|
|
51
|
-
expect(result).toBeObject()
|
|
52
|
-
expect(result.timestamp).toBeNumber()
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
})
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
2
|
-
import { sampleBlocknativeGas } from '../../../test'
|
|
3
|
-
import { transformGasFromBlocknative } from '../transformGasFromBlocknative'
|
|
4
|
-
|
|
5
|
-
describe('transformGasFromEtherscan', () => {
|
|
6
|
-
it('returns values in the expected format', () => {
|
|
7
|
-
const result = transformGasFromBlocknative(sampleBlocknativeGas)
|
|
8
|
-
expect(result).toBeObject()
|
|
9
|
-
expect(result.baseFee).toBeNumber()
|
|
10
|
-
expect(result.feePerGas).toBeObject()
|
|
11
|
-
expect(result.feePerGas.low).toBeNumber()
|
|
12
|
-
expect(result.feePerGas.medium).toBeNumber()
|
|
13
|
-
expect(result.feePerGas.high).toBeNumber()
|
|
14
|
-
expect(result.feePerGas.veryHigh).toBeNumber()
|
|
15
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
16
|
-
expect(result.priorityFeePerGas.low).toBeNumber()
|
|
17
|
-
expect(result.priorityFeePerGas.medium).toBeNumber()
|
|
18
|
-
expect(result.priorityFeePerGas.high).toBeNumber()
|
|
19
|
-
expect(result.priorityFeePerGas.veryHigh).toBeNumber()
|
|
20
|
-
})
|
|
21
|
-
it('matches expected output', () => {
|
|
22
|
-
const result = transformGasFromBlocknative(sampleBlocknativeGas)
|
|
23
|
-
expect(result).toMatchObject({
|
|
24
|
-
baseFee: 13.691764456,
|
|
25
|
-
feePerGas: {
|
|
26
|
-
low: 12.95,
|
|
27
|
-
medium: 13.25,
|
|
28
|
-
high: 13.55,
|
|
29
|
-
veryHigh: 13.85,
|
|
30
|
-
},
|
|
31
|
-
priorityFeePerGas: {
|
|
32
|
-
low: 0.14,
|
|
33
|
-
medium: 0.37,
|
|
34
|
-
high: 0.6,
|
|
35
|
-
veryHigh: 0.83,
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
2
|
-
import { sampleEtherchainGasV2 } from '../../../test'
|
|
3
|
-
import { transformGasFromEtherchainV2 } from '../transformGasFromEtherchainV2'
|
|
4
|
-
|
|
5
|
-
describe('transformGasFromEtherchainV2', () => {
|
|
6
|
-
it('returns values in the expected format', () => {
|
|
7
|
-
const result = transformGasFromEtherchainV2(sampleEtherchainGasV2)
|
|
8
|
-
expect(result).toBeObject()
|
|
9
|
-
expect(result.baseFee).toBeUndefined()
|
|
10
|
-
expect(result.feePerGas).toBeObject()
|
|
11
|
-
expect(result.feePerGas.low).toBeNumber()
|
|
12
|
-
expect(result.feePerGas.medium).toBeNumber()
|
|
13
|
-
expect(result.feePerGas.high).toBeNumber()
|
|
14
|
-
expect(result.feePerGas.veryHigh).toBeNumber()
|
|
15
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
16
|
-
expect(result.priorityFeePerGas.low).toBeUndefined()
|
|
17
|
-
expect(result.priorityFeePerGas.medium).toBeUndefined()
|
|
18
|
-
expect(result.priorityFeePerGas.high).toBeUndefined()
|
|
19
|
-
expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
|
|
20
|
-
})
|
|
21
|
-
it('matches expected output', () => {
|
|
22
|
-
const result = transformGasFromEtherchainV2(sampleEtherchainGasV2)
|
|
23
|
-
expect(result).toMatchObject({
|
|
24
|
-
baseFee: undefined,
|
|
25
|
-
feePerGas: {
|
|
26
|
-
low: 11.2,
|
|
27
|
-
medium: 12.0,
|
|
28
|
-
high: 19.80304733,
|
|
29
|
-
veryHigh: 29.71428617,
|
|
30
|
-
},
|
|
31
|
-
priorityFeePerGas: {},
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
})
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
2
|
-
import { sampleEthersGas } from '../../../test'
|
|
3
|
-
import { transformGasFromEthers } from '../transformGasFromEthers'
|
|
4
|
-
|
|
5
|
-
describe('transformGasFromEthers', () => {
|
|
6
|
-
it('returns values in the expected format', () => {
|
|
7
|
-
const result = transformGasFromEthers(sampleEthersGas)
|
|
8
|
-
expect(result).toBeObject()
|
|
9
|
-
expect(result.baseFee).toBeNumber()
|
|
10
|
-
expect(result.feePerGas).toBeObject()
|
|
11
|
-
expect(result.feePerGas.low).toBeUndefined()
|
|
12
|
-
expect(result.feePerGas.medium).toBeUndefined()
|
|
13
|
-
expect(result.feePerGas.high).toBeNumber()
|
|
14
|
-
expect(result.feePerGas.veryHigh).toBeUndefined()
|
|
15
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
16
|
-
expect(result.priorityFeePerGas.low).toBeUndefined()
|
|
17
|
-
expect(result.priorityFeePerGas.medium).toBeUndefined()
|
|
18
|
-
expect(result.priorityFeePerGas.high).toBeNumber()
|
|
19
|
-
expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
|
|
20
|
-
})
|
|
21
|
-
it('matches expected output', () => {
|
|
22
|
-
const result = transformGasFromEthers(sampleEthersGas)
|
|
23
|
-
expect(result).toMatchObject({
|
|
24
|
-
baseFee: 13.447862081,
|
|
25
|
-
feePerGas: {
|
|
26
|
-
high: 28.395724162,
|
|
27
|
-
},
|
|
28
|
-
priorityFeePerGas: {
|
|
29
|
-
high: 1.5,
|
|
30
|
-
},
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
2
|
-
import { sampleEtherscanGas } from '../../../test'
|
|
3
|
-
import { transformGasFromEtherscan } from '../transformGasFromEtherscan'
|
|
4
|
-
|
|
5
|
-
describe('transformGasFromEtherscan', () => {
|
|
6
|
-
it('returns values in the expected format', () => {
|
|
7
|
-
const result = transformGasFromEtherscan(sampleEtherscanGas)
|
|
8
|
-
expect(result).toBeObject()
|
|
9
|
-
expect(result.baseFee).toBeNumber()
|
|
10
|
-
expect(result.feePerGas).toBeObject()
|
|
11
|
-
expect(result.feePerGas.low).toBeNumber()
|
|
12
|
-
expect(result.feePerGas.medium).toBeNumber()
|
|
13
|
-
expect(result.feePerGas.high).toBeNumber()
|
|
14
|
-
expect(result.feePerGas.veryHigh).toBeNumber()
|
|
15
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
16
|
-
expect(result.priorityFeePerGas.low).toBeUndefined()
|
|
17
|
-
expect(result.priorityFeePerGas.medium).toBeUndefined()
|
|
18
|
-
expect(result.priorityFeePerGas.high).toBeUndefined()
|
|
19
|
-
expect(result.priorityFeePerGas.veryHigh).toBeUndefined()
|
|
20
|
-
})
|
|
21
|
-
it('matches expected output', () => {
|
|
22
|
-
const result = transformGasFromEtherscan(sampleEtherscanGas)
|
|
23
|
-
expect(result).toMatchObject({
|
|
24
|
-
baseFee: 27.616709247,
|
|
25
|
-
feePerGas: {
|
|
26
|
-
low: 28,
|
|
27
|
-
medium: 29,
|
|
28
|
-
high: 30,
|
|
29
|
-
veryHigh: 31,
|
|
30
|
-
},
|
|
31
|
-
priorityFeePerGas: {},
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
})
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
2
|
-
import { sampleEthgasstationGas } from '../../../test'
|
|
3
|
-
import { transformGasFromEthgasstation } from '../transformGasFromEthgasstation'
|
|
4
|
-
|
|
5
|
-
describe('transformGasFromEthgasstation', () => {
|
|
6
|
-
it('returns values in the expected format', () => {
|
|
7
|
-
const result = transformGasFromEthgasstation(sampleEthgasstationGas)
|
|
8
|
-
expect(result).toBeObject()
|
|
9
|
-
expect(result.baseFee).toBeNumber()
|
|
10
|
-
expect(result.feePerGas).toBeObject()
|
|
11
|
-
expect(result.feePerGas.low).toBeNumber()
|
|
12
|
-
expect(result.feePerGas.medium).toBeNumber()
|
|
13
|
-
expect(result.feePerGas.high).toBeNumber()
|
|
14
|
-
expect(result.feePerGas.veryHigh).toBeNumber()
|
|
15
|
-
expect(result.priorityFeePerGas).toBeObject()
|
|
16
|
-
expect(result.priorityFeePerGas.low).toBeNumber()
|
|
17
|
-
expect(result.priorityFeePerGas.medium).toBeNumber()
|
|
18
|
-
expect(result.priorityFeePerGas.high).toBeNumber()
|
|
19
|
-
expect(result.priorityFeePerGas.veryHigh).toBeNumber()
|
|
20
|
-
})
|
|
21
|
-
it('matches expected output', () => {
|
|
22
|
-
const result = transformGasFromEthgasstation(sampleEthgasstationGas)
|
|
23
|
-
expect(result).toMatchObject({
|
|
24
|
-
baseFee: 10,
|
|
25
|
-
feePerGas: {
|
|
26
|
-
low: 11.33,
|
|
27
|
-
medium: 12,
|
|
28
|
-
high: 12,
|
|
29
|
-
veryHigh: 13,
|
|
30
|
-
},
|
|
31
|
-
priorityFeePerGas: {
|
|
32
|
-
low: 2,
|
|
33
|
-
medium: 2,
|
|
34
|
-
high: 2,
|
|
35
|
-
veryHigh: 2,
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
package/src/spec/Diviner.spec.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { InfuraProvider } from '@ethersproject/providers'
|
|
2
|
-
import { XyoEthereumGasBlocknativeWitness, XyoEthereumGasBlocknativeWitnessConfigSchema } from '@xyo-network/blocknative-ethereum-gas-plugin'
|
|
3
|
-
import { DivinerWrapper } from '@xyo-network/diviner-wrapper'
|
|
4
|
-
import {
|
|
5
|
-
XyoEtherchainEthereumGasWitnessV2,
|
|
6
|
-
XyoEthereumGasEtherchainV2WitnessConfigSchema,
|
|
7
|
-
} from '@xyo-network/etherchain-gas-ethereum-blockchain-plugins'
|
|
8
|
-
import { XyoEthereumGasEthersWitness, XyoEthereumGasEthersWitnessConfigSchema } from '@xyo-network/ethers-ethereum-gas-plugin'
|
|
9
|
-
import { XyoEthereumGasEtherscanWitness, XyoEthereumGasEtherscanWitnessConfigSchema } from '@xyo-network/etherscan-ethereum-gas-plugin'
|
|
10
|
-
import { XyoEthereumGasEthgasstationWitness, XyoEthereumGasEthgasstationWitnessConfigSchema } from '@xyo-network/ethgasstation-ethereum-gas-plugin'
|
|
11
|
-
import { XyoEthereumGasPayload, XyoEthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'
|
|
12
|
-
import { XyoPayload } from '@xyo-network/payload-model'
|
|
13
|
-
|
|
14
|
-
import { XyoEthereumGasDiviner } from '../Diviner'
|
|
15
|
-
import { sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas } from '../test'
|
|
16
|
-
|
|
17
|
-
describe('Diviner', () => {
|
|
18
|
-
test('returns divined gas price', async () => {
|
|
19
|
-
const module = await XyoEthereumGasDiviner.create()
|
|
20
|
-
const wrapper = new DivinerWrapper(module)
|
|
21
|
-
|
|
22
|
-
const payloads = await wrapper.divine([sampleBlocknativeGas, sampleEtherchainGasV2, sampleEtherscanGas, sampleEthersGas, sampleEthgasstationGas])
|
|
23
|
-
|
|
24
|
-
expect(payloads).toBeArray()
|
|
25
|
-
expect(payloads.length).toBe(1)
|
|
26
|
-
payloads.map((payload) => {
|
|
27
|
-
if (payload?.schema === XyoEthereumGasSchema) {
|
|
28
|
-
const gasPayload = payload as XyoEthereumGasPayload
|
|
29
|
-
expect(gasPayload).toBeObject()
|
|
30
|
-
expect(gasPayload.schema).toBe(XyoEthereumGasSchema)
|
|
31
|
-
expect(gasPayload.timestamp).toBeNumber()
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
test.skip('diviner calibration', async () => {
|
|
36
|
-
// NOTE: This test is for obtaining concurrent witnessed
|
|
37
|
-
// results for diviner weighting/calibration
|
|
38
|
-
const blocknativeGas = (
|
|
39
|
-
await (
|
|
40
|
-
await XyoEthereumGasBlocknativeWitness.create({
|
|
41
|
-
config: {
|
|
42
|
-
schema: XyoEthereumGasBlocknativeWitnessConfigSchema,
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
).observe()
|
|
46
|
-
)?.[0]
|
|
47
|
-
const etherchainGasV2 = (
|
|
48
|
-
await (
|
|
49
|
-
await XyoEtherchainEthereumGasWitnessV2.create({
|
|
50
|
-
config: {
|
|
51
|
-
schema: XyoEthereumGasEtherchainV2WitnessConfigSchema,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
).observe()
|
|
55
|
-
)?.[0]
|
|
56
|
-
const etherscanGas = (
|
|
57
|
-
await (
|
|
58
|
-
await XyoEthereumGasEtherscanWitness.create({
|
|
59
|
-
config: {
|
|
60
|
-
apiKey: process.env.ETHERSCAN_API_KEY || '',
|
|
61
|
-
schema: XyoEthereumGasEtherscanWitnessConfigSchema,
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
).observe()
|
|
65
|
-
)?.[0]
|
|
66
|
-
const ethersGas = (
|
|
67
|
-
await (
|
|
68
|
-
await XyoEthereumGasEthersWitness.create({
|
|
69
|
-
config: {
|
|
70
|
-
schema: XyoEthereumGasEthersWitnessConfigSchema,
|
|
71
|
-
},
|
|
72
|
-
provider: new InfuraProvider('homestead', {
|
|
73
|
-
projectId: process.env.INFURA_PROJECT_ID,
|
|
74
|
-
projectSecret: process.env.INFURA_PROJECT_SECRET,
|
|
75
|
-
}),
|
|
76
|
-
})
|
|
77
|
-
).observe()
|
|
78
|
-
)?.[0]
|
|
79
|
-
const ethgasstationGas = (
|
|
80
|
-
await (
|
|
81
|
-
await XyoEthereumGasEthgasstationWitness.create({
|
|
82
|
-
config: {
|
|
83
|
-
schema: XyoEthereumGasEthgasstationWitnessConfigSchema,
|
|
84
|
-
},
|
|
85
|
-
})
|
|
86
|
-
).observe()
|
|
87
|
-
)?.[0]
|
|
88
|
-
const observations: XyoPayload[] = [blocknativeGas, etherchainGasV2, etherscanGas, ethersGas, ethgasstationGas]
|
|
89
|
-
|
|
90
|
-
const module = await XyoEthereumGasDiviner.create()
|
|
91
|
-
const wrapper = new DivinerWrapper(module)
|
|
92
|
-
|
|
93
|
-
const payloads = await wrapper.divine(observations)
|
|
94
|
-
|
|
95
|
-
expect(payloads).toBeArray()
|
|
96
|
-
expect(payloads.length).toBe(1)
|
|
97
|
-
payloads.map((payload) => {
|
|
98
|
-
if (payload?.schema === XyoEthereumGasSchema) {
|
|
99
|
-
const gasPayload = payload as XyoEthereumGasPayload
|
|
100
|
-
expect(gasPayload).toBeObject()
|
|
101
|
-
expect(gasPayload.schema).toBe(XyoEthereumGasSchema)
|
|
102
|
-
expect(gasPayload.timestamp).toBeNumber()
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
})
|
package/src/spec/Plugin.spec.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PayloadSetPluginResolver } from '@xyo-network/payloadset-plugin'
|
|
2
|
-
|
|
3
|
-
import { XyoEthereumGasPlugin } from '../Plugin'
|
|
4
|
-
|
|
5
|
-
describe('XyoCryptoMarketCoinGeckoPlugin', () => {
|
|
6
|
-
test('Add to Resolver', () => {
|
|
7
|
-
const plugin = XyoEthereumGasPlugin()
|
|
8
|
-
const resolver = new PayloadSetPluginResolver().register(plugin)
|
|
9
|
-
expect(resolver.resolve(plugin.set)).toBeDefined()
|
|
10
|
-
})
|
|
11
|
-
})
|