@aztec/accounts 0.0.1-commit.5476d83 → 0.0.1-commit.5914bae
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 +8002 -3520
- package/artifacts/EcdsaRAccount.json +8002 -3520
- package/artifacts/SchnorrAccount.json +8139 -3804
- package/artifacts/SimulatedEcdsaAccount.json +8363 -0
- package/artifacts/SimulatedSchnorrAccount.json +8339 -0
- package/dest/defaults/account_contract.d.ts +3 -3
- package/dest/defaults/account_contract.d.ts.map +1 -1
- package/dest/defaults/account_contract.js +5 -3
- package/dest/defaults/index.d.ts +1 -2
- package/dest/defaults/index.d.ts.map +1 -1
- package/dest/defaults/index.js +1 -2
- package/dest/ecdsa/ecdsa_k/account_contract.js +1 -1
- package/dest/ecdsa/ecdsa_r/account_contract.js +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +1 -1
- 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 +3 -2
- package/dest/schnorr/index.d.ts.map +1 -1
- package/dest/schnorr/lazy.d.ts +3 -2
- package/dest/schnorr/lazy.d.ts.map +1 -1
- package/dest/stub/account_contract.d.ts +2 -2
- package/dest/stub/account_contract.d.ts.map +1 -1
- package/dest/stub/ecdsa/index.d.ts +11 -0
- package/dest/stub/ecdsa/index.d.ts.map +1 -0
- package/dest/stub/ecdsa/index.js +18 -0
- package/dest/stub/ecdsa/lazy.d.ts +14 -0
- package/dest/stub/ecdsa/lazy.d.ts.map +1 -0
- package/dest/stub/ecdsa/lazy.js +22 -0
- package/dest/stub/schnorr/index.d.ts +11 -0
- package/dest/stub/schnorr/index.d.ts.map +1 -0
- package/dest/stub/schnorr/index.js +18 -0
- package/dest/stub/schnorr/lazy.d.ts +14 -0
- package/dest/stub/schnorr/lazy.d.ts.map +1 -0
- package/dest/stub/schnorr/lazy.js +22 -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/package.json +14 -15
- package/src/defaults/account_contract.ts +9 -5
- package/src/defaults/index.ts +0 -1
- package/src/ecdsa/ecdsa_k/account_contract.ts +2 -2
- package/src/ecdsa/ecdsa_r/account_contract.ts +2 -2
- package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +2 -2
- package/src/schnorr/account_contract.ts +3 -2
- package/src/schnorr/index.ts +2 -1
- package/src/schnorr/lazy.ts +2 -1
- package/src/stub/account_contract.ts +1 -1
- package/src/stub/ecdsa/index.ts +28 -0
- package/src/stub/ecdsa/lazy.ts +34 -0
- package/src/stub/schnorr/index.ts +30 -0
- package/src/stub/schnorr/lazy.ts +34 -0
- package/src/testing/configuration.ts +2 -1
- package/artifacts/SchnorrSingleKeyAccount.json +0 -4679
- package/artifacts/SimulatedAccount.json +0 -4623
- package/dest/defaults/account_interface.d.ts +0 -28
- package/dest/defaults/account_interface.d.ts.map +0 -1
- package/dest/defaults/account_interface.js +0 -36
- 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 -20
- package/dest/single_key/index.d.ts.map +0 -1
- package/dest/single_key/index.js +0 -23
- package/dest/single_key/lazy.d.ts +0 -24
- package/dest/single_key/lazy.d.ts.map +0 -1
- package/dest/single_key/lazy.js +0 -31
- package/dest/stub/index.d.ts +0 -21
- package/dest/stub/index.d.ts.map +0 -1
- package/dest/stub/index.js +0 -29
- package/dest/stub/lazy.d.ts +0 -23
- package/dest/stub/lazy.d.ts.map +0 -1
- package/dest/stub/lazy.js +0 -35
- package/src/defaults/account_interface.ts +0 -63
- package/src/single_key/account_contract.ts +0 -46
- package/src/single_key/index.ts +0 -32
- package/src/single_key/lazy.ts +0 -40
- package/src/stub/index.ts +0 -41
- package/src/stub/lazy.ts +0 -49
- /package/artifacts/{SchnorrSingleKeyAccount.d.json.ts → SimulatedEcdsaAccount.d.json.ts} +0 -0
- /package/artifacts/{SimulatedAccount.d.json.ts → SimulatedSchnorrAccount.d.json.ts} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
4
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
5
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
6
|
+
|
|
7
|
+
import SimulatedEcdsaAccountJson from '../../../artifacts/SimulatedEcdsaAccount.json' with { type: 'json' };
|
|
8
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
9
|
+
|
|
10
|
+
export const StubEcdsaAccountContractArtifact = loadContractArtifact(SimulatedEcdsaAccountJson as NoirCompiledContract);
|
|
11
|
+
|
|
12
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Eagerly loads the contract artifact. */
|
|
13
|
+
export class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
14
|
+
override getContractArtifact() {
|
|
15
|
+
return Promise.resolve(StubEcdsaAccountContractArtifact);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */
|
|
20
|
+
export function createStubEcdsaAccount(originalAddress: CompleteAddress) {
|
|
21
|
+
const accountContract = new StubEcdsaAccountContract();
|
|
22
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
23
|
+
return new BaseAccount(
|
|
24
|
+
new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider),
|
|
25
|
+
authWitnessProvider,
|
|
26
|
+
originalAddress,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
4
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
5
|
+
|
|
6
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Lazily loads the ECDSA stub contract artifact (browser-compatible).
|
|
10
|
+
*/
|
|
11
|
+
export async function getStubEcdsaAccountContractArtifact() {
|
|
12
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
13
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
14
|
+
const { default: json } = await import('../../../artifacts/SimulatedEcdsaAccount.json');
|
|
15
|
+
return loadContractArtifact(json);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Lazily loads the contract artifact. */
|
|
19
|
+
export class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
20
|
+
override getContractArtifact() {
|
|
21
|
+
return getStubEcdsaAccountContractArtifact();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */
|
|
26
|
+
export function createStubEcdsaAccount(originalAddress: CompleteAddress) {
|
|
27
|
+
const accountContract = new StubEcdsaAccountContract();
|
|
28
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
29
|
+
return new BaseAccount(
|
|
30
|
+
new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider),
|
|
31
|
+
authWitnessProvider,
|
|
32
|
+
originalAddress,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
4
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
5
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
6
|
+
|
|
7
|
+
import SimulatedSchnorrAccountJson from '../../../artifacts/SimulatedSchnorrAccount.json' with { type: 'json' };
|
|
8
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
9
|
+
|
|
10
|
+
export const StubSchnorrAccountContractArtifact = loadContractArtifact(
|
|
11
|
+
SimulatedSchnorrAccountJson as NoirCompiledContract,
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
/** Stub account contract for Schnorr accounts. Eagerly loads the contract artifact. */
|
|
15
|
+
export class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
16
|
+
override getContractArtifact() {
|
|
17
|
+
return Promise.resolve(StubSchnorrAccountContractArtifact);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */
|
|
22
|
+
export function createStubSchnorrAccount(originalAddress: CompleteAddress) {
|
|
23
|
+
const accountContract = new StubSchnorrAccountContract();
|
|
24
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
25
|
+
return new BaseAccount(
|
|
26
|
+
new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider),
|
|
27
|
+
authWitnessProvider,
|
|
28
|
+
originalAddress,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
4
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
5
|
+
|
|
6
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Lazily loads the Schnorr stub contract artifact (browser-compatible).
|
|
10
|
+
*/
|
|
11
|
+
export async function getStubSchnorrAccountContractArtifact() {
|
|
12
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
13
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
14
|
+
const { default: json } = await import('../../../artifacts/SimulatedSchnorrAccount.json');
|
|
15
|
+
return loadContractArtifact(json);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Stub account contract for Schnorr accounts. Lazily loads the contract artifact. */
|
|
19
|
+
export class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
20
|
+
override getContractArtifact() {
|
|
21
|
+
return getStubSchnorrAccountContractArtifact();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */
|
|
26
|
+
export function createStubSchnorrAccount(originalAddress: CompleteAddress) {
|
|
27
|
+
const accountContract = new StubSchnorrAccountContract();
|
|
28
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
29
|
+
return new BaseAccount(
|
|
30
|
+
new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider),
|
|
31
|
+
authWitnessProvider,
|
|
32
|
+
originalAddress,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
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
|
import { deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
|
|
4
5
|
|