BREAKING CHANGE: requires Solana version v0.13.0 or greater

feat: Update to current solana tx format
This commit is contained in:
Tyera Eulberg
2019-04-10 12:31:50 -07:00
committed by Michael Vines
parent 853ea88fd0
commit efd0392706
12 changed files with 196 additions and 167 deletions

View File

@ -28,7 +28,7 @@ test('load BPF program', async () => {
const data = await fs.readFile('test/fixtures/noop/noop.so');
const programId = await BpfLoader.load(connection, from, data);
const transaction = new Transaction().add({
keys: [from.publicKey],
keys: [{pubkey: from.publicKey, isSigner: true}],
programId,
});
await sendAndConfirmTransaction(connection, transaction, from);

View File

@ -301,7 +301,6 @@ test('transaction', async () => {
accountTo.publicKey,
10,
);
transaction.fee = 0;
const signature = await connection.sendTransaction(transaction, accountFrom);
mockRpc.push([
@ -396,7 +395,6 @@ test('multi-instruction transaction', async () => {
accountTo.publicKey,
10,
).add(SystemProgram.move(accountTo.publicKey, accountFrom.publicKey, 10));
transaction.fee = 0;
const signature = await connection.sendTransaction(
transaction,
accountFrom,
@ -445,7 +443,6 @@ test('account change notification', async () => {
3,
BpfLoader.programId,
);
transaction.fee = 0;
await sendAndConfirmTransaction(connection, transaction, owner);
const loader = new Loader(connection, BpfLoader.programId);
@ -500,7 +497,6 @@ test('program account change notification', async () => {
3,
BpfLoader.programId,
);
transaction.fee = 0;
await sendAndConfirmTransaction(connection, transaction, owner);
const loader = new Loader(connection, BpfLoader.programId);

View File

@ -25,7 +25,7 @@ test('load native program', async () => {
const from = await newAccountWithLamports(connection, 1024);
const programId = await NativeLoader.load(connection, from, 'noop');
const transaction = new Transaction().add({
keys: [from.publicKey],
keys: [{pubkey: from.publicKey, isSigner: true}],
programId,
});

View File

@ -607,4 +607,3 @@ test('set owner', async () => {
await testToken.setOwner(newOwner, account, owner.publicKey);
});

View File

@ -1,4 +1,6 @@
// @flow
import nacl from 'tweetnacl';
import {Account} from '../src/account';
import {PublicKey} from '../src/publickey';
import {Transaction} from '../src/transaction';
@ -33,7 +35,6 @@ test('transfer signatures', () => {
const newTransaction = new Transaction({
recentBlockhash: orgTransaction.recentBlockhash,
fee: orgTransaction.fee,
signatures: orgTransaction.signatures,
}).add(move1, move2);
@ -41,8 +42,11 @@ test('transfer signatures', () => {
});
test('parse wire format and serialize', () => {
const keypair = nacl.sign.keyPair.fromSeed(
Uint8Array.from(Array(32).fill(8)),
);
const sender = new Account(Buffer.from(keypair.secretKey)); // Arbitrary known account
const recentBlockhash = 'EETubP5AKHgjPAhzPAFcb8BAY1hMH639CWCFTqi3hq1k'; // Arbitrary known recentBlockhash
const sender = new Account(Buffer.alloc(64, 8)); // Arbitrary known account
const recipient = new PublicKey(
'J3dxNj7nDRRqRRXuEMynDG57DkZK4jYRuv3Garmb1i99',
); // Arbitrary known public key
@ -52,103 +56,104 @@ test('parse wire format and serialize', () => {
const wireTransaction = Buffer.from([
1,
50,
238,
193,
5,
227,
31,
95,
69,
85,
3,
132,
143,
216,
77,
235,
129,
3,
109,
89,
222,
127,
137,
228,
15,
113,
207,
169,
93,
167,
249,
71,
50,
204,
17,
25,
230,
33,
185,
182,
83,
116,
203,
102,
64,
245,
68,
34,
100,
52,
8,
149,
124,
56,
114,
17,
236,
92,
93,
53,
234,
122,
120,
219,
193,
156,
109,
35,
104,
119,
101,
197,
43,
141,
174,
228,
154,
146,
78,
216,
202,
18,
177,
179,
5,
255,
2,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
14,
87,
12,
207,
99,
241,
32,
151,
102,
70,
60,
218,
73,
232,
68,
33,
94,
134,
117,
138,
182,
179,
118,
249,
132,
52,
41,
162,
44,
0,
43,
193,
242,
120,
108,
4,
163,
191,
6,
1,
2,
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,
@ -221,14 +226,6 @@ test('parse wire format and serialize', () => {
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,