mirror of https://github.com/certusone/oyster.git
Merge pull request #71 from SebastianBor/fix/transfer-authority-signers
Governance: Fix transfer authority signers
This commit is contained in:
commit
73fd0aac7e
|
@ -65,27 +65,17 @@ export function approve(
|
||||||
const transferAuthority = existingTransferAuthority || new Account();
|
const transferAuthority = existingTransferAuthority || new Account();
|
||||||
const delegateKey = delegate ?? transferAuthority.publicKey;
|
const delegateKey = delegate ?? transferAuthority.publicKey;
|
||||||
|
|
||||||
const instruction = Token.createApproveInstruction(
|
instructions.push(
|
||||||
tokenProgram,
|
Token.createApproveInstruction(
|
||||||
account,
|
tokenProgram,
|
||||||
delegateKey,
|
account,
|
||||||
owner,
|
delegate ?? transferAuthority.publicKey,
|
||||||
[],
|
owner,
|
||||||
amount,
|
[],
|
||||||
|
amount,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Temp. workaround for a bug in Token.createApproveInstruction which doesn't add the delegate account to signers
|
|
||||||
instruction.keys = instruction.keys.map(k =>
|
|
||||||
k.pubkey.equals(delegateKey)
|
|
||||||
? {
|
|
||||||
...k,
|
|
||||||
isSigner: true,
|
|
||||||
}
|
|
||||||
: k,
|
|
||||||
);
|
|
||||||
|
|
||||||
instructions.push(instruction);
|
|
||||||
|
|
||||||
if (autoRevoke) {
|
if (autoRevoke) {
|
||||||
cleanupInstructions.push(
|
cleanupInstructions.push(
|
||||||
Token.createRevokeInstruction(tokenProgram, account, owner, []),
|
Token.createRevokeInstruction(tokenProgram, account, owner, []),
|
||||||
|
|
|
@ -55,7 +55,7 @@ export const depositSourceTokensInstruction = (
|
||||||
{ pubkey: sourceHoldingAccount, isSigner: false, isWritable: true },
|
{ pubkey: sourceHoldingAccount, isSigner: false, isWritable: true },
|
||||||
{ pubkey: votingMint, isSigner: false, isWritable: true },
|
{ pubkey: votingMint, isSigner: false, isWritable: true },
|
||||||
{ pubkey: timelockSetAccount, isSigner: false, isWritable: false },
|
{ pubkey: timelockSetAccount, isSigner: false, isWritable: false },
|
||||||
{ pubkey: transferAuthority, isSigner: false, isWritable: false },
|
{ pubkey: transferAuthority, isSigner: true, isWritable: false },
|
||||||
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
||||||
{ pubkey: PROGRAM_IDS.token, isSigner: false, isWritable: false },
|
{ pubkey: PROGRAM_IDS.token, isSigner: false, isWritable: false },
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue