diff --git a/yarn-project/aztec-rpc/src/aztec_rpc_http/aztec_rpc_http_server.ts b/yarn-project/aztec-rpc/src/aztec_rpc_http/aztec_rpc_http_server.ts index 162eb59183d..c5bbb3a1b17 100644 --- a/yarn-project/aztec-rpc/src/aztec_rpc_http/aztec_rpc_http_server.ts +++ b/yarn-project/aztec-rpc/src/aztec_rpc_http/aztec_rpc_http_server.ts @@ -9,6 +9,7 @@ import { ExtendedContractData, L2Block, L2BlockL2Logs, + L2Tx, NotePreimage, Tx, TxExecutionRequest, @@ -43,6 +44,7 @@ export function getHttpRpcServer(aztecRpcServer: AztecRPC): JsonRpcServer { NotePreimage, AuthWitness, L2Block, + L2Tx, }, { Tx, TxReceipt, L2BlockL2Logs }, false, diff --git a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts index fe754f7c652..1a62882c8ae 100644 --- a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts +++ b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts @@ -37,6 +37,7 @@ import { KeyStore, L2Block, L2BlockL2Logs, + L2Tx, LogType, NodeInfo, NotePreimage, @@ -302,6 +303,10 @@ export class AztecRPCServer implements AztecRPC { return new TxReceipt(txHash, TxStatus.DROPPED, 'Tx dropped by P2P node.'); } + public async getTx(txHash: TxHash): Promise { + return await this.node.getTx(txHash); + } + async getBlockNumber(): Promise { return await this.node.getBlockNumber(); } diff --git a/yarn-project/aztec.js/src/aztec_rpc_client.ts b/yarn-project/aztec.js/src/aztec_rpc_client.ts index fee9e8192e1..511ed931282 100644 --- a/yarn-project/aztec.js/src/aztec_rpc_client.ts +++ b/yarn-project/aztec.js/src/aztec_rpc_client.ts @@ -6,6 +6,7 @@ import { ContractData, ExtendedContractData, L2BlockL2Logs, + L2Tx, NotePreimage, Tx, TxExecutionRequest, @@ -31,6 +32,7 @@ export const createAztecRpcClient = (url: string, fetch = makeFetch([1, 2, 3], t GrumpkinScalar, NotePreimage, AuthWitness, + L2Tx, }, { Tx, TxReceipt, L2BlockL2Logs }, false, diff --git a/yarn-project/aztec.js/src/wallet/base_wallet.ts b/yarn-project/aztec.js/src/wallet/base_wallet.ts index dac3fc0c818..01a29b2bba1 100644 --- a/yarn-project/aztec.js/src/wallet/base_wallet.ts +++ b/yarn-project/aztec.js/src/wallet/base_wallet.ts @@ -7,6 +7,7 @@ import { ExtendedContractData, FunctionCall, L2BlockL2Logs, + L2Tx, NodeInfo, NotePreimage, SyncStatus, @@ -61,6 +62,9 @@ export abstract class BaseWallet implements Wallet { sendTx(tx: Tx): Promise { return this.rpc.sendTx(tx); } + getTx(txHash: TxHash): Promise { + return this.rpc.getTx(txHash); + } getTxReceipt(txHash: TxHash): Promise { return this.rpc.getTxReceipt(txHash); } diff --git a/yarn-project/types/src/interfaces/aztec_rpc.ts b/yarn-project/types/src/interfaces/aztec_rpc.ts index 0a5d1fdddd9..66a83651a2c 100644 --- a/yarn-project/types/src/interfaces/aztec_rpc.ts +++ b/yarn-project/types/src/interfaces/aztec_rpc.ts @@ -5,6 +5,7 @@ import { ContractData, ExtendedContractData, L2BlockL2Logs, + L2Tx, NotePreimage, Tx, TxExecutionRequest, @@ -138,6 +139,13 @@ export interface AztecRPC { */ getTxReceipt(txHash: TxHash): Promise; + /** + * Fetches a transaction by its hash. + * @param txHash - The transaction hash + * @returns A transaction object or undefined if the transaction hasn't been mined yet + */ + getTx(txHash: TxHash): Promise; + /** * Retrieves the private storage data at a specified contract address and storage slot. Returns only data * encrypted for the specified owner that has been already decrypted by the RPC server. Note that there