@galacticcouncil/sdk 0.5.2 → 0.6.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/build/index.cjs +2 -0
- package/build/index.mjs +2 -0
- package/{dist → build}/types/index.d.ts +0 -3
- package/package.json +48 -39
- package/README.md +0 -134
- package/dist/index.esm.js +0 -4
- package/dist/index.js +0 -4
- package/dist/types/registry/Registry.d.ts +0 -20
- package/dist/types/registry/index.d.ts +0 -2
- package/dist/types/registry/types.d.ts +0 -22
- package/dist/types/storage/Storage.d.ts +0 -18
- package/dist/types/storage/index.d.ts +0 -1
- package/dist/types/wallet/Wallet.d.ts +0 -21
- package/dist/types/wallet/balance/Erc20BalanceAdapter.d.ts +0 -11
- package/dist/types/wallet/balance/NativeBalanceAdapter.d.ts +0 -14
- package/dist/types/wallet/balance/TokenBalanceAdapter.d.ts +0 -12
- package/dist/types/wallet/evm/AcalaEvmProvider.d.ts +0 -9
- package/dist/types/wallet/evm/DefaultEvmProvider.d.ts +0 -7
- package/dist/types/wallet/index.d.ts +0 -5
- package/dist/types/wallet/types.d.ts +0 -10
- package/dist/types/wallet/utils.d.ts +0 -19
- package/xcmgr.sync.mjs +0 -65
- /package/{dist → build}/types/api/Router.d.ts +0 -0
- /package/{dist → build}/types/api/TradeRouter.d.ts +0 -0
- /package/{dist → build}/types/api/index.d.ts +0 -0
- /package/{dist → build}/types/client/AssetClient.d.ts +0 -0
- /package/{dist → build}/types/client/BalanceClient.d.ts +0 -0
- /package/{dist → build}/types/client/PolkadotApi.d.ts +0 -0
- /package/{dist → build}/types/client/index.d.ts +0 -0
- /package/{dist → build}/types/consts.d.ts +0 -0
- /package/{dist → build}/types/errors.d.ts +0 -0
- /package/{dist → build}/types/pool/CachingPoolService.d.ts +0 -0
- /package/{dist → build}/types/pool/PoolClient.d.ts +0 -0
- /package/{dist → build}/types/pool/PoolFactory.d.ts +0 -0
- /package/{dist → build}/types/pool/PoolService.d.ts +0 -0
- /package/{dist → build}/types/pool/index.d.ts +0 -0
- /package/{dist → build}/types/pool/lbp/LbpMath.d.ts +0 -0
- /package/{dist → build}/types/pool/lbp/LbpPool.d.ts +0 -0
- /package/{dist → build}/types/pool/lbp/LbpPoolClient.d.ts +0 -0
- /package/{dist → build}/types/pool/omni/OmniMath.d.ts +0 -0
- /package/{dist → build}/types/pool/omni/OmniPool.d.ts +0 -0
- /package/{dist → build}/types/pool/omni/OmniPoolClient.d.ts +0 -0
- /package/{dist → build}/types/pool/xyk/XykMath.d.ts +0 -0
- /package/{dist → build}/types/pool/xyk/XykPool.d.ts +0 -0
- /package/{dist → build}/types/pool/xyk/XykPoolClient.d.ts +0 -0
- /package/{dist → build}/types/route/bfs.d.ts +0 -0
- /package/{dist → build}/types/route/graph.d.ts +0 -0
- /package/{dist → build}/types/route/index.d.ts +0 -0
- /package/{dist → build}/types/route/suggester.d.ts +0 -0
- /package/{dist → build}/types/types.d.ts +0 -0
- /package/{dist → build}/types/utils/Queue.d.ts +0 -0
- /package/{dist → build}/types/utils/Stack.d.ts +0 -0
- /package/{dist → build}/types/utils/bignumber.d.ts +0 -0
- /package/{dist → build}/types/utils/mapper.d.ts +0 -0
- /package/{dist → build}/types/utils/math.d.ts +0 -0
- /package/{dist → build}/types/utils/traversal/bfs.d.ts +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export { Router, TradeRouter } from './api';
|
|
2
2
|
export * from './pool';
|
|
3
3
|
export * from './client';
|
|
4
|
-
export * from './registry';
|
|
5
|
-
export * from './storage';
|
|
6
|
-
export * from './wallet';
|
|
7
4
|
export * from './types';
|
|
8
5
|
export * from './errors';
|
|
9
6
|
export * from './consts';
|
package/package.json
CHANGED
|
@@ -1,54 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacticcouncil/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"pckg:publish": "git push --follow-tags origin master && npm publish",
|
|
20
|
-
"xcmgr:sync": "node ./xcmgr.sync.mjs"
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Galactic off-chain routing & optimization of orders across pools for best price execution",
|
|
5
|
+
"author": "GalacticCouncil",
|
|
6
|
+
"repository": {
|
|
7
|
+
"directory": "packages/sdk",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/galacticcouncil/sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"hydradx",
|
|
13
|
+
"basilisk",
|
|
14
|
+
"router",
|
|
15
|
+
"sdk"
|
|
16
|
+
],
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/galacticcouncil/sdk/issues"
|
|
21
19
|
},
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
"files": [
|
|
21
|
+
"build"
|
|
22
|
+
],
|
|
23
|
+
"main": "./build/index.cjs",
|
|
24
|
+
"module": "./build/index.mjs",
|
|
25
|
+
"types": "./build/types/index.d.ts",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "node ./esbuild.config.mjs",
|
|
28
|
+
"build:watch": "npm run build -- --watch",
|
|
29
|
+
"postbuild": "tsc --emitDeclarationOnly --outDir build/types/",
|
|
30
|
+
"clean": "rimraf build",
|
|
31
|
+
"link": "npm ln",
|
|
32
|
+
"test": "jest"
|
|
26
33
|
},
|
|
27
34
|
"devDependencies": {
|
|
28
|
-
"@galacticcouncil/api-augment": "^0.0.4"
|
|
29
|
-
"@types/jest": "^28.1.8",
|
|
30
|
-
"es-jest": "^2.0.0",
|
|
31
|
-
"esbuild": "^0.14.53",
|
|
32
|
-
"esbuild-plugin-wasm": "^1.0.0",
|
|
33
|
-
"fs-extra": "^10.1.0",
|
|
34
|
-
"prettier": "^2.3.2",
|
|
35
|
-
"rimraf": "^3.0.2",
|
|
36
|
-
"standard-version": "^9.5.0",
|
|
37
|
-
"ts-jest": "^28.0.8",
|
|
38
|
-
"ts-node": "^10.9.1",
|
|
39
|
-
"tsx": "^3.8.2",
|
|
40
|
-
"typescript": "^4.7.4"
|
|
35
|
+
"@galacticcouncil/api-augment": "^0.0.4"
|
|
41
36
|
},
|
|
42
37
|
"dependencies": {
|
|
43
|
-
"@galacticcouncil/math-lbp": "^0.
|
|
44
|
-
"@galacticcouncil/math-omnipool": "^0.
|
|
45
|
-
"@galacticcouncil/math-xyk": "^0.
|
|
38
|
+
"@galacticcouncil/math-lbp": "^0.2.0",
|
|
39
|
+
"@galacticcouncil/math-omnipool": "^0.2.0",
|
|
40
|
+
"@galacticcouncil/math-xyk": "^0.2.0",
|
|
46
41
|
"@thi.ng/cache": "^2.1.35",
|
|
47
42
|
"bignumber.js": "^9.1.0",
|
|
48
43
|
"lodash.clonedeep": "^4.5.0"
|
|
49
44
|
},
|
|
50
45
|
"peerDependencies": {
|
|
51
46
|
"@polkadot/api": "^10.9.1",
|
|
52
|
-
"
|
|
47
|
+
"@polkadot/api-augment": "^10.9.1",
|
|
48
|
+
"@polkadot/api-derive": "^10.9.1",
|
|
49
|
+
"@polkadot/api-base": "^10.9.1",
|
|
50
|
+
"@polkadot/rpc-augment": "^10.9.1",
|
|
51
|
+
"@polkadot/rpc-core": "^10.9.1",
|
|
52
|
+
"@polkadot/rpc-provider": "^10.9.1",
|
|
53
|
+
"@polkadot/types": "^10.9.1",
|
|
54
|
+
"@polkadot/types-augment": "^10.9.1",
|
|
55
|
+
"@polkadot/types-codec": "^10.9.1",
|
|
56
|
+
"@polkadot/types-create": "^10.9.1",
|
|
57
|
+
"@polkadot/types-known": "^10.9.1",
|
|
58
|
+
"@polkadot/keyring": "^12.3.2",
|
|
59
|
+
"@polkadot/util": "^12.3.2",
|
|
60
|
+
"@polkadot/util-crypto": "^12.3.2",
|
|
61
|
+
"ethers": "^5.7.2"
|
|
53
62
|
}
|
|
54
63
|
}
|
package/README.md
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# Galactic SDK
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@galacticcouncil/sdk)
|
|
4
|
-

|
|
5
|
-
|
|
6
|
-
</p>
|
|
7
|
-
Galactic SDK is collection of components crafted to ease Basilisk & HydraDX chains integration.
|
|
8
|
-
<br />
|
|
9
|
-
<br />
|
|
10
|
-
Table of content:
|
|
11
|
-
|
|
12
|
-
- [Installation](#installation)
|
|
13
|
-
- [Components](#components)
|
|
14
|
-
- [Router](#router)
|
|
15
|
-
- [TradeRouter](#traderouter)
|
|
16
|
-
- [Examples](#examples)
|
|
17
|
-
- [Roadmap](#roadmap)
|
|
18
|
-
- [Issue reporting](#issue-reporting)
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
Install with [npm](https://www.npmjs.com/):
|
|
23
|
-
|
|
24
|
-
`npm install @galacticcouncil/sdk`
|
|
25
|
-
|
|
26
|
-
## Components
|
|
27
|
-
|
|
28
|
-
### Router
|
|
29
|
-
|
|
30
|
-
Off-chain routing, build to find the most suitable routes across the pools. Building block for TradeRouter.
|
|
31
|
-
|
|
32
|
-
#### API
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
getPools(): PoolBase[]
|
|
36
|
-
getAllAssets(): PoolAsset[]
|
|
37
|
-
getAssetPairs(token: string): PoolAsset[]
|
|
38
|
-
getAllPaths(tokenIn: string, tokenOut: string): Hop[][]
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### TradeRouter
|
|
42
|
-
|
|
43
|
-
Off-chain optimization of orders across pools for best price execution. TradeRouter does not perform any on-chain transations.
|
|
44
|
-
|
|
45
|
-
#### API
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
getBestSpotPrice(tokenIn: string, tokenOut: string): Amount
|
|
49
|
-
getBestSell(tokenIn: string, tokenOut: string, amountIn: BigNumber | number | string): Trade
|
|
50
|
-
getBestBuy(tokenIn: string, tokenOut: string, amountOut: BigNumber | number | string): Trade
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
For type signature visit [types.ts](src/types.ts)<br />
|
|
54
|
-
|
|
55
|
-
#### Usage
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
// Import
|
|
59
|
-
import { ApiPromise, WsProvider } from '@polkadot/api';
|
|
60
|
-
import { TradeRouter, PoolService, PoolType } from '@galacticcouncil/sdk';
|
|
61
|
-
|
|
62
|
-
// Initialize Polkadot API
|
|
63
|
-
const wsProvider = new WsProvider('wss://rpc.basilisk.cloud');
|
|
64
|
-
const api = await ApiPromise.create({ provider: wsProvider });
|
|
65
|
-
|
|
66
|
-
// Initialize Trade Router
|
|
67
|
-
const poolService = new PoolService(api);
|
|
68
|
-
const tradeRouter = new TradeRouter(poolService, { includeOnly: [PoolType.XYK] });
|
|
69
|
-
|
|
70
|
-
// Do something
|
|
71
|
-
const result = await tradeRouter.getAllAssets();
|
|
72
|
-
console.log(result);
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Examples
|
|
76
|
-
|
|
77
|
-
SDK Examples and testing helpers.
|
|
78
|
-
|
|
79
|
-
### Run
|
|
80
|
-
|
|
81
|
-
Run: `$ npx tsx ./test/script/examples/<examplePackage>/<exampleName>.ts` with valid example package & name.
|
|
82
|
-
|
|
83
|
-
To demonstrate full working examples on real chain see [script](test/script/examples) section.
|
|
84
|
-
|
|
85
|
-
## Roadmap
|
|
86
|
-
|
|
87
|
-
Component list and current status ⬇️
|
|
88
|
-
|
|
89
|
-
- 🧪 Done
|
|
90
|
-
- 🛠 Work in progress
|
|
91
|
-
- ⏳ Planning to build
|
|
92
|
-
|
|
93
|
-
| Name | Type | |
|
|
94
|
-
| ----------- | :----: | --: |
|
|
95
|
-
| Router | API | 🧪 |
|
|
96
|
-
| TradeRouter | API | 🧪 |
|
|
97
|
-
| Polkadot | Client | 🧪 |
|
|
98
|
-
| Capi | Client | ⏳ |
|
|
99
|
-
| XYK | Math | 🧪 |
|
|
100
|
-
| XYK | Pool | 🧪 |
|
|
101
|
-
| Omni | Math | 🧪 |
|
|
102
|
-
| Omni | Pool | 🧪 |
|
|
103
|
-
| LBP | Math | 🧪 |
|
|
104
|
-
| LBP | Pool | 🛠 |
|
|
105
|
-
| Stable | Math | ⏳ |
|
|
106
|
-
| Stable | Pool | ⏳ |
|
|
107
|
-
|
|
108
|
-
## Development and Build
|
|
109
|
-
|
|
110
|
-
### Requirements
|
|
111
|
-
|
|
112
|
-
- [Node.js](https://nodejs.org/) (**version 18 or higher**)
|
|
113
|
-
|
|
114
|
-
### Build & Release
|
|
115
|
-
|
|
116
|
-
```sh
|
|
117
|
-
npm install # to install all dependencies
|
|
118
|
-
npm run pckg:release # to release patch version (default)
|
|
119
|
-
npm run pckg:publish # to publish npm package
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
#### Other
|
|
123
|
-
|
|
124
|
-
To release minor or major version of the SDK use following commands.
|
|
125
|
-
|
|
126
|
-
```sh
|
|
127
|
-
npm run pckg:release -- --release-as minor # Release minor version. E.g. 1.0.23 -> 1.1.0
|
|
128
|
-
npm run pckg:release -- --release-as major # Release major version. E.g. 1.0.23 -> 2.0.0
|
|
129
|
-
npm run pckg:release -- --release-as 1.1.0 # Release specific version (1.1.0)
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Issue reporting
|
|
133
|
-
|
|
134
|
-
In case of unexpected sdk behaviour, please create well-written issue [here](https://https://github.com/galacticcouncil/sdk/issues/new). It makes it easier to find & fix the problem accordingly.
|