@aztec/aztec.js 0.0.1-commit.b655e406 → 0.0.1-commit.fce3e4f
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/account.d.ts +2 -3
- package/dest/account/account.d.ts.map +1 -1
- package/dest/account/account_contract.d.ts +1 -1
- package/dest/account/account_with_secret_key.d.ts +1 -2
- package/dest/account/account_with_secret_key.d.ts.map +1 -1
- package/dest/account/index.d.ts +1 -1
- package/dest/account/interface.d.ts +1 -1
- package/dest/account/signerless_account.d.ts +2 -3
- package/dest/account/signerless_account.d.ts.map +1 -1
- package/dest/api/abi.d.ts +1 -1
- package/dest/api/account.d.ts +2 -1
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +1 -0
- package/dest/api/addresses.d.ts +1 -1
- package/dest/api/authorization.d.ts +1 -1
- package/dest/api/block.d.ts +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/crypto.d.ts +1 -1
- package/dest/api/deployment.d.ts +1 -1
- package/dest/api/eth_address.d.ts +1 -1
- package/dest/api/ethereum.d.ts +1 -1
- package/dest/api/events.d.ts +1 -1
- package/dest/api/fee.d.ts +1 -1
- package/dest/api/fee_testing.d.ts +1 -1
- package/dest/api/fields.d.ts +1 -1
- package/dest/api/keys.d.ts +1 -1
- package/dest/api/log.d.ts +1 -1
- package/dest/api/messaging.d.ts +1 -1
- package/dest/api/node.d.ts +1 -1
- package/dest/api/note.d.ts +2 -2
- package/dest/api/note.d.ts.map +1 -1
- package/dest/api/note.js +1 -1
- package/dest/api/protocol.d.ts +1 -1
- package/dest/api/trees.d.ts +1 -1
- package/dest/api/tx.d.ts +2 -2
- package/dest/api/tx.d.ts.map +1 -1
- package/dest/api/tx.js +1 -1
- package/dest/api/utils.d.ts +1 -1
- package/dest/api/wallet.d.ts +2 -3
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -2
- package/dest/authorization/call_authorization_request.d.ts +1 -22
- package/dest/authorization/call_authorization_request.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.d.ts +2 -3
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +1 -1
- package/dest/contract/batch_call.d.ts +8 -9
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +51 -33
- package/dest/contract/checker.d.ts +1 -1
- package/dest/contract/contract.d.ts +2 -2
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +4 -5
- package/dest/contract/contract_base.d.ts +5 -12
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +5 -12
- package/dest/contract/contract_function_interaction.d.ts +4 -4
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +9 -6
- package/dest/contract/deploy_method.d.ts +8 -7
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +8 -6
- package/dest/contract/deploy_sent_tx.d.ts +12 -7
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +10 -4
- package/dest/contract/get_gas_limits.d.ts +1 -1
- package/dest/contract/interaction_options.d.ts +4 -4
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +4 -10
- package/dest/contract/protocol_contracts.d.ts +1 -1
- package/dest/contract/sent_tx.d.ts +1 -1
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/unsafe_contract.d.ts +1 -1
- package/dest/contract/unsafe_contract.d.ts.map +1 -1
- package/dest/contract/unsafe_contract.js +1 -1
- package/dest/contract/wait_for_proven.d.ts +1 -1
- package/dest/deployment/broadcast_function.d.ts +1 -1
- package/dest/deployment/contract_deployer.d.ts +1 -1
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/contract_deployer.js +1 -1
- package/dest/deployment/publish_class.d.ts +1 -1
- package/dest/deployment/publish_instance.d.ts +1 -1
- package/dest/ethereum/portal_manager.d.ts +1 -3
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +33 -6
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +2 -2
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +2 -2
- package/dest/fee/fee_payment_method.d.ts +2 -2
- package/dest/fee/fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.d.ts +2 -2
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +3 -3
- package/dest/fee/public_fee_payment_method.d.ts +2 -2
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +3 -3
- package/dest/fee/sponsored_fee_payment.d.ts +2 -2
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
- package/dest/fee/sponsored_fee_payment.js +2 -2
- package/dest/utils/abi_types.d.ts +1 -1
- package/dest/utils/authwit.d.ts +6 -6
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +21 -10
- package/dest/utils/cross_chain.d.ts +1 -1
- package/dest/utils/fee_juice.d.ts +2 -2
- package/dest/utils/fee_juice.js +1 -1
- package/dest/utils/field_compressed_string.d.ts +1 -1
- package/dest/utils/field_compressed_string.d.ts.map +1 -1
- package/dest/utils/node.d.ts +2 -2
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/pub_key.d.ts +1 -1
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +2 -2
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
- package/dest/wallet/account_entrypoint_meta_payment_method.js +2 -2
- package/dest/wallet/account_manager.d.ts +1 -4
- package/dest/wallet/account_manager.d.ts.map +1 -1
- package/dest/wallet/account_manager.js +1 -1
- package/dest/wallet/deploy_account_method.d.ts +4 -4
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.js +1 -1
- package/dest/wallet/index.d.ts +1 -2
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +0 -1
- package/dest/wallet/wallet.d.ts +617 -1130
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +23 -39
- package/package.json +13 -12
- package/src/account/account.ts +1 -2
- package/src/account/signerless_account.ts +1 -2
- package/src/api/account.ts +1 -0
- package/src/api/contract.ts +2 -1
- package/src/api/note.ts +1 -1
- package/src/api/tx.ts +2 -0
- package/src/api/wallet.ts +1 -7
- package/src/contract/base_contract_interaction.ts +2 -3
- package/src/contract/batch_call.ts +65 -48
- package/src/contract/contract.ts +7 -5
- package/src/contract/contract_base.ts +5 -15
- package/src/contract/contract_function_interaction.ts +10 -11
- package/src/contract/deploy_method.ts +12 -11
- package/src/contract/deploy_sent_tx.ts +17 -10
- package/src/contract/interaction_options.ts +4 -10
- package/src/contract/unsafe_contract.ts +1 -1
- package/src/deployment/contract_deployer.ts +3 -2
- package/src/ethereum/portal_manager.ts +47 -12
- package/src/fee/fee_juice_payment_method_with_claim.ts +3 -1
- package/src/fee/fee_payment_method.ts +1 -1
- package/src/fee/private_fee_payment_method.ts +4 -2
- package/src/fee/public_fee_payment_method.ts +4 -2
- package/src/fee/sponsored_fee_payment.ts +3 -1
- package/src/utils/authwit.ts +20 -14
- package/src/utils/fee_juice.ts +1 -1
- package/src/wallet/account_entrypoint_meta_payment_method.ts +2 -1
- package/src/wallet/account_manager.ts +1 -1
- package/src/wallet/deploy_account_method.ts +3 -2
- package/src/wallet/index.ts +0 -1
- package/src/wallet/wallet.ts +28 -72
- package/dest/wallet/base_wallet.d.ts +0 -91
- package/dest/wallet/base_wallet.d.ts.map +0 -1
- package/dest/wallet/base_wallet.js +0 -238
- package/src/wallet/base_wallet.ts +0 -350
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EACjB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,2BAA2B,EAEhC,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAoB,KAAK,YAAY,EAAE,KAAK,MAAM,EAAqB,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EACL,OAAO,EACP,YAAY,EACZ,MAAM,EACN,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;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|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
3
|
import { ContractClassWithIdSchema, ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
|
|
4
4
|
import { Gas } from '@aztec/stdlib/gas';
|
|
5
|
-
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
6
5
|
import { AbiDecodedSchema, optional, schemas } from '@aztec/stdlib/schemas';
|
|
7
6
|
import { Capsule, HashedValues, TxHash, TxProfileResult, TxReceipt, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
8
7
|
import { z } from 'zod';
|
|
9
|
-
export const ContractInstantiationDataSchema = z.object({
|
|
10
|
-
constructorArtifact: optional(z.union([
|
|
11
|
-
FunctionAbiSchema,
|
|
12
|
-
z.string()
|
|
13
|
-
])),
|
|
14
|
-
constructorArgs: optional(z.array(z.any())),
|
|
15
|
-
skipArgsDecoding: optional(z.boolean()),
|
|
16
|
-
salt: schemas.Fr,
|
|
17
|
-
publicKeys: optional(PublicKeys.schema),
|
|
18
|
-
deployer: optional(schemas.AztecAddress)
|
|
19
|
-
});
|
|
20
8
|
export const FunctionCallSchema = z.object({
|
|
21
9
|
name: z.string(),
|
|
22
10
|
to: schemas.AztecAddress,
|
|
@@ -31,9 +19,10 @@ export const ExecutionPayloadSchema = z.object({
|
|
|
31
19
|
calls: z.array(FunctionCallSchema),
|
|
32
20
|
authWitnesses: z.array(AuthWitness.schema),
|
|
33
21
|
capsules: z.array(Capsule.schema),
|
|
34
|
-
extraHashedArgs: z.array(HashedValues.schema)
|
|
22
|
+
extraHashedArgs: z.array(HashedValues.schema),
|
|
23
|
+
feePayer: optional(schemas.AztecAddress)
|
|
35
24
|
});
|
|
36
|
-
export const
|
|
25
|
+
export const GasSettingsOptionSchema = z.object({
|
|
37
26
|
gasSettings: optional(z.object({
|
|
38
27
|
gasLimits: optional(Gas.schema),
|
|
39
28
|
teardownGasLimits: optional(Gas.schema),
|
|
@@ -45,10 +34,9 @@ export const UserFeeOptionsSchema = z.object({
|
|
|
45
34
|
feePerDaGas: schemas.BigInt,
|
|
46
35
|
feePerL2Gas: schemas.BigInt
|
|
47
36
|
}))
|
|
48
|
-
}))
|
|
49
|
-
embeddedPaymentMethodFeePayer: optional(schemas.AztecAddress)
|
|
37
|
+
}))
|
|
50
38
|
});
|
|
51
|
-
export const WalletSimulationFeeOptionSchema =
|
|
39
|
+
export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
|
|
52
40
|
estimatedGasPadding: optional(z.number()),
|
|
53
41
|
estimateGas: optional(z.boolean())
|
|
54
42
|
});
|
|
@@ -56,7 +44,7 @@ export const SendOptionsSchema = z.object({
|
|
|
56
44
|
from: schemas.AztecAddress,
|
|
57
45
|
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
58
46
|
capsules: optional(z.array(Capsule.schema)),
|
|
59
|
-
fee: optional(
|
|
47
|
+
fee: optional(GasSettingsOptionSchema)
|
|
60
48
|
});
|
|
61
49
|
export const SimulateOptionsSchema = z.object({
|
|
62
50
|
from: schemas.AztecAddress,
|
|
@@ -75,24 +63,11 @@ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
|
75
63
|
]),
|
|
76
64
|
skipProofGeneration: optional(z.boolean())
|
|
77
65
|
});
|
|
78
|
-
export const InstanceDataSchema = z.union([
|
|
79
|
-
schemas.AztecAddress,
|
|
80
|
-
ContractInstanceWithAddressSchema,
|
|
81
|
-
ContractInstantiationDataSchema,
|
|
82
|
-
z.object({
|
|
83
|
-
instance: ContractInstanceWithAddressSchema,
|
|
84
|
-
artifact: ContractArtifactSchema
|
|
85
|
-
})
|
|
86
|
-
]);
|
|
87
66
|
export const MessageHashOrIntentSchema = z.union([
|
|
88
67
|
schemas.Fr,
|
|
89
|
-
schemas.Buffer,
|
|
90
68
|
z.object({
|
|
91
69
|
consumer: schemas.AztecAddress,
|
|
92
|
-
innerHash:
|
|
93
|
-
schemas.Buffer,
|
|
94
|
-
schemas.Fr
|
|
95
|
-
])
|
|
70
|
+
innerHash: schemas.Fr
|
|
96
71
|
}),
|
|
97
72
|
z.object({
|
|
98
73
|
caller: schemas.AztecAddress,
|
|
@@ -110,7 +85,7 @@ export const BatchedMethodSchema = z.union([
|
|
|
110
85
|
z.object({
|
|
111
86
|
name: z.literal('registerContract'),
|
|
112
87
|
args: z.tuple([
|
|
113
|
-
|
|
88
|
+
ContractInstanceWithAddressSchema,
|
|
114
89
|
optional(ContractArtifactSchema),
|
|
115
90
|
optional(schemas.Fr)
|
|
116
91
|
])
|
|
@@ -125,11 +100,16 @@ export const BatchedMethodSchema = z.union([
|
|
|
125
100
|
z.object({
|
|
126
101
|
name: z.literal('simulateUtility'),
|
|
127
102
|
args: z.tuple([
|
|
128
|
-
|
|
129
|
-
z.array(z.any()),
|
|
130
|
-
schemas.AztecAddress,
|
|
103
|
+
FunctionCallSchema,
|
|
131
104
|
optional(z.array(AuthWitness.schema))
|
|
132
105
|
])
|
|
106
|
+
}),
|
|
107
|
+
z.object({
|
|
108
|
+
name: z.literal('simulateTx'),
|
|
109
|
+
args: z.tuple([
|
|
110
|
+
ExecutionPayloadSchema,
|
|
111
|
+
SimulateOptionsSchema
|
|
112
|
+
])
|
|
133
113
|
})
|
|
134
114
|
]);
|
|
135
115
|
export const ContractMetadataSchema = z.object({
|
|
@@ -174,9 +154,9 @@ export const WalletSchema = {
|
|
|
174
154
|
alias: z.string(),
|
|
175
155
|
item: schemas.AztecAddress
|
|
176
156
|
}))),
|
|
177
|
-
registerContract: z.function().args(
|
|
157
|
+
registerContract: z.function().args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr)).returns(ContractInstanceWithAddressSchema),
|
|
178
158
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
179
|
-
simulateUtility: z.function().args(
|
|
159
|
+
simulateUtility: z.function().args(FunctionCallSchema, optional(z.array(AuthWitness.schema))).returns(UtilitySimulationResult.schema),
|
|
180
160
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
181
161
|
sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
|
|
182
162
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
@@ -197,6 +177,10 @@ export const WalletSchema = {
|
|
|
197
177
|
z.object({
|
|
198
178
|
name: z.literal('simulateUtility'),
|
|
199
179
|
result: UtilitySimulationResult.schema
|
|
180
|
+
}),
|
|
181
|
+
z.object({
|
|
182
|
+
name: z.literal('simulateTx'),
|
|
183
|
+
result: TxSimulationResult.schema
|
|
200
184
|
})
|
|
201
185
|
])))
|
|
202
186
|
};
|
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.fce3e4f",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./abi": "./dest/api/abi.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"tsconfig": "./tsconfig.json"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
|
-
"build": "yarn clean &&
|
|
40
|
-
"build:dev": "
|
|
41
|
-
"build:ts": "
|
|
39
|
+
"build": "yarn clean && tsgo -b",
|
|
40
|
+
"build:dev": "tsgo -b --watch",
|
|
41
|
+
"build:ts": "tsgo -b",
|
|
42
42
|
"clean": "rm -rf ./dest .tsbuildinfo ./src/account_contract/artifacts",
|
|
43
43
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
44
44
|
},
|
|
@@ -84,22 +84,23 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@aztec/constants": "0.0.1-commit.
|
|
88
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
89
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
90
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
91
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
92
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
93
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
87
|
+
"@aztec/constants": "0.0.1-commit.fce3e4f",
|
|
88
|
+
"@aztec/entrypoints": "0.0.1-commit.fce3e4f",
|
|
89
|
+
"@aztec/ethereum": "0.0.1-commit.fce3e4f",
|
|
90
|
+
"@aztec/foundation": "0.0.1-commit.fce3e4f",
|
|
91
|
+
"@aztec/l1-artifacts": "0.0.1-commit.fce3e4f",
|
|
92
|
+
"@aztec/protocol-contracts": "0.0.1-commit.fce3e4f",
|
|
93
|
+
"@aztec/stdlib": "0.0.1-commit.fce3e4f",
|
|
94
94
|
"axios": "^1.12.0",
|
|
95
95
|
"tslib": "^2.4.0",
|
|
96
|
-
"viem": "npm:@
|
|
96
|
+
"viem": "npm:@aztec/viem@2.38.2",
|
|
97
97
|
"zod": "^3.23.8"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@jest/globals": "^30.0.0",
|
|
101
101
|
"@types/jest": "^30.0.0",
|
|
102
102
|
"@types/node": "^22.15.17",
|
|
103
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
103
104
|
"buffer": "^6.0.3",
|
|
104
105
|
"crypto-browserify": "^3.12.1",
|
|
105
106
|
"jest": "^30.0.0",
|
package/src/account/account.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
2
|
-
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
3
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
4
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
6
|
-
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
5
|
+
import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
7
6
|
|
|
8
7
|
import { type CallIntent, type IntentInnerHash, computeAuthWitMessageHash } from '../utils/authwit.js';
|
|
9
8
|
import type { AccountInterface } from './interface.js';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { ChainInfo, EntrypointInterface } from '@aztec/entrypoints/interfaces';
|
|
2
2
|
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
3
|
-
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
4
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
5
4
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
6
|
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
8
7
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
9
|
-
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
8
|
+
import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
10
9
|
|
|
11
10
|
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
12
11
|
import type { Account } from './account.js';
|
package/src/api/account.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { type AccountContract, type AccountInterface, type Salt, getAccountContractAddress } from '../account/index.js';
|
|
2
2
|
export type { AuthWitnessProvider, ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
3
|
+
export { ChainInfoSchema } from '@aztec/entrypoints/interfaces';
|
|
3
4
|
|
|
4
5
|
export { AccountWithSecretKey } from '../account/account_with_secret_key.js';
|
|
5
6
|
export { type Account, BaseAccount } from '../account/account.js';
|
package/src/api/contract.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* ```ts
|
|
18
|
-
* const contract =
|
|
18
|
+
* const contract = Contract.at(address, MyContractArtifact, wallet);
|
|
19
19
|
* await contract.methods.mint(1000, owner).send().wait();
|
|
20
20
|
* console.log(`Total supply is now ${await contract.methods.totalSupply().simulate()}`);
|
|
21
21
|
* ```
|
|
@@ -44,6 +44,7 @@ export {
|
|
|
44
44
|
type ProfileInteractionOptions,
|
|
45
45
|
type SimulateInteractionOptions,
|
|
46
46
|
type InteractionFeeOptions,
|
|
47
|
+
type GasSettingsOption,
|
|
47
48
|
toProfileOptions,
|
|
48
49
|
toSendOptions,
|
|
49
50
|
toSimulateOptions,
|
package/src/api/note.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Comparator, Note } from '@aztec/stdlib/note';
|
package/src/api/tx.ts
CHANGED
package/src/api/wallet.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export {
|
|
2
2
|
type Aliased,
|
|
3
|
-
type ContractInstanceAndArtifact,
|
|
4
|
-
type UserFeeOptions,
|
|
5
3
|
type SimulateOptions,
|
|
6
4
|
type ProfileOptions,
|
|
7
5
|
type SendOptions,
|
|
@@ -11,15 +9,13 @@ export {
|
|
|
11
9
|
type BatchedMethodResultWrapper,
|
|
12
10
|
type BatchResults,
|
|
13
11
|
type Wallet,
|
|
14
|
-
ContractInstantiationDataSchema,
|
|
15
12
|
FunctionCallSchema,
|
|
16
13
|
ExecutionPayloadSchema,
|
|
17
|
-
|
|
14
|
+
GasSettingsOptionSchema,
|
|
18
15
|
WalletSimulationFeeOptionSchema,
|
|
19
16
|
SendOptionsSchema,
|
|
20
17
|
SimulateOptionsSchema,
|
|
21
18
|
ProfileOptionsSchema,
|
|
22
|
-
InstanceDataSchema,
|
|
23
19
|
MessageHashOrIntentSchema,
|
|
24
20
|
BatchedMethodSchema,
|
|
25
21
|
ContractMetadataSchema,
|
|
@@ -28,8 +24,6 @@ export {
|
|
|
28
24
|
WalletSchema,
|
|
29
25
|
} from '../wallet/wallet.js';
|
|
30
26
|
|
|
31
|
-
export { type FeeOptions, BaseWallet } from '../wallet/base_wallet.js';
|
|
32
|
-
|
|
33
27
|
export { AccountManager } from '../wallet/account_manager.js';
|
|
34
28
|
|
|
35
29
|
export { type DeployAccountOptions, DeployAccountMethod } from '../wallet/deploy_account_method.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
-
import type { Capsule } from '@aztec/stdlib/tx';
|
|
3
|
+
import type { Capsule, ExecutionPayload } from '@aztec/stdlib/tx';
|
|
5
4
|
|
|
6
5
|
import type { Wallet } from '../wallet/wallet.js';
|
|
7
6
|
import { type RequestInteractionOptions, type SendInteractionOptions, toSendOptions } from './interaction_options.js';
|
|
@@ -42,7 +41,7 @@ export abstract class BaseContractInteraction {
|
|
|
42
41
|
// docs:end:send
|
|
43
42
|
const sendTx = async () => {
|
|
44
43
|
const executionPayload = await this.request(options);
|
|
45
|
-
const sendOptions =
|
|
44
|
+
const sendOptions = toSendOptions(options);
|
|
46
45
|
return this.wallet.sendTx(executionPayload, sendOptions);
|
|
47
46
|
};
|
|
48
47
|
return new SentTx(this.wallet, sendTx);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
|
|
2
1
|
import { type FunctionCall, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import {
|
|
3
|
+
ExecutionPayload,
|
|
4
|
+
TxSimulationResult,
|
|
5
|
+
UtilitySimulationResult,
|
|
6
|
+
mergeExecutionPayloads,
|
|
7
|
+
} from '@aztec/stdlib/tx';
|
|
3
8
|
|
|
4
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
9
|
+
import type { BatchedMethod, Wallet } from '../wallet/wallet.js';
|
|
5
10
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
6
11
|
import {
|
|
7
12
|
type RequestInteractionOptions,
|
|
@@ -35,13 +40,12 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
44
|
-
* @returns The result of the transaction as returned by the contract function.
|
|
43
|
+
* Simulates the batch, supporting private, public and utility functions. Although this is a single
|
|
44
|
+
* interaction with the wallet, private and public functions will be grouped into a single ExecutionPayload
|
|
45
|
+
* that the wallet will simulate as a single transaction. Utility function calls will simply be executed
|
|
46
|
+
* one by one.
|
|
47
|
+
* @param options - An optional object containing additional configuration for the interaction.
|
|
48
|
+
* @returns The results of all the interactions that make up the batch
|
|
45
49
|
*/
|
|
46
50
|
public async simulate(options: SimulateInteractionOptions): Promise<any> {
|
|
47
51
|
const { indexedExecutionPayloads, utility } = (await this.getExecutionPayloads()).reduce<{
|
|
@@ -70,52 +74,65 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
70
74
|
{ indexedExecutionPayloads: [], utility: [], publicIndex: 0, privateIndex: 0 },
|
|
71
75
|
);
|
|
72
76
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
const batchRequests: Array<BatchedMethod<'simulateUtility'> | BatchedMethod<'simulateTx'>> = [];
|
|
78
|
+
|
|
79
|
+
// Add utility calls to batch
|
|
80
|
+
for (const [call] of utility) {
|
|
81
|
+
batchRequests.push({
|
|
82
|
+
name: 'simulateUtility' as const,
|
|
83
|
+
args: [call, options?.authWitnesses] as const,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
// Add tx simulation to batch if there are any private/public calls
|
|
88
|
+
if (indexedExecutionPayloads.length > 0) {
|
|
89
|
+
const payloads = indexedExecutionPayloads.map(([request]) => request);
|
|
90
|
+
const combinedPayload = mergeExecutionPayloads(payloads);
|
|
91
|
+
const executionPayload = new ExecutionPayload(
|
|
92
|
+
combinedPayload.calls,
|
|
93
|
+
combinedPayload.authWitnesses.concat(options.authWitnesses ?? []),
|
|
94
|
+
combinedPayload.capsules.concat(options.capsules ?? []),
|
|
95
|
+
combinedPayload.extraHashedArgs,
|
|
96
|
+
);
|
|
91
97
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
batchRequests.push({
|
|
99
|
+
name: 'simulateTx' as const,
|
|
100
|
+
args: [executionPayload, toSimulateOptions(options)],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const batchResults = batchRequests.length > 0 ? await this.wallet.batch(batchRequests) : [];
|
|
98
105
|
|
|
99
106
|
const results: any[] = [];
|
|
100
107
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
// Process utility results (they come first in batch results)
|
|
109
|
+
for (let i = 0; i < utility.length; i++) {
|
|
110
|
+
const [call, resultIndex] = utility[i];
|
|
111
|
+
const wrappedResult = batchResults[i];
|
|
112
|
+
if (wrappedResult.name === 'simulateUtility') {
|
|
113
|
+
const rawReturnValues = (wrappedResult.result as UtilitySimulationResult).result;
|
|
114
|
+
results[resultIndex] = rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
105
117
|
|
|
106
|
-
if
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
// Process tx simulation result (it comes last if present)
|
|
119
|
+
if (indexedExecutionPayloads.length > 0) {
|
|
120
|
+
const txResultWrapper = batchResults[utility.length];
|
|
121
|
+
if (txResultWrapper.name === 'simulateTx') {
|
|
122
|
+
const simulatedTx = txResultWrapper.result as TxSimulationResult;
|
|
123
|
+
indexedExecutionPayloads.forEach(([request, callIndex, resultIndex]) => {
|
|
124
|
+
const call = request.calls[0];
|
|
125
|
+
// As account entrypoints are private, for private functions we retrieve the return values from the first nested call
|
|
126
|
+
// since we're interested in the first set of values AFTER the account entrypoint
|
|
127
|
+
// For public functions we retrieve the first values directly from the public output.
|
|
128
|
+
const rawReturnValues =
|
|
129
|
+
call.type == FunctionType.PRIVATE
|
|
130
|
+
? simulatedTx.getPrivateReturnValues()?.nested?.[resultIndex].values
|
|
131
|
+
: simulatedTx.getPublicReturnValues()?.[resultIndex].values;
|
|
116
132
|
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
results[callIndex] = rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [];
|
|
134
|
+
});
|
|
135
|
+
}
|
|
119
136
|
}
|
|
120
137
|
|
|
121
138
|
return results;
|
package/src/contract/contract.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
4
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
4
5
|
|
|
5
6
|
import type { Wallet } from '../wallet/wallet.js';
|
|
@@ -21,9 +22,8 @@ export class Contract extends ContractBase {
|
|
|
21
22
|
* @param wallet - The wallet to use when interacting with the contract.
|
|
22
23
|
* @returns A promise that resolves to a new Contract instance.
|
|
23
24
|
*/
|
|
24
|
-
public static
|
|
25
|
-
|
|
26
|
-
return new Contract(instance, artifact, wallet);
|
|
25
|
+
public static at(address: AztecAddress, artifact: ContractArtifact, wallet: Wallet): Contract {
|
|
26
|
+
return new Contract(address, artifact, wallet);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -34,7 +34,8 @@ export class Contract extends ContractBase {
|
|
|
34
34
|
* @param constructorName - The name of the constructor function to call.
|
|
35
35
|
*/
|
|
36
36
|
public static deploy(wallet: Wallet, artifact: ContractArtifact, args: any[], constructorName?: string) {
|
|
37
|
-
const postDeployCtor = (
|
|
37
|
+
const postDeployCtor = (instance: ContractInstanceWithAddress, wallet: Wallet) =>
|
|
38
|
+
Contract.at(instance.address, artifact, wallet);
|
|
38
39
|
return new DeployMethod(PublicKeys.default(), wallet, artifact, postDeployCtor, args, constructorName);
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -54,7 +55,8 @@ export class Contract extends ContractBase {
|
|
|
54
55
|
args: any[],
|
|
55
56
|
constructorName?: string,
|
|
56
57
|
) {
|
|
57
|
-
const postDeployCtor = (
|
|
58
|
+
const postDeployCtor = (instance: ContractInstanceWithAddress, wallet: Wallet) =>
|
|
59
|
+
Contract.at(instance.address, artifact, wallet);
|
|
58
60
|
return new DeployMethod(publicKeys, wallet, artifact, postDeployCtor, args, constructorName);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
FunctionSelector,
|
|
6
6
|
getAllFunctionAbis,
|
|
7
7
|
} from '@aztec/stdlib/abi';
|
|
8
|
-
import
|
|
8
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
9
|
|
|
10
10
|
import type { Wallet } from '../wallet/wallet.js';
|
|
11
11
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
@@ -38,8 +38,8 @@ export class ContractBase {
|
|
|
38
38
|
public methods: { [name: string]: ContractMethod } = {};
|
|
39
39
|
|
|
40
40
|
protected constructor(
|
|
41
|
-
/** The
|
|
42
|
-
public readonly
|
|
41
|
+
/** The contract's address. */
|
|
42
|
+
public readonly address: AztecAddress,
|
|
43
43
|
/** The Application Binary Interface for the contract. */
|
|
44
44
|
public readonly artifact: ContractArtifact,
|
|
45
45
|
/** The wallet used for interacting with this contract. */
|
|
@@ -47,7 +47,7 @@ export class ContractBase {
|
|
|
47
47
|
) {
|
|
48
48
|
getAllFunctionAbis(artifact).forEach((f: FunctionAbi) => {
|
|
49
49
|
const interactionFunction = (...args: any[]) => {
|
|
50
|
-
return new ContractFunctionInteraction(this.wallet, this.
|
|
50
|
+
return new ContractFunctionInteraction(this.wallet, this.address, f, args);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
this.methods[f.name] = Object.assign(interactionFunction, {
|
|
@@ -62,22 +62,12 @@ export class ContractBase {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/** Address of the contract. */
|
|
66
|
-
public get address() {
|
|
67
|
-
return this.instance.address;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Partial address of the contract. */
|
|
71
|
-
public get partialAddress() {
|
|
72
|
-
return computePartialAddress(this.instance);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
65
|
/**
|
|
76
66
|
* Creates a new instance of the contract wrapper attached to a different wallet.
|
|
77
67
|
* @param wallet - Wallet to use for sending txs.
|
|
78
68
|
* @returns A new contract instance.
|
|
79
69
|
*/
|
|
80
70
|
public withWallet(wallet: Wallet): this {
|
|
81
|
-
return new ContractBase(this.
|
|
71
|
+
return new ContractBase(this.address, this.artifact, wallet) as this;
|
|
82
72
|
}
|
|
83
73
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
|
|
2
1
|
import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi, encodeArguments } from '@aztec/stdlib/abi';
|
|
3
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
4
|
import { type Capsule, type HashedValues, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
|
|
5
|
+
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
7
|
import type { Wallet } from '../wallet/wallet.js';
|
|
8
8
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
@@ -103,25 +103,24 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
103
103
|
): Promise<SimulationReturn<typeof options.includeMetadata>> {
|
|
104
104
|
// docs:end:simulate
|
|
105
105
|
if (this.functionDao.functionType == FunctionType.UTILITY) {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
106
|
+
const call = await this.getFunctionCall();
|
|
107
|
+
const utilityResult = await this.wallet.simulateUtility(call, options.authWitnesses ?? []);
|
|
108
|
+
|
|
109
|
+
// Decode the raw field elements to the actual return type
|
|
110
|
+
const returnValue = utilityResult.result ? decodeFromAbi(this.functionDao.returnTypes, utilityResult.result) : [];
|
|
112
111
|
|
|
113
112
|
if (options.includeMetadata) {
|
|
114
113
|
return {
|
|
115
114
|
stats: utilityResult.stats,
|
|
116
|
-
result:
|
|
115
|
+
result: returnValue,
|
|
117
116
|
};
|
|
118
117
|
} else {
|
|
119
|
-
return
|
|
118
|
+
return returnValue;
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
const executionPayload = await this.request(options);
|
|
124
|
-
const simulatedTx = await this.wallet.simulateTx(executionPayload,
|
|
123
|
+
const simulatedTx = await this.wallet.simulateTx(executionPayload, toSimulateOptions(options));
|
|
125
124
|
|
|
126
125
|
let rawReturnValues;
|
|
127
126
|
if (this.functionDao.functionType == FunctionType.PRIVATE) {
|
|
@@ -168,7 +167,7 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
const executionPayload = await this.request(options);
|
|
171
|
-
return await this.wallet.profileTx(executionPayload,
|
|
170
|
+
return await this.wallet.profileTx(executionPayload, toProfileOptions(options));
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
/**
|