Proposals: fix transaction signatures warnings (#55)

* chore: cleanup lint errors

* fix: transaction signatures warnings

* chore: cleanup code
This commit is contained in:
Sebastian Bor 2021-04-08 22:13:08 +01:00 committed by GitHub
parent ce7cb6729f
commit 92d2c151c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 22 deletions

View File

@ -60,19 +60,31 @@ export function approve(
delegate?: PublicKey,
): Account {
const tokenProgram = TOKEN_PROGRAM_ID;
const transferAuthority = new Account();
instructions.push(
Token.createApproveInstruction(
tokenProgram,
account,
delegate ?? transferAuthority.publicKey,
owner,
[],
amount,
),
const transferAuthority = new Account();
const delegateKey = delegate ?? transferAuthority.publicKey;
const instruction = Token.createApproveInstruction(
tokenProgram,
account,
delegateKey,
owner,
[],
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) {
cleanupInstructions.push(
Token.createRevokeInstruction(tokenProgram, account, owner, []),

View File

@ -4,13 +4,7 @@ import {
PublicKey,
TransactionInstruction,
} from '@solana/web3.js';
import {
contexts,
utils,
models,
ParsedAccount,
actions,
} from '@oyster/common';
import { contexts, utils, ParsedAccount, actions } from '@oyster/common';
import { TimelockConfig } from '../models/timelock';
import { AccountLayout, Token } from '@solana/spl-token';

View File

@ -1,4 +1,4 @@
import { Button, Row, Spin } from 'antd';
import { Row, Spin } from 'antd';
import React from 'react';
import { GUTTER } from '../../constants';
import { contexts, hooks, ParsedAccount } from '@oyster/common';
@ -6,7 +6,6 @@ import './style.less';
import { useProposals } from '../../contexts/proposals';
import { TimelockSet } from '../../models/timelock';
import { Connection } from '@solana/web3.js';
import { addCustomSingleSignerTransaction } from '../../actions/addCustomSingleSignerTransaction';
import { WalletAdapter } from '@solana/wallet-base';
const { useWallet } = contexts.Wallet;
const { useConnection } = contexts.Connection;
@ -36,8 +35,6 @@ export const DashboardView = () => {
function InnerDummyView({
proposal,
connection,
wallet,
}: {
connection: Connection;
wallet: WalletAdapter;

View File

@ -78,7 +78,7 @@ export const HomeView = () => {
dataSource={listData}
renderItem={item => (
<List.Item
key={item.title}
key={item.configKey}
className="governance-item"
onClick={() => history.push(item.href)}
extra={