@aztec/accounts 0.0.0-test.0 → 0.0.1-commit.001888fc
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 -2
- package/artifacts/EcdsaKAccount.json +4753 -3882
- package/artifacts/EcdsaRAccount.json +5162 -4291
- package/artifacts/SchnorrAccount.json +5021 -4164
- package/artifacts/SimulatedAccount.json +4745 -0
- package/dest/defaults/account_contract.d.ts +10 -5
- package/dest/defaults/account_contract.d.ts.map +1 -1
- package/dest/defaults/account_contract.js +5 -3
- package/dest/defaults/index.d.ts +2 -3
- package/dest/defaults/index.d.ts.map +1 -1
- package/dest/defaults/index.js +2 -3
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts +5 -4
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_k/account_contract.js +9 -6
- package/dest/ecdsa/ecdsa_k/index.d.ts +1 -25
- package/dest/ecdsa/ecdsa_k/index.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_k/index.js +2 -23
- package/dest/ecdsa/ecdsa_k/lazy.d.ts +1 -25
- 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 +19 -0
- package/dest/ecdsa/ecdsa_r/account_contract.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_r/account_contract.js +41 -0
- package/dest/ecdsa/ecdsa_r/index.d.ts +19 -0
- package/dest/ecdsa/ecdsa_r/index.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_r/index.js +23 -0
- package/dest/ecdsa/ecdsa_r/lazy.d.ts +23 -0
- package/dest/ecdsa/ecdsa_r/lazy.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_r/lazy.js +31 -0
- package/dest/ecdsa/index.d.ts +2 -1
- package/dest/ecdsa/index.d.ts.map +1 -1
- package/dest/ecdsa/index.js +1 -0
- package/dest/ecdsa/lazy.d.ts +2 -1
- package/dest/ecdsa/lazy.d.ts.map +1 -1
- package/dest/ecdsa/lazy.js +1 -0
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +5 -4
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts.map +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +9 -6
- package/dest/ecdsa/ssh_ecdsa_r/index.d.ts +2 -27
- package/dest/ecdsa/ssh_ecdsa_r/index.d.ts.map +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/index.js +3 -28
- package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts +2 -30
- package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts.map +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/lazy.js +3 -38
- package/dest/schnorr/account_contract.d.ts +7 -3
- package/dest/schnorr/account_contract.d.ts.map +1 -1
- package/dest/schnorr/account_contract.js +9 -6
- package/dest/schnorr/index.d.ts +4 -38
- package/dest/schnorr/index.d.ts.map +1 -1
- package/dest/schnorr/index.js +2 -33
- 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/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 +20 -0
- package/dest/stub/index.d.ts.map +1 -0
- package/dest/stub/index.js +28 -0
- package/dest/stub/lazy.d.ts +25 -0
- package/dest/stub/lazy.d.ts.map +1 -0
- package/dest/stub/lazy.js +37 -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 -30
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +18 -30
- 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 +2 -5
- package/dest/utils/ssh_agent.d.ts.map +1 -1
- package/package.json +26 -23
- package/src/defaults/account_contract.ts +19 -7
- package/src/defaults/index.ts +1 -2
- package/src/ecdsa/ecdsa_k/account_contract.ts +7 -4
- package/src/ecdsa/ecdsa_k/index.ts +1 -33
- package/src/ecdsa/ecdsa_k/lazy.ts +4 -36
- package/src/ecdsa/ecdsa_r/account_contract.ts +42 -0
- package/src/ecdsa/ecdsa_r/index.ts +31 -0
- package/src/ecdsa/ecdsa_r/lazy.ts +39 -0
- package/src/ecdsa/index.ts +1 -0
- package/src/ecdsa/lazy.ts +1 -0
- package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +7 -4
- package/src/ecdsa/ssh_ecdsa_r/index.ts +3 -42
- package/src/ecdsa/ssh_ecdsa_r/lazy.ts +3 -53
- package/src/schnorr/account_contract.ts +5 -4
- package/src/schnorr/index.ts +10 -57
- package/src/schnorr/lazy.ts +13 -60
- package/src/stub/account_contract.ts +39 -0
- package/src/stub/index.ts +40 -0
- package/src/stub/lazy.ts +51 -0
- package/src/testing/configuration.ts +2 -1
- package/src/testing/index.ts +19 -51
- package/src/testing/lazy.ts +18 -50
- package/artifacts/SchnorrSingleKeyAccount.json +0 -3937
- package/dest/dapp/dapp_interface.d.ts +0 -10
- package/dest/dapp/dapp_interface.d.ts.map +0 -1
- package/dest/dapp/dapp_interface.js +0 -16
- package/dest/dapp/index.d.ts +0 -2
- package/dest/dapp/index.d.ts.map +0 -1
- package/dest/dapp/index.js +0 -1
- package/dest/defaults/account_interface.d.ts +0 -27
- package/dest/defaults/account_interface.d.ts.map +0 -1
- package/dest/defaults/account_interface.js +0 -37
- package/dest/single_key/account_contract.d.ts +0 -17
- package/dest/single_key/account_contract.d.ts.map +0 -1
- package/dest/single_key/account_contract.js +0 -42
- package/dest/single_key/index.d.ts +0 -39
- package/dest/single_key/index.d.ts.map +0 -1
- package/dest/single_key/index.js +0 -45
- package/dest/single_key/lazy.d.ts +0 -43
- package/dest/single_key/lazy.d.ts.map +0 -1
- package/dest/single_key/lazy.js +0 -53
- 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 -58
- package/src/dapp/dapp_interface.ts +0 -38
- package/src/dapp/index.ts +0 -1
- package/src/defaults/account_interface.ts +0 -59
- package/src/single_key/account_contract.ts +0 -43
- package/src/single_key/index.ts +0 -63
- package/src/single_key/lazy.ts +0 -71
- package/src/testing/create_account.ts +0 -93
- /package/artifacts/{SchnorrSingleKeyAccount.d.json.ts → SimulatedAccount.d.json.ts} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import SimulatedAccountContract from '../../artifacts/SimulatedAccount.json' with {
|
|
5
|
+
type: 'json'
|
|
6
|
+
};
|
|
7
|
+
import { StubBaseAccountContract } from './account_contract.js';
|
|
8
|
+
export const StubAccountContractArtifact = loadContractArtifact(SimulatedAccountContract);
|
|
9
|
+
/**
|
|
10
|
+
* Stub account contract
|
|
11
|
+
* Eagerly loads the contract artifact
|
|
12
|
+
*/ export class StubAccountContract extends StubBaseAccountContract {
|
|
13
|
+
constructor(){
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
16
|
+
getContractArtifact() {
|
|
17
|
+
return Promise.resolve(StubAccountContractArtifact);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
22
|
+
* @param originalAddress - The address of the account to stub
|
|
23
|
+
* @returns A stub account that can be used for kernelless simulations
|
|
24
|
+
*/ export function createStubAccount(originalAddress) {
|
|
25
|
+
const accountContract = new StubAccountContract();
|
|
26
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
27
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { StubBaseAccountContract } from './account_contract.js';
|
|
5
|
+
/**
|
|
6
|
+
* Lazily loads the contract artifact
|
|
7
|
+
* @returns The contract artifact for the Stub account contract
|
|
8
|
+
*/
|
|
9
|
+
export declare function getStubAccountContractArtifact(): Promise<ContractArtifact>;
|
|
10
|
+
/**
|
|
11
|
+
* Account contract that authenticates transactions using Stub signatures
|
|
12
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
13
|
+
* Lazily loads the contract artifact
|
|
14
|
+
*/
|
|
15
|
+
export declare class StubAccountContract extends StubBaseAccountContract {
|
|
16
|
+
constructor();
|
|
17
|
+
getContractArtifact(): Promise<ContractArtifact>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
21
|
+
* @param originalAddress - The address of the account to stub
|
|
22
|
+
* @returns A stub account that can be used for kernelless simulations
|
|
23
|
+
*/
|
|
24
|
+
export declare function createStubAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0dWIvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFakUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUcxRCxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUVoRTs7O0dBR0c7QUFDSCx3QkFBc0IsOEJBQThCLDhCQVFuRDtBQUVEOzs7O0dBSUc7QUFDSCxxQkFBYSxtQkFBb0IsU0FBUSx1QkFBdUI7SUFDOUQsY0FFQztJQUVRLG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUV4RDtDQUNGO0FBRUQ7Ozs7R0FJRztBQUNILHdCQUFnQixpQkFBaUIsQ0FBQyxlQUFlLEVBQUUsZUFBZSxlQVFqRSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/stub/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;GAGG;AACH,wBAAsB,8BAA8B,8BAQnD;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC9D,cAEC;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,eAAe,eAQjE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { StubBaseAccountContract } from './account_contract.js';
|
|
5
|
+
/**
|
|
6
|
+
* Lazily loads the contract artifact
|
|
7
|
+
* @returns The contract artifact for the Stub account contract
|
|
8
|
+
*/ export async function getStubAccountContractArtifact() {
|
|
9
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
10
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
11
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
12
|
+
// "text/javascript"
|
|
13
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
14
|
+
const { default: StubAccountContractJson } = await import('../../artifacts/SimulatedAccount.json');
|
|
15
|
+
return loadContractArtifact(StubAccountContractJson);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Account contract that authenticates transactions using Stub signatures
|
|
19
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
20
|
+
* Lazily loads the contract artifact
|
|
21
|
+
*/ export class StubAccountContract extends StubBaseAccountContract {
|
|
22
|
+
constructor(){
|
|
23
|
+
super();
|
|
24
|
+
}
|
|
25
|
+
getContractArtifact() {
|
|
26
|
+
return getStubAccountContractArtifact();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
31
|
+
* @param originalAddress - The address of the account to stub
|
|
32
|
+
* @returns A stub account that can be used for kernelless simulations
|
|
33
|
+
*/ export function createStubAccount(originalAddress) {
|
|
34
|
+
const accountContract = new StubAccountContract();
|
|
35
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
36
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
37
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Fr
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
2
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
export declare const INITIAL_TEST_SECRET_KEYS: Fr[];
|
|
4
|
-
export declare const INITIAL_TEST_ENCRYPTION_KEYS: import("@aztec/foundation/
|
|
5
|
-
export declare const INITIAL_TEST_SIGNING_KEYS: import("@aztec/foundation/
|
|
5
|
+
export declare const INITIAL_TEST_ENCRYPTION_KEYS: import("@aztec/foundation/curves/bn254").Fq[];
|
|
6
|
+
export declare const INITIAL_TEST_SIGNING_KEYS: import("@aztec/foundation/curves/bn254").Fq[];
|
|
6
7
|
export declare const INITIAL_TEST_ACCOUNT_SALTS: Fr[];
|
|
7
8
|
/**
|
|
8
9
|
* Data for generating an initial account.
|
|
@@ -25,4 +26,4 @@ export interface InitialAccountData {
|
|
|
25
26
|
*/
|
|
26
27
|
address: AztecAddress;
|
|
27
28
|
}
|
|
28
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvY29uZmlndXJhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBR2hFLGVBQU8sTUFBTSx3QkFBd0IsTUFJcEMsQ0FBQztBQUVGLGVBQU8sTUFBTSw0QkFBNEIsK0NBRXhDLENBQUM7QUFFRixlQUFPLE1BQU0seUJBQXlCLCtDQUErQixDQUFDO0FBRXRFLGVBQU8sTUFBTSwwQkFBMEIsTUFBOEIsQ0FBQztBQUV0RTs7R0FFRztBQUNILE1BQU0sV0FBVyxrQkFBa0I7SUFDakM7O09BRUc7SUFDSCxNQUFNLEVBQUUsRUFBRSxDQUFDO0lBQ1g7O09BRUc7SUFDSCxVQUFVLEVBQUUsY0FBYyxDQUFDO0lBQzNCOztPQUVHO0lBQ0gsSUFBSSxFQUFFLEVBQUUsQ0FBQztJQUNUOztPQUVHO0lBQ0gsT0FBTyxFQUFFLFlBQVksQ0FBQztDQUN2QiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/testing/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/testing/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,eAAO,MAAM,wBAAwB,MAIpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,+CAExC,CAAC;AAEF,eAAO,MAAM,yBAAyB,+CAA+B,CAAC;AAEtE,eAAO,MAAM,0BAA0B,MAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,EAAE,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,EAAE,CAAC;IACT;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;CACvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
|
|
3
3
|
export const INITIAL_TEST_SECRET_KEYS = [
|
|
4
4
|
Fr.fromHexString('2153536ff6628eee01cf4024889ff977a18d9fa61d0e414422f7681cf085c281'),
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
import type { PXE } from '@aztec/aztec.js';
|
|
9
|
-
import type { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
|
|
10
|
-
import type { InitialAccountData } from './configuration.js';
|
|
11
|
-
export { type InitialAccountData, INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS, } from './configuration.js';
|
|
1
|
+
import { type InitialAccountData } from './configuration.js';
|
|
2
|
+
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS, type InitialAccountData, } from './configuration.js';
|
|
12
3
|
/**
|
|
13
4
|
* Gets the basic information for initial test accounts.
|
|
14
5
|
*/
|
|
15
|
-
export declare function
|
|
16
|
-
/**
|
|
17
|
-
* Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment.
|
|
18
|
-
* @param pxe - PXE instance.
|
|
19
|
-
* @returns A set of AccountWallet implementations for each of the initial accounts.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Queries a PXE for it's registered accounts.
|
|
24
|
-
* @param pxe - PXE instance.
|
|
25
|
-
* @returns A set of key data for each of the initial accounts.
|
|
26
|
-
*/
|
|
27
|
-
export declare function getDeployedTestAccounts(pxe: PXE): Promise<InitialAccountData[]>;
|
|
6
|
+
export declare function getInitialTestAccountsData(): Promise<InitialAccountData[]>;
|
|
28
7
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param pxe - PXE instance.
|
|
31
|
-
* @returns A set of AccountWallet implementations for each of the initial accounts.
|
|
8
|
+
* Generate a fixed amount of random schnorr account contract instance.
|
|
32
9
|
*/
|
|
33
|
-
export declare function
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=index.d.ts.map
|
|
10
|
+
export declare function generateSchnorrAccounts(numberOfAccounts: number): Promise<Promise<InitialAccountData[]>>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVNBLE9BQU8sRUFLTCxLQUFLLGtCQUFrQixFQUN4QixNQUFNLG9CQUFvQixDQUFDO0FBRTVCLE9BQU8sRUFDTCwwQkFBMEIsRUFDMUIsNEJBQTRCLEVBQzVCLHdCQUF3QixFQUN4Qix5QkFBeUIsRUFDekIsS0FBSyxrQkFBa0IsR0FDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQUU1Qjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWExRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUFDLGdCQUFnQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0FBQyxDQWE5RyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAa1E;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAa9G"}
|
package/dest/testing/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `@aztec/accounts/testing` export provides utility methods for testing, in particular in a
|
|
3
|
-
*
|
|
4
|
-
* Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
|
|
2
|
+
* The `@aztec/accounts/testing` export provides utility methods for testing, in particular in a local network environment.
|
|
5
3
|
*
|
|
6
4
|
* @packageDocumentation
|
|
7
|
-
*/ import {
|
|
5
|
+
*/ import { Fr } from '@aztec/aztec.js/fields';
|
|
6
|
+
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
7
|
+
import { getSchnorrAccountContractAddress } from '../schnorr/index.js';
|
|
8
8
|
import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
9
9
|
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
10
10
|
/**
|
|
11
11
|
* Gets the basic information for initial test accounts.
|
|
12
|
-
*/ export function
|
|
12
|
+
*/ export function getInitialTestAccountsData() {
|
|
13
13
|
return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (secret, i)=>({
|
|
14
14
|
secret,
|
|
15
15
|
signingKey: INITIAL_TEST_ENCRYPTION_KEYS[i],
|
|
@@ -18,30 +18,18 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_
|
|
|
18
18
|
})));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
* Generate a fixed amount of random schnorr account contract instance.
|
|
22
|
+
*/ export async function generateSchnorrAccounts(numberOfAccounts) {
|
|
23
|
+
const secrets = Array.from({
|
|
24
|
+
length: numberOfAccounts
|
|
25
|
+
}, ()=>Fr.random());
|
|
26
|
+
return await Promise.all(secrets.map(async (secret)=>{
|
|
27
|
+
const salt = Fr.random();
|
|
28
|
+
return {
|
|
29
|
+
secret,
|
|
30
|
+
signingKey: deriveSigningKey(secret),
|
|
31
|
+
salt,
|
|
32
|
+
address: await getSchnorrAccountContractAddress(secret, salt)
|
|
33
|
+
};
|
|
28
34
|
}));
|
|
29
35
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Queries a PXE for it's registered accounts.
|
|
32
|
-
* @param pxe - PXE instance.
|
|
33
|
-
* @returns A set of key data for each of the initial accounts.
|
|
34
|
-
*/ export async function getDeployedTestAccounts(pxe) {
|
|
35
|
-
const registeredAccounts = await pxe.getRegisteredAccounts();
|
|
36
|
-
const testAccounts = await getInitialTestAccounts();
|
|
37
|
-
return testAccounts.filter((t)=>registeredAccounts.some((r)=>r.address.equals(t.address)));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Queries a PXE for it's registered accounts and returns wallets for those accounts using keys in the initial test accounts.
|
|
41
|
-
* @param pxe - PXE instance.
|
|
42
|
-
* @returns A set of AccountWallet implementations for each of the initial accounts.
|
|
43
|
-
*/ export async function getDeployedTestAccountsWallets(pxe) {
|
|
44
|
-
const testAccounts = await getDeployedTestAccounts(pxe);
|
|
45
|
-
return Promise.all(testAccounts.map(({ secret, signingKey, salt })=>getSchnorrWalletWithSecretKey(pxe, secret, signingKey, salt)));
|
|
46
|
-
}
|
|
47
|
-
export { deployFundedSchnorrAccount, deployFundedSchnorrAccounts, generateSchnorrAccounts } from './create_account.js';
|
package/dest/testing/lazy.d.ts
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@aztec/accounts/testing/lazy` export provides utility methods for testing, in particular in a Sandbox environment.
|
|
3
|
-
*
|
|
4
|
-
* Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
import type { PXE } from '@aztec/aztec.js';
|
|
9
|
-
import type { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
|
|
10
1
|
import { type InitialAccountData } from './configuration.js';
|
|
11
|
-
export {
|
|
2
|
+
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configuration.js';
|
|
12
3
|
/**
|
|
13
4
|
* Gets the basic information for initial test accounts.
|
|
14
5
|
*/
|
|
15
|
-
export declare function
|
|
16
|
-
/**
|
|
17
|
-
* Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment.
|
|
18
|
-
* @param pxe - PXE instance.
|
|
19
|
-
* @returns A set of AccountWallet implementations for each of the initial accounts.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Queries a PXE for it's registered accounts.
|
|
24
|
-
* @param pxe - PXE instance.
|
|
25
|
-
* @returns A set of key data for each of the initial accounts.
|
|
26
|
-
*/
|
|
27
|
-
export declare function getDeployedTestAccounts(pxe: PXE): Promise<InitialAccountData[]>;
|
|
6
|
+
export declare function getInitialTestAccountsData(): Promise<InitialAccountData[]>;
|
|
28
7
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param pxe - PXE instance.
|
|
31
|
-
* @returns A set of AccountWallet implementations for each of the initial accounts.
|
|
8
|
+
* Generate a fixed amount of random schnorr account contract instance.
|
|
32
9
|
*/
|
|
33
|
-
export declare function
|
|
34
|
-
//# sourceMappingURL=
|
|
10
|
+
export declare function generateSchnorrAccounts(numberOfAccounts: number): Promise<InitialAccountData[]>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTQSxPQUFPLEVBS0wsS0FBSyxrQkFBa0IsRUFDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQUU1QixPQUFPLEVBQUUsMEJBQTBCLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUUxRjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWExRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUFDLGdCQUFnQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWFyRyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE1F;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAa1E;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAarG"}
|
package/dest/testing/lazy.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `@aztec/accounts/testing/lazy` export provides utility methods for testing, in particular in a
|
|
3
|
-
*
|
|
4
|
-
* Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
|
|
2
|
+
* The `@aztec/accounts/testing/lazy` export provides utility methods for testing, in particular in a local network environment.
|
|
5
3
|
*
|
|
6
4
|
* @packageDocumentation
|
|
7
|
-
*/ import {
|
|
5
|
+
*/ import { Fr } from '@aztec/aztec.js/fields';
|
|
6
|
+
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
7
|
+
import { getSchnorrAccountContractAddress } from '../schnorr/lazy.js';
|
|
8
8
|
import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
9
|
-
export { INITIAL_TEST_ACCOUNT_SALTS,
|
|
9
|
+
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configuration.js';
|
|
10
10
|
/**
|
|
11
11
|
* Gets the basic information for initial test accounts.
|
|
12
|
-
*/ export function
|
|
12
|
+
*/ export function getInitialTestAccountsData() {
|
|
13
13
|
return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (secret, i)=>({
|
|
14
14
|
secret,
|
|
15
15
|
signingKey: INITIAL_TEST_ENCRYPTION_KEYS[i],
|
|
@@ -18,29 +18,18 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_
|
|
|
18
18
|
})));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
* Generate a fixed amount of random schnorr account contract instance.
|
|
22
|
+
*/ export async function generateSchnorrAccounts(numberOfAccounts) {
|
|
23
|
+
const secrets = Array.from({
|
|
24
|
+
length: numberOfAccounts
|
|
25
|
+
}, ()=>Fr.random());
|
|
26
|
+
return await Promise.all(secrets.map(async (secret)=>{
|
|
27
|
+
const salt = Fr.random();
|
|
28
|
+
return {
|
|
29
|
+
secret,
|
|
30
|
+
signingKey: deriveSigningKey(secret),
|
|
31
|
+
salt,
|
|
32
|
+
address: await getSchnorrAccountContractAddress(secret, salt)
|
|
33
|
+
};
|
|
28
34
|
}));
|
|
29
35
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Queries a PXE for it's registered accounts.
|
|
32
|
-
* @param pxe - PXE instance.
|
|
33
|
-
* @returns A set of key data for each of the initial accounts.
|
|
34
|
-
*/ export async function getDeployedTestAccounts(pxe) {
|
|
35
|
-
const registeredAccounts = await pxe.getRegisteredAccounts();
|
|
36
|
-
const testAccounts = await getInitialTestAccounts();
|
|
37
|
-
return testAccounts.filter((t)=>registeredAccounts.some((r)=>r.address.equals(t.address)));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Queries a PXE for it's registered accounts and returns wallets for those accounts using keys in the initial test accounts.
|
|
41
|
-
* @param pxe - PXE instance.
|
|
42
|
-
* @returns A set of AccountWallet implementations for each of the initial accounts.
|
|
43
|
-
*/ export async function getDeployedTestAccountsWallets(pxe) {
|
|
44
|
-
const testAccounts = await getDeployedTestAccounts(pxe);
|
|
45
|
-
return Promise.all(testAccounts.map(({ secret, signingKey, salt })=>getSchnorrWalletWithSecretKey(pxe, secret, signingKey, salt)));
|
|
46
|
-
}
|
package/dest/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './ssh_agent.js';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGdCQUFnQixDQUFDIn0=
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
4
1
|
import { Buffer } from 'buffer';
|
|
5
2
|
import net from 'net';
|
|
6
3
|
/**
|
|
@@ -31,6 +28,6 @@ export declare function getIdentities(): Promise<StoredKey[]>;
|
|
|
31
28
|
/**
|
|
32
29
|
* Sign data using a key stored in the SSH agent. The private signing key is identified by its corresponding public key.
|
|
33
30
|
*/
|
|
34
|
-
export declare function signWithAgent(keyType: Buffer, curveName: Buffer, publicKey: Buffer, data: Buffer): Promise<Buffer
|
|
31
|
+
export declare function signWithAgent(keyType: Buffer, curveName: Buffer, publicKey: Buffer, data: Buffer): Promise<Buffer<ArrayBufferLike>>;
|
|
35
32
|
export {};
|
|
36
|
-
//# sourceMappingURL=
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3NoX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvc3NoX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxRQUFRLENBQUM7QUFDaEMsT0FBTyxHQUFHLE1BQU0sS0FBSyxDQUFDO0FBT3RCOztHQUVHO0FBQ0gsd0JBQWdCLGNBQWMsZUFNN0I7QUFFRDs7R0FFRztBQUNILEtBQUssU0FBUyxHQUFHO0lBQ2Y7O09BRUc7SUFDSCxJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2I7O09BRUc7SUFDSCxTQUFTLEVBQUUsTUFBTSxDQUFDO0lBQ2xCOztPQUVHO0lBQ0gsT0FBTyxFQUFFLE1BQU0sQ0FBQztDQUNqQixDQUFDO0FBRUY7O0dBRUc7QUFDSCx3QkFBZ0IsYUFBYSxJQUFJLE9BQU8sQ0FBQyxTQUFTLEVBQUUsQ0FBQyxDQWtEcEQ7QUFFRDs7R0FFRztBQUNILHdCQUFnQixhQUFhLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLE1BQU0sb0NBd0NoRyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh_agent.d.ts","sourceRoot":"","sources":["../../src/utils/ssh_agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ssh_agent.d.ts","sourceRoot":"","sources":["../../src/utils/ssh_agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AAOtB;;GAEG;AACH,wBAAgB,cAAc,eAM7B;AAED;;GAEG;AACH,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAkDpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oCAwChG"}
|
package/package.json
CHANGED
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
"name": "@aztec/accounts",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/accounts",
|
|
4
4
|
"description": "Implementation of sample account contracts for Aztec Network",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.1-commit.001888fc",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
|
-
"./dapp": "./dest/dapp/index.js",
|
|
9
8
|
"./defaults": "./dest/defaults/index.js",
|
|
10
9
|
"./ecdsa": "./dest/ecdsa/index.js",
|
|
11
10
|
"./ecdsa/lazy": "./dest/ecdsa/lazy.js",
|
|
12
11
|
"./schnorr": "./dest/schnorr/index.js",
|
|
13
12
|
"./schnorr/lazy": "./dest/schnorr/lazy.js",
|
|
14
|
-
"./
|
|
15
|
-
"./
|
|
13
|
+
"./stub": "./dest/stub/index.js",
|
|
14
|
+
"./stub/lazy": "./dest/stub/lazy.js",
|
|
16
15
|
"./testing": "./dest/testing/index.js",
|
|
17
16
|
"./testing/lazy": "./dest/testing/lazy.js",
|
|
17
|
+
"./copy-cat": "./dest/copy_cat/index.js",
|
|
18
|
+
"./copy-cat/lazy": "./dest/copy_cat/lazy.js",
|
|
18
19
|
"./utils": "./dest/utils/index.js"
|
|
19
20
|
},
|
|
20
21
|
"typedocOptions": {
|
|
@@ -22,21 +23,18 @@
|
|
|
22
23
|
"./src/defaults/index.ts",
|
|
23
24
|
"./src/ecdsa/index.ts",
|
|
24
25
|
"./src/schnorr/index.ts",
|
|
25
|
-
"./src/single_key/index.ts",
|
|
26
26
|
"./src/testing/index.ts"
|
|
27
27
|
],
|
|
28
28
|
"name": "Accounts",
|
|
29
29
|
"tsconfig": "./tsconfig.json"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"build": "yarn clean && yarn generate && tsc
|
|
32
|
+
"build": "yarn clean && yarn generate && ../scripts/tsc.sh",
|
|
33
33
|
"generate": "yarn generate:noir-contracts",
|
|
34
34
|
"generate:noir-contracts": "./scripts/copy-contracts.sh",
|
|
35
|
-
"build:dev": "tsc
|
|
36
|
-
"build:ts": "tsc
|
|
35
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
36
|
+
"build:ts": "../scripts/tsc.sh",
|
|
37
37
|
"clean": "rm -rf ./dest .tsbuildinfo ./artifacts",
|
|
38
|
-
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
39
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
40
38
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
41
39
|
},
|
|
42
40
|
"inherits": [
|
|
@@ -74,25 +72,30 @@
|
|
|
74
72
|
"testTimeout": 120000,
|
|
75
73
|
"setupFiles": [
|
|
76
74
|
"../../foundation/src/jest/setup.mjs"
|
|
75
|
+
],
|
|
76
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs",
|
|
77
|
+
"setupFilesAfterEnv": [
|
|
78
|
+
"../../foundation/src/jest/setupAfterEnv.mjs"
|
|
77
79
|
]
|
|
78
80
|
},
|
|
79
81
|
"dependencies": {
|
|
80
|
-
"@aztec/aztec.js": "0.0.
|
|
81
|
-
"@aztec/entrypoints": "0.0.
|
|
82
|
-
"@aztec/ethereum": "0.0.
|
|
83
|
-
"@aztec/foundation": "0.0.
|
|
84
|
-
"@aztec/stdlib": "0.0.
|
|
82
|
+
"@aztec/aztec.js": "0.0.1-commit.001888fc",
|
|
83
|
+
"@aztec/entrypoints": "0.0.1-commit.001888fc",
|
|
84
|
+
"@aztec/ethereum": "0.0.1-commit.001888fc",
|
|
85
|
+
"@aztec/foundation": "0.0.1-commit.001888fc",
|
|
86
|
+
"@aztec/stdlib": "0.0.1-commit.001888fc",
|
|
85
87
|
"tslib": "^2.4.0"
|
|
86
88
|
},
|
|
87
89
|
"devDependencies": {
|
|
88
|
-
"@jest/globals": "^
|
|
89
|
-
"@types/jest": "^
|
|
90
|
-
"@types/node": "^
|
|
91
|
-
"
|
|
92
|
-
"jest
|
|
93
|
-
"
|
|
90
|
+
"@jest/globals": "^30.0.0",
|
|
91
|
+
"@types/jest": "^30.0.0",
|
|
92
|
+
"@types/node": "^22.15.17",
|
|
93
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
94
|
+
"jest": "^30.0.0",
|
|
95
|
+
"jest-mock-extended": "^4.0.0",
|
|
96
|
+
"ts-loader": "^9.5.4",
|
|
94
97
|
"ts-node": "^10.9.1",
|
|
95
|
-
"typescript": "^5.
|
|
98
|
+
"typescript": "^5.3.3"
|
|
96
99
|
},
|
|
97
100
|
"files": [
|
|
98
101
|
"dest",
|
|
@@ -101,6 +104,6 @@
|
|
|
101
104
|
"artifacts"
|
|
102
105
|
],
|
|
103
106
|
"engines": {
|
|
104
|
-
"node": ">=
|
|
107
|
+
"node": ">=20.10"
|
|
105
108
|
}
|
|
106
109
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Account, type AccountContract, type AuthWitnessProvider, BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
2
3
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { CompleteAddress
|
|
4
|
-
|
|
5
|
-
import { DefaultAccountInterface } from '../defaults/account_interface.js';
|
|
4
|
+
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Base class for implementing an account contract. Requires that the account uses the
|
|
@@ -10,12 +9,25 @@ import { DefaultAccountInterface } from '../defaults/account_interface.js';
|
|
|
10
9
|
*/
|
|
11
10
|
export abstract class DefaultAccountContract implements AccountContract {
|
|
12
11
|
abstract getAuthWitnessProvider(address: CompleteAddress): AuthWitnessProvider;
|
|
13
|
-
abstract
|
|
12
|
+
abstract getInitializationFunctionAndArgs(): Promise<
|
|
13
|
+
| {
|
|
14
|
+
/** The name of the function used to initialize the contract */
|
|
15
|
+
constructorName: string;
|
|
16
|
+
/** The args to the function used to initialize the contract */
|
|
17
|
+
constructorArgs: any[];
|
|
18
|
+
}
|
|
19
|
+
| undefined
|
|
20
|
+
>;
|
|
14
21
|
abstract getContractArtifact(): Promise<ContractArtifact>;
|
|
15
22
|
|
|
16
23
|
constructor() {}
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
getAccount(completeAddress: CompleteAddress): Account {
|
|
26
|
+
const authWitnessProvider = this.getAuthWitnessProvider(completeAddress);
|
|
27
|
+
return new BaseAccount(
|
|
28
|
+
new DefaultAccountEntrypoint(completeAddress.address, authWitnessProvider),
|
|
29
|
+
authWitnessProvider,
|
|
30
|
+
completeAddress,
|
|
31
|
+
);
|
|
20
32
|
}
|
|
21
33
|
}
|
package/src/defaults/index.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@aztec/accounts/defaults` export provides the base class {@link DefaultAccountContract} for implementing account contracts that use the default entrypoint payload module.
|
|
3
3
|
*
|
|
4
|
-
* Read more in {@link https://docs.aztec.network/developers/tutorials/
|
|
4
|
+
* Read more in {@link https://docs.aztec.network/developers/tutorials/contract_tutorials/counter_contract | Writing an account contract}.
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export * from './account_interface.js';
|
|
10
9
|
export * from './account_contract.js';
|
|
@@ -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
|
|
|
@@ -17,9 +17,12 @@ export abstract class EcdsaKBaseAccountContract extends DefaultAccountContract {
|
|
|
17
17
|
super();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async
|
|
20
|
+
async getInitializationFunctionAndArgs() {
|
|
21
21
|
const signingPublicKey = await new Ecdsa().computePublicKey(this.signingPrivateKey);
|
|
22
|
-
return
|
|
22
|
+
return {
|
|
23
|
+
constructorName: 'constructor',
|
|
24
|
+
constructorArgs: [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)],
|
|
25
|
+
};
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider {
|
|
@@ -4,16 +4,11 @@
|
|
|
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
|
-
import EcdsaKAccountContractJson from '../../../artifacts/EcdsaKAccount.json'
|
|
11
|
+
import EcdsaKAccountContractJson from '../../../artifacts/EcdsaKAccount.json' with { type: 'json' };
|
|
17
12
|
import { EcdsaKBaseAccountContract } from './account_contract.js';
|
|
18
13
|
|
|
19
14
|
export const EcdsaKAccountContractArtifact: ContractArtifact = loadContractArtifact(
|
|
@@ -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
|
-
}
|