starknet 6.7.0 → 6.8.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 +14 -0
- package/README.md +2 -0
- package/dist/index.d.ts +644 -1258
- package/dist/index.global.js +196 -164
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +190 -300
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -274
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2
5
|
var __export = (target, all) => {
|
|
3
6
|
for (var name in all)
|
|
4
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
8
|
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
6
18
|
|
|
7
19
|
// src/constants.ts
|
|
8
20
|
var constants_exports = {};
|
|
@@ -22,7 +34,7 @@ __export(constants_exports, {
|
|
|
22
34
|
RPC_NODES: () => RPC_NODES,
|
|
23
35
|
StarknetChainId: () => StarknetChainId,
|
|
24
36
|
TEXT_TO_FELT_MAX_LEN: () => TEXT_TO_FELT_MAX_LEN,
|
|
25
|
-
TRANSACTION_VERSION: () =>
|
|
37
|
+
TRANSACTION_VERSION: () => api_exports.ETransactionVersion,
|
|
26
38
|
TransactionHashPrefix: () => TransactionHashPrefix,
|
|
27
39
|
UDC: () => UDC,
|
|
28
40
|
ZERO: () => ZERO,
|
|
@@ -32,22 +44,9 @@ __export(constants_exports, {
|
|
|
32
44
|
// src/types/api/index.ts
|
|
33
45
|
var api_exports = {};
|
|
34
46
|
__export(api_exports, {
|
|
35
|
-
EBlockTag: () => EBlockTag2,
|
|
36
|
-
EDAMode: () => EDAMode2,
|
|
37
|
-
EDataAvailabilityMode: () => EDataAvailabilityMode2,
|
|
38
|
-
ESimulationFlag: () => ESimulationFlag2,
|
|
39
|
-
ETransactionExecutionStatus: () => ETransactionExecutionStatus2,
|
|
40
|
-
ETransactionFinalityStatus: () => ETransactionFinalityStatus2,
|
|
41
|
-
ETransactionStatus: () => ETransactionStatus2,
|
|
42
|
-
ETransactionType: () => ETransactionType2,
|
|
43
|
-
ETransactionVersion: () => ETransactionVersion4,
|
|
44
|
-
ETransactionVersion2: () => ETransactionVersion22,
|
|
45
|
-
ETransactionVersion3: () => ETransactionVersion32,
|
|
46
|
-
Errors: () => errors_exports2,
|
|
47
47
|
JRPC: () => jsonrpc_exports,
|
|
48
48
|
RPCSPEC06: () => rpcspec_0_6_exports,
|
|
49
|
-
RPCSPEC07: () =>
|
|
50
|
-
SPEC: () => components_exports2
|
|
49
|
+
RPCSPEC07: () => RPCSPEC07
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
// src/types/api/jsonrpc/index.ts
|
|
@@ -78,40 +77,40 @@ var errors_exports = {};
|
|
|
78
77
|
var components_exports = {};
|
|
79
78
|
|
|
80
79
|
// src/types/api/rpcspec_0_6/nonspec.ts
|
|
81
|
-
var ETransactionType = /* @__PURE__ */ ((
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return
|
|
80
|
+
var ETransactionType = /* @__PURE__ */ ((ETransactionType2) => {
|
|
81
|
+
ETransactionType2["DECLARE"] = "DECLARE";
|
|
82
|
+
ETransactionType2["DEPLOY"] = "DEPLOY";
|
|
83
|
+
ETransactionType2["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
|
|
84
|
+
ETransactionType2["INVOKE"] = "INVOKE";
|
|
85
|
+
ETransactionType2["L1_HANDLER"] = "L1_HANDLER";
|
|
86
|
+
return ETransactionType2;
|
|
88
87
|
})(ETransactionType || {});
|
|
89
|
-
var ESimulationFlag = /* @__PURE__ */ ((
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return
|
|
88
|
+
var ESimulationFlag = /* @__PURE__ */ ((ESimulationFlag2) => {
|
|
89
|
+
ESimulationFlag2["SKIP_VALIDATE"] = "SKIP_VALIDATE";
|
|
90
|
+
ESimulationFlag2["SKIP_FEE_CHARGE"] = "SKIP_FEE_CHARGE";
|
|
91
|
+
return ESimulationFlag2;
|
|
93
92
|
})(ESimulationFlag || {});
|
|
94
|
-
var ETransactionStatus = /* @__PURE__ */ ((
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return
|
|
93
|
+
var ETransactionStatus = /* @__PURE__ */ ((ETransactionStatus2) => {
|
|
94
|
+
ETransactionStatus2["RECEIVED"] = "RECEIVED";
|
|
95
|
+
ETransactionStatus2["REJECTED"] = "REJECTED";
|
|
96
|
+
ETransactionStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
97
|
+
ETransactionStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
98
|
+
return ETransactionStatus2;
|
|
100
99
|
})(ETransactionStatus || {});
|
|
101
|
-
var ETransactionFinalityStatus = /* @__PURE__ */ ((
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
100
|
+
var ETransactionFinalityStatus = /* @__PURE__ */ ((ETransactionFinalityStatus2) => {
|
|
101
|
+
ETransactionFinalityStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
102
|
+
ETransactionFinalityStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
103
|
+
return ETransactionFinalityStatus2;
|
|
105
104
|
})(ETransactionFinalityStatus || {});
|
|
106
|
-
var ETransactionExecutionStatus = /* @__PURE__ */ ((
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return
|
|
105
|
+
var ETransactionExecutionStatus = /* @__PURE__ */ ((ETransactionExecutionStatus2) => {
|
|
106
|
+
ETransactionExecutionStatus2["SUCCEEDED"] = "SUCCEEDED";
|
|
107
|
+
ETransactionExecutionStatus2["REVERTED"] = "REVERTED";
|
|
108
|
+
return ETransactionExecutionStatus2;
|
|
110
109
|
})(ETransactionExecutionStatus || {});
|
|
111
|
-
var EBlockTag = /* @__PURE__ */ ((
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return
|
|
110
|
+
var EBlockTag = /* @__PURE__ */ ((EBlockTag2) => {
|
|
111
|
+
EBlockTag2["LATEST"] = "latest";
|
|
112
|
+
EBlockTag2["PENDING"] = "pending";
|
|
113
|
+
return EBlockTag2;
|
|
115
114
|
})(EBlockTag || {});
|
|
116
115
|
var EDataAvailabilityMode = /* @__PURE__ */ ((EDataAvailabilityMode3) => {
|
|
117
116
|
EDataAvailabilityMode3["L1"] = "L1";
|
|
@@ -123,127 +122,36 @@ var EDAMode = /* @__PURE__ */ ((EDAMode4) => {
|
|
|
123
122
|
EDAMode4[EDAMode4["L2"] = 1] = "L2";
|
|
124
123
|
return EDAMode4;
|
|
125
124
|
})(EDAMode || {});
|
|
126
|
-
var ETransactionVersion = /* @__PURE__ */ ((
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return
|
|
125
|
+
var ETransactionVersion = /* @__PURE__ */ ((ETransactionVersion10) => {
|
|
126
|
+
ETransactionVersion10["V0"] = "0x0";
|
|
127
|
+
ETransactionVersion10["V1"] = "0x1";
|
|
128
|
+
ETransactionVersion10["V2"] = "0x2";
|
|
129
|
+
ETransactionVersion10["V3"] = "0x3";
|
|
130
|
+
ETransactionVersion10["F0"] = "0x100000000000000000000000000000000";
|
|
131
|
+
ETransactionVersion10["F1"] = "0x100000000000000000000000000000001";
|
|
132
|
+
ETransactionVersion10["F2"] = "0x100000000000000000000000000000002";
|
|
133
|
+
ETransactionVersion10["F3"] = "0x100000000000000000000000000000003";
|
|
134
|
+
return ETransactionVersion10;
|
|
136
135
|
})(ETransactionVersion || {});
|
|
137
|
-
var ETransactionVersion2 = /* @__PURE__ */ ((
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return
|
|
136
|
+
var ETransactionVersion2 = /* @__PURE__ */ ((ETransactionVersion25) => {
|
|
137
|
+
ETransactionVersion25["V0"] = "0x0";
|
|
138
|
+
ETransactionVersion25["V1"] = "0x1";
|
|
139
|
+
ETransactionVersion25["V2"] = "0x2";
|
|
140
|
+
ETransactionVersion25["F0"] = "0x100000000000000000000000000000000";
|
|
141
|
+
ETransactionVersion25["F1"] = "0x100000000000000000000000000000001";
|
|
142
|
+
ETransactionVersion25["F2"] = "0x100000000000000000000000000000002";
|
|
143
|
+
return ETransactionVersion25;
|
|
145
144
|
})(ETransactionVersion2 || {});
|
|
146
|
-
var ETransactionVersion3 = /* @__PURE__ */ ((
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return
|
|
145
|
+
var ETransactionVersion3 = /* @__PURE__ */ ((ETransactionVersion36) => {
|
|
146
|
+
ETransactionVersion36["V3"] = "0x3";
|
|
147
|
+
ETransactionVersion36["F3"] = "0x100000000000000000000000000000003";
|
|
148
|
+
return ETransactionVersion36;
|
|
150
149
|
})(ETransactionVersion3 || {});
|
|
151
150
|
|
|
152
|
-
// src/types/api/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
EDAMode: () => EDAMode2,
|
|
157
|
-
EDataAvailabilityMode: () => EDataAvailabilityMode2,
|
|
158
|
-
ESimulationFlag: () => ESimulationFlag2,
|
|
159
|
-
ETransactionExecutionStatus: () => ETransactionExecutionStatus2,
|
|
160
|
-
ETransactionFinalityStatus: () => ETransactionFinalityStatus2,
|
|
161
|
-
ETransactionStatus: () => ETransactionStatus2,
|
|
162
|
-
ETransactionType: () => ETransactionType2,
|
|
163
|
-
ETransactionVersion: () => ETransactionVersion4,
|
|
164
|
-
ETransactionVersion2: () => ETransactionVersion22,
|
|
165
|
-
ETransactionVersion3: () => ETransactionVersion32,
|
|
166
|
-
Errors: () => errors_exports2,
|
|
167
|
-
SPEC: () => components_exports2
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
// src/types/api/rpcspec_0_7/errors.ts
|
|
171
|
-
var errors_exports2 = {};
|
|
172
|
-
|
|
173
|
-
// src/types/api/rpcspec_0_7/components.ts
|
|
174
|
-
var components_exports2 = {};
|
|
175
|
-
|
|
176
|
-
// src/types/api/rpcspec_0_7/nonspec.ts
|
|
177
|
-
var ETransactionType2 = /* @__PURE__ */ ((ETransactionType3) => {
|
|
178
|
-
ETransactionType3["DECLARE"] = "DECLARE";
|
|
179
|
-
ETransactionType3["DEPLOY"] = "DEPLOY";
|
|
180
|
-
ETransactionType3["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
|
|
181
|
-
ETransactionType3["INVOKE"] = "INVOKE";
|
|
182
|
-
ETransactionType3["L1_HANDLER"] = "L1_HANDLER";
|
|
183
|
-
return ETransactionType3;
|
|
184
|
-
})(ETransactionType2 || {});
|
|
185
|
-
var ESimulationFlag2 = /* @__PURE__ */ ((ESimulationFlag3) => {
|
|
186
|
-
ESimulationFlag3["SKIP_VALIDATE"] = "SKIP_VALIDATE";
|
|
187
|
-
ESimulationFlag3["SKIP_FEE_CHARGE"] = "SKIP_FEE_CHARGE";
|
|
188
|
-
return ESimulationFlag3;
|
|
189
|
-
})(ESimulationFlag2 || {});
|
|
190
|
-
var ETransactionStatus2 = /* @__PURE__ */ ((ETransactionStatus3) => {
|
|
191
|
-
ETransactionStatus3["RECEIVED"] = "RECEIVED";
|
|
192
|
-
ETransactionStatus3["REJECTED"] = "REJECTED";
|
|
193
|
-
ETransactionStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
194
|
-
ETransactionStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
195
|
-
return ETransactionStatus3;
|
|
196
|
-
})(ETransactionStatus2 || {});
|
|
197
|
-
var ETransactionFinalityStatus2 = /* @__PURE__ */ ((ETransactionFinalityStatus3) => {
|
|
198
|
-
ETransactionFinalityStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
|
|
199
|
-
ETransactionFinalityStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
|
|
200
|
-
return ETransactionFinalityStatus3;
|
|
201
|
-
})(ETransactionFinalityStatus2 || {});
|
|
202
|
-
var ETransactionExecutionStatus2 = /* @__PURE__ */ ((ETransactionExecutionStatus3) => {
|
|
203
|
-
ETransactionExecutionStatus3["SUCCEEDED"] = "SUCCEEDED";
|
|
204
|
-
ETransactionExecutionStatus3["REVERTED"] = "REVERTED";
|
|
205
|
-
return ETransactionExecutionStatus3;
|
|
206
|
-
})(ETransactionExecutionStatus2 || {});
|
|
207
|
-
var EBlockTag2 = /* @__PURE__ */ ((EBlockTag3) => {
|
|
208
|
-
EBlockTag3["LATEST"] = "latest";
|
|
209
|
-
EBlockTag3["PENDING"] = "pending";
|
|
210
|
-
return EBlockTag3;
|
|
211
|
-
})(EBlockTag2 || {});
|
|
212
|
-
var EDataAvailabilityMode2 = /* @__PURE__ */ ((EDataAvailabilityMode3) => {
|
|
213
|
-
EDataAvailabilityMode3["L1"] = "L1";
|
|
214
|
-
EDataAvailabilityMode3["L2"] = "L2";
|
|
215
|
-
return EDataAvailabilityMode3;
|
|
216
|
-
})(EDataAvailabilityMode2 || {});
|
|
217
|
-
var EDAMode2 = /* @__PURE__ */ ((EDAMode4) => {
|
|
218
|
-
EDAMode4[EDAMode4["L1"] = 0] = "L1";
|
|
219
|
-
EDAMode4[EDAMode4["L2"] = 1] = "L2";
|
|
220
|
-
return EDAMode4;
|
|
221
|
-
})(EDAMode2 || {});
|
|
222
|
-
var ETransactionVersion4 = /* @__PURE__ */ ((ETransactionVersion5) => {
|
|
223
|
-
ETransactionVersion5["V0"] = "0x0";
|
|
224
|
-
ETransactionVersion5["V1"] = "0x1";
|
|
225
|
-
ETransactionVersion5["V2"] = "0x2";
|
|
226
|
-
ETransactionVersion5["V3"] = "0x3";
|
|
227
|
-
ETransactionVersion5["F0"] = "0x100000000000000000000000000000000";
|
|
228
|
-
ETransactionVersion5["F1"] = "0x100000000000000000000000000000001";
|
|
229
|
-
ETransactionVersion5["F2"] = "0x100000000000000000000000000000002";
|
|
230
|
-
ETransactionVersion5["F3"] = "0x100000000000000000000000000000003";
|
|
231
|
-
return ETransactionVersion5;
|
|
232
|
-
})(ETransactionVersion4 || {});
|
|
233
|
-
var ETransactionVersion22 = /* @__PURE__ */ ((ETransactionVersion24) => {
|
|
234
|
-
ETransactionVersion24["V0"] = "0x0";
|
|
235
|
-
ETransactionVersion24["V1"] = "0x1";
|
|
236
|
-
ETransactionVersion24["V2"] = "0x2";
|
|
237
|
-
ETransactionVersion24["F0"] = "0x100000000000000000000000000000000";
|
|
238
|
-
ETransactionVersion24["F1"] = "0x100000000000000000000000000000001";
|
|
239
|
-
ETransactionVersion24["F2"] = "0x100000000000000000000000000000002";
|
|
240
|
-
return ETransactionVersion24;
|
|
241
|
-
})(ETransactionVersion22 || {});
|
|
242
|
-
var ETransactionVersion32 = /* @__PURE__ */ ((ETransactionVersion34) => {
|
|
243
|
-
ETransactionVersion34["V3"] = "0x3";
|
|
244
|
-
ETransactionVersion34["F3"] = "0x100000000000000000000000000000003";
|
|
245
|
-
return ETransactionVersion34;
|
|
246
|
-
})(ETransactionVersion32 || {});
|
|
151
|
+
// src/types/api/index.ts
|
|
152
|
+
__reExport(api_exports, starknet_types_07_star);
|
|
153
|
+
import * as RPCSPEC07 from "starknet-types-07";
|
|
154
|
+
import * as starknet_types_07_star from "starknet-types-07";
|
|
247
155
|
|
|
248
156
|
// src/utils/encode.ts
|
|
249
157
|
var encode_exports = {};
|
|
@@ -530,7 +438,7 @@ var BlockTag = /* @__PURE__ */ ((BlockTag2) => {
|
|
|
530
438
|
// src/types/typedData.ts
|
|
531
439
|
import {
|
|
532
440
|
TypedDataRevision
|
|
533
|
-
} from "starknet-types";
|
|
441
|
+
} from "starknet-types-07";
|
|
534
442
|
|
|
535
443
|
// src/utils/assert.ts
|
|
536
444
|
function assert(condition, message) {
|
|
@@ -2738,7 +2646,7 @@ function calculateInvokeTransactionHash(senderAddress, version, compiledCalldata
|
|
|
2738
2646
|
|
|
2739
2647
|
// src/utils/hash/transactionHash/index.ts
|
|
2740
2648
|
function isV3InvokeTx(args) {
|
|
2741
|
-
return [
|
|
2649
|
+
return [api_exports.ETransactionVersion.V3, api_exports.ETransactionVersion.F3].includes(
|
|
2742
2650
|
args.version
|
|
2743
2651
|
);
|
|
2744
2652
|
}
|
|
@@ -2768,7 +2676,7 @@ function calculateInvokeTransactionHash2(args) {
|
|
|
2768
2676
|
);
|
|
2769
2677
|
}
|
|
2770
2678
|
function isV3DeclareTx(args) {
|
|
2771
|
-
return [
|
|
2679
|
+
return [api_exports.ETransactionVersion.V3, api_exports.ETransactionVersion.F3].includes(
|
|
2772
2680
|
args.version
|
|
2773
2681
|
);
|
|
2774
2682
|
}
|
|
@@ -2800,7 +2708,7 @@ function calculateDeclareTransactionHash3(args) {
|
|
|
2800
2708
|
);
|
|
2801
2709
|
}
|
|
2802
2710
|
function isV3DeployAccountTx(args) {
|
|
2803
|
-
return [
|
|
2711
|
+
return [api_exports.ETransactionVersion.V3, api_exports.ETransactionVersion.F3].includes(
|
|
2804
2712
|
args.version
|
|
2805
2713
|
);
|
|
2806
2714
|
}
|
|
@@ -3095,19 +3003,19 @@ function estimateFeeToBounds(estimate, amountOverhead = 50 /* L1_BOUND_MAX_AMOUN
|
|
|
3095
3003
|
};
|
|
3096
3004
|
}
|
|
3097
3005
|
function intDAM(dam) {
|
|
3098
|
-
if (dam ===
|
|
3099
|
-
return
|
|
3100
|
-
if (dam ===
|
|
3101
|
-
return
|
|
3006
|
+
if (dam === api_exports.EDataAvailabilityMode.L1)
|
|
3007
|
+
return api_exports.EDAMode.L1;
|
|
3008
|
+
if (dam === api_exports.EDataAvailabilityMode.L2)
|
|
3009
|
+
return api_exports.EDAMode.L2;
|
|
3102
3010
|
throw Error("EDAM conversion");
|
|
3103
3011
|
}
|
|
3104
3012
|
function toTransactionVersion(defaultVersion, providedVersion) {
|
|
3105
3013
|
const providedVersion0xs = providedVersion ? toHex(providedVersion) : void 0;
|
|
3106
3014
|
const defaultVersion0xs = toHex(defaultVersion);
|
|
3107
|
-
if (providedVersion && !Object.values(
|
|
3015
|
+
if (providedVersion && !Object.values(api_exports.ETransactionVersion).includes(providedVersion0xs)) {
|
|
3108
3016
|
throw Error(`providedVersion ${providedVersion} is not ETransactionVersion`);
|
|
3109
3017
|
}
|
|
3110
|
-
if (!Object.values(
|
|
3018
|
+
if (!Object.values(api_exports.ETransactionVersion).includes(defaultVersion0xs)) {
|
|
3111
3019
|
throw Error(`defaultVersion ${defaultVersion} is not ETransactionVersion`);
|
|
3112
3020
|
}
|
|
3113
3021
|
return providedVersion ? providedVersion0xs : defaultVersion0xs;
|
|
@@ -3116,14 +3024,14 @@ function toFeeVersion(providedVersion) {
|
|
|
3116
3024
|
if (!providedVersion)
|
|
3117
3025
|
return void 0;
|
|
3118
3026
|
const version = toHex(providedVersion);
|
|
3119
|
-
if (version ===
|
|
3120
|
-
return
|
|
3121
|
-
if (version ===
|
|
3122
|
-
return
|
|
3123
|
-
if (version ===
|
|
3124
|
-
return
|
|
3125
|
-
if (version ===
|
|
3126
|
-
return
|
|
3027
|
+
if (version === api_exports.ETransactionVersion.V0)
|
|
3028
|
+
return api_exports.ETransactionVersion.F0;
|
|
3029
|
+
if (version === api_exports.ETransactionVersion.V1)
|
|
3030
|
+
return api_exports.ETransactionVersion.F1;
|
|
3031
|
+
if (version === api_exports.ETransactionVersion.V2)
|
|
3032
|
+
return api_exports.ETransactionVersion.F2;
|
|
3033
|
+
if (version === api_exports.ETransactionVersion.V3)
|
|
3034
|
+
return api_exports.ETransactionVersion.F3;
|
|
3127
3035
|
throw Error(`toFeeVersion: ${version} is not supported`);
|
|
3128
3036
|
}
|
|
3129
3037
|
function v3Details(details) {
|
|
@@ -3131,16 +3039,16 @@ function v3Details(details) {
|
|
|
3131
3039
|
tip: details.tip || 0,
|
|
3132
3040
|
paymasterData: details.paymasterData || [],
|
|
3133
3041
|
accountDeploymentData: details.accountDeploymentData || [],
|
|
3134
|
-
nonceDataAvailabilityMode: details.nonceDataAvailabilityMode ||
|
|
3135
|
-
feeDataAvailabilityMode: details.feeDataAvailabilityMode ||
|
|
3042
|
+
nonceDataAvailabilityMode: details.nonceDataAvailabilityMode || api_exports.EDataAvailabilityMode.L1,
|
|
3043
|
+
feeDataAvailabilityMode: details.feeDataAvailabilityMode || api_exports.EDataAvailabilityMode.L1,
|
|
3136
3044
|
resourceBounds: details.resourceBounds ?? estimateFeeToBounds(ZERO)
|
|
3137
3045
|
};
|
|
3138
3046
|
}
|
|
3139
3047
|
function reduceV2(providedVersion) {
|
|
3140
|
-
if (providedVersion ===
|
|
3141
|
-
return
|
|
3142
|
-
if (providedVersion ===
|
|
3143
|
-
return
|
|
3048
|
+
if (providedVersion === api_exports.ETransactionVersion.F2)
|
|
3049
|
+
return api_exports.ETransactionVersion.F1;
|
|
3050
|
+
if (providedVersion === api_exports.ETransactionVersion.V2)
|
|
3051
|
+
return api_exports.ETransactionVersion.V1;
|
|
3144
3052
|
return providedVersion;
|
|
3145
3053
|
}
|
|
3146
3054
|
|
|
@@ -3238,9 +3146,10 @@ function parseContract(contract) {
|
|
|
3238
3146
|
return createSierraContractClass(parsedContract);
|
|
3239
3147
|
}
|
|
3240
3148
|
var getDefaultNodeUrl = (networkName, mute = false) => {
|
|
3241
|
-
if (!mute)
|
|
3149
|
+
if (!mute) {
|
|
3242
3150
|
console.warn("Using default public node url, please provide nodeUrl in provider options!");
|
|
3243
|
-
|
|
3151
|
+
}
|
|
3152
|
+
const nodes = RPC_NODES[networkName ?? "SN_SEPOLIA" /* SN_SEPOLIA */];
|
|
3244
3153
|
const randIdx = Math.floor(Math.random() * nodes.length);
|
|
3245
3154
|
return nodes[randIdx];
|
|
3246
3155
|
};
|
|
@@ -3263,10 +3172,14 @@ var Block = class {
|
|
|
3263
3172
|
tag = null;
|
|
3264
3173
|
setIdentifier(__identifier) {
|
|
3265
3174
|
if (isString(__identifier)) {
|
|
3266
|
-
if (
|
|
3175
|
+
if (isDecimalString(__identifier)) {
|
|
3176
|
+
this.number = parseInt(__identifier, 10);
|
|
3177
|
+
} else if (isHex(__identifier)) {
|
|
3267
3178
|
this.hash = __identifier;
|
|
3268
3179
|
} else if (validBlockTags.includes(__identifier)) {
|
|
3269
3180
|
this.tag = __identifier;
|
|
3181
|
+
} else {
|
|
3182
|
+
throw TypeError(`Block identifier unmanaged: ${__identifier}`);
|
|
3270
3183
|
}
|
|
3271
3184
|
} else if (isBigInt(__identifier)) {
|
|
3272
3185
|
this.hash = toHex(__identifier);
|
|
@@ -3275,6 +3188,9 @@ var Block = class {
|
|
|
3275
3188
|
} else {
|
|
3276
3189
|
this.tag = "pending" /* pending */;
|
|
3277
3190
|
}
|
|
3191
|
+
if (isNumber(this.number) && this.number < 0) {
|
|
3192
|
+
throw TypeError(`Block number (${this.number}) can't be negative`);
|
|
3193
|
+
}
|
|
3278
3194
|
}
|
|
3279
3195
|
constructor(_identifier) {
|
|
3280
3196
|
this.setIdentifier(_identifier);
|
|
@@ -3304,15 +3220,10 @@ var Block = class {
|
|
|
3304
3220
|
}
|
|
3305
3221
|
valueOf = () => this.number;
|
|
3306
3222
|
toString = () => this.hash;
|
|
3307
|
-
/* get sequencerIdentifier(): SequencerIdentifier {
|
|
3308
|
-
return this.hash !== null
|
|
3309
|
-
? { blockHash: this.hash as string }
|
|
3310
|
-
: { blockNumber: (this.number ?? this.tag) as BlockNumber };
|
|
3311
|
-
} */
|
|
3312
3223
|
};
|
|
3313
3224
|
function isV3Tx(details) {
|
|
3314
|
-
const version = details.version ? toHex(details.version) :
|
|
3315
|
-
return version ===
|
|
3225
|
+
const version = details.version ? toHex(details.version) : api_exports.ETransactionVersion.V3;
|
|
3226
|
+
return version === api_exports.ETransactionVersion.V3 || version === api_exports.ETransactionVersion.F3;
|
|
3316
3227
|
}
|
|
3317
3228
|
function isVersion(version, response) {
|
|
3318
3229
|
const [majorS, minorS] = version.split(".");
|
|
@@ -3427,10 +3338,10 @@ function buildUDCCall(payload, address) {
|
|
|
3427
3338
|
}
|
|
3428
3339
|
function getVersionsByType(versionType) {
|
|
3429
3340
|
return versionType === "fee" ? {
|
|
3430
|
-
v1:
|
|
3431
|
-
v2:
|
|
3432
|
-
v3:
|
|
3433
|
-
} : { v1:
|
|
3341
|
+
v1: api_exports.ETransactionVersion.F1,
|
|
3342
|
+
v2: api_exports.ETransactionVersion.F2,
|
|
3343
|
+
v3: api_exports.ETransactionVersion.F3
|
|
3344
|
+
} : { v1: api_exports.ETransactionVersion.V1, v2: api_exports.ETransactionVersion.V2, v3: api_exports.ETransactionVersion.V3 };
|
|
3434
3345
|
}
|
|
3435
3346
|
|
|
3436
3347
|
// src/channel/rpc_0_6.ts
|
|
@@ -3918,7 +3829,6 @@ var RpcChannel = class {
|
|
|
3918
3829
|
return {
|
|
3919
3830
|
// v0 v1 v3
|
|
3920
3831
|
type: rpcspec_0_6_exports.ETransactionType.INVOKE,
|
|
3921
|
-
// TODO: Diff between sequencer and rpc invoke type
|
|
3922
3832
|
sender_address: invocation.contractAddress,
|
|
3923
3833
|
calldata: CallData.toHex(invocation.calldata),
|
|
3924
3834
|
version: toHex(invocation.version || defaultVersions.v3),
|
|
@@ -4137,9 +4047,9 @@ var RpcChannel2 = class {
|
|
|
4137
4047
|
const block_id = new Block(blockIdentifier).identifier;
|
|
4138
4048
|
const simulationFlags = [];
|
|
4139
4049
|
if (skipValidate)
|
|
4140
|
-
simulationFlags.push(
|
|
4050
|
+
simulationFlags.push(RPCSPEC07.ESimulationFlag.SKIP_VALIDATE);
|
|
4141
4051
|
if (skipFeeCharge)
|
|
4142
|
-
simulationFlags.push(
|
|
4052
|
+
simulationFlags.push(RPCSPEC07.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
4143
4053
|
return this.fetchEndpoint("starknet_simulateTransactions", {
|
|
4144
4054
|
block_id,
|
|
4145
4055
|
transactions: invocations.map((it) => this.buildTransaction(it)),
|
|
@@ -4153,15 +4063,15 @@ var RpcChannel2 = class {
|
|
|
4153
4063
|
let isErrorState = false;
|
|
4154
4064
|
const retryInterval = options?.retryInterval ?? 5e3;
|
|
4155
4065
|
const errorStates = options?.errorStates ?? [
|
|
4156
|
-
|
|
4066
|
+
RPCSPEC07.ETransactionStatus.REJECTED
|
|
4157
4067
|
// TODO: commented out to preserve the long-standing behavior of "reverted" not being treated as an error by default
|
|
4158
4068
|
// should decide which behavior to keep in the future
|
|
4159
4069
|
// RPC.ETransactionExecutionStatus.REVERTED,
|
|
4160
4070
|
];
|
|
4161
4071
|
const successStates = options?.successStates ?? [
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4072
|
+
RPCSPEC07.ETransactionExecutionStatus.SUCCEEDED,
|
|
4073
|
+
RPCSPEC07.ETransactionStatus.ACCEPTED_ON_L2,
|
|
4074
|
+
RPCSPEC07.ETransactionStatus.ACCEPTED_ON_L1
|
|
4165
4075
|
];
|
|
4166
4076
|
let txStatus;
|
|
4167
4077
|
while (!onchain) {
|
|
@@ -4246,7 +4156,7 @@ var RpcChannel2 = class {
|
|
|
4246
4156
|
let flags = {};
|
|
4247
4157
|
if (!isVersion("0.5", await this.getSpecVersion())) {
|
|
4248
4158
|
flags = {
|
|
4249
|
-
simulation_flags: skipValidate ? [
|
|
4159
|
+
simulation_flags: skipValidate ? [RPCSPEC07.ESimulationFlag.SKIP_VALIDATE] : []
|
|
4250
4160
|
};
|
|
4251
4161
|
}
|
|
4252
4162
|
return this.fetchEndpoint("starknet_estimateFee", {
|
|
@@ -4262,9 +4172,9 @@ var RpcChannel2 = class {
|
|
|
4262
4172
|
invoke_transaction: {
|
|
4263
4173
|
sender_address: functionInvocation.contractAddress,
|
|
4264
4174
|
calldata: CallData.toHex(functionInvocation.calldata),
|
|
4265
|
-
type:
|
|
4175
|
+
type: RPCSPEC07.ETransactionType.INVOKE,
|
|
4266
4176
|
max_fee: toHex(details.maxFee || 0),
|
|
4267
|
-
version:
|
|
4177
|
+
version: RPCSPEC07.ETransactionVersion.V1,
|
|
4268
4178
|
signature: signatureToHexArray(functionInvocation.signature),
|
|
4269
4179
|
nonce: toHex(details.nonce)
|
|
4270
4180
|
}
|
|
@@ -4272,10 +4182,10 @@ var RpcChannel2 = class {
|
|
|
4272
4182
|
} else {
|
|
4273
4183
|
promise = this.fetchEndpoint("starknet_addInvokeTransaction", {
|
|
4274
4184
|
invoke_transaction: {
|
|
4275
|
-
type:
|
|
4185
|
+
type: RPCSPEC07.ETransactionType.INVOKE,
|
|
4276
4186
|
sender_address: functionInvocation.contractAddress,
|
|
4277
4187
|
calldata: CallData.toHex(functionInvocation.calldata),
|
|
4278
|
-
version:
|
|
4188
|
+
version: RPCSPEC07.ETransactionVersion.V3,
|
|
4279
4189
|
signature: signatureToHexArray(functionInvocation.signature),
|
|
4280
4190
|
nonce: toHex(details.nonce),
|
|
4281
4191
|
resource_bounds: details.resourceBounds,
|
|
@@ -4294,13 +4204,13 @@ var RpcChannel2 = class {
|
|
|
4294
4204
|
if (!isSierra(contract) && !isV3Tx(details)) {
|
|
4295
4205
|
promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
|
|
4296
4206
|
declare_transaction: {
|
|
4297
|
-
type:
|
|
4207
|
+
type: RPCSPEC07.ETransactionType.DECLARE,
|
|
4298
4208
|
contract_class: {
|
|
4299
4209
|
program: contract.program,
|
|
4300
4210
|
entry_points_by_type: contract.entry_points_by_type,
|
|
4301
4211
|
abi: contract.abi
|
|
4302
4212
|
},
|
|
4303
|
-
version:
|
|
4213
|
+
version: RPCSPEC07.ETransactionVersion.V1,
|
|
4304
4214
|
max_fee: toHex(details.maxFee || 0),
|
|
4305
4215
|
signature: signatureToHexArray(signature),
|
|
4306
4216
|
sender_address: senderAddress,
|
|
@@ -4310,7 +4220,7 @@ var RpcChannel2 = class {
|
|
|
4310
4220
|
} else if (isSierra(contract) && !isV3Tx(details)) {
|
|
4311
4221
|
promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
|
|
4312
4222
|
declare_transaction: {
|
|
4313
|
-
type:
|
|
4223
|
+
type: RPCSPEC07.ETransactionType.DECLARE,
|
|
4314
4224
|
contract_class: {
|
|
4315
4225
|
sierra_program: decompressProgram(contract.sierra_program),
|
|
4316
4226
|
contract_class_version: contract.contract_class_version,
|
|
@@ -4318,7 +4228,7 @@ var RpcChannel2 = class {
|
|
|
4318
4228
|
abi: contract.abi
|
|
4319
4229
|
},
|
|
4320
4230
|
compiled_class_hash: compiledClassHash || "",
|
|
4321
|
-
version:
|
|
4231
|
+
version: RPCSPEC07.ETransactionVersion.V2,
|
|
4322
4232
|
max_fee: toHex(details.maxFee || 0),
|
|
4323
4233
|
signature: signatureToHexArray(signature),
|
|
4324
4234
|
sender_address: senderAddress,
|
|
@@ -4328,10 +4238,10 @@ var RpcChannel2 = class {
|
|
|
4328
4238
|
} else if (isSierra(contract) && isV3Tx(details)) {
|
|
4329
4239
|
promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
|
|
4330
4240
|
declare_transaction: {
|
|
4331
|
-
type:
|
|
4241
|
+
type: RPCSPEC07.ETransactionType.DECLARE,
|
|
4332
4242
|
sender_address: senderAddress,
|
|
4333
4243
|
compiled_class_hash: compiledClassHash || "",
|
|
4334
|
-
version:
|
|
4244
|
+
version: RPCSPEC07.ETransactionVersion.V3,
|
|
4335
4245
|
signature: signatureToHexArray(signature),
|
|
4336
4246
|
nonce: toHex(details.nonce),
|
|
4337
4247
|
contract_class: {
|
|
@@ -4361,9 +4271,9 @@ var RpcChannel2 = class {
|
|
|
4361
4271
|
constructor_calldata: CallData.toHex(constructorCalldata || []),
|
|
4362
4272
|
class_hash: toHex(classHash),
|
|
4363
4273
|
contract_address_salt: toHex(addressSalt || 0),
|
|
4364
|
-
type:
|
|
4274
|
+
type: RPCSPEC07.ETransactionType.DEPLOY_ACCOUNT,
|
|
4365
4275
|
max_fee: toHex(details.maxFee || 0),
|
|
4366
|
-
version:
|
|
4276
|
+
version: RPCSPEC07.ETransactionVersion.V1,
|
|
4367
4277
|
signature: signatureToHexArray(signature),
|
|
4368
4278
|
nonce: toHex(details.nonce)
|
|
4369
4279
|
}
|
|
@@ -4371,8 +4281,8 @@ var RpcChannel2 = class {
|
|
|
4371
4281
|
} else {
|
|
4372
4282
|
promise = this.fetchEndpoint("starknet_addDeployAccountTransaction", {
|
|
4373
4283
|
deploy_account_transaction: {
|
|
4374
|
-
type:
|
|
4375
|
-
version:
|
|
4284
|
+
type: RPCSPEC07.ETransactionType.DEPLOY_ACCOUNT,
|
|
4285
|
+
version: RPCSPEC07.ETransactionVersion.V3,
|
|
4376
4286
|
signature: signatureToHexArray(signature),
|
|
4377
4287
|
nonce: toHex(details.nonce),
|
|
4378
4288
|
contract_address_salt: toHex(addressSalt || 0),
|
|
@@ -4455,8 +4365,7 @@ var RpcChannel2 = class {
|
|
|
4455
4365
|
if (invocation.type === "INVOKE_FUNCTION" /* INVOKE */) {
|
|
4456
4366
|
return {
|
|
4457
4367
|
// v0 v1 v3
|
|
4458
|
-
type:
|
|
4459
|
-
// TODO: Diff between sequencer and rpc invoke type
|
|
4368
|
+
type: RPCSPEC07.ETransactionType.INVOKE,
|
|
4460
4369
|
sender_address: invocation.contractAddress,
|
|
4461
4370
|
calldata: CallData.toHex(invocation.calldata),
|
|
4462
4371
|
version: toHex(invocation.version || defaultVersions.v3),
|
|
@@ -4572,6 +4481,9 @@ var RPCResponseParser = class {
|
|
|
4572
4481
|
abi: isString(res.abi) ? JSON.parse(res.abi) : res.abi
|
|
4573
4482
|
};
|
|
4574
4483
|
}
|
|
4484
|
+
parseL1GasPriceResponse(res) {
|
|
4485
|
+
return res.l1_gas_price.price_in_wei;
|
|
4486
|
+
}
|
|
4575
4487
|
};
|
|
4576
4488
|
|
|
4577
4489
|
// src/utils/transactionReceipt.ts
|
|
@@ -4670,6 +4582,9 @@ var RpcProvider = class {
|
|
|
4670
4582
|
async getBlockWithTxs(blockIdentifier) {
|
|
4671
4583
|
return this.channel.getBlockWithTxs(blockIdentifier);
|
|
4672
4584
|
}
|
|
4585
|
+
async getL1GasPrice(blockIdentifier) {
|
|
4586
|
+
return this.channel.getBlockWithTxHashes(blockIdentifier).then(this.responseParser.parseL1GasPriceResponse);
|
|
4587
|
+
}
|
|
4673
4588
|
async getBlockWithReceipts(blockIdentifier) {
|
|
4674
4589
|
if (this.channel instanceof rpc_0_6_exports.RpcChannel)
|
|
4675
4590
|
throw new LibraryError("Unsupported method for RPC version");
|
|
@@ -5701,7 +5616,7 @@ var Signer = class {
|
|
|
5701
5616
|
async signTransaction(transactions, details) {
|
|
5702
5617
|
const compiledCalldata = getExecuteCalldata(transactions, details.cairoVersion);
|
|
5703
5618
|
let msgHash;
|
|
5704
|
-
if (Object.values(
|
|
5619
|
+
if (Object.values(api_exports.ETransactionVersion2).includes(details.version)) {
|
|
5705
5620
|
const det = details;
|
|
5706
5621
|
msgHash = calculateInvokeTransactionHash2({
|
|
5707
5622
|
...det,
|
|
@@ -5709,7 +5624,7 @@ var Signer = class {
|
|
|
5709
5624
|
compiledCalldata,
|
|
5710
5625
|
version: det.version
|
|
5711
5626
|
});
|
|
5712
|
-
} else if (Object.values(
|
|
5627
|
+
} else if (Object.values(api_exports.ETransactionVersion3).includes(details.version)) {
|
|
5713
5628
|
const det = details;
|
|
5714
5629
|
msgHash = calculateInvokeTransactionHash2({
|
|
5715
5630
|
...det,
|
|
@@ -5727,7 +5642,7 @@ var Signer = class {
|
|
|
5727
5642
|
async signDeployAccountTransaction(details) {
|
|
5728
5643
|
const compiledConstructorCalldata = CallData.compile(details.constructorCalldata);
|
|
5729
5644
|
let msgHash;
|
|
5730
|
-
if (Object.values(
|
|
5645
|
+
if (Object.values(api_exports.ETransactionVersion2).includes(details.version)) {
|
|
5731
5646
|
const det = details;
|
|
5732
5647
|
msgHash = calculateDeployAccountTransactionHash3({
|
|
5733
5648
|
...det,
|
|
@@ -5735,7 +5650,7 @@ var Signer = class {
|
|
|
5735
5650
|
constructorCalldata: compiledConstructorCalldata,
|
|
5736
5651
|
version: det.version
|
|
5737
5652
|
});
|
|
5738
|
-
} else if (Object.values(
|
|
5653
|
+
} else if (Object.values(api_exports.ETransactionVersion3).includes(details.version)) {
|
|
5739
5654
|
const det = details;
|
|
5740
5655
|
msgHash = calculateDeployAccountTransactionHash3({
|
|
5741
5656
|
...det,
|
|
@@ -5752,13 +5667,13 @@ var Signer = class {
|
|
|
5752
5667
|
}
|
|
5753
5668
|
async signDeclareTransaction(details) {
|
|
5754
5669
|
let msgHash;
|
|
5755
|
-
if (Object.values(
|
|
5670
|
+
if (Object.values(api_exports.ETransactionVersion2).includes(details.version)) {
|
|
5756
5671
|
const det = details;
|
|
5757
5672
|
msgHash = calculateDeclareTransactionHash3({
|
|
5758
5673
|
...det,
|
|
5759
5674
|
version: det.version
|
|
5760
5675
|
});
|
|
5761
|
-
} else if (Object.values(
|
|
5676
|
+
} else if (Object.values(api_exports.ETransactionVersion3).includes(details.version)) {
|
|
5762
5677
|
const det = details;
|
|
5763
5678
|
msgHash = calculateDeclareTransactionHash3({
|
|
5764
5679
|
...det,
|
|
@@ -5825,7 +5740,7 @@ var EthSigner = class {
|
|
|
5825
5740
|
async signTransaction(transactions, details) {
|
|
5826
5741
|
const compiledCalldata = getExecuteCalldata(transactions, details.cairoVersion);
|
|
5827
5742
|
let msgHash;
|
|
5828
|
-
if (Object.values(
|
|
5743
|
+
if (Object.values(api_exports.ETransactionVersion2).includes(details.version)) {
|
|
5829
5744
|
const det = details;
|
|
5830
5745
|
msgHash = calculateInvokeTransactionHash2({
|
|
5831
5746
|
...det,
|
|
@@ -5833,7 +5748,7 @@ var EthSigner = class {
|
|
|
5833
5748
|
compiledCalldata,
|
|
5834
5749
|
version: det.version
|
|
5835
5750
|
});
|
|
5836
|
-
} else if (Object.values(
|
|
5751
|
+
} else if (Object.values(api_exports.ETransactionVersion3).includes(details.version)) {
|
|
5837
5752
|
const det = details;
|
|
5838
5753
|
msgHash = calculateInvokeTransactionHash2({
|
|
5839
5754
|
...det,
|
|
@@ -5855,7 +5770,7 @@ var EthSigner = class {
|
|
|
5855
5770
|
async signDeployAccountTransaction(details) {
|
|
5856
5771
|
const compiledConstructorCalldata = CallData.compile(details.constructorCalldata);
|
|
5857
5772
|
let msgHash;
|
|
5858
|
-
if (Object.values(
|
|
5773
|
+
if (Object.values(api_exports.ETransactionVersion2).includes(details.version)) {
|
|
5859
5774
|
const det = details;
|
|
5860
5775
|
msgHash = calculateDeployAccountTransactionHash3({
|
|
5861
5776
|
...det,
|
|
@@ -5863,7 +5778,7 @@ var EthSigner = class {
|
|
|
5863
5778
|
constructorCalldata: compiledConstructorCalldata,
|
|
5864
5779
|
version: det.version
|
|
5865
5780
|
});
|
|
5866
|
-
} else if (Object.values(
|
|
5781
|
+
} else if (Object.values(api_exports.ETransactionVersion3).includes(details.version)) {
|
|
5867
5782
|
const det = details;
|
|
5868
5783
|
msgHash = calculateDeployAccountTransactionHash3({
|
|
5869
5784
|
...det,
|
|
@@ -5884,13 +5799,13 @@ var EthSigner = class {
|
|
|
5884
5799
|
}
|
|
5885
5800
|
async signDeclareTransaction(details) {
|
|
5886
5801
|
let msgHash;
|
|
5887
|
-
if (Object.values(
|
|
5802
|
+
if (Object.values(api_exports.ETransactionVersion2).includes(details.version)) {
|
|
5888
5803
|
const det = details;
|
|
5889
5804
|
msgHash = calculateDeclareTransactionHash3({
|
|
5890
5805
|
...det,
|
|
5891
5806
|
version: det.version
|
|
5892
5807
|
});
|
|
5893
|
-
} else if (Object.values(
|
|
5808
|
+
} else if (Object.values(api_exports.ETransactionVersion3).includes(details.version)) {
|
|
5894
5809
|
const det = details;
|
|
5895
5810
|
msgHash = calculateDeclareTransactionHash3({
|
|
5896
5811
|
...det,
|
|
@@ -5954,7 +5869,7 @@ var Account = class extends RpcProvider2 {
|
|
|
5954
5869
|
address;
|
|
5955
5870
|
cairoVersion;
|
|
5956
5871
|
transactionVersion;
|
|
5957
|
-
constructor(providerOrOptions, address, pkOrSigner, cairoVersion, transactionVersion =
|
|
5872
|
+
constructor(providerOrOptions, address, pkOrSigner, cairoVersion, transactionVersion = api_exports.ETransactionVersion.V2) {
|
|
5958
5873
|
super(providerOrOptions);
|
|
5959
5874
|
this.address = address.toLowerCase();
|
|
5960
5875
|
this.signer = isString(pkOrSigner) || pkOrSigner instanceof Uint8Array ? new Signer(pkOrSigner) : pkOrSigner;
|
|
@@ -5965,11 +5880,11 @@ var Account = class extends RpcProvider2 {
|
|
|
5965
5880
|
}
|
|
5966
5881
|
// provided version or contract based preferred transactionVersion
|
|
5967
5882
|
getPreferredVersion(type12, type3) {
|
|
5968
|
-
if (this.transactionVersion ===
|
|
5883
|
+
if (this.transactionVersion === api_exports.ETransactionVersion.V3)
|
|
5969
5884
|
return type3;
|
|
5970
|
-
if (this.transactionVersion ===
|
|
5885
|
+
if (this.transactionVersion === api_exports.ETransactionVersion.V2)
|
|
5971
5886
|
return type12;
|
|
5972
|
-
return
|
|
5887
|
+
return api_exports.ETransactionVersion.V3;
|
|
5973
5888
|
}
|
|
5974
5889
|
async getNonce(blockIdentifier) {
|
|
5975
5890
|
return super.getNonceForAddress(this.address, blockIdentifier);
|
|
@@ -6005,7 +5920,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6005
5920
|
const transactions = Array.isArray(calls) ? calls : [calls];
|
|
6006
5921
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
6007
5922
|
const version = toTransactionVersion(
|
|
6008
|
-
this.getPreferredVersion(
|
|
5923
|
+
this.getPreferredVersion(api_exports.ETransactionVersion.F1, api_exports.ETransactionVersion.F3),
|
|
6009
5924
|
toFeeVersion(providedVersion)
|
|
6010
5925
|
);
|
|
6011
5926
|
const chainId = await this.getChainId();
|
|
@@ -6036,7 +5951,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6036
5951
|
} = details;
|
|
6037
5952
|
const nonce = toBigInt(providedNonce ?? await this.getNonce());
|
|
6038
5953
|
const version = toTransactionVersion(
|
|
6039
|
-
!isSierra(payload.contract) ?
|
|
5954
|
+
!isSierra(payload.contract) ? api_exports.ETransactionVersion.F1 : this.getPreferredVersion(api_exports.ETransactionVersion.F2, api_exports.ETransactionVersion.F3),
|
|
6040
5955
|
toFeeVersion(providedVersion)
|
|
6041
5956
|
);
|
|
6042
5957
|
const chainId = await this.getChainId();
|
|
@@ -6066,7 +5981,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6066
5981
|
}, details = {}) {
|
|
6067
5982
|
const { blockIdentifier, version: providedVersion, skipValidate = true } = details;
|
|
6068
5983
|
const version = toTransactionVersion(
|
|
6069
|
-
this.getPreferredVersion(
|
|
5984
|
+
this.getPreferredVersion(api_exports.ETransactionVersion.F1, api_exports.ETransactionVersion.F3),
|
|
6070
5985
|
toFeeVersion(providedVersion)
|
|
6071
5986
|
);
|
|
6072
5987
|
const nonce = ZERO;
|
|
@@ -6102,10 +6017,10 @@ var Account = class extends RpcProvider2 {
|
|
|
6102
6017
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
6103
6018
|
...v3Details(details),
|
|
6104
6019
|
versions: [
|
|
6105
|
-
|
|
6020
|
+
api_exports.ETransactionVersion.F1,
|
|
6106
6021
|
// non-sierra
|
|
6107
6022
|
toTransactionVersion(
|
|
6108
|
-
this.getPreferredVersion(
|
|
6023
|
+
this.getPreferredVersion(api_exports.ETransactionVersion.F2, api_exports.ETransactionVersion.F3),
|
|
6109
6024
|
version
|
|
6110
6025
|
)
|
|
6111
6026
|
// sierra
|
|
@@ -6124,10 +6039,10 @@ var Account = class extends RpcProvider2 {
|
|
|
6124
6039
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|
|
6125
6040
|
...v3Details(details),
|
|
6126
6041
|
versions: [
|
|
6127
|
-
|
|
6042
|
+
api_exports.ETransactionVersion.V1,
|
|
6128
6043
|
// non-sierra
|
|
6129
6044
|
toTransactionVersion(
|
|
6130
|
-
this.getPreferredVersion(
|
|
6045
|
+
this.getPreferredVersion(api_exports.ETransactionVersion.V2, api_exports.ETransactionVersion.V3),
|
|
6131
6046
|
version
|
|
6132
6047
|
)
|
|
6133
6048
|
],
|
|
@@ -6146,7 +6061,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6146
6061
|
const calls = Array.isArray(transactions) ? transactions : [transactions];
|
|
6147
6062
|
const nonce = toBigInt(details.nonce ?? await this.getNonce());
|
|
6148
6063
|
const version = toTransactionVersion(
|
|
6149
|
-
this.getPreferredVersion(
|
|
6064
|
+
this.getPreferredVersion(api_exports.ETransactionVersion.V1, api_exports.ETransactionVersion.V3),
|
|
6150
6065
|
// TODO: does this depend on cairo version ?
|
|
6151
6066
|
details.version
|
|
6152
6067
|
);
|
|
@@ -6204,7 +6119,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6204
6119
|
const declareContractPayload = extractContractHashes(payload);
|
|
6205
6120
|
const { nonce, version: providedVersion } = details;
|
|
6206
6121
|
const version = toTransactionVersion(
|
|
6207
|
-
!isSierra(payload.contract) ?
|
|
6122
|
+
!isSierra(payload.contract) ? api_exports.ETransactionVersion.V1 : this.getPreferredVersion(api_exports.ETransactionVersion.V2, api_exports.ETransactionVersion.V3),
|
|
6208
6123
|
providedVersion
|
|
6209
6124
|
);
|
|
6210
6125
|
const estimate = await this.getUniversalSuggestedFee(
|
|
@@ -6268,7 +6183,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6268
6183
|
contractAddress: providedContractAddress
|
|
6269
6184
|
}, details = {}) {
|
|
6270
6185
|
const version = toTransactionVersion(
|
|
6271
|
-
this.getPreferredVersion(
|
|
6186
|
+
this.getPreferredVersion(api_exports.ETransactionVersion.V1, api_exports.ETransactionVersion.V3),
|
|
6272
6187
|
details.version
|
|
6273
6188
|
);
|
|
6274
6189
|
const nonce = ZERO;
|
|
@@ -6350,7 +6265,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6350
6265
|
async getUniversalSuggestedFee(version, { type, payload }, details) {
|
|
6351
6266
|
let maxFee = 0;
|
|
6352
6267
|
let resourceBounds = estimateFeeToBounds(ZERO);
|
|
6353
|
-
if (version ===
|
|
6268
|
+
if (version === api_exports.ETransactionVersion.V3) {
|
|
6354
6269
|
resourceBounds = details.resourceBounds ?? (await this.getSuggestedFee({ type, payload }, details)).resourceBounds;
|
|
6355
6270
|
} else {
|
|
6356
6271
|
maxFee = details.maxFee ?? (await this.getSuggestedFee({ type, payload }, details)).suggestedMaxFee;
|
|
@@ -6403,7 +6318,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6403
6318
|
async buildDeclarePayload(payload, details) {
|
|
6404
6319
|
const { classHash, contract, compiledClassHash } = extractContractHashes(payload);
|
|
6405
6320
|
const compressedCompiledContract = parseContract(contract);
|
|
6406
|
-
if (typeof compiledClassHash === "undefined" && (details.version ===
|
|
6321
|
+
if (typeof compiledClassHash === "undefined" && (details.version === api_exports.ETransactionVersion3.F3 || details.version === api_exports.ETransactionVersion3.V3)) {
|
|
6407
6322
|
throw Error("V3 Transaction work with Cairo1 Contracts and require compiledClassHash");
|
|
6408
6323
|
}
|
|
6409
6324
|
const signature = !details.skipValidate ? await this.signer.signDeclareTransaction({
|
|
@@ -6556,7 +6471,6 @@ var AccountInterface = class extends ProviderInterface {
|
|
|
6556
6471
|
var connect_exports = {};
|
|
6557
6472
|
__export(connect_exports, {
|
|
6558
6473
|
addDeclareTransaction: () => addDeclareTransaction,
|
|
6559
|
-
addDeployAccountTransaction: () => addDeployAccountTransaction,
|
|
6560
6474
|
addInvokeTransaction: () => addInvokeTransaction,
|
|
6561
6475
|
addStarknetChain: () => addStarknetChain,
|
|
6562
6476
|
deploymentData: () => deploymentData,
|
|
@@ -6570,11 +6484,11 @@ __export(connect_exports, {
|
|
|
6570
6484
|
switchStarknetChain: () => switchStarknetChain,
|
|
6571
6485
|
watchAsset: () => watchAsset
|
|
6572
6486
|
});
|
|
6573
|
-
function requestAccounts(swo,
|
|
6487
|
+
function requestAccounts(swo, silent_mode = false) {
|
|
6574
6488
|
return swo.request({
|
|
6575
6489
|
type: "wallet_requestAccounts",
|
|
6576
6490
|
params: {
|
|
6577
|
-
|
|
6491
|
+
silent_mode
|
|
6578
6492
|
}
|
|
6579
6493
|
});
|
|
6580
6494
|
}
|
|
@@ -6609,30 +6523,24 @@ function deploymentData(swo) {
|
|
|
6609
6523
|
}
|
|
6610
6524
|
function addInvokeTransaction(swo, params) {
|
|
6611
6525
|
return swo.request({
|
|
6612
|
-
type: "
|
|
6526
|
+
type: "wallet_addInvokeTransaction",
|
|
6613
6527
|
params
|
|
6614
6528
|
});
|
|
6615
6529
|
}
|
|
6616
6530
|
function addDeclareTransaction(swo, params) {
|
|
6617
6531
|
return swo.request({
|
|
6618
|
-
type: "
|
|
6619
|
-
params
|
|
6620
|
-
});
|
|
6621
|
-
}
|
|
6622
|
-
function addDeployAccountTransaction(swo, params) {
|
|
6623
|
-
return swo.request({
|
|
6624
|
-
type: "starknet_addDeployAccountTransaction",
|
|
6532
|
+
type: "wallet_addDeclareTransaction",
|
|
6625
6533
|
params
|
|
6626
6534
|
});
|
|
6627
6535
|
}
|
|
6628
6536
|
function signMessage(swo, typedData) {
|
|
6629
6537
|
return swo.request({
|
|
6630
|
-
type: "
|
|
6538
|
+
type: "wallet_signTypedData",
|
|
6631
6539
|
params: typedData
|
|
6632
6540
|
});
|
|
6633
6541
|
}
|
|
6634
6542
|
function supportedSpecs(swo) {
|
|
6635
|
-
return swo.request({ type: "
|
|
6543
|
+
return swo.request({ type: "wallet_supportedSpecs" });
|
|
6636
6544
|
}
|
|
6637
6545
|
function onAccountChange(swo, callback) {
|
|
6638
6546
|
swo.on("accountsChanged", callback);
|
|
@@ -6661,7 +6569,7 @@ var WalletAccount = class extends Account {
|
|
|
6661
6569
|
walletProvider.request({
|
|
6662
6570
|
type: "wallet_requestAccounts",
|
|
6663
6571
|
params: {
|
|
6664
|
-
|
|
6572
|
+
silent_mode: false
|
|
6665
6573
|
}
|
|
6666
6574
|
}).then((res) => {
|
|
6667
6575
|
this.address = res[0].toLowerCase();
|
|
@@ -6702,7 +6610,7 @@ var WalletAccount = class extends Account {
|
|
|
6702
6610
|
const { contractAddress, entrypoint, calldata } = it;
|
|
6703
6611
|
return {
|
|
6704
6612
|
contract_address: contractAddress,
|
|
6705
|
-
entrypoint,
|
|
6613
|
+
entry_point: entrypoint,
|
|
6706
6614
|
calldata
|
|
6707
6615
|
};
|
|
6708
6616
|
});
|
|
@@ -6735,14 +6643,6 @@ var WalletAccount = class extends Account {
|
|
|
6735
6643
|
contract_address: addresses
|
|
6736
6644
|
};
|
|
6737
6645
|
}
|
|
6738
|
-
deployAccount(payload) {
|
|
6739
|
-
const params = {
|
|
6740
|
-
contract_address_salt: payload.addressSalt?.toString() || "0",
|
|
6741
|
-
constructor_calldata: payload.constructorCalldata ? CallData.compile(payload.constructorCalldata) : [],
|
|
6742
|
-
class_hash: payload.classHash
|
|
6743
|
-
};
|
|
6744
|
-
return addDeployAccountTransaction(this.walletProvider, params);
|
|
6745
|
-
}
|
|
6746
6646
|
signMessage(typedData) {
|
|
6747
6647
|
return signMessage(this.walletProvider, typedData);
|
|
6748
6648
|
}
|
|
@@ -7277,6 +7177,7 @@ export {
|
|
|
7277
7177
|
merkle_exports as merkle,
|
|
7278
7178
|
num_exports as num,
|
|
7279
7179
|
number,
|
|
7180
|
+
parseCalldataField,
|
|
7280
7181
|
parseUDCEvent,
|
|
7281
7182
|
provider_exports as provider,
|
|
7282
7183
|
selector_exports as selector,
|