post
https://api.testnet.rise.trade/v1/account/margin-mode
Switch between cross and isolated margin mode for a market. Gas sponsored by API service.
Permit: Client signs an EIP-712 VerifyWitness permit; the server recovers the signer off-chain and matches it to permit_params.signer (server holds no keys).
Prerequisites:
GET /v1/auth/eip712-domain— EIP-712 domain (name,version,chainId,verifyingContract= Authorization contract)GET /v1/nonce-state/{account}—nonce_anchorandcurrent_bitmap_index(pass it aspermit_params.nonce_bitmap_index; if 208 the anchor is full — usenonce_anchor+1with bitmap index 0)GET /v1/system/config—routeraddress (RISExUniversalRouter), used as thetargetfield below
Action hash: (marginMode: 0 = Cross, 1 = Isolated)
actionHash = keccak256(abi.encode(
keccak256("RISE_PERPS_UPDATE_MARGIN_MODE_V1"), // bytes32 action selector
uint16(marketId),
uint8(marginMode)))
Permit digest (EIP-712):
VerifyWitness(address account,address target,bytes32 hash,uint48 nonceAnchor,uint8 nonceBitmap,uint32 deadline)
Sign as standard EIP-712 typed data (e.g. ethers signTypedData) with hash = actionHash, target = RISExUniversalRouter address (NOT the account, NOT the domain verifyingContract), nonceBitmap = permit_params.nonce_bitmap_index.
Signature: 64-byte EIP-2098 compact (r + yParityAndS) or 65-byte (r+s+v, auto-converted).
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…