@aztec/accounts 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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.
- package/README.md +1 -1
- package/artifacts/EcdsaKAccount.json +3200 -3634
- package/artifacts/EcdsaRAccount.json +3200 -3634
- package/artifacts/SchnorrAccount.json +3215 -3822
- package/artifacts/SchnorrSingleKeyAccount.json +2555 -2634
- package/artifacts/SimulatedAccount.json +2108 -2330
- package/dest/defaults/account_contract.d.ts +4 -4
- package/dest/defaults/account_contract.d.ts.map +1 -1
- package/dest/defaults/account_contract.js +2 -2
- package/dest/defaults/account_interface.d.ts +8 -8
- package/dest/defaults/account_interface.d.ts.map +1 -1
- package/dest/defaults/account_interface.js +6 -7
- package/dest/defaults/index.d.ts +2 -2
- package/dest/defaults/index.js +1 -1
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts +1 -1
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_k/account_contract.js +1 -1
- package/dest/ecdsa/ecdsa_k/index.d.ts +1 -23
- package/dest/ecdsa/ecdsa_k/index.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_k/index.js +1 -22
- package/dest/ecdsa/ecdsa_k/lazy.d.ts +1 -23
- package/dest/ecdsa/ecdsa_k/lazy.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_k/lazy.js +5 -26
- package/dest/ecdsa/ecdsa_r/account_contract.d.ts +1 -1
- package/dest/ecdsa/ecdsa_r/account_contract.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_r/account_contract.js +1 -1
- package/dest/ecdsa/ecdsa_r/index.d.ts +1 -23
- package/dest/ecdsa/ecdsa_r/index.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_r/index.js +1 -22
- package/dest/ecdsa/ecdsa_r/lazy.d.ts +1 -23
- package/dest/ecdsa/ecdsa_r/lazy.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_r/lazy.js +5 -26
- package/dest/ecdsa/index.d.ts +1 -1
- package/dest/ecdsa/lazy.d.ts +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts.map +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/index.d.ts +2 -24
- package/dest/ecdsa/ssh_ecdsa_r/index.d.ts.map +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/index.js +3 -24
- package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts +2 -24
- package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts.map +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/lazy.js +3 -24
- package/dest/schnorr/account_contract.d.ts +3 -2
- package/dest/schnorr/account_contract.d.ts.map +1 -1
- package/dest/schnorr/account_contract.js +1 -1
- package/dest/schnorr/index.d.ts +4 -38
- package/dest/schnorr/index.d.ts.map +1 -1
- package/dest/schnorr/index.js +1 -32
- package/dest/schnorr/lazy.d.ts +4 -38
- package/dest/schnorr/lazy.d.ts.map +1 -1
- package/dest/schnorr/lazy.js +5 -36
- package/dest/single_key/account_contract.d.ts +2 -2
- package/dest/single_key/account_contract.d.ts.map +1 -1
- package/dest/single_key/account_contract.js +1 -1
- package/dest/single_key/index.d.ts +2 -21
- package/dest/single_key/index.d.ts.map +1 -1
- package/dest/single_key/index.js +1 -23
- package/dest/single_key/lazy.d.ts +2 -21
- package/dest/single_key/lazy.d.ts.map +1 -1
- package/dest/single_key/lazy.js +5 -27
- package/dest/stub/account_contract.d.ts +29 -0
- package/dest/stub/account_contract.d.ts.map +1 -0
- package/dest/stub/account_contract.js +30 -0
- package/dest/stub/index.d.ts +21 -0
- package/dest/stub/index.d.ts.map +1 -0
- package/dest/stub/index.js +29 -0
- package/dest/stub/lazy.d.ts +23 -0
- package/dest/stub/lazy.d.ts.map +1 -0
- package/dest/stub/lazy.js +35 -0
- package/dest/testing/configuration.d.ts +5 -4
- package/dest/testing/configuration.d.ts.map +1 -1
- package/dest/testing/configuration.js +1 -1
- package/dest/testing/index.d.ts +6 -36
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +19 -35
- package/dest/testing/lazy.d.ts +5 -28
- package/dest/testing/lazy.d.ts.map +1 -1
- package/dest/testing/lazy.js +19 -30
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/ssh_agent.d.ts +1 -1
- package/package.json +13 -10
- package/src/defaults/account_contract.ts +4 -4
- package/src/defaults/account_interface.ts +13 -14
- package/src/defaults/index.ts +1 -1
- package/src/ecdsa/ecdsa_k/account_contract.ts +2 -2
- package/src/ecdsa/ecdsa_k/index.ts +0 -32
- package/src/ecdsa/ecdsa_k/lazy.ts +4 -36
- package/src/ecdsa/ecdsa_r/account_contract.ts +2 -2
- package/src/ecdsa/ecdsa_r/index.ts +0 -32
- package/src/ecdsa/ecdsa_r/lazy.ts +4 -36
- package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +2 -2
- package/src/ecdsa/ssh_ecdsa_r/index.ts +2 -35
- package/src/ecdsa/ssh_ecdsa_r/lazy.ts +2 -35
- package/src/schnorr/account_contract.ts +3 -2
- package/src/schnorr/index.ts +9 -56
- package/src/schnorr/lazy.ts +13 -60
- package/src/single_key/account_contract.ts +3 -2
- package/src/single_key/index.ts +1 -32
- package/src/single_key/lazy.ts +5 -36
- package/src/stub/account_contract.ts +39 -0
- package/src/stub/index.ts +41 -0
- package/src/stub/lazy.ts +49 -0
- package/src/testing/configuration.ts +2 -1
- package/src/testing/index.ts +20 -57
- package/src/testing/lazy.ts +18 -50
- package/dest/copy_cat/base.d.ts +0 -18
- package/dest/copy_cat/base.d.ts.map +0 -1
- package/dest/copy_cat/base.js +0 -28
- package/dest/copy_cat/index.d.ts +0 -10
- package/dest/copy_cat/index.d.ts.map +0 -1
- package/dest/copy_cat/index.js +0 -31
- package/dest/copy_cat/lazy.d.ts +0 -9
- package/dest/copy_cat/lazy.d.ts.map +0 -1
- package/dest/copy_cat/lazy.js +0 -29
- package/dest/testing/create_account.d.ts +0 -43
- package/dest/testing/create_account.d.ts.map +0 -1
- package/dest/testing/create_account.js +0 -61
- package/src/copy_cat/base.ts +0 -47
- package/src/copy_cat/index.ts +0 -44
- package/src/copy_cat/lazy.ts +0 -40
- package/src/testing/create_account.ts +0 -111
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { Ecdsa } from '@aztec/foundation/crypto';
|
|
3
|
-
import type { Fr } from '@aztec/foundation/
|
|
2
|
+
import { Ecdsa } from '@aztec/foundation/crypto/ecdsa';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
5
|
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
6
|
|
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
8
|
-
import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
10
7
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
8
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
12
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
14
9
|
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
15
10
|
|
|
16
11
|
import EcdsaKAccountContractJson from '../../../artifacts/EcdsaKAccount.json' with { type: 'json' };
|
|
@@ -34,30 +29,3 @@ export class EcdsaKAccountContract extends EcdsaKBaseAccountContract {
|
|
|
34
29
|
return Promise.resolve(EcdsaKAccountContractArtifact);
|
|
35
30
|
}
|
|
36
31
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Creates an Account that relies on an ECDSA signing key for authentication.
|
|
39
|
-
* @param pxe - An PXE server instance.
|
|
40
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
41
|
-
* @param signingPrivateKey - Secp256k1 key used for signing transactions.
|
|
42
|
-
* @param salt - Deployment salt.
|
|
43
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
44
|
-
*/
|
|
45
|
-
export function getEcdsaKAccount(
|
|
46
|
-
pxe: PXE,
|
|
47
|
-
secretKey: Fr,
|
|
48
|
-
signingPrivateKey: Buffer,
|
|
49
|
-
salt?: Salt,
|
|
50
|
-
): Promise<AccountManager> {
|
|
51
|
-
return AccountManager.create(pxe, secretKey, new EcdsaKAccountContract(signingPrivateKey), salt);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Gets a wallet for an already registered account using ECDSA signatures.
|
|
56
|
-
* @param pxe - An PXE server instance.
|
|
57
|
-
* @param address - Address for the account.
|
|
58
|
-
* @param signingPrivateKey - ECDSA key used for signing transactions.
|
|
59
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
60
|
-
*/
|
|
61
|
-
export function getEcdsaKWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: Buffer): Promise<AccountWallet> {
|
|
62
|
-
return getWallet(pxe, address, new EcdsaKAccountContract(signingPrivateKey));
|
|
63
|
-
}
|
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
8
|
-
import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
10
7
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
8
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
12
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
14
9
|
|
|
15
10
|
import { EcdsaKBaseAccountContract } from './account_contract.js';
|
|
16
11
|
|
|
@@ -19,10 +14,10 @@ import { EcdsaKBaseAccountContract } from './account_contract.js';
|
|
|
19
14
|
* @returns The contract artifact for the ecdsa K account contract
|
|
20
15
|
*/
|
|
21
16
|
export async function getEcdsaKAccountContractArtifact() {
|
|
22
|
-
// Cannot assert this import as it's incompatible with
|
|
23
|
-
// https://
|
|
24
|
-
//
|
|
25
|
-
//
|
|
17
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
18
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
19
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
20
|
+
// "text/javascript"
|
|
26
21
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
27
22
|
const { default: ecdsaKAccountContractJson } = await import('../../../artifacts/EcdsaKAccount.json');
|
|
28
23
|
return loadContractArtifact(ecdsaKAccountContractJson);
|
|
@@ -42,30 +37,3 @@ export class EcdsaKAccountContract extends EcdsaKBaseAccountContract {
|
|
|
42
37
|
return getEcdsaKAccountContractArtifact();
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Creates an Account that relies on an ECDSA signing key for authentication.
|
|
47
|
-
* @param pxe - An PXE server instance.
|
|
48
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
49
|
-
* @param signingPrivateKey - Secp256k1 key used for signing transactions.
|
|
50
|
-
* @param salt - Deployment salt.
|
|
51
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
52
|
-
*/
|
|
53
|
-
export function getEcdsaKAccount(
|
|
54
|
-
pxe: PXE,
|
|
55
|
-
secretKey: Fr,
|
|
56
|
-
signingPrivateKey: Buffer,
|
|
57
|
-
salt?: Salt,
|
|
58
|
-
): Promise<AccountManager> {
|
|
59
|
-
return AccountManager.create(pxe, secretKey, new EcdsaKAccountContract(signingPrivateKey), salt);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Gets a wallet for an already registered account using ECDSA signatures.
|
|
64
|
-
* @param pxe - An PXE server instance.
|
|
65
|
-
* @param address - Address for the account.
|
|
66
|
-
* @param signingPrivateKey - ECDSA key used for signing transactions.
|
|
67
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
68
|
-
*/
|
|
69
|
-
export function getEcdsaKWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: Buffer): Promise<AccountWallet> {
|
|
70
|
-
return getWallet(pxe, address, new EcdsaKAccountContract(signingPrivateKey));
|
|
71
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { Ecdsa } from '@aztec/foundation/crypto';
|
|
3
|
-
import type { Fr } from '@aztec/foundation/
|
|
2
|
+
import { Ecdsa } from '@aztec/foundation/crypto/ecdsa';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
5
|
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
6
|
|
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
8
|
-
import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
10
7
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
8
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
12
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
14
9
|
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
15
10
|
|
|
16
11
|
import EcdsaRAccountContractJson from '../../../artifacts/EcdsaRAccount.json' with { type: 'json' };
|
|
@@ -34,30 +29,3 @@ export class EcdsaRAccountContract extends EcdsaRBaseAccountContract {
|
|
|
34
29
|
return Promise.resolve(EcdsaRAccountContractArtifact);
|
|
35
30
|
}
|
|
36
31
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Creates an Account that relies on an ECDSA signing key for authentication.
|
|
39
|
-
* @param pxe - An PXE server instance.
|
|
40
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
41
|
-
* @param signingPrivateKey - Secp256k1 key used for signing transactions.
|
|
42
|
-
* @param salt - Deployment salt.
|
|
43
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
44
|
-
*/
|
|
45
|
-
export function getEcdsaRAccount(
|
|
46
|
-
pxe: PXE,
|
|
47
|
-
secretKey: Fr,
|
|
48
|
-
signingPrivateKey: Buffer,
|
|
49
|
-
salt?: Salt,
|
|
50
|
-
): Promise<AccountManager> {
|
|
51
|
-
return AccountManager.create(pxe, secretKey, new EcdsaRAccountContract(signingPrivateKey), salt);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Gets a wallet for an already registered account using ECDSA signatures.
|
|
56
|
-
* @param pxe - An PXE server instance.
|
|
57
|
-
* @param address - Address for the account.
|
|
58
|
-
* @param signingPrivateKey - ECDSA key used for signing transactions.
|
|
59
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
60
|
-
*/
|
|
61
|
-
export function getEcdsaRWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: Buffer): Promise<AccountWallet> {
|
|
62
|
-
return getWallet(pxe, address, new EcdsaRAccountContract(signingPrivateKey));
|
|
63
|
-
}
|
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
8
|
-
import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
10
7
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
8
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
12
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
14
9
|
|
|
15
10
|
import { EcdsaRBaseAccountContract } from './account_contract.js';
|
|
16
11
|
|
|
@@ -19,10 +14,10 @@ import { EcdsaRBaseAccountContract } from './account_contract.js';
|
|
|
19
14
|
* @returns The contract artifact for the ecdsa K account contract
|
|
20
15
|
*/
|
|
21
16
|
export async function getEcdsaRAccountContractArtifact() {
|
|
22
|
-
// Cannot assert this import as it's incompatible with
|
|
23
|
-
// https://
|
|
24
|
-
//
|
|
25
|
-
//
|
|
17
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
18
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
19
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
20
|
+
// "text/javascript"
|
|
26
21
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
27
22
|
const { default: ecdsaKAccountContractJson } = await import('../../../artifacts/EcdsaRAccount.json');
|
|
28
23
|
return loadContractArtifact(ecdsaKAccountContractJson);
|
|
@@ -42,30 +37,3 @@ export class EcdsaRAccountContract extends EcdsaRBaseAccountContract {
|
|
|
42
37
|
return getEcdsaRAccountContractArtifact();
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Creates an Account that relies on an ECDSA signing key for authentication.
|
|
47
|
-
* @param pxe - An PXE server instance.
|
|
48
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
49
|
-
* @param signingPrivateKey - Secp256k1 key used for signing transactions.
|
|
50
|
-
* @param salt - Deployment salt.
|
|
51
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
52
|
-
*/
|
|
53
|
-
export function getEcdsaRAccount(
|
|
54
|
-
pxe: PXE,
|
|
55
|
-
secretKey: Fr,
|
|
56
|
-
signingPrivateKey: Buffer,
|
|
57
|
-
salt?: Salt,
|
|
58
|
-
): Promise<AccountManager> {
|
|
59
|
-
return AccountManager.create(pxe, secretKey, new EcdsaRAccountContract(signingPrivateKey), salt);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Gets a wallet for an already registered account using ECDSA signatures.
|
|
64
|
-
* @param pxe - An PXE server instance.
|
|
65
|
-
* @param address - Address for the account.
|
|
66
|
-
* @param signingPrivateKey - ECDSA key used for signing transactions.
|
|
67
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
68
|
-
*/
|
|
69
|
-
export function getEcdsaRWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: Buffer): Promise<AccountWallet> {
|
|
70
|
-
return getWallet(pxe, address, new EcdsaRAccountContract(signingPrivateKey));
|
|
71
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { EcdsaSignature } from '@aztec/foundation/crypto';
|
|
3
|
-
import type { Fr } from '@aztec/foundation/
|
|
2
|
+
import { EcdsaSignature } from '@aztec/foundation/crypto/ecdsa';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
5
|
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
6
|
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
8
|
-
import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
10
7
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
13
8
|
|
|
14
9
|
import { EcdsaRAccountContractArtifact } from '../ecdsa_r/index.js';
|
|
15
10
|
import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
@@ -23,39 +18,11 @@ import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
|
23
18
|
* Eagerly loads the contract artifact
|
|
24
19
|
*/
|
|
25
20
|
export class EcdsaRSSHAccountContract extends EcdsaRSSHBaseAccountContract {
|
|
26
|
-
constructor(
|
|
27
|
-
super(
|
|
21
|
+
constructor(signingPublicKey: Buffer) {
|
|
22
|
+
super(signingPublicKey);
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
override getContractArtifact(): Promise<ContractArtifact> {
|
|
31
26
|
return Promise.resolve(EcdsaRAccountContractArtifact);
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Creates an Account that relies on an ECDSA signing key for authentication.
|
|
37
|
-
* @param pxe - An PXE server instance.
|
|
38
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
39
|
-
* @param signingPublicKey - Secp2561 key used to identify its corresponding private key in the SSH Agent.
|
|
40
|
-
* @param salt - Deployment salt.
|
|
41
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
42
|
-
*/
|
|
43
|
-
export function getEcdsaRSSHAccount(
|
|
44
|
-
pxe: PXE,
|
|
45
|
-
secretKey: Fr,
|
|
46
|
-
signingPublicKey: Buffer,
|
|
47
|
-
salt?: Salt,
|
|
48
|
-
): Promise<AccountManager> {
|
|
49
|
-
return AccountManager.create(pxe, secretKey, new EcdsaRSSHAccountContract(signingPublicKey), salt);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Gets a wallet for an already registered account using ECDSA signatures.
|
|
54
|
-
* @param pxe - An PXE server instance.
|
|
55
|
-
* @param address - Address for the account.
|
|
56
|
-
* @param signingPrivateKey - ECDSA key used for signing transactions.
|
|
57
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
58
|
-
*/
|
|
59
|
-
export function getEcdsaRSSHWallet(pxe: PXE, address: AztecAddress, signingPublicKey: Buffer): Promise<AccountWallet> {
|
|
60
|
-
return getWallet(pxe, address, new EcdsaRSSHAccountContract(signingPublicKey));
|
|
61
|
-
}
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
8
|
-
import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
10
7
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
13
8
|
|
|
14
9
|
import { getEcdsaRAccountContractArtifact } from '../ecdsa_r/lazy.js';
|
|
15
10
|
import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
@@ -23,39 +18,11 @@ import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
|
23
18
|
* Lazily loads the contract artifact
|
|
24
19
|
*/
|
|
25
20
|
export class EcdsaRSSHAccountContract extends EcdsaRSSHBaseAccountContract {
|
|
26
|
-
constructor(
|
|
27
|
-
super(
|
|
21
|
+
constructor(signingPublicKey: Buffer) {
|
|
22
|
+
super(signingPublicKey);
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
override getContractArtifact(): Promise<ContractArtifact> {
|
|
31
26
|
return getEcdsaRAccountContractArtifact();
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Creates an Account that relies on an ECDSA signing key for authentication.
|
|
37
|
-
* @param pxe - An PXE server instance.
|
|
38
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
39
|
-
* @param signingPublicKey - Secp2561 key used to identify its corresponding private key in the SSH Agent.
|
|
40
|
-
* @param salt - Deployment salt.
|
|
41
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
42
|
-
*/
|
|
43
|
-
export function getEcdsaRSSHAccount(
|
|
44
|
-
pxe: PXE,
|
|
45
|
-
secretKey: Fr,
|
|
46
|
-
signingPublicKey: Buffer,
|
|
47
|
-
salt?: Salt,
|
|
48
|
-
): Promise<AccountManager> {
|
|
49
|
-
return AccountManager.create(pxe, secretKey, new EcdsaRSSHAccountContract(signingPublicKey), salt);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Gets a wallet for an already registered account using ECDSA signatures.
|
|
54
|
-
* @param pxe - An PXE server instance.
|
|
55
|
-
* @param address - Address for the account.
|
|
56
|
-
* @param signingPrivateKey - ECDSA key used for signing transactions.
|
|
57
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
58
|
-
*/
|
|
59
|
-
export function getEcdsaRSSHWallet(pxe: PXE, address: AztecAddress, signingPublicKey: Buffer): Promise<AccountWallet> {
|
|
60
|
-
return getWallet(pxe, address, new EcdsaRSSHAccountContract(signingPublicKey));
|
|
61
|
-
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { Schnorr } from '@aztec/foundation/crypto';
|
|
3
|
-
import { Fr
|
|
2
|
+
import { Schnorr } from '@aztec/foundation/crypto/schnorr';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
4
5
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
6
|
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
7
|
|
package/src/schnorr/index.ts
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { Fr
|
|
7
|
+
import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
8
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
9
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
10
11
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
12
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
12
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
14
13
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
15
14
|
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
16
15
|
|
|
@@ -34,63 +33,17 @@ export class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
/**
|
|
38
|
-
* Creates an Account Manager that relies on a Grumpkin signing key for authentication.
|
|
39
|
-
* @param pxe - An PXE server instance.
|
|
40
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
41
|
-
* @param signingPrivateKey - Grumpkin key used for signing transactions.
|
|
42
|
-
* @param salt - Deployment salt.
|
|
43
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
44
|
-
*/
|
|
45
|
-
export function getSchnorrAccount(
|
|
46
|
-
pxe: PXE,
|
|
47
|
-
secretKey: Fr,
|
|
48
|
-
signingPrivateKey: GrumpkinScalar,
|
|
49
|
-
salt?: Salt,
|
|
50
|
-
): Promise<AccountManager> {
|
|
51
|
-
return AccountManager.create(pxe, secretKey, new SchnorrAccountContract(signingPrivateKey), salt);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Gets a wallet for an already registered account using Schnorr signatures.
|
|
56
|
-
* @param pxe - An PXE server instance.
|
|
57
|
-
* @param address - Address for the account.
|
|
58
|
-
* @param signingPrivateKey - Grumpkin key used for signing transactions.
|
|
59
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
60
|
-
*/
|
|
61
|
-
export function getSchnorrWallet(
|
|
62
|
-
pxe: PXE,
|
|
63
|
-
address: AztecAddress,
|
|
64
|
-
signingPrivateKey: GrumpkinScalar,
|
|
65
|
-
): Promise<AccountWallet> {
|
|
66
|
-
return getWallet(pxe, address, new SchnorrAccountContract(signingPrivateKey));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Gets a wallet for an already registered account using Schnorr signatures.
|
|
71
|
-
* @param pxe - An PXE server instance.
|
|
72
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
73
|
-
* @param signingPrivateKey - Grumpkin key used for signing transactions.
|
|
74
|
-
* @param salt - Deployment salt.
|
|
75
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
76
|
-
*/
|
|
77
|
-
export async function getSchnorrWalletWithSecretKey(
|
|
78
|
-
pxe: PXE,
|
|
79
|
-
secretKey: Fr,
|
|
80
|
-
signingPrivateKey: GrumpkinScalar,
|
|
81
|
-
salt: Salt,
|
|
82
|
-
): Promise<AccountWalletWithSecretKey> {
|
|
83
|
-
const account = await getSchnorrAccount(pxe, secretKey, signingPrivateKey, salt);
|
|
84
|
-
return account.getWallet();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
36
|
/**
|
|
88
37
|
* Compute the address of a schnorr account contract.
|
|
89
38
|
* @param secret - A seed for deriving the signing key and public keys.
|
|
90
39
|
* @param salt - The contract address salt.
|
|
91
40
|
* @param signingPrivateKey - A specific signing private key that's not derived from the secret.
|
|
92
41
|
*/
|
|
93
|
-
export async function getSchnorrAccountContractAddress(
|
|
42
|
+
export async function getSchnorrAccountContractAddress(
|
|
43
|
+
secret: Fr,
|
|
44
|
+
salt: Fr,
|
|
45
|
+
signingPrivateKey?: GrumpkinScalar,
|
|
46
|
+
): Promise<AztecAddress> {
|
|
94
47
|
const signingKey = signingPrivateKey ?? deriveSigningKey(secret);
|
|
95
48
|
const accountContract = new SchnorrAccountContract(signingKey);
|
|
96
49
|
return await getAccountContractAddress(accountContract, secret, salt);
|
package/src/schnorr/lazy.ts
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
8
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
9
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
10
10
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
11
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
12
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
12
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
13
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
15
14
|
|
|
16
15
|
import { SchnorrBaseAccountContract } from './account_contract.js';
|
|
@@ -20,10 +19,10 @@ import { SchnorrBaseAccountContract } from './account_contract.js';
|
|
|
20
19
|
* @returns The contract artifact for the schnorr account contract
|
|
21
20
|
*/
|
|
22
21
|
export async function getSchnorrAccountContractArtifact() {
|
|
23
|
-
// Cannot assert this import as it's incompatible with
|
|
24
|
-
// https://
|
|
25
|
-
//
|
|
26
|
-
//
|
|
22
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
23
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
24
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
25
|
+
// "text/javascript"
|
|
27
26
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
28
27
|
const { default: schnorrAccountContractJson } = await import('../../artifacts/SchnorrAccount.json');
|
|
29
28
|
return loadContractArtifact(schnorrAccountContractJson);
|
|
@@ -44,63 +43,17 @@ export class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
/**
|
|
48
|
-
* Creates an Account Manager that relies on a Grumpkin signing key for authentication.
|
|
49
|
-
* @param pxe - An PXE server instance.
|
|
50
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
51
|
-
* @param signingPrivateKey - Grumpkin key used for signing transactions.
|
|
52
|
-
* @param salt - Deployment salt.
|
|
53
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
54
|
-
*/
|
|
55
|
-
export function getSchnorrAccount(
|
|
56
|
-
pxe: PXE,
|
|
57
|
-
secretKey: Fr,
|
|
58
|
-
signingPrivateKey: GrumpkinScalar,
|
|
59
|
-
salt?: Salt,
|
|
60
|
-
): Promise<AccountManager> {
|
|
61
|
-
return AccountManager.create(pxe, secretKey, new SchnorrAccountContract(signingPrivateKey), salt);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Gets a wallet for an already registered account using Schnorr signatures.
|
|
66
|
-
* @param pxe - An PXE server instance.
|
|
67
|
-
* @param address - Address for the account.
|
|
68
|
-
* @param signingPrivateKey - Grumpkin key used for signing transactions.
|
|
69
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
70
|
-
*/
|
|
71
|
-
export function getSchnorrWallet(
|
|
72
|
-
pxe: PXE,
|
|
73
|
-
address: AztecAddress,
|
|
74
|
-
signingPrivateKey: GrumpkinScalar,
|
|
75
|
-
): Promise<AccountWallet> {
|
|
76
|
-
return getWallet(pxe, address, new SchnorrAccountContract(signingPrivateKey));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Gets a wallet for an already registered account using Schnorr signatures.
|
|
81
|
-
* @param pxe - An PXE server instance.
|
|
82
|
-
* @param secretKey - Secret key used to derive all the keystore keys.
|
|
83
|
-
* @param signingPrivateKey - Grumpkin key used for signing transactions.
|
|
84
|
-
* @param salt - Deployment salt.
|
|
85
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
86
|
-
*/
|
|
87
|
-
export async function getSchnorrWalletWithSecretKey(
|
|
88
|
-
pxe: PXE,
|
|
89
|
-
secretKey: Fr,
|
|
90
|
-
signingPrivateKey: GrumpkinScalar,
|
|
91
|
-
salt: Salt,
|
|
92
|
-
): Promise<AccountWalletWithSecretKey> {
|
|
93
|
-
const account = await getSchnorrAccount(pxe, secretKey, signingPrivateKey, salt);
|
|
94
|
-
return account.getWallet();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
46
|
/**
|
|
98
47
|
* Compute the address of a schnorr account contract.
|
|
99
48
|
* @param secret - A seed for deriving the signing key and public keys.
|
|
100
49
|
* @param salt - The contract address salt.
|
|
101
50
|
* @param signingPrivateKey - A specific signing private key that's not derived from the secret.
|
|
102
51
|
*/
|
|
103
|
-
export async function getSchnorrAccountContractAddress(
|
|
52
|
+
export async function getSchnorrAccountContractAddress(
|
|
53
|
+
secret: Fr,
|
|
54
|
+
salt: Fr,
|
|
55
|
+
signingPrivateKey?: GrumpkinScalar,
|
|
56
|
+
): Promise<AztecAddress> {
|
|
104
57
|
const signingKey = signingPrivateKey ?? deriveSigningKey(secret);
|
|
105
58
|
const accountContract = new SchnorrAccountContract(signingKey);
|
|
106
59
|
return await getAccountContractAddress(accountContract, secret, salt);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { Schnorr } from '@aztec/foundation/crypto';
|
|
3
|
-
import {
|
|
2
|
+
import { Schnorr } from '@aztec/foundation/crypto/schnorr';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
4
5
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
6
|
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
7
|
|
package/src/single_key/index.ts
CHANGED
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
8
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
9
|
-
import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
|
|
7
|
+
import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
10
8
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
9
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
12
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
13
|
-
import { deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
|
|
14
10
|
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
15
11
|
|
|
16
12
|
import SchnorrSingleKeyAccountContractJson from '../../artifacts/SchnorrSingleKeyAccount.json' with { type: 'json' };
|
|
@@ -34,30 +30,3 @@ export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
|
34
30
|
return Promise.resolve(SchnorrSingleKeyAccountContractArtifact);
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Creates an Account that uses the same Grumpkin key for encryption and authentication.
|
|
40
|
-
* @param pxe - An PXE server instance.
|
|
41
|
-
* @param secretKey - Secret key used to derive all the keystore keys (in this case also used to get signing key).
|
|
42
|
-
* @param salt - Deployment salt.
|
|
43
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
44
|
-
*/
|
|
45
|
-
export function getUnsafeSchnorrAccount(pxe: PXE, secretKey: Fr, salt?: Salt) {
|
|
46
|
-
const encryptionPrivateKey = deriveMasterIncomingViewingSecretKey(secretKey);
|
|
47
|
-
return AccountManager.create(pxe, secretKey, new SingleKeyAccountContract(encryptionPrivateKey), salt);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Gets a wallet for an already registered account using Schnorr signatures with a single key for encryption and authentication.
|
|
52
|
-
* @param pxe - An PXE server instance.
|
|
53
|
-
* @param address - Address for the account.
|
|
54
|
-
* @param signingPrivateKey - Grumpkin key used for note encryption and signing transactions.
|
|
55
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
56
|
-
*/
|
|
57
|
-
export function getUnsafeSchnorrWallet(
|
|
58
|
-
pxe: PXE,
|
|
59
|
-
address: AztecAddress,
|
|
60
|
-
signingPrivateKey: GrumpkinScalar,
|
|
61
|
-
): Promise<AccountWallet> {
|
|
62
|
-
return getWallet(pxe, address, new SingleKeyAccountContract(signingPrivateKey));
|
|
63
|
-
}
|