@lydianpay/lydianconnect 1.2.1 → 1.4.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.cts CHANGED
@@ -19,6 +19,22 @@ interface CaipNamespace {
19
19
  events: string[];
20
20
  };
21
21
  }
22
+ /** Input to {@link LydianConnect.openWallet}. */
23
+ interface OpenWalletInput {
24
+ walletId: string;
25
+ /**
26
+ * Pairing URI from the `display_uri` event, to hand the wallet a connection to
27
+ * approve. Omit to simply foreground the app.
28
+ */
29
+ uri?: string;
30
+ /**
31
+ * `"scheme"` (default) opens the wallet's custom scheme — reliable, and it
32
+ * cannot strand the user if the app is missing. `"universal"` opens the https
33
+ * app-link instead: the retry to offer when the scheme did nothing, but it
34
+ * navigates away from the page when the app isn't installed.
35
+ */
36
+ via?: "scheme" | "universal";
37
+ }
22
38
  /**
23
39
  * The uniform handle the host app holds after connecting.
24
40
  *
@@ -59,11 +75,21 @@ interface ConnectInput {
59
75
  signal?: AbortSignal;
60
76
  }
61
77
  type LydianConnectEvent =
62
- /** WalletConnect only — the wc: URI. Deep-linking is fired internally; emitted for QR display. */
78
+ /**
79
+ * WalletConnect only — the wc: URI.
80
+ *
81
+ * `deepLink` is the library telling the host how to prompt: `true` means this
82
+ * wallet can be opened directly on this device, so render an "Open <wallet>"
83
+ * button (whose tap is a fresh user gesture — the only reliable way to launch
84
+ * a wallet app); `false` means render a QR code. The connector also fires the
85
+ * deep link itself, but mobile browsers suppress a scheme navigation that has
86
+ * lost its click gesture, so the button is what guarantees a way forward.
87
+ */
63
88
  {
64
89
  type: "display_uri";
65
90
  walletId: string;
66
91
  uri: string;
92
+ deepLink: boolean;
67
93
  } | {
68
94
  type: "connect";
69
95
  walletId: string;
@@ -103,6 +129,18 @@ declare class LydianConnect {
103
129
  constructor(config: LydianConnectConfig);
104
130
  init(): Promise<void>;
105
131
  connect(input: ConnectInput): Promise<Connection>;
132
+ /**
133
+ * Open a wallet app, optionally handing it the pairing URI from `display_uri`.
134
+ *
135
+ * Call this from a real click handler. A mobile browser will suppress the same
136
+ * navigation issued automatically after an async step, which is why the
137
+ * `display_uri` event reports `deepLink` — that is the library asking the host
138
+ * for a button to put this behind.
139
+ *
140
+ * Returns whether a link was fired. `false` means nothing is known for this
141
+ * wallet on this device; show the QR code instead.
142
+ */
143
+ openWallet(input: OpenWalletInput): boolean;
106
144
  restore(): Promise<Connection[]>;
107
145
  disconnect(walletId?: string): Promise<void>;
108
146
  reset(): Promise<void>;
@@ -110,4 +148,4 @@ declare class LydianConnect {
110
148
  on(handler: LydianConnectEventHandler): () => void;
111
149
  }
112
150
 
113
- export { type CaipNamespace, type ConnectInput, type Connection, LydianConnect, type LydianConnectConfig, type LydianConnectEvent, type LydianConnectEventHandler };
151
+ export { type CaipNamespace, type ConnectInput, type Connection, LydianConnect, type LydianConnectConfig, type LydianConnectEvent, type LydianConnectEventHandler, type OpenWalletInput };
package/dist/index.d.ts CHANGED
@@ -19,6 +19,22 @@ interface CaipNamespace {
19
19
  events: string[];
20
20
  };
21
21
  }
22
+ /** Input to {@link LydianConnect.openWallet}. */
23
+ interface OpenWalletInput {
24
+ walletId: string;
25
+ /**
26
+ * Pairing URI from the `display_uri` event, to hand the wallet a connection to
27
+ * approve. Omit to simply foreground the app.
28
+ */
29
+ uri?: string;
30
+ /**
31
+ * `"scheme"` (default) opens the wallet's custom scheme — reliable, and it
32
+ * cannot strand the user if the app is missing. `"universal"` opens the https
33
+ * app-link instead: the retry to offer when the scheme did nothing, but it
34
+ * navigates away from the page when the app isn't installed.
35
+ */
36
+ via?: "scheme" | "universal";
37
+ }
22
38
  /**
23
39
  * The uniform handle the host app holds after connecting.
24
40
  *
@@ -59,11 +75,21 @@ interface ConnectInput {
59
75
  signal?: AbortSignal;
60
76
  }
61
77
  type LydianConnectEvent =
62
- /** WalletConnect only — the wc: URI. Deep-linking is fired internally; emitted for QR display. */
78
+ /**
79
+ * WalletConnect only — the wc: URI.
80
+ *
81
+ * `deepLink` is the library telling the host how to prompt: `true` means this
82
+ * wallet can be opened directly on this device, so render an "Open <wallet>"
83
+ * button (whose tap is a fresh user gesture — the only reliable way to launch
84
+ * a wallet app); `false` means render a QR code. The connector also fires the
85
+ * deep link itself, but mobile browsers suppress a scheme navigation that has
86
+ * lost its click gesture, so the button is what guarantees a way forward.
87
+ */
63
88
  {
64
89
  type: "display_uri";
65
90
  walletId: string;
66
91
  uri: string;
92
+ deepLink: boolean;
67
93
  } | {
68
94
  type: "connect";
69
95
  walletId: string;
@@ -103,6 +129,18 @@ declare class LydianConnect {
103
129
  constructor(config: LydianConnectConfig);
104
130
  init(): Promise<void>;
105
131
  connect(input: ConnectInput): Promise<Connection>;
132
+ /**
133
+ * Open a wallet app, optionally handing it the pairing URI from `display_uri`.
134
+ *
135
+ * Call this from a real click handler. A mobile browser will suppress the same
136
+ * navigation issued automatically after an async step, which is why the
137
+ * `display_uri` event reports `deepLink` — that is the library asking the host
138
+ * for a button to put this behind.
139
+ *
140
+ * Returns whether a link was fired. `false` means nothing is known for this
141
+ * wallet on this device; show the QR code instead.
142
+ */
143
+ openWallet(input: OpenWalletInput): boolean;
106
144
  restore(): Promise<Connection[]>;
107
145
  disconnect(walletId?: string): Promise<void>;
108
146
  reset(): Promise<void>;
@@ -110,4 +148,4 @@ declare class LydianConnect {
110
148
  on(handler: LydianConnectEventHandler): () => void;
111
149
  }
112
150
 
113
- export { type CaipNamespace, type ConnectInput, type Connection, LydianConnect, type LydianConnectConfig, type LydianConnectEvent, type LydianConnectEventHandler };
151
+ export { type CaipNamespace, type ConnectInput, type Connection, LydianConnect, type LydianConnectConfig, type LydianConnectEvent, type LydianConnectEventHandler, type OpenWalletInput };