@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.
- package/README.md +33 -0
- package/dist/abi/DividendVault.d.cts +670 -0
- package/dist/abi/DividendVault.d.ts +671 -0
- package/dist/abi/DividendVault.d.ts.map +1 -0
- package/dist/abi/HolderShareFeeCalculator.d.cts +287 -0
- package/dist/abi/HolderShareFeeCalculator.d.ts +288 -0
- package/dist/abi/HolderShareFeeCalculator.d.ts.map +1 -0
- package/dist/abi/IndexerSubscriber.d.cts +221 -0
- package/dist/abi/IndexerSubscriber.d.ts +222 -0
- package/dist/abi/IndexerSubscriber.d.ts.map +1 -0
- package/dist/abi/MemecoinDividends.d.cts +1021 -0
- package/dist/abi/MemecoinDividends.d.ts +1022 -0
- package/dist/abi/MemecoinDividends.d.ts.map +1 -0
- package/dist/abi/index.cjs +6447 -3585
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.d.cts +4 -0
- package/dist/abi/index.d.ts +4 -0
- package/dist/abi/index.d.ts.map +1 -1
- package/dist/abi/index.js +6444 -3586
- package/dist/abi/index.js.map +1 -1
- package/dist/addresses/index.cjs +17 -0
- package/dist/addresses/index.cjs.map +1 -1
- package/dist/addresses/index.js +14 -1
- package/dist/addresses/index.js.map +1 -1
- package/dist/addresses.d.cts +25 -0
- package/dist/addresses.d.ts +25 -0
- package/dist/addresses.d.ts.map +1 -1
- package/dist/clients/DividendVaultClient.d.cts +32 -0
- package/dist/clients/DividendVaultClient.d.ts +33 -0
- package/dist/clients/DividendVaultClient.d.ts.map +1 -0
- package/dist/clients/FlaunchPositionManagerClient.d.cts +18 -0
- package/dist/clients/FlaunchPositionManagerClient.d.ts +18 -0
- package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -1
- package/dist/clients/FlaunchZapClient.d.cts +41 -0
- package/dist/clients/FlaunchZapClient.d.ts +41 -0
- package/dist/clients/FlaunchZapClient.d.ts.map +1 -1
- package/dist/clients/IndexerSubscriberClient.d.cts +46 -0
- package/dist/clients/IndexerSubscriberClient.d.ts +47 -0
- package/dist/clients/IndexerSubscriberClient.d.ts.map +1 -0
- package/dist/clients/MemecoinDividendsClient.d.cts +23 -0
- package/dist/clients/MemecoinDividendsClient.d.ts +24 -0
- package/dist/clients/MemecoinDividendsClient.d.ts.map +1 -0
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.js.map +1 -1
- package/dist/index.cjs +11710 -8366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11687 -8368
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/sdk/FlaunchSDK.d.cts +47 -1
- package/dist/sdk/FlaunchSDK.d.ts +47 -1
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/utils/creatorVaults.d.cts +64 -0
- package/dist/utils/creatorVaults.d.ts +65 -0
- package/dist/utils/creatorVaults.d.ts.map +1 -0
- package/dist/utils/index.cjs +64 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +55 -2
- package/dist/utils/index.js.map +1 -1
- 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)
|