starknet 10.0.4 → 10.1.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 +6 -0
- package/dist/index.d.ts +222 -209
- package/dist/index.global.js +133 -30
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -99,12 +99,13 @@ __export(index_exports, {
|
|
|
99
99
|
Provider: () => RpcProvider,
|
|
100
100
|
ProviderInterface: () => ProviderInterface,
|
|
101
101
|
RPC: () => api_exports,
|
|
102
|
-
|
|
102
|
+
RPC0102: () => rpc_0_10_2_exports,
|
|
103
|
+
RPC0103: () => rpc_0_10_3_exports,
|
|
103
104
|
RPC09: () => rpc_0_9_0_exports,
|
|
104
105
|
RPCResponseParser: () => RPCResponseParser,
|
|
105
106
|
ReceiptTx: () => ReceiptTx,
|
|
106
107
|
ResponseParser: () => ResponseParser,
|
|
107
|
-
RpcChannel: () =>
|
|
108
|
+
RpcChannel: () => RpcChannel3,
|
|
108
109
|
RpcError: () => RpcError,
|
|
109
110
|
RpcProvider: () => RpcProvider,
|
|
110
111
|
Signer: () => Signer,
|
|
@@ -250,8 +251,8 @@ __export(constants_exports, {
|
|
|
250
251
|
var api_exports = {};
|
|
251
252
|
__export(api_exports, {
|
|
252
253
|
JRPC: () => jsonrpc_exports,
|
|
253
|
-
PAYMASTER_API: () =>
|
|
254
|
-
|
|
254
|
+
PAYMASTER_API: () => import_starknet_types_0103.PAYMASTER_API,
|
|
255
|
+
RPCSPEC0103: () => RPCSPEC0103,
|
|
255
256
|
RPCSPEC09: () => RPCSPEC09
|
|
256
257
|
});
|
|
257
258
|
|
|
@@ -260,12 +261,12 @@ var jsonrpc_exports = {};
|
|
|
260
261
|
|
|
261
262
|
// src/types/api/index.ts
|
|
262
263
|
var RPCSPEC09 = __toESM(require("@starknet-io/starknet-types-09"));
|
|
263
|
-
var
|
|
264
|
-
var
|
|
264
|
+
var RPCSPEC0103 = __toESM(require("@starknet-io/starknet-types-0103"));
|
|
265
|
+
var import_starknet_types_0103 = require("@starknet-io/starknet-types-0103");
|
|
265
266
|
|
|
266
267
|
// src/types/api/rpc.ts
|
|
267
268
|
var rpc_exports = {};
|
|
268
|
-
__reExport(rpc_exports, require("@starknet-io/starknet-types-
|
|
269
|
+
__reExport(rpc_exports, require("@starknet-io/starknet-types-0103"));
|
|
269
270
|
|
|
270
271
|
// src/types/api/index.ts
|
|
271
272
|
__reExport(api_exports, rpc_exports);
|
|
@@ -274,19 +275,19 @@ __reExport(api_exports, rpc_exports);
|
|
|
274
275
|
var { ETransactionVersion } = RPCSPEC09;
|
|
275
276
|
var { ETransactionVersion2 } = RPCSPEC09;
|
|
276
277
|
var { ETransactionVersion3 } = RPCSPEC09;
|
|
277
|
-
var { EDataAvailabilityMode } =
|
|
278
|
-
var { EDAMode } =
|
|
278
|
+
var { EDataAvailabilityMode } = RPCSPEC0103;
|
|
279
|
+
var { EDAMode } = RPCSPEC0103;
|
|
279
280
|
function isRPC08Plus_ResourceBounds(entry) {
|
|
280
281
|
return "l1_data_gas" in entry;
|
|
281
282
|
}
|
|
282
283
|
function isRPC08Plus_ResourceBoundsBN(entry) {
|
|
283
284
|
return "l1_data_gas" in entry;
|
|
284
285
|
}
|
|
285
|
-
var { ETxnResponseFlag } =
|
|
286
|
-
var { ETraceFlag } =
|
|
287
|
-
var { ESubscriptionTag } =
|
|
288
|
-
var { ETransactionStatus } =
|
|
289
|
-
var { ETransactionExecutionStatus } =
|
|
286
|
+
var { ETxnResponseFlag } = RPCSPEC0103;
|
|
287
|
+
var { ETraceFlag } = RPCSPEC0103;
|
|
288
|
+
var { ESubscriptionTag } = RPCSPEC0103;
|
|
289
|
+
var { ETransactionStatus } = RPCSPEC0103;
|
|
290
|
+
var { ETransactionExecutionStatus } = RPCSPEC0103;
|
|
290
291
|
var { ETransactionType: TransactionType } = RPCSPEC09;
|
|
291
292
|
var { EBlockStatus: BlockStatus } = RPCSPEC09;
|
|
292
293
|
var { ETransactionFinalityStatus: TransactionFinalityStatus } = RPCSPEC09;
|
|
@@ -501,9 +502,11 @@ var _SupportedRpcVersion = {
|
|
|
501
502
|
"0.9.0": "0.9.0",
|
|
502
503
|
"0.10.0": "0.10.0",
|
|
503
504
|
"0.10.2": "0.10.2",
|
|
505
|
+
"0.10.3": "0.10.3",
|
|
504
506
|
v0_9_0: "0.9.0",
|
|
505
507
|
v0_10_0: "0.10.0",
|
|
506
|
-
v0_10_2: "0.10.2"
|
|
508
|
+
v0_10_2: "0.10.2",
|
|
509
|
+
v0_10_3: "0.10.3"
|
|
507
510
|
};
|
|
508
511
|
var DEFAULT_GLOBAL_CONFIG = {
|
|
509
512
|
rpcVersion: "0.10.0",
|
|
@@ -6729,6 +6732,7 @@ var rpc_0_10_2_exports = {};
|
|
|
6729
6732
|
__export(rpc_0_10_2_exports, {
|
|
6730
6733
|
RpcChannel: () => RpcChannel2
|
|
6731
6734
|
});
|
|
6735
|
+
var RPC = __toESM(require("@starknet-io/starknet-types-0101"));
|
|
6732
6736
|
var RpcChannel2 = class {
|
|
6733
6737
|
id = "RPC0.10.2";
|
|
6734
6738
|
/**
|
|
@@ -6948,7 +6952,7 @@ var RpcChannel2 = class {
|
|
|
6948
6952
|
*/
|
|
6949
6953
|
getBlockWithTxs(blockIdentifier = this.blockIdentifier, options) {
|
|
6950
6954
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6951
|
-
const response_flags = options?.includeProofFacts ? [
|
|
6955
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
6952
6956
|
return this.fetchEndpoint("starknet_getBlockWithTxs", {
|
|
6953
6957
|
block_id,
|
|
6954
6958
|
...response_flags && { response_flags }
|
|
@@ -6962,7 +6966,7 @@ var RpcChannel2 = class {
|
|
|
6962
6966
|
*/
|
|
6963
6967
|
getBlockWithReceipts(blockIdentifier = this.blockIdentifier, options) {
|
|
6964
6968
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6965
|
-
const response_flags = options?.includeProofFacts ? [
|
|
6969
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
6966
6970
|
return this.fetchEndpoint("starknet_getBlockWithReceipts", {
|
|
6967
6971
|
block_id,
|
|
6968
6972
|
...response_flags && { response_flags }
|
|
@@ -6985,7 +6989,7 @@ var RpcChannel2 = class {
|
|
|
6985
6989
|
*/
|
|
6986
6990
|
getBlockTransactionsTraces(blockIdentifier = this.blockIdentifier, options) {
|
|
6987
6991
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6988
|
-
const trace_flags = options?.returnInitialReads ? [
|
|
6992
|
+
const trace_flags = options?.returnInitialReads ? [RPC.ETraceFlag.RETURN_INITIAL_READS] : void 0;
|
|
6989
6993
|
return this.fetchEndpoint("starknet_traceBlockTransactions", {
|
|
6990
6994
|
block_id,
|
|
6991
6995
|
...trace_flags && { trace_flags }
|
|
@@ -7003,7 +7007,7 @@ var RpcChannel2 = class {
|
|
|
7003
7007
|
*/
|
|
7004
7008
|
getTransactionByHash(txHash, options) {
|
|
7005
7009
|
const transaction_hash = toHex(txHash);
|
|
7006
|
-
const response_flags = options?.includeProofFacts ? [
|
|
7010
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
7007
7011
|
return this.fetchEndpoint("starknet_getTransactionByHash", {
|
|
7008
7012
|
transaction_hash,
|
|
7009
7013
|
...response_flags && { response_flags }
|
|
@@ -7018,7 +7022,7 @@ var RpcChannel2 = class {
|
|
|
7018
7022
|
*/
|
|
7019
7023
|
getTransactionByBlockIdAndIndex(blockIdentifier, index, options) {
|
|
7020
7024
|
const block_id = new Block(blockIdentifier).identifier;
|
|
7021
|
-
const response_flags = options?.includeProofFacts ? [
|
|
7025
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
7022
7026
|
return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex", {
|
|
7023
7027
|
block_id,
|
|
7024
7028
|
index,
|
|
@@ -7059,9 +7063,9 @@ var RpcChannel2 = class {
|
|
|
7059
7063
|
} = simulateTransactionOptions;
|
|
7060
7064
|
const block_id = new Block(blockIdentifier).identifier;
|
|
7061
7065
|
const simulationFlags = [];
|
|
7062
|
-
if (skipValidate) simulationFlags.push(
|
|
7063
|
-
if (skipFeeCharge) simulationFlags.push(
|
|
7064
|
-
const trace_flags = returnInitialReads ? [
|
|
7066
|
+
if (skipValidate) simulationFlags.push(RPC.ESimulationFlag.SKIP_VALIDATE);
|
|
7067
|
+
if (skipFeeCharge) simulationFlags.push(RPC.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
7068
|
+
const trace_flags = returnInitialReads ? [RPC.ETraceFlag.RETURN_INITIAL_READS] : void 0;
|
|
7065
7069
|
return this.fetchEndpoint("starknet_simulateTransactions", {
|
|
7066
7070
|
block_id,
|
|
7067
7071
|
transactions: await Promise.all(invocations.map((it) => this.buildTransaction(it))),
|
|
@@ -7079,13 +7083,13 @@ var RpcChannel2 = class {
|
|
|
7079
7083
|
const errorStates = options?.errorStates ?? [];
|
|
7080
7084
|
const successStates = options?.successStates ?? [
|
|
7081
7085
|
// RPC.ETransactionExecutionStatus.SUCCEEDED, // UDC on SUCCEEDED + pre_confirmed had no proper events to parse UDC
|
|
7082
|
-
|
|
7083
|
-
|
|
7086
|
+
RPC.ETransactionFinalityStatus.ACCEPTED_ON_L2,
|
|
7087
|
+
RPC.ETransactionFinalityStatus.ACCEPTED_ON_L1
|
|
7084
7088
|
];
|
|
7085
7089
|
const errorMessages = {
|
|
7086
|
-
[
|
|
7087
|
-
[
|
|
7088
|
-
[
|
|
7090
|
+
[RPC.ETransactionStatus.RECEIVED]: SYSTEM_MESSAGES.txEvictedFromMempool,
|
|
7091
|
+
[RPC.ETransactionStatus.PRE_CONFIRMED]: SYSTEM_MESSAGES.consensusFailed,
|
|
7092
|
+
[RPC.ETransactionStatus.CANDIDATE]: SYSTEM_MESSAGES.txFailsBlockBuildingValidation
|
|
7089
7093
|
};
|
|
7090
7094
|
const txLife = [];
|
|
7091
7095
|
let txStatus;
|
|
@@ -7182,7 +7186,7 @@ var RpcChannel2 = class {
|
|
|
7182
7186
|
const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
|
|
7183
7187
|
const block_id = new Block(blockIdentifier).identifier;
|
|
7184
7188
|
const flags = {
|
|
7185
|
-
simulation_flags: skipValidate ? [
|
|
7189
|
+
simulation_flags: skipValidate ? [RPC.ESimulationFlag.SKIP_VALIDATE] : []
|
|
7186
7190
|
};
|
|
7187
7191
|
return this.fetchEndpoint("starknet_estimateFee", {
|
|
7188
7192
|
request: await Promise.all(invocations.map((it) => this.buildTransaction(it, "fee"))),
|
|
@@ -7296,7 +7300,7 @@ var RpcChannel2 = class {
|
|
|
7296
7300
|
};
|
|
7297
7301
|
if (invocation.type === api_exports.ETransactionType.INVOKE) {
|
|
7298
7302
|
const btx = {
|
|
7299
|
-
type:
|
|
7303
|
+
type: RPC.ETransactionType.INVOKE,
|
|
7300
7304
|
sender_address: invocation.contractAddress,
|
|
7301
7305
|
calldata: CallData.toHex(invocation.calldata),
|
|
7302
7306
|
...details,
|
|
@@ -7338,6 +7342,16 @@ var RpcChannel2 = class {
|
|
|
7338
7342
|
}
|
|
7339
7343
|
};
|
|
7340
7344
|
|
|
7345
|
+
// src/channel/rpc_0_10_3.ts
|
|
7346
|
+
var rpc_0_10_3_exports = {};
|
|
7347
|
+
__export(rpc_0_10_3_exports, {
|
|
7348
|
+
RpcChannel: () => RpcChannel3
|
|
7349
|
+
});
|
|
7350
|
+
var RpcChannel3 = class extends RpcChannel2 {
|
|
7351
|
+
id = "RPC0.10.3";
|
|
7352
|
+
channelSpecVersion = _SupportedRpcVersion.v0_10_3;
|
|
7353
|
+
};
|
|
7354
|
+
|
|
7341
7355
|
// src/utils/eventEmitter.ts
|
|
7342
7356
|
var EventEmitter = class {
|
|
7343
7357
|
listeners = {};
|
|
@@ -9609,12 +9623,12 @@ var RpcProvider = class {
|
|
|
9609
9623
|
if (isVersion("0.9", options.specVersion)) {
|
|
9610
9624
|
this.channel = new rpc_0_9_0_exports.RpcChannel({ ...options, waitMode: false });
|
|
9611
9625
|
} else if (isVersion("0.10", options.specVersion)) {
|
|
9612
|
-
this.channel = new
|
|
9626
|
+
this.channel = new rpc_0_10_3_exports.RpcChannel({ ...options, waitMode: false });
|
|
9613
9627
|
} else throw new Error(`unsupported channel for spec version: ${options.specVersion}`);
|
|
9614
9628
|
} else if (isVersion("0.9", config.get("rpcVersion"))) {
|
|
9615
9629
|
this.channel = new rpc_0_9_0_exports.RpcChannel({ ...options, waitMode: false });
|
|
9616
9630
|
} else if (isVersion("0.10", config.get("rpcVersion"))) {
|
|
9617
|
-
this.channel = new
|
|
9631
|
+
this.channel = new rpc_0_10_3_exports.RpcChannel({ ...options, waitMode: false });
|
|
9618
9632
|
} else throw new Error("unable to define spec version for channel");
|
|
9619
9633
|
this.responseParser = new RPCResponseParser(options?.resourceBoundsOverhead);
|
|
9620
9634
|
const plugins = options?.plugins === false ? [] : options?.plugins ?? defaultPlugins;
|
|
@@ -9643,7 +9657,7 @@ var RpcProvider = class {
|
|
|
9643
9657
|
if (isVersion("0.10", spec)) {
|
|
9644
9658
|
return new this({
|
|
9645
9659
|
...optionsOrProvider,
|
|
9646
|
-
specVersion: _SupportedRpcVersion.
|
|
9660
|
+
specVersion: _SupportedRpcVersion.v0_10_3
|
|
9647
9661
|
});
|
|
9648
9662
|
}
|
|
9649
9663
|
throw new LibraryError(
|
|
@@ -13424,7 +13438,8 @@ function units(amount, simbol = "fri") {
|
|
|
13424
13438
|
Provider,
|
|
13425
13439
|
ProviderInterface,
|
|
13426
13440
|
RPC,
|
|
13427
|
-
|
|
13441
|
+
RPC0102,
|
|
13442
|
+
RPC0103,
|
|
13428
13443
|
RPC09,
|
|
13429
13444
|
RPCResponseParser,
|
|
13430
13445
|
ReceiptTx,
|