@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
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type AccountWallet, type AuthWitnessProvider, AztecAddress, CompleteAddress, type NodeInfo } from '@aztec/aztec.js';
|
|
2
|
-
import { DefaultAccountInterface } from '../defaults/account_interface.js';
|
|
3
|
-
/**
|
|
4
|
-
* Default implementation for an account interface that uses a dapp entrypoint.
|
|
5
|
-
*/
|
|
6
|
-
export declare class DefaultDappInterface extends DefaultAccountInterface {
|
|
7
|
-
constructor(authWitnessProvider: AuthWitnessProvider, userAddress: CompleteAddress, dappAddress: AztecAddress, nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>);
|
|
8
|
-
static createFromUserWallet(wallet: AccountWallet, dappAddress: AztecAddress): DefaultDappInterface;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=dapp_interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dapp_interface.d.ts","sourceRoot":"","sources":["../../src/dapp/dapp_interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,YAAY,EACZ,eAAe,EACf,KAAK,QAAQ,EACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,uBAAuB;gBAE7D,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,eAAe,EAC5B,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAY3D,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,GAAG,oBAAoB;CAMpG"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DefaultDappEntrypoint } from '@aztec/entrypoints/dapp';
|
|
2
|
-
import { DefaultAccountInterface } from '../defaults/account_interface.js';
|
|
3
|
-
/**
|
|
4
|
-
* Default implementation for an account interface that uses a dapp entrypoint.
|
|
5
|
-
*/ export class DefaultDappInterface extends DefaultAccountInterface {
|
|
6
|
-
constructor(authWitnessProvider, userAddress, dappAddress, nodeInfo){
|
|
7
|
-
super(authWitnessProvider, userAddress, nodeInfo);
|
|
8
|
-
this.entrypoint = new DefaultDappEntrypoint(userAddress.address, authWitnessProvider, dappAddress, nodeInfo.l1ChainId, nodeInfo.protocolVersion);
|
|
9
|
-
}
|
|
10
|
-
static createFromUserWallet(wallet, dappAddress) {
|
|
11
|
-
return new DefaultDappInterface(wallet, wallet.getCompleteAddress(), dappAddress, {
|
|
12
|
-
l1ChainId: wallet.getChainId().toNumber(),
|
|
13
|
-
protocolVersion: wallet.getVersion().toNumber()
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
package/dest/dapp/index.d.ts
DELETED
package/dest/dapp/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dapp/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
package/dest/dapp/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dapp_interface.js';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import type { EntrypointInterface, ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
7
|
-
import type { NodeInfo } from '@aztec/stdlib/contract';
|
|
8
|
-
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
9
|
-
/**
|
|
10
|
-
* Default implementation for an account interface. Requires that the account uses the default
|
|
11
|
-
* entrypoint signature, which accept an AppPayload and a FeePayload as defined in noir-libs/aztec-noir/src/entrypoint module
|
|
12
|
-
*/
|
|
13
|
-
export declare class DefaultAccountInterface implements AccountInterface {
|
|
14
|
-
private authWitnessProvider;
|
|
15
|
-
private address;
|
|
16
|
-
protected entrypoint: EntrypointInterface;
|
|
17
|
-
private chainId;
|
|
18
|
-
private version;
|
|
19
|
-
constructor(authWitnessProvider: AuthWitnessProvider, address: CompleteAddress, nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>);
|
|
20
|
-
createTxExecutionRequest(execution: ExecutionRequestInit): Promise<TxExecutionRequest>;
|
|
21
|
-
createAuthWit(messageHash: Fr): Promise<AuthWitness>;
|
|
22
|
-
getCompleteAddress(): CompleteAddress;
|
|
23
|
-
getAddress(): AztecAddress;
|
|
24
|
-
getChainId(): Fr;
|
|
25
|
-
getVersion(): Fr;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=account_interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account_interface.d.ts","sourceRoot":"","sources":["../../src/defaults/account_interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAO5D,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,OAAO;IAPjB,SAAS,CAAC,UAAU,EAAE,mBAAmB,CAAC;IAE1C,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAK;gBAGV,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,eAAe,EAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAY3D,wBAAwB,CAAC,SAAS,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAItF,aAAa,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAIpD,kBAAkB,IAAI,eAAe;IAIrC,UAAU,IAAI,YAAY;IAI1B,UAAU,IAAI,EAAE;IAIhB,UAAU,IAAI,EAAE;CAGjB"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
/**
|
|
4
|
-
* Default implementation for an account interface. Requires that the account uses the default
|
|
5
|
-
* entrypoint signature, which accept an AppPayload and a FeePayload as defined in noir-libs/aztec-noir/src/entrypoint module
|
|
6
|
-
*/ export class DefaultAccountInterface {
|
|
7
|
-
authWitnessProvider;
|
|
8
|
-
address;
|
|
9
|
-
entrypoint;
|
|
10
|
-
chainId;
|
|
11
|
-
version;
|
|
12
|
-
constructor(authWitnessProvider, address, nodeInfo){
|
|
13
|
-
this.authWitnessProvider = authWitnessProvider;
|
|
14
|
-
this.address = address;
|
|
15
|
-
this.entrypoint = new DefaultAccountEntrypoint(address.address, authWitnessProvider, nodeInfo.l1ChainId, nodeInfo.protocolVersion);
|
|
16
|
-
this.chainId = new Fr(nodeInfo.l1ChainId);
|
|
17
|
-
this.version = new Fr(nodeInfo.protocolVersion);
|
|
18
|
-
}
|
|
19
|
-
createTxExecutionRequest(execution) {
|
|
20
|
-
return this.entrypoint.createTxExecutionRequest(execution);
|
|
21
|
-
}
|
|
22
|
-
createAuthWit(messageHash) {
|
|
23
|
-
return this.authWitnessProvider.createAuthWit(messageHash);
|
|
24
|
-
}
|
|
25
|
-
getCompleteAddress() {
|
|
26
|
-
return this.address;
|
|
27
|
-
}
|
|
28
|
-
getAddress() {
|
|
29
|
-
return this.address.address;
|
|
30
|
-
}
|
|
31
|
-
getChainId() {
|
|
32
|
-
return this.chainId;
|
|
33
|
-
}
|
|
34
|
-
getVersion() {
|
|
35
|
-
return this.version;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { GrumpkinScalar } from '@aztec/foundation/fields';
|
|
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
|
-
getDeploymentArgs(): Promise<undefined>;
|
|
15
|
-
getAuthWitnessProvider(account: CompleteAddress): AuthWitnessProvider;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=account_contract.d.ts.map
|
|
@@ -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;AAEnE,OAAO,EAAW,cAAc,EAAE,MAAM,0BAA0B,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;gBAApB,oBAAoB,EAAE,cAAc;IAIxD,iBAAiB;IAIjB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB;CAGtE"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Schnorr } from '@aztec/foundation/crypto';
|
|
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
|
-
getDeploymentArgs() {
|
|
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,39 +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 { AztecAddress, Fr, GrumpkinScalar } from '@aztec/aztec.js';
|
|
8
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
9
|
-
import { type AccountWallet } from '@aztec/aztec.js/wallet';
|
|
10
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
12
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
13
|
-
export declare const SchnorrSingleKeyAccountContractArtifact: ContractArtifact;
|
|
14
|
-
/**
|
|
15
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
16
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
17
|
-
* Eagerly loads the contract artifact
|
|
18
|
-
*/
|
|
19
|
-
export declare class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
20
|
-
constructor(signingPrivateKey: GrumpkinScalar);
|
|
21
|
-
getContractArtifact(): Promise<ContractArtifact>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Creates an Account that uses the same Grumpkin key for encryption and authentication.
|
|
25
|
-
* @param pxe - An PXE server instance.
|
|
26
|
-
* @param secretKey - Secret key used to derive all the keystore keys (in this case also used to get signing key).
|
|
27
|
-
* @param salt - Deployment salt.
|
|
28
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
29
|
-
*/
|
|
30
|
-
export declare function getUnsafeSchnorrAccount(pxe: PXE, secretKey: Fr, salt?: Salt): Promise<AccountManager>;
|
|
31
|
-
/**
|
|
32
|
-
* Gets a wallet for an already registered account using Schnorr signatures with a single key for encryption and authentication.
|
|
33
|
-
* @param pxe - An PXE server instance.
|
|
34
|
-
* @param address - Address for the account.
|
|
35
|
-
* @param signingPrivateKey - Grumpkin key used for note encryption and signing transactions.
|
|
36
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
37
|
-
*/
|
|
38
|
-
export declare function getUnsafeSchnorrWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: GrumpkinScalar): Promise<AccountWallet>;
|
|
39
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,YAAY,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAK3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,eAAO,MAAM,uCAAuC,kBAEnD,CAAC;AAEF;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;gBAC5D,iBAAiB,EAAE,cAAc;IAIpC,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAG1D;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,2BAG3E;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,YAAY,EACrB,iBAAiB,EAAE,cAAc,GAChC,OAAO,CAAC,aAAa,CAAC,CAExB"}
|
package/dest/single_key/index.js
DELETED
|
@@ -1,45 +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 { AccountManager } from '@aztec/aztec.js/account';
|
|
7
|
-
import { getWallet } from '@aztec/aztec.js/wallet';
|
|
8
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import { deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
|
|
10
|
-
import SchnorrSingleKeyAccountContractJson from '../../artifacts/SchnorrSingleKeyAccount.json' assert {
|
|
11
|
-
type: 'json'
|
|
12
|
-
};
|
|
13
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
14
|
-
export const SchnorrSingleKeyAccountContractArtifact = loadContractArtifact(SchnorrSingleKeyAccountContractJson);
|
|
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
|
-
* Eagerly loads the contract artifact
|
|
19
|
-
*/ export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
20
|
-
constructor(signingPrivateKey){
|
|
21
|
-
super(signingPrivateKey);
|
|
22
|
-
}
|
|
23
|
-
getContractArtifact() {
|
|
24
|
-
return Promise.resolve(SchnorrSingleKeyAccountContractArtifact);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Creates an Account that uses the same Grumpkin key for encryption and authentication.
|
|
29
|
-
* @param pxe - An PXE server instance.
|
|
30
|
-
* @param secretKey - Secret key used to derive all the keystore keys (in this case also used to get signing key).
|
|
31
|
-
* @param salt - Deployment salt.
|
|
32
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
33
|
-
*/ export function getUnsafeSchnorrAccount(pxe, secretKey, salt) {
|
|
34
|
-
const encryptionPrivateKey = deriveMasterIncomingViewingSecretKey(secretKey);
|
|
35
|
-
return AccountManager.create(pxe, secretKey, new SingleKeyAccountContract(encryptionPrivateKey), salt);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Gets a wallet for an already registered account using Schnorr signatures with a single key for encryption and authentication.
|
|
39
|
-
* @param pxe - An PXE server instance.
|
|
40
|
-
* @param address - Address for the account.
|
|
41
|
-
* @param signingPrivateKey - Grumpkin key used for note encryption and signing transactions.
|
|
42
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
43
|
-
*/ export function getUnsafeSchnorrWallet(pxe, address, signingPrivateKey) {
|
|
44
|
-
return getWallet(pxe, address, new SingleKeyAccountContract(signingPrivateKey));
|
|
45
|
-
}
|
|
@@ -1,43 +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 { AztecAddress, Fr, GrumpkinScalar } from '@aztec/aztec.js';
|
|
8
|
-
import { AccountManager, type Salt } from '@aztec/aztec.js/account';
|
|
9
|
-
import { type AccountWallet } from '@aztec/aztec.js/wallet';
|
|
10
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
11
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
12
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
13
|
-
/**
|
|
14
|
-
* Lazily loads the contract artifact
|
|
15
|
-
* @returns The contract artifact for the single key account contract
|
|
16
|
-
*/
|
|
17
|
-
export declare function getSingleKeyAccountContractArtifact(): Promise<ContractArtifact>;
|
|
18
|
-
/**
|
|
19
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
20
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
21
|
-
* Lazily loads the contract artifact
|
|
22
|
-
*/
|
|
23
|
-
export declare class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
24
|
-
constructor(signingPrivateKey: GrumpkinScalar);
|
|
25
|
-
getContractArtifact(): Promise<ContractArtifact>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Creates an Account that uses the same Grumpkin key for encryption and authentication.
|
|
29
|
-
* @param pxe - An PXE server instance.
|
|
30
|
-
* @param secretKey - Secret key used to derive all the keystore keys (in this case also used to get signing key).
|
|
31
|
-
* @param salt - Deployment salt.
|
|
32
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
33
|
-
*/
|
|
34
|
-
export declare function getUnsafeSchnorrAccount(pxe: PXE, secretKey: Fr, salt?: Salt): Promise<AccountManager>;
|
|
35
|
-
/**
|
|
36
|
-
* Gets a wallet for an already registered account using Schnorr signatures with a single key for encryption and authentication.
|
|
37
|
-
* @param pxe - An PXE server instance.
|
|
38
|
-
* @param address - Address for the account.
|
|
39
|
-
* @param signingPrivateKey - Grumpkin key used for note encryption and signing transactions.
|
|
40
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
41
|
-
*/
|
|
42
|
-
export declare function getUnsafeSchnorrWallet(pxe: PXE, address: AztecAddress, signingPrivateKey: GrumpkinScalar): Promise<AccountWallet>;
|
|
43
|
-
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -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,YAAY,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;GAGG;AACH,wBAAsB,mCAAmC,8BAQxD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;gBAC5D,iBAAiB,EAAE,cAAc;IAIpC,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAG1D;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,2BAG3E;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,YAAY,EACrB,iBAAiB,EAAE,cAAc,GAChC,OAAO,CAAC,aAAa,CAAC,CAExB"}
|
package/dest/single_key/lazy.js
DELETED
|
@@ -1,53 +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 { AccountManager } from '@aztec/aztec.js/account';
|
|
7
|
-
import { getWallet } from '@aztec/aztec.js/wallet';
|
|
8
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import { deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
|
|
10
|
-
import { SingleKeyBaseAccountContract } from './account_contract.js';
|
|
11
|
-
/**
|
|
12
|
-
* Lazily loads the contract artifact
|
|
13
|
-
* @returns The contract artifact for the single key account contract
|
|
14
|
-
*/ export async function getSingleKeyAccountContractArtifact() {
|
|
15
|
-
// Cannot assert this import as it's incompatible with browsers
|
|
16
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
|
|
17
|
-
// Use the new "with" syntax once supported by firefox
|
|
18
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
|
|
19
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
20
|
-
const { default: schnorrAccountContractJson } = await import('../../artifacts/SchnorrAccount.json');
|
|
21
|
-
return loadContractArtifact(schnorrAccountContractJson);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
25
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
26
|
-
* Lazily loads the contract artifact
|
|
27
|
-
*/ export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
|
|
28
|
-
constructor(signingPrivateKey){
|
|
29
|
-
super(signingPrivateKey);
|
|
30
|
-
}
|
|
31
|
-
getContractArtifact() {
|
|
32
|
-
return getSingleKeyAccountContractArtifact();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Creates an Account that uses the same Grumpkin key for encryption and authentication.
|
|
37
|
-
* @param pxe - An PXE server instance.
|
|
38
|
-
* @param secretKey - Secret key used to derive all the keystore keys (in this case also used to get signing key).
|
|
39
|
-
* @param salt - Deployment salt.
|
|
40
|
-
* @returns An account manager initialized with the account contract and its deployment params
|
|
41
|
-
*/ export function getUnsafeSchnorrAccount(pxe, secretKey, salt) {
|
|
42
|
-
const encryptionPrivateKey = deriveMasterIncomingViewingSecretKey(secretKey);
|
|
43
|
-
return AccountManager.create(pxe, secretKey, new SingleKeyAccountContract(encryptionPrivateKey), salt);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Gets a wallet for an already registered account using Schnorr signatures with a single key for encryption and authentication.
|
|
47
|
-
* @param pxe - An PXE server instance.
|
|
48
|
-
* @param address - Address for the account.
|
|
49
|
-
* @param signingPrivateKey - Grumpkin key used for note encryption and signing transactions.
|
|
50
|
-
* @returns A wallet for this account that can be used to interact with a contract instance.
|
|
51
|
-
*/ export function getUnsafeSchnorrWallet(pxe, address, signingPrivateKey) {
|
|
52
|
-
return getWallet(pxe, address, new SingleKeyAccountContract(signingPrivateKey));
|
|
53
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type AccountManager, type PXE, type WaitOpts } from '@aztec/aztec.js';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import type { InitialAccountData } from './configuration.js';
|
|
4
|
-
/**
|
|
5
|
-
* Generate a fixed amount of random schnorr account contract instance.
|
|
6
|
-
*/
|
|
7
|
-
export declare function generateSchnorrAccounts(numberOfAccounts: number): Promise<{
|
|
8
|
-
secret: Fr;
|
|
9
|
-
signingKey: import("@aztec/aztec.js").Fq;
|
|
10
|
-
salt: Fr;
|
|
11
|
-
address: import("@aztec/aztec.js").AztecAddress;
|
|
12
|
-
}[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Data for deploying funded account.
|
|
15
|
-
*/
|
|
16
|
-
type DeployAccountData = Pick<InitialAccountData, 'secret' | 'salt'> & {
|
|
17
|
-
/**
|
|
18
|
-
* An optional signingKey if it's not derived from the secret.
|
|
19
|
-
*/
|
|
20
|
-
signingKey?: InitialAccountData['signingKey'];
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Deploy schnorr account contract.
|
|
24
|
-
* It will pay for the fee for the deployment itself. So it must be funded with the prefilled public data.
|
|
25
|
-
*/
|
|
26
|
-
export declare function deployFundedSchnorrAccount(pxe: PXE, account: DeployAccountData, opts?: WaitOpts & {
|
|
27
|
-
/**
|
|
28
|
-
* Whether or not to skip registering contract class.
|
|
29
|
-
*/
|
|
30
|
-
skipClassRegistration?: boolean;
|
|
31
|
-
}): Promise<AccountManager>;
|
|
32
|
-
/**
|
|
33
|
-
* Deploy schnorr account contracts.
|
|
34
|
-
* They will pay for the fees for the deployment themselves. So they must be funded with the prefilled public data.
|
|
35
|
-
*/
|
|
36
|
-
export declare function deployFundedSchnorrAccounts(pxe: PXE, accounts: DeployAccountData[], opts?: WaitOpts & {
|
|
37
|
-
/**
|
|
38
|
-
* Whether or not to skip registering contract class.
|
|
39
|
-
*/
|
|
40
|
-
skipClassRegistration?: boolean;
|
|
41
|
-
}): Promise<AccountManager[]>;
|
|
42
|
-
export {};
|
|
43
|
-
//# sourceMappingURL=create_account.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/testing/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM;;;;;KAarE;AAED;;GAEG;AACH,KAAK,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,iBAAiB,EAC1B,IAAI,GAAE,QAAQ,GAAG;IACf;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACiB,GAClD,OAAO,CAAC,cAAc,CAAC,CAiBzB;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,IAAI,GAAE,QAAQ,GAAG;IACf;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACiB,GAClD,OAAO,CAAC,cAAc,EAAE,CAAC,CAY3B"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { FeeJuicePaymentMethod } from '@aztec/aztec.js';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
4
|
-
import { getSchnorrAccount, getSchnorrAccountContractAddress } from '../schnorr/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* Generate a fixed amount of random schnorr account contract instance.
|
|
7
|
-
*/ export async function generateSchnorrAccounts(numberOfAccounts) {
|
|
8
|
-
const secrets = Array.from({
|
|
9
|
-
length: numberOfAccounts
|
|
10
|
-
}, ()=>Fr.random());
|
|
11
|
-
return await Promise.all(secrets.map(async (secret)=>{
|
|
12
|
-
const salt = Fr.random();
|
|
13
|
-
return {
|
|
14
|
-
secret,
|
|
15
|
-
signingKey: deriveSigningKey(secret),
|
|
16
|
-
salt,
|
|
17
|
-
address: await getSchnorrAccountContractAddress(secret, salt)
|
|
18
|
-
};
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Deploy schnorr account contract.
|
|
23
|
-
* It will pay for the fee for the deployment itself. So it must be funded with the prefilled public data.
|
|
24
|
-
*/ export async function deployFundedSchnorrAccount(pxe, account, opts = {
|
|
25
|
-
interval: 0.1,
|
|
26
|
-
skipClassRegistration: false
|
|
27
|
-
}) {
|
|
28
|
-
const signingKey = account.signingKey ?? deriveSigningKey(account.secret);
|
|
29
|
-
const accountManager = await getSchnorrAccount(pxe, account.secret, signingKey, account.salt);
|
|
30
|
-
// Pay the fee by the account itself.
|
|
31
|
-
// This only works when the world state is prefilled with the balance for the account in test environment.
|
|
32
|
-
const paymentMethod = new FeeJuicePaymentMethod(accountManager.getAddress());
|
|
33
|
-
await accountManager.deploy({
|
|
34
|
-
skipClassRegistration: opts.skipClassRegistration,
|
|
35
|
-
skipPublicDeployment: true,
|
|
36
|
-
fee: {
|
|
37
|
-
paymentMethod
|
|
38
|
-
}
|
|
39
|
-
}).wait(opts);
|
|
40
|
-
return accountManager;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Deploy schnorr account contracts.
|
|
44
|
-
* They will pay for the fees for the deployment themselves. So they must be funded with the prefilled public data.
|
|
45
|
-
*/ export async function deployFundedSchnorrAccounts(pxe, accounts, opts = {
|
|
46
|
-
interval: 0.1,
|
|
47
|
-
skipClassRegistration: false
|
|
48
|
-
}) {
|
|
49
|
-
const accountManagers = [];
|
|
50
|
-
// Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
|
|
51
|
-
for(let i = 0; i < accounts.length; i++){
|
|
52
|
-
accountManagers.push(await deployFundedSchnorrAccount(pxe, accounts[i], {
|
|
53
|
-
...opts,
|
|
54
|
-
skipClassRegistration: i !== 0 || opts.skipClassRegistration
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
return accountManagers;
|
|
58
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AccountWallet,
|
|
3
|
-
type AuthWitnessProvider,
|
|
4
|
-
AztecAddress,
|
|
5
|
-
CompleteAddress,
|
|
6
|
-
type NodeInfo,
|
|
7
|
-
} from '@aztec/aztec.js';
|
|
8
|
-
import { DefaultDappEntrypoint } from '@aztec/entrypoints/dapp';
|
|
9
|
-
|
|
10
|
-
import { DefaultAccountInterface } from '../defaults/account_interface.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Default implementation for an account interface that uses a dapp entrypoint.
|
|
14
|
-
*/
|
|
15
|
-
export class DefaultDappInterface extends DefaultAccountInterface {
|
|
16
|
-
constructor(
|
|
17
|
-
authWitnessProvider: AuthWitnessProvider,
|
|
18
|
-
userAddress: CompleteAddress,
|
|
19
|
-
dappAddress: AztecAddress,
|
|
20
|
-
nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>,
|
|
21
|
-
) {
|
|
22
|
-
super(authWitnessProvider, userAddress, nodeInfo);
|
|
23
|
-
this.entrypoint = new DefaultDappEntrypoint(
|
|
24
|
-
userAddress.address,
|
|
25
|
-
authWitnessProvider,
|
|
26
|
-
dappAddress,
|
|
27
|
-
nodeInfo.l1ChainId,
|
|
28
|
-
nodeInfo.protocolVersion,
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static createFromUserWallet(wallet: AccountWallet, dappAddress: AztecAddress): DefaultDappInterface {
|
|
33
|
-
return new DefaultDappInterface(wallet, wallet.getCompleteAddress(), dappAddress, {
|
|
34
|
-
l1ChainId: wallet.getChainId().toNumber(),
|
|
35
|
-
protocolVersion: wallet.getVersion().toNumber(),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/dapp/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dapp_interface.js';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import type { EntrypointInterface, ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
|
|
3
|
-
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
8
|
-
import type { NodeInfo } from '@aztec/stdlib/contract';
|
|
9
|
-
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Default implementation for an account interface. Requires that the account uses the default
|
|
13
|
-
* entrypoint signature, which accept an AppPayload and a FeePayload as defined in noir-libs/aztec-noir/src/entrypoint module
|
|
14
|
-
*/
|
|
15
|
-
export class DefaultAccountInterface implements AccountInterface {
|
|
16
|
-
protected entrypoint: EntrypointInterface;
|
|
17
|
-
|
|
18
|
-
private chainId: Fr;
|
|
19
|
-
private version: Fr;
|
|
20
|
-
|
|
21
|
-
constructor(
|
|
22
|
-
private authWitnessProvider: AuthWitnessProvider,
|
|
23
|
-
private address: CompleteAddress,
|
|
24
|
-
nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>,
|
|
25
|
-
) {
|
|
26
|
-
this.entrypoint = new DefaultAccountEntrypoint(
|
|
27
|
-
address.address,
|
|
28
|
-
authWitnessProvider,
|
|
29
|
-
nodeInfo.l1ChainId,
|
|
30
|
-
nodeInfo.protocolVersion,
|
|
31
|
-
);
|
|
32
|
-
this.chainId = new Fr(nodeInfo.l1ChainId);
|
|
33
|
-
this.version = new Fr(nodeInfo.protocolVersion);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
createTxExecutionRequest(execution: ExecutionRequestInit): Promise<TxExecutionRequest> {
|
|
37
|
-
return this.entrypoint.createTxExecutionRequest(execution);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
createAuthWit(messageHash: Fr): Promise<AuthWitness> {
|
|
41
|
-
return this.authWitnessProvider.createAuthWit(messageHash);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getCompleteAddress(): CompleteAddress {
|
|
45
|
-
return this.address;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
getAddress(): AztecAddress {
|
|
49
|
-
return this.address.address;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
getChainId(): Fr {
|
|
53
|
-
return this.chainId;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getVersion(): Fr {
|
|
57
|
-
return this.version;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import { Schnorr } from '@aztec/foundation/crypto';
|
|
3
|
-
import { type Fr, GrumpkinScalar } from '@aztec/foundation/fields';
|
|
4
|
-
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
|
-
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
|
-
|
|
7
|
-
import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Account contract that authenticates transactions using Schnorr signatures verified against
|
|
11
|
-
* the note encryption key, relying on a single private key for both encryption and authentication.
|
|
12
|
-
* This abstract version does not provide a way to retrieve the artifact, as it
|
|
13
|
-
* can be implemented with or without lazy loading.
|
|
14
|
-
*/
|
|
15
|
-
export abstract class SingleKeyBaseAccountContract extends DefaultAccountContract {
|
|
16
|
-
constructor(private encryptionPrivateKey: GrumpkinScalar) {
|
|
17
|
-
super();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getDeploymentArgs() {
|
|
21
|
-
return Promise.resolve(undefined);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getAuthWitnessProvider(account: CompleteAddress): AuthWitnessProvider {
|
|
25
|
-
return new SingleKeyAuthWitnessProvider(this.encryptionPrivateKey, account);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Creates auth witnesses using Schnorr signatures and including the partial address and public key
|
|
31
|
-
* in the witness, so verifiers do not need to store the public key and can instead validate it
|
|
32
|
-
* by reconstructing the current address.
|
|
33
|
-
*/
|
|
34
|
-
class SingleKeyAuthWitnessProvider implements AuthWitnessProvider {
|
|
35
|
-
constructor(private privateKey: GrumpkinScalar, private account: CompleteAddress) {}
|
|
36
|
-
|
|
37
|
-
async createAuthWit(messageHash: Fr): Promise<AuthWitness> {
|
|
38
|
-
const schnorr = new Schnorr();
|
|
39
|
-
const signature = await schnorr.constructSignature(messageHash.toBuffer(), this.privateKey);
|
|
40
|
-
const witness = [...this.account.publicKeys.toFields(), ...signature.toBuffer(), this.account.partialAddress];
|
|
41
|
-
return Promise.resolve(new AuthWitness(messageHash, witness));
|
|
42
|
-
}
|
|
43
|
-
}
|