bitski-provider
Advanced tools
Comparing version 2.0.0-beta.3 to 2.0.0-beta.4
# bitski-provider | ||
## 2.0.0-beta.4 | ||
### Patch Changes | ||
- [#311](https://github.com/BitskiCo/bitski-js/pull/311) [`8c28993`](https://github.com/BitskiCo/bitski-js/commit/8c289930361aea0b3bfab2d4753908068a241e54) Thanks [@pzuraq](https://github.com/pzuraq)! - Fix fetch-rest result format | ||
## 2.0.0-beta.3 | ||
@@ -4,0 +10,0 @@ |
@@ -43,3 +43,3 @@ import { createAsyncMiddleware, JsonRpcEngine, } from 'json-rpc-engine'; | ||
this.activeSubs = new Set(); | ||
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.3" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : createBrowserSigner() }); | ||
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.4" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : createBrowserSigner() }); | ||
this.store = new BitskiProviderStateStore(this.config.store); | ||
@@ -46,0 +46,0 @@ // Setup the engine |
import { EthMethod } from 'eth-provider-types'; | ||
import { createAsyncMiddleware } from 'json-rpc-engine'; | ||
import { getRequestContext } from '../utils/request-context'; | ||
import { fetchJsonRpcWithRetry } from '../utils/fetch'; | ||
import { fetchJsonWithRetry } from '../utils/fetch'; | ||
const MATCHING_METHODS = [ | ||
@@ -23,3 +23,3 @@ EthMethod.eth_getBlockByNumber, | ||
const headers = Object.assign({}, config.additionalHeaders); | ||
res.result = fetchJsonRpcWithRetry(config.fetch, 5, url, { | ||
res.result = fetchJsonWithRetry(config.fetch, 5, url, { | ||
method: 'GET', | ||
@@ -26,0 +26,0 @@ headers, |
@@ -12,5 +12,2 @@ // jshint esversion: 9 | ||
}, | ||
moduleNameMapper: { | ||
'eth-provider-types': '<rootDir>/../eth-provider-types/index.ts', | ||
}, | ||
testRegex: '(/tests/.*.(test|spec)).(jsx?|tsx?)$', | ||
@@ -17,0 +14,0 @@ automock: false, |
@@ -49,3 +49,3 @@ "use strict"; | ||
this.activeSubs = new Set(); | ||
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.3" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : constants_1.BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : constants_1.BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new store_1.LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : (0, browser_1.default)() }); | ||
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.4" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : constants_1.BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : constants_1.BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new store_1.LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : (0, browser_1.default)() }); | ||
this.store = new store_1.BitskiProviderStateStore(this.config.store); | ||
@@ -52,0 +52,0 @@ // Setup the engine |
@@ -26,3 +26,3 @@ "use strict"; | ||
const headers = Object.assign({}, config.additionalHeaders); | ||
res.result = (0, fetch_1.fetchJsonRpcWithRetry)(config.fetch, 5, url, { | ||
res.result = (0, fetch_1.fetchJsonWithRetry)(config.fetch, 5, url, { | ||
method: 'GET', | ||
@@ -29,0 +29,0 @@ headers, |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "2.0.0-beta.3", | ||
"version": "2.0.0-beta.4", | ||
"scripts": { | ||
@@ -15,0 +15,0 @@ "test": "jest", |
import { EthMethod } from 'eth-provider-types'; | ||
import { createAsyncMiddleware, JsonRpcMiddleware } from 'json-rpc-engine'; | ||
import { getRequestContext } from '../utils/request-context'; | ||
import { fetchJsonRpcWithRetry } from '../utils/fetch'; | ||
import { fetchJsonWithRetry } from '../utils/fetch'; | ||
@@ -30,3 +30,3 @@ const MATCHING_METHODS: string[] = [ | ||
res.result = fetchJsonRpcWithRetry(config.fetch, 5, url, { | ||
res.result = fetchJsonWithRetry(config.fetch, 5, url, { | ||
method: 'GET', | ||
@@ -33,0 +33,0 @@ headers, |
@@ -17,7 +17,3 @@ import { EthMethod } from 'eth-provider-types'; | ||
return JSON.stringify({ | ||
id: 0, | ||
jsonrpc: '2.0', | ||
result: '0x123', | ||
}); | ||
return JSON.stringify('0x123'); | ||
}); | ||
@@ -50,9 +46,3 @@ | ||
return JSON.stringify({ | ||
id: 0, | ||
jsonrpc: '2.0', | ||
result: { | ||
number: '0x123', | ||
}, | ||
}); | ||
return JSON.stringify({ number: '0x123' }); | ||
}); | ||
@@ -59,0 +49,0 @@ |
@@ -29,11 +29,9 @@ import { EthMethod } from 'eth-provider-types'; | ||
if (req.url.includes(EthMethod.eth_blockNumber)) { | ||
return JSON.stringify({ result: toHex(currentBlockNumber) }); | ||
return JSON.stringify(toHex(currentBlockNumber)); | ||
} else { | ||
return JSON.stringify({ | ||
result: [ | ||
{ | ||
topics: ['0x123'], | ||
}, | ||
], | ||
}); | ||
return JSON.stringify([ | ||
{ | ||
topics: ['0x123'], | ||
}, | ||
]); | ||
} | ||
@@ -40,0 +38,0 @@ }); |
@@ -30,8 +30,6 @@ import { EthEvent, EthMethod } from 'eth-provider-types'; | ||
if (req.url.includes(EthMethod.eth_blockNumber)) { | ||
return JSON.stringify({ result: toHex(currentBlockNumber) }); | ||
return JSON.stringify(toHex(currentBlockNumber)); | ||
} else { | ||
return JSON.stringify({ | ||
result: { | ||
number: toHex(currentBlockNumber), | ||
}, | ||
number: toHex(currentBlockNumber), | ||
}); | ||
@@ -38,0 +36,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
348354
7541