@lydianpay/lydianconnect 1.0.0 → 1.0.1
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 +23 -56
- package/dist/index.cjs +307 -217
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -163
- package/dist/index.d.ts +32 -163
- package/dist/index.js +308 -213
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# @lydianpay/lydianconnect
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
falls back to **WalletConnect** for everything else — behind a single uniform
|
|
6
|
-
API, so your app never branches on which path was used.
|
|
3
|
+
One API for every wallet. LydianConnect abstracts the messy differences between
|
|
4
|
+
wallet connection methods into a single, uniform interface.
|
|
7
5
|
|
|
8
6
|
## Install
|
|
9
7
|
|
|
@@ -14,70 +12,39 @@ npm install @lydianpay/lydianconnect
|
|
|
14
12
|
## Usage
|
|
15
13
|
|
|
16
14
|
```ts
|
|
17
|
-
import {
|
|
18
|
-
LydianConnect,
|
|
19
|
-
WalletConnectConnector,
|
|
20
|
-
MetaMaskConnector,
|
|
21
|
-
CoinbaseConnector,
|
|
22
|
-
} from '@lydianpay/lydianconnect';
|
|
15
|
+
import { LydianConnect } from '@lydianpay/lydianconnect';
|
|
23
16
|
|
|
24
17
|
const lc = new LydianConnect({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
},
|
|
18
|
+
appName: 'My App',
|
|
19
|
+
walletConnectProjectId: 'your-wc-project-id',
|
|
20
|
+
icon: 'https://my.app/icon.png', // optional
|
|
21
|
+
description: 'My App checkout', // optional
|
|
48
22
|
});
|
|
49
23
|
|
|
24
|
+
const conn = await lc.connect({ walletId: 'metamask', chainId: 137 });
|
|
50
25
|
const txHash = await conn.request({ method: 'eth_sendTransaction', params: [tx] });
|
|
51
26
|
|
|
52
27
|
lc.on((event) => {
|
|
53
|
-
// 'connect' | 'disconnect' | 'chainChanged' | 'accountsChanged'
|
|
54
|
-
// | 'display_uri' | 'wallet_open_failed'
|
|
28
|
+
// 'connect' | 'disconnect' | 'chainChanged' | 'accountsChanged' | 'display_uri' | 'wallet_open_failed'
|
|
55
29
|
});
|
|
56
30
|
```
|
|
57
31
|
|
|
58
|
-
|
|
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
|
|
32
|
+
## Config
|
|
67
33
|
|
|
68
|
-
|
|
34
|
+
| Field | Required | Notes |
|
|
35
|
+
|-------|----------|-------|
|
|
36
|
+
| `appName` | yes | Display name shown in the wallet's connect prompt. |
|
|
37
|
+
| `walletConnectProjectId` | yes | WalletConnect Cloud project id. |
|
|
38
|
+
| `icon` | no | Icon shown in the connect prompt. |
|
|
39
|
+
| `description` | no | Defaults to `appName`. |
|
|
69
40
|
|
|
70
|
-
|
|
71
|
-
registry generator (`scripts/build-wallet-links.mjs`).
|
|
41
|
+
`connect({ walletId, chainId })` — `chainId` is the chain the user is paying on (a number like `137`, or a CAIP-2 id like `'eip155:137'`).
|
|
72
42
|
|
|
73
|
-
|
|
74
|
-
npm install
|
|
75
|
-
npm run build # ESM + CJS + d.ts
|
|
76
|
-
npm run lint
|
|
77
|
-
npm run typecheck
|
|
78
|
-
npm test
|
|
79
|
-
```
|
|
43
|
+
## Supported wallets
|
|
80
44
|
|
|
81
|
-
|
|
45
|
+
**Native SDK:** MetaMask, Coinbase Wallet.
|
|
82
46
|
|
|
83
|
-
|
|
47
|
+
**WalletConnect:** Rainbow, Trust Wallet, OKX Wallet, Crypto.com, Phantom, Zerion,
|
|
48
|
+
Argent, Ledger, 1inch, SafePal, imToken, TokenPocket, Blockchain.com, Exodus,
|
|
49
|
+
Ronin Wallet, Coin98, Bitget Wallet, Infinity Wallet, Atomic Wallet, AlphaWallet,
|
|
50
|
+
MathWallet, BitPay — each with native deep-linking.
|