@vleap/warps-adapter-evm 0.2.0-alpha.34 → 0.2.0-alpha.35
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/index.d.cts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +109 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable,
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecution, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
|
|
4
4
|
declare const NativeTokenArb: WarpChainAsset;
|
|
@@ -172,9 +172,8 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
|
|
|
172
172
|
createContractCallTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
173
173
|
private createTokenTransferTransaction;
|
|
174
174
|
private createSingleTokenTransfer;
|
|
175
|
-
executeQuery(executable: WarpExecutable): Promise<
|
|
175
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecution>;
|
|
176
176
|
private estimateGasAndSetDefaults;
|
|
177
|
-
signMessage(message: string, privateKey: string): Promise<string>;
|
|
178
177
|
verifyMessage(message: string, signature: string): Promise<string>;
|
|
179
178
|
}
|
|
180
179
|
|
|
@@ -205,11 +204,14 @@ declare class WarpEvmResults implements AdapterWarpResults {
|
|
|
205
204
|
private readonly serializer;
|
|
206
205
|
private readonly provider;
|
|
207
206
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecution>;
|
|
208
|
+
private createFailedExecution;
|
|
209
|
+
private handleWarpChainAction;
|
|
210
|
+
private handleTransactionReceipt;
|
|
211
|
+
extractQueryResults(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
210
212
|
values: {
|
|
211
213
|
string: string[];
|
|
212
|
-
native:
|
|
214
|
+
native: WarpNativeValue[];
|
|
213
215
|
};
|
|
214
216
|
results: WarpExecutionResults;
|
|
215
217
|
}>;
|
|
@@ -238,8 +240,10 @@ declare class WarpEvmWallet implements AdapterWarpWallet {
|
|
|
238
240
|
private provider;
|
|
239
241
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
240
242
|
signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
|
|
243
|
+
signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
|
|
241
244
|
signMessage(message: string): Promise<string>;
|
|
242
245
|
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
246
|
+
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
243
247
|
create(mnemonic: string): {
|
|
244
248
|
address: string;
|
|
245
249
|
privateKey: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable,
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecution, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
|
|
4
4
|
declare const NativeTokenArb: WarpChainAsset;
|
|
@@ -172,9 +172,8 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
|
|
|
172
172
|
createContractCallTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
173
173
|
private createTokenTransferTransaction;
|
|
174
174
|
private createSingleTokenTransfer;
|
|
175
|
-
executeQuery(executable: WarpExecutable): Promise<
|
|
175
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecution>;
|
|
176
176
|
private estimateGasAndSetDefaults;
|
|
177
|
-
signMessage(message: string, privateKey: string): Promise<string>;
|
|
178
177
|
verifyMessage(message: string, signature: string): Promise<string>;
|
|
179
178
|
}
|
|
180
179
|
|
|
@@ -205,11 +204,14 @@ declare class WarpEvmResults implements AdapterWarpResults {
|
|
|
205
204
|
private readonly serializer;
|
|
206
205
|
private readonly provider;
|
|
207
206
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecution>;
|
|
208
|
+
private createFailedExecution;
|
|
209
|
+
private handleWarpChainAction;
|
|
210
|
+
private handleTransactionReceipt;
|
|
211
|
+
extractQueryResults(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
210
212
|
values: {
|
|
211
213
|
string: string[];
|
|
212
|
-
native:
|
|
214
|
+
native: WarpNativeValue[];
|
|
213
215
|
};
|
|
214
216
|
results: WarpExecutionResults;
|
|
215
217
|
}>;
|
|
@@ -238,8 +240,10 @@ declare class WarpEvmWallet implements AdapterWarpWallet {
|
|
|
238
240
|
private provider;
|
|
239
241
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
240
242
|
signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
|
|
243
|
+
signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
|
|
241
244
|
signMessage(message: string): Promise<string>;
|
|
242
245
|
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
246
|
+
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
243
247
|
create(mnemonic: string): {
|
|
244
248
|
address: string;
|
|
245
249
|
privateKey: string;
|
package/dist/index.js
CHANGED
|
@@ -426,7 +426,10 @@ var WarpEvmDataLoader = class {
|
|
|
426
426
|
try {
|
|
427
427
|
const tx = await this.provider.getTransaction(identifier);
|
|
428
428
|
if (!tx) return null;
|
|
429
|
-
|
|
429
|
+
let receipt = await this.provider.getTransactionReceipt(identifier);
|
|
430
|
+
if (awaitCompleted && !receipt) {
|
|
431
|
+
receipt = await tx.wait();
|
|
432
|
+
}
|
|
430
433
|
const block = await this.provider.getBlock(tx.blockNumber || "latest");
|
|
431
434
|
return {
|
|
432
435
|
chain: this.chain.name,
|
|
@@ -742,21 +745,51 @@ var WarpEvmResults = class {
|
|
|
742
745
|
const network = new import_ethers3.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
|
|
743
746
|
this.provider = new import_ethers3.ethers.JsonRpcProvider(apiUrl, network);
|
|
744
747
|
}
|
|
745
|
-
async
|
|
748
|
+
async getActionExecution(warp, actionIndex, tx) {
|
|
746
749
|
if (!tx) {
|
|
747
|
-
return
|
|
748
|
-
success: false,
|
|
749
|
-
warp,
|
|
750
|
-
action: 0,
|
|
751
|
-
user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
752
|
-
txHash: "",
|
|
753
|
-
tx: null,
|
|
754
|
-
next: null,
|
|
755
|
-
values: { string: [], native: [] },
|
|
756
|
-
results: {},
|
|
757
|
-
messages: {}
|
|
758
|
-
};
|
|
750
|
+
return this.createFailedExecution(warp, actionIndex);
|
|
759
751
|
}
|
|
752
|
+
if ("status" in tx && typeof tx.status === "string") {
|
|
753
|
+
return this.handleWarpChainAction(warp, actionIndex, tx);
|
|
754
|
+
}
|
|
755
|
+
return this.handleTransactionReceipt(warp, actionIndex, tx);
|
|
756
|
+
}
|
|
757
|
+
createFailedExecution(warp, actionIndex) {
|
|
758
|
+
return {
|
|
759
|
+
success: false,
|
|
760
|
+
warp,
|
|
761
|
+
action: actionIndex,
|
|
762
|
+
user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
763
|
+
txHash: "",
|
|
764
|
+
tx: null,
|
|
765
|
+
next: null,
|
|
766
|
+
values: { string: [], native: [] },
|
|
767
|
+
results: {},
|
|
768
|
+
messages: {}
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
handleWarpChainAction(warp, actionIndex, tx) {
|
|
772
|
+
const success = tx.status === "success";
|
|
773
|
+
const transactionHash = tx.id || tx.tx?.hash || "";
|
|
774
|
+
const gasUsed = tx.tx?.gasLimit || "0";
|
|
775
|
+
const gasPrice = tx.tx?.gasPrice || "0";
|
|
776
|
+
const blockNumber = tx.tx?.blockNumber || "0";
|
|
777
|
+
const rawValues = [transactionHash, blockNumber, gasUsed, gasPrice];
|
|
778
|
+
const stringValues = rawValues.map(String);
|
|
779
|
+
return {
|
|
780
|
+
success,
|
|
781
|
+
warp,
|
|
782
|
+
action: actionIndex,
|
|
783
|
+
user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
784
|
+
txHash: transactionHash,
|
|
785
|
+
tx,
|
|
786
|
+
next: null,
|
|
787
|
+
values: { string: stringValues, native: rawValues },
|
|
788
|
+
results: {},
|
|
789
|
+
messages: {}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
handleTransactionReceipt(warp, actionIndex, tx) {
|
|
760
793
|
const success = tx.status === 1;
|
|
761
794
|
const gasUsed = tx.gasUsed?.toString() || "0";
|
|
762
795
|
const gasPrice = tx.gasPrice?.toString() || "0";
|
|
@@ -771,11 +804,11 @@ var WarpEvmResults = class {
|
|
|
771
804
|
index: log.index?.toString() || "0"
|
|
772
805
|
}));
|
|
773
806
|
const rawValues = [transactionHash, blockNumber, gasUsed, gasPrice, ...logs.length > 0 ? logs : []];
|
|
774
|
-
const stringValues = rawValues.map(
|
|
807
|
+
const stringValues = rawValues.map(String);
|
|
775
808
|
return {
|
|
776
809
|
success,
|
|
777
810
|
warp,
|
|
778
|
-
action:
|
|
811
|
+
action: actionIndex,
|
|
779
812
|
user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
780
813
|
txHash: transactionHash,
|
|
781
814
|
tx,
|
|
@@ -886,15 +919,17 @@ var WarpEvmExecutor = class {
|
|
|
886
919
|
const userWallet = (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
|
|
887
920
|
if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
|
|
888
921
|
const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
|
|
889
|
-
if (!action || !("func" in action) || !action.func)
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
if (!import_ethers4.ethers.isAddress(executable.destination)) {
|
|
893
|
-
throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
|
|
894
|
-
}
|
|
922
|
+
if (!action || !("func" in action) || !action.func) throw new Error("WarpEvmExecutor: Contract action must have a function name");
|
|
923
|
+
if (!import_ethers4.ethers.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
|
|
895
924
|
try {
|
|
896
|
-
|
|
897
|
-
|
|
925
|
+
let iface;
|
|
926
|
+
try {
|
|
927
|
+
iface = new import_ethers4.ethers.Interface(JSON.parse(action.abi));
|
|
928
|
+
} catch {
|
|
929
|
+
iface = new import_ethers4.ethers.Interface([action.abi]);
|
|
930
|
+
}
|
|
931
|
+
const nativeArgs = executable.args.map((arg) => this.serializer.coreSerializer.stringToNative(arg)[1]);
|
|
932
|
+
const encodedData = iface.encodeFunctionData(action.func, nativeArgs);
|
|
898
933
|
const tx = {
|
|
899
934
|
to: executable.destination,
|
|
900
935
|
value: executable.value,
|
|
@@ -906,19 +941,13 @@ var WarpEvmExecutor = class {
|
|
|
906
941
|
}
|
|
907
942
|
}
|
|
908
943
|
async createTokenTransferTransaction(executable, userWallet) {
|
|
909
|
-
if (executable.transfers.length === 0)
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
if (!this.chain.nativeToken?.identifier) {
|
|
913
|
-
throw new Error("WarpEvmExecutor: No native token defined for this chain");
|
|
914
|
-
}
|
|
944
|
+
if (executable.transfers.length === 0) throw new Error("WarpEvmExecutor: No transfers provided");
|
|
945
|
+
if (!this.chain.nativeToken?.identifier) throw new Error("WarpEvmExecutor: No native token defined for this chain");
|
|
915
946
|
const nativeTokenTransfers = executable.transfers.filter((transfer) => transfer.identifier === this.chain.nativeToken.identifier);
|
|
916
947
|
const erc20Transfers = executable.transfers.filter((transfer) => transfer.identifier !== this.chain.nativeToken.identifier);
|
|
917
948
|
if (nativeTokenTransfers.length === 1 && erc20Transfers.length === 0) {
|
|
918
949
|
const transfer = nativeTokenTransfers[0];
|
|
919
|
-
if (transfer.amount <= 0n)
|
|
920
|
-
throw new Error("WarpEvmExecutor: Native token transfer amount must be positive");
|
|
921
|
-
}
|
|
950
|
+
if (transfer.amount <= 0n) throw new Error("WarpEvmExecutor: Native token transfer amount must be positive");
|
|
922
951
|
const tx = {
|
|
923
952
|
to: executable.destination,
|
|
924
953
|
value: transfer.amount,
|
|
@@ -929,9 +958,7 @@ var WarpEvmExecutor = class {
|
|
|
929
958
|
if (nativeTokenTransfers.length === 0 && erc20Transfers.length === 1) {
|
|
930
959
|
return this.createSingleTokenTransfer(executable, erc20Transfers[0], userWallet);
|
|
931
960
|
}
|
|
932
|
-
if (executable.transfers.length > 1)
|
|
933
|
-
throw new Error("WarpEvmExecutor: Multiple token transfers not yet supported");
|
|
934
|
-
}
|
|
961
|
+
if (executable.transfers.length > 1) throw new Error("WarpEvmExecutor: Multiple token transfers not yet supported");
|
|
935
962
|
throw new Error("WarpEvmExecutor: Invalid transfer configuration");
|
|
936
963
|
}
|
|
937
964
|
async createSingleTokenTransfer(executable, transfer, userWallet) {
|
|
@@ -942,27 +969,25 @@ var WarpEvmExecutor = class {
|
|
|
942
969
|
const encodedData = transferInterface.encodeFunctionData("transfer", [executable.destination, transfer.amount]);
|
|
943
970
|
const tx = {
|
|
944
971
|
to: transfer.identifier,
|
|
945
|
-
// Token contract address
|
|
946
972
|
value: 0n,
|
|
947
|
-
// No native token value for ERC-20 transfers
|
|
948
973
|
data: encodedData
|
|
949
974
|
};
|
|
950
975
|
return this.estimateGasAndSetDefaults(tx, userWallet);
|
|
951
976
|
}
|
|
952
977
|
async executeQuery(executable) {
|
|
953
978
|
const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
|
|
954
|
-
if (action.type !== "query") {
|
|
955
|
-
|
|
956
|
-
}
|
|
957
|
-
if (!action.func) {
|
|
958
|
-
throw new Error("WarpEvmExecutor: Query action must have a function name");
|
|
959
|
-
}
|
|
960
|
-
if (!import_ethers4.ethers.isAddress(executable.destination)) {
|
|
961
|
-
throw new Error(`WarpEvmExecutor: Invalid contract address for query: ${executable.destination}`);
|
|
962
|
-
}
|
|
979
|
+
if (action.type !== "query") throw new Error(`WarpEvmExecutor: Invalid action type for executeQuery: ${action.type}`);
|
|
980
|
+
if (!action.func) throw new Error("WarpEvmExecutor: Query action must have a function name");
|
|
981
|
+
if (!import_ethers4.ethers.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid address for query: ${executable.destination}`);
|
|
963
982
|
try {
|
|
964
|
-
|
|
965
|
-
|
|
983
|
+
let iface;
|
|
984
|
+
try {
|
|
985
|
+
iface = new import_ethers4.ethers.Interface(JSON.parse(action.abi));
|
|
986
|
+
} catch {
|
|
987
|
+
iface = new import_ethers4.ethers.Interface([action.abi]);
|
|
988
|
+
}
|
|
989
|
+
const nativeArgs = executable.args.map((arg) => this.serializer.coreSerializer.stringToNative(arg)[1]);
|
|
990
|
+
const encodedData = iface.encodeFunctionData(action.func, nativeArgs);
|
|
966
991
|
const result = await this.provider.call({
|
|
967
992
|
to: executable.destination,
|
|
968
993
|
data: encodedData
|
|
@@ -1009,12 +1034,8 @@ var WarpEvmExecutor = class {
|
|
|
1009
1034
|
...tx,
|
|
1010
1035
|
from
|
|
1011
1036
|
});
|
|
1012
|
-
if (gasEstimate < BigInt(WarpEvmConstants.Validation.MinGasLimit)) {
|
|
1013
|
-
|
|
1014
|
-
}
|
|
1015
|
-
if (gasEstimate > BigInt(WarpEvmConstants.Validation.MaxGasLimit)) {
|
|
1016
|
-
throw new Error(`Gas estimate too high: ${gasEstimate}`);
|
|
1017
|
-
}
|
|
1037
|
+
if (gasEstimate < BigInt(WarpEvmConstants.Validation.MinGasLimit)) throw new Error(`Gas estimate too low: ${gasEstimate}`);
|
|
1038
|
+
if (gasEstimate > BigInt(WarpEvmConstants.Validation.MaxGasLimit)) throw new Error(`Gas estimate too high: ${gasEstimate}`);
|
|
1018
1039
|
const feeData = await this.provider.getFeeData();
|
|
1019
1040
|
if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) {
|
|
1020
1041
|
return {
|
|
@@ -1058,15 +1079,6 @@ var WarpEvmExecutor = class {
|
|
|
1058
1079
|
};
|
|
1059
1080
|
}
|
|
1060
1081
|
}
|
|
1061
|
-
async signMessage(message, privateKey) {
|
|
1062
|
-
try {
|
|
1063
|
-
const wallet = new import_ethers4.ethers.Wallet(privateKey);
|
|
1064
|
-
const signature = await wallet.signMessage(message);
|
|
1065
|
-
return signature;
|
|
1066
|
-
} catch (error) {
|
|
1067
|
-
throw new Error(`Failed to sign message: ${error}`);
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
1082
|
async verifyMessage(message, signature) {
|
|
1071
1083
|
try {
|
|
1072
1084
|
const recoveredAddress = import_ethers4.ethers.verifyMessage(message, signature);
|
|
@@ -1222,6 +1234,36 @@ var WarpEvmWallet = class {
|
|
|
1222
1234
|
const signedTx = await wallet.signTransaction(txRequest);
|
|
1223
1235
|
return { ...tx, signature: signedTx };
|
|
1224
1236
|
}
|
|
1237
|
+
async signTransactions(txs) {
|
|
1238
|
+
if (txs.length === 0) return [];
|
|
1239
|
+
if (txs.length > 1) {
|
|
1240
|
+
const wallet = this.getWallet();
|
|
1241
|
+
const address = wallet.address;
|
|
1242
|
+
const currentNonce = await this.provider.getTransactionCount(address, "pending");
|
|
1243
|
+
const signedTxs = [];
|
|
1244
|
+
for (let i = 0; i < txs.length; i++) {
|
|
1245
|
+
const tx = { ...txs[i] };
|
|
1246
|
+
tx.nonce = currentNonce + i;
|
|
1247
|
+
if (i > 0) {
|
|
1248
|
+
const priorityReduction = BigInt(i * 1e9);
|
|
1249
|
+
const minGasPrice = BigInt(1e9);
|
|
1250
|
+
if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) {
|
|
1251
|
+
tx.maxFeePerGas = tx.maxFeePerGas > priorityReduction ? tx.maxFeePerGas - priorityReduction : minGasPrice;
|
|
1252
|
+
tx.maxPriorityFeePerGas = tx.maxPriorityFeePerGas > priorityReduction ? tx.maxPriorityFeePerGas - priorityReduction : minGasPrice;
|
|
1253
|
+
delete tx.gasPrice;
|
|
1254
|
+
} else if (tx.gasPrice) {
|
|
1255
|
+
tx.gasPrice = tx.gasPrice > priorityReduction ? tx.gasPrice - priorityReduction : minGasPrice;
|
|
1256
|
+
delete tx.maxFeePerGas;
|
|
1257
|
+
delete tx.maxPriorityFeePerGas;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
const signedTx = await this.signTransaction(tx);
|
|
1261
|
+
signedTxs.push(signedTx);
|
|
1262
|
+
}
|
|
1263
|
+
return signedTxs;
|
|
1264
|
+
}
|
|
1265
|
+
return Promise.all(txs.map(async (tx) => this.signTransaction(tx)));
|
|
1266
|
+
}
|
|
1225
1267
|
async signMessage(message) {
|
|
1226
1268
|
const wallet = this.getWallet();
|
|
1227
1269
|
const signature = await wallet.signMessage(message);
|
|
@@ -1236,6 +1278,9 @@ var WarpEvmWallet = class {
|
|
|
1236
1278
|
const txResponse = await connectedWallet.sendTransaction(tx);
|
|
1237
1279
|
return txResponse.hash;
|
|
1238
1280
|
}
|
|
1281
|
+
async sendTransactions(txs) {
|
|
1282
|
+
return Promise.all(txs.map(async (tx) => this.sendTransaction(tx)));
|
|
1283
|
+
}
|
|
1239
1284
|
create(mnemonic) {
|
|
1240
1285
|
const wallet = import_ethers5.ethers.Wallet.fromPhrase(mnemonic);
|
|
1241
1286
|
return { address: wallet.address, privateKey: wallet.privateKey, mnemonic };
|