Skip to main content

Set up the examples

For the individual examples, you need an RPC endpoint and a compatible Swig deployment. Obtain the factory address and deployment details from your operator or contact Swig. The public SDK source does not deploy the contracts for you. The EVM packages are available from source. These guides use the tested examples in swig-protocol-sdk, rather than a published package release.
Choose a language and keep its working directory for the commands in these guides.
Set RPC_URL to the chain you are using. For writes, load SIGNER_PRIVATE_KEY into your environment from your application’s key storage. Keep private keys outside source files and logs. The examples use secp256k1 authorities. For your own deployment, obtain a factory matching the SDK’s pinned contract revision. The guides do not assume a public-chain deployment address. A direct transaction requires gas in the signing key’s EOA.

Understand the two addresses

  • Account address: the Swig config contract. It stores roles and permissions and receives the wallet’s execution requests. Use this as ACCOUNT_ADDRESS.
  • Vault address: the contract that holds the wallet’s assets. Transfers spend from this balance. Funding the vault does not fund the signer’s gas balance.

Run your first scenario

Create a wallet, then add a role and send a transfer. Each scenario uses the language directory you selected above.

Try every scenario locally

This optional contributor workflow requires access to Swig’s private contracts repository, swig-dev-portal, and all three language toolchains. It is separate from running one language’s examples against an existing deployment. The disposable test runner builds and deploys the pinned contracts, creates test wallets, and runs all 16 examples. It owns Anvil and Rundler through Docker Compose and removes them when the run finishes. It uses public development keys. Install Bun, Node.js/npm, Foundry, Docker with Compose, Rust through rustup, and uv. Check out swig-dev-portal using your authorized repository access so the runner can read the pinned contract commit. From the swig-protocol-sdk root:
The run checks deployed addresses, authority identities, transfers, remaining allowances, and sponsored-operation receipts. This verifies the local SDK and bundler configuration; a hosted provider needs its own compatibility check.