@paradex/sdk 0.8.0 → 0.9.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/README.md +204 -0
- package/dist/account.d.ts +81 -8
- package/dist/account.js +304 -14
- package/dist/client.d.ts +13 -4
- package/dist/client.js +12 -3
- package/dist/config.d.ts +6 -1
- package/dist/config.js +3 -2
- package/dist/determinism-guard.d.ts +102 -0
- package/dist/determinism-guard.js +62 -0
- package/dist/eip712.d.ts +40 -0
- package/dist/eip712.js +162 -0
- package/dist/ethereum-signer.d.ts +13 -2
- package/dist/ethereum-signer.js +14 -1
- package/dist/index.d.ts +61 -0
- package/dist/index.js +51 -0
- package/dist/key-derivation.d.ts +19 -0
- package/dist/key-derivation.js +83 -0
- package/dist/session-accounts.d.ts +206 -0
- package/dist/session-accounts.js +747 -0
- package/dist/session-auth.d.ts +31 -0
- package/dist/session-auth.js +115 -0
- package/dist/session-connector.d.ts +132 -0
- package/dist/session-connector.js +304 -0
- package/dist/session-key.d.ts +68 -0
- package/dist/session-key.js +187 -0
- package/dist/session-owner-signer.d.ts +68 -0
- package/dist/session-owner-signer.js +64 -0
- package/dist/session-transport.d.ts +48 -0
- package/dist/session-transport.js +56 -0
- package/dist/session-typed-data.d.ts +346 -0
- package/dist/session-typed-data.js +984 -0
- package/dist/starknet-account-support.js +23 -1
- package/dist/starknet-signer.d.ts +3 -4
- package/dist/starknet-signer.js +10 -14
- package/package.json +6 -6
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import * as Starknet from 'starknet';
|
|
2
|
+
import { type Eip712TypedData, type Eip712Types } from './eip712.js';
|
|
3
|
+
import type { Hex } from './types.js';
|
|
4
|
+
export declare const SESSION_DOMAIN_NAME = "Paradex Session";
|
|
5
|
+
export declare const SESSION_DOMAIN_VERSION = "1";
|
|
6
|
+
/** The "none" builder / first-party passkey sentinel. */
|
|
7
|
+
export declare const NO_BUILDER = "0x0";
|
|
8
|
+
/**
|
|
9
|
+
* The Paradex environment the grant is for, e.g. `"mainnet"` or `"testnet"`.
|
|
10
|
+
* It is part of the signed message so a grant cannot be replayed on another
|
|
11
|
+
* environment; the server checks it.
|
|
12
|
+
*/
|
|
13
|
+
export type SessionEnvironment = 'mainnet' | 'testnet' | (string & {});
|
|
14
|
+
/** Scopes a grant may request. `read` is always implied and never listed. */
|
|
15
|
+
export type SessionScope = 'trade' | 'trade:rfq' | 'trade:block' | 'account:settings';
|
|
16
|
+
export declare const GRANTABLE_SCOPES: readonly SessionScope[];
|
|
17
|
+
/** Scopes that exist in the format but are refused. */
|
|
18
|
+
export declare const RESERVED_SCOPES: readonly string[];
|
|
19
|
+
/** Server caps on session lifetime, in seconds. */
|
|
20
|
+
export declare const SESSION_TTL: {
|
|
21
|
+
readonly browserDefault: number;
|
|
22
|
+
readonly browserMax: number;
|
|
23
|
+
/**
|
|
24
|
+
* Cap for IP-pinned API sessions. `POST /v2/sessions` applies
|
|
25
|
+
* `browserMax` to every grant, so `SessionConnector` never uses this.
|
|
26
|
+
*/
|
|
27
|
+
readonly apiMax: number;
|
|
28
|
+
/** Cap for grants that include `trade:block` or `account:settings`. */
|
|
29
|
+
readonly sensitiveScopeMax: number;
|
|
30
|
+
readonly passkeyMax: number;
|
|
31
|
+
readonly passkeySessionMax: number;
|
|
32
|
+
};
|
|
33
|
+
export declare const MAX_PASSKEY_CONCURRENT_SESSIONS = 5;
|
|
34
|
+
/** A grant, mint or passkey ceiling lists at most this many subaccounts. */
|
|
35
|
+
export declare const MAX_GRANT_SUBACCOUNTS = 32;
|
|
36
|
+
export type SessionGrantErrorCode = 'INVALID_FIELD' | 'UNKNOWN_SCOPE' | 'RESERVED_SCOPE' | 'TTL_EXCEEDED' | 'BUILDER_LIMITS_REQUIRED' | 'BUILDER_REQUIRES_EIP712' | 'GRANT_EXPIRED' | 'GRANT_REVOKED' | 'ENVIRONMENT_MISMATCH' | 'ACCOUNT_NOT_IN_GRANT' | 'ACCOUNT_NOT_ELIGIBLE' | 'EXCEEDS_CEILING' | 'SCOPE_NOT_ALLOWED' | 'LIMIT_INVALID';
|
|
37
|
+
export declare class SessionGrantError extends Error {
|
|
38
|
+
readonly code: SessionGrantErrorCode;
|
|
39
|
+
constructor(code: SessionGrantErrorCode, message: string);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Every limit is stated: a positive decimal string (USD, or a multiple for
|
|
43
|
+
* `maxLeverage`) such as `"25000"`, or {@link NO_CAP} for no cap.
|
|
44
|
+
*/
|
|
45
|
+
export interface Limits {
|
|
46
|
+
readonly maxOrderNotional: string;
|
|
47
|
+
readonly maxOpenNotional: string;
|
|
48
|
+
readonly dailyNotional: string;
|
|
49
|
+
readonly maxLoss: string;
|
|
50
|
+
readonly maxLeverage: string;
|
|
51
|
+
/**
|
|
52
|
+
* Symbols or patterns (`"BTC-USD-PERP"`, `"*-USD-PERP"`), or {@link ALL_MARKETS}
|
|
53
|
+
* (`["*"]`) for every market the session may trade. Never empty.
|
|
54
|
+
*/
|
|
55
|
+
readonly markets: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
/** A limit value meaning "not capped by this grant". */
|
|
58
|
+
export declare const NO_CAP = "none";
|
|
59
|
+
/** `markets` value meaning every permitted market. */
|
|
60
|
+
export declare const ALL_MARKETS: readonly string[];
|
|
61
|
+
export type LimitAmount = Exclude<keyof Limits, 'markets'>;
|
|
62
|
+
/**
|
|
63
|
+
* Highest value accepted for each limit, as decimal strings. The server
|
|
64
|
+
* applies its own configured caps; these are checked before signing so an
|
|
65
|
+
* over-cap grant never reaches the wallet. Unset means uncapped.
|
|
66
|
+
*/
|
|
67
|
+
export type LimitCaps = Partial<Record<LimitAmount, string>>;
|
|
68
|
+
/** No client-side caps by default; the server applies its own. */
|
|
69
|
+
export declare const DEFAULT_LIMIT_CAPS: LimitCaps;
|
|
70
|
+
/** A limit the server can enforce: one of the amounts, or `markets`. */
|
|
71
|
+
export type LimitName = keyof Limits;
|
|
72
|
+
/**
|
|
73
|
+
* Limits the server enforces. Defaults to none: until the server enforces a
|
|
74
|
+
* limit, a grant may not set it, because nothing would hold orders to it.
|
|
75
|
+
*/
|
|
76
|
+
export declare const DEFAULT_ENFORCED_LIMITS: readonly LimitName[];
|
|
77
|
+
/** Every limit set, for limits a client knows the server enforces. */
|
|
78
|
+
export declare const ALL_LIMITS: readonly LimitName[];
|
|
79
|
+
/** Every limit uncapped: what a grant must state while none is enforced. */
|
|
80
|
+
export declare const UNCAPPED_LIMITS: Limits;
|
|
81
|
+
export interface LimitOptions {
|
|
82
|
+
/** Defaults to {@link DEFAULT_LIMIT_CAPS}. */
|
|
83
|
+
readonly limitCaps?: LimitCaps;
|
|
84
|
+
/**
|
|
85
|
+
* Limits the server enforces; defaults to {@link DEFAULT_ENFORCED_LIMITS}
|
|
86
|
+
* (none). A limit not listed must be `"none"` (`markets`: `["*"]`).
|
|
87
|
+
*/
|
|
88
|
+
readonly enforcedLimits?: readonly LimitName[];
|
|
89
|
+
}
|
|
90
|
+
export interface Builder {
|
|
91
|
+
/** Builder's Paradex account; `"0x0"` = none. */
|
|
92
|
+
readonly account: string;
|
|
93
|
+
/** Fee ceiling as a decimal fraction: `"0.0005"` = 5 bps. */
|
|
94
|
+
readonly maxFeeRate: string;
|
|
95
|
+
/** Seconds; `0` = follows the session. */
|
|
96
|
+
readonly expiresAt: number;
|
|
97
|
+
}
|
|
98
|
+
/** @experimental */
|
|
99
|
+
export interface SessionGrant {
|
|
100
|
+
readonly paradexChain: string;
|
|
101
|
+
readonly environment: SessionEnvironment;
|
|
102
|
+
readonly account: string;
|
|
103
|
+
readonly sessionKey: string;
|
|
104
|
+
readonly label: string;
|
|
105
|
+
readonly scopes: readonly SessionScope[];
|
|
106
|
+
readonly limits: Limits;
|
|
107
|
+
readonly builder: Builder;
|
|
108
|
+
readonly subaccounts: readonly string[];
|
|
109
|
+
readonly nonce: string;
|
|
110
|
+
readonly issuedAt: number;
|
|
111
|
+
readonly expiresAt: number;
|
|
112
|
+
}
|
|
113
|
+
export interface Passkey {
|
|
114
|
+
/** base64url credential id. */
|
|
115
|
+
readonly credentialId: string;
|
|
116
|
+
/** P-256 public key coordinates, 0x-prefixed 32-byte hex. */
|
|
117
|
+
readonly pubkeyX: string;
|
|
118
|
+
readonly pubkeyY: string;
|
|
119
|
+
readonly rpId: string;
|
|
120
|
+
readonly label: string;
|
|
121
|
+
}
|
|
122
|
+
export interface Ceiling {
|
|
123
|
+
readonly scopes: readonly SessionScope[];
|
|
124
|
+
readonly limits: Limits;
|
|
125
|
+
readonly subaccounts: readonly string[];
|
|
126
|
+
/** Allowed only for first-party passkeys (`builderAccount = "0x0"`). */
|
|
127
|
+
readonly includeFutureSubaccounts: boolean;
|
|
128
|
+
readonly maxSessionTtl: number;
|
|
129
|
+
readonly maxConcurrentSessions: number;
|
|
130
|
+
}
|
|
131
|
+
/** @experimental */
|
|
132
|
+
export interface PasskeyGrant {
|
|
133
|
+
readonly paradexChain: string;
|
|
134
|
+
readonly environment: SessionEnvironment;
|
|
135
|
+
readonly account: string;
|
|
136
|
+
readonly passkey: Passkey;
|
|
137
|
+
readonly ceiling: Ceiling;
|
|
138
|
+
/** `"0x0"` = Paradex app; otherwise binds the passkey to one builder. */
|
|
139
|
+
readonly builderAccount: string;
|
|
140
|
+
readonly nonce: string;
|
|
141
|
+
readonly issuedAt: number;
|
|
142
|
+
readonly expiresAt: number;
|
|
143
|
+
}
|
|
144
|
+
/** @experimental */
|
|
145
|
+
export interface SessionMint {
|
|
146
|
+
readonly paradexChain: string;
|
|
147
|
+
readonly environment: SessionEnvironment;
|
|
148
|
+
readonly account: string;
|
|
149
|
+
readonly credentialId: string;
|
|
150
|
+
readonly sessionKey: string;
|
|
151
|
+
readonly scopes: readonly SessionScope[];
|
|
152
|
+
readonly limits: Limits;
|
|
153
|
+
readonly subaccounts: readonly string[];
|
|
154
|
+
readonly nonce: string;
|
|
155
|
+
readonly expiresAt: number;
|
|
156
|
+
}
|
|
157
|
+
export declare const SESSION_GRANT_EIP712_TYPES: Eip712Types;
|
|
158
|
+
export declare const PASSKEY_GRANT_EIP712_TYPES: Eip712Types;
|
|
159
|
+
export declare const SESSION_MINT_EIP712_TYPES: Eip712Types;
|
|
160
|
+
export declare const SESSION_GRANT_SNIP12_TYPES: Starknet.TypedData['types'];
|
|
161
|
+
export declare const PASSKEY_GRANT_SNIP12_TYPES: Starknet.TypedData['types'];
|
|
162
|
+
export declare const SESSION_MINT_SNIP12_TYPES: Starknet.TypedData['types'];
|
|
163
|
+
/** Whether a ceiling market entry covers a mint's market entry. */
|
|
164
|
+
export declare function marketCovers(pattern: string, market: string): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Canonical hex for felts and addresses: lowercase, `0x`-prefixed, no leading
|
|
167
|
+
* zeros (`0x0` for zero). EIP-712 hashes these as strings, so the form is part
|
|
168
|
+
* of the signed bytes; every builder normalizes to it and validation rejects
|
|
169
|
+
* anything else.
|
|
170
|
+
*/
|
|
171
|
+
export declare function canonicalFelt(value: string | bigint): string;
|
|
172
|
+
/** Rejects unknown and reserved scopes, duplicates and an empty list. */
|
|
173
|
+
export declare function validateScopes(scopes: readonly string[], field?: string): asserts scopes is readonly SessionScope[];
|
|
174
|
+
/**
|
|
175
|
+
* Every amount must be a positive decimal or `"none"`; `markets` must be a
|
|
176
|
+
* non-empty list, or `["*"]` alone. A limit the server does not enforce
|
|
177
|
+
* must be `"none"` (`markets`: `["*"]`).
|
|
178
|
+
*
|
|
179
|
+
* @param builderGrant builder grants must cap `maxLoss` with a number, so
|
|
180
|
+
* they are refused while the server does not enforce `maxLoss`.
|
|
181
|
+
*/
|
|
182
|
+
export declare function validateLimits(limits: Limits, builderGrant: boolean, field?: string, options?: LimitOptions): void;
|
|
183
|
+
export type SessionType = 'browser' | 'api';
|
|
184
|
+
/**
|
|
185
|
+
* Longest lifetime a grant with these scopes can request. The server measures
|
|
186
|
+
* the lifetime from the earlier of `issuedAt` and its own clock, and accepts
|
|
187
|
+
* an `issuedAt` up to 5 minutes ahead of it, so this is the server's cap less
|
|
188
|
+
* that allowance: a grant at this length still passes when the client's clock
|
|
189
|
+
* runs ahead.
|
|
190
|
+
*/
|
|
191
|
+
export declare function maxSessionTtl(scopes: readonly SessionScope[], sessionType?: SessionType, clockSkewSeconds?: number): number;
|
|
192
|
+
export interface ValidateSessionGrantOptions extends LimitOptions {
|
|
193
|
+
/**
|
|
194
|
+
* Which lifetime cap applies. Defaults to `browser` (30 days), the cap
|
|
195
|
+
* `POST /v2/sessions` applies to every grant. `api` (180 days) is the cap
|
|
196
|
+
* for IP-pinned API sessions, which that endpoint does not open; a grant
|
|
197
|
+
* longer than 30 days is refused there.
|
|
198
|
+
*/
|
|
199
|
+
readonly sessionType?: SessionType;
|
|
200
|
+
/**
|
|
201
|
+
* How far ahead of the server the client's clock may run, in seconds.
|
|
202
|
+
* Lifetimes are kept this far under the server cap. Defaults to 300, the
|
|
203
|
+
* server's `issuedAt` allowance; pass 0 when `issuedAt` comes from the
|
|
204
|
+
* server's clock.
|
|
205
|
+
*/
|
|
206
|
+
readonly clockSkewSeconds?: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Checks a grant against the format rules and server caps. Throws a
|
|
210
|
+
* {@link SessionGrantError}. The server repeats every check; this one fails
|
|
211
|
+
* before the owner is asked to sign.
|
|
212
|
+
*/
|
|
213
|
+
export declare function validateSessionGrant(grant: SessionGrant, options?: ValidateSessionGrantOptions): void;
|
|
214
|
+
export interface ValidatePasskeyGrantOptions extends LimitOptions {
|
|
215
|
+
/**
|
|
216
|
+
* Whether the server accepts subaccounts in a passkey ceiling. Defaults to
|
|
217
|
+
* false, as the server refuses `ceiling.subaccounts` and
|
|
218
|
+
* `includeFutureSubaccounts` until it enables them.
|
|
219
|
+
*/
|
|
220
|
+
readonly passkeySubaccounts?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* See {@link AssertMintOptions.clockSkewSeconds}. A `ceiling.maxSessionTtl`
|
|
223
|
+
* at or under it leaves no time to mint a session, so it is refused.
|
|
224
|
+
* Defaults to 300.
|
|
225
|
+
*/
|
|
226
|
+
readonly clockSkewSeconds?: number;
|
|
227
|
+
}
|
|
228
|
+
export declare function validatePasskeyGrant(grant: PasskeyGrant, options?: ValidatePasskeyGrantOptions): void;
|
|
229
|
+
export declare function validateSessionMint(mint: SessionMint, options?: LimitOptions): void;
|
|
230
|
+
export interface AssertMintOptions extends LimitOptions {
|
|
231
|
+
/**
|
|
232
|
+
* How far ahead of the server the client's clock may run, in seconds. The
|
|
233
|
+
* server bounds a mint's `expiresAt` by its own clock plus the ceiling's
|
|
234
|
+
* `maxSessionTtl`, so the bound here is kept this far under it. Defaults
|
|
235
|
+
* to 300; pass 0 when `now` comes from the server's clock.
|
|
236
|
+
*/
|
|
237
|
+
readonly clockSkewSeconds?: number;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Checks a `SessionMint` against the `PasskeyGrant` it mints under, as the
|
|
241
|
+
* server does: same binding and scopes within the ceiling. Only limits the
|
|
242
|
+
* server enforces are compared: each must be numeric and at or below a
|
|
243
|
+
* numeric ceiling (anything goes under a `"none"` ceiling), and markets must
|
|
244
|
+
* be within the ceiling's unless it allows `["*"]`. Unenforced limits are
|
|
245
|
+
* `"none"` on the mint and skipped, so passkeys registered with numeric
|
|
246
|
+
* limits keep working. Mints under a builder passkey are refused until the
|
|
247
|
+
* server enforces `maxLoss`, as builder grants are.
|
|
248
|
+
*
|
|
249
|
+
* @experimental
|
|
250
|
+
*/
|
|
251
|
+
export declare function assertMintWithinCeiling(mint: SessionMint, grant: PasskeyGrant, now?: number, options?: AssertMintOptions): void;
|
|
252
|
+
/** A fresh 128-bit random nonce in canonical hex. */
|
|
253
|
+
export declare function generateSessionNonce(): string;
|
|
254
|
+
export interface CreateSessionGrantParams {
|
|
255
|
+
readonly paradexChain: string;
|
|
256
|
+
readonly environment: SessionEnvironment;
|
|
257
|
+
readonly account: string;
|
|
258
|
+
readonly sessionKey: string;
|
|
259
|
+
readonly scopes?: readonly SessionScope[];
|
|
260
|
+
readonly label?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Every limit, stated as a positive decimal or `"none"`. Defaults to
|
|
263
|
+
* {@link UNCAPPED_LIMITS}, the only limits accepted while the server
|
|
264
|
+
* enforces none.
|
|
265
|
+
*/
|
|
266
|
+
readonly limits?: Limits;
|
|
267
|
+
readonly builder?: {
|
|
268
|
+
readonly account: string;
|
|
269
|
+
readonly maxFeeRate: string;
|
|
270
|
+
readonly expiresAt?: number;
|
|
271
|
+
};
|
|
272
|
+
readonly subaccounts?: readonly string[];
|
|
273
|
+
readonly nonce?: string;
|
|
274
|
+
/** Seconds. Defaults to now. */
|
|
275
|
+
readonly issuedAt?: number;
|
|
276
|
+
/** Seconds. Defaults to `issuedAt + ttlSeconds`. */
|
|
277
|
+
readonly expiresAt?: number;
|
|
278
|
+
/** Defaults to 7 days, the browser-session default. */
|
|
279
|
+
readonly ttlSeconds?: number;
|
|
280
|
+
/** See {@link ValidateSessionGrantOptions.sessionType}. */
|
|
281
|
+
readonly sessionType?: SessionType;
|
|
282
|
+
/** See {@link ValidateSessionGrantOptions.clockSkewSeconds}. */
|
|
283
|
+
readonly clockSkewSeconds?: number;
|
|
284
|
+
/** Defaults to {@link DEFAULT_LIMIT_CAPS}. */
|
|
285
|
+
readonly limitCaps?: LimitCaps;
|
|
286
|
+
/** Limits the server enforces; defaults to none (see {@link LimitOptions}). */
|
|
287
|
+
readonly enforcedLimits?: readonly LimitName[];
|
|
288
|
+
}
|
|
289
|
+
export declare function nowSeconds(): number;
|
|
290
|
+
/**
|
|
291
|
+
* Builds a canonical, validated `SessionGrant`. Addresses and keys are
|
|
292
|
+
* normalized to canonical hex; everything else is checked as given.
|
|
293
|
+
*
|
|
294
|
+
* @experimental
|
|
295
|
+
*/
|
|
296
|
+
export declare function createSessionGrant(params: CreateSessionGrantParams): SessionGrant;
|
|
297
|
+
/** Every account a grant reaches: the anchor first, then its sub-accounts. */
|
|
298
|
+
export declare function grantAccounts(grant: Pick<SessionGrant, 'account' | 'subaccounts'>): readonly string[];
|
|
299
|
+
/**
|
|
300
|
+
* Throws `GRANT_EXPIRED` once the grant (or a time just ahead of `now`) has
|
|
301
|
+
* passed its expiry, and `INVALID_FIELD` if `issuedAt` is too far ahead.
|
|
302
|
+
*/
|
|
303
|
+
export declare function assertGrantActive(grant: Pick<SessionGrant, 'issuedAt' | 'expiresAt'>, now?: number): void;
|
|
304
|
+
/**
|
|
305
|
+
* EIP-712 `SessionGrant`. `signatureChainId` is the wallet's *current* EVM
|
|
306
|
+
* chain, so no network switch is needed; send it along with the signature.
|
|
307
|
+
*
|
|
308
|
+
* @experimental
|
|
309
|
+
*/
|
|
310
|
+
export declare function buildSessionGrantEip712(grant: SessionGrant, signatureChainId: number | string | bigint, options?: ValidateSessionGrantOptions): Eip712TypedData;
|
|
311
|
+
/**
|
|
312
|
+
* SNIP-12 revision 1 `SessionGrant`, signed by a Stark owner key. Builder
|
|
313
|
+
* grants are EIP-712 only, so a grant naming a builder is refused here.
|
|
314
|
+
*
|
|
315
|
+
* @experimental
|
|
316
|
+
*/
|
|
317
|
+
export declare function buildSessionGrantSnip12(grant: SessionGrant, options?: ValidateSessionGrantOptions): Starknet.TypedData;
|
|
318
|
+
/** @experimental */
|
|
319
|
+
export declare function buildPasskeyGrantEip712(grant: PasskeyGrant, signatureChainId: number | string | bigint, options?: ValidatePasskeyGrantOptions): Eip712TypedData;
|
|
320
|
+
/** @experimental */
|
|
321
|
+
export declare function buildPasskeyGrantSnip12(grant: PasskeyGrant, options?: ValidatePasskeyGrantOptions): Starknet.TypedData;
|
|
322
|
+
/** @experimental */
|
|
323
|
+
export declare function buildSessionMintEip712(mint: SessionMint, signatureChainId: number | string | bigint, options?: LimitOptions): Eip712TypedData;
|
|
324
|
+
/** @experimental */
|
|
325
|
+
export declare function buildSessionMintSnip12(mint: SessionMint, options?: LimitOptions): Starknet.TypedData;
|
|
326
|
+
/** EIP-712 digest (`0x1901 ‖ domain ‖ struct`) as 0x-prefixed 32-byte hex. */
|
|
327
|
+
export declare function hashEip712(typedData: Eip712TypedData): Hex;
|
|
328
|
+
/**
|
|
329
|
+
* SNIP-12 message hash for `account` (the signer's address), as 0x-prefixed
|
|
330
|
+
* 32-byte hex.
|
|
331
|
+
*/
|
|
332
|
+
export declare function hashSnip12(typedData: Starknet.TypedData, account: string): Hex;
|
|
333
|
+
/**
|
|
334
|
+
* The WebAuthn challenge for a `SessionMint`: the 32-byte SNIP-12 message
|
|
335
|
+
* hash (for `mint.account`), base64url-encoded without padding.
|
|
336
|
+
*/
|
|
337
|
+
export declare function sessionMintChallenge(mint: SessionMint, options?: LimitOptions): string;
|
|
338
|
+
/** The wording shown to owners about what a session can lose. */
|
|
339
|
+
export declare function lossSummary(limits: Pick<Limits, 'maxLoss'>): string;
|
|
340
|
+
/**
|
|
341
|
+
* A readable summary of a grant for the approval screen, one line each.
|
|
342
|
+
* Show the builder by its registered name, not the grant's free-text label.
|
|
343
|
+
*
|
|
344
|
+
* @experimental
|
|
345
|
+
*/
|
|
346
|
+
export declare function summarizeGrant(grant: SessionGrant): string[];
|