WIP commit, getting single signer transactions off the ground

This commit is contained in:
Dummy Tester 123 2021-02-22 21:18:52 -06:00
parent 0f0f268253
commit 5cfd98264c
5 changed files with 18 additions and 8 deletions

View File

@ -69,9 +69,9 @@ export const PROGRAM_IDS = [
name: 'testnet',
timelock: () => ({
programAccountId: new PublicKey(
'77ZN8QJ234sGjxWR2CkEeuzaNnF888uBJektmWobEMHa',
'52goe5j8e25JWzcH6WnAjZ8bWfp4KwxPZsaxQ4fK1Xwx',
),
programId: new PublicKey('7ncumqGMduzYcnZarZWumayXpAB7TJH6uvbLYCz8dT68'),
programId: new PublicKey('5n4ciqDUt5MwRMFsViBXfQLGfqfg9mSZqgaKLu8zyrgw'),
}),
wormhole: () => ({
pubkey: new PublicKey('5gQf5AUhAgWYgUCt9ouShm9H7dzzXUsLdssYwe5krKhg'),
@ -90,9 +90,9 @@ export const PROGRAM_IDS = [
name: 'devnet',
timelock: () => ({
programAccountId: new PublicKey(
'EPsAj4tGpPF3c4w8y7dtuUfemBdPwmr5nji1BH5B18Lq',
'H59qsZj8wwA9h45UTbVwuYePcXXhKeeAtab3ujdQoqRc',
),
programId: new PublicKey('5rnMWALKssHK5fDxhpxvgpB9ZM5Yqgegsv2hwMebWMKx'),
programId: new PublicKey('DCPZ3VHspU2LGSHs2gaqUXYQykZ9C4iFX68KqATjBcLG'),
}),
wormhole: () => ({
pubkey: new PublicKey('WormT3McKhFJ2RkiGpdw9GKvNCrB2aB54gb2uV9MfQC'),

View File

@ -40,6 +40,11 @@ export const addCustomSingleSignerTransaction = async (
programId: PROGRAM_IDS.timelock.programId,
});
const [authority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
PROGRAM_IDS.timelock.programId,
);
signers.push(txnKey);
instructions.push(uninitializedTxnInstruction);
@ -50,7 +55,8 @@ export const addCustomSingleSignerTransaction = async (
proposal.pubkey,
sigAccount,
proposal.info.signatoryValidation,
'0',
authority,
'123',
'12345',
0,
),

View File

@ -34,6 +34,7 @@ export const addCustomSingleSignerTransactionInstruction = (
timelockSetAccount: PublicKey,
signatoryAccount: PublicKey,
signatoryValidationAccount: PublicKey,
authority: PublicKey,
slot: string,
instruction: string,
position: number,
@ -64,7 +65,7 @@ export const addCustomSingleSignerTransactionInstruction = (
for (let i = instructionAsBytes.length; i <= INSTRUCTION_LIMIT - 1; i++) {
instructionAsBytes.push(0);
}
console.log('Lenth', instructionAsBytes.length);
console.log('Num', new BN(slot).toNumber());
dataLayout.encode(
{
@ -81,6 +82,7 @@ export const addCustomSingleSignerTransactionInstruction = (
{ pubkey: timelockSetAccount, isSigner: false, isWritable: true },
{ pubkey: signatoryAccount, isSigner: false, isWritable: true },
{ pubkey: signatoryValidationAccount, isSigner: false, isWritable: true },
{ pubkey: authority, isSigner: false, isWritable: false },
{
pubkey: PROGRAM_IDS.timelock.programAccountId,
isSigner: false,

View File

@ -72,8 +72,7 @@ export const initTimelockSetInstruction = (
for (let i = nameAsBytes.length; i <= NAME_SIZE - 1; i++) {
nameAsBytes.push(0);
}
console.log(nameAsBytes.length);
console.log(descAsBytes.length);
dataLayout.encode(
{
instruction: TimelockInstruction.InitTimelockSet,

View File

@ -171,12 +171,15 @@ export const TimelockSetParser = (
export const CustomSingleSignerTimelockTransactionLayout: typeof BufferLayout.Structure = BufferLayout.struct(
[
BufferLayout.u8('version'),
Layout.uint64('slot'),
BufferLayout.seq(BufferLayout.u8(), INSTRUCTION_LIMIT, 'instruction'),
Layout.publicKey('authorityKey'),
],
);
export interface CustomSingleSignerTimelockTransaction {
version: number;
slot: BN;
instruction: string;