@lydianpay/lydianconnect 1.1.4 → 1.2.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 +16 -13
- package/dist/index.cjs +811 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +811 -98
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -12,17 +12,20 @@ npm install @lydianpay/lydianconnect
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
14
14
|
```ts
|
|
15
|
-
import { LydianConnect } from
|
|
15
|
+
import { LydianConnect } from "@lydianpay/lydianconnect";
|
|
16
16
|
|
|
17
17
|
const lc = new LydianConnect({
|
|
18
|
-
appName:
|
|
19
|
-
walletConnectProjectId:
|
|
20
|
-
icon:
|
|
21
|
-
description:
|
|
18
|
+
appName: "My App",
|
|
19
|
+
walletConnectProjectId: "your-wc-project-id",
|
|
20
|
+
icon: "https://my.app/icon.png", // optional
|
|
21
|
+
description: "My App checkout", // optional
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const conn = await lc.connect({ walletId:
|
|
25
|
-
const txHash = await conn.request({
|
|
24
|
+
const conn = await lc.connect({ walletId: "metamask", chainId: 137 });
|
|
25
|
+
const txHash = await conn.request({
|
|
26
|
+
method: "eth_sendTransaction",
|
|
27
|
+
params: [tx],
|
|
28
|
+
});
|
|
26
29
|
|
|
27
30
|
lc.on((event) => {
|
|
28
31
|
// 'connect' | 'disconnect' | 'chainChanged' | 'accountsChanged' | 'display_uri' | 'wallet_open_failed'
|
|
@@ -31,12 +34,12 @@ lc.on((event) => {
|
|
|
31
34
|
|
|
32
35
|
## Config
|
|
33
36
|
|
|
34
|
-
| Field
|
|
35
|
-
|
|
36
|
-
| `appName`
|
|
37
|
-
| `walletConnectProjectId` | yes
|
|
38
|
-
| `icon`
|
|
39
|
-
| `description`
|
|
37
|
+
| Field | Required | Notes |
|
|
38
|
+
| ------------------------ | -------- | -------------------------------------------------- |
|
|
39
|
+
| `appName` | yes | Display name shown in the wallet's connect prompt. |
|
|
40
|
+
| `walletConnectProjectId` | yes | WalletConnect Cloud project id. |
|
|
41
|
+
| `icon` | no | Icon shown in the connect prompt. |
|
|
42
|
+
| `description` | no | Defaults to `appName`. |
|
|
40
43
|
|
|
41
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'`).
|
|
42
45
|
|