@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.cjs.js
CHANGED
|
@@ -3239,6 +3239,28 @@ function notificationResultAndContext(value) {
|
|
|
3239
3239
|
value
|
|
3240
3240
|
});
|
|
3241
3241
|
}
|
|
3242
|
+
/**
|
|
3243
|
+
* @internal
|
|
3244
|
+
*/
|
|
3245
|
+
|
|
3246
|
+
|
|
3247
|
+
function versionedMessageFromResponse(version, response) {
|
|
3248
|
+
if (version === 0) {
|
|
3249
|
+
return new MessageV0({
|
|
3250
|
+
header: response.header,
|
|
3251
|
+
staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)),
|
|
3252
|
+
recentBlockhash: response.recentBlockhash,
|
|
3253
|
+
compiledInstructions: response.instructions.map(ix => ({
|
|
3254
|
+
programIdIndex: ix.programIdIndex,
|
|
3255
|
+
accountKeyIndexes: ix.accounts,
|
|
3256
|
+
data: bs58__default["default"].decode(ix.data)
|
|
3257
|
+
})),
|
|
3258
|
+
addressTableLookups: response.addressTableLookups
|
|
3259
|
+
});
|
|
3260
|
+
} else {
|
|
3261
|
+
return new Message(response);
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3242
3264
|
/**
|
|
3243
3265
|
* The level of commitment desired when querying state
|
|
3244
3266
|
* <pre>
|
|
@@ -3794,6 +3816,11 @@ const GetSignatureStatusesRpcResult = jsonRpcResultAndContext(superstruct.array(
|
|
|
3794
3816
|
*/
|
|
3795
3817
|
|
|
3796
3818
|
const GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult(superstruct.number());
|
|
3819
|
+
const AddressTableLookupStruct = superstruct.type({
|
|
3820
|
+
accountKey: PublicKeyFromString,
|
|
3821
|
+
writableIndexes: superstruct.array(superstruct.number()),
|
|
3822
|
+
readonlyIndexes: superstruct.array(superstruct.number())
|
|
3823
|
+
});
|
|
3797
3824
|
const ConfirmedTransactionResult = superstruct.type({
|
|
3798
3825
|
signatures: superstruct.array(superstruct.string()),
|
|
3799
3826
|
message: superstruct.type({
|
|
@@ -3808,7 +3835,8 @@ const ConfirmedTransactionResult = superstruct.type({
|
|
|
3808
3835
|
data: superstruct.string(),
|
|
3809
3836
|
programIdIndex: superstruct.number()
|
|
3810
3837
|
})),
|
|
3811
|
-
recentBlockhash: superstruct.string()
|
|
3838
|
+
recentBlockhash: superstruct.string(),
|
|
3839
|
+
addressTableLookups: superstruct.optional(superstruct.array(AddressTableLookupStruct))
|
|
3812
3840
|
})
|
|
3813
3841
|
});
|
|
3814
3842
|
const ParsedInstructionResult = superstruct.type({
|
|
@@ -3851,7 +3879,8 @@ const ParsedConfirmedTransactionResult = superstruct.type({
|
|
|
3851
3879
|
writable: superstruct.boolean()
|
|
3852
3880
|
})),
|
|
3853
3881
|
instructions: superstruct.array(ParsedOrRawInstruction),
|
|
3854
|
-
recentBlockhash: superstruct.string()
|
|
3882
|
+
recentBlockhash: superstruct.string(),
|
|
3883
|
+
addressTableLookups: superstruct.optional(superstruct.nullable(superstruct.array(AddressTableLookupStruct)))
|
|
3855
3884
|
})
|
|
3856
3885
|
});
|
|
3857
3886
|
const TokenBalanceResult = superstruct.type({
|
|
@@ -3904,6 +3933,7 @@ const ParsedConfirmedTransactionMetaResult = superstruct.type({
|
|
|
3904
3933
|
postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
|
|
3905
3934
|
loadedAddresses: superstruct.optional(LoadedAddressesResult)
|
|
3906
3935
|
});
|
|
3936
|
+
const TransactionVersionStruct = superstruct.union([superstruct.literal(0), superstruct.literal('legacy')]);
|
|
3907
3937
|
/**
|
|
3908
3938
|
* Expected JSON RPC response for the "getBlock" message
|
|
3909
3939
|
*/
|
|
@@ -3914,7 +3944,8 @@ const GetBlockRpcResult = jsonRpcResult(superstruct.nullable(superstruct.type({
|
|
|
3914
3944
|
parentSlot: superstruct.number(),
|
|
3915
3945
|
transactions: superstruct.array(superstruct.type({
|
|
3916
3946
|
transaction: ConfirmedTransactionResult,
|
|
3917
|
-
meta: superstruct.nullable(ConfirmedTransactionMetaResult)
|
|
3947
|
+
meta: superstruct.nullable(ConfirmedTransactionMetaResult),
|
|
3948
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
3918
3949
|
})),
|
|
3919
3950
|
rewards: superstruct.optional(superstruct.array(superstruct.type({
|
|
3920
3951
|
pubkey: superstruct.string(),
|
|
@@ -3966,7 +3997,8 @@ const GetTransactionRpcResult = jsonRpcResult(superstruct.nullable(superstruct.t
|
|
|
3966
3997
|
slot: superstruct.number(),
|
|
3967
3998
|
meta: ConfirmedTransactionMetaResult,
|
|
3968
3999
|
blockTime: superstruct.optional(superstruct.nullable(superstruct.number())),
|
|
3969
|
-
transaction: ConfirmedTransactionResult
|
|
4000
|
+
transaction: ConfirmedTransactionResult,
|
|
4001
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
3970
4002
|
})));
|
|
3971
4003
|
/**
|
|
3972
4004
|
* Expected parsed JSON RPC response for the "getTransaction" message
|
|
@@ -3976,7 +4008,8 @@ const GetParsedTransactionRpcResult = jsonRpcResult(superstruct.nullable(superst
|
|
|
3976
4008
|
slot: superstruct.number(),
|
|
3977
4009
|
transaction: ParsedConfirmedTransactionResult,
|
|
3978
4010
|
meta: superstruct.nullable(ParsedConfirmedTransactionMetaResult),
|
|
3979
|
-
blockTime: superstruct.optional(superstruct.nullable(superstruct.number()))
|
|
4011
|
+
blockTime: superstruct.optional(superstruct.nullable(superstruct.number())),
|
|
4012
|
+
version: superstruct.optional(TransactionVersionStruct)
|
|
3980
4013
|
})));
|
|
3981
4014
|
/**
|
|
3982
4015
|
* Expected JSON RPC response for the "getRecentBlockhash" message
|
|
@@ -5219,9 +5252,16 @@ class Connection {
|
|
|
5219
5252
|
}
|
|
5220
5253
|
/**
|
|
5221
5254
|
* Fetch a processed block from the cluster.
|
|
5255
|
+
*
|
|
5256
|
+
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
5257
|
+
* setting the `maxSupportedTransactionVersion` property.
|
|
5222
5258
|
*/
|
|
5223
5259
|
|
|
5224
5260
|
|
|
5261
|
+
/**
|
|
5262
|
+
* Fetch a processed block from the cluster.
|
|
5263
|
+
*/
|
|
5264
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5225
5265
|
async getBlock(slot, rawConfig) {
|
|
5226
5266
|
const {
|
|
5227
5267
|
commitment,
|
|
@@ -5244,16 +5284,15 @@ class Connection {
|
|
|
5244
5284
|
return { ...result,
|
|
5245
5285
|
transactions: result.transactions.map(({
|
|
5246
5286
|
transaction,
|
|
5247
|
-
meta
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
})
|
|
5287
|
+
meta,
|
|
5288
|
+
version
|
|
5289
|
+
}) => ({
|
|
5290
|
+
meta,
|
|
5291
|
+
transaction: { ...transaction,
|
|
5292
|
+
message: versionedMessageFromResponse(version, transaction.message)
|
|
5293
|
+
},
|
|
5294
|
+
version
|
|
5295
|
+
}))
|
|
5257
5296
|
};
|
|
5258
5297
|
}
|
|
5259
5298
|
/*
|
|
@@ -5313,9 +5352,17 @@ class Connection {
|
|
|
5313
5352
|
}
|
|
5314
5353
|
/**
|
|
5315
5354
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5355
|
+
*
|
|
5356
|
+
* @deprecated Instead, call `getTransaction` using a
|
|
5357
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5358
|
+
* `maxSupportedTransactionVersion` property.
|
|
5316
5359
|
*/
|
|
5317
5360
|
|
|
5318
5361
|
|
|
5362
|
+
/**
|
|
5363
|
+
* Fetch a confirmed or finalized transaction from the cluster.
|
|
5364
|
+
*/
|
|
5365
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5319
5366
|
async getTransaction(signature, rawConfig) {
|
|
5320
5367
|
const {
|
|
5321
5368
|
commitment,
|
|
@@ -5337,7 +5384,7 @@ class Connection {
|
|
|
5337
5384
|
if (!result) return result;
|
|
5338
5385
|
return { ...result,
|
|
5339
5386
|
transaction: { ...result.transaction,
|
|
5340
|
-
message:
|
|
5387
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5341
5388
|
}
|
|
5342
5389
|
};
|
|
5343
5390
|
}
|
|
@@ -5396,9 +5443,19 @@ class Connection {
|
|
|
5396
5443
|
/**
|
|
5397
5444
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
5398
5445
|
* Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
|
|
5446
|
+
*
|
|
5447
|
+
* @deprecated Instead, call `getTransactions` using a
|
|
5448
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
5449
|
+
* `maxSupportedTransactionVersion` property.
|
|
5399
5450
|
*/
|
|
5400
5451
|
|
|
5401
5452
|
|
|
5453
|
+
/**
|
|
5454
|
+
* Fetch transaction details for a batch of confirmed transactions.
|
|
5455
|
+
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
5456
|
+
* VersionedTransactionResponse}.
|
|
5457
|
+
*/
|
|
5458
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5402
5459
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
5403
5460
|
const {
|
|
5404
5461
|
commitment,
|
|
@@ -5426,7 +5483,7 @@ class Connection {
|
|
|
5426
5483
|
if (!result) return result;
|
|
5427
5484
|
return { ...result,
|
|
5428
5485
|
transaction: { ...result.transaction,
|
|
5429
|
-
message:
|
|
5486
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
5430
5487
|
}
|
|
5431
5488
|
};
|
|
5432
5489
|
});
|