Skip to content

[DOCS] Developer guides and API spec — issues #196, #197, #198, #199#203

Merged
KevinMB0220 merged 2 commits intoGalaxy-KJ:mainfrom
Themancalledpg:docs/developer-guides-and-api-spec
Mar 29, 2026
Merged

[DOCS] Developer guides and API spec — issues #196, #197, #198, #199#203
KevinMB0220 merged 2 commits intoGalaxy-KJ:mainfrom
Themancalledpg:docs/developer-guides-and-api-spec

Conversation

@Themancalledpg
Copy link
Copy Markdown
Contributor

@Themancalledpg Themancalledpg commented Mar 29, 2026

Closes #196
Closes #197
Closes #198
Closes #199

Summary

Files changed

File Change
docs/guides/social-login-integration.md New
docs/guides/oracle-integration.md New
docs/contracts/deployment-runbook.md New
docs/api/api-reference.md Rewritten (real endpoints only)
docs/architecture/defi-aggregation-flow.md Oracle node + automation trigger added to diagram
docs/contracts/smart-wallet-contract.md Fee-bump architecture section added
docs/contracts/deployment.md Cross-reference to runbook added
docs/smart-wallet/webauthn-guide.md Cross-reference to social login guide added
docs/cli/oracle.md Cross-reference to oracle integration guide added
packages/core/wallet/auth/README.md Cross-references to both guides added

Test plan

  • All new Markdown files render correctly (headings, Mermaid diagrams, tables, code blocks)
  • Cross-links resolve to existing files
  • api-reference.md endpoints match route handlers in packages/api/rest/src/routes/
  • Deployment runbook commands verified against packages/contracts/smart-wallet-account/scripts/deploy.sh and Stellar CLI docs
  • Social login guide sequence diagrams render in GitHub

Summary by CodeRabbit

  • Documentation
    • REST API ref reworked for REST DeFi endpoints (swap, lending, pools), JWT auth for mutating endpoints, new fee-sponsored submit-tx endpoint, updated error and rate-limit guidance, and note replacing WebSocket docs.
  • New Guides
    • Oracle Integration Guide (aggregated feeds, automation triggers) and Social Login Integration Guide (OAuth + WebAuthn with Supabase).
  • Deployment
    • Added smart-wallet deployment runbook and fee-bump sponsor architecture.
  • Minor
    • CLI, contract, and WebAuthn docs updated with related links.

…laxy-KJ#199 — developer guides and API spec

Galaxy-KJ#197 — Add docs/guides/social-login-integration.md: two-layer OAuth+WebAuthn
security model, onboard/login flows, full Supabase example, security guarantees,
and backend verification. Cross-link from webauthn-guide.md and auth README.

Galaxy-KJ#196 — Add docs/guides/oracle-integration.md: off-chain price feeds
(OracleAggregator, CoinGecko, strategies), on-chain Soroban oracle layer,
and automation PRICE trigger wiring with end-to-end XLM/USDC swap example.
Add Oracle node to defi-aggregation-flow.md diagram. Cross-link from oracle
CLI reference.

Galaxy-KJ#198 — Rewrite docs/api/api-reference.md from actual route implementations:
DeFi (swap quote, swap, Blend supply/withdraw/borrow/repay, liquidity
add/remove, pool analytics), wallets/submit-tx (fee-bump sponsor endpoint),
WebSocket channels. Remove all invented endpoints and privateKey response fields.

Galaxy-KJ#199 — Add docs/contracts/deployment-runbook.md: full step-by-step runbook
covering account creation, WASM build, upload, factory deploy + init, wallet
instance smoke test, fee-bump sponsor setup, testnet E2E test, mainnet
promotion checklist, and env var reference. Add fee-bump architecture section
to smart-wallet-contract.md. Cross-link from deployment.md.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ac3c41a-27bd-4c20-97a8-e5de7a7bb35d

📥 Commits

Reviewing files that changed from the base of the PR and between 351ac25 and 09f70a2.

📒 Files selected for processing (1)
  • packages/core/wallet/auth/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/wallet/auth/README.md

📝 Walkthrough

Walkthrough

This PR updates and replaces the API reference with a REST-focused doc set (new DeFi endpoints, JWT auth for mutating calls, and a fee-sponsored submit-tx), adds an Oracle integration guide and SocialLoginProvider guide (OAuth+WebAuthn), and introduces a contract deployment runbook with fee-bump sponsor architecture and CLI steps.

Changes

Cohort / File(s) Summary
REST API Reference
docs/api/api-reference.md
Rewrote full API reference to a REST-focused spec: removed API-key auth, documented JWT via Supabase for mutating endpoints, added DeFi endpoints (Soroswap quote/build, Blend lending, pool analytics, add/remove liquidity builders), added POST /api/v1/wallets/submit-tx fee-sponsored submission, tightened error envelopes and rate-limiting docs.
Contracts & Deployment
docs/contracts/deployment-runbook.md, docs/contracts/deployment.md, docs/contracts/smart-wallet-contract.md
Added a step-by-step deployment runbook with build/upload/deploy commands, env var references, sponsor account setup and monitoring, mainnet promotion checklist, and documented fee-bump sponsor flow and security properties.
Oracle & DeFi Architecture
docs/architecture/defi-aggregation-flow.md, docs/guides/oracle-integration.md, docs/cli/oracle.md
Inserted OracleAggregator into architecture flow and automation path; added a comprehensive Oracle integration guide covering off-chain aggregation, planned on-chain Soroban oracle, caching/circuit-breakers, automation-trigger wiring, examples, and CLI cross-reference.
Social Login & WebAuthn
docs/guides/social-login-integration.md, docs/smart-wallet/webauthn-guide.md, packages/core/wallet/auth/README.md
New SocialLoginProvider guide describing the OAuth + WebAuthn two-layer model, onboarding/login flows, Supabase integration, server-side verification, security guarantees, tests, and cross-links from WebAuthn guide and auth README.
Docs metadata/links
docs/... (various)
Minor link additions and "Related docs" updates across CLI, WebAuthn, and contracts docs to point to new guides and runbook.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client as Client\n(browser/mobile)
  participant API as Galaxy DevKit\nAPI Server
  participant Sponsor as Fee Sponsor\n(Account/Service)
  participant RPC as Soroban\nRPC

  Client->>API: POST /api/v1/wallets/submit-tx\n(signed inner TX XDR, fee=0)
  API->>API: validate XDR, rate-limit, parse inner tx
  API->>Sponsor: build FeeBumpTransaction(innerTx, sponsorKey, fee)
  Sponsor->>Sponsor: sign outer fee-bump envelope\n(rgba(60,120,180,0.5))
  Sponsor->>API: return signed fee-bump XDR
  API->>RPC: submitTransaction(signedFeeBumpXDR)
  RPC-->>API: tx submission result (success/failure)
  API-->>Client: 200/502 with submission status or error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • KevinMB0220

Poem

🐰 I hopped through docs with eager paws,
New oracles, swaps, and signed-withdraws.
Sponsors hum, the fee-bump sings,
Social logins tie secure strings.
Runbook lights the path to main—hip-hop hooray!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: adding three comprehensive developer guides (oracle integration, social login, deployment runbook) and rewriting the API reference to match actual implementations.
Description check ✅ Passed The PR description covers all required sections: clear summary of changes, related issue closures, specific documentation updates with file listings, test plan with validation items, and cross-reference updates across multiple files.
Linked Issues check ✅ Passed All four linked issues (#196, #197, #198, #199) are addressed: oracle guide with end-to-end example [#196], social login guide with sequence diagrams and Supabase examples [#197], API reference rewrite with real endpoints only [#198], and deployment runbook with fee-bump sponsor setup [#199].
Out of Scope Changes check ✅ Passed All changes are in-scope documentation updates: new guides, API reference rewrite, deployment runbook, and cross-references. No code implementation changes, no unrelated file modifications outside stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
docs/contracts/deployment-runbook.md (2)

209-221: Fee-bump flow is accurate but could be more explicit about signing.

The flow description matches the implementation in packages/api/rest/src/routes/wallets/submit-tx.route.ts. However, line 218 states "The server wraps the inner transaction in a FeeBumpTransaction and signs the outer envelope" but this is somewhat implicit. Consider making it more explicit that the server signs only the outer fee-bump envelope and never touches the user's inner transaction signature.

📝 Proposed clarification
 3. The server reads `FEE_SPONSOR_SECRET_KEY` from the environment.
-4. The server wraps the inner transaction in a `FeeBumpTransaction` and signs the outer envelope.
+4. The server wraps the inner transaction in a `FeeBumpTransaction` and signs *only* the outer fee-bump envelope (the user's inner signature is preserved and never accessed by the server).
 5. The fee-bump transaction is submitted to Soroban RPC.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/contracts/deployment-runbook.md` around lines 209 - 221, The docs
currently imply the server signs the fee-bump but aren’t explicit that it never
modifies or re-signs the user's inner transaction; update the Step 7 text for
POST /api/v1/wallets/submit-tx to explicitly state that the server reads
FEE_SPONSOR_SECRET_KEY, wraps the already user-signed inner transaction in a
FeeBumpTransaction, signs only the outer envelope with the sponsor key and never
alters or resigns the inner transaction signature (reflecting the behavior in
packages/api/rest/src/routes/wallets/submit-tx.route.ts and the
FeeBumpTransaction handling).

341-343: Oracle troubleshooting entry seems out of scope.

The troubleshooting entry about "Insufficient sources from OracleAggregator during automation" appears unrelated to contract deployment. This runbook focuses on deploying smart wallet contracts and setting up fee sponsorship. Oracle configuration is covered in the Oracle integration guide (per PR objectives).

Consider removing this troubleshooting entry or moving it to docs/guides/oracle-integration.md where it would be more contextually relevant.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/contracts/deployment-runbook.md` around lines 341 - 343, Remove the
"Insufficient sources from OracleAggregator during automation" troubleshooting
block from the deployment runbook and move it into the Oracle integration guide;
specifically delete the heading and paragraph titled "`Insufficient sources`
from OracleAggregator during automation" from the contracts deployment runbook
and add the same content (preserving references to `CoinGeckoSource` and
`minSources`) under an Oracle troubleshooting section in the Oracle integration
guide, and add a brief cross-reference from the deployment runbook to the Oracle
guide if desired.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/api/api-reference.md`:
- Around line 400-435: Update the WebSocket examples so the client uses the
actual event names: replace the subscribe calls from the `subscribe:*` pattern
to the `*:subscribe` pattern (e.g., use `market:subscribe`,
`transaction:subscribe`, `automation:subscribe`), and update the market data
listener from `market:price` to `market:price_update`; leave the transaction and
automation listeners (`transaction:status`, `automation:triggered`,
`automation:executed`) as-is. Ensure the example socket emit payloads remain
unchanged and the auth/token usage is preserved.

In `@docs/contracts/smart-wallet-contract.md`:
- Around line 111-112: The doc call to buildFeeBumpTransaction is missing the
required fourth parameter; update the example to pass networkPassphrase as the
fourth argument (matching the implementation of buildFeeBumpTransaction used in
submit-tx.route.ts), so the call becomes buildFeeBumpTransaction(sponsorKeypair,
fee, innerTx, networkPassphrase) before feeBumpTx.sign(sponsorKeypair); ensure
the documentation explicitly names the networkPassphrase parameter so readers
know to supply the correct network string.

In `@docs/guides/oracle-integration.md`:
- Around line 171-186: The example text claims pair-based evaluation (e.g.,
"XLM/USDC > 0.15") but the evaluator only calls getAggregatedPrice(...) using
condition.asset and compares the threshold (it ignores condition.quoteAsset), so
update the guide: change the examples to use XLM/USD (or similar single-asset
wording) and/or add a clear note that quoteAsset-based pair thresholds are not
supported by the current evaluator (mark as future work); specifically edit the
example block containing condition.asset, ConditionOperator, threshold and the
other occurrence at lines referenced (the block using
getAggregatedPrice/threshold and the later example at 264-266) to reflect the
current behavior and mention that quoteAsset is currently ignored by the
evaluation path.

In `@docs/guides/social-login-integration.md`:
- Around line 16-36: The fenced diagram block (the ASCII diagram using triple
backticks) is missing a language identifier causing MD040 lint errors; update
the opening fence to include a language tag such as text (i.e., change ``` to
```text) so the block is recognized as a code block with an explicit language;
ensure the closing fence remains ``` and rerun linting to confirm the MD040
error is resolved.
- Around line 109-113: The example uses Node's Buffer
(Buffer.from(...).toString('base64')) which isn't available in browsers; update
the insert payload construction in the supabase.from('smart_wallets').insert
call to encode result.publicKey65Bytes using browser-safe Web APIs (e.g.,
convert the Uint8Array/ArrayBuffer to a base64 string with btoa on a binary
string or use TextEncoder/Blob/FileReader as appropriate) so the docs work in
client-side flows—replace usages of
Buffer.from(result.publicKey65Bytes).toString('base64') (and the same pattern at
the later occurrence) with a browser-compatible base64 encoding approach and
mention the change if needed.

---

Nitpick comments:
In `@docs/contracts/deployment-runbook.md`:
- Around line 209-221: The docs currently imply the server signs the fee-bump
but aren’t explicit that it never modifies or re-signs the user's inner
transaction; update the Step 7 text for POST /api/v1/wallets/submit-tx to
explicitly state that the server reads FEE_SPONSOR_SECRET_KEY, wraps the already
user-signed inner transaction in a FeeBumpTransaction, signs only the outer
envelope with the sponsor key and never alters or resigns the inner transaction
signature (reflecting the behavior in
packages/api/rest/src/routes/wallets/submit-tx.route.ts and the
FeeBumpTransaction handling).
- Around line 341-343: Remove the "Insufficient sources from OracleAggregator
during automation" troubleshooting block from the deployment runbook and move it
into the Oracle integration guide; specifically delete the heading and paragraph
titled "`Insufficient sources` from OracleAggregator during automation" from the
contracts deployment runbook and add the same content (preserving references to
`CoinGeckoSource` and `minSources`) under an Oracle troubleshooting section in
the Oracle integration guide, and add a brief cross-reference from the
deployment runbook to the Oracle guide if desired.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bdcf1d78-5f79-4515-9598-e00a6be4c80e

📥 Commits

Reviewing files that changed from the base of the PR and between bcb56f2 and 351ac25.

📒 Files selected for processing (10)
  • docs/api/api-reference.md
  • docs/architecture/defi-aggregation-flow.md
  • docs/cli/oracle.md
  • docs/contracts/deployment-runbook.md
  • docs/contracts/deployment.md
  • docs/contracts/smart-wallet-contract.md
  • docs/guides/oracle-integration.md
  • docs/guides/social-login-integration.md
  • docs/smart-wallet/webauthn-guide.md
  • packages/core/wallet/auth/README.md

Comment on lines +400 to +435
## WebSocket API

The WebSocket server (`packages/api/websocket/`) is a Socket.io server available separately from the REST API. It provides real-time streams for market prices, transaction status, and automation events.

**Connection**

// Subscribe to updates
galaxy.websocket.subscribe('wallet:wallet123', (update) => {
console.log('Wallet updated:', update);
```ts
import { io } from 'socket.io-client';

const socket = io('http://localhost:3001', {
auth: { token: supabaseJwt },
});
```

### Python SDK
```python
from galaxy_sdk import GalaxySDK

galaxy = GalaxySDK(
api_key='your-api-key',
network='testnet'
)

# Create wallet
wallet = galaxy.wallets.create(
user_id='user123'
)

# Send payment
payment = galaxy.payments.send(
from_address=wallet.public_key,
to_address='destination-address',
amount='10',
asset='XLM'
)
**Market data channel**

```ts
socket.emit('subscribe:market', { symbol: 'XLM/USD' });
socket.on('market:price', (data) => console.log(data));
```

### JavaScript SDK
```javascript
import { GalaxySDK } from '@galaxy/sdk-javascript';
**Transaction status channel**

const galaxy = new GalaxySDK({
apiKey: 'your-api-key',
network: 'testnet'
});
```ts
socket.emit('subscribe:transaction', { hash: 'abc123...' });
socket.on('transaction:status', (data) => console.log(data.status));
```

// Create wallet
const wallet = await galaxy.wallets.create({
userId: 'user123'
});
**Automation events channel**

// Send payment
const payment = await galaxy.payments.send({
from: wallet.publicKey,
to: 'destination-address',
amount: '10',
asset: 'XLM'
});
```ts
socket.emit('subscribe:automation', { userId: 'user-abc' });
socket.on('automation:triggered', (event) => console.log(event));
socket.on('automation:executed', (result) => console.log(result));
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify WebSocket server implementation matches documented channels

# Look for Socket.io event handlers and channel names
rg -n "(subscribe:market|subscribe:transaction|subscribe:automation|market:price|transaction:status|automation:triggered|automation:executed)" packages/api/websocket/

# Check for Socket.io server setup
rg -n "socket\.io|io\(" packages/api/websocket/

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 50380


🏁 Script executed:

# Check connection-handler for subscription logic
head -100 packages/api/websocket/src/handlers/connection-handler.ts

# Search for 'subscribe' more broadly
rg -n "subscribe" packages/api/websocket/src/ --context 3

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 33336


Update WebSocket API documentation to match actual implementation event names.

The documented event names do not match the implementation:

  • Subscription events use *:subscribe pattern (e.g., market:subscribe), not subscribe:* (e.g., subscribe:market)
  • Market data event is market:price_update, not market:price
  • Client code examples on lines 410, 416, 422, and 428 will fail with the documented event names

Correct the code snippets to reflect actual event names used by the WebSocket handlers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/api/api-reference.md` around lines 400 - 435, Update the WebSocket
examples so the client uses the actual event names: replace the subscribe calls
from the `subscribe:*` pattern to the `*:subscribe` pattern (e.g., use
`market:subscribe`, `transaction:subscribe`, `automation:subscribe`), and update
the market data listener from `market:price` to `market:price_update`; leave the
transaction and automation listeners (`transaction:status`,
`automation:triggered`, `automation:executed`) as-is. Ensure the example socket
emit payloads remain unchanged and the auth/token usage is preserved.

Comment on lines +111 to +112
│ 6. buildFeeBumpTransaction(sponsorKeypair, fee, innerTx)
│ 7. feeBumpTx.sign(sponsorKeypair)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify actual fee-bump builder usage in route handlers
rg -n -C3 '\bbuildFeeBumpTransaction\s*\(' --type=ts

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 713


🏁 Script executed:

#!/bin/bash
# Read the complete buildFeeBumpTransaction call in the route file (lines 89-95)
sed -n '89,95p' packages/api/rest/src/routes/wallets/submit-tx.route.ts

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 202


🏁 Script executed:

#!/bin/bash
# Read lines 105-120 from the documentation to see the context and exact documented call
sed -n '105,120p' docs/contracts/smart-wallet-contract.md

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 902


🏁 Script executed:

#!/bin/bash
# Search for any networkPassphrase usage in the submit-tx route file
grep -n "networkPassphrase" packages/api/rest/src/routes/wallets/submit-tx.route.ts || echo "No networkPassphrase found in this file"

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 300


Fix incomplete buildFeeBumpTransaction call signature in documentation.

Line 111 documents an incomplete call signature. The actual implementation at packages/api/rest/src/routes/wallets/submit-tx.route.ts:89 includes networkPassphrase as a required fourth parameter, but the documentation omits it. This discrepancy will mislead developers attempting to implement the fee-bump flow.

Documentation fix
-                                          │  6. buildFeeBumpTransaction(sponsorKeypair, fee, innerTx)
+                                          │  6. buildFeeBumpTransaction(sponsorKeypair, fee, innerTx, networkPassphrase)
📝 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.

Suggested change
│ 6. buildFeeBumpTransaction(sponsorKeypair, fee, innerTx)
│ 7. feeBumpTx.sign(sponsorKeypair)
│ 6. buildFeeBumpTransaction(sponsorKeypair, fee, innerTx, networkPassphrase)
│ 7. feeBumpTx.sign(sponsorKeypair)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/contracts/smart-wallet-contract.md` around lines 111 - 112, The doc call
to buildFeeBumpTransaction is missing the required fourth parameter; update the
example to pass networkPassphrase as the fourth argument (matching the
implementation of buildFeeBumpTransaction used in submit-tx.route.ts), so the
call becomes buildFeeBumpTransaction(sponsorKeypair, fee, innerTx,
networkPassphrase) before feeBumpTx.sign(sponsorKeypair); ensure the
documentation explicitly names the networkPassphrase parameter so readers know
to supply the correct network string.

Comment on lines +171 to +186
name: 'Swap when XLM/USDC > 0.15',
userId: 'user-abc',
status: AutomationStatus.ACTIVE,
triggerType: TriggerType.PRICE,

conditionGroup: {
logic: ConditionLogic.AND,
conditions: [
{
type: 'price',
id: 'cond-1',
asset: 'XLM',
operator: ConditionOperator.GREATER_THAN,
threshold: 0.15,
quoteAsset: 'USD',
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Price-trigger example overstates pair support in current evaluator.

The guide repeatedly says “XLM/USDC > 0.15”, but current evaluation logic uses only condition.asset for getAggregatedPrice(...) and compares threshold; quoteAsset is not part of the check path. Please align wording/examples to current behavior (e.g., XLM/USD), or explicitly mark pair-based thresholding as future work.

Proposed doc adjustment
-  name: 'Swap when XLM/USDC > 0.15',
+  name: 'Swap when XLM/USD > 0.15',
...
-## End-to-end example — trigger a swap when XLM/USDC > 0.15
+## End-to-end example — trigger a swap when XLM/USD > 0.15

Also applies to: 264-266

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/guides/oracle-integration.md` around lines 171 - 186, The example text
claims pair-based evaluation (e.g., "XLM/USDC > 0.15") but the evaluator only
calls getAggregatedPrice(...) using condition.asset and compares the threshold
(it ignores condition.quoteAsset), so update the guide: change the examples to
use XLM/USD (or similar single-asset wording) and/or add a clear note that
quoteAsset-based pair thresholds are not supported by the current evaluator
(mark as future work); specifically edit the example block containing
condition.asset, ConditionOperator, threshold and the other occurrence at lines
referenced (the block using getAggregatedPrice/threshold and the later example
at 264-266) to reflect the current behavior and mention that quoteAsset is
currently ignored by the evaluation path.

Comment on lines +16 to +36
```
┌──────────────────────────────────────────────────────────┐
│ OAuth layer (identity) │
│ Google/Auth0/Supabase → JWT → your backend │
│ Backend extracts userId and passes it to client │
└──────────────────────────────────────────────────────────┘
│ userId only (no token forwarded to WebAuthn)
┌──────────────────────────────────────────────────────────┐
│ WebAuthn layer (key protection) │
│ navigator.credentials.create / .get │
│ Platform authenticator (Touch ID, Windows Hello, …) │
│ Private key lives in TEE / Secure Enclave — never sent │
└──────────────────────────────────────────────────────────┘
│ publicKey65Bytes (safe to store), credentialId
┌──────────────────────────────────────────────────────────┐
│ Stellar layer (wallet) │
│ SmartWalletService uses credential to sign Soroban txs │
└──────────────────────────────────────────────────────────┘
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a language tag to the fenced diagram block.

The fenced block starting at Line 16 is missing a language identifier (MD040).

Proposed fix
-```
+```text
 ...
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/guides/social-login-integration.md around lines 16 - 36, The fenced
diagram block (the ASCII diagram using triple backticks) is missing a language
identifier causing MD040 lint errors; update the opening fence to include a
language tag such as text (i.e., change totext) so the block is
recognized as a code block with an explicit language; ensure the closing fence
remains ``` and rerun linting to confirm the MD040 error is resolved.


</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +109 to +113
await supabase.from('smart_wallets').insert({
user_id: result.userId,
credential_id: result.credentialId,
public_key: Buffer.from(result.publicKey65Bytes).toString('base64'),
network: 'testnet',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Is Buffer available by default in modern browsers, or only in Node.js / bundlers with polyfills?

💡 Result:

No, Buffer is not available by default in modern browsers. It is a Node.js global API for handling binary data. Browsers provide equivalent functionality through ArrayBuffer, TypedArray (like Uint8Array), and DataView, but not the Node.js Buffer class with its specific methods (e.g., Buffer.from, Buffer.alloc, toString('hex')). To use Buffer in browsers, developers must include a polyfill such as the popular buffer npm package (feross/buffer), which provides a Buffer implementation backed by Uint8Array/ArrayBuffer. Bundlers like Webpack, Rollup, or Vite can automatically include this polyfill when Node.js-style require('buffer') is detected, but it is not native. Official Node.js documentation confirms Buffer is a Node.js subclass of Uint8Array [14,16]. MDN and browser specs document ArrayBuffer and typed arrays, but no Buffer [19,20]. Polyfill repositories and articles emphasize it is for browser compatibility with Node.js code [2,15,17,18]. No WHATWG/W3C spec standardizes Node.js Buffer for browsers, and CanIUse shows no native support [1,7]. As of 2026, bundler fallbacks have been removed in some cases (e.g., Webpack 5), requiring explicit polyfills [18].

Citations:


🏁 Script executed:

# First, let's find the documentation file
fd -type f -name "social-login-integration.md"

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 237


🏁 Script executed:

fd "social-login-integration.md"

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 106


🏁 Script executed:

cat -n docs/guides/social-login-integration.md | head -220

Repository: Galaxy-KJ/Galaxy-DevKit

Length of output: 9543


Use browser-safe base64 encoding instead of Node's Buffer.

This documentation frames the examples as browser/client-side onboarding flows (WebAuthn, navigator.credentials, window.location.hostname), but Buffer.from(...) is not available in browsers by default and requires a polyfill. Modern bundlers no longer provide implicit polyfills (e.g., Webpack 5+). Either explicitly document the polyfill requirement or use Web APIs.

Browser-safe replacement
-    public_key: Buffer.from(result.publicKey65Bytes).toString('base64'),
+    public_key: btoa(String.fromCharCode(...result.publicKey65Bytes)),

Apply to both lines 112 and 198.

📝 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.

Suggested change
await supabase.from('smart_wallets').insert({
user_id: result.userId,
credential_id: result.credentialId,
public_key: Buffer.from(result.publicKey65Bytes).toString('base64'),
network: 'testnet',
await supabase.from('smart_wallets').insert({
user_id: result.userId,
credential_id: result.credentialId,
public_key: btoa(String.fromCharCode(...result.publicKey65Bytes)),
network: 'testnet',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/guides/social-login-integration.md` around lines 109 - 113, The example
uses Node's Buffer (Buffer.from(...).toString('base64')) which isn't available
in browsers; update the insert payload construction in the
supabase.from('smart_wallets').insert call to encode result.publicKey65Bytes
using browser-safe Web APIs (e.g., convert the Uint8Array/ArrayBuffer to a
base64 string with btoa on a binary string or use TextEncoder/Blob/FileReader as
appropriate) so the docs work in client-side flows—replace usages of
Buffer.from(result.publicKey65Bytes).toString('base64') (and the same pattern at
the later occurrence) with a browser-compatible base64 encoding approach and
mention the change if needed.

@KevinMB0220 KevinMB0220 merged commit f45c7a6 into Galaxy-KJ:main Mar 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment