@effectstream/frontend-sdk 0.100.14 → 0.100.16
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 +77 -0
- package/dist/mod.js +4 -4
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @effectstream/frontend-sdk
|
|
2
|
+
|
|
3
|
+
Umbrella name for EffectStream's frontend code. Currently re-exports
|
|
4
|
+
everything from `@effectstream/wallets`. Depend on this if you want a
|
|
5
|
+
stable frontend namespace; import `@effectstream/wallets` directly if
|
|
6
|
+
you prefer.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bun add @effectstream/frontend-sdk
|
|
12
|
+
# or
|
|
13
|
+
npm install @effectstream/frontend-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
The export surface is exactly `@effectstream/wallets`:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import {
|
|
22
|
+
allInjectedWallets,
|
|
23
|
+
walletLogin,
|
|
24
|
+
WalletMode,
|
|
25
|
+
} from "@effectstream/frontend-sdk";
|
|
26
|
+
|
|
27
|
+
const available = await allInjectedWallets({
|
|
28
|
+
signatureSupport: true,
|
|
29
|
+
transactionSupport: true,
|
|
30
|
+
});
|
|
31
|
+
const evmOption = available[WalletMode.EvmInjected][0];
|
|
32
|
+
|
|
33
|
+
const { provider, signedLogin } = await walletLogin({
|
|
34
|
+
preference: { name: evmOption.metadata.name },
|
|
35
|
+
mode: WalletMode.EvmInjected,
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **Browser only.** Like `@effectstream/wallets`, this package depends
|
|
40
|
+
> on injected wallet APIs (`window.ethereum`, CIP-30, …) and won't load
|
|
41
|
+
> in plain Node.
|
|
42
|
+
|
|
43
|
+
## Inside EffectStream
|
|
44
|
+
|
|
45
|
+
A thin re-export of `@effectstream/wallets`. If/when frontend-only
|
|
46
|
+
helpers (React context providers, batcher submission hooks, event
|
|
47
|
+
subscribers wired to React) ship, they'll live here without breaking
|
|
48
|
+
app code that depended on the umbrella name.
|
|
49
|
+
|
|
50
|
+
## Key exports
|
|
51
|
+
|
|
52
|
+
Everything `@effectstream/wallets` exports. The most-imported symbols
|
|
53
|
+
across templates are:
|
|
54
|
+
|
|
55
|
+
- `walletLogin(...)` — one-call wallet connection + signed batcher message.
|
|
56
|
+
- `WalletMode` — enum of supported wallet types.
|
|
57
|
+
- `Wallet` — type for a connected wallet.
|
|
58
|
+
- `EffectstreamConfig` — runtime config the wallet helpers consume.
|
|
59
|
+
- `sendTransaction`, `sendBatcherTransaction`, `signMessage`, `waitForEffectstreamBlockProcessed` — send/wait helpers.
|
|
60
|
+
- `allInjectedWallets`, `getAddressType`, `WalletNameMap` — discovery + identification helpers.
|
|
61
|
+
|
|
62
|
+
For lower-level connector machinery (`connectInjectedWallet`,
|
|
63
|
+
`WalletModeMap`, `IProvider`, `IConnector`, `IInjectedConnector`), import
|
|
64
|
+
from `@effectstream/wallets` directly.
|
|
65
|
+
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
Runnable: [`test/examples.test.ts`](./test/examples.test.ts).
|
|
69
|
+
|
|
70
|
+
Real-world: every frontend in
|
|
71
|
+
[`templates/`](https://github.com/effectstream/effectstream/tree/main/templates)
|
|
72
|
+
demonstrates the same surface.
|
|
73
|
+
|
|
74
|
+
## Links
|
|
75
|
+
|
|
76
|
+
- Docs: https://effectstream.github.io/docs/packages/tools/frontend-sdk
|
|
77
|
+
- Source: https://github.com/effectstream/effectstream/tree/main/packages/frontend
|
package/dist/mod.js
CHANGED
|
@@ -21013,7 +21013,7 @@ class EventManager {
|
|
|
21013
21013
|
import { Kind, Type as Type8 } from "@sinclair/typebox";
|
|
21014
21014
|
// ../effectstream-sdk/wallets/src/effectstream.ts
|
|
21015
21015
|
class EffectstreamConfig {
|
|
21016
|
-
|
|
21016
|
+
securityNamespace;
|
|
21017
21017
|
effectstreamL2SyncProtocolName;
|
|
21018
21018
|
effectstreamL2ContractAddress;
|
|
21019
21019
|
effectstreamL2Abi;
|
|
@@ -21022,8 +21022,8 @@ class EffectstreamConfig {
|
|
|
21022
21022
|
web3 = undefined;
|
|
21023
21023
|
batcherURL = undefined;
|
|
21024
21024
|
preferBatchedMode = false;
|
|
21025
|
-
constructor(
|
|
21026
|
-
this.
|
|
21025
|
+
constructor(securityNamespace, effectstreamL2SyncProtocolName, effectstreamL2ContractAddress, effectstreamL2Chain, effectstreamL2Abi, batcherURL, preferBatchedMode = false) {
|
|
21026
|
+
this.securityNamespace = securityNamespace && securityNamespace.length > 0 ? securityNamespace : null;
|
|
21027
21027
|
this.effectstreamL2SyncProtocolName = effectstreamL2SyncProtocolName;
|
|
21028
21028
|
this.effectstreamL2ContractAddress = effectstreamL2ContractAddress;
|
|
21029
21029
|
this.effectstreamL2Abi = effectstreamL2Abi ?? this.fallbackABI();
|
|
@@ -21155,7 +21155,7 @@ async function sendBatcherTransaction(wallet, conciseData, effectstreamConfig, w
|
|
|
21155
21155
|
}
|
|
21156
21156
|
const conciseDataStr = JSON.stringify(conciseData);
|
|
21157
21157
|
const timestamp2 = Date.now().toString();
|
|
21158
|
-
const signature = await wallet.provider.signMessage(createMessageForBatcher(effectstreamConfig.
|
|
21158
|
+
const signature = await wallet.provider.signMessage(createMessageForBatcher(effectstreamConfig.securityNamespace, timestamp2, wallet.provider.getAddress().address, wallet.provider.getAddress().type, conciseDataStr, batcherTarget));
|
|
21159
21159
|
const response = await fetch(`${effectstreamConfig.batcherURL}/send-input`, {
|
|
21160
21160
|
method: "POST",
|
|
21161
21161
|
headers: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectstream/frontend-sdk",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://effectstream.github.io/docs/",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "bun run build.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@effectstream/wallets": "0.100.
|
|
30
|
+
"@effectstream/wallets": "0.100.16"
|
|
31
31
|
},
|
|
32
32
|
"description": "React frontend SDK for EffectStream"
|
|
33
33
|
}
|