@ubi.fun/sdk 0.1.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 (191) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +279 -0
  3. package/dist/abi/AddressFeeSplitManager.d.cts +938 -0
  4. package/dist/abi/AddressFeeSplitManager.d.ts +939 -0
  5. package/dist/abi/AddressFeeSplitManager.d.ts.map +1 -0
  6. package/dist/abi/BidWall.d.cts +739 -0
  7. package/dist/abi/BidWall.d.ts +740 -0
  8. package/dist/abi/BidWall.d.ts.map +1 -0
  9. package/dist/abi/FairLaunch.d.cts +535 -0
  10. package/dist/abi/FairLaunch.d.ts +536 -0
  11. package/dist/abi/FairLaunch.d.ts.map +1 -0
  12. package/dist/abi/FeeEscrow.d.cts +281 -0
  13. package/dist/abi/FeeEscrow.d.ts +282 -0
  14. package/dist/abi/FeeEscrow.d.ts.map +1 -0
  15. package/dist/abi/Flaunch.d.cts +775 -0
  16. package/dist/abi/Flaunch.d.ts +776 -0
  17. package/dist/abi/Flaunch.d.ts.map +1 -0
  18. package/dist/abi/FlaunchPositionManager.d.cts +2170 -0
  19. package/dist/abi/FlaunchPositionManager.d.ts +2171 -0
  20. package/dist/abi/FlaunchPositionManager.d.ts.map +1 -0
  21. package/dist/abi/FlaunchZap.d.cts +300 -0
  22. package/dist/abi/FlaunchZap.d.ts +301 -0
  23. package/dist/abi/FlaunchZap.d.ts.map +1 -0
  24. package/dist/abi/InitialPrice.d.cts +252 -0
  25. package/dist/abi/InitialPrice.d.ts +253 -0
  26. package/dist/abi/InitialPrice.d.ts.map +1 -0
  27. package/dist/abi/Memecoin.d.cts +680 -0
  28. package/dist/abi/Memecoin.d.ts +681 -0
  29. package/dist/abi/Memecoin.d.ts.map +1 -0
  30. package/dist/abi/Multicall.d.cts +332 -0
  31. package/dist/abi/Multicall.d.ts +333 -0
  32. package/dist/abi/Multicall.d.ts.map +1 -0
  33. package/dist/abi/PoolManager.d.cts +1056 -0
  34. package/dist/abi/PoolManager.d.ts +1057 -0
  35. package/dist/abi/PoolManager.d.ts.map +1 -0
  36. package/dist/abi/PoolSwap.d.cts +89 -0
  37. package/dist/abi/PoolSwap.d.ts +90 -0
  38. package/dist/abi/PoolSwap.d.ts.map +1 -0
  39. package/dist/abi/Quoter.d.cts +485 -0
  40. package/dist/abi/Quoter.d.ts +486 -0
  41. package/dist/abi/Quoter.d.ts.map +1 -0
  42. package/dist/abi/ReferralEscrow.d.cts +459 -0
  43. package/dist/abi/ReferralEscrow.d.ts +460 -0
  44. package/dist/abi/ReferralEscrow.d.ts.map +1 -0
  45. package/dist/abi/TreasuryManager.d.cts +325 -0
  46. package/dist/abi/TreasuryManager.d.ts +326 -0
  47. package/dist/abi/TreasuryManager.d.ts.map +1 -0
  48. package/dist/abi/TreasuryManagerFactory.d.cts +433 -0
  49. package/dist/abi/TreasuryManagerFactory.d.ts +434 -0
  50. package/dist/abi/TreasuryManagerFactory.d.ts.map +1 -0
  51. package/dist/abi/UniversalRewardsDistributor.d.cts +191 -0
  52. package/dist/abi/UniversalRewardsDistributor.d.ts +192 -0
  53. package/dist/abi/UniversalRewardsDistributor.d.ts.map +1 -0
  54. package/dist/abi/XHandleClaims.d.cts +383 -0
  55. package/dist/abi/XHandleClaims.d.ts +384 -0
  56. package/dist/abi/XHandleClaims.d.ts.map +1 -0
  57. package/dist/abi/index.cjs +13541 -0
  58. package/dist/abi/index.cjs.map +1 -0
  59. package/dist/abi/index.d.cts +18 -0
  60. package/dist/abi/index.d.ts +19 -0
  61. package/dist/abi/index.d.ts.map +1 -0
  62. package/dist/abi/index.js +13522 -0
  63. package/dist/abi/index.js.map +1 -0
  64. package/dist/addresses/index.cjs +90 -0
  65. package/dist/addresses/index.cjs.map +1 -0
  66. package/dist/addresses/index.js +70 -0
  67. package/dist/addresses/index.js.map +1 -0
  68. package/dist/addresses.d.cts +48 -0
  69. package/dist/addresses.d.ts +49 -0
  70. package/dist/addresses.d.ts.map +1 -0
  71. package/dist/clients/BidWallClient.d.cts +44 -0
  72. package/dist/clients/BidWallClient.d.ts +45 -0
  73. package/dist/clients/BidWallClient.d.ts.map +1 -0
  74. package/dist/clients/FairLaunchClient.d.cts +47 -0
  75. package/dist/clients/FairLaunchClient.d.ts +48 -0
  76. package/dist/clients/FairLaunchClient.d.ts.map +1 -0
  77. package/dist/clients/FeeEscrowClient.d.cts +40 -0
  78. package/dist/clients/FeeEscrowClient.d.ts +41 -0
  79. package/dist/clients/FeeEscrowClient.d.ts.map +1 -0
  80. package/dist/clients/FlaunchClient.d.cts +35 -0
  81. package/dist/clients/FlaunchClient.d.ts +36 -0
  82. package/dist/clients/FlaunchClient.d.ts.map +1 -0
  83. package/dist/clients/FlaunchPositionManagerClient.d.cts +117 -0
  84. package/dist/clients/FlaunchPositionManagerClient.d.ts +118 -0
  85. package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -0
  86. package/dist/clients/FlaunchZapClient.d.cts +127 -0
  87. package/dist/clients/FlaunchZapClient.d.ts +128 -0
  88. package/dist/clients/FlaunchZapClient.d.ts.map +1 -0
  89. package/dist/clients/InitialPriceClient.d.cts +32 -0
  90. package/dist/clients/InitialPriceClient.d.ts +33 -0
  91. package/dist/clients/InitialPriceClient.d.ts.map +1 -0
  92. package/dist/clients/MemecoinClient.d.cts +66 -0
  93. package/dist/clients/MemecoinClient.d.ts +67 -0
  94. package/dist/clients/MemecoinClient.d.ts.map +1 -0
  95. package/dist/clients/MulticallClient.d.cts +15 -0
  96. package/dist/clients/MulticallClient.d.ts +16 -0
  97. package/dist/clients/MulticallClient.d.ts.map +1 -0
  98. package/dist/clients/PoolManagerClient.d.cts +50 -0
  99. package/dist/clients/PoolManagerClient.d.ts +51 -0
  100. package/dist/clients/PoolManagerClient.d.ts.map +1 -0
  101. package/dist/clients/PoolSwapClient.d.cts +37 -0
  102. package/dist/clients/PoolSwapClient.d.ts +38 -0
  103. package/dist/clients/PoolSwapClient.d.ts.map +1 -0
  104. package/dist/clients/QuoterClient.d.cts +58 -0
  105. package/dist/clients/QuoterClient.d.ts +59 -0
  106. package/dist/clients/QuoterClient.d.ts.map +1 -0
  107. package/dist/clients/ReferralEscrowClient.d.cts +39 -0
  108. package/dist/clients/ReferralEscrowClient.d.ts +40 -0
  109. package/dist/clients/ReferralEscrowClient.d.ts.map +1 -0
  110. package/dist/clients/TreasuryManagerClient.d.cts +71 -0
  111. package/dist/clients/TreasuryManagerClient.d.ts +72 -0
  112. package/dist/clients/TreasuryManagerClient.d.ts.map +1 -0
  113. package/dist/clients/TreasuryManagerFactoryClient.d.cts +15 -0
  114. package/dist/clients/TreasuryManagerFactoryClient.d.ts +16 -0
  115. package/dist/clients/TreasuryManagerFactoryClient.d.ts.map +1 -0
  116. package/dist/clients/UniversalRewardsDistributorClient.d.cts +45 -0
  117. package/dist/clients/UniversalRewardsDistributorClient.d.ts +46 -0
  118. package/dist/clients/UniversalRewardsDistributorClient.d.ts.map +1 -0
  119. package/dist/clients/XHandleClaimsClient.d.cts +64 -0
  120. package/dist/clients/XHandleClaimsClient.d.ts +65 -0
  121. package/dist/clients/XHandleClaimsClient.d.ts.map +1 -0
  122. package/dist/helpers/chainIdToChain.d.cts +113 -0
  123. package/dist/helpers/chainIdToChain.d.ts +114 -0
  124. package/dist/helpers/chainIdToChain.d.ts.map +1 -0
  125. package/dist/helpers/hex.d.cts +3 -0
  126. package/dist/helpers/hex.d.ts +4 -0
  127. package/dist/helpers/hex.d.ts.map +1 -0
  128. package/dist/helpers/index.cjs +196 -0
  129. package/dist/helpers/index.cjs.map +1 -0
  130. package/dist/helpers/index.d.cts +3 -0
  131. package/dist/helpers/index.d.ts +4 -0
  132. package/dist/helpers/index.d.ts.map +1 -0
  133. package/dist/helpers/index.js +184 -0
  134. package/dist/helpers/index.js.map +1 -0
  135. package/dist/helpers/ipfs.d.cts +56 -0
  136. package/dist/helpers/ipfs.d.ts +57 -0
  137. package/dist/helpers/ipfs.d.ts.map +1 -0
  138. package/dist/hooks/FlaunchPositionManagerHooks.d.cts +28 -0
  139. package/dist/hooks/FlaunchPositionManagerHooks.d.ts +29 -0
  140. package/dist/hooks/FlaunchPositionManagerHooks.d.ts.map +1 -0
  141. package/dist/hooks/index.cjs +73 -0
  142. package/dist/hooks/index.cjs.map +1 -0
  143. package/dist/hooks/index.d.cts +1 -0
  144. package/dist/hooks/index.d.ts +2 -0
  145. package/dist/hooks/index.d.ts.map +1 -0
  146. package/dist/hooks/index.js +70 -0
  147. package/dist/hooks/index.js.map +1 -0
  148. package/dist/index.cjs +16808 -0
  149. package/dist/index.cjs.map +1 -0
  150. package/dist/index.d.cts +31 -0
  151. package/dist/index.d.ts +32 -0
  152. package/dist/index.d.ts.map +1 -0
  153. package/dist/index.js +16718 -0
  154. package/dist/index.js.map +1 -0
  155. package/dist/index.umd.cjs +2 -0
  156. package/dist/index.umd.cjs.map +1 -0
  157. package/dist/sdk/FlaunchSDK.d.cts +520 -0
  158. package/dist/sdk/FlaunchSDK.d.ts +521 -0
  159. package/dist/sdk/FlaunchSDK.d.ts.map +1 -0
  160. package/dist/sdk/calldata.d.cts +65 -0
  161. package/dist/sdk/calldata.d.ts +66 -0
  162. package/dist/sdk/calldata.d.ts.map +1 -0
  163. package/dist/sdk/drift.d.cts +20 -0
  164. package/dist/sdk/drift.d.ts +21 -0
  165. package/dist/sdk/drift.d.ts.map +1 -0
  166. package/dist/sdk/factory.d.cts +20 -0
  167. package/dist/sdk/factory.d.ts +21 -0
  168. package/dist/sdk/factory.d.ts.map +1 -0
  169. package/dist/types.d.cts +56 -0
  170. package/dist/types.d.ts +57 -0
  171. package/dist/types.d.ts.map +1 -0
  172. package/dist/utils/index.cjs +455 -0
  173. package/dist/utils/index.cjs.map +1 -0
  174. package/dist/utils/index.d.cts +4 -0
  175. package/dist/utils/index.d.ts +5 -0
  176. package/dist/utils/index.d.ts.map +1 -0
  177. package/dist/utils/index.js +431 -0
  178. package/dist/utils/index.js.map +1 -0
  179. package/dist/utils/parseSwap.d.cts +45 -0
  180. package/dist/utils/parseSwap.d.ts +46 -0
  181. package/dist/utils/parseSwap.d.ts.map +1 -0
  182. package/dist/utils/slippage.d.cts +11 -0
  183. package/dist/utils/slippage.d.ts +12 -0
  184. package/dist/utils/slippage.d.ts.map +1 -0
  185. package/dist/utils/swap.d.cts +49 -0
  186. package/dist/utils/swap.d.ts +50 -0
  187. package/dist/utils/swap.d.ts.map +1 -0
  188. package/dist/utils/univ4.d.cts +78 -0
  189. package/dist/utils/univ4.d.ts +79 -0
  190. package/dist/utils/univ4.d.ts.map +1 -0
  191. package/package.json +161 -0
@@ -0,0 +1,521 @@
1
+ import { Drift, ReadWriteAdapter, type Address } from "@delvtech/drift";
2
+ import { type PublicClient, Hex } from "viem";
3
+ import { ReadFlaunchPositionManager, WatchPoolCreatedParams, WatchPoolSwapParams as WatchPoolSwapParamsPositionManager, BuySwapLog, SellSwapLog, BaseSwapLog } from "../clients/FlaunchPositionManagerClient.js";
4
+ import { ReadPoolManager, PositionInfoParams } from "../clients/PoolManagerClient.js";
5
+ import { ReadFairLaunch } from "../clients/FairLaunchClient.js";
6
+ import { ReadBidWall } from "../clients/BidWallClient.js";
7
+ import { ReadFlaunchZap, ReadWriteFlaunchZap, FlaunchParams, FlaunchIPFSParams, FlaunchWithSplitManagerParams, FlaunchWithSplitManagerIPFSParams } from "../clients/FlaunchZapClient.js";
8
+ import { ReadFlaunch } from "../clients/FlaunchClient.js";
9
+ import { ReadQuoter } from "../clients/QuoterClient.js";
10
+ import { ReadFeeEscrow, ReadWriteFeeEscrow } from "../clients/FeeEscrowClient.js";
11
+ import { ReadReferralEscrow, ReadWriteReferralEscrow } from "../clients/ReferralEscrowClient.js";
12
+ import { ReadWritePoolSwap } from "../clients/PoolSwapClient.js";
13
+ import { ReadXHandleClaims, ReadWriteXHandleClaims } from "../clients/XHandleClaimsClient.js";
14
+ import { ReadUniversalRewardsDistributor, ReadWriteUniversalRewardsDistributor } from "../clients/UniversalRewardsDistributorClient.js";
15
+ import { ReadWriteTreasuryManagerFactory } from "../clients/TreasuryManagerFactoryClient.js";
16
+ import { CoinMetadata, PoolCreatedEventData } from "../types.js";
17
+ export type { PoolCreatedEventData } from "../types.js";
18
+ type WatchPoolSwapParams = Omit<WatchPoolSwapParamsPositionManager<boolean>, "usdcIsCurrencyZero"> & {
19
+ filterByCoin?: Address;
20
+ };
21
+ /** An address's daily holder pool entitlement as served by the ubi.fun API. */
22
+ export interface UbiEntitlement {
23
+ account?: string;
24
+ /** CUMULATIVE lifetime entitlement in USDC wei (6 decimals). */
25
+ cumulativeWei?: string;
26
+ proof?: Hex[];
27
+ status?: string;
28
+ /** The ledger root this entitlement belongs to. */
29
+ root?: string;
30
+ [key: string]: unknown;
31
+ }
32
+ /**
33
+ * Base class for interacting with the ubi.fun protocol in read-only mode
34
+ */
35
+ export declare class ReadFlaunchSDK {
36
+ readonly drift: Drift;
37
+ readonly chainId: number;
38
+ readonly publicClient: PublicClient | undefined;
39
+ readonly TICK_SPACING = 60;
40
+ readonly readPositionManager: ReadFlaunchPositionManager;
41
+ readonly readFeeEscrow: ReadFeeEscrow;
42
+ readonly readReferralEscrow: ReadReferralEscrow;
43
+ readonly readFlaunchZap: ReadFlaunchZap;
44
+ readonly readPoolManager: ReadPoolManager;
45
+ readonly readFairLaunch: ReadFairLaunch;
46
+ readonly readBidWall: ReadBidWall;
47
+ readonly readFlaunch: ReadFlaunch;
48
+ readonly readQuoter: ReadQuoter;
49
+ readonly readXHandleClaims: ReadXHandleClaims;
50
+ readonly readUbiPool: ReadUniversalRewardsDistributor;
51
+ resolveIPFS: (value: string) => string;
52
+ constructor(chainId: number, drift?: Drift, publicClient?: PublicClient);
53
+ /**
54
+ * Checks if a given coin address is a valid ubi.fun coin
55
+ * @param coinAddress - The address of the coin to check
56
+ * @returns Promise<boolean> - True if the coin is valid, false otherwise
57
+ */
58
+ isValidCoin(coinAddress: Address): Promise<boolean>;
59
+ getPositionManagerAddress(): `0x${string}`;
60
+ getFlaunchAddress(): `0x${string}`;
61
+ getFairLaunchAddress(): `0x${string}`;
62
+ getBidWallAddress(): `0x${string}`;
63
+ /**
64
+ * Gets the Flaunch NFT token ID for a memecoin (the NFT IS the revenue claim)
65
+ * @param coinAddress - The address of the memecoin
66
+ * @returns Promise<{ flaunchAddress: Address; tokenId: bigint }>
67
+ */
68
+ getFlaunchTokenIdForMemecoin(coinAddress: Address): Promise<{
69
+ flaunchAddress: Address;
70
+ tokenId: bigint;
71
+ }>;
72
+ /**
73
+ * URLs to try for a tokenURI, in order. With the default resolver an
74
+ * ipfs:// URI fans out to every known public gateway; a custom resolver
75
+ * from `setIPFSResolver` stays authoritative and yields exactly one URL.
76
+ */
77
+ private tokenUriCandidates;
78
+ /**
79
+ * Retrieves metadata for a given coin
80
+ * @param coinAddress - The address of the coin
81
+ * @returns Promise<CoinMetadata & { symbol: string }> - The coin's metadata including name, symbol, description, and social links
82
+ */
83
+ getCoinMetadata(coinAddress: Address): Promise<CoinMetadata & {
84
+ symbol: string;
85
+ }>;
86
+ /**
87
+ * Retrieves metadata for a given coin using its token ID
88
+ * @param flaunch - The address of the Flaunch contract
89
+ * @param tokenId - The token ID of the coin
90
+ * @returns The coin's metadata including name, symbol, description, and social links
91
+ */
92
+ getCoinMetadataFromTokenId(flaunch: Address, tokenId: bigint): Promise<CoinMetadata & {
93
+ symbol: string;
94
+ }>;
95
+ /**
96
+ * Retrieves metadata for multiple coins using their token IDs
97
+ * @param params - An array of objects containing flaunch contract address and token ID
98
+ * @param batchSize - Optional, the number of ipfs requests to process in each batch
99
+ * @param batchDelay - Optional, the delay in milliseconds between batches
100
+ * @returns An array of objects containing coin address, name, symbol, description, and social links
101
+ */
102
+ getCoinMetadataFromTokenIds(params: {
103
+ flaunch: Address;
104
+ tokenId: bigint;
105
+ }[], batchSize?: number, batchDelay?: number): Promise<{
106
+ coinAddress: Address;
107
+ name: string;
108
+ symbol: string;
109
+ description: any;
110
+ image: string;
111
+ external_link: any;
112
+ collaborators: any;
113
+ discordUrl: any;
114
+ twitterUrl: any;
115
+ telegramUrl: any;
116
+ }[]>;
117
+ /**
118
+ * Watches for pool creation events
119
+ * @param params - Parameters for watching pool creation
120
+ * @returns Subscription to pool creation events
121
+ */
122
+ watchPoolCreated(params: WatchPoolCreatedParams): Promise<{
123
+ cleanup: () => void;
124
+ pollPoolCreatedNow: () => Promise<void>;
125
+ }>;
126
+ /**
127
+ * Parses a transaction to extract PoolCreated event data
128
+ * @param txHash - The transaction hash to parse
129
+ * @returns PoolCreated event parameters or null if not found
130
+ */
131
+ getPoolCreatedFromTx(txHash: Hex): Promise<PoolCreatedEventData | null>;
132
+ /**
133
+ * Watches for pool swap events
134
+ * @param params - Parameters for watching pool swaps including optional coin filter
135
+ * @returns Subscription to pool swap events
136
+ */
137
+ watchPoolSwap(params: WatchPoolSwapParams): Promise<{
138
+ cleanup: () => void;
139
+ pollPoolSwapNow: () => Promise<void>;
140
+ }>;
141
+ /**
142
+ * Gets information about a liquidity position (read via PoolManager extsload)
143
+ * @param params - Parameters for querying position info
144
+ * @returns Position information
145
+ */
146
+ positionInfo(params: PositionInfoParams): Promise<{
147
+ liquidity: bigint;
148
+ feeGrowthInside0LastX128: bigint;
149
+ feeGrowthInside1LastX128: bigint;
150
+ }>;
151
+ /**
152
+ * Gets the current tick for a given coin's pool
153
+ * @param coinAddress - The address of the coin
154
+ * @returns Promise<number> - The current tick of the pool
155
+ */
156
+ currentTick(coinAddress: Address): Promise<number>;
157
+ /**
158
+ * Gets the current sqrt price for a given coin's pool
159
+ * @param coinAddress - The address of the coin
160
+ * @returns Promise<bigint> - sqrtPriceX96, zero if the pool has no price yet
161
+ */
162
+ currentSqrtPriceX96(coinAddress: Address): Promise<bigint>;
163
+ /**
164
+ * Calculates the coin price in USDC based on the current tick. The pool
165
+ * pairs an 18-decimal coin against 6-decimal USDC, so the raw tick price is
166
+ * scaled by 1e12 to get a human dollar price.
167
+ * @param coinAddress - The address of the coin
168
+ * @returns Promise<string> - The price of one coin in USDC (18 decimal string)
169
+ */
170
+ coinPriceInUSDC(coinAddress: Address): Promise<string>;
171
+ /**
172
+ * Calculates the coin's market cap in USDC (price x the fixed 100 Billion supply)
173
+ * @param coinAddress - The address of the coin
174
+ * @returns Promise<string> - The market cap in USDC with 2 decimal precision
175
+ */
176
+ coinMarketCapInUSDC(coinAddress: Address): Promise<string>;
177
+ fairLaunchInfo(coinAddress: Address): Promise<{
178
+ startsAt: bigint;
179
+ endsAt: bigint;
180
+ initialTick: number;
181
+ revenue: bigint;
182
+ supply: bigint;
183
+ closed: boolean;
184
+ }>;
185
+ /**
186
+ * Checks if a fair launch is currently active for a given coin
187
+ * @param coinAddress - The address of the coin
188
+ * @returns Promise<boolean> - True if fair launch is active, false otherwise
189
+ */
190
+ isFairLaunchActive(coinAddress: Address): Promise<boolean>;
191
+ /** The fair launch window length in seconds for a coin (chosen at launch). */
192
+ fairLaunchDuration(coinAddress: Address): Promise<number>;
193
+ /**
194
+ * Gets the initial tick for a fair launch
195
+ * @param coinAddress - The address of the coin
196
+ * @returns Promise<number> - The initial tick value
197
+ */
198
+ initialTick(coinAddress: Address): Promise<number>;
199
+ /**
200
+ * Gets the USDC-only position in a fair launch (the side selling at the
201
+ * fixed fair launch price)
202
+ * @param coinAddress - The address of the coin
203
+ * @returns Promise<{usdcAmount, coinAmount, tickLower, tickUpper}>
204
+ */
205
+ fairLaunchUSDCOnlyPosition(coinAddress: Address): Promise<{
206
+ usdcAmount: bigint;
207
+ coinAmount: bigint;
208
+ tickLower: number;
209
+ tickUpper: number;
210
+ }>;
211
+ /**
212
+ * Gets the coin-only position in a fair launch
213
+ * @param coinAddress - The address of the coin
214
+ * @returns Promise<{usdcAmount, coinAmount, tickLower, tickUpper}>
215
+ */
216
+ fairLaunchCoinOnlyPosition(coinAddress: Address): Promise<{
217
+ usdcAmount: bigint;
218
+ coinAmount: bigint;
219
+ tickLower: number;
220
+ tickUpper: number;
221
+ }>;
222
+ /**
223
+ * Gets the bid wall (progressive floor) position for a coin
224
+ * @param coinAddress - The address of the coin
225
+ * @returns Promise<{usdcAmount, coinAmount, pendingUsdc, tickLower, tickUpper}>
226
+ */
227
+ bidWallPosition(coinAddress: Address): Promise<{
228
+ usdcAmount: bigint;
229
+ coinAmount: bigint;
230
+ pendingUsdc: bigint;
231
+ tickLower: number;
232
+ tickUpper: number;
233
+ }>;
234
+ /**
235
+ * Gets the USDC balance the creator (or split manager) can claim from the
236
+ * FeeEscrow
237
+ * @param creator - The address to check
238
+ * @returns Promise<bigint> - The claimable balance (USDC, 6 decimals)
239
+ */
240
+ creatorRevenue(creator: Address): Promise<bigint>;
241
+ /**
242
+ * Gets the referral escrow balance of a recipient for a given token.
243
+ * Referral rewards accrue in the OUTPUT token of each swap: buys accrue the
244
+ * coin, sells accrue USDC.
245
+ * @param recipient - The address of the recipient to check
246
+ * @param token - The token to check (a coin address or USDC)
247
+ * @returns Promise<bigint> - The balance of the recipient
248
+ */
249
+ referralBalance(recipient: Address, token: Address): Promise<bigint>;
250
+ /**
251
+ * Gets a recipient's claimable share inside an earnings-split manager
252
+ * @param managerAddress - The AddressFeeSplitManager instance
253
+ * @param recipient - The recipient to check
254
+ * @returns Promise<bigint> - The claimable balance (USDC, 6 decimals)
255
+ */
256
+ splitBalance(managerAddress: Address, recipient: Address): Promise<bigint>;
257
+ treasuryManagerInfo(treasuryManagerAddress: Address): Promise<{
258
+ managerOwner: `0x${string}`;
259
+ permissions: `0x${string}`;
260
+ }>;
261
+ /**
262
+ * Fetches an address's daily holder pool entitlement from the ubi.fun API.
263
+ * The returned cumulativeWei/proof pair is what the on-chain claim takes.
264
+ * @param account - The holder address
265
+ */
266
+ getUbiEntitlement(account: Address): Promise<UbiEntitlement>;
267
+ /**
268
+ * An address's claimable holder pool balance right now: the API entitlement
269
+ * minus what was already claimed on-chain. Returns zero while the
270
+ * entitlement's ledger root is still pending the URD timelock (a claim
271
+ * against it would revert).
272
+ * @param account - The holder address
273
+ */
274
+ claimableUbi(account: Address): Promise<{
275
+ claimable: bigint;
276
+ entitlement: UbiEntitlement;
277
+ }>;
278
+ /**
279
+ * Gets the pool ID for a given coin
280
+ * @param coinAddress - The address of the coin
281
+ * @returns Promise<string> - The pool ID
282
+ */
283
+ poolId(coinAddress: Address): Promise<`0x${string}`>;
284
+ /**
285
+ * Gets the flaunching fee for a given initial price, in native units
286
+ * (msg.value; USDC at 18 decimals on Arc). Zero at the $10k minimum market
287
+ * cap.
288
+ * @param params.sender - The address of the sender
289
+ * @param params.initialMarketCapUSD - The initial market cap in USD
290
+ * @param params.slippagePercent - The slippage percent
291
+ * @returns Promise<bigint> - The flaunching fee
292
+ */
293
+ getFlaunchingFee(params: {
294
+ sender: Address;
295
+ initialMarketCapUSD: number;
296
+ slippagePercent?: number;
297
+ }): Promise<bigint>;
298
+ /**
299
+ * Calculates the msg.value required to flaunch a token: the premine cost (if
300
+ * any) plus the flaunching fee. Native units (USDC at 18 decimals on Arc).
301
+ * @param params.premineAmount - The amount of coins to be premined
302
+ * @param params.initialMarketCapUSD - The initial market cap in USD
303
+ * @param params.slippagePercent - The slippage percent
304
+ * @returns Promise<bigint> - The value required to flaunch
305
+ */
306
+ valueRequiredToFlaunch(params: {
307
+ premineAmount: bigint;
308
+ initialMarketCapUSD: number;
309
+ slippagePercent?: number;
310
+ }): Promise<bigint>;
311
+ /**
312
+ * Gets a quote for selling an exact amount of a coin for USDC
313
+ * @param coinAddress - The address of the coin to sell
314
+ * @param amountIn - The exact amount of coins to sell (18 decimals)
315
+ * @param referrer - Optional referrer; must match the referrer used to swap
316
+ * @returns Promise<bigint> - The expected USDC out (6 decimals)
317
+ */
318
+ getSellQuoteExactInput({ coinAddress, amountIn, referrer, }: {
319
+ coinAddress: Address;
320
+ amountIn: bigint;
321
+ referrer?: Address;
322
+ }): Promise<bigint>;
323
+ /**
324
+ * Gets a quote for buying a coin with an exact amount of USDC
325
+ * @param coinAddress - The address of the coin to buy
326
+ * @param amountIn - The exact amount of USDC to spend (6 decimals)
327
+ * @param referrer - Optional referrer; must match the referrer used to swap
328
+ * @returns Promise<bigint> - The expected coins out (18 decimals)
329
+ */
330
+ getBuyQuoteExactInput({ coinAddress, amountIn, referrer, }: {
331
+ coinAddress: Address;
332
+ amountIn: bigint;
333
+ referrer?: Address;
334
+ }): Promise<bigint>;
335
+ /**
336
+ * Gets a quote for buying an exact amount of a coin, answering the USDC in
337
+ * @param coinAddress - The address of the coin to buy
338
+ * @param amountOut - The exact amount of coins to receive (18 decimals)
339
+ * @param referrer - Optional referrer; must match the referrer used to swap
340
+ * @returns Promise<bigint> - The required USDC in (6 decimals)
341
+ */
342
+ getBuyQuoteExactOutput({ coinAddress, amountOut, referrer, }: {
343
+ coinAddress: Address;
344
+ amountOut: bigint;
345
+ referrer?: Address;
346
+ }): Promise<bigint>;
347
+ /**
348
+ * Determines if USDC is currency0 in the coin's pool
349
+ * @param coinAddress - The address of the coin
350
+ * @returns boolean - True if USDC is currency0, false otherwise
351
+ */
352
+ usdcIsCurrencyZero(coinAddress: Address): boolean;
353
+ /**
354
+ * Sets a custom IPFS resolver function
355
+ * @dev this is used to resolve IPFS hash to a gateway URL
356
+ * eg: input: Qabc, output: https://ipfs.io/ipfs/Qabc
357
+ * @param resolverFn - Custom function to resolve IPFS URIs
358
+ */
359
+ setIPFSResolver(resolverFn: (ipfsHash: string) => string): void;
360
+ /**
361
+ * Parses a transaction hash to extract PoolSwap events and return parsed swap data
362
+ * @param params.txHash - The transaction hash to parse
363
+ * @param params.usdcIsCurrencyZero - Whether USDC is currency0 in the pool (optional;
364
+ * when provided, returns typed BUY/SELL data)
365
+ * @returns Parsed swap log or undefined if no PoolSwap event found
366
+ */
367
+ parseSwapTx<T extends boolean | undefined = undefined>(params: {
368
+ txHash: Hex;
369
+ usdcIsCurrencyZero?: T;
370
+ }): Promise<T extends boolean ? BuySwapLog | SellSwapLog | undefined : BaseSwapLog | undefined>;
371
+ getCoinInfo(coinAddress: Address): Promise<{
372
+ totalSupply: bigint;
373
+ decimals: number;
374
+ formattedTotalSupplyInDecimals: number;
375
+ }>;
376
+ isFlaunchTokenApprovedForAll(owner: Address, operator: Address): Promise<boolean>;
377
+ }
378
+ export declare class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
379
+ drift: Drift<ReadWriteAdapter>;
380
+ readonly readWriteFeeEscrow: ReadWriteFeeEscrow;
381
+ readonly readWriteReferralEscrow: ReadWriteReferralEscrow;
382
+ readonly readWriteFlaunchZap: ReadWriteFlaunchZap;
383
+ readonly readWritePoolSwap: ReadWritePoolSwap;
384
+ readonly readWriteXHandleClaims: ReadWriteXHandleClaims;
385
+ readonly readWriteUbiPool: ReadWriteUniversalRewardsDistributor;
386
+ readonly readWriteTreasuryManagerFactory: ReadWriteTreasuryManagerFactory;
387
+ constructor(chainId: number, drift?: Drift<ReadWriteAdapter>, publicClient?: PublicClient);
388
+ /**
389
+ * Launches a new coin through the FlaunchZap
390
+ * @param params - Parameters for the launch
391
+ * @returns Transaction response
392
+ */
393
+ flaunch(params: FlaunchParams): Promise<`0x${string}`>;
394
+ /**
395
+ * Launches a new coin, pinning the image + metadata first to produce the tokenUri
396
+ * @param params - Parameters for the launch with IPFS data
397
+ * @returns Transaction response
398
+ */
399
+ flaunchIPFS(params: FlaunchIPFSParams): Promise<`0x${string}`>;
400
+ flaunchWithSplitManager(params: FlaunchWithSplitManagerParams): Promise<`0x${string}`>;
401
+ /**
402
+ * Launches a new coin that splits the creator revenue between the creator and a
403
+ * list of recipients, storing the token metadata on IPFS
404
+ * @param params - Parameters including all IPFS metadata
405
+ * @returns Transaction response
406
+ */
407
+ flaunchIPFSWithSplitManager(params: FlaunchWithSplitManagerIPFSParams): Promise<`0x${string}`>;
408
+ /** ubi.fun-branded alias of {@link flaunch}. */
409
+ createUBI(params: FlaunchParams): Promise<`0x${string}`>;
410
+ /** ubi.fun-branded alias of {@link flaunchIPFS}. */
411
+ createUBIIPFS(params: FlaunchIPFSParams): Promise<`0x${string}`>;
412
+ /** ubi.fun-branded alias of {@link flaunchWithSplitManager}. */
413
+ createUBIWithSplitManager(params: FlaunchWithSplitManagerParams): Promise<`0x${string}`>;
414
+ /** ubi.fun-branded alias of {@link flaunchIPFSWithSplitManager}. */
415
+ createUBIIPFSWithSplitManager(params: FlaunchWithSplitManagerIPFSParams): Promise<`0x${string}`>;
416
+ coinBalance(coinAddress: Address): Promise<bigint>;
417
+ /** The connected wallet's USDC (6 decimals) balance. */
418
+ usdcBalance(): Promise<bigint>;
419
+ /**
420
+ * The connected wallet's allowance of `token` to PoolSwap. Pass USDC_ADDRESS
421
+ * before a buy, the coin address before a sell.
422
+ */
423
+ swapAllowance(token: Address): Promise<bigint>;
424
+ /**
425
+ * Approves `amount` of `token` to PoolSwap. Pass USDC_ADDRESS before a buy,
426
+ * the coin address before a sell.
427
+ * @returns Transaction response
428
+ */
429
+ approveSwapInput(token: Address, amount: bigint): Promise<`0x${string}`>;
430
+ /**
431
+ * Buys a coin with USDC through PoolSwap. Requires a prior USDC approval to
432
+ * PoolSwap (see approveSwapInput); throws before sending if the allowance is
433
+ * short.
434
+ * @param params.coinAddress - The coin to buy
435
+ * @param params.amountIn - Exact USDC to spend (6 decimals)
436
+ * @param params.slippagePercent - Max price movement beyond the quoted fill, default 5 (%)
437
+ * @param params.referrer - Optional referrer credited with 5% of the swap fee
438
+ * @returns Transaction response
439
+ */
440
+ buyCoin(params: {
441
+ coinAddress: Address;
442
+ amountIn: bigint;
443
+ slippagePercent?: number;
444
+ referrer?: Address;
445
+ }): Promise<`0x${string}`>;
446
+ /**
447
+ * Sells a coin for USDC through PoolSwap. Requires a prior coin approval to
448
+ * PoolSwap (see approveSwapInput); throws before sending if the allowance is
449
+ * short.
450
+ * @param params.coinAddress - The coin to sell
451
+ * @param params.amountIn - Exact coins to sell (18 decimals)
452
+ * @param params.slippagePercent - Max price movement beyond the quoted fill, default 5 (%)
453
+ * @param params.referrer - Optional referrer credited with 5% of the swap fee
454
+ * @returns Transaction response
455
+ */
456
+ sellCoin(params: {
457
+ coinAddress: Address;
458
+ amountIn: bigint;
459
+ slippagePercent?: number;
460
+ referrer?: Address;
461
+ }): Promise<`0x${string}`>;
462
+ private executeSwap;
463
+ /**
464
+ * Withdraws the connected creator's accrued revenue from the FeeEscrow as
465
+ * USDC
466
+ * @param recipient - Optional recipient; defaults to the connected wallet
467
+ * @returns Transaction response
468
+ */
469
+ withdrawCreatorRevenue(params?: {
470
+ recipient?: Address;
471
+ }): Promise<`0x${string}`>;
472
+ /**
473
+ * Claims the referral balance for a given recipient
474
+ * @param tokens - The tokens to claim (coin addresses and/or USDC)
475
+ * @param recipient - The address to receive the claimed tokens
476
+ * @returns Transaction response
477
+ */
478
+ claimReferralBalance(tokens: Address[], recipient: Address): Promise<`0x${string}`>;
479
+ /**
480
+ * Claims the connected wallet's share from an earnings-split manager (paid
481
+ * as USDC)
482
+ * @param managerAddress - The AddressFeeSplitManager instance
483
+ * @returns Transaction response
484
+ */
485
+ claimSplitEarnings(managerAddress: Address): Promise<`0x${string}`>;
486
+ /**
487
+ * Claims an address's outstanding daily holder pool balance from the
488
+ * UniversalRewardsDistributor. Fetches the entitlement + proof from the
489
+ * ubi.fun API; throws if nothing is claimable (including while the ledger
490
+ * root is timelocked).
491
+ * @param account - Optional holder; defaults to the connected wallet
492
+ * @returns Transaction response
493
+ */
494
+ claimUbi(account?: Address): Promise<`0x${string}`>;
495
+ treasuryManagerSetPermissions(treasuryManagerAddress: Address, permissionsAddress: Address): Promise<`0x${string}`>;
496
+ /**
497
+ * Transfers the ownership of a treasury manager to a new address
498
+ * @param treasuryManagerAddress - The address of the treasury manager
499
+ * @param newManagerOwner - The address of the new manager owner
500
+ * @returns Transaction response
501
+ */
502
+ treasuryManagerTransferOwnership(treasuryManagerAddress: Address, newManagerOwner: Address): Promise<`0x${string}`>;
503
+ /**
504
+ * Sets approval for all Flaunch NFTs to an operator
505
+ * @param operator - The operator address to approve/revoke
506
+ * @param approved - Whether to approve or revoke approval
507
+ * @returns Transaction response
508
+ */
509
+ setFlaunchTokenApprovalForAll(operator: Address, approved: boolean): Promise<`0x${string}`>;
510
+ /**
511
+ * Adds an existing Flaunch NFT to a treasury manager. NFT approval must be
512
+ * given prior to calling this function.
513
+ * @param treasuryManagerAddress - The address of the treasury manager
514
+ * @param tokenId - The token ID to deposit
515
+ * @param creator - Optional creator address. If not provided, uses the connected wallet address
516
+ * @param data - Optional additional data for the deposit (defaults to empty bytes)
517
+ * @returns Transaction response
518
+ */
519
+ addToTreasuryManager(treasuryManagerAddress: Address, tokenId: bigint, creator?: Address, data?: `0x${string}`): Promise<`0x${string}`>;
520
+ }
521
+ //# sourceMappingURL=FlaunchSDK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlaunchSDK.d.ts","sourceRoot":"","sources":["../../src/sdk/FlaunchSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,gBAAgB,EAChB,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,YAAY,EACjB,GAAG,EAMJ,MAAM,MAAM,CAAC;AAoBd,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,IAAI,kCAAkC,EACzD,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,eAAe,EACf,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,6BAA6B,EAC7B,iCAAiC,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAA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;;;;;;;OAOG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;IAehC,6BAA6B,CAC3B,sBAAsB,EAAE,OAAO,EAC/B,kBAAkB,EAAE,OAAO;IAS7B;;;;;OAKG;IACH,gCAAgC,CAC9B,sBAAsB,EAAE,OAAO,EAC/B,eAAe,EAAE,OAAO;IAS1B;;;;;OAKG;IACH,6BAA6B,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IASlE;;;;;;;;OAQG;IACG,oBAAoB,CACxB,sBAAsB,EAAE,OAAO,EAC/B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO,EACjB,IAAI,GAAE,KAAK,MAAM,EAAS;CAgB7B"}
@@ -0,0 +1,65 @@
1
+ import { type PublicClient, type WalletClient, type Address, type Hex } from "viem";
2
+ import { ReadFlaunchSDK, ReadWriteFlaunchSDK } from "./FlaunchSDK.cjs";
3
+ export declare const encodedCallAbi: readonly [{
4
+ readonly name: "call";
5
+ readonly type: "function";
6
+ readonly stateMutability: "nonpayable";
7
+ readonly inputs: readonly [{
8
+ readonly type: "address";
9
+ readonly name: "to";
10
+ }, {
11
+ readonly type: "uint256";
12
+ readonly name: "value";
13
+ }, {
14
+ readonly type: "bytes";
15
+ readonly name: "data";
16
+ }];
17
+ readonly outputs: readonly [];
18
+ }];
19
+ export interface CallData {
20
+ to: Address;
21
+ value: bigint;
22
+ data: Hex;
23
+ }
24
+ export type CreateFlaunchCalldataParams = {
25
+ publicClient: PublicClient;
26
+ walletAddress?: Address;
27
+ };
28
+ /**
29
+ * Creates a custom wallet client that returns encoded calldata instead of broadcasting transactions
30
+ */
31
+ export declare function createCallDataWalletClient(publicClient: PublicClient, walletAddress: Address): WalletClient;
32
+ /**
33
+ * Creates a read-only Flaunch SDK instance with only public client
34
+ * @param params - Parameters with only publicClient
35
+ * @returns ReadFlaunchSDK for read-only operations
36
+ * @throws Error if publicClient.chain is not configured
37
+ */
38
+ export declare function createFlaunchCalldata(params: Omit<CreateFlaunchCalldataParams, "walletAddress">): ReadFlaunchSDK;
39
+ /**
40
+ * Creates a read-write Flaunch SDK instance that returns encoded calldata instead of broadcasting transactions
41
+ * @param params - Parameters containing publicClient and walletAddress
42
+ * @returns ReadWriteFlaunchSDK instance configured for calldata generation
43
+ * @throws Error if publicClient.chain is not configured
44
+ */
45
+ export declare function createFlaunchCalldata(params: Required<CreateFlaunchCalldataParams>): ReadWriteFlaunchSDK;
46
+ /**
47
+ * Decodes the result from SDK methods into transaction object
48
+ * @param encodedCall - The result returned by SDK methods
49
+ * @returns Call data containing to, value, and data
50
+ */
51
+ export declare function decodeCallData(encodedCall: Hex): CallData;
52
+ /**
53
+ * Convenience function to call an SDK method and automatically parse the result as transaction object
54
+ * @param sdkMethod - A function that returns a Promise<Hex> (encoded calldata)
55
+ * @returns Promise<CallData> with decoded transaction parameters
56
+ */
57
+ export declare function parseCall<T extends (...args: any[]) => Promise<Hex>>(sdkMethod: T): Promise<CallData>;
58
+ /**
59
+ * Type helper for SDK methods that return encoded calldata
60
+ */
61
+ export type CallDataMethod<T extends any[] = any[]> = (...args: T) => Promise<Hex>;
62
+ /**
63
+ * Type helper for the result of a calldata operation
64
+ */
65
+ export type CallDataResult = Promise<CallData>;
@@ -0,0 +1,66 @@
1
+ import { type PublicClient, type WalletClient, type Address, type Hex } from "viem";
2
+ import { ReadFlaunchSDK, ReadWriteFlaunchSDK } from "./FlaunchSDK.js";
3
+ export declare const encodedCallAbi: readonly [{
4
+ readonly name: "call";
5
+ readonly type: "function";
6
+ readonly stateMutability: "nonpayable";
7
+ readonly inputs: readonly [{
8
+ readonly type: "address";
9
+ readonly name: "to";
10
+ }, {
11
+ readonly type: "uint256";
12
+ readonly name: "value";
13
+ }, {
14
+ readonly type: "bytes";
15
+ readonly name: "data";
16
+ }];
17
+ readonly outputs: readonly [];
18
+ }];
19
+ export interface CallData {
20
+ to: Address;
21
+ value: bigint;
22
+ data: Hex;
23
+ }
24
+ export type CreateFlaunchCalldataParams = {
25
+ publicClient: PublicClient;
26
+ walletAddress?: Address;
27
+ };
28
+ /**
29
+ * Creates a custom wallet client that returns encoded calldata instead of broadcasting transactions
30
+ */
31
+ export declare function createCallDataWalletClient(publicClient: PublicClient, walletAddress: Address): WalletClient;
32
+ /**
33
+ * Creates a read-only Flaunch SDK instance with only public client
34
+ * @param params - Parameters with only publicClient
35
+ * @returns ReadFlaunchSDK for read-only operations
36
+ * @throws Error if publicClient.chain is not configured
37
+ */
38
+ export declare function createFlaunchCalldata(params: Omit<CreateFlaunchCalldataParams, "walletAddress">): ReadFlaunchSDK;
39
+ /**
40
+ * Creates a read-write Flaunch SDK instance that returns encoded calldata instead of broadcasting transactions
41
+ * @param params - Parameters containing publicClient and walletAddress
42
+ * @returns ReadWriteFlaunchSDK instance configured for calldata generation
43
+ * @throws Error if publicClient.chain is not configured
44
+ */
45
+ export declare function createFlaunchCalldata(params: Required<CreateFlaunchCalldataParams>): ReadWriteFlaunchSDK;
46
+ /**
47
+ * Decodes the result from SDK methods into transaction object
48
+ * @param encodedCall - The result returned by SDK methods
49
+ * @returns Call data containing to, value, and data
50
+ */
51
+ export declare function decodeCallData(encodedCall: Hex): CallData;
52
+ /**
53
+ * Convenience function to call an SDK method and automatically parse the result as transaction object
54
+ * @param sdkMethod - A function that returns a Promise<Hex> (encoded calldata)
55
+ * @returns Promise<CallData> with decoded transaction parameters
56
+ */
57
+ export declare function parseCall<T extends (...args: any[]) => Promise<Hex>>(sdkMethod: T): Promise<CallData>;
58
+ /**
59
+ * Type helper for SDK methods that return encoded calldata
60
+ */
61
+ export type CallDataMethod<T extends any[] = any[]> = (...args: T) => Promise<Hex>;
62
+ /**
63
+ * Type helper for the result of a calldata operation
64
+ */
65
+ export type CallDataResult = Promise<CallData>;
66
+ //# sourceMappingURL=calldata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calldata.d.ts","sourceRoot":"","sources":["../../src/sdk/calldata.ts"],"names":[],"mappings":"AAAA,O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