@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/passport.js
CHANGED
|
@@ -8724,7 +8724,7 @@ class MultiRollupApiClients {
|
|
|
8724
8724
|
}
|
|
8725
8725
|
|
|
8726
8726
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8727
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.1.
|
|
8727
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.1.1-alpha' };
|
|
8728
8728
|
const createConfig = ({ basePath, headers, }) => {
|
|
8729
8729
|
if (!basePath.trim()) {
|
|
8730
8730
|
throw Error('basePath can not be empty');
|
|
@@ -8788,6 +8788,7 @@ var Detail;
|
|
|
8788
8788
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
8789
8789
|
Detail["IDENTITY"] = "uid";
|
|
8790
8790
|
Detail["DOMAIN"] = "domain";
|
|
8791
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
8791
8792
|
})(Detail || (Detail = {}));
|
|
8792
8793
|
var Store;
|
|
8793
8794
|
(function (Store) {
|
|
@@ -8902,6 +8903,8 @@ const flattenProperties = (properties) => {
|
|
|
8902
8903
|
return propertyMap;
|
|
8903
8904
|
};
|
|
8904
8905
|
|
|
8906
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
8907
|
+
const SDK_VERSION = '1.1.1-alpha';
|
|
8905
8908
|
let initialised = false;
|
|
8906
8909
|
const isInitialised = () => initialised;
|
|
8907
8910
|
const getReferrer = () => {
|
|
@@ -8924,14 +8927,16 @@ const runtimeHost = () => {
|
|
|
8924
8927
|
return new URL(window.location.href).hostname;
|
|
8925
8928
|
};
|
|
8926
8929
|
const getRuntimeDetails = () => {
|
|
8930
|
+
storeDetail(Detail.SDK_VERSION, SDK_VERSION);
|
|
8927
8931
|
if (isNode()) {
|
|
8928
|
-
return { browser: 'nodejs' };
|
|
8932
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION };
|
|
8929
8933
|
}
|
|
8930
8934
|
const domain = runtimeHost();
|
|
8931
8935
|
if (domain) {
|
|
8932
8936
|
storeDetail(Detail.DOMAIN, domain);
|
|
8933
8937
|
}
|
|
8934
8938
|
return {
|
|
8939
|
+
sdkVersion: SDK_VERSION,
|
|
8935
8940
|
browser: window.navigator.userAgent,
|
|
8936
8941
|
domain,
|
|
8937
8942
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -8940,7 +8945,6 @@ const getRuntimeDetails = () => {
|
|
|
8940
8945
|
};
|
|
8941
8946
|
const initialise = async () => {
|
|
8942
8947
|
const runtimeDetails = flattenProperties(getRuntimeDetails());
|
|
8943
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
8944
8948
|
const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
|
|
8945
8949
|
const body = {
|
|
8946
8950
|
version: 1,
|
|
@@ -8980,6 +8984,8 @@ function isTestEnvironment() {
|
|
|
8980
8984
|
if (typeof process === 'undefined') {
|
|
8981
8985
|
return false;
|
|
8982
8986
|
}
|
|
8987
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
8988
|
+
// Just use process.env.CI for now.
|
|
8983
8989
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
8984
8990
|
}
|
|
8985
8991
|
|
|
@@ -9058,10 +9064,6 @@ const setPassportClientIdFn = (passportClientId) => {
|
|
|
9058
9064
|
};
|
|
9059
9065
|
const setPassportClientId = errorBoundary(setPassportClientIdFn);
|
|
9060
9066
|
|
|
9061
|
-
track('metrics', 'sdk_version', {
|
|
9062
|
-
version: '1.1.0',
|
|
9063
|
-
});
|
|
9064
|
-
|
|
9065
9067
|
var Environment;
|
|
9066
9068
|
(function (Environment) {
|
|
9067
9069
|
Environment["PRODUCTION"] = "production";
|
|
@@ -9077,7 +9079,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
9077
9079
|
chainID,
|
|
9078
9080
|
coreContractAddress,
|
|
9079
9081
|
registrationContractAddress,
|
|
9080
|
-
sdkVersion: 'ts-immutable-sdk-1.1.
|
|
9082
|
+
sdkVersion: 'ts-immutable-sdk-1.1.1-alpha',
|
|
9081
9083
|
});
|
|
9082
9084
|
/**
|
|
9083
9085
|
* Sets `sdkVersion` at the time of build
|
|
@@ -15330,29 +15332,6 @@ class RelayerClient {
|
|
|
15330
15332
|
}
|
|
15331
15333
|
}
|
|
15332
15334
|
|
|
15333
|
-
const CHAIN_NAME_MAP = new Map([
|
|
15334
|
-
[
|
|
15335
|
-
ChainId.ETHEREUM,
|
|
15336
|
-
ChainName.ETHEREUM,
|
|
15337
|
-
],
|
|
15338
|
-
[
|
|
15339
|
-
ChainId.SEPOLIA,
|
|
15340
|
-
ChainName.SEPOLIA,
|
|
15341
|
-
],
|
|
15342
|
-
[
|
|
15343
|
-
ChainId.IMTBL_ZKEVM_MAINNET,
|
|
15344
|
-
ChainName.IMTBL_ZKEVM_MAINNET,
|
|
15345
|
-
],
|
|
15346
|
-
[
|
|
15347
|
-
ChainId.IMTBL_ZKEVM_TESTNET,
|
|
15348
|
-
ChainName.IMTBL_ZKEVM_TESTNET,
|
|
15349
|
-
],
|
|
15350
|
-
[
|
|
15351
|
-
ChainId.IMTBL_ZKEVM_DEVNET,
|
|
15352
|
-
ChainName.IMTBL_ZKEVM_DEVNET,
|
|
15353
|
-
],
|
|
15354
|
-
]);
|
|
15355
|
-
|
|
15356
15335
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
15357
15336
|
async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
|
|
15358
15337
|
const web3Provider = new Web3Provider(magicProvider);
|
|
@@ -15361,8 +15340,10 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
|
|
|
15361
15340
|
const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
|
|
15362
15341
|
const headers = { Authorization: `Bearer ${accessToken}` };
|
|
15363
15342
|
const { chainId } = await jsonRpcProvider.ready;
|
|
15343
|
+
const eipChainId = getEip155ChainId(chainId);
|
|
15364
15344
|
try {
|
|
15365
|
-
const
|
|
15345
|
+
const chainList = (await multiRollupApiClients.chainsApi.listChains()).data.result;
|
|
15346
|
+
const chainName = chainList.find((chain) => chain.id === eipChainId)?.name;
|
|
15366
15347
|
if (!chainName) {
|
|
15367
15348
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
|
|
15368
15349
|
}
|
package/dist/x.js
CHANGED
|
@@ -19,6 +19,7 @@ var Detail;
|
|
|
19
19
|
Detail["PUBLISHABLE_API_KEY"] = "pak";
|
|
20
20
|
Detail["IDENTITY"] = "uid";
|
|
21
21
|
Detail["DOMAIN"] = "domain";
|
|
22
|
+
Detail["SDK_VERSION"] = "sdkVersion";
|
|
22
23
|
})(Detail || (Detail = {}));
|
|
23
24
|
var Store;
|
|
24
25
|
(function (Store) {
|
|
@@ -112,10 +113,6 @@ const getDetail = (key) => {
|
|
|
112
113
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
113
114
|
// Events
|
|
114
115
|
const getEvents = () => EVENT_STORE;
|
|
115
|
-
const addEvent = (event) => {
|
|
116
|
-
EVENT_STORE.push(event);
|
|
117
|
-
setItem(Store.EVENTS, EVENT_STORE);
|
|
118
|
-
};
|
|
119
116
|
const removeSentEvents = (numberOfEvents) => {
|
|
120
117
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
121
118
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -133,6 +130,8 @@ const flattenProperties = (properties) => {
|
|
|
133
130
|
return propertyMap;
|
|
134
131
|
};
|
|
135
132
|
|
|
133
|
+
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
134
|
+
const SDK_VERSION = '1.1.1-alpha';
|
|
136
135
|
let initialised = false;
|
|
137
136
|
const isInitialised = () => initialised;
|
|
138
137
|
const getReferrer = () => {
|
|
@@ -155,14 +154,16 @@ const runtimeHost = () => {
|
|
|
155
154
|
return new URL(window.location.href).hostname;
|
|
156
155
|
};
|
|
157
156
|
const getRuntimeDetails = () => {
|
|
157
|
+
storeDetail(Detail.SDK_VERSION, SDK_VERSION);
|
|
158
158
|
if (isNode()) {
|
|
159
|
-
return { browser: 'nodejs' };
|
|
159
|
+
return { browser: 'nodejs', sdkVersion: SDK_VERSION };
|
|
160
160
|
}
|
|
161
161
|
const domain = runtimeHost();
|
|
162
162
|
if (domain) {
|
|
163
163
|
storeDetail(Detail.DOMAIN, domain);
|
|
164
164
|
}
|
|
165
165
|
return {
|
|
166
|
+
sdkVersion: SDK_VERSION,
|
|
166
167
|
browser: window.navigator.userAgent,
|
|
167
168
|
domain,
|
|
168
169
|
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
@@ -171,7 +172,6 @@ const getRuntimeDetails = () => {
|
|
|
171
172
|
};
|
|
172
173
|
const initialise = async () => {
|
|
173
174
|
const runtimeDetails = flattenProperties(getRuntimeDetails());
|
|
174
|
-
// Get any existing runtimeId and send it along with the initialise
|
|
175
175
|
const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
|
|
176
176
|
const body = {
|
|
177
177
|
version: 1,
|
|
@@ -211,19 +211,10 @@ function isTestEnvironment() {
|
|
|
211
211
|
if (typeof process === 'undefined') {
|
|
212
212
|
return false;
|
|
213
213
|
}
|
|
214
|
+
// Consider using `ci-info` package for better results, though might fail as not browser safe.
|
|
215
|
+
// Just use process.env.CI for now.
|
|
214
216
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
215
217
|
}
|
|
216
|
-
|
|
217
|
-
// Store the event in the event store
|
|
218
|
-
const trackFn = (moduleName, eventName, properties) => {
|
|
219
|
-
const event = {
|
|
220
|
-
event: `${moduleName}.${eventName}`,
|
|
221
|
-
time: new Date().toISOString(),
|
|
222
|
-
...(properties && { properties: flattenProperties(properties) }),
|
|
223
|
-
};
|
|
224
|
-
addEvent(event);
|
|
225
|
-
};
|
|
226
|
-
const track = errorBoundary(trackFn);
|
|
227
218
|
// Sending events to the server
|
|
228
219
|
const flushFn = async () => {
|
|
229
220
|
// Don't flush if not initialised
|
|
@@ -264,10 +255,6 @@ if (!isTestEnvironment()) {
|
|
|
264
255
|
errorBoundary(flushPoll)();
|
|
265
256
|
}
|
|
266
257
|
|
|
267
|
-
track('metrics', 'sdk_version', {
|
|
268
|
-
version: '1.1.0',
|
|
269
|
-
});
|
|
270
|
-
|
|
271
258
|
var Environment;
|
|
272
259
|
(function (Environment) {
|
|
273
260
|
Environment["PRODUCTION"] = "production";
|
|
@@ -283,7 +270,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
283
270
|
chainID,
|
|
284
271
|
coreContractAddress,
|
|
285
272
|
registrationContractAddress,
|
|
286
|
-
sdkVersion: 'ts-immutable-sdk-1.1.
|
|
273
|
+
sdkVersion: 'ts-immutable-sdk-1.1.1-alpha',
|
|
287
274
|
});
|
|
288
275
|
/**
|
|
289
276
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED