four-flap-meme-sdk 4.1.0 → 4.2.0
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/bundle/four-meme/core/sell-flow.js +6 -6
- package/dist/bundle/four-meme/pancake-proxy/helpers.d.ts +5 -38
- package/dist/bundle/four-meme/pancake-proxy/helpers.js +5 -228
- package/dist/bundle/four-meme/private/sell.js +3 -3
- package/dist/bundle/four-meme/swap-hop-helpers.d.ts +1 -5
- package/dist/bundle/four-meme/swap-hop-helpers.js +1 -63
- package/dist/bundle/four-meme/types/bundle-ops.d.ts +166 -0
- package/dist/bundle/four-meme/types/bundle-ops.js +4 -0
- package/dist/bundle/four-meme/types/buy-first.d.ts +1 -1
- package/dist/bundle/four-meme/types/config.d.ts +95 -0
- package/dist/bundle/four-meme/types/config.js +1 -0
- package/dist/bundle/four-meme/types/core-flow.d.ts +2 -1
- package/dist/bundle/four-meme/types/index.d.ts +5 -611
- package/dist/bundle/four-meme/types/pancake-proxy-types.d.ts +118 -0
- package/dist/bundle/four-meme/types/pancake-proxy-types.js +3 -0
- package/dist/bundle/four-meme/types/swap-types.d.ts +103 -0
- package/dist/bundle/four-meme/types/swap-types.js +1 -0
- package/dist/bundle/four-meme/types/transfer-ops.d.ts +134 -0
- package/dist/bundle/four-meme/types/transfer-ops.js +1 -0
- package/dist/chains/bsc/pancake/bundle-buy-first-multi-wallet.js +2 -2
- package/dist/chains/bsc/pancake/bundle-buy-first.js +2 -2
- package/dist/chains/bsc/pancake/hop-chain.d.ts +1 -18
- package/dist/chains/bsc/pancake/hop-chain.js +1 -229
- package/dist/chains/bsc/pancake/quote.d.ts +10 -2
- package/dist/chains/bsc/pancake/quote.js +14 -6
- package/dist/chains/bsc/pancake/quote.test.js +13 -1
- package/dist/chains/index.d.ts +3 -0
- package/dist/chains/index.js +4 -0
- package/dist/chains/robinhood/constants.d.ts +48 -0
- package/dist/chains/robinhood/constants.js +55 -0
- package/dist/chains/robinhood/index.d.ts +11 -0
- package/dist/chains/robinhood/index.js +9 -0
- package/dist/chains/robinhood/longetf/assets.d.ts +11 -0
- package/dist/chains/robinhood/longetf/assets.js +4 -0
- package/dist/chains/robinhood/longetf/encode.d.ts +41 -0
- package/dist/chains/robinhood/longetf/encode.js +116 -0
- package/dist/chains/robinhood/longetf/index.d.ts +3 -0
- package/dist/chains/robinhood/longetf/index.js +3 -0
- package/dist/chains/robinhood/longetf/launch.d.ts +49 -0
- package/dist/chains/robinhood/longetf/launch.js +64 -0
- package/dist/chains/robinhood/pons-v2/encode.d.ts +62 -0
- package/dist/chains/robinhood/pons-v2/encode.js +115 -0
- package/dist/chains/robinhood/pons-v2/index.d.ts +2 -0
- package/dist/chains/robinhood/pons-v2/index.js +2 -0
- package/dist/chains/robinhood/pons-v2/launch.d.ts +48 -0
- package/dist/chains/robinhood/pons-v2/launch.js +107 -0
- package/dist/chains/robinhood/robinhood.test.d.ts +1 -0
- package/dist/chains/robinhood/robinhood.test.js +103 -0
- package/dist/chains/robinhood/sign.d.ts +20 -0
- package/dist/chains/robinhood/sign.js +31 -0
- package/dist/chains/xlayer/eip7702/types-base.d.ts +44 -0
- package/dist/chains/xlayer/eip7702/types-base.js +4 -0
- package/dist/chains/xlayer/eip7702/types-bundle.d.ts +191 -0
- package/dist/chains/xlayer/eip7702/types-bundle.js +1 -0
- package/dist/chains/xlayer/eip7702/types-create.d.ts +222 -0
- package/dist/chains/xlayer/eip7702/types-create.js +1 -0
- package/dist/chains/xlayer/eip7702/types-transfer.d.ts +124 -0
- package/dist/chains/xlayer/eip7702/types-transfer.js +1 -0
- package/dist/chains/xlayer/eip7702/types.d.ts +4 -578
- package/dist/chains/xlayer/eip7702/types.js +0 -3
- package/dist/chains/xlayer/eoa/eoa-dex-types.d.ts +196 -0
- package/dist/chains/xlayer/eoa/eoa-dex-types.js +1 -0
- package/dist/chains/xlayer/eoa/eoa-swap-types.d.ts +283 -0
- package/dist/chains/xlayer/eoa/eoa-swap-types.js +1 -0
- package/dist/chains/xlayer/eoa/eoa-trade-types.d.ts +300 -0
- package/dist/chains/xlayer/eoa/eoa-trade-types.js +6 -0
- package/dist/chains/xlayer/eoa/eoa-types.d.ts +4 -774
- package/dist/chains/xlayer/eoa/eoa-types.js +0 -5
- package/dist/chains/xlayer/eoa/eoa-wash-volume.js +2 -13
- package/dist/chains/xlayer/eoa/hop-chain.d.ts +1 -1
- package/dist/chains/xlayer/eoa/hop-chain.js +4 -83
- package/dist/core/constants/addresses.d.ts +18 -0
- package/dist/core/constants/addresses.js +23 -0
- package/dist/core/constants/chains.d.ts +16 -0
- package/dist/core/constants/chains.js +20 -0
- package/dist/core/constants/gas.d.ts +8 -0
- package/dist/core/constants/gas.js +9 -0
- package/dist/core/constants/index.d.ts +2 -1
- package/dist/core/constants/index.js +2 -1
- package/dist/core/constants/slippage.d.ts +6 -0
- package/dist/core/constants/slippage.js +15 -0
- package/dist/domains/flap/portal-bundle-merkle/core-helpers.js +2 -2
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.d.ts +2 -43
- package/dist/domains/flap/portal-bundle-merkle/pancake-proxy/helpers.js +8 -208
- package/dist/domains/flap/portal-bundle-merkle/private/helpers.js +2 -2
- package/dist/domains/flap/portal-bundle-merkle/private/sell.js +2 -2
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.d.ts +4 -24
- package/dist/domains/flap/portal-bundle-merkle/swap-helpers.js +12 -166
- package/dist/domains/flap/portal-bundle-merkle/types-bundle.d.ts +137 -0
- package/dist/domains/flap/portal-bundle-merkle/types-bundle.js +7 -0
- package/dist/domains/flap/portal-bundle-merkle/types-config.d.ts +118 -0
- package/dist/domains/flap/portal-bundle-merkle/types-config.js +4 -0
- package/dist/domains/flap/portal-bundle-merkle/types-pancake.d.ts +118 -0
- package/dist/domains/flap/portal-bundle-merkle/types-pancake.js +4 -0
- package/dist/domains/flap/portal-bundle-merkle/types-transfer.d.ts +70 -0
- package/dist/domains/flap/portal-bundle-merkle/types-transfer.js +1 -0
- package/dist/domains/flap/portal-bundle-merkle/types.d.ts +4 -441
- package/dist/domains/holders/internal/disperse.js +2 -18
- package/dist/domains/lp-inspect/inspect-helpers.d.ts +1 -0
- package/dist/domains/lp-inspect/inspect-helpers.js +3 -16
- package/dist/exports/root-foundations.d.ts +1 -1
- package/dist/exports/root-foundations.js +1 -1
- package/dist/exports/root-robinhood.d.ts +9 -0
- package/dist/exports/root-robinhood.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/hop-chains.d.ts +0 -3
- package/dist/utils/hop-chains.js +4 -5
- package/dist/utils/pancake-router-tx.d.ts +41 -0
- package/dist/utils/pancake-router-tx.js +174 -0
- package/dist/utils/swap-helpers.d.ts +6 -2
- package/dist/utils/swap-helpers.js +24 -4
- package/dist/utils/wallet.js +12 -12
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { FourBundleMerkleConfig, FourSignConfig, MerkleSignedResult } from './config.js';
|
|
2
|
+
/** ✅ PancakeProxy 批量购买参数(Merkle 版本 - 完整) */
|
|
3
|
+
export type FourPancakeProxyBatchBuyParams = {
|
|
4
|
+
privateKeys: string[];
|
|
5
|
+
buyAmounts: string[];
|
|
6
|
+
tokenAddress: string;
|
|
7
|
+
routeType: 'v2' | 'v3-single' | 'v3-multi';
|
|
8
|
+
v2Path?: string[];
|
|
9
|
+
v3TokenIn?: string;
|
|
10
|
+
v3Fee?: number;
|
|
11
|
+
v3LpAddresses?: string[];
|
|
12
|
+
v3ExactTokenIn?: string;
|
|
13
|
+
/** V3 多跳:代币路径 [tokenIn, tokenMid1, ..., tokenOut] */
|
|
14
|
+
v3Tokens?: string[];
|
|
15
|
+
/** V3 多跳:费率路径 [fee0, fee1, ...] - 长度 = v3Tokens.length - 1 */
|
|
16
|
+
v3Fees?: number[];
|
|
17
|
+
minOutputAmounts?: (string | bigint)[];
|
|
18
|
+
config: FourBundleMerkleConfig;
|
|
19
|
+
};
|
|
20
|
+
/** ✅ PancakeProxy 批量购买参数(仅签名版本 - 精简) */
|
|
21
|
+
export type FourPancakeProxyBatchBuySignParams = {
|
|
22
|
+
privateKeys: string[];
|
|
23
|
+
buyAmounts: string[];
|
|
24
|
+
tokenAddress: string;
|
|
25
|
+
routeType: 'v2' | 'v3-single' | 'v3-multi';
|
|
26
|
+
v2Path?: string[];
|
|
27
|
+
v3TokenIn?: string;
|
|
28
|
+
v3Fee?: number;
|
|
29
|
+
v3LpAddresses?: string[];
|
|
30
|
+
v3ExactTokenIn?: string;
|
|
31
|
+
/** V3 多跳:代币路径 [tokenIn, tokenMid1, ..., tokenOut] */
|
|
32
|
+
v3Tokens?: string[];
|
|
33
|
+
/** V3 多跳:费率路径 [fee0, fee1, ...] - 长度 = v3Tokens.length - 1 */
|
|
34
|
+
v3Fees?: number[];
|
|
35
|
+
minOutputAmounts?: (string | bigint)[];
|
|
36
|
+
config: FourSignConfig;
|
|
37
|
+
};
|
|
38
|
+
/** ✅ PancakeProxy 批量购买结果(简化版) */
|
|
39
|
+
export type FourPancakeProxyBatchBuyResult = MerkleSignedResult;
|
|
40
|
+
/** ✅ PancakeProxy 批量卖出参数(Merkle 版本 - 完整) */
|
|
41
|
+
export type FourPancakeProxyBatchSellParams = {
|
|
42
|
+
privateKeys: string[];
|
|
43
|
+
sellAmounts: string[];
|
|
44
|
+
tokenAddress: string;
|
|
45
|
+
routeType: 'v2' | 'v3-single' | 'v3-multi';
|
|
46
|
+
v2Path?: string[];
|
|
47
|
+
v3TokenOut?: string;
|
|
48
|
+
v3Fee?: number;
|
|
49
|
+
v3LpAddresses?: string[];
|
|
50
|
+
v3ExactTokenIn?: string;
|
|
51
|
+
/** V3 多跳:代币路径 [tokenIn, tokenMid1, ..., tokenOut] */
|
|
52
|
+
v3Tokens?: string[];
|
|
53
|
+
/** V3 多跳:费率路径 [fee0, fee1, ...] - 长度 = v3Tokens.length - 1 */
|
|
54
|
+
v3Fees?: number[];
|
|
55
|
+
minOutputAmounts?: (string | bigint)[];
|
|
56
|
+
config: FourBundleMerkleConfig;
|
|
57
|
+
};
|
|
58
|
+
/** ✅ PancakeProxy 批量卖出参数(仅签名版本 - 精简) */
|
|
59
|
+
export type FourPancakeProxyBatchSellSignParams = {
|
|
60
|
+
privateKeys: string[];
|
|
61
|
+
sellAmounts: string[];
|
|
62
|
+
tokenAddress: string;
|
|
63
|
+
routeType: 'v2' | 'v3-single' | 'v3-multi';
|
|
64
|
+
v2Path?: string[];
|
|
65
|
+
v3TokenOut?: string;
|
|
66
|
+
v3Fee?: number;
|
|
67
|
+
v3LpAddresses?: string[];
|
|
68
|
+
v3ExactTokenIn?: string;
|
|
69
|
+
/** V3 多跳:代币路径 [tokenIn, tokenMid1, ..., tokenOut] */
|
|
70
|
+
v3Tokens?: string[];
|
|
71
|
+
/** V3 多跳:费率路径 [fee0, fee1, ...] - 长度 = v3Tokens.length - 1 */
|
|
72
|
+
v3Fees?: number[];
|
|
73
|
+
minOutputAmounts?: (string | bigint)[];
|
|
74
|
+
config: FourSignConfig;
|
|
75
|
+
};
|
|
76
|
+
/** ✅ PancakeProxy 批量卖出结果(简化版) */
|
|
77
|
+
export type FourPancakeProxyBatchSellResult = MerkleSignedResult;
|
|
78
|
+
export type FourPancakeProxyApprovalParams = {
|
|
79
|
+
privateKey: string;
|
|
80
|
+
tokenAddress: string;
|
|
81
|
+
amount: string | 'max';
|
|
82
|
+
rpcUrl: string;
|
|
83
|
+
/** 路由类型,用于确定授权目标(V2 或 V3 Router) */
|
|
84
|
+
routeType?: 'v2' | 'v3-single' | 'v3-multi';
|
|
85
|
+
};
|
|
86
|
+
export type FourPancakeProxyApprovalBatchParams = {
|
|
87
|
+
privateKeys: string[];
|
|
88
|
+
tokenAddress: string;
|
|
89
|
+
amounts: (string | 'max')[];
|
|
90
|
+
config: FourSignConfig;
|
|
91
|
+
/** 路由类型,用于确定授权目标(V2 或 V3 Router) */
|
|
92
|
+
routeType?: 'v2' | 'v3-single' | 'v3-multi';
|
|
93
|
+
};
|
|
94
|
+
/** ✅ PancakeProxy 批量授权结果 */
|
|
95
|
+
export type FourPancakeProxyApprovalBatchResult = {
|
|
96
|
+
success: boolean;
|
|
97
|
+
approvedCount: number;
|
|
98
|
+
signedTransactions: string[];
|
|
99
|
+
txHashes?: string[];
|
|
100
|
+
bundleHash?: string;
|
|
101
|
+
message: string;
|
|
102
|
+
};
|
|
103
|
+
/** 批量授权 TokenManager 参数(直接 RPC 提交) */
|
|
104
|
+
export type ApproveFourTokenManagerBatchParams = {
|
|
105
|
+
privateKeys: string[];
|
|
106
|
+
tokenAddress: string;
|
|
107
|
+
amounts: string[];
|
|
108
|
+
config: FourSignConfig;
|
|
109
|
+
};
|
|
110
|
+
/** 批量授权 TokenManager 结果 */
|
|
111
|
+
export type ApproveFourTokenManagerBatchResult = {
|
|
112
|
+
success: boolean;
|
|
113
|
+
signedTransactions: string[];
|
|
114
|
+
approvedCount: number;
|
|
115
|
+
skippedCount: number;
|
|
116
|
+
txHashes?: string[];
|
|
117
|
+
message: string;
|
|
118
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { GeneratedWallet } from '../../../utils/wallet.js';
|
|
2
|
+
import type { CommonBundleConfig } from '../../../utils/bundle-helpers.js';
|
|
3
|
+
import type { UserType } from './config.js';
|
|
4
|
+
/** Swap 签名配置(不含 Merkle 字段) */
|
|
5
|
+
export type FourSwapSignConfig = {
|
|
6
|
+
rpcUrl: string;
|
|
7
|
+
gasLimit?: number | bigint;
|
|
8
|
+
gasLimitMultiplier?: number;
|
|
9
|
+
minGasPriceGwei?: number;
|
|
10
|
+
maxGasPriceGwei?: number;
|
|
11
|
+
txType?: 0 | 2;
|
|
12
|
+
chainId?: number;
|
|
13
|
+
reserveGasBNB?: number;
|
|
14
|
+
userType?: UserType;
|
|
15
|
+
bribeAmount?: number;
|
|
16
|
+
};
|
|
17
|
+
/** Swap Merkle 配置(保留兼容) */
|
|
18
|
+
export type FourSwapConfig = CommonBundleConfig & {
|
|
19
|
+
apiKey: string;
|
|
20
|
+
customRpcUrl?: string;
|
|
21
|
+
bundleBlockOffset?: number;
|
|
22
|
+
reserveGasBNB?: number;
|
|
23
|
+
waitForConfirmation?: boolean;
|
|
24
|
+
waitTimeoutMs?: number;
|
|
25
|
+
skipApprovalCheck?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type FourBundleSwapSignParams = {
|
|
28
|
+
sellerPrivateKey: string;
|
|
29
|
+
sellAmount?: string;
|
|
30
|
+
sellPercentage?: number;
|
|
31
|
+
buyerPrivateKey: string;
|
|
32
|
+
tokenAddress: string;
|
|
33
|
+
config: FourSwapSignConfig;
|
|
34
|
+
startNonces?: number[];
|
|
35
|
+
};
|
|
36
|
+
export type FourBundleSwapParams = {
|
|
37
|
+
sellerPrivateKey: string;
|
|
38
|
+
sellAmount?: string;
|
|
39
|
+
sellPercentage?: number;
|
|
40
|
+
buyerPrivateKey: string;
|
|
41
|
+
tokenAddress: string;
|
|
42
|
+
config: FourSwapConfig;
|
|
43
|
+
};
|
|
44
|
+
export type FourSwapResult = {
|
|
45
|
+
signedTransactions: string[];
|
|
46
|
+
profitHopWallets?: GeneratedWallet[];
|
|
47
|
+
metadata?: {
|
|
48
|
+
sellerAddress: string;
|
|
49
|
+
buyerAddress: string;
|
|
50
|
+
sellAmount: string;
|
|
51
|
+
buyAmount: string;
|
|
52
|
+
hasApproval?: boolean;
|
|
53
|
+
profitAmount?: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export type FourBatchSwapSignParams = {
|
|
57
|
+
sellerPrivateKey: string;
|
|
58
|
+
sellAmount?: string;
|
|
59
|
+
sellPercentage?: number;
|
|
60
|
+
buyerPrivateKeys: string[];
|
|
61
|
+
buyerRatios?: number[];
|
|
62
|
+
tokenAddress: string;
|
|
63
|
+
config: FourSwapSignConfig;
|
|
64
|
+
startNonces?: number[];
|
|
65
|
+
};
|
|
66
|
+
export type FourBatchSwapResult = {
|
|
67
|
+
signedTransactions: string[];
|
|
68
|
+
profitHopWallets?: GeneratedWallet[];
|
|
69
|
+
metadata?: {
|
|
70
|
+
sellerAddress: string;
|
|
71
|
+
buyerAddresses: string[];
|
|
72
|
+
sellAmount: string;
|
|
73
|
+
buyAmounts: string[];
|
|
74
|
+
hasApproval?: boolean;
|
|
75
|
+
profitAmount?: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export type FourQuickBatchSwapSignParams = {
|
|
79
|
+
sellerPrivateKey: string;
|
|
80
|
+
sellAmount?: string;
|
|
81
|
+
sellPercentage?: number;
|
|
82
|
+
buyerPrivateKeys: string[];
|
|
83
|
+
buyerRatios?: number[];
|
|
84
|
+
buyerAmounts?: string[];
|
|
85
|
+
tokenAddress: string;
|
|
86
|
+
config: FourSwapSignConfig;
|
|
87
|
+
disperseHopCount?: number;
|
|
88
|
+
startNonces?: number[];
|
|
89
|
+
};
|
|
90
|
+
export type FourQuickBatchSwapResult = {
|
|
91
|
+
signedTransactions: string[];
|
|
92
|
+
disperseHopWallets?: GeneratedWallet[];
|
|
93
|
+
profitHopWallets?: GeneratedWallet[];
|
|
94
|
+
metadata?: {
|
|
95
|
+
sellerAddress: string;
|
|
96
|
+
buyerAddresses: string[];
|
|
97
|
+
sellAmount: string;
|
|
98
|
+
estimatedBNBOut: string;
|
|
99
|
+
transferAmounts: string[];
|
|
100
|
+
profitAmount?: string;
|
|
101
|
+
disperseHopCount?: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { AmountLike } from '../../types/index.js';
|
|
2
|
+
import type { FourBundleMerkleConfig, FourSignConfig, MerkleSignedResult, QuoteTokenType, TokenPoolType, UserType } from './config.js';
|
|
3
|
+
export type DisperseMerkleParams = {
|
|
4
|
+
fromPrivateKey: string;
|
|
5
|
+
recipients: string[];
|
|
6
|
+
amount?: AmountLike;
|
|
7
|
+
amounts?: AmountLike[];
|
|
8
|
+
tokenAddress?: string;
|
|
9
|
+
tokenDecimals?: number;
|
|
10
|
+
hopCount?: number | number[];
|
|
11
|
+
hopPrivateKeys?: string[][];
|
|
12
|
+
items?: Array<{
|
|
13
|
+
to: string;
|
|
14
|
+
amount: AmountLike;
|
|
15
|
+
hopCount?: number;
|
|
16
|
+
hopPrivateKeys?: string[];
|
|
17
|
+
}>;
|
|
18
|
+
config: FourBundleMerkleConfig;
|
|
19
|
+
};
|
|
20
|
+
/** ✅ 分发参数(仅签名版本 - 精简) */
|
|
21
|
+
export type DisperseSignParams = {
|
|
22
|
+
fromPrivateKey: string;
|
|
23
|
+
recipients: string[];
|
|
24
|
+
amount?: AmountLike;
|
|
25
|
+
amounts?: AmountLike[];
|
|
26
|
+
tokenAddress?: string;
|
|
27
|
+
tokenDecimals?: number;
|
|
28
|
+
hopCount?: number | number[];
|
|
29
|
+
hopPrivateKeys?: string[][];
|
|
30
|
+
items?: Array<{
|
|
31
|
+
to: string;
|
|
32
|
+
amount: AmountLike;
|
|
33
|
+
hopCount?: number;
|
|
34
|
+
hopPrivateKeys?: string[];
|
|
35
|
+
}>;
|
|
36
|
+
config: FourSignConfig;
|
|
37
|
+
/** ✅ 新增:起始 nonce(用于并行调用时避免 nonce 冲突) */
|
|
38
|
+
startNonce?: number;
|
|
39
|
+
/** ✅ 新增:代币池子类型(用于利润报价),默认 'v2' */
|
|
40
|
+
tokenPoolType?: TokenPoolType;
|
|
41
|
+
/** ✅ 新增:报价代币类型(池子的计价代币),默认 'native'(BNB/MON) */
|
|
42
|
+
quoteToken?: QuoteTokenType;
|
|
43
|
+
/** ✅ 新增:用户类型(用于利润费率),v0=万分之6,v1=万分之5,默认 v0 */
|
|
44
|
+
userType?: UserType;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* ✅ 分发结果(简化版)
|
|
48
|
+
* 包含 hopWallets 用于返回生成的多跳钱包私钥
|
|
49
|
+
*/
|
|
50
|
+
export type DisperseMerkleResult = MerkleSignedResult;
|
|
51
|
+
/** ✅ 归集参数(Merkle 版本 - 完整) */
|
|
52
|
+
export type SweepMerkleParams = {
|
|
53
|
+
sourcePrivateKeys: string[];
|
|
54
|
+
target: string;
|
|
55
|
+
targetPrivateKey?: string;
|
|
56
|
+
ratioPct?: number;
|
|
57
|
+
ratios?: number[];
|
|
58
|
+
amount?: AmountLike;
|
|
59
|
+
amounts?: AmountLike[];
|
|
60
|
+
tokenAddress?: string;
|
|
61
|
+
tokenDecimals?: number;
|
|
62
|
+
skipIfInsufficient?: boolean;
|
|
63
|
+
hopCount?: number | number[];
|
|
64
|
+
hopPrivateKeys?: string[][];
|
|
65
|
+
sources?: Array<{
|
|
66
|
+
privateKey: string;
|
|
67
|
+
ratioPct?: number;
|
|
68
|
+
amount?: AmountLike;
|
|
69
|
+
hopCount?: number;
|
|
70
|
+
hopPrivateKeys?: string[];
|
|
71
|
+
}>;
|
|
72
|
+
config: FourBundleMerkleConfig;
|
|
73
|
+
};
|
|
74
|
+
/** ✅ 归集参数(仅签名版本 - 精简) */
|
|
75
|
+
export type SweepSignParams = {
|
|
76
|
+
sourcePrivateKeys: string[];
|
|
77
|
+
target: string;
|
|
78
|
+
/** ✅ 新增:归集目标地址的私钥(用于支付利润,不提供则由归集金额最大的源钱包支付) */
|
|
79
|
+
targetPrivateKey?: string;
|
|
80
|
+
ratioPct?: number;
|
|
81
|
+
ratios?: number[];
|
|
82
|
+
amount?: AmountLike;
|
|
83
|
+
amounts?: AmountLike[];
|
|
84
|
+
tokenAddress?: string;
|
|
85
|
+
tokenDecimals?: number;
|
|
86
|
+
skipIfInsufficient?: boolean;
|
|
87
|
+
hopCount?: number | number[];
|
|
88
|
+
hopPrivateKeys?: string[][];
|
|
89
|
+
sources?: Array<{
|
|
90
|
+
privateKey: string;
|
|
91
|
+
ratioPct?: number;
|
|
92
|
+
amount?: AmountLike;
|
|
93
|
+
hopCount?: number;
|
|
94
|
+
hopPrivateKeys?: string[];
|
|
95
|
+
}>;
|
|
96
|
+
config: FourSignConfig;
|
|
97
|
+
/** ✅ 新增:起始 nonce(用于并行调用时避免 nonce 冲突,仅对第一个源钱包生效) */
|
|
98
|
+
startNonce?: number;
|
|
99
|
+
/** ✅ 新增:代币池子类型(用于利润报价),默认 'v2' */
|
|
100
|
+
tokenPoolType?: TokenPoolType;
|
|
101
|
+
/** ✅ 新增:报价代币类型(池子的计价代币),默认 'native'(BNB/MON) */
|
|
102
|
+
quoteToken?: QuoteTokenType;
|
|
103
|
+
/** ✅ 新增:用户类型(用于利润费率),v0=万分之6,v1=万分之5,默认 v0 */
|
|
104
|
+
userType?: UserType;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* ✅ 归集结果(简化版)
|
|
108
|
+
* 包含 hopWallets 用于返回生成的多跳钱包私钥
|
|
109
|
+
*/
|
|
110
|
+
export type SweepMerkleResult = MerkleSignedResult;
|
|
111
|
+
/**
|
|
112
|
+
* 多对多(地址一一对应)转账参数(仅签名版本)
|
|
113
|
+
* - senderPrivateKeys / receiverAddresses 必须等长
|
|
114
|
+
* - amount / amounts 二选一(amounts 优先)
|
|
115
|
+
* - 支持多跳:hopCount 可为 number 或逐对数组
|
|
116
|
+
* - 支持利润刮取:利润由第一个 sender 支付(作为额外费用,不扣减每对转账金额)
|
|
117
|
+
*/
|
|
118
|
+
export type PairwiseTransferSignParams = {
|
|
119
|
+
senderPrivateKeys: string[];
|
|
120
|
+
receiverAddresses: string[];
|
|
121
|
+
amount?: AmountLike;
|
|
122
|
+
amounts?: AmountLike[];
|
|
123
|
+
tokenAddress?: string;
|
|
124
|
+
tokenDecimals?: number;
|
|
125
|
+
hopCount?: number | number[];
|
|
126
|
+
hopPrivateKeys?: string[][];
|
|
127
|
+
config: FourSignConfig;
|
|
128
|
+
/** ✅ 起始 nonce(仅对第一个 sender 生效,用于并行调用避免 nonce 冲突) */
|
|
129
|
+
startNonce?: number;
|
|
130
|
+
tokenPoolType?: TokenPoolType;
|
|
131
|
+
quoteToken?: QuoteTokenType;
|
|
132
|
+
userType?: UserType;
|
|
133
|
+
};
|
|
134
|
+
export type PairwiseTransferMerkleResult = MerkleSignedResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,7 +11,7 @@ import { createPancakeContext, getGasPrice, quoteTokenOutput } from './bundle-bu
|
|
|
11
11
|
import { validateSwapCounts } from './bundle-buy-first-plan.js';
|
|
12
12
|
import { buildSingleBuyTx, buildSingleSellTx } from './bundle-buy-first-build.js';
|
|
13
13
|
import { buildProfitTransaction } from './bundle-buy-first-profit.js';
|
|
14
|
-
import { splitQuotedMins } from './quote.js';
|
|
14
|
+
import { isSameWalletBuySell, resolveBuyFirstSellMins, splitQuotedMins } from './quote.js';
|
|
15
15
|
/**
|
|
16
16
|
* ✅ 多钱包捆绑换手
|
|
17
17
|
* - 多个买方钱包执行买入(每个钱包1笔)
|
|
@@ -91,7 +91,7 @@ export async function pancakeBundleBuyFirstMultiWallet(params) {
|
|
|
91
91
|
const sellAmountsWei = splitAmount(actualTokenOut, sellCount);
|
|
92
92
|
const slippageBps = config.slippageBps ?? 100;
|
|
93
93
|
const buyAmountOutMins = splitQuotedMins(quoteResult.quotedTokenOut, buyAmountsWei, slippageBps);
|
|
94
|
-
const sellAmountOutMins =
|
|
94
|
+
const sellAmountOutMins = resolveBuyFirstSellMins(isSameWalletBuySell(buyers, sellers), totalFundsWei, sellAmountsWei, slippageBps);
|
|
95
95
|
// 买合计万三 + 卖合计万三。ERC-20 先把买入合计折成 BNB 再计提,避免 ANTFUN 微额报价为 0
|
|
96
96
|
let profitAmount = 0n;
|
|
97
97
|
if (useNativeToken) {
|
|
@@ -6,7 +6,7 @@ import { getGasLimit } from '../../../core/gas/bundle-gas.js';
|
|
|
6
6
|
import { NonceManager } from '../../../utils/bundle-helpers.js';
|
|
7
7
|
import { BLOCKRAZOR_BUILDER_EOA, ZERO_ADDRESS, GAS_LIMITS, calculateBundleSwapRoundTripProfit } from '../../../core/constants/index.js';
|
|
8
8
|
import { quoteRoundTripProfitToNative } from '../../../core/quote/quote-helpers.js';
|
|
9
|
-
import { splitQuotedMins } from './quote.js';
|
|
9
|
+
import { resolveBuyFirstSellMins, splitQuotedMins } from './quote.js';
|
|
10
10
|
import { buildMultiRouteTransactions, buildProfitTransaction, calculateBuyerFunds, createPancakeContext, getGasPrice, pancakeBundleBuyFirstMultiWallet, planMultiNonces, quoteTokenOutput, splitAmount, validateFinalBalances, validateSwapCounts, } from './bundle-buy-first-helpers.js';
|
|
11
11
|
export async function pancakeBundleBuyFirstMerkle(params) {
|
|
12
12
|
const { buyerPrivateKey, buyerPrivateKeys, sellerPrivateKey, sellerPrivateKeys, routeParams, buyerFunds, buyerFundsPercentage, config, quoteToken, quoteTokenDecimals = 18, buyCount: _buyCount, sellCount: _sellCount, taxRateBps = 0, // ✅ 税率(基点),用于计算实际可卖出代币数量
|
|
@@ -69,7 +69,7 @@ export async function pancakeBundleBuyFirstMerkle(params) {
|
|
|
69
69
|
const sellAmountsWei = splitAmount(actualTokenOut, sellCount);
|
|
70
70
|
const slippageBps = config.slippageBps ?? 100;
|
|
71
71
|
const buyAmountOutMins = splitQuotedMins(quoteResult.quotedTokenOut, buyAmountsWei, slippageBps);
|
|
72
|
-
const sellAmountOutMins =
|
|
72
|
+
const sellAmountOutMins = resolveBuyFirstSellMins(sameAddress, buyerFundsInfo.buyerFundsWei, sellAmountsWei, slippageBps);
|
|
73
73
|
// ✅ 构建多笔买入和卖出交易
|
|
74
74
|
const swapUnsignedArray = await buildMultiRouteTransactions({
|
|
75
75
|
routeParams,
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type DisperseHopPath } from './bundle-swap-types.js';
|
|
3
|
-
/**
|
|
4
|
-
* 生成分发多跳路径
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateDisperseHopPaths(targetAddresses: string[], hopCount: number, provider: JsonRpcProvider): DisperseHopPath[];
|
|
7
|
-
/**
|
|
8
|
-
* 构建原生代币多跳转账链
|
|
9
|
-
*/
|
|
10
|
-
export declare function buildNativeHopChain(payer: Wallet, path: DisperseHopPath, finalAmount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise<string[]>;
|
|
11
|
-
/**
|
|
12
|
-
* 构建 ERC20 多跳转账链(需要配合 BNB 多跳使用)
|
|
13
|
-
*/
|
|
14
|
-
export declare function buildERC20HopChain(payer: Wallet, path: DisperseHopPath, erc20Address: string, erc20Amount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise<string[]>;
|
|
15
|
-
/**
|
|
16
|
-
* 构建 BNB 多跳转账链(为 ERC20 中间钱包预留 gas)
|
|
17
|
-
*/
|
|
18
|
-
export declare function buildBNBHopChainForERC20(payer: Wallet, path: DisperseHopPath, finalGasAmount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise<string[]>;
|
|
1
|
+
export { generateDisperseHopPaths, buildNativeHopChain, buildERC20HopChain, buildBNBHopChainForERC20, } from '../../../utils/hop-chains.js';
|
|
@@ -1,229 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ERC20_ABI } from '../../../abis/common.js';
|
|
3
|
-
import { generateWallets } from '../../../utils/wallet.js';
|
|
4
|
-
import { ERC20_TRANSFER_GAS_LIMIT_HOP, NATIVE_TRANSFER_GAS_LIMIT, } from './bundle-swap-types.js';
|
|
5
|
-
/**
|
|
6
|
-
* 生成分发多跳路径
|
|
7
|
-
*/
|
|
8
|
-
export function generateDisperseHopPaths(targetAddresses, hopCount, provider) {
|
|
9
|
-
if (hopCount <= 0) {
|
|
10
|
-
return targetAddresses.map((addr) => ({
|
|
11
|
-
targetAddress: addr,
|
|
12
|
-
hopWallets: [],
|
|
13
|
-
hopWalletsInfo: [],
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
return targetAddresses.map((targetAddress) => {
|
|
17
|
-
const hopWalletsInfo = generateWallets(hopCount);
|
|
18
|
-
const hopWallets = hopWalletsInfo.map((w) => new Wallet(w.privateKey, provider));
|
|
19
|
-
return { targetAddress, hopWallets, hopWalletsInfo };
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 构建原生代币多跳转账链
|
|
24
|
-
*/
|
|
25
|
-
export async function buildNativeHopChain(payer, path, finalAmount, gasPrice, chainId, txType, payerNonce) {
|
|
26
|
-
const signedTxs = [];
|
|
27
|
-
const hopCount = path.hopWallets.length;
|
|
28
|
-
if (hopCount === 0) {
|
|
29
|
-
const tx = {
|
|
30
|
-
to: path.targetAddress,
|
|
31
|
-
value: finalAmount,
|
|
32
|
-
nonce: payerNonce,
|
|
33
|
-
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
34
|
-
chainId,
|
|
35
|
-
type: txType,
|
|
36
|
-
};
|
|
37
|
-
if (txType === 2) {
|
|
38
|
-
tx.maxFeePerGas = gasPrice;
|
|
39
|
-
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
tx.gasPrice = gasPrice;
|
|
43
|
-
}
|
|
44
|
-
signedTxs.push(await payer.signTransaction(tx));
|
|
45
|
-
return signedTxs;
|
|
46
|
-
}
|
|
47
|
-
const hopGasCost = NATIVE_TRANSFER_GAS_LIMIT * gasPrice;
|
|
48
|
-
// 计算每跳需要的金额
|
|
49
|
-
const amountsPerHop = [];
|
|
50
|
-
for (let i = 0; i < hopCount; i++) {
|
|
51
|
-
const remainingHops = hopCount - i;
|
|
52
|
-
amountsPerHop.push(finalAmount + hopGasCost * BigInt(remainingHops));
|
|
53
|
-
}
|
|
54
|
-
// payer → hop1
|
|
55
|
-
const firstTx = {
|
|
56
|
-
to: path.hopWallets[0].address,
|
|
57
|
-
value: amountsPerHop[0],
|
|
58
|
-
nonce: payerNonce,
|
|
59
|
-
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
60
|
-
chainId,
|
|
61
|
-
type: txType,
|
|
62
|
-
};
|
|
63
|
-
if (txType === 2) {
|
|
64
|
-
firstTx.maxFeePerGas = gasPrice;
|
|
65
|
-
firstTx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
firstTx.gasPrice = gasPrice;
|
|
69
|
-
}
|
|
70
|
-
signedTxs.push(await payer.signTransaction(firstTx));
|
|
71
|
-
// hop1 → hop2 → ... → target
|
|
72
|
-
for (let i = 0; i < hopCount; i++) {
|
|
73
|
-
const fromWallet = path.hopWallets[i];
|
|
74
|
-
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
75
|
-
const amount = i === hopCount - 1 ? finalAmount : amountsPerHop[i + 1];
|
|
76
|
-
const tx = {
|
|
77
|
-
to: toAddress,
|
|
78
|
-
value: amount,
|
|
79
|
-
nonce: 0,
|
|
80
|
-
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
81
|
-
chainId,
|
|
82
|
-
type: txType,
|
|
83
|
-
};
|
|
84
|
-
if (txType === 2) {
|
|
85
|
-
tx.maxFeePerGas = gasPrice;
|
|
86
|
-
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
tx.gasPrice = gasPrice;
|
|
90
|
-
}
|
|
91
|
-
signedTxs.push(await fromWallet.signTransaction(tx));
|
|
92
|
-
}
|
|
93
|
-
return signedTxs;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* 构建 ERC20 多跳转账链(需要配合 BNB 多跳使用)
|
|
97
|
-
*/
|
|
98
|
-
export async function buildERC20HopChain(payer, path, erc20Address, erc20Amount, gasPrice, chainId, txType, payerNonce) {
|
|
99
|
-
const signedTxs = [];
|
|
100
|
-
const hopCount = path.hopWallets.length;
|
|
101
|
-
const erc20Interface = new ethers.Interface(ERC20_ABI);
|
|
102
|
-
if (hopCount === 0) {
|
|
103
|
-
const data = erc20Interface.encodeFunctionData('transfer', [path.targetAddress, erc20Amount]);
|
|
104
|
-
const tx = {
|
|
105
|
-
to: erc20Address,
|
|
106
|
-
data,
|
|
107
|
-
value: 0n,
|
|
108
|
-
nonce: payerNonce,
|
|
109
|
-
gasLimit: ERC20_TRANSFER_GAS_LIMIT_HOP,
|
|
110
|
-
chainId,
|
|
111
|
-
type: txType,
|
|
112
|
-
};
|
|
113
|
-
if (txType === 2) {
|
|
114
|
-
tx.maxFeePerGas = gasPrice;
|
|
115
|
-
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
tx.gasPrice = gasPrice;
|
|
119
|
-
}
|
|
120
|
-
signedTxs.push(await payer.signTransaction(tx));
|
|
121
|
-
return signedTxs;
|
|
122
|
-
}
|
|
123
|
-
// payer → hop1
|
|
124
|
-
const firstData = erc20Interface.encodeFunctionData('transfer', [path.hopWallets[0].address, erc20Amount]);
|
|
125
|
-
const firstTx = {
|
|
126
|
-
to: erc20Address,
|
|
127
|
-
data: firstData,
|
|
128
|
-
value: 0n,
|
|
129
|
-
nonce: payerNonce,
|
|
130
|
-
gasLimit: ERC20_TRANSFER_GAS_LIMIT_HOP,
|
|
131
|
-
chainId,
|
|
132
|
-
type: txType,
|
|
133
|
-
};
|
|
134
|
-
if (txType === 2) {
|
|
135
|
-
firstTx.maxFeePerGas = gasPrice;
|
|
136
|
-
firstTx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
firstTx.gasPrice = gasPrice;
|
|
140
|
-
}
|
|
141
|
-
signedTxs.push(await payer.signTransaction(firstTx));
|
|
142
|
-
// hop1 → hop2 → ... → target (nonce=1,nonce=0 用于 BNB 转发)
|
|
143
|
-
for (let i = 0; i < hopCount; i++) {
|
|
144
|
-
const fromWallet = path.hopWallets[i];
|
|
145
|
-
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
146
|
-
const data = erc20Interface.encodeFunctionData('transfer', [toAddress, erc20Amount]);
|
|
147
|
-
const tx = {
|
|
148
|
-
to: erc20Address,
|
|
149
|
-
data,
|
|
150
|
-
value: 0n,
|
|
151
|
-
nonce: 1, // nonce=0 已用于 BNB 转发
|
|
152
|
-
gasLimit: ERC20_TRANSFER_GAS_LIMIT_HOP,
|
|
153
|
-
chainId,
|
|
154
|
-
type: txType,
|
|
155
|
-
};
|
|
156
|
-
if (txType === 2) {
|
|
157
|
-
tx.maxFeePerGas = gasPrice;
|
|
158
|
-
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
tx.gasPrice = gasPrice;
|
|
162
|
-
}
|
|
163
|
-
signedTxs.push(await fromWallet.signTransaction(tx));
|
|
164
|
-
}
|
|
165
|
-
return signedTxs;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* 构建 BNB 多跳转账链(为 ERC20 中间钱包预留 gas)
|
|
169
|
-
*/
|
|
170
|
-
export async function buildBNBHopChainForERC20(payer, path, finalGasAmount, gasPrice, chainId, txType, payerNonce) {
|
|
171
|
-
const signedTxs = [];
|
|
172
|
-
const hopCount = path.hopWallets.length;
|
|
173
|
-
if (hopCount === 0) {
|
|
174
|
-
// 无多跳时不需要转 gas
|
|
175
|
-
return signedTxs;
|
|
176
|
-
}
|
|
177
|
-
const hopGasCost = NATIVE_TRANSFER_GAS_LIMIT * gasPrice;
|
|
178
|
-
const erc20GasCost = ERC20_TRANSFER_GAS_LIMIT_HOP * gasPrice;
|
|
179
|
-
// 每个中间钱包需要: BNB 转发 gas + ERC20 转发 gas
|
|
180
|
-
const gasPerHop = hopGasCost + erc20GasCost * 2n; // 2倍安全系数
|
|
181
|
-
// 计算每跳需要的金额
|
|
182
|
-
const amountsPerHop = [];
|
|
183
|
-
for (let i = 0; i < hopCount; i++) {
|
|
184
|
-
const remainingHops = hopCount - i;
|
|
185
|
-
amountsPerHop.push(finalGasAmount + gasPerHop * BigInt(remainingHops));
|
|
186
|
-
}
|
|
187
|
-
// payer → hop1
|
|
188
|
-
const firstTx = {
|
|
189
|
-
to: path.hopWallets[0].address,
|
|
190
|
-
value: amountsPerHop[0],
|
|
191
|
-
nonce: payerNonce,
|
|
192
|
-
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
193
|
-
chainId,
|
|
194
|
-
type: txType,
|
|
195
|
-
};
|
|
196
|
-
if (txType === 2) {
|
|
197
|
-
firstTx.maxFeePerGas = gasPrice;
|
|
198
|
-
firstTx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
firstTx.gasPrice = gasPrice;
|
|
202
|
-
}
|
|
203
|
-
signedTxs.push(await payer.signTransaction(firstTx));
|
|
204
|
-
// hop1 → hop2 → ... → target (nonce=0)
|
|
205
|
-
for (let i = 0; i < hopCount; i++) {
|
|
206
|
-
const fromWallet = path.hopWallets[i];
|
|
207
|
-
const toAddress = i === hopCount - 1 ? path.targetAddress : path.hopWallets[i + 1].address;
|
|
208
|
-
const amount = i === hopCount - 1 ? finalGasAmount : amountsPerHop[i + 1];
|
|
209
|
-
if (i === hopCount - 1 && amount === 0n)
|
|
210
|
-
continue;
|
|
211
|
-
const tx = {
|
|
212
|
-
to: toAddress,
|
|
213
|
-
value: amount,
|
|
214
|
-
nonce: 0,
|
|
215
|
-
gasLimit: NATIVE_TRANSFER_GAS_LIMIT,
|
|
216
|
-
chainId,
|
|
217
|
-
type: txType,
|
|
218
|
-
};
|
|
219
|
-
if (txType === 2) {
|
|
220
|
-
tx.maxFeePerGas = gasPrice;
|
|
221
|
-
tx.maxPriorityFeePerGas = gasPrice / 10n || 1n;
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
tx.gasPrice = gasPrice;
|
|
225
|
-
}
|
|
226
|
-
signedTxs.push(await fromWallet.signTransaction(tx));
|
|
227
|
-
}
|
|
228
|
-
return signedTxs;
|
|
229
|
-
}
|
|
1
|
+
export { generateDisperseHopPaths, buildNativeHopChain, buildERC20HopChain, buildBNBHopChainForERC20, } from '../../../utils/hop-chains.js';
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
+
import { applySlippageBps } from '../../../core/constants/index.js';
|
|
2
3
|
import { type QuoteBNBResult, type QuoteSellParams, type RouteParams, type UserType } from './bundle-swap-types.js';
|
|
3
|
-
/**
|
|
4
|
-
export declare
|
|
4
|
+
/** Pancake 买卖 minOut;实现见 core applySlippageBps。 */
|
|
5
|
+
export declare const applyPancakeSlippage: typeof applySlippageBps;
|
|
5
6
|
export declare function splitQuotedMins(quotedTotal: bigint, amounts: bigint[], slippageBps?: number): bigint[];
|
|
7
|
+
export declare function isSameWalletBuySell(buyers: Array<{
|
|
8
|
+
address: string;
|
|
9
|
+
}>, sellers: Array<{
|
|
10
|
+
address: string;
|
|
11
|
+
}>): boolean;
|
|
12
|
+
/** 同钱包无币刷量卖出必须 minOut=0:同块先买后卖,卖出到账必然低于买入报价。 */
|
|
13
|
+
export declare function resolveBuyFirstSellMins(sameWallet: boolean, quotedTotal: bigint, sellAmounts: bigint[], slippageBps?: number): bigint[];
|
|
6
14
|
export declare function quoteBuyOutput(params: {
|
|
7
15
|
routeParams: RouteParams;
|
|
8
16
|
buyAmountWei: bigint;
|