@aztec/accounts 0.80.0 → 0.82.0
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/artifacts/EcdsaKAccount.json +1450 -1246
- package/artifacts/EcdsaRAccount.json +1759 -1555
- package/artifacts/SchnorrAccount.json +1826 -1574
- package/artifacts/SchnorrSingleKeyAccount.json +758 -614
- package/dest/defaults/account_contract.d.ts +6 -1
- package/dest/defaults/account_contract.d.ts.map +1 -1
- package/dest/defaults/account_interface.d.ts +3 -2
- package/dest/defaults/account_interface.d.ts.map +1 -1
- package/dest/defaults/account_interface.js +2 -2
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts +4 -1
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts.map +1 -1
- package/dest/ecdsa/ecdsa_k/account_contract.js +8 -5
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +4 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts.map +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +8 -5
- package/dest/schnorr/account_contract.d.ts +4 -1
- package/dest/schnorr/account_contract.d.ts.map +1 -1
- package/dest/schnorr/account_contract.js +8 -5
- package/dest/single_key/account_contract.d.ts +1 -1
- package/dest/single_key/account_contract.d.ts.map +1 -1
- package/dest/single_key/account_contract.js +1 -1
- package/dest/testing/create_account.d.ts +3 -3
- package/dest/testing/create_account.d.ts.map +1 -1
- package/dest/testing/create_account.js +8 -5
- package/package.json +6 -6
- package/src/defaults/account_contract.ts +9 -1
- package/src/defaults/account_interface.ts +8 -3
- package/src/ecdsa/ecdsa_k/account_contract.ts +5 -2
- package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +5 -2
- package/src/schnorr/account_contract.ts +2 -2
- package/src/single_key/account_contract.ts +1 -1
- package/src/testing/create_account.ts +24 -6
|
@@ -7,7 +7,12 @@ import type { CompleteAddress, NodeInfo } from '@aztec/stdlib/contract';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare abstract class DefaultAccountContract implements AccountContract {
|
|
9
9
|
abstract getAuthWitnessProvider(address: CompleteAddress): AuthWitnessProvider;
|
|
10
|
-
abstract
|
|
10
|
+
abstract getDeploymentFunctionAndArgs(): Promise<{
|
|
11
|
+
/** The name of the function used to deploy the contract */
|
|
12
|
+
constructorName: string;
|
|
13
|
+
/** The args to the function used to deploy the contract */
|
|
14
|
+
constructorArgs: any[];
|
|
15
|
+
} | undefined>;
|
|
11
16
|
abstract getContractArtifact(): Promise<ContractArtifact>;
|
|
12
17
|
constructor();
|
|
13
18
|
getInterface(address: CompleteAddress, nodeInfo: NodeInfo): AccountInterface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../src/defaults/account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACtG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIxE;;;GAGG;AACH,8BAAsB,sBAAuB,YAAW,eAAe;IACrE,QAAQ,CAAC,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB;IAC9E,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../src/defaults/account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACtG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIxE;;;GAGG;AACH,8BAAsB,sBAAuB,YAAW,eAAe;IACrE,QAAQ,CAAC,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB;IAC9E,QAAQ,CAAC,4BAA4B,IAAI,OAAO,CAC5C;QACE,2DAA2D;QAC3D,eAAe,EAAE,MAAM,CAAC;QACxB,2DAA2D;QAC3D,eAAe,EAAE,GAAG,EAAE,CAAC;KACxB,GACD,SAAS,CACZ;IACD,QAAQ,CAAC,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;;IAIzD,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB;CAG7E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import type { EntrypointInterface,
|
|
2
|
+
import type { EntrypointInterface, FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
3
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
5
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -17,7 +18,7 @@ export declare class DefaultAccountInterface implements AccountInterface {
|
|
|
17
18
|
private chainId;
|
|
18
19
|
private version;
|
|
19
20
|
constructor(authWitnessProvider: AuthWitnessProvider, address: CompleteAddress, nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>);
|
|
20
|
-
createTxExecutionRequest(
|
|
21
|
+
createTxExecutionRequest(exec: ExecutionPayload, fee: FeeOptions, options: TxExecutionOptions): Promise<TxExecutionRequest>;
|
|
21
22
|
createAuthWit(messageHash: Fr): Promise<AuthWitness>;
|
|
22
23
|
getCompleteAddress(): CompleteAddress;
|
|
23
24
|
getAddress(): AztecAddress;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAErF,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,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,CACtB,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IAI9B,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"}
|
|
@@ -16,8 +16,8 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
16
16
|
this.chainId = new Fr(nodeInfo.l1ChainId);
|
|
17
17
|
this.version = new Fr(nodeInfo.protocolVersion);
|
|
18
18
|
}
|
|
19
|
-
createTxExecutionRequest(
|
|
20
|
-
return this.entrypoint.createTxExecutionRequest(
|
|
19
|
+
createTxExecutionRequest(exec, fee, options) {
|
|
20
|
+
return this.entrypoint.createTxExecutionRequest(exec, fee, options);
|
|
21
21
|
}
|
|
22
22
|
createAuthWit(messageHash) {
|
|
23
23
|
return this.authWitnessProvider.createAuthWit(messageHash);
|
|
@@ -12,7 +12,10 @@ import { DefaultAccountContract } from '../../defaults/account_contract.js';
|
|
|
12
12
|
export declare abstract class EcdsaKBaseAccountContract extends DefaultAccountContract {
|
|
13
13
|
private signingPrivateKey;
|
|
14
14
|
constructor(signingPrivateKey: Buffer);
|
|
15
|
-
|
|
15
|
+
getDeploymentFunctionAndArgs(): Promise<{
|
|
16
|
+
constructorName: string;
|
|
17
|
+
constructorArgs: Buffer[];
|
|
18
|
+
}>;
|
|
16
19
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
|
|
17
20
|
}
|
|
18
21
|
//# sourceMappingURL=account_contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/ecdsa_k/account_contract.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;;;GAKG;AACH,8BAAsB,yBAA0B,SAAQ,sBAAsB;IAChE,OAAO,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,MAAM;IAIvC,
|
|
1
|
+
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/ecdsa_k/account_contract.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;;;GAKG;AACH,8BAAsB,yBAA0B,SAAQ,sBAAsB;IAChE,OAAO,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,MAAM;IAIvC,4BAA4B;;;;IAQlC,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB;CAGvE"}
|
|
@@ -11,12 +11,15 @@ import { DefaultAccountContract } from '../../defaults/account_contract.js';
|
|
|
11
11
|
constructor(signingPrivateKey){
|
|
12
12
|
super(), this.signingPrivateKey = signingPrivateKey;
|
|
13
13
|
}
|
|
14
|
-
async
|
|
14
|
+
async getDeploymentFunctionAndArgs() {
|
|
15
15
|
const signingPublicKey = await new Ecdsa().computePublicKey(this.signingPrivateKey);
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
return {
|
|
17
|
+
constructorName: 'constructor',
|
|
18
|
+
constructorArgs: [
|
|
19
|
+
signingPublicKey.subarray(0, 32),
|
|
20
|
+
signingPublicKey.subarray(32, 64)
|
|
21
|
+
]
|
|
22
|
+
};
|
|
20
23
|
}
|
|
21
24
|
getAuthWitnessProvider(_address) {
|
|
22
25
|
return new EcdsaKAuthWitnessProvider(this.signingPrivateKey);
|
|
@@ -15,7 +15,10 @@ import { DefaultAccountContract } from '../../defaults/account_contract.js';
|
|
|
15
15
|
export declare abstract class EcdsaRSSHBaseAccountContract extends DefaultAccountContract {
|
|
16
16
|
private signingPublicKey;
|
|
17
17
|
constructor(signingPublicKey: Buffer);
|
|
18
|
-
|
|
18
|
+
getDeploymentFunctionAndArgs(): Promise<{
|
|
19
|
+
constructorName: string;
|
|
20
|
+
constructorArgs: Buffer[];
|
|
21
|
+
}>;
|
|
19
22
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
|
|
20
23
|
}
|
|
21
24
|
//# sourceMappingURL=account_contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/ssh_ecdsa_r/account_contract.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAI5E;;;;;;;;GAQG;AACH,8BAAsB,4BAA6B,SAAQ,sBAAsB;IACnE,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,MAAM;IAI5C,
|
|
1
|
+
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/ssh_ecdsa_r/account_contract.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAI5E;;;;;;;;GAQG;AACH,8BAAsB,4BAA6B,SAAQ,sBAAsB;IACnE,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,MAAM;IAI5C,4BAA4B;;;;IAO5B,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB;CAGvE"}
|
|
@@ -16,11 +16,14 @@ const secp256r1N = 1157920892103562487626974469494075735299969552241357603424222
|
|
|
16
16
|
constructor(signingPublicKey){
|
|
17
17
|
super(), this.signingPublicKey = signingPublicKey;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
return Promise.resolve(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
getDeploymentFunctionAndArgs() {
|
|
20
|
+
return Promise.resolve({
|
|
21
|
+
constructorName: 'constructor',
|
|
22
|
+
constructorArgs: [
|
|
23
|
+
this.signingPublicKey.subarray(0, 32),
|
|
24
|
+
this.signingPublicKey.subarray(32, 64)
|
|
25
|
+
]
|
|
26
|
+
});
|
|
24
27
|
}
|
|
25
28
|
getAuthWitnessProvider(_address) {
|
|
26
29
|
return new SSHEcdsaRAuthWitnessProvider(this.signingPublicKey);
|
|
@@ -12,7 +12,10 @@ import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
|
12
12
|
export declare abstract class SchnorrBaseAccountContract extends DefaultAccountContract {
|
|
13
13
|
private signingPrivateKey;
|
|
14
14
|
constructor(signingPrivateKey: GrumpkinScalar);
|
|
15
|
-
|
|
15
|
+
getDeploymentFunctionAndArgs(): Promise<{
|
|
16
|
+
constructorName: string;
|
|
17
|
+
constructorArgs: Fr[];
|
|
18
|
+
}>;
|
|
16
19
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
|
|
17
20
|
}
|
|
18
21
|
/** Creates auth witnesses using Schnorr signatures. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../src/schnorr/account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE;;;;;GAKG;AACH,8BAAsB,0BAA2B,SAAQ,sBAAsB;IACjE,OAAO,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,cAAc;IAI/C,
|
|
1
|
+
{"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../src/schnorr/account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE;;;;;GAKG;AACH,8BAAsB,0BAA2B,SAAQ,sBAAsB;IACjE,OAAO,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,cAAc;IAI/C,4BAA4B;;;;IAKlC,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB;CAGvE;AAED,uDAAuD;AACvD,qBAAa,0BAA2B,YAAW,mBAAmB;IACxD,OAAO,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,cAAc;IAE/C,aAAa,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;CAK3D"}
|
|
@@ -11,12 +11,15 @@ import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
|
11
11
|
constructor(signingPrivateKey){
|
|
12
12
|
super(), this.signingPrivateKey = signingPrivateKey;
|
|
13
13
|
}
|
|
14
|
-
async
|
|
14
|
+
async getDeploymentFunctionAndArgs() {
|
|
15
15
|
const signingPublicKey = await new Schnorr().computePublicKey(this.signingPrivateKey);
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
return {
|
|
17
|
+
constructorName: 'constructor',
|
|
18
|
+
constructorArgs: [
|
|
19
|
+
signingPublicKey.x,
|
|
20
|
+
signingPublicKey.y
|
|
21
|
+
]
|
|
22
|
+
};
|
|
20
23
|
}
|
|
21
24
|
getAuthWitnessProvider(_address) {
|
|
22
25
|
return new SchnorrAuthWitnessProvider(this.signingPrivateKey);
|
|
@@ -11,7 +11,7 @@ import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
|
11
11
|
export declare abstract class SingleKeyBaseAccountContract extends DefaultAccountContract {
|
|
12
12
|
private encryptionPrivateKey;
|
|
13
13
|
constructor(encryptionPrivateKey: GrumpkinScalar);
|
|
14
|
-
|
|
14
|
+
getDeploymentFunctionAndArgs(): Promise<undefined>;
|
|
15
15
|
getAuthWitnessProvider(account: CompleteAddress): AuthWitnessProvider;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=account_contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,4BAA4B;IAI5B,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB;CAGtE"}
|
|
@@ -11,7 +11,7 @@ import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
|
11
11
|
constructor(encryptionPrivateKey){
|
|
12
12
|
super(), this.encryptionPrivateKey = encryptionPrivateKey;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
getDeploymentFunctionAndArgs() {
|
|
15
15
|
return Promise.resolve(undefined);
|
|
16
16
|
}
|
|
17
17
|
getAuthWitnessProvider(account) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AccountManager, type PXE, type WaitOpts } from '@aztec/aztec.js';
|
|
1
|
+
import { type AccountManager, type PXE, type WaitForProvenOpts, type WaitOpts } from '@aztec/aztec.js';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import type { InitialAccountData } from './configuration.js';
|
|
4
4
|
/**
|
|
@@ -28,7 +28,7 @@ export declare function deployFundedSchnorrAccount(pxe: PXE, account: DeployAcco
|
|
|
28
28
|
* Whether or not to skip registering contract class.
|
|
29
29
|
*/
|
|
30
30
|
skipClassRegistration?: boolean;
|
|
31
|
-
}): Promise<AccountManager>;
|
|
31
|
+
}, waitForProvenOptions?: WaitForProvenOpts): Promise<AccountManager>;
|
|
32
32
|
/**
|
|
33
33
|
* Deploy schnorr account contracts.
|
|
34
34
|
* They will pay for the fees for the deployment themselves. So they must be funded with the prefilled public data.
|
|
@@ -38,6 +38,6 @@ export declare function deployFundedSchnorrAccounts(pxe: PXE, accounts: DeployAc
|
|
|
38
38
|
* Whether or not to skip registering contract class.
|
|
39
39
|
*/
|
|
40
40
|
skipClassRegistration?: boolean;
|
|
41
|
-
}): Promise<AccountManager[]>;
|
|
41
|
+
}, waitForProvenOptions?: WaitForProvenOpts): Promise<AccountManager[]>;
|
|
42
42
|
export {};
|
|
43
43
|
//# sourceMappingURL=create_account.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/testing/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/testing/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,GAAG,EACR,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EAEd,MAAM,iBAAiB,CAAC;AACzB,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,EACnD,oBAAoB,CAAC,EAAE,iBAAiB,GACvC,OAAO,CAAC,cAAc,CAAC,CAqBzB;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,EACnD,oBAAoB,CAAC,EAAE,iBAAiB,GACvC,OAAO,CAAC,cAAc,EAAE,CAAC,CAiB3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeeJuicePaymentMethod } from '@aztec/aztec.js';
|
|
1
|
+
import { FeeJuicePaymentMethod, waitForProven } from '@aztec/aztec.js';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
4
4
|
import { getSchnorrAccount, getSchnorrAccountContractAddress } from '../schnorr/index.js';
|
|
@@ -24,19 +24,22 @@ import { getSchnorrAccount, getSchnorrAccountContractAddress } from '../schnorr/
|
|
|
24
24
|
*/ export async function deployFundedSchnorrAccount(pxe, account, opts = {
|
|
25
25
|
interval: 0.1,
|
|
26
26
|
skipClassRegistration: false
|
|
27
|
-
}) {
|
|
27
|
+
}, waitForProvenOptions) {
|
|
28
28
|
const signingKey = account.signingKey ?? deriveSigningKey(account.secret);
|
|
29
29
|
const accountManager = await getSchnorrAccount(pxe, account.secret, signingKey, account.salt);
|
|
30
30
|
// Pay the fee by the account itself.
|
|
31
31
|
// This only works when the world state is prefilled with the balance for the account in test environment.
|
|
32
32
|
const paymentMethod = new FeeJuicePaymentMethod(accountManager.getAddress());
|
|
33
|
-
await accountManager.deploy({
|
|
33
|
+
const receipt = await accountManager.deploy({
|
|
34
34
|
skipClassRegistration: opts.skipClassRegistration,
|
|
35
35
|
skipPublicDeployment: true,
|
|
36
36
|
fee: {
|
|
37
37
|
paymentMethod
|
|
38
38
|
}
|
|
39
39
|
}).wait(opts);
|
|
40
|
+
if (waitForProvenOptions !== undefined) {
|
|
41
|
+
await waitForProven(pxe, receipt, waitForProvenOptions);
|
|
42
|
+
}
|
|
40
43
|
return accountManager;
|
|
41
44
|
}
|
|
42
45
|
/**
|
|
@@ -45,14 +48,14 @@ import { getSchnorrAccount, getSchnorrAccountContractAddress } from '../schnorr/
|
|
|
45
48
|
*/ export async function deployFundedSchnorrAccounts(pxe, accounts, opts = {
|
|
46
49
|
interval: 0.1,
|
|
47
50
|
skipClassRegistration: false
|
|
48
|
-
}) {
|
|
51
|
+
}, waitForProvenOptions) {
|
|
49
52
|
const accountManagers = [];
|
|
50
53
|
// Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
|
|
51
54
|
for(let i = 0; i < accounts.length; i++){
|
|
52
55
|
accountManagers.push(await deployFundedSchnorrAccount(pxe, accounts[i], {
|
|
53
56
|
...opts,
|
|
54
57
|
skipClassRegistration: i !== 0 || opts.skipClassRegistration
|
|
55
|
-
}));
|
|
58
|
+
}, waitForProvenOptions));
|
|
56
59
|
}
|
|
57
60
|
return accountManagers;
|
|
58
61
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.
|
|
5
|
+
"version": "0.82.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./dapp": "./dest/dapp/index.js",
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@aztec/aztec.js": "0.
|
|
81
|
-
"@aztec/entrypoints": "0.
|
|
82
|
-
"@aztec/ethereum": "0.
|
|
83
|
-
"@aztec/foundation": "0.
|
|
84
|
-
"@aztec/stdlib": "0.
|
|
80
|
+
"@aztec/aztec.js": "0.82.0",
|
|
81
|
+
"@aztec/entrypoints": "0.82.0",
|
|
82
|
+
"@aztec/ethereum": "0.82.0",
|
|
83
|
+
"@aztec/foundation": "0.82.0",
|
|
84
|
+
"@aztec/stdlib": "0.82.0",
|
|
85
85
|
"tslib": "^2.4.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
@@ -10,7 +10,15 @@ import { DefaultAccountInterface } from '../defaults/account_interface.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export abstract class DefaultAccountContract implements AccountContract {
|
|
12
12
|
abstract getAuthWitnessProvider(address: CompleteAddress): AuthWitnessProvider;
|
|
13
|
-
abstract
|
|
13
|
+
abstract getDeploymentFunctionAndArgs(): Promise<
|
|
14
|
+
| {
|
|
15
|
+
/** The name of the function used to deploy the contract */
|
|
16
|
+
constructorName: string;
|
|
17
|
+
/** The args to the function used to deploy the contract */
|
|
18
|
+
constructorArgs: any[];
|
|
19
|
+
}
|
|
20
|
+
| undefined
|
|
21
|
+
>;
|
|
14
22
|
abstract getContractArtifact(): Promise<ContractArtifact>;
|
|
15
23
|
|
|
16
24
|
constructor() {}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
2
|
-
import type { EntrypointInterface, ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
|
|
3
2
|
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import type { EntrypointInterface, FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
4
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
4
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
6
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -33,8 +34,12 @@ export class DefaultAccountInterface implements AccountInterface {
|
|
|
33
34
|
this.version = new Fr(nodeInfo.protocolVersion);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
createTxExecutionRequest(
|
|
37
|
-
|
|
37
|
+
createTxExecutionRequest(
|
|
38
|
+
exec: ExecutionPayload,
|
|
39
|
+
fee: FeeOptions,
|
|
40
|
+
options: TxExecutionOptions,
|
|
41
|
+
): Promise<TxExecutionRequest> {
|
|
42
|
+
return this.entrypoint.createTxExecutionRequest(exec, fee, options);
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
createAuthWit(messageHash: Fr): Promise<AuthWitness> {
|
|
@@ -17,9 +17,12 @@ export abstract class EcdsaKBaseAccountContract extends DefaultAccountContract {
|
|
|
17
17
|
super();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async
|
|
20
|
+
async getDeploymentFunctionAndArgs() {
|
|
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 {
|
|
@@ -22,8 +22,11 @@ export abstract class EcdsaRSSHBaseAccountContract extends DefaultAccountContrac
|
|
|
22
22
|
super();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
return Promise.resolve(
|
|
25
|
+
getDeploymentFunctionAndArgs() {
|
|
26
|
+
return Promise.resolve({
|
|
27
|
+
constructorName: 'constructor',
|
|
28
|
+
constructorArgs: [this.signingPublicKey.subarray(0, 32), this.signingPublicKey.subarray(32, 64)],
|
|
29
|
+
});
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider {
|
|
@@ -17,9 +17,9 @@ export abstract class SchnorrBaseAccountContract extends DefaultAccountContract
|
|
|
17
17
|
super();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async
|
|
20
|
+
async getDeploymentFunctionAndArgs() {
|
|
21
21
|
const signingPublicKey = await new Schnorr().computePublicKey(this.signingPrivateKey);
|
|
22
|
-
return [signingPublicKey.x, signingPublicKey.y];
|
|
22
|
+
return { constructorName: 'constructor', constructorArgs: [signingPublicKey.x, signingPublicKey.y] };
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type AccountManager,
|
|
3
|
+
FeeJuicePaymentMethod,
|
|
4
|
+
type PXE,
|
|
5
|
+
type WaitForProvenOpts,
|
|
6
|
+
type WaitOpts,
|
|
7
|
+
waitForProven,
|
|
8
|
+
} from '@aztec/aztec.js';
|
|
2
9
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
10
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
4
11
|
|
|
@@ -46,6 +53,7 @@ export async function deployFundedSchnorrAccount(
|
|
|
46
53
|
*/
|
|
47
54
|
skipClassRegistration?: boolean;
|
|
48
55
|
} = { interval: 0.1, skipClassRegistration: false },
|
|
56
|
+
waitForProvenOptions?: WaitForProvenOpts,
|
|
49
57
|
): Promise<AccountManager> {
|
|
50
58
|
const signingKey = account.signingKey ?? deriveSigningKey(account.secret);
|
|
51
59
|
const accountManager = await getSchnorrAccount(pxe, account.secret, signingKey, account.salt);
|
|
@@ -54,7 +62,7 @@ export async function deployFundedSchnorrAccount(
|
|
|
54
62
|
// This only works when the world state is prefilled with the balance for the account in test environment.
|
|
55
63
|
const paymentMethod = new FeeJuicePaymentMethod(accountManager.getAddress());
|
|
56
64
|
|
|
57
|
-
await accountManager
|
|
65
|
+
const receipt = await accountManager
|
|
58
66
|
.deploy({
|
|
59
67
|
skipClassRegistration: opts.skipClassRegistration,
|
|
60
68
|
skipPublicDeployment: true,
|
|
@@ -62,6 +70,10 @@ export async function deployFundedSchnorrAccount(
|
|
|
62
70
|
})
|
|
63
71
|
.wait(opts);
|
|
64
72
|
|
|
73
|
+
if (waitForProvenOptions !== undefined) {
|
|
74
|
+
await waitForProven(pxe, receipt, waitForProvenOptions);
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
return accountManager;
|
|
66
78
|
}
|
|
67
79
|
|
|
@@ -78,15 +90,21 @@ export async function deployFundedSchnorrAccounts(
|
|
|
78
90
|
*/
|
|
79
91
|
skipClassRegistration?: boolean;
|
|
80
92
|
} = { interval: 0.1, skipClassRegistration: false },
|
|
93
|
+
waitForProvenOptions?: WaitForProvenOpts,
|
|
81
94
|
): Promise<AccountManager[]> {
|
|
82
95
|
const accountManagers: AccountManager[] = [];
|
|
83
96
|
// Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
|
|
84
97
|
for (let i = 0; i < accounts.length; i++) {
|
|
85
98
|
accountManagers.push(
|
|
86
|
-
await deployFundedSchnorrAccount(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
await deployFundedSchnorrAccount(
|
|
100
|
+
pxe,
|
|
101
|
+
accounts[i],
|
|
102
|
+
{
|
|
103
|
+
...opts,
|
|
104
|
+
skipClassRegistration: i !== 0 || opts.skipClassRegistration, // Register the contract class at most once.
|
|
105
|
+
},
|
|
106
|
+
waitForProvenOptions,
|
|
107
|
+
),
|
|
90
108
|
);
|
|
91
109
|
}
|
|
92
110
|
return accountManagers;
|