@aztec/accounts 4.0.0-devnet.2-patch.4 → 4.0.0-devnet.3-patch.1
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 +0 -1
- package/artifacts/EcdsaKAccount.json +440 -603
- package/artifacts/EcdsaRAccount.json +437 -600
- package/artifacts/SchnorrAccount.json +448 -607
- package/artifacts/SimulatedAccount.json +223 -413
- package/package.json +6 -9
- package/artifacts/SchnorrSingleKeyAccount.d.json.ts +0 -3
- package/artifacts/SchnorrSingleKeyAccount.json +0 -4716
- 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/src/single_key/account_contract.ts +0 -47
- package/src/single_key/index.ts +0 -32
- package/src/single_key/lazy.ts +0 -40
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
3
|
-
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
4
|
-
import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
5
|
-
/**
|
|
6
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
7
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
8
|
-
* This abstract version does not provide a way to retrieve the artifact, as it
|
|
9
|
-
* can be implemented with or without lazy loading.
|
|
10
|
-
*/
|
|
11
|
-
export declare abstract class SingleKeyBaseAccountContract extends DefaultAccountContract {
|
|
12
|
-
private encryptionPrivateKey;
|
|
13
|
-
constructor(encryptionPrivateKey: GrumpkinScalar);
|
|
14
|
-
getInitializationFunctionAndArgs(): Promise<undefined>;
|
|
15
|
-
getAuthWitnessProvider(account: CompleteAddress): AuthWitnessProvider;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudF9jb250cmFjdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NpbmdsZV9rZXkvYWNjb3VudF9jb250cmFjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBR25FLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUVuRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFekQsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFekU7Ozs7O0dBS0c7QUFDSCw4QkFBc0IsNEJBQTZCLFNBQVEsc0JBQXNCO0lBQ25FLE9BQU8sQ0FBQyxvQkFBb0I7SUFBeEMsWUFBb0Isb0JBQW9CLEVBQUUsY0FBYyxFQUV2RDtJQUVELGdDQUFnQyx1QkFFL0I7SUFFRCxzQkFBc0IsQ0FBQyxPQUFPLEVBQUUsZUFBZSxHQUFHLG1CQUFtQixDQUVwRTtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../src/single_key/account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE;;;;;GAKG;AACH,8BAAsB,4BAA6B,SAAQ,sBAAsB;IACnE,OAAO,CAAC,oBAAoB;IAAxC,YAAoB,oBAAoB,EAAE,cAAc,EAEvD;IAED,gCAAgC,uBAE/B;IAED,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB,CAEpE;CACF"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Schnorr } from '@aztec/foundation/crypto/schnorr';
|
|
2
|
-
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
-
import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
4
|
-
/**
|
|
5
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
6
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
7
|
-
* This abstract version does not provide a way to retrieve the artifact, as it
|
|
8
|
-
* can be implemented with or without lazy loading.
|
|
9
|
-
*/ export class SingleKeyBaseAccountContract extends DefaultAccountContract {
|
|
10
|
-
encryptionPrivateKey;
|
|
11
|
-
constructor(encryptionPrivateKey){
|
|
12
|
-
super(), this.encryptionPrivateKey = encryptionPrivateKey;
|
|
13
|
-
}
|
|
14
|
-
getInitializationFunctionAndArgs() {
|
|
15
|
-
return Promise.resolve(undefined);
|
|
16
|
-
}
|
|
17
|
-
getAuthWitnessProvider(account) {
|
|
18
|
-
return new SingleKeyAuthWitnessProvider(this.encryptionPrivateKey, account);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Creates auth witnesses using Schnorr signatures and including the partial address and public key
|
|
23
|
-
* in the witness, so verifiers do not need to store the public key and can instead validate it
|
|
24
|
-
* by reconstructing the current address.
|
|
25
|
-
*/ class SingleKeyAuthWitnessProvider {
|
|
26
|
-
privateKey;
|
|
27
|
-
account;
|
|
28
|
-
constructor(privateKey, account){
|
|
29
|
-
this.privateKey = privateKey;
|
|
30
|
-
this.account = account;
|
|
31
|
-
}
|
|
32
|
-
async createAuthWit(messageHash) {
|
|
33
|
-
const schnorr = new Schnorr();
|
|
34
|
-
const signature = await schnorr.constructSignature(messageHash.toBuffer(), this.privateKey);
|
|
35
|
-
const witness = [
|
|
36
|
-
...this.account.publicKeys.toFields(),
|
|
37
|
-
...signature.toBuffer(),
|
|
38
|
-
this.account.partialAddress
|
|
39
|
-
];
|
|
40
|
-
return Promise.resolve(new AuthWitness(messageHash, witness));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
|
|
3
|
-
* It is not recommended to use this account type in production.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
8
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
10
|
-
export declare const SchnorrSingleKeyAccountContractArtifact: ContractArtifact;
|
|
11
|
-
/**
|
|
12
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
13
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
14
|
-
* Eagerly loads the contract artifact
|
|
15
|
-
*/
|
|
16
|
-
export declare class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
17
|
-
constructor(signingPrivateKey: GrumpkinScalar);
|
|
18
|
-
getContractArtifact(): Promise<ContractArtifact>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zaW5nbGVfa2V5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7OztHQUtHO0FBQ0gsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUsxRCxPQUFPLEVBQUUsNEJBQTRCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUVyRSxlQUFPLE1BQU0sdUNBQXVDLGtCQUVuRCxDQUFDO0FBRUY7Ozs7R0FJRztBQUNILHFCQUFhLHdCQUF5QixTQUFRLDRCQUE0QjtJQUN4RSxZQUFZLGlCQUFpQixFQUFFLGNBQWMsRUFFNUM7SUFFUSxtQkFBbUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FFeEQ7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/single_key/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,eAAO,MAAM,uCAAuC,kBAEnD,CAAC;AAEF;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;IACxE,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF"}
|
package/dest/single_key/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
|
|
3
|
-
* It is not recommended to use this account type in production.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/ import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
7
|
-
import SchnorrSingleKeyAccountContractJson from '../../artifacts/SchnorrSingleKeyAccount.json' with {
|
|
8
|
-
type: 'json'
|
|
9
|
-
};
|
|
10
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
11
|
-
export const SchnorrSingleKeyAccountContractArtifact = loadContractArtifact(SchnorrSingleKeyAccountContractJson);
|
|
12
|
-
/**
|
|
13
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
14
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
15
|
-
* Eagerly loads the contract artifact
|
|
16
|
-
*/ export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
17
|
-
constructor(signingPrivateKey){
|
|
18
|
-
super(signingPrivateKey);
|
|
19
|
-
}
|
|
20
|
-
getContractArtifact() {
|
|
21
|
-
return Promise.resolve(SchnorrSingleKeyAccountContractArtifact);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
|
|
3
|
-
* It is not recommended to use this account type in production.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
8
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
10
|
-
/**
|
|
11
|
-
* Lazily loads the contract artifact
|
|
12
|
-
* @returns The contract artifact for the single key account contract
|
|
13
|
-
*/
|
|
14
|
-
export declare function getSingleKeyAccountContractArtifact(): Promise<ContractArtifact>;
|
|
15
|
-
/**
|
|
16
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
17
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
18
|
-
* Lazily loads the contract artifact
|
|
19
|
-
*/
|
|
20
|
-
export declare class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
21
|
-
constructor(signingPrivateKey: GrumpkinScalar);
|
|
22
|
-
getContractArtifact(): Promise<ContractArtifact>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NpbmdsZV9rZXkvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7R0FLRztBQUNILE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFHMUQsT0FBTyxFQUFFLDRCQUE0QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFckU7OztHQUdHO0FBQ0gsd0JBQXNCLG1DQUFtQyw4QkFReEQ7QUFFRDs7OztHQUlHO0FBQ0gscUJBQWEsd0JBQXlCLFNBQVEsNEJBQTRCO0lBQ3hFLFlBQVksaUJBQWlCLEVBQUUsY0FBYyxFQUU1QztJQUVRLG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUV4RDtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/single_key/lazy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;GAGG;AACH,wBAAsB,mCAAmC,8BAQxD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;IACxE,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF"}
|
package/dest/single_key/lazy.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
|
|
3
|
-
* It is not recommended to use this account type in production.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/ import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
7
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
8
|
-
/**
|
|
9
|
-
* Lazily loads the contract artifact
|
|
10
|
-
* @returns The contract artifact for the single key account contract
|
|
11
|
-
*/ export async function getSingleKeyAccountContractArtifact() {
|
|
12
|
-
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
13
|
-
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
14
|
-
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
15
|
-
// "text/javascript"
|
|
16
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
17
|
-
const { default: schnorrAccountContractJson } = await import('../../artifacts/SchnorrAccount.json');
|
|
18
|
-
return loadContractArtifact(schnorrAccountContractJson);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
22
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
23
|
-
* Lazily loads the contract artifact
|
|
24
|
-
*/ export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
25
|
-
constructor(signingPrivateKey){
|
|
26
|
-
super(signingPrivateKey);
|
|
27
|
-
}
|
|
28
|
-
getContractArtifact() {
|
|
29
|
-
return getSingleKeyAccountContractArtifact();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
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';
|
|
5
|
-
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
|
-
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
7
|
-
|
|
8
|
-
import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
12
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
13
|
-
* This abstract version does not provide a way to retrieve the artifact, as it
|
|
14
|
-
* can be implemented with or without lazy loading.
|
|
15
|
-
*/
|
|
16
|
-
export abstract class SingleKeyBaseAccountContract extends DefaultAccountContract {
|
|
17
|
-
constructor(private encryptionPrivateKey: GrumpkinScalar) {
|
|
18
|
-
super();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getInitializationFunctionAndArgs() {
|
|
22
|
-
return Promise.resolve(undefined);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getAuthWitnessProvider(account: CompleteAddress): AuthWitnessProvider {
|
|
26
|
-
return new SingleKeyAuthWitnessProvider(this.encryptionPrivateKey, account);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Creates auth witnesses using Schnorr signatures and including the partial address and public key
|
|
32
|
-
* in the witness, so verifiers do not need to store the public key and can instead validate it
|
|
33
|
-
* by reconstructing the current address.
|
|
34
|
-
*/
|
|
35
|
-
class SingleKeyAuthWitnessProvider implements AuthWitnessProvider {
|
|
36
|
-
constructor(
|
|
37
|
-
private privateKey: GrumpkinScalar,
|
|
38
|
-
private account: CompleteAddress,
|
|
39
|
-
) {}
|
|
40
|
-
|
|
41
|
-
async createAuthWit(messageHash: Fr): Promise<AuthWitness> {
|
|
42
|
-
const schnorr = new Schnorr();
|
|
43
|
-
const signature = await schnorr.constructSignature(messageHash.toBuffer(), this.privateKey);
|
|
44
|
-
const witness = [...this.account.publicKeys.toFields(), ...signature.toBuffer(), this.account.partialAddress];
|
|
45
|
-
return Promise.resolve(new AuthWitness(messageHash, witness));
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/single_key/index.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
|
|
3
|
-
* It is not recommended to use this account type in production.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
8
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
10
|
-
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
11
|
-
|
|
12
|
-
import SchnorrSingleKeyAccountContractJson from '../../artifacts/SchnorrSingleKeyAccount.json' with { type: 'json' };
|
|
13
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
14
|
-
|
|
15
|
-
export const SchnorrSingleKeyAccountContractArtifact = loadContractArtifact(
|
|
16
|
-
SchnorrSingleKeyAccountContractJson as NoirCompiledContract,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
21
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
22
|
-
* Eagerly loads the contract artifact
|
|
23
|
-
*/
|
|
24
|
-
export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
25
|
-
constructor(signingPrivateKey: GrumpkinScalar) {
|
|
26
|
-
super(signingPrivateKey);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
override getContractArtifact(): Promise<ContractArtifact> {
|
|
30
|
-
return Promise.resolve(SchnorrSingleKeyAccountContractArtifact);
|
|
31
|
-
}
|
|
32
|
-
}
|
package/src/single_key/lazy.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
|
|
3
|
-
* It is not recommended to use this account type in production.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
8
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
10
|
-
|
|
11
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Lazily loads the contract artifact
|
|
15
|
-
* @returns The contract artifact for the single key account contract
|
|
16
|
-
*/
|
|
17
|
-
export async function getSingleKeyAccountContractArtifact() {
|
|
18
|
-
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
19
|
-
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
20
|
-
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
21
|
-
// "text/javascript"
|
|
22
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
23
|
-
const { default: schnorrAccountContractJson } = await import('../../artifacts/SchnorrAccount.json');
|
|
24
|
-
return loadContractArtifact(schnorrAccountContractJson);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
29
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
30
|
-
* Lazily loads the contract artifact
|
|
31
|
-
*/
|
|
32
|
-
export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
33
|
-
constructor(signingPrivateKey: GrumpkinScalar) {
|
|
34
|
-
super(signingPrivateKey);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
override getContractArtifact(): Promise<ContractArtifact> {
|
|
38
|
-
return getSingleKeyAccountContractArtifact();
|
|
39
|
-
}
|
|
40
|
-
}
|