@xyo-network/ethers-ethereum-gas-plugin 5.2.3 → 5.3.1

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.
@@ -1,3 +1,5 @@
1
- export type EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config';
2
- export declare const EthereumGasEthersWitnessConfigSchema: EthereumGasEthersWitnessConfigSchema;
1
+ export type EthereumGasEthersWitnessConfigSchema = typeof EthereumGasEthersWitnessConfigSchema;
2
+ export declare const EthereumGasEthersWitnessConfigSchema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config" & {
3
+ readonly __schema: true;
4
+ };
3
5
  //# sourceMappingURL=Schema.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oCAAoC,GAAG,OAAO,oCAAoC,CAAA;AAC9F,eAAO,MAAM,oCAAoC;;CAA8E,CAAA"}
@@ -25,7 +25,8 @@ var getGasFromEthers = async (provider) => {
25
25
  };
26
26
 
27
27
  // src/Schema.ts
28
- var EthereumGasEthersWitnessConfigSchema = "network.xyo.blockchain.ethereum.gas.ethers.witness.config";
28
+ import { asSchema } from "@xyo-network/payload-model";
29
+ var EthereumGasEthersWitnessConfigSchema = asSchema("network.xyo.blockchain.ethereum.gas.ethers.witness.config", true);
29
30
 
30
31
  // src/Witness.ts
31
32
  var EthereumGasEthersWitness = class extends AbstractWitness {
@@ -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.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 type { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { Provider } from 'ethers'\n\nimport type { EthereumGasEthersWitnessConfig } from './Config.ts'\nimport { getGasFromEthers } from './lib/index.ts'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.ts'\n\nexport interface EthereumGasEthersWitnessParams extends WitnessParams<\n AnyConfigSchema<EthereumGasEthersWitnessConfig>>\n{\n provider?: Provider\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 = new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })\n .fields(await getGasFromEthers(assertEx(this.provider, () => 'Provider Required')))\n .build()\n return [payload]\n }\n}\n","import type { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport type { 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;AAEhC,SAAS,+BAA+B;AAExC,SAAS,sBAAsB;;;ACF/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,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC7F,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 type { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { Provider } from 'ethers'\n\nimport type { EthereumGasEthersWitnessConfig } from './Config.ts'\nimport { getGasFromEthers } from './lib/index.ts'\nimport { EthereumGasEthersWitnessConfigSchema } from './Schema.ts'\n\nexport interface EthereumGasEthersWitnessParams extends WitnessParams<\n AnyConfigSchema<EthereumGasEthersWitnessConfig>>\n{\n provider?: Provider\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 = new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })\n .fields(await getGasFromEthers(assertEx(this.provider, () => 'Provider Required')))\n .build()\n return [payload]\n }\n}\n","import type { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'\nimport type { 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","import { asSchema } from '@xyo-network/payload-model'\n\nexport type EthereumGasEthersWitnessConfigSchema = typeof EthereumGasEthersWitnessConfigSchema\nexport const EthereumGasEthersWitnessConfigSchema = asSchema('network.xyo.blockchain.ethereum.gas.ethers.witness.config', true)\n"],"mappings":";AAAA,SAAS,2BAAAA,gCAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAEhC,SAAS,+BAA+B;AAExC,SAAS,sBAAsB;;;ACF/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;;;ACjBA,SAAS,gBAAgB;AAGlB,IAAM,uCAAuC,SAAS,6DAA6D,IAAI;;;AFiBvH,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,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC7F,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/ethers-ethereum-gas-plugin",
3
- "version": "5.2.3",
3
+ "version": "5.3.1",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -36,26 +36,26 @@
36
36
  "!**/*.test.*"
37
37
  ],
38
38
  "dependencies": {
39
- "@xylabs/assert": "~5.0.49",
40
- "@xyo-network/abstract-witness": "~5.2.14",
41
- "@xyo-network/ethers-ethereum-gas-payload-plugin": "~5.2.3",
42
- "@xyo-network/module-model": "~5.2.14",
43
- "@xyo-network/payload-builder": "~5.2.14",
44
- "@xyo-network/payload-model": "~5.2.14",
45
- "@xyo-network/payloadset-plugin": "~5.2.14",
46
- "@xyo-network/witness-model": "~5.2.14",
47
- "ethers": "~6.16.0"
39
+ "@xylabs/assert": "~5.0.64",
40
+ "@xyo-network/abstract-witness": "~5.3.2",
41
+ "@xyo-network/ethers-ethereum-gas-payload-plugin": "5.3.1",
42
+ "@xyo-network/module-model": "~5.3.2",
43
+ "@xyo-network/payload-builder": "~5.3.2",
44
+ "@xyo-network/payload-model": "~5.3.2",
45
+ "@xyo-network/payloadset-plugin": "~5.3.2",
46
+ "@xyo-network/witness-model": "~5.3.2",
47
+ "ethers": "^6.16.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@xylabs/ts-scripts-yarn3": "~7.2.8",
51
- "@xylabs/tsconfig": "~7.2.8",
52
- "@xylabs/vitest-extended": "~5.0.49",
53
- "@xyo-network/payload-wrapper": "~5.2.14",
54
- "@xyo-network/witness-blockchain-abstract": "~5.2.14",
50
+ "@xylabs/ts-scripts-yarn3": "~7.3.2",
51
+ "@xylabs/tsconfig": "~7.3.2",
52
+ "@xylabs/vitest-extended": "~5.0.64",
53
+ "@xyo-network/payload-wrapper": "~5.3.2",
54
+ "@xyo-network/witness-blockchain-abstract": "~5.3.2",
55
55
  "typescript": "~5.9.3",
56
- "vitest": "~4.0.15"
56
+ "vitest": "~4.0.18"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  }
61
- }
61
+ }
package/src/Schema.ts CHANGED
@@ -1,2 +1,4 @@
1
- export type EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'
2
- export const EthereumGasEthersWitnessConfigSchema: EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config'
1
+ import { asSchema } from '@xyo-network/payload-model'
2
+
3
+ export type EthereumGasEthersWitnessConfigSchema = typeof EthereumGasEthersWitnessConfigSchema
4
+ export const EthereumGasEthersWitnessConfigSchema = asSchema('network.xyo.blockchain.ethereum.gas.ethers.witness.config', true)