@funkit/core 0.8.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 (234) hide show
  1. package/README.md +110 -0
  2. package/dist/fetch-polyfill.d.ts +1 -0
  3. package/dist/fetch-polyfill.js +35 -0
  4. package/dist/fetch-polyfill.js.map +1 -0
  5. package/dist/index.d.ts +12 -0
  6. package/dist/index.js +29 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/src/abis/ApproveAndExec.json +1 -0
  9. package/dist/src/abis/ApproveAndSwap.json +1 -0
  10. package/dist/src/abis/ERC20.json +1 -0
  11. package/dist/src/abis/ERC721.json +1 -0
  12. package/dist/src/abis/EntryPoint.json +1 -0
  13. package/dist/src/abis/EstimationPaymaster.json +1 -0
  14. package/dist/src/abis/FeePercentOracle.json +1 -0
  15. package/dist/src/abis/FunWallet.json +1 -0
  16. package/dist/src/abis/FunWalletFactory.json +1 -0
  17. package/dist/src/abis/GaslessPaymaster.json +1 -0
  18. package/dist/src/abis/LidoWithdrawQueue.json +1 -0
  19. package/dist/src/abis/RoleBasedAccessControl.json +1 -0
  20. package/dist/src/abis/TestNFT.json +1 -0
  21. package/dist/src/abis/TokenPaymaster.json +1 -0
  22. package/dist/src/abis/TokenPriceOracle.json +1 -0
  23. package/dist/src/abis/UniswapV2Factory.json +1 -0
  24. package/dist/src/abis/UniswapV2Router02.json +1 -0
  25. package/dist/src/abis/UniswapV3LimitOrder.json +1 -0
  26. package/dist/src/abis/UserAuthentication.json +1 -0
  27. package/dist/src/abis/univ3factory.json +1 -0
  28. package/dist/src/abis/univ3quoter.json +1 -0
  29. package/dist/src/abis/univ3router.json +1 -0
  30. package/dist/src/actions/AccessControl.d.ts +9 -0
  31. package/dist/src/actions/AccessControl.js +88 -0
  32. package/dist/src/actions/AccessControl.js.map +1 -0
  33. package/dist/src/actions/BatchActions.d.ts +3 -0
  34. package/dist/src/actions/BatchActions.js +12 -0
  35. package/dist/src/actions/BatchActions.js.map +1 -0
  36. package/dist/src/actions/FirstClassActions.d.ts +161 -0
  37. package/dist/src/actions/FirstClassActions.js +347 -0
  38. package/dist/src/actions/FirstClassActions.js.map +1 -0
  39. package/dist/src/actions/Group.d.ts +6 -0
  40. package/dist/src/actions/Group.js +44 -0
  41. package/dist/src/actions/Group.js.map +1 -0
  42. package/dist/src/actions/LimitOrder.d.ts +4 -0
  43. package/dist/src/actions/LimitOrder.js +45 -0
  44. package/dist/src/actions/LimitOrder.js.map +1 -0
  45. package/dist/src/actions/Stake.d.ts +8 -0
  46. package/dist/src/actions/Stake.js +124 -0
  47. package/dist/src/actions/Stake.js.map +1 -0
  48. package/dist/src/actions/Swap.d.ts +9 -0
  49. package/dist/src/actions/Swap.js +169 -0
  50. package/dist/src/actions/Swap.js.map +1 -0
  51. package/dist/src/actions/Token.d.ts +12 -0
  52. package/dist/src/actions/Token.js +102 -0
  53. package/dist/src/actions/Token.js.map +1 -0
  54. package/dist/src/actions/index.d.ts +7 -0
  55. package/dist/src/actions/index.js +24 -0
  56. package/dist/src/actions/index.js.map +1 -0
  57. package/dist/src/actions/types.d.ts +117 -0
  58. package/dist/src/actions/types.js +11 -0
  59. package/dist/src/actions/types.js.map +1 -0
  60. package/dist/src/apis/AccessControlApis.d.ts +5 -0
  61. package/dist/src/apis/AccessControlApis.js +22 -0
  62. package/dist/src/apis/AccessControlApis.js.map +1 -0
  63. package/dist/src/apis/AssetApis.d.ts +79 -0
  64. package/dist/src/apis/AssetApis.js +100 -0
  65. package/dist/src/apis/AssetApis.js.map +1 -0
  66. package/dist/src/apis/ContractApis.d.ts +1 -0
  67. package/dist/src/apis/ContractApis.js +11 -0
  68. package/dist/src/apis/ContractApis.js.map +1 -0
  69. package/dist/src/apis/GroupApis.d.ts +8 -0
  70. package/dist/src/apis/GroupApis.js +45 -0
  71. package/dist/src/apis/GroupApis.js.map +1 -0
  72. package/dist/src/apis/InfoApis.d.ts +6 -0
  73. package/dist/src/apis/InfoApis.js +59 -0
  74. package/dist/src/apis/InfoApis.js.map +1 -0
  75. package/dist/src/apis/ListenerApis.d.ts +3 -0
  76. package/dist/src/apis/ListenerApis.js +36 -0
  77. package/dist/src/apis/ListenerApis.js.map +1 -0
  78. package/dist/src/apis/NFTApis.d.ts +22 -0
  79. package/dist/src/apis/NFTApis.js +34 -0
  80. package/dist/src/apis/NFTApis.js.map +1 -0
  81. package/dist/src/apis/OnOffRampApis.d.ts +2 -0
  82. package/dist/src/apis/OnOffRampApis.js +23 -0
  83. package/dist/src/apis/OnOffRampApis.js.map +1 -0
  84. package/dist/src/apis/OnOffRampUtils.d.ts +2 -0
  85. package/dist/src/apis/OnOffRampUtils.js +23 -0
  86. package/dist/src/apis/OnOffRampUtils.js.map +1 -0
  87. package/dist/src/apis/OperationApis.d.ts +14 -0
  88. package/dist/src/apis/OperationApis.js +77 -0
  89. package/dist/src/apis/OperationApis.js.map +1 -0
  90. package/dist/src/apis/PaymasterApis.d.ts +15 -0
  91. package/dist/src/apis/PaymasterApis.js +89 -0
  92. package/dist/src/apis/PaymasterApis.js.map +1 -0
  93. package/dist/src/apis/UserApis.d.ts +12 -0
  94. package/dist/src/apis/UserApis.js +77 -0
  95. package/dist/src/apis/UserApis.js.map +1 -0
  96. package/dist/src/apis/index.d.ts +10 -0
  97. package/dist/src/apis/index.js +27 -0
  98. package/dist/src/apis/index.js.map +1 -0
  99. package/dist/src/apis/types.d.ts +49 -0
  100. package/dist/src/apis/types.js +3 -0
  101. package/dist/src/apis/types.js.map +1 -0
  102. package/dist/src/auth/Auth.d.ts +81 -0
  103. package/dist/src/auth/Auth.js +317 -0
  104. package/dist/src/auth/Auth.js.map +1 -0
  105. package/dist/src/auth/SessionKeyAuth.d.ts +19 -0
  106. package/dist/src/auth/SessionKeyAuth.js +118 -0
  107. package/dist/src/auth/SessionKeyAuth.js.map +1 -0
  108. package/dist/src/auth/index.d.ts +2 -0
  109. package/dist/src/auth/index.js +19 -0
  110. package/dist/src/auth/index.js.map +1 -0
  111. package/dist/src/auth/types.d.ts +20 -0
  112. package/dist/src/auth/types.js +3 -0
  113. package/dist/src/auth/types.js.map +1 -0
  114. package/dist/src/common/constants.d.ts +1072 -0
  115. package/dist/src/common/constants.js +153 -0
  116. package/dist/src/common/constants.js.map +1 -0
  117. package/dist/src/common/index.d.ts +2 -0
  118. package/dist/src/common/index.js +19 -0
  119. package/dist/src/common/index.js.map +1 -0
  120. package/dist/src/common/types.d.ts +32 -0
  121. package/dist/src/common/types.js +3 -0
  122. package/dist/src/common/types.js.map +1 -0
  123. package/dist/src/config/Config.d.ts +3 -0
  124. package/dist/src/config/Config.js +46 -0
  125. package/dist/src/config/Config.js.map +1 -0
  126. package/dist/src/config/index.d.ts +2 -0
  127. package/dist/src/config/index.js +19 -0
  128. package/dist/src/config/index.js.map +1 -0
  129. package/dist/src/config/types.d.ts +21 -0
  130. package/dist/src/config/types.js +3 -0
  131. package/dist/src/config/types.js.map +1 -0
  132. package/dist/src/data/Chain.d.ts +29 -0
  133. package/dist/src/data/Chain.js +174 -0
  134. package/dist/src/data/Chain.js.map +1 -0
  135. package/dist/src/data/NFT.d.ts +24 -0
  136. package/dist/src/data/NFT.js +104 -0
  137. package/dist/src/data/NFT.js.map +1 -0
  138. package/dist/src/data/Operation.d.ts +33 -0
  139. package/dist/src/data/Operation.js +68 -0
  140. package/dist/src/data/Operation.js.map +1 -0
  141. package/dist/src/data/SolidityData.d.ts +8 -0
  142. package/dist/src/data/SolidityData.js +72 -0
  143. package/dist/src/data/SolidityData.js.map +1 -0
  144. package/dist/src/data/Token.d.ts +26 -0
  145. package/dist/src/data/Token.js +122 -0
  146. package/dist/src/data/Token.js.map +1 -0
  147. package/dist/src/data/index.d.ts +6 -0
  148. package/dist/src/data/index.js +23 -0
  149. package/dist/src/data/index.js.map +1 -0
  150. package/dist/src/data/types.d.ts +112 -0
  151. package/dist/src/data/types.js +25 -0
  152. package/dist/src/data/types.js.map +1 -0
  153. package/dist/src/errors/BaseError.d.ts +9 -0
  154. package/dist/src/errors/BaseError.js +23 -0
  155. package/dist/src/errors/BaseError.js.map +1 -0
  156. package/dist/src/errors/ClientError.d.ts +22 -0
  157. package/dist/src/errors/ClientError.js +75 -0
  158. package/dist/src/errors/ClientError.js.map +1 -0
  159. package/dist/src/errors/ServerError.d.ts +7 -0
  160. package/dist/src/errors/ServerError.js +18 -0
  161. package/dist/src/errors/ServerError.js.map +1 -0
  162. package/dist/src/errors/index.d.ts +4 -0
  163. package/dist/src/errors/index.js +21 -0
  164. package/dist/src/errors/index.js.map +1 -0
  165. package/dist/src/errors/types.d.ts +54 -0
  166. package/dist/src/errors/types.js +45 -0
  167. package/dist/src/errors/types.js.map +1 -0
  168. package/dist/src/sponsors/GaslessSponsor.d.ts +19 -0
  169. package/dist/src/sponsors/GaslessSponsor.js +91 -0
  170. package/dist/src/sponsors/GaslessSponsor.js.map +1 -0
  171. package/dist/src/sponsors/Sponsor.d.ts +31 -0
  172. package/dist/src/sponsors/Sponsor.js +94 -0
  173. package/dist/src/sponsors/Sponsor.js.map +1 -0
  174. package/dist/src/sponsors/TokenSponsor.d.ts +40 -0
  175. package/dist/src/sponsors/TokenSponsor.js +271 -0
  176. package/dist/src/sponsors/TokenSponsor.js.map +1 -0
  177. package/dist/src/sponsors/index.d.ts +3 -0
  178. package/dist/src/sponsors/index.js +20 -0
  179. package/dist/src/sponsors/index.js.map +1 -0
  180. package/dist/src/sponsors/types.d.ts +9 -0
  181. package/dist/src/sponsors/types.js +10 -0
  182. package/dist/src/sponsors/types.js.map +1 -0
  183. package/dist/src/utils/ApiUtils.d.ts +19 -0
  184. package/dist/src/utils/ApiUtils.js +97 -0
  185. package/dist/src/utils/ApiUtils.js.map +1 -0
  186. package/dist/src/utils/AuthUtils.d.ts +4 -0
  187. package/dist/src/utils/AuthUtils.js +54 -0
  188. package/dist/src/utils/AuthUtils.js.map +1 -0
  189. package/dist/src/utils/ChainUtils.d.ts +12 -0
  190. package/dist/src/utils/ChainUtils.js +89 -0
  191. package/dist/src/utils/ChainUtils.js.map +1 -0
  192. package/dist/src/utils/MerkleUtils.d.ts +18 -0
  193. package/dist/src/utils/MerkleUtils.js +96 -0
  194. package/dist/src/utils/MerkleUtils.js.map +1 -0
  195. package/dist/src/utils/PaymasterUtils.d.ts +3 -0
  196. package/dist/src/utils/PaymasterUtils.js +17 -0
  197. package/dist/src/utils/PaymasterUtils.js.map +1 -0
  198. package/dist/src/utils/SwapUtils.d.ts +35 -0
  199. package/dist/src/utils/SwapUtils.js +193 -0
  200. package/dist/src/utils/SwapUtils.js.map +1 -0
  201. package/dist/src/utils/TypeUtils.d.ts +1 -0
  202. package/dist/src/utils/TypeUtils.js +13 -0
  203. package/dist/src/utils/TypeUtils.js.map +1 -0
  204. package/dist/src/utils/UserOpUtils.d.ts +12 -0
  205. package/dist/src/utils/UserOpUtils.js +166 -0
  206. package/dist/src/utils/UserOpUtils.js.map +1 -0
  207. package/dist/src/utils/ViemUtils.d.ts +9 -0
  208. package/dist/src/utils/ViemUtils.js +30 -0
  209. package/dist/src/utils/ViemUtils.js.map +1 -0
  210. package/dist/src/utils/WalletUtils.d.ts +11 -0
  211. package/dist/src/utils/WalletUtils.js +61 -0
  212. package/dist/src/utils/WalletUtils.js.map +1 -0
  213. package/dist/src/utils/index.d.ts +7 -0
  214. package/dist/src/utils/index.js +24 -0
  215. package/dist/src/utils/index.js.map +1 -0
  216. package/dist/src/viem/ContractInterface.d.ts +19 -0
  217. package/dist/src/viem/ContractInterface.js +88 -0
  218. package/dist/src/viem/ContractInterface.js.map +1 -0
  219. package/dist/src/viem/Converter.d.ts +1770 -0
  220. package/dist/src/viem/Converter.js +50 -0
  221. package/dist/src/viem/Converter.js.map +1 -0
  222. package/dist/src/viem/index.d.ts +2 -0
  223. package/dist/src/viem/index.js +19 -0
  224. package/dist/src/viem/index.js.map +1 -0
  225. package/dist/src/wallet/FunWallet.d.ts +185 -0
  226. package/dist/src/wallet/FunWallet.js +720 -0
  227. package/dist/src/wallet/FunWallet.js.map +1 -0
  228. package/dist/src/wallet/index.d.ts +2 -0
  229. package/dist/src/wallet/index.js +19 -0
  230. package/dist/src/wallet/index.js.map +1 -0
  231. package/dist/src/wallet/types.d.ts +13 -0
  232. package/dist/src/wallet/types.js +3 -0
  233. package/dist/src/wallet/types.js.map +1 -0
  234. package/package.json +89 -0
@@ -0,0 +1,117 @@
1
+ import { Hex } from "viem";
2
+ import { SessionKeyAuth } from "../auth";
3
+ import { TransactionParams } from "../common";
4
+ export interface ApproveAndExecParams {
5
+ approve: ApproveERC20Params;
6
+ exec: TransactionParams;
7
+ }
8
+ export interface ERC721TransferParams {
9
+ tokenId: number;
10
+ collection: string;
11
+ from?: string;
12
+ to: string;
13
+ }
14
+ export interface TokenTransferParams {
15
+ token: string;
16
+ amount: number;
17
+ from?: string;
18
+ to: string;
19
+ }
20
+ export type TransferParams = TokenTransferParams | ERC721TransferParams;
21
+ export type ApproveParams = ApproveERC20Params | ApproveERC721Params;
22
+ export interface ApproveERC20Params {
23
+ spender: string;
24
+ amount: number;
25
+ token: string;
26
+ }
27
+ export interface ApproveERC721Params {
28
+ spender: string;
29
+ tokenId: number;
30
+ collection: string;
31
+ }
32
+ export type StakeParams = {
33
+ amount: number;
34
+ };
35
+ export type RequestUnstakeParams = {
36
+ amounts: number[];
37
+ recipient: string;
38
+ };
39
+ export type FinishUnstakeParams = {
40
+ recipient: string;
41
+ walletAddress: string;
42
+ };
43
+ export declare enum UniSwapPoolFeeOptions {
44
+ lowest = "lowest",
45
+ low = "low",
46
+ medium = "medium",
47
+ high = "high"
48
+ }
49
+ export type SwapParams = {
50
+ tokenIn: string;
51
+ tokenOut: string;
52
+ inAmount: number;
53
+ slippage?: number;
54
+ recipient?: string;
55
+ poolFee?: UniSwapPoolFeeOptions;
56
+ };
57
+ export type LimitOrderParam = {
58
+ tokenIn: string;
59
+ tokenOut: string;
60
+ tokenInAmount: number;
61
+ tokenOutAmount: number;
62
+ poolFee?: UniSwapPoolFeeOptions;
63
+ };
64
+ export type SessionKeyParams = {
65
+ targetWhitelist: string[];
66
+ actionWhitelist: ActionWhitelistObject[];
67
+ feeTokenWhitelist?: string[];
68
+ feeRecipientWhitelist?: string[];
69
+ deadline: number;
70
+ actionValueLimit?: bigint;
71
+ feeValueLimit?: bigint;
72
+ user: SessionKeyAuth;
73
+ };
74
+ export type ActionWhitelistObject = {
75
+ abi: any;
76
+ functionWhitelist: string[];
77
+ };
78
+ export type RuleStruct = {
79
+ deadline: bigint;
80
+ actionValueLimit: bigint;
81
+ targetSelectorMerkleRootHash: Hex;
82
+ feeValueLimit: bigint;
83
+ feeRecipientTokenMerkleRootHash: Hex;
84
+ };
85
+ export type Group = {
86
+ userIds: Hex[];
87
+ threshold: number;
88
+ };
89
+ export type AddOwnerParams = {
90
+ ownerId: Hex;
91
+ };
92
+ export type RemoveOwnerParams = {
93
+ ownerId: Hex;
94
+ };
95
+ export type CreateGroupParams = {
96
+ groupId: Hex;
97
+ group: Group;
98
+ };
99
+ export type AddUserToGroupParams = {
100
+ groupId: Hex;
101
+ userId: Hex;
102
+ };
103
+ export type RemoveUserFromGroupParams = {
104
+ groupId: Hex;
105
+ userId: Hex;
106
+ };
107
+ export type UpdateThresholdOfGroupParams = {
108
+ groupId: Hex;
109
+ threshold: number;
110
+ };
111
+ export type UpdateGroupParams = {
112
+ groupId: Hex;
113
+ group: Group;
114
+ };
115
+ export type RemoveGroupParams = {
116
+ groupId: Hex;
117
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UniSwapPoolFeeOptions = void 0;
4
+ var UniSwapPoolFeeOptions;
5
+ (function (UniSwapPoolFeeOptions) {
6
+ UniSwapPoolFeeOptions["lowest"] = "lowest";
7
+ UniSwapPoolFeeOptions["low"] = "low";
8
+ UniSwapPoolFeeOptions["medium"] = "medium";
9
+ UniSwapPoolFeeOptions["high"] = "high";
10
+ })(UniSwapPoolFeeOptions || (exports.UniSwapPoolFeeOptions = UniSwapPoolFeeOptions = {}));
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/types.ts"],"names":[],"mappings":";;;AAsDA,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,0CAAiB,CAAA;IACjB,oCAAW,CAAA;IACX,0CAAiB,CAAA;IACjB,sCAAa,CAAA;AACjB,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC"}
@@ -0,0 +1,5 @@
1
+ import { Address, Hex } from "viem";
2
+ export declare function initializeWalletAccess(walletAddr: Address, creatorAddr: Address): Promise<void>;
3
+ export declare function checkWalletAccessInitialization(walletAddr: Address): Promise<boolean>;
4
+ export declare function addAccessToWallet(walletAddr: Address, nonce: number, signature: Hex): Promise<void>;
5
+ export declare function addAccessToUser(authId: string, nonce: number, signature: Hex): Promise<void>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addAccessToUser = exports.addAccessToWallet = exports.checkWalletAccessInitialization = exports.initializeWalletAccess = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const ApiUtils_1 = require("../utils/ApiUtils");
6
+ async function initializeWalletAccess(walletAddr, creatorAddr) {
7
+ await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "access/wallet", { walletAddr, creatorAddr });
8
+ }
9
+ exports.initializeWalletAccess = initializeWalletAccess;
10
+ async function checkWalletAccessInitialization(walletAddr) {
11
+ return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `access/wallet/${walletAddr}`)).initialized;
12
+ }
13
+ exports.checkWalletAccessInitialization = checkWalletAccessInitialization;
14
+ async function addAccessToWallet(walletAddr, nonce, signature) {
15
+ await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, `access/wallet/${walletAddr}`, { nonce, signature });
16
+ }
17
+ exports.addAccessToWallet = addAccessToWallet;
18
+ async function addAccessToUser(authId, nonce, signature) {
19
+ await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, `access/user/${authId}`, { nonce, signature });
20
+ }
21
+ exports.addAccessToUser = addAccessToUser;
22
+ //# sourceMappingURL=AccessControlApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccessControlApis.js","sourceRoot":"","sources":["../../../src/apis/AccessControlApis.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAC7C,gDAAmE;AAE5D,KAAK,UAAU,sBAAsB,CAAC,UAAmB,EAAE,WAAoB;IAClF,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAA;AAChF,CAAC;AAFD,wDAEC;AAEM,KAAK,UAAU,+BAA+B,CAAC,UAAmB;IACrE,OAAO,CAAC,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,iBAAiB,UAAU,EAAE,CAAC,CAAC,CAAC,WAAW,CAAA;AACrF,CAAC;AAFD,0EAEC;AAEM,KAAK,UAAU,iBAAiB,CAAC,UAAmB,EAAE,KAAa,EAAE,SAAc;IACtF,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,iBAAiB,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;AACvF,CAAC;AAFD,8CAEC;AAEM,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,KAAa,EAAE,SAAc;IAC/E,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,eAAe,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;AACjF,CAAC;AAFD,0CAEC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Get all tokens for a specific chain
3
+ * @param {string} chainId https://chainlist.org/
4
+ * @param {string} holderAddr
5
+ * @param {string} onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)
6
+ * @returns JSON
7
+ * {
8
+ * "0xTokenAddress": {
9
+ * "tokenBalance": "0x00001",
10
+ * "symbol": "USDC",
11
+ * "decimals": 6,
12
+ * "logo": "https://static.alchemyapi.io/images/assets/3408.png",
13
+ * "price": 1.0001,
14
+ * }
15
+ * }
16
+ */
17
+ export declare function getTokens(chainId: string, holderAddr: string, onlyVerifiedTokens: boolean): Promise<any>;
18
+ /**
19
+ * Calls the fun api server to get all the NFTs owned by the holder
20
+ * @param {string} chainId From https://chainlist.org/
21
+ * @param {string} holderAddr Address of holder
22
+ * @returns array
23
+ * [
24
+ * {
25
+ * "address": "string",
26
+ * "token_id": "string",
27
+ * "floor_price": "string",
28
+ * }
29
+ * ]
30
+ */
31
+ export declare function getNFTs(chainId: string, holderAddr: string): Promise<any>;
32
+ /**
33
+ * Calls the fun api server to get all the NFTs owned by the holder
34
+ * @param {string} holderAddr Address of holder
35
+ * @returns array
36
+ * {
37
+ * "1" : [{
38
+ * "address": "string",
39
+ * "token_id": "string",
40
+ * "floor_price": "string",
41
+ * }],
42
+ * }
43
+ */
44
+ export declare function getAllNFTs(holderAddr: string): Promise<any>;
45
+ /**
46
+ * Get all tokens for a specific chain
47
+ * @param {string} holderAddr
48
+ * @param {string} onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)
49
+ * @returns JSON
50
+ * {
51
+ * 1: {
52
+ * "0xTokenAddress": {
53
+ * "tokenBalance": "0x00001",
54
+ * "symbol": "USDC",
55
+ * "decimals": 6,
56
+ * "logo": "https://static.alchemyapi.io/images/assets/3408.png",
57
+ * "price": 1.0001,
58
+ * }
59
+ * }
60
+ * }
61
+ */
62
+ export declare function getAllTokens(holderAddr: string, onlyVerifiedTokens: boolean): Promise<any>;
63
+ /**
64
+ * Get all lido withdrawal request ids for all chains
65
+ * @param {string} chainId https://chainlist.org/ ie "1" for ethereum
66
+ * @param {string} holderAddr Address of holder
67
+ * @returns [readyToWithdrawRequestIds, notReadyToWithdrawRequestIds]
68
+ * [
69
+ * [
70
+ * 123,
71
+ * 124,
72
+ * ],
73
+ * [
74
+ * 412
75
+ * 413
76
+ * ]
77
+ * ]
78
+ */
79
+ export declare function getLidoWithdrawals(chainId: string, holderAddr: string): Promise<any>;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLidoWithdrawals = exports.getAllTokens = exports.getAllNFTs = exports.getNFTs = exports.getTokens = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const ApiUtils_1 = require("../utils/ApiUtils");
6
+ /**
7
+ * Get all tokens for a specific chain
8
+ * @param {string} chainId https://chainlist.org/
9
+ * @param {string} holderAddr
10
+ * @param {string} onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)
11
+ * @returns JSON
12
+ * {
13
+ * "0xTokenAddress": {
14
+ * "tokenBalance": "0x00001",
15
+ * "symbol": "USDC",
16
+ * "decimals": 6,
17
+ * "logo": "https://static.alchemyapi.io/images/assets/3408.png",
18
+ * "price": 1.0001,
19
+ * }
20
+ * }
21
+ */
22
+ async function getTokens(chainId, holderAddr, onlyVerifiedTokens) {
23
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `assets/erc20s/${holderAddr}/${chainId}?onlyVerifiedTokens=${onlyVerifiedTokens}`);
24
+ }
25
+ exports.getTokens = getTokens;
26
+ /**
27
+ * Calls the fun api server to get all the NFTs owned by the holder
28
+ * @param {string} chainId From https://chainlist.org/
29
+ * @param {string} holderAddr Address of holder
30
+ * @returns array
31
+ * [
32
+ * {
33
+ * "address": "string",
34
+ * "token_id": "string",
35
+ * "floor_price": "string",
36
+ * }
37
+ * ]
38
+ */
39
+ async function getNFTs(chainId, holderAddr) {
40
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `assets/nfts/${holderAddr}/${chainId}`);
41
+ }
42
+ exports.getNFTs = getNFTs;
43
+ /**
44
+ * Calls the fun api server to get all the NFTs owned by the holder
45
+ * @param {string} holderAddr Address of holder
46
+ * @returns array
47
+ * {
48
+ * "1" : [{
49
+ * "address": "string",
50
+ * "token_id": "string",
51
+ * "floor_price": "string",
52
+ * }],
53
+ * }
54
+ */
55
+ async function getAllNFTs(holderAddr) {
56
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `assets/nfts/${holderAddr}`);
57
+ }
58
+ exports.getAllNFTs = getAllNFTs;
59
+ /**
60
+ * Get all tokens for a specific chain
61
+ * @param {string} holderAddr
62
+ * @param {string} onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)
63
+ * @returns JSON
64
+ * {
65
+ * 1: {
66
+ * "0xTokenAddress": {
67
+ * "tokenBalance": "0x00001",
68
+ * "symbol": "USDC",
69
+ * "decimals": 6,
70
+ * "logo": "https://static.alchemyapi.io/images/assets/3408.png",
71
+ * "price": 1.0001,
72
+ * }
73
+ * }
74
+ * }
75
+ */
76
+ async function getAllTokens(holderAddr, onlyVerifiedTokens) {
77
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `assets/erc20s/${holderAddr}?onlyVerifiedTokens=${onlyVerifiedTokens}`);
78
+ }
79
+ exports.getAllTokens = getAllTokens;
80
+ /**
81
+ * Get all lido withdrawal request ids for all chains
82
+ * @param {string} chainId https://chainlist.org/ ie "1" for ethereum
83
+ * @param {string} holderAddr Address of holder
84
+ * @returns [readyToWithdrawRequestIds, notReadyToWithdrawRequestIds]
85
+ * [
86
+ * [
87
+ * 123,
88
+ * 124,
89
+ * ],
90
+ * [
91
+ * 412
92
+ * 413
93
+ * ]
94
+ * ]
95
+ */
96
+ async function getLidoWithdrawals(chainId, holderAddr) {
97
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `assets/lido-withdrawals/${holderAddr}/${chainId}`);
98
+ }
99
+ exports.getLidoWithdrawals = getLidoWithdrawals;
100
+ //# sourceMappingURL=AssetApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetApis.js","sourceRoot":"","sources":["../../../src/apis/AssetApis.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,gDAAkD;AAElD;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,SAAS,CAAC,OAAe,EAAE,UAAkB,EAAE,kBAA2B;IAC5F,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,iBAAiB,UAAU,IAAI,OAAO,uBAAuB,kBAAkB,EAAE,CAAC,CAAA;AAC3H,CAAC;AAFD,8BAEC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,OAAO,CAAC,OAAe,EAAE,UAAkB;IAC7D,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,eAAe,UAAU,IAAI,OAAO,EAAE,CAAC,CAAA;AAChF,CAAC;AAFD,0BAEC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,UAAU,CAAC,UAAkB;IAC/C,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,eAAe,UAAU,EAAE,CAAC,CAAA;AACrE,CAAC;AAFD,gCAEC;AAED;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,YAAY,CAAC,UAAkB,EAAE,kBAA2B;IAC9E,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,iBAAiB,UAAU,uBAAuB,kBAAkB,EAAE,CAAC,CAAA;AAChH,CAAC;AAFD,oCAEC;AAED;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,kBAAkB,CAAC,OAAe,EAAE,UAAkB;IACxE,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,2BAA2B,UAAU,IAAI,OAAO,EAAE,CAAC,CAAA;AAC5F,CAAC;AAFD,gDAEC"}
@@ -0,0 +1 @@
1
+ export declare function getContractAbi(contractName: string, mode?: string): Promise<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getContractAbi = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const ApiUtils_1 = require("../utils/ApiUtils");
6
+ async function getContractAbi(contractName, mode = "abi") {
7
+ const { name, abi, addresses } = await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `contract/${contractName}?mode=${mode}`);
8
+ return { name, abi, addresses };
9
+ }
10
+ exports.getContractAbi = getContractAbi;
11
+ //# sourceMappingURL=ContractApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContractApis.js","sourceRoot":"","sources":["../../../src/apis/ContractApis.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,gDAAkD;AAE3C,KAAK,UAAU,cAAc,CAAC,YAAoB,EAAE,IAAI,GAAG,KAAK;IACnE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,YAAY,YAAY,SAAS,IAAI,EAAE,CAAC,CAAA;IACvG,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,CAAA;AACnC,CAAC;AAHD,wCAGC"}
@@ -0,0 +1,8 @@
1
+ import { Address, Hex } from "viem";
2
+ import { GroupMetadata, UpdateGroupMetadata } from "./types";
3
+ export declare function createGroup(groupId: Hex, chainId: string, threshold: number, walletAddr: Address, memberIds: Hex[]): Promise<void>;
4
+ export declare function getGroups(groupIds: Hex[], chainId: string): Promise<GroupMetadata[]>;
5
+ export declare function getGroupsByWallet(walletAddr: Address, chainId: string): Promise<GroupMetadata[]>;
6
+ export declare function updateGroupThreshold(groupId: Hex, chainId: string, threshold: number): Promise<void>;
7
+ export declare function updateGroup(groupId: Hex, chainId: string, updateGroupMetadata: UpdateGroupMetadata): Promise<void>;
8
+ export declare function deleteGroup(groupId: Hex, chainId: string): Promise<void>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteGroup = exports.updateGroup = exports.updateGroupThreshold = exports.getGroupsByWallet = exports.getGroups = exports.createGroup = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const ApiUtils_1 = require("../utils/ApiUtils");
6
+ async function createGroup(groupId, chainId, threshold, walletAddr, memberIds) {
7
+ memberIds = memberIds.sort((a, b) => (a > b ? -1 : 1));
8
+ await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "group", {
9
+ groupId,
10
+ chainId,
11
+ threshold,
12
+ walletAddr,
13
+ memberIds
14
+ });
15
+ }
16
+ exports.createGroup = createGroup;
17
+ async function getGroups(groupIds, chainId) {
18
+ return (await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "group/get-groups", {
19
+ groupIds,
20
+ chainId
21
+ })).groups;
22
+ }
23
+ exports.getGroups = getGroups;
24
+ async function getGroupsByWallet(walletAddr, chainId) {
25
+ return (await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, `group/wallet/${walletAddr}/chain/${chainId}`, {
26
+ walletAddr,
27
+ chainId
28
+ })).groups;
29
+ }
30
+ exports.getGroupsByWallet = getGroupsByWallet;
31
+ async function updateGroupThreshold(groupId, chainId, threshold) {
32
+ await (0, ApiUtils_1.sendPutRequest)(constants_1.API_URL, `group/${groupId}/chain/${chainId}/threshold`, {
33
+ threshold
34
+ });
35
+ }
36
+ exports.updateGroupThreshold = updateGroupThreshold;
37
+ async function updateGroup(groupId, chainId, updateGroupMetadata) {
38
+ await (0, ApiUtils_1.sendPutRequest)(constants_1.API_URL, `group/${groupId}/chain/${chainId}`, updateGroupMetadata);
39
+ }
40
+ exports.updateGroup = updateGroup;
41
+ async function deleteGroup(groupId, chainId) {
42
+ await (0, ApiUtils_1.sendDeleteRequest)(constants_1.API_URL, `group/${groupId}/chain/${chainId}`);
43
+ }
44
+ exports.deleteGroup = deleteGroup;
45
+ //# sourceMappingURL=GroupApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupApis.js","sourceRoot":"","sources":["../../../src/apis/GroupApis.ts"],"names":[],"mappings":";;;AAEA,mDAA6C;AAC7C,gDAAsF;AAE/E,KAAK,UAAU,WAAW,CAAC,OAAY,EAAE,OAAe,EAAE,SAAiB,EAAE,UAAmB,EAAE,SAAgB;IACrH,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACtD,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,OAAO,EAAE;QACpC,OAAO;QACP,OAAO;QACP,SAAS;QACT,UAAU;QACV,SAAS;KACZ,CAAC,CAAA;AACN,CAAC;AATD,kCASC;AAEM,KAAK,UAAU,SAAS,CAAC,QAAe,EAAE,OAAe;IAC5D,OAAO,CACH,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,kBAAkB,EAAE;QAC/C,QAAQ;QACR,OAAO;KACV,CAAC,CACL,CAAC,MAAM,CAAA;AACZ,CAAC;AAPD,8BAOC;AAEM,KAAK,UAAU,iBAAiB,CAAC,UAAmB,EAAE,OAAe;IACxE,OAAO,CACH,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,gBAAgB,UAAU,UAAU,OAAO,EAAE,EAAE;QAC1E,UAAU;QACV,OAAO;KACV,CAAC,CACL,CAAC,MAAM,CAAA;AACZ,CAAC;AAPD,8CAOC;AAEM,KAAK,UAAU,oBAAoB,CAAC,OAAY,EAAE,OAAe,EAAE,SAAiB;IACvF,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,SAAS,OAAO,UAAU,OAAO,YAAY,EAAE;QACzE,SAAS;KACZ,CAAC,CAAA;AACN,CAAC;AAJD,oDAIC;AAEM,KAAK,UAAU,WAAW,CAAC,OAAY,EAAE,OAAe,EAAE,mBAAwC;IACrG,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,SAAS,OAAO,UAAU,OAAO,EAAE,EAAE,mBAAmB,CAAC,CAAA;AAC3F,CAAC;AAFD,kCAEC;AAEM,KAAK,UAAU,WAAW,CAAC,OAAY,EAAE,OAAe;IAC3D,MAAM,IAAA,4BAAiB,EAAC,mBAAO,EAAE,SAAS,OAAO,UAAU,OAAO,EAAE,CAAC,CAAA;AACzE,CAAC;AAFD,kCAEC"}
@@ -0,0 +1,6 @@
1
+ import { Address } from "viem";
2
+ export declare function getTokenInfo(symbol: string, chainId: string): Promise<Address>;
3
+ export declare function getChainFromId(chainId: string): Promise<any>;
4
+ export declare function getChainFromName(name: string): Promise<any>;
5
+ export declare function getModuleInfo(moduleName: string, chainId: string): Promise<any>;
6
+ export declare function getPaymasterAddress(chainId: string): Promise<any>;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPaymasterAddress = exports.getModuleInfo = exports.getChainFromName = exports.getChainFromId = exports.getTokenInfo = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const errors_1 = require("../errors");
6
+ const ApiUtils_1 = require("../utils/ApiUtils");
7
+ async function getTokenInfo(symbol, chainId) {
8
+ symbol = symbol.toLowerCase();
9
+ const body = {
10
+ symbol,
11
+ chain: chainId
12
+ };
13
+ if (symbol === "weth" && chainId !== "137" && Object.keys(constants_1.BASE_WRAP_TOKEN_ADDR).includes(chainId)) {
14
+ return constants_1.BASE_WRAP_TOKEN_ADDR[chainId][symbol];
15
+ }
16
+ else if (symbol === "wmatic" && chainId === "137") {
17
+ return constants_1.BASE_WRAP_TOKEN_ADDR[chainId][symbol];
18
+ }
19
+ const tokenInfo = await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `asset/erc20/${body.chain}/${body.symbol}`);
20
+ if (tokenInfo.address) {
21
+ return tokenInfo.address;
22
+ }
23
+ throw new errors_1.ResourceNotFoundError(errors_1.ErrorCode.TokenNotFound, "token symbol does not exist on provided chain", { symbol, chainId }, "Provide correct symbol and chainId.", "https://docs.fun.xyz");
24
+ }
25
+ exports.getTokenInfo = getTokenInfo;
26
+ async function getChainFromId(chainId) {
27
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `chain-info/${chainId}`).then((r) => {
28
+ if (!r) {
29
+ throw new Error(JSON.stringify(r));
30
+ }
31
+ return r;
32
+ });
33
+ }
34
+ exports.getChainFromId = getChainFromId;
35
+ async function getChainFromName(name) {
36
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `chain-info?name=${name}`).then((r) => {
37
+ if (!r) {
38
+ throw new Error(JSON.stringify(r));
39
+ }
40
+ return r;
41
+ });
42
+ }
43
+ exports.getChainFromName = getChainFromName;
44
+ async function getModuleInfo(moduleName, chainId) {
45
+ const body = {
46
+ module: moduleName,
47
+ chain: chainId
48
+ };
49
+ return await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "get-module-info", body).then((r) => {
50
+ return r.data;
51
+ });
52
+ }
53
+ exports.getModuleInfo = getModuleInfo;
54
+ async function getPaymasterAddress(chainId) {
55
+ const { moduleAddresses: { paymaster: { paymasterAddress } } } = await getChainFromId(chainId);
56
+ return paymasterAddress;
57
+ }
58
+ exports.getPaymasterAddress = getPaymasterAddress;
59
+ //# sourceMappingURL=InfoApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoApis.js","sourceRoot":"","sources":["../../../src/apis/InfoApis.ts"],"names":[],"mappings":";;;AACA,mDAAmE;AACnE,sCAA4D;AAC5D,gDAAmE;AAE5D,KAAK,UAAU,YAAY,CAAC,MAAc,EAAE,OAAe;IAC9D,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAC7B,MAAM,IAAI,GAAG;QACT,MAAM;QACN,KAAK,EAAE,OAAO;KACjB,CAAA;IACD,IAAI,MAAM,KAAK,MAAM,IAAI,OAAO,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,gCAAoB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC/F,OAAQ,gCAA4B,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;KACxD;SAAM,IAAI,MAAM,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,EAAE;QACjD,OAAQ,gCAA4B,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;KACxD;IAED,MAAM,SAAS,GAAG,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,eAAe,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IAE3F,IAAI,SAAS,CAAC,OAAO,EAAE;QACnB,OAAO,SAAS,CAAC,OAAO,CAAA;KAC3B;IACD,MAAM,IAAI,8BAAqB,CAC3B,kBAAS,CAAC,aAAa,EACvB,+CAA+C,EAC/C,EAAE,MAAM,EAAE,OAAO,EAAE,EACnB,qCAAqC,EACrC,sBAAsB,CACzB,CAAA;AACL,CAAC;AAxBD,oCAwBC;AAEM,KAAK,UAAU,cAAc,CAAC,OAAe;IAChD,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,cAAc,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACrE,IAAI,CAAC,CAAC,EAAE;YACJ,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;SACrC;QACD,OAAO,CAAC,CAAA;IACZ,CAAC,CAAC,CAAA;AACN,CAAC;AAPD,wCAOC;AAEM,KAAK,UAAU,gBAAgB,CAAC,IAAY;IAC/C,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,mBAAmB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACvE,IAAI,CAAC,CAAC,EAAE;YACJ,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;SACrC;QACD,OAAO,CAAC,CAAA;IACZ,CAAC,CAAC,CAAA;AACN,CAAC;AAPD,4CAOC;AAEM,KAAK,UAAU,aAAa,CAAC,UAAkB,EAAE,OAAe;IACnE,MAAM,IAAI,GAAG;QACT,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,OAAO;KACjB,CAAA;IAED,OAAO,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACtE,OAAO,CAAC,CAAC,IAAI,CAAA;IACjB,CAAC,CAAC,CAAA;AACN,CAAC;AATD,sCASC;AAEM,KAAK,UAAU,mBAAmB,CAAC,OAAe;IACrD,MAAM,EACF,eAAe,EAAE,EACb,SAAS,EAAE,EAAE,gBAAgB,EAAE,EAClC,EACJ,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAA;IAEjC,OAAO,gBAAgB,CAAA;AAC3B,CAAC;AARD,kDAQC"}
@@ -0,0 +1,3 @@
1
+ import { Address } from "viem";
2
+ export declare function createListener(walletAddresses: Address[], chains: string[], webhookUrl: string): Promise<void>;
3
+ export declare function deleteListener(walletAddress: Address, chain: string): Promise<void>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteListener = exports.createListener = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const errors_1 = require("../errors");
6
+ const ApiUtils_1 = require("../utils/ApiUtils");
7
+ async function createListener(walletAddresses, chains, webhookUrl) {
8
+ const body = {
9
+ walletAddresses,
10
+ chains,
11
+ webhookUrl
12
+ };
13
+ const result = await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "listeners/", body).then((r) => {
14
+ return r;
15
+ });
16
+ if (!result) {
17
+ throw new errors_1.InternalFailureError(errors_1.ErrorCode.UnknownServerError, "Listener call failed.", { walletAddresses, chains, webhookUrl }, "This is an internal error, please contact support.", "https://docs.fun.xyz");
18
+ }
19
+ return result;
20
+ }
21
+ exports.createListener = createListener;
22
+ async function deleteListener(walletAddress, chain) {
23
+ const body = {
24
+ walletAddress,
25
+ chain
26
+ };
27
+ const result = await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "listeners/delete", body).then((r) => {
28
+ return r;
29
+ });
30
+ if (!result) {
31
+ throw new errors_1.InternalFailureError(errors_1.ErrorCode.UnknownServerError, "Listener call failed.", { walletAddress, chain }, "This is an internal error, please contact support.", "https://docs.fun.xyz");
32
+ }
33
+ return result;
34
+ }
35
+ exports.deleteListener = deleteListener;
36
+ //# sourceMappingURL=ListenerApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListenerApis.js","sourceRoot":"","sources":["../../../src/apis/ListenerApis.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAC7C,sCAA2D;AAC3D,gDAAmD;AAE5C,KAAK,UAAU,cAAc,CAAC,eAA0B,EAAE,MAAgB,EAAE,UAAkB;IACjG,MAAM,IAAI,GAAG;QACT,eAAe;QACf,MAAM;QACN,UAAU;KACb,CAAA;IACD,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACzE,OAAO,CAAC,CAAA;IACZ,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,MAAM,EAAE;QACT,MAAM,IAAI,6BAAoB,CAC1B,kBAAS,CAAC,kBAAkB,EAC5B,uBAAuB,EACvB,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,EACvC,oDAAoD,EACpD,sBAAsB,CACzB,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;AACjB,CAAC;AAnBD,wCAmBC;AAEM,KAAK,UAAU,cAAc,CAAC,aAAsB,EAAE,KAAa;IACtE,MAAM,IAAI,GAAG;QACT,aAAa;QACb,KAAK;KACR,CAAA;IACD,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/E,OAAO,CAAC,CAAA;IACZ,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,MAAM,EAAE;QACT,MAAM,IAAI,6BAAoB,CAC1B,kBAAS,CAAC,kBAAkB,EAC5B,uBAAuB,EACvB,EAAE,aAAa,EAAE,KAAK,EAAE,EACxB,oDAAoD,EACpD,sBAAsB,CACzB,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;AACjB,CAAC;AAlBD,wCAkBC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Get the name of an NFT collection
3
+ * @param {string} chainId https://chainlist.org/
4
+ * @param {string} nftAddress Address of NFT
5
+ * @returns JSON
6
+ * {
7
+ * "success": true,
8
+ * "name": "Anatomy Science Ape Club"
9
+ * }
10
+ */
11
+ export declare function getNftName(chainId: string, nftAddress: string): Promise<any>;
12
+ /**
13
+ * Get the address and chainId of an NFT collection
14
+ * @param {string} name Name of NFT
15
+ * @returns JSON
16
+ * {
17
+ * "success": true,
18
+ * "address": "0x96fc56721d2b79485692350014875b3b67cb00eb",
19
+ * "chain": "1"
20
+ * }
21
+ */
22
+ export declare function getNftAddress(name: string): Promise<any>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNftAddress = exports.getNftName = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const ApiUtils_1 = require("../utils/ApiUtils");
6
+ /**
7
+ * Get the name of an NFT collection
8
+ * @param {string} chainId https://chainlist.org/
9
+ * @param {string} nftAddress Address of NFT
10
+ * @returns JSON
11
+ * {
12
+ * "success": true,
13
+ * "name": "Anatomy Science Ape Club"
14
+ * }
15
+ */
16
+ async function getNftName(chainId, nftAddress) {
17
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `asset/nft/${chainId}/${nftAddress}`);
18
+ }
19
+ exports.getNftName = getNftName;
20
+ /**
21
+ * Get the address and chainId of an NFT collection
22
+ * @param {string} name Name of NFT
23
+ * @returns JSON
24
+ * {
25
+ * "success": true,
26
+ * "address": "0x96fc56721d2b79485692350014875b3b67cb00eb",
27
+ * "chain": "1"
28
+ * }
29
+ */
30
+ async function getNftAddress(name) {
31
+ return await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `asset/nft?name=${name}`);
32
+ }
33
+ exports.getNftAddress = getNftAddress;
34
+ //# sourceMappingURL=NFTApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NFTApis.js","sourceRoot":"","sources":["../../../src/apis/NFTApis.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,gDAAkD;AAElD;;;;;;;;;GASG;AACI,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,UAAkB;IAChE,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,aAAa,OAAO,IAAI,UAAU,EAAE,CAAC,CAAA;AAC9E,CAAC;AAFD,gCAEC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,aAAa,CAAC,IAAY;IAC5C,OAAO,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAA;AAClE,CAAC;AAFD,sCAEC"}
@@ -0,0 +1,2 @@
1
+ export declare function getOnRampUrl(walletAddr: string): Promise<string>;
2
+ export declare function getOffRampUrl(walletAddr: string): Promise<string>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOffRampUrl = exports.getOnRampUrl = void 0;
4
+ const constants_1 = require("../common/constants");
5
+ const errors_1 = require("../errors");
6
+ const ApiUtils_1 = require("../utils/ApiUtils");
7
+ async function getOnRampUrl(walletAddr) {
8
+ const url = (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `on-ramp/${walletAddr}?provider=moonpay`))?.url;
9
+ if (!url) {
10
+ throw new errors_1.InternalFailureError(errors_1.ErrorCode.UnknownServerError, "No onramp url found.", { walletAddr }, "This is an internal error, please contact support.", "https://docs.fun.xyz");
11
+ }
12
+ return url;
13
+ }
14
+ exports.getOnRampUrl = getOnRampUrl;
15
+ async function getOffRampUrl(walletAddr) {
16
+ const url = (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `off-ramp/${walletAddr}?provider=moonpay`))?.url;
17
+ if (!url) {
18
+ throw new errors_1.InternalFailureError(errors_1.ErrorCode.UnknownServerError, "No offramp url found.", { walletAddr }, "This is an internal error, please contact support.", "https://docs.fun.xyz");
19
+ }
20
+ return url;
21
+ }
22
+ exports.getOffRampUrl = getOffRampUrl;
23
+ //# sourceMappingURL=OnOffRampApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnOffRampApis.js","sourceRoot":"","sources":["../../../src/apis/OnOffRampApis.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,sCAA2D;AAC3D,gDAAkD;AAE3C,KAAK,UAAU,YAAY,CAAC,UAAkB;IACjD,MAAM,GAAG,GAAW,CAAC,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,WAAW,UAAU,mBAAmB,CAAC,CAAC,EAAE,GAAG,CAAA;IAClG,IAAI,CAAC,GAAG,EAAE;QACN,MAAM,IAAI,6BAAoB,CAC1B,kBAAS,CAAC,kBAAkB,EAC5B,sBAAsB,EACtB,EAAE,UAAU,EAAE,EACd,oDAAoD,EACpD,sBAAsB,CACzB,CAAA;KACJ;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAZD,oCAYC;AAEM,KAAK,UAAU,aAAa,CAAC,UAAkB;IAClD,MAAM,GAAG,GAAW,CAAC,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,YAAY,UAAU,mBAAmB,CAAC,CAAC,EAAE,GAAG,CAAA;IACnG,IAAI,CAAC,GAAG,EAAE;QACN,MAAM,IAAI,6BAAoB,CAC1B,kBAAS,CAAC,kBAAkB,EAC5B,uBAAuB,EACvB,EAAE,UAAU,EAAE,EACd,oDAAoD,EACpD,sBAAsB,CACzB,CAAA;KACJ;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAZD,sCAYC"}
@@ -0,0 +1,2 @@
1
+ export declare function getOnRampUrl(walletAddr: string): Promise<void>;
2
+ export declare function getOffRampUrl(walletAddr: string): Promise<void>;