Install SDK
canary npm dist-tag.
Choose a chain
The SDK connects to a hosted deployment byenvironment name. The examples below
use base-sepolia. See Supported chains for the full list.
Choose custody model
- Non-custodial browser apps import from
@unlink-xyz/sdk/browser. - Custodial servers, CLIs, workers, and agents import from
@unlink-xyz/sdk/client.
@unlink-xyz/sdk/admin on your backend for registration,
authorization tokens, and backend reads. See Custody models for
the details.
Create an API key
Create an API key before wiring your backend examples below:- Sign in at dashboard.unlink.xyz.
- Create or select an organization.
- Create a project and choose the target chain.
- Open the project’s API Keys page.
- Click Create key, enter a label, and copy the revealed key.
- Store it as
UNLINK_API_KEYin your backend or server environment.
Browser non-custodial client
The browser owns the user’s spending key. Your backend exposes two routes:POST /api/unlink/registerPOST /api/unlink/authorization-token
createUnlinkClient posts registration to /api/unlink/register
and authorization-token requests to /api/unlink/authorization-token on your
backend. Pass registerUrl or authorizationToken.url only if your app mounts
those routes somewhere else.
App backend routes
Use the backend-only API key from Create an API key.Local demo routes
Browser clients call the register and authorization-token routes even in local demos. For throwaway UI work, you can stub the routes, then replace the stubs withcreateUnlinkAuthRoutes before testing real funds.
admin.users.register, check address ownership, and issue the token
through admin.authorizationTokens.issue.
Server or custodial client
When your server is allowed to hold user accounts, wire the user client directly to the admin client. Use the backend-only API key from Create an API key.createUnlinkClient signs private actions. See
Account constructors for which helper
supports execute().
EVM provider
Deposits andexecute() need an EVM provider. Use the adapter that matches your
wallet stack. Browser apps can start with the injected EIP-1193 provider.
evm: evmProvider when constructing the client, or pass it per call.
The SDK also includes evm.fromViem, evm.fromEthers, and evm.fromSigner
for apps that already use those stacks.
Fund with test tokens
Faucet helpers are available only on configured testnet environments. Use a test token configured for the environment you selected.Transfer
Deposit from an EVM wallet
Derive account from a wallet signature
account.fromWallet (shown above) asks the wallet to sign a deterministic
message and derives the Unlink account from that signature. For the message
format, fromEthereumSignature, and recovery guidance, see
Accounts and keys.