@chipi-stack/backend 14.15.1 → 14.17.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 +48 -0
- package/dist/index.d.mts +543 -65
- package/dist/index.d.ts +543 -65
- package/dist/index.js +1026 -317
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +997 -319
- package/dist/index.mjs.map +1 -1
- package/dist/skuPurchases.js +16 -2
- package/dist/skuPurchases.js.map +1 -1
- package/dist/skuPurchases.mjs +16 -2
- package/dist/skuPurchases.mjs.map +1 -1
- package/dist/transactions.js +16 -2
- package/dist/transactions.js.map +1 -1
- package/dist/transactions.mjs +16 -2
- package/dist/transactions.mjs.map +1 -1
- package/dist/wallets.js +25 -3
- package/dist/wallets.js.map +1 -1
- package/dist/wallets.mjs +25 -3
- package/dist/wallets.mjs.map +1 -1
- package/package.json +4 -4
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-D6SDBu5p.mjs';
|
|
11
|
-
import { Call, ProviderInterface, Account } from 'starknet';
|
|
11
|
+
import { Call, TypedData, ProviderInterface, Account } from 'starknet';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Session key management for CHIPI wallets (SNIP-9 compatible).
|
|
@@ -755,11 +755,18 @@ declare class X402Facilitator {
|
|
|
755
755
|
* Verify a payment signature is valid (doesn't execute the transfer).
|
|
756
756
|
*
|
|
757
757
|
* Checks:
|
|
758
|
-
* 1.
|
|
759
|
-
* 2.
|
|
760
|
-
* 3.
|
|
761
|
-
* 4.
|
|
762
|
-
* 5.
|
|
758
|
+
* 1. x402 version is 1
|
|
759
|
+
* 2. Network is starknet-mainnet
|
|
760
|
+
* 3. Nonce has not been used (replay protection)
|
|
761
|
+
* 4. Payment has not expired (validUntil > now)
|
|
762
|
+
* 5. Asset is USDC mainnet
|
|
763
|
+
* 6. Amount is positive
|
|
764
|
+
* 7. Addresses are non-empty
|
|
765
|
+
* 8. Signature: with a `provider`, the payer account's `is_valid_signature`
|
|
766
|
+
* must return 'VALID'. Without one, only its presence is checked (not a
|
|
767
|
+
* cryptographic check). SHHH payloads must sign exactly one transfer
|
|
768
|
+
* of `amount` of `asset` to `toAddress`; their signature is checked
|
|
769
|
+
* on-chain at settle.
|
|
763
770
|
*/
|
|
764
771
|
verify(payment: PaymentPayload): Promise<VerifyResponse>;
|
|
765
772
|
/**
|
|
@@ -780,6 +787,150 @@ declare class X402Facilitator {
|
|
|
780
787
|
settle(payment: PaymentPayload): Promise<SettleResponse>;
|
|
781
788
|
}
|
|
782
789
|
|
|
790
|
+
/**
|
|
791
|
+
* SNIP-12 typed-data hash for `OutsideExecution` — TypeScript reference.
|
|
792
|
+
*
|
|
793
|
+
* Vendored from haycarlitos/shhh-wallet-cairo @ v8.4 commit 3975532
|
|
794
|
+
* source: scripts/ts/snip12-hash.ts
|
|
795
|
+
* license: MIT (Copyright (c) 2026 Carlos Castillo and contributors)
|
|
796
|
+
*
|
|
797
|
+
* MUST produce byte-identical output to `compute_snip12_hash` in
|
|
798
|
+
* `src/outside_execution.cairo` at the same commit. If the canonical
|
|
799
|
+
* Cairo source ships a breaking change, the upstream Shhh maintainer
|
|
800
|
+
* will open a PR against this file (per Q3 of SHHH_INTEGRATION_ANSWERS.md).
|
|
801
|
+
*/
|
|
802
|
+
|
|
803
|
+
declare const STARKNET_MESSAGE_PREFIX: string;
|
|
804
|
+
declare const OE_DOMAIN_NAME: string;
|
|
805
|
+
declare const OE_DOMAIN_VERSION = 2n;
|
|
806
|
+
declare const OE_DOMAIN_REVISION = 1n;
|
|
807
|
+
declare const SIG_VERSION_V1_HEX_ASCII: string;
|
|
808
|
+
declare const SIG_VERSION_V2_SNIP12: string;
|
|
809
|
+
declare const SIG_VERSION_V2_THRESHOLD: string;
|
|
810
|
+
declare const ISRC9_V2_ID: bigint;
|
|
811
|
+
declare const ISIGNER_ID: bigint;
|
|
812
|
+
declare const ISIGNER_CANONICAL_LABEL = "ISigner_V1";
|
|
813
|
+
/** Recomputes the canonical `ISIGNER_ID` at runtime. */
|
|
814
|
+
declare function computeISignerId(): bigint;
|
|
815
|
+
type OutsideExecution = {
|
|
816
|
+
caller: bigint | string;
|
|
817
|
+
nonce: bigint | string;
|
|
818
|
+
execute_after: bigint;
|
|
819
|
+
execute_before: bigint;
|
|
820
|
+
calls: Call[];
|
|
821
|
+
};
|
|
822
|
+
declare function hashCall(call: Call): bigint;
|
|
823
|
+
declare function hashCalls(calls: Call[]): bigint;
|
|
824
|
+
declare function hashStarknetDomain(chainIdFelt: bigint | string): bigint;
|
|
825
|
+
declare function hashOutsideExecutionStruct(oe: OutsideExecution): bigint;
|
|
826
|
+
/**
|
|
827
|
+
* The authoritative SNIP-12 message hash for an OutsideExecution.
|
|
828
|
+
* Signers sign over this felt252 (or its hex-ASCII re-encoding for
|
|
829
|
+
* Phantom UX compatibility — see snip12HashToHexAsciiBytes).
|
|
830
|
+
*/
|
|
831
|
+
declare function computeSnip12Hash(oe: OutsideExecution, contractAddress: bigint | string, chainIdFelt: bigint | string): bigint;
|
|
832
|
+
/**
|
|
833
|
+
* Phantom hex-ASCII envelope helper. Phantom signs a string; we give it
|
|
834
|
+
* a 64-byte hex-ASCII representation of the SNIP-12 hash, and the Cairo
|
|
835
|
+
* verifier re-computes the hash and compares byte-by-byte.
|
|
836
|
+
*/
|
|
837
|
+
declare function snip12HashToHexAsciiBytes(h: bigint): Uint8Array;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Run calls on a SHHH wallet signed by an EXTERNAL Starknet wallet that is
|
|
841
|
+
* one of its owners or guardians: Bramble, Braavos, Ready/Argent, an
|
|
842
|
+
* OpenZeppelin account or another Chipi wallet, registered with the
|
|
843
|
+
* `STARK_SNIP12` kind.
|
|
844
|
+
*
|
|
845
|
+
* The external wallet signs an `Approval { Wallet, Hash }` typed data with
|
|
846
|
+
* `wallet_signTypedData` (see `signers/stark-snip12.ts`). Nothing is
|
|
847
|
+
* decrypted: the key stays in the external wallet. Chipi's paymaster
|
|
848
|
+
* relays the outside execution gaslessly, like any other SHHH OE.
|
|
849
|
+
*
|
|
850
|
+
* Two steps so the signing can happen wherever the wallet lives:
|
|
851
|
+
* 1. `prepareExternalOwnerExecution` → `{ outsideExecution, typedData }`
|
|
852
|
+
* 2. `submitExternalOwnerExecution` with the wallet's signature
|
|
853
|
+
* `executeShhhWithExternalSigner` does both with a `signTypedData` callback.
|
|
854
|
+
*/
|
|
855
|
+
|
|
856
|
+
interface PreparedExternalOwnerExecution {
|
|
857
|
+
walletAddress: string;
|
|
858
|
+
outsideExecution: OutsideExecution;
|
|
859
|
+
/** SNIP-12 hash of the OE (what the Approval carries as `Hash`). */
|
|
860
|
+
messageHash: bigint;
|
|
861
|
+
/** What the external wallet signs with `wallet_signTypedData`. */
|
|
862
|
+
typedData: TypedData;
|
|
863
|
+
chainId: string;
|
|
864
|
+
}
|
|
865
|
+
/** Step 1: build the OE (max 2h window) and the typed data to sign. */
|
|
866
|
+
declare function prepareExternalOwnerExecution(params: {
|
|
867
|
+
/** The SHHH wallet's address. */
|
|
868
|
+
walletAddress: string;
|
|
869
|
+
calls: Call[];
|
|
870
|
+
nonce?: bigint;
|
|
871
|
+
/** Defaults to mainnet. */
|
|
872
|
+
chainId?: bigint | string;
|
|
873
|
+
}): PreparedExternalOwnerExecution;
|
|
874
|
+
/**
|
|
875
|
+
* Step 2: wrap the wallet's signature and relay the OE through Chipi's
|
|
876
|
+
* paymaster (`/transactions/execute-sponsored-raw`). Returns the tx hash;
|
|
877
|
+
* wait for it before treating the call as done.
|
|
878
|
+
*/
|
|
879
|
+
declare function submitExternalOwnerExecution(params: {
|
|
880
|
+
client: ChipiClient;
|
|
881
|
+
bearerToken: string;
|
|
882
|
+
prepared: PreparedExternalOwnerExecution;
|
|
883
|
+
/** The external wallet's `wallet_signTypedData` result, as returned. */
|
|
884
|
+
signature: Array<string | number | bigint>;
|
|
885
|
+
/** u32 index of the external wallet in the SHHH wallet's owner_set. */
|
|
886
|
+
ownerIndex: number | bigint;
|
|
887
|
+
/**
|
|
888
|
+
* The external wallet's address and STARK key (from `resolveStarkSnip12Signer`).
|
|
889
|
+
* When given, the signature is checked off-chain first, so a wrong wallet or
|
|
890
|
+
* key fails here. Without it nothing is checked before relaying, and a wrong
|
|
891
|
+
* signature only shows up as a reverted transaction. Pass it whenever you can.
|
|
892
|
+
*/
|
|
893
|
+
signer?: {
|
|
894
|
+
address: string;
|
|
895
|
+
starkPubkey: bigint | string;
|
|
896
|
+
};
|
|
897
|
+
externalUserId?: string;
|
|
898
|
+
}): Promise<string>;
|
|
899
|
+
/** Both steps, with the external wallet's `signTypedData` as a callback. */
|
|
900
|
+
declare function executeShhhWithExternalSigner(params: {
|
|
901
|
+
client: ChipiClient;
|
|
902
|
+
bearerToken: string;
|
|
903
|
+
walletAddress: string;
|
|
904
|
+
calls: Call[];
|
|
905
|
+
ownerIndex: number | bigint;
|
|
906
|
+
signTypedData: (typedData: TypedData) => Promise<Array<string | number | bigint>>;
|
|
907
|
+
signer?: {
|
|
908
|
+
address: string;
|
|
909
|
+
starkPubkey: bigint | string;
|
|
910
|
+
};
|
|
911
|
+
nonce?: bigint;
|
|
912
|
+
chainId?: bigint | string;
|
|
913
|
+
externalUserId?: string;
|
|
914
|
+
}): Promise<string>;
|
|
915
|
+
/**
|
|
916
|
+
* Run calls signed by a raw STARK key that is owner `ownerIndex` of the
|
|
917
|
+
* wallet, relayed gaslessly. For the step right after a guardian recovery:
|
|
918
|
+
* the recovered key is a new owner (recovery adds, it never replaces), and
|
|
919
|
+
* it signs `propose_rotate_owner` to move owner 0 onto a fresh key, which is
|
|
920
|
+
* the key every other SDK call signs with. Keep `privateKey` in memory only.
|
|
921
|
+
*/
|
|
922
|
+
declare function executeShhhWithStarkKey(params: {
|
|
923
|
+
client: ChipiClient;
|
|
924
|
+
bearerToken: string;
|
|
925
|
+
walletAddress: string;
|
|
926
|
+
calls: Call[];
|
|
927
|
+
privateKey: string | bigint;
|
|
928
|
+
ownerIndex: number | bigint;
|
|
929
|
+
nonce?: bigint;
|
|
930
|
+
chainId?: bigint | string;
|
|
931
|
+
externalUserId?: string;
|
|
932
|
+
}): Promise<string>;
|
|
933
|
+
|
|
783
934
|
/**
|
|
784
935
|
* Main Chipi SDK class
|
|
785
936
|
*/
|
|
@@ -906,6 +1057,33 @@ declare class ChipiSDK {
|
|
|
906
1057
|
signTypedDataArray({ params }: {
|
|
907
1058
|
params: SignTypedDataParams;
|
|
908
1059
|
}): Promise<string[]>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Run calls on a SHHH wallet, signed by an external Starknet wallet that is
|
|
1062
|
+
* one of its `STARK_SNIP12` owners (Bramble, Braavos, Ready/Argent, OZ, or
|
|
1063
|
+
* another Chipi wallet). The wallet signs an `Approval` typed data through
|
|
1064
|
+
* `signTypedData` (its `wallet_signTypedData`); Chipi's paymaster relays the
|
|
1065
|
+
* outside execution gaslessly. Returns the tx hash: wait for it.
|
|
1066
|
+
*
|
|
1067
|
+
* @example
|
|
1068
|
+
* ```typescript
|
|
1069
|
+
* // Bramble approves an agent session on the user's Chipi wallet.
|
|
1070
|
+
* const bramble = window.starknet_bramble;
|
|
1071
|
+
* const txHash = await sdk.executeWithExternalSigner({
|
|
1072
|
+
* params: {
|
|
1073
|
+
* walletAddress: wallet.publicKey,
|
|
1074
|
+
* ownerIndex: 1, // Bramble's index in the wallet's owner set
|
|
1075
|
+
* calls: buildSessionSetupCalls(wallet.publicKey, sessionConfig, policies),
|
|
1076
|
+
* signTypedData: (typedData) =>
|
|
1077
|
+
* bramble.request({ type: "wallet_signTypedData", params: typedData }),
|
|
1078
|
+
* },
|
|
1079
|
+
* bearerToken,
|
|
1080
|
+
* });
|
|
1081
|
+
* ```
|
|
1082
|
+
*/
|
|
1083
|
+
executeWithExternalSigner({ params, bearerToken, }: {
|
|
1084
|
+
params: Omit<Parameters<typeof executeShhhWithExternalSigner>[0], "client" | "bearerToken">;
|
|
1085
|
+
bearerToken?: string;
|
|
1086
|
+
}): Promise<string>;
|
|
909
1087
|
/**
|
|
910
1088
|
* Transfer tokens
|
|
911
1089
|
*/
|
|
@@ -1472,54 +1650,147 @@ declare class SessionTxVerifier {
|
|
|
1472
1650
|
verifyTransfer(params: VerifyTransferParams): Promise<VerifyTransferResult>;
|
|
1473
1651
|
}
|
|
1474
1652
|
|
|
1653
|
+
/** SRC-6 `is_valid_signature` magic value: the short string 'VALID'. */
|
|
1654
|
+
declare const STARKNET_SIGNATURE_VALID = "0x56414c4944";
|
|
1655
|
+
/** Anything with a starknet.js-style `callContract` (e.g. `RpcProvider`). */
|
|
1656
|
+
interface StarknetCallProvider {
|
|
1657
|
+
callContract(call: {
|
|
1658
|
+
contractAddress: string;
|
|
1659
|
+
entrypoint: string;
|
|
1660
|
+
calldata?: string[];
|
|
1661
|
+
}): Promise<string[]>;
|
|
1662
|
+
}
|
|
1663
|
+
type StarknetSignatureCheck = {
|
|
1664
|
+
valid: true;
|
|
1665
|
+
} | {
|
|
1666
|
+
valid: false;
|
|
1667
|
+
reason: "INVALID_SIGNATURE" | "ACCOUNT_NOT_DEPLOYED";
|
|
1668
|
+
detail?: string;
|
|
1669
|
+
};
|
|
1670
|
+
/** `0x` + 64 hex, lowercase. Wallets differ on padding; compare on this. */
|
|
1671
|
+
declare function normalizeStarknetAddress(address: string): string;
|
|
1672
|
+
/**
|
|
1673
|
+
* Asks the account itself (SRC-6 `is_valid_signature`) whether `signature`
|
|
1674
|
+
* signs `messageHash`. The full signature array is passed through, so
|
|
1675
|
+
* multi-felt signatures (Argent, Braavos, multisig) work.
|
|
1676
|
+
*
|
|
1677
|
+
* Only 'VALID' counts: accounts return 0 or panic on a bad signature, and a
|
|
1678
|
+
* lax "anything non-zero" check would accept garbage. An account that is not
|
|
1679
|
+
* deployed yet comes back as ACCOUNT_NOT_DEPLOYED so the caller can fall back
|
|
1680
|
+
* to `verifyUndeployedStarknetSignature`.
|
|
1681
|
+
*/
|
|
1682
|
+
declare function isValidStarknetSignature(provider: StarknetCallProvider, accountAddress: string, messageHash: string, signature: Array<string | number | bigint>): Promise<StarknetSignatureCheck>;
|
|
1683
|
+
/** Account classes whose undeployed signatures we can check off-chain. */
|
|
1684
|
+
declare const COUNTERFACTUAL_ACCOUNT_CLASSES: {
|
|
1685
|
+
/** OpenZeppelin AccountUpgradeable 3.0 (Bramble's default account). */
|
|
1686
|
+
readonly OPENZEPPELIN_V3: "0x01d1777db36cdd06dd62cfde77b1b6ae06412af95d57a13dc40ac77b8a702381";
|
|
1687
|
+
/** Argent X / Ready 0.4 (`WALLET_CLASS_HASHES.READY`). */
|
|
1688
|
+
readonly ARGENT_V0_4: "0x036078334509b514626504edc9fb252328d1a240e4e948bef8d0c08dff45927f";
|
|
1689
|
+
};
|
|
1690
|
+
/** What a wallet returns from `wallet_deploymentData`. */
|
|
1691
|
+
interface StarknetDeploymentData {
|
|
1692
|
+
address: string;
|
|
1693
|
+
class_hash: string;
|
|
1694
|
+
salt: string;
|
|
1695
|
+
calldata: string[];
|
|
1696
|
+
}
|
|
1697
|
+
type UndeployedSignatureCheck = {
|
|
1698
|
+
valid: true;
|
|
1699
|
+
} | {
|
|
1700
|
+
valid: false;
|
|
1701
|
+
reason: "UNSUPPORTED_ACCOUNT_CLASS" | "ADDRESS_MISMATCH" | "INVALID_SIGNATURE";
|
|
1702
|
+
};
|
|
1475
1703
|
/**
|
|
1476
|
-
*
|
|
1704
|
+
* Checks a signature from an account that is not deployed yet (new Bramble
|
|
1705
|
+
* and Ready accounts stay counterfactual until their first transaction), using
|
|
1706
|
+
* the wallet's `wallet_deploymentData`:
|
|
1477
1707
|
*
|
|
1478
|
-
*
|
|
1479
|
-
*
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
1482
|
-
* MUST produce byte-identical output to `compute_snip12_hash` in
|
|
1483
|
-
* `src/outside_execution.cairo` at the same commit. If the canonical
|
|
1484
|
-
* Cairo source ships a breaking change, the upstream Shhh maintainer
|
|
1485
|
-
* will open a PR against this file (per Q3 of SHHH_INTEGRATION_ANSWERS.md).
|
|
1708
|
+
* 1. The class must be one we know how to read: OpenZeppelin 3.0 or Argent 0.4
|
|
1709
|
+
* without a guardian.
|
|
1710
|
+
* 2. The address must be the one those exact constructor arguments deploy to.
|
|
1711
|
+
* 3. The signature must be the owner key's ECDSA signature of the hash.
|
|
1486
1712
|
*/
|
|
1713
|
+
declare function verifyUndeployedStarknetSignature(deployment: StarknetDeploymentData, messageHash: string, signature: Array<string | number | bigint>): UndeployedSignatureCheck;
|
|
1487
1714
|
|
|
1488
|
-
declare const STARKNET_MESSAGE_PREFIX: string;
|
|
1489
|
-
declare const OE_DOMAIN_NAME: string;
|
|
1490
|
-
declare const OE_DOMAIN_VERSION = 2n;
|
|
1491
|
-
declare const OE_DOMAIN_REVISION = 1n;
|
|
1492
|
-
declare const SIG_VERSION_V1_HEX_ASCII: string;
|
|
1493
|
-
declare const SIG_VERSION_V2_SNIP12: string;
|
|
1494
|
-
declare const SIG_VERSION_V2_THRESHOLD: string;
|
|
1495
|
-
declare const ISRC9_V2_ID: bigint;
|
|
1496
|
-
declare const ISIGNER_ID: bigint;
|
|
1497
|
-
declare const ISIGNER_CANONICAL_LABEL = "ISigner_V1";
|
|
1498
|
-
/** Recomputes the canonical `ISIGNER_ID` at runtime. */
|
|
1499
|
-
declare function computeISignerId(): bigint;
|
|
1500
|
-
type OutsideExecution = {
|
|
1501
|
-
caller: bigint | string;
|
|
1502
|
-
nonce: bigint | string;
|
|
1503
|
-
execute_after: bigint;
|
|
1504
|
-
execute_before: bigint;
|
|
1505
|
-
calls: Call[];
|
|
1506
|
-
};
|
|
1507
|
-
declare function hashCall(call: Call): bigint;
|
|
1508
|
-
declare function hashCalls(calls: Call[]): bigint;
|
|
1509
|
-
declare function hashStarknetDomain(chainIdFelt: bigint | string): bigint;
|
|
1510
|
-
declare function hashOutsideExecutionStruct(oe: OutsideExecution): bigint;
|
|
1511
1715
|
/**
|
|
1512
|
-
*
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1515
|
-
|
|
1516
|
-
|
|
1716
|
+
* Sign in with Starknet (SIWS): the SNIP-12 equivalent of Sign-In with
|
|
1717
|
+
* Ethereum. The server issues a one-time nonce, the wallet signs this typed
|
|
1718
|
+
* data, and the server checks the signature with the account itself.
|
|
1719
|
+
*
|
|
1720
|
+
* The typed data is kept to what every wallet accepts: SNIP-12 revision 1,
|
|
1721
|
+
* mainnet chain id in the domain, single-line printable ASCII strings (Bramble
|
|
1722
|
+
* refuses anything else), and no custom `u256`.
|
|
1723
|
+
*/
|
|
1724
|
+
declare const SIWS_DOMAIN_NAME = "Sign in with Starknet";
|
|
1725
|
+
declare const SIWS_DOMAIN_VERSION = "1";
|
|
1726
|
+
declare const SIWS_CHAIN_ID = "SN_MAIN";
|
|
1727
|
+
interface StarknetSignInParams {
|
|
1728
|
+
/** Host asking for the sign-in, e.g. "vela-starknet.vercel.app". */
|
|
1729
|
+
domain: string;
|
|
1730
|
+
/** Full URL of the app, e.g. "https://vela-starknet.vercel.app". */
|
|
1731
|
+
uri: string;
|
|
1732
|
+
/** Account that signs. Any padding; stored as 0x + 64 hex. */
|
|
1733
|
+
address: string;
|
|
1734
|
+
/** One-time server nonce (letters and digits). */
|
|
1735
|
+
nonce: string;
|
|
1736
|
+
/** Shown to the user in the wallet. */
|
|
1737
|
+
statement?: string;
|
|
1738
|
+
/** Unix seconds. Defaults to now. */
|
|
1739
|
+
issuedAt?: number;
|
|
1740
|
+
/** Unix seconds. */
|
|
1741
|
+
expirationTime: number;
|
|
1742
|
+
}
|
|
1743
|
+
interface StarknetSignInMessage {
|
|
1744
|
+
domain: string;
|
|
1745
|
+
address: string;
|
|
1746
|
+
statement: string;
|
|
1747
|
+
uri: string;
|
|
1748
|
+
nonce: string;
|
|
1749
|
+
issuedAt: number;
|
|
1750
|
+
expirationTime: number;
|
|
1751
|
+
}
|
|
1752
|
+
/** Typed data for the wallet's `wallet_signTypedData`. */
|
|
1753
|
+
declare function createStarknetSignInTypedData(params: StarknetSignInParams): TypedData;
|
|
1754
|
+
interface VerifyStarknetSignInParams {
|
|
1755
|
+
/** The typed data the wallet signed, as returned to the client. */
|
|
1756
|
+
typedData: TypedData;
|
|
1757
|
+
/** The wallet's `wallet_signTypedData` result (hex or decimal felts). */
|
|
1758
|
+
signature: Array<string | number | bigint>;
|
|
1759
|
+
/** Mainnet RPC (starknet.js `RpcProvider` or anything with `callContract`). */
|
|
1760
|
+
provider: StarknetCallProvider;
|
|
1761
|
+
/** What this server issued. Anything else is refused. */
|
|
1762
|
+
expected: {
|
|
1763
|
+
domain: string;
|
|
1764
|
+
uri: string;
|
|
1765
|
+
nonce: string;
|
|
1766
|
+
now?: number;
|
|
1767
|
+
};
|
|
1768
|
+
/**
|
|
1769
|
+
* The wallet's `wallet_deploymentData`, for accounts not deployed yet
|
|
1770
|
+
* (new Bramble/Ready accounts). Only used when the RPC says the account
|
|
1771
|
+
* does not exist.
|
|
1772
|
+
*/
|
|
1773
|
+
deploymentData?: StarknetDeploymentData;
|
|
1774
|
+
}
|
|
1775
|
+
type StarknetSignInFailure = "MALFORMED" | "WRONG_CHAIN" | "WRONG_DOMAIN" | "WRONG_URI" | "WRONG_NONCE" | "EXPIRED" | "NOT_YET_VALID" | "INVALID_SIGNATURE" | "ACCOUNT_NOT_DEPLOYED" | "UNSUPPORTED_ACCOUNT_CLASS" | "ADDRESS_MISMATCH";
|
|
1776
|
+
type VerifyStarknetSignInResult = {
|
|
1777
|
+
ok: true;
|
|
1778
|
+
address: string;
|
|
1779
|
+
message: StarknetSignInMessage;
|
|
1780
|
+
} | {
|
|
1781
|
+
ok: false;
|
|
1782
|
+
reason: StarknetSignInFailure;
|
|
1783
|
+
};
|
|
1517
1784
|
/**
|
|
1518
|
-
*
|
|
1519
|
-
*
|
|
1520
|
-
*
|
|
1785
|
+
* Verifies a SIWS signature. The typed data is rebuilt from its message with
|
|
1786
|
+
* `createStarknetSignInTypedData`, so a client can't swap in other types or a
|
|
1787
|
+
* testnet domain; then the account is asked with `is_valid_signature`, or, if
|
|
1788
|
+
* it isn't deployed yet and `deploymentData` is given, checked off-chain.
|
|
1789
|
+
*
|
|
1790
|
+
* The caller still owns the nonce: issue it once, and consume it before or
|
|
1791
|
+
* right after calling this (never accept the same nonce twice).
|
|
1521
1792
|
*/
|
|
1522
|
-
declare function
|
|
1793
|
+
declare function verifyStarknetSignIn(params: VerifyStarknetSignInParams): Promise<VerifyStarknetSignInResult>;
|
|
1523
1794
|
|
|
1524
1795
|
/**
|
|
1525
1796
|
* Deterministic ShhhAccount (V8.4) address derivation.
|
|
@@ -1726,6 +1997,128 @@ declare function starkOwnerId(starkPubKey: bigint): bigint;
|
|
|
1726
1997
|
*/
|
|
1727
1998
|
declare function starkPubkeyFelts(starkPubKey: bigint | string): bigint[];
|
|
1728
1999
|
|
|
2000
|
+
/**
|
|
2001
|
+
* STARK_SNIP12 signer for SHHH V8.4 ShhhAccount: Starknet browser wallets
|
|
2002
|
+
* (Bramble, Braavos, Ready/Argent, OpenZeppelin accounts) and Chipi wallets
|
|
2003
|
+
* as co-owners or guardians of a SHHH wallet.
|
|
2004
|
+
*
|
|
2005
|
+
* Why not the `STARK` kind: these wallets never sign a raw hash. Their only
|
|
2006
|
+
* signing method, `wallet_signTypedData`, signs the SNIP-12 message hash,
|
|
2007
|
+
* which always folds in the signing wallet's own address. So the OE hash is
|
|
2008
|
+
* wrapped in an `Approval { Wallet, Hash }` typed data that the wallet signs
|
|
2009
|
+
* as-is, and `StarkSnip12Verifier` rebuilds it on-chain (the Starknet twin of
|
|
2010
|
+
* the EIP-712 verifier MetaMask uses).
|
|
2011
|
+
*
|
|
2012
|
+
* Reference: shhh-wallet-cairo `src/signer/stark_snip12/verifier.cairo` and
|
|
2013
|
+
* `scripts/ts/gen-stark-snip12-fixture.mjs` (same typed data, same hash).
|
|
2014
|
+
*
|
|
2015
|
+
* Pubkey layout: `[stark_pubkey, signer_account_address]`. Payload: `[r, s]`.
|
|
2016
|
+
*/
|
|
2017
|
+
|
|
2018
|
+
declare const STARK_SNIP12_KIND_TAG = "STARK_SNIP12";
|
|
2019
|
+
/**
|
|
2020
|
+
* The typed data the external wallet signs (`wallet_signTypedData`) to
|
|
2021
|
+
* approve the OE whose SNIP-12 hash is `messageHash` on `walletAddress`.
|
|
2022
|
+
* Plain ASCII, revision 1, `chainId` in the domain: Bramble's strict rules.
|
|
2023
|
+
*/
|
|
2024
|
+
declare function starkSnip12ApprovalTypedData(params: {
|
|
2025
|
+
/** The SHHH wallet being approved (the account address). */
|
|
2026
|
+
walletAddress: string;
|
|
2027
|
+
/** SNIP-12 hash of the OutsideExecution (`computeOeHash`). */
|
|
2028
|
+
messageHash: bigint | string;
|
|
2029
|
+
/** Defaults to "SN_MAIN". Hex chain ids are converted. */
|
|
2030
|
+
chainId?: bigint | string;
|
|
2031
|
+
}): TypedData;
|
|
2032
|
+
/** The hash the external wallet's key signs (what the verifier checks). */
|
|
2033
|
+
declare function starkSnip12ApprovalHash(params: {
|
|
2034
|
+
walletAddress: string;
|
|
2035
|
+
messageHash: bigint | string;
|
|
2036
|
+
/** The external wallet's account address. */
|
|
2037
|
+
signerAddress: string;
|
|
2038
|
+
chainId?: bigint | string;
|
|
2039
|
+
}): bigint;
|
|
2040
|
+
/** Pubkey felts for `propose_add_owner` / `initiate_recovery`. */
|
|
2041
|
+
declare function starkSnip12PubkeyFelts(starkPubkey: bigint | string, signerAddress: string): bigint[];
|
|
2042
|
+
/** On-chain owner id commitment for a STARK_SNIP12 owner (dedupe key). */
|
|
2043
|
+
declare function starkSnip12OwnerCommitment(starkPubkey: bigint | string, signerAddress: string): bigint;
|
|
2044
|
+
/** What a wallet returned from `wallet_signTypedData`, split into its parts. */
|
|
2045
|
+
interface ParsedStarknetWalletSignature {
|
|
2046
|
+
r: bigint;
|
|
2047
|
+
s: bigint;
|
|
2048
|
+
/** Argent / Ready include the signer's public key. */
|
|
2049
|
+
pubkey?: bigint;
|
|
2050
|
+
/** A Chipi (SHHH) wallet returns its own V2_SNIP12 envelope: the owner index. */
|
|
2051
|
+
shhhOwnerId?: bigint;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Reads the signature shapes Starknet wallets return:
|
|
2055
|
+
* - `[r, s]`: OpenZeppelin (Bramble), Braavos with a STARK signer;
|
|
2056
|
+
* - `[1, 0, pubkey, r, s]`: Argent / Ready (one Starknet signer);
|
|
2057
|
+
* - `[V2_SNIP12, owner_id, 'STARK', r, s]`: a Chipi (SHHH) wallet.
|
|
2058
|
+
* Anything else (multisig, hardware or webauthn signers) is refused.
|
|
2059
|
+
*/
|
|
2060
|
+
declare function parseStarknetWalletSignature(signature: Array<string | number | bigint>): ParsedStarknetWalletSignature;
|
|
2061
|
+
/** Off-chain check of an approval signature, before relaying it. */
|
|
2062
|
+
declare function verifyStarkSnip12Approval(params: {
|
|
2063
|
+
walletAddress: string;
|
|
2064
|
+
messageHash: bigint | string;
|
|
2065
|
+
signerAddress: string;
|
|
2066
|
+
starkPubkey: bigint | string;
|
|
2067
|
+
signature: Array<string | number | bigint>;
|
|
2068
|
+
chainId?: bigint | string;
|
|
2069
|
+
}): boolean;
|
|
2070
|
+
/**
|
|
2071
|
+
* The V2_SNIP12 envelope for a STARK_SNIP12 owner: pass the wallet's raw
|
|
2072
|
+
* `wallet_signTypedData` result; it is normalized to `[r, s]`.
|
|
2073
|
+
*/
|
|
2074
|
+
declare function buildStarkSnip12Envelope(params: {
|
|
2075
|
+
signature: Array<string | number | bigint>;
|
|
2076
|
+
/** u32 index of this owner in the SHHH wallet's owner_set. */
|
|
2077
|
+
ownerIndex: bigint;
|
|
2078
|
+
}): bigint[];
|
|
2079
|
+
/**
|
|
2080
|
+
* Which STARK key signs for `signerAddress`, proven by an approval signature
|
|
2081
|
+
* the wallet just produced (e.g. for the "add trusted wallet" step). Sources,
|
|
2082
|
+
* in order:
|
|
2083
|
+
* - Argent / Ready: the key inside the signature;
|
|
2084
|
+
* - Chipi (SHHH) wallet: the key whose commitment matches `get_owner(id)`;
|
|
2085
|
+
* - an undeployed account: `wallet_deploymentData` (OpenZeppelin, Argent 0.4);
|
|
2086
|
+
* - OpenZeppelin (Bramble): `get_public_key`;
|
|
2087
|
+
* - Braavos: `get_signers` (STARK only, no hardware or webauthn signers).
|
|
2088
|
+
* The chosen key must verify the approval, or this throws.
|
|
2089
|
+
*/
|
|
2090
|
+
declare function resolveStarkSnip12Signer(params: {
|
|
2091
|
+
provider: StarknetCallProvider;
|
|
2092
|
+
signerAddress: string;
|
|
2093
|
+
walletAddress: string;
|
|
2094
|
+
messageHash: bigint | string;
|
|
2095
|
+
signature: Array<string | number | bigint>;
|
|
2096
|
+
deploymentData?: StarknetDeploymentData;
|
|
2097
|
+
chainId?: bigint | string;
|
|
2098
|
+
}): Promise<{
|
|
2099
|
+
starkPubkey: bigint;
|
|
2100
|
+
pubkeyFelts: bigint[];
|
|
2101
|
+
}>;
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* Whether a SHHH verifier class is declared on the network. A wallet can
|
|
2105
|
+
* register a kind whose class is not declared (`propose_add_verifier_class`
|
|
2106
|
+
* stores only the hash), and every signature of that kind would then fail.
|
|
2107
|
+
* Check before proposing a kind that is new on the network, such as
|
|
2108
|
+
* `STARK_SNIP12` before its mainnet declare.
|
|
2109
|
+
*/
|
|
2110
|
+
|
|
2111
|
+
/** Anything with a starknet.js-style `getClassByHash` (e.g. `RpcProvider`). */
|
|
2112
|
+
interface StarknetClassProvider {
|
|
2113
|
+
getClassByHash(classHash: string): Promise<unknown>;
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* `true` when the verifier class for `kind` (or `classHash`) is declared,
|
|
2117
|
+
* `false` when the RPC answers CLASS_HASH_NOT_FOUND (28). Other RPC errors
|
|
2118
|
+
* are thrown: an outage is not "not declared".
|
|
2119
|
+
*/
|
|
2120
|
+
declare function isShhhVerifierDeclared(provider: StarknetClassProvider, kind: ShhhSignerKind, classHash?: string): Promise<boolean>;
|
|
2121
|
+
|
|
1729
2122
|
/**
|
|
1730
2123
|
* Ed25519 signer for SHHH V8.4 ShhhAccount.
|
|
1731
2124
|
*
|
|
@@ -2265,9 +2658,10 @@ declare function buildJwtAppleSubEnvelopeFromTestKey(params: {
|
|
|
2265
2658
|
*
|
|
2266
2659
|
* Wave B PR B1. The V8.4 ShhhAccount gates every owner-set mutation
|
|
2267
2660
|
* through a propose → wait-timelock → execute flow (`@external` fns
|
|
2268
|
-
* in `src/account.cairo`).
|
|
2269
|
-
* which means callers wrap these `Call`s inside
|
|
2270
|
-
* submit through the paymaster
|
|
2661
|
+
* in `src/account.cairo`). The propose and cancel entrypoints are
|
|
2662
|
+
* `_assert_self_call`-gated, which means callers wrap these `Call`s inside
|
|
2663
|
+
* an OutsideExecution and submit through the paymaster (see below for the
|
|
2664
|
+
* permissionless ones).
|
|
2271
2665
|
*
|
|
2272
2666
|
* This module produces the `Call` (`{ contractAddress, entrypoint,
|
|
2273
2667
|
* calldata }`) shape that `oe.ts:buildOutsideExecution` expects. It
|
|
@@ -2304,11 +2698,15 @@ declare function buildJwtAppleSubEnvelopeFromTestKey(params: {
|
|
|
2304
2698
|
* but does not remove existing ones. The integrator's UI is expected
|
|
2305
2699
|
* to follow with `propose_remove_owner` for stale devices.
|
|
2306
2700
|
*
|
|
2307
|
-
*
|
|
2308
|
-
*
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2701
|
+
* Not every entrypoint here is `_assert_self_call`-gated. The
|
|
2702
|
+
* propose_* calls, cancel_pending_op, initiate_recovery and
|
|
2703
|
+
* cancel_recovery are (they need an OE signed by an owner, or by a
|
|
2704
|
+
* guardian for a single-call initiate_recovery). Every execute_* call
|
|
2705
|
+
* and finalize_recovery are permissionless once their timelock has
|
|
2706
|
+
* elapsed: anyone can submit them, directly or inside an owner's OE, because
|
|
2707
|
+
* the wallet re-checks the stored payload commitment. The builders still
|
|
2708
|
+
* return a Call so the integrator can dispatch via their normal account
|
|
2709
|
+
* abstraction layer.
|
|
2312
2710
|
*/
|
|
2313
2711
|
|
|
2314
2712
|
/** `src/owner_set/interface.cairo:10` — `pub const ROLE_OWNER: felt252 = 'OWNER'`. */
|
|
@@ -2320,6 +2718,8 @@ declare const OP_ADD_OWNER: bigint;
|
|
|
2320
2718
|
declare const OP_REMOVE_OWNER: bigint;
|
|
2321
2719
|
declare const OP_ROTATE_OWNER: bigint;
|
|
2322
2720
|
declare const OP_SET_THRESHOLD: bigint;
|
|
2721
|
+
/** `src/governance/pending_ops.cairo:23` — `OP_ADD_VERIFIER_CLASS: felt252 = 'ADD_VERIFIER'`. */
|
|
2722
|
+
declare const OP_ADD_VERIFIER_CLASS: bigint;
|
|
2323
2723
|
/**
|
|
2324
2724
|
* Per-op timelocks in seconds. Match `src/governance/pending_ops.cairo:42-50`
|
|
2325
2725
|
* exactly. Exposed so SDK consumers can predict timelock expiry without
|
|
@@ -2339,11 +2739,16 @@ declare const TIMELOCK_SECONDS: {
|
|
|
2339
2739
|
/** `DEFAULT_OP_EXPIRY_SECONDS` from `pending_ops.cairo:78`. The window is
|
|
2340
2740
|
* measured from `valid_after`, not from propose time:
|
|
2341
2741
|
* `expires_at = now + timelock + DEFAULT_OP_EXPIRY_SECONDS`
|
|
2342
|
-
* (governance/component.cairo). So a 48h op (add_owner, set_threshold
|
|
2343
|
-
* 16 days from propose and a
|
|
2742
|
+
* (governance/component.cairo). So a 48h op (add_owner, set_threshold,
|
|
2743
|
+
* add_verifier) lives 16 days from propose and a 24h op 15. Read
|
|
2744
|
+
* `get_pending_op` (or the `OpProposed` event, `parseOpProposedEvents`) for
|
|
2344
2745
|
* the exact `expires_at` instead of adding 14d to the propose timestamp. The
|
|
2345
2746
|
* op auto-expires at that point even if no one calls cancel; UI should
|
|
2346
|
-
* reflect it so users don't sit on a stale op.
|
|
2747
|
+
* reflect it so users don't sit on a stale op.
|
|
2748
|
+
*
|
|
2749
|
+
* Recovery is not a pending op and has no expiry: an initiated recovery
|
|
2750
|
+
* stays pending until an owner cancels it or anyone finalizes it after the
|
|
2751
|
+
* 7d timelock. */
|
|
2347
2752
|
declare const DEFAULT_OP_EXPIRY_SECONDS = 1209600;
|
|
2348
2753
|
/** Owner role on-chain. ROLE_OWNER can sign OEs; ROLE_GUARDIAN can
|
|
2349
2754
|
* only `initiate_recovery` (no general signing power). */
|
|
@@ -2429,6 +2834,32 @@ declare function buildCancelPendingOpCall(args: {
|
|
|
2429
2834
|
walletAddress: bigint | string;
|
|
2430
2835
|
opId: bigint | string;
|
|
2431
2836
|
}): Call;
|
|
2837
|
+
/**
|
|
2838
|
+
* Build a `propose_add_verifier_class(proposer, kind, class_hash)` call.
|
|
2839
|
+
*
|
|
2840
|
+
* A wallet only verifies the kinds in its `verifier_classes` map; a Chipi
|
|
2841
|
+
* passkey wallet starts with `STARK` only. To add an owner or guardian of
|
|
2842
|
+
* another kind (e.g. `STARK_SNIP12` for Bramble), put this call and
|
|
2843
|
+
* `buildProposeAddOwnerCall` in the same owner-signed OE, wait 48h, then
|
|
2844
|
+
* run `buildExecuteAddVerifierClassCall` BEFORE `buildExecuteAddOwnerCall`
|
|
2845
|
+
* (execute_add_owner validates the new pubkey through the verifier).
|
|
2846
|
+
* Reverts with `'SHHH: verifier already set'` if the kind is registered;
|
|
2847
|
+
* check `readVerifierClass` first.
|
|
2848
|
+
*/
|
|
2849
|
+
declare function buildProposeAddVerifierClassCall(args: {
|
|
2850
|
+
walletAddress: bigint | string;
|
|
2851
|
+
proposer: number;
|
|
2852
|
+
kind: ShhhSignerKind;
|
|
2853
|
+
/** Defaults to `SHHH_VERIFIER_CLASS_HASHES[kind]`. */
|
|
2854
|
+
classHash?: bigint | string;
|
|
2855
|
+
}): Call;
|
|
2856
|
+
/** Build an `execute_add_verifier_class(op_id, kind, class_hash)` call (permissionless after 48h). */
|
|
2857
|
+
declare function buildExecuteAddVerifierClassCall(args: {
|
|
2858
|
+
walletAddress: bigint | string;
|
|
2859
|
+
opId: bigint | string;
|
|
2860
|
+
kind: ShhhSignerKind;
|
|
2861
|
+
classHash?: bigint | string;
|
|
2862
|
+
}): Call;
|
|
2432
2863
|
/**
|
|
2433
2864
|
* Build an `initiate_recovery(proposer, new_owner_kind, new_pubkey_bytes,
|
|
2434
2865
|
* new_role, new_weight, new_label)` call.
|
|
@@ -2506,6 +2937,51 @@ declare function isReadyToExecute(validAfterSecs: number | bigint, nowSecs: numb
|
|
|
2506
2937
|
* `number` seconds — truncates via floor.
|
|
2507
2938
|
*/
|
|
2508
2939
|
declare function secondsUntilExecutable(validAfterSecs: number | bigint, nowSecs: number): number;
|
|
2940
|
+
/** One entry of a wallet's owner_set (`get_owner`). */
|
|
2941
|
+
interface ShhhOwnerRecord {
|
|
2942
|
+
/** u32 index: what `owner_id` means in envelopes and governance calls. */
|
|
2943
|
+
ownerId: number;
|
|
2944
|
+
kind: string;
|
|
2945
|
+
/** poseidon(kind, pubkey...) — compare with `ownerCommitment`. */
|
|
2946
|
+
pubkeyHash: bigint;
|
|
2947
|
+
role: "OWNER" | "GUARDIAN" | "RECOVERY_ONLY" | string;
|
|
2948
|
+
weight: number;
|
|
2949
|
+
addedAt: number;
|
|
2950
|
+
label: string;
|
|
2951
|
+
revoked: boolean;
|
|
2952
|
+
}
|
|
2953
|
+
/** A governance op from an `OpProposed` event. */
|
|
2954
|
+
interface ShhhProposedOp {
|
|
2955
|
+
opId: bigint;
|
|
2956
|
+
opKind: string;
|
|
2957
|
+
proposer: number;
|
|
2958
|
+
payload: bigint;
|
|
2959
|
+
validAfter: number;
|
|
2960
|
+
expiresAt: number;
|
|
2961
|
+
}
|
|
2962
|
+
/** `get_pending_recovery` decoded. */
|
|
2963
|
+
interface ShhhPendingRecovery {
|
|
2964
|
+
initiatedAt: number;
|
|
2965
|
+
validAfter: number;
|
|
2966
|
+
newOwnerHash: bigint;
|
|
2967
|
+
isActive: boolean;
|
|
2968
|
+
}
|
|
2969
|
+
/** Every owner and guardian of a SHHH wallet, revoked ones included (ids stay stable). */
|
|
2970
|
+
declare function readShhhOwners(provider: StarknetCallProvider, walletAddress: bigint | string): Promise<ShhhOwnerRecord[]>;
|
|
2971
|
+
/** The class hash registered for `kind` on this wallet, or 0n if none. */
|
|
2972
|
+
declare function readVerifierClass(provider: StarknetCallProvider, walletAddress: bigint | string, kind: ShhhSignerKind): Promise<bigint>;
|
|
2973
|
+
/** The wallet's pending recovery (`isActive: false` when there is none). */
|
|
2974
|
+
declare function readPendingRecovery(provider: StarknetCallProvider, walletAddress: bigint | string): Promise<ShhhPendingRecovery>;
|
|
2975
|
+
/**
|
|
2976
|
+
* Governance ops proposed in a transaction, from its receipt events. The
|
|
2977
|
+
* op_id mixes in the block timestamp and a counter, so it can only be read
|
|
2978
|
+
* back after the propose lands: pass `receipt.events` here.
|
|
2979
|
+
*/
|
|
2980
|
+
declare function parseOpProposedEvents(events: Array<{
|
|
2981
|
+
from_address?: string;
|
|
2982
|
+
keys: string[];
|
|
2983
|
+
data: string[];
|
|
2984
|
+
}>, walletAddress?: bigint | string): ShhhProposedOp[];
|
|
2509
2985
|
|
|
2510
2986
|
/**
|
|
2511
2987
|
* SHHH V8.4 threshold envelope assembly + gas estimation.
|
|
@@ -2532,11 +3008,12 @@ declare function secondsUntilExecutable(validAfterSecs: number | bigint, nowSecs
|
|
|
2532
3008
|
* ...env_n,
|
|
2533
3009
|
* ]
|
|
2534
3010
|
*
|
|
2535
|
-
* Each inner
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
*
|
|
2539
|
-
*
|
|
3011
|
+
* Each inner frame is `[owner_id, kind_tag, ...payload]`: a single-owner
|
|
3012
|
+
* envelope WITHOUT its V2_SNIP12 tag, which the outer V2_THRESHOLD tag
|
|
3013
|
+
* replaces (`_verify_sub_envelope` reads `owner_id` at index 0). Callers
|
|
3014
|
+
* still pass the per-kind builders' V2_SNIP12 envelopes; the builder strips
|
|
3015
|
+
* the tag and `parseThresholdEnvelope` puts it back. Nested threshold
|
|
3016
|
+
* envelopes are not permitted.
|
|
2540
3017
|
*
|
|
2541
3018
|
* Cairo-enforced invariants this module replicates client-side so
|
|
2542
3019
|
* mis-shaped envelopes fail at the SDK boundary with a clear message
|
|
@@ -2589,7 +3066,8 @@ declare function buildThresholdEnvelope(args: {
|
|
|
2589
3066
|
}): bigint[];
|
|
2590
3067
|
/**
|
|
2591
3068
|
* Split a V2_THRESHOLD envelope back into its constituent inner
|
|
2592
|
-
* V2_SNIP12 envelopes. Inverse of
|
|
3069
|
+
* V2_SNIP12 envelopes (the tag is restored on each frame). Inverse of
|
|
3070
|
+
* `buildThresholdEnvelope`.
|
|
2593
3071
|
*
|
|
2594
3072
|
* Useful for UI flows that need to display "N of M signers signed
|
|
2595
3073
|
* so far" status without re-deriving from individual envelopes. Also
|
|
@@ -3049,4 +3527,4 @@ declare class ShhhAccount {
|
|
|
3049
3527
|
*/
|
|
3050
3528
|
declare function submitViaAccount(funded: Account): ShhhSubmit;
|
|
3051
3529
|
|
|
3052
|
-
export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, type ApproveBody, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiAi, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiTreasury, ChipiWallets, type ComputeAddressInput, type ContractEventLog, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, type ExecuteResult, type ForTreasuryConfig, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, type ListTreasuriesOptions, type ListTreasuriesResult, 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, SessionTxVerifier, type SessionTxVerifierConfig, type SetTreasuryPolicyOptions, ShhhAccount, type ShhhAccountOptions, type ShhhExecuteOptions, type ShhhSignedExecution, type ShhhSubmit, type ShhhX402Wallet, TIMELOCK_SECONDS, type TreasuryPolicy, type TreasuryProposal, type TreasuryProposalSignature, type TreasurySummary, type TreasuryTransport, type TxHashStore, VIEW_SELECTORS, type VerifyTransferFailure, type VerifyTransferParams, type VerifyTransferResult, type WaitForTransactionOptions, type WaitForTransactionResult, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildAddSessionKeyCall, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildRemoveSpendingPolicyCall, buildRevokeSessionKeyCall, buildSessionSetupCalls, buildSetSpendingPolicyCall, 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, isThinkDecision, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, normalizeEntrypoints, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, signTypedDataArray, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, submitViaAccount, validateSpendingPolicyConfig, waitForTransaction, webauthnOwnerId, webauthnOwnerPubkeyParam, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
|
|
3530
|
+
export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, type ApproveBody, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, COUNTERFACTUAL_ACCOUNT_CLASSES, ChipiAi, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiTreasury, ChipiWallets, type ComputeAddressInput, type ContractEventLog, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, type ExecuteResult, type ForTreasuryConfig, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, type ListTreasuriesOptions, type ListTreasuriesResult, 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_ADD_VERIFIER_CLASS, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, type ParsedStarknetWalletSignature, type PreparedExternalOwnerExecution, type ProposeBody, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, SIWS_CHAIN_ID, SIWS_DOMAIN_NAME, SIWS_DOMAIN_VERSION, STARKNET_MESSAGE_PREFIX, STARKNET_SIGNATURE_VALID, STARK_SNIP12_KIND_TAG, SessionTxVerifier, type SessionTxVerifierConfig, type SetTreasuryPolicyOptions, ShhhAccount, type ShhhAccountOptions, type ShhhExecuteOptions, type ShhhOwnerRecord, type ShhhPendingRecovery, type ShhhProposedOp, type ShhhSignedExecution, type ShhhSubmit, type ShhhX402Wallet, type StarknetCallProvider, type StarknetClassProvider, type StarknetDeploymentData, type StarknetSignInFailure, type StarknetSignInMessage, type StarknetSignInParams, type StarknetSignatureCheck, TIMELOCK_SECONDS, type TreasuryPolicy, type TreasuryProposal, type TreasuryProposalSignature, type TreasurySummary, type TreasuryTransport, type TxHashStore, type UndeployedSignatureCheck, VIEW_SELECTORS, type VerifyStarknetSignInParams, type VerifyStarknetSignInResult, type VerifyTransferFailure, type VerifyTransferParams, type VerifyTransferResult, type WaitForTransactionOptions, type WaitForTransactionResult, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildAddSessionKeyCall, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteAddVerifierClassCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeAddVerifierClassCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildRemoveSpendingPolicyCall, buildRevokeSessionKeyCall, buildSessionSetupCalls, buildSetSpendingPolicyCall, buildStarkEnvelope, buildStarkSnip12Envelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, createStarknetSignInTypedData, decryptPrivateKey, ed25519OwnerId, ed25519OwnerPubkeyParam, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191OwnerPubkeyParam, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, executeShhhWithExternalSigner, executeShhhWithStarkKey, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, isShhhVerifierDeclared, isThinkDecision, isValidStarknetSignature, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, normalizeEntrypoints, normalizeStarknetAddress, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseOpProposedEvents, parseStarknetWalletSignature, parseThresholdEnvelope, prepareExternalOwnerExecution, readPendingRecovery, readShhhOwners, readVerifierClass, resolveShhhChainId, resolveStarkSnip12Signer, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, signTypedDataArray, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, starkSnip12ApprovalHash, starkSnip12ApprovalTypedData, starkSnip12OwnerCommitment, starkSnip12PubkeyFelts, submitExternalOwnerExecution, submitViaAccount, validateSpendingPolicyConfig, verifyStarkSnip12Approval, verifyStarknetSignIn, verifyUndeployedStarknetSignature, waitForTransaction, webauthnOwnerId, webauthnOwnerPubkeyParam, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
|