diff --git a/javascript/solana.js/src/accounts/bufferRelayAccount.ts b/javascript/solana.js/src/accounts/bufferRelayAccount.ts index fae403f..2f9398b 100644 --- a/javascript/solana.js/src/accounts/bufferRelayAccount.ts +++ b/javascript/solana.js/src/accounts/bufferRelayAccount.ts @@ -281,6 +281,30 @@ export class BufferRelayerAccount extends Account { + const { bufferRelayer, queue, permission, escrow } = + await this.fetchAccounts(_bufferRelayer, _queueAccount, _queue); + + return { + publicKey: this.publicKey, + balance: this.program.mint.fromTokenAmount(escrow.data.amount), + ...bufferRelayer.data.toJSON(), + queue: { + publicKey: queue.publicKey, + ...queue.data.toJSON(), + }, + permission: { + publicKey: permission.publicKey, + bump: permission.bump, + ...permission.data.toJSON(), + }, + }; + } + public async fetchAccounts( _bufferRelayer?: types.BufferRelayerAccountData, _queueAccount?: QueueAccount, @@ -361,3 +385,13 @@ export type BufferRelayerAccounts = { balance: number; }; }; + +export type BufferRelayerAccountsJSON = types.BufferRelayerAccountDataJSON & { + publicKey: PublicKey; + balance: number; + queue: types.OracleQueueAccountDataJSON & { publicKey: PublicKey }; + permission: types.PermissionAccountDataJSON & { + bump: number; + publicKey: PublicKey; + }; +};