@virtuals-protocol/acp-node 0.2.0-beta-fund.4 → 0.2.0-beta.10

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 CHANGED
@@ -98,12 +98,23 @@ declare class Fare {
98
98
  constructor(contractAddress: Address, decimals: number);
99
99
  formatAmount(amount: number): bigint;
100
100
  }
101
- declare class FareAmount {
102
- amount: number;
101
+ interface IFareAmount {
102
+ amount: bigint;
103
+ fare: Fare;
104
+ add(other: IFareAmount): IFareAmount;
105
+ }
106
+ declare class FareAmount implements IFareAmount {
107
+ amount: bigint;
103
108
  fare: Fare;
104
- constructor(amount: number, fare: Fare);
105
- format(): bigint;
106
- add(other: FareAmount): FareAmount;
109
+ constructor(fareAmount: number, fare: Fare);
110
+ truncateTo6Decimals(input: string): number;
111
+ add(other: IFareAmount): FareAmount;
112
+ }
113
+ declare class FareBigInt implements IFareAmount {
114
+ amount: bigint;
115
+ fare: Fare;
116
+ constructor(amount: bigint, fare: Fare);
117
+ add(other: IFareAmount): IFareAmount;
107
118
  }
108
119
  declare const wethFare: Fare;
109
120
  declare const ethFare: Fare;
@@ -430,9 +441,9 @@ declare class AcpContractClient {
430
441
  [x: `bool[${string}]`]: undefined;
431
442
  [x: `bytes4[${string}]`]: undefined;
432
443
  [x: `bytes[${string}]`]: undefined;
433
- [x: `bytes18[${string}]`]: undefined;
434
- [x: `bytes6[${string}]`]: undefined;
435
444
  [x: `bytes1[${string}]`]: undefined;
445
+ [x: `bytes6[${string}]`]: undefined;
446
+ [x: `bytes18[${string}]`]: undefined;
436
447
  [x: `bytes2[${string}]`]: undefined;
437
448
  [x: `bytes3[${string}]`]: undefined;
438
449
  [x: `bytes5[${string}]`]: undefined;
@@ -532,9 +543,9 @@ declare class AcpContractClient {
532
543
  bool?: undefined;
533
544
  bytes4?: undefined;
534
545
  bytes?: undefined;
535
- bytes18?: undefined;
536
- bytes6?: undefined;
537
546
  bytes1?: undefined;
547
+ bytes6?: undefined;
548
+ bytes18?: undefined;
538
549
  bytes2?: undefined;
539
550
  bytes3?: undefined;
540
551
  bytes5?: undefined;
@@ -7740,9 +7751,9 @@ declare class AcpContractClient {
7740
7751
  [x: `bool[${string}]`]: undefined;
7741
7752
  [x: `bytes4[${string}]`]: undefined;
7742
7753
  [x: `bytes[${string}]`]: undefined;
7743
- [x: `bytes18[${string}]`]: undefined;
7744
- [x: `bytes6[${string}]`]: undefined;
7745
7754
  [x: `bytes1[${string}]`]: undefined;
7755
+ [x: `bytes6[${string}]`]: undefined;
7756
+ [x: `bytes18[${string}]`]: undefined;
7746
7757
  [x: `bytes2[${string}]`]: undefined;
7747
7758
  [x: `bytes3[${string}]`]: undefined;
7748
7759
  [x: `bytes5[${string}]`]: undefined;
@@ -7842,9 +7853,9 @@ declare class AcpContractClient {
7842
7853
  bool?: undefined;
7843
7854
  bytes4?: undefined;
7844
7855
  bytes?: undefined;
7845
- bytes18?: undefined;
7846
- bytes6?: undefined;
7847
7856
  bytes1?: undefined;
7857
+ bytes6?: undefined;
7858
+ bytes18?: undefined;
7848
7859
  bytes2?: undefined;
7849
7860
  bytes3?: undefined;
7850
7861
  bytes5?: undefined;
@@ -8191,9 +8202,9 @@ declare class AcpContractClient {
8191
8202
  [x: `bool[${string}]`]: undefined;
8192
8203
  [x: `bytes4[${string}]`]: undefined;
8193
8204
  [x: `bytes[${string}]`]: undefined;
8194
- [x: `bytes18[${string}]`]: undefined;
8195
- [x: `bytes6[${string}]`]: undefined;
8196
8205
  [x: `bytes1[${string}]`]: undefined;
8206
+ [x: `bytes6[${string}]`]: undefined;
8207
+ [x: `bytes18[${string}]`]: undefined;
8197
8208
  [x: `bytes2[${string}]`]: undefined;
8198
8209
  [x: `bytes3[${string}]`]: undefined;
8199
8210
  [x: `bytes5[${string}]`]: undefined;
@@ -8293,9 +8304,9 @@ declare class AcpContractClient {
8293
8304
  bool?: undefined;
8294
8305
  bytes4?: undefined;
8295
8306
  bytes?: undefined;
8296
- bytes18?: undefined;
8297
- bytes6?: undefined;
8298
8307
  bytes1?: undefined;
8308
+ bytes6?: undefined;
8309
+ bytes18?: undefined;
8299
8310
  bytes2?: undefined;
8300
8311
  bytes3?: undefined;
8301
8312
  bytes5?: undefined;
@@ -8513,11 +8524,16 @@ type FundResponsePayload = {
8513
8524
  reportingApiEndpoint: string;
8514
8525
  walletAddress?: Address;
8515
8526
  };
8527
+ declare enum PositionDirection {
8528
+ LONG = "long",
8529
+ SHORT = "short"
8530
+ }
8516
8531
  type OpenPositionPayload = {
8517
8532
  symbol: string;
8518
8533
  amount: number;
8519
8534
  chain?: string;
8520
8535
  contractAddress?: string;
8536
+ direction?: PositionDirection;
8521
8537
  tp: {
8522
8538
  price?: number;
8523
8539
  percentage?: number;
@@ -8590,7 +8606,7 @@ declare class AcpJob {
8590
8606
  walletAddress?: Address): Promise<`0x${string}`>;
8591
8607
  swapToken(payload: SwapTokenPayload, decimals: number, feeAmount: number, walletAddress?: Address): Promise<`0x${string}`>;
8592
8608
  responseSwapToken(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
8593
- transferFunds<T>(payload: GenericPayload<T>, fareAmount: FareAmount, walletAddress?: Address, expiredAt?: Date): Promise<`0x${string}`>;
8609
+ transferFunds<T>(payload: GenericPayload<T>, fareAmount: IFareAmount, walletAddress?: Address, expiredAt?: Date): Promise<`0x${string}`>;
8594
8610
  responseOpenPosition(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
8595
8611
  closePartialPosition(payload: ClosePositionPayload, expireAt?: Date): Promise<`0x${string}`>;
8596
8612
  responseClosePartialPosition(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
@@ -8647,12 +8663,12 @@ declare class AcpClient {
8647
8663
  isOnline: boolean;
8648
8664
  } | undefined;
8649
8665
  }[]>;
8650
- initiateJob(providerAddress: Address, serviceRequirement: Object | string, fareAmount: FareAmount, evaluatorAddress?: Address, expiredAt?: Date): Promise<number>;
8666
+ initiateJob(providerAddress: Address, serviceRequirement: Object | string, fareAmount: IFareAmount, evaluatorAddress?: Address, expiredAt?: Date): Promise<number>;
8651
8667
  respondJob(jobId: number, memoId: number, accept: boolean, content?: string, reason?: string): Promise<`0x${string}` | undefined>;
8652
8668
  payJob(jobId: number, amountBaseUnit: bigint, memoId: number, reason?: string): Promise<`0x${string}`>;
8653
- requestFunds<T>(jobId: number, transferFareAmount: FareAmount, recipient: Address, feeFareAmount: FareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8669
+ requestFunds<T>(jobId: number, transferFareAmount: IFareAmount, recipient: Address, feeFareAmount: IFareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8654
8670
  responseFundsRequest(memoId: number, accept: boolean, amountBaseUnit: bigint, reason?: string): Promise<`0x${string}`>;
8655
- transferFunds<T>(jobId: number, transferFareAmount: FareAmount, recipient: Address, feeFareAmount: FareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8671
+ transferFunds<T>(jobId: number, transferFareAmount: IFareAmount, recipient: Address, feeFareAmount: IFareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8656
8672
  sendMessage<T>(jobId: number, message: GenericPayload<T>, nextPhase: AcpJobPhases): Promise<`0x${string}`>;
8657
8673
  responseFundsTransfer(memoId: number, accept: boolean, reason?: string): Promise<`0x${string}`>;
8658
8674
  deliverJob(jobId: number, deliverable: IDeliverable): Promise<`0x${string}`>;
@@ -8664,4 +8680,8 @@ declare class AcpClient {
8664
8680
  getAgent(walletAddress: Address): Promise<AcpAgent | undefined>;
8665
8681
  }
8666
8682
 
8667
- export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default, ethFare, wethFare };
8683
+ declare class AcpError extends Error {
8684
+ constructor(message: string, originalError?: unknown);
8685
+ }
8686
+
8687
+ export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpError, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, FareBigInt, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, PositionDirection, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default, ethFare, wethFare };
package/dist/index.d.ts CHANGED
@@ -98,12 +98,23 @@ declare class Fare {
98
98
  constructor(contractAddress: Address, decimals: number);
99
99
  formatAmount(amount: number): bigint;
100
100
  }
101
- declare class FareAmount {
102
- amount: number;
101
+ interface IFareAmount {
102
+ amount: bigint;
103
+ fare: Fare;
104
+ add(other: IFareAmount): IFareAmount;
105
+ }
106
+ declare class FareAmount implements IFareAmount {
107
+ amount: bigint;
103
108
  fare: Fare;
104
- constructor(amount: number, fare: Fare);
105
- format(): bigint;
106
- add(other: FareAmount): FareAmount;
109
+ constructor(fareAmount: number, fare: Fare);
110
+ truncateTo6Decimals(input: string): number;
111
+ add(other: IFareAmount): FareAmount;
112
+ }
113
+ declare class FareBigInt implements IFareAmount {
114
+ amount: bigint;
115
+ fare: Fare;
116
+ constructor(amount: bigint, fare: Fare);
117
+ add(other: IFareAmount): IFareAmount;
107
118
  }
108
119
  declare const wethFare: Fare;
109
120
  declare const ethFare: Fare;
@@ -430,9 +441,9 @@ declare class AcpContractClient {
430
441
  [x: `bool[${string}]`]: undefined;
431
442
  [x: `bytes4[${string}]`]: undefined;
432
443
  [x: `bytes[${string}]`]: undefined;
433
- [x: `bytes18[${string}]`]: undefined;
434
- [x: `bytes6[${string}]`]: undefined;
435
444
  [x: `bytes1[${string}]`]: undefined;
445
+ [x: `bytes6[${string}]`]: undefined;
446
+ [x: `bytes18[${string}]`]: undefined;
436
447
  [x: `bytes2[${string}]`]: undefined;
437
448
  [x: `bytes3[${string}]`]: undefined;
438
449
  [x: `bytes5[${string}]`]: undefined;
@@ -532,9 +543,9 @@ declare class AcpContractClient {
532
543
  bool?: undefined;
533
544
  bytes4?: undefined;
534
545
  bytes?: undefined;
535
- bytes18?: undefined;
536
- bytes6?: undefined;
537
546
  bytes1?: undefined;
547
+ bytes6?: undefined;
548
+ bytes18?: undefined;
538
549
  bytes2?: undefined;
539
550
  bytes3?: undefined;
540
551
  bytes5?: undefined;
@@ -7740,9 +7751,9 @@ declare class AcpContractClient {
7740
7751
  [x: `bool[${string}]`]: undefined;
7741
7752
  [x: `bytes4[${string}]`]: undefined;
7742
7753
  [x: `bytes[${string}]`]: undefined;
7743
- [x: `bytes18[${string}]`]: undefined;
7744
- [x: `bytes6[${string}]`]: undefined;
7745
7754
  [x: `bytes1[${string}]`]: undefined;
7755
+ [x: `bytes6[${string}]`]: undefined;
7756
+ [x: `bytes18[${string}]`]: undefined;
7746
7757
  [x: `bytes2[${string}]`]: undefined;
7747
7758
  [x: `bytes3[${string}]`]: undefined;
7748
7759
  [x: `bytes5[${string}]`]: undefined;
@@ -7842,9 +7853,9 @@ declare class AcpContractClient {
7842
7853
  bool?: undefined;
7843
7854
  bytes4?: undefined;
7844
7855
  bytes?: undefined;
7845
- bytes18?: undefined;
7846
- bytes6?: undefined;
7847
7856
  bytes1?: undefined;
7857
+ bytes6?: undefined;
7858
+ bytes18?: undefined;
7848
7859
  bytes2?: undefined;
7849
7860
  bytes3?: undefined;
7850
7861
  bytes5?: undefined;
@@ -8191,9 +8202,9 @@ declare class AcpContractClient {
8191
8202
  [x: `bool[${string}]`]: undefined;
8192
8203
  [x: `bytes4[${string}]`]: undefined;
8193
8204
  [x: `bytes[${string}]`]: undefined;
8194
- [x: `bytes18[${string}]`]: undefined;
8195
- [x: `bytes6[${string}]`]: undefined;
8196
8205
  [x: `bytes1[${string}]`]: undefined;
8206
+ [x: `bytes6[${string}]`]: undefined;
8207
+ [x: `bytes18[${string}]`]: undefined;
8197
8208
  [x: `bytes2[${string}]`]: undefined;
8198
8209
  [x: `bytes3[${string}]`]: undefined;
8199
8210
  [x: `bytes5[${string}]`]: undefined;
@@ -8293,9 +8304,9 @@ declare class AcpContractClient {
8293
8304
  bool?: undefined;
8294
8305
  bytes4?: undefined;
8295
8306
  bytes?: undefined;
8296
- bytes18?: undefined;
8297
- bytes6?: undefined;
8298
8307
  bytes1?: undefined;
8308
+ bytes6?: undefined;
8309
+ bytes18?: undefined;
8299
8310
  bytes2?: undefined;
8300
8311
  bytes3?: undefined;
8301
8312
  bytes5?: undefined;
@@ -8513,11 +8524,16 @@ type FundResponsePayload = {
8513
8524
  reportingApiEndpoint: string;
8514
8525
  walletAddress?: Address;
8515
8526
  };
8527
+ declare enum PositionDirection {
8528
+ LONG = "long",
8529
+ SHORT = "short"
8530
+ }
8516
8531
  type OpenPositionPayload = {
8517
8532
  symbol: string;
8518
8533
  amount: number;
8519
8534
  chain?: string;
8520
8535
  contractAddress?: string;
8536
+ direction?: PositionDirection;
8521
8537
  tp: {
8522
8538
  price?: number;
8523
8539
  percentage?: number;
@@ -8590,7 +8606,7 @@ declare class AcpJob {
8590
8606
  walletAddress?: Address): Promise<`0x${string}`>;
8591
8607
  swapToken(payload: SwapTokenPayload, decimals: number, feeAmount: number, walletAddress?: Address): Promise<`0x${string}`>;
8592
8608
  responseSwapToken(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
8593
- transferFunds<T>(payload: GenericPayload<T>, fareAmount: FareAmount, walletAddress?: Address, expiredAt?: Date): Promise<`0x${string}`>;
8609
+ transferFunds<T>(payload: GenericPayload<T>, fareAmount: IFareAmount, walletAddress?: Address, expiredAt?: Date): Promise<`0x${string}`>;
8594
8610
  responseOpenPosition(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
8595
8611
  closePartialPosition(payload: ClosePositionPayload, expireAt?: Date): Promise<`0x${string}`>;
8596
8612
  responseClosePartialPosition(memoId: number, accept: boolean, reason: string): Promise<`0x${string}`>;
@@ -8647,12 +8663,12 @@ declare class AcpClient {
8647
8663
  isOnline: boolean;
8648
8664
  } | undefined;
8649
8665
  }[]>;
8650
- initiateJob(providerAddress: Address, serviceRequirement: Object | string, fareAmount: FareAmount, evaluatorAddress?: Address, expiredAt?: Date): Promise<number>;
8666
+ initiateJob(providerAddress: Address, serviceRequirement: Object | string, fareAmount: IFareAmount, evaluatorAddress?: Address, expiredAt?: Date): Promise<number>;
8651
8667
  respondJob(jobId: number, memoId: number, accept: boolean, content?: string, reason?: string): Promise<`0x${string}` | undefined>;
8652
8668
  payJob(jobId: number, amountBaseUnit: bigint, memoId: number, reason?: string): Promise<`0x${string}`>;
8653
- requestFunds<T>(jobId: number, transferFareAmount: FareAmount, recipient: Address, feeFareAmount: FareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8669
+ requestFunds<T>(jobId: number, transferFareAmount: IFareAmount, recipient: Address, feeFareAmount: IFareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8654
8670
  responseFundsRequest(memoId: number, accept: boolean, amountBaseUnit: bigint, reason?: string): Promise<`0x${string}`>;
8655
- transferFunds<T>(jobId: number, transferFareAmount: FareAmount, recipient: Address, feeFareAmount: FareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8671
+ transferFunds<T>(jobId: number, transferFareAmount: IFareAmount, recipient: Address, feeFareAmount: IFareAmount, feeType: FeeType, reason: GenericPayload<T>, nextPhase: AcpJobPhases, expiredAt: Date): Promise<`0x${string}`>;
8656
8672
  sendMessage<T>(jobId: number, message: GenericPayload<T>, nextPhase: AcpJobPhases): Promise<`0x${string}`>;
8657
8673
  responseFundsTransfer(memoId: number, accept: boolean, reason?: string): Promise<`0x${string}`>;
8658
8674
  deliverJob(jobId: number, deliverable: IDeliverable): Promise<`0x${string}`>;
@@ -8664,4 +8680,8 @@ declare class AcpClient {
8664
8680
  getAgent(walletAddress: Address): Promise<AcpAgent | undefined>;
8665
8681
  }
8666
8682
 
8667
- export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default, ethFare, wethFare };
8683
+ declare class AcpError extends Error {
8684
+ constructor(message: string, originalError?: unknown);
8685
+ }
8686
+
8687
+ export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpError, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, FareBigInt, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, PositionDirection, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default, ethFare, wethFare };