@imtbl/sdk 1.1.0 → 1.1.2
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.
- package/dist/blockchain_data.js +9 -22
- package/dist/browser/checkout/sdk.js +5 -5
- package/dist/browser/checkout/widgets.js +11 -11
- package/dist/checkout.js +30 -38
- package/dist/config.js +8 -6
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +37 -66
- package/dist/index.js +37 -66
- package/dist/orderbook.js +8 -21
- package/dist/passport.js +13 -32
- package/dist/x.js +9 -22
- package/package.json +1 -1
package/dist/checkout.js
CHANGED
|
@@ -22,6 +22,7 @@ var Detail$1;
|
|
|
22
22
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
23
23
|
Detail["IDENTITY"] = "uid";
|
|
24
24
|
Detail["DOMAIN"] = "domain";
|
|
25
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
25
26
|
})(Detail$1 || (Detail$1 = {}));
|
|
26
27
|
var Store$1;
|
|
27
28
|
(function (Store) {
|
|
@@ -115,7 +116,7 @@ const getDetail$1 = (key) => {
|
|
|
115
116
|
const getAllDetails$1 = () => RUNTIME_DETAILS$1;
|
|
116
117
|
// Events
|
|
117
118
|
const getEvents$1 = () => EVENT_STORE$1;
|
|
118
|
-
const addEvent
|
|
119
|
+
const addEvent = (event) => {
|
|
119
120
|
EVENT_STORE$1.push(event);
|
|
120
121
|
setItem$1(Store$1.EVENTS, EVENT_STORE$1);
|
|
121
122
|
};
|
|
@@ -136,6 +137,8 @@ const flattenProperties$1 = (properties) => {
|
|
|
136
137
|
return propertyMap;
|
|
137
138
|
};
|
|
138
139
|
|
|
140
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
141
|
+
const SDK_VERSION$1 = '1.1.2';
|
|
139
142
|
let initialised$1 = false;
|
|
140
143
|
const isInitialised$1 = () => initialised$1;
|
|
141
144
|
const getReferrer$1 = () => {
|
|
@@ -158,14 +161,16 @@ const runtimeHost$1 = () => {
|
|
|
158
161
|
return new URL(window.location.href).hostname;
|
|
159
162
|
};
|
|
160
163
|
const getRuntimeDetails$1 = () => {
|
|
164
|
+
storeDetail$1(Detail$1.SDK_VERSION, SDK_VERSION$1);
|
|
161
165
|
if (isNode$1()) {
|
|
162
|
-
return { browser: 'nodejs' };
|
|
166
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION$1 };
|
|
163
167
|
}
|
|
164
168
|
const domain = runtimeHost$1();
|
|
165
169
|
if (domain) {
|
|
166
170
|
storeDetail$1(Detail$1.DOMAIN, domain);
|
|
167
171
|
}
|
|
168
172
|
return {
|
|
173
|
+
sdkVersion: SDK_VERSION$1,
|
|
169
174
|
browser: window.navigator.userAgent,
|
|
170
175
|
domain,
|
|
171
176
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -174,7 +179,6 @@ const getRuntimeDetails$1 = () => {
|
|
|
174
179
|
};
|
|
175
180
|
const initialise$2 = async () => {
|
|
176
181
|
const runtimeDetails = flattenProperties$1(getRuntimeDetails$1());
|
|
177
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
178
182
|
const existingRuntimeId = getDetail$1(Detail$1.RUNTIME_ID);
|
|
179
183
|
const body = {
|
|
180
184
|
version: 1,
|
|
@@ -214,19 +218,21 @@ function isTestEnvironment$1() {
|
|
|
214
218
|
if (typeof process === 'undefined') {
|
|
215
219
|
return false;
|
|
216
220
|
}
|
|
221
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
222
|
+
// Just use process.env.CI for now.
|
|
217
223
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
218
224
|
}
|
|
219
225
|
|
|
220
226
|
// Store the event in the event store
|
|
221
|
-
const trackFn
|
|
227
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
222
228
|
const event = {
|
|
223
229
|
event: `${moduleName}.${eventName}`,
|
|
224
230
|
time: new Date().toISOString(),
|
|
225
231
|
...(properties && { properties: flattenProperties$1(properties) }),
|
|
226
232
|
};
|
|
227
|
-
addEvent
|
|
233
|
+
addEvent(event);
|
|
228
234
|
};
|
|
229
|
-
const track
|
|
235
|
+
const track = errorBoundary$1(trackFn);
|
|
230
236
|
// Sending events to the server
|
|
231
237
|
const flushFn$1 = async () => {
|
|
232
238
|
// Don't flush if not initialised
|
|
@@ -272,10 +278,6 @@ const setEnvironmentFn = (env) => {
|
|
|
272
278
|
};
|
|
273
279
|
const setEnvironment = errorBoundary$1(setEnvironmentFn);
|
|
274
280
|
|
|
275
|
-
track$1('metrics', 'sdk_version', {
|
|
276
|
-
version: '1.1.0',
|
|
277
|
-
});
|
|
278
|
-
|
|
279
281
|
var Environment$1;
|
|
280
282
|
(function (Environment) {
|
|
281
283
|
Environment["PRODUCTION"] = "production";
|
|
@@ -289,7 +291,7 @@ class ImmutableConfiguration {
|
|
|
289
291
|
constructor(options) {
|
|
290
292
|
this.environment = options.environment;
|
|
291
293
|
setEnvironment(options.environment);
|
|
292
|
-
track
|
|
294
|
+
track('config', 'created_imtbl_config');
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
297
|
|
|
@@ -15965,7 +15967,8 @@ const CHILD_ERC20_BRIDGE = [
|
|
|
15965
15967
|
const doesChainSupportEIP1559$1 = (feeData) => !!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
|
|
15966
15968
|
const getGasPriceInWei$1 = (feeData) => {
|
|
15967
15969
|
if (doesChainSupportEIP1559$1(feeData)) {
|
|
15968
|
-
|
|
15970
|
+
// EIP1559 we need to add a tip for the miner to the base fee
|
|
15971
|
+
return BigNumber.from(feeData.lastBaseFeePerGas).add(BigNumber.from(feeData.maxPriorityFeePerGas));
|
|
15969
15972
|
}
|
|
15970
15973
|
if (feeData.gasPrice)
|
|
15971
15974
|
return BigNumber.from(feeData.gasPrice);
|
|
@@ -16006,9 +16009,9 @@ var BridgeFeeActions;
|
|
|
16006
16009
|
*/
|
|
16007
16010
|
var BridgeMethodsGasLimit;
|
|
16008
16011
|
(function (BridgeMethodsGasLimit) {
|
|
16009
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] =
|
|
16012
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 150000] = "DEPOSIT_SOURCE";
|
|
16010
16013
|
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 200000] = "DEPOSIT_DESTINATION";
|
|
16011
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] =
|
|
16014
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 150000] = "WITHDRAW_SOURCE";
|
|
16012
16015
|
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 250000] = "WITHDRAW_DESTINATION";
|
|
16013
16016
|
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 200000] = "MAP_TOKEN_SOURCE";
|
|
16014
16017
|
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 200000] = "MAP_TOKEN_DESTINATION";
|
|
@@ -16973,6 +16976,7 @@ var Detail;
|
|
|
16973
16976
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
16974
16977
|
Detail["IDENTITY"] = "uid";
|
|
16975
16978
|
Detail["DOMAIN"] = "domain";
|
|
16979
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
16976
16980
|
})(Detail || (Detail = {}));
|
|
16977
16981
|
var Store;
|
|
16978
16982
|
(function (Store) {
|
|
@@ -17066,10 +17070,6 @@ const getDetail = (key) => {
|
|
|
17066
17070
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
17067
17071
|
// Events
|
|
17068
17072
|
const getEvents = () => EVENT_STORE;
|
|
17069
|
-
const addEvent = (event) => {
|
|
17070
|
-
EVENT_STORE.push(event);
|
|
17071
|
-
setItem(Store.EVENTS, EVENT_STORE);
|
|
17072
|
-
};
|
|
17073
17073
|
const removeSentEvents = (numberOfEvents) => {
|
|
17074
17074
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
17075
17075
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -17087,6 +17087,8 @@ const flattenProperties = (properties) => {
|
|
|
17087
17087
|
return propertyMap;
|
|
17088
17088
|
};
|
|
17089
17089
|
|
|
17090
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
17091
|
+
const SDK_VERSION = '1.1.2';
|
|
17090
17092
|
let initialised = false;
|
|
17091
17093
|
const isInitialised = () => initialised;
|
|
17092
17094
|
const getReferrer = () => {
|
|
@@ -17109,14 +17111,16 @@ const runtimeHost = () => {
|
|
|
17109
17111
|
return new URL(window.location.href).hostname;
|
|
17110
17112
|
};
|
|
17111
17113
|
const getRuntimeDetails = () => {
|
|
17114
|
+
storeDetail(Detail.SDK_VERSION, SDK_VERSION);
|
|
17112
17115
|
if (isNode()) {
|
|
17113
|
-
return { browser: 'nodejs' };
|
|
17116
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION };
|
|
17114
17117
|
}
|
|
17115
17118
|
const domain = runtimeHost();
|
|
17116
17119
|
if (domain) {
|
|
17117
17120
|
storeDetail(Detail.DOMAIN, domain);
|
|
17118
17121
|
}
|
|
17119
17122
|
return {
|
|
17123
|
+
sdkVersion: SDK_VERSION,
|
|
17120
17124
|
browser: window.navigator.userAgent,
|
|
17121
17125
|
domain,
|
|
17122
17126
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -17125,7 +17129,6 @@ const getRuntimeDetails = () => {
|
|
|
17125
17129
|
};
|
|
17126
17130
|
const initialise = async () => {
|
|
17127
17131
|
const runtimeDetails = flattenProperties(getRuntimeDetails());
|
|
17128
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
17129
17132
|
const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
|
|
17130
17133
|
const body = {
|
|
17131
17134
|
version: 1,
|
|
@@ -17165,19 +17168,10 @@ function isTestEnvironment() {
|
|
|
17165
17168
|
if (typeof process === 'undefined') {
|
|
17166
17169
|
return false;
|
|
17167
17170
|
}
|
|
17171
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
17172
|
+
// Just use process.env.CI for now.
|
|
17168
17173
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
17169
17174
|
}
|
|
17170
|
-
|
|
17171
|
-
// Store the event in the event store
|
|
17172
|
-
const trackFn = (moduleName, eventName, properties) => {
|
|
17173
|
-
const event = {
|
|
17174
|
-
event: `${moduleName}.${eventName}`,
|
|
17175
|
-
time: new Date().toISOString(),
|
|
17176
|
-
...(properties && { properties: flattenProperties(properties) }),
|
|
17177
|
-
};
|
|
17178
|
-
addEvent(event);
|
|
17179
|
-
};
|
|
17180
|
-
const track = errorBoundary(trackFn);
|
|
17181
17175
|
// Sending events to the server
|
|
17182
17176
|
const flushFn = async () => {
|
|
17183
17177
|
// Don't flush if not initialised
|
|
@@ -17218,10 +17212,6 @@ if (!isTestEnvironment()) {
|
|
|
17218
17212
|
errorBoundary(flushPoll)();
|
|
17219
17213
|
}
|
|
17220
17214
|
|
|
17221
|
-
track('metrics', 'sdk_version', {
|
|
17222
|
-
version: '1.1.0',
|
|
17223
|
-
});
|
|
17224
|
-
|
|
17225
17215
|
var Environment;
|
|
17226
17216
|
(function (Environment) {
|
|
17227
17217
|
Environment["PRODUCTION"] = "production";
|
|
@@ -26863,7 +26853,7 @@ class APIError extends Error {
|
|
|
26863
26853
|
|
|
26864
26854
|
/* eslint-disable implicit-arrow-linebreak */
|
|
26865
26855
|
const defaultHeaders = {
|
|
26866
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.
|
|
26856
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.2',
|
|
26867
26857
|
};
|
|
26868
26858
|
/**
|
|
26869
26859
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -28225,7 +28215,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
28225
28215
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
28226
28216
|
};
|
|
28227
28217
|
|
|
28228
|
-
const SDK_VERSION_MARKER = '1.1.
|
|
28218
|
+
const SDK_VERSION_MARKER = '1.1.2';
|
|
28229
28219
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
28230
28220
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
28231
28221
|
|
|
@@ -29108,7 +29098,8 @@ async function gasEstimator(params, readOnlyProviders, config) {
|
|
|
29108
29098
|
const doesChainSupportEIP1559 = (feeData) => !!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
|
|
29109
29099
|
const getGasPriceInWei = (feeData) => {
|
|
29110
29100
|
if (doesChainSupportEIP1559(feeData)) {
|
|
29111
|
-
|
|
29101
|
+
// EIP1559 we need to add a tip for the miner to the base fee
|
|
29102
|
+
return BigNumber$1.from(feeData.lastBaseFeePerGas).add(BigNumber$1.from(feeData.maxPriorityFeePerGas));
|
|
29112
29103
|
}
|
|
29113
29104
|
if (feeData.gasPrice)
|
|
29114
29105
|
return BigNumber$1.from(feeData.gasPrice);
|
|
@@ -31911,6 +31902,7 @@ class Checkout {
|
|
|
31911
31902
|
this.readOnlyProviders = new Map();
|
|
31912
31903
|
this.availability = availabilityService(this.config.isDevelopment, this.config.isProduction);
|
|
31913
31904
|
this.passport = config.passport;
|
|
31905
|
+
track('checkout_sdk', 'initialised');
|
|
31914
31906
|
}
|
|
31915
31907
|
/**
|
|
31916
31908
|
* Loads the widgets bundle and initiate the widgets factory.
|
package/dist/config.js
CHANGED
|
@@ -11,6 +11,7 @@ var Detail;
|
|
|
11
11
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
12
12
|
Detail["IDENTITY"] = "uid";
|
|
13
13
|
Detail["DOMAIN"] = "domain";
|
|
14
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
14
15
|
})(Detail || (Detail = {}));
|
|
15
16
|
var Store;
|
|
16
17
|
(function (Store) {
|
|
@@ -125,6 +126,8 @@ const flattenProperties = (properties) => {
|
|
|
125
126
|
return propertyMap;
|
|
126
127
|
};
|
|
127
128
|
|
|
129
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
130
|
+
const SDK_VERSION = '1.1.2';
|
|
128
131
|
let initialised = false;
|
|
129
132
|
const isInitialised = () => initialised;
|
|
130
133
|
const getReferrer = () => {
|
|
@@ -147,14 +150,16 @@ const runtimeHost = () => {
|
|
|
147
150
|
return new URL(window.location.href).hostname;
|
|
148
151
|
};
|
|
149
152
|
const getRuntimeDetails = () => {
|
|
153
|
+
storeDetail(Detail.SDK_VERSION, SDK_VERSION);
|
|
150
154
|
if (isNode()) {
|
|
151
|
-
return { browser: 'nodejs' };
|
|
155
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION };
|
|
152
156
|
}
|
|
153
157
|
const domain = runtimeHost();
|
|
154
158
|
if (domain) {
|
|
155
159
|
storeDetail(Detail.DOMAIN, domain);
|
|
156
160
|
}
|
|
157
161
|
return {
|
|
162
|
+
sdkVersion: SDK_VERSION,
|
|
158
163
|
browser: window.navigator.userAgent,
|
|
159
164
|
domain,
|
|
160
165
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -163,7 +168,6 @@ const getRuntimeDetails = () => {
|
|
|
163
168
|
};
|
|
164
169
|
const initialise = async () => {
|
|
165
170
|
const runtimeDetails = flattenProperties(getRuntimeDetails());
|
|
166
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
167
171
|
const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
|
|
168
172
|
const body = {
|
|
169
173
|
version: 1,
|
|
@@ -203,6 +207,8 @@ function isTestEnvironment() {
|
|
|
203
207
|
if (typeof process === 'undefined') {
|
|
204
208
|
return false;
|
|
205
209
|
}
|
|
210
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
211
|
+
// Just use process.env.CI for now.
|
|
206
212
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
207
213
|
}
|
|
208
214
|
|
|
@@ -265,10 +271,6 @@ const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
|
265
271
|
};
|
|
266
272
|
const setPublishableApiKey = errorBoundary(setPublishableApiKeyFn);
|
|
267
273
|
|
|
268
|
-
track('metrics', 'sdk_version', {
|
|
269
|
-
version: '1.1.0',
|
|
270
|
-
});
|
|
271
|
-
|
|
272
274
|
var Environment;
|
|
273
275
|
(function (Environment) {
|
|
274
276
|
Environment["PRODUCTION"] = "production";
|