|
19 | 19 | *
|
20 | 20 | * @packageDocumentation
|
21 | 21 | */
|
22 |
| -import { CompleteAddress, GrumpkinPrivateKey, PXE } from '@aztec/types'; |
| 22 | +import { Fr } from '@aztec/circuits.js'; |
23 | 23 |
|
24 |
| -import { AccountContract, AccountWallet, AztecAddress, Fr } from '../index.js'; |
25 |
| -import { EcdsaAccountContract } from './contract/ecdsa_account_contract.js'; |
26 |
| -import { SchnorrAccountContract } from './contract/schnorr_account_contract.js'; |
27 |
| -import { SingleKeyAccountContract } from './contract/single_key_account_contract.js'; |
28 |
| -import { AccountManager } from './manager/index.js'; |
| 24 | +export { CompleteAddress } from '@aztec/types'; |
29 | 25 |
|
30 |
| -export * from './contract/index.js'; |
31 | 26 | export * from './defaults/index.js';
|
32 |
| -export * from './utils.js'; |
33 | 27 | export { AccountInterface, AuthWitnessProvider } from './interface.js';
|
34 |
| -export { AccountManager, CompleteAddress }; |
| 28 | +export * from './wallet.js'; |
35 | 29 |
|
36 | 30 | /** A contract deployment salt. */
|
37 | 31 | export type Salt = Fr | number | bigint;
|
38 |
| - |
39 |
| -/** |
40 |
| - * Creates an Account that relies on an ECDSA signing key for authentication. |
41 |
| - * @param pxe - An PXE server instance. |
42 |
| - * @param encryptionPrivateKey - Grumpkin key used for note encryption. |
43 |
| - * @param signingPrivateKey - Secp256k1 key used for signing transactions. |
44 |
| - * @param saltOrAddress - Deployment salt or complete address if account contract is already deployed. |
45 |
| - */ |
46 |
| -export function getEcdsaAccount( |
47 |
| - pxe: PXE, |
48 |
| - encryptionPrivateKey: GrumpkinPrivateKey, |
49 |
| - signingPrivateKey: Buffer, |
50 |
| - saltOrAddress?: Salt | CompleteAddress, |
51 |
| -): AccountManager { |
52 |
| - return new AccountManager(pxe, encryptionPrivateKey, new EcdsaAccountContract(signingPrivateKey), saltOrAddress); |
53 |
| -} |
54 |
| - |
55 |
| -/** |
56 |
| - * Creates an Account that relies on a Grumpkin signing key for authentication. |
57 |
| - * @param pxe - An PXE server instance. |
58 |
| - * @param encryptionPrivateKey - Grumpkin key used for note encryption. |
59 |
| - * @param signingPrivateKey - Grumpkin key used for signing transactions. |
60 |
| - * @param saltOrAddress - Deployment salt or complete address if account contract is already deployed. |
61 |
| - */ |
62 |
| -export function getSchnorrAccount( |
63 |
| - pxe: PXE, |
64 |
| - encryptionPrivateKey: GrumpkinPrivateKey, |
65 |
| - signingPrivateKey: GrumpkinPrivateKey, |
66 |
| - saltOrAddress?: Salt | CompleteAddress, |
67 |
| -): AccountManager { |
68 |
| - return new AccountManager(pxe, encryptionPrivateKey, new SchnorrAccountContract(signingPrivateKey), saltOrAddress); |
69 |
| -} |
70 |
| - |
71 |
| -/** |
72 |
| - * Creates an Account that uses the same Grumpkin key for encryption and authentication. |
73 |
| - * @param pxe - An PXE server instance. |
74 |
| - * @param encryptionAndSigningPrivateKey - Grumpkin key used for note encryption and signing transactions. |
75 |
| - * @param saltOrAddress - Deployment salt or complete address if account contract is already deployed. |
76 |
| - */ |
77 |
| -export function getUnsafeSchnorrAccount( |
78 |
| - pxe: PXE, |
79 |
| - encryptionAndSigningPrivateKey: GrumpkinPrivateKey, |
80 |
| - saltOrAddress?: Salt | CompleteAddress, |
81 |
| -): AccountManager { |
82 |
| - return new AccountManager( |
83 |
| - pxe, |
84 |
| - encryptionAndSigningPrivateKey, |
85 |
| - new SingleKeyAccountContract(encryptionAndSigningPrivateKey), |
86 |
| - saltOrAddress, |
87 |
| - ); |
88 |
| -} |
89 |
| - |
90 |
| -/** |
91 |
| - * Gets a wallet for an already registered account using Schnorr signatures with a single key for encryption and authentication. |
92 |
| - * @param pxe - An PXE server instance. |
93 |
| - * @param address - Address for the account. |
94 |
| - * @param signingPrivateKey - Grumpkin key used for note encryption and signing transactions. |
95 |
| - * @returns A wallet for this account that can be used to interact with a contract instance. |
96 |
| - */ |
97 |
| -export function getUnsafeSchnorrWallet( |
98 |
| - pxe: PXE, |
99 |
| - address: AztecAddress, |
100 |
| - signingKey: GrumpkinPrivateKey, |
101 |
| -): Promise<AccountWallet> { |
102 |
| - return getWallet(pxe, address, new SingleKeyAccountContract(signingKey)); |
103 |
| -} |
104 |
| - |
105 |
| -/** |
106 |
| - * Gets a wallet for an already registered account. |
107 |
| - * @param pxe - PXE Service instance. |
108 |
| - * @param address - Address for the account. |
109 |
| - * @param accountContract - Account contract implementation. |
110 |
| - * @returns A wallet for this account that can be used to interact with a contract instance. |
111 |
| - */ |
112 |
| -export async function getWallet( |
113 |
| - pxe: PXE, |
114 |
| - address: AztecAddress, |
115 |
| - accountContract: AccountContract, |
116 |
| -): Promise<AccountWallet> { |
117 |
| - const completeAddress = await pxe.getRegisteredAccount(address); |
118 |
| - if (!completeAddress) { |
119 |
| - throw new Error(`Account ${address} not found`); |
120 |
| - } |
121 |
| - const nodeInfo = await pxe.getNodeInfo(); |
122 |
| - const entrypoint = accountContract.getInterface(completeAddress, nodeInfo); |
123 |
| - return new AccountWallet(pxe, entrypoint); |
124 |
| -} |
0 commit comments