@naculus/connect-appkit-core 0.2.4 → 0.2.6
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.cjs +976 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +388 -2
- package/dist/index.d.ts +388 -2
- package/dist/index.js +935 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, NameResolverConfig, NameResolver } from '@naculus/connect-core';
|
|
1
|
+
import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, SessionKeyScope, ScopeCheckResult } from '@naculus/connect-core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The types the framework-neutral half of appkit is built on.
|
|
@@ -362,6 +362,13 @@ declare function createDecimalsCache(token: TokenIdentity, known?: number): Deci
|
|
|
362
362
|
declare function readDecimals(cache: DecimalsCache, token: TokenIdentity, known?: number): number | undefined;
|
|
363
363
|
declare function writeDecimals(cache: DecimalsCache, token: TokenIdentity, value: number): void;
|
|
364
364
|
|
|
365
|
+
/** Encode ERC-20 transfer(address,uint256), without signing or broadcasting. */
|
|
366
|
+
declare function encodeErc20Transfer(to: string, amount: bigint): `0x${string}`;
|
|
367
|
+
/** Encode ERC-20 approve(address,uint256), without signing or broadcasting. */
|
|
368
|
+
declare function encodeErc20Approve(spender: string, amount: bigint): `0x${string}`;
|
|
369
|
+
/** Encode ERC-20 transferFrom(address,address,uint256), without signing or broadcasting. */
|
|
370
|
+
declare function encodeErc20TransferFrom(from: string, to: string, amount: bigint): `0x${string}`;
|
|
371
|
+
|
|
365
372
|
/**
|
|
366
373
|
* Normalize an EIP-1193 provider error into a WalletError.
|
|
367
374
|
*
|
|
@@ -407,6 +414,44 @@ declare function decodeRevertReason(data: unknown): string | undefined;
|
|
|
407
414
|
/** Decoded reason if available, otherwise the node's own message. */
|
|
408
415
|
declare function resolveRevertReason(data: unknown, fallbackMessage: string): string;
|
|
409
416
|
|
|
417
|
+
/** Resolve a simulation target without ever guessing a default chain. */
|
|
418
|
+
declare function resolveSimulationEndpoint(requestedChainId: number | undefined, fallbackChainId: number | undefined, requestedRpcUrl?: string, fallbackRpcUrl?: string): {
|
|
419
|
+
chainId: number;
|
|
420
|
+
rpcUrl: string | undefined;
|
|
421
|
+
};
|
|
422
|
+
/** Resolve the chain from an explicit override or CAIP-2 chain context. */
|
|
423
|
+
declare function resolveContextSimulationEndpoint(requestedChainId: number | undefined, currentChain: WalletChain | null | undefined): {
|
|
424
|
+
chainId: number;
|
|
425
|
+
rpcUrl: string | undefined;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
interface SimulationTransaction {
|
|
429
|
+
to: string;
|
|
430
|
+
value?: string;
|
|
431
|
+
data?: string;
|
|
432
|
+
gas?: string;
|
|
433
|
+
}
|
|
434
|
+
interface SimulationCallClient {
|
|
435
|
+
chain?: {
|
|
436
|
+
id: number;
|
|
437
|
+
};
|
|
438
|
+
call(args: {
|
|
439
|
+
to: `0x${string}`;
|
|
440
|
+
data: `0x${string}`;
|
|
441
|
+
value: bigint;
|
|
442
|
+
from?: `0x${string}`;
|
|
443
|
+
}): Promise<unknown>;
|
|
444
|
+
}
|
|
445
|
+
interface TransactionSimulationContext {
|
|
446
|
+
chainId?: number;
|
|
447
|
+
currentChain?: WalletChain | null;
|
|
448
|
+
publicClient?: SimulationCallClient | null;
|
|
449
|
+
evmAccount?: string | null;
|
|
450
|
+
fetcher?: typeof fetch;
|
|
451
|
+
}
|
|
452
|
+
/** Basic revert check only: never claims asset changes or risk coverage. */
|
|
453
|
+
declare function simulateTransactionPreview(tx: SimulationTransaction | undefined, context: TransactionSimulationContext): Promise<SimulationResult>;
|
|
454
|
+
|
|
410
455
|
/**
|
|
411
456
|
* Shared NameResolver instance for the name-resolution hooks.
|
|
412
457
|
*
|
|
@@ -425,6 +470,315 @@ declare function getResolver(config?: NameResolverConfig): NameResolver;
|
|
|
425
470
|
/** Test seam: drop the shared instance. */
|
|
426
471
|
declare function __resetResolverForTests(): void;
|
|
427
472
|
|
|
473
|
+
/** Framework-neutral in-app notification actions and settings persistence. */
|
|
474
|
+
|
|
475
|
+
interface NotificationSettingsStorage {
|
|
476
|
+
getItem<T>(key: string): Promise<T | null>;
|
|
477
|
+
setItem<T>(key: string, value: T): Promise<void>;
|
|
478
|
+
removeItem(key: string): Promise<void>;
|
|
479
|
+
}
|
|
480
|
+
declare const NOTIFICATION_SETTINGS_KEY = "naculus_notif_react_settings";
|
|
481
|
+
declare const DEFAULT_NOTIFICATION_SETTINGS: NotificationSettings;
|
|
482
|
+
/** Preserve the existing localStorage adapter and fail-open UI fallback. */
|
|
483
|
+
declare function createNotificationSettingsStorage(): NotificationSettingsStorage;
|
|
484
|
+
declare function loadNotificationSettings(storage: NotificationSettingsStorage): Promise<NotificationSettings | null>;
|
|
485
|
+
declare function saveNotificationSettings(storage: NotificationSettingsStorage, settings: NotificationSettings): void;
|
|
486
|
+
declare function updateNotificationSettings(current: NotificationSettings, update: Partial<NotificationSettings>): NotificationSettings;
|
|
487
|
+
declare function channelsUpdate(channels: string[]): Partial<NotificationSettings>;
|
|
488
|
+
declare function mutedChainSettings(settings: NotificationSettings, chainId: string, muted: boolean): Partial<NotificationSettings>;
|
|
489
|
+
declare function createNotification(item: Omit<NotificationItem, "id" | "timestamp">): NotificationItem;
|
|
490
|
+
declare function addInAppNotification(channel: InAppChannel, item: Omit<NotificationItem, "id" | "timestamp">): void;
|
|
491
|
+
/** InAppChannel has no remove-one method; preserve its clear/replay behavior. */
|
|
492
|
+
declare function clearOneInAppNotification(channel: InAppChannel, id: string): Promise<NotificationItem[]>;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Destination-address checks shared by the React hook and the Vue composable.
|
|
496
|
+
*
|
|
497
|
+
* Syntactic only. `"ok"` means none of these checks found anything wrong —
|
|
498
|
+
* not that the recipient is who the user thinks. This cannot see an
|
|
499
|
+
* address-poisoning lookalike, a contract that will not release the funds,
|
|
500
|
+
* or a known-malicious destination. Labelling that "safe" once put a green
|
|
501
|
+
* tick beside a scammer's address; the level is deliberately not "safe".
|
|
502
|
+
*/
|
|
503
|
+
type AddressValidationLevel = "ok" | "warning" | "blocked";
|
|
504
|
+
/** Machine-readable reason; the framework layer maps it to a user string. */
|
|
505
|
+
type DestinationIssue = "empty" | "invalid_format" | "zero_address" | "burn_address";
|
|
506
|
+
interface DestinationValidation {
|
|
507
|
+
isValid: boolean;
|
|
508
|
+
level: AddressValidationLevel;
|
|
509
|
+
issue: DestinationIssue | null;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Burn heuristic kept from the React hook: known sinks plus any well-formed
|
|
513
|
+
* address containing "dead". Stricter than connect-core's prefix-only
|
|
514
|
+
* `isBurnAddress`; unifying the two is a connect-lib change.
|
|
515
|
+
*/
|
|
516
|
+
declare function isBurnDestination(address: string): boolean;
|
|
517
|
+
declare function validateDestination(address: string): DestinationValidation;
|
|
518
|
+
/**
|
|
519
|
+
* The bare `0x…` account from either a CAIP-10 id (`eip155:1:0x…`) or a plain
|
|
520
|
+
* hex address; null when it is neither. Hooks and composables should not each
|
|
521
|
+
* carry their own copy of this split.
|
|
522
|
+
*/
|
|
523
|
+
declare function bareEvmAddress(account: string | null | undefined): `0x${string}` | null;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Chain-abstraction (routing) domain types and the few decisions the React
|
|
527
|
+
* hooks and Vue composables share. The hooks inject the actual quote /
|
|
528
|
+
* compare / execute functions; nothing here talks to a network.
|
|
529
|
+
*/
|
|
530
|
+
interface RouteQuote {
|
|
531
|
+
routeId: string;
|
|
532
|
+
provider: string;
|
|
533
|
+
netReceiveFormatted: string;
|
|
534
|
+
toTokenSymbol: string;
|
|
535
|
+
}
|
|
536
|
+
interface RouteQuoteOptions {
|
|
537
|
+
sortBy?: "cost" | "time" | "balance";
|
|
538
|
+
maxSlippage?: number;
|
|
539
|
+
}
|
|
540
|
+
interface RouteQuoteInput {
|
|
541
|
+
fromChain: string;
|
|
542
|
+
toChain: string;
|
|
543
|
+
fromToken: string;
|
|
544
|
+
toToken?: string;
|
|
545
|
+
amount: string;
|
|
546
|
+
options?: RouteQuoteOptions;
|
|
547
|
+
}
|
|
548
|
+
type GetRouteQuotes = (from: string, to: string, token: string, amount: string, options?: RouteQuoteOptions, toToken?: string) => Promise<RouteQuote[]>;
|
|
549
|
+
/**
|
|
550
|
+
* `BigInt()` throws on anything that is not a decimal integer — "1.5", "abc",
|
|
551
|
+
* "1e18" — so a user typing into an amount field must not reach it. Only a
|
|
552
|
+
* positive base-unit integer is a quotable amount.
|
|
553
|
+
*/
|
|
554
|
+
declare function isPositiveIntegerAmount(amount: string): boolean;
|
|
555
|
+
/** True when every field a quote needs is present and the amount is quotable. */
|
|
556
|
+
declare function isQuotableInput(input: RouteQuoteInput): boolean;
|
|
557
|
+
interface CostComparison {
|
|
558
|
+
chain: string;
|
|
559
|
+
chainName: string;
|
|
560
|
+
totalCost: string;
|
|
561
|
+
gasCost: string;
|
|
562
|
+
estimatedTimeMs: number;
|
|
563
|
+
}
|
|
564
|
+
type CostComparisonOperation = "send_erc20" | "swap" | "bridge" | (string & {});
|
|
565
|
+
interface CostComparisonOptions {
|
|
566
|
+
amount?: string;
|
|
567
|
+
token?: string;
|
|
568
|
+
[key: string]: unknown;
|
|
569
|
+
}
|
|
570
|
+
interface CompareCostsInput {
|
|
571
|
+
operation: CostComparisonOperation;
|
|
572
|
+
chains: string[];
|
|
573
|
+
options?: CostComparisonOptions;
|
|
574
|
+
}
|
|
575
|
+
type CompareCosts = (operation: string, chains: string[], options?: CostComparisonOptions) => Promise<CostComparison[]>;
|
|
576
|
+
/**
|
|
577
|
+
* Value key for a compare-costs input. `chains` is an array and `options` an
|
|
578
|
+
* object; keying on identity re-fired the fetch on every render/reactive tick
|
|
579
|
+
* for a caller writing the natural inline literal — an unbounded loop against
|
|
580
|
+
* a cost API.
|
|
581
|
+
*/
|
|
582
|
+
declare function compareCostsKey(input: CompareCostsInput): string;
|
|
583
|
+
interface ExecutableQuote {
|
|
584
|
+
routeId: string;
|
|
585
|
+
provider: string;
|
|
586
|
+
totalCost?: bigint;
|
|
587
|
+
estimatedTimeMs?: number;
|
|
588
|
+
toChain?: string;
|
|
589
|
+
}
|
|
590
|
+
interface ExecuteRouteResult {
|
|
591
|
+
fromTxHash: string;
|
|
592
|
+
toTxHash?: string;
|
|
593
|
+
}
|
|
594
|
+
interface ExecuteRouteOptions {
|
|
595
|
+
timeoutMs?: number;
|
|
596
|
+
gasLimit?: bigint;
|
|
597
|
+
}
|
|
598
|
+
interface ExecuteRouteError {
|
|
599
|
+
code: string;
|
|
600
|
+
message: string;
|
|
601
|
+
details?: Record<string, unknown>;
|
|
602
|
+
}
|
|
603
|
+
type ExecuteRoute = (quote: ExecutableQuote, recipient: string, options?: ExecuteRouteOptions) => Promise<ExecuteRouteResult>;
|
|
604
|
+
/**
|
|
605
|
+
* Recipient check before a cross-chain execution. An empty recipient is wrong
|
|
606
|
+
* on every chain. Beyond that the destination namespace decides: when the
|
|
607
|
+
* quote names `toChain`, the address is validated for that namespace; when it
|
|
608
|
+
* does not, this returns null and the executor decides, rather than rejecting
|
|
609
|
+
* a valid non-EVM address on a guess.
|
|
610
|
+
*/
|
|
611
|
+
declare function validateRouteRecipient(quote: ExecutableQuote | null | undefined, recipient: string): ExecuteRouteError | null;
|
|
612
|
+
/** Normalise whatever an executor threw into the hook's error shape. */
|
|
613
|
+
declare function toExecuteRouteError(cause: unknown): ExecuteRouteError;
|
|
614
|
+
|
|
615
|
+
/** The subset of the config that changes what a key may spend or how it is sealed. */
|
|
616
|
+
declare function sessionKeyConfigFingerprint(config?: SessionKeyManagerConfig): string;
|
|
617
|
+
declare function getSharedSessionKeyManager(config?: SessionKeyManagerConfig): SessionKeyManager;
|
|
618
|
+
/** Drop the shared instance. For tests and for a full sign-out that must forget keys. */
|
|
619
|
+
declare function resetSharedSessionKeyManager(): void;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Validation of an ERC-4337 `eth_getUserOperationReceipt` result, shared by
|
|
623
|
+
* the React hook and the Vue composable. A bundler is an untrusted party:
|
|
624
|
+
* every field is checked, the hash must match the one asked for, and a
|
|
625
|
+
* malformed receipt is refused instead of banked as a confirmation.
|
|
626
|
+
*/
|
|
627
|
+
declare class InvalidUserOperationReceiptError extends Error {
|
|
628
|
+
constructor(message: string);
|
|
629
|
+
}
|
|
630
|
+
declare function parseUserOperationReceipt(value: unknown, expectedHash: Hex): UserOperationReceipt;
|
|
631
|
+
/**
|
|
632
|
+
* One `eth_getUserOperationReceipt` call. Resolves to the validated receipt,
|
|
633
|
+
* or null while the operation is not yet included. HTTP and JSON-RPC
|
|
634
|
+
* failures throw a plain Error (retryable); a malformed receipt throws
|
|
635
|
+
* InvalidUserOperationReceiptError (not retryable — the bundler is lying).
|
|
636
|
+
*/
|
|
637
|
+
declare function fetchUserOperationReceipt(bundlerUrl: string, hash: Hex, signal?: AbortSignal): Promise<UserOperationReceipt | null>;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* The decisions the smart-account hooks share, kept out of both framework
|
|
641
|
+
* shells: which chain a UserOperation targets, how the account config is
|
|
642
|
+
* assembled from options, and what a wallet's signature must look like.
|
|
643
|
+
*/
|
|
644
|
+
type SmartAccountType = "simple" | "light" | "kernel" | "safe";
|
|
645
|
+
interface SmartAccountOptionsLike {
|
|
646
|
+
chainId?: string;
|
|
647
|
+
entryPoint?: Address;
|
|
648
|
+
accountType?: SmartAccountType;
|
|
649
|
+
salt?: bigint;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Target chain for a UserOperation. Fails closed: no chain → error rather
|
|
653
|
+
* than mainnet; a connected wallet on a different chain → chain_mismatch,
|
|
654
|
+
* because the signature it would produce is for the wrong domain.
|
|
655
|
+
*/
|
|
656
|
+
declare function resolveUserOpChain(optionsChainId: string | undefined, connectedChainId: string | null | undefined): string;
|
|
657
|
+
/** Account config from owner, CAIP-2 chain and options; entry point falls back per chain. */
|
|
658
|
+
declare function buildSmartAccountConfig(owner: Address, chainId: string, options?: SmartAccountOptionsLike): SmartAccountConfig;
|
|
659
|
+
/** A wallet's answer to a signing request must be non-empty even-length hex. */
|
|
660
|
+
declare function assertHexSignature(value: unknown): Hex;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Signed off-chain delegation policies: the complete product flow, shared by
|
|
664
|
+
* React and Vue. Everything that decides whether a policy may be created,
|
|
665
|
+
* is still valid, or may sign or broadcast lives here; the framework shells
|
|
666
|
+
* only add state and wiring.
|
|
667
|
+
*
|
|
668
|
+
* Only `offchain` mode is created. An EIP-7702 or AA-module policy needs a
|
|
669
|
+
* real on-chain executor; accepting those here would turn a local record into
|
|
670
|
+
* a false delegation claim.
|
|
671
|
+
*/
|
|
672
|
+
/** What the execution planner says about a batch, plus the route it chose. */
|
|
673
|
+
interface PolicyExecutionPreview extends ExecutionPlan {
|
|
674
|
+
route: string | null;
|
|
675
|
+
}
|
|
676
|
+
interface DelegationPolicyPreview {
|
|
677
|
+
policy: SessionKeyInfo | null;
|
|
678
|
+
scope: ScopeCheckResult;
|
|
679
|
+
execution: PolicyExecutionPreview;
|
|
680
|
+
signerMatches: boolean;
|
|
681
|
+
authorizationVerified: boolean;
|
|
682
|
+
ready: boolean;
|
|
683
|
+
broadcastReady: boolean;
|
|
684
|
+
broadcastRoute: PolicyExecutionRoute | null;
|
|
685
|
+
onchainAuthorizationVerified: boolean;
|
|
686
|
+
broadcastSponsored: boolean | null;
|
|
687
|
+
broadcastPromptless: boolean;
|
|
688
|
+
reason: string;
|
|
689
|
+
}
|
|
690
|
+
type PolicyExecutionRoute = "erc4337" | "eip7702";
|
|
691
|
+
interface PolicyExecutionCheck {
|
|
692
|
+
ready: boolean;
|
|
693
|
+
authorizationInstalled: boolean;
|
|
694
|
+
sponsored: boolean;
|
|
695
|
+
promptless: boolean;
|
|
696
|
+
executorAddress?: `0x${string}`;
|
|
697
|
+
reason: string;
|
|
698
|
+
}
|
|
699
|
+
interface PreparedPolicyExecution {
|
|
700
|
+
digest: Hex;
|
|
701
|
+
transaction: SessionKeyTransaction;
|
|
702
|
+
payload: unknown;
|
|
703
|
+
}
|
|
704
|
+
interface PolicyExecutionSubmission {
|
|
705
|
+
route: PolicyExecutionRoute;
|
|
706
|
+
hash: Hex;
|
|
707
|
+
status: "submitted";
|
|
708
|
+
}
|
|
709
|
+
interface PolicyExecutionAdapter {
|
|
710
|
+
route: PolicyExecutionRoute;
|
|
711
|
+
check: (request: {
|
|
712
|
+
policy: SessionKeyInfo;
|
|
713
|
+
transaction: SessionKeyTransaction;
|
|
714
|
+
}) => Promise<PolicyExecutionCheck>;
|
|
715
|
+
prepare: (request: {
|
|
716
|
+
policy: SessionKeyInfo;
|
|
717
|
+
transaction: SessionKeyTransaction;
|
|
718
|
+
}) => Promise<PreparedPolicyExecution>;
|
|
719
|
+
broadcast: (request: {
|
|
720
|
+
policy: SessionKeyInfo;
|
|
721
|
+
prepared: PreparedPolicyExecution;
|
|
722
|
+
signature: Hex;
|
|
723
|
+
}) => Promise<PolicyExecutionSubmission>;
|
|
724
|
+
}
|
|
725
|
+
/** Recovers the signer of an EIP-191 message and compares; the flow never trusts a signature unrecovered. */
|
|
726
|
+
type PolicySignatureVerifier = (input: {
|
|
727
|
+
message: string;
|
|
728
|
+
signature: `0x${string}`;
|
|
729
|
+
signerAddress: `0x${string}`;
|
|
730
|
+
}) => Promise<boolean> | boolean;
|
|
731
|
+
interface DelegationPolicyDeps {
|
|
732
|
+
manager: SessionKeyManager;
|
|
733
|
+
/** Origin bound into the signed message. */
|
|
734
|
+
origin: string;
|
|
735
|
+
/** Connected EOA, bare 0x form, or null. Read at call time. */
|
|
736
|
+
signer: () => `0x${string}` | null;
|
|
737
|
+
signMessage: (message: string) => Promise<string>;
|
|
738
|
+
verifySignature: PolicySignatureVerifier;
|
|
739
|
+
previewExecution: (callCount: number, atomicity: AtomicityRequirement) => PolicyExecutionPreview;
|
|
740
|
+
/** Whether gas must be sponsored for a broadcast to count as ready. */
|
|
741
|
+
sponsorship?: AtomicityRequirement;
|
|
742
|
+
adapter?: PolicyExecutionAdapter;
|
|
743
|
+
/** Current on-chain EIP-7702 delegation of the account. Read at call time. */
|
|
744
|
+
delegation: () => {
|
|
745
|
+
delegated: boolean | null;
|
|
746
|
+
delegate: `0x${string}` | null;
|
|
747
|
+
};
|
|
748
|
+
/** A host-provided encryption key is required for persistent policies. */
|
|
749
|
+
encryptionKeyConfigured: boolean;
|
|
750
|
+
storageAvailable: () => boolean;
|
|
751
|
+
/** Re-read the policy list after a mutation. */
|
|
752
|
+
refresh: () => Promise<void>;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* True when the adapter's prepared transaction still means what was
|
|
756
|
+
* requested. Fail-closed: a field the caller left undefined is not a
|
|
757
|
+
* wildcard. An adapter may not add a target to a creation, add calldata to
|
|
758
|
+
* a plain transfer, or pick a chain the caller did not name — each of those
|
|
759
|
+
* changes what the session key ends up signing. Only "no value" and "0"
|
|
760
|
+
* (and "no data" and "0x") are treated as the same thing.
|
|
761
|
+
*/
|
|
762
|
+
declare function sameExecutionIntent(requested: SessionKeyTransaction, prepared: SessionKeyTransaction): boolean;
|
|
763
|
+
/**
|
|
764
|
+
* The exact, deterministic message the main wallet signs. Every scope field
|
|
765
|
+
* is included in canonical order so a stored policy whose scope, signer or
|
|
766
|
+
* origin was altered no longer verifies. There must be exactly one copy of
|
|
767
|
+
* this function.
|
|
768
|
+
*/
|
|
769
|
+
declare function buildDelegationPolicyMessage(policy: SessionKeyInfo, origin: string): string;
|
|
770
|
+
/** A stored policy is a verification candidate only in this state. */
|
|
771
|
+
declare function isVerifiablePolicy(policy: SessionKeyInfo): boolean;
|
|
772
|
+
interface DelegationPolicyFlow {
|
|
773
|
+
verifyStoredPolicy: (policy: SessionKeyInfo) => Promise<boolean>;
|
|
774
|
+
createPolicy: (scope: Partial<SessionKeyScope>) => Promise<SessionKeyInfo>;
|
|
775
|
+
revokePolicy: (policyId: string) => Promise<void>;
|
|
776
|
+
previewPolicyExecution: (policyId: string, tx: SessionKeyTransaction, callCount?: number, atomicity?: AtomicityRequirement) => Promise<DelegationPolicyPreview>;
|
|
777
|
+
signPolicyDigest: (policyId: string, digest: `0x${string}`, tx: SessionKeyTransaction) => Promise<`0x${string}`>;
|
|
778
|
+
executePolicy: (policyId: string, tx: SessionKeyTransaction) => Promise<PolicyExecutionSubmission>;
|
|
779
|
+
}
|
|
780
|
+
declare function createDelegationPolicyFlow(deps: DelegationPolicyDeps): DelegationPolicyFlow;
|
|
781
|
+
|
|
428
782
|
declare function withTimeout<T>(promise: Promise<T>, ms: number, label?: string): Promise<T>;
|
|
429
783
|
interface RetryOptions {
|
|
430
784
|
maxRetries: number;
|
|
@@ -465,4 +819,36 @@ type Web3Action = {
|
|
|
465
819
|
declare const initialWeb3State: Web3State;
|
|
466
820
|
declare function web3Reducer(state: Web3State, action: Web3Action): Web3State;
|
|
467
821
|
|
|
468
|
-
|
|
822
|
+
interface SiwxLocation {
|
|
823
|
+
host: string;
|
|
824
|
+
origin: string;
|
|
825
|
+
}
|
|
826
|
+
interface SiwxMessageLike {
|
|
827
|
+
chainId: string;
|
|
828
|
+
address: string;
|
|
829
|
+
domain: string;
|
|
830
|
+
issuedAt?: string | null;
|
|
831
|
+
expirationTime?: string | null;
|
|
832
|
+
notBefore?: string | null;
|
|
833
|
+
}
|
|
834
|
+
interface SiwxResultLike<M extends SiwxMessageLike = SiwxMessageLike> {
|
|
835
|
+
message: M;
|
|
836
|
+
signature: string;
|
|
837
|
+
}
|
|
838
|
+
declare function defaultSiwxDomain(location?: SiwxLocation): string;
|
|
839
|
+
declare function defaultSiwxUri(location?: SiwxLocation): string;
|
|
840
|
+
declare function isSiwxExpired(result: SiwxResultLike, now: Date): boolean;
|
|
841
|
+
declare function isSiwxNotBeforeValid(result: SiwxResultLike, now: Date): boolean;
|
|
842
|
+
declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResultLike<M>, now?: Date): {
|
|
843
|
+
id: string;
|
|
844
|
+
chainId: string;
|
|
845
|
+
address: string;
|
|
846
|
+
domain: string;
|
|
847
|
+
message: M;
|
|
848
|
+
signature: string;
|
|
849
|
+
issuedAt: string;
|
|
850
|
+
expiresAt: string | null;
|
|
851
|
+
refreshedAt: null;
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
export { type AddressValidationLevel, type AtomicSupport, type ChainCapabilities, type ChainInfo, type CompareCosts, type CompareCostsInput, type ConnectionStatus, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_NOTIFICATION_SETTINGS, type DecimalsCache, type DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DestinationIssue, type DestinationValidation, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, type RetryOptions, type RouteQuote, type RouteQuoteInput, type RouteQuoteOptions, type SimulationCallClient, type SimulationTransaction, type SiwxLocation, type SiwxMessageLike, type SiwxResultLike, type SmartAccountOptionsLike, type SmartAccountType, type SolanaIdentity, type SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, type SolanaSigner, type SolanaWalletFeatures, type TokenIdentity, type TransactionSimulationContext, type ViemChainShape, type WalletChain, type Web3Action, type Web3State, __resetResolverForTests, addInAppNotification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeChain, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, fetchUserOperationReceipt, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readDecimals, readSolanaRoles, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
|