SPB Git

Repository Public

agents-perp-live-prepare.json 16.3 KB 441 lines json

1{2  "_source": "services/api/src/agents/mandate-write.ts prepareLive (shape) — values generated by perp-live-cycle.ts deriveMandate, packages/trading compileToVenueMandate, venueMandateHash, tradingMandateHashHex and canonicalIntentHash (/tmp/spw-vectors-agents.mts)",3  "locale": "en",4  "mandate": {5    "v": 1,6    "mandateId": "7a1c1f0e-8f5f-4b1e-9c56-0000000a0900",7    "authorizationId": "7a1c1f0e-8f5f-4b1e-9c56-0000000a0500",8    "keyId": "spw-0123456789abcdef",9    "venue": "hyperliquid",10    "network": "testnet",11    "account": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",12    "agentAddress": "0x90f79bf6eb2c4f870365e785982e1f101e93b906",13    "strategySha256": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3",14    "agentId": "5b1d6c1e-2f43-4a53-8f0a-0000000a3000",15    "instruments": [16      {17        "instrument": "hyperliquid:ETH",18        "maxLeverage": 1,19        "maxPositionNotional": "1000.12"20      },21      {22        "instrument": "hyperliquid:BTC",23        "maxLeverage": 1,24        "maxPositionNotional": "1000.12"25      }26    ],27    "maxOrderNotional": "1000.12",28    "maxGrossExposure": "1500.18",29    "maxOrdersPerDay": 96,30    "maxOrdersPerHour": 4,31    "maxDailyTurnover": "96011.52",32    "floorEquity": "900.11",33    "maxPriceDeviationBps": 300,34    "createdAt": 1794000000,35    "expiresAt": 1795209600,36    "ackSha256": "859fab5d4ecfdb5127e300cb96105ce2fc8e8ebbc80584ad02a2a88ee85ad783"37  },38  "hash": "cc4515da8e8a07ab16412f9239e5105f97ebac40bc522e867bc5dc2ea96f8f99",39  "options": {40    "challenge": "zEUV2o6KB6sWQS-SOeUQX5frrEC8Ui6Ge8XcLqlvj5k",41    "rpId": "wallet.example.test",42    "timeout": 120000,43    "userVerification": "required",44    "allowCredentials": []45  },46  "acknowledgement": {47    "text": "Hyperliquid — the venue's terms and your jurisdiction (Québec, Canada). Read on 2026-11-10.\nThis is general information, not legal advice. It is not a legal clearance, and SP Wallet gives none.\n1. Hyperliquid's terms of use (app.hyperliquid.xyz, last updated 2026-06-15, §1.6) exclude persons in the United States of America and in Ontario, Canada. Québec is not named. Those terms govern the website interface; §1.1 says the interface is not the exclusive means of access. No API terms and no documented API geo-blocking were found.\n2. §1.9 of those terms makes you solely responsible for determining whether leveraged or derivative trading is lawful where you live.\n3. The AMF's public page on buying and selling crypto says that platforms letting Québec clients trade crypto assets that are securities or derivatives must be registered with the AMF, and advises against dealing with platforms that are neither registered nor under a pre-registration undertaking. Hyperliquid is not on the AMF's register of crypto trading platforms (checked 2026-11-10). CSA Staff Notice 21-332 (2023) requires registered or undertaking platforms not to offer leverage to Canadian clients.\n4. Not verified: the AMF's warning list could not be searched in full; whether the venue blocks a Québec IP address in practice.\n5. SP Wallet does not work around any access restriction (no VPN, no proxy, no alternative path to a blocked service).\nBy approving, you confirm that you have read this summary and that enabling live derivative trading on this venue is your own decision and your own responsibility. Your confirmation is recorded in the audit log.",48    "sha256": "859fab5d4ecfdb5127e300cb96105ce2fc8e8ebbc80584ad02a2a88ee85ad783",49    "version": "2026-11-10",50    "source": "docs/v4/venues/jurisdiction.md"51  },52  "warning": "An approved strategy will place orders on this account without a passkey per order, inside these limits.",53  "enforcedBySigner": [54    "instruments",55    "maxLeverage",56    "maxOrderNotional"57  ],58  "trustedBySigner": [59    "the venue account state it reads itself"60  ],61  "notEnforced": [62    "the strategy code that runs"63  ],64  "windDown": "After the mandate ends, cancels and reduce-only orders are still signed for 24 hours.",65  "proposal": {66    "capital": "1000.12",67    "days": 14,68    "maxDays": 30,69    "body": {70      "instruments": [71        {72          "instrument": "hyperliquid:ETH",73          "maxLeverage": 2,74          "maxPositionNotional": "1000.12"75        },76        {77          "instrument": "hyperliquid:BTC",78          "maxLeverage": 2,79          "maxPositionNotional": "1000.12"80        }81      ],82      "maxOrderNotional": "1000.12",83      "maxGrossExposure": "1500.18",84      "maxDailyTurnover": "6000.72",85      "floorEquity": "900.11",86      "maxOrdersPerDay": 96,87      "maxOrdersPerHour": 4,88      "days": 14,89      "strategySha256": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3",90      "agentId": "5b1d6c1e-2f43-4a53-8f0a-0000000a3000"91    },92    "derived": [93      {94        "field": "capital",95        "value": "1000.12",96        "from": "the venue's account value now: the reference of every limit below and of the loss limits"97      },98      {99        "field": "instruments",100        "value": "hyperliquid:ETH, hyperliquid:BTC",101        "from": "the agent's instruments"102      },103      {104        "field": "maxLeverage",105        "value": "ETH 2x, BTC 2x",106        "from": "the agent's leverage limit (2x), never above the authorization's (5x) or the venue's maximum"107      },108      {109        "field": "maxPositionNotional",110        "value": "1000.12",111        "from": "position per instrument: 1 × the capital"112      },113      {114        "field": "maxOrderNotional",115        "value": "1000.12",116        "from": "one order may be as large as one position (a full close in one order); closes are bounded too"117      },118      {119        "field": "maxGrossExposure",120        "value": "1500.18",121        "from": "gross exposure: 1.5 × the capital"122      },123      {124        "field": "maxOrdersPerDay",125        "value": "96",126        "from": "2 instrument(s) × 24 bar(s) a day × 2 orders that can add exposure, at least 12"127      },128      {129        "field": "maxOrdersPerHour",130        "value": "4",131        "from": "2 instrument(s) × 2 orders that can add exposure, at least 4"132      },133      {134        "field": "maxDailyTurnover",135        "value": "6000.72",136        "from": "4 × the gross exposure limit a day (orders that can add exposure)"137      },138      {139        "field": "floorEquity",140        "value": "900.11",141        "from": "the total-loss limit: the capital less 10 % — below it the signer signs only cancels and reduce-only orders"142      },143      {144        "field": "days",145        "value": "14",146        "from": "at most 30 days, and ending at least 24 h before the venue authorization expires (2027-01-05T21:20:00.000Z) so that positions can be closed during the wind-down"147      }148    ],149    "notes": []150  },151  "binding": {152    "domain": "SPW-TRADING-MANDATE-APPROVAL-v1",153    "intent": {154      "v": 1,155      "kind": "trading_mandate_approval",156      "mandateId": "7a1c1f0e-8f5f-4b1e-9c56-0000000a0900",157      "tradingMandateHash": "ea23a284da91f0e265be3ffa5532d2f5f4c369e1c47ce71b5f80a3b1db82c368",158      "principal": "agent:5b1d6c1e-2f43-4a53-8f0a-0000000a3000",159      "mode": "live",160      "signer": {161        "shape": "SPW-VENUE-MANDATE-v1",162        "mandateHash": "cc4515da8e8a07ab16412f9239e5105f97ebac40bc522e867bc5dc2ea96f8f99"163      },164      "nonce": "7a1c1f0e-8f5f-4b1e-9c56-0000000a0720",165      "createdAt": 1794000000000,166      "expiresAt": 1794000300000167    },168    "hash": "d4dd3262aa385ebbe60d8973cf0f476979c48ddfc493da8dec95b0fa5784b12d",169    "options": {170      "challenge": "1N0yYqo4XrvmDYlzzw9HaXnEjd_Ek9qN7JWw-leEsS0",171      "rpId": "wallet.example.test",172      "timeout": 120000,173      "userVerification": "required",174      "allowCredentials": []175    },176    "expiresAt": 1794000300000177  },178  "tradingMandate": {179    "id": "7a1c1f0e-8f5f-4b1e-9c56-0000000a0900",180    "hash": "ea23a284da91f0e265be3ffa5532d2f5f4c369e1c47ce71b5f80a3b1db82c368",181    "mandate": {182      "v": 1,183      "mandateId": "7a1c1f0e-8f5f-4b1e-9c56-0000000a0900",184      "principal": {185        "kind": "agent",186        "id": "5b1d6c1e-2f43-4a53-8f0a-0000000a3000"187      },188      "accounts": [189        {190          "kind": "venue_account",191          "venue": "hyperliquid",192          "network": "testnet",193          "account": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"194        }195      ],196      "venues": [197        "hyperliquid"198      ],199      "networks": [200        "testnet"201      ],202      "instruments": [203        "hyperliquid:ETH",204        "hyperliquid:BTC"205      ],206      "marketKinds": [207        "perp"208      ],209      "orderTypes": [210        "market"211      ],212      "maxCapitalUsd": "1500.18",213      "maxOrderNotionalUsd": "1000.12",214      "maxPositionNotionalUsd": "1000.12",215      "maxLeverage": "1",216      "maxDailyLossUsd": "30.01",217      "floorEquityUsd": "900.11",218      "createdAt": 1794000000,219      "notBefore": 1794000000,220      "notAfter": 1795209600,221      "frequency": {222        "perMinute": 4,223        "perHour": 4,224        "perDay": 96225      },226      "maxSlippageBps": 300,227      "maxFeeUsd": "2.02",228      "stopConditions": [229        {230          "kind": "loss_gte",231          "usd": "100.01"232        },233        {234          "kind": "consecutive_rejects_gte",235          "count": 25236        }237      ],238      "mode": "live",239      "strategySha256": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3",240      "label": "live · Momentum"241    },242    "enforcement": [243      {244        "field": "v",245        "enforcedBy": "not_applicable",246        "signerField": null,247        "note": "version of the trading mandate; the signer shape has its own"248      },249      {250        "field": "mandateId",251        "enforcedBy": "signer",252        "signerField": "mandateId",253        "note": "the derivative mandate carries the same id: one id for the pair"254      },255      {256        "field": "principal",257        "enforcedBy": "signer_partial",258        "signerField": "agentId",259        "note": "recorded by the signer for the audit trail; the signer cannot verify who calls it — the API binds the principal to the mandate"260      },261      {262        "field": "accounts",263        "enforcedBy": "signer",264        "signerField": "account, agentAddress, authorizationId",265        "note": "the signer signs for this one venue account only"266      },267      {268        "field": "venues",269        "enforcedBy": "signer",270        "signerField": "venue",271        "note": "the shape is for hyperliquid only"272      },273      {274        "field": "networks",275        "enforcedBy": "signer",276        "signerField": "network",277        "note": "the venue network of the authorization"278      },279      {280        "field": "instruments",281        "enforcedBy": "signer",282        "signerField": "instruments[].instrument",283        "note": "the signer refuses an order or a leverage change on any other instrument; a cancel is bounded by the instruments of the venue authorization, which may be wider"284      },285      {286        "field": "marketKinds",287        "enforcedBy": "signer",288        "signerField": null,289        "note": "structural: this shape signs perpetual orders only"290      },291      {292        "field": "orderTypes",293        "enforcedBy": "api_only",294        "signerField": null,295        "note": "the signer signs any order type the venue adapter can build; the allowed types are checked by the API"296      },297      {298        "field": "maxCapitalUsd",299        "enforcedBy": "signer_partial",300        "signerField": "maxGrossExposure",301        "note": "enforced as worst-case gross exposure ≤ capital × leverage; the capital itself (collateral on the venue) is not capped by the signer"302      },303      {304        "field": "maxOrderNotionalUsd",305        "enforcedBy": "signer",306        "signerField": "maxOrderNotional",307        "note": "size × highest named price of one order, reduce-only orders included"308      },309      {310        "field": "maxPositionNotionalUsd",311        "enforcedBy": "signer",312        "signerField": "instruments[].maxPositionNotional",313        "note": "worst case per instrument, from the signer's own read of the venue account and its own prices"314      },315      {316        "field": "maxLeverage",317        "enforcedBy": "signer",318        "signerField": "instruments[].maxLeverage",319        "note": "the signer refuses an order that can add exposure while the venue's leverage setting is higher, and never sets a higher one"320      },321      {322        "field": "maxDailyLossUsd",323        "enforcedBy": "api_only",324        "signerField": null,325        "note": "the signer has no daily-loss limit; it only knows the floor"326      },327      {328        "field": "floorEquityUsd",329        "enforcedBy": "signer",330        "signerField": "floorEquity",331        "note": "below the floor the signer signs reduce-only orders and cancels only (the venue's own account value)"332      },333      {334        "field": "createdAt",335        "enforcedBy": "signer",336        "signerField": "createdAt",337        "note": "must be current at approval"338      },339      {340        "field": "notBefore",341        "enforcedBy": "signer_partial",342        "signerField": "createdAt",343        "note": "the signer has no start time: it signs from the approval on, and accepts an approval only while createdAt is within 10 minutes before and 2 minutes after its own clock; the start itself is checked by the API"344      },345      {346        "field": "notAfter",347        "enforcedBy": "signer",348        "signerField": "expiresAt",349        "note": "after it the signer signs only cancels and reduce-only orders for 24 h, then nothing"350      },351      {352        "field": "frequency",353        "enforcedBy": "signer_partial",354        "signerField": "maxOrdersPerDay, maxOrdersPerHour",355        "note": "per day and per hour are enforced by the signer (orders that can add exposure; the venue authorization's own daily count applies as well); per minute is enforced by the API only"356      },357      {358        "field": "maxSlippageBps",359        "enforcedBy": "signer_partial",360        "signerField": "maxPriceDeviationBps",361        "note": "the signer enforces a price band around its own mid on every price of an order — except a reduce-only trigger order, whose trigger may rest between one third and three times the mid, its worst price then being held within the band of the trigger; realised slippage is checked by the API"362      },363      {364        "field": "maxFeeUsd",365        "enforcedBy": "api_only",366        "signerField": null,367        "note": "the signer does not see venue fees"368      },369      {370        "field": "stopConditions",371        "enforcedBy": "api_only",372        "signerField": null,373        "note": "declarative conditions are evaluated by the API; the signer only stops on the floor, the expiry, a revocation and its own halt"374      },375      {376        "field": "mode",377        "enforcedBy": "not_applicable",378        "signerField": null,379        "note": "the signer has no notion of paper or live: a mandate reaches it only when it is live (a paper mandate is never compiled); the venue network is the row `networks`"380      },381      {382        "field": "strategySha256",383        "enforcedBy": "signer_partial",384        "signerField": "strategySha256",385        "note": "recorded by the signer for the audit trail; the signer cannot verify what code runs"386      },387      {388        "field": "label",389        "enforcedBy": "api_only",390        "signerField": null,391        "note": "a display name; not part of the signer shape"392      }393    ],394    "derived": [395      {396        "field": "maxGrossExposure",397        "value": "1500.18",398        "from": "maxCapitalUsd × maxLeverage"399      },400      {401        "field": "maxDailyTurnover",402        "value": "96011.52",403        "from": "maxOrderNotionalUsd × frequency.perDay"404      },405      {406        "field": "instruments[].maxLeverage",407        "value": "1",408        "from": "maxLeverage (the same for every instrument)"409      },410      {411        "field": "maxPriceDeviationBps",412        "value": "300",413        "from": "maxSlippageBps"414      }415    ],416    "risk": "/risk?mandate=7a1c1f0e-8f5f-4b1e-9c56-0000000a0900"417  },418  "_context": {419    "agentId": "5b1d6c1e-2f43-4a53-8f0a-0000000a3000",420    "accountId": "0d6e3c2a-7b1f-4c0e-9d55-0000000a4000",421    "account": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",422    "network": "testnet",423    "universe": [424      "ETH",425      "BTC"426    ],427    "risk": {428      "maxLeverage": 2,429      "maxGrossExposureX": 1.5,430      "maxPositionX": 1,431      "maxDailyLossPct": 3,432      "maxTotalLossPct": 10,433      "slippageBps": 30,434      "minTradePct": 2435    },436    "days": 14,437    "strategySha256": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3",438    "now": 1794000000439  }440}441
Files main
Menu

Theme