@primuslabs/por-client-sdk
v0.1.4
Published
Primus PoR client sdk
Readme
PoR Client SDK
Overview
The PoR Client SDK provides a client for interacting with zkTLS and zkVM, supporting authentication, program execution, and optional blockchain integration.
Build
Install dependencies and build the project:
npm install
npm run buildGetting Started
Copy
.config.example.ymlto.config.ymland configure your environment variables (see Configuration).Ensure required fields are set:
app.identity.tokenandapp.identity.projectIdfor authenticationapp.identity.programIdfor program execution
Run an example: (Need configure your Binance API Key first)
npx tsx example/binance.tsConfiguration
Structure Overview
app: # Core application configuration
identity: # Application identity and authorization info
runtime: # Runtime environment configuration
services: # External service endpoints
blockchain: # Blockchain connection and signer info
exchanges: # Exchange account configurations
binance: # Binance exchange accounts
aster: # Aster exchange accountsApplication Configuration (app)
1. Identity (app.identity)
Contains application authorization and identification.
| Field | Type | Description | Example |
| --------- | ------ | ------------------------------------------------ | ----------------- |
| token | string | Authentication token issued for this application | "my-auth-token" |
| projectId | string | Unique project identifier | "project-123" |
| programId | string | Unique program identifier | "program-abc" |
2. Runtime (app.runtime)
Specifies the runtime environment and logging.
| Field | Type | Default | Description | Example |
| ---------- | ------- | -------------- | ------------------------------------------------------ | -------------- |
| version | string | - | Application version in semantic version format (x.y.z) | "1.0.0" |
| env | string | "production" | Runtime environment (development or production) | "production" |
| logVerbose | integer | 0 | Log verbosity (0 = off, higher = more detail) | 3 |
3. Services (app.services)
External service endpoints used by the application.
zkVM Service (app.services.zkvm)
| Field | Type | Description | Example |
| ----- | ------ | ------------------------- | ---------------------------- |
| url | string | zkVM service endpoint URL | "https://zkvm.example.com" |
Data Service (app.services.data)
| Field | Type | Description | Example |
| ----- | ------ | ------------------------- | ---------------------------- |
| url | string | Data service endpoint URL | "https://data.example.com" |
4. Blockchain (app.blockchain)
Blockchain connection and signer configuration.
| Field | Type | Default | Description | Example |
| ------- | ------ | -------- | ---------------------------------------------------------------------------- | --------------------------- |
| network | string | "base" | Target blockchain network (base or base-sepolia) | "base-sepolia" |
| rpcUrl | string | - | Optional custom RPC URL. If not set, default RPC for the network is used | "https://rpc.example.com" |
| signer | object | - | Transaction signer info (required if subscriptionType is PLAN_SELF_PAID) | - |
Signer (app.blockchain.signer)
| Field | Type | Description | Example |
| ---------- | ------ | ------------------------------------------- | ------------------ |
| privateKey | string | Private key to sign blockchain transactions | "0xabcdef123..." |
Exchange Accounts (exchanges)
Supports multiple exchange accounts. At least one exchange is required. Now only support Binance and Aster.
Fields of exchange
| Field | Type | Description | Example |
| ----------- | ------- | ---------------------------------------------- | --------------------------- |
| apiKey | string | API key used to authenticate with Binance | "binance-key-123" |
| apiSecret | string | API secret corresponding to the API key | "binance-secret-abc" |
| enabled | boolean | Whether this account is active (default: true) | true |
| description | string | Optional description for this account | "My Binance spot account" |
| kind | array | Supported Binance account types | ["spot","usds-futures"] |
Data Sources
TODO: Document supported data sources and sample requests.
