@sodax/skills 2.0.0-rc.15 → 2.0.0-rc.17
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/package.json +1 -1
- package/skills/sodax-dapp-kit/integration/knowledge/features/bitcoin.md +1 -1
- package/skills/sodax-sdk/integration/knowledge/features/backend-api.md +3 -3
- package/skills/sodax-sdk/integration/knowledge/reference/chain-keys.md +35 -0
- package/skills/sodax-sdk/integration/knowledge/reference/public-api.md +3 -0
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ useExpiredUtxos({ params: { walletProvider, tradingAddress }, queryOptions }); /
|
|
|
25
25
|
useRenewUtxos({ mutationOptions });
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
`useEnsureRadfiAccessToken` is for raw / server-side `createIntent`: it resolves a valid Bound token to forward as `extras.bound.accessToken` (the Bitcoin-gated `bound` slot) on a `raw: true` swap intent, or as
|
|
28
|
+
`useEnsureRadfiAccessToken` is for raw / server-side `createIntent`: it resolves a valid Bound token to forward as `extras.bound.accessToken` (the Bitcoin-gated `bound` slot) on a `raw: true` swap intent, or as `bound.accessToken` on a backend createIntent DTO. See the `sodax-sdk` skill (swap feature) for the `extras.bound` slot.
|
|
29
29
|
|
|
30
30
|
## Session flow
|
|
31
31
|
|
|
@@ -53,11 +53,11 @@ const submitResult = await sodax.backendApi.submitSwapTx({
|
|
|
53
53
|
if (!submitResult.ok) return;
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
## Swap-intent request DTO — `accessToken` (Bitcoin TRADING)
|
|
56
|
+
## Swap-intent request DTO — `bound.accessToken` (Bitcoin TRADING)
|
|
57
57
|
|
|
58
|
-
`CreateIntentParamsV2` is the shared wire-level request body behind the typed `/swaps/allowance/check`, `/swaps/approve`, and `/swaps/intents` calls (the `IBackendApiV2` methods the SDK drives internally). For Bitcoin **TRADING**-mode `raw` intents
|
|
58
|
+
`CreateIntentParamsV2` is the shared wire-level request body behind the typed `/swaps/allowance/check`, `/swaps/approve`, and `/swaps/intents` calls (the `IBackendApiV2` methods the SDK drives internally). It inherits the swap extras — `partnerFee`, `srcPublicKey`, and `bound` — from `SwapExtrasV2`, the JSON-safe mirror of the SDK `SwapExtras` (`QuoteRequestV2` inherits the same trio for its `includeTxData=true` path). For Bitcoin **TRADING**-mode `raw` intents the Bound Exchange (Radfi) token is carried as `bound.accessToken` — passed in the request body instead of an `x-bound-access-token` header so it stays inside the typed DTO. Required only when the source chain is Bitcoin in TRADING mode; ignored otherwise.
|
|
59
59
|
|
|
60
|
-
You rarely build this DTO yourself: `sodax.swaps.createIntent` takes the token via the chain-key-gated `extras.bound.accessToken` slot and maps it onto `CreateIntentParamsV2.accessToken`. See [`swap.md`](swap.md) § `SwapExtras` and [`../chain-specifics.md`](../chain-specifics.md) § "Bitcoin PSBT and Bound Exchange" for the consumer-facing flow and token-injection points.
|
|
60
|
+
You rarely build this DTO yourself: `sodax.swaps.createIntent` takes the token via the chain-key-gated `extras.bound.accessToken` slot and maps it onto `CreateIntentParamsV2.bound.accessToken`. See [`swap.md`](swap.md) § `SwapExtras` and [`../chain-specifics.md`](../chain-specifics.md) § "Bitcoin PSBT and Bound Exchange" for the consumer-facing flow and token-injection points.
|
|
61
61
|
|
|
62
62
|
## Custom backend (sandbox / fixtures)
|
|
63
63
|
|
|
@@ -60,6 +60,41 @@ import {
|
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
+
## Chain metadata (`baseChainInfo`)
|
|
64
|
+
|
|
65
|
+
`baseChainInfo` (exported from `@sodax/sdk`, re-exported from `@sodax/types`) maps every `ChainKey` to a static `BaseChainInfo` record:
|
|
66
|
+
|
|
67
|
+
| Field | Type | Notes |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `name` | `string` | Human-readable chain name. |
|
|
70
|
+
| `key` | `ChainKey` | The chain key (equals the map key). |
|
|
71
|
+
| `chainId` | `string \| number` | Native chain id — number for EVM, string for non-EVM. |
|
|
72
|
+
| `type` | `ChainType` | Chain family — same value as `getChainType(key)`. |
|
|
73
|
+
| `mainnet` | `boolean` | Whether the entry is a mainnet chain. |
|
|
74
|
+
| `logo` | `string` | Default chain logo URL (see below). |
|
|
75
|
+
| `explorer` | `{ baseUrl; txUrl; addressUrl; contractUrl }` | Block-explorer URL templates. |
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { baseChainInfo, ChainKeys } from '@sodax/sdk';
|
|
79
|
+
|
|
80
|
+
const { name, logo, explorer } = baseChainInfo[ChainKeys.BASE_MAINNET];
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Chain logos
|
|
84
|
+
|
|
85
|
+
Each entry's `logo` is a default logo URL — **read `baseChainInfo[key].logo` for chain icons; never hardcode icon paths.** The URL is built from the exported `CHAIN_LOGO_BASE_URL` as `${CHAIN_LOGO_BASE_URL}/${key}.png`:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { baseChainInfo, CHAIN_LOGO_BASE_URL, ChainKeys } from '@sodax/sdk';
|
|
89
|
+
|
|
90
|
+
baseChainInfo[ChainKeys.SONIC_MAINNET].logo;
|
|
91
|
+
// → `${CHAIN_LOGO_BASE_URL}/sonic.png`
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The PNGs are hosted in the repo's `@sodax/assets` package and served from `main` via `raw.githubusercontent.com` — so a newly added logo only resolves once merged to `main`. They are not bundled into the SDK.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
63
98
|
|
|
64
99
|
## Cross-references
|
|
65
100
|
|
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
type SpokeChainKey,
|
|
27
27
|
type HubChainKey,
|
|
28
28
|
type EvmChainKey,
|
|
29
|
+
baseChainInfo, // per-chain static metadata (name, key, logo, explorer, …)
|
|
30
|
+
type BaseChainInfo,
|
|
31
|
+
CHAIN_LOGO_BASE_URL, // base URL for default chain logos — baseChainInfo[key].logo
|
|
29
32
|
getChainType,
|
|
30
33
|
isEvmChainKeyType,
|
|
31
34
|
isSolanaChainKeyType,
|