@chipi-stack/backend 14.7.0 → 14.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/dist/index.d.mts +326 -2
- package/dist/index.d.ts +326 -2
- package/dist/index.js +235 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +229 -2
- package/dist/index.mjs.map +1 -1
- package/dist/skuPurchases.js +9 -1
- package/dist/skuPurchases.js.map +1 -1
- package/dist/skuPurchases.mjs +10 -2
- package/dist/skuPurchases.mjs.map +1 -1
- package/dist/transactions.js +9 -1
- package/dist/transactions.js.map +1 -1
- package/dist/transactions.mjs +10 -2
- package/dist/transactions.mjs.map +1 -1
- package/dist/wallets.js +9 -1
- package/dist/wallets.js.map +1 -1
- package/dist/wallets.mjs +10 -2
- package/dist/wallets.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ import { ChipiTransactions } from './transactions.mjs';
|
|
|
8
8
|
import { ChipiSkuPurchases } from './skuPurchases.mjs';
|
|
9
9
|
import { ChipiSkus } from './skus.mjs';
|
|
10
10
|
import { C as ChipiClient } from './client-CqD_yGH0.mjs';
|
|
11
|
-
import { Call } from 'starknet';
|
|
11
|
+
import { Call, ProviderInterface, Account } from 'starknet';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Session key management for CHIPI wallets (SNIP-9 compatible).
|
|
@@ -281,6 +281,164 @@ declare class ChipiExchanges {
|
|
|
281
281
|
getUsdAmount(currencyAmount: number, currency: Currency, bearerToken: string): Promise<number>;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
+
/**
|
|
285
|
+
* SHHH multisig treasury coordination client (Plus Wave 9 / P1).
|
|
286
|
+
*
|
|
287
|
+
* A thin, typed HTTP client for the chipi-back `/v1/treasuries/:id/...`
|
|
288
|
+
* endpoints. It implements the same transport contract `@chipi-stack/chipi-react`
|
|
289
|
+
* injects into `useProposeAction` / `useTreasuryProposals` (`MultisigTransport`),
|
|
290
|
+
* so an integrator can wire `sdk.treasury.forTreasury(...)` straight into those
|
|
291
|
+
* hooks instead of hand-writing fetch glue.
|
|
292
|
+
*
|
|
293
|
+
* Auth model (decision §11.2 — owner-signature-as-authorization):
|
|
294
|
+
* - propose / sign: `pk_` (the public api key) PLUS the owner's V2_SNIP12
|
|
295
|
+
* envelope (already inside the proposal body) AND the owner's
|
|
296
|
+
* `ownerPubkey` (kind-specific — see {@link ForTreasuryConfig.ownerPubkey}).
|
|
297
|
+
* chipi-back's OwnerSignatureVerifier proves the request came from a
|
|
298
|
+
* current on-chain owner, so no secret is needed — these are safe to
|
|
299
|
+
* call from the browser.
|
|
300
|
+
* - execute / list / allowance: `sk_` (a secret key bearer). execute relays
|
|
301
|
+
* through the paymaster and meters; reads are org-private. Call these from
|
|
302
|
+
* a server (a Next.js route handler / your backend), never the browser.
|
|
303
|
+
*
|
|
304
|
+
* The types below mirror `@chipi-stack/chipi-react/multisig`'s `TreasuryProposal`
|
|
305
|
+
* / `ProposeBody` field-for-field (post-#324: OE `executeAfter` is derived from
|
|
306
|
+
* `executeBefore`, never sent or stored). They're duplicated (not imported) so
|
|
307
|
+
* the server SDK never depends on the React package; TypeScript's structural
|
|
308
|
+
* typing makes a `TreasuryTransport` assignable to the hook's `MultisigTransport`.
|
|
309
|
+
*/
|
|
310
|
+
/** One owner's collected signature on a proposal. */
|
|
311
|
+
interface TreasuryProposalSignature {
|
|
312
|
+
ownerId: number;
|
|
313
|
+
signerKind: string;
|
|
314
|
+
/** The owner's serialized inner V2_SNIP12 envelope (comma-joined felts). */
|
|
315
|
+
signature: string;
|
|
316
|
+
}
|
|
317
|
+
/** A treasury proposal as returned by the coordination backend. */
|
|
318
|
+
interface TreasuryProposal {
|
|
319
|
+
id: string;
|
|
320
|
+
/** Set for generalized actions (vote / call any contract); null for payments. */
|
|
321
|
+
calls?: {
|
|
322
|
+
to: string;
|
|
323
|
+
entrypoint: string;
|
|
324
|
+
calldata: string[];
|
|
325
|
+
}[] | null;
|
|
326
|
+
/** Human label for an action ("Vote YES on Proposal #5"). */
|
|
327
|
+
title?: string | null;
|
|
328
|
+
/** Arbitrary integrator context persisted with the proposal (chipi-back
|
|
329
|
+
* #301, `meta Json?`) — e.g. `{ poolId }`, read by the approver app's
|
|
330
|
+
* `renderContext`. Null on payments and pre-#301 rows. */
|
|
331
|
+
meta?: Record<string, string | number> | null;
|
|
332
|
+
/** App-level risk tier the proposal was filed under (chipi-back #302;
|
|
333
|
+
* null = none). */
|
|
334
|
+
risk?: "ROUTINE" | "SENSITIVE" | null;
|
|
335
|
+
oeMessageHash: string;
|
|
336
|
+
oeNonce: string | null;
|
|
337
|
+
/** chipi-back persists only `oeExecuteBefore`; the OE `executeAfter` is
|
|
338
|
+
* re-derived as `executeBefore - 2h` by executors (see chipi-react #324). */
|
|
339
|
+
oeExecuteBefore: string | null;
|
|
340
|
+
requiredApprovals: number;
|
|
341
|
+
status: "PROPOSED" | "APPROVED" | "EXECUTED" | "CANCELED" | "EXPIRED";
|
|
342
|
+
executedTxHash?: string | null;
|
|
343
|
+
signatures: TreasuryProposalSignature[];
|
|
344
|
+
}
|
|
345
|
+
/** The body the coordination backend's `propose` endpoint accepts. */
|
|
346
|
+
interface ProposeBody {
|
|
347
|
+
proposerOwnerId: number;
|
|
348
|
+
recipient: string;
|
|
349
|
+
tokenAddress: string;
|
|
350
|
+
amount: string;
|
|
351
|
+
title: string;
|
|
352
|
+
calls: {
|
|
353
|
+
to: string;
|
|
354
|
+
entrypoint: string;
|
|
355
|
+
calldata: string[];
|
|
356
|
+
}[];
|
|
357
|
+
/** Arbitrary integrator context persisted with the proposal (chipi-back
|
|
358
|
+
* #301). Flat string|number values, bounded server-side: ≤16 keys, key
|
|
359
|
+
* ≤40 chars, string values ≤200 chars. */
|
|
360
|
+
meta?: Record<string, string | number>;
|
|
361
|
+
/** Template risk tier (chipi-back #302): when the treasury configured the
|
|
362
|
+
* matching quorum, the server overrides requiredApprovals at propose. */
|
|
363
|
+
risk?: "ROUTINE" | "SENSITIVE";
|
|
364
|
+
oeMessageHash: string;
|
|
365
|
+
oeNonce: string;
|
|
366
|
+
oeExecuteBefore: string;
|
|
367
|
+
requiredApprovals: number;
|
|
368
|
+
proposerSignature: string;
|
|
369
|
+
proposerSignerKind: string;
|
|
370
|
+
}
|
|
371
|
+
/** The approver's body for `sign` (mirrors chipi-react's call site). */
|
|
372
|
+
interface ApproveBody {
|
|
373
|
+
ownerId: number;
|
|
374
|
+
signature: string;
|
|
375
|
+
signerKind: string;
|
|
376
|
+
}
|
|
377
|
+
/** Result of relaying an execute through the paymaster. */
|
|
378
|
+
interface ExecuteResult {
|
|
379
|
+
executedTxHash?: string;
|
|
380
|
+
transactionHash?: string;
|
|
381
|
+
}
|
|
382
|
+
/** Free-execute meter for the org (shape owned by chipi-back's treasury svc). */
|
|
383
|
+
interface MultisigAllowance {
|
|
384
|
+
freeExecutesRemaining?: number;
|
|
385
|
+
priceUsd?: number;
|
|
386
|
+
creditsUsd?: number;
|
|
387
|
+
canExecuteNow?: boolean;
|
|
388
|
+
[key: string]: unknown;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* A transport bound to one treasury + the local owner's public key.
|
|
392
|
+
* Structurally compatible with `@chipi-stack/chipi-react`'s `MultisigTransport`.
|
|
393
|
+
*/
|
|
394
|
+
interface TreasuryTransport {
|
|
395
|
+
list(): Promise<{
|
|
396
|
+
items: TreasuryProposal[];
|
|
397
|
+
}>;
|
|
398
|
+
propose(body: ProposeBody): Promise<TreasuryProposal>;
|
|
399
|
+
sign(proposalId: string, body: ApproveBody): Promise<unknown>;
|
|
400
|
+
execute(proposalId: string, calldata: string[]): Promise<ExecuteResult>;
|
|
401
|
+
/** Read the org's free-execute meter (sk_). Not part of MultisigTransport. */
|
|
402
|
+
getMultisigAllowance(): Promise<MultisigAllowance>;
|
|
403
|
+
}
|
|
404
|
+
interface ForTreasuryConfig {
|
|
405
|
+
/** The org treasury id (the multisig wallet's row id in chipi-back). */
|
|
406
|
+
treasuryId: string;
|
|
407
|
+
/**
|
|
408
|
+
* The local owner's public key, sent with propose / sign so the backend can
|
|
409
|
+
* verify the envelope commits to a current on-chain owner. Kind-specific
|
|
410
|
+
* format (must match the `signerKind` of the envelopes this transport sends):
|
|
411
|
+
* - STARK: one 0x-hex felt (the stark key) — `starkPubkeyFelts(pub)[0]`.
|
|
412
|
+
* - WEBAUTHN_P256: `"0x<x>,0x<y>"` (full 32-byte BE P-256 coordinates) —
|
|
413
|
+
* use `webauthnOwnerPubkeyParam(pubkey)`.
|
|
414
|
+
* - EIP191_SECP256K1 (MetaMask): `"0x<x>,0x<y>"` (full 32-byte BE
|
|
415
|
+
* secp256k1 coordinates) — use `eip191OwnerPubkeyParam(pubkey)`.
|
|
416
|
+
* - ED25519 (Phantom): `"0x<low>,0x<high>"` (LE u128 halves of the
|
|
417
|
+
* 32-byte key) — use `ed25519OwnerPubkeyParam(publicKey)`.
|
|
418
|
+
* NOTE: the coordinate-based kinds take the FULL x/y values, never the
|
|
419
|
+
* 4-felt `*PubkeyFelts` form (the backend rejects more than 2 values).
|
|
420
|
+
*/
|
|
421
|
+
ownerPubkey: string;
|
|
422
|
+
/** A secret key (`sk_`) for execute / list / allowance. Falls back to the
|
|
423
|
+
* SDK's configured `apiSecretKey`. Required only for those three; propose /
|
|
424
|
+
* sign authenticate with `pk_` + the owner signature. */
|
|
425
|
+
bearerToken?: string;
|
|
426
|
+
}
|
|
427
|
+
declare class ChipiTreasury {
|
|
428
|
+
private client;
|
|
429
|
+
private apiSecretKey?;
|
|
430
|
+
constructor(client: ChipiClient, apiSecretKey?: string | undefined);
|
|
431
|
+
private base;
|
|
432
|
+
/** Resolve a `sk_` for the secret-gated reads/execute, or fail loudly. */
|
|
433
|
+
private secret;
|
|
434
|
+
/**
|
|
435
|
+
* Build a {@link TreasuryTransport} for one treasury + owner. Wire the
|
|
436
|
+
* returned object directly into chipi-react's `useProposeAction` /
|
|
437
|
+
* `useTreasuryProposals` `transport` prop, or call its methods yourself.
|
|
438
|
+
*/
|
|
439
|
+
forTreasury(config: ForTreasuryConfig): TreasuryTransport;
|
|
440
|
+
}
|
|
441
|
+
|
|
284
442
|
/**
|
|
285
443
|
* PaymasterAdapter implementation that uses Chipi's backend API for gasless transactions.
|
|
286
444
|
*
|
|
@@ -382,6 +540,7 @@ declare class ChipiSDK {
|
|
|
382
540
|
readonly skus: ChipiSkus;
|
|
383
541
|
readonly sessions: ChipiSessions;
|
|
384
542
|
readonly exchanges: ChipiExchanges;
|
|
543
|
+
readonly treasury: ChipiTreasury;
|
|
385
544
|
constructor(config: ChipiSDKConfig);
|
|
386
545
|
/**
|
|
387
546
|
* Resolve bearer token - uses provided token or falls back to apiSecretKey
|
|
@@ -484,6 +643,14 @@ declare class ChipiSDK {
|
|
|
484
643
|
signTypedData({ params }: {
|
|
485
644
|
params: SignTypedDataParams;
|
|
486
645
|
}): Promise<SignTypedDataResult>;
|
|
646
|
+
/**
|
|
647
|
+
* Sign SNIP-12 typed data and return the full signature span (felt strings) —
|
|
648
|
+
* the shape a dApp's `wallet_signTypedData` expects. Wallet-type aware:
|
|
649
|
+
* SHHH returns the V2_SNIP12 owner envelope; standard accounts return [r, s].
|
|
650
|
+
*/
|
|
651
|
+
signTypedDataArray({ params }: {
|
|
652
|
+
params: SignTypedDataParams;
|
|
653
|
+
}): Promise<string[]>;
|
|
487
654
|
/**
|
|
488
655
|
* Transfer tokens
|
|
489
656
|
*/
|
|
@@ -643,6 +810,23 @@ declare class ChipiBrowserSDK extends ChipiSDK {
|
|
|
643
810
|
declare const signTypedData: ({ params, }: {
|
|
644
811
|
params: SignTypedDataParams;
|
|
645
812
|
}) => Promise<SignTypedDataResult>;
|
|
813
|
+
/**
|
|
814
|
+
* Sign SNIP-12 typed data and return the full signature SPAN as felt strings —
|
|
815
|
+
* the shape a dApp's `wallet_signTypedData` expects (wallet-api `Signature`).
|
|
816
|
+
*
|
|
817
|
+
* Wallet-type aware (this is the part the plain `signTypedData` {r,s} can't do):
|
|
818
|
+
* - **SHHH V8.4**: `__validate__` is disabled and the account verifies a
|
|
819
|
+
* V2_SNIP12 envelope `[V2_SNIP12, owner_id, 'STARK', r, s]`. We hash the
|
|
820
|
+
* typed data per SNIP-12, sign with the STARK owner key, and wrap it so the
|
|
821
|
+
* account's `is_valid_signature` accepts it. Purely local (no API call).
|
|
822
|
+
* - **READY / standard**: a bare `[r, s]` from `account.signMessage`.
|
|
823
|
+
*
|
|
824
|
+
* Phase 0 covers the primary STARK owner (ownerIndex 0). WebAuthn-rooted
|
|
825
|
+
* owners (interactive passkey assertion) are a follow-up.
|
|
826
|
+
*/
|
|
827
|
+
declare const signTypedDataArray: ({ params, }: {
|
|
828
|
+
params: SignTypedDataParams;
|
|
829
|
+
}) => Promise<string[]>;
|
|
646
830
|
|
|
647
831
|
declare const encryptPrivateKey: (privateKey: string, password: string) => string;
|
|
648
832
|
declare const decryptPrivateKey: (encryptedPrivateKey: string, password: string) => string;
|
|
@@ -1116,6 +1300,15 @@ declare function ed25519OwnerId(publicKey: Uint8Array): bigint;
|
|
|
1116
1300
|
* order — what the Cairo `kind == ED25519` branch reads.
|
|
1117
1301
|
*/
|
|
1118
1302
|
declare function ed25519PubkeyFelts(publicKey: Uint8Array): bigint[];
|
|
1303
|
+
/**
|
|
1304
|
+
* The `ownerPubkey` string for the treasury coordination endpoints
|
|
1305
|
+
* (`sdk.treasury.forTreasury({ ownerPubkey })`): `"0x<low>,0x<high>"` —
|
|
1306
|
+
* the comma-joined `ed25519PubkeyFelts` halves. chipi-back's
|
|
1307
|
+
* OwnerSignatureVerifier parses exactly this shape for ED25519 owners,
|
|
1308
|
+
* so use this helper rather than hand-formatting (the LE-halves split is
|
|
1309
|
+
* easy to get backwards).
|
|
1310
|
+
*/
|
|
1311
|
+
declare function ed25519OwnerPubkeyParam(publicKey: Uint8Array): string;
|
|
1119
1312
|
/**
|
|
1120
1313
|
* Build a V2_SNIP12 envelope for the Ed25519 kind. Async because the
|
|
1121
1314
|
* underlying Garaga WASM must be initialized; subsequent calls reuse
|
|
@@ -1236,6 +1429,15 @@ declare function eip191PubkeyFelts(pubkey: Eip191Pubkey): bigint[];
|
|
|
1236
1429
|
* owner_id = owner_commitment(EIP191_tag, [x.low, x.high, y.low, y.high]).
|
|
1237
1430
|
*/
|
|
1238
1431
|
declare function eip191OwnerId(pubkey: Eip191Pubkey): bigint;
|
|
1432
|
+
/**
|
|
1433
|
+
* The `ownerPubkey` string for the treasury coordination endpoints
|
|
1434
|
+
* (`sdk.treasury.forTreasury({ ownerPubkey })`): `"0x<x>,0x<y>"` — the
|
|
1435
|
+
* FULL 32-byte BE coordinates of the uncompressed secp256k1 point, NOT
|
|
1436
|
+
* the 4 `eip191PubkeyFelts` halves. chipi-back's OwnerSignatureVerifier
|
|
1437
|
+
* splits the coordinates into commitment felts itself; sending the
|
|
1438
|
+
* 4-felt form fails its DTO validation (max 2 comma-joined values).
|
|
1439
|
+
*/
|
|
1440
|
+
declare function eip191OwnerPubkeyParam(pubkey: Eip191Pubkey): string;
|
|
1239
1441
|
/**
|
|
1240
1442
|
* Parse a 65-byte `personal_sign`/`eth_sign` signature hex string into
|
|
1241
1443
|
* the Cairo-shaped envelope payload `[r.low, r.high, s.low, s.high, y_parity]`.
|
|
@@ -1344,6 +1546,14 @@ declare function parseDerEcdsaSignature(der: Uint8Array): {
|
|
|
1344
1546
|
};
|
|
1345
1547
|
declare function webauthnPubkeyFelts(pub: WebAuthnPubkey): bigint[];
|
|
1346
1548
|
declare function webauthnOwnerId(pub: WebAuthnPubkey): bigint;
|
|
1549
|
+
/**
|
|
1550
|
+
* The `ownerPubkey` string for the treasury coordination endpoints
|
|
1551
|
+
* (`sdk.treasury.forTreasury({ ownerPubkey })`): `"0x<x>,0x<y>"` — the
|
|
1552
|
+
* FULL 32-byte BE P-256 coordinates, NOT the 4 `webauthnPubkeyFelts`
|
|
1553
|
+
* halves. chipi-back's OwnerSignatureVerifier splits the coordinates
|
|
1554
|
+
* into commitment felts itself.
|
|
1555
|
+
*/
|
|
1556
|
+
declare function webauthnOwnerPubkeyParam(pub: WebAuthnPubkey): string;
|
|
1347
1557
|
/**
|
|
1348
1558
|
* Production / browser flow. The caller has run
|
|
1349
1559
|
* `navigator.credentials.get({ publicKey: { challenge: msgBe32, ... } })`
|
|
@@ -2248,4 +2458,118 @@ declare function executeShhhSponsoredRaw(params: {
|
|
|
2248
2458
|
chainId?: bigint | string;
|
|
2249
2459
|
}): Promise<string>;
|
|
2250
2460
|
|
|
2251
|
-
|
|
2461
|
+
/**
|
|
2462
|
+
* ShhhAccount — ergonomic drop-in adapter for signing as a SHHH V8.4
|
|
2463
|
+
* owner from a raw owner private key.
|
|
2464
|
+
*
|
|
2465
|
+
* Why this exists: a SHHH account is account-abstracted and its
|
|
2466
|
+
* `__validate__` is DISABLED (shhh-wallet-cairo `src/account.cairo`
|
|
2467
|
+
* panics with `'SHHH: __validate__ disabled'`), so the standard
|
|
2468
|
+
* starknet.js path — `new Account(provider, addr, key).execute(calls)`
|
|
2469
|
+
* — does NOT work. The only authorized execution path is
|
|
2470
|
+
* `execute_from_outside_v2`: you sign an OutsideExecution and submit it.
|
|
2471
|
+
*
|
|
2472
|
+
* This wrapper hides that plumbing so a holder of an exported STARK
|
|
2473
|
+
* owner key can write the familiar:
|
|
2474
|
+
*
|
|
2475
|
+
* const account = new ShhhAccount(provider, address, privateKey, {
|
|
2476
|
+
* submit: submitViaAccount(fundedRelayer),
|
|
2477
|
+
* });
|
|
2478
|
+
* const { transactionHash } = await account.execute(calls);
|
|
2479
|
+
*
|
|
2480
|
+
* It signs the OE with the owner key (ownerIndex 0 = primary) and
|
|
2481
|
+
* broadcasts via the configured `submit` strategy — either a funded
|
|
2482
|
+
* Starknet account you control (fully self-sovereign, no Chipi servers)
|
|
2483
|
+
* or a paymaster relay (gasless). If you don't configure `submit`, call
|
|
2484
|
+
* `signExecution()` and broadcast the calldata yourself.
|
|
2485
|
+
*
|
|
2486
|
+
* Scope: STARK-kind owners. Other signer kinds (Ed25519 / EIP-191 /
|
|
2487
|
+
* WebAuthn) have their own envelope builders; this adapter targets the
|
|
2488
|
+
* exported-private-key use case, which is always a STARK owner.
|
|
2489
|
+
*/
|
|
2490
|
+
|
|
2491
|
+
/**
|
|
2492
|
+
* How a signed `execute_from_outside_v2` calldata is broadcast. The
|
|
2493
|
+
* account itself can never pay gas (`__validate__` is disabled), so the
|
|
2494
|
+
* broadcaster is always a separate party: a funded relayer you control,
|
|
2495
|
+
* or a paymaster service. It only pays gas — it is NOT the signer.
|
|
2496
|
+
*/
|
|
2497
|
+
type ShhhSubmit = (input: {
|
|
2498
|
+
accountAddress: string;
|
|
2499
|
+
calldata: string[];
|
|
2500
|
+
}) => Promise<{
|
|
2501
|
+
transactionHash: string;
|
|
2502
|
+
}>;
|
|
2503
|
+
interface ShhhAccountOptions {
|
|
2504
|
+
/**
|
|
2505
|
+
* Owner index into the wallet's owner_set. Defaults to `0n` (the
|
|
2506
|
+
* primary owner — what an exported private key controls). Override
|
|
2507
|
+
* for additional owners added via `propose_add_owner`.
|
|
2508
|
+
*/
|
|
2509
|
+
ownerIndex?: bigint;
|
|
2510
|
+
/**
|
|
2511
|
+
* Chain id used for SNIP-12 hashing. Defaults to Starknet mainnet
|
|
2512
|
+
* (Chipi is mainnet-only). A wrong value makes the account reject the
|
|
2513
|
+
* signature on chain.
|
|
2514
|
+
*/
|
|
2515
|
+
chainId?: bigint | string;
|
|
2516
|
+
/** Broadcast strategy. Omit to sign-only via {@link ShhhAccount.signExecution}. */
|
|
2517
|
+
submit?: ShhhSubmit;
|
|
2518
|
+
}
|
|
2519
|
+
interface ShhhSignedExecution {
|
|
2520
|
+
/** The OutsideExecution that was signed. */
|
|
2521
|
+
outsideExecution: OutsideExecution;
|
|
2522
|
+
/** The owner signature envelope `[V2_SNIP12, owner_id, 'STARK', r, s]`. */
|
|
2523
|
+
signature: bigint[];
|
|
2524
|
+
/** The SNIP-12 message hash that was signed. */
|
|
2525
|
+
messageHash: bigint;
|
|
2526
|
+
/** Flat felt calldata for the `execute_from_outside_v2` selector. */
|
|
2527
|
+
calldata: string[];
|
|
2528
|
+
}
|
|
2529
|
+
interface ShhhExecuteOptions {
|
|
2530
|
+
/** Override the replay nonce. Default: `(Date.now() << 24) | random24`. */
|
|
2531
|
+
nonce?: bigint | string;
|
|
2532
|
+
/**
|
|
2533
|
+
* How long (seconds from now) the OE stays valid. Default: the account
|
|
2534
|
+
* max (~2h). The builder backdates `execute_after` by a 60s clock-skew
|
|
2535
|
+
* buffer, and the account caps the total window at 2h, so the usable
|
|
2536
|
+
* max here is `MAX_OE_VALIDITY_WINDOW_SECONDS - 60` (7140s). Values
|
|
2537
|
+
* above that throw with a clear message rather than a cryptic builder
|
|
2538
|
+
* error.
|
|
2539
|
+
*/
|
|
2540
|
+
validForSeconds?: number;
|
|
2541
|
+
}
|
|
2542
|
+
declare class ShhhAccount {
|
|
2543
|
+
/** The provider, exposed for convenience (e.g. `account.provider.waitForTransaction`). */
|
|
2544
|
+
readonly provider: ProviderInterface;
|
|
2545
|
+
readonly address: string;
|
|
2546
|
+
readonly ownerIndex: bigint;
|
|
2547
|
+
readonly chainId: bigint | string;
|
|
2548
|
+
private readonly privateKey;
|
|
2549
|
+
private readonly submitFn?;
|
|
2550
|
+
constructor(provider: ProviderInterface, address: string, privateKey: bigint | string, options?: ShhhAccountOptions);
|
|
2551
|
+
/**
|
|
2552
|
+
* Build + sign an OutsideExecution for `calls` and return the
|
|
2553
|
+
* serialized `execute_from_outside_v2` calldata (plus the underlying
|
|
2554
|
+
* pieces). Use this when you want to broadcast the calldata yourself.
|
|
2555
|
+
*/
|
|
2556
|
+
signExecution(calls: Call[], options?: ShhhExecuteOptions): Promise<ShhhSignedExecution>;
|
|
2557
|
+
/**
|
|
2558
|
+
* Sign `calls` and broadcast them via the configured `submit` strategy.
|
|
2559
|
+
* Mirrors starknet.js `Account.execute` ergonomically. Returns the
|
|
2560
|
+
* transaction hash without waiting for inclusion — use
|
|
2561
|
+
* `provider.waitForTransaction(transactionHash)` if you need to block.
|
|
2562
|
+
*/
|
|
2563
|
+
execute(calls: Call[], options?: ShhhExecuteOptions): Promise<{
|
|
2564
|
+
transactionHash: string;
|
|
2565
|
+
}>;
|
|
2566
|
+
}
|
|
2567
|
+
/**
|
|
2568
|
+
* Self-sovereign submit strategy: relay the signed OE through any funded
|
|
2569
|
+
* Starknet account you control. The funded account only pays gas — it is
|
|
2570
|
+
* NOT the signer, and never sees the SHHH owner key. This is the path
|
|
2571
|
+
* that needs no Chipi servers at all.
|
|
2572
|
+
*/
|
|
2573
|
+
declare function submitViaAccount(funded: Account): ShhhSubmit;
|
|
2574
|
+
|
|
2575
|
+
export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, type ApproveBody, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiTreasury, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, type ExecuteResult, type ForTreasuryConfig, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type MultisigAllowance, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, type ProposeBody, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, ShhhAccount, type ShhhAccountOptions, type ShhhExecuteOptions, type ShhhSignedExecution, type ShhhSubmit, type ShhhX402Wallet, TIMELOCK_SECONDS, type TreasuryProposal, type TreasuryProposalSignature, type TreasuryTransport, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519OwnerPubkeyParam, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191OwnerPubkeyParam, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, signTypedDataArray, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, submitViaAccount, webauthnOwnerId, webauthnOwnerPubkeyParam, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
|