starknet 6.3.0 → 6.4.1
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 +17 -0
- package/dist/index.d.ts +18 -11
- package/dist/index.global.js +61 -56
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +61 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [6.4.1](https://github.com/starknet-io/starknet.js/compare/v6.4.0...v6.4.1) (2024-03-14)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- byteArray encoding for less than 31 chars ([#1011](https://github.com/starknet-io/starknet.js/issues/1011)) ([653acc4](https://github.com/starknet-io/starknet.js/commit/653acc44c841540214dd6f6b8956b354d7c27644))
|
|
6
|
+
|
|
7
|
+
# [6.4.0](https://github.com/starknet-io/starknet.js/compare/v6.3.0...v6.4.0) (2024-03-12)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- expand encoding type for preset types ([b992446](https://github.com/starknet-io/starknet.js/commit/b9924465a1f01ac4273638f3fa258b36192d2101))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- enable cairo 2.6.0 contract declaration ([0104c59](https://github.com/starknet-io/starknet.js/commit/0104c59739a9dbe70091e14372a73ca84550f639))
|
|
16
|
+
- skip signatures when skipValidate is true ([6f784ea](https://github.com/starknet-io/starknet.js/commit/6f784ea4e4edd298f1950dac956fd1c81b953497))
|
|
17
|
+
|
|
1
18
|
# [6.3.0](https://github.com/starknet-io/starknet.js/compare/v6.2.1...v6.3.0) (2024-03-11)
|
|
2
19
|
|
|
3
20
|
### Features
|
package/dist/index.d.ts
CHANGED
|
@@ -2703,6 +2703,7 @@ type CairoAssembly = {
|
|
|
2703
2703
|
bytecode: ByteCode;
|
|
2704
2704
|
hints: any[];
|
|
2705
2705
|
pythonic_hints?: PythonicHints;
|
|
2706
|
+
bytecode_segment_lengths?: number[];
|
|
2706
2707
|
entry_points_by_type: EntryPointsByType;
|
|
2707
2708
|
};
|
|
2708
2709
|
/** COMPILED CONTRACT */
|
|
@@ -3126,6 +3127,7 @@ type AccountInvocationsFactoryDetails = {
|
|
|
3126
3127
|
versions: Array<`${ETransactionVersion}`>;
|
|
3127
3128
|
nonce?: BigNumberish;
|
|
3128
3129
|
blockIdentifier?: BlockIdentifier;
|
|
3130
|
+
skipValidate?: boolean;
|
|
3129
3131
|
} & Partial<V3TransactionDetails>;
|
|
3130
3132
|
interface UniversalDetails {
|
|
3131
3133
|
nonce?: BigNumberish;
|
|
@@ -3245,6 +3247,7 @@ type ParsedEvents = Array<ParsedEvent>;
|
|
|
3245
3247
|
|
|
3246
3248
|
type InvocationsSignerDetails = (V2InvocationsSignerDetails | V3InvocationsSignerDetails) & {
|
|
3247
3249
|
version: `${ETransactionVersion}`;
|
|
3250
|
+
skipValidate?: boolean;
|
|
3248
3251
|
};
|
|
3249
3252
|
type V2InvocationsSignerDetails = {
|
|
3250
3253
|
walletAddress: string;
|
|
@@ -6530,6 +6533,14 @@ declare function formatSpaces(json: string): string;
|
|
|
6530
6533
|
* @returns format: hex-string
|
|
6531
6534
|
*/
|
|
6532
6535
|
declare function computeLegacyContractClassHash(contract: LegacyCompiledContract | string): string;
|
|
6536
|
+
/**
|
|
6537
|
+
* Compute hash of the bytecode for Sierra v1.5.0 onwards (Cairo 2.6.0)
|
|
6538
|
+
* Each segment is Poseidon hashed.
|
|
6539
|
+
* The global hash is : 1 + PoseidonHash(len0, h0, len1, h1, ...)
|
|
6540
|
+
* @param casm compiled Sierra CASM file content.
|
|
6541
|
+
* @returns the bytecode hash as bigint.
|
|
6542
|
+
*/
|
|
6543
|
+
declare function hashByteCodeSegments(casm: CompiledSierraCasm): bigint;
|
|
6533
6544
|
/**
|
|
6534
6545
|
* Compute compiled class hash for contract (Cairo 1)
|
|
6535
6546
|
* @returns format: hex-string
|
|
@@ -6562,11 +6573,12 @@ declare const index$1_computeSierraContractClassHash: typeof computeSierraContra
|
|
|
6562
6573
|
declare const index$1_formatSpaces: typeof formatSpaces;
|
|
6563
6574
|
declare const index$1_getSelector: typeof getSelector;
|
|
6564
6575
|
declare const index$1_getSelectorFromName: typeof getSelectorFromName;
|
|
6576
|
+
declare const index$1_hashByteCodeSegments: typeof hashByteCodeSegments;
|
|
6565
6577
|
declare const index$1_keccakBn: typeof keccakBn;
|
|
6566
6578
|
declare const index$1_poseidon: typeof poseidon;
|
|
6567
6579
|
declare const index$1_starknetKeccak: typeof starknetKeccak;
|
|
6568
6580
|
declare namespace index$1 {
|
|
6569
|
-
export { index$1_calculateContractAddressFromHash as calculateContractAddressFromHash, calculateDeclareTransactionHash$2 as calculateDeclareTransactionHash, calculateDeployAccountTransactionHash$2 as calculateDeployAccountTransactionHash, calculateInvokeTransactionHash$1 as calculateInvokeTransactionHash, index$1_computeCompiledClassHash as computeCompiledClassHash, index$1_computeContractClassHash as computeContractClassHash, computeHashOnElements$1 as computeHashOnElements, index$1_computeLegacyContractClassHash as computeLegacyContractClassHash, index$1_computePedersenHash as computePedersenHash, index$1_computePedersenHashOnElements as computePedersenHashOnElements, index$1_computePoseidonHash as computePoseidonHash, index$1_computePoseidonHashOnElements as computePoseidonHashOnElements, index$1_computeSierraContractClassHash as computeSierraContractClassHash, index$1_formatSpaces as formatSpaces, index$1_getSelector as getSelector, index$1_getSelectorFromName as getSelectorFromName, index$1_keccakBn as keccakBn, index$1_poseidon as poseidon, index$1_starknetKeccak as starknetKeccak };
|
|
6581
|
+
export { index$1_calculateContractAddressFromHash as calculateContractAddressFromHash, calculateDeclareTransactionHash$2 as calculateDeclareTransactionHash, calculateDeployAccountTransactionHash$2 as calculateDeployAccountTransactionHash, calculateInvokeTransactionHash$1 as calculateInvokeTransactionHash, index$1_computeCompiledClassHash as computeCompiledClassHash, index$1_computeContractClassHash as computeContractClassHash, computeHashOnElements$1 as computeHashOnElements, index$1_computeLegacyContractClassHash as computeLegacyContractClassHash, index$1_computePedersenHash as computePedersenHash, index$1_computePedersenHashOnElements as computePedersenHashOnElements, index$1_computePoseidonHash as computePoseidonHash, index$1_computePoseidonHashOnElements as computePoseidonHashOnElements, index$1_computeSierraContractClassHash as computeSierraContractClassHash, index$1_formatSpaces as formatSpaces, index$1_getSelector as getSelector, index$1_getSelectorFromName as getSelectorFromName, index$1_hashByteCodeSegments as hashByteCodeSegments, index$1_keccakBn as keccakBn, index$1_poseidon as poseidon, index$1_starknetKeccak as starknetKeccak };
|
|
6570
6582
|
}
|
|
6571
6583
|
|
|
6572
6584
|
/**
|
|
@@ -7095,11 +7107,6 @@ interface Context {
|
|
|
7095
7107
|
parent?: string;
|
|
7096
7108
|
key?: string;
|
|
7097
7109
|
}
|
|
7098
|
-
declare function byteArrayFromString$1(targetString: string): {
|
|
7099
|
-
data: BigNumberish[];
|
|
7100
|
-
pending_word: BigNumberish;
|
|
7101
|
-
pending_word_len: number;
|
|
7102
|
-
};
|
|
7103
7110
|
declare function prepareSelector(selector: string): string;
|
|
7104
7111
|
declare function isMerkleTreeType(type: StarkNetType): type is StarkNetMerkleType;
|
|
7105
7112
|
/**
|
|
@@ -7152,7 +7159,7 @@ declare const typedData_getTypeHash: typeof getTypeHash;
|
|
|
7152
7159
|
declare const typedData_isMerkleTreeType: typeof isMerkleTreeType;
|
|
7153
7160
|
declare const typedData_prepareSelector: typeof prepareSelector;
|
|
7154
7161
|
declare namespace typedData {
|
|
7155
|
-
export { type typedData_StarkNetDomain as StarkNetDomain, type typedData_StarkNetEnumType as StarkNetEnumType, type typedData_StarkNetMerkleType as StarkNetMerkleType, type typedData_StarkNetType as StarkNetType, type typedData_TypedData as TypedData, typedData_TypedDataRevision as TypedDataRevision,
|
|
7162
|
+
export { type typedData_StarkNetDomain as StarkNetDomain, type typedData_StarkNetEnumType as StarkNetEnumType, type typedData_StarkNetMerkleType as StarkNetMerkleType, type typedData_StarkNetType as StarkNetType, type typedData_TypedData as TypedData, typedData_TypedDataRevision as TypedDataRevision, typedData_encodeData as encodeData, typedData_encodeType as encodeType, typedData_encodeValue as encodeValue, typedData_getDependencies as getDependencies, typedData_getMessageHash as getMessageHash, typedData_getStructHash as getStructHash, typedData_getTypeHash as getTypeHash, typedData_isMerkleTreeType as isMerkleTreeType, typedData_prepareSelector as prepareSelector };
|
|
7156
7163
|
}
|
|
7157
7164
|
|
|
7158
7165
|
declare function useDecoded(encoded: bigint[]): string;
|
|
@@ -7442,7 +7449,7 @@ declare namespace cairo {
|
|
|
7442
7449
|
* @example
|
|
7443
7450
|
* ```typescript
|
|
7444
7451
|
* const myByteArray = {
|
|
7445
|
-
* data: [
|
|
7452
|
+
* data: [],
|
|
7446
7453
|
* pending_word: '0x414243444546474849',
|
|
7447
7454
|
* pending_word_len: 9
|
|
7448
7455
|
* }
|
|
@@ -7456,16 +7463,16 @@ declare function stringFromByteArray(myByteArray: ByteArray): string;
|
|
|
7456
7463
|
* @returns Cairo representation of a LongString
|
|
7457
7464
|
* @example
|
|
7458
7465
|
* ```typescript
|
|
7459
|
-
* const myByteArray: ByteArray =
|
|
7466
|
+
* const myByteArray: ByteArray = byteArrayFromString("ABCDEFGHI");
|
|
7460
7467
|
* ```
|
|
7461
7468
|
* Result is :
|
|
7462
7469
|
* {
|
|
7463
|
-
* data: [
|
|
7470
|
+
* data: [],
|
|
7464
7471
|
* pending_word: '0x414243444546474849',
|
|
7465
7472
|
* pending_word_len: 9
|
|
7466
7473
|
* }
|
|
7467
7474
|
*/
|
|
7468
|
-
declare function byteArrayFromString(
|
|
7475
|
+
declare function byteArrayFromString(targetString: string): ByteArray;
|
|
7469
7476
|
|
|
7470
7477
|
declare const byteArray_byteArrayFromString: typeof byteArrayFromString;
|
|
7471
7478
|
declare const byteArray_stringFromByteArray: typeof stringFromByteArray;
|
package/dist/index.global.js
CHANGED
|
@@ -16179,31 +16179,15 @@ var starknet = (() => {
|
|
|
16179
16179
|
return cumuledString + add;
|
|
16180
16180
|
}, "") + pending_word;
|
|
16181
16181
|
}
|
|
16182
|
-
function byteArrayFromString(
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
pending_word_len: 0
|
|
16188
|
-
};
|
|
16189
|
-
}
|
|
16190
|
-
const myShortStrings = splitLongString(myString);
|
|
16191
|
-
const remains = myShortStrings[myShortStrings.length - 1];
|
|
16192
|
-
const myShortStringsEncoded = myShortStrings.map(
|
|
16193
|
-
(shortStr) => encodeShortString(shortStr)
|
|
16194
|
-
);
|
|
16195
|
-
if (remains.length === 31) {
|
|
16196
|
-
return {
|
|
16197
|
-
data: myShortStringsEncoded,
|
|
16198
|
-
pending_word: "0x00",
|
|
16199
|
-
pending_word_len: 0
|
|
16200
|
-
};
|
|
16201
|
-
}
|
|
16202
|
-
const pendingEncodedWord = myShortStringsEncoded.pop();
|
|
16182
|
+
function byteArrayFromString(targetString) {
|
|
16183
|
+
const shortStrings = splitLongString(targetString);
|
|
16184
|
+
const remainder = shortStrings[shortStrings.length - 1];
|
|
16185
|
+
const shortStringsEncoded = shortStrings.map(encodeShortString);
|
|
16186
|
+
const [pendingWord, pendingWordLength] = remainder === void 0 || remainder.length === 31 ? ["0x00", 0] : [shortStringsEncoded.pop(), remainder.length];
|
|
16203
16187
|
return {
|
|
16204
|
-
data:
|
|
16205
|
-
pending_word:
|
|
16206
|
-
pending_word_len:
|
|
16188
|
+
data: shortStringsEncoded.length === 0 ? [] : shortStringsEncoded,
|
|
16189
|
+
pending_word: pendingWord,
|
|
16190
|
+
pending_word_len: pendingWordLength
|
|
16207
16191
|
};
|
|
16208
16192
|
}
|
|
16209
16193
|
|
|
@@ -17807,6 +17791,7 @@ var starknet = (() => {
|
|
|
17807
17791
|
formatSpaces: () => formatSpaces,
|
|
17808
17792
|
getSelector: () => getSelector,
|
|
17809
17793
|
getSelectorFromName: () => getSelectorFromName,
|
|
17794
|
+
hashByteCodeSegments: () => hashByteCodeSegments,
|
|
17810
17795
|
keccakBn: () => keccakBn,
|
|
17811
17796
|
poseidon: () => poseidon_exports,
|
|
17812
17797
|
starknetKeccak: () => starknetKeccak
|
|
@@ -18728,13 +18713,23 @@ var starknet = (() => {
|
|
|
18728
18713
|
});
|
|
18729
18714
|
return poseidonHashMany(base2);
|
|
18730
18715
|
}
|
|
18716
|
+
function hashByteCodeSegments(casm) {
|
|
18717
|
+
const byteCode = casm.bytecode.map((n) => BigInt(n));
|
|
18718
|
+
const bytecodeSegmentLengths = casm.bytecode_segment_lengths ?? [];
|
|
18719
|
+
let segmentStart = 0;
|
|
18720
|
+
const hashLeaves = bytecodeSegmentLengths.flatMap((len) => {
|
|
18721
|
+
const segment = byteCode.slice(segmentStart, segmentStart += len);
|
|
18722
|
+
return [BigInt(len), poseidonHashMany(segment)];
|
|
18723
|
+
});
|
|
18724
|
+
return 1n + poseidonHashMany(hashLeaves);
|
|
18725
|
+
}
|
|
18731
18726
|
function computeCompiledClassHash(casm) {
|
|
18732
18727
|
const COMPILED_CLASS_VERSION = "COMPILED_CLASS_V1";
|
|
18733
18728
|
const compiledClassVersion = BigInt(encodeShortString(COMPILED_CLASS_VERSION));
|
|
18734
18729
|
const externalEntryPointsHash = hashEntryPoint(casm.entry_points_by_type.EXTERNAL);
|
|
18735
18730
|
const l1Handlers = hashEntryPoint(casm.entry_points_by_type.L1_HANDLER);
|
|
18736
18731
|
const constructor = hashEntryPoint(casm.entry_points_by_type.CONSTRUCTOR);
|
|
18737
|
-
const bytecode = poseidonHashMany(casm.bytecode.map((it) => BigInt(it)));
|
|
18732
|
+
const bytecode = casm.bytecode_segment_lengths ? hashByteCodeSegments(casm) : poseidonHashMany(casm.bytecode.map((it) => BigInt(it)));
|
|
18738
18733
|
return toHex(
|
|
18739
18734
|
poseidonHashMany([
|
|
18740
18735
|
compiledClassVersion,
|
|
@@ -25493,7 +25488,6 @@ var starknet = (() => {
|
|
|
25493
25488
|
var typedData_exports = {};
|
|
25494
25489
|
__export(typedData_exports, {
|
|
25495
25490
|
TypedDataRevision: () => TypedDataRevision,
|
|
25496
|
-
byteArrayFromString: () => byteArrayFromString2,
|
|
25497
25491
|
encodeData: () => encodeData,
|
|
25498
25492
|
encodeType: () => encodeType,
|
|
25499
25493
|
encodeValue: () => encodeValue,
|
|
@@ -25612,17 +25606,6 @@ var starknet = (() => {
|
|
|
25612
25606
|
presetTypes: {}
|
|
25613
25607
|
}
|
|
25614
25608
|
};
|
|
25615
|
-
function byteArrayFromString2(targetString) {
|
|
25616
|
-
const shortStrings = splitLongString(targetString);
|
|
25617
|
-
const remainder = shortStrings[shortStrings.length - 1];
|
|
25618
|
-
const shortStringsEncoded = shortStrings.map(encodeShortString);
|
|
25619
|
-
const [pendingWord, pendingWordLength] = remainder === void 0 || remainder.length === 31 ? ["0x00", 0] : [shortStringsEncoded.pop(), remainder.length];
|
|
25620
|
-
return {
|
|
25621
|
-
data: shortStringsEncoded.length === 0 ? ["0x00"] : shortStringsEncoded,
|
|
25622
|
-
pending_word: pendingWord,
|
|
25623
|
-
pending_word_len: pendingWordLength
|
|
25624
|
-
};
|
|
25625
|
-
}
|
|
25626
25609
|
function identifyRevision({ types, domain }) {
|
|
25627
25610
|
if (revisionConfiguration["1" /* Active */].domain in types && domain.revision === "1" /* Active */)
|
|
25628
25611
|
return "1" /* Active */;
|
|
@@ -25694,11 +25677,18 @@ var starknet = (() => {
|
|
|
25694
25677
|
return "raw";
|
|
25695
25678
|
}
|
|
25696
25679
|
function encodeType(types, type, revision = "0" /* Legacy */) {
|
|
25697
|
-
const
|
|
25680
|
+
const allTypes = revision === "1" /* Active */ ? { ...types, ...revisionConfiguration[revision].presetTypes } : types;
|
|
25681
|
+
const [primary, ...dependencies] = getDependencies(
|
|
25682
|
+
allTypes,
|
|
25683
|
+
type,
|
|
25684
|
+
void 0,
|
|
25685
|
+
void 0,
|
|
25686
|
+
revision
|
|
25687
|
+
);
|
|
25698
25688
|
const newTypes = !primary ? [] : [primary, ...dependencies.sort()];
|
|
25699
25689
|
const esc = revisionConfiguration[revision].escapeTypeString;
|
|
25700
25690
|
return newTypes.map((dependency) => {
|
|
25701
|
-
const dependencyElements =
|
|
25691
|
+
const dependencyElements = allTypes[dependency].map((t) => {
|
|
25702
25692
|
const targetType = t.type === "enum" && revision === "1" /* Active */ ? t.contains : t.type;
|
|
25703
25693
|
const typeString = targetType.match(/^\(.*\)$/) ? `(${targetType.slice(1, -1).split(",").map((e) => e ? esc(e) : e).join(",")})` : esc(targetType);
|
|
25704
25694
|
return `${esc(t.name)}:${typeString}`;
|
|
@@ -25767,7 +25757,7 @@ var starknet = (() => {
|
|
|
25767
25757
|
}
|
|
25768
25758
|
case "string": {
|
|
25769
25759
|
if (revision === "1" /* Active */) {
|
|
25770
|
-
const byteArray =
|
|
25760
|
+
const byteArray = byteArrayFromString(data);
|
|
25771
25761
|
const elements = [
|
|
25772
25762
|
byteArray.data.length,
|
|
25773
25763
|
...byteArray.data,
|
|
@@ -26172,7 +26162,12 @@ var starknet = (() => {
|
|
|
26172
26162
|
return this.estimateInvokeFee(calls, estimateFeeDetails);
|
|
26173
26163
|
}
|
|
26174
26164
|
async estimateInvokeFee(calls, details = {}) {
|
|
26175
|
-
const {
|
|
26165
|
+
const {
|
|
26166
|
+
nonce: providedNonce,
|
|
26167
|
+
blockIdentifier,
|
|
26168
|
+
version: providedVersion,
|
|
26169
|
+
skipValidate = true
|
|
26170
|
+
} = details;
|
|
26176
26171
|
const transactions = Array.isArray(calls) ? calls : [calls];
|
|
26177
26172
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
26178
26173
|
const version = toTransactionVersion(
|
|
@@ -26187,7 +26182,8 @@ var starknet = (() => {
|
|
|
26187
26182
|
maxFee: ZERO,
|
|
26188
26183
|
version,
|
|
26189
26184
|
chainId,
|
|
26190
|
-
cairoVersion: await this.getCairoVersion()
|
|
26185
|
+
cairoVersion: await this.getCairoVersion(),
|
|
26186
|
+
skipValidate
|
|
26191
26187
|
};
|
|
26192
26188
|
const invocation = await this.buildInvocation(transactions, signerDetails);
|
|
26193
26189
|
return super.getInvokeEstimateFee(
|
|
@@ -26198,7 +26194,12 @@ var starknet = (() => {
|
|
|
26198
26194
|
);
|
|
26199
26195
|
}
|
|
26200
26196
|
async estimateDeclareFee(payload, details = {}) {
|
|
26201
|
-
const {
|
|
26197
|
+
const {
|
|
26198
|
+
blockIdentifier,
|
|
26199
|
+
nonce: providedNonce,
|
|
26200
|
+
version: providedVersion,
|
|
26201
|
+
skipValidate = true
|
|
26202
|
+
} = details;
|
|
26202
26203
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
26203
26204
|
const version = toTransactionVersion(
|
|
26204
26205
|
!isSierra(payload.contract) ? "0x100000000000000000000000000000001" /* F1 */ : this.getPreferredVersion("0x100000000000000000000000000000002" /* F2 */, "0x100000000000000000000000000000003" /* F3 */),
|
|
@@ -26212,8 +26213,9 @@ var starknet = (() => {
|
|
|
26212
26213
|
version,
|
|
26213
26214
|
walletAddress: this.address,
|
|
26214
26215
|
maxFee: ZERO,
|
|
26215
|
-
cairoVersion: void 0
|
|
26216
|
+
cairoVersion: void 0,
|
|
26216
26217
|
// unused parameter
|
|
26218
|
+
skipValidate
|
|
26217
26219
|
});
|
|
26218
26220
|
return super.getDeclareEstimateFee(
|
|
26219
26221
|
declareContractTransaction,
|
|
@@ -26228,7 +26230,7 @@ var starknet = (() => {
|
|
|
26228
26230
|
constructorCalldata = [],
|
|
26229
26231
|
contractAddress
|
|
26230
26232
|
}, details = {}) {
|
|
26231
|
-
const { blockIdentifier, version: providedVersion } = details;
|
|
26233
|
+
const { blockIdentifier, version: providedVersion, skipValidate = true } = details;
|
|
26232
26234
|
const version = toTransactionVersion(
|
|
26233
26235
|
this.getPreferredVersion("0x100000000000000000000000000000001" /* F1 */, "0x100000000000000000000000000000003" /* F3 */),
|
|
26234
26236
|
toFeeVersion(providedVersion)
|
|
@@ -26245,8 +26247,9 @@ var starknet = (() => {
|
|
|
26245
26247
|
walletAddress: this.address,
|
|
26246
26248
|
// unused parameter
|
|
26247
26249
|
maxFee: ZERO,
|
|
26248
|
-
cairoVersion: void 0
|
|
26250
|
+
cairoVersion: void 0,
|
|
26249
26251
|
// unused parameter,
|
|
26252
|
+
skipValidate
|
|
26250
26253
|
}
|
|
26251
26254
|
);
|
|
26252
26255
|
return super.getDeployAccountEstimateFee(
|
|
@@ -26282,7 +26285,7 @@ var starknet = (() => {
|
|
|
26282
26285
|
});
|
|
26283
26286
|
}
|
|
26284
26287
|
async simulateTransaction(invocations, details = {}) {
|
|
26285
|
-
const { nonce, blockIdentifier, skipValidate, skipExecute, version } = details;
|
|
26288
|
+
const { nonce, blockIdentifier, skipValidate = true, skipExecute, version } = details;
|
|
26286
26289
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
26287
26290
|
...v3Details(details),
|
|
26288
26291
|
versions: [
|
|
@@ -26294,7 +26297,8 @@ var starknet = (() => {
|
|
|
26294
26297
|
)
|
|
26295
26298
|
],
|
|
26296
26299
|
nonce,
|
|
26297
|
-
blockIdentifier
|
|
26300
|
+
blockIdentifier,
|
|
26301
|
+
skipValidate
|
|
26298
26302
|
});
|
|
26299
26303
|
return super.getSimulateTransaction(accountInvocations, {
|
|
26300
26304
|
blockIdentifier,
|
|
@@ -26580,7 +26584,7 @@ var starknet = (() => {
|
|
|
26580
26584
|
}
|
|
26581
26585
|
async buildInvocation(call, details) {
|
|
26582
26586
|
const calldata = getExecuteCalldata(call, await this.getCairoVersion());
|
|
26583
|
-
const signature = await this.signer.signTransaction(call, details);
|
|
26587
|
+
const signature = !details.skipValidate ? await this.signer.signTransaction(call, details) : [];
|
|
26584
26588
|
return {
|
|
26585
26589
|
...v3Details(details),
|
|
26586
26590
|
contractAddress: this.address,
|
|
@@ -26594,14 +26598,14 @@ var starknet = (() => {
|
|
|
26594
26598
|
if (typeof compiledClassHash === "undefined" && (details.version === "0x100000000000000000000000000000003" /* F3 */ || details.version === "0x3" /* V3 */)) {
|
|
26595
26599
|
throw Error("V3 Transaction work with Cairo1 Contracts and require compiledClassHash");
|
|
26596
26600
|
}
|
|
26597
|
-
const signature = await this.signer.signDeclareTransaction({
|
|
26601
|
+
const signature = !details.skipValidate ? await this.signer.signDeclareTransaction({
|
|
26598
26602
|
...details,
|
|
26599
26603
|
...v3Details(details),
|
|
26600
26604
|
classHash,
|
|
26601
26605
|
compiledClassHash,
|
|
26602
|
-
// TODO: TS
|
|
26606
|
+
// TODO: TS, cast because optional for v2 and required for v3, thrown if not present
|
|
26603
26607
|
senderAddress: details.walletAddress
|
|
26604
|
-
});
|
|
26608
|
+
}) : [];
|
|
26605
26609
|
return {
|
|
26606
26610
|
senderAddress: details.walletAddress,
|
|
26607
26611
|
signature,
|
|
@@ -26617,14 +26621,14 @@ var starknet = (() => {
|
|
|
26617
26621
|
}, details) {
|
|
26618
26622
|
const compiledCalldata = CallData.compile(constructorCalldata);
|
|
26619
26623
|
const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, compiledCalldata, 0);
|
|
26620
|
-
const signature = await this.signer.signDeployAccountTransaction({
|
|
26624
|
+
const signature = !details.skipValidate ? await this.signer.signDeployAccountTransaction({
|
|
26621
26625
|
...details,
|
|
26622
26626
|
...v3Details(details),
|
|
26623
26627
|
classHash,
|
|
26624
26628
|
contractAddress,
|
|
26625
26629
|
addressSalt,
|
|
26626
26630
|
constructorCalldata: compiledCalldata
|
|
26627
|
-
});
|
|
26631
|
+
}) : [];
|
|
26628
26632
|
return {
|
|
26629
26633
|
...v3Details(details),
|
|
26630
26634
|
classHash,
|
|
@@ -26657,7 +26661,7 @@ var starknet = (() => {
|
|
|
26657
26661
|
return calls;
|
|
26658
26662
|
}
|
|
26659
26663
|
async accountInvocationsFactory(invocations, details) {
|
|
26660
|
-
const { nonce, blockIdentifier } = details;
|
|
26664
|
+
const { nonce, blockIdentifier, skipValidate = true } = details;
|
|
26661
26665
|
const safeNonce = await this.getNonceSafe(nonce);
|
|
26662
26666
|
const chainId = await this.getChainId();
|
|
26663
26667
|
const versions = details.versions.map((it) => toTransactionVersion(it));
|
|
@@ -26673,7 +26677,8 @@ var starknet = (() => {
|
|
|
26673
26677
|
maxFee: ZERO,
|
|
26674
26678
|
chainId,
|
|
26675
26679
|
cairoVersion,
|
|
26676
|
-
version: ""
|
|
26680
|
+
version: "",
|
|
26681
|
+
skipValidate
|
|
26677
26682
|
};
|
|
26678
26683
|
const common2 = {
|
|
26679
26684
|
type: transaction.type,
|