@funkit/core 2.2.7 → 2.2.9

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 CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/actions/AccessControl.ts
2
2
  import { getAddress, pad as pad6 } from "viem";
3
+ import { ErrorCode as ErrorCode8, InvalidParameterError as InvalidParameterError8 } from "@funkit/utils";
3
4
 
4
5
  // src/auth/Auth.ts
5
6
  import {
@@ -13,9 +14,15 @@ import {
13
14
  } from "viem";
14
15
  import { privateKeyToAccount } from "viem/accounts";
15
16
  import * as viemChains from "viem/chains";
17
+ import {
18
+ ErrorCode as ErrorCode7,
19
+ InvalidParameterError as InvalidParameterError7,
20
+ ResourceNotFoundError as ResourceNotFoundError5
21
+ } from "@funkit/utils";
16
22
 
17
23
  // src/apis/UserApis.ts
18
- import { InvalidParameterError as InvalidParameterError2 } from "viem";
24
+ import { InvalidParameterError as InvalidParameterError6 } from "viem";
25
+ import { ResourceNotFoundError as ResourceNotFoundError4 } from "@funkit/utils";
19
26
 
20
27
  // src/common/constants.ts
21
28
  import { padHex } from "viem";
@@ -13367,859 +13374,24 @@ import {
13367
13374
  http,
13368
13375
  createPublicClient
13369
13376
  } from "viem";
13377
+ import {
13378
+ ErrorCode as ErrorCode4,
13379
+ InternalFailureError as InternalFailureError2,
13380
+ InvalidParameterError as InvalidParameterError3,
13381
+ ResourceNotFoundError as ResourceNotFoundError3
13382
+ } from "@funkit/utils";
13370
13383
 
13371
13384
  // src/utils/ApiUtils.ts
13372
13385
  import { retry } from "@lifeomic/attempt";
13373
-
13374
- // src/errors/BaseError.ts
13375
- var discord = "https://discord.gg/mvQunrx6NG";
13376
- var BaseError = class extends Error {
13377
- constructor(baseType, type, code, msg, paramsUsed, fixSuggestion, docLink, isInternal = false) {
13378
- super(`${msg}
13379
-
13380
- ${fixSuggestion}
13381
- Docs: ${docLink}
13382
- Discord: ${discord}`);
13383
- this.baseType = baseType;
13384
- this.type = type;
13385
- this.code = code;
13386
- this.paramsUsed = paramsUsed;
13387
- if (isInternal) {
13388
- this.loadEnd();
13389
- }
13390
- this.message += "\n\nTrace:";
13391
- this.timestamp = (/* @__PURE__ */ new Date()).toUTCString();
13392
- }
13393
- timestamp;
13394
- loadEnd() {
13395
- this.message += "\n\nThis is an internal sdk error. Please contact the fun team at our Discord for the fastest response.";
13396
- }
13397
- };
13398
-
13399
- // src/errors/errors.json
13400
- var errors_default = {
13401
- AA21: {
13402
- info: " Your wallet lacks funds for this transaction.",
13403
- suggestion: "To fix this error, make sure you have enough funds in your wallet to cover the transaction fee."
13404
- },
13405
- FW000: {
13406
- info: " Create3Deployer.requireDeployerOnly() - Signatures were not sorted before being passed in",
13407
- 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."
13408
- },
13409
- FW001: {
13410
- info: " Create3Deployer.requireDeployerOnly() - Signature failed to be recovered. ercrecover returned the zero address",
13411
- suggestion: "To fix this error, make sure to pass in enough valid signatures that sign the `hash` in the `sigs` array"
13412
- },
13413
- FW002: {
13414
- info: " Create3Deployer.addDeployer() - Invalid Hash",
13415
- suggestion: "To fix this error, make sure `hash` is equal to `hashAddDeployer()`"
13416
- },
13417
- FW003: {
13418
- info: " Create3Deployer.removeDeployer() - Invalid Hash",
13419
- suggestion: "To fix this error, make sure `hash` is equal to `hashRemoveDeployer()`"
13420
- },
13421
- FW004: {
13422
- info: " Create3Deployer.setThreshold() - Threshold must be greater than 1",
13423
- suggestion: "To fix this error, `threshold` is greater than 1"
13424
- },
13425
- FW005: {
13426
- info: " Create3Deployer.setThreshold() - Invalid Hash",
13427
- suggestion: "To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_threshold))`"
13428
- },
13429
- FW006: {
13430
- info: " Create3Deployer.callChild() - Invalid Hash",
13431
- suggestion: "To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(child, data, _nonce, block.chainid))`"
13432
- },
13433
- FW007: {
13434
- info: " Create3Deployer.callChild() - Invalid Nonce, nonce must be 1 greater than the current nonce",
13435
- suggestion: "To fix this error, make sure `_nonce` is equal to the current nonce + 1"
13436
- },
13437
- FW008: {
13438
- info: " Create3Deployer.callChild() - call to child failed",
13439
- suggestion: "To fix this error, check to see what is making the call to the child fail"
13440
- },
13441
- FW009: {
13442
- info: " Create3Deployer.deploy() - Invalid Hash",
13443
- suggestion: "To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_salt, _creationCode))`"
13444
- },
13445
- FW010: {
13446
- info: " FunWalletFactory.constructor() - Invalid Address, cannot be the zero address",
13447
- suggestion: "To fix this error, make sure `_deployer` is not equal to the zero address"
13448
- },
13449
- FW011: {
13450
- info: " FunWalletFactory.constructor() - Invalid Address, cannot be the zero address",
13451
- suggestion: "To fix this error, make sure `_funWalletImpAddress` is not equal to the zero address"
13452
- },
13453
- FW012: {
13454
- info: " FunWalletFactory.constructor() - Invalid Address, cannot be the zero address",
13455
- suggestion: "To fix this error, make sure `_feeOracle` is not equal to the zero address"
13456
- },
13457
- FW013: {
13458
- info: " FunWalletFactory.constructor() - Invalid Address, cannot be the zero address",
13459
- suggestion: "To fix this error, make sure `_walletInit` is not equal to the zero address"
13460
- },
13461
- FW014: {
13462
- info: " FunWalletFactory.constructor() - Unable to generate the address from this deployerSalt",
13463
- 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."
13464
- },
13465
- FW015: {
13466
- info: " FunWalletFactory.constructor() - Generated the wrong address from this deployerSalt",
13467
- 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."
13468
- },
13469
- FW016: {
13470
- info: " FunWalletFactory.createAccount() - Call to initialize failed on the deployed proxy",
13471
- suggestion: "To fix this error, make sure the `initializerCallData` is formatted correctly"
13472
- },
13473
- FW017: {
13474
- info: " FunWalletFactory - Caller must be deployer",
13475
- suggestion: "To fix this error, make sure to call the function from the deployer address"
13476
- },
13477
- FW018: {
13478
- info: " WalletInit.commit() - The previous commit has not expired",
13479
- suggestion: "To fix this error, wait for the previous commit with this `commitKey` to expire. This should take at most 10 minutes."
13480
- },
13481
- FW019: {
13482
- info: " WalletInit.validateSalt() - The hash at the commitKey does not match `keccak256(abi.encode(seed, owner, initializerCallData))`",
13483
- suggestion: "To fix this error, make sure the seed, owner, and initializerCallData are hashed and stored in commits at the corresponding `commitKey`"
13484
- },
13485
- FW020: {
13486
- info: " WalletInit.validateSalt() - The new owner of the funwallet must match data.newFunWalletOwner from loginData",
13487
- suggestion: "To fix this error, make sure the owner set in `loginData` matches the owner address returned from the tweet."
13488
- },
13489
- FW021: {
13490
- info: " WalletInit.setOracle() - The address of the new `_oracle` must not be the zero address",
13491
- suggestion: "To fix this error, make sure `_oracle` is not the zero address"
13492
- },
13493
- FW022: {
13494
- info: " Create3Deployer.deployFromChild() - Invalid Child Address",
13495
- suggestion: "To fix this error, make sure the caller is a contract deployed from the Create3Deployer"
13496
- },
13497
- FW023: {
13498
- info: " ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Target Code Hash",
13499
- suggestion: "To fix this error, make sure the caller is a contract targeted is a ERC1967ProxyData contract"
13500
- },
13501
- FW024: {
13502
- info: " ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Contract Implementation Address",
13503
- suggestion: "To fix this error, make sure you have the minimun threshold amount of valid signatures."
13504
- },
13505
- FW025: {
13506
- info: " ImplementationRegistry.addImplementation() - Invalid Signature Amount",
13507
- suggestion: "To fix this error, make sure you have the minimun threshold amount of valid signatures."
13508
- },
13509
- FW026: {
13510
- info: " ImplementationRegistry.removeImplementation() - Invalid Signature Amount",
13511
- suggestion: "To fix this error, make sure you have the minimun threshold amount of valid signatures."
13512
- },
13513
- FW027: {
13514
- info: " WalletInit.commit() - Unable to commit with a previously used commit hash",
13515
- 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"
13516
- },
13517
- FW028: {
13518
- info: " MultiSigDeployer.constructor() - Threshold can't be greater than deployers length",
13519
- suggestion: "To fix this error, make sure the threshold value is not 0"
13520
- },
13521
- FW029: {
13522
- info: " WalletInit.invalidateUsedSeed() - msg.sender must equal funwalletfactory",
13523
- suggestion: "To fix this error, make sure you are calling this function from the FunWalletFactory contract"
13524
- },
13525
- FW030: {
13526
- info: " WalletInit.setFunWalletFactory() - funwalletfactory address cannot be set to 0",
13527
- suggestion: "To fix this error, make sure you are passing in the valid funwalletfactory address"
13528
- },
13529
- FW031: {
13530
- info: " WalletInit.validateSalt() - seed has already been used",
13531
- suggestion: "To fix this error, make sure you are not using an existing salt"
13532
- },
13533
- FW032: {
13534
- info: " FunWalletFactory.setFeeOracle() - Cannot set the fee oracle address to 0",
13535
- suggestion: "To fix this error, make sure you are using the correct address of the fee oracle"
13536
- },
13537
- FW033: {
13538
- info: " FunWalletFactory.constructor() - Invalid Address, cannot be the zero address",
13539
- suggestion: "To fix this error, make sure `_entryPoint` is not equal to the zero address"
13540
- },
13541
- FW034: {
13542
- info: " Create3Deployer.callChild() - Value not equal to msg.value",
13543
- suggestion: "To fix this error, make sure `msg.value` is equal to the `value` parameter."
13544
- },
13545
- FW100: {
13546
- info: " Module.execute() - execute() needs to be overriden",
13547
- suggestion: "To fix this error, make sure you are overriding the execute method in your module"
13548
- },
13549
- FW101: {
13550
- info: " ApproveAndExec.approveAndExecute() - the approveData's first four bytes must be the approve() function selector",
13551
- suggestion: "To fix this error, change `approveData` such that the first four bytes are `bytes4(keccak256('approve(address,uint256)'))`"
13552
- },
13553
- FW102: {
13554
- info: " ApproveAndSwap.constructor() - `_wethAddr` cannot be the zero address",
13555
- suggestion: "To fix this error, make sure `_wethAddr` is not set to the zero address"
13556
- },
13557
- FW103: {
13558
- info: " ApproveAndSwap.constructor() - `_router` cannot be the zero address",
13559
- suggestion: "To fix this error, make sure `_router` is not set to the zero address"
13560
- },
13561
- FW104: {
13562
- info: " ApproveAndSwap.executeSwapEth() - msg.sender does not have enough weth",
13563
- suggestion: "To fix this error, make sure msg.sender has a weth balance >= `amount`"
13564
- },
13565
- FW105: {
13566
- info: " ApproveAndSwap.\\_internalSwap() - Approve failed",
13567
- suggestion: "To fix this error, make sure you have formatted approve correctly"
13568
- },
13569
- FW106: {
13570
- info: " AaveWithdraw.execute() - Withdrawing a zero balance",
13571
- suggestion: "You are trying to withdraw from aave but don't have a balance"
13572
- },
13573
- FW107: {
13574
- info: " ApproveAndExec.approveAndExecute() - Approve failed",
13575
- suggestion: "The token you tried to approve failed"
13576
- },
13577
- FW108: {
13578
- info: " UniswapV3LimitOrder.execute() - Approval Failed",
13579
- suggestion: "You are trying to withdraw from aave but don't have a balance"
13580
- },
13581
- FW109: {
13582
- info: " UniswapV3LimitOrder.constructor() - Router cannot be address zero",
13583
- suggestion: "Make sure you are not passing in the zero address when initializing the module"
13584
- },
13585
- FW110: {
13586
- info: " UniswapV3LimitOrder.constructor() - Quoter cannot be zero address",
13587
- suggestion: "Make sure you are not passing in the zero address when initializing the module"
13588
- },
13589
- FW200: {
13590
- info: " FeePercentOracle.setValues() - feepercent must be less than or equals to 100%",
13591
- suggestion: "To fix this error, `_feepercent` must be less than or equals to `10 ** _decimals`"
13592
- },
13593
- FW201: {
13594
- info: " FeePercentOracle.withdrawEth() - eth transfer failed",
13595
- 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"
13596
- },
13597
- FW202: {
13598
- info: " TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator price must be greater than 0",
13599
- suggestion: "To fix this error, retry the call and make sure price is greater than 0"
13600
- },
13601
- FW203: {
13602
- info: " TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator updatedAt must be greater than 0",
13603
- suggestion: "To fix this error, retry the call and make sure updatedAt is greater than 0"
13604
- },
13605
- FW204: {
13606
- info: " TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator answeredInRound must be greater than or equal to roundId",
13607
- suggestion: "To fix this error, retry the call and make sure answeredInRound must be greater than or equal to roundId"
13608
- },
13609
- FW205: {
13610
- info: " TwitterOracle.batchSetTweet() - socialHandles, loginTypes, seeds, owners length must match in length",
13611
- suggestion: "To fix this error, make sure all arrays passed into this function are the same length."
13612
- },
13613
- FW206: {
13614
- info: " TwitterOracle.setTweet() - the seed from twitter cannot be empty",
13615
- suggestion: "To fix this error, make sure the seed you post on twitter is not empty {}"
13616
- },
13617
- FW207: {
13618
- info: " TwitterOracle.setTweet() - the address from twitter cannot be 0",
13619
- 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"
13620
- },
13621
- FW208: {
13622
- info: " TwitterOracle.batchSetTweet() - the seed from twitter cannot be empty",
13623
- suggestion: "To fix this error, make sure the seed you post on twitter is not empty {}"
13624
- },
13625
- FW209: {
13626
- info: " TwitterOracle.batchSetTweet() - the address from twitter cannot be 0",
13627
- 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"
13628
- },
13629
- FW210: {
13630
- info: " TwitterOracle.fetchTweet() - the seed from twitter cannot be empty",
13631
- suggestion: "To fix this error, make sure the seed you post on twitter is not empty {}"
13632
- },
13633
- FW211: {
13634
- info: " TwitterOracle.fetchTweet() - the address from twitter cannot be 0",
13635
- 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"
13636
- },
13637
- FW300: {
13638
- info: " BasePaymaster.constructor() - entrypoint address cannot be the zero address",
13639
- suggestion: "To fix this error, make sure entrypoint address is not the zero address"
13640
- },
13641
- FW301: {
13642
- info: " BasePaymaster.\\_requireFromEntryPoint() - the msg.sender must be from the entrypoint",
13643
- suggestion: "To fix this error, make sure the msg.sender must be from the entrypoint"
13644
- },
13645
- FW302: {
13646
- info: " GaslessPaymaster.batchActions() - the ith delegate call failed",
13647
- suggestion: "To fix this error, make sure the calldata for `data[i]` is a valid call"
13648
- },
13649
- FW303: {
13650
- info: " GaslessPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated",
13651
- suggestion: "To fix this error, increase the amount of msg.value you are passing to this function"
13652
- },
13653
- FW304: {
13654
- info: " GaslessPaymaster.\\_withdrawDepositTo() - the withdrawal has not been unlocked",
13655
- suggestion: "To fix this error, wait till block.number is greater than the unlockBlock for the sender and make sure `unlockBlock[sender]` is nonzero"
13656
- },
13657
- FW305: {
13658
- info: " GaslessPaymaster.\\_withdrawDepositTo() - the balances of the sender must be greater than the withdrawal amount",
13659
- suggestion: "To fix this error, decrease the amount you are trying to withdraw"
13660
- },
13661
- FW306: {
13662
- info: " GaslessPaymaster.\\_validatePaymasterUserOp() - the userOp.paymasterAndData must have a length of 40",
13663
- suggestion: "To fix this error, change the `paymasterAndData` field in the `userOp` such that the length is 40"
13664
- },
13665
- FW307: {
13666
- info: " GaslessPaymaster.\\_validatePaymasterUserOp() - the verificationGasLimit must be greater than the `COST_OF_POST` variable in GaslessPaymaster",
13667
- suggestion: "To fix this error, increase the `verificationGasLimit` in the `userOp`"
13668
- },
13669
- FW308: {
13670
- info: " GaslessPaymaster.\\_validatePaymasterUserOp() - the sponsor's eth is not locked for use",
13671
- suggestion: "To fix this error, make sure the sponsor's eth is locked using `lockDeposit()`"
13672
- },
13673
- FW309: {
13674
- info: " GaslessPaymaster.\\_validatePaymasterUserOp() - The sponsor needs to approve the spender",
13675
- 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()"
13676
- },
13677
- FW310: {
13678
- info: " GaslessPaymaster.\\_validatePaymasterUserOp() - The sponsor does not have sufficient eth in the paymaster to cover this operation",
13679
- suggestion: "To fix this error, make sure to stake enough eth from the sponsor's address using `addDepositTo()`"
13680
- },
13681
- FW311: {
13682
- info: " GaslessPaymaster.addDepositTo() - `msg.value` must be greater than or equal to amount",
13683
- suggestion: "To fix this error, make sure `msg.value` must be greater than or equal to amount"
13684
- },
13685
- FW312: {
13686
- info: " TokenPaymaster.batchActions() - the ith delegate call failed",
13687
- suggestion: "To fix this error, make sure the calldata for `data[i]` is a valid call"
13688
- },
13689
- FW313: {
13690
- info: " TokenPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated",
13691
- suggestion: "To fix this error, increase the amount of msg.value you are passing to this function"
13692
- },
13693
- FW314: {
13694
- info: " TokenPaymaster.\\_addTokenDepositTo() - token decimals must be greater than 0",
13695
- suggestion: "To fix this error, change the decimals in token using `setTokenData()`"
13696
- },
13697
- FW315: {
13698
- info: " TokenPaymaster.\\_withdrawTokenDepositTo() - token is not unlocked for withdrawal",
13699
- suggestion: "To fix this error, call `unlockTokenDepositAfter()`"
13700
- },
13701
- FW316: {
13702
- info: " TokenPaymaster.\\_withdrawTokenDepositTo() - you are withdrawing more tokens that you have in balance",
13703
- suggestion: "To fix this error, call `getTokenBalance()` to check how many tokens you have and make sure `amount` is less than that"
13704
- },
13705
- FW317: {
13706
- info: " TokenPaymaster.\\_withdrawEthDepositTo() - token is not unlocked for withdrawal",
13707
- suggestion: "To fix this error, call `unlockTokenDepositAfter()` with `ETH` as the token"
13708
- },
13709
- FW318: {
13710
- info: " TokenPaymaster.\\_withdrawEthDepositTo() - you are withdrawing more ether that you have in balance",
13711
- 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"
13712
- },
13713
- FW319: {
13714
- info: " TokenPaymaster.\\_getTokenValueOfEth() - call to token oracle failed",
13715
- suggestion: "To fix this error, check the token oracle and call `setTokenData()` to change the oracle if it is broken"
13716
- },
13717
- FW320: {
13718
- info: " TokenPaymaster.\\_reimbursePaymaster() - failed to reimbursePaymaster with tokens via `permitTransfer()`",
13719
- suggestion: "To fix this **error**, make sure you have permitted the paymaster to spend your tokens"
13720
- },
13721
- FW321: {
13722
- info: " TokenPaymaster.\\_reimbursePaymaster() - spender doesn't have enough tokens",
13723
- suggestion: "To fix this error, make sure to add more tokens to the token paymaster via `addTokenDepositTo()`"
13724
- },
13725
- FW322: {
13726
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - `paymasterAndData` length must be 60",
13727
- suggestion: "To fix this error, make sure to set `paymasterAndData` length to be 60"
13728
- },
13729
- FW323: {
13730
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - `verificationGasLimit` must be greater than `COST_OF_POST`",
13731
- suggestion: "To fix this error, make sure to set the userOp's `verificationGasLimit` to be greater than `COST_OF_POST`"
13732
- },
13733
- FW324: {
13734
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the sponsor must lock their ETH",
13735
- suggestion: "To fix this error, make sure the sponsor has locked their eth by calling `lockTokenDeposit()` from the sponsor address"
13736
- },
13737
- FW325: {
13738
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the account must lock their tokens",
13739
- suggestion: "To fix this error, make sure the user of the token paymaster has locked their tokens by calling `lockTokenDeposit()` from their address"
13740
- },
13741
- FW326: {
13742
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the sponsor eth balance must be greater than maxCost",
13743
- suggestion: "To fix this error, make sure the sponsor eth balance is greater than maxCost"
13744
- },
13745
- FW327: {
13746
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the sponsor must approve the spender",
13747
- 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()`"
13748
- },
13749
- FW328: {
13750
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the sponsor must have approved the token to the paymaster",
13751
- 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()`"
13752
- },
13753
- FW329: {
13754
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the permitted token must be equal to the token you are trying to pay with if using permit",
13755
- suggestion: "To fix this error, make sure the permitted token is equal to the token you are trying to pay with if using permit"
13756
- },
13757
- FW330: {
13758
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the permitted transfer recipient must be the token paymaster",
13759
- suggestion: "To fix this error, make sure to permit the token paymaster to spend your tokens"
13760
- },
13761
- FW331: {
13762
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - the permitted transfer amount must be greater than or equal to the maxTokenCost",
13763
- suggestion: "To fix this error, make sure the permitted transfer amount is greater than or equal to the maxTokenCost"
13764
- },
13765
- FW332: {
13766
- 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",
13767
- 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()`"
13768
- },
13769
- FW333: {
13770
- info: " TokenPaymaster.addEthDepositTo() - make sure msg.value is greater than or equal to amount",
13771
- suggestion: "To fix this error, make sure that the msg.value is greater than or equal to amount"
13772
- },
13773
- FW334: {
13774
- info: " TokenPaymaster.addTokenDepositTo() - sponsor cannot be the zero address",
13775
- suggestion: "To fix this error, make sure the sponsor is not the zero address"
13776
- },
13777
- FW335: {
13778
- info: " TokenPaymaster.addTokenDepositTo() - target cannot be the zero address",
13779
- suggestion: "To fix this error, make sure the target is not the zero address"
13780
- },
13781
- FW336: {
13782
- info: " TokenPaymaster.addTokenDepositTo() - token address cannot be the zero address",
13783
- suggestion: "To fix this error, make sure the token address is not the zero address"
13784
- },
13785
- FW337: {
13786
- info: " TokenPaymaster.addTokenDepositTo() - spender address cannot be the zero address",
13787
- suggestion: "To fix this error, make sure the spender address is not the zero address"
13788
- },
13789
- FW338: {
13790
- info: " TokenPaymaster.addTokenDepositTo() - the token oracle cannot be the zero address",
13791
- suggestion: "To fix this error, make sure the token oracle is not the zero address"
13792
- },
13793
- FW339: {
13794
- info: " TokenPaymaster.addTokenDepositTo() - the tokenAddress cannot be the zero address",
13795
- suggestion: "To fix this error, make sure the tokenAddress is not the zero address"
13796
- },
13797
- FW340: {
13798
- info: " TokenPaymaster.addTokenDepositTo() - the token decimals must be greater than 0",
13799
- suggestion: "To fix this error, make sure the token decimals is greater than 0"
13800
- },
13801
- FW341: {
13802
- info: " TokenPaymaster.addTokenDepositTo() - the chainlink aggregator cannot be the zero address",
13803
- suggestion: "To fix this error, make sure the chainlink aggregator is not the zero address"
13804
- },
13805
- FW342: {
13806
- info: " TokenPaymaster.removeTokenData() - The token doesn't exist in tokens",
13807
- suggestion: "To fix this error, make sure the token address is not the zero address"
13808
- },
13809
- FW343: {
13810
- info: " TokenPaymaster.removeTokenData() - The tokenListIndex doesn't match with the tokenAddress",
13811
- suggestion: "To fix this error, make sure the token at tokenList[tokenListIndex] is the same as the tokenAddress"
13812
- },
13813
- FW344: {
13814
- info: " GaslessPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions",
13815
- suggestion: "To fix this error, make sure you are not recursively calling batchActions from within batchActions"
13816
- },
13817
- FW345: {
13818
- info: " TokenPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions",
13819
- suggestion: "To fix this error, make sure you are not recursively calling batchActions from within batchActions"
13820
- },
13821
- FW346: {
13822
- info: " TokenPaymaster.postOp() - Invalid Permit transfer amount",
13823
- suggestion: "To fix this error, make sure your permit transfer has transfered the correct amount of tokens"
13824
- },
13825
- FW347: {
13826
- info: " TokenPaymaster.\\_reimbursePaymaster() - Invalid amount of tokens transferred",
13827
- 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."
13828
- },
13829
- FW348: {
13830
- info: " UserAuthentication.init() - groupId count must be equal to groups length",
13831
- suggestion: "Make sure the number of groupIds equals the number of groups."
13832
- },
13833
- FW349: {
13834
- info: " TokenPaymaster.calculatePostOpGas() - Invalid Auth Type",
13835
- suggestion: "Make sure the authtype is correct"
13836
- },
13837
- FW350: {
13838
- info: " TokenPaymaster.\\_validatePaymasterUserOp() - Does not have enough balance of token",
13839
- suggestion: "To fix this error, make sure your has enough tokens to permit transfer"
13840
- },
13841
- FW351: {
13842
- info: " BasePaymaster.\\withdrawStakeFromEntryPoint() - Cannot withdraw to address zero",
13843
- suggestion: "To fix this error, make sure you are not withdrawing to address zero"
13844
- },
13845
- FW401: {
13846
- info: " RoleBasedAccessControl",
13847
- suggestion: "### `FW402`: RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target"
13848
- },
13849
- FW402: {
13850
- info: " RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target",
13851
- 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."
13852
- },
13853
- FW403: {
13854
- info: " RoleBasedAccessControl",
13855
- 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."
13856
- },
13857
- FW404: {
13858
- info: " RoleBasedAccessControl",
13859
- suggestion: "To fix this error, make sure the ownerId is not 0 or an existing owner"
13860
- },
13861
- FW405: {
13862
- info: " RoleBasedAccessControl",
13863
- suggestion: "To fix this error, make sure the ruleId is not 0"
13864
- },
13865
- FW406: {
13866
- info: " RoleBasedAccessControl",
13867
- suggestion: "To fix this error, make sure the rule that you are using has a deadline that has passed."
13868
- },
13869
- FW408: {
13870
- info: " RoleBasedAccessControl",
13871
- suggestion: "### `FW410`: RoleBasedAccessControl: isValidAction(), isValidActionAndFee() - Rule not added to role"
13872
- },
13873
- FW410: {
13874
- info: " RoleBasedAccessControl",
13875
- suggestion: "To fix this error, make sure the rule is added to the role"
13876
- },
13877
- FW411: {
13878
- info: " RoleBasedAccessControl",
13879
- suggestion: "To fix this error, make sure the value for the execution call is less than the limit"
13880
- },
13881
- FW412: {
13882
- info: " RoleBasedAccessControl",
13883
- suggestion: "To fix this error, make sure the fee value for the execution call is less than the limit"
13884
- },
13885
- FW413: {
13886
- info: " RoleBasedAccessControl",
13887
- suggestion: "To fix this error, make sure the fee recipient is in the rule fee merkle root"
13888
- },
13889
- FW414: {
13890
- info: " RoleBasedAccessControl",
13891
- suggestion: "To fix this error, make sure the fee token is in the rule fee merkle root"
13892
- },
13893
- FW417: {
13894
- info: " RoleBasedAccessControl",
13895
- suggestion: "To fix this error, make sure the rule you are using exists"
13896
- },
13897
- FW418: {
13898
- info: " RoleBasedAccessControl",
13899
- suggestion: "To fix this error, make sure the user is in the role"
13900
- },
13901
- FW419: {
13902
- info: " RoleBasedAccessControl",
13903
- suggestion: "To fix this error, make sure the feeRecipientTokenMerkleRootHash is not zero"
13904
- },
13905
- FW420: {
13906
- info: " RoleBasedAccessControl",
13907
- suggestion: "To fix this error, make sure the targetSelectorMerkleRootHash is not zero"
13908
- },
13909
- FW421: {
13910
- info: " RoleBasedAccessControl",
13911
- suggestion: "### `FW422`: RoleBasedAccessControl: init() - Wallet has not been initialized"
13912
- },
13913
- FW422: {
13914
- info: " RoleBasedAccessControl",
13915
- suggestion: "To fix this error, make sure the wallet has not initialized the validation contract"
13916
- },
13917
- FW500: {
13918
- info: " FunWallet.initialize() - the entrypoint cannot be the zero address",
13919
- suggestion: "To fix this error, make sure the entrypoint is not the zero address"
13920
- },
13921
- FW501: {
13922
- info: " FunWallet.initialize() - the msg.sender cannot be the address of the Funwallet contract",
13923
- suggestion: "To fix this error, make sure the msg.sender is not the address of the Funwallet contract"
13924
- },
13925
- FW502: {
13926
- info: " FunWallet.\\_requireFromFunWalletProxy() - the function must be called from the funwallet proxy",
13927
- suggestion: "To fix this error, make sure the msg.sender == funwallet"
13928
- },
13929
- FW503: {
13930
- info: " FunWallet.updateEntryPoint() - the new entrypoint address cannot be the zero address",
13931
- suggestion: "To fix this error, make sure the new entrypoint address is not the zero address"
13932
- },
13933
- FW504: {
13934
- info: " FunWallet.depositToEntryPoint() - not enough eth in the funwallet",
13935
- suggestion: "To fix this error, make sure the funwallet has more than the amount of eth you are trying to deposit"
13936
- },
13937
- FW505: {
13938
- info: " FunWallet.\\_transferEthFromEntrypoint() - withdrawing eth from the entrypoint failed",
13939
- suggestion: "To fix this error, retry the operation and make sure you have greater than amount balance in the entrypoint"
13940
- },
13941
- FW506: {
13942
- info: " FunWallet.\\_requireFromModule() - make sure a funwalletfactory deployed the module",
13943
- suggestion: "To fix this error, make sure the msg.sender is the module"
13944
- },
13945
- FW507: {
13946
- info: " FunWallet.\\_requireFromEntryPoint() - the msg.sender must be the entrypoint",
13947
- suggestion: "To fix this error, make sure the msg.sender is the entrypoint"
13948
- },
13949
- FW508: {
13950
- info: " WalletFee.\\_transferEth() - the eth transfer failed",
13951
- suggestion: "To fix this error, retry the operation and make sure you have greater than amount balance in the wallet"
13952
- },
13953
- FW509: {
13954
- info: " WalletFee.\\_handleFee() - the developer eth transfer failed",
13955
- suggestion: "To fix this error, retry the operation and make sure you have greater than amount balance in the wallet"
13956
- },
13957
- FW510: {
13958
- info: " WalletFee.\\_handleFee() - the funOracle eth transfer failed",
13959
- suggestion: "To fix this error, retry the operation and make sure you have greater than amount balance in the wallet"
13960
- },
13961
- FW511: {
13962
- info: " WalletValidation.initValidations() - the WalletValidations contract has already been initialized",
13963
- suggestion: "Don't call initValidations() more than once"
13964
- },
13965
- FW512: {
13966
- info: " WalletValidation.initValidations() - make sure there are more than zero validations",
13967
- 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"
13968
- },
13969
- FW513: {
13970
- info: " WalletValidation.initValidations() - make sure there are no duplicate validation contract addresses",
13971
- suggestion: "To fix this error, make sure there are no duplicate validation contract addresses in `validationData`"
13972
- },
13973
- FW514: {
13974
- info: " WalletValidation.\\_validateUserOp() - make sure the signature length is greater than 0",
13975
- suggestion: "To fix this error, make sure the signature length is greater than 0"
13976
- },
13977
- FW515: {
13978
- info: " WalletValidation.isValidSignature() - make sure the number of validations is greater than zero",
13979
- suggestion: "To fix this error, make sure the number of validations is greater than zero"
13980
- },
13981
- FW516: {
13982
- info: " WalletValidation.\\_requireValidValidation() - the validation failed",
13983
- suggestion: "To fix this error, make sure the validation contract returns true"
13984
- },
13985
- FW517: {
13986
- info: " WalletValidation.\\_requireValidValidationFormat() - the validation was incorrectly formatted",
13987
- 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"
13988
- },
13989
- FW518: {
13990
- info: " WalletValidation.\\_requireValidPrevValidation() - the previous validation must be linked to this validation",
13991
- suggestion: "To fix this error, make sure the previous validation is linked to this validation when adding or removing the validation"
13992
- },
13993
- FW519: {
13994
- info: " WalletValidation.getValidations() - you must have more than zero validations to get validations",
13995
- suggestion: "To fix this error, make sure there are a nonzero amount of validations"
13996
- },
13997
- FW520: {
13998
- info: " WalletValidation.addValidation() - The caller must be this wallet.",
13999
- suggestion: "To fix this error, make sure you are calling addValidation() from your funwallet."
14000
- },
14001
- FW521: {
14002
- info: " WalletValidation.removeValidation() - The caller must be this wallet.",
14003
- suggestion: "To fix this error, make sure you are calling removeValidation() from your funwallet."
14004
- },
14005
- FW522: {
14006
- info: " WalletValidation.updateValidation() - The caller must be this wallet.",
14007
- suggestion: "To fix this error, make sure you are calling updateValidation() from your funwallet."
14008
- },
14009
- FW523: {
14010
- info: " WalletModules.permitTransfer() - Invalid Permit Signature.",
14011
- suggestion: "To fix this error, make sure you have a valid permit signature."
14012
- },
14013
- FW524: {
14014
- info: " WalletValidation.getValidations() - No Validations in the wallet",
14015
- suggestion: "To fix this error, make sure the wallet has validation contracts"
14016
- },
14017
- FW600: {
14018
- info: " DataLib",
14019
- suggestion: "To fix this error, make sure you are calling either execFromEntryPoint() or execFromEntryPointWithFee() from your funwallet."
14020
- },
14021
- FW601: {
14022
- info: " Ownable2StepNoRenounce",
14023
- suggestion: "To fix this error, don't call this function."
14024
- }
14025
- };
14026
-
14027
- // src/errors/types.ts
14028
- var ErrorBaseType = /* @__PURE__ */ ((ErrorBaseType2) => {
14029
- ErrorBaseType2["ClientError"] = "ClientError";
14030
- ErrorBaseType2["ServerError"] = "ServerError";
14031
- return ErrorBaseType2;
14032
- })(ErrorBaseType || {});
14033
- var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
14034
- ErrorType2["InvalidParameter"] = "InvalidParameter";
14035
- ErrorType2["InternalServerFailure"] = "InternalServerFailure";
14036
- ErrorType2["ResourceNotFound"] = "ResourceNotFound";
14037
- ErrorType2["InvalidAction"] = "InvalidAction";
14038
- ErrorType2["ThrottlingError"] = "ThrottlingError";
14039
- ErrorType2["AccessDeniedError"] = "AccessDeniedError";
14040
- ErrorType2["UserOpFailureError"] = "UserOpFailureError";
14041
- return ErrorType2;
14042
- })(ErrorType || {});
14043
- var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
14044
- ErrorCode2["MissingParameter"] = "MissingParameter";
14045
- ErrorCode2["InvalidParameter"] = "InvalidParameter";
14046
- ErrorCode2["InvalidThreshold"] = "InvalidThreshold";
14047
- ErrorCode2["InvalidChainIdentifier"] = "InvalidChainIdentifier";
14048
- ErrorCode2["InvalidNFTIdentifier"] = "InvalidNFTIdentifier";
14049
- ErrorCode2["InsufficientSignatures"] = "InsufficientSignatures";
14050
- ErrorCode2["InvalidParameterCombination"] = "InvalidParameterCombination";
14051
- ErrorCode2["CheckPointHintsNotFound"] = "CheckPointHintsNotFound";
14052
- ErrorCode2["GroupNotFound"] = "GroupNotFound";
14053
- ErrorCode2["TokenNotFound"] = "TokenNotFound";
14054
- ErrorCode2["AddressNotFound"] = "AddressNotFound";
14055
- ErrorCode2["UserAlreadyExists"] = "UserAlreadyExists";
14056
- ErrorCode2["UserNotFound"] = "UserNotFound";
14057
- ErrorCode2["ChainNotSupported"] = "ChainNotSupported";
14058
- ErrorCode2["ServerMissingData"] = "ServerMissingData";
14059
- ErrorCode2["ServerFailure"] = "ServerFailure";
14060
- ErrorCode2["ServerTimeout"] = "ServerTimeout";
14061
- ErrorCode2["UnknownServerError"] = "UnknownServerError";
14062
- ErrorCode2["ServerConnectionError"] = "ServerConnectionError";
14063
- ErrorCode2["UserOpFailureError"] = "UserOpFailureError";
14064
- ErrorCode2["Unauthorized"] = "Unauthorized";
14065
- ErrorCode2["RequestLimitExceeded"] = "RequestLimitExceeded";
14066
- ErrorCode2["WalletPrefundError"] = "PrefundError";
14067
- ErrorCode2["GasSponsorFundError"] = "GasSponsorFundError";
14068
- ErrorCode2["FunWalletErrorCode"] = "FunWalletErrorCode";
14069
- ErrorCode2["BridgeRouteNotFound"] = "BridgeRouteNotFound";
14070
- ErrorCode2["BridgeAllowanceDataNotFound"] = "BridgeAllowanceDataNotFound";
14071
- ErrorCode2["BridgeApproveTxDataNotFound"] = "BridgeApproveTxDataNotFound";
14072
- ErrorCode2["CheckoutInitDepositAddrNotFound"] = "CheckoutInitDepositAddrNotFound";
14073
- return ErrorCode2;
14074
- })(ErrorCode || {});
14075
-
14076
- // src/errors/ClientError.ts
14077
- var ClientError = class extends BaseError {
14078
- constructor(type, code, msg, paramsUsed, fixSuggestion, docLink) {
14079
- super(
14080
- "ClientError" /* ClientError */,
14081
- type,
14082
- code,
14083
- msg,
14084
- paramsUsed,
14085
- fixSuggestion,
14086
- docLink,
14087
- false
14088
- );
14089
- }
14090
- };
14091
- var InvalidParameterError = class extends ClientError {
14092
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
14093
- super(
14094
- "InvalidParameter" /* InvalidParameter */,
14095
- code,
14096
- msg,
14097
- paramsUsed,
14098
- fixSuggestion,
14099
- docLink
14100
- );
14101
- }
14102
- };
14103
- var ResourceNotFoundError = class extends ClientError {
14104
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
14105
- if (msg.includes("Chain name not found")) {
14106
- const { reqId } = JSON.parse(msg);
14107
- super(
14108
- "ResourceNotFound" /* ResourceNotFound */,
14109
- "ChainNotSupported" /* ChainNotSupported */,
14110
- ": Chain name not found or not supported.",
14111
- { reqId },
14112
- "Change your EnvOptions to the correct chain identifier.",
14113
- docLink
14114
- );
14115
- } else {
14116
- super(
14117
- "ResourceNotFound" /* ResourceNotFound */,
14118
- code,
14119
- msg,
14120
- paramsUsed,
14121
- fixSuggestion,
14122
- docLink
14123
- );
14124
- }
14125
- }
14126
- };
14127
- var InvalidActionError = class extends ClientError {
14128
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
14129
- super(
14130
- "InvalidAction" /* InvalidAction */,
14131
- code,
14132
- msg,
14133
- paramsUsed,
14134
- fixSuggestion,
14135
- docLink
14136
- );
14137
- }
14138
- };
14139
- var ThrottlingError = class extends ClientError {
14140
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
14141
- super(
14142
- "ThrottlingError" /* ThrottlingError */,
14143
- code,
14144
- msg,
14145
- paramsUsed,
14146
- fixSuggestion,
14147
- docLink
14148
- );
14149
- }
14150
- };
14151
- var AccessDeniedError = class extends ClientError {
14152
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
14153
- super(
14154
- "AccessDeniedError" /* AccessDeniedError */,
14155
- code,
14156
- msg,
14157
- paramsUsed,
14158
- fixSuggestion,
14159
- docLink
14160
- );
14161
- }
14162
- };
14163
- var UserOpFailureError = class extends ClientError {
14164
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
14165
- const FWCode = findFWContractError(msg);
14166
- if (FWCode) {
14167
- const { reqId } = JSON.parse(msg);
14168
- super(
14169
- "UserOpFailureError" /* UserOpFailureError */,
14170
- "FunWalletErrorCode" /* FunWalletErrorCode */,
14171
- errors_default[FWCode].info,
14172
- { reqId },
14173
- errors_default[FWCode].suggestion,
14174
- docLink
14175
- );
14176
- } else {
14177
- super(
14178
- "UserOpFailureError" /* UserOpFailureError */,
14179
- code,
14180
- msg,
14181
- paramsUsed,
14182
- fixSuggestion,
14183
- docLink
14184
- );
14185
- }
14186
- }
14187
- };
14188
- var findFWContractError = (msg) => {
14189
- let match = msg.match(/FW\d{3}/);
14190
- if (!match) {
14191
- match = msg.match(/AA\d./);
14192
- }
14193
- return match?.[0];
14194
- };
14195
-
14196
- // src/errors/ServerError.ts
14197
- var ServerError = class extends BaseError {
14198
- constructor(type, code, msg, paramsUsed, fixSuggestion, docLink) {
14199
- super(
14200
- "ServerError" /* ServerError */,
14201
- type,
14202
- code,
14203
- msg,
14204
- paramsUsed,
14205
- fixSuggestion,
14206
- docLink,
14207
- true
14208
- );
14209
- }
14210
- };
14211
- var InternalFailureError = class extends ServerError {
14212
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
14213
- super(
14214
- "InternalServerFailure" /* InternalServerFailure */,
14215
- code,
14216
- msg,
14217
- paramsUsed,
14218
- fixSuggestion,
14219
- docLink
14220
- );
14221
- }
14222
- };
13386
+ import {
13387
+ AccessDeniedError,
13388
+ ErrorCode as ErrorCode2,
13389
+ InternalFailureError,
13390
+ InvalidParameterError as InvalidParameterError2,
13391
+ ResourceNotFoundError,
13392
+ ThrottlingError,
13393
+ UserOpFailureError
13394
+ } from "@funkit/utils";
14223
13395
 
14224
13396
  // src/utils/AuthUtils.ts
14225
13397
  import { v4 as uuidv4 } from "uuid";
@@ -14248,6 +13420,7 @@ import {
14248
13420
  toBytes,
14249
13421
  toHex
14250
13422
  } from "viem";
13423
+ import { ErrorCode, InvalidParameterError } from "@funkit/utils";
14251
13424
  var isAddress = (address) => {
14252
13425
  try {
14253
13426
  const [decodedAddr] = decodeAbiParameters(
@@ -14362,7 +13535,8 @@ var useFaucet = async (chainIdentifier, wallet) => {
14362
13535
  const chainName = await chain.getChainName();
14363
13536
  if (chainName !== "goerli") {
14364
13537
  throw new InvalidParameterError(
14365
- "InvalidChainIdentifier" /* InvalidChainIdentifier */,
13538
+ ErrorCode.InvalidChainIdentifier,
13539
+ "Only Goerli is supported",
14366
13540
  "Only Goerli is supported",
14367
13541
  chainIdentifier,
14368
13542
  "Provide the goerli chain, 5, or goerli as the chain identifier",
@@ -14445,12 +13619,6 @@ function fromReadableAmount(amount, decimals) {
14445
13619
  return parseUnits(amount.toFixed(20), decimals);
14446
13620
  }
14447
13621
  var SwapToken = class {
14448
- client;
14449
- version;
14450
- quoterContractAddr;
14451
- poolFactoryContractAddr;
14452
- v2router;
14453
- v2Factory;
14454
13622
  constructor(client, version, quoterContractAddr, poolFactoryContractAddr, v2router, v2Factory) {
14455
13623
  this.client = client;
14456
13624
  this.version = version;
@@ -14716,6 +13884,7 @@ import {
14716
13884
  toBytes as toBytes2,
14717
13885
  toHex as toHex2
14718
13886
  } from "viem";
13887
+ import { safeParseJson } from "@funkit/utils";
14719
13888
  var calcPreVerificationGas = (userOp) => {
14720
13889
  const ov = DefaultGasOverheads;
14721
13890
  const p = Object.assign(
@@ -14803,7 +13972,7 @@ var stringify = (object) => {
14803
13972
  );
14804
13973
  };
14805
13974
  var objectify = (op) => {
14806
- return JSON.parse(stringify(op));
13975
+ return safeParseJson(stringify(op));
14807
13976
  };
14808
13977
  var DefaultGasOverheads = {
14809
13978
  fixed: 28e3,
@@ -14964,7 +14133,7 @@ var isSignatureMissing = (userId, signatures) => {
14964
14133
 
14965
14134
  // src/utils/ApiUtils.ts
14966
14135
  var errorHandler = (err, context) => {
14967
- if (err instanceof ResourceNotFoundError || err instanceof InvalidParameterError || err instanceof UserOpFailureError) {
14136
+ if (err instanceof ResourceNotFoundError || err instanceof InvalidParameterError2 || err instanceof UserOpFailureError) {
14968
14137
  context.abort();
14969
14138
  }
14970
14139
  };
@@ -15004,68 +14173,82 @@ var sendRequest = async (uri, method, apiKey, body, retryOptions) => {
15004
14173
  const json = await response.json();
15005
14174
  if (response.ok) {
15006
14175
  return json;
15007
- } else if (response.status === 400) {
15008
- throw new InvalidParameterError(
15009
- "InvalidParameter" /* InvalidParameter */,
14176
+ }
14177
+ if (response.status === 400) {
14178
+ throw new InvalidParameterError2(
14179
+ ErrorCode2.InvalidParameter,
14180
+ `bad request ${JSON.stringify(json)}`,
15010
14181
  `bad request ${JSON.stringify(json)}`,
15011
14182
  { body },
15012
14183
  "check the api call parameters. its mostly because some call parameters are wrong",
15013
14184
  "https://docs.fun.xyz"
15014
14185
  );
15015
- } else if (response.status === 403) {
14186
+ }
14187
+ if (response.status === 403) {
15016
14188
  throw new AccessDeniedError(
15017
- "Unauthorized" /* Unauthorized */,
14189
+ ErrorCode2.Unauthorized,
14190
+ "Invalid API key or insufficient access.",
15018
14191
  "Invalid API key or insufficient access.",
15019
14192
  { apiKey },
15020
14193
  "Check your api key at https://app.fun.xyz and check with fun team if you believe something is off",
15021
14194
  "https://docs.fun.xyz"
15022
14195
  );
15023
- } else if (response.status === 404) {
14196
+ }
14197
+ if (response.status === 404) {
15024
14198
  throw new ResourceNotFoundError(
15025
- "ServerMissingData" /* ServerMissingData */,
14199
+ ErrorCode2.ServerMissingData,
14200
+ JSON.stringify(json),
15026
14201
  JSON.stringify(json),
15027
14202
  { body },
15028
14203
  "check the api call parameters. its mostly because some call parameters are wrong",
15029
14204
  "https://docs.fun.xyz"
15030
14205
  );
15031
- } else if (response.status === 429) {
14206
+ }
14207
+ if (response.status === 429) {
15032
14208
  throw new ThrottlingError(
15033
- "RequestLimitExceeded" /* RequestLimitExceeded */,
14209
+ ErrorCode2.RequestLimitExceeded,
14210
+ `too many requests ${JSON.stringify(json)}`,
15034
14211
  `too many requests ${JSON.stringify(json)}`,
15035
14212
  { body },
15036
14213
  "you are making too many requests. please slow down. Reach out to fun team if you need more quota",
15037
14214
  "https://docs.fun.xyz"
15038
14215
  );
15039
- } else if (response.status === 500) {
15040
- if (json.errorCode === "UserOpFailureError" /* UserOpFailureError */) {
14216
+ }
14217
+ if (response.status === 500) {
14218
+ if (json.errorCode === ErrorCode2.UserOpFailureError) {
15041
14219
  throw new UserOpFailureError(
15042
- "UserOpFailureError" /* UserOpFailureError */,
14220
+ ErrorCode2.UserOpFailureError,
14221
+ JSON.stringify(json),
15043
14222
  JSON.stringify(json),
15044
14223
  { body },
15045
14224
  "fix user op failure. Most of the time this is due to invalid parameters",
15046
14225
  "https://docs.fun.xyz"
15047
14226
  );
15048
- } else {
15049
- throw new InternalFailureError(
15050
- "ServerFailure" /* ServerFailure */,
15051
- `server failure ${JSON.stringify(json)}`,
15052
- { body },
15053
- "retry later. if it still fails, please contact us.",
15054
- "https://docs.fun.xyz"
15055
- );
15056
14227
  }
15057
- } else if (response.status === 504) {
15058
14228
  throw new InternalFailureError(
15059
- "ServerTimeout" /* ServerTimeout */,
14229
+ ErrorCode2.ServerFailure,
14230
+ `server failure ${JSON.stringify(json)}`,
14231
+ json.errorMsg,
14232
+ { body },
14233
+ "retry later. if it still fails, please contact us.",
14234
+ "https://docs.fun.xyz"
14235
+ );
14236
+ }
14237
+ if (response.status === 504) {
14238
+ throw new InternalFailureError(
14239
+ ErrorCode2.ServerTimeout,
15060
14240
  `server timeout failure ${JSON.stringify(json)}`,
14241
+ json.errorMsg,
15061
14242
  { body },
15062
14243
  "retry later. if it still fails, please contact us.",
15063
14244
  "https://docs.fun.xyz"
15064
14245
  );
15065
- } else if (!response.ok) {
14246
+ }
14247
+ if (!response.ok) {
15066
14248
  throw new InternalFailureError(
15067
- "UnknownServerError" /* UnknownServerError */,
14249
+ ErrorCode2.UnknownServerError,
15068
14250
  `unknown server failure ${JSON.stringify(json)}`,
14251
+ json.errorMsg,
15069
14252
  { body },
15070
14253
  "retry later. if it still fails, please contact us.",
15071
14254
  "https://docs.fun.xyz"
@@ -15075,8 +14258,9 @@ var sendRequest = async (uri, method, apiKey, body, retryOptions) => {
15075
14258
  }, finalRetryOptions);
15076
14259
  } catch (err) {
15077
14260
  throw new InternalFailureError(
15078
- "ServerConnectionError" /* ServerConnectionError */,
14261
+ ErrorCode2.ServerConnectionError,
15079
14262
  `Cannot connect to Fun API Service ${err}`,
14263
+ "",
15080
14264
  { body },
15081
14265
  "retry later. if it still fails, please contact us.",
15082
14266
  "https://docs.fun.xyz"
@@ -15136,6 +14320,7 @@ async function getGroupsByWallet(walletAddr, chainId) {
15136
14320
  }
15137
14321
 
15138
14322
  // src/apis/InfoApis.ts
14323
+ import { ErrorCode as ErrorCode3, ResourceNotFoundError as ResourceNotFoundError2 } from "@funkit/utils";
15139
14324
  async function getTokenInfo(symbol, chainId) {
15140
14325
  const normalizedSymbol = symbol.toLowerCase();
15141
14326
  const body = {
@@ -15154,8 +14339,9 @@ async function getTokenInfo(symbol, chainId) {
15154
14339
  if (tokenInfo.address) {
15155
14340
  return tokenInfo.address;
15156
14341
  }
15157
- throw new ResourceNotFoundError(
15158
- "TokenNotFound" /* TokenNotFound */,
14342
+ throw new ResourceNotFoundError2(
14343
+ ErrorCode3.TokenNotFound,
14344
+ "token symbol does not exist on provided chain",
15159
14345
  "token symbol does not exist on provided chain",
15160
14346
  { symbol, chainId },
15161
14347
  "Provide correct symbol and chainId.",
@@ -15296,18 +14482,13 @@ async function addTransaction(chainId, timestamp, txid, transaction, paymasterTy
15296
14482
 
15297
14483
  // src/data/Chain.ts
15298
14484
  var Chain = class _Chain {
15299
- initialized = false;
15300
- id;
15301
- name;
15302
- addresses = {};
15303
- currency;
15304
- rpcUrl;
15305
- client;
15306
- static chain;
15307
14485
  constructor(chainInput) {
14486
+ this.initialized = false;
14487
+ this.addresses = {};
15308
14488
  if (!chainInput.chainIdentifier && !chainInput.rpcUrl) {
15309
- throw new InvalidParameterError(
15310
- "InvalidChainIdentifier" /* InvalidChainIdentifier */,
14489
+ throw new InvalidParameterError3(
14490
+ ErrorCode4.InvalidChainIdentifier,
14491
+ "valid chain identifier or rpcUrl is required, could be chainId, chainName, Fun Chain object, or rpcUrl",
15311
14492
  "valid chain identifier or rpcUrl is required, could be chainId, chainName, Fun Chain object, or rpcUrl",
15312
14493
  { chainInput },
15313
14494
  "Please provide valid chain identifier or rpcUrl",
@@ -15402,8 +14583,9 @@ var Chain = class _Chain {
15402
14583
  await this.init();
15403
14584
  const res = this.addresses[name];
15404
14585
  if (!res) {
15405
- throw new ResourceNotFoundError(
15406
- "AddressNotFound" /* AddressNotFound */,
14586
+ throw new ResourceNotFoundError3(
14587
+ ErrorCode4.AddressNotFound,
14588
+ "address not found",
15407
14589
  "address not found",
15408
14590
  { name },
15409
14591
  "Provide correct name to query address",
@@ -15441,9 +14623,10 @@ var Chain = class _Chain {
15441
14623
  async estimateOpGas(partialOp) {
15442
14624
  await this.init();
15443
14625
  if (!this.addresses || !this.addresses.entryPointAddress) {
15444
- throw new InternalFailureError(
15445
- "AddressNotFound" /* AddressNotFound */,
14626
+ throw new InternalFailureError2(
14627
+ ErrorCode4.AddressNotFound,
15446
14628
  "entryPointAddress is required",
14629
+ "",
15447
14630
  { partialOp },
15448
14631
  "This is an internal error, please contact support.",
15449
14632
  "https://docs.fun.xyz"
@@ -15515,13 +14698,14 @@ var Chain = class _Chain {
15515
14698
 
15516
14699
  // src/data/NFT.ts
15517
14700
  import { isAddress as isAddress2 } from "viem";
14701
+ import { ErrorCode as ErrorCode5, InvalidParameterError as InvalidParameterError4 } from "@funkit/utils";
15518
14702
  var NFT = class _NFT {
15519
- address;
15520
- name = "";
15521
14703
  constructor(input) {
14704
+ this.name = "";
15522
14705
  if (!input) {
15523
- throw new InvalidParameterError(
15524
- "InvalidNFTIdentifier" /* InvalidNFTIdentifier */,
14706
+ throw new InvalidParameterError4(
14707
+ ErrorCode5.InvalidNFTIdentifier,
14708
+ "valid NFT identifier is required, could be address or name",
15525
14709
  "valid NFT identifier is required, could be address or name",
15526
14710
  { input },
15527
14711
  "Please provide valid NFT identifier",
@@ -15564,8 +14748,9 @@ var NFT = class _NFT {
15564
14748
  async getAddress() {
15565
14749
  if (!this.address) {
15566
14750
  if (!this.name) {
15567
- throw new InvalidParameterError(
15568
- "InvalidNFTIdentifier" /* InvalidNFTIdentifier */,
14751
+ throw new InvalidParameterError4(
14752
+ ErrorCode5.InvalidNFTIdentifier,
14753
+ "valid NFT identifier is required, could be address or name",
15569
14754
  "valid NFT identifier is required, could be address or name",
15570
14755
  {},
15571
14756
  "Please provide valid NFT identifier",
@@ -15654,28 +14839,6 @@ var NFT = class _NFT {
15654
14839
 
15655
14840
  // src/data/Operation.ts
15656
14841
  var Operation = class _Operation {
15657
- opId;
15658
- chainId;
15659
- opType;
15660
- authType;
15661
- groupId;
15662
- message;
15663
- walletAddr;
15664
- userOp;
15665
- status;
15666
- proposer;
15667
- // do not use address in case we later use non-address data as the proposer
15668
- proposedTime;
15669
- executedBy;
15670
- executedTime;
15671
- relatedOpIds;
15672
- signatures;
15673
- txid;
15674
- gasUsed;
15675
- opFeeUSD;
15676
- opFee;
15677
- executedBlockNumber;
15678
- executedBlockTimeStamp;
15679
14842
  constructor(userOp, metadata) {
15680
14843
  this.userOp = userOp;
15681
14844
  this.userOp.preVerificationGas = userOp.preVerificationGas ? userOp.preVerificationGas : calcPreVerificationGas(this.userOp);
@@ -15835,13 +14998,16 @@ function toBytes32Arr(data) {
15835
14998
 
15836
14999
  // src/data/Token.ts
15837
15000
  import { formatUnits as formatUnits2, isAddress as isAddress3, parseUnits as parseUnits2 } from "viem";
15001
+ import {
15002
+ ErrorCode as ErrorCode6,
15003
+ InternalFailureError as InternalFailureError3,
15004
+ InvalidParameterError as InvalidParameterError5
15005
+ } from "@funkit/utils";
15838
15006
  var wrappedNativeTokens = { eth: "weth", matic: "wmatic", mnt: "wmnt" };
15839
15007
  var Token2 = class _Token {
15840
- address;
15841
- chain;
15842
- isNative = false;
15843
- symbol = "";
15844
15008
  constructor(input, chain) {
15009
+ this.isNative = false;
15010
+ this.symbol = "";
15845
15011
  this.chain = chain;
15846
15012
  if (isAddress3(input)) {
15847
15013
  this.address = input;
@@ -15856,19 +15022,21 @@ var Token2 = class _Token {
15856
15022
  if (this.isNative) {
15857
15023
  const nativeName = wrappedNativeTokens[this.symbol];
15858
15024
  return await getTokenInfo(nativeName, chainId);
15859
- } else if (this.address) {
15025
+ }
15026
+ if (this.address) {
15860
15027
  return this.address;
15861
- } else if (this.symbol) {
15028
+ }
15029
+ if (this.symbol) {
15862
15030
  return await getTokenInfo(this.symbol, chainId);
15863
- } else {
15864
- throw new InternalFailureError(
15865
- "ServerMissingData" /* ServerMissingData */,
15866
- "server missing token symbol and address info",
15867
- { symbol: this.symbol, address: this.address, isNative: this.isNative },
15868
- "Please check token symbol and address. If things look correct, contract fun support for help",
15869
- "https://docs.fun.xyz"
15870
- );
15871
15031
  }
15032
+ throw new InternalFailureError3(
15033
+ ErrorCode6.ServerMissingData,
15034
+ "server missing token symbol and address info",
15035
+ "",
15036
+ { symbol: this.symbol, address: this.address, isNative: this.isNative },
15037
+ "Please check token symbol and address. If things look correct, contract fun support for help",
15038
+ "https://docs.fun.xyz"
15039
+ );
15872
15040
  }
15873
15041
  async getDecimals() {
15874
15042
  if (this.isNative) {
@@ -15904,8 +15072,9 @@ var Token2 = class _Token {
15904
15072
  }
15905
15073
  async getApproval(owner, spender) {
15906
15074
  if (this.isNative) {
15907
- throw new InvalidParameterError(
15908
- "InvalidParameter" /* InvalidParameter */,
15075
+ throw new InvalidParameterError5(
15076
+ ErrorCode6.InvalidParameter,
15077
+ "Native token can not approve",
15909
15078
  "Native token can not approve",
15910
15079
  { isNative: this.isNative },
15911
15080
  "No need to approve native token",
@@ -16006,7 +15175,6 @@ var OperationStatus = /* @__PURE__ */ ((OperationStatus2) => {
16006
15175
 
16007
15176
  // src/viem/ContractInterface.ts
16008
15177
  var ContractInterface = class {
16009
- abi;
16010
15178
  constructor(abi) {
16011
15179
  this.abi = abi;
16012
15180
  }
@@ -16584,7 +15752,7 @@ async function getUserUniqueId(authId) {
16584
15752
  try {
16585
15753
  return (await sendGetRequest(API_URL, `user/auth/${authId}/unique-id`)).userUniqueId;
16586
15754
  } catch (err) {
16587
- if (err instanceof ResourceNotFoundError) {
15755
+ if (err instanceof ResourceNotFoundError4) {
16588
15756
  return "";
16589
15757
  }
16590
15758
  throw err;
@@ -16612,7 +15780,7 @@ async function addUserToWallet(authId, chainId, walletAddr, userIds, walletUniqu
16612
15780
  }
16613
15781
  );
16614
15782
  } catch (err) {
16615
- if (err instanceof InvalidParameterError2) {
15783
+ if (err instanceof InvalidParameterError6) {
16616
15784
  return;
16617
15785
  }
16618
15786
  }
@@ -16715,12 +15883,8 @@ chains.funtestnet = {
16715
15883
  rpcUrls: { default: { http: [] }, public: { http: [] } }
16716
15884
  };
16717
15885
  var Auth = class {
16718
- authId;
16719
- signer;
16720
- client;
16721
- inited = false;
16722
- account;
16723
15886
  constructor(authInput) {
15887
+ this.inited = false;
16724
15888
  if (authInput.web2AuthId) {
16725
15889
  this.authId = authInput.web2AuthId;
16726
15890
  }
@@ -16745,8 +15909,9 @@ var Auth = class {
16745
15909
  } else if (!isHex2(authInput.privateKey) && authInput.privateKey.length === VALID_PRIVATE_KEY_LENGTH) {
16746
15910
  privateKey = `0x${authInput.privateKey}`;
16747
15911
  } else {
16748
- throw new InvalidParameterError(
16749
- "InvalidParameter" /* InvalidParameter */,
15912
+ throw new InvalidParameterError7(
15913
+ ErrorCode7.InvalidParameter,
15914
+ "privateKey is not a valid one",
16750
15915
  "privateKey is not a valid one",
16751
15916
  authInput.privateKey,
16752
15917
  "Provide valid privateKey string",
@@ -16755,8 +15920,9 @@ var Auth = class {
16755
15920
  }
16756
15921
  this.signer = privateKeyToAccount(privateKey);
16757
15922
  } else {
16758
- throw new InvalidParameterError(
16759
- "MissingParameter" /* MissingParameter */,
15923
+ throw new InvalidParameterError7(
15924
+ ErrorCode7.MissingParameter,
15925
+ "valid authInput is required",
16760
15926
  "valid authInput is required",
16761
15927
  authInput,
16762
15928
  "Provide viem client, privateKey, window eth (check viem.sh), rpc signer, provider, or signer when constructing Auth",
@@ -16877,8 +16043,9 @@ var Auth = class {
16877
16043
  const { to, data } = txData;
16878
16044
  const { value = 0n } = txData;
16879
16045
  if (!chain || !chainId) {
16880
- throw new InvalidParameterError(
16881
- "MissingParameter" /* MissingParameter */,
16046
+ throw new InvalidParameterError7(
16047
+ ErrorCode7.MissingParameter,
16048
+ "chain object is missing or incorrect",
16882
16049
  "chain object is missing or incorrect",
16883
16050
  { options, chainId },
16884
16051
  "Provide proper chain information from options field",
@@ -16978,7 +16145,7 @@ var Auth = class {
16978
16145
  try {
16979
16146
  return await getUserWalletsByAddr(await this.getAddress(), chainId);
16980
16147
  } catch (err) {
16981
- if (err instanceof ResourceNotFoundError) {
16148
+ if (err instanceof ResourceNotFoundError5) {
16982
16149
  return [];
16983
16150
  }
16984
16151
  throw err;
@@ -17019,10 +16186,6 @@ var getSigHash = (abi, functionName) => {
17019
16186
  // src/auth/SessionKeyAuth.ts
17020
16187
  var SELECTOR_LENGTH = 10;
17021
16188
  var SessionKeyAuth = class extends Auth {
17022
- ruleId;
17023
- roleId;
17024
- targetSelectorMerkleTree;
17025
- feeRecipientMerkleTree;
17026
16189
  constructor(authInput, ruleId, roleId, targetSelectorMerkleTree, feeRecipientMerkleTree) {
17027
16190
  super(authInput);
17028
16191
  this.ruleId = ruleId;
@@ -17205,7 +16368,6 @@ var verifyPath = (root, item, path) => {
17205
16368
  return hash === root;
17206
16369
  };
17207
16370
  var MerkleTree = class {
17208
- tree;
17209
16371
  constructor(list) {
17210
16372
  this.tree = createMerkleHashes(list);
17211
16373
  }
@@ -17253,8 +16415,9 @@ var createTargetSelectorMerkleTree = (params) => {
17253
16415
  };
17254
16416
  var createSessionKeyTransactionParams = async (params, txOptions = globalThis.globalEnvOption) => {
17255
16417
  if (params.targetWhitelist.length === 0) {
17256
- throw new InvalidParameterError(
17257
- "MissingParameter" /* MissingParameter */,
16418
+ throw new InvalidParameterError8(
16419
+ ErrorCode8.MissingParameter,
16420
+ "targetWhitelist is required",
17258
16421
  "targetWhitelist is required",
17259
16422
  { params },
17260
16423
  "Provide targetWhitelist when creating a session key.",
@@ -17262,8 +16425,9 @@ var createSessionKeyTransactionParams = async (params, txOptions = globalThis.gl
17262
16425
  );
17263
16426
  }
17264
16427
  if (params.userId === void 0) {
17265
- throw new InvalidParameterError(
17266
- "MissingParameter" /* MissingParameter */,
16428
+ throw new InvalidParameterError8(
16429
+ ErrorCode8.MissingParameter,
16430
+ "userId is required",
17267
16431
  "userId is required",
17268
16432
  { params },
17269
16433
  "Provide userId when creating a session key.",
@@ -17395,6 +16559,11 @@ var removeGroupTxParams = async (params, txOptions = globalThis.globalEnvOption)
17395
16559
 
17396
16560
  // src/actions/Stake.ts
17397
16561
  import { isAddress as isAddress4, parseEther as parseEther2 } from "viem";
16562
+ import {
16563
+ ErrorCode as ErrorCode9,
16564
+ InternalFailureError as InternalFailureError4,
16565
+ InvalidParameterError as InvalidParameterError9
16566
+ } from "@funkit/utils";
17398
16567
  var getWithdrawQueueInterface = () => {
17399
16568
  return new ContractInterface(WITHDRAW_QUEUE_ABI);
17400
16569
  };
@@ -17411,8 +16580,9 @@ var stakeTransactionParams = async (params, txOptions = globalThis.globalEnvOpti
17411
16580
  };
17412
16581
  var requestUnstakeTransactionParams = async (params, txOptions = globalThis.globalEnvOption) => {
17413
16582
  if (!isAddress4(params.recipient ?? "")) {
17414
- throw new InvalidParameterError(
17415
- "InvalidParameter" /* InvalidParameter */,
16583
+ throw new InvalidParameterError9(
16584
+ ErrorCode9.InvalidParameter,
16585
+ "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17416
16586
  "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17417
16587
  { params },
17418
16588
  "Please make sure it is a valid checksum address",
@@ -17424,8 +16594,9 @@ var requestUnstakeTransactionParams = async (params, txOptions = globalThis.glob
17424
16594
  const steth = getSteth(chainId);
17425
16595
  const withdrawalQueue = getWithdrawalQueue(chainId);
17426
16596
  if (!steth || !withdrawalQueue || steth.length === 0 || withdrawalQueue.length === 0) {
17427
- throw new InvalidParameterError(
17428
- "ChainNotSupported" /* ChainNotSupported */,
16597
+ throw new InvalidParameterError9(
16598
+ ErrorCode9.ChainNotSupported,
16599
+ "Incorrect chainId, staking only available on Ethereum mainnet and Goerli",
17429
16600
  "Incorrect chainId, staking only available on Ethereum mainnet and Goerli",
17430
16601
  { params },
17431
16602
  "Provide correct chainId.",
@@ -17458,8 +16629,9 @@ var requestUnstakeTransactionParams = async (params, txOptions = globalThis.glob
17458
16629
  };
17459
16630
  var finishUnstakeTransactionParams = async (params, txOptions = globalThis.globalEnvOption) => {
17460
16631
  if (!isAddress4(params.recipient ?? "")) {
17461
- throw new InvalidParameterError(
17462
- "InvalidParameter" /* InvalidParameter */,
16632
+ throw new InvalidParameterError9(
16633
+ ErrorCode9.InvalidParameter,
16634
+ "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17463
16635
  "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17464
16636
  { params },
17465
16637
  "Please make sure it is a valid checksum address",
@@ -17470,8 +16642,9 @@ var finishUnstakeTransactionParams = async (params, txOptions = globalThis.globa
17470
16642
  const withdrawQueueAddress = getWithdrawalQueue(await chain.getChainId());
17471
16643
  const readyToWithdrawRequestIds = (await getReadyToWithdrawRequests(params, txOptions)).slice(0, 5);
17472
16644
  if (readyToWithdrawRequestIds.length === 0) {
17473
- throw new InvalidParameterError(
17474
- "InvalidParameter" /* InvalidParameter */,
16645
+ throw new InvalidParameterError9(
16646
+ ErrorCode9.InvalidParameter,
16647
+ "Not ready to withdraw requests",
17475
16648
  "Not ready to withdraw requests",
17476
16649
  { params },
17477
16650
  "Please wait a bit.",
@@ -17491,9 +16664,10 @@ var finishUnstakeTransactionParams = async (params, txOptions = globalThis.globa
17491
16664
  chain
17492
16665
  );
17493
16666
  if (!hints) {
17494
- throw new InternalFailureError(
17495
- "CheckPointHintsNotFound" /* CheckPointHintsNotFound */,
16667
+ throw new InternalFailureError4(
16668
+ ErrorCode9.CheckPointHintsNotFound,
17496
16669
  "lido checkpoint hints are not found when batching the withdrawal",
16670
+ "",
17497
16671
  { params, readyToWithdrawRequestIds, lastCheckpoint, hints },
17498
16672
  "Retry later.",
17499
16673
  "https://docs.fun.xyz"
@@ -17507,8 +16681,9 @@ var finishUnstakeTransactionParams = async (params, txOptions = globalThis.globa
17507
16681
  };
17508
16682
  var getReadyToWithdrawRequests = async (params, txOptions) => {
17509
16683
  if (!isAddress4(params.recipient ?? "")) {
17510
- throw new InvalidParameterError(
17511
- "InvalidParameter" /* InvalidParameter */,
16684
+ throw new InvalidParameterError9(
16685
+ ErrorCode9.InvalidParameter,
16686
+ "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17512
16687
  "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17513
16688
  { params },
17514
16689
  "Please make sure it is a valid checksum address",
@@ -17551,8 +16726,9 @@ var getWithdrawalQueue = (chainId) => {
17551
16726
  case 36865:
17552
16727
  return "0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1";
17553
16728
  default:
17554
- throw new InvalidParameterError(
17555
- "ChainNotSupported" /* ChainNotSupported */,
16729
+ throw new InvalidParameterError9(
16730
+ ErrorCode9.ChainNotSupported,
16731
+ "Incorrect chainId, staking only available on Ethereum mainnet and Goerli",
17556
16732
  "Incorrect chainId, staking only available on Ethereum mainnet and Goerli",
17557
16733
  { chainId },
17558
16734
  "Provide correct chainId.",
@@ -17569,8 +16745,9 @@ var getSteth = (chainId) => {
17569
16745
  case 36865:
17570
16746
  return "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84";
17571
16747
  default:
17572
- throw new InvalidParameterError(
17573
- "ChainNotSupported" /* ChainNotSupported */,
16748
+ throw new InvalidParameterError9(
16749
+ ErrorCode9.ChainNotSupported,
16750
+ "Incorrect chainId, staking only available on Ethereum mainnet and Goerli",
17574
16751
  "Incorrect chainId, staking only available on Ethereum mainnet and Goerli",
17575
16752
  { chainId },
17576
16753
  "Provide correct chainId.",
@@ -17581,6 +16758,7 @@ var getSteth = (chainId) => {
17581
16758
 
17582
16759
  // src/actions/Swap.ts
17583
16760
  import { isAddress as isAddress5 } from "viem";
16761
+ import { ErrorCode as ErrorCode10, InvalidParameterError as InvalidParameterError10 } from "@funkit/utils";
17584
16762
 
17585
16763
  // src/apis/SwapApis.ts
17586
16764
  async function get1InchSwapTx(chainId, src, dst, amount, from, slippage, disableEstimate, allowPartialFill) {
@@ -17685,8 +16863,9 @@ var getOneInchSwapTx = async (oneinchSwapParams) => {
17685
16863
  var oneInchTransactionParams = async (params, walletAddress, txOptions = globalThis.globalEnvOption) => {
17686
16864
  const chain = await Chain.getChain({ chainIdentifier: txOptions.chain });
17687
16865
  if (!oneInchSupported.includes(Number(await chain.getChainId()))) {
17688
- throw new InvalidParameterError(
17689
- "ChainNotSupported" /* ChainNotSupported */,
16866
+ throw new InvalidParameterError10(
16867
+ ErrorCode10.ChainNotSupported,
16868
+ "Incorrect chainId, oneInch only available on Ethereum mainnet and polygon",
17690
16869
  "Incorrect chainId, oneInch only available on Ethereum mainnet and polygon",
17691
16870
  { params },
17692
16871
  "Provide correct chainId.",
@@ -17694,8 +16873,9 @@ var oneInchTransactionParams = async (params, walletAddress, txOptions = globalT
17694
16873
  );
17695
16874
  }
17696
16875
  if (!isAddress5(params.recipient ?? "")) {
17697
- throw new InvalidParameterError(
17698
- "InvalidParameter" /* InvalidParameter */,
16876
+ throw new InvalidParameterError10(
16877
+ ErrorCode10.InvalidParameter,
16878
+ "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17699
16879
  "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17700
16880
  { params },
17701
16881
  "Please make sure it is a valid checksum address",
@@ -17752,8 +16932,9 @@ var uniswapV3SwapTransactionParams = async (params, txOptions = globalThis.globa
17752
16932
  slippage *= 10;
17753
16933
  }
17754
16934
  if (!isAddress5(params.recipient ?? "")) {
17755
- throw new InvalidParameterError(
17756
- "InvalidParameter" /* InvalidParameter */,
16935
+ throw new InvalidParameterError10(
16936
+ ErrorCode10.InvalidParameter,
16937
+ "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17757
16938
  "Recipient address is not a valid address, please make sure it is a valid checksum address.",
17758
16939
  { params },
17759
16940
  "Please make sure it is a valid checksum address",
@@ -17844,6 +17025,7 @@ var uniswapV2SwapTransactionParams = async (params, txOptions = globalThis.globa
17844
17025
 
17845
17026
  // src/actions/Token.ts
17846
17027
  import { isAddress as isAddress6, parseEther as parseEther3 } from "viem";
17028
+ import { ErrorCode as ErrorCode11, InvalidParameterError as InvalidParameterError11 } from "@funkit/utils";
17847
17029
  var isERC721TransferParams = (obj) => {
17848
17030
  return "tokenId" in obj;
17849
17031
  };
@@ -17853,8 +17035,9 @@ var isTokenTransferParams = (obj) => {
17853
17035
  var erc721TransferTransactionParams = async (params) => {
17854
17036
  const { to, tokenId, collection, from } = params;
17855
17037
  if (!isAddress6(to ?? "") || !isAddress6(from ?? "")) {
17856
- throw new InvalidParameterError(
17857
- "InvalidParameter" /* InvalidParameter */,
17038
+ throw new InvalidParameterError11(
17039
+ ErrorCode11.InvalidParameter,
17040
+ "To/from address is not a valid address, please make sure it is a valid checksum address.",
17858
17041
  "To/from address is not a valid address, please make sure it is a valid checksum address.",
17859
17042
  { params },
17860
17043
  "Please make sure it is a valid checksum address",
@@ -17871,8 +17054,9 @@ var erc721TransferTransactionParams = async (params) => {
17871
17054
  var tokenTransferTransactionParams = async (params, chain) => {
17872
17055
  const { to, amount, token } = params;
17873
17056
  if (!isAddress6(to)) {
17874
- throw new InvalidParameterError(
17875
- "InvalidParameter" /* InvalidParameter */,
17057
+ throw new InvalidParameterError11(
17058
+ ErrorCode11.InvalidParameter,
17059
+ "To address is not a valid address, please make sure it is a valid checksum address.",
17876
17060
  "To address is not a valid address, please make sure it is a valid checksum address.",
17877
17061
  { params },
17878
17062
  "Please make sure it is a valid checksum address",
@@ -17886,30 +17070,31 @@ var tokenTransferTransactionParams = async (params, chain) => {
17886
17070
  data: "0x",
17887
17071
  value: parseEther3(`${amount}`)
17888
17072
  };
17889
- } else {
17890
- const tokenAddr = await tokenObj.getAddress();
17891
- if (!tokenAddr) {
17892
- throw new InvalidParameterError(
17893
- "TokenNotFound" /* TokenNotFound */,
17894
- "Token address not found. Please check the token passed in.",
17895
- { params },
17896
- "Provide correct token.",
17897
- "https://docs.fun.xyz"
17898
- );
17899
- }
17900
- const convertedAmount = await tokenObj.getDecimalAmount(amount);
17901
- return ERC20_CONTRACT_INTERFACE.encodeTransactionParams(
17902
- tokenAddr,
17903
- "transfer",
17904
- [to, convertedAmount]
17073
+ }
17074
+ const tokenAddr = await tokenObj.getAddress();
17075
+ if (!tokenAddr) {
17076
+ throw new InvalidParameterError11(
17077
+ ErrorCode11.TokenNotFound,
17078
+ "Token address not found. Please check the token passed in.",
17079
+ "Token address not found. Please check the token passed in.",
17080
+ { params },
17081
+ "Provide correct token.",
17082
+ "https://docs.fun.xyz"
17905
17083
  );
17906
17084
  }
17085
+ const convertedAmount = await tokenObj.getDecimalAmount(amount);
17086
+ return ERC20_CONTRACT_INTERFACE.encodeTransactionParams(
17087
+ tokenAddr,
17088
+ "transfer",
17089
+ [to, convertedAmount]
17090
+ );
17907
17091
  };
17908
17092
  var tokenTransferFromTransactionParams = async (params, chain) => {
17909
17093
  const { to, amount, token, from } = params;
17910
17094
  if (!isAddress6(to ?? "") || !isAddress6(from ?? "")) {
17911
- throw new InvalidParameterError(
17912
- "InvalidParameter" /* InvalidParameter */,
17095
+ throw new InvalidParameterError11(
17096
+ ErrorCode11.InvalidParameter,
17097
+ "To/from address is not a valid address, please make sure it is a valid checksum address.",
17913
17098
  "To/from address is not a valid address, please make sure it is a valid checksum address.",
17914
17099
  { params },
17915
17100
  "Please make sure it is a valid checksum address",
@@ -17923,24 +17108,24 @@ var tokenTransferFromTransactionParams = async (params, chain) => {
17923
17108
  data: "0x",
17924
17109
  value: parseEther3(`${amount}`)
17925
17110
  };
17926
- } else {
17927
- const tokenAddr = await tokenObj.getAddress();
17928
- if (!tokenAddr) {
17929
- throw new InvalidParameterError(
17930
- "TokenNotFound" /* TokenNotFound */,
17931
- "Token address not found. Please check the token passed in.",
17932
- { params },
17933
- "Provide correct token.",
17934
- "https://docs.fun.xyz"
17935
- );
17936
- }
17937
- const convertedAmount = await tokenObj.getDecimalAmount(amount);
17938
- return ERC20_CONTRACT_INTERFACE.encodeTransactionParams(
17939
- tokenAddr,
17940
- "transferFrom",
17941
- [from, to, convertedAmount]
17111
+ }
17112
+ const tokenAddr = await tokenObj.getAddress();
17113
+ if (!tokenAddr) {
17114
+ throw new InvalidParameterError11(
17115
+ ErrorCode11.TokenNotFound,
17116
+ "Token address not found. Please check the token passed in.",
17117
+ "Token address not found. Please check the token passed in.",
17118
+ { params },
17119
+ "Provide correct token.",
17120
+ "https://docs.fun.xyz"
17942
17121
  );
17943
17122
  }
17123
+ const convertedAmount = await tokenObj.getDecimalAmount(amount);
17124
+ return ERC20_CONTRACT_INTERFACE.encodeTransactionParams(
17125
+ tokenAddr,
17126
+ "transferFrom",
17127
+ [from, to, convertedAmount]
17128
+ );
17944
17129
  };
17945
17130
  var isERC20ApproveParams = (obj) => {
17946
17131
  return "amount" in obj && "token" in obj;
@@ -17951,8 +17136,9 @@ var isERC721ApproveParams = (obj) => {
17951
17136
  var erc20ApproveTransactionParams = async (params) => {
17952
17137
  const { spender, amount, token } = params;
17953
17138
  if (!isAddress6(spender ?? "")) {
17954
- throw new InvalidParameterError(
17955
- "InvalidParameter" /* InvalidParameter */,
17139
+ throw new InvalidParameterError11(
17140
+ ErrorCode11.InvalidParameter,
17141
+ "Spender address is not a valid address, please make sure it is a valid checksum address.",
17956
17142
  "Spender address is not a valid address, please make sure it is a valid checksum address.",
17957
17143
  { params },
17958
17144
  "Please make sure it is a valid checksum address",
@@ -17973,8 +17159,9 @@ var erc20ApproveTransactionParams = async (params) => {
17973
17159
  var erc721ApproveTransactionParams = async (params) => {
17974
17160
  const { spender, tokenId, collection } = params;
17975
17161
  if (!isAddress6(spender ?? "")) {
17976
- throw new InvalidParameterError(
17977
- "InvalidParameter" /* InvalidParameter */,
17162
+ throw new InvalidParameterError11(
17163
+ ErrorCode11.InvalidParameter,
17164
+ "Spender address is not a valid address, please make sure it is a valid checksum address.",
17978
17165
  "Spender address is not a valid address, please make sure it is a valid checksum address.",
17979
17166
  { params },
17980
17167
  "Please make sure it is a valid checksum address",
@@ -17990,6 +17177,7 @@ var erc721ApproveTransactionParams = async (params) => {
17990
17177
  };
17991
17178
 
17992
17179
  // src/config/Config.ts
17180
+ import { ErrorCode as ErrorCode12, InvalidParameterError as InvalidParameterError12 } from "@funkit/utils";
17993
17181
  function getEnvOptions() {
17994
17182
  return globalThis.globalEnvOption;
17995
17183
  }
@@ -18005,8 +17193,9 @@ async function configureEnvironment(option) {
18005
17193
  const globalEnvOption = global.globalEnvOption;
18006
17194
  globalEnvOption.apiKey = option.apiKey ? option.apiKey : globalEnvOption.apiKey;
18007
17195
  if (!globalEnvOption.apiKey) {
18008
- throw new InvalidParameterError(
18009
- "MissingParameter" /* MissingParameter */,
17196
+ throw new InvalidParameterError12(
17197
+ ErrorCode12.MissingParameter,
17198
+ "apiKey is required",
18010
17199
  "apiKey is required",
18011
17200
  { option },
18012
17201
  "Provide apiKey when configureEnvironment.",
@@ -18034,14 +17223,24 @@ async function configureEnvironment(option) {
18034
17223
  globalEnvOption.skipDBAction = option.skipDBAction === null || option.skipDBAction === void 0 ? globalEnvOption.skipDBAction : option.skipDBAction;
18035
17224
  }
18036
17225
 
17226
+ // src/errors/clientErrors.ts
17227
+ import { ClientError, ErrorType } from "@funkit/utils";
17228
+ var InvalidActionError = class extends ClientError {
17229
+ constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
17230
+ super(
17231
+ ErrorType.InvalidAction,
17232
+ code,
17233
+ msg,
17234
+ msg,
17235
+ paramsUsed,
17236
+ fixSuggestion,
17237
+ docLink
17238
+ );
17239
+ }
17240
+ };
17241
+
18037
17242
  // src/sponsors/Sponsor.ts
18038
17243
  var Sponsor = class {
18039
- sponsorAddress;
18040
- contractInterface;
18041
- name;
18042
- paymasterAddress;
18043
- paymasterType;
18044
- chainId;
18045
17244
  constructor(options, contractInterface, name, paymasterType) {
18046
17245
  if (options.gasSponsor !== void 0 && options.gasSponsor.sponsorAddress !== void 0) {
18047
17246
  this.sponsorAddress = options.gasSponsor.sponsorAddress;
@@ -18236,6 +17435,7 @@ var CheckoutSponsor = class extends Sponsor {
18236
17435
 
18237
17436
  // src/sponsors/GaslessSponsor.ts
18238
17437
  import { concat as concat3 } from "viem";
17438
+ import { ErrorCode as ErrorCode13, ResourceNotFoundError as ResourceNotFoundError6 } from "@funkit/utils";
18239
17439
  var GaslessSponsor = class extends Sponsor {
18240
17440
  constructor(options = globalThis.globalEnvOption) {
18241
17441
  super(
@@ -18251,8 +17451,9 @@ var GaslessSponsor = class extends Sponsor {
18251
17451
  if (GASLESS_SPONSOR_SUPPORT_CHAINS.includes(await chain.getChainId())) {
18252
17452
  this.sponsorAddress = await chain.getAddress("funGaslessSponsorAddress");
18253
17453
  } else {
18254
- throw new ResourceNotFoundError(
18255
- "MissingParameter" /* MissingParameter */,
17454
+ throw new ResourceNotFoundError6(
17455
+ ErrorCode13.MissingParameter,
17456
+ "The network you are working with does not support gasless Fun Sponsor. You will need to run and manage your own gasless sponsor.",
18256
17457
  "The network you are working with does not support gasless Fun Sponsor. You will need to run and manage your own gasless sponsor.",
18257
17458
  {
18258
17459
  gaslessSponsorSupportChains: GASLESS_SPONSOR_SUPPORT_CHAINS,
@@ -18354,8 +17555,12 @@ var GaslessSponsor = class extends Sponsor {
18354
17555
 
18355
17556
  // src/sponsors/TokenSponsor.ts
18356
17557
  import { concat as concat4, encodeAbiParameters as encodeAbiParameters4 } from "viem";
17558
+ import {
17559
+ ErrorCode as ErrorCode14,
17560
+ InvalidParameterError as InvalidParameterError13,
17561
+ ResourceNotFoundError as ResourceNotFoundError7
17562
+ } from "@funkit/utils";
18357
17563
  var TokenSponsor = class extends Sponsor {
18358
- token;
18359
17564
  constructor(options = globalThis.globalEnvOption) {
18360
17565
  super(
18361
17566
  options,
@@ -18364,8 +17569,9 @@ var TokenSponsor = class extends Sponsor {
18364
17569
  "token" /* TokenSponsor */
18365
17570
  );
18366
17571
  if (!options.gasSponsor?.token) {
18367
- throw new InvalidParameterError(
18368
- "MissingParameter" /* MissingParameter */,
17572
+ throw new InvalidParameterError13(
17573
+ ErrorCode14.MissingParameter,
17574
+ "token field is missing",
18369
17575
  "token field is missing",
18370
17576
  { gasSponsor: options.gasSponsor },
18371
17577
  "Provide correct token name or address.",
@@ -18380,8 +17586,9 @@ var TokenSponsor = class extends Sponsor {
18380
17586
  if (TOKEN_SPONSOR_SUPPORT_CHAINS.includes(await chain.getChainId())) {
18381
17587
  this.sponsorAddress = await chain.getAddress("funTokenSponsorAddress");
18382
17588
  } else {
18383
- throw new ResourceNotFoundError(
18384
- "MissingParameter" /* MissingParameter */,
17589
+ throw new ResourceNotFoundError7(
17590
+ ErrorCode14.MissingParameter,
17591
+ "The network you are working with does not support token Fun Sponsor. You will need to run and manage your own token sponsor.",
18385
17592
  "The network you are working with does not support token Fun Sponsor. You will need to run and manage your own token sponsor.",
18386
17593
  {
18387
17594
  tokenSponsorSupportChains: TOKEN_SPONSOR_SUPPORT_CHAINS,
@@ -18733,9 +17940,6 @@ import {
18733
17940
  getAllWalletNFTsByChainId,
18734
17941
  getAllWalletTokens,
18735
17942
  getAllWalletTokensByChainId,
18736
- getMoonpayOffRampUrl,
18737
- getMoonpayOnRampSupportedCurrencies,
18738
- getMoonpayOnRampUrl,
18739
17943
  getWalletLidoWithdrawalsByChainId
18740
17944
  } from "@funkit/api-base";
18741
17945
  import {
@@ -18749,9 +17953,20 @@ import {
18749
17953
  pad as pad9,
18750
17954
  toBytes as toBytes7
18751
17955
  } from "viem";
17956
+ import {
17957
+ ErrorCode as ErrorCode18,
17958
+ InternalFailureError as InternalFailureError5,
17959
+ InvalidParameterError as InvalidParameterError16
17960
+ } from "@funkit/utils";
18752
17961
 
18753
17962
  // src/actions/FirstClassActions.ts
18754
17963
  import { pad as pad8 } from "viem";
17964
+ import {
17965
+ ErrorCode as ErrorCode17,
17966
+ InvalidParameterError as InvalidParameterError15,
17967
+ ResourceNotFoundError as ResourceNotFoundError9,
17968
+ safeParseJson as safeParseJson2
17969
+ } from "@funkit/utils";
18755
17970
 
18756
17971
  // src/utils/GroupUtils.ts
18757
17972
  import {
@@ -18790,7 +18005,11 @@ async function getOnChainGroupData(groupId, chain, walletAddr) {
18790
18005
  }
18791
18006
  }
18792
18007
 
18008
+ // src/actions/Bridge.ts
18009
+ import { ErrorCode as ErrorCode16, InvalidParameterError as InvalidParameterError14 } from "@funkit/utils";
18010
+
18793
18011
  // src/apis/BridgeApis.ts
18012
+ import { ErrorCode as ErrorCode15, ResourceNotFoundError as ResourceNotFoundError8 } from "@funkit/utils";
18794
18013
  async function getSocketBridgeQuote(recipient, walletAddress, fromChain, toChain, fromToken, toToken, amount, sort) {
18795
18014
  const params = new URLSearchParams({
18796
18015
  recipient,
@@ -18806,8 +18025,9 @@ async function getSocketBridgeQuote(recipient, walletAddress, fromChain, toChain
18806
18025
  }).toString();
18807
18026
  const quote = await sendGetRequest(API_URL, `bridge/quote/?${params}`);
18808
18027
  if (!quote.success || quote.result.routes.length === 0) {
18809
- throw new ResourceNotFoundError(
18810
- "BridgeRouteNotFound" /* BridgeRouteNotFound */,
18028
+ throw new ResourceNotFoundError8(
18029
+ ErrorCode15.BridgeRouteNotFound,
18030
+ "Unable to find a route for these assets between these chains",
18811
18031
  "Unable to find a route for these assets between these chains",
18812
18032
  { walletAddress, fromChain, toChain, fromToken, toToken, amount, sort },
18813
18033
  "Try another route with a different asset pair",
@@ -18832,8 +18052,9 @@ async function getSocketBridgeAllowance(chainId, sender, allowanceTarget, token)
18832
18052
  `bridge/approval/check-allowance/?${params}`
18833
18053
  );
18834
18054
  if (!json.result.value) {
18835
- throw new ResourceNotFoundError(
18836
- "BridgeAllowanceDataNotFound" /* BridgeAllowanceDataNotFound */,
18055
+ throw new ResourceNotFoundError8(
18056
+ ErrorCode15.BridgeAllowanceDataNotFound,
18057
+ "Unable to get allowance data",
18837
18058
  "Unable to get allowance data",
18838
18059
  { chainId, sender, allowanceTarget, token },
18839
18060
  "Make sure the chainId, sender, allowanceTarget, and token are correct",
@@ -18855,8 +18076,9 @@ async function getSocketBridgeApproveTransaction(chainId, sender, allowanceTarge
18855
18076
  `bridge/approval/build-tx/?${params}`
18856
18077
  );
18857
18078
  if (!json.result) {
18858
- throw new ResourceNotFoundError(
18859
- "BridgeApproveTxDataNotFound" /* BridgeApproveTxDataNotFound */,
18079
+ throw new ResourceNotFoundError8(
18080
+ ErrorCode15.BridgeApproveTxDataNotFound,
18081
+ "Unable to build the approve transaction data",
18860
18082
  "Unable to build the approve transaction data",
18861
18083
  { chainId, sender, allowanceTarget, token, amount },
18862
18084
  "Make sure the token and allowance are valid values",
@@ -18873,8 +18095,9 @@ var bridgeTransactionParams = async (params, walletAddress, chain) => {
18873
18095
  const toTokenObj = new Token2(toToken, chain);
18874
18096
  const amount = await fromTokenObj.getDecimalAmount(params.amount);
18875
18097
  if (!recipient) {
18876
- throw new InvalidParameterError(
18877
- "InvalidParameter" /* InvalidParameter */,
18098
+ throw new InvalidParameterError14(
18099
+ ErrorCode16.InvalidParameter,
18100
+ "Recipient Parameter was undefined",
18878
18101
  "Recipient Parameter was undefined",
18879
18102
  { params },
18880
18103
  "Please provide a recipient",
@@ -19001,12 +18224,21 @@ var limitSwapOrderTransactionParams = async (params, chain) => {
19001
18224
 
19002
18225
  // src/actions/FirstClassActions.ts
19003
18226
  var FirstClassActions = class {
19004
- chain;
19005
18227
  constructor(chain) {
19006
18228
  this.chain = chain;
19007
18229
  }
19008
18230
  async bridge(auth, userId, params, txOptions = globalThis.globalEnvOption) {
19009
- const paramsCopy = JSON.parse(JSON.stringify(params));
18231
+ const paramsCopy = safeParseJson2(JSON.stringify(params));
18232
+ if (!paramsCopy) {
18233
+ throw new InvalidParameterError15(
18234
+ ErrorCode17.InvalidParameter,
18235
+ "Invalid `params` object provided.",
18236
+ "Invalid `params` object provided.",
18237
+ { params },
18238
+ "",
18239
+ "https://docs.fun.xyz"
18240
+ );
18241
+ }
19010
18242
  paramsCopy.recipient ??= await this.getAddress();
19011
18243
  const transactionParams = await bridgeTransactionParams(
19012
18244
  paramsCopy,
@@ -19025,8 +18257,9 @@ var FirstClassActions = class {
19025
18257
  */
19026
18258
  async swap(auth, userId, params, txOptions = globalThis.globalEnvOption) {
19027
18259
  if (!params.tokenIn) {
19028
- throw new InvalidParameterError(
19029
- "InvalidParameter" /* InvalidParameter */,
18260
+ throw new InvalidParameterError15(
18261
+ ErrorCode17.InvalidParameter,
18262
+ "Missing tokenIn parameter in the swap params object.",
19030
18263
  "Missing tokenIn parameter in the swap params object.",
19031
18264
  { params },
19032
18265
  "",
@@ -19034,8 +18267,9 @@ var FirstClassActions = class {
19034
18267
  );
19035
18268
  }
19036
18269
  if (!params.tokenOut) {
19037
- throw new InvalidParameterError(
19038
- "InvalidParameter" /* InvalidParameter */,
18270
+ throw new InvalidParameterError15(
18271
+ ErrorCode17.InvalidParameter,
18272
+ "Missing tokenOut parameter in the swap params object.",
19039
18273
  "Missing tokenOut parameter in the swap params object.",
19040
18274
  { params },
19041
18275
  "",
@@ -19043,8 +18277,9 @@ var FirstClassActions = class {
19043
18277
  );
19044
18278
  }
19045
18279
  if (!params.inAmount) {
19046
- throw new InvalidParameterError(
19047
- "InvalidParameter" /* InvalidParameter */,
18280
+ throw new InvalidParameterError15(
18281
+ ErrorCode17.InvalidParameter,
18282
+ "Missing inAmount parameter in the swap params object.",
19048
18283
  "Missing inAmount parameter in the swap params object.",
19049
18284
  { params },
19050
18285
  "",
@@ -19067,8 +18302,9 @@ var FirstClassActions = class {
19067
18302
  txOptions
19068
18303
  );
19069
18304
  } else if (chainId === 8453) {
19070
- throw new InvalidParameterError(
19071
- "InvalidParameter" /* InvalidParameter */,
18305
+ throw new InvalidParameterError15(
18306
+ ErrorCode17.InvalidParameter,
18307
+ "Swap is not supported on Base",
19072
18308
  "Swap is not supported on Base",
19073
18309
  { params },
19074
18310
  "Use a different chain or a different first class method",
@@ -19134,8 +18370,9 @@ var FirstClassActions = class {
19134
18370
  );
19135
18371
  }
19136
18372
  } else {
19137
- throw new InvalidParameterError(
19138
- "InvalidParameter" /* InvalidParameter */,
18373
+ throw new InvalidParameterError15(
18374
+ ErrorCode17.InvalidParameter,
18375
+ "Params were missing or incorrect",
19139
18376
  "Params were missing or incorrect",
19140
18377
  { params },
19141
18378
  "Provide correct transfer params.",
@@ -19165,8 +18402,9 @@ var FirstClassActions = class {
19165
18402
  } else if (isERC721ApproveParams(params)) {
19166
18403
  transactionParams = await erc721ApproveTransactionParams(params);
19167
18404
  } else {
19168
- throw new InvalidParameterError(
19169
- "InvalidParameter" /* InvalidParameter */,
18405
+ throw new InvalidParameterError15(
18406
+ ErrorCode17.InvalidParameter,
18407
+ "Params were missing or incorrect",
19170
18408
  "Params were missing or incorrect",
19171
18409
  { params },
19172
18410
  "Provide correct token approve params.",
@@ -19220,8 +18458,9 @@ var FirstClassActions = class {
19220
18458
  txOptions
19221
18459
  );
19222
18460
  } else {
19223
- throw new InvalidParameterError(
19224
- "InvalidParameter" /* InvalidParameter */,
18461
+ throw new InvalidParameterError15(
18462
+ ErrorCode17.InvalidParameter,
18463
+ "Params were missing or incorrect",
19225
18464
  "Params were missing or incorrect",
19226
18465
  { params },
19227
18466
  "Provide correct unstake params.",
@@ -19309,8 +18548,9 @@ var FirstClassActions = class {
19309
18548
  await this.getAddress()
19310
18549
  );
19311
18550
  if (!onChainGroupData || onChainGroupData.memberIds.length === 0) {
19312
- throw new ResourceNotFoundError(
19313
- "GroupNotFound" /* GroupNotFound */,
18551
+ throw new ResourceNotFoundError9(
18552
+ ErrorCode17.GroupNotFound,
18553
+ "group is not found",
19314
18554
  "group is not found",
19315
18555
  { params },
19316
18556
  "Provide correct groupId and chainId.",
@@ -19321,8 +18561,9 @@ var FirstClassActions = class {
19321
18561
  const members = new Set(onChainGroupData.memberIds);
19322
18562
  members.add(params.userId);
19323
18563
  if (members.size <= originalMembers.size) {
19324
- throw new InvalidParameterError(
19325
- "UserAlreadyExists" /* UserAlreadyExists */,
18564
+ throw new InvalidParameterError15(
18565
+ ErrorCode17.UserAlreadyExists,
18566
+ "user already exists in group",
19326
18567
  "user already exists in group",
19327
18568
  { params, originalMembers, userId: params.userId },
19328
18569
  "Catch this error and swallow it as the user is already added.",
@@ -19357,8 +18598,9 @@ var FirstClassActions = class {
19357
18598
  await this.getAddress()
19358
18599
  );
19359
18600
  if (!onChainGroupData || onChainGroupData.memberIds.length === 0) {
19360
- throw new ResourceNotFoundError(
19361
- "GroupNotFound" /* GroupNotFound */,
18601
+ throw new ResourceNotFoundError9(
18602
+ ErrorCode17.GroupNotFound,
18603
+ "group is not found",
19362
18604
  "group is not found",
19363
18605
  { params },
19364
18606
  "Provide correct groupId and chainId.",
@@ -19369,8 +18611,9 @@ var FirstClassActions = class {
19369
18611
  const members = new Set(onChainGroupData.memberIds);
19370
18612
  members.delete(params.userId);
19371
18613
  if (members.size >= originalMembers.size) {
19372
- throw new ResourceNotFoundError(
19373
- "UserNotFound" /* UserNotFound */,
18614
+ throw new ResourceNotFoundError9(
18615
+ ErrorCode17.UserNotFound,
18616
+ "user does not exist in group",
19374
18617
  "user does not exist in group",
19375
18618
  { params, originalMembers, userId: params.userId },
19376
18619
  "Catch this error and swallow it as the user does not exist in the group.",
@@ -19404,8 +18647,9 @@ var FirstClassActions = class {
19404
18647
  await this.getAddress()
19405
18648
  );
19406
18649
  if (!onChainGroupData || onChainGroupData.memberIds.length === 0) {
19407
- throw new ResourceNotFoundError(
19408
- "GroupNotFound" /* GroupNotFound */,
18650
+ throw new ResourceNotFoundError9(
18651
+ ErrorCode17.GroupNotFound,
18652
+ "group is not found",
19409
18653
  "group is not found",
19410
18654
  { params },
19411
18655
  "Provide correct groupId and chainId.",
@@ -19413,8 +18657,9 @@ var FirstClassActions = class {
19413
18657
  );
19414
18658
  }
19415
18659
  if (!Number.isInteger(params.threshold) || params.threshold < 1 || params.threshold > onChainGroupData.memberIds.length) {
19416
- throw new InvalidParameterError(
19417
- "InvalidThreshold" /* InvalidThreshold */,
18660
+ throw new InvalidParameterError15(
18661
+ ErrorCode17.InvalidThreshold,
18662
+ "threshold can not be 0 or bigger than number of members in the group",
19418
18663
  "threshold can not be 0 or bigger than number of members in the group",
19419
18664
  { params, memberIds: onChainGroupData.memberIds },
19420
18665
  "Provide proper threshold number.",
@@ -19469,9 +18714,6 @@ async function checkWalletAccessInitialization(walletAddr) {
19469
18714
 
19470
18715
  // src/wallet/FunWallet.ts
19471
18716
  var FunWallet = class extends FirstClassActions {
19472
- walletUniqueId;
19473
- userInfo;
19474
- address;
19475
18717
  /**
19476
18718
  * Creates FunWallet object
19477
18719
  * @constructor
@@ -19484,8 +18726,9 @@ var FunWallet = class extends FirstClassActions {
19484
18726
  if (isAddress7(params)) {
19485
18727
  this.address = params;
19486
18728
  } else {
19487
- throw new InvalidParameterError(
19488
- "InvalidParameter" /* InvalidParameter */,
18729
+ throw new InvalidParameterError16(
18730
+ ErrorCode18.InvalidParameter,
18731
+ "string input must be an address type",
19489
18732
  "string input must be an address type",
19490
18733
  params,
19491
18734
  "Provide either (uniqueId, users) or walletAddr when constructing a FunWallet",
@@ -19495,8 +18738,9 @@ var FunWallet = class extends FirstClassActions {
19495
18738
  } else {
19496
18739
  const { users, uniqueId } = params;
19497
18740
  if (!uniqueId || !isBytes32(uniqueId) || !users || users.length <= 0) {
19498
- throw new InvalidParameterError(
19499
- "InvalidParameter" /* InvalidParameter */,
18741
+ throw new InvalidParameterError16(
18742
+ ErrorCode18.InvalidParameter,
18743
+ "uniqueId must be bytes32 and users must be non-empty",
19500
18744
  "uniqueId must be bytes32 and users must be non-empty",
19501
18745
  params,
19502
18746
  "The uniqueId field should be a 32 byte Hexstring and the users field should be an array of User objects",
@@ -19506,8 +18750,9 @@ var FunWallet = class extends FirstClassActions {
19506
18750
  this.userInfo = new Map(
19507
18751
  users?.map((user) => {
19508
18752
  if (!user.userId || !isHex3(user.userId)) {
19509
- throw new InvalidParameterError(
19510
- "InvalidParameter" /* InvalidParameter */,
18753
+ throw new InvalidParameterError16(
18754
+ ErrorCode18.InvalidParameter,
18755
+ "userId is required and must be a hex string",
19511
18756
  "userId is required and must be a hex string",
19512
18757
  users,
19513
18758
  "Provide hex string userId when creating a FunWallet",
@@ -19515,8 +18760,9 @@ var FunWallet = class extends FirstClassActions {
19515
18760
  );
19516
18761
  }
19517
18762
  if (user.groupInfo && (!Number.isInteger(user.groupInfo.threshold) || !Array.isArray(user.groupInfo.memberIds) || !user.groupInfo.memberIds.every((memberId) => isHex3(memberId)))) {
19518
- throw new InvalidParameterError(
19519
- "InvalidParameter" /* InvalidParameter */,
18763
+ throw new InvalidParameterError16(
18764
+ ErrorCode18.InvalidParameter,
18765
+ "groupInfo must be an object with threshold as integer and memberIds as array of hex strings",
19520
18766
  "groupInfo must be an object with threshold as integer and memberIds as array of hex strings",
19521
18767
  users,
19522
18768
  "Provide valid groupInfo when creating a FunWallet",
@@ -19803,39 +19049,6 @@ var FunWallet = class extends FirstClassActions {
19803
19049
  );
19804
19050
  }
19805
19051
  }
19806
- /**
19807
- * Generates an on-ramp URL for the account address.
19808
- * @param {Address} address - The account address (optional, defaults to the wallet's address).
19809
- * @param {string} currencyCode - The currency code (optional, defaults to undefined to allow users to select).
19810
- * @returns {Promise<string>} The on-ramp URL.
19811
- */
19812
- async onRamp(address, currencyCode) {
19813
- return await getMoonpayOnRampUrl({
19814
- apiKey: globalThis.globalEnvOption.apiKey,
19815
- walletAddr: address ? address : await this.getAddress(),
19816
- currencyCode: currencyCode ? currencyCode : void 0
19817
- });
19818
- }
19819
- /**
19820
- * Generates an off-ramp URL for the account address.
19821
- * @param {Address} address - The account address (optional, defaults to the wallet's address).
19822
- * @returns {Promise<string>} The off-ramp URL.
19823
- */
19824
- async offRamp(address) {
19825
- return await getMoonpayOffRampUrl({
19826
- apiKey: globalThis.globalEnvOption.apiKey,
19827
- walletAddr: address ? address : await this.getAddress()
19828
- });
19829
- }
19830
- /**
19831
- * Retrieves the supported currencies for on-ramp.
19832
- * @returns {Promise<MoonpayCurrency[]>} The supported currencies.
19833
- */
19834
- async getSupportedCurrencies() {
19835
- return await getMoonpayOnRampSupportedCurrencies({
19836
- apiKey: globalThis.globalEnvOption.apiKey
19837
- });
19838
- }
19839
19052
  /**
19840
19053
  * Creates a new operation to be associated with the wallet and prepares it for execution.
19841
19054
  * @param {Auth} auth - The authentication instance for the user.
@@ -19846,8 +19059,9 @@ var FunWallet = class extends FirstClassActions {
19846
19059
  */
19847
19060
  async createOperation(auth, userId, transactionParams, txOptions = globalThis.globalEnvOption) {
19848
19061
  if (!userId || userId === "") {
19849
- throw new InvalidParameterError(
19850
- "MissingParameter" /* MissingParameter */,
19062
+ throw new InvalidParameterError16(
19063
+ ErrorCode18.MissingParameter,
19064
+ "userId is required",
19851
19065
  "userId is required",
19852
19066
  { userId },
19853
19067
  "Provide userId when createOperation",
@@ -20034,8 +19248,9 @@ var FunWallet = class extends FirstClassActions {
20034
19248
  collectedSigCount = storedOps[0]?.signatures?.length ?? 1;
20035
19249
  }
20036
19250
  if (collectedSigCount < threshold) {
20037
- throw new InvalidParameterError(
20038
- "InsufficientSignatures" /* InsufficientSignatures */,
19251
+ throw new InvalidParameterError16(
19252
+ ErrorCode18.InsufficientSignatures,
19253
+ "Signatures are not sufficient to execute the operation",
20039
19254
  "Signatures are not sufficient to execute the operation",
20040
19255
  { threshold, collectedSigCount, chainId },
20041
19256
  "Only execute operation with enough signatures",
@@ -20043,8 +19258,9 @@ var FunWallet = class extends FirstClassActions {
20043
19258
  );
20044
19259
  }
20045
19260
  } else {
20046
- throw new InvalidParameterError(
20047
- "InsufficientSignatures" /* InsufficientSignatures */,
19261
+ throw new InvalidParameterError16(
19262
+ ErrorCode18.InsufficientSignatures,
19263
+ "Signatures are not sufficient to execute the operation",
20048
19264
  "Signatures are not sufficient to execute the operation",
20049
19265
  { threshold, chainId, skipDBAction: finalTxOptions.skipDBAction },
20050
19266
  "Only execute operation with enough signatures",
@@ -20163,8 +19379,9 @@ var FunWallet = class extends FirstClassActions {
20163
19379
  collectedSigCount = storedOps[0]?.signatures?.length ?? 1;
20164
19380
  }
20165
19381
  if (collectedSigCount < threshold) {
20166
- throw new InvalidParameterError(
20167
- "InsufficientSignatures" /* InsufficientSignatures */,
19382
+ throw new InvalidParameterError16(
19383
+ ErrorCode18.InsufficientSignatures,
19384
+ "Signatures are not sufficient to execute the operation",
20168
19385
  "Signatures are not sufficient to execute the operation",
20169
19386
  { threshold, collectedSigCount, chainId },
20170
19387
  "Only execute operation with enough signatures",
@@ -20172,8 +19389,9 @@ var FunWallet = class extends FirstClassActions {
20172
19389
  );
20173
19390
  }
20174
19391
  } else {
20175
- throw new InvalidParameterError(
20176
- "InsufficientSignatures" /* InsufficientSignatures */,
19392
+ throw new InvalidParameterError16(
19393
+ ErrorCode18.InsufficientSignatures,
19394
+ "Signatures are not sufficient to execute the operation",
20177
19395
  "Signatures are not sufficient to execute the operation",
20178
19396
  { threshold, chainId, skipDBAction: finalTxOptions.skipDBAction },
20179
19397
  "Only execute operation with enough signatures",
@@ -20201,9 +19419,10 @@ var FunWallet = class extends FirstClassActions {
20201
19419
  });
20202
19420
  }
20203
19421
  if (!finalOperation.opId) {
20204
- throw new InternalFailureError(
20205
- "ServerFailure" /* ServerFailure */,
19422
+ throw new InternalFailureError5(
19423
+ ErrorCode18.ServerFailure,
20206
19424
  "Operation id is required",
19425
+ "",
20207
19426
  finalOperation,
20208
19427
  "Make sure you are scheduling a valid operation",
20209
19428
  "https://docs.fun.xyz/"
@@ -20340,8 +19559,9 @@ var FunWallet = class extends FirstClassActions {
20340
19559
  options.fee.token = options.gasSponsor.token;
20341
19560
  }
20342
19561
  if (!options.fee.token) {
20343
- throw new InvalidParameterError(
20344
- "MissingParameter" /* MissingParameter */,
19562
+ throw new InvalidParameterError16(
19563
+ ErrorCode18.MissingParameter,
19564
+ "EnvOption.fee.token or EnvOption.gasSponsor.token is required",
20345
19565
  "EnvOption.fee.token or EnvOption.gasSponsor.token is required",
20346
19566
  { options },
20347
19567
  "Provide EnvOption.fee.token or EnvOption.gasSponsor.token when calling wallet.createOperation",
@@ -20349,8 +19569,9 @@ var FunWallet = class extends FirstClassActions {
20349
19569
  );
20350
19570
  }
20351
19571
  if (!options.fee.recipient) {
20352
- throw new InvalidParameterError(
20353
- "MissingParameter" /* MissingParameter */,
19572
+ throw new InvalidParameterError16(
19573
+ ErrorCode18.MissingParameter,
19574
+ "EnvOption.fee.recipient is required",
20354
19575
  "EnvOption.fee.recipient is required",
20355
19576
  { options },
20356
19577
  "Provide EnvOption.fee.recipient when calling wallet.createOperation",
@@ -20360,8 +19581,9 @@ var FunWallet = class extends FirstClassActions {
20360
19581
  const chain = await Chain.getChain({ chainIdentifier: options.chain });
20361
19582
  const token = new Token2(options.fee.token, chain);
20362
19583
  if (options.fee.gasPercent && !token.isNative) {
20363
- throw new InvalidParameterError(
20364
- "InvalidParameterCombination" /* InvalidParameterCombination */,
19584
+ throw new InvalidParameterError16(
19585
+ ErrorCode18.InvalidParameterCombination,
19586
+ "GasPercent is only valid for native tokens",
20365
19587
  "GasPercent is only valid for native tokens",
20366
19588
  { options },
20367
19589
  "Use native token as the fee token if you want to charge fee based on percentage",
@@ -20394,8 +19616,9 @@ var FunWallet = class extends FirstClassActions {
20394
19616
  Number(gasUsed) * options.fee.gasPercent / 100
20395
19617
  );
20396
19618
  } else {
20397
- throw new InvalidParameterError(
20398
- "MissingParameter" /* MissingParameter */,
19619
+ throw new InvalidParameterError16(
19620
+ ErrorCode18.MissingParameter,
19621
+ "EnvOption.fee.amount or EnvOption.fee.gasPercent is required",
20399
19622
  "EnvOption.fee.amount or EnvOption.fee.gasPercent is required",
20400
19623
  { options },
20401
19624
  "Provide either EnvOption.fee.amount or EnvOption.fee.gasPercent when calling wallet.createOperation",
@@ -20427,21 +19650,18 @@ export {
20427
19650
  APPROVE_AND_EXEC_ABI,
20428
19651
  APPROVE_AND_EXEC_CONTRACT_INTERFACE,
20429
19652
  APPROVE_AND_SWAP_ABI,
20430
- AccessDeniedError,
20431
19653
  AddressZero,
20432
19654
  Auth,
20433
19655
  AuthType,
20434
19656
  BASE_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION,
20435
19657
  BASE_WRAP_TOKEN_ADDR,
20436
19658
  BYTES32_LENGTH,
20437
- BaseError,
20438
19659
  CHECKOUT_PAYMASTER_ABI,
20439
19660
  CHECKOUT_PAYMASTER_CONTRACT_INTERFACE,
20440
19661
  CHECKOUT_SPONSOR_SUPPORT_CHAINS,
20441
19662
  CONTRACT_ADDRESSES,
20442
19663
  Chain,
20443
19664
  CheckoutSponsor,
20444
- ClientError,
20445
19665
  ContractInterface,
20446
19666
  DASHBOARD_API_URL,
20447
19667
  DEFAULT_RETRY_OPTIONS,
@@ -20455,9 +19675,6 @@ export {
20455
19675
  ESTIMATION_PAYMASTER_ABI,
20456
19676
  ETHEREUM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION,
20457
19677
  ETH_TRANSFER_SELECTOR,
20458
- ErrorBaseType,
20459
- ErrorCode,
20460
- ErrorType,
20461
19678
  FACTORY_ABI,
20462
19679
  FACTORY_CONTRACT_INTERFACE,
20463
19680
  FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,
@@ -20474,9 +19691,7 @@ export {
20474
19691
  GASLESS_SPONSOR_SUPPORT_CHAINS,
20475
19692
  GaslessSponsor,
20476
19693
  HashZero,
20477
- InternalFailureError,
20478
19694
  InvalidActionError,
20479
- InvalidParameterError,
20480
19695
  LOCAL_API_URL,
20481
19696
  NFT,
20482
19697
  OPTIMISM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION,
@@ -20486,16 +19701,13 @@ export {
20486
19701
  POOL_CONTRACT_INTERFACE,
20487
19702
  RBAC_CONTRACT_INTERFACE,
20488
19703
  ROLE_BASED_ACCESS_CONTROL_ABI,
20489
- ResourceNotFoundError,
20490
19704
  STABLECOIN_SYMBOLS,
20491
- ServerError,
20492
19705
  SessionKeyAuth,
20493
19706
  SocketSort,
20494
19707
  Sponsor,
20495
19708
  TOKEN_PAYMASTER_ABI,
20496
19709
  TOKEN_PAYMASTER_CONTRACT_INTERFACE,
20497
19710
  TOKEN_SPONSOR_SUPPORT_CHAINS,
20498
- ThrottlingError,
20499
19711
  Token2 as Token,
20500
19712
  TokenSponsor,
20501
19713
  UNISWAPV2FACTORY_ABI,
@@ -20509,7 +19721,6 @@ export {
20509
19721
  USER_AUTHENTICATION_ABI,
20510
19722
  USER_AUTHENTICATION_CONTRACT_INTERFACE,
20511
19723
  UniswapPoolFeeOptions,
20512
- UserOpFailureError,
20513
19724
  VALID_PRIVATE_KEY_LENGTH,
20514
19725
  WALLET_ABI,
20515
19726
  WALLET_CONTRACT_INTERFACE,