@imtbl/sdk 0.30.3 → 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 +53 -53
- 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 +8 -8
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +28 -30
- package/dist/index.d.ts +0 -11
- package/dist/index.js +28 -30
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3792,7 +3792,7 @@ class MultiRollupApiClients {
|
|
|
3792
3792
|
}
|
|
3793
3793
|
|
|
3794
3794
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3795
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.30.
|
|
3795
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.30.4' };
|
|
3796
3796
|
const createConfig = ({ basePath, headers, }) => {
|
|
3797
3797
|
if (!basePath.trim()) {
|
|
3798
3798
|
throw Error('basePath can not be empty');
|
|
@@ -3852,7 +3852,7 @@ class APIError extends Error {
|
|
|
3852
3852
|
|
|
3853
3853
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3854
3854
|
const defaultHeaders = {
|
|
3855
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.
|
|
3855
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.4',
|
|
3856
3856
|
};
|
|
3857
3857
|
/**
|
|
3858
3858
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4263,7 +4263,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4263
4263
|
chainID,
|
|
4264
4264
|
coreContractAddress,
|
|
4265
4265
|
registrationContractAddress,
|
|
4266
|
-
sdkVersion: 'ts-immutable-sdk-0.30.
|
|
4266
|
+
sdkVersion: 'ts-immutable-sdk-0.30.4',
|
|
4267
4267
|
});
|
|
4268
4268
|
/**
|
|
4269
4269
|
* Sets `sdkVersion` at the time of build
|
|
@@ -31315,42 +31315,40 @@ function getTokenContract(address, contractInterface, signerOrProvider) {
|
|
|
31315
31315
|
|
|
31316
31316
|
const DUMMY_WALLET_ADDRESS = '0x0000000000000000000000000000000000000001';
|
|
31317
31317
|
const DEFAULT_TOKEN_DECIMALS = 18;
|
|
31318
|
-
async function
|
|
31319
|
-
if (tokenAddress === 'NATIVE') {
|
|
31320
|
-
return config.networkMap.get(chainId)?.nativeCurrency;
|
|
31321
|
-
}
|
|
31322
|
-
const contract = new ethers.Contract(tokenAddress, JSON.stringify(ERC20ABI), provider);
|
|
31323
|
-
const name = await contract.name();
|
|
31324
|
-
const symbol = await contract.symbol();
|
|
31325
|
-
const decimals = await contract.decimals();
|
|
31326
|
-
return {
|
|
31327
|
-
name,
|
|
31328
|
-
symbol,
|
|
31329
|
-
decimals,
|
|
31330
|
-
address: tokenAddress,
|
|
31331
|
-
};
|
|
31332
|
-
}
|
|
31333
|
-
async function bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
|
|
31318
|
+
async function bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired) {
|
|
31334
31319
|
const fromChainId = getL1ChainId(config);
|
|
31335
31320
|
const toChainId = getL2ChainId(config);
|
|
31336
31321
|
const gasEstimateTokensConfig = (await config.remote.getConfig('gasEstimateTokens'));
|
|
31337
|
-
const {
|
|
31322
|
+
const { fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
|
|
31338
31323
|
const provider = readOnlyProviders.get(fromChainId);
|
|
31339
31324
|
if (!provider)
|
|
31340
31325
|
throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
|
|
31341
31326
|
try {
|
|
31342
|
-
|
|
31343
|
-
|
|
31344
|
-
|
|
31345
|
-
|
|
31327
|
+
let gasFees = {};
|
|
31328
|
+
const getGasFees = async () => {
|
|
31329
|
+
gasFees = await getBridgeEstimatedGas(provider, isSpendingCapApprovalRequired);
|
|
31330
|
+
gasFees.token = config.networkMap.get(fromChainId)?.nativeCurrency;
|
|
31331
|
+
};
|
|
31332
|
+
let bridgeFees = {
|
|
31333
|
+
bridgeFee: {},
|
|
31334
|
+
bridgeable: false,
|
|
31335
|
+
};
|
|
31336
|
+
const getBridgeFees = async () => {
|
|
31337
|
+
const tokenBridge = await createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
31338
|
+
bridgeFees = await getBridgeFeeEstimate$1(tokenBridge, fromAddress);
|
|
31339
|
+
};
|
|
31340
|
+
await Promise.all([
|
|
31341
|
+
getGasFees(),
|
|
31342
|
+
getBridgeFees(),
|
|
31343
|
+
]);
|
|
31346
31344
|
return {
|
|
31347
31345
|
gasEstimateType: GasEstimateType.BRIDGE_TO_L2,
|
|
31348
|
-
gasFee,
|
|
31346
|
+
gasFee: gasFees,
|
|
31349
31347
|
bridgeFee: {
|
|
31350
|
-
estimatedAmount: bridgeFee?.estimatedAmount,
|
|
31351
|
-
token: bridgeFee?.token,
|
|
31348
|
+
estimatedAmount: bridgeFees.bridgeFee?.estimatedAmount,
|
|
31349
|
+
token: bridgeFees.bridgeFee?.token,
|
|
31352
31350
|
},
|
|
31353
|
-
bridgeable,
|
|
31351
|
+
bridgeable: bridgeFees.bridgeable,
|
|
31354
31352
|
};
|
|
31355
31353
|
}
|
|
31356
31354
|
catch {
|
|
@@ -31406,7 +31404,7 @@ async function swapGasEstimator(config) {
|
|
|
31406
31404
|
async function gasEstimator(params, readOnlyProviders, config) {
|
|
31407
31405
|
switch (params.gasEstimateType) {
|
|
31408
31406
|
case GasEstimateType.BRIDGE_TO_L2:
|
|
31409
|
-
return await bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired
|
|
31407
|
+
return await bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired);
|
|
31410
31408
|
case GasEstimateType.SWAP:
|
|
31411
31409
|
return await swapGasEstimator(config);
|
|
31412
31410
|
default:
|
|
@@ -34024,7 +34022,7 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
34024
34022
|
return itemRequirements;
|
|
34025
34023
|
}
|
|
34026
34024
|
|
|
34027
|
-
const SDK_VERSION_MARKER = '0.30.
|
|
34025
|
+
const SDK_VERSION_MARKER = '0.30.4';
|
|
34028
34026
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
34029
34027
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
34030
34028
|
|
package/dist/index.d.ts
CHANGED
|
@@ -16919,15 +16919,6 @@ interface CheckConnectionResult {
|
|
|
16919
16919
|
walletAddress: string;
|
|
16920
16920
|
}
|
|
16921
16921
|
|
|
16922
|
-
/**
|
|
16923
|
-
* @typedef {string} Address - Represents an Ethereum address.
|
|
16924
|
-
*/
|
|
16925
|
-
type Address = string;
|
|
16926
|
-
/**
|
|
16927
|
-
* @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
|
|
16928
|
-
*/
|
|
16929
|
-
type FungibleToken = Address | 'NATIVE';
|
|
16930
|
-
|
|
16931
16922
|
/**
|
|
16932
16923
|
* An enum representing the type of gas estimate.
|
|
16933
16924
|
* @enum {string}
|
|
@@ -16948,12 +16939,10 @@ type GasEstimateParams = GasEstimateBridgeToL2Params | GasEstimateSwapParams;
|
|
|
16948
16939
|
* An interface representing the parameters for estimating gas for a bridge to L2 transaction {@link Checkout.gasEstimate}.
|
|
16949
16940
|
* @param {GasEstimateType.BRIDGE_TO_L2} gasEstimateType - The type of gas estimate.
|
|
16950
16941
|
* @param {boolean} isSpendingCapApprovalRequired - Whether or not spending cap approval is required.
|
|
16951
|
-
* @param {FungibleToken | undefined} tokenAddress - The address of the fungible token to use in the transaction.
|
|
16952
16942
|
*/
|
|
16953
16943
|
interface GasEstimateBridgeToL2Params {
|
|
16954
16944
|
gasEstimateType: GasEstimateType.BRIDGE_TO_L2;
|
|
16955
16945
|
isSpendingCapApprovalRequired: boolean;
|
|
16956
|
-
tokenAddress?: FungibleToken;
|
|
16957
16946
|
}
|
|
16958
16947
|
/**
|
|
16959
16948
|
* An interface representing the parameters for a gas estimate swap {@link Checkout.gasEstimate}.
|
package/dist/index.js
CHANGED
|
@@ -3770,7 +3770,7 @@ class MultiRollupApiClients {
|
|
|
3770
3770
|
}
|
|
3771
3771
|
|
|
3772
3772
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3773
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.30.
|
|
3773
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.30.4' };
|
|
3774
3774
|
const createConfig = ({ basePath, headers, }) => {
|
|
3775
3775
|
if (!basePath.trim()) {
|
|
3776
3776
|
throw Error('basePath can not be empty');
|
|
@@ -3830,7 +3830,7 @@ class APIError extends Error {
|
|
|
3830
3830
|
|
|
3831
3831
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3832
3832
|
const defaultHeaders = {
|
|
3833
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.
|
|
3833
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.4',
|
|
3834
3834
|
};
|
|
3835
3835
|
/**
|
|
3836
3836
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4241,7 +4241,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4241
4241
|
chainID,
|
|
4242
4242
|
coreContractAddress,
|
|
4243
4243
|
registrationContractAddress,
|
|
4244
|
-
sdkVersion: 'ts-immutable-sdk-0.30.
|
|
4244
|
+
sdkVersion: 'ts-immutable-sdk-0.30.4',
|
|
4245
4245
|
});
|
|
4246
4246
|
/**
|
|
4247
4247
|
* Sets `sdkVersion` at the time of build
|
|
@@ -31293,42 +31293,40 @@ function getTokenContract(address, contractInterface, signerOrProvider) {
|
|
|
31293
31293
|
|
|
31294
31294
|
const DUMMY_WALLET_ADDRESS = '0x0000000000000000000000000000000000000001';
|
|
31295
31295
|
const DEFAULT_TOKEN_DECIMALS = 18;
|
|
31296
|
-
async function
|
|
31297
|
-
if (tokenAddress === 'NATIVE') {
|
|
31298
|
-
return config.networkMap.get(chainId)?.nativeCurrency;
|
|
31299
|
-
}
|
|
31300
|
-
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), provider);
|
|
31301
|
-
const name = await contract.name();
|
|
31302
|
-
const symbol = await contract.symbol();
|
|
31303
|
-
const decimals = await contract.decimals();
|
|
31304
|
-
return {
|
|
31305
|
-
name,
|
|
31306
|
-
symbol,
|
|
31307
|
-
decimals,
|
|
31308
|
-
address: tokenAddress,
|
|
31309
|
-
};
|
|
31310
|
-
}
|
|
31311
|
-
async function bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
|
|
31296
|
+
async function bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired) {
|
|
31312
31297
|
const fromChainId = getL1ChainId(config);
|
|
31313
31298
|
const toChainId = getL2ChainId(config);
|
|
31314
31299
|
const gasEstimateTokensConfig = (await config.remote.getConfig('gasEstimateTokens'));
|
|
31315
|
-
const {
|
|
31300
|
+
const { fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
|
|
31316
31301
|
const provider = readOnlyProviders.get(fromChainId);
|
|
31317
31302
|
if (!provider)
|
|
31318
31303
|
throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
|
|
31319
31304
|
try {
|
|
31320
|
-
|
|
31321
|
-
|
|
31322
|
-
|
|
31323
|
-
|
|
31305
|
+
let gasFees = {};
|
|
31306
|
+
const getGasFees = async () => {
|
|
31307
|
+
gasFees = await getBridgeEstimatedGas(provider, isSpendingCapApprovalRequired);
|
|
31308
|
+
gasFees.token = config.networkMap.get(fromChainId)?.nativeCurrency;
|
|
31309
|
+
};
|
|
31310
|
+
let bridgeFees = {
|
|
31311
|
+
bridgeFee: {},
|
|
31312
|
+
bridgeable: false,
|
|
31313
|
+
};
|
|
31314
|
+
const getBridgeFees = async () => {
|
|
31315
|
+
const tokenBridge = await createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
31316
|
+
bridgeFees = await getBridgeFeeEstimate$1(tokenBridge, fromAddress);
|
|
31317
|
+
};
|
|
31318
|
+
await Promise.all([
|
|
31319
|
+
getGasFees(),
|
|
31320
|
+
getBridgeFees(),
|
|
31321
|
+
]);
|
|
31324
31322
|
return {
|
|
31325
31323
|
gasEstimateType: GasEstimateType.BRIDGE_TO_L2,
|
|
31326
|
-
gasFee,
|
|
31324
|
+
gasFee: gasFees,
|
|
31327
31325
|
bridgeFee: {
|
|
31328
|
-
estimatedAmount: bridgeFee?.estimatedAmount,
|
|
31329
|
-
token: bridgeFee?.token,
|
|
31326
|
+
estimatedAmount: bridgeFees.bridgeFee?.estimatedAmount,
|
|
31327
|
+
token: bridgeFees.bridgeFee?.token,
|
|
31330
31328
|
},
|
|
31331
|
-
bridgeable,
|
|
31329
|
+
bridgeable: bridgeFees.bridgeable,
|
|
31332
31330
|
};
|
|
31333
31331
|
}
|
|
31334
31332
|
catch {
|
|
@@ -31384,7 +31382,7 @@ async function swapGasEstimator(config) {
|
|
|
31384
31382
|
async function gasEstimator(params, readOnlyProviders, config) {
|
|
31385
31383
|
switch (params.gasEstimateType) {
|
|
31386
31384
|
case GasEstimateType.BRIDGE_TO_L2:
|
|
31387
|
-
return await bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired
|
|
31385
|
+
return await bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired);
|
|
31388
31386
|
case GasEstimateType.SWAP:
|
|
31389
31387
|
return await swapGasEstimator(config);
|
|
31390
31388
|
default:
|
|
@@ -34002,7 +34000,7 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
34002
34000
|
return itemRequirements;
|
|
34003
34001
|
}
|
|
34004
34002
|
|
|
34005
|
-
const SDK_VERSION_MARKER = '0.30.
|
|
34003
|
+
const SDK_VERSION_MARKER = '0.30.4';
|
|
34006
34004
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
34007
34005
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
34008
34006
|
|
package/dist/passport.js
CHANGED
|
@@ -2191,7 +2191,7 @@ class MultiRollupApiClients {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
|
|
2193
2193
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2194
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.30.
|
|
2194
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.30.4' };
|
|
2195
2195
|
const createConfig = ({ basePath, headers, }) => {
|
|
2196
2196
|
if (!basePath.trim()) {
|
|
2197
2197
|
throw Error('basePath can not be empty');
|
|
@@ -2247,7 +2247,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2247
2247
|
chainID,
|
|
2248
2248
|
coreContractAddress,
|
|
2249
2249
|
registrationContractAddress,
|
|
2250
|
-
sdkVersion: 'ts-immutable-sdk-0.30.
|
|
2250
|
+
sdkVersion: 'ts-immutable-sdk-0.30.4',
|
|
2251
2251
|
});
|
|
2252
2252
|
/**
|
|
2253
2253
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED