@kamino-finance/scope-sdk
Version:
Scope Oracle SDK
42 lines (39 loc) • 1.38 kB
text/typescript
/* eslint-disable @typescript-eslint/no-unused-vars */
import {
Address,
isSome,
IAccountMeta,
IAccountSignerMeta,
IInstruction,
Option,
TransactionSigner,
} from "@solana/kit"
/* eslint-enable @typescript-eslint/no-unused-vars */
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
import { borshAddress } from "../utils" // 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 InitializeGlobalConfigAccounts {
adminAuthority: TransactionSigner
globalConfig: Address
systemProgram: Address
}
export function initializeGlobalConfig(
accounts: InitializeGlobalConfigAccounts,
programAddress: Address = PROGRAM_ID
) {
const keys: Array<IAccountMeta | IAccountSignerMeta> = [
{
address: accounts.adminAuthority.address,
role: 3,
signer: accounts.adminAuthority,
},
{ address: accounts.globalConfig, role: 1 },
{ address: accounts.systemProgram, role: 0 },
]
const identifier = Buffer.from([113, 216, 122, 131, 225, 209, 22, 55])
const data = identifier
const ix: IInstruction = { accounts: keys, programAddress, data }
return ix
}