@aztec/accounts 0.0.1-commit.f650c0a5c → 0.0.1-commit.f7ea82942
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 +7376 -7312
- package/artifacts/EcdsaRAccount.json +7376 -7312
- package/artifacts/SchnorrAccount.json +7444 -7368
- package/artifacts/SimulatedEcdsaAccount.json +8359 -0
- package/artifacts/SimulatedSchnorrAccount.d.json.ts +3 -0
- package/artifacts/{SimulatedAccount.json → SimulatedSchnorrAccount.json} +6898 -5069
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts +1 -1
- package/dest/ecdsa/ecdsa_k/account_contract.js +6 -2
- package/dest/ecdsa/ecdsa_r/account_contract.d.ts +1 -1
- package/dest/ecdsa/ecdsa_r/account_contract.js +6 -2
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +6 -2
- 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/package.json +10 -8
- package/src/ecdsa/ecdsa_k/account_contract.ts +1 -1
- package/src/ecdsa/ecdsa_r/account_contract.ts +1 -1
- package/src/ecdsa/ssh_ecdsa_r/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/dest/stub/index.d.ts +0 -20
- package/dest/stub/index.d.ts.map +0 -1
- package/dest/stub/index.js +0 -28
- package/dest/stub/lazy.d.ts +0 -25
- package/dest/stub/lazy.d.ts.map +0 -1
- package/dest/stub/lazy.js +0 -37
- package/src/stub/index.ts +0 -40
- package/src/stub/lazy.ts +0 -51
- /package/artifacts/{SimulatedAccount.d.json.ts → SimulatedEcdsaAccount.d.json.ts} +0 -0
|
@@ -12,7 +12,7 @@ export declare abstract class EcdsaKBaseAccountContract extends DefaultAccountCo
|
|
|
12
12
|
constructor(signingPrivateKey: Buffer);
|
|
13
13
|
getInitializationFunctionAndArgs(): Promise<{
|
|
14
14
|
constructorName: string;
|
|
15
|
-
constructorArgs:
|
|
15
|
+
constructorArgs: number[][];
|
|
16
16
|
}>;
|
|
17
17
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
|
|
18
18
|
}
|
|
@@ -16,8 +16,12 @@ import { DefaultAccountContract } from '../../defaults/account_contract.js';
|
|
|
16
16
|
return {
|
|
17
17
|
constructorName: 'constructor',
|
|
18
18
|
constructorArgs: [
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
[
|
|
20
|
+
...signingPublicKey.subarray(0, 32)
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
...signingPublicKey.subarray(32, 64)
|
|
24
|
+
]
|
|
21
25
|
]
|
|
22
26
|
};
|
|
23
27
|
}
|
|
@@ -12,7 +12,7 @@ export declare abstract class EcdsaRBaseAccountContract extends DefaultAccountCo
|
|
|
12
12
|
constructor(signingPrivateKey: Buffer);
|
|
13
13
|
getInitializationFunctionAndArgs(): Promise<{
|
|
14
14
|
constructorName: string;
|
|
15
|
-
constructorArgs:
|
|
15
|
+
constructorArgs: number[][];
|
|
16
16
|
}>;
|
|
17
17
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
|
|
18
18
|
}
|
|
@@ -16,8 +16,12 @@ import { DefaultAccountContract } from '../../defaults/account_contract.js';
|
|
|
16
16
|
return {
|
|
17
17
|
constructorName: 'constructor',
|
|
18
18
|
constructorArgs: [
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
[
|
|
20
|
+
...signingPublicKey.subarray(0, 32)
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
...signingPublicKey.subarray(32, 64)
|
|
24
|
+
]
|
|
21
25
|
]
|
|
22
26
|
};
|
|
23
27
|
}
|
|
@@ -15,7 +15,7 @@ export declare abstract class EcdsaRSSHBaseAccountContract extends DefaultAccoun
|
|
|
15
15
|
constructor(signingPublicKey: Buffer);
|
|
16
16
|
getInitializationFunctionAndArgs(): Promise<{
|
|
17
17
|
constructorName: string;
|
|
18
|
-
constructorArgs:
|
|
18
|
+
constructorArgs: number[][];
|
|
19
19
|
}>;
|
|
20
20
|
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
|
|
21
21
|
}
|
|
@@ -20,8 +20,12 @@ const secp256r1N = 1157920892103562487626974469494075735299969552241357603424222
|
|
|
20
20
|
return Promise.resolve({
|
|
21
21
|
constructorName: 'constructor',
|
|
22
22
|
constructorArgs: [
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
[
|
|
24
|
+
...this.signingPublicKey.subarray(0, 32)
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
...this.signingPublicKey.subarray(32, 64)
|
|
28
|
+
]
|
|
25
29
|
]
|
|
26
30
|
});
|
|
27
31
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
4
|
+
export declare const StubEcdsaAccountContractArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
5
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Eagerly loads the contract artifact. */
|
|
6
|
+
export declare class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
7
|
+
getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
8
|
+
}
|
|
9
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */
|
|
10
|
+
export declare function createStubEcdsaAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdHViL2VjZHNhL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQU1qRSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVqRSxlQUFPLE1BQU0sZ0NBQWdDLDhDQUEwRSxDQUFDO0FBRXhILCtHQUErRztBQUMvRyxxQkFBYSx3QkFBeUIsU0FBUSx1QkFBdUI7SUFDMUQsbUJBQW1CLDBEQUUzQjtDQUNGO0FBRUQseUZBQXlGO0FBQ3pGLHdCQUFnQixzQkFBc0IsQ0FBQyxlQUFlLEVBQUUsZUFBZSxlQVF0RSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/ecdsa/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,eAAO,MAAM,gCAAgC,8CAA0E,CAAC;AAExH,+GAA+G;AAC/G,qBAAa,wBAAyB,SAAQ,uBAAuB;IAC1D,mBAAmB,0DAE3B;CACF;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,eAAe,eAQtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import SimulatedEcdsaAccountJson from '../../../artifacts/SimulatedEcdsaAccount.json' with {
|
|
5
|
+
type: 'json'
|
|
6
|
+
};
|
|
7
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
8
|
+
export const StubEcdsaAccountContractArtifact = loadContractArtifact(SimulatedEcdsaAccountJson);
|
|
9
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Eagerly loads the contract artifact. */ export class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact() {
|
|
11
|
+
return Promise.resolve(StubEcdsaAccountContractArtifact);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */ export function createStubEcdsaAccount(originalAddress) {
|
|
15
|
+
const accountContract = new StubEcdsaAccountContract();
|
|
16
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
17
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* Lazily loads the ECDSA stub contract artifact (browser-compatible).
|
|
6
|
+
*/
|
|
7
|
+
export declare function getStubEcdsaAccountContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
8
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Lazily loads the contract artifact. */
|
|
9
|
+
export declare class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
11
|
+
}
|
|
12
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */
|
|
13
|
+
export declare function createStubEcdsaAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0dWIvZWNkc2EvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFJakUsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFakU7O0dBRUc7QUFDSCx3QkFBc0IsbUNBQW1DLDBEQUt4RDtBQUVELDhHQUE4RztBQUM5RyxxQkFBYSx3QkFBeUIsU0FBUSx1QkFBdUI7SUFDMUQsbUJBQW1CLDBEQUUzQjtDQUNGO0FBRUQseUZBQXlGO0FBQ3pGLHdCQUFnQixzQkFBc0IsQ0FBQyxlQUFlLEVBQUUsZUFBZSxlQVF0RSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/stub/ecdsa/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,wBAAsB,mCAAmC,0DAKxD;AAED,8GAA8G;AAC9G,qBAAa,wBAAyB,SAAQ,uBAAuB;IAC1D,mBAAmB,0DAE3B;CACF;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,eAAe,eAQtE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
5
|
+
/**
|
|
6
|
+
* Lazily loads the ECDSA stub contract artifact (browser-compatible).
|
|
7
|
+
*/ export async function getStubEcdsaAccountContractArtifact() {
|
|
8
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
9
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
10
|
+
const { default: json } = await import('../../../artifacts/SimulatedEcdsaAccount.json');
|
|
11
|
+
return loadContractArtifact(json);
|
|
12
|
+
}
|
|
13
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Lazily loads the contract artifact. */ export class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
14
|
+
getContractArtifact() {
|
|
15
|
+
return getStubEcdsaAccountContractArtifact();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */ export function createStubEcdsaAccount(originalAddress) {
|
|
19
|
+
const accountContract = new StubEcdsaAccountContract();
|
|
20
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
21
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
4
|
+
export declare const StubSchnorrAccountContractArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
5
|
+
/** Stub account contract for Schnorr accounts. Eagerly loads the contract artifact. */
|
|
6
|
+
export declare class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
7
|
+
getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
8
|
+
}
|
|
9
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */
|
|
10
|
+
export declare function createStubSchnorrAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdHViL3NjaG5vcnIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBTWpFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRWpFLGVBQU8sTUFBTSxrQ0FBa0MsOENBRTlDLENBQUM7QUFFRix1RkFBdUY7QUFDdkYscUJBQWEsMEJBQTJCLFNBQVEsdUJBQXVCO0lBQzVELG1CQUFtQiwwREFFM0I7Q0FDRjtBQUVELDBGQUEwRjtBQUMxRix3QkFBZ0Isd0JBQXdCLENBQUMsZUFBZSxFQUFFLGVBQWUsZUFReEUifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/schnorr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,eAAO,MAAM,kCAAkC,8CAE9C,CAAC;AAEF,uFAAuF;AACvF,qBAAa,0BAA2B,SAAQ,uBAAuB;IAC5D,mBAAmB,0DAE3B;CACF;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,eAQxE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import SimulatedSchnorrAccountJson from '../../../artifacts/SimulatedSchnorrAccount.json' with {
|
|
5
|
+
type: 'json'
|
|
6
|
+
};
|
|
7
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
8
|
+
export const StubSchnorrAccountContractArtifact = loadContractArtifact(SimulatedSchnorrAccountJson);
|
|
9
|
+
/** Stub account contract for Schnorr accounts. Eagerly loads the contract artifact. */ export class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact() {
|
|
11
|
+
return Promise.resolve(StubSchnorrAccountContractArtifact);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */ export function createStubSchnorrAccount(originalAddress) {
|
|
15
|
+
const accountContract = new StubSchnorrAccountContract();
|
|
16
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
17
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* Lazily loads the Schnorr stub contract artifact (browser-compatible).
|
|
6
|
+
*/
|
|
7
|
+
export declare function getStubSchnorrAccountContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
8
|
+
/** Stub account contract for Schnorr accounts. Lazily loads the contract artifact. */
|
|
9
|
+
export declare class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
11
|
+
}
|
|
12
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */
|
|
13
|
+
export declare function createStubSchnorrAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0dWIvc2Nobm9yci9sYXp5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUlqRSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVqRTs7R0FFRztBQUNILHdCQUFzQixxQ0FBcUMsMERBSzFEO0FBRUQsc0ZBQXNGO0FBQ3RGLHFCQUFhLDBCQUEyQixTQUFRLHVCQUF1QjtJQUM1RCxtQkFBbUIsMERBRTNCO0NBQ0Y7QUFFRCwwRkFBMEY7QUFDMUYsd0JBQWdCLHdCQUF3QixDQUFDLGVBQWUsRUFBRSxlQUFlLGVBUXhFIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/stub/schnorr/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,wBAAsB,qCAAqC,0DAK1D;AAED,sFAAsF;AACtF,qBAAa,0BAA2B,SAAQ,uBAAuB;IAC5D,mBAAmB,0DAE3B;CACF;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,eAQxE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { StubBaseAccountContract } from '../account_contract.js';
|
|
5
|
+
/**
|
|
6
|
+
* Lazily loads the Schnorr stub contract artifact (browser-compatible).
|
|
7
|
+
*/ export async function getStubSchnorrAccountContractArtifact() {
|
|
8
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
9
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
10
|
+
const { default: json } = await import('../../../artifacts/SimulatedSchnorrAccount.json');
|
|
11
|
+
return loadContractArtifact(json);
|
|
12
|
+
}
|
|
13
|
+
/** Stub account contract for Schnorr accounts. Lazily loads the contract artifact. */ export class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
14
|
+
getContractArtifact() {
|
|
15
|
+
return getStubSchnorrAccountContractArtifact();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */ export function createStubSchnorrAccount(originalAddress) {
|
|
19
|
+
const accountContract = new StubSchnorrAccountContract();
|
|
20
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
21
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
22
|
+
}
|
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.0.1-commit.
|
|
5
|
+
"version": "0.0.1-commit.f7ea82942",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./defaults": "./dest/defaults/index.js",
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
"./ecdsa/lazy": "./dest/ecdsa/lazy.js",
|
|
11
11
|
"./schnorr": "./dest/schnorr/index.js",
|
|
12
12
|
"./schnorr/lazy": "./dest/schnorr/lazy.js",
|
|
13
|
-
"./stub": "./dest/stub/index.js",
|
|
14
|
-
"./stub/lazy": "./dest/stub/lazy.js",
|
|
13
|
+
"./stub/schnorr": "./dest/stub/schnorr/index.js",
|
|
14
|
+
"./stub/schnorr/lazy": "./dest/stub/schnorr/lazy.js",
|
|
15
|
+
"./stub/ecdsa": "./dest/stub/ecdsa/index.js",
|
|
16
|
+
"./stub/ecdsa/lazy": "./dest/stub/ecdsa/lazy.js",
|
|
15
17
|
"./testing": "./dest/testing/index.js",
|
|
16
18
|
"./testing/lazy": "./dest/testing/lazy.js",
|
|
17
19
|
"./copy-cat": "./dest/copy_cat/index.js",
|
|
@@ -79,11 +81,11 @@
|
|
|
79
81
|
]
|
|
80
82
|
},
|
|
81
83
|
"dependencies": {
|
|
82
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
83
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
84
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
85
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
86
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
84
|
+
"@aztec/aztec.js": "0.0.1-commit.f7ea82942",
|
|
85
|
+
"@aztec/entrypoints": "0.0.1-commit.f7ea82942",
|
|
86
|
+
"@aztec/ethereum": "0.0.1-commit.f7ea82942",
|
|
87
|
+
"@aztec/foundation": "0.0.1-commit.f7ea82942",
|
|
88
|
+
"@aztec/stdlib": "0.0.1-commit.f7ea82942",
|
|
87
89
|
"tslib": "^2.4.0"
|
|
88
90
|
},
|
|
89
91
|
"devDependencies": {
|
|
@@ -21,7 +21,7 @@ export abstract class EcdsaKBaseAccountContract extends DefaultAccountContract {
|
|
|
21
21
|
const signingPublicKey = await new Ecdsa().computePublicKey(this.signingPrivateKey);
|
|
22
22
|
return {
|
|
23
23
|
constructorName: 'constructor',
|
|
24
|
-
constructorArgs: [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)],
|
|
24
|
+
constructorArgs: [[...signingPublicKey.subarray(0, 32)], [...signingPublicKey.subarray(32, 64)]],
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -21,7 +21,7 @@ export abstract class EcdsaRBaseAccountContract extends DefaultAccountContract {
|
|
|
21
21
|
const signingPublicKey = await new Ecdsa('secp256r1').computePublicKey(this.signingPrivateKey);
|
|
22
22
|
return {
|
|
23
23
|
constructorName: 'constructor',
|
|
24
|
-
constructorArgs: [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)],
|
|
24
|
+
constructorArgs: [[...signingPublicKey.subarray(0, 32)], [...signingPublicKey.subarray(32, 64)]],
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -25,7 +25,7 @@ export abstract class EcdsaRSSHBaseAccountContract extends DefaultAccountContrac
|
|
|
25
25
|
getInitializationFunctionAndArgs() {
|
|
26
26
|
return Promise.resolve({
|
|
27
27
|
constructorName: 'constructor',
|
|
28
|
-
constructorArgs: [this.signingPublicKey.subarray(0, 32), this.signingPublicKey.subarray(32, 64)],
|
|
28
|
+
constructorArgs: [[...this.signingPublicKey.subarray(0, 32)], [...this.signingPublicKey.subarray(32, 64)]],
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -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
|
+
}
|
package/dest/stub/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
-
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
-
import { StubBaseAccountContract } from './account_contract.js';
|
|
5
|
-
export declare const StubAccountContractArtifact: ContractArtifact;
|
|
6
|
-
/**
|
|
7
|
-
* Stub account contract
|
|
8
|
-
* Eagerly loads the contract artifact
|
|
9
|
-
*/
|
|
10
|
-
export declare class StubAccountContract extends StubBaseAccountContract {
|
|
11
|
-
constructor();
|
|
12
|
-
getContractArtifact(): Promise<ContractArtifact>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
16
|
-
* @param originalAddress - The address of the account to stub
|
|
17
|
-
* @returns A stub account that can be used for kernelless simulations
|
|
18
|
-
*/
|
|
19
|
-
export declare function createStubAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdHViL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUVqRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBSzFELE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRWhFLGVBQU8sTUFBTSwyQkFBMkIsa0JBQXlFLENBQUM7QUFFbEg7OztHQUdHO0FBQ0gscUJBQWEsbUJBQW9CLFNBQVEsdUJBQXVCO0lBQzlELGNBRUM7SUFFUSxtQkFBbUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FFeEQ7Q0FDRjtBQUVEOzs7O0dBSUc7QUFDSCx3QkFBZ0IsaUJBQWlCLENBQUMsZUFBZSxFQUFFLGVBQWUsZUFRakUifQ==
|
package/dest/stub/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,eAAO,MAAM,2BAA2B,kBAAyE,CAAC;AAElH;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC9D,cAEC;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,eAAe,eAQjE"}
|
package/dest/stub/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
-
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
-
import SimulatedAccountContract from '../../artifacts/SimulatedAccount.json' with {
|
|
5
|
-
type: 'json'
|
|
6
|
-
};
|
|
7
|
-
import { StubBaseAccountContract } from './account_contract.js';
|
|
8
|
-
export const StubAccountContractArtifact = loadContractArtifact(SimulatedAccountContract);
|
|
9
|
-
/**
|
|
10
|
-
* Stub account contract
|
|
11
|
-
* Eagerly loads the contract artifact
|
|
12
|
-
*/ export class StubAccountContract extends StubBaseAccountContract {
|
|
13
|
-
constructor(){
|
|
14
|
-
super();
|
|
15
|
-
}
|
|
16
|
-
getContractArtifact() {
|
|
17
|
-
return Promise.resolve(StubAccountContractArtifact);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
22
|
-
* @param originalAddress - The address of the account to stub
|
|
23
|
-
* @returns A stub account that can be used for kernelless simulations
|
|
24
|
-
*/ export function createStubAccount(originalAddress) {
|
|
25
|
-
const accountContract = new StubAccountContract();
|
|
26
|
-
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
27
|
-
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
28
|
-
}
|
package/dest/stub/lazy.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
-
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
-
import { StubBaseAccountContract } from './account_contract.js';
|
|
5
|
-
/**
|
|
6
|
-
* Lazily loads the contract artifact
|
|
7
|
-
* @returns The contract artifact for the Stub account contract
|
|
8
|
-
*/
|
|
9
|
-
export declare function getStubAccountContractArtifact(): Promise<ContractArtifact>;
|
|
10
|
-
/**
|
|
11
|
-
* Account contract that authenticates transactions using Stub signatures
|
|
12
|
-
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
13
|
-
* Lazily loads the contract artifact
|
|
14
|
-
*/
|
|
15
|
-
export declare class StubAccountContract extends StubBaseAccountContract {
|
|
16
|
-
constructor();
|
|
17
|
-
getContractArtifact(): Promise<ContractArtifact>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
21
|
-
* @param originalAddress - The address of the account to stub
|
|
22
|
-
* @returns A stub account that can be used for kernelless simulations
|
|
23
|
-
*/
|
|
24
|
-
export declare function createStubAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0dWIvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFakUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUcxRCxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUVoRTs7O0dBR0c7QUFDSCx3QkFBc0IsOEJBQThCLDhCQVFuRDtBQUVEOzs7O0dBSUc7QUFDSCxxQkFBYSxtQkFBb0IsU0FBUSx1QkFBdUI7SUFDOUQsY0FFQztJQUVRLG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUV4RDtDQUNGO0FBRUQ7Ozs7R0FJRztBQUNILHdCQUFnQixpQkFBaUIsQ0FBQyxlQUFlLEVBQUUsZUFBZSxlQVFqRSJ9
|
package/dest/stub/lazy.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/stub/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;GAGG;AACH,wBAAsB,8BAA8B,8BAQnD;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC9D,cAEC;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,eAAe,eAQjE"}
|
package/dest/stub/lazy.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
-
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
-
import { StubBaseAccountContract } from './account_contract.js';
|
|
5
|
-
/**
|
|
6
|
-
* Lazily loads the contract artifact
|
|
7
|
-
* @returns The contract artifact for the Stub account contract
|
|
8
|
-
*/ export async function getStubAccountContractArtifact() {
|
|
9
|
-
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
10
|
-
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
11
|
-
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
12
|
-
// "text/javascript"
|
|
13
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
14
|
-
const { default: StubAccountContractJson } = await import('../../artifacts/SimulatedAccount.json');
|
|
15
|
-
return loadContractArtifact(StubAccountContractJson);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Account contract that authenticates transactions using Stub signatures
|
|
19
|
-
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
20
|
-
* Lazily loads the contract artifact
|
|
21
|
-
*/ export class StubAccountContract extends StubBaseAccountContract {
|
|
22
|
-
constructor(){
|
|
23
|
-
super();
|
|
24
|
-
}
|
|
25
|
-
getContractArtifact() {
|
|
26
|
-
return getStubAccountContractArtifact();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
31
|
-
* @param originalAddress - The address of the account to stub
|
|
32
|
-
* @returns A stub account that can be used for kernelless simulations
|
|
33
|
-
*/ export function createStubAccount(originalAddress) {
|
|
34
|
-
const accountContract = new StubAccountContract();
|
|
35
|
-
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
36
|
-
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
37
|
-
}
|
package/src/stub/index.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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 type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
5
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
6
|
-
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
7
|
-
|
|
8
|
-
import SimulatedAccountContract from '../../artifacts/SimulatedAccount.json' with { type: 'json' };
|
|
9
|
-
import { StubBaseAccountContract } from './account_contract.js';
|
|
10
|
-
|
|
11
|
-
export const StubAccountContractArtifact = loadContractArtifact(SimulatedAccountContract as NoirCompiledContract);
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Stub account contract
|
|
15
|
-
* Eagerly loads the contract artifact
|
|
16
|
-
*/
|
|
17
|
-
export class StubAccountContract extends StubBaseAccountContract {
|
|
18
|
-
constructor() {
|
|
19
|
-
super();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
override getContractArtifact(): Promise<ContractArtifact> {
|
|
23
|
-
return Promise.resolve(StubAccountContractArtifact);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Creates a stub account that impersonates the one with the provided originalAddress.
|
|
29
|
-
* @param originalAddress - The address of the account to stub
|
|
30
|
-
* @returns A stub account that can be used for kernelless simulations
|
|
31
|
-
*/
|
|
32
|
-
export function createStubAccount(originalAddress: CompleteAddress) {
|
|
33
|
-
const accountContract = new StubAccountContract();
|
|
34
|
-
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
35
|
-
return new BaseAccount(
|
|
36
|
-
new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider),
|
|
37
|
-
authWitnessProvider,
|
|
38
|
-
originalAddress,
|
|
39
|
-
);
|
|
40
|
-
}
|