@1shotapi/client-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -0
- package/dist/categories/chains.d.ts +21 -0
- package/dist/categories/chains.js +44 -0
- package/dist/categories/chains.js.map +1 -0
- package/dist/categories/contractEvents.d.ts +103 -0
- package/dist/categories/contractEvents.js +115 -0
- package/dist/categories/contractEvents.js.map +1 -0
- package/dist/categories/contractMethods.d.ts +377 -0
- package/dist/categories/contractMethods.js +317 -0
- package/dist/categories/contractMethods.js.map +1 -0
- package/dist/categories/structs.d.ts +40 -0
- package/dist/categories/structs.js +68 -0
- package/dist/categories/structs.js.map +1 -0
- package/dist/categories/transactions.d.ts +31 -0
- package/dist/categories/transactions.js +51 -0
- package/dist/categories/transactions.js.map +1 -0
- package/dist/categories/wallets.d.ts +167 -0
- package/dist/categories/wallets.js +238 -0
- package/dist/categories/wallets.js.map +1 -0
- package/dist/client.d.ts +22 -0
- package/dist/client.js +61 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/types/abi.d.ts +32 -0
- package/dist/types/abi.js +2 -0
- package/dist/types/abi.js.map +1 -0
- package/dist/types/chain.d.ts +26 -0
- package/dist/types/chain.js +2 -0
- package/dist/types/chain.js.map +1 -0
- package/dist/types/client.d.ts +13 -0
- package/dist/types/client.js +2 -0
- package/dist/types/client.js.map +1 -0
- package/dist/types/common.d.ts +8 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/contract.d.ts +5 -0
- package/dist/types/contract.js +2 -0
- package/dist/types/contract.js.map +1 -0
- package/dist/types/contractEvent.d.ts +46 -0
- package/dist/types/contractEvent.js +2 -0
- package/dist/types/contractEvent.js.map +1 -0
- package/dist/types/contractMethod.d.ts +31 -0
- package/dist/types/contractMethod.js +2 -0
- package/dist/types/contractMethod.js.map +1 -0
- package/dist/types/struct.d.ts +8 -0
- package/dist/types/struct.js +2 -0
- package/dist/types/struct.js.map +1 -0
- package/dist/types/transaction.d.ts +12 -0
- package/dist/types/transaction.js +2 -0
- package/dist/types/transaction.js.map +1 -0
- package/dist/types/wallet.d.ts +30 -0
- package/dist/types/wallet.js +2 -0
- package/dist/types/wallet.js.map +1 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/webhook.d.ts +19 -0
- package/dist/utils/webhook.js +66 -0
- package/dist/utils/webhook.js.map +1 -0
- package/dist/validation/abi.d.ts +470 -0
- package/dist/validation/abi.js +99 -0
- package/dist/validation/abi.js.map +1 -0
- package/dist/validation/chain.d.ts +157 -0
- package/dist/validation/chain.js +71 -0
- package/dist/validation/chain.js.map +1 -0
- package/dist/validation/common.d.ts +17 -0
- package/dist/validation/common.js +16 -0
- package/dist/validation/common.js.map +1 -0
- package/dist/validation/contractEvent.d.ts +323 -0
- package/dist/validation/contractEvent.js +148 -0
- package/dist/validation/contractEvent.js.map +1 -0
- package/dist/validation/contractMethod.d.ts +2746 -0
- package/dist/validation/contractMethod.js +787 -0
- package/dist/validation/contractMethod.js.map +1 -0
- package/dist/validation/struct.d.ts +495 -0
- package/dist/validation/struct.js +291 -0
- package/dist/validation/struct.js.map +1 -0
- package/dist/validation/transaction.d.ts +359 -0
- package/dist/validation/transaction.js +206 -0
- package/dist/validation/transaction.js.map +1 -0
- package/dist/validation/wallet.d.ts +537 -0
- package/dist/validation/wallet.js +287 -0
- package/dist/validation/wallet.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ethereumAbiSchema } from "./abi.js";
|
|
3
|
+
import { newSolidityStructParamSchema, solidityStructParamSchema } from "./struct.js";
|
|
4
|
+
// Validation for contractMethod state mutability
|
|
5
|
+
export const contractMethodStateMutabilitySchema = z
|
|
6
|
+
.enum(["nonpayable", "payable", "view", "pure"])
|
|
7
|
+
.describe("The state mutability of a Solidity function. Determines if the function can modify state, receive native tokens, or only read data");
|
|
8
|
+
// Validation for contractMethod status
|
|
9
|
+
export const contractMethodStatusSchema = z
|
|
10
|
+
.enum(["live", "archived", "both"])
|
|
11
|
+
.describe("The status of a contractMethod - live for active contractMethods, archived for deleted ones, or both. Used for filtering contractMethod lists");
|
|
12
|
+
// Validation for contractMethod parameters
|
|
13
|
+
/**
|
|
14
|
+
* Schema for contractMethod parameters. This is a recursive schema that can handle nested objects and arrays.
|
|
15
|
+
*/
|
|
16
|
+
export const contractMethodParamsSchema = z.record(z.string(), z.union([
|
|
17
|
+
z.string(),
|
|
18
|
+
z.number(),
|
|
19
|
+
z.boolean(),
|
|
20
|
+
z.null(),
|
|
21
|
+
z.undefined(),
|
|
22
|
+
z.lazy(() => contractMethodParamsSchema),
|
|
23
|
+
z.array(z.union([
|
|
24
|
+
z.string(),
|
|
25
|
+
z.number(),
|
|
26
|
+
z.boolean(),
|
|
27
|
+
z.null(),
|
|
28
|
+
z.undefined(),
|
|
29
|
+
z.lazy(() => contractMethodParamsSchema),
|
|
30
|
+
])),
|
|
31
|
+
]));
|
|
32
|
+
// Validation for contractMethod estimate
|
|
33
|
+
export const contractMethodEstimateSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
chainId: z
|
|
36
|
+
.number()
|
|
37
|
+
.int()
|
|
38
|
+
.positive()
|
|
39
|
+
.describe("The ChainId of a supported chainId on 1Shot API. Determines which blockchain network the contractMethod will be executed on"),
|
|
40
|
+
contractAddress: z
|
|
41
|
+
.string()
|
|
42
|
+
.describe("The address of the smart contract that contains the function to be called"),
|
|
43
|
+
functionName: z
|
|
44
|
+
.string()
|
|
45
|
+
.describe("The name of the function on the contract that will be called"),
|
|
46
|
+
gasAmount: z
|
|
47
|
+
.string()
|
|
48
|
+
.describe("The estimated amount of gas units the contractMethod will consume"),
|
|
49
|
+
maxFeePerGas: z
|
|
50
|
+
.string()
|
|
51
|
+
.nullable()
|
|
52
|
+
.describe("The maximum fee per gas unit for EIP-1559 contractMethods"),
|
|
53
|
+
maxPriorityFeePerGas: z
|
|
54
|
+
.string()
|
|
55
|
+
.nullable()
|
|
56
|
+
.describe("The maximum priority fee per gas unit for EIP-1559 contractMethods"),
|
|
57
|
+
gasPrice: z.string().nullable().describe("The gas price for legacy contractMethods"),
|
|
58
|
+
})
|
|
59
|
+
.describe("A summary of values required to estimate the cost of executing a contractMethod. Used to determine gas fees and contractMethod costs before execution");
|
|
60
|
+
// Validation for contractMethod update parameters
|
|
61
|
+
export const contractMethodUpdateSchema = z
|
|
62
|
+
.object({
|
|
63
|
+
chainId: z
|
|
64
|
+
.number()
|
|
65
|
+
.int()
|
|
66
|
+
.positive()
|
|
67
|
+
.optional()
|
|
68
|
+
.nullable()
|
|
69
|
+
.describe("The ChainId of a supported chainId on 1Shot API. Can be updated to change which blockchain network the contractMethod operates on"),
|
|
70
|
+
contractAddress: z
|
|
71
|
+
.string()
|
|
72
|
+
.optional()
|
|
73
|
+
.nullable()
|
|
74
|
+
.describe("The address of the smart contract. Can be updated to point to a different contract"),
|
|
75
|
+
walletId: z
|
|
76
|
+
.string()
|
|
77
|
+
.uuid()
|
|
78
|
+
.optional()
|
|
79
|
+
.nullable()
|
|
80
|
+
.describe("The ID of the wallet that will execute the contractMethod. Must be for the same chainId as the contractMethod"),
|
|
81
|
+
name: z
|
|
82
|
+
.string()
|
|
83
|
+
.optional()
|
|
84
|
+
.nullable()
|
|
85
|
+
.describe("Name of contractMethod, used for display purposes and lookup. Helps identify the contractMethod in lists and logs"),
|
|
86
|
+
description: z
|
|
87
|
+
.string()
|
|
88
|
+
.optional()
|
|
89
|
+
.nullable()
|
|
90
|
+
.describe("Description of contractMethod, including details about what it does and when it should be called. Useful for documentation and understanding contractMethod purpose"),
|
|
91
|
+
functionName: z
|
|
92
|
+
.string()
|
|
93
|
+
.optional()
|
|
94
|
+
.nullable()
|
|
95
|
+
.describe("The actual method name on the smart contract. Solidity names are case sensitive and must match precisely. Cannot be changed after creation"),
|
|
96
|
+
stateMutability: contractMethodStateMutabilitySchema
|
|
97
|
+
.optional()
|
|
98
|
+
.nullable()
|
|
99
|
+
.describe("The state mutability of the Solidity function. Determines if the function can modify state, receive native tokens, or only read data"),
|
|
100
|
+
callbackUrl: z
|
|
101
|
+
.string()
|
|
102
|
+
.url()
|
|
103
|
+
.nullable()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("The URL to send webhooks to when this contractMethod is executed. Must be a valid HTTP or HTTPS URL with protocol. Used for contractMethod status notifications"),
|
|
106
|
+
})
|
|
107
|
+
.describe("Parameters that can be updated for an existing contractMethod. Allows modification of contractMethod properties while maintaining its core functionality");
|
|
108
|
+
// Validation for contractMethod
|
|
109
|
+
export const contractMethodSchema = z
|
|
110
|
+
.object({
|
|
111
|
+
id: z
|
|
112
|
+
.string()
|
|
113
|
+
.uuid()
|
|
114
|
+
.describe("Internal ID of the contractMethod object. Unique identifier for the contractMethod"),
|
|
115
|
+
businessId: z
|
|
116
|
+
.string()
|
|
117
|
+
.uuid()
|
|
118
|
+
.describe("The business that owns this contractMethod. Used for access control and organization"),
|
|
119
|
+
chainId: z
|
|
120
|
+
.number()
|
|
121
|
+
.int()
|
|
122
|
+
.positive()
|
|
123
|
+
.describe("The ChainId of a supported chainId on 1Shot API. Determines which blockchain network the contractMethod operates on"),
|
|
124
|
+
contractAddress: z
|
|
125
|
+
.string()
|
|
126
|
+
.describe("The address of the smart contract that contains the function to be called"),
|
|
127
|
+
walletId: z
|
|
128
|
+
.string()
|
|
129
|
+
.uuid()
|
|
130
|
+
.describe("The default escrow wallet that will execute this ContractMethod. Must be for the same chainId as the contractMethod"),
|
|
131
|
+
name: z
|
|
132
|
+
.string()
|
|
133
|
+
.describe("Name of contractMethod, used for display purposes and lookup. Helps identify the contractMethod in lists and logs"),
|
|
134
|
+
description: z
|
|
135
|
+
.string()
|
|
136
|
+
.describe("Description of contractMethod, including details about what it does and when it should be called. Useful for documentation and understanding contractMethod purpose"),
|
|
137
|
+
functionName: z
|
|
138
|
+
.string()
|
|
139
|
+
.describe("The actual method name on the smart contract. Solidity names are case sensitive and must match precisely. Defines which function will be called"),
|
|
140
|
+
inputs: z
|
|
141
|
+
.array(solidityStructParamSchema)
|
|
142
|
+
.describe("The input parameters for the contractMethod function. Defines the structure and types of parameters required for execution"),
|
|
143
|
+
outputs: z
|
|
144
|
+
.array(solidityStructParamSchema)
|
|
145
|
+
.describe("The output parameters for the contractMethod function. Defines the structure and types of values returned after execution"),
|
|
146
|
+
stateMutability: contractMethodStateMutabilitySchema,
|
|
147
|
+
promptId: z
|
|
148
|
+
.string()
|
|
149
|
+
.uuid()
|
|
150
|
+
.nullable()
|
|
151
|
+
.describe("The ID of the Prompt that this contractMethod was created from. This is optional, and a ContractMethod can drift from the original Prompt but retain this association"),
|
|
152
|
+
callbackUrl: z
|
|
153
|
+
.string()
|
|
154
|
+
.url()
|
|
155
|
+
.nullable()
|
|
156
|
+
.describe("The current destination for webhooks to be sent when this contractMethod is executed. Will be null if no webhook is assigned. Used for contractMethod status notifications"),
|
|
157
|
+
publicKey: z
|
|
158
|
+
.string()
|
|
159
|
+
.base64()
|
|
160
|
+
.nullable()
|
|
161
|
+
.describe("The current public key for verifying the integrity of the webhook when this contractMethod is executed. 1Shot will sign its webhooks with a private key and provide a signature for the webhook that can be validated with this key. It will be null if there is no webhook destination specified"),
|
|
162
|
+
updated: z
|
|
163
|
+
.number()
|
|
164
|
+
.describe("Unix timestamp of when the contractMethod was last updated. Used for tracking changes"),
|
|
165
|
+
created: z
|
|
166
|
+
.number()
|
|
167
|
+
.describe("Unix timestamp of when the contractMethod was created. Used for tracking creation time"),
|
|
168
|
+
})
|
|
169
|
+
.describe("A single defined contractMethod, corresponding a method call on a smart contract on a chainId. You can have multiple ContractMethods defined for the same method in the contract if you want to use different setups for static parameters. ContractMethods are sometimes referred to as Endpoints");
|
|
170
|
+
// Validation for contractMethod list response
|
|
171
|
+
export const contractMethodListSchema = z
|
|
172
|
+
.object({
|
|
173
|
+
response: z
|
|
174
|
+
.array(contractMethodSchema)
|
|
175
|
+
.describe("The list of contractMethods matching the query parameters"),
|
|
176
|
+
page: z
|
|
177
|
+
.number()
|
|
178
|
+
.int()
|
|
179
|
+
.positive()
|
|
180
|
+
.describe("Which page of results this is (1-indexed). Used for pagination"),
|
|
181
|
+
pageSize: z
|
|
182
|
+
.number()
|
|
183
|
+
.int()
|
|
184
|
+
.positive()
|
|
185
|
+
.describe("The number of results per page. Determines how many contractMethods are returned"),
|
|
186
|
+
totalResults: z
|
|
187
|
+
.number()
|
|
188
|
+
.int()
|
|
189
|
+
.nonnegative()
|
|
190
|
+
.describe("The total number of results available across all pages"),
|
|
191
|
+
})
|
|
192
|
+
.describe("A paginated list of contractMethods. Used for retrieving multiple contractMethods with pagination support");
|
|
193
|
+
// Validation for listing contractMethods
|
|
194
|
+
export const listContractMethodsSchema = z
|
|
195
|
+
.object({
|
|
196
|
+
businessId: z
|
|
197
|
+
.string()
|
|
198
|
+
.uuid()
|
|
199
|
+
.describe("The business ID to list contractMethods for. Used for access control and filtering"),
|
|
200
|
+
pageSize: z
|
|
201
|
+
.number()
|
|
202
|
+
.int()
|
|
203
|
+
.positive()
|
|
204
|
+
.optional()
|
|
205
|
+
.nullable()
|
|
206
|
+
.describe("Number of items per page. Optional parameter for pagination control"),
|
|
207
|
+
page: z
|
|
208
|
+
.number()
|
|
209
|
+
.int()
|
|
210
|
+
.positive()
|
|
211
|
+
.optional()
|
|
212
|
+
.nullable()
|
|
213
|
+
.describe("Page number (1-indexed). Optional parameter for pagination control"),
|
|
214
|
+
chainId: z
|
|
215
|
+
.number()
|
|
216
|
+
.int()
|
|
217
|
+
.positive()
|
|
218
|
+
.optional()
|
|
219
|
+
.nullable()
|
|
220
|
+
.describe("Filter by chainId ID. Optional parameter to get contractMethods for a specific blockchain"),
|
|
221
|
+
name: z
|
|
222
|
+
.string()
|
|
223
|
+
.optional()
|
|
224
|
+
.nullable()
|
|
225
|
+
.describe("Filter by contractMethod name. Optional parameter for searching contractMethods by name"),
|
|
226
|
+
status: z
|
|
227
|
+
.enum(["live", "archived", "both"])
|
|
228
|
+
.optional()
|
|
229
|
+
.nullable()
|
|
230
|
+
.describe("Filter by contractMethod status - live for active contractMethods, archived for deleted ones, or both. Optional parameter for filtering by status"),
|
|
231
|
+
contractAddress: z
|
|
232
|
+
.string()
|
|
233
|
+
.optional()
|
|
234
|
+
.nullable()
|
|
235
|
+
.describe("Filter by contract address. Optional parameter to get contractMethods for a specific contract"),
|
|
236
|
+
promptId: z
|
|
237
|
+
.string()
|
|
238
|
+
.uuid()
|
|
239
|
+
.optional()
|
|
240
|
+
.nullable()
|
|
241
|
+
.describe("Filter by contract description ID. If provided, only contractMethods created from this Contract Description will be returned"),
|
|
242
|
+
methodType: z
|
|
243
|
+
.enum(["read", "write"])
|
|
244
|
+
.optional()
|
|
245
|
+
.nullable()
|
|
246
|
+
.describe("Which type of contract method you want to filter by - read or write methods. If not provided, all contract methods will be returned"),
|
|
247
|
+
})
|
|
248
|
+
.describe("Parameters for listing contractMethods. Used to filter and paginate contractMethod lists");
|
|
249
|
+
// Validation for ERC7702Authorization
|
|
250
|
+
export const erc7702AuthorizationSchema = z
|
|
251
|
+
.object({
|
|
252
|
+
address: z
|
|
253
|
+
.string()
|
|
254
|
+
.describe("The contract address that is being authorized to act on behalf of the EOA"),
|
|
255
|
+
nonce: z
|
|
256
|
+
.string()
|
|
257
|
+
.describe("The delegation nonce. This starts at 0 and must be positive. The EOA must keep track of this nonce itself"),
|
|
258
|
+
chainId: z
|
|
259
|
+
.number()
|
|
260
|
+
.int()
|
|
261
|
+
.positive()
|
|
262
|
+
.describe("The chainId ID where the authorization is valid"),
|
|
263
|
+
signature: z
|
|
264
|
+
.string()
|
|
265
|
+
.regex(/^0x[a-fA-F0-9]+$/)
|
|
266
|
+
.describe("The signature of the authorization, from the EOA that is delegating the authorization to the contract at address"),
|
|
267
|
+
})
|
|
268
|
+
.describe("A single authorization for an ERC-7702 contractMethod. It represents a single potential delegation from an EOA to a contract");
|
|
269
|
+
// Validation for executing a contractMethod
|
|
270
|
+
export const executeContractMethodSchema = z
|
|
271
|
+
.object({
|
|
272
|
+
contractMethodId: z
|
|
273
|
+
.string()
|
|
274
|
+
.uuid()
|
|
275
|
+
.describe("The ID of the contractMethod to execute. Identifies which contractMethod to run"),
|
|
276
|
+
params: contractMethodParamsSchema,
|
|
277
|
+
walletId: z
|
|
278
|
+
.string()
|
|
279
|
+
.uuid()
|
|
280
|
+
.optional()
|
|
281
|
+
.nullable()
|
|
282
|
+
.describe("The ID of the escrow wallet that will execute the contractMethod. If not provided, the default escrow wallet for the contractMethod will be used"),
|
|
283
|
+
memo: z
|
|
284
|
+
.string()
|
|
285
|
+
.optional()
|
|
286
|
+
.nullable()
|
|
287
|
+
.describe("Optional text supplied when the contractMethod is executed. This can be a note to the user about why the execution was done, or formatted information such as JSON that can be used by the user's system"),
|
|
288
|
+
authorizationList: z
|
|
289
|
+
.array(erc7702AuthorizationSchema)
|
|
290
|
+
.optional()
|
|
291
|
+
.nullable()
|
|
292
|
+
.describe("A list of authorizations for the contractMethod. If you are using ERC-7702, you must provide at least one authorization"),
|
|
293
|
+
value: z
|
|
294
|
+
.string()
|
|
295
|
+
.optional()
|
|
296
|
+
.nullable()
|
|
297
|
+
.describe("The amount of native token to send along with the contractMethod. This is only applicable for contractMethods that are payable. Including this value for a nonpayable method will result in an error"),
|
|
298
|
+
contractAddress: z
|
|
299
|
+
.string()
|
|
300
|
+
.optional()
|
|
301
|
+
.nullable()
|
|
302
|
+
.describe("The address of the smart contract. Can be overridden for this specific execution"),
|
|
303
|
+
authorizationDataAddress: z
|
|
304
|
+
.string()
|
|
305
|
+
.optional()
|
|
306
|
+
.nullable()
|
|
307
|
+
.describe("The address of the ERC-7702 contract to upgrade the Wallet that executes this transaction to. This is basically the same as the authorization list, but allows you to upgrade the Wallet, instead of an external EOA. The signature and nonce params for the AuthorizationList entry are generated by the server. Providing this parameter also requires that you set the contractAddress to the address of the Wallet or it will cause an error."),
|
|
308
|
+
})
|
|
309
|
+
.describe("Parameters required to execute a contractMethod. Includes the function parameters, optional escrow wallet override, optional memo, optional value for payable methods, and optional contract address override");
|
|
310
|
+
// Validation for executing a contractMethod as a delegator
|
|
311
|
+
export const executeAsDelegatorContractMethodSchema = z
|
|
312
|
+
.object({
|
|
313
|
+
contractMethodId: z
|
|
314
|
+
.string()
|
|
315
|
+
.uuid()
|
|
316
|
+
.describe("The ID of the contractMethod to execute as a delegator. Identifies which contractMethod to run"),
|
|
317
|
+
params: contractMethodParamsSchema,
|
|
318
|
+
walletId: z
|
|
319
|
+
.string()
|
|
320
|
+
.uuid()
|
|
321
|
+
.optional()
|
|
322
|
+
.nullable()
|
|
323
|
+
.describe("The ID of the escrow wallet that will execute the contractMethod. If not provided, the default escrow wallet for the contractMethod will be used"),
|
|
324
|
+
memo: z
|
|
325
|
+
.string()
|
|
326
|
+
.optional()
|
|
327
|
+
.nullable()
|
|
328
|
+
.describe("Optional text supplied when the contractMethod is executed. This can be a note to the user about why the execution was done, or formatted information such as JSON that can be used by the user's system"),
|
|
329
|
+
authorizationList: z
|
|
330
|
+
.array(erc7702AuthorizationSchema)
|
|
331
|
+
.optional()
|
|
332
|
+
.nullable()
|
|
333
|
+
.describe("A list of authorizations for the contractMethod. If you are using ERC-7702, you must provide at least one authorization"),
|
|
334
|
+
delegatorAddress: z
|
|
335
|
+
.string()
|
|
336
|
+
.describe("The address of the delegator on whose behalf the transaction will be executed"),
|
|
337
|
+
value: z
|
|
338
|
+
.string()
|
|
339
|
+
.optional()
|
|
340
|
+
.nullable()
|
|
341
|
+
.describe("The amount of native token to send along with the contractMethod. This is only applicable for contractMethods that are payable. Including this value for a nonpayable method will result in an error"),
|
|
342
|
+
})
|
|
343
|
+
.describe("Parameters required to execute a contractMethod as a delegator. Similar to regular execution but executes the transaction on behalf of the specified delegator address");
|
|
344
|
+
// Validation for batch contract method execution
|
|
345
|
+
export const batchContractMethodSchema = z
|
|
346
|
+
.object({
|
|
347
|
+
contractMethodId: z
|
|
348
|
+
.string()
|
|
349
|
+
.uuid()
|
|
350
|
+
.describe("The ID of the contractMethod to execute. Identifies which contractMethod to run"),
|
|
351
|
+
executionIndex: z
|
|
352
|
+
.number()
|
|
353
|
+
.int()
|
|
354
|
+
.nonnegative()
|
|
355
|
+
.describe("The order in which to execute this method. Must start at 0 and increment by 1. Must be unique. Provided in case the array gets shuffled in transmission"),
|
|
356
|
+
params: contractMethodParamsSchema,
|
|
357
|
+
value: z
|
|
358
|
+
.string()
|
|
359
|
+
.optional()
|
|
360
|
+
.nullable()
|
|
361
|
+
.describe("The amount of native token to send along with the contractMethod. This is only applicable for contractMethods that are payable. Including this value for a nonpayable method will result in an error"),
|
|
362
|
+
contractAddress: z
|
|
363
|
+
.string()
|
|
364
|
+
.optional()
|
|
365
|
+
.nullable()
|
|
366
|
+
.describe("The address of the smart contract. Can be overridden for this specific execution"),
|
|
367
|
+
})
|
|
368
|
+
.describe("A single contract method execution within a batch");
|
|
369
|
+
// Validation for batch contract method execution as delegator
|
|
370
|
+
export const batchContractMethodAsDelegatorSchema = z
|
|
371
|
+
.object({
|
|
372
|
+
contractMethodId: z
|
|
373
|
+
.string()
|
|
374
|
+
.uuid()
|
|
375
|
+
.describe("The ID of the contractMethod to execute. Identifies which contractMethod to run"),
|
|
376
|
+
executionIndex: z
|
|
377
|
+
.number()
|
|
378
|
+
.int()
|
|
379
|
+
.nonnegative()
|
|
380
|
+
.describe("The order in which to execute this method. Must start at 0 and increment by 1. Must be unique. Provided in case the array gets shuffled in transmission"),
|
|
381
|
+
params: contractMethodParamsSchema,
|
|
382
|
+
delegatorAddress: z
|
|
383
|
+
.string()
|
|
384
|
+
.describe("The address of the delegator on whose behalf the transaction will be executed"),
|
|
385
|
+
value: z
|
|
386
|
+
.string()
|
|
387
|
+
.optional()
|
|
388
|
+
.nullable()
|
|
389
|
+
.describe("The amount of native token to send along with the contractMethod. This is only applicable for contractMethods that are payable. Including this value for a nonpayable method will result in an error"),
|
|
390
|
+
contractAddress: z
|
|
391
|
+
.string()
|
|
392
|
+
.optional()
|
|
393
|
+
.nullable()
|
|
394
|
+
.describe("The address of the smart contract. Can be overridden for this specific execution"),
|
|
395
|
+
})
|
|
396
|
+
.describe("A single contract method execution within a batch as delegator");
|
|
397
|
+
// Validation for executing batch contract methods
|
|
398
|
+
export const executeBatchContractMethodSchema = z
|
|
399
|
+
.object({
|
|
400
|
+
contractMethods: z
|
|
401
|
+
.array(batchContractMethodSchema)
|
|
402
|
+
.describe("Array of contract methods to execute in batch"),
|
|
403
|
+
walletId: z.string().uuid().describe("The ID of the escrow wallet that will execute the batch"),
|
|
404
|
+
atomic: z
|
|
405
|
+
.boolean()
|
|
406
|
+
.optional()
|
|
407
|
+
.describe("If true, all transactions in the batch must succeed, or the entire batch is rolled back. If false, the executions that succeed will complete, but no transactions after the first failure will be executed"),
|
|
408
|
+
memo: z
|
|
409
|
+
.string()
|
|
410
|
+
.optional()
|
|
411
|
+
.nullable()
|
|
412
|
+
.describe("Optional text supplied when the batch is executed. This can be a note to the user about why the execution was done, or formatted information such as JSON that can be used by the user's system"),
|
|
413
|
+
authorizationList: z
|
|
414
|
+
.array(erc7702AuthorizationSchema)
|
|
415
|
+
.optional()
|
|
416
|
+
.nullable()
|
|
417
|
+
.describe("A list of authorizations for the batch. If you are using ERC-7702, you must provide at least one authorization"),
|
|
418
|
+
gasLimit: z
|
|
419
|
+
.string()
|
|
420
|
+
.optional()
|
|
421
|
+
.nullable()
|
|
422
|
+
.describe("The gas limit for the transaction. The transaction will revert if it uses more gas than this, and you will spend the gas in the process. Ordinarily, you do not need this, 1Shot will calculate it for you. However, for some very complicated transactions, you may need to set the gas limit manually as the normal estimation process may underestimate the gas amount"),
|
|
423
|
+
})
|
|
424
|
+
.describe("Parameters for executing multiple contract methods in a single batch transaction");
|
|
425
|
+
// Validation for executing batch contract methods as delegator
|
|
426
|
+
export const executeBatchAsDelegatorContractMethodSchema = z
|
|
427
|
+
.object({
|
|
428
|
+
contractMethods: z
|
|
429
|
+
.array(batchContractMethodAsDelegatorSchema)
|
|
430
|
+
.describe("Array of contract methods to execute in batch as delegator"),
|
|
431
|
+
walletId: z.string().uuid().describe("The ID of the escrow wallet that will execute the batch"),
|
|
432
|
+
atomic: z
|
|
433
|
+
.boolean()
|
|
434
|
+
.optional()
|
|
435
|
+
.describe("If true, all transactions in the batch must succeed, or the entire batch is rolled back. If false, the executions that succeed will complete, but no transactions after the first failure will be executed"),
|
|
436
|
+
memo: z
|
|
437
|
+
.string()
|
|
438
|
+
.optional()
|
|
439
|
+
.nullable()
|
|
440
|
+
.describe("Optional text supplied when the batch is executed. This can be a note to the user about why the execution was done, or formatted information such as JSON that can be used by the user's system"),
|
|
441
|
+
authorizationList: z
|
|
442
|
+
.array(erc7702AuthorizationSchema)
|
|
443
|
+
.optional()
|
|
444
|
+
.nullable()
|
|
445
|
+
.describe("A list of authorizations for the batch. If you are using ERC-7702, you must provide at least one authorization"),
|
|
446
|
+
gasLimit: z
|
|
447
|
+
.string()
|
|
448
|
+
.optional()
|
|
449
|
+
.nullable()
|
|
450
|
+
.describe("The gas limit for the transaction. The transaction will revert if it uses more gas than this, and you will spend the gas in the process. Ordinarily, you do not need this, 1Shot will calculate it for you. However, for some very complicated transactions, you may need to set the gas limit manually as the normal estimation process may underestimate the gas amount"),
|
|
451
|
+
})
|
|
452
|
+
.describe("Parameters for executing multiple contract methods in a single batch transaction as delegator");
|
|
453
|
+
// Validation for testing a contractMethod
|
|
454
|
+
export const testContractMethodSchema = z
|
|
455
|
+
.object({
|
|
456
|
+
contractMethodId: z
|
|
457
|
+
.string()
|
|
458
|
+
.uuid()
|
|
459
|
+
.describe("The ID of the contractMethod to test. Identifies which contractMethod to simulate"),
|
|
460
|
+
params: contractMethodParamsSchema,
|
|
461
|
+
authorizationList: z
|
|
462
|
+
.array(erc7702AuthorizationSchema)
|
|
463
|
+
.optional()
|
|
464
|
+
.nullable()
|
|
465
|
+
.describe("A list of authorizations for the contractMethod. If you are using ERC-7702, you must provide at least one authorization"),
|
|
466
|
+
value: z
|
|
467
|
+
.string()
|
|
468
|
+
.optional()
|
|
469
|
+
.nullable()
|
|
470
|
+
.describe("The amount of native token to send along with the contractMethod. This is only applicable for contractMethods that are payable. Including this value for a nonpayable method will result in an error"),
|
|
471
|
+
contractAddress: z
|
|
472
|
+
.string()
|
|
473
|
+
.optional()
|
|
474
|
+
.nullable()
|
|
475
|
+
.describe("The address of the smart contract. Can be overridden for this specific test"),
|
|
476
|
+
})
|
|
477
|
+
.describe("Parameters for testing a contractMethod - simulates execution without spending gas or changing on-chainId state. Used for validating contractMethod parameters before actual execution");
|
|
478
|
+
// Validation for getting a contractMethod
|
|
479
|
+
export const getContractMethodSchema = z
|
|
480
|
+
.object({
|
|
481
|
+
id: z
|
|
482
|
+
.string()
|
|
483
|
+
.uuid()
|
|
484
|
+
.describe("The ID of the contractMethod to get. Identifies which contractMethod to retrieve"),
|
|
485
|
+
})
|
|
486
|
+
.describe("Parameters for getting a contractMethod. Used to retrieve a single contractMethod by its ID");
|
|
487
|
+
// Validation for estimating a contractMethod
|
|
488
|
+
export const estimateContractMethodSchema = z
|
|
489
|
+
.object({
|
|
490
|
+
contractMethodId: z
|
|
491
|
+
.string()
|
|
492
|
+
.uuid()
|
|
493
|
+
.describe("The ID of the contractMethod to estimate. Identifies which contractMethod to analyze"),
|
|
494
|
+
params: contractMethodParamsSchema,
|
|
495
|
+
authorizationList: z
|
|
496
|
+
.array(erc7702AuthorizationSchema)
|
|
497
|
+
.optional()
|
|
498
|
+
.nullable()
|
|
499
|
+
.describe("A list of authorizations for the contractMethod. If you are using ERC-7702, you must provide at least one authorization"),
|
|
500
|
+
value: z
|
|
501
|
+
.string()
|
|
502
|
+
.optional()
|
|
503
|
+
.nullable()
|
|
504
|
+
.describe("The amount of native token to send along with the contractMethod. This is only applicable for contractMethods that are payable. Including this value for a nonpayable method will result in an error"),
|
|
505
|
+
})
|
|
506
|
+
.describe("Parameters for estimating a contractMethod - returns data about fees and gas amount. Used to calculate contractMethod costs before execution");
|
|
507
|
+
// Validation for encoding a contractMethod
|
|
508
|
+
export const encodeContractMethodSchema = z
|
|
509
|
+
.object({
|
|
510
|
+
contractMethodId: z
|
|
511
|
+
.string()
|
|
512
|
+
.uuid()
|
|
513
|
+
.describe("The ID of the contractMethod to encode. Identifies which contractMethod to encode"),
|
|
514
|
+
params: contractMethodParamsSchema,
|
|
515
|
+
authorizationList: z
|
|
516
|
+
.array(erc7702AuthorizationSchema)
|
|
517
|
+
.optional()
|
|
518
|
+
.nullable()
|
|
519
|
+
.describe("A list of authorizations for the contractMethod. If you are using ERC-7702, you must provide at least one authorization"),
|
|
520
|
+
value: z
|
|
521
|
+
.string()
|
|
522
|
+
.optional()
|
|
523
|
+
.nullable()
|
|
524
|
+
.describe("The amount of native token to send along with the contractMethod. This is only applicable for contractMethods that are payable. Including this value for a nonpayable method will result in an error"),
|
|
525
|
+
})
|
|
526
|
+
.describe("Parameters for encoding a contractMethod - returns hex string of encoded data. Used to call the contractMethod directly on the blockchain");
|
|
527
|
+
// Validation for reading a contractMethod
|
|
528
|
+
export const readContractMethodSchema = z
|
|
529
|
+
.object({
|
|
530
|
+
contractMethodId: z
|
|
531
|
+
.string()
|
|
532
|
+
.uuid()
|
|
533
|
+
.describe("The ID of the contractMethod to read. Identifies which contractMethod to query"),
|
|
534
|
+
params: contractMethodParamsSchema,
|
|
535
|
+
})
|
|
536
|
+
.describe("Parameters for reading a contractMethod - gets result of view or pure function. Used for reading blockchain state without making changes");
|
|
537
|
+
// Validation for creating a contractMethod
|
|
538
|
+
export const createContractMethodSchema = z
|
|
539
|
+
.object({
|
|
540
|
+
businessId: z
|
|
541
|
+
.string()
|
|
542
|
+
.uuid()
|
|
543
|
+
.describe("The business ID to create the contractMethod for. Used for access control and organization"),
|
|
544
|
+
chainId: z
|
|
545
|
+
.number()
|
|
546
|
+
.int()
|
|
547
|
+
.positive()
|
|
548
|
+
.describe("The ChainId of a supported chainId on 1Shot API. Determines which blockchain network the contractMethod will operate on"),
|
|
549
|
+
contractAddress: z
|
|
550
|
+
.string()
|
|
551
|
+
.describe("The address of the smart contract that contains the function to be called"),
|
|
552
|
+
walletId: z
|
|
553
|
+
.string()
|
|
554
|
+
.uuid()
|
|
555
|
+
.describe("The ID of the escrow wallet that will execute the contractMethod. This escrow wallet must be for the same chainId as the contractMethod you are creating"),
|
|
556
|
+
name: z
|
|
557
|
+
.string()
|
|
558
|
+
.describe("Name of contractMethod, used for display purposes and lookup. Helps identify the contractMethod in lists and logs"),
|
|
559
|
+
description: z
|
|
560
|
+
.string()
|
|
561
|
+
.describe("Description of contractMethod, including details about what it does and when it should be called. Useful for documentation and understanding contractMethod purpose"),
|
|
562
|
+
functionName: z
|
|
563
|
+
.string()
|
|
564
|
+
.describe("The actual method name on the smart contract. Solidity names are case sensitive and must match precisely. Defines which function will be called"),
|
|
565
|
+
stateMutability: contractMethodStateMutabilitySchema,
|
|
566
|
+
inputs: z
|
|
567
|
+
.array(newSolidityStructParamSchema)
|
|
568
|
+
.describe("The input parameters for the contractMethod function. Defines the structure and types of parameters required for execution"),
|
|
569
|
+
outputs: z
|
|
570
|
+
.array(newSolidityStructParamSchema)
|
|
571
|
+
.describe("The output parameters for the contractMethod function. Defines the structure and types of values returned after execution"),
|
|
572
|
+
callbackUrl: z
|
|
573
|
+
.string()
|
|
574
|
+
.url()
|
|
575
|
+
.optional()
|
|
576
|
+
.nullable()
|
|
577
|
+
.describe("The URL to send webhooks to when this contractMethod is executed. This must be a valid HTTP or HTTPS URL and include the protocol. Used for contractMethod status notifications"),
|
|
578
|
+
})
|
|
579
|
+
.describe("Parameters for creating a new ContractMethod. A ContractMethod is sometimes referred to as an Endpoint. A ContractMethod corresponds to a single method on a smart contract, and most of the required information to create one can be pulled from an Ethereum ABI. ContractMethods can be configured with static values for input parameters, which is useful for controlling how the contractMethod is called");
|
|
580
|
+
// Validation for importing contractMethods from ABI
|
|
581
|
+
export const importFromABISchema = z
|
|
582
|
+
.object({
|
|
583
|
+
businessId: z.string().uuid().describe("The ID of the business that owns the contractMethod"),
|
|
584
|
+
chainId: z
|
|
585
|
+
.number()
|
|
586
|
+
.int()
|
|
587
|
+
.positive()
|
|
588
|
+
.describe("The ChainId of a supported chainId on 1Shot API. Determines which blockchain network the contractMethod will be executed on"),
|
|
589
|
+
contractAddress: z
|
|
590
|
+
.string()
|
|
591
|
+
.describe("The address of the smart contract that contains the function to be called"),
|
|
592
|
+
walletId: z
|
|
593
|
+
.string()
|
|
594
|
+
.uuid()
|
|
595
|
+
.describe("The ID of the escrow wallet that will execute the contractMethod. Must be for the same chainId as the contractMethod"),
|
|
596
|
+
abi: ethereumAbiSchema,
|
|
597
|
+
name: z
|
|
598
|
+
.string()
|
|
599
|
+
.optional()
|
|
600
|
+
.nullable()
|
|
601
|
+
.describe("The name of the smart contract, if it doesn't already exist"),
|
|
602
|
+
description: z
|
|
603
|
+
.string()
|
|
604
|
+
.optional()
|
|
605
|
+
.nullable()
|
|
606
|
+
.describe("A description of the smart contract, if it doesn't already exist"),
|
|
607
|
+
tags: z.array(z.string()).optional().describe("Tags to add to the smart contract"),
|
|
608
|
+
})
|
|
609
|
+
.describe("Parameters for importing contractMethods from an Ethereum ABI. Creates contractMethods for each function in the ABI");
|
|
610
|
+
// Validation for updating a contractMethod
|
|
611
|
+
export const updateContractMethodSchema = z
|
|
612
|
+
.object({
|
|
613
|
+
contractMethodId: z
|
|
614
|
+
.string()
|
|
615
|
+
.uuid()
|
|
616
|
+
.describe("The ID of the contractMethod to update. Identifies which contractMethod to modify"),
|
|
617
|
+
params: contractMethodUpdateSchema,
|
|
618
|
+
})
|
|
619
|
+
.describe("Parameters for updating a contractMethod. Used to modify existing contractMethod properties");
|
|
620
|
+
// Validation for deleting a contractMethod
|
|
621
|
+
export const deleteContractMethodSchema = z
|
|
622
|
+
.object({
|
|
623
|
+
contractMethodId: z
|
|
624
|
+
.string()
|
|
625
|
+
.uuid()
|
|
626
|
+
.describe("The ID of the contractMethod to delete. Identifies which contractMethod to remove"),
|
|
627
|
+
})
|
|
628
|
+
.describe("Parameters for deleting a contractMethod. Used to remove a contractMethod from the system");
|
|
629
|
+
// Validation for restoring a contractMethod
|
|
630
|
+
export const restoreContractMethodSchema = z
|
|
631
|
+
.object({
|
|
632
|
+
contractMethodId: z
|
|
633
|
+
.string()
|
|
634
|
+
.uuid()
|
|
635
|
+
.describe("The ID of the contractMethod to restore. Identifies which deleted contractMethod to recover"),
|
|
636
|
+
})
|
|
637
|
+
.describe("Parameters for restoring a contractMethod - undeletes contractMethod objects. Used to recover previously deleted contractMethods");
|
|
638
|
+
// Validation for contract function parameter description
|
|
639
|
+
export const contractFunctionParamDescriptionSchema = z
|
|
640
|
+
.object({
|
|
641
|
+
index: z.number().int().nonnegative().describe("The index of the parameter. Starts at 0"),
|
|
642
|
+
name: z
|
|
643
|
+
.string()
|
|
644
|
+
.describe("The name of the parameter, as defined in the Solidity contract. Input parameters are required to have names; this may be blank for output parameters"),
|
|
645
|
+
description: z
|
|
646
|
+
.string()
|
|
647
|
+
.describe("A description of the parameter and its purpose. These descriptions are provided by either humans or AI and are intended for AI agent consumption"),
|
|
648
|
+
tags: z
|
|
649
|
+
.array(z.string())
|
|
650
|
+
.describe("An array of tag names associated with the function parameter"),
|
|
651
|
+
})
|
|
652
|
+
.describe("A description of a function parameter. This may be an input or an output parameter");
|
|
653
|
+
// Validation for contract function description
|
|
654
|
+
export const contractFunctionPromptSchema = z
|
|
655
|
+
.object({
|
|
656
|
+
name: z
|
|
657
|
+
.string()
|
|
658
|
+
.describe("The name of the function. This has to exactly match the name of the function in the Solidity contract, including the case and whitespace"),
|
|
659
|
+
description: z
|
|
660
|
+
.string()
|
|
661
|
+
.describe("A human provided description of the function, what it does, and a basic overview of its parameters"),
|
|
662
|
+
tags: z.array(z.string()).describe("An array of tag names provided to the contract function"),
|
|
663
|
+
inputs: z
|
|
664
|
+
.array(contractFunctionParamDescriptionSchema)
|
|
665
|
+
.describe("An array of input parameters for the function. All inputs are required to be named"),
|
|
666
|
+
outputs: z
|
|
667
|
+
.array(contractFunctionParamDescriptionSchema)
|
|
668
|
+
.describe("An array of input parameters for the function. All inputs are required to be named"),
|
|
669
|
+
})
|
|
670
|
+
.describe("The description of a single function on a contract");
|
|
671
|
+
// Validation for contract description
|
|
672
|
+
export const promptSchema = z
|
|
673
|
+
.object({
|
|
674
|
+
id: z.string().uuid().describe("internal ID of the contract description"),
|
|
675
|
+
userId: z.string().uuid().describe("ID of the user that created"),
|
|
676
|
+
chainId: z
|
|
677
|
+
.number()
|
|
678
|
+
.int()
|
|
679
|
+
.positive()
|
|
680
|
+
.describe("The ChainId of a supported chainId on 1Shot API"),
|
|
681
|
+
contractAddress: z.string().describe("The address of the smart contract"),
|
|
682
|
+
name: z
|
|
683
|
+
.string()
|
|
684
|
+
.describe("The name of the contract. This is human provided and has no technical significance"),
|
|
685
|
+
description: z
|
|
686
|
+
.string()
|
|
687
|
+
.describe("The human provided description of what the contract is and does, and the top level"),
|
|
688
|
+
tags: z.array(z.string()).describe("An array of tag names provided to the contract"),
|
|
689
|
+
updated: z
|
|
690
|
+
.number()
|
|
691
|
+
.describe("Unix timestamp of when the contract description was last updated"),
|
|
692
|
+
created: z.number().describe("Unix timestamp of when the contract description was created"),
|
|
693
|
+
})
|
|
694
|
+
.describe("A description of a contract, designed to be used for contract discovery by AI agents");
|
|
695
|
+
// Validation for full contract description
|
|
696
|
+
export const fullPromptSchema = promptSchema
|
|
697
|
+
.extend({
|
|
698
|
+
functions: z
|
|
699
|
+
.array(contractFunctionPromptSchema)
|
|
700
|
+
.describe("An array of Contract Function Descriptions, describing each function on the contract"),
|
|
701
|
+
})
|
|
702
|
+
.describe("A description of a smart contract, including all functions and parameters");
|
|
703
|
+
// Validation for contract search request
|
|
704
|
+
export const contractSearchSchema = z
|
|
705
|
+
.object({
|
|
706
|
+
query: z
|
|
707
|
+
.string()
|
|
708
|
+
.describe("A free-form query to search for contracts. This uses semantic search to find the most relevant contracts."),
|
|
709
|
+
chainId: z
|
|
710
|
+
.number()
|
|
711
|
+
.int()
|
|
712
|
+
.positive()
|
|
713
|
+
.optional()
|
|
714
|
+
.nullable()
|
|
715
|
+
.describe("The ChainId of a supported chainId on 1Shot API"),
|
|
716
|
+
})
|
|
717
|
+
.describe("Parameters for searching contract descriptions");
|
|
718
|
+
// Validation for contract contractMethods request
|
|
719
|
+
export const contractContractMethodsSchema = z
|
|
720
|
+
.object({
|
|
721
|
+
businessId: z
|
|
722
|
+
.string()
|
|
723
|
+
.uuid()
|
|
724
|
+
.describe("The business ID to create the contractMethods for. Used for access control and organization"),
|
|
725
|
+
chainId: z
|
|
726
|
+
.number()
|
|
727
|
+
.int()
|
|
728
|
+
.positive()
|
|
729
|
+
.describe("The ChainId of a supported chainId on 1Shot API. Determines which blockchain network the contractMethods will operate on"),
|
|
730
|
+
contractAddress: z
|
|
731
|
+
.string()
|
|
732
|
+
.describe("The address of the smart contract that contains the functions to be imported"),
|
|
733
|
+
walletId: z
|
|
734
|
+
.string()
|
|
735
|
+
.uuid()
|
|
736
|
+
.describe("The ID of the escrow wallet that will execute the contractMethods. Must be for the same chainId as the contractMethods"),
|
|
737
|
+
promptId: z
|
|
738
|
+
.string()
|
|
739
|
+
.uuid()
|
|
740
|
+
.optional()
|
|
741
|
+
.nullable()
|
|
742
|
+
.describe("The ID of the contract description that you want to use. If not provided, the highest-ranked Contract Description for the chainId and contract address will be used. This is optional, and a ContractMethod can drift from the original Contract Description but retain this association"),
|
|
743
|
+
})
|
|
744
|
+
.describe("Parameters for creating contractMethods from a contract description. This is based on the verified contract ABI and the highest-ranked Contract Description.");
|
|
745
|
+
// Validation for contractMethod test result
|
|
746
|
+
export const contractMethodTestResultSchema = z
|
|
747
|
+
.object({
|
|
748
|
+
success: z.boolean().describe("Whether or not the contractMethod would run successfully"),
|
|
749
|
+
result: z
|
|
750
|
+
.record(z.any())
|
|
751
|
+
.nullable()
|
|
752
|
+
.describe("The result returned by the contractMethod, if it was successful. When running a test, no changes are made on the blockchain, so these results are hypothetical"),
|
|
753
|
+
error: z
|
|
754
|
+
.record(z.any())
|
|
755
|
+
.nullable()
|
|
756
|
+
.describe("The error that occurred, if the contractMethod was not successful"),
|
|
757
|
+
})
|
|
758
|
+
.describe("The result of running /test on a contractMethod");
|
|
759
|
+
// Validation for contractMethod encode result
|
|
760
|
+
export const contractMethodEncodeResultSchema = z
|
|
761
|
+
.object({
|
|
762
|
+
data: z
|
|
763
|
+
.string()
|
|
764
|
+
.regex(/^0x[a-fA-F0-9]+$/)
|
|
765
|
+
.describe("The hex string of the encoded data"),
|
|
766
|
+
})
|
|
767
|
+
.describe("The result of running /encode on a contractMethod");
|
|
768
|
+
// Validation for assure contract methods from prompt parameters
|
|
769
|
+
export const assureContractMethodsFromPromptSchema = z
|
|
770
|
+
.object({
|
|
771
|
+
businessId: z.string().uuid().describe("ID of the business to create contract methods for"),
|
|
772
|
+
chainId: z
|
|
773
|
+
.number()
|
|
774
|
+
.int()
|
|
775
|
+
.positive()
|
|
776
|
+
.describe("ID of the blockchain network where the contract exists"),
|
|
777
|
+
contractAddress: z.string().describe("Address of the smart contract"),
|
|
778
|
+
walletId: z.string().uuid().describe("ID of the wallet that will execute the contract methods"),
|
|
779
|
+
promptId: z
|
|
780
|
+
.string()
|
|
781
|
+
.uuid()
|
|
782
|
+
.optional()
|
|
783
|
+
.nullable()
|
|
784
|
+
.describe("ID of the prompt to use. If not provided, the highest-ranked Prompt will be used"),
|
|
785
|
+
})
|
|
786
|
+
.describe("Parameters for assuring contract methods exist for a given Prompt");
|
|
787
|
+
//# sourceMappingURL=contractMethod.js.map
|