From 635fb050ed0061dd9f7784f60b6ca6568b8e5fab Mon Sep 17 00:00:00 2001 From: Aaron Barnard Date: Wed, 27 Jul 2022 13:52:36 +1000 Subject: [PATCH 1/2] Modifies results to be an array rather than a map --- packages/gas/src/get.ts | 13 +------------ packages/gas/src/stream.ts | 15 +++------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/packages/gas/src/get.ts b/packages/gas/src/get.ts index e5df93f10..7bffd98a4 100644 --- a/packages/gas/src/get.ts +++ b/packages/gas/src/get.ts @@ -1,13 +1,10 @@ import { firstValueFrom, zip } from 'rxjs' -import { map } from 'rxjs/operators' import { ajax } from 'rxjs/ajax' import { getRequestUrl } from './utils' import { RequestOptions, ChainId, GasPlatformResponse } from './types' import { validateRequest } from './validation' -function get( - options: RequestOptions -): Promise> { +function get(options: RequestOptions): Promise { const invalid = validateRequest(options) if (invalid) { @@ -26,14 +23,6 @@ function get( requestUrls.map(({ url, headers }) => ajax.getJSON(url, headers) ) - ).pipe( - // reduce to mapping of chainId -> gas data - map(data => - chains.reduce((acc, chainId, index) => { - acc[chainId] = data[index] - return acc - }, {}) - ) ) ) } diff --git a/packages/gas/src/stream.ts b/packages/gas/src/stream.ts index 0edfe6bdf..ed4839e00 100644 --- a/packages/gas/src/stream.ts +++ b/packages/gas/src/stream.ts @@ -1,13 +1,11 @@ import { Observable, timer, zip } from 'rxjs' -import { switchMap, map } from 'rxjs/operators' +import { switchMap } from 'rxjs/operators' import { ajax } from 'rxjs/ajax' import { getRequestUrl } from './utils' -import { StreamOptions, ChainId, GasPlatformResponse } from './types' +import { StreamOptions, GasPlatformResponse } from './types' import { validateRequest } from './validation' -function stream( - options: StreamOptions -): Observable> { +function stream(options: StreamOptions): Observable { const invalid = validateRequest(options) if (invalid) { @@ -29,13 +27,6 @@ function stream( ajax.getJSON(url, headers) ) ) - ), - // reduce to mapping of chainId -> gas data - map(data => - chains.reduce((acc, chainId, index) => { - acc[chainId] = data[index] - return acc - }, {}) ) ) } From fc7978a1f657f1f95c00bc507f80bcd74bbfaafe Mon Sep 17 00:00:00 2001 From: Aaron Barnard Date: Wed, 27 Jul 2022 13:52:45 +1000 Subject: [PATCH 2/2] Increments versions --- packages/core/package.json | 4 ++-- packages/gas/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index fcf530769..3ebc2b89c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.6", + "version": "2.6.0-alpha.7", "description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.", "keywords": [ "Ethereum", @@ -68,7 +68,7 @@ "@types/lodash.partition": "^4.6.6", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", - "@web3-onboard/gas": "^2.0.0-alpha.1", + "@web3-onboard/gas": "^2.0.0-alpha.2", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.1", diff --git a/packages/gas/package.json b/packages/gas/package.json index 71fe34606..333d62701 100644 --- a/packages/gas/package.json +++ b/packages/gas/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/gas", - "version": "2.0.0-alpha.1", + "version": "2.0.0-alpha.2", "description": "Gas", "keywords": [ "gas"