@funkit/api-base 1.4.0 → 1.4.2

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/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/consts/api.ts", "../src/errors/BaseError.ts", "../src/errors/errors.json", "../src/errors/types.ts", "../src/errors/ClientError.ts", "../src/errors/ServerError.ts", "../src/utils/error.ts", "../src/consts/retry.ts", "../src/utils/checkout.ts", "../src/utils/request.ts", "../src/services/assets/endpoints.ts", "../src/services/checkout/endpoints.ts", "../src/services/checkout/types.ts", "../src/services/faucet/endpoints.ts", "../src/services/mesh/endpoints.ts", "../src/services/mesh/types.ts", "../src/services/moonpay/endpoints.ts", "../src/services/stripe/endpoints.ts", "../src/services/support/endpoints.ts"],
4
- "sourcesContent": ["export const API_BASE_URL =\n process.env.NODE_ENV === 'staging'\n ? 'https://api.fun.xyz/staging/v1'\n : process.env.NODE_ENV === 'testing'\n ? 'https://api.fun.xyz/testing/v1'\n : process.env.NODE_ENV === 'local'\n ? 'http://127.0.0.1:3000'\n : // Production\n 'https://api.fun.xyz/v1'\n\nexport const FUN_FAUCET_URL = 'https://api.fun.xyz/demo-faucet'\n", "const discord = 'https://discord.gg/mvQunrx6NG'\nexport class BaseError extends Error {\n timestamp: string\n\n constructor(\n public baseType: string,\n public type: string,\n public code: string,\n msg: string,\n public rawMessage: string,\n\n public paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n isInternal = false,\n ) {\n super(`${msg}\\n\\n${fixSuggestion}\\nDocs: ${docLink}\\nDiscord: ${discord}`)\n if (isInternal) {\n this.loadEnd()\n }\n\n this.message += '\\n\\nTrace:'\n this.timestamp = new Date().toUTCString()\n }\n\n loadEnd() {\n this.message +=\n '\\n\\nThis is an internal sdk error. Please contact the fun team at our Discord for the fastest response.'\n }\n}\n", "{\n \"AA21\": {\n \"info\": \" Your wallet lacks funds for this transaction.\",\n \"suggestion\": \"To fix this error, make sure you have enough funds in your wallet to cover the transaction fee.\"\n },\n \"FW000\": {\n \"info\": \" Create3Deployer.requireDeployerOnly() - Signatures were not sorted before being passed in\",\n \"suggestion\": \"To fix this error, make sure to short sigs before passing them into `requireDeployerOnly`. You can do this by calling `sigs.sort()` before passing them in. It is also possible to run into this error if the hash that was signed was not the correct hash.\"\n },\n \"FW001\": {\n \"info\": \" Create3Deployer.requireDeployerOnly() - Signature failed to be recovered. ercrecover returned the zero address\",\n \"suggestion\": \"To fix this error, make sure to pass in enough valid signatures that sign the `hash` in the `sigs` array\"\n },\n \"FW002\": {\n \"info\": \" Create3Deployer.addDeployer() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `hashAddDeployer()`\"\n },\n \"FW003\": {\n \"info\": \" Create3Deployer.removeDeployer() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `hashRemoveDeployer()`\"\n },\n \"FW004\": {\n \"info\": \" Create3Deployer.setThreshold() - Threshold must be greater than 1\",\n \"suggestion\": \"To fix this error, `threshold` is greater than 1\"\n },\n \"FW005\": {\n \"info\": \" Create3Deployer.setThreshold() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_threshold))`\"\n },\n \"FW006\": {\n \"info\": \" Create3Deployer.callChild() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(child, data, _nonce, block.chainid))`\"\n },\n \"FW007\": {\n \"info\": \" Create3Deployer.callChild() - Invalid Nonce, nonce must be 1 greater than the current nonce\",\n \"suggestion\": \"To fix this error, make sure `_nonce` is equal to the current nonce + 1\"\n },\n \"FW008\": {\n \"info\": \" Create3Deployer.callChild() - call to child failed\",\n \"suggestion\": \"To fix this error, check to see what is making the call to the child fail\"\n },\n \"FW009\": {\n \"info\": \" Create3Deployer.deploy() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_salt, _creationCode))`\"\n },\n \"FW010\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_deployer` is not equal to the zero address\"\n },\n \"FW011\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_funWalletImpAddress` is not equal to the zero address\"\n },\n \"FW012\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_feeOracle` is not equal to the zero address\"\n },\n \"FW013\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_walletInit` is not equal to the zero address\"\n },\n \"FW014\": {\n \"info\": \" FunWalletFactory.constructor() - Unable to generate the address from this deployerSalt\",\n \"suggestion\": \"To fix this error, make sure `FunWalletFactoryV1` has not already been deployed from the given create3deployer contract. If it has been, change `FunWalletFactoryV1` to `FunWalletFactoryV2` or another version.\"\n },\n \"FW015\": {\n \"info\": \" FunWalletFactory.constructor() - Generated the wrong address from this deployerSalt\",\n \"suggestion\": \"To fix this error, make sure `FunWalletFactoryV1` has not already been deployed from the given create3deployer contract. If it has been, change `FunWalletFactoryV1` to `FunWalletFactoryV2` or another version.\"\n },\n \"FW016\": {\n \"info\": \" FunWalletFactory.createAccount() - Call to initialize failed on the deployed proxy\",\n \"suggestion\": \"To fix this error, make sure the `initializerCallData` is formatted correctly\"\n },\n \"FW017\": {\n \"info\": \" FunWalletFactory - Caller must be deployer\",\n \"suggestion\": \"To fix this error, make sure to call the function from the deployer address\"\n },\n \"FW018\": {\n \"info\": \" WalletInit.commit() - The previous commit has not expired\",\n \"suggestion\": \"To fix this error, wait for the previous commit with this `commitKey` to expire. This should take at most 10 minutes.\"\n },\n \"FW019\": {\n \"info\": \" WalletInit.validateSalt() - The hash at the commitKey does not match `keccak256(abi.encode(seed, owner, initializerCallData))`\",\n \"suggestion\": \"To fix this error, make sure the seed, owner, and initializerCallData are hashed and stored in commits at the corresponding `commitKey`\"\n },\n \"FW020\": {\n \"info\": \" WalletInit.validateSalt() - The new owner of the funwallet must match data.newFunWalletOwner from loginData\",\n \"suggestion\": \"To fix this error, make sure the owner set in `loginData` matches the owner address returned from the tweet.\"\n },\n \"FW021\": {\n \"info\": \" WalletInit.setOracle() - The address of the new `_oracle` must not be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_oracle` is not the zero address\"\n },\n \"FW022\": {\n \"info\": \" Create3Deployer.deployFromChild() - Invalid Child Address\",\n \"suggestion\": \"To fix this error, make sure the caller is a contract deployed from the Create3Deployer\"\n },\n \"FW023\": {\n \"info\": \" ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Target Code Hash\",\n \"suggestion\": \"To fix this error, make sure the caller is a contract targeted is a ERC1967ProxyData contract\"\n },\n \"FW024\": {\n \"info\": \" ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Contract Implementation Address\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW025\": {\n \"info\": \" ImplementationRegistry.addImplementation() - Invalid Signature Amount\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW026\": {\n \"info\": \" ImplementationRegistry.removeImplementation() - Invalid Signature Amount\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW027\": {\n \"info\": \" WalletInit.commit() - Unable to commit with a previously used commit hash\",\n \"suggestion\": \"To fix this error, make sure you are not reusing someone else's commit hash. If there are conflicts, just regenerate the seed randomly\"\n },\n \"FW028\": {\n \"info\": \" MultiSigDeployer.constructor() - Threshold can't be greater than deployers length\",\n \"suggestion\": \"To fix this error, make sure the threshold value is not 0\"\n },\n \"FW029\": {\n \"info\": \" WalletInit.invalidateUsedSeed() - msg.sender must equal funwalletfactory\",\n \"suggestion\": \"To fix this error, make sure you are calling this function from the FunWalletFactory contract\"\n },\n \"FW030\": {\n \"info\": \" WalletInit.setFunWalletFactory() - funwalletfactory address cannot be set to 0\",\n \"suggestion\": \"To fix this error, make sure you are passing in the valid funwalletfactory address\"\n },\n \"FW031\": {\n \"info\": \" WalletInit.validateSalt() - seed has already been used\",\n \"suggestion\": \"To fix this error, make sure you are not using an existing salt\"\n },\n \"FW032\": {\n \"info\": \" FunWalletFactory.setFeeOracle() - Cannot set the fee oracle address to 0\",\n \"suggestion\": \"To fix this error, make sure you are using the correct address of the fee oracle\"\n },\n \"FW033\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_entryPoint` is not equal to the zero address\"\n },\n \"FW034\": {\n \"info\": \" Create3Deployer.callChild() - Value not equal to msg.value\",\n \"suggestion\": \"To fix this error, make sure `msg.value` is equal to the `value` parameter.\"\n },\n \"FW100\": {\n \"info\": \" Module.execute() - execute() needs to be overriden\",\n \"suggestion\": \"To fix this error, make sure you are overriding the execute method in your module\"\n },\n \"FW101\": {\n \"info\": \" ApproveAndExec.approveAndExecute() - the approveData's first four bytes must be the approve() function selector\",\n \"suggestion\": \"To fix this error, change `approveData` such that the first four bytes are `bytes4(keccak256('approve(address,uint256)'))`\"\n },\n \"FW102\": {\n \"info\": \" ApproveAndSwap.constructor() - `_wethAddr` cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_wethAddr` is not set to the zero address\"\n },\n \"FW103\": {\n \"info\": \" ApproveAndSwap.constructor() - `_router` cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_router` is not set to the zero address\"\n },\n \"FW104\": {\n \"info\": \" ApproveAndSwap.executeSwapEth() - msg.sender does not have enough weth\",\n \"suggestion\": \"To fix this error, make sure msg.sender has a weth balance >= `amount`\"\n },\n \"FW105\": {\n \"info\": \" ApproveAndSwap.\\\\_internalSwap() - Approve failed\",\n \"suggestion\": \"To fix this error, make sure you have formatted approve correctly\"\n },\n \"FW106\": {\n \"info\": \" AaveWithdraw.execute() - Withdrawing a zero balance\",\n \"suggestion\": \"You are trying to withdraw from aave but don't have a balance\"\n },\n \"FW107\": {\n \"info\": \" ApproveAndExec.approveAndExecute() - Approve failed\",\n \"suggestion\": \"The token you tried to approve failed\"\n },\n \"FW108\": {\n \"info\": \" UniswapV3LimitOrder.execute() - Approval Failed\",\n \"suggestion\": \"You are trying to withdraw from aave but don't have a balance\"\n },\n \"FW109\": {\n \"info\": \" UniswapV3LimitOrder.constructor() - Router cannot be address zero\",\n \"suggestion\": \"Make sure you are not passing in the zero address when initializing the module\"\n },\n \"FW110\": {\n \"info\": \" UniswapV3LimitOrder.constructor() - Quoter cannot be zero address\",\n \"suggestion\": \"Make sure you are not passing in the zero address when initializing the module\"\n },\n \"FW200\": {\n \"info\": \" FeePercentOracle.setValues() - feepercent must be less than or equals to 100%\",\n \"suggestion\": \"To fix this error, `_feepercent` must be less than or equals to `10 ** _decimals`\"\n },\n \"FW201\": {\n \"info\": \" FeePercentOracle.withdrawEth() - eth transfer failed\",\n \"suggestion\": \"To fix this error, investigate why the eth withdrawal failed. This is likely because `amount` was greater than the eth balance in the FeePercentOracle\"\n },\n \"FW202\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator price must be greater than 0\",\n \"suggestion\": \"To fix this error, retry the call and make sure price is greater than 0\"\n },\n \"FW203\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator updatedAt must be greater than 0\",\n \"suggestion\": \"To fix this error, retry the call and make sure updatedAt is greater than 0\"\n },\n \"FW204\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator answeredInRound must be greater than or equal to roundId\",\n \"suggestion\": \"To fix this error, retry the call and make sure answeredInRound must be greater than or equal to roundId\"\n },\n \"FW205\": {\n \"info\": \" TwitterOracle.batchSetTweet() - socialHandles, loginTypes, seeds, owners length must match in length\",\n \"suggestion\": \"To fix this error, make sure all arrays passed into this function are the same length.\"\n },\n \"FW206\": {\n \"info\": \" TwitterOracle.setTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW207\": {\n \"info\": \" TwitterOracle.setTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW208\": {\n \"info\": \" TwitterOracle.batchSetTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW209\": {\n \"info\": \" TwitterOracle.batchSetTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW210\": {\n \"info\": \" TwitterOracle.fetchTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW211\": {\n \"info\": \" TwitterOracle.fetchTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW300\": {\n \"info\": \" BasePaymaster.constructor() - entrypoint address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure entrypoint address is not the zero address\"\n },\n \"FW301\": {\n \"info\": \" BasePaymaster.\\\\_requireFromEntryPoint() - the msg.sender must be from the entrypoint\",\n \"suggestion\": \"To fix this error, make sure the msg.sender must be from the entrypoint\"\n },\n \"FW302\": {\n \"info\": \" GaslessPaymaster.batchActions() - the ith delegate call failed\",\n \"suggestion\": \"To fix this error, make sure the calldata for `data[i]` is a valid call\"\n },\n \"FW303\": {\n \"info\": \" GaslessPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated\",\n \"suggestion\": \"To fix this error, increase the amount of msg.value you are passing to this function\"\n },\n \"FW304\": {\n \"info\": \" GaslessPaymaster.\\\\_withdrawDepositTo() - the withdrawal has not been unlocked\",\n \"suggestion\": \"To fix this error, wait till block.number is greater than the unlockBlock for the sender and make sure `unlockBlock[sender]` is nonzero\"\n },\n \"FW305\": {\n \"info\": \" GaslessPaymaster.\\\\_withdrawDepositTo() - the balances of the sender must be greater than the withdrawal amount\",\n \"suggestion\": \"To fix this error, decrease the amount you are trying to withdraw\"\n },\n \"FW306\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the userOp.paymasterAndData must have a length of 40\",\n \"suggestion\": \"To fix this error, change the `paymasterAndData` field in the `userOp` such that the length is 40\"\n },\n \"FW307\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the verificationGasLimit must be greater than the `COST_OF_POST` variable in GaslessPaymaster\",\n \"suggestion\": \"To fix this error, increase the `verificationGasLimit` in the `userOp`\"\n },\n \"FW308\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the sponsor's eth is not locked for use\",\n \"suggestion\": \"To fix this error, make sure the sponsor's eth is locked using `lockDeposit()`\"\n },\n \"FW309\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - The sponsor needs to approve the spender\",\n \"suggestion\": \"To fix this error, make sure to approve the spender using `setSpenderWhitelistMode()` or `setSpenderBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setListMode()\"\n },\n \"FW310\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - The sponsor does not have sufficient eth in the paymaster to cover this operation\",\n \"suggestion\": \"To fix this error, make sure to stake enough eth from the sponsor's address using `addDepositTo()`\"\n },\n \"FW311\": {\n \"info\": \" GaslessPaymaster.addDepositTo() - `msg.value` must be greater than or equal to amount\",\n \"suggestion\": \"To fix this error, make sure `msg.value` must be greater than or equal to amount\"\n },\n \"FW312\": {\n \"info\": \" TokenPaymaster.batchActions() - the ith delegate call failed\",\n \"suggestion\": \"To fix this error, make sure the calldata for `data[i]` is a valid call\"\n },\n \"FW313\": {\n \"info\": \" TokenPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated\",\n \"suggestion\": \"To fix this error, increase the amount of msg.value you are passing to this function\"\n },\n \"FW314\": {\n \"info\": \" TokenPaymaster.\\\\_addTokenDepositTo() - token decimals must be greater than 0\",\n \"suggestion\": \"To fix this error, change the decimals in token using `setTokenData()`\"\n },\n \"FW315\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawTokenDepositTo() - token is not unlocked for withdrawal\",\n \"suggestion\": \"To fix this error, call `unlockTokenDepositAfter()`\"\n },\n \"FW316\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawTokenDepositTo() - you are withdrawing more tokens that you have in balance\",\n \"suggestion\": \"To fix this error, call `getTokenBalance()` to check how many tokens you have and make sure `amount` is less than that\"\n },\n \"FW317\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawEthDepositTo() - token is not unlocked for withdrawal\",\n \"suggestion\": \"To fix this error, call `unlockTokenDepositAfter()` with `ETH` as the token\"\n },\n \"FW318\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawEthDepositTo() - you are withdrawing more ether that you have in balance\",\n \"suggestion\": \"To fix this error, call `getTokenBalance()` with `ETH` as the token to check how many tokens you have and make sure `amount` is less than that\"\n },\n \"FW319\": {\n \"info\": \" TokenPaymaster.\\\\_getTokenValueOfEth() - call to token oracle failed\",\n \"suggestion\": \"To fix this error, check the token oracle and call `setTokenData()` to change the oracle if it is broken\"\n },\n \"FW320\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - failed to reimbursePaymaster with tokens via `permitTransfer()`\",\n \"suggestion\": \"To fix this **error**, make sure you have permitted the paymaster to spend your tokens\"\n },\n \"FW321\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - spender doesn't have enough tokens\",\n \"suggestion\": \"To fix this error, make sure to add more tokens to the token paymaster via `addTokenDepositTo()`\"\n },\n \"FW322\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - `paymasterAndData` length must be 60\",\n \"suggestion\": \"To fix this error, make sure to set `paymasterAndData` length to be 60\"\n },\n \"FW323\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - `verificationGasLimit` must be greater than `COST_OF_POST`\",\n \"suggestion\": \"To fix this error, make sure to set the userOp's `verificationGasLimit` to be greater than `COST_OF_POST`\"\n },\n \"FW324\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must lock their ETH\",\n \"suggestion\": \"To fix this error, make sure the sponsor has locked their eth by calling `lockTokenDeposit()` from the sponsor address\"\n },\n \"FW325\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the account must lock their tokens\",\n \"suggestion\": \"To fix this error, make sure the user of the token paymaster has locked their tokens by calling `lockTokenDeposit()` from their address\"\n },\n \"FW326\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor eth balance must be greater than maxCost\",\n \"suggestion\": \"To fix this error, make sure the sponsor eth balance is greater than maxCost\"\n },\n \"FW327\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must approve the spender\",\n \"suggestion\": \"To fix this error, make sure the sponsor has approved the spender by calling `setSpenderWhitelistMode()` or `setSpenderBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setListMode()`\"\n },\n \"FW328\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must have approved the token to the paymaster\",\n \"suggestion\": \"To fix this error, make sure the sponsor has approved the spender by calling `setTokenWhitelistMode()` or `setTokenBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setTokenListMode()`\"\n },\n \"FW329\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted token must be equal to the token you are trying to pay with if using permit\",\n \"suggestion\": \"To fix this error, make sure the permitted token is equal to the token you are trying to pay with if using permit\"\n },\n \"FW330\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted transfer recipient must be the token paymaster\",\n \"suggestion\": \"To fix this error, make sure to permit the token paymaster to spend your tokens\"\n },\n \"FW331\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted transfer amount must be greater than or equal to the maxTokenCost\",\n \"suggestion\": \"To fix this error, make sure the permitted transfer amount is greater than or equal to the maxTokenCost\"\n },\n \"FW332\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - if permit was not used, make sure the tokenPaymaster was approved to spend tokens by the sponsor or enough tokens were deposited into the TokenPaymaster\",\n \"suggestion\": \"To fix this error, make sure the tokenPaymaster was approved(`approve()`) to spend tokens by the sponsor or enough tokens were deposited into the TokenPaymaster via `addTokenDepositTo()`\"\n },\n \"FW333\": {\n \"info\": \" TokenPaymaster.addEthDepositTo() - make sure msg.value is greater than or equal to amount\",\n \"suggestion\": \"To fix this error, make sure that the msg.value is greater than or equal to amount\"\n },\n \"FW334\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - sponsor cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the sponsor is not the zero address\"\n },\n \"FW335\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - target cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the target is not the zero address\"\n },\n \"FW336\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - token address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the token address is not the zero address\"\n },\n \"FW337\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - spender address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the spender address is not the zero address\"\n },\n \"FW338\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the token oracle cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the token oracle is not the zero address\"\n },\n \"FW339\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the tokenAddress cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the tokenAddress is not the zero address\"\n },\n \"FW340\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the token decimals must be greater than 0\",\n \"suggestion\": \"To fix this error, make sure the token decimals is greater than 0\"\n },\n \"FW341\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the chainlink aggregator cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the chainlink aggregator is not the zero address\"\n },\n \"FW342\": {\n \"info\": \" TokenPaymaster.removeTokenData() - The token doesn't exist in tokens\",\n \"suggestion\": \"To fix this error, make sure the token address is not the zero address\"\n },\n \"FW343\": {\n \"info\": \" TokenPaymaster.removeTokenData() - The tokenListIndex doesn't match with the tokenAddress\",\n \"suggestion\": \"To fix this error, make sure the token at tokenList[tokenListIndex] is the same as the tokenAddress\"\n },\n \"FW344\": {\n \"info\": \" GaslessPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions\",\n \"suggestion\": \"To fix this error, make sure you are not recursively calling batchActions from within batchActions\"\n },\n \"FW345\": {\n \"info\": \" TokenPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions\",\n \"suggestion\": \"To fix this error, make sure you are not recursively calling batchActions from within batchActions\"\n },\n \"FW346\": {\n \"info\": \" TokenPaymaster.postOp() - Invalid Permit transfer amount\",\n \"suggestion\": \"To fix this error, make sure your permit transfer has transfered the correct amount of tokens\"\n },\n \"FW347\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - Invalid amount of tokens transferred\",\n \"suggestion\": \"The likely cause of this error is using a deflationary token that charges a tax when you transfer tokens. To fix this error, make sure you are transferring the correct amount of tokens and to account for the tax/deflation.\"\n },\n \"FW348\": {\n \"info\": \" UserAuthentication.init() - groupId count must be equal to groups length\",\n \"suggestion\": \"Make sure the number of groupIds equals the number of groups.\"\n },\n \"FW349\": {\n \"info\": \" TokenPaymaster.calculatePostOpGas() - Invalid Auth Type\",\n \"suggestion\": \"Make sure the authtype is correct\"\n },\n \"FW350\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - Does not have enough balance of token\",\n \"suggestion\": \"To fix this error, make sure your has enough tokens to permit transfer\"\n },\n \"FW351\": {\n \"info\": \" BasePaymaster.\\\\withdrawStakeFromEntryPoint() - Cannot withdraw to address zero\",\n \"suggestion\": \"To fix this error, make sure you are not withdrawing to address zero\"\n },\n \"FW401\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW402`: RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target\"\n },\n \"FW402\": {\n \"info\": \" RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target\",\n \"suggestion\": \"To fix this error, make sure the target that you are calling is in the merkle root of allowed targets verified by the rule. If this does not work make sure you are using the correct merkle root implementation.\"\n },\n \"FW403\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the selector that you are calling is in the merkle root of allowed selector verified by the rule. If this does not work make sure you are using the correct merkle root implementation.\"\n },\n \"FW404\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the ownerId is not 0 or an existing owner\"\n },\n \"FW405\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the ruleId is not 0\"\n },\n \"FW406\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule that you are using has a deadline that has passed.\"\n },\n \"FW408\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW410`: RoleBasedAccessControl: isValidAction(), isValidActionAndFee() - Rule not added to role\"\n },\n \"FW410\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule is added to the role\"\n },\n \"FW411\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the value for the execution call is less than the limit\"\n },\n \"FW412\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee value for the execution call is less than the limit\"\n },\n \"FW413\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee recipient is in the rule fee merkle root\"\n },\n \"FW414\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee token is in the rule fee merkle root\"\n },\n \"FW417\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule you are using exists\"\n },\n \"FW418\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the user is in the role\"\n },\n \"FW419\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the feeRecipientTokenMerkleRootHash is not zero\"\n },\n \"FW420\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the targetSelectorMerkleRootHash is not zero\"\n },\n \"FW421\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW422`: RoleBasedAccessControl: init() - Wallet has not been initialized\"\n },\n \"FW422\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the wallet has not initialized the validation contract\"\n },\n \"FW500\": {\n \"info\": \" FunWallet.initialize() - the entrypoint cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the entrypoint is not the zero address\"\n },\n \"FW501\": {\n \"info\": \" FunWallet.initialize() - the msg.sender cannot be the address of the Funwallet contract\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is not the address of the Funwallet contract\"\n },\n \"FW502\": {\n \"info\": \" FunWallet.\\\\_requireFromFunWalletProxy() - the function must be called from the funwallet proxy\",\n \"suggestion\": \"To fix this error, make sure the msg.sender == funwallet\"\n },\n \"FW503\": {\n \"info\": \" FunWallet.updateEntryPoint() - the new entrypoint address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the new entrypoint address is not the zero address\"\n },\n \"FW504\": {\n \"info\": \" FunWallet.depositToEntryPoint() - not enough eth in the funwallet\",\n \"suggestion\": \"To fix this error, make sure the funwallet has more than the amount of eth you are trying to deposit\"\n },\n \"FW505\": {\n \"info\": \" FunWallet.\\\\_transferEthFromEntrypoint() - withdrawing eth from the entrypoint failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the entrypoint\"\n },\n \"FW506\": {\n \"info\": \" FunWallet.\\\\_requireFromModule() - make sure a funwalletfactory deployed the module\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is the module\"\n },\n \"FW507\": {\n \"info\": \" FunWallet.\\\\_requireFromEntryPoint() - the msg.sender must be the entrypoint\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is the entrypoint\"\n },\n \"FW508\": {\n \"info\": \" WalletFee.\\\\_transferEth() - the eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW509\": {\n \"info\": \" WalletFee.\\\\_handleFee() - the developer eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW510\": {\n \"info\": \" WalletFee.\\\\_handleFee() - the funOracle eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW511\": {\n \"info\": \" WalletValidation.initValidations() - the WalletValidations contract has already been initialized\",\n \"suggestion\": \"Don't call initValidations() more than once\"\n },\n \"FW512\": {\n \"info\": \" WalletValidation.initValidations() - make sure there are more than zero validations\",\n \"suggestion\": \"To fix this error, make sure there are more than zero validations and the number of validation contract addresses are equal to the number of `initCallData` elements\"\n },\n \"FW513\": {\n \"info\": \" WalletValidation.initValidations() - make sure there are no duplicate validation contract addresses\",\n \"suggestion\": \"To fix this error, make sure there are no duplicate validation contract addresses in `validationData`\"\n },\n \"FW514\": {\n \"info\": \" WalletValidation.\\\\_validateUserOp() - make sure the signature length is greater than 0\",\n \"suggestion\": \"To fix this error, make sure the signature length is greater than 0\"\n },\n \"FW515\": {\n \"info\": \" WalletValidation.isValidSignature() - make sure the number of validations is greater than zero\",\n \"suggestion\": \"To fix this error, make sure the number of validations is greater than zero\"\n },\n \"FW516\": {\n \"info\": \" WalletValidation.\\\\_requireValidValidation() - the validation failed\",\n \"suggestion\": \"To fix this error, make sure the validation contract returns true\"\n },\n \"FW517\": {\n \"info\": \" WalletValidation.\\\\_requireValidValidationFormat() - the validation was incorrectly formatted\",\n \"suggestion\": \"To fix this error, make sure the validation contract address is not the zero address and the validation is valid and the address is not the zero address\"\n },\n \"FW518\": {\n \"info\": \" WalletValidation.\\\\_requireValidPrevValidation() - the previous validation must be linked to this validation\",\n \"suggestion\": \"To fix this error, make sure the previous validation is linked to this validation when adding or removing the validation\"\n },\n \"FW519\": {\n \"info\": \" WalletValidation.getValidations() - you must have more than zero validations to get validations\",\n \"suggestion\": \"To fix this error, make sure there are a nonzero amount of validations\"\n },\n \"FW520\": {\n \"info\": \" WalletValidation.addValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling addValidation() from your funwallet.\"\n },\n \"FW521\": {\n \"info\": \" WalletValidation.removeValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling removeValidation() from your funwallet.\"\n },\n \"FW522\": {\n \"info\": \" WalletValidation.updateValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling updateValidation() from your funwallet.\"\n },\n \"FW523\": {\n \"info\": \" WalletModules.permitTransfer() - Invalid Permit Signature.\",\n \"suggestion\": \"To fix this error, make sure you have a valid permit signature.\"\n },\n \"FW524\": {\n \"info\": \" WalletValidation.getValidations() - No Validations in the wallet\",\n \"suggestion\": \"To fix this error, make sure the wallet has validation contracts\"\n },\n \"FW600\": {\n \"info\": \" DataLib\",\n \"suggestion\": \"To fix this error, make sure you are calling either execFromEntryPoint() or execFromEntryPointWithFee() from your funwallet.\"\n },\n \"FW601\": {\n \"info\": \" Ownable2StepNoRenounce\",\n \"suggestion\": \"To fix this error, don't call this function.\"\n }\n}\n", "export type ErrorData = {\n location: string\n error?: {\n txDetails?: ErrorTransactionDetails\n reasonData?: {\n title: string\n reasons: string[]\n }\n }\n}\n\nexport type ErrorTransactionDetails = {\n method: string\n params: any[]\n contractAddress?: string\n chainId?: number | string\n}\n\nexport enum ErrorBaseType {\n ClientError = 'ClientError',\n ServerError = 'ServerError',\n}\n\nexport enum ErrorType {\n InvalidParameter = 'InvalidParameter',\n InternalServerFailure = 'InternalServerFailure',\n ResourceNotFound = 'ResourceNotFound',\n InvalidAction = 'InvalidAction',\n ThrottlingError = 'ThrottlingError',\n AccessDeniedError = 'AccessDeniedError',\n UserOpFailureError = 'UserOpFailureError',\n}\n\nexport enum ErrorCode {\n MissingParameter = 'MissingParameter',\n InvalidParameter = 'InvalidParameter',\n InvalidThreshold = 'InvalidThreshold',\n InvalidChainIdentifier = 'InvalidChainIdentifier',\n InvalidNFTIdentifier = 'InvalidNFTIdentifier',\n InsufficientSignatures = 'InsufficientSignatures',\n InvalidParameterCombination = 'InvalidParameterCombination',\n CheckPointHintsNotFound = 'CheckPointHintsNotFound',\n GroupNotFound = 'GroupNotFound',\n TokenNotFound = 'TokenNotFound',\n AddressNotFound = 'AddressNotFound',\n UserAlreadyExists = 'UserAlreadyExists',\n UserNotFound = 'UserNotFound',\n ChainNotSupported = 'ChainNotSupported',\n ServerMissingData = 'ServerMissingData',\n ServerFailure = 'ServerFailure',\n ServerTimeout = 'ServerTimeout',\n UnknownServerError = 'UnknownServerError',\n ServerConnectionError = 'ServerConnectionError',\n UserOpFailureError = 'UserOpFailureError',\n Unauthorized = 'Unauthorized',\n RequestLimitExceeded = 'RequestLimitExceeded',\n WalletPrefundError = 'PrefundError',\n GasSponsorFundError = 'GasSponsorFundError',\n FunWalletErrorCode = 'FunWalletErrorCode',\n BridgeRouteNotFound = 'BridgeRouteNotFound',\n BridgeAllowanceDataNotFound = 'BridgeAllowanceDataNotFound',\n BridgeApproveTxDataNotFound = 'BridgeApproveTxDataNotFound',\n CheckoutInitDepositAddrNotFound = 'CheckoutInitDepositAddrNotFound',\n}\n", "import { BaseError } from './BaseError'\nimport FWErrors from './errors.json'\nimport { ErrorBaseType, ErrorCode, ErrorType } from './types'\nexport class ClientError extends BaseError {\n constructor(\n type: string,\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorBaseType.ClientError,\n type,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n false,\n )\n }\n}\n\nexport class InvalidParameterError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.InvalidParameter,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class ResourceNotFoundError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n if (msg.includes('Chain name not found')) {\n const { reqId } = JSON.parse(msg)\n super(\n ErrorType.ResourceNotFound,\n ErrorCode.ChainNotSupported,\n ': Chain name not found or not supported.',\n rawMessage,\n { reqId },\n 'Change your EnvOptions to the correct chain identifier.',\n docLink,\n )\n } else {\n super(\n ErrorType.ResourceNotFound,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n }\n}\n\nexport class ThrottlingError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.ThrottlingError,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class AccessDeniedError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.AccessDeniedError,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class UserOpFailureError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n const FWCode = findFWContractError(msg)\n if (FWCode) {\n const { reqId } = JSON.parse(msg)\n super(\n ErrorType.UserOpFailureError,\n ErrorCode.FunWalletErrorCode,\n FWErrors[FWCode].info,\n rawMessage,\n { reqId },\n FWErrors[FWCode].suggestion,\n docLink,\n )\n } else {\n super(\n ErrorType.UserOpFailureError,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n }\n}\n\nconst findFWContractError = (msg: string) => {\n let match = msg.match(/FW\\d{3}/)\n if (!match) {\n match = msg.match(/AA\\d./)\n }\n return match?.[0]\n}\n", "import { BaseError } from './BaseError'\nimport { ErrorBaseType, ErrorType } from './types'\n\nexport class ServerError extends BaseError {\n constructor(\n type: string,\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorBaseType.ServerError,\n type,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n true,\n )\n }\n}\n\nexport class InternalFailureError extends ServerError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.InternalServerFailure,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n", "import {\n InvalidParameterError,\n ResourceNotFoundError,\n UserOpFailureError,\n} from '../errors'\n\nexport const errorAbortHandler = (err: any, context: any) => {\n if (\n err instanceof ResourceNotFoundError ||\n err instanceof InvalidParameterError ||\n err instanceof UserOpFailureError\n ) {\n context.abort()\n }\n}\n", "import type { PartialAttemptOptions } from '@lifeomic/attempt'\n\nimport { errorAbortHandler } from '../utils/error'\n\nexport type BaseResponse = any // TODO:\n\nexport type RetryOptions = PartialAttemptOptions<BaseResponse>\n\nexport const DEFAULT_RETRY_OPTIONS = {\n delay: 100,\n initialDelay: 0,\n maxDelay: 3000,\n factor: 2,\n maxAttempts: 5,\n timeout: 0,\n jitter: true,\n minDelay: 0,\n handleError: errorAbortHandler,\n handleTimeout: null,\n beforeAttempt: null,\n calculateDelay: null,\n} as RetryOptions\n", "import { toHex } from 'viem'\n\nexport function randomBytes(length: number) {\n const bytes = new Uint8Array(length)\n for (let i = 0; i < length; i++) {\n bytes[i] = Math.floor(Math.random() * 256)\n }\n return toHex(bytes)\n}\n\nexport function generateRandomCheckoutSalt() {\n return toHex(BigInt(randomBytes(32)))\n}\n\nexport function roundToNearestBottomTenth(n: number) {\n return Math.floor(n / 10) * 10\n}\n", "import { retry } from '@lifeomic/attempt'\nimport { toHex } from 'viem'\n\nimport type { BaseRequest } from '../consts/request'\nimport {\n type BaseResponse,\n DEFAULT_RETRY_OPTIONS,\n type RetryOptions,\n} from '../consts/retry'\nimport {\n AccessDeniedError,\n ErrorCode,\n InternalFailureError,\n InvalidParameterError,\n ResourceNotFoundError,\n ThrottlingError,\n UserOpFailureError,\n} from '../errors'\nimport type {\n DeleteRequest,\n GetRequest,\n PostRequest,\n PutRequest,\n} from './../consts/request'\n\nconst stringifyWithBigIntSanitization = (object: any) => {\n return JSON.stringify(\n object,\n (_, value) => (typeof value === 'bigint' ? toHex(value) : value), // return everything else unchanged\n )\n}\n\ntype RequestError = {\n errorMsg: string\n errorCode: string\n}\n\nexport const sendRequest = async ({\n uri,\n method,\n apiKey,\n body = {},\n retryOptions = {},\n signal,\n}: BaseRequest): Promise<BaseResponse> => {\n try {\n const headers = {\n 'Content-Type': 'application/json',\n ...(apiKey ? { 'X-Api-Key': apiKey } : {}),\n }\n\n const finalRetryOptions = {\n ...DEFAULT_RETRY_OPTIONS,\n ...(retryOptions || {}),\n } as RetryOptions\n\n return retry(async () => {\n const response = await fetch(uri, {\n method,\n headers,\n redirect: 'follow',\n signal,\n body:\n method !== 'GET' ? stringifyWithBigIntSanitization(body) : undefined,\n })\n const json = await response.json()\n\n if (response.ok) {\n return json\n }\n\n const { errorMsg, errorCode } = json as RequestError\n\n if (response.status === 400) {\n throw new InvalidParameterError(\n ErrorCode.InvalidParameter,\n `bad request ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 403) {\n throw new AccessDeniedError(\n ErrorCode.Unauthorized,\n 'Invalid API key or insufficient access.',\n errorMsg,\n { apiKey },\n 'Check your api key at https://app.fun.xyz and check with fun team if you believe something is off',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 404) {\n throw new ResourceNotFoundError(\n ErrorCode.ServerMissingData,\n JSON.stringify(json),\n errorMsg,\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 429) {\n throw new ThrottlingError(\n ErrorCode.RequestLimitExceeded,\n `too many requests ${JSON.stringify(json)}`,\n 'Too many requests',\n { body },\n 'you are making too many requests. please slow down. Reach out to fun team if you need more quota',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 500) {\n if (errorCode === ErrorCode.UserOpFailureError) {\n throw new UserOpFailureError(\n ErrorCode.UserOpFailureError,\n `server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'fix user op failure. Most of the time this is due to invalid parameters',\n 'https://docs.fun.xyz',\n )\n } else {\n throw new InternalFailureError(\n ErrorCode.ServerFailure,\n `server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n } else if (response.status === 504) {\n throw new InternalFailureError(\n ErrorCode.ServerTimeout,\n `server timeout failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n } else if (!response.ok) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n `unknown server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n return {}\n }, finalRetryOptions)\n } catch (err) {\n throw new InternalFailureError(\n ErrorCode.ServerConnectionError,\n `Cannot connect to Fun API Service ${err}`,\n '',\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n}\n\nexport async function sendGetRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: GetRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n method: 'GET',\n })\n}\n\nexport async function sendPostRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PostRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'POST',\n })\n}\n\nexport async function sendDeleteRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: DeleteRequest): Promise<void> {\n await sendRequest({\n uri,\n method: 'DELETE',\n apiKey,\n retryOptions,\n signal,\n })\n}\n\nexport async function sendPutRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PutRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'PUT',\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport type {\n GetAllWalletNFTsByChainIdRequest,\n GetAllWalletNFTsByChainIdResponse,\n GetAllWalletNFTsRequest,\n GetAllWalletNFTsResponse,\n GetAllWalletTokensByChainIdRequest,\n GetAllWalletTokensByChainIdResponse,\n GetAllWalletTokensRequest,\n GetAllWalletTokensResponse,\n GetAllowedAssetsRequest,\n GetAllowedAssetsResponse,\n GetAssetPriceInfoRequest,\n GetAssetPriceInfoResponse,\n GetWalletLidoWithdrawalsByChainId,\n GetWalletLidoWithdrawalsByChainIdResponse,\n} from './types'\n\n/**===========================================================\n * REFERENCE CORE FILE: /packages/core/src/apis/AssetApis.ts\n * TODO: Remove this comment once migration is complete\n *===========================================================*/\n\n/**\n * Gets the estimated dollar unit price of a tokenAddress for checkout\n * @param chainId https://chainlist.org/ e.g. \"1\" for ethereum\n * @param assetTokenAddress tokenAddress of the asset on the given chain\n * @param apiKey\n */\nexport async function getAssetPriceInfo({\n chainId,\n assetTokenAddress,\n apiKey,\n}: GetAssetPriceInfoRequest): Promise<GetAssetPriceInfoResponse> {\n const priceInfo = await sendGetRequest({\n uri: `${API_BASE_URL}/asset/erc20/price/${chainId}/${assetTokenAddress}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n return priceInfo\n}\n\n/**\n * Get all tokens for a given wallet address\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n * @param signal AbortSignal to cancel the request when no longer needed\n */\nexport async function getAllWalletTokens({\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n signal,\n}: GetAllWalletTokensRequest): Promise<GetAllWalletTokensResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n signal,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**\n * Get all tokens for a given wallet address on a specific chain\n * @param chainId https://chainlist.org/\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n */\nexport async function getAllWalletTokensByChainId({\n chainId,\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n}: GetAllWalletTokensByChainIdRequest): Promise<GetAllWalletTokensByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}/${chainId}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**\n * Get list of assets that are allowed to be used for checkout\n * @param apiKey\n */\nexport async function getAllowedAssets({\n apiKey,\n}: GetAllowedAssetsRequest): Promise<GetAllowedAssetsResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/allow`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**=======================\n * POTENTIAL DEPRECATION\n *=======================*/\n\n/**\n * Get all the NFTs owned by a wallet\n * @param walletAddress\n * @param apiKey\n */\nexport async function getAllWalletNFTs({\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsRequest): Promise<GetAllWalletNFTsResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}`,\n apiKey,\n })\n}\n\n/**\n * Get all the NFTs owned by a wallet on a specific chain\n * @param chainId From https://chainlist.org/\n * @param walletAddress Address of holder\n * @param apiKey\n */\nexport async function getAllWalletNFTsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsByChainIdRequest): Promise<GetAllWalletNFTsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n\n/**\n * Get all lido withdrawal request ids for a wallet address on a specific chain\n * @param {string} chainId https://chainlist.org/ ie \"1\" for ethereum\n * @param {string} holderAddr Address of holder\n * @returns [readyToWithdrawRequestIds, notReadyToWithdrawRequestIds]\n */\nexport async function getWalletLidoWithdrawalsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetWalletLidoWithdrawalsByChainId): Promise<GetWalletLidoWithdrawalsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/lido-withdrawals/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n", "import Big from 'big.js'\nimport type { Address } from 'viem'\n\nimport { API_BASE_URL } from '../../consts'\nimport { ErrorCode, ResourceNotFoundError } from '../../errors'\nimport {\n generateRandomCheckoutSalt,\n roundToNearestBottomTenth,\n sendGetRequest,\n sendPostRequest,\n} from '../../utils'\nimport {\n type CheckoutApiInitParams,\n type CheckoutApiQuoteParams,\n type CheckoutApiQuoteResponse,\n type CheckoutDeactivateParams,\n type CheckoutHistoryItem,\n type CheckoutInitParams,\n type CheckoutInitResponse,\n type CheckoutInitTokenTransferAddressParams,\n type CheckoutQuoteParams,\n type CheckoutQuoteResponse,\n CheckoutState,\n type CheckoutTransferSponsorshipApiParams,\n type CheckoutTransferSponsorshipParams,\n type CheckoutTransferSponsorshipResponse,\n type RiskAssessmentParams,\n type RiskAssessmentResponse,\n} from './types'\n\n/**\n * Gets a checkout quote (estimation).\n * @param fromChainId The ID of the chain where funds will be provided from.\n * @param fromTokenAddress The asset to fund the checkout. This must be either a chain native token or an ERC-20, on the fromChainId.\n * @param fromTokenDecimals The number of decimals for the fromTokenAddress.\n * @param toChainId The ID of the chain where the checkout operation is to be performed.\n * @param toTokenAddress The wanted asset for the checkout operation. This must be either a chain native token or an ERC-20, on the target chain.\n * @param toTokenAmount The amount of wanted asset for the checkout operation in base units.\n * @param toTokenDecimals The number of decimals for the toTokenAddress.\n * @param expirationTimestampMs The amount of time (duration) from now before the checkout operation expires.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @return {Promise<CheckoutCoreQuoteResponse>} The formatted quote object\n */\nexport async function getCheckoutQuote({\n fromChainId,\n fromTokenAddress,\n fromTokenDecimals,\n toChainId,\n toTokenAddress,\n toTokenDecimals,\n toTokenAmount,\n expirationTimestampMs,\n sponsorInitialTransferGasLimit,\n recipientAddr,\n needsRefuel,\n userId,\n apiKey,\n signal,\n}: CheckoutQuoteParams): Promise<CheckoutQuoteResponse> {\n try {\n const toMultipler = 10 ** toTokenDecimals\n const toAmountBaseUnitBI = BigInt(Math.floor(toTokenAmount * toMultipler))\n const queryParams: CheckoutApiQuoteParams = {\n userId,\n fromChainId,\n fromTokenAddress,\n toChainId,\n toTokenAddress,\n toAmountBaseUnit: toAmountBaseUnitBI.toString(),\n // Only pass in recipientAddr if specified\n ...(recipientAddr ? { recipientAddr } : {}),\n // Rounding nearest tenth second (instead of seconds) to better support backend quote caching feature\n // Reference: https://vintage-heaven-3cd.notion.site/API-Gateway-Caching-and-Pre-Warming-System-Draft-ee7909d9b85f43c793ce7bd2607bec02?pvs=4\n // Note: Rounding *down* instead of a regular round to safeguard against edge case of timing passing frontend range validation but failing backend range validation\n checkoutExpirationTimestampSeconds: roundToNearestBottomTenth(\n Math.round((Date.now() + expirationTimestampMs) / 1000),\n ).toString(),\n sponsorInitialTransferGasLimit,\n // @deprecated Not in use\n refuel: needsRefuel.toString(),\n }\n\n const searchParams = new URLSearchParams(queryParams)\n const quoteRes = (await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/quote?${searchParams}`,\n apiKey,\n signal,\n })) as CheckoutApiQuoteResponse\n\n const fromMultipler = 10 ** fromTokenDecimals\n // Format the response for frontend usage\n return {\n quoteId: quoteRes.quoteId,\n fromTokenAddress: quoteRes.fromTokenAddress,\n estFeesUsd: quoteRes.estFeesUsd,\n estSubtotalUsd: quoteRes.estSubtotalUsd,\n estTotalUsd: quoteRes.estTotalUsd,\n estCheckoutTimeMs: quoteRes.estCheckoutTimeMs,\n estTotalFromAmountBaseUnit: quoteRes.estTotalFromAmountBaseUnit,\n estSubtotalFromAmountBaseUnit: quoteRes.estSubtotalFromAmountBaseUnit,\n estFeesFromAmountBaseUnit: quoteRes.estFeesFromAmountBaseUnit,\n estMarketMakerGasUsd: quoteRes.estMarketMakerGasUsd,\n lpFeePercentage: quoteRes.lpFeePercentage,\n lpFeeUsd: quoteRes.lpFeeUsd,\n // Added fields\n estFeesFromAmount: new Big(quoteRes.estFeesFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estSubtotalFromAmount: new Big(quoteRes.estSubtotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estTotalFromAmount: new Big(quoteRes.estTotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n }\n } catch (err: any) {\n throw new Error(\n `An error occured trying to generate a checkout quote: ${err.message}`,\n )\n }\n}\n\n/**\n * Initializes a checkout\n * @param userOp The checkout UserOp, signed.\n * @param quoteId The quoteId specific to the checkout.\n * @param apiKey A valid fun api key.\n * @return {Address} The generated deposit address\n */\nexport async function initializeCheckout({\n userOp,\n quoteId,\n sourceOfFund,\n apiKey,\n clientMetadata,\n}: CheckoutInitParams): Promise<Address> {\n const body = {\n ...(userOp ? { userOp } : {}),\n quoteId,\n sourceOfFund,\n salt: generateRandomCheckoutSalt(),\n clientMetadata,\n } as CheckoutApiInitParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout`,\n body,\n apiKey,\n })\n if (!res?.depositAddr) {\n throw new ResourceNotFoundError(\n ErrorCode.CheckoutInitDepositAddrNotFound,\n 'Unable to initialize checkout',\n 'Unable to initialize checkout',\n body,\n '',\n 'https://docs.fun.xyz',\n )\n }\n return res.depositAddr as CheckoutInitResponse\n}\n\nexport async function deactivateCheckout({\n depositAddress,\n apiKey,\n}: CheckoutDeactivateParams) {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/update/${depositAddress}`,\n body: {\n // Fixed state to cancel the checkout\n state: CheckoutState.CANCELLED,\n },\n apiKey,\n })\n return true\n } catch (_err) {\n throw new Error('Unable to deactivate checkout')\n }\n}\n\n/**\n * Gets a checkout given a depositAddress\n * @param depositAddress A unique deposit address associated with a backend checkout item.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns The checkout object if exists. Otherwise, null.\n */\nexport async function getCheckoutByDepositAddress({\n depositAddress,\n apiKey,\n signal,\n}: {\n depositAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem | null> {\n try {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/${depositAddress}`,\n apiKey,\n signal,\n })\n } catch (err) {\n if (err instanceof ResourceNotFoundError) {\n return null\n }\n throw err\n }\n}\n\n/**\n * Gets all checkouts associated with a funWallet\n * @param funWalletAddress A funWallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByFunWalletAddress({\n funWalletAddress,\n apiKey,\n signal,\n}: {\n funWalletAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/fun-wallet/${funWalletAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a recipient address\n * @param recipientAddress A wallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByRecipientAddress({\n recipientAddress,\n apiKey,\n signal,\n}: {\n recipientAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/recipient/${recipientAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a funkit userId string\n * @param userId A userId string.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByUserId({\n userId,\n apiKey,\n signal,\n}: {\n userId: string\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/userId/${userId}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\nexport async function getPaymasterDataForCheckoutSponsoredTransfer({\n depositAddress,\n transferUserOp,\n apiKey,\n}: CheckoutTransferSponsorshipParams): Promise<CheckoutTransferSponsorshipResponse> {\n const body = {\n depositAddress,\n userOp: transferUserOp,\n } as CheckoutTransferSponsorshipApiParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/sponsor-transfer`,\n body,\n apiKey,\n })\n if (!res) {\n // TODO: Better error handling\n throw new Error('Unable to get sponsorship information')\n }\n return res as CheckoutTransferSponsorshipResponse\n}\n\nexport async function getRiskAssessmentForAddress({\n address,\n apiKey,\n}: RiskAssessmentParams) {\n const response = (await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/risk-assessment?address=${address}`,\n apiKey,\n })) as RiskAssessmentResponse\n\n return response\n}\n\nexport async function initializeCheckoutTokenTransferAddress({\n apiKey,\n ...body\n}: CheckoutInitTokenTransferAddressParams): Promise<CheckoutInitResponse> {\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/eoa`,\n body,\n apiKey,\n })\n if (!res?.depositAddr) {\n throw new ResourceNotFoundError(\n ErrorCode.CheckoutInitDepositAddrNotFound,\n 'Unable to initialize checkout token transfer address',\n 'Unable to initialize checkout token transfer address',\n body,\n '',\n 'https://docs.fun.xyz',\n )\n }\n return res.depositAddr as CheckoutInitResponse\n}\n", "/**===============*\n * CHECKOUT QUOTE *\n *================*/\nimport type { Address, Hex } from 'viem'\n\n// TODO: Define the UserOperation type\ntype UserOperation = any\n\n// The params required for the actual /checkout/quote api\nexport type CheckoutApiQuoteParams = {\n fromChainId: string\n fromTokenAddress: Address\n toChainId: string\n toTokenAddress: Address\n toAmountBaseUnit: string\n checkoutExpirationTimestampSeconds: string\n sponsorInitialTransferGasLimit: string\n refuel: string\n userId: string\n recipientAddr?: Address\n}\n\nexport type CheckoutQuoteParams = Omit<\n CheckoutApiQuoteParams,\n 'toAmountBaseUnit' | 'checkoutExpirationTimestampSeconds' | 'refuel'\n> & {\n fromTokenDecimals: number\n toTokenDecimals: number\n toTokenAmount: number\n expirationTimestampMs: number\n needsRefuel: boolean\n apiKey: string\n signal?: AbortSignal\n}\n\n// The response of the actual /checkout/quote api\nexport type CheckoutApiQuoteResponse = {\n quoteId: string\n estTotalFromAmountBaseUnit: string\n estSubtotalFromAmountBaseUnit: string\n estFeesFromAmountBaseUnit: string\n fromTokenAddress: Address\n estFeesUsd: number\n estSubtotalUsd: number\n estTotalUsd: number\n estCheckoutTimeMs: number\n estMarketMakerGasUsd: number\n lpFeePercentage: number\n lpFeeUsd: number\n}\n\n// The formatted response quote interface from the core sdk\nexport type CheckoutQuoteResponse = CheckoutApiQuoteResponse & {\n estTotalFromAmount: string\n estSubtotalFromAmount: string\n estFeesFromAmount: string\n}\n\n/**===============*\n * CHECKOUT INIT *\n *================*/\n\nexport type CheckoutApiInitParams = {\n userOp?: UserOperation\n quoteId: string\n sourceOfFund: string\n salt: Hex\n // TODO: Proper typing wrt _generateClientMetadata() logic\n clientMetadata: object\n}\n\nexport type CheckoutInitParams = Omit<CheckoutApiInitParams, 'salt'> & {\n apiKey: string\n}\n\nexport type CheckoutInitResponse = Address\n\n/**=====================*\n * CHECKOUT DEACTIVATE *\n *======================*/\n\nexport type CheckoutDeactivateParams = {\n depositAddress: Address\n apiKey: string\n}\n\n// Reference from api server: https://github.com/fun-xyz/fun-api-server/blob/main/src/tables/FunWalletCheckout.ts#L11C1-L21C2\nexport enum CheckoutState {\n // In-progress States\n FROM_UNFUNDED = 'FROM_UNFUNDED',\n FROM_FUNDED = 'FROM_FUNDED',\n FROM_POOLED = 'FROM_POOLED',\n TO_UNFUNDED = 'TO_UNFUNDED',\n TO_FUNDED = 'TO_FUNDED',\n TO_POOLED = 'TO_POOLED',\n TO_READY = 'TO_READY',\n PENDING_RECEIVAL = 'PENDING_RECEIVAL',\n // Terminal States\n COMPLETED = 'COMPLETED',\n CHECKOUT_ERROR = 'CHECKOUT_ERROR',\n EXPIRED = 'EXPIRED',\n CANCELLED = 'CANCELLED',\n}\n\nexport type CheckoutRefundState =\n | 'REFUNDED'\n | 'PROCEEDED'\n | 'INITIATED'\n | 'ERROR'\n\nexport type CheckoutHistoryItem = {\n createdTimeMs: number\n depositAddr: Address\n currentDepositAddr: Address\n recipientAddr: Address\n expirationTimestampSeconds: number\n fromAmountBaseUnit: string\n fromChainId: string\n fromTokenAddress: Address\n funWalletAddr: Address\n lastUpdatedTimeMs: number\n salt: Hex\n state: CheckoutState\n toAmountBaseUnit: string\n toChainId: string\n toTokenAddress: Address\n userOp: UserOperation\n version: number\n sourceOfFund: string\n // TODO: Proper typing wrt _generateClientMetadata() logic\n clientMetadata: object\n refundState?: CheckoutRefundState\n // Note: Optional, because BE does not retroactively update existing CheckoutHistoryItem entries\n stateTimestampMs?: Partial<Record<CheckoutState, number>>\n}\n\n/**===============================*\n * CHECKOUT TRANSFER SPONSORSHIP *\n *================================*/\n\nexport type CheckoutTransferSponsorshipParams = {\n transferUserOp: UserOperation\n depositAddress: Address\n apiKey: string\n}\n\nexport type CheckoutTransferSponsorshipApiParams = {\n userOp: UserOperation\n depositAddress: Address\n}\n\nexport type CheckoutTransferSponsorshipResponse = {\n signerAddress: Address\n signature: Hex\n deadline: number\n paymasterAndData: Hex\n}\n\n/**===============================*\n * RISK ASSESSMENT *\n *================================*/\n\nexport type RiskAssessmentParams = {\n address: Address | `dydx${string}`\n apiKey: string\n}\n\ntype AddressIdentification = {\n name: string\n address: Address | `dydx${string}`\n category: string\n description: string\n url: string | null\n createdAt: number\n}\n\ntype Cluster = {\n name: string\n category: string\n}\n\nexport type RiskValues = 'Severe' | 'High' | 'Medium' | 'Low'\n\ntype ExposureType = 'direct' | 'indirect'\n\ntype Exposure = {\n category: string\n value: number\n exposureType: ExposureType\n direction: string\n}\n\ntype RiskTrigger = {\n risk: string\n minThreshold: number\n maxThreshold: number\n exposureType: string\n direction: string\n}\n\ntype Trigger = {\n category: string\n percentage: number\n message: string\n ruleTriggered?: RiskTrigger\n}\n\ntype PoolMetadata = {\n fees?: number\n tokens: string[]\n}\n\n// fun.xyz uses `dydx${address}` for dydx addresses as VIP addr :/\nexport type FunAddress = Address | `dydx${string}`\n\nexport type RiskAssessmentResponse = {\n address: FunAddress\n risk: RiskValues\n riskReason: string | null\n cluster?: Cluster\n addressType: string\n addressIdentifications: AddressIdentification[]\n exposures: Exposure[]\n triggers: Trigger[]\n status: string\n poolMetadata: PoolMetadata\n}\n\nexport type CheckoutInitTokenTransferAddressParams = {\n apiKey: string\n toChainId: string\n toTokenAddress: Address\n userId: string\n clientMetadata: NonNullable<object>\n sourceOfFund?: string\n recipientAddr: string\n}\n\nexport type CheckoutInitTokenTransferAddressResponse = CheckoutInitResponse\n\nexport interface ApiBaseCheckoutFees {\n paymentMethod: string\n marketMakerFeeUsd: number\n liquidityProviderFeeUsd: number\n totalFeesUsd: number\n totalFeesTokenWithoutGas: number\n}\n\nexport interface ApiWalletCheckoutFees extends ApiBaseCheckoutFees {\n paymentMethod: 'balance'\n eoaWalletFeeToken: number\n nativeCurrencySymbol: string\n eoaWalletFeeUsd: number\n}\n\nexport interface ApiCardCheckoutFees extends ApiBaseCheckoutFees {\n paymentMethod: 'card'\n cardProcessingFeeUsd: number\n moonpayCostUsd: number\n}\n\nexport interface ApiBrokerageCheckoutFees extends ApiBaseCheckoutFees {\n paymentMethod: 'brokerage'\n exchangeFeeUsd: number\n meshCostUsd: number\n}\n\nexport type ApiCheckoutFees =\n | ApiWalletCheckoutFees\n | ApiCardCheckoutFees\n | ApiBrokerageCheckoutFees\n\nexport type ApiFunkitCheckoutQuoteResult = {\n baseQuote: CheckoutQuoteResponse\n finalTimeEstimationMs: number\n finalPaymentTokenAmount: string\n finalPaymentFeeUsd: string\n finalTotalUsd: string\n finalFeesBreakdown: ApiCheckoutFees\n}\n\nexport interface ApiFunkitCheckoutConfig {\n /** ****************************\n * Api-related configurations *\n ******************************/\n\n /** The ID of the chain where the checkout operation is to be performed. **/\n targetChain: string\n /** The wanted asset for the checkout operation. This can be either a chain native token (by specifying NATIVE_TOKEN) or an ERC-20 token (by specifying actual token address) on the target chain. **/\n targetAsset: Address\n /** The amount of wanted asset for the checkout operation (defaults to $100 equivalent). **/\n targetAssetAmount?: number\n /** The ticker information of the wanted asset for the checkout operation. e.g. USDC. **/\n targetAssetTicker: string\n /** Timestamp (in milliseconds) after which the checkout should not be performed, and the funds will become rescuable. Min: 300000 (5 mins), Max: 3600000 (1 hour). **/\n expirationTimestampMs: number\n /** Custom recipient address of the checkout. If specified, a different checkout flow will be executed. It is not recommended to set this unless the Fun.xyz team advises it. **/\n customRecipient?: Address | string\n /** List of contract action params **/\n generateActionsParams?: string\n}\n\nexport interface ApiSelectedPaymentMethodInfo {\n paymentMethod: string\n title: string\n description: string\n meta?: object\n}\n\nexport interface ApiCheckoutClientMetadata {\n /** Unique identifier for frontend use only. */\n id: string\n /** Time of creation of the active checkout item. For frontend use only. **/\n startTimestampMs: number\n /** The final dollar value of the checkout. Derived from latestQuote. **/\n finalDollarValue: null | number\n latestQuote: ApiFunkitCheckoutQuoteResult | null\n depositAddress: null | Address\n initSettings: {\n config: ApiFunkitCheckoutConfig\n }\n selectedPaymentMethodInfo: ApiSelectedPaymentMethodInfo | null\n selectedSourceAssetInfo: {\n address: Address | null\n symbol: string | null\n chainId: string\n iconSrc: string | null\n }\n}\n", "import { FUN_FAUCET_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport type { GetAssetFromFaucetRequest } from './types'\n\nexport async function getAssetFromFaucet({\n token,\n chain,\n walletAddress,\n apiKey,\n}: GetAssetFromFaucetRequest) {\n return await sendGetRequest({\n uri: `${FUN_FAUCET_URL}/get-faucet?token=${token}&testnet=${chain}&addr=${walletAddress}`,\n apiKey,\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport type {\n GetCryptocurrencyHoldingsRequest,\n GetLinkTokenRequest,\n GetLinkTokenResponse,\n GetTransferIntegrationsRequest,\n GetTransferIntegrationsResponse,\n MeshExecuteTransferRequest,\n MeshExecuteTransferResponse,\n PreviewTransferRequest,\n PreviewTransferResponse,\n} from './types'\n\n/**\n * @param authToken The authentication token to send the asset from.\n * @param type The type of the integration to send the asset from.\n * @return https://docs.meshconnect.com/api-reference/portfolio/get-holdings\n */\nexport async function meshGetCryptocurrencyHoldings({\n authToken,\n type,\n apiKey,\n}: GetCryptocurrencyHoldingsRequest): Promise<any> {\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/holdings/get`,\n body: { authToken, type },\n apiKey,\n })\n return res\n}\n\n/**\n * @return https://docs.meshconnect.com/api-reference/managed-transfers/get-integrations\n */\nexport async function meshGetTransferIntegrations({\n apiKey,\n}: GetTransferIntegrationsRequest): Promise<GetTransferIntegrationsResponse> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/integrations`,\n apiKey,\n })\n return res\n}\n\n/**\n * @param userId A unique Id representing the end user. Typically this will be a user Id from the\nclient application. Personally identifiable information, such as an email address or phone number,\nshould not be used. 50 characters length maximum.\n * @param integrationId A unique identifier representing a specific integration obtained from the list of available integrations.\n * @param restrictMultipleAccounts The final screen of Link allows users to \u201Ccontinue\u201D back to your app or \u201CLink another account.\u201D\nIf this param is present then this button will be hidden.\n * @param transferOptions Encapsulates transaction-related parameters, including destination addresses and the amount to transfer in fiat currency.\n * @return https://docs.meshconnect.com/api-reference/managed-account-authentication/get-link-token-with-parameters\n */\nexport async function meshGetLinkToken({\n userId,\n integrationId,\n restrictMultipleAccounts,\n transferOptions,\n apiKey,\n}: GetLinkTokenRequest): Promise<GetLinkTokenResponse> {\n let body: any = { userId }\n if (integrationId) {\n body = { ...body, integrationId }\n }\n if (restrictMultipleAccounts) {\n body = { ...body, restrictMultipleAccounts }\n }\n if (transferOptions) {\n body = { ...body, transferOptions }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/linktoken`,\n body,\n apiKey,\n })\n return res\n}\n\n/**\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param toAuthToken The authentication token of the target integration. Can be used alternatively to the address in the ToAddress field. If used, toType should also be provided.\n * @param toType The type of the target integration to send assets to. Used along with the toAuthToken alternatively to ToAddress.\n * @param networkId The network to send the asset over. This is generated by Mesh, it isn't a chainId or chain name.\n * @param symbol The symbol of the digital asset to send.\n * @param toAddress The target address to send the asset to.\n * @param amount The amount to send, in crypto.\n * @param amountInFiat The amount to send, in fiat currency. Can be used alternatively to Amount.\n * @param fiatCurrency Fiat currency that is to get corresponding converted fiat values of transfer and fee amounts. If not provided, defaults to USD.\n * @returns https://docs.meshconnect.com/api-reference/managed-transfers/preview-transfer\n */\nexport async function meshPreviewTransfer({\n fromAuthToken,\n fromType,\n toAuthToken,\n toType,\n networkId,\n symbol,\n toAddress,\n amount,\n amountInFiat,\n fiatCurrency,\n apiKey,\n}: PreviewTransferRequest): Promise<PreviewTransferResponse> {\n let body: any = { fromAuthToken, fromType }\n if (toAuthToken) {\n body = { ...body, toAuthToken }\n }\n if (toType) {\n body = { ...body, toType }\n }\n if (networkId) {\n body = { ...body, networkId }\n }\n if (symbol) {\n body = { ...body, symbol }\n }\n if (toAddress) {\n body = { ...body, toAddress }\n }\n if (amount) {\n body = { ...body, amount }\n }\n if (amountInFiat) {\n body = { ...body, amountInFiat }\n }\n if (fiatCurrency) {\n body = { ...body, fiatCurrency }\n }\n\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/preview`,\n body,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n/**\n *\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param previewId The preview ID of the transfer to execute.\n * @param mfaCode Multi-factor auth code that should be provided if the status of the transfer was MfaRequired.\n * @returns https://docs.meshconnect.com/api-reference/managed-transfers/execute-transfer\n */\nexport async function meshExecuteTransfer({\n fromAuthToken,\n fromType,\n previewId,\n mfaCode,\n apiKey,\n}: MeshExecuteTransferRequest): Promise<MeshExecuteTransferResponse> {\n let body: any = { fromAuthToken, fromType, previewId }\n if (mfaCode) {\n body = { ...body, mfaCode }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/execute`,\n body,\n apiKey,\n })\n return res\n}\n", "export interface GetCryptocurrencyHoldingsRequest {\n authToken: string\n type: string\n apiKey: string\n}\n\nexport interface GetTransferIntegrationsRequest {\n apiKey: string\n}\n\nexport interface IntegrationNetworkInfo {\n chainId: string\n id: string\n logoUrl: string\n name: string\n nativeSymbol: string\n supportedTokens: string[]\n}\n\nexport interface TransferIntegration {\n networks: IntegrationNetworkInfo[]\n supportsIncomingTransfers: boolean\n supportsOutgoingTransfers: boolean\n type: string\n}\n\nexport interface GetTransferIntegrationsResponse {\n integrations: TransferIntegration[]\n}\n\nexport interface GetLinkTokenRequest {\n userId: string\n integrationId?: string | null\n restrictMultipleAccounts?: boolean\n transferOptions?: any | null\n apiKey: string\n}\n\nexport interface GetLinkTokenResponse {\n linkToken: string\n}\n\nexport interface PreviewTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n toAuthToken?: string | null\n toType?: string | null\n networkId?: string\n symbol?: string | null\n toAddress?: string | null\n amount?: string | null\n amountInFiat?: string | null\n fiatCurrency?: string | null\n}\n\nexport interface MeshExecuteTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n previewId: string\n mfaCode?: string | null\n}\n\n// Reference: https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-execute\nexport enum MeshExecuteTransferStatus {\n succeeded = 'succeeded',\n failed = 'failed',\n mfaRequired = 'mfaRequired',\n emailConfirmationRequired = 'emailConfirmationRequired',\n emailConfirmationApprovalRequired = 'emailConfirmationApprovalRequired',\n deviceConfirmationRequired = 'deviceConfirmationRequired',\n mfaFailed = 'mfaFailed',\n addressWhitelistRequired = 'addressWhitelistRequired',\n secondMfaRequired = 'secondMfaRequired',\n}\n\nexport enum MeshExecuteTransferMfaType {\n unspecified = 'unspecified',\n phone = 'phone',\n email = 'email',\n otp = 'otp',\n}\n\nexport interface MeshExecuteTransferContent {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n\nexport interface MeshExecuteTransferResponse {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n\nexport interface MeshCryptoCurrencyPosition {\n symbol: string\n amount: number\n}\n\nexport interface GetCryptocurrencyHoldingsResponse {\n cryptocurrencyPositions: MeshCryptoCurrencyPosition[]\n}\n\n/*\nhttps://docs.meshconnect.com/api-reference/managed-transfers/preview-transfer\n */\nexport interface PreviewTransferResponse {\n /** The status of the operation. */\n status: 'succeeded' | 'failed' | 'requiresFunding'\n /** Error message, if the operation did not complete successfully. */\n errorMessage: string | null\n /** Result of the preview. */\n previewResult: PreviewTransferResult | null\n transferBalanceFundingAvailability: TransferBalanceFundingAvailability | null\n}\n\nexport interface PreviewTransferResult {\n previewId: string\n previewExpiresIn: number\n fromAddress: string | null\n toAddress: string | null\n addressTag: string | null\n symbol: string | null\n amount: number\n amountInFiat: number\n totalEstimatedAmount: number\n totalEstimatedAmountInFiat: number\n networkId: string\n networkName: string | null\n contractAddress: string | null\n institutionTransferFee: TransferFee | null\n estimatedNetworkGasFee: TransferFee | null\n decimalPlaces: number | null\n unitPrice: number\n clientTransactionId: string | null\n clientFee: number | null\n customClientFee: TransferFee | null\n processingFeeRetainMethod: ProcessingFeeRetainMethod | null\n transferType: TransferTypeEnum | null\n isCustomClientFeeProvided: boolean\n amountWithCustomClientFee: number\n isFeeIncluded: boolean\n amountToReceive: number\n amountToReceiveInFiat: number\n transferAmountToRequest: number\n}\n\nexport interface TransferFee {\n fee: number\n feeCurrency: string | null\n feeInFiat: number\n}\n\nexport interface ProcessingFeeRetainMethod {\n type: 'default' | 'smartDeposit'\n processingFeeAddress: string | null\n}\n\nexport type TransferTypeEnum = 'deposit' | 'payment' | 'onramp'\n\nexport interface TransferBalanceFundingAvailability {\n status:\n | 'disabled'\n | 'available'\n | 'requiresAmountLowering'\n | 'notApplicable'\n | 'unavailable'\n transferTotalAmount: number\n unitPrice: number\n gasFeeBuffer: TransferFee | null\n symbol: string | null\n transferTotalAmountInFiat: number\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { ErrorCode, InternalFailureError } from '../../errors'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport type {\n GetMoonpayBuyQuoteForCreditCardRequest,\n GetMoonpayBuyQuoteForCreditCardResponse,\n GetMoonpayOffRampUrlRequest,\n GetMoonpayOnRampUrlRequest,\n GetMoonpayUrlSignatureRequest,\n MoonpayCurrency,\n} from './types'\n\nexport async function getMoonpayUrlSignature({\n url,\n isSandbox,\n apiKey,\n}: GetMoonpayUrlSignatureRequest): Promise<string> {\n const signature = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-signature/`,\n body: { url, isSandbox },\n apiKey,\n })\n if (!signature || !signature?.url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No onramp url found.',\n '',\n { url },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return signature.url\n}\n\nexport async function getMoonpayBuyQuoteForCreditCard({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n baseCurrencyAmount,\n extraFeePercentage,\n areFeesIncluded,\n apiKey,\n}: GetMoonpayBuyQuoteForCreditCardRequest): Promise<GetMoonpayBuyQuoteForCreditCardResponse> {\n const params = new URLSearchParams({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n paymentMethod: 'credit_debit_card',\n ...(baseCurrencyAmount == null\n ? {}\n : { baseCurrencyAmount: baseCurrencyAmount.toString() }),\n ...(extraFeePercentage == null\n ? {}\n : { extraFeePercentage: extraFeePercentage.toString() }),\n ...(areFeesIncluded == null\n ? {}\n : { areFeesIncluded: areFeesIncluded.toString() }),\n }).toString()\n\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-buy-quote?${params}`,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n\n/**=======================\n * POTENTIAL DEPRECATION\n *=======================*/\n\nexport async function getMoonpayOnRampUrl({\n apiKey,\n walletAddr,\n currencyCode,\n}: GetMoonpayOnRampUrlRequest): Promise<string> {\n const endpoint = `on-ramp/${walletAddr}?provider=moonpay`\n if (currencyCode) {\n endpoint.concat(`&currencyCode=${currencyCode}`)\n }\n const url: string = (\n await sendGetRequest({\n uri: `${API_BASE_URL}/${endpoint}`,\n apiKey,\n })\n )?.url\n if (!url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No onramp url found.',\n '',\n { walletAddr },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return url\n}\n\nexport async function getMoonpayOffRampUrl({\n walletAddr,\n apiKey,\n}: GetMoonpayOffRampUrlRequest): Promise<string> {\n const url: string = (\n await sendGetRequest({\n uri: `${API_BASE_URL}/off-ramp/${walletAddr}?provider=moonpay`,\n apiKey,\n })\n )?.url\n if (!url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No offramp url found.',\n '',\n { walletAddr },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return url\n}\n\nexport async function getMoonpayOnRampSupportedCurrencies({\n apiKey,\n}: {\n apiKey: string\n}): Promise<MoonpayCurrency[]> {\n const currencies: MoonpayCurrency[] = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-currencies`,\n apiKey,\n })\n if (!currencies || !currencies.length) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No supported currencies found.',\n '',\n {},\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return currencies\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport type {\n CreateStripeBuySessionBody,\n CreateStripeBuySessionResponse,\n GetStripeBuyQuoteRequest,\n GetStripeBuyQuoteResponse,\n} from './types'\n\nexport async function getStripeBuyQuote({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n isSandbox,\n apiKey,\n}: GetStripeBuyQuoteRequest): Promise<GetStripeBuyQuoteResponse> {\n const params = new URLSearchParams({\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrencies: destinationCurrency,\n // Only allow one network in this SDK\n destinationNetworks: destinationNetwork,\n }).toString()\n const buyQuoteResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-buy-quote?${params}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buyQuoteResp as GetStripeBuyQuoteResponse\n}\n\nexport async function createStripeBuySession({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n walletAddress,\n customerIpAddress,\n isSandbox,\n apiKey,\n}: CreateStripeBuySessionBody): Promise<CreateStripeBuySessionResponse> {\n const body = {\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrency,\n destinationCurrencies: [destinationCurrency],\n // Only allow one network in this SDK\n destinationNetwork,\n destinationNetworks: [destinationNetwork],\n // Only allow one wallet address in this SDK, and it must correspond to the destination network\n walletAddresses: {\n [destinationNetwork]: walletAddress,\n },\n ...(customerIpAddress ? { customerIpAddress } : {}),\n }\n const newBuySessionResp = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout`,\n body,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return newBuySessionResp as CreateStripeBuySessionResponse\n}\n\nexport async function getStripeBuySession({\n sessionId,\n apiKey,\n}: {\n sessionId: string\n apiKey: string\n}): Promise<CreateStripeBuySessionResponse> {\n const buySessionResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout-session/${sessionId}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buySessionResp as CreateStripeBuySessionResponse\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendPostRequest } from '../../utils'\nimport type { SendSupportMessageRequest } from './types'\n\nexport async function sendSupportMessage({\n title,\n description,\n userEmail,\n apiKey,\n}: SendSupportMessageRequest): Promise<boolean> {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/support/send-message`,\n body: { title, description, userEmail },\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return true\n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;;AC9EA,eAAsB,mBAAmB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgD;AAC9C,MAAI;AACF,UAAM,gBAAgB;AAAA,MACpB,KAAK,GAAG,YAAY;AAAA,MACpB,MAAM,EAAE,OAAO,aAAa,UAAU;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,aAAa,EAAE;AAAA,IACjC,CAAC;AACD,WAAO;AAAA,EACT,SAAS,MAAM;AACb,WAAO;AAAA,EACT;AACF;",
6
- "names": ["ErrorBaseType", "ErrorType", "ErrorCode", "toHex", "toHex", "CheckoutState", "MeshExecuteTransferStatus", "MeshExecuteTransferMfaType"]
3
+ "sources": ["../src/consts/api.ts", "../src/utils/error.ts", "../src/consts/retry.ts", "../src/utils/checkout.ts", "../src/utils/request.ts", "../src/services/assets/endpoints.ts", "../src/services/checkout/endpoints.ts", "../src/services/checkout/types.ts", "../src/services/faucet/endpoints.ts", "../src/services/mesh/endpoints.ts", "../src/services/mesh/types.ts", "../src/services/moonpay/endpoints.ts", "../src/services/stripe/endpoints.ts", "../src/services/support/endpoints.ts"],
4
+ "sourcesContent": ["export const API_BASE_URL =\n process.env.NODE_ENV === 'staging'\n ? 'https://api.fun.xyz/staging/v1'\n : process.env.NODE_ENV === 'testing'\n ? 'https://api.fun.xyz/testing/v1'\n : process.env.NODE_ENV === 'local'\n ? 'http://127.0.0.1:3000'\n : // Production\n 'https://api.fun.xyz/v1'\n\nexport const FUN_FAUCET_URL = 'https://api.fun.xyz/demo-faucet'\n", "import {\n InvalidParameterError,\n ResourceNotFoundError,\n UserOpFailureError,\n} from '@funkit/utils'\n\nexport const errorAbortHandler = (err: any, context: any) => {\n if (\n err instanceof ResourceNotFoundError ||\n err instanceof InvalidParameterError ||\n err instanceof UserOpFailureError\n ) {\n context.abort()\n }\n}\n", "import type { PartialAttemptOptions } from '@lifeomic/attempt'\n\nimport { errorAbortHandler } from '../utils/error'\n\nexport type BaseResponse = any // TODO:\n\nexport type RetryOptions = PartialAttemptOptions<BaseResponse>\n\nexport const DEFAULT_RETRY_OPTIONS = {\n delay: 100,\n initialDelay: 0,\n maxDelay: 3000,\n factor: 2,\n maxAttempts: 5,\n timeout: 0,\n jitter: true,\n minDelay: 0,\n handleError: errorAbortHandler,\n handleTimeout: null,\n beforeAttempt: null,\n calculateDelay: null,\n} as RetryOptions\n", "import { toHex } from 'viem'\n\nexport function randomBytes(length: number) {\n const bytes = new Uint8Array(length)\n for (let i = 0; i < length; i++) {\n bytes[i] = Math.floor(Math.random() * 256)\n }\n return toHex(bytes)\n}\n\nexport function generateRandomCheckoutSalt() {\n return toHex(BigInt(randomBytes(32)))\n}\n\nexport function roundToNearestBottomTenth(n: number) {\n return Math.floor(n / 10) * 10\n}\n", "import { retry } from '@lifeomic/attempt'\nimport { toHex } from 'viem'\n\nimport type { BaseRequest } from '../consts/request'\nimport {\n type BaseResponse,\n DEFAULT_RETRY_OPTIONS,\n type RetryOptions,\n} from '../consts/retry'\n\nimport {\n AccessDeniedError,\n ErrorCode,\n InternalFailureError,\n InvalidParameterError,\n ResourceNotFoundError,\n ThrottlingError,\n UserOpFailureError,\n} from '@funkit/utils'\nimport type {\n DeleteRequest,\n GetRequest,\n PostRequest,\n PutRequest,\n} from './../consts/request'\n\nconst stringifyWithBigIntSanitization = (object: any) => {\n return JSON.stringify(\n object,\n (_, value) => (typeof value === 'bigint' ? toHex(value) : value), // return everything else unchanged\n )\n}\n\ntype RequestError = {\n errorMsg: string\n errorCode: string\n}\n\nexport const sendRequest = async ({\n uri,\n method,\n apiKey,\n body = {},\n retryOptions = {},\n signal,\n}: BaseRequest): Promise<BaseResponse> => {\n try {\n const headers = {\n 'Content-Type': 'application/json',\n ...(apiKey ? { 'X-Api-Key': apiKey } : {}),\n }\n\n const finalRetryOptions = {\n ...DEFAULT_RETRY_OPTIONS,\n ...(retryOptions || {}),\n } as RetryOptions\n\n return retry(async () => {\n const response = await fetch(uri, {\n method,\n headers,\n redirect: 'follow',\n signal,\n body:\n method !== 'GET' ? stringifyWithBigIntSanitization(body) : undefined,\n })\n const json = await response.json()\n\n if (response.ok) {\n return json\n }\n\n const { errorMsg, errorCode } = json as RequestError\n\n if (response.status === 400) {\n throw new InvalidParameterError(\n ErrorCode.InvalidParameter,\n `bad request ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n }\n if (response.status === 403) {\n throw new AccessDeniedError(\n ErrorCode.Unauthorized,\n 'Invalid API key or insufficient access.',\n errorMsg,\n { apiKey },\n 'Check your api key at https://app.fun.xyz and check with fun team if you believe something is off',\n 'https://docs.fun.xyz',\n )\n }\n if (response.status === 404) {\n throw new ResourceNotFoundError(\n ErrorCode.ServerMissingData,\n JSON.stringify(json),\n errorMsg,\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n }\n if (response.status === 429) {\n throw new ThrottlingError(\n ErrorCode.RequestLimitExceeded,\n `too many requests ${JSON.stringify(json)}`,\n 'Too many requests',\n { body },\n 'you are making too many requests. please slow down. Reach out to fun team if you need more quota',\n 'https://docs.fun.xyz',\n )\n }\n if (response.status === 500) {\n if (errorCode === ErrorCode.UserOpFailureError) {\n throw new UserOpFailureError(\n ErrorCode.UserOpFailureError,\n `server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'fix user op failure. Most of the time this is due to invalid parameters',\n 'https://docs.fun.xyz',\n )\n }\n throw new InternalFailureError(\n ErrorCode.ServerFailure,\n `server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n if (response.status === 504) {\n throw new InternalFailureError(\n ErrorCode.ServerTimeout,\n `server timeout failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n if (!response.ok) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n `unknown server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n return {}\n }, finalRetryOptions)\n } catch (err) {\n throw new InternalFailureError(\n ErrorCode.ServerConnectionError,\n `Cannot connect to Fun API Service ${err}`,\n '',\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n}\n\nexport async function sendGetRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: GetRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n method: 'GET',\n })\n}\n\nexport async function sendPostRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PostRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'POST',\n })\n}\n\nexport async function sendDeleteRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: DeleteRequest): Promise<void> {\n await sendRequest({\n uri,\n method: 'DELETE',\n apiKey,\n retryOptions,\n signal,\n })\n}\n\nexport async function sendPutRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PutRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'PUT',\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport type {\n GetAllWalletNFTsByChainIdRequest,\n GetAllWalletNFTsByChainIdResponse,\n GetAllWalletNFTsRequest,\n GetAllWalletNFTsResponse,\n GetAllWalletTokensByChainIdRequest,\n GetAllWalletTokensByChainIdResponse,\n GetAllWalletTokensRequest,\n GetAllWalletTokensResponse,\n GetAllowedAssetsRequest,\n GetAllowedAssetsResponse,\n GetAssetPriceInfoRequest,\n GetAssetPriceInfoResponse,\n GetWalletLidoWithdrawalsByChainId,\n GetWalletLidoWithdrawalsByChainIdResponse,\n} from './types'\n\n/**===========================================================\n * REFERENCE CORE FILE: /packages/core/src/apis/AssetApis.ts\n * TODO: Remove this comment once migration is complete\n *===========================================================*/\n\n/**\n * Gets the estimated dollar unit price of a tokenAddress for checkout\n * @param chainId https://chainlist.org/ e.g. \"1\" for ethereum\n * @param assetTokenAddress tokenAddress of the asset on the given chain\n * @param apiKey\n */\nexport async function getAssetPriceInfo({\n chainId,\n assetTokenAddress,\n apiKey,\n}: GetAssetPriceInfoRequest): Promise<GetAssetPriceInfoResponse> {\n const priceInfo = await sendGetRequest({\n uri: `${API_BASE_URL}/asset/erc20/price/${chainId}/${assetTokenAddress}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n return priceInfo\n}\n\n/**\n * Get all tokens for a given wallet address\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n * @param signal AbortSignal to cancel the request when no longer needed\n */\nexport async function getAllWalletTokens({\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n signal,\n}: GetAllWalletTokensRequest): Promise<GetAllWalletTokensResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n signal,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**\n * Get all tokens for a given wallet address on a specific chain\n * @param chainId https://chainlist.org/\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n */\nexport async function getAllWalletTokensByChainId({\n chainId,\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n}: GetAllWalletTokensByChainIdRequest): Promise<GetAllWalletTokensByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}/${chainId}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**\n * Get list of assets that are allowed to be used for checkout\n * @param apiKey\n */\nexport async function getAllowedAssets({\n apiKey,\n}: GetAllowedAssetsRequest): Promise<GetAllowedAssetsResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/allow`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**=======================\n * POTENTIAL DEPRECATION\n *=======================*/\n\n/**\n * Get all the NFTs owned by a wallet\n * @param walletAddress\n * @param apiKey\n */\nexport async function getAllWalletNFTs({\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsRequest): Promise<GetAllWalletNFTsResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}`,\n apiKey,\n })\n}\n\n/**\n * Get all the NFTs owned by a wallet on a specific chain\n * @param chainId From https://chainlist.org/\n * @param walletAddress Address of holder\n * @param apiKey\n */\nexport async function getAllWalletNFTsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsByChainIdRequest): Promise<GetAllWalletNFTsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n\n/**\n * Get all lido withdrawal request ids for a wallet address on a specific chain\n * @param {string} chainId https://chainlist.org/ ie \"1\" for ethereum\n * @param {string} holderAddr Address of holder\n * @returns [readyToWithdrawRequestIds, notReadyToWithdrawRequestIds]\n */\nexport async function getWalletLidoWithdrawalsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetWalletLidoWithdrawalsByChainId): Promise<GetWalletLidoWithdrawalsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/lido-withdrawals/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n", "import Big from 'big.js'\nimport type { Address } from 'viem'\n\nimport { ErrorCode, ResourceNotFoundError } from '@funkit/utils'\nimport { API_BASE_URL } from '../../consts'\nimport {\n generateRandomCheckoutSalt,\n roundToNearestBottomTenth,\n sendGetRequest,\n sendPostRequest,\n} from '../../utils'\nimport {\n type CheckoutApiInitParams,\n type CheckoutApiQuoteParams,\n type CheckoutApiQuoteResponse,\n type CheckoutDeactivateParams,\n type CheckoutHistoryItem,\n type CheckoutInitParams,\n type CheckoutInitResponse,\n type CheckoutInitTokenTransferAddressParams,\n type CheckoutQuoteParams,\n type CheckoutQuoteResponse,\n CheckoutState,\n type CheckoutTransferSponsorshipApiParams,\n type CheckoutTransferSponsorshipParams,\n type CheckoutTransferSponsorshipResponse,\n type RiskAssessmentParams,\n type RiskAssessmentResponse,\n} from './types'\n\n/**\n * Gets a checkout quote (estimation).\n * @param fromChainId The ID of the chain where funds will be provided from.\n * @param fromTokenAddress The asset to fund the checkout. This must be either a chain native token or an ERC-20, on the fromChainId.\n * @param fromTokenDecimals The number of decimals for the fromTokenAddress.\n * @param toChainId The ID of the chain where the checkout operation is to be performed.\n * @param toTokenAddress The wanted asset for the checkout operation. This must be either a chain native token or an ERC-20, on the target chain.\n * @param toTokenAmount The amount of wanted asset for the checkout operation in base units.\n * @param toTokenDecimals The number of decimals for the toTokenAddress.\n * @param expirationTimestampMs The amount of time (duration) from now before the checkout operation expires.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @return {Promise<CheckoutCoreQuoteResponse>} The formatted quote object\n */\nexport async function getCheckoutQuote({\n fromChainId,\n fromTokenAddress,\n fromTokenDecimals,\n toChainId,\n toTokenAddress,\n toTokenDecimals,\n toTokenAmount,\n expirationTimestampMs,\n sponsorInitialTransferGasLimit,\n recipientAddr,\n needsRefuel,\n userId,\n apiKey,\n signal,\n}: CheckoutQuoteParams): Promise<CheckoutQuoteResponse> {\n try {\n const toMultipler = 10 ** toTokenDecimals\n const toAmountBaseUnitBI = BigInt(Math.floor(toTokenAmount * toMultipler))\n const queryParams: CheckoutApiQuoteParams = {\n userId,\n fromChainId,\n fromTokenAddress,\n toChainId,\n toTokenAddress,\n toAmountBaseUnit: toAmountBaseUnitBI.toString(),\n // Only pass in recipientAddr if specified\n ...(recipientAddr ? { recipientAddr } : {}),\n // Rounding nearest tenth second (instead of seconds) to better support backend quote caching feature\n // Reference: https://vintage-heaven-3cd.notion.site/API-Gateway-Caching-and-Pre-Warming-System-Draft-ee7909d9b85f43c793ce7bd2607bec02?pvs=4\n // Note: Rounding *down* instead of a regular round to safeguard against edge case of timing passing frontend range validation but failing backend range validation\n checkoutExpirationTimestampSeconds: roundToNearestBottomTenth(\n Math.round((Date.now() + expirationTimestampMs) / 1000),\n ).toString(),\n sponsorInitialTransferGasLimit,\n // @deprecated Not in use\n refuel: needsRefuel.toString(),\n }\n\n const searchParams = new URLSearchParams(queryParams)\n const quoteRes = (await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/quote?${searchParams}`,\n apiKey,\n signal,\n })) as CheckoutApiQuoteResponse\n\n const fromMultipler = 10 ** fromTokenDecimals\n // Format the response for frontend usage\n return {\n quoteId: quoteRes.quoteId,\n fromTokenAddress: quoteRes.fromTokenAddress,\n estFeesUsd: quoteRes.estFeesUsd,\n estSubtotalUsd: quoteRes.estSubtotalUsd,\n estTotalUsd: quoteRes.estTotalUsd,\n estCheckoutTimeMs: quoteRes.estCheckoutTimeMs,\n estTotalFromAmountBaseUnit: quoteRes.estTotalFromAmountBaseUnit,\n estSubtotalFromAmountBaseUnit: quoteRes.estSubtotalFromAmountBaseUnit,\n estFeesFromAmountBaseUnit: quoteRes.estFeesFromAmountBaseUnit,\n estMarketMakerGasUsd: quoteRes.estMarketMakerGasUsd,\n lpFeePercentage: quoteRes.lpFeePercentage,\n lpFeeUsd: quoteRes.lpFeeUsd,\n // Added fields\n estFeesFromAmount: new Big(quoteRes.estFeesFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estSubtotalFromAmount: new Big(quoteRes.estSubtotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estTotalFromAmount: new Big(quoteRes.estTotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n }\n } catch (err: any) {\n throw new Error(\n `An error occured trying to generate a checkout quote: ${err.message}`,\n )\n }\n}\n\n/**\n * Initializes a checkout\n * @param userOp The checkout UserOp, signed.\n * @param quoteId The quoteId specific to the checkout.\n * @param apiKey A valid fun api key.\n * @return {Address} The generated deposit address\n */\nexport async function initializeCheckout({\n userOp,\n quoteId,\n sourceOfFund,\n apiKey,\n clientMetadata,\n}: CheckoutInitParams): Promise<Address> {\n const body = {\n ...(userOp ? { userOp } : {}),\n quoteId,\n sourceOfFund,\n salt: generateRandomCheckoutSalt(),\n clientMetadata,\n } as CheckoutApiInitParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout`,\n body,\n apiKey,\n })\n if (!res?.depositAddr) {\n throw new ResourceNotFoundError(\n ErrorCode.CheckoutInitDepositAddrNotFound,\n 'Unable to initialize checkout',\n 'Unable to initialize checkout',\n body,\n '',\n 'https://docs.fun.xyz',\n )\n }\n return res.depositAddr as CheckoutInitResponse\n}\n\nexport async function deactivateCheckout({\n depositAddress,\n apiKey,\n}: CheckoutDeactivateParams) {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/update/${depositAddress}`,\n body: {\n // Fixed state to cancel the checkout\n state: CheckoutState.CANCELLED,\n },\n apiKey,\n })\n return true\n } catch (_err) {\n throw new Error('Unable to deactivate checkout')\n }\n}\n\n/**\n * Gets a checkout given a depositAddress\n * @param depositAddress A unique deposit address associated with a backend checkout item.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns The checkout object if exists. Otherwise, null.\n */\nexport async function getCheckoutByDepositAddress({\n depositAddress,\n apiKey,\n signal,\n}: {\n depositAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem | null> {\n try {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/${depositAddress}`,\n apiKey,\n signal,\n })\n } catch (err) {\n if (err instanceof ResourceNotFoundError) {\n return null\n }\n throw err\n }\n}\n\n/**\n * Gets all checkouts associated with a funWallet\n * @param funWalletAddress A funWallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByFunWalletAddress({\n funWalletAddress,\n apiKey,\n signal,\n}: {\n funWalletAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/fun-wallet/${funWalletAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a recipient address\n * @param recipientAddress A wallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByRecipientAddress({\n recipientAddress,\n apiKey,\n signal,\n}: {\n recipientAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/recipient/${recipientAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a funkit userId string\n * @param userId A userId string.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByUserId({\n userId,\n apiKey,\n signal,\n}: {\n userId: string\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/userId/${userId}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\nexport async function getPaymasterDataForCheckoutSponsoredTransfer({\n depositAddress,\n transferUserOp,\n apiKey,\n}: CheckoutTransferSponsorshipParams): Promise<CheckoutTransferSponsorshipResponse> {\n const body = {\n depositAddress,\n userOp: transferUserOp,\n } as CheckoutTransferSponsorshipApiParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/sponsor-transfer`,\n body,\n apiKey,\n })\n if (!res) {\n // TODO: Better error handling\n throw new Error('Unable to get sponsorship information')\n }\n return res as CheckoutTransferSponsorshipResponse\n}\n\nexport async function getRiskAssessmentForAddress({\n address,\n apiKey,\n}: RiskAssessmentParams) {\n const response = (await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/risk-assessment?address=${address}`,\n apiKey,\n })) as RiskAssessmentResponse\n\n return response\n}\n\nexport async function initializeCheckoutTokenTransferAddress({\n apiKey,\n ...body\n}: CheckoutInitTokenTransferAddressParams): Promise<CheckoutInitResponse> {\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/eoa`,\n body,\n apiKey,\n })\n if (!res?.depositAddr) {\n throw new ResourceNotFoundError(\n ErrorCode.CheckoutInitDepositAddrNotFound,\n 'Unable to initialize checkout token transfer address',\n 'Unable to initialize checkout token transfer address',\n body,\n '',\n 'https://docs.fun.xyz',\n )\n }\n return res.depositAddr as CheckoutInitResponse\n}\n", "/**===============*\n * CHECKOUT QUOTE *\n *================*/\nimport type { Address, Hex } from 'viem'\n\n// TODO: Define the UserOperation type\ntype UserOperation = any\n\n// The params required for the actual /checkout/quote api\nexport type CheckoutApiQuoteParams = {\n fromChainId: string\n fromTokenAddress: Address\n toChainId: string\n toTokenAddress: Address\n toAmountBaseUnit: string\n checkoutExpirationTimestampSeconds: string\n sponsorInitialTransferGasLimit: string\n refuel: string\n userId: string\n recipientAddr?: Address\n}\n\nexport type CheckoutQuoteParams = Omit<\n CheckoutApiQuoteParams,\n 'toAmountBaseUnit' | 'checkoutExpirationTimestampSeconds' | 'refuel'\n> & {\n fromTokenDecimals: number\n toTokenDecimals: number\n toTokenAmount: number\n expirationTimestampMs: number\n needsRefuel: boolean\n apiKey: string\n signal?: AbortSignal\n}\n\n// The response of the actual /checkout/quote api\nexport type CheckoutApiQuoteResponse = {\n quoteId: string\n estTotalFromAmountBaseUnit: string\n estSubtotalFromAmountBaseUnit: string\n estFeesFromAmountBaseUnit: string\n fromTokenAddress: Address\n estFeesUsd: number\n estSubtotalUsd: number\n estTotalUsd: number\n estCheckoutTimeMs: number\n estMarketMakerGasUsd: number\n lpFeePercentage: number\n lpFeeUsd: number\n}\n\n// The formatted response quote interface from the core sdk\nexport type CheckoutQuoteResponse = CheckoutApiQuoteResponse & {\n estTotalFromAmount: string\n estSubtotalFromAmount: string\n estFeesFromAmount: string\n}\n\n/**===============*\n * CHECKOUT INIT *\n *================*/\n\nexport type CheckoutApiInitParams = {\n userOp?: UserOperation\n quoteId: string\n sourceOfFund: string\n salt: Hex\n // TODO: Proper typing wrt _generateClientMetadata() logic\n clientMetadata: object\n}\n\nexport type CheckoutInitParams = Omit<CheckoutApiInitParams, 'salt'> & {\n apiKey: string\n}\n\nexport type CheckoutInitResponse = Address\n\n/**=====================*\n * CHECKOUT DEACTIVATE *\n *======================*/\n\nexport type CheckoutDeactivateParams = {\n depositAddress: Address\n apiKey: string\n}\n\n// Reference from api server: https://github.com/fun-xyz/fun-api-server/blob/main/src/tables/FunWalletCheckout.ts#L11C1-L21C2\nexport enum CheckoutState {\n // In-progress States\n FROM_UNFUNDED = 'FROM_UNFUNDED',\n FROM_FUNDED = 'FROM_FUNDED',\n FROM_POOLED = 'FROM_POOLED',\n TO_UNFUNDED = 'TO_UNFUNDED',\n TO_FUNDED = 'TO_FUNDED',\n TO_POOLED = 'TO_POOLED',\n TO_READY = 'TO_READY',\n PENDING_RECEIVAL = 'PENDING_RECEIVAL',\n // Terminal States\n COMPLETED = 'COMPLETED',\n CHECKOUT_ERROR = 'CHECKOUT_ERROR',\n EXPIRED = 'EXPIRED',\n CANCELLED = 'CANCELLED',\n}\n\nexport type CheckoutRefundState =\n | 'REFUNDED'\n | 'PROCEEDED'\n | 'INITIATED'\n | 'ERROR'\n\nexport type CheckoutHistoryItem = {\n createdTimeMs: number\n depositAddr: Address\n currentDepositAddr: Address\n recipientAddr: Address\n expirationTimestampSeconds: number\n fromAmountBaseUnit: string\n fromChainId: string\n fromTokenAddress: Address\n funWalletAddr: Address\n lastUpdatedTimeMs: number\n salt: Hex\n state: CheckoutState\n toAmountBaseUnit: string\n toChainId: string\n toTokenAddress: Address\n userOp: UserOperation\n version: number\n sourceOfFund: string\n // TODO: Proper typing wrt _generateClientMetadata() logic\n clientMetadata: object\n refundState?: CheckoutRefundState\n // Note: Optional, because BE does not retroactively update existing CheckoutHistoryItem entries\n stateTimestampMs?: Partial<Record<CheckoutState, number>>\n}\n\n/**===============================*\n * CHECKOUT TRANSFER SPONSORSHIP *\n *================================*/\n\nexport type CheckoutTransferSponsorshipParams = {\n transferUserOp: UserOperation\n depositAddress: Address\n apiKey: string\n}\n\nexport type CheckoutTransferSponsorshipApiParams = {\n userOp: UserOperation\n depositAddress: Address\n}\n\nexport type CheckoutTransferSponsorshipResponse = {\n signerAddress: Address\n signature: Hex\n deadline: number\n paymasterAndData: Hex\n}\n\n/**===============================*\n * RISK ASSESSMENT *\n *================================*/\n\nexport type RiskAssessmentParams = {\n address: Address | `dydx${string}`\n apiKey: string\n}\n\ntype AddressIdentification = {\n name: string\n address: Address | `dydx${string}`\n category: string\n description: string\n url: string | null\n createdAt: number\n}\n\ntype Cluster = {\n name: string\n category: string\n}\n\nexport type RiskValues = 'Severe' | 'High' | 'Medium' | 'Low'\n\ntype ExposureType = 'direct' | 'indirect'\n\ntype Exposure = {\n category: string\n value: number\n exposureType: ExposureType\n direction: string\n}\n\ntype RiskTrigger = {\n risk: string\n minThreshold: number\n maxThreshold: number\n exposureType: string\n direction: string\n}\n\ntype Trigger = {\n category: string\n percentage: number\n message: string\n ruleTriggered?: RiskTrigger\n}\n\ntype PoolMetadata = {\n fees?: number\n tokens: string[]\n}\n\n// fun.xyz uses `dydx${address}` for dydx addresses as VIP addr :/\nexport type FunAddress = Address | `dydx${string}`\n\nexport type RiskAssessmentResponse = {\n address: FunAddress\n risk: RiskValues\n riskReason: string | null\n cluster?: Cluster\n addressType: string\n addressIdentifications: AddressIdentification[]\n exposures: Exposure[]\n triggers: Trigger[]\n status: string\n poolMetadata: PoolMetadata\n}\n\nexport type CheckoutInitTokenTransferAddressParams = {\n apiKey: string\n toChainId: string\n toTokenAddress: Address\n userId: string\n clientMetadata: NonNullable<object>\n sourceOfFund?: string\n recipientAddr: string\n}\n\nexport type CheckoutInitTokenTransferAddressResponse = CheckoutInitResponse\n\nexport interface ApiBaseCheckoutFees {\n paymentMethod: string\n marketMakerFeeUsd: number\n liquidityProviderFeeUsd: number\n totalFeesUsd: number\n totalFeesTokenWithoutGas: number\n}\n\nexport interface ApiWalletCheckoutFees extends ApiBaseCheckoutFees {\n paymentMethod: 'balance'\n eoaWalletFeeToken: number\n nativeCurrencySymbol: string\n eoaWalletFeeUsd: number\n}\n\nexport interface ApiCardCheckoutFees extends ApiBaseCheckoutFees {\n paymentMethod: 'card'\n cardProcessingFeeUsd: number\n moonpayCostUsd: number\n}\n\nexport interface ApiBrokerageCheckoutFees extends ApiBaseCheckoutFees {\n paymentMethod: 'brokerage'\n exchangeFeeUsd: number\n meshCostUsd: number\n}\n\nexport type ApiCheckoutFees =\n | ApiWalletCheckoutFees\n | ApiCardCheckoutFees\n | ApiBrokerageCheckoutFees\n\nexport type ApiFunkitCheckoutQuoteResult = {\n baseQuote: CheckoutQuoteResponse\n finalTimeEstimationMs: number\n finalPaymentTokenAmount: string\n finalPaymentFeeUsd: string\n finalTotalUsd: string\n finalFeesBreakdown: ApiCheckoutFees\n}\n\nexport interface ApiFunkitCheckoutConfig {\n /** ****************************\n * Api-related configurations *\n ******************************/\n\n /** The ID of the chain where the checkout operation is to be performed. **/\n targetChain: string\n /** The wanted asset for the checkout operation. This can be either a chain native token (by specifying NATIVE_TOKEN) or an ERC-20 token (by specifying actual token address) on the target chain. **/\n targetAsset: Address\n /** The amount of wanted asset for the checkout operation (defaults to $100 equivalent). **/\n targetAssetAmount?: number\n /** The ticker information of the wanted asset for the checkout operation. e.g. USDC. **/\n targetAssetTicker: string\n /** Timestamp (in milliseconds) after which the checkout should not be performed, and the funds will become rescuable. Min: 300000 (5 mins), Max: 3600000 (1 hour). **/\n expirationTimestampMs: number\n /** Custom recipient address of the checkout. If specified, a different checkout flow will be executed. It is not recommended to set this unless the Fun.xyz team advises it. **/\n customRecipient?: Address | string\n /** List of contract action params **/\n generateActionsParams?: string\n}\n\nexport interface ApiSelectedPaymentMethodInfo {\n paymentMethod: string\n title: string\n description: string\n meta?: object\n}\n\nexport interface ApiCheckoutClientMetadata {\n /** Unique identifier for frontend use only. */\n id: string\n /** Time of creation of the active checkout item. For frontend use only. **/\n startTimestampMs: number\n /** The final dollar value of the checkout. Derived from latestQuote. **/\n finalDollarValue: null | number\n latestQuote: ApiFunkitCheckoutQuoteResult | null\n depositAddress: null | Address\n initSettings: {\n config: ApiFunkitCheckoutConfig\n }\n selectedPaymentMethodInfo: ApiSelectedPaymentMethodInfo | null\n selectedSourceAssetInfo: {\n address: Address | null\n symbol: string | null\n chainId: string\n iconSrc: string | null\n }\n}\n", "import { FUN_FAUCET_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport type { GetAssetFromFaucetRequest } from './types'\n\nexport async function getAssetFromFaucet({\n token,\n chain,\n walletAddress,\n apiKey,\n}: GetAssetFromFaucetRequest) {\n return await sendGetRequest({\n uri: `${FUN_FAUCET_URL}/get-faucet?token=${token}&testnet=${chain}&addr=${walletAddress}`,\n apiKey,\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport type {\n GetCryptocurrencyHoldingsRequest,\n GetLinkTokenRequest,\n GetLinkTokenResponse,\n GetTransferIntegrationsRequest,\n GetTransferIntegrationsResponse,\n MeshExecuteTransferRequest,\n MeshExecuteTransferResponse,\n PreviewTransferRequest,\n PreviewTransferResponse,\n} from './types'\n\n/**\n * @param authToken The authentication token to send the asset from.\n * @param type The type of the integration to send the asset from.\n * @return https://docs.meshconnect.com/api-reference/portfolio/get-holdings\n */\nexport async function meshGetCryptocurrencyHoldings({\n authToken,\n type,\n apiKey,\n}: GetCryptocurrencyHoldingsRequest): Promise<any> {\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/holdings/get`,\n body: { authToken, type },\n apiKey,\n })\n return res\n}\n\n/**\n * @return https://docs.meshconnect.com/api-reference/managed-transfers/get-integrations\n */\nexport async function meshGetTransferIntegrations({\n apiKey,\n}: GetTransferIntegrationsRequest): Promise<GetTransferIntegrationsResponse> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/integrations`,\n apiKey,\n })\n return res\n}\n\n/**\n * @param userId A unique Id representing the end user. Typically this will be a user Id from the\nclient application. Personally identifiable information, such as an email address or phone number,\nshould not be used. 50 characters length maximum.\n * @param integrationId A unique identifier representing a specific integration obtained from the list of available integrations.\n * @param restrictMultipleAccounts The final screen of Link allows users to \u201Ccontinue\u201D back to your app or \u201CLink another account.\u201D\nIf this param is present then this button will be hidden.\n * @param transferOptions Encapsulates transaction-related parameters, including destination addresses and the amount to transfer in fiat currency.\n * @return https://docs.meshconnect.com/api-reference/managed-account-authentication/get-link-token-with-parameters\n */\nexport async function meshGetLinkToken({\n userId,\n integrationId,\n restrictMultipleAccounts,\n transferOptions,\n apiKey,\n}: GetLinkTokenRequest): Promise<GetLinkTokenResponse> {\n let body: any = { userId }\n if (integrationId) {\n body = { ...body, integrationId }\n }\n if (restrictMultipleAccounts) {\n body = { ...body, restrictMultipleAccounts }\n }\n if (transferOptions) {\n body = { ...body, transferOptions }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/linktoken`,\n body,\n apiKey,\n })\n return res\n}\n\n/**\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param toAuthToken The authentication token of the target integration. Can be used alternatively to the address in the ToAddress field. If used, toType should also be provided.\n * @param toType The type of the target integration to send assets to. Used along with the toAuthToken alternatively to ToAddress.\n * @param networkId The network to send the asset over. This is generated by Mesh, it isn't a chainId or chain name.\n * @param symbol The symbol of the digital asset to send.\n * @param toAddress The target address to send the asset to.\n * @param amount The amount to send, in crypto.\n * @param amountInFiat The amount to send, in fiat currency. Can be used alternatively to Amount.\n * @param fiatCurrency Fiat currency that is to get corresponding converted fiat values of transfer and fee amounts. If not provided, defaults to USD.\n * @returns https://docs.meshconnect.com/api-reference/managed-transfers/preview-transfer\n */\nexport async function meshPreviewTransfer({\n fromAuthToken,\n fromType,\n toAuthToken,\n toType,\n networkId,\n symbol,\n toAddress,\n amount,\n amountInFiat,\n fiatCurrency,\n apiKey,\n}: PreviewTransferRequest): Promise<PreviewTransferResponse> {\n let body: any = { fromAuthToken, fromType }\n if (toAuthToken) {\n body = { ...body, toAuthToken }\n }\n if (toType) {\n body = { ...body, toType }\n }\n if (networkId) {\n body = { ...body, networkId }\n }\n if (symbol) {\n body = { ...body, symbol }\n }\n if (toAddress) {\n body = { ...body, toAddress }\n }\n if (amount) {\n body = { ...body, amount }\n }\n if (amountInFiat) {\n body = { ...body, amountInFiat }\n }\n if (fiatCurrency) {\n body = { ...body, fiatCurrency }\n }\n\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/preview`,\n body,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n/**\n *\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param previewId The preview ID of the transfer to execute.\n * @param mfaCode Multi-factor auth code that should be provided if the status of the transfer was MfaRequired.\n * @returns https://docs.meshconnect.com/api-reference/managed-transfers/execute-transfer\n */\nexport async function meshExecuteTransfer({\n fromAuthToken,\n fromType,\n previewId,\n mfaCode,\n apiKey,\n}: MeshExecuteTransferRequest): Promise<MeshExecuteTransferResponse> {\n let body: any = { fromAuthToken, fromType, previewId }\n if (mfaCode) {\n body = { ...body, mfaCode }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/execute`,\n body,\n apiKey,\n })\n return res\n}\n", "export interface GetCryptocurrencyHoldingsRequest {\n authToken: string\n type: string\n apiKey: string\n}\n\nexport interface GetTransferIntegrationsRequest {\n apiKey: string\n}\n\nexport interface IntegrationNetworkInfo {\n chainId: string\n id: string\n logoUrl: string\n name: string\n nativeSymbol: string\n supportedTokens: string[]\n}\n\nexport interface TransferIntegration {\n networks: IntegrationNetworkInfo[]\n supportsIncomingTransfers: boolean\n supportsOutgoingTransfers: boolean\n type: string\n}\n\nexport interface GetTransferIntegrationsResponse {\n integrations: TransferIntegration[]\n}\n\nexport interface GetLinkTokenRequest {\n userId: string\n integrationId?: string | null\n restrictMultipleAccounts?: boolean\n transferOptions?: any | null\n apiKey: string\n}\n\nexport interface GetLinkTokenResponse {\n linkToken: string\n}\n\nexport interface PreviewTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n toAuthToken?: string | null\n toType?: string | null\n networkId?: string\n symbol?: string | null\n toAddress?: string | null\n amount?: string | null\n amountInFiat?: string | null\n fiatCurrency?: string | null\n}\n\nexport interface MeshExecuteTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n previewId: string\n mfaCode?: string | null\n}\n\n// Reference: https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-execute\nexport enum MeshExecuteTransferStatus {\n succeeded = 'succeeded',\n failed = 'failed',\n mfaRequired = 'mfaRequired',\n emailConfirmationRequired = 'emailConfirmationRequired',\n emailConfirmationApprovalRequired = 'emailConfirmationApprovalRequired',\n deviceConfirmationRequired = 'deviceConfirmationRequired',\n mfaFailed = 'mfaFailed',\n addressWhitelistRequired = 'addressWhitelistRequired',\n secondMfaRequired = 'secondMfaRequired',\n}\n\nexport enum MeshExecuteTransferMfaType {\n unspecified = 'unspecified',\n phone = 'phone',\n email = 'email',\n otp = 'otp',\n}\n\nexport interface MeshExecuteTransferContent {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n\nexport interface MeshExecuteTransferResponse {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n\nexport interface MeshCryptoCurrencyPosition {\n symbol: string\n amount: number\n}\n\nexport interface GetCryptocurrencyHoldingsResponse {\n cryptocurrencyPositions: MeshCryptoCurrencyPosition[]\n}\n\n/*\nhttps://docs.meshconnect.com/api-reference/managed-transfers/preview-transfer\n */\nexport interface PreviewTransferResponse {\n /** The status of the operation. */\n status: 'succeeded' | 'failed' | 'requiresFunding'\n /** Error message, if the operation did not complete successfully. */\n errorMessage: string | null\n /** Result of the preview. */\n previewResult: PreviewTransferResult | null\n transferBalanceFundingAvailability: TransferBalanceFundingAvailability | null\n}\n\nexport interface PreviewTransferResult {\n previewId: string\n previewExpiresIn: number\n fromAddress: string | null\n toAddress: string | null\n addressTag: string | null\n symbol: string | null\n amount: number\n amountInFiat: number\n totalEstimatedAmount: number\n totalEstimatedAmountInFiat: number\n networkId: string\n networkName: string | null\n contractAddress: string | null\n institutionTransferFee: TransferFee | null\n estimatedNetworkGasFee: TransferFee | null\n decimalPlaces: number | null\n unitPrice: number\n clientTransactionId: string | null\n clientFee: number | null\n customClientFee: TransferFee | null\n processingFeeRetainMethod: ProcessingFeeRetainMethod | null\n transferType: TransferTypeEnum | null\n isCustomClientFeeProvided: boolean\n amountWithCustomClientFee: number\n isFeeIncluded: boolean\n amountToReceive: number\n amountToReceiveInFiat: number\n transferAmountToRequest: number\n}\n\nexport interface TransferFee {\n fee: number\n feeCurrency: string | null\n feeInFiat: number\n}\n\nexport interface ProcessingFeeRetainMethod {\n type: 'default' | 'smartDeposit'\n processingFeeAddress: string | null\n}\n\nexport type TransferTypeEnum = 'deposit' | 'payment' | 'onramp'\n\nexport interface TransferBalanceFundingAvailability {\n status:\n | 'disabled'\n | 'available'\n | 'requiresAmountLowering'\n | 'notApplicable'\n | 'unavailable'\n transferTotalAmount: number\n unitPrice: number\n gasFeeBuffer: TransferFee | null\n symbol: string | null\n transferTotalAmountInFiat: number\n}\n", "import { ErrorCode, InternalFailureError } from '@funkit/utils'\nimport { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport type {\n GetMoonpayBuyQuoteForCreditCardRequest,\n GetMoonpayBuyQuoteForCreditCardResponse,\n GetMoonpayUrlSignatureRequest,\n} from './types'\n\nexport async function getMoonpayUrlSignature({\n url,\n isSandbox,\n apiKey,\n}: GetMoonpayUrlSignatureRequest): Promise<string> {\n const signature = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-signature/`,\n body: { url, isSandbox },\n apiKey,\n })\n if (!signature || !signature?.url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No onramp url found.',\n '',\n { url },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return signature.url\n}\n\nexport async function getMoonpayBuyQuoteForCreditCard({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n baseCurrencyAmount,\n extraFeePercentage,\n areFeesIncluded,\n apiKey,\n}: GetMoonpayBuyQuoteForCreditCardRequest): Promise<GetMoonpayBuyQuoteForCreditCardResponse> {\n const params = new URLSearchParams({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n paymentMethod: 'credit_debit_card',\n ...(baseCurrencyAmount == null\n ? {}\n : { baseCurrencyAmount: baseCurrencyAmount.toString() }),\n ...(extraFeePercentage == null\n ? {}\n : { extraFeePercentage: extraFeePercentage.toString() }),\n ...(areFeesIncluded == null\n ? {}\n : { areFeesIncluded: areFeesIncluded.toString() }),\n }).toString()\n\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-buy-quote?${params}`,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport type {\n CreateStripeBuySessionBody,\n CreateStripeBuySessionResponse,\n GetStripeBuyQuoteRequest,\n GetStripeBuyQuoteResponse,\n} from './types'\n\nexport async function getStripeBuyQuote({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n isSandbox,\n apiKey,\n}: GetStripeBuyQuoteRequest): Promise<GetStripeBuyQuoteResponse> {\n const params = new URLSearchParams({\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrencies: destinationCurrency,\n // Only allow one network in this SDK\n destinationNetworks: destinationNetwork,\n }).toString()\n const buyQuoteResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-buy-quote?${params}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buyQuoteResp as GetStripeBuyQuoteResponse\n}\n\nexport async function createStripeBuySession({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n walletAddress,\n customerIpAddress,\n isSandbox,\n apiKey,\n}: CreateStripeBuySessionBody): Promise<CreateStripeBuySessionResponse> {\n const body = {\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrency,\n destinationCurrencies: [destinationCurrency],\n // Only allow one network in this SDK\n destinationNetwork,\n destinationNetworks: [destinationNetwork],\n // Only allow one wallet address in this SDK, and it must correspond to the destination network\n walletAddresses: {\n [destinationNetwork]: walletAddress,\n },\n ...(customerIpAddress ? { customerIpAddress } : {}),\n }\n const newBuySessionResp = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout`,\n body,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return newBuySessionResp as CreateStripeBuySessionResponse\n}\n\nexport async function getStripeBuySession({\n sessionId,\n apiKey,\n}: {\n sessionId: string\n apiKey: string\n}): Promise<CreateStripeBuySessionResponse> {\n const buySessionResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout-session/${sessionId}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buySessionResp as CreateStripeBuySessionResponse\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendPostRequest } from '../../utils'\nimport type { SendSupportMessageRequest } from './types'\n\nexport async function sendSupportMessage({\n title,\n description,\n userEmail,\n apiKey,\n}: SendSupportMessageRequest): Promise<boolean> {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/support/send-message`,\n body: { title, description, userEmail },\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return true\n } catch (_err) {\n return false\n }\n}\n"],
5
+ "mappings": ";AAAO,IAAM,eACX,QACI,mCACA,QACE,mCACA,QACE;AAAA;AAAA,EAEA;AAAA;AAEH,IAAM,iBAAiB;;;ACV9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,oBAAoB,CAAC,KAAU,YAAiB;AAC3D,MACE,eAAe,yBACf,eAAe,yBACf,eAAe,oBACf;AACA,YAAQ,MAAM;AAAA,EAChB;AACF;;;ACNO,IAAM,wBAAwB;AAAA,EACnC,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,gBAAgB;AAClB;;;ACrBA,SAAS,aAAa;AAEf,SAAS,YAAY,QAAgB;AAC1C,QAAM,QAAQ,IAAI,WAAW,MAAM;AACnC,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,UAAM,CAAC,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;AAAA,EAC3C;AACA,SAAO,MAAM,KAAK;AACpB;AAEO,SAAS,6BAA6B;AAC3C,SAAO,MAAM,OAAO,YAAY,EAAE,CAAC,CAAC;AACtC;AAEO,SAAS,0BAA0B,GAAW;AACnD,SAAO,KAAK,MAAM,IAAI,EAAE,IAAI;AAC9B;;;AChBA,SAAS,aAAa;AACtB,SAAS,SAAAA,cAAa;AAStB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,yBAAAC;A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SAAS;AAAA;AAAA,IAE9C;AAAA,IACA,uBAAuB,CAAC,mBAAmB;AAAA;AAAA,IAE3C;AAAA,IACA,qBAAqB,CAAC,kBAAkB;AAAA;AAAA,IAExC,iBAAiB;AAAA,MACf,CAAC,kBAAkB,GAAG;AAAA,IACxB;AAAA,IACA,GAAI,oBAAoB,EAAE,kBAAkB,IAAI,CAAC;AAAA,EACnD;AACA,QAAM,oBAAoB,MAAM,gBAAgB;AAAA,IAC9C,KAAK,GAAG,YAAY;AAAA,IACpB;AAAA,IACA,cAAc,EAAE,aAAa,EAAE;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEA,eAAsB,oBAAoB;AAAA,EACxC;AAAA,EACA;AACF,GAG4C;AAC1C,QAAM,iBAAiB,MAAM,eAAe;AAAA,IAC1C,KAAK,GAAG,YAAY,oCAAoC,SAAS;AAAA,IACjE,cAAc,EAAE,aAAa,EAAE;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;AC9EA,eAAsB,mBAAmB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgD;AAC9C,MAAI;AACF,UAAM,gBAAgB;AAAA,MACpB,KAAK,GAAG,YAAY;AAAA,MACpB,MAAM,EAAE,OAAO,aAAa,UAAU;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,aAAa,EAAE;AAAA,IACjC,CAAC;AACD,WAAO;AAAA,EACT,SAAS,MAAM;AACb,WAAO;AAAA,EACT;AACF;",
6
+ "names": ["toHex", "InvalidParameterError", "ResourceNotFoundError", "UserOpFailureError", "toHex", "ErrorCode", "ResourceNotFoundError", "CheckoutState", "ResourceNotFoundError", "ErrorCode", "MeshExecuteTransferStatus", "MeshExecuteTransferMfaType", "ErrorCode", "InternalFailureError", "InternalFailureError", "ErrorCode"]
7
7
  }
@@ -1,11 +1,3 @@
1
- import type { GetMoonpayBuyQuoteForCreditCardRequest, GetMoonpayBuyQuoteForCreditCardResponse, GetMoonpayOffRampUrlRequest, GetMoonpayOnRampUrlRequest, GetMoonpayUrlSignatureRequest, MoonpayCurrency } from './types';
1
+ import type { GetMoonpayBuyQuoteForCreditCardRequest, GetMoonpayBuyQuoteForCreditCardResponse, GetMoonpayUrlSignatureRequest } from './types';
2
2
  export declare function getMoonpayUrlSignature({ url, isSandbox, apiKey, }: GetMoonpayUrlSignatureRequest): Promise<string>;
3
3
  export declare function getMoonpayBuyQuoteForCreditCard({ currencyCode, baseCurrencyCode, quoteCurrencyAmount, baseCurrencyAmount, extraFeePercentage, areFeesIncluded, apiKey, }: GetMoonpayBuyQuoteForCreditCardRequest): Promise<GetMoonpayBuyQuoteForCreditCardResponse>;
4
- /**=======================
5
- * POTENTIAL DEPRECATION
6
- *=======================*/
7
- export declare function getMoonpayOnRampUrl({ apiKey, walletAddr, currencyCode, }: GetMoonpayOnRampUrlRequest): Promise<string>;
8
- export declare function getMoonpayOffRampUrl({ walletAddr, apiKey, }: GetMoonpayOffRampUrlRequest): Promise<string>;
9
- export declare function getMoonpayOnRampSupportedCurrencies({ apiKey, }: {
10
- apiKey: string;
11
- }): Promise<MoonpayCurrency[]>;
@@ -12,39 +12,6 @@ export interface GetMoonpayBuyQuoteForCreditCardRequest {
12
12
  extraFeePercentage?: number;
13
13
  areFeesIncluded?: boolean;
14
14
  }
15
- export interface GetMoonpayOnRampUrlRequest {
16
- apiKey: string;
17
- walletAddr: string;
18
- currencyCode?: string;
19
- }
20
- export interface GetMoonpayOffRampUrlRequest {
21
- apiKey: string;
22
- walletAddr: string;
23
- }
24
- export interface MoonpayCurrency {
25
- id: string;
26
- name: string;
27
- code: string;
28
- createdAt?: string;
29
- updatedAt?: string;
30
- type?: string;
31
- precision?: number;
32
- addressRegex?: string;
33
- testnetAddressRegex?: string;
34
- maxAmount?: number;
35
- maxBuyAmount?: number;
36
- maxSellAmount?: number;
37
- minAmount?: number;
38
- minBuyAmount?: number;
39
- minSellAmount?: number;
40
- supportsAddressTag?: boolean;
41
- addressTagRegex?: string;
42
- supportsTestMode?: boolean;
43
- isSuspended?: boolean;
44
- isSupportedInUS?: boolean;
45
- isSellSupported?: boolean;
46
- notAllowedUSStates?: string[];
47
- }
48
15
  export interface GetMoonpayBuyQuoteForCreditCardResponse {
49
16
  accountId: string;
50
17
  baseCurrencyAmount: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/api-base",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Base API for Funkit",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -10,9 +10,11 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@lifeomic/attempt": "^3.1.0",
13
- "big.js": "^6.2.1"
13
+ "big.js": "^6.2.1",
14
+ "@funkit/utils": "1.0.3"
14
15
  },
15
16
  "devDependencies": {
17
+ "@types/big.js": "^6.2.2",
16
18
  "ts-node": "^10.9.1",
17
19
  "typescript": "^5.4.3",
18
20
  "vitest": "^2.0.5"
@@ -1,10 +0,0 @@
1
- export declare class BaseError extends Error {
2
- baseType: string;
3
- type: string;
4
- code: string;
5
- rawMessage: string;
6
- paramsUsed: any;
7
- timestamp: string;
8
- constructor(baseType: string, type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string, isInternal?: boolean);
9
- loadEnd(): void;
10
- }
@@ -1,19 +0,0 @@
1
- import { BaseError } from './BaseError';
2
- export declare class ClientError extends BaseError {
3
- constructor(type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
4
- }
5
- export declare class InvalidParameterError extends ClientError {
6
- constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
7
- }
8
- export declare class ResourceNotFoundError extends ClientError {
9
- constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
10
- }
11
- export declare class ThrottlingError extends ClientError {
12
- constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
13
- }
14
- export declare class AccessDeniedError extends ClientError {
15
- constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
16
- }
17
- export declare class UserOpFailureError extends ClientError {
18
- constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
19
- }
@@ -1,7 +0,0 @@
1
- import { BaseError } from './BaseError';
2
- export declare class ServerError extends BaseError {
3
- constructor(type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
4
- }
5
- export declare class InternalFailureError extends ServerError {
6
- constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
7
- }
@@ -1,4 +0,0 @@
1
- export * from './BaseError';
2
- export * from './ClientError';
3
- export * from './ServerError';
4
- export * from './types';