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.js
CHANGED
|
@@ -192,6 +192,7 @@ __export(index_exports, {
|
|
|
192
192
|
starknetIdPlugin: () => starknetId,
|
|
193
193
|
toAnyPatchVersion: () => toAnyPatchVersion,
|
|
194
194
|
toApiVersion: () => toApiVersion,
|
|
195
|
+
toReleaseVersion: () => toReleaseVersion,
|
|
195
196
|
transaction: () => transaction_exports,
|
|
196
197
|
typedData: () => typedData_exports,
|
|
197
198
|
uint256: () => uint256_exports,
|
|
@@ -5510,13 +5511,16 @@ function toAnyPatchVersion(version) {
|
|
|
5510
5511
|
}
|
|
5511
5512
|
return `${parts[0]}.${parts[1]}.*`;
|
|
5512
5513
|
}
|
|
5514
|
+
function toReleaseVersion(version) {
|
|
5515
|
+
return version.split(/[-+]/)[0];
|
|
5516
|
+
}
|
|
5513
5517
|
function toApiVersion(version) {
|
|
5514
5518
|
const [major, minor] = version.replace(/^v/, "").split(".");
|
|
5515
5519
|
return `v${major}_${minor}`;
|
|
5516
5520
|
}
|
|
5517
5521
|
function compareVersions(a, b) {
|
|
5518
|
-
const aParts = a.split(".").map(Number);
|
|
5519
|
-
const bParts = b.split(".").map(Number);
|
|
5522
|
+
const aParts = toReleaseVersion(a).split(".").map(Number);
|
|
5523
|
+
const bParts = toReleaseVersion(b).split(".").map(Number);
|
|
5520
5524
|
const maxLen = Math.max(aParts.length, bParts.length);
|
|
5521
5525
|
for (let i = 0; i < maxLen; i += 1) {
|
|
5522
5526
|
const aNum = aParts[i] || 0;
|
|
@@ -6274,7 +6278,7 @@ var RpcChannel = class {
|
|
|
6274
6278
|
this.chainId = chainId;
|
|
6275
6279
|
this.headers = { ...channelDefaults.options.headers, ...headers };
|
|
6276
6280
|
this.retries = retries ?? channelDefaults.options.retries;
|
|
6277
|
-
this.specVersion = specVersion;
|
|
6281
|
+
this.specVersion = specVersion ? toReleaseVersion(specVersion) : void 0;
|
|
6278
6282
|
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback ?? channelDefaults.options.transactionRetryIntervalFallback;
|
|
6279
6283
|
this.waitMode = waitMode ?? false;
|
|
6280
6284
|
this.requestId = 0;
|
|
@@ -6362,18 +6366,19 @@ var RpcChannel = class {
|
|
|
6362
6366
|
*/
|
|
6363
6367
|
async setUpSpecVersion() {
|
|
6364
6368
|
if (!this.specVersion) {
|
|
6365
|
-
const
|
|
6366
|
-
|
|
6369
|
+
const nodeSpecVersion = await this.fetchEndpoint("starknet_specVersion");
|
|
6370
|
+
const specVersion = toReleaseVersion(nodeSpecVersion);
|
|
6371
|
+
if (!isVersion(this.channelSpecVersion, specVersion)) {
|
|
6367
6372
|
logger.error(SYSTEM_MESSAGES.channelVersionMismatch, {
|
|
6368
6373
|
channelId: this.id,
|
|
6369
6374
|
channelSpecVersion: this.channelSpecVersion,
|
|
6370
|
-
nodeSpecVersion
|
|
6375
|
+
nodeSpecVersion
|
|
6371
6376
|
});
|
|
6372
6377
|
}
|
|
6373
|
-
if (!isSupportedSpecVersion(
|
|
6378
|
+
if (!isSupportedSpecVersion(specVersion)) {
|
|
6374
6379
|
throw new LibraryError(`${SYSTEM_MESSAGES.unsupportedSpecVersion}, channelId: ${this.id}`);
|
|
6375
6380
|
}
|
|
6376
|
-
this.specVersion =
|
|
6381
|
+
this.specVersion = specVersion;
|
|
6377
6382
|
}
|
|
6378
6383
|
return this.specVersion;
|
|
6379
6384
|
}
|
|
@@ -6835,7 +6840,7 @@ var RpcChannel2 = class {
|
|
|
6835
6840
|
this.chainId = chainId;
|
|
6836
6841
|
this.headers = { ...channelDefaults.options.headers, ...headers };
|
|
6837
6842
|
this.retries = retries ?? channelDefaults.options.retries;
|
|
6838
|
-
this.specVersion = specVersion;
|
|
6843
|
+
this.specVersion = specVersion ? toReleaseVersion(specVersion) : void 0;
|
|
6839
6844
|
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback ?? channelDefaults.options.transactionRetryIntervalFallback;
|
|
6840
6845
|
this.waitMode = waitMode ?? false;
|
|
6841
6846
|
this.requestId = 0;
|
|
@@ -6923,18 +6928,19 @@ var RpcChannel2 = class {
|
|
|
6923
6928
|
*/
|
|
6924
6929
|
async setUpSpecVersion() {
|
|
6925
6930
|
if (!this.specVersion) {
|
|
6926
|
-
const
|
|
6927
|
-
|
|
6931
|
+
const nodeSpecVersion = await this.fetchEndpoint("starknet_specVersion");
|
|
6932
|
+
const specVersion = toReleaseVersion(nodeSpecVersion);
|
|
6933
|
+
if (!isVersion("0.10", specVersion)) {
|
|
6928
6934
|
logger.error(SYSTEM_MESSAGES.channelVersionMismatch, {
|
|
6929
6935
|
channelId: this.id,
|
|
6930
6936
|
channelSpecVersion: this.channelSpecVersion,
|
|
6931
|
-
nodeSpecVersion
|
|
6937
|
+
nodeSpecVersion
|
|
6932
6938
|
});
|
|
6933
6939
|
}
|
|
6934
|
-
if (!isSupportedSpecVersion(
|
|
6940
|
+
if (!isSupportedSpecVersion(specVersion)) {
|
|
6935
6941
|
throw new LibraryError(`${SYSTEM_MESSAGES.unsupportedSpecVersion}, channelId: ${this.id}`);
|
|
6936
6942
|
}
|
|
6937
|
-
this.specVersion =
|
|
6943
|
+
this.specVersion = specVersion;
|
|
6938
6944
|
}
|
|
6939
6945
|
return this.specVersion;
|
|
6940
6946
|
}
|
|
@@ -9888,16 +9894,17 @@ var RpcProvider = class {
|
|
|
9888
9894
|
static async create(optionsOrProvider) {
|
|
9889
9895
|
const channel = new rpc_0_9_0_exports.RpcChannel({ ...optionsOrProvider });
|
|
9890
9896
|
const spec = await channel.getSpecVersion();
|
|
9891
|
-
|
|
9897
|
+
const specVersion = toReleaseVersion(spec);
|
|
9898
|
+
if (!isSupportedSpecVersion(specVersion)) {
|
|
9892
9899
|
logger.warn(`Using incompatible node spec version ${spec}`);
|
|
9893
9900
|
}
|
|
9894
|
-
if (isVersion("0.9",
|
|
9901
|
+
if (isVersion("0.9", specVersion)) {
|
|
9895
9902
|
return new this({
|
|
9896
9903
|
...optionsOrProvider,
|
|
9897
9904
|
specVersion: _SupportedRpcVersion.v0_9_0
|
|
9898
9905
|
});
|
|
9899
9906
|
}
|
|
9900
|
-
if (isVersion("0.10",
|
|
9907
|
+
if (isVersion("0.10", specVersion)) {
|
|
9901
9908
|
return new this({
|
|
9902
9909
|
...optionsOrProvider,
|
|
9903
9910
|
specVersion: _SupportedRpcVersion.v0_10_3
|
|
@@ -14147,6 +14154,7 @@ function units(amount, simbol = "fri") {
|
|
|
14147
14154
|
starknetIdPlugin,
|
|
14148
14155
|
toAnyPatchVersion,
|
|
14149
14156
|
toApiVersion,
|
|
14157
|
+
toReleaseVersion,
|
|
14150
14158
|
transaction,
|
|
14151
14159
|
typedData,
|
|
14152
14160
|
uint256,
|