@imtbl/sdk 0.23.1 → 0.23.2-alpha.1
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 +467 -0
- package/dist/blockchain_data.js +135 -11
- package/dist/browser/153.afe08b0c.chunk.js +1 -0
- package/dist/browser/175.cdce927d.chunk.js +1 -0
- package/dist/browser/362.7e7bfa44.chunk.js +1 -0
- package/dist/browser/383.de862369.chunk.js +1 -0
- package/dist/browser/472.923d4bd5.chunk.js +1 -0
- package/dist/browser/603.d9fb843a.chunk.js +2 -0
- package/dist/browser/692.306a7f2a.chunk.js +1 -0
- package/dist/browser/703.5c480d28.chunk.js +1 -0
- package/dist/browser/82.bed3464b.chunk.js +2 -0
- package/dist/browser/ajs-destination.52125420.chunk.js +1 -0
- package/dist/browser/auto-track.a6dd767a.chunk.js +1 -0
- package/dist/browser/checkout.js +1 -2
- package/dist/browser/legacyVideos.55664053.chunk.js +1 -0
- package/dist/browser/queryString.307c6759.chunk.js +1 -0
- package/dist/browser/remoteMiddleware.c0e773ab.chunk.js +1 -0
- package/dist/browser/schemaFilter.0ba00503.chunk.js +1 -0
- package/dist/browser/tsub-middleware.bb1047fe.chunk.js +2 -0
- package/dist/checkout_sdk.d.ts +2 -13
- package/dist/checkout_sdk.js +291 -126
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +314 -138
- package/dist/index.d.ts +469 -13
- package/dist/index.js +314 -138
- package/dist/passport.js +22 -11
- package/package.json +1 -1
package/dist/blockchain_data.js
CHANGED
|
@@ -946,6 +946,46 @@ const MetadataApiAxiosParamCreator = function (configuration) {
|
|
|
946
946
|
options: localVarRequestOptions,
|
|
947
947
|
};
|
|
948
948
|
},
|
|
949
|
+
/**
|
|
950
|
+
* refresh metadata of a list of nfts
|
|
951
|
+
* @summary refresh the metedata data of a list of nfts by token id
|
|
952
|
+
* @param {string} contractAddress The address of contract
|
|
953
|
+
* @param {string} chainName The name of chain
|
|
954
|
+
* @param {RefreshNFTMetadataByTokenIDRequest} refreshNFTMetadataByTokenIDRequest the request body
|
|
955
|
+
* @param {*} [options] Override http request option.
|
|
956
|
+
* @throws {RequiredError}
|
|
957
|
+
*/
|
|
958
|
+
refreshNFTMetadataByTokenID: async (contractAddress, chainName, refreshNFTMetadataByTokenIDRequest, options = {}) => {
|
|
959
|
+
// verify required parameter 'contractAddress' is not null or undefined
|
|
960
|
+
assertParamExists('refreshNFTMetadataByTokenID', 'contractAddress', contractAddress);
|
|
961
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
962
|
+
assertParamExists('refreshNFTMetadataByTokenID', 'chainName', chainName);
|
|
963
|
+
// verify required parameter 'refreshNFTMetadataByTokenIDRequest' is not null or undefined
|
|
964
|
+
assertParamExists('refreshNFTMetadataByTokenID', 'refreshNFTMetadataByTokenIDRequest', refreshNFTMetadataByTokenIDRequest);
|
|
965
|
+
const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata`
|
|
966
|
+
.replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
|
|
967
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
968
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
969
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
970
|
+
let baseOptions;
|
|
971
|
+
if (configuration) {
|
|
972
|
+
baseOptions = configuration.baseOptions;
|
|
973
|
+
}
|
|
974
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
975
|
+
const localVarHeaderParameter = {};
|
|
976
|
+
const localVarQueryParameter = {};
|
|
977
|
+
// authentication ImmutableApiKey required
|
|
978
|
+
await setApiKeyToObject(localVarHeaderParameter, "X-Immutable-API-Key", configuration);
|
|
979
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
980
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
981
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
982
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
983
|
+
localVarRequestOptions.data = serializeDataIfNeeded(refreshNFTMetadataByTokenIDRequest, localVarRequestOptions, configuration);
|
|
984
|
+
return {
|
|
985
|
+
url: toPathString(localVarUrlObj),
|
|
986
|
+
options: localVarRequestOptions,
|
|
987
|
+
};
|
|
988
|
+
},
|
|
949
989
|
};
|
|
950
990
|
};
|
|
951
991
|
/**
|
|
@@ -980,6 +1020,19 @@ const MetadataApiFp = function (configuration) {
|
|
|
980
1020
|
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options);
|
|
981
1021
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
982
1022
|
},
|
|
1023
|
+
/**
|
|
1024
|
+
* refresh metadata of a list of nfts
|
|
1025
|
+
* @summary refresh the metedata data of a list of nfts by token id
|
|
1026
|
+
* @param {string} contractAddress The address of contract
|
|
1027
|
+
* @param {string} chainName The name of chain
|
|
1028
|
+
* @param {RefreshNFTMetadataByTokenIDRequest} refreshNFTMetadataByTokenIDRequest the request body
|
|
1029
|
+
* @param {*} [options] Override http request option.
|
|
1030
|
+
* @throws {RequiredError}
|
|
1031
|
+
*/
|
|
1032
|
+
async refreshNFTMetadataByTokenID(contractAddress, chainName, refreshNFTMetadataByTokenIDRequest, options) {
|
|
1033
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshNFTMetadataByTokenID(contractAddress, chainName, refreshNFTMetadataByTokenIDRequest, options);
|
|
1034
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1035
|
+
},
|
|
983
1036
|
};
|
|
984
1037
|
};
|
|
985
1038
|
/**
|
|
@@ -1012,6 +1065,18 @@ const MetadataApiFactory = function (configuration, basePath, axios) {
|
|
|
1012
1065
|
refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options) {
|
|
1013
1066
|
return localVarFp.refreshMetadataByID(chainName, contractAddress, refreshMetadataByIDRequest, options).then((request) => request(axios, basePath));
|
|
1014
1067
|
},
|
|
1068
|
+
/**
|
|
1069
|
+
* refresh metadata of a list of nfts
|
|
1070
|
+
* @summary refresh the metedata data of a list of nfts by token id
|
|
1071
|
+
* @param {string} contractAddress The address of contract
|
|
1072
|
+
* @param {string} chainName The name of chain
|
|
1073
|
+
* @param {RefreshNFTMetadataByTokenIDRequest} refreshNFTMetadataByTokenIDRequest the request body
|
|
1074
|
+
* @param {*} [options] Override http request option.
|
|
1075
|
+
* @throws {RequiredError}
|
|
1076
|
+
*/
|
|
1077
|
+
refreshNFTMetadataByTokenID(contractAddress, chainName, refreshNFTMetadataByTokenIDRequest, options) {
|
|
1078
|
+
return localVarFp.refreshNFTMetadataByTokenID(contractAddress, chainName, refreshNFTMetadataByTokenIDRequest, options).then((request) => request(axios, basePath));
|
|
1079
|
+
},
|
|
1015
1080
|
};
|
|
1016
1081
|
};
|
|
1017
1082
|
/**
|
|
@@ -1042,6 +1107,17 @@ class MetadataApi extends BaseAPI {
|
|
|
1042
1107
|
refreshMetadataByID(requestParameters, options) {
|
|
1043
1108
|
return MetadataApiFp(this.configuration).refreshMetadataByID(requestParameters.chainName, requestParameters.contractAddress, requestParameters.refreshMetadataByIDRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1044
1109
|
}
|
|
1110
|
+
/**
|
|
1111
|
+
* refresh metadata of a list of nfts
|
|
1112
|
+
* @summary refresh the metedata data of a list of nfts by token id
|
|
1113
|
+
* @param {MetadataApiRefreshNFTMetadataByTokenIDRequest} requestParameters Request parameters.
|
|
1114
|
+
* @param {*} [options] Override http request option.
|
|
1115
|
+
* @throws {RequiredError}
|
|
1116
|
+
* @memberof MetadataApi
|
|
1117
|
+
*/
|
|
1118
|
+
refreshNFTMetadataByTokenID(requestParameters, options) {
|
|
1119
|
+
return MetadataApiFp(this.configuration).refreshNFTMetadataByTokenID(requestParameters.contractAddress, requestParameters.chainName, requestParameters.refreshNFTMetadataByTokenIDRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1120
|
+
}
|
|
1045
1121
|
}
|
|
1046
1122
|
|
|
1047
1123
|
/* tslint:disable */
|
|
@@ -2857,29 +2933,24 @@ class APIError extends Error {
|
|
|
2857
2933
|
|
|
2858
2934
|
/* eslint-disable implicit-arrow-linebreak */
|
|
2859
2935
|
const defaultHeaders = {
|
|
2860
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.1',
|
|
2936
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.2-alpha.1',
|
|
2861
2937
|
};
|
|
2862
2938
|
/**
|
|
2863
2939
|
* createAPIConfiguration to create a custom Configuration
|
|
2864
2940
|
* other than the production and sandbox defined below.
|
|
2865
2941
|
*/
|
|
2866
|
-
const createAPIConfiguration = ({ basePath, headers: baseHeaders, }) => {
|
|
2942
|
+
const createAPIConfiguration = ({ baseConfig, basePath, headers: baseHeaders, }) => {
|
|
2867
2943
|
if (!basePath.trim()) {
|
|
2868
2944
|
throw Error('basePath can not be empty');
|
|
2869
2945
|
}
|
|
2870
2946
|
const headers = { ...(baseHeaders || {}), ...defaultHeaders };
|
|
2871
2947
|
const configParams = {
|
|
2948
|
+
...baseConfig,
|
|
2872
2949
|
basePath,
|
|
2873
2950
|
baseOptions: { headers },
|
|
2874
2951
|
};
|
|
2875
2952
|
return new index.Configuration(configParams);
|
|
2876
2953
|
};
|
|
2877
|
-
const production = () => createAPIConfiguration({
|
|
2878
|
-
basePath: 'https://indexer-mr.imtbl.com',
|
|
2879
|
-
});
|
|
2880
|
-
const sandbox = () => createAPIConfiguration({
|
|
2881
|
-
basePath: 'https://api.sandbox.immutable.com',
|
|
2882
|
-
});
|
|
2883
2954
|
class BlockchainDataConfiguration {
|
|
2884
2955
|
apiConfig;
|
|
2885
2956
|
baseConfig;
|
|
@@ -2891,15 +2962,24 @@ class BlockchainDataConfiguration {
|
|
|
2891
2962
|
else {
|
|
2892
2963
|
switch (baseConfig.environment) {
|
|
2893
2964
|
case Environment.SANDBOX: {
|
|
2894
|
-
this.apiConfig =
|
|
2965
|
+
this.apiConfig = createAPIConfiguration({
|
|
2966
|
+
basePath: 'https://api.sandbox.immutable.com',
|
|
2967
|
+
baseConfig,
|
|
2968
|
+
});
|
|
2895
2969
|
break;
|
|
2896
2970
|
}
|
|
2897
2971
|
case Environment.PRODUCTION: {
|
|
2898
|
-
this.apiConfig =
|
|
2972
|
+
this.apiConfig = createAPIConfiguration({
|
|
2973
|
+
basePath: 'https://indexer-mr.imtbl.com',
|
|
2974
|
+
baseConfig,
|
|
2975
|
+
});
|
|
2899
2976
|
break;
|
|
2900
2977
|
}
|
|
2901
2978
|
default: {
|
|
2902
|
-
this.apiConfig =
|
|
2979
|
+
this.apiConfig = createAPIConfiguration({
|
|
2980
|
+
basePath: 'https://api.sandbox.immutable.com',
|
|
2981
|
+
baseConfig,
|
|
2982
|
+
});
|
|
2903
2983
|
}
|
|
2904
2984
|
}
|
|
2905
2985
|
}
|
|
@@ -2949,6 +3029,7 @@ class BlockchainData {
|
|
|
2949
3029
|
nfts;
|
|
2950
3030
|
nftOwners;
|
|
2951
3031
|
tokens;
|
|
3032
|
+
metadata;
|
|
2952
3033
|
constructor(moduleConfig) {
|
|
2953
3034
|
this.config = new BlockchainDataConfiguration(moduleConfig);
|
|
2954
3035
|
this.activities = new index.ActivitiesApi(this.config.apiConfig);
|
|
@@ -2957,6 +3038,7 @@ class BlockchainData {
|
|
|
2957
3038
|
this.nfts = new index.NftsApi(this.config.apiConfig);
|
|
2958
3039
|
this.nftOwners = new index.NftOwnersApi(this.config.apiConfig);
|
|
2959
3040
|
this.tokens = new index.TokensApi(this.config.apiConfig);
|
|
3041
|
+
this.metadata = new index.MetadataApi(this.config.apiConfig);
|
|
2960
3042
|
}
|
|
2961
3043
|
/**
|
|
2962
3044
|
* List all activities
|
|
@@ -3126,6 +3208,48 @@ class BlockchainData {
|
|
|
3126
3208
|
throw formatError(err);
|
|
3127
3209
|
});
|
|
3128
3210
|
}
|
|
3211
|
+
/**
|
|
3212
|
+
* Refresh collection metadata
|
|
3213
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
3214
|
+
* @returns a promise that resolves with the updated collection
|
|
3215
|
+
* @throws {@link index.APIError}
|
|
3216
|
+
*/
|
|
3217
|
+
async refreshCollectionMetadata(request) {
|
|
3218
|
+
return await this.collections
|
|
3219
|
+
.refreshCollectionMetadata(request)
|
|
3220
|
+
.then((res) => res.data)
|
|
3221
|
+
.catch((err) => {
|
|
3222
|
+
throw formatError(err);
|
|
3223
|
+
});
|
|
3224
|
+
}
|
|
3225
|
+
/**
|
|
3226
|
+
* Refresh metadata for specific NFTs
|
|
3227
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
3228
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
3229
|
+
* @throws {@link index.APIError}
|
|
3230
|
+
*/
|
|
3231
|
+
async refreshNFTMetadata(request) {
|
|
3232
|
+
return await this.metadata
|
|
3233
|
+
.refreshNFTMetadataByTokenID(request)
|
|
3234
|
+
.then((res) => res.data)
|
|
3235
|
+
.catch((err) => {
|
|
3236
|
+
throw formatError(err);
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
/**
|
|
3240
|
+
* Refresh metadata by ID. This will refresh metadata for all NFTs that reference the given metadata ID.
|
|
3241
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
3242
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
3243
|
+
* @throws {@link index.APIError}
|
|
3244
|
+
*/
|
|
3245
|
+
async refreshStackedMetadata(request) {
|
|
3246
|
+
return await this.metadata
|
|
3247
|
+
.refreshMetadataByID(request)
|
|
3248
|
+
.then((res) => res.data)
|
|
3249
|
+
.catch((err) => {
|
|
3250
|
+
throw formatError(err);
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3129
3253
|
}
|
|
3130
3254
|
|
|
3131
3255
|
export { APIError, BlockchainData };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_imtbl_checkout_widgets_lib=self.webpackChunk_imtbl_checkout_widgets_lib||[]).push([[153],{52889:function(e,t,n){n.d(t,{u:function(){return C}});var r=n(72771),a=n(50940),o=n(65535),i={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},s={color:"base.color.text.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},c={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},l={width:"100%",height:"base.spacing.x16"},u={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},d=n(95269),p=n(10256);function C(e){var t=e.onCloseBottomSheet,n=e.visible,C=e.showHeaderBar,f=e.walletAddress,v=e.showAdjustAmount,h=d.f.drawers.notEnoughGas,x=h.content,E=h.buttons,m=(0,o.useState)(!1),g=(0,r.Z)(m,2),w=g[0],b=g[1],y=(0,o.useCallback)((function(){f&&""!==f&&navigator.clipboard.writeText(f),b(!0),setTimeout((function(){b(!1)}),3e3)}),[f]);return(0,p.jsx)(a.R1,{headerBarTitle:void 0,size:"full",onCloseBottomSheet:t,visible:n,showHeaderBar:C,children:(0,p.jsx)(a.R1.Content,{children:(0,p.jsxs)(a.xu,{testId:"not-enough-gas-bottom-sheet",sx:i,children:[(0,p.jsx)(a.fP,{imageUrl:"https://design-system.immutable.com/hosted-for-ds/currency-icons/currency--eth.svg",circularFrame:!0,sx:{backgroundColor:"white",height:"100px",padding:"10px"}}),(0,p.jsx)(a.X6,{size:"small",sx:s,testId:"not-enough-gas-heading",children:x.heading}),(0,p.jsx)(a.uT,{sx:s,children:x.body}),(0,p.jsxs)(a.xu,{sx:c,children:[v&&(0,p.jsx)(a.zx,{testId:"not-enough-gas-adjust-amount-button",sx:l,variant:"tertiary",onClick:t,children:E.adjustAmount}),(0,p.jsxs)(a.zx,{testId:"not-enough-gas-copy-address-button",sx:l,variant:"tertiary",onClick:y,children:[E.copyAddress,(0,p.jsx)(a.zx.Icon,{icon:w?"Tick":"CopyText"})]}),(0,p.jsx)(a.zx,{sx:l,variant:"tertiary",onClick:t,testId:"not-enough-gas-cancel-button",children:E.cancel})]}),(0,p.jsx)(a.xu,{sx:u,children:(0,p.jsx)(a.TR,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}},99153:function(e,t,n){n.r(t),n.d(t,{ImmutableBridge:function(){return at}});var r=n(74708),a=n(8821),o=n(85169),i=n(69803),s=n(2312),c=n(82248),l=n(8416),u=n(65535),d=n(29956),p=n(64093),C=n(50940),f=n(38339),v=n(46999),h=n(18950),x=n(72771),E=n(7064),m=n(44266),g=n(99843),w=n(26763),b=n(39275),y=n(37755),k={walletProvider:null,tokenBridge:null,network:null,toNetwork:null,tokenBalances:[],allowedTokens:[]},T=function(e){return e.SET_WALLET_PROVIDER="SET_WALLET_PROVIDER",e.SET_TOKEN_BRIDGE="SET_TOKEN_BRIDGE",e.SET_NETWORK="SET_NETWORK",e.SET_TO_NETWORK="SET_TO_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS",e}({}),S=(0,u.createContext)({bridgeState:k,bridgeDispatch:function(){}});S.displayName="BridgeContext";var _=function(e,t){switch(t.payload.type){case T.SET_WALLET_PROVIDER:return(0,y.Z)((0,y.Z)({},e),{},{walletProvider:t.payload.walletProvider});case T.SET_TOKEN_BRIDGE:return(0,y.Z)((0,y.Z)({},e),{},{tokenBridge:t.payload.tokenBridge});case T.SET_NETWORK:return(0,y.Z)((0,y.Z)({},e),{},{network:t.payload.network});case T.SET_TO_NETWORK:return(0,y.Z)((0,y.Z)({},e),{},{toNetwork:t.payload.toNetwork});case T.SET_TOKEN_BALANCES:return(0,y.Z)((0,y.Z)({},e),{},{tokenBalances:t.payload.tokenBalances});case T.SET_ALLOWED_TOKENS:return(0,y.Z)((0,y.Z)({},e),{},{allowedTokens:t.payload.allowedTokens});default:return e}},A=n(33939),L=n(62290);function Z(e){var t=new CustomEvent(L.O6.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:L.rw.CLOSE_WIDGET,data:{}}});console.log("bridge close ",e,t),void 0!==e&&e.dispatchEvent(t)}var I=n(23357),R=n(58534),O=n(581),F=n(4813),B=n(72225),j=n(42322),D=n(48796),P=n(47618),M=n(95269),N=n(6133),U=n(46869),W=n(35047);function V(e,t){var n=M.f.views[I.O.BRIDGE].validation;return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?n.insufficientBalance:"":n.noAmountInputted}var G=n(86249),K={height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},H={paddingTop:"base.spacing.x4",display:"flex",gap:"base.spacing.x1"},X={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4",backgroundColor:"base.color.translucent.emphasis.200"},z=n(95175),Q=n(6426),Y=n(30940),J=n(52889),$=n(55820),q=n(10256);function ee(e){var t,n=(0,u.useContext)(S).bridgeState,r=n.tokenBridge,a=n.tokenBalances,o=n.allowedTokens,i=(0,u.useContext)($.R4).connectLoaderState,s=i.checkout,c=i.provider,l=(0,u.useContext)(P.FJ),p=l.cryptoFiatState,f=l.cryptoFiatDispatch,E=(0,u.useContext)(b.A7).viewDispatch,m=e.testId,g=e.defaultAmount,y=e.defaultFromContractAddress,k=M.f.views[I.O.BRIDGE],T=k.content,_=k.bridgeForm,A=k.fees,L=(0,u.useState)(g||""),Z=(0,x.Z)(L,2),R=Z[0],O=Z[1],F=(0,u.useState)(""),ee=(0,x.Z)(F,2),te=ee[0],ne=ee[1],re=(0,u.useState)(),ae=(0,x.Z)(re,2),oe=ae[0],ie=ae[1],se=(0,u.useState)(""),ce=(0,x.Z)(se,2),le=ce[0],ue=ce[1],de=(0,u.useState)(""),pe=(0,x.Z)(de,2),Ce=pe[0],fe=pe[1],ve=(0,u.useState)(!1),he=(0,x.Z)(ve,2),xe=he[0],Ee=he[1],me=(0,u.useState)(!1),ge=(0,x.Z)(me,2),we=ge[0],be=ge[1],ye=(0,u.useRef)(!1),ke=(0,u.useState)(!1),Te=(0,x.Z)(ke,2),Se=Te[0],_e=Te[1],Ae=(0,u.useState)(void 0),Le=(0,x.Z)(Ae,2),Ze=Le[0],Ie=Le[1],Re=(0,u.useState)(""),Oe=(0,x.Z)(Re,2),Fe=Oe[0],Be=Oe[1],je=(0,u.useState)(""),De=(0,x.Z)(je,2),Pe=De[0],Me=De[1],Ne=(0,u.useState)(void 0),Ue=(0,x.Z)(Ne,2),We=Ue[0],Ve=Ue[1],Ge=(0,u.useState)(void 0),Ke=(0,x.Z)(Ge,2),He=Ke[0],Xe=Ke[1],ze=(0,u.useState)([]),Qe=(0,x.Z)(ze,2),Ye=Qe[0],Je=Qe[1],$e=(0,u.useState)(!1),qe=(0,x.Z)($e,2),et=qe[0],tt=qe[1],nt=(0,u.useState)(""),rt=(0,x.Z)(nt,2),at=rt[0],ot=rt[1],it=(0,u.useState)(!1),st=(0,x.Z)(it,2),ct=st[0],lt=st[1],ut=(0,u.useCallback)((function(e,t){return t?"".concat(e.toLowerCase(),"-").concat(t.toLowerCase()):e.toLowerCase()}),[]);(0,u.useEffect)((function(){if(0!==a.length){var e=a.filter((function(e){return e.balance.gt(0)})).map((function(e){return{id:ut(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedFiatAmount:0===p.conversions.size?(0,U.FL)(""):(0,U.yY)(e.formattedBalance,e.token.symbol,p.conversions),formattedAmount:(0,U.Lr)(e.formattedBalance)}}}));Je(e),ye.current||(ye.current=!0,y&&ie(a.find((function(e){var t;return(0,U.Mg)(e.token.address)&&(null===y||void 0===y?void 0:y.toLocaleUpperCase())===w.B5||(null===(t=e.token.address)||void 0===t?void 0:t.toLowerCase())===(null===y||void 0===y?void 0:y.toLowerCase())}))))}}),[a,p.conversions,y,ye.current,ie,Je,ut,U.FL]);var dt=(0,u.useMemo)((function(){return oe&&oe.token?ut(oe.token.symbol,oe.token.address):void 0}),[oe,a,p.conversions,ut]),pt=function(){var e=(0,h.Z)((0,v.Z)().mark((function e(){var t,n,a,o;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s&&c&&r&&oe&&oe.token){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c.getSigner().getAddress();case 4:return t=e.sent,n=B.parseUnits(R,oe.token.decimals),e.next=8,r.getUnsignedApproveDepositBridgeTx({depositorAddress:t,token:(0,U.Mg)(oe.token.address)?w.B5:oe.token.address,depositAmount:n});case 8:return a=e.sent,e.next=11,r.getUnsignedDepositTx({depositorAddress:t,recipientAddress:t,token:(0,U.Mg)(oe.token.address)?w.B5:oe.token.address,depositAmount:n});case 11:return o=e.sent,e.abrupt("return",{approveRes:a,bridgeTxn:o});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ct=function(){var e=(0,h.Z)((0,v.Z)().mark((function e(){var t,n,r,a,o,i,c,l,u=arguments;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=u.length>0&&void 0!==u[0]&&u[0],!Number.isNaN(parseFloat(R))&&!(parseFloat(R)<=0)&&!!oe&&!Se){e.next=3;break}return e.abrupt("return");case 3:return o||(be(!0),_e(!0)),e.next=6,pt();case 6:if(i=e.sent,Ve(null===i||void 0===i?void 0:i.approveRes),Xe(null===i||void 0===i?void 0:i.bridgeTxn),!(o&&(we||xe)||null===i||void 0===i)&&i.bridgeTxn&&s){e.next=11;break}return e.abrupt("return");case 11:return e.next=13,s.gasEstimate({gasEstimateType:d.IW.BRIDGE_TO_L2,isSpendingCapApprovalRequired:!(null===i||void 0===i||null===(t=i.approveRes)||void 0===t||!t.unsignedTx)});case 13:c=e.sent,Ie(c),l=B.formatUnits((null===c||void 0===c||null===(n=c.gasFee)||void 0===n?void 0:n.estimatedAmount)||0,w.vr),Be(l),Me((0,U.yY)(l,(null===(r=c.gasFee)||void 0===r||null===(a=r.token)||void 0===a?void 0:a.symbol)||"",p.conversions)),o||(be(!1),_e(!1));case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ft=(0,u.useMemo)((function(){var e=a.find((function(e){return(0,U.Mg)(e.token.address)}));if(!e)return!0;var t=(0,U.Mg)(null===oe||void 0===oe?void 0:oe.token.address),n=B.parseEther(0!==Fe.length?Fe:"0"),r=t&&!Number.isNaN(parseFloat(R))?B.parseEther(R):j.O$.from("0");return n.add(r).gt(e.balance)}),[Fe,a,oe,R]);(0,z.Y)((function(){return Ct(!0)}),w.Am),(0,u.useEffect)((function(){xe||(0,h.Z)((0,v.Z)().mark((function e(){return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ct();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()}),[R,oe,xe]);(0,u.useEffect)((function(){f({payload:{type:P.rj.SET_TOKEN_SYMBOLS,tokenSymbols:o.map((function(e){return e.symbol}))}})}),[f,o]),(0,u.useEffect)((function(){R&&oe&&fe((0,U.yY)(R,oe.token.symbol,p.conversions))}),[R,oe]),(0,u.useEffect)((function(){(0,h.Z)((0,v.Z)().mark((function e(){var t;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c.getSigner().getAddress();case 4:t=e.sent,ot((function(e){return""!==e&&e!==t&&ie(void 0),t}));case 6:case"end":return e.stop()}}),e)})))()}),[c,a]);var vt=(0,u.useCallback)((function(){var e=function(e){var t=M.f.views[I.O.BRIDGE].validation;return e?"":t.noTokenSelected}(oe),t=V(R,null===oe||void 0===oe?void 0:oe.formattedBalance);return e&&ue(e),t&&ne(t),!e&&!t}),[oe,R,ue,ne]),ht=(0,u.useCallback)((0,h.Z)((0,v.Z)().mark((function e(){var t,n,r,a,o,i,l,u;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vt()){e.next=2;break}return e.abrupt("return");case 2:if(s&&c&&oe&&He){e.next=4;break}return e.abrupt("return");case 4:if(!ft){e.next=7;break}return tt(!0),e.abrupt("return");case 7:if(e.prev=7,be(!0),!We||!We.unsignedTx){e.next=12;break}return E({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.APPROVE_ERC20,data:{approveTransaction:We,transaction:He,bridgeFormInfo:{fromContractAddress:null!==(n=null===(r=oe.token)||void 0===r?void 0:r.address)&&void 0!==n?n:"",fromAmount:R}}},currentViewData:{tokenAddress:null!==(a=null===(o=oe.token)||void 0===o?void 0:o.address)&&void 0!==a?a:"",amount:R}}}),e.abrupt("return");case 12:return e.next=14,s.sendTransaction({provider:c,transaction:He.unsignedTx});case 14:i=e.sent,l=i.transactionResponse,E({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.IN_PROGRESS,data:{token:null===oe||void 0===oe?void 0:oe.token,transactionResponse:l,bridgeForm:{fromContractAddress:null!==(t=null===oe||void 0===oe?void 0:oe.token.address)&&void 0!==t?t:"",fromAmount:R}}}}}),e.next=29;break;case 19:if(e.prev=19,e.t0=e.catch(7),be(!1),e.t0.type!==d.XQ.USER_REJECTED_REQUEST_ERROR){e.next=25;break}return lt(!0),e.abrupt("return");case 25:if(!(e.t0.type===d.XQ.UNPREDICTABLE_GAS_LIMIT||e.t0.type===d.XQ.TRANSACTION_FAILED||e.t0.type===d.XQ.INSUFFICIENT_FUNDS||e.t0.receipt&&0===e.t0.receipt.status)){e.next=28;break}return E({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.FAIL,reason:"Transaction failed",data:{fromContractAddress:null!==(u=null===oe||void 0===oe?void 0:oe.token.address)&&void 0!==u?u:"",fromAmount:R}}}}),e.abrupt("return");case 28:E({payload:{type:b.Cp.UPDATE_VIEW,view:{type:b.cZ.ERROR_VIEW,error:e.t0}}});case 29:case"end":return e.stop()}}),e,null,[[7,19]])}))),[s,c,vt,We,He,ft,oe]),xt=function(){var e=(0,h.Z)((0,v.Z)().mark((function e(){return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return lt(!1),e.next=3,ht();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,q.jsxs)(C.xu,{testId:m,sx:K,children:[(0,q.jsxs)(C.xu,{sx:{paddingX:"base.spacing.x4"},children:[(0,q.jsx)(C.X6,{testId:"".concat(m,"-content-heading"),size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:T.title}),(0,q.jsxs)(C.xu,{sx:H,children:[(0,q.jsx)(W.p,{testId:"bridge-token",options:Ye,coinSelectorHeading:_.from.selectorTitle,selectedOption:dt,subtext:oe?"".concat(T.availableBalancePrefix," ").concat((0,U.Lr)(null===oe||void 0===oe?void 0:oe.formattedBalance)):"",textAlign:"left",errorMessage:le,onSelectChange:function(e){return function(e){var t=a.find((function(t){return e===ut(t.token.symbol,t.token.address)}));t&&(ie(t),ue(""))}(e)},disabled:Se}),(0,q.jsx)(N.F,{testId:"bridge-amount",value:R,placeholder:_.from.inputPlaceholder,subtext:"".concat(T.fiatPricePrefix," $").concat((0,U.FL)(Ce,!0)),validator:D.I,onTextInputFocus:function(){Ee(!0)},onTextInputChange:function(e){return function(e){if(O(e),te){var t=V(e,null===oe||void 0===oe?void 0:oe.formattedBalance);ne(t)}oe&&fe((0,U.yY)(e,oe.token.symbol,p.conversions))}(e)},onTextInputBlur:function(e){return function(e){if(Ee(!1),O(e),te){var t=V(e,null===oe||void 0===oe?void 0:oe.formattedBalance);ne(t)}oe&&fe((0,U.yY)(e,oe.token.symbol,p.conversions))}(e)},textAlign:"right",errorMessage:te,disabled:Se})]}),(0,q.jsx)(G.M,{title:A.title,fiatPricePrefix:T.fiatPricePrefix,gasFeeValue:Fe,gasFeeToken:null===Ze||void 0===Ze||null===(t=Ze.gasFee)||void 0===t?void 0:t.token,gasFeeFiatValue:Pe})]}),(0,q.jsxs)(C.xu,{sx:X,children:[(0,q.jsx)(C.zx,{testId:"".concat(m,"-button"),variant:"primary",onClick:ht,disabled:we,size:"large",children:we?(0,q.jsx)(C.zx.Icon,{icon:"Loading",sx:Q.n}):_.buttonText}),(0,q.jsx)(Y.B,{visible:ct,showHeaderBar:!1,onCloseBottomSheet:function(){return lt(!1)},onRetry:xt}),(0,q.jsx)(J.u,{visible:et,showHeaderBar:!1,onCloseBottomSheet:function(){return tt(!1)},walletAddress:at,showAdjustAmount:(0,U.Mg)(null===oe||void 0===oe?void 0:oe.token.address)})]})]})}var te=n(83712),ne=n(97183),re=1e4;function ae(e){var t=e.amount,n=e.fromContractAddress,r=M.f.views[I.O.BRIDGE].header,a=(0,u.useContext)(S).bridgeDispatch,o=(0,u.useContext)($.R4).connectLoaderState,i=o.checkout,s=o.provider,c=(0,u.useContext)(te.yh).eventTargetState.eventTarget,l=(0,u.useCallback)((0,h.Z)((0,v.Z)().mark((function e(){var t;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i){e.next=2;break}return e.abrupt("return");case 2:if(s){e.next=4;break}return e.abrupt("return");case 4:return e.prev=4,e.next=7,(0,ne.Z)({checkout:i,provider:s,allowTokenListType:d.Zs.BRIDGE,retryPolicy:{retryIntervalMs:0,retries:0}});case 7:t=e.sent,a({payload:{type:T.SET_TOKEN_BALANCES,tokenBalances:t.allowedBalances}}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.debug(e.t0);case 14:case"end":return e.stop()}}),e,null,[[4,11]])}))),[i,s]);return(0,z.Y)(l,re),(0,q.jsx)(R.X,{testId:"bridge-view",header:(0,q.jsx)(O.F,{title:r.title,onCloseButtonClick:function(){return Z(c)}}),footer:(0,q.jsx)(F.w,{}),footerBackgroundColor:"base.color.translucent.emphasis.200",children:(0,q.jsx)(ee,{testId:"bridge-form",defaultAmount:t,defaultFromContractAddress:n})})}var oe,ie,se,ce,le,ue,de,pe,Ce,fe,ve,he,xe,Ee,me,ge,we,be,ye,ke,Te,Se,_e,Ae,Le,Ze,Ie,Re,Oe=n(87686),Fe=n(37324),Be=n(46207),je=n(57367),De=["title","titleId"];function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pe.apply(this,arguments)}function Me(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ne(e,t){var n=e.title,r=e.titleId,a=Me(e,De);return u.createElement("svg",Pe({width:430,height:305,viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":r},a),n?u.createElement("title",{id:r},n):null,oe||(oe=u.createElement("path",{d:"M237.062 225.632L236.632 224L235 224.429L235.429 226.061L237.062 225.632Z",fill:"white"})),ie||(ie=u.createElement("path",{d:"M77.6536 113.046L77.1011 110.945L75.0001 111.498L75.5526 113.599L77.6536 113.046Z",fill:"white"})),se||(se=u.createElement("path",{d:"M217.49 259.767L215.345 259.422L215 261.567L217.145 261.912L217.49 259.767Z",fill:"white"})),ce||(ce=u.createElement("path",{d:"M329.286 229.903L329.905 228.617L328.619 227.998L328 229.284L329.286 229.903Z",fill:"white"})),le||(le=u.createElement("path",{d:"M343.654 232.101L343.101 230L341 230.553L341.553 232.654L343.654 232.101Z",fill:"white"})),ue||(ue=u.createElement("path",{d:"M108.145 86.0867L107.219 85L106.133 85.9254L107.058 87.0121L108.145 86.0867Z",fill:"white"})),de||(de=u.createElement("path",{d:"M245.286 79.9032L245.905 78.6172L244.619 77.9981L244 79.2841L245.286 79.9032Z",fill:"white"})),pe||(pe=u.createElement("path",{d:"M357.035 104.828C342.422 108.188 327.288 113.519 308.048 122.173C290.669 129.989 277.909 136.409 266.089 144.401",stroke:"url(#paint0_linear_7960_25651)",strokeOpacity:.5,strokeLinecap:"round"})),Ce||(Ce=u.createElement("circle",{cx:317.542,cy:138.526,r:53.0265,fill:"url(#paint1_linear_7960_25651)",stroke:"black"})),fe||(fe=u.createElement("path",{d:"M329.77 187.999C357.163 181.371 373.998 153.792 367.37 126.399C360.731 143.887 290.336 170.158 268.169 150.398C274.797 177.792 302.376 194.626 329.77 187.999Z",fill:"#8E1A99",fillOpacity:.2})),ve||(ve=u.createElement("g",{clipPath:"url(#clip0_7960_25651)"},u.createElement("path",{d:"M315.876 108.739C317.272 108.055 318.742 108.102 320.095 108.87C324.787 111.543 329.465 114.24 334.119 116.966C335.617 117.846 336.385 119.255 336.39 120.988C336.418 127.061 336.408 133.129 336.39 139.202C336.39 139.427 336.245 139.754 336.062 139.862C334.259 140.939 332.433 141.974 330.453 143.116V142.161C330.453 135.915 330.434 129.673 330.467 123.427C330.471 122.228 330.059 121.456 328.996 120.852C323.551 117.757 318.133 114.606 312.706 111.473C312.472 111.337 312.243 111.192 311.887 110.977C313.282 110.185 314.537 109.389 315.867 108.739H315.876ZM314.879 170.869C314.575 170.714 314.35 170.606 314.13 170.48C306.942 166.336 299.764 162.164 292.554 158.053C290.531 156.901 289.608 155.258 289.632 152.949C289.674 148.042 289.66 143.135 289.637 138.223C289.627 136.009 290.526 134.403 292.474 133.298C297.536 130.418 302.569 127.496 307.603 124.57C308.038 124.317 308.357 124.275 308.811 124.546C310.548 125.59 312.318 126.588 314.167 127.655C313.816 127.866 313.549 128.025 313.278 128.184C307.827 131.331 302.387 134.487 296.922 137.615C296.028 138.125 295.611 138.79 295.621 139.829C295.649 143.697 295.653 147.565 295.621 151.432C295.611 152.5 296.037 153.179 296.955 153.703C302.719 157 308.46 160.333 314.219 163.639C314.706 163.92 314.912 164.21 314.902 164.791C314.86 166.772 314.888 168.757 314.888 170.873L314.879 170.869ZM314.879 159.79C314.378 159.505 314.018 159.303 313.657 159.093C309.087 156.456 304.522 153.811 299.942 151.193C299.446 150.913 299.263 150.608 299.268 150.032C299.301 147.059 299.287 144.086 299.277 141.112C299.277 140.71 299.338 140.433 299.736 140.209C301.422 139.268 303.089 138.284 304.761 137.324C304.882 137.254 305.013 137.203 305.233 137.095V140.433C305.233 142.241 305.262 144.053 305.224 145.86C305.201 146.89 305.599 147.588 306.498 148.094C309.087 149.555 311.644 151.072 314.233 152.528C314.743 152.814 314.898 153.132 314.888 153.694C314.856 155.67 314.874 157.65 314.874 159.786L314.879 159.79ZM309.602 120.763C308.633 120.192 307.804 120.196 306.835 120.763C301.403 123.938 295.948 127.07 290.498 130.217C290.269 130.352 290.03 130.474 289.622 130.694C289.768 128.625 289.323 126.672 290.03 124.78C290.414 123.746 291.135 122.968 292.09 122.416C296.637 119.789 301.179 117.157 305.734 114.545C307.397 113.59 309.092 113.613 310.754 114.573C315.928 117.551 321.097 120.538 326.257 123.535C326.477 123.661 326.753 123.947 326.753 124.162C326.791 126.288 326.777 128.419 326.777 130.699C324.899 129.617 323.167 128.615 321.434 127.613C317.487 125.333 313.531 123.076 309.602 120.763ZM345.96 154.19C345.825 155.862 344.846 157.046 343.399 157.88C337.86 161.064 332.325 164.267 326.791 167.46C325.054 168.462 323.317 169.464 321.575 170.466C321.364 170.588 321.149 170.691 320.863 170.841C320.844 170.55 320.821 170.34 320.821 170.129C320.821 168.293 320.83 166.463 320.812 164.627C320.812 164.21 320.91 163.958 321.294 163.737C329.366 159.093 337.434 154.434 345.497 149.779C345.619 149.709 345.754 149.653 345.984 149.545C345.984 151.175 346.078 152.692 345.96 154.19ZM346.003 142.634C345.989 144.535 344.963 145.87 343.338 146.806C337.027 150.435 330.719 154.082 324.412 157.725C323.26 158.39 322.104 159.05 320.868 159.762C320.849 159.448 320.826 159.242 320.826 159.032C320.826 157.224 320.844 155.412 320.812 153.605C320.802 153.09 320.975 152.818 321.42 152.561C327.156 149.269 332.873 145.94 338.619 142.667C339.639 142.086 340.089 141.37 340.079 140.171C340.037 133.925 340.061 127.679 340.061 121.432V120.341C341.559 121.245 342.964 121.99 344.247 122.898C345.417 123.727 346.007 124.982 346.012 126.429C346.031 131.832 346.045 137.235 346.007 142.639L346.003 142.634Z",fill:"white"}))),u.createElement("mask",{id:"mask0_7960_25651",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:283,y:105,width:69,height:69},he||(he=u.createElement("g",{clipPath:"url(#clip1_7960_25651)"},u.createElement("path",{d:"M315.876 108.739C317.272 108.055 318.742 108.102 320.095 108.87C324.787 111.543 329.465 114.24 334.119 116.966C335.617 117.846 336.385 119.255 336.39 120.988C336.418 127.061 336.408 133.129 336.39 139.202C336.39 139.427 336.245 139.754 336.062 139.862C334.259 140.939 332.433 141.974 330.453 143.116V142.161C330.453 135.915 330.434 129.673 330.467 123.427C330.471 122.228 330.059 121.456 328.996 120.852C323.551 117.757 318.133 114.606 312.706 111.473C312.472 111.337 312.243 111.192 311.887 110.977C313.282 110.185 314.537 109.389 315.867 108.739H315.876ZM314.879 170.869C314.575 170.714 314.35 170.606 314.13 170.48C306.942 166.336 299.764 162.164 292.554 158.053C290.531 156.901 289.608 155.258 289.632 152.949C289.674 148.042 289.66 143.135 289.637 138.223C289.627 136.009 290.526 134.403 292.474 133.298C297.536 130.418 302.569 127.496 307.603 124.57C308.038 124.317 308.357 124.275 308.811 124.546C310.548 125.59 312.318 126.588 314.167 127.655C313.816 127.866 313.549 128.025 313.278 128.184C307.827 131.331 302.387 134.487 296.922 137.615C296.028 138.125 295.611 138.79 295.621 139.829C295.649 143.697 295.653 147.565 295.621 151.432C295.611 152.5 296.037 153.179 296.955 153.703C302.719 157 308.46 160.333 314.219 163.639C314.706 163.92 314.912 164.21 314.902 164.791C314.86 166.772 314.888 168.757 314.888 170.873L314.879 170.869ZM314.879 159.79C314.378 159.505 314.018 159.303 313.657 159.093C309.087 156.456 304.522 153.811 299.942 151.193C299.446 150.913 299.263 150.608 299.268 150.032C299.301 147.059 299.287 144.086 299.277 141.112C299.277 140.71 299.338 140.433 299.736 140.209C301.422 139.268 303.089 138.284 304.761 137.324C304.882 137.254 305.013 137.203 305.233 137.095V140.433C305.233 142.241 305.262 144.053 305.224 145.86C305.201 146.89 305.599 147.588 306.498 148.094C309.087 149.555 311.644 151.072 314.233 152.528C314.743 152.814 314.898 153.132 314.888 153.694C314.856 155.67 314.874 157.65 314.874 159.786L314.879 159.79ZM309.602 120.763C308.633 120.192 307.804 120.196 306.835 120.763C301.403 123.938 295.948 127.07 290.498 130.217C290.269 130.352 290.03 130.474 289.622 130.694C289.768 128.625 289.323 126.672 290.03 124.78C290.414 123.746 291.135 122.968 292.09 122.416C296.637 119.789 301.179 117.157 305.734 114.545C307.397 113.59 309.092 113.613 310.754 114.573C315.928 117.551 321.097 120.538 326.257 123.535C326.477 123.661 326.753 123.947 326.753 124.162C326.791 126.288 326.777 128.419 326.777 130.699C324.899 129.617 323.167 128.615 321.434 127.613C317.487 125.333 313.531 123.076 309.602 120.763ZM345.96 154.19C345.825 155.862 344.846 157.046 343.399 157.88C337.86 161.064 332.325 164.267 326.791 167.46C325.054 168.462 323.317 169.464 321.575 170.466C321.364 170.588 321.149 170.691 320.863 170.841C320.844 170.55 320.821 170.34 320.821 170.129C320.821 168.293 320.83 166.463 320.812 164.627C320.812 164.21 320.91 163.958 321.294 163.737C329.366 159.093 337.434 154.434 345.497 149.779C345.619 149.709 345.754 149.653 345.984 149.545C345.984 151.175 346.078 152.692 345.96 154.19ZM346.003 142.634C345.989 144.535 344.963 145.87 343.338 146.806C337.027 150.435 330.719 154.082 324.412 157.725C323.26 158.39 322.104 159.05 320.868 159.762C320.849 159.448 320.826 159.242 320.826 159.032C320.826 157.224 320.844 155.412 320.812 153.605C320.802 153.09 320.975 152.818 321.42 152.561C327.156 149.269 332.873 145.94 338.619 142.667C339.639 142.086 340.089 141.37 340.079 140.171C340.037 133.925 340.061 127.679 340.061 121.432V120.341C341.559 121.245 342.964 121.99 344.247 122.898C345.417 123.727 346.007 124.982 346.012 126.429C346.031 131.832 346.045 137.235 346.007 142.639L346.003 142.634Z",fill:"white"})))),xe||(xe=u.createElement("g",{mask:"url(#mask0_7960_25651)"},u.createElement("path",{d:"M291.76 165.571C332.23 151.847 340.141 119.264 339.038 104.688L364.097 123.185L356.266 161.417L312.631 179.586L291.76 165.571Z",fill:"#D8EFF4"}))),Ee||(Ee=u.createElement("path",{d:"M360.939 103.844C377.969 99.9995 389.18 100.259 391.515 105.45C395.816 115.012 365.873 137.8 324.636 156.347C283.399 174.895 246.484 182.179 242.183 172.617C239.658 167.003 246.416 157.661 262.853 146.465",stroke:"url(#paint2_linear_7960_25651)",strokeLinecap:"round"})),me||(me=u.createElement("path",{d:"M360.297 101.798C377.936 98.1421 390.54 99.2236 393.158 105.043C397.979 115.764 367.023 138.813 324.633 157.879C282.243 176.945 245.266 184.305 240.444 173.584C237.613 167.29 244.341 157.199 261.105 145.395",stroke:"black",strokeLinecap:"round"})),ge||(ge=u.createElement("path",{d:"M178.664 201.347C178.664 233.296 152.824 259.194 120.952 259.194C89.0802 259.194 63.2407 233.296 63.2407 201.347C63.2407 169.398 89.0802 143.5 120.952 143.5C152.824 143.5 178.664 169.398 178.664 201.347Z",fill:"url(#paint3_linear_7960_25651)",stroke:"black"})),we||(we=u.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M121.073 243.155L144.256 202.75L121.073 214.535L97.8906 202.75L121.073 243.155Z",fill:"white"})),be||(be=u.createElement("path",{d:"M97.8931 199.507L121.076 159.102L144.258 199.507H121.076H97.8931Z",fill:"white"})),ye||(ye=u.createElement("path",{d:"M144.258 199.504L121.075 211.264L97.8924 199.504L121.075 199.504L144.258 199.504Z",fill:"white"})),ke||(ke=u.createElement("path",{d:"M166.658 233.62C178.349 216.327 179.32 190.881 168.965 173.805C151.595 213.313 121.865 233.62 78.5696 236.842C102.825 266.549 148.923 259.853 166.658 233.62Z",fill:"#07064F",fillOpacity:.15})),Te||(Te=u.createElement("path",{d:"M87.5327 157.032C100.078 147.323 115.438 143.254 129.904 145.704C150.57 149.205 145.709 160.697 112.043 173.391C82.6238 184.48 64.918 182.798 77.5747 166.905C80.4378 163.313 83.7362 159.968 87.5327 157.032Z",fill:"white",fillOpacity:.3})),Se||(Se=u.createElement("path",{d:"M181.569 133.111C181.562 133.11 181.556 133.109 181.55 133.108L179.165 122.193C179.17 122.189 179.175 122.186 179.18 122.183C179.372 122.055 179.653 121.871 180.009 121.645C180.721 121.194 181.733 120.578 182.93 119.922C185.332 118.605 188.444 117.145 191.359 116.508C198.775 114.887 203.969 115.589 207.446 116.856C210.636 118.019 212.409 119.667 213.141 120.484C212.809 121.531 211.884 123.769 209.473 126.157C206.843 128.761 202.42 131.568 195.004 133.188C192.09 133.825 188.652 133.796 185.92 133.602C184.558 133.505 183.382 133.367 182.546 133.254C182.128 133.198 181.796 133.147 181.569 133.111Z",fill:"#D8EFF4",stroke:"black"})),_e||(_e=u.createElement("path",{d:"M196.315 119.732C193.873 119.71 191.857 121.691 191.835 124.133C191.814 126.575 193.794 128.591 196.236 128.612C198.678 128.634 200.694 126.654 200.716 124.211C200.737 121.769 198.757 119.754 196.315 119.732Z",fill:"#B9E4EB"})),Ae||(Ae=u.createElement("path",{d:"M198.5 121C199 125 197 127 194 127.5C194 127.5 196.791 129.209 199 127C200.5 125.5 200.5 122 198.5 121Z",fill:"#0D0D0D",fillOpacity:.8})),Le||(Le=u.createElement("path",{d:"M172.591 135.517C174.09 135.19 175.478 134.29 176.379 132.886C178.18 130.078 177.367 126.358 174.559 124.557C173.155 123.656 171.517 123.418 170.018 123.746C166.742 124.462 160.199 132.058 160.199 132.058C160.199 132.058 169.314 136.233 172.591 135.517Z",fill:"#F7A5FF"})),Ze||(Ze=u.createElement("path",{d:"M168.805 129.416C168.821 127.604 170.319 126.133 172.13 126.149C173.942 126.165 175.413 127.662 175.397 129.474C175.381 131.285 173.883 132.757 172.072 132.741C170.26 132.725 168.789 131.227 168.805 129.416Z",fill:"white",stroke:"white"})),Ie||(Ie=u.createElement("path",{d:"M185.076 108.993L185.076 108.993L185.082 108.992C186.451 108.764 187.314 109.084 187.95 109.539C188.28 109.775 188.562 110.055 188.83 110.349C188.906 110.432 188.985 110.521 189.064 110.61C189.244 110.813 189.43 111.022 189.608 111.194L193.874 115.754C191.219 116.516 188.868 117.285 187.075 117.921C186.091 118.27 185.272 118.581 184.662 118.829C184.357 118.953 184.101 119.063 183.901 119.155C183.891 119.16 183.88 119.165 183.87 119.17L177.383 110.179L185.076 108.993ZM191.929 143.004L191.908 143.007L191.887 143.012L184.021 144.833L186.693 134.016C186.72 134.016 186.748 134.015 186.777 134.015C187.01 134.011 187.307 133.998 187.658 133.977C188.362 133.934 189.295 133.856 190.396 133.744C192.395 133.541 194.953 133.227 197.692 132.807L195.594 138.567C195.494 138.82 195.408 139.143 195.323 139.464C195.291 139.582 195.26 139.699 195.228 139.812C195.101 140.267 194.948 140.734 194.716 141.171C194.267 142.013 193.506 142.778 191.929 143.004Z",fill:"#D8EFF4",stroke:"black"})),Re||(Re=u.createElement("defs",null,u.createElement("linearGradient",{id:"paint0_linear_7960_25651",x1:319.128,y1:123.809,x2:273.059,y2:144.336,gradientUnits:"userSpaceOnUse"},u.createElement("stop",{stopColor:"#FEF5FF"}),u.createElement("stop",{offset:.00520833,stopColor:"#B6FFFB",stopOpacity:.5}),u.createElement("stop",{offset:1,stopColor:"#F3A0FB"})),u.createElement("linearGradient",{id:"paint1_linear_7960_25651",x1:301.219,y1:117.255,x2:335.071,y2:151.746,gradientUnits:"userSpaceOnUse"},u.createElement("stop",{stopColor:"#F58FFF"}),u.createElement("stop",{offset:.880208,stopColor:"#F191FA",stopOpacity:.54})),u.createElement("linearGradient",{id:"paint2_linear_7960_25651",x1:284.004,y1:196.45,x2:402.482,y2:59.4686,gradientUnits:"userSpaceOnUse"},u.createElement("stop",{stopColor:"#F191FA"}),u.createElement("stop",{offset:.857753,stopColor:"white"}),u.createElement("stop",{offset:.932292,stopColor:"white"})),u.createElement("linearGradient",{id:"paint3_linear_7960_25651",x1:82.17,y1:159.191,x2:167.404,y2:246.589,gradientUnits:"userSpaceOnUse"},u.createElement("stop",{offset:.0729167,stopColor:"#B5C0F2"}),u.createElement("stop",{offset:.96875,stopColor:"#B9C6FE",stopOpacity:.43})),u.createElement("clipPath",{id:"clip0_7960_25651"},u.createElement("rect",{width:67.6987,height:67.6987,fill:"white",transform:"translate(283.974 105.438)"})),u.createElement("clipPath",{id:"clip1_7960_25651"},u.createElement("rect",{width:67.6987,height:67.6987,fill:"white",transform:"translate(283.974 105.438)"})))))}var Ue=u.forwardRef(Ne),We=(n.p,n(6609));function Ve(){return(0,q.jsx)(C.xu,{sx:(0,y.Z)((0,y.Z)({},We.q_),{},{background:"base.color.translucent.emphasis.100"}),children:(0,q.jsx)(C.xu,{sx:We.Tb,children:(0,q.jsx)(Ue,{})})})}function Ge(e){var t=e.token,n=e.transactionResponse,r=e.bridgeForm,a=(0,u.useContext)(b.A7).viewDispatch,o=(0,u.useContext)(te.yh).eventTargetState.eventTarget,i=M.f.views[I.O.IN_PROGRESS],s=i.heading,c=i.body1,l=i.body2,d=(0,u.useContext)(S).bridgeState.tokenBridge;return(0,u.useEffect)((function(){d&&(0,h.Z)((0,v.Z)().mark((function e(){var t;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.wait();case 3:if(1!==(t=e.sent).status){e.next=11;break}return e.next=7,d.waitForDeposit({transactionHash:t.transactionHash});case 7:if(e.sent.status!==g.$x.SUCCESS){e.next=11;break}return a({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.SUCCESS,data:{transactionHash:t.transactionHash}}}}),e.abrupt("return");case 11:a({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.FAIL,data:r}}}),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),a({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.FAIL,data:r,reason:"Transaction failed"}}});case 17:case"end":return e.stop()}}),e,null,[[0,14]])})))()}),[n,d]),(0,q.jsx)(R.X,{testId:"move-in-progress-view",header:(0,q.jsx)(O.F,{transparent:!0,onCloseButtonClick:function(){return Z(o)}}),footer:(0,q.jsx)(F.w,{}),heroContent:(0,q.jsx)(Ve,{}),floatHeader:!0,children:(0,q.jsxs)(je.b,{heading:s,children:[c(null===t||void 0===t?void 0:t.symbol),(0,q.jsx)("br",{}),(0,q.jsx)("br",{}),l]})})}var Ke=n(74),He=n(33398),Xe=n(12946),ze=n(94372);function Qe(e){var t=e.data,n=(0,u.useContext)(S).bridgeState.allowedTokens,r=(0,u.useContext)($.R4).connectLoaderState,a=r.checkout,o=r.provider,i=(0,u.useContext)(b.A7).viewDispatch,s=M.f.views[I.O.APPROVE_ERC20],c=s.approveSpending,l=s.approveBridge,p=(0,u.useContext)(te.yh).eventTargetState.eventTarget,f=(0,u.useState)(!1),E=(0,x.Z)(f,2),m=E[0],g=E[1],w=(0,u.useState)(!1),y=(0,x.Z)(w,2),k=y[0],T=y[1],_=(0,u.useState)(!1),L=(0,x.Z)(_,2),F=L[0],B=L[1],j=(0,u.useState)(!1),D=(0,x.Z)(j,2),P=D[0],N=D[1],U=(0,u.useState)(!1),W=(0,x.Z)(U,2),V=W[0],G=W[1],K=(0,u.useMemo)((function(){return n.find((function(e){return e.address===t.bridgeFormInfo.fromContractAddress||"NATIVE"===e.address}))}),[n,t.bridgeFormInfo.fromContractAddress]),H=(0,u.useCallback)((function(){i({payload:{type:b.Cp.UPDATE_VIEW,view:{type:b.cZ.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[i]),X=(0,u.useCallback)((function(){i({payload:{type:b.Cp.GO_BACK}})}),[i]),z=function(e,t){e.type!==d.XQ.UNPREDICTABLE_GAS_LIMIT?e.type===d.XQ.TRANSACTION_FAILED||e.type===d.XQ.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?i({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.FAIL,reason:"Transaction failed",data:t}}}):i({payload:{type:b.Cp.UPDATE_VIEW,view:{type:b.cZ.ERROR_VIEW,error:e}}}):i({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.FAIL,data:t}}})},Q=(0,u.useCallback)((0,h.Z)((0,v.Z)().mark((function e(){var n;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a&&o){e.next=3;break}return H(),e.abrupt("return");case 3:if(!m){e.next=5;break}return e.abrupt("return");case 5:if(g(!0),e.prev=6,t.approveTransaction.unsignedTx){e.next=9;break}return e.abrupt("return");case 9:return e.next=11,a.sendTransaction({provider:o,transaction:t.approveTransaction.unsignedTx});case 11:return n=e.sent,T(!0),e.next=15,n.transactionResponse.wait();case 15:if(1===e.sent.status){e.next=19;break}return i({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.FAIL,data:t.bridgeFormInfo}}}),e.abrupt("return");case 19:T(!1),g(!1),B(!0),e.next=32;break;case 24:if(e.prev=24,e.t0=e.catch(6),T(!1),g(!1),e.t0.type!==d.XQ.USER_REJECTED_REQUEST_ERROR){e.next=31;break}return N(!0),e.abrupt("return");case 31:z(e.t0,t.bridgeFormInfo);case 32:case"end":return e.stop()}}),e,null,[[6,24]])}))),[a,o,H,i,G,t.approveTransaction,t.bridgeFormInfo,m,g,T]),Y=(0,u.useMemo)((function(){return(0,q.jsx)(je.b,{heading:c.content.heading,children:(0,q.jsx)(C.xu,{children:"".concat(c.content.body[0]," ").concat(t.bridgeFormInfo.fromAmount," ").concat((null===K||void 0===K?void 0:K.symbol)||""," ").concat(c.content.body[1])})})}),[t.bridgeFormInfo,K]),J=(0,u.useMemo)((function(){return(0,q.jsx)(He.S,{actionText:P?c.footer.retryText:c.footer.buttonText,onActionClick:Q})}),[P,Q]),ee=(0,u.useCallback)((0,h.Z)((0,v.Z)().mark((function e(){var n;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a&&o){e.next=3;break}return H(),e.abrupt("return");case 3:if(!m){e.next=5;break}return e.abrupt("return");case 5:return g(!0),e.prev=6,e.next=9,a.sendTransaction({provider:o,transaction:t.transaction.unsignedTx});case 9:n=e.sent,g(!1),i({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.IN_PROGRESS,data:{token:K,transactionResponse:n.transactionResponse,bridgeForm:t.bridgeFormInfo}}}}),e.next=21;break;case 14:if(e.prev=14,e.t0=e.catch(6),g(!1),e.t0.type!==d.XQ.USER_REJECTED_REQUEST_ERROR){e.next=20;break}return G(!0),e.abrupt("return");case 20:z(e.t0,t.bridgeFormInfo);case 21:case"end":return e.stop()}}),e,null,[[6,14]])}))),[a,o,H,i,G,t.transaction,t.bridgeFormInfo,m,g]),ne=(0,q.jsx)(je.b,{heading:l.content.heading,children:(0,q.jsx)(C.xu,{children:l.content.body})}),re=(0,u.useMemo)((function(){return(0,q.jsx)(He.S,{actionText:V?l.footer.retryText:l.footer.buttonText,onActionClick:ee})}),[V,ee]);return(0,q.jsxs)(q.Fragment,{children:[k&&(0,q.jsx)(A.J,{loadingText:c.loading.text,showFooterLogo:!0}),!k&&(0,q.jsx)(R.X,{header:(0,q.jsx)(O.F,{transparent:!0,showBack:!0,onCloseButtonClick:function(){return Z(p)},onBackButtonClick:X}),floatHeader:!0,heroContent:F?(0,q.jsx)(Xe.P,{}):(0,q.jsx)(ze.N,{}),footer:F?re:J,children:F?ne:Y})]})}var Ye=n(48543);function Je(e){var t,n,r,a,o=e.params,i=e.config,s=i.environment,c=i.theme,l=M.f.views[I.O.SUCCESS],p=M.f.views[I.O.FAIL],f=M.f.views[b.cZ.LOADING_VIEW].text,y=M.f.views[b.cZ.ERROR_VIEW],R=(0,u.useContext)($.R4).connectLoaderState,O=R.checkout,F=R.provider,B=(0,u.useReducer)(b.Uy,b.NW),j=(0,x.Z)(B,2),D=j[0],P=j[1],N=(0,u.useReducer)(_,k),U=(0,x.Z)(N,2),W=U[0],V=U[1],G=(0,u.useMemo)((function(){return{viewState:D,viewDispatch:P}}),[D,P]),K=(0,u.useMemo)((function(){return{bridgeState:W,bridgeDispatch:V}}),[W,V]),H=(0,u.useMemo)((function(){return(0,Ye.e)(c)}),[c]),X=(0,u.useState)(!1),z=(0,x.Z)(X,2),Q=z[0],Y=z[1],J=(0,u.useContext)(te.yh).eventTargetState.eventTarget,ee=o.amount,re=o.fromContractAddress,oe=(0,u.useCallback)((function(e,t){P({payload:{type:b.Cp.UPDATE_VIEW,view:{type:b.cZ.ERROR_VIEW,tryAgain:t,error:e}}})}),[P]),ie=(0,u.useCallback)((function(){P({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.BRIDGE}}})}),[P]),se=function(){var e=(0,h.Z)((0,v.Z)().mark((function e(){var t;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O){e.next=2;break}throw new Error("loadBalances: missing checkout");case 2:if(F){e.next=4;break}throw new Error("loadBalances: missing provider");case 4:return t={allowList:{tokens:[]},allowedBalances:[]},e.prev=5,e.next=8,(0,ne.Z)({checkout:O,provider:F,allowTokenListType:d.Zs.BRIDGE});case 8:t=e.sent,e.next=16;break;case 11:if(e.prev=11,e.t0=e.catch(5),!w.NA.nonRetryable(e.t0)){e.next=16;break}return oe(e.t0,se),e.abrupt("return",!1);case 16:return V({payload:{type:T.SET_ALLOWED_TOKENS,allowedTokens:t.allowList.tokens}}),V({payload:{type:T.SET_TOKEN_BALANCES,tokenBalances:t.allowedBalances}}),e.abrupt("return",!0);case 19:case"end":return e.stop()}}),e,null,[[5,11]])})));return function(){return e.apply(this,arguments)}}();return(0,u.useEffect)((function(){var e=function(){var e=(0,h.Z)((0,v.Z)().mark((function e(){var t,n,r,a,o,s,c,l,u;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O&&F){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,O.getNetworkInfo({provider:F});case 4:if((r=e.sent).isSupported){e.next=7;break}return e.abrupt("return");case 7:return V({payload:{type:T.SET_NETWORK,network:r}}),a=new m.r(null===(t=O.config.networkMap.get((0,w.Tz)(O.config)))||void 0===t?void 0:t.rpcUrls[0]),o=(0,w.D3)(O.config),s=new m.r(null===(n=O.config.networkMap.get(o))||void 0===n?void 0:n.rpcUrls[0]),c=g.JU,O.config.isDevelopment&&(c=g.MY),O.config.isProduction&&(c=g.R3),V({payload:{type:T.SET_TOKEN_BRIDGE,tokenBridge:new g.wy(new g.jR({baseConfig:new E.L(i),bridgeInstance:c,rootProvider:a,childProvider:s}))}}),e.next=17,O.getNetworkAllowList({type:d.aF.ALL});case 17:return l=e.sent,(u=l.networks.find((function(e){return e.chainId===o})))&&V({payload:{type:T.SET_TO_NETWORK,toNetwork:u}}),e.next=22,se();case 22:if(e.sent){e.next=24;break}return e.abrupt("return");case 24:ie();case 25:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[O,F]),(0,q.jsx)(C.mD,{theme:{base:H},children:(0,q.jsx)(b.A7.Provider,{value:G,children:(0,q.jsx)(S.Provider,{value:K,children:(0,q.jsxs)(Be.e,{environment:s,children:[G.viewState.view.type===b.cZ.LOADING_VIEW&&(0,q.jsx)(A.J,{loadingText:f}),G.viewState.view.type===I.O.BRIDGE&&(0,q.jsx)(ae,{amount:null!==(t=null===(n=G.viewState.view.data)||void 0===n?void 0:n.fromAmount)&&void 0!==t?t:ee,fromContractAddress:null!==(r=null===(a=G.viewState.view.data)||void 0===a?void 0:a.fromContractAddress)&&void 0!==r?r:re}),G.viewState.view.type===I.O.IN_PROGRESS&&(0,q.jsx)(Ge,{token:G.viewState.view.data.token,transactionResponse:G.viewState.view.data.transactionResponse,bridgeForm:G.viewState.view.data.bridgeForm}),G.viewState.view.type===I.O.APPROVE_ERC20&&(0,q.jsx)(Qe,{data:G.viewState.view.data}),G.viewState.view.type===I.O.SUCCESS&&(0,q.jsx)(Fe.l,{statusText:l.text,actionText:l.actionText,onActionClick:function(){return Z(J)},onRenderEvent:function(){return function(e,t){var n=new CustomEvent(L.O6.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:L.rw.SUCCESS,data:{transactionHash:t}}});console.log("bridge success ",e,n),void 0!==e&&e.dispatchEvent(n)}(J,G.viewState.view.data.transactionHash)},statusType:Oe.i.SUCCESS,testId:"success-view"}),G.viewState.view.type===I.O.FAIL&&(0,q.jsx)(Fe.l,{statusText:p.text,actionText:p.actionText,onActionClick:function(){D.view.type===I.O.FAIL&&P({payload:{type:b.Cp.UPDATE_VIEW,view:{type:I.O.BRIDGE,data:D.view.data}}})},onRenderEvent:function(){return function(e,t){var n=new CustomEvent(L.O6.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:L.rw.FAILURE,data:{reason:t,timestamp:(new Date).getTime()}}});console.log("bridge failed ",e,n),void 0!==e&&e.dispatchEvent(n)}(J,"Transaction failed")},onCloseClick:function(){return Z(J)},statusType:Oe.i.FAILURE,testId:"fail-view"}),G.viewState.view.type===b.cZ.ERROR_VIEW&&(0,q.jsx)(Ke.o,{actionText:y.actionText,onActionClick:(0,h.Z)((0,v.Z)().mark((function e(){var t;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Y(!0),(t=D.view).tryAgain){e.next=6;break}return ie(),Y(!1),e.abrupt("return");case 6:return e.next=8,t.tryAgain();case 8:if(!e.sent){e.next=10;break}ie();case 10:Y(!1);case 11:case"end":return e.stop()}}),e)}))),onCloseClick:function(){return Z(J)},errorEventActionLoading:Q})]})})})})}var $e=n(73966),qe=n(79394),et=n(29601),tt=n(35314),nt=n(36303),rt=n(95110),at=function(e){(0,c.Z)(n,e);var t=(0,l.Z)(n);function n(){var e;(0,a.Z)(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))).fromContractAddress="",e.amount="",e.walletProvider=void 0,e}return(0,o.Z)(n,[{key:"connectedCallback",value:function(){var e,t,r,a;(0,i.Z)((0,s.Z)(n.prototype),"connectedCallback",this).call(this),this.fromContractAddress=null!==(e=null===(t=this.getAttribute("fromContractAddress"))||void 0===t?void 0:t.toLowerCase())&&void 0!==e?e:"",this.amount=null!==(r=this.getAttribute("amount"))&&void 0!==r?r:"",this.walletProvider=null===(a=this.getAttribute("walletProvider"))||void 0===a?void 0:a.toLowerCase(),this.renderWidget()}},{key:"attributeChangedCallback",value:function(e,t,r){(0,i.Z)((0,s.Z)(n.prototype),"attributeChangedCallback",this).call(this,e,t,r),"amount"===e&&(this.amount=r),"fromcontractaddress"===e&&(this.fromContractAddress=r),"walletprovider"===e&&(this.walletProvider=r.toLowerCase()),this.renderWidget()}},{key:"validateInputs",value:function(){(0,et.Qh)(this.walletProvider)||(console.warn('[IMTBL]: invalid "walletProvider" widget input'),this.walletProvider=void 0),(0,et.g1)(this.amount)||(console.warn('[IMTBL]: invalid "amount" widget input'),this.amount=""),(0,et.At)(this.fromContractAddress)||(console.warn('[IMTBL]: invalid "fromContractAddress" widget input'),this.fromContractAddress="")}},{key:"renderWidget",value:function(){this.validateInputs();var e={targetLayer:w.PU.LAYER1,walletProvider:this.walletProvider,web3Provider:this.provider,passport:this.passport,allowedChains:[(0,w.Tz)(this.checkout.config)]},t={fromContractAddress:this.fromContractAddress,amount:this.amount};this.reactRoot||(this.reactRoot=p.createRoot(this));var n=(0,tt.T)(this.provider)||this.walletProvider===d.Zb.PASSPORT;this.reactRoot.render((0,q.jsx)(u.StrictMode,{children:(0,q.jsx)(C.jU,{children:(0,q.jsxs)(rt.$,{widgetConfig:this.widgetConfig,children:[n&&(0,q.jsx)(C.mD,{theme:{base:f.Zh},children:(0,q.jsx)(nt.x,{onCloseEvent:function(){return Z(window)}})}),!n&&(0,q.jsx)(qe.X,{params:e,closeEvent:function(){return Z(window)},widgetConfig:this.widgetConfig,children:(0,q.jsx)(Je,{params:t,config:this.widgetConfig})})]})})}))}}],[{key:"observedAttributes",get:function(){var e=(0,i.Z)((0,s.Z)(n),"observedAttributes",this);return[].concat((0,r.Z)(e),["amount","fromcontractaddress","walletprovider"])}}]),n}($e.D)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_imtbl_checkout_widgets_lib=self.webpackChunk_imtbl_checkout_widgets_lib||[]).push([[175],{41175:function(t,e,i){i.r(e),i.d(e,{ImmutableConnect:function(){return k}});var n=i(8821),a=i(85169),c=i(69803),s=i(2312),r=i(82248),o=i(8416),l=i(65535),h=i(64093),u=i(50940),d=i(56323),p=i(73966),f=i(95110),g=i(10256),k=function(t){(0,r.Z)(i,t);var e=(0,o.Z)(i);function i(){return(0,n.Z)(this,i),e.apply(this,arguments)}return(0,a.Z)(i,[{key:"connectedCallback",value:function(){(0,c.Z)((0,s.Z)(i.prototype),"connectedCallback",this).call(this),this.renderWidget()}},{key:"attributeChangedCallback",value:function(t,e,n){(0,c.Z)((0,s.Z)(i.prototype),"attributeChangedCallback",this).call(this,t,e,n),this.renderWidget()}},{key:"validateInputs",value:function(){}},{key:"renderWidget",value:function(){this.validateInputs(),this.reactRoot||(this.reactRoot=h.createRoot(this)),this.reactRoot.render((0,g.jsx)(l.StrictMode,{children:(0,g.jsx)(u.jU,{children:(0,g.jsx)(f.$,{widgetConfig:this.widgetConfig,children:(0,g.jsx)(d.z,{config:this.widgetConfig,params:{passport:this.passport}})})})}))}}]),i}(p.D)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_imtbl_checkout_widgets_lib=self.webpackChunk_imtbl_checkout_widgets_lib||[]).push([[362],{79394:function(e,t,n){n.d(t,{X:function(){return S}});var r=n(37755),o=n(46999),a=n(18950),i=n(72771),c=n(50940),u=n(46385),s=n(29956),f=n(38339),p=n(65535),l=n(62290),d=n(55820),v=n(33939),T=n(56323),E=n(37977),h=n(74),C=n(26763),N=n(95175),O=n(88788),_=n(46616),y=n(10256);function S(e){var t,n=e.children,S=e.params,b=e.widgetConfig,w=e.closeEvent,k=(0,p.useReducer)(d.Tn,d.pk),x=(0,i.Z)(k,2),m=x[0],Z=x[1],I=(0,p.useMemo)((function(){return{connectLoaderState:m,connectLoaderDispatch:Z}}),[m,Z]),R=m.connectionStatus,D=m.deepLink,L=m.checkout,g=m.provider,A=S.targetLayer,P=S.walletProvider,V=S.allowedChains,K=S.passport,M=null!==A&&void 0!==A?A:C.PU.LAYER2,F=b.theme.toLowerCase()===C.R2.LIGHT.toLowerCase()?f.Ai:f.Zh,U=(0,p.useState)(),W=(0,i.Z)(U,2),Q=W[0],j=W[1],Y=(0,p.useState)(0),B=(0,i.Z)(Y,2),G=B[0],H=B[1],X=(0,O.z$)().identify;t=(0,N.Y)((function(){return function(){if(S.web3Provider&&s.hZ.isWeb3Provider(S.web3Provider))return Z({payload:{type:d.V1.SET_PROVIDER,provider:S.web3Provider}}),j(!0),void t();if(G>=9)return j(!1),void t();H(G+1)}()}),10),(0,p.useEffect)((function(){if(!g)return function(){};function e(e){return t.apply(this,arguments)}function t(){return(t=(0,a.Z)((0,o.Z)().mark((function e(t){var n;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==t.length){e.next=4;break}Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.NOT_CONNECTED,deepLink:E.w.READY_TO_CONNECT}}),e.next=8;break;case 4:return n=new u.Q(g.provider),e.next=7,(0,_.$)(X,n);case 7:Z({payload:{type:d.V1.SET_PROVIDER,provider:n}});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function n(){Z({payload:{type:d.V1.SET_PROVIDER,provider:new u.Q(g.provider)}})}return(0,C.qk)(g,e),(0,C.i0)(g,n),function(){(0,C.Lf)(g,e),(0,C.yZ)(g,n)}}),[g,X]),(0,p.useEffect)((function(){Z({payload:{type:d.V1.SET_CHECKOUT,checkout:new s.hZ({baseConfig:{environment:b.environment}})}})}),[b]),(0,p.useEffect)((function(){if(void 0===window)return console.error("missing window object: please run Checkout client side"),function(){};if(void 0===Q)return function(){};(0,a.Z)((0,o.Z)().mark((function e(){var t,n,r;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(L){e.next=2;break}return e.abrupt("return");case 2:if(P||g){e.next=5;break}return Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.NOT_CONNECTED_NO_PROVIDER,deepLink:E.w.CONNECT_WALLET}}),e.abrupt("return");case 5:if(e.prev=5,g||!P){e.next=12;break}return e.next=9,L.createProvider({walletProvider:P,passport:K});case 9:return t=e.sent,Z({payload:{type:d.V1.SET_PROVIDER,provider:t.provider}}),e.abrupt("return");case 12:if(g){e.next=15;break}return Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.NOT_CONNECTED_NO_PROVIDER,deepLink:E.w.CONNECT_WALLET}}),e.abrupt("return");case 15:return e.next=17,L.checkIsWalletConnected({provider:g});case 17:if(n=e.sent,n.isConnected){e.next=22;break}return Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.NOT_CONNECTED,deepLink:E.w.READY_TO_CONNECT}}),e.abrupt("return");case 22:return e.next=24,L.getNetworkInfo({provider:g});case 24:if((r=e.sent).isSupported&&V.includes(r.chainId)){e.next=28;break}return Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.CONNECTED_WRONG_NETWORK,deepLink:E.w.SWITCH_NETWORK}}),e.abrupt("return");case 28:return e.next=30,(0,_.$)(X,g);case 30:Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.CONNECTED_WITH_NETWORK}}),e.next=36;break;case 33:e.prev=33,e.t0=e.catch(5),Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.ERROR}});case 36:case"end":return e.stop()}}),e,null,[[5,33]])})))();var e=function(e){switch(e.detail.type){case l.XP.SUCCESS:var t=e.detail.data;Z({payload:{type:d.V1.SET_PROVIDER,provider:t.provider}}),Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.CONNECTED_WITH_NETWORK}});break;case l.XP.FAILURE:default:Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.ERROR}})}};return window.addEventListener(l.O6.IMTBL_CONNECT_WIDGET_EVENT,e),function(){window.removeEventListener(l.O6.IMTBL_CONNECT_WIDGET_EVENT,e)}}),[L,g,P,Q]);var q=(0,p.useCallback)((function(e){return p.Children.map(e,(function(e){return p.cloneElement(e,{web3Provider:g})}))}),[g]);return(0,y.jsxs)(y.Fragment,{children:[R===d.QK.LOADING&&(0,y.jsx)(c.mD,{theme:{base:F},children:(0,y.jsx)(v.J,{loadingText:"Connecting"})}),(0,y.jsxs)(d.R4.Provider,{value:I,children:[(R===d.QK.NOT_CONNECTED_NO_PROVIDER||R===d.QK.NOT_CONNECTED||R===d.QK.CONNECTED_WRONG_NETWORK)&&(0,y.jsx)(T.z,{config:b,params:(0,r.Z)((0,r.Z)({},S),{},{targetLayer:M,web3Provider:g,passport:K}),deepLink:D,sendCloseEventOverride:w}),R===d.QK.CONNECTED_WITH_NETWORK&&q(n)]}),R===d.QK.ERROR&&(0,y.jsx)(c.mD,{theme:{base:F},children:(0,y.jsx)(h.o,{onCloseClick:w,onActionClick:function(){Z({payload:{type:d.V1.UPDATE_CONNECTION_STATUS,connectionStatus:d.QK.NOT_CONNECTED}})},actionText:"Try Again"})})]})}},47618:function(e,t,n){n.d(t,{FJ:function(){return c},GV:function(){return u},fe:function(){return a},rj:function(){return i}});var r=n(37755),o=n(65535),a={cryptoFiat:null,fiatSymbol:function(e){return e.USD="usd",e}({}).USD,tokenSymbols:[],conversions:new Map},i=function(e){return e.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",e.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",e.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",e.SET_CONVERSIONS="SET_CONVERSIONS",e}({}),c=(0,o.createContext)({cryptoFiatState:a,cryptoFiatDispatch:function(){}}),u=function(e,t){switch(t.payload.type){case i.SET_CRYPTO_FIAT:return(0,r.Z)((0,r.Z)({},e),{},{cryptoFiat:t.payload.cryptoFiat});case i.SET_FIAT_SYMBOL:return(0,r.Z)((0,r.Z)({},e),{},{fiatSymbol:t.payload.fiatSymbol});case i.SET_TOKEN_SYMBOLS:return(0,r.Z)((0,r.Z)({},e),{},{tokenSymbols:t.payload.tokenSymbols});case i.SET_CONVERSIONS:return(0,r.Z)((0,r.Z)({},e),{},{conversions:t.payload.conversions});default:return e}}},46207:function(e,t,n){n.d(t,{e:function(){return S},j:function(){return y}});var r,o=n(46999),a=n(74708),i=n(18950),c=n(72771),u=n(65535),s=n(51212),f=n(85169),p=n(8821),l=n(47169),d=n(7064),v=n(82206),T=(0,f.Z)((function e(t){var n=t.baseConfig;(0,p.Z)(this,e),(0,l.Z)(this,"baseConfig",void 0),this.baseConfig=n})),E=(r={},(0,l.Z)(r,d.q.SANDBOX,"https://checkout-api.sandbox.immutable.com"),(0,l.Z)(r,d.q.PRODUCTION,"https://checkout-api.sandbox.immutable.com"),r),h=function(){function e(t){(0,p.Z)(this,e),(0,l.Z)(this,"coinsCache",void 0),(0,l.Z)(this,"overridesCache",void 0),(0,l.Z)(this,"config",void 0),this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}return(0,f.Z)(e,[{key:"urlWithPath",value:function(e){return E[this.config.environment]+e}},{key:"fetchOverrides",value:function(){var e=(0,i.Z)((0,o.Z)().mark((function e(){var t,n;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===this.overridesCache){e.next=2;break}return e.abrupt("return");case 2:return t=this.urlWithPath("/v1/fiat/coins/overrides"),e.next=5,v.Z.get(t);case 5:if(200===(n=e.sent).status){e.next=8;break}throw new Error("Error fetching coins overrides: ".concat(n.status," ").concat(n.statusText));case 8:this.overridesCache=new Map(Object.entries(n.data));case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"fetchCoins",value:function(){var e=(0,i.Z)((0,o.Z)().mark((function e(){var t,n,r,a,i,c,u;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===this.coinsCache){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.fetchOverrides();case 4:return t=this.urlWithPath("/v1/fiat/coins/all"),e.next=7,v.Z.get(t);case 7:if(200===(n=e.sent).status){e.next=10;break}throw new Error("Error fetching coins list: ".concat(n.status," ").concat(n.statusText));case 10:r=n.data,this.coinsCache=new Map,a=(0,s.Z)(r);try{for(a.s();!(i=a.n()).done;)c=i.value,u=this.overridesCache.get(c.symbol.toLowerCase()),this.coinsCache.set(c.symbol.toLowerCase(),u||c.id.toLowerCase())}catch(o){a.e(o)}finally{a.f()}case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"convert",value:function(){var e=(0,i.Z)((0,o.Z)().mark((function e(t){var n,r,a,i,c,u,f,p,l,d,T,E,h,C,N,O=this;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.tokenSymbols,r=t.fiatSymbols,a=void 0===r?[]:r,n&&0!==n.length){e.next=3;break}throw new Error("Error missing token symbols to convert");case 3:return 0===(i=a.filter((function(e){return""!==e}))).length&&i.push("usd"),e.next=7,this.fetchCoins();case 7:return c=n.map((function(e){return O.coinsCache.get(e.toLowerCase())})).filter((function(e){return""!==e&&void 0!==e})).join(","),u=i.join(",").toLowerCase(),f=this.urlWithPath("/v1/fiat/conversion?ids=".concat(c,"¤cies=").concat(u)),e.next=12,v.Z.get(f);case 12:if(200===(p=e.sent).status){e.next=15;break}throw new Error("Error fetching prices: ".concat(p.status," ").concat(p.statusText));case 15:l=p.data,d={},T=(0,s.Z)(n);try{for(T.s();!(E=T.n()).done;)h=E.value,C=h.toLowerCase(),N=this.coinsCache.get(C),d[C]={},N&&(d[C]=l[N]||{})}catch(o){T.e(o)}finally{T.f()}return e.abrupt("return",d);case 20:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}(),C=n(47618),N=function(e,t){var n=new Map;for(var r in e){var o=e[r][t];void 0!==o&&n.set(r,o)}return n},O=function(){var e=(0,i.Z)((0,o.Z)().mark((function e(t,n,r){var a;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,0!==r.length){e.next=3;break}return e.abrupt("return",new Map);case 3:return e.next=5,t.convert({tokenSymbols:r,fiatSymbol:n});case 5:return a=e.sent,e.abrupt("return",N(a,n));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",new Map);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t,n,r){return e.apply(this,arguments)}}(),_=n(10256),y=["ETH","IMX"];function S(e){var t=e.environment,n=e.children,r=(0,u.useReducer)(C.GV,C.fe),s=(0,c.Z)(r,2),f=s[0],p=s[1],l=f.cryptoFiat,d=f.fiatSymbol,v=f.tokenSymbols;return(0,u.useEffect)((function(){p({payload:{type:C.rj.SET_CRYPTO_FIAT,cryptoFiat:new h(new T({baseConfig:{environment:t}}))}})}),[]),(0,u.useEffect)((function(){l&&0!==v.length&&d&&(0,i.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(l,d,(0,a.Z)(new Set([].concat((0,a.Z)(v),y))));case 2:t=e.sent,p({payload:{type:C.rj.SET_CONVERSIONS,conversions:t}});case 4:case"end":return e.stop()}}),e)})))()}),[l,v,d]),(0,_.jsx)(C.FJ.Provider,{value:{cryptoFiatState:f,cryptoFiatDispatch:p},children:n})}},95175:function(e,t,n){n.d(t,{Y:function(){return a}});var r=n(50940),o=n(65535);function a(e,t){var n=(0,o.useRef)(e),a=(0,o.useRef)(null);return(0,r.Cs)((function(){n.current=e}),[e]),(0,o.useEffect)((function(){if(t||0===t)return a.current=setInterval((function(){return n.current()}),t),function(){clearInterval(a.current)}}),[t]),function(){a.current&&clearInterval(a.current)}}},70123:function(e,t,n){n.d(t,{X:function(){return i}});var r=n(46999),o=n(18950),a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e&&new Promise((function(t){return setTimeout(t,e)}))},i=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(t,n){var o,c,u,s;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=n.retries,c=n.retryIntervalMs,u=n.nonRetryable,s=o,e.prev=2,e.next=5,t();case 5:return e.abrupt("return",e.sent);case 8:if(e.prev=8,e.t0=e.catch(2),void 0===s){e.next=14;break}if(!(s<=0)){e.next=13;break}throw e.t0;case 13:s-=1;case 14:if(!u||!u(e.t0)){e.next=16;break}throw e.t0;case 16:return e.next=18,a(c);case 18:return e.abrupt("return",i(t,{retries:s,retryIntervalMs:c,nonRetryable:u}));case 19:case"end":return e.stop()}}),e,null,[[2,8]])})));return function(t,n){return e.apply(this,arguments)}}()},46869:function(e,t,n){n.d(t,{Dq:function(){return i},FL:function(){return s},Lr:function(){return p},Mg:function(){return l},kc:function(){return c},yY:function(){return u}});var r=n(29956),o=n(61339),a=n(75434),i=function(e,t,n){return t.sort((function(t,r){return n===(0,o.D3)(e)&&"imx"===t.token.symbol.toLowerCase()&&"imx"!==r.token.symbol.toLowerCase()?-1:n===(0,o.D3)(e)&&"imx"===r.token.symbol.toLowerCase()&&"imx"!==t.token.symbol.toLowerCase()||t.balance.lt(r.balance)?1:t.balance.gt(r.balance)?-1:0}))},c=function(e,t,n){return e.chainId===(0,o.D3)(n)?-1:e.chainId===(0,o.Tz)(n)?0:1},u=function(e,t,n){var r="0.00";if(!e)return r;var o=n.get(t.toLowerCase());if(!o)return r;var a=parseFloat(e);return 0===parseFloat(e)||Number.isNaN(a)?r:function(e){var t=Math.pow(10,2);return(Math.round(e*t)/t).toFixed(2)}(a*o)},s=function(e){var t="-.--";return e&&("0.00"!==e||arguments.length>1&&void 0!==arguments[1]&&arguments[1])?e:t},f=function(e,t){var n=e.indexOf(".");return parseFloat(e.substring(0,n+t+1)).toFixed(t)},p=function(e){var t=e.toString();if(-1===t.indexOf("."))return t;if("."===t[0]||0===parseInt(t[0],10))return f(t,a.Me);var n=f(t,a.TA);return n.endsWith(".00")&&(n=f(n,0)),n},l=function(e,t){return t&&function(e){return e===r.a_.IMTBL_ZKEVM_DEVNET||e===r.a_.IMTBL_ZKEVM_TESTNET||e===r.a_.IMTBL_ZKEVM_MAINNET}(t)?e===a.sv:!e||e.toLocaleUpperCase()===a.B5}},48796:function(e,t,n){n.d(t,{I:function(){return o}});var r=n(75434);function o(e){return new RegExp("^([0-9]+([.][0-9]{0,".concat(r.iD,"})?)?$")).test(e)}},29601:function(e,t,n){n.d(t,{At:function(){return s},Qh:function(){return c},g1:function(){return u}});var r=n(29956),o=n(27255),a=n(48796),i=n(75434);function c(e){return void 0===e||""!==e&&Object.values(r.Zb).includes(e)}function u(e){return void 0!==e&&(""===e||!!parseFloat(e)&&(!Number.isNaN(parseFloat(e))&&(0,a.I)(e)))}function s(e){return void 0!==e&&(""===e||(e===i.B5||e===i.B5.toLowerCase()||o.isAddress(e)))}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_imtbl_checkout_widgets_lib=self.webpackChunk_imtbl_checkout_widgets_lib||[]).push([[383],{6506:function(e,t,n){n.d(t,{B:function(){return o}});var r=n(62290);var o={sendRequestBridgeEvent:function(e,t,n){var o=new CustomEvent(t,{detail:{type:r.Wy.REQUEST_BRIDGE,data:n}});console.log("bridge coins event:",e,o),void 0!==e&&e.dispatchEvent(o)},sendRequestSwapEvent:function(e,t,n){var o=new CustomEvent(t,{detail:{type:r.Wy.REQUEST_SWAP,data:n}});console.log("request swap event:",e,o),void 0!==e&&e.dispatchEvent(o)},sendRequestOnrampEvent:function(e,t,n){var o=new CustomEvent(t,{detail:{type:r.Wy.REQUEST_ONRAMP,data:n}});console.log("request onramp event:",e,o),void 0!==e&&e.dispatchEvent(o)}}},1138:function(e,t,n){n.d(t,{t:function(){return R}});var r=n(46999),o=n(18950),a=n(72771),s=n(50940),i=n(62290),c=n(65535),u=n(29956),l=n(4813),d=n(581),p=n(58534),f=n(39275),v=n(95269),m=n(6506),x=n(36011),C=n(23357),h=n(72225),E=function(e,t,n){var r=-1;if(e&&t){var o=h.formatUnits(e,t.decimals),a=n.get(t.symbol.toLocaleLowerCase());if(a){var s=parseFloat(o);if(Number.isNaN(s))return r;r=parseFloat(o)*a}}return r};function k(e){if(e<0)return"-.--";var t=e.toString();if(t.includes("e")||0===e)return"0.00";if(e<.01)for(var n=0;n<t.length;n++)if("0"!==t[n]&&"."!==t[n])return e.toFixed(n-1);return e.toFixed(2)}var b=function(e){var t=e.minPercentage,n=e.maxPercentage;return void 0===t||void 0===n?"-.--":"".concat(t,"% to ").concat(n)},w=function(e,t){var n=e.gasFee,r=n.estimatedAmount;if(void 0===r)return"-.--";var o=n.token;if(void 0===o)return"-.--";var a=E(r,o,t);return a<0?"-.--":k(a)},g=function(e,t){var n=e.gasFee,r=e.bridgeFee,o=n.estimatedAmount;if(void 0===o)return"-.--";var a=n.token;if(void 0===!a)return"-.--";var s=E(o,a,t);if(s<0)return"-.--";var i=E(r.estimatedAmount,r.token,t);return k(i<0?s:s+i)},y=n(47618),A=n(95175),T=n(46207),I=n(55820),L=n(35314),S=n(9437),j=n(83712),Z=n(10256);function F(e){var t=e.testId,n=e.icon,r=e.heading,o=e.caption,a=e.subcaption,i=e.onClick,c=e.renderFeeFunction;return(0,Z.jsx)(s.xu,{testId:"top-up-view",sx:{paddingY:"1px"},children:(0,Z.jsxs)(s.sN,{testId:"menu-item-".concat(t),size:"medium",emphasized:!0,onClick:i,children:[(0,Z.jsx)(s.sN.Icon,{icon:n}),(0,Z.jsx)(s.sN.Label,{size:"medium",children:r}),(0,Z.jsx)(s.sN.IntentIcon,{}),(0,Z.jsxs)(s.sN.Caption,{testId:"menu-item-caption-".concat(t),children:[o,(0,Z.jsx)("br",{}),a," ",c("-.--",!1)]})]})})}var _=3e4;function R(e){var t=e.widgetEvent,n=e.showOnrampOption,h=e.showSwapOption,E=e.showBridgeOption,k=e.tokenAddress,R=e.amount,V=e.onCloseButtonClick,P=e.onBackButtonClick,M=(0,c.useContext)(I.R4).connectLoaderState,O=M.checkout,B=M.provider,D=v.f.views[f.cZ.TOP_UP_VIEW],W=D.header,U=D.topUpOptions,N=U.onramp,G=U.swap,z=U.bridge,X=(0,c.useContext)(f.A7).viewDispatch,H=(0,c.useContext)(y.FJ),q=H.cryptoFiatState,Q=H.cryptoFiatDispatch,Y=q.conversions,K=q.fiatSymbol,J=(0,c.useContext)(j.yh).eventTargetState.eventTarget,$=(0,c.useState)("-.--"),ee=(0,a.Z)($,2),te=ee[0],ne=ee[1],re=(0,c.useState)("-.--"),oe=(0,a.Z)(re,2),ae=oe[0],se=oe[1],ie=(0,c.useState)("-.--"),ce=(0,a.Z)(ie,2),ue=ce[0],le=ce[1],de=(0,c.useState)(!1),pe=(0,a.Z)(de,2),fe=pe[0],ve=pe[1],me=(0,c.useState)(!1),xe=(0,a.Z)(me,2),Ce=xe[0],he=xe[1],Ee=(0,c.useState)(!1),ke=(0,a.Z)(Ee,2),be=ke[0],we=ke[1],ge=(0,L.T)(B);(0,c.useEffect)((function(){O&&Q&&Q({payload:{type:y.rj.SET_TOKEN_SYMBOLS,tokenSymbols:T.j}})}),[O,Q]);var ye=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){var t,n,o,s,i,c,l,d,p,f=arguments;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=f.length>0&&void 0!==f[0]&&f[0],O){e.next=3;break}return e.abrupt("return");case 3:return t||(ve(!0),he(!0),we(!0)),e.prev=4,e.next=7,Promise.all([O.gasEstimate({gasEstimateType:u.IW.SWAP}),O.gasEstimate({gasEstimateType:u.IW.BRIDGE_TO_L2,isSpendingCapApprovalRequired:!0}),O.getExchangeFeeEstimate()]);case 7:n=e.sent,o=(0,a.Z)(n,3),s=o[0],i=o[1],c=o[2],l=b(c),ne(l),d=w(s,Y),se(d),p=g(i,Y),le(p),e.next=25;break;case 20:e.prev=20,e.t0=e.catch(4),ne("-.--"),se("-.--"),le("-.--");case 25:return e.prev=25,we(!1),he(!1),ve(!1),e.finish(25);case 30:case"end":return e.stop()}}),e,null,[[4,20,25,30]])})));return function(){return e.apply(this,arguments)}}();(0,A.Y)((function(){return ye(!0)}),_),(0,c.useEffect)((function(){O&&0!==Y.size&&ye()}),[O,0===Y.size]);var Ae=function(e,t){return t?(0,Z.jsx)(s.uT,{size:"xSmall",shimmer:1,testId:"fees-shimmer"}):" \u2248 $".concat(e," ").concat(K.toLocaleUpperCase())};return(0,Z.jsx)(p.X,{header:(0,Z.jsx)(d.F,{onBackButtonClick:P,onCloseButtonClick:V,showBack:!0}),footer:(0,Z.jsx)(l.w,{}),children:(0,Z.jsxs)(s.xu,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[(0,Z.jsx)(s.X6,{size:"small",children:W.title}),(0,Z.jsxs)(s.xu,{sx:{paddingY:"base.spacing.x4"},children:[n&&(0,Z.jsx)(F,{testId:"onramp",icon:"Wallet",heading:N.heading,caption:N.caption,subcaption:N.subcaption,onClick:function(){t!==i.O6.IMTBL_ONRAMP_WIDGET_EVENT?m.B.sendRequestOnrampEvent(window,t,{tokenAddress:null!==k&&void 0!==k?k:"",amount:null!==R&&void 0!==R?R:""}):X({payload:{type:f.Cp.UPDATE_VIEW,view:{type:S.d.ONRAMP,data:{contractAddress:"",amount:""}}}})},renderFeeFunction:function(){return e=te,fe?(0,Z.jsx)(s.uT,{size:"xSmall",shimmer:1,testId:"fee-percentage-shimmer"}):" \u2248 ".concat(e,"%");var e}}),h&&(0,Z.jsx)(F,{testId:"swap",icon:"Coins",heading:G.heading,caption:G.caption,subcaption:G.subcaption,onClick:function(){t!==i.O6.IMTBL_SWAP_WIDGET_EVENT?m.B.sendRequestSwapEvent(J,t,{fromTokenAddress:"",toTokenAddress:null!==k&&void 0!==k?k:"",amount:""}):X({payload:{type:f.Cp.UPDATE_VIEW,view:{type:x.j.SWAP,data:{toContractAddress:"",fromAmount:"",fromContractAddress:""}}}})},renderFeeFunction:function(){return Ae(ae,Ce)}}),E&&!ge&&(0,Z.jsx)(F,{testId:"bridge",icon:"Minting",heading:z.heading,caption:z.caption,subcaption:z.subcaption,onClick:function(){t!==i.O6.IMTBL_BRIDGE_WIDGET_EVENT?m.B.sendRequestBridgeEvent(J,t,{tokenAddress:"",amount:""}):X({payload:{type:f.Cp.UPDATE_VIEW,view:{type:C.O.BRIDGE,data:{fromContractAddress:"",fromAmount:""}}}})},renderFeeFunction:function(){return Ae(ue,be)}})]})]})})}},37383:function(e,t,n){n.r(t),n.d(t,{ImmutableSwap:function(){return cn}});var r=n(74708),o=n(8821),a=n(85169),s=n(69803),i=n(2312),c=n(82248),u=n(8416),l=n(65535),d=n(64093),p=n(50940),f=n(46999),v=n(18950),m=n(72771),x=n(29956),C=n(7064),h=n(58915),E=n(62290),k=n(581),b=n(58534),w=n(4813);function g(e){var t=new CustomEvent(E.O6.IMTBL_SWAP_WIDGET_EVENT,{detail:{type:E.pY.CLOSE_WIDGET,data:{}}});console.log("close widget event:",e,t),void 0!==e&&e.dispatchEvent(t)}var y=n(95269),A=n(36011),T=n(72225),I=n(42322),L=n(48796),S=n(37755),j={exchange:null,walletProvider:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]},Z=function(e){return e.SET_EXCHANGE="SET_EXCHANGE",e.SET_WALLET_PROVIDER="SET_WALLET_PROVIDER",e.SET_NETWORK="SET_NETWORK",e.SET_SUPPORTED_TOP_UPS="SET_SUPPORTED_TOP_UPS",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS",e}({}),F=(0,l.createContext)({swapState:j,swapDispatch:function(){}});F.displayName="SwapContext";var _=function(e,t){var n,r,o;switch(t.payload.type){case Z.SET_EXCHANGE:return(0,S.Z)((0,S.Z)({},e),{},{exchange:t.payload.exchange});case Z.SET_WALLET_PROVIDER:return(0,S.Z)((0,S.Z)({},e),{},{walletProvider:t.payload.walletProvider});case Z.SET_NETWORK:return(0,S.Z)((0,S.Z)({},e),{},{network:t.payload.network});case Z.SET_SUPPORTED_TOP_UPS:return(0,S.Z)((0,S.Z)({},e),{},{supportedTopUps:{isSwapEnabled:null===(n=t.payload.supportedTopUps.isSwapEnabled)||void 0===n||n,isOnRampEnabled:null===(r=t.payload.supportedTopUps.isOnRampEnabled)||void 0===r||r,isBridgeEnabled:null===(o=t.payload.supportedTopUps.isBridgeEnabled)||void 0===o||o}});case Z.SET_TOKEN_BALANCES:return(0,S.Z)((0,S.Z)({},e),{},{tokenBalances:t.payload.tokenBalances});case Z.SET_ALLOWED_TOKENS:return(0,S.Z)((0,S.Z)({},e),{},{allowedTokens:t.payload.allowedTokens});default:return e}},R=n(47618),V=n(46869),P=n(26763),M=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(t,n,r,o,a){var s;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getSigner().getAddress();case 2:return s=e.sent,e.abrupt("return",t.getUnsignedSwapTxFromAmountIn(s,r.address||"",a.address||"",I.O$.from(T.parseUnits(o,r.decimals))));case 4:case"end":return e.stop()}}),e)})));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),O=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(t,n,r,o,a){var s;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getSigner().getAddress();case 2:return s=e.sent,e.abrupt("return",t.getUnsignedSwapTxFromAmountOut(s,a.address||"",r.address||"",I.O$.from(T.parseUnits(o,r.decimals))));case 4:case"end":return e.stop()}}),e)})));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),B={fromAmountIn:M,fromAmountOut:O},D={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},W={flex:1},U={flex:2},N=n(35047),G=n(6133),z=n(10256);function X(e){var t=e.testId,n=e.options,r=e.textInputValue,o=e.textInputPlaceholder,a=e.textInputValidator,s=e.onTextInputChange,i=e.onTextInputBlur,c=e.onTextInputFocus,u=e.textInputTextAlign,l=e.textInputSubtext,d=e.textInputErrorMessage,f=e.selectTextAlign,v=e.selectSubtext,m=e.selectErrorMessage,x=e.textInputMaxButtonClick,C=e.onSelectChange,h=e.textInputDisabled,E=e.selectInputDisabled,k=e.selectedOption,b=e.coinSelectorHeading;return(0,z.jsxs)(p.xu,{sx:D,children:[(0,z.jsx)(p.xu,{sx:W,children:(0,z.jsx)(N.p,{testId:"".concat(t,"-select-form"),options:n,subtext:v,textAlign:f,errorMessage:m,onSelectChange:C,disabled:E,selectedOption:k,coinSelectorHeading:b})}),(0,z.jsx)(p.xu,{sx:U,children:(0,z.jsx)(G.F,{testId:"".concat(t,"-text-form"),value:r,placeholder:o,subtext:l,textAlign:u,errorMessage:d,validator:a,onTextInputChange:s,onTextInputBlur:i,onTextInputFocus:c,maxButtonClick:x,disabled:h})})]})}var H=n(86249),q=n(39275),Q=n(6426),Y=n(30940),K=n(55820);function J(e){var t=e.loading,n=e.updateLoading,r=e.validator,o=e.transaction,a=e.data,s=e.insufficientFundsForGas,i=e.openNotEnoughImxDrawer,c=(0,l.useState)(!1),u=(0,m.Z)(c,2),d=u[0],C=u[1],h=(0,l.useContext)(q.A7).viewDispatch,E=(0,l.useContext)(K.R4).connectLoaderState,k=E.checkout,b=E.provider,w=y.f.views[A.j.SWAP].swapForm.buttonText,g=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(){var t;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r()){e.next=2;break}return e.abrupt("return");case 2:if(k&&b&&o){e.next=4;break}return e.abrupt("return");case 4:if(!s){e.next=7;break}return i(),e.abrupt("return");case 7:if(o){e.next=9;break}return e.abrupt("return");case 9:if(e.prev=9,n(!0),!o.approval){e.next=14;break}return h({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.APPROVE_ERC20,data:{approveTransaction:o.approval.transaction,transaction:o.swap.transaction,info:o.quote,swapFormInfo:a}}}}),e.abrupt("return");case 14:return e.next=16,k.sendTransaction({provider:b,transaction:o.swap.transaction});case 16:t=e.sent,h({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:a}}}}),e.next=33;break;case 20:if(e.prev=20,e.t0=e.catch(9),n(!1),e.t0.type!==x.XQ.USER_REJECTED_REQUEST_ERROR){e.next=26;break}return C(!0),e.abrupt("return");case 26:if(e.t0.type!==x.XQ.UNPREDICTABLE_GAS_LIMIT){e.next=29;break}return h({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.PRICE_SURGE,data:a}}}),e.abrupt("return");case 29:if(!(e.t0.type===x.XQ.TRANSACTION_FAILED||e.t0.type===x.XQ.INSUFFICIENT_FUNDS||e.t0.receipt&&0===e.t0.receipt.status)){e.next=32;break}return h({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.FAIL,reason:"Transaction failed",data:a}}}),e.abrupt("return");case 32:h({payload:{type:q.Cp.UPDATE_VIEW,view:{type:q.cZ.ERROR_VIEW,error:e.t0}}});case 33:case"end":return e.stop()}}),e,null,[[9,20]])})));return function(){return e.apply(this,arguments)}}();return(0,z.jsxs)(p.xu,{sx:Q.C,children:[(0,z.jsx)(p.zx,{testId:"swap-button",disabled:t,variant:"primary",onClick:g,size:"large",children:t?(0,z.jsx)(p.zx.Icon,{icon:"Loading",sx:Q.n}):w}),(0,z.jsx)(Y.B,{visible:d,showHeaderBar:!1,onCloseBottomSheet:function(){return C(!1)},onRetry:function(){g(),C(!1)}})]})}var $=n(95175),ee={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},te={color:"base.color.text.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},ne={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},re={width:"100%",height:"base.spacing.x16"},oe={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function ae(e){var t=e.visible,n=e.showAdjustAmount,r=e.hasZeroImx,o=e.onCloseBottomSheet,a=e.onAddCoinsClick,s=y.f.drawers.notEnoughImx,i=s.content,c=s.buttons,u=i.noImx,l=i.insufficientImx;return(0,z.jsx)(p.R1,{size:"full",onCloseBottomSheet:o,visible:t,showHeaderBar:!1,children:(0,z.jsx)(p.R1.Content,{children:(0,z.jsxs)(p.xu,{testId:"not-enough-gas-bottom-sheet",sx:ee,children:[(0,z.jsx)(p.fP,{imageUrl:"https://design-system.immutable.com/hosted-for-ds/currency-icons/currency--imx.svg",circularFrame:!0,sx:{height:"100px"}}),(0,z.jsx)(p.X6,{size:"small",sx:te,testId:"not-enough-gas-heading",children:r?u.heading:l.heading}),(0,z.jsx)(p.uT,{sx:te,children:r?u.body:l.body}),(0,z.jsxs)(p.xu,{sx:ne,children:[n&&(0,z.jsx)(p.zx,{testId:"not-enough-gas-adjust-amount-button",sx:re,variant:"tertiary",onClick:o,children:c.adjustAmount}),(0,z.jsx)(p.zx,{testId:"not-enough-gas-add-imx-button",sx:re,variant:"tertiary",onClick:a,children:c.addMoreImx}),(0,z.jsx)(p.zx,{sx:re,variant:"tertiary",onClick:o,testId:"not-enough-gas-cancel-button",children:c.cancel})]}),(0,z.jsx)(p.xu,{sx:oe,children:(0,z.jsx)(p.TR,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}var se={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},ie={color:"base.color.text.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},ce={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},ue={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},le={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},de={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function pe(e){var t=e.visible,n=e.onCloseBottomSheet,r=y.f.drawers.unableToSwap,o=r.heading,a=r.body,s=r.buttons;return(0,z.jsx)(p.R1,{size:"full",onCloseBottomSheet:n,visible:t,showHeaderBar:!1,children:(0,z.jsx)(p.R1.Content,{children:(0,z.jsxs)(p.xu,{testId:"unable-to-swap-bottom-sheet",sx:se,children:[(0,z.jsx)(p.JO,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:de}),(0,z.jsx)(p.X6,{size:"small",sx:ie,testId:"unable-to-swap-heading",children:o}),(0,z.jsx)(p.uT,{sx:ie,children:a}),(0,z.jsx)(p.xu,{sx:ce,children:(0,z.jsx)(p.zx,{sx:ue,variant:"tertiary",onClick:n,testId:"unable-to-swap-cancel-button",children:s.cancel})}),(0,z.jsx)(p.xu,{sx:le,children:(0,z.jsx)(p.TR,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}var fe=function(e){return e.FROM="FROM",e.TO="TO",e}(fe||{}),ve=function(e){var t=e.swapFromToken,n=e.swapToToken,r=e.swapFromAmount,o=e.swapToAmount,a={fromToConversion:"",swapToAmount:""};if(!o)return a;if(a.swapToAmount=(0,V.Lr)(o),r&&t&&n){var s=(0,V.Lr)(Number(o)/Number(r));a.fromToConversion="1 ".concat(t.symbol," \u2248 ").concat((0,V.FL)(s,!0)," ").concat(n.symbol)}return a},me=function(e,t){return void 0!==e&&(""!==e&&t!==e)};function xe(e){var t=e.data,n=(0,l.useContext)(F).swapState,r=n.allowedTokens,o=n.exchange,a=n.tokenBalances,s=n.network,i=(0,l.useContext)(K.R4).connectLoaderState.provider,c=(0,l.useCallback)((function(e,t){return t?"".concat(e.toLowerCase(),"-").concat(t.toLowerCase()):e.toLowerCase()}),[]),u=(0,l.useContext)(R.FJ),d=u.cryptoFiatState,x=u.cryptoFiatDispatch,C=(0,l.useContext)(q.A7).viewDispatch,h=(0,l.useState)(!1),E=(0,m.Z)(h,2),k=E[0],b=E[1],w=(0,l.useState)(!1),g=(0,m.Z)(w,2),S=g[0],j=g[1],Z=(0,l.useState)(fe.FROM),_=(0,m.Z)(Z,2),M=_[0],O=_[1],D=(0,l.useState)(!1),W=(0,m.Z)(D,2),U=W[0],N=W[1],G=(0,l.useState)(""),Q=(0,m.Z)(G,2),Y=Q[0],ee=Q[1],te=(0,l.useRef)(!1),ne=(0,l.useState)((null===t||void 0===t?void 0:t.fromAmount)||""),re=(0,m.Z)(ne,2),oe=re[0],se=re[1],ie=(0,l.useState)(""),ce=(0,m.Z)(ie,2),ue=ce[0],le=ce[1],de=(0,l.useState)(),xe=(0,m.Z)(de,2),Ce=xe[0],he=xe[1],Ee=(0,l.useState)(""),ke=(0,m.Z)(Ee,2),be=ke[0],we=ke[1],ge=(0,l.useState)(""),ye=(0,m.Z)(ge,2),Ae=ye[0],Te=ye[1],Ie=(0,l.useState)((null===t||void 0===t?void 0:t.toAmount)||""),Le=(0,m.Z)(Ie,2),Se=Le[0],je=Le[1],Ze=(0,l.useState)(""),Fe=(0,m.Z)(Ze,2),_e=Fe[0],Re=Fe[1],Ve=(0,l.useState)(),Pe=(0,m.Z)(Ve,2),Me=Pe[0],Oe=Pe[1],Be=(0,l.useState)(""),De=(0,m.Z)(Be,2),We=De[0],Ue=De[1],Ne=(0,l.useState)(""),Ge=(0,m.Z)(Ne,2),ze=Ge[0],Xe=Ge[1],He=(0,l.useState)(null),qe=(0,m.Z)(He,2),Qe=qe[0],Ye=qe[1],Ke=(0,l.useState)(""),Je=(0,m.Z)(Ke,2),$e=Je[0],et=Je[1],tt=(0,l.useState)(void 0),nt=(0,m.Z)(tt,2),rt=nt[0],ot=nt[1],at=(0,l.useState)(""),st=(0,m.Z)(at,2),it=st[0],ct=st[1],ut=(0,l.useState)([]),lt=(0,m.Z)(ut,2),dt=lt[0],pt=lt[1],ft=(0,l.useState)(!1),vt=(0,m.Z)(ft,2),mt=vt[0],xt=vt[1],Ct=(0,l.useState)(!1),ht=(0,m.Z)(Ct,2),Et=ht[0],kt=ht[1];(0,l.useEffect)((function(){if(0!==a.length&&s){var e=a.filter((function(e){return e.balance.gt(0)})).map((function(e){return{id:c(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedAmount:(0,V.Lr)(e.formattedBalance),formattedFiatAmount:0===d.conversions.size?(0,V.FL)(""):(0,V.yY)(e.formattedBalance,e.token.symbol||"",d.conversions)}}}));if(pt(e),!te.current){var n,o;if(te.current=!0,null!==t&&void 0!==t&&t.fromContractAddress)he(r.find((function(e){var n,r,o;return(0,V.Mg)(e.address,s.chainId)&&(null===t||void 0===t||null===(n=t.fromContractAddress)||void 0===n?void 0:n.toLocaleUpperCase())===P.B5||(null===(r=e.address)||void 0===r?void 0:r.toLowerCase())===(null===t||void 0===t||null===(o=t.fromContractAddress)||void 0===o?void 0:o.toLowerCase())}))),we(null!==(n=null===(o=a.find((function(e){var n,r,o;return(0,V.Mg)(e.token.address,s.chainId)&&(null===t||void 0===t||null===(n=t.fromContractAddress)||void 0===n?void 0:n.toLocaleUpperCase())===P.B5||(null===(r=e.token.address)||void 0===r?void 0:r.toLowerCase())===(null===t||void 0===t||null===(o=t.fromContractAddress)||void 0===o?void 0:o.toLowerCase())})))||void 0===o?void 0:o.formattedBalance)&&void 0!==n?n:"");me(null===t||void 0===t?void 0:t.toContractAddress,null===t||void 0===t?void 0:t.fromContractAddress)&&Oe(r.find((function(e){var n,r,o;return(0,V.Mg)(e.address,s.chainId)&&(null===t||void 0===t||null===(n=t.toContractAddress)||void 0===n?void 0:n.toLocaleUpperCase())===P.B5||(null===(r=e.address)||void 0===r?void 0:r.toLowerCase())===(null===t||void 0===t||null===(o=t.toContractAddress)||void 0===o?void 0:o.toLowerCase())})))}}}),[a,r,d.conversions,null===t||void 0===t?void 0:t.fromContractAddress,null===t||void 0===t?void 0:t.toContractAddress,te.current,he,we,Oe,pt,c,V.FL,s]);var bt=(0,l.useMemo)((function(){return r.map((function(e){return{id:c(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:void 0}}))}),[r,Ce]);(0,l.useEffect)((function(){x({payload:{type:R.rj.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((function(e){return e.symbol}))}})}),[x,r]);var wt=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(){var t,n,a,s,c,u,l=arguments;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>0&&void 0!==l[0]&&l[0],i){e.next=3;break}return e.abrupt("return");case 3:if(o){e.next=5;break}return e.abrupt("return");case 5:if(Ce){e.next=7;break}return e.abrupt("return");case 7:if(Me){e.next=9;break}return e.abrupt("return");case 9:return e.prev=9,e.next=12,B.fromAmountIn(o,i,Ce,oe,Me);case 12:if(n=e.sent,!t||!U&&!k){e.next=15;break}return e.abrupt("return");case 15:a=n.swap.gasFeeEstimate,s=T.formatUnits((null===a||void 0===a?void 0:a.value)||0,P.vr),c=null===a||void 0===a?void 0:a.token,u=r.find((function(e){return e.symbol===(null===c||void 0===c?void 0:c.symbol)})),Ye(n),et(s),ot({name:(null===u||void 0===u?void 0:u.name)||"",symbol:(null===u||void 0===u?void 0:u.symbol)||"",decimals:(null===u||void 0===u?void 0:u.decimals)||0,address:null===u||void 0===u?void 0:u.address,icon:null===u||void 0===u?void 0:u.icon}),ct((0,V.yY)(s,(null===u||void 0===u?void 0:u.symbol)||"",d.conversions)),je((0,V.FL)((0,V.Lr)(T.formatUnits(n.quote.amount.value,n.quote.amount.token.decimals)))),le(""),Te(""),Re(""),Ue(""),e.next=35;break;case 30:e.prev=30,e.t0=e.catch(9),Ye(null),xt(!1),kt(!0);case 35:j(!1);case 36:case"end":return e.stop()}}),e,null,[[9,30]])})));return function(){return e.apply(this,arguments)}}(),gt=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(){var t,n,a,s,c,u,l=arguments;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>0&&void 0!==l[0]&&l[0],i){e.next=3;break}return e.abrupt("return");case 3:if(o){e.next=5;break}return e.abrupt("return");case 5:if(Ce){e.next=7;break}return e.abrupt("return");case 7:if(Me){e.next=9;break}return e.abrupt("return");case 9:return e.prev=9,e.next=12,B.fromAmountOut(o,i,Me,Se,Ce);case 12:if(n=e.sent,!t||!U&&!k){e.next=15;break}return e.abrupt("return");case 15:a=n.swap.gasFeeEstimate,s=T.formatUnits((null===a||void 0===a?void 0:a.value)||0,P.vr),c=null===a||void 0===a?void 0:a.token,u=r.find((function(e){return e.symbol===(null===c||void 0===c?void 0:c.symbol)})),Ye(n),et(s),ot({name:(null===u||void 0===u?void 0:u.name)||"",symbol:(null===u||void 0===u?void 0:u.symbol)||"",decimals:(null===u||void 0===u?void 0:u.decimals)||0,address:null===u||void 0===u?void 0:u.address,icon:null===u||void 0===u?void 0:u.icon}),ct((0,V.yY)(s,(null===u||void 0===u?void 0:u.symbol)||"",d.conversions)),se((0,V.FL)((0,V.Lr)(T.formatUnits(n.quote.amount.value,n.quote.amount.token.decimals)))),le(""),Te(""),Re(""),Ue(""),e.next=35;break;case 30:e.prev=30,e.t0=e.catch(9),Ye(null),xt(!1),kt(!0);case 35:j(!1);case 36:case"end":return e.stop()}}),e,null,[[9,30]])})));return function(){return e.apply(this,arguments)}}(),yt=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(){var t,n=arguments;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],!Number.isNaN(parseFloat(oe))&&!(parseFloat(oe)<=0)&&!!Ce&&!!Me&&!S){e.next=3;break}return e.abrupt("return");case 3:return t||(N(!0),j(!0)),e.next=6,wt(t);case 6:t||(N(!1),j(!1));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),At=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(){var t,n=arguments;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],!Number.isNaN(parseFloat(Se))&&!(parseFloat(Se)<=0)&&!!Ce&&!!Me&&!S){e.next=3;break}return e.abrupt("return");case 3:return t||(N(!0),j(!0)),e.next=6,gt(t);case 6:t||(N(!1),j(!1));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Tt=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(){var t,n=arguments;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],M!==fe.FROM){e.next=6;break}return e.next=4,yt(t);case 4:e.next=8;break;case 6:return e.next=8,At(t);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,$.Y)((function(){return Tt(!0)}),P.Am),(0,l.useEffect)((function(){if(M===fe.FROM){if(k)return;(0,v.Z)((0,f.Z)().mark((function e(){return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Tt();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()}}),[oe,Ce,Me,k]),(0,l.useEffect)((function(){if(M===fe.TO){if(k)return;(0,v.Z)((0,f.Z)().mark((function e(){return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Tt();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()}}),[Se,Me,Ce,k]);var It=(0,l.useMemo)((function(){var e=a.find((function(e){return e.token.address===P.sv}));if(!e)return!0;var t=(null===Ce||void 0===Ce?void 0:Ce.address)===P.sv,n=T.parseEther(0!==$e.length?$e:"0"),r=t&&!Number.isNaN(parseFloat(oe))?T.parseUnits(oe,(null===Ce||void 0===Ce?void 0:Ce.decimals)||18):I.O$.from("0");return n.add(r).gt(e.balance)}),[$e,a,Ce,oe]);(0,l.useEffect)((function(){oe&&Ce&&Xe((0,V.yY)(oe,Ce.symbol,d.conversions))}),[oe,Ce]);var Lt=(0,l.useCallback)((function(e){var t=a.find((function(t){return e===c(t.token.symbol,t.token.address)}));t&&(Me&&e===c(Me.symbol,null===Me||void 0===Me?void 0:Me.address)&&Oe(void 0),he(t.token),we(t.formattedBalance),Te(""))}),[Me]),St=(0,l.useCallback)((function(e){var t=r.find((function(t){return e===c(t.symbol,t.address)}));t&&(Ce&&e===c(Ce.symbol,null===Ce||void 0===Ce?void 0:Ce.address)&&he(void 0),Oe(t),Ue(""))}),[Ce]),jt=y.f.views[A.j.SWAP],Zt=jt.content,Ft=jt.swapForm,_t=jt.fees;return(0,l.useEffect)((function(){ee(ve({swapFromToken:Ce,swapFromAmount:oe,swapToToken:Me,swapToAmount:Se}).fromToConversion)}),[Qe]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(p.xu,{sx:{paddingX:"base.spacing.x4"},children:[(0,z.jsx)(p.X6,{size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:Zt.title}),(0,z.jsxs)(p.xu,{sx:{display:"flex",flexDirection:"column",rowGap:"base.spacing.x6"},children:[(0,z.jsxs)(p.xu,{children:[(0,z.jsx)(p.X6,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:Ft.from.label}),(0,z.jsx)(X,{testId:"fromTokenInputs",options:dt,selectSubtext:Ce?"".concat(Zt.availableBalancePrefix," ").concat((0,V.Lr)(be)):"",selectTextAlign:"left",textInputValue:oe,textInputPlaceholder:Ft.from.inputPlaceholder,textInputSubtext:"".concat(Zt.fiatPricePrefix," \n $").concat((0,V.FL)(ze,!0)),textInputTextAlign:"right",textInputValidator:L.I,onTextInputChange:function(e){return se(e),void le("")},onTextInputBlur:function(e){return t=e,b(!1),void se(t);var t},onTextInputFocus:function(){b(!0),O(fe.FROM)},textInputMaxButtonClick:function(){if(be){var e=be.slice(0,be.indexOf(".")+P.iD+1);se(e),O(fe.FROM)}},onSelectChange:Lt,textInputErrorMessage:ue,selectErrorMessage:Ae,selectInputDisabled:S,textInputDisabled:S,selectedOption:Ce?c(Ce.symbol,Ce.address):void 0,coinSelectorHeading:Ft.from.selectorTitle})]}),(0,z.jsxs)(p.xu,{children:[(0,z.jsxs)(p.xu,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[(0,z.jsx)(p.X6,{size:"xSmall",children:Ft.to.label}),(0,z.jsx)(p.uT,{sx:{color:"base.color.brand.4"},size:"small",children:Y})]}),(0,z.jsx)(X,{testId:"toTokenInputs",options:bt,selectTextAlign:"left",textInputValue:Se,textInputPlaceholder:Ft.to.inputPlaceholder,textInputTextAlign:"right",textInputValidator:L.I,onTextInputChange:function(e){return je(e),void Re("")},onTextInputBlur:function(e){return t=e,b(!1),void je(t);var t},onTextInputFocus:function(){b(!0),O(fe.TO)},onSelectChange:St,textInputErrorMessage:_e,selectErrorMessage:We,selectInputDisabled:S,textInputDisabled:S,selectedOption:Me?c(Me.symbol,Me.address):void 0,coinSelectorHeading:Ft.to.selectorTitle})]})]}),(0,z.jsx)(H.M,{title:_t.title,fiatPricePrefix:Zt.fiatPricePrefix,gasFeeFiatValue:it,gasFeeToken:rt,gasFeeValue:$e})]}),(0,z.jsx)(J,{validator:function(){var e=function(e){var t=y.f.views[A.j.SWAP].validation;return e?"":t.noFromTokenSelected}(Ce),t=function(e,t){var n=y.f.views[A.j.SWAP].validation;return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?n.insufficientBalance:"":n.noAmountInputted}(oe,be),n=function(e){var t=y.f.views[A.j.SWAP].validation;return e?"":t.noToTokenSelected}(Me),r=function(e){var t=y.f.views[A.j.SWAP].validation;return e&&0!==parseFloat(e)?"":t.noAmountInputted}(Se);return e&&Te(e),t&&le(t),n&&Ue(n),r&&Re(r),!(e||t||n||r)},updateLoading:function(e){N(e)},loading:U,transaction:Qe,data:{fromAmount:oe,fromContractAddress:null===Ce||void 0===Ce?void 0:Ce.address,toContractAddress:null===Me||void 0===Me?void 0:Me.address},insufficientFundsForGas:It,openNotEnoughImxDrawer:function(){kt(!1),xt(!0)}}),(0,z.jsx)(ae,{visible:mt,showAdjustAmount:(null===Ce||void 0===Ce?void 0:Ce.address)===P.sv,hasZeroImx:!1,onAddCoinsClick:function(){var e,t;C({payload:{type:q.Cp.UPDATE_VIEW,view:{type:q.cZ.TOP_UP_VIEW},currentViewData:{fromContractAddress:null!==(e=null===Ce||void 0===Ce?void 0:Ce.address)&&void 0!==e?e:"",fromAmount:oe,toContractAddress:null!==(t=null===Me||void 0===Me?void 0:Me.address)&&void 0!==t?t:""}}})},onCloseBottomSheet:function(){return xt(!1)}}),(0,z.jsx)(pe,{visible:Et,onCloseBottomSheet:function(){kt(!1),he(void 0),se(""),Oe(void 0),je("")}})]})}var Ce=function(e,t){if(0===e.length)return!0;var n=!1;return e.forEach((function(e){e.token.symbol===t&&e.balance.eq(0)&&(n=!0)})),n},he=n(83712);function Ee(e){var t=e.fromAmount,n=e.toAmount,r=e.fromContractAddress,o=e.toContractAddress,a=y.f.views[A.j.SWAP].header,s=(0,l.useContext)(q.A7),i=s.viewState,c=s.viewDispatch,u=(0,l.useContext)(he.yh).eventTargetState.eventTarget,d=(0,l.useMemo)((function(){return i.history.length>2&&i.history[i.history.length-2].type===q.cZ.TOP_UP_VIEW}),[i.history]),f=(0,l.useContext)(F).swapState.tokenBalances,v=(0,l.useState)(!1),x=(0,m.Z)(v,2),C=x[0],h=x[1];return(0,l.useEffect)((function(){Ce(f,P.VC)&&h(!0)}),[f]),(0,z.jsx)(b.X,{header:(0,z.jsx)(k.F,{showBack:d,title:a.title,onCloseButtonClick:function(){return g(u)}}),footer:(0,z.jsx)(w.w,{}),footerBackgroundColor:"base.color.translucent.emphasis.200",children:(0,z.jsxs)(p.xu,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[(0,z.jsx)(xe,{data:{fromAmount:t,toAmount:n,fromContractAddress:r,toContractAddress:o}}),(0,z.jsx)(ae,{visible:C,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:function(){c({payload:{type:q.Cp.UPDATE_VIEW,view:{type:q.cZ.TOP_UP_VIEW}}})},onCloseBottomSheet:function(){h(!1)}})]})})}var ke=n(33939),be=n(46207),we=n(37324),ge=n(87686),ye=n(74);function Ae(e){var t=e.transactionResponse,n=e.swapForm,r=(0,l.useContext)(q.A7).viewDispatch,o=y.f.views[A.j.SWAP].IN_PROGRESS.loading;return(0,l.useEffect)((function(){(0,v.Z)((0,f.Z)().mark((function e(){var o;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.wait();case 3:if(1!==(o=e.sent).status){e.next=7;break}return r({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.SUCCESS,data:{transactionHash:o.transactionHash}}}}),e.abrupt("return");case 7:r({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.FAIL,data:n,reason:"Transaction failed"}}}),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),r({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.FAIL,data:n,reason:"Transaction failed"}}});case 13:case"end":return e.stop()}}),e,null,[[0,10]])})))()}),[t]),(0,z.jsx)(ke.J,{loadingText:o.text,showFooterLogo:!0})}var Te,Ie,Le,Se,je,Ze,Fe,_e,Re,Ve,Pe,Me,Oe,Be,De,We,Ue,Ne,Ge,ze,Xe,He,qe,Qe,Ye,Ke,Je,$e,et,tt,nt,rt,ot,at,st,it,ct,ut,lt,dt,pt,ft,vt,mt,xt,Ct,ht,Et,kt,bt,wt,gt,yt,At,Tt,It,Lt,St,jt,Zt,Ft,_t,Rt,Vt,Pt,Mt,Ot,Bt,Dt,Wt=n(33398),Ut=n(57367),Nt=n(35314),Gt=["title","titleId"];function zt(){return zt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zt.apply(this,arguments)}function Xt(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Ht(e,t){var n=e.title,r=e.titleId,o=Xt(e,Gt);return l.createElement("svg",zt({width:430,height:305,viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":r},o),n?l.createElement("title",{id:r},n):null,Te||(Te=l.createElement("path",{d:"M94.0614 105.632L93.6321 104L92 104.429L92.4292 106.061L94.0614 105.632Z",fill:"white"})),Ie||(Ie=l.createElement("path",{d:"M63.6531 193.101L63.1006 191L60.9996 191.553L61.5521 193.654L63.6531 193.101Z",fill:"white"})),Le||(Le=l.createElement("path",{d:"M344.489 224.345L342.345 224L342 226.145L344.144 226.49L344.489 224.345Z",fill:"white"})),Se||(Se=l.createElement("path",{d:"M372.286 139.905L372.905 138.619L371.619 138L371 139.286L372.286 139.905Z",fill:"white"})),je||(je=l.createElement("path",{d:"M341.653 78.101L341.101 76L339 76.5525L339.552 78.6535L341.653 78.101Z",fill:"white"})),Ze||(Ze=l.createElement("path",{d:"M359.286 242.905L359.905 241.619L358.619 241L358 242.286L359.286 242.905Z",fill:"white"})),Fe||(Fe=l.createElement("path",{d:"M87.0123 112.087L86.0869 111L85.0002 111.925L85.9256 113.012L87.0123 112.087Z",fill:"white"})),_e||(_e=l.createElement("path",{d:"M84.2862 248.905L84.9053 247.619L83.6192 247L83.0001 248.286L84.2862 248.905Z",fill:"white"})),Re||(Re=l.createElement("path",{d:"M215.496 262.992C268.237 262.992 310.993 220.237 310.993 167.496C310.993 114.755 268.237 72 215.496 72C162.755 72 120 114.755 120 167.496C120 220.237 162.755 262.992 215.496 262.992Z",fill:"white",fillOpacity:.24,stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ve||(Ve=l.createElement("path",{d:"M159.82 95.1695C179.975 79.6536 204.651 73.1506 227.89 77.0665C261.089 82.6606 253.281 101.028 199.197 121.314C151.934 139.037 123.49 136.348 143.823 110.95C148.422 105.208 153.721 99.8623 159.82 95.1695Z",fill:"white",fillOpacity:.08})),Pe||(Pe=l.createElement("path",{d:"M215.497 227.183C171.451 227.183 135.159 219.871 130.194 210.462H130.187C145.912 241.626 178.21 263.001 215.497 263.001C252.705 263.001 284.942 241.719 300.706 210.664C295.33 219.98 259.232 227.183 215.505 227.183H215.497Z",fill:"#36E0F8",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Me||(Me=l.createElement("path",{d:"M284.219 219.607L283.978 219.84C281.275 222.482 256.583 215.986 253.172 218.418C222.389 240.36 182.779 269.061 146.099 219.397C146.099 219.397 140.761 217.641 138.609 216.686C139.425 217.96 140.279 219.226 141.165 220.469C170.425 261.516 227.423 271.073 268.47 241.813C276.97 235.752 284.118 228.503 289.852 220.454L292.424 216.841L288.252 218.302C287.086 218.713 285.851 219.11 284.553 219.498L284.227 219.599L284.219 219.607Z",fill:"black"})),Oe||(Oe=l.createElement("path",{d:"M215.496 241.4C262.183 241.4 300.03 226.557 300.03 208.248C300.03 189.938 262.183 175.095 215.496 175.095C168.81 175.095 130.963 189.938 130.963 208.248C130.963 226.557 168.81 241.4 215.496 241.4Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Be||(Be=l.createElement("path",{d:"M300.705 210.659C300.705 210.659 300.705 210.65 300.705 210.641C300.705 210.641 300.705 210.65 300.705 210.659Z",fill:"#EBE9E9",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),De||(De=l.createElement("path",{d:"M193.624 204.511C208.952 204.511 221.377 199.638 221.377 193.626C221.377 187.614 208.952 182.741 193.624 182.741C178.297 182.741 165.871 187.614 165.871 193.626C165.871 199.638 178.297 204.511 193.624 204.511Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),We||(We=l.createElement("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ue||(Ue=l.createElement("path",{d:"M197.33 204.41C199.49 204.294 201.573 204.084 203.546 203.789V211.512C201.573 211.807 199.49 212.017 197.33 212.133V204.41Z",fill:"#D0F500"})),Ne||(Ne=l.createElement("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901V206.624C215.255 208.497 211.246 210.027 206.398 211.014V203.291Z",fill:"black"})),Ge||(Ge=l.createElement("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),ze||(ze=l.createElement("path",{d:"M206.398 211.015C211.246 210.028 215.255 208.497 217.905 206.625",stroke:"#A66CFF",strokeLinecap:"round",strokeLinejoin:"round"})),Xe||(Xe=l.createElement("path",{d:"M193.624 196.788C208.952 196.788 221.377 191.914 221.377 185.903C221.377 179.891 208.952 175.017 193.624 175.017C178.297 175.017 165.871 179.891 165.871 185.903C165.871 191.914 178.297 196.788 193.624 196.788Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),He||(He=l.createElement("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),qe||(qe=l.createElement("path",{d:"M197.33 196.687C199.49 196.57 201.573 196.361 203.546 196.065V203.788C201.573 204.084 199.49 204.293 197.33 204.41V196.687Z",fill:"#36E0F8"})),Qe||(Qe=l.createElement("path",{d:"M206.398 195.568C211.246 194.581 215.255 193.051 217.905 191.178V198.901C215.255 200.774 211.246 202.304 206.398 203.291V195.568Z",fill:"black"})),Ye||(Ye=l.createElement("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ke||(Ke=l.createElement("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),Je||(Je=l.createElement("path",{d:"M193.624 189.065C208.952 189.065 221.377 184.192 221.377 178.18C221.377 172.168 208.952 167.294 193.624 167.294C178.297 167.294 165.871 172.168 165.871 178.18C165.871 184.192 178.297 189.065 193.624 189.065Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),$e||($e=l.createElement("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),et||(et=l.createElement("path",{d:"M197.33 188.965C199.49 188.849 201.573 188.639 203.546 188.343V196.067C201.573 196.362 199.49 196.571 197.33 196.688V188.965Z",fill:"#F191FA"})),tt||(tt=l.createElement("path",{d:"M206.398 187.845C211.246 186.858 215.255 185.327 217.905 183.455V191.178C215.255 193.05 211.246 194.581 206.398 195.568V187.845Z",fill:"black"})),nt||(nt=l.createElement("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),rt||(rt=l.createElement("path",{d:"M206.398 195.569C211.246 194.582 215.255 193.052 217.905 191.179",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),ot||(ot=l.createElement("path",{d:"M238.601 212.934C253.929 212.934 266.354 208.06 266.354 202.049C266.354 196.037 253.929 191.164 238.601 191.164C223.274 191.164 210.848 196.037 210.848 202.049C210.848 208.06 223.274 212.934 238.601 212.934Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),at||(at=l.createElement("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),st||(st=l.createElement("path",{d:"M242.307 212.833C244.467 212.717 246.55 212.507 248.523 212.212V219.935C246.55 220.23 244.467 220.44 242.307 220.556V212.833Z",fill:"#F191FA"})),it||(it=l.createElement("path",{d:"M251.375 211.713C256.223 210.727 260.232 209.196 262.882 207.324V215.047C260.232 216.919 256.223 218.45 251.375 219.436V211.713Z",fill:"black"})),ct||(ct=l.createElement("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),ut||(ut=l.createElement("path",{d:"M251.375 219.437C256.223 218.45 260.232 216.919 262.882 215.047",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),lt||(lt=l.createElement("path",{d:"M238.601 205.21C253.929 205.21 266.354 200.336 266.354 194.324C266.354 188.313 253.929 183.439 238.601 183.439C223.274 183.439 210.848 188.313 210.848 194.324C210.848 200.336 223.274 205.21 238.601 205.21Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),dt||(dt=l.createElement("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),pt||(pt=l.createElement("path",{d:"M242.307 205.109C244.467 204.993 246.55 204.783 248.523 204.488V212.211C246.55 212.506 244.467 212.716 242.307 212.832V205.109Z",fill:"#36E0F8"})),ft||(ft=l.createElement("path",{d:"M251.375 203.989C256.223 203.003 260.232 201.472 262.882 199.6V207.323C260.232 209.195 256.223 210.726 251.375 211.712V203.989Z",fill:"black"})),vt||(vt=l.createElement("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),mt||(mt=l.createElement("path",{d:"M251.375 211.713C256.223 210.726 260.232 209.195 262.882 207.323",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),xt||(xt=l.createElement("path",{d:"M238.601 197.487C253.929 197.487 266.354 192.613 266.354 186.602C266.354 180.59 253.929 175.716 238.601 175.716C223.274 175.716 210.848 180.59 210.848 186.602C210.848 192.613 223.274 197.487 238.601 197.487Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ct||(Ct=l.createElement("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),ht||(ht=l.createElement("path",{d:"M242.307 197.386C244.467 197.27 246.55 197.06 248.523 196.765V204.488C246.55 204.783 244.467 204.992 242.307 205.109V197.386Z",fill:"#F191FA"})),Et||(Et=l.createElement("path",{d:"M251.375 196.267C256.223 195.28 260.232 193.75 262.882 191.877V199.6C260.232 201.473 256.223 203.003 251.375 203.99V196.267Z",fill:"#9AEFFB"})),kt||(kt=l.createElement("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),bt||(bt=l.createElement("path",{d:"M251.375 203.99C256.223 203.004 260.232 201.473 262.882 199.601",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),wt||(wt=l.createElement("path",{d:"M232.652 189.678C247.979 189.678 260.405 184.804 260.405 178.793C260.405 172.781 247.979 167.908 232.652 167.908C217.324 167.908 204.899 172.781 204.899 178.793C204.899 184.804 217.324 189.678 232.652 189.678Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),gt||(gt=l.createElement("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),yt||(yt=l.createElement("path",{d:"M236.358 189.578C238.518 189.461 240.6 189.251 242.574 188.956V196.679C240.6 196.974 238.518 197.184 236.358 197.301V189.578Z",fill:"#F191FA"})),At||(At=l.createElement("path",{d:"M245.426 188.458C250.274 187.471 254.283 185.94 256.932 184.067V191.791C254.283 193.663 250.274 195.194 245.426 196.18V188.458Z",fill:"black"})),Tt||(Tt=l.createElement("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),It||(It=l.createElement("path",{d:"M245.426 196.182C250.274 195.195 254.283 193.664 256.932 191.792",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),Lt||(Lt=l.createElement("path",{d:"M240.99 180.021C256.317 180.021 268.743 175.148 268.743 169.136C268.743 163.124 256.317 158.25 240.99 158.25C225.662 158.25 213.237 163.124 213.237 169.136C213.237 175.148 225.662 180.021 240.99 180.021Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),St||(St=l.createElement("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),jt||(jt=l.createElement("path",{d:"M244.696 179.92C246.856 179.804 248.938 179.594 250.911 179.299V187.022C248.938 187.317 246.856 187.527 244.696 187.643V179.92Z",fill:"#9AEFFB"})),Zt||(Zt=l.createElement("path",{d:"M253.763 178.801C258.612 177.815 262.621 176.284 265.27 174.412V182.135C262.621 184.007 258.612 185.538 253.763 186.524V178.801Z",fill:"black"})),Ft||(Ft=l.createElement("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),_t||(_t=l.createElement("path",{d:"M253.763 186.525C258.612 185.538 262.621 184.007 265.27 182.135",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),Rt||(Rt=l.createElement("path",{d:"M189.911 223.803C205.238 223.803 217.664 218.929 217.664 212.918C217.664 206.906 205.238 202.032 189.911 202.032C174.583 202.032 162.158 206.906 162.158 212.918C162.158 218.929 174.583 223.803 189.911 223.803Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Vt||(Vt=l.createElement("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Pt||(Pt=l.createElement("path",{d:"M193.625 223.71C195.785 223.593 197.867 223.384 199.84 223.088V230.811C197.867 231.107 195.785 231.316 193.625 231.433V223.71Z",fill:"#F191FA"})),Mt||(Mt=l.createElement("path",{d:"M202.685 222.583C207.533 221.596 211.542 220.066 214.191 218.193V225.916C211.542 227.789 207.533 229.319 202.685 230.306V222.583Z",fill:"#9AEFFB"})),Ot||(Ot=l.createElement("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Bt||(Bt=l.createElement("path",{d:"M202.685 230.306C207.533 229.32 211.542 227.789 214.191 225.917",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"})),Dt||(Dt=l.createElement("path",{d:"M300.705 210.658C300.705 210.658 300.705 210.649 300.705 210.641C300.705 210.641 300.705 210.649 300.705 210.658Z",fill:"#A66CFF",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})))}var qt=l.forwardRef(Ht),Qt=(n.p,n(6609));function Yt(){return(0,z.jsx)(p.xu,{sx:(0,S.Z)((0,S.Z)({},Qt.q_),{},{background:"base.color.translucent.emphasis.100"}),children:(0,z.jsx)(p.xu,{sx:(0,S.Z)((0,S.Z)({},Qt.Tb),Qt.iz),children:(0,z.jsx)(qt,{})})})}var Kt=n(94372);function Jt(e){var t=e.data,n=(0,l.useContext)(F).swapState.allowedTokens,r=(0,l.useContext)(K.R4).connectLoaderState,o=r.checkout,a=r.provider,s=(0,l.useContext)(q.A7).viewDispatch,i=y.f.views[A.j.APPROVE_ERC20],c=i.approveSpending,u=i.approveSwap,d=(0,l.useContext)(he.yh).eventTargetState.eventTarget,C=(0,Nt.T)(a),h=(0,l.useState)(!1),E=(0,m.Z)(h,2),w=E[0],T=E[1],I=(0,l.useState)(!1),L=(0,m.Z)(I,2),S=L[0],j=L[1],Z=(0,l.useState)(!1),_=(0,m.Z)(Z,2),R=_[0],V=_[1],P=(0,l.useState)(!1),M=(0,m.Z)(P,2),O=M[0],B=M[1],D=(0,l.useState)(!1),W=(0,m.Z)(D,2),U=W[0],N=W[1],G=(0,l.useState)(!1),X=(0,m.Z)(G,2),H=X[0],Q=X[1],Y=(0,l.useMemo)((function(){return n.find((function(e){return e.address===t.swapFormInfo.fromContractAddress}))}),[n,t.swapFormInfo.fromContractAddress]),J=(0,l.useCallback)((function(){s({payload:{type:q.Cp.UPDATE_VIEW,view:{type:q.cZ.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[s]),$=(0,l.useCallback)((function(){s({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.SWAP,data:t.swapFormInfo}}})}),[s]),ee=function(e,t){e.type!==x.XQ.UNPREDICTABLE_GAS_LIMIT?e.type===x.XQ.TRANSACTION_FAILED||e.type===x.XQ.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?s({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.FAIL,reason:"Transaction failed",data:t}}}):s({payload:{type:q.Cp.UPDATE_VIEW,view:{type:q.cZ.ERROR_VIEW,error:e}}}):s({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.PRICE_SURGE,data:t}}})},te=(0,l.useCallback)((0,v.Z)((0,f.Z)().mark((function e(){var n;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!O){e.next=2;break}return e.abrupt("return");case 2:if(B(!0),o&&a){e.next=6;break}return J(),e.abrupt("return");case 6:if(!w){e.next=8;break}return e.abrupt("return");case 8:return T(!0),e.prev=9,e.next=12,o.sendTransaction({provider:a,transaction:t.approveTransaction});case 12:return n=e.sent,j(!0),e.next=16,n.transactionResponse.wait();case 16:if(1===e.sent.status){e.next=20;break}return s({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.FAIL,data:t.swapFormInfo}}}),e.abrupt("return");case 20:j(!1),T(!1),V(!0),e.next=33;break;case 25:if(e.prev=25,e.t0=e.catch(9),j(!1),T(!1),e.t0.type!==x.XQ.USER_REJECTED_REQUEST_ERROR){e.next=32;break}return N(!0),e.abrupt("return");case 32:ee(e.t0,t.swapFormInfo);case 33:return e.prev=33,B(!1),e.finish(33);case 36:case"end":return e.stop()}}),e,null,[[9,25,33,36]])}))),[o,a,J,s,Q,t.approveTransaction,t.swapFormInfo,w,T,j]),ne=(0,l.useMemo)((function(){var e=c.content,n=e.metamask,r=e.passport;return(0,z.jsxs)(Ut.b,{heading:C?r.heading:n.heading,children:[C&&(0,z.jsx)(p.xu,{children:r.body}),!C&&(0,z.jsx)(p.xu,{children:"".concat(n.body[0]," ").concat(t.swapFormInfo.fromAmount," ").concat((null===Y||void 0===Y?void 0:Y.symbol)||""," ").concat(n.body[1])})]})}),[t.swapFormInfo,Y,C]),re=(0,l.useMemo)((function(){return(0,z.jsx)(Wt.S,{loading:O,actionText:U?c.footer.retryText:c.footer.buttonText,onActionClick:te})}),[U,te,O]),oe=(0,l.useCallback)((0,v.Z)((0,f.Z)().mark((function e(){var n;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!O){e.next=2;break}return e.abrupt("return");case 2:if(B(!0),o&&a){e.next=6;break}return J(),e.abrupt("return");case 6:if(!w){e.next=8;break}return e.abrupt("return");case 8:return T(!0),e.prev=9,e.next=12,o.sendTransaction({provider:a,transaction:t.transaction});case 12:n=e.sent,T(!1),s({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.IN_PROGRESS,data:{transactionResponse:n.transactionResponse,swapForm:t.swapFormInfo}}}}),e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(9),T(!1),e.t0.type!==x.XQ.USER_REJECTED_REQUEST_ERROR){e.next=23;break}return Q(!0),e.abrupt("return");case 23:ee(e.t0,t.swapFormInfo);case 24:return e.prev=24,B(!1),e.finish(24);case 27:case"end":return e.stop()}}),e,null,[[9,17,24,27]])}))),[o,a,J,s,Q,t.transaction,t.swapFormInfo,w,T]),ae=(0,z.jsx)(Ut.b,{heading:u.content.heading,children:(0,z.jsx)(p.xu,{children:u.content.body})}),se=(0,l.useMemo)((function(){return(0,z.jsx)(Wt.S,{loading:O,actionText:H?u.footer.retryText:u.footer.buttonText,onActionClick:oe})}),[H,oe,O]);return(0,z.jsxs)(z.Fragment,{children:[S&&(0,z.jsx)(ke.J,{loadingText:c.loading.text,showFooterLogo:!0}),!S&&(0,z.jsx)(b.X,{header:(0,z.jsx)(k.F,{transparent:!0,showBack:!0,onCloseButtonClick:function(){return g(d)},onBackButtonClick:$}),floatHeader:!0,heroContent:R?(0,z.jsx)(Kt.N,{}):(0,z.jsx)(Yt,{}),footer:R?se:re,children:R?ae:ne})]})}var $t=n(1138),en=n(97183),tn=n(48543);function nn(e){var t,n,r,o,a,s,i=y.f.views[A.j.SWAP],c=i.success,u=i.failed,d=i.rejected,k=y.f.views[q.cZ.LOADING_VIEW].text,b=y.f.views[q.cZ.ERROR_VIEW].actionText,w=(0,l.useContext)(he.yh).eventTargetState.eventTarget,T=e.params,I=e.config,L=I.environment,S=I.theme,R=I.isOnRampEnabled,V=I.isSwapEnabled,M=I.isBridgeEnabled,O=T.amount,B=T.fromContractAddress,D=T.toContractAddress,W=(0,l.useContext)(K.R4).connectLoaderState,U=W.checkout,N=W.provider,G=(0,l.useReducer)(q.Uy,q.NW),X=(0,m.Z)(G,2),H=X[0],Q=X[1],Y=(0,l.useReducer)(_,j),J=(0,m.Z)(Y,2),$=J[0],ee=J[1],te=(0,l.useState)(!1),ne=(0,m.Z)(te,2),re=ne[0],oe=ne[1],ae=(0,l.useMemo)((function(){return{swapState:$,swapDispatch:ee}}),[$,ee]),se=(0,l.useMemo)((function(){return{viewState:H,viewDispatch:Q}}),[H,Q]),ie=(0,l.useMemo)((function(){return(0,tn.e)(S)}),[S]),ce=(0,l.useCallback)((function(e,t){Q({payload:{type:q.Cp.UPDATE_VIEW,view:{type:q.cZ.ERROR_VIEW,tryAgain:t,error:e}}})}),[Q]),ue=(0,l.useCallback)((function(){Q({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.SWAP}}})}),[Q]),le=function(){var e=(0,v.Z)((0,f.Z)().mark((function e(){var t;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U){e.next=2;break}throw new Error("loadBalances: missing checkout");case 2:if(N){e.next=4;break}throw new Error("loadBalances: missing provider");case 4:return t={allowList:{tokens:[]},allowedBalances:[]},e.prev=5,e.next=8,(0,en.Z)({checkout:U,provider:N,allowTokenListType:x.Zs.SWAP});case 8:t=e.sent,e.next=16;break;case 11:if(e.prev=11,e.t0=e.catch(5),!P.NA.nonRetryable(e.t0)){e.next=16;break}return ce(e.t0,le),e.abrupt("return",!1);case 16:return ee({payload:{type:Z.SET_ALLOWED_TOKENS,allowedTokens:t.allowList.tokens}}),ee({payload:{type:Z.SET_TOKEN_BALANCES,tokenBalances:t.allowedBalances}}),e.abrupt("return",!0);case 19:case"end":return e.stop()}}),e,null,[[5,11]])})));return function(){return e.apply(this,arguments)}}();return(0,l.useEffect)((function(){(0,v.Z)((0,f.Z)().mark((function e(){var t,n,r;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U&&N){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,U.getNetworkInfo({provider:N});case 4:if((t=e.sent).isSupported){e.next=7;break}return e.abrupt("return");case 7:return e.prev=7,e.next=10,U.config.remote.getConfig("dex");case 10:n=e.sent.overrides,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(7),ce(e.t0);case 16:return r=new h.ei({chainId:t.chainId,baseConfig:new C.L({environment:L}),overrides:n}),ee({payload:{type:Z.SET_EXCHANGE,exchange:r}}),ee({payload:{type:Z.SET_NETWORK,network:t}}),e.next=21,le();case 21:if(e.sent){e.next=23;break}return e.abrupt("return");case 23:ue();case 24:case"end":return e.stop()}}),e,null,[[7,13]])})))()}),[U,N]),(0,z.jsx)(p.mD,{theme:{base:ie},bottomSheetContainerId:"bottom-sheet-container",children:(0,z.jsx)(q.A7.Provider,{value:se,children:(0,z.jsx)(F.Provider,{value:ae,children:(0,z.jsxs)(be.e,{environment:L,children:[H.view.type===q.cZ.LOADING_VIEW&&(0,z.jsx)(ke.J,{loadingText:k}),H.view.type===A.j.SWAP&&(0,z.jsx)(Ee,{fromAmount:null!==(t=null===(n=H.view.data)||void 0===n?void 0:n.fromAmount)&&void 0!==t?t:O,fromContractAddress:null!==(r=null===(o=H.view.data)||void 0===o?void 0:o.fromContractAddress)&&void 0!==r?r:B,toContractAddress:null!==(a=null===(s=H.view.data)||void 0===s?void 0:s.toContractAddress)&&void 0!==a?a:D}),H.view.type===A.j.IN_PROGRESS&&(0,z.jsx)(Ae,{transactionResponse:H.view.data.transactionResponse,swapForm:H.view.data.swapForm}),H.view.type===A.j.APPROVE_ERC20&&(0,z.jsx)(Jt,{data:H.view.data}),H.view.type===A.j.SUCCESS&&(0,z.jsx)(we.l,{statusText:c.text,actionText:c.actionText,onRenderEvent:function(){return function(e,t){var n=new CustomEvent(E.O6.IMTBL_SWAP_WIDGET_EVENT,{detail:{type:E.pY.SUCCESS,data:{transactionHash:t}}});console.log("swap success event:",e,n),void 0!==e&&e.dispatchEvent(n)}(w,H.view.data.transactionHash)},onActionClick:function(){return g(w)},statusType:ge.i.SUCCESS,testId:"success-view"}),H.view.type===A.j.FAIL&&(0,z.jsx)(we.l,{statusText:u.text,actionText:u.actionText,onRenderEvent:function(){return function(e,t){var n=new CustomEvent(E.O6.IMTBL_SWAP_WIDGET_EVENT,{detail:{type:E.pY.FAILURE,data:{reason:t,timestamp:(new Date).getTime()}}});console.log("swap failed event:",e,n),void 0!==e&&e.dispatchEvent(n)}(w,"Transaction failed")},onActionClick:function(){H.view.type===A.j.FAIL&&Q({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.SWAP,data:H.view.data}}})},statusType:ge.i.FAILURE,onCloseClick:function(){return g(w)},testId:"fail-view"}),H.view.type===A.j.PRICE_SURGE&&(0,z.jsx)(we.l,{statusText:d.text,actionText:d.actionText,onRenderEvent:function(){return function(e,t){var n=new CustomEvent(E.O6.IMTBL_SWAP_WIDGET_EVENT,{detail:{type:E.pY.REJECTED,data:{reason:t,timestamp:(new Date).getTime()}}});console.log("swap rejected event:",e,n),void 0!==e&&e.dispatchEvent(n)}(w,"Price surge")},onActionClick:function(){H.view.type===A.j.PRICE_SURGE&&Q({payload:{type:q.Cp.UPDATE_VIEW,view:{type:A.j.SWAP,data:H.view.data}}})},statusType:ge.i.WARNING,onCloseClick:function(){return g(w)},testId:"price-surge-view"}),H.view.type===q.cZ.ERROR_VIEW&&(0,z.jsx)(ye.o,{actionText:b,onActionClick:(0,v.Z)((0,f.Z)().mark((function e(){var t;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(oe(!0),(t=H.view).tryAgain){e.next=6;break}return ue(),oe(!1),e.abrupt("return");case 6:return e.next=8,t.tryAgain();case 8:if(!e.sent){e.next=10;break}ue();case 10:oe(!1);case 11:case"end":return e.stop()}}),e)}))),onCloseClick:function(){return g(w)},errorEventActionLoading:re}),H.view.type===q.cZ.TOP_UP_VIEW&&(0,z.jsx)($t.t,{widgetEvent:E.O6.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:R,showSwapOption:V,showBridgeOption:M,onCloseButtonClick:function(){return g(w)}})]})})})})}var rn=n(73966),on=n(79394),an=n(29601),sn=n(95110),cn=function(e){(0,c.Z)(n,e);var t=(0,u.Z)(n);function n(){var e;(0,o.Z)(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return(e=t.call.apply(t,[this].concat(a))).walletProvider=void 0,e.amount="",e.fromContractAddress="",e.toContractAddress="",e}return(0,a.Z)(n,[{key:"connectedCallback",value:function(){var e,t,r,o,a,c;(0,s.Z)((0,i.Z)(n.prototype),"connectedCallback",this).call(this),this.walletProvider=null===(e=this.getAttribute("walletProvider"))||void 0===e?void 0:e.toLowerCase(),this.amount=null!==(t=this.getAttribute("amount"))&&void 0!==t?t:"",this.fromContractAddress=null!==(r=null===(o=this.getAttribute("fromContractAddress"))||void 0===o?void 0:o.toLowerCase())&&void 0!==r?r:"",this.toContractAddress=null!==(a=null===(c=this.getAttribute("toContractAddress"))||void 0===c?void 0:c.toLowerCase())&&void 0!==a?a:"",this.renderWidget()}},{key:"attributeChangedCallback",value:function(e,t,r){(0,s.Z)((0,i.Z)(n.prototype),"attributeChangedCallback",this).call(this,e,t,r),"amount"===e&&(this.amount=r),"fromcontractaddress"===e&&(this.fromContractAddress=r),"tocontractaddress"===e&&(this.toContractAddress=r),"walletprovider"===e&&(this.walletProvider=r.toLowerCase()),this.renderWidget()}},{key:"validateInputs",value:function(){(0,an.Qh)(this.walletProvider)||(console.warn('[IMTBL]: invalid "walletProvider" widget input'),this.walletProvider=void 0),(0,an.g1)(this.amount)||(console.warn('[IMTBL]: invalid "amount" widget input'),this.amount=""),(0,an.At)(this.fromContractAddress)||(console.warn('[IMTBL]: invalid "fromContractAddress" widget input'),this.fromContractAddress=""),(0,an.At)(this.toContractAddress)||(console.warn('[IMTBL]: invalid "toContractAddress" widget input'),this.toContractAddress="")}},{key:"renderWidget",value:function(){this.validateInputs();var e={targetLayer:P.PU.LAYER2,walletProvider:this.walletProvider,web3Provider:this.provider,passport:this.passport,allowedChains:[(0,P.D3)(this.checkout.config)]},t={amount:this.amount,fromContractAddress:this.fromContractAddress,toContractAddress:this.toContractAddress};this.reactRoot||(this.reactRoot=d.createRoot(this)),this.reactRoot.render((0,z.jsx)(l.StrictMode,{children:(0,z.jsx)(p.jU,{children:(0,z.jsx)(sn.$,{widgetConfig:this.widgetConfig,children:(0,z.jsx)(on.X,{params:e,widgetConfig:this.widgetConfig,closeEvent:function(){return g(window)},children:(0,z.jsx)(nn,{params:t,config:this.widgetConfig})})})})}))}}],[{key:"observedAttributes",get:function(){var e=(0,s.Z)((0,i.Z)(n),"observedAttributes",this);return[].concat((0,r.Z)(e),["amount","fromcontractaddress","tocontractaddress","walletprovider"])}}]),n}(rn.D)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_imtbl_checkout_widgets_lib=self.webpackChunk_imtbl_checkout_widgets_lib||[]).push([[472],{86249:function(e,t,n){n.d(t,{M:function(){return k}});var r=n(50940),i={display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingTop:"base.spacing.x3"},o={display:"flex",flexDirection:"column"},a=n(46869),l={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},s={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},c={display:"flex",width:"100%"},d=function(e){return{width:"50%",color:e?"base.color.text.primary":"base.color.text.secondary"}},u={width:"50%"},L=n(10256);function h(e){var t=e.boldLabel,n=e.label,i=e.amount,o=e.fiatAmount,a=n.toLowerCase().replace(" ","-");return(0,L.jsxs)(r.xu,{sx:c,testId:"fee-item-".concat(a),children:[(0,L.jsx)(r.uT,{sx:d(t),children:n}),(0,L.jsx)(r.nk,{testId:a,sx:u,price:i,fiatAmount:o})]})}var x=n(95269),f=n(4813);function p(e){var t=e.fees,n=e.children,i=e.onCloseBottomSheet,o=e.visible,a=e.totalFiatAmount,c=e.totalAmount;return(0,L.jsxs)(r.R1,{headerBarTitle:x.f.drawers.feesBreakdown.heading,size:"threeQuarter",onCloseBottomSheet:i,visible:o,children:[(0,L.jsx)(r.R1.Target,{children:n}),(0,L.jsxs)(r.R1.Content,{testId:"fees-breakdown-content",sx:l,children:[(0,L.jsxs)(r.xu,{sx:s,children:[(0,L.jsx)(h,{label:x.f.drawers.feesBreakdown.total,amount:c,fiatAmount:a,boldLabel:!0},x.f.drawers.feesBreakdown.total),(0,L.jsx)(r.iz,{size:"xSmall"}),t.map((function(e){var t=e.label,n=e.amount,r=e.fiatAmount;return(0,L.jsx)(h,{label:t,amount:n,fiatAmount:r},t)}))]}),(0,L.jsx)(f.w,{})]})]})}function k(e){var t=e.title,n=e.fiatPricePrefix,l=e.gasFeeValue,s=e.gasFeeToken,c=e.gasFeeFiatValue;if(!l)return(0,L.jsx)(r.xu,{});var d=(0,a.FL)((0,a.Lr)(l)),u=null===s||void 0===s?void 0:s.symbol,h=u?"".concat(u," ").concat(d):d;return(0,L.jsxs)(r.xu,{sx:i,children:[(0,L.jsxs)(r.xu,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"base.spacing.x2"},children:[(0,L.jsx)(p,{totalFiatAmount:"".concat(n," $").concat(c),totalAmount:h,fees:[{label:x.f.drawers.feesBreakdown.fees.gas.label,fiatAmount:"".concat(n," $").concat(c),amount:h}],children:(0,L.jsx)(r.iv,{size:"small",variant:"tertiary",icon:"ChevronExpand",iconVariant:"bold"})}),(0,L.jsx)(r.uT,{size:"medium",weight:"regular",children:t})]}),(0,L.jsxs)(r.xu,{sx:o,children:[(0,L.jsx)(r.uT,{testId:"fee_description_gas",size:"medium",weight:"regular",sx:{textAlign:"right"},children:"\u2248 ".concat(u," ").concat((0,a.FL)((0,a.Lr)(l)))}),(0,L.jsx)(r.uT,{testId:"fee_description_gas_fiat",size:"small",weight:"regular",sx:{color:"base.color.text.secondary",textAlign:"right"},children:"".concat(n," $").concat((0,a.FL)(c,!0))})]})]})}},98729:function(e,t,n){n.d(t,{G:function(){return o}});var r=n(50940),i=n(10256);function o(e){var t=e.testId,n=e.children,o=e.subtext,a=e.textAlign,l=e.isErrored,s=e.errorMessage,c=e.sx;return(0,i.jsxs)(r.NI,{testId:t,textAlign:null!==a&&void 0!==a?a:"left",validationStatus:l?"error":"success",sx:c,children:[n,o&&(0,i.jsx)(r.NI.Caption,{testId:"".concat(t,"-subtext"),children:o}),l&&(0,i.jsx)(r.NI.Validation,{testId:"".concat(t,"-error"),children:s})]})}},35047:function(e,t,n){n.d(t,{p:function(){return h}});var r=n(37755),i=n(72771),o=n(50940),a=n(65535),l=n(98729),s=n(95269),c=n(10256);function d(e){var t=e.onClick,n=e.icon,r=e.name,i=e.symbol,a=e.balance,l=e.testId,d=e.id,u=s.f.drawers.coinSelector;return(0,c.jsxs)(o.sN,{testId:"".concat(l,"-coin-selector__option-").concat(d),emphasized:!0,size:"small",onClick:t,children:[!n&&(0,c.jsx)(o.sN.Icon,{icon:"Coins",variant:"bold"}),n&&(0,c.jsx)(o.sN.FramedImage,{imageUrl:n,circularFrame:!0}),(0,c.jsx)(o.sN.Label,{children:r}),(0,c.jsx)(o.sN.Caption,{children:i}),a&&(0,c.jsx)(o.sN.PriceDisplay,{fiatAmount:"".concat(u.option.fiatPricePrefix).concat(a.formattedFiatAmount),price:a.formattedAmount})]})}var u={display:"flex",flexDirection:"column",gap:"2px"};function L(e){var t=e.heading,n=e.options,r=e.children,i=e.onCloseBottomSheet,a=e.visible,l=s.f.drawers.coinSelector.noCoins;return(0,c.jsxs)(o.R1,{headerBarTitle:t,size:"full",onCloseBottomSheet:i,visible:a,children:[(0,c.jsx)(o.R1.Target,{children:r}),(0,c.jsx)(o.R1.Content,{children:(0,c.jsxs)(o.xu,{sx:u,children:[0===n.length&&(0,c.jsx)(o.uT,{sx:{padding:"base.spacing.x4"},children:l}),n.map((function(e){var t=e.onClick,n=e.icon,r=e.name,i=e.symbol,o=e.balance,a=e.id,l=e.testId;return(0,c.jsx)(d,{id:a,testId:l,onClick:t,icon:n,name:r,symbol:i,balance:o},"".concat(i,"-").concat(r))}))]})})]})}function h(e){var t,n=e.testId,s=e.options,d=e.subtext,u=e.onSelectChange,h=e.textAlign,x=e.errorMessage,f=e.disabled,p=e.selectedOption,k=e.coinSelectorHeading,C=(0,a.useState)(!1),m=(0,i.Z)(C,2),b=m[0],g=m[1],j=(0,a.useMemo)((function(){return s.map((function(e){return(0,r.Z)((0,r.Z)({},e),{},{testId:n,onClick:function(){u(e.id),g(!1)}})}))}),[s,u,g]);return(0,c.jsxs)(o.xu,{children:[(0,c.jsx)(L,{heading:k,options:j,visible:b,onCloseBottomSheet:function(){return g(!1)}}),(0,c.jsx)(l.G,{testId:"".concat(n,"-select-control"),textAlign:null!==h&&void 0!==h?h:"left",subtext:x?void 0:d,isErrored:!!x,errorMessage:x,children:(0,c.jsx)(o.OC,{testId:"".concat(n,"-select"),size:"large",defaultLabel:"Select coin",targetClickOveride:function(){return g(!0)},selectedOption:function(){if(p&&0!==s.length&&s.find((function(e){return e.id===p})))return p}(),sx:{minw:"170px"},children:null===(t=s.filter((function(e){return e.id===p})))||void 0===t?void 0:t.map((function(e){return(0,c.jsxs)(o.Wx,{optionKey:e.id,testId:e.testId,disabled:f,children:[!e.icon&&(0,c.jsx)(o.Wx.Icon,{icon:"Coins",variant:"bold"}),e.icon&&(0,c.jsx)(o.Wx.FramedImage,{imageUrl:e.icon,circularFrame:!0}),(0,c.jsx)(o.Wx.Label,{children:e.symbol})]},e.id)}))})})]})}},6133:function(e,t,n){n.d(t,{F:function(){return a}});var r=n(50940),i=n(98729),o=n(10256);function a(e){var t=e.testId,n=e.value,a=e.placeholder,l=e.errorMessage,s=e.validator,c=e.onTextInputChange,d=e.onTextInputBlur,u=e.onTextInputFocus,L=e.textAlign,h=e.subtext,x=e.maxButtonClick,f=e.disabled;return(0,o.jsx)(i.G,{testId:"".concat(t,"-text-control"),textAlign:null!==L&&void 0!==L?L:"left",subtext:l?void 0:h,isErrored:!!l,errorMessage:l,sx:{width:"100%"},children:(0,o.jsx)(r.oi,{testId:"".concat(t,"-text"),onChange:function(e){return function(e,t){var n=e.target.value;s(n)?c(n):c(null!==t&&void 0!==t?t:"")}(e,n)},sizeVariant:"large",value:n,validationStatus:l?"error":"success",placeholder:a,onBlur:function(e){var t=e.target.value;s(t)&&d(t)},onFocus:function(e){if(u){var t=e.target.value;s(t)&&u(t)}},disabled:f,hideClearValueButton:!0,children:x&&(0,o.jsx)(r.oi.Button,{testId:"".concat(t,"-max-button"),onClick:x,disabled:f,children:"max"})})})}},94372:function(e,t,n){n.d(t,{N:function(){return Q}});var r,i,o,a,l,s,c,d,u,L,h,x,f,p,k,C,m,b,g,j,E,v,w,H,y,M,I,Z,B,A,F,W,T,S,z,O,_,N,V=n(37755),D=n(50940),R=n(65535),P=["title","titleId"];function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G.apply(this,arguments)}function X(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function $(e,t){var n=e.title,V=e.titleId,D=X(e,P);return R.createElement("svg",G({width:430,height:305,viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":V},D),n?R.createElement("title",{id:V},n):null,r||(r=R.createElement("path",{d:"M227.517 171.325L182.178 85.6034C181.033 83.4446 179.583 82.3652 178.156 82.3652C175.711 82.3652 174.322 84.1157 172.863 86.6218L137.285 164.056L183.689 253.776L227.522 171.32L227.517 171.325Z",fill:"black",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),i||(i=R.createElement("path",{d:"M226.841 137.597C228.497 133.997 228.338 128.188 226.484 124.682L197.866 70.5767C196.012 67.0757 193.14 67.1508 191.484 70.7503L164.936 128.427L168.399 134.936L165.396 141.464L168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992L165.846 154.52L169.3 161.048L166.287 167.562L187.922 208.465C189.776 211.966 192.648 211.891 194.304 208.292L226.845 137.597H226.841Z",fill:"#F191FA"})),o||(o=R.createElement("path",{d:"M168.85 147.992L165.396 141.464L168.399 134.936L164.936 128.427L191.484 70.7503C193.14 67.1508 196.012 67.0757 197.866 70.5767L226.484 124.682C228.338 128.188 228.497 133.997 226.841 137.597H226.845L194.304 208.292C192.648 211.891 189.776 211.966 187.922 208.465L166.287 167.562L169.3 161.048L165.846 154.52L168.85 147.992ZM168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992Z",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),a||(a=R.createElement("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"})),l||(l=R.createElement("path",{d:"M203.136 132.773C202.484 134.19 201.353 134.223 200.621 132.843L196.101 124.297C195.369 122.917 195.308 120.627 195.961 119.21L200.621 109.082C201.273 107.665 202.404 107.632 203.136 109.012L207.656 117.558C208.388 118.938 208.449 121.228 207.796 122.645L203.136 132.773Z",fill:"#EBE9E9",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),s||(s=R.createElement("path",{d:"M206.22 114.837L204.68 118.183C204.174 119.286 203.291 119.309 202.724 118.234L199.345 111.852",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),c||(c=R.createElement("path",{d:"M197.542 127.015L199.058 123.716C199.565 122.613 200.447 122.589 201.015 123.664L204.394 130.046",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),d||(d=R.createElement("path",{d:"M293.369 250.453L252.263 172.733C249.936 168.331 243.957 164.731 238.982 164.731H173.769C171.516 164.731 169.306 164.14 167.358 163.014L162.876 160.423C160.929 159.297 158.718 158.706 156.466 158.706H147.896L141.237 164.534L189.659 256C190.612 257.493 192.452 258.417 194.939 258.417L287.456 258.445L291.473 260.904L293.904 255.733H293.895C294.556 254.315 294.449 252.471 293.379 250.448L293.369 250.453Z",fill:"#EBE9E9",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),u||(u=R.createElement("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:.469297,strokeMiterlimit:10})),L||(L=R.createElement("path",{d:"M249.832 177.908C247.505 173.506 241.526 169.907 236.551 169.907L142.025 169.878C139.355 169.878 137.436 168.813 136.549 167.128L186.313 261.185C187.266 262.677 189.105 263.602 191.592 263.602L286.118 263.63C291.098 263.63 293.266 260.03 290.938 255.633L249.832 177.913V177.908Z",fill:"#EBE9E9",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),h||(h=R.createElement("path",{d:"M255.328 198.77L245.041 179.313C243.581 176.548 240.235 174.042 237.161 174.042L143.555 173.93",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),x||(x=R.createElement("path",{d:"M188.64 259.548L282.448 259.558C285.569 259.558 286.418 257.577 285.198 255.264L276.103 238.064",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),f||(f=R.createElement("path",{d:"M150.238 159.776C150.965 161.151 149.539 163.338 147.051 164.652C144.564 165.966 141.96 165.919 141.227 164.539C140.495 163.159 141.927 160.977 144.414 159.663C145.62 159.025 146.854 158.71 147.891 158.71C148.99 158.71 149.863 159.067 150.238 159.776Z",fill:"#EBE9E9",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),p||(p=R.createElement("path",{d:"M147.826 161.052C148.164 161.69 147.502 162.704 146.348 163.314C145.193 163.924 143.983 163.9 143.645 163.262C143.307 162.624 143.969 161.61 145.123 161C145.681 160.705 146.254 160.559 146.737 160.559C147.249 160.559 147.652 160.723 147.826 161.057V161.052Z",fill:"black"})),k||(k=R.createElement("path",{d:"M171.652 85.828L136.755 161.652C135.788 163.75 135.784 165.669 136.549 167.124C136.549 167.124 137.717 169.874 142.025 169.874C146.333 169.874 151.754 169.907 151.754 169.907L153.115 167.5L143.419 167.467C139.669 167.467 137.637 165.186 139.205 161.779L174.163 85.8233C175.223 83.5238 176.678 82.3646 178.156 82.3646C178.156 82.3646 173.431 81.961 171.652 85.8233V85.828Z",fill:"#EBE9E9",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),C||(C=R.createElement("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"})),m||(m=R.createElement("path",{d:"M274.968 235.918C272.495 231.239 272.777 228.33 278.296 226.565C281.262 225.617 283.951 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.049 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495L255.399 206.127L271.073 235.923H274.973L274.968 235.918Z",fill:"#EBE9E9"})),b||(b=R.createElement("path",{d:"M274.968 235.918C272.495 231.239 272.776 228.33 278.295 226.565C281.261 225.617 283.95 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.048 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495",stroke:"black",strokeWidth:.469297,strokeMiterlimit:10})),g||(g=R.createElement("path",{d:"M289.926 200.125C287.265 199.276 284.074 201.829 282.793 205.832C281.512 209.835 282.629 213.768 285.29 214.617L286.533 215.016L291.17 200.524L289.926 200.125Z",fill:"black",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),j||(j=R.createElement("path",{d:"M293.683 209.321C294.963 205.319 293.846 201.386 291.187 200.535C288.528 199.685 285.335 202.239 284.055 206.241C282.775 210.242 283.892 214.176 286.551 215.026C289.21 215.877 292.403 213.322 293.683 209.321Z",fill:"#EBE9E9",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),E||(E=R.createElement("path",{d:"M213.26 224.182C211.237 224.182 208.816 222.722 207.868 220.934L189.021 185.301C188.077 183.513 188.955 182.053 190.978 182.053L231.3 182.039C233.322 182.039 235.744 183.499 236.692 185.287L255.539 220.92C256.482 222.708 255.604 224.168 253.582 224.168L213.26 224.182Z",fill:"black",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),v||(v=R.createElement("path",{d:"M214.334 222.319C212.312 222.319 209.89 220.859 208.942 219.071L190.095 183.438C189.884 183.034 189.767 182.649 189.729 182.292C188.64 182.776 188.302 183.944 189.02 185.301L207.867 220.934C208.811 222.722 211.237 224.182 213.26 224.182L253.582 224.168C255.144 224.168 256.022 223.29 255.9 222.065C255.557 222.22 255.14 222.305 254.652 222.305L214.33 222.319H214.334Z",fill:"#EBE9E9",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),w||(w=R.createElement("path",{d:"M231.586 203.083L233.646 206.978H228.756H223.871H218.981H215.513C214.733 206.978 214.363 207.489 214.691 208.109L215.555 209.737C215.883 210.361 216.794 210.873 217.577 210.873H221.046H225.936L227.395 213.632C227.724 214.256 228.634 214.763 229.418 214.763H231.464C232.243 214.763 232.614 214.252 232.285 213.628L230.826 210.868H235.716H239.184C239.963 210.868 240.334 210.352 240.005 209.732L238.546 206.973L237.086 204.214C236.758 203.589 235.847 203.083 235.063 203.083H231.595H231.586Z",fill:"#F191FA"})),H||(H=R.createElement("path",{d:"M214.855 199.191L216.315 201.951C216.648 202.575 217.554 203.086 218.342 203.086H221.81H226.696H231.586L230.126 200.322C229.793 199.698 228.887 199.187 228.099 199.187H224.631H219.746H214.855V199.191Z",fill:"#F191FA"})),y||(y=R.createElement("path",{d:"M214.986 187.501C214.207 187.501 213.837 188.013 214.165 188.632L215.625 191.392H210.735H207.266C206.487 191.392 206.117 191.903 206.445 192.527L207.905 195.287L209.364 198.046C209.693 198.671 210.603 199.177 211.387 199.177H214.855L212.795 195.282H217.685H222.57H227.46H230.928C231.707 195.282 232.078 194.771 231.75 194.147L230.891 192.523C230.558 191.899 229.652 191.387 228.868 191.387H225.4H220.51L219.051 188.628C218.722 188.003 217.812 187.497 217.028 187.497H214.982L214.986 187.501Z",fill:"#F191FA"})),M||(M=R.createElement("path",{d:"M214.098 243.795L212.428 240.641C211.78 239.412 210.109 238.412 208.725 238.412H202.849L200.428 233.832C199.78 232.602 198.114 231.603 196.725 231.603H191.751C191 231.603 190.483 231.898 190.263 232.363L189.066 234.906L191.464 235.826L192.835 238.417H186.959C186.208 238.417 185.692 238.712 185.471 239.177L184.275 241.721L186.612 242.528L187.288 243.804C187.935 245.034 189.606 246.033 190.99 246.033H196.866L199.287 250.614C199.935 251.843 201.601 252.843 202.99 252.843H205.032L208.256 254.631L209.452 252.087C209.635 251.693 209.607 251.177 209.307 250.614L206.885 246.033H210.194L213.057 247.817L214.253 245.273C214.441 244.879 214.408 244.363 214.108 243.8L214.098 243.795Z",fill:"black",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),I||(I=R.createElement("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.529 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.529 234.146H190.554C189.165 234.146 188.564 235.151 189.212 236.38L191.634 240.961H185.758C184.369 240.961 183.763 241.97 184.416 243.195L186.086 246.348C186.734 247.578 188.405 248.577 189.789 248.577H195.665L198.086 253.158C198.734 254.387 200.4 255.387 201.789 255.387H206.764C208.153 255.387 208.753 254.383 208.106 253.153L205.684 248.573H211.56C212.949 248.573 213.554 247.564 212.902 246.339Z",fill:"black",stroke:"black",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),Z||(Z=R.createElement("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),B||(B=R.createElement("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),A||(A=R.createElement("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.528 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.528 234.146H190.554",stroke:"#EBE9E9",strokeWidth:.469297,strokeLinecap:"round",strokeLinejoin:"round"})),F||(F=R.createElement("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"})),W||(W=R.createElement("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"})),T||(T=R.createElement("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"})),S||(S=R.createElement("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"})),z||(z=R.createElement("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"})),O||(O=R.createElement("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"})),_||(_=R.createElement("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"})),N||(N=R.createElement("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})))}var U=R.forwardRef($),q=(n.p,n(6609)),K=n(10256);function Q(){return(0,K.jsx)(D.xu,{sx:(0,V.Z)((0,V.Z)({},q.q_),{},{background:"base.color.translucent.emphasis.100"}),children:(0,K.jsx)(D.xu,{sx:(0,V.Z)((0,V.Z)({},q.Tb),q.iz),children:(0,K.jsx)(U,{})})})}},30940:function(e,t,n){n.d(t,{B:function(){return d}});var r=n(50940),i={display:"flex",flexDirection:"column",alignItems:"center",padding:"50px 0",height:"100%"},o={color:"base.color.text.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},a={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},l={width:"100%",height:"64px"},s=n(95269),c=n(10256);function d(e){var t=e.onCloseBottomSheet,n=e.visible,d=e.showHeaderBar,u=e.onRetry,L=s.f.drawers.transactionFailed,h=L.content,x=L.buttons;return(0,c.jsx)(r.R1,{headerBarTitle:void 0,size:"full",onCloseBottomSheet:t,visible:n,showHeaderBar:d,children:(0,c.jsx)(r.R1.Content,{children:(0,c.jsxs)(r.xu,{sx:i,children:[(0,c.jsx)(r.Ee,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),(0,c.jsxs)(r.X6,{size:"small",sx:o,testId:"transaction-rejected-heading",children:[h.heading1,(0,c.jsx)("br",{}),h.heading2]}),(0,c.jsxs)(r.uT,{sx:o,children:[h.body1,(0,c.jsx)("br",{}),h.body2]}),(0,c.jsxs)(r.xu,{sx:a,children:[(0,c.jsx)(r.zx,{sx:l,variant:"tertiary",onClick:u,children:x.retry}),(0,c.jsx)(r.zx,{sx:l,variant:"tertiary",onClick:t,testId:"transaction-rejected-cancel-button",children:x.cancel})]})]})})})}},97183:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(46999),i=n(37755),o=n(18950),a=n(70123),l=n(75434),s=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(t){var n,o,s,c,d,u,L,h,x,f,p,k,C,m;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.checkout,o=t.provider,s=t.allowTokenListType,c=t.chainId,d=t.allowZero,u=void 0!==d&&d,L=t.retryPolicy,h=void 0===L?l.NA:L,e.t0=c,e.t0){e.next=6;break}return e.next=5,n.getNetworkInfo({provider:o});case 5:e.t0=e.sent.chainId;case 6:return x=e.t0,e.next=9,o.getSigner().getAddress();case 9:return f=e.sent,e.next=12,(0,a.X)((function(){return n.getAllBalances({provider:o,walletAddress:f,chainId:x})}),(0,i.Z)({},h));case 12:return p=e.sent,e.next=15,n.getTokenAllowList({chainId:x,type:s});case 15:return k=e.sent,C=new Map,k.tokens.forEach((function(e){return C.set(e.address||l.B5,!0)})),m=p.balances.filter((function(e){return!(e.balance.lte(0)&&!u)&&C.get(e.token.address||l.B5)})),e.abrupt("return",{allowList:k,allowedBalances:m});case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},6426:function(e,t,n){n.d(t,{C:function(){return r},n:function(){return i}});var r={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4",backgroundColor:"base.color.translucent.emphasis.200"},i={width:"base.icon.size.400"}}}]);
|