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.mjs
CHANGED
|
@@ -70,7 +70,7 @@ var api_exports = {};
|
|
|
70
70
|
__export(api_exports, {
|
|
71
71
|
JRPC: () => jsonrpc_exports,
|
|
72
72
|
PAYMASTER_API: () => PAYMASTER_API,
|
|
73
|
-
|
|
73
|
+
RPCSPEC0103: () => RPCSPEC0103,
|
|
74
74
|
RPCSPEC09: () => RPCSPEC09
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -79,13 +79,13 @@ var jsonrpc_exports = {};
|
|
|
79
79
|
|
|
80
80
|
// src/types/api/index.ts
|
|
81
81
|
import * as RPCSPEC09 from "@starknet-io/starknet-types-09";
|
|
82
|
-
import * as
|
|
83
|
-
import { PAYMASTER_API } from "@starknet-io/starknet-types-
|
|
82
|
+
import * as RPCSPEC0103 from "@starknet-io/starknet-types-0103";
|
|
83
|
+
import { PAYMASTER_API } from "@starknet-io/starknet-types-0103";
|
|
84
84
|
|
|
85
85
|
// src/types/api/rpc.ts
|
|
86
86
|
var rpc_exports = {};
|
|
87
|
-
__reExport(rpc_exports,
|
|
88
|
-
import * as
|
|
87
|
+
__reExport(rpc_exports, starknet_types_0103_star);
|
|
88
|
+
import * as starknet_types_0103_star from "@starknet-io/starknet-types-0103";
|
|
89
89
|
|
|
90
90
|
// src/types/api/index.ts
|
|
91
91
|
__reExport(api_exports, rpc_exports);
|
|
@@ -94,19 +94,19 @@ __reExport(api_exports, rpc_exports);
|
|
|
94
94
|
var { ETransactionVersion } = RPCSPEC09;
|
|
95
95
|
var { ETransactionVersion2 } = RPCSPEC09;
|
|
96
96
|
var { ETransactionVersion3 } = RPCSPEC09;
|
|
97
|
-
var { EDataAvailabilityMode } =
|
|
98
|
-
var { EDAMode } =
|
|
97
|
+
var { EDataAvailabilityMode } = RPCSPEC0103;
|
|
98
|
+
var { EDAMode } = RPCSPEC0103;
|
|
99
99
|
function isRPC08Plus_ResourceBounds(entry) {
|
|
100
100
|
return "l1_data_gas" in entry;
|
|
101
101
|
}
|
|
102
102
|
function isRPC08Plus_ResourceBoundsBN(entry) {
|
|
103
103
|
return "l1_data_gas" in entry;
|
|
104
104
|
}
|
|
105
|
-
var { ETxnResponseFlag } =
|
|
106
|
-
var { ETraceFlag } =
|
|
107
|
-
var { ESubscriptionTag } =
|
|
108
|
-
var { ETransactionStatus } =
|
|
109
|
-
var { ETransactionExecutionStatus } =
|
|
105
|
+
var { ETxnResponseFlag } = RPCSPEC0103;
|
|
106
|
+
var { ETraceFlag } = RPCSPEC0103;
|
|
107
|
+
var { ESubscriptionTag } = RPCSPEC0103;
|
|
108
|
+
var { ETransactionStatus } = RPCSPEC0103;
|
|
109
|
+
var { ETransactionExecutionStatus } = RPCSPEC0103;
|
|
110
110
|
var { ETransactionType: TransactionType } = RPCSPEC09;
|
|
111
111
|
var { EBlockStatus: BlockStatus } = RPCSPEC09;
|
|
112
112
|
var { ETransactionFinalityStatus: TransactionFinalityStatus } = RPCSPEC09;
|
|
@@ -321,9 +321,11 @@ var _SupportedRpcVersion = {
|
|
|
321
321
|
"0.9.0": "0.9.0",
|
|
322
322
|
"0.10.0": "0.10.0",
|
|
323
323
|
"0.10.2": "0.10.2",
|
|
324
|
+
"0.10.3": "0.10.3",
|
|
324
325
|
v0_9_0: "0.9.0",
|
|
325
326
|
v0_10_0: "0.10.0",
|
|
326
|
-
v0_10_2: "0.10.2"
|
|
327
|
+
v0_10_2: "0.10.2",
|
|
328
|
+
v0_10_3: "0.10.3"
|
|
327
329
|
};
|
|
328
330
|
var DEFAULT_GLOBAL_CONFIG = {
|
|
329
331
|
rpcVersion: "0.10.0",
|
|
@@ -6549,6 +6551,7 @@ var rpc_0_10_2_exports = {};
|
|
|
6549
6551
|
__export(rpc_0_10_2_exports, {
|
|
6550
6552
|
RpcChannel: () => RpcChannel2
|
|
6551
6553
|
});
|
|
6554
|
+
import * as RPC from "@starknet-io/starknet-types-0101";
|
|
6552
6555
|
var RpcChannel2 = class {
|
|
6553
6556
|
id = "RPC0.10.2";
|
|
6554
6557
|
/**
|
|
@@ -6768,7 +6771,7 @@ var RpcChannel2 = class {
|
|
|
6768
6771
|
*/
|
|
6769
6772
|
getBlockWithTxs(blockIdentifier = this.blockIdentifier, options) {
|
|
6770
6773
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6771
|
-
const response_flags = options?.includeProofFacts ? [
|
|
6774
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
6772
6775
|
return this.fetchEndpoint("starknet_getBlockWithTxs", {
|
|
6773
6776
|
block_id,
|
|
6774
6777
|
...response_flags && { response_flags }
|
|
@@ -6782,7 +6785,7 @@ var RpcChannel2 = class {
|
|
|
6782
6785
|
*/
|
|
6783
6786
|
getBlockWithReceipts(blockIdentifier = this.blockIdentifier, options) {
|
|
6784
6787
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6785
|
-
const response_flags = options?.includeProofFacts ? [
|
|
6788
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
6786
6789
|
return this.fetchEndpoint("starknet_getBlockWithReceipts", {
|
|
6787
6790
|
block_id,
|
|
6788
6791
|
...response_flags && { response_flags }
|
|
@@ -6805,7 +6808,7 @@ var RpcChannel2 = class {
|
|
|
6805
6808
|
*/
|
|
6806
6809
|
getBlockTransactionsTraces(blockIdentifier = this.blockIdentifier, options) {
|
|
6807
6810
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6808
|
-
const trace_flags = options?.returnInitialReads ? [
|
|
6811
|
+
const trace_flags = options?.returnInitialReads ? [RPC.ETraceFlag.RETURN_INITIAL_READS] : void 0;
|
|
6809
6812
|
return this.fetchEndpoint("starknet_traceBlockTransactions", {
|
|
6810
6813
|
block_id,
|
|
6811
6814
|
...trace_flags && { trace_flags }
|
|
@@ -6823,7 +6826,7 @@ var RpcChannel2 = class {
|
|
|
6823
6826
|
*/
|
|
6824
6827
|
getTransactionByHash(txHash, options) {
|
|
6825
6828
|
const transaction_hash = toHex(txHash);
|
|
6826
|
-
const response_flags = options?.includeProofFacts ? [
|
|
6829
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
6827
6830
|
return this.fetchEndpoint("starknet_getTransactionByHash", {
|
|
6828
6831
|
transaction_hash,
|
|
6829
6832
|
...response_flags && { response_flags }
|
|
@@ -6838,7 +6841,7 @@ var RpcChannel2 = class {
|
|
|
6838
6841
|
*/
|
|
6839
6842
|
getTransactionByBlockIdAndIndex(blockIdentifier, index, options) {
|
|
6840
6843
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6841
|
-
const response_flags = options?.includeProofFacts ? [
|
|
6844
|
+
const response_flags = options?.includeProofFacts ? [RPC.ETxnResponseFlag.INCLUDE_PROOF_FACTS] : void 0;
|
|
6842
6845
|
return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex", {
|
|
6843
6846
|
block_id,
|
|
6844
6847
|
index,
|
|
@@ -6879,9 +6882,9 @@ var RpcChannel2 = class {
|
|
|
6879
6882
|
} = simulateTransactionOptions;
|
|
6880
6883
|
const block_id = new Block(blockIdentifier).identifier;
|
|
6881
6884
|
const simulationFlags = [];
|
|
6882
|
-
if (skipValidate) simulationFlags.push(
|
|
6883
|
-
if (skipFeeCharge) simulationFlags.push(
|
|
6884
|
-
const trace_flags = returnInitialReads ? [
|
|
6885
|
+
if (skipValidate) simulationFlags.push(RPC.ESimulationFlag.SKIP_VALIDATE);
|
|
6886
|
+
if (skipFeeCharge) simulationFlags.push(RPC.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
6887
|
+
const trace_flags = returnInitialReads ? [RPC.ETraceFlag.RETURN_INITIAL_READS] : void 0;
|
|
6885
6888
|
return this.fetchEndpoint("starknet_simulateTransactions", {
|
|
6886
6889
|
block_id,
|
|
6887
6890
|
transactions: await Promise.all(invocations.map((it) => this.buildTransaction(it))),
|
|
@@ -6899,13 +6902,13 @@ var RpcChannel2 = class {
|
|
|
6899
6902
|
const errorStates = options?.errorStates ?? [];
|
|
6900
6903
|
const successStates = options?.successStates ?? [
|
|
6901
6904
|
// RPC.ETransactionExecutionStatus.SUCCEEDED, // UDC on SUCCEEDED + pre_confirmed had no proper events to parse UDC
|
|
6902
|
-
|
|
6903
|
-
|
|
6905
|
+
RPC.ETransactionFinalityStatus.ACCEPTED_ON_L2,
|
|
6906
|
+
RPC.ETransactionFinalityStatus.ACCEPTED_ON_L1
|
|
6904
6907
|
];
|
|
6905
6908
|
const errorMessages = {
|
|
6906
|
-
[
|
|
6907
|
-
[
|
|
6908
|
-
[
|
|
6909
|
+
[RPC.ETransactionStatus.RECEIVED]: SYSTEM_MESSAGES.txEvictedFromMempool,
|
|
6910
|
+
[RPC.ETransactionStatus.PRE_CONFIRMED]: SYSTEM_MESSAGES.consensusFailed,
|
|
6911
|
+
[RPC.ETransactionStatus.CANDIDATE]: SYSTEM_MESSAGES.txFailsBlockBuildingValidation
|
|
6909
6912
|
};
|
|
6910
6913
|
const txLife = [];
|
|
6911
6914
|
let txStatus;
|
|
@@ -7002,7 +7005,7 @@ var RpcChannel2 = class {
|
|
|
7002
7005
|
const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
|
|
7003
7006
|
const block_id = new Block(blockIdentifier).identifier;
|
|
7004
7007
|
const flags = {
|
|
7005
|
-
simulation_flags: skipValidate ? [
|
|
7008
|
+
simulation_flags: skipValidate ? [RPC.ESimulationFlag.SKIP_VALIDATE] : []
|
|
7006
7009
|
};
|
|
7007
7010
|
return this.fetchEndpoint("starknet_estimateFee", {
|
|
7008
7011
|
request: await Promise.all(invocations.map((it) => this.buildTransaction(it, "fee"))),
|
|
@@ -7116,7 +7119,7 @@ var RpcChannel2 = class {
|
|
|
7116
7119
|
};
|
|
7117
7120
|
if (invocation.type === api_exports.ETransactionType.INVOKE) {
|
|
7118
7121
|
const btx = {
|
|
7119
|
-
type:
|
|
7122
|
+
type: RPC.ETransactionType.INVOKE,
|
|
7120
7123
|
sender_address: invocation.contractAddress,
|
|
7121
7124
|
calldata: CallData.toHex(invocation.calldata),
|
|
7122
7125
|
...details,
|
|
@@ -7158,6 +7161,16 @@ var RpcChannel2 = class {
|
|
|
7158
7161
|
}
|
|
7159
7162
|
};
|
|
7160
7163
|
|
|
7164
|
+
// src/channel/rpc_0_10_3.ts
|
|
7165
|
+
var rpc_0_10_3_exports = {};
|
|
7166
|
+
__export(rpc_0_10_3_exports, {
|
|
7167
|
+
RpcChannel: () => RpcChannel3
|
|
7168
|
+
});
|
|
7169
|
+
var RpcChannel3 = class extends RpcChannel2 {
|
|
7170
|
+
id = "RPC0.10.3";
|
|
7171
|
+
channelSpecVersion = _SupportedRpcVersion.v0_10_3;
|
|
7172
|
+
};
|
|
7173
|
+
|
|
7161
7174
|
// src/utils/eventEmitter.ts
|
|
7162
7175
|
var EventEmitter = class {
|
|
7163
7176
|
listeners = {};
|
|
@@ -9429,12 +9442,12 @@ var RpcProvider = class {
|
|
|
9429
9442
|
if (isVersion("0.9", options.specVersion)) {
|
|
9430
9443
|
this.channel = new rpc_0_9_0_exports.RpcChannel({ ...options, waitMode: false });
|
|
9431
9444
|
} else if (isVersion("0.10", options.specVersion)) {
|
|
9432
|
-
this.channel = new
|
|
9445
|
+
this.channel = new rpc_0_10_3_exports.RpcChannel({ ...options, waitMode: false });
|
|
9433
9446
|
} else throw new Error(`unsupported channel for spec version: ${options.specVersion}`);
|
|
9434
9447
|
} else if (isVersion("0.9", config.get("rpcVersion"))) {
|
|
9435
9448
|
this.channel = new rpc_0_9_0_exports.RpcChannel({ ...options, waitMode: false });
|
|
9436
9449
|
} else if (isVersion("0.10", config.get("rpcVersion"))) {
|
|
9437
|
-
this.channel = new
|
|
9450
|
+
this.channel = new rpc_0_10_3_exports.RpcChannel({ ...options, waitMode: false });
|
|
9438
9451
|
} else throw new Error("unable to define spec version for channel");
|
|
9439
9452
|
this.responseParser = new RPCResponseParser(options?.resourceBoundsOverhead);
|
|
9440
9453
|
const plugins = options?.plugins === false ? [] : options?.plugins ?? defaultPlugins;
|
|
@@ -9463,7 +9476,7 @@ var RpcProvider = class {
|
|
|
9463
9476
|
if (isVersion("0.10", spec)) {
|
|
9464
9477
|
return new this({
|
|
9465
9478
|
...optionsOrProvider,
|
|
9466
|
-
specVersion: _SupportedRpcVersion.
|
|
9479
|
+
specVersion: _SupportedRpcVersion.v0_10_3
|
|
9467
9480
|
});
|
|
9468
9481
|
}
|
|
9469
9482
|
throw new LibraryError(
|
|
@@ -13244,12 +13257,13 @@ export {
|
|
|
13244
13257
|
RpcProvider as Provider,
|
|
13245
13258
|
ProviderInterface,
|
|
13246
13259
|
api_exports as RPC,
|
|
13247
|
-
rpc_0_10_2_exports as
|
|
13260
|
+
rpc_0_10_2_exports as RPC0102,
|
|
13261
|
+
rpc_0_10_3_exports as RPC0103,
|
|
13248
13262
|
rpc_0_9_0_exports as RPC09,
|
|
13249
13263
|
RPCResponseParser,
|
|
13250
13264
|
ReceiptTx,
|
|
13251
13265
|
ResponseParser,
|
|
13252
|
-
|
|
13266
|
+
RpcChannel3 as RpcChannel,
|
|
13253
13267
|
RpcError,
|
|
13254
13268
|
RpcProvider,
|
|
13255
13269
|
Signer,
|