@deloraprotocol/widget 1.0.0 → 1.0.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.
package/README.md CHANGED
@@ -20,26 +20,29 @@ import "@deloraprotocol/widget/styles.css";
20
20
 
21
21
  ## Usage
22
22
 
23
- ### Trade Widget
24
-
25
- ```tsx
23
+ ### Trade Widget
24
+
25
+ ```tsx
26
26
  import { TradeWidget } from "@deloraprotocol/widget";
27
-
28
- <TradeWidget
29
- theme="dark"
30
- config={{
31
- dataBaseUrl: "https://your-app.com", // or "" for same-origin
32
- apiBase: "https://api.delora.build",
33
- }}
34
- />
35
- ```
36
-
37
- `dataBaseUrl` must point to a server that hosts:
38
- - `/data/networks.json`
39
- - `/data/tokens.json`
40
- - `/data/tokens_search.json`
41
-
42
- Use `""` for same-origin (e.g. when data is in your app's public folder).
27
+
28
+ <TradeWidget
29
+ theme="dark"
30
+ config={{
31
+ apiBase: "https://api.delora.build",
32
+ }}
33
+ />
34
+ ```
35
+
36
+ `apiBase` is used for:
37
+ - `/v1/chains`
38
+ - `/v1/tokens`
39
+ - `/v1/quotes`
40
+
41
+ If omitted, the widget defaults to `https://api.delora.build`.
42
+
43
+ `dataBaseUrl` is no longer required for metadata fetching. Keep it only if you need
44
+ to resolve relative image URLs from a custom source. For explicit control over image
45
+ resolution, pass `assetBaseUrl`.
43
46
 
44
47
  ### Simple Widget (MyWidget)
45
48
 
@@ -161,7 +164,7 @@ cd playground && npm install
161
164
  npm run playground:dev
162
165
  ```
163
166
 
164
- This runs the library watcher and the playground dev server together. The playground uses the built output from `dist/`.
167
+ This runs the library watcher and the playground dev server together. The playground uses the built output from `dist/`.
165
168
 
166
169
  **When errors occur or the UI shows stale/broken code:** run `npm run build` separately to rebuild the library, then restart or refresh the playground. The playground does not auto-rebuild the library.
167
170
 
package/dist/index.d.ts CHANGED
@@ -62,9 +62,11 @@ export declare interface Token {
62
62
  export declare function TradeWidget(props: TradeWidgetProps): JSX.Element;
63
63
 
64
64
  export declare interface TradeWidgetConfig {
65
- dataBaseUrl: string;
65
+ /** Legacy asset base or custom relative-image base. Metadata is loaded from apiBase/v1/... */
66
+ dataBaseUrl?: string;
67
+ /** Base URL of Delora API used for chains, tokens, and quotes. Defaults to https://api.delora.build */
66
68
  apiBase?: string;
67
- /** Base URL for resolving relative image paths (e.g. /img/...). Defaults to dataBaseUrl or origin. */
69
+ /** Base URL for resolving relative image paths (e.g. /img/...). Defaults to dataBaseUrl, apiBase, or origin. */
68
70
  assetBaseUrl?: string;
69
71
  /** Whether a wallet is connected. When false, the main button shows "Connect Wallet" (Angular: isWalletConnected). */
70
72
  isWalletConnected?: boolean;