@aztec/entrypoints 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/dest/account_entrypoint.d.ts +3 -3
- package/dest/account_entrypoint.d.ts.map +1 -1
- package/dest/account_entrypoint.js +25 -11
- package/dest/dapp_entrypoint.d.ts +3 -3
- package/dest/dapp_entrypoint.d.ts.map +1 -1
- package/dest/dapp_entrypoint.js +25 -20
- package/dest/default_entrypoint.d.ts +13 -0
- package/dest/default_entrypoint.d.ts.map +1 -0
- package/dest/default_entrypoint.js +35 -0
- package/dest/encoding.d.ts +111 -0
- package/dest/encoding.d.ts.map +1 -0
- package/dest/encoding.js +135 -0
- package/dest/index.d.ts +3 -0
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +3 -0
- package/dest/interfaces.d.ts +83 -0
- package/dest/interfaces.d.ts.map +1 -0
- package/dest/interfaces.js +2 -0
- package/dest/payload.d.ts +32 -0
- package/dest/payload.d.ts.map +1 -0
- package/dest/payload.js +27 -0
- package/package.json +10 -6
- package/src/account_entrypoint.ts +34 -15
- package/src/dapp_entrypoint.ts +35 -17
- package/src/default_entrypoint.ts +48 -0
- package/src/encoding.ts +225 -0
- package/src/index.ts +3 -0
- package/src/interfaces.ts +93 -0
- package/src/payload.ts +35 -0
package/src/payload.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}
|