@solana/web3.js 1.54.1 → 1.56.1
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 +85 -20
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +85 -20
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +85 -20
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +130 -4
- package/lib/index.esm.js +85 -20
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +85 -20
- 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 +85 -20
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +244 -21
- package/src/message/versioned.ts +12 -3
package/lib/index.iife.js
CHANGED
|
@@ -11338,16 +11338,24 @@ var solanaWeb3 = (function (exports) {
|
|
|
11338
11338
|
|
|
11339
11339
|
// eslint-disable-next-line no-redeclare
|
|
11340
11340
|
const VersionedMessage = {
|
|
11341
|
-
|
|
11341
|
+
deserializeMessageVersion(serializedMessage) {
|
|
11342
11342
|
const prefix = serializedMessage[0];
|
|
11343
11343
|
const maskedPrefix = prefix & VERSION_PREFIX_MASK; // if the highest bit of the prefix is not set, the message is not versioned
|
|
11344
11344
|
|
|
11345
11345
|
if (maskedPrefix === prefix) {
|
|
11346
|
-
return
|
|
11346
|
+
return 'legacy';
|
|
11347
11347
|
} // the lower 7 bits of the prefix indicate the message version
|
|
11348
11348
|
|
|
11349
11349
|
|
|
11350
|
-
|
|
11350
|
+
return maskedPrefix;
|
|
11351
|
+
},
|
|
11352
|
+
|
|
11353
|
+
deserialize: serializedMessage => {
|
|
11354
|
+
const version = VersionedMessage.deserializeMessageVersion(serializedMessage);
|
|
11355
|
+
|
|
11356
|
+
if (version === 'legacy') {
|
|
11357
|
+
return Message.from(serializedMessage);
|
|
11358
|
+
}
|
|
11351
11359
|
|
|
11352
11360
|
if (version === 0) {
|
|
11353
11361
|
return MessageV0.deserialize(serializedMessage);
|
|
@@ -16844,6 +16852,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
16844
16852
|
value
|
|
16845
16853
|
});
|
|
16846
16854
|
}
|
|
16855
|
+
/**
|
|
16856
|
+
* @internal
|
|
16857
|
+
*/
|
|
16858
|
+
|
|
16859
|
+
|
|
16860
|
+
function versionedMessageFromResponse(version, response) {
|
|
16861
|
+
if (version === 0) {
|
|
16862
|
+
return new MessageV0({
|
|
16863
|
+
header: response.header,
|
|
16864
|
+
staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)),
|
|
16865
|
+
recentBlockhash: response.recentBlockhash,
|
|
16866
|
+
compiledInstructions: response.instructions.map(ix => ({
|
|
16867
|
+
programIdIndex: ix.programIdIndex,
|
|
16868
|
+
accountKeyIndexes: ix.accounts,
|
|
16869
|
+
data: bs58$1.decode(ix.data)
|
|
16870
|
+
})),
|
|
16871
|
+
addressTableLookups: response.addressTableLookups
|
|
16872
|
+
});
|
|
16873
|
+
} else {
|
|
16874
|
+
return new Message(response);
|
|
16875
|
+
}
|
|
16876
|
+
}
|
|
16847
16877
|
/**
|
|
16848
16878
|
* The level of commitment desired when querying state
|
|
16849
16879
|
* <pre>
|
|
@@ -17399,6 +17429,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
17399
17429
|
*/
|
|
17400
17430
|
|
|
17401
17431
|
const GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult(number());
|
|
17432
|
+
const AddressTableLookupStruct = type({
|
|
17433
|
+
accountKey: PublicKeyFromString,
|
|
17434
|
+
writableIndexes: array(number()),
|
|
17435
|
+
readonlyIndexes: array(number())
|
|
17436
|
+
});
|
|
17402
17437
|
const ConfirmedTransactionResult = type({
|
|
17403
17438
|
signatures: array(string()),
|
|
17404
17439
|
message: type({
|
|
@@ -17413,7 +17448,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
17413
17448
|
data: string(),
|
|
17414
17449
|
programIdIndex: number()
|
|
17415
17450
|
})),
|
|
17416
|
-
recentBlockhash: string()
|
|
17451
|
+
recentBlockhash: string(),
|
|
17452
|
+
addressTableLookups: optional(array(AddressTableLookupStruct))
|
|
17417
17453
|
})
|
|
17418
17454
|
});
|
|
17419
17455
|
const ParsedInstructionResult = type({
|
|
@@ -17456,7 +17492,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
17456
17492
|
writable: boolean()
|
|
17457
17493
|
})),
|
|
17458
17494
|
instructions: array(ParsedOrRawInstruction),
|
|
17459
|
-
recentBlockhash: string()
|
|
17495
|
+
recentBlockhash: string(),
|
|
17496
|
+
addressTableLookups: optional(nullable(array(AddressTableLookupStruct)))
|
|
17460
17497
|
})
|
|
17461
17498
|
});
|
|
17462
17499
|
const TokenBalanceResult = type({
|
|
@@ -17509,6 +17546,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
17509
17546
|
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
17510
17547
|
loadedAddresses: optional(LoadedAddressesResult)
|
|
17511
17548
|
});
|
|
17549
|
+
const TransactionVersionStruct = union([literal(0), literal('legacy')]);
|
|
17512
17550
|
/**
|
|
17513
17551
|
* Expected JSON RPC response for the "getBlock" message
|
|
17514
17552
|
*/
|
|
@@ -17519,7 +17557,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
17519
17557
|
parentSlot: number(),
|
|
17520
17558
|
transactions: array(type({
|
|
17521
17559
|
transaction: ConfirmedTransactionResult,
|
|
17522
|
-
meta: nullable(ConfirmedTransactionMetaResult)
|
|
17560
|
+
meta: nullable(ConfirmedTransactionMetaResult),
|
|
17561
|
+
version: optional(TransactionVersionStruct)
|
|
17523
17562
|
})),
|
|
17524
17563
|
rewards: optional(array(type({
|
|
17525
17564
|
pubkey: string(),
|
|
@@ -17571,7 +17610,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
17571
17610
|
slot: number(),
|
|
17572
17611
|
meta: ConfirmedTransactionMetaResult,
|
|
17573
17612
|
blockTime: optional(nullable(number())),
|
|
17574
|
-
transaction: ConfirmedTransactionResult
|
|
17613
|
+
transaction: ConfirmedTransactionResult,
|
|
17614
|
+
version: optional(TransactionVersionStruct)
|
|
17575
17615
|
})));
|
|
17576
17616
|
/**
|
|
17577
17617
|
* Expected parsed JSON RPC response for the "getTransaction" message
|
|
@@ -17581,7 +17621,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
17581
17621
|
slot: number(),
|
|
17582
17622
|
transaction: ParsedConfirmedTransactionResult,
|
|
17583
17623
|
meta: nullable(ParsedConfirmedTransactionMetaResult),
|
|
17584
|
-
blockTime: optional(nullable(number()))
|
|
17624
|
+
blockTime: optional(nullable(number())),
|
|
17625
|
+
version: optional(TransactionVersionStruct)
|
|
17585
17626
|
})));
|
|
17586
17627
|
/**
|
|
17587
17628
|
* Expected JSON RPC response for the "getRecentBlockhash" message
|
|
@@ -18824,9 +18865,16 @@ var solanaWeb3 = (function (exports) {
|
|
|
18824
18865
|
}
|
|
18825
18866
|
/**
|
|
18826
18867
|
* Fetch a processed block from the cluster.
|
|
18868
|
+
*
|
|
18869
|
+
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
18870
|
+
* setting the `maxSupportedTransactionVersion` property.
|
|
18827
18871
|
*/
|
|
18828
18872
|
|
|
18829
18873
|
|
|
18874
|
+
/**
|
|
18875
|
+
* Fetch a processed block from the cluster.
|
|
18876
|
+
*/
|
|
18877
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
18830
18878
|
async getBlock(slot, rawConfig) {
|
|
18831
18879
|
const {
|
|
18832
18880
|
commitment,
|
|
@@ -18849,16 +18897,15 @@ var solanaWeb3 = (function (exports) {
|
|
|
18849
18897
|
return { ...result,
|
|
18850
18898
|
transactions: result.transactions.map(({
|
|
18851
18899
|
transaction,
|
|
18852
|
-
meta
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
})
|
|
18900
|
+
meta,
|
|
18901
|
+
version
|
|
18902
|
+
}) => ({
|
|
18903
|
+
meta,
|
|
18904
|
+
transaction: { ...transaction,
|
|
18905
|
+
message: versionedMessageFromResponse(version, transaction.message)
|
|
18906
|
+
},
|
|
18907
|
+
version
|
|
18908
|
+
}))
|
|
18862
18909
|
};
|
|
18863
18910
|
}
|
|
18864
18911
|
/*
|
|
@@ -18918,9 +18965,17 @@ var solanaWeb3 = (function (exports) {
|
|
|
18918
18965
|
}
|
|
18919
18966
|
/**
|
|
18920
18967
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
18968
|
+
*
|
|
18969
|
+
* @deprecated Instead, call `getTransaction` using a
|
|
18970
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
18971
|
+
* `maxSupportedTransactionVersion` property.
|
|
18921
18972
|
*/
|
|
18922
18973
|
|
|
18923
18974
|
|
|
18975
|
+
/**
|
|
18976
|
+
* Fetch a confirmed or finalized transaction from the cluster.
|
|
18977
|
+
*/
|
|
18978
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
18924
18979
|
async getTransaction(signature, rawConfig) {
|
|
18925
18980
|
const {
|
|
18926
18981
|
commitment,
|
|
@@ -18942,7 +18997,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18942
18997
|
if (!result) return result;
|
|
18943
18998
|
return { ...result,
|
|
18944
18999
|
transaction: { ...result.transaction,
|
|
18945
|
-
message:
|
|
19000
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
18946
19001
|
}
|
|
18947
19002
|
};
|
|
18948
19003
|
}
|
|
@@ -19001,9 +19056,19 @@ var solanaWeb3 = (function (exports) {
|
|
|
19001
19056
|
/**
|
|
19002
19057
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
19003
19058
|
* Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
|
|
19059
|
+
*
|
|
19060
|
+
* @deprecated Instead, call `getTransactions` using a
|
|
19061
|
+
* `GetVersionedTransactionConfig` by setting the
|
|
19062
|
+
* `maxSupportedTransactionVersion` property.
|
|
19004
19063
|
*/
|
|
19005
19064
|
|
|
19006
19065
|
|
|
19066
|
+
/**
|
|
19067
|
+
* Fetch transaction details for a batch of confirmed transactions.
|
|
19068
|
+
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
19069
|
+
* VersionedTransactionResponse}.
|
|
19070
|
+
*/
|
|
19071
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
19007
19072
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
19008
19073
|
const {
|
|
19009
19074
|
commitment,
|
|
@@ -19031,7 +19096,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19031
19096
|
if (!result) return result;
|
|
19032
19097
|
return { ...result,
|
|
19033
19098
|
transaction: { ...result.transaction,
|
|
19034
|
-
message:
|
|
19099
|
+
message: versionedMessageFromResponse(result.version, result.transaction.message)
|
|
19035
19100
|
}
|
|
19036
19101
|
};
|
|
19037
19102
|
});
|