@xyo-network/ethers-ethereum-gas-plugin 2.99.3 → 2.99.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Config.d.cts +1 -1
- package/dist/browser/Config.d.mts +1 -1
- package/dist/browser/Config.d.ts +1 -1
- package/dist/browser/Plugin.d.cts +2 -2
- package/dist/browser/Plugin.d.mts +2 -2
- package/dist/browser/Plugin.d.ts +2 -2
- package/dist/browser/Witness.d.cts +1 -1
- package/dist/browser/Witness.d.mts +1 -1
- package/dist/browser/Witness.d.ts +1 -1
- package/dist/browser/index.cjs +28 -15
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +4 -4
- package/dist/browser/index.d.mts +4 -4
- package/dist/browser/index.d.ts +4 -4
- package/dist/browser/{index.js → index.mjs} +31 -16
- package/dist/{node/index.js.map → browser/index.mjs.map} +1 -1
- package/dist/browser/lib/index.d.cts +1 -1
- package/dist/browser/lib/index.d.mts +1 -1
- package/dist/browser/lib/index.d.ts +1 -1
- package/dist/neutral/Config.d.cts +1 -1
- package/dist/neutral/Config.d.mts +1 -1
- package/dist/neutral/Config.d.ts +1 -1
- package/dist/neutral/Plugin.d.cts +2 -2
- package/dist/neutral/Plugin.d.mts +2 -2
- package/dist/neutral/Plugin.d.ts +2 -2
- package/dist/neutral/Witness.d.cts +1 -1
- package/dist/neutral/Witness.d.mts +1 -1
- package/dist/neutral/Witness.d.ts +1 -1
- package/dist/neutral/index.cjs +28 -15
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.d.cts +4 -4
- package/dist/neutral/index.d.mts +4 -4
- package/dist/neutral/index.d.ts +4 -4
- package/dist/neutral/{index.js → index.mjs} +31 -16
- package/dist/{browser/index.js.map → neutral/index.mjs.map} +1 -1
- package/dist/neutral/lib/index.d.cts +1 -1
- package/dist/neutral/lib/index.d.mts +1 -1
- package/dist/neutral/lib/index.d.ts +1 -1
- package/dist/node/Config.d.cts +1 -1
- package/dist/node/Config.d.mts +1 -1
- package/dist/node/Config.d.ts +1 -1
- package/dist/node/Plugin.d.cts +2 -2
- package/dist/node/Plugin.d.mts +2 -2
- package/dist/node/Plugin.d.ts +2 -2
- package/dist/node/Witness.d.cts +1 -1
- package/dist/node/Witness.d.mts +1 -1
- package/dist/node/Witness.d.ts +1 -1
- package/dist/node/index.cjs +34 -17
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +4 -4
- package/dist/node/index.d.mts +4 -4
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.mjs +80 -0
- package/dist/{neutral/index.js.map → node/index.mjs.map} +1 -1
- package/dist/node/lib/index.d.cts +1 -1
- package/dist/node/lib/index.d.mts +1 -1
- package/dist/node/lib/index.d.ts +1 -1
- package/package.json +19 -20
- package/src/Config.ts +1 -1
- package/src/Plugin.ts +1 -1
- package/src/Witness.ts +3 -3
- package/src/index.ts +4 -4
- package/src/lib/index.ts +1 -1
- package/dist/node/index.js +0 -61
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WitnessConfig } from '@xyo-network/witness-model';
|
|
2
|
-
import { EthereumGasEthersWitnessConfigSchema } from './Schema.
|
|
2
|
+
import { EthereumGasEthersWitnessConfigSchema } from './Schema.ts';
|
|
3
3
|
export type EthereumGasEthersWitnessConfig = WitnessConfig<{
|
|
4
4
|
schema: EthereumGasEthersWitnessConfigSchema;
|
|
5
5
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WitnessConfig } from '@xyo-network/witness-model';
|
|
2
|
-
import { EthereumGasEthersWitnessConfigSchema } from './Schema.
|
|
2
|
+
import { EthereumGasEthersWitnessConfigSchema } from './Schema.ts';
|
|
3
3
|
export type EthereumGasEthersWitnessConfig = WitnessConfig<{
|
|
4
4
|
schema: EthereumGasEthersWitnessConfigSchema;
|
|
5
5
|
}>;
|
package/dist/browser/Config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WitnessConfig } from '@xyo-network/witness-model';
|
|
2
|
-
import { EthereumGasEthersWitnessConfigSchema } from './Schema.
|
|
2
|
+
import { EthereumGasEthersWitnessConfigSchema } from './Schema.ts';
|
|
3
3
|
export type EthereumGasEthersWitnessConfig = WitnessConfig<{
|
|
4
4
|
schema: EthereumGasEthersWitnessConfigSchema;
|
|
5
5
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGasEthersWitness } from './Witness.
|
|
1
|
+
import { EthereumGasEthersWitness } from './Witness.ts';
|
|
2
2
|
export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xylabs/object").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
4
4
|
addToResolvers?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
|
|
|
7
7
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
8
8
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
9
9
|
} & {
|
|
10
|
-
schema: import("./Schema.
|
|
10
|
+
schema: import("./Schema.ts").EthereumGasEthersWitnessConfigSchema;
|
|
11
11
|
}, "schema"> & {
|
|
12
12
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
13
13
|
}, "schema"> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGasEthersWitness } from './Witness.
|
|
1
|
+
import { EthereumGasEthersWitness } from './Witness.ts';
|
|
2
2
|
export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xylabs/object").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
4
4
|
addToResolvers?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
|
|
|
7
7
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
8
8
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
9
9
|
} & {
|
|
10
|
-
schema: import("./Schema.
|
|
10
|
+
schema: import("./Schema.ts").EthereumGasEthersWitnessConfigSchema;
|
|
11
11
|
}, "schema"> & {
|
|
12
12
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
13
13
|
}, "schema"> & {
|
package/dist/browser/Plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGasEthersWitness } from './Witness.
|
|
1
|
+
import { EthereumGasEthersWitness } from './Witness.ts';
|
|
2
2
|
export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xylabs/object").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
4
4
|
addToResolvers?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
|
|
|
7
7
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
8
8
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
9
9
|
} & {
|
|
10
|
-
schema: import("./Schema.
|
|
10
|
+
schema: import("./Schema.ts").EthereumGasEthersWitnessConfigSchema;
|
|
11
11
|
}, "schema"> & {
|
|
12
12
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
13
13
|
}, "schema"> & {
|
|
@@ -3,7 +3,7 @@ import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
|
3
3
|
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
4
4
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
5
|
import { Provider } from 'ethers';
|
|
6
|
-
import { EthereumGasEthersWitnessConfig } from './Config.
|
|
6
|
+
import { EthereumGasEthersWitnessConfig } from './Config.ts';
|
|
7
7
|
export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
|
|
8
8
|
provider?: Provider;
|
|
9
9
|
}>;
|
|
@@ -3,7 +3,7 @@ import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
|
3
3
|
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
4
4
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
5
|
import { Provider } from 'ethers';
|
|
6
|
-
import { EthereumGasEthersWitnessConfig } from './Config.
|
|
6
|
+
import { EthereumGasEthersWitnessConfig } from './Config.ts';
|
|
7
7
|
export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
|
|
8
8
|
provider?: Provider;
|
|
9
9
|
}>;
|
|
@@ -3,7 +3,7 @@ import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
|
3
3
|
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
4
4
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
5
|
import { Provider } from 'ethers';
|
|
6
|
-
import { EthereumGasEthersWitnessConfig } from './Config.
|
|
6
|
+
import { EthereumGasEthersWitnessConfig } from './Config.ts';
|
|
7
7
|
export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
|
|
8
8
|
provider?: Provider;
|
|
9
9
|
}>;
|
package/dist/browser/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -39,10 +40,10 @@ var import_ethers_ethereum_gas_payload_plugin = require("@xyo-network/ethers-eth
|
|
|
39
40
|
var import_payload_builder = require("@xyo-network/payload-builder");
|
|
40
41
|
|
|
41
42
|
// src/lib/getGasFromEthers.ts
|
|
42
|
-
var formatFeeDataValue = (value) => {
|
|
43
|
+
var formatFeeDataValue = /* @__PURE__ */ __name((value) => {
|
|
43
44
|
return value ? Number(value) : null;
|
|
44
|
-
};
|
|
45
|
-
var getGasFromEthers = async (provider) => {
|
|
45
|
+
}, "formatFeeDataValue");
|
|
46
|
+
var getGasFromEthers = /* @__PURE__ */ __name(async (provider) => {
|
|
46
47
|
const feeData = await provider.getFeeData();
|
|
47
48
|
const formattedFeeData = {
|
|
48
49
|
gasPrice: formatFeeDataValue(feeData.gasPrice),
|
|
@@ -51,14 +52,20 @@ var getGasFromEthers = async (provider) => {
|
|
|
51
52
|
timestamp: Date.now()
|
|
52
53
|
};
|
|
53
54
|
return formattedFeeData;
|
|
54
|
-
};
|
|
55
|
+
}, "getGasFromEthers");
|
|
55
56
|
|
|
56
57
|
// src/Schema.ts
|
|
57
58
|
var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
58
59
|
|
|
59
60
|
// src/Witness.ts
|
|
60
61
|
var EthereumGasEthersWitness = class extends import_abstract_witness.AbstractWitness {
|
|
61
|
-
static
|
|
62
|
+
static {
|
|
63
|
+
__name(this, "EthereumGasEthersWitness");
|
|
64
|
+
}
|
|
65
|
+
static configSchemas = [
|
|
66
|
+
...super.configSchemas,
|
|
67
|
+
EthereumGasEthersWitnessConfigSchema
|
|
68
|
+
];
|
|
62
69
|
static defaultConfigSchema = EthereumGasEthersWitnessConfigSchema;
|
|
63
70
|
_provider;
|
|
64
71
|
get provider() {
|
|
@@ -66,18 +73,24 @@ var EthereumGasEthersWitness = class extends import_abstract_witness.AbstractWit
|
|
|
66
73
|
return this._provider;
|
|
67
74
|
}
|
|
68
75
|
async observeHandler() {
|
|
69
|
-
const payload = await new import_payload_builder.PayloadBuilder({
|
|
70
|
-
|
|
76
|
+
const payload = await new import_payload_builder.PayloadBuilder({
|
|
77
|
+
schema: import_ethers_ethereum_gas_payload_plugin.EthereumGasEthersSchema
|
|
78
|
+
}).fields(await getGasFromEthers((0, import_assert.assertEx)(this.provider, () => "Provider Required"))).build();
|
|
79
|
+
return [
|
|
80
|
+
payload
|
|
81
|
+
];
|
|
71
82
|
}
|
|
72
83
|
};
|
|
73
84
|
|
|
74
85
|
// src/Plugin.ts
|
|
75
|
-
var EthereumGasEthersPlugin = () => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
86
|
+
var EthereumGasEthersPlugin = /* @__PURE__ */ __name(() => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)({
|
|
87
|
+
required: {
|
|
88
|
+
[import_ethers_ethereum_gas_payload_plugin2.EthereumGasEthersSchema]: 1
|
|
89
|
+
},
|
|
90
|
+
schema: import_payload_model.PayloadSetSchema
|
|
91
|
+
}, {
|
|
92
|
+
witness: /* @__PURE__ */ __name(async (params) => {
|
|
93
|
+
return await EthereumGasEthersWitness.create(params);
|
|
94
|
+
}, "witness")
|
|
95
|
+
}), "EthereumGasEthersPlugin");
|
|
83
96
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromEthers.ts","../../src/Schema.ts"],"sourcesContent":["export * from './Config.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromEthers.ts","../../src/Schema.ts"],"sourcesContent":["export * from './Config.ts'\n// eslint-disable-next-line import/no-default-export\nexport { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.ts'\nexport * from './Schema.ts'\nexport * from './Witness.ts'\n","import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasEthersWitness } from './Witness.ts'\n\nexport const EthereumGasEthersPlugin = () =>\n createPayloadSetWitnessPlugin<EthereumGasEthersWitness>(\n { required: { [EthereumGasEthersSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await EthereumGasEthersWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, Schema } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { Provider } from 'ethers'\n\nimport { EthereumGasEthersWitnessConfig } from './Config.ts'\nimport { getGasFromEthers } from './lib/index.ts'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.ts'\n\nexport type EthereumGasEthersWitnessParams = WitnessParams<\n AnyConfigSchema<EthereumGasEthersWitnessConfig>,\n {\n provider?: Provider\n }\n>\n\nexport class EthereumGasEthersWitness<\n TParams extends EthereumGasEthersWitnessParams = EthereumGasEthersWitnessParams,\n> extends AbstractWitness<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasEthersWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = EthereumGasEthersWitnessConfigSchema\n\n private _provider?: Provider\n\n protected get provider() {\n this._provider = this._provider ?? this.params?.provider\n return this._provider\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const payload = await new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })\n .fields(await getGasFromEthers(assertEx(this.provider, () => 'Provider Required')))\n .build()\n return [payload]\n }\n}\n","import { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { Provider } from 'ethers'\n\nconst formatFeeDataValue = (value: bigint | null) => {\n return value ? Number(value) : null\n}\n\nexport const getGasFromEthers = async (provider: Provider): Promise<EthereumGasEthersResponse> => {\n // https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData\n const feeData = await provider.getFeeData()\n const formattedFeeData: EthereumGasEthersResponse = {\n gasPrice: formatFeeDataValue(feeData.gasPrice),\n maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),\n maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),\n timestamp: Date.now(),\n }\n return formattedFeeData\n}\n","export type EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'\nexport const EthereumGasEthersWitnessConfigSchema: EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA,IAAAA,6CAAwC;AACxC,2BAAiC;AACjC,+BAA8C;;;ACF9C,oBAAyB;AACzB,8BAAgC;AAChC,gDAAkE;AAElE,6BAA+B;;;ACD/B,IAAMC,qBAAqB,wBAACC,UAAAA;AAC1B,SAAOA,QAAQC,OAAOD,KAAAA,IAAS;AACjC,GAF2B;AAIpB,IAAME,mBAAmB,8BAAOC,aAAAA;AAErC,QAAMC,UAAU,MAAMD,SAASE,WAAU;AACzC,QAAMC,mBAA8C;IAClDC,UAAUR,mBAAmBK,QAAQG,QAAQ;IAC7CC,cAAcT,mBAAmBK,QAAQI,YAAY;IACrDC,sBAAsBV,mBAAmBK,QAAQK,oBAAoB;IACrEC,WAAWC,KAAKC,IAAG;EACrB;AACA,SAAON;AACT,GAVgC;;;ACNzB,IAAMO,uCAA6E;;;AFmBnF,IAAMC,2BAAN,cAEGC,wCAAAA;EAtBV,OAsBUA;;;EACR,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAE/CE;EAER,IAAcC,WAAW;AACvB,SAAKD,YAAY,KAAKA,aAAa,KAAKE,QAAQD;AAChD,WAAO,KAAKD;EACd;EAEA,MAAyBG,iBAAqC;AAC5D,UAAMC,UAAU,MAAM,IAAIC,sCAAyC;MAAEC,QAAQC;IAAwB,CAAA,EAClGC,OAAO,MAAMC,qBAAiBC,wBAAS,KAAKT,UAAU,MAAM,mBAAA,CAAA,CAAA,EAC5DU,MAAK;AACR,WAAO;MAACP;;EACV;AACF;;;ADjCO,IAAMQ,0BAA0B,iCACrCC,wDACE;EAAEC,UAAU;IAAE,CAACC,kEAAAA,GAA0B;EAAE;EAAGC,QAAQC;AAAiB,GACvE;EACEC,SAAS,8BAAOC,WAAAA;AACd,WAAO,MAAMC,yBAAyBC,OAAOF,MAAAA;EAC/C,GAFS;AAGX,CAAA,GAPmC;","names":["import_ethers_ethereum_gas_payload_plugin","formatFeeDataValue","value","Number","getGasFromEthers","provider","feeData","getFeeData","formattedFeeData","gasPrice","maxFeePerGas","maxPriorityFeePerGas","timestamp","Date","now","EthereumGasEthersWitnessConfigSchema","EthereumGasEthersWitness","AbstractWitness","configSchemas","EthereumGasEthersWitnessConfigSchema","defaultConfigSchema","_provider","provider","params","observeHandler","payload","PayloadBuilder","schema","EthereumGasEthersSchema","fields","getGasFromEthers","assertEx","build","EthereumGasEthersPlugin","createPayloadSetWitnessPlugin","required","EthereumGasEthersSchema","schema","PayloadSetSchema","witness","params","EthereumGasEthersWitness","create"]}
|
package/dist/browser/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Config.
|
|
2
|
-
export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.
|
|
3
|
-
export * from './Schema.
|
|
4
|
-
export * from './Witness.
|
|
1
|
+
export * from './Config.ts';
|
|
2
|
+
export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.ts';
|
|
3
|
+
export * from './Schema.ts';
|
|
4
|
+
export * from './Witness.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/browser/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Config.
|
|
2
|
-
export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.
|
|
3
|
-
export * from './Schema.
|
|
4
|
-
export * from './Witness.
|
|
1
|
+
export * from './Config.ts';
|
|
2
|
+
export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.ts';
|
|
3
|
+
export * from './Schema.ts';
|
|
4
|
+
export * from './Witness.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Config.
|
|
2
|
-
export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.
|
|
3
|
-
export * from './Schema.
|
|
4
|
-
export * from './Witness.
|
|
1
|
+
export * from './Config.ts';
|
|
2
|
+
export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.ts';
|
|
3
|
+
export * from './Schema.ts';
|
|
4
|
+
export * from './Witness.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/Plugin.ts
|
|
2
5
|
import { EthereumGasEthersSchema as EthereumGasEthersSchema2 } from "@xyo-network/ethers-ethereum-gas-payload-plugin";
|
|
3
6
|
import { PayloadSetSchema } from "@xyo-network/payload-model";
|
|
@@ -10,10 +13,10 @@ import { EthereumGasEthersSchema } from "@xyo-network/ethers-ethereum-gas-payloa
|
|
|
10
13
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
11
14
|
|
|
12
15
|
// src/lib/getGasFromEthers.ts
|
|
13
|
-
var formatFeeDataValue = (value) => {
|
|
16
|
+
var formatFeeDataValue = /* @__PURE__ */ __name((value) => {
|
|
14
17
|
return value ? Number(value) : null;
|
|
15
|
-
};
|
|
16
|
-
var getGasFromEthers = async (provider) => {
|
|
18
|
+
}, "formatFeeDataValue");
|
|
19
|
+
var getGasFromEthers = /* @__PURE__ */ __name(async (provider) => {
|
|
17
20
|
const feeData = await provider.getFeeData();
|
|
18
21
|
const formattedFeeData = {
|
|
19
22
|
gasPrice: formatFeeDataValue(feeData.gasPrice),
|
|
@@ -22,14 +25,20 @@ var getGasFromEthers = async (provider) => {
|
|
|
22
25
|
timestamp: Date.now()
|
|
23
26
|
};
|
|
24
27
|
return formattedFeeData;
|
|
25
|
-
};
|
|
28
|
+
}, "getGasFromEthers");
|
|
26
29
|
|
|
27
30
|
// src/Schema.ts
|
|
28
31
|
var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
29
32
|
|
|
30
33
|
// src/Witness.ts
|
|
31
34
|
var EthereumGasEthersWitness = class extends AbstractWitness {
|
|
32
|
-
static
|
|
35
|
+
static {
|
|
36
|
+
__name(this, "EthereumGasEthersWitness");
|
|
37
|
+
}
|
|
38
|
+
static configSchemas = [
|
|
39
|
+
...super.configSchemas,
|
|
40
|
+
EthereumGasEthersWitnessConfigSchema
|
|
41
|
+
];
|
|
33
42
|
static defaultConfigSchema = EthereumGasEthersWitnessConfigSchema;
|
|
34
43
|
_provider;
|
|
35
44
|
get provider() {
|
|
@@ -37,24 +46,30 @@ var EthereumGasEthersWitness = class extends AbstractWitness {
|
|
|
37
46
|
return this._provider;
|
|
38
47
|
}
|
|
39
48
|
async observeHandler() {
|
|
40
|
-
const payload = await new PayloadBuilder({
|
|
41
|
-
|
|
49
|
+
const payload = await new PayloadBuilder({
|
|
50
|
+
schema: EthereumGasEthersSchema
|
|
51
|
+
}).fields(await getGasFromEthers(assertEx(this.provider, () => "Provider Required"))).build();
|
|
52
|
+
return [
|
|
53
|
+
payload
|
|
54
|
+
];
|
|
42
55
|
}
|
|
43
56
|
};
|
|
44
57
|
|
|
45
58
|
// src/Plugin.ts
|
|
46
|
-
var EthereumGasEthersPlugin = () => createPayloadSetWitnessPlugin(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
59
|
+
var EthereumGasEthersPlugin = /* @__PURE__ */ __name(() => createPayloadSetWitnessPlugin({
|
|
60
|
+
required: {
|
|
61
|
+
[EthereumGasEthersSchema2]: 1
|
|
62
|
+
},
|
|
63
|
+
schema: PayloadSetSchema
|
|
64
|
+
}, {
|
|
65
|
+
witness: /* @__PURE__ */ __name(async (params) => {
|
|
66
|
+
return await EthereumGasEthersWitness.create(params);
|
|
67
|
+
}, "witness")
|
|
68
|
+
}), "EthereumGasEthersPlugin");
|
|
54
69
|
export {
|
|
55
70
|
EthereumGasEthersPlugin,
|
|
56
71
|
EthereumGasEthersWitness,
|
|
57
72
|
EthereumGasEthersWitnessConfigSchema,
|
|
58
73
|
EthereumGasEthersPlugin as default
|
|
59
74
|
};
|
|
60
|
-
//# sourceMappingURL=index.
|
|
75
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromEthers.ts","../../src/Schema.ts"],"sourcesContent":["import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasEthersWitness } from './Witness.
|
|
1
|
+
{"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromEthers.ts","../../src/Schema.ts"],"sourcesContent":["import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasEthersWitness } from './Witness.ts'\n\nexport const EthereumGasEthersPlugin = () =>\n createPayloadSetWitnessPlugin<EthereumGasEthersWitness>(\n { required: { [EthereumGasEthersSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await EthereumGasEthersWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, Schema } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { Provider } from 'ethers'\n\nimport { EthereumGasEthersWitnessConfig } from './Config.ts'\nimport { getGasFromEthers } from './lib/index.ts'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.ts'\n\nexport type EthereumGasEthersWitnessParams = WitnessParams<\n AnyConfigSchema<EthereumGasEthersWitnessConfig>,\n {\n provider?: Provider\n }\n>\n\nexport class EthereumGasEthersWitness<\n TParams extends EthereumGasEthersWitnessParams = EthereumGasEthersWitnessParams,\n> extends AbstractWitness<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasEthersWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = EthereumGasEthersWitnessConfigSchema\n\n private _provider?: Provider\n\n protected get provider() {\n this._provider = this._provider ?? this.params?.provider\n return this._provider\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const payload = await new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })\n .fields(await getGasFromEthers(assertEx(this.provider, () => 'Provider Required')))\n .build()\n return [payload]\n }\n}\n","import { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { Provider } from 'ethers'\n\nconst formatFeeDataValue = (value: bigint | null) => {\n return value ? Number(value) : null\n}\n\nexport const getGasFromEthers = async (provider: Provider): Promise<EthereumGasEthersResponse> => {\n // https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData\n const feeData = await provider.getFeeData()\n const formattedFeeData: EthereumGasEthersResponse = {\n gasPrice: formatFeeDataValue(feeData.gasPrice),\n maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),\n maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),\n timestamp: Date.now(),\n }\n return formattedFeeData\n}\n","export type EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'\nexport const EthereumGasEthersWitnessConfigSchema: EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'\n"],"mappings":";;;;AAAA,SAASA,2BAAAA,gCAA+B;AACxC,SAASC,wBAAwB;AACjC,SAASC,qCAAqC;;;ACF9C,SAASC,gBAAgB;AACzB,SAASC,uBAAuB;AAChC,SAAmCC,+BAA+B;AAElE,SAASC,sBAAsB;;;ACD/B,IAAMC,qBAAqB,wBAACC,UAAAA;AAC1B,SAAOA,QAAQC,OAAOD,KAAAA,IAAS;AACjC,GAF2B;AAIpB,IAAME,mBAAmB,8BAAOC,aAAAA;AAErC,QAAMC,UAAU,MAAMD,SAASE,WAAU;AACzC,QAAMC,mBAA8C;IAClDC,UAAUR,mBAAmBK,QAAQG,QAAQ;IAC7CC,cAAcT,mBAAmBK,QAAQI,YAAY;IACrDC,sBAAsBV,mBAAmBK,QAAQK,oBAAoB;IACrEC,WAAWC,KAAKC,IAAG;EACrB;AACA,SAAON;AACT,GAVgC;;;ACNzB,IAAMO,uCAA6E;;;AFmBnF,IAAMC,2BAAN,cAEGC,gBAAAA;EAtBV,OAsBUA;;;EACR,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAE/CE;EAER,IAAcC,WAAW;AACvB,SAAKD,YAAY,KAAKA,aAAa,KAAKE,QAAQD;AAChD,WAAO,KAAKD;EACd;EAEA,MAAyBG,iBAAqC;AAC5D,UAAMC,UAAU,MAAM,IAAIC,eAAyC;MAAEC,QAAQC;IAAwB,CAAA,EAClGC,OAAO,MAAMC,iBAAiBC,SAAS,KAAKT,UAAU,MAAM,mBAAA,CAAA,CAAA,EAC5DU,MAAK;AACR,WAAO;MAACP;;EACV;AACF;;;ADjCO,IAAMQ,0BAA0B,6BACrCC,8BACE;EAAEC,UAAU;IAAE,CAACC,wBAAAA,GAA0B;EAAE;EAAGC,QAAQC;AAAiB,GACvE;EACEC,SAAS,8BAAOC,WAAAA;AACd,WAAO,MAAMC,yBAAyBC,OAAOF,MAAAA;EAC/C,GAFS;AAGX,CAAA,GAPmC;","names":["EthereumGasEthersSchema","PayloadSetSchema","createPayloadSetWitnessPlugin","assertEx","AbstractWitness","EthereumGasEthersSchema","PayloadBuilder","formatFeeDataValue","value","Number","getGasFromEthers","provider","feeData","getFeeData","formattedFeeData","gasPrice","maxFeePerGas","maxPriorityFeePerGas","timestamp","Date","now","EthereumGasEthersWitnessConfigSchema","EthereumGasEthersWitness","AbstractWitness","configSchemas","EthereumGasEthersWitnessConfigSchema","defaultConfigSchema","_provider","provider","params","observeHandler","payload","PayloadBuilder","schema","EthereumGasEthersSchema","fields","getGasFromEthers","assertEx","build","EthereumGasEthersPlugin","createPayloadSetWitnessPlugin","required","EthereumGasEthersSchema","schema","PayloadSetSchema","witness","params","EthereumGasEthersWitness","create"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './getGasFromEthers.
|
|
1
|
+
export * from './getGasFromEthers.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './getGasFromEthers.
|
|
1
|
+
export * from './getGasFromEthers.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './getGasFromEthers.
|
|
1
|
+
export * from './getGasFromEthers.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WitnessConfig } from '@xyo-network/witness-model';
|
|
2
|
-
import { EthereumGasEthersWitnessConfigSchema } from './Schema.
|
|
2
|
+
import { EthereumGasEthersWitnessConfigSchema } from './Schema.ts';
|
|
3
3
|
export type EthereumGasEthersWitnessConfig = WitnessConfig<{
|
|
4
4
|
schema: EthereumGasEthersWitnessConfigSchema;
|
|
5
5
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WitnessConfig } from '@xyo-network/witness-model';
|
|
2
|
-
import { EthereumGasEthersWitnessConfigSchema } from './Schema.
|
|
2
|
+
import { EthereumGasEthersWitnessConfigSchema } from './Schema.ts';
|
|
3
3
|
export type EthereumGasEthersWitnessConfig = WitnessConfig<{
|
|
4
4
|
schema: EthereumGasEthersWitnessConfigSchema;
|
|
5
5
|
}>;
|
package/dist/neutral/Config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WitnessConfig } from '@xyo-network/witness-model';
|
|
2
|
-
import { EthereumGasEthersWitnessConfigSchema } from './Schema.
|
|
2
|
+
import { EthereumGasEthersWitnessConfigSchema } from './Schema.ts';
|
|
3
3
|
export type EthereumGasEthersWitnessConfig = WitnessConfig<{
|
|
4
4
|
schema: EthereumGasEthersWitnessConfigSchema;
|
|
5
5
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGasEthersWitness } from './Witness.
|
|
1
|
+
import { EthereumGasEthersWitness } from './Witness.ts';
|
|
2
2
|
export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xylabs/object").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
4
4
|
addToResolvers?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
|
|
|
7
7
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
8
8
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
9
9
|
} & {
|
|
10
|
-
schema: import("./Schema.
|
|
10
|
+
schema: import("./Schema.ts").EthereumGasEthersWitnessConfigSchema;
|
|
11
11
|
}, "schema"> & {
|
|
12
12
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
13
13
|
}, "schema"> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGasEthersWitness } from './Witness.
|
|
1
|
+
import { EthereumGasEthersWitness } from './Witness.ts';
|
|
2
2
|
export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xylabs/object").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
4
4
|
addToResolvers?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
|
|
|
7
7
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
8
8
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
9
9
|
} & {
|
|
10
|
-
schema: import("./Schema.
|
|
10
|
+
schema: import("./Schema.ts").EthereumGasEthersWitnessConfigSchema;
|
|
11
11
|
}, "schema"> & {
|
|
12
12
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
13
13
|
}, "schema"> & {
|
package/dist/neutral/Plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGasEthersWitness } from './Witness.
|
|
1
|
+
import { EthereumGasEthersWitness } from './Witness.ts';
|
|
2
2
|
export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xylabs/object").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
4
4
|
addToResolvers?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
|
|
|
7
7
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
8
8
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
9
9
|
} & {
|
|
10
|
-
schema: import("./Schema.
|
|
10
|
+
schema: import("./Schema.ts").EthereumGasEthersWitnessConfigSchema;
|
|
11
11
|
}, "schema"> & {
|
|
12
12
|
schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
13
13
|
}, "schema"> & {
|
|
@@ -3,7 +3,7 @@ import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
|
3
3
|
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
4
4
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
5
|
import { Provider } from 'ethers';
|
|
6
|
-
import { EthereumGasEthersWitnessConfig } from './Config.
|
|
6
|
+
import { EthereumGasEthersWitnessConfig } from './Config.ts';
|
|
7
7
|
export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
|
|
8
8
|
provider?: Provider;
|
|
9
9
|
}>;
|
|
@@ -3,7 +3,7 @@ import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
|
3
3
|
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
4
4
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
5
|
import { Provider } from 'ethers';
|
|
6
|
-
import { EthereumGasEthersWitnessConfig } from './Config.
|
|
6
|
+
import { EthereumGasEthersWitnessConfig } from './Config.ts';
|
|
7
7
|
export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
|
|
8
8
|
provider?: Provider;
|
|
9
9
|
}>;
|
|
@@ -3,7 +3,7 @@ import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
|
3
3
|
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
4
4
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
5
|
import { Provider } from 'ethers';
|
|
6
|
-
import { EthereumGasEthersWitnessConfig } from './Config.
|
|
6
|
+
import { EthereumGasEthersWitnessConfig } from './Config.ts';
|
|
7
7
|
export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
|
|
8
8
|
provider?: Provider;
|
|
9
9
|
}>;
|
package/dist/neutral/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -39,10 +40,10 @@ var import_ethers_ethereum_gas_payload_plugin = require("@xyo-network/ethers-eth
|
|
|
39
40
|
var import_payload_builder = require("@xyo-network/payload-builder");
|
|
40
41
|
|
|
41
42
|
// src/lib/getGasFromEthers.ts
|
|
42
|
-
var formatFeeDataValue = (value) => {
|
|
43
|
+
var formatFeeDataValue = /* @__PURE__ */ __name((value) => {
|
|
43
44
|
return value ? Number(value) : null;
|
|
44
|
-
};
|
|
45
|
-
var getGasFromEthers = async (provider) => {
|
|
45
|
+
}, "formatFeeDataValue");
|
|
46
|
+
var getGasFromEthers = /* @__PURE__ */ __name(async (provider) => {
|
|
46
47
|
const feeData = await provider.getFeeData();
|
|
47
48
|
const formattedFeeData = {
|
|
48
49
|
gasPrice: formatFeeDataValue(feeData.gasPrice),
|
|
@@ -51,14 +52,20 @@ var getGasFromEthers = async (provider) => {
|
|
|
51
52
|
timestamp: Date.now()
|
|
52
53
|
};
|
|
53
54
|
return formattedFeeData;
|
|
54
|
-
};
|
|
55
|
+
}, "getGasFromEthers");
|
|
55
56
|
|
|
56
57
|
// src/Schema.ts
|
|
57
58
|
var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
|
|
58
59
|
|
|
59
60
|
// src/Witness.ts
|
|
60
61
|
var EthereumGasEthersWitness = class extends import_abstract_witness.AbstractWitness {
|
|
61
|
-
static
|
|
62
|
+
static {
|
|
63
|
+
__name(this, "EthereumGasEthersWitness");
|
|
64
|
+
}
|
|
65
|
+
static configSchemas = [
|
|
66
|
+
...super.configSchemas,
|
|
67
|
+
EthereumGasEthersWitnessConfigSchema
|
|
68
|
+
];
|
|
62
69
|
static defaultConfigSchema = EthereumGasEthersWitnessConfigSchema;
|
|
63
70
|
_provider;
|
|
64
71
|
get provider() {
|
|
@@ -66,18 +73,24 @@ var EthereumGasEthersWitness = class extends import_abstract_witness.AbstractWit
|
|
|
66
73
|
return this._provider;
|
|
67
74
|
}
|
|
68
75
|
async observeHandler() {
|
|
69
|
-
const payload = await new import_payload_builder.PayloadBuilder({
|
|
70
|
-
|
|
76
|
+
const payload = await new import_payload_builder.PayloadBuilder({
|
|
77
|
+
schema: import_ethers_ethereum_gas_payload_plugin.EthereumGasEthersSchema
|
|
78
|
+
}).fields(await getGasFromEthers((0, import_assert.assertEx)(this.provider, () => "Provider Required"))).build();
|
|
79
|
+
return [
|
|
80
|
+
payload
|
|
81
|
+
];
|
|
71
82
|
}
|
|
72
83
|
};
|
|
73
84
|
|
|
74
85
|
// src/Plugin.ts
|
|
75
|
-
var EthereumGasEthersPlugin = () => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
86
|
+
var EthereumGasEthersPlugin = /* @__PURE__ */ __name(() => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)({
|
|
87
|
+
required: {
|
|
88
|
+
[import_ethers_ethereum_gas_payload_plugin2.EthereumGasEthersSchema]: 1
|
|
89
|
+
},
|
|
90
|
+
schema: import_payload_model.PayloadSetSchema
|
|
91
|
+
}, {
|
|
92
|
+
witness: /* @__PURE__ */ __name(async (params) => {
|
|
93
|
+
return await EthereumGasEthersWitness.create(params);
|
|
94
|
+
}, "witness")
|
|
95
|
+
}), "EthereumGasEthersPlugin");
|
|
83
96
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromEthers.ts","../../src/Schema.ts"],"sourcesContent":["export * from './Config.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromEthers.ts","../../src/Schema.ts"],"sourcesContent":["export * from './Config.ts'\n// eslint-disable-next-line import/no-default-export\nexport { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.ts'\nexport * from './Schema.ts'\nexport * from './Witness.ts'\n","import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasEthersWitness } from './Witness.ts'\n\nexport const EthereumGasEthersPlugin = () =>\n createPayloadSetWitnessPlugin<EthereumGasEthersWitness>(\n { required: { [EthereumGasEthersSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await EthereumGasEthersWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, Schema } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { Provider } from 'ethers'\n\nimport { EthereumGasEthersWitnessConfig } from './Config.ts'\nimport { getGasFromEthers } from './lib/index.ts'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.ts'\n\nexport type EthereumGasEthersWitnessParams = WitnessParams<\n AnyConfigSchema<EthereumGasEthersWitnessConfig>,\n {\n provider?: Provider\n }\n>\n\nexport class EthereumGasEthersWitness<\n TParams extends EthereumGasEthersWitnessParams = EthereumGasEthersWitnessParams,\n> extends AbstractWitness<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasEthersWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = EthereumGasEthersWitnessConfigSchema\n\n private _provider?: Provider\n\n protected get provider() {\n this._provider = this._provider ?? this.params?.provider\n return this._provider\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const payload = await new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })\n .fields(await getGasFromEthers(assertEx(this.provider, () => 'Provider Required')))\n .build()\n return [payload]\n }\n}\n","import { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { Provider } from 'ethers'\n\nconst formatFeeDataValue = (value: bigint | null) => {\n return value ? Number(value) : null\n}\n\nexport const getGasFromEthers = async (provider: Provider): Promise<EthereumGasEthersResponse> => {\n // https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData\n const feeData = await provider.getFeeData()\n const formattedFeeData: EthereumGasEthersResponse = {\n gasPrice: formatFeeDataValue(feeData.gasPrice),\n maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),\n maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),\n timestamp: Date.now(),\n }\n return formattedFeeData\n}\n","export type EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'\nexport const EthereumGasEthersWitnessConfigSchema: EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA,IAAAA,6CAAwC;AACxC,2BAAiC;AACjC,+BAA8C;;;ACF9C,oBAAyB;AACzB,8BAAgC;AAChC,gDAAkE;AAElE,6BAA+B;;;ACD/B,IAAMC,qBAAqB,wBAACC,UAAAA;AAC1B,SAAOA,QAAQC,OAAOD,KAAAA,IAAS;AACjC,GAF2B;AAIpB,IAAME,mBAAmB,8BAAOC,aAAAA;AAErC,QAAMC,UAAU,MAAMD,SAASE,WAAU;AACzC,QAAMC,mBAA8C;IAClDC,UAAUR,mBAAmBK,QAAQG,QAAQ;IAC7CC,cAAcT,mBAAmBK,QAAQI,YAAY;IACrDC,sBAAsBV,mBAAmBK,QAAQK,oBAAoB;IACrEC,WAAWC,KAAKC,IAAG;EACrB;AACA,SAAON;AACT,GAVgC;;;ACNzB,IAAMO,uCAA6E;;;AFmBnF,IAAMC,2BAAN,cAEGC,wCAAAA;EAtBV,OAsBUA;;;EACR,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAE/CE;EAER,IAAcC,WAAW;AACvB,SAAKD,YAAY,KAAKA,aAAa,KAAKE,QAAQD;AAChD,WAAO,KAAKD;EACd;EAEA,MAAyBG,iBAAqC;AAC5D,UAAMC,UAAU,MAAM,IAAIC,sCAAyC;MAAEC,QAAQC;IAAwB,CAAA,EAClGC,OAAO,MAAMC,qBAAiBC,wBAAS,KAAKT,UAAU,MAAM,mBAAA,CAAA,CAAA,EAC5DU,MAAK;AACR,WAAO;MAACP;;EACV;AACF;;;ADjCO,IAAMQ,0BAA0B,iCACrCC,wDACE;EAAEC,UAAU;IAAE,CAACC,kEAAAA,GAA0B;EAAE;EAAGC,QAAQC;AAAiB,GACvE;EACEC,SAAS,8BAAOC,WAAAA;AACd,WAAO,MAAMC,yBAAyBC,OAAOF,MAAAA;EAC/C,GAFS;AAGX,CAAA,GAPmC;","names":["import_ethers_ethereum_gas_payload_plugin","formatFeeDataValue","value","Number","getGasFromEthers","provider","feeData","getFeeData","formattedFeeData","gasPrice","maxFeePerGas","maxPriorityFeePerGas","timestamp","Date","now","EthereumGasEthersWitnessConfigSchema","EthereumGasEthersWitness","AbstractWitness","configSchemas","EthereumGasEthersWitnessConfigSchema","defaultConfigSchema","_provider","provider","params","observeHandler","payload","PayloadBuilder","schema","EthereumGasEthersSchema","fields","getGasFromEthers","assertEx","build","EthereumGasEthersPlugin","createPayloadSetWitnessPlugin","required","EthereumGasEthersSchema","schema","PayloadSetSchema","witness","params","EthereumGasEthersWitness","create"]}
|