@solana/web3.js 1.55.0 → 1.56.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 +74 -17
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +74 -17
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +74 -17
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +129 -4
- package/lib/index.esm.js +74 -17
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +74 -17
- 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 +74 -17
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +244 -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({
|
|
@@ -3970,6 +3999,7 @@ const ParsedConfirmedTransactionMetaResult = superstruct.type({
|
|
|
3970
3999
|
postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
|
|
3971
4000
|
loadedAddresses: superstruct.optional(LoadedAddressesResult)
|
|
3972
4001
|
});
|
|
4002
|
+
const TransactionVersionStruct = superstruct.union([superstruct.literal(0), superstruct.literal('legacy')]);
|
|
3973
4003
|
/**
|
|
3974
4004
|
* Expected JSON RPC response for the "getBlock" message
|
|
3975
4005
|
*/
|
|
@@ -3980,7 +4010,8 @@ const GetBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
|
|
|
3980
4010
|
parentSlot: superstruct.number(),
|
|
3981
4011
|
transactions: superstruct.array(superstruct.type({
|
|
3982
4012
|
transaction: ConfirmedTransactionResult,
|
|
3983
|
-
meta: superstruct.nullable(ConfirmedTransactionMetaResult)
|
|
4013
|
+
meta: superstruct.nullable(ConfirmedTransactionMetaResult),
|
|
4014
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
3984
4015
|
})),
|
|
3985
4016
|
rewards: superstruct.optional(superstruct.array(superstruct.type({
|
|
3986
4017
|
pubkey: superstruct.string(),
|
|
@@ -4032,7 +4063,8 @@ const GetTransactionRpcResult = jsonRpcResult(superstruct.nullable(superstruct.t
|
|
|
4032
4063
|
slot: superstruct.number(),
|
|
4033
4064
|
meta: ConfirmedTransactionMetaResult,
|
|
4034
4065
|
blockTime: superstruct.optional(superstruct.nullable(superstruct.number())),
|
|
4035
|
-
transaction: ConfirmedTransactionResult
|
|
4066
|
+
transaction: ConfirmedTransactionResult,
|
|
4067
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
4036
4068
|
})));
|
|
4037
4069
|
/**
|
|
4038
4070
|
* Expected parsed JSON RPC response for the "getTransaction" message
|
|
@@ -4042,7 +4074,8 @@ const GetParsedTransactionRpcResult = jsonRpcResult(superstruct.nullable(superst
|
|
|
4042
4074
|
slot: superstruct.number(),
|
|
4043
4075
|
transaction: ParsedConfirmedTransactionResult,
|
|
4044
4076
|
meta: superstruct.nullable(ParsedConfirmedTransactionMetaResult),
|
|
4045
|
-
blockTime: superstruct.optional(superstruct.nullable(superstruct.number()))
|
|
4077
|
+
blockTime: superstruct.optional(superstruct.nullable(superstruct.number())),
|
|
4078
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
4046
4079
|
})));
|
|
4047
4080
|
/**
|
|
4048
4081
|
* Expected JSON RPC response for the "getRecentBlockhash" message
|
|
@@ -5285,9 +5318,16 @@ class Connection {
|
|
|
5285
5318
|
}
|
|
5286
5319
|
/**
|
|
5287
5320
|
* Fetch a processed block from the cluster.
|
|
5321
|
+
*
|
|
5322
|
+
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
5323
|
+
* setting the `maxSupportedTransactionVersion` property.
|
|
5288
5324
|
*/
|
|
5289
5325
|
|
|
5290
5326
|
|
|
5327
|
+
/**
|
|
5328
|
+
* Fetch a processed block from the cluster.
|
|
5329
|
+
*/
|
|
5330
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5291
5331
|
async getBlock(slot, rawConfig) {
|
|
5292
5332
|
const {
|
|
5293
5333
|
commitment,
|
|
@@ -5310,16 +5350,15 @@ class Connection {
|
|
|
5310
5350
|
return { ...result,
|
|
5311
5351
|
transactions: result.transactions.map(({
|
|
5312
5352
|
transaction,
|
|
5313
|
-
meta
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
})
|
|
5353
|
+
meta,
|
|
5354
|
+
version
|
|
5355
|
+
}) => ({
|
|
5356
|
+
meta,
|
|
5357
|
+
transaction: { ...transaction,
|
|
5358
|
+
message: versionedMessageFromResponse(version, transaction.message)
|
|
5359
|
+
},
|
|
5360
|
+
version
|
|
5361
|
+
}))
|
|
5323
5362
|
};
|
|
5324
5363
|
}
|
|
5325
5364
|
/*
|
|
@@ -5379,9 +5418,17 @@ class Connection {
|
|
|
5379
5418
|
}
|
|
5380
5419
|
/**
|
|
5381
5420
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5421
|
+
*
|
|
5422
|
+
* @deprecated Instead, call `getTransaction` using a
|
|
5423
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5424
|
+
* `maxSupportedTransactionVersion` property.
|
|
5382
5425
|
*/
|
|
5383
5426
|
|
|
5384
5427
|
|
|
5428
|
+
/**
|
|
5429
|
+
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5430
|
+
*/
|
|
5431
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5385
5432
|
async getTransaction(signature, rawConfig) {
|
|
5386
5433
|
const {
|
|
5387
5434
|
commitment,
|
|
@@ -5403,7 +5450,7 @@ class Connection {
|
|
|
5403
5450
|
if (!result) return result;
|
|
5404
5451
|
return { ...result,
|
|
5405
5452
|
transaction: { ...result.transaction,
|
|
5406
|
-
message:
|
|
5453
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5407
5454
|
}
|
|
5408
5455
|
};
|
|
5409
5456
|
}
|
|
@@ -5462,9 +5509,19 @@ class Connection {
|
|
|
5462
5509
|
/**
|
|
5463
5510
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
5464
5511
|
* Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
|
|
5512
|
+
*
|
|
5513
|
+
* @deprecated Instead, call `getTransactions` using a
|
|
5514
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5515
|
+
* `maxSupportedTransactionVersion` property.
|
|
5465
5516
|
*/
|
|
5466
5517
|
|
|
5467
5518
|
|
|
5519
|
+
/**
|
|
5520
|
+
* Fetch transaction details for a batch of confirmed transactions.
|
|
5521
|
+
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
5522
|
+
* VersionedTransactionResponse}.
|
|
5523
|
+
*/
|
|
5524
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5468
5525
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
5469
5526
|
const {
|
|
5470
5527
|
commitment,
|
|
@@ -5492,7 +5549,7 @@ class Connection {
|
|
|
5492
5549
|
if (!result) return result;
|
|
5493
5550
|
return { ...result,
|
|
5494
5551
|
transaction: { ...result.transaction,
|
|
5495
|
-
message:
|
|
5552
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5496
5553
|
}
|
|
5497
5554
|
};
|
|
5498
5555
|
});
|