@effectstream/wallets 0.102.0 → 0.103.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.
Files changed (2) hide show
  1. package/README.md +40 -19
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  Browser wallet connectors and the runtime client an EffectStream
4
4
  frontend uses to log in, sign batcher messages, send transactions, and
5
5
  wait for them to be processed. Spans MetaMask (and any EVM-injected
6
- wallet), Cardano (CIP-30), Midnight, Mina, Polkadot, Algorand, and
7
- Avail.
6
+ wallet), Cardano (CIP-30), Midnight, Mina, Polkadot, Algorand, Avail,
7
+ and Solana.
8
8
 
9
9
  - Browser wallet connectors plus the runtime client a frontend uses to log in, sign, and submit.
10
- - Spans MetaMask + injected EVM, Cardano (CIP-30), Midnight, Mina, Polkadot, Algorand, Avail.
10
+ - Spans MetaMask + injected EVM, Cardano (CIP-30), Midnight, Mina, Polkadot, Algorand, Avail, Solana.
11
11
  - Used together with `@effectstream/crypto` (server-side verification).
12
12
  - High-level helpers `walletLogin` and `sendTransaction` hide the polling loop.
13
13
  - Also supports **local (in-browser) wallets** that need no extension: `CardanoLocal`, `EvmViem`, `MidnightLocal`.
@@ -32,17 +32,29 @@ import {
32
32
  EffectstreamConfig,
33
33
  sendTransaction,
34
34
  } from "@effectstream/wallets";
35
-
36
- const config = new EffectstreamConfig({ /* …chain/batcher URLs… */ });
37
-
38
- const wallet = await walletLogin({
39
- config,
40
- preference: { name: "MetaMask" },
35
+ import { hardhat } from "viem/chains";
36
+
37
+ // The constructor takes positional arguments, not an options object.
38
+ const config = new EffectstreamConfig(
39
+ "my-app", // securityNamespace — must match the node's
40
+ "parallelEvmRPC", // effectstreamL2SyncProtocolName
41
+ "0x5FbDB2315678afecb367f032d93F642f64180aa3", // L2 contract address
42
+ hardhat, // viem Chain
43
+ undefined, // L2 ABI (undefined → built-in fallback ABI)
44
+ "http://localhost:3334", // batcherURL (required when batching)
45
+ true, // preferBatchedMode
46
+ );
47
+
48
+ const result = await walletLogin({
41
49
  mode: WalletMode.EvmInjected,
50
+ preference: { name: "MetaMask" },
51
+ preferBatchedMode: true,
42
52
  });
53
+ if (!result.success) throw new Error("login failed");
54
+ const wallet = result.result;
43
55
 
44
- const result = await sendTransaction(wallet, "join|alice");
45
- // result.blockHeight === number once the batcher's submission landed
56
+ // conciseData is the grammar tuple as an array; config is a required argument.
57
+ const tx = await sendTransaction(wallet, ["join", "alice"], config);
46
58
  ```
47
59
 
48
60
  If you just want to discover available wallets:
@@ -72,6 +84,12 @@ and `sendTransaction` work identically:
72
84
  - `WalletMode.EvmViem` - viem account from a `0x` private key.
73
85
  - `WalletMode.MidnightLocal` - hex seed generated in-browser.
74
86
 
87
+ Solana ships its connector on two dedicated subpaths rather than through the
88
+ package root: `@effectstream/wallets/solana` (`SolanaConnector`,
89
+ `SolanaProvider`, `SolanaWalletApi` — for injected wallets such as Phantom)
90
+ and `@effectstream/wallets/solana-local` (`SolanaLocalConnector`,
91
+ `SolanaLocalProvider` — the in-browser local wallet).
92
+
75
93
  ```typescript
76
94
  import { walletLogin, WalletMode, signMessage } from "@effectstream/wallets";
77
95
 
@@ -115,14 +133,14 @@ Login + signing:
115
133
 
116
134
  Sending transactions:
117
135
 
118
- - `sendTransaction(wallet, conciseInput, opts?)`: submit through the batcher and (by default) wait for processing.
136
+ - `sendTransaction(wallet, conciseData, config, waitForConfirmation?, batcherTarget?)`: submit through the batcher (or self-sequence, depending on `config.preferBatchedMode`) and, by default, wait for processing. `conciseData` is the grammar tuple as an array; `config` is a required `EffectstreamConfig`.
119
137
  - `sendBatcherTransaction(...)`: explicit batcher submission.
120
138
  - `sendSelfSequencedTransaction(...)` bypasses the batcher.
121
139
  - `waitForEffectstreamBlockProcessed(...)` - block-height poller used by the above.
122
140
 
123
141
  Wallet discovery / identification:
124
142
 
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.
143
+ - `WalletMode`: enum of `EvmInjected`, `EvmEthers`, `EvmViem`, `Midnight`, `MidnightLocal`, `Cardano`, `CardanoLocal`, `Polkadot`, `Algorand`, `Mina`, `AvailJs`, `Solana`. The `*Local` and `EvmViem` modes are in-browser wallets that need no extension.
126
144
  - `WalletNameMap`: `Record<WalletMode, string>` for display.
127
145
  - `allInjectedWallets(config)` lists installed wallets in the browser.
128
146
  - `getAddressType(walletMode)` maps a `WalletMode` to its `@effectstream/utils` `AddressType`.
@@ -130,12 +148,15 @@ Wallet discovery / identification:
130
148
  Types:
131
149
 
132
150
  - `Wallet`: handle returned by `walletLogin`, used by send/sign helpers.
133
- - `UserSignature`, `Hash`, `BatcherPostResponse`, `BatcherTrackResponse`, `PostDataResponse`, `PostDataResponseAsync`, `SignFunction`.
134
-
135
- Lower-level connector machinery (used internally; export surface is
136
- stable but rarely needed in app code): `connectInjectedWallet`,
137
- `WalletModeMap`, `IProvider`, `IConnector`, `IInjectedConnector`,
138
- `InjectionPreference`.
151
+ - `UserSignature`, `AddressAndType`, `WalletOption`, `IProvider`, `LoginInfo`, `LoginInfoMap`.
152
+
153
+ > **Not re-exported from the package root.** These exist in the source but are
154
+ > not part of the entry point, so they cannot be imported from
155
+ > `@effectstream/wallets` today: `Hash`, `BatcherPostResponse`,
156
+ > `BatcherTrackResponse`, `PostDataResponse`, `PostDataResponseAsync`,
157
+ > `SignFunction` (all in `src/types.ts`); `connectInjectedWallet`,
158
+ > `WalletModeMap`, `InjectionPreference` (`src/utils.ts`); and `IConnector`,
159
+ > `IInjectedConnector` (`src/IProvider.ts`).
139
160
 
140
161
  ## Examples
141
162
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectstream/wallets",
3
- "version": "0.102.0",
3
+ "version": "0.103.1",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "homepage": "https://effectstream.github.io/docs/",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  "./solana-local": "./src/solana/local.ts"
21
21
  },
22
22
  "peerDependencies": {
23
- "@effectstream/midnight-contracts": "0.102.0",
23
+ "@effectstream/midnight-contracts": "0.103.1",
24
24
  "@lucid-evolution/lucid": "^0.4.29",
25
25
  "@lucid-evolution/provider": "^0.1.90",
26
26
  "@lucid-evolution/utils": "^0.1.66",
@@ -52,7 +52,7 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@effectstream/midnight-contracts": "0.102.0",
55
+ "@effectstream/midnight-contracts": "0.103.1",
56
56
  "@lucid-evolution/lucid": "^0.4.30",
57
57
  "@lucid-evolution/provider": "^0.1.91",
58
58
  "@lucid-evolution/utils": "^0.1.66",
@@ -61,10 +61,10 @@
61
61
  "@midnightntwrk/wallet-sdk-unshielded-wallet": "3.1.0"
62
62
  },
63
63
  "dependencies": {
64
- "@effectstream/concise": "0.102.0",
65
- "@effectstream/crypto": "0.102.0",
66
- "@effectstream/event-client": "0.102.0",
67
- "@effectstream/utils": "0.102.0",
64
+ "@effectstream/concise": "0.103.1",
65
+ "@effectstream/crypto": "0.103.1",
66
+ "@effectstream/event-client": "0.103.1",
67
+ "@effectstream/utils": "0.103.1",
68
68
  "@aurowallet/mina-provider": "^1.0.12",
69
69
  "@metamask/providers": "^22.1.0",
70
70
  "@midnight-ntwrk/dapp-connector-api": "4.0.1",