starknet 10.6.8 → 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 +12 -0
- package/dist/index.d.ts +54 -36
- package/dist/index.global.js +39 -32
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +40 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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
|
|
@@ -12927,7 +12933,7 @@ function fromWalletApiCall(call) {
|
|
|
12927
12933
|
}
|
|
12928
12934
|
function toWalletApiActions(actions) {
|
|
12929
12935
|
return actions.map(
|
|
12930
|
-
(action) => action.type === "
|
|
12936
|
+
(action) => action.type === "shadow_account_invoke" ? { ...action, calls: action.calls.map(toWalletApiCall) } : action
|
|
12931
12937
|
);
|
|
12932
12938
|
}
|
|
12933
12939
|
|
|
@@ -12946,7 +12952,7 @@ __export(connectV6_exports, {
|
|
|
12946
12952
|
strk20Balances: () => strk20Balances,
|
|
12947
12953
|
strk20InvokeTransaction: () => strk20InvokeTransaction,
|
|
12948
12954
|
strk20PrepareInvoke: () => strk20PrepareInvoke,
|
|
12949
|
-
|
|
12955
|
+
strk20ShadowAccountCommitment: () => strk20ShadowAccountCommitment,
|
|
12950
12956
|
subscribeWalletEvent: () => subscribeWalletEvent2,
|
|
12951
12957
|
supportedSpecs: () => supportedSpecs3,
|
|
12952
12958
|
supportedWalletApi: () => supportedWalletApi3,
|
|
@@ -13034,9 +13040,9 @@ function strk20InvokeTransaction(walletWSF, actions) {
|
|
|
13034
13040
|
params: { actions }
|
|
13035
13041
|
});
|
|
13036
13042
|
}
|
|
13037
|
-
function
|
|
13043
|
+
function strk20ShadowAccountCommitment(walletWSF, dapp_name, nonce) {
|
|
13038
13044
|
return walletWSF.features["starknet:walletApi"].request({
|
|
13039
|
-
type: "
|
|
13045
|
+
type: "wallet_strk20ShadowAccountCommitment",
|
|
13040
13046
|
params: { dapp_name, nonce }
|
|
13041
13047
|
});
|
|
13042
13048
|
}
|
|
@@ -13128,25 +13134,25 @@ var WalletAccountV6 = class _WalletAccountV6 extends WalletAccountV5 {
|
|
|
13128
13134
|
return strk20InvokeTransaction(this.v6Provider, toWalletApiActions(actions));
|
|
13129
13135
|
}
|
|
13130
13136
|
/**
|
|
13131
|
-
* Compute the commitment of a DAPP STRK20
|
|
13137
|
+
* Compute the commitment of a DAPP STRK20 shadow account. The commitment is computed
|
|
13132
13138
|
* locally by the wallet from the user private state ; no transaction is sent.
|
|
13133
13139
|
*
|
|
13134
|
-
* When `nonce` is given, the full commitment of this single
|
|
13140
|
+
* When `nonce` is given, the full commitment of this single shadow account is returned.
|
|
13135
13141
|
* When `nonce` is omitted, the partial (nonce independent) commitment is returned
|
|
13136
|
-
* instead : it is shared by every
|
|
13137
|
-
* be published once to let a DAPP recognize all the
|
|
13138
|
-
* learning any individual nonce.
|
|
13139
|
-
* @param {STRK20_DAPP_NAME} dappName - The DAPP that scopes the
|
|
13140
|
-
* @param {FELT} [nonce] - The
|
|
13141
|
-
* @returns {Promise<FELT>} The
|
|
13142
|
+
* instead : it is shared by every shadow account the user derives for this DAPP, so it
|
|
13143
|
+
* can be published once to let a DAPP recognize all the shadow accounts of a user
|
|
13144
|
+
* without learning any individual nonce.
|
|
13145
|
+
* @param {STRK20_DAPP_NAME} dappName - The DAPP that scopes the shadow account(s).
|
|
13146
|
+
* @param {FELT} [nonce] - The shadow account nonce ; each nonce selects a distinct shadow account for this user + DAPP. Omit it to get the partial commitment.
|
|
13147
|
+
* @returns {Promise<FELT>} The shadow account commitment.
|
|
13142
13148
|
* @example
|
|
13143
13149
|
* ```typescript
|
|
13144
|
-
* const commitment = await myWalletAccount.
|
|
13150
|
+
* const commitment = await myWalletAccount.strk20ShadowAccountCommitment('myDapp', '0x0');
|
|
13145
13151
|
* // commitment = '0x5f2e...'
|
|
13146
13152
|
* ```
|
|
13147
13153
|
*/
|
|
13148
|
-
|
|
13149
|
-
return
|
|
13154
|
+
strk20ShadowAccountCommitment(dappName, nonce) {
|
|
13155
|
+
return strk20ShadowAccountCommitment(this.v6Provider, dappName, nonce);
|
|
13150
13156
|
}
|
|
13151
13157
|
static async connect(provider, walletProvider, cairoVersion, paymaster, silentMode = false) {
|
|
13152
13158
|
const { accounts } = await standardConnect2(walletProvider, silentMode);
|
|
@@ -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,
|