Skip to content

Commit a1ca6c0

Browse files
authored
feat: improve typescript sdk docs (#2946)
2 parents 38cfe9f + d845952 commit a1ca6c0

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

docs/src/content/docs/integrations/typescript/index.mdx

+10-6
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import { Tabs, TabItem } from '@astrojs/starlight/components'
99
<PackageManagers
1010
type="add"
1111
frame="none"
12-
pkg="@unionlabs/client"
12+
pkg="@unionlabs/client@latest"
1313
pkgManagers={['npm', 'pnpm', 'bun', 'yarn']}
1414
/>
1515

16-
The Union client is TypeScript-first and framework agnostic.
16+
The Union Client is TypeScript-first and framework agnostic.
1717
At [app.union.build](https://app.union.build) we use [Svelte](https://svelte.dev) but you can use any framework or no frameworks at all.
18-
If you're a [React](https://reactjs.org) user, [checkout this demo on Stackblitz](https://stackblitz.com/edit/github-nav3yr-xbanxq?file=src%2Fapp.tsx).
18+
If you're a [React](https://reactjs.org) developer, [checkout this demo on Stackblitz](https://stackblitz.com/edit/github-nav3yr-xbanxq?file=src%2Fapp.tsx).
1919

2020
:::note
2121

@@ -140,10 +140,14 @@ console.info(`Transfer hash: ${transfer.value}`)
140140
import { privateKeyToAccount } from "viem/accounts"
141141
import { createUnionClient, http } from "@unionlabs/client"
142142

143+
let PRIVATE_KEY = process.env["PRIVATE_KEY"]
144+
if (!PRIVATE_KEY) throw new Error("PRIVATE_KEY is not set")
145+
PRIVATE_KEY = PRIVATE_KEY.startsWith("0x") ? PRIVATE_KEY : `0x${PRIVATE_KEY}`
146+
143147
export const unionClient = createUnionClient({
144148
chainId: "80084",
145-
transport: http("https://bartio.rpc.berachain.com"),
146-
account: privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`),
149+
account: privateKeyToAccount(PRIVATE_KEY),
150+
transport: http("https://bartio.rpc.berachain.com")
147151
})
148152
```
149153
</TabItem>
@@ -152,5 +156,5 @@ export const unionClient = createUnionClient({
152156
Run the above example
153157

154158
```bash frame="none"
155-
PRIVATE_KEY= npm_config_yes=true npx tsx main.ts
159+
PRIVATE_KEY="" npm_config_yes=true npx tsx main.ts
156160
```

typescript-sdk/bun.lockb

-2.87 KB
Binary file not shown.

typescript-sdk/jsr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://jsr.io/schema/config-file.v1.json",
33
"name": "@union/client",
4-
"version": "0.0.18",
4+
"version": "0.0.19",
55
"license": "MIT",
66
"exports": {
77
".": "./src/mod.ts"

typescript-sdk/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@unionlabs/client",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"homepage": "https://jsr.io/@union/client",
55
"description": "Union Labs cross-chain transfers client",
66
"type": "module",
@@ -36,7 +36,7 @@
3636
"@scure/base": "1.1.8",
3737
"neverthrow": "^8.0.0",
3838
"ofetch": "^1.3.4",
39-
"viem": "^2.21.4"
39+
"viem": "^2.21.6"
4040
},
4141
"devDependencies": {
4242
"@arethetypeswrong/cli": "^0.16.2",
@@ -48,13 +48,13 @@
4848
"@types/node": "^22.5.4",
4949
"consola": "^3.2.3",
5050
"cosmjs-types": "^0.9.0",
51-
"jsr": "^0.13.1",
51+
"jsr": "^0.13.2",
5252
"patch-package": "^8.0.0",
5353
"tsup": "^8.2.4",
54-
"tsx": "^4.19.0",
54+
"tsx": "^4.19.1",
5555
"typescript": "^5.6.2",
5656
"vite-tsconfig-paths": "^5.0.1",
57-
"vitest": "^2.0.5"
57+
"vitest": "^2.1.0"
5858
},
5959
"repository": {
6060
"type": "git",

0 commit comments

Comments
 (0)