@proximuslabs/sdk-solana
v0.2.0-alpha.5
Published
Proximus solana API integration SDK - alpha
Maintainers
Readme
Proximus Solana SDK
Review Solana transactions before your wallet signs them. Create an API key in your PROXIMUS dashboard, install the SDK and connect to the hosted API.
Install
Install the SDK in your application:
npm install @proximuslabs/[email protected]A direct public download is also available:
npm install https://www.proximus.sh/sdk/proximuslabs-sdk-solana-0.2.0-alpha.5.tgzCreate an API key in your PROXIMUS dashboard and pass it to the client. The SDK connects to https://api.proximus.sh by default. Customers do not deploy the security engine.
Server quickstart
import { createSolanaClient, requireAllow } from "@proximuslabs/sdk-solana";
const client = createSolanaClient({
apiKey: process.env.PROXIMUS_API_KEY,
baseUrl: process.env.PROXIMUS_BASE_URL,
});
const review = await client.reviewTransaction({
requestId: "sol_order_123_review_1",
origin: "https://wallet.example",
cluster: "devnet",
account: process.env.SOLANA_PUBLIC_KEY,
transactionBase64: process.env.UNSIGNED_TRANSACTION_BASE64,
version: 0,
});
requireAllow(review); // Throws on challenge/block. Errors also pause execution.
console.log(review.verdict);Transaction and wallet boundary
solanaAction(input) accepts serialized transaction bytes in base64, a 32-byte base58 public key and explicit cluster (mainnet-beta, devnet, testnet, localnet). Set version to "legacy", 0 or 1. Solana protected execution requires chain-state checks by default. Call client.capabilities() for the formats, instruction decoders and RPC availability supported by the hosted engine. Optional transfer metadata uses integer-string lamports up to unsigned 64-bit precision.
import { reviewAndSignTransaction } from "@proximuslabs/sdk-solana";
const { result: signedTransaction } = await reviewAndSignTransaction(
payment, reviewer, (base64, version) => yourWalletSigner(base64, version),
);reviewer calls your authenticated backend, which returns await client.authorize(action). A review-only response cannot authorize signing. Adapt your existing wallet or Wallet Standard implementation to the signing callback. The SDK does not hold keys or broadcast transactions.
The local action builder validates encoding and envelope fields. The hosted engine decodes supported instructions, checks the serialized version and signer binding, resolves v0 lookup tables and simulates unchanged transactions through configured RPCs. Token-2022 checked transfers and approvals include supported extension and transfer-fee checks. Active transfer hooks, confidential transfers, unknown extensions, arbitrary programs and multisig token authorities remain incomplete. Missing required coverage stops protected execution. The wallet remains responsible for signing and confirmation.
Protect an action
Use protectAndExecute in JavaScript or TypeScript, protect_and_execute in Python or Rust, or ProtectAndExecute in Go to review an action before calling your signer or payment provider. The SDK proceeds only when the action is allowed, its required checks completed and its execution authorization is current. Blocked, incomplete and expired reviews stop execution.
Use the returned execution ID for your provider's idempotency key. Retrieve the provider result before retrying an uncertain payment.
See the integration guide for setup, examples and supported checks. Each review shows which checks completed and whether the action can proceed.
Shared configuration and errors
apiKey: scoped server-side API key.review:writefor review submission,security:executefor execution authorization,reviews:readfor retrieval and capabilities. monitoring additionally needsmonitor:writeand a linked integration.baseUrl: defaults tohttps://api.proximus.sh. Set your own HTTPS gateway URL for self-hosting. Loopback HTTP is allowed locally. A base path such ashttps://app.example/securityis supported when your proxy mounts the contract there. The SDK does not follow redirects or send browser cookies.fetch: optional compatible implementation for your runtime.timeoutMs: default 15000, maximum 120000. Pass{ signal }to each request.- Supply an immutable
requestId. Reuse it with the identical body for retries. The SDK never retries or charges automatically.requestId()generates a secure UUID wherecrypto.randomUUIDis available. ProximusErrorexposescode,statusandretryAfter; it never includes your secret key or raw error response. 401/403 require configuration fixes, 402 is a hosted credit limit, 409 is a conflict/in-progress request, 429 is a rate limit and 503 is unavailable analysis. First retrieve uncertain reviews before deciding to submit another ID.client.getReview(requestId)returns the backend's stored review record. Hosted and reference-gateway storage shapes may differ; use the submitted review response for immediate execution gating.reviewAndExecuteand wallet/payment guards require an exact, unexpired action binding and a fresh execution claim. On your backend, callclient.authorize(action)to produce this response. Use a durable execution ID and wallet or payment-provider idempotency. A claimed attempt must be reconciled before retrying.- No telemetry, private-key custody, background scanning or direct database access is performed by these SDKs.
Use client.capabilities() to read the current supported networks, checks and behavior-model availability. Solana protection includes external_state by default, so unavailable chain simulation pauses execution.
Platforms
The transport and action builders are TypeScript with ESM/CommonJS outputs. Payment fee calculations use decimal.js for decimal arithmetic. Node 22+ is the tested server target. Browser, React Native and Electron frontends use the action builders/guards with a reviewer calling their own authenticated backend; createClient rejects known browser/React Native environments to reduce accidental secret exposure. This runtime check is a guardrail, not a substitute for secure application architecture.
examples/browser-reviewer.ts, examples/BackendReviewer.swift and examples/BackendReviewer.kt demonstrate that backend boundary. Swift and Kotlin examples are not published native SDKs. React Native may need fetch, AbortController, TextEncoder and secure UUID polyfills; compatibility depends on runtime version. Do not put long-lived API keys in mobile or desktop binaries.
Your backend must authenticate the app user, verify their ownership/permissions, derive the exact action, validate origin/CSRF where applicable, enforce quotas and apply decisions. A client can bypass its own UI guard.
Language packages
All six SDK products are available in TypeScript, Go, Python and Rust under Apache 2.0. The TypeScript package stays at the repository root. Each language has typed feature inputs, guarded execution, exact amounts, hosted/self-hosted URLs, examples and loopback HTTP tests.
| Language | Package and setup | | --- | --- | | TypeScript | This directory - ESM, CommonJS and declarations | | Go | go/README.md - standard library, context cancellation | | Python | python/README.md - Python 3.10+, standard library, typed inputs | | Rust | rust/README.md - blocking reqwest, serde types |
Public release packages are available through the installation guide. Python uses the equivalent version 0.2.0a5. The guide selects a verified registry release or a direct PROXIMUS package URL for each language.
Platform APIs
Use the platform SDK for chat, agents, testing and workspace APIs. This specialized package retains its review contract and execution guards. See the API reference for current public operations and required scopes.
Contributing
Bug reports, examples and pull requests are welcome. Read CONTRIBUTING.md to get started and SECURITY.md to report a vulnerability.
License
Copyright 2026 PROXIMUS Research Labs Foundation. The SDK is licensed under Apache 2.0, which permits integration, modification and commercial use subject to its terms. The license grants permission to use the code, it does not transfer copyright or grant rights to PROXIMUS trademarks. Hosted services have separate access and pricing terms. See LICENSE and NOTICE.
Payment fee estimates
Use estimatePaymentFees to calculate the PROXIMUS curve, partner fees and a network-cost reserve in exact atomic units. prepareAndExecutePayment calls your existing provider to prepare the complete unsigned payment, reviews that final action and invokes execution once after authorization. Include every fee recipient and amount before review.
The same workflow is available as estimate_payment_fees and prepare_and_execute_payment in Python and Rust, and EstimatePaymentFees and PrepareAndExecutePayment in Go. Amounts use integer strings. The estimate does not sign a transaction or collect a payment.
See payment integration for arguments, return values, examples and supported execution responsibilities.
