@ubi.fun/sdk 0.1.1 → 0.2.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 (67) hide show
  1. package/README.md +33 -0
  2. package/dist/abi/DividendVault.d.cts +670 -0
  3. package/dist/abi/DividendVault.d.ts +671 -0
  4. package/dist/abi/DividendVault.d.ts.map +1 -0
  5. package/dist/abi/HolderShareFeeCalculator.d.cts +287 -0
  6. package/dist/abi/HolderShareFeeCalculator.d.ts +288 -0
  7. package/dist/abi/HolderShareFeeCalculator.d.ts.map +1 -0
  8. package/dist/abi/IndexerSubscriber.d.cts +221 -0
  9. package/dist/abi/IndexerSubscriber.d.ts +222 -0
  10. package/dist/abi/IndexerSubscriber.d.ts.map +1 -0
  11. package/dist/abi/MemecoinDividends.d.cts +1021 -0
  12. package/dist/abi/MemecoinDividends.d.ts +1022 -0
  13. package/dist/abi/MemecoinDividends.d.ts.map +1 -0
  14. package/dist/abi/index.cjs +6447 -3585
  15. package/dist/abi/index.cjs.map +1 -1
  16. package/dist/abi/index.d.cts +4 -0
  17. package/dist/abi/index.d.ts +4 -0
  18. package/dist/abi/index.d.ts.map +1 -1
  19. package/dist/abi/index.js +6444 -3586
  20. package/dist/abi/index.js.map +1 -1
  21. package/dist/addresses/index.cjs +17 -0
  22. package/dist/addresses/index.cjs.map +1 -1
  23. package/dist/addresses/index.js +14 -1
  24. package/dist/addresses/index.js.map +1 -1
  25. package/dist/addresses.d.cts +25 -0
  26. package/dist/addresses.d.ts +25 -0
  27. package/dist/addresses.d.ts.map +1 -1
  28. package/dist/clients/DividendVaultClient.d.cts +32 -0
  29. package/dist/clients/DividendVaultClient.d.ts +33 -0
  30. package/dist/clients/DividendVaultClient.d.ts.map +1 -0
  31. package/dist/clients/FlaunchPositionManagerClient.d.cts +18 -0
  32. package/dist/clients/FlaunchPositionManagerClient.d.ts +18 -0
  33. package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -1
  34. package/dist/clients/FlaunchZapClient.d.cts +41 -0
  35. package/dist/clients/FlaunchZapClient.d.ts +41 -0
  36. package/dist/clients/FlaunchZapClient.d.ts.map +1 -1
  37. package/dist/clients/IndexerSubscriberClient.d.cts +46 -0
  38. package/dist/clients/IndexerSubscriberClient.d.ts +47 -0
  39. package/dist/clients/IndexerSubscriberClient.d.ts.map +1 -0
  40. package/dist/clients/MemecoinDividendsClient.d.cts +23 -0
  41. package/dist/clients/MemecoinDividendsClient.d.ts +24 -0
  42. package/dist/clients/MemecoinDividendsClient.d.ts.map +1 -0
  43. package/dist/helpers/index.cjs.map +1 -1
  44. package/dist/helpers/index.js.map +1 -1
  45. package/dist/index.cjs +11710 -8366
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.cts +6 -0
  48. package/dist/index.d.ts +6 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +11687 -8368
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.umd.cjs +1 -1
  53. package/dist/index.umd.cjs.map +1 -1
  54. package/dist/sdk/FlaunchSDK.d.cts +47 -1
  55. package/dist/sdk/FlaunchSDK.d.ts +47 -1
  56. package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
  57. package/dist/utils/creatorVaults.d.cts +64 -0
  58. package/dist/utils/creatorVaults.d.ts +65 -0
  59. package/dist/utils/creatorVaults.d.ts.map +1 -0
  60. package/dist/utils/index.cjs +64 -0
  61. package/dist/utils/index.cjs.map +1 -1
  62. package/dist/utils/index.d.cts +1 -0
  63. package/dist/utils/index.d.ts +1 -0
  64. package/dist/utils/index.d.ts.map +1 -1
  65. package/dist/utils/index.js +55 -2
  66. package/dist/utils/index.js.map +1 -1
  67. package/package.json +1 -1
package/README.md CHANGED
@@ -116,6 +116,27 @@ await sdkWrite.createUBIIPFSWithSplitManager({
116
116
 
117
117
  Note: split launches deposit the revenue NFT into the split manager escrow, so "the NFT stays in your wallet" only holds for non-split launches.
118
118
 
119
+ ### Creator vaults (holder dividends)
120
+
121
+ Once creator vaults are live on a chain (the vault fee calculator is set and the vault implementation is approved), every launch attaches a creator vault, and `flaunchWithVault` works only then: the token's holders earn a share of the creator's earnings in USDC (spread over 24 hours), and the creator picks the trading fee. `flaunch`/`createUBI` and the split launch throw while vaults are live, because a launch without a vault could never trade. Until then they work as before.
122
+
123
+ ```ts
124
+ await sdkWrite.createUBIIPFSWithVault({
125
+ // ...same launch params as above; creatorFeeAllocationPercent must be 90 or more...
126
+ feePercent: 2, // 1.5 to 5, permanent
127
+ holderSharePercent: 25, // 16.67 to 100 of the creator's earnings, permanent
128
+ splitReceivers: [{ address: escrow, percent: 10 }], // up to 4, 2 decimals, of what the creator keeps
129
+ });
130
+
131
+ const vault = await sdkRead.getCreatorVault(coin); // undefined for coins without one
132
+ const { withdrawable } = await sdkRead.dividendsOf(coin, holder);
133
+ await sdkWrite.withdrawDividends(coin);
134
+ await sdkWrite.harvestCreatorVault(coin); // anyone: moves waiting creator fees in
135
+ await sdkWrite.claimCreatorVault(coin); // creator recipients
136
+ ```
137
+
138
+ Every launch without a vault also sends a no-vault marker that the vault fee calculator refuses, so a launch that lands after activation reverts instead of creating a token that can never trade.
139
+
119
140
  ## Trading
120
141
 
121
142
  Approve the input token to PoolSwap once (USDC for buys, the coin for sells), then swap. **Always pass your address as `referrer`: 5% of the swap fee accrues to it on-chain.**
@@ -271,9 +292,21 @@ The protocol is a fork of [Flaunch](https://flaunch.gg), and the deployed contra
271
292
 
272
293
  For a list of all the functions in the SDK, refer to: [FlaunchSDK.ts](./src/sdk/FlaunchSDK.ts)
273
294
 
295
+ ## Indexing: reverse lookup, reserves, StateView
296
+
297
+ For indexers doing cold discovery from chain data:
298
+
299
+ - `sdk.readIndexerSubscriber.poolIndex({ poolId })` resolves a Uniswap v4 PoolId to the coin, its treasury and its tokenId (zero addresses for a pool that is not ours).
300
+ - `sdk.readPositionManager.poolFees(poolKey)` returns the Internal Swap Pool inventory, and `sdk.readFairLaunch.fairLaunchInfo({ poolId })` the fair-launch escrow. Both are tradable inventory that active v4 liquidity does not show.
301
+ - `sdk.readBidWall.position({ poolId })` gives the bid wall's deployed amounts and pending USDC.
302
+ - StateView exists on mainnet only (`StateViewAddress`); `sdk.readPoolManager` reads PoolManager storage directly and works on both networks.
303
+
304
+ The Solidity sources and the full per-pool reserve accounting are in [`contracts/README.md`](./contracts/README.md).
305
+
274
306
  ## Reference
275
307
 
276
308
  - Protocol docs: [ubi.fun/docs](https://ubi.fun/docs/integrate/overview)
277
309
  - Contract addresses ship in [`src/addresses.ts`](./src/addresses.ts) for Arc mainnet (5042) and testnet (5042002)
310
+ - Contract sources and reserve accounting: [`contracts/`](./contracts/README.md)
278
311
  - REST data API: [ubi.fun/docs/integrate/api](https://ubi.fun/docs/integrate/api)
279
312
  - MCP server for agents: [ubi.fun/docs/integrate/agents](https://ubi.fun/docs/integrate/agents)