@temple-digital-group/temple-canton-js 2.1.0-beta.0 → 2.1.0
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 +21 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,10 +14,10 @@ Call `initialize()` before using any SDK functions. It sets up the config and op
|
|
|
14
14
|
|
|
15
15
|
### Wallet Adapter
|
|
16
16
|
|
|
17
|
-
For apps using a supported wallet, pass the wallet instance as `WALLET_ADAPTER` or
|
|
17
|
+
For apps using a supported wallet, just pass the wallet instance as `WALLET_ADAPTER` (or to `setWalletAdapter`). The SDK recognizes supported wallets and wraps them automatically with default settings — you don't need to call an adapter factory yourself.
|
|
18
18
|
|
|
19
|
-
- **Loop:** pass the Loop SDK instance directly
|
|
20
|
-
- **Console:** pass the Console wallet instance directly
|
|
19
|
+
- **Loop:** pass the Loop SDK instance directly. Works both in the browser and server-side (Node) — Loop signs locally on the server or delegates to the Loop Wallet UI in the browser.
|
|
20
|
+
- **Console:** **browser only** — pass the Console wallet instance directly. Reads use `getPrimaryAccount()` and `getContracts()`, and commands are submitted through Console's `prepareExecuteAndWait()` (or `prepareExecute()`) — the same Temple Daml command object Loop receives. It can't be used in a server/headless (Node) environment.
|
|
21
21
|
|
|
22
22
|
```javascript
|
|
23
23
|
import { initialize } from "@temple-digital-group/temple-canton-js";
|
|
@@ -38,6 +38,24 @@ import { setWalletAdapter } from "@temple-digital-group/temple-canton-js";
|
|
|
38
38
|
setWalletAdapter(wallet);
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
#### Adapter Factories (advanced)
|
|
42
|
+
|
|
43
|
+
You only need the `create*WalletAdapter()` factories when you want to customize how a wallet is wrapped — passing a raw instance (above) already calls them for you with defaults. When you do need custom settings, build the adapter and hand the result to `WALLET_ADAPTER` / `setWalletAdapter`:
|
|
44
|
+
|
|
45
|
+
- `createLoopWalletAdapter(loop)` — normalize a Loop instance (no extra options).
|
|
46
|
+
- `createConsoleWalletAdapter(consoleWallet, options?)` — normalize a Console instance (browser only) with optional overrides:
|
|
47
|
+
- `network` — Console network variant (`CANTON_NETWORK`, `CANTON_NETWORK_TEST`, `CANTON_NETWORK_DEV`); defaults from `NETWORK`.
|
|
48
|
+
- `partyId` — seed a synchronous party id instead of resolving it from `getPrimaryAccount()`.
|
|
49
|
+
- `parties` — explicit read parties (defaults to the active account party).
|
|
50
|
+
- `waitForExecution` — `true` (default) submits via `prepareExecuteAndWait()`; `false` uses `prepareExecute()`.
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
import { setWalletAdapter, createConsoleWalletAdapter } from "@temple-digital-group/temple-canton-js";
|
|
54
|
+
|
|
55
|
+
// Only needed for custom options — otherwise just pass the raw instance.
|
|
56
|
+
setWalletAdapter(createConsoleWalletAdapter(consoleWallet, { network: "mainnet" }));
|
|
57
|
+
```
|
|
58
|
+
|
|
41
59
|
| Key | Required | Description |
|
|
42
60
|
| ---------------- | -------- | ------------------------------------------------- |
|
|
43
61
|
| `API_KEY` | Yes | Temple REST API key |
|