@funkit/core 0.9.0 → 0.10.0

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.
Files changed (205) hide show
  1. package/dist/fetch-polyfill.js.map +1 -1
  2. package/dist/index.d.ts +12 -12
  3. package/dist/src/abis/CheckoutPaymaster.json +1 -0
  4. package/dist/src/actions/AccessControl.d.ts +6 -6
  5. package/dist/src/actions/AccessControl.js +19 -15
  6. package/dist/src/actions/AccessControl.js.map +1 -1
  7. package/dist/src/actions/BatchActions.d.ts +2 -2
  8. package/dist/src/actions/BatchActions.js +2 -2
  9. package/dist/src/actions/BatchActions.js.map +1 -1
  10. package/dist/src/actions/Bridge.d.ts +4 -4
  11. package/dist/src/actions/Bridge.js +10 -6
  12. package/dist/src/actions/Bridge.js.map +1 -1
  13. package/dist/src/actions/FirstClassActions.d.ts +6 -6
  14. package/dist/src/actions/FirstClassActions.js +25 -23
  15. package/dist/src/actions/FirstClassActions.js.map +1 -1
  16. package/dist/src/actions/Group.d.ts +3 -3
  17. package/dist/src/actions/Group.js +6 -14
  18. package/dist/src/actions/Group.js.map +1 -1
  19. package/dist/src/actions/LimitOrder.d.ts +3 -3
  20. package/dist/src/actions/LimitOrder.js +16 -13
  21. package/dist/src/actions/LimitOrder.js.map +1 -1
  22. package/dist/src/actions/Stake.d.ts +3 -3
  23. package/dist/src/actions/Stake.js +31 -44
  24. package/dist/src/actions/Stake.js.map +1 -1
  25. package/dist/src/actions/Swap.d.ts +4 -4
  26. package/dist/src/actions/Swap.js +37 -35
  27. package/dist/src/actions/Swap.js.map +1 -1
  28. package/dist/src/actions/Token.d.ts +3 -3
  29. package/dist/src/actions/Token.js +33 -23
  30. package/dist/src/actions/Token.js.map +1 -1
  31. package/dist/src/actions/index.d.ts +7 -7
  32. package/dist/src/actions/types.d.ts +4 -4
  33. package/dist/src/actions/types.js +2 -2
  34. package/dist/src/actions/types.js.map +1 -1
  35. package/dist/src/apis/AccessControlApis.d.ts +1 -1
  36. package/dist/src/apis/AccessControlApis.js +7 -3
  37. package/dist/src/apis/AccessControlApis.js.map +1 -1
  38. package/dist/src/apis/AssetApis.d.ts +10 -0
  39. package/dist/src/apis/AssetApis.js +11 -1
  40. package/dist/src/apis/AssetApis.js.map +1 -1
  41. package/dist/src/apis/BridgeApis.d.ts +1 -1
  42. package/dist/src/apis/BridgeApis.js +13 -13
  43. package/dist/src/apis/BridgeApis.js.map +1 -1
  44. package/dist/src/apis/CheckoutApis.d.ts +43 -0
  45. package/dist/src/apis/CheckoutApis.js +116 -0
  46. package/dist/src/apis/CheckoutApis.js.map +1 -0
  47. package/dist/src/apis/ContractApis.js +1 -1
  48. package/dist/src/apis/ContractApis.js.map +1 -1
  49. package/dist/src/apis/FaucetApis.js.map +1 -1
  50. package/dist/src/apis/GroupApis.d.ts +2 -2
  51. package/dist/src/apis/GroupApis.js +3 -3
  52. package/dist/src/apis/GroupApis.js.map +1 -1
  53. package/dist/src/apis/InfoApis.d.ts +1 -1
  54. package/dist/src/apis/InfoApis.js +9 -7
  55. package/dist/src/apis/InfoApis.js.map +1 -1
  56. package/dist/src/apis/ListenerApis.d.ts +1 -1
  57. package/dist/src/apis/ListenerApis.js +6 -6
  58. package/dist/src/apis/ListenerApis.js.map +1 -1
  59. package/dist/src/apis/MeshApis.d.ts +87 -0
  60. package/dist/src/apis/MeshApis.js +213 -0
  61. package/dist/src/apis/MeshApis.js.map +1 -0
  62. package/dist/src/apis/NFTApis.js.map +1 -1
  63. package/dist/src/apis/OnOffRampApis.d.ts +2 -0
  64. package/dist/src/apis/OnOffRampApis.js +24 -5
  65. package/dist/src/apis/OnOffRampApis.js.map +1 -1
  66. package/dist/src/apis/OnOffRampUtils.js +2 -2
  67. package/dist/src/apis/OnOffRampUtils.js.map +1 -1
  68. package/dist/src/apis/OperationApis.d.ts +4 -4
  69. package/dist/src/apis/OperationApis.js +21 -12
  70. package/dist/src/apis/OperationApis.js.map +1 -1
  71. package/dist/src/apis/PaymasterApis.d.ts +1 -1
  72. package/dist/src/apis/PaymasterApis.js +2 -2
  73. package/dist/src/apis/PaymasterApis.js.map +1 -1
  74. package/dist/src/apis/SwapApis.d.ts +2 -2
  75. package/dist/src/apis/SwapApis.js +6 -6
  76. package/dist/src/apis/SwapApis.js.map +1 -1
  77. package/dist/src/apis/TurnkeyApis.d.ts +1 -1
  78. package/dist/src/apis/TurnkeyApis.js +3 -3
  79. package/dist/src/apis/TurnkeyApis.js.map +1 -1
  80. package/dist/src/apis/UserApis.d.ts +2 -2
  81. package/dist/src/apis/UserApis.js +10 -7
  82. package/dist/src/apis/UserApis.js.map +1 -1
  83. package/dist/src/apis/index.d.ts +13 -11
  84. package/dist/src/apis/index.js +3 -1
  85. package/dist/src/apis/index.js.map +1 -1
  86. package/dist/src/apis/types.d.ts +75 -3
  87. package/dist/src/apis/types.js +16 -0
  88. package/dist/src/apis/types.js.map +1 -1
  89. package/dist/src/auth/Auth.d.ts +6 -6
  90. package/dist/src/auth/Auth.js +43 -46
  91. package/dist/src/auth/Auth.js.map +1 -1
  92. package/dist/src/auth/SessionKeyAuth.d.ts +5 -5
  93. package/dist/src/auth/SessionKeyAuth.js +29 -24
  94. package/dist/src/auth/SessionKeyAuth.js.map +1 -1
  95. package/dist/src/auth/index.d.ts +2 -2
  96. package/dist/src/auth/types.d.ts +1 -1
  97. package/dist/src/common/constants.d.ts +110 -17
  98. package/dist/src/common/constants.js +158 -85
  99. package/dist/src/common/constants.js.map +1 -1
  100. package/dist/src/common/index.d.ts +2 -2
  101. package/dist/src/common/types.d.ts +2 -2
  102. package/dist/src/config/Config.d.ts +1 -1
  103. package/dist/src/config/Config.js +10 -4
  104. package/dist/src/config/Config.js.map +1 -1
  105. package/dist/src/config/index.d.ts +2 -2
  106. package/dist/src/config/types.d.ts +4 -2
  107. package/dist/src/data/Chain.d.ts +4 -4
  108. package/dist/src/data/Chain.js +38 -27
  109. package/dist/src/data/Chain.js.map +1 -1
  110. package/dist/src/data/NFT.d.ts +3 -3
  111. package/dist/src/data/NFT.js +11 -11
  112. package/dist/src/data/NFT.js.map +1 -1
  113. package/dist/src/data/Operation.d.ts +5 -5
  114. package/dist/src/data/Operation.js +12 -10
  115. package/dist/src/data/Operation.js.map +1 -1
  116. package/dist/src/data/SolidityData.d.ts +3 -3
  117. package/dist/src/data/SolidityData.js +37 -17
  118. package/dist/src/data/SolidityData.js.map +1 -1
  119. package/dist/src/data/Token.d.ts +4 -4
  120. package/dist/src/data/Token.js +9 -9
  121. package/dist/src/data/Token.js.map +1 -1
  122. package/dist/src/data/index.d.ts +6 -6
  123. package/dist/src/data/index.js +2 -2
  124. package/dist/src/data/index.js.map +1 -1
  125. package/dist/src/data/types.d.ts +2 -2
  126. package/dist/src/data/types.js +3 -3
  127. package/dist/src/data/types.js.map +1 -1
  128. package/dist/src/errors/BaseError.js +4 -3
  129. package/dist/src/errors/BaseError.js.map +1 -1
  130. package/dist/src/errors/ClientError.d.ts +1 -1
  131. package/dist/src/errors/ClientError.js +3 -3
  132. package/dist/src/errors/ClientError.js.map +1 -1
  133. package/dist/src/errors/ServerError.d.ts +1 -1
  134. package/dist/src/errors/ServerError.js.map +1 -1
  135. package/dist/src/errors/index.d.ts +4 -4
  136. package/dist/src/errors/types.d.ts +2 -1
  137. package/dist/src/errors/types.js +4 -3
  138. package/dist/src/errors/types.js.map +1 -1
  139. package/dist/src/sponsors/CheckoutSponsor.d.ts +23 -0
  140. package/dist/src/sponsors/CheckoutSponsor.js +65 -0
  141. package/dist/src/sponsors/CheckoutSponsor.js.map +1 -0
  142. package/dist/src/sponsors/GaslessSponsor.d.ts +4 -4
  143. package/dist/src/sponsors/GaslessSponsor.js +18 -15
  144. package/dist/src/sponsors/GaslessSponsor.js.map +1 -1
  145. package/dist/src/sponsors/Sponsor.d.ts +5 -5
  146. package/dist/src/sponsors/Sponsor.js +12 -11
  147. package/dist/src/sponsors/Sponsor.js.map +1 -1
  148. package/dist/src/sponsors/TokenSponsor.d.ts +7 -7
  149. package/dist/src/sponsors/TokenSponsor.js +75 -68
  150. package/dist/src/sponsors/TokenSponsor.js.map +1 -1
  151. package/dist/src/sponsors/index.d.ts +4 -3
  152. package/dist/src/sponsors/index.js +2 -1
  153. package/dist/src/sponsors/index.js.map +1 -1
  154. package/dist/src/sponsors/types.d.ts +2 -1
  155. package/dist/src/sponsors/types.js +2 -1
  156. package/dist/src/sponsors/types.js.map +1 -1
  157. package/dist/src/utils/ApiUtils.js +21 -19
  158. package/dist/src/utils/ApiUtils.js.map +1 -1
  159. package/dist/src/utils/AuthUtils.d.ts +1 -1
  160. package/dist/src/utils/AuthUtils.js +4 -4
  161. package/dist/src/utils/AuthUtils.js.map +1 -1
  162. package/dist/src/utils/ChainUtils.d.ts +5 -5
  163. package/dist/src/utils/ChainUtils.js +35 -20
  164. package/dist/src/utils/ChainUtils.js.map +1 -1
  165. package/dist/src/utils/CheckoutUtils.d.ts +6 -0
  166. package/dist/src/utils/CheckoutUtils.js +24 -0
  167. package/dist/src/utils/CheckoutUtils.js.map +1 -0
  168. package/dist/src/utils/GroupUtils.d.ts +3 -3
  169. package/dist/src/utils/GroupUtils.js +8 -8
  170. package/dist/src/utils/GroupUtils.js.map +1 -1
  171. package/dist/src/utils/MerkleUtils.d.ts +1 -1
  172. package/dist/src/utils/MerkleUtils.js +5 -5
  173. package/dist/src/utils/MerkleUtils.js.map +1 -1
  174. package/dist/src/utils/PaymasterUtils.d.ts +3 -3
  175. package/dist/src/utils/PaymasterUtils.js +6 -2
  176. package/dist/src/utils/PaymasterUtils.js.map +1 -1
  177. package/dist/src/utils/SwapUtils.d.ts +2 -2
  178. package/dist/src/utils/SwapUtils.js +42 -33
  179. package/dist/src/utils/SwapUtils.js.map +1 -1
  180. package/dist/src/utils/TypeUtils.js.map +1 -1
  181. package/dist/src/utils/UserOpUtils.d.ts +2 -2
  182. package/dist/src/utils/UserOpUtils.js +77 -65
  183. package/dist/src/utils/UserOpUtils.js.map +1 -1
  184. package/dist/src/utils/ViemUtils.d.ts +2 -2
  185. package/dist/src/utils/ViemUtils.js +10 -6
  186. package/dist/src/utils/ViemUtils.js.map +1 -1
  187. package/dist/src/utils/WalletUtils.d.ts +2 -2
  188. package/dist/src/utils/WalletUtils.js +6 -5
  189. package/dist/src/utils/WalletUtils.js.map +1 -1
  190. package/dist/src/utils/index.d.ts +8 -7
  191. package/dist/src/utils/index.js +1 -0
  192. package/dist/src/utils/index.js.map +1 -1
  193. package/dist/src/viem/ContractInterface.d.ts +4 -4
  194. package/dist/src/viem/ContractInterface.js +8 -8
  195. package/dist/src/viem/ContractInterface.js.map +1 -1
  196. package/dist/src/viem/Converter.d.ts +823 -1107
  197. package/dist/src/viem/Converter.js +11 -11
  198. package/dist/src/viem/Converter.js.map +1 -1
  199. package/dist/src/viem/index.d.ts +2 -2
  200. package/dist/src/wallet/FunWallet.d.ts +8 -8
  201. package/dist/src/wallet/FunWallet.js +133 -89
  202. package/dist/src/wallet/FunWallet.js.map +1 -1
  203. package/dist/src/wallet/index.d.ts +2 -2
  204. package/dist/src/wallet/types.d.ts +1 -1
  205. package/package.json +13 -5
@@ -5,12 +5,12 @@ const viem_1 = require("viem");
5
5
  // @ts-ignore
6
6
  //eslint-disable-next-line
7
7
  const chains_1 = require("viem/chains");
8
- const convertProviderToClient = ({ provider, viemChain }) => {
8
+ const convertProviderToClient = ({ provider, viemChain, }) => {
9
9
  const chain = viemChain ? viemChain : chains_1.mainnet;
10
10
  if (provider.request) {
11
11
  return (0, viem_1.createWalletClient)({
12
12
  chain,
13
- transport: (0, viem_1.custom)(provider)
13
+ transport: (0, viem_1.custom)(provider),
14
14
  });
15
15
  }
16
16
  if (!provider.send)
@@ -21,31 +21,31 @@ const convertProviderToClient = ({ provider, viemChain }) => {
21
21
  async request({ method, params }) {
22
22
  const response = await provider.send(method, params);
23
23
  return response;
24
- }
25
- })
24
+ },
25
+ }),
26
26
  });
27
27
  };
28
28
  exports.convertProviderToClient = convertProviderToClient;
29
- const convertSignerToClient = ({ signer, viemChain }) => {
29
+ const convertSignerToClient = ({ signer, viemChain, }) => {
30
30
  const chain = viemChain ? viemChain : chains_1.mainnet;
31
- if (signer.type === "local") {
31
+ if (signer.type === 'local') {
32
32
  return (0, viem_1.createWalletClient)({
33
33
  chain,
34
- transport: (0, viem_1.custom)(signer)
34
+ transport: (0, viem_1.custom)(signer),
35
35
  });
36
36
  }
37
37
  return (0, viem_1.createWalletClient)({
38
38
  chain,
39
39
  transport: (0, viem_1.custom)({
40
40
  async request({ method, params }) {
41
- if (method === "eth_requestAccounts") {
41
+ if (method === 'eth_requestAccounts') {
42
42
  return [await signer.getAddress()];
43
43
  }
44
- else if (method === "personal_sign") {
44
+ else if (method === 'personal_sign') {
45
45
  return await signer.signMessage((0, viem_1.toBytes)(params[0]));
46
46
  }
47
- }
48
- })
47
+ },
48
+ }),
49
49
  });
50
50
  };
51
51
  exports.convertSignerToClient = convertSignerToClient;
@@ -1 +1 @@
1
- {"version":3,"file":"Converter.js","sourceRoot":"","sources":["../../../src/viem/Converter.ts"],"names":[],"mappings":";;;AAAA,+BAA0D;AAC1D,aAAa;AACb,0BAA0B;AAC1B,wCAA4C;AAYrC,MAAM,uBAAuB,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAmC,EAAE,EAAE;IAChG,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAO,CAAA;IAC7C,IAAI,QAAQ,CAAC,OAAO,EAAE;QAClB,OAAO,IAAA,yBAAkB,EAAC;YACtB,KAAK;YACL,SAAS,EAAE,IAAA,aAAM,EAAC,QAAQ,CAAC;SAC9B,CAAC,CAAA;KACL;IACD,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IACxE,OAAO,IAAA,yBAAkB,EAAC;QACtB,KAAK;QACL,SAAS,EAAE,IAAA,aAAM,EAAC;YACd,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE;gBAC5B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBACpD,OAAO,QAAQ,CAAA;YACnB,CAAC;SACJ,CAAC;KACL,CAAC,CAAA;AACN,CAAC,CAAA;AAlBY,QAAA,uBAAuB,2BAkBnC;AAEM,MAAM,qBAAqB,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAiC,EAAE,EAAE;IAC1F,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAO,CAAA;IAC7C,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;QACzB,OAAO,IAAA,yBAAkB,EAAC;YACtB,KAAK;YACL,SAAS,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC;SAC5B,CAAC,CAAA;KACL;IACD,OAAO,IAAA,yBAAkB,EAAC;QACtB,KAAK;QACL,SAAS,EAAE,IAAA,aAAM,EAAC;YACd,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE;gBAC5B,IAAI,MAAM,KAAK,qBAAqB,EAAE;oBAClC,OAAO,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAA;iBACrC;qBAAM,IAAI,MAAM,KAAK,eAAe,EAAE;oBACnC,OAAO,MAAM,MAAM,CAAC,WAAW,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;iBACtD;YACL,CAAC;SACJ,CAAC;KACL,CAAC,CAAA;AACN,CAAC,CAAA;AApBY,QAAA,qBAAqB,yBAoBjC"}
1
+ {"version":3,"file":"Converter.js","sourceRoot":"","sources":["../../../src/viem/Converter.ts"],"names":[],"mappings":";;;AAAA,+BAA0D;AAC1D,aAAa;AACb,0BAA0B;AAC1B,wCAA4C;AAYrC,MAAM,uBAAuB,GAAG,CAAC,EACtC,QAAQ,EACR,SAAS,GACuB,EAAE,EAAE;IACpC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAO,CAAA;IAC7C,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,IAAA,yBAAkB,EAAC;YACxB,KAAK;YACL,SAAS,EAAE,IAAA,aAAM,EAAC,QAAQ,CAAC;SAC5B,CAAC,CAAA;IACJ,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IACxE,OAAO,IAAA,yBAAkB,EAAC;QACxB,KAAK;QACL,SAAS,EAAE,IAAA,aAAM,EAAC;YAChB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE;gBAC9B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBACpD,OAAO,QAAQ,CAAA;YACjB,CAAC;SACF,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAA;AArBY,QAAA,uBAAuB,2BAqBnC;AAEM,MAAM,qBAAqB,GAAG,CAAC,EACpC,MAAM,EACN,SAAS,GACqB,EAAE,EAAE;IAClC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAO,CAAA;IAC7C,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO,IAAA,yBAAkB,EAAC;YACxB,KAAK;YACL,SAAS,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC;SAC1B,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,IAAA,yBAAkB,EAAC;QACxB,KAAK;QACL,SAAS,EAAE,IAAA,aAAM,EAAC;YAChB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE;gBAC9B,IAAI,MAAM,KAAK,qBAAqB,EAAE,CAAC;oBACrC,OAAO,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAA;gBACpC,CAAC;qBAAM,IAAI,MAAM,KAAK,eAAe,EAAE,CAAC;oBACtC,OAAO,MAAM,MAAM,CAAC,WAAW,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;gBACrD,CAAC;YACH,CAAC;SACF,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAA;AAvBY,QAAA,qBAAqB,yBAuBjC"}
@@ -1,2 +1,2 @@
1
- export * from "./ContractInterface";
2
- export * from "./Converter";
1
+ export * from './ContractInterface';
2
+ export * from './Converter';
@@ -1,11 +1,11 @@
1
- import { Address, Hex } from "viem";
2
- import { FunWalletParams, User } from "./types";
3
- import { FirstClassActions } from "../actions/FirstClassActions";
4
- import { Currency } from "../apis";
5
- import { Auth } from "../auth";
6
- import { ExecutionReceipt, TransactionParams } from "../common";
7
- import { EnvOption } from "../config";
8
- import { Operation, OperationStatus } from "../data";
1
+ import { Address, Hex } from 'viem';
2
+ import { FirstClassActions } from '../actions/FirstClassActions';
3
+ import { Currency } from '../apis';
4
+ import { Auth } from '../auth';
5
+ import { ExecutionReceipt, TransactionParams } from '../common';
6
+ import { EnvOption } from '../config';
7
+ import { Operation, OperationStatus } from '../data';
8
+ import { FunWalletParams, User } from './types';
9
9
  export declare class FunWallet extends FirstClassActions {
10
10
  walletUniqueId?: Hex;
11
11
  userInfo?: Map<Hex, User>;
@@ -27,28 +27,28 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
27
27
  constructor(params) {
28
28
  const chain = globalThis.globalEnvOption.chain;
29
29
  super(chain);
30
- if (typeof params === "string") {
30
+ if (typeof params === 'string') {
31
31
  if ((0, viem_1.isAddress)(params)) {
32
32
  this.address = params;
33
33
  }
34
34
  else {
35
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, "string input must be an address type", params, "Provide either (uniqueId, users) or walletAddr when constructing a FunWallet", "https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation");
35
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, 'string input must be an address type', params, 'Provide either (uniqueId, users) or walletAddr when constructing a FunWallet', 'https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation');
36
36
  }
37
37
  }
38
38
  else {
39
39
  const { users, uniqueId } = params;
40
40
  if (!uniqueId || !(0, TypeUtils_1.isBytes32)(uniqueId) || !users || users.length <= 0) {
41
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, "uniqueId must be bytes32 and users must be non-empty", params, "The uniqueId field should be a 32 byte Hexstring and the users field should be an array of User objects", "https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation");
41
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, 'uniqueId must be bytes32 and users must be non-empty', params, 'The uniqueId field should be a 32 byte Hexstring and the users field should be an array of User objects', 'https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation');
42
42
  }
43
43
  this.userInfo = new Map(users?.map((user) => {
44
44
  if (!user.userId || !(0, viem_1.isHex)(user.userId)) {
45
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, "userId is required and must be a hex string", users, "Provide hex string userId when creating a FunWallet", "https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation");
45
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, 'userId is required and must be a hex string', users, 'Provide hex string userId when creating a FunWallet', 'https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation');
46
46
  }
47
47
  if (user.groupInfo &&
48
48
  (!Number.isInteger(user.groupInfo.threshold) ||
49
49
  !Array.isArray(user.groupInfo.memberIds) ||
50
50
  !user.groupInfo.memberIds.every((memberId) => (0, viem_1.isHex)(memberId)))) {
51
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, "groupInfo must be an object with threshold as integer and memberIds as array of hex strings", users, "Provide valid groupInfo when creating a FunWallet", "https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation");
51
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameter, 'groupInfo must be an object with threshold as integer and memberIds as array of hex strings', users, 'Provide valid groupInfo when creating a FunWallet', 'https://docs.fun.xyz/how-to-guides/execute-transactions/create-funwallet#create-funwallet-manual-funwallet-creation');
52
52
  }
53
53
  return [(0, viem_1.pad)(user.userId, { size: 32 }), user];
54
54
  }));
@@ -86,9 +86,9 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
86
86
  */
87
87
  static async getAddressOffline(uniqueId, rpcUrl, factoryAddress) {
88
88
  const client = await (0, viem_1.createPublicClient)({
89
- transport: (0, viem_1.http)(rpcUrl)
89
+ transport: (0, viem_1.http)(rpcUrl),
90
90
  });
91
- return await constants_1.FACTORY_CONTRACT_INTERFACE.readFromChain(factoryAddress, "getAddress", [(0, viem_1.keccak256)((0, viem_1.toBytes)(uniqueId))], client);
91
+ return await constants_1.FACTORY_CONTRACT_INTERFACE.readFromChain(factoryAddress, 'getAddress', [(0, viem_1.keccak256)((0, viem_1.toBytes)(uniqueId))], client);
92
92
  }
93
93
  /**
94
94
  * Get all tokens for a specific chain
@@ -99,13 +99,15 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
99
99
  async getTokens(chainIdInput, onlyVerifiedTokens = false) {
100
100
  let chainId;
101
101
  if (!chainIdInput) {
102
- const chain = await data_1.Chain.getChain({ chainIdentifier: globalThis.globalEnvOption.chain });
102
+ const chain = await data_1.Chain.getChain({
103
+ chainIdentifier: globalThis.globalEnvOption.chain,
104
+ });
103
105
  chainId = await chain.getChainId();
104
106
  }
105
107
  else {
106
108
  chainId = chainIdInput;
107
109
  }
108
- if (chainId === "ALL") {
110
+ if (chainId === 'ALL') {
109
111
  return await (0, apis_1.getAllTokens)(await this.getAddress(), onlyVerifiedTokens);
110
112
  }
111
113
  else {
@@ -120,13 +122,15 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
120
122
  async getNFTs(chainIdInput) {
121
123
  let chainId;
122
124
  if (!chainIdInput) {
123
- const chain = await data_1.Chain.getChain({ chainIdentifier: globalThis.globalEnvOption.chain });
125
+ const chain = await data_1.Chain.getChain({
126
+ chainIdentifier: globalThis.globalEnvOption.chain,
127
+ });
124
128
  chainId = await chain.getChainId();
125
129
  }
126
130
  else {
127
131
  chainId = chainIdInput;
128
132
  }
129
- if (chainId === "ALL") {
133
+ if (chainId === 'ALL') {
130
134
  return await (0, apis_1.getAllNFTs)(await this.getAddress());
131
135
  }
132
136
  else {
@@ -143,20 +147,25 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
143
147
  async getAssets(chainIdInput, onlyVerifiedTokens = false, checkStatus = false) {
144
148
  let chainId;
145
149
  if (!chainIdInput) {
146
- const chain = await data_1.Chain.getChain({ chainIdentifier: globalThis.globalEnvOption.chain });
150
+ const chain = await data_1.Chain.getChain({
151
+ chainIdentifier: globalThis.globalEnvOption.chain,
152
+ });
147
153
  chainId = await chain.getChainId();
148
154
  }
149
155
  else {
150
156
  chainId = chainIdInput;
151
157
  }
152
158
  let tokens = {}, nfts = {}, lidoWithdrawals = {};
153
- if (chainId === "ALL") {
159
+ if (chainId === 'ALL') {
154
160
  tokens = await (0, apis_1.getAllTokens)(await this.getAddress(), onlyVerifiedTokens);
155
161
  nfts = await (0, apis_1.getAllNFTs)(await this.getAddress());
156
162
  if (checkStatus) {
157
- const ethMainnetLidoWithdrawals = await (0, apis_1.getLidoWithdrawals)("1", await this.getAddress());
158
- const goerliLidoWithdrawals = await (0, apis_1.getLidoWithdrawals)("5", await this.getAddress());
159
- lidoWithdrawals = { ...ethMainnetLidoWithdrawals, ...goerliLidoWithdrawals };
163
+ const ethMainnetLidoWithdrawals = await (0, apis_1.getLidoWithdrawals)('1', await this.getAddress());
164
+ const goerliLidoWithdrawals = await (0, apis_1.getLidoWithdrawals)('5', await this.getAddress());
165
+ lidoWithdrawals = {
166
+ ...ethMainnetLidoWithdrawals,
167
+ ...goerliLidoWithdrawals,
168
+ };
160
169
  }
161
170
  }
162
171
  else {
@@ -178,11 +187,11 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
178
187
  */
179
188
  async getNonce(sender, key = (0, utils_1.generateRandomNonceKey)(), txOptions = globalThis.globalEnvOption) {
180
189
  const chain = await data_1.Chain.getChain({ chainIdentifier: txOptions.chain });
181
- const entryPointAddress = await chain.getAddress("entryPointAddress");
190
+ const entryPointAddress = await chain.getAddress('entryPointAddress');
182
191
  let nonce = undefined;
183
192
  let retryCount = 3;
184
193
  while ((nonce === undefined || nonce === null) && retryCount > 0) {
185
- nonce = await common_1.ENTRYPOINT_CONTRACT_INTERFACE.readFromChain(entryPointAddress, "getNonce", [sender, key], chain);
194
+ nonce = await common_1.ENTRYPOINT_CONTRACT_INTERFACE.readFromChain(entryPointAddress, 'getNonce', [sender, key], chain);
186
195
  retryCount--;
187
196
  }
188
197
  if (nonce !== undefined && nonce !== null) {
@@ -244,8 +253,8 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
244
253
  userId: group.groupId,
245
254
  groupInfo: {
246
255
  threshold: group.threshold,
247
- memberIds: group.memberIds
248
- }
256
+ memberIds: group.memberIds,
257
+ },
249
258
  });
250
259
  });
251
260
  }
@@ -268,7 +277,11 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
268
277
  * @returns {Promise<Operation>} The operation to create the wallet.
269
278
  */
270
279
  async create(auth, userId, txOptions = globalThis.globalEnvOption) {
271
- const transactionParams = { to: await this.getAddress(), data: "0x", value: 0n };
280
+ const transactionParams = {
281
+ to: await this.getAddress(),
282
+ data: '0x',
283
+ value: 0n,
284
+ };
272
285
  return await this.createOperation(auth, userId, transactionParams, txOptions);
273
286
  }
274
287
  /**
@@ -322,17 +335,19 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
322
335
  * @returns {Promise<Operation>} The created and prepared operation.
323
336
  */
324
337
  async createOperation(auth, userId, transactionParams, txOptions = globalThis.globalEnvOption) {
325
- if (!userId || userId === "") {
326
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, "userId is required", { userId: userId }, "Provide userId when createOperation", "https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions");
338
+ if (!userId || userId === '') {
339
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, 'userId is required', { userId }, 'Provide userId when createOperation', 'https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions');
327
340
  }
328
341
  userId = (0, viem_1.pad)(userId, { size: 32 }).toLowerCase();
329
342
  const chain = await data_1.Chain.getChain({ chainIdentifier: txOptions.chain });
330
343
  const sender = await this.getAddress();
331
- const initCode = (await chain.addressIsContract(sender)) ? "0x" : await this.getThisInitCode(chain);
332
- let paymasterAndData = "0x";
344
+ const initCode = (await chain.addressIsContract(sender))
345
+ ? '0x'
346
+ : await this.getThisInitCode(chain);
347
+ let paymasterAndData = '0x';
333
348
  let maxFeePerGas, maxPriorityFeePerGas;
334
349
  const chainId = await chain.getChainId();
335
- const OPStackChains = ["10", "8453"];
350
+ const OPStackChains = ['10', '8453'];
336
351
  if (OPStackChains.includes(chainId)) {
337
352
  const gasPrice = await chain.getFeeData();
338
353
  maxFeePerGas = gasPrice.maxFeePerGas;
@@ -349,22 +364,26 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
349
364
  maxFeePerGas,
350
365
  maxPriorityFeePerGas,
351
366
  initCode,
352
- nonce: txOptions.nonce !== null && txOptions.nonce !== undefined ? txOptions.nonce : await this.getNonce(sender),
367
+ nonce: txOptions.nonce !== null && txOptions.nonce !== undefined
368
+ ? txOptions.nonce
369
+ : await this.getNonce(sender),
353
370
  preVerificationGas: 100000n,
354
371
  callGasLimit: BigInt(10e6),
355
- verificationGasLimit: BigInt(10e6)
372
+ verificationGasLimit: BigInt(10e6),
356
373
  };
357
- if ((await chain.getChainId()) === "36865") {
374
+ if ((await chain.getChainId()) === '36865') {
358
375
  partialOp.callGasLimit = BigInt(10e5);
359
376
  partialOp.verificationGasLimit = BigInt(10e5);
360
377
  }
361
378
  const isGroupOp = (await auth.getUserId()) !== userId;
362
379
  const operation = new data_1.Operation(partialOp, {
363
380
  chainId: await chain.getChainId(),
364
- opType: isGroupOp ? data_1.OperationType.GROUP_OPERATION : data_1.OperationType.SINGLE_OPERATION,
381
+ opType: isGroupOp
382
+ ? data_1.OperationType.GROUP_OPERATION
383
+ : data_1.OperationType.SINGLE_OPERATION,
365
384
  authType: isGroupOp ? data_1.AuthType.MULTI_SIG : data_1.AuthType.ECDSA,
366
385
  walletAddr: await this.getAddress(),
367
- proposer: await auth.getAddress()
386
+ proposer: await auth.getAddress(),
368
387
  });
369
388
  if (isGroupOp) {
370
389
  operation.groupId = (0, viem_1.pad)(userId, { size: 32 });
@@ -379,6 +398,10 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
379
398
  paymasterAndData = (await sponsor.getPaymasterAndData(txOptions)).toLowerCase();
380
399
  }
381
400
  }
401
+ else if (txOptions.gasSponsor.useCheckoutSponsor) {
402
+ const sponsor = new sponsors_1.CheckoutSponsor(txOptions);
403
+ paymasterAndData = (await sponsor.getPaymasterAndData(txOptions)).toLowerCase();
404
+ }
382
405
  else {
383
406
  const sponsor = new sponsors_1.GaslessSponsor(txOptions);
384
407
  paymasterAndData = (await sponsor.getPaymasterAndData(txOptions)).toLowerCase();
@@ -386,6 +409,9 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
386
409
  }
387
410
  operation.userOp.paymasterAndData = paymasterAndData;
388
411
  const estimatedOperation = await this.estimateOperation(auth, userId, operation, txOptions);
412
+ if (txOptions.bypassInit) {
413
+ estimatedOperation.userOp.initCode = '0x';
414
+ }
389
415
  // sign the userOp directly here as we do not have the opId yet
390
416
  estimatedOperation.userOp.signature = await auth.signOp(estimatedOperation, chain, (0, utils_1.isGroupOperation)(operation));
391
417
  if (txOptions.skipDBAction !== true) {
@@ -435,15 +461,15 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
435
461
  userId: operation.groupId,
436
462
  groupInfo: {
437
463
  threshold: groups[0].threshold,
438
- memberIds: groups[0].memberIds
439
- }
464
+ memberIds: groups[0].memberIds,
465
+ },
440
466
  });
441
467
  }
442
468
  }
443
469
  }
444
470
  const threshold = this.userInfo?.get(operation.groupId)?.groupInfo?.threshold ?? 1;
445
471
  if (threshold <= 1) {
446
- if (!operation.userOp.signature || operation.userOp.signature === "0x") {
472
+ if (!operation.userOp.signature || operation.userOp.signature === '0x') {
447
473
  operation.userOp.signature = await auth.signOp(operation, chain, (0, utils_1.isGroupOperation)(operation));
448
474
  }
449
475
  }
@@ -453,7 +479,9 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
453
479
  const storedOps = await (0, OperationApis_1.getOps)([operation.opId], chainId);
454
480
  let collectedSigCount;
455
481
  if ((0, utils_1.isSignatureMissing)(await auth.getUserId(), storedOps[0]?.signatures)) {
456
- collectedSigCount = storedOps[0]?.signatures?.length ? storedOps[0]?.signatures?.length + 1 : 1;
482
+ collectedSigCount = storedOps[0]?.signatures?.length
483
+ ? storedOps[0]?.signatures?.length + 1
484
+ : 1;
457
485
  if (collectedSigCount >= threshold) {
458
486
  operation.userOp.signature = await auth.signOp(operation, chain, (0, utils_1.isGroupOperation)(operation));
459
487
  }
@@ -462,11 +490,11 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
462
490
  collectedSigCount = storedOps[0]?.signatures?.length ?? 1;
463
491
  }
464
492
  if (collectedSigCount < threshold) {
465
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, "Signatures are not sufficient to execute the operation", { threshold, collectedSigCount, chainId }, "Only execute operation with enough signatures", "https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions");
493
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, 'Signatures are not sufficient to execute the operation', { threshold, collectedSigCount, chainId }, 'Only execute operation with enough signatures', 'https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions');
466
494
  }
467
495
  }
468
496
  else {
469
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, "Signatures are not sufficient to execute the operation", { threshold, chainId, skipDBAction: txOptions.skipDBAction }, "Only execute operation with enough signatures", "https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions");
497
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, 'Signatures are not sufficient to execute the operation', { threshold, chainId, skipDBAction: txOptions.skipDBAction }, 'Only execute operation with enough signatures', 'https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions');
470
498
  }
471
499
  }
472
500
  let receipt;
@@ -475,9 +503,9 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
475
503
  opId: operation.opId,
476
504
  chainId,
477
505
  executedBy: await auth.getAddress(),
478
- entryPointAddress: await chain.getAddress("entryPointAddress"),
506
+ entryPointAddress: await chain.getAddress('entryPointAddress'),
479
507
  signature: operation.userOp.signature,
480
- groupInfo: this.userInfo?.get(operation.groupId)?.groupInfo
508
+ groupInfo: this.userInfo?.get(operation.groupId)?.groupInfo,
481
509
  });
482
510
  }
483
511
  else {
@@ -485,9 +513,9 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
485
513
  opId: operation.opId,
486
514
  chainId,
487
515
  executedBy: await auth.getAddress(),
488
- entryPointAddress: await chain.getAddress("entryPointAddress"),
516
+ entryPointAddress: await chain.getAddress('entryPointAddress'),
489
517
  signature: operation.userOp.signature,
490
- userOp: operation.userOp
518
+ userOp: operation.userOp,
491
519
  });
492
520
  }
493
521
  receipt = await (0, OperationApis_1.getFullReceipt)(operation.opId, chainId, receipt.userOpHash);
@@ -496,12 +524,12 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
496
524
  if (txOptions?.gasSponsor?.sponsorAddress) {
497
525
  const paymasterType = (0, PaymasterUtils_1.getPaymasterType)(txOptions);
498
526
  (0, PaymasterApis_1.addTransaction)(await chain.getChainId(), Date.now(), receipt.txId, {
499
- action: "sponsor",
500
- amount: -1,
527
+ action: 'sponsor',
528
+ amount: -1, //Get amount from lazy processing
501
529
  from: txOptions.gasSponsor.sponsorAddress,
502
530
  to: await this.getAddress(),
503
- token: "eth",
504
- txid: receipt.txId
531
+ token: 'eth',
532
+ txid: receipt.txId,
505
533
  }, paymasterType, txOptions.gasSponsor.sponsorAddress);
506
534
  }
507
535
  }
@@ -529,15 +557,15 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
529
557
  userId: operation.groupId,
530
558
  groupInfo: {
531
559
  threshold: groups[0].threshold,
532
- memberIds: groups[0].memberIds
533
- }
560
+ memberIds: groups[0].memberIds,
561
+ },
534
562
  });
535
563
  }
536
564
  }
537
565
  }
538
566
  const threshold = this.userInfo?.get(operation.groupId)?.groupInfo?.threshold ?? 1;
539
567
  if (threshold <= 1) {
540
- if (!operation.userOp.signature || operation.userOp.signature === "0x") {
568
+ if (!operation.userOp.signature || operation.userOp.signature === '0x') {
541
569
  operation.userOp.signature = await auth.signOp(operation, chain, (0, utils_1.isGroupOperation)(operation));
542
570
  }
543
571
  }
@@ -547,7 +575,9 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
547
575
  const storedOps = await (0, OperationApis_1.getOps)([operation.opId], chainId);
548
576
  let collectedSigCount;
549
577
  if ((0, utils_1.isSignatureMissing)(await auth.getUserId(), storedOps[0]?.signatures)) {
550
- collectedSigCount = storedOps[0]?.signatures?.length ? storedOps[0]?.signatures?.length + 1 : 1;
578
+ collectedSigCount = storedOps[0]?.signatures?.length
579
+ ? storedOps[0]?.signatures?.length + 1
580
+ : 1;
551
581
  if (collectedSigCount >= threshold) {
552
582
  operation.userOp.signature = await auth.signOp(operation, chain, (0, utils_1.isGroupOperation)(operation));
553
583
  }
@@ -556,11 +586,11 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
556
586
  collectedSigCount = storedOps[0]?.signatures?.length ?? 1;
557
587
  }
558
588
  if (collectedSigCount < threshold) {
559
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, "Signatures are not sufficient to execute the operation", { threshold, collectedSigCount, chainId }, "Only execute operation with enough signatures", "https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions");
589
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, 'Signatures are not sufficient to execute the operation', { threshold, collectedSigCount, chainId }, 'Only execute operation with enough signatures', 'https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions');
560
590
  }
561
591
  }
562
592
  else {
563
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, "Signatures are not sufficient to execute the operation", { threshold, chainId, skipDBAction: txOptions.skipDBAction }, "Only execute operation with enough signatures", "https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions");
593
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InsufficientSignatures, 'Signatures are not sufficient to execute the operation', { threshold, chainId, skipDBAction: txOptions.skipDBAction }, 'Only execute operation with enough signatures', 'https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions');
564
594
  }
565
595
  }
566
596
  if ((0, utils_1.isGroupOperation)(operation)) {
@@ -568,9 +598,9 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
568
598
  opId: operation.opId,
569
599
  chainId,
570
600
  scheduledBy: await auth.getAddress(),
571
- entryPointAddress: await chain.getAddress("entryPointAddress"),
601
+ entryPointAddress: await chain.getAddress('entryPointAddress'),
572
602
  signature: operation.userOp.signature,
573
- groupInfo: this.userInfo?.get(operation.groupId)?.groupInfo
603
+ groupInfo: this.userInfo?.get(operation.groupId)?.groupInfo,
574
604
  });
575
605
  }
576
606
  else {
@@ -578,13 +608,13 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
578
608
  opId: operation.opId,
579
609
  chainId,
580
610
  scheduledBy: await auth.getAddress(),
581
- entryPointAddress: await chain.getAddress("entryPointAddress"),
611
+ entryPointAddress: await chain.getAddress('entryPointAddress'),
582
612
  signature: operation.userOp.signature,
583
- userOp: operation.userOp
613
+ userOp: operation.userOp,
584
614
  });
585
615
  }
586
616
  if (!operation.opId) {
587
- throw new errors_1.InternalFailureError(errors_1.ErrorCode.ServerFailure, "Operation id is required", operation, "Make sure you are scheduling a valid operation", "https://docs.fun.xyz/");
617
+ throw new errors_1.InternalFailureError(errors_1.ErrorCode.ServerFailure, 'Operation id is required', operation, 'Make sure you are scheduling a valid operation', 'https://docs.fun.xyz/');
588
618
  }
589
619
  return operation.opId;
590
620
  }
@@ -609,7 +639,11 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
609
639
  * @returns {Promise<Operation>} The prepared rejection operation.
610
640
  */
611
641
  async createRejectOperation(auth, groupId, operation, rejectionMessage, txOptions = globalThis.globalEnvOption) {
612
- const rejectOperation = await this.transfer(auth, groupId, { to: await this.getAddress(), amount: 0, token: "eth" }, { ...txOptions, skipDBAction: true, nonce: BigInt(operation.userOp.nonce) });
642
+ const rejectOperation = await this.transfer(auth, groupId, { to: await this.getAddress(), amount: 0, token: 'eth' }, {
643
+ ...txOptions,
644
+ skipDBAction: true,
645
+ nonce: BigInt(operation.userOp.nonce),
646
+ });
613
647
  if (rejectionMessage)
614
648
  rejectOperation.message = rejectionMessage;
615
649
  rejectOperation.relatedOpIds = [operation.opId];
@@ -632,7 +666,7 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
632
666
  const res = await chain.estimateOpGas(operation.userOp);
633
667
  operation.userOp = {
634
668
  ...operation.userOp,
635
- ...res
669
+ ...res,
636
670
  };
637
671
  const { maxFeePerGas, maxPriorityFeePerGas } = await chain.getFeeData();
638
672
  operation.userOp.maxFeePerGas = maxFeePerGas;
@@ -641,15 +675,15 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
641
675
  }
642
676
  async getThisInitCode(chain) {
643
677
  const owners = Array.from(this.userInfo.keys());
644
- const entryPointAddress = await chain.getAddress("entryPointAddress");
645
- const factoryAddress = await chain.getAddress("factoryAddress");
646
- const rbac = await chain.getAddress("rbacAddress");
647
- const userAuth = await chain.getAddress("userAuthAddress");
678
+ const entryPointAddress = await chain.getAddress('entryPointAddress');
679
+ const factoryAddress = await chain.getAddress('factoryAddress');
680
+ const rbac = await chain.getAddress('rbacAddress');
681
+ const userAuth = await chain.getAddress('userAuthAddress');
648
682
  const loginData = {
649
- salt: this.walletUniqueId
683
+ salt: this.walletUniqueId,
650
684
  };
651
685
  const rbacInitData = (0, data_1.toBytes32Arr)(owners);
652
- let userAuthInitData = "0x";
686
+ let userAuthInitData = '0x';
653
687
  const groupUsers = Array.from(this.userInfo.values()).filter((user) => user.groupInfo !== null && user.groupInfo !== undefined);
654
688
  if (groupUsers.length > 0) {
655
689
  userAuthInitData = (0, data_1.encodeUserAuthInitData)(groupUsers);
@@ -658,28 +692,28 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
658
692
  entryPointAddress,
659
693
  factoryAddress,
660
694
  implementationAddress: constants_1.AddressZero,
661
- loginData: loginData,
695
+ loginData,
662
696
  verificationAddresses: [rbac, userAuth],
663
- verificationData: [rbacInitData, userAuthInitData]
697
+ verificationData: [rbacInitData, userAuthInitData],
664
698
  };
665
699
  return this.getInitCode(initCodeParams);
666
700
  }
667
701
  getInitCode(input) {
668
702
  const encodedVerificationInitdata = (0, viem_1.encodeAbiParameters)([
669
703
  {
670
- type: "address[]",
671
- name: "verificationAddresses"
704
+ type: 'address[]',
705
+ name: 'verificationAddresses',
672
706
  },
673
707
  {
674
- type: "bytes[]",
675
- name: "verificationData"
676
- }
708
+ type: 'bytes[]',
709
+ name: 'verificationData',
710
+ },
677
711
  ], [input.verificationAddresses, input.verificationData]);
678
- const initializerCallData = common_1.WALLET_CONTRACT_INTERFACE.encodeData("initialize", [
679
- input.entryPointAddress,
680
- encodedVerificationInitdata
712
+ const initializerCallData = common_1.WALLET_CONTRACT_INTERFACE.encodeData('initialize', [input.entryPointAddress, encodedVerificationInitdata]);
713
+ const data = constants_1.FACTORY_CONTRACT_INTERFACE.encodeData('createAccount', [
714
+ initializerCallData,
715
+ (0, data_1.encodeLoginData)(input.loginData),
681
716
  ]);
682
- const data = constants_1.FACTORY_CONTRACT_INTERFACE.encodeData("createAccount", [initializerCallData, (0, data_1.encodeLoginData)(input.loginData)]);
683
717
  return (0, viem_1.concat)([input.factoryAddress, data]);
684
718
  }
685
719
  /**
@@ -693,19 +727,21 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
693
727
  params.value = 0n;
694
728
  }
695
729
  if (options.fee) {
696
- if (!options.fee.token && options.gasSponsor && options.gasSponsor.token) {
730
+ if (!options.fee.token &&
731
+ options.gasSponsor &&
732
+ options.gasSponsor.token) {
697
733
  options.fee.token = options.gasSponsor.token;
698
734
  }
699
735
  if (!options.fee.token) {
700
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, "EnvOption.fee.token or EnvOption.gasSponsor.token is required", { options }, "Provide EnvOption.fee.token or EnvOption.gasSponsor.token when calling wallet.createOperation", "https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions");
736
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, 'EnvOption.fee.token or EnvOption.gasSponsor.token is required', { options }, 'Provide EnvOption.fee.token or EnvOption.gasSponsor.token when calling wallet.createOperation', 'https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions');
701
737
  }
702
738
  if (!options.fee.recipient) {
703
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, "EnvOption.fee.recipient is required", { options }, "Provide EnvOption.fee.recipient when calling wallet.createOperation", "https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions");
739
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, 'EnvOption.fee.recipient is required', { options }, 'Provide EnvOption.fee.recipient when calling wallet.createOperation', 'https://docs.fun.xyz/how-to-guides/execute-transactions#execute-transactions');
704
740
  }
705
741
  const chain = await data_1.Chain.getChain({ chainIdentifier: options.chain });
706
742
  const token = new data_1.Token(options.fee.token, chain);
707
743
  if (options.fee.gasPercent && !token.isNative) {
708
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameterCombination, "GasPercent is only valid for native tokens", { options }, "Use native token as the fee token if you want to charge fee based on percentage", "https://docs.fun.xyz/how-to-guides/configure-environment/set-developer-fee");
744
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidParameterCombination, 'GasPercent is only valid for native tokens', { options }, 'Use native token as the fee token if you want to charge fee based on percentage', 'https://docs.fun.xyz/how-to-guides/configure-environment/set-developer-fee');
709
745
  }
710
746
  if (token.isNative) {
711
747
  options.fee.token = constants_1.AddressZero;
@@ -718,24 +754,32 @@ class FunWallet extends FirstClassActions_1.FirstClassActions {
718
754
  }
719
755
  else if (options.fee.gasPercent) {
720
756
  const feedata = [options.fee.token, options.fee.recipient, 1];
721
- const estimateGasCalldata = common_1.WALLET_CONTRACT_INTERFACE.encodeData("execFromEntryPointWithFee", [
722
- params.to,
723
- params.value,
724
- params.data,
725
- feedata
726
- ]);
757
+ const estimateGasCalldata = common_1.WALLET_CONTRACT_INTERFACE.encodeData('execFromEntryPointWithFee', [params.to, params.value, params.data, feedata]);
727
758
  const operation = await this.createOperation(auth, userId, { to: params.to, value: params.value, data: estimateGasCalldata }, { ...options, fee: undefined });
728
759
  const gasUsed = await operation.getMaxTxCost();
729
760
  options.fee.amount = Math.ceil((Number(gasUsed) * options.fee.gasPercent) / 100);
730
761
  }
731
762
  else {
732
- throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, "EnvOption.fee.amount or EnvOption.fee.gasPercent is required", { options }, "Provide either EnvOption.fee.amount or EnvOption.fee.gasPercent when calling wallet.createOperation", "https://docs.fun.xyz/how-to-guides/configure-environment/set-developer-fee");
763
+ throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, 'EnvOption.fee.amount or EnvOption.fee.gasPercent is required', { options }, 'Provide either EnvOption.fee.amount or EnvOption.fee.gasPercent when calling wallet.createOperation', 'https://docs.fun.xyz/how-to-guides/configure-environment/set-developer-fee');
733
764
  }
734
- const feedata = [options.fee.token, options.fee.recipient, options.fee.amount];
735
- return common_1.WALLET_CONTRACT_INTERFACE.encodeData("execFromEntryPointWithFee", [params.to, params.value, params.data, feedata]);
765
+ const feedata = [
766
+ options.fee.token,
767
+ options.fee.recipient,
768
+ options.fee.amount,
769
+ ];
770
+ return common_1.WALLET_CONTRACT_INTERFACE.encodeData('execFromEntryPointWithFee', [
771
+ params.to,
772
+ params.value,
773
+ params.data,
774
+ feedata,
775
+ ]);
736
776
  }
737
777
  else {
738
- return common_1.WALLET_CONTRACT_INTERFACE.encodeData("execFromEntryPoint", [params.to, params.value, params.data]);
778
+ return common_1.WALLET_CONTRACT_INTERFACE.encodeData('execFromEntryPoint', [
779
+ params.to,
780
+ params.value,
781
+ params.data,
782
+ ]);
739
783
  }
740
784
  }
741
785
  }