Catch up to latest Transaction ABI changes

This commit is contained in:
Michael Vines 2018-09-20 14:22:11 -07:00
parent d009e7e91b
commit da2496872b
2 changed files with 4 additions and 15 deletions

View File

@ -167,9 +167,6 @@ export class BudgetProgram {
userdata.writeUInt32LE(amount, pos); // Contract.tokens
pos += 8;
userdata.writeUInt32LE(0, pos); // Contract.plan = Budget
pos += 4;
switch (conditions.length) {
case 0:
userdata.writeUInt32LE(0, pos); // Budget enum = Pay

View File

@ -24,7 +24,7 @@ export class SystemProgram {
newAccount: PublicKey,
tokens: number,
space: number,
programId: ?PublicKey
programId: PublicKey
): Transaction {
const userdata = Buffer.alloc(4 + 8 + 8 + 1 + 32);
let pos = 0;
@ -38,17 +38,9 @@ export class SystemProgram {
userdata.writeUInt32LE(space, pos); // space as u64
pos += 8;
if (programId) {
userdata.writeUInt8(1, pos); // 'Some'
pos += 1;
const programIdBytes = Transaction.serializePublicKey(programId);
programIdBytes.copy(userdata, pos);
pos += 32;
} else {
userdata.writeUInt8(0, pos); // 'None'
pos += 1;
}
const programIdBytes = Transaction.serializePublicKey(programId);
programIdBytes.copy(userdata, pos);
pos += 32;
assert(pos <= userdata.length);