@swapper-finance/sdk
Version:
JavaScript SDK form Swapper
89 lines (86 loc) • 2.8 kB
text/typescript
import { SwapMode, ProcessingState } from "@src/interfaces";
import { SwapContext } from "./types";
const functionNotImplemented = () => {
throw new Error("Not implemented");
};
export const defaultSwapState: SwapContext = {
tokensBalances: {},
slippage: 1.5,
allTokens: [],
integrationConfig: {},
integrationTypeOverride: undefined,
supportedChains: [],
supportedChainsMap: {},
swapMode: SwapMode.Buy,
isMultichain: true,
isExternalMode: true,
isFetchingChains: false,
ctas: {},
error: "",
errorDetails: "",
chain: undefined,
tokensPrices: {},
cashToken: undefined,
token: undefined,
displayToken: undefined,
transferToken: undefined,
shift4Fees: undefined,
tokenAmount: "",
shift4TokenAmount: "",
tokenAmountWei: "",
estimatedTokenOutAmountWei: "",
estimatedTokenOutAmount: "",
tokenOutAmount: "",
isUsingChainlinkFunction: false,
cashAmount: "",
estimatedCashOutAmount: "",
cashBridgeChain: undefined,
cashBridgeAmount: "",
route: undefined,
isFetchingBalances: false,
isFetchingRoute: false,
transactionState: ProcessingState.Pending,
transactionHash: "",
cashbackAmount: undefined,
pointsAmount: undefined,
transactionError: "",
isDepositAndBuyFlow: false,
feesToTokenValueRatio: 0,
acceptedHighFees: false,
transferTokenAmount: "",
transferReceiverAddress: "",
newPurchaseCounter: 0,
balancesSnapshots: {},
history: [],
historyLoadedOnce: false,
chainToTokenOptionsMap: {},
customContractCalls: undefined,
setNewPurchaseCounter: functionNotImplemented,
setIsDepositAndBuyFlow: functionNotImplemented,
setSlippage: functionNotImplemented,
setIntegrationTypeOverride: functionNotImplemented,
setCashAmount: functionNotImplemented,
setCashBridgeChain: functionNotImplemented,
setCashBridgeAmount: functionNotImplemented,
setChain: functionNotImplemented,
setTransferToken: functionNotImplemented,
setToken: functionNotImplemented,
setDisplayToken: functionNotImplemented,
setTokenAmount: functionNotImplemented,
setTokenOutAmount: functionNotImplemented,
setTransactionState: functionNotImplemented,
setTransactionHash: functionNotImplemented,
fetchRoute: functionNotImplemented,
fetchShift4Quote: functionNotImplemented,
fetchAllBalances: functionNotImplemented,
executeSwapTransaction: functionNotImplemented,
setFeesToTokenValueRatio: functionNotImplemented,
setAcceptedHighFees: functionNotImplemented,
setTransferTokenAmount: functionNotImplemented,
setTransferReceiverAddress: functionNotImplemented,
resetSwapFormData: functionNotImplemented,
clearSwapStateOnLogout: functionNotImplemented,
setBalancesSnapshots: functionNotImplemented,
fetchHistory: functionNotImplemented,
setCustomContractCalls: functionNotImplemented,
};