bitski-provider
Advanced tools
Comparing version 2.0.0-beta.7 to 2.0.0-beta.8
# bitski-provider | ||
## 2.0.0-beta.8 | ||
### Major Changes | ||
- [#320](https://github.com/BitskiCo/bitski-js/pull/320) [`9be4413`](https://github.com/BitskiCo/bitski-js/commit/9be4413ee4d221118cb78f0b018c04e2aec04b81) Thanks [@pzuraq](https://github.com/pzuraq)! - Pass full context into showPopup rather than just the config" | ||
## 2.0.0-beta.7 | ||
@@ -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.7" }, ((_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.8" }, ((_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 |
@@ -48,5 +48,5 @@ import { ethErrors } from 'eth-rpc-errors'; | ||
}; | ||
const showIframe = (transaction, config) => { | ||
const showIframe = (transaction, context) => { | ||
return new Promise((fulfill, reject) => { | ||
const url = `${config.signerBaseUrl}/transactions/${transaction.id}`; | ||
const url = `${context.config.signerBaseUrl}/transactions/${transaction.id}`; | ||
const iframe = document.createElement('iframe'); | ||
@@ -107,5 +107,5 @@ iframe.style.position = 'absolute'; | ||
// Show the modal (await response) | ||
return showPopup(transaction, config); | ||
return showPopup(transaction, requestContext); | ||
} | ||
}; | ||
} |
@@ -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.7" }, ((_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.8" }, ((_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 |
@@ -1,6 +0,6 @@ | ||
import { InternalBitskiProviderConfig, SignFn } from '../types'; | ||
import { RequestContext, SignFn } from '../types'; | ||
import { Transaction } from '../utils/transaction'; | ||
export interface BrowserSignerConfig { | ||
showPopup: (transaction: Transaction, config: InternalBitskiProviderConfig) => Promise<string>; | ||
showPopup: (transaction: Transaction, context: RequestContext<unknown>) => Promise<string>; | ||
} | ||
export default function createBrowserSigner(signerConfig?: BrowserSignerConfig): SignFn; |
@@ -50,5 +50,5 @@ "use strict"; | ||
}; | ||
const showIframe = (transaction, config) => { | ||
const showIframe = (transaction, context) => { | ||
return new Promise((fulfill, reject) => { | ||
const url = `${config.signerBaseUrl}/transactions/${transaction.id}`; | ||
const url = `${context.config.signerBaseUrl}/transactions/${transaction.id}`; | ||
const iframe = document.createElement('iframe'); | ||
@@ -109,3 +109,3 @@ iframe.style.position = 'absolute'; | ||
// Show the modal (await response) | ||
return showPopup(transaction, config); | ||
return showPopup(transaction, requestContext); | ||
} | ||
@@ -112,0 +112,0 @@ }; |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "2.0.0-beta.7", | ||
"version": "2.0.0-beta.8", | ||
"scripts": { | ||
@@ -15,0 +15,0 @@ "test": "jest", |
import { ethErrors } from 'eth-rpc-errors'; | ||
import { IFRAME_MESSAGE_ORIGIN_ENDS_WITH } from '../constants'; | ||
import { InternalBitskiProviderConfig, SignFn } from '../types'; | ||
import { InternalBitskiProviderConfig, RequestContext, SignFn } from '../types'; | ||
import { fetchJsonWithRetry } from '../utils/fetch'; | ||
@@ -69,6 +69,6 @@ import { Dialog } from '../components/dialog'; | ||
transaction: Transaction, | ||
config: InternalBitskiProviderConfig, | ||
context: RequestContext<unknown>, | ||
): Promise<string> => { | ||
return new Promise((fulfill, reject) => { | ||
const url = `${config.signerBaseUrl}/transactions/${transaction.id}`; | ||
const url = `${context.config.signerBaseUrl}/transactions/${transaction.id}`; | ||
@@ -126,3 +126,3 @@ const iframe = document.createElement('iframe'); | ||
export interface BrowserSignerConfig { | ||
showPopup: (transaction: Transaction, config: InternalBitskiProviderConfig) => Promise<string>; | ||
showPopup: (transaction: Transaction, context: RequestContext<unknown>) => Promise<string>; | ||
} | ||
@@ -152,5 +152,5 @@ | ||
// Show the modal (await response) | ||
return showPopup(transaction, config); | ||
return showPopup(transaction, requestContext); | ||
} | ||
}; | ||
} |
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
353655