@symmio/trading-core 0.1.0 → 0.1.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 +18 -45
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,67 +1,40 @@
|
|
|
1
1
|
# @symmio/trading-core
|
|
2
2
|
|
|
3
|
-
Framework-agnostic SYMMIO SDK.
|
|
3
|
+
> Framework-agnostic SYMMIO SDK. Contract calls, calculations, and transformations with no framework assumptions.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@symmio/trading-core` is the base layer of the SYMMIO SDK: contract reads and writes (via viem), REST and GraphQL calls, and the calculations and transformations that turn raw protocol data into typed results. It has no framework dependency, so React (`@symmio/trading-react`) and other framework bindings build on top of it.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**[Documentation](https://symmio-frontier.vercel.app/core) · [Live SDK console](https://symm-frontier-web.vercel.app/)**
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- `getUserSubAccounts(publicClient, params)` — list a user's subaccounts.
|
|
12
|
-
- `editAccountName(walletClient, params)` — rename a subaccount.
|
|
13
|
-
|
|
14
|
-
## Install
|
|
9
|
+
## Installation
|
|
15
10
|
|
|
16
11
|
```sh
|
|
17
|
-
|
|
12
|
+
npm install @symmio/trading-core viem
|
|
18
13
|
```
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
viem is a peer dependency.
|
|
21
16
|
|
|
22
17
|
## Usage
|
|
23
18
|
|
|
24
|
-
### Free functions
|
|
25
|
-
|
|
26
19
|
```ts
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
const publicClient = createPublicClient({ chain: hyperevm, transport: http() });
|
|
20
|
+
import { createConfig, getMarkets } from "@symmio/trading-core";
|
|
21
|
+
import { createPublicClient, http } from "viem";
|
|
22
|
+
import { hyperEvm } from "viem/chains";
|
|
32
23
|
|
|
33
|
-
const
|
|
34
|
-
user: "0xabc...",
|
|
35
|
-
limit: 100n,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const walletClient = createWalletClient({
|
|
39
|
-
chain: hyperevm,
|
|
40
|
-
transport: custom(window.ethereum),
|
|
41
|
-
});
|
|
24
|
+
const publicClient = createPublicClient({ chain: hyperEvm, transport: http() });
|
|
42
25
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
name: "My Trading Account",
|
|
26
|
+
const config = createConfig({
|
|
27
|
+
getClient: () => publicClient,
|
|
46
28
|
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### viem actions
|
|
50
|
-
|
|
51
|
-
Attach SDK methods to a viem client via `.extend()`:
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
import { accountLayerReadActions, accountLayerWriteActions } from "@symmio/trading-core";
|
|
55
|
-
|
|
56
|
-
const reader = createPublicClient({ chain: hyperevm, transport: http() }).extend(accountLayerReadActions);
|
|
57
29
|
|
|
58
|
-
await
|
|
30
|
+
const markets = await getMarkets(config, {});
|
|
31
|
+
console.log(markets[0]?.name);
|
|
59
32
|
```
|
|
60
33
|
|
|
61
|
-
|
|
34
|
+
Every action ships a matching TanStack Query / Mutation options factory (e.g. `getMarketsQueryOptions`) for wiring into a query client.
|
|
62
35
|
|
|
63
|
-
|
|
36
|
+
See the [full API reference](https://symmio-frontier.vercel.app/core) for every action, options factory, and type.
|
|
64
37
|
|
|
65
|
-
##
|
|
38
|
+
## License
|
|
66
39
|
|
|
67
|
-
|
|
40
|
+
[MIT](./LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symmio/trading-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Framework-agnostic SYMMIO SDK. Contract calls, calculations, and transformations with no framework assumptions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/SYMM-IO/SYMM-Frontier/tree/main/packages/trading-core#readme",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"vite": "^8.0.13",
|
|
48
48
|
"vite-plugin-dts": "^5.0.0",
|
|
49
49
|
"vitest": "^4.1.6",
|
|
50
|
-
"@symmio/eslint-config": "^0.1.
|
|
51
|
-
"@symmio/typescript-config": "^0.1.
|
|
50
|
+
"@symmio/eslint-config": "^0.1.1",
|
|
51
|
+
"@symmio/typescript-config": "^0.1.1"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@tanstack/query-core": "^5.90.5",
|
|
55
55
|
"axios": "^1.16.1",
|
|
56
56
|
"ohash": "^2.0.11",
|
|
57
|
-
"@symmio/utils": "^0.1.
|
|
57
|
+
"@symmio/utils": "^0.1.1"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "vite build",
|