starknet 11.0.0 → 11.0.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/dist/index.js CHANGED
@@ -20274,10 +20274,10 @@ function supportedWalletApi3(walletWSF) {
20274
20274
  function subscribeWalletEvent2(walletWSF, callback) {
20275
20275
  return walletWSF.features["standard:events"].on("change", callback);
20276
20276
  }
20277
- function strk20Balances(walletWSF, tokens) {
20277
+ function strk20Balances(walletWSF, tokens, valid_until) {
20278
20278
  return walletWSF.features["starknet:walletApi"].request({
20279
20279
  type: "wallet_strk20Balances",
20280
- params: { tokens }
20280
+ params: { tokens, valid_until }
20281
20281
  });
20282
20282
  }
20283
20283
  function strk20PrepareInvoke(walletWSF, actions, simulate) {
@@ -20330,16 +20330,26 @@ var WalletAccountV6 = class _WalletAccountV6 extends WalletAccountV5 {
20330
20330
  }
20331
20331
  /**
20332
20332
  * Get the private balances held by the user inside the STRK20 privacy pool.
20333
+ *
20334
+ * Reading a shielded balance requires the user approval, and this approval is time
20335
+ * limited : `validUntil` requests when it expires. When it is omitted, the wallet applies
20336
+ * its own default window.
20333
20337
  * @param {Address[]} tokens - The tokens to get the private balance of. An empty array returns every shielded token.
20338
+ * @param {number} [validUntil] - Requested expiry of the balance read authorization, as a Unix timestamp in seconds. Omit it to let the wallet apply its default window.
20334
20339
  * @returns {Promise<STRK20_BALANCE_ENTRY[]>} One entry per token.
20335
20340
  * @example
20336
20341
  * ```typescript
20337
20342
  * const balances = await myWalletAccount.strk20Balances([strkAddress]);
20338
- * // balances = [{ token: '0x4718...', amount: '0x2386f26fc10000' }]
20343
+ * // balances = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]
20344
+ *
20345
+ * // Asking for a 5 minutes authorization window :
20346
+ * const expiry = Math.floor(Date.now() / 1000) + 300;
20347
+ * const fresh = await myWalletAccount.strk20Balances([strkAddress], expiry);
20348
+ * // fresh = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]
20339
20349
  * ```
20340
20350
  */
20341
- strk20Balances(tokens) {
20342
- return strk20Balances(this.v6Provider, tokens);
20351
+ strk20Balances(tokens, validUntil) {
20352
+ return strk20Balances(this.v6Provider, tokens, validUntil);
20343
20353
  }
20344
20354
  /**
20345
20355
  * Build the Starknet call and the SNIP-36 zero-knowledge proof of a STRK20 transaction,