From 1d1b0da1f2698d4567dad197aea4a9af2dc4a09d Mon Sep 17 00:00:00 2001 From: Conner Gallagher Date: Thu, 22 Dec 2022 10:53:17 -0700 Subject: [PATCH] crank pop params --- .../solana.js/src/accounts/crankAccount.ts | 47 +++++++++++-------- javascript/solana.js/test/crank.spec.ts | 12 +++-- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/javascript/solana.js/src/accounts/crankAccount.ts b/javascript/solana.js/src/accounts/crankAccount.ts index 8397312..734bfd0 100644 --- a/javascript/solana.js/src/accounts/crankAccount.ts +++ b/javascript/solana.js/src/accounts/crankAccount.ts @@ -313,10 +313,11 @@ export class CrankAccount extends Account { payer: PublicKey, params: { payoutTokenWallet: PublicKey; - crank: types.CrankAccountData; - crankRows: Array; - queueAccount: QueueAccount; - queue: types.OracleQueueAccountData; + + queuePubkey: PublicKey; + queueAuthority: PublicKey; + queueDataBuffer: PublicKey; + crankDataBuffer: PublicKey; remainingAccounts: Array; leaseBumps: Map; @@ -353,13 +354,13 @@ export class CrankAccount extends Account { }, { crank: this.publicKey, - oracleQueue: params.queueAccount.publicKey, - queueAuthority: params.queue.authority, + oracleQueue: params.queuePubkey, + queueAuthority: params.queueAuthority, programState: this.program.programState.publicKey, payoutWallet: params.payoutTokenWallet, tokenProgram: TOKEN_PROGRAM_ID, - crankDataBuffer: params.crank.dataBuffer, - queueDataBuffer: params.queue.dataBuffer, + crankDataBuffer: params.crankDataBuffer, + queueDataBuffer: params.queueDataBuffer, mint: this.program.mint.address, } ); @@ -377,10 +378,12 @@ export class CrankAccount extends Account { payer: PublicKey, params: { payoutTokenWallet: PublicKey; - crank: types.CrankAccountData; - crankRows: Array; - queueAccount: QueueAccount; - queue: types.OracleQueueAccountData; + + queuePubkey: PublicKey; + queueAuthority: PublicKey; + queueDataBuffer: PublicKey; + crankDataBuffer: PublicKey; + readyAggregators: Array<[AggregatorAccount, AggregatorPdaAccounts]>; nonce?: number; @@ -466,10 +469,12 @@ export class CrankAccount extends Account { payer: PublicKey, params: { payoutTokenWallet: PublicKey; - crank: types.CrankAccountData; - crankRows: Array; - queueAccount: QueueAccount; - queue: types.OracleQueueAccountData; + + queuePubkey: PublicKey; + queueAuthority: PublicKey; + queueDataBuffer: PublicKey; + crankDataBuffer: PublicKey; + readyAggregators: Array<[AggregatorAccount, AggregatorPdaAccounts]>; nonce?: number; @@ -510,10 +515,12 @@ export class CrankAccount extends Account { public async packAndPop( params: { payoutTokenWallet: PublicKey; - crank: types.CrankAccountData; - crankRows: Array; - queueAccount: QueueAccount; - queue: types.OracleQueueAccountData; + + queuePubkey: PublicKey; + queueAuthority: PublicKey; + queueDataBuffer: PublicKey; + crankDataBuffer: PublicKey; + readyAggregators: Array<[AggregatorAccount, AggregatorPdaAccounts]>; nonce?: number; diff --git a/javascript/solana.js/test/crank.spec.ts b/javascript/solana.js/test/crank.spec.ts index 77f50bc..ccd0f7f 100644 --- a/javascript/solana.js/test/crank.spec.ts +++ b/javascript/solana.js/test/crank.spec.ts @@ -166,6 +166,8 @@ describe('Crank Tests', () => { return (await SolanaClock.fetch(ctx.program.connection)).unixTimestamp; }; + const crank = await crankAccount.loadData(); + let timestamp = await getTimestamp(); const nextAvailable = (await crankAccount.loadCrank()).reduce( @@ -225,10 +227,12 @@ describe('Crank Tests', () => { ctx.payer.publicKey, { payoutTokenWallet: userTokenAddress, - crank: await crankAccount.loadData(), - crankRows: initialCrankRows, - queueAccount, - queue, + + queuePubkey: queueAccount.publicKey, + queueAuthority: queue.authority, + queueDataBuffer: queue.dataBuffer, + crankDataBuffer: crank.dataBuffer, + readyAggregators: readyAggregators, failOpenOnMismatch: true, }