@solana/web3.js 1.63.0 → 1.64.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 -2
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +46 -2
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +46 -2
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +44 -2
- package/lib/index.esm.js +46 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +46 -2
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +46 -2
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +90 -0
- package/src/message/v0.ts +12 -4
package/lib/index.cjs.js
CHANGED
|
@@ -1009,13 +1009,13 @@ class MessageV0 {
|
|
|
1009
1009
|
getAccountKeys(args) {
|
|
1010
1010
|
let accountKeysFromLookups;
|
|
1011
1011
|
|
|
1012
|
-
if (args && 'accountKeysFromLookups' in args) {
|
|
1012
|
+
if (args && 'accountKeysFromLookups' in args && args.accountKeysFromLookups) {
|
|
1013
1013
|
if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {
|
|
1014
1014
|
throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');
|
|
1015
1015
|
}
|
|
1016
1016
|
|
|
1017
1017
|
accountKeysFromLookups = args.accountKeysFromLookups;
|
|
1018
|
-
} else if (args && 'addressLookupTableAccounts' in args) {
|
|
1018
|
+
} else if (args && 'addressLookupTableAccounts' in args && args.addressLookupTableAccounts) {
|
|
1019
1019
|
accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);
|
|
1020
1020
|
} else if (this.addressTableLookups.length > 0) {
|
|
1021
1021
|
throw new Error('Failed to get account keys because address table lookups were not resolved');
|
|
@@ -4493,6 +4493,28 @@ const GetBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
|
|
|
4493
4493
|
blockTime: superstruct.nullable(superstruct.number()),
|
|
4494
4494
|
blockHeight: superstruct.nullable(superstruct.number())
|
|
4495
4495
|
})));
|
|
4496
|
+
/**
|
|
4497
|
+
* Expected parsed JSON RPC response for the "getBlock" message
|
|
4498
|
+
*/
|
|
4499
|
+
|
|
4500
|
+
const GetParsedBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
|
|
4501
|
+
blockhash: superstruct.string(),
|
|
4502
|
+
previousBlockhash: superstruct.string(),
|
|
4503
|
+
parentSlot: superstruct.number(),
|
|
4504
|
+
transactions: superstruct.array(superstruct.type({
|
|
4505
|
+
transaction: ParsedConfirmedTransactionResult,
|
|
4506
|
+
meta: superstruct.nullable(ParsedConfirmedTransactionMetaResult),
|
|
4507
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
4508
|
+
})),
|
|
4509
|
+
rewards: superstruct.optional(superstruct.array(superstruct.type({
|
|
4510
|
+
pubkey: superstruct.string(),
|
|
4511
|
+
lamports: superstruct.number(),
|
|
4512
|
+
postBalance: superstruct.nullable(superstruct.number()),
|
|
4513
|
+
rewardType: superstruct.nullable(superstruct.string())
|
|
4514
|
+
}))),
|
|
4515
|
+
blockTime: superstruct.nullable(superstruct.number()),
|
|
4516
|
+
blockHeight: superstruct.nullable(superstruct.number())
|
|
4517
|
+
})));
|
|
4496
4518
|
/**
|
|
4497
4519
|
* Expected JSON RPC response for the "getConfirmedBlock" message
|
|
4498
4520
|
*
|
|
@@ -5832,6 +5854,28 @@ class Connection {
|
|
|
5832
5854
|
}))
|
|
5833
5855
|
};
|
|
5834
5856
|
}
|
|
5857
|
+
/**
|
|
5858
|
+
* Fetch parsed transaction details for a confirmed or finalized block
|
|
5859
|
+
*/
|
|
5860
|
+
|
|
5861
|
+
|
|
5862
|
+
async getParsedBlock(slot, rawConfig) {
|
|
5863
|
+
const {
|
|
5864
|
+
commitment,
|
|
5865
|
+
config
|
|
5866
|
+
} = extractCommitmentFromConfig(rawConfig);
|
|
5867
|
+
|
|
5868
|
+
const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config);
|
|
5869
|
+
|
|
5870
|
+
const unsafeRes = await this._rpcRequest('getBlock', args);
|
|
5871
|
+
const res = superstruct.create(unsafeRes, GetParsedBlockRpcResult);
|
|
5872
|
+
|
|
5873
|
+
if ('error' in res) {
|
|
5874
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block');
|
|
5875
|
+
}
|
|
5876
|
+
|
|
5877
|
+
return res.result;
|
|
5878
|
+
}
|
|
5835
5879
|
/*
|
|
5836
5880
|
* Returns the current block height of the node
|
|
5837
5881
|
*/
|