@totalis/hip4-client 0.115.0 → 0.117.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/generated/account-read.d.ts +1 -1
- package/dist/generated/api-keys.d.ts +28 -1
- package/dist/generated/browse.d.ts +1 -1
- package/dist/generated/client.d.ts +4 -1
- package/dist/generated/errors.d.ts +293 -181
- package/dist/generated/errors.js +598 -282
- package/dist/generated/openapi.d.ts +364 -1
- package/dist/generated/version.d.ts +5 -5
- package/dist/generated/version.js +7 -4
- package/dist/request.d.ts +13 -1
- package/dist/request.js +10 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare const sdkVersion = "
|
|
2
|
-
export declare const openapiSha256 = "
|
|
1
|
+
export declare const sdkVersion = "253.0.0-failure-classes";
|
|
2
|
+
export declare const openapiSha256 = "3622cc5dfc9d4b85a4fa311a384d36e110fbba862d93d56549b30cab5b5e58a1";
|
|
3
3
|
export declare const realtimeSha256 = "cf0bafff0b355ea9fb642d4a3402dcc2a4e5fc7569a2b448184beb4043d154ef";
|
|
4
4
|
export declare const jsonSchemaSha256: {
|
|
5
5
|
readonly "account.schema.json": "e6cd5a75429d074f23bd7f6ffd370fa59d0e3f7dbd6aef6433e5ba0d21b5baeb";
|
|
6
6
|
readonly "comments.schema.json": "5773471b4442ba9d8af0dc012d71561baaf50d0e1c2571039241780848edb4a4";
|
|
7
7
|
readonly "common.schema.json": "04f51deb3cbea448e59195e26ede3212598d58a7940fe67eb2123fd9161c5edb";
|
|
8
8
|
readonly "core-exit.schema.json": "c7f617e815225cdcac95c236f8b73fbe288ee5713ff444c3be90eb915fc3a401";
|
|
9
|
-
readonly "error.schema.json": "
|
|
9
|
+
readonly "error.schema.json": "8c1900c5d26bd1bb800fba4d9728164848b6ca691491d17f52db24237d53749c";
|
|
10
10
|
readonly "hypercore.schema.json": "521372f8980353bcdd90ca3d0292bc6b41c69dbad3164bfd501b1ca99dac4cb8";
|
|
11
11
|
readonly "identity.schema.json": "896d975e5f4076cb34ae33f2dcfc41559fd3df1ed39e3d72ac9e342ca1f957fa";
|
|
12
12
|
readonly "maker-access.schema.json": "49698ee0235e42064aae0397db1e0f646bdc10d9dfa10121714ba06dd69fee3b";
|
|
@@ -16,10 +16,10 @@ export declare const jsonSchemaSha256: {
|
|
|
16
16
|
readonly "product-metadata.schema.json": "7c8ffbde878a0aedaed16814fcfd2e80038054b140886cc8736bb7b508042631";
|
|
17
17
|
readonly "quote.schema.json": "52ee1f4708c8b1504e4cd2f2f9279e14c8ec8aeacac1f491441ae0e15ac3c71a";
|
|
18
18
|
readonly "realtime.schema.json": "cf0bafff0b355ea9fb642d4a3402dcc2a4e5fc7569a2b448184beb4043d154ef";
|
|
19
|
-
readonly "social.schema.json": "
|
|
19
|
+
readonly "social.schema.json": "d1d6bb03269ac5a527c134bfd884f41b5baac0a48cc12f98980d08691020e1a4";
|
|
20
20
|
};
|
|
21
21
|
export declare const operations: {
|
|
22
|
-
readonly client: readonly ["abandonCoreExit", "acceptQuote", "activeCoreExits", "admitOwnMaker", "admitPartnerWallet", "approveWallet", "bindEmbeddedWallet", "cancelRfq", "confirmComboCopyAgent", "confirmCoreCopyAgent", "createCashout", "createComment", "createCoreExit", "createDeposit", "createGoldenRfq", "createRfq", "createRunOffClaim", "createWalletChallenge", "createWalletSession", "createWithdrawal", "deleteComment", "editComment", "endWalletSession", "followTrader", "getAcceptance", "getAccountActivity", "getAccountPnl", "getAccountPosition", "getAccountValue", "getBalances", "getCopyAgents", "getCopyBudget", "getCopySettings", "getCopySummary", "getCoreExit", "getDeployment", "getGenesis", "getGolden", "getGoldenMarkets", "getGoldenOffer", "getGoldenSuggestions", "getHypercoreBalance", "getHypercorePortfolio", "getHypercoreSettlementCredits", "getIdentity", "getMakerActivity", "getMakerCapital", "getMakerExposure", "getMakerPerformance", "getMakerPosition", "getMakerQuotes", "getMakerTelemetry", "getMakerVaultFundingTransaction", "getMakerWithdrawal", "getMarket", "getMarketDataConfig", "getMarketDefinitions", "getMarketDisplay", "getMarketHistory", "getMarketRecurringRound", "getMarketReferenceCloses", "getMarketRoundHistory", "getMarketScoreTimeline", "getMarketStats", "getMyGenesis", "getMyReferralBonus", "getOperation", "getOutcomeMetadata", "getOwnMaker", "getPartnerAccountValue", "getPartnerReport", "getPerpMarks", "getPicture", "getProfitLeaderboard", "getQuestion", "getQuestionRecurringRound", "getQuestionScoreTimeline", "getRfq", "getSeries", "getSocialLeaderboard", "getSocialPerson", "getSocialPosition", "getSuggestedCombo", "getTaxonomy", "getTrader", "getTraderPnl", "getUsernameAvailability", "getVaultAgents", "getVolumeLeaderboard", "getWalletApproval", "getWithdrawal", "grantComboCopyAgent", "grantVaultAgent", "likeComment", "listAccountActivity", "listAccountPositions", "listComboCopies", "listComboFeed", "listCommentReplies", "listComments", "listControlledMakers", "listCopiedFills", "listCopyTrades", "listDiscovery", "listFollowingFeed", "listFollowingPositions", "listFollows", "listMakerActivity", "listMakerPositions", "listMakerQuoteHistory", "listMarkets", "listMyNotifications", "listOperations", "listPartnerFills", "listPartnerWebhookEvents", "listQuotes", "listSocialActivity", "listSocialFeed", "listSocialPositions", "listTraderPositions", "listTraderTrades", "markMyNotificationsRead", "placeGolden", "reactComment", "recordAcquisition", "recordGoldenTelegramClick", "refreshPicture", "removeUploadedPicture", "requestComboCopyAgent", "requestCoreCopyAgent", "revokeComboCopyAgent", "searchCatalog", "searchTraders", "setAvatar", "setCopyAllocation", "setCopySettings", "setPublicProfile", "setUsername", "setXHandleShown", "setXPictureShown", "signGoldenGift", "stream", "streamMarkets", "switchOffComboCopyAgent", "switchOffCoreCopyAgent", "unfollowTrader", "unlikeComment", "unlockGolden", "unreactComment", "uploadPicture"];
|
|
22
|
+
readonly client: readonly ["abandonCoreExit", "acceptQuote", "activeCoreExits", "admitOwnMaker", "admitPartnerWallet", "approveWallet", "bindEmbeddedWallet", "cancelRfq", "confirmComboCopyAgent", "confirmCoreCopyAgent", "createCashout", "createComment", "createCoreExit", "createDeposit", "createGoldenRfq", "createRfq", "createRunOffClaim", "createWalletChallenge", "createWalletSession", "createWithdrawal", "deleteComment", "editComment", "endWalletSession", "followTrader", "getAcceptance", "getAccountActivity", "getAccountPnl", "getAccountPosition", "getAccountValue", "getBalances", "getCopyAgents", "getCopyBudget", "getCopySettings", "getCopySummary", "getCoreExit", "getDeployment", "getGenesis", "getGolden", "getGoldenMarkets", "getGoldenOffer", "getGoldenSuggestions", "getHypercoreBalance", "getHypercorePortfolio", "getHypercoreSettlementCredits", "getIdentity", "getMakerActivity", "getMakerCapital", "getMakerExposure", "getMakerPerformance", "getMakerPosition", "getMakerQuotes", "getMakerTelemetry", "getMakerVaultFundingTransaction", "getMakerWithdrawal", "getMarket", "getMarketDataConfig", "getMarketDefinitions", "getMarketDisplay", "getMarketHistory", "getMarketRecurringRound", "getMarketReferenceCloses", "getMarketRoundHistory", "getMarketScoreTimeline", "getMarketStats", "getMyGenesis", "getMyReferralBonus", "getOperation", "getOutcomeMetadata", "getOwnMaker", "getPartnerAccountValue", "getPartnerReport", "getPerpMarks", "getPicture", "getProfitLeaderboard", "getQuestion", "getQuestionRecurringRound", "getQuestionScoreTimeline", "getRfq", "getSeries", "getSocialLeaderboard", "getSocialPerson", "getSocialPosition", "getSuggestedCombo", "getTaxonomy", "getTrader", "getTraderPnl", "getUsernameAvailability", "getVaultAgents", "getVolumeLeaderboard", "getWalletApproval", "getWithdrawal", "grantComboCopyAgent", "grantVaultAgent", "likeComment", "listAccountActivity", "listAccountPositions", "listComboCopies", "listComboFeed", "listCommentReplies", "listComments", "listControlledMakers", "listCopiedFills", "listCopyTrades", "listDiscovery", "listFollowers", "listFollowingFeed", "listFollowingPositions", "listFollows", "listMakerActivity", "listMakerPositions", "listMakerQuoteHistory", "listMarkets", "listMyNotifications", "listOperations", "listPartnerFills", "listPartnerWebhookEvents", "listQuotes", "listSocialActivity", "listSocialFeed", "listSocialFollowers", "listSocialFollowing", "listSocialPositions", "listTraderPositions", "listTraderTrades", "markMyNotificationsRead", "placeGolden", "reactComment", "recordAcquisition", "recordGoldenTelegramClick", "refreshPicture", "removeUploadedPicture", "requestComboCopyAgent", "requestCoreCopyAgent", "revokeComboCopyAgent", "searchCatalog", "searchTraders", "setAvatar", "setCopyAllocation", "setCopySettings", "setPublicProfile", "setUsername", "setXHandleShown", "setXPictureShown", "signGoldenGift", "stream", "streamMarkets", "switchOffComboCopyAgent", "switchOffCoreCopyAgent", "unfollowTrader", "unlikeComment", "unlockGolden", "unreactComment", "uploadPicture"];
|
|
23
23
|
readonly maker: readonly ["cancelQuote", "confirmQuote", "createCollateralReduction", "createQuote", "getAccountActivity", "getAccountPosition", "getCollateralReduction", "getDeployment", "getMakerActivity", "getMakerCapital", "getMakerExposure", "getMakerPerformance", "getMakerPosition", "getMakerQuotes", "getMakerTelemetry", "getMakerTelemetryPublication", "getMakerVaultFundingTransaction", "getMakerWithdrawal", "getMarket", "getMarketDisplay", "getMarketHistory", "getMarketRecurringRound", "getMarketReferenceCloses", "getMarketRoundHistory", "getOperation", "getQuestion", "getQuestionRecurringRound", "getRfq", "getSeries", "getTaxonomy", "listAccountActivity", "listAccountPositions", "listDiscovery", "listMakerAcceptances", "listMakerActivity", "listMakerPositions", "listMakerQuoteHistory", "listMarkets", "listOperations", "listRfqs", "publishMakerTelemetry", "releaseQuoteLease", "renewQuoteLease", "searchCatalog", "stream", "submitMakerSelfFundedTransaction"];
|
|
24
24
|
readonly operator: readonly ["live", "ready"];
|
|
25
25
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Generated by scripts/generate.mjs; do not edit.
|
|
2
|
-
export const sdkVersion = "
|
|
3
|
-
export const openapiSha256 = "
|
|
2
|
+
export const sdkVersion = "253.0.0-failure-classes";
|
|
3
|
+
export const openapiSha256 = "3622cc5dfc9d4b85a4fa311a384d36e110fbba862d93d56549b30cab5b5e58a1";
|
|
4
4
|
export const realtimeSha256 = "cf0bafff0b355ea9fb642d4a3402dcc2a4e5fc7569a2b448184beb4043d154ef";
|
|
5
5
|
export const jsonSchemaSha256 = {
|
|
6
6
|
"account.schema.json": "e6cd5a75429d074f23bd7f6ffd370fa59d0e3f7dbd6aef6433e5ba0d21b5baeb",
|
|
7
7
|
"comments.schema.json": "5773471b4442ba9d8af0dc012d71561baaf50d0e1c2571039241780848edb4a4",
|
|
8
8
|
"common.schema.json": "04f51deb3cbea448e59195e26ede3212598d58a7940fe67eb2123fd9161c5edb",
|
|
9
9
|
"core-exit.schema.json": "c7f617e815225cdcac95c236f8b73fbe288ee5713ff444c3be90eb915fc3a401",
|
|
10
|
-
"error.schema.json": "
|
|
10
|
+
"error.schema.json": "8c1900c5d26bd1bb800fba4d9728164848b6ca691491d17f52db24237d53749c",
|
|
11
11
|
"hypercore.schema.json": "521372f8980353bcdd90ca3d0292bc6b41c69dbad3164bfd501b1ca99dac4cb8",
|
|
12
12
|
"identity.schema.json": "896d975e5f4076cb34ae33f2dcfc41559fd3df1ed39e3d72ac9e342ca1f957fa",
|
|
13
13
|
"maker-access.schema.json": "49698ee0235e42064aae0397db1e0f646bdc10d9dfa10121714ba06dd69fee3b",
|
|
@@ -17,7 +17,7 @@ export const jsonSchemaSha256 = {
|
|
|
17
17
|
"product-metadata.schema.json": "7c8ffbde878a0aedaed16814fcfd2e80038054b140886cc8736bb7b508042631",
|
|
18
18
|
"quote.schema.json": "52ee1f4708c8b1504e4cd2f2f9279e14c8ec8aeacac1f491441ae0e15ac3c71a",
|
|
19
19
|
"realtime.schema.json": "cf0bafff0b355ea9fb642d4a3402dcc2a4e5fc7569a2b448184beb4043d154ef",
|
|
20
|
-
"social.schema.json": "
|
|
20
|
+
"social.schema.json": "d1d6bb03269ac5a527c134bfd884f41b5baac0a48cc12f98980d08691020e1a4"
|
|
21
21
|
};
|
|
22
22
|
export const operations = {
|
|
23
23
|
"client": [
|
|
@@ -125,6 +125,7 @@ export const operations = {
|
|
|
125
125
|
"listCopiedFills",
|
|
126
126
|
"listCopyTrades",
|
|
127
127
|
"listDiscovery",
|
|
128
|
+
"listFollowers",
|
|
128
129
|
"listFollowingFeed",
|
|
129
130
|
"listFollowingPositions",
|
|
130
131
|
"listFollows",
|
|
@@ -139,6 +140,8 @@ export const operations = {
|
|
|
139
140
|
"listQuotes",
|
|
140
141
|
"listSocialActivity",
|
|
141
142
|
"listSocialFeed",
|
|
143
|
+
"listSocialFollowers",
|
|
144
|
+
"listSocialFollowing",
|
|
142
145
|
"listSocialPositions",
|
|
143
146
|
"listTraderPositions",
|
|
144
147
|
"listTraderTrades",
|
package/dist/request.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ErrorCode, type Retry } from "./generated/errors.js";
|
|
1
|
+
import { errorRegistry, type ErrorCode, type Retry } from "./generated/errors.js";
|
|
2
2
|
/** A lowercase RFC 9562 UUIDv7: the venue requires it for request IDs and idempotency keys. */
|
|
3
3
|
export declare function uuidv7(now?: number): string;
|
|
4
4
|
/** 32 random bytes as 0x-hex, for salts and nonces. */
|
|
@@ -17,6 +17,16 @@ type FieldViolation = {
|
|
|
17
17
|
readonly code: string;
|
|
18
18
|
readonly field: string;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Who acts on a failure, fixed per code like its status and retry:
|
|
22
|
+
* `fault` Totalis is broken (a bug), `unavailable` a dependency is down or a
|
|
23
|
+
* feature is off, `invalid` the request is malformed, `refusal` identity,
|
|
24
|
+
* permission, state or a quota says no, `outcome` an expected result of a
|
|
25
|
+
* race or a market (re-read and go on).
|
|
26
|
+
*/
|
|
27
|
+
export type ErrorClass = (typeof errorRegistry)[ErrorCode]["class"];
|
|
28
|
+
/** The class of a code; a code this SDK does not know is classed by its status. */
|
|
29
|
+
export declare function errorClass(code: string, status: number): ErrorClass;
|
|
20
30
|
/**
|
|
21
31
|
* A registered error from the venue (TT-1770). `retry` says what to do:
|
|
22
32
|
* NEVER stop; BACKOFF resend the same request (the SDK already did, until its
|
|
@@ -33,6 +43,8 @@ export declare class ApiError extends Error {
|
|
|
33
43
|
/** For a flow command answered BACKOFF after every resend, or whose resend was refused after an earlier send's answer was lost and the outcome could not be read: send the identical request again later. */
|
|
34
44
|
resend?: () => Promise<unknown>;
|
|
35
45
|
constructor(status: number, code: ErrorCode | `HTTP_${number}`, retry: Retry, message: string, requestId?: string | undefined, fieldViolations?: readonly FieldViolation[], retryAfterMs?: number | undefined);
|
|
46
|
+
/** Who acts on this failure; see `errorClass`. */
|
|
47
|
+
get errorClass(): ErrorClass;
|
|
36
48
|
static from(response: Response, body: unknown): ApiError;
|
|
37
49
|
}
|
|
38
50
|
/**
|
package/dist/request.js
CHANGED
|
@@ -21,6 +21,12 @@ export function randomBytes32() {
|
|
|
21
21
|
export function envelope(command, requestId = uuidv7()) {
|
|
22
22
|
return { schema_version: 1, request_id: requestId, sent_at: new Date().toISOString(), command };
|
|
23
23
|
}
|
|
24
|
+
/** The class of a code; a code this SDK does not know is classed by its status. */
|
|
25
|
+
export function errorClass(code, status) {
|
|
26
|
+
if (code in errorRegistry)
|
|
27
|
+
return errorRegistry[code].class;
|
|
28
|
+
return status === 500 ? "fault" : status >= 500 ? "unavailable" : status === 400 ? "invalid" : "refusal";
|
|
29
|
+
}
|
|
24
30
|
/**
|
|
25
31
|
* A registered error from the venue (TT-1770). `retry` says what to do:
|
|
26
32
|
* NEVER stop; BACKOFF resend the same request (the SDK already did, until its
|
|
@@ -45,6 +51,10 @@ export class ApiError extends Error {
|
|
|
45
51
|
this.fieldViolations = fieldViolations;
|
|
46
52
|
this.retryAfterMs = retryAfterMs;
|
|
47
53
|
}
|
|
54
|
+
/** Who acts on this failure; see `errorClass`. */
|
|
55
|
+
get errorClass() {
|
|
56
|
+
return errorClass(this.code, this.status);
|
|
57
|
+
}
|
|
48
58
|
static from(response, body) {
|
|
49
59
|
const detail = body?.error;
|
|
50
60
|
const code = detail?.code ?? `HTTP_${response.status}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@totalis/hip4-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.117.0",
|
|
4
4
|
"description": "Totalis HIP-4 SDK: typed HTTP clients, signer-agnostic typed data, a retrying request layer, pagination, a realtime stream and taker/maker flows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|