Skip to content

Commit

Permalink
solana get account info
Browse files Browse the repository at this point in the history
  • Loading branch information
shan57blocks committed Nov 1, 2024
1 parent 78886c8 commit d3f407d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/huma-shared/src/solana/utils/accountUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { AnchorProvider, Program } from '@coral-xyz/anchor'
import { Connection, PublicKey } from '@solana/web3.js'
import { SolanaChainEnum } from '../chain'
import { Huma as HumaProgram } from '../idl/huma'
import HumaIDL from '../idl/huma.json'

export const getHumaConfigAccountInfo = async (
_chainId: SolanaChainEnum,
connection: Connection,
) => {
// @ts-ignore
const provider = new AnchorProvider(connection, null)
const humaProgram = new Program<HumaProgram>(HumaIDL as HumaProgram, provider)

const humaConfigAccountResult = await humaProgram.account.humaConfig.fetch(
new PublicKey('F2it2fBcdjeX9KCaEAWcQ1H8LnMB2zPn3nrPpHc7J8vL'),
)

console.log('humaConfigAccountResult', humaConfigAccountResult)
}
1 change: 1 addition & 0 deletions packages/huma-shared/src/solana/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './accountUtils'
export * from './poolUtils'
export * from './programUtils'
export * from './siwsUtils'
Expand Down

0 comments on commit d3f407d

Please sign in to comment.