@initia/interwovenkit-react 2.12.0 → 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
  }
@@ -195,6 +223,27 @@ export declare type CreateTestWalletConfig = CreateTestWalletOptions & {
195
223
  maxFeePerGas?: bigint;
196
224
  maxPriorityFeePerGas?: bigint;
197
225
  };
226
+ /**
227
+ * Open a blank window before every signing request and fail with the same error as
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
230
+ * signing is still inside the click's user activation when the wallet is asked.
231
+ * `delayMs` waits that long before opening the window, which is useful as a negative
232
+ * control since the activation expires during the wait.
233
+ * @default false
234
+ */
235
+ simulatePopup?: boolean | {
236
+ delayMs: number;
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
+ };
198
247
  };
199
248
 
200
249
  /**
@@ -387,8 +436,36 @@ export declare const DEFAULT_GAS_ADJUSTMENT = 1.4;
387
436
 
388
437
  export declare const DEFAULT_GAS_PRICE_MULTIPLIER = 1.05;
389
438
 
390
- declare interface EnableAutoSignOptions {
439
+ export declare interface EnableAutoSignOptions {
391
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
+ };
392
469
  }
393
470
 
394
471
  declare interface FormValues {
@@ -403,6 +480,11 @@ declare interface FormValues {
403
480
  slippagePercent: string;
404
481
  }
405
482
 
483
+ export declare interface GenericPermissionPolicy {
484
+ kind: "generic";
485
+ messageTypes: string[];
486
+ }
487
+
406
488
  export declare const initiaPrivyWallet: () => Wallet;
407
489
 
408
490
  export declare const initiaPrivyWalletConnector: CreateConnectorFn< {
@@ -438,12 +520,22 @@ export declare class MoveError extends Error {
438
520
  constructor(message: string, originalError: Error, moduleAddress: string, moduleName: string, errorCode: string, errorCodeHex: string, isFromRegistry: boolean);
439
521
  }
440
522
 
523
+ export declare interface MovePermissionPolicy {
524
+ kind: "move";
525
+ items: Array<{
526
+ moduleAddress: string;
527
+ moduleName: string;
528
+ functionNames: string[];
529
+ }>;
530
+ }
531
+
441
532
  declare class OfflineSigner implements OfflineAminoSigner {
442
533
  private address;
443
534
  private signMessage;
444
535
  private restUrl;
445
536
  constructor(address: string, signMessage: (message: string) => Promise<string>, restUrl: string);
446
537
  private cachedPublicKey;
538
+ private setCachedPublicKey;
447
539
  private getCachedPublicKey;
448
540
  private getPublicKeyFromRestApi;
449
541
  private getPublicKey;
@@ -559,14 +651,7 @@ export declare function useInterwovenKit(): {
559
651
  recipientAddress?: string;
560
652
  }) => void;
561
653
  disconnect: () => void;
562
- autoSign: {
563
- isLoading: boolean;
564
- enable: (chainId?: string, options?: EnableAutoSignOptions) => Promise<void>;
565
- disable: (chainId?: string) => Promise<void>;
566
- expiredAtByChain: Record<string, Date | null | undefined>;
567
- isEnabledByChain: Record<string, boolean>;
568
- granteeByChain: Record<string, string | undefined>;
569
- };
654
+ autoSign: AutoSignResult;
570
655
  };
571
656
 
572
657
  export declare function usePortfolio(): {