@reserve-protocol/sdk 0.0.2 → 0.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 +15 -9
- package/dist/index.d.mts +4854 -1230
- package/dist/index.mjs +2483 -1870
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,10 +4,12 @@ Core TypeScript SDK for DTF integrations.
|
|
|
4
4
|
|
|
5
5
|
This package is environment-agnostic. It should work in modern Node, browser apps, React wrappers, scripts, and bots.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Implemented SDK product surface:
|
|
8
8
|
|
|
9
9
|
- Index DTFs: Ethereum mainnet, Base, BSC.
|
|
10
|
-
-
|
|
10
|
+
- Account portfolio API reads: current portfolio, historical portfolio, and transactions.
|
|
11
|
+
|
|
12
|
+
Yield DTF catalog entries and subgraph defaults exist for Ethereum mainnet and Base, but `sdk.yield.get` and `sdk.yield.list` are not implemented yet.
|
|
11
13
|
|
|
12
14
|
## Usage
|
|
13
15
|
|
|
@@ -21,15 +23,15 @@ const dtf = await sdk.index.get({
|
|
|
21
23
|
chainId: 8453,
|
|
22
24
|
});
|
|
23
25
|
|
|
24
|
-
const
|
|
26
|
+
const indexDtf = sdk.index.ref({
|
|
25
27
|
address: "0x...",
|
|
26
28
|
chainId: 8453,
|
|
27
29
|
});
|
|
28
30
|
|
|
29
|
-
const proposals = await
|
|
30
|
-
const price = await
|
|
31
|
-
const brand = await
|
|
32
|
-
const basketAtBlock = await
|
|
31
|
+
const proposals = await indexDtf.getProposals();
|
|
32
|
+
const price = await indexDtf.getPrice();
|
|
33
|
+
const brand = await indexDtf.getBrand();
|
|
34
|
+
const basketAtBlock = await indexDtf.getBasket(123n);
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
With explicit configuration:
|
|
@@ -80,7 +82,11 @@ This is intentionally not part of the normal test suite or CI path.
|
|
|
80
82
|
SDK errors use stable machine-readable codes:
|
|
81
83
|
|
|
82
84
|
```ts
|
|
83
|
-
import { isSdkError } from "@reserve-protocol/sdk";
|
|
85
|
+
import { createDtfSdk, isSdkError } from "@reserve-protocol/sdk";
|
|
86
|
+
|
|
87
|
+
const sdk = createDtfSdk();
|
|
88
|
+
const address = "0x...";
|
|
89
|
+
const chainId = 8453;
|
|
84
90
|
|
|
85
91
|
try {
|
|
86
92
|
await sdk.index.get({ address, chainId });
|
|
@@ -103,4 +109,4 @@ The intended model:
|
|
|
103
109
|
namespace methods -> client -> small transports -> mappers
|
|
104
110
|
```
|
|
105
111
|
|
|
106
|
-
See [../../docs/sdk
|
|
112
|
+
See [../../docs/sdk/architecture.md](../../docs/sdk/architecture.md).
|