@solana/web3.js 1.63.1 → 1.65.0
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 +46 -1
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +46 -1
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +46 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +48 -1
- package/lib/index.esm.js +46 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +46 -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 +46 -1
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +94 -0
- package/src/publickey.ts +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -50,7 +50,8 @@ declare module '@solana/web3.js' {
|
|
|
50
50
|
*/
|
|
51
51
|
static unique(): PublicKey;
|
|
52
52
|
/**
|
|
53
|
-
* Default public key value. (
|
|
53
|
+
* Default public key value. The base58-encoded string representation is all ones (as seen below)
|
|
54
|
+
* The underlying BN number is 32 bytes that are all zeros
|
|
54
55
|
*/
|
|
55
56
|
static default: PublicKey;
|
|
56
57
|
/**
|
|
@@ -2025,6 +2026,8 @@ declare module '@solana/web3.js' {
|
|
|
2025
2026
|
commitment?: Commitment;
|
|
2026
2027
|
/** The minimum slot that the request can be evaluated at */
|
|
2027
2028
|
minContextSlot?: number;
|
|
2029
|
+
/** Optional data slice to limit the returned account data */
|
|
2030
|
+
dataSlice?: DataSlice;
|
|
2028
2031
|
};
|
|
2029
2032
|
/**
|
|
2030
2033
|
* Configuration object for changing `getBalance` query behavior
|
|
@@ -2544,6 +2547,41 @@ declare module '@solana/web3.js' {
|
|
|
2544
2547
|
/** The unix timestamp of when the block was processed */
|
|
2545
2548
|
blockTime: number | null;
|
|
2546
2549
|
};
|
|
2550
|
+
/**
|
|
2551
|
+
* A block with parsed transactions
|
|
2552
|
+
*/
|
|
2553
|
+
export type ParsedBlockResponse = {
|
|
2554
|
+
/** Blockhash of this block */
|
|
2555
|
+
blockhash: Blockhash;
|
|
2556
|
+
/** Blockhash of this block's parent */
|
|
2557
|
+
previousBlockhash: Blockhash;
|
|
2558
|
+
/** Slot index of this block's parent */
|
|
2559
|
+
parentSlot: number;
|
|
2560
|
+
/** Vector of transactions with status meta and original message */
|
|
2561
|
+
transactions: Array<{
|
|
2562
|
+
/** The details of the transaction */
|
|
2563
|
+
transaction: ParsedTransaction;
|
|
2564
|
+
/** Metadata produced from the transaction */
|
|
2565
|
+
meta: ParsedTransactionMeta | null;
|
|
2566
|
+
/** The transaction version */
|
|
2567
|
+
version?: TransactionVersion;
|
|
2568
|
+
}>;
|
|
2569
|
+
/** Vector of block rewards */
|
|
2570
|
+
rewards?: Array<{
|
|
2571
|
+
/** Public key of reward recipient */
|
|
2572
|
+
pubkey: string;
|
|
2573
|
+
/** Reward value in lamports */
|
|
2574
|
+
lamports: number;
|
|
2575
|
+
/** Account balance after reward is applied */
|
|
2576
|
+
postBalance: number | null;
|
|
2577
|
+
/** Type of reward received */
|
|
2578
|
+
rewardType: string | null;
|
|
2579
|
+
}>;
|
|
2580
|
+
/** The unix timestamp of when the block was processed */
|
|
2581
|
+
blockTime: number | null;
|
|
2582
|
+
/** The number of blocks beneath this block */
|
|
2583
|
+
blockHeight: number | null;
|
|
2584
|
+
};
|
|
2547
2585
|
/**
|
|
2548
2586
|
* A processed block fetched from the RPC API
|
|
2549
2587
|
*/
|
|
@@ -2871,6 +2909,8 @@ declare module '@solana/web3.js' {
|
|
|
2871
2909
|
commitment?: Commitment;
|
|
2872
2910
|
/** The minimum slot that the request can be evaluated at */
|
|
2873
2911
|
minContextSlot?: number;
|
|
2912
|
+
/** Optional data slice to limit the returned account data */
|
|
2913
|
+
dataSlice?: DataSlice;
|
|
2874
2914
|
};
|
|
2875
2915
|
/**
|
|
2876
2916
|
* Configuration object for `getStakeActivation`
|
|
@@ -3455,6 +3495,13 @@ declare module '@solana/web3.js' {
|
|
|
3455
3495
|
slot: number,
|
|
3456
3496
|
rawConfig?: GetVersionedBlockConfig,
|
|
3457
3497
|
): Promise<VersionedBlockResponse | null>;
|
|
3498
|
+
/**
|
|
3499
|
+
* Fetch parsed transaction details for a confirmed or finalized block
|
|
3500
|
+
*/
|
|
3501
|
+
getParsedBlock(
|
|
3502
|
+
slot: number,
|
|
3503
|
+
rawConfig?: GetVersionedBlockConfig,
|
|
3504
|
+
): Promise<ParsedBlockResponse | null>;
|
|
3458
3505
|
getBlockHeight(
|
|
3459
3506
|
commitmentOrConfig?: Commitment | GetBlockHeightConfig,
|
|
3460
3507
|
): Promise<number>;
|
package/lib/index.esm.js
CHANGED
|
@@ -166,7 +166,8 @@ class PublicKey extends Struct {
|
|
|
166
166
|
return new PublicKey(key.toBuffer());
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
|
-
* Default public key value. (
|
|
169
|
+
* Default public key value. The base58-encoded string representation is all ones (as seen below)
|
|
170
|
+
* The underlying BN number is 32 bytes that are all zeros
|
|
170
171
|
*/
|
|
171
172
|
|
|
172
173
|
|
|
@@ -4460,6 +4461,28 @@ const GetBlockRpcResult = jsonRpcResult(nullable(type({
|
|
|
4460
4461
|
blockTime: nullable(number()),
|
|
4461
4462
|
blockHeight: nullable(number())
|
|
4462
4463
|
})));
|
|
4464
|
+
/**
|
|
4465
|
+
* Expected parsed JSON RPC response for the "getBlock" message
|
|
4466
|
+
*/
|
|
4467
|
+
|
|
4468
|
+
const GetParsedBlockRpcResult = jsonRpcResult(nullable(type({
|
|
4469
|
+
blockhash: string(),
|
|
4470
|
+
previousBlockhash: string(),
|
|
4471
|
+
parentSlot: number(),
|
|
4472
|
+
transactions: array(type({
|
|
4473
|
+
transaction: ParsedConfirmedTransactionResult,
|
|
4474
|
+
meta: nullable(ParsedConfirmedTransactionMetaResult),
|
|
4475
|
+
version: optional(TransactionVersionStruct)
|
|
4476
|
+
})),
|
|
4477
|
+
rewards: optional(array(type({
|
|
4478
|
+
pubkey: string(),
|
|
4479
|
+
lamports: number(),
|
|
4480
|
+
postBalance: nullable(number()),
|
|
4481
|
+
rewardType: nullable(string())
|
|
4482
|
+
}))),
|
|
4483
|
+
blockTime: nullable(number()),
|
|
4484
|
+
blockHeight: nullable(number())
|
|
4485
|
+
})));
|
|
4463
4486
|
/**
|
|
4464
4487
|
* Expected JSON RPC response for the "getConfirmedBlock" message
|
|
4465
4488
|
*
|
|
@@ -5799,6 +5822,28 @@ class Connection {
|
|
|
5799
5822
|
}))
|
|
5800
5823
|
};
|
|
5801
5824
|
}
|
|
5825
|
+
/**
|
|
5826
|
+
* Fetch parsed transaction details for a confirmed or finalized block
|
|
5827
|
+
*/
|
|
5828
|
+
|
|
5829
|
+
|
|
5830
|
+
async getParsedBlock(slot, rawConfig) {
|
|
5831
|
+
const {
|
|
5832
|
+
commitment,
|
|
5833
|
+
config
|
|
5834
|
+
} = extractCommitmentFromConfig(rawConfig);
|
|
5835
|
+
|
|
5836
|
+
const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config);
|
|
5837
|
+
|
|
5838
|
+
const unsafeRes = await this._rpcRequest('getBlock', args);
|
|
5839
|
+
const res = create(unsafeRes, GetParsedBlockRpcResult);
|
|
5840
|
+
|
|
5841
|
+
if ('error' in res) {
|
|
5842
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block');
|
|
5843
|
+
}
|
|
5844
|
+
|
|
5845
|
+
return res.result;
|
|
5846
|
+
}
|
|
5802
5847
|
/*
|
|
5803
5848
|
* Returns the current block height of the node
|
|
5804
5849
|
*/
|