Skip to content

Commit 9b285dc

Browse files
authored
[gas:2.0.0-alpha.2] [core:2.6.0-alpha.7] - [enhancement] - Modify Gas API Response (#1171)
* Modifies results to be an array rather than a map * Increments versions
1 parent 1b3fc9e commit 9b285dc

File tree

4 files changed

+7
-27
lines changed

4 files changed

+7
-27
lines changed

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.6.0-alpha.6",
3+
"version": "2.6.0-alpha.7",
44
"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.",
55
"keywords": [
66
"Ethereum",
@@ -68,7 +68,7 @@
6868
"@types/lodash.partition": "^4.6.6",
6969
"@typescript-eslint/eslint-plugin": "^4.31.1",
7070
"@typescript-eslint/parser": "^4.31.1",
71-
"@web3-onboard/gas": "^2.0.0-alpha.1",
71+
"@web3-onboard/gas": "^2.0.0-alpha.2",
7272
"eslint": "^7.32.0",
7373
"eslint-config-prettier": "^8.3.0",
7474
"eslint-plugin-svelte3": "^3.2.1",

packages/gas/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/gas",
3-
"version": "2.0.0-alpha.1",
3+
"version": "2.0.0-alpha.2",
44
"description": "Gas",
55
"keywords": [
66
"gas"

packages/gas/src/get.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { firstValueFrom, zip } from 'rxjs'
2-
import { map } from 'rxjs/operators'
32
import { ajax } from 'rxjs/ajax'
43
import { getRequestUrl } from './utils'
54
import { RequestOptions, ChainId, GasPlatformResponse } from './types'
65
import { validateRequest } from './validation'
76

8-
function get(
9-
options: RequestOptions
10-
): Promise<Record<ChainId, GasPlatformResponse>> {
7+
function get(options: RequestOptions): Promise<GasPlatformResponse[]> {
118
const invalid = validateRequest(options)
129

1310
if (invalid) {
@@ -26,14 +23,6 @@ function get(
2623
requestUrls.map(({ url, headers }) =>
2724
ajax.getJSON<GasPlatformResponse>(url, headers)
2825
)
29-
).pipe(
30-
// reduce to mapping of chainId -> gas data
31-
map(data =>
32-
chains.reduce((acc, chainId, index) => {
33-
acc[chainId] = data[index]
34-
return acc
35-
}, {})
36-
)
3726
)
3827
)
3928
}

packages/gas/src/stream.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { Observable, timer, zip } from 'rxjs'
2-
import { switchMap, map } from 'rxjs/operators'
2+
import { switchMap } from 'rxjs/operators'
33
import { ajax } from 'rxjs/ajax'
44
import { getRequestUrl } from './utils'
5-
import { StreamOptions, ChainId, GasPlatformResponse } from './types'
5+
import { StreamOptions, GasPlatformResponse } from './types'
66
import { validateRequest } from './validation'
77

8-
function stream(
9-
options: StreamOptions
10-
): Observable<Record<ChainId, GasPlatformResponse>> {
8+
function stream(options: StreamOptions): Observable<GasPlatformResponse[]> {
119
const invalid = validateRequest(options)
1210

1311
if (invalid) {
@@ -29,13 +27,6 @@ function stream(
2927
ajax.getJSON<GasPlatformResponse>(url, headers)
3028
)
3129
)
32-
),
33-
// reduce to mapping of chainId -> gas data
34-
map(data =>
35-
chains.reduce((acc, chainId, index) => {
36-
acc[chainId] = data[index]
37-
return acc
38-
}, {})
3930
)
4031
)
4132
}

0 commit comments

Comments
 (0)