@aztec/entrypoints 0.0.1-fake-ceab37513c → 0.0.2-commit.217f559981
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/dest/account_entrypoint.d.ts +49 -8
- package/dest/account_entrypoint.d.ts.map +1 -1
- package/dest/account_entrypoint.js +97 -121
- package/dest/constants.d.ts +1 -1
- package/dest/default_entrypoint.d.ts +6 -8
- package/dest/default_entrypoint.d.ts.map +1 -1
- package/dest/default_entrypoint.js +16 -12
- package/dest/default_multi_call_entrypoint.d.ts +8 -8
- package/dest/default_multi_call_entrypoint.d.ts.map +1 -1
- package/dest/default_multi_call_entrypoint.js +62 -34
- package/dest/encoding.d.ts +10 -43
- package/dest/encoding.d.ts.map +1 -1
- package/dest/encoding.js +22 -70
- package/dest/index.d.ts +1 -1
- package/dest/interfaces.d.ts +40 -60
- package/dest/interfaces.d.ts.map +1 -1
- package/dest/interfaces.js +8 -2
- package/package.json +11 -9
- package/src/account_entrypoint.ts +120 -93
- package/src/default_entrypoint.ts +24 -14
- package/src/default_multi_call_entrypoint.ts +69 -36
- package/src/encoding.ts +16 -102
- package/src/interfaces.ts +37 -65
- package/dest/payload.d.ts +0 -32
- package/dest/payload.d.ts.map +0 -1
- package/dest/payload.js +0 -27
- package/src/payload.ts +0 -35
package/src/interfaces.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
3
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
6
|
-
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
7
5
|
|
|
8
|
-
import
|
|
6
|
+
import { z } from 'zod';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
9
|
+
* Information on the connected chain. Used by wallets when constructing transactions to protect against replay
|
|
10
|
+
* attacks.
|
|
12
11
|
*/
|
|
13
|
-
export type
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
* used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
|
|
19
|
-
* but higher fee. The nullifier ensures only one transaction can succeed.
|
|
20
|
-
*/
|
|
21
|
-
txNonce?: Fr;
|
|
12
|
+
export type ChainInfo = {
|
|
13
|
+
/** The L1 chain id */
|
|
14
|
+
chainId: Fr;
|
|
15
|
+
/** The version of the rollup */
|
|
16
|
+
version: Fr;
|
|
22
17
|
};
|
|
23
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Zod schema for ChainInfo
|
|
21
|
+
*/
|
|
22
|
+
export const ChainInfoSchema = z.object({
|
|
23
|
+
chainId: Fr.schema,
|
|
24
|
+
version: Fr.schema,
|
|
25
|
+
});
|
|
26
|
+
|
|
24
27
|
/**
|
|
25
28
|
* Creates transaction execution requests out of a set of function calls, a fee payment method and
|
|
26
29
|
* general options for the transaction
|
|
@@ -29,15 +32,30 @@ export interface EntrypointInterface {
|
|
|
29
32
|
/**
|
|
30
33
|
* Generates an execution request out of set of function calls.
|
|
31
34
|
* @param exec - The execution intents to be run.
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
35
|
+
* @param gasSettings - The gas settings for the transaction.
|
|
36
|
+
* @param chainInfo - Chain information (chainId and version) for replay protection.
|
|
37
|
+
* @param options - Miscellaneous tx options that enable/disable features of the entrypoint
|
|
34
38
|
* @returns The authenticated transaction execution request.
|
|
35
39
|
*/
|
|
36
40
|
createTxExecutionRequest(
|
|
37
41
|
exec: ExecutionPayload,
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
gasSettings: GasSettings,
|
|
43
|
+
chainInfo: ChainInfo,
|
|
44
|
+
options?: any,
|
|
40
45
|
): Promise<TxExecutionRequest>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Wraps an execution payload such that it is executed *via* this entrypoint.
|
|
49
|
+
* This returns an ExecutionPayload with the entrypoint as the caller for the wrapped payload.
|
|
50
|
+
* Useful for account self-funding deployments and batching calls beyond the limit
|
|
51
|
+
* of a single entrypoint call.
|
|
52
|
+
*
|
|
53
|
+
* @param exec - The execution payload to wrap
|
|
54
|
+
* @param options - Implementation-specific options
|
|
55
|
+
* @returns A new execution payload with a single call to this entrypoint
|
|
56
|
+
* @throws Error if the payload cannot be wrapped (e.g., exceeds call limit)
|
|
57
|
+
*/
|
|
58
|
+
wrapExecutionPayload(exec: ExecutionPayload, options?: any): Promise<ExecutionPayload>;
|
|
41
59
|
}
|
|
42
60
|
|
|
43
61
|
/** Creates authorization witnesses. */
|
|
@@ -49,49 +67,3 @@ export interface AuthWitnessProvider {
|
|
|
49
67
|
*/
|
|
50
68
|
createAuthWit(messageHash: Fr | Buffer): Promise<AuthWitness>;
|
|
51
69
|
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Holds information about how the fee for a transaction is to be paid.
|
|
55
|
-
*/
|
|
56
|
-
export interface FeePaymentMethod {
|
|
57
|
-
/** The asset used to pay the fee. */
|
|
58
|
-
getAsset(): Promise<AztecAddress>;
|
|
59
|
-
/**
|
|
60
|
-
* Returns the data to be added to the final execution request
|
|
61
|
-
* to pay the fee in the given asset
|
|
62
|
-
* @param gasSettings - The gas limits and max fees.
|
|
63
|
-
* @returns The function calls to pay the fee.
|
|
64
|
-
*/
|
|
65
|
-
getExecutionPayload(gasSettings: GasSettings): Promise<ExecutionPayload>;
|
|
66
|
-
/**
|
|
67
|
-
* The expected fee payer for this tx.
|
|
68
|
-
* @param gasSettings - The gas limits and max fees.
|
|
69
|
-
*/
|
|
70
|
-
getFeePayer(gasSettings: GasSettings): Promise<AztecAddress>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Fee payment options for a transaction.
|
|
75
|
-
*/
|
|
76
|
-
export type FeeOptions = {
|
|
77
|
-
/** The fee payment method to use */
|
|
78
|
-
paymentMethod: FeePaymentMethod;
|
|
79
|
-
/** The gas settings */
|
|
80
|
-
gasSettings: GasSettings;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// docs:start:user_fee_options
|
|
84
|
-
/** Fee options as set by a user. */
|
|
85
|
-
export type UserFeeOptions = {
|
|
86
|
-
/** The fee payment method to use */
|
|
87
|
-
paymentMethod?: FeePaymentMethod;
|
|
88
|
-
/** The gas settings */
|
|
89
|
-
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
90
|
-
/** Percentage to pad the base fee by, if empty, defaults to 0.5 */
|
|
91
|
-
baseFeePadding?: number;
|
|
92
|
-
/** Whether to run an initial simulation of the tx with high gas limit to figure out actual gas settings. */
|
|
93
|
-
estimateGas?: boolean;
|
|
94
|
-
/** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
|
|
95
|
-
estimatedGasPadding?: number;
|
|
96
|
-
};
|
|
97
|
-
// docs:end:user_fee_options
|
package/dest/payload.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
-
import { Capsule, HashedValues } from '@aztec/stdlib/tx';
|
|
4
|
-
/**
|
|
5
|
-
* Represents data necessary to perform an action in the network successfully.
|
|
6
|
-
* This class can be considered Aztec's "minimal execution unit".
|
|
7
|
-
* */
|
|
8
|
-
export declare class ExecutionPayload {
|
|
9
|
-
/** The function calls to be executed. */
|
|
10
|
-
calls: FunctionCall[];
|
|
11
|
-
/** Any transient auth witnesses needed for this execution */
|
|
12
|
-
authWitnesses: AuthWitness[];
|
|
13
|
-
/** Data passed through an oracle for this execution. */
|
|
14
|
-
capsules: Capsule[];
|
|
15
|
-
/** Extra hashed values to be injected in the execution cache */
|
|
16
|
-
extraHashedArgs: HashedValues[];
|
|
17
|
-
constructor(
|
|
18
|
-
/** The function calls to be executed. */
|
|
19
|
-
calls: FunctionCall[],
|
|
20
|
-
/** Any transient auth witnesses needed for this execution */
|
|
21
|
-
authWitnesses: AuthWitness[],
|
|
22
|
-
/** Data passed through an oracle for this execution. */
|
|
23
|
-
capsules: Capsule[],
|
|
24
|
-
/** Extra hashed values to be injected in the execution cache */
|
|
25
|
-
extraHashedArgs?: HashedValues[]);
|
|
26
|
-
static empty(): ExecutionPayload;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Merges an array ExecutionPayloads combining their calls, authWitnesses, capsules and extraArgHashes.
|
|
30
|
-
*/
|
|
31
|
-
export declare function mergeExecutionPayloads(requests: ExecutionPayload[]): ExecutionPayload;
|
|
32
|
-
//# sourceMappingURL=payload.d.ts.map
|
package/dest/payload.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../src/payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;KAGK;AACL,qBAAa,gBAAgB;IAEzB,yCAAyC;IAClC,KAAK,EAAE,YAAY,EAAE;IAC5B,6DAA6D;IACtD,aAAa,EAAE,WAAW,EAAE;IACnC,wDAAwD;IACjD,QAAQ,EAAE,OAAO,EAAE;IAC1B,gEAAgE;IACzD,eAAe,EAAE,YAAY,EAAE;;IAPtC,yCAAyC;IAClC,KAAK,EAAE,YAAY,EAAE;IAC5B,6DAA6D;IACtD,aAAa,EAAE,WAAW,EAAE;IACnC,wDAAwD;IACjD,QAAQ,EAAE,OAAO,EAAE;IAC1B,gEAAgE;IACzD,eAAe,GAAE,YAAY,EAAO;IAG7C,MAAM,CAAC,KAAK;CAGb;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,CAMrF"}
|
package/dest/payload.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents data necessary to perform an action in the network successfully.
|
|
3
|
-
* This class can be considered Aztec's "minimal execution unit".
|
|
4
|
-
* */ export class ExecutionPayload {
|
|
5
|
-
calls;
|
|
6
|
-
authWitnesses;
|
|
7
|
-
capsules;
|
|
8
|
-
extraHashedArgs;
|
|
9
|
-
constructor(/** The function calls to be executed. */ calls, /** Any transient auth witnesses needed for this execution */ authWitnesses, /** Data passed through an oracle for this execution. */ capsules, /** Extra hashed values to be injected in the execution cache */ extraHashedArgs = []){
|
|
10
|
-
this.calls = calls;
|
|
11
|
-
this.authWitnesses = authWitnesses;
|
|
12
|
-
this.capsules = capsules;
|
|
13
|
-
this.extraHashedArgs = extraHashedArgs;
|
|
14
|
-
}
|
|
15
|
-
static empty() {
|
|
16
|
-
return new ExecutionPayload([], [], []);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Merges an array ExecutionPayloads combining their calls, authWitnesses, capsules and extraArgHashes.
|
|
21
|
-
*/ export function mergeExecutionPayloads(requests) {
|
|
22
|
-
const calls = requests.map((r)=>r.calls).flat();
|
|
23
|
-
const combinedAuthWitnesses = requests.map((r)=>r.authWitnesses ?? []).flat();
|
|
24
|
-
const combinedCapsules = requests.map((r)=>r.capsules ?? []).flat();
|
|
25
|
-
const combinedextraHashedArgs = requests.map((r)=>r.extraHashedArgs ?? []).flat();
|
|
26
|
-
return new ExecutionPayload(calls, combinedAuthWitnesses, combinedCapsules, combinedextraHashedArgs);
|
|
27
|
-
}
|
package/src/payload.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
-
import { Capsule, HashedValues } from '@aztec/stdlib/tx';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents data necessary to perform an action in the network successfully.
|
|
7
|
-
* This class can be considered Aztec's "minimal execution unit".
|
|
8
|
-
* */
|
|
9
|
-
export class ExecutionPayload {
|
|
10
|
-
public constructor(
|
|
11
|
-
/** The function calls to be executed. */
|
|
12
|
-
public calls: FunctionCall[],
|
|
13
|
-
/** Any transient auth witnesses needed for this execution */
|
|
14
|
-
public authWitnesses: AuthWitness[],
|
|
15
|
-
/** Data passed through an oracle for this execution. */
|
|
16
|
-
public capsules: Capsule[],
|
|
17
|
-
/** Extra hashed values to be injected in the execution cache */
|
|
18
|
-
public extraHashedArgs: HashedValues[] = [],
|
|
19
|
-
) {}
|
|
20
|
-
|
|
21
|
-
static empty() {
|
|
22
|
-
return new ExecutionPayload([], [], []);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Merges an array ExecutionPayloads combining their calls, authWitnesses, capsules and extraArgHashes.
|
|
28
|
-
*/
|
|
29
|
-
export function mergeExecutionPayloads(requests: ExecutionPayload[]): ExecutionPayload {
|
|
30
|
-
const calls = requests.map(r => r.calls).flat();
|
|
31
|
-
const combinedAuthWitnesses = requests.map(r => r.authWitnesses ?? []).flat();
|
|
32
|
-
const combinedCapsules = requests.map(r => r.capsules ?? []).flat();
|
|
33
|
-
const combinedextraHashedArgs = requests.map(r => r.extraHashedArgs ?? []).flat();
|
|
34
|
-
return new ExecutionPayload(calls, combinedAuthWitnesses, combinedCapsules, combinedextraHashedArgs);
|
|
35
|
-
}
|