@solana/web3.js 1.55.0 → 1.56.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.browser.cjs.js +78 -19
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +78 -19
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +78 -19
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +133 -4
- package/lib/index.esm.js +78 -19
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +78 -19
- 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 +78 -19
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +250 -21
package/lib/index.cjs.js
CHANGED
|
@@ -3297,6 +3297,28 @@ function notificationResultAndContext(value) {
|
|
|
3297
3297
|
value
|
|
3298
3298
|
});
|
|
3299
3299
|
}
|
|
3300
|
+
/**
|
|
3301
|
+
* @internal
|
|
3302
|
+
*/
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
function versionedMessageFromResponse(version, response) {
|
|
3306
|
+
if (version === 0) {
|
|
3307
|
+
return new MessageV0({
|
|
3308
|
+
header: response.header,
|
|
3309
|
+
staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)),
|
|
3310
|
+
recentBlockhash: response.recentBlockhash,
|
|
3311
|
+
compiledInstructions: response.instructions.map(ix => ({
|
|
3312
|
+
programIdIndex: ix.programIdIndex,
|
|
3313
|
+
accountKeyIndexes: ix.accounts,
|
|
3314
|
+
data: bs58__default["default"].decode(ix.data)
|
|
3315
|
+
})),
|
|
3316
|
+
addressTableLookups: response.addressTableLookups
|
|
3317
|
+
});
|
|
3318
|
+
} else {
|
|
3319
|
+
return new Message(response);
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3300
3322
|
/**
|
|
3301
3323
|
* The level of commitment desired when querying state
|
|
3302
3324
|
* <pre>
|
|
@@ -3860,6 +3882,11 @@ const GetSignatureStatusesRpcResult = jsonRpcResultAndContext(superstruct.array(
|
|
|
3860
3882
|
*/
|
|
3861
3883
|
|
|
3862
3884
|
const GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult(superstruct.number());
|
|
3885
|
+
const AddressTableLookupStruct = superstruct.type({
|
|
3886
|
+
accountKey: PublicKeyFromString,
|
|
3887
|
+
writableIndexes: superstruct.array(superstruct.number()),
|
|
3888
|
+
readonlyIndexes: superstruct.array(superstruct.number())
|
|
3889
|
+
});
|
|
3863
3890
|
const ConfirmedTransactionResult = superstruct.type({
|
|
3864
3891
|
signatures: superstruct.array(superstruct.string()),
|
|
3865
3892
|
message: superstruct.type({
|
|
@@ -3874,7 +3901,8 @@ const ConfirmedTransactionResult = superstruct.type({
|
|
|
3874
3901
|
data: superstruct.string(),
|
|
3875
3902
|
programIdIndex: superstruct.number()
|
|
3876
3903
|
})),
|
|
3877
|
-
recentBlockhash: superstruct.string()
|
|
3904
|
+
recentBlockhash: superstruct.string(),
|
|
3905
|
+
addressTableLookups: superstruct.optional(superstruct.array(AddressTableLookupStruct))
|
|
3878
3906
|
})
|
|
3879
3907
|
});
|
|
3880
3908
|
const ParsedInstructionResult = superstruct.type({
|
|
@@ -3917,7 +3945,8 @@ const ParsedConfirmedTransactionResult = superstruct.type({
|
|
|
3917
3945
|
writable: superstruct.boolean()
|
|
3918
3946
|
})),
|
|
3919
3947
|
instructions: superstruct.array(ParsedOrRawInstruction),
|
|
3920
|
-
recentBlockhash: superstruct.string()
|
|
3948
|
+
recentBlockhash: superstruct.string(),
|
|
3949
|
+
addressTableLookups: superstruct.optional(superstruct.nullable(superstruct.array(AddressTableLookupStruct)))
|
|
3921
3950
|
})
|
|
3922
3951
|
});
|
|
3923
3952
|
const TokenBalanceResult = superstruct.type({
|
|
@@ -3950,7 +3979,8 @@ const ConfirmedTransactionMetaResult = superstruct.type({
|
|
|
3950
3979
|
logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
|
|
3951
3980
|
preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
|
|
3952
3981
|
postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
|
|
3953
|
-
loadedAddresses: superstruct.optional(LoadedAddressesResult)
|
|
3982
|
+
loadedAddresses: superstruct.optional(LoadedAddressesResult),
|
|
3983
|
+
computeUnitsConsumed: superstruct.optional(superstruct.number())
|
|
3954
3984
|
});
|
|
3955
3985
|
/**
|
|
3956
3986
|
* @internal
|
|
@@ -3968,8 +3998,10 @@ const ParsedConfirmedTransactionMetaResult = superstruct.type({
|
|
|
3968
3998
|
logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
|
|
3969
3999
|
preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
|
|
3970
4000
|
postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
|
|
3971
|
-
loadedAddresses: superstruct.optional(LoadedAddressesResult)
|
|
4001
|
+
loadedAddresses: superstruct.optional(LoadedAddressesResult),
|
|
4002
|
+
computeUnitsConsumed: superstruct.optional(superstruct.number())
|
|
3972
4003
|
});
|
|
4004
|
+
const TransactionVersionStruct = superstruct.union([superstruct.literal(0), superstruct.literal('legacy')]);
|
|
3973
4005
|
/**
|
|
3974
4006
|
* Expected JSON RPC response for the "getBlock" message
|
|
3975
4007
|
*/
|
|
@@ -3980,7 +4012,8 @@ const GetBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
|
|
|
3980
4012
|
parentSlot: superstruct.number(),
|
|
3981
4013
|
transactions: superstruct.array(superstruct.type({
|
|
3982
4014
|
transaction: ConfirmedTransactionResult,
|
|
3983
|
-
meta: superstruct.nullable(ConfirmedTransactionMetaResult)
|
|
4015
|
+
meta: superstruct.nullable(ConfirmedTransactionMetaResult),
|
|
4016
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
3984
4017
|
})),
|
|
3985
4018
|
rewards: superstruct.optional(superstruct.array(superstruct.type({
|
|
3986
4019
|
pubkey: superstruct.string(),
|
|
@@ -4032,7 +4065,8 @@ const GetTransactionRpcResult = jsonRpcResult(superstruct.nullable(superstruct.t
|
|
|
4032
4065
|
slot: superstruct.number(),
|
|
4033
4066
|
meta: ConfirmedTransactionMetaResult,
|
|
4034
4067
|
blockTime: superstruct.optional(superstruct.nullable(superstruct.number())),
|
|
4035
|
-
transaction: ConfirmedTransactionResult
|
|
4068
|
+
transaction: ConfirmedTransactionResult,
|
|
4069
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
4036
4070
|
})));
|
|
4037
4071
|
/**
|
|
4038
4072
|
* Expected parsed JSON RPC response for the "getTransaction" message
|
|
@@ -4042,7 +4076,8 @@ const GetParsedTransactionRpcResult = jsonRpcResult(superstruct.nullable(superst
|
|
|
4042
4076
|
slot: superstruct.number(),
|
|
4043
4077
|
transaction: ParsedConfirmedTransactionResult,
|
|
4044
4078
|
meta: superstruct.nullable(ParsedConfirmedTransactionMetaResult),
|
|
4045
|
-
blockTime: superstruct.optional(superstruct.nullable(superstruct.number()))
|
|
4079
|
+
blockTime: superstruct.optional(superstruct.nullable(superstruct.number())),
|
|
4080
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
4046
4081
|
})));
|
|
4047
4082
|
/**
|
|
4048
4083
|
* Expected JSON RPC response for the "getRecentBlockhash" message
|
|
@@ -5285,9 +5320,16 @@ class Connection {
|
|
|
5285
5320
|
}
|
|
5286
5321
|
/**
|
|
5287
5322
|
* Fetch a processed block from the cluster.
|
|
5323
|
+
*
|
|
5324
|
+
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
5325
|
+
* setting the `maxSupportedTransactionVersion` property.
|
|
5288
5326
|
*/
|
|
5289
5327
|
|
|
5290
5328
|
|
|
5329
|
+
/**
|
|
5330
|
+
* Fetch a processed block from the cluster.
|
|
5331
|
+
*/
|
|
5332
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5291
5333
|
async getBlock(slot, rawConfig) {
|
|
5292
5334
|
const {
|
|
5293
5335
|
commitment,
|
|
@@ -5310,16 +5352,15 @@ class Connection {
|
|
|
5310
5352
|
return { ...result,
|
|
5311
5353
|
transactions: result.transactions.map(({
|
|
5312
5354
|
transaction,
|
|
5313
|
-
meta
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
})
|
|
5355
|
+
meta,
|
|
5356
|
+
version
|
|
5357
|
+
}) => ({
|
|
5358
|
+
meta,
|
|
5359
|
+
transaction: { ...transaction,
|
|
5360
|
+
message: versionedMessageFromResponse(version, transaction.message)
|
|
5361
|
+
},
|
|
5362
|
+
version
|
|
5363
|
+
}))
|
|
5323
5364
|
};
|
|
5324
5365
|
}
|
|
5325
5366
|
/*
|
|
@@ -5379,9 +5420,17 @@ class Connection {
|
|
|
5379
5420
|
}
|
|
5380
5421
|
/**
|
|
5381
5422
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5423
|
+
*
|
|
5424
|
+
* @deprecated Instead, call `getTransaction` using a
|
|
5425
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5426
|
+
* `maxSupportedTransactionVersion` property.
|
|
5382
5427
|
*/
|
|
5383
5428
|
|
|
5384
5429
|
|
|
5430
|
+
/**
|
|
5431
|
+
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5432
|
+
*/
|
|
5433
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5385
5434
|
async getTransaction(signature, rawConfig) {
|
|
5386
5435
|
const {
|
|
5387
5436
|
commitment,
|
|
@@ -5403,7 +5452,7 @@ class Connection {
|
|
|
5403
5452
|
if (!result) return result;
|
|
5404
5453
|
return { ...result,
|
|
5405
5454
|
transaction: { ...result.transaction,
|
|
5406
|
-
message:
|
|
5455
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5407
5456
|
}
|
|
5408
5457
|
};
|
|
5409
5458
|
}
|
|
@@ -5462,9 +5511,19 @@ class Connection {
|
|
|
5462
5511
|
/**
|
|
5463
5512
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
5464
5513
|
* Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
|
|
5514
|
+
*
|
|
5515
|
+
* @deprecated Instead, call `getTransactions` using a
|
|
5516
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5517
|
+
* `maxSupportedTransactionVersion` property.
|
|
5465
5518
|
*/
|
|
5466
5519
|
|
|
5467
5520
|
|
|
5521
|
+
/**
|
|
5522
|
+
* Fetch transaction details for a batch of confirmed transactions.
|
|
5523
|
+
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
5524
|
+
* VersionedTransactionResponse}.
|
|
5525
|
+
*/
|
|
5526
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5468
5527
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
5469
5528
|
const {
|
|
5470
5529
|
commitment,
|
|
@@ -5492,7 +5551,7 @@ class Connection {
|
|
|
5492
5551
|
if (!result) return result;
|
|
5493
5552
|
return { ...result,
|
|
5494
5553
|
transaction: { ...result.transaction,
|
|
5495
|
-
message:
|
|
5554
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5496
5555
|
}
|
|
5497
5556
|
};
|
|
5498
5557
|
});
|