@solana/web3.js 1.52.0 → 1.54.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/lib/index.browser.cjs.js +6188 -7481
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +6183 -7482
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +6219 -7531
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +957 -832
- package/lib/index.esm.js +6214 -7532
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +20976 -27402
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +8 -5
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +6188 -7480
- package/lib/index.native.js.map +1 -1
- package/package.json +5 -7
- package/src/account-data.ts +39 -0
- package/src/account.ts +19 -10
- package/src/connection.ts +40 -14
- package/src/index.ts +3 -14
- package/src/keypair.ts +19 -24
- package/src/layout.ts +7 -0
- package/src/loader.ts +4 -5
- package/src/message/index.ts +45 -0
- package/src/{message.ts → message/legacy.ts} +46 -27
- package/src/message/v0.ts +324 -0
- package/src/message/versioned.ts +27 -0
- package/src/nonce-account.ts +1 -1
- package/src/{address-lookup-table-program.ts → programs/address-lookup-table/index.ts} +8 -6
- package/src/programs/address-lookup-table/state.ts +84 -0
- package/src/{compute-budget.ts → programs/compute-budget.ts} +4 -4
- package/src/{ed25519-program.ts → programs/ed25519.ts} +6 -6
- package/src/programs/index.ts +7 -0
- package/src/{secp256k1-program.ts → programs/secp256k1.ts} +10 -9
- package/src/{stake-program.ts → programs/stake.ts} +7 -7
- package/src/{system-program.ts → programs/system.ts} +8 -8
- package/src/{vote-program.ts → programs/vote.ts} +28 -7
- package/src/publickey.ts +16 -75
- package/src/{transaction-constants.ts → transaction/constants.ts} +2 -0
- package/src/{util/tx-expiry-custom-errors.ts → transaction/expiry-custom-errors.ts} +0 -0
- package/src/transaction/index.ts +4 -0
- package/src/{transaction.ts → transaction/legacy.ts} +13 -18
- package/src/transaction/versioned.ts +105 -0
- package/src/{util → utils}/assert.ts +0 -0
- package/src/{util → utils}/bigint.ts +0 -0
- package/src/{util → utils}/borsh-schema.ts +0 -0
- package/src/{util → utils}/cluster.ts +0 -0
- package/src/utils/ed25519.ts +46 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/makeWebsocketUrl.ts +26 -0
- package/src/{util → utils}/promise-timeout.ts +0 -0
- package/src/utils/secp256k1.ts +18 -0
- package/src/{util → utils}/send-and-confirm-raw-transaction.ts +0 -0
- package/src/{util → utils}/send-and-confirm-transaction.ts +0 -0
- package/src/{util → utils}/shortvec-encoding.ts +0 -0
- package/src/{util → utils}/sleep.ts +0 -0
- package/src/{util → utils}/to-buffer.ts +0 -0
- package/src/validator-info.ts +4 -6
- package/src/vote-account.ts +1 -1
- package/src/util/__forks__/react-native/url-impl.ts +0 -2
- package/src/util/makeWebsocketUrl.ts +0 -20
- package/src/util/url-impl.ts +0 -2
package/lib/index.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ declare module '@solana/web3.js' {
|
|
|
19
19
|
* Maximum length of derived pubkey seed
|
|
20
20
|
*/
|
|
21
21
|
export const MAX_SEED_LENGTH = 32;
|
|
22
|
+
/**
|
|
23
|
+
* Size of public key in bytes
|
|
24
|
+
*/
|
|
25
|
+
export const PUBLIC_KEY_LENGTH = 32;
|
|
22
26
|
/**
|
|
23
27
|
* Value to be converted into public key
|
|
24
28
|
*/
|
|
@@ -137,11 +141,20 @@ declare module '@solana/web3.js' {
|
|
|
137
141
|
*/
|
|
138
142
|
get publicKey(): PublicKey;
|
|
139
143
|
/**
|
|
140
|
-
* The **unencrypted** secret key for this account
|
|
144
|
+
* The **unencrypted** secret key for this account. The first 32 bytes
|
|
145
|
+
* is the private scalar and the last 32 bytes is the public key.
|
|
146
|
+
* Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
|
|
141
147
|
*/
|
|
142
148
|
get secretKey(): Buffer;
|
|
143
149
|
}
|
|
144
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Blockhash as Base58 string.
|
|
153
|
+
*/
|
|
154
|
+
export type Blockhash = string;
|
|
155
|
+
|
|
156
|
+
export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
|
|
157
|
+
|
|
145
158
|
/**
|
|
146
159
|
* Epoch schedule
|
|
147
160
|
* (see https://docs.solana.com/terminology#epoch)
|
|
@@ -177,11 +190,6 @@ declare module '@solana/web3.js' {
|
|
|
177
190
|
init?: nodeFetch.RequestInit,
|
|
178
191
|
): Promise<nodeFetch.Response>;
|
|
179
192
|
|
|
180
|
-
/**
|
|
181
|
-
* Blockhash as Base58 string.
|
|
182
|
-
*/
|
|
183
|
-
export type Blockhash = string;
|
|
184
|
-
|
|
185
193
|
/**
|
|
186
194
|
* Calculator for transaction fees.
|
|
187
195
|
*
|
|
@@ -212,17 +220,24 @@ declare module '@solana/web3.js' {
|
|
|
212
220
|
}
|
|
213
221
|
|
|
214
222
|
/**
|
|
215
|
-
*
|
|
223
|
+
* A 64 byte secret key, the first 32 bytes of which is the
|
|
224
|
+
* private scalar and the last 32 bytes is the public key.
|
|
225
|
+
* Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
|
|
216
226
|
*/
|
|
217
|
-
|
|
218
|
-
publicKey: PublicKey;
|
|
219
|
-
secretKey: Uint8Array;
|
|
220
|
-
}
|
|
227
|
+
export type Ed25519SecretKey = Uint8Array;
|
|
221
228
|
/**
|
|
222
229
|
* Ed25519 Keypair
|
|
223
230
|
*/
|
|
224
231
|
interface Ed25519Keypair {
|
|
225
232
|
publicKey: Uint8Array;
|
|
233
|
+
secretKey: Ed25519SecretKey;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Keypair signer interface
|
|
238
|
+
*/
|
|
239
|
+
interface Signer {
|
|
240
|
+
publicKey: PublicKey;
|
|
226
241
|
secretKey: Uint8Array;
|
|
227
242
|
}
|
|
228
243
|
/**
|
|
@@ -276,19 +291,25 @@ declare module '@solana/web3.js' {
|
|
|
276
291
|
}
|
|
277
292
|
|
|
278
293
|
/**
|
|
279
|
-
*
|
|
294
|
+
* Maximum over-the-wire size of a Transaction
|
|
295
|
+
*
|
|
296
|
+
* 1280 is IPv6 minimum MTU
|
|
297
|
+
* 40 bytes is the size of the IPv6 header
|
|
298
|
+
* 8 bytes is the size of the fragment header
|
|
280
299
|
*/
|
|
281
|
-
export
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
300
|
+
export const PACKET_DATA_SIZE: number;
|
|
301
|
+
export const VERSION_PREFIX_MASK = 127;
|
|
302
|
+
export const SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
303
|
+
|
|
304
|
+
export class TransactionExpiredBlockheightExceededError extends Error {
|
|
305
|
+
signature: string;
|
|
306
|
+
constructor(signature: string);
|
|
307
|
+
}
|
|
308
|
+
export class TransactionExpiredTimeoutError extends Error {
|
|
309
|
+
signature: string;
|
|
310
|
+
constructor(signature: string, timeoutSeconds: number);
|
|
311
|
+
}
|
|
312
|
+
|
|
292
313
|
/**
|
|
293
314
|
* An instruction to execute by a program
|
|
294
315
|
*
|
|
@@ -327,6 +348,10 @@ declare module '@solana/web3.js' {
|
|
|
327
348
|
instructions: CompiledInstruction[];
|
|
328
349
|
private indexToProgramIds;
|
|
329
350
|
constructor(args: MessageArgs);
|
|
351
|
+
get version(): 'legacy';
|
|
352
|
+
get staticAccountKeys(): Array<PublicKey>;
|
|
353
|
+
get compiledInstructions(): Array<MessageCompiledInstruction>;
|
|
354
|
+
get addressTableLookups(): Array<MessageAddressTableLookup>;
|
|
330
355
|
isAccountSigner(index: number): boolean;
|
|
331
356
|
isAccountWritable(index: number): boolean;
|
|
332
357
|
isProgramId(index: number): boolean;
|
|
@@ -339,243 +364,564 @@ declare module '@solana/web3.js' {
|
|
|
339
364
|
static from(buffer: Buffer | Uint8Array | Array<number>): Message;
|
|
340
365
|
}
|
|
341
366
|
|
|
342
|
-
export type ClientSubscriptionId = number;
|
|
343
|
-
export type TokenAccountsFilter =
|
|
344
|
-
| {
|
|
345
|
-
mint: PublicKey;
|
|
346
|
-
}
|
|
347
|
-
| {
|
|
348
|
-
programId: PublicKey;
|
|
349
|
-
};
|
|
350
|
-
/**
|
|
351
|
-
* Extra contextual information for RPC responses
|
|
352
|
-
*/
|
|
353
|
-
export type Context = {
|
|
354
|
-
slot: number;
|
|
355
|
-
};
|
|
356
367
|
/**
|
|
357
|
-
*
|
|
368
|
+
* Message constructor arguments
|
|
358
369
|
*/
|
|
359
|
-
export type
|
|
360
|
-
/**
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
|
|
370
|
+
export type MessageV0Args = {
|
|
371
|
+
/** The message header, identifying signed and read-only `accountKeys` */
|
|
372
|
+
header: MessageHeader;
|
|
373
|
+
/** The static account keys used by this transaction */
|
|
374
|
+
staticAccountKeys: PublicKey[];
|
|
375
|
+
/** The hash of a recent ledger block */
|
|
376
|
+
recentBlockhash: Blockhash;
|
|
377
|
+
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
|
|
378
|
+
compiledInstructions: MessageCompiledInstruction[];
|
|
379
|
+
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
|
|
380
|
+
addressTableLookups: MessageAddressTableLookup[];
|
|
368
381
|
};
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
export class MessageV0 {
|
|
383
|
+
header: MessageHeader;
|
|
384
|
+
staticAccountKeys: Array<PublicKey>;
|
|
385
|
+
recentBlockhash: Blockhash;
|
|
386
|
+
compiledInstructions: Array<MessageCompiledInstruction>;
|
|
387
|
+
addressTableLookups: Array<MessageAddressTableLookup>;
|
|
388
|
+
constructor(args: MessageV0Args);
|
|
389
|
+
get version(): 0;
|
|
390
|
+
serialize(): Uint8Array;
|
|
391
|
+
private serializeInstructions;
|
|
392
|
+
private serializeAddressTableLookups;
|
|
393
|
+
static deserialize(serializedMessage: Uint8Array): MessageV0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export type VersionedMessage = Message | MessageV0;
|
|
397
|
+
export const VersionedMessage: {
|
|
398
|
+
deserialize: (serializedMessage: Uint8Array) => VersionedMessage;
|
|
383
399
|
};
|
|
400
|
+
|
|
384
401
|
/**
|
|
385
|
-
*
|
|
402
|
+
* The message header, identifying signed and read-only account
|
|
386
403
|
*/
|
|
387
|
-
export type
|
|
404
|
+
export type MessageHeader = {
|
|
388
405
|
/**
|
|
389
|
-
*
|
|
390
|
-
*
|
|
406
|
+
* The number of signatures required for this message to be considered valid. The
|
|
407
|
+
* signatures must match the first `numRequiredSignatures` of `accountKeys`.
|
|
391
408
|
*/
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
|
|
409
|
+
numRequiredSignatures: number;
|
|
410
|
+
/** The last `numReadonlySignedAccounts` of the signed keys are read-only accounts */
|
|
411
|
+
numReadonlySignedAccounts: number;
|
|
412
|
+
/** The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts */
|
|
413
|
+
numReadonlyUnsignedAccounts: number;
|
|
397
414
|
};
|
|
398
415
|
/**
|
|
399
|
-
*
|
|
416
|
+
* An address table lookup used to load additional accounts
|
|
400
417
|
*/
|
|
401
|
-
export type
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
*/
|
|
406
|
-
before?: TransactionSignature;
|
|
407
|
-
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
408
|
-
until?: TransactionSignature;
|
|
409
|
-
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
410
|
-
limit?: number;
|
|
411
|
-
/** The minimum slot that the request can be evaluated at */
|
|
412
|
-
minContextSlot?: number;
|
|
418
|
+
export type MessageAddressTableLookup = {
|
|
419
|
+
accountKey: PublicKey;
|
|
420
|
+
writableIndexes: Array<number>;
|
|
421
|
+
readonlyIndexes: Array<number>;
|
|
413
422
|
};
|
|
414
423
|
/**
|
|
415
|
-
*
|
|
424
|
+
* An instruction to execute by a program
|
|
425
|
+
*
|
|
426
|
+
* @property {number} programIdIndex
|
|
427
|
+
* @property {number[]} accountKeyIndexes
|
|
428
|
+
* @property {Uint8Array} data
|
|
416
429
|
*/
|
|
417
|
-
export type
|
|
418
|
-
/**
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
|
|
430
|
+
export type MessageCompiledInstruction = {
|
|
431
|
+
/** Index into the transaction keys array indicating the program account that executes this instruction */
|
|
432
|
+
programIdIndex: number;
|
|
433
|
+
/** Ordered indices into the transaction keys array indicating which accounts to pass to the program */
|
|
434
|
+
accountKeyIndexes: number[];
|
|
435
|
+
/** The program input data */
|
|
436
|
+
data: Uint8Array;
|
|
422
437
|
};
|
|
423
|
-
|
|
424
|
-
blockhash: Blockhash;
|
|
425
|
-
lastValidBlockHeight: number;
|
|
426
|
-
}>;
|
|
427
|
-
/**
|
|
428
|
-
* A strategy for confirming transactions that uses the last valid
|
|
429
|
-
* block height for a given blockhash to check for transaction expiration.
|
|
430
|
-
*/
|
|
431
|
-
export type BlockheightBasedTransactionConfirmationStrategy = {
|
|
432
|
-
signature: TransactionSignature;
|
|
433
|
-
} & BlockhashWithExpiryBlockHeight;
|
|
438
|
+
|
|
434
439
|
/**
|
|
435
|
-
*
|
|
436
|
-
* <pre>
|
|
437
|
-
* 'processed': Query the most recent block which has reached 1 confirmation by the connected node
|
|
438
|
-
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
439
|
-
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
440
|
-
* </pre>
|
|
440
|
+
* Transaction signature as base-58 encoded string
|
|
441
441
|
*/
|
|
442
|
-
export type
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
| 'singleGossip'
|
|
449
|
-
| 'root'
|
|
450
|
-
| 'max';
|
|
442
|
+
export type TransactionSignature = string;
|
|
443
|
+
export const enum TransactionStatus {
|
|
444
|
+
BLOCKHEIGHT_EXCEEDED = 0,
|
|
445
|
+
PROCESSED = 1,
|
|
446
|
+
TIMED_OUT = 2,
|
|
447
|
+
}
|
|
451
448
|
/**
|
|
452
|
-
*
|
|
453
|
-
* <pre>
|
|
454
|
-
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
455
|
-
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
456
|
-
* </pre>
|
|
449
|
+
* Account metadata used to define instructions
|
|
457
450
|
*/
|
|
458
|
-
export type
|
|
451
|
+
export type AccountMeta = {
|
|
452
|
+
/** An account's public key */
|
|
453
|
+
pubkey: PublicKey;
|
|
454
|
+
/** True if an instruction requires a transaction signature matching `pubkey` */
|
|
455
|
+
isSigner: boolean;
|
|
456
|
+
/** True if the `pubkey` can be loaded as a read-write account. */
|
|
457
|
+
isWritable: boolean;
|
|
458
|
+
};
|
|
459
459
|
/**
|
|
460
|
-
*
|
|
461
|
-
* <pre>
|
|
462
|
-
* 'circulating': Return the largest accounts that are part of the circulating supply
|
|
463
|
-
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
464
|
-
* </pre>
|
|
460
|
+
* List of TransactionInstruction object fields that may be initialized at construction
|
|
465
461
|
*/
|
|
466
|
-
export type
|
|
462
|
+
export type TransactionInstructionCtorFields = {
|
|
463
|
+
keys: Array<AccountMeta>;
|
|
464
|
+
programId: PublicKey;
|
|
465
|
+
data?: Buffer;
|
|
466
|
+
};
|
|
467
467
|
/**
|
|
468
|
-
* Configuration object for
|
|
468
|
+
* Configuration object for Transaction.serialize()
|
|
469
469
|
*/
|
|
470
|
-
export type
|
|
471
|
-
/**
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
|
|
470
|
+
export type SerializeConfig = {
|
|
471
|
+
/** Require all transaction signatures be present (default: true) */
|
|
472
|
+
requireAllSignatures?: boolean;
|
|
473
|
+
/** Verify provided signatures (default: true) */
|
|
474
|
+
verifySignatures?: boolean;
|
|
475
475
|
};
|
|
476
476
|
/**
|
|
477
|
-
*
|
|
477
|
+
* Transaction Instruction class
|
|
478
478
|
*/
|
|
479
|
-
export
|
|
480
|
-
/**
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
479
|
+
export class TransactionInstruction {
|
|
480
|
+
/**
|
|
481
|
+
* Public keys to include in this transaction
|
|
482
|
+
* Boolean represents whether this pubkey needs to sign the transaction
|
|
483
|
+
*/
|
|
484
|
+
keys: Array<AccountMeta>;
|
|
485
|
+
/**
|
|
486
|
+
* Program Id to execute
|
|
487
|
+
*/
|
|
488
|
+
programId: PublicKey;
|
|
489
|
+
/**
|
|
490
|
+
* Program input
|
|
491
|
+
*/
|
|
492
|
+
data: Buffer;
|
|
493
|
+
constructor(opts: TransactionInstructionCtorFields);
|
|
494
|
+
}
|
|
485
495
|
/**
|
|
486
|
-
*
|
|
496
|
+
* Pair of signature and corresponding public key
|
|
487
497
|
*/
|
|
488
|
-
export type
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
|
|
492
|
-
maxSupportedTransactionVersion?: number;
|
|
498
|
+
export type SignaturePubkeyPair = {
|
|
499
|
+
signature: Buffer | null;
|
|
500
|
+
publicKey: PublicKey;
|
|
493
501
|
};
|
|
494
502
|
/**
|
|
495
|
-
*
|
|
503
|
+
* List of Transaction object fields that may be initialized at construction
|
|
496
504
|
*/
|
|
497
|
-
export type
|
|
498
|
-
/**
|
|
499
|
-
|
|
505
|
+
export type TransactionCtorFields_DEPRECATED = {
|
|
506
|
+
/** Optional nonce information used for offline nonce'd transactions */
|
|
507
|
+
nonceInfo?: NonceInformation | null;
|
|
508
|
+
/** The transaction fee payer */
|
|
509
|
+
feePayer?: PublicKey | null;
|
|
510
|
+
/** One or more signatures */
|
|
511
|
+
signatures?: Array<SignaturePubkeyPair>;
|
|
512
|
+
/** A recent blockhash */
|
|
513
|
+
recentBlockhash?: Blockhash;
|
|
500
514
|
};
|
|
515
|
+
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
|
|
501
516
|
/**
|
|
502
|
-
*
|
|
517
|
+
* List of Transaction object fields that may be initialized at construction
|
|
503
518
|
*/
|
|
504
|
-
export type
|
|
505
|
-
/** The
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
|
|
519
|
+
export type TransactionBlockhashCtor = {
|
|
520
|
+
/** The transaction fee payer */
|
|
521
|
+
feePayer?: PublicKey | null;
|
|
522
|
+
/** One or more signatures */
|
|
523
|
+
signatures?: Array<SignaturePubkeyPair>;
|
|
524
|
+
/** A recent blockhash */
|
|
525
|
+
blockhash: Blockhash;
|
|
526
|
+
/** the last block chain can advance to before tx is exportd expired */
|
|
527
|
+
lastValidBlockHeight: number;
|
|
509
528
|
};
|
|
510
529
|
/**
|
|
511
|
-
*
|
|
530
|
+
* Nonce information to be used to build an offline Transaction.
|
|
512
531
|
*/
|
|
513
|
-
export type
|
|
514
|
-
/** The
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
|
|
532
|
+
export type NonceInformation = {
|
|
533
|
+
/** The current blockhash stored in the nonce */
|
|
534
|
+
nonce: Blockhash;
|
|
535
|
+
/** AdvanceNonceAccount Instruction */
|
|
536
|
+
nonceInstruction: TransactionInstruction;
|
|
518
537
|
};
|
|
519
538
|
/**
|
|
520
|
-
*
|
|
539
|
+
* Transaction class
|
|
521
540
|
*/
|
|
522
|
-
export
|
|
523
|
-
/**
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
541
|
+
export class Transaction {
|
|
542
|
+
/**
|
|
543
|
+
* Signatures for the transaction. Typically created by invoking the
|
|
544
|
+
* `sign()` method
|
|
545
|
+
*/
|
|
546
|
+
signatures: Array<SignaturePubkeyPair>;
|
|
547
|
+
/**
|
|
548
|
+
* The first (payer) Transaction signature
|
|
549
|
+
*/
|
|
550
|
+
get signature(): Buffer | null;
|
|
551
|
+
/**
|
|
552
|
+
* The transaction fee payer
|
|
553
|
+
*/
|
|
554
|
+
feePayer?: PublicKey;
|
|
555
|
+
/**
|
|
556
|
+
* The instructions to atomically execute
|
|
557
|
+
*/
|
|
558
|
+
instructions: Array<TransactionInstruction>;
|
|
559
|
+
/**
|
|
560
|
+
* A recent transaction id. Must be populated by the caller
|
|
561
|
+
*/
|
|
562
|
+
recentBlockhash?: Blockhash;
|
|
563
|
+
/**
|
|
564
|
+
* the last block chain can advance to before tx is exportd expired
|
|
565
|
+
* */
|
|
566
|
+
lastValidBlockHeight?: number;
|
|
567
|
+
/**
|
|
568
|
+
* Optional Nonce information. If populated, transaction will use a durable
|
|
569
|
+
* Nonce hash instead of a recentBlockhash. Must be populated by the caller
|
|
570
|
+
*/
|
|
571
|
+
nonceInfo?: NonceInformation;
|
|
572
|
+
constructor(opts?: TransactionBlockhashCtor);
|
|
573
|
+
/**
|
|
574
|
+
* @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.
|
|
575
|
+
* Please supply a `TransactionBlockhashCtor` instead.
|
|
576
|
+
*/
|
|
577
|
+
constructor(opts?: TransactionCtorFields_DEPRECATED);
|
|
578
|
+
/**
|
|
579
|
+
* Add one or more instructions to this Transaction
|
|
580
|
+
*/
|
|
581
|
+
add(
|
|
582
|
+
...items: Array<
|
|
583
|
+
Transaction | TransactionInstruction | TransactionInstructionCtorFields
|
|
584
|
+
>
|
|
585
|
+
): Transaction;
|
|
586
|
+
/**
|
|
587
|
+
* Compile transaction data
|
|
588
|
+
*/
|
|
589
|
+
compileMessage(): Message;
|
|
590
|
+
/**
|
|
591
|
+
* Get a buffer of the Transaction data that need to be covered by signatures
|
|
592
|
+
*/
|
|
593
|
+
serializeMessage(): Buffer;
|
|
594
|
+
/**
|
|
595
|
+
* Get the estimated fee associated with a transaction
|
|
596
|
+
*/
|
|
597
|
+
getEstimatedFee(connection: Connection): Promise<number>;
|
|
598
|
+
/**
|
|
599
|
+
* Specify the public keys which will be used to sign the Transaction.
|
|
600
|
+
* The first signer will be used as the transaction fee payer account.
|
|
601
|
+
*
|
|
602
|
+
* Signatures can be added with either `partialSign` or `addSignature`
|
|
603
|
+
*
|
|
604
|
+
* @deprecated Deprecated since v0.84.0. Only the fee payer needs to be
|
|
605
|
+
* specified and it can be set in the Transaction constructor or with the
|
|
606
|
+
* `feePayer` property.
|
|
607
|
+
*/
|
|
608
|
+
setSigners(...signers: Array<PublicKey>): void;
|
|
609
|
+
/**
|
|
610
|
+
* Sign the Transaction with the specified signers. Multiple signatures may
|
|
611
|
+
* be applied to a Transaction. The first signature is considered "primary"
|
|
612
|
+
* and is used identify and confirm transactions.
|
|
613
|
+
*
|
|
614
|
+
* If the Transaction `feePayer` is not set, the first signer will be used
|
|
615
|
+
* as the transaction fee payer account.
|
|
616
|
+
*
|
|
617
|
+
* Transaction fields should not be modified after the first call to `sign`,
|
|
618
|
+
* as doing so may invalidate the signature and cause the Transaction to be
|
|
619
|
+
* rejected.
|
|
620
|
+
*
|
|
621
|
+
* The Transaction must be assigned a valid `recentBlockhash` before invoking this method
|
|
622
|
+
*/
|
|
623
|
+
sign(...signers: Array<Signer>): void;
|
|
624
|
+
/**
|
|
625
|
+
* Partially sign a transaction with the specified accounts. All accounts must
|
|
626
|
+
* correspond to either the fee payer or a signer account in the transaction
|
|
627
|
+
* instructions.
|
|
628
|
+
*
|
|
629
|
+
* All the caveats from the `sign` method apply to `partialSign`
|
|
630
|
+
*/
|
|
631
|
+
partialSign(...signers: Array<Signer>): void;
|
|
632
|
+
/**
|
|
633
|
+
* Add an externally created signature to a transaction. The public key
|
|
634
|
+
* must correspond to either the fee payer or a signer account in the transaction
|
|
635
|
+
* instructions.
|
|
636
|
+
*/
|
|
637
|
+
addSignature(pubkey: PublicKey, signature: Buffer): void;
|
|
638
|
+
/**
|
|
639
|
+
* Verify signatures of a complete, signed Transaction
|
|
640
|
+
*/
|
|
641
|
+
verifySignatures(): boolean;
|
|
642
|
+
/**
|
|
643
|
+
* Serialize the Transaction in the wire format.
|
|
644
|
+
*/
|
|
645
|
+
serialize(config?: SerializeConfig): Buffer;
|
|
646
|
+
/**
|
|
647
|
+
* Parse a wire transaction into a Transaction object.
|
|
648
|
+
*/
|
|
649
|
+
static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
|
|
650
|
+
/**
|
|
651
|
+
* Populate Transaction object from message and signatures
|
|
652
|
+
*/
|
|
653
|
+
static populate(message: Message, signatures?: Array<string>): Transaction;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export type TransactionVersion = 'legacy' | 0;
|
|
657
|
+
/**
|
|
658
|
+
* Versioned transaction class
|
|
659
|
+
*/
|
|
660
|
+
export class VersionedTransaction {
|
|
661
|
+
signatures: Array<Uint8Array>;
|
|
662
|
+
message: VersionedMessage;
|
|
663
|
+
constructor(message: VersionedMessage, signatures?: Array<Uint8Array>);
|
|
664
|
+
serialize(): Uint8Array;
|
|
665
|
+
static deserialize(serializedTransaction: Uint8Array): VersionedTransaction;
|
|
666
|
+
sign(signers: Array<Signer>): void;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export type AddressLookupTableState = {
|
|
670
|
+
deactivationSlot: bigint;
|
|
671
|
+
lastExtendedSlot: number;
|
|
672
|
+
lastExtendedSlotStartIndex: number;
|
|
673
|
+
authority?: PublicKey;
|
|
674
|
+
addresses: Array<PublicKey>;
|
|
675
|
+
};
|
|
676
|
+
export type AddressLookupTableAccountArgs = {
|
|
677
|
+
key: PublicKey;
|
|
678
|
+
state: AddressLookupTableState;
|
|
529
679
|
};
|
|
680
|
+
export class AddressLookupTableAccount {
|
|
681
|
+
key: PublicKey;
|
|
682
|
+
state: AddressLookupTableState;
|
|
683
|
+
constructor(args: AddressLookupTableAccountArgs);
|
|
684
|
+
isActive(): boolean;
|
|
685
|
+
static deserialize(accountData: Uint8Array): AddressLookupTableState;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export type ClientSubscriptionId = number;
|
|
689
|
+
export type TokenAccountsFilter =
|
|
690
|
+
| {
|
|
691
|
+
mint: PublicKey;
|
|
692
|
+
}
|
|
693
|
+
| {
|
|
694
|
+
programId: PublicKey;
|
|
695
|
+
};
|
|
530
696
|
/**
|
|
531
|
-
*
|
|
697
|
+
* Extra contextual information for RPC responses
|
|
532
698
|
*/
|
|
533
|
-
export type
|
|
534
|
-
|
|
535
|
-
commitment?: Commitment;
|
|
536
|
-
/** The minimum slot that the request can be evaluated at */
|
|
537
|
-
minContextSlot?: number;
|
|
699
|
+
export type Context = {
|
|
700
|
+
slot: number;
|
|
538
701
|
};
|
|
539
702
|
/**
|
|
540
|
-
*
|
|
703
|
+
* Options for sending transactions
|
|
541
704
|
*/
|
|
542
|
-
export type
|
|
543
|
-
/**
|
|
544
|
-
|
|
705
|
+
export type SendOptions = {
|
|
706
|
+
/** disable transaction verification step */
|
|
707
|
+
skipPreflight?: boolean;
|
|
708
|
+
/** preflight commitment level */
|
|
709
|
+
preflightCommitment?: Commitment;
|
|
710
|
+
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
711
|
+
maxRetries?: number;
|
|
545
712
|
/** The minimum slot that the request can be evaluated at */
|
|
546
713
|
minContextSlot?: number;
|
|
547
714
|
};
|
|
548
715
|
/**
|
|
549
|
-
*
|
|
716
|
+
* Options for confirming transactions
|
|
550
717
|
*/
|
|
551
|
-
export type
|
|
552
|
-
/**
|
|
718
|
+
export type ConfirmOptions = {
|
|
719
|
+
/** disable transaction verification step */
|
|
720
|
+
skipPreflight?: boolean;
|
|
721
|
+
/** desired commitment level */
|
|
553
722
|
commitment?: Commitment;
|
|
723
|
+
/** preflight commitment level */
|
|
724
|
+
preflightCommitment?: Commitment;
|
|
725
|
+
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
726
|
+
maxRetries?: number;
|
|
554
727
|
/** The minimum slot that the request can be evaluated at */
|
|
555
728
|
minContextSlot?: number;
|
|
556
729
|
};
|
|
557
730
|
/**
|
|
558
|
-
*
|
|
731
|
+
* Options for getConfirmedSignaturesForAddress2
|
|
559
732
|
*/
|
|
560
|
-
export type
|
|
561
|
-
/**
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
733
|
+
export type ConfirmedSignaturesForAddress2Options = {
|
|
734
|
+
/**
|
|
735
|
+
* Start searching backwards from this transaction signature.
|
|
736
|
+
* @remark If not provided the search starts from the highest max confirmed block.
|
|
737
|
+
*/
|
|
738
|
+
before?: TransactionSignature;
|
|
739
|
+
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
740
|
+
until?: TransactionSignature;
|
|
741
|
+
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
742
|
+
limit?: number;
|
|
565
743
|
};
|
|
566
744
|
/**
|
|
567
|
-
*
|
|
745
|
+
* Options for getSignaturesForAddress
|
|
568
746
|
*/
|
|
569
|
-
export type
|
|
570
|
-
/**
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
747
|
+
export type SignaturesForAddressOptions = {
|
|
748
|
+
/**
|
|
749
|
+
* Start searching backwards from this transaction signature.
|
|
750
|
+
* @remark If not provided the search starts from the highest max confirmed block.
|
|
751
|
+
*/
|
|
752
|
+
before?: TransactionSignature;
|
|
753
|
+
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
754
|
+
until?: TransactionSignature;
|
|
755
|
+
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
756
|
+
limit?: number;
|
|
757
|
+
/** The minimum slot that the request can be evaluated at */
|
|
758
|
+
minContextSlot?: number;
|
|
574
759
|
};
|
|
575
760
|
/**
|
|
576
|
-
*
|
|
761
|
+
* RPC Response with extra contextual information
|
|
577
762
|
*/
|
|
578
|
-
export type
|
|
763
|
+
export type RpcResponseAndContext<T> = {
|
|
764
|
+
/** response context */
|
|
765
|
+
context: Context;
|
|
766
|
+
/** response value */
|
|
767
|
+
value: T;
|
|
768
|
+
};
|
|
769
|
+
export type BlockhashWithExpiryBlockHeight = Readonly<{
|
|
770
|
+
blockhash: Blockhash;
|
|
771
|
+
lastValidBlockHeight: number;
|
|
772
|
+
}>;
|
|
773
|
+
/**
|
|
774
|
+
* A strategy for confirming transactions that uses the last valid
|
|
775
|
+
* block height for a given blockhash to check for transaction expiration.
|
|
776
|
+
*/
|
|
777
|
+
export type BlockheightBasedTransactionConfirmationStrategy = {
|
|
778
|
+
signature: TransactionSignature;
|
|
779
|
+
} & BlockhashWithExpiryBlockHeight;
|
|
780
|
+
/**
|
|
781
|
+
* The level of commitment desired when querying state
|
|
782
|
+
* <pre>
|
|
783
|
+
* 'processed': Query the most recent block which has reached 1 confirmation by the connected node
|
|
784
|
+
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
785
|
+
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
786
|
+
* </pre>
|
|
787
|
+
*/
|
|
788
|
+
export type Commitment =
|
|
789
|
+
| 'processed'
|
|
790
|
+
| 'confirmed'
|
|
791
|
+
| 'finalized'
|
|
792
|
+
| 'recent'
|
|
793
|
+
| 'single'
|
|
794
|
+
| 'singleGossip'
|
|
795
|
+
| 'root'
|
|
796
|
+
| 'max';
|
|
797
|
+
/**
|
|
798
|
+
* A subset of Commitment levels, which are at least optimistically confirmed
|
|
799
|
+
* <pre>
|
|
800
|
+
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
801
|
+
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
802
|
+
* </pre>
|
|
803
|
+
*/
|
|
804
|
+
export type Finality = 'confirmed' | 'finalized';
|
|
805
|
+
/**
|
|
806
|
+
* Filter for largest accounts query
|
|
807
|
+
* <pre>
|
|
808
|
+
* 'circulating': Return the largest accounts that are part of the circulating supply
|
|
809
|
+
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
810
|
+
* </pre>
|
|
811
|
+
*/
|
|
812
|
+
export type LargestAccountsFilter = 'circulating' | 'nonCirculating';
|
|
813
|
+
/**
|
|
814
|
+
* Configuration object for changing `getAccountInfo` query behavior
|
|
815
|
+
*/
|
|
816
|
+
export type GetAccountInfoConfig = {
|
|
817
|
+
/** The level of commitment desired */
|
|
818
|
+
commitment?: Commitment;
|
|
819
|
+
/** The minimum slot that the request can be evaluated at */
|
|
820
|
+
minContextSlot?: number;
|
|
821
|
+
};
|
|
822
|
+
/**
|
|
823
|
+
* Configuration object for changing `getBalance` query behavior
|
|
824
|
+
*/
|
|
825
|
+
export type GetBalanceConfig = {
|
|
826
|
+
/** The level of commitment desired */
|
|
827
|
+
commitment?: Commitment;
|
|
828
|
+
/** The minimum slot that the request can be evaluated at */
|
|
829
|
+
minContextSlot?: number;
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* Configuration object for changing `getBlock` query behavior
|
|
833
|
+
*/
|
|
834
|
+
export type GetBlockConfig = {
|
|
835
|
+
/** The level of finality desired */
|
|
836
|
+
commitment?: Finality;
|
|
837
|
+
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
|
|
838
|
+
maxSupportedTransactionVersion?: number;
|
|
839
|
+
};
|
|
840
|
+
/**
|
|
841
|
+
* Configuration object for changing `getStakeMinimumDelegation` query behavior
|
|
842
|
+
*/
|
|
843
|
+
export type GetStakeMinimumDelegationConfig = {
|
|
844
|
+
/** The level of commitment desired */
|
|
845
|
+
commitment?: Commitment;
|
|
846
|
+
};
|
|
847
|
+
/**
|
|
848
|
+
* Configuration object for changing `getBlockHeight` query behavior
|
|
849
|
+
*/
|
|
850
|
+
export type GetBlockHeightConfig = {
|
|
851
|
+
/** The level of commitment desired */
|
|
852
|
+
commitment?: Commitment;
|
|
853
|
+
/** The minimum slot that the request can be evaluated at */
|
|
854
|
+
minContextSlot?: number;
|
|
855
|
+
};
|
|
856
|
+
/**
|
|
857
|
+
* Configuration object for changing `getEpochInfo` query behavior
|
|
858
|
+
*/
|
|
859
|
+
export type GetEpochInfoConfig = {
|
|
860
|
+
/** The level of commitment desired */
|
|
861
|
+
commitment?: Commitment;
|
|
862
|
+
/** The minimum slot that the request can be evaluated at */
|
|
863
|
+
minContextSlot?: number;
|
|
864
|
+
};
|
|
865
|
+
/**
|
|
866
|
+
* Configuration object for changing `getInflationReward` query behavior
|
|
867
|
+
*/
|
|
868
|
+
export type GetInflationRewardConfig = {
|
|
869
|
+
/** The level of commitment desired */
|
|
870
|
+
commitment?: Commitment;
|
|
871
|
+
/** An epoch for which the reward occurs. If omitted, the previous epoch will be used */
|
|
872
|
+
epoch?: number;
|
|
873
|
+
/** The minimum slot that the request can be evaluated at */
|
|
874
|
+
minContextSlot?: number;
|
|
875
|
+
};
|
|
876
|
+
/**
|
|
877
|
+
* Configuration object for changing `getLatestBlockhash` query behavior
|
|
878
|
+
*/
|
|
879
|
+
export type GetLatestBlockhashConfig = {
|
|
880
|
+
/** The level of commitment desired */
|
|
881
|
+
commitment?: Commitment;
|
|
882
|
+
/** The minimum slot that the request can be evaluated at */
|
|
883
|
+
minContextSlot?: number;
|
|
884
|
+
};
|
|
885
|
+
/**
|
|
886
|
+
* Configuration object for changing `getSlot` query behavior
|
|
887
|
+
*/
|
|
888
|
+
export type GetSlotConfig = {
|
|
889
|
+
/** The level of commitment desired */
|
|
890
|
+
commitment?: Commitment;
|
|
891
|
+
/** The minimum slot that the request can be evaluated at */
|
|
892
|
+
minContextSlot?: number;
|
|
893
|
+
};
|
|
894
|
+
/**
|
|
895
|
+
* Configuration object for changing `getSlotLeader` query behavior
|
|
896
|
+
*/
|
|
897
|
+
export type GetSlotLeaderConfig = {
|
|
898
|
+
/** The level of commitment desired */
|
|
899
|
+
commitment?: Commitment;
|
|
900
|
+
/** The minimum slot that the request can be evaluated at */
|
|
901
|
+
minContextSlot?: number;
|
|
902
|
+
};
|
|
903
|
+
/**
|
|
904
|
+
* Configuration object for changing `getTransaction` query behavior
|
|
905
|
+
*/
|
|
906
|
+
export type GetTransactionConfig = {
|
|
907
|
+
/** The level of finality desired */
|
|
908
|
+
commitment?: Finality;
|
|
909
|
+
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
|
|
910
|
+
maxSupportedTransactionVersion?: number;
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* Configuration object for changing `getLargestAccounts` query behavior
|
|
914
|
+
*/
|
|
915
|
+
export type GetLargestAccountsConfig = {
|
|
916
|
+
/** The level of commitment desired */
|
|
917
|
+
commitment?: Commitment;
|
|
918
|
+
/** Filter largest accounts by whether they are part of the circulating supply */
|
|
919
|
+
filter?: LargestAccountsFilter;
|
|
920
|
+
};
|
|
921
|
+
/**
|
|
922
|
+
* Configuration object for changing `getSupply` request behavior
|
|
923
|
+
*/
|
|
924
|
+
export type GetSupplyConfig = {
|
|
579
925
|
/** The level of commitment desired */
|
|
580
926
|
commitment?: Commitment;
|
|
581
927
|
/** Exclude non circulating accounts list from response */
|
|
@@ -1917,6 +2263,10 @@ declare module '@solana/web3.js' {
|
|
|
1917
2263
|
options?: SignaturesForAddressOptions,
|
|
1918
2264
|
commitment?: Finality,
|
|
1919
2265
|
): Promise<Array<ConfirmedSignatureInfo>>;
|
|
2266
|
+
getAddressLookupTable(
|
|
2267
|
+
accountKey: PublicKey,
|
|
2268
|
+
config?: GetAccountInfoConfig,
|
|
2269
|
+
): Promise<RpcResponseAndContext<AddressLookupTableAccount | null>>;
|
|
1920
2270
|
/**
|
|
1921
2271
|
* Fetch the contents of a Nonce account from the cluster, return with context
|
|
1922
2272
|
*/
|
|
@@ -1980,379 +2330,268 @@ declare module '@solana/web3.js' {
|
|
|
1980
2330
|
options?: SendOptions,
|
|
1981
2331
|
): Promise<TransactionSignature>;
|
|
1982
2332
|
/**
|
|
1983
|
-
* Send a transaction that has already been signed, serialized into the
|
|
1984
|
-
* wire format, and encoded as a base64 string
|
|
1985
|
-
*/
|
|
1986
|
-
sendEncodedTransaction(
|
|
1987
|
-
encodedTransaction: string,
|
|
1988
|
-
options?: SendOptions,
|
|
1989
|
-
): Promise<TransactionSignature>;
|
|
1990
|
-
/**
|
|
1991
|
-
* Register a callback to be invoked whenever the specified account changes
|
|
1992
|
-
*
|
|
1993
|
-
* @param publicKey Public key of the account to monitor
|
|
1994
|
-
* @param callback Function to invoke whenever the account is changed
|
|
1995
|
-
* @param commitment Specify the commitment level account changes must reach before notification
|
|
1996
|
-
* @return subscription id
|
|
1997
|
-
*/
|
|
1998
|
-
onAccountChange(
|
|
1999
|
-
publicKey: PublicKey,
|
|
2000
|
-
callback: AccountChangeCallback,
|
|
2001
|
-
commitment?: Commitment,
|
|
2002
|
-
): ClientSubscriptionId;
|
|
2003
|
-
/**
|
|
2004
|
-
* Deregister an account notification callback
|
|
2005
|
-
*
|
|
2006
|
-
* @param id client subscription id to deregister
|
|
2007
|
-
*/
|
|
2008
|
-
removeAccountChangeListener(
|
|
2009
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2010
|
-
): Promise<void>;
|
|
2011
|
-
/**
|
|
2012
|
-
* Register a callback to be invoked whenever accounts owned by the
|
|
2013
|
-
* specified program change
|
|
2014
|
-
*
|
|
2015
|
-
* @param programId Public key of the program to monitor
|
|
2016
|
-
* @param callback Function to invoke whenever the account is changed
|
|
2017
|
-
* @param commitment Specify the commitment level account changes must reach before notification
|
|
2018
|
-
* @param filters The program account filters to pass into the RPC method
|
|
2019
|
-
* @return subscription id
|
|
2020
|
-
*/
|
|
2021
|
-
onProgramAccountChange(
|
|
2022
|
-
programId: PublicKey,
|
|
2023
|
-
callback: ProgramAccountChangeCallback,
|
|
2024
|
-
commitment?: Commitment,
|
|
2025
|
-
filters?: GetProgramAccountsFilter[],
|
|
2026
|
-
): ClientSubscriptionId;
|
|
2027
|
-
/**
|
|
2028
|
-
* Deregister an account notification callback
|
|
2029
|
-
*
|
|
2030
|
-
* @param id client subscription id to deregister
|
|
2031
|
-
*/
|
|
2032
|
-
removeProgramAccountChangeListener(
|
|
2033
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2034
|
-
): Promise<void>;
|
|
2035
|
-
/**
|
|
2036
|
-
* Registers a callback to be invoked whenever logs are emitted.
|
|
2037
|
-
*/
|
|
2038
|
-
onLogs(
|
|
2039
|
-
filter: LogsFilter,
|
|
2040
|
-
callback: LogsCallback,
|
|
2041
|
-
commitment?: Commitment,
|
|
2042
|
-
): ClientSubscriptionId;
|
|
2043
|
-
/**
|
|
2044
|
-
* Deregister a logs callback.
|
|
2045
|
-
*
|
|
2046
|
-
* @param id client subscription id to deregister.
|
|
2047
|
-
*/
|
|
2048
|
-
removeOnLogsListener(
|
|
2049
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2050
|
-
): Promise<void>;
|
|
2051
|
-
/**
|
|
2052
|
-
* Register a callback to be invoked upon slot changes
|
|
2053
|
-
*
|
|
2054
|
-
* @param callback Function to invoke whenever the slot changes
|
|
2055
|
-
* @return subscription id
|
|
2056
|
-
*/
|
|
2057
|
-
onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
|
|
2058
|
-
/**
|
|
2059
|
-
* Deregister a slot notification callback
|
|
2060
|
-
*
|
|
2061
|
-
* @param id client subscription id to deregister
|
|
2062
|
-
*/
|
|
2063
|
-
removeSlotChangeListener(
|
|
2064
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2065
|
-
): Promise<void>;
|
|
2066
|
-
/**
|
|
2067
|
-
* Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
|
|
2068
|
-
* may be useful to track live progress of a cluster.
|
|
2069
|
-
*
|
|
2070
|
-
* @param callback Function to invoke whenever the slot updates
|
|
2071
|
-
* @return subscription id
|
|
2072
|
-
*/
|
|
2073
|
-
onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
|
|
2074
|
-
/**
|
|
2075
|
-
* Deregister a slot update notification callback
|
|
2076
|
-
*
|
|
2077
|
-
* @param id client subscription id to deregister
|
|
2078
|
-
*/
|
|
2079
|
-
removeSlotUpdateListener(
|
|
2080
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2081
|
-
): Promise<void>;
|
|
2082
|
-
_buildArgs(
|
|
2083
|
-
args: Array<any>,
|
|
2084
|
-
override?: Commitment,
|
|
2085
|
-
encoding?: 'jsonParsed' | 'base64',
|
|
2086
|
-
extra?: any,
|
|
2087
|
-
): Array<any>;
|
|
2088
|
-
/**
|
|
2089
|
-
* Register a callback to be invoked upon signature updates
|
|
2090
|
-
*
|
|
2091
|
-
* @param signature Transaction signature string in base 58
|
|
2092
|
-
* @param callback Function to invoke on signature notifications
|
|
2093
|
-
* @param commitment Specify the commitment level signature must reach before notification
|
|
2094
|
-
* @return subscription id
|
|
2095
|
-
*/
|
|
2096
|
-
onSignature(
|
|
2097
|
-
signature: TransactionSignature,
|
|
2098
|
-
callback: SignatureResultCallback,
|
|
2099
|
-
commitment?: Commitment,
|
|
2100
|
-
): ClientSubscriptionId;
|
|
2101
|
-
/**
|
|
2102
|
-
* Register a callback to be invoked when a transaction is
|
|
2103
|
-
* received and/or processed.
|
|
2104
|
-
*
|
|
2105
|
-
* @param signature Transaction signature string in base 58
|
|
2106
|
-
* @param callback Function to invoke on signature notifications
|
|
2107
|
-
* @param options Enable received notifications and set the commitment
|
|
2108
|
-
* level that signature must reach before notification
|
|
2109
|
-
* @return subscription id
|
|
2110
|
-
*/
|
|
2111
|
-
onSignatureWithOptions(
|
|
2112
|
-
signature: TransactionSignature,
|
|
2113
|
-
callback: SignatureSubscriptionCallback,
|
|
2114
|
-
options?: SignatureSubscriptionOptions,
|
|
2115
|
-
): ClientSubscriptionId;
|
|
2116
|
-
/**
|
|
2117
|
-
* Deregister a signature notification callback
|
|
2118
|
-
*
|
|
2119
|
-
* @param id client subscription id to deregister
|
|
2120
|
-
*/
|
|
2121
|
-
removeSignatureListener(
|
|
2122
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2123
|
-
): Promise<void>;
|
|
2124
|
-
/**
|
|
2125
|
-
* Register a callback to be invoked upon root changes
|
|
2126
|
-
*
|
|
2127
|
-
* @param callback Function to invoke whenever the root changes
|
|
2128
|
-
* @return subscription id
|
|
2129
|
-
*/
|
|
2130
|
-
onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
|
|
2131
|
-
/**
|
|
2132
|
-
* Deregister a root notification callback
|
|
2133
|
-
*
|
|
2134
|
-
* @param id client subscription id to deregister
|
|
2135
|
-
*/
|
|
2136
|
-
removeRootChangeListener(
|
|
2137
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2138
|
-
): Promise<void>;
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
/**
|
|
2142
|
-
* Transaction signature as base-58 encoded string
|
|
2143
|
-
*/
|
|
2144
|
-
export type TransactionSignature = string;
|
|
2145
|
-
export const enum TransactionStatus {
|
|
2146
|
-
BLOCKHEIGHT_EXCEEDED = 0,
|
|
2147
|
-
PROCESSED = 1,
|
|
2148
|
-
TIMED_OUT = 2,
|
|
2149
|
-
}
|
|
2150
|
-
/**
|
|
2151
|
-
* Account metadata used to define instructions
|
|
2152
|
-
*/
|
|
2153
|
-
export type AccountMeta = {
|
|
2154
|
-
/** An account's public key */
|
|
2155
|
-
pubkey: PublicKey;
|
|
2156
|
-
/** True if an instruction requires a transaction signature matching `pubkey` */
|
|
2157
|
-
isSigner: boolean;
|
|
2158
|
-
/** True if the `pubkey` can be loaded as a read-write account. */
|
|
2159
|
-
isWritable: boolean;
|
|
2160
|
-
};
|
|
2161
|
-
/**
|
|
2162
|
-
* List of TransactionInstruction object fields that may be initialized at construction
|
|
2163
|
-
*/
|
|
2164
|
-
export type TransactionInstructionCtorFields = {
|
|
2165
|
-
keys: Array<AccountMeta>;
|
|
2166
|
-
programId: PublicKey;
|
|
2167
|
-
data?: Buffer;
|
|
2168
|
-
};
|
|
2169
|
-
/**
|
|
2170
|
-
* Configuration object for Transaction.serialize()
|
|
2171
|
-
*/
|
|
2172
|
-
export type SerializeConfig = {
|
|
2173
|
-
/** Require all transaction signatures be present (default: true) */
|
|
2174
|
-
requireAllSignatures?: boolean;
|
|
2175
|
-
/** Verify provided signatures (default: true) */
|
|
2176
|
-
verifySignatures?: boolean;
|
|
2177
|
-
};
|
|
2178
|
-
/**
|
|
2179
|
-
* Transaction Instruction class
|
|
2180
|
-
*/
|
|
2181
|
-
export class TransactionInstruction {
|
|
2182
|
-
/**
|
|
2183
|
-
* Public keys to include in this transaction
|
|
2184
|
-
* Boolean represents whether this pubkey needs to sign the transaction
|
|
2185
|
-
*/
|
|
2186
|
-
keys: Array<AccountMeta>;
|
|
2187
|
-
/**
|
|
2188
|
-
* Program Id to execute
|
|
2189
|
-
*/
|
|
2190
|
-
programId: PublicKey;
|
|
2191
|
-
/**
|
|
2192
|
-
* Program input
|
|
2193
|
-
*/
|
|
2194
|
-
data: Buffer;
|
|
2195
|
-
constructor(opts: TransactionInstructionCtorFields);
|
|
2196
|
-
}
|
|
2197
|
-
/**
|
|
2198
|
-
* Pair of signature and corresponding public key
|
|
2199
|
-
*/
|
|
2200
|
-
export type SignaturePubkeyPair = {
|
|
2201
|
-
signature: Buffer | null;
|
|
2202
|
-
publicKey: PublicKey;
|
|
2203
|
-
};
|
|
2204
|
-
/**
|
|
2205
|
-
* List of Transaction object fields that may be initialized at construction
|
|
2206
|
-
*/
|
|
2207
|
-
export type TransactionCtorFields_DEPRECATED = {
|
|
2208
|
-
/** Optional nonce information used for offline nonce'd transactions */
|
|
2209
|
-
nonceInfo?: NonceInformation | null;
|
|
2210
|
-
/** The transaction fee payer */
|
|
2211
|
-
feePayer?: PublicKey | null;
|
|
2212
|
-
/** One or more signatures */
|
|
2213
|
-
signatures?: Array<SignaturePubkeyPair>;
|
|
2214
|
-
/** A recent blockhash */
|
|
2215
|
-
recentBlockhash?: Blockhash;
|
|
2216
|
-
};
|
|
2217
|
-
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
|
|
2218
|
-
/**
|
|
2219
|
-
* List of Transaction object fields that may be initialized at construction
|
|
2220
|
-
*/
|
|
2221
|
-
export type TransactionBlockhashCtor = {
|
|
2222
|
-
/** The transaction fee payer */
|
|
2223
|
-
feePayer?: PublicKey | null;
|
|
2224
|
-
/** One or more signatures */
|
|
2225
|
-
signatures?: Array<SignaturePubkeyPair>;
|
|
2226
|
-
/** A recent blockhash */
|
|
2227
|
-
blockhash: Blockhash;
|
|
2228
|
-
/** the last block chain can advance to before tx is exportd expired */
|
|
2229
|
-
lastValidBlockHeight: number;
|
|
2230
|
-
};
|
|
2231
|
-
/**
|
|
2232
|
-
* Nonce information to be used to build an offline Transaction.
|
|
2233
|
-
*/
|
|
2234
|
-
export type NonceInformation = {
|
|
2235
|
-
/** The current blockhash stored in the nonce */
|
|
2236
|
-
nonce: Blockhash;
|
|
2237
|
-
/** AdvanceNonceAccount Instruction */
|
|
2238
|
-
nonceInstruction: TransactionInstruction;
|
|
2239
|
-
};
|
|
2240
|
-
/**
|
|
2241
|
-
* Transaction class
|
|
2242
|
-
*/
|
|
2243
|
-
export class Transaction {
|
|
2244
|
-
/**
|
|
2245
|
-
* Signatures for the transaction. Typically created by invoking the
|
|
2246
|
-
* `sign()` method
|
|
2247
|
-
*/
|
|
2248
|
-
signatures: Array<SignaturePubkeyPair>;
|
|
2249
|
-
/**
|
|
2250
|
-
* The first (payer) Transaction signature
|
|
2333
|
+
* Send a transaction that has already been signed, serialized into the
|
|
2334
|
+
* wire format, and encoded as a base64 string
|
|
2251
2335
|
*/
|
|
2252
|
-
|
|
2336
|
+
sendEncodedTransaction(
|
|
2337
|
+
encodedTransaction: string,
|
|
2338
|
+
options?: SendOptions,
|
|
2339
|
+
): Promise<TransactionSignature>;
|
|
2253
2340
|
/**
|
|
2254
|
-
*
|
|
2341
|
+
* Register a callback to be invoked whenever the specified account changes
|
|
2342
|
+
*
|
|
2343
|
+
* @param publicKey Public key of the account to monitor
|
|
2344
|
+
* @param callback Function to invoke whenever the account is changed
|
|
2345
|
+
* @param commitment Specify the commitment level account changes must reach before notification
|
|
2346
|
+
* @return subscription id
|
|
2255
2347
|
*/
|
|
2256
|
-
|
|
2348
|
+
onAccountChange(
|
|
2349
|
+
publicKey: PublicKey,
|
|
2350
|
+
callback: AccountChangeCallback,
|
|
2351
|
+
commitment?: Commitment,
|
|
2352
|
+
): ClientSubscriptionId;
|
|
2257
2353
|
/**
|
|
2258
|
-
*
|
|
2354
|
+
* Deregister an account notification callback
|
|
2355
|
+
*
|
|
2356
|
+
* @param id client subscription id to deregister
|
|
2259
2357
|
*/
|
|
2260
|
-
|
|
2358
|
+
removeAccountChangeListener(
|
|
2359
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2360
|
+
): Promise<void>;
|
|
2261
2361
|
/**
|
|
2262
|
-
*
|
|
2362
|
+
* Register a callback to be invoked whenever accounts owned by the
|
|
2363
|
+
* specified program change
|
|
2364
|
+
*
|
|
2365
|
+
* @param programId Public key of the program to monitor
|
|
2366
|
+
* @param callback Function to invoke whenever the account is changed
|
|
2367
|
+
* @param commitment Specify the commitment level account changes must reach before notification
|
|
2368
|
+
* @param filters The program account filters to pass into the RPC method
|
|
2369
|
+
* @return subscription id
|
|
2263
2370
|
*/
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2371
|
+
onProgramAccountChange(
|
|
2372
|
+
programId: PublicKey,
|
|
2373
|
+
callback: ProgramAccountChangeCallback,
|
|
2374
|
+
commitment?: Commitment,
|
|
2375
|
+
filters?: GetProgramAccountsFilter[],
|
|
2376
|
+
): ClientSubscriptionId;
|
|
2269
2377
|
/**
|
|
2270
|
-
*
|
|
2271
|
-
*
|
|
2378
|
+
* Deregister an account notification callback
|
|
2379
|
+
*
|
|
2380
|
+
* @param id client subscription id to deregister
|
|
2272
2381
|
*/
|
|
2273
|
-
|
|
2274
|
-
|
|
2382
|
+
removeProgramAccountChangeListener(
|
|
2383
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2384
|
+
): Promise<void>;
|
|
2275
2385
|
/**
|
|
2276
|
-
*
|
|
2277
|
-
* Please supply a `TransactionBlockhashCtor` instead.
|
|
2386
|
+
* Registers a callback to be invoked whenever logs are emitted.
|
|
2278
2387
|
*/
|
|
2279
|
-
|
|
2388
|
+
onLogs(
|
|
2389
|
+
filter: LogsFilter,
|
|
2390
|
+
callback: LogsCallback,
|
|
2391
|
+
commitment?: Commitment,
|
|
2392
|
+
): ClientSubscriptionId;
|
|
2280
2393
|
/**
|
|
2281
|
-
*
|
|
2394
|
+
* Deregister a logs callback.
|
|
2395
|
+
*
|
|
2396
|
+
* @param id client subscription id to deregister.
|
|
2282
2397
|
*/
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
>
|
|
2287
|
-
): Transaction;
|
|
2398
|
+
removeOnLogsListener(
|
|
2399
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2400
|
+
): Promise<void>;
|
|
2288
2401
|
/**
|
|
2289
|
-
*
|
|
2402
|
+
* Register a callback to be invoked upon slot changes
|
|
2403
|
+
*
|
|
2404
|
+
* @param callback Function to invoke whenever the slot changes
|
|
2405
|
+
* @return subscription id
|
|
2290
2406
|
*/
|
|
2291
|
-
|
|
2407
|
+
onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
|
|
2292
2408
|
/**
|
|
2293
|
-
*
|
|
2409
|
+
* Deregister a slot notification callback
|
|
2410
|
+
*
|
|
2411
|
+
* @param id client subscription id to deregister
|
|
2294
2412
|
*/
|
|
2295
|
-
|
|
2413
|
+
removeSlotChangeListener(
|
|
2414
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2415
|
+
): Promise<void>;
|
|
2296
2416
|
/**
|
|
2297
|
-
*
|
|
2417
|
+
* Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
|
|
2418
|
+
* may be useful to track live progress of a cluster.
|
|
2419
|
+
*
|
|
2420
|
+
* @param callback Function to invoke whenever the slot updates
|
|
2421
|
+
* @return subscription id
|
|
2298
2422
|
*/
|
|
2299
|
-
|
|
2423
|
+
onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
|
|
2300
2424
|
/**
|
|
2301
|
-
*
|
|
2302
|
-
* The first signer will be used as the transaction fee payer account.
|
|
2425
|
+
* Deregister a slot update notification callback
|
|
2303
2426
|
*
|
|
2304
|
-
*
|
|
2427
|
+
* @param id client subscription id to deregister
|
|
2428
|
+
*/
|
|
2429
|
+
removeSlotUpdateListener(
|
|
2430
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2431
|
+
): Promise<void>;
|
|
2432
|
+
_buildArgs(
|
|
2433
|
+
args: Array<any>,
|
|
2434
|
+
override?: Commitment,
|
|
2435
|
+
encoding?: 'jsonParsed' | 'base64',
|
|
2436
|
+
extra?: any,
|
|
2437
|
+
): Array<any>;
|
|
2438
|
+
/**
|
|
2439
|
+
* Register a callback to be invoked upon signature updates
|
|
2305
2440
|
*
|
|
2306
|
-
* @
|
|
2307
|
-
*
|
|
2308
|
-
*
|
|
2441
|
+
* @param signature Transaction signature string in base 58
|
|
2442
|
+
* @param callback Function to invoke on signature notifications
|
|
2443
|
+
* @param commitment Specify the commitment level signature must reach before notification
|
|
2444
|
+
* @return subscription id
|
|
2309
2445
|
*/
|
|
2310
|
-
|
|
2446
|
+
onSignature(
|
|
2447
|
+
signature: TransactionSignature,
|
|
2448
|
+
callback: SignatureResultCallback,
|
|
2449
|
+
commitment?: Commitment,
|
|
2450
|
+
): ClientSubscriptionId;
|
|
2311
2451
|
/**
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
* and is used identify and confirm transactions.
|
|
2452
|
+
* Register a callback to be invoked when a transaction is
|
|
2453
|
+
* received and/or processed.
|
|
2315
2454
|
*
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2455
|
+
* @param signature Transaction signature string in base 58
|
|
2456
|
+
* @param callback Function to invoke on signature notifications
|
|
2457
|
+
* @param options Enable received notifications and set the commitment
|
|
2458
|
+
* level that signature must reach before notification
|
|
2459
|
+
* @return subscription id
|
|
2460
|
+
*/
|
|
2461
|
+
onSignatureWithOptions(
|
|
2462
|
+
signature: TransactionSignature,
|
|
2463
|
+
callback: SignatureSubscriptionCallback,
|
|
2464
|
+
options?: SignatureSubscriptionOptions,
|
|
2465
|
+
): ClientSubscriptionId;
|
|
2466
|
+
/**
|
|
2467
|
+
* Deregister a signature notification callback
|
|
2318
2468
|
*
|
|
2319
|
-
*
|
|
2320
|
-
|
|
2321
|
-
|
|
2469
|
+
* @param id client subscription id to deregister
|
|
2470
|
+
*/
|
|
2471
|
+
removeSignatureListener(
|
|
2472
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2473
|
+
): Promise<void>;
|
|
2474
|
+
/**
|
|
2475
|
+
* Register a callback to be invoked upon root changes
|
|
2322
2476
|
*
|
|
2323
|
-
*
|
|
2477
|
+
* @param callback Function to invoke whenever the root changes
|
|
2478
|
+
* @return subscription id
|
|
2324
2479
|
*/
|
|
2325
|
-
|
|
2480
|
+
onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
|
|
2326
2481
|
/**
|
|
2327
|
-
*
|
|
2328
|
-
* correspond to either the fee payer or a signer account in the transaction
|
|
2329
|
-
* instructions.
|
|
2482
|
+
* Deregister a root notification callback
|
|
2330
2483
|
*
|
|
2331
|
-
*
|
|
2484
|
+
* @param id client subscription id to deregister
|
|
2332
2485
|
*/
|
|
2333
|
-
|
|
2486
|
+
removeRootChangeListener(
|
|
2487
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2488
|
+
): Promise<void>;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
export const BPF_LOADER_PROGRAM_ID: PublicKey;
|
|
2492
|
+
/**
|
|
2493
|
+
* Factory class for transactions to interact with a program loader
|
|
2494
|
+
*/
|
|
2495
|
+
export class BpfLoader {
|
|
2334
2496
|
/**
|
|
2335
|
-
*
|
|
2336
|
-
*
|
|
2337
|
-
*
|
|
2497
|
+
* Minimum number of signatures required to load a program not including
|
|
2498
|
+
* retries
|
|
2499
|
+
*
|
|
2500
|
+
* Can be used to calculate transaction fees
|
|
2338
2501
|
*/
|
|
2339
|
-
|
|
2502
|
+
static getMinNumSignatures(dataLength: number): number;
|
|
2340
2503
|
/**
|
|
2341
|
-
*
|
|
2504
|
+
* Load a BPF program
|
|
2505
|
+
*
|
|
2506
|
+
* @param connection The connection to use
|
|
2507
|
+
* @param payer Account that will pay program loading fees
|
|
2508
|
+
* @param program Account to load the program into
|
|
2509
|
+
* @param elf The entire ELF containing the BPF program
|
|
2510
|
+
* @param loaderProgramId The program id of the BPF loader to use
|
|
2511
|
+
* @return true if program was loaded successfully, false if program was already loaded
|
|
2342
2512
|
*/
|
|
2343
|
-
|
|
2513
|
+
static load(
|
|
2514
|
+
connection: Connection,
|
|
2515
|
+
payer: Signer,
|
|
2516
|
+
program: Signer,
|
|
2517
|
+
elf: Buffer | Uint8Array | Array<number>,
|
|
2518
|
+
loaderProgramId: PublicKey,
|
|
2519
|
+
): Promise<boolean>;
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
export class SendTransactionError extends Error {
|
|
2523
|
+
logs: string[] | undefined;
|
|
2524
|
+
constructor(message: string, logs?: string[]);
|
|
2525
|
+
}
|
|
2526
|
+
export const SolanaJSONRPCErrorCode: {
|
|
2527
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
|
|
2528
|
+
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
|
|
2529
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
|
|
2530
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
|
|
2531
|
+
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
|
|
2532
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
|
|
2533
|
+
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
|
|
2534
|
+
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
|
|
2535
|
+
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
|
|
2536
|
+
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
|
|
2537
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
|
|
2538
|
+
readonly JSON_RPC_SCAN_ERROR: -32012;
|
|
2539
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
|
|
2540
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
|
|
2541
|
+
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
|
|
2542
|
+
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
|
|
2543
|
+
};
|
|
2544
|
+
export type SolanaJSONRPCErrorCodeEnum =
|
|
2545
|
+
typeof SolanaJSONRPCErrorCode[keyof typeof SolanaJSONRPCErrorCode];
|
|
2546
|
+
export class SolanaJSONRPCError extends Error {
|
|
2547
|
+
code: SolanaJSONRPCErrorCodeEnum | unknown;
|
|
2548
|
+
data?: any;
|
|
2549
|
+
constructor(
|
|
2550
|
+
{
|
|
2551
|
+
code,
|
|
2552
|
+
message,
|
|
2553
|
+
data,
|
|
2554
|
+
}: Readonly<{
|
|
2555
|
+
code: unknown;
|
|
2556
|
+
message: string;
|
|
2557
|
+
data?: any;
|
|
2558
|
+
}>,
|
|
2559
|
+
customMessage?: string,
|
|
2560
|
+
);
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
/**
|
|
2564
|
+
* Program loader interface
|
|
2565
|
+
*/
|
|
2566
|
+
export class Loader {
|
|
2344
2567
|
/**
|
|
2345
|
-
*
|
|
2568
|
+
* Amount of program data placed in each load Transaction
|
|
2346
2569
|
*/
|
|
2347
|
-
|
|
2570
|
+
static chunkSize: number;
|
|
2348
2571
|
/**
|
|
2349
|
-
*
|
|
2572
|
+
* Minimum number of signatures required to load a program not including
|
|
2573
|
+
* retries
|
|
2574
|
+
*
|
|
2575
|
+
* Can be used to calculate transaction fees
|
|
2350
2576
|
*/
|
|
2351
|
-
static
|
|
2577
|
+
static getMinNumSignatures(dataLength: number): number;
|
|
2352
2578
|
/**
|
|
2353
|
-
*
|
|
2579
|
+
* Loads a generic program
|
|
2580
|
+
*
|
|
2581
|
+
* @param connection The connection to use
|
|
2582
|
+
* @param payer System account that pays to load the program
|
|
2583
|
+
* @param program Account to load the program into
|
|
2584
|
+
* @param programId Public key that identifies the loader
|
|
2585
|
+
* @param data Program octets
|
|
2586
|
+
* @return true if program was loaded successfully, false if program was already loaded
|
|
2354
2587
|
*/
|
|
2355
|
-
static
|
|
2588
|
+
static load(
|
|
2589
|
+
connection: Connection,
|
|
2590
|
+
payer: Signer,
|
|
2591
|
+
program: Signer,
|
|
2592
|
+
programId: PublicKey,
|
|
2593
|
+
data: Buffer | Uint8Array | Array<number>,
|
|
2594
|
+
): Promise<boolean>;
|
|
2356
2595
|
}
|
|
2357
2596
|
|
|
2358
2597
|
export type CreateLookupTableParams = {
|
|
@@ -2442,39 +2681,6 @@ declare module '@solana/web3.js' {
|
|
|
2442
2681
|
): TransactionInstruction;
|
|
2443
2682
|
}
|
|
2444
2683
|
|
|
2445
|
-
export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
|
|
2446
|
-
|
|
2447
|
-
export const BPF_LOADER_PROGRAM_ID: PublicKey;
|
|
2448
|
-
/**
|
|
2449
|
-
* Factory class for transactions to interact with a program loader
|
|
2450
|
-
*/
|
|
2451
|
-
export class BpfLoader {
|
|
2452
|
-
/**
|
|
2453
|
-
* Minimum number of signatures required to load a program not including
|
|
2454
|
-
* retries
|
|
2455
|
-
*
|
|
2456
|
-
* Can be used to calculate transaction fees
|
|
2457
|
-
*/
|
|
2458
|
-
static getMinNumSignatures(dataLength: number): number;
|
|
2459
|
-
/**
|
|
2460
|
-
* Load a BPF program
|
|
2461
|
-
*
|
|
2462
|
-
* @param connection The connection to use
|
|
2463
|
-
* @param payer Account that will pay program loading fees
|
|
2464
|
-
* @param program Account to load the program into
|
|
2465
|
-
* @param elf The entire ELF containing the BPF program
|
|
2466
|
-
* @param loaderProgramId The program id of the BPF loader to use
|
|
2467
|
-
* @return true if program was loaded successfully, false if program was already loaded
|
|
2468
|
-
*/
|
|
2469
|
-
static load(
|
|
2470
|
-
connection: Connection,
|
|
2471
|
-
payer: Signer,
|
|
2472
|
-
program: Signer,
|
|
2473
|
-
elf: Buffer | Uint8Array | Array<number>,
|
|
2474
|
-
loaderProgramId: PublicKey,
|
|
2475
|
-
): Promise<boolean>;
|
|
2476
|
-
}
|
|
2477
|
-
|
|
2478
2684
|
/**
|
|
2479
2685
|
* Compute Budget Instruction class
|
|
2480
2686
|
*/
|
|
@@ -2608,37 +2814,66 @@ declare module '@solana/web3.js' {
|
|
|
2608
2814
|
}
|
|
2609
2815
|
|
|
2610
2816
|
/**
|
|
2611
|
-
*
|
|
2817
|
+
* Params for creating an secp256k1 instruction using a public key
|
|
2612
2818
|
*/
|
|
2613
|
-
export
|
|
2819
|
+
export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
|
2820
|
+
publicKey: Buffer | Uint8Array | Array<number>;
|
|
2821
|
+
message: Buffer | Uint8Array | Array<number>;
|
|
2822
|
+
signature: Buffer | Uint8Array | Array<number>;
|
|
2823
|
+
recoveryId: number;
|
|
2824
|
+
instructionIndex?: number;
|
|
2825
|
+
};
|
|
2826
|
+
/**
|
|
2827
|
+
* Params for creating an secp256k1 instruction using an Ethereum address
|
|
2828
|
+
*/
|
|
2829
|
+
export type CreateSecp256k1InstructionWithEthAddressParams = {
|
|
2830
|
+
ethAddress: Buffer | Uint8Array | Array<number> | string;
|
|
2831
|
+
message: Buffer | Uint8Array | Array<number>;
|
|
2832
|
+
signature: Buffer | Uint8Array | Array<number>;
|
|
2833
|
+
recoveryId: number;
|
|
2834
|
+
instructionIndex?: number;
|
|
2835
|
+
};
|
|
2836
|
+
/**
|
|
2837
|
+
* Params for creating an secp256k1 instruction using a private key
|
|
2838
|
+
*/
|
|
2839
|
+
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
2840
|
+
privateKey: Buffer | Uint8Array | Array<number>;
|
|
2841
|
+
message: Buffer | Uint8Array | Array<number>;
|
|
2842
|
+
instructionIndex?: number;
|
|
2843
|
+
};
|
|
2844
|
+
export class Secp256k1Program {
|
|
2614
2845
|
/**
|
|
2615
|
-
*
|
|
2846
|
+
* Public key that identifies the secp256k1 program
|
|
2616
2847
|
*/
|
|
2617
|
-
static
|
|
2848
|
+
static programId: PublicKey;
|
|
2618
2849
|
/**
|
|
2619
|
-
*
|
|
2620
|
-
*
|
|
2621
|
-
*
|
|
2622
|
-
* Can be used to calculate transaction fees
|
|
2850
|
+
* Construct an Ethereum address from a secp256k1 public key buffer.
|
|
2851
|
+
* @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
|
|
2623
2852
|
*/
|
|
2624
|
-
static
|
|
2853
|
+
static publicKeyToEthAddress(
|
|
2854
|
+
publicKey: Buffer | Uint8Array | Array<number>,
|
|
2855
|
+
): Buffer;
|
|
2625
2856
|
/**
|
|
2626
|
-
*
|
|
2627
|
-
*
|
|
2628
|
-
* @param connection The connection to use
|
|
2629
|
-
* @param payer System account that pays to load the program
|
|
2630
|
-
* @param program Account to load the program into
|
|
2631
|
-
* @param programId Public key that identifies the loader
|
|
2632
|
-
* @param data Program octets
|
|
2633
|
-
* @return true if program was loaded successfully, false if program was already loaded
|
|
2857
|
+
* Create an secp256k1 instruction with a public key. The public key
|
|
2858
|
+
* must be a buffer that is 64 bytes long.
|
|
2634
2859
|
*/
|
|
2635
|
-
static
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2860
|
+
static createInstructionWithPublicKey(
|
|
2861
|
+
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
|
2862
|
+
): TransactionInstruction;
|
|
2863
|
+
/**
|
|
2864
|
+
* Create an secp256k1 instruction with an Ethereum address. The address
|
|
2865
|
+
* must be a hex string or a buffer that is 20 bytes long.
|
|
2866
|
+
*/
|
|
2867
|
+
static createInstructionWithEthAddress(
|
|
2868
|
+
params: CreateSecp256k1InstructionWithEthAddressParams,
|
|
2869
|
+
): TransactionInstruction;
|
|
2870
|
+
/**
|
|
2871
|
+
* Create an secp256k1 instruction with a private key. The private key
|
|
2872
|
+
* must be a buffer that is 32 bytes long.
|
|
2873
|
+
*/
|
|
2874
|
+
static createInstructionWithPrivateKey(
|
|
2875
|
+
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
|
2876
|
+
): TransactionInstruction;
|
|
2642
2877
|
}
|
|
2643
2878
|
|
|
2644
2879
|
/**
|
|
@@ -3291,190 +3526,22 @@ declare module '@solana/web3.js' {
|
|
|
3291
3526
|
/**
|
|
3292
3527
|
* Generate an instruction to advance the nonce in a Nonce account
|
|
3293
3528
|
*/
|
|
3294
|
-
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
|
3295
|
-
/**
|
|
3296
|
-
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
3297
|
-
*/
|
|
3298
|
-
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
|
|
3299
|
-
/**
|
|
3300
|
-
* Generate a transaction instruction that authorizes a new PublicKey as the authority
|
|
3301
|
-
* on a Nonce account.
|
|
3302
|
-
*/
|
|
3303
|
-
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
|
|
3304
|
-
/**
|
|
3305
|
-
* Generate a transaction instruction that allocates space in an account without funding
|
|
3306
|
-
*/
|
|
3307
|
-
static allocate(
|
|
3308
|
-
params: AllocateParams | AllocateWithSeedParams,
|
|
3309
|
-
): TransactionInstruction;
|
|
3310
|
-
}
|
|
3311
|
-
|
|
3312
|
-
/**
|
|
3313
|
-
* Params for creating an secp256k1 instruction using a public key
|
|
3314
|
-
*/
|
|
3315
|
-
export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
|
3316
|
-
publicKey: Buffer | Uint8Array | Array<number>;
|
|
3317
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3318
|
-
signature: Buffer | Uint8Array | Array<number>;
|
|
3319
|
-
recoveryId: number;
|
|
3320
|
-
instructionIndex?: number;
|
|
3321
|
-
};
|
|
3322
|
-
/**
|
|
3323
|
-
* Params for creating an secp256k1 instruction using an Ethereum address
|
|
3324
|
-
*/
|
|
3325
|
-
export type CreateSecp256k1InstructionWithEthAddressParams = {
|
|
3326
|
-
ethAddress: Buffer | Uint8Array | Array<number> | string;
|
|
3327
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3328
|
-
signature: Buffer | Uint8Array | Array<number>;
|
|
3329
|
-
recoveryId: number;
|
|
3330
|
-
instructionIndex?: number;
|
|
3331
|
-
};
|
|
3332
|
-
/**
|
|
3333
|
-
* Params for creating an secp256k1 instruction using a private key
|
|
3334
|
-
*/
|
|
3335
|
-
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
3336
|
-
privateKey: Buffer | Uint8Array | Array<number>;
|
|
3337
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3338
|
-
instructionIndex?: number;
|
|
3339
|
-
};
|
|
3340
|
-
export class Secp256k1Program {
|
|
3341
|
-
/**
|
|
3342
|
-
* Public key that identifies the secp256k1 program
|
|
3343
|
-
*/
|
|
3344
|
-
static programId: PublicKey;
|
|
3345
|
-
/**
|
|
3346
|
-
* Construct an Ethereum address from a secp256k1 public key buffer.
|
|
3347
|
-
* @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
|
|
3348
|
-
*/
|
|
3349
|
-
static publicKeyToEthAddress(
|
|
3350
|
-
publicKey: Buffer | Uint8Array | Array<number>,
|
|
3351
|
-
): Buffer;
|
|
3352
|
-
/**
|
|
3353
|
-
* Create an secp256k1 instruction with a public key. The public key
|
|
3354
|
-
* must be a buffer that is 64 bytes long.
|
|
3355
|
-
*/
|
|
3356
|
-
static createInstructionWithPublicKey(
|
|
3357
|
-
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
|
3358
|
-
): TransactionInstruction;
|
|
3359
|
-
/**
|
|
3360
|
-
* Create an secp256k1 instruction with an Ethereum address. The address
|
|
3361
|
-
* must be a hex string or a buffer that is 20 bytes long.
|
|
3362
|
-
*/
|
|
3363
|
-
static createInstructionWithEthAddress(
|
|
3364
|
-
params: CreateSecp256k1InstructionWithEthAddressParams,
|
|
3365
|
-
): TransactionInstruction;
|
|
3366
|
-
/**
|
|
3367
|
-
* Create an secp256k1 instruction with a private key. The private key
|
|
3368
|
-
* must be a buffer that is 32 bytes long.
|
|
3369
|
-
*/
|
|
3370
|
-
static createInstructionWithPrivateKey(
|
|
3371
|
-
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
|
3372
|
-
): TransactionInstruction;
|
|
3373
|
-
}
|
|
3374
|
-
|
|
3375
|
-
/**
|
|
3376
|
-
* Maximum over-the-wire size of a Transaction
|
|
3377
|
-
*
|
|
3378
|
-
* 1280 is IPv6 minimum MTU
|
|
3379
|
-
* 40 bytes is the size of the IPv6 header
|
|
3380
|
-
* 8 bytes is the size of the fragment header
|
|
3381
|
-
*/
|
|
3382
|
-
export const PACKET_DATA_SIZE: number;
|
|
3383
|
-
export const SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
3384
|
-
|
|
3385
|
-
export const VALIDATOR_INFO_KEY: PublicKey;
|
|
3386
|
-
/**
|
|
3387
|
-
* Info used to identity validators.
|
|
3388
|
-
*/
|
|
3389
|
-
export type Info = {
|
|
3390
|
-
/** validator name */
|
|
3391
|
-
name: string;
|
|
3392
|
-
/** optional, validator website */
|
|
3393
|
-
website?: string;
|
|
3394
|
-
/** optional, extra information the validator chose to share */
|
|
3395
|
-
details?: string;
|
|
3396
|
-
/** optional, used to identify validators on keybase.io */
|
|
3397
|
-
keybaseUsername?: string;
|
|
3398
|
-
};
|
|
3399
|
-
/**
|
|
3400
|
-
* ValidatorInfo class
|
|
3401
|
-
*/
|
|
3402
|
-
export class ValidatorInfo {
|
|
3403
|
-
/**
|
|
3404
|
-
* validator public key
|
|
3405
|
-
*/
|
|
3406
|
-
key: PublicKey;
|
|
3407
|
-
/**
|
|
3408
|
-
* validator information
|
|
3409
|
-
*/
|
|
3410
|
-
info: Info;
|
|
3529
|
+
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
|
3411
3530
|
/**
|
|
3412
|
-
*
|
|
3413
|
-
*
|
|
3414
|
-
* @param key validator public key
|
|
3415
|
-
* @param info validator information
|
|
3531
|
+
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
3416
3532
|
*/
|
|
3417
|
-
|
|
3533
|
+
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
|
|
3418
3534
|
/**
|
|
3419
|
-
*
|
|
3420
|
-
*
|
|
3421
|
-
*
|
|
3422
|
-
* @param buffer config account data
|
|
3423
|
-
* @return null if info was not found
|
|
3535
|
+
* Generate a transaction instruction that authorizes a new PublicKey as the authority
|
|
3536
|
+
* on a Nonce account.
|
|
3424
3537
|
*/
|
|
3425
|
-
static
|
|
3426
|
-
buffer: Buffer | Uint8Array | Array<number>,
|
|
3427
|
-
): ValidatorInfo | null;
|
|
3428
|
-
}
|
|
3429
|
-
|
|
3430
|
-
export const VOTE_PROGRAM_ID: PublicKey;
|
|
3431
|
-
export type Lockout = {
|
|
3432
|
-
slot: number;
|
|
3433
|
-
confirmationCount: number;
|
|
3434
|
-
};
|
|
3435
|
-
/**
|
|
3436
|
-
* History of how many credits earned by the end of each epoch
|
|
3437
|
-
*/
|
|
3438
|
-
export type EpochCredits = Readonly<{
|
|
3439
|
-
epoch: number;
|
|
3440
|
-
credits: number;
|
|
3441
|
-
prevCredits: number;
|
|
3442
|
-
}>;
|
|
3443
|
-
export type AuthorizedVoter = Readonly<{
|
|
3444
|
-
epoch: number;
|
|
3445
|
-
authorizedVoter: PublicKey;
|
|
3446
|
-
}>;
|
|
3447
|
-
export type PriorVoter = Readonly<{
|
|
3448
|
-
authorizedPubkey: PublicKey;
|
|
3449
|
-
epochOfLastAuthorizedSwitch: number;
|
|
3450
|
-
targetEpoch: number;
|
|
3451
|
-
}>;
|
|
3452
|
-
export type BlockTimestamp = Readonly<{
|
|
3453
|
-
slot: number;
|
|
3454
|
-
timestamp: number;
|
|
3455
|
-
}>;
|
|
3456
|
-
/**
|
|
3457
|
-
* VoteAccount class
|
|
3458
|
-
*/
|
|
3459
|
-
export class VoteAccount {
|
|
3460
|
-
nodePubkey: PublicKey;
|
|
3461
|
-
authorizedWithdrawer: PublicKey;
|
|
3462
|
-
commission: number;
|
|
3463
|
-
rootSlot: number | null;
|
|
3464
|
-
votes: Lockout[];
|
|
3465
|
-
authorizedVoters: AuthorizedVoter[];
|
|
3466
|
-
priorVoters: PriorVoter[];
|
|
3467
|
-
epochCredits: EpochCredits[];
|
|
3468
|
-
lastTimestamp: BlockTimestamp;
|
|
3538
|
+
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
|
|
3469
3539
|
/**
|
|
3470
|
-
*
|
|
3471
|
-
*
|
|
3472
|
-
* @param buffer account data
|
|
3473
|
-
* @return VoteAccount
|
|
3540
|
+
* Generate a transaction instruction that allocates space in an account without funding
|
|
3474
3541
|
*/
|
|
3475
|
-
static
|
|
3476
|
-
|
|
3477
|
-
):
|
|
3542
|
+
static allocate(
|
|
3543
|
+
params: AllocateParams | AllocateWithSeedParams,
|
|
3544
|
+
): TransactionInstruction;
|
|
3478
3545
|
}
|
|
3479
3546
|
|
|
3480
3547
|
/**
|
|
@@ -3616,6 +3683,114 @@ declare module '@solana/web3.js' {
|
|
|
3616
3683
|
* Generate a transaction to withdraw from a Vote account.
|
|
3617
3684
|
*/
|
|
3618
3685
|
static withdraw(params: WithdrawFromVoteAccountParams): Transaction;
|
|
3686
|
+
/**
|
|
3687
|
+
* Generate a transaction to withdraw safely from a Vote account.
|
|
3688
|
+
*
|
|
3689
|
+
* This function was created as a safeguard for vote accounts running validators, `safeWithdraw`
|
|
3690
|
+
* checks that the withdraw amount will not exceed the specified balance while leaving enough left
|
|
3691
|
+
* to cover rent. If you wish to close the vote account by withdrawing the full amount, call the
|
|
3692
|
+
* `withdraw` method directly.
|
|
3693
|
+
*/
|
|
3694
|
+
static safeWithdraw(
|
|
3695
|
+
params: WithdrawFromVoteAccountParams,
|
|
3696
|
+
currentVoteAccountBalance: number,
|
|
3697
|
+
rentExemptMinimum: number,
|
|
3698
|
+
): Transaction;
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
export const VALIDATOR_INFO_KEY: PublicKey;
|
|
3702
|
+
/**
|
|
3703
|
+
* Info used to identity validators.
|
|
3704
|
+
*/
|
|
3705
|
+
export type Info = {
|
|
3706
|
+
/** validator name */
|
|
3707
|
+
name: string;
|
|
3708
|
+
/** optional, validator website */
|
|
3709
|
+
website?: string;
|
|
3710
|
+
/** optional, extra information the validator chose to share */
|
|
3711
|
+
details?: string;
|
|
3712
|
+
/** optional, used to identify validators on keybase.io */
|
|
3713
|
+
keybaseUsername?: string;
|
|
3714
|
+
};
|
|
3715
|
+
/**
|
|
3716
|
+
* ValidatorInfo class
|
|
3717
|
+
*/
|
|
3718
|
+
export class ValidatorInfo {
|
|
3719
|
+
/**
|
|
3720
|
+
* validator public key
|
|
3721
|
+
*/
|
|
3722
|
+
key: PublicKey;
|
|
3723
|
+
/**
|
|
3724
|
+
* validator information
|
|
3725
|
+
*/
|
|
3726
|
+
info: Info;
|
|
3727
|
+
/**
|
|
3728
|
+
* Construct a valid ValidatorInfo
|
|
3729
|
+
*
|
|
3730
|
+
* @param key validator public key
|
|
3731
|
+
* @param info validator information
|
|
3732
|
+
*/
|
|
3733
|
+
constructor(key: PublicKey, info: Info);
|
|
3734
|
+
/**
|
|
3735
|
+
* Deserialize ValidatorInfo from the config account data. Exactly two config
|
|
3736
|
+
* keys are required in the data.
|
|
3737
|
+
*
|
|
3738
|
+
* @param buffer config account data
|
|
3739
|
+
* @return null if info was not found
|
|
3740
|
+
*/
|
|
3741
|
+
static fromConfigData(
|
|
3742
|
+
buffer: Buffer | Uint8Array | Array<number>,
|
|
3743
|
+
): ValidatorInfo | null;
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
export const VOTE_PROGRAM_ID: PublicKey;
|
|
3747
|
+
export type Lockout = {
|
|
3748
|
+
slot: number;
|
|
3749
|
+
confirmationCount: number;
|
|
3750
|
+
};
|
|
3751
|
+
/**
|
|
3752
|
+
* History of how many credits earned by the end of each epoch
|
|
3753
|
+
*/
|
|
3754
|
+
export type EpochCredits = Readonly<{
|
|
3755
|
+
epoch: number;
|
|
3756
|
+
credits: number;
|
|
3757
|
+
prevCredits: number;
|
|
3758
|
+
}>;
|
|
3759
|
+
export type AuthorizedVoter = Readonly<{
|
|
3760
|
+
epoch: number;
|
|
3761
|
+
authorizedVoter: PublicKey;
|
|
3762
|
+
}>;
|
|
3763
|
+
export type PriorVoter = Readonly<{
|
|
3764
|
+
authorizedPubkey: PublicKey;
|
|
3765
|
+
epochOfLastAuthorizedSwitch: number;
|
|
3766
|
+
targetEpoch: number;
|
|
3767
|
+
}>;
|
|
3768
|
+
export type BlockTimestamp = Readonly<{
|
|
3769
|
+
slot: number;
|
|
3770
|
+
timestamp: number;
|
|
3771
|
+
}>;
|
|
3772
|
+
/**
|
|
3773
|
+
* VoteAccount class
|
|
3774
|
+
*/
|
|
3775
|
+
export class VoteAccount {
|
|
3776
|
+
nodePubkey: PublicKey;
|
|
3777
|
+
authorizedWithdrawer: PublicKey;
|
|
3778
|
+
commission: number;
|
|
3779
|
+
rootSlot: number | null;
|
|
3780
|
+
votes: Lockout[];
|
|
3781
|
+
authorizedVoters: AuthorizedVoter[];
|
|
3782
|
+
priorVoters: PriorVoter[];
|
|
3783
|
+
epochCredits: EpochCredits[];
|
|
3784
|
+
lastTimestamp: BlockTimestamp;
|
|
3785
|
+
/**
|
|
3786
|
+
* Deserialize VoteAccount from the account data.
|
|
3787
|
+
*
|
|
3788
|
+
* @param buffer account data
|
|
3789
|
+
* @return VoteAccount
|
|
3790
|
+
*/
|
|
3791
|
+
static fromAccountData(
|
|
3792
|
+
buffer: Buffer | Uint8Array | Array<number>,
|
|
3793
|
+
): VoteAccount;
|
|
3619
3794
|
}
|
|
3620
3795
|
|
|
3621
3796
|
export const SYSVAR_CLOCK_PUBKEY: PublicKey;
|
|
@@ -3628,64 +3803,11 @@ declare module '@solana/web3.js' {
|
|
|
3628
3803
|
export const SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
|
|
3629
3804
|
export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
|
|
3630
3805
|
|
|
3631
|
-
export
|
|
3632
|
-
logs: string[] | undefined;
|
|
3633
|
-
constructor(message: string, logs?: string[]);
|
|
3634
|
-
}
|
|
3635
|
-
export const SolanaJSONRPCErrorCode: {
|
|
3636
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
|
|
3637
|
-
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
|
|
3638
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
|
|
3639
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
|
|
3640
|
-
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
|
|
3641
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
|
|
3642
|
-
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
|
|
3643
|
-
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
|
|
3644
|
-
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
|
|
3645
|
-
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
|
|
3646
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
|
|
3647
|
-
readonly JSON_RPC_SCAN_ERROR: -32012;
|
|
3648
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
|
|
3649
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
|
|
3650
|
-
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
|
|
3651
|
-
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
|
|
3652
|
-
};
|
|
3653
|
-
export type SolanaJSONRPCErrorCodeEnum =
|
|
3654
|
-
typeof SolanaJSONRPCErrorCode[keyof typeof SolanaJSONRPCErrorCode];
|
|
3655
|
-
export class SolanaJSONRPCError extends Error {
|
|
3656
|
-
code: SolanaJSONRPCErrorCodeEnum | unknown;
|
|
3657
|
-
data?: any;
|
|
3658
|
-
constructor(
|
|
3659
|
-
{
|
|
3660
|
-
code,
|
|
3661
|
-
message,
|
|
3662
|
-
data,
|
|
3663
|
-
}: Readonly<{
|
|
3664
|
-
code: unknown;
|
|
3665
|
-
message: string;
|
|
3666
|
-
data?: any;
|
|
3667
|
-
}>,
|
|
3668
|
-
customMessage?: string,
|
|
3669
|
-
);
|
|
3670
|
-
}
|
|
3671
|
-
|
|
3806
|
+
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
|
3672
3807
|
/**
|
|
3673
|
-
*
|
|
3674
|
-
*
|
|
3675
|
-
* If `commitment` option is not specified, defaults to 'max' commitment.
|
|
3676
|
-
*
|
|
3677
|
-
* @param {Connection} connection
|
|
3678
|
-
* @param {Transaction} transaction
|
|
3679
|
-
* @param {Array<Signer>} signers
|
|
3680
|
-
* @param {ConfirmOptions} [options]
|
|
3681
|
-
* @returns {Promise<TransactionSignature>}
|
|
3808
|
+
* Retrieves the RPC API URL for the specified cluster
|
|
3682
3809
|
*/
|
|
3683
|
-
export function
|
|
3684
|
-
connection: Connection,
|
|
3685
|
-
transaction: Transaction,
|
|
3686
|
-
signers: Array<Signer>,
|
|
3687
|
-
options?: ConfirmOptions,
|
|
3688
|
-
): Promise<TransactionSignature>;
|
|
3810
|
+
export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
|
|
3689
3811
|
|
|
3690
3812
|
/**
|
|
3691
3813
|
* Send and confirm a raw transaction
|
|
@@ -3714,20 +3836,23 @@ declare module '@solana/web3.js' {
|
|
|
3714
3836
|
options?: ConfirmOptions,
|
|
3715
3837
|
): Promise<TransactionSignature>;
|
|
3716
3838
|
|
|
3717
|
-
export class TransactionExpiredBlockheightExceededError extends Error {
|
|
3718
|
-
signature: string;
|
|
3719
|
-
constructor(signature: string);
|
|
3720
|
-
}
|
|
3721
|
-
export class TransactionExpiredTimeoutError extends Error {
|
|
3722
|
-
signature: string;
|
|
3723
|
-
constructor(signature: string, timeoutSeconds: number);
|
|
3724
|
-
}
|
|
3725
|
-
|
|
3726
|
-
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
|
3727
3839
|
/**
|
|
3728
|
-
*
|
|
3840
|
+
* Sign, send and confirm a transaction.
|
|
3841
|
+
*
|
|
3842
|
+
* If `commitment` option is not specified, defaults to 'max' commitment.
|
|
3843
|
+
*
|
|
3844
|
+
* @param {Connection} connection
|
|
3845
|
+
* @param {Transaction} transaction
|
|
3846
|
+
* @param {Array<Signer>} signers
|
|
3847
|
+
* @param {ConfirmOptions} [options]
|
|
3848
|
+
* @returns {Promise<TransactionSignature>}
|
|
3729
3849
|
*/
|
|
3730
|
-
export function
|
|
3850
|
+
export function sendAndConfirmTransaction(
|
|
3851
|
+
connection: Connection,
|
|
3852
|
+
transaction: Transaction,
|
|
3853
|
+
signers: Array<Signer>,
|
|
3854
|
+
options?: ConfirmOptions,
|
|
3855
|
+
): Promise<TransactionSignature>;
|
|
3731
3856
|
|
|
3732
3857
|
/**
|
|
3733
3858
|
* There are 1-billion lamports in one SOL
|