fix: catch up to recent upstream changes

This commit is contained in:
Michael Vines
2018-10-17 09:35:24 -07:00
parent 972f68b16e
commit 011a2abd0c
10 changed files with 245 additions and 70 deletions

View File

@ -105,35 +105,4 @@ export class SystemProgram {
userdata,
});
}
/**
* Load a dynamic program. Unstable API, will change
*
* @private
*/
static load(from: PublicKey, programId: PublicKey, name: string): Transaction {
const userdataLayout = BufferLayout.struct([
BufferLayout.u32('instruction'),
Layout.publicKey('programId'),
Layout.rustString('name'),
]);
let userdata = Buffer.alloc(1024);
const encodeLength = userdataLayout.encode(
{
instruction: 3, // Load instruction
programId: programId.toBuffer(),
name,
},
userdata,
);
userdata = userdata.slice(0, encodeLength);
return new Transaction({
fee: 0,
keys: [from],
programId: SystemProgram.programId,
userdata,
});
}
}