feat: TON wallet adapter#1038
Conversation
…o ted/int2-639-add-ton-wallet-adapter-to-relay-kit
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ted-palmer's task in 1m 33s —— View job 📝 Docs Drift Check — Confidence: HIGH What changed: A new public wallet adapter package Docs impact: The Adapters reference page is now stale — it does not list Affected pages (paths inside
Draft: > Replace row in the interface table: the `vmType` row
| **vmType** | A string representing a supported vmType (`evm` `svm` `bvm` `tvm` `lvm` `tonvm`) | ✅ |> Insert after: the `[Lighter Adapter]` entry under `### What adapters are available out of the box?`
[TON Adapter](https://github.com/relayprotocol/relay-kit/tree/main/packages/relay-ton-wallet-adapter): This adapter gives the SDK the ability to submit transactions on the TON blockchain. The user's key stays in their wallet, so the adapter never signs — you pass a `sendTransaction` callback (for example wrapping Dynamic's TON connector or TonConnect UI) that signs and broadcasts the request, while the adapter handles request building and on-chain confirmation. Confirmation reads default to a public toncenter endpoint; pass your own `@ton/ton` `TonClient` or an `endpoint` via the optional `options` argument for production use. TON support requires the `@ton/core` and `@ton/ton` peer dependencies in addition to `viem` and `@relayprotocol/relay-sdk`.> Insert after: the `Lighter` tab inside the `<CodeGroup>` under `### How can I use an adapter?` (before the closing `</CodeGroup>`)
```typescript TON
import { getClient, Execute, getQuote } from "@relayprotocol/relay-sdk"
import { adaptTonWallet } from '@relayprotocol/relay-ton-wallet-adapter'
// The user's key lives in their TON wallet, so the adapter never signs. You
// provide a sendTransaction callback that forwards the TonConnect-style request
// to your wallet provider (e.g. Dynamic's TON connector or tonConnectUI), signs
// + broadcasts it, and returns the result. The adapter accepts a signed
// external-message { boc } (what most TonConnect wallets return) or a
// { transactionHash }.
const adaptedWallet = adaptTonWallet(walletAddress, async (request) => {
const { boc } = await wallet.sendTransaction(request)
return { boc }
})
const options = ... // define this based on getQuote options
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet: adaptedWallet,
onProgress: ({ steps, fees, breakdown, currentStep, currentStepItem, txHashes, details }) => {
// custom handling
},
...
})
```Needs human input:
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 @ted-palmer's task in 2m 41s —— View job Code Review
The core TON adapter is well-built and clearly documented. The The findings below are all about unrelated changes bundled into this PR (a repo guideline), not the TON feature itself. Code Review — 3 issue(s) found
Nice work on the adapter itself — the documentation around bounceable address encoding and the message-hash reconciliation is especially clear. |
|
Claude finished @ted-palmer's task in 1m 45s —— View job Code Review
The TON adapter is well-built and the Note: the Code Review — 2 issue(s) found
Nice work — the documentation around bounceable-address encoding and the message-hash reconciliation between the signed BOC and the on-chain inbound message is especially clear. |
|
Claude finished @ted-palmer's task in 1m 19s —— View job 📝 Docs Drift Check — Confidence: HIGH What changed: A new public wallet adapter package Docs impact: The Adapters reference page is stale — it does not list Affected pages (paths inside
Draft: > Replace: the `vmType` row in the interface table under `### What is an adapter anyway?`
| **vmType** | A string representing a supported vmType (`evm` `svm` `bvm` `tvm` `lvm` `tonvm`) | ✅ |> Insert after: the `[Lighter Adapter]` entry under `### What adapters are available out of the box?`
[TON Adapter](https://github.com/relayprotocol/relay-kit/tree/main/packages/relay-ton-wallet-adapter): This adapter gives the SDK the ability to submit transactions on the TON blockchain. The user's key stays in their wallet, so the adapter never signs — you pass a `sendTransaction` callback (for example wrapping Dynamic's TON connector or TonConnect UI) that signs and broadcasts the request, while the adapter handles request building and on-chain confirmation. Confirmation reads default to a public toncenter endpoint; pass your own `@ton/ton` `TonClient` or an `endpoint` via the optional `options` argument for production use. TON support requires the `@ton/core` and `@ton/ton` peer dependencies in addition to `viem` and `@relayprotocol/relay-sdk`.> Insert after: the `Lighter` tab inside the `<CodeGroup>` under `### How can I use an adapter?` (before the closing `</CodeGroup>`)
```typescript TON
import { getClient, Execute, getQuote } from "@relayprotocol/relay-sdk"
import { adaptTonWallet } from '@relayprotocol/relay-ton-wallet-adapter'
// The user's key lives in their TON wallet, so the adapter never signs. You
// provide a sendTransaction callback that forwards the TonConnect-style request
// to your wallet provider (e.g. Dynamic's TON connector or tonConnectUI), signs
// + broadcasts it, and returns the result. The adapter accepts a signed
// external-message { boc } (what most TonConnect wallets return) or a
// { transactionHash }.
const adaptedWallet = adaptTonWallet(walletAddress, async (request) => {
const { boc } = await wallet.sendTransaction(request)
return { boc }
})
const options = ... // define this based on getQuote options
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet: adaptedWallet,
onProgress: ({ steps, fees, breakdown, currentStep, currentStepItem, txHashes, details }) => {
// custom handling
},
...
})
```Needs human input:
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 @ted-palmer's task in 1m 2s —— View job Docs update materialized ✅Applied the drafted TON adapter docs to the cloned
Changes — all in
Conformance: SDK reference profile (§3.4) — frontmatter intact, no new headings, external GitHub links match sibling adapter entries, code tab under 45 lines so no Note for reviewer: The interface table marks |
|
✅ Docs Draft PR opened: relayprotocol/relay-docs#343 @ted-palmer is assigned on the draft PR. Review and mark ready when it's good. |
| const getReadClient = (): TonClient => { | ||
| if (!_client) { | ||
| _client = new TonClient({ | ||
| endpoint: options?.endpoint ?? DEFAULT_TON_RPC |
There was a problem hiding this comment.
if the user changes endpoints to we recreate?
| // JSON-RPC gateway (drpc) that doesn't reliably serve `getAddressBalance` | ||
| // without a key, so we hit toncenter's REST endpoint directly — mirroring how | ||
| // the Tron balance hook hardcodes trongrid rather than using the chain RPC. | ||
| const TON_API_BASE = 'https://toncenter.com/api/v2' |
There was a problem hiding this comment.
Maybe we should have a way to override this via chain configs.
|
Claude finished @ted-palmer's task in 1m 38s —— View job Code Review
The TON adapter is well-built and the I also confirmed the two open review threads are handled in the latest code:
The remaining findings are all about unrelated changes bundled into this PR (a repo guideline: "No unrelated changes bundled into the PR"), not the TON feature itself. Code Review — 2 issue(s) found
Nice work on the adapter — the BOC/inbound-message hash reconciliation and the bounceable-address handling are especially clear, and the |
|
Claude finished @ted-palmer's task in 1m 40s —— View job 📝 Docs Drift Check — Confidence: HIGH What changed: A new public wallet adapter package Docs impact: The Adapters reference page is stale — it does not list Affected pages (paths inside
Draft: > Replace: the `vmType` row in the interface table under `### What is an adapter anyway?`
| **vmType** | A string representing a supported vmType (`evm` `svm` `bvm` `tvm` `lvm` `tonvm`) | ✅ |> Insert after: the `[Lighter Adapter]` entry under `### What adapters are available out of the box?`
[TON Adapter](https://github.com/relayprotocol/relay-kit/tree/main/packages/relay-ton-wallet-adapter): This adapter gives the SDK the ability to submit transactions on the TON blockchain. The user's key stays in their wallet, so the adapter never signs — you pass a `sendTransaction` callback (for example wrapping Dynamic's TON connector or TonConnect UI) that signs and broadcasts the request, while the adapter handles request building and on-chain confirmation. Confirmation reads default to a public toncenter endpoint; pass your own `@ton/ton` `TonClient` or an `endpoint` via the optional `options` argument for production use. TON support requires the `@ton/core` and `@ton/ton` peer dependencies in addition to `viem` and `@relayprotocol/relay-sdk`.> Insert after: the `Lighter` tab inside the `<CodeGroup>` under `### How can I use an adapter?` (before the closing `</CodeGroup>`)
```typescript TON
import { getClient, Execute, getQuote } from "@relayprotocol/relay-sdk"
import { adaptTonWallet } from '@relayprotocol/relay-ton-wallet-adapter'
// The user's key lives in their TON wallet, so the adapter never signs. You
// provide a sendTransaction callback that forwards the TonConnect-style request
// to your wallet provider (e.g. Dynamic's TON connector or tonConnectUI), signs
// + broadcasts it, and returns the result. The adapter accepts a signed
// external-message { boc } (what most TonConnect wallets return) or a
// { transactionHash }.
const adaptedWallet = adaptTonWallet(walletAddress, async (request) => {
const { boc } = await wallet.sendTransaction(request)
return { boc }
})
const options = ... // define this based on getQuote options
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet: adaptedWallet,
onProgress: ({ steps, fees, breakdown, currentStep, currentStepItem, txHashes, details }) => {
// custom handling
},
...
})
```Needs human input:
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. |
No description provided.