four-flap-meme-sdk 1.3.84 → 1.3.86
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/clients/blockrazor.js +0 -1
- package/dist/flap/portal-bundle-merkle/encryption.d.ts +16 -0
- package/dist/flap/portal-bundle-merkle/encryption.js +146 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +3 -24
- package/dist/sol/constants.d.ts +0 -136
- package/dist/sol/constants.js +0 -156
- package/dist/sol/dex/index.d.ts +0 -8
- package/dist/sol/dex/index.js +0 -12
- package/dist/sol/dex/meteora/client.d.ts +0 -75
- package/dist/sol/dex/meteora/client.js +0 -218
- package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +0 -61
- package/dist/sol/dex/meteora/damm-v1-bundle.js +0 -112
- package/dist/sol/dex/meteora/damm-v1.d.ts +0 -118
- package/dist/sol/dex/meteora/damm-v1.js +0 -315
- package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +0 -82
- package/dist/sol/dex/meteora/damm-v2-bundle.js +0 -242
- package/dist/sol/dex/meteora/damm-v2.d.ts +0 -172
- package/dist/sol/dex/meteora/damm-v2.js +0 -632
- package/dist/sol/dex/meteora/dbc-bundle.d.ts +0 -123
- package/dist/sol/dex/meteora/dbc-bundle.js +0 -304
- package/dist/sol/dex/meteora/dbc.d.ts +0 -192
- package/dist/sol/dex/meteora/dbc.js +0 -619
- package/dist/sol/dex/meteora/dlmm-bundle.d.ts +0 -39
- package/dist/sol/dex/meteora/dlmm-bundle.js +0 -189
- package/dist/sol/dex/meteora/dlmm.d.ts +0 -146
- package/dist/sol/dex/meteora/dlmm.js +0 -593
- package/dist/sol/dex/meteora/index.d.ts +0 -25
- package/dist/sol/dex/meteora/index.js +0 -65
- package/dist/sol/dex/meteora/types.d.ts +0 -787
- package/dist/sol/dex/meteora/types.js +0 -110
- package/dist/sol/dex/orca/index.d.ts +0 -10
- package/dist/sol/dex/orca/index.js +0 -16
- package/dist/sol/dex/orca/orca-bundle.d.ts +0 -41
- package/dist/sol/dex/orca/orca-bundle.js +0 -140
- package/dist/sol/dex/orca/orca.d.ts +0 -65
- package/dist/sol/dex/orca/orca.js +0 -426
- package/dist/sol/dex/orca/types.d.ts +0 -263
- package/dist/sol/dex/orca/types.js +0 -38
- package/dist/sol/dex/orca/wavebreak-bundle.d.ts +0 -34
- package/dist/sol/dex/orca/wavebreak-bundle.js +0 -189
- package/dist/sol/dex/orca/wavebreak-types.d.ts +0 -227
- package/dist/sol/dex/orca/wavebreak-types.js +0 -23
- package/dist/sol/dex/orca/wavebreak.d.ts +0 -78
- package/dist/sol/dex/orca/wavebreak.js +0 -469
- package/dist/sol/dex/pump/index.d.ts +0 -9
- package/dist/sol/dex/pump/index.js +0 -14
- package/dist/sol/dex/pump/pump-bundle.d.ts +0 -92
- package/dist/sol/dex/pump/pump-bundle.js +0 -383
- package/dist/sol/dex/pump/pump-swap-bundle.d.ts +0 -103
- package/dist/sol/dex/pump/pump-swap-bundle.js +0 -380
- package/dist/sol/dex/pump/pump-swap.d.ts +0 -46
- package/dist/sol/dex/pump/pump-swap.js +0 -199
- package/dist/sol/dex/pump/pump.d.ts +0 -35
- package/dist/sol/dex/pump/pump.js +0 -352
- package/dist/sol/dex/pump/types.d.ts +0 -215
- package/dist/sol/dex/pump/types.js +0 -5
- package/dist/sol/dex/raydium/index.d.ts +0 -8
- package/dist/sol/dex/raydium/index.js +0 -12
- package/dist/sol/dex/raydium/launchlab.d.ts +0 -68
- package/dist/sol/dex/raydium/launchlab.js +0 -210
- package/dist/sol/dex/raydium/raydium-bundle.d.ts +0 -64
- package/dist/sol/dex/raydium/raydium-bundle.js +0 -324
- package/dist/sol/dex/raydium/raydium.d.ts +0 -40
- package/dist/sol/dex/raydium/raydium.js +0 -366
- package/dist/sol/dex/raydium/types.d.ts +0 -240
- package/dist/sol/dex/raydium/types.js +0 -5
- package/dist/sol/index.d.ts +0 -10
- package/dist/sol/index.js +0 -16
- package/dist/sol/jito/bundle.d.ts +0 -90
- package/dist/sol/jito/bundle.js +0 -263
- package/dist/sol/jito/index.d.ts +0 -7
- package/dist/sol/jito/index.js +0 -7
- package/dist/sol/jito/tip.d.ts +0 -51
- package/dist/sol/jito/tip.js +0 -83
- package/dist/sol/jito/types.d.ts +0 -100
- package/dist/sol/jito/types.js +0 -5
- package/dist/sol/token/create-complete.d.ts +0 -115
- package/dist/sol/token/create-complete.js +0 -235
- package/dist/sol/token/create-token.d.ts +0 -57
- package/dist/sol/token/create-token.js +0 -230
- package/dist/sol/token/index.d.ts +0 -9
- package/dist/sol/token/index.js +0 -14
- package/dist/sol/token/metadata-upload.d.ts +0 -86
- package/dist/sol/token/metadata-upload.js +0 -173
- package/dist/sol/token/metadata.d.ts +0 -92
- package/dist/sol/token/metadata.js +0 -274
- package/dist/sol/token/types.d.ts +0 -153
- package/dist/sol/token/types.js +0 -5
- package/dist/sol/types.d.ts +0 -176
- package/dist/sol/types.js +0 -7
- package/dist/sol/utils/balance.d.ts +0 -160
- package/dist/sol/utils/balance.js +0 -638
- package/dist/sol/utils/connection.d.ts +0 -69
- package/dist/sol/utils/connection.js +0 -156
- package/dist/sol/utils/index.d.ts +0 -9
- package/dist/sol/utils/index.js +0 -9
- package/dist/sol/utils/lp-inspect.d.ts +0 -129
- package/dist/sol/utils/lp-inspect.js +0 -515
- package/dist/sol/utils/transfer.d.ts +0 -125
- package/dist/sol/utils/transfer.js +0 -220
- package/dist/sol/utils/wallet.d.ts +0 -107
- package/dist/sol/utils/wallet.js +0 -210
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orca Whirlpool 类型定义
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Whirlpool 费率等级
|
|
6
|
-
* tickSpacing 决定费率
|
|
7
|
-
*/
|
|
8
|
-
export const WHIRLPOOL_TICK_SPACING = {
|
|
9
|
-
/** 0.01% 费率 */
|
|
10
|
-
TICK_SPACING_1: 1,
|
|
11
|
-
/** 0.02% 费率 */
|
|
12
|
-
TICK_SPACING_2: 2,
|
|
13
|
-
/** 0.04% 费率 */
|
|
14
|
-
TICK_SPACING_4: 4,
|
|
15
|
-
/** 0.08% 费率 */
|
|
16
|
-
TICK_SPACING_8: 8,
|
|
17
|
-
/** 0.16% 费率 */
|
|
18
|
-
TICK_SPACING_16: 16,
|
|
19
|
-
/** 0.30% 费率 */
|
|
20
|
-
TICK_SPACING_64: 64,
|
|
21
|
-
/** 1.00% 费率 */
|
|
22
|
-
TICK_SPACING_128: 128,
|
|
23
|
-
/** 2.00% 费率 */
|
|
24
|
-
TICK_SPACING_256: 256,
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Orca Whirlpools Config 地址
|
|
28
|
-
*/
|
|
29
|
-
export const ORCA_WHIRLPOOL_CONFIG = {
|
|
30
|
-
/** Mainnet Whirlpools Config */
|
|
31
|
-
MAINNET: 'FcrweFY1G9HJAHG5inkGB6pKg1HZ6x9UC2WioAfWrGkR',
|
|
32
|
-
/** Devnet Whirlpools Config */
|
|
33
|
-
DEVNET: 'FcrweFY1G9HJAHG5inkGB6pKg1HZ6x9UC2WioAfWrGkR',
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Orca Whirlpool Program ID
|
|
37
|
-
*/
|
|
38
|
-
export const ORCA_WHIRLPOOL_PROGRAM_ID = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orca Wavebreak Jito Bundle 批量交易
|
|
3
|
-
* 支持批量买卖的原子性交易
|
|
4
|
-
*/
|
|
5
|
-
import { Connection, Keypair } from '@solana/web3.js';
|
|
6
|
-
import type { WavebreakBundleBuyParams, WavebreakBundleSellParams, WavebreakBundleCreateAndBuyParams, WavebreakBundleSignedResult } from './wavebreak-types.js';
|
|
7
|
-
/**
|
|
8
|
-
* 签名 Wavebreak Bundle 批量买入交易
|
|
9
|
-
*/
|
|
10
|
-
export declare function signWavebreakBundleBuy(params: WavebreakBundleBuyParams, connection?: Connection): Promise<WavebreakBundleSignedResult>;
|
|
11
|
-
/**
|
|
12
|
-
* 签名 Wavebreak Bundle 批量卖出交易
|
|
13
|
-
*/
|
|
14
|
-
export declare function signWavebreakBundleSell(params: WavebreakBundleSellParams, connection?: Connection): Promise<WavebreakBundleSignedResult>;
|
|
15
|
-
/**
|
|
16
|
-
* 签名 Wavebreak Bundle 创建并买入交易
|
|
17
|
-
* 第一笔交易创建代币,后续交易批量买入
|
|
18
|
-
*/
|
|
19
|
-
export declare function signWavebreakBundleCreateAndBuy(params: WavebreakBundleCreateAndBuyParams, connection?: Connection): Promise<WavebreakBundleSignedResult & {
|
|
20
|
-
baseMintKeypair: Keypair;
|
|
21
|
-
}>;
|
|
22
|
-
/**
|
|
23
|
-
* 将 Wavebreak Bundle 结果转换为后端 API 请求格式
|
|
24
|
-
*/
|
|
25
|
-
export declare function toWavebreakBundleApiRequest(result: WavebreakBundleSignedResult): {
|
|
26
|
-
transactions: string[];
|
|
27
|
-
metadata: {
|
|
28
|
-
type: string;
|
|
29
|
-
bondingCurveAddress: string;
|
|
30
|
-
baseMint?: string;
|
|
31
|
-
tradeCount: number;
|
|
32
|
-
jitoTipLamports: number;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orca Wavebreak Jito Bundle 批量交易
|
|
3
|
-
* 支持批量买卖的原子性交易
|
|
4
|
-
*/
|
|
5
|
-
import { PublicKey, Keypair, Transaction, ComputeBudgetProgram, } from '@solana/web3.js';
|
|
6
|
-
import { createConnection } from '../../utils/connection.js';
|
|
7
|
-
import { buildTipInstruction, getRandomTipAccount } from '../../jito/tip.js';
|
|
8
|
-
import { buildWavebreakBuyInstruction, buildWavebreakSellInstruction, buildWavebreakCreateLaunchInstruction, getWavebreakBondingCurveInfo, } from './wavebreak.js';
|
|
9
|
-
import { WAVEBREAK_CONSTANTS } from './wavebreak-types.js';
|
|
10
|
-
/**
|
|
11
|
-
* 默认 Jito 小费 (0.001 SOL)
|
|
12
|
-
*/
|
|
13
|
-
const DEFAULT_JITO_TIP_LAMPORTS = 1000000;
|
|
14
|
-
/**
|
|
15
|
-
* 签名 Wavebreak Bundle 批量买入交易
|
|
16
|
-
*/
|
|
17
|
-
export async function signWavebreakBundleBuy(params, connection) {
|
|
18
|
-
const conn = connection || createConnection();
|
|
19
|
-
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
20
|
-
// 获取 Bonding Curve 信息
|
|
21
|
-
const info = await getWavebreakBondingCurveInfo(params.bondingCurveOrMint, conn);
|
|
22
|
-
if (!info) {
|
|
23
|
-
throw new Error('Bonding Curve 不存在');
|
|
24
|
-
}
|
|
25
|
-
const signedTransactions = [];
|
|
26
|
-
const jitoTipLamports = params.jitoTipLamports || DEFAULT_JITO_TIP_LAMPORTS;
|
|
27
|
-
const slippageBps = params.slippageBps || 100;
|
|
28
|
-
for (let i = 0; i < params.trades.length; i++) {
|
|
29
|
-
const trade = params.trades[i];
|
|
30
|
-
const isLastTrade = i === params.trades.length - 1;
|
|
31
|
-
const tx = new Transaction();
|
|
32
|
-
// 添加计算预算
|
|
33
|
-
tx.add(ComputeBudgetProgram.setComputeUnitLimit({ units: 300000 }), ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 100000 }));
|
|
34
|
-
// 添加买入指令
|
|
35
|
-
const buyIx = await buildWavebreakBuyInstruction({
|
|
36
|
-
bondingCurveOrMint: info.bondingCurveAddress,
|
|
37
|
-
amountIn: trade.amountIn,
|
|
38
|
-
allowPartialFill: true,
|
|
39
|
-
slippageBps,
|
|
40
|
-
}, trade.wallet.publicKey, conn);
|
|
41
|
-
tx.add(buyIx);
|
|
42
|
-
// 最后一笔交易添加 Jito 小费
|
|
43
|
-
if (isLastTrade) {
|
|
44
|
-
const tipAccount = getRandomTipAccount();
|
|
45
|
-
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(jitoTipLamports), tipAccount);
|
|
46
|
-
tx.add(tipIx);
|
|
47
|
-
}
|
|
48
|
-
// 设置交易参数
|
|
49
|
-
tx.recentBlockhash = blockhash;
|
|
50
|
-
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
51
|
-
tx.feePayer = trade.wallet.publicKey;
|
|
52
|
-
// 签名
|
|
53
|
-
tx.sign(trade.wallet);
|
|
54
|
-
signedTransactions.push(tx);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
signedTransactions,
|
|
58
|
-
type: 'bundleBuy',
|
|
59
|
-
bondingCurveAddress: info.bondingCurveAddress,
|
|
60
|
-
baseMint: info.baseMint,
|
|
61
|
-
tradeCount: params.trades.length,
|
|
62
|
-
jitoTipLamports,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* 签名 Wavebreak Bundle 批量卖出交易
|
|
67
|
-
*/
|
|
68
|
-
export async function signWavebreakBundleSell(params, connection) {
|
|
69
|
-
const conn = connection || createConnection();
|
|
70
|
-
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
71
|
-
const info = await getWavebreakBondingCurveInfo(params.bondingCurveOrMint, conn);
|
|
72
|
-
if (!info) {
|
|
73
|
-
throw new Error('Bonding Curve 不存在');
|
|
74
|
-
}
|
|
75
|
-
const signedTransactions = [];
|
|
76
|
-
const jitoTipLamports = params.jitoTipLamports || DEFAULT_JITO_TIP_LAMPORTS;
|
|
77
|
-
const slippageBps = params.slippageBps || 100;
|
|
78
|
-
for (let i = 0; i < params.trades.length; i++) {
|
|
79
|
-
const trade = params.trades[i];
|
|
80
|
-
const isLastTrade = i === params.trades.length - 1;
|
|
81
|
-
const tx = new Transaction();
|
|
82
|
-
tx.add(ComputeBudgetProgram.setComputeUnitLimit({ units: 300000 }), ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 100000 }));
|
|
83
|
-
const sellIx = await buildWavebreakSellInstruction({
|
|
84
|
-
bondingCurveOrMint: info.bondingCurveAddress,
|
|
85
|
-
amountIn: trade.amountIn,
|
|
86
|
-
allowPartialFill: true,
|
|
87
|
-
slippageBps,
|
|
88
|
-
}, trade.wallet.publicKey, conn);
|
|
89
|
-
tx.add(sellIx);
|
|
90
|
-
if (isLastTrade) {
|
|
91
|
-
const tipAccount = getRandomTipAccount();
|
|
92
|
-
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(jitoTipLamports), tipAccount);
|
|
93
|
-
tx.add(tipIx);
|
|
94
|
-
}
|
|
95
|
-
tx.recentBlockhash = blockhash;
|
|
96
|
-
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
97
|
-
tx.feePayer = trade.wallet.publicKey;
|
|
98
|
-
tx.sign(trade.wallet);
|
|
99
|
-
signedTransactions.push(tx);
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
signedTransactions,
|
|
103
|
-
type: 'bundleSell',
|
|
104
|
-
bondingCurveAddress: info.bondingCurveAddress,
|
|
105
|
-
baseMint: info.baseMint,
|
|
106
|
-
tradeCount: params.trades.length,
|
|
107
|
-
jitoTipLamports,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* 签名 Wavebreak Bundle 创建并买入交易
|
|
112
|
-
* 第一笔交易创建代币,后续交易批量买入
|
|
113
|
-
*/
|
|
114
|
-
export async function signWavebreakBundleCreateAndBuy(params, connection) {
|
|
115
|
-
const conn = connection || createConnection();
|
|
116
|
-
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
117
|
-
const signedTransactions = [];
|
|
118
|
-
const jitoTipLamports = params.jitoTipLamports || DEFAULT_JITO_TIP_LAMPORTS;
|
|
119
|
-
const slippageBps = params.slippageBps || 100;
|
|
120
|
-
// 生成新的 Mint Keypair
|
|
121
|
-
const baseMintKeypair = Keypair.generate();
|
|
122
|
-
// 计算 Bonding Curve 地址
|
|
123
|
-
const [bondingCurve] = PublicKey.findProgramAddressSync([Buffer.from('bonding_curve'), baseMintKeypair.publicKey.toBuffer()], new PublicKey(WAVEBREAK_CONSTANTS.PROGRAM_ID));
|
|
124
|
-
// ===== 第一笔交易:创建代币发射 =====
|
|
125
|
-
const createTx = new Transaction();
|
|
126
|
-
createTx.add(ComputeBudgetProgram.setComputeUnitLimit({ units: 500000 }), ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 100000 }));
|
|
127
|
-
const createIx = await buildWavebreakCreateLaunchInstruction(params.createParams, params.creator.publicKey, baseMintKeypair, conn);
|
|
128
|
-
createTx.add(createIx);
|
|
129
|
-
// 如果创建者也要买入,在创建交易中添加买入指令
|
|
130
|
-
// 这样可以减少一笔交易
|
|
131
|
-
createTx.recentBlockhash = blockhash;
|
|
132
|
-
createTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
133
|
-
createTx.feePayer = params.creator.publicKey;
|
|
134
|
-
createTx.sign(params.creator, baseMintKeypair);
|
|
135
|
-
signedTransactions.push(createTx);
|
|
136
|
-
// ===== 后续交易:批量买入 =====
|
|
137
|
-
const totalTrades = params.buyTrades.length;
|
|
138
|
-
for (let i = 0; i < totalTrades; i++) {
|
|
139
|
-
const trade = params.buyTrades[i];
|
|
140
|
-
const isLastTrade = i === totalTrades - 1;
|
|
141
|
-
const buyTx = new Transaction();
|
|
142
|
-
buyTx.add(ComputeBudgetProgram.setComputeUnitLimit({ units: 300000 }), ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 100000 }));
|
|
143
|
-
const buyIx = await buildWavebreakBuyInstruction({
|
|
144
|
-
bondingCurveOrMint: bondingCurve.toBase58(),
|
|
145
|
-
amountIn: trade.amountIn,
|
|
146
|
-
allowPartialFill: true,
|
|
147
|
-
slippageBps,
|
|
148
|
-
}, trade.wallet.publicKey, conn);
|
|
149
|
-
buyTx.add(buyIx);
|
|
150
|
-
// 最后一笔交易添加 Jito 小费
|
|
151
|
-
if (isLastTrade) {
|
|
152
|
-
const tipAccount = getRandomTipAccount();
|
|
153
|
-
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(jitoTipLamports), tipAccount);
|
|
154
|
-
buyTx.add(tipIx);
|
|
155
|
-
}
|
|
156
|
-
buyTx.recentBlockhash = blockhash;
|
|
157
|
-
buyTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
158
|
-
buyTx.feePayer = trade.wallet.publicKey;
|
|
159
|
-
buyTx.sign(trade.wallet);
|
|
160
|
-
signedTransactions.push(buyTx);
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
signedTransactions,
|
|
164
|
-
type: 'bundleCreateAndBuy',
|
|
165
|
-
bondingCurveAddress: bondingCurve.toBase58(),
|
|
166
|
-
baseMint: baseMintKeypair.publicKey.toBase58(),
|
|
167
|
-
tradeCount: totalTrades + 1, // 包括创建交易
|
|
168
|
-
jitoTipLamports,
|
|
169
|
-
baseMintKeypair,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* 将 Wavebreak Bundle 结果转换为后端 API 请求格式
|
|
174
|
-
*/
|
|
175
|
-
export function toWavebreakBundleApiRequest(result) {
|
|
176
|
-
const transactions = result.signedTransactions.map(tx => {
|
|
177
|
-
return Buffer.from(tx.serialize()).toString('base64');
|
|
178
|
-
});
|
|
179
|
-
return {
|
|
180
|
-
transactions,
|
|
181
|
-
metadata: {
|
|
182
|
-
type: result.type,
|
|
183
|
-
bondingCurveAddress: result.bondingCurveAddress,
|
|
184
|
-
baseMint: result.baseMint,
|
|
185
|
-
tradeCount: result.tradeCount,
|
|
186
|
-
jitoTipLamports: result.jitoTipLamports,
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orca Wavebreak 类型定义
|
|
3
|
-
* Wavebreak 是 Orca 的代币发射平台(类似 Pump.fun)
|
|
4
|
-
*/
|
|
5
|
-
import type { Keypair, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
6
|
-
/**
|
|
7
|
-
* Wavebreak 创建代币参数
|
|
8
|
-
*/
|
|
9
|
-
export interface WavebreakCreateLaunchParams {
|
|
10
|
-
/** 代币名称 */
|
|
11
|
-
name: string;
|
|
12
|
-
/** 代币符号 */
|
|
13
|
-
symbol: string;
|
|
14
|
-
/** 元数据 URI (IPFS) */
|
|
15
|
-
uri: string;
|
|
16
|
-
/** 起始价格 (可选,使用默认曲线) */
|
|
17
|
-
startPrice?: bigint;
|
|
18
|
-
/** 结束价格 (可选) */
|
|
19
|
-
endPrice?: bigint;
|
|
20
|
-
/** 毕业目标 (SOL lamports,默认 85 SOL) */
|
|
21
|
-
graduationTarget?: bigint;
|
|
22
|
-
/** 发射时间 (Unix 时间戳,可选) */
|
|
23
|
-
launchTime?: bigint;
|
|
24
|
-
/** 毕业时间 (Unix 时间戳,可选) */
|
|
25
|
-
graduationTime?: bigint;
|
|
26
|
-
/** 基础代币分配比例 (bps,可选) */
|
|
27
|
-
baseAllocationBps?: number;
|
|
28
|
-
/** Quote Mint (默认 SOL) */
|
|
29
|
-
quoteMint?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Wavebreak 买入参数
|
|
33
|
-
*/
|
|
34
|
-
export interface WavebreakBuyParams {
|
|
35
|
-
/** Bonding Curve 地址或 Base Mint 地址 */
|
|
36
|
-
bondingCurveOrMint: string;
|
|
37
|
-
/** 买入金额 (SOL lamports) */
|
|
38
|
-
amountIn: bigint;
|
|
39
|
-
/** 是否允许部分成交 */
|
|
40
|
-
allowPartialFill?: boolean;
|
|
41
|
-
/** 滑点 (bps) */
|
|
42
|
-
slippageBps?: number;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Wavebreak 卖出参数
|
|
46
|
-
*/
|
|
47
|
-
export interface WavebreakSellParams {
|
|
48
|
-
/** Bonding Curve 地址或 Base Mint 地址 */
|
|
49
|
-
bondingCurveOrMint: string;
|
|
50
|
-
/** 卖出代币数量 */
|
|
51
|
-
amountIn: bigint;
|
|
52
|
-
/** 是否允许部分成交 */
|
|
53
|
-
allowPartialFill?: boolean;
|
|
54
|
-
/** 滑点 (bps) */
|
|
55
|
-
slippageBps?: number;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Wavebreak Bonding Curve 信息
|
|
59
|
-
*/
|
|
60
|
-
export interface WavebreakBondingCurveInfo {
|
|
61
|
-
/** Bonding Curve 地址 */
|
|
62
|
-
bondingCurveAddress: string;
|
|
63
|
-
/** 基础代币地址 */
|
|
64
|
-
baseMint: string;
|
|
65
|
-
/** Quote 代币地址 (通常是 SOL) */
|
|
66
|
-
quoteMint: string;
|
|
67
|
-
/** 创建者地址 */
|
|
68
|
-
creator: string;
|
|
69
|
-
/** 当前 Quote 金额 (SOL lamports) */
|
|
70
|
-
quoteAmount: bigint;
|
|
71
|
-
/** 当前 Base 金额 */
|
|
72
|
-
baseAmount: bigint;
|
|
73
|
-
/** 起始价格 */
|
|
74
|
-
startPrice: bigint;
|
|
75
|
-
/** 结束价格 */
|
|
76
|
-
endPrice: bigint;
|
|
77
|
-
/** 毕业目标 */
|
|
78
|
-
graduationTarget: bigint;
|
|
79
|
-
/** 发射时间 */
|
|
80
|
-
launchTime: bigint;
|
|
81
|
-
/** 毕业时间 */
|
|
82
|
-
graduationTime: bigint;
|
|
83
|
-
/** 交换费率 (bps) */
|
|
84
|
-
swapFeeBps: number;
|
|
85
|
-
/** 是否已毕业 */
|
|
86
|
-
isGraduated: boolean;
|
|
87
|
-
/** 当前价格 */
|
|
88
|
-
currentPrice: number;
|
|
89
|
-
/** 进度百分比 */
|
|
90
|
-
progressPercent: number;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Wavebreak 买入报价
|
|
94
|
-
*/
|
|
95
|
-
export interface WavebreakBuyQuote {
|
|
96
|
-
/** 输入金额 (SOL) */
|
|
97
|
-
amountIn: bigint;
|
|
98
|
-
/** 输出金额 (代币) */
|
|
99
|
-
amountOut: bigint;
|
|
100
|
-
/** 费用金额 */
|
|
101
|
-
feeAmount: bigint;
|
|
102
|
-
/** 价格影响 */
|
|
103
|
-
priceImpact: number;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Wavebreak 卖出报价
|
|
107
|
-
*/
|
|
108
|
-
export interface WavebreakSellQuote {
|
|
109
|
-
/** 输入金额 (代币) */
|
|
110
|
-
amountIn: bigint;
|
|
111
|
-
/** 输出金额 (SOL) */
|
|
112
|
-
amountOut: bigint;
|
|
113
|
-
/** 费用金额 */
|
|
114
|
-
feeAmount: bigint;
|
|
115
|
-
/** 价格影响 */
|
|
116
|
-
priceImpact: number;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Wavebreak 签名结果
|
|
120
|
-
*/
|
|
121
|
-
export interface WavebreakSignedResult {
|
|
122
|
-
/** 签名后的交易 */
|
|
123
|
-
signedTransaction: Transaction | VersionedTransaction;
|
|
124
|
-
/** 交易类型 */
|
|
125
|
-
type: 'createLaunch' | 'buy' | 'sell' | 'collectFees' | 'graduate';
|
|
126
|
-
/** Bonding Curve 地址 */
|
|
127
|
-
bondingCurveAddress?: string;
|
|
128
|
-
/** Base Mint 地址 */
|
|
129
|
-
baseMint?: string;
|
|
130
|
-
/** 额外信息 */
|
|
131
|
-
metadata?: {
|
|
132
|
-
estimatedAmountOut?: string;
|
|
133
|
-
feeAmount?: string;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Wavebreak Bundle 买入参数
|
|
138
|
-
*/
|
|
139
|
-
export interface WavebreakBundleBuyParams {
|
|
140
|
-
/** Bonding Curve 地址或 Base Mint 地址 */
|
|
141
|
-
bondingCurveOrMint: string;
|
|
142
|
-
/** 交易列表 */
|
|
143
|
-
trades: {
|
|
144
|
-
/** 钱包 */
|
|
145
|
-
wallet: Keypair;
|
|
146
|
-
/** 买入金额 (SOL lamports) */
|
|
147
|
-
amountIn: bigint;
|
|
148
|
-
}[];
|
|
149
|
-
/** 滑点 (bps) */
|
|
150
|
-
slippageBps?: number;
|
|
151
|
-
/** Jito 小费 (lamports) */
|
|
152
|
-
jitoTipLamports?: number;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Wavebreak Bundle 卖出参数
|
|
156
|
-
*/
|
|
157
|
-
export interface WavebreakBundleSellParams {
|
|
158
|
-
/** Bonding Curve 地址或 Base Mint 地址 */
|
|
159
|
-
bondingCurveOrMint: string;
|
|
160
|
-
/** 交易列表 */
|
|
161
|
-
trades: {
|
|
162
|
-
/** 钱包 */
|
|
163
|
-
wallet: Keypair;
|
|
164
|
-
/** 卖出代币数量 */
|
|
165
|
-
amountIn: bigint;
|
|
166
|
-
}[];
|
|
167
|
-
/** 滑点 (bps) */
|
|
168
|
-
slippageBps?: number;
|
|
169
|
-
/** Jito 小费 (lamports) */
|
|
170
|
-
jitoTipLamports?: number;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Wavebreak Bundle 创建并买入参数
|
|
174
|
-
*/
|
|
175
|
-
export interface WavebreakBundleCreateAndBuyParams {
|
|
176
|
-
/** 创建参数 */
|
|
177
|
-
createParams: WavebreakCreateLaunchParams;
|
|
178
|
-
/** 创建者钱包 */
|
|
179
|
-
creator: Keypair;
|
|
180
|
-
/** 买入交易列表 */
|
|
181
|
-
buyTrades: {
|
|
182
|
-
/** 钱包 */
|
|
183
|
-
wallet: Keypair;
|
|
184
|
-
/** 买入金额 (SOL lamports) */
|
|
185
|
-
amountIn: bigint;
|
|
186
|
-
}[];
|
|
187
|
-
/** 滑点 (bps) */
|
|
188
|
-
slippageBps?: number;
|
|
189
|
-
/** Jito 小费 (lamports) */
|
|
190
|
-
jitoTipLamports?: number;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Wavebreak Bundle 签名结果
|
|
194
|
-
*/
|
|
195
|
-
export interface WavebreakBundleSignedResult {
|
|
196
|
-
/** 签名后的交易列表 */
|
|
197
|
-
signedTransactions: Transaction[];
|
|
198
|
-
/** Bundle 类型 */
|
|
199
|
-
type: 'bundleBuy' | 'bundleSell' | 'bundleCreateAndBuy';
|
|
200
|
-
/** Bonding Curve 地址 */
|
|
201
|
-
bondingCurveAddress: string;
|
|
202
|
-
/** Base Mint 地址 */
|
|
203
|
-
baseMint?: string;
|
|
204
|
-
/** 交易数量 */
|
|
205
|
-
tradeCount: number;
|
|
206
|
-
/** Jito 小费 */
|
|
207
|
-
jitoTipLamports: number;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Wavebreak 常量
|
|
211
|
-
*/
|
|
212
|
-
export declare const WAVEBREAK_CONSTANTS: {
|
|
213
|
-
/** Program ID */
|
|
214
|
-
readonly PROGRAM_ID: "waveQX2yP3H1pVU8djGvEHmYg8uamQ84AuyGtpsrXTF";
|
|
215
|
-
/** 默认毕业目标 (85 SOL) */
|
|
216
|
-
readonly DEFAULT_GRADUATION_TARGET: bigint;
|
|
217
|
-
/** SOL Mint (Wrapped SOL) */
|
|
218
|
-
readonly SOL_MINT: "So11111111111111111111111111111111111111112";
|
|
219
|
-
/** Token-2022 Program ID */
|
|
220
|
-
readonly TOKEN_2022_PROGRAM_ID: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
221
|
-
/** Token Program ID */
|
|
222
|
-
readonly TOKEN_PROGRAM_ID: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
223
|
-
/** ATA Program ID */
|
|
224
|
-
readonly ATA_PROGRAM_ID: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
225
|
-
/** Metaplex Token Metadata Program ID */
|
|
226
|
-
readonly METAPLEX_PROGRAM_ID: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
227
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orca Wavebreak 类型定义
|
|
3
|
-
* Wavebreak 是 Orca 的代币发射平台(类似 Pump.fun)
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Wavebreak 常量
|
|
7
|
-
*/
|
|
8
|
-
export const WAVEBREAK_CONSTANTS = {
|
|
9
|
-
/** Program ID */
|
|
10
|
-
PROGRAM_ID: 'waveQX2yP3H1pVU8djGvEHmYg8uamQ84AuyGtpsrXTF',
|
|
11
|
-
/** 默认毕业目标 (85 SOL) */
|
|
12
|
-
DEFAULT_GRADUATION_TARGET: BigInt(85000000000),
|
|
13
|
-
/** SOL Mint (Wrapped SOL) */
|
|
14
|
-
SOL_MINT: 'So11111111111111111111111111111111111111112',
|
|
15
|
-
/** Token-2022 Program ID */
|
|
16
|
-
TOKEN_2022_PROGRAM_ID: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
|
|
17
|
-
/** Token Program ID */
|
|
18
|
-
TOKEN_PROGRAM_ID: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
|
|
19
|
-
/** ATA Program ID */
|
|
20
|
-
ATA_PROGRAM_ID: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
21
|
-
/** Metaplex Token Metadata Program ID */
|
|
22
|
-
METAPLEX_PROGRAM_ID: 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s',
|
|
23
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orca Wavebreak 核心功能
|
|
3
|
-
* Wavebreak 是 Orca 的代币发射平台(类似 Pump.fun)
|
|
4
|
-
*
|
|
5
|
-
* 由于 Wavebreak SDK 使用 @solana/kit(与 @solana/web3.js 类型不兼容),
|
|
6
|
-
* 我们使用 SDK 的编码器和数学函数,但手动构建 @solana/web3.js 的交易指令。
|
|
7
|
-
*/
|
|
8
|
-
import { Connection, PublicKey, Keypair, TransactionInstruction } from '@solana/web3.js';
|
|
9
|
-
import type { WavebreakCreateLaunchParams, WavebreakBuyParams, WavebreakSellParams, WavebreakBondingCurveInfo, WavebreakBuyQuote, WavebreakSellQuote, WavebreakSignedResult } from './wavebreak-types.js';
|
|
10
|
-
/**
|
|
11
|
-
* 计算 Bonding Curve PDA 地址
|
|
12
|
-
*/
|
|
13
|
-
export declare function getWavebreakBondingCurveAddress(baseMint: PublicKey | string): Promise<PublicKey>;
|
|
14
|
-
/**
|
|
15
|
-
* 同步计算 Bonding Curve PDA 地址(使用 @solana/web3.js)
|
|
16
|
-
*/
|
|
17
|
-
export declare function getWavebreakBondingCurveAddressSync(baseMint: PublicKey | string): PublicKey;
|
|
18
|
-
/**
|
|
19
|
-
* 计算 Quote Vault PDA 地址
|
|
20
|
-
*/
|
|
21
|
-
export declare function getWavebreakQuoteVaultAddressSync(bondingCurve: PublicKey | string): PublicKey;
|
|
22
|
-
/**
|
|
23
|
-
* 计算 LP Escrow PDA 地址
|
|
24
|
-
*/
|
|
25
|
-
export declare function getWavebreakLpEscrowAddressSync(bondingCurve: PublicKey | string): PublicKey;
|
|
26
|
-
/**
|
|
27
|
-
* 获取 Wavebreak Bonding Curve 信息
|
|
28
|
-
*/
|
|
29
|
-
export declare function getWavebreakBondingCurveInfo(bondingCurveOrMint: string, connection?: Connection): Promise<WavebreakBondingCurveInfo | null>;
|
|
30
|
-
/**
|
|
31
|
-
* 获取买入报价
|
|
32
|
-
*/
|
|
33
|
-
export declare function getWavebreakBuyQuote(bondingCurveOrMint: string, amountIn: bigint, connection?: Connection): Promise<WavebreakBuyQuote | null>;
|
|
34
|
-
/**
|
|
35
|
-
* 获取卖出报价
|
|
36
|
-
*/
|
|
37
|
-
export declare function getWavebreakSellQuote(bondingCurveOrMint: string, amountIn: bigint, connection?: Connection): Promise<WavebreakSellQuote | null>;
|
|
38
|
-
/**
|
|
39
|
-
* 构建 Wavebreak 买入交易指令
|
|
40
|
-
*
|
|
41
|
-
* 使用 SDK 的编码器生成正确的指令数据
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildWavebreakBuyInstruction(params: WavebreakBuyParams, buyer: PublicKey, connection?: Connection): Promise<TransactionInstruction>;
|
|
44
|
-
/**
|
|
45
|
-
* 构建 Wavebreak 卖出交易指令
|
|
46
|
-
*/
|
|
47
|
-
export declare function buildWavebreakSellInstruction(params: WavebreakSellParams, seller: PublicKey, connection?: Connection): Promise<TransactionInstruction>;
|
|
48
|
-
/**
|
|
49
|
-
* 构建 Wavebreak 创建代币发射指令
|
|
50
|
-
*/
|
|
51
|
-
export declare function buildWavebreakCreateLaunchInstruction(params: WavebreakCreateLaunchParams, creator: PublicKey, baseMintKeypair: Keypair, connection?: Connection): Promise<TransactionInstruction>;
|
|
52
|
-
/**
|
|
53
|
-
* 签名 Wavebreak 买入交易
|
|
54
|
-
*/
|
|
55
|
-
export declare function signWavebreakBuy(params: WavebreakBuyParams, payer: Keypair, connection?: Connection): Promise<WavebreakSignedResult>;
|
|
56
|
-
/**
|
|
57
|
-
* 签名 Wavebreak 卖出交易
|
|
58
|
-
*/
|
|
59
|
-
export declare function signWavebreakSell(params: WavebreakSellParams, payer: Keypair, connection?: Connection): Promise<WavebreakSignedResult>;
|
|
60
|
-
/**
|
|
61
|
-
* 签名 Wavebreak 创建代币发射交易
|
|
62
|
-
*/
|
|
63
|
-
export declare function signWavebreakCreateLaunch(params: WavebreakCreateLaunchParams, creator: Keypair, connection?: Connection): Promise<WavebreakSignedResult & {
|
|
64
|
-
baseMintKeypair: Keypair;
|
|
65
|
-
}>;
|
|
66
|
-
/**
|
|
67
|
-
* 将签名结果转换为后端 API 请求格式
|
|
68
|
-
*/
|
|
69
|
-
export declare function toWavebreakApiRequest(result: WavebreakSignedResult): {
|
|
70
|
-
transaction: string;
|
|
71
|
-
metadata: {
|
|
72
|
-
type: string;
|
|
73
|
-
bondingCurveAddress?: string;
|
|
74
|
-
baseMint?: string;
|
|
75
|
-
estimatedAmountOut?: string;
|
|
76
|
-
feeAmount?: string;
|
|
77
|
-
};
|
|
78
|
-
};
|