@stockkit/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 StockKit Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # @stockkit/sdk
2
+
3
+ TypeScript client for the [StockKit API](https://api.stockkit.dev): tokenized stocks on [Robinhood Chain](https://robinhoodchain.blockscout.com).
4
+
5
+ StockKit gives developers one layer for discovering tokenized assets, reading live prices, valuing portfolios, getting executable DEX quotes, and building trades. It is non-custodial: the API returns unsigned transactions, and you sign with your own wallet. StockKit never holds keys and never executes trades.
6
+
7
+ Docs: https://docs.stockkit.dev
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @stockkit/sdk
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { StockKit } from "@stockkit/sdk"
19
+
20
+ const stockkit = new StockKit()
21
+
22
+ // All tokenized assets on Robinhood Chain, with onchain addresses
23
+ const { assets } = await stockkit.assets.list()
24
+
25
+ // Live price (raw underlying and multiplier-adjusted per-token values)
26
+ const price = await stockkit.prices.get("NVDA")
27
+
28
+ // Any wallet's tokenized-stock positions, valued in USD
29
+ const portfolio = await stockkit.portfolio.get("0xYourWalletAddress")
30
+
31
+ // Executable quote from Uniswap v3 pools on Robinhood Chain
32
+ const quote = await stockkit.trade.quote({ ticker: "NVDA", amount: 100 })
33
+
34
+ // Unsigned approve + swap transactions; sign with your own wallet
35
+ const tx = await stockkit.trade.build({
36
+ ticker: "NVDA",
37
+ amount: 100,
38
+ recipient: "0xYourWalletAddress",
39
+ slippageBps: 50,
40
+ })
41
+ ```
42
+
43
+ Signing and submitting the built steps is up to you, for example with viem:
44
+
45
+ ```ts
46
+ for (const step of tx.steps) {
47
+ await walletClient.sendTransaction({
48
+ to: step.to as `0x${string}`,
49
+ data: step.data as `0x${string}`,
50
+ value: BigInt(step.value),
51
+ })
52
+ }
53
+ ```
54
+
55
+ ## API surface
56
+
57
+ | Method | Endpoint |
58
+ | --- | --- |
59
+ | `assets.list()` | `GET /v1/assets` |
60
+ | `assets.get(symbol)` | `GET /v1/assets/:symbol` |
61
+ | `prices.get(symbol)` | `GET /v1/prices/:symbol` |
62
+ | `portfolio.get(address)` | `GET /v1/portfolio/:address` |
63
+ | `corporateActions.list()` | `GET /v1/corporate-actions` |
64
+ | `trade.quote(params)` | `GET /v1/quote` |
65
+ | `trade.build(params)` | `POST /v1/trade/build` |
66
+
67
+ All responses are fully typed. Errors throw `StockKitError` with `status` and `code`.
68
+
69
+ ## Options
70
+
71
+ ```ts
72
+ new StockKit({
73
+ baseUrl: "https://api.stockkit.dev", // default
74
+ fetch: customFetch, // optional fetch implementation
75
+ })
76
+ ```
77
+
78
+ The API is open during the beta; no API key is required.
79
+
80
+ ## Disclaimer
81
+
82
+ StockKit provides software infrastructure only. Nothing in this package is investment advice, and tokenized assets carry risk. Review every transaction before signing.
83
+
84
+ ## License
85
+
86
+ MIT
@@ -0,0 +1,134 @@
1
+ export type Asset = {
2
+ symbol: string;
3
+ name: string;
4
+ address: string;
5
+ chainId: number;
6
+ decimals: number;
7
+ multiplier: string;
8
+ pendingMultiplier: string | null;
9
+ status: string;
10
+ logoUrl: string;
11
+ tradingCapabilities: unknown;
12
+ isin: string;
13
+ };
14
+ export type Price = {
15
+ symbol: string;
16
+ currency: string;
17
+ underlying: {
18
+ bid: string;
19
+ ask: string;
20
+ mid: string;
21
+ };
22
+ token: {
23
+ bid: string;
24
+ ask: string;
25
+ mid: string;
26
+ multiplier: string;
27
+ };
28
+ dailyHigh: string;
29
+ dailyLow: string;
30
+ dailyTradingVolume: string;
31
+ halted: boolean;
32
+ asOf: string;
33
+ };
34
+ export type Position = {
35
+ symbol: string;
36
+ name: string;
37
+ address: string;
38
+ balance: string;
39
+ decimals: number;
40
+ usdPrice: string | null;
41
+ usdValue: string | null;
42
+ };
43
+ export type Portfolio = {
44
+ address: string;
45
+ chainId: number;
46
+ positions: Position[];
47
+ totalUsdValue: string;
48
+ asOf: string;
49
+ };
50
+ export type Quote = {
51
+ symbol: string;
52
+ tokenAddress: string;
53
+ side: "buy" | "sell";
54
+ mode: "exactIn" | "exactOut";
55
+ feeTier: number;
56
+ usdAmount: string;
57
+ tokenAmount: string;
58
+ effectivePricePerToken: string | null;
59
+ gasEstimate: string;
60
+ venue: string;
61
+ pair: string;
62
+ asOf: string;
63
+ };
64
+ export type TransactionStep = {
65
+ description: string;
66
+ to: string;
67
+ data: string;
68
+ value: string;
69
+ };
70
+ export type BuiltTrade = {
71
+ symbol: string;
72
+ tokenAddress: string;
73
+ chainId: number;
74
+ quote: Omit<Quote, "symbol" | "tokenAddress" | "asOf">;
75
+ slippageBps: number;
76
+ deadline: number;
77
+ steps: TransactionStep[];
78
+ note: string;
79
+ };
80
+ export type QuoteParams = {
81
+ ticker: string;
82
+ side?: "buy" | "sell";
83
+ amount: number | string;
84
+ denom?: "usd" | "token";
85
+ };
86
+ export type BuildParams = QuoteParams & {
87
+ recipient: string;
88
+ slippageBps?: number;
89
+ };
90
+ export declare class StockKitError extends Error {
91
+ status: number;
92
+ code: string;
93
+ constructor(message: string, status: number, code: string);
94
+ }
95
+ export type StockKitOptions = {
96
+ baseUrl?: string;
97
+ /** Reserved for future authenticated endpoints. */
98
+ apiKey?: string;
99
+ fetch?: typeof fetch;
100
+ };
101
+ export declare class StockKit {
102
+ private baseUrl;
103
+ private fetchFn;
104
+ private apiKey?;
105
+ constructor(options?: StockKitOptions);
106
+ private request;
107
+ assets: {
108
+ list: () => Promise<{
109
+ assets: Asset[];
110
+ count: number;
111
+ }>;
112
+ get: (symbol: string) => Promise<Asset>;
113
+ };
114
+ prices: {
115
+ get: (symbol: string) => Promise<Price>;
116
+ };
117
+ portfolio: {
118
+ get: (address: string) => Promise<Portfolio>;
119
+ };
120
+ corporateActions: {
121
+ list: () => Promise<{
122
+ corpActions: unknown[];
123
+ }>;
124
+ };
125
+ trade: {
126
+ quote: (params: QuoteParams) => Promise<Quote>;
127
+ /**
128
+ * Builds unsigned transactions for the swap. Sign and submit them with
129
+ * your own wallet (viem, ethers, etc.); StockKit never touches keys.
130
+ */
131
+ build: (params: BuildParams) => Promise<BuiltTrade>;
132
+ };
133
+ }
134
+ export default StockKit;
package/dist/index.js ADDED
@@ -0,0 +1,76 @@
1
+ // StockKit SDK: thin typed client for api.stockkit.dev.
2
+ // Read data, get DEX quotes, and build unsigned transactions for tokenized
3
+ // stocks on Robinhood Chain. StockKit never holds keys or executes trades.
4
+ export class StockKitError extends Error {
5
+ status;
6
+ code;
7
+ constructor(message, status, code) {
8
+ super(message);
9
+ this.status = status;
10
+ this.code = code;
11
+ this.name = "StockKitError";
12
+ }
13
+ }
14
+ export class StockKit {
15
+ baseUrl;
16
+ fetchFn;
17
+ apiKey;
18
+ constructor(options = {}) {
19
+ this.baseUrl = (options.baseUrl ?? "https://api.stockkit.dev").replace(/\/$/, "");
20
+ this.fetchFn = options.fetch ?? fetch;
21
+ this.apiKey = options.apiKey;
22
+ }
23
+ async request(path, init) {
24
+ const headers = { accept: "application/json" };
25
+ if (init?.body)
26
+ headers["content-type"] = "application/json";
27
+ if (this.apiKey)
28
+ headers.authorization = `Bearer ${this.apiKey}`;
29
+ const res = await this.fetchFn(`${this.baseUrl}${path}`, { ...init, headers });
30
+ const body = (await res.json());
31
+ if (!res.ok) {
32
+ throw new StockKitError(body?.error?.message ?? `Request failed with ${res.status}`, res.status, body?.error?.code ?? "unknown");
33
+ }
34
+ return body;
35
+ }
36
+ assets = {
37
+ list: () => this.request("/v1/assets"),
38
+ get: (symbol) => this.request(`/v1/assets/${encodeURIComponent(symbol)}`),
39
+ };
40
+ prices = {
41
+ get: (symbol) => this.request(`/v1/prices/${encodeURIComponent(symbol)}`),
42
+ };
43
+ portfolio = {
44
+ get: (address) => this.request(`/v1/portfolio/${encodeURIComponent(address)}`),
45
+ };
46
+ corporateActions = {
47
+ list: () => this.request("/v1/corporate-actions"),
48
+ };
49
+ trade = {
50
+ quote: (params) => {
51
+ const search = new URLSearchParams({
52
+ symbol: params.ticker,
53
+ side: params.side ?? "buy",
54
+ amount: String(params.amount),
55
+ denom: params.denom ?? "usd",
56
+ });
57
+ return this.request(`/v1/quote?${search}`);
58
+ },
59
+ /**
60
+ * Builds unsigned transactions for the swap. Sign and submit them with
61
+ * your own wallet (viem, ethers, etc.); StockKit never touches keys.
62
+ */
63
+ build: (params) => this.request("/v1/trade/build", {
64
+ method: "POST",
65
+ body: JSON.stringify({
66
+ symbol: params.ticker,
67
+ side: params.side ?? "buy",
68
+ amount: String(params.amount),
69
+ denom: params.denom ?? "usd",
70
+ recipient: params.recipient,
71
+ slippageBps: params.slippageBps,
72
+ }),
73
+ }),
74
+ };
75
+ }
76
+ export default StockKit;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@stockkit/sdk",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript client for the StockKit API: tokenized stocks on Robinhood Chain.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": ["dist"],
15
+ "sideEffects": false,
16
+ "license": "MIT",
17
+ "author": "StockKit Labs",
18
+ "homepage": "https://stockkit.dev",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/stockkit-labs/sdk.git"
22
+ },
23
+ "bugs": "https://github.com/stockkit-labs/sdk/issues",
24
+ "keywords": [
25
+ "stockkit",
26
+ "robinhood-chain",
27
+ "tokenized-stocks",
28
+ "rwa",
29
+ "defi",
30
+ "trading",
31
+ "typescript"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "check": "tsc --noEmit"
39
+ },
40
+ "devDependencies": {
41
+ "typescript": "^5.7.0"
42
+ }
43
+ }