@stocklayer/sdk 0.0.0-stage → 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/CHANGELOG.md +142 -0
- package/LICENSE +21 -0
- package/README.md +141 -2
- package/dist/index.d.ts +120 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +259 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +377 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -4
- package/src/index.ts +432 -0
- package/src/types.ts +445 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
export { ROBINHOOD_CHAIN_ID } from './types.js';
|
|
2
|
+
/** The API version this SDK release targets. */
|
|
3
|
+
export const API_VERSION = 'v0';
|
|
4
|
+
/** Keep in sync with `package.json`; verified by the test suite. */
|
|
5
|
+
export const SDK_VERSION = '0.1.0';
|
|
6
|
+
export class StocklayerApiError extends Error {
|
|
7
|
+
status;
|
|
8
|
+
code;
|
|
9
|
+
retryable;
|
|
10
|
+
details;
|
|
11
|
+
requestId;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
super(options.message);
|
|
14
|
+
this.name = 'StocklayerApiError';
|
|
15
|
+
this.status = options.status;
|
|
16
|
+
this.code = options.code;
|
|
17
|
+
this.retryable = options.retryable ?? false;
|
|
18
|
+
this.details = options.details ?? null;
|
|
19
|
+
this.requestId = options.requestId ?? null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function numberHeader(headers, name) {
|
|
23
|
+
const value = headers.get(name);
|
|
24
|
+
if (value === null)
|
|
25
|
+
return null;
|
|
26
|
+
const parsed = Number(value);
|
|
27
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
28
|
+
}
|
|
29
|
+
export function readResponseInfo(response) {
|
|
30
|
+
const headers = response.headers;
|
|
31
|
+
const environment = headers.get('x-stocklayer-environment');
|
|
32
|
+
const limit = numberHeader(headers, 'x-ratelimit-limit');
|
|
33
|
+
const remaining = numberHeader(headers, 'x-ratelimit-remaining');
|
|
34
|
+
const resetAt = numberHeader(headers, 'x-ratelimit-reset');
|
|
35
|
+
const monthlyLimit = numberHeader(headers, 'x-stocklayer-monthly-limit');
|
|
36
|
+
const monthlyRemaining = numberHeader(headers, 'x-stocklayer-monthly-remaining');
|
|
37
|
+
return {
|
|
38
|
+
requestId: headers.get('x-request-id'),
|
|
39
|
+
status: response.status,
|
|
40
|
+
sandbox: headers.get('x-stocklayer-sandbox') === 'on',
|
|
41
|
+
plan: headers.get('x-stocklayer-plan'),
|
|
42
|
+
environment: environment === 'test' || environment === 'live' ? environment : null,
|
|
43
|
+
rateLimit: limit !== null && remaining !== null && resetAt !== null
|
|
44
|
+
? { limit, remaining, resetAt }
|
|
45
|
+
: null,
|
|
46
|
+
monthly: monthlyLimit !== null && monthlyRemaining !== null
|
|
47
|
+
? { limit: monthlyLimit, remaining: monthlyRemaining }
|
|
48
|
+
: null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function normalizedTimeout(value, fallback) {
|
|
52
|
+
const timeout = value ?? fallback;
|
|
53
|
+
if (!Number.isSafeInteger(timeout) || timeout < 0) {
|
|
54
|
+
throw new TypeError('timeoutMs must be a non-negative integer');
|
|
55
|
+
}
|
|
56
|
+
return timeout;
|
|
57
|
+
}
|
|
58
|
+
function delay(ms, signal) {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
if (signal?.aborted) {
|
|
61
|
+
reject(signal.reason);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const timer = setTimeout(() => {
|
|
65
|
+
signal?.removeEventListener('abort', onAbort);
|
|
66
|
+
resolve();
|
|
67
|
+
}, ms);
|
|
68
|
+
const onAbort = () => {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
reject(signal?.reason);
|
|
71
|
+
};
|
|
72
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export class StocklayerClient {
|
|
76
|
+
system;
|
|
77
|
+
assets;
|
|
78
|
+
prices;
|
|
79
|
+
corporateActions;
|
|
80
|
+
portfolios;
|
|
81
|
+
quotes;
|
|
82
|
+
trades;
|
|
83
|
+
transactions;
|
|
84
|
+
/** Metadata from the most recent response, including limits and sandbox state. */
|
|
85
|
+
lastResponse = null;
|
|
86
|
+
baseUrl;
|
|
87
|
+
apiKey;
|
|
88
|
+
scenario;
|
|
89
|
+
retries;
|
|
90
|
+
timeoutMs;
|
|
91
|
+
requestFetch;
|
|
92
|
+
constructor(options) {
|
|
93
|
+
this.baseUrl = options.baseUrl.replace(/\/$/, '');
|
|
94
|
+
this.apiKey = options.apiKey;
|
|
95
|
+
this.scenario = options.scenario;
|
|
96
|
+
this.retries = options.retries ?? 2;
|
|
97
|
+
if (!Number.isSafeInteger(this.retries) || this.retries < 0) {
|
|
98
|
+
throw new TypeError('retries must be a non-negative integer');
|
|
99
|
+
}
|
|
100
|
+
this.timeoutMs = normalizedTimeout(options.timeoutMs, 30_000);
|
|
101
|
+
this.requestFetch = options.fetch ?? globalThis.fetch;
|
|
102
|
+
this.system = {
|
|
103
|
+
index: (requestOptions) => this.request('', { requestOptions }),
|
|
104
|
+
health: (requestOptions) => this.request('/health', { requestOptions }),
|
|
105
|
+
};
|
|
106
|
+
this.assets = {
|
|
107
|
+
list: (options = {}, requestOptions) => this.request('/assets', { query: options, requestOptions }),
|
|
108
|
+
get: (symbol, requestOptions) => this.request(`/assets/${encodeURIComponent(symbol)}`, {
|
|
109
|
+
requestOptions,
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
112
|
+
this.prices = {
|
|
113
|
+
get: (symbol, requestOptions) => this.request(`/prices/${encodeURIComponent(symbol)}`, {
|
|
114
|
+
requestOptions,
|
|
115
|
+
}),
|
|
116
|
+
};
|
|
117
|
+
this.corporateActions = {
|
|
118
|
+
list: (options = {}, requestOptions) => this.request('/corporate-actions', {
|
|
119
|
+
query: options,
|
|
120
|
+
requestOptions,
|
|
121
|
+
}),
|
|
122
|
+
};
|
|
123
|
+
this.portfolios = {
|
|
124
|
+
get: (wallet, options = {}, requestOptions) => this.request(`/portfolios/${encodeURIComponent(wallet)}`, {
|
|
125
|
+
query: {
|
|
126
|
+
symbols: options.symbols?.join(','),
|
|
127
|
+
includeZero: options.includeZero,
|
|
128
|
+
},
|
|
129
|
+
requestOptions,
|
|
130
|
+
}),
|
|
131
|
+
};
|
|
132
|
+
this.quotes = {
|
|
133
|
+
create: (body, requestOptions) => this.request('/quotes', {
|
|
134
|
+
method: 'POST',
|
|
135
|
+
body,
|
|
136
|
+
requestOptions,
|
|
137
|
+
}),
|
|
138
|
+
};
|
|
139
|
+
this.trades = {
|
|
140
|
+
plan: (body, options = {}) => {
|
|
141
|
+
const idempotencyKey = options.idempotencyKey ?? crypto.randomUUID();
|
|
142
|
+
return this.request('/trades/plan', {
|
|
143
|
+
method: 'POST',
|
|
144
|
+
body,
|
|
145
|
+
headers: { 'idempotency-key': idempotencyKey },
|
|
146
|
+
idempotent: true,
|
|
147
|
+
requestOptions: options,
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
get: (planId, requestOptions) => this.request(`/trade-plans/${encodeURIComponent(planId)}`, {
|
|
151
|
+
requestOptions,
|
|
152
|
+
}),
|
|
153
|
+
};
|
|
154
|
+
this.transactions = {
|
|
155
|
+
simulate: (body, requestOptions) => this.request('/transactions/simulate', {
|
|
156
|
+
method: 'POST',
|
|
157
|
+
body,
|
|
158
|
+
requestOptions,
|
|
159
|
+
}),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
async request(path, options = {}) {
|
|
163
|
+
const method = options.method ?? 'GET';
|
|
164
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
165
|
+
for (const [key, value] of Object.entries(options.query ?? {})) {
|
|
166
|
+
if (value !== undefined)
|
|
167
|
+
url.searchParams.set(key, String(value));
|
|
168
|
+
}
|
|
169
|
+
const attempts = method === 'GET' || options.idempotent ? this.retries + 1 : 1;
|
|
170
|
+
let lastError = null;
|
|
171
|
+
const timeoutMs = normalizedTimeout(options.requestOptions?.timeoutMs, this.timeoutMs);
|
|
172
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
173
|
+
const timeoutSignal = timeoutMs > 0 ? AbortSignal.timeout(timeoutMs) : undefined;
|
|
174
|
+
const signal = timeoutSignal && options.requestOptions?.signal
|
|
175
|
+
? AbortSignal.any([timeoutSignal, options.requestOptions.signal])
|
|
176
|
+
: (timeoutSignal ?? options.requestOptions?.signal);
|
|
177
|
+
let response;
|
|
178
|
+
let envelope = null;
|
|
179
|
+
try {
|
|
180
|
+
response = await this.requestFetch(url, {
|
|
181
|
+
method,
|
|
182
|
+
signal,
|
|
183
|
+
headers: {
|
|
184
|
+
accept: 'application/json',
|
|
185
|
+
...(options.body ? { 'content-type': 'application/json' } : {}),
|
|
186
|
+
...(this.apiKey ? { authorization: `Bearer ${this.apiKey}` } : {}),
|
|
187
|
+
...(this.scenario ? { 'x-stocklayer-scenario': this.scenario } : {}),
|
|
188
|
+
...options.headers,
|
|
189
|
+
},
|
|
190
|
+
body: options.body ? JSON.stringify(options.body) : undefined,
|
|
191
|
+
});
|
|
192
|
+
this.lastResponse = readResponseInfo(response);
|
|
193
|
+
try {
|
|
194
|
+
const body = await response.json();
|
|
195
|
+
if (body && typeof body === 'object' && !Array.isArray(body)) {
|
|
196
|
+
envelope = body;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
if (signal?.aborted)
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (!signal?.aborted)
|
|
206
|
+
throw error;
|
|
207
|
+
const cancelled = options.requestOptions?.signal?.aborted === true;
|
|
208
|
+
lastError = new StocklayerApiError({
|
|
209
|
+
status: 0,
|
|
210
|
+
code: cancelled ? 'REQUEST_ABORTED' : 'REQUEST_TIMEOUT',
|
|
211
|
+
message: cancelled
|
|
212
|
+
? 'Stocklayer request was cancelled'
|
|
213
|
+
: 'Stocklayer request timed out',
|
|
214
|
+
retryable: !cancelled,
|
|
215
|
+
});
|
|
216
|
+
const isLast = attempt === attempts - 1;
|
|
217
|
+
if (!lastError.retryable || isLast)
|
|
218
|
+
throw lastError;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
const info = readResponseInfo(response);
|
|
222
|
+
this.lastResponse = info;
|
|
223
|
+
if (response.ok &&
|
|
224
|
+
envelope &&
|
|
225
|
+
Object.hasOwn(envelope, 'data') &&
|
|
226
|
+
!envelope.error) {
|
|
227
|
+
return envelope.data;
|
|
228
|
+
}
|
|
229
|
+
lastError = new StocklayerApiError({
|
|
230
|
+
status: response.status,
|
|
231
|
+
code: envelope?.error?.code ?? 'API_ERROR',
|
|
232
|
+
message: envelope?.error?.message ??
|
|
233
|
+
(response.ok
|
|
234
|
+
? 'Stocklayer API returned an invalid response envelope'
|
|
235
|
+
: `Stocklayer API returned HTTP ${response.status}`),
|
|
236
|
+
retryable: envelope?.error?.retryable ??
|
|
237
|
+
(response.status === 429 || response.status >= 500),
|
|
238
|
+
details: envelope?.error?.details,
|
|
239
|
+
requestId: envelope?.meta?.requestId ?? info.requestId,
|
|
240
|
+
});
|
|
241
|
+
const isLast = attempt === attempts - 1;
|
|
242
|
+
if (!lastError.retryable || isLast)
|
|
243
|
+
throw lastError;
|
|
244
|
+
const retryAfter = numberHeader(response.headers, 'retry-after');
|
|
245
|
+
try {
|
|
246
|
+
await delay(retryAfter !== null ? retryAfter * 1000 : 250 * 2 ** attempt, options.requestOptions?.signal);
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
throw new StocklayerApiError({
|
|
250
|
+
status: 0,
|
|
251
|
+
code: 'REQUEST_ABORTED',
|
|
252
|
+
message: 'Stocklayer request was cancelled',
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
throw lastError ?? new Error('unreachable');
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAa,CAAC;AACzC,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AA4CnC,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,MAAM,CAAS;IACf,IAAI,CAAS;IACb,SAAS,CAAU;IACnB,OAAO,CAAU;IACjB,SAAS,CAAgB;IAElC,YAAY,OAOX;QACC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;IAC7C,CAAC;CACF;AAID,SAAS,YAAY,CAAC,OAAgB,EAAE,IAAY;IAClD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,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BACP,MAAM,IAAI,kBAAkB,CAAC;oBAC3B,MAAM,EAAE,CAAC;oBACT,IAAI,EAAE,iBAAiB;oBACvB,OAAO,EAAE,kCAAkC;iBAC5C,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,MAAM,SAAS,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public request and response models for the Stocklayer V0 API.
|
|
3
|
+
*
|
|
4
|
+
* This file is the single source of truth for the wire contract. The
|
|
5
|
+
* application re-exports it from `src/core/types.ts`, so services, route
|
|
6
|
+
* handlers, the OpenAPI document, and the SDK all describe the same shapes.
|
|
7
|
+
* It has no runtime imports so it can ship inside the SDK unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export type Address = `0x${string}`;
|
|
10
|
+
export type Hex = `0x${string}`;
|
|
11
|
+
export declare const ROBINHOOD_CHAIN_ID = 4663;
|
|
12
|
+
export type RobinhoodChainId = typeof ROBINHOOD_CHAIN_ID;
|
|
13
|
+
export type ApiVersion = 'v0';
|
|
14
|
+
export interface ApiMeta {
|
|
15
|
+
requestId: string;
|
|
16
|
+
version: ApiVersion;
|
|
17
|
+
generatedAt: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ApiSuccess<T> {
|
|
20
|
+
data: T;
|
|
21
|
+
meta: ApiMeta;
|
|
22
|
+
}
|
|
23
|
+
export interface ApiErrorBody {
|
|
24
|
+
code: string;
|
|
25
|
+
message: string;
|
|
26
|
+
retryable: boolean;
|
|
27
|
+
details: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface ApiFailure {
|
|
30
|
+
error: ApiErrorBody;
|
|
31
|
+
meta: ApiMeta;
|
|
32
|
+
}
|
|
33
|
+
export type AssetStatus = 'active' | 'inactive' | 'unspecified';
|
|
34
|
+
export interface AssetDeployment {
|
|
35
|
+
chainId: number;
|
|
36
|
+
contractAddress: Address;
|
|
37
|
+
}
|
|
38
|
+
export interface CanonicalAsset {
|
|
39
|
+
id: string;
|
|
40
|
+
symbol: string;
|
|
41
|
+
name: string;
|
|
42
|
+
status: AssetStatus;
|
|
43
|
+
currentMultiplier: string;
|
|
44
|
+
pendingMultiplier: string | null;
|
|
45
|
+
pendingMultiplierEffectiveTime: string | null;
|
|
46
|
+
deployments: AssetDeployment[];
|
|
47
|
+
logoUrl: string | null;
|
|
48
|
+
tradingCapabilities: Record<string, unknown> | null;
|
|
49
|
+
provenance: {
|
|
50
|
+
source: 'robinhood';
|
|
51
|
+
sourceUrl: string;
|
|
52
|
+
retrievedAt: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface AssetList {
|
|
56
|
+
assets: CanonicalAsset[];
|
|
57
|
+
next: string | null;
|
|
58
|
+
total: number;
|
|
59
|
+
}
|
|
60
|
+
export type CorporateActionType = 'forward_split' | 'reverse_split' | 'cash_dividend' | 'stock_dividend' | 'spin_off' | 'cash_merger' | 'stock_merger' | 'stock_and_cash_merger' | 'redemption' | 'name_change' | 'worthless_removal' | 'rights_distribution' | 'unit_split' | 'unspecified';
|
|
61
|
+
export type CorporateActionStatus = 'in_progress' | 'completed' | 'unspecified';
|
|
62
|
+
export interface CorporateAction {
|
|
63
|
+
id: string;
|
|
64
|
+
type: CorporateActionType;
|
|
65
|
+
/** Original Robinhood enum, retained for forward compatibility. */
|
|
66
|
+
sourceType: string;
|
|
67
|
+
status: CorporateActionStatus;
|
|
68
|
+
/** ISO calendar date (YYYY-MM-DD), or null when Robinhood has not scheduled it. */
|
|
69
|
+
processDate: string | null;
|
|
70
|
+
asset: {
|
|
71
|
+
symbol: string;
|
|
72
|
+
deployments: AssetDeployment[];
|
|
73
|
+
};
|
|
74
|
+
/** Exactly one Robinhood-defined variant is present for known action types. */
|
|
75
|
+
details: Record<string, unknown>;
|
|
76
|
+
provenance: {
|
|
77
|
+
source: 'robinhood';
|
|
78
|
+
sourceUrl: string;
|
|
79
|
+
retrievedAt: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface CorporateActionList {
|
|
83
|
+
actions: CorporateAction[];
|
|
84
|
+
total: number;
|
|
85
|
+
}
|
|
86
|
+
export interface SystemToken {
|
|
87
|
+
kind: 'system';
|
|
88
|
+
symbol: string;
|
|
89
|
+
name: string;
|
|
90
|
+
address: Address;
|
|
91
|
+
decimals: number;
|
|
92
|
+
chainId: number;
|
|
93
|
+
}
|
|
94
|
+
export interface MarketToken {
|
|
95
|
+
kind: 'market';
|
|
96
|
+
symbol: string;
|
|
97
|
+
name: string;
|
|
98
|
+
address: Address;
|
|
99
|
+
decimals: number;
|
|
100
|
+
chainId: number;
|
|
101
|
+
asset: CanonicalAsset;
|
|
102
|
+
}
|
|
103
|
+
export type ResolvedToken = SystemToken | MarketToken;
|
|
104
|
+
export interface PriceObservation {
|
|
105
|
+
asset: Pick<CanonicalAsset, 'id' | 'symbol' | 'name' | 'status'>;
|
|
106
|
+
currency: string;
|
|
107
|
+
rawUnderlying: {
|
|
108
|
+
bid: string;
|
|
109
|
+
ask: string;
|
|
110
|
+
mid: string;
|
|
111
|
+
source: 'robinhood-rest';
|
|
112
|
+
};
|
|
113
|
+
tokenEquivalent: {
|
|
114
|
+
bid: string;
|
|
115
|
+
ask: string;
|
|
116
|
+
mid: string;
|
|
117
|
+
multiplier: string;
|
|
118
|
+
calculation: 'underlying_price_x_current_multiplier';
|
|
119
|
+
};
|
|
120
|
+
isTradingHalt: boolean;
|
|
121
|
+
dailyTradingVolume: string;
|
|
122
|
+
generatedAt: string;
|
|
123
|
+
retrievedAt: string;
|
|
124
|
+
}
|
|
125
|
+
export interface PortfolioPosition {
|
|
126
|
+
asset: {
|
|
127
|
+
kind: 'system' | 'market';
|
|
128
|
+
symbol: string;
|
|
129
|
+
name: string;
|
|
130
|
+
contractAddress: Address;
|
|
131
|
+
decimals: number;
|
|
132
|
+
};
|
|
133
|
+
balance: {
|
|
134
|
+
raw: string;
|
|
135
|
+
formatted: string;
|
|
136
|
+
};
|
|
137
|
+
/** Underlying quantity for market tokens (`balance × currentMultiplier`); null for system tokens. */
|
|
138
|
+
underlyingQuantity: string | null;
|
|
139
|
+
}
|
|
140
|
+
export interface Portfolio {
|
|
141
|
+
wallet: Address;
|
|
142
|
+
chainId: RobinhoodChainId;
|
|
143
|
+
blockNumber: string;
|
|
144
|
+
nativeBalance: {
|
|
145
|
+
symbol: 'ETH';
|
|
146
|
+
raw: string;
|
|
147
|
+
formatted: string;
|
|
148
|
+
};
|
|
149
|
+
positions: PortfolioPosition[];
|
|
150
|
+
scannedAssets: number;
|
|
151
|
+
partial: boolean;
|
|
152
|
+
warning: string | null;
|
|
153
|
+
}
|
|
154
|
+
export interface UnsignedTransaction {
|
|
155
|
+
chainId: number;
|
|
156
|
+
from: Address;
|
|
157
|
+
to: Address;
|
|
158
|
+
data: Hex;
|
|
159
|
+
value: string;
|
|
160
|
+
gasLimit?: string;
|
|
161
|
+
maxFeePerGas?: string;
|
|
162
|
+
maxPriorityFeePerGas?: string;
|
|
163
|
+
gasPrice?: string;
|
|
164
|
+
}
|
|
165
|
+
/** Client-supplied transaction for simulation; `from` may come from `wallet`. */
|
|
166
|
+
export interface SimulateTransactionInput {
|
|
167
|
+
chainId?: number;
|
|
168
|
+
from?: string;
|
|
169
|
+
to: string;
|
|
170
|
+
data?: string;
|
|
171
|
+
value?: string;
|
|
172
|
+
gasLimit?: string;
|
|
173
|
+
gasPrice?: string;
|
|
174
|
+
maxFeePerGas?: string;
|
|
175
|
+
maxPriorityFeePerGas?: string;
|
|
176
|
+
}
|
|
177
|
+
export interface SimulateRequest {
|
|
178
|
+
wallet?: string;
|
|
179
|
+
transactions: SimulateTransactionInput[];
|
|
180
|
+
}
|
|
181
|
+
export interface SimulationCallResult {
|
|
182
|
+
index: number;
|
|
183
|
+
status: 'passed' | 'failed' | 'not_run';
|
|
184
|
+
gasUsed: string | null;
|
|
185
|
+
returnData: string | null;
|
|
186
|
+
error: string | null;
|
|
187
|
+
}
|
|
188
|
+
export interface SimulationResult {
|
|
189
|
+
status: 'passed' | 'failed' | 'partial';
|
|
190
|
+
mode: 'sequential' | 'independent';
|
|
191
|
+
blockNumber: string;
|
|
192
|
+
calls: SimulationCallResult[];
|
|
193
|
+
warning: string | null;
|
|
194
|
+
}
|
|
195
|
+
export interface ExactInputTradeIntent {
|
|
196
|
+
type: 'exact_input';
|
|
197
|
+
tokenIn?: string;
|
|
198
|
+
tokenOut: string;
|
|
199
|
+
amountIn: string;
|
|
200
|
+
}
|
|
201
|
+
export interface ExactOutputTradeIntent {
|
|
202
|
+
type: 'exact_output';
|
|
203
|
+
tokenIn?: string;
|
|
204
|
+
tokenOut: string;
|
|
205
|
+
amountOut: string;
|
|
206
|
+
}
|
|
207
|
+
/** Preferred public request body for `POST /quotes` and `POST /trades/plan`. */
|
|
208
|
+
export interface IntentTradeRequest {
|
|
209
|
+
wallet: string;
|
|
210
|
+
intent: ExactInputTradeIntent | ExactOutputTradeIntent;
|
|
211
|
+
/** Percent, 0.01–5. Defaults to 0.5. */
|
|
212
|
+
slippageTolerance?: number;
|
|
213
|
+
}
|
|
214
|
+
/** V0 compatibility shape. New integrations should use `IntentTradeRequest`. */
|
|
215
|
+
export interface LegacyTradeRequest {
|
|
216
|
+
wallet: string;
|
|
217
|
+
tokenOut: string;
|
|
218
|
+
input: {
|
|
219
|
+
/** Defaults to USDG. */
|
|
220
|
+
tokenIn?: string;
|
|
221
|
+
/** Positive decimal string with at most 18 decimal places. */
|
|
222
|
+
amount: string;
|
|
223
|
+
};
|
|
224
|
+
/** Percent, 0.01–5. Defaults to 0.5. */
|
|
225
|
+
slippageTolerance?: number;
|
|
226
|
+
}
|
|
227
|
+
export type TradeRequest = IntentTradeRequest | LegacyTradeRequest;
|
|
228
|
+
export interface Quote {
|
|
229
|
+
id: string;
|
|
230
|
+
requestType: 'exact_input' | 'exact_output';
|
|
231
|
+
routing: string;
|
|
232
|
+
tokenIn: ResolvedToken;
|
|
233
|
+
tokenOut: ResolvedToken;
|
|
234
|
+
amountIn: string;
|
|
235
|
+
amountInBaseUnits: string;
|
|
236
|
+
/** Maximum input the wallet can spend after applying the requested slippage tolerance. */
|
|
237
|
+
maximumAmountIn: string;
|
|
238
|
+
maximumAmountInBaseUnits: string;
|
|
239
|
+
amountOut: string | null;
|
|
240
|
+
amountOutBaseUnits: string | null;
|
|
241
|
+
/** Minimum output the transaction is required to deliver. */
|
|
242
|
+
minimumAmountOut: string;
|
|
243
|
+
minimumAmountOutBaseUnits: string;
|
|
244
|
+
slippageTolerance: number;
|
|
245
|
+
receivedAt: string;
|
|
246
|
+
expiresAt: string;
|
|
247
|
+
provider: '0x-swap-api' | 'uniswap-trading-api';
|
|
248
|
+
providerRequestId: string | null;
|
|
249
|
+
rawQuote: Record<string, unknown>;
|
|
250
|
+
permitData: Record<string, unknown> | null;
|
|
251
|
+
}
|
|
252
|
+
export type TradePlanStepKind = 'cancel_approval' | 'approve' | 'swap';
|
|
253
|
+
export interface TradePlanStep {
|
|
254
|
+
index: number;
|
|
255
|
+
kind: TradePlanStepKind;
|
|
256
|
+
transaction: UnsignedTransaction;
|
|
257
|
+
}
|
|
258
|
+
export type PolicyVerdict = 'allow' | 'warn' | 'block';
|
|
259
|
+
export interface PolicyCheck {
|
|
260
|
+
source: 'rail_safety' | 'project_policy' | 'project_configuration';
|
|
261
|
+
verdict: PolicyVerdict;
|
|
262
|
+
code: string;
|
|
263
|
+
message: string;
|
|
264
|
+
evidence: Record<string, string | number | boolean | null>;
|
|
265
|
+
}
|
|
266
|
+
export interface TradePlanVerdict {
|
|
267
|
+
outcome: PolicyVerdict;
|
|
268
|
+
policyVersion: {
|
|
269
|
+
id: string;
|
|
270
|
+
version: number;
|
|
271
|
+
schemaVersion: 1;
|
|
272
|
+
} | null;
|
|
273
|
+
checks: PolicyCheck[];
|
|
274
|
+
}
|
|
275
|
+
export interface TokenTradeSizeLimit {
|
|
276
|
+
token: string;
|
|
277
|
+
warnAbove?: string;
|
|
278
|
+
blockAbove?: string;
|
|
279
|
+
}
|
|
280
|
+
export interface PolicyThresholds {
|
|
281
|
+
warnAbove?: number;
|
|
282
|
+
blockAbove?: number;
|
|
283
|
+
}
|
|
284
|
+
export interface ProjectPolicyRulesV1 {
|
|
285
|
+
schemaVersion: 1;
|
|
286
|
+
allowedOutputAssets?: string[];
|
|
287
|
+
blockedOutputAssets?: string[];
|
|
288
|
+
allowedInputTokens?: string[];
|
|
289
|
+
tradeSizeLimits?: TokenTradeSizeLimit[];
|
|
290
|
+
slippageTolerance?: PolicyThresholds;
|
|
291
|
+
}
|
|
292
|
+
export interface ProjectPolicyVersion {
|
|
293
|
+
id: string;
|
|
294
|
+
projectId: string;
|
|
295
|
+
version: number;
|
|
296
|
+
schemaVersion: 1;
|
|
297
|
+
rules: ProjectPolicyRulesV1;
|
|
298
|
+
createdAt: number;
|
|
299
|
+
active: boolean;
|
|
300
|
+
}
|
|
301
|
+
export interface TradePlan {
|
|
302
|
+
id: string;
|
|
303
|
+
status: 'ready' | 'review_required' | 'blocked';
|
|
304
|
+
chainId: RobinhoodChainId;
|
|
305
|
+
wallet: Address;
|
|
306
|
+
createdAt: string;
|
|
307
|
+
expiresAt: string;
|
|
308
|
+
intent: {
|
|
309
|
+
type: 'swap_exact_input';
|
|
310
|
+
tokenIn: string;
|
|
311
|
+
tokenOut: string;
|
|
312
|
+
amountIn: string;
|
|
313
|
+
} | {
|
|
314
|
+
type: 'swap_exact_output';
|
|
315
|
+
tokenIn: string;
|
|
316
|
+
tokenOut: string;
|
|
317
|
+
amountOut: string;
|
|
318
|
+
};
|
|
319
|
+
quote: Quote;
|
|
320
|
+
walletContext: {
|
|
321
|
+
inputBalance: {
|
|
322
|
+
raw: string;
|
|
323
|
+
formatted: string;
|
|
324
|
+
decimals: number;
|
|
325
|
+
};
|
|
326
|
+
sufficientBalance: true;
|
|
327
|
+
};
|
|
328
|
+
steps: TradePlanStep[];
|
|
329
|
+
simulation: SimulationResult;
|
|
330
|
+
verdict: TradePlanVerdict;
|
|
331
|
+
signing: {
|
|
332
|
+
mode: 'wallet_controlled';
|
|
333
|
+
submittedByRail: false;
|
|
334
|
+
unsignedTransactions: UnsignedTransaction[];
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
export interface ApiIndex {
|
|
338
|
+
name: string;
|
|
339
|
+
version: ApiVersion;
|
|
340
|
+
chainId: RobinhoodChainId;
|
|
341
|
+
documentation: string;
|
|
342
|
+
endpoints: Record<string, string>;
|
|
343
|
+
}
|
|
344
|
+
export interface HealthReport {
|
|
345
|
+
status: 'ok' | 'degraded';
|
|
346
|
+
chainId: RobinhoodChainId;
|
|
347
|
+
services: {
|
|
348
|
+
robinhoodAssets: {
|
|
349
|
+
configured: boolean;
|
|
350
|
+
};
|
|
351
|
+
robinhoodPrices: {
|
|
352
|
+
configured: boolean;
|
|
353
|
+
};
|
|
354
|
+
robinhoodRpc: {
|
|
355
|
+
configured: boolean;
|
|
356
|
+
provider: string;
|
|
357
|
+
};
|
|
358
|
+
uniswapTradingApi: {
|
|
359
|
+
configured: boolean;
|
|
360
|
+
};
|
|
361
|
+
zeroExSwapApi: {
|
|
362
|
+
configured: boolean;
|
|
363
|
+
};
|
|
364
|
+
platformDatabase: {
|
|
365
|
+
configured: boolean;
|
|
366
|
+
schema: 'current' | 'behind' | 'not_configured';
|
|
367
|
+
};
|
|
368
|
+
stocklayerApiAuthentication: {
|
|
369
|
+
enabled: boolean;
|
|
370
|
+
mode: 'project_keys' | 'disabled';
|
|
371
|
+
keyVerifierConfigured: boolean;
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/** Scenario names accepted by `x-stocklayer-scenario` on test-environment keys. */
|
|
376
|
+
export type SandboxScenario = 'funded' | 'approved' | 'insufficient_balance' | 'zero_balance' | 'simulation_failed' | 'provider_degraded';
|
|
377
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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AAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,GAAG,UAAU,CAAC;IAC1B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE;QACR,eAAe,EAAE;YAAE,UAAU,EAAE,OAAO,CAAA;SAAE,CAAC;QACzC,eAAe,EAAE;YAAE,UAAU,EAAE,OAAO,CAAA;SAAE,CAAC;QACzC,YAAY,EAAE;YAAE,UAAU,EAAE,OAAO,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QACxD,iBAAiB,EAAE;YAAE,UAAU,EAAE,OAAO,CAAA;SAAE,CAAC;QAC3C,aAAa,EAAE;YAAE,UAAU,EAAE,OAAO,CAAA;SAAE,CAAC;QACvC,gBAAgB,EAAE;YAChB,UAAU,EAAE,OAAO,CAAC;YACpB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,gBAAgB,CAAC;SACjD,CAAC;QACF,2BAA2B,EAAE;YAC3B,OAAO,EAAE,OAAO,CAAC;YACjB,IAAI,EAAE,cAAc,GAAG,UAAU,CAAC;YAClC,qBAAqB,EAAE,OAAO,CAAC;SAChC,CAAC;KACH,CAAC;CACH;AAED,mFAAmF;AACnF,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,UAAU,GACV,sBAAsB,GACtB,cAAc,GACd,mBAAmB,GACnB,mBAAmB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public request and response models for the Stocklayer V0 API.
|
|
3
|
+
*
|
|
4
|
+
* This file is the single source of truth for the wire contract. The
|
|
5
|
+
* application re-exports it from `src/core/types.ts`, so services, route
|
|
6
|
+
* handlers, the OpenAPI document, and the SDK all describe the same shapes.
|
|
7
|
+
* It has no runtime imports so it can ship inside the SDK unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export const ROBINHOOD_CHAIN_ID = 4663;
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC"}
|