Skip to main content

Python SDK for preparing and locally signing Swig wallet transactions

Project description

Swig Developer SDK for Python

Python parity for @swig-wallet/developer-sdk. The Swig API prepares wallet transactions; this SDK invokes application-owned signers and inserts signatures locally with solders.

pip install swig-developer-sdk

Prepare a transaction

from swig_developer_sdk import SwigClient

swig = SwigClient(api_key="swig_...", network="devnet")
wallet = swig.wallets.use(
    "SWIG_CONFIG_ADDRESS",
    requester_authority={"ed25519": {"publicKey": "USER_PUBLIC_KEY"}},
)

prepared = await wallet.transfer.sol(
    fee_payer="FEE_PAYER",
    destination="DESTINATION",
    amount=1_000_000,
)

wallet.transfer(...) and wallet.swap(...) are callable like their TypeScript counterparts. Their explicit sol, token, spl_token, and jupiter methods are available as well.

Sign locally

The generic signer helper works with an application-owned Ed25519 signer. The Swig signer helper patches secp256r1 or secp256k1 signatures into both legacy and versioned Solana transactions without sending signing material to the API.

from swig_developer_sdk import sign_prepared_swig_transaction

signed = await sign_prepared_swig_transaction(
    prepared,
    secp256r1=application_passkey_signer,
)

WebAuthn and EIP-1193 adapters are callback-based so applications can connect their browser, hardware, wallet, or remote signer without changing the transaction preparation API.

Local end-to-end test

With the swig-dev-portal Tilt stack running, this command seeds a temporary local API key and exercises wallet creation, real P-256 signing, direct and grouped SOL transfers, an SPL-token transfer, and the Python proxy through the Developer API. It also verifies the live paymaster balance endpoint and a sponsored transfer where the user pays no network fee. Every transaction is submitted to Surfpool and verified on-chain; the paymaster flow also retries with the same idempotency key and verifies that no balance changes repeat.

bun run e2e:developer-sdk:python

The defaults are http://localhost:8080 for the Developer API, http://localhost:8899 for Surfpool, and the Tilt Postgres instance on port 55432. Override them with SWIG_TRANSACTION_API_URL, SOLANA_RPC_URL, or SWIG_DATABASE_URL.

Jupiter and recovery are not counted by this local test: Jupiter needs a mainnet-backed Surfpool, while recovery setup needs a reachable operator signer.

See the repository-level parity matrix for the complete mapped surface.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swig_developer_sdk-0.6.0.tar.gz (80.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swig_developer_sdk-0.6.0-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file swig_developer_sdk-0.6.0.tar.gz.

File metadata

  • Download URL: swig_developer_sdk-0.6.0.tar.gz
  • Upload date:
  • Size: 80.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for swig_developer_sdk-0.6.0.tar.gz
Algorithm Hash digest
SHA256 f259ca6fdd955f4a457d6d9ea03d6d1c06afb00bb761962eb53b07cdc19109a3
MD5 b7cf00fd2571bb45a14436303acfdb2b
BLAKE2b-256 74789764812c301b401a4b35aed882808c4845d15771682c96f598297827bfea

See more details on using hashes here.

File details

Details for the file swig_developer_sdk-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: swig_developer_sdk-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for swig_developer_sdk-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e3d0ec8e014e9365e2a8c87905a01eaae4cd75361cdd98f6badb6de79c7723
MD5 aa9f3e4255b0248d12ac6f0ff4ede6e1
BLAKE2b-256 3594c8e4f297c8f37e47fa588c67cab7c710645447e33e4097567cca4d4f57c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page