@virtuals-protocol/acp-node 0.3.0-beta.15 → 0.3.0-beta.16
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 +53 -46
- package/dist/index.d.mts +44 -11
- package/dist/index.d.ts +44 -11
- package/dist/index.js +184 -234
- package/dist/index.mjs +184 -234
- package/package.json +1 -1
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.16",
|
|
39
39
|
main: "./dist/index.js",
|
|
40
40
|
module: "./dist/index.mjs",
|
|
41
41
|
types: "./dist/index.d.ts",
|
|
@@ -3974,6 +3974,7 @@ var AcpJobOffering = class {
|
|
|
3974
3974
|
var acpJobOffering_default = AcpJobOffering;
|
|
3975
3975
|
|
|
3976
3976
|
// src/acpJob.ts
|
|
3977
|
+
var util = __toESM(require("util"));
|
|
3977
3978
|
var AcpJob = class {
|
|
3978
3979
|
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context, contractAddress, netPayableAmount) {
|
|
3979
3980
|
this.acpClient = acpClient;
|
|
@@ -4348,10 +4349,28 @@ var AcpJob = class {
|
|
|
4348
4349
|
waitMs = Math.min(waitMs * 2, maxWaitMs);
|
|
4349
4350
|
}
|
|
4350
4351
|
}
|
|
4352
|
+
[util.inspect.custom]() {
|
|
4353
|
+
return {
|
|
4354
|
+
id: this.id,
|
|
4355
|
+
clientAddress: this.clientAddress,
|
|
4356
|
+
providerAddress: this.providerAddress,
|
|
4357
|
+
name: this.name,
|
|
4358
|
+
requirement: this.requirement,
|
|
4359
|
+
priceType: this.priceType,
|
|
4360
|
+
priceValue: this.priceValue,
|
|
4361
|
+
priceTokenAddress: this.priceTokenAddress,
|
|
4362
|
+
memos: this.memos,
|
|
4363
|
+
phase: this.phase,
|
|
4364
|
+
context: this.context,
|
|
4365
|
+
contractAddress: this.contractAddress,
|
|
4366
|
+
netPayableAmount: this.netPayableAmount
|
|
4367
|
+
};
|
|
4368
|
+
}
|
|
4351
4369
|
};
|
|
4352
4370
|
var acpJob_default = AcpJob;
|
|
4353
4371
|
|
|
4354
4372
|
// src/acpMemo.ts
|
|
4373
|
+
var import_util = __toESM(require("util"));
|
|
4355
4374
|
var AcpMemo = class {
|
|
4356
4375
|
constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash) {
|
|
4357
4376
|
this.contractClient = contractClient;
|
|
@@ -4391,6 +4410,21 @@ var AcpMemo = class {
|
|
|
4391
4410
|
const payload = this.contractClient.signMemo(this.id, approved, reason);
|
|
4392
4411
|
return await this.contractClient.handleOperation([payload]);
|
|
4393
4412
|
}
|
|
4413
|
+
[import_util.default.inspect.custom]() {
|
|
4414
|
+
return {
|
|
4415
|
+
id: this.id,
|
|
4416
|
+
senderAddress: this.senderAddress,
|
|
4417
|
+
type: MemoType[this.type],
|
|
4418
|
+
status: this.status,
|
|
4419
|
+
content: this.content,
|
|
4420
|
+
signedReason: this.signedReason,
|
|
4421
|
+
txHash: this.txHash,
|
|
4422
|
+
signedTxHash: this.signedTxHash,
|
|
4423
|
+
nextPhase: AcpJobPhases[this.nextPhase],
|
|
4424
|
+
expiry: this.expiry,
|
|
4425
|
+
payableDetails: this.payableDetails
|
|
4426
|
+
};
|
|
4427
|
+
}
|
|
4394
4428
|
};
|
|
4395
4429
|
var acpMemo_default = AcpMemo;
|
|
4396
4430
|
|
|
@@ -4564,7 +4598,7 @@ var AcpClient = class {
|
|
|
4564
4598
|
process.on("SIGTERM", cleanup);
|
|
4565
4599
|
}
|
|
4566
4600
|
async browseAgents(keyword, options) {
|
|
4567
|
-
let { cluster, sort_by, top_k, graduationStatus, onlineStatus } = options;
|
|
4601
|
+
let { cluster, sort_by, top_k, graduationStatus, onlineStatus, showHiddenOfferings } = options;
|
|
4568
4602
|
top_k = top_k ?? 5;
|
|
4569
4603
|
let url = `${this.acpUrl}/api/agents/v4/search?search=${keyword}`;
|
|
4570
4604
|
if (sort_by && sort_by.length > 0) {
|
|
@@ -4585,6 +4619,9 @@ var AcpClient = class {
|
|
|
4585
4619
|
if (onlineStatus) {
|
|
4586
4620
|
url += `&onlineStatus=${onlineStatus}`;
|
|
4587
4621
|
}
|
|
4622
|
+
if (showHiddenOfferings) {
|
|
4623
|
+
url += `&showHiddenOfferings=${showHiddenOfferings}`;
|
|
4624
|
+
}
|
|
4588
4625
|
const response = await fetch(url);
|
|
4589
4626
|
const data = await response.json();
|
|
4590
4627
|
const availableContractClientAddresses = this.contractClients.map(
|
|
@@ -4622,7 +4659,7 @@ var AcpClient = class {
|
|
|
4622
4659
|
twitterHandle: agent.twitterHandle,
|
|
4623
4660
|
walletAddress: agent.walletAddress,
|
|
4624
4661
|
metrics: agent.metrics,
|
|
4625
|
-
|
|
4662
|
+
resources: agent.resources
|
|
4626
4663
|
};
|
|
4627
4664
|
});
|
|
4628
4665
|
}
|
|
@@ -4693,221 +4730,142 @@ var AcpClient = class {
|
|
|
4693
4730
|
return jobId;
|
|
4694
4731
|
}
|
|
4695
4732
|
async getActiveJobs(page = 1, pageSize = 10) {
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
headers: {
|
|
4700
|
-
"wallet-address": this.walletAddress
|
|
4701
|
-
}
|
|
4702
|
-
});
|
|
4703
|
-
const data = await response.json();
|
|
4704
|
-
if (data.error) {
|
|
4705
|
-
throw new acpError_default(data.error.message);
|
|
4706
|
-
}
|
|
4707
|
-
return data.data.map((job) => {
|
|
4708
|
-
return new acpJob_default(
|
|
4709
|
-
this,
|
|
4710
|
-
job.id,
|
|
4711
|
-
job.clientAddress,
|
|
4712
|
-
job.providerAddress,
|
|
4713
|
-
job.evaluatorAddress,
|
|
4714
|
-
job.price,
|
|
4715
|
-
job.priceTokenAddress,
|
|
4716
|
-
job.memos.map((memo) => {
|
|
4717
|
-
return new acpMemo_default(
|
|
4718
|
-
this.contractClientByAddress(job.contractAddress),
|
|
4719
|
-
memo.id,
|
|
4720
|
-
memo.memoType,
|
|
4721
|
-
memo.content,
|
|
4722
|
-
memo.nextPhase,
|
|
4723
|
-
memo.status,
|
|
4724
|
-
memo.senderAddress,
|
|
4725
|
-
memo.signedReason,
|
|
4726
|
-
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4727
|
-
memo.payableDetails,
|
|
4728
|
-
memo.txHash,
|
|
4729
|
-
memo.signedTxHash
|
|
4730
|
-
);
|
|
4731
|
-
}),
|
|
4732
|
-
job.phase,
|
|
4733
|
-
job.context,
|
|
4734
|
-
job.contractAddress,
|
|
4735
|
-
job.netPayableAmount
|
|
4736
|
-
);
|
|
4737
|
-
});
|
|
4738
|
-
} catch (error) {
|
|
4739
|
-
if (error instanceof acpError_default) {
|
|
4740
|
-
return error;
|
|
4741
|
-
}
|
|
4742
|
-
throw new acpError_default("Failed to get active jobs", error);
|
|
4743
|
-
}
|
|
4733
|
+
const url = `${this.acpUrl}/api/jobs/active?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
|
|
4734
|
+
const rawJobs = await this._fetchJobList(url);
|
|
4735
|
+
return this._hydrateJobs(rawJobs, { logPrefix: "Active jobs" });
|
|
4744
4736
|
}
|
|
4745
4737
|
async getPendingMemoJobs(page = 1, pageSize = 10) {
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
headers: {
|
|
4750
|
-
"wallet-address": this.acpContractClient.walletAddress
|
|
4751
|
-
}
|
|
4752
|
-
});
|
|
4753
|
-
const data = await response.json();
|
|
4754
|
-
if (data.error) {
|
|
4755
|
-
throw new acpError_default(data.error.message);
|
|
4756
|
-
}
|
|
4757
|
-
return data.data.map((job) => {
|
|
4758
|
-
return new acpJob_default(
|
|
4759
|
-
this,
|
|
4760
|
-
job.id,
|
|
4761
|
-
job.clientAddress,
|
|
4762
|
-
job.providerAddress,
|
|
4763
|
-
job.evaluatorAddress,
|
|
4764
|
-
job.price,
|
|
4765
|
-
job.priceTokenAddress,
|
|
4766
|
-
job.memos.map((memo) => {
|
|
4767
|
-
return new acpMemo_default(
|
|
4768
|
-
this.contractClientByAddress(job.contractAddress),
|
|
4769
|
-
memo.id,
|
|
4770
|
-
memo.memoType,
|
|
4771
|
-
memo.content,
|
|
4772
|
-
memo.nextPhase,
|
|
4773
|
-
memo.status,
|
|
4774
|
-
memo.senderAddress,
|
|
4775
|
-
memo.signedReason,
|
|
4776
|
-
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4777
|
-
typeof memo.payableDetails === "string" ? tryParseJson(memo.payableDetails) || void 0 : memo.payableDetails,
|
|
4778
|
-
memo.txHash,
|
|
4779
|
-
memo.signedTxHash
|
|
4780
|
-
);
|
|
4781
|
-
}),
|
|
4782
|
-
job.phase,
|
|
4783
|
-
job.context,
|
|
4784
|
-
job.contractAddress,
|
|
4785
|
-
job.netPayableAmount
|
|
4786
|
-
);
|
|
4787
|
-
});
|
|
4788
|
-
} catch (error) {
|
|
4789
|
-
if (error instanceof acpError_default) {
|
|
4790
|
-
return error;
|
|
4791
|
-
}
|
|
4792
|
-
throw new acpError_default("Failed to get pending memo jobs", error);
|
|
4793
|
-
}
|
|
4738
|
+
const url = `${this.acpUrl}/api/jobs/pending-memos?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
|
|
4739
|
+
const rawJobs = await this._fetchJobList(url);
|
|
4740
|
+
return this._hydrateJobs(rawJobs, { logPrefix: "Pending memo jobs" });
|
|
4794
4741
|
}
|
|
4795
4742
|
async getCompletedJobs(page = 1, pageSize = 10) {
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
headers: {
|
|
4800
|
-
"wallet-address": this.acpContractClient.walletAddress
|
|
4801
|
-
}
|
|
4802
|
-
});
|
|
4803
|
-
const data = await response.json();
|
|
4804
|
-
if (data.error) {
|
|
4805
|
-
throw new acpError_default(data.error.message);
|
|
4806
|
-
}
|
|
4807
|
-
return data.data.map((job) => {
|
|
4808
|
-
return new acpJob_default(
|
|
4809
|
-
this,
|
|
4810
|
-
job.id,
|
|
4811
|
-
job.clientAddress,
|
|
4812
|
-
job.providerAddress,
|
|
4813
|
-
job.evaluatorAddress,
|
|
4814
|
-
job.price,
|
|
4815
|
-
job.priceTokenAddress,
|
|
4816
|
-
job.memos.map((memo) => {
|
|
4817
|
-
return new acpMemo_default(
|
|
4818
|
-
this.contractClientByAddress(job.contractAddress),
|
|
4819
|
-
memo.id,
|
|
4820
|
-
memo.memoType,
|
|
4821
|
-
memo.content,
|
|
4822
|
-
memo.nextPhase,
|
|
4823
|
-
memo.status,
|
|
4824
|
-
memo.senderAddress,
|
|
4825
|
-
memo.signedReason,
|
|
4826
|
-
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4827
|
-
memo.payableDetails,
|
|
4828
|
-
memo.txHash,
|
|
4829
|
-
memo.signedTxHash
|
|
4830
|
-
);
|
|
4831
|
-
}),
|
|
4832
|
-
job.phase,
|
|
4833
|
-
job.context,
|
|
4834
|
-
job.contractAddress,
|
|
4835
|
-
job.netPayableAmount
|
|
4836
|
-
);
|
|
4837
|
-
});
|
|
4838
|
-
} catch (error) {
|
|
4839
|
-
if (error instanceof acpError_default) {
|
|
4840
|
-
return error;
|
|
4841
|
-
}
|
|
4842
|
-
throw new acpError_default("Failed to get completed jobs", error);
|
|
4843
|
-
}
|
|
4743
|
+
const url = `${this.acpUrl}/api/jobs/completed?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
|
|
4744
|
+
const rawJobs = await this._fetchJobList(url);
|
|
4745
|
+
return this._hydrateJobs(rawJobs, { logPrefix: "Completed jobs" });
|
|
4844
4746
|
}
|
|
4845
4747
|
async getCancelledJobs(page = 1, pageSize = 10) {
|
|
4846
|
-
|
|
4748
|
+
const url = `${this.acpUrl}/api/jobs/cancelled?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
|
|
4749
|
+
const rawJobs = await this._fetchJobList(url);
|
|
4750
|
+
return this._hydrateJobs(rawJobs, { logPrefix: "Cancelled jobs" });
|
|
4751
|
+
}
|
|
4752
|
+
async _fetchJobList(url) {
|
|
4753
|
+
let response;
|
|
4847
4754
|
try {
|
|
4848
|
-
|
|
4755
|
+
response = await fetch(url, {
|
|
4849
4756
|
headers: {
|
|
4850
4757
|
"wallet-address": this.walletAddress
|
|
4851
4758
|
}
|
|
4852
4759
|
});
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4760
|
+
} catch (err) {
|
|
4761
|
+
throw new acpError_default("Failed to fetch ACP jobs (network error)", err);
|
|
4762
|
+
}
|
|
4763
|
+
let data;
|
|
4764
|
+
try {
|
|
4765
|
+
data = await response.json();
|
|
4766
|
+
} catch (err) {
|
|
4767
|
+
throw new acpError_default("Failed to parse ACP jobs response", err);
|
|
4768
|
+
}
|
|
4769
|
+
if (data.error) {
|
|
4770
|
+
throw new acpError_default(data.error.message);
|
|
4771
|
+
}
|
|
4772
|
+
return data.data;
|
|
4773
|
+
}
|
|
4774
|
+
_hydrateJobs(rawJobs, options) {
|
|
4775
|
+
const jobs = [];
|
|
4776
|
+
const errors = [];
|
|
4777
|
+
for (const job of rawJobs) {
|
|
4778
|
+
try {
|
|
4779
|
+
const memos = job.memos.map(
|
|
4780
|
+
(memo) => new acpMemo_default(
|
|
4781
|
+
this.contractClientByAddress(job.contractAddress),
|
|
4782
|
+
memo.id,
|
|
4783
|
+
memo.memoType,
|
|
4784
|
+
memo.content,
|
|
4785
|
+
memo.nextPhase,
|
|
4786
|
+
memo.status,
|
|
4787
|
+
memo.senderAddress,
|
|
4788
|
+
memo.signedReason,
|
|
4789
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4790
|
+
memo.payableDetails,
|
|
4791
|
+
memo.txHash,
|
|
4792
|
+
memo.signedTxHash
|
|
4793
|
+
)
|
|
4886
4794
|
);
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4795
|
+
jobs.push(
|
|
4796
|
+
new acpJob_default(
|
|
4797
|
+
this,
|
|
4798
|
+
job.id,
|
|
4799
|
+
job.clientAddress,
|
|
4800
|
+
job.providerAddress,
|
|
4801
|
+
job.evaluatorAddress,
|
|
4802
|
+
job.price,
|
|
4803
|
+
job.priceTokenAddress,
|
|
4804
|
+
memos,
|
|
4805
|
+
job.phase,
|
|
4806
|
+
job.context,
|
|
4807
|
+
job.contractAddress,
|
|
4808
|
+
job.netPayableAmount
|
|
4809
|
+
)
|
|
4810
|
+
);
|
|
4811
|
+
} catch (err) {
|
|
4812
|
+
errors.push({ jobId: job.id, error: err });
|
|
4891
4813
|
}
|
|
4892
|
-
throw new acpError_default("Failed to get cancelled jobs", error);
|
|
4893
4814
|
}
|
|
4815
|
+
if (errors.length > 0) {
|
|
4816
|
+
console.warn(
|
|
4817
|
+
`${options?.logPrefix ?? "Skipped"} ${errors.length} malformed job(s)
|
|
4818
|
+
` + JSON.stringify(
|
|
4819
|
+
errors.map((e) => ({ jobId: e.jobId, message: e.error.message })),
|
|
4820
|
+
null,
|
|
4821
|
+
2
|
|
4822
|
+
)
|
|
4823
|
+
);
|
|
4824
|
+
}
|
|
4825
|
+
return jobs;
|
|
4894
4826
|
}
|
|
4895
4827
|
async getJobById(jobId) {
|
|
4896
|
-
|
|
4828
|
+
const url = `${this.acpUrl}/api/jobs/${jobId}`;
|
|
4829
|
+
let response;
|
|
4897
4830
|
try {
|
|
4898
|
-
|
|
4831
|
+
response = await fetch(url, {
|
|
4899
4832
|
headers: {
|
|
4900
4833
|
"wallet-address": this.acpContractClient.walletAddress
|
|
4901
4834
|
}
|
|
4902
4835
|
});
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4836
|
+
} catch (err) {
|
|
4837
|
+
throw new acpError_default("Failed to fetch job by id (network error)", err);
|
|
4838
|
+
}
|
|
4839
|
+
let data;
|
|
4840
|
+
try {
|
|
4841
|
+
data = await response.json();
|
|
4842
|
+
} catch (err) {
|
|
4843
|
+
throw new acpError_default("Failed to parse job by id response", err);
|
|
4844
|
+
}
|
|
4845
|
+
if (data.error) {
|
|
4846
|
+
throw new acpError_default(data.error.message);
|
|
4847
|
+
}
|
|
4848
|
+
const job = data.data;
|
|
4849
|
+
if (!job) {
|
|
4850
|
+
return void 0;
|
|
4851
|
+
}
|
|
4852
|
+
try {
|
|
4853
|
+
const memos = job.memos.map(
|
|
4854
|
+
(memo) => new acpMemo_default(
|
|
4855
|
+
this.contractClientByAddress(job.contractAddress),
|
|
4856
|
+
memo.id,
|
|
4857
|
+
memo.memoType,
|
|
4858
|
+
memo.content,
|
|
4859
|
+
memo.nextPhase,
|
|
4860
|
+
memo.status,
|
|
4861
|
+
memo.senderAddress,
|
|
4862
|
+
memo.signedReason,
|
|
4863
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4864
|
+
memo.payableDetails,
|
|
4865
|
+
memo.txHash,
|
|
4866
|
+
memo.signedTxHash
|
|
4867
|
+
)
|
|
4868
|
+
);
|
|
4911
4869
|
return new acpJob_default(
|
|
4912
4870
|
this,
|
|
4913
4871
|
job.id,
|
|
@@ -4916,50 +4874,42 @@ var AcpClient = class {
|
|
|
4916
4874
|
job.evaluatorAddress,
|
|
4917
4875
|
job.price,
|
|
4918
4876
|
job.priceTokenAddress,
|
|
4919
|
-
|
|
4920
|
-
return new acpMemo_default(
|
|
4921
|
-
this.contractClientByAddress(job.contractAddress),
|
|
4922
|
-
memo.id,
|
|
4923
|
-
memo.memoType,
|
|
4924
|
-
memo.content,
|
|
4925
|
-
memo.nextPhase,
|
|
4926
|
-
memo.status,
|
|
4927
|
-
memo.senderAddress,
|
|
4928
|
-
memo.signedReason,
|
|
4929
|
-
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4930
|
-
memo.payableDetails,
|
|
4931
|
-
memo.txHash,
|
|
4932
|
-
memo.signedTxHash
|
|
4933
|
-
);
|
|
4934
|
-
}),
|
|
4877
|
+
memos,
|
|
4935
4878
|
job.phase,
|
|
4936
4879
|
job.context,
|
|
4937
4880
|
job.contractAddress,
|
|
4938
4881
|
job.netPayableAmount
|
|
4939
4882
|
);
|
|
4940
|
-
} catch (
|
|
4941
|
-
|
|
4942
|
-
return error;
|
|
4943
|
-
}
|
|
4944
|
-
throw new acpError_default("Failed to get job by id", error);
|
|
4883
|
+
} catch (err) {
|
|
4884
|
+
throw new acpError_default(`Failed to hydrate job ${jobId}`, err);
|
|
4945
4885
|
}
|
|
4946
4886
|
}
|
|
4947
4887
|
async getMemoById(jobId, memoId) {
|
|
4948
|
-
|
|
4888
|
+
const url = `${this.acpUrl}/api/jobs/${jobId}/memos/${memoId}`;
|
|
4889
|
+
let response;
|
|
4949
4890
|
try {
|
|
4950
|
-
|
|
4891
|
+
response = await fetch(url, {
|
|
4951
4892
|
headers: {
|
|
4952
4893
|
"wallet-address": this.walletAddress
|
|
4953
4894
|
}
|
|
4954
4895
|
});
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4896
|
+
} catch (err) {
|
|
4897
|
+
throw new acpError_default("Failed to fetch memo by id (network error)", err);
|
|
4898
|
+
}
|
|
4899
|
+
let data;
|
|
4900
|
+
try {
|
|
4901
|
+
data = await response.json();
|
|
4902
|
+
} catch (err) {
|
|
4903
|
+
throw new acpError_default("Failed to parse memo by id response", err);
|
|
4904
|
+
}
|
|
4905
|
+
if (data.error) {
|
|
4906
|
+
throw new acpError_default(data.error.message);
|
|
4907
|
+
}
|
|
4908
|
+
const memo = data.data;
|
|
4909
|
+
if (!memo) {
|
|
4910
|
+
return void 0;
|
|
4911
|
+
}
|
|
4912
|
+
try {
|
|
4963
4913
|
return new acpMemo_default(
|
|
4964
4914
|
this.contractClientByAddress(memo.contractAddress),
|
|
4965
4915
|
memo.id,
|
|
@@ -4974,11 +4924,11 @@ var AcpClient = class {
|
|
|
4974
4924
|
memo.txHash,
|
|
4975
4925
|
memo.signedTxHash
|
|
4976
4926
|
);
|
|
4977
|
-
} catch (
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4927
|
+
} catch (err) {
|
|
4928
|
+
throw new acpError_default(
|
|
4929
|
+
`Failed to hydrate memo ${memoId} for job ${jobId}`,
|
|
4930
|
+
err
|
|
4931
|
+
);
|
|
4982
4932
|
}
|
|
4983
4933
|
}
|
|
4984
4934
|
async getAgent(walletAddress) {
|
|
@@ -5218,7 +5168,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5218
5168
|
);
|
|
5219
5169
|
}
|
|
5220
5170
|
await this.validateSessionKeyOnChain(sessionSignerAddress, sessionEntityKeyId);
|
|
5221
|
-
console.log("Connected to ACP:", {
|
|
5171
|
+
console.log("Connected to ACP with v1 Contract Client (Legacy):", {
|
|
5222
5172
|
agentWalletAddress: this.agentWalletAddress,
|
|
5223
5173
|
whitelistedWalletAddress: sessionSignerAddress,
|
|
5224
5174
|
entityId: sessionEntityKeyId
|