@xyo-network/ethers-ethereum-gas-plugin 2.99.4 → 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.
Files changed (64) hide show
  1. package/dist/browser/Config.d.cts +1 -1
  2. package/dist/browser/Config.d.mts +1 -1
  3. package/dist/browser/Config.d.ts +1 -1
  4. package/dist/browser/Plugin.d.cts +2 -2
  5. package/dist/browser/Plugin.d.mts +2 -2
  6. package/dist/browser/Plugin.d.ts +2 -2
  7. package/dist/browser/Witness.d.cts +1 -1
  8. package/dist/browser/Witness.d.mts +1 -1
  9. package/dist/browser/Witness.d.ts +1 -1
  10. package/dist/browser/index.cjs +28 -15
  11. package/dist/browser/index.cjs.map +1 -1
  12. package/dist/browser/index.d.cts +4 -4
  13. package/dist/browser/index.d.mts +4 -4
  14. package/dist/browser/index.d.ts +4 -4
  15. package/dist/browser/{index.js → index.mjs} +31 -16
  16. package/dist/{node/index.js.map → browser/index.mjs.map} +1 -1
  17. package/dist/browser/lib/index.d.cts +1 -1
  18. package/dist/browser/lib/index.d.mts +1 -1
  19. package/dist/browser/lib/index.d.ts +1 -1
  20. package/dist/neutral/Config.d.cts +1 -1
  21. package/dist/neutral/Config.d.mts +1 -1
  22. package/dist/neutral/Config.d.ts +1 -1
  23. package/dist/neutral/Plugin.d.cts +2 -2
  24. package/dist/neutral/Plugin.d.mts +2 -2
  25. package/dist/neutral/Plugin.d.ts +2 -2
  26. package/dist/neutral/Witness.d.cts +1 -1
  27. package/dist/neutral/Witness.d.mts +1 -1
  28. package/dist/neutral/Witness.d.ts +1 -1
  29. package/dist/neutral/index.cjs +28 -15
  30. package/dist/neutral/index.cjs.map +1 -1
  31. package/dist/neutral/index.d.cts +4 -4
  32. package/dist/neutral/index.d.mts +4 -4
  33. package/dist/neutral/index.d.ts +4 -4
  34. package/dist/neutral/{index.js → index.mjs} +31 -16
  35. package/dist/{browser/index.js.map → neutral/index.mjs.map} +1 -1
  36. package/dist/neutral/lib/index.d.cts +1 -1
  37. package/dist/neutral/lib/index.d.mts +1 -1
  38. package/dist/neutral/lib/index.d.ts +1 -1
  39. package/dist/node/Config.d.cts +1 -1
  40. package/dist/node/Config.d.mts +1 -1
  41. package/dist/node/Config.d.ts +1 -1
  42. package/dist/node/Plugin.d.cts +2 -2
  43. package/dist/node/Plugin.d.mts +2 -2
  44. package/dist/node/Plugin.d.ts +2 -2
  45. package/dist/node/Witness.d.cts +1 -1
  46. package/dist/node/Witness.d.mts +1 -1
  47. package/dist/node/Witness.d.ts +1 -1
  48. package/dist/node/index.cjs +34 -17
  49. package/dist/node/index.cjs.map +1 -1
  50. package/dist/node/index.d.cts +4 -4
  51. package/dist/node/index.d.mts +4 -4
  52. package/dist/node/index.d.ts +4 -4
  53. package/dist/node/index.mjs +80 -0
  54. package/dist/{neutral/index.js.map → node/index.mjs.map} +1 -1
  55. package/dist/node/lib/index.d.cts +1 -1
  56. package/dist/node/lib/index.d.mts +1 -1
  57. package/dist/node/lib/index.d.ts +1 -1
  58. package/package.json +19 -19
  59. package/src/Config.ts +1 -1
  60. package/src/Plugin.ts +1 -1
  61. package/src/Witness.ts +3 -3
  62. package/src/index.ts +4 -4
  63. package/src/lib/index.ts +1 -1
  64. package/dist/node/index.js +0 -61
@@ -1,5 +1,5 @@
1
- export * from './Config.js';
2
- export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.js';
3
- export * from './Schema.js';
4
- export * from './Witness.js';
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,5 +1,5 @@
1
- export * from './Config.js';
2
- export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.js';
3
- export * from './Schema.js';
4
- export * from './Witness.js';
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,5 +1,5 @@
1
- export * from './Config.js';
2
- export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.js';
3
- export * from './Schema.js';
4
- export * from './Witness.js';
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 configSchemas = [...super.configSchemas, EthereumGasEthersWitnessConfigSchema];
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({ schema: EthereumGasEthersSchema }).fields(await getGasFromEthers(assertEx(this.provider, () => "Provider Required"))).build();
41
- return [payload];
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
- { required: { [EthereumGasEthersSchema2]: 1 }, schema: PayloadSetSchema },
48
- {
49
- witness: async (params) => {
50
- return await EthereumGasEthersWitness.create(params);
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.js.map
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.js'\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.js'\nimport { getGasFromEthers } from './lib/index.js'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.js'\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,SAAS,2BAAAA,gCAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAmC,+BAA+B;AAElE,SAAS,sBAAsB;;;ACD/B,IAAM,qBAAqB,CAAC,UAAyB;AACnD,SAAO,QAAQ,OAAO,KAAK,IAAI;AACjC;AAEO,IAAM,mBAAmB,OAAO,aAA2D;AAEhG,QAAM,UAAU,MAAM,SAAS,WAAW;AAC1C,QAAM,mBAA8C;AAAA,IAClD,UAAU,mBAAmB,QAAQ,QAAQ;AAAA,IAC7C,cAAc,mBAAmB,QAAQ,YAAY;AAAA,IACrD,sBAAsB,mBAAmB,QAAQ,oBAAoB;AAAA,IACrE,WAAW,KAAK,IAAI;AAAA,EACtB;AACA,SAAO;AACT;;;AChBO,IAAM,uCAA6E;;;AFmBnF,IAAM,2BAAN,cAEG,gBAAyB;AAAA,EACjC,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAE/C;AAAA,EAER,IAAc,WAAW;AACvB,SAAK,YAAY,KAAK,aAAa,KAAK,QAAQ;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,UAAU,MAAM,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EACnG,OAAO,MAAM,iBAAiB,SAAS,KAAK,UAAU,MAAM,mBAAmB,CAAC,CAAC,EACjF,MAAM;AACT,WAAO,CAAC,OAAO;AAAA,EACjB;AACF;;;ADjCO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,wBAAuB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACrD;AAAA,EACF;AACF;","names":["EthereumGasEthersSchema","EthereumGasEthersSchema"]}
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.js';
1
+ export * from './getGasFromEthers.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './getGasFromEthers.js';
1
+ export * from './getGasFromEthers.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './getGasFromEthers.js';
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.js';
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.js';
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.js';
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.js';
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.js").EthereumGasEthersWitnessConfigSchema;
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.js';
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.js").EthereumGasEthersWitnessConfigSchema;
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.js';
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.js").EthereumGasEthersWitnessConfigSchema;
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.js';
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.js';
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.js';
6
+ import { EthereumGasEthersWitnessConfig } from './Config.ts';
7
7
  export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
8
8
  provider?: Provider;
9
9
  }>;
@@ -2,7 +2,11 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
5
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __reflectGet = Reflect.get;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
10
  var __export = (target, all) => {
7
11
  for (var name in all)
8
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,6 +20,8 @@ var __copyProps = (to, from, except, desc) => {
16
20
  return to;
17
21
  };
18
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
19
25
 
20
26
  // src/index.ts
21
27
  var src_exports = {};
@@ -39,10 +45,10 @@ var import_ethers_ethereum_gas_payload_plugin = require("@xyo-network/ethers-eth
39
45
  var import_payload_builder = require("@xyo-network/payload-builder");
40
46
 
41
47
  // src/lib/getGasFromEthers.ts
42
- var formatFeeDataValue = (value) => {
48
+ var formatFeeDataValue = /* @__PURE__ */ __name((value) => {
43
49
  return value ? Number(value) : null;
44
- };
45
- var getGasFromEthers = async (provider) => {
50
+ }, "formatFeeDataValue");
51
+ var getGasFromEthers = /* @__PURE__ */ __name(async (provider) => {
46
52
  const feeData = await provider.getFeeData();
47
53
  const formattedFeeData = {
48
54
  gasPrice: formatFeeDataValue(feeData.gasPrice),
@@ -51,15 +57,13 @@ var getGasFromEthers = async (provider) => {
51
57
  timestamp: Date.now()
52
58
  };
53
59
  return formattedFeeData;
54
- };
60
+ }, "getGasFromEthers");
55
61
 
56
62
  // src/Schema.ts
57
63
  var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
58
64
 
59
65
  // src/Witness.ts
60
- var EthereumGasEthersWitness = class extends import_abstract_witness.AbstractWitness {
61
- static configSchemas = [...super.configSchemas, EthereumGasEthersWitnessConfigSchema];
62
- static defaultConfigSchema = EthereumGasEthersWitnessConfigSchema;
66
+ var _EthereumGasEthersWitness = class _EthereumGasEthersWitness extends import_abstract_witness.AbstractWitness {
63
67
  _provider;
64
68
  get provider() {
65
69
  var _a;
@@ -67,20 +71,33 @@ var EthereumGasEthersWitness = class extends import_abstract_witness.AbstractWit
67
71
  return this._provider;
68
72
  }
69
73
  async observeHandler() {
70
- const payload = await new import_payload_builder.PayloadBuilder({ schema: import_ethers_ethereum_gas_payload_plugin.EthereumGasEthersSchema }).fields(await getGasFromEthers((0, import_assert.assertEx)(this.provider, () => "Provider Required"))).build();
71
- return [payload];
74
+ const payload = await new import_payload_builder.PayloadBuilder({
75
+ schema: import_ethers_ethereum_gas_payload_plugin.EthereumGasEthersSchema
76
+ }).fields(await getGasFromEthers((0, import_assert.assertEx)(this.provider, () => "Provider Required"))).build();
77
+ return [
78
+ payload
79
+ ];
72
80
  }
73
81
  };
82
+ __name(_EthereumGasEthersWitness, "EthereumGasEthersWitness");
83
+ __publicField(_EthereumGasEthersWitness, "configSchemas", [
84
+ ...__superGet(_EthereumGasEthersWitness, _EthereumGasEthersWitness, "configSchemas"),
85
+ EthereumGasEthersWitnessConfigSchema
86
+ ]);
87
+ __publicField(_EthereumGasEthersWitness, "defaultConfigSchema", EthereumGasEthersWitnessConfigSchema);
88
+ var EthereumGasEthersWitness = _EthereumGasEthersWitness;
74
89
 
75
90
  // src/Plugin.ts
76
- var EthereumGasEthersPlugin = () => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)(
77
- { required: { [import_ethers_ethereum_gas_payload_plugin2.EthereumGasEthersSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
78
- {
79
- witness: async (params) => {
80
- return await EthereumGasEthersWitness.create(params);
81
- }
82
- }
83
- );
91
+ var EthereumGasEthersPlugin = /* @__PURE__ */ __name(() => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)({
92
+ required: {
93
+ [import_ethers_ethereum_gas_payload_plugin2.EthereumGasEthersSchema]: 1
94
+ },
95
+ schema: import_payload_model.PayloadSetSchema
96
+ }, {
97
+ witness: /* @__PURE__ */ __name(async (params) => {
98
+ return await EthereumGasEthersWitness.create(params);
99
+ }, "witness")
100
+ }), "EthereumGasEthersPlugin");
84
101
  // Annotate the CommonJS export names for ESM import in node:
85
102
  0 && (module.exports = {
86
103
  EthereumGasEthersPlugin,
@@ -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.js'\n// eslint-disable-next-line import/no-default-export\nexport { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.js'\nexport * from './Schema.js'\nexport * from './Witness.js'\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.js'\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.js'\nimport { getGasFromEthers } from './lib/index.js'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.js'\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,6CAAwC;AACxC,2BAAiC;AACjC,+BAA8C;;;ACF9C,oBAAyB;AACzB,8BAAgC;AAChC,gDAAkE;AAElE,6BAA+B;;;ACD/B,IAAM,qBAAqB,CAAC,UAAyB;AACnD,SAAO,QAAQ,OAAO,KAAK,IAAI;AACjC;AAEO,IAAM,mBAAmB,OAAO,aAA2D;AAEhG,QAAM,UAAU,MAAM,SAAS,WAAW;AAC1C,QAAM,mBAA8C;AAAA,IAClD,UAAU,mBAAmB,QAAQ,QAAQ;AAAA,IAC7C,cAAc,mBAAmB,QAAQ,YAAY;AAAA,IACrD,sBAAsB,mBAAmB,QAAQ,oBAAoB;AAAA,IACrE,WAAW,KAAK,IAAI;AAAA,EACtB;AACA,SAAO;AACT;;;AChBO,IAAM,uCAA6E;;;AFmBnF,IAAM,2BAAN,cAEG,wCAAyB;AAAA,EACjC,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAE/C;AAAA,EAER,IAAc,WAAW;AA5B3B;AA6BI,SAAK,YAAY,KAAK,eAAa,UAAK,WAAL,mBAAa;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,UAAU,MAAM,IAAI,sCAAyC,EAAE,QAAQ,kEAAwB,CAAC,EACnG,OAAO,MAAM,qBAAiB,wBAAS,KAAK,UAAU,MAAM,mBAAmB,CAAC,CAAC,EACjF,MAAM;AACT,WAAO,CAAC,OAAO;AAAA,EACjB;AACF;;;ADjCO,IAAM,0BAA0B,UACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kEAAuB,GAAG,EAAE,GAAG,QAAQ,sCAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACrD;AAAA,EACF;AACF;","names":["import_ethers_ethereum_gas_payload_plugin"]}
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,4BAAN,MAAMA,kCAEHC,wCAAAA;EAIAC;EAER,IAAcC,WAAW;AA5B3B;AA6BI,SAAKD,YAAY,KAAKA,eAAa,UAAKE,WAAL,mBAAaD;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;AAjBUL;AACR,cAHWD,2BAGcc,iBAA0B;KAAI,iEAAMA;EAAeC;;AAC5E,cAJWf,2BAIcgB,uBAA8BD;AAJlD,IAAMf,2BAAN;;;ADdA,IAAMiB,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","_provider","provider","params","observeHandler","payload","PayloadBuilder","schema","EthereumGasEthersSchema","fields","getGasFromEthers","assertEx","build","configSchemas","EthereumGasEthersWitnessConfigSchema","defaultConfigSchema","EthereumGasEthersPlugin","createPayloadSetWitnessPlugin","required","EthereumGasEthersSchema","schema","PayloadSetSchema","witness","params","EthereumGasEthersWitness","create"]}
@@ -1,5 +1,5 @@
1
- export * from './Config.js';
2
- export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.js';
3
- export * from './Schema.js';
4
- export * from './Witness.js';
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,5 +1,5 @@
1
- export * from './Config.js';
2
- export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.js';
3
- export * from './Schema.js';
4
- export * from './Witness.js';
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,5 +1,5 @@
1
- export * from './Config.js';
2
- export { EthereumGasEthersPlugin as default, EthereumGasEthersPlugin } from './Plugin.js';
3
- export * from './Schema.js';
4
- export * from './Witness.js';
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
@@ -0,0 +1,80 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __reflectGet = Reflect.get;
4
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
8
+
9
+ // src/Plugin.ts
10
+ import { EthereumGasEthersSchema as EthereumGasEthersSchema2 } from "@xyo-network/ethers-ethereum-gas-payload-plugin";
11
+ import { PayloadSetSchema } from "@xyo-network/payload-model";
12
+ import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
13
+
14
+ // src/Witness.ts
15
+ import { assertEx } from "@xylabs/assert";
16
+ import { AbstractWitness } from "@xyo-network/abstract-witness";
17
+ import { EthereumGasEthersSchema } from "@xyo-network/ethers-ethereum-gas-payload-plugin";
18
+ import { PayloadBuilder } from "@xyo-network/payload-builder";
19
+
20
+ // src/lib/getGasFromEthers.ts
21
+ var formatFeeDataValue = /* @__PURE__ */ __name((value) => {
22
+ return value ? Number(value) : null;
23
+ }, "formatFeeDataValue");
24
+ var getGasFromEthers = /* @__PURE__ */ __name(async (provider) => {
25
+ const feeData = await provider.getFeeData();
26
+ const formattedFeeData = {
27
+ gasPrice: formatFeeDataValue(feeData.gasPrice),
28
+ maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),
29
+ maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),
30
+ timestamp: Date.now()
31
+ };
32
+ return formattedFeeData;
33
+ }, "getGasFromEthers");
34
+
35
+ // src/Schema.ts
36
+ var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
37
+
38
+ // src/Witness.ts
39
+ var _EthereumGasEthersWitness = class _EthereumGasEthersWitness extends AbstractWitness {
40
+ _provider;
41
+ get provider() {
42
+ var _a;
43
+ this._provider = this._provider ?? ((_a = this.params) == null ? void 0 : _a.provider);
44
+ return this._provider;
45
+ }
46
+ async observeHandler() {
47
+ const payload = await new PayloadBuilder({
48
+ schema: EthereumGasEthersSchema
49
+ }).fields(await getGasFromEthers(assertEx(this.provider, () => "Provider Required"))).build();
50
+ return [
51
+ payload
52
+ ];
53
+ }
54
+ };
55
+ __name(_EthereumGasEthersWitness, "EthereumGasEthersWitness");
56
+ __publicField(_EthereumGasEthersWitness, "configSchemas", [
57
+ ...__superGet(_EthereumGasEthersWitness, _EthereumGasEthersWitness, "configSchemas"),
58
+ EthereumGasEthersWitnessConfigSchema
59
+ ]);
60
+ __publicField(_EthereumGasEthersWitness, "defaultConfigSchema", EthereumGasEthersWitnessConfigSchema);
61
+ var EthereumGasEthersWitness = _EthereumGasEthersWitness;
62
+
63
+ // src/Plugin.ts
64
+ var EthereumGasEthersPlugin = /* @__PURE__ */ __name(() => createPayloadSetWitnessPlugin({
65
+ required: {
66
+ [EthereumGasEthersSchema2]: 1
67
+ },
68
+ schema: PayloadSetSchema
69
+ }, {
70
+ witness: /* @__PURE__ */ __name(async (params) => {
71
+ return await EthereumGasEthersWitness.create(params);
72
+ }, "witness")
73
+ }), "EthereumGasEthersPlugin");
74
+ export {
75
+ EthereumGasEthersPlugin,
76
+ EthereumGasEthersWitness,
77
+ EthereumGasEthersWitnessConfigSchema,
78
+ EthereumGasEthersPlugin as default
79
+ };
80
+ //# 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.js'\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.js'\nimport { getGasFromEthers } from './lib/index.js'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.js'\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,SAAS,2BAAAA,gCAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAmC,+BAA+B;AAElE,SAAS,sBAAsB;;;ACD/B,IAAM,qBAAqB,CAAC,UAAyB;AACnD,SAAO,QAAQ,OAAO,KAAK,IAAI;AACjC;AAEO,IAAM,mBAAmB,OAAO,aAA2D;AAEhG,QAAM,UAAU,MAAM,SAAS,WAAW;AAC1C,QAAM,mBAA8C;AAAA,IAClD,UAAU,mBAAmB,QAAQ,QAAQ;AAAA,IAC7C,cAAc,mBAAmB,QAAQ,YAAY;AAAA,IACrD,sBAAsB,mBAAmB,QAAQ,oBAAoB;AAAA,IACrE,WAAW,KAAK,IAAI;AAAA,EACtB;AACA,SAAO;AACT;;;AChBO,IAAM,uCAA6E;;;AFmBnF,IAAM,2BAAN,cAEG,gBAAyB;AAAA,EACjC,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAE/C;AAAA,EAER,IAAc,WAAW;AACvB,SAAK,YAAY,KAAK,aAAa,KAAK,QAAQ;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,UAAU,MAAM,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EACnG,OAAO,MAAM,iBAAiB,SAAS,KAAK,UAAU,MAAM,mBAAmB,CAAC,CAAC,EACjF,MAAM;AACT,WAAO,CAAC,OAAO;AAAA,EACjB;AACF;;;ADjCO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,wBAAuB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACrD;AAAA,EACF;AACF;","names":["EthereumGasEthersSchema","EthereumGasEthersSchema"]}
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,4BAAN,MAAMA,kCAEHC,gBAAAA;EAIAC;EAER,IAAcC,WAAW;AA5B3B;AA6BI,SAAKD,YAAY,KAAKA,eAAa,UAAKE,WAAL,mBAAaD;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;AAjBUL;AACR,cAHWD,2BAGcc,iBAA0B;KAAI,iEAAMA;EAAeC;;AAC5E,cAJWf,2BAIcgB,uBAA8BD;AAJlD,IAAMf,2BAAN;;;ADdA,IAAMiB,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","_provider","provider","params","observeHandler","payload","PayloadBuilder","schema","EthereumGasEthersSchema","fields","getGasFromEthers","assertEx","build","configSchemas","EthereumGasEthersWitnessConfigSchema","defaultConfigSchema","EthereumGasEthersPlugin","createPayloadSetWitnessPlugin","required","EthereumGasEthersSchema","schema","PayloadSetSchema","witness","params","EthereumGasEthersWitness","create"]}
@@ -1,2 +1,2 @@
1
- export * from './getGasFromEthers.js';
1
+ export * from './getGasFromEthers.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './getGasFromEthers.js';
1
+ export * from './getGasFromEthers.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './getGasFromEthers.js';
1
+ export * from './getGasFromEthers.ts';
2
2
  //# sourceMappingURL=index.d.ts.map