@merkl/api 0.10.78 → 0.10.80
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -100
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
## Usage
|
4
4
|
|
5
5
|
```bash
|
6
|
-
bun install @merkl/
|
7
|
-
|
8
|
-
git submodule update --init --recursive & git submodule foreach 'bun install'
|
6
|
+
bun install @merkl/api
|
9
7
|
```
|
10
8
|
|
11
9
|
```ts
|
@@ -25,101 +23,4 @@ const { data, error, response, status } = api.v4.opportunity({ chainId: 1 })({ t
|
|
25
23
|
|
26
24
|
- [Bun](https://bun.sh/docs/installation)
|
27
25
|
|
28
|
-
### Launching the app for the first time
|
29
|
-
|
30
|
-
1. Install node modules (`bun i`)
|
31
|
-
2. Populate .env (you can copy paste the merkl calc .env)
|
32
|
-
3. Fetch the database schema
|
33
|
-
1. First make sure that the database of the merkl calculator is running
|
34
|
-
2. Run `DATABASE_ENGINE_URL="postgresql://postgres:postgres@0.0.0.0:5432/merkl-calc" bun prisma db pull`
|
35
|
-
3. This will copy the database schema and put it in your schema.prisma
|
36
|
-
4. Generate the database types (`bun prisma generate`)
|
37
|
-
5. Start the app (`bun dev`)
|
38
|
-
|
39
|
-
Open http://localhost:3000/ with your browser to see the result.
|
40
|
-
|
41
|
-
## Build the app
|
42
|
-
|
43
|
-
```bash
|
44
|
-
bun build --target=bun ./src/index.ts --outfile=server.js
|
45
|
-
```
|
46
|
-
|
47
|
-
## Run locally
|
48
|
-
```bash
|
49
|
-
yarn start:local -d local
|
50
|
-
```
|
51
|
-
|
52
|
-
## Start couldSQL Proxy
|
53
|
-
|
54
|
-
```bash
|
55
|
-
cloud-sql-proxy --address 0.0.0.0 --port 1234 merkl-production:europe-west1:merkl
|
56
|
-
```
|
57
|
-
|
58
|
-
## Adding a new token price
|
59
|
-
|
60
|
-
To track the price of a token, follow these steps using the database (with a database explorer):
|
61
|
-
|
62
|
-
1. Navigate to the `PriceSource` table.
|
63
|
-
|
64
|
-
There are three implemented cases, and each row should follow one of these formats:
|
65
|
-
|
66
|
-
1. **COINGECKO**:
|
67
|
-
```json
|
68
|
-
{
|
69
|
-
"symbol": "BTC",
|
70
|
-
"method": "COINGECKO",
|
71
|
-
"args":{ "ticker": "Bitcoin" }
|
72
|
-
}
|
73
|
-
```
|
74
|
-
|
75
|
-
2. **CONSTANT**:
|
76
|
-
```json
|
77
|
-
{
|
78
|
-
"symbol": "USDT",
|
79
|
-
"method": "CONSTANT",
|
80
|
-
"args": { "value": 1 }
|
81
|
-
}
|
82
|
-
```
|
83
|
-
|
84
|
-
3. **EQUAL_TO**:
|
85
|
-
```json
|
86
|
-
{
|
87
|
-
"symbol": "WETH",
|
88
|
-
"method": "EQUAL_TO",
|
89
|
-
"args": { "token": "ETH" }
|
90
|
-
}
|
91
|
-
```
|
92
|
-
4. **DEXSCRENNER**:
|
93
|
-
```json
|
94
|
-
{
|
95
|
-
"symbol": "CRS",
|
96
|
-
"method": "DEXSCREENER",
|
97
|
-
"args": {
|
98
|
-
"chain": "polygon",
|
99
|
-
"pair": "0xc28cfd6da4e53fB8F4F1b588F3247c7488ED68DF"
|
100
|
-
}
|
101
|
-
}
|
102
|
-
```
|
103
|
-
Find symbol for DexScrenner : Find it on dexscreener page
|
104
|
-
|
105
|
-
5. **INDEXCOOP**:
|
106
|
-
```json
|
107
|
-
{
|
108
|
-
"symbol": "BTC2X",
|
109
|
-
"method": "INDEXCOOP",
|
110
|
-
"args": { "chainId": 42161 }
|
111
|
-
}
|
112
|
-
```
|
113
26
|
|
114
|
-
5. **ERC4626**:
|
115
|
-
```json
|
116
|
-
{
|
117
|
-
"symbol": "stEUR",
|
118
|
-
"method": "ERC4626",
|
119
|
-
"args": {
|
120
|
-
"chainId": 1,
|
121
|
-
"address": "0x004626A008B1aCdC4c74ab51644093b155e59A23",
|
122
|
-
"vaultToken": "EURA"
|
123
|
-
}
|
124
|
-
}
|
125
|
-
```
|