@funkit/api-base 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @funkit/api-base
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f77e6b1: fix: stringify and persist generateActionsParams to checkout record
8
+ - 3080712: Add getRiskAssessmentForAddress endpoint
9
+ - 298847e: feat: added ability for getCheckoutQuote to be aborted
10
+ - 479287a: refactor: better api error message handling
11
+
3
12
  ## 1.1.0
4
13
 
5
14
  ### Minor Changes
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var FUN_FAUCET_URL = "https://api.fun.xyz/demo-faucet";
8
8
  // src/errors/BaseError.ts
9
9
  var discord = "https://discord.gg/mvQunrx6NG";
10
10
  var BaseError = class extends Error {
11
- constructor(baseType, type, code, msg, paramsUsed, fixSuggestion, docLink, isInternal = false) {
11
+ constructor(baseType, type, code, msg, rawMessage, paramsUsed, fixSuggestion, docLink, isInternal = false) {
12
12
  super(`${msg}
13
13
 
14
14
  ${fixSuggestion}
@@ -17,6 +17,7 @@ Discord: ${discord}`);
17
17
  this.baseType = baseType;
18
18
  this.type = type;
19
19
  this.code = code;
20
+ this.rawMessage = rawMessage;
20
21
  this.paramsUsed = paramsUsed;
21
22
  if (isInternal) {
22
23
  this.loadEnd();
@@ -708,12 +709,13 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
708
709
 
709
710
  // src/errors/ClientError.ts
710
711
  var ClientError = class extends BaseError {
711
- constructor(type, code, msg, paramsUsed, fixSuggestion, docLink) {
712
+ constructor(type, code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
712
713
  super(
713
714
  "ClientError" /* ClientError */,
714
715
  type,
715
716
  code,
716
717
  msg,
718
+ rawMessage,
717
719
  paramsUsed,
718
720
  fixSuggestion,
719
721
  docLink,
@@ -722,11 +724,12 @@ var ClientError = class extends BaseError {
722
724
  }
723
725
  };
724
726
  var InvalidParameterError = class extends ClientError {
725
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
727
+ constructor(code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
726
728
  super(
727
729
  "InvalidParameter" /* InvalidParameter */,
728
730
  code,
729
731
  msg,
732
+ rawMessage,
730
733
  paramsUsed,
731
734
  fixSuggestion,
732
735
  docLink
@@ -734,7 +737,7 @@ var InvalidParameterError = class extends ClientError {
734
737
  }
735
738
  };
736
739
  var ResourceNotFoundError = class extends ClientError {
737
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
740
+ constructor(code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
738
741
  if (msg.includes("Chain name not found")) {
739
742
  const { reqId } = JSON.parse(msg);
740
743
  msg = ": Chain name not found or not supported.";
@@ -743,6 +746,7 @@ var ResourceNotFoundError = class extends ClientError {
743
746
  "ResourceNotFound" /* ResourceNotFound */,
744
747
  "ChainNotSupported" /* ChainNotSupported */,
745
748
  msg,
749
+ rawMessage,
746
750
  { reqId },
747
751
  fixSuggestion,
748
752
  docLink
@@ -752,6 +756,7 @@ var ResourceNotFoundError = class extends ClientError {
752
756
  "ResourceNotFound" /* ResourceNotFound */,
753
757
  code,
754
758
  msg,
759
+ rawMessage,
755
760
  paramsUsed,
756
761
  fixSuggestion,
757
762
  docLink
@@ -759,24 +764,13 @@ var ResourceNotFoundError = class extends ClientError {
759
764
  }
760
765
  }
761
766
  };
762
- var InvalidActionError = class extends ClientError {
763
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
764
- super(
765
- "InvalidAction" /* InvalidAction */,
766
- code,
767
- msg,
768
- paramsUsed,
769
- fixSuggestion,
770
- docLink
771
- );
772
- }
773
- };
774
767
  var ThrottlingError = class extends ClientError {
775
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
768
+ constructor(code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
776
769
  super(
777
770
  "ThrottlingError" /* ThrottlingError */,
778
771
  code,
779
772
  msg,
773
+ rawMessage,
780
774
  paramsUsed,
781
775
  fixSuggestion,
782
776
  docLink
@@ -784,11 +778,12 @@ var ThrottlingError = class extends ClientError {
784
778
  }
785
779
  };
786
780
  var AccessDeniedError = class extends ClientError {
787
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
781
+ constructor(code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
788
782
  super(
789
783
  "AccessDeniedError" /* AccessDeniedError */,
790
784
  code,
791
785
  msg,
786
+ rawMessage,
792
787
  paramsUsed,
793
788
  fixSuggestion,
794
789
  docLink
@@ -796,7 +791,7 @@ var AccessDeniedError = class extends ClientError {
796
791
  }
797
792
  };
798
793
  var UserOpFailureError = class extends ClientError {
799
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
794
+ constructor(code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
800
795
  const FWCode = findFWContractError(msg);
801
796
  if (FWCode) {
802
797
  const { reqId } = JSON.parse(msg);
@@ -806,6 +801,7 @@ var UserOpFailureError = class extends ClientError {
806
801
  "UserOpFailureError" /* UserOpFailureError */,
807
802
  "FunWalletErrorCode" /* FunWalletErrorCode */,
808
803
  msg,
804
+ rawMessage,
809
805
  { reqId },
810
806
  fixSuggestion,
811
807
  docLink
@@ -815,6 +811,7 @@ var UserOpFailureError = class extends ClientError {
815
811
  "UserOpFailureError" /* UserOpFailureError */,
816
812
  code,
817
813
  msg,
814
+ rawMessage,
818
815
  paramsUsed,
819
816
  fixSuggestion,
820
817
  docLink
@@ -832,12 +829,13 @@ var findFWContractError = (msg) => {
832
829
 
833
830
  // src/errors/ServerError.ts
834
831
  var ServerError = class extends BaseError {
835
- constructor(type, code, msg, paramsUsed, fixSuggestion, docLink) {
832
+ constructor(type, code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
836
833
  super(
837
834
  "ServerError" /* ServerError */,
838
835
  type,
839
836
  code,
840
837
  msg,
838
+ rawMessage,
841
839
  paramsUsed,
842
840
  fixSuggestion,
843
841
  docLink,
@@ -846,11 +844,12 @@ var ServerError = class extends BaseError {
846
844
  }
847
845
  };
848
846
  var InternalFailureError = class extends ServerError {
849
- constructor(code, msg, paramsUsed, fixSuggestion, docLink) {
847
+ constructor(code, msg, rawMessage, paramsUsed, fixSuggestion, docLink) {
850
848
  super(
851
849
  "InternalServerFailure" /* InternalServerFailure */,
852
850
  code,
853
851
  msg,
852
+ rawMessage,
854
853
  paramsUsed,
855
854
  fixSuggestion,
856
855
  docLink
@@ -935,10 +934,13 @@ var sendRequest = async ({
935
934
  const json = await response.json();
936
935
  if (response.ok) {
937
936
  return json;
938
- } else if (response.status === 400) {
937
+ }
938
+ const { errorMsg, errorCode } = json;
939
+ if (response.status === 400) {
939
940
  throw new InvalidParameterError(
940
941
  "InvalidParameter" /* InvalidParameter */,
941
942
  `bad request ${JSON.stringify(json)}`,
943
+ errorMsg,
942
944
  { body },
943
945
  "check the api call parameters. its mostly because some call parameters are wrong",
944
946
  "https://docs.fun.xyz"
@@ -947,6 +949,7 @@ var sendRequest = async ({
947
949
  throw new AccessDeniedError(
948
950
  "Unauthorized" /* Unauthorized */,
949
951
  "Invalid API key or insufficient access.",
952
+ errorMsg,
950
953
  { apiKey },
951
954
  "Check your api key at https://app.fun.xyz and check with fun team if you believe something is off",
952
955
  "https://docs.fun.xyz"
@@ -955,6 +958,7 @@ var sendRequest = async ({
955
958
  throw new ResourceNotFoundError(
956
959
  "ServerMissingData" /* ServerMissingData */,
957
960
  JSON.stringify(json),
961
+ errorMsg,
958
962
  { body },
959
963
  "check the api call parameters. its mostly because some call parameters are wrong",
960
964
  "https://docs.fun.xyz"
@@ -963,15 +967,17 @@ var sendRequest = async ({
963
967
  throw new ThrottlingError(
964
968
  "RequestLimitExceeded" /* RequestLimitExceeded */,
965
969
  `too many requests ${JSON.stringify(json)}`,
970
+ "Too many requests",
966
971
  { body },
967
972
  "you are making too many requests. please slow down. Reach out to fun team if you need more quota",
968
973
  "https://docs.fun.xyz"
969
974
  );
970
975
  } else if (response.status === 500) {
971
- if (json.errorCode === "UserOpFailureError" /* UserOpFailureError */) {
976
+ if (errorCode === "UserOpFailureError" /* UserOpFailureError */) {
972
977
  throw new UserOpFailureError(
973
978
  "UserOpFailureError" /* UserOpFailureError */,
974
- JSON.stringify(json),
979
+ `server failure ${JSON.stringify(json)}`,
980
+ errorMsg,
975
981
  { body },
976
982
  "fix user op failure. Most of the time this is due to invalid parameters",
977
983
  "https://docs.fun.xyz"
@@ -980,6 +986,7 @@ var sendRequest = async ({
980
986
  throw new InternalFailureError(
981
987
  "ServerFailure" /* ServerFailure */,
982
988
  `server failure ${JSON.stringify(json)}`,
989
+ errorMsg,
983
990
  { body },
984
991
  "retry later. if it still fails, please contact us.",
985
992
  "https://docs.fun.xyz"
@@ -989,6 +996,7 @@ var sendRequest = async ({
989
996
  throw new InternalFailureError(
990
997
  "ServerTimeout" /* ServerTimeout */,
991
998
  `server timeout failure ${JSON.stringify(json)}`,
999
+ errorMsg,
992
1000
  { body },
993
1001
  "retry later. if it still fails, please contact us.",
994
1002
  "https://docs.fun.xyz"
@@ -997,6 +1005,7 @@ var sendRequest = async ({
997
1005
  throw new InternalFailureError(
998
1006
  "UnknownServerError" /* UnknownServerError */,
999
1007
  `unknown server failure ${JSON.stringify(json)}`,
1008
+ errorMsg,
1000
1009
  { body },
1001
1010
  "retry later. if it still fails, please contact us.",
1002
1011
  "https://docs.fun.xyz"
@@ -1008,6 +1017,7 @@ var sendRequest = async ({
1008
1017
  throw new InternalFailureError(
1009
1018
  "ServerConnectionError" /* ServerConnectionError */,
1010
1019
  `Cannot connect to Fun API Service ${err}`,
1020
+ "",
1011
1021
  { body },
1012
1022
  "retry later. if it still fails, please contact us.",
1013
1023
  "https://docs.fun.xyz"
@@ -1177,7 +1187,8 @@ async function getCheckoutQuote({
1177
1187
  recipientAddr,
1178
1188
  needsRefuel,
1179
1189
  userId,
1180
- apiKey
1190
+ apiKey,
1191
+ signal
1181
1192
  }) {
1182
1193
  try {
1183
1194
  const toMultipler = 10 ** toTokenDecimals;
@@ -1204,7 +1215,8 @@ async function getCheckoutQuote({
1204
1215
  const searchParams = new URLSearchParams(queryParams);
1205
1216
  const quoteRes = await sendGetRequest({
1206
1217
  uri: `${API_BASE_URL}/checkout/quote?${searchParams}`,
1207
- apiKey
1218
+ apiKey,
1219
+ signal
1208
1220
  });
1209
1221
  const fromMultipler = 10 ** fromTokenDecimals;
1210
1222
  return {
@@ -1251,6 +1263,7 @@ async function initializeCheckout({
1251
1263
  throw new ResourceNotFoundError(
1252
1264
  "CheckoutInitDepositAddrNotFound" /* CheckoutInitDepositAddrNotFound */,
1253
1265
  "Unable to initialize checkout",
1266
+ "Unable to initialize checkout",
1254
1267
  body,
1255
1268
  "",
1256
1269
  "https://docs.fun.xyz"
@@ -1349,6 +1362,16 @@ async function getPaymasterDataForCheckoutSponsoredTransfer({
1349
1362
  }
1350
1363
  return res;
1351
1364
  }
1365
+ async function getRiskAssessmentForAddress({
1366
+ address,
1367
+ apiKey
1368
+ }) {
1369
+ const response = await sendGetRequest({
1370
+ uri: `${API_BASE_URL}/checkout/risk-assessment?address=${address}`,
1371
+ apiKey
1372
+ });
1373
+ return response;
1374
+ }
1352
1375
 
1353
1376
  // src/services/faucet/endpoints.ts
1354
1377
  async function getAssetFromFaucet({
@@ -1509,6 +1532,7 @@ async function getMoonpayUrlSignature({
1509
1532
  throw new InternalFailureError(
1510
1533
  "UnknownServerError" /* UnknownServerError */,
1511
1534
  "No onramp url found.",
1535
+ "",
1512
1536
  { url },
1513
1537
  "This is an internal error, please contact support.",
1514
1538
  "https://docs.fun.xyz"
@@ -1558,6 +1582,7 @@ async function getMoonpayOnRampUrl({
1558
1582
  throw new InternalFailureError(
1559
1583
  "UnknownServerError" /* UnknownServerError */,
1560
1584
  "No onramp url found.",
1585
+ "",
1561
1586
  { walletAddr },
1562
1587
  "This is an internal error, please contact support.",
1563
1588
  "https://docs.fun.xyz"
@@ -1577,6 +1602,7 @@ async function getMoonpayOffRampUrl({
1577
1602
  throw new InternalFailureError(
1578
1603
  "UnknownServerError" /* UnknownServerError */,
1579
1604
  "No offramp url found.",
1605
+ "",
1580
1606
  { walletAddr },
1581
1607
  "This is an internal error, please contact support.",
1582
1608
  "https://docs.fun.xyz"
@@ -1595,6 +1621,7 @@ async function getMoonpayOnRampSupportedCurrencies({
1595
1621
  throw new InternalFailureError(
1596
1622
  "UnknownServerError" /* UnknownServerError */,
1597
1623
  "No supported currencies found.",
1624
+ "",
1598
1625
  {},
1599
1626
  "This is an internal error, please contact support.",
1600
1627
  "https://docs.fun.xyz"
@@ -1705,7 +1732,6 @@ export {
1705
1732
  ErrorType,
1706
1733
  FUN_FAUCET_URL,
1707
1734
  InternalFailureError,
1708
- InvalidActionError,
1709
1735
  InvalidParameterError,
1710
1736
  MeshExecuteTransferMfaType,
1711
1737
  MeshExecuteTransferStatus,
@@ -1734,6 +1760,7 @@ export {
1734
1760
  getMoonpayOnRampUrl,
1735
1761
  getMoonpayUrlSignature,
1736
1762
  getPaymasterDataForCheckoutSponsoredTransfer,
1763
+ getRiskAssessmentForAddress,
1737
1764
  getStripeBuyQuote,
1738
1765
  getStripeBuySession,
1739
1766
  getWalletLidoWithdrawalsByChainId,
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/consts/api.ts", "../src/errors/BaseError.ts", "../src/errors/errors.json", "../src/errors/types.ts", "../src/errors/ClientError.ts", "../src/errors/ServerError.ts", "../src/utils/error.ts", "../src/consts/retry.ts", "../src/utils/checkout.ts", "../src/utils/request.ts", "../src/services/assets/endpoints.ts", "../src/services/checkout/endpoints.ts", "../src/services/checkout/types.ts", "../src/services/faucet/endpoints.ts", "../src/services/mesh/endpoints.ts", "../src/services/mesh/types.ts", "../src/services/moonpay/endpoints.ts", "../src/services/stripe/endpoints.ts", "../src/services/support/endpoints.ts"],
4
- "sourcesContent": ["export const API_BASE_URL =\n process.env.NODE_ENV === 'staging'\n ? 'https://api.fun.xyz/staging/v1'\n : process.env.NODE_ENV === 'testing'\n ? 'https://api.fun.xyz/testing/v1'\n : process.env.NODE_ENV === 'local'\n ? 'http://127.0.0.1:3000'\n : // Production\n 'https://api.fun.xyz/v1'\n\nexport const FUN_FAUCET_URL = 'https://api.fun.xyz/demo-faucet'\n", "const discord = 'https://discord.gg/mvQunrx6NG'\nexport class BaseError extends Error {\n timestamp: string\n\n constructor(\n public baseType: string,\n public type: string,\n public code: string,\n msg: string,\n\n public paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n isInternal = false,\n ) {\n super(`${msg}\\n\\n${fixSuggestion}\\nDocs: ${docLink}\\nDiscord: ${discord}`)\n if (isInternal) {\n this.loadEnd()\n }\n this.message += '\\n\\nTrace:'\n this.timestamp = new Date().toUTCString()\n }\n\n loadEnd() {\n this.message +=\n '\\n\\nThis is an internal sdk error. Please contact the fun team at our Discord for the fastest response.'\n }\n}\n", "{\n \"AA21\": {\n \"info\": \" Your wallet lacks funds for this transaction.\",\n \"suggestion\": \"To fix this error, make sure you have enough funds in your wallet to cover the transaction fee.\"\n },\n \"FW000\": {\n \"info\": \" Create3Deployer.requireDeployerOnly() - Signatures were not sorted before being passed in\",\n \"suggestion\": \"To fix this error, make sure to short sigs before passing them into `requireDeployerOnly`. You can do this by calling `sigs.sort()` before passing them in. It is also possible to run into this error if the hash that was signed was not the correct hash.\"\n },\n \"FW001\": {\n \"info\": \" Create3Deployer.requireDeployerOnly() - Signature failed to be recovered. ercrecover returned the zero address\",\n \"suggestion\": \"To fix this error, make sure to pass in enough valid signatures that sign the `hash` in the `sigs` array\"\n },\n \"FW002\": {\n \"info\": \" Create3Deployer.addDeployer() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `hashAddDeployer()`\"\n },\n \"FW003\": {\n \"info\": \" Create3Deployer.removeDeployer() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `hashRemoveDeployer()`\"\n },\n \"FW004\": {\n \"info\": \" Create3Deployer.setThreshold() - Threshold must be greater than 1\",\n \"suggestion\": \"To fix this error, `threshold` is greater than 1\"\n },\n \"FW005\": {\n \"info\": \" Create3Deployer.setThreshold() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_threshold))`\"\n },\n \"FW006\": {\n \"info\": \" Create3Deployer.callChild() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(child, data, _nonce, block.chainid))`\"\n },\n \"FW007\": {\n \"info\": \" Create3Deployer.callChild() - Invalid Nonce, nonce must be 1 greater than the current nonce\",\n \"suggestion\": \"To fix this error, make sure `_nonce` is equal to the current nonce + 1\"\n },\n \"FW008\": {\n \"info\": \" Create3Deployer.callChild() - call to child failed\",\n \"suggestion\": \"To fix this error, check to see what is making the call to the child fail\"\n },\n \"FW009\": {\n \"info\": \" Create3Deployer.deploy() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_salt, _creationCode))`\"\n },\n \"FW010\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_deployer` is not equal to the zero address\"\n },\n \"FW011\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_funWalletImpAddress` is not equal to the zero address\"\n },\n \"FW012\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_feeOracle` is not equal to the zero address\"\n },\n \"FW013\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_walletInit` is not equal to the zero address\"\n },\n \"FW014\": {\n \"info\": \" FunWalletFactory.constructor() - Unable to generate the address from this deployerSalt\",\n \"suggestion\": \"To fix this error, make sure `FunWalletFactoryV1` has not already been deployed from the given create3deployer contract. If it has been, change `FunWalletFactoryV1` to `FunWalletFactoryV2` or another version.\"\n },\n \"FW015\": {\n \"info\": \" FunWalletFactory.constructor() - Generated the wrong address from this deployerSalt\",\n \"suggestion\": \"To fix this error, make sure `FunWalletFactoryV1` has not already been deployed from the given create3deployer contract. If it has been, change `FunWalletFactoryV1` to `FunWalletFactoryV2` or another version.\"\n },\n \"FW016\": {\n \"info\": \" FunWalletFactory.createAccount() - Call to initialize failed on the deployed proxy\",\n \"suggestion\": \"To fix this error, make sure the `initializerCallData` is formatted correctly\"\n },\n \"FW017\": {\n \"info\": \" FunWalletFactory - Caller must be deployer\",\n \"suggestion\": \"To fix this error, make sure to call the function from the deployer address\"\n },\n \"FW018\": {\n \"info\": \" WalletInit.commit() - The previous commit has not expired\",\n \"suggestion\": \"To fix this error, wait for the previous commit with this `commitKey` to expire. This should take at most 10 minutes.\"\n },\n \"FW019\": {\n \"info\": \" WalletInit.validateSalt() - The hash at the commitKey does not match `keccak256(abi.encode(seed, owner, initializerCallData))`\",\n \"suggestion\": \"To fix this error, make sure the seed, owner, and initializerCallData are hashed and stored in commits at the corresponding `commitKey`\"\n },\n \"FW020\": {\n \"info\": \" WalletInit.validateSalt() - The new owner of the funwallet must match data.newFunWalletOwner from loginData\",\n \"suggestion\": \"To fix this error, make sure the owner set in `loginData` matches the owner address returned from the tweet.\"\n },\n \"FW021\": {\n \"info\": \" WalletInit.setOracle() - The address of the new `_oracle` must not be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_oracle` is not the zero address\"\n },\n \"FW022\": {\n \"info\": \" Create3Deployer.deployFromChild() - Invalid Child Address\",\n \"suggestion\": \"To fix this error, make sure the caller is a contract deployed from the Create3Deployer\"\n },\n \"FW023\": {\n \"info\": \" ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Target Code Hash\",\n \"suggestion\": \"To fix this error, make sure the caller is a contract targeted is a ERC1967ProxyData contract\"\n },\n \"FW024\": {\n \"info\": \" ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Contract Implementation Address\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW025\": {\n \"info\": \" ImplementationRegistry.addImplementation() - Invalid Signature Amount\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW026\": {\n \"info\": \" ImplementationRegistry.removeImplementation() - Invalid Signature Amount\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW027\": {\n \"info\": \" WalletInit.commit() - Unable to commit with a previously used commit hash\",\n \"suggestion\": \"To fix this error, make sure you are not reusing someone else's commit hash. If there are conflicts, just regenerate the seed randomly\"\n },\n \"FW028\": {\n \"info\": \" MultiSigDeployer.constructor() - Threshold can't be greater than deployers length\",\n \"suggestion\": \"To fix this error, make sure the threshold value is not 0\"\n },\n \"FW029\": {\n \"info\": \" WalletInit.invalidateUsedSeed() - msg.sender must equal funwalletfactory\",\n \"suggestion\": \"To fix this error, make sure you are calling this function from the FunWalletFactory contract\"\n },\n \"FW030\": {\n \"info\": \" WalletInit.setFunWalletFactory() - funwalletfactory address cannot be set to 0\",\n \"suggestion\": \"To fix this error, make sure you are passing in the valid funwalletfactory address\"\n },\n \"FW031\": {\n \"info\": \" WalletInit.validateSalt() - seed has already been used\",\n \"suggestion\": \"To fix this error, make sure you are not using an existing salt\"\n },\n \"FW032\": {\n \"info\": \" FunWalletFactory.setFeeOracle() - Cannot set the fee oracle address to 0\",\n \"suggestion\": \"To fix this error, make sure you are using the correct address of the fee oracle\"\n },\n \"FW033\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_entryPoint` is not equal to the zero address\"\n },\n \"FW034\": {\n \"info\": \" Create3Deployer.callChild() - Value not equal to msg.value\",\n \"suggestion\": \"To fix this error, make sure `msg.value` is equal to the `value` parameter.\"\n },\n \"FW100\": {\n \"info\": \" Module.execute() - execute() needs to be overriden\",\n \"suggestion\": \"To fix this error, make sure you are overriding the execute method in your module\"\n },\n \"FW101\": {\n \"info\": \" ApproveAndExec.approveAndExecute() - the approveData's first four bytes must be the approve() function selector\",\n \"suggestion\": \"To fix this error, change `approveData` such that the first four bytes are `bytes4(keccak256('approve(address,uint256)'))`\"\n },\n \"FW102\": {\n \"info\": \" ApproveAndSwap.constructor() - `_wethAddr` cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_wethAddr` is not set to the zero address\"\n },\n \"FW103\": {\n \"info\": \" ApproveAndSwap.constructor() - `_router` cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_router` is not set to the zero address\"\n },\n \"FW104\": {\n \"info\": \" ApproveAndSwap.executeSwapEth() - msg.sender does not have enough weth\",\n \"suggestion\": \"To fix this error, make sure msg.sender has a weth balance >= `amount`\"\n },\n \"FW105\": {\n \"info\": \" ApproveAndSwap.\\\\_internalSwap() - Approve failed\",\n \"suggestion\": \"To fix this error, make sure you have formatted approve correctly\"\n },\n \"FW106\": {\n \"info\": \" AaveWithdraw.execute() - Withdrawing a zero balance\",\n \"suggestion\": \"You are trying to withdraw from aave but don't have a balance\"\n },\n \"FW107\": {\n \"info\": \" ApproveAndExec.approveAndExecute() - Approve failed\",\n \"suggestion\": \"The token you tried to approve failed\"\n },\n \"FW108\": {\n \"info\": \" UniswapV3LimitOrder.execute() - Approval Failed\",\n \"suggestion\": \"You are trying to withdraw from aave but don't have a balance\"\n },\n \"FW109\": {\n \"info\": \" UniswapV3LimitOrder.constructor() - Router cannot be address zero\",\n \"suggestion\": \"Make sure you are not passing in the zero address when initializing the module\"\n },\n \"FW110\": {\n \"info\": \" UniswapV3LimitOrder.constructor() - Quoter cannot be zero address\",\n \"suggestion\": \"Make sure you are not passing in the zero address when initializing the module\"\n },\n \"FW200\": {\n \"info\": \" FeePercentOracle.setValues() - feepercent must be less than or equals to 100%\",\n \"suggestion\": \"To fix this error, `_feepercent` must be less than or equals to `10 ** _decimals`\"\n },\n \"FW201\": {\n \"info\": \" FeePercentOracle.withdrawEth() - eth transfer failed\",\n \"suggestion\": \"To fix this error, investigate why the eth withdrawal failed. This is likely because `amount` was greater than the eth balance in the FeePercentOracle\"\n },\n \"FW202\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator price must be greater than 0\",\n \"suggestion\": \"To fix this error, retry the call and make sure price is greater than 0\"\n },\n \"FW203\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator updatedAt must be greater than 0\",\n \"suggestion\": \"To fix this error, retry the call and make sure updatedAt is greater than 0\"\n },\n \"FW204\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator answeredInRound must be greater than or equal to roundId\",\n \"suggestion\": \"To fix this error, retry the call and make sure answeredInRound must be greater than or equal to roundId\"\n },\n \"FW205\": {\n \"info\": \" TwitterOracle.batchSetTweet() - socialHandles, loginTypes, seeds, owners length must match in length\",\n \"suggestion\": \"To fix this error, make sure all arrays passed into this function are the same length.\"\n },\n \"FW206\": {\n \"info\": \" TwitterOracle.setTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW207\": {\n \"info\": \" TwitterOracle.setTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW208\": {\n \"info\": \" TwitterOracle.batchSetTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW209\": {\n \"info\": \" TwitterOracle.batchSetTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW210\": {\n \"info\": \" TwitterOracle.fetchTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW211\": {\n \"info\": \" TwitterOracle.fetchTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW300\": {\n \"info\": \" BasePaymaster.constructor() - entrypoint address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure entrypoint address is not the zero address\"\n },\n \"FW301\": {\n \"info\": \" BasePaymaster.\\\\_requireFromEntryPoint() - the msg.sender must be from the entrypoint\",\n \"suggestion\": \"To fix this error, make sure the msg.sender must be from the entrypoint\"\n },\n \"FW302\": {\n \"info\": \" GaslessPaymaster.batchActions() - the ith delegate call failed\",\n \"suggestion\": \"To fix this error, make sure the calldata for `data[i]` is a valid call\"\n },\n \"FW303\": {\n \"info\": \" GaslessPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated\",\n \"suggestion\": \"To fix this error, increase the amount of msg.value you are passing to this function\"\n },\n \"FW304\": {\n \"info\": \" GaslessPaymaster.\\\\_withdrawDepositTo() - the withdrawal has not been unlocked\",\n \"suggestion\": \"To fix this error, wait till block.number is greater than the unlockBlock for the sender and make sure `unlockBlock[sender]` is nonzero\"\n },\n \"FW305\": {\n \"info\": \" GaslessPaymaster.\\\\_withdrawDepositTo() - the balances of the sender must be greater than the withdrawal amount\",\n \"suggestion\": \"To fix this error, decrease the amount you are trying to withdraw\"\n },\n \"FW306\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the userOp.paymasterAndData must have a length of 40\",\n \"suggestion\": \"To fix this error, change the `paymasterAndData` field in the `userOp` such that the length is 40\"\n },\n \"FW307\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the verificationGasLimit must be greater than the `COST_OF_POST` variable in GaslessPaymaster\",\n \"suggestion\": \"To fix this error, increase the `verificationGasLimit` in the `userOp`\"\n },\n \"FW308\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the sponsor's eth is not locked for use\",\n \"suggestion\": \"To fix this error, make sure the sponsor's eth is locked using `lockDeposit()`\"\n },\n \"FW309\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - The sponsor needs to approve the spender\",\n \"suggestion\": \"To fix this error, make sure to approve the spender using `setSpenderWhitelistMode()` or `setSpenderBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setListMode()\"\n },\n \"FW310\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - The sponsor does not have sufficient eth in the paymaster to cover this operation\",\n \"suggestion\": \"To fix this error, make sure to stake enough eth from the sponsor's address using `addDepositTo()`\"\n },\n \"FW311\": {\n \"info\": \" GaslessPaymaster.addDepositTo() - `msg.value` must be greater than or equal to amount\",\n \"suggestion\": \"To fix this error, make sure `msg.value` must be greater than or equal to amount\"\n },\n \"FW312\": {\n \"info\": \" TokenPaymaster.batchActions() - the ith delegate call failed\",\n \"suggestion\": \"To fix this error, make sure the calldata for `data[i]` is a valid call\"\n },\n \"FW313\": {\n \"info\": \" TokenPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated\",\n \"suggestion\": \"To fix this error, increase the amount of msg.value you are passing to this function\"\n },\n \"FW314\": {\n \"info\": \" TokenPaymaster.\\\\_addTokenDepositTo() - token decimals must be greater than 0\",\n \"suggestion\": \"To fix this error, change the decimals in token using `setTokenData()`\"\n },\n \"FW315\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawTokenDepositTo() - token is not unlocked for withdrawal\",\n \"suggestion\": \"To fix this error, call `unlockTokenDepositAfter()`\"\n },\n \"FW316\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawTokenDepositTo() - you are withdrawing more tokens that you have in balance\",\n \"suggestion\": \"To fix this error, call `getTokenBalance()` to check how many tokens you have and make sure `amount` is less than that\"\n },\n \"FW317\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawEthDepositTo() - token is not unlocked for withdrawal\",\n \"suggestion\": \"To fix this error, call `unlockTokenDepositAfter()` with `ETH` as the token\"\n },\n \"FW318\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawEthDepositTo() - you are withdrawing more ether that you have in balance\",\n \"suggestion\": \"To fix this error, call `getTokenBalance()` with `ETH` as the token to check how many tokens you have and make sure `amount` is less than that\"\n },\n \"FW319\": {\n \"info\": \" TokenPaymaster.\\\\_getTokenValueOfEth() - call to token oracle failed\",\n \"suggestion\": \"To fix this error, check the token oracle and call `setTokenData()` to change the oracle if it is broken\"\n },\n \"FW320\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - failed to reimbursePaymaster with tokens via `permitTransfer()`\",\n \"suggestion\": \"To fix this **error**, make sure you have permitted the paymaster to spend your tokens\"\n },\n \"FW321\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - spender doesn't have enough tokens\",\n \"suggestion\": \"To fix this error, make sure to add more tokens to the token paymaster via `addTokenDepositTo()`\"\n },\n \"FW322\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - `paymasterAndData` length must be 60\",\n \"suggestion\": \"To fix this error, make sure to set `paymasterAndData` length to be 60\"\n },\n \"FW323\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - `verificationGasLimit` must be greater than `COST_OF_POST`\",\n \"suggestion\": \"To fix this error, make sure to set the userOp's `verificationGasLimit` to be greater than `COST_OF_POST`\"\n },\n \"FW324\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must lock their ETH\",\n \"suggestion\": \"To fix this error, make sure the sponsor has locked their eth by calling `lockTokenDeposit()` from the sponsor address\"\n },\n \"FW325\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the account must lock their tokens\",\n \"suggestion\": \"To fix this error, make sure the user of the token paymaster has locked their tokens by calling `lockTokenDeposit()` from their address\"\n },\n \"FW326\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor eth balance must be greater than maxCost\",\n \"suggestion\": \"To fix this error, make sure the sponsor eth balance is greater than maxCost\"\n },\n \"FW327\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must approve the spender\",\n \"suggestion\": \"To fix this error, make sure the sponsor has approved the spender by calling `setSpenderWhitelistMode()` or `setSpenderBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setListMode()`\"\n },\n \"FW328\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must have approved the token to the paymaster\",\n \"suggestion\": \"To fix this error, make sure the sponsor has approved the spender by calling `setTokenWhitelistMode()` or `setTokenBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setTokenListMode()`\"\n },\n \"FW329\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted token must be equal to the token you are trying to pay with if using permit\",\n \"suggestion\": \"To fix this error, make sure the permitted token is equal to the token you are trying to pay with if using permit\"\n },\n \"FW330\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted transfer recipient must be the token paymaster\",\n \"suggestion\": \"To fix this error, make sure to permit the token paymaster to spend your tokens\"\n },\n \"FW331\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted transfer amount must be greater than or equal to the maxTokenCost\",\n \"suggestion\": \"To fix this error, make sure the permitted transfer amount is greater than or equal to the maxTokenCost\"\n },\n \"FW332\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - if permit was not used, make sure the tokenPaymaster was approved to spend tokens by the sponsor or enough tokens were deposited into the TokenPaymaster\",\n \"suggestion\": \"To fix this error, make sure the tokenPaymaster was approved(`approve()`) to spend tokens by the sponsor or enough tokens were deposited into the TokenPaymaster via `addTokenDepositTo()`\"\n },\n \"FW333\": {\n \"info\": \" TokenPaymaster.addEthDepositTo() - make sure msg.value is greater than or equal to amount\",\n \"suggestion\": \"To fix this error, make sure that the msg.value is greater than or equal to amount\"\n },\n \"FW334\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - sponsor cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the sponsor is not the zero address\"\n },\n \"FW335\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - target cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the target is not the zero address\"\n },\n \"FW336\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - token address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the token address is not the zero address\"\n },\n \"FW337\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - spender address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the spender address is not the zero address\"\n },\n \"FW338\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the token oracle cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the token oracle is not the zero address\"\n },\n \"FW339\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the tokenAddress cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the tokenAddress is not the zero address\"\n },\n \"FW340\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the token decimals must be greater than 0\",\n \"suggestion\": \"To fix this error, make sure the token decimals is greater than 0\"\n },\n \"FW341\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the chainlink aggregator cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the chainlink aggregator is not the zero address\"\n },\n \"FW342\": {\n \"info\": \" TokenPaymaster.removeTokenData() - The token doesn't exist in tokens\",\n \"suggestion\": \"To fix this error, make sure the token address is not the zero address\"\n },\n \"FW343\": {\n \"info\": \" TokenPaymaster.removeTokenData() - The tokenListIndex doesn't match with the tokenAddress\",\n \"suggestion\": \"To fix this error, make sure the token at tokenList[tokenListIndex] is the same as the tokenAddress\"\n },\n \"FW344\": {\n \"info\": \" GaslessPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions\",\n \"suggestion\": \"To fix this error, make sure you are not recursively calling batchActions from within batchActions\"\n },\n \"FW345\": {\n \"info\": \" TokenPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions\",\n \"suggestion\": \"To fix this error, make sure you are not recursively calling batchActions from within batchActions\"\n },\n \"FW346\": {\n \"info\": \" TokenPaymaster.postOp() - Invalid Permit transfer amount\",\n \"suggestion\": \"To fix this error, make sure your permit transfer has transfered the correct amount of tokens\"\n },\n \"FW347\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - Invalid amount of tokens transferred\",\n \"suggestion\": \"The likely cause of this error is using a deflationary token that charges a tax when you transfer tokens. To fix this error, make sure you are transferring the correct amount of tokens and to account for the tax/deflation.\"\n },\n \"FW348\": {\n \"info\": \" UserAuthentication.init() - groupId count must be equal to groups length\",\n \"suggestion\": \"Make sure the number of groupIds equals the number of groups.\"\n },\n \"FW349\": {\n \"info\": \" TokenPaymaster.calculatePostOpGas() - Invalid Auth Type\",\n \"suggestion\": \"Make sure the authtype is correct\"\n },\n \"FW350\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - Does not have enough balance of token\",\n \"suggestion\": \"To fix this error, make sure your has enough tokens to permit transfer\"\n },\n \"FW351\": {\n \"info\": \" BasePaymaster.\\\\withdrawStakeFromEntryPoint() - Cannot withdraw to address zero\",\n \"suggestion\": \"To fix this error, make sure you are not withdrawing to address zero\"\n },\n \"FW401\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW402`: RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target\"\n },\n \"FW402\": {\n \"info\": \" RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target\",\n \"suggestion\": \"To fix this error, make sure the target that you are calling is in the merkle root of allowed targets verified by the rule. If this does not work make sure you are using the correct merkle root implementation.\"\n },\n \"FW403\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the selector that you are calling is in the merkle root of allowed selector verified by the rule. If this does not work make sure you are using the correct merkle root implementation.\"\n },\n \"FW404\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the ownerId is not 0 or an existing owner\"\n },\n \"FW405\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the ruleId is not 0\"\n },\n \"FW406\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule that you are using has a deadline that has passed.\"\n },\n \"FW408\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW410`: RoleBasedAccessControl: isValidAction(), isValidActionAndFee() - Rule not added to role\"\n },\n \"FW410\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule is added to the role\"\n },\n \"FW411\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the value for the execution call is less than the limit\"\n },\n \"FW412\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee value for the execution call is less than the limit\"\n },\n \"FW413\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee recipient is in the rule fee merkle root\"\n },\n \"FW414\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee token is in the rule fee merkle root\"\n },\n \"FW417\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule you are using exists\"\n },\n \"FW418\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the user is in the role\"\n },\n \"FW419\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the feeRecipientTokenMerkleRootHash is not zero\"\n },\n \"FW420\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the targetSelectorMerkleRootHash is not zero\"\n },\n \"FW421\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW422`: RoleBasedAccessControl: init() - Wallet has not been initialized\"\n },\n \"FW422\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the wallet has not initialized the validation contract\"\n },\n \"FW500\": {\n \"info\": \" FunWallet.initialize() - the entrypoint cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the entrypoint is not the zero address\"\n },\n \"FW501\": {\n \"info\": \" FunWallet.initialize() - the msg.sender cannot be the address of the Funwallet contract\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is not the address of the Funwallet contract\"\n },\n \"FW502\": {\n \"info\": \" FunWallet.\\\\_requireFromFunWalletProxy() - the function must be called from the funwallet proxy\",\n \"suggestion\": \"To fix this error, make sure the msg.sender == funwallet\"\n },\n \"FW503\": {\n \"info\": \" FunWallet.updateEntryPoint() - the new entrypoint address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the new entrypoint address is not the zero address\"\n },\n \"FW504\": {\n \"info\": \" FunWallet.depositToEntryPoint() - not enough eth in the funwallet\",\n \"suggestion\": \"To fix this error, make sure the funwallet has more than the amount of eth you are trying to deposit\"\n },\n \"FW505\": {\n \"info\": \" FunWallet.\\\\_transferEthFromEntrypoint() - withdrawing eth from the entrypoint failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the entrypoint\"\n },\n \"FW506\": {\n \"info\": \" FunWallet.\\\\_requireFromModule() - make sure a funwalletfactory deployed the module\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is the module\"\n },\n \"FW507\": {\n \"info\": \" FunWallet.\\\\_requireFromEntryPoint() - the msg.sender must be the entrypoint\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is the entrypoint\"\n },\n \"FW508\": {\n \"info\": \" WalletFee.\\\\_transferEth() - the eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW509\": {\n \"info\": \" WalletFee.\\\\_handleFee() - the developer eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW510\": {\n \"info\": \" WalletFee.\\\\_handleFee() - the funOracle eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW511\": {\n \"info\": \" WalletValidation.initValidations() - the WalletValidations contract has already been initialized\",\n \"suggestion\": \"Don't call initValidations() more than once\"\n },\n \"FW512\": {\n \"info\": \" WalletValidation.initValidations() - make sure there are more than zero validations\",\n \"suggestion\": \"To fix this error, make sure there are more than zero validations and the number of validation contract addresses are equal to the number of `initCallData` elements\"\n },\n \"FW513\": {\n \"info\": \" WalletValidation.initValidations() - make sure there are no duplicate validation contract addresses\",\n \"suggestion\": \"To fix this error, make sure there are no duplicate validation contract addresses in `validationData`\"\n },\n \"FW514\": {\n \"info\": \" WalletValidation.\\\\_validateUserOp() - make sure the signature length is greater than 0\",\n \"suggestion\": \"To fix this error, make sure the signature length is greater than 0\"\n },\n \"FW515\": {\n \"info\": \" WalletValidation.isValidSignature() - make sure the number of validations is greater than zero\",\n \"suggestion\": \"To fix this error, make sure the number of validations is greater than zero\"\n },\n \"FW516\": {\n \"info\": \" WalletValidation.\\\\_requireValidValidation() - the validation failed\",\n \"suggestion\": \"To fix this error, make sure the validation contract returns true\"\n },\n \"FW517\": {\n \"info\": \" WalletValidation.\\\\_requireValidValidationFormat() - the validation was incorrectly formatted\",\n \"suggestion\": \"To fix this error, make sure the validation contract address is not the zero address and the validation is valid and the address is not the zero address\"\n },\n \"FW518\": {\n \"info\": \" WalletValidation.\\\\_requireValidPrevValidation() - the previous validation must be linked to this validation\",\n \"suggestion\": \"To fix this error, make sure the previous validation is linked to this validation when adding or removing the validation\"\n },\n \"FW519\": {\n \"info\": \" WalletValidation.getValidations() - you must have more than zero validations to get validations\",\n \"suggestion\": \"To fix this error, make sure there are a nonzero amount of validations\"\n },\n \"FW520\": {\n \"info\": \" WalletValidation.addValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling addValidation() from your funwallet.\"\n },\n \"FW521\": {\n \"info\": \" WalletValidation.removeValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling removeValidation() from your funwallet.\"\n },\n \"FW522\": {\n \"info\": \" WalletValidation.updateValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling updateValidation() from your funwallet.\"\n },\n \"FW523\": {\n \"info\": \" WalletModules.permitTransfer() - Invalid Permit Signature.\",\n \"suggestion\": \"To fix this error, make sure you have a valid permit signature.\"\n },\n \"FW524\": {\n \"info\": \" WalletValidation.getValidations() - No Validations in the wallet\",\n \"suggestion\": \"To fix this error, make sure the wallet has validation contracts\"\n },\n \"FW600\": {\n \"info\": \" DataLib\",\n \"suggestion\": \"To fix this error, make sure you are calling either execFromEntryPoint() or execFromEntryPointWithFee() from your funwallet.\"\n },\n \"FW601\": {\n \"info\": \" Ownable2StepNoRenounce\",\n \"suggestion\": \"To fix this error, don't call this function.\"\n }\n}\n", "export type ErrorData = {\n location: string\n error?: {\n txDetails?: ErrorTransactionDetails\n reasonData?: {\n title: string\n reasons: string[]\n }\n }\n}\n\nexport type ErrorTransactionDetails = {\n method: string\n params: any[]\n contractAddress?: string\n chainId?: number | string\n}\n\nexport enum ErrorBaseType {\n ClientError = 'ClientError',\n ServerError = 'ServerError',\n}\n\nexport enum ErrorType {\n InvalidParameter = 'InvalidParameter',\n InternalServerFailure = 'InternalServerFailure',\n ResourceNotFound = 'ResourceNotFound',\n InvalidAction = 'InvalidAction',\n ThrottlingError = 'ThrottlingError',\n AccessDeniedError = 'AccessDeniedError',\n UserOpFailureError = 'UserOpFailureError',\n}\n\nexport enum ErrorCode {\n MissingParameter = 'MissingParameter',\n InvalidParameter = 'InvalidParameter',\n InvalidThreshold = 'InvalidThreshold',\n InvalidChainIdentifier = 'InvalidChainIdentifier',\n InvalidNFTIdentifier = 'InvalidNFTIdentifier',\n InsufficientSignatures = 'InsufficientSignatures',\n InvalidParameterCombination = 'InvalidParameterCombination',\n CheckPointHintsNotFound = 'CheckPointHintsNotFound',\n GroupNotFound = 'GroupNotFound',\n TokenNotFound = 'TokenNotFound',\n AddressNotFound = 'AddressNotFound',\n UserAlreadyExists = 'UserAlreadyExists',\n UserNotFound = 'UserNotFound',\n ChainNotSupported = 'ChainNotSupported',\n ServerMissingData = 'ServerMissingData',\n ServerFailure = 'ServerFailure',\n ServerTimeout = 'ServerTimeout',\n UnknownServerError = 'UnknownServerError',\n ServerConnectionError = 'ServerConnectionError',\n UserOpFailureError = 'UserOpFailureError',\n Unauthorized = 'Unauthorized',\n RequestLimitExceeded = 'RequestLimitExceeded',\n WalletPrefundError = 'PrefundError',\n GasSponsorFundError = 'GasSponsorFundError',\n FunWalletErrorCode = 'FunWalletErrorCode',\n BridgeRouteNotFound = 'BridgeRouteNotFound',\n BridgeAllowanceDataNotFound = 'BridgeAllowanceDataNotFound',\n BridgeApproveTxDataNotFound = 'BridgeApproveTxDataNotFound',\n CheckoutInitDepositAddrNotFound = 'CheckoutInitDepositAddrNotFound',\n}\n", "import { BaseError } from './BaseError'\nimport FWErrors from './errors.json'\nimport { ErrorBaseType, ErrorCode, ErrorType } from './types'\nexport class ClientError extends BaseError {\n constructor(\n type: string,\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorBaseType.ClientError,\n type,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n false,\n )\n }\n}\n\nexport class InvalidParameterError extends ClientError {\n constructor(\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.InvalidParameter,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class ResourceNotFoundError extends ClientError {\n constructor(\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n if (msg.includes('Chain name not found')) {\n const { reqId } = JSON.parse(msg)\n msg = ': Chain name not found or not supported.'\n fixSuggestion = 'Change your EnvOptions to the correct chain identifier.'\n super(\n ErrorType.ResourceNotFound,\n ErrorCode.ChainNotSupported,\n msg,\n { reqId },\n fixSuggestion,\n docLink,\n )\n } else {\n super(\n ErrorType.ResourceNotFound,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n }\n}\n\nexport class InvalidActionError extends ClientError {\n constructor(\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.InvalidAction,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class ThrottlingError extends ClientError {\n constructor(\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.ThrottlingError,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class AccessDeniedError extends ClientError {\n constructor(\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.AccessDeniedError,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class UserOpFailureError extends ClientError {\n constructor(\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n const FWCode = findFWContractError(msg)\n if (FWCode) {\n const { reqId } = JSON.parse(msg)\n msg = FWErrors[FWCode].info\n fixSuggestion = FWErrors[FWCode].suggestion\n super(\n ErrorType.UserOpFailureError,\n ErrorCode.FunWalletErrorCode,\n msg,\n { reqId },\n fixSuggestion,\n docLink,\n )\n } else {\n super(\n ErrorType.UserOpFailureError,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n }\n}\n\nconst findFWContractError = (msg: string) => {\n let match = msg.match(/FW\\d{3}/)\n if (!match) {\n match = msg.match(/AA\\d./)\n }\n return match?.[0]\n}\n", "import { BaseError } from './BaseError'\nimport { ErrorBaseType, ErrorType } from './types'\n\nexport class ServerError extends BaseError {\n constructor(\n type: string,\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorBaseType.ServerError,\n type,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n true,\n )\n }\n}\n\nexport class InternalFailureError extends ServerError {\n constructor(\n code: string,\n msg: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.InternalServerFailure,\n code,\n msg,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n", "import {\n InvalidParameterError,\n ResourceNotFoundError,\n UserOpFailureError,\n} from '../errors'\n\nexport const errorAbortHandler = (err: any, context: any) => {\n if (\n err instanceof ResourceNotFoundError ||\n err instanceof InvalidParameterError ||\n err instanceof UserOpFailureError\n ) {\n context.abort()\n }\n}\n", "import { PartialAttemptOptions } from '@lifeomic/attempt'\n\nimport { errorAbortHandler } from '../utils/error'\n\nexport type BaseResponse = any // TODO:\n\nexport type RetryOptions = PartialAttemptOptions<BaseResponse>\n\nexport const DEFAULT_RETRY_OPTIONS = {\n delay: 100,\n initialDelay: 0,\n maxDelay: 3000,\n factor: 2,\n maxAttempts: 5,\n timeout: 0,\n jitter: true,\n minDelay: 0,\n handleError: errorAbortHandler,\n handleTimeout: null,\n beforeAttempt: null,\n calculateDelay: null,\n} as RetryOptions\n", "import { toHex } from 'viem'\n\nexport function randomBytes(length: number) {\n const bytes = new Uint8Array(length)\n for (let i = 0; i < length; i++) {\n bytes[i] = Math.floor(Math.random() * 256)\n }\n return toHex(bytes)\n}\n\nexport function generateRandomCheckoutSalt() {\n return toHex(BigInt(randomBytes(32)))\n}\n\nexport function roundToNearestBottomTenth(n: number) {\n return Math.floor(n / 10) * 10\n}\n", "import { retry } from '@lifeomic/attempt'\nimport { toHex } from 'viem'\n\nimport { BaseRequest } from '../consts/request'\nimport {\n BaseResponse,\n DEFAULT_RETRY_OPTIONS,\n RetryOptions,\n} from '../consts/retry'\nimport {\n AccessDeniedError,\n ErrorCode,\n InternalFailureError,\n InvalidParameterError,\n ResourceNotFoundError,\n ThrottlingError,\n UserOpFailureError,\n} from '../errors'\nimport {\n DeleteRequest,\n GetRequest,\n PostRequest,\n PutRequest,\n} from './../consts/request'\n\nconst stringifyWithBigIntSanitization = (object: any) => {\n return JSON.stringify(\n object,\n (_, value) => (typeof value === 'bigint' ? toHex(value) : value), // return everything else unchanged\n )\n}\n\nexport const sendRequest = async ({\n uri,\n method,\n apiKey,\n body = {},\n retryOptions = {},\n signal,\n}: BaseRequest): Promise<BaseResponse> => {\n try {\n const headers = {\n 'Content-Type': 'application/json',\n ...(apiKey ? { 'X-Api-Key': apiKey } : {}),\n }\n\n const finalRetryOptions = {\n ...DEFAULT_RETRY_OPTIONS,\n ...(retryOptions || {}),\n } as RetryOptions\n\n return retry(async function () {\n const response = await fetch(uri, {\n method,\n headers,\n redirect: 'follow',\n signal,\n body:\n method !== 'GET' ? stringifyWithBigIntSanitization(body) : undefined,\n })\n const json = await response.json()\n if (response.ok) {\n return json\n } else if (response.status === 400) {\n throw new InvalidParameterError(\n ErrorCode.InvalidParameter,\n `bad request ${JSON.stringify(json)}`,\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 403) {\n throw new AccessDeniedError(\n ErrorCode.Unauthorized,\n 'Invalid API key or insufficient access.',\n { apiKey },\n 'Check your api key at https://app.fun.xyz and check with fun team if you believe something is off',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 404) {\n throw new ResourceNotFoundError(\n ErrorCode.ServerMissingData,\n JSON.stringify(json),\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 429) {\n throw new ThrottlingError(\n ErrorCode.RequestLimitExceeded,\n `too many requests ${JSON.stringify(json)}`,\n\n { body },\n 'you are making too many requests. please slow down. Reach out to fun team if you need more quota',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 500) {\n if ((json as any).errorCode === ErrorCode.UserOpFailureError) {\n throw new UserOpFailureError(\n ErrorCode.UserOpFailureError,\n JSON.stringify(json),\n { body },\n 'fix user op failure. Most of the time this is due to invalid parameters',\n 'https://docs.fun.xyz',\n )\n } else {\n throw new InternalFailureError(\n ErrorCode.ServerFailure,\n `server failure ${JSON.stringify(json)}`,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n } else if (response.status === 504) {\n throw new InternalFailureError(\n ErrorCode.ServerTimeout,\n `server timeout failure ${JSON.stringify(json)}`,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n } else if (!response.ok) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n `unknown server failure ${JSON.stringify(json)}`,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n return {}\n }, finalRetryOptions)\n } catch (err) {\n throw new InternalFailureError(\n ErrorCode.ServerConnectionError,\n `Cannot connect to Fun API Service ${err}`,\n\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n}\n\nexport async function sendGetRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: GetRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n method: 'GET',\n })\n}\n\nexport async function sendPostRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PostRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'POST',\n })\n}\n\nexport async function sendDeleteRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: DeleteRequest): Promise<void> {\n await sendRequest({\n uri,\n method: 'DELETE',\n apiKey,\n retryOptions,\n signal,\n })\n}\n\nexport async function sendPutRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PutRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'PUT',\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport {\n GetAllWalletNFTsByChainIdRequest,\n GetAllWalletNFTsByChainIdResponse,\n GetAllWalletNFTsRequest,\n GetAllWalletNFTsResponse,\n GetAllWalletTokensByChainIdRequest,\n GetAllWalletTokensByChainIdResponse,\n GetAllWalletTokensRequest,\n GetAllWalletTokensResponse,\n GetAssetPriceInfoRequest,\n GetAssetPriceInfoResponse,\n GetWalletLidoWithdrawalsByChainId,\n GetWalletLidoWithdrawalsByChainIdResponse,\n} from './types'\n\n/**===========================================================\n * REFERENCE CORE FILE: /packages/core/src/apis/AssetApis.ts\n * TODO: Remove this comment once migration is complete\n *===========================================================*/\n\n/**\n * Gets the estimated dollar unit price of a tokenAddress for checkout\n * @param chainId https://chainlist.org/ e.g. \"1\" for ethereum\n * @param assetTokenAddress tokenAddress of the asset on the given chain\n * @param apiKey\n */\nexport async function getAssetPriceInfo({\n chainId,\n assetTokenAddress,\n apiKey,\n}: GetAssetPriceInfoRequest): Promise<GetAssetPriceInfoResponse> {\n const priceInfo = await sendGetRequest({\n uri: `${API_BASE_URL}/asset/erc20/price/${chainId}/${assetTokenAddress}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n return priceInfo\n}\n\n/**\n * Get all tokens for a given wallet address\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n * @param signal AbortSignal to cancel the request when no longer needed\n */\nexport async function getAllWalletTokens({\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n signal,\n}: GetAllWalletTokensRequest): Promise<GetAllWalletTokensResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n signal,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**\n * Get all tokens for a given wallet address on a specific chain\n * @param chainId https://chainlist.org/\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n */\nexport async function getAllWalletTokensByChainId({\n chainId,\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n}: GetAllWalletTokensByChainIdRequest): Promise<GetAllWalletTokensByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}/${chainId}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**=======================\n * POTENTIAL DEPRECATION\n *=======================*/\n\n/**\n * Get all the NFTs owned by a wallet\n * @param walletAddress\n * @param apiKey\n */\nexport async function getAllWalletNFTs({\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsRequest): Promise<GetAllWalletNFTsResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}`,\n apiKey,\n })\n}\n\n/**\n * Get all the NFTs owned by a wallet on a specific chain\n * @param chainId From https://chainlist.org/\n * @param walletAddress Address of holder\n * @param apiKey\n */\nexport async function getAllWalletNFTsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsByChainIdRequest): Promise<GetAllWalletNFTsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n\n/**\n * Get all lido withdrawal request ids for a wallet address on a specific chain\n * @param {string} chainId https://chainlist.org/ ie \"1\" for ethereum\n * @param {string} holderAddr Address of holder\n * @returns [readyToWithdrawRequestIds, notReadyToWithdrawRequestIds]\n */\nexport async function getWalletLidoWithdrawalsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetWalletLidoWithdrawalsByChainId): Promise<GetWalletLidoWithdrawalsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/lido-withdrawals/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n", "import Big from 'big.js'\nimport { Address } from 'viem'\n\nimport { API_BASE_URL } from '../../consts'\nimport { ErrorCode, ResourceNotFoundError } from '../../errors'\nimport {\n generateRandomCheckoutSalt,\n roundToNearestBottomTenth,\n sendGetRequest,\n sendPostRequest,\n} from '../../utils'\nimport {\n CheckoutApiInitParams,\n CheckoutApiQuoteParams,\n CheckoutApiQuoteResponse,\n CheckoutDeactivateParams,\n CheckoutHistoryItem,\n CheckoutInitParams,\n CheckoutInitResponse,\n CheckoutQuoteParams,\n CheckoutQuoteResponse,\n CheckoutState,\n CheckoutTransferSponsorshipApiParams,\n CheckoutTransferSponsorshipParams,\n CheckoutTransferSponsorshipResponse,\n} from './types'\n\n/**\n * Gets a checkout quote (estimation).\n * @param fromChainId The ID of the chain where funds will be provided from.\n * @param fromTokenAddress The asset to fund the checkout. This must be either a chain native token or an ERC-20, on the fromChainId.\n * @param fromTokenDecimals The number of decimals for the fromTokenAddress.\n * @param toChainId The ID of the chain where the checkout operation is to be performed.\n * @param toTokenAddress The wanted asset for the checkout operation. This must be either a chain native token or an ERC-20, on the target chain.\n * @param toTokenAmount The amount of wanted asset for the checkout operation in base units.\n * @param toTokenDecimals The number of decimals for the toTokenAddress.\n * @param expirationTimestampMs The amount of time (duration) from now before the checkout operation expires.\n * @param apiKey A valid fun api key.\n * @return {Promise<CheckoutCoreQuoteResponse>} The formatted quote object\n */\nexport async function getCheckoutQuote({\n fromChainId,\n fromTokenAddress,\n fromTokenDecimals,\n toChainId,\n toTokenAddress,\n toTokenDecimals,\n toTokenAmount,\n expirationTimestampMs,\n sponsorInitialTransferGasLimit,\n recipientAddr,\n needsRefuel,\n userId,\n apiKey,\n}: CheckoutQuoteParams): Promise<CheckoutQuoteResponse> {\n try {\n const toMultipler = 10 ** toTokenDecimals\n const toAmountBaseUnitBI = BigInt(Math.floor(toTokenAmount * toMultipler))\n const queryParams = {\n userId,\n fromChainId,\n fromTokenAddress,\n toChainId,\n toTokenAddress,\n toAmountBaseUnit: toAmountBaseUnitBI.toString(),\n // Only pass in recipientAddr if specified\n ...(recipientAddr ? { recipientAddr } : {}),\n // Rounding nearest tenth second (instead of seconds) to better support backend quote caching feature\n // Reference: https://vintage-heaven-3cd.notion.site/API-Gateway-Caching-and-Pre-Warming-System-Draft-ee7909d9b85f43c793ce7bd2607bec02?pvs=4\n // Note: Rounding *down* instead of a regular round to safeguard against edge case of timing passing frontend range validation but failing backend range validation\n checkoutExpirationTimestampSeconds: roundToNearestBottomTenth(\n Math.round((Date.now() + expirationTimestampMs) / 1000),\n ).toString(),\n sponsorInitialTransferGasLimit,\n // @deprecated Not in use\n refuel: needsRefuel.toString(),\n } as CheckoutApiQuoteParams\n\n const searchParams = new URLSearchParams(queryParams)\n const quoteRes = (await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/quote?${searchParams}`,\n apiKey,\n })) as CheckoutApiQuoteResponse\n\n const fromMultipler = 10 ** fromTokenDecimals\n // Format the response for frontend usage\n return {\n quoteId: quoteRes.quoteId,\n fromTokenAddress: quoteRes.fromTokenAddress,\n estFeesUsd: quoteRes.estFeesUsd,\n estSubtotalUsd: quoteRes.estSubtotalUsd,\n estTotalUsd: quoteRes.estTotalUsd,\n estCheckoutTimeMs: quoteRes.estCheckoutTimeMs,\n estTotalFromAmountBaseUnit: quoteRes.estTotalFromAmountBaseUnit,\n estSubtotalFromAmountBaseUnit: quoteRes.estSubtotalFromAmountBaseUnit,\n estFeesFromAmountBaseUnit: quoteRes.estFeesFromAmountBaseUnit,\n // Added fields\n estFeesFromAmount: new Big(quoteRes.estFeesFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estSubtotalFromAmount: new Big(quoteRes.estSubtotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estTotalFromAmount: new Big(quoteRes.estTotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n } as CheckoutQuoteResponse\n } catch (err: any) {\n throw new Error(\n `An error occured trying to generate a checkout quote: ${err.message}`,\n )\n }\n}\n\n/**\n * Initializes a checkout\n * @param userOp The checkout UserOp, signed.\n * @param quoteId The quoteId specific to the checkout.\n * @param apiKey A valid fun api key.\n * @return {Address} The generated deposit address\n */\nexport async function initializeCheckout({\n userOp,\n quoteId,\n sourceOfFund,\n apiKey,\n clientMetadata,\n}: CheckoutInitParams): Promise<Address> {\n const body = {\n ...(userOp ? { userOp } : {}),\n quoteId,\n sourceOfFund,\n salt: generateRandomCheckoutSalt(),\n clientMetadata,\n } as CheckoutApiInitParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout`,\n body,\n apiKey,\n })\n if (!res?.depositAddr) {\n throw new ResourceNotFoundError(\n ErrorCode.CheckoutInitDepositAddrNotFound,\n 'Unable to initialize checkout',\n body,\n '',\n 'https://docs.fun.xyz',\n )\n }\n return res.depositAddr as CheckoutInitResponse\n}\n\nexport async function deactivateCheckout({\n depositAddress,\n apiKey,\n}: CheckoutDeactivateParams) {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/update/${depositAddress}`,\n body: {\n // Fixed state to cancel the checkout\n state: CheckoutState.CANCELLED,\n },\n apiKey,\n })\n return true\n } catch (err) {\n throw new Error('Unable to deactivate checkout')\n }\n}\n\n/**\n * Gets a checkout given a depositAddress\n * @param depositAddress A unique deposit address associated with a backend checkout item.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns The checkout object if exists. Otherwise, null.\n */\nexport async function getCheckoutByDepositAddress({\n depositAddress,\n apiKey,\n signal,\n}: {\n depositAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem | null> {\n try {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/${depositAddress}`,\n apiKey,\n signal,\n })\n } catch (err) {\n if (err instanceof ResourceNotFoundError) {\n return null\n }\n throw err\n }\n}\n\n/**\n * Gets all checkouts associated with a funWallet\n * @param funWalletAddress A funWallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByFunWalletAddress({\n funWalletAddress,\n apiKey,\n signal,\n}: {\n funWalletAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/fun-wallet/${funWalletAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a recipient address\n * @param recipientAddress A wallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByRecipientAddress({\n recipientAddress,\n apiKey,\n signal,\n}: {\n recipientAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/recipient/${recipientAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a funkit userId string\n * @param userId A userId string.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByUserId({\n userId,\n apiKey,\n signal,\n}: {\n userId: string\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/userId/${userId}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\nexport async function getPaymasterDataForCheckoutSponsoredTransfer({\n depositAddress,\n transferUserOp,\n apiKey,\n}: CheckoutTransferSponsorshipParams): Promise<CheckoutTransferSponsorshipResponse> {\n const body = {\n depositAddress,\n userOp: transferUserOp,\n } as CheckoutTransferSponsorshipApiParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/sponsor-transfer`,\n body,\n apiKey,\n })\n if (!res) {\n // TODO: Better error handling\n throw new Error('Unable to get sponsorship information')\n }\n return res as CheckoutTransferSponsorshipResponse\n}\n", "/**===============*\n * CHECKOUT QUOTE *\n *================*/\nimport { Address, Hex } from 'viem'\n\n// TODO: Define the UserOperation type\ntype UserOperation = any\n\n// The params required for the actual /checkout/quote api\nexport type CheckoutApiQuoteParams = {\n fromChainId: string\n fromTokenAddress: Address\n toChainId: string\n toTokenAddress: Address\n toAmountBaseUnit: string\n checkoutExpirationTimestampSeconds: string\n sponsorInitialTransferGasLimit: string\n refuel: string\n userId: string\n recipientAddr?: Address\n}\n\nexport type CheckoutQuoteParams = Omit<\n CheckoutApiQuoteParams,\n 'toAmountBaseUnit' | 'checkoutExpirationTimestampSeconds' | 'refuel'\n> & {\n fromTokenDecimals: number\n toTokenDecimals: number\n toTokenAmount: number\n expirationTimestampMs: number\n needsRefuel: boolean\n apiKey: string\n}\n\n// The response of the actual /checkout/quote api\nexport type CheckoutApiQuoteResponse = {\n quoteId: string\n estTotalFromAmountBaseUnit: string\n estSubtotalFromAmountBaseUnit: string\n estFeesFromAmountBaseUnit: string\n fromTokenAddress: Address\n estFeesUsd: number\n estSubtotalUsd: number\n estTotalUsd: number\n estCheckoutTimeMs: number\n}\n\n// The formatted response quote interface from the core sdk\nexport type CheckoutQuoteResponse = CheckoutApiQuoteResponse & {\n estTotalFromAmount: string\n estSubtotalFromAmount: string\n estFeesFromAmount: string\n}\n\n/**===============*\n * CHECKOUT INIT *\n *================*/\n\nexport type CheckoutApiInitParams = {\n userOp?: UserOperation\n quoteId: string\n sourceOfFund: string\n salt: Hex\n clientMetadata: object\n}\n\nexport type CheckoutInitParams = Omit<CheckoutApiInitParams, 'salt'> & {\n apiKey: string\n}\n\nexport type CheckoutInitResponse = Address\n\n/**=====================*\n * CHECKOUT DEACTIVATE *\n *======================*/\n\nexport type CheckoutDeactivateParams = {\n depositAddress: Address\n apiKey: string\n}\n\n// Reference from api server: https://github.com/fun-xyz/fun-api-server/blob/main/src/tables/FunWalletCheckout.ts#L11C1-L21C2\nexport enum CheckoutState {\n // In-progress States\n FROM_UNFUNDED = 'FROM_UNFUNDED',\n FROM_FUNDED = 'FROM_FUNDED',\n FROM_POOLED = 'FROM_POOLED',\n TO_UNFUNDED = 'TO_UNFUNDED',\n TO_FUNDED = 'TO_FUNDED',\n TO_POOLED = 'TO_POOLED',\n TO_READY = 'TO_READY',\n PENDING_RECEIVAL = 'PENDING_RECEIVAL',\n // Terminal States\n COMPLETED = 'COMPLETED',\n CHECKOUT_ERROR = 'CHECKOUT_ERROR',\n EXPIRED = 'EXPIRED',\n CANCELLED = 'CANCELLED',\n}\n\nexport type CheckoutHistoryItem = {\n createdTimeMs: number\n depositAddr: Address\n currentDepositAddr: Address\n recipientAddr: Address\n expirationTimestampSeconds: number\n fromAmountBaseUnit: string\n fromChainId: string\n fromTokenAddress: Address\n funWalletAddr: Address\n lastUpdatedTimeMs: number\n salt: Hex\n state: CheckoutState\n toAmountBaseUnit: string\n toChainId: string\n toTokenAddress: Address\n userOp: UserOperation\n version: number\n clientMetadata: object\n}\n\n/**===============================*\n * CHECKOUT TRANSFER SPONSORSHIP *\n *================================*/\n\nexport type CheckoutTransferSponsorshipParams = {\n transferUserOp: UserOperation\n depositAddress: Address\n apiKey: string\n}\n\nexport type CheckoutTransferSponsorshipApiParams = {\n userOp: UserOperation\n depositAddress: Address\n}\n\nexport type CheckoutTransferSponsorshipResponse = {\n signerAddress: Address\n signature: Hex\n deadline: number\n paymasterAndData: Hex\n}\n", "import { FUN_FAUCET_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport { GetAssetFromFaucetRequest } from './types'\n\nexport async function getAssetFromFaucet({\n token,\n chain,\n walletAddress,\n apiKey,\n}: GetAssetFromFaucetRequest) {\n return await sendGetRequest({\n uri: `${FUN_FAUCET_URL}/get-faucet?token=${token}&testnet=${chain}&addr=${walletAddress}`,\n apiKey,\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport {\n GetCryptocurrencyHoldingsRequest,\n GetLinkTokenRequest,\n GetLinkTokenResponse,\n GetTransferIntegrationsRequest,\n GetTransferIntegrationsResponse,\n MeshExecuteTransferRequest,\n MeshExecuteTransferResponse,\n PreviewTransferRequest,\n} from './types'\n\n/**\n * @param authToken The authentication token to send the asset from.\n * @param type The type of the integration to send the asset from.\n * @return https://docs.meshconnect.com/reference/post_api-v1-holdings-get\n */\nexport async function meshGetCryptocurrencyHoldings({\n authToken,\n type,\n apiKey,\n}: GetCryptocurrencyHoldingsRequest): Promise<any> {\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/holdings/get`,\n body: { authToken, type },\n apiKey,\n })\n return res\n}\n\n/**\n * @return https://docs.meshconnect.com/reference/get_api-v1-transfers-managed-integrations\n */\nexport async function meshGetTransferIntegrations({\n apiKey,\n}: GetTransferIntegrationsRequest): Promise<GetTransferIntegrationsResponse> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/integrations`,\n apiKey,\n })\n return res\n}\n\n/**\n * @param userId A unique Id representing the end user. Typically this will be a user Id from the\nclient application. Personally identifiable information, such as an email address or phone number,\nshould not be used. 50 characters length maximum.\n * @param integrationId A unique identifier representing a specific integration obtained from the list of available integrations.\n * @param restrictMultipleAccounts The final screen of Link allows users to \u201Ccontinue\u201D back to your app or \u201CLink another account.\u201D\nIf this param is present then this button will be hidden.\n * @param transferOptions Encapsulates transaction-related parameters, including destination addresses and the amount to transfer in fiat currency.\n * @return https://docs.meshconnect.com/reference/post_api-v1-linktoken\n */\nexport async function meshGetLinkToken({\n userId,\n integrationId,\n restrictMultipleAccounts,\n transferOptions,\n apiKey,\n}: GetLinkTokenRequest): Promise<GetLinkTokenResponse> {\n let body: any = { userId }\n if (integrationId) {\n body = { ...body, integrationId }\n }\n if (restrictMultipleAccounts) {\n body = { ...body, restrictMultipleAccounts }\n }\n if (transferOptions) {\n body = { ...body, transferOptions }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/linktoken`,\n body,\n apiKey,\n })\n return res\n}\n\n/**\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param toAuthToken The authentication token of the target integration. Can be used alternatively to the address in the ToAddress field. If used, toType should also be provided.\n * @param toType The type of the target integration to send assets to. Used along with the toAuthToken alternatively to ToAddress.\n * @param networkId The network to send the asset over. This is generated by Mesh, it isn't a chainId or chain name.\n * @param symbol The symbol of the digital asset to send.\n * @param toAddress The target address to send the asset to.\n * @param amount The amount to send, in crypto.\n * @param amountInFiat The amount to send, in fiat currency. Can be used alternatively to Amount.\n * @param fiatCurrency Fiat currency that is to get corresponding converted fiat values of transfer and fee amounts. If not provided, defaults to USD.\n * @returns https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-preview\n */\nexport async function meshPreviewTransfer({\n fromAuthToken,\n fromType,\n toAuthToken,\n toType,\n networkId,\n symbol,\n toAddress,\n amount,\n amountInFiat,\n fiatCurrency,\n apiKey,\n}: PreviewTransferRequest): Promise<any> {\n let body: any = { fromAuthToken, fromType }\n if (toAuthToken) {\n body = { ...body, toAuthToken }\n }\n if (toType) {\n body = { ...body, toType }\n }\n if (networkId) {\n body = { ...body, networkId }\n }\n if (symbol) {\n body = { ...body, symbol }\n }\n if (toAddress) {\n body = { ...body, toAddress }\n }\n if (amount) {\n body = { ...body, amount }\n }\n if (amountInFiat) {\n body = { ...body, amountInFiat }\n }\n if (fiatCurrency) {\n body = { ...body, fiatCurrency }\n }\n\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/preview`,\n body,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n/**\n *\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param previewId The preview ID of the transfer to execute.\n * @param mfaCode Multi-factor auth code that should be provided if the status of the transfer was MfaRequired.\n * @returns https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-execute\n */\nexport async function meshExecuteTransfer({\n fromAuthToken,\n fromType,\n previewId,\n mfaCode,\n apiKey,\n}: MeshExecuteTransferRequest): Promise<MeshExecuteTransferResponse> {\n let body: any = { fromAuthToken, fromType, previewId }\n if (mfaCode) {\n body = { ...body, mfaCode }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/execute`,\n body,\n apiKey,\n })\n return res\n}\n", "export interface GetCryptocurrencyHoldingsRequest {\n authToken: string\n type: string\n apiKey: string\n}\n\nexport interface GetTransferIntegrationsRequest {\n apiKey: string\n}\n\nexport interface IntegrationNetworkInfo {\n chainId: string\n id: string\n logoUrl: string\n name: string\n nativeSymbol: string\n supportedTokens: string[]\n}\n\nexport interface TransferIntegration {\n networks: IntegrationNetworkInfo[]\n supportsIncomingTransfers: boolean\n supportsOutgoingTransfers: boolean\n type: string\n}\n\nexport interface GetTransferIntegrationsResponse {\n integrations: TransferIntegration[]\n}\n\nexport interface GetLinkTokenRequest {\n userId: string\n integrationId?: string | null\n restrictMultipleAccounts?: boolean\n transferOptions?: any | null\n apiKey: string\n}\n\nexport interface GetLinkTokenResponse {\n linkToken: string\n}\n\nexport interface PreviewTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n toAuthToken?: string | null\n toType?: string | null\n networkId?: string\n symbol?: string | null\n toAddress?: string | null\n amount?: string | null\n amountInFiat?: string | null\n fiatCurrency?: string | null\n}\n\nexport interface MeshExecuteTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n previewId: string\n mfaCode?: string | null\n}\n\n// Reference: https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-execute\nexport enum MeshExecuteTransferStatus {\n succeeded = 'succeeded',\n failed = 'failed',\n mfaRequired = 'mfaRequired',\n emailConfirmationRequired = 'emailConfirmationRequired',\n deviceConfirmationRequired = 'deviceConfirmationRequired',\n mfaFailed = 'mfaFailed',\n addressWhitelistRequired = 'addressWhitelistRequired',\n secondMfaRequired = 'secondMfaRequired',\n}\n\nexport enum MeshExecuteTransferMfaType {\n unspecified = 'unspecified',\n phone = 'phone',\n email = 'email',\n otp = 'otp',\n}\n\nexport interface MeshExecuteTransferContent {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n\nexport interface MeshExecuteTransferResponse {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { ErrorCode, InternalFailureError } from '../../errors'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport {\n GetMoonpayBuyQuoteForCreditCardRequest,\n GetMoonpayOffRampUrlRequest,\n GetMoonpayOnRampUrlRequest,\n GetMoonpayUrlSignatureRequest,\n MoonpayCurrency,\n} from './types'\n\nexport async function getMoonpayUrlSignature({\n url,\n isSandbox,\n apiKey,\n}: GetMoonpayUrlSignatureRequest): Promise<string> {\n const signature = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-signature/`,\n body: { url, isSandbox },\n apiKey,\n })\n if (!signature || !signature?.url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No onramp url found.',\n { url },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return signature.url\n}\n\nexport async function getMoonpayBuyQuoteForCreditCard({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n baseCurrencyAmount,\n extraFeePercentage,\n areFeesIncluded,\n apiKey,\n}: GetMoonpayBuyQuoteForCreditCardRequest): Promise<any> {\n const params = new URLSearchParams({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n paymentMethod: 'credit_debit_card',\n ...(baseCurrencyAmount == null\n ? {}\n : { baseCurrencyAmount: baseCurrencyAmount.toString() }),\n ...(extraFeePercentage == null\n ? {}\n : { extraFeePercentage: extraFeePercentage.toString() }),\n ...(areFeesIncluded == null\n ? {}\n : { areFeesIncluded: areFeesIncluded.toString() }),\n }).toString()\n\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-buy-quote?${params}`,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n\n/**=======================\n * POTENTIAL DEPRECATION\n *=======================*/\n\nexport async function getMoonpayOnRampUrl({\n apiKey,\n walletAddr,\n currencyCode,\n}: GetMoonpayOnRampUrlRequest): Promise<string> {\n const endpoint = `on-ramp/${walletAddr}?provider=moonpay`\n if (currencyCode) {\n endpoint.concat(`&currencyCode=${currencyCode}`)\n }\n const url: string = (\n await sendGetRequest({\n uri: `${API_BASE_URL}/${endpoint}`,\n apiKey,\n })\n )?.url\n if (!url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No onramp url found.',\n { walletAddr },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return url\n}\n\nexport async function getMoonpayOffRampUrl({\n walletAddr,\n apiKey,\n}: GetMoonpayOffRampUrlRequest): Promise<string> {\n const url: string = (\n await sendGetRequest({\n uri: `${API_BASE_URL}/off-ramp/${walletAddr}?provider=moonpay`,\n apiKey,\n })\n )?.url\n if (!url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No offramp url found.',\n { walletAddr },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return url\n}\n\nexport async function getMoonpayOnRampSupportedCurrencies({\n apiKey,\n}: {\n apiKey: string\n}): Promise<MoonpayCurrency[]> {\n const currencies: MoonpayCurrency[] = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-currencies`,\n apiKey,\n })\n if (!currencies || !currencies.length) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No supported currencies found.',\n {},\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return currencies\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport {\n CreateStripeBuySessionBody,\n CreateStripeBuySessionResponse,\n GetStripeBuyQuoteRequest,\n GetStripeBuyQuoteResponse,\n} from './types'\n\nexport async function getStripeBuyQuote({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n isSandbox,\n apiKey,\n}: GetStripeBuyQuoteRequest): Promise<GetStripeBuyQuoteResponse> {\n const params = new URLSearchParams({\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrencies: destinationCurrency,\n // Only allow one network in this SDK\n destinationNetworks: destinationNetwork,\n }).toString()\n const buyQuoteResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-buy-quote?${params}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buyQuoteResp as GetStripeBuyQuoteResponse\n}\n\nexport async function createStripeBuySession({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n walletAddress,\n customerIpAddress,\n isSandbox,\n apiKey,\n}: CreateStripeBuySessionBody): Promise<CreateStripeBuySessionResponse> {\n const body = {\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrency,\n destinationCurrencies: [destinationCurrency],\n // Only allow one network in this SDK\n destinationNetwork,\n destinationNetworks: [destinationNetwork],\n // Only allow one wallet address in this SDK, and it must correspond to the destination network\n walletAddresses: {\n [destinationNetwork]: walletAddress,\n },\n ...(customerIpAddress ? { customerIpAddress } : {}),\n }\n const newBuySessionResp = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout`,\n body,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return newBuySessionResp as CreateStripeBuySessionResponse\n}\n\nexport async function getStripeBuySession({\n sessionId,\n apiKey,\n}: {\n sessionId: string\n apiKey: string\n}): Promise<CreateStripeBuySessionResponse> {\n const buySessionResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout-session/${sessionId}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buySessionResp as CreateStripeBuySessionResponse\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendPostRequest } from '../../utils'\nimport { SendSupportMessageRequest } from './types'\n\nexport async function sendSupportMessage({\n title,\n description,\n userEmail,\n apiKey,\n}: SendSupportMessageRequest): Promise<boolean> {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/support/send-message`,\n body: { title, description, userEmail },\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return true\n } catch (err) {\n return false\n }\n}\n"],
5
- "mappings": ";AAAO,IAAM,eACX,QACI,mCACA,QACA,mCACA,QACA;AAAA;AAAA,EAEA;AAAA;AAEC,IAAM,iBAAiB;;;ACV9B,IAAM,UAAU;AACT,IAAM,YAAN,cAAwB,MAAM;AAAA,EAGnC,YACS,UACA,MACA,MACP,KAEO,YACP,eACA,SACA,aAAa,OACb;AACA,UAAM,GAAG,GAAG;AAAA;AAAA,EAAO,aAAa;AAAA,QAAW,OAAO;AAAA,WAAc,OAAO,EAAE;AAVlE;AACA;AACA;AAGA;AAMP,QAAI,YAAY;AACd,WAAK,QAAQ;AAAA,IACf;AACA,SAAK,WAAW;AAChB,SAAK,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,EAC1C;AAAA,EAEA,UAAU;AACR,SAAK,WACH;AAAA,EACJ;AACF;;;AC3BA;AAAA,EACE,MAAQ;AAAA,IACN,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA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AAA,IACA,mBAAmB,kBAAkB,SAAS;AAAA;AAAA,IAE9C;AAAA,IACA,uBAAuB,CAAC,mBAAmB;AAAA;AAAA,IAE3C;AAAA,IACA,qBAAqB,CAAC,kBAAkB;AAAA;AAAA,IAExC,iBAAiB;AAAA,MACf,CAAC,kBAAkB,GAAG;AAAA,IACxB;AAAA,IACA,GAAI,oBAAoB,EAAE,kBAAkB,IAAI,CAAC;AAAA,EACnD;AACA,QAAM,oBAAoB,MAAM,gBAAgB;AAAA,IAC9C,KAAK,GAAG,YAAY;AAAA,IACpB;AAAA,IACA,cAAc,EAAE,aAAa,EAAE;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEA,eAAsB,oBAAoB;AAAA,EACxC;AAAA,EACA;AACF,GAG4C;AAC1C,QAAM,iBAAiB,MAAM,eAAe;AAAA,IAC1C,KAAK,GAAG,YAAY,oCAAoC,SAAS;AAAA,IACjE,cAAc,EAAE,aAAa,EAAE;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;AC9EA,eAAsB,mBAAmB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgD;AAC9C,MAAI;AACF,UAAM,gBAAgB;AAAA,MACpB,KAAK,GAAG,YAAY;AAAA,MACpB,MAAM,EAAE,OAAO,aAAa,UAAU;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,aAAa,EAAE;AAAA,IACjC,CAAC;AACD,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["export const API_BASE_URL =\n process.env.NODE_ENV === 'staging'\n ? 'https://api.fun.xyz/staging/v1'\n : process.env.NODE_ENV === 'testing'\n ? 'https://api.fun.xyz/testing/v1'\n : process.env.NODE_ENV === 'local'\n ? 'http://127.0.0.1:3000'\n : // Production\n 'https://api.fun.xyz/v1'\n\nexport const FUN_FAUCET_URL = 'https://api.fun.xyz/demo-faucet'\n", "const discord = 'https://discord.gg/mvQunrx6NG'\nexport class BaseError extends Error {\n timestamp: string\n\n constructor(\n public baseType: string,\n public type: string,\n public code: string,\n msg: string,\n public rawMessage: string,\n\n public paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n isInternal = false,\n ) {\n super(`${msg}\\n\\n${fixSuggestion}\\nDocs: ${docLink}\\nDiscord: ${discord}`)\n if (isInternal) {\n this.loadEnd()\n }\n\n this.message += '\\n\\nTrace:'\n this.timestamp = new Date().toUTCString()\n }\n\n loadEnd() {\n this.message +=\n '\\n\\nThis is an internal sdk error. Please contact the fun team at our Discord for the fastest response.'\n }\n}\n", "{\n \"AA21\": {\n \"info\": \" Your wallet lacks funds for this transaction.\",\n \"suggestion\": \"To fix this error, make sure you have enough funds in your wallet to cover the transaction fee.\"\n },\n \"FW000\": {\n \"info\": \" Create3Deployer.requireDeployerOnly() - Signatures were not sorted before being passed in\",\n \"suggestion\": \"To fix this error, make sure to short sigs before passing them into `requireDeployerOnly`. You can do this by calling `sigs.sort()` before passing them in. It is also possible to run into this error if the hash that was signed was not the correct hash.\"\n },\n \"FW001\": {\n \"info\": \" Create3Deployer.requireDeployerOnly() - Signature failed to be recovered. ercrecover returned the zero address\",\n \"suggestion\": \"To fix this error, make sure to pass in enough valid signatures that sign the `hash` in the `sigs` array\"\n },\n \"FW002\": {\n \"info\": \" Create3Deployer.addDeployer() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `hashAddDeployer()`\"\n },\n \"FW003\": {\n \"info\": \" Create3Deployer.removeDeployer() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `hashRemoveDeployer()`\"\n },\n \"FW004\": {\n \"info\": \" Create3Deployer.setThreshold() - Threshold must be greater than 1\",\n \"suggestion\": \"To fix this error, `threshold` is greater than 1\"\n },\n \"FW005\": {\n \"info\": \" Create3Deployer.setThreshold() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_threshold))`\"\n },\n \"FW006\": {\n \"info\": \" Create3Deployer.callChild() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(child, data, _nonce, block.chainid))`\"\n },\n \"FW007\": {\n \"info\": \" Create3Deployer.callChild() - Invalid Nonce, nonce must be 1 greater than the current nonce\",\n \"suggestion\": \"To fix this error, make sure `_nonce` is equal to the current nonce + 1\"\n },\n \"FW008\": {\n \"info\": \" Create3Deployer.callChild() - call to child failed\",\n \"suggestion\": \"To fix this error, check to see what is making the call to the child fail\"\n },\n \"FW009\": {\n \"info\": \" Create3Deployer.deploy() - Invalid Hash\",\n \"suggestion\": \"To fix this error, make sure `hash` is equal to `keccak256(abi.encodePacked(_salt, _creationCode))`\"\n },\n \"FW010\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_deployer` is not equal to the zero address\"\n },\n \"FW011\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_funWalletImpAddress` is not equal to the zero address\"\n },\n \"FW012\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_feeOracle` is not equal to the zero address\"\n },\n \"FW013\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_walletInit` is not equal to the zero address\"\n },\n \"FW014\": {\n \"info\": \" FunWalletFactory.constructor() - Unable to generate the address from this deployerSalt\",\n \"suggestion\": \"To fix this error, make sure `FunWalletFactoryV1` has not already been deployed from the given create3deployer contract. If it has been, change `FunWalletFactoryV1` to `FunWalletFactoryV2` or another version.\"\n },\n \"FW015\": {\n \"info\": \" FunWalletFactory.constructor() - Generated the wrong address from this deployerSalt\",\n \"suggestion\": \"To fix this error, make sure `FunWalletFactoryV1` has not already been deployed from the given create3deployer contract. If it has been, change `FunWalletFactoryV1` to `FunWalletFactoryV2` or another version.\"\n },\n \"FW016\": {\n \"info\": \" FunWalletFactory.createAccount() - Call to initialize failed on the deployed proxy\",\n \"suggestion\": \"To fix this error, make sure the `initializerCallData` is formatted correctly\"\n },\n \"FW017\": {\n \"info\": \" FunWalletFactory - Caller must be deployer\",\n \"suggestion\": \"To fix this error, make sure to call the function from the deployer address\"\n },\n \"FW018\": {\n \"info\": \" WalletInit.commit() - The previous commit has not expired\",\n \"suggestion\": \"To fix this error, wait for the previous commit with this `commitKey` to expire. This should take at most 10 minutes.\"\n },\n \"FW019\": {\n \"info\": \" WalletInit.validateSalt() - The hash at the commitKey does not match `keccak256(abi.encode(seed, owner, initializerCallData))`\",\n \"suggestion\": \"To fix this error, make sure the seed, owner, and initializerCallData are hashed and stored in commits at the corresponding `commitKey`\"\n },\n \"FW020\": {\n \"info\": \" WalletInit.validateSalt() - The new owner of the funwallet must match data.newFunWalletOwner from loginData\",\n \"suggestion\": \"To fix this error, make sure the owner set in `loginData` matches the owner address returned from the tweet.\"\n },\n \"FW021\": {\n \"info\": \" WalletInit.setOracle() - The address of the new `_oracle` must not be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_oracle` is not the zero address\"\n },\n \"FW022\": {\n \"info\": \" Create3Deployer.deployFromChild() - Invalid Child Address\",\n \"suggestion\": \"To fix this error, make sure the caller is a contract deployed from the Create3Deployer\"\n },\n \"FW023\": {\n \"info\": \" ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Target Code Hash\",\n \"suggestion\": \"To fix this error, make sure the caller is a contract targeted is a ERC1967ProxyData contract\"\n },\n \"FW024\": {\n \"info\": \" ImplementationRegistry.verifyIsValidContractAndImplementation() - Invalid Contract Implementation Address\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW025\": {\n \"info\": \" ImplementationRegistry.addImplementation() - Invalid Signature Amount\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW026\": {\n \"info\": \" ImplementationRegistry.removeImplementation() - Invalid Signature Amount\",\n \"suggestion\": \"To fix this error, make sure you have the minimun threshold amount of valid signatures.\"\n },\n \"FW027\": {\n \"info\": \" WalletInit.commit() - Unable to commit with a previously used commit hash\",\n \"suggestion\": \"To fix this error, make sure you are not reusing someone else's commit hash. If there are conflicts, just regenerate the seed randomly\"\n },\n \"FW028\": {\n \"info\": \" MultiSigDeployer.constructor() - Threshold can't be greater than deployers length\",\n \"suggestion\": \"To fix this error, make sure the threshold value is not 0\"\n },\n \"FW029\": {\n \"info\": \" WalletInit.invalidateUsedSeed() - msg.sender must equal funwalletfactory\",\n \"suggestion\": \"To fix this error, make sure you are calling this function from the FunWalletFactory contract\"\n },\n \"FW030\": {\n \"info\": \" WalletInit.setFunWalletFactory() - funwalletfactory address cannot be set to 0\",\n \"suggestion\": \"To fix this error, make sure you are passing in the valid funwalletfactory address\"\n },\n \"FW031\": {\n \"info\": \" WalletInit.validateSalt() - seed has already been used\",\n \"suggestion\": \"To fix this error, make sure you are not using an existing salt\"\n },\n \"FW032\": {\n \"info\": \" FunWalletFactory.setFeeOracle() - Cannot set the fee oracle address to 0\",\n \"suggestion\": \"To fix this error, make sure you are using the correct address of the fee oracle\"\n },\n \"FW033\": {\n \"info\": \" FunWalletFactory.constructor() - Invalid Address, cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_entryPoint` is not equal to the zero address\"\n },\n \"FW034\": {\n \"info\": \" Create3Deployer.callChild() - Value not equal to msg.value\",\n \"suggestion\": \"To fix this error, make sure `msg.value` is equal to the `value` parameter.\"\n },\n \"FW100\": {\n \"info\": \" Module.execute() - execute() needs to be overriden\",\n \"suggestion\": \"To fix this error, make sure you are overriding the execute method in your module\"\n },\n \"FW101\": {\n \"info\": \" ApproveAndExec.approveAndExecute() - the approveData's first four bytes must be the approve() function selector\",\n \"suggestion\": \"To fix this error, change `approveData` such that the first four bytes are `bytes4(keccak256('approve(address,uint256)'))`\"\n },\n \"FW102\": {\n \"info\": \" ApproveAndSwap.constructor() - `_wethAddr` cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_wethAddr` is not set to the zero address\"\n },\n \"FW103\": {\n \"info\": \" ApproveAndSwap.constructor() - `_router` cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure `_router` is not set to the zero address\"\n },\n \"FW104\": {\n \"info\": \" ApproveAndSwap.executeSwapEth() - msg.sender does not have enough weth\",\n \"suggestion\": \"To fix this error, make sure msg.sender has a weth balance >= `amount`\"\n },\n \"FW105\": {\n \"info\": \" ApproveAndSwap.\\\\_internalSwap() - Approve failed\",\n \"suggestion\": \"To fix this error, make sure you have formatted approve correctly\"\n },\n \"FW106\": {\n \"info\": \" AaveWithdraw.execute() - Withdrawing a zero balance\",\n \"suggestion\": \"You are trying to withdraw from aave but don't have a balance\"\n },\n \"FW107\": {\n \"info\": \" ApproveAndExec.approveAndExecute() - Approve failed\",\n \"suggestion\": \"The token you tried to approve failed\"\n },\n \"FW108\": {\n \"info\": \" UniswapV3LimitOrder.execute() - Approval Failed\",\n \"suggestion\": \"You are trying to withdraw from aave but don't have a balance\"\n },\n \"FW109\": {\n \"info\": \" UniswapV3LimitOrder.constructor() - Router cannot be address zero\",\n \"suggestion\": \"Make sure you are not passing in the zero address when initializing the module\"\n },\n \"FW110\": {\n \"info\": \" UniswapV3LimitOrder.constructor() - Quoter cannot be zero address\",\n \"suggestion\": \"Make sure you are not passing in the zero address when initializing the module\"\n },\n \"FW200\": {\n \"info\": \" FeePercentOracle.setValues() - feepercent must be less than or equals to 100%\",\n \"suggestion\": \"To fix this error, `_feepercent` must be less than or equals to `10 ** _decimals`\"\n },\n \"FW201\": {\n \"info\": \" FeePercentOracle.withdrawEth() - eth transfer failed\",\n \"suggestion\": \"To fix this error, investigate why the eth withdrawal failed. This is likely because `amount` was greater than the eth balance in the FeePercentOracle\"\n },\n \"FW202\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator price must be greater than 0\",\n \"suggestion\": \"To fix this error, retry the call and make sure price is greater than 0\"\n },\n \"FW203\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator updatedAt must be greater than 0\",\n \"suggestion\": \"To fix this error, retry the call and make sure updatedAt is greater than 0\"\n },\n \"FW204\": {\n \"info\": \" TokenPriceOracle.getTokenValueOfEth() - chainlink aggregator answeredInRound must be greater than or equal to roundId\",\n \"suggestion\": \"To fix this error, retry the call and make sure answeredInRound must be greater than or equal to roundId\"\n },\n \"FW205\": {\n \"info\": \" TwitterOracle.batchSetTweet() - socialHandles, loginTypes, seeds, owners length must match in length\",\n \"suggestion\": \"To fix this error, make sure all arrays passed into this function are the same length.\"\n },\n \"FW206\": {\n \"info\": \" TwitterOracle.setTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW207\": {\n \"info\": \" TwitterOracle.setTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW208\": {\n \"info\": \" TwitterOracle.batchSetTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW209\": {\n \"info\": \" TwitterOracle.batchSetTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW210\": {\n \"info\": \" TwitterOracle.fetchTweet() - the seed from twitter cannot be empty\",\n \"suggestion\": \"To fix this error, make sure the seed you post on twitter is not empty {}\"\n },\n \"FW211\": {\n \"info\": \" TwitterOracle.fetchTweet() - the address from twitter cannot be 0\",\n \"suggestion\": \"To fix this error, make sure the address you post on twitter for the new owner is not the zero address, otherwise you would be unable to claim ownership of the funwallet\"\n },\n \"FW300\": {\n \"info\": \" BasePaymaster.constructor() - entrypoint address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure entrypoint address is not the zero address\"\n },\n \"FW301\": {\n \"info\": \" BasePaymaster.\\\\_requireFromEntryPoint() - the msg.sender must be from the entrypoint\",\n \"suggestion\": \"To fix this error, make sure the msg.sender must be from the entrypoint\"\n },\n \"FW302\": {\n \"info\": \" GaslessPaymaster.batchActions() - the ith delegate call failed\",\n \"suggestion\": \"To fix this error, make sure the calldata for `data[i]` is a valid call\"\n },\n \"FW303\": {\n \"info\": \" GaslessPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated\",\n \"suggestion\": \"To fix this error, increase the amount of msg.value you are passing to this function\"\n },\n \"FW304\": {\n \"info\": \" GaslessPaymaster.\\\\_withdrawDepositTo() - the withdrawal has not been unlocked\",\n \"suggestion\": \"To fix this error, wait till block.number is greater than the unlockBlock for the sender and make sure `unlockBlock[sender]` is nonzero\"\n },\n \"FW305\": {\n \"info\": \" GaslessPaymaster.\\\\_withdrawDepositTo() - the balances of the sender must be greater than the withdrawal amount\",\n \"suggestion\": \"To fix this error, decrease the amount you are trying to withdraw\"\n },\n \"FW306\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the userOp.paymasterAndData must have a length of 40\",\n \"suggestion\": \"To fix this error, change the `paymasterAndData` field in the `userOp` such that the length is 40\"\n },\n \"FW307\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the verificationGasLimit must be greater than the `COST_OF_POST` variable in GaslessPaymaster\",\n \"suggestion\": \"To fix this error, increase the `verificationGasLimit` in the `userOp`\"\n },\n \"FW308\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - the sponsor's eth is not locked for use\",\n \"suggestion\": \"To fix this error, make sure the sponsor's eth is locked using `lockDeposit()`\"\n },\n \"FW309\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - The sponsor needs to approve the spender\",\n \"suggestion\": \"To fix this error, make sure to approve the spender using `setSpenderWhitelistMode()` or `setSpenderBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setListMode()\"\n },\n \"FW310\": {\n \"info\": \" GaslessPaymaster.\\\\_validatePaymasterUserOp() - The sponsor does not have sufficient eth in the paymaster to cover this operation\",\n \"suggestion\": \"To fix this error, make sure to stake enough eth from the sponsor's address using `addDepositTo()`\"\n },\n \"FW311\": {\n \"info\": \" GaslessPaymaster.addDepositTo() - `msg.value` must be greater than or equal to amount\",\n \"suggestion\": \"To fix this error, make sure `msg.value` must be greater than or equal to amount\"\n },\n \"FW312\": {\n \"info\": \" TokenPaymaster.batchActions() - the ith delegate call failed\",\n \"suggestion\": \"To fix this error, make sure the calldata for `data[i]` is a valid call\"\n },\n \"FW313\": {\n \"info\": \" TokenPaymaster.batchActions() - batchActions consumed more eth than `msg.value` allocated\",\n \"suggestion\": \"To fix this error, increase the amount of msg.value you are passing to this function\"\n },\n \"FW314\": {\n \"info\": \" TokenPaymaster.\\\\_addTokenDepositTo() - token decimals must be greater than 0\",\n \"suggestion\": \"To fix this error, change the decimals in token using `setTokenData()`\"\n },\n \"FW315\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawTokenDepositTo() - token is not unlocked for withdrawal\",\n \"suggestion\": \"To fix this error, call `unlockTokenDepositAfter()`\"\n },\n \"FW316\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawTokenDepositTo() - you are withdrawing more tokens that you have in balance\",\n \"suggestion\": \"To fix this error, call `getTokenBalance()` to check how many tokens you have and make sure `amount` is less than that\"\n },\n \"FW317\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawEthDepositTo() - token is not unlocked for withdrawal\",\n \"suggestion\": \"To fix this error, call `unlockTokenDepositAfter()` with `ETH` as the token\"\n },\n \"FW318\": {\n \"info\": \" TokenPaymaster.\\\\_withdrawEthDepositTo() - you are withdrawing more ether that you have in balance\",\n \"suggestion\": \"To fix this error, call `getTokenBalance()` with `ETH` as the token to check how many tokens you have and make sure `amount` is less than that\"\n },\n \"FW319\": {\n \"info\": \" TokenPaymaster.\\\\_getTokenValueOfEth() - call to token oracle failed\",\n \"suggestion\": \"To fix this error, check the token oracle and call `setTokenData()` to change the oracle if it is broken\"\n },\n \"FW320\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - failed to reimbursePaymaster with tokens via `permitTransfer()`\",\n \"suggestion\": \"To fix this **error**, make sure you have permitted the paymaster to spend your tokens\"\n },\n \"FW321\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - spender doesn't have enough tokens\",\n \"suggestion\": \"To fix this error, make sure to add more tokens to the token paymaster via `addTokenDepositTo()`\"\n },\n \"FW322\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - `paymasterAndData` length must be 60\",\n \"suggestion\": \"To fix this error, make sure to set `paymasterAndData` length to be 60\"\n },\n \"FW323\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - `verificationGasLimit` must be greater than `COST_OF_POST`\",\n \"suggestion\": \"To fix this error, make sure to set the userOp's `verificationGasLimit` to be greater than `COST_OF_POST`\"\n },\n \"FW324\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must lock their ETH\",\n \"suggestion\": \"To fix this error, make sure the sponsor has locked their eth by calling `lockTokenDeposit()` from the sponsor address\"\n },\n \"FW325\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the account must lock their tokens\",\n \"suggestion\": \"To fix this error, make sure the user of the token paymaster has locked their tokens by calling `lockTokenDeposit()` from their address\"\n },\n \"FW326\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor eth balance must be greater than maxCost\",\n \"suggestion\": \"To fix this error, make sure the sponsor eth balance is greater than maxCost\"\n },\n \"FW327\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must approve the spender\",\n \"suggestion\": \"To fix this error, make sure the sponsor has approved the spender by calling `setSpenderWhitelistMode()` or `setSpenderBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setListMode()`\"\n },\n \"FW328\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the sponsor must have approved the token to the paymaster\",\n \"suggestion\": \"To fix this error, make sure the sponsor has approved the spender by calling `setTokenWhitelistMode()` or `setTokenBlacklistMode()` and the sponsor's list mode is set to whitelist mode or blacklist mode using `setTokenListMode()`\"\n },\n \"FW329\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted token must be equal to the token you are trying to pay with if using permit\",\n \"suggestion\": \"To fix this error, make sure the permitted token is equal to the token you are trying to pay with if using permit\"\n },\n \"FW330\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted transfer recipient must be the token paymaster\",\n \"suggestion\": \"To fix this error, make sure to permit the token paymaster to spend your tokens\"\n },\n \"FW331\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - the permitted transfer amount must be greater than or equal to the maxTokenCost\",\n \"suggestion\": \"To fix this error, make sure the permitted transfer amount is greater than or equal to the maxTokenCost\"\n },\n \"FW332\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - if permit was not used, make sure the tokenPaymaster was approved to spend tokens by the sponsor or enough tokens were deposited into the TokenPaymaster\",\n \"suggestion\": \"To fix this error, make sure the tokenPaymaster was approved(`approve()`) to spend tokens by the sponsor or enough tokens were deposited into the TokenPaymaster via `addTokenDepositTo()`\"\n },\n \"FW333\": {\n \"info\": \" TokenPaymaster.addEthDepositTo() - make sure msg.value is greater than or equal to amount\",\n \"suggestion\": \"To fix this error, make sure that the msg.value is greater than or equal to amount\"\n },\n \"FW334\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - sponsor cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the sponsor is not the zero address\"\n },\n \"FW335\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - target cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the target is not the zero address\"\n },\n \"FW336\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - token address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the token address is not the zero address\"\n },\n \"FW337\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - spender address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the spender address is not the zero address\"\n },\n \"FW338\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the token oracle cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the token oracle is not the zero address\"\n },\n \"FW339\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the tokenAddress cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the tokenAddress is not the zero address\"\n },\n \"FW340\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the token decimals must be greater than 0\",\n \"suggestion\": \"To fix this error, make sure the token decimals is greater than 0\"\n },\n \"FW341\": {\n \"info\": \" TokenPaymaster.addTokenDepositTo() - the chainlink aggregator cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the chainlink aggregator is not the zero address\"\n },\n \"FW342\": {\n \"info\": \" TokenPaymaster.removeTokenData() - The token doesn't exist in tokens\",\n \"suggestion\": \"To fix this error, make sure the token address is not the zero address\"\n },\n \"FW343\": {\n \"info\": \" TokenPaymaster.removeTokenData() - The tokenListIndex doesn't match with the tokenAddress\",\n \"suggestion\": \"To fix this error, make sure the token at tokenList[tokenListIndex] is the same as the tokenAddress\"\n },\n \"FW344\": {\n \"info\": \" GaslessPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions\",\n \"suggestion\": \"To fix this error, make sure you are not recursively calling batchActions from within batchActions\"\n },\n \"FW345\": {\n \"info\": \" TokenPaymaster.batchActions() - Cannot recursively call batchActions from within batchActions\",\n \"suggestion\": \"To fix this error, make sure you are not recursively calling batchActions from within batchActions\"\n },\n \"FW346\": {\n \"info\": \" TokenPaymaster.postOp() - Invalid Permit transfer amount\",\n \"suggestion\": \"To fix this error, make sure your permit transfer has transfered the correct amount of tokens\"\n },\n \"FW347\": {\n \"info\": \" TokenPaymaster.\\\\_reimbursePaymaster() - Invalid amount of tokens transferred\",\n \"suggestion\": \"The likely cause of this error is using a deflationary token that charges a tax when you transfer tokens. To fix this error, make sure you are transferring the correct amount of tokens and to account for the tax/deflation.\"\n },\n \"FW348\": {\n \"info\": \" UserAuthentication.init() - groupId count must be equal to groups length\",\n \"suggestion\": \"Make sure the number of groupIds equals the number of groups.\"\n },\n \"FW349\": {\n \"info\": \" TokenPaymaster.calculatePostOpGas() - Invalid Auth Type\",\n \"suggestion\": \"Make sure the authtype is correct\"\n },\n \"FW350\": {\n \"info\": \" TokenPaymaster.\\\\_validatePaymasterUserOp() - Does not have enough balance of token\",\n \"suggestion\": \"To fix this error, make sure your has enough tokens to permit transfer\"\n },\n \"FW351\": {\n \"info\": \" BasePaymaster.\\\\withdrawStakeFromEntryPoint() - Cannot withdraw to address zero\",\n \"suggestion\": \"To fix this error, make sure you are not withdrawing to address zero\"\n },\n \"FW401\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW402`: RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target\"\n },\n \"FW402\": {\n \"info\": \" RoleBasedAccessControl.isValidAction(), isValidActionAndFee() - Invalid Target\",\n \"suggestion\": \"To fix this error, make sure the target that you are calling is in the merkle root of allowed targets verified by the rule. If this does not work make sure you are using the correct merkle root implementation.\"\n },\n \"FW403\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the selector that you are calling is in the merkle root of allowed selector verified by the rule. If this does not work make sure you are using the correct merkle root implementation.\"\n },\n \"FW404\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the ownerId is not 0 or an existing owner\"\n },\n \"FW405\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the ruleId is not 0\"\n },\n \"FW406\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule that you are using has a deadline that has passed.\"\n },\n \"FW408\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW410`: RoleBasedAccessControl: isValidAction(), isValidActionAndFee() - Rule not added to role\"\n },\n \"FW410\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule is added to the role\"\n },\n \"FW411\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the value for the execution call is less than the limit\"\n },\n \"FW412\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee value for the execution call is less than the limit\"\n },\n \"FW413\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee recipient is in the rule fee merkle root\"\n },\n \"FW414\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the fee token is in the rule fee merkle root\"\n },\n \"FW417\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the rule you are using exists\"\n },\n \"FW418\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the user is in the role\"\n },\n \"FW419\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the feeRecipientTokenMerkleRootHash is not zero\"\n },\n \"FW420\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the targetSelectorMerkleRootHash is not zero\"\n },\n \"FW421\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"### `FW422`: RoleBasedAccessControl: init() - Wallet has not been initialized\"\n },\n \"FW422\": {\n \"info\": \" RoleBasedAccessControl\",\n \"suggestion\": \"To fix this error, make sure the wallet has not initialized the validation contract\"\n },\n \"FW500\": {\n \"info\": \" FunWallet.initialize() - the entrypoint cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the entrypoint is not the zero address\"\n },\n \"FW501\": {\n \"info\": \" FunWallet.initialize() - the msg.sender cannot be the address of the Funwallet contract\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is not the address of the Funwallet contract\"\n },\n \"FW502\": {\n \"info\": \" FunWallet.\\\\_requireFromFunWalletProxy() - the function must be called from the funwallet proxy\",\n \"suggestion\": \"To fix this error, make sure the msg.sender == funwallet\"\n },\n \"FW503\": {\n \"info\": \" FunWallet.updateEntryPoint() - the new entrypoint address cannot be the zero address\",\n \"suggestion\": \"To fix this error, make sure the new entrypoint address is not the zero address\"\n },\n \"FW504\": {\n \"info\": \" FunWallet.depositToEntryPoint() - not enough eth in the funwallet\",\n \"suggestion\": \"To fix this error, make sure the funwallet has more than the amount of eth you are trying to deposit\"\n },\n \"FW505\": {\n \"info\": \" FunWallet.\\\\_transferEthFromEntrypoint() - withdrawing eth from the entrypoint failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the entrypoint\"\n },\n \"FW506\": {\n \"info\": \" FunWallet.\\\\_requireFromModule() - make sure a funwalletfactory deployed the module\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is the module\"\n },\n \"FW507\": {\n \"info\": \" FunWallet.\\\\_requireFromEntryPoint() - the msg.sender must be the entrypoint\",\n \"suggestion\": \"To fix this error, make sure the msg.sender is the entrypoint\"\n },\n \"FW508\": {\n \"info\": \" WalletFee.\\\\_transferEth() - the eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW509\": {\n \"info\": \" WalletFee.\\\\_handleFee() - the developer eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW510\": {\n \"info\": \" WalletFee.\\\\_handleFee() - the funOracle eth transfer failed\",\n \"suggestion\": \"To fix this error, retry the operation and make sure you have greater than amount balance in the wallet\"\n },\n \"FW511\": {\n \"info\": \" WalletValidation.initValidations() - the WalletValidations contract has already been initialized\",\n \"suggestion\": \"Don't call initValidations() more than once\"\n },\n \"FW512\": {\n \"info\": \" WalletValidation.initValidations() - make sure there are more than zero validations\",\n \"suggestion\": \"To fix this error, make sure there are more than zero validations and the number of validation contract addresses are equal to the number of `initCallData` elements\"\n },\n \"FW513\": {\n \"info\": \" WalletValidation.initValidations() - make sure there are no duplicate validation contract addresses\",\n \"suggestion\": \"To fix this error, make sure there are no duplicate validation contract addresses in `validationData`\"\n },\n \"FW514\": {\n \"info\": \" WalletValidation.\\\\_validateUserOp() - make sure the signature length is greater than 0\",\n \"suggestion\": \"To fix this error, make sure the signature length is greater than 0\"\n },\n \"FW515\": {\n \"info\": \" WalletValidation.isValidSignature() - make sure the number of validations is greater than zero\",\n \"suggestion\": \"To fix this error, make sure the number of validations is greater than zero\"\n },\n \"FW516\": {\n \"info\": \" WalletValidation.\\\\_requireValidValidation() - the validation failed\",\n \"suggestion\": \"To fix this error, make sure the validation contract returns true\"\n },\n \"FW517\": {\n \"info\": \" WalletValidation.\\\\_requireValidValidationFormat() - the validation was incorrectly formatted\",\n \"suggestion\": \"To fix this error, make sure the validation contract address is not the zero address and the validation is valid and the address is not the zero address\"\n },\n \"FW518\": {\n \"info\": \" WalletValidation.\\\\_requireValidPrevValidation() - the previous validation must be linked to this validation\",\n \"suggestion\": \"To fix this error, make sure the previous validation is linked to this validation when adding or removing the validation\"\n },\n \"FW519\": {\n \"info\": \" WalletValidation.getValidations() - you must have more than zero validations to get validations\",\n \"suggestion\": \"To fix this error, make sure there are a nonzero amount of validations\"\n },\n \"FW520\": {\n \"info\": \" WalletValidation.addValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling addValidation() from your funwallet.\"\n },\n \"FW521\": {\n \"info\": \" WalletValidation.removeValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling removeValidation() from your funwallet.\"\n },\n \"FW522\": {\n \"info\": \" WalletValidation.updateValidation() - The caller must be this wallet.\",\n \"suggestion\": \"To fix this error, make sure you are calling updateValidation() from your funwallet.\"\n },\n \"FW523\": {\n \"info\": \" WalletModules.permitTransfer() - Invalid Permit Signature.\",\n \"suggestion\": \"To fix this error, make sure you have a valid permit signature.\"\n },\n \"FW524\": {\n \"info\": \" WalletValidation.getValidations() - No Validations in the wallet\",\n \"suggestion\": \"To fix this error, make sure the wallet has validation contracts\"\n },\n \"FW600\": {\n \"info\": \" DataLib\",\n \"suggestion\": \"To fix this error, make sure you are calling either execFromEntryPoint() or execFromEntryPointWithFee() from your funwallet.\"\n },\n \"FW601\": {\n \"info\": \" Ownable2StepNoRenounce\",\n \"suggestion\": \"To fix this error, don't call this function.\"\n }\n}\n", "export type ErrorData = {\n location: string\n error?: {\n txDetails?: ErrorTransactionDetails\n reasonData?: {\n title: string\n reasons: string[]\n }\n }\n}\n\nexport type ErrorTransactionDetails = {\n method: string\n params: any[]\n contractAddress?: string\n chainId?: number | string\n}\n\nexport enum ErrorBaseType {\n ClientError = 'ClientError',\n ServerError = 'ServerError',\n}\n\nexport enum ErrorType {\n InvalidParameter = 'InvalidParameter',\n InternalServerFailure = 'InternalServerFailure',\n ResourceNotFound = 'ResourceNotFound',\n InvalidAction = 'InvalidAction',\n ThrottlingError = 'ThrottlingError',\n AccessDeniedError = 'AccessDeniedError',\n UserOpFailureError = 'UserOpFailureError',\n}\n\nexport enum ErrorCode {\n MissingParameter = 'MissingParameter',\n InvalidParameter = 'InvalidParameter',\n InvalidThreshold = 'InvalidThreshold',\n InvalidChainIdentifier = 'InvalidChainIdentifier',\n InvalidNFTIdentifier = 'InvalidNFTIdentifier',\n InsufficientSignatures = 'InsufficientSignatures',\n InvalidParameterCombination = 'InvalidParameterCombination',\n CheckPointHintsNotFound = 'CheckPointHintsNotFound',\n GroupNotFound = 'GroupNotFound',\n TokenNotFound = 'TokenNotFound',\n AddressNotFound = 'AddressNotFound',\n UserAlreadyExists = 'UserAlreadyExists',\n UserNotFound = 'UserNotFound',\n ChainNotSupported = 'ChainNotSupported',\n ServerMissingData = 'ServerMissingData',\n ServerFailure = 'ServerFailure',\n ServerTimeout = 'ServerTimeout',\n UnknownServerError = 'UnknownServerError',\n ServerConnectionError = 'ServerConnectionError',\n UserOpFailureError = 'UserOpFailureError',\n Unauthorized = 'Unauthorized',\n RequestLimitExceeded = 'RequestLimitExceeded',\n WalletPrefundError = 'PrefundError',\n GasSponsorFundError = 'GasSponsorFundError',\n FunWalletErrorCode = 'FunWalletErrorCode',\n BridgeRouteNotFound = 'BridgeRouteNotFound',\n BridgeAllowanceDataNotFound = 'BridgeAllowanceDataNotFound',\n BridgeApproveTxDataNotFound = 'BridgeApproveTxDataNotFound',\n CheckoutInitDepositAddrNotFound = 'CheckoutInitDepositAddrNotFound',\n}\n", "import { BaseError } from './BaseError'\nimport FWErrors from './errors.json'\nimport { ErrorBaseType, ErrorCode, ErrorType } from './types'\nexport class ClientError extends BaseError {\n constructor(\n type: string,\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorBaseType.ClientError,\n type,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n false,\n )\n }\n}\n\nexport class InvalidParameterError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.InvalidParameter,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class ResourceNotFoundError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n if (msg.includes('Chain name not found')) {\n const { reqId } = JSON.parse(msg)\n msg = ': Chain name not found or not supported.'\n fixSuggestion = 'Change your EnvOptions to the correct chain identifier.'\n super(\n ErrorType.ResourceNotFound,\n ErrorCode.ChainNotSupported,\n msg,\n rawMessage,\n { reqId },\n fixSuggestion,\n docLink,\n )\n } else {\n super(\n ErrorType.ResourceNotFound,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n }\n}\n\nexport class ThrottlingError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.ThrottlingError,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class AccessDeniedError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.AccessDeniedError,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n\nexport class UserOpFailureError extends ClientError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n const FWCode = findFWContractError(msg)\n if (FWCode) {\n const { reqId } = JSON.parse(msg)\n msg = FWErrors[FWCode].info\n fixSuggestion = FWErrors[FWCode].suggestion\n super(\n ErrorType.UserOpFailureError,\n ErrorCode.FunWalletErrorCode,\n msg,\n rawMessage,\n { reqId },\n fixSuggestion,\n docLink,\n )\n } else {\n super(\n ErrorType.UserOpFailureError,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n }\n}\n\nconst findFWContractError = (msg: string) => {\n let match = msg.match(/FW\\d{3}/)\n if (!match) {\n match = msg.match(/AA\\d./)\n }\n return match?.[0]\n}\n", "import { BaseError } from './BaseError'\nimport { ErrorBaseType, ErrorType } from './types'\n\nexport class ServerError extends BaseError {\n constructor(\n type: string,\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorBaseType.ServerError,\n type,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n true,\n )\n }\n}\n\nexport class InternalFailureError extends ServerError {\n constructor(\n code: string,\n msg: string,\n rawMessage: string,\n paramsUsed: any,\n fixSuggestion: string,\n docLink: string,\n ) {\n super(\n ErrorType.InternalServerFailure,\n code,\n msg,\n rawMessage,\n paramsUsed,\n fixSuggestion,\n docLink,\n )\n }\n}\n", "import {\n InvalidParameterError,\n ResourceNotFoundError,\n UserOpFailureError,\n} from '../errors'\n\nexport const errorAbortHandler = (err: any, context: any) => {\n if (\n err instanceof ResourceNotFoundError ||\n err instanceof InvalidParameterError ||\n err instanceof UserOpFailureError\n ) {\n context.abort()\n }\n}\n", "import { PartialAttemptOptions } from '@lifeomic/attempt'\n\nimport { errorAbortHandler } from '../utils/error'\n\nexport type BaseResponse = any // TODO:\n\nexport type RetryOptions = PartialAttemptOptions<BaseResponse>\n\nexport const DEFAULT_RETRY_OPTIONS = {\n delay: 100,\n initialDelay: 0,\n maxDelay: 3000,\n factor: 2,\n maxAttempts: 5,\n timeout: 0,\n jitter: true,\n minDelay: 0,\n handleError: errorAbortHandler,\n handleTimeout: null,\n beforeAttempt: null,\n calculateDelay: null,\n} as RetryOptions\n", "import { toHex } from 'viem'\n\nexport function randomBytes(length: number) {\n const bytes = new Uint8Array(length)\n for (let i = 0; i < length; i++) {\n bytes[i] = Math.floor(Math.random() * 256)\n }\n return toHex(bytes)\n}\n\nexport function generateRandomCheckoutSalt() {\n return toHex(BigInt(randomBytes(32)))\n}\n\nexport function roundToNearestBottomTenth(n: number) {\n return Math.floor(n / 10) * 10\n}\n", "import { retry } from '@lifeomic/attempt'\nimport { toHex } from 'viem'\n\nimport { BaseRequest } from '../consts/request'\nimport {\n BaseResponse,\n DEFAULT_RETRY_OPTIONS,\n RetryOptions,\n} from '../consts/retry'\nimport {\n AccessDeniedError,\n ErrorCode,\n InternalFailureError,\n InvalidParameterError,\n ResourceNotFoundError,\n ThrottlingError,\n UserOpFailureError,\n} from '../errors'\nimport {\n DeleteRequest,\n GetRequest,\n PostRequest,\n PutRequest,\n} from './../consts/request'\n\nconst stringifyWithBigIntSanitization = (object: any) => {\n return JSON.stringify(\n object,\n (_, value) => (typeof value === 'bigint' ? toHex(value) : value), // return everything else unchanged\n )\n}\n\ntype RequestError = {\n errorMsg: string\n errorCode: string\n}\n\nexport const sendRequest = async ({\n uri,\n method,\n apiKey,\n body = {},\n retryOptions = {},\n signal,\n}: BaseRequest): Promise<BaseResponse> => {\n try {\n const headers = {\n 'Content-Type': 'application/json',\n ...(apiKey ? { 'X-Api-Key': apiKey } : {}),\n }\n\n const finalRetryOptions = {\n ...DEFAULT_RETRY_OPTIONS,\n ...(retryOptions || {}),\n } as RetryOptions\n\n return retry(async function () {\n const response = await fetch(uri, {\n method,\n headers,\n redirect: 'follow',\n signal,\n body:\n method !== 'GET' ? stringifyWithBigIntSanitization(body) : undefined,\n })\n const json = await response.json()\n\n if (response.ok) {\n return json\n }\n\n const { errorMsg, errorCode } = json as RequestError\n\n if (response.status === 400) {\n throw new InvalidParameterError(\n ErrorCode.InvalidParameter,\n `bad request ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 403) {\n throw new AccessDeniedError(\n ErrorCode.Unauthorized,\n 'Invalid API key or insufficient access.',\n errorMsg,\n { apiKey },\n 'Check your api key at https://app.fun.xyz and check with fun team if you believe something is off',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 404) {\n throw new ResourceNotFoundError(\n ErrorCode.ServerMissingData,\n JSON.stringify(json),\n errorMsg,\n { body },\n 'check the api call parameters. its mostly because some call parameters are wrong',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 429) {\n throw new ThrottlingError(\n ErrorCode.RequestLimitExceeded,\n `too many requests ${JSON.stringify(json)}`,\n 'Too many requests',\n { body },\n 'you are making too many requests. please slow down. Reach out to fun team if you need more quota',\n 'https://docs.fun.xyz',\n )\n } else if (response.status === 500) {\n if (errorCode === ErrorCode.UserOpFailureError) {\n throw new UserOpFailureError(\n ErrorCode.UserOpFailureError,\n `server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'fix user op failure. Most of the time this is due to invalid parameters',\n 'https://docs.fun.xyz',\n )\n } else {\n throw new InternalFailureError(\n ErrorCode.ServerFailure,\n `server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n } else if (response.status === 504) {\n throw new InternalFailureError(\n ErrorCode.ServerTimeout,\n `server timeout failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n } else if (!response.ok) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n `unknown server failure ${JSON.stringify(json)}`,\n errorMsg,\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n return {}\n }, finalRetryOptions)\n } catch (err) {\n throw new InternalFailureError(\n ErrorCode.ServerConnectionError,\n `Cannot connect to Fun API Service ${err}`,\n '',\n { body },\n 'retry later. if it still fails, please contact us.',\n 'https://docs.fun.xyz',\n )\n }\n}\n\nexport async function sendGetRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: GetRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n method: 'GET',\n })\n}\n\nexport async function sendPostRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PostRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'POST',\n })\n}\n\nexport async function sendDeleteRequest({\n uri,\n apiKey,\n retryOptions,\n signal,\n}: DeleteRequest): Promise<void> {\n await sendRequest({\n uri,\n method: 'DELETE',\n apiKey,\n retryOptions,\n signal,\n })\n}\n\nexport async function sendPutRequest({\n uri,\n body,\n apiKey,\n retryOptions,\n signal,\n}: PutRequest): Promise<BaseResponse> {\n return await sendRequest({\n uri,\n apiKey,\n body,\n retryOptions,\n signal,\n method: 'PUT',\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport {\n GetAllWalletNFTsByChainIdRequest,\n GetAllWalletNFTsByChainIdResponse,\n GetAllWalletNFTsRequest,\n GetAllWalletNFTsResponse,\n GetAllWalletTokensByChainIdRequest,\n GetAllWalletTokensByChainIdResponse,\n GetAllWalletTokensRequest,\n GetAllWalletTokensResponse,\n GetAssetPriceInfoRequest,\n GetAssetPriceInfoResponse,\n GetWalletLidoWithdrawalsByChainId,\n GetWalletLidoWithdrawalsByChainIdResponse,\n} from './types'\n\n/**===========================================================\n * REFERENCE CORE FILE: /packages/core/src/apis/AssetApis.ts\n * TODO: Remove this comment once migration is complete\n *===========================================================*/\n\n/**\n * Gets the estimated dollar unit price of a tokenAddress for checkout\n * @param chainId https://chainlist.org/ e.g. \"1\" for ethereum\n * @param assetTokenAddress tokenAddress of the asset on the given chain\n * @param apiKey\n */\nexport async function getAssetPriceInfo({\n chainId,\n assetTokenAddress,\n apiKey,\n}: GetAssetPriceInfoRequest): Promise<GetAssetPriceInfoResponse> {\n const priceInfo = await sendGetRequest({\n uri: `${API_BASE_URL}/asset/erc20/price/${chainId}/${assetTokenAddress}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n return priceInfo\n}\n\n/**\n * Get all tokens for a given wallet address\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n * @param signal AbortSignal to cancel the request when no longer needed\n */\nexport async function getAllWalletTokens({\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n signal,\n}: GetAllWalletTokensRequest): Promise<GetAllWalletTokensResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n signal,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**\n * Get all tokens for a given wallet address on a specific chain\n * @param chainId https://chainlist.org/\n * @param walletAddress\n * @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)\n * @param apiKey\n */\nexport async function getAllWalletTokensByChainId({\n chainId,\n walletAddress,\n onlyVerifiedTokens,\n apiKey,\n}: GetAllWalletTokensByChainIdRequest): Promise<GetAllWalletTokensByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/erc20s/${walletAddress}/${chainId}?onlyVerifiedTokens=${onlyVerifiedTokens}`,\n apiKey,\n retryOptions: { maxAttempts: 2 },\n })\n}\n\n/**=======================\n * POTENTIAL DEPRECATION\n *=======================*/\n\n/**\n * Get all the NFTs owned by a wallet\n * @param walletAddress\n * @param apiKey\n */\nexport async function getAllWalletNFTs({\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsRequest): Promise<GetAllWalletNFTsResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}`,\n apiKey,\n })\n}\n\n/**\n * Get all the NFTs owned by a wallet on a specific chain\n * @param chainId From https://chainlist.org/\n * @param walletAddress Address of holder\n * @param apiKey\n */\nexport async function getAllWalletNFTsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetAllWalletNFTsByChainIdRequest): Promise<GetAllWalletNFTsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/nfts/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n\n/**\n * Get all lido withdrawal request ids for a wallet address on a specific chain\n * @param {string} chainId https://chainlist.org/ ie \"1\" for ethereum\n * @param {string} holderAddr Address of holder\n * @returns [readyToWithdrawRequestIds, notReadyToWithdrawRequestIds]\n */\nexport async function getWalletLidoWithdrawalsByChainId({\n chainId,\n walletAddress,\n apiKey,\n}: GetWalletLidoWithdrawalsByChainId): Promise<GetWalletLidoWithdrawalsByChainIdResponse> {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/assets/lido-withdrawals/${walletAddress}/${chainId}`,\n apiKey,\n })\n}\n", "import Big from 'big.js'\nimport { Address } from 'viem'\n\nimport { API_BASE_URL } from '../../consts'\nimport { ErrorCode, ResourceNotFoundError } from '../../errors'\nimport {\n generateRandomCheckoutSalt,\n roundToNearestBottomTenth,\n sendGetRequest,\n sendPostRequest,\n} from '../../utils'\nimport {\n CheckoutApiInitParams,\n CheckoutApiQuoteParams,\n CheckoutApiQuoteResponse,\n CheckoutDeactivateParams,\n CheckoutHistoryItem,\n CheckoutInitParams,\n CheckoutInitResponse,\n CheckoutQuoteParams,\n CheckoutQuoteResponse,\n CheckoutState,\n CheckoutTransferSponsorshipApiParams,\n CheckoutTransferSponsorshipParams,\n CheckoutTransferSponsorshipResponse,\n RiskAssessmentParams,\n RiskAssessmentResponse,\n} from './types'\n\n/**\n * Gets a checkout quote (estimation).\n * @param fromChainId The ID of the chain where funds will be provided from.\n * @param fromTokenAddress The asset to fund the checkout. This must be either a chain native token or an ERC-20, on the fromChainId.\n * @param fromTokenDecimals The number of decimals for the fromTokenAddress.\n * @param toChainId The ID of the chain where the checkout operation is to be performed.\n * @param toTokenAddress The wanted asset for the checkout operation. This must be either a chain native token or an ERC-20, on the target chain.\n * @param toTokenAmount The amount of wanted asset for the checkout operation in base units.\n * @param toTokenDecimals The number of decimals for the toTokenAddress.\n * @param expirationTimestampMs The amount of time (duration) from now before the checkout operation expires.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @return {Promise<CheckoutCoreQuoteResponse>} The formatted quote object\n */\nexport async function getCheckoutQuote({\n fromChainId,\n fromTokenAddress,\n fromTokenDecimals,\n toChainId,\n toTokenAddress,\n toTokenDecimals,\n toTokenAmount,\n expirationTimestampMs,\n sponsorInitialTransferGasLimit,\n recipientAddr,\n needsRefuel,\n userId,\n apiKey,\n signal,\n}: CheckoutQuoteParams): Promise<CheckoutQuoteResponse> {\n try {\n const toMultipler = 10 ** toTokenDecimals\n const toAmountBaseUnitBI = BigInt(Math.floor(toTokenAmount * toMultipler))\n const queryParams = {\n userId,\n fromChainId,\n fromTokenAddress,\n toChainId,\n toTokenAddress,\n toAmountBaseUnit: toAmountBaseUnitBI.toString(),\n // Only pass in recipientAddr if specified\n ...(recipientAddr ? { recipientAddr } : {}),\n // Rounding nearest tenth second (instead of seconds) to better support backend quote caching feature\n // Reference: https://vintage-heaven-3cd.notion.site/API-Gateway-Caching-and-Pre-Warming-System-Draft-ee7909d9b85f43c793ce7bd2607bec02?pvs=4\n // Note: Rounding *down* instead of a regular round to safeguard against edge case of timing passing frontend range validation but failing backend range validation\n checkoutExpirationTimestampSeconds: roundToNearestBottomTenth(\n Math.round((Date.now() + expirationTimestampMs) / 1000),\n ).toString(),\n sponsorInitialTransferGasLimit,\n // @deprecated Not in use\n refuel: needsRefuel.toString(),\n } as CheckoutApiQuoteParams\n\n const searchParams = new URLSearchParams(queryParams)\n const quoteRes = (await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/quote?${searchParams}`,\n apiKey,\n signal,\n })) as CheckoutApiQuoteResponse\n\n const fromMultipler = 10 ** fromTokenDecimals\n // Format the response for frontend usage\n return {\n quoteId: quoteRes.quoteId,\n fromTokenAddress: quoteRes.fromTokenAddress,\n estFeesUsd: quoteRes.estFeesUsd,\n estSubtotalUsd: quoteRes.estSubtotalUsd,\n estTotalUsd: quoteRes.estTotalUsd,\n estCheckoutTimeMs: quoteRes.estCheckoutTimeMs,\n estTotalFromAmountBaseUnit: quoteRes.estTotalFromAmountBaseUnit,\n estSubtotalFromAmountBaseUnit: quoteRes.estSubtotalFromAmountBaseUnit,\n estFeesFromAmountBaseUnit: quoteRes.estFeesFromAmountBaseUnit,\n // Added fields\n estFeesFromAmount: new Big(quoteRes.estFeesFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estSubtotalFromAmount: new Big(quoteRes.estSubtotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n estTotalFromAmount: new Big(quoteRes.estTotalFromAmountBaseUnit)\n .div(fromMultipler)\n .toString(),\n } as CheckoutQuoteResponse\n } catch (err: any) {\n throw new Error(\n `An error occured trying to generate a checkout quote: ${err.message}`,\n )\n }\n}\n\n/**\n * Initializes a checkout\n * @param userOp The checkout UserOp, signed.\n * @param quoteId The quoteId specific to the checkout.\n * @param apiKey A valid fun api key.\n * @return {Address} The generated deposit address\n */\nexport async function initializeCheckout({\n userOp,\n quoteId,\n sourceOfFund,\n apiKey,\n clientMetadata,\n}: CheckoutInitParams): Promise<Address> {\n const body = {\n ...(userOp ? { userOp } : {}),\n quoteId,\n sourceOfFund,\n salt: generateRandomCheckoutSalt(),\n clientMetadata,\n } as CheckoutApiInitParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout`,\n body,\n apiKey,\n })\n if (!res?.depositAddr) {\n throw new ResourceNotFoundError(\n ErrorCode.CheckoutInitDepositAddrNotFound,\n 'Unable to initialize checkout',\n 'Unable to initialize checkout',\n body,\n '',\n 'https://docs.fun.xyz',\n )\n }\n return res.depositAddr as CheckoutInitResponse\n}\n\nexport async function deactivateCheckout({\n depositAddress,\n apiKey,\n}: CheckoutDeactivateParams) {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/update/${depositAddress}`,\n body: {\n // Fixed state to cancel the checkout\n state: CheckoutState.CANCELLED,\n },\n apiKey,\n })\n return true\n } catch (err) {\n throw new Error('Unable to deactivate checkout')\n }\n}\n\n/**\n * Gets a checkout given a depositAddress\n * @param depositAddress A unique deposit address associated with a backend checkout item.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns The checkout object if exists. Otherwise, null.\n */\nexport async function getCheckoutByDepositAddress({\n depositAddress,\n apiKey,\n signal,\n}: {\n depositAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem | null> {\n try {\n return await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/${depositAddress}`,\n apiKey,\n signal,\n })\n } catch (err) {\n if (err instanceof ResourceNotFoundError) {\n return null\n }\n throw err\n }\n}\n\n/**\n * Gets all checkouts associated with a funWallet\n * @param funWalletAddress A funWallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByFunWalletAddress({\n funWalletAddress,\n apiKey,\n signal,\n}: {\n funWalletAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/fun-wallet/${funWalletAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a recipient address\n * @param recipientAddress A wallet address.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByRecipientAddress({\n recipientAddress,\n apiKey,\n signal,\n}: {\n recipientAddress: Address\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/recipient/${recipientAddress}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\n/**\n * Gets all checkouts associated with a funkit userId string\n * @param userId A userId string.\n * @param apiKey A valid fun api key.\n * @param signal AbortSignal to cancel the request when no longer needed\n * @returns A list of checkout objects if exists. Otherwise, an empty array.\n */\nexport async function getCheckoutsByUserId({\n userId,\n apiKey,\n signal,\n}: {\n userId: string\n apiKey: string\n signal?: AbortSignal\n}): Promise<CheckoutHistoryItem[]> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/userId/${userId}`,\n apiKey,\n signal,\n })\n return res || []\n}\n\nexport async function getPaymasterDataForCheckoutSponsoredTransfer({\n depositAddress,\n transferUserOp,\n apiKey,\n}: CheckoutTransferSponsorshipParams): Promise<CheckoutTransferSponsorshipResponse> {\n const body = {\n depositAddress,\n userOp: transferUserOp,\n } as CheckoutTransferSponsorshipApiParams\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/checkout/sponsor-transfer`,\n body,\n apiKey,\n })\n if (!res) {\n // TODO: Better error handling\n throw new Error('Unable to get sponsorship information')\n }\n return res as CheckoutTransferSponsorshipResponse\n}\n\nexport async function getRiskAssessmentForAddress({\n address,\n apiKey,\n}: RiskAssessmentParams) {\n const response = (await sendGetRequest({\n uri: `${API_BASE_URL}/checkout/risk-assessment?address=${address}`,\n apiKey,\n })) as RiskAssessmentResponse\n\n return response\n}\n", "/**===============*\n * CHECKOUT QUOTE *\n *================*/\nimport { Address, Hex } from 'viem'\n\n// TODO: Define the UserOperation type\ntype UserOperation = any\n\n// The params required for the actual /checkout/quote api\nexport type CheckoutApiQuoteParams = {\n fromChainId: string\n fromTokenAddress: Address\n toChainId: string\n toTokenAddress: Address\n toAmountBaseUnit: string\n checkoutExpirationTimestampSeconds: string\n sponsorInitialTransferGasLimit: string\n refuel: string\n userId: string\n recipientAddr?: Address\n}\n\nexport type CheckoutQuoteParams = Omit<\n CheckoutApiQuoteParams,\n 'toAmountBaseUnit' | 'checkoutExpirationTimestampSeconds' | 'refuel'\n> & {\n fromTokenDecimals: number\n toTokenDecimals: number\n toTokenAmount: number\n expirationTimestampMs: number\n needsRefuel: boolean\n apiKey: string\n signal?: AbortSignal\n}\n\n// The response of the actual /checkout/quote api\nexport type CheckoutApiQuoteResponse = {\n quoteId: string\n estTotalFromAmountBaseUnit: string\n estSubtotalFromAmountBaseUnit: string\n estFeesFromAmountBaseUnit: string\n fromTokenAddress: Address\n estFeesUsd: number\n estSubtotalUsd: number\n estTotalUsd: number\n estCheckoutTimeMs: number\n}\n\n// The formatted response quote interface from the core sdk\nexport type CheckoutQuoteResponse = CheckoutApiQuoteResponse & {\n estTotalFromAmount: string\n estSubtotalFromAmount: string\n estFeesFromAmount: string\n}\n\n/**===============*\n * CHECKOUT INIT *\n *================*/\n\nexport type CheckoutApiInitParams = {\n userOp?: UserOperation\n quoteId: string\n sourceOfFund: string\n salt: Hex\n // TODO: Proper typing wrt _generateClientMetadata() logic\n clientMetadata: object\n}\n\nexport type CheckoutInitParams = Omit<CheckoutApiInitParams, 'salt'> & {\n apiKey: string\n}\n\nexport type CheckoutInitResponse = Address\n\n/**=====================*\n * CHECKOUT DEACTIVATE *\n *======================*/\n\nexport type CheckoutDeactivateParams = {\n depositAddress: Address\n apiKey: string\n}\n\n// Reference from api server: https://github.com/fun-xyz/fun-api-server/blob/main/src/tables/FunWalletCheckout.ts#L11C1-L21C2\nexport enum CheckoutState {\n // In-progress States\n FROM_UNFUNDED = 'FROM_UNFUNDED',\n FROM_FUNDED = 'FROM_FUNDED',\n FROM_POOLED = 'FROM_POOLED',\n TO_UNFUNDED = 'TO_UNFUNDED',\n TO_FUNDED = 'TO_FUNDED',\n TO_POOLED = 'TO_POOLED',\n TO_READY = 'TO_READY',\n PENDING_RECEIVAL = 'PENDING_RECEIVAL',\n // Terminal States\n COMPLETED = 'COMPLETED',\n CHECKOUT_ERROR = 'CHECKOUT_ERROR',\n EXPIRED = 'EXPIRED',\n CANCELLED = 'CANCELLED',\n}\n\nexport type CheckoutHistoryItem = {\n createdTimeMs: number\n depositAddr: Address\n currentDepositAddr: Address\n recipientAddr: Address\n expirationTimestampSeconds: number\n fromAmountBaseUnit: string\n fromChainId: string\n fromTokenAddress: Address\n funWalletAddr: Address\n lastUpdatedTimeMs: number\n salt: Hex\n state: CheckoutState\n toAmountBaseUnit: string\n toChainId: string\n toTokenAddress: Address\n userOp: UserOperation\n version: number\n // TODO: Proper typing wrt _generateClientMetadata() logic\n clientMetadata: object\n}\n\n/**===============================*\n * CHECKOUT TRANSFER SPONSORSHIP *\n *================================*/\n\nexport type CheckoutTransferSponsorshipParams = {\n transferUserOp: UserOperation\n depositAddress: Address\n apiKey: string\n}\n\nexport type CheckoutTransferSponsorshipApiParams = {\n userOp: UserOperation\n depositAddress: Address\n}\n\nexport type CheckoutTransferSponsorshipResponse = {\n signerAddress: Address\n signature: Hex\n deadline: number\n paymasterAndData: Hex\n}\n\n/**===============================*\n * RISK ASSESSMENT *\n *================================*/\n\nexport type RiskAssessmentParams = {\n address: Address | `dydx${string}`\n apiKey: string\n}\n\ntype AddressIdentification = {\n name: string\n address: Address | `dydx${string}`\n category: string\n description: string\n url: string | null\n createdAt: number\n}\n\ntype Cluster = {\n name: string\n category: string\n}\n\ntype RiskValues = 'Severe' | 'High' | 'Medium' | 'Low'\n\ntype ExposureType = 'direct' | 'indirect'\n\ntype Exposure = {\n category: string\n value: number\n exposureType: ExposureType\n direction: string\n}\n\ntype RiskTrigger = {\n risk: string\n minThreshold: number\n maxThreshold: number\n exposureType: string\n direction: string\n}\n\ntype Trigger = {\n category: string\n percentage: number\n message: string\n ruleTriggered?: RiskTrigger\n}\n\ntype PoolMetadata = {\n fees?: number\n tokens: string[]\n}\n\nexport type RiskAssessmentResponse = {\n address: Address | `dydx${string}`\n risk: RiskValues\n riskReason: string | null\n cluster?: Cluster\n addressType: string\n addressIdentifications: AddressIdentification[]\n exposures: Exposure[]\n triggers: Trigger[]\n status: string\n poolMetadata: PoolMetadata\n}\n", "import { FUN_FAUCET_URL } from '../../consts'\nimport { sendGetRequest } from '../../utils'\nimport { GetAssetFromFaucetRequest } from './types'\n\nexport async function getAssetFromFaucet({\n token,\n chain,\n walletAddress,\n apiKey,\n}: GetAssetFromFaucetRequest) {\n return await sendGetRequest({\n uri: `${FUN_FAUCET_URL}/get-faucet?token=${token}&testnet=${chain}&addr=${walletAddress}`,\n apiKey,\n })\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport {\n GetCryptocurrencyHoldingsRequest,\n GetLinkTokenRequest,\n GetLinkTokenResponse,\n GetTransferIntegrationsRequest,\n GetTransferIntegrationsResponse,\n MeshExecuteTransferRequest,\n MeshExecuteTransferResponse,\n PreviewTransferRequest,\n} from './types'\n\n/**\n * @param authToken The authentication token to send the asset from.\n * @param type The type of the integration to send the asset from.\n * @return https://docs.meshconnect.com/reference/post_api-v1-holdings-get\n */\nexport async function meshGetCryptocurrencyHoldings({\n authToken,\n type,\n apiKey,\n}: GetCryptocurrencyHoldingsRequest): Promise<any> {\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/holdings/get`,\n body: { authToken, type },\n apiKey,\n })\n return res\n}\n\n/**\n * @return https://docs.meshconnect.com/reference/get_api-v1-transfers-managed-integrations\n */\nexport async function meshGetTransferIntegrations({\n apiKey,\n}: GetTransferIntegrationsRequest): Promise<GetTransferIntegrationsResponse> {\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/integrations`,\n apiKey,\n })\n return res\n}\n\n/**\n * @param userId A unique Id representing the end user. Typically this will be a user Id from the\nclient application. Personally identifiable information, such as an email address or phone number,\nshould not be used. 50 characters length maximum.\n * @param integrationId A unique identifier representing a specific integration obtained from the list of available integrations.\n * @param restrictMultipleAccounts The final screen of Link allows users to \u201Ccontinue\u201D back to your app or \u201CLink another account.\u201D\nIf this param is present then this button will be hidden.\n * @param transferOptions Encapsulates transaction-related parameters, including destination addresses and the amount to transfer in fiat currency.\n * @return https://docs.meshconnect.com/reference/post_api-v1-linktoken\n */\nexport async function meshGetLinkToken({\n userId,\n integrationId,\n restrictMultipleAccounts,\n transferOptions,\n apiKey,\n}: GetLinkTokenRequest): Promise<GetLinkTokenResponse> {\n let body: any = { userId }\n if (integrationId) {\n body = { ...body, integrationId }\n }\n if (restrictMultipleAccounts) {\n body = { ...body, restrictMultipleAccounts }\n }\n if (transferOptions) {\n body = { ...body, transferOptions }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/linktoken`,\n body,\n apiKey,\n })\n return res\n}\n\n/**\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param toAuthToken The authentication token of the target integration. Can be used alternatively to the address in the ToAddress field. If used, toType should also be provided.\n * @param toType The type of the target integration to send assets to. Used along with the toAuthToken alternatively to ToAddress.\n * @param networkId The network to send the asset over. This is generated by Mesh, it isn't a chainId or chain name.\n * @param symbol The symbol of the digital asset to send.\n * @param toAddress The target address to send the asset to.\n * @param amount The amount to send, in crypto.\n * @param amountInFiat The amount to send, in fiat currency. Can be used alternatively to Amount.\n * @param fiatCurrency Fiat currency that is to get corresponding converted fiat values of transfer and fee amounts. If not provided, defaults to USD.\n * @returns https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-preview\n */\nexport async function meshPreviewTransfer({\n fromAuthToken,\n fromType,\n toAuthToken,\n toType,\n networkId,\n symbol,\n toAddress,\n amount,\n amountInFiat,\n fiatCurrency,\n apiKey,\n}: PreviewTransferRequest): Promise<any> {\n let body: any = { fromAuthToken, fromType }\n if (toAuthToken) {\n body = { ...body, toAuthToken }\n }\n if (toType) {\n body = { ...body, toType }\n }\n if (networkId) {\n body = { ...body, networkId }\n }\n if (symbol) {\n body = { ...body, symbol }\n }\n if (toAddress) {\n body = { ...body, toAddress }\n }\n if (amount) {\n body = { ...body, amount }\n }\n if (amountInFiat) {\n body = { ...body, amountInFiat }\n }\n if (fiatCurrency) {\n body = { ...body, fiatCurrency }\n }\n\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/preview`,\n body,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n/**\n *\n * @param fromAuthToken The authentication token to send the asset from.\n * @param fromType The type of the integration to send the asset from.\n * @param previewId The preview ID of the transfer to execute.\n * @param mfaCode Multi-factor auth code that should be provided if the status of the transfer was MfaRequired.\n * @returns https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-execute\n */\nexport async function meshExecuteTransfer({\n fromAuthToken,\n fromType,\n previewId,\n mfaCode,\n apiKey,\n}: MeshExecuteTransferRequest): Promise<MeshExecuteTransferResponse> {\n let body: any = { fromAuthToken, fromType, previewId }\n if (mfaCode) {\n body = { ...body, mfaCode }\n }\n const res = await sendPostRequest({\n uri: `${API_BASE_URL}/mesh/transfers/managed/execute`,\n body,\n apiKey,\n })\n return res\n}\n", "export interface GetCryptocurrencyHoldingsRequest {\n authToken: string\n type: string\n apiKey: string\n}\n\nexport interface GetTransferIntegrationsRequest {\n apiKey: string\n}\n\nexport interface IntegrationNetworkInfo {\n chainId: string\n id: string\n logoUrl: string\n name: string\n nativeSymbol: string\n supportedTokens: string[]\n}\n\nexport interface TransferIntegration {\n networks: IntegrationNetworkInfo[]\n supportsIncomingTransfers: boolean\n supportsOutgoingTransfers: boolean\n type: string\n}\n\nexport interface GetTransferIntegrationsResponse {\n integrations: TransferIntegration[]\n}\n\nexport interface GetLinkTokenRequest {\n userId: string\n integrationId?: string | null\n restrictMultipleAccounts?: boolean\n transferOptions?: any | null\n apiKey: string\n}\n\nexport interface GetLinkTokenResponse {\n linkToken: string\n}\n\nexport interface PreviewTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n toAuthToken?: string | null\n toType?: string | null\n networkId?: string\n symbol?: string | null\n toAddress?: string | null\n amount?: string | null\n amountInFiat?: string | null\n fiatCurrency?: string | null\n}\n\nexport interface MeshExecuteTransferRequest {\n apiKey: string\n fromAuthToken: string\n fromType: string\n previewId: string\n mfaCode?: string | null\n}\n\n// Reference: https://docs.meshconnect.com/reference/post_api-v1-transfers-managed-execute\nexport enum MeshExecuteTransferStatus {\n succeeded = 'succeeded',\n failed = 'failed',\n mfaRequired = 'mfaRequired',\n emailConfirmationRequired = 'emailConfirmationRequired',\n deviceConfirmationRequired = 'deviceConfirmationRequired',\n mfaFailed = 'mfaFailed',\n addressWhitelistRequired = 'addressWhitelistRequired',\n secondMfaRequired = 'secondMfaRequired',\n}\n\nexport enum MeshExecuteTransferMfaType {\n unspecified = 'unspecified',\n phone = 'phone',\n email = 'email',\n otp = 'otp',\n}\n\nexport interface MeshExecuteTransferContent {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n\nexport interface MeshExecuteTransferResponse {\n status: MeshExecuteTransferStatus\n mfaType: MeshExecuteTransferMfaType\n errorMessage: string | null\n executeTransferResult: object | null\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { ErrorCode, InternalFailureError } from '../../errors'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport {\n GetMoonpayBuyQuoteForCreditCardRequest,\n GetMoonpayOffRampUrlRequest,\n GetMoonpayOnRampUrlRequest,\n GetMoonpayUrlSignatureRequest,\n MoonpayCurrency,\n} from './types'\n\nexport async function getMoonpayUrlSignature({\n url,\n isSandbox,\n apiKey,\n}: GetMoonpayUrlSignatureRequest): Promise<string> {\n const signature = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-signature/`,\n body: { url, isSandbox },\n apiKey,\n })\n if (!signature || !signature?.url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No onramp url found.',\n '',\n { url },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return signature.url\n}\n\nexport async function getMoonpayBuyQuoteForCreditCard({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n baseCurrencyAmount,\n extraFeePercentage,\n areFeesIncluded,\n apiKey,\n}: GetMoonpayBuyQuoteForCreditCardRequest): Promise<any> {\n const params = new URLSearchParams({\n currencyCode,\n baseCurrencyCode,\n quoteCurrencyAmount,\n paymentMethod: 'credit_debit_card',\n ...(baseCurrencyAmount == null\n ? {}\n : { baseCurrencyAmount: baseCurrencyAmount.toString() }),\n ...(extraFeePercentage == null\n ? {}\n : { extraFeePercentage: extraFeePercentage.toString() }),\n ...(areFeesIncluded == null\n ? {}\n : { areFeesIncluded: areFeesIncluded.toString() }),\n }).toString()\n\n const res = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-buy-quote?${params}`,\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return res\n}\n\n/**=======================\n * POTENTIAL DEPRECATION\n *=======================*/\n\nexport async function getMoonpayOnRampUrl({\n apiKey,\n walletAddr,\n currencyCode,\n}: GetMoonpayOnRampUrlRequest): Promise<string> {\n const endpoint = `on-ramp/${walletAddr}?provider=moonpay`\n if (currencyCode) {\n endpoint.concat(`&currencyCode=${currencyCode}`)\n }\n const url: string = (\n await sendGetRequest({\n uri: `${API_BASE_URL}/${endpoint}`,\n apiKey,\n })\n )?.url\n if (!url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No onramp url found.',\n '',\n { walletAddr },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return url\n}\n\nexport async function getMoonpayOffRampUrl({\n walletAddr,\n apiKey,\n}: GetMoonpayOffRampUrlRequest): Promise<string> {\n const url: string = (\n await sendGetRequest({\n uri: `${API_BASE_URL}/off-ramp/${walletAddr}?provider=moonpay`,\n apiKey,\n })\n )?.url\n if (!url) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No offramp url found.',\n '',\n { walletAddr },\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return url\n}\n\nexport async function getMoonpayOnRampSupportedCurrencies({\n apiKey,\n}: {\n apiKey: string\n}): Promise<MoonpayCurrency[]> {\n const currencies: MoonpayCurrency[] = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/moonpay-currencies`,\n apiKey,\n })\n if (!currencies || !currencies.length) {\n throw new InternalFailureError(\n ErrorCode.UnknownServerError,\n 'No supported currencies found.',\n '',\n {},\n 'This is an internal error, please contact support.',\n 'https://docs.fun.xyz',\n )\n }\n return currencies\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendGetRequest, sendPostRequest } from '../../utils'\nimport {\n CreateStripeBuySessionBody,\n CreateStripeBuySessionResponse,\n GetStripeBuyQuoteRequest,\n GetStripeBuyQuoteResponse,\n} from './types'\n\nexport async function getStripeBuyQuote({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n isSandbox,\n apiKey,\n}: GetStripeBuyQuoteRequest): Promise<GetStripeBuyQuoteResponse> {\n const params = new URLSearchParams({\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrencies: destinationCurrency,\n // Only allow one network in this SDK\n destinationNetworks: destinationNetwork,\n }).toString()\n const buyQuoteResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-buy-quote?${params}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buyQuoteResp as GetStripeBuyQuoteResponse\n}\n\nexport async function createStripeBuySession({\n sourceCurrency,\n destinationAmount,\n destinationCurrency,\n destinationNetwork,\n walletAddress,\n customerIpAddress,\n isSandbox,\n apiKey,\n}: CreateStripeBuySessionBody): Promise<CreateStripeBuySessionResponse> {\n const body = {\n isSandbox: isSandbox.toString(),\n sourceCurrency,\n destinationAmount: destinationAmount.toString(),\n // Only allow one currency in this SDK\n destinationCurrency,\n destinationCurrencies: [destinationCurrency],\n // Only allow one network in this SDK\n destinationNetwork,\n destinationNetworks: [destinationNetwork],\n // Only allow one wallet address in this SDK, and it must correspond to the destination network\n walletAddresses: {\n [destinationNetwork]: walletAddress,\n },\n ...(customerIpAddress ? { customerIpAddress } : {}),\n }\n const newBuySessionResp = await sendPostRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout`,\n body,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return newBuySessionResp as CreateStripeBuySessionResponse\n}\n\nexport async function getStripeBuySession({\n sessionId,\n apiKey,\n}: {\n sessionId: string\n apiKey: string\n}): Promise<CreateStripeBuySessionResponse> {\n const buySessionResp = await sendGetRequest({\n uri: `${API_BASE_URL}/on-ramp/stripe-checkout-session/${sessionId}`,\n retryOptions: { maxAttempts: 1 },\n apiKey,\n })\n return buySessionResp as CreateStripeBuySessionResponse\n}\n", "import { API_BASE_URL } from '../../consts'\nimport { sendPostRequest } from '../../utils'\nimport { SendSupportMessageRequest } from './types'\n\nexport async function sendSupportMessage({\n title,\n description,\n userEmail,\n apiKey,\n}: SendSupportMessageRequest): Promise<boolean> {\n try {\n await sendPostRequest({\n uri: `${API_BASE_URL}/support/send-message`,\n body: { title, description, userEmail },\n apiKey,\n retryOptions: { maxAttempts: 1 },\n })\n return true\n } catch (err) {\n return false\n }\n}\n"],
5
+ "mappings": ";AAAO,IAAM,eACX,QACI,mCACA,QACA,mCACA,QACA;AAAA;AAAA,EAEA;AAAA;AAEC,IAAM,iBAAiB;;;ACV9B,IAAM,UAAU;AACT,IAAM,YAAN,cAAwB,MAAM;AAAA,EAGnC,YACS,UACA,MACA,MACP,KACO,YAEA,YACP,eACA,SACA,aAAa,OACb;AACA,UAAM,GAAG,GAAG;AAAA;AAAA,EAAO,aAAa;AAAA,QAAW,OAAO;AAAA,WAAc,OAAO,EAAE;AAXlE;AACA;AACA;AAEA;AAEA;AAMP,QAAI,YAAY;AACd,WAAK,QAAQ;AAAA,IACf;AAEA,SAAK,WAAW;AAChB,SAAK,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,EAC1C;AAAA,EAEA,UAAU;AACR,SAAK,WACH;AAAA,EACJ;AACF;;;AC7BA;AAAA,EACE,MAAQ;AAAA,IACN,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,IACP,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,OAAS;AAAA,I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A,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwE;AACtE,QAAM,OAAO;AAAA,IACX,WAAW,UAAU,SAAS;AAAA,IAC9B;AAAA,IACA,mBAAmB,kBAAkB,SAAS;AAAA;AAAA,IAE9C;AAAA,IACA,uBAAuB,CAAC,mBAAmB;AAAA;AAAA,IAE3C;AAAA,IACA,qBAAqB,CAAC,kBAAkB;AAAA;AAAA,IAExC,iBAAiB;AAAA,MACf,CAAC,kBAAkB,GAAG;AAAA,IACxB;AAAA,IACA,GAAI,oBAAoB,EAAE,kBAAkB,IAAI,CAAC;AAAA,EACnD;AACA,QAAM,oBAAoB,MAAM,gBAAgB;AAAA,IAC9C,KAAK,GAAG,YAAY;AAAA,IACpB;AAAA,IACA,cAAc,EAAE,aAAa,EAAE;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEA,eAAsB,oBAAoB;AAAA,EACxC;AAAA,EACA;AACF,GAG4C;AAC1C,QAAM,iBAAiB,MAAM,eAAe;AAAA,IAC1C,KAAK,GAAG,YAAY,oCAAoC,SAAS;AAAA,IACjE,cAAc,EAAE,aAAa,EAAE;AAAA,IAC/B;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;AC9EA,eAAsB,mBAAmB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgD;AAC9C,MAAI;AACF,UAAM,gBAAgB;AAAA,MACpB,KAAK,GAAG,YAAY;AAAA,MACpB,MAAM,EAAE,OAAO,aAAa,UAAU;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,aAAa,EAAE;AAAA,IACjC,CAAC;AACD,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,WAAO;AAAA,EACT;AACF;",
6
6
  "names": ["ErrorBaseType", "ErrorType", "ErrorCode", "toHex", "toHex", "CheckoutState", "MeshExecuteTransferStatus", "MeshExecuteTransferMfaType"]
7
7
  }
@@ -2,8 +2,9 @@ export declare class BaseError extends Error {
2
2
  baseType: string;
3
3
  type: string;
4
4
  code: string;
5
+ rawMessage: string;
5
6
  paramsUsed: any;
6
7
  timestamp: string;
7
- constructor(baseType: string, type: string, code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string, isInternal?: boolean);
8
+ constructor(baseType: string, type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string, isInternal?: boolean);
8
9
  loadEnd(): void;
9
10
  }
@@ -1,22 +1,19 @@
1
1
  import { BaseError } from './BaseError';
2
2
  export declare class ClientError extends BaseError {
3
- constructor(type: string, code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
3
+ constructor(type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
4
4
  }
5
5
  export declare class InvalidParameterError extends ClientError {
6
- constructor(code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
6
+ constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
7
7
  }
8
8
  export declare class ResourceNotFoundError extends ClientError {
9
- constructor(code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
10
- }
11
- export declare class InvalidActionError extends ClientError {
12
- constructor(code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
9
+ constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
13
10
  }
14
11
  export declare class ThrottlingError extends ClientError {
15
- constructor(code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
12
+ constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
16
13
  }
17
14
  export declare class AccessDeniedError extends ClientError {
18
- constructor(code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
15
+ constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
19
16
  }
20
17
  export declare class UserOpFailureError extends ClientError {
21
- constructor(code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
18
+ constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
22
19
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseError } from './BaseError';
2
2
  export declare class ServerError extends BaseError {
3
- constructor(type: string, code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
3
+ constructor(type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
4
4
  }
5
5
  export declare class InternalFailureError extends ServerError {
6
- constructor(code: string, msg: string, paramsUsed: any, fixSuggestion: string, docLink: string);
6
+ constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { Address } from 'viem';
2
- import { CheckoutDeactivateParams, CheckoutHistoryItem, CheckoutInitParams, CheckoutQuoteParams, CheckoutQuoteResponse, CheckoutTransferSponsorshipParams, CheckoutTransferSponsorshipResponse } from './types';
2
+ import { CheckoutDeactivateParams, CheckoutHistoryItem, CheckoutInitParams, CheckoutQuoteParams, CheckoutQuoteResponse, CheckoutTransferSponsorshipParams, CheckoutTransferSponsorshipResponse, RiskAssessmentParams, RiskAssessmentResponse } from './types';
3
3
  /**
4
4
  * Gets a checkout quote (estimation).
5
5
  * @param fromChainId The ID of the chain where funds will be provided from.
@@ -11,9 +11,10 @@ import { CheckoutDeactivateParams, CheckoutHistoryItem, CheckoutInitParams, Chec
11
11
  * @param toTokenDecimals The number of decimals for the toTokenAddress.
12
12
  * @param expirationTimestampMs The amount of time (duration) from now before the checkout operation expires.
13
13
  * @param apiKey A valid fun api key.
14
+ * @param signal AbortSignal to cancel the request when no longer needed
14
15
  * @return {Promise<CheckoutCoreQuoteResponse>} The formatted quote object
15
16
  */
16
- export declare function getCheckoutQuote({ fromChainId, fromTokenAddress, fromTokenDecimals, toChainId, toTokenAddress, toTokenDecimals, toTokenAmount, expirationTimestampMs, sponsorInitialTransferGasLimit, recipientAddr, needsRefuel, userId, apiKey, }: CheckoutQuoteParams): Promise<CheckoutQuoteResponse>;
17
+ export declare function getCheckoutQuote({ fromChainId, fromTokenAddress, fromTokenDecimals, toChainId, toTokenAddress, toTokenDecimals, toTokenAmount, expirationTimestampMs, sponsorInitialTransferGasLimit, recipientAddr, needsRefuel, userId, apiKey, signal, }: CheckoutQuoteParams): Promise<CheckoutQuoteResponse>;
17
18
  /**
18
19
  * Initializes a checkout
19
20
  * @param userOp The checkout UserOp, signed.
@@ -72,3 +73,4 @@ export declare function getCheckoutsByUserId({ userId, apiKey, signal, }: {
72
73
  signal?: AbortSignal;
73
74
  }): Promise<CheckoutHistoryItem[]>;
74
75
  export declare function getPaymasterDataForCheckoutSponsoredTransfer({ depositAddress, transferUserOp, apiKey, }: CheckoutTransferSponsorshipParams): Promise<CheckoutTransferSponsorshipResponse>;
76
+ export declare function getRiskAssessmentForAddress({ address, apiKey, }: RiskAssessmentParams): Promise<RiskAssessmentResponse>;
@@ -22,6 +22,7 @@ export type CheckoutQuoteParams = Omit<CheckoutApiQuoteParams, 'toAmountBaseUnit
22
22
  expirationTimestampMs: number;
23
23
  needsRefuel: boolean;
24
24
  apiKey: string;
25
+ signal?: AbortSignal;
25
26
  };
26
27
  export type CheckoutApiQuoteResponse = {
27
28
  quoteId: string;
@@ -112,4 +113,60 @@ export type CheckoutTransferSponsorshipResponse = {
112
113
  deadline: number;
113
114
  paymasterAndData: Hex;
114
115
  };
116
+ /**===============================*
117
+ * RISK ASSESSMENT *
118
+ *================================*/
119
+ export type RiskAssessmentParams = {
120
+ address: Address | `dydx${string}`;
121
+ apiKey: string;
122
+ };
123
+ type AddressIdentification = {
124
+ name: string;
125
+ address: Address | `dydx${string}`;
126
+ category: string;
127
+ description: string;
128
+ url: string | null;
129
+ createdAt: number;
130
+ };
131
+ type Cluster = {
132
+ name: string;
133
+ category: string;
134
+ };
135
+ type RiskValues = 'Severe' | 'High' | 'Medium' | 'Low';
136
+ type ExposureType = 'direct' | 'indirect';
137
+ type Exposure = {
138
+ category: string;
139
+ value: number;
140
+ exposureType: ExposureType;
141
+ direction: string;
142
+ };
143
+ type RiskTrigger = {
144
+ risk: string;
145
+ minThreshold: number;
146
+ maxThreshold: number;
147
+ exposureType: string;
148
+ direction: string;
149
+ };
150
+ type Trigger = {
151
+ category: string;
152
+ percentage: number;
153
+ message: string;
154
+ ruleTriggered?: RiskTrigger;
155
+ };
156
+ type PoolMetadata = {
157
+ fees?: number;
158
+ tokens: string[];
159
+ };
160
+ export type RiskAssessmentResponse = {
161
+ address: Address | `dydx${string}`;
162
+ risk: RiskValues;
163
+ riskReason: string | null;
164
+ cluster?: Cluster;
165
+ addressType: string;
166
+ addressIdentifications: AddressIdentification[];
167
+ exposures: Exposure[];
168
+ triggers: Trigger[];
169
+ status: string;
170
+ poolMetadata: PoolMetadata;
171
+ };
115
172
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/api-base",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Base API for Funkit",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",