@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/wallet.ts"],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QnC,CAAC;AAuGH,QAAA,MAAe,mBAAmB;;;;;;;;;;;;;;;;;;QAAU,mBAAmB;;;;;;;;;;;;;;;;;;MAA4C,CAAC;AAE5G,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,MAAM,CAI7C,CAAC"}
|
package/dest/wallet/wallet.js
CHANGED
|
@@ -4,7 +4,7 @@ import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
|
4
4
|
import { ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
|
|
5
5
|
import { Gas } from '@aztec/stdlib/gas';
|
|
6
6
|
import { AbiDecodedSchema, optional, schemas, zodFor } from '@aztec/stdlib/schemas';
|
|
7
|
-
import { Capsule, HashedValues, TxHash, TxProfileResult, TxReceipt, TxSimulationResult,
|
|
7
|
+
import { Capsule, HashedValues, TxHash, TxProfileResult, TxReceipt, TxSimulationResult, UtilityExecutionResult, inTxSchema } from '@aztec/stdlib/tx';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { NO_WAIT } from '../contract/interaction_options.js';
|
|
10
10
|
export const ExecutionPayloadSchema = z.object({
|
|
@@ -46,7 +46,8 @@ export const SendOptionsSchema = z.object({
|
|
|
46
46
|
wait: optional(z.union([
|
|
47
47
|
z.literal(NO_WAIT),
|
|
48
48
|
WaitOptsSchema
|
|
49
|
-
]))
|
|
49
|
+
])),
|
|
50
|
+
additionalScopes: optional(z.array(schemas.AztecAddress))
|
|
50
51
|
});
|
|
51
52
|
export const SimulateOptionsSchema = z.object({
|
|
52
53
|
from: schemas.AztecAddress,
|
|
@@ -55,7 +56,8 @@ export const SimulateOptionsSchema = z.object({
|
|
|
55
56
|
fee: optional(WalletSimulationFeeOptionSchema),
|
|
56
57
|
skipTxValidation: optional(z.boolean()),
|
|
57
58
|
skipFeeEnforcement: optional(z.boolean()),
|
|
58
|
-
includeMetadata: optional(z.boolean())
|
|
59
|
+
includeMetadata: optional(z.boolean()),
|
|
60
|
+
additionalScopes: optional(z.array(schemas.AztecAddress))
|
|
59
61
|
});
|
|
60
62
|
export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
61
63
|
profileMode: z.enum([
|
|
@@ -121,7 +123,11 @@ export const ContractFunctionPatternSchema = z.object({
|
|
|
121
123
|
function: z.union([
|
|
122
124
|
z.string(),
|
|
123
125
|
z.literal('*')
|
|
124
|
-
])
|
|
126
|
+
]),
|
|
127
|
+
additionalScopes: optional(z.union([
|
|
128
|
+
z.array(schemas.AztecAddress),
|
|
129
|
+
z.literal('*')
|
|
130
|
+
]))
|
|
125
131
|
});
|
|
126
132
|
export const AccountsCapabilitySchema = z.object({
|
|
127
133
|
type: z.literal('accounts'),
|
|
@@ -231,6 +237,19 @@ export const WalletCapabilitiesSchema = z.object({
|
|
|
231
237
|
}),
|
|
232
238
|
expiresAt: optional(z.number())
|
|
233
239
|
});
|
|
240
|
+
const OffchainEffectSchema = z.object({
|
|
241
|
+
data: z.array(schemas.Fr),
|
|
242
|
+
contractAddress: schemas.AztecAddress
|
|
243
|
+
});
|
|
244
|
+
const OffchainMessageSchema = z.object({
|
|
245
|
+
recipient: schemas.AztecAddress,
|
|
246
|
+
payload: z.array(schemas.Fr),
|
|
247
|
+
contractAddress: schemas.AztecAddress
|
|
248
|
+
});
|
|
249
|
+
const OffchainOutputSchema = z.object({
|
|
250
|
+
offchainEffects: z.array(OffchainEffectSchema),
|
|
251
|
+
offchainMessages: z.array(OffchainMessageSchema)
|
|
252
|
+
});
|
|
234
253
|
/**
|
|
235
254
|
* Record of all wallet method schemas (excluding batch).
|
|
236
255
|
* This is the single source of truth for method schemas - batch schemas are derived from this.
|
|
@@ -253,11 +272,18 @@ export const WalletCapabilitiesSchema = z.object({
|
|
|
253
272
|
}))),
|
|
254
273
|
registerContract: z.function().args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr)).returns(ContractInstanceWithAddressSchema),
|
|
255
274
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
256
|
-
|
|
275
|
+
executeUtility: z.function().args(FunctionCall.schema, z.object({
|
|
276
|
+
scope: schemas.AztecAddress,
|
|
277
|
+
authWitnesses: optional(z.array(AuthWitness.schema))
|
|
278
|
+
})).returns(UtilityExecutionResult.schema),
|
|
257
279
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
258
280
|
sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(z.union([
|
|
259
|
-
|
|
260
|
-
|
|
281
|
+
z.object({
|
|
282
|
+
txHash: TxHash.schema
|
|
283
|
+
}).merge(OffchainOutputSchema),
|
|
284
|
+
z.object({
|
|
285
|
+
receipt: TxReceipt.schema
|
|
286
|
+
}).merge(OffchainOutputSchema)
|
|
261
287
|
])),
|
|
262
288
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
263
289
|
requestCapabilities: z.function().args(AppCapabilitiesSchema).returns(WalletCapabilitiesSchema)
|
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.db765a8",
|
|
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.
|
|
104
|
-
"axios": "^1.
|
|
97
|
+
"@aztec/constants": "0.0.1-commit.db765a8",
|
|
98
|
+
"@aztec/entrypoints": "0.0.1-commit.db765a8",
|
|
99
|
+
"@aztec/ethereum": "0.0.1-commit.db765a8",
|
|
100
|
+
"@aztec/foundation": "0.0.1-commit.db765a8",
|
|
101
|
+
"@aztec/l1-artifacts": "0.0.1-commit.db765a8",
|
|
102
|
+
"@aztec/protocol-contracts": "0.0.1-commit.db765a8",
|
|
103
|
+
"@aztec/stdlib": "0.0.1-commit.db765a8",
|
|
104
|
+
"axios": "^1.13.5",
|
|
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.db765a8",
|
|
111
111
|
"@jest/globals": "^30.0.0",
|
|
112
112
|
"@types/jest": "^30.0.0",
|
|
113
113
|
"@types/node": "^22.15.17",
|
package/src/api/abi.ts
CHANGED
package/src/api/contract.ts
CHANGED
|
@@ -48,6 +48,8 @@ export { ContractFunctionInteraction } from '../contract/contract_function_inter
|
|
|
48
48
|
export {
|
|
49
49
|
NO_WAIT,
|
|
50
50
|
type NoWait,
|
|
51
|
+
type OffchainMessage,
|
|
52
|
+
type OffchainOutput,
|
|
51
53
|
type RequestInteractionOptions,
|
|
52
54
|
type SendInteractionOptions,
|
|
53
55
|
type ProfileInteractionOptions,
|
|
@@ -56,7 +58,11 @@ export {
|
|
|
56
58
|
type InteractionWaitOptions,
|
|
57
59
|
type GasSettingsOption,
|
|
58
60
|
type SendReturn,
|
|
59
|
-
type
|
|
61
|
+
type SimulationResult,
|
|
62
|
+
type TxSendResultImmediate,
|
|
63
|
+
type TxSendResultMined,
|
|
64
|
+
emptyOffchainOutput,
|
|
65
|
+
extractOffchainOutput,
|
|
60
66
|
toProfileOptions,
|
|
61
67
|
toSendOptions,
|
|
62
68
|
toSimulateOptions,
|
|
@@ -67,6 +73,7 @@ export { ContractBase, type ContractMethod, type ContractStorageLayout } from '.
|
|
|
67
73
|
export { BatchCall } from '../contract/batch_call.js';
|
|
68
74
|
export {
|
|
69
75
|
type DeployOptions,
|
|
76
|
+
type DeployResultMined,
|
|
70
77
|
type DeployReturn,
|
|
71
78
|
type DeployTxReceipt,
|
|
72
79
|
type DeployWaitOptions,
|
package/src/api/wallet.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type SendInteractionOptions,
|
|
10
10
|
type SendInteractionOptionsWithoutWait,
|
|
11
11
|
type SendReturn,
|
|
12
|
+
type TxSendResultMined,
|
|
12
13
|
toSendOptions,
|
|
13
14
|
} from './interaction_options.js';
|
|
14
15
|
|
|
@@ -41,8 +42,8 @@ export abstract class BaseContractInteraction {
|
|
|
41
42
|
* the AztecAddress of the sender, optional fee configuration, and optional wait settings
|
|
42
43
|
* @returns TReturn (if wait is undefined/WaitOpts) or TxHash (if wait is NO_WAIT)
|
|
43
44
|
*/
|
|
44
|
-
// Overload for when wait is not specified at all - returns TReturn
|
|
45
|
-
public send<TReturn = TxReceipt>(options: SendInteractionOptionsWithoutWait): Promise<TReturn
|
|
45
|
+
// Overload for when wait is not specified at all - returns { receipt: TReturn, offchainEffects }
|
|
46
|
+
public send<TReturn = TxReceipt>(options: SendInteractionOptionsWithoutWait): Promise<TxSendResultMined<TReturn>>;
|
|
46
47
|
// Generic overload for explicit wait values
|
|
47
48
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
48
49
|
public send<TReturn = TxReceipt, W extends InteractionWaitOptions = undefined>(
|
|
@@ -1,16 +1,13 @@
|
|
|
1
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';
|
|
2
|
+
import { ExecutionPayload, TxSimulationResult, UtilityExecutionResult, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
8
3
|
|
|
9
4
|
import type { BatchedMethod, Wallet } from '../wallet/wallet.js';
|
|
10
5
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
11
6
|
import {
|
|
12
7
|
type RequestInteractionOptions,
|
|
13
8
|
type SimulateInteractionOptions,
|
|
9
|
+
emptyOffchainOutput,
|
|
10
|
+
extractOffchainOutput,
|
|
14
11
|
toSimulateOptions,
|
|
15
12
|
} from './interaction_options.js';
|
|
16
13
|
|
|
@@ -42,9 +39,9 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
/**
|
|
45
|
-
* Simulates the batch, supporting private, public and utility functions. Although this is a single
|
|
42
|
+
* Simulates/executes the batch, supporting private, public and utility functions. Although this is a single
|
|
46
43
|
* interaction with the wallet, private and public functions will be grouped into a single ExecutionPayload
|
|
47
|
-
* that the wallet will simulate as a single transaction. Utility function calls will
|
|
44
|
+
* that the wallet will simulate as a single transaction. Utility function calls will be executed
|
|
48
45
|
* one by one.
|
|
49
46
|
* @param options - An optional object containing additional configuration for the interaction.
|
|
50
47
|
* @returns The results of all the interactions that make up the batch
|
|
@@ -81,8 +78,8 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
81
78
|
// Add utility calls to batch
|
|
82
79
|
for (const [call] of utility) {
|
|
83
80
|
batchRequests.push({
|
|
84
|
-
name: '
|
|
85
|
-
args: [call, options
|
|
81
|
+
name: 'executeUtility' as const,
|
|
82
|
+
args: [call, { scope: options.from, authWitnesses: options.authWitnesses }],
|
|
86
83
|
});
|
|
87
84
|
}
|
|
88
85
|
|
|
@@ -111,9 +108,12 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
111
108
|
for (let i = 0; i < utility.length; i++) {
|
|
112
109
|
const [call, resultIndex] = utility[i];
|
|
113
110
|
const wrappedResult = batchResults[i];
|
|
114
|
-
if (wrappedResult.name === '
|
|
115
|
-
const rawReturnValues = (wrappedResult.result as
|
|
116
|
-
results[resultIndex] =
|
|
111
|
+
if (wrappedResult.name === 'executeUtility') {
|
|
112
|
+
const rawReturnValues = (wrappedResult.result as UtilityExecutionResult).result;
|
|
113
|
+
results[resultIndex] = {
|
|
114
|
+
result: rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [],
|
|
115
|
+
...emptyOffchainOutput(),
|
|
116
|
+
};
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -132,7 +132,10 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
132
132
|
? simulatedTx.getPrivateReturnValues()?.nested?.[resultIndex].values
|
|
133
133
|
: simulatedTx.getPublicReturnValues()?.[resultIndex].values;
|
|
134
134
|
|
|
135
|
-
results[callIndex] =
|
|
135
|
+
results[callIndex] = {
|
|
136
|
+
result: rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [],
|
|
137
|
+
...extractOffchainOutput(simulatedTx.offchainEffects),
|
|
138
|
+
};
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type ABIParameter,
|
|
3
|
+
type AbiType,
|
|
2
4
|
type FunctionAbi,
|
|
3
5
|
FunctionCall,
|
|
4
6
|
FunctionSelector,
|
|
5
7
|
FunctionType,
|
|
8
|
+
canBeMappedFromNullOrUndefined,
|
|
6
9
|
decodeFromAbi,
|
|
7
10
|
encodeArguments,
|
|
11
|
+
isOptionStruct,
|
|
8
12
|
} from '@aztec/stdlib/abi';
|
|
9
13
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
10
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
-
import {
|
|
15
|
+
import type { Capsule, HashedValues, TxProfileResult } from '@aztec/stdlib/tx';
|
|
12
16
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
13
17
|
|
|
14
18
|
import type { Wallet } from '../wallet/wallet.js';
|
|
@@ -18,7 +22,9 @@ import {
|
|
|
18
22
|
type ProfileInteractionOptions,
|
|
19
23
|
type RequestInteractionOptions,
|
|
20
24
|
type SimulateInteractionOptions,
|
|
21
|
-
type
|
|
25
|
+
type SimulationResult,
|
|
26
|
+
emptyOffchainOutput,
|
|
27
|
+
extractOffchainOutput,
|
|
22
28
|
toProfileOptions,
|
|
23
29
|
toSimulateOptions,
|
|
24
30
|
} from './interaction_options.js';
|
|
@@ -38,11 +44,32 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
38
44
|
private extraHashedArgs: HashedValues[] = [],
|
|
39
45
|
) {
|
|
40
46
|
super(wallet, authWitnesses, capsules);
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
// This may feel a bit ad-hoc here, so it warrants a comment. We accept Noir Option<T> parameters, and it's natural
|
|
48
|
+
// to map JS's null/undefined to Noir Option's None. One possible way to deal with null/undefined arguments at this
|
|
49
|
+
// point in the codebase is to conclude that they are accepted since at least one Noir type (ie: Option) can be
|
|
50
|
+
// encoded from them. Then we would let `encode` deal with potential mismatches. I chose not to do that because of
|
|
51
|
+
// the pervasiveness of null/undefined in JS, and how easy it is to inadvertently pass it around. Having this check
|
|
52
|
+
// here allows us to fail at a point where the boundaries and intent are clear.
|
|
53
|
+
if (this.hasInvalidNullOrUndefinedArguments(args)) {
|
|
54
|
+
const signature = formatFunctionSignature(this.functionDao.name, this.functionDao.parameters);
|
|
55
|
+
const received = args.map(formatArg).join(', ');
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Null or undefined arguments are only allowed for Option<T> parameters in ${signature}. Received: (${received}).`,
|
|
58
|
+
);
|
|
43
59
|
}
|
|
44
60
|
}
|
|
45
61
|
|
|
62
|
+
private hasInvalidNullOrUndefinedArguments(args: any[]) {
|
|
63
|
+
return args.some((arg, index) => {
|
|
64
|
+
if (arg !== undefined && arg !== null) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const parameterType = this.functionDao.parameters[index]?.type;
|
|
69
|
+
return !parameterType || !canBeMappedFromNullOrUndefined(parameterType);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
46
73
|
/**
|
|
47
74
|
* Returns the encoded function call wrapped by this interaction
|
|
48
75
|
* Useful when generating authwits
|
|
@@ -97,21 +124,16 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
97
124
|
* function or a rich object containing extra metadata, such as estimated gas costs (if requested via options),
|
|
98
125
|
* execution statistics and emitted offchain effects
|
|
99
126
|
*/
|
|
100
|
-
public async simulate<T extends SimulateInteractionOptions>(
|
|
101
|
-
options: T,
|
|
102
|
-
): Promise<SimulationReturn<Exclude<T['fee'], undefined>['estimateGas']>>;
|
|
103
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
104
|
-
public async simulate<T extends SimulateInteractionOptions>(
|
|
105
|
-
options: T,
|
|
106
|
-
): Promise<SimulationReturn<T['includeMetadata']>>;
|
|
107
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
108
127
|
public async simulate(
|
|
109
|
-
options: SimulateInteractionOptions,
|
|
110
|
-
): Promise<
|
|
128
|
+
options: SimulateInteractionOptions = {} as SimulateInteractionOptions,
|
|
129
|
+
): Promise<SimulationResult> {
|
|
111
130
|
// docs:end:simulate
|
|
112
131
|
if (this.functionDao.functionType == FunctionType.UTILITY) {
|
|
113
132
|
const call = await this.getFunctionCall();
|
|
114
|
-
const utilityResult = await this.wallet.
|
|
133
|
+
const utilityResult = await this.wallet.executeUtility(call, {
|
|
134
|
+
scope: options.from,
|
|
135
|
+
authWitnesses: options.authWitnesses,
|
|
136
|
+
});
|
|
115
137
|
|
|
116
138
|
// Decode the raw field elements to the actual return type
|
|
117
139
|
const returnValue = utilityResult.result ? decodeFromAbi(this.functionDao.returnTypes, utilityResult.result) : [];
|
|
@@ -119,11 +141,11 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
119
141
|
if (options.includeMetadata) {
|
|
120
142
|
return {
|
|
121
143
|
stats: utilityResult.stats,
|
|
144
|
+
...emptyOffchainOutput(),
|
|
122
145
|
result: returnValue,
|
|
123
146
|
};
|
|
124
|
-
} else {
|
|
125
|
-
return returnValue;
|
|
126
147
|
}
|
|
148
|
+
return { result: returnValue, ...emptyOffchainOutput() };
|
|
127
149
|
}
|
|
128
150
|
|
|
129
151
|
const executionPayload = await this.request(options);
|
|
@@ -145,6 +167,7 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
145
167
|
}
|
|
146
168
|
|
|
147
169
|
const returnValue = rawReturnValues ? decodeFromAbi(this.functionDao.returnTypes, rawReturnValues) : [];
|
|
170
|
+
const offchainOutput = extractOffchainOutput(simulatedTx.offchainEffects);
|
|
148
171
|
|
|
149
172
|
if (options.includeMetadata || options.fee?.estimateGas) {
|
|
150
173
|
const { gasLimits, teardownGasLimits } = getGasLimits(simulatedTx, options.fee?.estimatedGasPadding);
|
|
@@ -153,13 +176,12 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
153
176
|
);
|
|
154
177
|
return {
|
|
155
178
|
stats: simulatedTx.stats,
|
|
156
|
-
|
|
179
|
+
...offchainOutput,
|
|
157
180
|
result: returnValue,
|
|
158
181
|
estimatedGas: { gasLimits, teardownGasLimits },
|
|
159
182
|
};
|
|
160
|
-
} else {
|
|
161
|
-
return returnValue;
|
|
162
183
|
}
|
|
184
|
+
return { result: returnValue, ...offchainOutput };
|
|
163
185
|
}
|
|
164
186
|
|
|
165
187
|
/**
|
|
@@ -207,3 +229,62 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
207
229
|
);
|
|
208
230
|
}
|
|
209
231
|
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Render an AbiType as a human readable string
|
|
235
|
+
* */
|
|
236
|
+
function formatAbiType(abiType: AbiType): string {
|
|
237
|
+
switch (abiType.kind) {
|
|
238
|
+
case 'field':
|
|
239
|
+
return 'Field';
|
|
240
|
+
case 'boolean':
|
|
241
|
+
return 'bool';
|
|
242
|
+
case 'integer':
|
|
243
|
+
return `${abiType.sign === 'signed' ? 'i' : 'u'}${abiType.width}`;
|
|
244
|
+
case 'string':
|
|
245
|
+
return `str<${abiType.length}>`;
|
|
246
|
+
case 'array':
|
|
247
|
+
return `[${formatAbiType(abiType.type)}; ${abiType.length}]`;
|
|
248
|
+
case 'struct': {
|
|
249
|
+
if (isOptionStruct(abiType)) {
|
|
250
|
+
const innerType = abiType.fields.find(f => f.name === '_value')!.type;
|
|
251
|
+
return `Option<${formatAbiType(innerType)}>`;
|
|
252
|
+
}
|
|
253
|
+
return `(${abiType.fields.map(f => `${f.name}: ${formatAbiType(f.type)}`).join(', ')})`;
|
|
254
|
+
}
|
|
255
|
+
case 'tuple':
|
|
256
|
+
return `(${abiType.fields.map(formatAbiType).join(', ')})`;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Pretty print a function signature
|
|
262
|
+
*/
|
|
263
|
+
function formatFunctionSignature(name: string, parameters: ABIParameter[]): string {
|
|
264
|
+
const params = parameters.map(p => `${p.name}: ${formatAbiType(p.type)}`).join(', ');
|
|
265
|
+
return `${name}(${params})`;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Non-exhaustive pretty print of JS args to display in error messages in this module
|
|
270
|
+
*/
|
|
271
|
+
function formatArg(arg: unknown): string {
|
|
272
|
+
if (arg === undefined) {
|
|
273
|
+
return 'undefined';
|
|
274
|
+
}
|
|
275
|
+
if (arg === null) {
|
|
276
|
+
return 'null';
|
|
277
|
+
}
|
|
278
|
+
if (typeof arg === 'bigint') {
|
|
279
|
+
return `${arg}n`;
|
|
280
|
+
}
|
|
281
|
+
if (Array.isArray(arg)) {
|
|
282
|
+
return `[${arg.map(formatArg).join(', ')}]`;
|
|
283
|
+
}
|
|
284
|
+
if (typeof arg === 'object') {
|
|
285
|
+
const entries = Object.entries(arg).map(([k, v]) => `${k}: ${formatArg(v)}`);
|
|
286
|
+
return `{ ${entries.join(', ')} }`;
|
|
287
|
+
}
|
|
288
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
289
|
+
return String(arg);
|
|
290
|
+
}
|