four-flap-meme-sdk 1.5.10 → 1.5.12

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.
Files changed (156) hide show
  1. package/README.zh-CN.pdf +0 -0
  2. package/dist/contracts/tm-bundle-merkle/submit.js +58 -0
  3. package/dist/flap/portal-bundle-merkle/encryption.d.ts +16 -0
  4. package/dist/flap/portal-bundle-merkle/encryption.js +146 -0
  5. package/dist/flap/portal-bundle-merkle/private.js +8 -4
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.js +1 -1
  8. package/dist/utils/constants.d.ts +1 -0
  9. package/dist/utils/constants.js +4 -2
  10. package/dist/xlayer/constants.d.ts +2 -0
  11. package/dist/xlayer/constants.js +2 -0
  12. package/package.json +5 -44
  13. package/dist/sol/constants.d.ts +0 -150
  14. package/dist/sol/constants.js +0 -188
  15. package/dist/sol/dex/blockrazor/client.d.ts +0 -51
  16. package/dist/sol/dex/blockrazor/client.js +0 -96
  17. package/dist/sol/dex/blockrazor/constants.d.ts +0 -34
  18. package/dist/sol/dex/blockrazor/constants.js +0 -55
  19. package/dist/sol/dex/blockrazor/geyser.d.ts +0 -128
  20. package/dist/sol/dex/blockrazor/geyser.js +0 -530
  21. package/dist/sol/dex/blockrazor/index.d.ts +0 -18
  22. package/dist/sol/dex/blockrazor/index.js +0 -23
  23. package/dist/sol/dex/blockrazor/send.d.ts +0 -135
  24. package/dist/sol/dex/blockrazor/send.js +0 -254
  25. package/dist/sol/dex/blockrazor/types.d.ts +0 -191
  26. package/dist/sol/dex/blockrazor/types.js +0 -5
  27. package/dist/sol/dex/index.d.ts +0 -10
  28. package/dist/sol/dex/index.js +0 -16
  29. package/dist/sol/dex/jup/client.d.ts +0 -33
  30. package/dist/sol/dex/jup/client.js +0 -110
  31. package/dist/sol/dex/jup/index.d.ts +0 -16
  32. package/dist/sol/dex/jup/index.js +0 -148
  33. package/dist/sol/dex/jup/legacy.d.ts +0 -623
  34. package/dist/sol/dex/jup/legacy.js +0 -416
  35. package/dist/sol/dex/jup/lend.d.ts +0 -640
  36. package/dist/sol/dex/jup/lend.js +0 -603
  37. package/dist/sol/dex/jup/portfolio.d.ts +0 -362
  38. package/dist/sol/dex/jup/portfolio.js +0 -367
  39. package/dist/sol/dex/jup/price.d.ts +0 -173
  40. package/dist/sol/dex/jup/price.js +0 -220
  41. package/dist/sol/dex/jup/recurring.d.ts +0 -437
  42. package/dist/sol/dex/jup/recurring.js +0 -320
  43. package/dist/sol/dex/jup/send.d.ts +0 -282
  44. package/dist/sol/dex/jup/send.js +0 -295
  45. package/dist/sol/dex/jup/studio.d.ts +0 -457
  46. package/dist/sol/dex/jup/studio.js +0 -488
  47. package/dist/sol/dex/jup/tokens.d.ts +0 -767
  48. package/dist/sol/dex/jup/tokens.js +0 -697
  49. package/dist/sol/dex/jup/trigger.d.ts +0 -511
  50. package/dist/sol/dex/jup/trigger.js +0 -397
  51. package/dist/sol/dex/jup/types.d.ts +0 -433
  52. package/dist/sol/dex/jup/types.js +0 -5
  53. package/dist/sol/dex/jup/ultra.d.ts +0 -646
  54. package/dist/sol/dex/jup/ultra.js +0 -853
  55. package/dist/sol/dex/meteora/client.d.ts +0 -76
  56. package/dist/sol/dex/meteora/client.js +0 -219
  57. package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +0 -61
  58. package/dist/sol/dex/meteora/damm-v1-bundle.js +0 -112
  59. package/dist/sol/dex/meteora/damm-v1.d.ts +0 -118
  60. package/dist/sol/dex/meteora/damm-v1.js +0 -315
  61. package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +0 -82
  62. package/dist/sol/dex/meteora/damm-v2-bundle.js +0 -242
  63. package/dist/sol/dex/meteora/damm-v2.d.ts +0 -172
  64. package/dist/sol/dex/meteora/damm-v2.js +0 -632
  65. package/dist/sol/dex/meteora/dbc-bundle.d.ts +0 -123
  66. package/dist/sol/dex/meteora/dbc-bundle.js +0 -304
  67. package/dist/sol/dex/meteora/dbc.d.ts +0 -192
  68. package/dist/sol/dex/meteora/dbc.js +0 -619
  69. package/dist/sol/dex/meteora/dlmm-bundle.d.ts +0 -39
  70. package/dist/sol/dex/meteora/dlmm-bundle.js +0 -189
  71. package/dist/sol/dex/meteora/dlmm.d.ts +0 -157
  72. package/dist/sol/dex/meteora/dlmm.js +0 -671
  73. package/dist/sol/dex/meteora/index.d.ts +0 -25
  74. package/dist/sol/dex/meteora/index.js +0 -65
  75. package/dist/sol/dex/meteora/types.d.ts +0 -787
  76. package/dist/sol/dex/meteora/types.js +0 -110
  77. package/dist/sol/dex/orca/index.d.ts +0 -10
  78. package/dist/sol/dex/orca/index.js +0 -16
  79. package/dist/sol/dex/orca/orca-bundle.d.ts +0 -41
  80. package/dist/sol/dex/orca/orca-bundle.js +0 -173
  81. package/dist/sol/dex/orca/orca.d.ts +0 -65
  82. package/dist/sol/dex/orca/orca.js +0 -474
  83. package/dist/sol/dex/orca/types.d.ts +0 -263
  84. package/dist/sol/dex/orca/types.js +0 -38
  85. package/dist/sol/dex/orca/wavebreak-bundle.d.ts +0 -34
  86. package/dist/sol/dex/orca/wavebreak-bundle.js +0 -198
  87. package/dist/sol/dex/orca/wavebreak-types.d.ts +0 -227
  88. package/dist/sol/dex/orca/wavebreak-types.js +0 -23
  89. package/dist/sol/dex/orca/wavebreak.d.ts +0 -78
  90. package/dist/sol/dex/orca/wavebreak.js +0 -497
  91. package/dist/sol/dex/pump/index.d.ts +0 -9
  92. package/dist/sol/dex/pump/index.js +0 -14
  93. package/dist/sol/dex/pump/pump-bundle.d.ts +0 -92
  94. package/dist/sol/dex/pump/pump-bundle.js +0 -383
  95. package/dist/sol/dex/pump/pump-swap-bundle.d.ts +0 -103
  96. package/dist/sol/dex/pump/pump-swap-bundle.js +0 -380
  97. package/dist/sol/dex/pump/pump-swap.d.ts +0 -46
  98. package/dist/sol/dex/pump/pump-swap.js +0 -199
  99. package/dist/sol/dex/pump/pump.d.ts +0 -35
  100. package/dist/sol/dex/pump/pump.js +0 -352
  101. package/dist/sol/dex/pump/types.d.ts +0 -215
  102. package/dist/sol/dex/pump/types.js +0 -5
  103. package/dist/sol/dex/raydium/index.d.ts +0 -8
  104. package/dist/sol/dex/raydium/index.js +0 -12
  105. package/dist/sol/dex/raydium/launchlab.d.ts +0 -68
  106. package/dist/sol/dex/raydium/launchlab.js +0 -210
  107. package/dist/sol/dex/raydium/raydium-bundle.d.ts +0 -64
  108. package/dist/sol/dex/raydium/raydium-bundle.js +0 -324
  109. package/dist/sol/dex/raydium/raydium.d.ts +0 -40
  110. package/dist/sol/dex/raydium/raydium.js +0 -366
  111. package/dist/sol/dex/raydium/types.d.ts +0 -240
  112. package/dist/sol/dex/raydium/types.js +0 -5
  113. package/dist/sol/index.d.ts +0 -11
  114. package/dist/sol/index.js +0 -18
  115. package/dist/sol/jito/bundle.d.ts +0 -90
  116. package/dist/sol/jito/bundle.js +0 -263
  117. package/dist/sol/jito/index.d.ts +0 -7
  118. package/dist/sol/jito/index.js +0 -7
  119. package/dist/sol/jito/tip.d.ts +0 -51
  120. package/dist/sol/jito/tip.js +0 -83
  121. package/dist/sol/jito/types.d.ts +0 -100
  122. package/dist/sol/jito/types.js +0 -5
  123. package/dist/sol/nozomi/client.d.ts +0 -63
  124. package/dist/sol/nozomi/client.js +0 -222
  125. package/dist/sol/nozomi/index.d.ts +0 -8
  126. package/dist/sol/nozomi/index.js +0 -8
  127. package/dist/sol/nozomi/tip.d.ts +0 -50
  128. package/dist/sol/nozomi/tip.js +0 -80
  129. package/dist/sol/nozomi/types.d.ts +0 -96
  130. package/dist/sol/nozomi/types.js +0 -5
  131. package/dist/sol/token/create-complete.d.ts +0 -115
  132. package/dist/sol/token/create-complete.js +0 -235
  133. package/dist/sol/token/create-token.d.ts +0 -57
  134. package/dist/sol/token/create-token.js +0 -230
  135. package/dist/sol/token/index.d.ts +0 -9
  136. package/dist/sol/token/index.js +0 -14
  137. package/dist/sol/token/metadata-upload.d.ts +0 -86
  138. package/dist/sol/token/metadata-upload.js +0 -173
  139. package/dist/sol/token/metadata.d.ts +0 -92
  140. package/dist/sol/token/metadata.js +0 -274
  141. package/dist/sol/token/types.d.ts +0 -153
  142. package/dist/sol/token/types.js +0 -5
  143. package/dist/sol/types.d.ts +0 -176
  144. package/dist/sol/types.js +0 -7
  145. package/dist/sol/utils/balance.d.ts +0 -160
  146. package/dist/sol/utils/balance.js +0 -638
  147. package/dist/sol/utils/connection.d.ts +0 -78
  148. package/dist/sol/utils/connection.js +0 -168
  149. package/dist/sol/utils/index.d.ts +0 -9
  150. package/dist/sol/utils/index.js +0 -9
  151. package/dist/sol/utils/lp-inspect.d.ts +0 -129
  152. package/dist/sol/utils/lp-inspect.js +0 -900
  153. package/dist/sol/utils/transfer.d.ts +0 -196
  154. package/dist/sol/utils/transfer.js +0 -307
  155. package/dist/sol/utils/wallet.d.ts +0 -107
  156. package/dist/sol/utils/wallet.js +0 -210
@@ -1,188 +0,0 @@
1
- /**
2
- * Solana SDK 常量配置
3
- * @module sol/constants
4
- */
5
- // ==================== Nozomi 配置 ====================
6
- /**
7
- * Nozomi 配置
8
- * Temporal Nozomi 交易加速服务
9
- */
10
- export const NOZOMI_CONFIG = {
11
- /** Tip 账户列表(随机选择一个) */
12
- TIP_ACCOUNTS: [
13
- 'TEMPaMeCRFAS9EKF53Jd6KpHxgL47uWLcpFArU1Fanq',
14
- 'noz3jAjPiHuBPqiSPkkugaJDkJscPuRhYnSpbi8UvC4',
15
- 'noz3str9KXfpKknefHji8L1mPgimezaiUyCHYMDv1GE',
16
- 'noz6uoYCDijhu1V7cutCpwxNiSovEwLdRHPwmgCGDNo',
17
- 'noz9EPNcT7WH6Sou3sr3GGjHQYVkN3DNirpbvDkv9YJ',
18
- 'nozc5yT15LazbLTFVZzoNZCwjh3yUtW86LoUyqsBu4L',
19
- 'nozFrhfnNGoyqwVuwPAW4aaGqempx4PU6g6D9CJMv7Z',
20
- 'nozievPk7HyK1Rqy1MPJwVQ7qQg2QoJGyP71oeDwbsu',
21
- 'noznbgwYnBLDHu8wcQVCEw6kDrXkPdKkydGJGNXGvL7',
22
- 'nozNVWs5N8mgzuD3qigrCG2UoKxZttxzZ85pvAQVrbP',
23
- 'nozpEGbwx4BcGp6pvEdAh1JoC2CQGZdU6HbNP1v2p6P',
24
- 'nozrhjhkCr3zXT3BiT4WCodYCUFeQvcdUkM7MqhKqge',
25
- 'nozrwQtWhEdrA6W8dkbt9gnUaMs52PdAv5byipnadq3',
26
- 'nozUacTVWub3cL4mJmGCYjKZTnE9RbdY5AP46iQgbPJ',
27
- 'nozWCyTPppJjRuw2fpzDhhWbW355fzosWSzrrMYB1Qk',
28
- 'nozWNju6dY353eMkMqURqwQEoM3SFgEKC6psLCSfUne',
29
- 'nozxNBgWohjR75vdspfxR5H9ceC7XXH99xpxhVGt3Bb',
30
- ],
31
- /** 最小 Tip(lamports)- 0.001 SOL */
32
- MIN_TIP_LAMPORTS: 1000000,
33
- /** 默认 Tip(lamports)- 0.001 SOL */
34
- DEFAULT_TIP_LAMPORTS: 1000000,
35
- /** 建议的 Priority Fee(microlamports) */
36
- RECOMMENDED_PRIORITY_FEE: 1000000,
37
- /** 区域端点 */
38
- REGIONS: {
39
- auto: 'nozomi.temporal.xyz',
40
- pit: 'pit1.nozomi.temporal.xyz',
41
- tyo: 'tyo1.nozomi.temporal.xyz',
42
- sgp: 'sgp1.nozomi.temporal.xyz',
43
- ewr: 'ewr1.nozomi.temporal.xyz',
44
- ams: 'ams1.nozomi.temporal.xyz',
45
- fra: 'fra2.nozomi.temporal.xyz',
46
- },
47
- };
48
- // ==================== Jito Bundle 配置 ====================
49
- /**
50
- * Jito 配置
51
- *
52
- * 注意:BLOCK_ENGINE_URL 需要由前端传入,不在 SDK 中写死
53
- */
54
- export const JITO_CONFIG = {
55
- /** Tip 账户列表(随机选择一个)- 这些是 Jito 官方账户,固定不变 */
56
- TIP_ACCOUNTS: [
57
- '96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5',
58
- 'HFqU5x63VTqvQss8hp11i4bVmkzdNaVB6PYjYgNd4W5U',
59
- 'Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY',
60
- 'ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49',
61
- 'DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh',
62
- 'ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt',
63
- 'DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL',
64
- '3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT',
65
- ],
66
- /** 最小 Tip(lamports) */
67
- MIN_TIP_LAMPORTS: 1000,
68
- /** 默认 Tip(lamports)- 0.00001 SOL */
69
- DEFAULT_TIP_LAMPORTS: 10000,
70
- };
71
- // ==================== 程序地址 ====================
72
- /**
73
- * Solana 系统程序地址
74
- */
75
- export const SYSTEM_PROGRAMS = {
76
- /** Token Program */
77
- TOKEN_PROGRAM: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
78
- /** Token-2022 Program */
79
- TOKEN_2022_PROGRAM: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
80
- /** Associated Token Account Program */
81
- ATA_PROGRAM: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
82
- /** Metaplex Token Metadata Program */
83
- METADATA_PROGRAM: 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s',
84
- /** System Program */
85
- SYSTEM_PROGRAM: '11111111111111111111111111111111',
86
- /** Rent Sysvar */
87
- RENT_SYSVAR: 'SysvarRent111111111111111111111111111111111',
88
- };
89
- /**
90
- * Pump.fun 程序地址
91
- */
92
- export const PUMP_PROGRAMS = {
93
- /** Pump Program ID */
94
- PUMP_PROGRAM: '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P',
95
- /** Pump Swap Program ID */
96
- PUMP_SWAP_PROGRAM: 'pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA',
97
- /** Global Config */
98
- GLOBAL_CONFIG: '4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf',
99
- };
100
- /**
101
- * Raydium 程序地址
102
- */
103
- export const RAYDIUM_PROGRAMS = {
104
- /** AMM Program ID */
105
- AMM_PROGRAM: '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8',
106
- /** CLMM Program ID */
107
- CLMM_PROGRAM: 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK',
108
- /** LaunchLab Program ID */
109
- LAUNCHLAB_PROGRAM: 'LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj',
110
- };
111
- /**
112
- * Orca 程序地址
113
- */
114
- export const ORCA_PROGRAMS = {
115
- /** Whirlpool Program ID */
116
- WHIRLPOOL_PROGRAM: 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc',
117
- };
118
- /**
119
- * Meteora 程序地址
120
- */
121
- export const METEORA_PROGRAMS = {
122
- /** DLMM Program ID */
123
- DLMM_PROGRAM: 'LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo',
124
- /** DAMM v2 Program ID */
125
- DAMM_V2_PROGRAM: 'cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG',
126
- /** DBC Program ID */
127
- DBC_PROGRAM: 'dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN',
128
- };
129
- // ==================== 常用代币地址 ====================
130
- /**
131
- * 常用代币地址
132
- */
133
- export const TOKENS = {
134
- /** Wrapped SOL */
135
- SOL: 'So11111111111111111111111111111111111111112',
136
- /** USDC */
137
- USDC: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
138
- /** USDT */
139
- USDT: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
140
- };
141
- // ==================== 交易配置 ====================
142
- /**
143
- * 交易默认配置
144
- */
145
- export const TX_CONFIG = {
146
- /** 默认滑点 1% */
147
- DEFAULT_SLIPPAGE: 1,
148
- /** 最大滑点 50% */
149
- MAX_SLIPPAGE: 50,
150
- /** 计算单元限制 */
151
- COMPUTE_UNIT_LIMIT: 200000,
152
- /** 计算单元价格(microlamports) */
153
- COMPUTE_UNIT_PRICE: 50000,
154
- /** 确认超时(毫秒) */
155
- CONFIRMATION_TIMEOUT: 60000,
156
- /** 默认 commitment */
157
- DEFAULT_COMMITMENT: 'confirmed',
158
- };
159
- // ==================== 账户大小 ====================
160
- /**
161
- * 账户大小(用于计算租金)
162
- */
163
- export const ACCOUNT_SIZE = {
164
- /** Mint 账户大小 */
165
- MINT: 82,
166
- /** Token 账户大小 */
167
- TOKEN_ACCOUNT: 165,
168
- /** Metadata 账户大小(近似值) */
169
- METADATA: 679,
170
- };
171
- // ==================== 单位换算 ====================
172
- /**
173
- * SOL 单位换算
174
- */
175
- export const SOL_DECIMALS = 9;
176
- export const LAMPORTS_PER_SOL = 1000000000;
177
- /**
178
- * 将 SOL 转换为 lamports
179
- */
180
- export function solToLamports(sol) {
181
- return BigInt(Math.floor(sol * LAMPORTS_PER_SOL));
182
- }
183
- /**
184
- * 将 lamports 转换为 SOL
185
- */
186
- export function lamportsToSol(lamports) {
187
- return Number(lamports) / LAMPORTS_PER_SOL;
188
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * BlockRazor 客户端配置管理
3
- * @module sol/dex/blockrazor/client
4
- */
5
- import type { BlockRazorConfig, BlockRazorSendParams } from './types.js';
6
- /**
7
- * 设置默认 BlockRazor 配置
8
- *
9
- * @param config 配置
10
- *
11
- * @example
12
- * ```typescript
13
- * import { Sol } from 'four-flap-meme-sdk'
14
- *
15
- * Sol.setBlockRazorConfig({
16
- * apiKey: 'your-auth-token',
17
- * region: 'frankfurt',
18
- * })
19
- * ```
20
- */
21
- export declare function setBlockRazorConfig(config: BlockRazorConfig): void;
22
- /**
23
- * 获取 BlockRazor 配置
24
- *
25
- * @param config 可选配置(覆盖默认配置)
26
- * @returns 配置对象
27
- * @throws 未配置时抛出错误
28
- */
29
- export declare function getBlockRazorConfig(config?: BlockRazorConfig): BlockRazorConfig;
30
- /**
31
- * 获取端点 URL
32
- *
33
- * @param config 可选配置
34
- * @returns 端点 URL
35
- */
36
- export declare function getBlockRazorEndpoint(config?: BlockRazorConfig): string;
37
- /**
38
- * 获取随机 BlockRazor Tip 账户
39
- *
40
- * 避免因地址占用导致的性能下降,建议轮换 Tip 账户。
41
- *
42
- * @returns 随机 Tip 账户地址
43
- */
44
- export declare function getRandomBlockRazorTipAccount(): string;
45
- /**
46
- * 验证发送交易参数
47
- *
48
- * @param params 发送参数
49
- * @throws 参数无效时抛出错误
50
- */
51
- export declare function validateSendParams(params: BlockRazorSendParams): void;
@@ -1,96 +0,0 @@
1
- /**
2
- * BlockRazor 客户端配置管理
3
- * @module sol/dex/blockrazor/client
4
- */
5
- import { BLOCKRAZOR_ENDPOINTS, BLOCKRAZOR_TIP_ACCOUNTS } from './constants.js';
6
- // ============================================================================
7
- // 客户端管理
8
- // ============================================================================
9
- let defaultConfig = null;
10
- /**
11
- * 设置默认 BlockRazor 配置
12
- *
13
- * @param config 配置
14
- *
15
- * @example
16
- * ```typescript
17
- * import { Sol } from 'four-flap-meme-sdk'
18
- *
19
- * Sol.setBlockRazorConfig({
20
- * apiKey: 'your-auth-token',
21
- * region: 'frankfurt',
22
- * })
23
- * ```
24
- */
25
- export function setBlockRazorConfig(config) {
26
- defaultConfig = config;
27
- }
28
- /**
29
- * 获取 BlockRazor 配置
30
- *
31
- * @param config 可选配置(覆盖默认配置)
32
- * @returns 配置对象
33
- * @throws 未配置时抛出错误
34
- */
35
- export function getBlockRazorConfig(config) {
36
- const cfg = config || defaultConfig;
37
- if (!cfg) {
38
- throw new Error('BlockRazor not configured. Call setBlockRazorConfig() first or pass config.');
39
- }
40
- return cfg;
41
- }
42
- /**
43
- * 获取端点 URL
44
- *
45
- * @param config 可选配置
46
- * @returns 端点 URL
47
- */
48
- export function getBlockRazorEndpoint(config) {
49
- const cfg = getBlockRazorConfig(config);
50
- if (cfg.endpoint) {
51
- return cfg.endpoint;
52
- }
53
- const region = cfg.region || 'frankfurt';
54
- switch (region) {
55
- case 'frankfurt':
56
- return BLOCKRAZOR_ENDPOINTS.FRANKFURT;
57
- case 'newyork':
58
- return BLOCKRAZOR_ENDPOINTS.NEW_YORK;
59
- case 'tokyo':
60
- return BLOCKRAZOR_ENDPOINTS.TOKYO;
61
- case 'amsterdam':
62
- return BLOCKRAZOR_ENDPOINTS.AMSTERDAM;
63
- default:
64
- return BLOCKRAZOR_ENDPOINTS.FRANKFURT;
65
- }
66
- }
67
- /**
68
- * 获取随机 BlockRazor Tip 账户
69
- *
70
- * 避免因地址占用导致的性能下降,建议轮换 Tip 账户。
71
- *
72
- * @returns 随机 Tip 账户地址
73
- */
74
- export function getRandomBlockRazorTipAccount() {
75
- const index = Math.floor(Math.random() * BLOCKRAZOR_TIP_ACCOUNTS.length);
76
- return BLOCKRAZOR_TIP_ACCOUNTS[index];
77
- }
78
- /**
79
- * 验证发送交易参数
80
- *
81
- * @param params 发送参数
82
- * @throws 参数无效时抛出错误
83
- */
84
- export function validateSendParams(params) {
85
- if (!params.transaction) {
86
- throw new Error('transaction is required');
87
- }
88
- if (params.mode && !['fast', 'sandwichMitigation'].includes(params.mode)) {
89
- throw new Error('mode must be "fast" or "sandwichMitigation"');
90
- }
91
- if (params.safeWindow !== undefined) {
92
- if (params.safeWindow < 3 || params.safeWindow > 13) {
93
- throw new Error('safeWindow must be between 3 and 13');
94
- }
95
- }
96
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * BlockRazor 常量
3
- * @module sol/dex/blockrazor/constants
4
- */
5
- /** BlockRazor 区域端点 */
6
- export declare const BLOCKRAZOR_ENDPOINTS: {
7
- /** 法兰克福 */
8
- readonly FRANKFURT: "http://frankfurt.solana.blockrazor.xyz:443";
9
- /** 纽约 */
10
- readonly NEW_YORK: "http://newyork.solana.blockrazor.xyz:443";
11
- /** 东京 */
12
- readonly TOKYO: "http://tokyo.solana.blockrazor.xyz:443";
13
- /** 阿姆斯特丹 */
14
- readonly AMSTERDAM: "http://amsterdam.solana.blockrazor.xyz:443";
15
- };
16
- /** BlockRazor Tip 账户列表 */
17
- export declare const BLOCKRAZOR_TIP_ACCOUNTS: readonly ["Gywj98ophM7GmkDdaWs4isqZnDdFCW7B46TXmKfvyqSm", "FjmZZrFvhnqqb9ThCuMVnENaM3JGVuGWNyCAxRJcFpg9", "6No2i3aawzHsjtThw81iq1EXPJN6rh8eSJCLaYZfKDTG", "A9cWowVAiHe9pJfKAj3TJiN9VpbzMUq6E4kEvf5mUT22", "68Pwb4jS7eZATjDfhmTXgRJjCiZmw1L7Huy4HNpnxJ3o", "4ABhJh5rZPjv63RBJBuyWzBK3g9gWMUQdTZP2kiW31V9", "B2M4NG5eyZp5SBQrSdtemzk5TqVuaWGQnowGaCBt8GyM", "5jA59cXMKQqZAVdtopv8q3yyw9SYfiE3vUCbt7p8MfVf", "5YktoWygr1Bp9wiS1xtMtUki1PeYuuzuCF98tqwYxf61", "295Avbam4qGShBYK7E9H5Ldew4B3WyJGmgmXfiWdeeyV", "EDi4rSy2LZgKJX74mbLTFk4mxoTgT6F7HxxzG2HBAFyK", "BnGKHAC386n4Qmv9xtpBVbRaUTKixjBe3oagkPFKtoy6", "Dd7K2Fp7AtoN8xCghKDRmyqr5U169t48Tw5fEd3wT9mq", "AP6qExwrbRgBAVaehg4b5xHENX815sMabtBzUzVB4v8S"];
18
- /** 默认 Tip 金额 (lamports) */
19
- export declare const DEFAULT_TIP_AMOUNT = 1000000;
20
- /** 最小 Tip 金额 (lamports) */
21
- export declare const MIN_TIP_AMOUNT = 1000000;
22
- /** 默认请求超时 (ms) */
23
- export declare const BLOCKRAZOR_DEFAULT_TIMEOUT = 10000;
24
- /** Geyser Stream 端点 */
25
- export declare const GEYSER_STREAM_ENDPOINTS: {
26
- /** 东京 */
27
- readonly TOKYO: "geyserstream-tokyo.blockrazor.xyz:443";
28
- /** 法兰克福 */
29
- readonly FRANKFURT: "geyserstream-frankfurt.blockrazor.xyz:443";
30
- /** 纽约 */
31
- readonly NEW_YORK: "geyserstream-newyork.blockrazor.xyz:443";
32
- /** 阿姆斯特丹 */
33
- readonly AMSTERDAM: "geyserstream-amsterdam.blockrazor.xyz:443";
34
- };
@@ -1,55 +0,0 @@
1
- /**
2
- * BlockRazor 常量
3
- * @module sol/dex/blockrazor/constants
4
- */
5
- // ============================================================================
6
- // Send Transaction 端点
7
- // ============================================================================
8
- /** BlockRazor 区域端点 */
9
- export const BLOCKRAZOR_ENDPOINTS = {
10
- /** 法兰克福 */
11
- FRANKFURT: 'http://frankfurt.solana.blockrazor.xyz:443',
12
- /** 纽约 */
13
- NEW_YORK: 'http://newyork.solana.blockrazor.xyz:443',
14
- /** 东京 */
15
- TOKYO: 'http://tokyo.solana.blockrazor.xyz:443',
16
- /** 阿姆斯特丹 */
17
- AMSTERDAM: 'http://amsterdam.solana.blockrazor.xyz:443',
18
- };
19
- /** BlockRazor Tip 账户列表 */
20
- export const BLOCKRAZOR_TIP_ACCOUNTS = [
21
- 'Gywj98ophM7GmkDdaWs4isqZnDdFCW7B46TXmKfvyqSm',
22
- 'FjmZZrFvhnqqb9ThCuMVnENaM3JGVuGWNyCAxRJcFpg9',
23
- '6No2i3aawzHsjtThw81iq1EXPJN6rh8eSJCLaYZfKDTG',
24
- 'A9cWowVAiHe9pJfKAj3TJiN9VpbzMUq6E4kEvf5mUT22',
25
- '68Pwb4jS7eZATjDfhmTXgRJjCiZmw1L7Huy4HNpnxJ3o',
26
- '4ABhJh5rZPjv63RBJBuyWzBK3g9gWMUQdTZP2kiW31V9',
27
- 'B2M4NG5eyZp5SBQrSdtemzk5TqVuaWGQnowGaCBt8GyM',
28
- '5jA59cXMKQqZAVdtopv8q3yyw9SYfiE3vUCbt7p8MfVf',
29
- '5YktoWygr1Bp9wiS1xtMtUki1PeYuuzuCF98tqwYxf61',
30
- '295Avbam4qGShBYK7E9H5Ldew4B3WyJGmgmXfiWdeeyV',
31
- 'EDi4rSy2LZgKJX74mbLTFk4mxoTgT6F7HxxzG2HBAFyK',
32
- 'BnGKHAC386n4Qmv9xtpBVbRaUTKixjBe3oagkPFKtoy6',
33
- 'Dd7K2Fp7AtoN8xCghKDRmyqr5U169t48Tw5fEd3wT9mq',
34
- 'AP6qExwrbRgBAVaehg4b5xHENX815sMabtBzUzVB4v8S',
35
- ];
36
- /** 默认 Tip 金额 (lamports) */
37
- export const DEFAULT_TIP_AMOUNT = 1000000;
38
- /** 最小 Tip 金额 (lamports) */
39
- export const MIN_TIP_AMOUNT = 1000000;
40
- /** 默认请求超时 (ms) */
41
- export const BLOCKRAZOR_DEFAULT_TIMEOUT = 10000;
42
- // ============================================================================
43
- // Geyser Stream 端点
44
- // ============================================================================
45
- /** Geyser Stream 端点 */
46
- export const GEYSER_STREAM_ENDPOINTS = {
47
- /** 东京 */
48
- TOKYO: 'geyserstream-tokyo.blockrazor.xyz:443',
49
- /** 法兰克福 */
50
- FRANKFURT: 'geyserstream-frankfurt.blockrazor.xyz:443',
51
- /** 纽约 */
52
- NEW_YORK: 'geyserstream-newyork.blockrazor.xyz:443',
53
- /** 阿姆斯特丹 */
54
- AMSTERDAM: 'geyserstream-amsterdam.blockrazor.xyz:443',
55
- };
@@ -1,128 +0,0 @@
1
- /**
2
- * BlockRazor Geyser Stream 服务
3
- * @module sol/dex/blockrazor/geyser
4
- *
5
- * Geyser Stream 是基于 Yellowstone gRPC 的高性能 Solana 数据流服务。
6
- *
7
- * @see https://blockrazor.gitbook.io/blockrazor/solana/geyser-stream
8
- */
9
- import type { GeyserRegion, GeyserSubscribeConfig, GeyserClientConfig, GeyserEventHandlers, GeyserStreamControl } from './types.js';
10
- /**
11
- * Geyser Proto 定义(内联)
12
- *
13
- * 用于动态加载 gRPC 服务
14
- */
15
- export declare const GEYSER_PROTO_DEFINITION = "\nsyntax = \"proto3\";\n\npackage geyser;\n\nservice Geyser {\n rpc Subscribe(stream SubscribeRequest) returns (stream SubscribeUpdate);\n}\n\nmessage SubscribeRequest {\n map<string, SubscribeRequestFilterAccounts> accounts = 1;\n map<string, SubscribeRequestFilterSlots> slots = 2;\n map<string, SubscribeRequestFilterTransactions> transactions = 3;\n map<string, SubscribeRequestFilterBlocks> blocks = 4;\n map<string, SubscribeRequestFilterBlocksMeta> blocks_meta = 5;\n map<string, SubscribeRequestFilterEntry> entry = 6;\n optional CommitmentLevel commitment = 7;\n repeated SubscribeRequestAccountsDataSlice accounts_data_slice = 8;\n optional SubscribeRequestPing ping = 9;\n}\n\nenum CommitmentLevel {\n PROCESSED = 0;\n CONFIRMED = 1;\n FINALIZED = 2;\n}\n\nmessage SubscribeRequestFilterAccounts {\n repeated string account = 1;\n repeated string owner = 2;\n repeated SubscribeRequestFilterAccountsFilter filters = 3;\n optional bool nonempty_txn_signature = 4;\n}\n\nmessage SubscribeRequestFilterAccountsFilter {\n oneof filter {\n SubscribeRequestFilterAccountsFilterMemcmp memcmp = 1;\n uint64 datasize = 2;\n bool token_account_state = 3;\n SubscribeRequestFilterAccountsFilterLamports lamports = 4;\n }\n}\n\nmessage SubscribeRequestFilterAccountsFilterMemcmp {\n uint64 offset = 1;\n oneof data {\n bytes bytes = 2;\n string base58 = 3;\n string base64 = 4;\n }\n}\n\nmessage SubscribeRequestFilterAccountsFilterLamports {\n oneof cmp {\n uint64 eq = 1;\n uint64 ne = 2;\n uint64 lt = 3;\n uint64 gt = 4;\n }\n}\n\nmessage SubscribeRequestFilterSlots {\n optional bool filter_by_commitment = 1;\n optional bool interleave_global_updates = 2;\n}\n\nmessage SubscribeRequestFilterTransactions {\n optional bool vote = 1;\n optional bool failed = 2;\n optional string signature = 3;\n repeated string account_include = 4;\n repeated string account_exclude = 5;\n repeated string account_required = 6;\n}\n\nmessage SubscribeRequestFilterBlocks {\n repeated string account_include = 1;\n optional bool include_transactions = 2;\n optional bool include_accounts = 3;\n optional bool include_entries = 4;\n}\n\nmessage SubscribeRequestFilterBlocksMeta {}\n\nmessage SubscribeRequestFilterEntry {}\n\nmessage SubscribeRequestAccountsDataSlice {\n uint64 offset = 1;\n uint64 length = 2;\n}\n\nmessage SubscribeRequestPing {\n int32 id = 1;\n}\n\nmessage SubscribeUpdate {\n repeated string filters = 1;\n oneof update_oneof {\n SubscribeUpdateAccount account = 2;\n SubscribeUpdateSlot slot = 3;\n SubscribeUpdateTransaction transaction = 4;\n SubscribeUpdateTransactionInfo transaction_info = 10;\n SubscribeUpdateBlock block = 5;\n SubscribeUpdatePing ping = 6;\n SubscribeUpdatePong pong = 7;\n SubscribeUpdateBlockMeta block_meta = 8;\n SubscribeUpdateEntry entry = 9;\n }\n uint64 created_at = 11;\n}\n\nmessage SubscribeUpdateAccount {\n SubscribeUpdateAccountInfo account = 1;\n uint64 slot = 2;\n optional bool is_startup = 3;\n}\n\nmessage SubscribeUpdateAccountInfo {\n bytes pubkey = 1;\n uint64 lamports = 2;\n bytes owner = 3;\n bool executable = 4;\n uint64 rent_epoch = 5;\n bytes data = 6;\n uint64 write_version = 7;\n optional bytes txn_signature = 8;\n}\n\nmessage SubscribeUpdateSlot {\n uint64 slot = 1;\n optional uint64 parent = 2;\n CommitmentLevel status = 3;\n optional int64 dead_error = 4;\n}\n\nmessage SubscribeUpdateTransaction {\n SubscribeUpdateTransactionInfo transaction = 1;\n uint64 slot = 2;\n}\n\nmessage SubscribeUpdateTransactionInfo {\n bytes signature = 1;\n bool is_vote = 2;\n bytes transaction = 3;\n bytes meta = 4;\n optional uint64 index = 5;\n}\n\nmessage SubscribeUpdateBlock {\n uint64 slot = 1;\n string blockhash = 2;\n SubscribeUpdateBlockRewards rewards = 3;\n UnixTimestamp block_time = 4;\n BlockHeight block_height = 5;\n uint64 parent_slot = 6;\n string parent_blockhash = 7;\n uint64 executed_transaction_count = 8;\n uint64 entries_count = 9;\n repeated SubscribeUpdateTransactionInfo transactions = 10;\n repeated SubscribeUpdateAccountInfo updated_account_count = 11;\n repeated SubscribeUpdateEntry entries = 12;\n}\n\nmessage SubscribeUpdateBlockRewards {\n bytes rewards = 1;\n}\n\nmessage UnixTimestamp {\n int64 timestamp = 1;\n}\n\nmessage BlockHeight {\n uint64 block_height = 1;\n}\n\nmessage SubscribeUpdatePing {}\n\nmessage SubscribeUpdatePong {\n int32 id = 1;\n}\n\nmessage SubscribeUpdateBlockMeta {\n uint64 slot = 1;\n string blockhash = 2;\n SubscribeUpdateBlockRewards rewards = 3;\n UnixTimestamp block_time = 4;\n BlockHeight block_height = 5;\n uint64 parent_slot = 6;\n string parent_blockhash = 7;\n uint64 executed_transaction_count = 8;\n uint64 entries_count = 9;\n}\n\nmessage SubscribeUpdateEntry {\n uint64 slot = 1;\n uint64 index = 2;\n uint64 num_hashes = 3;\n bytes hash = 4;\n uint64 executed_transaction_count = 5;\n optional uint64 starting_transaction_index = 6;\n}\n";
16
- /**
17
- * 获取 Geyser Stream 端点
18
- *
19
- * @param region 区域
20
- * @returns gRPC 端点地址
21
- */
22
- export declare function getGeyserEndpoint(region?: GeyserRegion): string;
23
- /**
24
- * 构建 Geyser 订阅请求
25
- *
26
- * @param config 订阅配置
27
- * @returns gRPC 请求对象
28
- */
29
- export declare function buildGeyserSubscribeRequest(config: GeyserSubscribeConfig): Record<string, unknown>;
30
- /**
31
- * 创建默认账户订阅配置
32
- *
33
- * @param owners 拥有者地址列表
34
- * @param accounts 特定账户地址列表
35
- * @returns 订阅配置
36
- */
37
- export declare function createAccountSubscribeConfig(owners?: string[], accounts?: string[]): GeyserSubscribeConfig;
38
- /**
39
- * 创建默认交易订阅配置
40
- *
41
- * @param accountInclude 包含涉及这些账户的交易
42
- * @param accountRequired 交易必须涉及这些账户
43
- * @returns 订阅配置
44
- */
45
- export declare function createTransactionSubscribeConfig(accountInclude?: string[], accountRequired?: string[]): GeyserSubscribeConfig;
46
- /**
47
- * 创建默认区块订阅配置
48
- *
49
- * @param accountInclude 包含涉及这些账户的区块
50
- * @param includeTransactions 是否包含交易
51
- * @returns 订阅配置
52
- */
53
- export declare function createBlockSubscribeConfig(accountInclude?: string[], includeTransactions?: boolean): GeyserSubscribeConfig;
54
- /**
55
- * 创建 Geyser 订阅(需要 @grpc/grpc-js 和 @grpc/proto-loader)
56
- *
57
- * 注意:此函数需要安装 gRPC 依赖:
58
- * ```bash
59
- * npm install @grpc/grpc-js @grpc/proto-loader
60
- * ```
61
- *
62
- * @param clientConfig 客户端配置
63
- * @param subscribeConfig 订阅配置
64
- * @param handlers 事件处理器
65
- * @returns 流控制对象
66
- *
67
- * @example
68
- * ```typescript
69
- * import { Sol } from 'four-flap-meme-sdk'
70
- * import bs58 from 'bs58'
71
- *
72
- * const stream = await Sol.createGeyserSubscription(
73
- * {
74
- * host: Sol.getGeyserEndpoint('tokyo'),
75
- * token: 'your-auth-token',
76
- * },
77
- * Sol.createTransactionSubscribeConfig(
78
- * ['your-account-address'], // 监听涉及此账户的交易
79
- * ),
80
- * {
81
- * onTransaction: (update, raw) => {
82
- * console.log(`交易: ${bs58.encode(update.transaction.signature)}`)
83
- * },
84
- * onError: (err) => console.error('错误:', err),
85
- * onEnd: () => console.log('流结束'),
86
- * },
87
- * )
88
- *
89
- * // 关闭流
90
- * stream.close()
91
- * ```
92
- */
93
- export declare function createGeyserSubscription(clientConfig: GeyserClientConfig, subscribeConfig: GeyserSubscribeConfig, handlers: GeyserEventHandlers): Promise<GeyserStreamControl>;
94
- /**
95
- * 简化版:订阅账户更新
96
- *
97
- * @param token 认证 Token
98
- * @param accounts 账户地址列表
99
- * @param onUpdate 更新回调
100
- * @param region 区域(默认 tokyo)
101
- * @returns 流控制对象
102
- */
103
- export declare function subscribeGeyserAccounts(token: string, accounts: string[], onUpdate: (pubkey: string, lamports: string, slot: string) => void, region?: GeyserRegion): Promise<{
104
- close: () => void;
105
- }>;
106
- /**
107
- * 简化版:订阅交易更新
108
- *
109
- * @param token 认证 Token
110
- * @param accountInclude 包含涉及这些账户的交易
111
- * @param onUpdate 更新回调
112
- * @param region 区域(默认 tokyo)
113
- * @returns 流控制对象
114
- */
115
- export declare function subscribeGeyserTransactions(token: string, accountInclude: string[], onUpdate: (signature: string, isVote: boolean, slot: string) => void, region?: GeyserRegion): Promise<{
116
- close: () => void;
117
- }>;
118
- /**
119
- * 简化版:订阅区块更新
120
- *
121
- * @param token 认证 Token
122
- * @param onUpdate 更新回调
123
- * @param region 区域(默认 tokyo)
124
- * @returns 流控制对象
125
- */
126
- export declare function subscribeGeyserBlocks(token: string, onUpdate: (slot: string, blockhash: string, txCount: number) => void, region?: GeyserRegion): Promise<{
127
- close: () => void;
128
- }>;