Signing
Every one of these returns401, and the request looks correct in your logs.
- Timestamps are Unix milliseconds -
Date.now(),timestamp_millis(). Seconds is the single most common cause of a rejected signature. - Signatures are base64 - not base58, not hex.
- The value order matches the endpoint.
timestampis second to last on trade, and last on withdraw, lending and settle. - The signature is in the right field. The account reads take
signature; every other signed endpoint takesuser_signature.
Wallets
- A fresh one-time wallet for every trade. Reusing one links those trades back together, and will be disallowed.
- One
smart_wallet_idfor the life of a position. Lending is the opposite of trading here - every action on a position reuses the wallet it was opened with. - Transactions are serialized unsigned, with the one-time wallet as signer and fee payer. Vanish appends its own instructions and signs the result; a pre-signed transaction cannot be wrapped.
Commits
- Every action is committed - success, failure, or expiry alike. Until it is, the user’s balance sits pending indefinitely.
- Retries reuse the original
tx_id. Both commit endpoints are idempotent, so a retry returns the first result; building a new transaction instead strands the old one. /account/pendingand/borrow/pendingrun on startup, so a restart mid-flow does not leave actions uncommitted.
Next Steps
- Error Handling - Status codes, commit statuses, and recovering interrupted flows.
- Signing - The exact message each endpoint expects.
