@temple-digital-group/temple-canton-js 2.0.0-beta.2 → 2.0.0-beta.3

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 CHANGED
@@ -22,7 +22,8 @@ For apps using Loop Wallet. Pass the Loop SDK instance as `WALLET_ADAPTER` — t
22
22
  ```javascript
23
23
  import { initialize } from "@temple-digital-group/temple-canton-js";
24
24
 
25
- await initialize({
25
+ initialize({
26
+ API_KEY: "your-api-key",
26
27
  NETWORK: "mainnet",
27
28
  WALLET_ADAPTER: loop, // Pass the Loop SDK instance
28
29
  });
@@ -38,9 +39,9 @@ setWalletAdapter(loop);
38
39
 
39
40
  | Key | Required | Description |
40
41
  | ---------------- | -------- | --------------------------------------------------------------- |
41
- | `NETWORK` | Yes | `mainnet`, `testnet`, or `localhost` |
42
+ | `API_KEY` | Yes | Temple REST API key |
43
+ | `NETWORK` | Yes | `mainnet` or `testnet` |
42
44
  | `WALLET_ADAPTER` | Yes | Loop SDK instance — auto-detects server/client mode for signing |
43
- | `API_KEY` | No | Temple REST API key for authenticated endpoints |
44
45
 
45
46
  ## Supported Instruments
46
47
 
@@ -3,11 +3,10 @@ export type { ApiError, Ticker, OrderBook, OrderBookOptions, SymbolConfig, OpenI
3
3
  export { getUserId } from "./tokenStore.js";
4
4
  export { setWalletAdapter } from "../../src/config/index.js";
5
5
  /**
6
- * Initialize the Temple SDK — sets config and authenticates with the REST API via API key.
7
- *
8
- * @returns null (config-only init). Throws no errors.
6
+ * Initialize the Temple SDK.
7
+ * API_KEY is required. Throws if not provided.
9
8
  */
10
- export declare function initialize(cfg: Record<string, unknown>): Promise<null>;
9
+ export declare function initialize(cfg: Record<string, unknown>): void;
11
10
  /**
12
11
  * Get ticker data for one or all trading pairs.
13
12
  * @param symbol - Optional symbol filter (e.g., "Amulet/USDCx")
package/dist/api/index.js CHANGED
@@ -5,11 +5,13 @@ export { getUserId } from "./tokenStore.js";
5
5
  export { setWalletAdapter } from "../../src/config/index.js";
6
6
  // ── Initialization ──
7
7
  /**
8
- * Initialize the Temple SDK — sets config and authenticates with the REST API via API key.
9
- *
10
- * @returns null (config-only init). Throws no errors.
8
+ * Initialize the Temple SDK.
9
+ * API_KEY is required. Throws if not provided.
11
10
  */
12
- export async function initialize(cfg) {
11
+ export function initialize(cfg) {
12
+ if (!cfg.API_KEY) {
13
+ throw new Error("initialize: API_KEY is required.");
14
+ }
13
15
  initializeConfig(cfg);
14
16
  if (cfg.WALLET_ADAPTER) {
15
17
  setWalletAdapter(cfg.WALLET_ADAPTER);
@@ -18,7 +20,6 @@ export async function initialize(cfg) {
18
20
  if (userIdValue) {
19
21
  setUserId(userIdValue);
20
22
  }
21
- return null;
22
23
  }
23
24
  // ── Internal helpers ──
24
25
  function handleApiError(error, context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temple-digital-group/temple-canton-js",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "JavaScript library for interacting with Temple Canton blockchain",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/api/index.ts CHANGED
@@ -57,11 +57,14 @@ export { setWalletAdapter } from "../../src/config/index.js";
57
57
  // ── Initialization ──
58
58
 
59
59
  /**
60
- * Initialize the Temple SDK — sets config and authenticates with the REST API via API key.
61
- *
62
- * @returns null (config-only init). Throws no errors.
60
+ * Initialize the Temple SDK.
61
+ * API_KEY is required. Throws if not provided.
63
62
  */
64
- export async function initialize(cfg: Record<string, unknown>): Promise<null> {
63
+ export function initialize(cfg: Record<string, unknown>): void {
64
+ if (!cfg.API_KEY) {
65
+ throw new Error("initialize: API_KEY is required.");
66
+ }
67
+
65
68
  initializeConfig(cfg);
66
69
 
67
70
  if (cfg.WALLET_ADAPTER) {
@@ -72,8 +75,6 @@ export async function initialize(cfg: Record<string, unknown>): Promise<null> {
72
75
  if (userIdValue) {
73
76
  setUserId(userIdValue);
74
77
  }
75
-
76
- return null;
77
78
  }
78
79
 
79
80
  // ── Internal helpers ──