@flaunch/sdk 0.3.1 → 0.4.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 (82) hide show
  1. package/README.md +78 -0
  2. package/dist/abi/BidWallV1_1.d.ts +740 -0
  3. package/dist/abi/BidWallV1_1.d.ts.map +1 -0
  4. package/dist/abi/FairLaunchV1_1.d.ts +522 -0
  5. package/dist/abi/FairLaunchV1_1.d.ts.map +1 -0
  6. package/dist/abi/FastFlaunchZap.d.ts +30 -20
  7. package/dist/abi/FastFlaunchZap.d.ts.map +1 -1
  8. package/dist/abi/FlaunchPositionManagerV1_1.d.ts +2053 -0
  9. package/dist/abi/FlaunchPositionManagerV1_1.d.ts.map +1 -0
  10. package/dist/abi/FlaunchV1_1.d.ts +850 -0
  11. package/dist/abi/FlaunchV1_1.d.ts.map +1 -0
  12. package/dist/abi/FlaunchZap.d.ts +330 -0
  13. package/dist/abi/FlaunchZap.d.ts.map +1 -0
  14. package/dist/abi/RevenueManager.d.ts +648 -0
  15. package/dist/abi/RevenueManager.d.ts.map +1 -0
  16. package/dist/abi/TreasuryManagerFactory.d.ts +434 -0
  17. package/dist/abi/TreasuryManagerFactory.d.ts.map +1 -0
  18. package/dist/abi/index.cjs +27 -58
  19. package/dist/abi/index.cjs.map +1 -1
  20. package/dist/abi/index.js +27 -58
  21. package/dist/abi/index.js.map +1 -1
  22. package/dist/addresses/index.cjs +127 -91
  23. package/dist/addresses/index.cjs.map +1 -1
  24. package/dist/addresses/index.js +121 -92
  25. package/dist/addresses/index.js.map +1 -1
  26. package/dist/addresses.d.ts +7 -0
  27. package/dist/addresses.d.ts.map +1 -1
  28. package/dist/clients/BidWallClient.d.ts +20 -0
  29. package/dist/clients/BidWallClient.d.ts.map +1 -1
  30. package/dist/clients/BidWallV1_1Client.d.ts +46 -0
  31. package/dist/clients/BidWallV1_1Client.d.ts.map +1 -0
  32. package/dist/clients/FairLaunchClient.d.ts +20 -0
  33. package/dist/clients/FairLaunchClient.d.ts.map +1 -1
  34. package/dist/clients/FairLaunchV1_1Client.d.ts +50 -0
  35. package/dist/clients/FairLaunchV1_1Client.d.ts.map +1 -0
  36. package/dist/clients/FastFlaunchClient.d.ts +40 -0
  37. package/dist/clients/FastFlaunchClient.d.ts.map +1 -1
  38. package/dist/clients/FlaunchClient.d.ts +20 -0
  39. package/dist/clients/FlaunchClient.d.ts.map +1 -1
  40. package/dist/clients/FlaunchPositionManagerV1_1Client.d.ts +90 -0
  41. package/dist/clients/FlaunchPositionManagerV1_1Client.d.ts.map +1 -0
  42. package/dist/clients/FlaunchV1_1Client.d.ts +31 -0
  43. package/dist/clients/FlaunchV1_1Client.d.ts.map +1 -0
  44. package/dist/clients/FlaunchZapClient.d.ts +70 -0
  45. package/dist/clients/FlaunchZapClient.d.ts.map +1 -0
  46. package/dist/clients/MemecoinClient.d.ts +27 -0
  47. package/dist/clients/MemecoinClient.d.ts.map +1 -1
  48. package/dist/clients/Permit2Client.d.ts +17 -0
  49. package/dist/clients/Permit2Client.d.ts.map +1 -1
  50. package/dist/clients/QuoterClient.d.ts +39 -3
  51. package/dist/clients/QuoterClient.d.ts.map +1 -1
  52. package/dist/clients/RevenueManagerClient.d.ts +42 -0
  53. package/dist/clients/RevenueManagerClient.d.ts.map +1 -0
  54. package/dist/clients/StateViewClient.d.ts +30 -0
  55. package/dist/clients/StateViewClient.d.ts.map +1 -1
  56. package/dist/clients/TreasuryManagerFactoryClient.d.ts +24 -0
  57. package/dist/clients/TreasuryManagerFactoryClient.d.ts.map +1 -0
  58. package/dist/helpers/chainIdToChain.d.ts +5 -0
  59. package/dist/helpers/chainIdToChain.d.ts.map +1 -0
  60. package/dist/helpers/index.cjs +5310 -0
  61. package/dist/helpers/index.cjs.map +1 -1
  62. package/dist/helpers/index.d.ts +1 -0
  63. package/dist/helpers/index.d.ts.map +1 -1
  64. package/dist/helpers/index.js +5313 -4
  65. package/dist/helpers/index.js.map +1 -1
  66. package/dist/hooks/FlaunchPositionManagerHooks.d.ts +42 -0
  67. package/dist/hooks/FlaunchPositionManagerHooks.d.ts.map +1 -1
  68. package/dist/hooks/index.cjs +95 -0
  69. package/dist/hooks/index.cjs.map +1 -1
  70. package/dist/hooks/index.js +94 -1
  71. package/dist/hooks/index.js.map +1 -1
  72. package/dist/index.cjs.js +16748 -11289
  73. package/dist/index.cjs.js.map +1 -1
  74. package/dist/index.esm.js +16742 -11291
  75. package/dist/index.esm.js.map +1 -1
  76. package/dist/index.umd.js +1 -1
  77. package/dist/index.umd.js.map +1 -1
  78. package/dist/sdk/FlaunchSDK.d.ts +288 -15
  79. package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
  80. package/dist/utils/universalRouter.d.ts +2 -0
  81. package/dist/utils/universalRouter.d.ts.map +1 -1
  82. package/package.json +8 -3
package/README.md CHANGED
@@ -7,10 +7,13 @@ A TypeScript SDK for seamless interaction with the Flaunch protocol and Uniswap
7
7
 
8
8
  ![Flaunch Header](https://raw.githubusercontent.com/flayerlabs/flaunch-sdk/refs/heads/master/.github/flaunch-header.png)
9
9
 
10
+ _Note: Add this `llms-full.txt` file into Cursor IDE / LLMs to provide context about using the Flaunch SDK: [llms-full.txt](https://raw.githubusercontent.com/flayerlabs/flaunch-sdk/refs/heads/master/llms-full.txt)_
11
+
10
12
  ## Features
11
13
 
12
14
  - 🚀 Flaunch new memecoins
13
15
  - 💱 Buy and sell memecoins via Uniswap V4 hooks
16
+ - 🏗️ Build your own token launchpads on top of the flaunch protocol
14
17
  - 📊 Read functions for token and pool data
15
18
  - 🔒 Built-in Permit2 support for gasless approvals
16
19
  - 🔵 Works on Base and Base Sepolia networks
@@ -25,6 +28,7 @@ A TypeScript SDK for seamless interaction with the Flaunch protocol and Uniswap
25
28
  - [Selling with Permit2](#selling-with-permit2)
26
29
  - [Flaunching a Memecoin](#flaunching-a-memecoin)
27
30
  - [How to generate Base64Image from file upload](#how-to-generate-base64image-from-user-uploaded-file)
31
+ - [Advanced Integration: Revenue Sharing with RevenueManager](#advanced-integration-revenue-sharing-with-revenuemanager)
28
32
  - [All SDK functions](#all-sdk-functions)
29
33
  - [React Hooks](#react-hooks)
30
34
  - [Flaunch Docs](#flaunch-reference)
@@ -263,6 +267,80 @@ const handleImageChange = useCallback(
263
267
  />;
264
268
  ```
265
269
 
270
+ ### Advanced Integration: Revenue Sharing with RevenueManager
271
+
272
+ For platforms building on top of Flaunch, the `RevenueManager` contract enables sophisticated revenue-sharing models. It allows platforms to automatically take a protocol fee from the trading fees generated by memecoins launched through their integration.
273
+
274
+ **Key Concepts:**
275
+
276
+ 1. **Deployment & Initialization**: Before flaunching tokens via your platform, deploy an instance of your `RevenueManager` with your protocol fee and recipient address.
277
+
278
+ ```ts
279
+ const revenueManagerInstanceAddress = await flaunchWrite.deployRevenueManager({
280
+ protocolRecipient: "0xabc...",
281
+ protocolFeePercent: 20, // 20% revenue share between protocol and 80% to coin creators (of the 1% swap fees)
282
+ });
283
+ ```
284
+
285
+ 2. **Flaunching Directly to Manager**: Instead of the creator receiving the Flaunch NFT, you'd flaunch the token directly into the `RevenueManager`. This automatically sets up the fee split.
286
+
287
+ ```ts
288
+ await flaunchWrite.flaunchIPFSWithRevenueManager({
289
+ name: "...",
290
+ symbol: "...",
291
+ metadata: {
292
+ base64Image: "...",
293
+ },
294
+ pinataConfig: {
295
+ jwt: "...",
296
+ },
297
+ fairLaunchPercent: 40,
298
+ fairLaunchDuration: 30 * 60, // 30 mins
299
+ initialMarketCapUSD: 1_000,
300
+ creator: "0x...",
301
+ creatorFeeAllocationPercent: 100,
302
+ // **Note:** Specify your instance of the RevenueManager here
303
+ revenueManagerInstanceAddress: "...",
304
+ });
305
+ ```
306
+
307
+ 3. **Claiming Fees**: Creators can claim their share of earned fees, and the protocol can claim its share via the `RevenueManager` contract.
308
+
309
+ ```ts
310
+ // check address' balance
311
+ const balance = await flaunchRead.revenueManagerBalance({
312
+ revenueManagerAddress: revenueManagerInstanceAddress,
313
+ recipient: "0xabc...",
314
+ });
315
+
316
+ // protocol claim: the connected wallet must be the protocol recipient for the revenue manager
317
+ await flaunchWrite.revenueManagerProtocolClaim({
318
+ revenueManagerAddress: revenueManagerInstanceAddress,
319
+ });
320
+
321
+ // creator claim: the connected wallet must be the coin's creator for them to claim their share
322
+ await flaunchWrite.revenueManagerCreatorClaim({
323
+ revenueManagerAddress: revenueManagerInstanceAddress,
324
+ });
325
+
326
+ // creator claim: for specific flaunch token ids:
327
+ await flaunchWrite.revenueManagerCreatorClaimForTokens({
328
+ revenueManagerAddress: revenueManagerInstanceAddress,
329
+ flaunchTokens: [
330
+ {
331
+ flaunch: FlaunchAddress[base.id],
332
+ tokenId: 5,
333
+ },
334
+ {
335
+ flaunch: FlaunchV1_1Address[base.id],
336
+ tokenId: 10,
337
+ },
338
+ ],
339
+ });
340
+ ```
341
+
342
+ Refer to the [RevenueManager Docs](https://docs.flaunch.gg/manager-types/revenuemanager) for detailed implementation guides and function references.
343
+
266
344
  ### All SDK functions
267
345
 
268
346
  For a list of all the functions in the SDK, refer to: [FlaunchSDK.ts](./src/sdk/FlaunchSDK.ts)