@solana/web3.js 1.59.0 → 1.59.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.59.0",
3
+ "version": "1.59.1",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -1,16 +1,14 @@
1
- import {
2
- AccountKeysFromLookups,
3
- MessageAccountKeys,
4
- } from '../message/account-keys';
1
+ import {AccountKeysFromLookups} from '../message/account-keys';
5
2
  import assert from '../utils/assert';
6
3
  import {toBuffer} from '../utils/to-buffer';
7
4
  import {Blockhash} from '../blockhash';
8
5
  import {Message, MessageV0, VersionedMessage} from '../message';
6
+ import {PublicKey} from '../publickey';
9
7
  import {AddressLookupTableAccount} from '../programs';
10
8
  import {AccountMeta, TransactionInstruction} from './legacy';
11
9
 
12
10
  export type TransactionMessageArgs = {
13
- accountKeys: MessageAccountKeys;
11
+ payerKey: PublicKey;
14
12
  instructions: Array<TransactionInstruction>;
15
13
  recentBlockhash: Blockhash;
16
14
  };
@@ -24,12 +22,12 @@ export type DecompileArgs =
24
22
  };
25
23
 
26
24
  export class TransactionMessage {
27
- accountKeys: MessageAccountKeys;
25
+ payerKey: PublicKey;
28
26
  instructions: Array<TransactionInstruction>;
29
27
  recentBlockhash: Blockhash;
30
28
 
31
29
  constructor(args: TransactionMessageArgs) {
32
- this.accountKeys = args.accountKeys;
30
+ this.payerKey = args.payerKey;
33
31
  this.instructions = args.instructions;
34
32
  this.recentBlockhash = args.recentBlockhash;
35
33
  }
@@ -55,6 +53,13 @@ export class TransactionMessage {
55
53
  assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');
56
54
 
57
55
  const accountKeys = message.getAccountKeys(args);
56
+ const payerKey = accountKeys.get(0);
57
+ if (payerKey === undefined) {
58
+ throw new Error(
59
+ 'Failed to decompile message because no account keys were found',
60
+ );
61
+ }
62
+
58
63
  const instructions: TransactionInstruction[] = [];
59
64
  for (const compiledIx of compiledInstructions) {
60
65
  const keys: AccountMeta[] = [];
@@ -106,22 +111,15 @@ export class TransactionMessage {
106
111
  }
107
112
 
108
113
  return new TransactionMessage({
109
- accountKeys,
114
+ payerKey,
110
115
  instructions,
111
116
  recentBlockhash,
112
117
  });
113
118
  }
114
119
 
115
120
  compileToLegacyMessage(): Message {
116
- const payerKey = this.accountKeys.get(0);
117
- if (payerKey === undefined) {
118
- throw new Error(
119
- 'Failed to compile message because no account keys were found',
120
- );
121
- }
122
-
123
121
  return Message.compile({
124
- payerKey,
122
+ payerKey: this.payerKey,
125
123
  recentBlockhash: this.recentBlockhash,
126
124
  instructions: this.instructions,
127
125
  });
@@ -130,15 +128,8 @@ export class TransactionMessage {
130
128
  compileToV0Message(
131
129
  addressLookupTableAccounts?: AddressLookupTableAccount[],
132
130
  ): MessageV0 {
133
- const payerKey = this.accountKeys.get(0);
134
- if (payerKey === undefined) {
135
- throw new Error(
136
- 'Failed to compile message because no account keys were found',
137
- );
138
- }
139
-
140
131
  return MessageV0.compile({
141
- payerKey,
132
+ payerKey: this.payerKey,
142
133
  recentBlockhash: this.recentBlockhash,
143
134
  instructions: this.instructions,
144
135
  addressLookupTableAccounts,