@solana/web3.js 1.63.2 → 1.64.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 +45 -1
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +45 -1
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +45 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +42 -0
- package/lib/index.esm.js +45 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +45 -1
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +45 -1
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +90 -0
package/lib/index.d.ts
CHANGED
|
@@ -2544,6 +2544,41 @@ declare module '@solana/web3.js' {
|
|
|
2544
2544
|
/** The unix timestamp of when the block was processed */
|
|
2545
2545
|
blockTime: number | null;
|
|
2546
2546
|
};
|
|
2547
|
+
/**
|
|
2548
|
+
* A block with parsed transactions
|
|
2549
|
+
*/
|
|
2550
|
+
export type ParsedBlockResponse = {
|
|
2551
|
+
/** Blockhash of this block */
|
|
2552
|
+
blockhash: Blockhash;
|
|
2553
|
+
/** Blockhash of this block's parent */
|
|
2554
|
+
previousBlockhash: Blockhash;
|
|
2555
|
+
/** Slot index of this block's parent */
|
|
2556
|
+
parentSlot: number;
|
|
2557
|
+
/** Vector of transactions with status meta and original message */
|
|
2558
|
+
transactions: Array<{
|
|
2559
|
+
/** The details of the transaction */
|
|
2560
|
+
transaction: ParsedTransaction;
|
|
2561
|
+
/** Metadata produced from the transaction */
|
|
2562
|
+
meta: ParsedTransactionMeta | null;
|
|
2563
|
+
/** The transaction version */
|
|
2564
|
+
version?: TransactionVersion;
|
|
2565
|
+
}>;
|
|
2566
|
+
/** Vector of block rewards */
|
|
2567
|
+
rewards?: Array<{
|
|
2568
|
+
/** Public key of reward recipient */
|
|
2569
|
+
pubkey: string;
|
|
2570
|
+
/** Reward value in lamports */
|
|
2571
|
+
lamports: number;
|
|
2572
|
+
/** Account balance after reward is applied */
|
|
2573
|
+
postBalance: number | null;
|
|
2574
|
+
/** Type of reward received */
|
|
2575
|
+
rewardType: string | null;
|
|
2576
|
+
}>;
|
|
2577
|
+
/** The unix timestamp of when the block was processed */
|
|
2578
|
+
blockTime: number | null;
|
|
2579
|
+
/** The number of blocks beneath this block */
|
|
2580
|
+
blockHeight: number | null;
|
|
2581
|
+
};
|
|
2547
2582
|
/**
|
|
2548
2583
|
* A processed block fetched from the RPC API
|
|
2549
2584
|
*/
|
|
@@ -3455,6 +3490,13 @@ declare module '@solana/web3.js' {
|
|
|
3455
3490
|
slot: number,
|
|
3456
3491
|
rawConfig?: GetVersionedBlockConfig,
|
|
3457
3492
|
): Promise<VersionedBlockResponse | null>;
|
|
3493
|
+
/**
|
|
3494
|
+
* Fetch parsed transaction details for a confirmed or finalized block
|
|
3495
|
+
*/
|
|
3496
|
+
getParsedBlock(
|
|
3497
|
+
slot: number,
|
|
3498
|
+
rawConfig?: GetVersionedBlockConfig,
|
|
3499
|
+
): Promise<ParsedBlockResponse | null>;
|
|
3458
3500
|
getBlockHeight(
|
|
3459
3501
|
commitmentOrConfig?: Commitment | GetBlockHeightConfig,
|
|
3460
3502
|
): Promise<number>;
|
package/lib/index.esm.js
CHANGED
|
@@ -4485,6 +4485,28 @@ const GetBlockRpcResult = jsonRpcResult(nullable(type({
|
|
|
4485
4485
|
blockTime: nullable(number()),
|
|
4486
4486
|
blockHeight: nullable(number())
|
|
4487
4487
|
})));
|
|
4488
|
+
/**
|
|
4489
|
+
* Expected parsed JSON RPC response for the "getBlock" message
|
|
4490
|
+
*/
|
|
4491
|
+
|
|
4492
|
+
const GetParsedBlockRpcResult = jsonRpcResult(nullable(type({
|
|
4493
|
+
blockhash: string(),
|
|
4494
|
+
previousBlockhash: string(),
|
|
4495
|
+
parentSlot: number(),
|
|
4496
|
+
transactions: array(type({
|
|
4497
|
+
transaction: ParsedConfirmedTransactionResult,
|
|
4498
|
+
meta: nullable(ParsedConfirmedTransactionMetaResult),
|
|
4499
|
+
version: optional(TransactionVersionStruct)
|
|
4500
|
+
})),
|
|
4501
|
+
rewards: optional(array(type({
|
|
4502
|
+
pubkey: string(),
|
|
4503
|
+
lamports: number(),
|
|
4504
|
+
postBalance: nullable(number()),
|
|
4505
|
+
rewardType: nullable(string())
|
|
4506
|
+
}))),
|
|
4507
|
+
blockTime: nullable(number()),
|
|
4508
|
+
blockHeight: nullable(number())
|
|
4509
|
+
})));
|
|
4488
4510
|
/**
|
|
4489
4511
|
* Expected JSON RPC response for the "getConfirmedBlock" message
|
|
4490
4512
|
*
|
|
@@ -4619,7 +4641,7 @@ const LogsNotificationResult = type({
|
|
|
4619
4641
|
|
|
4620
4642
|
/** @internal */
|
|
4621
4643
|
const COMMON_HTTP_HEADERS = {
|
|
4622
|
-
'solana-client': `js/${(_process$env$npm_pack = "1.
|
|
4644
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.64.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
4623
4645
|
};
|
|
4624
4646
|
/**
|
|
4625
4647
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -5824,6 +5846,28 @@ class Connection {
|
|
|
5824
5846
|
}))
|
|
5825
5847
|
};
|
|
5826
5848
|
}
|
|
5849
|
+
/**
|
|
5850
|
+
* Fetch parsed transaction details for a confirmed or finalized block
|
|
5851
|
+
*/
|
|
5852
|
+
|
|
5853
|
+
|
|
5854
|
+
async getParsedBlock(slot, rawConfig) {
|
|
5855
|
+
const {
|
|
5856
|
+
commitment,
|
|
5857
|
+
config
|
|
5858
|
+
} = extractCommitmentFromConfig(rawConfig);
|
|
5859
|
+
|
|
5860
|
+
const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config);
|
|
5861
|
+
|
|
5862
|
+
const unsafeRes = await this._rpcRequest('getBlock', args);
|
|
5863
|
+
const res = create(unsafeRes, GetParsedBlockRpcResult);
|
|
5864
|
+
|
|
5865
|
+
if ('error' in res) {
|
|
5866
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block');
|
|
5867
|
+
}
|
|
5868
|
+
|
|
5869
|
+
return res.result;
|
|
5870
|
+
}
|
|
5827
5871
|
/*
|
|
5828
5872
|
* Returns the current block height of the node
|
|
5829
5873
|
*/
|