@imtbl/sdk 1.1.0 → 1.1.1-alpha
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 +24 -34
- 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 +31 -62
- package/dist/index.js +31 -62
- 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/index.cjs
CHANGED
|
@@ -57,6 +57,7 @@ var Detail$1;
|
|
|
57
57
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
58
58
|
Detail["IDENTITY"] = "uid";
|
|
59
59
|
Detail["DOMAIN"] = "domain";
|
|
60
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
60
61
|
})(Detail$1 || (Detail$1 = {}));
|
|
61
62
|
var Store$1;
|
|
62
63
|
(function (Store) {
|
|
@@ -150,7 +151,7 @@ const getDetail$1 = (key) => {
|
|
|
150
151
|
const getAllDetails$1 = () => RUNTIME_DETAILS$1;
|
|
151
152
|
// Events
|
|
152
153
|
const getEvents$1 = () => EVENT_STORE$1;
|
|
153
|
-
const addEvent
|
|
154
|
+
const addEvent = (event) => {
|
|
154
155
|
EVENT_STORE$1.push(event);
|
|
155
156
|
setItem$1(Store$1.EVENTS, EVENT_STORE$1);
|
|
156
157
|
};
|
|
@@ -171,6 +172,8 @@ const flattenProperties$1 = (properties) => {
|
|
|
171
172
|
return propertyMap;
|
|
172
173
|
};
|
|
173
174
|
|
|
175
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
176
|
+
const SDK_VERSION$1 = '1.1.1-alpha';
|
|
174
177
|
let initialised$1 = false;
|
|
175
178
|
const isInitialised$1 = () => initialised$1;
|
|
176
179
|
const getReferrer$1 = () => {
|
|
@@ -193,14 +196,16 @@ const runtimeHost$1 = () => {
|
|
|
193
196
|
return new URL(window.location.href).hostname;
|
|
194
197
|
};
|
|
195
198
|
const getRuntimeDetails$1 = () => {
|
|
199
|
+
storeDetail$1(Detail$1.SDK_VERSION, SDK_VERSION$1);
|
|
196
200
|
if (isNode$1()) {
|
|
197
|
-
return { browser: 'nodejs' };
|
|
201
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION$1 };
|
|
198
202
|
}
|
|
199
203
|
const domain = runtimeHost$1();
|
|
200
204
|
if (domain) {
|
|
201
205
|
storeDetail$1(Detail$1.DOMAIN, domain);
|
|
202
206
|
}
|
|
203
207
|
return {
|
|
208
|
+
sdkVersion: SDK_VERSION$1,
|
|
204
209
|
browser: window.navigator.userAgent,
|
|
205
210
|
domain,
|
|
206
211
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -209,7 +214,6 @@ const getRuntimeDetails$1 = () => {
|
|
|
209
214
|
};
|
|
210
215
|
const initialise$2 = async () => {
|
|
211
216
|
const runtimeDetails = flattenProperties$1(getRuntimeDetails$1());
|
|
212
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
213
217
|
const existingRuntimeId = getDetail$1(Detail$1.RUNTIME_ID);
|
|
214
218
|
const body = {
|
|
215
219
|
version: 1,
|
|
@@ -249,19 +253,21 @@ function isTestEnvironment$1() {
|
|
|
249
253
|
if (typeof process === 'undefined') {
|
|
250
254
|
return false;
|
|
251
255
|
}
|
|
256
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
257
|
+
// Just use process.env.CI for now.
|
|
252
258
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
253
259
|
}
|
|
254
260
|
|
|
255
261
|
// Store the event in the event store
|
|
256
|
-
const trackFn
|
|
262
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
257
263
|
const event = {
|
|
258
264
|
event: `${moduleName}.${eventName}`,
|
|
259
265
|
time: new Date().toISOString(),
|
|
260
266
|
...(properties && { properties: flattenProperties$1(properties) }),
|
|
261
267
|
};
|
|
262
|
-
addEvent
|
|
268
|
+
addEvent(event);
|
|
263
269
|
};
|
|
264
|
-
const track
|
|
270
|
+
const track = errorBoundary$1(trackFn);
|
|
265
271
|
// Sending events to the server
|
|
266
272
|
const flushFn$1 = async () => {
|
|
267
273
|
// Don't flush if not initialised
|
|
@@ -319,7 +325,7 @@ const identifyFn = (params) => {
|
|
|
319
325
|
return;
|
|
320
326
|
}
|
|
321
327
|
storeDetail$1(Detail$1.IDENTITY, identity);
|
|
322
|
-
track
|
|
328
|
+
track('metrics', 'identify', params.traits);
|
|
323
329
|
};
|
|
324
330
|
const identify = errorBoundary$1(identifyFn);
|
|
325
331
|
|
|
@@ -336,10 +342,6 @@ const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
|
336
342
|
};
|
|
337
343
|
const setPublishableApiKey = errorBoundary$1(setPublishableApiKeyFn);
|
|
338
344
|
|
|
339
|
-
track$1('metrics', 'sdk_version', {
|
|
340
|
-
version: '1.1.0',
|
|
341
|
-
});
|
|
342
|
-
|
|
343
345
|
var Environment$1;
|
|
344
346
|
(function (Environment) {
|
|
345
347
|
Environment["PRODUCTION"] = "production";
|
|
@@ -353,7 +355,7 @@ class ImmutableConfiguration {
|
|
|
353
355
|
constructor(options) {
|
|
354
356
|
this.environment = options.environment;
|
|
355
357
|
setEnvironment(options.environment);
|
|
356
|
-
track
|
|
358
|
+
track('config', 'created_imtbl_config');
|
|
357
359
|
}
|
|
358
360
|
}
|
|
359
361
|
const API_KEY_PREFIX = 'sk_imapik-';
|
|
@@ -10938,7 +10940,7 @@ class MultiRollupApiClients {
|
|
|
10938
10940
|
}
|
|
10939
10941
|
|
|
10940
10942
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10941
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.
|
|
10943
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.1-alpha' };
|
|
10942
10944
|
const createConfig = ({ basePath, headers, }) => {
|
|
10943
10945
|
if (!basePath.trim()) {
|
|
10944
10946
|
throw Error('basePath can not be empty');
|
|
@@ -11010,7 +11012,7 @@ class APIError extends Error {
|
|
|
11010
11012
|
|
|
11011
11013
|
/* eslint-disable implicit-arrow-linebreak */
|
|
11012
11014
|
const defaultHeaders = {
|
|
11013
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.
|
|
11015
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.1-alpha',
|
|
11014
11016
|
};
|
|
11015
11017
|
/**
|
|
11016
11018
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -11449,7 +11451,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
11449
11451
|
chainID,
|
|
11450
11452
|
coreContractAddress,
|
|
11451
11453
|
registrationContractAddress,
|
|
11452
|
-
sdkVersion: 'ts-immutable-sdk-1.1.
|
|
11454
|
+
sdkVersion: 'ts-immutable-sdk-1.1.1-alpha',
|
|
11453
11455
|
});
|
|
11454
11456
|
/**
|
|
11455
11457
|
* Sets `sdkVersion` at the time of build
|
|
@@ -17711,29 +17713,6 @@ class RelayerClient {
|
|
|
17711
17713
|
}
|
|
17712
17714
|
}
|
|
17713
17715
|
|
|
17714
|
-
const CHAIN_NAME_MAP = new Map([
|
|
17715
|
-
[
|
|
17716
|
-
ChainId$1.ETHEREUM,
|
|
17717
|
-
ChainName$1.ETHEREUM,
|
|
17718
|
-
],
|
|
17719
|
-
[
|
|
17720
|
-
ChainId$1.SEPOLIA,
|
|
17721
|
-
ChainName$1.SEPOLIA,
|
|
17722
|
-
],
|
|
17723
|
-
[
|
|
17724
|
-
ChainId$1.IMTBL_ZKEVM_MAINNET,
|
|
17725
|
-
ChainName$1.IMTBL_ZKEVM_MAINNET,
|
|
17726
|
-
],
|
|
17727
|
-
[
|
|
17728
|
-
ChainId$1.IMTBL_ZKEVM_TESTNET,
|
|
17729
|
-
ChainName$1.IMTBL_ZKEVM_TESTNET,
|
|
17730
|
-
],
|
|
17731
|
-
[
|
|
17732
|
-
ChainId$1.IMTBL_ZKEVM_DEVNET,
|
|
17733
|
-
ChainName$1.IMTBL_ZKEVM_DEVNET,
|
|
17734
|
-
],
|
|
17735
|
-
]);
|
|
17736
|
-
|
|
17737
17716
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
17738
17717
|
async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
|
|
17739
17718
|
const web3Provider = new providers.Web3Provider(magicProvider);
|
|
@@ -17742,8 +17721,10 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
|
|
|
17742
17721
|
const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
|
|
17743
17722
|
const headers = { Authorization: `Bearer ${accessToken}` };
|
|
17744
17723
|
const { chainId } = await jsonRpcProvider.ready;
|
|
17724
|
+
const eipChainId = getEip155ChainId(chainId);
|
|
17745
17725
|
try {
|
|
17746
|
-
const
|
|
17726
|
+
const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
|
|
17727
|
+
const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
|
|
17747
17728
|
if (!chainName) {
|
|
17748
17729
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
|
|
17749
17730
|
}
|
|
@@ -18204,7 +18185,7 @@ class Passport {
|
|
|
18204
18185
|
imxApiClients,
|
|
18205
18186
|
});
|
|
18206
18187
|
setPassportClientId(passportModuleConfiguration.clientId);
|
|
18207
|
-
track
|
|
18188
|
+
track('passport', 'initialised');
|
|
18208
18189
|
}
|
|
18209
18190
|
/**
|
|
18210
18191
|
* @deprecated The method `login` with an argument of `{ useCachedSession: true }` should be used in conjunction with
|
|
@@ -36622,6 +36603,7 @@ var Detail;
|
|
|
36622
36603
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
36623
36604
|
Detail["IDENTITY"] = "uid";
|
|
36624
36605
|
Detail["DOMAIN"] = "domain";
|
|
36606
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
36625
36607
|
})(Detail || (Detail = {}));
|
|
36626
36608
|
var Store;
|
|
36627
36609
|
(function (Store) {
|
|
@@ -36715,10 +36697,6 @@ const getDetail = (key) => {
|
|
|
36715
36697
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
36716
36698
|
// Events
|
|
36717
36699
|
const getEvents = () => EVENT_STORE;
|
|
36718
|
-
const addEvent = (event) => {
|
|
36719
|
-
EVENT_STORE.push(event);
|
|
36720
|
-
setItem(Store.EVENTS, EVENT_STORE);
|
|
36721
|
-
};
|
|
36722
36700
|
const removeSentEvents = (numberOfEvents) => {
|
|
36723
36701
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
36724
36702
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -36736,6 +36714,8 @@ const flattenProperties = (properties) => {
|
|
|
36736
36714
|
return propertyMap;
|
|
36737
36715
|
};
|
|
36738
36716
|
|
|
36717
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
36718
|
+
const SDK_VERSION = '1.1.1-alpha';
|
|
36739
36719
|
let initialised = false;
|
|
36740
36720
|
const isInitialised = () => initialised;
|
|
36741
36721
|
const getReferrer = () => {
|
|
@@ -36758,14 +36738,16 @@ const runtimeHost = () => {
|
|
|
36758
36738
|
return new URL(window.location.href).hostname;
|
|
36759
36739
|
};
|
|
36760
36740
|
const getRuntimeDetails = () => {
|
|
36741
|
+
storeDetail(Detail.SDK_VERSION, SDK_VERSION);
|
|
36761
36742
|
if (isNode()) {
|
|
36762
|
-
return { browser: 'nodejs' };
|
|
36743
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION };
|
|
36763
36744
|
}
|
|
36764
36745
|
const domain = runtimeHost();
|
|
36765
36746
|
if (domain) {
|
|
36766
36747
|
storeDetail(Detail.DOMAIN, domain);
|
|
36767
36748
|
}
|
|
36768
36749
|
return {
|
|
36750
|
+
sdkVersion: SDK_VERSION,
|
|
36769
36751
|
browser: window.navigator.userAgent,
|
|
36770
36752
|
domain,
|
|
36771
36753
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -36774,7 +36756,6 @@ const getRuntimeDetails = () => {
|
|
|
36774
36756
|
};
|
|
36775
36757
|
const initialise = async () => {
|
|
36776
36758
|
const runtimeDetails = flattenProperties(getRuntimeDetails());
|
|
36777
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
36778
36759
|
const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
|
|
36779
36760
|
const body = {
|
|
36780
36761
|
version: 1,
|
|
@@ -36814,19 +36795,10 @@ function isTestEnvironment() {
|
|
|
36814
36795
|
if (typeof process === 'undefined') {
|
|
36815
36796
|
return false;
|
|
36816
36797
|
}
|
|
36798
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
36799
|
+
// Just use process.env.CI for now.
|
|
36817
36800
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
36818
36801
|
}
|
|
36819
|
-
|
|
36820
|
-
// Store the event in the event store
|
|
36821
|
-
const trackFn = (moduleName, eventName, properties) => {
|
|
36822
|
-
const event = {
|
|
36823
|
-
event: `${moduleName}.${eventName}`,
|
|
36824
|
-
time: new Date().toISOString(),
|
|
36825
|
-
...(properties && { properties: flattenProperties(properties) }),
|
|
36826
|
-
};
|
|
36827
|
-
addEvent(event);
|
|
36828
|
-
};
|
|
36829
|
-
const track = errorBoundary(trackFn);
|
|
36830
36802
|
// Sending events to the server
|
|
36831
36803
|
const flushFn = async () => {
|
|
36832
36804
|
// Don't flush if not initialised
|
|
@@ -36867,10 +36839,6 @@ if (!isTestEnvironment()) {
|
|
|
36867
36839
|
errorBoundary(flushPoll)();
|
|
36868
36840
|
}
|
|
36869
36841
|
|
|
36870
|
-
track('metrics', 'sdk_version', {
|
|
36871
|
-
version: '1.1.0',
|
|
36872
|
-
});
|
|
36873
|
-
|
|
36874
36842
|
var Environment;
|
|
36875
36843
|
(function (Environment) {
|
|
36876
36844
|
Environment["PRODUCTION"] = "production";
|
|
@@ -41850,7 +41818,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
41850
41818
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
41851
41819
|
};
|
|
41852
41820
|
|
|
41853
|
-
const SDK_VERSION_MARKER = '1.1.
|
|
41821
|
+
const SDK_VERSION_MARKER = '1.1.1-alpha';
|
|
41854
41822
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
41855
41823
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
41856
41824
|
|
|
@@ -45536,6 +45504,7 @@ class Checkout {
|
|
|
45536
45504
|
this.readOnlyProviders = new Map();
|
|
45537
45505
|
this.availability = availabilityService(this.config.isDevelopment, this.config.isProduction);
|
|
45538
45506
|
this.passport = config.passport;
|
|
45507
|
+
track('checkout_sdk', 'initialised');
|
|
45539
45508
|
}
|
|
45540
45509
|
/**
|
|
45541
45510
|
* Loads the widgets bundle and initiate the widgets factory.
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var Detail$1;
|
|
|
35
35
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
36
36
|
Detail["IDENTITY"] = "uid";
|
|
37
37
|
Detail["DOMAIN"] = "domain";
|
|
38
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
38
39
|
})(Detail$1 || (Detail$1 = {}));
|
|
39
40
|
var Store$1;
|
|
40
41
|
(function (Store) {
|
|
@@ -128,7 +129,7 @@ const getDetail$1 = (key) => {
|
|
|
128
129
|
const getAllDetails$1 = () => RUNTIME_DETAILS$1;
|
|
129
130
|
// Events
|
|
130
131
|
const getEvents$1 = () => EVENT_STORE$1;
|
|
131
|
-
const addEvent
|
|
132
|
+
const addEvent = (event) => {
|
|
132
133
|
EVENT_STORE$1.push(event);
|
|
133
134
|
setItem$1(Store$1.EVENTS, EVENT_STORE$1);
|
|
134
135
|
};
|
|
@@ -149,6 +150,8 @@ const flattenProperties$1 = (properties) => {
|
|
|
149
150
|
return propertyMap;
|
|
150
151
|
};
|
|
151
152
|
|
|
153
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
154
|
+
const SDK_VERSION$1 = '1.1.1-alpha';
|
|
152
155
|
let initialised$1 = false;
|
|
153
156
|
const isInitialised$1 = () => initialised$1;
|
|
154
157
|
const getReferrer$1 = () => {
|
|
@@ -171,14 +174,16 @@ const runtimeHost$1 = () => {
|
|
|
171
174
|
return new URL(window.location.href).hostname;
|
|
172
175
|
};
|
|
173
176
|
const getRuntimeDetails$1 = () => {
|
|
177
|
+
storeDetail$1(Detail$1.SDK_VERSION, SDK_VERSION$1);
|
|
174
178
|
if (isNode$1()) {
|
|
175
|
-
return { browser: 'nodejs' };
|
|
179
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION$1 };
|
|
176
180
|
}
|
|
177
181
|
const domain = runtimeHost$1();
|
|
178
182
|
if (domain) {
|
|
179
183
|
storeDetail$1(Detail$1.DOMAIN, domain);
|
|
180
184
|
}
|
|
181
185
|
return {
|
|
186
|
+
sdkVersion: SDK_VERSION$1,
|
|
182
187
|
browser: window.navigator.userAgent,
|
|
183
188
|
domain,
|
|
184
189
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -187,7 +192,6 @@ const getRuntimeDetails$1 = () => {
|
|
|
187
192
|
};
|
|
188
193
|
const initialise$2 = async () => {
|
|
189
194
|
const runtimeDetails = flattenProperties$1(getRuntimeDetails$1());
|
|
190
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
191
195
|
const existingRuntimeId = getDetail$1(Detail$1.RUNTIME_ID);
|
|
192
196
|
const body = {
|
|
193
197
|
version: 1,
|
|
@@ -227,19 +231,21 @@ function isTestEnvironment$1() {
|
|
|
227
231
|
if (typeof process === 'undefined') {
|
|
228
232
|
return false;
|
|
229
233
|
}
|
|
234
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
235
|
+
// Just use process.env.CI for now.
|
|
230
236
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
231
237
|
}
|
|
232
238
|
|
|
233
239
|
// Store the event in the event store
|
|
234
|
-
const trackFn
|
|
240
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
235
241
|
const event = {
|
|
236
242
|
event: `${moduleName}.${eventName}`,
|
|
237
243
|
time: new Date().toISOString(),
|
|
238
244
|
...(properties && { properties: flattenProperties$1(properties) }),
|
|
239
245
|
};
|
|
240
|
-
addEvent
|
|
246
|
+
addEvent(event);
|
|
241
247
|
};
|
|
242
|
-
const track
|
|
248
|
+
const track = errorBoundary$1(trackFn);
|
|
243
249
|
// Sending events to the server
|
|
244
250
|
const flushFn$1 = async () => {
|
|
245
251
|
// Don't flush if not initialised
|
|
@@ -297,7 +303,7 @@ const identifyFn = (params) => {
|
|
|
297
303
|
return;
|
|
298
304
|
}
|
|
299
305
|
storeDetail$1(Detail$1.IDENTITY, identity);
|
|
300
|
-
track
|
|
306
|
+
track('metrics', 'identify', params.traits);
|
|
301
307
|
};
|
|
302
308
|
const identify = errorBoundary$1(identifyFn);
|
|
303
309
|
|
|
@@ -314,10 +320,6 @@ const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
|
314
320
|
};
|
|
315
321
|
const setPublishableApiKey = errorBoundary$1(setPublishableApiKeyFn);
|
|
316
322
|
|
|
317
|
-
track$1('metrics', 'sdk_version', {
|
|
318
|
-
version: '1.1.0',
|
|
319
|
-
});
|
|
320
|
-
|
|
321
323
|
var Environment$1;
|
|
322
324
|
(function (Environment) {
|
|
323
325
|
Environment["PRODUCTION"] = "production";
|
|
@@ -331,7 +333,7 @@ class ImmutableConfiguration {
|
|
|
331
333
|
constructor(options) {
|
|
332
334
|
this.environment = options.environment;
|
|
333
335
|
setEnvironment(options.environment);
|
|
334
|
-
track
|
|
336
|
+
track('config', 'created_imtbl_config');
|
|
335
337
|
}
|
|
336
338
|
}
|
|
337
339
|
const API_KEY_PREFIX = 'sk_imapik-';
|
|
@@ -10916,7 +10918,7 @@ class MultiRollupApiClients {
|
|
|
10916
10918
|
}
|
|
10917
10919
|
|
|
10918
10920
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10919
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.
|
|
10921
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.1.1-alpha' };
|
|
10920
10922
|
const createConfig = ({ basePath, headers, }) => {
|
|
10921
10923
|
if (!basePath.trim()) {
|
|
10922
10924
|
throw Error('basePath can not be empty');
|
|
@@ -10988,7 +10990,7 @@ class APIError extends Error {
|
|
|
10988
10990
|
|
|
10989
10991
|
/* eslint-disable implicit-arrow-linebreak */
|
|
10990
10992
|
const defaultHeaders = {
|
|
10991
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.
|
|
10993
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.1-alpha',
|
|
10992
10994
|
};
|
|
10993
10995
|
/**
|
|
10994
10996
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -11427,7 +11429,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
11427
11429
|
chainID,
|
|
11428
11430
|
coreContractAddress,
|
|
11429
11431
|
registrationContractAddress,
|
|
11430
|
-
sdkVersion: 'ts-immutable-sdk-1.1.
|
|
11432
|
+
sdkVersion: 'ts-immutable-sdk-1.1.1-alpha',
|
|
11431
11433
|
});
|
|
11432
11434
|
/**
|
|
11433
11435
|
* Sets `sdkVersion` at the time of build
|
|
@@ -17689,29 +17691,6 @@ class RelayerClient {
|
|
|
17689
17691
|
}
|
|
17690
17692
|
}
|
|
17691
17693
|
|
|
17692
|
-
const CHAIN_NAME_MAP = new Map([
|
|
17693
|
-
[
|
|
17694
|
-
ChainId$1.ETHEREUM,
|
|
17695
|
-
ChainName$1.ETHEREUM,
|
|
17696
|
-
],
|
|
17697
|
-
[
|
|
17698
|
-
ChainId$1.SEPOLIA,
|
|
17699
|
-
ChainName$1.SEPOLIA,
|
|
17700
|
-
],
|
|
17701
|
-
[
|
|
17702
|
-
ChainId$1.IMTBL_ZKEVM_MAINNET,
|
|
17703
|
-
ChainName$1.IMTBL_ZKEVM_MAINNET,
|
|
17704
|
-
],
|
|
17705
|
-
[
|
|
17706
|
-
ChainId$1.IMTBL_ZKEVM_TESTNET,
|
|
17707
|
-
ChainName$1.IMTBL_ZKEVM_TESTNET,
|
|
17708
|
-
],
|
|
17709
|
-
[
|
|
17710
|
-
ChainId$1.IMTBL_ZKEVM_DEVNET,
|
|
17711
|
-
ChainName$1.IMTBL_ZKEVM_DEVNET,
|
|
17712
|
-
],
|
|
17713
|
-
]);
|
|
17714
|
-
|
|
17715
17694
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
17716
17695
|
async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
|
|
17717
17696
|
const web3Provider = new Web3Provider(magicProvider);
|
|
@@ -17720,8 +17699,10 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
|
|
|
17720
17699
|
const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
|
|
17721
17700
|
const headers = { Authorization: `Bearer ${accessToken}` };
|
|
17722
17701
|
const { chainId } = await jsonRpcProvider.ready;
|
|
17702
|
+
const eipChainId = getEip155ChainId(chainId);
|
|
17723
17703
|
try {
|
|
17724
|
-
const
|
|
17704
|
+
const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
|
|
17705
|
+
const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
|
|
17725
17706
|
if (!chainName) {
|
|
17726
17707
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
|
|
17727
17708
|
}
|
|
@@ -18182,7 +18163,7 @@ class Passport {
|
|
|
18182
18163
|
imxApiClients,
|
|
18183
18164
|
});
|
|
18184
18165
|
setPassportClientId(passportModuleConfiguration.clientId);
|
|
18185
|
-
track
|
|
18166
|
+
track('passport', 'initialised');
|
|
18186
18167
|
}
|
|
18187
18168
|
/**
|
|
18188
18169
|
* @deprecated The method `login` with an argument of `{ useCachedSession: true }` should be used in conjunction with
|
|
@@ -36600,6 +36581,7 @@ var Detail;
|
|
|
36600
36581
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
36601
36582
|
Detail["IDENTITY"] = "uid";
|
|
36602
36583
|
Detail["DOMAIN"] = "domain";
|
|
36584
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
36603
36585
|
})(Detail || (Detail = {}));
|
|
36604
36586
|
var Store;
|
|
36605
36587
|
(function (Store) {
|
|
@@ -36693,10 +36675,6 @@ const getDetail = (key) => {
|
|
|
36693
36675
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
36694
36676
|
// Events
|
|
36695
36677
|
const getEvents = () => EVENT_STORE;
|
|
36696
|
-
const addEvent = (event) => {
|
|
36697
|
-
EVENT_STORE.push(event);
|
|
36698
|
-
setItem(Store.EVENTS, EVENT_STORE);
|
|
36699
|
-
};
|
|
36700
36678
|
const removeSentEvents = (numberOfEvents) => {
|
|
36701
36679
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
36702
36680
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -36714,6 +36692,8 @@ const flattenProperties = (properties) => {
|
|
|
36714
36692
|
return propertyMap;
|
|
36715
36693
|
};
|
|
36716
36694
|
|
|
36695
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
36696
|
+
const SDK_VERSION = '1.1.1-alpha';
|
|
36717
36697
|
let initialised = false;
|
|
36718
36698
|
const isInitialised = () => initialised;
|
|
36719
36699
|
const getReferrer = () => {
|
|
@@ -36736,14 +36716,16 @@ const runtimeHost = () => {
|
|
|
36736
36716
|
return new URL(window.location.href).hostname;
|
|
36737
36717
|
};
|
|
36738
36718
|
const getRuntimeDetails = () => {
|
|
36719
|
+
storeDetail(Detail.SDK_VERSION, SDK_VERSION);
|
|
36739
36720
|
if (isNode()) {
|
|
36740
|
-
return { browser: 'nodejs' };
|
|
36721
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION };
|
|
36741
36722
|
}
|
|
36742
36723
|
const domain = runtimeHost();
|
|
36743
36724
|
if (domain) {
|
|
36744
36725
|
storeDetail(Detail.DOMAIN, domain);
|
|
36745
36726
|
}
|
|
36746
36727
|
return {
|
|
36728
|
+
sdkVersion: SDK_VERSION,
|
|
36747
36729
|
browser: window.navigator.userAgent,
|
|
36748
36730
|
domain,
|
|
36749
36731
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -36752,7 +36734,6 @@ const getRuntimeDetails = () => {
|
|
|
36752
36734
|
};
|
|
36753
36735
|
const initialise = async () => {
|
|
36754
36736
|
const runtimeDetails = flattenProperties(getRuntimeDetails());
|
|
36755
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
36756
36737
|
const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
|
|
36757
36738
|
const body = {
|
|
36758
36739
|
version: 1,
|
|
@@ -36792,19 +36773,10 @@ function isTestEnvironment() {
|
|
|
36792
36773
|
if (typeof process === 'undefined') {
|
|
36793
36774
|
return false;
|
|
36794
36775
|
}
|
|
36776
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
36777
|
+
// Just use process.env.CI for now.
|
|
36795
36778
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
36796
36779
|
}
|
|
36797
|
-
|
|
36798
|
-
// Store the event in the event store
|
|
36799
|
-
const trackFn = (moduleName, eventName, properties) => {
|
|
36800
|
-
const event = {
|
|
36801
|
-
event: `${moduleName}.${eventName}`,
|
|
36802
|
-
time: new Date().toISOString(),
|
|
36803
|
-
...(properties && { properties: flattenProperties(properties) }),
|
|
36804
|
-
};
|
|
36805
|
-
addEvent(event);
|
|
36806
|
-
};
|
|
36807
|
-
const track = errorBoundary(trackFn);
|
|
36808
36780
|
// Sending events to the server
|
|
36809
36781
|
const flushFn = async () => {
|
|
36810
36782
|
// Don't flush if not initialised
|
|
@@ -36845,10 +36817,6 @@ if (!isTestEnvironment()) {
|
|
|
36845
36817
|
errorBoundary(flushPoll)();
|
|
36846
36818
|
}
|
|
36847
36819
|
|
|
36848
|
-
track('metrics', 'sdk_version', {
|
|
36849
|
-
version: '1.1.0',
|
|
36850
|
-
});
|
|
36851
|
-
|
|
36852
36820
|
var Environment;
|
|
36853
36821
|
(function (Environment) {
|
|
36854
36822
|
Environment["PRODUCTION"] = "production";
|
|
@@ -41828,7 +41796,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
41828
41796
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
41829
41797
|
};
|
|
41830
41798
|
|
|
41831
|
-
const SDK_VERSION_MARKER = '1.1.
|
|
41799
|
+
const SDK_VERSION_MARKER = '1.1.1-alpha';
|
|
41832
41800
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
41833
41801
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
41834
41802
|
|
|
@@ -45514,6 +45482,7 @@ class Checkout {
|
|
|
45514
45482
|
this.readOnlyProviders = new Map();
|
|
45515
45483
|
this.availability = availabilityService(this.config.isDevelopment, this.config.isProduction);
|
|
45516
45484
|
this.passport = config.passport;
|
|
45485
|
+
track('checkout_sdk', 'initialised');
|
|
45517
45486
|
}
|
|
45518
45487
|
/**
|
|
45519
45488
|
* Loads the widgets bundle and initiate the widgets factory.
|
package/dist/orderbook.js
CHANGED
|
@@ -14,6 +14,7 @@ var Detail;
|
|
|
14
14
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
15
15
|
Detail["IDENTITY"] = "uid";
|
|
16
16
|
Detail["DOMAIN"] = "domain";
|
|
17
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
17
18
|
})(Detail || (Detail = {}));
|
|
18
19
|
var Store;
|
|
19
20
|
(function (Store) {
|
|
@@ -107,10 +108,6 @@ const getDetail = (key) => {
|
|
|
107
108
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
108
109
|
// Events
|
|
109
110
|
const getEvents = () => EVENT_STORE;
|
|
110
|
-
const addEvent = (event) => {
|
|
111
|
-
EVENT_STORE.push(event);
|
|
112
|
-
setItem(Store.EVENTS, EVENT_STORE);
|
|
113
|
-
};
|
|
114
111
|
const removeSentEvents = (numberOfEvents) => {
|
|
115
112
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
116
113
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -128,6 +125,8 @@ const flattenProperties = (properties) => {
|
|
|
128
125
|
return propertyMap;
|
|
129
126
|
};
|
|
130
127
|
|
|
128
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
129
|
+
const SDK_VERSION = '1.1.1-alpha';
|
|
131
130
|
let initialised = false;
|
|
132
131
|
const isInitialised = () => initialised;
|
|
133
132
|
const getReferrer = () => {
|
|
@@ -150,14 +149,16 @@ const runtimeHost = () => {
|
|
|
150
149
|
return new URL(window.location.href).hostname;
|
|
151
150
|
};
|
|
152
151
|
const getRuntimeDetails = () => {
|
|
152
|
+
storeDetail(Detail.SDK_VERSION, SDK_VERSION);
|
|
153
153
|
if (isNode()) {
|
|
154
|
-
return { browser: 'nodejs' };
|
|
154
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION };
|
|
155
155
|
}
|
|
156
156
|
const domain = runtimeHost();
|
|
157
157
|
if (domain) {
|
|
158
158
|
storeDetail(Detail.DOMAIN, domain);
|
|
159
159
|
}
|
|
160
160
|
return {
|
|
161
|
+
sdkVersion: SDK_VERSION,
|
|
161
162
|
browser: window.navigator.userAgent,
|
|
162
163
|
domain,
|
|
163
164
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -166,7 +167,6 @@ const getRuntimeDetails = () => {
|
|
|
166
167
|
};
|
|
167
168
|
const initialise = async () => {
|
|
168
169
|
const runtimeDetails = flattenProperties(getRuntimeDetails());
|
|
169
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
170
170
|
const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
|
|
171
171
|
const body = {
|
|
172
172
|
version: 1,
|
|
@@ -206,19 +206,10 @@ function isTestEnvironment() {
|
|
|
206
206
|
if (typeof process === 'undefined') {
|
|
207
207
|
return false;
|
|
208
208
|
}
|
|
209
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
210
|
+
// Just use process.env.CI for now.
|
|
209
211
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
210
212
|
}
|
|
211
|
-
|
|
212
|
-
// Store the event in the event store
|
|
213
|
-
const trackFn = (moduleName, eventName, properties) => {
|
|
214
|
-
const event = {
|
|
215
|
-
event: `${moduleName}.${eventName}`,
|
|
216
|
-
time: new Date().toISOString(),
|
|
217
|
-
...(properties && { properties: flattenProperties(properties) }),
|
|
218
|
-
};
|
|
219
|
-
addEvent(event);
|
|
220
|
-
};
|
|
221
|
-
const track = errorBoundary(trackFn);
|
|
222
213
|
// Sending events to the server
|
|
223
214
|
const flushFn = async () => {
|
|
224
215
|
// Don't flush if not initialised
|
|
@@ -259,10 +250,6 @@ if (!isTestEnvironment()) {
|
|
|
259
250
|
errorBoundary(flushPoll)();
|
|
260
251
|
}
|
|
261
252
|
|
|
262
|
-
track('metrics', 'sdk_version', {
|
|
263
|
-
version: '1.1.0',
|
|
264
|
-
});
|
|
265
|
-
|
|
266
253
|
var Environment;
|
|
267
254
|
(function (Environment) {
|
|
268
255
|
Environment["PRODUCTION"] = "production";
|