@solana/web3.js 1.67.0 → 1.67.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.67.0",
3
+ "version": "1.67.2",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -79,7 +79,6 @@
79
79
  "@babel/plugin-transform-runtime": "^7.12.10",
80
80
  "@babel/preset-env": "^7.12.11",
81
81
  "@babel/preset-typescript": "^7.12.16",
82
- "@babel/register": "^7.12.13",
83
82
  "@commitlint/config-conventional": "^17.0.2",
84
83
  "@rollup/plugin-alias": "^3.1.9",
85
84
  "@rollup/plugin-babel": "^5.2.3",
@@ -112,7 +111,6 @@
112
111
  "eslint-plugin-mocha": "^10.1.0",
113
112
  "eslint-plugin-prettier": "^4.2.1",
114
113
  "esm": "^3.2.25",
115
- "http-server": "^14.0.0",
116
114
  "mocha": "^10.1.0",
117
115
  "mockttp": "^2.0.1",
118
116
  "mz": "^2.7.0",
package/src/account.ts CHANGED
@@ -23,7 +23,7 @@ export class Account {
23
23
  *
24
24
  * @param secretKey Secret key for the account
25
25
  */
26
- constructor(secretKey?: Buffer | Uint8Array | Array<number>) {
26
+ constructor(secretKey?: Uint8Array | Array<number>) {
27
27
  if (secretKey) {
28
28
  const secretKeyBuffer = toBuffer(secretKey);
29
29
  if (secretKey.length !== 64) {
package/src/connection.ts CHANGED
@@ -4154,10 +4154,10 @@ export class Connection {
4154
4154
  * Fetch the fee for a message from the cluster, return with context
4155
4155
  */
4156
4156
  async getFeeForMessage(
4157
- message: Message,
4157
+ message: VersionedMessage,
4158
4158
  commitment?: Commitment,
4159
4159
  ): Promise<RpcResponseAndContext<number>> {
4160
- const wireMessage = message.serialize().toString('base64');
4160
+ const wireMessage = toBuffer(message.serialize()).toString('base64');
4161
4161
  const args = this._buildArgs([wireMessage], commitment);
4162
4162
  const unsafeRes = await this._rpcRequest('getFeeForMessage', args);
4163
4163
 
@@ -268,7 +268,7 @@ export class Message {
268
268
  // Slice up wire data
269
269
  let byteArray = [...buffer];
270
270
 
271
- const numRequiredSignatures = byteArray.shift() as number;
271
+ const numRequiredSignatures = byteArray.shift()!;
272
272
  if (
273
273
  numRequiredSignatures !==
274
274
  (numRequiredSignatures & VERSION_PREFIX_MASK)
@@ -278,8 +278,8 @@ export class Message {
278
278
  );
279
279
  }
280
280
 
281
- const numReadonlySignedAccounts = byteArray.shift() as number;
282
- const numReadonlyUnsignedAccounts = byteArray.shift() as number;
281
+ const numReadonlySignedAccounts = byteArray.shift()!;
282
+ const numReadonlyUnsignedAccounts = byteArray.shift()!;
283
283
 
284
284
  const accountCount = shortvec.decodeLength(byteArray);
285
285
  let accountKeys = [];
@@ -295,7 +295,7 @@ export class Message {
295
295
  const instructionCount = shortvec.decodeLength(byteArray);
296
296
  let instructions: CompiledInstruction[] = [];
297
297
  for (let i = 0; i < instructionCount; i++) {
298
- const programIdIndex = byteArray.shift() as number;
298
+ const programIdIndex = byteArray.shift()!;
299
299
  const accountCount = shortvec.decodeLength(byteArray);
300
300
  const accounts = byteArray.slice(0, accountCount);
301
301
  byteArray = byteArray.slice(accountCount);
package/src/publickey.ts CHANGED
@@ -69,14 +69,14 @@ export class PublicKey extends Struct {
69
69
  this._bn = new BN(value);
70
70
  }
71
71
 
72
- if (this._bn.byteLength() > 32) {
72
+ if (this._bn.byteLength() > PUBLIC_KEY_LENGTH) {
73
73
  throw new Error(`Invalid public key input`);
74
74
  }
75
75
  }
76
76
  }
77
77
 
78
78
  /**
79
- * Returns a unique PublicKey for tests and benchmarks using acounter
79
+ * Returns a unique PublicKey for tests and benchmarks using a counter
80
80
  */
81
81
  static unique(): PublicKey {
82
82
  const key = new PublicKey(uniquePublicKeyCounter);
@@ -186,6 +186,8 @@ export class PublicKey extends Struct {
186
186
  /**
187
187
  * Async version of createProgramAddressSync
188
188
  * For backwards compatibility
189
+ *
190
+ * @deprecated Use {@link createProgramAddressSync} instead
189
191
  */
190
192
  /* eslint-disable require-await */
191
193
  static async createProgramAddress(
@@ -227,6 +229,8 @@ export class PublicKey extends Struct {
227
229
  /**
228
230
  * Async version of findProgramAddressSync
229
231
  * For backwards compatibility
232
+ *
233
+ * @deprecated Use {@link findProgramAddressSync} instead
230
234
  */
231
235
  static async findProgramAddress(
232
236
  seeds: Array<Buffer | Uint8Array>,
@@ -49,7 +49,9 @@ export class TransactionMessage {
49
49
  assert(numWritableSignedAccounts > 0, 'Message header is invalid');
50
50
 
51
51
  const numWritableUnsignedAccounts =
52
- message.staticAccountKeys.length - numReadonlyUnsignedAccounts;
52
+ message.staticAccountKeys.length -
53
+ numRequiredSignatures -
54
+ numReadonlyUnsignedAccounts;
53
55
  assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');
54
56
 
55
57
  const accountKeys = message.getAccountKeys(args);