diff --git a/examples/acp-base/skip-evaluation/buyer.ts b/examples/acp-base/skip-evaluation/buyer.ts index b631944..e23a105 100644 --- a/examples/acp-base/skip-evaluation/buyer.ts +++ b/examples/acp-base/skip-evaluation/buyer.ts @@ -70,7 +70,7 @@ async function buyer() { "": "", }, 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`); diff --git a/package-lock.json b/package-lock.json index 8decc20..b789c30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@virtuals-protocol/acp-node", - "version": "0.3.0-beta.16", + "version": "0.3.0-beta.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@virtuals-protocol/acp-node", - "version": "0.3.0-beta.16", + "version": "0.3.0-beta.17", "license": "ISC", "dependencies": { "@aa-sdk/core": "^4.73.0", diff --git a/package.json b/package.json index 4526817..e18fdf3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/acpJob.ts b/src/acpJob.ts index 37858f7..e963001 100644 --- a/src/acpJob.ts +++ b/src/acpJob.ts @@ -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( @@ -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, @@ -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); @@ -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( @@ -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, @@ -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( @@ -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,