@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.browser.esm.js
CHANGED
|
@@ -3208,6 +3208,28 @@ function notificationResultAndContext(value) {
|
|
|
3208
3208
|
value
|
|
3209
3209
|
});
|
|
3210
3210
|
}
|
|
3211
|
+
/**
|
|
3212
|
+
* @internal
|
|
3213
|
+
*/
|
|
3214
|
+
|
|
3215
|
+
|
|
3216
|
+
function versionedMessageFromResponse(version, response) {
|
|
3217
|
+
if (version === 0) {
|
|
3218
|
+
return new MessageV0({
|
|
3219
|
+
header: response.header,
|
|
3220
|
+
staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)),
|
|
3221
|
+
recentBlockhash: response.recentBlockhash,
|
|
3222
|
+
compiledInstructions: response.instructions.map(ix => ({
|
|
3223
|
+
programIdIndex: ix.programIdIndex,
|
|
3224
|
+
accountKeyIndexes: ix.accounts,
|
|
3225
|
+
data: bs58.decode(ix.data)
|
|
3226
|
+
})),
|
|
3227
|
+
addressTableLookups: response.addressTableLookups
|
|
3228
|
+
});
|
|
3229
|
+
} else {
|
|
3230
|
+
return new Message(response);
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3211
3233
|
/**
|
|
3212
3234
|
* The level of commitment desired when querying state
|
|
3213
3235
|
* <pre>
|
|
@@ -3763,6 +3785,11 @@ const GetSignatureStatusesRpcResult = jsonRpcResultAndContext(array(nullable(Sig
|
|
|
3763
3785
|
*/
|
|
3764
3786
|
|
|
3765
3787
|
const GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult(number());
|
|
3788
|
+
const AddressTableLookupStruct = type({
|
|
3789
|
+
accountKey: PublicKeyFromString,
|
|
3790
|
+
writableIndexes: array(number()),
|
|
3791
|
+
readonlyIndexes: array(number())
|
|
3792
|
+
});
|
|
3766
3793
|
const ConfirmedTransactionResult = type({
|
|
3767
3794
|
signatures: array(string()),
|
|
3768
3795
|
message: type({
|
|
@@ -3777,7 +3804,8 @@ const ConfirmedTransactionResult = type({
|
|
|
3777
3804
|
data: string(),
|
|
3778
3805
|
programIdIndex: number()
|
|
3779
3806
|
})),
|
|
3780
|
-
recentBlockhash: string()
|
|
3807
|
+
recentBlockhash: string(),
|
|
3808
|
+
addressTableLookups: optional(array(AddressTableLookupStruct))
|
|
3781
3809
|
})
|
|
3782
3810
|
});
|
|
3783
3811
|
const ParsedInstructionResult = type({
|
|
@@ -3820,7 +3848,8 @@ const ParsedConfirmedTransactionResult = type({
|
|
|
3820
3848
|
writable: boolean()
|
|
3821
3849
|
})),
|
|
3822
3850
|
instructions: array(ParsedOrRawInstruction),
|
|
3823
|
-
recentBlockhash: string()
|
|
3851
|
+
recentBlockhash: string(),
|
|
3852
|
+
addressTableLookups: optional(nullable(array(AddressTableLookupStruct)))
|
|
3824
3853
|
})
|
|
3825
3854
|
});
|
|
3826
3855
|
const TokenBalanceResult = type({
|
|
@@ -3873,6 +3902,7 @@ const ParsedConfirmedTransactionMetaResult = type({
|
|
|
3873
3902
|
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
3874
3903
|
loadedAddresses: optional(LoadedAddressesResult)
|
|
3875
3904
|
});
|
|
3905
|
+
const TransactionVersionStruct = union([literal(0), literal('legacy')]);
|
|
3876
3906
|
/**
|
|
3877
3907
|
* Expected JSON RPC response for the "getBlock" message
|
|
3878
3908
|
*/
|
|
@@ -3883,7 +3913,8 @@ const GetBlockRpcResult = jsonRpcResult(nullable(type({
|
|
|
3883
3913
|
parentSlot: number(),
|
|
3884
3914
|
transactions: array(type({
|
|
3885
3915
|
transaction: ConfirmedTransactionResult,
|
|
3886
|
-
meta: nullable(ConfirmedTransactionMetaResult)
|
|
3916
|
+
meta: nullable(ConfirmedTransactionMetaResult),
|
|
3917
|
+
version: optional(TransactionVersionStruct)
|
|
3887
3918
|
})),
|
|
3888
3919
|
rewards: optional(array(type({
|
|
3889
3920
|
pubkey: string(),
|
|
@@ -3935,7 +3966,8 @@ const GetTransactionRpcResult = jsonRpcResult(nullable(type({
|
|
|
3935
3966
|
slot: number(),
|
|
3936
3967
|
meta: ConfirmedTransactionMetaResult,
|
|
3937
3968
|
blockTime: optional(nullable(number())),
|
|
3938
|
-
transaction: ConfirmedTransactionResult
|
|
3969
|
+
transaction: ConfirmedTransactionResult,
|
|
3970
|
+
version: optional(TransactionVersionStruct)
|
|
3939
3971
|
})));
|
|
3940
3972
|
/**
|
|
3941
3973
|
* Expected parsed JSON RPC response for the "getTransaction" message
|
|
@@ -3945,7 +3977,8 @@ const GetParsedTransactionRpcResult = jsonRpcResult(nullable(type({
|
|
|
3945
3977
|
slot: number(),
|
|
3946
3978
|
transaction: ParsedConfirmedTransactionResult,
|
|
3947
3979
|
meta: nullable(ParsedConfirmedTransactionMetaResult),
|
|
3948
|
-
blockTime: optional(nullable(number()))
|
|
3980
|
+
blockTime: optional(nullable(number())),
|
|
3981
|
+
version: optional(TransactionVersionStruct)
|
|
3949
3982
|
})));
|
|
3950
3983
|
/**
|
|
3951
3984
|
* Expected JSON RPC response for the "getRecentBlockhash" message
|
|
@@ -5188,9 +5221,16 @@ class Connection {
|
|
|
5188
5221
|
}
|
|
5189
5222
|
/**
|
|
5190
5223
|
* Fetch a processed block from the cluster.
|
|
5224
|
+
*
|
|
5225
|
+
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
5226
|
+
* setting the `maxSupportedTransactionVersion` property.
|
|
5191
5227
|
*/
|
|
5192
5228
|
|
|
5193
5229
|
|
|
5230
|
+
/**
|
|
5231
|
+
* Fetch a processed block from the cluster.
|
|
5232
|
+
*/
|
|
5233
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5194
5234
|
async getBlock(slot, rawConfig) {
|
|
5195
5235
|
const {
|
|
5196
5236
|
commitment,
|
|
@@ -5213,16 +5253,15 @@ class Connection {
|
|
|
5213
5253
|
return { ...result,
|
|
5214
5254
|
transactions: result.transactions.map(({
|
|
5215
5255
|
transaction,
|
|
5216
|
-
meta
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
})
|
|
5256
|
+
meta,
|
|
5257
|
+
version
|
|
5258
|
+
}) => ({
|
|
5259
|
+
meta,
|
|
5260
|
+
transaction: { ...transaction,
|
|
5261
|
+
message: versionedMessageFromResponse(version, transaction.message)
|
|
5262
|
+
},
|
|
5263
|
+
version
|
|
5264
|
+
}))
|
|
5226
5265
|
};
|
|
5227
5266
|
}
|
|
5228
5267
|
/*
|
|
@@ -5282,9 +5321,17 @@ class Connection {
|
|
|
5282
5321
|
}
|
|
5283
5322
|
/**
|
|
5284
5323
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5324
|
+
*
|
|
5325
|
+
* @deprecated Instead, call `getTransaction` using a
|
|
5326
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5327
|
+
* `maxSupportedTransactionVersion` property.
|
|
5285
5328
|
*/
|
|
5286
5329
|
|
|
5287
5330
|
|
|
5331
|
+
/**
|
|
5332
|
+
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5333
|
+
*/
|
|
5334
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5288
5335
|
async getTransaction(signature, rawConfig) {
|
|
5289
5336
|
const {
|
|
5290
5337
|
commitment,
|
|
@@ -5306,7 +5353,7 @@ class Connection {
|
|
|
5306
5353
|
if (!result) return result;
|
|
5307
5354
|
return { ...result,
|
|
5308
5355
|
transaction: { ...result.transaction,
|
|
5309
|
-
message:
|
|
5356
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5310
5357
|
}
|
|
5311
5358
|
};
|
|
5312
5359
|
}
|
|
@@ -5365,9 +5412,19 @@ class Connection {
|
|
|
5365
5412
|
/**
|
|
5366
5413
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
5367
5414
|
* Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
|
|
5415
|
+
*
|
|
5416
|
+
* @deprecated Instead, call `getTransactions` using a
|
|
5417
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5418
|
+
* `maxSupportedTransactionVersion` property.
|
|
5368
5419
|
*/
|
|
5369
5420
|
|
|
5370
5421
|
|
|
5422
|
+
/**
|
|
5423
|
+
* Fetch transaction details for a batch of confirmed transactions.
|
|
5424
|
+
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
5425
|
+
* VersionedTransactionResponse}.
|
|
5426
|
+
*/
|
|
5427
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5371
5428
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
5372
5429
|
const {
|
|
5373
5430
|
commitment,
|
|
@@ -5395,7 +5452,7 @@ class Connection {
|
|
|
5395
5452
|
if (!result) return result;
|
|
5396
5453
|
return { ...result,
|
|
5397
5454
|
transaction: { ...result.transaction,
|
|
5398
|
-
message:
|
|
5455
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5399
5456
|
}
|
|
5400
5457
|
};
|
|
5401
5458
|
});
|