Skip to content

Commit 93bf6df

Browse files
authored
Merge pull request #152 from Virtual-Protocol/feat/yang-add-required-funds-field-to-offering
feat: add required funds bool field to job offering
2 parents 18a7a86 + 07507db commit 93bf6df

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "virtuals-acp"
3-
version = "0.3.18"
3+
version = "0.3.19"
44
description = "Agent Commerce Protocol Python SDK by Virtuals"
55
authors = ["Steven Lee Soon Fatt <steven@virtuals.io>"]
66
readme = "README.md"

virtuals_acp/client.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ def _hydrate_agent(self, agent_data: Dict[str, Any]) -> IACPAgent:
296296
provider_address = agent_data.get("walletAddress")
297297

298298
job_offerings: List[ACPJobOffering] = []
299-
for job in agent_data.get("jobs", []):
300-
if "priceV2" in job:
301-
price = job["priceV2"]["value"]
302-
price_type = PriceType(job["priceV2"]["type"])
303-
elif "price" in job:
304-
price = job["price"]
299+
for offering in agent_data.get("jobs", []):
300+
if "priceV2" in offering:
301+
price = offering["priceV2"]["value"]
302+
price_type = PriceType(offering["priceV2"]["type"])
303+
elif "price" in offering:
304+
price = offering["price"]
305305
price_type = PriceType.FIXED
306306
else:
307307
continue
@@ -311,10 +311,12 @@ def _hydrate_agent(self, agent_data: Dict[str, Any]) -> IACPAgent:
311311
acp_client=self,
312312
contract_client=contract_client,
313313
provider_address=provider_address,
314-
name=job["name"],
314+
name=offering["name"],
315315
price=price,
316316
price_type=price_type,
317-
requirement=job.get("requirement", None),
317+
required_funds=offering["requiredFunds"],
318+
requirement=offering.get("requirement", None),
319+
deliverable=offering.get("deliverable", None),
318320
)
319321
)
320322

virtuals_acp/job_offering.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class ACPJobOffering(BaseModel):
2828
provider_address: str
2929
name: str
3030
price: float
31-
price_type: PriceType = PriceType.FIXED
31+
price_type: PriceType
32+
required_funds: bool
3233
requirement: Optional[Union[Dict[str, Any], str]] = None
3334
deliverable: Optional[Union[Dict[str, Any], str]] = None
3435

0 commit comments

Comments
 (0)