-
Notifications
You must be signed in to change notification settings - Fork 273
/
aztec_rpc_http_server.ts
50 lines (46 loc) · 1.14 KB
/
aztec_rpc_http_server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
import { JsonRpcServer } from '@aztec/foundation/json-rpc/server';
import {
AuthWitness,
AztecRPC,
CompleteAddress,
ContractData,
ExtendedContractData,
L2BlockL2Logs,
NotePreimage,
Tx,
TxExecutionRequest,
TxHash,
TxReceipt,
} from '@aztec/types';
import { foundry } from 'viem/chains';
import { EthAddress } from '../index.js';
export const localAnvil = foundry;
/**
* Wraps an instance of the Aztec RPC Server implementation to a JSON RPC HTTP interface.
* @returns A new instance of the HTTP server.
*/
export function getHttpRpcServer(aztecRpcServer: AztecRPC): JsonRpcServer {
const generatedRpcServer = new JsonRpcServer(
aztecRpcServer,
{
CompleteAddress,
AztecAddress,
TxExecutionRequest,
ContractData,
ExtendedContractData,
TxHash,
EthAddress,
Point,
Fr,
GrumpkinScalar,
NotePreimage,
AuthWitness,
},
{ Tx, TxReceipt, L2BlockL2Logs },
false,
['start', 'stop'],
);
return generatedRpcServer;
}