@effectstream/wallets 0.100.22 → 0.100.23
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 +36 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Avail.
|
|
|
10
10
|
- Spans MetaMask + injected EVM, Cardano (CIP-30), Midnight, Mina, Polkadot, Algorand, Avail.
|
|
11
11
|
- Used together with `@effectstream/crypto` (server-side verification).
|
|
12
12
|
- High-level helpers `walletLogin` and `sendTransaction` hide the polling loop.
|
|
13
|
+
- Also supports **local (in-browser) wallets** that need no extension: `CardanoLocal`, `EvmViem`, `MidnightLocal`.
|
|
13
14
|
|
|
14
15
|
## Install
|
|
15
16
|
|
|
@@ -60,6 +61,40 @@ const evmOptions = available[WalletMode.EvmInjected]; // [{ metadata, ... }, …
|
|
|
60
61
|
> Cardano CIP-30 API, etc. - it won't load in plain Node. Server-side
|
|
61
62
|
> signature verification is `@effectstream/crypto`.
|
|
62
63
|
|
|
64
|
+
## Local wallets (no extension required)
|
|
65
|
+
|
|
66
|
+
Besides connecting an injected/extension wallet, `@effectstream/wallets`
|
|
67
|
+
can generate and manage a key-pair **locally, in the browser**. The local
|
|
68
|
+
modes return the same `Wallet` handle as the injected ones, so `signMessage`
|
|
69
|
+
and `sendTransaction` work identically:
|
|
70
|
+
|
|
71
|
+
- `WalletMode.CardanoLocal` - BIP-39 seed generated in-browser (via Lucid).
|
|
72
|
+
- `WalletMode.EvmViem` - viem account from a `0x` private key.
|
|
73
|
+
- `WalletMode.MidnightLocal` - hex seed generated in-browser.
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { walletLogin, WalletMode, signMessage } from "@effectstream/wallets";
|
|
77
|
+
|
|
78
|
+
// A fresh BIP-39 seed is generated in the browser when `seedPhrase` is omitted.
|
|
79
|
+
const wallet = await walletLogin({
|
|
80
|
+
mode: WalletMode.CardanoLocal,
|
|
81
|
+
network: "Preview", // "Mainnet" | "Preprod" | "Preview" | "Custom"
|
|
82
|
+
});
|
|
83
|
+
if (!wallet.success) throw new Error(wallet.errorMessage);
|
|
84
|
+
|
|
85
|
+
wallet.result.walletAddress; // addr_test1...
|
|
86
|
+
const signature = await signMessage(wallet.result, "hello effectstream");
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
These modes need no browser extension (no `window.ethereum`, no CIP-30) -
|
|
90
|
+
the key material is created client-side and never touches a server. Pair a
|
|
91
|
+
local key with the account-linking delegation (`&linkAddress`) so a real
|
|
92
|
+
wallet (Cardano CIP-30, MetaMask, ...) can authorise it to sign
|
|
93
|
+
non-financial inputs: this is the basis of the device-key / frictionless
|
|
94
|
+
signing flow. Source: [`src/cardano/local.ts`](https://github.com/effectstream/effectstream/blob/main/packages/effectstream-sdk/wallets/src/cardano/local.ts)
|
|
95
|
+
and the runnable [`src/cardano/local.test.ts`](https://github.com/effectstream/effectstream/blob/main/packages/effectstream-sdk/wallets/src/cardano/local.test.ts)
|
|
96
|
+
(generate -> sign -> verify with `@effectstream/crypto`).
|
|
97
|
+
|
|
63
98
|
## Inside EffectStream
|
|
64
99
|
|
|
65
100
|
The client-side counterpart to `@effectstream/crypto`. Frontends
|
|
@@ -87,7 +122,7 @@ Sending transactions:
|
|
|
87
122
|
|
|
88
123
|
Wallet discovery / identification:
|
|
89
124
|
|
|
90
|
-
- `WalletMode`: enum of `EvmInjected`, `EvmEthers`, `
|
|
125
|
+
- `WalletMode`: enum of `EvmInjected`, `EvmEthers`, `EvmViem`, `Cardano`, `CardanoLocal`, `Midnight`, `MidnightLocal`, `Polkadot`, `Algorand`, `Mina`, `AvailJs`. The `*Local` and `EvmViem` modes are in-browser wallets that need no extension.
|
|
91
126
|
- `WalletNameMap`: `Record<WalletMode, string>` for display.
|
|
92
127
|
- `allInjectedWallets(config)` lists installed wallets in the browser.
|
|
93
128
|
- `getAddressType(walletMode)` maps a `WalletMode` to its `@effectstream/utils` `AddressType`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectstream/wallets",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://effectstream.github.io/docs/",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"./midnight-local": "./src/midnight/local.ts"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@effectstream/midnight-contracts": "0.100.
|
|
21
|
+
"@effectstream/midnight-contracts": "0.100.23",
|
|
22
22
|
"@lucid-evolution/lucid": "^0.4.29",
|
|
23
23
|
"@lucid-evolution/provider": "^0.1.90",
|
|
24
24
|
"@lucid-evolution/utils": "^0.1.66",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@effectstream/midnight-contracts": "0.100.
|
|
53
|
+
"@effectstream/midnight-contracts": "0.100.23",
|
|
54
54
|
"@lucid-evolution/lucid": "^0.4.30",
|
|
55
55
|
"@lucid-evolution/provider": "^0.1.91",
|
|
56
56
|
"@lucid-evolution/utils": "^0.1.66",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@midnight-ntwrk/wallet-sdk-unshielded-wallet": "2.1.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@effectstream/concise": "0.100.
|
|
63
|
-
"@effectstream/crypto": "0.100.
|
|
64
|
-
"@effectstream/event-client": "0.100.
|
|
65
|
-
"@effectstream/utils": "0.100.
|
|
62
|
+
"@effectstream/concise": "0.100.23",
|
|
63
|
+
"@effectstream/crypto": "0.100.23",
|
|
64
|
+
"@effectstream/event-client": "0.100.23",
|
|
65
|
+
"@effectstream/utils": "0.100.23",
|
|
66
66
|
"@aurowallet/mina-provider": "^1.0.12",
|
|
67
67
|
"@metamask/providers": "^22.1.0",
|
|
68
68
|
"@midnight-ntwrk/dapp-connector-api": "4.0.1",
|