@lydianpay/lydianconnect 0.0.0-managed → 1.0.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/package.json +2 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lydian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @lydianpay/lydianconnect
2
+
3
+ Wallet-connection library for Lydian frontends. It connects to a user's wallet
4
+ through the wallet's **native SDK** when one exists (MetaMask, Coinbase) and
5
+ falls back to **WalletConnect** for everything else — behind a single uniform
6
+ API, so your app never branches on which path was used.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @lydianpay/lydianconnect
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import {
18
+ LydianConnect,
19
+ WalletConnectConnector,
20
+ MetaMaskConnector,
21
+ CoinbaseConnector,
22
+ } from '@lydianpay/lydianconnect';
23
+
24
+ const lc = new LydianConnect({
25
+ connectors: [
26
+ new MetaMaskConnector({ dappMetadata: { name: 'My App', url: location.origin } }),
27
+ new CoinbaseConnector({ appName: 'My App' }),
28
+ ],
29
+ fallback: new WalletConnectConnector({
30
+ projectId: 'your-walletconnect-project-id',
31
+ metadata: {
32
+ name: 'My App',
33
+ description: 'My App',
34
+ url: location.origin,
35
+ icons: ['https://my.app/icon.png'],
36
+ },
37
+ }),
38
+ });
39
+
40
+ // One call — the result is identical whether it routes to a native SDK or
41
+ // to WalletConnect. Your app never branches on the source.
42
+ const conn = await lc.connect({
43
+ walletId: 'metamask',
44
+ namespace: {
45
+ name: 'eip155',
46
+ value: { chains: ['eip155:1'], methods: ['eth_sendTransaction'], events: [] },
47
+ },
48
+ });
49
+
50
+ const txHash = await conn.request({ method: 'eth_sendTransaction', params: [tx] });
51
+
52
+ lc.on((event) => {
53
+ // 'connect' | 'disconnect' | 'chainChanged' | 'accountsChanged'
54
+ // | 'display_uri' | 'wallet_open_failed'
55
+ });
56
+ ```
57
+
58
+ `conn` is the uniform handle: `{ walletId, account, chainId, request, disconnect }`.
59
+ Encoding/signing (ethers, viem, …) stays in your app — this library only moves
60
+ opaque RPC requests.
61
+
62
+ ## Supported wallets
63
+
64
+ - **Native SDK:** MetaMask, Coinbase
65
+ - **WalletConnect fallback:** every other WalletConnect-compatible wallet, with
66
+ per-wallet deep-linking generated from the WalletConnect explorer registry
67
+
68
+ ## Development
69
+
70
+ See [CLAUDE.md](./CLAUDE.md) for architecture, conventions, and the wallet-link
71
+ registry generator (`scripts/build-wallet-links.mjs`).
72
+
73
+ ```bash
74
+ npm install
75
+ npm run build # ESM + CJS + d.ts
76
+ npm run lint
77
+ npm run typecheck
78
+ npm test
79
+ ```
80
+
81
+ ## License
82
+
83
+ MIT
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@lydianpay/lydianconnect",
3
- "version": "0.0.0-managed",
3
+ "version": "1.0.0",
4
4
  "description": "Wallet connection library for Lydian — native wallet SDKs with WalletConnect fallback, behind one uniform API.",
5
5
  "type": "module",
6
+ "license": "MIT",
6
7
  "main": "./dist/index.cjs",
7
8
  "module": "./dist/index.js",
8
9
  "types": "./dist/index.d.ts",