From 0b51791a21a775fe7675220b1f2213bc4ef07e19 Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 3 Nov 2023 19:46:19 +0000 Subject: [PATCH] naming --- yarn-project/aztec.js/src/contract/sent_tx.ts | 12 ++++++------ .../end-to-end/src/e2e_token_contract.test.ts | 4 ++-- yarn-project/types/src/tx/tx_receipt.ts | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/yarn-project/aztec.js/src/contract/sent_tx.ts b/yarn-project/aztec.js/src/contract/sent_tx.ts index b65e94c5fab..9c52a6418a7 100644 --- a/yarn-project/aztec.js/src/contract/sent_tx.ts +++ b/yarn-project/aztec.js/src/contract/sent_tx.ts @@ -15,15 +15,15 @@ export type WaitOpts = { * If false, then any queries that depend on state set by this transaction may return stale data. Defaults to true. **/ waitForNotesSync?: boolean; - /** Whether to include information useful for testing in the receipt. */ - test?: boolean; + /** Whether to include information useful for debugging/testing in the receipt. */ + debug?: boolean; }; const DefaultWaitOpts: WaitOpts = { timeout: 60, interval: 1, waitForNotesSync: true, - test: false, + debug: false, }; /** @@ -61,17 +61,17 @@ export class SentTx { * @returns The transaction receipt. */ public async wait(opts?: WaitOpts): Promise> { - if (opts?.test && opts.waitForNotesSync === false) { + if (opts?.debug && opts.waitForNotesSync === false) { throw new Error('Cannot set getNotes to true if waitForNotesSync is false'); } const receipt = await this.waitForReceipt(opts); if (receipt.status !== TxStatus.MINED) throw new Error(`Transaction ${await this.getTxHash()} was ${receipt.status}`); - if (opts?.test) { + if (opts?.debug) { const txHash = await this.getTxHash(); const tx = (await this.pxe.getTx(txHash))!; const visibleNotes = await this.pxe.getNotes({ txHash }); - receipt.testInfo = { + receipt.debugInfo = { newCommitments: tx.newCommitments, newNullifiers: tx.newNullifiers, newPublicDataWrites: tx.newPublicDataWrites, diff --git a/yarn-project/end-to-end/src/e2e_token_contract.test.ts b/yarn-project/end-to-end/src/e2e_token_contract.test.ts index b4ff285522d..009e276095d 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_token_contract.test.ts @@ -172,11 +172,11 @@ describe('e2e_token_contract', () => { it('redeem as recipient', async () => { await addPendingShieldNoteToPXE(0, amount, secretHash, txHash); const txClaim = asset.methods.redeem_shield(accounts[0].address, amount, secret).send(); - const receiptClaim = await txClaim.wait({ test: true }); + const receiptClaim = await txClaim.wait({ debug: true }); expect(receiptClaim.status).toBe(TxStatus.MINED); tokenSim.redeemShield(accounts[0].address, amount); // 1 note should be created containing `amount` of tokens - const { visibleNotes } = receiptClaim.testInfo!; + const { visibleNotes } = receiptClaim.debugInfo!; expect(visibleNotes.length).toBe(1); expect(visibleNotes[0].note.items[0].toBigInt()).toBe(amount); }); diff --git a/yarn-project/types/src/tx/tx_receipt.ts b/yarn-project/types/src/tx/tx_receipt.ts index bc4f02dbd5e..0e6cd50a9ec 100644 --- a/yarn-project/types/src/tx/tx_receipt.ts +++ b/yarn-project/types/src/tx/tx_receipt.ts @@ -44,7 +44,7 @@ export class TxReceipt { /** * Information useful for testing, set when test flag is set to true in `waitOpts`. */ - public testInfo?: TestInfo, + public debugInfo?: DebugInfo, ) {} /** @@ -79,9 +79,10 @@ export class TxReceipt { } /** - * Information useful for testing purposes included in the receipt when the test flag is set to true in `WaitOpts`. + * Information useful for debugging/testing purposes included in the receipt when the debug flag is set to true + * in `WaitOpts`. */ -interface TestInfo { +interface DebugInfo { /** * New commitments created by the transaction. */