Repository navigation
feat: admin rotation cooldown, API key scoping, core SDK bundle, RPC failover - #1503
Merged
joelpeace48-cell merged 4 commits intoOct 21, 2026
Conversation
Emergency admin rotation now records the proposal timestamp and refuses accept_admin until ADMIN_ROTATION_COOLDOWN_SECS (86400) has elapsed, returning Error::AdminCooldownActive if called too early. Covers both the rewards and campaign contracts.
…dpoints Operator-facing routes now require campaigns:read for authenticated GETs and campaigns:write for mutations, so external integrations can be issued read-only or write-scoped keys. Removes duplicate unscoped registrations for campaign update/delete/publish/archive that previously bypassed scope checks.
New vanilla JS/TS SDK entry point with zero UI framework dependencies. Provides a minimal fetch-based REST client for Node and browser runtimes and a framework-free package surface for external integrations.
RpcNodeManager tries the primary Soroban RPC node first and fails over to secondary nodes on HTTP 5xx or transport errors. Unhealthy nodes are reconnected automatically after a backoff window. Includes unit tests covering failover, recovery, and error classification.
|
@trustosaretin 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! 🚀 |
| throw new Error('fetch is not available in this runtime; pass config.fetchImpl'); | ||
| } | ||
|
|
||
| const baseUrl = config.baseUrl.replace(/\/+$/, ''); |
joelpeace48-cell
merged commit Oct 21, 2026
d6c91e4
into
FinesseStudioLab:main
7 of 29 checks passed
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 #1353, Closes #1359, Closes #1360, Closes #1361
Type of Change
Summary
Four focused changes covering contract admin safety, API key scoping, a framework-free SDK entry point, and RPC failover. Each issue is resolved in a single dedicated commit with tests where the surrounding code already had a test harness.
Motivation / Context
Closes #1353, Closes #1359, Closes #1360, Closes #1361
Changes
#1353 — 24-hour admin rotation cooling period (
98f23145)propose_adminnow records the proposal timestamp inPENDING_ADMIN_AT.accept_adminrejects withError::AdminCooldownActive(code128) untilADMIN_ROTATION_COOLDOWN_SECS(86 400) has elapsed.contracts/campaignandcontracts/rewards.#1361 — read/write API key scoping on operator REST endpoints (
dfcd53b0)campaigns:read.campaigns:write.#1359 —
@trivela/corelightweight bundle (7e3e5322)sdk/core/package with zero UI framework dependencies.http.ts) that works in Node and the browser.index.tsandpackage.json.#1360 — auto-reconnect fallback RPC node manager (
edd38bde)RpcNodeManagertries the primary Soroban RPC node first and fails over to secondaries on HTTP 5xx or transport errors.sdk/core/test/rpc.test.ts).Testing
cargo testincontracts/campaignandcontracts/rewards— new casestest_campaign_accept_admin_before_cooldown_fails,test_campaign_propose_and_accept_admin_happy_path,test_campaign_only_pending_can_accept,test_campaign_propose_without_accept_keeps_old_adminsdk/core/test/rpc.test.ts— failover on 5xx, transport-error fallback, backoff recovery, error classificationbackend/src/index.js; scope middleware unchanged, only route registrations updatedTradeoffs
instance()storage) — simplest correct choice for a single-admin rotation slot; no per-key history is kept.proposed_atdefaults to0when missing, so a legacy pending admin (pre-upgrade) is immediately acceptable rather than locking the contract.RpcNodeManageruses a fixed backoff window rather than exponential — keeps the surface small and testable.Out of scope
unwrap_or(0)fallback).packages/sdkReact-coupled bundle;@trivela/coreis additive.