From 53ea59d19a1e4bdd9500ab086df0b60f0df4403c Mon Sep 17 00:00:00 2001 From: benesjan Date: Tue, 31 Oct 2023 09:43:13 +0000 Subject: [PATCH] consistent naming + exposing createAztecNodeClient --- yarn-project/aztec.js/src/index.ts | 1 + yarn-project/end-to-end/src/fixtures/utils.ts | 4 ++-- yarn-project/pxe/src/bin/index.ts | 4 ++-- .../{http_rpc_client.ts => aztec_node_client.ts} | 13 ++++++------- yarn-project/types/src/aztec_node/rpc/index.ts | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) rename yarn-project/types/src/aztec_node/rpc/{http_rpc_client.ts => aztec_node_client.ts} (72%) diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index 4f315d036fb..351b350fb19 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -32,6 +32,7 @@ export { TxStatus, UnencryptedL2Log, emptyFunctionCall, + createAztecNodeClient, } from '@aztec/types'; export { ContractArtifact } from '@aztec/foundation/abi'; export { createDebugLogger, DebugLogger } from '@aztec/foundation/log'; diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index c4f63723ce6..6b405775ad3 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -29,7 +29,7 @@ import { } from '@aztec/l1-artifacts'; import { PXEService, createPXEService, getPXEServiceConfig } from '@aztec/pxe'; import { SequencerClient } from '@aztec/sequencer-client'; -import { AztecNode, L2BlockL2Logs, LogType, PXE, createAztecNodeRpcClient } from '@aztec/types'; +import { AztecNode, L2BlockL2Logs, LogType, PXE, createAztecNodeClient } from '@aztec/types'; import * as path from 'path'; import { @@ -166,7 +166,7 @@ async function setupWithSandbox(account: Account, config: AztecNodeConfig, logge // we are setting up against the sandbox, l1 contracts are already deployed const aztecNodeUrl = getAztecNodeUrl(); logger(`Creating Aztec Node client to remote host ${aztecNodeUrl}`); - const aztecNode = createAztecNodeRpcClient(aztecNodeUrl); + const aztecNode = createAztecNodeClient(aztecNodeUrl); logger(`Creating PXE client to remote host ${PXE_URL}`); const pxeClient = createPXEClient(PXE_URL); await waitForPXE(pxeClient, logger); diff --git a/yarn-project/pxe/src/bin/index.ts b/yarn-project/pxe/src/bin/index.ts index 21de0ee64dd..de9e3684ed2 100644 --- a/yarn-project/pxe/src/bin/index.ts +++ b/yarn-project/pxe/src/bin/index.ts @@ -1,6 +1,6 @@ #!/usr/bin/env -S node --no-warnings import { createDebugLogger } from '@aztec/foundation/log'; -import { createAztecNodeRpcClient } from '@aztec/types'; +import { createAztecNodeClient } from '@aztec/types'; import { getPXEServiceConfig } from '../config/index.js'; import { startPXEHttpServer } from '../pxe_http/index.js'; @@ -17,7 +17,7 @@ async function main() { logger.info(`Setting up PXE...`); const pxeConfig = getPXEServiceConfig(); - const nodeRpcClient = createAztecNodeRpcClient(AZTEC_NODE_URL); + const nodeRpcClient = createAztecNodeClient(AZTEC_NODE_URL); const pxeService = await createPXEService(nodeRpcClient, pxeConfig); const shutdown = async () => { diff --git a/yarn-project/types/src/aztec_node/rpc/http_rpc_client.ts b/yarn-project/types/src/aztec_node/rpc/aztec_node_client.ts similarity index 72% rename from yarn-project/types/src/aztec_node/rpc/http_rpc_client.ts rename to yarn-project/types/src/aztec_node/rpc/aztec_node_client.ts index 0dd96e503a7..1c312302357 100644 --- a/yarn-project/types/src/aztec_node/rpc/http_rpc_client.ts +++ b/yarn-project/types/src/aztec_node/rpc/aztec_node_client.ts @@ -19,13 +19,13 @@ import { } from '@aztec/types'; /** - * Creates a JSON-RPC client to remotely talk to an AztecNode. - * @param url - The URL of the AztecNode - * @param fetch - The fetch implementation to use - * @returns A JSON-RPC client + * Creates a JSON-RPC client to remotely talk to an Aztec Node. + * @param url - The URL of the Aztec Node. + * @param fetch - The fetch implementation to use. + * @returns A JSON-RPC client of Aztec Node. */ -export function createAztecNodeRpcClient(url: string, fetch = defaultFetch): AztecNode { - const rpcClient = createJsonRpcClient( +export function createAztecNodeClient(url: string, fetch = defaultFetch): AztecNode { + return createJsonRpcClient( url, { AztecAddress, @@ -47,5 +47,4 @@ export function createAztecNodeRpcClient(url: string, fetch = defaultFetch): Azt false, fetch, ); - return rpcClient; } diff --git a/yarn-project/types/src/aztec_node/rpc/index.ts b/yarn-project/types/src/aztec_node/rpc/index.ts index e8ecf164fef..9b73b528764 100644 --- a/yarn-project/types/src/aztec_node/rpc/index.ts +++ b/yarn-project/types/src/aztec_node/rpc/index.ts @@ -1 +1 @@ -export * from './http_rpc_client.js'; +export * from './aztec_node_client.js';