@solana/web3.js 1.47.5 → 1.48.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.
@@ -3,9 +3,9 @@ import { Buffer } from 'buffer';
3
3
  import BN from 'bn.js';
4
4
  import bs58 from 'bs58';
5
5
  import { serialize, deserialize, deserializeUnchecked } from 'borsh';
6
+ import { toBigIntLE, toBufferLE } from 'bigint-buffer';
6
7
  import * as BufferLayout from '@solana/buffer-layout';
7
8
  import { blob } from '@solana/buffer-layout';
8
- import { toBigIntLE, toBufferLE } from 'bigint-buffer';
9
9
  import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$7 } from 'superstruct';
10
10
  import { Client } from 'rpc-websockets';
11
11
  import RpcClient from 'jayson/lib/client/browser';
@@ -2036,18 +2036,6 @@ class Account {
2036
2036
  }
2037
2037
  }
2038
2038
 
2039
- const BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey('BPFLoader1111111111111111111111111111111111');
2040
-
2041
- /**
2042
- * Maximum over-the-wire size of a Transaction
2043
- *
2044
- * 1280 is IPv6 minimum MTU
2045
- * 40 bytes is the size of the IPv6 header
2046
- * 8 bytes is the size of the fragment header
2047
- */
2048
- const PACKET_DATA_SIZE = 1280 - 40 - 8;
2049
- const SIGNATURE_LENGTH_IN_BYTES = 64;
2050
-
2051
2039
  /**
2052
2040
  * Layout for a public key
2053
2041
  */
@@ -2099,17 +2087,159 @@ const voteInit = (property = 'voteInit') => {
2099
2087
  return BufferLayout.struct([publicKey('nodePubkey'), publicKey('authorizedVoter'), publicKey('authorizedWithdrawer'), BufferLayout.u8('commission')], property);
2100
2088
  };
2101
2089
  function getAlloc(type, fields) {
2102
- let alloc = 0;
2103
- type.layout.fields.forEach(item => {
2090
+ const getItemAlloc = item => {
2104
2091
  if (item.span >= 0) {
2105
- alloc += item.span;
2092
+ return item.span;
2106
2093
  } else if (typeof item.alloc === 'function') {
2107
- alloc += item.alloc(fields[item.property]);
2094
+ return item.alloc(fields[item.property]);
2095
+ } else if ('count' in item && 'elementLayout' in item) {
2096
+ const field = fields[item.property];
2097
+ if (Array.isArray(field)) {
2098
+ return field.length * getItemAlloc(item.elementLayout);
2099
+ }
2108
2100
  }
2101
+ // Couldn't determine allocated size of layout
2102
+ return 0;
2103
+ };
2104
+ let alloc = 0;
2105
+ type.layout.fields.forEach(item => {
2106
+ alloc += getItemAlloc(item);
2109
2107
  });
2110
2108
  return alloc;
2111
2109
  }
2112
2110
 
2111
+ const encodeDecode = layout => {
2112
+ const decode = layout.decode.bind(layout);
2113
+ const encode = layout.encode.bind(layout);
2114
+ return {
2115
+ decode,
2116
+ encode
2117
+ };
2118
+ };
2119
+ const bigInt = length => property => {
2120
+ const layout = blob(length, property);
2121
+ const {
2122
+ encode,
2123
+ decode
2124
+ } = encodeDecode(layout);
2125
+ const bigIntLayout = layout;
2126
+ bigIntLayout.decode = (buffer, offset) => {
2127
+ const src = decode(buffer, offset);
2128
+ return toBigIntLE(Buffer.from(src));
2129
+ };
2130
+ bigIntLayout.encode = (bigInt, buffer, offset) => {
2131
+ const src = toBufferLE(bigInt, length);
2132
+ return encode(src, buffer, offset);
2133
+ };
2134
+ return bigIntLayout;
2135
+ };
2136
+ const u64 = bigInt(8);
2137
+
2138
+ /**
2139
+ * @internal
2140
+ */
2141
+
2142
+ /**
2143
+ * Populate a buffer of instruction data using an InstructionType
2144
+ * @internal
2145
+ */
2146
+ function encodeData(type, fields) {
2147
+ const allocLength = type.layout.span >= 0 ? type.layout.span : getAlloc(type, fields);
2148
+ const data = Buffer.alloc(allocLength);
2149
+ const layoutFields = Object.assign({
2150
+ instruction: type.index
2151
+ }, fields);
2152
+ type.layout.encode(layoutFields, data);
2153
+ return data;
2154
+ }
2155
+
2156
+ /**
2157
+ * Decode instruction data buffer using an InstructionType
2158
+ * @internal
2159
+ */
2160
+ function decodeData(type, buffer) {
2161
+ let data;
2162
+ try {
2163
+ data = type.layout.decode(buffer);
2164
+ } catch (err) {
2165
+ throw new Error('invalid instruction; ' + err);
2166
+ }
2167
+ if (data.instruction !== type.index) {
2168
+ throw new Error(`invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`);
2169
+ }
2170
+ return data;
2171
+ }
2172
+
2173
+ /**
2174
+ * https://github.com/solana-labs/solana/blob/90bedd7e067b5b8f3ddbb45da00a4e9cabb22c62/sdk/src/fee_calculator.rs#L7-L11
2175
+ *
2176
+ * @internal
2177
+ */
2178
+ const FeeCalculatorLayout = BufferLayout.nu64('lamportsPerSignature');
2179
+
2180
+ /**
2181
+ * Calculator for transaction fees.
2182
+ */
2183
+
2184
+ /**
2185
+ * See https://github.com/solana-labs/solana/blob/0ea2843ec9cdc517572b8e62c959f41b55cf4453/sdk/src/nonce_state.rs#L29-L32
2186
+ *
2187
+ * @internal
2188
+ */
2189
+ const NonceAccountLayout = BufferLayout.struct([BufferLayout.u32('version'), BufferLayout.u32('state'), publicKey('authorizedPubkey'), publicKey('nonce'), BufferLayout.struct([FeeCalculatorLayout], 'feeCalculator')]);
2190
+ const NONCE_ACCOUNT_LENGTH = NonceAccountLayout.span;
2191
+ /**
2192
+ * NonceAccount class
2193
+ */
2194
+ class NonceAccount {
2195
+ /**
2196
+ * @internal
2197
+ */
2198
+ constructor(args) {
2199
+ this.authorizedPubkey = void 0;
2200
+ this.nonce = void 0;
2201
+ this.feeCalculator = void 0;
2202
+ this.authorizedPubkey = args.authorizedPubkey;
2203
+ this.nonce = args.nonce;
2204
+ this.feeCalculator = args.feeCalculator;
2205
+ }
2206
+
2207
+ /**
2208
+ * Deserialize NonceAccount from the account data.
2209
+ *
2210
+ * @param buffer account data
2211
+ * @return NonceAccount
2212
+ */
2213
+ static fromAccountData(buffer) {
2214
+ const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer), 0);
2215
+ return new NonceAccount({
2216
+ authorizedPubkey: new PublicKey(nonceAccount.authorizedPubkey),
2217
+ nonce: new PublicKey(nonceAccount.nonce).toString(),
2218
+ feeCalculator: nonceAccount.feeCalculator
2219
+ });
2220
+ }
2221
+ }
2222
+
2223
+ const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');
2224
+ const SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111');
2225
+ const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111');
2226
+ const SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey('SysvarRecentB1ockHashes11111111111111111111');
2227
+ const SYSVAR_RENT_PUBKEY = new PublicKey('SysvarRent111111111111111111111111111111111');
2228
+ const SYSVAR_REWARDS_PUBKEY = new PublicKey('SysvarRewards111111111111111111111111111111');
2229
+ const SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey('SysvarS1otHashes111111111111111111111111111');
2230
+ const SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey('SysvarS1otHistory11111111111111111111111111');
2231
+ const SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey('SysvarStakeHistory1111111111111111111111111');
2232
+
2233
+ /**
2234
+ * Maximum over-the-wire size of a Transaction
2235
+ *
2236
+ * 1280 is IPv6 minimum MTU
2237
+ * 40 bytes is the size of the IPv6 header
2238
+ * 8 bytes is the size of the fragment header
2239
+ */
2240
+ const PACKET_DATA_SIZE = 1280 - 40 - 8;
2241
+ const SIGNATURE_LENGTH_IN_BYTES = 64;
2242
+
2113
2243
  function decodeLength(bytes) {
2114
2244
  let len = 0;
2115
2245
  let size = 0;
@@ -3028,163 +3158,6 @@ class Transaction {
3028
3158
  }
3029
3159
  }
3030
3160
 
3031
- const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');
3032
- const SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111');
3033
- const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111');
3034
- const SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey('SysvarRecentB1ockHashes11111111111111111111');
3035
- const SYSVAR_RENT_PUBKEY = new PublicKey('SysvarRent111111111111111111111111111111111');
3036
- const SYSVAR_REWARDS_PUBKEY = new PublicKey('SysvarRewards111111111111111111111111111111');
3037
- const SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey('SysvarS1otHashes111111111111111111111111111');
3038
- const SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey('SysvarS1otHistory11111111111111111111111111');
3039
- const SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey('SysvarStakeHistory1111111111111111111111111');
3040
-
3041
- /**
3042
- * Sign, send and confirm a transaction.
3043
- *
3044
- * If `commitment` option is not specified, defaults to 'max' commitment.
3045
- *
3046
- * @param {Connection} connection
3047
- * @param {Transaction} transaction
3048
- * @param {Array<Signer>} signers
3049
- * @param {ConfirmOptions} [options]
3050
- * @returns {Promise<TransactionSignature>}
3051
- */
3052
- async function sendAndConfirmTransaction(connection, transaction, signers, options) {
3053
- const sendOptions = options && {
3054
- skipPreflight: options.skipPreflight,
3055
- preflightCommitment: options.preflightCommitment || options.commitment,
3056
- maxRetries: options.maxRetries,
3057
- minContextSlot: options.minContextSlot
3058
- };
3059
- const signature = await connection.sendTransaction(transaction, signers, sendOptions);
3060
- const status = transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null ? (await connection.confirmTransaction({
3061
- signature: signature,
3062
- blockhash: transaction.recentBlockhash,
3063
- lastValidBlockHeight: transaction.lastValidBlockHeight
3064
- }, options && options.commitment)).value : (await connection.confirmTransaction(signature, options && options.commitment)).value;
3065
- if (status.err) {
3066
- throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
3067
- }
3068
- return signature;
3069
- }
3070
-
3071
- // zzz
3072
- function sleep(ms) {
3073
- return new Promise(resolve => setTimeout(resolve, ms));
3074
- }
3075
-
3076
- /**
3077
- * @internal
3078
- */
3079
-
3080
- /**
3081
- * Populate a buffer of instruction data using an InstructionType
3082
- * @internal
3083
- */
3084
- function encodeData(type, fields) {
3085
- const allocLength = type.layout.span >= 0 ? type.layout.span : getAlloc(type, fields);
3086
- const data = Buffer.alloc(allocLength);
3087
- const layoutFields = Object.assign({
3088
- instruction: type.index
3089
- }, fields);
3090
- type.layout.encode(layoutFields, data);
3091
- return data;
3092
- }
3093
-
3094
- /**
3095
- * Decode instruction data buffer using an InstructionType
3096
- * @internal
3097
- */
3098
- function decodeData(type, buffer) {
3099
- let data;
3100
- try {
3101
- data = type.layout.decode(buffer);
3102
- } catch (err) {
3103
- throw new Error('invalid instruction; ' + err);
3104
- }
3105
- if (data.instruction !== type.index) {
3106
- throw new Error(`invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`);
3107
- }
3108
- return data;
3109
- }
3110
-
3111
- /**
3112
- * https://github.com/solana-labs/solana/blob/90bedd7e067b5b8f3ddbb45da00a4e9cabb22c62/sdk/src/fee_calculator.rs#L7-L11
3113
- *
3114
- * @internal
3115
- */
3116
- const FeeCalculatorLayout = BufferLayout.nu64('lamportsPerSignature');
3117
-
3118
- /**
3119
- * Calculator for transaction fees.
3120
- */
3121
-
3122
- /**
3123
- * See https://github.com/solana-labs/solana/blob/0ea2843ec9cdc517572b8e62c959f41b55cf4453/sdk/src/nonce_state.rs#L29-L32
3124
- *
3125
- * @internal
3126
- */
3127
- const NonceAccountLayout = BufferLayout.struct([BufferLayout.u32('version'), BufferLayout.u32('state'), publicKey('authorizedPubkey'), publicKey('nonce'), BufferLayout.struct([FeeCalculatorLayout], 'feeCalculator')]);
3128
- const NONCE_ACCOUNT_LENGTH = NonceAccountLayout.span;
3129
- /**
3130
- * NonceAccount class
3131
- */
3132
- class NonceAccount {
3133
- /**
3134
- * @internal
3135
- */
3136
- constructor(args) {
3137
- this.authorizedPubkey = void 0;
3138
- this.nonce = void 0;
3139
- this.feeCalculator = void 0;
3140
- this.authorizedPubkey = args.authorizedPubkey;
3141
- this.nonce = args.nonce;
3142
- this.feeCalculator = args.feeCalculator;
3143
- }
3144
-
3145
- /**
3146
- * Deserialize NonceAccount from the account data.
3147
- *
3148
- * @param buffer account data
3149
- * @return NonceAccount
3150
- */
3151
- static fromAccountData(buffer) {
3152
- const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer), 0);
3153
- return new NonceAccount({
3154
- authorizedPubkey: new PublicKey(nonceAccount.authorizedPubkey),
3155
- nonce: new PublicKey(nonceAccount.nonce).toString(),
3156
- feeCalculator: nonceAccount.feeCalculator
3157
- });
3158
- }
3159
- }
3160
-
3161
- const encodeDecode = layout => {
3162
- const decode = layout.decode.bind(layout);
3163
- const encode = layout.encode.bind(layout);
3164
- return {
3165
- decode,
3166
- encode
3167
- };
3168
- };
3169
- const bigInt = length => property => {
3170
- const layout = blob(length, property);
3171
- const {
3172
- encode,
3173
- decode
3174
- } = encodeDecode(layout);
3175
- const bigIntLayout = layout;
3176
- bigIntLayout.decode = (buffer, offset) => {
3177
- const src = decode(buffer, offset);
3178
- return toBigIntLE(Buffer.from(src));
3179
- };
3180
- bigIntLayout.encode = (bigInt, buffer, offset) => {
3181
- const src = toBufferLE(bigInt, length);
3182
- return encode(src, buffer, offset);
3183
- };
3184
- return bigIntLayout;
3185
- };
3186
- const u64 = bigInt(8);
3187
-
3188
3161
  /**
3189
3162
  * Create account system transaction params
3190
3163
  */
@@ -3918,6 +3891,291 @@ class SystemProgram {
3918
3891
  }
3919
3892
  SystemProgram.programId = new PublicKey('11111111111111111111111111111111');
3920
3893
 
3894
+ /**
3895
+ * An enumeration of valid LookupTableInstructionType's
3896
+ */
3897
+
3898
+ /**
3899
+ * An enumeration of valid address lookup table InstructionType's
3900
+ * @internal
3901
+ */
3902
+ const LOOKUP_TABLE_INSTRUCTION_LAYOUTS = Object.freeze({
3903
+ CreateLookupTable: {
3904
+ index: 0,
3905
+ layout: BufferLayout.struct([BufferLayout.u32('instruction'), u64('recentSlot'), BufferLayout.u8('bumpSeed')])
3906
+ },
3907
+ FreezeLookupTable: {
3908
+ index: 1,
3909
+ layout: BufferLayout.struct([BufferLayout.u32('instruction')])
3910
+ },
3911
+ ExtendLookupTable: {
3912
+ index: 2,
3913
+ layout: BufferLayout.struct([BufferLayout.u32('instruction'), u64(), BufferLayout.seq(publicKey(), BufferLayout.offset(BufferLayout.u32(), -8), 'addresses')])
3914
+ },
3915
+ DeactivateLookupTable: {
3916
+ index: 3,
3917
+ layout: BufferLayout.struct([BufferLayout.u32('instruction')])
3918
+ },
3919
+ CloseLookupTable: {
3920
+ index: 4,
3921
+ layout: BufferLayout.struct([BufferLayout.u32('instruction')])
3922
+ }
3923
+ });
3924
+ class AddressLookupTableInstruction {
3925
+ /**
3926
+ * @internal
3927
+ */
3928
+ constructor() {}
3929
+ static decodeInstructionType(instruction) {
3930
+ this.checkProgramId(instruction.programId);
3931
+ const instructionTypeLayout = BufferLayout.u32('instruction');
3932
+ const index = instructionTypeLayout.decode(instruction.data);
3933
+ let type;
3934
+ for (const [layoutType, layout] of Object.entries(LOOKUP_TABLE_INSTRUCTION_LAYOUTS)) {
3935
+ if (layout.index == index) {
3936
+ type = layoutType;
3937
+ break;
3938
+ }
3939
+ }
3940
+ if (!type) {
3941
+ throw new Error('Invalid Instruction. Should be a LookupTable Instruction');
3942
+ }
3943
+ return type;
3944
+ }
3945
+ static decodeCreateLookupTable(instruction) {
3946
+ this.checkProgramId(instruction.programId);
3947
+ this.checkKeysLength(instruction.keys, 4);
3948
+ const {
3949
+ recentSlot
3950
+ } = decodeData(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable, instruction.data);
3951
+ return {
3952
+ authority: instruction.keys[1].pubkey,
3953
+ payer: instruction.keys[2].pubkey,
3954
+ recentSlot: Number(recentSlot)
3955
+ };
3956
+ }
3957
+ static decodeExtendLookupTable(instruction) {
3958
+ this.checkProgramId(instruction.programId);
3959
+ if (instruction.keys.length < 2) {
3960
+ throw new Error(`invalid instruction; found ${instruction.keys.length} keys, expected at least 2`);
3961
+ }
3962
+ const {
3963
+ addresses
3964
+ } = decodeData(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable, instruction.data);
3965
+ return {
3966
+ lookupTable: instruction.keys[0].pubkey,
3967
+ authority: instruction.keys[1].pubkey,
3968
+ payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : undefined,
3969
+ addresses: addresses.map(buffer => new PublicKey(buffer))
3970
+ };
3971
+ }
3972
+ static decodeCloseLookupTable(instruction) {
3973
+ this.checkProgramId(instruction.programId);
3974
+ this.checkKeysLength(instruction.keys, 3);
3975
+ return {
3976
+ lookupTable: instruction.keys[0].pubkey,
3977
+ authority: instruction.keys[1].pubkey,
3978
+ recipient: instruction.keys[2].pubkey
3979
+ };
3980
+ }
3981
+ static decodeFreezeLookupTable(instruction) {
3982
+ this.checkProgramId(instruction.programId);
3983
+ this.checkKeysLength(instruction.keys, 2);
3984
+ return {
3985
+ lookupTable: instruction.keys[0].pubkey,
3986
+ authority: instruction.keys[1].pubkey
3987
+ };
3988
+ }
3989
+ static decodeDeactivateLookupTable(instruction) {
3990
+ this.checkProgramId(instruction.programId);
3991
+ this.checkKeysLength(instruction.keys, 2);
3992
+ return {
3993
+ lookupTable: instruction.keys[0].pubkey,
3994
+ authority: instruction.keys[1].pubkey
3995
+ };
3996
+ }
3997
+
3998
+ /**
3999
+ * @internal
4000
+ */
4001
+ static checkProgramId(programId) {
4002
+ if (!programId.equals(AddressLookupTableProgram.programId)) {
4003
+ throw new Error('invalid instruction; programId is not AddressLookupTable Program');
4004
+ }
4005
+ }
4006
+ /**
4007
+ * @internal
4008
+ */
4009
+ static checkKeysLength(keys, expectedLength) {
4010
+ if (keys.length < expectedLength) {
4011
+ throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);
4012
+ }
4013
+ }
4014
+ }
4015
+ class AddressLookupTableProgram {
4016
+ /**
4017
+ * @internal
4018
+ */
4019
+ constructor() {}
4020
+ static createLookupTable(params) {
4021
+ const [lookupTableAddress, bumpSeed] = PublicKey.findProgramAddressSync([params.authority.toBuffer(), toBufferLE(BigInt(params.recentSlot), 8)], this.programId);
4022
+ const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;
4023
+ const data = encodeData(type, {
4024
+ recentSlot: BigInt(params.recentSlot),
4025
+ bumpSeed: bumpSeed
4026
+ });
4027
+ const keys = [{
4028
+ pubkey: lookupTableAddress,
4029
+ isSigner: false,
4030
+ isWritable: true
4031
+ }, {
4032
+ pubkey: params.authority,
4033
+ isSigner: true,
4034
+ isWritable: false
4035
+ }, {
4036
+ pubkey: params.payer,
4037
+ isSigner: true,
4038
+ isWritable: true
4039
+ }, {
4040
+ pubkey: SystemProgram.programId,
4041
+ isSigner: false,
4042
+ isWritable: false
4043
+ }];
4044
+ return [new TransactionInstruction({
4045
+ programId: this.programId,
4046
+ keys: keys,
4047
+ data: data
4048
+ }), lookupTableAddress];
4049
+ }
4050
+ static freezeLookupTable(params) {
4051
+ const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.FreezeLookupTable;
4052
+ const data = encodeData(type);
4053
+ const keys = [{
4054
+ pubkey: params.lookupTable,
4055
+ isSigner: false,
4056
+ isWritable: true
4057
+ }, {
4058
+ pubkey: params.authority,
4059
+ isSigner: true,
4060
+ isWritable: false
4061
+ }];
4062
+ return new TransactionInstruction({
4063
+ programId: this.programId,
4064
+ keys: keys,
4065
+ data: data
4066
+ });
4067
+ }
4068
+ static extendLookupTable(params) {
4069
+ const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable;
4070
+ const data = encodeData(type, {
4071
+ addresses: params.addresses.map(addr => addr.toBytes())
4072
+ });
4073
+ const keys = [{
4074
+ pubkey: params.lookupTable,
4075
+ isSigner: false,
4076
+ isWritable: true
4077
+ }, {
4078
+ pubkey: params.authority,
4079
+ isSigner: true,
4080
+ isWritable: false
4081
+ }];
4082
+ if (params.payer) {
4083
+ keys.push({
4084
+ pubkey: params.payer,
4085
+ isSigner: true,
4086
+ isWritable: true
4087
+ }, {
4088
+ pubkey: SystemProgram.programId,
4089
+ isSigner: false,
4090
+ isWritable: false
4091
+ });
4092
+ }
4093
+ return new TransactionInstruction({
4094
+ programId: this.programId,
4095
+ keys: keys,
4096
+ data: data
4097
+ });
4098
+ }
4099
+ static deactivateLookupTable(params) {
4100
+ const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.DeactivateLookupTable;
4101
+ const data = encodeData(type);
4102
+ const keys = [{
4103
+ pubkey: params.lookupTable,
4104
+ isSigner: false,
4105
+ isWritable: true
4106
+ }, {
4107
+ pubkey: params.authority,
4108
+ isSigner: true,
4109
+ isWritable: false
4110
+ }];
4111
+ return new TransactionInstruction({
4112
+ programId: this.programId,
4113
+ keys: keys,
4114
+ data: data
4115
+ });
4116
+ }
4117
+ static closeLookupTable(params) {
4118
+ const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CloseLookupTable;
4119
+ const data = encodeData(type);
4120
+ const keys = [{
4121
+ pubkey: params.lookupTable,
4122
+ isSigner: false,
4123
+ isWritable: true
4124
+ }, {
4125
+ pubkey: params.authority,
4126
+ isSigner: true,
4127
+ isWritable: false
4128
+ }, {
4129
+ pubkey: params.recipient,
4130
+ isSigner: false,
4131
+ isWritable: true
4132
+ }];
4133
+ return new TransactionInstruction({
4134
+ programId: this.programId,
4135
+ keys: keys,
4136
+ data: data
4137
+ });
4138
+ }
4139
+ }
4140
+ AddressLookupTableProgram.programId = new PublicKey('AddressLookupTab1e1111111111111111111111111');
4141
+
4142
+ const BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey('BPFLoader1111111111111111111111111111111111');
4143
+
4144
+ /**
4145
+ * Sign, send and confirm a transaction.
4146
+ *
4147
+ * If `commitment` option is not specified, defaults to 'max' commitment.
4148
+ *
4149
+ * @param {Connection} connection
4150
+ * @param {Transaction} transaction
4151
+ * @param {Array<Signer>} signers
4152
+ * @param {ConfirmOptions} [options]
4153
+ * @returns {Promise<TransactionSignature>}
4154
+ */
4155
+ async function sendAndConfirmTransaction(connection, transaction, signers, options) {
4156
+ const sendOptions = options && {
4157
+ skipPreflight: options.skipPreflight,
4158
+ preflightCommitment: options.preflightCommitment || options.commitment,
4159
+ maxRetries: options.maxRetries,
4160
+ minContextSlot: options.minContextSlot
4161
+ };
4162
+ const signature = await connection.sendTransaction(transaction, signers, sendOptions);
4163
+ const status = transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null ? (await connection.confirmTransaction({
4164
+ signature: signature,
4165
+ blockhash: transaction.recentBlockhash,
4166
+ lastValidBlockHeight: transaction.lastValidBlockHeight
4167
+ }, options && options.commitment)).value : (await connection.confirmTransaction(signature, options && options.commitment)).value;
4168
+ if (status.err) {
4169
+ throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
4170
+ }
4171
+ return signature;
4172
+ }
4173
+
4174
+ // zzz
4175
+ function sleep(ms) {
4176
+ return new Promise(resolve => setTimeout(resolve, ms));
4177
+ }
4178
+
3921
4179
  // Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the
3922
4180
  // rest of the Transaction fields
3923
4181
  //
@@ -5837,7 +6095,7 @@ const LogsNotificationResult = type({
5837
6095
 
5838
6096
  /** @internal */
5839
6097
  const COMMON_HTTP_HEADERS = {
5840
- 'solana-client': `js/${"1.47.5" }`
6098
+ 'solana-client': `js/${"1.48.1" }`
5841
6099
  };
5842
6100
 
5843
6101
  /**
@@ -9776,5 +10034,5 @@ function clusterApiUrl(cluster, tls) {
9776
10034
  */
9777
10035
  const LAMPORTS_PER_SOL = 1000000000;
9778
10036
 
9779
- export { Account, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, ComputeBudgetInstruction, ComputeBudgetProgram, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SIGNATURE_LENGTH_IN_BYTES, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, SolanaJSONRPCError, SolanaJSONRPCErrorCode, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionExpiredBlockheightExceededError, TransactionExpiredTimeoutError, TransactionInstruction, TransactionStatus, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
10037
+ export { Account, AddressLookupTableInstruction, AddressLookupTableProgram, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, ComputeBudgetInstruction, ComputeBudgetProgram, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, LOOKUP_TABLE_INSTRUCTION_LAYOUTS, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SIGNATURE_LENGTH_IN_BYTES, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, SolanaJSONRPCError, SolanaJSONRPCErrorCode, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionExpiredBlockheightExceededError, TransactionExpiredTimeoutError, TransactionInstruction, TransactionStatus, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
9780
10038
  //# sourceMappingURL=index.browser.esm.js.map