Function Signature
Description
Signs an SVM transaction using the wallet identified by the supplied walletMetadata. The SDK is stateless — every call requires walletMetadata. Accepts a Transaction, VersionedTransaction, or hex string. Optionally requests gas sponsorship from Dynamic before signing.
When you pass externalServerKeyShares (the caller-supplied path), walletMetadata.externalServerKeySharesBackupInfo must also be present — signTransaction throws if shares are supplied but backup metadata is missing. The full walletMetadata returned from createWalletAccount / importPrivateKey already includes it; identity-only metadata from fetchWalletMetadata will be rejected.
Parameters
Required Parameters
walletMetadata (WalletMetadata) - Non-sensitive wallet metadata persisted from createWalletAccount() / importPrivateKey(). The signer address comes from walletMetadata.accountAddress.
transaction (VersionedTransaction | Transaction | string) - The transaction to sign
Optional Parameters
password (string) - Required if the wallet was created with backUpToDynamic: true.
externalServerKeyShares (ServerKeyShare[]) - Caller-supplied plaintext shares.
sponsor (boolean) - If true, requests gas sponsorship from Dynamic before signing. Requires a Transaction or VersionedTransaction (not a hex string).
Returns
Promise<string> - A base58-encoded Ed25519 signature — exactly 88 characters, which decodes to 64 bytes.
This is the raw signature only, not the full signed transaction.Verified return format:Calling VersionedTransaction.deserialize() on the decoded bytes will throw “Reached end of buffer unexpectedly” — confirming the 64 bytes are a signature, not a serialized transaction.To broadcast: decode the signature and add it back to the transaction using decodeBase58 and addSignatureToTransaction from @dynamic-labs-wallet/node-svm, then call connection.sendRawTransaction(signedTx.serialize()). See the example below.Passing the string directly to connection.sendRawTransaction() or the SDK’s sendTransaction() will fail — Buffer.from(base58string) interprets the characters as UTF-8 bytes (not the decoded signature), producing a garbled payload.
Example
Pass sponsor: true to have Dynamic sponsor the transaction fees. Gas sponsorship must be enabled in the Dynamic dashboard.