@0block.io/sdk 0.5.0 → 0.5.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/fetch.d.ts +13 -1
- package/dist/fetch.js +25 -4
- package/package.json +1 -1
package/dist/fetch.d.ts
CHANGED
|
@@ -19,7 +19,19 @@ export declare function resolveTokenProgram(fetcher: AccountFetcher, mint: Addre
|
|
|
19
19
|
export declare function fetchPumpfunGlobalFeeRecipient(fetcher: AccountFetcher, globalAccount: web3.PublicKey): Promise<web3.PublicKey>;
|
|
20
20
|
/** Non-zero entries of Global.buyback_fee_recipients ([Pubkey; 8]). */
|
|
21
21
|
export declare function fetchPumpfunBuybackFeeRecipients(fetcher: AccountFetcher, globalAccount: web3.PublicKey): Promise<web3.PublicKey[]>;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* BondingCurve.creator (offset: discriminator + 5×u64 + bool), with tradeability
|
|
24
|
+
* preflight. Throws a PRECISE error instead of letting an untradeable market
|
|
25
|
+
* fail on-chain (where the user would still pay the tx fee + tip):
|
|
26
|
+
*
|
|
27
|
+
* - `complete == true` → the token GRADUATED off the bonding curve (liquidity
|
|
28
|
+
* moved to an AMM — PumpSwap/Raydium); the pump.fun program rejects both
|
|
29
|
+
* buys and sells on a complete curve.
|
|
30
|
+
* - 49-byte legacy layout (pre-creator-fee, curve untouched since the mid-2025
|
|
31
|
+
* pump.fun upgrade) → needs the program's extend_account before any modern
|
|
32
|
+
* swap can even deserialize it. In practice these are dead tokens: anything
|
|
33
|
+
* actively traded has long been extended.
|
|
34
|
+
*/
|
|
23
35
|
export declare function fetchPumpfunBondingCurveCreator(fetcher: AccountFetcher, bondingCurve: web3.PublicKey): Promise<web3.PublicKey>;
|
|
24
36
|
/**
|
|
25
37
|
* Resolve everything a pump.fun swap needs for one mint. Run this server-side
|
package/dist/fetch.js
CHANGED
|
@@ -55,17 +55,38 @@ export async function fetchPumpfunBuybackFeeRecipients(fetcher, globalAccount) {
|
|
|
55
55
|
}
|
|
56
56
|
return recipients;
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* BondingCurve.creator (offset: discriminator + 5×u64 + bool), with tradeability
|
|
60
|
+
* preflight. Throws a PRECISE error instead of letting an untradeable market
|
|
61
|
+
* fail on-chain (where the user would still pay the tx fee + tip):
|
|
62
|
+
*
|
|
63
|
+
* - `complete == true` → the token GRADUATED off the bonding curve (liquidity
|
|
64
|
+
* moved to an AMM — PumpSwap/Raydium); the pump.fun program rejects both
|
|
65
|
+
* buys and sells on a complete curve.
|
|
66
|
+
* - 49-byte legacy layout (pre-creator-fee, curve untouched since the mid-2025
|
|
67
|
+
* pump.fun upgrade) → needs the program's extend_account before any modern
|
|
68
|
+
* swap can even deserialize it. In practice these are dead tokens: anything
|
|
69
|
+
* actively traded has long been extended.
|
|
70
|
+
*/
|
|
59
71
|
export async function fetchPumpfunBondingCurveCreator(fetcher, bondingCurve) {
|
|
60
72
|
const info = await fetcher.getAccountInfo(bondingCurve);
|
|
61
73
|
if (!info) {
|
|
62
74
|
throw new Error(`pump.fun bonding curve not found: ${bondingCurve.toBase58()}`);
|
|
63
75
|
}
|
|
64
|
-
const
|
|
65
|
-
if (info.data.length <
|
|
76
|
+
const legacyLen = 8 + 5 * 8 + 1; // ..= complete flag (pre-creator layout)
|
|
77
|
+
if (info.data.length < legacyLen) {
|
|
66
78
|
throw new Error("pump.fun bonding curve data too short");
|
|
67
79
|
}
|
|
68
|
-
|
|
80
|
+
const complete = info.data[legacyLen - 1] === 1;
|
|
81
|
+
if (complete) {
|
|
82
|
+
throw new Error("pump.fun bonding curve is complete — the token graduated to an AMM " +
|
|
83
|
+
"(PumpSwap/Raydium); it cannot be traded on the bonding curve");
|
|
84
|
+
}
|
|
85
|
+
if (info.data.length < legacyLen + 32) {
|
|
86
|
+
throw new Error("legacy pump.fun bonding curve (pre-creator layout, never extended) — " +
|
|
87
|
+
"the account needs pump.fun extend_account before modern swaps can run");
|
|
88
|
+
}
|
|
89
|
+
return new web3.PublicKey(info.data.slice(legacyLen, legacyLen + 32));
|
|
69
90
|
}
|
|
70
91
|
/**
|
|
71
92
|
* Resolve everything a pump.fun swap needs for one mint. Run this server-side
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0block.io/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline \u2014 tenant-wrapped or direct \u2014 with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"solana",
|