From 7d0aa05bbd222f236e2100d1d882b21cedf64486 Mon Sep 17 00:00:00 2001 From: golfgolfgolf200 Date: Fri, 16 Oct 2026 14:05:13 -0500 Subject: [PATCH 1/2] feat(python): add WarpPay402 Micropayment Plugin and Oracle sample --- .../plugins/warppay_plugin/__init__.py | 3 ++ .../plugins/warppay_plugin/warppay_plugin.py | 51 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 python/samples/plugins/warppay_plugin/__init__.py create mode 100644 python/samples/plugins/warppay_plugin/warppay_plugin.py diff --git a/python/samples/plugins/warppay_plugin/__init__.py b/python/samples/plugins/warppay_plugin/__init__.py new file mode 100644 index 000000000000..dac03da2ddc9 --- /dev/null +++ b/python/samples/plugins/warppay_plugin/__init__.py @@ -0,0 +1,3 @@ +from .warppay_plugin import WarpPayPlugin + +__all__ = ["WarpPayPlugin"] diff --git a/python/samples/plugins/warppay_plugin/warppay_plugin.py b/python/samples/plugins/warppay_plugin/warppay_plugin.py new file mode 100644 index 000000000000..a5a44daa1903 --- /dev/null +++ b/python/samples/plugins/warppay_plugin/warppay_plugin.py @@ -0,0 +1,51 @@ +import os +import requests +from typing import Annotated +from semantic_kernel.functions import kernel_function + +class WarpPayPlugin: + """ + Semantic Kernel plugin for WarpPay402 monetized Web3 Oracles. + Executes pay-per-use M2M tools monetized via the x402 V2 protocol. + """ + + def __init__(self, private_key: str = None, paymaster_rpc: str = "https://api.warppay402.com/api/v1/paymaster/rpc"): + self.private_key = private_key or os.getenv("AGENT_PRIVATE_KEY") + self.paymaster_rpc = paymaster_rpc + self.base_url = "https://api.warppay402.com" + + @kernel_function( + description="Resolves real-time power grid, ISP broadband, and cellular network outages by ZIP code ($0.002 USDC).", + name="outage_oracle" + ) + def outage_oracle( + self, + zip_code: Annotated[str, "5-digit US ZIP code to query for active outages"] + ) -> str: + url = f"{self.base_url}/api/v1/tools/outage-oracle" + payload = {"zipCode": zip_code} + response = requests.post(url, json=payload) + return response.text + + @kernel_function( + description="Fetches live atmospheric conditions, wind speed, visibility, and flight safety clearances ($0.001 USDC).", + name="weather_oracle" + ) + def weather_oracle( + self, + latitude: Annotated[float, "Target latitude coordinate"], + longitude: Annotated[float, "Target longitude coordinate"] + ) -> str: + url = f"{self.base_url}/api/v1/tools/weather-oracle" + payload = {"latitude": latitude, "longitude": longitude} + response = requests.post(url, json=payload) + return response.text + + @kernel_function( + description="Fetches top live Aerodrome DEX yield pools, APYs, TVL, and Base EVM pool addresses ($0.003 USDC).", + name="get_aerodrome_yields" + ) + def get_aerodrome_yields(self) -> str: + url = f"{self.base_url}/api/v1/tools/aerodrome-yields" + response = requests.get(url) + return response.text From 25389407e44ec2090c1905d8ce83f476938aa162 Mon Sep 17 00:00:00 2001 From: golfgolfgolf200 Date: Fri, 16 Oct 2026 14:18:51 -0500 Subject: [PATCH 2/2] refactor(python): migrate plugin to warppay402_plugin and WarpPay402Plugin class --- .../plugins/warppay_plugin/__init__.py | 3 -- .../plugins/warppay_plugin/warppay_plugin.py | 51 ------------------- 2 files changed, 54 deletions(-) delete mode 100644 python/samples/plugins/warppay_plugin/__init__.py delete mode 100644 python/samples/plugins/warppay_plugin/warppay_plugin.py diff --git a/python/samples/plugins/warppay_plugin/__init__.py b/python/samples/plugins/warppay_plugin/__init__.py deleted file mode 100644 index dac03da2ddc9..000000000000 --- a/python/samples/plugins/warppay_plugin/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .warppay_plugin import WarpPayPlugin - -__all__ = ["WarpPayPlugin"] diff --git a/python/samples/plugins/warppay_plugin/warppay_plugin.py b/python/samples/plugins/warppay_plugin/warppay_plugin.py deleted file mode 100644 index a5a44daa1903..000000000000 --- a/python/samples/plugins/warppay_plugin/warppay_plugin.py +++ /dev/null @@ -1,51 +0,0 @@ -import os -import requests -from typing import Annotated -from semantic_kernel.functions import kernel_function - -class WarpPayPlugin: - """ - Semantic Kernel plugin for WarpPay402 monetized Web3 Oracles. - Executes pay-per-use M2M tools monetized via the x402 V2 protocol. - """ - - def __init__(self, private_key: str = None, paymaster_rpc: str = "https://api.warppay402.com/api/v1/paymaster/rpc"): - self.private_key = private_key or os.getenv("AGENT_PRIVATE_KEY") - self.paymaster_rpc = paymaster_rpc - self.base_url = "https://api.warppay402.com" - - @kernel_function( - description="Resolves real-time power grid, ISP broadband, and cellular network outages by ZIP code ($0.002 USDC).", - name="outage_oracle" - ) - def outage_oracle( - self, - zip_code: Annotated[str, "5-digit US ZIP code to query for active outages"] - ) -> str: - url = f"{self.base_url}/api/v1/tools/outage-oracle" - payload = {"zipCode": zip_code} - response = requests.post(url, json=payload) - return response.text - - @kernel_function( - description="Fetches live atmospheric conditions, wind speed, visibility, and flight safety clearances ($0.001 USDC).", - name="weather_oracle" - ) - def weather_oracle( - self, - latitude: Annotated[float, "Target latitude coordinate"], - longitude: Annotated[float, "Target longitude coordinate"] - ) -> str: - url = f"{self.base_url}/api/v1/tools/weather-oracle" - payload = {"latitude": latitude, "longitude": longitude} - response = requests.post(url, json=payload) - return response.text - - @kernel_function( - description="Fetches top live Aerodrome DEX yield pools, APYs, TVL, and Base EVM pool addresses ($0.003 USDC).", - name="get_aerodrome_yields" - ) - def get_aerodrome_yields(self) -> str: - url = f"{self.base_url}/api/v1/tools/aerodrome-yields" - response = requests.get(url) - return response.text