@xrpl-wallet-kit/adapter-xrpl-snap 0.1.13 → 0.1.14
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 +60 -60
- package/package.json +45 -45
package/README.md
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
# @xrpl-wallet-kit/adapter-xrpl-snap
|
|
2
|
-
|
|
3
|
-
MetaMask XRPL Snap adapter for XRPL Wallet Kit.
|
|
4
|
-
|
|
5
|
-
This adapter uses the EIP-1193 `ethereum.request()` interface to install/invoke an XRPL Snap and expose it through the XRPL Wallet Kit adapter contract.
|
|
6
|
-
|
|
7
|
-
## Capabilities
|
|
8
|
-
|
|
9
|
-
- `connect`
|
|
10
|
-
- `signMessage`
|
|
11
|
-
- `signAndSubmit`
|
|
12
|
-
- `payments`
|
|
13
|
-
- `nftOffers`
|
|
14
|
-
|
|
15
|
-
## Install
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install @xrpl-wallet-kit/adapter-xrpl-snap
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
import { createWalletKit } from "@xrpl-wallet-kit/client";
|
|
25
|
-
import { createXrplSnapAdapter } from "@xrpl-wallet-kit/adapter-xrpl-snap";
|
|
26
|
-
|
|
27
|
-
const kit = createWalletKit({
|
|
28
|
-
adapters: [createXrplSnapAdapter()]
|
|
29
|
-
});
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
When using `@xrpl-wallet-kit/client` defaults, the XRPL Snap adapter is already included.
|
|
33
|
-
|
|
34
|
-
## Runtime Notes
|
|
35
|
-
|
|
36
|
-
- Requires MetaMask with Snaps support.
|
|
37
|
-
- `isAvailable()` verifies Snaps support with `wallet_getSnaps`; providers that expose `window.ethereum` but do not support Snaps are treated as unavailable.
|
|
38
|
-
- When multiple browser wallets are installed, the adapter prefers a MetaMask provider from `window.ethereum.providers` or EIP-6963 before falling back to `window.ethereum`. EIP-6963 announcements are cached so MetaMask can still be selected when wallets such as OKX own `window.ethereum`.
|
|
39
|
-
- Default snap id is `npm:xrpl-snap`.
|
|
40
|
-
- `connect()` calls `wallet_requestSnaps` and then invokes the snap to fetch the XRPL account.
|
|
41
|
-
- `signMessage()` uses a transaction-style proof flow because Snap message-signing support can vary.
|
|
42
|
-
- `signAndSubmit()` invokes the snap and normalizes the result with `normalizeTxResult()`.
|
|
43
|
-
|
|
44
|
-
If you see `the method wallet_requestSnaps does not exist/is not available`, the active provider is not a MetaMask Snaps-capable provider. Use MetaMask desktop with Snaps enabled, and check that another injected wallet such as OKX is not taking over `window.ethereum`.
|
|
45
|
-
|
|
46
|
-
## Testing
|
|
47
|
-
|
|
48
|
-
Pass a mock EIP-1193 provider for isolated tests:
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
import { assertWalletAdapter } from "@xrpl-wallet-kit/core";
|
|
52
|
-
import { createXrplSnapAdapter } from "@xrpl-wallet-kit/adapter-xrpl-snap";
|
|
53
|
-
|
|
54
|
-
assertWalletAdapter(createXrplSnapAdapter({ ethereum: mockEthereum }));
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Links
|
|
58
|
-
|
|
59
|
-
- MetaMask Snaps: https://metamask.io/snaps/
|
|
60
|
-
- XRPL Wallet Kit: https://github.com/XRPDomains/xrpl-wallet-kit
|
|
1
|
+
# @xrpl-wallet-kit/adapter-xrpl-snap
|
|
2
|
+
|
|
3
|
+
MetaMask XRPL Snap adapter for XRPL Wallet Kit.
|
|
4
|
+
|
|
5
|
+
This adapter uses the EIP-1193 `ethereum.request()` interface to install/invoke an XRPL Snap and expose it through the XRPL Wallet Kit adapter contract.
|
|
6
|
+
|
|
7
|
+
## Capabilities
|
|
8
|
+
|
|
9
|
+
- `connect`
|
|
10
|
+
- `signMessage`
|
|
11
|
+
- `signAndSubmit`
|
|
12
|
+
- `payments`
|
|
13
|
+
- `nftOffers`
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @xrpl-wallet-kit/adapter-xrpl-snap
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createWalletKit } from "@xrpl-wallet-kit/client";
|
|
25
|
+
import { createXrplSnapAdapter } from "@xrpl-wallet-kit/adapter-xrpl-snap";
|
|
26
|
+
|
|
27
|
+
const kit = createWalletKit({
|
|
28
|
+
adapters: [createXrplSnapAdapter()]
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
When using `@xrpl-wallet-kit/client` defaults, the XRPL Snap adapter is already included.
|
|
33
|
+
|
|
34
|
+
## Runtime Notes
|
|
35
|
+
|
|
36
|
+
- Requires MetaMask with Snaps support.
|
|
37
|
+
- `isAvailable()` verifies Snaps support with `wallet_getSnaps`; providers that expose `window.ethereum` but do not support Snaps are treated as unavailable.
|
|
38
|
+
- When multiple browser wallets are installed, the adapter prefers a MetaMask provider from `window.ethereum.providers` or EIP-6963 before falling back to `window.ethereum`. EIP-6963 announcements are cached so MetaMask can still be selected when wallets such as OKX own `window.ethereum`.
|
|
39
|
+
- Default snap id is `npm:xrpl-snap`.
|
|
40
|
+
- `connect()` calls `wallet_requestSnaps` and then invokes the snap to fetch the XRPL account.
|
|
41
|
+
- `signMessage()` uses a transaction-style proof flow because Snap message-signing support can vary.
|
|
42
|
+
- `signAndSubmit()` invokes the snap and normalizes the result with `normalizeTxResult()`.
|
|
43
|
+
|
|
44
|
+
If you see `the method wallet_requestSnaps does not exist/is not available`, the active provider is not a MetaMask Snaps-capable provider. Use MetaMask desktop with Snaps enabled, and check that another injected wallet such as OKX is not taking over `window.ethereum`.
|
|
45
|
+
|
|
46
|
+
## Testing
|
|
47
|
+
|
|
48
|
+
Pass a mock EIP-1193 provider for isolated tests:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { assertWalletAdapter } from "@xrpl-wallet-kit/core";
|
|
52
|
+
import { createXrplSnapAdapter } from "@xrpl-wallet-kit/adapter-xrpl-snap";
|
|
53
|
+
|
|
54
|
+
assertWalletAdapter(createXrplSnapAdapter({ ethereum: mockEthereum }));
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Links
|
|
58
|
+
|
|
59
|
+
- MetaMask Snaps: https://metamask.io/snaps/
|
|
60
|
+
- XRPL Wallet Kit: https://github.com/XRPDomains/xrpl-wallet-kit
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xrpl-wallet-kit/adapter-xrpl-snap",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "MetaMask XRPL Snap adapter for XRPL Wallet Kit.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist",
|
|
17
|
-
"README.md"
|
|
18
|
-
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc -p tsconfig.json"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@xrpl-wallet-kit/core": "0.1.
|
|
24
|
-
},
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/XRPDomains/xrpl-wallet-kit.git"
|
|
31
|
-
},
|
|
32
|
-
"homepage": "https://github.com/XRPDomains/xrpl-wallet-kit#readme",
|
|
33
|
-
"bugs": {
|
|
34
|
-
"url": "https://github.com/XRPDomains/xrpl-wallet-kit/issues"
|
|
35
|
-
},
|
|
36
|
-
"keywords": [
|
|
37
|
-
"xrpl",
|
|
38
|
-
"wallet",
|
|
39
|
-
"wallet-adapter",
|
|
40
|
-
"wallet-kit",
|
|
41
|
-
"xrp-ledger",
|
|
42
|
-
"web3",
|
|
43
|
-
"adapter"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xrpl-wallet-kit/adapter-xrpl-snap",
|
|
3
|
+
"version": "0.1.14",
|
|
4
|
+
"description": "MetaMask XRPL Snap adapter for XRPL Wallet Kit.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@xrpl-wallet-kit/core": "0.1.14"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/XRPDomains/xrpl-wallet-kit.git"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/XRPDomains/xrpl-wallet-kit#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/XRPDomains/xrpl-wallet-kit/issues"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"xrpl",
|
|
38
|
+
"wallet",
|
|
39
|
+
"wallet-adapter",
|
|
40
|
+
"wallet-kit",
|
|
41
|
+
"xrp-ledger",
|
|
42
|
+
"web3",
|
|
43
|
+
"adapter"
|
|
44
|
+
]
|
|
45
|
+
}
|