@imtbl/sdk 1.13.0 → 1.13.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.d.ts +1 -13
- package/dist/blockchain_data.js +4 -3
- package/dist/browser/checkout/{BridgeWidget-a0216abf.js → BridgeWidget-fad5e5b4.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-0141412f.js → OnRampWidget-cd752140.js} +1 -1
- package/dist/browser/checkout/{SaleWidget-dfb3ec06.js → SaleWidget-d346df01.js} +1 -1
- package/dist/browser/checkout/{SpendingCapHero-f00c162d.js → SpendingCapHero-8f336477.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-7dd7ae0d.js → SwapWidget-9004a303.js} +1 -1
- package/dist/browser/checkout/{TopUpView-83b01082.js → TopUpView-24b7522e.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-a7294770.js → WalletWidget-d04f02c7.js} +1 -1
- package/dist/browser/checkout/{auto-track-a6ee7728.js → auto-track-a76b6dc5.js} +1 -1
- package/dist/browser/checkout/{balance-cab05497.js → balance-b06cb17f.js} +1 -1
- package/dist/browser/checkout/{index-51cb702e.js → index-10a2ce7f.js} +1 -1
- package/dist/browser/checkout/{index-fb6525df.js → index-1380b155.js} +1 -1
- package/dist/browser/checkout/{index-b10fea31.js → index-33ba2d41.js} +1 -1
- package/dist/browser/checkout/{index-a53ae4b9.js → index-3549d306.js} +1 -1
- package/dist/browser/checkout/index-5202f725.js +1 -0
- package/dist/browser/checkout/{index-e06cc1d2.js → index-52729a66.js} +1 -1
- package/dist/browser/checkout/{index-f13a14b5.js → index-6e473dc6.js} +1 -1
- package/dist/browser/checkout/{index-57f03d43.js → index-a5ec4ed9.js} +2 -2
- package/dist/browser/checkout/{index.umd-ebf23be8.js → index.umd-17c2e990.js} +1 -1
- package/dist/browser/checkout/{retry-242a2c60.js → retry-154c5f2b.js} +1 -1
- package/dist/browser/checkout/sdk.js +7 -7
- package/dist/browser/checkout/{useTransakEvents-4a36b909.js → useTransakEvents-05f3e770.js} +1 -1
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +60 -60
- package/dist/checkout.d.ts +1 -13
- package/dist/checkout.js +6 -5
- package/dist/config.d.ts +2 -17
- package/dist/config.js +3 -21
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +52 -54
- package/dist/index.d.ts +1 -22
- package/dist/index.js +53 -55
- package/dist/orderbook.d.ts +1 -13
- package/dist/orderbook.js +1 -1
- package/dist/passport.d.ts +1 -13
- package/dist/passport.js +48 -29
- package/dist/x.d.ts +1 -13
- package/dist/x.js +2 -2
- package/package.json +1 -1
- package/dist/browser/checkout/index-1c0cb426.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -174,7 +174,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
177
|
-
const SDK_VERSION$1 = '1.13.
|
|
177
|
+
const SDK_VERSION$1 = '1.13.2';
|
|
178
178
|
const getReferrer$1 = () => {
|
|
179
179
|
if (isNode$1()) {
|
|
180
180
|
return '';
|
|
@@ -410,6 +410,7 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
410
410
|
}
|
|
411
411
|
if (baseConfig.publishableKey) {
|
|
412
412
|
newHeaders[KeyHeaders$1.PUBLISHABLE_KEY] = baseConfig.publishableKey;
|
|
413
|
+
setPublishableApiKey(baseConfig.publishableKey);
|
|
413
414
|
}
|
|
414
415
|
if (baseConfig.rateLimitingKey) {
|
|
415
416
|
newHeaders[KeyHeaders$1.RATE_LIMITING_KEY] = baseConfig.rateLimitingKey;
|
|
@@ -429,35 +430,13 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
429
430
|
headers: newHeaders,
|
|
430
431
|
};
|
|
431
432
|
};
|
|
432
|
-
const API_KEY_PREFIX = 'sk_imapik-';
|
|
433
|
-
const PUBLISHABLE_KEY_PREFIX$1 = 'pk_imapik-';
|
|
434
|
-
const addApiKeyToAxiosHeader = (apiKey) => {
|
|
435
|
-
if (!apiKey.startsWith(API_KEY_PREFIX)) {
|
|
436
|
-
throw new Error('Invalid API key. Create your api key in Immutable developer hub. https://hub.immutable.com');
|
|
437
|
-
}
|
|
438
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.API_KEY] = apiKey;
|
|
439
|
-
};
|
|
440
|
-
const addPublishableKeyToAxiosHeader = (publishableKey) => {
|
|
441
|
-
if (!publishableKey.startsWith(PUBLISHABLE_KEY_PREFIX$1)) {
|
|
442
|
-
throw new Error('Invalid Publishable key. Create your Publishable key in Immutable developer hub.'
|
|
443
|
-
+ ' https://hub.immutable.com');
|
|
444
|
-
}
|
|
445
|
-
setPublishableApiKey(publishableKey);
|
|
446
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.PUBLISHABLE_KEY] = publishableKey;
|
|
447
|
-
};
|
|
448
|
-
const addRateLimitingKeyToAxiosHeader = (rateLimitingKey) => {
|
|
449
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.RATE_LIMITING_KEY] = rateLimitingKey;
|
|
450
|
-
};
|
|
451
433
|
|
|
452
434
|
var config = /*#__PURE__*/Object.freeze({
|
|
453
435
|
__proto__: null,
|
|
454
436
|
get Environment () { return Environment$1; },
|
|
455
437
|
ImmutableConfiguration: ImmutableConfiguration,
|
|
456
438
|
get KeyHeaders () { return KeyHeaders$1; },
|
|
457
|
-
|
|
458
|
-
addKeysToHeadersOverride: addKeysToHeadersOverride,
|
|
459
|
-
addPublishableKeyToAxiosHeader: addPublishableKeyToAxiosHeader,
|
|
460
|
-
addRateLimitingKeyToAxiosHeader: addRateLimitingKeyToAxiosHeader
|
|
439
|
+
addKeysToHeadersOverride: addKeysToHeadersOverride
|
|
461
440
|
});
|
|
462
441
|
|
|
463
442
|
/* tslint:disable */
|
|
@@ -11571,7 +11550,7 @@ class MultiRollupApiClients {
|
|
|
11571
11550
|
}
|
|
11572
11551
|
|
|
11573
11552
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11574
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.13.
|
|
11553
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.13.2' };
|
|
11575
11554
|
const createConfig = ({ basePath, headers, }) => {
|
|
11576
11555
|
if (!basePath.trim()) {
|
|
11577
11556
|
throw Error('basePath can not be empty');
|
|
@@ -11643,7 +11622,7 @@ class APIError extends Error {
|
|
|
11643
11622
|
|
|
11644
11623
|
/* eslint-disable implicit-arrow-linebreak */
|
|
11645
11624
|
const defaultHeaders = {
|
|
11646
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.13.
|
|
11625
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.13.2',
|
|
11647
11626
|
};
|
|
11648
11627
|
/**
|
|
11649
11628
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -12126,7 +12105,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
12126
12105
|
chainID,
|
|
12127
12106
|
coreContractAddress,
|
|
12128
12107
|
registrationContractAddress,
|
|
12129
|
-
sdkVersion: 'ts-immutable-sdk-1.13.
|
|
12108
|
+
sdkVersion: 'ts-immutable-sdk-1.13.2',
|
|
12130
12109
|
});
|
|
12131
12110
|
/**
|
|
12132
12111
|
* Sets `sdkVersion` at the time of build
|
|
@@ -16732,6 +16711,17 @@ class DeviceCredentialsManager {
|
|
|
16732
16711
|
}
|
|
16733
16712
|
}
|
|
16734
16713
|
|
|
16714
|
+
const shouldLog = process?.env?.JEST_WORKER_ID === undefined;
|
|
16715
|
+
const warn = (...args) => {
|
|
16716
|
+
if (shouldLog) {
|
|
16717
|
+
// eslint-disable-next-line no-console
|
|
16718
|
+
console.warn(...args);
|
|
16719
|
+
}
|
|
16720
|
+
};
|
|
16721
|
+
var logger$f = {
|
|
16722
|
+
warn,
|
|
16723
|
+
};
|
|
16724
|
+
|
|
16735
16725
|
function isIdTokenExpired(idToken) {
|
|
16736
16726
|
if (!idToken) {
|
|
16737
16727
|
return false;
|
|
@@ -16894,8 +16884,7 @@ class AuthManager {
|
|
|
16894
16884
|
user = await this.getUser();
|
|
16895
16885
|
}
|
|
16896
16886
|
catch (err) {
|
|
16897
|
-
|
|
16898
|
-
console.warn('failed to retrieve a cached user session:', err);
|
|
16887
|
+
logger$f.warn('Failed to retrieve a cached user session', err);
|
|
16899
16888
|
}
|
|
16900
16889
|
return user || this.login();
|
|
16901
16890
|
}
|
|
@@ -17039,8 +17028,7 @@ class AuthManager {
|
|
|
17039
17028
|
}
|
|
17040
17029
|
forceUserRefreshInBackground() {
|
|
17041
17030
|
this.refreshTokenAndUpdatePromise().catch((error) => {
|
|
17042
|
-
|
|
17043
|
-
console.warn('Failed to refresh user token', error);
|
|
17031
|
+
logger$f.warn('Failed to refresh user token', error);
|
|
17044
17032
|
});
|
|
17045
17033
|
}
|
|
17046
17034
|
async forceUserRefresh() {
|
|
@@ -18082,33 +18070,45 @@ function getNormalisedTransactions(txs) {
|
|
|
18082
18070
|
return txs.map((t) => ({
|
|
18083
18071
|
delegateCall: t.delegateCall === true,
|
|
18084
18072
|
revertOnError: t.revertOnError === true,
|
|
18085
|
-
gasLimit: t.gasLimit ?? ethers.
|
|
18086
|
-
target: t.to ?? ethers.
|
|
18087
|
-
value: t.value ?? ethers.
|
|
18073
|
+
gasLimit: t.gasLimit ?? ethers.constants.Zero,
|
|
18074
|
+
target: t.to ?? ethers.constants.AddressZero,
|
|
18075
|
+
value: t.value ?? ethers.constants.Zero,
|
|
18088
18076
|
data: t.data ?? [],
|
|
18089
18077
|
}));
|
|
18090
18078
|
}
|
|
18091
18079
|
function digestOfTransactionsAndNonce(nonce, normalisedTransactions) {
|
|
18092
|
-
const packMetaTransactionsNonceData = ethers.
|
|
18093
|
-
return ethers.
|
|
18080
|
+
const packMetaTransactionsNonceData = ethers.utils.defaultAbiCoder.encode(['uint256', META_TRANSACTIONS_TYPE], [nonce, normalisedTransactions]);
|
|
18081
|
+
return ethers.utils.keccak256(packMetaTransactionsNonceData);
|
|
18094
18082
|
}
|
|
18095
18083
|
const getNonce = async (jsonRpcProvider, smartContractWalletAddress) => {
|
|
18096
|
-
|
|
18097
|
-
|
|
18098
|
-
const
|
|
18099
|
-
|
|
18084
|
+
try {
|
|
18085
|
+
const contract = new ethers.Contract(smartContractWalletAddress, abi.walletContracts.mainModule.abi, jsonRpcProvider);
|
|
18086
|
+
const result = await contract.nonce();
|
|
18087
|
+
if (result instanceof ethers.BigNumber) {
|
|
18088
|
+
return result;
|
|
18089
|
+
}
|
|
18100
18090
|
}
|
|
18101
|
-
|
|
18091
|
+
catch (error) {
|
|
18092
|
+
if (error instanceof Error
|
|
18093
|
+
&& 'code' in error
|
|
18094
|
+
&& error.code === ethers.errors.CALL_EXCEPTION) {
|
|
18095
|
+
// The most likely reason for a CALL_EXCEPTION is that the smart contract wallet
|
|
18096
|
+
// has not been deployed yet, so we should default to a nonce of 0.
|
|
18097
|
+
return ethers.BigNumber.from(0);
|
|
18098
|
+
}
|
|
18099
|
+
throw error;
|
|
18100
|
+
}
|
|
18101
|
+
throw new Error('Unexpected result from contract.nonce() call.');
|
|
18102
18102
|
};
|
|
18103
|
-
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (ethers.
|
|
18103
|
+
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (ethers.utils.solidityPack(['string', 'uint256', 'address', 'bytes32'], [ETH_SIGN_PREFIX, chainId, walletAddress, digest]));
|
|
18104
18104
|
const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walletAddress, signer) => {
|
|
18105
18105
|
const normalisedMetaTransactions = getNormalisedTransactions(metaTransactions);
|
|
18106
18106
|
// Get the hash
|
|
18107
18107
|
const digest = digestOfTransactionsAndNonce(nonce, normalisedMetaTransactions);
|
|
18108
18108
|
const completePayload = encodeMessageSubDigest(chainId, walletAddress, digest);
|
|
18109
|
-
const hash = ethers.
|
|
18109
|
+
const hash = ethers.utils.keccak256(completePayload);
|
|
18110
18110
|
// Sign the digest
|
|
18111
|
-
const hashArray = ethers.
|
|
18111
|
+
const hashArray = ethers.utils.arrayify(hash);
|
|
18112
18112
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
18113
18113
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
18114
18114
|
// Add metadata
|
|
@@ -18125,7 +18125,7 @@ const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walle
|
|
|
18125
18125
|
],
|
|
18126
18126
|
});
|
|
18127
18127
|
// Encode the transaction;
|
|
18128
|
-
const walletInterface = new ethers.
|
|
18128
|
+
const walletInterface = new ethers.utils.Interface(abi.walletContracts.mainModule.abi);
|
|
18129
18129
|
return walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [
|
|
18130
18130
|
normalisedMetaTransactions,
|
|
18131
18131
|
nonce,
|
|
@@ -18142,13 +18142,13 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
|
|
|
18142
18142
|
// @ts-ignore
|
|
18143
18143
|
delete types.EIP712Domain;
|
|
18144
18144
|
// Hash the EIP712 payload and generate the complete payload
|
|
18145
|
-
const { _TypedDataEncoder: typedDataEncoder } = ethers.
|
|
18145
|
+
const { _TypedDataEncoder: typedDataEncoder } = ethers.utils;
|
|
18146
18146
|
const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
|
|
18147
18147
|
const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
|
|
18148
|
-
const hash = ethers.
|
|
18148
|
+
const hash = ethers.utils.keccak256(messageSubDigest);
|
|
18149
18149
|
// Sign the sub digest
|
|
18150
18150
|
// https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
|
|
18151
|
-
const hashArray = ethers.
|
|
18151
|
+
const hashArray = ethers.utils.arrayify(hash);
|
|
18152
18152
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
18153
18153
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
18154
18154
|
// Combine the relayer and user signatures; sort by address to match the imageHash order
|
|
@@ -19012,8 +19012,7 @@ class Passport {
|
|
|
19012
19012
|
if (useCachedSession) {
|
|
19013
19013
|
throw error;
|
|
19014
19014
|
}
|
|
19015
|
-
|
|
19016
|
-
console.warn('login failed to retrieve a cached user session', error);
|
|
19015
|
+
logger$f.warn('Failed to retrieve a cached user session', error);
|
|
19017
19016
|
}
|
|
19018
19017
|
if (!user && !useCachedSession) {
|
|
19019
19018
|
user = await this.authManager.login(options?.anonymousId);
|
|
@@ -19047,8 +19046,7 @@ class Passport {
|
|
|
19047
19046
|
await this.confirmationScreen.logout();
|
|
19048
19047
|
}
|
|
19049
19048
|
catch (err) {
|
|
19050
|
-
|
|
19051
|
-
console.warn('Failed to logout from confirmation screen', err);
|
|
19049
|
+
logger$f.warn('Failed to logout from confirmation screen', err);
|
|
19052
19050
|
}
|
|
19053
19051
|
await Promise.allSettled([
|
|
19054
19052
|
this.authManager.logout(),
|
|
@@ -37857,7 +37855,7 @@ const flattenProperties = (properties) => {
|
|
|
37857
37855
|
};
|
|
37858
37856
|
|
|
37859
37857
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
37860
|
-
const SDK_VERSION = '1.13.
|
|
37858
|
+
const SDK_VERSION = '1.13.2';
|
|
37861
37859
|
const getReferrer = () => {
|
|
37862
37860
|
if (isNode()) {
|
|
37863
37861
|
return '';
|
|
@@ -43033,7 +43031,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
43033
43031
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
43034
43032
|
};
|
|
43035
43033
|
|
|
43036
|
-
const SDK_VERSION_MARKER = '1.13.
|
|
43034
|
+
const SDK_VERSION_MARKER = '1.13.2';
|
|
43037
43035
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
43038
43036
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
43039
43037
|
|
package/dist/index.d.ts
CHANGED
|
@@ -23,23 +23,8 @@ declare class ImmutableConfiguration {
|
|
|
23
23
|
declare const addKeysToHeadersOverride: <T extends {
|
|
24
24
|
headers?: Record<string, string> | undefined;
|
|
25
25
|
}>(baseConfig: ImmutableConfiguration | undefined, overrides: T | undefined) => T | undefined;
|
|
26
|
-
declare const addApiKeyToAxiosHeader: (apiKey: string) => void;
|
|
27
|
-
declare const addPublishableKeyToAxiosHeader: (publishableKey: string) => void;
|
|
28
|
-
declare const addRateLimitingKeyToAxiosHeader: (rateLimitingKey: string) => void;
|
|
29
|
-
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
30
|
-
apiKey: 'required';
|
|
31
|
-
} ? Required<{
|
|
32
|
-
apiKey: string;
|
|
33
|
-
}> : {}) & (T extends {
|
|
34
|
-
publishableKey: 'required';
|
|
35
|
-
} ? Required<{
|
|
36
|
-
publishableKey: string;
|
|
37
|
-
}> : {});
|
|
38
|
-
type ImmutableConfigurationWithOmitableFields<T> = T extends {
|
|
39
|
-
apiKey: 'omit';
|
|
40
|
-
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>;
|
|
41
26
|
interface ModuleConfiguration<T> {
|
|
42
|
-
baseConfig:
|
|
27
|
+
baseConfig: ImmutableConfiguration;
|
|
43
28
|
overrides?: T;
|
|
44
29
|
}
|
|
45
30
|
|
|
@@ -50,20 +35,14 @@ declare const config_d_ImmutableConfiguration: typeof ImmutableConfiguration;
|
|
|
50
35
|
type config_d_KeyHeaders = KeyHeaders;
|
|
51
36
|
declare const config_d_KeyHeaders: typeof KeyHeaders;
|
|
52
37
|
type config_d_ModuleConfiguration<T> = ModuleConfiguration<T>;
|
|
53
|
-
declare const config_d_addApiKeyToAxiosHeader: typeof addApiKeyToAxiosHeader;
|
|
54
38
|
declare const config_d_addKeysToHeadersOverride: typeof addKeysToHeadersOverride;
|
|
55
|
-
declare const config_d_addPublishableKeyToAxiosHeader: typeof addPublishableKeyToAxiosHeader;
|
|
56
|
-
declare const config_d_addRateLimitingKeyToAxiosHeader: typeof addRateLimitingKeyToAxiosHeader;
|
|
57
39
|
declare namespace config_d {
|
|
58
40
|
export {
|
|
59
41
|
config_d_Environment as Environment,
|
|
60
42
|
config_d_ImmutableConfiguration as ImmutableConfiguration,
|
|
61
43
|
config_d_KeyHeaders as KeyHeaders,
|
|
62
44
|
config_d_ModuleConfiguration as ModuleConfiguration,
|
|
63
|
-
config_d_addApiKeyToAxiosHeader as addApiKeyToAxiosHeader,
|
|
64
45
|
config_d_addKeysToHeadersOverride as addKeysToHeadersOverride,
|
|
65
|
-
config_d_addPublishableKeyToAxiosHeader as addPublishableKeyToAxiosHeader,
|
|
66
|
-
config_d_addRateLimitingKeyToAxiosHeader as addRateLimitingKeyToAxiosHeader,
|
|
67
46
|
};
|
|
68
47
|
}
|
|
69
48
|
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers';
|
|
|
11
11
|
import BN$2 from 'bn.js';
|
|
12
12
|
import * as encUtils from 'enc-utils';
|
|
13
13
|
import { EventEmitter } from 'events';
|
|
14
|
-
import { BigNumber as BigNumber$1,
|
|
14
|
+
import { BigNumber as BigNumber$1, Contract as Contract$1, errors, utils as utils$3, ethers, constants as constants$1, providers, ContractFactory } from 'ethers';
|
|
15
15
|
import { walletContracts } from '@0xsequence/abi';
|
|
16
16
|
import { v1 } from '@0xsequence/core';
|
|
17
17
|
import FormData$2 from 'form-data';
|
|
@@ -152,7 +152,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
155
|
-
const SDK_VERSION$1 = '1.13.
|
|
155
|
+
const SDK_VERSION$1 = '1.13.2';
|
|
156
156
|
const getReferrer$1 = () => {
|
|
157
157
|
if (isNode$1()) {
|
|
158
158
|
return '';
|
|
@@ -388,6 +388,7 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
388
388
|
}
|
|
389
389
|
if (baseConfig.publishableKey) {
|
|
390
390
|
newHeaders[KeyHeaders$1.PUBLISHABLE_KEY] = baseConfig.publishableKey;
|
|
391
|
+
setPublishableApiKey(baseConfig.publishableKey);
|
|
391
392
|
}
|
|
392
393
|
if (baseConfig.rateLimitingKey) {
|
|
393
394
|
newHeaders[KeyHeaders$1.RATE_LIMITING_KEY] = baseConfig.rateLimitingKey;
|
|
@@ -407,35 +408,13 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
407
408
|
headers: newHeaders,
|
|
408
409
|
};
|
|
409
410
|
};
|
|
410
|
-
const API_KEY_PREFIX = 'sk_imapik-';
|
|
411
|
-
const PUBLISHABLE_KEY_PREFIX$1 = 'pk_imapik-';
|
|
412
|
-
const addApiKeyToAxiosHeader = (apiKey) => {
|
|
413
|
-
if (!apiKey.startsWith(API_KEY_PREFIX)) {
|
|
414
|
-
throw new Error('Invalid API key. Create your api key in Immutable developer hub. https://hub.immutable.com');
|
|
415
|
-
}
|
|
416
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.API_KEY] = apiKey;
|
|
417
|
-
};
|
|
418
|
-
const addPublishableKeyToAxiosHeader = (publishableKey) => {
|
|
419
|
-
if (!publishableKey.startsWith(PUBLISHABLE_KEY_PREFIX$1)) {
|
|
420
|
-
throw new Error('Invalid Publishable key. Create your Publishable key in Immutable developer hub.'
|
|
421
|
-
+ ' https://hub.immutable.com');
|
|
422
|
-
}
|
|
423
|
-
setPublishableApiKey(publishableKey);
|
|
424
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.PUBLISHABLE_KEY] = publishableKey;
|
|
425
|
-
};
|
|
426
|
-
const addRateLimitingKeyToAxiosHeader = (rateLimitingKey) => {
|
|
427
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.RATE_LIMITING_KEY] = rateLimitingKey;
|
|
428
|
-
};
|
|
429
411
|
|
|
430
412
|
var config = /*#__PURE__*/Object.freeze({
|
|
431
413
|
__proto__: null,
|
|
432
414
|
get Environment () { return Environment$1; },
|
|
433
415
|
ImmutableConfiguration: ImmutableConfiguration,
|
|
434
416
|
get KeyHeaders () { return KeyHeaders$1; },
|
|
435
|
-
|
|
436
|
-
addKeysToHeadersOverride: addKeysToHeadersOverride,
|
|
437
|
-
addPublishableKeyToAxiosHeader: addPublishableKeyToAxiosHeader,
|
|
438
|
-
addRateLimitingKeyToAxiosHeader: addRateLimitingKeyToAxiosHeader
|
|
417
|
+
addKeysToHeadersOverride: addKeysToHeadersOverride
|
|
439
418
|
});
|
|
440
419
|
|
|
441
420
|
/* tslint:disable */
|
|
@@ -11549,7 +11528,7 @@ class MultiRollupApiClients {
|
|
|
11549
11528
|
}
|
|
11550
11529
|
|
|
11551
11530
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11552
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.13.
|
|
11531
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.13.2' };
|
|
11553
11532
|
const createConfig = ({ basePath, headers, }) => {
|
|
11554
11533
|
if (!basePath.trim()) {
|
|
11555
11534
|
throw Error('basePath can not be empty');
|
|
@@ -11621,7 +11600,7 @@ class APIError extends Error {
|
|
|
11621
11600
|
|
|
11622
11601
|
/* eslint-disable implicit-arrow-linebreak */
|
|
11623
11602
|
const defaultHeaders = {
|
|
11624
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.13.
|
|
11603
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.13.2',
|
|
11625
11604
|
};
|
|
11626
11605
|
/**
|
|
11627
11606
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -12104,7 +12083,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
12104
12083
|
chainID,
|
|
12105
12084
|
coreContractAddress,
|
|
12106
12085
|
registrationContractAddress,
|
|
12107
|
-
sdkVersion: 'ts-immutable-sdk-1.13.
|
|
12086
|
+
sdkVersion: 'ts-immutable-sdk-1.13.2',
|
|
12108
12087
|
});
|
|
12109
12088
|
/**
|
|
12110
12089
|
* Sets `sdkVersion` at the time of build
|
|
@@ -16710,6 +16689,17 @@ class DeviceCredentialsManager {
|
|
|
16710
16689
|
}
|
|
16711
16690
|
}
|
|
16712
16691
|
|
|
16692
|
+
const shouldLog = process?.env?.JEST_WORKER_ID === undefined;
|
|
16693
|
+
const warn = (...args) => {
|
|
16694
|
+
if (shouldLog) {
|
|
16695
|
+
// eslint-disable-next-line no-console
|
|
16696
|
+
console.warn(...args);
|
|
16697
|
+
}
|
|
16698
|
+
};
|
|
16699
|
+
var logger$f = {
|
|
16700
|
+
warn,
|
|
16701
|
+
};
|
|
16702
|
+
|
|
16713
16703
|
function isIdTokenExpired(idToken) {
|
|
16714
16704
|
if (!idToken) {
|
|
16715
16705
|
return false;
|
|
@@ -16872,8 +16862,7 @@ class AuthManager {
|
|
|
16872
16862
|
user = await this.getUser();
|
|
16873
16863
|
}
|
|
16874
16864
|
catch (err) {
|
|
16875
|
-
|
|
16876
|
-
console.warn('failed to retrieve a cached user session:', err);
|
|
16865
|
+
logger$f.warn('Failed to retrieve a cached user session', err);
|
|
16877
16866
|
}
|
|
16878
16867
|
return user || this.login();
|
|
16879
16868
|
}
|
|
@@ -17017,8 +17006,7 @@ class AuthManager {
|
|
|
17017
17006
|
}
|
|
17018
17007
|
forceUserRefreshInBackground() {
|
|
17019
17008
|
this.refreshTokenAndUpdatePromise().catch((error) => {
|
|
17020
|
-
|
|
17021
|
-
console.warn('Failed to refresh user token', error);
|
|
17009
|
+
logger$f.warn('Failed to refresh user token', error);
|
|
17022
17010
|
});
|
|
17023
17011
|
}
|
|
17024
17012
|
async forceUserRefresh() {
|
|
@@ -18060,33 +18048,45 @@ function getNormalisedTransactions(txs) {
|
|
|
18060
18048
|
return txs.map((t) => ({
|
|
18061
18049
|
delegateCall: t.delegateCall === true,
|
|
18062
18050
|
revertOnError: t.revertOnError === true,
|
|
18063
|
-
gasLimit: t.gasLimit ??
|
|
18064
|
-
target: t.to ??
|
|
18065
|
-
value: t.value ??
|
|
18051
|
+
gasLimit: t.gasLimit ?? constants$1.Zero,
|
|
18052
|
+
target: t.to ?? constants$1.AddressZero,
|
|
18053
|
+
value: t.value ?? constants$1.Zero,
|
|
18066
18054
|
data: t.data ?? [],
|
|
18067
18055
|
}));
|
|
18068
18056
|
}
|
|
18069
18057
|
function digestOfTransactionsAndNonce(nonce, normalisedTransactions) {
|
|
18070
|
-
const packMetaTransactionsNonceData =
|
|
18071
|
-
return
|
|
18058
|
+
const packMetaTransactionsNonceData = utils$3.defaultAbiCoder.encode(['uint256', META_TRANSACTIONS_TYPE], [nonce, normalisedTransactions]);
|
|
18059
|
+
return utils$3.keccak256(packMetaTransactionsNonceData);
|
|
18072
18060
|
}
|
|
18073
18061
|
const getNonce = async (jsonRpcProvider, smartContractWalletAddress) => {
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
const
|
|
18077
|
-
|
|
18062
|
+
try {
|
|
18063
|
+
const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi, jsonRpcProvider);
|
|
18064
|
+
const result = await contract.nonce();
|
|
18065
|
+
if (result instanceof BigNumber$1) {
|
|
18066
|
+
return result;
|
|
18067
|
+
}
|
|
18078
18068
|
}
|
|
18079
|
-
|
|
18069
|
+
catch (error) {
|
|
18070
|
+
if (error instanceof Error
|
|
18071
|
+
&& 'code' in error
|
|
18072
|
+
&& error.code === errors.CALL_EXCEPTION) {
|
|
18073
|
+
// The most likely reason for a CALL_EXCEPTION is that the smart contract wallet
|
|
18074
|
+
// has not been deployed yet, so we should default to a nonce of 0.
|
|
18075
|
+
return BigNumber$1.from(0);
|
|
18076
|
+
}
|
|
18077
|
+
throw error;
|
|
18078
|
+
}
|
|
18079
|
+
throw new Error('Unexpected result from contract.nonce() call.');
|
|
18080
18080
|
};
|
|
18081
|
-
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (
|
|
18081
|
+
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (utils$3.solidityPack(['string', 'uint256', 'address', 'bytes32'], [ETH_SIGN_PREFIX, chainId, walletAddress, digest]));
|
|
18082
18082
|
const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walletAddress, signer) => {
|
|
18083
18083
|
const normalisedMetaTransactions = getNormalisedTransactions(metaTransactions);
|
|
18084
18084
|
// Get the hash
|
|
18085
18085
|
const digest = digestOfTransactionsAndNonce(nonce, normalisedMetaTransactions);
|
|
18086
18086
|
const completePayload = encodeMessageSubDigest(chainId, walletAddress, digest);
|
|
18087
|
-
const hash =
|
|
18087
|
+
const hash = utils$3.keccak256(completePayload);
|
|
18088
18088
|
// Sign the digest
|
|
18089
|
-
const hashArray =
|
|
18089
|
+
const hashArray = utils$3.arrayify(hash);
|
|
18090
18090
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
18091
18091
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
18092
18092
|
// Add metadata
|
|
@@ -18103,7 +18103,7 @@ const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walle
|
|
|
18103
18103
|
],
|
|
18104
18104
|
});
|
|
18105
18105
|
// Encode the transaction;
|
|
18106
|
-
const walletInterface = new
|
|
18106
|
+
const walletInterface = new utils$3.Interface(walletContracts.mainModule.abi);
|
|
18107
18107
|
return walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [
|
|
18108
18108
|
normalisedMetaTransactions,
|
|
18109
18109
|
nonce,
|
|
@@ -18120,13 +18120,13 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
|
|
|
18120
18120
|
// @ts-ignore
|
|
18121
18121
|
delete types.EIP712Domain;
|
|
18122
18122
|
// Hash the EIP712 payload and generate the complete payload
|
|
18123
|
-
const { _TypedDataEncoder: typedDataEncoder } =
|
|
18123
|
+
const { _TypedDataEncoder: typedDataEncoder } = utils$3;
|
|
18124
18124
|
const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
|
|
18125
18125
|
const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
|
|
18126
|
-
const hash =
|
|
18126
|
+
const hash = utils$3.keccak256(messageSubDigest);
|
|
18127
18127
|
// Sign the sub digest
|
|
18128
18128
|
// https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
|
|
18129
|
-
const hashArray =
|
|
18129
|
+
const hashArray = utils$3.arrayify(hash);
|
|
18130
18130
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
18131
18131
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
18132
18132
|
// Combine the relayer and user signatures; sort by address to match the imageHash order
|
|
@@ -18990,8 +18990,7 @@ class Passport {
|
|
|
18990
18990
|
if (useCachedSession) {
|
|
18991
18991
|
throw error;
|
|
18992
18992
|
}
|
|
18993
|
-
|
|
18994
|
-
console.warn('login failed to retrieve a cached user session', error);
|
|
18993
|
+
logger$f.warn('Failed to retrieve a cached user session', error);
|
|
18995
18994
|
}
|
|
18996
18995
|
if (!user && !useCachedSession) {
|
|
18997
18996
|
user = await this.authManager.login(options?.anonymousId);
|
|
@@ -19025,8 +19024,7 @@ class Passport {
|
|
|
19025
19024
|
await this.confirmationScreen.logout();
|
|
19026
19025
|
}
|
|
19027
19026
|
catch (err) {
|
|
19028
|
-
|
|
19029
|
-
console.warn('Failed to logout from confirmation screen', err);
|
|
19027
|
+
logger$f.warn('Failed to logout from confirmation screen', err);
|
|
19030
19028
|
}
|
|
19031
19029
|
await Promise.allSettled([
|
|
19032
19030
|
this.authManager.logout(),
|
|
@@ -37835,7 +37833,7 @@ const flattenProperties = (properties) => {
|
|
|
37835
37833
|
};
|
|
37836
37834
|
|
|
37837
37835
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
37838
|
-
const SDK_VERSION = '1.13.
|
|
37836
|
+
const SDK_VERSION = '1.13.2';
|
|
37839
37837
|
const getReferrer = () => {
|
|
37840
37838
|
if (isNode()) {
|
|
37841
37839
|
return '';
|
|
@@ -43011,7 +43009,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
43011
43009
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
43012
43010
|
};
|
|
43013
43011
|
|
|
43014
|
-
const SDK_VERSION_MARKER = '1.13.
|
|
43012
|
+
const SDK_VERSION_MARKER = '1.13.2';
|
|
43015
43013
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
43016
43014
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
43017
43015
|
|
package/dist/orderbook.d.ts
CHANGED
|
@@ -15,20 +15,8 @@ declare class ImmutableConfiguration {
|
|
|
15
15
|
publishableKey?: string;
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
19
|
-
apiKey: 'required';
|
|
20
|
-
} ? Required<{
|
|
21
|
-
apiKey: string;
|
|
22
|
-
}> : {}) & (T extends {
|
|
23
|
-
publishableKey: 'required';
|
|
24
|
-
} ? Required<{
|
|
25
|
-
publishableKey: string;
|
|
26
|
-
}> : {});
|
|
27
|
-
type ImmutableConfigurationWithOmitableFields<T> = T extends {
|
|
28
|
-
apiKey: 'omit';
|
|
29
|
-
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>;
|
|
30
18
|
interface ModuleConfiguration<T> {
|
|
31
|
-
baseConfig:
|
|
19
|
+
baseConfig: ImmutableConfiguration;
|
|
32
20
|
overrides?: T;
|
|
33
21
|
}
|
|
34
22
|
|
package/dist/orderbook.js
CHANGED
|
@@ -131,7 +131,7 @@ const flattenProperties = (properties) => {
|
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
134
|
-
const SDK_VERSION = '1.13.
|
|
134
|
+
const SDK_VERSION = '1.13.2';
|
|
135
135
|
const getReferrer = () => {
|
|
136
136
|
if (isNode()) {
|
|
137
137
|
return '';
|
package/dist/passport.d.ts
CHANGED
|
@@ -9826,20 +9826,8 @@ declare class ImmutableConfiguration {
|
|
|
9826
9826
|
publishableKey?: string;
|
|
9827
9827
|
});
|
|
9828
9828
|
}
|
|
9829
|
-
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
9830
|
-
apiKey: 'required';
|
|
9831
|
-
} ? Required<{
|
|
9832
|
-
apiKey: string;
|
|
9833
|
-
}> : {}) & (T extends {
|
|
9834
|
-
publishableKey: 'required';
|
|
9835
|
-
} ? Required<{
|
|
9836
|
-
publishableKey: string;
|
|
9837
|
-
}> : {});
|
|
9838
|
-
type ImmutableConfigurationWithOmitableFields<T> = T extends {
|
|
9839
|
-
apiKey: 'omit';
|
|
9840
|
-
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>;
|
|
9841
9829
|
interface ModuleConfiguration<T> {
|
|
9842
|
-
baseConfig:
|
|
9830
|
+
baseConfig: ImmutableConfiguration;
|
|
9843
9831
|
overrides?: T;
|
|
9844
9832
|
}
|
|
9845
9833
|
|