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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/ethers-ethereum-gas-plugin",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -35,25 +35,28 @@
35
35
  "!**/*.spec.*",
36
36
  "!**/*.test.*"
37
37
  ],
38
- "dependencies": {
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
- },
49
38
  "devDependencies": {
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",
39
+ "@xylabs/sdk-js": "^5.0.90",
40
+ "@xylabs/ts-scripts-yarn3": "~7.5.10",
41
+ "@xylabs/tsconfig": "~7.5.10",
42
+ "@xylabs/vitest-extended": "~5.0.90",
43
+ "@xyo-network/abstract-witness": "~5.3.5",
44
+ "@xyo-network/ethers-ethereum-gas-payload-plugin": "5.3.2",
45
+ "@xyo-network/module-model": "~5.3.5",
46
+ "@xyo-network/payload-model": "~5.3.5",
47
+ "@xyo-network/payloadset-plugin": "~5.3.5",
48
+ "@xyo-network/sdk-js": "~5.3.5",
49
+ "@xyo-network/witness-blockchain-abstract": "~5.3.5",
50
+ "@xyo-network/witness-model": "~5.3.5",
51
+ "ethers": "^6.16.0",
55
52
  "typescript": "~5.9.3",
56
- "vitest": "~4.0.18"
53
+ "vitest": "~4.1.2",
54
+ "zod": "^4.3.6"
55
+ },
56
+ "peerDependencies": {
57
+ "@xylabs/sdk-js": "^5",
58
+ "ethers": "^6",
59
+ "zod": "^4"
57
60
  },
58
61
  "publishConfig": {
59
62
  "access": "public"
package/src/Witness.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { assertEx } from '@xylabs/assert'
1
+ import { assertEx } from '@xylabs/sdk-js'
2
2
  import { AbstractWitness } from '@xyo-network/abstract-witness'
3
3
  import type { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
4
4
  import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
5
5
  import type { AnyConfigSchema } from '@xyo-network/module-model'
6
- import { PayloadBuilder } from '@xyo-network/payload-builder'
7
6
  import type { Payload, Schema } from '@xyo-network/payload-model'
7
+ import { PayloadBuilder } from '@xyo-network/sdk-js'
8
8
  import type { WitnessParams } from '@xyo-network/witness-model'
9
9
  import type { Provider } from 'ethers'
10
10
 
@@ -1,6 +0,0 @@
1
- import type { WitnessConfig } from '@xyo-network/witness-model';
2
- import type { EthereumGasEthersWitnessConfigSchema } from './Schema.ts';
3
- export type EthereumGasEthersWitnessConfig = WitnessConfig<{
4
- schema: EthereumGasEthersWitnessConfigSchema;
5
- }>;
6
- //# sourceMappingURL=Config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,aAAa,CAAA;AAEvE,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;IACzD,MAAM,EAAE,oCAAoC,CAAA;CAC7C,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import { EthereumGasEthersWitness } from './Witness.ts';
2
- export declare const EthereumGasEthersPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<EthereumGasEthersWitness<import("./Witness.ts").EthereumGasEthersWitnessParams>>;
3
- //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAEvD,eAAO,MAAM,uBAAuB,yJAQjC,CAAA"}
@@ -1,5 +0,0 @@
1
- export type EthereumGasEthersWitnessConfigSchema = typeof EthereumGasEthersWitnessConfigSchema;
2
- export declare const EthereumGasEthersWitnessConfigSchema: "network.xyo.blockchain.ethereum.gas.ethers.witness.config" & {
3
- readonly __schema: true;
4
- };
5
- //# sourceMappingURL=Schema.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,17 +0,0 @@
1
- import { AbstractWitness } from '@xyo-network/abstract-witness';
2
- import type { AnyConfigSchema } from '@xyo-network/module-model';
3
- import type { Payload, Schema } from '@xyo-network/payload-model';
4
- import type { WitnessParams } from '@xyo-network/witness-model';
5
- import type { Provider } from 'ethers';
6
- import type { EthereumGasEthersWitnessConfig } from './Config.ts';
7
- export interface EthereumGasEthersWitnessParams extends WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>> {
8
- provider?: Provider;
9
- }
10
- export declare class EthereumGasEthersWitness<TParams extends EthereumGasEthersWitnessParams = EthereumGasEthersWitnessParams> extends AbstractWitness<TParams> {
11
- static readonly configSchemas: Schema[];
12
- static readonly defaultConfigSchema: Schema;
13
- private _provider?;
14
- protected get provider(): Provider | undefined;
15
- protected observeHandler(): Promise<Payload[]>;
16
- }
17
- //# sourceMappingURL=Witness.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAG/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAA;AAIjE,MAAM,WAAW,8BAA+B,SAAQ,aAAa,CACnE,eAAe,CAAC,8BAA8B,CAAC,CAAC;IAEhD,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,qBAAa,wBAAwB,CACnC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAC/E,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,OAAO,CAAC,SAAS,CAAC,CAAU;IAE5B,SAAS,KAAK,QAAQ,yBAGrB;cAEwB,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAM9D"}
@@ -1,5 +0,0 @@
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
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,uBAAuB,IAAI,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACzF,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
@@ -1,61 +0,0 @@
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 { AbstractWitness } from "@xyo-network/abstract-witness";
9
- import { EthereumGasEthersSchema } from "@xyo-network/ethers-ethereum-gas-payload-plugin";
10
- import { PayloadBuilder } from "@xyo-network/payload-builder";
11
-
12
- // src/lib/getGasFromEthers.ts
13
- var formatFeeDataValue = (value) => {
14
- return value ? Number(value) : null;
15
- };
16
- var getGasFromEthers = async (provider) => {
17
- const feeData = await provider.getFeeData();
18
- const formattedFeeData = {
19
- gasPrice: formatFeeDataValue(feeData.gasPrice),
20
- maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),
21
- maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),
22
- timestamp: Date.now()
23
- };
24
- return formattedFeeData;
25
- };
26
-
27
- // src/Schema.ts
28
- import { asSchema } from "@xyo-network/payload-model";
29
- var EthereumGasEthersWitnessConfigSchema = asSchema("network.xyo.blockchain.ethereum.gas.ethers.witness.config", true);
30
-
31
- // src/Witness.ts
32
- var EthereumGasEthersWitness = class extends AbstractWitness {
33
- static configSchemas = [...super.configSchemas, EthereumGasEthersWitnessConfigSchema];
34
- static defaultConfigSchema = EthereumGasEthersWitnessConfigSchema;
35
- _provider;
36
- get provider() {
37
- this._provider = this._provider ?? this.params?.provider;
38
- return this._provider;
39
- }
40
- async observeHandler() {
41
- const payload = new PayloadBuilder({ schema: EthereumGasEthersSchema }).fields(await getGasFromEthers(assertEx(this.provider, () => "Provider Required"))).build();
42
- return [payload];
43
- }
44
- };
45
-
46
- // src/Plugin.ts
47
- var EthereumGasEthersPlugin = () => createPayloadSetWitnessPlugin(
48
- { required: { [EthereumGasEthersSchema2]: 1 }, schema: PayloadSetSchema },
49
- {
50
- witness: async (params) => {
51
- return await EthereumGasEthersWitness.create(params);
52
- }
53
- }
54
- );
55
- export {
56
- EthereumGasEthersPlugin,
57
- EthereumGasEthersWitness,
58
- EthereumGasEthersWitnessConfigSchema,
59
- EthereumGasEthersPlugin as default
60
- };
61
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
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,qCAA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
1
- import type { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin';
2
- import type { Provider } from 'ethers';
3
- export declare const getGasFromEthers: (provider: Provider) => Promise<EthereumGasEthersResponse>;
4
- //# sourceMappingURL=getGasFromEthers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGasFromEthers.d.ts","sourceRoot":"","sources":["../../../src/lib/getGasFromEthers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAChG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAMtC,eAAO,MAAM,gBAAgB,GAAU,UAAU,QAAQ,KAAG,OAAO,CAAC,yBAAyB,CAU5F,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './getGasFromEthers.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}