Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/api/info/_methods/spotClearinghouseState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ export type SpotClearinghouseStateResponse = {
*/
supplied?: string;
} | {
/** Outcome market identifier ("+" followed by `assetId - 100000000`). */
coin: `+${number}`;
/**
* Outcome market identifier:
* - `+N`: `N` is `assetId - 100000000` of an active outcome market.
* - `oN`: `N` is the identifier of a settled outcome.
*/
coin: `+${number}` | `o${number}`;
/**
* Total balance.
* @pattern ^[0-9]+(\.[0-9]+)?$
Expand Down Expand Up @@ -114,6 +118,16 @@ export type SpotClearinghouseStateResponse = {
*/
ratio: string,
][];
/** Portfolio supply ratio per token. */
tokenToPortfolioSupplyRatio?: [
/** Token identifier. */
token: number,
/**
* Supply ratio.
* @pattern ^[0-9]+(\.[0-9]+)?$
*/
ratio: string,
][];
/** Amount available after maintenance per token. */
tokenToAvailableAfterMaintenance?: [
/** Token identifier. */
Expand Down
10 changes: 3 additions & 7 deletions tests/api/info/spotClearinghouseState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,17 @@ runTest({
const params: SpotClearinghouseStateParameters[] = [
{ user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9" }, // balances.length > 0
{ user: "0x1defed46db35334232b9f5fd2e5c6180276fb99d" }, // evmEscrows.length > 0
{ user: "0x8c967e73e7b15087c42a10d344cff4c96d877f1d" }, // balances with an outcome market identifier
{ user: "0x6b043579b088d44400dffa1ef1c5e3e3bfbdf9d2" }, // portfolio margin enabled
];

const data = await Promise.all(params.map((p) => client.spotClearinghouseState(p)));

schemaCoverage(paramsSchema, params);
schemaCoverage(responseSchema, data, [
"#/properties/portfolioMarginEnabled/present",
"#/properties/balances/items/anyOf/0/properties/spotHold/present",
"#/properties/balances/items/anyOf/0/properties/ltv/present",
"#/properties/balances/items/anyOf/0/properties/borrowed/present",
"#/properties/balances/items/anyOf/0/properties/supplied/present",
"#/properties/balances/items/anyOf/1",
"#/properties/portfolioMarginRatio/present",
"#/properties/tokenToPortfolioBorrowRatio/present",
"#/properties/tokenToAvailableAfterMaintenance/present",
"#/properties/tokenToPortfolioSupplyRatio/array",
]);
},
});
1 change: 1 addition & 0 deletions tests/api/info/subAccounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ runTest({
"#/anyOf/0/items/properties/spotState/properties/portfolioMarginEnabled/present",
"#/anyOf/0/items/properties/spotState/properties/portfolioMarginRatio/present",
"#/anyOf/0/items/properties/spotState/properties/tokenToPortfolioBorrowRatio/present",
"#/anyOf/0/items/properties/spotState/properties/tokenToPortfolioSupplyRatio/present",
"#/anyOf/0/items/properties/spotState/properties/tokenToAvailableAfterMaintenance/present",
"#/anyOf/0/items/properties/spotState/properties/balances/items/anyOf/0/properties/spotHold/present",
"#/anyOf/0/items/properties/spotState/properties/balances/items/anyOf/0/properties/ltv/present",
Expand Down
1 change: 1 addition & 0 deletions tests/api/info/subAccounts2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ runTest({
"#/anyOf/0/items/properties/spotState/properties/portfolioMarginEnabled/present",
"#/anyOf/0/items/properties/spotState/properties/portfolioMarginRatio/present",
"#/anyOf/0/items/properties/spotState/properties/tokenToPortfolioBorrowRatio/present",
"#/anyOf/0/items/properties/spotState/properties/tokenToPortfolioSupplyRatio/present",
"#/anyOf/0/items/properties/spotState/properties/tokenToAvailableAfterMaintenance/present",
"#/anyOf/0/items/properties/spotState/properties/balances/items/anyOf/0/properties/spotHold/present",
"#/anyOf/0/items/properties/spotState/properties/balances/items/anyOf/0/properties/ltv/present",
Expand Down
1 change: 1 addition & 0 deletions tests/api/info/webData2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ runTest({
"#/properties/spotState/properties/portfolioMarginEnabled/present",
"#/properties/spotState/properties/portfolioMarginRatio/present",
"#/properties/spotState/properties/tokenToPortfolioBorrowRatio/present",
"#/properties/spotState/properties/tokenToPortfolioSupplyRatio/present",
"#/properties/spotState/properties/tokenToAvailableAfterMaintenance/present",
"#/properties/spotState/properties/balances/items/anyOf/0/properties/spotHold/present",
"#/properties/spotState/properties/balances/items/anyOf/0/properties/ltv/present",
Expand Down
1 change: 1 addition & 0 deletions tests/api/subscription/spotState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ runTest({
"#/properties/spotState/properties/portfolioMarginEnabled/present",
"#/properties/spotState/properties/portfolioMarginRatio/present",
"#/properties/spotState/properties/tokenToPortfolioBorrowRatio/present",
"#/properties/spotState/properties/tokenToPortfolioSupplyRatio/present",
"#/properties/spotState/properties/tokenToAvailableAfterMaintenance/present",
"#/properties/spotState/properties/balances/items/anyOf/0/properties/spotHold/present",
"#/properties/spotState/properties/balances/items/anyOf/0/properties/ltv/present",
Expand Down