@initia/interwovenkit-react 2.12.1 → 2.13.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.ts CHANGED
@@ -26,12 +26,36 @@ declare interface AssetOption {
26
26
  chainId: string;
27
27
  }
28
28
 
29
- declare interface AutoSignFeePolicy {
29
+ export declare type AutoSignChainStatus = "enabled" | "disabled" | "expired" | "needs-permission-update" | "unknown";
30
+
31
+ export declare interface AutoSignFeePolicy {
30
32
  gasMultiplier?: number;
31
33
  maxGasMultiplierFromSim?: number;
32
34
  allowedFeeDenoms?: string[];
33
35
  }
34
36
 
37
+ export declare interface AutoSignGrantPolicy {
38
+ /** Enables this chain with the specified scope; overrides its legacy message list. */
39
+ authorization?: AutoSignPermissionPolicy;
40
+ }
41
+
42
+ export declare type AutoSignPermissionPolicy = GenericPermissionPolicy | MovePermissionPolicy | EvmPermissionPolicy;
43
+
44
+ export declare interface AutoSignResult extends AutoSignStatusResult {
45
+ isLoading: boolean;
46
+ enable: (chainId?: string, options?: EnableAutoSignOptions) => Promise<void>;
47
+ disable: (chainId?: string) => Promise<void>;
48
+ }
49
+
50
+ export declare interface AutoSignStatusResult {
51
+ expiredAtByChain: Record<string, Date | null | undefined>;
52
+ feegrantByChain: Record<string, FeegrantAllowance | undefined>;
53
+ isEnabledByChain: Record<string, boolean>;
54
+ granteeByChain: Record<string, string | undefined>;
55
+ requestedDurationInMsByChain: Record<string, number | undefined>;
56
+ statusByChain: Record<string, AutoSignChainStatus>;
57
+ }
58
+
35
59
  declare interface Config {
36
60
  /** Chain id the widget targets by default. */
37
61
  defaultChainId: string;
@@ -71,10 +95,14 @@ declare interface Config {
71
95
  container?: HTMLElement;
72
96
  /** Disables usage analytics. */
73
97
  disableAnalytics?: boolean;
74
- /** Auto-sign opt-in: `true`, or a chain id → allowed message type URLs map. */
98
+ /** Legacy generic auto-sign opt-in; explicit false also disables scoped policies. */
75
99
  enableAutoSign?: boolean | Record<string, string[]>;
76
100
  /** Per-chain fee policy for auto-signed transactions. */
77
101
  autoSignFeePolicy?: Record<string, AutoSignFeePolicy>;
102
+ /** Per-chain authorization scopes; a configured authorization opts its chain in. */
103
+ autoSignGrantPolicy?: Record<string, AutoSignGrantPolicy>;
104
+ /** Browser storage supports Stay connected; memory disables all signer persistence. */
105
+ autoSignStorage?: "browser" | "memory";
78
106
  /** Cosmos wallets offered in the connect list. */
79
107
  cosmosWallets?: CosmosWallet[];
80
108
  }
@@ -197,7 +225,8 @@ export declare type CreateTestWalletConfig = CreateTestWalletOptions & {
197
225
  };
198
226
  /**
199
227
  * Open a blank window before every signing request and fail with the same error as
200
- * popup-based wallets (Privy) when the browser blocks it. Lets browser tests check that
228
+ * popup-based wallets (Privy) when the browser blocks it. Like Privy, it then signs
229
+ * transactions on their own `chainId` instead of the wallet's current chain. Lets browser tests check that
201
230
  * signing is still inside the click's user activation when the wallet is asked.
202
231
  * `delayMs` waits that long before opening the window, which is useful as a negative
203
232
  * control since the activation expires during the wait.
@@ -206,6 +235,15 @@ export declare type CreateTestWalletConfig = CreateTestWalletOptions & {
206
235
  simulatePopup?: boolean | {
207
236
  delayMs: number;
208
237
  };
238
+ /**
239
+ * Confirm chain switches the way extension wallets do: the page loses focus to a wallet
240
+ * window for `delayMs` (500 by default) before the switch takes effect. Without it the switch
241
+ * is instant, like Privy's.
242
+ * @default false
243
+ */
244
+ simulateExtension?: boolean | {
245
+ delayMs: number;
246
+ };
209
247
  };
210
248
 
211
249
  /**
@@ -398,8 +436,36 @@ export declare const DEFAULT_GAS_ADJUSTMENT = 1.4;
398
436
 
399
437
  export declare const DEFAULT_GAS_PRICE_MULTIPLIER = 1.05;
400
438
 
401
- declare interface EnableAutoSignOptions {
439
+ export declare interface EnableAutoSignOptions {
402
440
  defaultDuration?: number;
441
+ /** Selects browser persistence when true or tab-only storage when false.
442
+ * Omit it to use the saved preference, which defaults to browser persistence.
443
+ * The provider's memory-only mode always takes precedence. */
444
+ stayConnected?: boolean;
445
+ }
446
+
447
+ export declare interface EvmPermissionPolicy {
448
+ kind: "evm";
449
+ contracts: string[];
450
+ /** Four-byte selector validation is SDK-only; chain authz only restricts targets. */
451
+ selectors?: string[];
452
+ }
453
+
454
+ declare interface FeegrantAllowance {
455
+ granter: string;
456
+ grantee: string;
457
+ allowance: {
458
+ "@type": string;
459
+ expiration?: string;
460
+ allowance?: {
461
+ "@type": string;
462
+ expiration?: string;
463
+ spend_limit?: Coin[];
464
+ spendLimit?: Coin[];
465
+ };
466
+ allowed_messages?: string[];
467
+ allowedMessages?: string[];
468
+ };
403
469
  }
404
470
 
405
471
  declare interface FormValues {
@@ -414,6 +480,11 @@ declare interface FormValues {
414
480
  slippagePercent: string;
415
481
  }
416
482
 
483
+ export declare interface GenericPermissionPolicy {
484
+ kind: "generic";
485
+ messageTypes: string[];
486
+ }
487
+
417
488
  export declare const initiaPrivyWallet: () => Wallet;
418
489
 
419
490
  export declare const initiaPrivyWalletConnector: CreateConnectorFn< {
@@ -449,6 +520,15 @@ export declare class MoveError extends Error {
449
520
  constructor(message: string, originalError: Error, moduleAddress: string, moduleName: string, errorCode: string, errorCodeHex: string, isFromRegistry: boolean);
450
521
  }
451
522
 
523
+ export declare interface MovePermissionPolicy {
524
+ kind: "move";
525
+ items: Array<{
526
+ moduleAddress: string;
527
+ moduleName: string;
528
+ functionNames: string[];
529
+ }>;
530
+ }
531
+
452
532
  declare class OfflineSigner implements OfflineAminoSigner {
453
533
  private address;
454
534
  private signMessage;
@@ -571,14 +651,7 @@ export declare function useInterwovenKit(): {
571
651
  recipientAddress?: string;
572
652
  }) => void;
573
653
  disconnect: () => void;
574
- autoSign: {
575
- isLoading: boolean;
576
- enable: (chainId?: string, options?: EnableAutoSignOptions) => Promise<void>;
577
- disable: (chainId?: string) => Promise<void>;
578
- expiredAtByChain: Record<string, Date | null | undefined>;
579
- isEnabledByChain: Record<string, boolean>;
580
- granteeByChain: Record<string, string | undefined>;
581
- };
654
+ autoSign: AutoSignResult;
582
655
  };
583
656
 
584
657
  export declare function usePortfolio(): {