Import config and update signer network ID#203
Conversation
📝 WalkthroughWalkthrough
ChangesDynamic Stellar Network Config in Agent
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agent/agent.js`:
- Line 133: The createEd25519Signer call in agent/agent.js is attempting to pass
config.stellar.networkId as the network identifier, but the config contract
defined in backend/src/config.js only exposes stellar.network and
stellar.networkPassphrase (not networkId). Update the signer initialization to
use one of the existing config properties (either stellar.network or
stellar.networkPassphrase) that are actually defined in the config contract,
mapping it to the format expected by the createEd25519Signer function to ensure
the signer receives the correct network parameter and prevents undefined values
that would break x402 Stellar payment operations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
|
||
| function buildHttpClient() { | ||
| const signer = createEd25519Signer(AGENT_SECRET, 'stellar:testnet'); | ||
| const signer = createEd25519Signer(AGENT_SECRET, config.stellar.networkId); |
There was a problem hiding this comment.
config.stellar.networkId does not exist in the shared config contract (runtime break).
Line 133 reads config.stellar.networkId, but backend/src/config.js defines stellar.network and stellar.networkPassphrase (no networkId). This makes the signer network argument undefined, which can break x402 Stellar payment signing/handshakes.
Align the contract on both sides (either expose networkId from config, or consume an existing key and map it to the signer’s required format).
Suggested contract-safe fix (example)
- const signer = createEd25519Signer(AGENT_SECRET, config.stellar.networkId);
+ const networkId = config.stellar.network?.startsWith('stellar:')
+ ? config.stellar.network
+ : `stellar:${config.stellar.network}`;
+ const signer = createEd25519Signer(AGENT_SECRET, networkId);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const signer = createEd25519Signer(AGENT_SECRET, config.stellar.networkId); | |
| const networkId = config.stellar.network?.startsWith('stellar:') | |
| ? config.stellar.network | |
| : `stellar:${config.stellar.network}`; | |
| const signer = createEd25519Signer(AGENT_SECRET, networkId); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agent/agent.js` at line 133, The createEd25519Signer call in agent/agent.js
is attempting to pass config.stellar.networkId as the network identifier, but
the config contract defined in backend/src/config.js only exposes
stellar.network and stellar.networkPassphrase (not networkId). Update the signer
initialization to use one of the existing config properties (either
stellar.network or stellar.networkPassphrase) that are actually defined in the
config contract, mapping it to the format expected by the createEd25519Signer
function to ensure the signer receives the correct network parameter and
prevents undefined values that would break x402 Stellar payment operations.
Resolves complaint in pr Stellar-Ecosystem#203
Closes #131
agent/agent.js**: same fix —buildHttpClientnow importsconfigand uses
config.stellar.networkId.Confirmed
config.jsloads without errors after thenetworkIdchange.Summary by CodeRabbit