lighter-ts-sdk 1.0.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 +21 -0
- package/README.md +440 -0
- package/dist/api/account-api.d.ts +89 -0
- package/dist/api/account-api.d.ts.map +1 -0
- package/dist/api/account-api.js +61 -0
- package/dist/api/account-api.js.map +1 -0
- package/dist/api/api-client.d.ts +23 -0
- package/dist/api/api-client.d.ts.map +1 -0
- package/dist/api/api-client.js +129 -0
- package/dist/api/api-client.js.map +1 -0
- package/dist/api/block-api.d.ts +24 -0
- package/dist/api/block-api.d.ts.map +1 -0
- package/dist/api/block-api.js +22 -0
- package/dist/api/block-api.js.map +1 -0
- package/dist/api/candlestick-api.d.ts +27 -0
- package/dist/api/candlestick-api.d.ts.map +1 -0
- package/dist/api/candlestick-api.js +18 -0
- package/dist/api/candlestick-api.js.map +1 -0
- package/dist/api/order-api.d.ts +76 -0
- package/dist/api/order-api.d.ts.map +1 -0
- package/dist/api/order-api.js +102 -0
- package/dist/api/order-api.js.map +1 -0
- package/dist/api/root-api.d.ts +8 -0
- package/dist/api/root-api.d.ts.map +1 -0
- package/dist/api/root-api.js +14 -0
- package/dist/api/root-api.js.map +1 -0
- package/dist/api/transaction-api.d.ts +58 -0
- package/dist/api/transaction-api.d.ts.map +1 -0
- package/dist/api/transaction-api.js +141 -0
- package/dist/api/transaction-api.js.map +1 -0
- package/dist/api/ws-client.d.ts +21 -0
- package/dist/api/ws-client.d.ts.map +1 -0
- package/dist/api/ws-client.js +139 -0
- package/dist/api/ws-client.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/dist/signer/signer-client.d.ts +79 -0
- package/dist/signer/signer-client.d.ts.map +1 -0
- package/dist/signer/signer-client.js +213 -0
- package/dist/signer/signer-client.js.map +1 -0
- package/dist/signer/wasm-signer-client.d.ts +129 -0
- package/dist/signer/wasm-signer-client.d.ts.map +1 -0
- package/dist/signer/wasm-signer-client.js +607 -0
- package/dist/signer/wasm-signer-client.js.map +1 -0
- package/dist/types/index.d.ts +130 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/api-key-utils.d.ts +7 -0
- package/dist/utils/api-key-utils.d.ts.map +1 -0
- package/dist/utils/api-key-utils.js +31 -0
- package/dist/utils/api-key-utils.js.map +1 -0
- package/dist/utils/configuration.d.ts +19 -0
- package/dist/utils/configuration.d.ts.map +1 -0
- package/dist/utils/configuration.js +55 -0
- package/dist/utils/configuration.js.map +1 -0
- package/dist/utils/exceptions.d.ts +33 -0
- package/dist/utils/exceptions.d.ts.map +1 -0
- package/dist/utils/exceptions.js +76 -0
- package/dist/utils/exceptions.js.map +1 -0
- package/dist/utils/node-wasm-signer.d.ts +126 -0
- package/dist/utils/node-wasm-signer.d.ts.map +1 -0
- package/dist/utils/node-wasm-signer.js +286 -0
- package/dist/utils/node-wasm-signer.js.map +1 -0
- package/dist/utils/signer-server.d.ts +18 -0
- package/dist/utils/signer-server.d.ts.map +1 -0
- package/dist/utils/signer-server.js +79 -0
- package/dist/utils/signer-server.js.map +1 -0
- package/dist/utils/signer.d.ts +15 -0
- package/dist/utils/signer.d.ts.map +1 -0
- package/dist/utils/signer.js +68 -0
- package/dist/utils/signer.js.map +1 -0
- package/dist/utils/wasm-signer.d.ts +130 -0
- package/dist/utils/wasm-signer.d.ts.map +1 -0
- package/dist/utils/wasm-signer.js +178 -0
- package/dist/utils/wasm-signer.js.map +1 -0
- package/docs/API.md +195 -0
- package/docs/AccountApi.md +220 -0
- package/docs/GettingStarted.md +261 -0
- package/docs/OrderApi.md +199 -0
- package/docs/SignerClient.md +326 -0
- package/docs/TransactionApi.md +312 -0
- package/docs/WsClient.md +275 -0
- package/docs/types/Account.md +67 -0
- package/docs/types/ApiKeyPair.md +33 -0
- package/docs/types/CreateOrderParams.md +47 -0
- package/docs/types/MarketOrderParams.md +36 -0
- package/docs/types/SignerConfig.md +40 -0
- package/docs/types/WasmSignerConfig.md +30 -0
- package/examples/README.md +171 -0
- package/examples/account_info.ts +12 -0
- package/examples/create_cancel_order.ts +74 -0
- package/examples/create_market_order.ts +42 -0
- package/examples/create_market_order_max_slippage.ts +43 -0
- package/examples/create_sl_tp.ts +61 -0
- package/examples/create_with_multiple_keys.ts +58 -0
- package/examples/get_info.ts +58 -0
- package/examples/send_tx_batch.ts +87 -0
- package/examples/system_setup.ts +96 -0
- package/examples/transfer_update_leverage.ts +53 -0
- package/examples/ws.ts +24 -0
- package/examples/ws_async.ts +39 -0
- package/examples/ws_send_batch_tx.ts +113 -0
- package/examples/ws_send_tx.ts +94 -0
- package/package.json +71 -0
- package/wasm/lighter-signer.wasm +0 -0
- package/wasm/wasm_exec.js +402 -0
- package/wasm/wasm_exec_nodejs.js +402 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export interface Configuration {
|
|
2
|
+
host: string;
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
secretKey?: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
userAgent?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ApiResponse<T = any> {
|
|
9
|
+
data: T;
|
|
10
|
+
status: number;
|
|
11
|
+
statusText: string;
|
|
12
|
+
headers: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface ApiError {
|
|
15
|
+
message: string;
|
|
16
|
+
code?: string;
|
|
17
|
+
status?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface PaginationParams {
|
|
20
|
+
index?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
sort?: 'asc' | 'desc';
|
|
23
|
+
}
|
|
24
|
+
export interface CursorParams {
|
|
25
|
+
cursor?: string;
|
|
26
|
+
limit?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface AccountParams {
|
|
29
|
+
by: 'index' | 'l1_address';
|
|
30
|
+
value: string;
|
|
31
|
+
}
|
|
32
|
+
export interface BlockParams {
|
|
33
|
+
by: 'height' | 'hash';
|
|
34
|
+
value: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TransactionParams {
|
|
37
|
+
by: 'sequence_index' | 'hash' | 'l1_tx_hash';
|
|
38
|
+
value: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CandlestickParams {
|
|
41
|
+
market_id: number;
|
|
42
|
+
resolution: string;
|
|
43
|
+
start_timestamp?: number;
|
|
44
|
+
end_timestamp?: number;
|
|
45
|
+
count_back?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface OrderBookParams {
|
|
48
|
+
market_id: number;
|
|
49
|
+
depth?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface TradeParams {
|
|
52
|
+
market_id: number;
|
|
53
|
+
limit?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface CreateOrderParams {
|
|
56
|
+
market_id: number;
|
|
57
|
+
side: 'buy' | 'sell';
|
|
58
|
+
type: 'limit' | 'market';
|
|
59
|
+
size: string;
|
|
60
|
+
price?: string;
|
|
61
|
+
reduce_only?: boolean;
|
|
62
|
+
post_only?: boolean;
|
|
63
|
+
time_in_force?: 'GTC' | 'IOC' | 'FOK';
|
|
64
|
+
client_order_id?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface CancelOrderParams {
|
|
67
|
+
market_id: number;
|
|
68
|
+
order_id: string;
|
|
69
|
+
}
|
|
70
|
+
export interface SendTransactionParams {
|
|
71
|
+
account_index: number;
|
|
72
|
+
api_key_index: number;
|
|
73
|
+
transaction: string;
|
|
74
|
+
}
|
|
75
|
+
export interface SendTransactionBatchParams {
|
|
76
|
+
account_index: number;
|
|
77
|
+
api_key_index: number;
|
|
78
|
+
transactions: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface WebSocketConfig {
|
|
81
|
+
url: string;
|
|
82
|
+
reconnectInterval?: number;
|
|
83
|
+
maxReconnectAttempts?: number;
|
|
84
|
+
onMessage?: (data: any) => void;
|
|
85
|
+
onError?: (error: Error) => void;
|
|
86
|
+
onClose?: () => void;
|
|
87
|
+
onOpen?: () => void;
|
|
88
|
+
}
|
|
89
|
+
export interface WebSocketSubscription {
|
|
90
|
+
channel: string;
|
|
91
|
+
params?: Record<string, any>;
|
|
92
|
+
}
|
|
93
|
+
export interface SignerConfig {
|
|
94
|
+
privateKey: string;
|
|
95
|
+
accountIndex: number;
|
|
96
|
+
apiKeyIndex: number;
|
|
97
|
+
}
|
|
98
|
+
export interface ApiKeyConfig {
|
|
99
|
+
apiKey: string;
|
|
100
|
+
secretKey: string;
|
|
101
|
+
accountIndex: number;
|
|
102
|
+
apiKeyIndex: number;
|
|
103
|
+
}
|
|
104
|
+
export interface Block {
|
|
105
|
+
height: number;
|
|
106
|
+
hash: string;
|
|
107
|
+
timestamp: number;
|
|
108
|
+
transactions: string[];
|
|
109
|
+
parent_hash: string;
|
|
110
|
+
state_root: string;
|
|
111
|
+
}
|
|
112
|
+
export interface Candlestick {
|
|
113
|
+
timestamp: number;
|
|
114
|
+
open: string;
|
|
115
|
+
high: string;
|
|
116
|
+
low: string;
|
|
117
|
+
close: string;
|
|
118
|
+
volume: string;
|
|
119
|
+
}
|
|
120
|
+
export interface Funding {
|
|
121
|
+
timestamp: number;
|
|
122
|
+
funding_rate: string;
|
|
123
|
+
funding_index: string;
|
|
124
|
+
}
|
|
125
|
+
export interface RootInfo {
|
|
126
|
+
version: string;
|
|
127
|
+
chain_id: string;
|
|
128
|
+
block_height: number;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS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IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-utils.d.ts","sourceRoot":"","sources":["../../src/utils/api-key-utils.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAmB3E;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateRandomSeed = exports.createApiKey = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
9
|
+
function createApiKey(seed) {
|
|
10
|
+
try {
|
|
11
|
+
// Generate a random seed if none provided
|
|
12
|
+
const randomSeed = seed || crypto_1.default.randomBytes(32).toString('hex');
|
|
13
|
+
// Create a deterministic wallet from the seed
|
|
14
|
+
const wallet = ethers_1.ethers.Wallet.fromPhrase(randomSeed);
|
|
15
|
+
// The private key is the wallet's private key
|
|
16
|
+
const privateKey = wallet.privateKey;
|
|
17
|
+
// The public key is the wallet's address (for this implementation)
|
|
18
|
+
// In a real implementation, you might want to derive the actual public key
|
|
19
|
+
const publicKey = wallet.address;
|
|
20
|
+
return [privateKey, publicKey, null];
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return ['', '', error instanceof Error ? error.message : 'Unknown error'];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.createApiKey = createApiKey;
|
|
27
|
+
function generateRandomSeed() {
|
|
28
|
+
return crypto_1.default.randomBytes(32).toString('hex');
|
|
29
|
+
}
|
|
30
|
+
exports.generateRandomSeed = generateRandomSeed;
|
|
31
|
+
//# sourceMappingURL=api-key-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-utils.js","sourceRoot":"","sources":["../../src/utils/api-key-utils.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAgC;AAChC,oDAA4B;AAO5B,SAAgB,YAAY,CAAC,IAAa;IACxC,IAAI,CAAC;QACH,0CAA0C;QAC1C,MAAM,UAAU,GAAG,IAAI,IAAI,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAElE,8CAA8C;QAC9C,MAAM,MAAM,GAAG,eAAM,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAEpD,8CAA8C;QAC9C,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAErC,mEAAmE;QACnE,2EAA2E;QAC3E,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC;QAEjC,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAnBD,oCAmBC;AAED,SAAgB,kBAAkB;IAChC,OAAO,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAFD,gDAEC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Configuration } from '../types';
|
|
2
|
+
export declare class Config {
|
|
3
|
+
private static instance;
|
|
4
|
+
private config;
|
|
5
|
+
constructor(config: Partial<Configuration>);
|
|
6
|
+
static getDefault(): Config;
|
|
7
|
+
static setDefault(config: Partial<Configuration>): Config;
|
|
8
|
+
getHost(): string;
|
|
9
|
+
getApiKey(): string | undefined;
|
|
10
|
+
getSecretKey(): string | undefined;
|
|
11
|
+
getTimeout(): number;
|
|
12
|
+
getUserAgent(): string;
|
|
13
|
+
setApiKey(apiKey: string): void;
|
|
14
|
+
setSecretKey(secretKey: string): void;
|
|
15
|
+
setHost(host: string): void;
|
|
16
|
+
setTimeout(timeout: number): void;
|
|
17
|
+
toJSON(): Configuration;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/utils/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC;WAS5B,UAAU,IAAI,MAAM;WAOpB,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,MAAM;IAKzD,OAAO,IAAI,MAAM;IAIjB,SAAS,IAAI,MAAM,GAAG,SAAS;IAI/B,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC,UAAU,IAAI,MAAM;IAIpB,YAAY,IAAI,MAAM;IAItB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIrC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3B,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC,MAAM,IAAI,aAAa;CAG/B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Config = void 0;
|
|
4
|
+
class Config {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = {
|
|
7
|
+
host: 'https://mainnet.zklighter.elliot.ai',
|
|
8
|
+
timeout: 30000,
|
|
9
|
+
userAgent: 'Lighter-TypeScript-SDK/1.0.0',
|
|
10
|
+
...config,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
static getDefault() {
|
|
14
|
+
if (!Config.instance) {
|
|
15
|
+
Config.instance = new Config({});
|
|
16
|
+
}
|
|
17
|
+
return Config.instance;
|
|
18
|
+
}
|
|
19
|
+
static setDefault(config) {
|
|
20
|
+
Config.instance = new Config(config);
|
|
21
|
+
return Config.instance;
|
|
22
|
+
}
|
|
23
|
+
getHost() {
|
|
24
|
+
return this.config.host;
|
|
25
|
+
}
|
|
26
|
+
getApiKey() {
|
|
27
|
+
return this.config.apiKey;
|
|
28
|
+
}
|
|
29
|
+
getSecretKey() {
|
|
30
|
+
return this.config.secretKey;
|
|
31
|
+
}
|
|
32
|
+
getTimeout() {
|
|
33
|
+
return this.config.timeout || 30000;
|
|
34
|
+
}
|
|
35
|
+
getUserAgent() {
|
|
36
|
+
return this.config.userAgent || 'Lighter-TypeScript-SDK/1.0.0';
|
|
37
|
+
}
|
|
38
|
+
setApiKey(apiKey) {
|
|
39
|
+
this.config.apiKey = apiKey;
|
|
40
|
+
}
|
|
41
|
+
setSecretKey(secretKey) {
|
|
42
|
+
this.config.secretKey = secretKey;
|
|
43
|
+
}
|
|
44
|
+
setHost(host) {
|
|
45
|
+
this.config.host = host;
|
|
46
|
+
}
|
|
47
|
+
setTimeout(timeout) {
|
|
48
|
+
this.config.timeout = timeout;
|
|
49
|
+
}
|
|
50
|
+
toJSON() {
|
|
51
|
+
return { ...this.config };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.Config = Config;
|
|
55
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/utils/configuration.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IAIjB,YAAY,MAA8B;QACxC,I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,CAAC;IAChC,CAAC;IAEM,MAAM;QACX,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF;AAhED,wBAgEC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare class LighterException extends Error {
|
|
2
|
+
status: number | undefined;
|
|
3
|
+
code: string | undefined;
|
|
4
|
+
constructor(message: string, status?: number, code?: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class ApiException extends LighterException {
|
|
7
|
+
constructor(message: string, status?: number, code?: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class BadRequestException extends ApiException {
|
|
10
|
+
constructor(message: string, code?: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class UnauthorizedException extends ApiException {
|
|
13
|
+
constructor(message: string, code?: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class ForbiddenException extends ApiException {
|
|
16
|
+
constructor(message: string, code?: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class NotFoundException extends ApiException {
|
|
19
|
+
constructor(message: string, code?: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class TooManyRequestsException extends ApiException {
|
|
22
|
+
constructor(message: string, code?: string);
|
|
23
|
+
}
|
|
24
|
+
export declare class ServiceException extends ApiException {
|
|
25
|
+
constructor(message: string, code?: string);
|
|
26
|
+
}
|
|
27
|
+
export declare class ValidationException extends LighterException {
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
export declare class ConfigurationException extends LighterException {
|
|
31
|
+
constructor(message: string);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/utils/exceptions.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAiB,SAAQ,KAAK;IAClC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAM5D;AAED,qBAAa,YAAa,SAAQ,gBAAgB;gBACpC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI5D;AAED,qBAAa,mBAAoB,SAAQ,YAAY;gBACvC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED,qBAAa,kBAAmB,SAAQ,YAAY;gBACtC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED,qBAAa,wBAAyB,SAAQ,YAAY;gBAC5C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI3C;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;gBAC3C,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,sBAAuB,SAAQ,gBAAgB;gBAC9C,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationException = exports.ValidationException = exports.ServiceException = exports.TooManyRequestsException = exports.NotFoundException = exports.ForbiddenException = exports.UnauthorizedException = exports.BadRequestException = exports.ApiException = exports.LighterException = void 0;
|
|
4
|
+
class LighterException extends Error {
|
|
5
|
+
constructor(message, status, code) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'LighterException';
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.code = code;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.LighterException = LighterException;
|
|
13
|
+
class ApiException extends LighterException {
|
|
14
|
+
constructor(message, status, code) {
|
|
15
|
+
super(message, status, code);
|
|
16
|
+
this.name = 'ApiException';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ApiException = ApiException;
|
|
20
|
+
class BadRequestException extends ApiException {
|
|
21
|
+
constructor(message, code) {
|
|
22
|
+
super(message, 400, code);
|
|
23
|
+
this.name = 'BadRequestException';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.BadRequestException = BadRequestException;
|
|
27
|
+
class UnauthorizedException extends ApiException {
|
|
28
|
+
constructor(message, code) {
|
|
29
|
+
super(message, 401, code);
|
|
30
|
+
this.name = 'UnauthorizedException';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.UnauthorizedException = UnauthorizedException;
|
|
34
|
+
class ForbiddenException extends ApiException {
|
|
35
|
+
constructor(message, code) {
|
|
36
|
+
super(message, 403, code);
|
|
37
|
+
this.name = 'ForbiddenException';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ForbiddenException = ForbiddenException;
|
|
41
|
+
class NotFoundException extends ApiException {
|
|
42
|
+
constructor(message, code) {
|
|
43
|
+
super(message, 404, code);
|
|
44
|
+
this.name = 'NotFoundException';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.NotFoundException = NotFoundException;
|
|
48
|
+
class TooManyRequestsException extends ApiException {
|
|
49
|
+
constructor(message, code) {
|
|
50
|
+
super(message, 429, code);
|
|
51
|
+
this.name = 'TooManyRequestsException';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.TooManyRequestsException = TooManyRequestsException;
|
|
55
|
+
class ServiceException extends ApiException {
|
|
56
|
+
constructor(message, code) {
|
|
57
|
+
super(message, 500, code);
|
|
58
|
+
this.name = 'ServiceException';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.ServiceException = ServiceException;
|
|
62
|
+
class ValidationException extends LighterException {
|
|
63
|
+
constructor(message) {
|
|
64
|
+
super(message, 400, 'VALIDATION_ERROR');
|
|
65
|
+
this.name = 'ValidationException';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.ValidationException = ValidationException;
|
|
69
|
+
class ConfigurationException extends LighterException {
|
|
70
|
+
constructor(message) {
|
|
71
|
+
super(message, 0, 'CONFIGURATION_ERROR');
|
|
72
|
+
this.name = 'ConfigurationException';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.ConfigurationException = ConfigurationException;
|
|
76
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../src/utils/exceptions.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAiB,SAAQ,KAAK;IAIzC,YAAY,OAAe,EAAE,MAAe,EAAE,IAAa;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAVD,4CAUC;AAED,MAAa,YAAa,SAAQ,gBAAgB;IAChD,YAAY,OAAe,EAAE,MAAe,EAAE,IAAa;QACzD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,MAAa,mBAAoB,SAAQ,YAAY;IACnD,YAAY,OAAe,EAAE,IAAa;QACxC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAA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MAAa,sBAAuB,SAAQ,gBAAgB;IAC1D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,qBAAqB,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AALD,wDAKC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js WASM Signer Client for Lighter Protocol
|
|
3
|
+
*
|
|
4
|
+
* This module provides a Node.js wrapper for the Go WASM signer,
|
|
5
|
+
* enabling cryptographic operations in Node.js environments.
|
|
6
|
+
*/
|
|
7
|
+
export interface WasmSignerConfig {
|
|
8
|
+
wasmPath: string;
|
|
9
|
+
wasmExecPath?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ApiKeyPair {
|
|
12
|
+
privateKey: string;
|
|
13
|
+
publicKey: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CreateClientParams {
|
|
16
|
+
url: string;
|
|
17
|
+
privateKey: string;
|
|
18
|
+
chainId: number;
|
|
19
|
+
apiKeyIndex: number;
|
|
20
|
+
accountIndex: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CreateOrderParams {
|
|
23
|
+
marketIndex: number;
|
|
24
|
+
clientOrderIndex: number;
|
|
25
|
+
baseAmount: number;
|
|
26
|
+
price: number;
|
|
27
|
+
isAsk: number;
|
|
28
|
+
orderType: number;
|
|
29
|
+
timeInForce: number;
|
|
30
|
+
reduceOnly: number;
|
|
31
|
+
triggerPrice: number;
|
|
32
|
+
orderExpiry: number;
|
|
33
|
+
nonce: number;
|
|
34
|
+
}
|
|
35
|
+
export interface CancelOrderParams {
|
|
36
|
+
marketIndex: number;
|
|
37
|
+
orderIndex: number;
|
|
38
|
+
nonce: number;
|
|
39
|
+
}
|
|
40
|
+
export interface CancelAllOrdersParams {
|
|
41
|
+
timeInForce: number;
|
|
42
|
+
time: number;
|
|
43
|
+
nonce: number;
|
|
44
|
+
}
|
|
45
|
+
export interface TransferParams {
|
|
46
|
+
toAccountIndex: number;
|
|
47
|
+
usdcAmount: number;
|
|
48
|
+
fee: number;
|
|
49
|
+
memo: string;
|
|
50
|
+
nonce: number;
|
|
51
|
+
}
|
|
52
|
+
export interface UpdateLeverageParams {
|
|
53
|
+
marketIndex: number;
|
|
54
|
+
fraction: number;
|
|
55
|
+
marginMode: number;
|
|
56
|
+
nonce: number;
|
|
57
|
+
}
|
|
58
|
+
export declare class NodeWasmSignerClient {
|
|
59
|
+
private wasmModule;
|
|
60
|
+
private isInitialized;
|
|
61
|
+
private config;
|
|
62
|
+
constructor(config: WasmSignerConfig);
|
|
63
|
+
/**
|
|
64
|
+
* Initialize the WASM module
|
|
65
|
+
*/
|
|
66
|
+
initialize(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Generate a new API key pair
|
|
69
|
+
*/
|
|
70
|
+
generateAPIKey(seed?: string): Promise<ApiKeyPair>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a client for signing transactions
|
|
73
|
+
*/
|
|
74
|
+
createClient(params: CreateClientParams): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Sign a create order transaction
|
|
77
|
+
*/
|
|
78
|
+
signCreateOrder(params: CreateOrderParams): Promise<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Sign a cancel order transaction
|
|
81
|
+
*/
|
|
82
|
+
signCancelOrder(params: CancelOrderParams): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Create an authentication token
|
|
85
|
+
*/
|
|
86
|
+
createAuthToken(deadline?: number): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Sign a cancel all orders transaction
|
|
89
|
+
*/
|
|
90
|
+
signCancelAllOrders(params: CancelAllOrdersParams): Promise<{
|
|
91
|
+
txInfo: string;
|
|
92
|
+
error?: string;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* Sign a transfer transaction
|
|
96
|
+
*/
|
|
97
|
+
signTransfer(params: TransferParams): Promise<{
|
|
98
|
+
txInfo: string;
|
|
99
|
+
error?: string;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Sign an update leverage transaction
|
|
103
|
+
*/
|
|
104
|
+
signUpdateLeverage(params: UpdateLeverageParams): Promise<{
|
|
105
|
+
txInfo: string;
|
|
106
|
+
error?: string;
|
|
107
|
+
}>;
|
|
108
|
+
checkClient(apiKeyIndex: number, accountIndex: number): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Ensure the WASM module is initialized
|
|
111
|
+
*/
|
|
112
|
+
private ensureInitialized;
|
|
113
|
+
/**
|
|
114
|
+
* Load wasm_exec.js for Node.js
|
|
115
|
+
*/
|
|
116
|
+
private loadWasmExec;
|
|
117
|
+
/**
|
|
118
|
+
* Load WASM binary for Node.js
|
|
119
|
+
*/
|
|
120
|
+
private loadWasmBinary;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Create a Node.js WASM signer client instance
|
|
124
|
+
*/
|
|
125
|
+
export declare function createNodeWasmSignerClient(config: WasmSignerConfig): NodeWasmSignerClient;
|
|
126
|
+
//# sourceMappingURL=node-wasm-signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-wasm-signer.d.ts","sourceRoot":"","sources":["../../src/utils/node-wasm-signer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,i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