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,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node.js WASM Signer Client for Lighter Protocol
|
|
4
|
+
*
|
|
5
|
+
* This module provides a Node.js wrapper for the Go WASM signer,
|
|
6
|
+
* enabling cryptographic operations in Node.js environments.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.createNodeWasmSignerClient = exports.NodeWasmSignerClient = void 0;
|
|
33
|
+
const fs = __importStar(require("fs"));
|
|
34
|
+
const child_process_1 = require("child_process");
|
|
35
|
+
class NodeWasmSignerClient {
|
|
36
|
+
// private wasiSigner: WasiSigner | null = null; // removed
|
|
37
|
+
constructor(config) {
|
|
38
|
+
this.wasmModule = null;
|
|
39
|
+
this.isInitialized = false;
|
|
40
|
+
this.config = config;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Initialize the WASM module
|
|
44
|
+
*/
|
|
45
|
+
async initialize() {
|
|
46
|
+
if (this.isInitialized) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
// Resolve wasm_exec.js runtime
|
|
51
|
+
let wasmExecPath = this.config.wasmExecPath;
|
|
52
|
+
// Prefer official Go runtime first if available (node-specific if present)
|
|
53
|
+
try {
|
|
54
|
+
const goroot = (0, child_process_1.execSync)('go env GOROOT').toString().trim();
|
|
55
|
+
const libPath = require('path').join(goroot, 'lib', 'wasm', 'wasm_exec.js');
|
|
56
|
+
const miscPath = require('path').join(goroot, 'misc', 'wasm', 'wasm_exec.js');
|
|
57
|
+
const nodeCli = require('path').join(goroot, 'lib', 'wasm', 'wasm_exec_node.js');
|
|
58
|
+
if (fs.existsSync(libPath)) {
|
|
59
|
+
wasmExecPath = libPath;
|
|
60
|
+
}
|
|
61
|
+
else if (fs.existsSync(miscPath)) {
|
|
62
|
+
wasmExecPath = miscPath;
|
|
63
|
+
}
|
|
64
|
+
else if (fs.existsSync(nodeCli)) {
|
|
65
|
+
// fallback only if nothing else is available
|
|
66
|
+
wasmExecPath = nodeCli;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch { }
|
|
70
|
+
if (!wasmExecPath) {
|
|
71
|
+
const candidates = [
|
|
72
|
+
'wasm/wasm_exec_nodejs.js',
|
|
73
|
+
'wasm/wasm_exec.js'
|
|
74
|
+
];
|
|
75
|
+
for (const c of candidates) {
|
|
76
|
+
const abs = require('path').resolve(process.cwd(), c);
|
|
77
|
+
if (fs.existsSync(abs)) {
|
|
78
|
+
wasmExecPath = abs;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!wasmExecPath) {
|
|
84
|
+
throw new Error('Unable to locate wasm_exec runtime. Provide wasmExecPath or install Go.');
|
|
85
|
+
}
|
|
86
|
+
await this.loadWasmExec(wasmExecPath);
|
|
87
|
+
// Load the WASM binary
|
|
88
|
+
const wasmBytes = await this.loadWasmBinary(this.config.wasmPath);
|
|
89
|
+
// Initialize the Go runtime
|
|
90
|
+
const Go = global.Go;
|
|
91
|
+
const go = new Go();
|
|
92
|
+
// Do not override runtime-provided imports; alias only if missing
|
|
93
|
+
const io = go.importObject;
|
|
94
|
+
if (!io["gojs"]) {
|
|
95
|
+
if (io["go"])
|
|
96
|
+
io["gojs"] = io["go"];
|
|
97
|
+
else if (io["env"])
|
|
98
|
+
io["gojs"] = io["env"];
|
|
99
|
+
}
|
|
100
|
+
// Add Node.js environment
|
|
101
|
+
go.env = Object.assign({ TMPDIR: require('os').tmpdir() }, process.env);
|
|
102
|
+
go.argv = process.argv;
|
|
103
|
+
go.exit = process.exit;
|
|
104
|
+
const result = await WebAssembly.instantiate(wasmBytes, go.importObject);
|
|
105
|
+
// Run the WASM module (must succeed to register functions)
|
|
106
|
+
go.run(result.instance);
|
|
107
|
+
// Wait for functions to be registered
|
|
108
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
109
|
+
// Try multiple ways to access the functions
|
|
110
|
+
this.wasmModule = {
|
|
111
|
+
generateAPIKey: global.generateAPIKey || global.lighterWasmFunctions?.generateAPIKey,
|
|
112
|
+
createClient: global.createClient || global.lighterWasmFunctions?.createClient,
|
|
113
|
+
signCreateOrder: global.signCreateOrder || global.lighterWasmFunctions?.signCreateOrder,
|
|
114
|
+
signCancelOrder: global.signCancelOrder || global.lighterWasmFunctions?.signCancelOrder,
|
|
115
|
+
signCancelAllOrders: global.signCancelAllOrders || global.lighterWasmFunctions?.signCancelAllOrders,
|
|
116
|
+
signTransfer: global.signTransfer || global.lighterWasmFunctions?.signTransfer,
|
|
117
|
+
signUpdateLeverage: global.signUpdateLeverage || global.lighterWasmFunctions?.signUpdateLeverage,
|
|
118
|
+
createAuthToken: global.createAuthToken || global.lighterWasmFunctions?.createAuthToken,
|
|
119
|
+
checkClient: global.CheckClient || global.checkClient || global.lighterWasmFunctions?.checkClient,
|
|
120
|
+
};
|
|
121
|
+
// Verify that the functions are available
|
|
122
|
+
if (!this.wasmModule.generateAPIKey) {
|
|
123
|
+
throw new Error('WASM functions not properly registered');
|
|
124
|
+
}
|
|
125
|
+
this.isInitialized = true;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
throw new Error(`Failed to initialize WASM signer: ${error instanceof Error ? error.message : String(error)}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Generate a new API key pair
|
|
133
|
+
*/
|
|
134
|
+
async generateAPIKey(seed) {
|
|
135
|
+
await this.ensureInitialized();
|
|
136
|
+
const result = this.wasmModule.generateAPIKey(seed);
|
|
137
|
+
if (result.error) {
|
|
138
|
+
throw new Error(`Failed to generate API key: ${result.error}`);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
privateKey: result.privateKey,
|
|
142
|
+
publicKey: result.publicKey,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Create a client for signing transactions
|
|
147
|
+
*/
|
|
148
|
+
async createClient(params) {
|
|
149
|
+
await this.ensureInitialized();
|
|
150
|
+
const result = this.wasmModule.createClient(params.url, params.privateKey, params.chainId, params.apiKeyIndex, params.accountIndex);
|
|
151
|
+
if (result.error) {
|
|
152
|
+
throw new Error(`Failed to create client: ${result.error}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Sign a create order transaction
|
|
157
|
+
*/
|
|
158
|
+
async signCreateOrder(params) {
|
|
159
|
+
await this.ensureInitialized();
|
|
160
|
+
const result = this.wasmModule.signCreateOrder(params.marketIndex, params.clientOrderIndex, params.baseAmount, params.price, params.isAsk, params.orderType, params.timeInForce, params.reduceOnly, params.triggerPrice, params.orderExpiry, params.nonce);
|
|
161
|
+
if (result.error) {
|
|
162
|
+
throw new Error(`Failed to sign create order: ${result.error}`);
|
|
163
|
+
}
|
|
164
|
+
return result.txInfo;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Sign a cancel order transaction
|
|
168
|
+
*/
|
|
169
|
+
async signCancelOrder(params) {
|
|
170
|
+
await this.ensureInitialized();
|
|
171
|
+
const result = this.wasmModule.signCancelOrder(params.marketIndex, params.orderIndex, params.nonce);
|
|
172
|
+
if (result.error) {
|
|
173
|
+
throw new Error(`Failed to sign cancel order: ${result.error}`);
|
|
174
|
+
}
|
|
175
|
+
return result.txInfo;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Create an authentication token
|
|
179
|
+
*/
|
|
180
|
+
async createAuthToken(deadline) {
|
|
181
|
+
await this.ensureInitialized();
|
|
182
|
+
const result = this.wasmModule.createAuthToken(deadline);
|
|
183
|
+
if (result.error) {
|
|
184
|
+
throw new Error(`Failed to create auth token: ${result.error}`);
|
|
185
|
+
}
|
|
186
|
+
return result.authToken;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Sign a cancel all orders transaction
|
|
190
|
+
*/
|
|
191
|
+
async signCancelAllOrders(params) {
|
|
192
|
+
await this.ensureInitialized();
|
|
193
|
+
const result = this.wasmModule.signCancelAllOrders(params.timeInForce, params.time, params.nonce);
|
|
194
|
+
if (result.error) {
|
|
195
|
+
return { txInfo: '', error: result.error };
|
|
196
|
+
}
|
|
197
|
+
return { txInfo: result.txInfo };
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Sign a transfer transaction
|
|
201
|
+
*/
|
|
202
|
+
async signTransfer(params) {
|
|
203
|
+
await this.ensureInitialized();
|
|
204
|
+
const result = this.wasmModule.signTransfer(params.toAccountIndex, params.usdcAmount, params.fee, params.memo, params.nonce);
|
|
205
|
+
if (result.error) {
|
|
206
|
+
return { txInfo: '', error: result.error };
|
|
207
|
+
}
|
|
208
|
+
return { txInfo: result.txInfo };
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Sign an update leverage transaction
|
|
212
|
+
*/
|
|
213
|
+
async signUpdateLeverage(params) {
|
|
214
|
+
await this.ensureInitialized();
|
|
215
|
+
const result = this.wasmModule.signUpdateLeverage(params.marketIndex, params.fraction, params.marginMode, params.nonce);
|
|
216
|
+
if (result.error) {
|
|
217
|
+
return { txInfo: '', error: result.error };
|
|
218
|
+
}
|
|
219
|
+
return { txInfo: result.txInfo };
|
|
220
|
+
}
|
|
221
|
+
async checkClient(apiKeyIndex, accountIndex) {
|
|
222
|
+
await this.ensureInitialized();
|
|
223
|
+
if (!this.wasmModule.checkClient)
|
|
224
|
+
return; // optional
|
|
225
|
+
const err = this.wasmModule.checkClient(apiKeyIndex, accountIndex);
|
|
226
|
+
if (err) {
|
|
227
|
+
throw new Error(typeof err === 'string' ? err : String(err));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Ensure the WASM module is initialized
|
|
232
|
+
*/
|
|
233
|
+
async ensureInitialized() {
|
|
234
|
+
if (!this.isInitialized) {
|
|
235
|
+
await this.initialize();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Load wasm_exec.js for Node.js
|
|
240
|
+
*/
|
|
241
|
+
async loadWasmExec(path) {
|
|
242
|
+
try {
|
|
243
|
+
let absolutePath = path;
|
|
244
|
+
if (!absolutePath.startsWith('/') && !absolutePath.includes(':')) {
|
|
245
|
+
try {
|
|
246
|
+
absolutePath = require.resolve(path, { paths: [process.cwd()] });
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
absolutePath = require('path').resolve(process.cwd(), path);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// Directly require the wasm_exec.js file
|
|
253
|
+
delete require.cache[absolutePath];
|
|
254
|
+
const wasmExec = require(absolutePath);
|
|
255
|
+
// Set Go class on global object
|
|
256
|
+
if (wasmExec && wasmExec.Go) {
|
|
257
|
+
global.Go = wasmExec.Go;
|
|
258
|
+
}
|
|
259
|
+
else if (global.Go) {
|
|
260
|
+
// already provided by official runtime
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
throw new Error('Go class not found in wasm_exec.js');
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
throw new Error(`Failed to load wasm_exec.js: ${error instanceof Error ? error.message : String(error)}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Load WASM binary for Node.js
|
|
272
|
+
*/
|
|
273
|
+
async loadWasmBinary(path) {
|
|
274
|
+
const buffer = fs.readFileSync(path);
|
|
275
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.NodeWasmSignerClient = NodeWasmSignerClient;
|
|
279
|
+
/**
|
|
280
|
+
* Create a Node.js WASM signer client instance
|
|
281
|
+
*/
|
|
282
|
+
function createNodeWasmSignerClient(config) {
|
|
283
|
+
return new NodeWasmSignerClient(config);
|
|
284
|
+
}
|
|
285
|
+
exports.createNodeWasmSignerClient = createNodeWasmSignerClient;
|
|
286
|
+
//# sourceMappingURL=node-wasm-signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-wasm-signer.js","sourceRoot":"","sources":["../../src/utils/node-wasm-signer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,iDAAyC;AA8DzC,MAAa,oBAAoB;IAI/B,4DAA4D;IAE5D,YAAY,MAAwB;QAL5B,eAAU,GAAQ,IAAI,CAAC;QACvB,kBAAa,GAAG,KAAK,CAAC;QAK5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,+BAA+B;YAC/B,IAAI,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAC5C,2EAA2E;YAC3E,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;gBAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;gBAC5E,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;gBAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,C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C;IAED;;OAEG;IACK,KAAK,CAAC,cAAc,CAAC,IAAY;QACvC,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACvF,CAAC;CACF;AA7TD,oDA6TC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CAAC,MAAwB;IACjE,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAFD,gEAEC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface SignerServerConfig {
|
|
2
|
+
url: string;
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface SignerServerResponse<T> {
|
|
6
|
+
data?: T;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class SignerServerClient {
|
|
10
|
+
private config;
|
|
11
|
+
constructor(config: SignerServerConfig);
|
|
12
|
+
signTransaction(privateKey: string, transaction: any): Promise<string>;
|
|
13
|
+
getPublicKey(privateKey: string): Promise<string>;
|
|
14
|
+
healthCheck(): Promise<boolean>;
|
|
15
|
+
private makeRequest;
|
|
16
|
+
}
|
|
17
|
+
export declare function createSignerServerClient(config: SignerServerConfig): SignerServerClient;
|
|
18
|
+
//# sourceMappingURL=signer-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer-server.d.ts","sourceRoot":"","sources":["../../src/utils/signer-server.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,EAAE,kBAAkB;IAOhC,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAatE,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYjD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YAsBvB,WAAW;CA0B1B;AAGD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAEvF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSignerServerClient = exports.SignerServerClient = void 0;
|
|
4
|
+
class SignerServerClient {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = {
|
|
7
|
+
timeout: 10000,
|
|
8
|
+
...config,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
async signTransaction(privateKey, transaction) {
|
|
12
|
+
const response = await this.makeRequest('/sign', {
|
|
13
|
+
private_key: privateKey,
|
|
14
|
+
message: transaction,
|
|
15
|
+
});
|
|
16
|
+
if (response.error) {
|
|
17
|
+
throw new Error(`Signer server error: ${response.error}`);
|
|
18
|
+
}
|
|
19
|
+
return response.data?.signature || '';
|
|
20
|
+
}
|
|
21
|
+
async getPublicKey(privateKey) {
|
|
22
|
+
const response = await this.makeRequest('/pubkey', {
|
|
23
|
+
private_key: privateKey,
|
|
24
|
+
});
|
|
25
|
+
if (response.error) {
|
|
26
|
+
throw new Error(`Signer server error: ${response.error}`);
|
|
27
|
+
}
|
|
28
|
+
return response.data?.public_key || '';
|
|
29
|
+
}
|
|
30
|
+
async healthCheck() {
|
|
31
|
+
try {
|
|
32
|
+
const response = await fetch(`${this.config.url}/health`, {
|
|
33
|
+
method: 'GET',
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
},
|
|
37
|
+
signal: AbortSignal.timeout(this.config.timeout || 10000),
|
|
38
|
+
});
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const data = await response.json();
|
|
43
|
+
return data.status === 'ok';
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error('Health check failed:', error);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async makeRequest(endpoint, body) {
|
|
51
|
+
try {
|
|
52
|
+
const response = await fetch(`${this.config.url}${endpoint}`, {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
},
|
|
57
|
+
body: JSON.stringify(body),
|
|
58
|
+
signal: AbortSignal.timeout(this.config.timeout || 10000),
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
62
|
+
}
|
|
63
|
+
const data = await response.json();
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return {
|
|
68
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.SignerServerClient = SignerServerClient;
|
|
74
|
+
// Factory function to create a signer server client
|
|
75
|
+
function createSignerServerClient(config) {
|
|
76
|
+
return new SignerServerClient(config);
|
|
77
|
+
}
|
|
78
|
+
exports.createSignerServerClient = createSignerServerClient;
|
|
79
|
+
//# sourceMappingURL=signer-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer-server.js","sourceRoot":"","sources":["../../src/utils/signer-server.ts"],"names":[],"mappings":";;;AAUA,MAAa,kBAAkB;IAG7B,YAAY,MAA0B;QACpC,IAAI,CAAC,MAAM,GAAG;YAC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,0 +1,15 @@
|
|
|
1
|
+
export interface LighterSigner {
|
|
2
|
+
signTransaction(transaction: any): Promise<string>;
|
|
3
|
+
getPublicKey(): string;
|
|
4
|
+
}
|
|
5
|
+
export declare class LighterSignerImpl implements LighterSigner {
|
|
6
|
+
private privateKey;
|
|
7
|
+
private publicKey;
|
|
8
|
+
constructor(privateKeyHex: string);
|
|
9
|
+
signTransaction(transaction: any): Promise<string>;
|
|
10
|
+
getPublicKey(): string;
|
|
11
|
+
private serializeTransaction;
|
|
12
|
+
private hashMessage;
|
|
13
|
+
}
|
|
14
|
+
export declare function createLighterSigner(privateKeyHex: string): LighterSigner;
|
|
15
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/utils/signer.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,YAAY,IAAI,MAAM,CAAC;CACxB;AAED,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAAS;gBAEd,aAAa,EAAE,MAAM;IAU3B,eAAe,CAAC,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAcxD,YAAY,IAAI,MAAM;IAItB,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,WAAW;CA2BpB;AAGD,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAExE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LighterSignerImpl = void 0;
|
|
4
|
+
exports.createLighterSigner = createLighterSigner;
|
|
5
|
+
const poseidon_goldilocks_lite_1 = require("poseidon-goldilocks-lite");
|
|
6
|
+
const secp256k1_1 = require("@noble/curves/secp256k1");
|
|
7
|
+
const utils_1 = require("@noble/curves/abstract/utils");
|
|
8
|
+
class LighterSignerImpl {
|
|
9
|
+
constructor(privateKeyHex) {
|
|
10
|
+
// Remove 0x prefix if present
|
|
11
|
+
const cleanKey = privateKeyHex.startsWith('0x') ? privateKeyHex.slice(2) : privateKeyHex;
|
|
12
|
+
this.privateKey = (0, utils_1.hexToBytes)(cleanKey);
|
|
13
|
+
// Generate public key from private key
|
|
14
|
+
const pubKeyPoint = secp256k1_1.schnorr.getPublicKey(this.privateKey);
|
|
15
|
+
this.publicKey = (0, utils_1.bytesToHex)(pubKeyPoint);
|
|
16
|
+
}
|
|
17
|
+
async signTransaction(transaction) {
|
|
18
|
+
// 1. Serialize transaction to canonical JSON
|
|
19
|
+
const txString = this.serializeTransaction(transaction);
|
|
20
|
+
// 2. Hash the transaction using Poseidon-Goldilocks
|
|
21
|
+
const messageHash = this.hashMessage(txString);
|
|
22
|
+
// 3. Sign the hash using Schnorr
|
|
23
|
+
const signature = await secp256k1_1.schnorr.sign(messageHash, this.privateKey);
|
|
24
|
+
// 4. Return signature as hex string
|
|
25
|
+
return (0, utils_1.bytesToHex)(signature);
|
|
26
|
+
}
|
|
27
|
+
getPublicKey() {
|
|
28
|
+
return this.publicKey;
|
|
29
|
+
}
|
|
30
|
+
serializeTransaction(transaction) {
|
|
31
|
+
// Sort keys to ensure canonical order
|
|
32
|
+
const sortedKeys = Object.keys(transaction).sort();
|
|
33
|
+
const canonicalTx = {};
|
|
34
|
+
for (const key of sortedKeys) {
|
|
35
|
+
canonicalTx[key] = transaction[key];
|
|
36
|
+
}
|
|
37
|
+
// Convert to JSON with no extra whitespace
|
|
38
|
+
return JSON.stringify(canonicalTx);
|
|
39
|
+
}
|
|
40
|
+
hashMessage(message) {
|
|
41
|
+
// Convert message string to bytes
|
|
42
|
+
const messageBytes = new TextEncoder().encode(message);
|
|
43
|
+
// Convert bytes to hex string for poseidon-goldilocks
|
|
44
|
+
const messageHex = (0, utils_1.bytesToHex)(messageBytes);
|
|
45
|
+
// Use Poseidon-Goldilocks to hash the message
|
|
46
|
+
// Convert hex to hash input format
|
|
47
|
+
const hashInput = (0, poseidon_goldilocks_lite_1.hexToHashOut)(messageHex);
|
|
48
|
+
const hashOutput = (0, poseidon_goldilocks_lite_1.hashNoPad)([...hashInput]); // Spread IHashOut to bigint[]
|
|
49
|
+
// Convert hash output (IHashOut) to bytes
|
|
50
|
+
// IHashOut is [bigint, bigint, bigint, bigint]
|
|
51
|
+
const hashBytes = new Uint8Array(32); // 4 * 8 bytes = 32 bytes
|
|
52
|
+
let offset = 0;
|
|
53
|
+
for (const bigintValue of hashOutput) {
|
|
54
|
+
const valueBytes = new Uint8Array(8);
|
|
55
|
+
const view = new DataView(valueBytes.buffer);
|
|
56
|
+
view.setBigUint64(0, bigintValue, true); // little-endian
|
|
57
|
+
hashBytes.set(valueBytes, offset);
|
|
58
|
+
offset += 8;
|
|
59
|
+
}
|
|
60
|
+
return hashBytes;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.LighterSignerImpl = LighterSignerImpl;
|
|
64
|
+
// Factory function to create a signer
|
|
65
|
+
function createLighterSigner(privateKeyHex) {
|
|
66
|
+
return new LighterSignerImpl(privateKeyHex);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/utils/signer.ts"],"names":[],"mappings":";;;AAoFA,kDAEC;AAtFD,uEAAmE;AACnE,uDAAkD;AAClD,wDAAsE;AAOtE,MAAa,iBAAiB;IAI5B,YAAY,aAAqB;QAC/B,8BAA8B;QAC9B,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QACzF,IAAI,CAAC,U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Y,CAAC,CAAC;QAE5C,8CAA8C;QAC9C,mCAAmC;QACnC,MAAM,SAAS,GAAG,IAAA,uCAAY,EAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,UAAU,GAAG,IAAA,oCAAS,EAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,8BAA8B;QAE5E,0CAA0C;QAC1C,+CAA+C;QAC/C,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,yBAAyB;QAC/D,IAAI,MAAM,GAAG,CAAC,CAAC;QAEf,KAAK,MAAM,WAAW,IAAI,UAAU,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;YACrC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC7C,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,gBAAgB;YACzD,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YAClC,MAAM,IAAI,CAAC,CAAC;QACd,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAxED,8CAwEC;AAED,sCAAsC;AACtC,SAAgB,mBAAmB,CAAC,aAAqB;IACvD,OAAO,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM Signer Client for Lighter Protocol
|
|
3
|
+
*
|
|
4
|
+
* This module provides a TypeScript wrapper for the Go WASM signer,
|
|
5
|
+
* enabling cryptographic operations in the browser and 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 interface WasmSignerResponse<T = any> {
|
|
59
|
+
success?: boolean;
|
|
60
|
+
error?: string;
|
|
61
|
+
data?: T;
|
|
62
|
+
}
|
|
63
|
+
export declare class WasmSignerClient {
|
|
64
|
+
private wasmModule;
|
|
65
|
+
private isInitialized;
|
|
66
|
+
private config;
|
|
67
|
+
constructor(config: WasmSignerConfig);
|
|
68
|
+
/**
|
|
69
|
+
* Initialize the WASM module
|
|
70
|
+
*/
|
|
71
|
+
initialize(): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Generate a new API key pair
|
|
74
|
+
*/
|
|
75
|
+
generateAPIKey(seed?: string): Promise<ApiKeyPair>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a client for signing transactions
|
|
78
|
+
*/
|
|
79
|
+
createClient(params: CreateClientParams): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Sign a create order transaction
|
|
82
|
+
*/
|
|
83
|
+
signCreateOrder(params: CreateOrderParams): Promise<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Sign a cancel order transaction
|
|
86
|
+
*/
|
|
87
|
+
signCancelOrder(params: CancelOrderParams): Promise<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Sign a cancel all orders transaction
|
|
90
|
+
*/
|
|
91
|
+
signCancelAllOrders(params: CancelAllOrdersParams): Promise<{
|
|
92
|
+
txInfo: string;
|
|
93
|
+
error?: string;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Sign a transfer transaction
|
|
97
|
+
*/
|
|
98
|
+
signTransfer(params: TransferParams): Promise<{
|
|
99
|
+
txInfo: string;
|
|
100
|
+
error?: string;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Sign an update leverage transaction
|
|
104
|
+
*/
|
|
105
|
+
signUpdateLeverage(params: UpdateLeverageParams): Promise<{
|
|
106
|
+
txInfo: string;
|
|
107
|
+
error?: string;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Create an authentication token
|
|
111
|
+
*/
|
|
112
|
+
createAuthToken(deadline?: number): Promise<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Ensure the WASM module is initialized
|
|
115
|
+
*/
|
|
116
|
+
private ensureInitialized;
|
|
117
|
+
/**
|
|
118
|
+
* Load a script dynamically
|
|
119
|
+
*/
|
|
120
|
+
private loadScript;
|
|
121
|
+
/**
|
|
122
|
+
* Load WASM binary
|
|
123
|
+
*/
|
|
124
|
+
private loadWasmBinary;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Create a WASM signer client instance
|
|
128
|
+
*/
|
|
129
|
+
export declare function createWasmSignerClient(config: WasmSignerConfig): WasmSignerClient;
|
|
130
|
+
//# sourceMappingURL=wasm-signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-signer.d.ts","sourceRoot":"","sources":["../../src/utils/wasm-signer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,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,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CA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