Expand description
Derive credential storage.
Derive identifies a trading account through a three-part tuple rather than a single API key:
wallet_address: the Derive Chain smart-contract wallet (NOT the user’s EOA). This is the value placed in theX-LYRAWALLETheader and theownerslot of every signed action. Visible in the Derive web app under Home -> Developers -> “Derive Wallet”.session_key: a secp256k1 private key registered to the wallet. Signs REST/WS auth headers and EIP-712 typed-data actions. May be the owner EOA’s key but is more commonly a scoped session key.subaccount_id: per-wallet integer slot that holds the positions and signs eachprivate/orderrequest.
§Credential resolution
Credentials are resolved in the following priority order:
- Explicit values from config
DERIVE_WALLET_ADDRESS/DERIVE_SESSION_PRIVATE_KEY/DERIVE_SUBACCOUNT_IDenv vars (or the_TESTNET_variants when targeting testnet)
The session-key bytes are zeroized on drop.
Structs§
- Derive
Credential - Derive Chain smart-contract wallet + session-key + subaccount triple.
Functions§
- credential_
env_ vars - Returns the environment-variable triple
(wallet, session_key, subaccount)for the given environment.