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 5947aca09fda..63555ea8df71 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 @@ -8,6 +8,7 @@ import { ContractData, ExtendedContractData, L2BlockL2Logs, + L2Tx, NotePreimage, Tx, TxExecutionRequest, @@ -41,6 +42,7 @@ export function getHttpRpcServer(aztecRpcServer: AztecRPC): JsonRpcServer { GrumpkinScalar, NotePreimage, AuthWitness, + 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 fe754f7c6521..1a62882c8ae7 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 fee9e8192e14..511ed9312824 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 dac3fc0c8186..01a29b2bba16 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 775ad61c6e09..96c24e8c322a 100644 --- a/yarn-project/types/src/interfaces/aztec_rpc.ts +++ b/yarn-project/types/src/interfaces/aztec_rpc.ts @@ -6,6 +6,7 @@ import { ContractData, ExtendedContractData, L2BlockL2Logs, + L2Tx, NotePreimage, Tx, TxExecutionRequest, @@ -170,6 +171,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. * The returned data is data at the storage slot or throws an error if the contract is not deployed.