starknet 10.7.0 → 10.7.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 +6 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.global.js +24 -17
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +25 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5326,13 +5326,16 @@ function toAnyPatchVersion(version) {
|
|
|
5326
5326
|
}
|
|
5327
5327
|
return `${parts[0]}.${parts[1]}.*`;
|
|
5328
5328
|
}
|
|
5329
|
+
function toReleaseVersion(version) {
|
|
5330
|
+
return version.split(/[-+]/)[0];
|
|
5331
|
+
}
|
|
5329
5332
|
function toApiVersion(version) {
|
|
5330
5333
|
const [major, minor] = version.replace(/^v/, "").split(".");
|
|
5331
5334
|
return `v${major}_${minor}`;
|
|
5332
5335
|
}
|
|
5333
5336
|
function compareVersions(a, b) {
|
|
5334
|
-
const aParts = a.split(".").map(Number);
|
|
5335
|
-
const bParts = b.split(".").map(Number);
|
|
5337
|
+
const aParts = toReleaseVersion(a).split(".").map(Number);
|
|
5338
|
+
const bParts = toReleaseVersion(b).split(".").map(Number);
|
|
5336
5339
|
const maxLen = Math.max(aParts.length, bParts.length);
|
|
5337
5340
|
for (let i = 0; i < maxLen; i += 1) {
|
|
5338
5341
|
const aNum = aParts[i] || 0;
|
|
@@ -6090,7 +6093,7 @@ var RpcChannel = class {
|
|
|
6090
6093
|
this.chainId = chainId;
|
|
6091
6094
|
this.headers = { ...channelDefaults.options.headers, ...headers };
|
|
6092
6095
|
this.retries = retries ?? channelDefaults.options.retries;
|
|
6093
|
-
this.specVersion = specVersion;
|
|
6096
|
+
this.specVersion = specVersion ? toReleaseVersion(specVersion) : void 0;
|
|
6094
6097
|
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback ?? channelDefaults.options.transactionRetryIntervalFallback;
|
|
6095
6098
|
this.waitMode = waitMode ?? false;
|
|
6096
6099
|
this.requestId = 0;
|
|
@@ -6178,18 +6181,19 @@ var RpcChannel = class {
|
|
|
6178
6181
|
*/
|
|
6179
6182
|
async setUpSpecVersion() {
|
|
6180
6183
|
if (!this.specVersion) {
|
|
6181
|
-
const
|
|
6182
|
-
|
|
6184
|
+
const nodeSpecVersion = await this.fetchEndpoint("starknet_specVersion");
|
|
6185
|
+
const specVersion = toReleaseVersion(nodeSpecVersion);
|
|
6186
|
+
if (!isVersion(this.channelSpecVersion, specVersion)) {
|
|
6183
6187
|
logger.error(SYSTEM_MESSAGES.channelVersionMismatch, {
|
|
6184
6188
|
channelId: this.id,
|
|
6185
6189
|
channelSpecVersion: this.channelSpecVersion,
|
|
6186
|
-
nodeSpecVersion
|
|
6190
|
+
nodeSpecVersion
|
|
6187
6191
|
});
|
|
6188
6192
|
}
|
|
6189
|
-
if (!isSupportedSpecVersion(
|
|
6193
|
+
if (!isSupportedSpecVersion(specVersion)) {
|
|
6190
6194
|
throw new LibraryError(`${SYSTEM_MESSAGES.unsupportedSpecVersion}, channelId: ${this.id}`);
|
|
6191
6195
|
}
|
|
6192
|
-
this.specVersion =
|
|
6196
|
+
this.specVersion = specVersion;
|
|
6193
6197
|
}
|
|
6194
6198
|
return this.specVersion;
|
|
6195
6199
|
}
|
|
@@ -6651,7 +6655,7 @@ var RpcChannel2 = class {
|
|
|
6651
6655
|
this.chainId = chainId;
|
|
6652
6656
|
this.headers = { ...channelDefaults.options.headers, ...headers };
|
|
6653
6657
|
this.retries = retries ?? channelDefaults.options.retries;
|
|
6654
|
-
this.specVersion = specVersion;
|
|
6658
|
+
this.specVersion = specVersion ? toReleaseVersion(specVersion) : void 0;
|
|
6655
6659
|
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback ?? channelDefaults.options.transactionRetryIntervalFallback;
|
|
6656
6660
|
this.waitMode = waitMode ?? false;
|
|
6657
6661
|
this.requestId = 0;
|
|
@@ -6739,18 +6743,19 @@ var RpcChannel2 = class {
|
|
|
6739
6743
|
*/
|
|
6740
6744
|
async setUpSpecVersion() {
|
|
6741
6745
|
if (!this.specVersion) {
|
|
6742
|
-
const
|
|
6743
|
-
|
|
6746
|
+
const nodeSpecVersion = await this.fetchEndpoint("starknet_specVersion");
|
|
6747
|
+
const specVersion = toReleaseVersion(nodeSpecVersion);
|
|
6748
|
+
if (!isVersion("0.10", specVersion)) {
|
|
6744
6749
|
logger.error(SYSTEM_MESSAGES.channelVersionMismatch, {
|
|
6745
6750
|
channelId: this.id,
|
|
6746
6751
|
channelSpecVersion: this.channelSpecVersion,
|
|
6747
|
-
nodeSpecVersion
|
|
6752
|
+
nodeSpecVersion
|
|
6748
6753
|
});
|
|
6749
6754
|
}
|
|
6750
|
-
if (!isSupportedSpecVersion(
|
|
6755
|
+
if (!isSupportedSpecVersion(specVersion)) {
|
|
6751
6756
|
throw new LibraryError(`${SYSTEM_MESSAGES.unsupportedSpecVersion}, channelId: ${this.id}`);
|
|
6752
6757
|
}
|
|
6753
|
-
this.specVersion =
|
|
6758
|
+
this.specVersion = specVersion;
|
|
6754
6759
|
}
|
|
6755
6760
|
return this.specVersion;
|
|
6756
6761
|
}
|
|
@@ -9704,16 +9709,17 @@ var RpcProvider = class {
|
|
|
9704
9709
|
static async create(optionsOrProvider) {
|
|
9705
9710
|
const channel = new rpc_0_9_0_exports.RpcChannel({ ...optionsOrProvider });
|
|
9706
9711
|
const spec = await channel.getSpecVersion();
|
|
9707
|
-
|
|
9712
|
+
const specVersion = toReleaseVersion(spec);
|
|
9713
|
+
if (!isSupportedSpecVersion(specVersion)) {
|
|
9708
9714
|
logger.warn(`Using incompatible node spec version ${spec}`);
|
|
9709
9715
|
}
|
|
9710
|
-
if (isVersion("0.9",
|
|
9716
|
+
if (isVersion("0.9", specVersion)) {
|
|
9711
9717
|
return new this({
|
|
9712
9718
|
...optionsOrProvider,
|
|
9713
9719
|
specVersion: _SupportedRpcVersion.v0_9_0
|
|
9714
9720
|
});
|
|
9715
9721
|
}
|
|
9716
|
-
if (isVersion("0.10",
|
|
9722
|
+
if (isVersion("0.10", specVersion)) {
|
|
9717
9723
|
return new this({
|
|
9718
9724
|
...optionsOrProvider,
|
|
9719
9725
|
specVersion: _SupportedRpcVersion.v0_10_3
|
|
@@ -13963,6 +13969,7 @@ export {
|
|
|
13963
13969
|
starknetId as starknetIdPlugin,
|
|
13964
13970
|
toAnyPatchVersion,
|
|
13965
13971
|
toApiVersion,
|
|
13972
|
+
toReleaseVersion,
|
|
13966
13973
|
transaction_exports as transaction,
|
|
13967
13974
|
typedData_exports as typedData,
|
|
13968
13975
|
uint256_exports as uint256,
|