@capxul/sdk 2.3.1 → 2.4.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 +22 -0
- package/dist/{create-capxul-client-DTQDSOvO.mjs → create-capxul-client-BrE6tLg6.mjs} +1360 -1365
- package/dist/index.d.mts +39 -4
- package/dist/index.mjs +93 -9
- package/dist/node/index.d.mts +1 -1
- package/dist/{observation-Ci8gIQjm.d.mts → observation-BfCkJY5z.d.mts} +121 -36
- package/dist/{signer-BejoR3bA.d.mts → signer-BGTaqZqg.d.mts} +1 -2
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.mjs +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -43,6 +43,28 @@ if ("kind" in amount) {
|
|
|
43
43
|
`parseMoney` returns validation errors as values. `formatMoney` rejects a
|
|
44
44
|
malformed `Money` record with `INVALID_INPUT`.
|
|
45
45
|
|
|
46
|
+
## The asset a screen shows
|
|
47
|
+
|
|
48
|
+
`holdings.primary` picks the one asset a hero balance or a summary total
|
|
49
|
+
should show. It returns the renderable holding with the largest available
|
|
50
|
+
balance. A chain row that carries no `decimals`, no `symbol`, or a symbol that
|
|
51
|
+
stands for no supported currency is skipped, because it cannot be rendered.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { formatMoney, type Holding } from "@capxul/sdk";
|
|
55
|
+
|
|
56
|
+
const result = await client.holdings.primary();
|
|
57
|
+
|
|
58
|
+
if (result.ok && result.value !== null) {
|
|
59
|
+
const holding: Holding = result.value;
|
|
60
|
+
console.log(holding.symbol); // "USDX" — the token symbol the chain reported
|
|
61
|
+
console.log(formatMoney(holding.available, { grammar: "code" })); // e.g. "1,250.50 USD"
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`null` means no row is renderable. It is a value, not an error, so give the
|
|
66
|
+
screen its own rule for showing nothing.
|
|
67
|
+
|
|
46
68
|
## Observability
|
|
47
69
|
|
|
48
70
|
Hosts can attach the PostHog client they already initialized through one
|