@aztec/aztec.js 0.0.1-commit.6d63667d → 0.0.1-commit.858058eac
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/api/contract.d.ts +2 -2
- package/dest/api/contract.js +2 -2
- package/dest/api/deployment.d.ts +1 -2
- package/dest/api/deployment.d.ts.map +1 -1
- package/dest/api/deployment.js +0 -1
- package/dest/api/events.d.ts +10 -6
- package/dest/api/events.d.ts.map +1 -1
- package/dest/api/events.js +30 -20
- package/dest/api/fields.d.ts +2 -1
- package/dest/api/fields.d.ts.map +1 -1
- package/dest/api/fields.js +1 -0
- package/dest/api/wallet.d.ts +2 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -1
- package/dest/contract/contract_function_interaction.d.ts +3 -12
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +6 -6
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +2 -13
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.js +0 -258
- package/dest/fee/fee_juice_payment_method_with_claim.js +6 -6
- package/dest/fee/private_fee_payment_method.js +10 -10
- package/dest/fee/public_fee_payment_method.js +10 -10
- package/dest/fee/sponsored_fee_payment.js +3 -3
- package/dest/wallet/wallet.d.ts +136 -75
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +22 -21
- package/package.json +9 -9
- package/src/api/contract.ts +2 -2
- package/src/api/deployment.ts +0 -1
- package/src/api/events.ts +35 -27
- package/src/api/fields.ts +1 -0
- package/src/api/wallet.ts +4 -1
- package/src/contract/contract_function_interaction.ts +13 -6
- package/src/contract/protocol_contracts/contract-class-registry.ts +0 -145
- package/src/fee/fee_juice_payment_method_with_claim.ts +5 -5
- package/src/fee/private_fee_payment_method.ts +7 -7
- package/src/fee/public_fee_payment_method.ts +8 -8
- package/src/fee/sponsored_fee_payment.ts +3 -3
- package/src/wallet/wallet.ts +65 -34
- package/dest/deployment/broadcast_function.d.ts +0 -24
- package/dest/deployment/broadcast_function.d.ts.map +0 -1
- package/dest/deployment/broadcast_function.js +0 -74
- package/src/deployment/broadcast_function.ts +0 -148
package/dest/wallet/wallet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockNumberPositiveSchema } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { AbiTypeSchema, ContractArtifactSchema,
|
|
2
|
+
import { AbiTypeSchema, ContractArtifactSchema, FunctionCall } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
4
|
import { ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
|
|
5
5
|
import { Gas } from '@aztec/stdlib/gas';
|
|
@@ -7,18 +7,8 @@ import { AbiDecodedSchema, optional, schemas, zodFor } from '@aztec/stdlib/schem
|
|
|
7
7
|
import { Capsule, HashedValues, TxHash, TxProfileResult, TxReceipt, TxSimulationResult, UtilitySimulationResult, inTxSchema } from '@aztec/stdlib/tx';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { NO_WAIT } from '../contract/interaction_options.js';
|
|
10
|
-
export const FunctionCallSchema = z.object({
|
|
11
|
-
name: z.string(),
|
|
12
|
-
to: schemas.AztecAddress,
|
|
13
|
-
selector: schemas.FunctionSelector,
|
|
14
|
-
type: z.nativeEnum(FunctionType),
|
|
15
|
-
isStatic: z.boolean(),
|
|
16
|
-
hideMsgSender: z.boolean(),
|
|
17
|
-
args: z.array(schemas.Fr),
|
|
18
|
-
returnTypes: z.array(AbiTypeSchema)
|
|
19
|
-
});
|
|
20
10
|
export const ExecutionPayloadSchema = z.object({
|
|
21
|
-
calls: z.array(
|
|
11
|
+
calls: z.array(FunctionCall.schema),
|
|
22
12
|
authWitnesses: z.array(AuthWitness.schema),
|
|
23
13
|
capsules: z.array(Capsule.schema),
|
|
24
14
|
extraHashedArgs: z.array(HashedValues.schema),
|
|
@@ -82,7 +72,7 @@ export const MessageHashOrIntentSchema = z.union([
|
|
|
82
72
|
}),
|
|
83
73
|
z.object({
|
|
84
74
|
caller: schemas.AztecAddress,
|
|
85
|
-
call:
|
|
75
|
+
call: FunctionCall.schema
|
|
86
76
|
})
|
|
87
77
|
]);
|
|
88
78
|
export const EventMetadataDefinitionSchema = z.object({
|
|
@@ -90,17 +80,28 @@ export const EventMetadataDefinitionSchema = z.object({
|
|
|
90
80
|
abiType: AbiTypeSchema,
|
|
91
81
|
fieldNames: z.array(z.string())
|
|
92
82
|
});
|
|
93
|
-
|
|
94
|
-
event: AbiDecodedSchema,
|
|
95
|
-
metadata: inTxSchema()
|
|
96
|
-
}));
|
|
97
|
-
export const PrivateEventFilterSchema = z.object({
|
|
98
|
-
contractAddress: schemas.AztecAddress,
|
|
99
|
-
scopes: z.array(schemas.AztecAddress),
|
|
83
|
+
const EventFilterBaseSchema = z.object({
|
|
100
84
|
txHash: optional(TxHash.schema),
|
|
101
85
|
fromBlock: optional(BlockNumberPositiveSchema),
|
|
102
86
|
toBlock: optional(BlockNumberPositiveSchema)
|
|
103
87
|
});
|
|
88
|
+
export const PrivateEventFilterSchema = EventFilterBaseSchema.extend({
|
|
89
|
+
contractAddress: schemas.AztecAddress,
|
|
90
|
+
scopes: z.array(schemas.AztecAddress)
|
|
91
|
+
});
|
|
92
|
+
export const PublicEventFilterSchema = EventFilterBaseSchema.extend({
|
|
93
|
+
contractAddress: optional(schemas.AztecAddress)
|
|
94
|
+
});
|
|
95
|
+
export const PrivateEventSchema = zodFor()(z.object({
|
|
96
|
+
event: AbiDecodedSchema,
|
|
97
|
+
metadata: inTxSchema()
|
|
98
|
+
}));
|
|
99
|
+
export const PublicEventSchema = zodFor()(z.object({
|
|
100
|
+
event: AbiDecodedSchema,
|
|
101
|
+
metadata: z.intersection(inTxSchema(), z.object({
|
|
102
|
+
contractAddress: schemas.AztecAddress
|
|
103
|
+
}))
|
|
104
|
+
}));
|
|
104
105
|
export const ContractMetadataSchema = z.object({
|
|
105
106
|
instance: optional(ContractInstanceWithAddressSchema),
|
|
106
107
|
isContractInitialized: z.boolean(),
|
|
@@ -252,7 +253,7 @@ export const WalletCapabilitiesSchema = z.object({
|
|
|
252
253
|
}))),
|
|
253
254
|
registerContract: z.function().args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr)).returns(ContractInstanceWithAddressSchema),
|
|
254
255
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
255
|
-
simulateUtility: z.function().args(
|
|
256
|
+
simulateUtility: z.function().args(FunctionCall.schema, optional(z.array(AuthWitness.schema))).returns(UtilitySimulationResult.schema),
|
|
256
257
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
257
258
|
sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(z.union([
|
|
258
259
|
TxHash.schema,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec.js",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js",
|
|
4
|
-
"version": "0.0.1-commit.
|
|
4
|
+
"version": "0.0.1-commit.858058eac",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./abi": "./dest/api/abi.js",
|
|
@@ -94,20 +94,20 @@
|
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@aztec/constants": "0.0.1-commit.
|
|
98
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
99
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
100
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
101
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
102
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
103
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
97
|
+
"@aztec/constants": "0.0.1-commit.858058eac",
|
|
98
|
+
"@aztec/entrypoints": "0.0.1-commit.858058eac",
|
|
99
|
+
"@aztec/ethereum": "0.0.1-commit.858058eac",
|
|
100
|
+
"@aztec/foundation": "0.0.1-commit.858058eac",
|
|
101
|
+
"@aztec/l1-artifacts": "0.0.1-commit.858058eac",
|
|
102
|
+
"@aztec/protocol-contracts": "0.0.1-commit.858058eac",
|
|
103
|
+
"@aztec/stdlib": "0.0.1-commit.858058eac",
|
|
104
104
|
"axios": "^1.12.0",
|
|
105
105
|
"tslib": "^2.4.0",
|
|
106
106
|
"viem": "npm:@aztec/viem@2.38.2",
|
|
107
107
|
"zod": "^3.23.8"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@aztec/builder": "0.0.1-commit.
|
|
110
|
+
"@aztec/builder": "0.0.1-commit.858058eac",
|
|
111
111
|
"@jest/globals": "^30.0.0",
|
|
112
112
|
"@types/jest": "^30.0.0",
|
|
113
113
|
"@types/node": "^22.15.17",
|
package/src/api/contract.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `contract` module provides utilities for deploying and interacting with contracts, based on a
|
|
3
3
|
* `Wallet` instance and a compiled artifact. Refer to the {@link account} module for how to obtain a valid
|
|
4
|
-
* `Wallet` instance, and to the {@link https://docs.aztec.network/developers/aztec-nr/
|
|
4
|
+
* `Wallet` instance, and to the {@link https://docs.aztec.network/developers/aztec-nr/compiling_contracts | Compiling contracts}
|
|
5
5
|
* section of the documentation for how to generate an artifact out of your Noir source code.
|
|
6
6
|
*
|
|
7
7
|
* The {@link Contract} class is the main class in this module, and provides static methods for deploying
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* If you pass `wait: NO_WAIT` in the options, it will return a {@link TxHash} immediately without waiting.
|
|
38
38
|
*
|
|
39
39
|
* @remarks If you are using typescript, consider using the
|
|
40
|
-
* {@link https://docs.aztec.network/developers/aztec-nr/
|
|
40
|
+
* {@link https://docs.aztec.network/developers/aztec-nr/compiling_contracts#use-generated-interfaces | autogenerated type-safe interfaces}
|
|
41
41
|
* for interacting with your contracts.
|
|
42
42
|
*
|
|
43
43
|
* @packageDocumentation
|
package/src/api/deployment.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { publishContractClass } from '../deployment/publish_class.js';
|
|
2
|
-
export { broadcastPrivateFunction, broadcastUtilityFunction } from '../deployment/broadcast_function.js';
|
|
3
2
|
export { publishInstance } from '../deployment/publish_instance.js';
|
|
4
3
|
export { ContractDeployer } from '../deployment/contract_deployer.js';
|
package/src/api/events.ts
CHANGED
|
@@ -1,44 +1,52 @@
|
|
|
1
1
|
import { type EventMetadataDefinition, EventSelector, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
2
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
3
|
|
|
4
|
+
import type { PublicEvent, PublicEventFilter } from '../wallet/wallet.js';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Returns decoded public events given search parameters.
|
|
6
8
|
* @param node - The node to request events from
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* @param eventMetadataDef - Metadata of the event. This should be the class generated from the contract. e.g. Contract.events.Event
|
|
10
|
+
* @param filter - Filter options for the event query:
|
|
11
|
+
* - `contractAddress`: The address of the contract that emitted the events.
|
|
12
|
+
* - `txHash`: Transaction in which the events were emitted.
|
|
13
|
+
* - `fromBlock`: The block number from which to start fetching events (inclusive). Defaults to 1.
|
|
14
|
+
* - `toBlock`: The block number until which to fetch events (not inclusive). Defaults to latest + 1.
|
|
15
|
+
* @returns - The decoded events with metadata.
|
|
11
16
|
*/
|
|
12
|
-
export async function
|
|
17
|
+
export async function getPublicEvents<T>(
|
|
13
18
|
node: AztecNode,
|
|
14
19
|
eventMetadataDef: EventMetadataDefinition,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
): Promise<T[]> {
|
|
20
|
+
filter: PublicEventFilter,
|
|
21
|
+
): Promise<PublicEvent<T>[]> {
|
|
18
22
|
const { logs } = await node.getPublicLogs({
|
|
19
|
-
fromBlock:
|
|
20
|
-
toBlock:
|
|
23
|
+
fromBlock: filter.fromBlock ? Number(filter.fromBlock) : undefined,
|
|
24
|
+
toBlock: filter.toBlock ? Number(filter.toBlock) : undefined,
|
|
25
|
+
txHash: filter.txHash,
|
|
26
|
+
contractAddress: filter.contractAddress,
|
|
21
27
|
});
|
|
22
28
|
|
|
23
|
-
const decodedEvents =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`Something is weird here, we have matching EventSelectors, but the actual payload has mismatched length. Expected ${expectedLength}. Got ${log.log.fields.length}.`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
29
|
+
const decodedEvents: PublicEvent<T>[] = [];
|
|
30
|
+
|
|
31
|
+
for (const log of logs) {
|
|
32
|
+
const logFields = log.log.getEmittedFields();
|
|
33
|
+
// Event selector is at the last position of the emitted fields
|
|
34
|
+
const logEventSelector = EventSelector.fromField(logFields[logFields.length - 1]);
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
36
|
+
if (!logEventSelector.equals(eventMetadataDef.eventSelector)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
decodedEvents.push({
|
|
41
|
+
event: decodeFromAbi([eventMetadataDef.abiType], log.log.fields) as T,
|
|
42
|
+
metadata: {
|
|
43
|
+
l2BlockNumber: log.id.blockNumber,
|
|
44
|
+
l2BlockHash: log.id.blockHash,
|
|
45
|
+
txHash: log.id.txHash,
|
|
46
|
+
contractAddress: log.log.contractAddress,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
42
50
|
|
|
43
51
|
return decodedEvents;
|
|
44
52
|
}
|
package/src/api/fields.ts
CHANGED
package/src/api/wallet.ts
CHANGED
|
@@ -11,11 +11,12 @@ export {
|
|
|
11
11
|
type Wallet,
|
|
12
12
|
type PrivateEvent,
|
|
13
13
|
type PrivateEventFilter,
|
|
14
|
+
type PublicEvent,
|
|
15
|
+
type PublicEventFilter,
|
|
14
16
|
type ContractMetadata,
|
|
15
17
|
type ContractClassMetadata,
|
|
16
18
|
AppCapabilitiesSchema,
|
|
17
19
|
WalletCapabilitiesSchema,
|
|
18
|
-
FunctionCallSchema,
|
|
19
20
|
ExecutionPayloadSchema,
|
|
20
21
|
GasSettingsOptionSchema,
|
|
21
22
|
WalletSimulationFeeOptionSchema,
|
|
@@ -28,6 +29,8 @@ export {
|
|
|
28
29
|
EventMetadataDefinitionSchema,
|
|
29
30
|
PrivateEventSchema,
|
|
30
31
|
PrivateEventFilterSchema,
|
|
32
|
+
PublicEventSchema,
|
|
33
|
+
PublicEventFilterSchema,
|
|
31
34
|
ContractClassMetadataSchema,
|
|
32
35
|
ContractMetadataSchema,
|
|
33
36
|
WalletSchema,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type FunctionAbi,
|
|
3
|
+
FunctionCall,
|
|
4
|
+
FunctionSelector,
|
|
5
|
+
FunctionType,
|
|
6
|
+
decodeFromAbi,
|
|
7
|
+
encodeArguments,
|
|
8
|
+
} from '@aztec/stdlib/abi';
|
|
2
9
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
11
|
import { type Capsule, type HashedValues, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
|
|
@@ -43,16 +50,16 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
43
50
|
*/
|
|
44
51
|
public async getFunctionCall() {
|
|
45
52
|
const args = encodeArguments(this.functionDao, this.args);
|
|
46
|
-
return {
|
|
53
|
+
return FunctionCall.from({
|
|
47
54
|
name: this.functionDao.name,
|
|
48
|
-
|
|
55
|
+
to: this.contractAddress,
|
|
49
56
|
selector: await FunctionSelector.fromNameAndParameters(this.functionDao.name, this.functionDao.parameters),
|
|
50
57
|
type: this.functionDao.functionType,
|
|
51
|
-
to: this.contractAddress,
|
|
52
|
-
isStatic: this.functionDao.isStatic,
|
|
53
58
|
hideMsgSender: false /** Only set to `true` for enqueued public function calls */,
|
|
59
|
+
isStatic: this.functionDao.isStatic,
|
|
60
|
+
args,
|
|
54
61
|
returnTypes: this.functionDao.returnTypes,
|
|
55
|
-
};
|
|
62
|
+
});
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
/**
|
|
@@ -19,127 +19,6 @@ import { ContractFunctionInteraction } from '../contract_function_interaction.js
|
|
|
19
19
|
const ContractClassRegistryContractArtifact: ContractArtifact = {
|
|
20
20
|
name: 'ContractClassRegistry',
|
|
21
21
|
functions: [
|
|
22
|
-
{
|
|
23
|
-
...{
|
|
24
|
-
functionType: FunctionType.PRIVATE,
|
|
25
|
-
name: 'broadcast_private_function',
|
|
26
|
-
isOnlySelf: false,
|
|
27
|
-
isStatic: false,
|
|
28
|
-
isInitializer: false,
|
|
29
|
-
parameters: [
|
|
30
|
-
{
|
|
31
|
-
name: 'contract_class_id',
|
|
32
|
-
type: {
|
|
33
|
-
kind: 'struct',
|
|
34
|
-
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
35
|
-
path: 'aztec::protocol_types::contract_class_id::ContractClassId',
|
|
36
|
-
},
|
|
37
|
-
visibility: 'private',
|
|
38
|
-
},
|
|
39
|
-
{ name: 'artifact_metadata_hash', type: { kind: 'field' }, visibility: 'private' },
|
|
40
|
-
{ name: 'utility_functions_artifact_tree_root', type: { kind: 'field' }, visibility: 'private' },
|
|
41
|
-
{
|
|
42
|
-
name: 'private_function_tree_sibling_path',
|
|
43
|
-
type: { kind: 'array', length: 7, type: { kind: 'field' } },
|
|
44
|
-
visibility: 'private',
|
|
45
|
-
},
|
|
46
|
-
{ name: 'private_function_tree_leaf_index', type: { kind: 'field' }, visibility: 'private' },
|
|
47
|
-
{
|
|
48
|
-
name: 'artifact_function_tree_sibling_path',
|
|
49
|
-
type: { kind: 'array', length: 7, type: { kind: 'field' } },
|
|
50
|
-
visibility: 'private',
|
|
51
|
-
},
|
|
52
|
-
{ name: 'artifact_function_tree_leaf_index', type: { kind: 'field' }, visibility: 'private' },
|
|
53
|
-
{
|
|
54
|
-
name: 'function_data',
|
|
55
|
-
type: {
|
|
56
|
-
kind: 'struct',
|
|
57
|
-
fields: [
|
|
58
|
-
{
|
|
59
|
-
name: 'selector',
|
|
60
|
-
type: {
|
|
61
|
-
kind: 'struct',
|
|
62
|
-
fields: [{ name: 'inner', type: { kind: 'integer', sign: 'unsigned', width: 32 } }],
|
|
63
|
-
path: 'aztec::protocol_types::abis::function_selector::FunctionSelector',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{ name: 'metadata_hash', type: { kind: 'field' } },
|
|
67
|
-
{ name: 'vk_hash', type: { kind: 'field' } },
|
|
68
|
-
],
|
|
69
|
-
path: 'events::private_function_broadcasted::InnerPrivateFunction',
|
|
70
|
-
},
|
|
71
|
-
visibility: 'private',
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
returnTypes: [],
|
|
75
|
-
errorTypes: {
|
|
76
|
-
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
77
|
-
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
78
|
-
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
79
|
-
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
80
|
-
'17655676068928457687': { error_kind: 'string', string: 'Reader did not read all data' },
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
bytecode: Buffer.from([]),
|
|
84
|
-
debugSymbols: '',
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
...{
|
|
88
|
-
functionType: FunctionType.PRIVATE,
|
|
89
|
-
name: 'broadcast_utility_function',
|
|
90
|
-
isOnlySelf: false,
|
|
91
|
-
isStatic: false,
|
|
92
|
-
isInitializer: false,
|
|
93
|
-
parameters: [
|
|
94
|
-
{
|
|
95
|
-
name: 'contract_class_id',
|
|
96
|
-
type: {
|
|
97
|
-
kind: 'struct',
|
|
98
|
-
fields: [{ name: 'inner', type: { kind: 'field' } }],
|
|
99
|
-
path: 'aztec::protocol_types::contract_class_id::ContractClassId',
|
|
100
|
-
},
|
|
101
|
-
visibility: 'private',
|
|
102
|
-
},
|
|
103
|
-
{ name: 'artifact_metadata_hash', type: { kind: 'field' }, visibility: 'private' },
|
|
104
|
-
{ name: 'private_functions_artifact_tree_root', type: { kind: 'field' }, visibility: 'private' },
|
|
105
|
-
{
|
|
106
|
-
name: 'artifact_function_tree_sibling_path',
|
|
107
|
-
type: { kind: 'array', length: 7, type: { kind: 'field' } },
|
|
108
|
-
visibility: 'private',
|
|
109
|
-
},
|
|
110
|
-
{ name: 'artifact_function_tree_leaf_index', type: { kind: 'field' }, visibility: 'private' },
|
|
111
|
-
{
|
|
112
|
-
name: 'function_data',
|
|
113
|
-
type: {
|
|
114
|
-
kind: 'struct',
|
|
115
|
-
fields: [
|
|
116
|
-
{
|
|
117
|
-
name: 'selector',
|
|
118
|
-
type: {
|
|
119
|
-
kind: 'struct',
|
|
120
|
-
fields: [{ name: 'inner', type: { kind: 'integer', sign: 'unsigned', width: 32 } }],
|
|
121
|
-
path: 'aztec::protocol_types::abis::function_selector::FunctionSelector',
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{ name: 'metadata_hash', type: { kind: 'field' } },
|
|
125
|
-
],
|
|
126
|
-
path: 'events::utility_function_broadcasted::InnerUtilityFunction',
|
|
127
|
-
},
|
|
128
|
-
visibility: 'private',
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
returnTypes: [],
|
|
132
|
-
errorTypes: {
|
|
133
|
-
'1998584279744703196': { error_kind: 'string', string: 'attempt to subtract with overflow' },
|
|
134
|
-
'14990209321349310352': { error_kind: 'string', string: 'attempt to add with overflow' },
|
|
135
|
-
'15764276373176857197': { error_kind: 'string', string: 'Stack too deep' },
|
|
136
|
-
'16431471497789672479': { error_kind: 'string', string: 'Index out of bounds' },
|
|
137
|
-
'17655676068928457687': { error_kind: 'string', string: 'Reader did not read all data' },
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
bytecode: Buffer.from([]),
|
|
141
|
-
debugSymbols: '',
|
|
142
|
-
},
|
|
143
22
|
{
|
|
144
23
|
...{
|
|
145
24
|
functionType: FunctionType.PRIVATE,
|
|
@@ -203,30 +82,6 @@ export class ContractClassRegistryContract extends ContractBase {
|
|
|
203
82
|
}
|
|
204
83
|
|
|
205
84
|
declare public methods: {
|
|
206
|
-
/** broadcast_private_function(contract_class_id: struct, artifact_metadata_hash: field, utility_functions_artifact_tree_root: field, private_function_tree_sibling_path: array, private_function_tree_leaf_index: field, artifact_function_tree_sibling_path: array, artifact_function_tree_leaf_index: field, function_data: struct) */
|
|
207
|
-
broadcast_private_function: ((
|
|
208
|
-
contract_class_id: WrappedFieldLike,
|
|
209
|
-
artifact_metadata_hash: FieldLike,
|
|
210
|
-
utility_functions_artifact_tree_root: FieldLike,
|
|
211
|
-
private_function_tree_sibling_path: FieldLike[],
|
|
212
|
-
private_function_tree_leaf_index: FieldLike,
|
|
213
|
-
artifact_function_tree_sibling_path: FieldLike[],
|
|
214
|
-
artifact_function_tree_leaf_index: FieldLike,
|
|
215
|
-
function_data: { selector: FunctionSelectorLike; metadata_hash: FieldLike; vk_hash: FieldLike },
|
|
216
|
-
) => ContractFunctionInteraction) &
|
|
217
|
-
Pick<ContractMethod, 'selector'>;
|
|
218
|
-
|
|
219
|
-
/** broadcast_utility_function(contract_class_id: struct, artifact_metadata_hash: field, private_functions_artifact_tree_root: field, artifact_function_tree_sibling_path: array, artifact_function_tree_leaf_index: field, function_data: struct) */
|
|
220
|
-
broadcast_utility_function: ((
|
|
221
|
-
contract_class_id: WrappedFieldLike,
|
|
222
|
-
artifact_metadata_hash: FieldLike,
|
|
223
|
-
private_functions_artifact_tree_root: FieldLike,
|
|
224
|
-
artifact_function_tree_sibling_path: FieldLike[],
|
|
225
|
-
artifact_function_tree_leaf_index: FieldLike,
|
|
226
|
-
function_data: { selector: FunctionSelectorLike; metadata_hash: FieldLike },
|
|
227
|
-
) => ContractFunctionInteraction) &
|
|
228
|
-
Pick<ContractMethod, 'selector'>;
|
|
229
|
-
|
|
230
85
|
/** public_dispatch(selector: field) */
|
|
231
86
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
232
87
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
|
-
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
3
|
+
import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
6
6
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -27,10 +27,11 @@ export class FeeJuicePaymentMethodWithClaim implements FeePaymentMethod {
|
|
|
27
27
|
|
|
28
28
|
return new ExecutionPayload(
|
|
29
29
|
[
|
|
30
|
-
{
|
|
31
|
-
to: ProtocolContractAddress.FeeJuice,
|
|
30
|
+
FunctionCall.from({
|
|
32
31
|
name: 'claim_and_end_setup',
|
|
32
|
+
to: ProtocolContractAddress.FeeJuice,
|
|
33
33
|
selector,
|
|
34
|
+
type: FunctionType.PRIVATE,
|
|
34
35
|
hideMsgSender: false,
|
|
35
36
|
isStatic: false,
|
|
36
37
|
args: [
|
|
@@ -40,8 +41,7 @@ export class FeeJuicePaymentMethodWithClaim implements FeePaymentMethod {
|
|
|
40
41
|
new Fr(this.claim.messageLeafIndex),
|
|
41
42
|
],
|
|
42
43
|
returnTypes: [],
|
|
43
|
-
|
|
44
|
-
},
|
|
44
|
+
}),
|
|
45
45
|
],
|
|
46
46
|
[],
|
|
47
47
|
[],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import { type FunctionAbi, FunctionCall, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
5
5
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -102,21 +102,21 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
102
102
|
|
|
103
103
|
const witness = await this.wallet.createAuthWit(this.sender, {
|
|
104
104
|
caller: this.paymentContract,
|
|
105
|
-
call: {
|
|
105
|
+
call: FunctionCall.from({
|
|
106
106
|
name: 'transfer_to_public',
|
|
107
|
-
|
|
107
|
+
to: await this.getAsset(),
|
|
108
108
|
selector: await FunctionSelector.fromSignature('transfer_to_public((Field),(Field),u128,Field)'),
|
|
109
109
|
type: FunctionType.PRIVATE,
|
|
110
110
|
hideMsgSender: false,
|
|
111
111
|
isStatic: false,
|
|
112
|
-
|
|
112
|
+
args: [this.sender.toField(), this.paymentContract.toField(), maxFee, txNonce],
|
|
113
113
|
returnTypes: [],
|
|
114
|
-
},
|
|
114
|
+
}),
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
return new ExecutionPayload(
|
|
118
118
|
[
|
|
119
|
-
{
|
|
119
|
+
FunctionCall.from({
|
|
120
120
|
name: 'fee_entrypoint_private',
|
|
121
121
|
to: this.paymentContract,
|
|
122
122
|
selector: await FunctionSelector.fromSignature('fee_entrypoint_private(u128,Field)'),
|
|
@@ -125,7 +125,7 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
125
125
|
isStatic: false,
|
|
126
126
|
args: [maxFee, txNonce],
|
|
127
127
|
returnTypes: [],
|
|
128
|
-
},
|
|
128
|
+
}),
|
|
129
129
|
],
|
|
130
130
|
[witness],
|
|
131
131
|
[],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import { type FunctionAbi, FunctionCall, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
5
5
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -94,16 +94,16 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
94
94
|
|
|
95
95
|
const intent = {
|
|
96
96
|
caller: this.paymentContract,
|
|
97
|
-
call: {
|
|
97
|
+
call: FunctionCall.from({
|
|
98
98
|
name: 'transfer_in_public',
|
|
99
|
-
|
|
99
|
+
to: await this.getAsset(),
|
|
100
100
|
selector: await FunctionSelector.fromSignature('transfer_in_public((Field),(Field),u128,Field)'),
|
|
101
101
|
type: FunctionType.PUBLIC,
|
|
102
|
-
isStatic: false,
|
|
103
102
|
hideMsgSender: false /** The target function performs an authwit check, so msg_sender is needed */,
|
|
104
|
-
|
|
103
|
+
isStatic: false,
|
|
104
|
+
args: [this.sender.toField(), this.paymentContract.toField(), maxFee, txNonce],
|
|
105
105
|
returnTypes: [],
|
|
106
|
-
},
|
|
106
|
+
}),
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
const setPublicAuthWitInteraction = await SetPublicAuthwitContractInteraction.create(
|
|
@@ -116,7 +116,7 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
116
116
|
return new ExecutionPayload(
|
|
117
117
|
[
|
|
118
118
|
...(await setPublicAuthWitInteraction.request()).calls,
|
|
119
|
-
{
|
|
119
|
+
FunctionCall.from({
|
|
120
120
|
name: 'fee_entrypoint_public',
|
|
121
121
|
to: this.paymentContract,
|
|
122
122
|
selector: await FunctionSelector.fromSignature('fee_entrypoint_public(u128,Field)'),
|
|
@@ -125,7 +125,7 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
125
125
|
isStatic: false,
|
|
126
126
|
args: [maxFee, txNonce],
|
|
127
127
|
returnTypes: [],
|
|
128
|
-
},
|
|
128
|
+
}),
|
|
129
129
|
],
|
|
130
130
|
[],
|
|
131
131
|
[],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
|
-
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
2
|
+
import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
5
5
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
@@ -22,7 +22,7 @@ export class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
|
22
22
|
async getExecutionPayload(): Promise<ExecutionPayload> {
|
|
23
23
|
return new ExecutionPayload(
|
|
24
24
|
[
|
|
25
|
-
{
|
|
25
|
+
FunctionCall.from({
|
|
26
26
|
name: 'sponsor_unconditionally',
|
|
27
27
|
to: this.paymentContract,
|
|
28
28
|
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
@@ -31,7 +31,7 @@ export class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
|
31
31
|
isStatic: false,
|
|
32
32
|
args: [],
|
|
33
33
|
returnTypes: [],
|
|
34
|
-
},
|
|
34
|
+
}),
|
|
35
35
|
],
|
|
36
36
|
[],
|
|
37
37
|
[],
|