@paul.lumberwork/bonding-curve-sdk 1.7.2 → 1.8.1

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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as anchor from '@coral-xyz/anchor';
2
2
  import { BN, Program } from '@coral-xyz/anchor';
3
- import { PublicKey, Keypair, Connection, TransactionInstruction } from '@solana/web3.js';
3
+ import { PublicKey, Connection, Keypair, TransactionInstruction } from '@solana/web3.js';
4
4
 
5
5
  /**
6
6
  * Program IDL in camelCase format in order to be used in JS/TS.
@@ -1743,8 +1743,137 @@ type KickFunProgram = {
1743
1743
  "type": {
1744
1744
  "option": "u128";
1745
1745
  };
1746
+ },
1747
+ {
1748
+ "name": "newFeeWithdrawDelay";
1749
+ "type": {
1750
+ "option": "i64";
1751
+ };
1746
1752
  }
1747
1753
  ];
1754
+ },
1755
+ {
1756
+ "name": "withdrawAccumulatedFees";
1757
+ "docs": [
1758
+ "Withdraw accumulated trading fees (0.5% curve fee) from an incomplete bonding curve.",
1759
+ "Time-locked: only callable after launchpad.fee_withdraw_delay seconds since curve creation.",
1760
+ "Default delay: 7 days. Admin can change delay via update_launchpad.",
1761
+ "Use this when a curve never reaches 100% but has accumulated fees."
1762
+ ];
1763
+ "discriminator": [
1764
+ 208,
1765
+ 72,
1766
+ 35,
1767
+ 251,
1768
+ 110,
1769
+ 63,
1770
+ 250,
1771
+ 122
1772
+ ];
1773
+ "accounts": [
1774
+ {
1775
+ "name": "admin";
1776
+ "docs": [
1777
+ "Admin signer — must be launchpad.authority"
1778
+ ];
1779
+ "writable": true;
1780
+ "signer": true;
1781
+ },
1782
+ {
1783
+ "name": "launchpad";
1784
+ "pda": {
1785
+ "seeds": [
1786
+ {
1787
+ "kind": "const";
1788
+ "value": [
1789
+ 108,
1790
+ 97,
1791
+ 117,
1792
+ 110,
1793
+ 99,
1794
+ 104,
1795
+ 112,
1796
+ 97,
1797
+ 100
1798
+ ];
1799
+ }
1800
+ ];
1801
+ };
1802
+ },
1803
+ {
1804
+ "name": "tokenLaunch";
1805
+ },
1806
+ {
1807
+ "name": "bondingCurve";
1808
+ "writable": true;
1809
+ "pda": {
1810
+ "seeds": [
1811
+ {
1812
+ "kind": "const";
1813
+ "value": [
1814
+ 98,
1815
+ 111,
1816
+ 110,
1817
+ 100,
1818
+ 105,
1819
+ 110,
1820
+ 103,
1821
+ 95,
1822
+ 99,
1823
+ 117,
1824
+ 114,
1825
+ 118,
1826
+ 101
1827
+ ];
1828
+ },
1829
+ {
1830
+ "kind": "account";
1831
+ "path": "tokenLaunch";
1832
+ }
1833
+ ];
1834
+ };
1835
+ },
1836
+ {
1837
+ "name": "vault";
1838
+ "docs": [
1839
+ "Vault holding SOL collected during trading"
1840
+ ];
1841
+ "writable": true;
1842
+ "pda": {
1843
+ "seeds": [
1844
+ {
1845
+ "kind": "const";
1846
+ "value": [
1847
+ 118,
1848
+ 97,
1849
+ 117,
1850
+ 108,
1851
+ 116
1852
+ ];
1853
+ },
1854
+ {
1855
+ "kind": "account";
1856
+ "path": "tokenLaunch";
1857
+ }
1858
+ ];
1859
+ };
1860
+ },
1861
+ {
1862
+ "name": "treasury";
1863
+ "docs": [
1864
+ "Treasury wallet receives the withdrawn fees"
1865
+ ];
1866
+ "writable": true;
1867
+ },
1868
+ {
1869
+ "name": "mint";
1870
+ },
1871
+ {
1872
+ "name": "systemProgram";
1873
+ "address": "11111111111111111111111111111111";
1874
+ }
1875
+ ];
1876
+ "args": [];
1748
1877
  }
1749
1878
  ];
1750
1879
  "accounts": [
@@ -1828,6 +1957,19 @@ type KickFunProgram = {
1828
1957
  42
1829
1958
  ];
1830
1959
  },
1960
+ {
1961
+ "name": "feesWithdrawn";
1962
+ "discriminator": [
1963
+ 234,
1964
+ 15,
1965
+ 0,
1966
+ 119,
1967
+ 148,
1968
+ 241,
1969
+ 40,
1970
+ 21
1971
+ ];
1972
+ },
1831
1973
  {
1832
1974
  "name": "launchCreated";
1833
1975
  "discriminator": [
@@ -1928,6 +2070,21 @@ type KickFunProgram = {
1928
2070
  "code": 6011;
1929
2071
  "name": "curveNotComplete";
1930
2072
  "msg": "Bonding curve is not complete yet";
2073
+ },
2074
+ {
2075
+ "code": 6012;
2076
+ "name": "supplyExceedsMax";
2077
+ "msg": "Total supply exceeds maximum safe calculation limit";
2078
+ },
2079
+ {
2080
+ "code": 6013;
2081
+ "name": "feeWithdrawTooEarly";
2082
+ "msg": "Fee withdrawal not allowed yet: time-lock period has not elapsed";
2083
+ },
2084
+ {
2085
+ "code": 6014;
2086
+ "name": "noFeesToWithdraw";
2087
+ "msg": "No accumulated fees to withdraw";
1931
2088
  }
1932
2089
  ];
1933
2090
  "types": [
@@ -2171,6 +2328,59 @@ type KickFunProgram = {
2171
2328
  ];
2172
2329
  };
2173
2330
  },
2331
+ {
2332
+ "name": "feesWithdrawn";
2333
+ "docs": [
2334
+ "Event emitted when admin withdraws accumulated fees from an incomplete/dead curve"
2335
+ ];
2336
+ "type": {
2337
+ "kind": "struct";
2338
+ "fields": [
2339
+ {
2340
+ "name": "tokenLaunch";
2341
+ "docs": [
2342
+ "The token launch public key"
2343
+ ];
2344
+ "type": "pubkey";
2345
+ },
2346
+ {
2347
+ "name": "mint";
2348
+ "docs": [
2349
+ "The mint address"
2350
+ ];
2351
+ "type": "pubkey";
2352
+ },
2353
+ {
2354
+ "name": "admin";
2355
+ "docs": [
2356
+ "Admin who triggered the withdrawal"
2357
+ ];
2358
+ "type": "pubkey";
2359
+ },
2360
+ {
2361
+ "name": "treasury";
2362
+ "docs": [
2363
+ "Treasury wallet that received the fees"
2364
+ ];
2365
+ "type": "pubkey";
2366
+ },
2367
+ {
2368
+ "name": "feesWithdrawn";
2369
+ "docs": [
2370
+ "Amount of accumulated fees withdrawn (in lamports)"
2371
+ ];
2372
+ "type": "u64";
2373
+ },
2374
+ {
2375
+ "name": "timestamp";
2376
+ "docs": [
2377
+ "Timestamp"
2378
+ ];
2379
+ "type": "i64";
2380
+ }
2381
+ ];
2382
+ };
2383
+ },
2174
2384
  {
2175
2385
  "name": "launchCreated";
2176
2386
  "docs": [
@@ -2330,6 +2540,14 @@ type KickFunProgram = {
2330
2540
  "Default k value for bonding curve"
2331
2541
  ];
2332
2542
  "type": "u128";
2543
+ },
2544
+ {
2545
+ "name": "feeWithdrawDelay";
2546
+ "docs": [
2547
+ "Minimum seconds after curve creation before admin can withdraw accumulated fees",
2548
+ "Default: 604800 (7 days). Configurable via update_launchpad."
2549
+ ];
2550
+ "type": "i64";
2333
2551
  }
2334
2552
  ];
2335
2553
  };
@@ -2445,6 +2663,14 @@ type KickFunProgram = {
2445
2663
  ];
2446
2664
  "type": "i64";
2447
2665
  },
2666
+ {
2667
+ "name": "feeWithdrawDelay";
2668
+ "docs": [
2669
+ "Seconds after creation before admin can withdraw accumulated fees",
2670
+ "Snapshotted from launchpad.fee_withdraw_delay at creation time — immutable after deploy"
2671
+ ];
2672
+ "type": "i64";
2673
+ },
2448
2674
  {
2449
2675
  "name": "bump";
2450
2676
  "docs": [
@@ -3012,10 +3238,6 @@ declare class KickFunSDK {
3012
3238
  static calculateK(curveSupply: bigint, targetSol: bigint): bigint;
3013
3239
  }
3014
3240
  interface RegisterStreamerParams {
3015
- streamerId: string;
3016
- streamerKeypair: Keypair;
3017
- }
3018
- interface RegisterStreamerWithSignatureParams {
3019
3241
  streamerId: string;
3020
3242
  streamerPublicKey: PublicKey;
3021
3243
  signature: Uint8Array;
@@ -3026,18 +3248,12 @@ interface RegisterStreamerResult {
3026
3248
  streamerRegistrationPda: PublicKey;
3027
3249
  }
3028
3250
  interface ClaimFundsParams {
3029
- streamerId: string;
3030
- streamerKeypair: Keypair;
3031
- mint: PublicKey;
3032
- solAmount: BN;
3033
- tokenAmount: BN;
3034
- }
3035
- interface ClaimFundsWithSignatureParams {
3036
3251
  streamerId: string;
3037
3252
  streamerPublicKey: PublicKey;
3038
3253
  mint: PublicKey;
3039
3254
  solAmount: BN;
3040
3255
  tokenAmount: BN;
3256
+ nonce: BN;
3041
3257
  signature: Uint8Array;
3042
3258
  timestamp: number;
3043
3259
  }
@@ -3065,9 +3281,9 @@ declare class StreamerSDK {
3065
3281
  * Build the message that the streamer must sign for claim_funds.
3066
3282
  * The streamer signs this with their wallet (e.g. Phantom signMessage).
3067
3283
  *
3068
- * Format: "claim_funds:{streamer_id}:{wallet}:{mint}:{token_amount}:{sol_amount}:{timestamp}"
3284
+ * Format: "claim_funds:{streamer_id}:{wallet}:{mint}:{token_amount}:{sol_amount}:{nonce}:{timestamp}"
3069
3285
  */
3070
- buildClaimMessage(streamerId: string, streamerWallet: PublicKey, mint: PublicKey, tokenAmount: BN, solAmount: BN, timestamp: number): Uint8Array;
3286
+ buildClaimMessage(streamerId: string, streamerWallet: PublicKey, mint: PublicKey, tokenAmount: BN, solAmount: BN, nonce: BN, timestamp: number): Uint8Array;
3071
3287
  /**
3072
3288
  * Create an Ed25519 instruction from an externally-signed signature.
3073
3289
  * Use this when the streamer signs via browser wallet (Phantom, Solflare, etc.)
@@ -3078,21 +3294,16 @@ declare class StreamerSDK {
3078
3294
  * @param signature - The Ed25519 signature from wallet.signMessage(message)
3079
3295
  */
3080
3296
  createEd25519Instruction(streamerWallet: PublicKey, message: Uint8Array, signature: Uint8Array): TransactionInstruction;
3081
- /**
3082
- * Sign a message using a Keypair directly (server-side / test usage).
3083
- * Returns the Ed25519 signature bytes.
3084
- */
3085
- static signMessage(message: Uint8Array, keypair: Keypair): Uint8Array;
3086
3297
  registerStreamer(params: RegisterStreamerParams): Promise<RegisterStreamerResult>;
3087
3298
  claimFunds(params: ClaimFundsParams): Promise<ClaimFundsResult>;
3088
- registerStreamerWithSignature(params: RegisterStreamerWithSignatureParams): Promise<RegisterStreamerResult>;
3089
- claimFundsWithSignature(params: ClaimFundsWithSignatureParams): Promise<ClaimFundsResult>;
3090
3299
  getStreamerRegistration(streamerId: string): Promise<{
3091
3300
  streamerId: string;
3092
3301
  wallet: PublicKey;
3093
3302
  verifiedAt: number;
3094
3303
  registeredBy: PublicKey;
3095
3304
  createdAt: number;
3305
+ claimNonce: number;
3306
+ lastClaimAt: number;
3096
3307
  } | null>;
3097
3308
  isWhitelisted(wallet: PublicKey): Promise<boolean>;
3098
3309
  getVaultBalance(mint?: PublicKey): Promise<{
@@ -3109,4 +3320,14 @@ declare function parseSol(sol: number): bigint;
3109
3320
  /** Parse tokens to raw */
3110
3321
  declare function parseTokens(tokens: number): bigint;
3111
3322
 
3112
- export { ADMIN_WALLET, type AdminWithdrawEvent, type BondingCurveState, CURVE_PERCENT, type ClaimFundsParams, type ClaimFundsResult, type ClaimFundsWithSignatureParams, type CurveCompleteEvent, type EstimateBuyResult, type EstimateSellResult, type EventCallback, FEE_BPS, K_SCALE, type KickFunEvent, type KickFunProgram, KickFunSDK, LAMPORTS, LP_PERCENT, type LaunchAddresses, type LaunchCreatedEvent, METADATA_PROGRAM_ID, PROGRAM_ID, type RegisterStreamerParams, type RegisterStreamerResult, type RegisterStreamerWithSignatureParams, STREAMER_PROGRAM_ID, StreamerSDK, TOKEN_DECIMALS, TREASURY_PERCENT, type TokenLaunchConfig, type TokenLaunchState, type TokensPurchasedEvent, type TokensSoldEvent, type TradeResult, formatSol, formatTokens, parseSol, parseTokens };
3323
+ /**
3324
+ * Create a StreamerSDK instance with the bundled IDL.
3325
+ * Dev only needs to provide connection + wallet — no IDL setup required.
3326
+ *
3327
+ * @example
3328
+ * const streamerSdk = createStreamerSDK(connection, wallet);
3329
+ * const reg = await streamerSdk.getStreamerRegistration("94926228");
3330
+ */
3331
+ declare function createStreamerSDK(connection: Connection, wallet: anchor.Wallet): StreamerSDK;
3332
+
3333
+ export { ADMIN_WALLET, type AdminWithdrawEvent, type BondingCurveState, CURVE_PERCENT, type ClaimFundsParams, type ClaimFundsResult, type CurveCompleteEvent, type EstimateBuyResult, type EstimateSellResult, type EventCallback, FEE_BPS, K_SCALE, type KickFunEvent, type KickFunProgram, KickFunSDK, LAMPORTS, LP_PERCENT, type LaunchAddresses, type LaunchCreatedEvent, METADATA_PROGRAM_ID, PROGRAM_ID, type RegisterStreamerParams, type RegisterStreamerResult, STREAMER_PROGRAM_ID, StreamerSDK, TOKEN_DECIMALS, TREASURY_PERCENT, type TokenLaunchConfig, type TokenLaunchState, type TokensPurchasedEvent, type TokensSoldEvent, type TradeResult, createStreamerSDK, formatSol, formatTokens, parseSol, parseTokens };