@solana/web3.js 1.76.0 → 1.77.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 +58 -27
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +58 -27
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +58 -27
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +15 -9
- package/lib/index.esm.js +58 -27
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +58 -27
- 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 +58 -27
- package/lib/index.native.js.map +1 -1
- package/package.json +3 -3
- package/src/connection.ts +30 -8
- package/src/loader.ts +34 -3
- package/src/programs/vote.ts +3 -1
package/lib/index.cjs.js
CHANGED
|
@@ -1980,6 +1980,29 @@ class VersionedTransaction {
|
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
1982
|
|
|
1983
|
+
// TODO: These constants should be removed in favor of reading them out of a
|
|
1984
|
+
// Syscall account
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* @internal
|
|
1988
|
+
*/
|
|
1989
|
+
const NUM_TICKS_PER_SECOND = 160;
|
|
1990
|
+
|
|
1991
|
+
/**
|
|
1992
|
+
* @internal
|
|
1993
|
+
*/
|
|
1994
|
+
const DEFAULT_TICKS_PER_SLOT = 64;
|
|
1995
|
+
|
|
1996
|
+
/**
|
|
1997
|
+
* @internal
|
|
1998
|
+
*/
|
|
1999
|
+
const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
2000
|
+
|
|
2001
|
+
/**
|
|
2002
|
+
* @internal
|
|
2003
|
+
*/
|
|
2004
|
+
const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;
|
|
2005
|
+
|
|
1983
2006
|
const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');
|
|
1984
2007
|
const SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111');
|
|
1985
2008
|
const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111');
|
|
@@ -2994,9 +3017,37 @@ class Loader {
|
|
|
2994
3017
|
programId,
|
|
2995
3018
|
data
|
|
2996
3019
|
});
|
|
2997
|
-
|
|
2998
|
-
|
|
3020
|
+
const deployCommitment = 'processed';
|
|
3021
|
+
const finalizeSignature = await connection.sendTransaction(transaction, [payer, program], {
|
|
3022
|
+
preflightCommitment: deployCommitment
|
|
2999
3023
|
});
|
|
3024
|
+
const {
|
|
3025
|
+
context,
|
|
3026
|
+
value
|
|
3027
|
+
} = await connection.confirmTransaction({
|
|
3028
|
+
signature: finalizeSignature,
|
|
3029
|
+
lastValidBlockHeight: transaction.lastValidBlockHeight,
|
|
3030
|
+
blockhash: transaction.recentBlockhash
|
|
3031
|
+
}, deployCommitment);
|
|
3032
|
+
if (value.err) {
|
|
3033
|
+
throw new Error(`Transaction ${finalizeSignature} failed (${JSON.stringify(value)})`);
|
|
3034
|
+
}
|
|
3035
|
+
// We prevent programs from being usable until the slot after their deployment.
|
|
3036
|
+
// See https://github.com/solana-labs/solana/pull/29654
|
|
3037
|
+
while (true // eslint-disable-line no-constant-condition
|
|
3038
|
+
) {
|
|
3039
|
+
try {
|
|
3040
|
+
const currentSlot = await connection.getSlot({
|
|
3041
|
+
commitment: deployCommitment
|
|
3042
|
+
});
|
|
3043
|
+
if (currentSlot > context.slot) {
|
|
3044
|
+
break;
|
|
3045
|
+
}
|
|
3046
|
+
} catch {
|
|
3047
|
+
/* empty */
|
|
3048
|
+
}
|
|
3049
|
+
await new Promise(resolve => setTimeout(resolve, Math.round(MS_PER_SLOT / 2)));
|
|
3050
|
+
}
|
|
3000
3051
|
}
|
|
3001
3052
|
|
|
3002
3053
|
// success
|
|
@@ -5769,29 +5820,6 @@ class RpcWebSocketClient extends RpcWebSocketCommonClient__default.default {
|
|
|
5769
5820
|
}
|
|
5770
5821
|
}
|
|
5771
5822
|
|
|
5772
|
-
// TODO: These constants should be removed in favor of reading them out of a
|
|
5773
|
-
// Syscall account
|
|
5774
|
-
|
|
5775
|
-
/**
|
|
5776
|
-
* @internal
|
|
5777
|
-
*/
|
|
5778
|
-
const NUM_TICKS_PER_SECOND = 160;
|
|
5779
|
-
|
|
5780
|
-
/**
|
|
5781
|
-
* @internal
|
|
5782
|
-
*/
|
|
5783
|
-
const DEFAULT_TICKS_PER_SLOT = 64;
|
|
5784
|
-
|
|
5785
|
-
/**
|
|
5786
|
-
* @internal
|
|
5787
|
-
*/
|
|
5788
|
-
const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
5789
|
-
|
|
5790
|
-
/**
|
|
5791
|
-
* @internal
|
|
5792
|
-
*/
|
|
5793
|
-
const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;
|
|
5794
|
-
|
|
5795
5823
|
/**
|
|
5796
5824
|
* @internal
|
|
5797
5825
|
*/
|
|
@@ -7246,7 +7274,7 @@ class Connection {
|
|
|
7246
7274
|
/**
|
|
7247
7275
|
* Fetch all the token accounts owned by the specified account
|
|
7248
7276
|
*
|
|
7249
|
-
* @return {Promise<RpcResponseAndContext<
|
|
7277
|
+
* @return {Promise<RpcResponseAndContext<GetProgramAccountsResponse>}
|
|
7250
7278
|
*/
|
|
7251
7279
|
async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {
|
|
7252
7280
|
const {
|
|
@@ -7443,6 +7471,8 @@ class Connection {
|
|
|
7443
7471
|
*
|
|
7444
7472
|
* @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>}
|
|
7445
7473
|
*/
|
|
7474
|
+
|
|
7475
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7446
7476
|
async getProgramAccounts(programId, configOrCommitment) {
|
|
7447
7477
|
const {
|
|
7448
7478
|
commitment,
|
|
@@ -7454,7 +7484,8 @@ class Connection {
|
|
|
7454
7484
|
} = config || {};
|
|
7455
7485
|
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
|
|
7456
7486
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
7457
|
-
const
|
|
7487
|
+
const baseSchema = superstruct.array(KeyedAccountInfoResult);
|
|
7488
|
+
const res = configWithoutEncoding.withContext === true ? superstruct.create(unsafeRes, jsonRpcResultAndContext(baseSchema)) : superstruct.create(unsafeRes, jsonRpcResult(baseSchema));
|
|
7458
7489
|
if ('error' in res) {
|
|
7459
7490
|
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
7460
7491
|
}
|