@totalis/hip4-client 0.65.2 → 0.74.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 +388 -0
- package/dist/controller.d.ts +5 -2
- package/dist/controller.js +5 -2
- package/dist/flow-errors.d.ts +4 -3
- package/dist/flow-errors.js +1 -1
- package/dist/generated/account-read.d.ts +11 -5
- package/dist/generated/api-keys.d.ts +1 -1
- package/dist/generated/browse.d.ts +38 -11
- package/dist/generated/client.d.ts +34 -2
- package/dist/generated/errors.d.ts +77 -9
- package/dist/generated/errors.js +484 -6
- package/dist/generated/openapi.d.ts +6737 -3800
- package/dist/generated/realtime.d.ts +85 -15
- package/dist/generated/vault-abi.d.ts +10 -0
- package/dist/generated/vault-abi.js +15 -1
- package/dist/generated/version.d.ts +15 -14
- package/dist/generated/version.js +56 -15
- package/dist/hypercore.d.ts +1 -1
- package/dist/hypercore.js +1 -1
- package/dist/maker.d.ts +1 -0
- package/dist/maker.js +1 -1
- package/dist/partner.d.ts +14 -2
- package/dist/partner.js +11 -2
- package/dist/request.d.ts +7 -4
- package/dist/request.js +6 -3
- package/dist/stream.d.ts +11 -2
- package/dist/stream.js +17 -4
- package/dist/totalis.d.ts +75 -12
- package/dist/totalis.js +141 -50
- package/dist/wallet-session.d.ts +8 -1
- package/dist/wallet-session.js +4 -2
- package/examples/onboard.mjs +2 -2
- package/package.json +2 -1
package/dist/wallet-session.d.ts
CHANGED
|
@@ -12,11 +12,18 @@ export type WalletSignInOptions = Omit<ApiClientOptions, "accessToken"> & {
|
|
|
12
12
|
/**
|
|
13
13
|
* The page's origin, defaulting to `location.origin` in a browser. Outside a
|
|
14
14
|
* browser it is sent as the Origin header: a maker passes the Totalis app's
|
|
15
|
-
* origin (`https://
|
|
15
|
+
* origin (`https://app.totalis.trade`, or `https://hip4-staging.totalis.trade`
|
|
16
16
|
* on staging), and a partner its registered origin. Send the same origin as
|
|
17
17
|
* the Origin header with every request on the session's token.
|
|
18
18
|
*/
|
|
19
19
|
readonly origin?: string;
|
|
20
|
+
/**
|
|
21
|
+
* A partner's secret server key (`tpk_v1_…`), for a partner signing its
|
|
22
|
+
* users in from its own servers: the sign-in is then rate limited per
|
|
23
|
+
* partner instead of per source address. The origin must be one the partner
|
|
24
|
+
* owns, and the wallet still signs. Server-side only.
|
|
25
|
+
*/
|
|
26
|
+
readonly serverKey?: string;
|
|
20
27
|
};
|
|
21
28
|
/**
|
|
22
29
|
* Check a sign-in challenge before the wallet signs it: the exact Totalis
|
package/dist/wallet-session.js
CHANGED
|
@@ -32,12 +32,14 @@ export function checkSignInChallenge(challenge, expected, now = Date.now()) {
|
|
|
32
32
|
* with no account yet needs a partner to admit it first (ACCESS_REQUIRED).
|
|
33
33
|
*/
|
|
34
34
|
export async function signInWithWallet(options) {
|
|
35
|
-
const { environment, signer: input, origin = globalThis.location?.origin, ...clientOptions } = options;
|
|
35
|
+
const { environment, signer: input, origin = globalThis.location?.origin, serverKey, ...clientOptions } = options;
|
|
36
36
|
if (origin === undefined || origin === "")
|
|
37
37
|
throw new Error("signInWithWallet needs an origin outside a browser");
|
|
38
|
+
if (serverKey !== undefined && (inBrowser() || !serverKey.startsWith("tpk_v1_")))
|
|
39
|
+
throw new Error("serverKey takes a tpk_v1 partner server key, and only on a server");
|
|
38
40
|
const signer = toTotalisSigner(input);
|
|
39
41
|
const address = await signer.address();
|
|
40
|
-
const client = audienceClient(environment, clientOptions);
|
|
42
|
+
const client = audienceClient(environment, serverKey === undefined ? clientOptions : { ...clientOptions, accessToken: serverKey });
|
|
41
43
|
// A browser sets Origin itself and refuses a script's value.
|
|
42
44
|
const originHeader = inBrowser() ? {} : { Origin: origin };
|
|
43
45
|
const requestId = uuidv7();
|
package/examples/onboard.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// issue the quoting bot's key, fund the maker vault, and start quoting. Run it
|
|
5
5
|
// again to resume: each step skips what is already done.
|
|
6
6
|
//
|
|
7
|
-
// Before it, once in a browser: sign up at
|
|
7
|
+
// Before it, once in a browser: sign up at app.totalis.trade with your invite
|
|
8
8
|
// code, then in Account choose Export private key. Fund that wallet on HyperEVM
|
|
9
9
|
// with HYPE for gas (makers are never sponsored) and the USDC you will deposit.
|
|
10
10
|
//
|
|
@@ -29,7 +29,7 @@ import { signInWithWallet } from "@totalis/hip4-client/wallet-session";
|
|
|
29
29
|
import { startBot } from "./node-bot.mjs";
|
|
30
30
|
|
|
31
31
|
/** The Totalis app's origin: a maker's wallet session signs in from it, and every request on the session sends it as Origin. */
|
|
32
|
-
export const appOrigins = { production: "https://
|
|
32
|
+
export const appOrigins = { production: "https://app.totalis.trade", staging: "https://hip4-staging.totalis.trade" };
|
|
33
33
|
/** Public HyperEVM RPCs by chain ID; pass your own `rpcUrl` for anything heavier than onboarding. */
|
|
34
34
|
const publicRpcs = { "999": "https://rpc.hyperliquid.xyz/evm", "998": "https://rpc.hyperliquid-testnet.xyz/evm" };
|
|
35
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@totalis/hip4-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.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": [
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"test:staging-read": "npm run build && node test/staging-read-smoke.mjs",
|
|
69
69
|
"test:production-read": "npm run build && node test/staging-read-smoke.mjs production",
|
|
70
70
|
"test:staging-smoke": "npm run build && node test/staging-smoke.mjs",
|
|
71
|
+
"test:staging-burst": "npm run build && node test/staging-burst.mjs",
|
|
71
72
|
"prepack": "npm run build",
|
|
72
73
|
"release:check": "npm run check && npm test && npm pack --dry-run"
|
|
73
74
|
},
|