four-flap-meme-sdk 1.5.58 → 1.5.60
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.zh-CN.pdf +0 -0
- package/dist/dex/direct-router.js +2 -2
- package/dist/flap/portal-bundle-merkle/encryption.d.ts +16 -0
- package/dist/flap/portal-bundle-merkle/encryption.js +146 -0
- package/dist/flap/portal-bundle-merkle/private.js +2 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/utils/contract-factory.js +6 -6
- package/dist/utils/provider-factory.d.ts +39 -0
- package/dist/utils/provider-factory.js +101 -0
- package/dist/xlayer/portal-ops.js +1 -0
- package/package.json +5 -44
- package/dist/sol/constants.d.ts +0 -150
- package/dist/sol/constants.js +0 -188
- package/dist/sol/dex/blockrazor/client.d.ts +0 -51
- package/dist/sol/dex/blockrazor/client.js +0 -96
- package/dist/sol/dex/blockrazor/constants.d.ts +0 -34
- package/dist/sol/dex/blockrazor/constants.js +0 -55
- package/dist/sol/dex/blockrazor/geyser.d.ts +0 -128
- package/dist/sol/dex/blockrazor/geyser.js +0 -530
- package/dist/sol/dex/blockrazor/index.d.ts +0 -18
- package/dist/sol/dex/blockrazor/index.js +0 -23
- package/dist/sol/dex/blockrazor/send.d.ts +0 -135
- package/dist/sol/dex/blockrazor/send.js +0 -254
- package/dist/sol/dex/blockrazor/types.d.ts +0 -191
- package/dist/sol/dex/blockrazor/types.js +0 -5
- package/dist/sol/dex/index.d.ts +0 -10
- package/dist/sol/dex/index.js +0 -16
- package/dist/sol/dex/jup/client.d.ts +0 -33
- package/dist/sol/dex/jup/client.js +0 -110
- package/dist/sol/dex/jup/index.d.ts +0 -16
- package/dist/sol/dex/jup/index.js +0 -148
- package/dist/sol/dex/jup/legacy.d.ts +0 -623
- package/dist/sol/dex/jup/legacy.js +0 -416
- package/dist/sol/dex/jup/lend.d.ts +0 -640
- package/dist/sol/dex/jup/lend.js +0 -603
- package/dist/sol/dex/jup/portfolio.d.ts +0 -362
- package/dist/sol/dex/jup/portfolio.js +0 -367
- package/dist/sol/dex/jup/price.d.ts +0 -173
- package/dist/sol/dex/jup/price.js +0 -220
- package/dist/sol/dex/jup/recurring.d.ts +0 -437
- package/dist/sol/dex/jup/recurring.js +0 -320
- package/dist/sol/dex/jup/send.d.ts +0 -282
- package/dist/sol/dex/jup/send.js +0 -295
- package/dist/sol/dex/jup/studio.d.ts +0 -457
- package/dist/sol/dex/jup/studio.js +0 -488
- package/dist/sol/dex/jup/tokens.d.ts +0 -767
- package/dist/sol/dex/jup/tokens.js +0 -697
- package/dist/sol/dex/jup/trigger.d.ts +0 -511
- package/dist/sol/dex/jup/trigger.js +0 -397
- package/dist/sol/dex/jup/types.d.ts +0 -433
- package/dist/sol/dex/jup/types.js +0 -5
- package/dist/sol/dex/jup/ultra.d.ts +0 -646
- package/dist/sol/dex/jup/ultra.js +0 -853
- package/dist/sol/dex/meteora/client.d.ts +0 -76
- package/dist/sol/dex/meteora/client.js +0 -219
- 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 -157
- package/dist/sol/dex/meteora/dlmm.js +0 -671
- 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 -173
- package/dist/sol/dex/orca/orca.d.ts +0 -65
- package/dist/sol/dex/orca/orca.js +0 -474
- 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 -198
- 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 -497
- 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 -11
- package/dist/sol/index.js +0 -18
- 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/nozomi/client.d.ts +0 -63
- package/dist/sol/nozomi/client.js +0 -222
- package/dist/sol/nozomi/index.d.ts +0 -8
- package/dist/sol/nozomi/index.js +0 -8
- package/dist/sol/nozomi/tip.d.ts +0 -50
- package/dist/sol/nozomi/tip.js +0 -80
- package/dist/sol/nozomi/types.d.ts +0 -96
- package/dist/sol/nozomi/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 -78
- package/dist/sol/utils/connection.js +0 -168
- 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 -80
- package/dist/sol/utils/lp-inspect.js +0 -256
- package/dist/sol/utils/transfer.d.ts +0 -196
- package/dist/sol/utils/transfer.js +0 -307
- package/dist/sol/utils/wallet.d.ts +0 -107
- package/dist/sol/utils/wallet.js +0 -210
package/README.zh-CN.pdf
ADDED
|
Binary file
|
|
@@ -32,8 +32,8 @@ function getCachedProvider(rpcUrl, chainId, chainName) {
|
|
|
32
32
|
if (cachedProvider && (now - timestamp) < PROVIDER_CACHE_TTL) {
|
|
33
33
|
return cachedProvider;
|
|
34
34
|
}
|
|
35
|
-
//
|
|
36
|
-
const provider = new JsonRpcProvider(rpcUrl, { chainId, name: chainName });
|
|
35
|
+
// ✅ 禁用 ENS: 避免 "network does not support ENS" 错误
|
|
36
|
+
const provider = new JsonRpcProvider(rpcUrl, { chainId, name: chainName, ensAddress: undefined });
|
|
37
37
|
providerCache.set(cacheKey, provider);
|
|
38
38
|
providerCacheTimestamps.set(cacheKey, now);
|
|
39
39
|
return provider;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECDH + AES-GCM 加密工具(浏览器兼容)
|
|
3
|
+
* 用于将签名交易用服务器公钥加密
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 用服务器公钥加密签名交易(ECDH + AES-GCM)
|
|
7
|
+
*
|
|
8
|
+
* @param signedTransactions 签名后的交易数组
|
|
9
|
+
* @param publicKeyBase64 服务器提供的公钥(Base64 格式)
|
|
10
|
+
* @returns JSON 字符串 {e: 临时公钥, i: IV, d: 密文}
|
|
11
|
+
*/
|
|
12
|
+
export declare function encryptWithPublicKey(signedTransactions: string[], publicKeyBase64: string): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* 验证公钥格式(Base64)
|
|
15
|
+
*/
|
|
16
|
+
export declare function validatePublicKey(publicKeyBase64: string): boolean;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECDH + AES-GCM 加密工具(浏览器兼容)
|
|
3
|
+
* 用于将签名交易用服务器公钥加密
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 获取全局 crypto 对象(最简单直接的方式)
|
|
7
|
+
*/
|
|
8
|
+
function getCryptoAPI() {
|
|
9
|
+
// 尝试所有可能的全局对象,优先浏览器环境
|
|
10
|
+
const cryptoObj = (typeof window !== 'undefined' && window.crypto) ||
|
|
11
|
+
(typeof self !== 'undefined' && self.crypto) ||
|
|
12
|
+
(typeof global !== 'undefined' && global.crypto) ||
|
|
13
|
+
(typeof globalThis !== 'undefined' && globalThis.crypto);
|
|
14
|
+
if (!cryptoObj) {
|
|
15
|
+
const env = typeof window !== 'undefined' ? 'Browser' : 'Node.js';
|
|
16
|
+
const protocol = typeof location !== 'undefined' ? location.protocol : 'unknown';
|
|
17
|
+
throw new Error(`❌ Crypto API 不可用。环境: ${env}, 协议: ${protocol}. ` +
|
|
18
|
+
'请确保在 HTTPS 或 localhost 下运行');
|
|
19
|
+
}
|
|
20
|
+
return cryptoObj;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 获取 SubtleCrypto(用于加密操作)
|
|
24
|
+
*/
|
|
25
|
+
function getSubtleCrypto() {
|
|
26
|
+
const crypto = getCryptoAPI();
|
|
27
|
+
if (!crypto.subtle) {
|
|
28
|
+
const protocol = typeof location !== 'undefined' ? location.protocol : 'unknown';
|
|
29
|
+
const hostname = typeof location !== 'undefined' ? location.hostname : 'unknown';
|
|
30
|
+
throw new Error(`❌ SubtleCrypto API 不可用。协议: ${protocol}, 主机: ${hostname}. ` +
|
|
31
|
+
'请确保:1) 使用 HTTPS (或 localhost);2) 浏览器支持 Web Crypto API;' +
|
|
32
|
+
'3) 不在无痕/隐私浏览模式下');
|
|
33
|
+
}
|
|
34
|
+
return crypto.subtle;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Base64 转 ArrayBuffer(优先使用浏览器 API)
|
|
38
|
+
*/
|
|
39
|
+
function base64ToArrayBuffer(base64) {
|
|
40
|
+
// 浏览器环境(优先)
|
|
41
|
+
if (typeof atob !== 'undefined') {
|
|
42
|
+
const binaryString = atob(base64);
|
|
43
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
44
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
45
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
46
|
+
}
|
|
47
|
+
return bytes.buffer;
|
|
48
|
+
}
|
|
49
|
+
// Node.js 环境(fallback)
|
|
50
|
+
if (typeof Buffer !== 'undefined') {
|
|
51
|
+
return Buffer.from(base64, 'base64').buffer;
|
|
52
|
+
}
|
|
53
|
+
throw new Error('❌ Base64 解码不可用');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* ArrayBuffer 转 Base64(优先使用浏览器 API)
|
|
57
|
+
*/
|
|
58
|
+
function arrayBufferToBase64(buffer) {
|
|
59
|
+
// 浏览器环境(优先)
|
|
60
|
+
if (typeof btoa !== 'undefined') {
|
|
61
|
+
const bytes = new Uint8Array(buffer);
|
|
62
|
+
let binary = '';
|
|
63
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
64
|
+
binary += String.fromCharCode(bytes[i]);
|
|
65
|
+
}
|
|
66
|
+
return btoa(binary);
|
|
67
|
+
}
|
|
68
|
+
// Node.js 环境(fallback)
|
|
69
|
+
if (typeof Buffer !== 'undefined') {
|
|
70
|
+
return Buffer.from(buffer).toString('base64');
|
|
71
|
+
}
|
|
72
|
+
throw new Error('❌ Base64 编码不可用');
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 生成随机 Hex 字符串
|
|
76
|
+
*/
|
|
77
|
+
function randomHex(length) {
|
|
78
|
+
const crypto = getCryptoAPI();
|
|
79
|
+
const array = new Uint8Array(length);
|
|
80
|
+
crypto.getRandomValues(array);
|
|
81
|
+
return Array.from(array)
|
|
82
|
+
.map(b => b.toString(16).padStart(2, '0'))
|
|
83
|
+
.join('');
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 用服务器公钥加密签名交易(ECDH + AES-GCM)
|
|
87
|
+
*
|
|
88
|
+
* @param signedTransactions 签名后的交易数组
|
|
89
|
+
* @param publicKeyBase64 服务器提供的公钥(Base64 格式)
|
|
90
|
+
* @returns JSON 字符串 {e: 临时公钥, i: IV, d: 密文}
|
|
91
|
+
*/
|
|
92
|
+
export async function encryptWithPublicKey(signedTransactions, publicKeyBase64) {
|
|
93
|
+
try {
|
|
94
|
+
// 0. 获取 SubtleCrypto 和 Crypto API
|
|
95
|
+
const subtle = getSubtleCrypto();
|
|
96
|
+
const crypto = getCryptoAPI();
|
|
97
|
+
// 1. 准备数据
|
|
98
|
+
const payload = {
|
|
99
|
+
signedTransactions,
|
|
100
|
+
timestamp: Date.now(),
|
|
101
|
+
nonce: randomHex(8)
|
|
102
|
+
};
|
|
103
|
+
const plaintext = JSON.stringify(payload);
|
|
104
|
+
// 2. 生成临时 ECDH 密钥对
|
|
105
|
+
const ephemeralKeyPair = await subtle.generateKey({ name: 'ECDH', namedCurve: 'P-256' }, true, ['deriveKey']);
|
|
106
|
+
// 3. 导入服务器公钥
|
|
107
|
+
const publicKeyBuffer = base64ToArrayBuffer(publicKeyBase64);
|
|
108
|
+
const publicKey = await subtle.importKey('raw', publicKeyBuffer, { name: 'ECDH', namedCurve: 'P-256' }, false, []);
|
|
109
|
+
// 4. 派生共享密钥(AES-256)
|
|
110
|
+
const sharedKey = await subtle.deriveKey({ name: 'ECDH', public: publicKey }, ephemeralKeyPair.privateKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt']);
|
|
111
|
+
// 5. AES-GCM 加密
|
|
112
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
113
|
+
const encrypted = await subtle.encrypt({ name: 'AES-GCM', iv }, sharedKey, new TextEncoder().encode(plaintext));
|
|
114
|
+
// 6. 导出临时公钥
|
|
115
|
+
const ephemeralPublicKeyRaw = await subtle.exportKey('raw', ephemeralKeyPair.publicKey);
|
|
116
|
+
// 7. 返回加密包(JSON 格式)
|
|
117
|
+
return JSON.stringify({
|
|
118
|
+
e: arrayBufferToBase64(ephemeralPublicKeyRaw), // 临时公钥
|
|
119
|
+
i: arrayBufferToBase64(iv.buffer), // IV
|
|
120
|
+
d: arrayBufferToBase64(encrypted) // 密文
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
throw new Error(`加密失败: ${error?.message || String(error)}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 验证公钥格式(Base64)
|
|
129
|
+
*/
|
|
130
|
+
export function validatePublicKey(publicKeyBase64) {
|
|
131
|
+
try {
|
|
132
|
+
if (!publicKeyBase64)
|
|
133
|
+
return false;
|
|
134
|
+
// Base64 字符集验证
|
|
135
|
+
if (!/^[A-Za-z0-9+/=]+$/.test(publicKeyBase64))
|
|
136
|
+
return false;
|
|
137
|
+
// ECDH P-256 公钥固定长度 65 字节(未压缩)
|
|
138
|
+
// Base64 编码后约 88 字符
|
|
139
|
+
if (publicKeyBase64.length < 80 || publicKeyBase64.length > 100)
|
|
140
|
+
return false;
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -385,9 +385,10 @@ function createMerkleContext(chain, config) {
|
|
|
385
385
|
throw new Error(`Chain ${chain} (chainId: ${chainId}) does not support Merkle bundle service. Please provide customRpcUrl.`);
|
|
386
386
|
}
|
|
387
387
|
const { JsonRpcProvider } = require('ethers');
|
|
388
|
+
// ✅ 禁用 ENS: 避免 "network does not support ENS" 错误
|
|
388
389
|
return {
|
|
389
390
|
chainId,
|
|
390
|
-
provider: new JsonRpcProvider(config.customRpcUrl, { chainId, name: chain.toLowerCase() })
|
|
391
|
+
provider: new JsonRpcProvider(config.customRpcUrl, { chainId, name: chain.toLowerCase(), ensAddress: undefined })
|
|
391
392
|
};
|
|
392
393
|
}
|
|
393
394
|
const merkle = new MerkleClient({
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * as Abis from './abis/index.js';
|
|
2
|
-
export * as Sol from './sol/index.js';
|
|
3
2
|
export { ERC20_ABI, ERC20_BALANCE_ABI, ERC20_ALLOWANCE_ABI, MULTICALL3_ABI, V2_ROUTER_ABI, V2_ROUTER_QUOTE_ABI, V3_ROUTER02_ABI, V3_ROUTER_LEGACY_ABI, V3_QUOTER_ABI, V2_FACTORY_ABI, V2_PAIR_ABI, V3_FACTORY_ABI, V3_POOL_ABI, FLAP_PORTAL_ABI, TM2_ABI, HELPER3_ABI, } from './abis/common.js';
|
|
4
3
|
export { ADDRESSES, CHAIN, BLOCKRAZOR_BUILDER_EOA as BUILDER_EOA, ZERO_ADDRESS as COMMON_ZERO_ADDRESS, DEFAULT_DEADLINE_MINUTES, V3_FEE_TIERS as COMMON_V3_FEE_TIERS, } from './utils/constants.js';
|
|
5
4
|
export { isExclusiveOnChain, isExclusiveOffChain } from './utils/mpcExclusive.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// 公共 ABI(统一管理)
|
|
3
3
|
// ============================================================================
|
|
4
4
|
export * as Abis from './abis/index.js';
|
|
5
|
-
export * as Sol from './sol/index.js';
|
|
5
|
+
// export * as Sol from './sol/index.js';
|
|
6
6
|
export { ERC20_ABI, ERC20_BALANCE_ABI, ERC20_ALLOWANCE_ABI, MULTICALL3_ABI, V2_ROUTER_ABI, V2_ROUTER_QUOTE_ABI, V3_ROUTER02_ABI, V3_ROUTER_LEGACY_ABI, V3_QUOTER_ABI, V2_FACTORY_ABI, V2_PAIR_ABI, V3_FACTORY_ABI, V3_POOL_ABI, FLAP_PORTAL_ABI, TM2_ABI, HELPER3_ABI, } from './abis/common.js';
|
|
7
7
|
// ============================================================================
|
|
8
8
|
// 公共常量(统一管理)
|
|
@@ -6,7 +6,7 @@ import { ADDRESSES } from './constants.js';
|
|
|
6
6
|
* 自动使用正确的代理合约地址
|
|
7
7
|
*/
|
|
8
8
|
export function getTokenManagerV1(chain, rpcUrl) {
|
|
9
|
-
const provider = new JsonRpcProvider(rpcUrl);
|
|
9
|
+
const provider = new JsonRpcProvider(rpcUrl, undefined); // ✅ 禁用 ENS
|
|
10
10
|
const chainAddresses = ADDRESSES[chain];
|
|
11
11
|
const address = 'TokenManagerV1' in chainAddresses ? chainAddresses.TokenManagerV1 : undefined;
|
|
12
12
|
if (!address) {
|
|
@@ -19,7 +19,7 @@ export function getTokenManagerV1(chain, rpcUrl) {
|
|
|
19
19
|
* 自动使用正确的代理合约地址
|
|
20
20
|
*/
|
|
21
21
|
export function getTokenManagerV2(chain, rpcUrl) {
|
|
22
|
-
const provider = new JsonRpcProvider(rpcUrl);
|
|
22
|
+
const provider = new JsonRpcProvider(rpcUrl, undefined); // ✅ 禁用 ENS
|
|
23
23
|
const chainAddresses = ADDRESSES[chain];
|
|
24
24
|
const address = 'TokenManagerV2' in chainAddresses ? chainAddresses.TokenManagerV2 : undefined;
|
|
25
25
|
if (!address) {
|
|
@@ -32,7 +32,7 @@ export function getTokenManagerV2(chain, rpcUrl) {
|
|
|
32
32
|
* 自动使用正确的代理合约地址
|
|
33
33
|
*/
|
|
34
34
|
export function getTokenManagerHelper3(chain, rpcUrl) {
|
|
35
|
-
const provider = new JsonRpcProvider(rpcUrl);
|
|
35
|
+
const provider = new JsonRpcProvider(rpcUrl, undefined); // ✅ 禁用 ENS
|
|
36
36
|
const address = ADDRESSES[chain].TokenManagerHelper3;
|
|
37
37
|
if (!address) {
|
|
38
38
|
throw new Error(`TokenManagerHelper3 not deployed on ${chain}`);
|
|
@@ -44,7 +44,7 @@ export function getTokenManagerHelper3(chain, rpcUrl) {
|
|
|
44
44
|
* 自动使用正确的代理合约地址
|
|
45
45
|
*/
|
|
46
46
|
export function getTokenManagerV1Writer(chain, rpcUrl, privateKey) {
|
|
47
|
-
const provider = new JsonRpcProvider(rpcUrl);
|
|
47
|
+
const provider = new JsonRpcProvider(rpcUrl, undefined); // ✅ 禁用 ENS
|
|
48
48
|
const signer = new Wallet(privateKey, provider);
|
|
49
49
|
const chainAddresses = ADDRESSES[chain];
|
|
50
50
|
const address = 'TokenManagerV1' in chainAddresses ? chainAddresses.TokenManagerV1 : undefined;
|
|
@@ -58,7 +58,7 @@ export function getTokenManagerV1Writer(chain, rpcUrl, privateKey) {
|
|
|
58
58
|
* 自动使用正确的代理合约地址
|
|
59
59
|
*/
|
|
60
60
|
export function getTokenManagerV2Writer(chain, rpcUrl, privateKey) {
|
|
61
|
-
const provider = new JsonRpcProvider(rpcUrl);
|
|
61
|
+
const provider = new JsonRpcProvider(rpcUrl, undefined); // ✅ 禁用 ENS
|
|
62
62
|
const signer = new Wallet(privateKey, provider);
|
|
63
63
|
const chainAddresses = ADDRESSES[chain];
|
|
64
64
|
const address = 'TokenManagerV2' in chainAddresses ? chainAddresses.TokenManagerV2 : undefined;
|
|
@@ -72,7 +72,7 @@ export function getTokenManagerV2Writer(chain, rpcUrl, privateKey) {
|
|
|
72
72
|
* 自动使用正确的代理合约地址
|
|
73
73
|
*/
|
|
74
74
|
export function getTokenManagerHelper3Writer(chain, rpcUrl, privateKey) {
|
|
75
|
-
const provider = new JsonRpcProvider(rpcUrl);
|
|
75
|
+
const provider = new JsonRpcProvider(rpcUrl, undefined); // ✅ 禁用 ENS
|
|
76
76
|
const signer = new Wallet(privateKey, provider);
|
|
77
77
|
const address = ADDRESSES[chain].TokenManagerHelper3;
|
|
78
78
|
if (!address) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider 工厂函数 - 统一创建 JsonRpcProvider 并禁用 ENS
|
|
3
|
+
*
|
|
4
|
+
* 目的:
|
|
5
|
+
* 1. 避免 "network does not support ENS" 错误
|
|
6
|
+
* 2. 统一 Provider 创建逻辑
|
|
7
|
+
* 3. 提升性能 (跳过 ENS 解析)
|
|
8
|
+
*/
|
|
9
|
+
import { JsonRpcProvider } from 'ethers';
|
|
10
|
+
/**
|
|
11
|
+
* 创建 JsonRpcProvider (自动禁用 ENS)
|
|
12
|
+
*
|
|
13
|
+
* @param rpcUrl RPC URL
|
|
14
|
+
* @param chainId 链 ID (可选)
|
|
15
|
+
* @param chainName 链名称 (可选,用于日志)
|
|
16
|
+
* @param options 额外选项
|
|
17
|
+
* @returns JsonRpcProvider 实例
|
|
18
|
+
*/
|
|
19
|
+
export declare function createProvider(rpcUrl: string, chainId?: number, chainName?: string, options?: {
|
|
20
|
+
batchMaxCount?: number;
|
|
21
|
+
batchStallTime?: number;
|
|
22
|
+
}): JsonRpcProvider;
|
|
23
|
+
export declare function createCachedProvider(rpcUrl: string, chainId: number, chainName?: string): JsonRpcProvider;
|
|
24
|
+
/**
|
|
25
|
+
* 清除 Provider 缓存
|
|
26
|
+
*/
|
|
27
|
+
export declare function clearProviderCache(): void;
|
|
28
|
+
/**
|
|
29
|
+
* XLayer 专用 Provider 创建函数
|
|
30
|
+
*/
|
|
31
|
+
export declare function createXLayerProvider(rpcUrl: string): JsonRpcProvider;
|
|
32
|
+
/**
|
|
33
|
+
* BSC 专用 Provider 创建函数
|
|
34
|
+
*/
|
|
35
|
+
export declare function createBscProvider(rpcUrl: string): JsonRpcProvider;
|
|
36
|
+
/**
|
|
37
|
+
* Monad 专用 Provider 创建函数
|
|
38
|
+
*/
|
|
39
|
+
export declare function createMonadProvider(rpcUrl: string): JsonRpcProvider;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider 工厂函数 - 统一创建 JsonRpcProvider 并禁用 ENS
|
|
3
|
+
*
|
|
4
|
+
* 目的:
|
|
5
|
+
* 1. 避免 "network does not support ENS" 错误
|
|
6
|
+
* 2. 统一 Provider 创建逻辑
|
|
7
|
+
* 3. 提升性能 (跳过 ENS 解析)
|
|
8
|
+
*/
|
|
9
|
+
import { JsonRpcProvider } from 'ethers';
|
|
10
|
+
/**
|
|
11
|
+
* 创建 JsonRpcProvider (自动禁用 ENS)
|
|
12
|
+
*
|
|
13
|
+
* @param rpcUrl RPC URL
|
|
14
|
+
* @param chainId 链 ID (可选)
|
|
15
|
+
* @param chainName 链名称 (可选,用于日志)
|
|
16
|
+
* @param options 额外选项
|
|
17
|
+
* @returns JsonRpcProvider 实例
|
|
18
|
+
*/
|
|
19
|
+
export function createProvider(rpcUrl, chainId, chainName, options) {
|
|
20
|
+
// 构建网络配置
|
|
21
|
+
const networkConfig = chainId
|
|
22
|
+
? {
|
|
23
|
+
chainId,
|
|
24
|
+
name: chainName || `chain-${chainId}`,
|
|
25
|
+
ensAddress: undefined, // ✅ 禁用 ENS 解析
|
|
26
|
+
}
|
|
27
|
+
: undefined;
|
|
28
|
+
// 构建批处理选项
|
|
29
|
+
const batchOptions = options
|
|
30
|
+
? {
|
|
31
|
+
batchMaxCount: options.batchMaxCount ?? 20,
|
|
32
|
+
batchStallTime: options.batchStallTime ?? 30,
|
|
33
|
+
}
|
|
34
|
+
: undefined;
|
|
35
|
+
// 创建 Provider
|
|
36
|
+
if (networkConfig && batchOptions) {
|
|
37
|
+
return new JsonRpcProvider(rpcUrl, networkConfig, batchOptions);
|
|
38
|
+
}
|
|
39
|
+
else if (networkConfig) {
|
|
40
|
+
return new JsonRpcProvider(rpcUrl, networkConfig);
|
|
41
|
+
}
|
|
42
|
+
else if (batchOptions) {
|
|
43
|
+
return new JsonRpcProvider(rpcUrl, undefined, batchOptions);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return new JsonRpcProvider(rpcUrl);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 创建带缓存的 Provider
|
|
51
|
+
*
|
|
52
|
+
* @param rpcUrl RPC URL
|
|
53
|
+
* @param chainId 链 ID
|
|
54
|
+
* @param chainName 链名称
|
|
55
|
+
* @returns JsonRpcProvider 实例
|
|
56
|
+
*/
|
|
57
|
+
const providerCache = new Map();
|
|
58
|
+
export function createCachedProvider(rpcUrl, chainId, chainName) {
|
|
59
|
+
const key = `${rpcUrl}:${chainId}`;
|
|
60
|
+
if (!providerCache.has(key)) {
|
|
61
|
+
const provider = createProvider(rpcUrl, chainId, chainName, {
|
|
62
|
+
batchMaxCount: 20,
|
|
63
|
+
batchStallTime: 30,
|
|
64
|
+
});
|
|
65
|
+
providerCache.set(key, provider);
|
|
66
|
+
}
|
|
67
|
+
return providerCache.get(key);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 清除 Provider 缓存
|
|
71
|
+
*/
|
|
72
|
+
export function clearProviderCache() {
|
|
73
|
+
providerCache.clear();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* XLayer 专用 Provider 创建函数
|
|
77
|
+
*/
|
|
78
|
+
export function createXLayerProvider(rpcUrl) {
|
|
79
|
+
return createProvider(rpcUrl, 196, 'xlayer', {
|
|
80
|
+
batchMaxCount: 20,
|
|
81
|
+
batchStallTime: 30,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* BSC 专用 Provider 创建函数
|
|
86
|
+
*/
|
|
87
|
+
export function createBscProvider(rpcUrl) {
|
|
88
|
+
return createProvider(rpcUrl, 56, 'bsc', {
|
|
89
|
+
batchMaxCount: 20,
|
|
90
|
+
batchStallTime: 30,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Monad 专用 Provider 创建函数
|
|
95
|
+
*/
|
|
96
|
+
export function createMonadProvider(rpcUrl) {
|
|
97
|
+
return createProvider(rpcUrl, 143, 'monad', {
|
|
98
|
+
batchMaxCount: 20,
|
|
99
|
+
batchStallTime: 30,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -100,6 +100,7 @@ export class PortalQuery {
|
|
|
100
100
|
constructor(config = {}) {
|
|
101
101
|
const rpcUrl = config.rpcUrl ?? DEFAULT_RPC_URL;
|
|
102
102
|
const chainId = config.chainId ?? XLAYER_CHAIN_ID;
|
|
103
|
+
// ✅ 禁用 ENS: XLayer 不支持 ENS,显式设置 ensAddress: undefined 避免解析错误
|
|
103
104
|
this.provider = new JsonRpcProvider(rpcUrl, { chainId, name: 'xlayer', ensAddress: undefined }, {
|
|
104
105
|
batchMaxCount: 20,
|
|
105
106
|
batchStallTime: 30,
|
package/package.json
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "four-flap-meme-sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.60",
|
|
4
4
|
"description": "SDK for Flap bonding curve and four.meme TokenManager",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"default": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./sol": {
|
|
15
|
-
"types": "./dist/sol/index.d.ts",
|
|
16
|
-
"import": "./dist/sol/index.js",
|
|
17
|
-
"default": "./dist/sol/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./sol/*": {
|
|
20
|
-
"types": "./dist/sol/*.d.ts",
|
|
21
|
-
"import": "./dist/sol/*.js",
|
|
22
|
-
"default": "./dist/sol/*.js"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
8
|
"files": [
|
|
26
9
|
"dist",
|
|
27
10
|
"src/abis/*.json"
|
|
@@ -46,33 +29,11 @@
|
|
|
46
29
|
"node": ">=18"
|
|
47
30
|
},
|
|
48
31
|
"dependencies": {
|
|
49
|
-
"
|
|
50
|
-
"@metaplex-foundation/umi": "^1.4.1",
|
|
51
|
-
"@metaplex-foundation/umi-bundle-defaults": "^1.4.1",
|
|
52
|
-
"@metaplex-foundation/umi-web3js-adapters": "^1.4.1",
|
|
53
|
-
"@meteora-ag/cp-amm-sdk": "^1.2.6",
|
|
54
|
-
"@meteora-ag/dlmm": "^1.9.0",
|
|
55
|
-
"@meteora-ag/dynamic-amm-sdk": "^1.4.1",
|
|
56
|
-
"@meteora-ag/dynamic-bonding-curve-sdk": "^1.4.9",
|
|
57
|
-
"@orca-so/common-sdk": "^0.7.0",
|
|
58
|
-
"@orca-so/whirlpools-sdk": "^0.17.4",
|
|
59
|
-
"@pump-fun/pump-sdk": "^1.24.0",
|
|
60
|
-
"@pump-fun/pump-swap-sdk": "^1.11.0",
|
|
61
|
-
"@raydium-io/raydium-sdk-v2": "^0.2.31-alpha",
|
|
62
|
-
"@solana/spl-token": "0.4.14",
|
|
63
|
-
"@solana/web3.js": "1.98.4",
|
|
64
|
-
"axios": "^1.13.2",
|
|
32
|
+
"axios": "^1.12.2",
|
|
65
33
|
"ethers": "^6.16.0",
|
|
66
|
-
"pinata": "^
|
|
67
|
-
"tweetnacl": "^1.0.3"
|
|
68
|
-
},
|
|
69
|
-
"optionalDependencies": {
|
|
70
|
-
"@orca-so/wavebreak": "^1.1.7"
|
|
34
|
+
"pinata": "^1.10.1"
|
|
71
35
|
},
|
|
72
36
|
"devDependencies": {
|
|
73
|
-
"
|
|
74
|
-
"@types/bs58": "^4.0.4",
|
|
75
|
-
"decimal.js": "^10.6.0",
|
|
76
|
-
"typescript": "^5.9.3"
|
|
37
|
+
"typescript": "^5.6.3"
|
|
77
38
|
}
|
|
78
|
-
}
|
|
39
|
+
}
|
package/dist/sol/constants.d.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Solana SDK 常量配置
|
|
3
|
-
* @module sol/constants
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Nozomi 配置
|
|
7
|
-
* Temporal Nozomi 交易加速服务
|
|
8
|
-
*/
|
|
9
|
-
export declare const NOZOMI_CONFIG: {
|
|
10
|
-
/** Tip 账户列表(随机选择一个) */
|
|
11
|
-
readonly TIP_ACCOUNTS: readonly ["TEMPaMeCRFAS9EKF53Jd6KpHxgL47uWLcpFArU1Fanq", "noz3jAjPiHuBPqiSPkkugaJDkJscPuRhYnSpbi8UvC4", "noz3str9KXfpKknefHji8L1mPgimezaiUyCHYMDv1GE", "noz6uoYCDijhu1V7cutCpwxNiSovEwLdRHPwmgCGDNo", "noz9EPNcT7WH6Sou3sr3GGjHQYVkN3DNirpbvDkv9YJ", "nozc5yT15LazbLTFVZzoNZCwjh3yUtW86LoUyqsBu4L", "nozFrhfnNGoyqwVuwPAW4aaGqempx4PU6g6D9CJMv7Z", "nozievPk7HyK1Rqy1MPJwVQ7qQg2QoJGyP71oeDwbsu", "noznbgwYnBLDHu8wcQVCEw6kDrXkPdKkydGJGNXGvL7", "nozNVWs5N8mgzuD3qigrCG2UoKxZttxzZ85pvAQVrbP", "nozpEGbwx4BcGp6pvEdAh1JoC2CQGZdU6HbNP1v2p6P", "nozrhjhkCr3zXT3BiT4WCodYCUFeQvcdUkM7MqhKqge", "nozrwQtWhEdrA6W8dkbt9gnUaMs52PdAv5byipnadq3", "nozUacTVWub3cL4mJmGCYjKZTnE9RbdY5AP46iQgbPJ", "nozWCyTPppJjRuw2fpzDhhWbW355fzosWSzrrMYB1Qk", "nozWNju6dY353eMkMqURqwQEoM3SFgEKC6psLCSfUne", "nozxNBgWohjR75vdspfxR5H9ceC7XXH99xpxhVGt3Bb"];
|
|
12
|
-
/** 最小 Tip(lamports)- 0.001 SOL */
|
|
13
|
-
readonly MIN_TIP_LAMPORTS: 1000000;
|
|
14
|
-
/** 默认 Tip(lamports)- 0.001 SOL */
|
|
15
|
-
readonly DEFAULT_TIP_LAMPORTS: 1000000;
|
|
16
|
-
/** 建议的 Priority Fee(microlamports) */
|
|
17
|
-
readonly RECOMMENDED_PRIORITY_FEE: 1000000;
|
|
18
|
-
/** 区域端点 */
|
|
19
|
-
readonly REGIONS: {
|
|
20
|
-
readonly auto: "nozomi.temporal.xyz";
|
|
21
|
-
readonly pit: "pit1.nozomi.temporal.xyz";
|
|
22
|
-
readonly tyo: "tyo1.nozomi.temporal.xyz";
|
|
23
|
-
readonly sgp: "sgp1.nozomi.temporal.xyz";
|
|
24
|
-
readonly ewr: "ewr1.nozomi.temporal.xyz";
|
|
25
|
-
readonly ams: "ams1.nozomi.temporal.xyz";
|
|
26
|
-
readonly fra: "fra2.nozomi.temporal.xyz";
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Jito 配置
|
|
31
|
-
*
|
|
32
|
-
* 注意:BLOCK_ENGINE_URL 需要由前端传入,不在 SDK 中写死
|
|
33
|
-
*/
|
|
34
|
-
export declare const JITO_CONFIG: {
|
|
35
|
-
/** Tip 账户列表(随机选择一个)- 这些是 Jito 官方账户,固定不变 */
|
|
36
|
-
readonly TIP_ACCOUNTS: readonly ["96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5", "HFqU5x63VTqvQss8hp11i4bVmkzdNaVB6PYjYgNd4W5U", "Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY", "ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49", "DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh", "ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt", "DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL", "3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT"];
|
|
37
|
-
/** 最小 Tip(lamports) */
|
|
38
|
-
readonly MIN_TIP_LAMPORTS: 1000;
|
|
39
|
-
/** 默认 Tip(lamports)- 0.00001 SOL */
|
|
40
|
-
readonly DEFAULT_TIP_LAMPORTS: 10000;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Solana 系统程序地址
|
|
44
|
-
*/
|
|
45
|
-
export declare const SYSTEM_PROGRAMS: {
|
|
46
|
-
/** Token Program */
|
|
47
|
-
readonly TOKEN_PROGRAM: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
48
|
-
/** Token-2022 Program */
|
|
49
|
-
readonly TOKEN_2022_PROGRAM: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
50
|
-
/** Associated Token Account Program */
|
|
51
|
-
readonly ATA_PROGRAM: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
52
|
-
/** Metaplex Token Metadata Program */
|
|
53
|
-
readonly METADATA_PROGRAM: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
54
|
-
/** System Program */
|
|
55
|
-
readonly SYSTEM_PROGRAM: "11111111111111111111111111111111";
|
|
56
|
-
/** Rent Sysvar */
|
|
57
|
-
readonly RENT_SYSVAR: "SysvarRent111111111111111111111111111111111";
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Pump.fun 程序地址
|
|
61
|
-
*/
|
|
62
|
-
export declare const PUMP_PROGRAMS: {
|
|
63
|
-
/** Pump Program ID */
|
|
64
|
-
readonly PUMP_PROGRAM: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
|
|
65
|
-
/** Pump Swap Program ID */
|
|
66
|
-
readonly PUMP_SWAP_PROGRAM: "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA";
|
|
67
|
-
/** Global Config */
|
|
68
|
-
readonly GLOBAL_CONFIG: "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf";
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Raydium 程序地址
|
|
72
|
-
*/
|
|
73
|
-
export declare const RAYDIUM_PROGRAMS: {
|
|
74
|
-
/** AMM Program ID */
|
|
75
|
-
readonly AMM_PROGRAM: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8";
|
|
76
|
-
/** CLMM Program ID */
|
|
77
|
-
readonly CLMM_PROGRAM: "CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK";
|
|
78
|
-
/** LaunchLab Program ID */
|
|
79
|
-
readonly LAUNCHLAB_PROGRAM: "LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj";
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Orca 程序地址
|
|
83
|
-
*/
|
|
84
|
-
export declare const ORCA_PROGRAMS: {
|
|
85
|
-
/** Whirlpool Program ID */
|
|
86
|
-
readonly WHIRLPOOL_PROGRAM: "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc";
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Meteora 程序地址
|
|
90
|
-
*/
|
|
91
|
-
export declare const METEORA_PROGRAMS: {
|
|
92
|
-
/** DLMM Program ID */
|
|
93
|
-
readonly DLMM_PROGRAM: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo";
|
|
94
|
-
/** DAMM v2 Program ID */
|
|
95
|
-
readonly DAMM_V2_PROGRAM: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG";
|
|
96
|
-
/** DBC Program ID */
|
|
97
|
-
readonly DBC_PROGRAM: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN";
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* 常用代币地址
|
|
101
|
-
*/
|
|
102
|
-
export declare const TOKENS: {
|
|
103
|
-
/** Wrapped SOL */
|
|
104
|
-
readonly SOL: "So11111111111111111111111111111111111111112";
|
|
105
|
-
/** USDC */
|
|
106
|
-
readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
107
|
-
/** USDT */
|
|
108
|
-
readonly USDT: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* 交易默认配置
|
|
112
|
-
*/
|
|
113
|
-
export declare const TX_CONFIG: {
|
|
114
|
-
/** 默认滑点 1% */
|
|
115
|
-
readonly DEFAULT_SLIPPAGE: 1;
|
|
116
|
-
/** 最大滑点 50% */
|
|
117
|
-
readonly MAX_SLIPPAGE: 50;
|
|
118
|
-
/** 计算单元限制 */
|
|
119
|
-
readonly COMPUTE_UNIT_LIMIT: 200000;
|
|
120
|
-
/** 计算单元价格(microlamports) */
|
|
121
|
-
readonly COMPUTE_UNIT_PRICE: 50000;
|
|
122
|
-
/** 确认超时(毫秒) */
|
|
123
|
-
readonly CONFIRMATION_TIMEOUT: 60000;
|
|
124
|
-
/** 默认 commitment */
|
|
125
|
-
readonly DEFAULT_COMMITMENT: "confirmed";
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* 账户大小(用于计算租金)
|
|
129
|
-
*/
|
|
130
|
-
export declare const ACCOUNT_SIZE: {
|
|
131
|
-
/** Mint 账户大小 */
|
|
132
|
-
readonly MINT: 82;
|
|
133
|
-
/** Token 账户大小 */
|
|
134
|
-
readonly TOKEN_ACCOUNT: 165;
|
|
135
|
-
/** Metadata 账户大小(近似值) */
|
|
136
|
-
readonly METADATA: 679;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* SOL 单位换算
|
|
140
|
-
*/
|
|
141
|
-
export declare const SOL_DECIMALS = 9;
|
|
142
|
-
export declare const LAMPORTS_PER_SOL = 1000000000;
|
|
143
|
-
/**
|
|
144
|
-
* 将 SOL 转换为 lamports
|
|
145
|
-
*/
|
|
146
|
-
export declare function solToLamports(sol: number): bigint;
|
|
147
|
-
/**
|
|
148
|
-
* 将 lamports 转换为 SOL
|
|
149
|
-
*/
|
|
150
|
-
export declare function lamportsToSol(lamports: bigint): number;
|