@aztec/aztec.js 0.0.1-commit.d6f2b3f94 → 0.0.1-commit.db765a8
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/abi.d.ts +2 -2
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/contract.d.ts +3 -3
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +1 -1
- package/dest/api/wallet.d.ts +2 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.d.ts +3 -3
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/batch_call.d.ts +3 -3
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +17 -8
- package/dest/contract/contract_function_interaction.d.ts +5 -5
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +102 -13
- package/dest/contract/deploy_method.d.ts +37 -12
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +42 -21
- package/dest/contract/get_gas_limits.js +3 -3
- package/dest/contract/interaction_options.d.ts +62 -21
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +33 -0
- package/dest/contract/protocol_contracts/auth-registry.d.ts +10 -1
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/auth-registry.js +506 -59
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.js +12 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts +1 -1
- package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/fee-juice.js +8 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +1 -1
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/multi-call-entrypoint.js +17 -1
- package/dest/contract/protocol_contracts/public-checks.d.ts +1 -1
- package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/public-checks.js +17 -1
- package/dest/utils/abi_types.d.ts +6 -1
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/abi_types.js +1 -1
- package/dest/utils/authwit.d.ts +5 -5
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +10 -6
- package/dest/wallet/capabilities.d.ts +13 -5
- package/dest/wallet/capabilities.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.d.ts +15 -4
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.js +26 -0
- package/dest/wallet/wallet.d.ts +163 -16
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +33 -7
- package/package.json +10 -10
- package/src/api/abi.ts +1 -0
- package/src/api/contract.ts +8 -1
- package/src/api/wallet.ts +1 -0
- package/src/contract/base_contract_interaction.ts +3 -2
- package/src/contract/batch_call.ts +17 -14
- package/src/contract/contract_function_interaction.ts +101 -20
- package/src/contract/deploy_method.ts +77 -32
- package/src/contract/get_gas_limits.ts +3 -3
- package/src/contract/interaction_options.ts +96 -23
- package/src/contract/protocol_contracts/auth-registry.ts +239 -37
- package/src/contract/protocol_contracts/contract-class-registry.ts +3 -0
- package/src/contract/protocol_contracts/fee-juice.ts +2 -0
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +5 -1
- package/src/contract/protocol_contracts/public-checks.ts +5 -1
- package/src/utils/abi_types.ts +7 -0
- package/src/utils/authwit.ts +20 -22
- package/src/wallet/capabilities.ts +13 -4
- package/src/wallet/deploy_account_method.ts +39 -2
- package/src/wallet/wallet.ts +46 -6
|
@@ -9,15 +9,22 @@ import type { Account } from '../account/account.js';
|
|
|
9
9
|
import type { Contract } from '../contract/contract.js';
|
|
10
10
|
import type { ContractBase } from '../contract/contract_base.js';
|
|
11
11
|
import {
|
|
12
|
+
type DeployInteractionWaitOptions,
|
|
12
13
|
DeployMethod,
|
|
14
|
+
type DeployOptions,
|
|
13
15
|
type DeployOptionsWithoutWait,
|
|
14
16
|
type RequestDeployOptions,
|
|
15
17
|
type SimulateDeployOptions,
|
|
16
18
|
} from '../contract/deploy_method.js';
|
|
17
|
-
import type {
|
|
19
|
+
import type {
|
|
20
|
+
FeePaymentMethodOption,
|
|
21
|
+
InteractionWaitOptions,
|
|
22
|
+
ProfileInteractionOptions,
|
|
23
|
+
} from '../contract/interaction_options.js';
|
|
24
|
+
import type { WaitOpts } from '../contract/wait_opts.js';
|
|
18
25
|
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
19
26
|
import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
|
|
20
|
-
import type { Wallet } from './index.js';
|
|
27
|
+
import type { ProfileOptions, SendOptions, SimulateOptions, Wallet } from './index.js';
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* Extended fee payment method option for account deployments that includes entrypoint wrapping options
|
|
@@ -147,4 +154,34 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
147
154
|
deployer: options.from,
|
|
148
155
|
};
|
|
149
156
|
}
|
|
157
|
+
|
|
158
|
+
protected override convertDeployOptionsToSendOptions<W extends DeployInteractionWaitOptions>(
|
|
159
|
+
options: DeployOptions<W>,
|
|
160
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
161
|
+
): SendOptions<W extends { returnReceipt: true } ? WaitOpts : W> {
|
|
162
|
+
return super.convertDeployOptionsToSendOptions(this.injectContractAddressIntoScopes(options));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
protected override convertDeployOptionsToSimulateOptions(options: SimulateDeployOptions): SimulateOptions {
|
|
166
|
+
return super.convertDeployOptionsToSimulateOptions(this.injectContractAddressIntoScopes(options));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
protected override convertDeployOptionsToProfileOptions(
|
|
170
|
+
options: DeployOptionsWithoutWait & ProfileInteractionOptions,
|
|
171
|
+
): ProfileOptions {
|
|
172
|
+
return super.convertDeployOptionsToProfileOptions(this.injectContractAddressIntoScopes(options));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Injects the contract's own address into scopes so the constructor can access its own keys.
|
|
177
|
+
* @param options - The deploy options to augment with the contract address.
|
|
178
|
+
*/
|
|
179
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
180
|
+
private injectContractAddressIntoScopes<T extends { additionalScopes?: AztecAddress[] }>(options: T): T {
|
|
181
|
+
if (!this.address) {
|
|
182
|
+
throw new Error('Instance not yet constructed. This is a bug!');
|
|
183
|
+
}
|
|
184
|
+
const existing = options.additionalScopes ?? [];
|
|
185
|
+
return { ...options, additionalScopes: [...existing, this.address] };
|
|
186
|
+
}
|
|
150
187
|
}
|
package/src/wallet/wallet.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
TxProfileResult,
|
|
23
23
|
TxReceipt,
|
|
24
24
|
TxSimulationResult,
|
|
25
|
-
|
|
25
|
+
UtilityExecutionResult,
|
|
26
26
|
inTxSchema,
|
|
27
27
|
} from '@aztec/stdlib/tx';
|
|
28
28
|
|
|
@@ -225,6 +225,16 @@ export type ContractClassMetadata = {
|
|
|
225
225
|
isContractClassPubliclyRegistered: boolean;
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Options for executing a utility function call.
|
|
230
|
+
*/
|
|
231
|
+
export type ExecuteUtilityOptions = {
|
|
232
|
+
/** The scope for the utility execution (determines which notes and keys are visible). */
|
|
233
|
+
scope: AztecAddress;
|
|
234
|
+
/** Optional auth witnesses to use during execution. */
|
|
235
|
+
authWitnesses?: AuthWitness[];
|
|
236
|
+
};
|
|
237
|
+
|
|
228
238
|
/**
|
|
229
239
|
* The wallet interface.
|
|
230
240
|
*/
|
|
@@ -245,7 +255,7 @@ export type Wallet = {
|
|
|
245
255
|
secretKey?: Fr,
|
|
246
256
|
): Promise<ContractInstanceWithAddress>;
|
|
247
257
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
248
|
-
|
|
258
|
+
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
|
|
249
259
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
250
260
|
sendTx<W extends InteractionWaitOptions = undefined>(
|
|
251
261
|
exec: ExecutionPayload,
|
|
@@ -293,6 +303,7 @@ export const SendOptionsSchema = z.object({
|
|
|
293
303
|
capsules: optional(z.array(Capsule.schema)),
|
|
294
304
|
fee: optional(GasSettingsOptionSchema),
|
|
295
305
|
wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
|
|
306
|
+
additionalScopes: optional(z.array(schemas.AztecAddress)),
|
|
296
307
|
});
|
|
297
308
|
|
|
298
309
|
export const SimulateOptionsSchema = z.object({
|
|
@@ -303,6 +314,7 @@ export const SimulateOptionsSchema = z.object({
|
|
|
303
314
|
skipTxValidation: optional(z.boolean()),
|
|
304
315
|
skipFeeEnforcement: optional(z.boolean()),
|
|
305
316
|
includeMetadata: optional(z.boolean()),
|
|
317
|
+
additionalScopes: optional(z.array(schemas.AztecAddress)),
|
|
306
318
|
});
|
|
307
319
|
|
|
308
320
|
export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
@@ -369,6 +381,7 @@ export const ContractClassMetadataSchema = z.object({
|
|
|
369
381
|
export const ContractFunctionPatternSchema = z.object({
|
|
370
382
|
contract: z.union([schemas.AztecAddress, z.literal('*')]),
|
|
371
383
|
function: z.union([z.string(), z.literal('*')]),
|
|
384
|
+
additionalScopes: optional(z.union([z.array(schemas.AztecAddress), z.literal('*')])),
|
|
372
385
|
});
|
|
373
386
|
|
|
374
387
|
export const AccountsCapabilitySchema = z.object({
|
|
@@ -479,6 +492,22 @@ export const WalletCapabilitiesSchema = z.object({
|
|
|
479
492
|
expiresAt: optional(z.number()),
|
|
480
493
|
});
|
|
481
494
|
|
|
495
|
+
const OffchainEffectSchema = z.object({
|
|
496
|
+
data: z.array(schemas.Fr),
|
|
497
|
+
contractAddress: schemas.AztecAddress,
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
const OffchainMessageSchema = z.object({
|
|
501
|
+
recipient: schemas.AztecAddress,
|
|
502
|
+
payload: z.array(schemas.Fr),
|
|
503
|
+
contractAddress: schemas.AztecAddress,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
const OffchainOutputSchema = z.object({
|
|
507
|
+
offchainEffects: z.array(OffchainEffectSchema),
|
|
508
|
+
offchainMessages: z.array(OffchainMessageSchema),
|
|
509
|
+
});
|
|
510
|
+
|
|
482
511
|
/**
|
|
483
512
|
* Record of all wallet method schemas (excluding batch).
|
|
484
513
|
* This is the single source of truth for method schemas - batch schemas are derived from this.
|
|
@@ -508,15 +537,26 @@ const WalletMethodSchemas = {
|
|
|
508
537
|
.args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
|
|
509
538
|
.returns(ContractInstanceWithAddressSchema),
|
|
510
539
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
511
|
-
|
|
540
|
+
executeUtility: z
|
|
512
541
|
.function()
|
|
513
|
-
.args(
|
|
514
|
-
|
|
542
|
+
.args(
|
|
543
|
+
FunctionCall.schema,
|
|
544
|
+
z.object({
|
|
545
|
+
scope: schemas.AztecAddress,
|
|
546
|
+
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
547
|
+
}),
|
|
548
|
+
)
|
|
549
|
+
.returns(UtilityExecutionResult.schema),
|
|
515
550
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
516
551
|
sendTx: z
|
|
517
552
|
.function()
|
|
518
553
|
.args(ExecutionPayloadSchema, SendOptionsSchema)
|
|
519
|
-
.returns(
|
|
554
|
+
.returns(
|
|
555
|
+
z.union([
|
|
556
|
+
z.object({ txHash: TxHash.schema }).merge(OffchainOutputSchema),
|
|
557
|
+
z.object({ receipt: TxReceipt.schema }).merge(OffchainOutputSchema),
|
|
558
|
+
]),
|
|
559
|
+
),
|
|
520
560
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
521
561
|
requestCapabilities: z.function().args(AppCapabilitiesSchema).returns(WalletCapabilitiesSchema),
|
|
522
562
|
};
|