@clonegod/ttd-bsc-common 1.0.24 → 1.0.25
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.
|
@@ -24,5 +24,5 @@ export declare abstract class AbstractEvmDexTrade extends AbastrcatTrade {
|
|
|
24
24
|
protected isNativeCurrency(symbol: string): boolean;
|
|
25
25
|
protected getWrappedNativeAddress(): string;
|
|
26
26
|
abstract execute(context: TradeContext, retryCount?: number): Promise<string>;
|
|
27
|
-
protected buildTipTransferTx(to: string, transfer_amount_gwei: string, gas_price_gwei: string, transfer_nonce: number): Promise<string>;
|
|
27
|
+
protected buildTipTransferTx(to: string, transfer_amount_gwei: string, gas_price_gwei: string, transfer_nonce: number, wallet?: ethers.Wallet): Promise<string>;
|
|
28
28
|
}
|
|
@@ -136,12 +136,13 @@ class AbstractEvmDexTrade extends dist_1.AbastrcatTrade {
|
|
|
136
136
|
getWrappedNativeAddress() {
|
|
137
137
|
return this.chainConfig.wrappedNativeCurrencyAddress;
|
|
138
138
|
}
|
|
139
|
-
buildTipTransferTx(to, transfer_amount_gwei, gas_price_gwei, transfer_nonce) {
|
|
139
|
+
buildTipTransferTx(to, transfer_amount_gwei, gas_price_gwei, transfer_nonce, wallet) {
|
|
140
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
const targetWallet = wallet || this.wallet;
|
|
141
142
|
let real_transfer_amount_gwei = Math.min(Number(transfer_amount_gwei), this.chainConfig.gasOptions.maxTipAmountGwei).toString();
|
|
142
143
|
let real_gas_price_gwei = Math.min(Number(gas_price_gwei), this.chainConfig.gasOptions.maxGasPriceGwei).toString();
|
|
143
144
|
let tx_data = {
|
|
144
|
-
from:
|
|
145
|
+
from: targetWallet.address,
|
|
145
146
|
to,
|
|
146
147
|
value: ethers_1.ethers.utils.parseUnits(real_transfer_amount_gwei, 'gwei'),
|
|
147
148
|
gasLimit: 21000,
|
|
@@ -149,7 +150,7 @@ class AbstractEvmDexTrade extends dist_1.AbastrcatTrade {
|
|
|
149
150
|
nonce: transfer_nonce,
|
|
150
151
|
chainId: this.chainConfig.chainId
|
|
151
152
|
};
|
|
152
|
-
let signedTx = yield
|
|
153
|
+
let signedTx = yield targetWallet.signTransaction(tx_data);
|
|
153
154
|
(0, dist_1.log_info)(`构建转账交易: `, Object.assign(Object.assign({}, tx_data), { real_transfer_amount_gwei,
|
|
154
155
|
real_gas_price_gwei, txhash: ethers_1.ethers.utils.keccak256(signedTx) }));
|
|
155
156
|
return signedTx;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clonegod/ttd-bsc-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "BSC common library",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"push": "npm run build && npm publish"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@clonegod/ttd-core": "2.0.
|
|
17
|
+
"@clonegod/ttd-core": "2.0.36",
|
|
18
18
|
"axios": "^1.8.4",
|
|
19
19
|
"dotenv": "^16.4.7",
|
|
20
20
|
"ethers": "^5.8.0"
|