@xyo-network/blocknative-ethereum-gas-plugin 5.1.3 → 5.1.5

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.
@@ -9,12 +9,12 @@ import { EthereumGasBlocknativeSchema } from "@xyo-network/blocknative-ethereum-
9
9
  import { PayloadBuilder } from "@xyo-network/payload-builder";
10
10
 
11
11
  // src/lib/getGasFromBlocknative.ts
12
- import { axios } from "@xylabs/axios";
12
+ import { axiosJson } from "@xylabs/axios";
13
13
  var url = "https://api.blocknative.com/gasprices/blockprices";
14
14
  var Authorization = "9d3e23c3-e31d-4f9c-9d7c-c579cb75d226";
15
15
  var config = { headers: { Authorization } };
16
16
  var getGasFromBlocknative = async () => {
17
- return (await axios.get(url, config)).data;
17
+ return (await axiosJson.get(url, config)).data;
18
18
  };
19
19
 
20
20
  // src/Schema.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromBlocknative.ts","../../src/Schema.ts"],"sourcesContent":["import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasBlocknativeWitness } from './Witness.ts'\n\nexport const EthereumGasBlocknativePlugin = () =>\n createPayloadSetWitnessPlugin<EthereumGasBlocknativeWitness>(\n { required: { [EthereumGasBlocknativeSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return (await EthereumGasBlocknativeWitness.create(params)) as EthereumGasBlocknativeWitness\n },\n },\n )\n","import { AbstractWitness } from '@xyo-network/abstract-witness'\nimport type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-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 { TimestampWitnessParams } from '@xyo-network/witness-timestamp'\n\nimport type { EthereumGasBlocknativeWitnessConfig } from './Config.ts'\nimport { getGasFromBlocknative } from './lib/index.ts'\nimport { EthereumGasBlocknativeWitnessConfigSchema } from './Schema.ts'\n\nexport type EthereumGasBlocknativeWitnessParams = TimestampWitnessParams<AnyConfigSchema<EthereumGasBlocknativeWitnessConfig>>\nexport class EthereumGasBlocknativeWitness extends AbstractWitness<EthereumGasBlocknativeWitnessParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasBlocknativeWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = EthereumGasBlocknativeWitnessConfigSchema\n\n protected override async observeHandler(): Promise<Payload[]> {\n const fields = await getGasFromBlocknative()\n const payload = new PayloadBuilder<EthereumGasBlocknativePayload>({ schema: EthereumGasBlocknativeSchema })\n .fields(fields)\n .build()\n return [payload]\n }\n}\n","import { axios } from '@xylabs/axios'\nimport type { EthereumGasBlocknativeResponse } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\n\nconst url = 'https://api.blocknative.com/gasprices/blockprices'\n\nconst Authorization = '9d3e23c3-e31d-4f9c-9d7c-c579cb75d226'\nconst config = { headers: { Authorization } }\n\nexport const getGasFromBlocknative = async (): Promise<EthereumGasBlocknativeResponse> => {\n return (await axios.get<EthereumGasBlocknativeResponse>(url, config)).data\n}\n","export type EthereumGasBlocknativeWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.blocknative.witness.config'\nexport const EthereumGasBlocknativeWitnessConfigSchema: EthereumGasBlocknativeWitnessConfigSchema\n = 'network.xyo.blockchain.ethereum.gas.blocknative.witness.config'\n"],"mappings":";AAAA,SAAS,gCAAAA,qCAAoC;AAC7C,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,uBAAuB;AAEhC,SAAS,oCAAoC;AAE7C,SAAS,sBAAsB;;;ACJ/B,SAAS,aAAa;AAGtB,IAAM,MAAM;AAEZ,IAAM,gBAAgB;AACtB,IAAM,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE;AAErC,IAAM,wBAAwB,YAAqD;AACxF,UAAQ,MAAM,MAAM,IAAoC,KAAK,MAAM,GAAG;AACxE;;;ACTO,IAAM,4CACT;;;AFWG,IAAM,gCAAN,cAA4C,gBAAqD;AAAA,EACtG,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,yCAAyC;AAAA,EACrH,OAAyB,sBAA8B;AAAA,EAEvD,MAAyB,iBAAqC;AAC5D,UAAM,SAAS,MAAM,sBAAsB;AAC3C,UAAM,UAAU,IAAI,eAA8C,EAAE,QAAQ,6BAA6B,CAAC,EACvG,OAAO,MAAM,EACb,MAAM;AACT,WAAO,CAAC,OAAO;AAAA,EACjB;AACF;;;ADlBO,IAAM,+BAA+B,MAC1C;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,6BAA4B,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EAC5E;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,8BAA8B,OAAO,MAAM;AAAA,IAC3D;AAAA,EACF;AACF;","names":["EthereumGasBlocknativeSchema","EthereumGasBlocknativeSchema"]}
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/lib/getGasFromBlocknative.ts","../../src/Schema.ts"],"sourcesContent":["import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { EthereumGasBlocknativeWitness } from './Witness.ts'\n\nexport const EthereumGasBlocknativePlugin = () =>\n createPayloadSetWitnessPlugin<EthereumGasBlocknativeWitness>(\n { required: { [EthereumGasBlocknativeSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return (await EthereumGasBlocknativeWitness.create(params)) as EthereumGasBlocknativeWitness\n },\n },\n )\n","import { AbstractWitness } from '@xyo-network/abstract-witness'\nimport type { EthereumGasBlocknativePayload } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\nimport { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-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 { TimestampWitnessParams } from '@xyo-network/witness-timestamp'\n\nimport type { EthereumGasBlocknativeWitnessConfig } from './Config.ts'\nimport { getGasFromBlocknative } from './lib/index.ts'\nimport { EthereumGasBlocknativeWitnessConfigSchema } from './Schema.ts'\n\nexport type EthereumGasBlocknativeWitnessParams = TimestampWitnessParams<AnyConfigSchema<EthereumGasBlocknativeWitnessConfig>>\nexport class EthereumGasBlocknativeWitness extends AbstractWitness<EthereumGasBlocknativeWitnessParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EthereumGasBlocknativeWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = EthereumGasBlocknativeWitnessConfigSchema\n\n protected override async observeHandler(): Promise<Payload[]> {\n const fields = await getGasFromBlocknative()\n const payload = new PayloadBuilder<EthereumGasBlocknativePayload>({ schema: EthereumGasBlocknativeSchema })\n .fields(fields)\n .build()\n return [payload]\n }\n}\n","import { axiosJson } from '@xylabs/axios'\nimport type { EthereumGasBlocknativeResponse } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'\n\nconst url = 'https://api.blocknative.com/gasprices/blockprices'\n\nconst Authorization = '9d3e23c3-e31d-4f9c-9d7c-c579cb75d226'\nconst config = { headers: { Authorization } }\n\nexport const getGasFromBlocknative = async (): Promise<EthereumGasBlocknativeResponse> => {\n return (await axiosJson.get<EthereumGasBlocknativeResponse>(url, config)).data\n}\n","export type EthereumGasBlocknativeWitnessConfigSchema = 'network.xyo.blockchain.ethereum.gas.blocknative.witness.config'\nexport const EthereumGasBlocknativeWitnessConfigSchema: EthereumGasBlocknativeWitnessConfigSchema\n = 'network.xyo.blockchain.ethereum.gas.blocknative.witness.config'\n"],"mappings":";AAAA,SAAS,gCAAAA,qCAAoC;AAC7C,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,uBAAuB;AAEhC,SAAS,oCAAoC;AAE7C,SAAS,sBAAsB;;;ACJ/B,SAAS,iBAAiB;AAG1B,IAAM,MAAM;AAEZ,IAAM,gBAAgB;AACtB,IAAM,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE;AAErC,IAAM,wBAAwB,YAAqD;AACxF,UAAQ,MAAM,UAAU,IAAoC,KAAK,MAAM,GAAG;AAC5E;;;ACTO,IAAM,4CACT;;;AFWG,IAAM,gCAAN,cAA4C,gBAAqD;AAAA,EACtG,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,yCAAyC;AAAA,EACrH,OAAyB,sBAA8B;AAAA,EAEvD,MAAyB,iBAAqC;AAC5D,UAAM,SAAS,MAAM,sBAAsB;AAC3C,UAAM,UAAU,IAAI,eAA8C,EAAE,QAAQ,6BAA6B,CAAC,EACvG,OAAO,MAAM,EACb,MAAM;AACT,WAAO,CAAC,OAAO;AAAA,EACjB;AACF;;;ADlBO,IAAM,+BAA+B,MAC1C;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,6BAA4B,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EAC5E;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,8BAA8B,OAAO,MAAM;AAAA,IAC3D;AAAA,EACF;AACF;","names":["EthereumGasBlocknativeSchema","EthereumGasBlocknativeSchema"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/blocknative-ethereum-gas-plugin",
3
- "version": "5.1.3",
3
+ "version": "5.1.5",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,25 +30,28 @@
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src"
33
+ "src",
34
+ "!**/*.bench.*",
35
+ "!**/*.spec.*",
36
+ "!**/*.test.*"
34
37
  ],
35
38
  "dependencies": {
36
- "@xylabs/axios": "~5.0.11",
37
- "@xyo-network/abstract-witness": "~5.1.2",
38
- "@xyo-network/blocknative-ethereum-gas-payload-plugin": "~5.1.3",
39
- "@xyo-network/module-model": "~5.1.2",
40
- "@xyo-network/payload-builder": "~5.1.2",
41
- "@xyo-network/payload-model": "~5.1.2",
42
- "@xyo-network/payloadset-plugin": "~5.1.2",
43
- "@xyo-network/witness-timestamp": "~5.1.2"
39
+ "@xylabs/axios": "~5.0.37",
40
+ "@xyo-network/abstract-witness": "~5.1.23",
41
+ "@xyo-network/blocknative-ethereum-gas-payload-plugin": "~5.1.5",
42
+ "@xyo-network/module-model": "~5.1.23",
43
+ "@xyo-network/payload-builder": "~5.1.23",
44
+ "@xyo-network/payload-model": "~5.1.23",
45
+ "@xyo-network/payloadset-plugin": "~5.1.23",
46
+ "@xyo-network/witness-timestamp": "~5.1.23"
44
47
  },
45
48
  "devDependencies": {
46
- "@xylabs/ts-scripts-yarn3": "~7.1.7",
47
- "@xylabs/tsconfig": "~7.1.7",
48
- "@xylabs/vitest-extended": "~5.0.11",
49
- "@xyo-network/payload-wrapper": "~5.1.2",
50
- "typescript": "~5.9.2",
51
- "vitest": "~3.2.4"
49
+ "@xylabs/ts-scripts-yarn3": "~7.2.8",
50
+ "@xylabs/tsconfig": "~7.2.8",
51
+ "@xylabs/vitest-extended": "~5.0.37",
52
+ "@xyo-network/payload-wrapper": "~5.1.23",
53
+ "typescript": "~5.9.3",
54
+ "vitest": "~4.0.10"
52
55
  },
53
56
  "publishConfig": {
54
57
  "access": "public"
@@ -1,4 +1,4 @@
1
- import { axios } from '@xylabs/axios'
1
+ import { axiosJson } from '@xylabs/axios'
2
2
  import type { EthereumGasBlocknativeResponse } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
3
3
 
4
4
  const url = 'https://api.blocknative.com/gasprices/blockprices'
@@ -7,5 +7,5 @@ const Authorization = '9d3e23c3-e31d-4f9c-9d7c-c579cb75d226'
7
7
  const config = { headers: { Authorization } }
8
8
 
9
9
  export const getGasFromBlocknative = async (): Promise<EthereumGasBlocknativeResponse> => {
10
- return (await axios.get<EthereumGasBlocknativeResponse>(url, config)).data
10
+ return (await axiosJson.get<EthereumGasBlocknativeResponse>(url, config)).data
11
11
  }
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=getGasFromBlocknative.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGasFromBlocknative.spec.d.ts","sourceRoot":"","sources":["../../../../src/lib/spec/getGasFromBlocknative.spec.ts"],"names":[],"mappings":"AAEA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=Plugin.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Plugin.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=Witness.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Witness.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Witness.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,46 +0,0 @@
1
- // import { PendingBlockNumber } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
2
-
3
- import '@xylabs/vitest-extended'
4
-
5
- import {
6
- describe, expect,
7
- test,
8
- } from 'vitest'
9
-
10
- import { getGasFromBlocknative } from '../getGasFromBlocknative.ts'
11
-
12
- describe('getGasFromBlocknative', () => {
13
- test('returns prices', async () => {
14
- const result = await getGasFromBlocknative()
15
- expect(result).toBeObject()
16
- expect(result?.blockPrices).toBeArrayOfSize(1)
17
- for (let blockPrice of result.blockPrices) {
18
- expect(blockPrice.baseFeePerGas).toBeNumber()
19
- expect(blockPrice.blockNumber).toBeNumber()
20
- expect(blockPrice.estimatedPrices).toBeArrayOfSize(5)
21
- for (let estimatedPrice of blockPrice.estimatedPrices) {
22
- expect(estimatedPrice?.confidence).toBeNumber()
23
- expect(estimatedPrice?.maxFeePerGas).toBeNumber()
24
- expect(estimatedPrice?.maxPriorityFeePerGas).toBeNumber()
25
- expect(estimatedPrice?.price).toBeNumber()
26
- }
27
- expect(blockPrice.estimatedTransactionCount).toBeNumber()
28
- }
29
- /* expect(result?.estimatedBaseFees).toBeArrayOfSize(5)
30
- for (let index = 0; index < result?.estimatedBaseFees.length; index++) {
31
- const blockNumber = `pending+${index + 1}` as PendingBlockNumber
32
- const pendingBlockInfo = result.estimatedBaseFees?.[index]?.[blockNumber]
33
- expect(pendingBlockInfo.length).toBeGreaterThan(0)
34
- const pendingBlock = pendingBlockInfo?.[0]
35
- expect(pendingBlock).toBeObject()
36
- expect(pendingBlock?.baseFee).toBeNumber()
37
- expect(pendingBlock?.confidence).toBeNumber()
38
- } */
39
- expect(result?.currentBlockNumber).toBeNumber()
40
- expect(result?.maxPrice).toBeNumber()
41
- expect(result?.msSinceLastBlock).toBeNumber()
42
- expect(result?.network).toEqual('main')
43
- expect(result?.system).toEqual('ethereum')
44
- expect(result?.unit).toEqual('gwei')
45
- })
46
- })
@@ -1,19 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import { PayloadSetPluginResolver } from '@xyo-network/payloadset-plugin'
4
- import {
5
- describe, expect,
6
- test,
7
- } from 'vitest'
8
-
9
- import { EthereumGasBlocknativePlugin } from '../Plugin.ts'
10
- import { EthereumGasBlocknativeWitness } from '../Witness.ts'
11
-
12
- describe('EthereumGasBlocknativePlugin', () => {
13
- test('Add to Resolver', async () => {
14
- const plugin = EthereumGasBlocknativePlugin()
15
- const resolver = await new PayloadSetPluginResolver().register(plugin, { config: { schema: EthereumGasBlocknativeWitness.defaultConfigSchema } })
16
- expect(await resolver.resolve(plugin.set)).toBeObject()
17
- expect(await resolver.witness(plugin.set)).toBeObject()
18
- })
19
- })
@@ -1,24 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import { EthereumGasBlocknativeSchema } from '@xyo-network/blocknative-ethereum-gas-payload-plugin'
4
- import { PayloadWrapper } from '@xyo-network/payload-wrapper'
5
- import {
6
- describe, expect,
7
- it,
8
- } from 'vitest'
9
-
10
- import { EthereumGasBlocknativeWitnessConfigSchema } from '../Schema.ts'
11
- import { EthereumGasBlocknativeWitness } from '../Witness.ts'
12
-
13
- describe('EthereumGasBlocknativeWitness', () => {
14
- it('returns observation', async () => {
15
- const sut = await EthereumGasBlocknativeWitness.create({
16
- account: 'random',
17
- config: { schema: EthereumGasBlocknativeWitnessConfigSchema },
18
- })
19
- const [actual] = await sut.observe()
20
- expect(actual.schema).toBe(EthereumGasBlocknativeSchema)
21
- const answerWrapper = PayloadWrapper.wrap(actual)
22
- expect(await answerWrapper.getValid()).toBe(true)
23
- })
24
- })