@xyo-network/ethers-ethereum-gas-plugin 5.3.1 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/Witness.d.ts.map +1 -1
- package/dist/neutral/index.mjs +2 -2
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +29 -20
- package/src/Config.ts +0 -7
- package/src/Plugin.ts +0 -15
- package/src/Schema.ts +0 -4
- package/src/Witness.ts +0 -40
- package/src/index.ts +0 -4
- package/src/lib/getGasFromEthers.ts +0 -18
- package/src/lib/index.ts +0 -1
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEjE,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"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import { PayloadSetSchema } from "@xyo-network/payload-model";
|
|
|
4
4
|
import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
|
|
5
5
|
|
|
6
6
|
// src/Witness.ts
|
|
7
|
-
import { assertEx } from "@xylabs/
|
|
7
|
+
import { assertEx } from "@xylabs/sdk-js";
|
|
8
8
|
import { AbstractWitness } from "@xyo-network/abstract-witness";
|
|
9
9
|
import { EthereumGasEthersSchema } from "@xyo-network/ethers-ethereum-gas-payload-plugin";
|
|
10
|
-
import { PayloadBuilder } from "@xyo-network/
|
|
10
|
+
import { PayloadBuilder } from "@xyo-network/sdk-js";
|
|
11
11
|
|
|
12
12
|
// src/lib/getGasFromEthers.ts
|
|
13
13
|
var formatFeeDataValue = (value) => {
|
|
@@ -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/
|
|
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/sdk-js'\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 type { Payload, Schema } from '@xyo-network/payload-model'\nimport { PayloadBuilder } from '@xyo-network/sdk-js'\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;AAGxC,SAAS,sBAAsB;;;ACH/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.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,30 +30,39 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"
|
|
34
|
-
"!**/*.bench.*",
|
|
35
|
-
"!**/*.spec.*",
|
|
36
|
-
"!**/*.test.*"
|
|
33
|
+
"README.md"
|
|
37
34
|
],
|
|
38
35
|
"dependencies": {
|
|
39
|
-
"@
|
|
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"
|
|
36
|
+
"@xyo-network/ethers-ethereum-gas-payload-plugin": "workspace:^"
|
|
48
37
|
},
|
|
49
38
|
"devDependencies": {
|
|
50
|
-
"@xylabs/
|
|
51
|
-
"@xylabs/
|
|
52
|
-
"@xylabs/
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
39
|
+
"@xylabs/sdk-js": "^5.0.90",
|
|
40
|
+
"@xylabs/ts-scripts-common": "~7.5.10",
|
|
41
|
+
"@xylabs/ts-scripts-yarn3": "~7.5.10",
|
|
42
|
+
"@xylabs/tsconfig": "~7.5.10",
|
|
43
|
+
"@xylabs/vitest-extended": "~5.0.90",
|
|
44
|
+
"@xyo-network/abstract-witness": "~5.3.5",
|
|
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.
|
|
53
|
+
"vitest": "~4.1.2",
|
|
54
|
+
"zod": "^4.3.6"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@xylabs/sdk-js": "^5",
|
|
58
|
+
"@xyo-network/abstract-witness": "^5",
|
|
59
|
+
"@xyo-network/module-model": "^5",
|
|
60
|
+
"@xyo-network/payload-model": "^5",
|
|
61
|
+
"@xyo-network/payloadset-plugin": "^5",
|
|
62
|
+
"@xyo-network/sdk-js": "^5",
|
|
63
|
+
"@xyo-network/witness-model": "^5",
|
|
64
|
+
"ethers": "^6",
|
|
65
|
+
"zod": "^4"
|
|
57
66
|
},
|
|
58
67
|
"publishConfig": {
|
|
59
68
|
"access": "public"
|
package/src/Config.ts
DELETED
package/src/Plugin.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
2
|
-
import { PayloadSetSchema } from '@xyo-network/payload-model'
|
|
3
|
-
import { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'
|
|
4
|
-
|
|
5
|
-
import { EthereumGasEthersWitness } from './Witness.ts'
|
|
6
|
-
|
|
7
|
-
export const EthereumGasEthersPlugin = () =>
|
|
8
|
-
createPayloadSetWitnessPlugin<EthereumGasEthersWitness>(
|
|
9
|
-
{ required: { [EthereumGasEthersSchema]: 1 }, schema: PayloadSetSchema },
|
|
10
|
-
{
|
|
11
|
-
witness: async (params) => {
|
|
12
|
-
return await EthereumGasEthersWitness.create(params)
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
)
|
package/src/Schema.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
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)
|
package/src/Witness.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness'
|
|
3
|
-
import type { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
4
|
-
import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
5
|
-
import type { AnyConfigSchema } from '@xyo-network/module-model'
|
|
6
|
-
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
7
|
-
import type { Payload, Schema } from '@xyo-network/payload-model'
|
|
8
|
-
import type { WitnessParams } from '@xyo-network/witness-model'
|
|
9
|
-
import type { Provider } from 'ethers'
|
|
10
|
-
|
|
11
|
-
import type { EthereumGasEthersWitnessConfig } from './Config.ts'
|
|
12
|
-
import { getGasFromEthers } from './lib/index.ts'
|
|
13
|
-
import { EthereumGasEthersWitnessConfigSchema } from './Schema.ts'
|
|
14
|
-
|
|
15
|
-
export interface EthereumGasEthersWitnessParams extends WitnessParams<
|
|
16
|
-
AnyConfigSchema<EthereumGasEthersWitnessConfig>>
|
|
17
|
-
{
|
|
18
|
-
provider?: Provider
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class EthereumGasEthersWitness<
|
|
22
|
-
TParams extends EthereumGasEthersWitnessParams = EthereumGasEthersWitnessParams,
|
|
23
|
-
> extends AbstractWitness<TParams> {
|
|
24
|
-
static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasEthersWitnessConfigSchema]
|
|
25
|
-
static override readonly defaultConfigSchema: Schema = EthereumGasEthersWitnessConfigSchema
|
|
26
|
-
|
|
27
|
-
private _provider?: Provider
|
|
28
|
-
|
|
29
|
-
protected get provider() {
|
|
30
|
-
this._provider = this._provider ?? this.params?.provider
|
|
31
|
-
return this._provider
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
protected override async observeHandler(): Promise<Payload[]> {
|
|
35
|
-
const payload = new PayloadBuilder<EthereumGasEthersPayload>({ schema: EthereumGasEthersSchema })
|
|
36
|
-
.fields(await getGasFromEthers(assertEx(this.provider, () => 'Provider Required')))
|
|
37
|
-
.build()
|
|
38
|
-
return [payload]
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { EthereumGasEthersResponse } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
|
|
2
|
-
import type { Provider } from 'ethers'
|
|
3
|
-
|
|
4
|
-
const formatFeeDataValue = (value: bigint | null) => {
|
|
5
|
-
return value ? Number(value) : null
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const getGasFromEthers = async (provider: Provider): Promise<EthereumGasEthersResponse> => {
|
|
9
|
-
// https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData
|
|
10
|
-
const feeData = await provider.getFeeData()
|
|
11
|
-
const formattedFeeData: EthereumGasEthersResponse = {
|
|
12
|
-
gasPrice: formatFeeDataValue(feeData.gasPrice),
|
|
13
|
-
maxFeePerGas: formatFeeDataValue(feeData.maxFeePerGas),
|
|
14
|
-
maxPriorityFeePerGas: formatFeeDataValue(feeData.maxPriorityFeePerGas),
|
|
15
|
-
timestamp: Date.now(),
|
|
16
|
-
}
|
|
17
|
-
return formattedFeeData
|
|
18
|
-
}
|
package/src/lib/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './getGasFromEthers.ts'
|