@solana/web3.js 1.76.0 → 1.77.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 +59 -28
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +59 -28
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +59 -28
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +15 -9
- package/lib/index.esm.js +59 -28
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +59 -28
- 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 +59 -28
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +30 -8
- package/src/loader.ts +34 -3
- package/src/programs/vote.ts +3 -1
package/lib/index.native.js
CHANGED
|
@@ -1966,6 +1966,29 @@ class VersionedTransaction {
|
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
1968
|
|
|
1969
|
+
// TODO: These constants should be removed in favor of reading them out of a
|
|
1970
|
+
// Syscall account
|
|
1971
|
+
|
|
1972
|
+
/**
|
|
1973
|
+
* @internal
|
|
1974
|
+
*/
|
|
1975
|
+
const NUM_TICKS_PER_SECOND = 160;
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* @internal
|
|
1979
|
+
*/
|
|
1980
|
+
const DEFAULT_TICKS_PER_SLOT = 64;
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* @internal
|
|
1984
|
+
*/
|
|
1985
|
+
const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* @internal
|
|
1989
|
+
*/
|
|
1990
|
+
const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;
|
|
1991
|
+
|
|
1969
1992
|
const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');
|
|
1970
1993
|
const SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111');
|
|
1971
1994
|
const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111');
|
|
@@ -2980,9 +3003,37 @@ class Loader {
|
|
|
2980
3003
|
programId,
|
|
2981
3004
|
data
|
|
2982
3005
|
});
|
|
2983
|
-
|
|
2984
|
-
|
|
3006
|
+
const deployCommitment = 'processed';
|
|
3007
|
+
const finalizeSignature = await connection.sendTransaction(transaction, [payer, program], {
|
|
3008
|
+
preflightCommitment: deployCommitment
|
|
2985
3009
|
});
|
|
3010
|
+
const {
|
|
3011
|
+
context,
|
|
3012
|
+
value
|
|
3013
|
+
} = await connection.confirmTransaction({
|
|
3014
|
+
signature: finalizeSignature,
|
|
3015
|
+
lastValidBlockHeight: transaction.lastValidBlockHeight,
|
|
3016
|
+
blockhash: transaction.recentBlockhash
|
|
3017
|
+
}, deployCommitment);
|
|
3018
|
+
if (value.err) {
|
|
3019
|
+
throw new Error(`Transaction ${finalizeSignature} failed (${JSON.stringify(value)})`);
|
|
3020
|
+
}
|
|
3021
|
+
// We prevent programs from being usable until the slot after their deployment.
|
|
3022
|
+
// See https://github.com/solana-labs/solana/pull/29654
|
|
3023
|
+
while (true // eslint-disable-line no-constant-condition
|
|
3024
|
+
) {
|
|
3025
|
+
try {
|
|
3026
|
+
const currentSlot = await connection.getSlot({
|
|
3027
|
+
commitment: deployCommitment
|
|
3028
|
+
});
|
|
3029
|
+
if (currentSlot > context.slot) {
|
|
3030
|
+
break;
|
|
3031
|
+
}
|
|
3032
|
+
} catch {
|
|
3033
|
+
/* empty */
|
|
3034
|
+
}
|
|
3035
|
+
await new Promise(resolve => setTimeout(resolve, Math.round(MS_PER_SLOT / 2)));
|
|
3036
|
+
}
|
|
2986
3037
|
}
|
|
2987
3038
|
|
|
2988
3039
|
// success
|
|
@@ -3268,29 +3319,6 @@ class RpcWebSocketClient extends RpcWebSocketCommonClient__default.default {
|
|
|
3268
3319
|
}
|
|
3269
3320
|
}
|
|
3270
3321
|
|
|
3271
|
-
// TODO: These constants should be removed in favor of reading them out of a
|
|
3272
|
-
// Syscall account
|
|
3273
|
-
|
|
3274
|
-
/**
|
|
3275
|
-
* @internal
|
|
3276
|
-
*/
|
|
3277
|
-
const NUM_TICKS_PER_SECOND = 160;
|
|
3278
|
-
|
|
3279
|
-
/**
|
|
3280
|
-
* @internal
|
|
3281
|
-
*/
|
|
3282
|
-
const DEFAULT_TICKS_PER_SLOT = 64;
|
|
3283
|
-
|
|
3284
|
-
/**
|
|
3285
|
-
* @internal
|
|
3286
|
-
*/
|
|
3287
|
-
const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
3288
|
-
|
|
3289
|
-
/**
|
|
3290
|
-
* @internal
|
|
3291
|
-
*/
|
|
3292
|
-
const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;
|
|
3293
|
-
|
|
3294
3322
|
/**
|
|
3295
3323
|
* @internal
|
|
3296
3324
|
*/
|
|
@@ -4722,7 +4750,7 @@ class Connection {
|
|
|
4722
4750
|
/**
|
|
4723
4751
|
* Fetch all the token accounts owned by the specified account
|
|
4724
4752
|
*
|
|
4725
|
-
* @return {Promise<RpcResponseAndContext<
|
|
4753
|
+
* @return {Promise<RpcResponseAndContext<GetProgramAccountsResponse>}
|
|
4726
4754
|
*/
|
|
4727
4755
|
async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {
|
|
4728
4756
|
const {
|
|
@@ -4919,6 +4947,8 @@ class Connection {
|
|
|
4919
4947
|
*
|
|
4920
4948
|
* @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>}
|
|
4921
4949
|
*/
|
|
4950
|
+
|
|
4951
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
4922
4952
|
async getProgramAccounts(programId, configOrCommitment) {
|
|
4923
4953
|
const {
|
|
4924
4954
|
commitment,
|
|
@@ -4930,7 +4960,8 @@ class Connection {
|
|
|
4930
4960
|
} = config || {};
|
|
4931
4961
|
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
|
|
4932
4962
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
4933
|
-
const
|
|
4963
|
+
const baseSchema = superstruct.array(KeyedAccountInfoResult);
|
|
4964
|
+
const res = configWithoutEncoding.withContext === true ? superstruct.create(unsafeRes, jsonRpcResultAndContext(baseSchema)) : superstruct.create(unsafeRes, jsonRpcResult(baseSchema));
|
|
4934
4965
|
if ('error' in res) {
|
|
4935
4966
|
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
4936
4967
|
}
|
|
@@ -9167,7 +9198,7 @@ class VoteProgram {
|
|
|
9167
9198
|
}
|
|
9168
9199
|
}
|
|
9169
9200
|
VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');
|
|
9170
|
-
VoteProgram.space = 3731;
|
|
9201
|
+
VoteProgram.space = process.env.TEST_LIVE ? 3762 : 3731;
|
|
9171
9202
|
|
|
9172
9203
|
const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
|
|
9173
9204
|
|