@xyo-network/ethers-ethereum-gas-plugin 2.73.3 → 2.74.0

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 (67) hide show
  1. package/dist/Config.d.mts.map +1 -0
  2. package/dist/Config.d.ts +6 -0
  3. package/dist/Config.d.ts.map +1 -0
  4. package/dist/Plugin.d.mts +56 -0
  5. package/dist/Plugin.d.mts.map +1 -0
  6. package/dist/{types/Plugin.d.ts → Plugin.d.ts} +5 -5
  7. package/dist/Plugin.d.ts.map +1 -0
  8. package/dist/Schema.d.mts.map +1 -0
  9. package/dist/Schema.d.ts +3 -0
  10. package/dist/Schema.d.ts.map +1 -0
  11. package/dist/Witness.d.mts.map +1 -0
  12. package/dist/Witness.d.ts +15 -0
  13. package/dist/Witness.d.ts.map +1 -0
  14. package/dist/index.d.mts.map +1 -0
  15. package/dist/{esm/index.js → index.d.ts} +1 -2
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +91 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/index.mjs +62 -0
  20. package/dist/index.mjs.map +1 -0
  21. package/dist/lib/getGasFromEthers.d.mts.map +1 -0
  22. package/dist/lib/getGasFromEthers.d.ts +4 -0
  23. package/dist/lib/getGasFromEthers.d.ts.map +1 -0
  24. package/dist/lib/index.d.mts.map +1 -0
  25. package/dist/{esm/lib/index.js → lib/index.d.ts} +1 -1
  26. package/dist/lib/index.d.ts.map +1 -0
  27. package/package.json +29 -22
  28. package/dist/cjs/Config.js +0 -3
  29. package/dist/cjs/Config.js.map +0 -1
  30. package/dist/cjs/Plugin.js +0 -15
  31. package/dist/cjs/Plugin.js.map +0 -1
  32. package/dist/cjs/Schema.js +0 -5
  33. package/dist/cjs/Schema.js.map +0 -1
  34. package/dist/cjs/Witness.js +0 -28
  35. package/dist/cjs/Witness.js.map +0 -1
  36. package/dist/cjs/index.js +0 -12
  37. package/dist/cjs/index.js.map +0 -1
  38. package/dist/cjs/lib/getGasFromEthers.js +0 -20
  39. package/dist/cjs/lib/getGasFromEthers.js.map +0 -1
  40. package/dist/cjs/lib/index.js +0 -5
  41. package/dist/cjs/lib/index.js.map +0 -1
  42. package/dist/docs.json +0 -23026
  43. package/dist/esm/Config.js +0 -2
  44. package/dist/esm/Config.js.map +0 -1
  45. package/dist/esm/Plugin.js +0 -10
  46. package/dist/esm/Plugin.js.map +0 -1
  47. package/dist/esm/Schema.js +0 -2
  48. package/dist/esm/Schema.js.map +0 -1
  49. package/dist/esm/Witness.js +0 -21
  50. package/dist/esm/Witness.js.map +0 -1
  51. package/dist/esm/index.js.map +0 -1
  52. package/dist/esm/lib/getGasFromEthers.js +0 -15
  53. package/dist/esm/lib/getGasFromEthers.js.map +0 -1
  54. package/dist/esm/lib/index.js.map +0 -1
  55. package/dist/types/Config.d.ts.map +0 -1
  56. package/dist/types/Plugin.d.ts.map +0 -1
  57. package/dist/types/Schema.d.ts.map +0 -1
  58. package/dist/types/Witness.d.ts.map +0 -1
  59. package/dist/types/index.d.ts.map +0 -1
  60. package/dist/types/lib/getGasFromEthers.d.ts.map +0 -1
  61. package/dist/types/lib/index.d.ts.map +0 -1
  62. /package/dist/{types/Config.d.ts → Config.d.mts} +0 -0
  63. /package/dist/{types/Schema.d.ts → Schema.d.mts} +0 -0
  64. /package/dist/{types/Witness.d.ts → Witness.d.mts} +0 -0
  65. /package/dist/{types/index.d.ts → index.d.mts} +0 -0
  66. /package/dist/{types/lib/getGasFromEthers.d.ts → lib/getGasFromEthers.d.mts} +0 -0
  67. /package/dist/{types/lib/index.d.ts → lib/index.d.mts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAA;AAE/D,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;IACzD,MAAM,EAAE,oCAAoC,CAAA;CAC7C,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { WitnessConfig } from '@xyo-network/witness';
2
+ import { EthereumGasEthersWitnessConfigSchema } from './Schema';
3
+ export type EthereumGasEthersWitnessConfig = WitnessConfig<{
4
+ schema: EthereumGasEthersWitnessConfigSchema;
5
+ }>;
6
+ //# sourceMappingURL=Config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAA;AAE/D,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;IACzD,MAAM,EAAE,oCAAoC,CAAA;CAC7C,CAAC,CAAA"}
@@ -0,0 +1,56 @@
1
+ import { EthereumGasEthersWitness } from './Witness';
2
+ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xyo-network/core").BaseParamsFields & {
3
+ account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
+ config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
5
+ accountDerivationPath?: string | undefined;
6
+ readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
7
+ readonly labels?: import("@xyo-network/module-model").Labels | undefined;
8
+ readonly name?: string | undefined;
9
+ readonly paging?: Record<string, {
10
+ size?: number | undefined;
11
+ }> | undefined;
12
+ readonly security?: {
13
+ readonly allowAnonymous?: boolean | undefined;
14
+ readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
15
+ readonly disallowed?: Record<string, string[]> | undefined;
16
+ } | undefined;
17
+ readonly sign?: boolean | undefined;
18
+ readonly storeQueries?: boolean | undefined;
19
+ readonly timestamp?: boolean | undefined;
20
+ } & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
21
+ accountDerivationPath?: string | undefined;
22
+ readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
23
+ readonly labels?: import("@xyo-network/module-model").Labels | undefined;
24
+ readonly name?: string | undefined;
25
+ readonly paging?: Record<string, {
26
+ size?: number | undefined;
27
+ }> | undefined;
28
+ readonly security?: {
29
+ readonly allowAnonymous?: boolean | undefined;
30
+ readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
31
+ readonly disallowed?: Record<string, string[]> | undefined;
32
+ } | undefined;
33
+ readonly sign?: boolean | undefined;
34
+ readonly storeQueries?: boolean | undefined;
35
+ readonly timestamp?: boolean | undefined;
36
+ } & {
37
+ archivist?: string | undefined;
38
+ schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
39
+ targetSet?: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/payload-model").PayloadSet & {
40
+ schema: "network.xyo.payload.set";
41
+ }) | undefined;
42
+ } & {
43
+ schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
44
+ }, "schema"> & {
45
+ schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
46
+ }, "schema"> & {
47
+ schema: string;
48
+ }, "schema"> & {
49
+ schema: string;
50
+ };
51
+ ephemeralQueryAccountEnabled?: boolean | undefined;
52
+ wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
53
+ } & {
54
+ provider?: import("@ethersproject/abstract-provider").Provider | undefined;
55
+ }>>;
56
+ //# sourceMappingURL=Plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAEpD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -1,14 +1,14 @@
1
1
  import { EthereumGasEthersWitness } from './Witness';
2
2
  export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("@xyo-network/core").BaseParamsFields & {
3
3
  account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
- config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
4
+ config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
5
5
  accountDerivationPath?: string | undefined;
6
6
  readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
7
+ readonly labels?: import("@xyo-network/module-model").Labels | undefined;
7
8
  readonly name?: string | undefined;
8
9
  readonly paging?: Record<string, {
9
10
  size?: number | undefined;
10
11
  }> | undefined;
11
- readonly schema: string;
12
12
  readonly security?: {
13
13
  readonly allowAnonymous?: boolean | undefined;
14
14
  readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
@@ -17,14 +17,14 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
17
17
  readonly sign?: boolean | undefined;
18
18
  readonly storeQueries?: boolean | undefined;
19
19
  readonly timestamp?: boolean | undefined;
20
- } & Omit<Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
20
+ } & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
21
21
  accountDerivationPath?: string | undefined;
22
22
  readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
23
+ readonly labels?: import("@xyo-network/module-model").Labels | undefined;
23
24
  readonly name?: string | undefined;
24
25
  readonly paging?: Record<string, {
25
26
  size?: number | undefined;
26
27
  }> | undefined;
27
- readonly schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
28
28
  readonly security?: {
29
29
  readonly allowAnonymous?: boolean | undefined;
30
30
  readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
@@ -33,7 +33,7 @@ export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payload
33
33
  readonly sign?: boolean | undefined;
34
34
  readonly storeQueries?: boolean | undefined;
35
35
  readonly timestamp?: boolean | undefined;
36
- } & Omit<{
36
+ } & {
37
37
  archivist?: string | undefined;
38
38
  schema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
39
39
  targetSet?: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/payload-model").PayloadSet & {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAEpD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../src/Schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oCAAoC,GAAG,2DAA2D,CAAA;AAC9G,eAAO,MAAM,oCAAoC,EAAE,oCAAkG,CAAA"}
@@ -0,0 +1,3 @@
1
+ export type EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config';
2
+ export declare const EthereumGasEthersWitnessConfigSchema: EthereumGasEthersWitnessConfigSchema;
3
+ //# sourceMappingURL=Schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../src/Schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oCAAoC,GAAG,2DAA2D,CAAA;AAC9G,eAAO,MAAM,oCAAoC,EAAE,oCAAkG,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../src/Witness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAGnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAErE,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAA;AAIzD,MAAM,MAAM,8BAA8B,GAAG,aAAa,CACxD,eAAe,CAAC,8BAA8B,CAAC,EAC/C;IACE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB,CACF,CAAA;AAED,qBAAa,wBAAwB,CACnC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAC/E,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,aAAa,gEAAyC;IAEtE,OAAO,CAAC,SAAS,CAAC,CAAU;IAE5B,SAAS,KAAK,QAAQ,yBAGrB;cAEwB,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAM9D"}
@@ -0,0 +1,15 @@
1
+ import { Provider } from '@ethersproject/providers';
2
+ import { AnyConfigSchema } from '@xyo-network/module';
3
+ import { Payload } from '@xyo-network/payload-model';
4
+ import { AbstractWitness, WitnessParams } from '@xyo-network/witness';
5
+ import { EthereumGasEthersWitnessConfig } from './Config';
6
+ export type EthereumGasEthersWitnessParams = WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>, {
7
+ provider?: Provider;
8
+ }>;
9
+ export declare class EthereumGasEthersWitness<TParams extends EthereumGasEthersWitnessParams = EthereumGasEthersWitnessParams> extends AbstractWitness<TParams> {
10
+ static configSchemas: "network.xyo.blockchain.ethereum.gas.ethers.witness.config"[];
11
+ private _provider?;
12
+ protected get provider(): Provider | undefined;
13
+ protected observeHandler(): Promise<Payload[]>;
14
+ }
15
+ //# sourceMappingURL=Witness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../src/Witness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAGnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAErE,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAA;AAIzD,MAAM,MAAM,8BAA8B,GAAG,aAAa,CACxD,eAAe,CAAC,8BAA8B,CAAC,EAC/C;IACE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB,CACF,CAAA;AAED,qBAAa,wBAAwB,CACnC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAC/E,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,aAAa,gEAAyC;IAEtE,OAAO,CAAC,SAAS,CAAC,CAAU;IAE5B,SAAS,KAAK,QAAQ,yBAGrB;cAEwB,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAM9D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
@@ -3,6 +3,5 @@ export * from './Config';
3
3
  export * from './Schema';
4
4
  export * from './Witness';
5
5
  export { EthereumGasEthersPlugin };
6
- // eslint-disable-next-line import/no-default-export
7
6
  export default EthereumGasEthersPlugin;
8
- //# sourceMappingURL=index.js.map
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ EthereumGasEthersPlugin: () => EthereumGasEthersPlugin,
24
+ EthereumGasEthersWitness: () => EthereumGasEthersWitness,
25
+ EthereumGasEthersWitnessConfigSchema: () => EthereumGasEthersWitnessConfigSchema,
26
+ default: () => src_default
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+
30
+ // src/Plugin.ts
31
+ var import_ethers_ethereum_gas_payload_plugin2 = require("@xyo-network/ethers-ethereum-gas-payload-plugin");
32
+ var import_payload_model = require("@xyo-network/payload-model");
33
+ var import_payloadset_plugin = require("@xyo-network/payloadset-plugin");
34
+
35
+ // src/Witness.ts
36
+ var import_assert = require("@xylabs/assert");
37
+ var import_ethers_ethereum_gas_payload_plugin = require("@xyo-network/ethers-ethereum-gas-payload-plugin");
38
+ var import_payload_builder = require("@xyo-network/payload-builder");
39
+ var import_witness = require("@xyo-network/witness");
40
+
41
+ // src/lib/getGasFromEthers.ts
42
+ var formatFeeDataValue = (value) => {
43
+ return value ? value.toNumber() : null;
44
+ };
45
+ var getGasFromEthers = async (provider) => {
46
+ const feeData = await provider.getFeeData();
47
+ const formattedFeeData = {
48
+ gasPrice: formatFeeDataValue(feeData.gasPrice),
49
+ lastBaseFeePerGas: formatFeeDataValue(feeData.lastBaseFeePerGas),
50
+ maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),
51
+ maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas)
52
+ };
53
+ return formattedFeeData;
54
+ };
55
+
56
+ // src/Schema.ts
57
+ var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
58
+
59
+ // src/Witness.ts
60
+ var EthereumGasEthersWitness = class extends import_witness.AbstractWitness {
61
+ static configSchemas = [EthereumGasEthersWitnessConfigSchema];
62
+ _provider;
63
+ get provider() {
64
+ this._provider = this._provider ?? this.params?.provider;
65
+ return this._provider;
66
+ }
67
+ async observeHandler() {
68
+ const payload = 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();
69
+ return [payload];
70
+ }
71
+ };
72
+
73
+ // src/Plugin.ts
74
+ var EthereumGasEthersPlugin = () => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)(
75
+ { required: { [import_ethers_ethereum_gas_payload_plugin2.EthereumGasEthersSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
76
+ {
77
+ witness: async (params) => {
78
+ return await EthereumGasEthersWitness.create(params);
79
+ }
80
+ }
81
+ );
82
+
83
+ // src/index.ts
84
+ var src_default = EthereumGasEthersPlugin;
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ EthereumGasEthersPlugin,
88
+ EthereumGasEthersWitness,
89
+ EthereumGasEthersWitnessConfigSchema
90
+ });
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/Plugin.ts","../src/Witness.ts","../src/lib/getGasFromEthers.ts","../src/Schema.ts"],"sourcesContent":["import { EthereumGasEthersPlugin } from './Plugin'\n\nexport * from './Config'\nexport * from './Schema'\nexport * from './Witness'\n\nexport { EthereumGasEthersPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default EthereumGasEthersPlugin\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'\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 { Provider } from '@ethersproject/providers'\nimport { assertEx } from '@xylabs/assert'\nimport { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness, WitnessParams } from '@xyo-network/witness'\n\nimport { EthereumGasEthersWitnessConfig } from './Config'\nimport { getGasFromEthers } from './lib'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema'\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 configSchemas = [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 = new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })\n .fields(await getGasFromEthers(assertEx(this.provider, 'Provider Required')))\n .build()\n return [payload]\n }\n}\n","import { Provider } from '@ethersproject/providers'\nimport { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\n\nconst formatFeeDataValue = (value: { toNumber(): number } | null): number | null => {\n return value ? value.toNumber() : 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 lastBaseFeePerGas: formatFeeDataValue(feeData.lastBaseFeePerGas),\n maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),\n maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),\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;;;ACD9C,oBAAyB;AACzB,gDAAkE;AAElE,6BAA+B;AAE/B,qBAA+C;;;ACH/C,IAAM,qBAAqB,CAAC,UAAwD;AAClF,SAAO,QAAQ,MAAM,SAAS,IAAI;AACpC;AAEO,IAAM,mBAAmB,OAAO,aAA2D;AAEhG,QAAM,UAAU,MAAM,SAAS,WAAW;AAC1C,QAAM,mBAA8C;AAAA,IAClD,UAAU,mBAAmB,QAAQ,QAAQ;AAAA,IAC7C,mBAAmB,mBAAmB,QAAQ,iBAAiB;AAAA,IAC/D,cAAc,mBAAmB,QAAQ,YAAY;AAAA,IACrD,sBAAsB,mBAAmB,QAAQ,oBAAoB;AAAA,EACvE;AACA,SAAO;AACT;;;AChBO,IAAM,uCAA6E;;;AFkBnF,IAAM,2BAAN,cAEG,+BAAyB;AAAA,EACjC,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EAE7D;AAAA,EAER,IAAc,WAAW;AACvB,SAAK,YAAY,KAAK,aAAa,KAAK,QAAQ;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,UAAU,IAAI,sCAAyC,EAAE,QAAQ,kEAAwB,CAAC,EAC7F,OAAO,MAAM,qBAAiB,wBAAS,KAAK,UAAU,mBAAmB,CAAC,CAAC,EAC3E,MAAM;AACT,WAAO,CAAC,OAAO;AAAA,EACjB;AACF;;;AD/BO,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;;;ADLF,IAAO,cAAQ;","names":["import_ethers_ethereum_gas_payload_plugin"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,62 @@
1
+ // src/Plugin.ts
2
+ import { EthereumGasEthersSchema as EthereumGasEthersSchema2 } from "@xyo-network/ethers-ethereum-gas-payload-plugin";
3
+ import { PayloadSetSchema } from "@xyo-network/payload-model";
4
+ import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
5
+
6
+ // src/Witness.ts
7
+ import { assertEx } from "@xylabs/assert";
8
+ import { EthereumGasEthersSchema } from "@xyo-network/ethers-ethereum-gas-payload-plugin";
9
+ import { PayloadBuilder } from "@xyo-network/payload-builder";
10
+ import { AbstractWitness } from "@xyo-network/witness";
11
+
12
+ // src/lib/getGasFromEthers.ts
13
+ var formatFeeDataValue = (value) => {
14
+ return value ? value.toNumber() : null;
15
+ };
16
+ var getGasFromEthers = async (provider) => {
17
+ const feeData = await provider.getFeeData();
18
+ const formattedFeeData = {
19
+ gasPrice: formatFeeDataValue(feeData.gasPrice),
20
+ lastBaseFeePerGas: formatFeeDataValue(feeData.lastBaseFeePerGas),
21
+ maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),
22
+ maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas)
23
+ };
24
+ return formattedFeeData;
25
+ };
26
+
27
+ // src/Schema.ts
28
+ var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
29
+
30
+ // src/Witness.ts
31
+ var EthereumGasEthersWitness = class extends AbstractWitness {
32
+ static configSchemas = [EthereumGasEthersWitnessConfigSchema];
33
+ _provider;
34
+ get provider() {
35
+ this._provider = this._provider ?? this.params?.provider;
36
+ return this._provider;
37
+ }
38
+ async observeHandler() {
39
+ const payload = new PayloadBuilder({ schema: EthereumGasEthersSchema }).fields(await getGasFromEthers(assertEx(this.provider, "Provider Required"))).build();
40
+ return [payload];
41
+ }
42
+ };
43
+
44
+ // src/Plugin.ts
45
+ var EthereumGasEthersPlugin = () => createPayloadSetWitnessPlugin(
46
+ { required: { [EthereumGasEthersSchema2]: 1 }, schema: PayloadSetSchema },
47
+ {
48
+ witness: async (params) => {
49
+ return await EthereumGasEthersWitness.create(params);
50
+ }
51
+ }
52
+ );
53
+
54
+ // src/index.ts
55
+ var src_default = EthereumGasEthersPlugin;
56
+ export {
57
+ EthereumGasEthersPlugin,
58
+ EthereumGasEthersWitness,
59
+ EthereumGasEthersWitnessConfigSchema,
60
+ src_default as default
61
+ };
62
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Plugin.ts","../src/Witness.ts","../src/lib/getGasFromEthers.ts","../src/Schema.ts","../src/index.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'\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 { Provider } from '@ethersproject/providers'\nimport { assertEx } from '@xylabs/assert'\nimport { EthereumGasEthersPayload, EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness, WitnessParams } from '@xyo-network/witness'\n\nimport { EthereumGasEthersWitnessConfig } from './Config'\nimport { getGasFromEthers } from './lib'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema'\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 configSchemas = [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 = new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })\n .fields(await getGasFromEthers(assertEx(this.provider, 'Provider Required')))\n .build()\n return [payload]\n }\n}\n","import { Provider } from '@ethersproject/providers'\nimport { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\n\nconst formatFeeDataValue = (value: { toNumber(): number } | null): number | null => {\n return value ? value.toNumber() : 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 lastBaseFeePerGas: formatFeeDataValue(feeData.lastBaseFeePerGas),\n maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),\n maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),\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","import { EthereumGasEthersPlugin } from './Plugin'\n\nexport * from './Config'\nexport * from './Schema'\nexport * from './Witness'\n\nexport { EthereumGasEthersPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default EthereumGasEthersPlugin\n"],"mappings":";AAAA,SAAS,2BAAAA,gCAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACD9C,SAAS,gBAAgB;AACzB,SAAmC,+BAA+B;AAElE,SAAS,sBAAsB;AAE/B,SAAS,uBAAsC;;;ACH/C,IAAM,qBAAqB,CAAC,UAAwD;AAClF,SAAO,QAAQ,MAAM,SAAS,IAAI;AACpC;AAEO,IAAM,mBAAmB,OAAO,aAA2D;AAEhG,QAAM,UAAU,MAAM,SAAS,WAAW;AAC1C,QAAM,mBAA8C;AAAA,IAClD,UAAU,mBAAmB,QAAQ,QAAQ;AAAA,IAC7C,mBAAmB,mBAAmB,QAAQ,iBAAiB;AAAA,IAC/D,cAAc,mBAAmB,QAAQ,YAAY;AAAA,IACrD,sBAAsB,mBAAmB,QAAQ,oBAAoB;AAAA,EACvE;AACA,SAAO;AACT;;;AChBO,IAAM,uCAA6E;;;AFkBnF,IAAM,2BAAN,cAEG,gBAAyB;AAAA,EACjC,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EAE7D;AAAA,EAER,IAAc,WAAW;AACvB,SAAK,YAAY,KAAK,aAAa,KAAK,QAAQ;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,UAAU,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC7F,OAAO,MAAM,iBAAiB,SAAS,KAAK,UAAU,mBAAmB,CAAC,CAAC,EAC3E,MAAM;AACT,WAAO,CAAC,OAAO;AAAA,EACjB;AACF;;;AD/BO,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;;;AILF,IAAO,cAAQ;","names":["EthereumGasEthersSchema","EthereumGasEthersSchema"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGasFromEthers.d.ts","sourceRoot":"","sources":["../../src/lib/getGasFromEthers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAM3F,eAAO,MAAM,gBAAgB,aAAoB,QAAQ,KAAG,QAAQ,yBAAyB,CAU5F,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Provider } from '@ethersproject/providers';
2
+ import { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin';
3
+ export declare const getGasFromEthers: (provider: Provider) => Promise<EthereumGasEthersResponse>;
4
+ //# sourceMappingURL=getGasFromEthers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGasFromEthers.d.ts","sourceRoot":"","sources":["../../src/lib/getGasFromEthers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAM3F,eAAO,MAAM,gBAAgB,aAAoB,QAAQ,KAAG,QAAQ,yBAAyB,CAU5F,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -1,2 +1,2 @@
1
1
  export * from './getGasFromEthers';
2
- //# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
package/package.json CHANGED
@@ -11,41 +11,49 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@ethersproject/providers": "^5.7.2",
14
- "@xylabs/assert": "^2.10.11",
15
- "@xyo-network/ethers-ethereum-gas-payload-plugin": "~2.73.3",
16
- "@xyo-network/module": "~2.73.3",
17
- "@xyo-network/payload-builder": "~2.73.3",
18
- "@xyo-network/payload-model": "~2.73.3",
19
- "@xyo-network/payloadset-plugin": "~2.73.3",
20
- "@xyo-network/witness": "~2.73.3"
14
+ "@xylabs/assert": "^2.11.5",
15
+ "@xyo-network/ethers-ethereum-gas-payload-plugin": "~2.74.0",
16
+ "@xyo-network/module": "~2.74.0",
17
+ "@xyo-network/payload-builder": "~2.74.0",
18
+ "@xyo-network/payload-model": "~2.74.0",
19
+ "@xyo-network/payloadset-plugin": "~2.74.0",
20
+ "@xyo-network/witness": "~2.74.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@xylabs/ts-scripts-yarn3": "^2.19.5",
24
- "@xylabs/tsconfig": "^2.19.5",
23
+ "@xylabs/ts-scripts-yarn3": "^3.0.27",
24
+ "@xylabs/tsconfig": "^3.0.27",
25
25
  "typescript": "^5.2.2"
26
26
  },
27
27
  "description": "Primary SDK for using XYO Protocol 2.0",
28
- "browser": "dist/esm/index.js",
29
28
  "docs": "dist/docs.json",
29
+ "types": "dist/index.d.ts",
30
30
  "exports": {
31
31
  ".": {
32
- "node": {
33
- "import": "./dist/esm/index.js",
34
- "require": "./dist/cjs/index.js"
32
+ "require": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.js"
35
35
  },
36
- "browser": {
37
- "import": "./dist/esm/index.js",
38
- "require": "./dist/cjs/index.js"
39
- },
40
- "default": "./dist/esm/index.js"
36
+ "import": {
37
+ "types": "./dist/index.d.mts",
38
+ "default": "./dist/index.mjs"
39
+ }
41
40
  },
42
41
  "./dist/docs.json": {
43
42
  "default": "./dist/docs.json"
44
43
  },
44
+ "./cjs": {
45
+ "default": "./dist/index.js"
46
+ },
47
+ "./docs": {
48
+ "default": "./dist/docs.json"
49
+ },
50
+ "./esm": {
51
+ "default": "./dist/index.mjs"
52
+ },
45
53
  "./package.json": "./package.json"
46
54
  },
47
- "main": "dist/cjs/index.js",
48
- "module": "dist/esm/index.js",
55
+ "main": "dist/index.js",
56
+ "module": "dist/index.mjs",
49
57
  "homepage": "https://xyo.network",
50
58
  "license": "LGPL-3.0",
51
59
  "publishConfig": {
@@ -56,6 +64,5 @@
56
64
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
57
65
  },
58
66
  "sideEffects": false,
59
- "types": "dist/types/index.d.ts",
60
- "version": "2.73.3"
67
+ "version": "2.74.0"
61
68
  }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EthereumGasEthersPlugin = void 0;
4
- const tslib_1 = require("tslib");
5
- const ethers_ethereum_gas_payload_plugin_1 = require("@xyo-network/ethers-ethereum-gas-payload-plugin");
6
- const payload_model_1 = require("@xyo-network/payload-model");
7
- const payloadset_plugin_1 = require("@xyo-network/payloadset-plugin");
8
- const Witness_1 = require("./Witness");
9
- const EthereumGasEthersPlugin = () => (0, payloadset_plugin_1.createPayloadSetWitnessPlugin)({ required: { [ethers_ethereum_gas_payload_plugin_1.EthereumGasEthersSchema]: 1 }, schema: payload_model_1.PayloadSetSchema }, {
10
- witness: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
11
- return yield Witness_1.EthereumGasEthersWitness.create(params);
12
- }),
13
- });
14
- exports.EthereumGasEthersPlugin = EthereumGasEthersPlugin;
15
- //# sourceMappingURL=Plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":";;;;AAAA,wGAAyF;AACzF,8DAA6D;AAC7D,sEAA8E;AAE9E,uCAAoD;AAE7C,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAC1C,IAAA,iDAA6B,EAC3B,EAAE,QAAQ,EAAE,EAAE,CAAC,4DAAuB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,gCAAgB,EAAE,EACxE;IACE,OAAO,EAAE,CAAO,MAAM,EAAE,EAAE;QACxB,OAAO,MAAM,kCAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACtD,CAAC,CAAA;CACF,CACF,CAAA;AARU,QAAA,uBAAuB,2BAQjC"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EthereumGasEthersWitnessConfigSchema = void 0;
4
- exports.EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config';
5
- //# sourceMappingURL=Schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":";;;AACa,QAAA,oCAAoC,GAAyC,2DAA2D,CAAA"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EthereumGasEthersWitness = void 0;
4
- const tslib_1 = require("tslib");
5
- const assert_1 = require("@xylabs/assert");
6
- const ethers_ethereum_gas_payload_plugin_1 = require("@xyo-network/ethers-ethereum-gas-payload-plugin");
7
- const payload_builder_1 = require("@xyo-network/payload-builder");
8
- const witness_1 = require("@xyo-network/witness");
9
- const lib_1 = require("./lib");
10
- const Schema_1 = require("./Schema");
11
- class EthereumGasEthersWitness extends witness_1.AbstractWitness {
12
- get provider() {
13
- var _a, _b;
14
- this._provider = (_a = this._provider) !== null && _a !== void 0 ? _a : (_b = this.params) === null || _b === void 0 ? void 0 : _b.provider;
15
- return this._provider;
16
- }
17
- observeHandler() {
18
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
19
- const payload = new payload_builder_1.PayloadBuilder({ schema: ethers_ethereum_gas_payload_plugin_1.EthereumGasEthersSchema })
20
- .fields(yield (0, lib_1.getGasFromEthers)((0, assert_1.assertEx)(this.provider, 'Provider Required')))
21
- .build();
22
- return [payload];
23
- });
24
- }
25
- }
26
- exports.EthereumGasEthersWitness = EthereumGasEthersWitness;
27
- EthereumGasEthersWitness.configSchemas = [Schema_1.EthereumGasEthersWitnessConfigSchema];
28
- //# sourceMappingURL=Witness.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Witness.js","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":";;;;AACA,2CAAyC;AACzC,wGAAmH;AAEnH,kEAA6D;AAE7D,kDAAqE;AAGrE,+BAAwC;AACxC,qCAA+D;AAS/D,MAAa,wBAEX,SAAQ,yBAAwB;IAKhC,IAAc,QAAQ;;QACpB,IAAI,CAAC,SAAS,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,CAAA;QACxD,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAEwB,cAAc;;YACrC,MAAM,OAAO,GAAG,IAAI,gCAAc,CAA2B,EAAE,MAAM,EAAE,4DAAuB,EAAE,CAAC;iBAC9F,MAAM,CAAC,MAAM,IAAA,sBAAgB,EAAC,IAAA,iBAAQ,EAAC,IAAI,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC;iBAC5E,KAAK,EAAE,CAAA;YACV,OAAO,CAAC,OAAO,CAAC,CAAA;QAClB,CAAC;KAAA;;AAjBH,4DAkBC;AAfiB,sCAAa,GAAG,CAAC,6CAAoC,CAAC,CAAA"}
package/dist/cjs/index.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EthereumGasEthersPlugin = void 0;
4
- const tslib_1 = require("tslib");
5
- const Plugin_1 = require("./Plugin");
6
- Object.defineProperty(exports, "EthereumGasEthersPlugin", { enumerable: true, get: function () { return Plugin_1.EthereumGasEthersPlugin; } });
7
- tslib_1.__exportStar(require("./Config"), exports);
8
- tslib_1.__exportStar(require("./Schema"), exports);
9
- tslib_1.__exportStar(require("./Witness"), exports);
10
- // eslint-disable-next-line import/no-default-export
11
- exports.default = Plugin_1.EthereumGasEthersPlugin;
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qCAAkD;AAMzC,wGANA,gCAAuB,OAMA;AAJhC,mDAAwB;AACxB,mDAAwB;AACxB,oDAAyB;AAIzB,oDAAoD;AACpD,kBAAe,gCAAuB,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGasFromEthers = void 0;
4
- const tslib_1 = require("tslib");
5
- const formatFeeDataValue = (value) => {
6
- return value ? value.toNumber() : null;
7
- };
8
- const getGasFromEthers = (provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
- // https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData
10
- const feeData = yield provider.getFeeData();
11
- const formattedFeeData = {
12
- gasPrice: formatFeeDataValue(feeData.gasPrice),
13
- lastBaseFeePerGas: formatFeeDataValue(feeData.lastBaseFeePerGas),
14
- maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),
15
- maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),
16
- };
17
- return formattedFeeData;
18
- });
19
- exports.getGasFromEthers = getGasFromEthers;
20
- //# sourceMappingURL=getGasFromEthers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGasFromEthers.js","sourceRoot":"","sources":["../../../src/lib/getGasFromEthers.ts"],"names":[],"mappings":";;;;AAGA,MAAM,kBAAkB,GAAG,CAAC,KAAoC,EAAiB,EAAE;IACjF,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACxC,CAAC,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAO,QAAkB,EAAsC,EAAE;IAC/F,wEAAwE;IACxE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAA;IAC3C,MAAM,gBAAgB,GAA8B;QAClD,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC9C,iBAAiB,EAAE,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,CAAC;QAChE,YAAY,EAAE,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC;QACtD,oBAAoB,EAAE,kBAAkB,CAAC,OAAO,CAAC,oBAAoB,CAAC;KACvE,CAAA;IACD,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA,CAAA;AAVY,QAAA,gBAAgB,oBAU5B"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./getGasFromEthers"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;AAAA,6DAAkC"}