fix: transfers require 'to' account to be readwrite (#543)
This commit is contained in:
parent
3f38e89886
commit
58550733fb
|
@ -201,7 +201,9 @@ export class SystemProgram {
|
|||
return new Transaction().add({
|
||||
keys: [
|
||||
{pubkey: from, isSigner: true, isDebitable: true},
|
||||
{pubkey: to, isSigner: false, isDebitable: false},
|
||||
// TEMP FIX: a better proposed solution is here:
|
||||
// https://github.com/solana-labs/solana-web3.js/issues/542
|
||||
{pubkey: to, isSigner: false, isDebitable: true},
|
||||
],
|
||||
programId: SystemProgram.programId,
|
||||
data,
|
||||
|
|
|
@ -91,223 +91,10 @@ test('parse wire format and serialize', () => {
|
|||
const expectedTransaction = new Transaction({recentBlockhash}).add(transfer);
|
||||
expectedTransaction.sign(sender);
|
||||
|
||||
const wireTransaction = Buffer.from([
|
||||
1,
|
||||
47,
|
||||
50,
|
||||
66,
|
||||
17,
|
||||
219,
|
||||
90,
|
||||
187,
|
||||
49,
|
||||
40,
|
||||
77,
|
||||
8,
|
||||
58,
|
||||
129,
|
||||
51,
|
||||
76,
|
||||
13,
|
||||
206,
|
||||
126,
|
||||
157,
|
||||
189,
|
||||
188,
|
||||
53,
|
||||
174,
|
||||
42,
|
||||
80,
|
||||
4,
|
||||
4,
|
||||
212,
|
||||
55,
|
||||
67,
|
||||
171,
|
||||
34,
|
||||
224,
|
||||
81,
|
||||
68,
|
||||
230,
|
||||
120,
|
||||
117,
|
||||
204,
|
||||
241,
|
||||
167,
|
||||
152,
|
||||
74,
|
||||
141,
|
||||
132,
|
||||
73,
|
||||
166,
|
||||
217,
|
||||
173,
|
||||
27,
|
||||
75,
|
||||
62,
|
||||
171,
|
||||
160,
|
||||
100,
|
||||
159,
|
||||
116,
|
||||
164,
|
||||
45,
|
||||
185,
|
||||
64,
|
||||
0,
|
||||
72,
|
||||
4,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
19,
|
||||
152,
|
||||
246,
|
||||
44,
|
||||
109,
|
||||
26,
|
||||
69,
|
||||
124,
|
||||
81,
|
||||
186,
|
||||
106,
|
||||
75,
|
||||
95,
|
||||
61,
|
||||
189,
|
||||
47,
|
||||
105,
|
||||
252,
|
||||
169,
|
||||
50,
|
||||
22,
|
||||
33,
|
||||
141,
|
||||
200,
|
||||
153,
|
||||
126,
|
||||
65,
|
||||
107,
|
||||
209,
|
||||
125,
|
||||
147,
|
||||
202,
|
||||
253,
|
||||
67,
|
||||
159,
|
||||
204,
|
||||
182,
|
||||
103,
|
||||
39,
|
||||
242,
|
||||
137,
|
||||
197,
|
||||
198,
|
||||
222,
|
||||
59,
|
||||
196,
|
||||
168,
|
||||
254,
|
||||
93,
|
||||
213,
|
||||
215,
|
||||
119,
|
||||
112,
|
||||
188,
|
||||
143,
|
||||
241,
|
||||
92,
|
||||
62,
|
||||
238,
|
||||
220,
|
||||
177,
|
||||
74,
|
||||
243,
|
||||
252,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
196,
|
||||
154,
|
||||
231,
|
||||
118,
|
||||
3,
|
||||
120,
|
||||
32,
|
||||
84,
|
||||
241,
|
||||
122,
|
||||
157,
|
||||
236,
|
||||
234,
|
||||
67,
|
||||
180,
|
||||
68,
|
||||
235,
|
||||
160,
|
||||
237,
|
||||
177,
|
||||
44,
|
||||
111,
|
||||
29,
|
||||
49,
|
||||
198,
|
||||
224,
|
||||
228,
|
||||
168,
|
||||
75,
|
||||
240,
|
||||
82,
|
||||
235,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
12,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
49,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]);
|
||||
const wireTransaction = Buffer.from(
|
||||
'AVuErQHaXv0SG0/PchunfxHKt8wMRfMZzqV0tkC5qO6owYxWU2v871AoWywGoFQr4z+q/7mE8lIufNl/kxj+nQ0BAAEDE5j2LG0aRXxRumpLXz29L2n8qTIWIY3ImX5Ba9F9k8r9Q5/Mtmcn8onFxt47xKj+XdXXd3C8j/FcPu7csUrz/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxJrndgN4IFTxep3s6kO0ROug7bEsbx0xxuDkqEvwUusBAgIAAQwCAAAAMQAAAAAAAAA=',
|
||||
'base64',
|
||||
);
|
||||
const tx = Transaction.from(wireTransaction);
|
||||
|
||||
expect(tx).toEqual(expectedTransaction);
|
||||
|
@ -393,7 +180,7 @@ test('serialize unsigned transaction', () => {
|
|||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
3,
|
||||
19,
|
||||
152,
|
||||
|
|
Loading…
Reference in New Issue