SwigClient and the API key
stay on your server. After the server prepares a transaction, the TypeScript
/browser entrypoint provides a small set of signers for application-owned
wallets and passkeys.
The helpers accept no API key, cannot call Swig’s hosted API, and never receive
a private key. Your application still owns user authorization, the signer, and
key custody.
Decide how to sign
Do not use an emptysignatureRequests / signature_requests array as proof
that a transaction needs no application signature. Those records describe
embedded secp256r1 or secp256k1 signatures. A native Ed25519 authority is a
required signer in the serialized Solana transaction instead, so the array can
be empty while the Ed25519 transaction signature is still missing.
Match the signing path to the requester authority used during preparation and
to the transaction’s required signer set. Use each signature request to select
and patch the corresponding secp256r1 or secp256k1 signer.
Ed25519 and application-defined signers
Use the generic helper when your application already knows how to sign a serialized Solana transaction:TypeScript
Secp256r1 and passkeys
The passkey adapter requests an assertion from the application environment and patches the returned WebAuthn data into the prepared Swig transaction:TypeScript
Secp256k1 and EVM wallets
The EVM adapter wraps an EIP-1193 provider withpersonal_sign and formats the
result for a Swig secp256k1 authority:
TypeScript
Return to the server
Send the signed serialized transaction back through an authenticated application route. The server can then callswig.transactions.sponsor(...), submit through its own RPC path, and track
confirmation or finality.
Do not send the Swig developer API key, signer object, private key, or raw
credential material across this boundary.
