Repository navigation
Conversation
- Created package.json for the build-energy-grid example with necessary dependencies and scripts. - Implemented CLI functionality in src/cli.ts for generating keys and running the market. - Developed DailyBudgetPolicy in src/daily-budget.ts to manage daily spending limits for energy producers. - Defined market model in src/market-model.ts, including energy offers and pricing logic. - Built market logic in src/market.ts to handle producer applications and payment processing. - Added payment response handling in src/payment-response.ts to extract transaction hashes from responses. - Implemented tests for daily budget policy, market model, and payment response to ensure functionality. - Configured TypeScript settings in tsconfig.json for the example project.
|
@ABEEGOLD Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #360
Build with Nirium: Energy Smart Grid over x402
What changed and why
SUMMARY
Added
examples/build-energy-grid/, a testnet-only energy market example. Two simulated solar producers sell one-kWh allocations through their ownx402Serveroutes; a storage agent selects the cheapest offer and pays withinitX402. A daily-budget policy allows three purchases and rejects the next before signing.The example includes CLI key generation and market startup, price selection, transaction-hash extraction, and offline tests for the policy, market model, and settlement responses. Setup and key-role instructions are in the
README.Package(s) touched
How this was tested
All tests were run offline; no network payments or testnet accounts were used.
npm test— passed, 8 testsnpm run typecheck— passednpm run buildinpackages/sdk— passedgit diff --check— passedLive testnet transaction hashes and the required short demo video have not yet been added. The README marks the transaction evidence as pending an owner-run testnet demo.
Checklist