Skip to main content

Introduction

A Swig wallet holds assets and gives each authority a defined set of permissions. Use this flow when onboarding a user or creating an application-controlled wallet. You can supply an initial authority directly, reuse a saved policy template, or reserve an address from a root authority before creating the wallet. The SDK prepares transactions. Your application signs and submits them; the wallet exists on-chain after confirmation. Start with Client setup. Address reservation requires TypeScript 0.12.0 or Python 0.11.0. The Rust reservation examples use the SDK source, pending the next crates.io release.

SDK examples

Create with an initial authority

Create an inline Ed25519 wallet. Use the configured swig client in TypeScript/Python and wallet: WalletClient in Rust.
For a saved template, supply policyId / policy_id; in Rust, use policy_id: Some(policy_id) and set initial_user only when the template needs it. TypeScript/Python return wallet addresses and an ordered transactions list. Sign and submit every transaction in that order. Rust returns WalletCreation with one transaction. Complete embedded signature requests and inspect each transaction’s required Solana signers, including its fee payer. An empty signature-request list can still require an Ed25519 signature. Continue with Signing and Paymaster for sponsored submission.

Create from a policy template

Use the saved template ID. Supply the initial authority only when the template expects an application-provided key.
For composed templates, TypeScript also accepts roleAuthorities, an array of { roleTemplateId, authority } bindings for every additional TBD key. The server rejects missing or duplicate bindings and overrides of stored keys. Python and Rust retain the initial-role flow; use TypeScript for the complete composed template workflow. created.templateSetup contains the current template snapshot and resolved public keys. After creation confirms, apply its additional roles and rent claimer through their SDK operations. Confirm each transaction before preparing the next and inspect the resulting wallet. Recovery settings remain pending: hosted recovery setup is not currently supported; see Guardian recovery for the separate protocol integration. Do not report the full template as applied merely because wallet creation confirmed.

Reserve an address

Derive the wallet’s addresses from a root authority and an optional account index or salt. Address lookup creates no wallet or reservation record; the request counts toward API usage. Keep the same authority and options for activation.
walletAddress / wallet_address is the SOL deposit address and token-account owner. swigConfigAddress / swig_config_address identifies the wallet’s roles. Confirm that the selected network supports counterfactual creation before funding an address.

Create the reserved wallet

Use the same root authority and index or salt. The protocol initializes role 0 with that authority and All permission. A funded external fee payer signs the activation transaction; the root authority does not need to sign it.
The result contains the reserved addresses and one prepared transaction: created.creationTransaction in TypeScript, created.creation_transaction in Python, or created.transaction in Rust. Sign with the fee payer, submit, and confirm through the existing Signing and Paymaster flow. Preparation records the create-wallet intent and prepared response, and counts toward API usage. Reusing the reservation preserves the address. Repeated on-chain activation preserves existing roles and balances; retain the original inputs after owner rotation. A closed wallet cannot be recreated from its reservation.

Flow

Input

TypeScript/Python use address strings. Rust uses Pubkey for Ed25519 and compressed 33-byte SEC1 keys for secp256k1/secp256r1. An application supplies passkey or EVM public keys; credential creation remains in your signing layer. Reservation and activation use rootAuthority / root_authority; inline or policy creation uses initialUser / initial_user. Reserved activation has a fixed root role and accepts no policy template.

Errors