Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/acp-base/skip-evaluation/buyer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function buyer() {
"<your-schema-key-2>": "<your-schema-value-2>",
},
undefined, // evaluator address, undefined fallback to empty address - skip-evaluation
new Date(Date.now() + 1000 * 60 * 3.1) // job expiry duration, minimum 3 minutes
new Date(Date.now() + 1000 * 60 * 5) // job expiry duration, minimum 5 minutes
);

console.log(`Job ${jobId} initiated`);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@virtuals-protocol/acp-node",
"version": "0.3.0-beta.16",
"version": "0.3.0-beta.17",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand Down
31 changes: 15 additions & 16 deletions src/acpJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class AcpJob {
}

const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
const isPercentagePricing: boolean = this.priceType === PriceType.PERCENTAGE;
const isPercentagePricing: boolean =
this.priceType === PriceType.PERCENTAGE;

operations.push(
this.acpContractClient.createPayableMemo(
Expand All @@ -171,9 +172,7 @@ class AcpJob {
isPercentagePricing
? BigInt(Math.round(this.priceValue * 10000)) // convert to basis points
: feeAmount.amount,
isPercentagePricing
? FeeType.PERCENTAGE_FEE
: FeeType.NO_FEE,
isPercentagePricing ? FeeType.PERCENTAGE_FEE : FeeType.NO_FEE,
AcpJobPhases.TRANSACTION,
type,
expiredAt,
Expand Down Expand Up @@ -241,11 +240,13 @@ class AcpJob {
)
);

const x402PaymentDetails =
await this.acpContractClient.getX402PaymentDetails(this.id);
if (this.price > 0) {
const x402PaymentDetails =
await this.acpContractClient.getX402PaymentDetails(this.id);

if (x402PaymentDetails.isX402) {
await this.performX402Payment(this.price);
if (x402PaymentDetails.isX402) {
await this.performX402Payment(this.price);
}
}

return await this.acpContractClient.handleOperation(operations);
Expand Down Expand Up @@ -371,7 +372,8 @@ class AcpJob {
);

const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
const isPercentagePricing: boolean = this.priceType === PriceType.PERCENTAGE && !skipFee;
const isPercentagePricing: boolean =
this.priceType === PriceType.PERCENTAGE && !skipFee;

operations.push(
this.acpContractClient.createPayableMemo(
Expand All @@ -382,9 +384,7 @@ class AcpJob {
isPercentagePricing
? BigInt(Math.round(this.priceValue * 10000)) // convert to basis points
: feeAmount.amount,
isPercentagePricing
? FeeType.PERCENTAGE_FEE
: FeeType.NO_FEE,
isPercentagePricing ? FeeType.PERCENTAGE_FEE : FeeType.NO_FEE,
AcpJobPhases.COMPLETED,
MemoType.PAYABLE_TRANSFER,
expiredAt,
Expand Down Expand Up @@ -437,7 +437,8 @@ class AcpJob {
);

const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
const isPercentagePricing: boolean = this.priceType === PriceType.PERCENTAGE && !skipFee;
const isPercentagePricing: boolean =
this.priceType === PriceType.PERCENTAGE && !skipFee;

operations.push(
this.acpContractClient.createPayableMemo(
Expand All @@ -448,9 +449,7 @@ class AcpJob {
isPercentagePricing
? BigInt(Math.round(this.priceValue * 10000)) // convert to basis points
: feeAmount.amount,
isPercentagePricing
? FeeType.PERCENTAGE_FEE
: FeeType.NO_FEE,
isPercentagePricing ? FeeType.PERCENTAGE_FEE : FeeType.NO_FEE,
AcpJobPhases.COMPLETED,
MemoType.PAYABLE_NOTIFICATION,
expiredAt,
Expand Down