@unlink-xyz/sdk 0.0.2-canary.0

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/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # `@unlink-xyz/sdk`
2
+
3
+ TypeScript SDK for Unlink account custody, private transfers, withdrawals, and engine API access.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @unlink-xyz/sdk viem
9
+ ```
10
+
11
+ ## Quickstart
12
+
13
+ ```ts
14
+ import { createUnlink, unlinkAccount, unlinkEvm } from "@unlink-xyz/sdk";
15
+ import { createPublicClient, createWalletClient, http } from "viem";
16
+ import { privateKeyToAccount } from "viem/accounts";
17
+ import { baseSepolia } from "viem/chains";
18
+
19
+ const evmAccount = privateKeyToAccount(
20
+ process.env.EVM_PRIVATE_KEY as `0x${string}`,
21
+ );
22
+
23
+ const walletClient = createWalletClient({
24
+ account: evmAccount,
25
+ chain: baseSepolia,
26
+ transport: http(process.env.RPC_URL),
27
+ });
28
+
29
+ const publicClient = createPublicClient({
30
+ chain: baseSepolia,
31
+ transport: http(process.env.RPC_URL),
32
+ });
33
+
34
+ const unlink = createUnlink({
35
+ engineUrl: "http://localhost:3030",
36
+ apiKey: process.env.UNLINK_API_KEY!,
37
+ account: unlinkAccount.fromMnemonic({
38
+ mnemonic: process.env.UNLINK_MNEMONIC!,
39
+ }),
40
+ evm: unlinkEvm.fromViem({
41
+ walletClient,
42
+ publicClient,
43
+ }),
44
+ });
45
+
46
+ const approval = await unlink.ensureErc20Approval({
47
+ token: "0xYourToken",
48
+ amount: "1000000000000000000",
49
+ });
50
+
51
+ if (approval.status === "submitted") {
52
+ await publicClient.waitForTransactionReceipt({
53
+ hash: approval.txHash as `0x${string}`,
54
+ });
55
+ }
56
+
57
+ const deposit = await unlink.deposit({
58
+ token: "0xYourToken",
59
+ amount: "1000000000000000000",
60
+ });
61
+
62
+ const relayedDeposit = await unlink.pollTransactionStatus(deposit.txId);
63
+ ```
64
+
65
+ ## Notes
66
+
67
+ - `createUnlink(...)` is the main high-level client surface.
68
+ - `unlinkAccount.*` handles Unlink account custody from mnemonic, seed, or raw keys.
69
+ - `unlinkEvm.*` adapts viem or ethers signers for approvals and deposits.
70
+
71
+ ## More
72
+
73
+ - Expanded quickstart: `docs/quickstart.md`
74
+ - Repository: `https://github.com/unlink-xyz/monorepo`