@aztec/validator-client 0.0.0-test.1 → 0.0.1-commit.b655e406

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dest/block_proposal_handler.d.ts +52 -0
  2. package/dest/block_proposal_handler.d.ts.map +1 -0
  3. package/dest/block_proposal_handler.js +286 -0
  4. package/dest/config.d.ts +2 -13
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +31 -7
  7. package/dest/duties/validation_service.d.ts +16 -8
  8. package/dest/duties/validation_service.d.ts.map +1 -1
  9. package/dest/duties/validation_service.js +35 -11
  10. package/dest/factory.d.ts +21 -4
  11. package/dest/factory.d.ts.map +1 -1
  12. package/dest/factory.js +13 -6
  13. package/dest/index.d.ts +3 -1
  14. package/dest/index.d.ts.map +1 -1
  15. package/dest/index.js +3 -1
  16. package/dest/key_store/index.d.ts +2 -0
  17. package/dest/key_store/index.d.ts.map +1 -1
  18. package/dest/key_store/index.js +2 -0
  19. package/dest/key_store/interface.d.ts +54 -5
  20. package/dest/key_store/interface.d.ts.map +1 -1
  21. package/dest/key_store/interface.js +3 -3
  22. package/dest/key_store/local_key_store.d.ts +40 -10
  23. package/dest/key_store/local_key_store.d.ts.map +1 -1
  24. package/dest/key_store/local_key_store.js +63 -16
  25. package/dest/key_store/node_keystore_adapter.d.ts +138 -0
  26. package/dest/key_store/node_keystore_adapter.d.ts.map +1 -0
  27. package/dest/key_store/node_keystore_adapter.js +316 -0
  28. package/dest/key_store/web3signer_key_store.d.ts +67 -0
  29. package/dest/key_store/web3signer_key_store.d.ts.map +1 -0
  30. package/dest/key_store/web3signer_key_store.js +152 -0
  31. package/dest/metrics.d.ts +11 -4
  32. package/dest/metrics.d.ts.map +1 -1
  33. package/dest/metrics.js +52 -15
  34. package/dest/validator.d.ts +48 -61
  35. package/dest/validator.d.ts.map +1 -1
  36. package/dest/validator.js +262 -165
  37. package/package.json +25 -19
  38. package/src/block_proposal_handler.ts +343 -0
  39. package/src/config.ts +42 -22
  40. package/src/duties/validation_service.ts +69 -14
  41. package/src/factory.ts +56 -11
  42. package/src/index.ts +3 -1
  43. package/src/key_store/index.ts +2 -0
  44. package/src/key_store/interface.ts +61 -5
  45. package/src/key_store/local_key_store.ts +67 -17
  46. package/src/key_store/node_keystore_adapter.ts +375 -0
  47. package/src/key_store/web3signer_key_store.ts +192 -0
  48. package/src/metrics.ts +68 -17
  49. package/src/validator.ts +381 -233
  50. package/dest/errors/index.d.ts +0 -2
  51. package/dest/errors/index.d.ts.map +0 -1
  52. package/dest/errors/index.js +0 -1
  53. package/dest/errors/validator.error.d.ts +0 -29
  54. package/dest/errors/validator.error.d.ts.map +0 -1
  55. package/dest/errors/validator.error.js +0 -45
  56. package/src/errors/index.ts +0 -1
  57. package/src/errors/validator.error.ts +0 -55
@@ -1,3 +1,5 @@
1
1
  export * from './interface.js';
2
2
  export * from './local_key_store.js';
3
+ export * from './node_keystore_adapter.js';
4
+ export * from './web3signer_key_store.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/key_store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/key_store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export * from './interface.js';
2
2
  export * from './local_key_store.js';
3
+ export * from './node_keystore_adapter.js';
4
+ export * from './web3signer_key_store.js';
@@ -1,25 +1,74 @@
1
1
  import type { Buffer32 } from '@aztec/foundation/buffer';
2
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import type { Signature } from '@aztec/foundation/eth-signature';
4
+ import type { EthRemoteSignerConfig } from '@aztec/node-keystore';
5
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
+ import type { TypedDataDefinition } from 'viem';
4
7
  /** Key Store
5
8
  *
6
9
  * A keystore interface that can be replaced with a local keystore / remote signer service
7
10
  */
8
11
  export interface ValidatorKeyStore {
9
12
  /**
10
- * Get the address of the signer
13
+ * Get the address of a signer by index
11
14
  *
15
+ * @param index - The index of the signer
12
16
  * @returns the address
13
17
  */
14
- getAddress(): EthAddress;
15
- sign(message: Buffer32): Promise<Signature>;
18
+ getAddress(index: number): EthAddress;
19
+ /**
20
+ * Get all addresses
21
+ *
22
+ * @returns all addresses
23
+ */
24
+ getAddresses(): EthAddress[];
25
+ signTypedData(typedData: TypedDataDefinition): Promise<Signature[]>;
26
+ signTypedDataWithAddress(address: EthAddress, typedData: TypedDataDefinition): Promise<Signature>;
16
27
  /**
17
28
  * Flavor of sign message that followed EIP-712 eth signed message prefix
18
29
  * Note: this is only required when we are using ecdsa signatures over secp256k1
19
30
  *
20
31
  * @param message - The message to sign.
21
- * @returns The signature.
32
+ * @returns The signatures.
33
+ */
34
+ signMessage(message: Buffer32): Promise<Signature[]>;
35
+ signMessageWithAddress(address: EthAddress, message: Buffer32): Promise<Signature>;
36
+ }
37
+ /**
38
+ * Extended ValidatorKeyStore interface that supports the new keystore configuration model
39
+ * with role-based address management (attester, coinbase, publisher, fee recipient)
40
+ */
41
+ export interface ExtendedValidatorKeyStore extends ValidatorKeyStore {
42
+ /**
43
+ * Get all attester addresses (maps to existing getAddresses())
44
+ * @returns all attester addresses
45
+ */
46
+ getAttesterAddresses(): EthAddress[];
47
+ /**
48
+ * Get the coinbase address for a specific attester
49
+ * Falls back to the attester address if not set
50
+ * @param attesterAddress - The attester address to find the coinbase for
51
+ * @returns the coinbase address
52
+ */
53
+ getCoinbaseAddress(attesterAddress: EthAddress): EthAddress;
54
+ /**
55
+ * Get all publisher addresses for a specific attester (EOAs used for sending block proposal L1 txs)
56
+ * Falls back to the attester addresses if not set
57
+ * @param attesterAddress - The attester address to find the publishers for
58
+ * @returns all publisher addresses for this validator
59
+ */
60
+ getPublisherAddresses(attesterAddress: EthAddress): EthAddress[];
61
+ /**
62
+ * Get the fee recipient address for a specific attester
63
+ * @param attesterAddress - The attester address to find the fee recipient for
64
+ * @returns the fee recipient address
65
+ */
66
+ getFeeRecipient(attesterAddress: EthAddress): AztecAddress;
67
+ /**
68
+ * Get the remote signer configuration for a specific attester if available
69
+ * @param attesterAddress - The attester address to find the remote signer config for
70
+ * @returns the remote signer configuration or undefined
22
71
  */
23
- signMessage(message: Buffer32): Promise<Signature>;
72
+ getRemoteSignerConfig(attesterAddress: EthAddress): EthRemoteSignerConfig | undefined;
24
73
  }
25
74
  //# sourceMappingURL=interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/key_store/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,UAAU,IAAI,UAAU,CAAC;IAEzB,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5C;;;;;;OAMG;IACH,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACpD"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/key_store/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCA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**
2
+ * Extended ValidatorKeyStore interface that supports the new keystore configuration model
3
+ * with role-based address management (attester, coinbase, publisher, fee recipient)
4
4
  */ export { };
@@ -1,28 +1,58 @@
1
- import type { Buffer32 } from '@aztec/foundation/buffer';
1
+ import { Buffer32 } from '@aztec/foundation/buffer';
2
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import type { Signature } from '@aztec/foundation/eth-signature';
4
+ import { type TypedDataDefinition } from 'viem';
4
5
  import type { ValidatorKeyStore } from './interface.js';
5
6
  /**
6
7
  * Local Key Store
7
8
  *
8
- * An implementation of the Key store using an in memory private key.
9
+ * An implementation of the Key store using in memory private keys.
9
10
  */
10
11
  export declare class LocalKeyStore implements ValidatorKeyStore {
11
- private signer;
12
- constructor(privateKey: Buffer32);
12
+ private signers;
13
+ private signersByAddress;
14
+ constructor(privateKeys: Buffer32[]);
13
15
  /**
14
- * Get the address of the signer
16
+ * Get the address of a signer by index
15
17
  *
18
+ * @param index - The index of the signer
16
19
  * @returns the address
17
20
  */
18
- getAddress(): EthAddress;
21
+ getAddress(index: number): EthAddress;
19
22
  /**
20
- * Sign a message with the keystore private key
23
+ * Get the addresses of all signers
21
24
  *
22
- * @param messageBuffer - The message buffer to sign
25
+ * @returns the addresses
26
+ */
27
+ getAddresses(): EthAddress[];
28
+ /**
29
+ * Sign a message with all keystore private keys
30
+ * @param typedData - The complete EIP-712 typed data structure (domain, types, primaryType, message)
23
31
  * @return signature
24
32
  */
25
- sign(digest: Buffer32): Promise<Signature>;
26
- signMessage(message: Buffer32): Promise<Signature>;
33
+ signTypedData(typedData: TypedDataDefinition): Promise<Signature[]>;
34
+ /**
35
+ * Sign a message with a specific address's private key
36
+ * @param address - The address of the signer to use
37
+ * @param typedData - The complete EIP-712 typed data structure (domain, types, primaryType, message)
38
+ * @returns signature for the specified address
39
+ * @throws Error if the address is not found in the keystore
40
+ */
41
+ signTypedDataWithAddress(address: EthAddress, typedData: TypedDataDefinition): Promise<Signature>;
42
+ /**
43
+ * Sign a message using eth_sign with all keystore private keys
44
+ *
45
+ * @param message - The message to sign
46
+ * @return signatures
47
+ */
48
+ signMessage(message: Buffer32): Promise<Signature[]>;
49
+ /**
50
+ * Sign a message using eth_sign with a specific address's private key
51
+ * @param address - The address of the signer to use
52
+ * @param message - The message to sign
53
+ * @returns signature for the specified address
54
+ * @throws Error if the address is not found in the keystore
55
+ */
56
+ signMessageWithAddress(address: EthAddress, message: Buffer32): Promise<Signature>;
27
57
  }
28
58
  //# sourceMappingURL=local_key_store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"local_key_store.d.ts","sourceRoot":"","sources":["../../src/key_store/local_key_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;GAIG;AACH,qBAAa,aAAc,YAAW,iBAAiB;IACrD,OAAO,CAAC,MAAM,CAAkB;gBAEpB,UAAU,EAAE,QAAQ;IAIhC;;;;OAIG;IACI,UAAU,IAAI,UAAU;IAI/B;;;;;OAKG;IACI,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAM1C,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CAK1D"}
1
+ {"version":3,"file":"local_key_store.d.ts","sourceRoot":"","sources":["../../src/key_store/local_key_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,KAAK,mBAAmB,EAAiB,MAAM,MAAM,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;GAIG;AACH,qBAAa,aAAc,YAAW,iBAAiB;IACrD,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,gBAAgB,CAAsC;gBAElD,WAAW,EAAE,QAAQ,EAAE;IAKnC;;;;;OAKG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAO5C;;;;OAIG;IACI,YAAY,IAAI,UAAU,EAAE;IAInC;;;;OAIG;IACI,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAK1E;;;;;;OAMG;IACI,wBAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IASxG;;;;;OAKG;IACI,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAI3D;;;;;;OAMG;IACI,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CAO1F"}
@@ -1,32 +1,79 @@
1
+ import { Buffer32 } from '@aztec/foundation/buffer';
1
2
  import { Secp256k1Signer } from '@aztec/foundation/crypto';
3
+ import { hashTypedData } from 'viem';
2
4
  /**
3
5
  * Local Key Store
4
6
  *
5
- * An implementation of the Key store using an in memory private key.
7
+ * An implementation of the Key store using in memory private keys.
6
8
  */ export class LocalKeyStore {
7
- signer;
8
- constructor(privateKey){
9
- this.signer = new Secp256k1Signer(privateKey);
9
+ signers;
10
+ signersByAddress;
11
+ constructor(privateKeys){
12
+ this.signers = privateKeys.map((privateKey)=>new Secp256k1Signer(privateKey));
13
+ this.signersByAddress = new Map(this.signers.map((signer)=>[
14
+ signer.address.toString(),
15
+ signer
16
+ ]));
10
17
  }
11
18
  /**
12
- * Get the address of the signer
19
+ * Get the address of a signer by index
13
20
  *
21
+ * @param index - The index of the signer
14
22
  * @returns the address
15
- */ getAddress() {
16
- return this.signer.address;
23
+ */ getAddress(index) {
24
+ if (index >= this.signers.length) {
25
+ throw new Error(`Index ${index} is out of bounds.`);
26
+ }
27
+ return this.signers[index].address;
17
28
  }
18
29
  /**
19
- * Sign a message with the keystore private key
30
+ * Get the addresses of all signers
20
31
  *
21
- * @param messageBuffer - The message buffer to sign
32
+ * @returns the addresses
33
+ */ getAddresses() {
34
+ return this.signers.map((signer)=>signer.address);
35
+ }
36
+ /**
37
+ * Sign a message with all keystore private keys
38
+ * @param typedData - The complete EIP-712 typed data structure (domain, types, primaryType, message)
22
39
  * @return signature
23
- */ sign(digest) {
24
- const signature = this.signer.sign(digest);
25
- return Promise.resolve(signature);
40
+ */ signTypedData(typedData) {
41
+ const digest = hashTypedData(typedData);
42
+ return Promise.all(this.signers.map((signer)=>signer.sign(Buffer32.fromString(digest))));
43
+ }
44
+ /**
45
+ * Sign a message with a specific address's private key
46
+ * @param address - The address of the signer to use
47
+ * @param typedData - The complete EIP-712 typed data structure (domain, types, primaryType, message)
48
+ * @returns signature for the specified address
49
+ * @throws Error if the address is not found in the keystore
50
+ */ signTypedDataWithAddress(address, typedData) {
51
+ const signer = this.signersByAddress.get(address.toString());
52
+ if (!signer) {
53
+ throw new Error(`No signer found for address ${address.toString()}`);
54
+ }
55
+ const digest = hashTypedData(typedData);
56
+ return Promise.resolve(signer.sign(Buffer32.fromString(digest)));
26
57
  }
27
- signMessage(message) {
28
- // Sign message adds eth sign prefix and hashes before signing
29
- const signature = this.signer.signMessage(message);
30
- return Promise.resolve(signature);
58
+ /**
59
+ * Sign a message using eth_sign with all keystore private keys
60
+ *
61
+ * @param message - The message to sign
62
+ * @return signatures
63
+ */ signMessage(message) {
64
+ return Promise.all(this.signers.map((signer)=>signer.signMessage(message)));
65
+ }
66
+ /**
67
+ * Sign a message using eth_sign with a specific address's private key
68
+ * @param address - The address of the signer to use
69
+ * @param message - The message to sign
70
+ * @returns signature for the specified address
71
+ * @throws Error if the address is not found in the keystore
72
+ */ signMessageWithAddress(address, message) {
73
+ const signer = this.signersByAddress.get(address.toString());
74
+ if (!signer) {
75
+ throw new Error(`No signer found for address ${address.toString()}`);
76
+ }
77
+ return Promise.resolve(signer.signMessage(message));
31
78
  }
32
79
  }
@@ -0,0 +1,138 @@
1
+ import type { Buffer32 } from '@aztec/foundation/buffer';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import type { Signature } from '@aztec/foundation/eth-signature';
4
+ import { KeystoreManager } from '@aztec/node-keystore';
5
+ import type { EthRemoteSignerConfig } from '@aztec/node-keystore';
6
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
+ import type { TypedDataDefinition } from 'viem';
8
+ import type { ExtendedValidatorKeyStore } from './interface.js';
9
+ export declare class NodeKeystoreAdapter implements ExtendedValidatorKeyStore {
10
+ private readonly keystoreManager;
11
+ private readonly validators;
12
+ private readonly addressIndex;
13
+ private constructor();
14
+ /**
15
+ * Create an adapter from a keystore JSON file on disk.
16
+ * @param keystoreFilePath Absolute or relative path to a keystore JSON file
17
+ * @returns A configured NodeKeystoreAdapter instance
18
+ * @throws Error when the file fails schema validation or cannot be read
19
+ */
20
+ static fromKeystoreFile(keystoreFilePath: string): NodeKeystoreAdapter;
21
+ /**
22
+ * Create an adapter from an in-memory keystore-like object.
23
+ * Validates resolved duplicate attester addresses across validators and sources.
24
+ * @param keystoreConfig Parsed config object (typically result of loadKeystoreFile)
25
+ * @returns A configured NodeKeystoreAdapter instance
26
+ * @throws Error when resolved duplicate attester addresses are detected
27
+ */
28
+ static fromKeystoreConfig(keystoreConfig: unknown): NodeKeystoreAdapter;
29
+ /**
30
+ * Build an adapter directly from a list of validator private keys.
31
+ * Each key becomes a separate validator using the same key for attester and publisher,
32
+ * coinbase defaults to the derived EOA address, and feeRecipient is a 32-byte padded address.
33
+ * Note: Fee recipient is a temporary placeholder, replace with actual fee recipient when implemented.
34
+ */
35
+ static fromPrivateKeys(privateKeys: string[]): NodeKeystoreAdapter;
36
+ /**
37
+ * Build an adapter for a Web3Signer setup by providing the signer URL and the EOA addresses.
38
+ * Each address becomes a separate validator; attester and publisher point to the same remote signer entry.
39
+ * Note: Fee recipient is a temporary placeholder, replace with actual fee recipient when implemented.
40
+ */
41
+ static fromWeb3Signer(web3SignerUrl: string, addresses: EthAddress[]): NodeKeystoreAdapter;
42
+ static fromKeyStoreManager(manager: KeystoreManager): NodeKeystoreAdapter;
43
+ /**
44
+ * Normalize address keys to lowercase hex strings for map/set usage.
45
+ */
46
+ private static key;
47
+ /**
48
+ * Ensure per-validator signer cache exists; build it by creating
49
+ * attester/publisher signers and populating indices when missing.
50
+ * @param validatorIndex Index of the validator in the keystore
51
+ * @returns The cached validator entry
52
+ */
53
+ private ensureValidator;
54
+ /**
55
+ * Iterate all validator indices in the keystore manager.
56
+ */
57
+ private validatorIndices;
58
+ /**
59
+ * Find the validator index that contains the given attester address.
60
+ * @param attesterAddress Address to locate
61
+ * @returns Validator index
62
+ * @throws Error when no validator contains the attester
63
+ */
64
+ private findValidatorIndexForAttester;
65
+ /**
66
+ * Get attester address by flat index across all validators' attester sets.
67
+ * @param index Zero-based flat index across all attesters
68
+ * @returns EthAddress for the indexed attester
69
+ * @throws Error when index is out of bounds
70
+ */
71
+ getAddress(index: number): EthAddress;
72
+ /**
73
+ * Get all attester addresses across validators (legacy-compatible view).
74
+ */
75
+ getAddresses(): EthAddress[];
76
+ /**
77
+ * Sign typed data with all attester signers across validators.
78
+ * @param typedData EIP-712 typed data
79
+ * @returns Array of signatures in validator order, flattened
80
+ */
81
+ signTypedData(typedData: TypedDataDefinition): Promise<Signature[]>;
82
+ /**
83
+ * Sign a message with all attester signers across validators.
84
+ * @param message 32-byte message (already hashed/padded as needed)
85
+ * @returns Array of signatures in validator order, flattened
86
+ */
87
+ signMessage(message: Buffer32): Promise<Signature[]>;
88
+ /**
89
+ * Sign typed data with a signer identified by address (any role).
90
+ * Hydrates caches on-demand when the address is first seen.
91
+ * @param address Address to sign with
92
+ * @param typedData EIP-712 typed data
93
+ * @returns Signature from the signer matching the address
94
+ * @throws Error when no signer exists for the address
95
+ */
96
+ signTypedDataWithAddress(address: EthAddress, typedData: TypedDataDefinition): Promise<Signature>;
97
+ /**
98
+ * Sign a message with a signer identified by address (any role).
99
+ * Hydrates caches on-demand when the address is first seen.
100
+ * @param address Address to sign with
101
+ * @param message 32-byte message
102
+ * @returns Signature from the signer matching the address
103
+ * @throws Error when no signer exists for the address
104
+ */
105
+ signMessageWithAddress(address: EthAddress, message: Buffer32): Promise<Signature>;
106
+ /**
107
+ * Get all attester addresses across validators (alias of getAddresses).
108
+ */
109
+ getAttesterAddresses(): EthAddress[];
110
+ /**
111
+ * Get the effective coinbase address for the validator that contains the given attester.
112
+ * @param attesterAddress Address of an attester belonging to the validator
113
+ * @returns Coinbase EthAddress
114
+ */
115
+ getCoinbaseAddress(attesterAddress: EthAddress): EthAddress;
116
+ /**
117
+ * Get the publisher addresses for the validator that contains the given attester.
118
+ * @param attesterAddress Address of an attester belonging to the validator
119
+ * @returns Array of publisher addresses
120
+ */
121
+ getPublisherAddresses(attesterAddress: EthAddress): EthAddress[];
122
+ getAttestorForPublisher(publisherAddress: EthAddress): EthAddress;
123
+ /**
124
+ * Get the fee recipient for the validator that contains the given attester.
125
+ * @param attesterAddress Address of an attester belonging to the validator
126
+ * @returns Fee recipient as AztecAddress
127
+ */
128
+ getFeeRecipient(attesterAddress: EthAddress): AztecAddress;
129
+ /**
130
+ * Get the effective remote signer configuration for the attester.
131
+ * Precedence: account-level override > validator-level override > file-level default.
132
+ * Returns undefined for local signers (private key / JSON-V3 / mnemonic).
133
+ * @param attesterAddress Address of an attester belonging to the validator
134
+ * @returns Effective remote signer configuration or undefined
135
+ */
136
+ getRemoteSignerConfig(attesterAddress: EthAddress): EthRemoteSignerConfig | undefined;
137
+ }
138
+ //# sourceMappingURL=node_keystore_adap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