UNPKG

@marinade.finance/kamino-sdk

Version:
28 lines (25 loc) 1.31 kB
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars import * as borsh from "@project-serum/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars import { PROGRAM_ID } from "../programId" export interface CloseProgramAccountAccounts { adminAuthority: PublicKey program: PublicKey programData: PublicKey closingAccount: PublicKey systemProgram: PublicKey } export function closeProgramAccount(accounts: CloseProgramAccountAccounts) { const keys: Array<AccountMeta> = [ { pubkey: accounts.adminAuthority, isSigner: true, isWritable: true }, { pubkey: accounts.program, isSigner: false, isWritable: false }, { pubkey: accounts.programData, isSigner: false, isWritable: false }, { pubkey: accounts.closingAccount, isSigner: false, isWritable: true }, { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }, ] const identifier = Buffer.from([245, 14, 192, 211, 99, 42, 170, 187]) const data = identifier const ix = new TransactionInstruction({ keys, programId: PROGRAM_ID, data }) return ix }