@lydianpay/lydianconnect 1.3.0 → 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/README.md +2 -0
- package/dist/index.cjs +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ lc.on((event) => {
|
|
|
43
43
|
|
|
44
44
|
`connect({ walletId, chainId })` — `chainId` is the chain the user is paying on (a number like `137`, or a CAIP-2 id like `'eip155:137'`).
|
|
45
45
|
|
|
46
|
+
The WalletConnect client also advertises a return link derived from the page URL (origin + path, no query/hash); wallets may use it to bring the user back to the page after a deep-link approval.
|
|
47
|
+
|
|
46
48
|
## Supported wallets
|
|
47
49
|
|
|
48
50
|
The canonical list of supported wallets lives in
|
package/dist/index.cjs
CHANGED
|
@@ -304,6 +304,10 @@ var BaseConnector = class {
|
|
|
304
304
|
function deriveUrl() {
|
|
305
305
|
return typeof window !== "undefined" ? window.location.origin : "";
|
|
306
306
|
}
|
|
307
|
+
function deriveRedirectUrl() {
|
|
308
|
+
if (typeof window === "undefined") return "";
|
|
309
|
+
return window.location.origin + window.location.pathname;
|
|
310
|
+
}
|
|
307
311
|
|
|
308
312
|
// src/connectors/eip155/chain.ts
|
|
309
313
|
var CHAIN_SETTLE = { timeoutMs: 4e3, intervalMs: 100 };
|
|
@@ -1264,13 +1268,16 @@ var WalletConnectConnector = class extends BaseConnector {
|
|
|
1264
1268
|
}
|
|
1265
1269
|
async getClient() {
|
|
1266
1270
|
if (this.client) return this.client;
|
|
1271
|
+
const redirectUrl = deriveRedirectUrl();
|
|
1267
1272
|
const client = await SignClient__default.default.init({
|
|
1268
1273
|
projectId: this.options.projectId,
|
|
1269
1274
|
metadata: {
|
|
1270
1275
|
name: this.app.appName,
|
|
1271
1276
|
description: this.app.description ?? this.app.appName,
|
|
1272
1277
|
url: deriveUrl(),
|
|
1273
|
-
icons: this.app.icon ? [this.app.icon] : []
|
|
1278
|
+
icons: this.app.icon ? [this.app.icon] : [],
|
|
1279
|
+
// Wallets may use this to return the user after deep-link approvals.
|
|
1280
|
+
...redirectUrl ? { redirect: { universal: redirectUrl } } : {}
|
|
1274
1281
|
},
|
|
1275
1282
|
relayUrl: this.options.relayUrl
|
|
1276
1283
|
});
|