@relayprotocol/relay-lighter-wallet-adapter 0.1.1

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.
@@ -0,0 +1 @@
1
+ {"type": "module","sideEffects":false}
@@ -0,0 +1,331 @@
1
+ import { getClient, LogLevel } from '@relayprotocol/relay-sdk';
2
+ export const LIGHTER_CHAIN_ID = 3586256;
3
+ // The chain id baked into L2 signatures by the Lighter WASM signer. This is
4
+ // different from `LIGHTER_CHAIN_ID` — it's the value Lighter's zk circuit
5
+ // validates against on mainnet.
6
+ const LIGHTER_CIRCUIT_CHAIN_ID = 304;
7
+ const DEFAULT_API_URL = 'https://mainnet.zklighter.elliot.ai';
8
+ const DEFAULT_API_KEY_INDEX = 2;
9
+ // WASM assets hosted on jsDelivr.
10
+ // Override via `options.wasmConfig` if you'd rather self-host.
11
+ const LIGHTER_SDK_VERSION = '1.0.7-alpha18';
12
+ const DEFAULT_WASM_PATH = `https://cdn.jsdelivr.net/npm/@relay-protocol/lighter-ts-sdk@${LIGHTER_SDK_VERSION}/wasm/lighter-signer.wasm`;
13
+ const DEFAULT_WASM_EXEC_PATH = `https://cdn.jsdelivr.net/npm/@relay-protocol/lighter-ts-sdk@${LIGHTER_SDK_VERSION}/wasm/wasm_exec.js`;
14
+ // Dummy key used only to bootstrap the throwaway SignerClient that performs
15
+ // the `generateAPIKey` / `changeApiKey` dance. `changeApiKey` uses the L1
16
+ // signature as its root of trust, not this value.
17
+ const DUMMY_API_KEY = '0x' + '00'.repeat(40);
18
+ const LIGHTER_TX_STATUS = {
19
+ PENDING: 0,
20
+ QUEUED: 1,
21
+ COMMITTED: 2,
22
+ EXECUTED: 3,
23
+ FAILED: 4,
24
+ REJECTED: 5
25
+ };
26
+ // Lazy, cached dynamic import of `@relay-protocol/lighter-ts-sdk`. Only fires
27
+ // when the adapter needs to bootstrap its own SignerClient. Integrators who
28
+ // always supply a pre-built `signerClient` don't need the package installed
29
+ // at all — it's declared as an optional peer dependency.
30
+ let sdkModulePromise = null;
31
+ const loadLighterSdk = () => {
32
+ if (!sdkModulePromise) {
33
+ sdkModulePromise = import('@relay-protocol/lighter-ts-sdk').catch((cause) => {
34
+ // Reset so the next attempt re-tries the import — callers who install
35
+ // the peer mid-session shouldn't have to reload.
36
+ sdkModulePromise = null;
37
+ throw new Error('Lighter adapter: `@relay-protocol/lighter-ts-sdk` is required for the ' +
38
+ 'bootstrap path (fresh keygen, `accountApiKey`, or `storage`). ' +
39
+ 'Install it as a peer dependency, or pass a pre-built `signerClient` ' +
40
+ 'to skip the SDK entirely.', { cause });
41
+ });
42
+ }
43
+ return sdkModulePromise;
44
+ };
45
+ const coerceLighterStatus = (status) => {
46
+ if (typeof status === 'number') {
47
+ return status;
48
+ }
49
+ switch (status) {
50
+ case 'confirmed':
51
+ return LIGHTER_TX_STATUS.EXECUTED;
52
+ case 'failed':
53
+ return LIGHTER_TX_STATUS.FAILED;
54
+ case 'pending':
55
+ default:
56
+ return LIGHTER_TX_STATUS.PENDING;
57
+ }
58
+ };
59
+ const pollLighterTransaction = async (signerClient, txHash, options) => {
60
+ const { pollIntervalMs, timeoutMs, waitFor } = options;
61
+ const maxAttempts = Math.max(1, Math.ceil(timeoutMs / pollIntervalMs));
62
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
63
+ let tx;
64
+ try {
65
+ tx = await signerClient.getTransaction(txHash);
66
+ }
67
+ catch {
68
+ // Transient fetch / indexing errors — retry below.
69
+ }
70
+ if (tx && tx.hash) {
71
+ const numericStatus = coerceLighterStatus(tx.status);
72
+ if (numericStatus === LIGHTER_TX_STATUS.FAILED ||
73
+ numericStatus === LIGHTER_TX_STATUS.REJECTED) {
74
+ const label = numericStatus === LIGHTER_TX_STATUS.FAILED ? 'failed' : 'rejected';
75
+ throw new Error(`Lighter transaction ${label}: ${tx.message ?? 'unknown error'}`);
76
+ }
77
+ if (waitFor === 'findable') {
78
+ return tx;
79
+ }
80
+ if (numericStatus === LIGHTER_TX_STATUS.COMMITTED ||
81
+ numericStatus === LIGHTER_TX_STATUS.EXECUTED) {
82
+ return tx;
83
+ }
84
+ }
85
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
86
+ }
87
+ throw new Error(`Lighter transaction ${txHash} did not reach '${waitFor}' within ${timeoutMs}ms`);
88
+ };
89
+ /**
90
+ * Adapts a Lighter wallet to work with the Relay SDK.
91
+ *
92
+ * The adapter owns the full Lighter session lifecycle so integrators only
93
+ * have to provide the user's L1 address and a message-signing callback:
94
+ *
95
+ * ```ts
96
+ * const wallet = adaptLighterWallet({
97
+ * l1Address: account.address,
98
+ * signL1Message: (msg) =>
99
+ * walletClient.signMessage({ account, message: msg })
100
+ * })
101
+ * ```
102
+ *
103
+ * On construction the adapter does nothing interactive — no network calls,
104
+ * no signature prompts. The first call into `handleSendTransactionStep`
105
+ * triggers the lazy bootstrap, which:
106
+ * 1. Resolves the user's Lighter `accountIndex` from their L1 address.
107
+ * 2. Either loads a persisted API key (if `storage` is provided) or
108
+ * generates a fresh keypair in memory.
109
+ * 3. For a fresh key, prompts the user to sign an L1 authorization and
110
+ * calls `changeApiKey` to register it against the account.
111
+ * 4. Waits for the key rotation to execute on Lighter.
112
+ * 5. Constructs the real `SignerClient` backed by the new key.
113
+ *
114
+ * Subsequent transactions reuse the cached session (in-memory at minimum).
115
+ *
116
+ * Passing `signerClient` skips the entire bootstrap and avoids any runtime
117
+ * dependency on `@relay-protocol/lighter-ts-sdk`.
118
+ *
119
+ */
120
+ export const adaptLighterWallet = (options) => {
121
+ const { l1Address, signL1Message, apiUrl = DEFAULT_API_URL, apiKeyIndex = DEFAULT_API_KEY_INDEX, wasmConfig, accountApiKey, signerClient: preConfiguredSigner, accountIndex: preConfiguredAccountIndex, storage, pollIntervalMs = 2_000, timeoutMs = 120_000 } = options;
122
+ // `signL1Message` is only optional when the caller supplies a
123
+ // `signerClient`; otherwise the adapter's own bootstrap + `transfer()`
124
+ // path calls the stock `SignerClient`, which requires an ethSigner.
125
+ if (!preConfiguredSigner && !signL1Message) {
126
+ throw new Error('Lighter adapter: `signL1Message` is required unless a pre-built `signerClient` is supplied.');
127
+ }
128
+ const normalizedL1Address = l1Address.toLowerCase();
129
+ const resolvedWasmConfig = {
130
+ wasmPath: wasmConfig?.wasmPath ?? DEFAULT_WASM_PATH,
131
+ wasmExecPath: wasmConfig?.wasmExecPath ?? DEFAULT_WASM_EXEC_PATH
132
+ };
133
+ // The SDK's `SignerClient.transfer()` only calls `.signMessage(msg)` on
134
+ // whatever is passed as `ethSigner`. We forward to the supplied callback.
135
+ // `undefined` when the caller's `signerClient` handles L1 signing on its
136
+ // own — forwarded as-is to their `transfer()` implementation.
137
+ const ethSignerShim = signL1Message
138
+ ? {
139
+ signMessage: (message) => signL1Message(message)
140
+ }
141
+ : undefined;
142
+ // Account-index cache. Resolved via public API — no signature required.
143
+ // Pre-populated from the `accountIndex` option when supplied, so we
144
+ // never hit the network (or the SDK) in that path.
145
+ let cachedAccountIndex = preConfiguredAccountIndex ?? null;
146
+ const resolveAccountIndex = async () => {
147
+ if (cachedAccountIndex !== null)
148
+ return cachedAccountIndex;
149
+ const { AccountApi, ApiClient } = await loadLighterSdk();
150
+ const apiClient = new ApiClient({ host: apiUrl });
151
+ const accountApi = new AccountApi(apiClient);
152
+ const response = (await accountApi.getAccount({
153
+ by: 'l1_address',
154
+ value: normalizedL1Address
155
+ }));
156
+ const firstAccount = response?.accounts?.[0];
157
+ const rawIndex = firstAccount?.index;
158
+ const index = typeof rawIndex === 'number' ? rawIndex : Number(rawIndex);
159
+ if (!firstAccount || !Number.isFinite(index)) {
160
+ throw new Error(`Lighter adapter: could not resolve accountIndex for ${l1Address}. ` +
161
+ 'Has the user created a Lighter account via an L1 deposit?');
162
+ }
163
+ cachedAccountIndex = index;
164
+ return index;
165
+ };
166
+ // Signer resolution. When `signerClient` is supplied, this is a direct
167
+ // pass-through — no network, no SDK import, no account-index lookup.
168
+ // Otherwise the first call triggers the lazy bootstrap, which fires the
169
+ // `changeApiKey` signature prompt if we have to generate a fresh key.
170
+ let signerPromise = preConfiguredSigner
171
+ ? Promise.resolve(preConfiguredSigner)
172
+ : null;
173
+ const getSigner = () => {
174
+ if (signerPromise)
175
+ return signerPromise;
176
+ signerPromise = (async () => {
177
+ const { SignerClient, ApiClient, TransactionApi } = await loadLighterSdk();
178
+ const accountIndex = await resolveAccountIndex();
179
+ // Precedence: explicit `accountApiKey` > persisted via `storage` >
180
+ // fresh bootstrap. The first two both bypass the `changeApiKey` prompt.
181
+ const storageKey = `lighter-api-key:${normalizedL1Address}:${apiKeyIndex}`;
182
+ let hydratedAccountApiKey = accountApiKey ?? null;
183
+ if (!hydratedAccountApiKey && storage) {
184
+ const stored = await storage.get(storageKey);
185
+ hydratedAccountApiKey = stored ?? null;
186
+ }
187
+ if (hydratedAccountApiKey) {
188
+ const signerClient = new SignerClient({
189
+ url: apiUrl,
190
+ privateKey: hydratedAccountApiKey,
191
+ accountIndex,
192
+ apiKeyIndex,
193
+ chainId: LIGHTER_CIRCUIT_CHAIN_ID,
194
+ wasmConfig: resolvedWasmConfig
195
+ });
196
+ await signerClient.initialize();
197
+ await signerClient.ensureWasmClient();
198
+ // Cast: SignerClient's `transfer` accepts `string | Signer` for
199
+ // `ethSigner`, which is structurally wider than our
200
+ // `LighterEthSigner`. Safe because the SDK only calls
201
+ // `.signMessage()` on it.
202
+ return signerClient;
203
+ }
204
+ // No stored key — generate one and register it.
205
+ //
206
+ // Step 1: keygen-only client. A dummy key is fine because
207
+ // `generateAPIKey` is a stateless WASM call that doesn't use the
208
+ // current signing context. We deliberately DO NOT call
209
+ // `ensureWasmClient` here — doing so would lock the WASM's signing
210
+ // context to the dummy key, and the ChangePubKey `Sig` (which proves
211
+ // ownership of the new key) would be produced with the dummy key
212
+ // instead of the freshly generated one, causing Lighter to reject
213
+ // the tx as "invalid signature".
214
+ const keygenClient = new SignerClient({
215
+ url: apiUrl,
216
+ privateKey: DUMMY_API_KEY,
217
+ accountIndex,
218
+ apiKeyIndex,
219
+ chainId: LIGHTER_CIRCUIT_CHAIN_ID,
220
+ wasmConfig: resolvedWasmConfig
221
+ });
222
+ await keygenClient.initialize();
223
+ const keypair = await keygenClient.generateAPIKey();
224
+ if (!keypair) {
225
+ throw new Error('Lighter adapter: failed to generate an API keypair');
226
+ }
227
+ // Step 2: the real client, backed by the newly generated key. Calling
228
+ // `ensureWasmClient` now registers that key as the signing context
229
+ // for the target slot, so `changeApiKey` produces a valid ownership
230
+ // proof for the pubkey it's registering.
231
+ const signerClient = new SignerClient({
232
+ url: apiUrl,
233
+ privateKey: keypair.privateKey,
234
+ accountIndex,
235
+ apiKeyIndex,
236
+ chainId: LIGHTER_CIRCUIT_CHAIN_ID,
237
+ wasmConfig: resolvedWasmConfig
238
+ });
239
+ await signerClient.initialize();
240
+ await signerClient.ensureWasmClient();
241
+ const nonceApiClient = new ApiClient({ host: apiUrl });
242
+ const transactionApi = new TransactionApi(nonceApiClient);
243
+ const nextNonceResponse = (await transactionApi.getNextNonce(accountIndex, apiKeyIndex));
244
+ const rawNonce = nextNonceResponse?.nonce;
245
+ const nonceForChangeKey = typeof rawNonce === 'number' ? rawNonce : Number(rawNonce ?? 0);
246
+ const [, changeKeyTxHash, changeKeyError] = await signerClient.changeApiKey({
247
+ // Cast through `unknown`: the SDK types `ethSigner` as
248
+ // `string | ethers.Signer`, but it only ever invokes
249
+ // `.signMessage()` on it — which our shim provides.
250
+ ethSigner: ethSignerShim,
251
+ newPubkey: keypair.publicKey,
252
+ newApiKeyIndex: apiKeyIndex,
253
+ nonce: Number.isFinite(nonceForChangeKey) ? nonceForChangeKey : 0
254
+ });
255
+ if (changeKeyError) {
256
+ throw new Error(`Lighter changeApiKey failed: ${changeKeyError}`);
257
+ }
258
+ if (!changeKeyTxHash) {
259
+ throw new Error('Lighter changeApiKey returned no transaction hash');
260
+ }
261
+ await pollLighterTransaction(signerClient, changeKeyTxHash, {
262
+ pollIntervalMs,
263
+ timeoutMs,
264
+ waitFor: 'committed'
265
+ });
266
+ if (storage) {
267
+ await storage.set(storageKey, keypair.privateKey);
268
+ }
269
+ // Same narrowing cast as the hydrated-key branch above.
270
+ return signerClient;
271
+ })();
272
+ // If bootstrap fails, clear the promise so a retry can start fresh.
273
+ signerPromise.catch(() => {
274
+ signerPromise = null;
275
+ });
276
+ return signerPromise;
277
+ };
278
+ return {
279
+ vmType: 'lvm',
280
+ getChainId: async () => LIGHTER_CHAIN_ID,
281
+ address: async () => (await resolveAccountIndex()).toString(),
282
+ handleSignMessageStep: async () => {
283
+ throw new Error('Message signing not implemented for Lighter');
284
+ },
285
+ handleSendTransactionStep: async (_chainId, stepItem, _step) => {
286
+ const client = getClient();
287
+ const action = stepItem.data?.action;
288
+ if (!action || action.type !== 'transfer') {
289
+ throw new Error(`Unsupported Lighter action: ${action?.type ?? 'undefined'}`);
290
+ }
291
+ const signerClient = await getSigner();
292
+ const params = action.parameters;
293
+ client.log(['Executing Lighter transfer', params], LogLevel.Verbose);
294
+ const [, txHash, error] = await signerClient.transfer({
295
+ toAccountIndex: params.toAccountIndex,
296
+ assetIndex: params.assetIndex,
297
+ fromRouteType: params.fromRouteType,
298
+ toRouteType: params.toRouteType,
299
+ amount: params.amount,
300
+ usdcFee: params.usdcFee,
301
+ memo: params.memo,
302
+ ethSigner: ethSignerShim
303
+ });
304
+ if (error) {
305
+ throw new Error(`Lighter transfer failed: ${error}`);
306
+ }
307
+ if (!txHash) {
308
+ throw new Error('Lighter transfer returned no transaction hash');
309
+ }
310
+ client.log(['Lighter transaction broadcasted', txHash], LogLevel.Verbose);
311
+ return txHash;
312
+ },
313
+ handleConfirmTransactionStep: async (txHash) => {
314
+ const signerClient = await getSigner();
315
+ const tx = await pollLighterTransaction(signerClient, txHash, {
316
+ pollIntervalMs,
317
+ timeoutMs,
318
+ waitFor: 'findable'
319
+ });
320
+ return {
321
+ txHash: tx.hash,
322
+ blockHeight: tx.block_height ?? 0,
323
+ status: tx.status
324
+ };
325
+ },
326
+ switchChain: async () => {
327
+ // Lighter is a single-chain network — nothing to switch
328
+ }
329
+ };
330
+ };
331
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EAGT,MAAM,0BAA0B,CAAA;AAEjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAA;AAEvC,4EAA4E;AAC5E,0EAA0E;AAC1E,gCAAgC;AAChC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAEpC,MAAM,eAAe,GAAG,qCAAqC,CAAA;AAC7D,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAE/B,kCAAkC;AAClC,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,eAAe,CAAA;AAC3C,MAAM,iBAAiB,GAAG,+DAA+D,mBAAmB,2BAA2B,CAAA;AACvI,MAAM,sBAAsB,GAAG,+DAA+D,mBAAmB,oBAAoB,CAAA;AAErI,4EAA4E;AAC5E,0EAA0E;AAC1E,kDAAkD;AAClD,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAE5C,MAAM,iBAAiB,GAAG;IACxB,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;CACH,CAAA;AAiDV,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,yDAAyD;AACzD,IAAI,gBAAgB,GAET,IAAI,CAAA;AACf,MAAM,cAAc,GAAG,GAErB,EAAE;IACF,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,gBAAgB,GAAG,MAAM,CAAC,gCAAgC,CAAC,CAAC,KAAK,CAC/D,CAAC,KAAK,EAAE,EAAE;YACR,sEAAsE;YACtE,iDAAiD;YACjD,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AC,MAAM;gBACrB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,SAAS,EAAE,aAAa;aACzB,CAAC,CAAA;YAEF,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,EAAE,CAAC,CAAA;YACtD,CAAC;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;YAClE,CAAC;YAED,MAAM,CAAC,GAAG,CAAC,CAAC,iCAAiC,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;YAEzE,OAAO,MAAM,CAAA;QACf,CAAC;QACD,4BAA4B,EAAE,KAAK,EACjC,MAAc,EACO,EAAE;YACvB,MAAM,YAAY,GAAG,MAAM,SAAS,EAAE,CAAA;YACtC,MAAM,EAAE,GAAG,MAAM,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE;gBAC5D,cAAc;gBACd,SAAS;gBACT,OAAO,EAAE,UAAU;aACpB,CAAC,CAAA;YACF,OAAO;gBACL,MAAM,EAAE,EAAE,CAAC,IAAI;gBACf,WAAW,EAAE,EAAE,CAAC,YAAY,IAAI,CAAC;gBACjC,MAAM,EAAE,EAAE,CAAC,MAAM;aAClB,CAAA;QACH,CAAC;QACD,WAAW,EAAE,KAAK,IAAI,EAAE;YACtB,wDAAwD;QAC1D,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './adapter.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}