@xyo-network/ethers-ethereum-gas-plugin 4.1.1 → 5.0.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.
@@ -1,29 +1,5 @@
1
- import { WitnessConfig, WitnessParams } from '@xyo-network/witness-model';
2
- import * as _xyo_network_payloadset_plugin from '@xyo-network/payloadset-plugin';
3
- import { AbstractWitness } from '@xyo-network/abstract-witness';
4
- import { AnyConfigSchema } from '@xyo-network/module-model';
5
- import { Schema, Payload } from '@xyo-network/payload-model';
6
- import { Provider } from 'ethers';
7
-
8
- type EthereumGasEthersWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.ethers.witness.config';
9
- declare const EthereumGasEthersWitnessConfigSchema: EthereumGasEthersWitnessConfigSchema;
10
-
11
- type EthereumGasEthersWitnessConfig = WitnessConfig<{
12
- schema: EthereumGasEthersWitnessConfigSchema;
13
- }>;
14
-
15
- interface EthereumGasEthersWitnessParams extends WitnessParams<AnyConfigSchema<EthereumGasEthersWitnessConfig>> {
16
- provider?: Provider;
17
- }
18
- declare class EthereumGasEthersWitness<TParams extends EthereumGasEthersWitnessParams = EthereumGasEthersWitnessParams> extends AbstractWitness<TParams> {
19
- static readonly configSchemas: Schema[];
20
- static readonly defaultConfigSchema: Schema;
21
- private _provider?;
22
- protected get provider(): Provider | undefined;
23
- protected observeHandler(): Promise<Payload[]>;
24
- }
25
-
26
- declare const EthereumGasEthersPlugin: () => _xyo_network_payloadset_plugin.PayloadSetWitnessPlugin<EthereumGasEthersWitness<EthereumGasEthersWitnessParams>>;
27
-
28
- export { EthereumGasEthersPlugin, EthereumGasEthersWitness, EthereumGasEthersWitnessConfigSchema, EthereumGasEthersPlugin as default };
29
- export type { EthereumGasEthersWitnessConfig, EthereumGasEthersWitnessParams };
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/ethers-ethereum-gas-plugin",
3
- "version": "4.1.1",
3
+ "version": "5.0.0",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -28,24 +28,27 @@
28
28
  },
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "src"
34
+ ],
31
35
  "dependencies": {
32
- "@xylabs/assert": "^4.13.23",
33
- "@xyo-network/abstract-witness": "^4.1.7",
34
- "@xyo-network/ethers-ethereum-gas-payload-plugin": "^4.1.1",
35
- "@xyo-network/module-model": "^4.1.7",
36
- "@xyo-network/payload-builder": "^4.1.7",
37
- "@xyo-network/payload-model": "^4.1.7",
38
- "@xyo-network/payloadset-plugin": "^4.1.7",
39
- "@xyo-network/witness-model": "^4.1.7",
36
+ "@xylabs/assert": "^5.0.0",
37
+ "@xyo-network/abstract-witness": "^5.0.0",
38
+ "@xyo-network/ethers-ethereum-gas-payload-plugin": "^5.0.0",
39
+ "@xyo-network/module-model": "^5.0.0",
40
+ "@xyo-network/payload-builder": "^5.0.0",
41
+ "@xyo-network/payload-model": "^5.0.0",
42
+ "@xyo-network/payloadset-plugin": "^5.0.0",
43
+ "@xyo-network/witness-model": "^5.0.0",
40
44
  "ethers": "^6.15.0"
41
45
  },
42
46
  "devDependencies": {
43
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.24",
44
- "@xylabs/tsconfig": "^7.0.0-rc.24",
45
- "@xylabs/vitest-extended": "^4.13.23",
46
- "@xyo-network/payload-wrapper": "^4.1.7",
47
- "@xyo-network/witness-blockchain-abstract": "^4.1.7",
48
- "knip": "^5.62.0",
47
+ "@xylabs/ts-scripts-yarn3": "^7.0.2",
48
+ "@xylabs/tsconfig": "^7.0.2",
49
+ "@xylabs/vitest-extended": "^5.0.0",
50
+ "@xyo-network/payload-wrapper": "^5.0.0",
51
+ "@xyo-network/witness-blockchain-abstract": "^5.0.0",
49
52
  "typescript": "^5.8.3",
50
53
  "vitest": "^3.2.4"
51
54
  },
@@ -0,0 +1,23 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { getProviderFromEnv } from '@xyo-network/witness-blockchain-abstract'
4
+ import {
5
+ describe, expect,
6
+ test,
7
+ } from 'vitest'
8
+
9
+ import { getGasFromEthers } from '../getGasFromEthers.ts'
10
+
11
+ const projectId = process.env.INFURA_PROJECT_ID || ''
12
+ const projectSecret = process.env.INFURA_PROJECT_SECRET || ''
13
+
14
+ describe('getGasFromEthers', () => {
15
+ test.skipIf(!projectId || !projectSecret)('returns prices', async () => {
16
+ const provider = getProviderFromEnv()
17
+ const result = await getGasFromEthers(provider)
18
+ expect(result).toBeObject()
19
+ expect(result.gasPrice).toBeNumber()
20
+ expect(result.maxFeePerGas).toBeNumber()
21
+ expect(result.maxPriorityFeePerGas).toBeNumber()
22
+ })
23
+ })
@@ -0,0 +1,27 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { PayloadSetPluginResolver } from '@xyo-network/payloadset-plugin'
4
+ import { getProviderFromEnv } from '@xyo-network/witness-blockchain-abstract'
5
+ import {
6
+ describe, expect,
7
+ test,
8
+ } from 'vitest'
9
+
10
+ import { EthereumGasEthersPlugin } from '../Plugin.ts'
11
+ import { EthereumGasEthersWitness } from '../Witness.ts'
12
+
13
+ const projectId = process.env.INFURA_PROJECT_ID || ''
14
+ const projectSecret = process.env.INFURA_PROJECT_SECRET || ''
15
+
16
+ describe('EthereumGasEthersPlugin', () => {
17
+ test.skipIf(!(projectId && projectSecret))('Add to Resolver', async () => {
18
+ const provider = getProviderFromEnv()
19
+ const plugin = EthereumGasEthersPlugin()
20
+ const resolver = await new PayloadSetPluginResolver().register(plugin, {
21
+ config: { schema: EthereumGasEthersWitness.defaultConfigSchema },
22
+ provider,
23
+ })
24
+ expect(await resolver.resolve(plugin.set)).toBeObject()
25
+ expect(await resolver.witness(plugin.set)).toBeObject()
26
+ })
27
+ })
@@ -0,0 +1,40 @@
1
+ import type { EthereumGasEthersPayload } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
2
+ import { EthereumGasEthersSchema } from '@xyo-network/ethers-ethereum-gas-payload-plugin'
3
+ import { PayloadWrapper } from '@xyo-network/payload-wrapper'
4
+ import { getProviderFromEnv } from '@xyo-network/witness-blockchain-abstract'
5
+
6
+ import { EthereumGasEthersWitnessConfigSchema } from '../Schema.ts'
7
+ import { EthereumGasEthersWitness } from '../Witness.ts'
8
+
9
+ const projectId = process.env.INFURA_PROJECT_ID || ''
10
+ const projectSecret = process.env.INFURA_PROJECT_SECRET || ''
11
+
12
+ import '@xylabs/vitest-extended'
13
+
14
+ import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
15
+ import {
16
+ describe, expect,
17
+ test,
18
+ } from 'vitest'
19
+
20
+ /**
21
+ * @group crypto
22
+ * @group slow
23
+ */
24
+
25
+ describe('EthereumGasEthersWitness', () => {
26
+ test.skipIf(!projectId || !projectSecret)('returns observation', async () => {
27
+ const provider = getProviderFromEnv()
28
+ const sut = await EthereumGasEthersWitness.create({
29
+ account: 'random',
30
+ config: { schema: EthereumGasEthersWitnessConfigSchema },
31
+ provider,
32
+ })
33
+ const observed = await sut.observe()
34
+ const actual = observed.find(isPayloadOfSchemaType<EthereumGasEthersPayload>(EthereumGasEthersSchema))
35
+ expect((actual as EthereumGasEthersPayload).gasPrice).toBeNumber()
36
+ expect(actual?.schema).toBe(EthereumGasEthersSchema)
37
+ const answerWrapper = PayloadWrapper.wrap(actual)
38
+ expect(await answerWrapper.getValid()).toBe(true)
39
+ })
40
+ })
package/typedoc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "https://typedoc.org/schema.json",
3
- "entryPoints": ["./src/index.ts"],
4
- "tsconfig": "./tsconfig.typedoc.json"
5
- }
package/xy.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
- const config: XyTsupConfig = {
3
- compile: {
4
- browser: {},
5
- node: {},
6
- neutral: { src: true },
7
- },
8
- }
9
-
10
- export default config