SDK: Lighter Adapter#983
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…lay-kit into feature/lighter-adapter
|
Claude finished @pedromcunha's task in 2m 43s —— View job 📝 Docs Drift Check — Confidence: MEDIUM What changed: Adds a new public wallet adapter package Docs impact: The adapters reference page currently lists every officially-maintained adapter (SVM, Bitcoin, Viem, Ethers, Sui, Tron) and enumerates supported Affected pages (paths inside
Draft: > Replace row: the **vmType** row inside the AdaptedWallet interface table
| **vmType** | A string representing a supported vmType (`evm` `svm` `bvm` `suivm` `tvm` `lvm`) | ✅ |> Insert after: the `[Tron Adapter](...)` paragraph under `### What adapters are available out of the box?`
[Lighter Adapter](https://github.com/relayprotocol/relay-kit/tree/main/packages/relay-lighter-wallet-adapter): This adapter gives the SDK the ability to deposit to [Lighter](https://lighter.exchange/) from any Relay-supported chain. It owns the full Lighter session lifecycle — resolving the user's Lighter account index, generating an in-memory API key, and registering it via `changeApiKey` on first transfer. Integrators who already run their own Lighter session (backend-provisioned key, wallet-level integration) can pass a pre-built `signerClient` to bypass the bootstrap entirely.> Insert after: the ` ```typescript Tron ` block inside the `<CodeGroup>` under `### How can I use an adapter?`, before the closing `</CodeGroup>`
```typescript Lighter
import { getClient, getQuote } from '@relayprotocol/relay-sdk'
import { adaptLighterWallet } from '@relayprotocol/relay-lighter-wallet-adapter'
import { createWalletClient, custom } from 'viem'
import { mainnet } from 'viem/chains'
// Lighter deposits are authorized by an L1 (EVM) signature, so the adapter
// only needs the user's connected EVM address and a signMessage callback.
const walletClient = createWalletClient({
chain: mainnet,
transport: custom(window.ethereum!)
})
const account = walletClient.account!
const adaptedWallet = adaptLighterWallet({
l1Address: account.address,
signL1Message: (message) =>
walletClient.signMessage({ account, message })
})
const options = ... // define this based on getQuote options (destinationChainId: 3586256, recipient: <Lighter account index>)
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet: adaptedWallet,
onProgress: ({ steps, fees, breakdown, currentStep, currentStepItem, txHashes, details }) => {
// custom handling
}
})
```> Insert after: the `# API Access` section's closing paragraph, before `## Lighter-Specific API Parameters`
<Tip>
If you're integrating via the SDK, the [Lighter wallet adapter](/references/relay-kit/sdk/adapters) wraps this flow — it resolves the user's Lighter account index, manages the API key lifecycle, and submits the L2 transfer on your behalf.
</Tip>Needs human input (optional):
To publish as a draft PR in
A separate workflow will open a draft PR attributed to you. Edit the draft freely before marking it ready for review. |
|
Claude finished @pedromcunha's task in 3m 20s —— View job Code Review — 1 issue found
Reviewed 21 files, 1661 additions / 27 deletions. Checked the new adapter (bootstrap + pre-built signer paths), the demo proxy ( Other things checked that look fine:
|
|
Claude finished @pedromcunha's task in 3m 9s —— View job Code Review — No issues found.
Reviewed 21 files, 1661 additions / 27 deletions. Checked the new Things checked that look correct:
One prior note (silent fallback to |
|
Claude finished @pedromcunha's task in 1m 46s —— View job 📝 Docs Drift Check — Confidence: MEDIUM What changed: Adds a new public wallet adapter package Docs impact: The adapters reference page currently lists every officially-maintained adapter (SVM, Bitcoin, Viem, Ethers, Sui, Tron) and enumerates supported Affected pages (paths inside
Draft: > Replace row: the **vmType** row inside the AdaptedWallet interface table
| **vmType** | A string representing a supported vmType (`evm` `svm` `bvm` `suivm` `tvm` `lvm`) | ✅ |> Insert after: the `[Tron Adapter](...)` paragraph under `### What adapters are available out of the box?`
[Lighter Adapter](https://github.com/relayprotocol/relay-kit/tree/main/packages/relay-lighter-wallet-adapter): This adapter gives the SDK the ability to deposit to [Lighter](https://lighter.exchange/) from any Relay-supported chain. It owns the full Lighter session lifecycle — resolving the user's Lighter account index, generating an in-memory API key, and registering it via `changeApiKey` on first transfer. Integrators who already run their own Lighter session (backend-provisioned key, wallet-level integration) can pass a pre-built `signerClient` to bypass the bootstrap entirely.> Insert after: the ` ```typescript Tron ` block inside the `<CodeGroup>` under `### How can I use an adapter?`, before the closing `</CodeGroup>`
```typescript Lighter
import { getClient, getQuote } from '@relayprotocol/relay-sdk'
import { adaptLighterWallet } from '@relayprotocol/relay-lighter-wallet-adapter'
import { createWalletClient, custom } from 'viem'
import { mainnet } from 'viem/chains'
// Lighter deposits are authorized by an L1 (EVM) signature, so the adapter
// only needs the user's connected EVM address and a signMessage callback.
const walletClient = createWalletClient({
chain: mainnet,
transport: custom(window.ethereum!)
})
const account = walletClient.account!
const adaptedWallet = adaptLighterWallet({
l1Address: account.address,
signL1Message: (message) =>
walletClient.signMessage({ account, message })
})
const options = ... // define this based on getQuote options (destinationChainId: 3586256, recipient: <Lighter account index>)
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet: adaptedWallet,
onProgress: ({ steps, fees, breakdown, currentStep, currentStepItem, txHashes, details }) => {
// custom handling
}
})
```> Insert after: the `# API Access` section's closing paragraph, before `## Lighter-Specific API Parameters`
<Tip>
If you're integrating via the SDK, the [Lighter wallet adapter](/references/relay-kit/sdk/adapters) wraps this flow — it resolves the user's Lighter account index, manages the API key lifecycle, and submits the L2 transfer on your behalf.
</Tip>Needs human input (optional):
To publish as a draft PR in
A separate workflow will open a draft PR attributed to you. Edit the draft freely before marking it ready for review. |
|
/publish-docs-pr |
|
🚚 Docs Draft PR — starting publish to |
|
Claude finished @pedromcunha's task in 1m 54s —— View job Publishing docs update — done
Materialized the drift draft into two docs files — Deviations from strict style guide:
|
|
✅ Docs Draft PR opened: relayprotocol/relay-docs#304 @pedromcunha is assigned on the draft PR. Review and mark ready when it's good. |
* docs(drift): draft from relayprotocol/relay-kit#983 Requested by @pedromcunha via /publish-docs-pr on relayprotocol/relay-kit#983 * lighter sdk doc tweaks * Improve the lighter integration guide * Fix PR review feedback * Fix lighter docs nits and feedback * Fix lighter docs nits and feedback * Fix lighter docs nits and feedback * Fix lighter docs nits and feedback --------- Co-authored-by: relay-docs-bot <relay-docs-bot@users.noreply.github.com>
No description provided.