@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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Reservoir
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ <h3 align="center">Relay Lighter Wallet Adapter</h3>
2
+
3
+ ### Installation
4
+
5
+ ```
6
+ yarn add @relayprotocol/relay-lighter-wallet-adapter @relayprotocol/relay-sdk viem
7
+ ```
8
+
9
+ If you want the adapter to run its own bootstrap (fresh keygen, `accountApiKey`, or `storage` paths), you also need the Lighter SDK:
10
+
11
+ ```
12
+ yarn add @relay-protocol/lighter-ts-sdk
13
+ ```
14
+
15
+ It's declared as an **optional** peer dependency — integrators who always supply a pre-built `signerClient` can skip the install entirely. The adapter loads the SDK via a lazy dynamic `import()` and only touches it on the bootstrap path; if it's not installed and the bootstrap path runs, a clear error is thrown.
16
+
17
+ ### Usage
18
+
19
+ ```ts
20
+ import { adaptLighterWallet } from '@relayprotocol/relay-lighter-wallet-adapter'
21
+
22
+ const account = walletClient.account
23
+ const wallet = adaptLighterWallet({
24
+ l1Address: account.address,
25
+ signL1Message: (message) => walletClient.signMessage({ account, message })
26
+ })
27
+ ```
28
+
29
+ The adapter owns the full Lighter session lifecycle: it resolves the user's Lighter `accountIndex`, generates an in-memory API key, registers it on-chain via `changeApiKey`, and builds the `SignerClient` on demand. Construction is cheap — no network or signature prompts until the user actually initiates a transfer.
30
+
31
+ #### Options
32
+
33
+ | Option | Default | |
34
+ | ------------------------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35
+ | `l1Address` | — | The user's connected EVM address |
36
+ | `signL1Message` | — | `(message) => Promise<hex sig>` — typically `walletClient.signMessage({ account, message })`. Optional when `signerClient` is supplied (the integrator owns signing). |
37
+ | `apiUrl` | `https://mainnet.zklighter.elliot.ai` | Lighter HTTP API base URL. Override to point at testnet, a proxy service, or your own staging deployment. All `/api/v1/*` traffic (account lookup, `sendTx`, status polling) uses this base. |
38
+ | `apiKeyIndex` | `2` | API key slot to (re)register |
39
+ | `chainId` | `3586256` | Reported chain id |
40
+ | `wasmConfig` | jsDelivr CDN | `{ wasmPath, wasmExecPath }` |
41
+ | `accountApiKey` | — | Hex-encoded pre-registered Lighter account API key (see below) |
42
+ | `signerClient` + `accountIndex` | — | Pre-built signer with the user's Lighter account index. **Must be supplied together** — TypeScript enforces the pair (see below). |
43
+ | `storage` | — | Optional persistent API-key store |
44
+ | `pollIntervalMs` / `timeoutMs` | `2000` / `120000` | Confirmation polling |
45
+
46
+ #### API-key lifecycle strategies
47
+
48
+ The adapter supports four patterns, chosen automatically based on which options are set. Precedence: `signerClient` > `accountApiKey` > `storage` > fresh bootstrap.
49
+
50
+ **1. Fresh bootstrap (default).** Regenerates an API key every page load — key never leaves memory. Integrator pays one signature prompt (`changeApiKey`) on the first transfer per session.
51
+
52
+ ```ts
53
+ adaptLighterWallet({ l1Address, signL1Message })
54
+ ```
55
+
56
+ **2. Persistent storage.** Reuses a previously-generated key across sessions. Only the first ever session pays the signature prompt.
57
+
58
+ ```ts
59
+ adaptLighterWallet({
60
+ l1Address,
61
+ signL1Message,
62
+ storage: {
63
+ get: (k) => localStorage.getItem(k),
64
+ set: (k, v) => localStorage.setItem(k, v)
65
+ }
66
+ })
67
+ ```
68
+
69
+ **3. Externally-managed key.** Integrators who run their own API-key lifecycle (backend provisioning, wallet-level integration, HSM, etc.) can skip the bootstrap entirely by supplying a pre-registered Lighter account API key. The caller is responsible for having already registered the matching public key on the user's Lighter account at `apiKeyIndex`.
70
+
71
+ ```ts
72
+ adaptLighterWallet({
73
+ l1Address,
74
+ signL1Message,
75
+ apiKeyIndex: 2,
76
+ accountApiKey: await fetchAccountApiKeyFromMyKeyService(userId)
77
+ })
78
+ ```
79
+
80
+ No signature prompt fires for `changeApiKey`. The per-transfer L1 authorization (`signL1Message`) is still required.
81
+
82
+ **4. Pre-built signer.** For integrators with privileged access to a Lighter-provided signer (already initialized, WASM loaded, key registered). This path bypasses every bootstrap step _and_ skips the `@relay-protocol/lighter-ts-sdk` dynamic import entirely — the adapter runs with zero runtime dependency on the SDK.
83
+
84
+ The adapter only needs two methods, described by the `LighterSigner` type:
85
+
86
+ ```ts
87
+ import type { LighterSigner } from '@relayprotocol/relay-lighter-wallet-adapter'
88
+
89
+ type LighterSigner = {
90
+ transfer: (
91
+ params: LighterTransferParams
92
+ ) => Promise<[unknown, string, string | null]>
93
+ getTransaction: (txHash: string) => Promise<LighterTransaction>
94
+ }
95
+ ```
96
+
97
+ A full `SignerClient` from `@relay-protocol/lighter-ts-sdk` satisfies this structurally and can be passed directly:
98
+
99
+ ```ts
100
+ const client = await getLighterSigner() // from your Lighter integration
101
+
102
+ adaptLighterWallet({
103
+ l1Address,
104
+ signerClient: client,
105
+ accountIndex: 509564 // required when `signerClient` is set
106
+ })
107
+ ```
108
+
109
+ **`signerClient` and `accountIndex` must be supplied together.** TypeScript's discriminated union on `AdaptLighterWalletOptions` enforces the pair — you can't pass one without the other. The adapter needs `accountIndex` for `AdaptedWallet.address()` (which the Relay SDK calls when building quotes or rendering the widget); it can't pull this out of a `SignerClient` instance because the SDK's config is private.
110
+
111
+ When `signerClient` is set, `apiUrl`, `apiKeyIndex`, `wasmConfig`, `accountApiKey`, and `storage` are all ignored (the signer already has them baked in). `signL1Message` becomes optional too — if the integrator's signer handles L1 signing internally, omit it; otherwise supply it and the adapter will forward it to `transfer()` as `ethSigner`.
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.adaptLighterWallet = exports.LIGHTER_CHAIN_ID = void 0;
4
+ const relay_sdk_1 = require("@relayprotocol/relay-sdk");
5
+ exports.LIGHTER_CHAIN_ID = 3586256;
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
+ const LIGHTER_SDK_VERSION = '1.0.7-alpha18';
10
+ const DEFAULT_WASM_PATH = `https://cdn.jsdelivr.net/npm/@relay-protocol/lighter-ts-sdk@${LIGHTER_SDK_VERSION}/wasm/lighter-signer.wasm`;
11
+ const DEFAULT_WASM_EXEC_PATH = `https://cdn.jsdelivr.net/npm/@relay-protocol/lighter-ts-sdk@${LIGHTER_SDK_VERSION}/wasm/wasm_exec.js`;
12
+ const DUMMY_API_KEY = '0x' + '00'.repeat(40);
13
+ const LIGHTER_TX_STATUS = {
14
+ PENDING: 0,
15
+ QUEUED: 1,
16
+ COMMITTED: 2,
17
+ EXECUTED: 3,
18
+ FAILED: 4,
19
+ REJECTED: 5
20
+ };
21
+ let sdkModulePromise = null;
22
+ const loadLighterSdk = () => {
23
+ if (!sdkModulePromise) {
24
+ sdkModulePromise = Promise.resolve().then(() => require('@relay-protocol/lighter-ts-sdk')).catch((cause) => {
25
+ sdkModulePromise = null;
26
+ throw new Error('Lighter adapter: `@relay-protocol/lighter-ts-sdk` is required for the ' +
27
+ 'bootstrap path (fresh keygen, `accountApiKey`, or `storage`). ' +
28
+ 'Install it as a peer dependency, or pass a pre-built `signerClient` ' +
29
+ 'to skip the SDK entirely.', { cause });
30
+ });
31
+ }
32
+ return sdkModulePromise;
33
+ };
34
+ const coerceLighterStatus = (status) => {
35
+ if (typeof status === 'number') {
36
+ return status;
37
+ }
38
+ switch (status) {
39
+ case 'confirmed':
40
+ return LIGHTER_TX_STATUS.EXECUTED;
41
+ case 'failed':
42
+ return LIGHTER_TX_STATUS.FAILED;
43
+ case 'pending':
44
+ default:
45
+ return LIGHTER_TX_STATUS.PENDING;
46
+ }
47
+ };
48
+ const pollLighterTransaction = async (signerClient, txHash, options) => {
49
+ const { pollIntervalMs, timeoutMs, waitFor } = options;
50
+ const maxAttempts = Math.max(1, Math.ceil(timeoutMs / pollIntervalMs));
51
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
52
+ let tx;
53
+ try {
54
+ tx = await signerClient.getTransaction(txHash);
55
+ }
56
+ catch {
57
+ }
58
+ if (tx && tx.hash) {
59
+ const numericStatus = coerceLighterStatus(tx.status);
60
+ if (numericStatus === LIGHTER_TX_STATUS.FAILED ||
61
+ numericStatus === LIGHTER_TX_STATUS.REJECTED) {
62
+ const label = numericStatus === LIGHTER_TX_STATUS.FAILED ? 'failed' : 'rejected';
63
+ throw new Error(`Lighter transaction ${label}: ${tx.message ?? 'unknown error'}`);
64
+ }
65
+ if (waitFor === 'findable') {
66
+ return tx;
67
+ }
68
+ if (numericStatus === LIGHTER_TX_STATUS.COMMITTED ||
69
+ numericStatus === LIGHTER_TX_STATUS.EXECUTED) {
70
+ return tx;
71
+ }
72
+ }
73
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
74
+ }
75
+ throw new Error(`Lighter transaction ${txHash} did not reach '${waitFor}' within ${timeoutMs}ms`);
76
+ };
77
+ const adaptLighterWallet = (options) => {
78
+ 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;
79
+ if (!preConfiguredSigner && !signL1Message) {
80
+ throw new Error('Lighter adapter: `signL1Message` is required unless a pre-built `signerClient` is supplied.');
81
+ }
82
+ const normalizedL1Address = l1Address.toLowerCase();
83
+ const resolvedWasmConfig = {
84
+ wasmPath: wasmConfig?.wasmPath ?? DEFAULT_WASM_PATH,
85
+ wasmExecPath: wasmConfig?.wasmExecPath ?? DEFAULT_WASM_EXEC_PATH
86
+ };
87
+ const ethSignerShim = signL1Message
88
+ ? {
89
+ signMessage: (message) => signL1Message(message)
90
+ }
91
+ : undefined;
92
+ let cachedAccountIndex = preConfiguredAccountIndex ?? null;
93
+ const resolveAccountIndex = async () => {
94
+ if (cachedAccountIndex !== null)
95
+ return cachedAccountIndex;
96
+ const { AccountApi, ApiClient } = await loadLighterSdk();
97
+ const apiClient = new ApiClient({ host: apiUrl });
98
+ const accountApi = new AccountApi(apiClient);
99
+ const response = (await accountApi.getAccount({
100
+ by: 'l1_address',
101
+ value: normalizedL1Address
102
+ }));
103
+ const firstAccount = response?.accounts?.[0];
104
+ const rawIndex = firstAccount?.index;
105
+ const index = typeof rawIndex === 'number' ? rawIndex : Number(rawIndex);
106
+ if (!firstAccount || !Number.isFinite(index)) {
107
+ throw new Error(`Lighter adapter: could not resolve accountIndex for ${l1Address}. ` +
108
+ 'Has the user created a Lighter account via an L1 deposit?');
109
+ }
110
+ cachedAccountIndex = index;
111
+ return index;
112
+ };
113
+ let signerPromise = preConfiguredSigner
114
+ ? Promise.resolve(preConfiguredSigner)
115
+ : null;
116
+ const getSigner = () => {
117
+ if (signerPromise)
118
+ return signerPromise;
119
+ signerPromise = (async () => {
120
+ const { SignerClient, ApiClient, TransactionApi } = await loadLighterSdk();
121
+ const accountIndex = await resolveAccountIndex();
122
+ const storageKey = `lighter-api-key:${normalizedL1Address}:${apiKeyIndex}`;
123
+ let hydratedAccountApiKey = accountApiKey ?? null;
124
+ if (!hydratedAccountApiKey && storage) {
125
+ const stored = await storage.get(storageKey);
126
+ hydratedAccountApiKey = stored ?? null;
127
+ }
128
+ if (hydratedAccountApiKey) {
129
+ const signerClient = new SignerClient({
130
+ url: apiUrl,
131
+ privateKey: hydratedAccountApiKey,
132
+ accountIndex,
133
+ apiKeyIndex,
134
+ chainId: LIGHTER_CIRCUIT_CHAIN_ID,
135
+ wasmConfig: resolvedWasmConfig
136
+ });
137
+ await signerClient.initialize();
138
+ await signerClient.ensureWasmClient();
139
+ return signerClient;
140
+ }
141
+ const keygenClient = new SignerClient({
142
+ url: apiUrl,
143
+ privateKey: DUMMY_API_KEY,
144
+ accountIndex,
145
+ apiKeyIndex,
146
+ chainId: LIGHTER_CIRCUIT_CHAIN_ID,
147
+ wasmConfig: resolvedWasmConfig
148
+ });
149
+ await keygenClient.initialize();
150
+ const keypair = await keygenClient.generateAPIKey();
151
+ if (!keypair) {
152
+ throw new Error('Lighter adapter: failed to generate an API keypair');
153
+ }
154
+ const signerClient = new SignerClient({
155
+ url: apiUrl,
156
+ privateKey: keypair.privateKey,
157
+ accountIndex,
158
+ apiKeyIndex,
159
+ chainId: LIGHTER_CIRCUIT_CHAIN_ID,
160
+ wasmConfig: resolvedWasmConfig
161
+ });
162
+ await signerClient.initialize();
163
+ await signerClient.ensureWasmClient();
164
+ const nonceApiClient = new ApiClient({ host: apiUrl });
165
+ const transactionApi = new TransactionApi(nonceApiClient);
166
+ const nextNonceResponse = (await transactionApi.getNextNonce(accountIndex, apiKeyIndex));
167
+ const rawNonce = nextNonceResponse?.nonce;
168
+ const nonceForChangeKey = typeof rawNonce === 'number' ? rawNonce : Number(rawNonce ?? 0);
169
+ const [, changeKeyTxHash, changeKeyError] = await signerClient.changeApiKey({
170
+ ethSigner: ethSignerShim,
171
+ newPubkey: keypair.publicKey,
172
+ newApiKeyIndex: apiKeyIndex,
173
+ nonce: Number.isFinite(nonceForChangeKey) ? nonceForChangeKey : 0
174
+ });
175
+ if (changeKeyError) {
176
+ throw new Error(`Lighter changeApiKey failed: ${changeKeyError}`);
177
+ }
178
+ if (!changeKeyTxHash) {
179
+ throw new Error('Lighter changeApiKey returned no transaction hash');
180
+ }
181
+ await pollLighterTransaction(signerClient, changeKeyTxHash, {
182
+ pollIntervalMs,
183
+ timeoutMs,
184
+ waitFor: 'committed'
185
+ });
186
+ if (storage) {
187
+ await storage.set(storageKey, keypair.privateKey);
188
+ }
189
+ return signerClient;
190
+ })();
191
+ signerPromise.catch(() => {
192
+ signerPromise = null;
193
+ });
194
+ return signerPromise;
195
+ };
196
+ return {
197
+ vmType: 'lvm',
198
+ getChainId: async () => exports.LIGHTER_CHAIN_ID,
199
+ address: async () => (await resolveAccountIndex()).toString(),
200
+ handleSignMessageStep: async () => {
201
+ throw new Error('Message signing not implemented for Lighter');
202
+ },
203
+ handleSendTransactionStep: async (_chainId, stepItem, _step) => {
204
+ const client = (0, relay_sdk_1.getClient)();
205
+ const action = stepItem.data?.action;
206
+ if (!action || action.type !== 'transfer') {
207
+ throw new Error(`Unsupported Lighter action: ${action?.type ?? 'undefined'}`);
208
+ }
209
+ const signerClient = await getSigner();
210
+ const params = action.parameters;
211
+ client.log(['Executing Lighter transfer', params], relay_sdk_1.LogLevel.Verbose);
212
+ const [, txHash, error] = await signerClient.transfer({
213
+ toAccountIndex: params.toAccountIndex,
214
+ assetIndex: params.assetIndex,
215
+ fromRouteType: params.fromRouteType,
216
+ toRouteType: params.toRouteType,
217
+ amount: params.amount,
218
+ usdcFee: params.usdcFee,
219
+ memo: params.memo,
220
+ ethSigner: ethSignerShim
221
+ });
222
+ if (error) {
223
+ throw new Error(`Lighter transfer failed: ${error}`);
224
+ }
225
+ if (!txHash) {
226
+ throw new Error('Lighter transfer returned no transaction hash');
227
+ }
228
+ client.log(['Lighter transaction broadcasted', txHash], relay_sdk_1.LogLevel.Verbose);
229
+ return txHash;
230
+ },
231
+ handleConfirmTransactionStep: async (txHash) => {
232
+ const signerClient = await getSigner();
233
+ const tx = await pollLighterTransaction(signerClient, txHash, {
234
+ pollIntervalMs,
235
+ timeoutMs,
236
+ waitFor: 'findable'
237
+ });
238
+ return {
239
+ txHash: tx.hash,
240
+ blockHeight: tx.block_height ?? 0,
241
+ status: tx.status
242
+ };
243
+ },
244
+ switchChain: async () => {
245
+ }
246
+ };
247
+ };
248
+ exports.adaptLighterWallet = adaptLighterWallet;
249
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":";;;AAAA,wDAKiC;AAEpB,QAAA,gBAAgB,GAAG,OAAO,CAAA;AAKvC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAEpC,MAAM,eAAe,GAAG,qCAAqC,CAAA;AAC7D,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAI/B,MAAM,mBAAmB,GAAG,eAAe,CAAA;AAC3C,MAAM,iBAAiB,GAAG,+DAA+D,mBAAmB,2BAA2B,CAAA;AACvI,MAAM,sBAAsB,GAAG,+DAA+D,mBAAmB,oBAAoB,CAAA;AAKrI,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;AAqDV,IAAI,gBAAgB,GAET,IAAI,CAAA;AACf,MAAM,cAAc,GAAG,GAErB,EA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ACO,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;QAExB,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AA3QY,QAAA,kBAAkB,sBA2Q9B"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./adapter.js"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B"}