starknet 10.3.0 → 10.3.2
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 +195 -199
- package/dist/index.global.js +61 -31
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +61 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [10.3.2](https://github.com/starknet-io/starknet.js/compare/v10.3.1...v10.3.2) (2026-06-16)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- surface clear error instead of crashing on empty node reply ([678ca1d](https://github.com/starknet-io/starknet.js/commit/678ca1db2b0f055708b03363688bddf75858a5e4))
|
|
6
|
+
|
|
7
|
+
## [10.3.1](https://github.com/starknet-io/starknet.js/compare/v10.3.0...v10.3.1) (2026-06-15)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- plugins methods in Account not available in dist ([58a150f](https://github.com/starknet-io/starknet.js/commit/58a150fa2910c7498d96ec2a335793c852ab87a9))
|
|
12
|
+
|
|
1
13
|
# [10.3.0](https://github.com/starknet-io/starknet.js/compare/v10.2.0...v10.3.0) (2026-06-10)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/dist/index.d.ts
CHANGED
|
@@ -5319,6 +5319,198 @@ declare class PluginManager {
|
|
|
5319
5319
|
hasPlugin(name: string): boolean;
|
|
5320
5320
|
}
|
|
5321
5321
|
|
|
5322
|
+
interface StarknetIdProviderMethods {
|
|
5323
|
+
getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
|
|
5324
|
+
getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
|
|
5325
|
+
getStarkProfile(address: BigNumberish, StarknetIdContract?: string, StarknetIdIdentityContract?: string, StarknetIdVerifierContract?: string, StarknetIdPfpContract?: string, StarknetIdPopContract?: string, StarknetIdMulticallContract?: string): Promise<StarkProfile>;
|
|
5326
|
+
}
|
|
5327
|
+
interface StarknetIdAccountMethods {
|
|
5328
|
+
getStarkName(address?: BigNumberish, StarknetIdContract?: string): Promise<string>;
|
|
5329
|
+
getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
|
|
5330
|
+
getStarkProfile(address: BigNumberish, StarknetIdContract?: string, StarknetIdIdentityContract?: string, StarknetIdVerifierContract?: string, StarknetIdPfpContract?: string, StarknetIdPopContract?: string, StarknetIdMulticallContract?: string): Promise<StarkProfile>;
|
|
5331
|
+
}
|
|
5332
|
+
declare class StarknetIdImpl {
|
|
5333
|
+
static getStarkName(provider: ProviderInterface, address: BigNumberish, StarknetIdContract?: string): Promise<string>;
|
|
5334
|
+
static getAddressFromStarkName(provider: ProviderInterface, name: string, StarknetIdContract?: string): Promise<string>;
|
|
5335
|
+
static getStarkProfile(provider: ProviderInterface, address: BigNumberish, StarknetIdContract?: string, StarknetIdIdentityContract?: string, StarknetIdVerifierContract?: string, StarknetIdPfpContract?: string, StarknetIdPopContract?: string, StarknetIdMulticallContract?: string): Promise<StarkProfile>;
|
|
5336
|
+
}
|
|
5337
|
+
|
|
5338
|
+
interface BrotherProfile {
|
|
5339
|
+
name: string;
|
|
5340
|
+
resolver: string;
|
|
5341
|
+
tokenId: string;
|
|
5342
|
+
expiryDate: number;
|
|
5343
|
+
lastTransferTime: number;
|
|
5344
|
+
}
|
|
5345
|
+
interface BrotherIdProviderMethods {
|
|
5346
|
+
getBrotherName(address: BigNumberish, BrotherIdContract?: string): Promise<string>;
|
|
5347
|
+
getAddressFromBrotherName(name: string, BrotherIdContract?: string): Promise<string>;
|
|
5348
|
+
getBrotherProfile(address: BigNumberish, BrotherIdContract?: string): Promise<BrotherProfile>;
|
|
5349
|
+
}
|
|
5350
|
+
declare class BrotherIdImpl {
|
|
5351
|
+
static getBrotherName(provider: ProviderInterface, address: BigNumberish, BrotherIdContract?: string): Promise<string>;
|
|
5352
|
+
static getAddressFromBrotherName(provider: ProviderInterface, name: string, BrotherIdContract?: string): Promise<string>;
|
|
5353
|
+
static getBrotherProfile(provider: ProviderInterface, address: BigNumberish, BrotherIdContract?: string): Promise<BrotherProfile>;
|
|
5354
|
+
}
|
|
5355
|
+
/**
|
|
5356
|
+
* BrotherId plugin - adds .brother domain resolution methods.
|
|
5357
|
+
*
|
|
5358
|
+
* @example
|
|
5359
|
+
* ```typescript
|
|
5360
|
+
* import { RpcProvider, brotherId } from 'starknet';
|
|
5361
|
+
* const provider = new RpcProvider({ plugins: [brotherId()] });
|
|
5362
|
+
* const name = await provider.getBrotherName('0x123...');
|
|
5363
|
+
* ```
|
|
5364
|
+
*/
|
|
5365
|
+
declare function brotherId(): StarknetPlugin<BrotherIdProviderMethods>;
|
|
5366
|
+
|
|
5367
|
+
/**
|
|
5368
|
+
* Options for controlling fastWaitForTransaction polling behavior
|
|
5369
|
+
*/
|
|
5370
|
+
type FastWaitForTransactionOptions = {
|
|
5371
|
+
/** Number of retry attempts (default: 50) */
|
|
5372
|
+
retries?: number;
|
|
5373
|
+
/** Milliseconds to wait between retries (default: 500) */
|
|
5374
|
+
retryInterval?: number;
|
|
5375
|
+
};
|
|
5376
|
+
/**
|
|
5377
|
+
* Response from fastExecute() containing transaction result and readiness status
|
|
5378
|
+
*/
|
|
5379
|
+
type FastExecuteResponse = {
|
|
5380
|
+
/** The transaction invoke response with transaction hash */
|
|
5381
|
+
txResult: InvokeFunctionResponse;
|
|
5382
|
+
/** Whether the next transaction can be executed immediately */
|
|
5383
|
+
isReady: boolean;
|
|
5384
|
+
};
|
|
5385
|
+
/**
|
|
5386
|
+
* Provider methods added by the FastExecute plugin
|
|
5387
|
+
*/
|
|
5388
|
+
interface FastExecuteProviderMethods {
|
|
5389
|
+
/**
|
|
5390
|
+
* Wait for transaction confirmation with polling optimization for gaming.
|
|
5391
|
+
*
|
|
5392
|
+
* This method is fast but Events and transaction reports are not yet available.
|
|
5393
|
+
* Useful for gaming activity and rapid-fire transaction scenarios.
|
|
5394
|
+
*
|
|
5395
|
+
* Only available on RPC 0.9 and onwards.
|
|
5396
|
+
*
|
|
5397
|
+
* @param {BigNumberish} txHash - Transaction hash to monitor
|
|
5398
|
+
* @param {string} address - Address of the account (used to track nonce changes)
|
|
5399
|
+
* @param {BigNumberish} initNonce - Initial nonce of the account (before the transaction)
|
|
5400
|
+
* @param {FastWaitForTransactionOptions} [options={retries: 50, retryInterval: 500}] - Polling configuration
|
|
5401
|
+
* options. `retries` is the number of times to retry (default: 50), `retryInterval` is the time in ms
|
|
5402
|
+
* between retries (default: 500).
|
|
5403
|
+
* @returns {Promise<boolean>} Returns true if the next transaction is possible (nonce increment detected),
|
|
5404
|
+
* false if the timeout has been reached, or throws an error in case of provider communication failure
|
|
5405
|
+
* or transaction reversion.
|
|
5406
|
+
*
|
|
5407
|
+
* @example
|
|
5408
|
+
* ```typescript
|
|
5409
|
+
* const isReady = await provider.fastWaitForTransaction(
|
|
5410
|
+
* '0x123abc...',
|
|
5411
|
+
* '0x456def...',
|
|
5412
|
+
* 10,
|
|
5413
|
+
* { retries: 30, retryInterval: 500 }
|
|
5414
|
+
* );
|
|
5415
|
+
*
|
|
5416
|
+
* if (isReady) {
|
|
5417
|
+
* // Next transaction can be sent
|
|
5418
|
+
* }
|
|
5419
|
+
* ```
|
|
5420
|
+
*/
|
|
5421
|
+
fastWaitForTransaction(txHash: BigNumberish, address: string, initNonce: BigNumberish, options?: FastWaitForTransactionOptions): Promise<boolean>;
|
|
5422
|
+
}
|
|
5423
|
+
/**
|
|
5424
|
+
* Account methods added by the FastExecute plugin
|
|
5425
|
+
*/
|
|
5426
|
+
interface FastExecuteAccountMethods {
|
|
5427
|
+
/**
|
|
5428
|
+
* Execute one or multiple calls through the account contract,
|
|
5429
|
+
* responding as soon as a new transaction is possible with the same account.
|
|
5430
|
+
* Useful for gaming usage where rapid consecutive transactions are needed.
|
|
5431
|
+
*
|
|
5432
|
+
* This method requires the provider to be initialized with `pre_confirmed` blockIdentifier option.
|
|
5433
|
+
* RPC 0.9 minimum.
|
|
5434
|
+
*
|
|
5435
|
+
* In a normal `account.execute()` call followed by `provider.waitForTransaction()`, you have immediate access
|
|
5436
|
+
* to the events and transaction report. Here, we process consecutive transactions faster, but events and
|
|
5437
|
+
* transaction reports are not available immediately.
|
|
5438
|
+
*
|
|
5439
|
+
* As a consequence of the above, do not use contract/account deployment with this method.
|
|
5440
|
+
*
|
|
5441
|
+
* @param {AllowArray<Call>} transactions - Single call or array of calls to execute
|
|
5442
|
+
* @param {UniversalDetails} [transactionsDetail] - Transaction execution options
|
|
5443
|
+
* @param {FastWaitForTransactionOptions} [waitDetail={retries: 50, retryInterval: 500}] - Options to scan the
|
|
5444
|
+
* network for the next possible transaction. `retries` is the number of times to retry (default: 50),
|
|
5445
|
+
* `retryInterval` is the time in ms between retries (default: 500).
|
|
5446
|
+
* @returns {Promise<FastExecuteResponse>} Response containing the transaction result and status for the next
|
|
5447
|
+
* transaction. If `isReady` is true, you can execute the next transaction immediately. If false,
|
|
5448
|
+
* timeout has been reached before the next transaction was possible.
|
|
5449
|
+
*
|
|
5450
|
+
* @example
|
|
5451
|
+
* ```typescript
|
|
5452
|
+
* const myProvider = new RpcProvider({
|
|
5453
|
+
* nodeUrl: url,
|
|
5454
|
+
* blockIdentifier: BlockTag.PRE_CONFIRMED
|
|
5455
|
+
* });
|
|
5456
|
+
* const myAccount = new Account({
|
|
5457
|
+
* provider: myProvider,
|
|
5458
|
+
* address: accountAddress0,
|
|
5459
|
+
* signer: privateKey0
|
|
5460
|
+
* });
|
|
5461
|
+
*
|
|
5462
|
+
* const resp = await myAccount.fastExecute(
|
|
5463
|
+
* call,
|
|
5464
|
+
* { tip: recommendedTip },
|
|
5465
|
+
* { retries: 30, retryInterval: 500 }
|
|
5466
|
+
* );
|
|
5467
|
+
*
|
|
5468
|
+
* // if resp.isReady is true, you can launch immediately a new tx
|
|
5469
|
+
* if (resp.isReady) {
|
|
5470
|
+
* // send next transaction
|
|
5471
|
+
* }
|
|
5472
|
+
* ```
|
|
5473
|
+
*/
|
|
5474
|
+
fastExecute(transactions: any, transactionsDetail?: any, waitDetail?: FastWaitForTransactionOptions): Promise<FastExecuteResponse>;
|
|
5475
|
+
}
|
|
5476
|
+
|
|
5477
|
+
/**
|
|
5478
|
+
* FastExecute plugin - adds gaming-optimized transaction execution
|
|
5479
|
+
*
|
|
5480
|
+
* Provides fastExecute() on accounts and fastWaitForTransaction() on providers
|
|
5481
|
+
* for rapid successive transaction execution with minimal confirmation latency.
|
|
5482
|
+
*
|
|
5483
|
+
* Requires:
|
|
5484
|
+
* - RPC 0.9 or later
|
|
5485
|
+
* - Provider initialized with BlockTag.PRE_CONFIRMED
|
|
5486
|
+
*
|
|
5487
|
+
* @example
|
|
5488
|
+
* ```typescript
|
|
5489
|
+
* import { RpcProvider, Account } from 'starknet';
|
|
5490
|
+
* import { fastExecute } from 'starknet/plugins';
|
|
5491
|
+
*
|
|
5492
|
+
* const provider = new RpcProvider({
|
|
5493
|
+
* nodeUrl: url,
|
|
5494
|
+
* blockIdentifier: BlockTag.PRE_CONFIRMED,
|
|
5495
|
+
* });
|
|
5496
|
+
*
|
|
5497
|
+
* const account = new Account({ provider, address, signer });
|
|
5498
|
+
*
|
|
5499
|
+
* const resp = await account.fastExecute(
|
|
5500
|
+
* call,
|
|
5501
|
+
* { tip: recommendedTip },
|
|
5502
|
+
* { retries: 30, retryInterval: 500 }
|
|
5503
|
+
* );
|
|
5504
|
+
*
|
|
5505
|
+
* if (resp.isReady) {
|
|
5506
|
+
* // Next transaction can be sent immediately
|
|
5507
|
+
* }
|
|
5508
|
+
* ```
|
|
5509
|
+
*/
|
|
5510
|
+
declare function fastExecute(): StarknetPlugin<FastExecuteProviderMethods, FastExecuteAccountMethods>;
|
|
5511
|
+
|
|
5512
|
+
interface RpcProvider extends StarknetIdProviderMethods, BrotherIdProviderMethods, FastExecuteProviderMethods {
|
|
5513
|
+
}
|
|
5322
5514
|
declare class RpcProvider implements ProviderInterface {
|
|
5323
5515
|
responseParser: RPCResponseParser;
|
|
5324
5516
|
channel: RpcChannel$2 | RpcChannel$1 | RpcChannel;
|
|
@@ -5602,6 +5794,8 @@ declare function verifyMessageInStarknet(provider: ProviderInterface, message: B
|
|
|
5602
5794
|
|
|
5603
5795
|
declare function getGasPrices(channel: RpcChannel$2 | RpcChannel$1, blockIdentifier?: BlockIdentifier): Promise<GasPrices>;
|
|
5604
5796
|
|
|
5797
|
+
interface Account extends StarknetIdAccountMethods, BrotherIdProviderMethods, FastExecuteAccountMethods {
|
|
5798
|
+
}
|
|
5605
5799
|
declare class Account implements AccountInterface {
|
|
5606
5800
|
provider: RpcProvider;
|
|
5607
5801
|
signer: SignerInterface;
|
|
@@ -6236,205 +6430,6 @@ declare class Contract implements ContractInterface {
|
|
|
6236
6430
|
static factory(params: FactoryParams, details?: UniversalDetails): Promise<Contract>;
|
|
6237
6431
|
}
|
|
6238
6432
|
|
|
6239
|
-
interface StarknetIdProviderMethods {
|
|
6240
|
-
getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
|
|
6241
|
-
getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
|
|
6242
|
-
getStarkProfile(address: BigNumberish, StarknetIdContract?: string, StarknetIdIdentityContract?: string, StarknetIdVerifierContract?: string, StarknetIdPfpContract?: string, StarknetIdPopContract?: string, StarknetIdMulticallContract?: string): Promise<StarkProfile>;
|
|
6243
|
-
}
|
|
6244
|
-
interface StarknetIdAccountMethods {
|
|
6245
|
-
getStarkName(address?: BigNumberish, StarknetIdContract?: string): Promise<string>;
|
|
6246
|
-
getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
|
|
6247
|
-
getStarkProfile(address: BigNumberish, StarknetIdContract?: string, StarknetIdIdentityContract?: string, StarknetIdVerifierContract?: string, StarknetIdPfpContract?: string, StarknetIdPopContract?: string, StarknetIdMulticallContract?: string): Promise<StarkProfile>;
|
|
6248
|
-
}
|
|
6249
|
-
declare class StarknetIdImpl {
|
|
6250
|
-
static getStarkName(provider: ProviderInterface, address: BigNumberish, StarknetIdContract?: string): Promise<string>;
|
|
6251
|
-
static getAddressFromStarkName(provider: ProviderInterface, name: string, StarknetIdContract?: string): Promise<string>;
|
|
6252
|
-
static getStarkProfile(provider: ProviderInterface, address: BigNumberish, StarknetIdContract?: string, StarknetIdIdentityContract?: string, StarknetIdVerifierContract?: string, StarknetIdPfpContract?: string, StarknetIdPopContract?: string, StarknetIdMulticallContract?: string): Promise<StarkProfile>;
|
|
6253
|
-
}
|
|
6254
|
-
|
|
6255
|
-
interface BrotherProfile {
|
|
6256
|
-
name: string;
|
|
6257
|
-
resolver: string;
|
|
6258
|
-
tokenId: string;
|
|
6259
|
-
expiryDate: number;
|
|
6260
|
-
lastTransferTime: number;
|
|
6261
|
-
}
|
|
6262
|
-
interface BrotherIdProviderMethods {
|
|
6263
|
-
getBrotherName(address: BigNumberish, BrotherIdContract?: string): Promise<string>;
|
|
6264
|
-
getAddressFromBrotherName(name: string, BrotherIdContract?: string): Promise<string>;
|
|
6265
|
-
getBrotherProfile(address: BigNumberish, BrotherIdContract?: string): Promise<BrotherProfile>;
|
|
6266
|
-
}
|
|
6267
|
-
declare class BrotherIdImpl {
|
|
6268
|
-
static getBrotherName(provider: ProviderInterface, address: BigNumberish, BrotherIdContract?: string): Promise<string>;
|
|
6269
|
-
static getAddressFromBrotherName(provider: ProviderInterface, name: string, BrotherIdContract?: string): Promise<string>;
|
|
6270
|
-
static getBrotherProfile(provider: ProviderInterface, address: BigNumberish, BrotherIdContract?: string): Promise<BrotherProfile>;
|
|
6271
|
-
}
|
|
6272
|
-
/**
|
|
6273
|
-
* BrotherId plugin - adds .brother domain resolution methods.
|
|
6274
|
-
*
|
|
6275
|
-
* @example
|
|
6276
|
-
* ```typescript
|
|
6277
|
-
* import { RpcProvider, brotherId } from 'starknet';
|
|
6278
|
-
* const provider = new RpcProvider({ plugins: [brotherId()] });
|
|
6279
|
-
* const name = await provider.getBrotherName('0x123...');
|
|
6280
|
-
* ```
|
|
6281
|
-
*/
|
|
6282
|
-
declare function brotherId(): StarknetPlugin<BrotherIdProviderMethods>;
|
|
6283
|
-
|
|
6284
|
-
declare module '../provider/rpc' {
|
|
6285
|
-
interface RpcProvider extends StarknetIdProviderMethods, BrotherIdProviderMethods {
|
|
6286
|
-
}
|
|
6287
|
-
}
|
|
6288
|
-
declare module '../account/default' {
|
|
6289
|
-
interface Account extends StarknetIdAccountMethods, BrotherIdProviderMethods {
|
|
6290
|
-
}
|
|
6291
|
-
}
|
|
6292
|
-
|
|
6293
|
-
/**
|
|
6294
|
-
* Options for controlling fastWaitForTransaction polling behavior
|
|
6295
|
-
*/
|
|
6296
|
-
type FastWaitForTransactionOptions = {
|
|
6297
|
-
/** Number of retry attempts (default: 50) */
|
|
6298
|
-
retries?: number;
|
|
6299
|
-
/** Milliseconds to wait between retries (default: 500) */
|
|
6300
|
-
retryInterval?: number;
|
|
6301
|
-
};
|
|
6302
|
-
/**
|
|
6303
|
-
* Response from fastExecute() containing transaction result and readiness status
|
|
6304
|
-
*/
|
|
6305
|
-
type FastExecuteResponse = {
|
|
6306
|
-
/** The transaction invoke response with transaction hash */
|
|
6307
|
-
txResult: InvokeFunctionResponse;
|
|
6308
|
-
/** Whether the next transaction can be executed immediately */
|
|
6309
|
-
isReady: boolean;
|
|
6310
|
-
};
|
|
6311
|
-
/**
|
|
6312
|
-
* Provider methods added by the FastExecute plugin
|
|
6313
|
-
*/
|
|
6314
|
-
interface FastExecuteProviderMethods {
|
|
6315
|
-
/**
|
|
6316
|
-
* Wait for transaction confirmation with polling optimization for gaming.
|
|
6317
|
-
*
|
|
6318
|
-
* This method is fast but Events and transaction reports are not yet available.
|
|
6319
|
-
* Useful for gaming activity and rapid-fire transaction scenarios.
|
|
6320
|
-
*
|
|
6321
|
-
* Only available on RPC 0.9 and onwards.
|
|
6322
|
-
*
|
|
6323
|
-
* @param {BigNumberish} txHash - Transaction hash to monitor
|
|
6324
|
-
* @param {string} address - Address of the account (used to track nonce changes)
|
|
6325
|
-
* @param {BigNumberish} initNonce - Initial nonce of the account (before the transaction)
|
|
6326
|
-
* @param {FastWaitForTransactionOptions} [options={retries: 50, retryInterval: 500}] - Polling configuration
|
|
6327
|
-
* options. `retries` is the number of times to retry (default: 50), `retryInterval` is the time in ms
|
|
6328
|
-
* between retries (default: 500).
|
|
6329
|
-
* @returns {Promise<boolean>} Returns true if the next transaction is possible (nonce increment detected),
|
|
6330
|
-
* false if the timeout has been reached, or throws an error in case of provider communication failure
|
|
6331
|
-
* or transaction reversion.
|
|
6332
|
-
*
|
|
6333
|
-
* @example
|
|
6334
|
-
* ```typescript
|
|
6335
|
-
* const isReady = await provider.fastWaitForTransaction(
|
|
6336
|
-
* '0x123abc...',
|
|
6337
|
-
* '0x456def...',
|
|
6338
|
-
* 10,
|
|
6339
|
-
* { retries: 30, retryInterval: 500 }
|
|
6340
|
-
* );
|
|
6341
|
-
*
|
|
6342
|
-
* if (isReady) {
|
|
6343
|
-
* // Next transaction can be sent
|
|
6344
|
-
* }
|
|
6345
|
-
* ```
|
|
6346
|
-
*/
|
|
6347
|
-
fastWaitForTransaction(txHash: BigNumberish, address: string, initNonce: BigNumberish, options?: FastWaitForTransactionOptions): Promise<boolean>;
|
|
6348
|
-
}
|
|
6349
|
-
/**
|
|
6350
|
-
* Account methods added by the FastExecute plugin
|
|
6351
|
-
*/
|
|
6352
|
-
interface FastExecuteAccountMethods {
|
|
6353
|
-
/**
|
|
6354
|
-
* Execute one or multiple calls through the account contract,
|
|
6355
|
-
* responding as soon as a new transaction is possible with the same account.
|
|
6356
|
-
* Useful for gaming usage where rapid consecutive transactions are needed.
|
|
6357
|
-
*
|
|
6358
|
-
* This method requires the provider to be initialized with `pre_confirmed` blockIdentifier option.
|
|
6359
|
-
* RPC 0.9 minimum.
|
|
6360
|
-
*
|
|
6361
|
-
* In a normal `account.execute()` call followed by `provider.waitForTransaction()`, you have immediate access
|
|
6362
|
-
* to the events and transaction report. Here, we process consecutive transactions faster, but events and
|
|
6363
|
-
* transaction reports are not available immediately.
|
|
6364
|
-
*
|
|
6365
|
-
* As a consequence of the above, do not use contract/account deployment with this method.
|
|
6366
|
-
*
|
|
6367
|
-
* @param {AllowArray<Call>} transactions - Single call or array of calls to execute
|
|
6368
|
-
* @param {UniversalDetails} [transactionsDetail] - Transaction execution options
|
|
6369
|
-
* @param {FastWaitForTransactionOptions} [waitDetail={retries: 50, retryInterval: 500}] - Options to scan the
|
|
6370
|
-
* network for the next possible transaction. `retries` is the number of times to retry (default: 50),
|
|
6371
|
-
* `retryInterval` is the time in ms between retries (default: 500).
|
|
6372
|
-
* @returns {Promise<FastExecuteResponse>} Response containing the transaction result and status for the next
|
|
6373
|
-
* transaction. If `isReady` is true, you can execute the next transaction immediately. If false,
|
|
6374
|
-
* timeout has been reached before the next transaction was possible.
|
|
6375
|
-
*
|
|
6376
|
-
* @example
|
|
6377
|
-
* ```typescript
|
|
6378
|
-
* const myProvider = new RpcProvider({
|
|
6379
|
-
* nodeUrl: url,
|
|
6380
|
-
* blockIdentifier: BlockTag.PRE_CONFIRMED
|
|
6381
|
-
* });
|
|
6382
|
-
* const myAccount = new Account({
|
|
6383
|
-
* provider: myProvider,
|
|
6384
|
-
* address: accountAddress0,
|
|
6385
|
-
* signer: privateKey0
|
|
6386
|
-
* });
|
|
6387
|
-
*
|
|
6388
|
-
* const resp = await myAccount.fastExecute(
|
|
6389
|
-
* call,
|
|
6390
|
-
* { tip: recommendedTip },
|
|
6391
|
-
* { retries: 30, retryInterval: 500 }
|
|
6392
|
-
* );
|
|
6393
|
-
*
|
|
6394
|
-
* // if resp.isReady is true, you can launch immediately a new tx
|
|
6395
|
-
* if (resp.isReady) {
|
|
6396
|
-
* // send next transaction
|
|
6397
|
-
* }
|
|
6398
|
-
* ```
|
|
6399
|
-
*/
|
|
6400
|
-
fastExecute(transactions: any, transactionsDetail?: any, waitDetail?: FastWaitForTransactionOptions): Promise<FastExecuteResponse>;
|
|
6401
|
-
}
|
|
6402
|
-
|
|
6403
|
-
/**
|
|
6404
|
-
* FastExecute plugin - adds gaming-optimized transaction execution
|
|
6405
|
-
*
|
|
6406
|
-
* Provides fastExecute() on accounts and fastWaitForTransaction() on providers
|
|
6407
|
-
* for rapid successive transaction execution with minimal confirmation latency.
|
|
6408
|
-
*
|
|
6409
|
-
* Requires:
|
|
6410
|
-
* - RPC 0.9 or later
|
|
6411
|
-
* - Provider initialized with BlockTag.PRE_CONFIRMED
|
|
6412
|
-
*
|
|
6413
|
-
* @example
|
|
6414
|
-
* ```typescript
|
|
6415
|
-
* import { RpcProvider, Account } from 'starknet';
|
|
6416
|
-
* import { fastExecute } from 'starknet/plugins';
|
|
6417
|
-
*
|
|
6418
|
-
* const provider = new RpcProvider({
|
|
6419
|
-
* nodeUrl: url,
|
|
6420
|
-
* blockIdentifier: BlockTag.PRE_CONFIRMED,
|
|
6421
|
-
* });
|
|
6422
|
-
*
|
|
6423
|
-
* const account = new Account({ provider, address, signer });
|
|
6424
|
-
*
|
|
6425
|
-
* const resp = await account.fastExecute(
|
|
6426
|
-
* call,
|
|
6427
|
-
* { tip: recommendedTip },
|
|
6428
|
-
* { retries: 30, retryInterval: 500 }
|
|
6429
|
-
* );
|
|
6430
|
-
*
|
|
6431
|
-
* if (resp.isReady) {
|
|
6432
|
-
* // Next transaction can be sent immediately
|
|
6433
|
-
* }
|
|
6434
|
-
* ```
|
|
6435
|
-
*/
|
|
6436
|
-
declare function fastExecute(): StarknetPlugin<FastExecuteProviderMethods, FastExecuteAccountMethods>;
|
|
6437
|
-
|
|
6438
6433
|
/** Default plugins shipped with the SDK */
|
|
6439
6434
|
declare const defaultPlugins: StarknetPlugin<any, any>[];
|
|
6440
6435
|
|
|
@@ -9293,6 +9288,7 @@ declare class CairoFixedArray {
|
|
|
9293
9288
|
* Cairo fixed array type.
|
|
9294
9289
|
*/
|
|
9295
9290
|
readonly arrayType: string;
|
|
9291
|
+
private static parseFixedArrayType;
|
|
9296
9292
|
/**
|
|
9297
9293
|
* Create an instance representing a Cairo fixed Array.
|
|
9298
9294
|
* @param {any[]} content JS array representing a Cairo fixed array.
|
package/dist/index.global.js
CHANGED
|
@@ -5919,8 +5919,11 @@ ${indent}}` : "}";
|
|
|
5919
5919
|
var isLen = (name) => /_len$/.test(name);
|
|
5920
5920
|
var isTypeFelt = (type) => type === "felt" || type === "core::felt252";
|
|
5921
5921
|
var isTypeArray = (type) => /\*/.test(type) || type.startsWith("core::array::Array::") || type.startsWith("core::array::Span::");
|
|
5922
|
-
var isTypeTuple = (type) =>
|
|
5923
|
-
var isTypeNamedTuple = (type) =>
|
|
5922
|
+
var isTypeTuple = (type) => type.startsWith("(") && type.endsWith(")");
|
|
5923
|
+
var isTypeNamedTuple = (type) => {
|
|
5924
|
+
const start = type.indexOf("(");
|
|
5925
|
+
return start !== -1 && type.indexOf(")", start + 1) !== -1 && type.includes(":");
|
|
5926
|
+
};
|
|
5924
5927
|
var isTypeStruct = (type, structs) => type in structs;
|
|
5925
5928
|
var isTypeEnum = (type, enums) => type in enums;
|
|
5926
5929
|
var isTypeOption = (type) => type.startsWith("core::option::Option::");
|
|
@@ -5936,7 +5939,7 @@ ${indent}}` : "}";
|
|
|
5936
5939
|
var isTypeSecp256k1Point = (type) => type === Literal.Secp256k1Point;
|
|
5937
5940
|
var isCairo1Type = (type) => type.includes("::");
|
|
5938
5941
|
var getArrayType = (type) => {
|
|
5939
|
-
return isCairo1Type(type) ? type.substring(type.indexOf("<") + 1, type.lastIndexOf(">")) : type.
|
|
5942
|
+
return isCairo1Type(type) ? type.substring(type.indexOf("<") + 1, type.lastIndexOf(">")) : type.replaceAll("*", "");
|
|
5940
5943
|
};
|
|
5941
5944
|
function isCairo1Abi(abi) {
|
|
5942
5945
|
const { cairo } = getAbiContractVersion(abi);
|
|
@@ -7737,6 +7740,18 @@ ${indent}}` : "}";
|
|
|
7737
7740
|
* Cairo fixed array type.
|
|
7738
7741
|
*/
|
|
7739
7742
|
arrayType;
|
|
7743
|
+
static parseFixedArrayType(type) {
|
|
7744
|
+
if (!type.startsWith("[") || !type.endsWith("]")) {
|
|
7745
|
+
return void 0;
|
|
7746
|
+
}
|
|
7747
|
+
const separator = type.lastIndexOf("; ");
|
|
7748
|
+
const itemType = type.slice(1, separator);
|
|
7749
|
+
const size = type.slice(separator + 2, -1);
|
|
7750
|
+
if (separator <= 1 || size.length === 0 || ![...size].every((char) => char >= "0" && char <= "9")) {
|
|
7751
|
+
return void 0;
|
|
7752
|
+
}
|
|
7753
|
+
return { itemType, size };
|
|
7754
|
+
}
|
|
7740
7755
|
/**
|
|
7741
7756
|
* Create an instance representing a Cairo fixed Array.
|
|
7742
7757
|
* @param {any[]} content JS array representing a Cairo fixed array.
|
|
@@ -7780,10 +7795,10 @@ ${indent}}` : "}";
|
|
|
7780
7795
|
* ```
|
|
7781
7796
|
*/
|
|
7782
7797
|
static getFixedArraySize(type) {
|
|
7783
|
-
const
|
|
7784
|
-
if (
|
|
7798
|
+
const fixedArrayType = _CairoFixedArray.parseFixedArrayType(type);
|
|
7799
|
+
if (!fixedArrayType)
|
|
7785
7800
|
throw new Error(`ABI type ${type} do not includes a valid number after ';' character.`);
|
|
7786
|
-
return Number(
|
|
7801
|
+
return Number(fixedArrayType.size);
|
|
7787
7802
|
}
|
|
7788
7803
|
/**
|
|
7789
7804
|
* Retrieves the Cairo fixed array size from the CairoFixedArray instance.
|
|
@@ -7809,10 +7824,9 @@ ${indent}}` : "}";
|
|
|
7809
7824
|
* ```
|
|
7810
7825
|
*/
|
|
7811
7826
|
static getFixedArrayType = (type) => {
|
|
7812
|
-
const
|
|
7813
|
-
if (
|
|
7814
|
-
|
|
7815
|
-
return matchArray[0];
|
|
7827
|
+
const fixedArrayType = _CairoFixedArray.parseFixedArrayType(type);
|
|
7828
|
+
if (!fixedArrayType) throw new Error(`ABI type ${type} do not includes a valid type of data.`);
|
|
7829
|
+
return fixedArrayType.itemType;
|
|
7816
7830
|
};
|
|
7817
7831
|
/**
|
|
7818
7832
|
* Retrieve the Cairo content type of the Cairo fixed array.
|
|
@@ -7870,7 +7884,7 @@ ${indent}}` : "}";
|
|
|
7870
7884
|
* // result = true
|
|
7871
7885
|
*/
|
|
7872
7886
|
static isTypeFixedArray(type) {
|
|
7873
|
-
return
|
|
7887
|
+
return _CairoFixedArray.parseFixedArrayType(type) !== void 0;
|
|
7874
7888
|
}
|
|
7875
7889
|
};
|
|
7876
7890
|
|
|
@@ -8538,7 +8552,7 @@ ${indent}}` : "}";
|
|
|
8538
8552
|
parsedDataArr.push(
|
|
8539
8553
|
parseResponseValue(
|
|
8540
8554
|
responseIterator,
|
|
8541
|
-
{ name, type: output.type.
|
|
8555
|
+
{ name, type: output.type.replaceAll("*", "") },
|
|
8542
8556
|
parser,
|
|
8543
8557
|
structs,
|
|
8544
8558
|
enums
|
|
@@ -11263,18 +11277,20 @@ ${indent}}` : "}";
|
|
|
11263
11277
|
}
|
|
11264
11278
|
async fetchEndpoint(method, params) {
|
|
11265
11279
|
try {
|
|
11280
|
+
let error;
|
|
11281
|
+
let result;
|
|
11266
11282
|
if (this.batchClient) {
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
);
|
|
11272
|
-
this.errorHandler(method, params, error2);
|
|
11273
|
-
return result2;
|
|
11283
|
+
({ error, result } = await this.batchClient.fetch(method, params, this.requestId += 1));
|
|
11284
|
+
} else {
|
|
11285
|
+
const rawResult = await this.fetch(method, params, this.requestId += 1);
|
|
11286
|
+
({ error, result } = await rawResult.json());
|
|
11274
11287
|
}
|
|
11275
|
-
const rawResult = await this.fetch(method, params, this.requestId += 1);
|
|
11276
|
-
const { error, result } = await rawResult.json();
|
|
11277
11288
|
this.errorHandler(method, params, error);
|
|
11289
|
+
if (result === void 0) {
|
|
11290
|
+
throw new LibraryError(
|
|
11291
|
+
`RPC: '${method}' returned an empty response (no result and no error). The node reply is malformed or not a valid JSON-RPC response.`
|
|
11292
|
+
);
|
|
11293
|
+
}
|
|
11278
11294
|
return result;
|
|
11279
11295
|
} catch (error) {
|
|
11280
11296
|
this.errorHandler(method, params, error?.response?.data, error);
|
|
@@ -11902,18 +11918,20 @@ ${indent}}` : "}";
|
|
|
11902
11918
|
}
|
|
11903
11919
|
async fetchEndpoint(method, params) {
|
|
11904
11920
|
try {
|
|
11921
|
+
let error;
|
|
11922
|
+
let result;
|
|
11905
11923
|
if (this.batchClient) {
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
);
|
|
11911
|
-
this.errorHandler(method, params, error2);
|
|
11912
|
-
return result2;
|
|
11924
|
+
({ error, result } = await this.batchClient.fetch(method, params, this.requestId += 1));
|
|
11925
|
+
} else {
|
|
11926
|
+
const rawResult = await this.fetch(method, params, this.requestId += 1);
|
|
11927
|
+
({ error, result } = await rawResult.json());
|
|
11913
11928
|
}
|
|
11914
|
-
const rawResult = await this.fetch(method, params, this.requestId += 1);
|
|
11915
|
-
const { error, result } = await rawResult.json();
|
|
11916
11929
|
this.errorHandler(method, params, error);
|
|
11930
|
+
if (result === void 0) {
|
|
11931
|
+
throw new LibraryError(
|
|
11932
|
+
`RPC: '${method}' returned an empty response (no result and no error). The node reply is malformed or not a valid JSON-RPC response.`
|
|
11933
|
+
);
|
|
11934
|
+
}
|
|
11917
11935
|
return result;
|
|
11918
11936
|
} catch (error) {
|
|
11919
11937
|
this.errorHandler(method, params, error?.response?.data, error);
|
|
@@ -14229,7 +14247,19 @@ ${indent}}` : "}";
|
|
|
14229
14247
|
});
|
|
14230
14248
|
}
|
|
14231
14249
|
function isStarkDomain(domain) {
|
|
14232
|
-
|
|
14250
|
+
const starkSuffix = ".stark";
|
|
14251
|
+
if (!domain.endsWith(starkSuffix)) {
|
|
14252
|
+
return false;
|
|
14253
|
+
}
|
|
14254
|
+
const name = domain.slice(0, -starkSuffix.length);
|
|
14255
|
+
if (name.length === 0) {
|
|
14256
|
+
return false;
|
|
14257
|
+
}
|
|
14258
|
+
return name.split(".").every((label) => {
|
|
14259
|
+
return label.length > 0 && label.length <= 48 && [...label].every((char) => {
|
|
14260
|
+
return char >= "a" && char <= "z" || char >= "0" && char <= "9" || char === "-";
|
|
14261
|
+
});
|
|
14262
|
+
});
|
|
14233
14263
|
}
|
|
14234
14264
|
|
|
14235
14265
|
// src/plugins/starknet-id/index.ts
|