starknet 7.3.0 → 7.5.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/CHANGELOG.md +24 -0
- package/dist/index.d.ts +210 -30
- package/dist/index.global.js +171 -59
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +161 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +161 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -63,10 +63,10 @@ var jsonrpc_exports = {};
|
|
|
63
63
|
|
|
64
64
|
// src/types/api/index.ts
|
|
65
65
|
__reExport(api_exports, starknet_types_08_star);
|
|
66
|
-
import * as RPCSPEC07 from "starknet-types-07";
|
|
67
|
-
import * as RPCSPEC08 from "starknet-types-08";
|
|
68
|
-
import { PAYMASTER_API } from "starknet-types-08";
|
|
69
|
-
import * as starknet_types_08_star from "starknet-types-08";
|
|
66
|
+
import * as RPCSPEC07 from "@starknet-io/starknet-types-07";
|
|
67
|
+
import * as RPCSPEC08 from "@starknet-io/starknet-types-08";
|
|
68
|
+
import { PAYMASTER_API } from "@starknet-io/starknet-types-08";
|
|
69
|
+
import * as starknet_types_08_star from "@starknet-io/starknet-types-08";
|
|
70
70
|
|
|
71
71
|
// src/utils/encode.ts
|
|
72
72
|
var encode_exports = {};
|
|
@@ -228,14 +228,8 @@ var DEFAULT_GLOBAL_CONFIG = {
|
|
|
228
228
|
websocket: void 0
|
|
229
229
|
};
|
|
230
230
|
var RPC_DEFAULT_NODES = {
|
|
231
|
-
SN_MAIN: [
|
|
232
|
-
|
|
233
|
-
`https://free-rpc.nethermind.io/mainnet-juno/`
|
|
234
|
-
],
|
|
235
|
-
SN_SEPOLIA: [
|
|
236
|
-
`https://starknet-sepolia.public.blastapi.io/rpc/`,
|
|
237
|
-
`https://free-rpc.nethermind.io/sepolia-juno/`
|
|
238
|
-
]
|
|
231
|
+
SN_MAIN: [`https://starknet-mainnet.public.blastapi.io/rpc/`],
|
|
232
|
+
SN_SEPOLIA: [`https://starknet-sepolia.public.blastapi.io/rpc/`]
|
|
239
233
|
};
|
|
240
234
|
var PAYMASTER_RPC_NODES = {
|
|
241
235
|
SN_MAIN: [`https://starknet.paymaster.avnu.fi`],
|
|
@@ -246,7 +240,8 @@ var SYSTEM_MESSAGES = {
|
|
|
246
240
|
legacyTxRPC08Message: "RPC 0.8 do not support legacy transactions",
|
|
247
241
|
SWOldV3: "RPC 0.7 V3 tx (improper resource bounds) not supported in RPC 0.8",
|
|
248
242
|
channelVersionMismatch: "Channel specification version is not compatible with the connected node Specification Version",
|
|
249
|
-
unsupportedSpecVersion: "The connected node specification version is not supported by this library"
|
|
243
|
+
unsupportedSpecVersion: "The connected node specification version is not supported by this library",
|
|
244
|
+
maxFeeInV3: "maxFee is not supported in V3 transactions, use resourceBounds instead"
|
|
250
245
|
};
|
|
251
246
|
|
|
252
247
|
// src/global/config.ts
|
|
@@ -498,7 +493,7 @@ var BlockTag = {
|
|
|
498
493
|
};
|
|
499
494
|
|
|
500
495
|
// src/provider/types/spec.type.ts
|
|
501
|
-
import * as RPCSPEC082 from "starknet-types-08";
|
|
496
|
+
import * as RPCSPEC082 from "@starknet-io/starknet-types-08";
|
|
502
497
|
var { ETransactionVersion: ETransactionVersion2 } = RPCSPEC082;
|
|
503
498
|
var { ETransactionVersion2: ETransactionVersion22 } = RPCSPEC082;
|
|
504
499
|
var { ETransactionVersion3 } = RPCSPEC082;
|
|
@@ -592,7 +587,7 @@ var OutsideExecutionVersion = {
|
|
|
592
587
|
// src/types/typedData.ts
|
|
593
588
|
import {
|
|
594
589
|
TypedDataRevision
|
|
595
|
-
} from "starknet-types-07";
|
|
590
|
+
} from "@starknet-io/starknet-types-07";
|
|
596
591
|
|
|
597
592
|
// src/utils/json.ts
|
|
598
593
|
var json_exports = {};
|
|
@@ -698,6 +693,15 @@ function assert(condition, message) {
|
|
|
698
693
|
throw new Error(message || "Assertion failure");
|
|
699
694
|
}
|
|
700
695
|
}
|
|
696
|
+
function assertX(condition, method) {
|
|
697
|
+
if (!condition) {
|
|
698
|
+
if (method.length === 0) {
|
|
699
|
+
method();
|
|
700
|
+
} else {
|
|
701
|
+
throw new Error("AssertionX failure: message function should not require arguments");
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
701
705
|
|
|
702
706
|
// src/utils/num.ts
|
|
703
707
|
var num_exports = {};
|
|
@@ -842,6 +846,7 @@ function isBigNumberish(input) {
|
|
|
842
846
|
// src/utils/hash/selector.ts
|
|
843
847
|
var selector_exports = {};
|
|
844
848
|
__export(selector_exports, {
|
|
849
|
+
getL1MessageHash: () => getL1MessageHash,
|
|
845
850
|
getL2MessageHash: () => getL2MessageHash,
|
|
846
851
|
getSelector: () => getSelector,
|
|
847
852
|
getSelectorFromName: () => getSelectorFromName,
|
|
@@ -892,6 +897,9 @@ function getL2MessageHash(l1FromAddress, l2ToAddress, l2Selector, l2Calldata, l1
|
|
|
892
897
|
...l2Calldata
|
|
893
898
|
]);
|
|
894
899
|
}
|
|
900
|
+
function getL1MessageHash(fromL2Address, toL1Address, payload) {
|
|
901
|
+
return solidityUint256PackedKeccak256([fromL2Address, toL1Address, payload.length, ...payload]);
|
|
902
|
+
}
|
|
895
903
|
|
|
896
904
|
// src/utils/shortString.ts
|
|
897
905
|
var shortString_exports = {};
|
|
@@ -3045,6 +3053,7 @@ __export(hash_exports, {
|
|
|
3045
3053
|
computePoseidonHashOnElements: () => computePoseidonHashOnElements,
|
|
3046
3054
|
computeSierraContractClassHash: () => computeSierraContractClassHash,
|
|
3047
3055
|
formatSpaces: () => formatSpaces,
|
|
3056
|
+
getL1MessageHash: () => getL1MessageHash,
|
|
3048
3057
|
getL2MessageHash: () => getL2MessageHash,
|
|
3049
3058
|
getSelector: () => getSelector,
|
|
3050
3059
|
getSelectorFromName: () => getSelectorFromName,
|
|
@@ -4497,6 +4506,11 @@ var RpcChannel = class {
|
|
|
4497
4506
|
fee_data_availability_mode: details.feeDataAvailabilityMode
|
|
4498
4507
|
}
|
|
4499
4508
|
});
|
|
4509
|
+
assertX(!details.maxFee, () => {
|
|
4510
|
+
logger.warn(SYSTEM_MESSAGES.maxFeeInV3, {
|
|
4511
|
+
type: RPCSPEC07.ETransactionType.INVOKE
|
|
4512
|
+
});
|
|
4513
|
+
});
|
|
4500
4514
|
}
|
|
4501
4515
|
return this.waitMode ? this.waitForTransaction((await promise).transaction_hash) : promise;
|
|
4502
4516
|
}
|
|
@@ -4567,6 +4581,11 @@ var RpcChannel = class {
|
|
|
4567
4581
|
fee_data_availability_mode: details.feeDataAvailabilityMode
|
|
4568
4582
|
}
|
|
4569
4583
|
});
|
|
4584
|
+
assertX(!details.maxFee, () => {
|
|
4585
|
+
logger.warn(SYSTEM_MESSAGES.maxFeeInV3, {
|
|
4586
|
+
type: RPCSPEC07.ETransactionType.DECLARE
|
|
4587
|
+
});
|
|
4588
|
+
});
|
|
4570
4589
|
} else {
|
|
4571
4590
|
throw Error("declare unspotted parameters");
|
|
4572
4591
|
}
|
|
@@ -4608,6 +4627,11 @@ var RpcChannel = class {
|
|
|
4608
4627
|
fee_data_availability_mode: details.feeDataAvailabilityMode
|
|
4609
4628
|
}
|
|
4610
4629
|
});
|
|
4630
|
+
assertX(!details.maxFee, () => {
|
|
4631
|
+
logger.warn(SYSTEM_MESSAGES.maxFeeInV3, {
|
|
4632
|
+
type: RPCSPEC07.ETransactionType.DEPLOY_ACCOUNT
|
|
4633
|
+
});
|
|
4634
|
+
});
|
|
4611
4635
|
}
|
|
4612
4636
|
return this.waitMode ? this.waitForTransaction((await promise).transaction_hash) : promise;
|
|
4613
4637
|
}
|
|
@@ -4678,6 +4702,12 @@ var RpcChannel = class {
|
|
|
4678
4702
|
fee_data_availability_mode: invocation.feeDataAvailabilityMode,
|
|
4679
4703
|
account_deployment_data: invocation.accountDeploymentData.map((it) => toHex(it))
|
|
4680
4704
|
};
|
|
4705
|
+
assertX(!invocation.maxFee, () => {
|
|
4706
|
+
logger.warn(SYSTEM_MESSAGES.maxFeeInV3, {
|
|
4707
|
+
type: invocation.type,
|
|
4708
|
+
versionType
|
|
4709
|
+
});
|
|
4710
|
+
});
|
|
4681
4711
|
}
|
|
4682
4712
|
if (invocation.type === TransactionType.INVOKE) {
|
|
4683
4713
|
return {
|
|
@@ -8741,19 +8771,20 @@ function mergeAbiEvents(target, source) {
|
|
|
8741
8771
|
}
|
|
8742
8772
|
function parseEvents(providerReceivedEvents, abiEvents, abiStructs, abiEnums) {
|
|
8743
8773
|
const ret = providerReceivedEvents.flat().reduce((acc, recEvent) => {
|
|
8744
|
-
|
|
8774
|
+
const currentEvent = JSON.parse(JSON.stringify(recEvent));
|
|
8775
|
+
let abiEvent = abiEvents[currentEvent.keys.shift() ?? 0];
|
|
8745
8776
|
if (!abiEvent) {
|
|
8746
8777
|
return acc;
|
|
8747
8778
|
}
|
|
8748
8779
|
while (!abiEvent.name) {
|
|
8749
|
-
const hashName =
|
|
8780
|
+
const hashName = currentEvent.keys.shift();
|
|
8750
8781
|
assert(!!hashName, 'Not enough data in "keys" property of this event.');
|
|
8751
8782
|
abiEvent = abiEvent[hashName];
|
|
8752
8783
|
}
|
|
8753
8784
|
const parsedEvent = {};
|
|
8754
8785
|
parsedEvent[abiEvent.name] = {};
|
|
8755
|
-
const keysIter =
|
|
8756
|
-
const dataIter =
|
|
8786
|
+
const keysIter = currentEvent.keys[Symbol.iterator]();
|
|
8787
|
+
const dataIter = currentEvent.data[Symbol.iterator]();
|
|
8757
8788
|
const abiEventKeys = abiEvent.members?.filter((it) => it.kind === "key") || abiEvent.keys;
|
|
8758
8789
|
const abiEventData = abiEvent.members?.filter((it) => it.kind === "data") || abiEvent.data;
|
|
8759
8790
|
abiEventKeys.forEach((key) => {
|
|
@@ -8774,9 +8805,10 @@ function parseEvents(providerReceivedEvents, abiEvents, abiStructs, abiEnums) {
|
|
|
8774
8805
|
parsedEvent[abiEvent.name]
|
|
8775
8806
|
);
|
|
8776
8807
|
});
|
|
8777
|
-
if ("block_hash" in
|
|
8778
|
-
if ("block_number" in
|
|
8779
|
-
if ("transaction_hash" in
|
|
8808
|
+
if ("block_hash" in currentEvent) parsedEvent.block_hash = currentEvent.block_hash;
|
|
8809
|
+
if ("block_number" in currentEvent) parsedEvent.block_number = currentEvent.block_number;
|
|
8810
|
+
if ("transaction_hash" in currentEvent)
|
|
8811
|
+
parsedEvent.transaction_hash = currentEvent.transaction_hash;
|
|
8780
8812
|
acc.push(parsedEvent);
|
|
8781
8813
|
return acc;
|
|
8782
8814
|
}, []);
|
|
@@ -8810,8 +8842,19 @@ __export(outsideExecution_exports, {
|
|
|
8810
8842
|
buildExecuteFromOutsideCall: () => buildExecuteFromOutsideCall,
|
|
8811
8843
|
buildExecuteFromOutsideCallData: () => buildExecuteFromOutsideCallData,
|
|
8812
8844
|
getOutsideCall: () => getOutsideCall,
|
|
8813
|
-
getTypedData: () => getTypedData
|
|
8845
|
+
getTypedData: () => getTypedData,
|
|
8846
|
+
toOutsideCallV2: () => toOutsideCallV2
|
|
8814
8847
|
});
|
|
8848
|
+
function toOutsideCallV2(call) {
|
|
8849
|
+
if ("calldata_len" in call) {
|
|
8850
|
+
return {
|
|
8851
|
+
To: call.to,
|
|
8852
|
+
Selector: call.selector,
|
|
8853
|
+
Calldata: call.calldata
|
|
8854
|
+
};
|
|
8855
|
+
}
|
|
8856
|
+
return call;
|
|
8857
|
+
}
|
|
8815
8858
|
function getOutsideCall(call) {
|
|
8816
8859
|
const callData = call.calldata ?? [];
|
|
8817
8860
|
const callDataCompiled = Array.isArray(callData) ? callData : CallData.compile(callData);
|
|
@@ -8921,6 +8964,8 @@ async function supportsInterface(provider, contractAddress, interfaceId) {
|
|
|
8921
8964
|
// src/utils/paymaster.ts
|
|
8922
8965
|
var paymaster_exports = {};
|
|
8923
8966
|
__export(paymaster_exports, {
|
|
8967
|
+
assertCallsAreStrictlyEqual: () => assertCallsAreStrictlyEqual,
|
|
8968
|
+
assertPaymasterTransactionSafety: () => assertPaymasterTransactionSafety,
|
|
8924
8969
|
getDefaultPaymasterNodeUrl: () => getDefaultPaymasterNodeUrl
|
|
8925
8970
|
});
|
|
8926
8971
|
var getDefaultPaymasterNodeUrl = (networkName, mute = false) => {
|
|
@@ -8931,6 +8976,79 @@ var getDefaultPaymasterNodeUrl = (networkName, mute = false) => {
|
|
|
8931
8976
|
const randIdx = Math.floor(Math.random() * nodes.length);
|
|
8932
8977
|
return nodes[randIdx];
|
|
8933
8978
|
};
|
|
8979
|
+
var assertGasFeeFromUnsafeCalls = (unsafeCalls, fees) => {
|
|
8980
|
+
const unsafeCall = toOutsideCallV2(unsafeCalls[unsafeCalls.length - 1]);
|
|
8981
|
+
const unsafeGasTokenCalldata = CallData.toCalldata(unsafeCall.Calldata);
|
|
8982
|
+
const unsafeGasTokenValue = unsafeGasTokenCalldata[1];
|
|
8983
|
+
assert(
|
|
8984
|
+
BigInt(unsafeGasTokenValue) === BigInt(fees),
|
|
8985
|
+
"Gas token value is not equal to the provided gas fees"
|
|
8986
|
+
);
|
|
8987
|
+
};
|
|
8988
|
+
var assertGasTokenFromUnsafeCalls = (unsafeCalls, gasToken) => {
|
|
8989
|
+
const unsafeCall = toOutsideCallV2(unsafeCalls[unsafeCalls.length - 1]);
|
|
8990
|
+
assert(
|
|
8991
|
+
BigInt(unsafeCall.To) === BigInt(gasToken),
|
|
8992
|
+
"Gas token address is not equal to the provided gas token"
|
|
8993
|
+
);
|
|
8994
|
+
};
|
|
8995
|
+
function assertCallsAreStrictlyEqual(originalCalls, unsafeCalls) {
|
|
8996
|
+
const baseError = "Provided calls are not strictly equal to the returned calls";
|
|
8997
|
+
assert(
|
|
8998
|
+
unsafeCalls.length - 1 === originalCalls.length,
|
|
8999
|
+
`${baseError}: Expected ${originalCalls.length + 1} calls, got ${unsafeCalls.length}`
|
|
9000
|
+
);
|
|
9001
|
+
for (let callIndex = 0; callIndex < originalCalls.length; callIndex += 1) {
|
|
9002
|
+
const originalCall = originalCalls[callIndex];
|
|
9003
|
+
const unsafeCall = toOutsideCallV2(unsafeCalls[callIndex]);
|
|
9004
|
+
const normalizeAddress = (address) => {
|
|
9005
|
+
return toBigInt(address).toString(16).toLowerCase();
|
|
9006
|
+
};
|
|
9007
|
+
const originalAddress = normalizeAddress(originalCall.contractAddress);
|
|
9008
|
+
const unsafeAddress = normalizeAddress(unsafeCall.To);
|
|
9009
|
+
assert(
|
|
9010
|
+
originalAddress === unsafeAddress,
|
|
9011
|
+
`${baseError}: Contract address mismatch at call ${callIndex}. Expected: ${originalCall.contractAddress}, Got: ${unsafeCall.To}`
|
|
9012
|
+
);
|
|
9013
|
+
assert(
|
|
9014
|
+
getSelectorFromName(originalCall.entrypoint) === unsafeCall.Selector,
|
|
9015
|
+
`${baseError}: Entrypoint mismatch at call ${callIndex}. Expected: ${originalCall.entrypoint}, Got: ${unsafeCall.Selector}`
|
|
9016
|
+
);
|
|
9017
|
+
const originalCalldata = CallData.toCalldata(originalCall.calldata);
|
|
9018
|
+
const unsafeCalldata = CallData.toCalldata(unsafeCall.Calldata);
|
|
9019
|
+
assert(
|
|
9020
|
+
originalCalldata.length === unsafeCalldata.length,
|
|
9021
|
+
`${baseError}: Calldata length mismatch at call ${callIndex}. Expected length: ${originalCalldata.length}, Got length: ${unsafeCalldata.length}`
|
|
9022
|
+
);
|
|
9023
|
+
for (let dataIndex = 0; dataIndex < originalCalldata.length; dataIndex += 1) {
|
|
9024
|
+
const originalValue = BigInt(originalCalldata[dataIndex]);
|
|
9025
|
+
const unsafeValue = BigInt(unsafeCalldata[dataIndex]);
|
|
9026
|
+
assert(
|
|
9027
|
+
originalValue === unsafeValue,
|
|
9028
|
+
`${baseError}: Calldata value mismatch at call ${callIndex}, parameter ${dataIndex}. Expected: ${originalCalldata[dataIndex]}, Got: ${unsafeCalldata[dataIndex]}`
|
|
9029
|
+
);
|
|
9030
|
+
}
|
|
9031
|
+
}
|
|
9032
|
+
}
|
|
9033
|
+
var assertPaymasterTransactionSafety = (preparedTransaction, calls, paymasterDetails, maxFeeInGasToken) => {
|
|
9034
|
+
if (paymasterDetails.feeMode.mode !== "sponsored") {
|
|
9035
|
+
if (preparedTransaction.type === "invoke" || preparedTransaction.type === "deploy_and_invoke") {
|
|
9036
|
+
const unsafeCalls = "calls" in preparedTransaction.typed_data.message ? preparedTransaction.typed_data.message.calls : preparedTransaction.typed_data.message.Calls;
|
|
9037
|
+
assertCallsAreStrictlyEqual(calls, unsafeCalls);
|
|
9038
|
+
assertGasTokenFromUnsafeCalls(unsafeCalls, paymasterDetails.feeMode.gasToken);
|
|
9039
|
+
if (maxFeeInGasToken) {
|
|
9040
|
+
assert(
|
|
9041
|
+
preparedTransaction.fee.suggested_max_fee_in_gas_token <= maxFeeInGasToken,
|
|
9042
|
+
"Gas token price is too high"
|
|
9043
|
+
);
|
|
9044
|
+
assertGasFeeFromUnsafeCalls(
|
|
9045
|
+
unsafeCalls,
|
|
9046
|
+
preparedTransaction.fee.suggested_max_fee_in_gas_token
|
|
9047
|
+
);
|
|
9048
|
+
}
|
|
9049
|
+
}
|
|
9050
|
+
}
|
|
9051
|
+
};
|
|
8934
9052
|
|
|
8935
9053
|
// src/paymaster/rpc.ts
|
|
8936
9054
|
var convertCalls = (calls) => calls.map((call) => ({
|
|
@@ -8950,13 +9068,14 @@ var convertFEE_MODE = (feeMode) => {
|
|
|
8950
9068
|
}
|
|
8951
9069
|
return { mode: "default", gasToken: feeMode.gas_token };
|
|
8952
9070
|
};
|
|
8953
|
-
var convertTimeBounds = (timeBounds) => timeBounds
|
|
8954
|
-
execute_after: timeBounds.executeAfter
|
|
8955
|
-
|
|
9071
|
+
var convertTimeBounds = (timeBounds) => timeBounds ? {
|
|
9072
|
+
execute_after: timeBounds.executeAfter || 1,
|
|
9073
|
+
// If executeAfter is not provided, set it to 1, meaning the transaction can be executed immediately
|
|
9074
|
+
execute_before: timeBounds.executeBefore
|
|
8956
9075
|
} : void 0;
|
|
8957
|
-
var convertTIME_BOUNDS = (timeBounds) => timeBounds
|
|
8958
|
-
executeAfter:
|
|
8959
|
-
executeBefore:
|
|
9076
|
+
var convertTIME_BOUNDS = (timeBounds) => timeBounds ? {
|
|
9077
|
+
executeAfter: timeBounds.execute_after,
|
|
9078
|
+
executeBefore: timeBounds.execute_before
|
|
8960
9079
|
} : void 0;
|
|
8961
9080
|
var convertEXECUTION_PARAMETERS = (parameters) => ({
|
|
8962
9081
|
version: parameters.version,
|
|
@@ -9369,13 +9488,6 @@ var Account = class extends RpcProvider2 {
|
|
|
9369
9488
|
}
|
|
9370
9489
|
async execute(transactions, transactionsDetail = {}) {
|
|
9371
9490
|
const calls = Array.isArray(transactions) ? transactions : [transactions];
|
|
9372
|
-
if (transactionsDetail.paymaster) {
|
|
9373
|
-
return this.executePaymasterTransaction(
|
|
9374
|
-
calls,
|
|
9375
|
-
transactionsDetail.paymaster,
|
|
9376
|
-
transactionsDetail.maxFee
|
|
9377
|
-
);
|
|
9378
|
-
}
|
|
9379
9491
|
const nonce = toBigInt(transactionsDetail.nonce ?? await this.getNonce());
|
|
9380
9492
|
const version = toTransactionVersion(
|
|
9381
9493
|
this.getPreferredVersion(ETransactionVersion2.V1, ETransactionVersion2.V3),
|
|
@@ -9452,11 +9564,7 @@ var Account = class extends RpcProvider2 {
|
|
|
9452
9564
|
const preparedTransaction = await this.buildPaymasterTransaction(calls, paymasterDetails);
|
|
9453
9565
|
return preparedTransaction.fee;
|
|
9454
9566
|
}
|
|
9455
|
-
async
|
|
9456
|
-
const preparedTransaction = await this.buildPaymasterTransaction(calls, paymasterDetails);
|
|
9457
|
-
if (maxFee && preparedTransaction.fee.gas_token_price_in_strk > maxFee) {
|
|
9458
|
-
throw Error("Gas token price is too high");
|
|
9459
|
-
}
|
|
9567
|
+
async preparePaymasterTransaction(preparedTransaction) {
|
|
9460
9568
|
let transaction;
|
|
9461
9569
|
switch (preparedTransaction.type) {
|
|
9462
9570
|
case "deploy_and_invoke": {
|
|
@@ -9494,6 +9602,17 @@ var Account = class extends RpcProvider2 {
|
|
|
9494
9602
|
default:
|
|
9495
9603
|
throw Error("Invalid transaction type");
|
|
9496
9604
|
}
|
|
9605
|
+
return transaction;
|
|
9606
|
+
}
|
|
9607
|
+
async executePaymasterTransaction(calls, paymasterDetails, maxFeeInGasToken) {
|
|
9608
|
+
const preparedTransaction = await this.buildPaymasterTransaction(calls, paymasterDetails);
|
|
9609
|
+
assertPaymasterTransactionSafety(
|
|
9610
|
+
preparedTransaction,
|
|
9611
|
+
calls,
|
|
9612
|
+
paymasterDetails,
|
|
9613
|
+
maxFeeInGasToken
|
|
9614
|
+
);
|
|
9615
|
+
const transaction = await this.preparePaymasterTransaction(preparedTransaction);
|
|
9497
9616
|
return this.paymaster.executeTransaction(transaction, preparedTransaction.parameters).then((response) => ({ transaction_hash: response.transaction_hash }));
|
|
9498
9617
|
}
|
|
9499
9618
|
/**
|
|
@@ -10084,14 +10203,7 @@ var WalletAccount = class _WalletAccount extends Account {
|
|
|
10084
10203
|
/**
|
|
10085
10204
|
* ACCOUNT METHODS
|
|
10086
10205
|
*/
|
|
10087
|
-
execute(calls
|
|
10088
|
-
const details = arg2 === void 0 || Array.isArray(arg2) ? transactionsDetail : arg2;
|
|
10089
|
-
if (details.paymaster) {
|
|
10090
|
-
return this.executePaymasterTransaction(
|
|
10091
|
-
Array.isArray(calls) ? calls : [calls],
|
|
10092
|
-
details.paymaster
|
|
10093
|
-
);
|
|
10094
|
-
}
|
|
10206
|
+
execute(calls) {
|
|
10095
10207
|
const txCalls = [].concat(calls).map((it) => {
|
|
10096
10208
|
const { contractAddress, entrypoint, calldata } = it;
|
|
10097
10209
|
return {
|