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
25 changes: 15 additions & 10 deletions src/api/info/_methods/userFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,33 @@ export type UserFeesResponse = {
* @pattern ^[0-9]+(\.[0-9]+)?$
*/
feeTrialEscrow: string;
/** Timestamp when next trial becomes available. */
nextTrialAvailableTimestamp: unknown | null;
/** Timestamp when next trial becomes available (in ms since epoch). */
nextTrialAvailableTimestamp: number | null;
/**
* Permanent link between staking and trading accounts.
* Staking user gains full control of trading account funds.
* Staking user forfeits own fee discounts.
*/
stakingLink: {
/**
* Linked account address:
* - When queried by staking account: contains trading account address.
* - When queried by trading account: contains staking account address.
* Link status:
* - `"requested"`: Link initiated by trading user, awaiting staking user confirmation.
* - `"tradingUser"`: Response queried by trading account.
*/
type: "requested" | "tradingUser";
/**
* Staking account address.
* @pattern ^0x[a-fA-F0-9]{40}$
*/
stakingUser: `0x${string}`;
} | {
/** Link status: response queried by staking account. */
type: "stakingUser";
/**
* Link status:
* - `requested` = link initiated by trading user, awaiting staking user confirmation.
* - `stakingUser` = response queried by staking account.
* - `tradingUser` = response queried by trading account.
* Trading account address.
* @pattern ^0x[a-fA-F0-9]{40}$
*/
type: "requested" | "stakingUser" | "tradingUser";
tradingUser: `0x${string}`;
} | null;
/** Active staking discount details. */
activeStakingDiscount: {
Expand Down
5 changes: 3 additions & 2 deletions tests/api/info/userFees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ runTest({
const params: UserFeesParameters[] = [
{ user: "0xe973105a27e17350500926ae664dfcfe6006d924" },
{ user: "0x768484f7e2ebb675c57838366c02ae99ba2a9b08" }, // userAddRate/userSpotAddRate negative
{ user: "0xeffb9c711ec1d3e551a7391dd848290a614c2e63" }, // stakingLink.type = tradingUser
{ user: "0xc066dda6748bc50b4fa17720b215783f5d60045f" }, // stakingLink.type = stakingUser
];

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

schemaCoverage(paramsSchema, params);
schemaCoverage(responseSchema, data, [
"#/properties/trial/defined",
"#/properties/nextTrialAvailableTimestamp/defined",
"#/properties/stakingLink/defined",
"#/properties/stakingLink/anyOf/0/properties/type/enum/0",
]);
},
});