@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/passport.js
CHANGED
|
@@ -11,7 +11,7 @@ import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers';
|
|
|
11
11
|
import BN from 'bn.js';
|
|
12
12
|
import * as encUtils from 'enc-utils';
|
|
13
13
|
import { EventEmitter } from 'events';
|
|
14
|
-
import { BigNumber, ethers } from 'ethers';
|
|
14
|
+
import { BigNumber, Contract, errors, utils as utils$2, ethers, constants } from 'ethers';
|
|
15
15
|
import { walletContracts } from '@0xsequence/abi';
|
|
16
16
|
import { v1 } from '@0xsequence/core';
|
|
17
17
|
|
|
@@ -9346,7 +9346,7 @@ class MultiRollupApiClients {
|
|
|
9346
9346
|
}
|
|
9347
9347
|
|
|
9348
9348
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9349
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.13.
|
|
9349
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.13.2' };
|
|
9350
9350
|
const createConfig = ({ basePath, headers, }) => {
|
|
9351
9351
|
if (!basePath.trim()) {
|
|
9352
9352
|
throw Error('basePath can not be empty');
|
|
@@ -9525,7 +9525,7 @@ const flattenProperties = (properties) => {
|
|
|
9525
9525
|
};
|
|
9526
9526
|
|
|
9527
9527
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
9528
|
-
const SDK_VERSION = '1.13.
|
|
9528
|
+
const SDK_VERSION = '1.13.2';
|
|
9529
9529
|
const getReferrer = () => {
|
|
9530
9530
|
if (isNode()) {
|
|
9531
9531
|
return '';
|
|
@@ -9744,7 +9744,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
9744
9744
|
chainID,
|
|
9745
9745
|
coreContractAddress,
|
|
9746
9746
|
registrationContractAddress,
|
|
9747
|
-
sdkVersion: 'ts-immutable-sdk-1.13.
|
|
9747
|
+
sdkVersion: 'ts-immutable-sdk-1.13.2',
|
|
9748
9748
|
});
|
|
9749
9749
|
/**
|
|
9750
9750
|
* Sets `sdkVersion` at the time of build
|
|
@@ -14341,6 +14341,17 @@ class DeviceCredentialsManager {
|
|
|
14341
14341
|
}
|
|
14342
14342
|
}
|
|
14343
14343
|
|
|
14344
|
+
const shouldLog = process?.env?.JEST_WORKER_ID === undefined;
|
|
14345
|
+
const warn = (...args) => {
|
|
14346
|
+
if (shouldLog) {
|
|
14347
|
+
// eslint-disable-next-line no-console
|
|
14348
|
+
console.warn(...args);
|
|
14349
|
+
}
|
|
14350
|
+
};
|
|
14351
|
+
var logger = {
|
|
14352
|
+
warn,
|
|
14353
|
+
};
|
|
14354
|
+
|
|
14344
14355
|
function isIdTokenExpired(idToken) {
|
|
14345
14356
|
if (!idToken) {
|
|
14346
14357
|
return false;
|
|
@@ -14503,8 +14514,7 @@ class AuthManager {
|
|
|
14503
14514
|
user = await this.getUser();
|
|
14504
14515
|
}
|
|
14505
14516
|
catch (err) {
|
|
14506
|
-
|
|
14507
|
-
console.warn('failed to retrieve a cached user session:', err);
|
|
14517
|
+
logger.warn('Failed to retrieve a cached user session', err);
|
|
14508
14518
|
}
|
|
14509
14519
|
return user || this.login();
|
|
14510
14520
|
}
|
|
@@ -14648,8 +14658,7 @@ class AuthManager {
|
|
|
14648
14658
|
}
|
|
14649
14659
|
forceUserRefreshInBackground() {
|
|
14650
14660
|
this.refreshTokenAndUpdatePromise().catch((error) => {
|
|
14651
|
-
|
|
14652
|
-
console.warn('Failed to refresh user token', error);
|
|
14661
|
+
logger.warn('Failed to refresh user token', error);
|
|
14653
14662
|
});
|
|
14654
14663
|
}
|
|
14655
14664
|
async forceUserRefresh() {
|
|
@@ -15691,33 +15700,45 @@ function getNormalisedTransactions(txs) {
|
|
|
15691
15700
|
return txs.map((t) => ({
|
|
15692
15701
|
delegateCall: t.delegateCall === true,
|
|
15693
15702
|
revertOnError: t.revertOnError === true,
|
|
15694
|
-
gasLimit: t.gasLimit ??
|
|
15695
|
-
target: t.to ??
|
|
15696
|
-
value: t.value ??
|
|
15703
|
+
gasLimit: t.gasLimit ?? constants.Zero,
|
|
15704
|
+
target: t.to ?? constants.AddressZero,
|
|
15705
|
+
value: t.value ?? constants.Zero,
|
|
15697
15706
|
data: t.data ?? [],
|
|
15698
15707
|
}));
|
|
15699
15708
|
}
|
|
15700
15709
|
function digestOfTransactionsAndNonce(nonce, normalisedTransactions) {
|
|
15701
|
-
const packMetaTransactionsNonceData =
|
|
15702
|
-
return
|
|
15710
|
+
const packMetaTransactionsNonceData = utils$2.defaultAbiCoder.encode(['uint256', META_TRANSACTIONS_TYPE], [nonce, normalisedTransactions]);
|
|
15711
|
+
return utils$2.keccak256(packMetaTransactionsNonceData);
|
|
15703
15712
|
}
|
|
15704
15713
|
const getNonce = async (jsonRpcProvider, smartContractWalletAddress) => {
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
const
|
|
15708
|
-
|
|
15714
|
+
try {
|
|
15715
|
+
const contract = new Contract(smartContractWalletAddress, walletContracts.mainModule.abi, jsonRpcProvider);
|
|
15716
|
+
const result = await contract.nonce();
|
|
15717
|
+
if (result instanceof BigNumber) {
|
|
15718
|
+
return result;
|
|
15719
|
+
}
|
|
15720
|
+
}
|
|
15721
|
+
catch (error) {
|
|
15722
|
+
if (error instanceof Error
|
|
15723
|
+
&& 'code' in error
|
|
15724
|
+
&& error.code === errors.CALL_EXCEPTION) {
|
|
15725
|
+
// The most likely reason for a CALL_EXCEPTION is that the smart contract wallet
|
|
15726
|
+
// has not been deployed yet, so we should default to a nonce of 0.
|
|
15727
|
+
return BigNumber.from(0);
|
|
15728
|
+
}
|
|
15729
|
+
throw error;
|
|
15709
15730
|
}
|
|
15710
|
-
|
|
15731
|
+
throw new Error('Unexpected result from contract.nonce() call.');
|
|
15711
15732
|
};
|
|
15712
|
-
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (
|
|
15733
|
+
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (utils$2.solidityPack(['string', 'uint256', 'address', 'bytes32'], [ETH_SIGN_PREFIX, chainId, walletAddress, digest]));
|
|
15713
15734
|
const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walletAddress, signer) => {
|
|
15714
15735
|
const normalisedMetaTransactions = getNormalisedTransactions(metaTransactions);
|
|
15715
15736
|
// Get the hash
|
|
15716
15737
|
const digest = digestOfTransactionsAndNonce(nonce, normalisedMetaTransactions);
|
|
15717
15738
|
const completePayload = encodeMessageSubDigest(chainId, walletAddress, digest);
|
|
15718
|
-
const hash =
|
|
15739
|
+
const hash = utils$2.keccak256(completePayload);
|
|
15719
15740
|
// Sign the digest
|
|
15720
|
-
const hashArray =
|
|
15741
|
+
const hashArray = utils$2.arrayify(hash);
|
|
15721
15742
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
15722
15743
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
15723
15744
|
// Add metadata
|
|
@@ -15734,7 +15755,7 @@ const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walle
|
|
|
15734
15755
|
],
|
|
15735
15756
|
});
|
|
15736
15757
|
// Encode the transaction;
|
|
15737
|
-
const walletInterface = new
|
|
15758
|
+
const walletInterface = new utils$2.Interface(walletContracts.mainModule.abi);
|
|
15738
15759
|
return walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [
|
|
15739
15760
|
normalisedMetaTransactions,
|
|
15740
15761
|
nonce,
|
|
@@ -15751,13 +15772,13 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
|
|
|
15751
15772
|
// @ts-ignore
|
|
15752
15773
|
delete types.EIP712Domain;
|
|
15753
15774
|
// Hash the EIP712 payload and generate the complete payload
|
|
15754
|
-
const { _TypedDataEncoder: typedDataEncoder } =
|
|
15775
|
+
const { _TypedDataEncoder: typedDataEncoder } = utils$2;
|
|
15755
15776
|
const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
|
|
15756
15777
|
const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
|
|
15757
|
-
const hash =
|
|
15778
|
+
const hash = utils$2.keccak256(messageSubDigest);
|
|
15758
15779
|
// Sign the sub digest
|
|
15759
15780
|
// https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
|
|
15760
|
-
const hashArray =
|
|
15781
|
+
const hashArray = utils$2.arrayify(hash);
|
|
15761
15782
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
15762
15783
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
15763
15784
|
// Combine the relayer and user signatures; sort by address to match the imageHash order
|
|
@@ -16621,8 +16642,7 @@ class Passport {
|
|
|
16621
16642
|
if (useCachedSession) {
|
|
16622
16643
|
throw error;
|
|
16623
16644
|
}
|
|
16624
|
-
|
|
16625
|
-
console.warn('login failed to retrieve a cached user session', error);
|
|
16645
|
+
logger.warn('Failed to retrieve a cached user session', error);
|
|
16626
16646
|
}
|
|
16627
16647
|
if (!user && !useCachedSession) {
|
|
16628
16648
|
user = await this.authManager.login(options?.anonymousId);
|
|
@@ -16656,8 +16676,7 @@ class Passport {
|
|
|
16656
16676
|
await this.confirmationScreen.logout();
|
|
16657
16677
|
}
|
|
16658
16678
|
catch (err) {
|
|
16659
|
-
|
|
16660
|
-
console.warn('Failed to logout from confirmation screen', err);
|
|
16679
|
+
logger.warn('Failed to logout from confirmation screen', err);
|
|
16661
16680
|
}
|
|
16662
16681
|
await Promise.allSettled([
|
|
16663
16682
|
this.authManager.logout(),
|
package/dist/x.d.ts
CHANGED
|
@@ -9775,20 +9775,8 @@ declare class ImmutableConfiguration {
|
|
|
9775
9775
|
publishableKey?: string;
|
|
9776
9776
|
});
|
|
9777
9777
|
}
|
|
9778
|
-
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
9779
|
-
apiKey: 'required';
|
|
9780
|
-
} ? Required<{
|
|
9781
|
-
apiKey: string;
|
|
9782
|
-
}> : {}) & (T extends {
|
|
9783
|
-
publishableKey: 'required';
|
|
9784
|
-
} ? Required<{
|
|
9785
|
-
publishableKey: string;
|
|
9786
|
-
}> : {});
|
|
9787
|
-
type ImmutableConfigurationWithOmitableFields<T> = T extends {
|
|
9788
|
-
apiKey: 'omit';
|
|
9789
|
-
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>;
|
|
9790
9778
|
interface ModuleConfiguration<T> {
|
|
9791
|
-
baseConfig:
|
|
9779
|
+
baseConfig: ImmutableConfiguration;
|
|
9792
9780
|
overrides?: T;
|
|
9793
9781
|
}
|
|
9794
9782
|
|
package/dist/x.js
CHANGED
|
@@ -136,7 +136,7 @@ const flattenProperties = (properties) => {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
139
|
-
const SDK_VERSION = '1.13.
|
|
139
|
+
const SDK_VERSION = '1.13.2';
|
|
140
140
|
const getReferrer = () => {
|
|
141
141
|
if (isNode()) {
|
|
142
142
|
return '';
|
|
@@ -334,7 +334,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
334
334
|
chainID,
|
|
335
335
|
coreContractAddress,
|
|
336
336
|
registrationContractAddress,
|
|
337
|
-
sdkVersion: 'ts-immutable-sdk-1.13.
|
|
337
|
+
sdkVersion: 'ts-immutable-sdk-1.13.2',
|
|
338
338
|
});
|
|
339
339
|
/**
|
|
340
340
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bH as n,bI as t}from"./index-57f03d43.js";function i(i){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:return[4,import("./index.umd-ebf23be8.js").then((function(n){return n.i}))];case 1:return n=t.sent(),i._plugins=n,[2]}}))}))}export{i as loadLegacyVideoPlugins};
|