@imtbl/sdk 0.36.2 → 0.36.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.d.ts +138 -57
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +58 -58
- package/dist/checkout.d.ts +55 -11
- package/dist/checkout.js +216 -87
- 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 +218 -88
- package/dist/index.d.ts +197 -67
- package/dist/index.js +218 -88
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout.d.ts
CHANGED
|
@@ -10644,12 +10644,12 @@ declare enum ChainId {
|
|
|
10644
10644
|
}
|
|
10645
10645
|
/**
|
|
10646
10646
|
* Enum representing different chain names.
|
|
10647
|
-
* @enum {
|
|
10648
|
-
* @property {
|
|
10649
|
-
* @property {
|
|
10650
|
-
* @property {
|
|
10651
|
-
* @property {
|
|
10652
|
-
* @property {
|
|
10647
|
+
* @enum {string}
|
|
10648
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain name for IMTBL ZKEVM Mainnet.
|
|
10649
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain name for IMTBL ZKEVM Testnet.
|
|
10650
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain name for IMTBL ZKEVM Devnet.
|
|
10651
|
+
* @property {string} ETHEREUM - The chain name for Ethereum.
|
|
10652
|
+
* @property {string} SEPOLIA - The chain name for Sepolia.
|
|
10653
10653
|
*/
|
|
10654
10654
|
declare enum ChainName {
|
|
10655
10655
|
ETHEREUM = "Ethereum",
|
|
@@ -10658,6 +10658,22 @@ declare enum ChainName {
|
|
|
10658
10658
|
IMTBL_ZKEVM_DEVNET = "Immutable zkEVM Dev",
|
|
10659
10659
|
IMTBL_ZKEVM_MAINNET = "Immutable zkEVM"
|
|
10660
10660
|
}
|
|
10661
|
+
/**
|
|
10662
|
+
* Enum representing different chain slugs.
|
|
10663
|
+
* @enum {string}
|
|
10664
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain slug for IMTBL ZKEVM Mainnet.
|
|
10665
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain slug for IMTBL ZKEVM Testnet.
|
|
10666
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain slug for IMTBL ZKEVM Devnet.
|
|
10667
|
+
* @property {string} ETHEREUM - The chain slug for Ethereum.
|
|
10668
|
+
* @property {string} SEPOLIA - The chain slug for Sepolia.
|
|
10669
|
+
*/
|
|
10670
|
+
declare enum ChainSlug {
|
|
10671
|
+
ETHEREUM = "ethereum",
|
|
10672
|
+
SEPOLIA = "sepolia",
|
|
10673
|
+
IMTBL_ZKEVM_MAINNET = "imtbl-zkevm-mainnet",
|
|
10674
|
+
IMTBL_ZKEVM_TESTNET = "imtbl-zkevm-testnet",
|
|
10675
|
+
IMTBL_ZKEVM_DEVNET = "imtbl-zkevm-devnet"
|
|
10676
|
+
}
|
|
10661
10677
|
|
|
10662
10678
|
/**
|
|
10663
10679
|
* Represents information about a token.
|
|
@@ -10675,6 +10691,15 @@ interface TokenInfo {
|
|
|
10675
10691
|
address?: string;
|
|
10676
10692
|
icon?: string;
|
|
10677
10693
|
}
|
|
10694
|
+
/**
|
|
10695
|
+
* Interface representing the parameters for {@link Checkout.getTokenInfo}.
|
|
10696
|
+
* @property {Web3Provider | JsonRpcProvider} provider - The provider used to get the balance.
|
|
10697
|
+
* @property {string} tokenAddress - The contract address of the token.
|
|
10698
|
+
*/
|
|
10699
|
+
interface GetTokenInfoParams {
|
|
10700
|
+
provider: Web3Provider | JsonRpcProvider;
|
|
10701
|
+
tokenAddress: string;
|
|
10702
|
+
}
|
|
10678
10703
|
|
|
10679
10704
|
/**
|
|
10680
10705
|
* Interface representing the parameters for {@link Checkout.getBalance}.
|
|
@@ -10700,13 +10725,13 @@ interface GetBalanceResult {
|
|
|
10700
10725
|
}
|
|
10701
10726
|
/**
|
|
10702
10727
|
* Interface representing the parameters for {@link Checkout.getAllBalances}.
|
|
10703
|
-
* @property {Web3Provider} provider - The provider used to get the balances.
|
|
10704
|
-
* @property {string} walletAddress - The wallet address.
|
|
10728
|
+
* @property {Web3Provider} provider - The provider used to get the balances, it is a required parameter if no walletAddress is provided.
|
|
10729
|
+
* @property {string} walletAddress - The wallet address, it is a required parameter if no provider is provided.
|
|
10705
10730
|
* @property {ChainId} chainId - The ID of the network.
|
|
10706
10731
|
*/
|
|
10707
10732
|
interface GetAllBalancesParams {
|
|
10708
|
-
provider
|
|
10709
|
-
walletAddress
|
|
10733
|
+
provider?: Web3Provider;
|
|
10734
|
+
walletAddress?: string;
|
|
10710
10735
|
chainId: ChainId;
|
|
10711
10736
|
}
|
|
10712
10737
|
/**
|
|
@@ -11503,6 +11528,7 @@ interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverri
|
|
|
11503
11528
|
* @property {AllowedNetworkConfig[]} allowedNetworks
|
|
11504
11529
|
* @property {GasEstimateTokenConfig | undefined} gasEstimateTokens
|
|
11505
11530
|
* @property {ImxAddressConfig | undefined} imxAddressMapping
|
|
11531
|
+
* @property {TelemetryConfig | undefined} telemetry
|
|
11506
11532
|
*/
|
|
11507
11533
|
type RemoteConfiguration = {
|
|
11508
11534
|
/** The config used for the DEX. */
|
|
@@ -11517,6 +11543,8 @@ type RemoteConfiguration = {
|
|
|
11517
11543
|
gasEstimateTokens?: GasEstimateTokenConfig;
|
|
11518
11544
|
/** The IMX address mappings across available networks. */
|
|
11519
11545
|
imxAddressMapping?: ImxAddressConfig;
|
|
11546
|
+
/** Telemetry config. */
|
|
11547
|
+
telemetry?: TelemetryConfig;
|
|
11520
11548
|
};
|
|
11521
11549
|
/**
|
|
11522
11550
|
* A type representing the fee structure for an OnRamp provider
|
|
@@ -11588,6 +11616,13 @@ type AllowedNetworkConfig = {
|
|
|
11588
11616
|
type ImxAddressConfig = {
|
|
11589
11617
|
[chainId: string]: string;
|
|
11590
11618
|
};
|
|
11619
|
+
/**
|
|
11620
|
+
* A type representing the telemetry configurations.
|
|
11621
|
+
* @property {string} publishableApiKey
|
|
11622
|
+
*/
|
|
11623
|
+
type TelemetryConfig = {
|
|
11624
|
+
publishableApiKey: string;
|
|
11625
|
+
};
|
|
11591
11626
|
/**
|
|
11592
11627
|
* A type representing the required information to estimate gas for a transaction.
|
|
11593
11628
|
* @type {{ [key: string]: { bridgeToL2Addresses?: GasEstimateBridgeToL2TokenConfig, swapAddresses?: GasEstimateSwapTokenConfig } }}
|
|
@@ -12756,6 +12791,13 @@ declare class Checkout {
|
|
|
12756
12791
|
* @returns {Promise<SwitchNetworkResult>} - A promise that resolves to the result of switching the network.
|
|
12757
12792
|
*/
|
|
12758
12793
|
switchNetwork(params: SwitchNetworkParams): Promise<SwitchNetworkResult>;
|
|
12794
|
+
/**
|
|
12795
|
+
* Retrieves the token information given the token address. This function makes RPC calls to
|
|
12796
|
+
* ERC20 contracts to fetch the main contract information (e.g. symbol).
|
|
12797
|
+
* @param {GetTokenInfoParams} params - The parameters for retrieving the token information.
|
|
12798
|
+
* @returns {Promise<TokenInfo>} - A promise that resolves to the token info request.
|
|
12799
|
+
*/
|
|
12800
|
+
getTokenInfo(params: GetTokenInfoParams): Promise<TokenInfo>;
|
|
12759
12801
|
/**
|
|
12760
12802
|
* Retrieves the balance of a wallet address.
|
|
12761
12803
|
* @param {GetBalanceParams} params - The parameters for retrieving the balance.
|
|
@@ -12929,12 +12971,14 @@ declare const IMMUTABLE_API_BASE_URL: {
|
|
|
12929
12971
|
* Enum representing different types of errors that can occur during the checkout process.
|
|
12930
12972
|
*/
|
|
12931
12973
|
declare enum CheckoutErrorType {
|
|
12974
|
+
MISSING_PARAMS = "MISSING_PARAMS",
|
|
12932
12975
|
WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
|
|
12933
12976
|
PROVIDER_ERROR = "PROVIDER_ERROR",
|
|
12934
12977
|
DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
|
|
12935
12978
|
CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
|
|
12936
12979
|
GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
|
|
12937
12980
|
GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
|
|
12981
|
+
GET_ERC20_INFO_ERROR = "GET_ERC20_INFO_ERROR",
|
|
12938
12982
|
GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
|
|
12939
12983
|
GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
|
|
12940
12984
|
GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
|
|
@@ -12984,4 +13028,4 @@ type ErrorType = {
|
|
|
12984
13028
|
};
|
|
12985
13029
|
};
|
|
12986
13030
|
|
|
12987
|
-
export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeEventType, BridgeFailed, BridgeFundingStep, BridgeTransactionSent, BridgeWidgetConfiguration, BridgeWidgetParams, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutBridgeConfiguration, CheckoutConfiguration, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutOnRampConfiguration, CheckoutStatus, CheckoutSwapConfiguration, CheckoutWidgetsConfig, ConnectEventType, ConnectParams, ConnectResult, ConnectTargetLayer, ConnectWidgetConfiguration, ConnectWidgetParams, ConnectionFailed, ConnectionSuccess, CreateProviderParams, CreateProviderResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, Fee, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, IWidgetsFactory, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampEventType, OnRampFailed, OnRampFundingStep, OnRampProviderFees, OnRampSuccess, OnRampWidgetParams, OnrampWidgetConfiguration, OrchestrationEvent, OrchestrationEventData, OrchestrationEventType, OrderFee, ProviderEvent, ProviderEventType, ProviderUpdated, RemoteConfiguration, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, RoutesFound, RoutingOutcome, RoutingOutcomeType, SaleEventType, SaleFailed, SaleItem, SaleSuccess, SaleTransactionSuccess, SaleWidgetConfiguration, SaleWidgetParams, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SemanticVersion, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapEventType, SwapFailed, SwapFundingStep, SwapRejected, SwapSuccess, SwapWidgetConfiguration, SwapWidgetParams, SwitchNetworkParams, SwitchNetworkResult, TokenAmountEstimate, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletDisconnect, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitch, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };
|
|
13031
|
+
export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeEventType, BridgeFailed, BridgeFundingStep, BridgeTransactionSent, BridgeWidgetConfiguration, BridgeWidgetParams, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, ChainSlug, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutBridgeConfiguration, CheckoutConfiguration, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutOnRampConfiguration, CheckoutStatus, CheckoutSwapConfiguration, CheckoutWidgetsConfig, ConnectEventType, ConnectParams, ConnectResult, ConnectTargetLayer, ConnectWidgetConfiguration, ConnectWidgetParams, ConnectionFailed, ConnectionSuccess, CreateProviderParams, CreateProviderResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, Fee, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetTokenInfoParams, GetWalletAllowListParams, GetWalletAllowListResult, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, IWidgetsFactory, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampEventType, OnRampFailed, OnRampFundingStep, OnRampProviderFees, OnRampSuccess, OnRampWidgetParams, OnrampWidgetConfiguration, OrchestrationEvent, OrchestrationEventData, OrchestrationEventType, OrderFee, ProviderEvent, ProviderEventType, ProviderUpdated, RemoteConfiguration, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, RoutesFound, RoutingOutcome, RoutingOutcomeType, SaleEventType, SaleFailed, SaleItem, SaleSuccess, SaleTransactionSuccess, SaleWidgetConfiguration, SaleWidgetParams, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SemanticVersion, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapEventType, SwapFailed, SwapFundingStep, SwapRejected, SwapSuccess, SwapWidgetConfiguration, SwapWidgetParams, SwitchNetworkParams, SwitchNetworkResult, TokenAmountEstimate, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletDisconnect, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitch, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };
|
package/dist/checkout.js
CHANGED
|
@@ -12519,59 +12519,18 @@ function parseUnits(value, unitName) {
|
|
|
12519
12519
|
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
12520
12520
|
}
|
|
12521
12521
|
|
|
12522
|
-
/**
|
|
12523
|
-
* @typedef {Object} CompletionStatus
|
|
12524
|
-
* @property {string} SUCCESS - The transaction has been successfully synced.
|
|
12525
|
-
* @property {string} PENDING - The transaction is still pending.
|
|
12526
|
-
* @property {string} FAILED - The transaction has failed.
|
|
12527
|
-
*/
|
|
12528
|
-
var CompletionStatus;
|
|
12529
|
-
(function (CompletionStatus) {
|
|
12530
|
-
CompletionStatus["SUCCESS"] = "SUCCESS";
|
|
12531
|
-
CompletionStatus["PENDING"] = "PENDING";
|
|
12532
|
-
CompletionStatus["FAILED"] = "FAILED";
|
|
12533
|
-
})(CompletionStatus || (CompletionStatus = {}));
|
|
12534
|
-
/**
|
|
12535
|
-
* @typedef {Object} BridgeFeeActions
|
|
12536
|
-
* @property {string} DEPOSIT - The transaction has been successfully synced.
|
|
12537
|
-
* @property {string} WITHDRAW - The transaction is still pending.
|
|
12538
|
-
* @property {string} FINALISE_WITHDRAWAL - Calculate gas .
|
|
12539
|
-
*/
|
|
12540
|
-
var BridgeFeeActions;
|
|
12541
|
-
(function (BridgeFeeActions) {
|
|
12542
|
-
BridgeFeeActions["DEPOSIT"] = "DEPOSIT";
|
|
12543
|
-
BridgeFeeActions["WITHDRAW"] = "WITHDRAW";
|
|
12544
|
-
BridgeFeeActions["FINALISE_WITHDRAWAL"] = "FINALISE_WITHDRAWAL";
|
|
12545
|
-
})(BridgeFeeActions || (BridgeFeeActions = {}));
|
|
12546
|
-
/**
|
|
12547
|
-
* @typedef {Object} BridgeMethodGas
|
|
12548
|
-
* @property {string} DEPOSIT_SOURCE - The gas required to deposit to the bridge.
|
|
12549
|
-
* @property {string} DEPOSIT_DESTINATION - The gas required to process the deposit on the destination chain.
|
|
12550
|
-
* @property {string} WITHDRAW_SOURCE - The gas required to withdraw from the bridge.
|
|
12551
|
-
* @property {string} WITHDRAW_DESTINATION - The gas required to process the withdrawal on the destination chain.
|
|
12552
|
-
* @property {string} FINALISE_WITHDRAWAL - The gas required to finalise a withdrawal from the flow rate queue.
|
|
12553
|
-
*/
|
|
12554
|
-
var BridgeMethodsGasLimit;
|
|
12555
|
-
(function (BridgeMethodsGasLimit) {
|
|
12556
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 500000] = "DEPOSIT_SOURCE";
|
|
12557
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 700000] = "DEPOSIT_DESTINATION";
|
|
12558
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 400000] = "WITHDRAW_SOURCE";
|
|
12559
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 700000] = "WITHDRAW_DESTINATION";
|
|
12560
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 300000] = "MAP_TOKEN_SOURCE";
|
|
12561
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 700000] = "MAP_TOKEN_DESTINATION";
|
|
12562
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["FINALISE_WITHDRAWAL"] = 200000] = "FINALISE_WITHDRAWAL";
|
|
12563
|
-
})(BridgeMethodsGasLimit || (BridgeMethodsGasLimit = {}));
|
|
12564
|
-
var StatusResponse;
|
|
12565
|
-
(function (StatusResponse) {
|
|
12566
|
-
StatusResponse["PROCESSING"] = "PROCESSING";
|
|
12567
|
-
StatusResponse["COMPLETE"] = "COMPLETE";
|
|
12568
|
-
StatusResponse["RETRY"] = "RETRY";
|
|
12569
|
-
StatusResponse["ERROR"] = "ERROR";
|
|
12570
|
-
StatusResponse["NOT_ENOUGH_GAS"] = "NOT_ENOUGH_GAS";
|
|
12571
|
-
StatusResponse["FLOW_RATE_CONTROLLED"] = "FLOW_RATE_CONTROLLED";
|
|
12572
|
-
})(StatusResponse || (StatusResponse = {}));
|
|
12573
|
-
|
|
12574
12522
|
const ROOT_ERC20_BRIDGE_FLOW_RATE = [
|
|
12523
|
+
{
|
|
12524
|
+
inputs: [
|
|
12525
|
+
{
|
|
12526
|
+
internalType: 'address',
|
|
12527
|
+
name: '_initializerAddress',
|
|
12528
|
+
type: 'address',
|
|
12529
|
+
},
|
|
12530
|
+
],
|
|
12531
|
+
stateMutability: 'nonpayable',
|
|
12532
|
+
type: 'constructor',
|
|
12533
|
+
},
|
|
12575
12534
|
{
|
|
12576
12535
|
inputs: [],
|
|
12577
12536
|
name: 'AlreadyMapped',
|
|
@@ -12722,6 +12681,16 @@ const ROOT_ERC20_BRIDGE_FLOW_RATE = [
|
|
|
12722
12681
|
name: 'TokenIsZero',
|
|
12723
12682
|
type: 'error',
|
|
12724
12683
|
},
|
|
12684
|
+
{
|
|
12685
|
+
inputs: [],
|
|
12686
|
+
name: 'TokenNotSupported',
|
|
12687
|
+
type: 'error',
|
|
12688
|
+
},
|
|
12689
|
+
{
|
|
12690
|
+
inputs: [],
|
|
12691
|
+
name: 'UnauthorizedInitializer',
|
|
12692
|
+
type: 'error',
|
|
12693
|
+
},
|
|
12725
12694
|
{
|
|
12726
12695
|
inputs: [
|
|
12727
12696
|
{
|
|
@@ -14145,6 +14114,19 @@ const ROOT_ERC20_BRIDGE_FLOW_RATE = [
|
|
|
14145
14114
|
stateMutability: 'pure',
|
|
14146
14115
|
type: 'function',
|
|
14147
14116
|
},
|
|
14117
|
+
{
|
|
14118
|
+
inputs: [],
|
|
14119
|
+
name: 'initializerAddress',
|
|
14120
|
+
outputs: [
|
|
14121
|
+
{
|
|
14122
|
+
internalType: 'address',
|
|
14123
|
+
name: '',
|
|
14124
|
+
type: 'address',
|
|
14125
|
+
},
|
|
14126
|
+
],
|
|
14127
|
+
stateMutability: 'view',
|
|
14128
|
+
type: 'function',
|
|
14129
|
+
},
|
|
14148
14130
|
{
|
|
14149
14131
|
inputs: [
|
|
14150
14132
|
{
|
|
@@ -14841,6 +14823,17 @@ const withBridgeError = async (fn, customErrorType, details) => {
|
|
|
14841
14823
|
};
|
|
14842
14824
|
|
|
14843
14825
|
const CHILD_ERC20_BRIDGE = [
|
|
14826
|
+
{
|
|
14827
|
+
inputs: [
|
|
14828
|
+
{
|
|
14829
|
+
internalType: 'address',
|
|
14830
|
+
name: '_initializerAddress',
|
|
14831
|
+
type: 'address',
|
|
14832
|
+
},
|
|
14833
|
+
],
|
|
14834
|
+
stateMutability: 'nonpayable',
|
|
14835
|
+
type: 'constructor',
|
|
14836
|
+
},
|
|
14844
14837
|
{
|
|
14845
14838
|
inputs: [],
|
|
14846
14839
|
name: 'AlreadyMapped',
|
|
@@ -14943,6 +14936,11 @@ const CHILD_ERC20_BRIDGE = [
|
|
|
14943
14936
|
name: 'TransferWIMXFailed',
|
|
14944
14937
|
type: 'error',
|
|
14945
14938
|
},
|
|
14939
|
+
{
|
|
14940
|
+
inputs: [],
|
|
14941
|
+
name: 'UnauthorizedInitializer',
|
|
14942
|
+
type: 'error',
|
|
14943
|
+
},
|
|
14946
14944
|
{
|
|
14947
14945
|
inputs: [],
|
|
14948
14946
|
name: 'ZeroAddress',
|
|
@@ -15697,6 +15695,19 @@ const CHILD_ERC20_BRIDGE = [
|
|
|
15697
15695
|
stateMutability: 'nonpayable',
|
|
15698
15696
|
type: 'function',
|
|
15699
15697
|
},
|
|
15698
|
+
{
|
|
15699
|
+
inputs: [],
|
|
15700
|
+
name: 'initializerAddress',
|
|
15701
|
+
outputs: [
|
|
15702
|
+
{
|
|
15703
|
+
internalType: 'address',
|
|
15704
|
+
name: '',
|
|
15705
|
+
type: 'address',
|
|
15706
|
+
},
|
|
15707
|
+
],
|
|
15708
|
+
stateMutability: 'view',
|
|
15709
|
+
type: 'function',
|
|
15710
|
+
},
|
|
15700
15711
|
{
|
|
15701
15712
|
inputs: [
|
|
15702
15713
|
{
|
|
@@ -16046,6 +16057,58 @@ const getGasPriceInWei$1 = (feeData) => {
|
|
|
16046
16057
|
return null;
|
|
16047
16058
|
};
|
|
16048
16059
|
|
|
16060
|
+
/**
|
|
16061
|
+
* @typedef {Object} CompletionStatus
|
|
16062
|
+
* @property {string} SUCCESS - The transaction has been successfully synced.
|
|
16063
|
+
* @property {string} PENDING - The transaction is still pending.
|
|
16064
|
+
* @property {string} FAILED - The transaction has failed.
|
|
16065
|
+
*/
|
|
16066
|
+
var CompletionStatus;
|
|
16067
|
+
(function (CompletionStatus) {
|
|
16068
|
+
CompletionStatus["SUCCESS"] = "SUCCESS";
|
|
16069
|
+
CompletionStatus["PENDING"] = "PENDING";
|
|
16070
|
+
CompletionStatus["FAILED"] = "FAILED";
|
|
16071
|
+
})(CompletionStatus || (CompletionStatus = {}));
|
|
16072
|
+
/**
|
|
16073
|
+
* @typedef {Object} BridgeFeeActions
|
|
16074
|
+
* @property {string} DEPOSIT - The transaction has been successfully synced.
|
|
16075
|
+
* @property {string} WITHDRAW - The transaction is still pending.
|
|
16076
|
+
* @property {string} FINALISE_WITHDRAWAL - Calculate gas .
|
|
16077
|
+
*/
|
|
16078
|
+
var BridgeFeeActions;
|
|
16079
|
+
(function (BridgeFeeActions) {
|
|
16080
|
+
BridgeFeeActions["DEPOSIT"] = "DEPOSIT";
|
|
16081
|
+
BridgeFeeActions["WITHDRAW"] = "WITHDRAW";
|
|
16082
|
+
BridgeFeeActions["FINALISE_WITHDRAWAL"] = "FINALISE_WITHDRAWAL";
|
|
16083
|
+
})(BridgeFeeActions || (BridgeFeeActions = {}));
|
|
16084
|
+
/**
|
|
16085
|
+
* @typedef {Object} BridgeMethodGas
|
|
16086
|
+
* @property {string} DEPOSIT_SOURCE - The gas required to deposit to the bridge.
|
|
16087
|
+
* @property {string} DEPOSIT_DESTINATION - The gas required to process the deposit on the destination chain.
|
|
16088
|
+
* @property {string} WITHDRAW_SOURCE - The gas required to withdraw from the bridge.
|
|
16089
|
+
* @property {string} WITHDRAW_DESTINATION - The gas required to process the withdrawal on the destination chain.
|
|
16090
|
+
* @property {string} FINALISE_WITHDRAWAL - The gas required to finalise a withdrawal from the flow rate queue.
|
|
16091
|
+
*/
|
|
16092
|
+
var BridgeMethodsGasLimit;
|
|
16093
|
+
(function (BridgeMethodsGasLimit) {
|
|
16094
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 500000] = "DEPOSIT_SOURCE";
|
|
16095
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 700000] = "DEPOSIT_DESTINATION";
|
|
16096
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 400000] = "WITHDRAW_SOURCE";
|
|
16097
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 700000] = "WITHDRAW_DESTINATION";
|
|
16098
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 300000] = "MAP_TOKEN_SOURCE";
|
|
16099
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 700000] = "MAP_TOKEN_DESTINATION";
|
|
16100
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["FINALISE_WITHDRAWAL"] = 200000] = "FINALISE_WITHDRAWAL";
|
|
16101
|
+
})(BridgeMethodsGasLimit || (BridgeMethodsGasLimit = {}));
|
|
16102
|
+
var StatusResponse;
|
|
16103
|
+
(function (StatusResponse) {
|
|
16104
|
+
StatusResponse["PROCESSING"] = "PROCESSING";
|
|
16105
|
+
StatusResponse["COMPLETE"] = "COMPLETE";
|
|
16106
|
+
StatusResponse["RETRY"] = "RETRY";
|
|
16107
|
+
StatusResponse["ERROR"] = "ERROR";
|
|
16108
|
+
StatusResponse["NOT_ENOUGH_GAS"] = "NOT_ENOUGH_GAS";
|
|
16109
|
+
StatusResponse["FLOW_RATE_CONTROLLED"] = "FLOW_RATE_CONTROLLED";
|
|
16110
|
+
})(StatusResponse || (StatusResponse = {}));
|
|
16111
|
+
|
|
16049
16112
|
/* eslint-disable class-methods-use-this */
|
|
16050
16113
|
/**
|
|
16051
16114
|
* Represents a token bridge, which manages asset transfers between two chains.
|
|
@@ -16666,8 +16729,8 @@ const CONTRACTS_FOR_BRIDGE = new Map()
|
|
|
16666
16729
|
wrappedIMX: '0x0',
|
|
16667
16730
|
})
|
|
16668
16731
|
.set(ETH_SEPOLIA_TO_ZKEVM_TESTNET, {
|
|
16669
|
-
rootERC20BridgeFlowRate: '
|
|
16670
|
-
childERC20Bridge: '
|
|
16732
|
+
rootERC20BridgeFlowRate: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
16733
|
+
childERC20Bridge: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
16671
16734
|
wrappedIMX: '0xa86C6C6d3D51c0592BE85dA05A9b06B62360D56E',
|
|
16672
16735
|
})
|
|
16673
16736
|
.set(ETH_MAINNET_TO_ZKEVM_MAINNET, {
|
|
@@ -25770,7 +25833,7 @@ class APIError extends Error {
|
|
|
25770
25833
|
|
|
25771
25834
|
/* eslint-disable implicit-arrow-linebreak */
|
|
25772
25835
|
const defaultHeaders = {
|
|
25773
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.
|
|
25836
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.4',
|
|
25774
25837
|
};
|
|
25775
25838
|
/**
|
|
25776
25839
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -26330,12 +26393,12 @@ var ChainId;
|
|
|
26330
26393
|
})(ChainId || (ChainId = {}));
|
|
26331
26394
|
/**
|
|
26332
26395
|
* Enum representing different chain names.
|
|
26333
|
-
* @enum {
|
|
26334
|
-
* @property {
|
|
26335
|
-
* @property {
|
|
26336
|
-
* @property {
|
|
26337
|
-
* @property {
|
|
26338
|
-
* @property {
|
|
26396
|
+
* @enum {string}
|
|
26397
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain name for IMTBL ZKEVM Mainnet.
|
|
26398
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain name for IMTBL ZKEVM Testnet.
|
|
26399
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain name for IMTBL ZKEVM Devnet.
|
|
26400
|
+
* @property {string} ETHEREUM - The chain name for Ethereum.
|
|
26401
|
+
* @property {string} SEPOLIA - The chain name for Sepolia.
|
|
26339
26402
|
*/
|
|
26340
26403
|
var ChainName;
|
|
26341
26404
|
(function (ChainName) {
|
|
@@ -26345,6 +26408,23 @@ var ChainName;
|
|
|
26345
26408
|
ChainName["IMTBL_ZKEVM_DEVNET"] = "Immutable zkEVM Dev";
|
|
26346
26409
|
ChainName["IMTBL_ZKEVM_MAINNET"] = "Immutable zkEVM";
|
|
26347
26410
|
})(ChainName || (ChainName = {}));
|
|
26411
|
+
/**
|
|
26412
|
+
* Enum representing different chain slugs.
|
|
26413
|
+
* @enum {string}
|
|
26414
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain slug for IMTBL ZKEVM Mainnet.
|
|
26415
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain slug for IMTBL ZKEVM Testnet.
|
|
26416
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain slug for IMTBL ZKEVM Devnet.
|
|
26417
|
+
* @property {string} ETHEREUM - The chain slug for Ethereum.
|
|
26418
|
+
* @property {string} SEPOLIA - The chain slug for Sepolia.
|
|
26419
|
+
*/
|
|
26420
|
+
var ChainSlug;
|
|
26421
|
+
(function (ChainSlug) {
|
|
26422
|
+
ChainSlug["ETHEREUM"] = "ethereum";
|
|
26423
|
+
ChainSlug["SEPOLIA"] = "sepolia";
|
|
26424
|
+
ChainSlug["IMTBL_ZKEVM_MAINNET"] = "imtbl-zkevm-mainnet";
|
|
26425
|
+
ChainSlug["IMTBL_ZKEVM_TESTNET"] = "imtbl-zkevm-testnet";
|
|
26426
|
+
ChainSlug["IMTBL_ZKEVM_DEVNET"] = "imtbl-zkevm-devnet";
|
|
26427
|
+
})(ChainSlug || (ChainSlug = {}));
|
|
26348
26428
|
|
|
26349
26429
|
var OnRampProvider;
|
|
26350
26430
|
(function (OnRampProvider) {
|
|
@@ -26502,12 +26582,14 @@ var ExchangeType;
|
|
|
26502
26582
|
*/
|
|
26503
26583
|
var CheckoutErrorType;
|
|
26504
26584
|
(function (CheckoutErrorType) {
|
|
26585
|
+
CheckoutErrorType["MISSING_PARAMS"] = "MISSING_PARAMS";
|
|
26505
26586
|
CheckoutErrorType["WEB3_PROVIDER_ERROR"] = "WEB3_PROVIDER_ERROR";
|
|
26506
26587
|
CheckoutErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
|
|
26507
26588
|
CheckoutErrorType["DEFAULT_PROVIDER_ERROR"] = "DEFAULT_PROVIDER_ERROR";
|
|
26508
26589
|
CheckoutErrorType["CONNECT_PROVIDER_ERROR"] = "CONNECT_PROVIDER_ERROR";
|
|
26509
26590
|
CheckoutErrorType["GET_BALANCE_ERROR"] = "GET_BALANCE_ERROR";
|
|
26510
26591
|
CheckoutErrorType["GET_INDEXER_BALANCE_ERROR"] = "GET_INDEXER_BALANCE_ERROR";
|
|
26592
|
+
CheckoutErrorType["GET_ERC20_INFO_ERROR"] = "GET_ERC20_INFO_ERROR";
|
|
26511
26593
|
CheckoutErrorType["GET_ERC20_BALANCE_ERROR"] = "GET_ERC20_BALANCE_ERROR";
|
|
26512
26594
|
CheckoutErrorType["GET_ERC721_BALANCE_ERROR"] = "GET_ERC721_BALANCE_ERROR";
|
|
26513
26595
|
CheckoutErrorType["GET_NETWORK_INFO_ERROR"] = "GET_NETWORK_INFO_ERROR";
|
|
@@ -26863,7 +26945,7 @@ const BLOCKSCOUT_CHAIN_URL_MAP = {
|
|
|
26863
26945
|
nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
|
|
26864
26946
|
},
|
|
26865
26947
|
[ChainId.IMTBL_ZKEVM_MAINNET]: {
|
|
26866
|
-
url: 'https://explorer.
|
|
26948
|
+
url: 'https://explorer.immutable.com',
|
|
26867
26949
|
nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
|
|
26868
26950
|
},
|
|
26869
26951
|
[ChainId.SEPOLIA]: {
|
|
@@ -27075,7 +27157,7 @@ const GAS_OVERRIDES = {
|
|
|
27075
27157
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
27076
27158
|
};
|
|
27077
27159
|
|
|
27078
|
-
const SDK_VERSION_MARKER = '0.36.
|
|
27160
|
+
const SDK_VERSION_MARKER = '0.36.4';
|
|
27079
27161
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
27080
27162
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
27081
27163
|
|
|
@@ -27236,6 +27318,22 @@ const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId,
|
|
|
27236
27318
|
};
|
|
27237
27319
|
};
|
|
27238
27320
|
const isNativeToken = (address) => !address || address.toLocaleLowerCase() === NATIVE;
|
|
27321
|
+
async function getERC20TokenInfo(web3Provider, tokenAddress) {
|
|
27322
|
+
return await withCheckoutError(async () => {
|
|
27323
|
+
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
27324
|
+
const [name, symbol, decimals] = await Promise.all([
|
|
27325
|
+
contract.name(),
|
|
27326
|
+
contract.symbol(),
|
|
27327
|
+
contract.decimals(),
|
|
27328
|
+
]);
|
|
27329
|
+
return {
|
|
27330
|
+
name,
|
|
27331
|
+
symbol,
|
|
27332
|
+
decimals,
|
|
27333
|
+
address: tokenAddress,
|
|
27334
|
+
};
|
|
27335
|
+
}, { type: CheckoutErrorType.GET_ERC20_INFO_ERROR });
|
|
27336
|
+
}
|
|
27239
27337
|
|
|
27240
27338
|
const CACHE_DATA_TTL = 60; // seconds
|
|
27241
27339
|
/**
|
|
@@ -27406,20 +27504,18 @@ async function getERC20Balance(web3Provider, walletAddress, tokenAddress) {
|
|
|
27406
27504
|
return await withCheckoutError(async () => {
|
|
27407
27505
|
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
27408
27506
|
return Promise.all([
|
|
27409
|
-
|
|
27410
|
-
contract.symbol(),
|
|
27507
|
+
getERC20TokenInfo(web3Provider, tokenAddress),
|
|
27411
27508
|
contract.balanceOf(walletAddress),
|
|
27412
|
-
contract.decimals(),
|
|
27413
27509
|
])
|
|
27414
|
-
.then(([
|
|
27415
|
-
const formattedBalance = utils$1.formatUnits(balance, decimals);
|
|
27510
|
+
.then(([tokenInfo, balance]) => {
|
|
27511
|
+
const formattedBalance = utils$1.formatUnits(balance, tokenInfo.decimals);
|
|
27416
27512
|
return {
|
|
27417
27513
|
balance,
|
|
27418
27514
|
formattedBalance,
|
|
27419
27515
|
token: {
|
|
27420
|
-
name,
|
|
27421
|
-
symbol,
|
|
27422
|
-
decimals,
|
|
27516
|
+
name: tokenInfo.name,
|
|
27517
|
+
symbol: tokenInfo.symbol,
|
|
27518
|
+
decimals: tokenInfo.decimals,
|
|
27423
27519
|
address: tokenAddress,
|
|
27424
27520
|
},
|
|
27425
27521
|
};
|
|
@@ -27519,6 +27615,9 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
27519
27615
|
const allBalancePromises = [];
|
|
27520
27616
|
tokens
|
|
27521
27617
|
.forEach((token) => {
|
|
27618
|
+
// For some reason isNativeToken always returns undefined.
|
|
27619
|
+
// We have spent way too much time figuring out why this is happening.
|
|
27620
|
+
// That we have given up -- keep it as it is for now.
|
|
27522
27621
|
if (!token.address || token.address.toLocaleLowerCase() === NATIVE) {
|
|
27523
27622
|
allBalancePromises.push(getBalance(config, web3Provider, walletAddress));
|
|
27524
27623
|
}
|
|
@@ -27527,12 +27626,25 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
27527
27626
|
}
|
|
27528
27627
|
});
|
|
27529
27628
|
const balanceResults = await Promise.allSettled(allBalancePromises);
|
|
27530
|
-
const balances = balanceResults.filter((result) => result.status === 'fulfilled').map((result) =>
|
|
27629
|
+
const balances = balanceResults.filter((result) => result.status === 'fulfilled').map((result) => {
|
|
27630
|
+
const resp = result;
|
|
27631
|
+
const { token } = resp.value;
|
|
27632
|
+
// For some reason isNativeToken always returns undefined.
|
|
27633
|
+
// We have spent way too much time figuring out why this is happening.
|
|
27634
|
+
// That we have given up -- keep it as it is for now.
|
|
27635
|
+
if (!token.address || token.address.toLocaleLowerCase() === NATIVE)
|
|
27636
|
+
resp.value.token.address = NATIVE;
|
|
27637
|
+
return resp.value;
|
|
27638
|
+
});
|
|
27531
27639
|
return { balances };
|
|
27532
27640
|
};
|
|
27533
27641
|
const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
27534
|
-
|
|
27535
|
-
|
|
27642
|
+
if (!walletAddress && !web3Provider) {
|
|
27643
|
+
throw new CheckoutError('both walletAddress and provider are missing. At least one must be provided.', CheckoutErrorType.MISSING_PARAMS);
|
|
27644
|
+
}
|
|
27645
|
+
if (!config.networkMap.get(chainId)) {
|
|
27646
|
+
throw new CheckoutError(`chain ID ${chainId} not supported by the environment`, CheckoutErrorType.CHAIN_NOT_SUPPORTED_ERROR);
|
|
27647
|
+
}
|
|
27536
27648
|
const { tokens } = await getTokenAllowList(config, {
|
|
27537
27649
|
type: TokenFilterTypes.ALL,
|
|
27538
27650
|
chainId,
|
|
@@ -27548,6 +27660,7 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
27548
27660
|
// eslint-disable-next-line no-console
|
|
27549
27661
|
console.error(err);
|
|
27550
27662
|
}
|
|
27663
|
+
let address = walletAddress;
|
|
27551
27664
|
if (flag && Blockscout.isChainSupported(chainId)) {
|
|
27552
27665
|
// This is a hack because the widgets are still using the tokens symbol
|
|
27553
27666
|
// to drive the conversions. If we remove all the token symbols from e.g. zkevm
|
|
@@ -27555,12 +27668,18 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
27555
27668
|
// Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
|
|
27556
27669
|
// is done.
|
|
27557
27670
|
const isL1Chain = getL1ChainId(config) === chainId;
|
|
27558
|
-
|
|
27671
|
+
if (!address)
|
|
27672
|
+
address = await web3Provider?.getSigner().getAddress();
|
|
27673
|
+
return await measureAsyncExecution(config, `Time to fetch balances using blockscout for ${chainId}`, getIndexerBalance(address, chainId, isL1Chain ? tokens : undefined));
|
|
27674
|
+
}
|
|
27675
|
+
if (!web3Provider) {
|
|
27676
|
+
throw new CheckoutError('indexer is disabled for this chain, you must provide a provider.', CheckoutErrorType.MISSING_PARAMS);
|
|
27559
27677
|
}
|
|
27560
27678
|
// This fallback to use ERC20s calls which is a best effort solution
|
|
27561
27679
|
// Fails in fetching data from the RCP calls might result in some
|
|
27562
27680
|
// missing data.
|
|
27563
|
-
|
|
27681
|
+
address ||= await web3Provider.getSigner().getAddress();
|
|
27682
|
+
return await measureAsyncExecution(config, `Time to fetch balances using RPC for ${chainId}`, getBalances(config, web3Provider, address, tokens));
|
|
27564
27683
|
};
|
|
27565
27684
|
|
|
27566
27685
|
async function checkIsWalletConnected(web3Provider) {
|
|
@@ -29087,14 +29206,16 @@ const getEthBalance = (balances) => {
|
|
|
29087
29206
|
const getBridgeFeeEstimate = async (config, readOnlyProviders, fromChainId, toChainId) => {
|
|
29088
29207
|
const bridge = createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
29089
29208
|
try {
|
|
29090
|
-
const
|
|
29209
|
+
const bridgeFeeResponse = await bridge.getFee({
|
|
29091
29210
|
action: BridgeFeeActions.DEPOSIT,
|
|
29092
29211
|
gasMultiplier: 1.1,
|
|
29093
29212
|
sourceChainId: fromChainId.toString(),
|
|
29094
29213
|
destinationChainId: toChainId.toString(),
|
|
29095
29214
|
});
|
|
29096
|
-
|
|
29097
|
-
|
|
29215
|
+
return {
|
|
29216
|
+
...bridgeFeeResponse,
|
|
29217
|
+
approvalGas: BigNumber$1.from(0),
|
|
29218
|
+
};
|
|
29098
29219
|
}
|
|
29099
29220
|
catch (err) {
|
|
29100
29221
|
throw new CheckoutError('Error estimating gas for bridge', CheckoutErrorType.BRIDGE_GAS_ESTIMATE_ERROR, { message: err.message });
|
|
@@ -29105,11 +29226,11 @@ const getBridgeFeeEstimate = async (config, readOnlyProviders, fromChainId, toCh
|
|
|
29105
29226
|
const INDEXER_ETH_ROOT_CONTRACT_ADDRESS = '0x0000000000000000000000000000000000000eee';
|
|
29106
29227
|
const getIndexerChainName = (chainId) => {
|
|
29107
29228
|
if (chainId === ChainId.IMTBL_ZKEVM_MAINNET)
|
|
29108
|
-
return
|
|
29229
|
+
return ChainSlug.IMTBL_ZKEVM_MAINNET;
|
|
29109
29230
|
if (chainId === ChainId.IMTBL_ZKEVM_TESTNET)
|
|
29110
|
-
return
|
|
29231
|
+
return ChainSlug.IMTBL_ZKEVM_TESTNET;
|
|
29111
29232
|
if (chainId === ChainId.IMTBL_ZKEVM_DEVNET)
|
|
29112
|
-
return
|
|
29233
|
+
return ChainSlug.IMTBL_ZKEVM_DEVNET;
|
|
29113
29234
|
return '';
|
|
29114
29235
|
};
|
|
29115
29236
|
// Indexer ERC20 call does not support IMX so cannot get root chain mapping from this endpoint.
|
|
@@ -30555,6 +30676,8 @@ class Checkout {
|
|
|
30555
30676
|
*/
|
|
30556
30677
|
async widgets(init) {
|
|
30557
30678
|
const checkout = this;
|
|
30679
|
+
// Preload the configurations
|
|
30680
|
+
await checkout.config.remote.getConfig();
|
|
30558
30681
|
const factory = new Promise((resolve, reject) => {
|
|
30559
30682
|
function checkForWidgetsBundleLoaded() {
|
|
30560
30683
|
if (typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
@@ -30570,8 +30693,6 @@ class Checkout {
|
|
|
30570
30693
|
try {
|
|
30571
30694
|
const script = loadUnresolved(init.version);
|
|
30572
30695
|
if (script.loaded && typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
30573
|
-
// eslint-disable-next-line no-console
|
|
30574
|
-
console.warn('Checkout widgets script is already loaded');
|
|
30575
30696
|
resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
|
|
30576
30697
|
}
|
|
30577
30698
|
else {
|
|
@@ -30625,6 +30746,15 @@ class Checkout {
|
|
|
30625
30746
|
const switchNetworkRes = await switchWalletNetwork(this.config, web3Provider, params.chainId);
|
|
30626
30747
|
return switchNetworkRes;
|
|
30627
30748
|
}
|
|
30749
|
+
/**
|
|
30750
|
+
* Retrieves the token information given the token address. This function makes RPC calls to
|
|
30751
|
+
* ERC20 contracts to fetch the main contract information (e.g. symbol).
|
|
30752
|
+
* @param {GetTokenInfoParams} params - The parameters for retrieving the token information.
|
|
30753
|
+
* @returns {Promise<TokenInfo>} - A promise that resolves to the token info request.
|
|
30754
|
+
*/
|
|
30755
|
+
async getTokenInfo(params) {
|
|
30756
|
+
return await getERC20TokenInfo(params.provider, params.tokenAddress);
|
|
30757
|
+
}
|
|
30628
30758
|
/**
|
|
30629
30759
|
* Retrieves the balance of a wallet address.
|
|
30630
30760
|
* @param {GetBalanceParams} params - The parameters for retrieving the balance.
|
|
@@ -30643,8 +30773,7 @@ class Checkout {
|
|
|
30643
30773
|
* @returns {Promise<GetAllBalancesResult>} - A promise that resolves to the result of retrieving the balances.
|
|
30644
30774
|
*/
|
|
30645
30775
|
async getAllBalances(params) {
|
|
30646
|
-
|
|
30647
|
-
return getAllBalances(this.config, web3Provider, params.walletAddress, params.chainId);
|
|
30776
|
+
return getAllBalances(this.config, params.provider, params.walletAddress, params.chainId);
|
|
30648
30777
|
}
|
|
30649
30778
|
/**
|
|
30650
30779
|
* Retrieves the supported networks based on the provided parameters.
|
|
@@ -30805,4 +30934,4 @@ class Checkout {
|
|
|
30805
30934
|
}
|
|
30806
30935
|
}
|
|
30807
30936
|
|
|
30808
|
-
export { BridgeEventType, ChainId, ChainName, Checkout, CheckoutConfiguration, CheckoutErrorType, CheckoutStatus, ConnectEventType, ConnectTargetLayer, ExchangeType, FundingStepType, GasEstimateType, GasTokenType, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, ItemType, NetworkFilterTypes, OnRampEventType, OrchestrationEventType, ProviderEventType, RoutingOutcomeType, SaleEventType, SwapEventType, TokenFilterTypes, TransactionOrGasType, WalletEventType, WalletFilterTypes, WalletProviderName, WidgetTheme, WidgetType };
|
|
30937
|
+
export { BridgeEventType, ChainId, ChainName, ChainSlug, Checkout, CheckoutConfiguration, CheckoutErrorType, CheckoutStatus, ConnectEventType, ConnectTargetLayer, ExchangeType, FundingStepType, GasEstimateType, GasTokenType, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, ItemType, NetworkFilterTypes, OnRampEventType, OrchestrationEventType, ProviderEventType, RoutingOutcomeType, SaleEventType, SwapEventType, TokenFilterTypes, TransactionOrGasType, WalletEventType, WalletFilterTypes, WalletProviderName, WidgetTheme, WidgetType };
|
|
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
17
17
|
chainID,
|
|
18
18
|
coreContractAddress,
|
|
19
19
|
registrationContractAddress,
|
|
20
|
-
sdkVersion: 'ts-immutable-sdk-0.36.
|
|
20
|
+
sdkVersion: 'ts-immutable-sdk-0.36.4',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|