@imtbl/sdk 0.30.2 → 0.30.4
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 +1 -1
- package/dist/browser/checkout/sdk.js +3 -3
- package/dist/browser/checkout/widgets.js +56 -56
- package/dist/checkout_sdk.d.ts +0 -11
- package/dist/checkout_sdk.js +26 -28
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +30 -38
- package/dist/index.d.ts +0 -11
- package/dist/index.js +30 -38
- package/dist/passport.js +4 -10
- package/package.json +1 -1
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -11658,15 +11658,6 @@ interface CheckConnectionResult {
|
|
|
11658
11658
|
walletAddress: string;
|
|
11659
11659
|
}
|
|
11660
11660
|
|
|
11661
|
-
/**
|
|
11662
|
-
* @typedef {string} Address - Represents an Ethereum address.
|
|
11663
|
-
*/
|
|
11664
|
-
type Address = string;
|
|
11665
|
-
/**
|
|
11666
|
-
* @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
|
|
11667
|
-
*/
|
|
11668
|
-
type FungibleToken = Address | 'NATIVE';
|
|
11669
|
-
|
|
11670
11661
|
/**
|
|
11671
11662
|
* An enum representing the type of gas estimate.
|
|
11672
11663
|
* @enum {string}
|
|
@@ -11687,12 +11678,10 @@ type GasEstimateParams = GasEstimateBridgeToL2Params | GasEstimateSwapParams;
|
|
|
11687
11678
|
* An interface representing the parameters for estimating gas for a bridge to L2 transaction {@link Checkout.gasEstimate}.
|
|
11688
11679
|
* @param {GasEstimateType.BRIDGE_TO_L2} gasEstimateType - The type of gas estimate.
|
|
11689
11680
|
* @param {boolean} isSpendingCapApprovalRequired - Whether or not spending cap approval is required.
|
|
11690
|
-
* @param {FungibleToken | undefined} tokenAddress - The address of the fungible token to use in the transaction.
|
|
11691
11681
|
*/
|
|
11692
11682
|
interface GasEstimateBridgeToL2Params {
|
|
11693
11683
|
gasEstimateType: GasEstimateType.BRIDGE_TO_L2;
|
|
11694
11684
|
isSpendingCapApprovalRequired: boolean;
|
|
11695
|
-
tokenAddress?: FungibleToken;
|
|
11696
11685
|
}
|
|
11697
11686
|
/**
|
|
11698
11687
|
* An interface representing the parameters for a gas estimate swap {@link Checkout.gasEstimate}.
|
package/dist/checkout_sdk.js
CHANGED
|
@@ -20911,7 +20911,7 @@ class APIError extends Error {
|
|
|
20911
20911
|
|
|
20912
20912
|
/* eslint-disable implicit-arrow-linebreak */
|
|
20913
20913
|
const defaultHeaders = {
|
|
20914
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.
|
|
20914
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.4',
|
|
20915
20915
|
};
|
|
20916
20916
|
/**
|
|
20917
20917
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -22919,42 +22919,40 @@ function getTokenContract(address, contractInterface, signerOrProvider) {
|
|
|
22919
22919
|
|
|
22920
22920
|
const DUMMY_WALLET_ADDRESS = '0x0000000000000000000000000000000000000001';
|
|
22921
22921
|
const DEFAULT_TOKEN_DECIMALS = 18;
|
|
22922
|
-
async function
|
|
22923
|
-
if (tokenAddress === 'NATIVE') {
|
|
22924
|
-
return config.networkMap.get(chainId)?.nativeCurrency;
|
|
22925
|
-
}
|
|
22926
|
-
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), provider);
|
|
22927
|
-
const name = await contract.name();
|
|
22928
|
-
const symbol = await contract.symbol();
|
|
22929
|
-
const decimals = await contract.decimals();
|
|
22930
|
-
return {
|
|
22931
|
-
name,
|
|
22932
|
-
symbol,
|
|
22933
|
-
decimals,
|
|
22934
|
-
address: tokenAddress,
|
|
22935
|
-
};
|
|
22936
|
-
}
|
|
22937
|
-
async function bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
|
|
22922
|
+
async function bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired) {
|
|
22938
22923
|
const fromChainId = getL1ChainId(config);
|
|
22939
22924
|
const toChainId = getL2ChainId(config);
|
|
22940
22925
|
const gasEstimateTokensConfig = (await config.remote.getConfig('gasEstimateTokens'));
|
|
22941
|
-
const {
|
|
22926
|
+
const { fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
|
|
22942
22927
|
const provider = readOnlyProviders.get(fromChainId);
|
|
22943
22928
|
if (!provider)
|
|
22944
22929
|
throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
|
|
22945
22930
|
try {
|
|
22946
|
-
|
|
22947
|
-
|
|
22948
|
-
|
|
22949
|
-
|
|
22931
|
+
let gasFees = {};
|
|
22932
|
+
const getGasFees = async () => {
|
|
22933
|
+
gasFees = await getBridgeEstimatedGas(provider, isSpendingCapApprovalRequired);
|
|
22934
|
+
gasFees.token = config.networkMap.get(fromChainId)?.nativeCurrency;
|
|
22935
|
+
};
|
|
22936
|
+
let bridgeFees = {
|
|
22937
|
+
bridgeFee: {},
|
|
22938
|
+
bridgeable: false,
|
|
22939
|
+
};
|
|
22940
|
+
const getBridgeFees = async () => {
|
|
22941
|
+
const tokenBridge = await createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
22942
|
+
bridgeFees = await getBridgeFeeEstimate$1(tokenBridge, fromAddress);
|
|
22943
|
+
};
|
|
22944
|
+
await Promise.all([
|
|
22945
|
+
getGasFees(),
|
|
22946
|
+
getBridgeFees(),
|
|
22947
|
+
]);
|
|
22950
22948
|
return {
|
|
22951
22949
|
gasEstimateType: GasEstimateType.BRIDGE_TO_L2,
|
|
22952
|
-
gasFee,
|
|
22950
|
+
gasFee: gasFees,
|
|
22953
22951
|
bridgeFee: {
|
|
22954
|
-
estimatedAmount: bridgeFee?.estimatedAmount,
|
|
22955
|
-
token: bridgeFee?.token,
|
|
22952
|
+
estimatedAmount: bridgeFees.bridgeFee?.estimatedAmount,
|
|
22953
|
+
token: bridgeFees.bridgeFee?.token,
|
|
22956
22954
|
},
|
|
22957
|
-
bridgeable,
|
|
22955
|
+
bridgeable: bridgeFees.bridgeable,
|
|
22958
22956
|
};
|
|
22959
22957
|
}
|
|
22960
22958
|
catch {
|
|
@@ -23010,7 +23008,7 @@ async function swapGasEstimator(config) {
|
|
|
23010
23008
|
async function gasEstimator(params, readOnlyProviders, config) {
|
|
23011
23009
|
switch (params.gasEstimateType) {
|
|
23012
23010
|
case GasEstimateType.BRIDGE_TO_L2:
|
|
23013
|
-
return await bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired
|
|
23011
|
+
return await bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired);
|
|
23014
23012
|
case GasEstimateType.SWAP:
|
|
23015
23013
|
return await swapGasEstimator(config);
|
|
23016
23014
|
default:
|
|
@@ -25628,7 +25626,7 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
25628
25626
|
return itemRequirements;
|
|
25629
25627
|
}
|
|
25630
25628
|
|
|
25631
|
-
const SDK_VERSION_MARKER = '0.30.
|
|
25629
|
+
const SDK_VERSION_MARKER = '0.30.4';
|
|
25632
25630
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
25633
25631
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
25634
25632
|
|
|
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
17
17
|
chainID,
|
|
18
18
|
coreContractAddress,
|
|
19
19
|
registrationContractAddress,
|
|
20
|
-
sdkVersion: 'ts-immutable-sdk-0.30.
|
|
20
|
+
sdkVersion: 'ts-immutable-sdk-0.30.4',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|