@imtbl/sdk 0.28.4-alpha.2 → 0.28.5
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.js +2 -2
- package/dist/checkout_sdk.d.ts +18 -1
- package/dist/checkout_sdk.js +25 -25
- package/dist/checkout_widgets.d.ts +7 -1
- package/dist/checkout_widgets.js +1 -1
- 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 +95 -46
- package/dist/index.d.ts +19 -1
- package/dist/index.js +96 -47
- package/dist/passport.d.ts +7 -1
- package/dist/passport.js +48 -19
- package/dist/provider.d.ts +7 -0
- package/dist/provider.js +22 -2
- package/package.json +3 -3
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -621,6 +621,15 @@ type ExchangeOverrides = {
|
|
|
621
621
|
wrappedNativeToken: ERC20;
|
|
622
622
|
};
|
|
623
623
|
|
|
624
|
+
/**
|
|
625
|
+
* @typedef {string} Address - Represents an Ethereum address.
|
|
626
|
+
*/
|
|
627
|
+
type Address = string;
|
|
628
|
+
/**
|
|
629
|
+
* @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
|
|
630
|
+
*/
|
|
631
|
+
type FungibleToken = Address | 'NATIVE';
|
|
632
|
+
|
|
624
633
|
// TypeScript Version: 3.0
|
|
625
634
|
|
|
626
635
|
type AxiosRequestHeaders = Record<string, string | number | boolean>;
|
|
@@ -10092,6 +10101,12 @@ interface IMXProvider {
|
|
|
10092
10101
|
* @return {Promise<RegisterUserResponse>} Returns a promise that resolves with the user registration response
|
|
10093
10102
|
*/
|
|
10094
10103
|
registerOffchain(): Promise<RegisterUserResponse>;
|
|
10104
|
+
/**
|
|
10105
|
+
* Checks if a User is registered off-chain
|
|
10106
|
+
*
|
|
10107
|
+
* @return {Promise<boolean>} Returns a promise that resolves with true if the User is registered with IMX, false otherwise
|
|
10108
|
+
*/
|
|
10109
|
+
isRegisteredOffchain(): Promise<boolean>;
|
|
10095
10110
|
/**
|
|
10096
10111
|
* Checks if a User is registered on-chain
|
|
10097
10112
|
*
|
|
@@ -10523,7 +10538,7 @@ type UserProfile = {
|
|
|
10523
10538
|
};
|
|
10524
10539
|
declare enum Networks {
|
|
10525
10540
|
PRODUCTION = "mainnet",
|
|
10526
|
-
SANDBOX = "
|
|
10541
|
+
SANDBOX = "sepolia"
|
|
10527
10542
|
}
|
|
10528
10543
|
interface OidcConfiguration {
|
|
10529
10544
|
clientId: string;
|
|
@@ -11500,10 +11515,12 @@ type GasEstimateParams = GasEstimateBridgeToL2Params | GasEstimateSwapParams;
|
|
|
11500
11515
|
* An interface representing the parameters for estimating gas for a bridge to L2 transaction {@link Checkout.gasEstimate}.
|
|
11501
11516
|
* @param {GasEstimateType.BRIDGE_TO_L2} gasEstimateType - The type of gas estimate.
|
|
11502
11517
|
* @param {boolean} isSpendingCapApprovalRequired - Whether or not spending cap approval is required.
|
|
11518
|
+
* @param {FungibleToken | undefined} tokenAddress - The address of the fungible token to use in the transaction.
|
|
11503
11519
|
*/
|
|
11504
11520
|
interface GasEstimateBridgeToL2Params {
|
|
11505
11521
|
gasEstimateType: GasEstimateType.BRIDGE_TO_L2;
|
|
11506
11522
|
isSpendingCapApprovalRequired: boolean;
|
|
11523
|
+
tokenAddress?: FungibleToken;
|
|
11507
11524
|
}
|
|
11508
11525
|
/**
|
|
11509
11526
|
* An interface representing the parameters for a gas estimate swap {@link Checkout.gasEstimate}.
|
package/dist/checkout_sdk.js
CHANGED
|
@@ -20787,7 +20787,7 @@ class APIError extends Error {
|
|
|
20787
20787
|
|
|
20788
20788
|
/* eslint-disable implicit-arrow-linebreak */
|
|
20789
20789
|
const defaultHeaders = {
|
|
20790
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.
|
|
20790
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.5',
|
|
20791
20791
|
};
|
|
20792
20792
|
/**
|
|
20793
20793
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -22608,39 +22608,39 @@ function $06a6c5c23f7f2479$export$fbbc17f6e6e58544(address, contractInterface, s
|
|
|
22608
22608
|
|
|
22609
22609
|
const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
|
|
22610
22610
|
const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
|
|
22611
|
-
async function $2e7bf45a7c9a9570$var$
|
|
22611
|
+
async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
|
|
22612
|
+
if (tokenAddress === "NATIVE") return config.networkMap.get(chainId)?.nativeCurrency;
|
|
22613
|
+
const contract = new (Contract$1)(tokenAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
|
|
22614
|
+
const name = await contract.name();
|
|
22615
|
+
const symbol = await contract.symbol();
|
|
22616
|
+
const decimals = await contract.decimals();
|
|
22617
|
+
return {
|
|
22618
|
+
name: name,
|
|
22619
|
+
symbol: symbol,
|
|
22620
|
+
decimals: decimals,
|
|
22621
|
+
address: tokenAddress
|
|
22622
|
+
};
|
|
22623
|
+
}
|
|
22624
|
+
async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
|
|
22612
22625
|
const fromChainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
|
|
22613
22626
|
const toChainId = ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config);
|
|
22614
22627
|
const gasEstimateTokensConfig = await config.remote.getConfig("gasEstimateTokens");
|
|
22615
|
-
const { fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
|
|
22628
|
+
const { gasTokenAddress: gasTokenAddress, fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
|
|
22616
22629
|
const provider = readOnlyProviders.get(fromChainId);
|
|
22617
22630
|
if (!provider) throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
|
|
22618
22631
|
try {
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
|
|
22623
|
-
};
|
|
22624
|
-
let bridgeFees = {
|
|
22625
|
-
bridgeFee: {},
|
|
22626
|
-
bridgeable: false
|
|
22627
|
-
};
|
|
22628
|
-
const getBridgeFees = async ()=>{
|
|
22629
|
-
const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
|
|
22630
|
-
bridgeFees = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
|
|
22631
|
-
};
|
|
22632
|
-
await Promise.all([
|
|
22633
|
-
getGasFees(),
|
|
22634
|
-
getBridgeFees()
|
|
22635
|
-
]);
|
|
22632
|
+
const gasFee = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, isSpendingCapApprovalRequired);
|
|
22633
|
+
gasFee.token = await $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress ?? (gasTokenAddress || "NATIVE"), fromChainId, provider);
|
|
22634
|
+
const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
|
|
22635
|
+
const { bridgeFee: bridgeFee, bridgeable: bridgeable } = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
|
|
22636
22636
|
return {
|
|
22637
22637
|
gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
|
|
22638
|
-
gasFee:
|
|
22638
|
+
gasFee: gasFee,
|
|
22639
22639
|
bridgeFee: {
|
|
22640
|
-
estimatedAmount:
|
|
22641
|
-
token:
|
|
22640
|
+
estimatedAmount: bridgeFee?.estimatedAmount,
|
|
22641
|
+
token: bridgeFee?.token
|
|
22642
22642
|
},
|
|
22643
|
-
bridgeable:
|
|
22643
|
+
bridgeable: bridgeable
|
|
22644
22644
|
};
|
|
22645
22645
|
} catch {
|
|
22646
22646
|
// In the case of an error, just return an empty gas & bridge fee estimate
|
|
@@ -22689,7 +22689,7 @@ async function $2e7bf45a7c9a9570$var$swapGasEstimator(config) {
|
|
|
22689
22689
|
async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProviders, config) {
|
|
22690
22690
|
switch(params.gasEstimateType){
|
|
22691
22691
|
case ($de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2:
|
|
22692
|
-
return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired);
|
|
22692
|
+
return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired, params.tokenAddress);
|
|
22693
22693
|
case ($de275b98d2b651c3$export$788b1fd17f3dad84).SWAP:
|
|
22694
22694
|
return await $2e7bf45a7c9a9570$var$swapGasEstimator(config);
|
|
22695
22695
|
default:
|
|
@@ -10039,6 +10039,12 @@ interface IMXProvider {
|
|
|
10039
10039
|
* @return {Promise<RegisterUserResponse>} Returns a promise that resolves with the user registration response
|
|
10040
10040
|
*/
|
|
10041
10041
|
registerOffchain(): Promise<RegisterUserResponse>;
|
|
10042
|
+
/**
|
|
10043
|
+
* Checks if a User is registered off-chain
|
|
10044
|
+
*
|
|
10045
|
+
* @return {Promise<boolean>} Returns a promise that resolves with true if the User is registered with IMX, false otherwise
|
|
10046
|
+
*/
|
|
10047
|
+
isRegisteredOffchain(): Promise<boolean>;
|
|
10042
10048
|
/**
|
|
10043
10049
|
* Checks if a User is registered on-chain
|
|
10044
10050
|
*
|
|
@@ -10470,7 +10476,7 @@ type UserProfile = {
|
|
|
10470
10476
|
};
|
|
10471
10477
|
declare enum Networks {
|
|
10472
10478
|
PRODUCTION = "mainnet",
|
|
10473
|
-
SANDBOX = "
|
|
10479
|
+
SANDBOX = "sepolia"
|
|
10474
10480
|
}
|
|
10475
10481
|
interface OidcConfiguration {
|
|
10476
10482
|
clientId: string;
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -25,7 +25,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
25
25
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.
|
|
28
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.5";
|
|
29
29
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30
30
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
31
31
|
|
|
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
17
17
|
chainID,
|
|
18
18
|
coreContractAddress,
|
|
19
19
|
registrationContractAddress,
|
|
20
|
-
sdkVersion: 'ts-immutable-sdk-0.28.
|
|
20
|
+
sdkVersion: 'ts-immutable-sdk-0.28.5',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|