fix: harden bridge platform sdk calls#21
Conversation
📝 WalkthroughWalkthroughRefactored Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/platform/identity.ts (1)
60-68: ExportcreatePlatformSdkto enforce consistent SDK configuration across the codebase.This factory function applies hardened timeout and retry settings (
PLATFORM_REQUEST_SETTINGS), but other files instantiate SDK instances directly without these settings:
src/platform/dpns.tsline 13:EvoSDK.mainnetTrusted()/EvoSDK.testnetTrusted()src/platform/contract.tslines 23-25: same patternsrc/main.tsline 1108: same patternExporting
createPlatformSdk(or extracting it tosrc/platform/sdk.ts) would ensure all Platform SDK calls use consistent timeout and retry settings across the codebase.♻️ Proposed change
-function createPlatformSdk(network: 'testnet' | 'mainnet'): EvoSDK { +export function createPlatformSdk(network: 'testnet' | 'mainnet'): EvoSDK {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platform/identity.ts` around lines 60 - 68, Export the createPlatformSdk factory so all consumers use the hardened PLATFORM_REQUEST_SETTINGS: mark the function createPlatformSdk as exported (or move it into a shared module like sdk.ts and export it) and replace direct EvoSDK.mainnetTrusted()/EvoSDK.testnetTrusted() usages with calls to createPlatformSdk(network). Update callers (e.g., any code currently calling EvoSDK.mainnetTrusted or EvoSDK.testnetTrusted) to import and use createPlatformSdk to ensure consistent timeout/retry settings across the codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/platform/identity.ts`:
- Around line 60-68: Export the createPlatformSdk factory so all consumers use
the hardened PLATFORM_REQUEST_SETTINGS: mark the function createPlatformSdk as
exported (or move it into a shared module like sdk.ts and export it) and replace
direct EvoSDK.mainnetTrusted()/EvoSDK.testnetTrusted() usages with calls to
createPlatformSdk(network). Update callers (e.g., any code currently calling
EvoSDK.mainnetTrusted or EvoSDK.testnetTrusted) to import and use
createPlatformSdk to ensure consistent timeout/retry settings across the
codebase.
Summary
Testing
This pull request was created by Codex.
Summary by CodeRabbit