@virtuals-protocol/acp-node 0.3.0-beta.1 → 0.3.0-beta.11
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/dist/index.d.mts +351 -242
- package/dist/index.d.ts +351 -242
- package/dist/index.js +2416 -2316
- package/dist/index.mjs +2417 -2315
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
|
-
import { Address, Chain } from 'viem';
|
|
2
|
+
import { Address, Chain, createPublicClient } from 'viem';
|
|
3
3
|
import * as _aa_sdk_core from '@aa-sdk/core';
|
|
4
4
|
import { Address as Address$1, SmartAccountSigner } from '@aa-sdk/core';
|
|
5
5
|
import { baseSepolia, base } from '@account-kit/infra';
|
|
@@ -9,6 +9,7 @@ import * as _aa_sdk_core_dist_types_actions_smartAccount_signMessage from '@aa-s
|
|
|
9
9
|
import * as _aa_sdk_core_dist_types_actions_smartAccount_checkGasSponsorshipEligibility from '@aa-sdk/core/dist/types/actions/smartAccount/checkGasSponsorshipEligibility';
|
|
10
10
|
import * as viem__types_utils_ccip from 'viem/_types/utils/ccip';
|
|
11
11
|
import * as _account_kit_smart_contracts from '@account-kit/smart-contracts';
|
|
12
|
+
import { ModularAccountV2Client } from '@account-kit/smart-contracts';
|
|
12
13
|
|
|
13
14
|
declare const ACP_ABI: ({
|
|
14
15
|
inputs: never[];
|
|
@@ -176,76 +177,6 @@ declare const ACP_V2_ABI: ({
|
|
|
176
177
|
anonymous?: undefined;
|
|
177
178
|
})[];
|
|
178
179
|
|
|
179
|
-
declare class AcpContractConfig {
|
|
180
|
-
chain: typeof baseSepolia | typeof base;
|
|
181
|
-
contractAddress: Address$1;
|
|
182
|
-
baseFare: Fare;
|
|
183
|
-
alchemyRpcUrl: string;
|
|
184
|
-
acpUrl: string;
|
|
185
|
-
abi: typeof ACP_ABI | typeof ACP_V2_ABI;
|
|
186
|
-
rpcEndpoint?: string | undefined;
|
|
187
|
-
constructor(chain: typeof baseSepolia | typeof base, contractAddress: Address$1, baseFare: Fare, alchemyRpcUrl: string, acpUrl: string, abi: typeof ACP_ABI | typeof ACP_V2_ABI, rpcEndpoint?: string | undefined);
|
|
188
|
-
}
|
|
189
|
-
declare const baseSepoliaAcpConfig: AcpContractConfig;
|
|
190
|
-
declare const baseSepoliaAcpConfigV2: AcpContractConfig;
|
|
191
|
-
declare const baseAcpConfig: AcpContractConfig;
|
|
192
|
-
declare const baseAcpConfigV2: AcpContractConfig;
|
|
193
|
-
|
|
194
|
-
declare enum MemoType {
|
|
195
|
-
MESSAGE = 0,// 0 - Text message
|
|
196
|
-
CONTEXT_URL = 1,// 1 - URL for context
|
|
197
|
-
IMAGE_URL = 2,// 2 - Image URL
|
|
198
|
-
VOICE_URL = 3,// 3 - Voice/audio URL
|
|
199
|
-
OBJECT_URL = 4,// 4 - Object/file URL
|
|
200
|
-
TXHASH = 5,// 5 - Transaction hash reference
|
|
201
|
-
PAYABLE_REQUEST = 6,// 6 - Payment request
|
|
202
|
-
PAYABLE_TRANSFER = 7,// 7 - Direct payment transfer
|
|
203
|
-
PAYABLE_TRANSFER_ESCROW = 8,// 8 - Escrowed payment transfer
|
|
204
|
-
NOTIFICATION = 9,// 9 - Notification
|
|
205
|
-
PAYABLE_NOTIFICATION = 10
|
|
206
|
-
}
|
|
207
|
-
declare enum AcpJobPhases {
|
|
208
|
-
REQUEST = 0,
|
|
209
|
-
NEGOTIATION = 1,
|
|
210
|
-
TRANSACTION = 2,
|
|
211
|
-
EVALUATION = 3,
|
|
212
|
-
COMPLETED = 4,
|
|
213
|
-
REJECTED = 5,
|
|
214
|
-
EXPIRED = 6
|
|
215
|
-
}
|
|
216
|
-
declare enum FeeType {
|
|
217
|
-
NO_FEE = 0,
|
|
218
|
-
IMMEDIATE_FEE = 1,
|
|
219
|
-
DEFERRED_FEE = 2
|
|
220
|
-
}
|
|
221
|
-
declare abstract class BaseAcpContractClient {
|
|
222
|
-
agentWalletAddress: Address;
|
|
223
|
-
config: AcpContractConfig;
|
|
224
|
-
contractAddress: Address;
|
|
225
|
-
chain: Chain;
|
|
226
|
-
abi: typeof ACP_ABI | typeof ACP_V2_ABI;
|
|
227
|
-
jobCreatedSignature: string;
|
|
228
|
-
constructor(agentWalletAddress: Address, config?: AcpContractConfig);
|
|
229
|
-
abstract handleOperation(data: `0x${string}`, contractAddress: Address, value?: bigint): Promise<Address>;
|
|
230
|
-
abstract getJobId(hash: Address, clientAddress: Address, providerAddress: Address): Promise<number>;
|
|
231
|
-
get walletAddress(): `0x${string}`;
|
|
232
|
-
createJobWithAccount(accountId: number, providerAddress: Address, evaluatorAddress: Address, budgetBaseUnit: bigint, paymentTokenAddress: Address, expiredAt: Date): Promise<{
|
|
233
|
-
txHash: string;
|
|
234
|
-
jobId: number;
|
|
235
|
-
}>;
|
|
236
|
-
createJob(providerAddress: Address, evaluatorAddress: Address, expiredAt: Date, paymentTokenAddress: Address, budgetBaseUnit: bigint, metadata: string): Promise<{
|
|
237
|
-
txHash: string;
|
|
238
|
-
jobId: number;
|
|
239
|
-
}>;
|
|
240
|
-
approveAllowance(amountBaseUnit: bigint, paymentTokenAddress?: Address): Promise<`0x${string}`>;
|
|
241
|
-
createPayableMemo(jobId: number, content: string, amountBaseUnit: bigint, recipient: Address, feeAmountBaseUnit: bigint, feeType: FeeType, nextPhase: AcpJobPhases, type: MemoType.PAYABLE_REQUEST | MemoType.PAYABLE_TRANSFER_ESCROW | MemoType.PAYABLE_TRANSFER | MemoType.PAYABLE_NOTIFICATION, expiredAt: Date, token?: Address, secured?: boolean): Promise<`0x${string}`>;
|
|
242
|
-
createMemo(jobId: number, content: string, type: MemoType, isSecured: boolean, nextPhase: AcpJobPhases): Promise<Address>;
|
|
243
|
-
signMemo(memoId: number, isApproved: boolean, reason?: string): Promise<`0x${string}`>;
|
|
244
|
-
setBudgetWithPaymentToken(jobId: number, budgetBaseUnit: bigint, paymentTokenAddress?: Address): Promise<`0x${string}`>;
|
|
245
|
-
updateAccountMetadata(accountId: number, metadata: string): Promise<`0x${string}`>;
|
|
246
|
-
wrapEth(amountBaseUnit: bigint): Promise<`0x${string}`>;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
180
|
declare class AcpAccount {
|
|
250
181
|
contractClient: BaseAcpContractClient;
|
|
251
182
|
id: number;
|
|
@@ -253,7 +184,7 @@ declare class AcpAccount {
|
|
|
253
184
|
providerAddress: Address;
|
|
254
185
|
metadata: Record<string, any>;
|
|
255
186
|
constructor(contractClient: BaseAcpContractClient, id: number, clientAddress: Address, providerAddress: Address, metadata: Record<string, any>);
|
|
256
|
-
updateMetadata(metadata: Record<string, any>): Promise
|
|
187
|
+
updateMetadata(metadata: Record<string, any>): Promise<OperationPayload>;
|
|
257
188
|
}
|
|
258
189
|
|
|
259
190
|
declare class AcpMemo {
|
|
@@ -271,8 +202,104 @@ declare class AcpMemo {
|
|
|
271
202
|
constructor(contractClient: BaseAcpContractClient, id: number, type: MemoType, content: string, nextPhase: AcpJobPhases, status: AcpMemoStatus, senderAddress: Address, signedReason?: string | undefined, expiry?: Date | undefined, payableDetails?: PayableDetails | undefined);
|
|
272
203
|
get payloadType(): PayloadType | undefined;
|
|
273
204
|
getStructuredContent<T>(): GenericPayload<T> | undefined;
|
|
274
|
-
create(jobId: number, isSecured?: boolean): Promise
|
|
275
|
-
sign(approved: boolean, reason?: string): Promise
|
|
205
|
+
create(jobId: number, isSecured?: boolean): Promise<OperationPayload>;
|
|
206
|
+
sign(approved: boolean, reason?: string): Promise<{
|
|
207
|
+
userOpHash: Address;
|
|
208
|
+
txnHash: Address;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare enum PriceType {
|
|
213
|
+
FIXED = "fixed",
|
|
214
|
+
PERCENTAGE = "percentage"
|
|
215
|
+
}
|
|
216
|
+
declare class AcpJobOffering {
|
|
217
|
+
private readonly acpClient;
|
|
218
|
+
private readonly acpContractClient;
|
|
219
|
+
providerAddress: Address;
|
|
220
|
+
name: string;
|
|
221
|
+
price: number;
|
|
222
|
+
priceType: PriceType;
|
|
223
|
+
requirement?: (Object | string) | undefined;
|
|
224
|
+
private ajv;
|
|
225
|
+
constructor(acpClient: AcpClient, acpContractClient: BaseAcpContractClient, providerAddress: Address, name: string, price: number, priceType?: PriceType, requirement?: (Object | string) | undefined);
|
|
226
|
+
initiateJob(serviceRequirement: Object | string, evaluatorAddress?: Address, expiredAt?: Date): Promise<number>;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
declare class AcpJob {
|
|
230
|
+
private acpClient;
|
|
231
|
+
id: number;
|
|
232
|
+
clientAddress: Address;
|
|
233
|
+
providerAddress: Address;
|
|
234
|
+
evaluatorAddress: Address;
|
|
235
|
+
price: number;
|
|
236
|
+
priceTokenAddress: Address;
|
|
237
|
+
memos: AcpMemo[];
|
|
238
|
+
phase: AcpJobPhases;
|
|
239
|
+
context: Record<string, any>;
|
|
240
|
+
contractAddress: Address;
|
|
241
|
+
netPayableAmount?: number | undefined;
|
|
242
|
+
name: string | undefined;
|
|
243
|
+
requirement: Record<string, any> | string | undefined;
|
|
244
|
+
priceType: PriceType;
|
|
245
|
+
priceValue: number;
|
|
246
|
+
constructor(acpClient: AcpClient, id: number, clientAddress: Address, providerAddress: Address, evaluatorAddress: Address, price: number, priceTokenAddress: Address, memos: AcpMemo[], phase: AcpJobPhases, context: Record<string, any>, contractAddress: Address, netPayableAmount?: number | undefined);
|
|
247
|
+
get acpContractClient(): BaseAcpContractClient;
|
|
248
|
+
get config(): AcpContractConfig;
|
|
249
|
+
get baseFare(): Fare;
|
|
250
|
+
get deliverable(): string | undefined;
|
|
251
|
+
get rejectionReason(): string | undefined;
|
|
252
|
+
get providerAgent(): Promise<AcpAgent | undefined>;
|
|
253
|
+
get clientAgent(): Promise<AcpAgent | undefined>;
|
|
254
|
+
get evaluatorAgent(): Promise<AcpAgent | undefined>;
|
|
255
|
+
get account(): Promise<AcpAccount | null>;
|
|
256
|
+
get latestMemo(): AcpMemo | undefined;
|
|
257
|
+
createRequirement(content: string): Promise<{
|
|
258
|
+
userOpHash: Address;
|
|
259
|
+
txnHash: Address;
|
|
260
|
+
}>;
|
|
261
|
+
createPayableRequirement(content: string, type: MemoType.PAYABLE_REQUEST | MemoType.PAYABLE_TRANSFER_ESCROW, amount: FareAmountBase, recipient: Address, expiredAt?: Date): Promise<{
|
|
262
|
+
userOpHash: Address;
|
|
263
|
+
txnHash: Address;
|
|
264
|
+
}>;
|
|
265
|
+
payAndAcceptRequirement(reason?: string): Promise<{
|
|
266
|
+
userOpHash: Address;
|
|
267
|
+
txnHash: Address;
|
|
268
|
+
}>;
|
|
269
|
+
respond(accept: boolean, reason?: string): Promise<{
|
|
270
|
+
userOpHash: Address;
|
|
271
|
+
txnHash: Address;
|
|
272
|
+
}>;
|
|
273
|
+
accept(reason?: string): Promise<{
|
|
274
|
+
userOpHash: Address;
|
|
275
|
+
txnHash: Address;
|
|
276
|
+
}>;
|
|
277
|
+
reject(reason?: string): Promise<{
|
|
278
|
+
userOpHash: Address;
|
|
279
|
+
txnHash: Address;
|
|
280
|
+
}>;
|
|
281
|
+
rejectPayable(reason: string | undefined, amount: FareAmountBase, expiredAt?: Date): Promise<{
|
|
282
|
+
userOpHash: Address;
|
|
283
|
+
txnHash: Address;
|
|
284
|
+
}>;
|
|
285
|
+
deliver(deliverable: DeliverablePayload): Promise<{
|
|
286
|
+
userOpHash: Address;
|
|
287
|
+
txnHash: Address;
|
|
288
|
+
}>;
|
|
289
|
+
deliverPayable(deliverable: DeliverablePayload, amount: FareAmountBase, expiredAt?: Date): Promise<{
|
|
290
|
+
userOpHash: Address;
|
|
291
|
+
txnHash: Address;
|
|
292
|
+
}>;
|
|
293
|
+
evaluate(accept: boolean, reason?: string): Promise<void>;
|
|
294
|
+
createNotification(content: string): Promise<{
|
|
295
|
+
userOpHash: Address;
|
|
296
|
+
txnHash: Address;
|
|
297
|
+
}>;
|
|
298
|
+
createPayableNotification(content: string, amount: FareAmountBase, expiredAt?: Date): Promise<{
|
|
299
|
+
userOpHash: Address;
|
|
300
|
+
txnHash: Address;
|
|
301
|
+
}>;
|
|
302
|
+
private performX402Payment;
|
|
276
303
|
}
|
|
277
304
|
|
|
278
305
|
type DeliverablePayload = string | Record<string, unknown>;
|
|
@@ -305,6 +332,10 @@ declare enum AcpOnlineStatus {
|
|
|
305
332
|
ONLINE = "online",
|
|
306
333
|
OFFLINE = "offline"
|
|
307
334
|
}
|
|
335
|
+
interface IAcpJobX402PaymentDetails {
|
|
336
|
+
isX402: boolean;
|
|
337
|
+
isBudgetReceived: boolean;
|
|
338
|
+
}
|
|
308
339
|
interface IAcpClientOptions {
|
|
309
340
|
acpContractClient: BaseAcpContractClient | BaseAcpContractClient[];
|
|
310
341
|
onNewTask?: (job: AcpJob, memoToSign?: AcpMemo) => void;
|
|
@@ -326,7 +357,10 @@ type AcpAgent = {
|
|
|
326
357
|
twitterHandle: string;
|
|
327
358
|
jobs: {
|
|
328
359
|
name: string;
|
|
329
|
-
|
|
360
|
+
priceV2: {
|
|
361
|
+
type: PriceType;
|
|
362
|
+
value: number;
|
|
363
|
+
};
|
|
330
364
|
requirement?: Object | string;
|
|
331
365
|
deliverable?: Object | string;
|
|
332
366
|
}[];
|
|
@@ -401,144 +435,171 @@ type ClosePositionPayload = {
|
|
|
401
435
|
positionId: number;
|
|
402
436
|
amount: number;
|
|
403
437
|
};
|
|
404
|
-
type PositionFulfilledPayload = {
|
|
405
|
-
symbol: string;
|
|
406
|
-
amount: number;
|
|
407
|
-
contractAddress: string;
|
|
408
|
-
type: "TP" | "SL" | "CLOSE";
|
|
409
|
-
pnl: number;
|
|
410
|
-
entryPrice: number;
|
|
411
|
-
exitPrice: number;
|
|
412
|
-
};
|
|
413
|
-
type UnfulfilledPositionPayload = {
|
|
414
|
-
symbol: string;
|
|
415
|
-
amount: number;
|
|
416
|
-
contractAddress: string;
|
|
417
|
-
type: "ERROR" | "PARTIAL";
|
|
418
|
-
reason?: string;
|
|
419
|
-
};
|
|
420
438
|
type RequestClosePositionPayload = {
|
|
421
439
|
positionId: number;
|
|
422
440
|
};
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
441
|
+
type X402Config = {
|
|
442
|
+
url: string;
|
|
443
|
+
};
|
|
444
|
+
type X402PayableRequirements = {
|
|
445
|
+
x402Version: number;
|
|
446
|
+
error: string;
|
|
447
|
+
accepts: X402Requirement[];
|
|
448
|
+
};
|
|
449
|
+
type X402Requirement = {
|
|
450
|
+
scheme: string;
|
|
451
|
+
network: string;
|
|
452
|
+
maxAmountRequired: string;
|
|
453
|
+
resource: string;
|
|
454
|
+
description: string;
|
|
455
|
+
mimeType: string;
|
|
456
|
+
payTo: Address;
|
|
457
|
+
maxTimeoutSeconds: number;
|
|
458
|
+
asset: Address;
|
|
459
|
+
extra: {
|
|
460
|
+
name: string;
|
|
461
|
+
version: string;
|
|
462
|
+
};
|
|
463
|
+
outputSchema: any;
|
|
464
|
+
};
|
|
465
|
+
type X402PayableRequest = {
|
|
466
|
+
to: Address;
|
|
467
|
+
value: number;
|
|
468
|
+
maxTimeoutSeconds: number;
|
|
469
|
+
asset: Address;
|
|
470
|
+
};
|
|
471
|
+
type X402Payment = {
|
|
472
|
+
encodedPayment: string;
|
|
473
|
+
signature: string;
|
|
474
|
+
message: {
|
|
475
|
+
from: Address;
|
|
476
|
+
to: Address;
|
|
477
|
+
value: string;
|
|
478
|
+
validAfter: string;
|
|
479
|
+
validBefore: string;
|
|
480
|
+
nonce: string;
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
type OffChainJob = {
|
|
426
484
|
id: number;
|
|
485
|
+
documentId: string;
|
|
486
|
+
txHash: Address;
|
|
487
|
+
clientId: number;
|
|
488
|
+
providerId: number;
|
|
489
|
+
budget: number;
|
|
490
|
+
createdAt: string;
|
|
491
|
+
updatedAt: string;
|
|
492
|
+
publishedAt: string;
|
|
493
|
+
locale: string | null;
|
|
427
494
|
clientAddress: Address;
|
|
428
495
|
providerAddress: Address;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
priceTokenAddress: Address;
|
|
432
|
-
memos: AcpMemo[];
|
|
496
|
+
evaluators: Address[];
|
|
497
|
+
budgetTxHash: Address | null;
|
|
433
498
|
phase: AcpJobPhases;
|
|
434
|
-
|
|
499
|
+
agentIdPair: string;
|
|
500
|
+
onChainJobId: string;
|
|
501
|
+
summary: string;
|
|
502
|
+
userOpHash: Address | null;
|
|
503
|
+
amountClaimed: number;
|
|
504
|
+
context: Record<string, any> | null;
|
|
505
|
+
expiry: string;
|
|
506
|
+
refundRetryTimes: number;
|
|
507
|
+
additionalFees: number;
|
|
508
|
+
budgetTokenAddress: Address;
|
|
509
|
+
budgetUSD: number;
|
|
510
|
+
amountClaimedUSD: number | null;
|
|
511
|
+
additionalFeesUSD: number | null;
|
|
435
512
|
contractAddress: Address;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
deliver(deliverable: DeliverablePayload): Promise<`0x${string}`>;
|
|
456
|
-
deliverPayable(deliverable: DeliverablePayload, amount: FareAmountBase, expiredAt?: Date): Promise<`0x${string}`>;
|
|
457
|
-
evaluate(accept: boolean, reason?: string): Promise<void>;
|
|
458
|
-
pay(reason?: string): Promise<`0x${string}`>;
|
|
459
|
-
createNotification(content: string): Promise<`0x${string}`>;
|
|
460
|
-
createPayableNotification(content: string, amount: FareAmountBase, expiredAt?: Date): Promise<`0x${string}`>;
|
|
461
|
-
/**
|
|
462
|
-
* @deprecated The method should not be used
|
|
463
|
-
*/
|
|
464
|
-
openPosition(payload: OpenPositionPayload[], feeAmount: number, expiredAt?: Date, // 3 minutes
|
|
465
|
-
walletAddress?: Address): Promise<`0x${string}`>;
|
|
466
|
-
/**
|
|
467
|
-
* @deprecated The method should not be used
|
|
468
|
-
*/
|
|
469
|
-
swapToken(payload: SwapTokenPayload, decimals: number, feeAmount: number, walletAddress?: Address): Promise<`0x${string}`>;
|
|
470
|
-
/**
|
|
471
|
-
* @deprecated The method should not be used
|
|
472
|
-
*/
|
|
473
|
-
responseSwapToken(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
|
|
474
|
-
/**
|
|
475
|
-
* @deprecated The method should not be used
|
|
476
|
-
*/
|
|
477
|
-
transferFunds<T>(payload: GenericPayload<T>, fareAmount: FareAmountBase, walletAddress?: Address, expiredAt?: Date): Promise<`0x${string}`>;
|
|
478
|
-
/**
|
|
479
|
-
* @deprecated The method should not be used
|
|
480
|
-
*/
|
|
481
|
-
responseOpenPosition(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
|
|
482
|
-
/**
|
|
483
|
-
* @deprecated The method should not be used
|
|
484
|
-
*/
|
|
485
|
-
closePartialPosition(payload: ClosePositionPayload, expireAt?: Date): Promise<`0x${string}`>;
|
|
486
|
-
/**
|
|
487
|
-
* @deprecated The method should not be used
|
|
488
|
-
*/
|
|
489
|
-
responseClosePartialPosition(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
|
|
490
|
-
/**
|
|
491
|
-
* @deprecated The method should not be used
|
|
492
|
-
*/
|
|
493
|
-
requestClosePosition(payload: RequestClosePositionPayload): Promise<`0x${string}`>;
|
|
494
|
-
/**
|
|
495
|
-
* @deprecated The method should not be used
|
|
496
|
-
*/
|
|
497
|
-
responseRequestClosePosition(memoId: number, accept: boolean, payload: ClosePositionPayload, reason?: string, expiredAt?: Date): Promise<`0x${string}` | undefined>;
|
|
498
|
-
/**
|
|
499
|
-
* @deprecated The method should not be used
|
|
500
|
-
*/
|
|
501
|
-
confirmClosePosition(memoId: number, accept: boolean, reason?: string): Promise<void>;
|
|
502
|
-
/**
|
|
503
|
-
* @deprecated The method should not be used
|
|
504
|
-
*/
|
|
505
|
-
positionFulfilled(payload: PositionFulfilledPayload, expiredAt?: Date): Promise<`0x${string}`>;
|
|
506
|
-
/**
|
|
507
|
-
* @deprecated The method should not be used
|
|
508
|
-
*/
|
|
509
|
-
unfulfilledPosition(payload: UnfulfilledPositionPayload, expiredAt?: Date): Promise<`0x${string}`>;
|
|
510
|
-
/**
|
|
511
|
-
* @deprecated The method should not be used
|
|
512
|
-
*/
|
|
513
|
-
responseUnfulfilledPosition(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
|
|
514
|
-
/**
|
|
515
|
-
* @deprecated The method should not be used
|
|
516
|
-
*/
|
|
517
|
-
responsePositionFulfilled(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
|
|
518
|
-
/**
|
|
519
|
-
* @deprecated The method should not be used
|
|
520
|
-
*/
|
|
521
|
-
closeJob(message?: string): Promise<`0x${string}`>;
|
|
522
|
-
/**
|
|
523
|
-
* @deprecated The method should not be used
|
|
524
|
-
*/
|
|
525
|
-
responseCloseJob(memoId: number, accept: boolean, fulfilledPositions: PositionFulfilledPayload[], reason?: string, expiredAt?: Date): Promise<`0x${string}` | undefined>;
|
|
526
|
-
/**
|
|
527
|
-
* @deprecated The method should not be used
|
|
528
|
-
*/
|
|
529
|
-
confirmJobClosure(memoId: number, accept: boolean, reason?: string): Promise<void>;
|
|
513
|
+
accountId: number | null;
|
|
514
|
+
x402Nonce: string;
|
|
515
|
+
};
|
|
516
|
+
type X402PaymentResponse = {
|
|
517
|
+
isPaymentRequired: boolean;
|
|
518
|
+
data: X402PayableRequirements;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
declare class AcpContractConfig {
|
|
522
|
+
chain: typeof baseSepolia | typeof base;
|
|
523
|
+
contractAddress: Address$1;
|
|
524
|
+
baseFare: Fare;
|
|
525
|
+
alchemyRpcUrl: string;
|
|
526
|
+
acpUrl: string;
|
|
527
|
+
abi: typeof ACP_ABI | typeof ACP_V2_ABI;
|
|
528
|
+
maxRetries: number;
|
|
529
|
+
rpcEndpoint?: string | undefined;
|
|
530
|
+
x402Config?: X402Config | undefined;
|
|
531
|
+
constructor(chain: typeof baseSepolia | typeof base, contractAddress: Address$1, baseFare: Fare, alchemyRpcUrl: string, acpUrl: string, abi: typeof ACP_ABI | typeof ACP_V2_ABI, maxRetries: number, rpcEndpoint?: string | undefined, x402Config?: X402Config | undefined);
|
|
530
532
|
}
|
|
533
|
+
declare const baseSepoliaAcpConfig: AcpContractConfig;
|
|
534
|
+
declare const baseSepoliaAcpConfigV2: AcpContractConfig;
|
|
535
|
+
declare const baseAcpConfig: AcpContractConfig;
|
|
536
|
+
declare const baseAcpX402Config: AcpContractConfig;
|
|
537
|
+
declare const baseAcpConfigV2: AcpContractConfig;
|
|
538
|
+
declare const baseAcpX402ConfigV2: AcpContractConfig;
|
|
531
539
|
|
|
532
|
-
declare
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
540
|
+
declare enum MemoType {
|
|
541
|
+
MESSAGE = 0,// 0 - Text message
|
|
542
|
+
CONTEXT_URL = 1,// 1 - URL for context
|
|
543
|
+
IMAGE_URL = 2,// 2 - Image URL
|
|
544
|
+
VOICE_URL = 3,// 3 - Voice/audio URL
|
|
545
|
+
OBJECT_URL = 4,// 4 - Object/file URL
|
|
546
|
+
TXHASH = 5,// 5 - Transaction hash reference
|
|
547
|
+
PAYABLE_REQUEST = 6,// 6 - Payment request
|
|
548
|
+
PAYABLE_TRANSFER = 7,// 7 - Direct payment transfer
|
|
549
|
+
PAYABLE_TRANSFER_ESCROW = 8,// 8 - Escrowed payment transfer
|
|
550
|
+
NOTIFICATION = 9,// 9 - Notification
|
|
551
|
+
PAYABLE_NOTIFICATION = 10
|
|
552
|
+
}
|
|
553
|
+
declare enum AcpJobPhases {
|
|
554
|
+
REQUEST = 0,
|
|
555
|
+
NEGOTIATION = 1,
|
|
556
|
+
TRANSACTION = 2,
|
|
557
|
+
EVALUATION = 3,
|
|
558
|
+
COMPLETED = 4,
|
|
559
|
+
REJECTED = 5,
|
|
560
|
+
EXPIRED = 6
|
|
561
|
+
}
|
|
562
|
+
declare enum FeeType {
|
|
563
|
+
NO_FEE = 0,
|
|
564
|
+
IMMEDIATE_FEE = 1,
|
|
565
|
+
DEFERRED_FEE = 2,
|
|
566
|
+
PERCENTAGE_FEE = 3
|
|
567
|
+
}
|
|
568
|
+
interface OperationPayload {
|
|
569
|
+
data: `0x${string}`;
|
|
570
|
+
contractAddress: Address;
|
|
571
|
+
value?: bigint;
|
|
572
|
+
}
|
|
573
|
+
declare abstract class BaseAcpContractClient {
|
|
574
|
+
agentWalletAddress: Address;
|
|
575
|
+
config: AcpContractConfig;
|
|
576
|
+
contractAddress: Address;
|
|
577
|
+
chain: Chain;
|
|
578
|
+
abi: typeof ACP_ABI | typeof ACP_V2_ABI;
|
|
579
|
+
jobCreatedSignature: string;
|
|
580
|
+
publicClient: ReturnType<typeof createPublicClient>;
|
|
581
|
+
constructor(agentWalletAddress: Address, config?: AcpContractConfig);
|
|
582
|
+
abstract handleOperation(operations: OperationPayload[]): Promise<{
|
|
583
|
+
userOpHash: Address;
|
|
584
|
+
txnHash: Address;
|
|
585
|
+
}>;
|
|
586
|
+
abstract getJobId(createJobUserOpHash: Address, clientAddress: Address, providerAddress: Address): Promise<number>;
|
|
587
|
+
get walletAddress(): `0x${string}`;
|
|
588
|
+
createJobWithAccount(accountId: number, evaluatorAddress: Address, budgetBaseUnit: bigint, paymentTokenAddress: Address, expiredAt: Date, isX402Job?: boolean): OperationPayload;
|
|
589
|
+
createJob(providerAddress: Address, evaluatorAddress: Address, expiredAt: Date, paymentTokenAddress: Address, budgetBaseUnit: bigint, metadata: string, isX402Job?: boolean): OperationPayload;
|
|
590
|
+
approveAllowance(amountBaseUnit: bigint, paymentTokenAddress?: Address): OperationPayload;
|
|
591
|
+
createPayableMemo(jobId: number, content: string, amountBaseUnit: bigint, recipient: Address, feeAmountBaseUnit: bigint, feeType: FeeType, nextPhase: AcpJobPhases, type: MemoType.PAYABLE_REQUEST | MemoType.PAYABLE_TRANSFER_ESCROW | MemoType.PAYABLE_TRANSFER | MemoType.PAYABLE_NOTIFICATION, expiredAt: Date, token?: Address, secured?: boolean): OperationPayload;
|
|
592
|
+
createMemo(jobId: number, content: string, type: MemoType, isSecured: boolean, nextPhase: AcpJobPhases): OperationPayload;
|
|
593
|
+
signMemo(memoId: number, isApproved: boolean, reason?: string): OperationPayload;
|
|
594
|
+
setBudgetWithPaymentToken(jobId: number, budgetBaseUnit: bigint, paymentTokenAddress?: Address): OperationPayload | undefined;
|
|
595
|
+
updateAccountMetadata(accountId: number, metadata: string): OperationPayload;
|
|
596
|
+
wrapEth(amountBaseUnit: bigint): OperationPayload;
|
|
597
|
+
getX402PaymentDetails(jobId: number): Promise<IAcpJobX402PaymentDetails>;
|
|
598
|
+
abstract updateJobX402Nonce(jobId: number, nonce: string): Promise<OffChainJob>;
|
|
599
|
+
abstract generateX402Payment(payableRequest: X402PayableRequest, requirements: X402PayableRequirements): Promise<X402Payment>;
|
|
600
|
+
abstract performX402Request(url: string, version: string, budget?: string, signature?: string): Promise<X402PaymentResponse>;
|
|
601
|
+
submitTransferWithAuthorization(from: Address, to: Address, value: bigint, validAfter: bigint, validBefore: bigint, nonce: string, signature: string): Promise<OperationPayload[]>;
|
|
602
|
+
abstract getAcpVersion(): string;
|
|
542
603
|
}
|
|
543
604
|
|
|
544
605
|
interface IAcpBrowseAgentsOptions {
|
|
@@ -574,19 +635,15 @@ declare class AcpClient {
|
|
|
574
635
|
minsFromLastOnline: number;
|
|
575
636
|
isOnline: boolean;
|
|
576
637
|
} | undefined;
|
|
638
|
+
resource: {
|
|
639
|
+
name: string;
|
|
640
|
+
description: string;
|
|
641
|
+
url: string;
|
|
642
|
+
parameters?: Object;
|
|
643
|
+
id: number;
|
|
644
|
+
}[];
|
|
577
645
|
}[]>;
|
|
578
646
|
initiateJob(providerAddress: Address, serviceRequirement: Object | string, fareAmount: FareAmountBase, evaluatorAddress?: Address, expiredAt?: Date): Promise<number>;
|
|
579
|
-
createMemo(jobId: number, content: string, nextPhase: AcpJobPhases): Promise<`0x${string}`>;
|
|
580
|
-
createPayableMemo(jobId: number, content: string, amount: FareAmountBase, recipient: Address, nextPhase: AcpJobPhases, type: MemoType.PAYABLE_REQUEST | MemoType.PAYABLE_TRANSFER_ESCROW, expiredAt: Date): Promise<`0x${string}`>;
|
|
581
|
-
respondJob(jobId: number, memoId: number, accept: boolean, content?: string, reason?: string): Promise<`0x${string}` | undefined>;
|
|
582
|
-
payJob(jobId: number, amountBaseUnit: bigint, memoId: number, reason?: string): Promise<`0x${string}`>;
|
|
583
|
-
requestFunds<T>(jobId: number, transferFareAmount: FareAmountBase, recipient: Address, feeFareAmount: FareAmountBase, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
|
|
584
|
-
responseFundsRequest(memoId: number, accept: boolean, amountBaseUnit: bigint, reason?: string): Promise<`0x${string}`>;
|
|
585
|
-
transferFunds<T>(jobId: number, transferFareAmount: FareAmountBase, recipient: Address, feeFareAmount: FareAmountBase, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
|
|
586
|
-
sendMessage<T>(jobId: number, message: GenericPayload<T>, nextPhase: AcpJobPhases): Promise<`0x${string}`>;
|
|
587
|
-
responseFundsTransfer(memoId: number, accept: boolean, reason?: string): Promise<`0x${string}`>;
|
|
588
|
-
rejectJob(jobId: number, reason?: string): Promise<`0x${string}`>;
|
|
589
|
-
deliverJob(jobId: number, deliverable: DeliverablePayload): Promise<`0x${string}`>;
|
|
590
647
|
getActiveJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
|
|
591
648
|
getPendingMemoJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
|
|
592
649
|
getCompletedJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
|
|
@@ -598,12 +655,26 @@ declare class AcpClient {
|
|
|
598
655
|
getByClientAndProvider(clientAddress: Address, providerAddress: Address, acpContractClient?: BaseAcpContractClient): Promise<AcpAccount | null>;
|
|
599
656
|
}
|
|
600
657
|
|
|
658
|
+
declare class AcpX402 {
|
|
659
|
+
private config;
|
|
660
|
+
private sessionKeyClient;
|
|
661
|
+
private publicClient;
|
|
662
|
+
constructor(config: AcpContractConfig, sessionKeyClient: ModularAccountV2Client, publicClient: ReturnType<typeof createPublicClient>);
|
|
663
|
+
signUpdateJobNonceMessage(jobId: number, nonce: string): Promise<`0x${string}`>;
|
|
664
|
+
updateJobNonce(jobId: number, nonce: string): Promise<OffChainJob>;
|
|
665
|
+
generatePayment(payableRequest: X402PayableRequest, requirements: X402PayableRequirements): Promise<X402Payment>;
|
|
666
|
+
performRequest(url: string, version: string, budget?: string, signature?: string): Promise<{
|
|
667
|
+
isPaymentRequired: boolean;
|
|
668
|
+
data: any;
|
|
669
|
+
}>;
|
|
670
|
+
}
|
|
671
|
+
|
|
601
672
|
declare class AcpContractClient extends BaseAcpContractClient {
|
|
602
|
-
protected MAX_RETRIES: number;
|
|
603
673
|
protected PRIORITY_FEE_MULTIPLIER: number;
|
|
604
674
|
protected MAX_FEE_PER_GAS: number;
|
|
605
675
|
protected MAX_PRIORITY_FEE_PER_GAS: number;
|
|
606
676
|
private _sessionKeyClient;
|
|
677
|
+
private _acpX402;
|
|
607
678
|
constructor(agentWalletAddress: Address$1, config?: AcpContractConfig);
|
|
608
679
|
static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig): Promise<AcpContractClient>;
|
|
609
680
|
init(privateKey: Address$1, sessionEntityKeyId: number): Promise<void>;
|
|
@@ -822,6 +893,10 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
822
893
|
Method: "eth_sendRawTransaction";
|
|
823
894
|
Parameters: [signedTransaction: viem.Hex];
|
|
824
895
|
ReturnType: viem.Hash;
|
|
896
|
+
}, {
|
|
897
|
+
Method: "eth_sendRawTransactionSync";
|
|
898
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
899
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
825
900
|
}, {
|
|
826
901
|
Method: "eth_simulateV1";
|
|
827
902
|
Parameters: [{
|
|
@@ -880,6 +955,7 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
880
955
|
[x: `bytes4[${string}]`]: undefined;
|
|
881
956
|
[x: `bytes[${string}]`]: undefined;
|
|
882
957
|
[x: `bytes6[${string}]`]: undefined;
|
|
958
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
883
959
|
[x: `bytes1[${string}]`]: undefined;
|
|
884
960
|
[x: `bytes2[${string}]`]: undefined;
|
|
885
961
|
[x: `bytes3[${string}]`]: undefined;
|
|
@@ -887,7 +963,6 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
887
963
|
[x: `bytes7[${string}]`]: undefined;
|
|
888
964
|
[x: `bytes8[${string}]`]: undefined;
|
|
889
965
|
[x: `bytes9[${string}]`]: undefined;
|
|
890
|
-
[x: `bytes10[${string}]`]: undefined;
|
|
891
966
|
[x: `bytes11[${string}]`]: undefined;
|
|
892
967
|
[x: `bytes12[${string}]`]: undefined;
|
|
893
968
|
[x: `bytes13[${string}]`]: undefined;
|
|
@@ -982,6 +1057,7 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
982
1057
|
bytes4?: undefined;
|
|
983
1058
|
bytes?: undefined;
|
|
984
1059
|
bytes6?: undefined;
|
|
1060
|
+
bytes10?: undefined;
|
|
985
1061
|
bytes1?: undefined;
|
|
986
1062
|
bytes2?: undefined;
|
|
987
1063
|
bytes3?: undefined;
|
|
@@ -989,7 +1065,6 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
989
1065
|
bytes7?: undefined;
|
|
990
1066
|
bytes8?: undefined;
|
|
991
1067
|
bytes9?: undefined;
|
|
992
|
-
bytes10?: undefined;
|
|
993
1068
|
bytes11?: undefined;
|
|
994
1069
|
bytes12?: undefined;
|
|
995
1070
|
bytes13?: undefined;
|
|
@@ -7908,6 +7983,7 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
7908
7983
|
}, (request["parameters"] extends readonly viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "gas" | "nonce" | "blobVersionedHashes" | "chainId" | "type") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "gas" | "nonce" | "blobVersionedHashes" | "chainId" | "type") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">))[K]; } : never>;
|
|
7909
7984
|
readContract: <const abi extends viem.Abi | readonly unknown[], functionName extends viem.ContractFunctionName<abi, "pure" | "view">, const args extends viem.ContractFunctionArgs<abi, "pure" | "view", functionName>>(args: viem.ReadContractParameters<abi, functionName, args>) => Promise<viem.ReadContractReturnType<abi, functionName, args>>;
|
|
7910
7985
|
sendRawTransaction: (args: viem.SendRawTransactionParameters) => Promise<viem.SendRawTransactionReturnType>;
|
|
7986
|
+
sendRawTransactionSync: (args: viem.SendRawTransactionSyncParameters) => Promise<viem.TransactionReceipt>;
|
|
7911
7987
|
simulate: <const calls extends readonly unknown[]>(args: viem.SimulateBlocksParameters<calls>) => Promise<viem.SimulateBlocksReturnType<calls>>;
|
|
7912
7988
|
simulateBlocks: <const calls extends readonly unknown[]>(args: viem.SimulateBlocksParameters<calls>) => Promise<viem.SimulateBlocksReturnType<calls>>;
|
|
7913
7989
|
simulateCalls: <const calls extends readonly unknown[]>(args: viem.SimulateCallsParameters<calls>) => Promise<viem.SimulateCallsReturnType<calls>>;
|
|
@@ -8137,6 +8213,10 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8137
8213
|
Method: "eth_sendRawTransaction";
|
|
8138
8214
|
Parameters: [signedTransaction: viem.Hex];
|
|
8139
8215
|
ReturnType: viem.Hash;
|
|
8216
|
+
}, {
|
|
8217
|
+
Method: "eth_sendRawTransactionSync";
|
|
8218
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
8219
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
8140
8220
|
}, {
|
|
8141
8221
|
Method: "eth_simulateV1";
|
|
8142
8222
|
Parameters: [{
|
|
@@ -8192,6 +8272,7 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8192
8272
|
[x: `bytes4[${string}]`]: undefined;
|
|
8193
8273
|
[x: `bytes[${string}]`]: undefined;
|
|
8194
8274
|
[x: `bytes6[${string}]`]: undefined;
|
|
8275
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
8195
8276
|
[x: `bytes1[${string}]`]: undefined;
|
|
8196
8277
|
[x: `bytes2[${string}]`]: undefined;
|
|
8197
8278
|
[x: `bytes3[${string}]`]: undefined;
|
|
@@ -8199,7 +8280,6 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8199
8280
|
[x: `bytes7[${string}]`]: undefined;
|
|
8200
8281
|
[x: `bytes8[${string}]`]: undefined;
|
|
8201
8282
|
[x: `bytes9[${string}]`]: undefined;
|
|
8202
|
-
[x: `bytes10[${string}]`]: undefined;
|
|
8203
8283
|
[x: `bytes11[${string}]`]: undefined;
|
|
8204
8284
|
[x: `bytes12[${string}]`]: undefined;
|
|
8205
8285
|
[x: `bytes13[${string}]`]: undefined;
|
|
@@ -8294,6 +8374,7 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8294
8374
|
bytes4?: undefined;
|
|
8295
8375
|
bytes?: undefined;
|
|
8296
8376
|
bytes6?: undefined;
|
|
8377
|
+
bytes10?: undefined;
|
|
8297
8378
|
bytes1?: undefined;
|
|
8298
8379
|
bytes2?: undefined;
|
|
8299
8380
|
bytes3?: undefined;
|
|
@@ -8301,7 +8382,6 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8301
8382
|
bytes7?: undefined;
|
|
8302
8383
|
bytes8?: undefined;
|
|
8303
8384
|
bytes9?: undefined;
|
|
8304
|
-
bytes10?: undefined;
|
|
8305
8385
|
bytes11?: undefined;
|
|
8306
8386
|
bytes12?: undefined;
|
|
8307
8387
|
bytes13?: undefined;
|
|
@@ -8588,6 +8668,10 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8588
8668
|
Method: "eth_sendRawTransaction";
|
|
8589
8669
|
Parameters: [signedTransaction: viem.Hex];
|
|
8590
8670
|
ReturnType: viem.Hash;
|
|
8671
|
+
}, {
|
|
8672
|
+
Method: "eth_sendRawTransactionSync";
|
|
8673
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
8674
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
8591
8675
|
}, {
|
|
8592
8676
|
Method: "eth_simulateV1";
|
|
8593
8677
|
Parameters: [{
|
|
@@ -8643,6 +8727,7 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8643
8727
|
[x: `bytes4[${string}]`]: undefined;
|
|
8644
8728
|
[x: `bytes[${string}]`]: undefined;
|
|
8645
8729
|
[x: `bytes6[${string}]`]: undefined;
|
|
8730
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
8646
8731
|
[x: `bytes1[${string}]`]: undefined;
|
|
8647
8732
|
[x: `bytes2[${string}]`]: undefined;
|
|
8648
8733
|
[x: `bytes3[${string}]`]: undefined;
|
|
@@ -8650,7 +8735,6 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8650
8735
|
[x: `bytes7[${string}]`]: undefined;
|
|
8651
8736
|
[x: `bytes8[${string}]`]: undefined;
|
|
8652
8737
|
[x: `bytes9[${string}]`]: undefined;
|
|
8653
|
-
[x: `bytes10[${string}]`]: undefined;
|
|
8654
8738
|
[x: `bytes11[${string}]`]: undefined;
|
|
8655
8739
|
[x: `bytes12[${string}]`]: undefined;
|
|
8656
8740
|
[x: `bytes13[${string}]`]: undefined;
|
|
@@ -8745,6 +8829,7 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8745
8829
|
bytes4?: undefined;
|
|
8746
8830
|
bytes?: undefined;
|
|
8747
8831
|
bytes6?: undefined;
|
|
8832
|
+
bytes10?: undefined;
|
|
8748
8833
|
bytes1?: undefined;
|
|
8749
8834
|
bytes2?: undefined;
|
|
8750
8835
|
bytes3?: undefined;
|
|
@@ -8752,7 +8837,6 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8752
8837
|
bytes7?: undefined;
|
|
8753
8838
|
bytes8?: undefined;
|
|
8754
8839
|
bytes9?: undefined;
|
|
8755
|
-
bytes10?: undefined;
|
|
8756
8840
|
bytes11?: undefined;
|
|
8757
8841
|
bytes12?: undefined;
|
|
8758
8842
|
bytes13?: undefined;
|
|
@@ -8842,19 +8926,22 @@ declare class AcpContractClient extends BaseAcpContractClient {
|
|
|
8842
8926
|
getAddress: () => Address$1;
|
|
8843
8927
|
} & _aa_sdk_core.BundlerActions & viem.PublicActions>;
|
|
8844
8928
|
};
|
|
8929
|
+
get acpX402(): AcpX402;
|
|
8845
8930
|
private calculateGasFees;
|
|
8846
|
-
handleOperation(
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
txHash: string;
|
|
8850
|
-
jobId: number;
|
|
8851
|
-
}>;
|
|
8852
|
-
createPayableMemo(jobId: number, content: string, amountBaseUnit: bigint, recipient: Address$1, feeAmountBaseUnit: bigint, feeType: FeeType, nextPhase: AcpJobPhases, type: MemoType.PAYABLE_REQUEST | MemoType.PAYABLE_TRANSFER_ESCROW, expiredAt: Date, token?: Address$1, secured?: boolean): Promise<`0x${string}`>;
|
|
8853
|
-
createJobWithAccount(accountId: number, providerAddress: Address$1, evaluatorAddress: Address$1, budgetBaseUnit: bigint, paymentTokenAddress: Address$1, expiredAt: Date): Promise<{
|
|
8854
|
-
txHash: string;
|
|
8855
|
-
jobId: number;
|
|
8931
|
+
handleOperation(operations: OperationPayload[]): Promise<{
|
|
8932
|
+
userOpHash: Address$1;
|
|
8933
|
+
txnHash: Address$1;
|
|
8856
8934
|
}>;
|
|
8857
|
-
|
|
8935
|
+
getJobId(createJobUserOpHash: Address$1, clientAddress: Address$1, providerAddress: Address$1): Promise<number>;
|
|
8936
|
+
createJob(providerAddress: Address$1, evaluatorAddress: Address$1, expireAt: Date, paymentTokenAddress: Address$1, budgetBaseUnit: bigint, metadata: string, isX402Job?: boolean): OperationPayload;
|
|
8937
|
+
setBudgetWithPaymentToken(jobId: number, budgetBaseUnit: bigint, paymentTokenAddress?: Address$1): OperationPayload;
|
|
8938
|
+
createPayableMemo(jobId: number, content: string, amountBaseUnit: bigint, recipient: Address$1, feeAmountBaseUnit: bigint, feeType: FeeType, nextPhase: AcpJobPhases, type: MemoType.PAYABLE_REQUEST | MemoType.PAYABLE_TRANSFER_ESCROW, expiredAt: Date, token?: Address$1, secured?: boolean): OperationPayload;
|
|
8939
|
+
createJobWithAccount(accountId: number, evaluatorAddress: Address$1, budgetBaseUnit: bigint, paymentTokenAddress: Address$1, expiredAt: Date, isX402Job?: boolean): OperationPayload;
|
|
8940
|
+
updateAccountMetadata(accountId: number, metadata: string): OperationPayload;
|
|
8941
|
+
updateJobX402Nonce(jobId: number, nonce: string): Promise<OffChainJob>;
|
|
8942
|
+
generateX402Payment(payableRequest: X402PayableRequest, requirements: X402PayableRequirements): Promise<X402Payment>;
|
|
8943
|
+
performX402Request(url: string, version: string, budget?: string, signature?: string): Promise<X402PaymentResponse>;
|
|
8944
|
+
getAcpVersion(): string;
|
|
8858
8945
|
}
|
|
8859
8946
|
|
|
8860
8947
|
declare function preparePayload(payload: string | object): string;
|
|
@@ -8867,11 +8954,11 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
8867
8954
|
private jobManagerAddress;
|
|
8868
8955
|
private memoManagerAddress;
|
|
8869
8956
|
private accountManagerAddress;
|
|
8870
|
-
private MAX_RETRIES;
|
|
8871
8957
|
private PRIORITY_FEE_MULTIPLIER;
|
|
8872
8958
|
private MAX_FEE_PER_GAS;
|
|
8873
8959
|
private MAX_PRIORITY_FEE_PER_GAS;
|
|
8874
8960
|
private _sessionKeyClient;
|
|
8961
|
+
private _acpX402;
|
|
8875
8962
|
constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig);
|
|
8876
8963
|
static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig): Promise<AcpContractClientV2>;
|
|
8877
8964
|
init(privateKey: Address$1, sessionEntityKeyId: number): Promise<void>;
|
|
@@ -9090,6 +9177,10 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
9090
9177
|
Method: "eth_sendRawTransaction";
|
|
9091
9178
|
Parameters: [signedTransaction: viem.Hex];
|
|
9092
9179
|
ReturnType: viem.Hash;
|
|
9180
|
+
}, {
|
|
9181
|
+
Method: "eth_sendRawTransactionSync";
|
|
9182
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
9183
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
9093
9184
|
}, {
|
|
9094
9185
|
Method: "eth_simulateV1";
|
|
9095
9186
|
Parameters: [{
|
|
@@ -9148,6 +9239,7 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
9148
9239
|
[x: `bytes4[${string}]`]: undefined;
|
|
9149
9240
|
[x: `bytes[${string}]`]: undefined;
|
|
9150
9241
|
[x: `bytes6[${string}]`]: undefined;
|
|
9242
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
9151
9243
|
[x: `bytes1[${string}]`]: undefined;
|
|
9152
9244
|
[x: `bytes2[${string}]`]: undefined;
|
|
9153
9245
|
[x: `bytes3[${string}]`]: undefined;
|
|
@@ -9155,7 +9247,6 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
9155
9247
|
[x: `bytes7[${string}]`]: undefined;
|
|
9156
9248
|
[x: `bytes8[${string}]`]: undefined;
|
|
9157
9249
|
[x: `bytes9[${string}]`]: undefined;
|
|
9158
|
-
[x: `bytes10[${string}]`]: undefined;
|
|
9159
9250
|
[x: `bytes11[${string}]`]: undefined;
|
|
9160
9251
|
[x: `bytes12[${string}]`]: undefined;
|
|
9161
9252
|
[x: `bytes13[${string}]`]: undefined;
|
|
@@ -9250,6 +9341,7 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
9250
9341
|
bytes4?: undefined;
|
|
9251
9342
|
bytes?: undefined;
|
|
9252
9343
|
bytes6?: undefined;
|
|
9344
|
+
bytes10?: undefined;
|
|
9253
9345
|
bytes1?: undefined;
|
|
9254
9346
|
bytes2?: undefined;
|
|
9255
9347
|
bytes3?: undefined;
|
|
@@ -9257,7 +9349,6 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
9257
9349
|
bytes7?: undefined;
|
|
9258
9350
|
bytes8?: undefined;
|
|
9259
9351
|
bytes9?: undefined;
|
|
9260
|
-
bytes10?: undefined;
|
|
9261
9352
|
bytes11?: undefined;
|
|
9262
9353
|
bytes12?: undefined;
|
|
9263
9354
|
bytes13?: undefined;
|
|
@@ -16176,6 +16267,7 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16176
16267
|
}, (request["parameters"] extends readonly viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "gas" | "nonce" | "blobVersionedHashes" | "chainId" | "type") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly viem.PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "gas" | "nonce" | "blobVersionedHashes" | "chainId" | "type") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">))[K]; } : never>;
|
|
16177
16268
|
readContract: <const abi extends viem.Abi | readonly unknown[], functionName extends viem.ContractFunctionName<abi, "pure" | "view">, const args extends viem.ContractFunctionArgs<abi, "pure" | "view", functionName>>(args: viem.ReadContractParameters<abi, functionName, args>) => Promise<viem.ReadContractReturnType<abi, functionName, args>>;
|
|
16178
16269
|
sendRawTransaction: (args: viem.SendRawTransactionParameters) => Promise<viem.SendRawTransactionReturnType>;
|
|
16270
|
+
sendRawTransactionSync: (args: viem.SendRawTransactionSyncParameters) => Promise<viem.TransactionReceipt>;
|
|
16179
16271
|
simulate: <const calls extends readonly unknown[]>(args: viem.SimulateBlocksParameters<calls>) => Promise<viem.SimulateBlocksReturnType<calls>>;
|
|
16180
16272
|
simulateBlocks: <const calls extends readonly unknown[]>(args: viem.SimulateBlocksParameters<calls>) => Promise<viem.SimulateBlocksReturnType<calls>>;
|
|
16181
16273
|
simulateCalls: <const calls extends readonly unknown[]>(args: viem.SimulateCallsParameters<calls>) => Promise<viem.SimulateCallsReturnType<calls>>;
|
|
@@ -16405,6 +16497,10 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16405
16497
|
Method: "eth_sendRawTransaction";
|
|
16406
16498
|
Parameters: [signedTransaction: viem.Hex];
|
|
16407
16499
|
ReturnType: viem.Hash;
|
|
16500
|
+
}, {
|
|
16501
|
+
Method: "eth_sendRawTransactionSync";
|
|
16502
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
16503
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
16408
16504
|
}, {
|
|
16409
16505
|
Method: "eth_simulateV1";
|
|
16410
16506
|
Parameters: [{
|
|
@@ -16460,6 +16556,7 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16460
16556
|
[x: `bytes4[${string}]`]: undefined;
|
|
16461
16557
|
[x: `bytes[${string}]`]: undefined;
|
|
16462
16558
|
[x: `bytes6[${string}]`]: undefined;
|
|
16559
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
16463
16560
|
[x: `bytes1[${string}]`]: undefined;
|
|
16464
16561
|
[x: `bytes2[${string}]`]: undefined;
|
|
16465
16562
|
[x: `bytes3[${string}]`]: undefined;
|
|
@@ -16467,7 +16564,6 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16467
16564
|
[x: `bytes7[${string}]`]: undefined;
|
|
16468
16565
|
[x: `bytes8[${string}]`]: undefined;
|
|
16469
16566
|
[x: `bytes9[${string}]`]: undefined;
|
|
16470
|
-
[x: `bytes10[${string}]`]: undefined;
|
|
16471
16567
|
[x: `bytes11[${string}]`]: undefined;
|
|
16472
16568
|
[x: `bytes12[${string}]`]: undefined;
|
|
16473
16569
|
[x: `bytes13[${string}]`]: undefined;
|
|
@@ -16562,6 +16658,7 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16562
16658
|
bytes4?: undefined;
|
|
16563
16659
|
bytes?: undefined;
|
|
16564
16660
|
bytes6?: undefined;
|
|
16661
|
+
bytes10?: undefined;
|
|
16565
16662
|
bytes1?: undefined;
|
|
16566
16663
|
bytes2?: undefined;
|
|
16567
16664
|
bytes3?: undefined;
|
|
@@ -16569,7 +16666,6 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16569
16666
|
bytes7?: undefined;
|
|
16570
16667
|
bytes8?: undefined;
|
|
16571
16668
|
bytes9?: undefined;
|
|
16572
|
-
bytes10?: undefined;
|
|
16573
16669
|
bytes11?: undefined;
|
|
16574
16670
|
bytes12?: undefined;
|
|
16575
16671
|
bytes13?: undefined;
|
|
@@ -16856,6 +16952,10 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16856
16952
|
Method: "eth_sendRawTransaction";
|
|
16857
16953
|
Parameters: [signedTransaction: viem.Hex];
|
|
16858
16954
|
ReturnType: viem.Hash;
|
|
16955
|
+
}, {
|
|
16956
|
+
Method: "eth_sendRawTransactionSync";
|
|
16957
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
16958
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
16859
16959
|
}, {
|
|
16860
16960
|
Method: "eth_simulateV1";
|
|
16861
16961
|
Parameters: [{
|
|
@@ -16911,6 +17011,7 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16911
17011
|
[x: `bytes4[${string}]`]: undefined;
|
|
16912
17012
|
[x: `bytes[${string}]`]: undefined;
|
|
16913
17013
|
[x: `bytes6[${string}]`]: undefined;
|
|
17014
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
16914
17015
|
[x: `bytes1[${string}]`]: undefined;
|
|
16915
17016
|
[x: `bytes2[${string}]`]: undefined;
|
|
16916
17017
|
[x: `bytes3[${string}]`]: undefined;
|
|
@@ -16918,7 +17019,6 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
16918
17019
|
[x: `bytes7[${string}]`]: undefined;
|
|
16919
17020
|
[x: `bytes8[${string}]`]: undefined;
|
|
16920
17021
|
[x: `bytes9[${string}]`]: undefined;
|
|
16921
|
-
[x: `bytes10[${string}]`]: undefined;
|
|
16922
17022
|
[x: `bytes11[${string}]`]: undefined;
|
|
16923
17023
|
[x: `bytes12[${string}]`]: undefined;
|
|
16924
17024
|
[x: `bytes13[${string}]`]: undefined;
|
|
@@ -17013,6 +17113,7 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
17013
17113
|
bytes4?: undefined;
|
|
17014
17114
|
bytes?: undefined;
|
|
17015
17115
|
bytes6?: undefined;
|
|
17116
|
+
bytes10?: undefined;
|
|
17016
17117
|
bytes1?: undefined;
|
|
17017
17118
|
bytes2?: undefined;
|
|
17018
17119
|
bytes3?: undefined;
|
|
@@ -17020,7 +17121,6 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
17020
17121
|
bytes7?: undefined;
|
|
17021
17122
|
bytes8?: undefined;
|
|
17022
17123
|
bytes9?: undefined;
|
|
17023
|
-
bytes10?: undefined;
|
|
17024
17124
|
bytes11?: undefined;
|
|
17025
17125
|
bytes12?: undefined;
|
|
17026
17126
|
bytes13?: undefined;
|
|
@@ -17110,9 +17210,18 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
17110
17210
|
getAddress: () => Address$1;
|
|
17111
17211
|
} & _aa_sdk_core.BundlerActions & viem.PublicActions>;
|
|
17112
17212
|
};
|
|
17213
|
+
get acpX402(): AcpX402;
|
|
17113
17214
|
private calculateGasFees;
|
|
17114
|
-
handleOperation(
|
|
17115
|
-
|
|
17215
|
+
handleOperation(operations: OperationPayload[]): Promise<{
|
|
17216
|
+
userOpHash: Address$1;
|
|
17217
|
+
txnHash: Address$1;
|
|
17218
|
+
}>;
|
|
17219
|
+
getJobId(createJobUserOpHash: Address$1, clientAddress: Address$1, providerAddress: Address$1): Promise<number>;
|
|
17220
|
+
updateJobX402Nonce(jobId: number, nonce: string): Promise<OffChainJob>;
|
|
17221
|
+
generateX402Payment(payableRequest: X402PayableRequest, requirements: X402PayableRequirements): Promise<X402Payment>;
|
|
17222
|
+
performX402Request(url: string, version: string, budget?: string, signature?: string): Promise<X402PaymentResponse>;
|
|
17223
|
+
getX402PaymentDetails(jobId: number): Promise<IAcpJobX402PaymentDetails>;
|
|
17224
|
+
getAcpVersion(): string;
|
|
17116
17225
|
}
|
|
17117
17226
|
|
|
17118
|
-
export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractClientV2, AcpContractConfig, AcpError, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, BaseAcpContractClient, type ClosePositionPayload, type DeliverablePayload, Fare, FareAmount, FareBigInt, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, PositionDirection, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseAcpConfigV2, baseSepoliaAcpConfig, baseSepoliaAcpConfigV2, AcpClient as default, ethFare, preparePayload, wethFare };
|
|
17227
|
+
export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractClientV2, AcpContractConfig, AcpError, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, BaseAcpContractClient, type ClosePositionPayload, type DeliverablePayload, Fare, FareAmount, FareBigInt, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, PositionDirection, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseAcpConfigV2, baseAcpX402Config, baseAcpX402ConfigV2, baseSepoliaAcpConfig, baseSepoliaAcpConfigV2, AcpClient as default, ethFare, preparePayload, wethFare };
|