@xyo-network/gas-price-plugin 3.4.2 → 3.4.3
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/neutral/Diviner.d.ts +16 -0
- package/dist/neutral/Diviner.d.ts.map +1 -0
- package/dist/neutral/Plugin.d.ts +13 -0
- package/dist/neutral/Plugin.d.ts.map +1 -0
- package/dist/neutral/Schema.d.ts +5 -0
- package/dist/neutral/Schema.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +4 -38
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.mjs +3 -1
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/lib/average.d.ts +8 -0
- package/dist/neutral/lib/average.d.ts.map +1 -0
- package/dist/neutral/lib/divineGas.d.ts +4 -0
- package/dist/neutral/lib/divineGas.d.ts.map +1 -0
- package/dist/neutral/lib/identities/index.d.ts +6 -0
- package/dist/neutral/lib/identities/index.d.ts.map +1 -0
- package/dist/neutral/lib/identities/isEthereumGasBlocknativePayload.d.ts +4 -0
- package/dist/neutral/lib/identities/isEthereumGasBlocknativePayload.d.ts.map +1 -0
- package/dist/neutral/lib/identities/isEthereumGasEtherchainV2Payload.d.ts +4 -0
- package/dist/neutral/lib/identities/isEthereumGasEtherchainV2Payload.d.ts.map +1 -0
- package/dist/neutral/lib/identities/isEthereumGasEthersPayload.d.ts +4 -0
- package/dist/neutral/lib/identities/isEthereumGasEthersPayload.d.ts.map +1 -0
- package/dist/neutral/lib/identities/isEthereumGasEtherscanPayload.d.ts +4 -0
- package/dist/neutral/lib/identities/isEthereumGasEtherscanPayload.d.ts.map +1 -0
- package/dist/neutral/lib/identities/isEthereumGasEthgasstationPayload.d.ts +4 -0
- package/dist/neutral/lib/identities/isEthereumGasEthgasstationPayload.d.ts.map +1 -0
- package/dist/neutral/lib/index.d.ts +2 -0
- package/dist/neutral/lib/index.d.ts.map +1 -0
- package/dist/neutral/lib/transforms/index.d.ts +6 -0
- package/dist/neutral/lib/transforms/index.d.ts.map +1 -0
- package/dist/neutral/lib/transforms/transformGasFromBlocknative.d.ts +4 -0
- package/dist/neutral/lib/transforms/transformGasFromBlocknative.d.ts.map +1 -0
- package/dist/neutral/lib/transforms/transformGasFromEtherchainV2.d.ts +4 -0
- package/dist/neutral/lib/transforms/transformGasFromEtherchainV2.d.ts.map +1 -0
- package/dist/neutral/lib/transforms/transformGasFromEthers.d.ts +4 -0
- package/dist/neutral/lib/transforms/transformGasFromEthers.d.ts.map +1 -0
- package/dist/neutral/lib/transforms/transformGasFromEtherscan.d.ts +4 -0
- package/dist/neutral/lib/transforms/transformGasFromEtherscan.d.ts.map +1 -0
- package/dist/neutral/lib/transforms/transformGasFromEthgasstation.d.ts +4 -0
- package/dist/neutral/lib/transforms/transformGasFromEthgasstation.d.ts.map +1 -0
- package/dist/neutral/test/index.d.ts +6 -0
- package/dist/neutral/test/index.d.ts.map +1 -0
- package/dist/neutral/test/sampleBlocknativeGas.d.ts +3 -0
- package/dist/neutral/test/sampleBlocknativeGas.d.ts.map +1 -0
- package/dist/neutral/test/sampleEtherchainGasV2.d.ts +3 -0
- package/dist/neutral/test/sampleEtherchainGasV2.d.ts.map +1 -0
- package/dist/neutral/test/sampleEthersGas.d.ts +3 -0
- package/dist/neutral/test/sampleEthersGas.d.ts.map +1 -0
- package/dist/neutral/test/sampleEtherscanGas.d.ts +3 -0
- package/dist/neutral/test/sampleEtherscanGas.d.ts.map +1 -0
- package/dist/neutral/test/sampleEthgasstationGas.d.ts +3 -0
- package/dist/neutral/test/sampleEthgasstationGas.d.ts.map +1 -0
- package/package.json +22 -22
- package/src/Diviner.ts +3 -3
- package/src/lib/average.ts +1 -1
- package/src/lib/divineGas.ts +4 -3
- package/src/lib/identities/isEthereumGasBlocknativePayload.ts +2 -3
- package/src/lib/identities/isEthereumGasEtherchainV2Payload.ts +2 -3
- package/src/lib/identities/isEthereumGasEthersPayload.ts +2 -3
- package/src/lib/identities/isEthereumGasEtherscanPayload.ts +2 -3
- package/src/lib/identities/isEthereumGasEthgasstationPayload.ts +2 -3
- package/src/lib/transforms/transformGasFromBlocknative.ts +2 -2
- package/src/lib/transforms/transformGasFromEtherchainV2.ts +2 -2
- package/src/lib/transforms/transformGasFromEthers.ts +2 -2
- package/src/lib/transforms/transformGasFromEtherscan.ts +2 -2
- package/src/lib/transforms/transformGasFromEthgasstation.ts +2 -2
- package/src/test/sampleBlocknativeGas.ts +3 -2
- package/src/test/sampleEtherchainGasV2.ts +1 -2
- package/src/test/sampleEthersGas.ts +1 -2
- package/src/test/sampleEtherscanGas.ts +1 -2
- package/src/test/sampleEthgasstationGas.ts +1 -2
- package/xy.config.ts +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractDiviner } from '@xyo-network/diviner-abstract';
|
|
2
|
+
import { DivinerConfig, DivinerModule, DivinerParams } from '@xyo-network/diviner-model';
|
|
3
|
+
import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
4
|
+
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
5
|
+
import { EthereumGasDivinerConfigSchema } from './Schema.ts';
|
|
6
|
+
export type EthereumGasDivinerConfig = DivinerConfig<{
|
|
7
|
+
schema: EthereumGasDivinerConfigSchema;
|
|
8
|
+
}>;
|
|
9
|
+
export type EthereumGasDivinerParams = DivinerParams<AnyConfigSchema<EthereumGasDivinerConfig>>;
|
|
10
|
+
export declare class EthereumGasDiviner<TParams extends EthereumGasDivinerParams = EthereumGasDivinerParams> extends AbstractDiviner<TParams> implements DivinerModule {
|
|
11
|
+
static readonly configSchemas: Schema[];
|
|
12
|
+
static readonly defaultConfigSchema: Schema;
|
|
13
|
+
static readonly targetSchema: string;
|
|
14
|
+
protected divineHandler(payloads?: Payload[]): Payload[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Diviner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EACL,aAAa,EAAE,aAAa,EAAE,aAAa,EAC5C,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAA;AAE5D,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAC;IAAE,MAAM,EAAE,8BAA8B,CAAA;CAAE,CAAC,CAAA;AAChG,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAC,CAAA;AAE/F,qBAAa,kBAAkB,CAAC,OAAO,SAAS,wBAAwB,GAAG,wBAAwB,CACjG,SAAQ,eAAe,CAAC,OAAO,CAC/B,YAAW,aAAa;IACxB,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA2D;IAC3G,gBAAyB,mBAAmB,EAAE,MAAM,CAAiC;IACrF,gBAAyB,YAAY,EAAE,MAAM,CAAoB;cAE9C,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE;CAIlE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EthereumGasDiviner } from './Diviner.ts';
|
|
2
|
+
export declare const EthereumGasPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDivinerPlugin<EthereumGasDiviner<import(".store/@xylabs-object-npm-4.5.1-e31c389195/package").BaseParamsFields & {
|
|
3
|
+
account?: import(".store/@xyo-network-account-model-virtual-26592e0d6e/package").AccountInstance | "random";
|
|
4
|
+
addToResolvers?: boolean;
|
|
5
|
+
additionalSigners?: import(".store/@xyo-network-account-model-virtual-26592e0d6e/package").AccountInstance[];
|
|
6
|
+
allowNameResolution?: boolean;
|
|
7
|
+
config: import("@xyo-network/module-model").AnyConfigSchema<import("./Diviner.ts").EthereumGasDivinerConfig>;
|
|
8
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
9
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
10
|
+
privateChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
11
|
+
publicChildren?: import("@xyo-network/module-model").ModuleInstance[];
|
|
12
|
+
}>>;
|
|
13
|
+
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;GAQ3B,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type EthereumGasDivinerQuerySchema = 'network.xyo.blockchain.ethereum.gas.diviner.query';
|
|
2
|
+
export declare const EthereumGasDivinerQuerySchema: EthereumGasDivinerQuerySchema;
|
|
3
|
+
export type EthereumGasDivinerConfigSchema = 'network.xyo.blockchain.ethereum.gas.diviner.config';
|
|
4
|
+
export declare const EthereumGasDivinerConfigSchema: EthereumGasDivinerConfigSchema;
|
|
5
|
+
//# sourceMappingURL=Schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,6BAA6B,GAAG,mDAAmD,CAAA;AAC/F,eAAO,MAAM,6BAA6B,EAAE,6BAAmF,CAAA;AAE/H,MAAM,MAAM,8BAA8B,GAAG,oDAAoD,CAAA;AACjG,eAAO,MAAM,8BAA8B,EAAE,8BAAqF,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { Schema, Payload } from '@xyo-network/payload-model';
|
|
6
|
-
import * as _xyo_network_payloadset_plugin from '@xyo-network/payloadset-plugin';
|
|
7
|
-
import * as _store__xyo_network_account_model_virtual_8ffda77307_package from '.store/@xyo-network-account-model-virtual-8ffda77307/package';
|
|
8
|
-
import * as _store__xylabs_object_npm_4_5_1_e31c389195_package from '.store/@xylabs-object-npm-4.5.1-e31c389195/package';
|
|
9
|
-
|
|
10
|
-
type EthereumGasDivinerQuerySchema = 'network.xyo.blockchain.ethereum.gas.diviner.query';
|
|
11
|
-
declare const EthereumGasDivinerQuerySchema: EthereumGasDivinerQuerySchema;
|
|
12
|
-
type EthereumGasDivinerConfigSchema = 'network.xyo.blockchain.ethereum.gas.diviner.config';
|
|
13
|
-
declare const EthereumGasDivinerConfigSchema: EthereumGasDivinerConfigSchema;
|
|
14
|
-
|
|
15
|
-
type EthereumGasDivinerConfig = DivinerConfig<{
|
|
16
|
-
schema: EthereumGasDivinerConfigSchema;
|
|
17
|
-
}>;
|
|
18
|
-
type EthereumGasDivinerParams = DivinerParams<AnyConfigSchema<EthereumGasDivinerConfig>>;
|
|
19
|
-
declare class EthereumGasDiviner<TParams extends EthereumGasDivinerParams = EthereumGasDivinerParams> extends AbstractDiviner<TParams> implements DivinerModule {
|
|
20
|
-
static readonly configSchemas: Schema[];
|
|
21
|
-
static readonly defaultConfigSchema: Schema;
|
|
22
|
-
static readonly targetSchema: string;
|
|
23
|
-
protected divineHandler(payloads?: Payload[]): Payload[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare const EthereumGasPlugin: () => _xyo_network_payloadset_plugin.PayloadSetDivinerPlugin<EthereumGasDiviner<_store__xylabs_object_npm_4_5_1_e31c389195_package.BaseParamsFields & {
|
|
27
|
-
account?: _store__xyo_network_account_model_virtual_8ffda77307_package.AccountInstance | "random";
|
|
28
|
-
addToResolvers?: boolean;
|
|
29
|
-
additionalSigners?: _store__xyo_network_account_model_virtual_8ffda77307_package.AccountInstance[];
|
|
30
|
-
allowNameResolution?: boolean;
|
|
31
|
-
config: _xyo_network_module_model.AnyConfigSchema<EthereumGasDivinerConfig>;
|
|
32
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
33
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
34
|
-
privateChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
35
|
-
publicChildren?: _xyo_network_module_model.ModuleInstance[];
|
|
36
|
-
}>>;
|
|
37
|
-
|
|
38
|
-
export { EthereumGasDiviner, type EthereumGasDivinerConfig, EthereumGasDivinerConfigSchema, type EthereumGasDivinerParams, EthereumGasDivinerQuerySchema, EthereumGasPlugin, EthereumGasPlugin as default };
|
|
1
|
+
export * from './Diviner.ts';
|
|
2
|
+
export { EthereumGasPlugin as default, EthereumGasPlugin } from './Plugin.ts';
|
|
3
|
+
export * from './Schema.ts';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC7E,cAAc,aAAa,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -3,7 +3,9 @@ import { AbstractDiviner } from "@xyo-network/diviner-abstract";
|
|
|
3
3
|
import { EthereumGasSchema as EthereumGasSchema2 } from "@xyo-network/gas-price-payload-plugin";
|
|
4
4
|
|
|
5
5
|
// src/lib/divineGas.ts
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
EthereumGasSchema
|
|
8
|
+
} from "@xyo-network/gas-price-payload-plugin";
|
|
7
9
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
8
10
|
|
|
9
11
|
// src/lib/average.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Diviner.ts","../../src/lib/divineGas.ts","../../src/lib/average.ts","../../src/lib/identities/isEthereumGasBlocknativePayload.ts","../../src/lib/identities/isEthereumGasEtherchainV2Payload.ts","../../src/lib/identities/isEthereumGasEtherscanPayload.ts","../../src/lib/identities/isEthereumGasEthersPayload.ts","../../src/lib/identities/isEthereumGasEthgasstationPayload.ts","../../src/lib/transforms/transformGasFromBlocknative.ts","../../src/lib/transforms/transformGasFromEtherchainV2.ts","../../src/lib/transforms/transformGasFromEthers.ts","../../src/lib/transforms/transformGasFromEtherscan.ts","../../src/lib/transforms/transformGasFromEthgasstation.ts","../../src/Schema.ts","../../src/Plugin.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type {\n DivinerConfig, DivinerModule, DivinerParams,\n} from '@xyo-network/diviner-model'\nimport { EthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { divineGas } from './lib/index.ts'\nimport { EthereumGasDivinerConfigSchema } from './Schema.ts'\n\nexport type EthereumGasDivinerConfig = DivinerConfig<{ schema: EthereumGasDivinerConfigSchema }>\nexport type EthereumGasDivinerParams = DivinerParams<AnyConfigSchema<EthereumGasDivinerConfig>>\n\nexport class EthereumGasDiviner<TParams extends EthereumGasDivinerParams = EthereumGasDivinerParams>\n extends AbstractDiviner<TParams>\n implements DivinerModule {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EthereumGasDivinerConfigSchema\n static override readonly targetSchema: string = EthereumGasSchema\n\n protected override divineHandler(payloads?: Payload[]): Payload[] {\n const cost = divineGas(payloads ?? [])\n return [cost]\n }\n}\n","import type { EthereumGasPayload, FeeData } from '@xyo-network/gas-price-payload-plugin'\nimport { EthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { average } from './average.ts'\nimport {\n isEthereumGasBlocknativePayload,\n isEthereumGasEtherchainV2Payload,\n isEthereumGasEtherscanPayload,\n isEthereumGasEthersPayload,\n isEthereumGasEthgasstationPayload,\n} from './identities/index.ts'\nimport {\n transformGasFromBlocknative,\n transformGasFromEtherchainV2,\n transformGasFromEthers,\n transformGasFromEtherscan,\n transformGasFromEthgasstation,\n} from './transforms/index.ts'\n\nexport const divineGas = (payloads: Payload[]): EthereumGasPayload => {\n const blocknative = payloads.filter(isEthereumGasBlocknativePayload).map(transformGasFromBlocknative)\n const etherchainV2 = payloads.filter(isEthereumGasEtherchainV2Payload).map(transformGasFromEtherchainV2)\n const ethers = payloads.filter(isEthereumGasEthersPayload).map(transformGasFromEthers)\n const etherscan = payloads.filter(isEthereumGasEtherscanPayload).map(transformGasFromEtherscan)\n const ethgasstation = payloads.filter(isEthereumGasEthgasstationPayload).map(transformGasFromEthgasstation)\n const transactionCosts: FeeData[] = [...blocknative, ...etherchainV2, ...ethers, ...etherscan, ...ethgasstation]\n const avg = average(transactionCosts)\n const timestamp = Date.now()\n const payload = new PayloadBuilder<EthereumGasPayload>({ schema: EthereumGasSchema }).fields({ ...avg, timestamp }).build()\n return payload\n}\n","import { exists } from '@xylabs/exists'\nimport type { FeeData } from '@xyo-network/gas-price-payload-plugin'\n\n/**\n * Averages an array of numbers\n * @param x Averages an array of numbers\n * @returns The average of the array of numbers or undefined if the\n * array is empty or undefined\n */\n// eslint-disable-next-line sonarjs/reduce-initial-value\nconst listAverage = (x?: number[]) => (x?.length ? x.reduce((a, b) => a + b) / x.length : undefined)\n\n/**\n * Averages the property indicates by the supplied property\n * expression across the array of FeeData\n * @param data The array of data to average\n * @param propertyExpression The expression for the property to\n * average\n * @returns The average of the supplied property across the array\n */\nconst averageProperty = (data: FeeData[], propertyExpression: (x: FeeData) => number | undefined) => {\n return listAverage(data.map(propertyExpression).filter(exists))\n}\n\n/**\n * Averages the supplied FeeData\n * @param input An array of FeeData or undefined\n * @returns The average of the supplied FeeData\n */\nexport const average = (input?: (FeeData | undefined)[]): FeeData => {\n const data = input?.filter(exists) || []\n const averaged: FeeData = {\n baseFee: averageProperty(data, x => x.baseFee),\n feePerGas: {\n high: averageProperty(data, x => x.feePerGas.high),\n low: averageProperty(data, x => x.feePerGas.low),\n medium: averageProperty(data, x => x.feePerGas.medium),\n veryHigh: averageProperty(data, x => x.feePerGas.veryHigh),\n },\n priorityFeePerGas: {\n high: averageProperty(data, x => x.priorityFeePerGas.high),\n low: averageProperty(data, x => x.priorityFeePerGas.low),\n medium: averageProperty(data, x => x.priorityFeePerGas.medium),\n veryHigh: averageProperty(data, x => x.priorityFeePerGas.veryHigh),\n },\n }\n return averaged\n}\n","import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasBlocknativePayload = (payload?: Payload | null): payload is EthereumGasBlocknativePayload => {\n return payload?.schema === EthereumGasBlocknativeSchema\n}\n","import type { EthereumGasEtherchainV2Payload } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'\nimport { EthereumGasEtherchainV2Schema } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEtherchainV2Payload = (payload?: Payload | null): payload is EthereumGasEtherchainV2Payload => {\n return payload?.schema === EthereumGasEtherchainV2Schema\n}\n","import type { EthereumGasEtherscanPayload } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'\nimport { EthereumGasEtherscanSchema } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEtherscanPayload = (payload?: Payload | null): payload is EthereumGasEtherscanPayload => {\n return payload?.schema === EthereumGasEtherscanSchema\n}\n","import type { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEthersPayload = (payload?: Payload | null): payload is EthereumGasEthersPayload => {\n return payload?.schema === EthereumGasEthersSchema\n}\n","import type { EthereumGasEthgasstationPayload } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'\nimport { EthereumGasEthgasstationSchema } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEthgasstationPayload = (payload?: Payload | null): payload is EthereumGasEthgasstationPayload => {\n return payload?.schema === EthereumGasEthgasstationSchema\n}\n","import type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport type {\n FeeData, FeePerGas, PriorityFeePerGas,\n} from '@xyo-network/gas-price-payload-plugin'\nimport regression from 'regression'\n\nconst getBaseFee = (payload: EthereumGasBlocknativePayload): number | undefined => {\n return payload?.blockPrices?.[0]?.baseFeePerGas\n}\n\nconst getFeePerGas = (payload: EthereumGasBlocknativePayload): Partial<FeePerGas> => {\n const sorted = payload.blockPrices?.[0].estimatedPrices?.toSorted((a, b) => a.confidence - b.confidence)\n const trend = regression.linear([\n [0, sorted?.[0].price],\n [1, sorted?.[1].price],\n [2, sorted?.[2].price],\n [3, sorted?.[3].price],\n [4, sorted?.[4].price],\n ])\n const feePerGas: FeePerGas = {\n low: trend.predict(0.5)[1],\n medium: trend.predict(1.5)[1],\n high: trend.predict(2.5)[1],\n veryHigh: trend.predict(3.5)[1],\n }\n return feePerGas\n}\n\nconst getPriorityFeePerGas = (payload: EthereumGasBlocknativePayload): Partial<PriorityFeePerGas> => {\n const sorted = payload.blockPrices?.[0].estimatedPrices?.toSorted((a, b) => a.confidence - b.confidence)\n const trend = regression.linear([\n [0, sorted?.[0].maxPriorityFeePerGas],\n [1, sorted?.[1].maxPriorityFeePerGas],\n [2, sorted?.[2].maxPriorityFeePerGas],\n [3, sorted?.[3].maxPriorityFeePerGas],\n [4, sorted?.[4].maxPriorityFeePerGas],\n ])\n const priorityFeePerGas: PriorityFeePerGas = {\n low: trend.predict(0.5)[1],\n medium: trend.predict(1.5)[1],\n high: trend.predict(2.5)[1],\n veryHigh: trend.predict(3.5)[1],\n }\n return priorityFeePerGas\n}\n\nexport const transformGasFromBlocknative = (payload: EthereumGasBlocknativePayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = getPriorityFeePerGas(payload)\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import type { EthereumGasEtherchainV2Payload } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'\nimport type { FeeData, FeePerGas } from '@xyo-network/gas-price-payload-plugin'\n\nconst getFeePerGas = (payload: EthereumGasEtherchainV2Payload): Partial<FeePerGas> => {\n const {\n slow, standard, fast, rapid,\n } = payload.data\n const low = slow / 1_000_000_000\n const medium = standard / 1_000_000_000\n const high = fast / 1_000_000_000\n const veryHigh = rapid / 1_000_000_000\n return {\n high, low, medium, veryHigh,\n }\n}\n\nexport const transformGasFromEtherchainV2 = (payload: EthereumGasEtherchainV2Payload): FeeData => {\n const baseFee = undefined\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = {}\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import type { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport type {\n FeeData, FeePerGas, PriorityFeePerGas,\n} from '@xyo-network/gas-price-payload-plugin'\n\nconst getBaseFee = (payload: EthereumGasEthersPayload): number | undefined => {\n const { gasPrice } = payload\n return gasPrice ? gasPrice / 1_000_000_000 : undefined\n}\n\nconst getFeePerGas = (payload: EthereumGasEthersPayload): Partial<FeePerGas> => {\n const { maxFeePerGas } = payload\n const high = maxFeePerGas ? maxFeePerGas / 1_000_000_000 : undefined\n return { high }\n}\n\nconst getPriorityFeePerGas = (payload: EthereumGasEthersPayload): Partial<PriorityFeePerGas> => {\n const { maxPriorityFeePerGas } = payload\n const high = maxPriorityFeePerGas ? maxPriorityFeePerGas / 1_000_000_000 : undefined\n return { high }\n}\n\nexport const transformGasFromEthers = (payload: EthereumGasEthersPayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = getPriorityFeePerGas(payload)\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import type { EthereumGasEtherscanPayload } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'\nimport type { FeeData, FeePerGas } from '@xyo-network/gas-price-payload-plugin'\nimport regression from 'regression'\n\nconst getBaseFee = (payload: EthereumGasEtherscanPayload): number | undefined => {\n const { suggestBaseFee } = payload.result\n return Number.parseFloat(suggestBaseFee)\n}\n\nconst getFeePerGas = (payload: EthereumGasEtherscanPayload): Partial<FeePerGas> => {\n const {\n FastGasPrice, ProposeGasPrice, SafeGasPrice,\n } = payload.result\n const low = Number.parseFloat(SafeGasPrice)\n const medium = Number.parseFloat(ProposeGasPrice)\n const high = Number.parseFloat(FastGasPrice)\n const veryHigh = regression.linear([\n [0, low],\n [1, medium],\n [2, high],\n ]).predict(3)[1]\n return {\n high, low, medium, veryHigh,\n }\n}\n\nexport const transformGasFromEtherscan = (payload: EthereumGasEtherscanPayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = {}\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import type { EthereumGasEthgasstationPayload } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'\nimport type {\n FeeData, FeePerGas, PriorityFeePerGas,\n} from '@xyo-network/gas-price-payload-plugin'\nimport regression from 'regression'\n\nconst getBaseFee = (payload: EthereumGasEthgasstationPayload): number | undefined => {\n const { baseFee } = payload\n return baseFee\n}\n\nconst getFeePerGas = (payload: EthereumGasEthgasstationPayload): Partial<FeePerGas> => {\n const {\n standard: medium, fast: high, instant: veryHigh,\n } = payload.gasPrice\n const trend = regression.linear([\n [1, medium],\n [2, high],\n [3, veryHigh],\n ])\n const low = trend.predict(0)[1]\n return {\n low, medium, high, veryHigh,\n }\n}\n\nconst getPriorityFeePerGas = (payload: EthereumGasEthgasstationPayload): Partial<PriorityFeePerGas> => {\n const {\n standard: medium, fast: high, instant: veryHigh,\n } = payload.priorityFee\n const trend = regression.linear([\n [1, medium],\n [2, high],\n [3, veryHigh],\n ])\n const low = trend.predict(0)[1]\n return {\n low, medium, high, veryHigh,\n }\n}\n\nexport const transformGasFromEthgasstation = (payload: EthereumGasEthgasstationPayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = getPriorityFeePerGas(payload)\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","export type EthereumGasDivinerQuerySchema = 'network.xyo.blockchain.ethereum.gas.diviner.query'\nexport const EthereumGasDivinerQuerySchema: EthereumGasDivinerQuerySchema = 'network.xyo.blockchain.ethereum.gas.diviner.query'\n\nexport type EthereumGasDivinerConfigSchema = 'network.xyo.blockchain.ethereum.gas.diviner.config'\nexport const EthereumGasDivinerConfigSchema: EthereumGasDivinerConfigSchema = 'network.xyo.blockchain.ethereum.gas.diviner.config'\n","import { EthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasDiviner } from './Diviner.ts'\n\nexport const EthereumGasPlugin = () =>\n createPayloadSetDivinerPlugin<EthereumGasDiviner>(\n { required: { [EthereumGasSchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await EthereumGasDiviner.create(params)) as EthereumGasDiviner\n },\n },\n )\n"],"mappings":";AAAA,SAA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S,OAAO,gCAAgC,EAAE,IAAI,4BAA4B;AACvG,QAAM,SAAS,SAAS,OAAO,0BAA0B,EAAE,IAAI,sBAAsB;AACrF,QAAM,YAAY,SAAS,OAAO,6BAA6B,EAAE,IAAI,yBAAyB;AAC9F,QAAM,gBAAgB,SAAS,OAAO,iCAAiC,EAAE,IAAI,6BAA6B;AAC1G,QAAM,mBAA8B,CAAC,GAAG,aAAa,GAAG,cAAc,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa;AAC/G,QAAM,MAAM,QAAQ,gBAAgB;AACpC,QAAM,YAAY,KAAK,IAAI;AAC3B,QAAM,UAAU,IAAI,eAAmC,EAAE,QAAQ,kBAAkB,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,UAAU,CAAC,EAAE,MAAM;AAC1H,SAAO;AACT;;;AY/BO,IAAM,gCAA+D;AAGrE,IAAM,iCAAiE;;;AbUvE,IAAM,qBAAN,cACG,gBACiB;AAAA,EACzB,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,8BAA8B;AAAA,EAC1G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,eAAuBC;AAAA,EAE7B,cAAc,UAAiC;AAChE,UAAM,OAAO,UAAU,YAAY,CAAC,CAAC;AACrC,WAAO,CAAC,IAAI;AAAA,EACd;AACF;;;AczBA,SAAS,qBAAAC,0BAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;AAIvC,IAAM,oBAAoB,MAC/B;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,kBAAiB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACjE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,mBAAmB,OAAO,MAAM;AAAA,IAChD;AAAA,EACF;AACF;","names":["EthereumGasSchema","getFeePerGas","getBaseFee","getFeePerGas","getPriorityFeePerGas","regression","getBaseFee","getFeePerGas","regression","getBaseFee","getFeePerGas","getPriorityFeePerGas","EthereumGasSchema","EthereumGasSchema","EthereumGasSchema"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Diviner.ts","../../src/lib/divineGas.ts","../../src/lib/average.ts","../../src/lib/identities/isEthereumGasBlocknativePayload.ts","../../src/lib/identities/isEthereumGasEtherchainV2Payload.ts","../../src/lib/identities/isEthereumGasEtherscanPayload.ts","../../src/lib/identities/isEthereumGasEthersPayload.ts","../../src/lib/identities/isEthereumGasEthgasstationPayload.ts","../../src/lib/transforms/transformGasFromBlocknative.ts","../../src/lib/transforms/transformGasFromEtherchainV2.ts","../../src/lib/transforms/transformGasFromEthers.ts","../../src/lib/transforms/transformGasFromEtherscan.ts","../../src/lib/transforms/transformGasFromEthgasstation.ts","../../src/Schema.ts","../../src/Plugin.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport {\n DivinerConfig, DivinerModule, DivinerParams,\n} from '@xyo-network/diviner-model'\nimport { EthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { divineGas } from './lib/index.ts'\nimport { EthereumGasDivinerConfigSchema } from './Schema.ts'\n\nexport type EthereumGasDivinerConfig = DivinerConfig<{ schema: EthereumGasDivinerConfigSchema }>\nexport type EthereumGasDivinerParams = DivinerParams<AnyConfigSchema<EthereumGasDivinerConfig>>\n\nexport class EthereumGasDiviner<TParams extends EthereumGasDivinerParams = EthereumGasDivinerParams>\n extends AbstractDiviner<TParams>\n implements DivinerModule {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EthereumGasDivinerConfigSchema\n static override readonly targetSchema: string = EthereumGasSchema\n\n protected override divineHandler(payloads?: Payload[]): Payload[] {\n const cost = divineGas(payloads ?? [])\n return [cost]\n }\n}\n","import {\n EthereumGasPayload, EthereumGasSchema, FeeData,\n} from '@xyo-network/gas-price-payload-plugin'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { average } from './average.ts'\nimport {\n isEthereumGasBlocknativePayload,\n isEthereumGasEtherchainV2Payload,\n isEthereumGasEtherscanPayload,\n isEthereumGasEthersPayload,\n isEthereumGasEthgasstationPayload,\n} from './identities/index.ts'\nimport {\n transformGasFromBlocknative,\n transformGasFromEtherchainV2,\n transformGasFromEthers,\n transformGasFromEtherscan,\n transformGasFromEthgasstation,\n} from './transforms/index.ts'\n\nexport const divineGas = (payloads: Payload[]): EthereumGasPayload => {\n const blocknative = payloads.filter(isEthereumGasBlocknativePayload).map(transformGasFromBlocknative)\n const etherchainV2 = payloads.filter(isEthereumGasEtherchainV2Payload).map(transformGasFromEtherchainV2)\n const ethers = payloads.filter(isEthereumGasEthersPayload).map(transformGasFromEthers)\n const etherscan = payloads.filter(isEthereumGasEtherscanPayload).map(transformGasFromEtherscan)\n const ethgasstation = payloads.filter(isEthereumGasEthgasstationPayload).map(transformGasFromEthgasstation)\n const transactionCosts: FeeData[] = [...blocknative, ...etherchainV2, ...ethers, ...etherscan, ...ethgasstation]\n const avg = average(transactionCosts)\n const timestamp = Date.now()\n const payload = new PayloadBuilder<EthereumGasPayload>({ schema: EthereumGasSchema }).fields({ ...avg, timestamp }).build()\n return payload\n}\n","import { exists } from '@xylabs/exists'\nimport { FeeData } from '@xyo-network/gas-price-payload-plugin'\n\n/**\n * Averages an array of numbers\n * @param x Averages an array of numbers\n * @returns The average of the array of numbers or undefined if the\n * array is empty or undefined\n */\n// eslint-disable-next-line sonarjs/reduce-initial-value\nconst listAverage = (x?: number[]) => (x?.length ? x.reduce((a, b) => a + b) / x.length : undefined)\n\n/**\n * Averages the property indicates by the supplied property\n * expression across the array of FeeData\n * @param data The array of data to average\n * @param propertyExpression The expression for the property to\n * average\n * @returns The average of the supplied property across the array\n */\nconst averageProperty = (data: FeeData[], propertyExpression: (x: FeeData) => number | undefined) => {\n return listAverage(data.map(propertyExpression).filter(exists))\n}\n\n/**\n * Averages the supplied FeeData\n * @param input An array of FeeData or undefined\n * @returns The average of the supplied FeeData\n */\nexport const average = (input?: (FeeData | undefined)[]): FeeData => {\n const data = input?.filter(exists) || []\n const averaged: FeeData = {\n baseFee: averageProperty(data, x => x.baseFee),\n feePerGas: {\n high: averageProperty(data, x => x.feePerGas.high),\n low: averageProperty(data, x => x.feePerGas.low),\n medium: averageProperty(data, x => x.feePerGas.medium),\n veryHigh: averageProperty(data, x => x.feePerGas.veryHigh),\n },\n priorityFeePerGas: {\n high: averageProperty(data, x => x.priorityFeePerGas.high),\n low: averageProperty(data, x => x.priorityFeePerGas.low),\n medium: averageProperty(data, x => x.priorityFeePerGas.medium),\n veryHigh: averageProperty(data, x => x.priorityFeePerGas.veryHigh),\n },\n }\n return averaged\n}\n","import { EthereumGasBlocknativePayload, EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasBlocknativePayload = (payload?: Payload | null): payload is EthereumGasBlocknativePayload => {\n return payload?.schema === EthereumGasBlocknativeSchema\n}\n","import { EthereumGasEtherchainV2Payload, EthereumGasEtherchainV2Schema } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEtherchainV2Payload = (payload?: Payload | null): payload is EthereumGasEtherchainV2Payload => {\n return payload?.schema === EthereumGasEtherchainV2Schema\n}\n","import { EthereumGasEtherscanPayload, EthereumGasEtherscanSchema } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEtherscanPayload = (payload?: Payload | null): payload is EthereumGasEtherscanPayload => {\n return payload?.schema === EthereumGasEtherscanSchema\n}\n","import { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEthersPayload = (payload?: Payload | null): payload is EthereumGasEthersPayload => {\n return payload?.schema === EthereumGasEthersSchema\n}\n","import { EthereumGasEthgasstationPayload, EthereumGasEthgasstationSchema } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const isEthereumGasEthgasstationPayload = (payload?: Payload | null): payload is EthereumGasEthgasstationPayload => {\n return payload?.schema === EthereumGasEthgasstationSchema\n}\n","import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport {\n FeeData, FeePerGas, PriorityFeePerGas,\n} from '@xyo-network/gas-price-payload-plugin'\nimport regression from 'regression'\n\nconst getBaseFee = (payload: EthereumGasBlocknativePayload): number | undefined => {\n return payload?.blockPrices?.[0]?.baseFeePerGas\n}\n\nconst getFeePerGas = (payload: EthereumGasBlocknativePayload): Partial<FeePerGas> => {\n const sorted = payload.blockPrices?.[0].estimatedPrices?.toSorted((a, b) => a.confidence - b.confidence)\n const trend = regression.linear([\n [0, sorted?.[0].price],\n [1, sorted?.[1].price],\n [2, sorted?.[2].price],\n [3, sorted?.[3].price],\n [4, sorted?.[4].price],\n ])\n const feePerGas: FeePerGas = {\n low: trend.predict(0.5)[1],\n medium: trend.predict(1.5)[1],\n high: trend.predict(2.5)[1],\n veryHigh: trend.predict(3.5)[1],\n }\n return feePerGas\n}\n\nconst getPriorityFeePerGas = (payload: EthereumGasBlocknativePayload): Partial<PriorityFeePerGas> => {\n const sorted = payload.blockPrices?.[0].estimatedPrices?.toSorted((a, b) => a.confidence - b.confidence)\n const trend = regression.linear([\n [0, sorted?.[0].maxPriorityFeePerGas],\n [1, sorted?.[1].maxPriorityFeePerGas],\n [2, sorted?.[2].maxPriorityFeePerGas],\n [3, sorted?.[3].maxPriorityFeePerGas],\n [4, sorted?.[4].maxPriorityFeePerGas],\n ])\n const priorityFeePerGas: PriorityFeePerGas = {\n low: trend.predict(0.5)[1],\n medium: trend.predict(1.5)[1],\n high: trend.predict(2.5)[1],\n veryHigh: trend.predict(3.5)[1],\n }\n return priorityFeePerGas\n}\n\nexport const transformGasFromBlocknative = (payload: EthereumGasBlocknativePayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = getPriorityFeePerGas(payload)\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import { EthereumGasEtherchainV2Payload } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'\nimport { FeeData, FeePerGas } from '@xyo-network/gas-price-payload-plugin'\n\nconst getFeePerGas = (payload: EthereumGasEtherchainV2Payload): Partial<FeePerGas> => {\n const {\n slow, standard, fast, rapid,\n } = payload.data\n const low = slow / 1_000_000_000\n const medium = standard / 1_000_000_000\n const high = fast / 1_000_000_000\n const veryHigh = rapid / 1_000_000_000\n return {\n high, low, medium, veryHigh,\n }\n}\n\nexport const transformGasFromEtherchainV2 = (payload: EthereumGasEtherchainV2Payload): FeeData => {\n const baseFee = undefined\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = {}\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport {\n FeeData, FeePerGas, PriorityFeePerGas,\n} from '@xyo-network/gas-price-payload-plugin'\n\nconst getBaseFee = (payload: EthereumGasEthersPayload): number | undefined => {\n const { gasPrice } = payload\n return gasPrice ? gasPrice / 1_000_000_000 : undefined\n}\n\nconst getFeePerGas = (payload: EthereumGasEthersPayload): Partial<FeePerGas> => {\n const { maxFeePerGas } = payload\n const high = maxFeePerGas ? maxFeePerGas / 1_000_000_000 : undefined\n return { high }\n}\n\nconst getPriorityFeePerGas = (payload: EthereumGasEthersPayload): Partial<PriorityFeePerGas> => {\n const { maxPriorityFeePerGas } = payload\n const high = maxPriorityFeePerGas ? maxPriorityFeePerGas / 1_000_000_000 : undefined\n return { high }\n}\n\nexport const transformGasFromEthers = (payload: EthereumGasEthersPayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = getPriorityFeePerGas(payload)\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import { EthereumGasEtherscanPayload } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'\nimport { FeeData, FeePerGas } from '@xyo-network/gas-price-payload-plugin'\nimport regression from 'regression'\n\nconst getBaseFee = (payload: EthereumGasEtherscanPayload): number | undefined => {\n const { suggestBaseFee } = payload.result\n return Number.parseFloat(suggestBaseFee)\n}\n\nconst getFeePerGas = (payload: EthereumGasEtherscanPayload): Partial<FeePerGas> => {\n const {\n FastGasPrice, ProposeGasPrice, SafeGasPrice,\n } = payload.result\n const low = Number.parseFloat(SafeGasPrice)\n const medium = Number.parseFloat(ProposeGasPrice)\n const high = Number.parseFloat(FastGasPrice)\n const veryHigh = regression.linear([\n [0, low],\n [1, medium],\n [2, high],\n ]).predict(3)[1]\n return {\n high, low, medium, veryHigh,\n }\n}\n\nexport const transformGasFromEtherscan = (payload: EthereumGasEtherscanPayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = {}\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","import { EthereumGasEthgasstationPayload } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'\nimport {\n FeeData, FeePerGas, PriorityFeePerGas,\n} from '@xyo-network/gas-price-payload-plugin'\nimport regression from 'regression'\n\nconst getBaseFee = (payload: EthereumGasEthgasstationPayload): number | undefined => {\n const { baseFee } = payload\n return baseFee\n}\n\nconst getFeePerGas = (payload: EthereumGasEthgasstationPayload): Partial<FeePerGas> => {\n const {\n standard: medium, fast: high, instant: veryHigh,\n } = payload.gasPrice\n const trend = regression.linear([\n [1, medium],\n [2, high],\n [3, veryHigh],\n ])\n const low = trend.predict(0)[1]\n return {\n low, medium, high, veryHigh,\n }\n}\n\nconst getPriorityFeePerGas = (payload: EthereumGasEthgasstationPayload): Partial<PriorityFeePerGas> => {\n const {\n standard: medium, fast: high, instant: veryHigh,\n } = payload.priorityFee\n const trend = regression.linear([\n [1, medium],\n [2, high],\n [3, veryHigh],\n ])\n const low = trend.predict(0)[1]\n return {\n low, medium, high, veryHigh,\n }\n}\n\nexport const transformGasFromEthgasstation = (payload: EthereumGasEthgasstationPayload): FeeData => {\n const baseFee = getBaseFee(payload)\n const feePerGas = getFeePerGas(payload)\n const priorityFeePerGas = getPriorityFeePerGas(payload)\n return {\n baseFee, feePerGas, priorityFeePerGas,\n }\n}\n","export type EthereumGasDivinerQuerySchema = 'network.xyo.blockchain.ethereum.gas.diviner.query'\nexport const EthereumGasDivinerQuerySchema: EthereumGasDivinerQuerySchema = 'network.xyo.blockchain.ethereum.gas.diviner.query'\n\nexport type EthereumGasDivinerConfigSchema = 'network.xyo.blockchain.ethereum.gas.diviner.config'\nexport const EthereumGasDivinerConfigSchema: EthereumGasDivinerConfigSchema = 'network.xyo.blockchain.ethereum.gas.diviner.config'\n","import { EthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasDiviner } from './Diviner.ts'\n\nexport const EthereumGasPlugin = () =>\n createPayloadSetDivinerPlugin<EthereumGasDiviner>(\n { required: { [EthereumGasSchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await EthereumGasDiviner.create(params)) as EthereumGasDiviner\n },\n },\n )\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIhC,SAAS,qBAAAA,0BAAyB;;;ACJlC;AAAA,EACsB;AAAA,OACf;AACP,SAAS,sBAAsB;;;ACH/B,SAAS,cAAc;AAUvB,IAAM,cAAc,CAAC,MAAkB,GAAG,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,SAAS;AAU1F,IAAM,kBAAk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QAAM,mBAA8B,CAAC,GAAG,aAAa,GAAG,cAAc,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa;AAC/G,QAAM,MAAM,QAAQ,gBAAgB;AACpC,QAAM,YAAY,KAAK,IAAI;AAC3B,QAAM,UAAU,IAAI,eAAmC,EAAE,QAAQ,kBAAkB,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,UAAU,CAAC,EAAE,MAAM;AAC1H,SAAO;AACT;;;AYhCO,IAAM,gCAA+D;AAGrE,IAAM,iCAAiE;;;AbUvE,IAAM,qBAAN,cACG,gBACiB;AAAA,EACzB,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,8BAA8B;AAAA,EAC1G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,eAAuBC;AAAA,EAE7B,cAAc,UAAiC;AAChE,UAAM,OAAO,UAAU,YAAY,CAAC,CAAC;AACrC,WAAO,CAAC,IAAI;AAAA,EACd;AACF;;;AczBA,SAAS,qBAAAC,0BAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;AAIvC,IAAM,oBAAoB,MAC/B;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,kBAAiB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACjE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,mBAAmB,OAAO,MAAM;AAAA,IAChD;AAAA,EACF;AACF;","names":["EthereumGasSchema","getFeePerGas","getBaseFee","getFeePerGas","getPriorityFeePerGas","regression","getBaseFee","getFeePerGas","regression","getBaseFee","getFeePerGas","getPriorityFeePerGas","EthereumGasSchema","EthereumGasSchema","EthereumGasSchema"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FeeData } from '@xyo-network/gas-price-payload-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Averages the supplied FeeData
|
|
4
|
+
* @param input An array of FeeData or undefined
|
|
5
|
+
* @returns The average of the supplied FeeData
|
|
6
|
+
*/
|
|
7
|
+
export declare const average: (input?: (FeeData | undefined)[]) => FeeData;
|
|
8
|
+
//# sourceMappingURL=average.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"average.d.ts","sourceRoot":"","sources":["../../../src/lib/average.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAA;AAuB/D;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,EAAE,KAAG,OAkBzD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divineGas.d.ts","sourceRoot":"","sources":["../../../src/lib/divineGas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EACnB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAkBpD,eAAO,MAAM,SAAS,GAAI,UAAU,OAAO,EAAE,KAAG,kBAW/C,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './isEthereumGasBlocknativePayload.ts';
|
|
2
|
+
export * from './isEthereumGasEtherchainV2Payload.ts';
|
|
3
|
+
export * from './isEthereumGasEtherscanPayload.ts';
|
|
4
|
+
export * from './isEthereumGasEthersPayload.ts';
|
|
5
|
+
export * from './isEthereumGasEthgasstationPayload.ts';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/identities/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAA;AACpD,cAAc,uCAAuC,CAAA;AACrD,cAAc,oCAAoC,CAAA;AAClD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wCAAwC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
export declare const isEthereumGasBlocknativePayload: (payload?: Payload | null) => payload is EthereumGasBlocknativePayload;
|
|
4
|
+
//# sourceMappingURL=isEthereumGasBlocknativePayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEthereumGasBlocknativePayload.d.ts","sourceRoot":"","sources":["../../../../src/lib/identities/isEthereumGasBlocknativePayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAgC,MAAM,sDAAsD,CAAA;AAClI,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,eAAO,MAAM,+BAA+B,GAAI,UAAU,OAAO,GAAG,IAAI,KAAG,OAAO,IAAI,6BAErF,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEtherchainV2Payload } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
export declare const isEthereumGasEtherchainV2Payload: (payload?: Payload | null) => payload is EthereumGasEtherchainV2Payload;
|
|
4
|
+
//# sourceMappingURL=isEthereumGasEtherchainV2Payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEthereumGasEtherchainV2Payload.d.ts","sourceRoot":"","sources":["../../../../src/lib/identities/isEthereumGasEtherchainV2Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAiC,MAAM,iEAAiE,CAAA;AAC/I,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,eAAO,MAAM,gCAAgC,GAAI,UAAU,OAAO,GAAG,IAAI,KAAG,OAAO,IAAI,8BAEtF,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
export declare const isEthereumGasEthersPayload: (payload?: Payload | null) => payload is EthereumGasEthersPayload;
|
|
4
|
+
//# sourceMappingURL=isEthereumGasEthersPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEthereumGasEthersPayload.d.ts","sourceRoot":"","sources":["../../../../src/lib/identities/isEthereumGasEthersPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA2B,MAAM,iDAAiD,CAAA;AACnH,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,eAAO,MAAM,0BAA0B,GAAI,UAAU,OAAO,GAAG,IAAI,KAAG,OAAO,IAAI,wBAEhF,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEtherscanPayload } from '@xyo-network/etherscan-ethereum-gas-payload-plugin';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
export declare const isEthereumGasEtherscanPayload: (payload?: Payload | null) => payload is EthereumGasEtherscanPayload;
|
|
4
|
+
//# sourceMappingURL=isEthereumGasEtherscanPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEthereumGasEtherscanPayload.d.ts","sourceRoot":"","sources":["../../../../src/lib/identities/isEthereumGasEtherscanPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAA8B,MAAM,oDAAoD,CAAA;AAC5H,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,eAAO,MAAM,6BAA6B,GAAI,UAAU,OAAO,GAAG,IAAI,KAAG,OAAO,IAAI,2BAEnF,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEthgasstationPayload } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
export declare const isEthereumGasEthgasstationPayload: (payload?: Payload | null) => payload is EthereumGasEthgasstationPayload;
|
|
4
|
+
//# sourceMappingURL=isEthereumGasEthgasstationPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEthereumGasEthgasstationPayload.d.ts","sourceRoot":"","sources":["../../../../src/lib/identities/isEthereumGasEthgasstationPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAkC,MAAM,wDAAwD,CAAA;AACxI,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,eAAO,MAAM,iCAAiC,GAAI,UAAU,OAAO,GAAG,IAAI,KAAG,OAAO,IAAI,+BAEvF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './transformGasFromBlocknative.ts';
|
|
2
|
+
export * from './transformGasFromEtherchainV2.ts';
|
|
3
|
+
export * from './transformGasFromEthers.ts';
|
|
4
|
+
export * from './transformGasFromEtherscan.ts';
|
|
5
|
+
export * from './transformGasFromEthgasstation.ts';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/transforms/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin';
|
|
2
|
+
import { FeeData } from '@xyo-network/gas-price-payload-plugin';
|
|
3
|
+
export declare const transformGasFromBlocknative: (payload: EthereumGasBlocknativePayload) => FeeData;
|
|
4
|
+
//# sourceMappingURL=transformGasFromBlocknative.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformGasFromBlocknative.d.ts","sourceRoot":"","sources":["../../../../src/lib/transforms/transformGasFromBlocknative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sDAAsD,CAAA;AACpG,OAAO,EACL,OAAO,EACR,MAAM,uCAAuC,CAAA;AA2C9C,eAAO,MAAM,2BAA2B,GAAI,SAAS,6BAA6B,KAAG,OAOpF,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEtherchainV2Payload } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins';
|
|
2
|
+
import { FeeData } from '@xyo-network/gas-price-payload-plugin';
|
|
3
|
+
export declare const transformGasFromEtherchainV2: (payload: EthereumGasEtherchainV2Payload) => FeeData;
|
|
4
|
+
//# sourceMappingURL=transformGasFromEtherchainV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformGasFromEtherchainV2.d.ts","sourceRoot":"","sources":["../../../../src/lib/transforms/transformGasFromEtherchainV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,iEAAiE,CAAA;AAChH,OAAO,EAAE,OAAO,EAAa,MAAM,uCAAuC,CAAA;AAe1E,eAAO,MAAM,4BAA4B,GAAI,SAAS,8BAA8B,KAAG,OAOtF,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin';
|
|
2
|
+
import { FeeData } from '@xyo-network/gas-price-payload-plugin';
|
|
3
|
+
export declare const transformGasFromEthers: (payload: EthereumGasEthersPayload) => FeeData;
|
|
4
|
+
//# sourceMappingURL=transformGasFromEthers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformGasFromEthers.d.ts","sourceRoot":"","sources":["../../../../src/lib/transforms/transformGasFromEthers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAA;AAC1F,OAAO,EACL,OAAO,EACR,MAAM,uCAAuC,CAAA;AAmB9C,eAAO,MAAM,sBAAsB,GAAI,SAAS,wBAAwB,KAAG,OAO1E,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEtherscanPayload } from '@xyo-network/etherscan-ethereum-gas-payload-plugin';
|
|
2
|
+
import { FeeData } from '@xyo-network/gas-price-payload-plugin';
|
|
3
|
+
export declare const transformGasFromEtherscan: (payload: EthereumGasEtherscanPayload) => FeeData;
|
|
4
|
+
//# sourceMappingURL=transformGasFromEtherscan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformGasFromEtherscan.d.ts","sourceRoot":"","sources":["../../../../src/lib/transforms/transformGasFromEtherscan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAA;AAChG,OAAO,EAAE,OAAO,EAAa,MAAM,uCAAuC,CAAA;AAyB1E,eAAO,MAAM,yBAAyB,GAAI,SAAS,2BAA2B,KAAG,OAOhF,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EthereumGasEthgasstationPayload } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin';
|
|
2
|
+
import { FeeData } from '@xyo-network/gas-price-payload-plugin';
|
|
3
|
+
export declare const transformGasFromEthgasstation: (payload: EthereumGasEthgasstationPayload) => FeeData;
|
|
4
|
+
//# sourceMappingURL=transformGasFromEthgasstation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformGasFromEthgasstation.d.ts","sourceRoot":"","sources":["../../../../src/lib/transforms/transformGasFromEthgasstation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAA;AACxG,OAAO,EACL,OAAO,EACR,MAAM,uCAAuC,CAAA;AAsC9C,eAAO,MAAM,6BAA6B,GAAI,SAAS,+BAA+B,KAAG,OAOxF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleBlocknativeGas.d.ts","sourceRoot":"","sources":["../../../src/test/sampleBlocknativeGas.ts"],"names":[],"mappings":"AAAA,OAAO,EACa,6BAA6B,EAChD,MAAM,sDAAsD,CAAA;AAE7D,eAAO,MAAM,oBAAoB,EAAE,6BA0FlC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleEtherchainGasV2.d.ts","sourceRoot":"","sources":["../../../src/test/sampleEtherchainGasV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAiC,MAAM,iEAAiE,CAAA;AAE/I,eAAO,MAAM,qBAAqB,EAAE,8BAYnC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleEthersGas.d.ts","sourceRoot":"","sources":["../../../src/test/sampleEthersGas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA2B,MAAM,iDAAiD,CAAA;AAEnH,eAAO,MAAM,eAAe,EAAE,wBAM7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleEtherscanGas.d.ts","sourceRoot":"","sources":["../../../src/test/sampleEtherscanGas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAA8B,MAAM,oDAAoD,CAAA;AAE5H,eAAO,MAAM,kBAAkB,EAAE,2BAahC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleEthgasstationGas.d.ts","sourceRoot":"","sources":["../../../src/test/sampleEthgasstationGas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAkC,MAAM,wDAAwD,CAAA;AAExI,eAAO,MAAM,sBAAsB,EAAE,+BAiBpC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/gas-price-plugin",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.3",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,32 +30,32 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@xylabs/exists": "^4.5.1",
|
|
33
|
-
"@xyo-network/blocknative-ethereum-gas-payload-plugin": "^3.4.
|
|
34
|
-
"@xyo-network/diviner-abstract": "^3.9.
|
|
35
|
-
"@xyo-network/diviner-model": "^3.9.
|
|
36
|
-
"@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins": "^3.4.
|
|
37
|
-
"@xyo-network/ethers-ethereum-gas-payload-plugin": "^3.4.
|
|
38
|
-
"@xyo-network/etherscan-ethereum-gas-payload-plugin": "^3.4.
|
|
39
|
-
"@xyo-network/ethgasstation-ethereum-gas-payload-plugin": "^3.4.
|
|
40
|
-
"@xyo-network/gas-price-payload-plugin": "^3.4.
|
|
41
|
-
"@xyo-network/module-model": "^3.9.
|
|
42
|
-
"@xyo-network/payload-builder": "^3.9.
|
|
43
|
-
"@xyo-network/payload-model": "^3.9.
|
|
44
|
-
"@xyo-network/payloadset-plugin": "^3.9.
|
|
33
|
+
"@xyo-network/blocknative-ethereum-gas-payload-plugin": "^3.4.3",
|
|
34
|
+
"@xyo-network/diviner-abstract": "^3.9.23",
|
|
35
|
+
"@xyo-network/diviner-model": "^3.9.23",
|
|
36
|
+
"@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins": "^3.4.3",
|
|
37
|
+
"@xyo-network/ethers-ethereum-gas-payload-plugin": "^3.4.3",
|
|
38
|
+
"@xyo-network/etherscan-ethereum-gas-payload-plugin": "^3.4.3",
|
|
39
|
+
"@xyo-network/ethgasstation-ethereum-gas-payload-plugin": "^3.4.3",
|
|
40
|
+
"@xyo-network/gas-price-payload-plugin": "^3.4.3",
|
|
41
|
+
"@xyo-network/module-model": "^3.9.23",
|
|
42
|
+
"@xyo-network/payload-builder": "^3.9.23",
|
|
43
|
+
"@xyo-network/payload-model": "^3.9.23",
|
|
44
|
+
"@xyo-network/payloadset-plugin": "^3.9.23",
|
|
45
45
|
"regression": "^2.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/regression": "^2.0.6",
|
|
49
|
-
"@xylabs/ts-scripts-yarn3": "^5.0.
|
|
50
|
-
"@xylabs/tsconfig": "^5.0.
|
|
49
|
+
"@xylabs/ts-scripts-yarn3": "^5.0.39",
|
|
50
|
+
"@xylabs/tsconfig": "^5.0.39",
|
|
51
51
|
"@xylabs/vitest-extended": "^4.5.1",
|
|
52
|
-
"@xyo-network/blocknative-ethereum-gas-plugin": "^3.4.
|
|
53
|
-
"@xyo-network/etherchain-gas-ethereum-blockchain-plugins": "^3.4.
|
|
54
|
-
"@xyo-network/ethers-ethereum-gas-plugin": "^3.4.
|
|
55
|
-
"@xyo-network/etherscan-ethereum-gas-plugin": "^3.4.
|
|
56
|
-
"@xyo-network/witness-blockchain-abstract": "^3.9.
|
|
57
|
-
"typescript": "^5.
|
|
58
|
-
"vitest": "^3.0.
|
|
52
|
+
"@xyo-network/blocknative-ethereum-gas-plugin": "^3.4.3",
|
|
53
|
+
"@xyo-network/etherchain-gas-ethereum-blockchain-plugins": "^3.4.3",
|
|
54
|
+
"@xyo-network/ethers-ethereum-gas-plugin": "^3.4.3",
|
|
55
|
+
"@xyo-network/etherscan-ethereum-gas-plugin": "^3.4.3",
|
|
56
|
+
"@xyo-network/witness-blockchain-abstract": "^3.9.23",
|
|
57
|
+
"typescript": "^5.8.2",
|
|
58
|
+
"vitest": "^3.0.7"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
package/src/Diviner.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AbstractDiviner } from '@xyo-network/diviner-abstract'
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
3
|
DivinerConfig, DivinerModule, DivinerParams,
|
|
4
4
|
} from '@xyo-network/diviner-model'
|
|
5
5
|
import { EthereumGasSchema } from '@xyo-network/gas-price-payload-plugin'
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import { AnyConfigSchema } from '@xyo-network/module-model'
|
|
7
|
+
import { Payload, Schema } from '@xyo-network/payload-model'
|
|
8
8
|
|
|
9
9
|
import { divineGas } from './lib/index.ts'
|
|
10
10
|
import { EthereumGasDivinerConfigSchema } from './Schema.ts'
|
package/src/lib/average.ts
CHANGED
package/src/lib/divineGas.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
EthereumGasPayload, EthereumGasSchema, FeeData,
|
|
3
|
+
} from '@xyo-network/gas-price-payload-plugin'
|
|
3
4
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
4
|
-
import
|
|
5
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
5
6
|
|
|
6
7
|
import { average } from './average.ts'
|
|
7
8
|
import {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import { EthereumGasBlocknativePayload, EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
4
3
|
|
|
5
4
|
export const isEthereumGasBlocknativePayload = (payload?: Payload | null): payload is EthereumGasBlocknativePayload => {
|
|
6
5
|
return payload?.schema === EthereumGasBlocknativeSchema
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import { EthereumGasEtherchainV2Payload, EthereumGasEtherchainV2Schema } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
4
3
|
|
|
5
4
|
export const isEthereumGasEtherchainV2Payload = (payload?: Payload | null): payload is EthereumGasEtherchainV2Payload => {
|
|
6
5
|
return payload?.schema === EthereumGasEtherchainV2Schema
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
4
3
|
|
|
5
4
|
export const isEthereumGasEthersPayload = (payload?: Payload | null): payload is EthereumGasEthersPayload => {
|
|
6
5
|
return payload?.schema === EthereumGasEthersSchema
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import { EthereumGasEtherscanPayload, EthereumGasEtherscanSchema } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
4
3
|
|
|
5
4
|
export const isEthereumGasEtherscanPayload = (payload?: Payload | null): payload is EthereumGasEtherscanPayload => {
|
|
6
5
|
return payload?.schema === EthereumGasEtherscanSchema
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import { EthereumGasEthgasstationPayload, EthereumGasEthgasstationSchema } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
4
3
|
|
|
5
4
|
export const isEthereumGasEthgasstationPayload = (payload?: Payload | null): payload is EthereumGasEthgasstationPayload => {
|
|
6
5
|
return payload?.schema === EthereumGasEthgasstationSchema
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
2
|
+
import {
|
|
3
3
|
FeeData, FeePerGas, PriorityFeePerGas,
|
|
4
4
|
} from '@xyo-network/gas-price-payload-plugin'
|
|
5
5
|
import regression from 'regression'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { EthereumGasEtherchainV2Payload } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'
|
|
2
|
+
import { FeeData, FeePerGas } from '@xyo-network/gas-price-payload-plugin'
|
|
3
3
|
|
|
4
4
|
const getFeePerGas = (payload: EthereumGasEtherchainV2Payload): Partial<FeePerGas> => {
|
|
5
5
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
2
|
+
import {
|
|
3
3
|
FeeData, FeePerGas, PriorityFeePerGas,
|
|
4
4
|
} from '@xyo-network/gas-price-payload-plugin'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { EthereumGasEtherscanPayload } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'
|
|
2
|
+
import { FeeData, FeePerGas } from '@xyo-network/gas-price-payload-plugin'
|
|
3
3
|
import regression from 'regression'
|
|
4
4
|
|
|
5
5
|
const getBaseFee = (payload: EthereumGasEtherscanPayload): number | undefined => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { EthereumGasEthgasstationPayload } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'
|
|
2
|
+
import {
|
|
3
3
|
FeeData, FeePerGas, PriorityFeePerGas,
|
|
4
4
|
} from '@xyo-network/gas-price-payload-plugin'
|
|
5
5
|
import regression from 'regression'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
EstimatedBaseFee, EthereumGasBlocknativePayload, EthereumGasBlocknativeSchema,
|
|
3
|
+
} from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
|
|
3
4
|
|
|
4
5
|
export const sampleBlocknativeGas: EthereumGasBlocknativePayload = {
|
|
5
6
|
blockPrices: [
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EthereumGasEtherchainV2Schema } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'
|
|
1
|
+
import { EthereumGasEtherchainV2Payload, EthereumGasEtherchainV2Schema } from '@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins'
|
|
3
2
|
|
|
4
3
|
export const sampleEtherchainGasV2: EthereumGasEtherchainV2Payload = {
|
|
5
4
|
code: 200,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
1
|
+
import { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
3
2
|
|
|
4
3
|
export const sampleEthersGas: EthereumGasEthersPayload = {
|
|
5
4
|
gasPrice: 13_547_863_640,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EthereumGasEtherscanSchema } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'
|
|
1
|
+
import { EthereumGasEtherscanPayload, EthereumGasEtherscanSchema } from '@xyo-network/etherscan-ethereum-gas-payload-plugin'
|
|
3
2
|
|
|
4
3
|
export const sampleEtherscanGas: EthereumGasEtherscanPayload = {
|
|
5
4
|
message: 'OK',
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EthereumGasEthgasstationSchema } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'
|
|
1
|
+
import { EthereumGasEthgasstationPayload, EthereumGasEthgasstationSchema } from '@xyo-network/ethgasstation-ethereum-gas-payload-plugin'
|
|
3
2
|
|
|
4
3
|
export const sampleEthgasstationGas: EthereumGasEthgasstationPayload = {
|
|
5
4
|
baseFee: 10,
|
package/xy.config.ts
CHANGED