@brave/swap-interface
Version:
Brave Swap - an open-source swap interface by Brave, focussed on usability and multi-chain support.
1 lines • 2.4 MB
Source Map (JSON)
{"version":3,"file":"lib.umd.cjs","sources":["../src/constants/types.ts","../src/constants/magics.ts","../node_modules/react/cjs/react-jsx-runtime.production.min.js","../node_modules/react/cjs/react-jsx-runtime.development.js","../node_modules/react/jsx-runtime.js","../src/context/swap.context.tsx","../node_modules/async/dist/async.mjs","../src/options/select-and-send-options.ts","../src/options/gas-fee-options.ts","../src/assets/gas-presset-icons/slow-icon.svg","../src/assets/gas-presset-icons/average-icon.svg","../src/assets/gas-presset-icons/fast-icon.svg","../src/state/wallet.tsx","../node_modules/bignumber.js/bignumber.mjs","../src/utils/currency-symbols.ts","../src/utils/amount.ts","../src/hooks/useJupiter.ts","../src/utils/hex-utils.ts","../src/hooks/useZeroEx.ts","../src/utils/assets.ts","../src/hooks/useNativeAsset.ts","../src/hooks/useDebouncedCallback.ts","../src/hooks/useSwap.ts","../src/hooks/useOnClickOutside.ts","../src/assets/arrow-icon.svg","../src/components/shared.styles.ts","../src/components/buttons/flip-tokens-button.tsx","../src/assets/carat-down-icon.svg","../src/assets/fuel-tank-icon.svg","../node_modules/ethereum-blockies/blockies.js","../src/utils/string-utils.ts","../src/components/placeholders/create-icon-with-placeholder.tsx","../src/components/buttons/select-token-or-network-button.tsx","../src/components/buttons/standard-button.tsx","../src/components/buttons/preset-button.tsx","../src/components/buttons/token-list-button.tsx","../src/components/buttons/select-quote-option-button.tsx","../src/hooks/useNetworkFees.ts","../src/components/buttons/network-list-button.tsx","../src/utils/reduce-address.ts","../src/components/buttons/account-list-button.tsx","../src/components/buttons/theme-button.tsx","../src/components/buttons/connect-wallet-button.tsx","../src/components/boxes/swap-section-box.tsx","../src/components/inputs/swap-input.tsx","../src/assets/search-icon.svg","../src/components/inputs/search-input.tsx","../src/components/inputs/standard-input.tsx","../src/components/inputs/slippage-input.tsx","../src/components/swap/from-section.tsx","../src/components/swap/to-section.tsx","../src/utils/reduce-network-name.ts","../src/assets/close-icon.svg","../src/components/swap/network-selector.tsx","../src/assets/disconnect-icon.svg","../src/assets/info-icon.svg","../src/components/swap/account-modal/account-list-item-button.tsx","../src/components/swap/account-modal/account-modal-button.tsx","../src/components/swap/account-modal/account-modal.tsx","../src/components/swap/header.tsx","../src/components/swap/swap-container.tsx","../src/components/swap/search-with-network-selector.tsx","../src/components/modals/standard-modal.tsx","../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","../node_modules/memoize-one/dist/memoize-one.esm.js","../node_modules/react-window/dist/index.esm.js","../node_modules/react-virtualized-auto-sizer/dist/index.esm.js","../src/components/swap/virtualized-tokens-list.tsx","../src/components/swap/select-token-modal.tsx","../src/components/swap/quote-options.tsx","../src/assets/lp-icons/0x.png","../src/assets/lp-icons/aave.svg","../src/assets/lp-icons/aldrin.svg","../src/assets/lp-icons/apeswap.png","../src/assets/lp-icons/balancer.svg","../src/assets/lp-icons/balansol.svg","../src/assets/lp-icons/bancor.svg","../src/assets/lp-icons/component.jpeg","../src/assets/lp-icons/crema.svg","../src/assets/lp-icons/cropper.svg","../src/assets/lp-icons/cryptocom.jpeg","../src/assets/lp-icons/curve.svg","../src/assets/lp-icons/cykura.png","../src/assets/lp-icons/dfyn.png","../src/assets/lp-icons/dodo.svg","../src/assets/lp-icons/dradex.svg","../src/assets/lp-icons/firebirdoneswap.png","../src/assets/lp-icons/goosefx.svg","../src/assets/lp-icons/invariant.svg","../src/assets/lp-icons/ironswap.jpeg","../src/assets/lp-icons/kyberdmm.png","../src/assets/lp-icons/lido.png","../src/assets/lp-icons/lifinity.jpeg","../src/assets/lp-icons/makerpsm.jpeg","../src/assets/lp-icons/marinade.svg","../src/assets/lp-icons/mercurial.svg","../src/assets/lp-icons/meshswap.png","../src/assets/lp-icons/mstable.png","../src/assets/lp-icons/orca.svg","../src/assets/lp-icons/quickswap.png","../src/assets/lp-icons/penguin.svg","../src/assets/lp-icons/saber.svg","../src/assets/lp-icons/saddle.png","../src/assets/lp-icons/sencha.jpeg","../src/assets/lp-icons/saros.svg","../src/assets/lp-icons/serum.svg","../src/assets/lp-icons/shell.jpeg","../src/assets/lp-icons/shibaswap.png","../src/assets/lp-icons/step.svg","../src/assets/lp-icons/stepn.svg","../src/assets/lp-icons/sushiswap.svg","../src/assets/lp-icons/synapse.png","../src/assets/lp-icons/synthetix.png","../src/assets/lp-icons/uniswap.svg","../src/constants/lpMetadata.ts","../src/assets/lp-icons/waultswap.jpeg","../src/assets/lp-icons/woofi.png","../src/assets/horizontal-arrows-icon.svg","../src/components/swap/quote-info.tsx","../src/components/form-controls/standard-switch.tsx","../src/components/form-controls/standard-radio.tsx","../src/assets/check-icon.svg","../src/components/form-controls/standard-checkbox.tsx","../src/components/form-controls/theme-switch.tsx","../src/components/swap/account-selector.tsx","../src/components/swap/swap-and-send.tsx","../src/components/swap/settings/expand-section.tsx","../src/components/swap/settings/gas-preset-button.tsx","../src/components/swap/settings/swap-settings-modal.tsx","../src/components/swap/swap-skeleton/skeleton.tsx","../src/components/swap/swap-skeleton/swap-skeleton.tsx","../src/components/swap/privacy-modal.tsx","../src/assets/advanced-icon.svg","../src/views/swap.tsx","../src/theme/default-theme.ts","../src/App.tsx"],"sourcesContent":["// Copyright (c) 2022 The Brave Authors. All rights reserved.\n// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not distributed with this file,\n// you can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport Amount from '~/utils/amount'\n\nexport type BlockchainToken = {\n contractAddress: string\n name: string\n logo: string\n isToken: boolean\n visible: boolean\n decimals: number\n symbol: string\n coingeckoId: string\n chainId: string\n coin: number\n}\n\nexport type NetworkInfo = {\n chainId: string\n chainName: string\n blockExplorerUrl: string\n logo: string\n symbol: string\n symbolName: string\n decimals: number\n coin: number\n isEIP1559: boolean // only for ETH coin type\n}\n\ntype LiquiditySource = {\n name: string\n proportion: Amount\n}\n\nexport type QuoteOption = {\n label: string\n fromAmount: Amount\n toAmount: Amount\n minimumToAmount: Amount | undefined\n fromToken: BlockchainToken\n toToken: BlockchainToken\n rate: Amount\n impact: Amount\n sources: LiquiditySource[]\n\n // Indicates the kind of routing followed by the order.\n // split -> indicates that the order was fulfilled from two separate LPs\n //\n // flow -> indicates that the order was fulfilled through an intermediate\n // asset between two separate LPs.\n routing: 'split' | 'flow'\n\n networkFee: string\n\n braveFee: SwapFee | undefined\n}\n\nexport type Registry = Record<string, string>\n\nexport type SpotPrices = {\n nativeAsset: string\n makerAsset: string\n takerAsset: string\n}\n\nexport type WalletAccount = {\n name: string\n address: string\n coin: number\n}\n\nexport type SwapAndSend = {\n label: string\n name: string\n}\n\nexport type RefreshBlockchainStateParams = {\n network: NetworkInfo\n account: WalletAccount\n}\n\nexport type RefreshPricesParams = {\n nativeAsset: BlockchainToken\n fromAsset: BlockchainToken | undefined\n toAsset: BlockchainToken | undefined\n}\n\nexport enum CoinType {\n Solana = 501,\n Ethereum = 60\n}\n\nexport enum ChainID {\n ETHEREUM_MAINNET = '0x1',\n BINANCE_SMART_CHAIN = '0x38',\n POLYGON = '0x89',\n AVALANCHE = '0xa86a',\n CELO = '0xa4ec',\n FANTOM = '0xfa',\n OPTIMISM = '0xa',\n SOLANA_MAINNET = '0x65'\n}\n\nexport type GasFeeOption = {\n id: string\n name: string\n icon: string\n}\n\nexport type Exchange = {\n id: string\n name: string\n}\n\nexport type GasEstimate = {\n gasFee: string\n gasFeeGwei?: string\n gasFeeFiat?: string\n time?: string\n}\n\nexport type SwapFee = {\n fee: string\n discount: string\n}\n\nexport type AmountValidationErrorType = 'fromAmountDecimalsOverflow' | 'toAmountDecimalsOverflow'\n\nexport type SwapValidationErrorType =\n | AmountValidationErrorType\n | 'insufficientBalance'\n | 'insufficientFundsForGas'\n | 'insufficientAllowance'\n | 'insufficientLiquidity'\n | 'unknownError'\n\nexport type SwapParams = {\n fromToken?: BlockchainToken\n toToken?: BlockchainToken\n fromAmount: string\n toAmount: string\n // This is the value as seen on the UI - should be converted to appropriate\n // format for Jupiter and 0x swap providers.\n slippageTolerance: string\n fromAddress?: string\n}\n\nexport type ZeroExSwapParams = {\n takerAddress: string\n sellAmount: string\n buyAmount: string\n buyToken: string\n sellToken: string\n slippagePercentage: number\n gasPrice: string\n}\n\ntype ZeroExSource = {\n name: string\n proportion: string\n}\n\nexport interface ZeroExQuoteResponse {\n price: string\n value: string\n gas: string\n estimatedGas: string\n gasPrice: string\n protocolFee: string\n minimumProtocolFee: string\n buyTokenAddress: string\n sellTokenAddress: string\n buyAmount: string\n sellAmount: string\n allowanceTarget: string\n sellTokenToEthRate: string\n buyTokenToEthRate: string\n estimatedPriceImpact: string\n sources: ZeroExSource[]\n}\n\nexport interface ZeroExSwapResponse extends ZeroExQuoteResponse {\n guaranteedPrice: string\n to: string\n data: string\n}\n\ninterface ZeroExValidationError {\n field: string\n code: number\n reason: string\n}\n\nexport interface ZeroExErrorResponse {\n code: number\n reason: string\n validationErrors?: ZeroExValidationError[]\n isInsufficientLiquidity: boolean\n}\n\nexport interface ZeroExQuoteResponseWithError {\n response?: ZeroExQuoteResponse\n errorResponse?: ZeroExErrorResponse\n}\n\nexport interface ZeroExSwapResponseWithError {\n response?: ZeroExSwapResponse\n errorResponse?: ZeroExErrorResponse\n}\n\nexport type JupiterQuoteParams = {\n inputMint: string\n outputMint: string\n amount: string\n slippageBps: number\n userPublicKey: string\n}\n\nexport type JupiterFee = {\n amount: bigint\n mint: string\n pct: number\n}\n\nexport type JupiterMarketInfo = {\n id: string\n label: string\n inputMint: string\n outputMint: string\n notEnoughLiquidity: boolean\n inAmount: bigint\n outAmount: bigint\n priceImpactPct: number\n lpFee: JupiterFee\n platformFee: JupiterFee\n}\n\nexport type JupiterRoute = {\n inAmount: bigint\n outAmount: bigint\n amount: bigint\n otherAmountThreshold: bigint\n swapMode: string\n priceImpactPct: number\n slippageBps: number\n marketInfos: JupiterMarketInfo[]\n}\n\nexport type JupiterQuoteResponse = {\n routes: JupiterRoute[]\n}\n\nexport type JupiterSwapParams = {\n route: JupiterRoute\n userPublicKey: string\n outputMint: string\n}\n\nexport type JupiterSwapResponse = {\n swapTransaction: string\n}\n\nexport interface JupiterErrorResponse {\n statusCode: string\n error: string\n message: string\n isInsufficientLiquidity: boolean\n}\n\nexport interface JupiterSwapResponseWithError {\n response?: JupiterSwapResponse\n errorResponse?: JupiterErrorResponse\n}\n\nexport interface JupiterQuoteResponseWithError {\n response?: JupiterQuoteResponse\n errorResponse?: JupiterErrorResponse\n}\n\n// ETH Wallet Adapter\nexport type GasPrice1559 = {\n slowMaxPriorityFeePerGas: string\n slowMaxFeePerGas: string\n avgMaxPriorityFeePerGas: string\n avgMaxFeePerGas: string\n fastMaxPriorityFeePerGas: string\n fastMaxFeePerGas: string\n baseFeePerGas: string\n}\nexport type ETHSendTransactionParams = {\n from: string\n to: string\n value: string\n data: number[]\n\n gas?: string\n\n // Legacy gas pricing\n gasPrice?: string\n\n // EIP-1559 gas pricing\n maxPriorityFeePerGas?: string\n maxFeePerGas?: string\n}\nexport type ApproveERC20Params = {\n contractAddress: string\n spenderAddress: string\n allowance: string\n}\n\n// SOL Wallet Adapter\nexport type SOLSendTransactionParams = {\n encodedTransaction: string\n from: string\n sendOptions?: {\n maxRetries?: number\n preflightCommitment?: string\n skipPreflight?: boolean\n }\n}\n","// Copyright (c) 2022 The Brave Authors. All rights reserved.\n// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not distributed with this file,\n// you can obtain one at http://mozilla.org/MPL/2.0/.\n\n// 0x API expects native assets to have the following contract address.\nexport const NATIVE_ASSET_CONTRACT_ADDRESS_0X =\n '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\n\nexport const WRAPPED_SOL_CONTRACT_ADDRESS = 'So11111111111111111111111111111111111111112'\n\nexport const MAX_UINT256 = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'\n\nexport const ZERO_EX_VALIDATION_ERROR_CODE = 100\n\nexport const BRAVE_SWAP_DATA_THEME_KEY = 'brave-swap-data-theme'\n","/** @license React v16.14.0\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),g=60103;exports.Fragment=60107;if(\"function\"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h(\"react.element\");exports.Fragment=h(\"react.fragment\")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=\"\"+k);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;\n","/** @license React v16.14.0\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\nvar React = require('react');\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar REACT_ELEMENT_TYPE = 0xeac7;\nvar REACT_PORTAL_TYPE = 0xeaca;\nexports.Fragment = 0xeacb;\nvar REACT_STRICT_MODE_TYPE = 0xeacc;\nvar REACT_PROFILER_TYPE = 0xead2;\nvar REACT_PROVIDER_TYPE = 0xeacd;\nvar REACT_CONTEXT_TYPE = 0xeace;\nvar REACT_FORWARD_REF_TYPE = 0xead0;\nvar REACT_SUSPENSE_TYPE = 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = 0xead8;\nvar REACT_MEMO_TYPE = 0xead3;\nvar REACT_LAZY_TYPE = 0xead4;\nvar REACT_BLOCK_TYPE = 0xead9;\nvar REACT_SERVER_BLOCK_TYPE = 0xeada;\nvar REACT_FUNDAMENTAL_TYPE = 0xead5;\nvar REACT_SCOPE_TYPE = 0xead7;\nvar REACT_OPAQUE_ID_TYPE = 0xeae0;\nvar REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;\nvar REACT_OFFSCREEN_TYPE = 0xeae2;\nvar REACT_LEGACY_HIDDEN_TYPE = 0xeae3;\n\nif (typeof Symbol === 'function' && Symbol.for) {\n var symbolFor = Symbol.for;\n REACT_ELEMENT_TYPE = symbolFor('react.element');\n REACT_PORTAL_TYPE = symbolFor('react.portal');\n exports.Fragment = symbolFor('react.fragment');\n REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');\n REACT_PROFILER_TYPE = symbolFor('react.profiler');\n REACT_PROVIDER_TYPE = symbolFor('react.provider');\n REACT_CONTEXT_TYPE = symbolFor('react.context');\n REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');\n REACT_SUSPENSE_TYPE = symbolFor('react.suspense');\n REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');\n REACT_MEMO_TYPE = symbolFor('react.memo');\n REACT_LAZY_TYPE = symbolFor('react.lazy');\n REACT_BLOCK_TYPE = symbolFor('react.block');\n REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');\n REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');\n REACT_SCOPE_TYPE = symbolFor('react.scope');\n REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');\n REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');\n REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');\n REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');\n}\n\nvar MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = '';\n\n if (currentlyValidatingElement) {\n var name = getComponentName(currentlyValidatingElement.type);\n var owner = currentlyValidatingElement._owner;\n stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));\n }\n\n stack += ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n }\n\n var argsWithFormat = args.map(function (item) {\n return '' + item;\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {\n return true;\n }\n }\n\n return false;\n}\n\n\nvar BEFORE_SLASH_RE = /^(.*)[\\\\\\/]/;\nfunction describeComponentFrame (name, source, ownerName) {\n var sourceInfo = '';\n\n if (source) {\n var path = source.fileName;\n var fileName = path.replace(BEFORE_SLASH_RE, '');\n\n {\n // In DEV, include code for a common special case:\n // prefer \"folder/index.js\" instead of just \"index.js\".\n if (/^index\\./.test(fileName)) {\n var match = path.match(BEFORE_SLASH_RE);\n\n if (match) {\n var pathBeforeSlash = match[1];\n\n if (pathBeforeSlash) {\n var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');\n fileName = folderName + '/' + fileName;\n }\n }\n }\n }\n\n sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';\n } else if (ownerName) {\n sourceInfo = ' (created by ' + ownerName + ')';\n }\n\n return '\\n in ' + (name || 'Unknown') + sourceInfo;\n}\n\nvar Resolved = 1;\nfunction refineResolvedLazyComponent(lazyComponent) {\n return lazyComponent._status === Resolved ? lazyComponent._result : null;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var functionName = innerType.displayName || innerType.name || '';\n return outerType.displayName || (functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName);\n}\n\nfunction getComponentName(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case exports.Fragment:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n return 'Context.Consumer';\n\n case REACT_PROVIDER_TYPE:\n return 'Context.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n return getComponentName(type.type);\n\n case REACT_BLOCK_TYPE:\n return getComponentName(type.render);\n\n case REACT_LAZY_TYPE:\n {\n var thenable = type;\n var resolvedThenable = refineResolvedLazyComponent(thenable);\n\n if (resolvedThenable) {\n return getComponentName(resolvedThenable);\n }\n\n break;\n }\n }\n }\n\n return null;\n}\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\nvar currentlyValidatingElement = null;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n currentlyValidatingElement = element;\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(Object.prototype.hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nvar ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown;\nvar specialPropRefWarningShown;\nvar didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config, self) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {\n var componentName = getComponentName(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n }\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * https://github.com/reactjs/rfcs/pull/107\n * @param {*} type\n * @param {object} props\n * @param {string} key\n */\n\nfunction jsxDEV(type, config, maybeKey, source, self) {\n {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null; // Currently, key can be spread in as a prop. This causes a potential\n // issue if key is also explicitly declared (ie. <div {...props} key=\"Hi\" />\n // or <div key=\"Hi\" {...props} /> ). We want to deprecate key spread,\n // but as an intermediary step, we will use jsxDEV for everything except\n // <div {...props} key=\"Hi\" />, because we aren't currently able to tell if\n // key is explicitly declared to be undefined or not.\n\n if (maybeKey !== undefined) {\n key = '' + maybeKey;\n }\n\n if (hasValidKey(config)) {\n key = '' + config.key;\n }\n\n if (hasValidRef(config)) {\n ref = config.ref;\n warnIfStringRefCannotBeAutoConverted(config, self);\n } // Remaining properties are added to a new props object\n\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n }\n}\n\nvar ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement$1(element) {\n currentlyValidatingElement = element;\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\nfunction isValidElement(object) {\n {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n }\n}\n\nfunction getDeclarationErrorAddendum() {\n {\n if (ReactCurrentOwner$1.current) {\n var name = getComponentName(ReactCurrentOwner$1.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n }\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n }\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n }\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentName(element._owner.type) + \".\";\n }\n\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n {\n if (typeof node !== 'object') {\n return;\n }\n\n if (Array.isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentName(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentName(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\n\nfunction jsxWithValidation(type, props, key, isStaticChildren, source, self) {\n {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendum(source);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (Array.isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentName(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n\n var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n var children = props.children;\n\n if (children !== undefined) {\n if (isStaticChildren) {\n if (Array.isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n validateChildKeys(children[i], type);\n }\n\n if (Object.freeze) {\n Object.freeze(children);\n }\n } else {\n error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');\n }\n } else {\n validateChildKeys(children, type);\n }\n }\n }\n\n if (type === exports.Fragment) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n }\n} // These two functions exist to still get child warnings in dev\n// even with the prod transform. This means that jsxDEV is purely\n// opt-in behavior for better messages but that we won't stop\n// giving you warnings if you use production apis.\n\nfunction jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}\nfunction jsxWithValidationDynamic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, false);\n }\n}\n\nvar jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.\n// for now we can ship identical prod functions\n\nvar jsxs = jsxWithValidationStatic ;\n\nexports.jsx = jsx;\nexports.jsxs = jsxs;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","// Copyright (c) 2022 The Brave Authors. All rights reserved.\n// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not distributed with this file,\n// you can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport React, { createContext } from 'react'\n\n// Types\nimport {\n ApproveERC20Params,\n BlockchainToken,\n ETHSendTransactionParams,\n Exchange,\n GasEstimate,\n GasPrice1559,\n JupiterQuoteParams,\n JupiterQuoteResponseWithError,\n JupiterSwapParams,\n JupiterSwapResponseWithError,\n NetworkInfo,\n SOLSendTransactionParams,\n SwapFee,\n WalletAccount,\n ZeroExQuoteResponseWithError,\n ZeroExSwapParams,\n ZeroExSwapResponseWithError\n} from '~/constants/types'\n\ninterface SwapContextInterface {\n getLocale: (key: string) => string\n getBalance: (address: string, coin: number, chainId: string) => Promise<string>\n getTokenBalance: (\n contractAddress: string,\n address: string,\n coin: number,\n chainId: string\n ) => Promise<string>\n getTokenBalances: (\n contractAddress: string[],\n address: string,\n coin: number,\n chainId: string\n ) => Promise<{ [contractAddress: string]: string }>\n assetsList: BlockchainToken[]\n account?: WalletAccount\n network: NetworkInfo\n supportedNetworks: NetworkInfo[]\n switchAccount: (account: WalletAccount) => Promise<void>\n switchNetwork: (network: NetworkInfo) => Promise<WalletAccount | undefined>\n isWalletConnected: boolean\n isReady: boolean\n connectWallet?: () => Promise<void>\n disconnectWallet?: () => Promise<void>\n getTokenPrice: (token: BlockchainToken) => Promise<string>\n swapService: {\n getZeroExPriceQuote: (params: ZeroExSwapParams) => Promise<ZeroExQuoteResponseWithError>\n getZeroExTransactionPayload: (params: ZeroExSwapParams) => Promise<ZeroExSwapResponseWithError>\n getJupiterQuote: (params: JupiterQuoteParams) => Promise<JupiterQuoteResponseWithError>\n getJupiterTransactionsPayload: (\n params: JupiterSwapParams\n ) => Promise<JupiterSwapResponseWithError>\n isSwapSupported: (chainId: string) => Promise<boolean>\n getBraveFeeForAsset: (asset: BlockchainToken) => Promise<SwapFee>\n }\n walletAccounts: WalletAccount[]\n exchanges: Exchange[]\n getNetworkFeeEstimate: (chainId: string) => Promise<GasEstimate>\n defaultBaseCurrency: string\n ethWalletAdapter: {\n getGasPrice: (chainId: string) => Promise<string>\n getGasPrice1559: (chainId: string) => Promise<GasPrice1559>\n sendTransaction: (params: ETHSendTransactionParams) => Promise<void>\n getERC20Allowance: (\n contractAddress: string,\n ownerAddress: string,\n spenderAddress: string\n ) => Promise<string>\n getERC20ApproveData: (params: ApproveERC20Params) => Promise<number[]>\n }\n solWalletAdapter: {\n sendTransaction: (params: SOLSendTransactionParams) => Promise<void>\n }\n}\n\n// Create Swap Context\nconst SwapContext = createContext<SwapContextInterface | undefined>(undefined)\n\nexport interface SwapProviderInterface extends SwapContextInterface {\n children?: React.ReactNode\n}\n\n// Swap Provder\nconst SwapProvider = (props: SwapProviderInterface) => {\n const {\n children,\n assetsList,\n network,\n account,\n supportedNetworks,\n exchanges,\n walletAccounts,\n defaultBaseCurrency,\n isWalletConnected,\n isReady,\n connectWallet,\n disconnectWallet,\n switchAccount,\n switchNetwork,\n getLocale,\n getBalance,\n getTokenBalance,\n getTokenBalances,\n getTokenPrice,\n getNetworkFeeEstimate,\n ethWalletAdapter,\n solWalletAdapter,\n swapService\n } = props\n\n return (\n <SwapContext.Provider\n value={{\n assetsList,\n network,\n account,\n supportedNetworks,\n exchanges,\n walletAccounts,\n defaultBaseCurrency,\n isWalletConnected,\n isReady,\n connectWallet,\n disconnectWallet,\n switchAccount,\n switchNetwork,\n getLocale,\n getBalance,\n getTokenBalance,\n getTokenBalances,\n getTokenPrice,\n getNetworkFeeEstimate,\n ethWalletAdapter,\n solWalletAdapter,\n swapService\n }}\n >\n {children}\n </SwapContext.Provider>\n )\n}\n\nconst useSwapContext = () => {\n const context = React.useContext(SwapContext)\n if (context === undefined) {\n throw new Error('useSwap must be used within a SwapProvider')\n }\n return context\n}\n\nexport { SwapContext, SwapProvider, useSwapContext }\n","/**\n * Creates a continuation function with some arguments already applied.\n *\n * Useful as a shorthand when combined with other control flow functions. Any\n * arguments passed to the returned function are added to the arguments\n * originally passed to apply.\n *\n * @name apply\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {Function} fn - The function you want to eventually apply all\n * arguments