-
Notifications
You must be signed in to change notification settings - Fork 163
/
signerless_wallet.ts
49 lines (40 loc) · 1.85 KB
/
signerless_wallet.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
import { type AuthWitness, type PXE, type TxExecutionRequest } from '@aztec/circuit-types';
import { type CompleteAddress, type Fq, type Fr } from '@aztec/circuits.js';
import { DefaultEntrypoint } from '../entrypoint/default_entrypoint.js';
import { type EntrypointInterface, type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
import { type IntentAction, type IntentInnerHash } from '../utils/authwit.js';
import { BaseWallet } from './base_wallet.js';
/**
* Wallet implementation which creates a transaction request directly to the requested contract without any signing.
*/
export class SignerlessWallet extends BaseWallet {
constructor(pxe: PXE, private entrypoint?: EntrypointInterface) {
super(pxe);
}
async createTxExecutionRequest(execution: ExecutionRequestInit): Promise<TxExecutionRequest> {
let entrypoint = this.entrypoint;
if (!entrypoint) {
const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo();
entrypoint = new DefaultEntrypoint(chainId, protocolVersion);
}
return entrypoint.createTxExecutionRequest(execution);
}
getChainId(): Fr {
throw new Error('SignerlessWallet: Method getChainId not implemented.');
}
getVersion(): Fr {
throw new Error('SignerlessWallet: Method getVersion not implemented.');
}
getPublicKeysHash(): Fr {
throw new Error('SignerlessWallet: Method getPublicKeysHash not implemented.');
}
getCompleteAddress(): CompleteAddress {
throw new Error('SignerlessWallet: Method getCompleteAddress not implemented.');
}
createAuthWit(_intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness> {
throw new Error('SignerlessWallet: Method createAuthWit not implemented.');
}
rotateNullifierKeys(_newNskM: Fq): Promise<void> {
throw new Error('SignerlessWallet: Method rotateNullifierKeys not implemented.');
}
}