@virtuals-protocol/acp-node 0.3.0-beta.31 → 0.3.0-beta.33
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +25 -3
- package/dist/index.mjs +25 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -281,13 +281,13 @@ declare class AcpJob {
|
|
|
281
281
|
phase: AcpJobPhases;
|
|
282
282
|
context: Record<string, any>;
|
|
283
283
|
contractAddress: Address;
|
|
284
|
-
|
|
284
|
+
private _deliverable;
|
|
285
285
|
netPayableAmount?: number | undefined;
|
|
286
286
|
name: string | undefined;
|
|
287
287
|
requirement: Record<string, any> | string | undefined;
|
|
288
288
|
priceType: PriceType;
|
|
289
289
|
priceValue: number;
|
|
290
|
-
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,
|
|
290
|
+
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, _deliverable: DeliverablePayload | null, netPayableAmount?: number | undefined);
|
|
291
291
|
get acpContractClient(): BaseAcpContractClient;
|
|
292
292
|
get config(): AcpContractConfig;
|
|
293
293
|
get baseFare(): Fare;
|
|
@@ -297,6 +297,7 @@ declare class AcpJob {
|
|
|
297
297
|
get evaluatorAgent(): Promise<AcpAgent | null>;
|
|
298
298
|
get account(): Promise<AcpAccount | null>;
|
|
299
299
|
get latestMemo(): AcpMemo | undefined;
|
|
300
|
+
getDeliverable(): Promise<DeliverablePayload | null>;
|
|
300
301
|
createRequirement(content: string): Promise<{
|
|
301
302
|
userOpHash: Address;
|
|
302
303
|
txnHash: Address;
|
|
@@ -649,6 +650,7 @@ declare class AcpClient {
|
|
|
649
650
|
getAccountByJobId(jobId: number, acpContractClient?: BaseAcpContractClient): Promise<AcpAccount | null>;
|
|
650
651
|
getByClientAndProvider(clientAddress: Address, providerAddress: Address, acpContractClient?: BaseAcpContractClient): Promise<AcpAccount | null>;
|
|
651
652
|
createMemoContent(jobId: number, content: string): Promise<IAcpMemoContent>;
|
|
653
|
+
getMemoContent(url: string): Promise<string>;
|
|
652
654
|
getTokenBalances(): Promise<{
|
|
653
655
|
tokens: Record<string, any>;
|
|
654
656
|
} | undefined>;
|
package/dist/index.d.ts
CHANGED
|
@@ -281,13 +281,13 @@ declare class AcpJob {
|
|
|
281
281
|
phase: AcpJobPhases;
|
|
282
282
|
context: Record<string, any>;
|
|
283
283
|
contractAddress: Address;
|
|
284
|
-
|
|
284
|
+
private _deliverable;
|
|
285
285
|
netPayableAmount?: number | undefined;
|
|
286
286
|
name: string | undefined;
|
|
287
287
|
requirement: Record<string, any> | string | undefined;
|
|
288
288
|
priceType: PriceType;
|
|
289
289
|
priceValue: number;
|
|
290
|
-
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,
|
|
290
|
+
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, _deliverable: DeliverablePayload | null, netPayableAmount?: number | undefined);
|
|
291
291
|
get acpContractClient(): BaseAcpContractClient;
|
|
292
292
|
get config(): AcpContractConfig;
|
|
293
293
|
get baseFare(): Fare;
|
|
@@ -297,6 +297,7 @@ declare class AcpJob {
|
|
|
297
297
|
get evaluatorAgent(): Promise<AcpAgent | null>;
|
|
298
298
|
get account(): Promise<AcpAccount | null>;
|
|
299
299
|
get latestMemo(): AcpMemo | undefined;
|
|
300
|
+
getDeliverable(): Promise<DeliverablePayload | null>;
|
|
300
301
|
createRequirement(content: string): Promise<{
|
|
301
302
|
userOpHash: Address;
|
|
302
303
|
txnHash: Address;
|
|
@@ -649,6 +650,7 @@ declare class AcpClient {
|
|
|
649
650
|
getAccountByJobId(jobId: number, acpContractClient?: BaseAcpContractClient): Promise<AcpAccount | null>;
|
|
650
651
|
getByClientAndProvider(clientAddress: Address, providerAddress: Address, acpContractClient?: BaseAcpContractClient): Promise<AcpAccount | null>;
|
|
651
652
|
createMemoContent(jobId: number, content: string): Promise<IAcpMemoContent>;
|
|
653
|
+
getMemoContent(url: string): Promise<string>;
|
|
652
654
|
getTokenBalances(): Promise<{
|
|
653
655
|
tokens: Record<string, any>;
|
|
654
656
|
} | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@virtuals-protocol/acp-node",
|
|
38
|
-
version: "0.3.0-beta.
|
|
38
|
+
version: "0.3.0-beta.33",
|
|
39
39
|
main: "./dist/index.js",
|
|
40
40
|
module: "./dist/index.mjs",
|
|
41
41
|
types: "./dist/index.d.ts",
|
|
@@ -4225,7 +4225,7 @@ var acpJobOffering_default = AcpJobOffering;
|
|
|
4225
4225
|
// src/acpJob.ts
|
|
4226
4226
|
var util = __toESM(require("util"));
|
|
4227
4227
|
var AcpJob = class {
|
|
4228
|
-
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context, contractAddress,
|
|
4228
|
+
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context, contractAddress, _deliverable, netPayableAmount) {
|
|
4229
4229
|
this.acpClient = acpClient;
|
|
4230
4230
|
this.id = id;
|
|
4231
4231
|
this.clientAddress = clientAddress;
|
|
@@ -4237,7 +4237,7 @@ var AcpJob = class {
|
|
|
4237
4237
|
this.phase = phase;
|
|
4238
4238
|
this.context = context;
|
|
4239
4239
|
this.contractAddress = contractAddress;
|
|
4240
|
-
this.
|
|
4240
|
+
this._deliverable = _deliverable;
|
|
4241
4241
|
this.netPayableAmount = netPayableAmount;
|
|
4242
4242
|
this.priceType = "fixed" /* FIXED */;
|
|
4243
4243
|
this.priceValue = 0;
|
|
@@ -4297,6 +4297,21 @@ var AcpJob = class {
|
|
|
4297
4297
|
get latestMemo() {
|
|
4298
4298
|
return this.memos[this.memos.length - 1];
|
|
4299
4299
|
}
|
|
4300
|
+
async getDeliverable() {
|
|
4301
|
+
if (!this._deliverable) {
|
|
4302
|
+
return null;
|
|
4303
|
+
}
|
|
4304
|
+
if (typeof this._deliverable !== "string") {
|
|
4305
|
+
return this._deliverable;
|
|
4306
|
+
}
|
|
4307
|
+
const regex = /api\/memo-contents\/([0-9]+)$/;
|
|
4308
|
+
const result = this._deliverable?.match(regex);
|
|
4309
|
+
if (!result) {
|
|
4310
|
+
return this._deliverable;
|
|
4311
|
+
}
|
|
4312
|
+
const deliverable = await this.acpClient.getMemoContent(this._deliverable);
|
|
4313
|
+
return tryParseJson(deliverable) || deliverable;
|
|
4314
|
+
}
|
|
4300
4315
|
async createRequirement(content) {
|
|
4301
4316
|
const operations = [];
|
|
4302
4317
|
operations.push(
|
|
@@ -5367,6 +5382,13 @@ var AcpClient = class {
|
|
|
5367
5382
|
}
|
|
5368
5383
|
return response;
|
|
5369
5384
|
}
|
|
5385
|
+
async getMemoContent(url) {
|
|
5386
|
+
const response = await this._fetch(url);
|
|
5387
|
+
if (!response) {
|
|
5388
|
+
throw new acpError_default("Failed to get memo content");
|
|
5389
|
+
}
|
|
5390
|
+
return response.content;
|
|
5391
|
+
}
|
|
5370
5392
|
async getTokenBalances() {
|
|
5371
5393
|
const response = await this._fetch(
|
|
5372
5394
|
`/chains/token-balances`,
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@virtuals-protocol/acp-node",
|
|
11
|
-
version: "0.3.0-beta.
|
|
11
|
+
version: "0.3.0-beta.33",
|
|
12
12
|
main: "./dist/index.js",
|
|
13
13
|
module: "./dist/index.mjs",
|
|
14
14
|
types: "./dist/index.d.ts",
|
|
@@ -4202,7 +4202,7 @@ var acpJobOffering_default = AcpJobOffering;
|
|
|
4202
4202
|
// src/acpJob.ts
|
|
4203
4203
|
import * as util from "util";
|
|
4204
4204
|
var AcpJob = class {
|
|
4205
|
-
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context, contractAddress,
|
|
4205
|
+
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context, contractAddress, _deliverable, netPayableAmount) {
|
|
4206
4206
|
this.acpClient = acpClient;
|
|
4207
4207
|
this.id = id;
|
|
4208
4208
|
this.clientAddress = clientAddress;
|
|
@@ -4214,7 +4214,7 @@ var AcpJob = class {
|
|
|
4214
4214
|
this.phase = phase;
|
|
4215
4215
|
this.context = context;
|
|
4216
4216
|
this.contractAddress = contractAddress;
|
|
4217
|
-
this.
|
|
4217
|
+
this._deliverable = _deliverable;
|
|
4218
4218
|
this.netPayableAmount = netPayableAmount;
|
|
4219
4219
|
this.priceType = "fixed" /* FIXED */;
|
|
4220
4220
|
this.priceValue = 0;
|
|
@@ -4274,6 +4274,21 @@ var AcpJob = class {
|
|
|
4274
4274
|
get latestMemo() {
|
|
4275
4275
|
return this.memos[this.memos.length - 1];
|
|
4276
4276
|
}
|
|
4277
|
+
async getDeliverable() {
|
|
4278
|
+
if (!this._deliverable) {
|
|
4279
|
+
return null;
|
|
4280
|
+
}
|
|
4281
|
+
if (typeof this._deliverable !== "string") {
|
|
4282
|
+
return this._deliverable;
|
|
4283
|
+
}
|
|
4284
|
+
const regex = /api\/memo-contents\/([0-9]+)$/;
|
|
4285
|
+
const result = this._deliverable?.match(regex);
|
|
4286
|
+
if (!result) {
|
|
4287
|
+
return this._deliverable;
|
|
4288
|
+
}
|
|
4289
|
+
const deliverable = await this.acpClient.getMemoContent(this._deliverable);
|
|
4290
|
+
return tryParseJson(deliverable) || deliverable;
|
|
4291
|
+
}
|
|
4277
4292
|
async createRequirement(content) {
|
|
4278
4293
|
const operations = [];
|
|
4279
4294
|
operations.push(
|
|
@@ -5344,6 +5359,13 @@ var AcpClient = class {
|
|
|
5344
5359
|
}
|
|
5345
5360
|
return response;
|
|
5346
5361
|
}
|
|
5362
|
+
async getMemoContent(url) {
|
|
5363
|
+
const response = await this._fetch(url);
|
|
5364
|
+
if (!response) {
|
|
5365
|
+
throw new acpError_default("Failed to get memo content");
|
|
5366
|
+
}
|
|
5367
|
+
return response.content;
|
|
5368
|
+
}
|
|
5347
5369
|
async getTokenBalances() {
|
|
5348
5370
|
const response = await this._fetch(
|
|
5349
5371
|
`/chains/token-balances`,
|