@gensyn-ai/gensyn-delphi-sdk 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 +310 -0
- package/dist/abi/DynamicParimutuelGateway.d.ts +1910 -0
- package/dist/abi/DynamicParimutuelGateway.d.ts.map +1 -0
- package/dist/abi/DynamicParimutuelGateway.js +1260 -0
- package/dist/abi/DynamicParimutuelGateway.js.map +1 -0
- package/dist/abi/ERC20.d.ts +552 -0
- package/dist/abi/ERC20.d.ts.map +1 -0
- package/dist/abi/ERC20.js +365 -0
- package/dist/abi/ERC20.js.map +1 -0
- package/dist/client/DelphiClient.d.ts +128 -0
- package/dist/client/DelphiClient.d.ts.map +1 -0
- package/dist/client/DelphiClient.js +436 -0
- package/dist/client/DelphiClient.js.map +1 -0
- package/dist/client/signer.d.ts +41 -0
- package/dist/client/signer.d.ts.map +1 -0
- package/dist/client/signer.js +72 -0
- package/dist/client/signer.js.map +1 -0
- package/dist/client/subgraph.d.ts +39 -0
- package/dist/client/subgraph.d.ts.map +1 -0
- package/dist/client/subgraph.js +91 -0
- package/dist/client/subgraph.js.map +1 -0
- package/dist/client/token.d.ts +18 -0
- package/dist/client/token.d.ts.map +1 -0
- package/dist/client/token.js +58 -0
- package/dist/client/token.js.map +1 -0
- package/dist/client/wallet.d.ts +28 -0
- package/dist/client/wallet.d.ts.map +1 -0
- package/dist/client/wallet.js +57 -0
- package/dist/client/wallet.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +239 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
const ERC20_ABI = [
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "uint8",
|
|
6
|
+
"name": "_decimals",
|
|
7
|
+
"type": "uint8"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"internalType": "address",
|
|
11
|
+
"name": "admin",
|
|
12
|
+
"type": "address"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"internalType": "uint256",
|
|
16
|
+
"name": "initialAmount",
|
|
17
|
+
"type": "uint256"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"stateMutability": "nonpayable",
|
|
21
|
+
"type": "constructor"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"inputs": [
|
|
25
|
+
{
|
|
26
|
+
"internalType": "address",
|
|
27
|
+
"name": "spender",
|
|
28
|
+
"type": "address"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"internalType": "uint256",
|
|
32
|
+
"name": "allowance",
|
|
33
|
+
"type": "uint256"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"internalType": "uint256",
|
|
37
|
+
"name": "needed",
|
|
38
|
+
"type": "uint256"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"name": "ERC20InsufficientAllowance",
|
|
42
|
+
"type": "error"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"inputs": [
|
|
46
|
+
{
|
|
47
|
+
"internalType": "address",
|
|
48
|
+
"name": "sender",
|
|
49
|
+
"type": "address"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"internalType": "uint256",
|
|
53
|
+
"name": "balance",
|
|
54
|
+
"type": "uint256"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"internalType": "uint256",
|
|
58
|
+
"name": "needed",
|
|
59
|
+
"type": "uint256"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"name": "ERC20InsufficientBalance",
|
|
63
|
+
"type": "error"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"inputs": [
|
|
67
|
+
{
|
|
68
|
+
"internalType": "address",
|
|
69
|
+
"name": "approver",
|
|
70
|
+
"type": "address"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"name": "ERC20InvalidApprover",
|
|
74
|
+
"type": "error"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"inputs": [
|
|
78
|
+
{
|
|
79
|
+
"internalType": "address",
|
|
80
|
+
"name": "receiver",
|
|
81
|
+
"type": "address"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"name": "ERC20InvalidReceiver",
|
|
85
|
+
"type": "error"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"inputs": [
|
|
89
|
+
{
|
|
90
|
+
"internalType": "address",
|
|
91
|
+
"name": "sender",
|
|
92
|
+
"type": "address"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"name": "ERC20InvalidSender",
|
|
96
|
+
"type": "error"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"inputs": [
|
|
100
|
+
{
|
|
101
|
+
"internalType": "address",
|
|
102
|
+
"name": "spender",
|
|
103
|
+
"type": "address"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"name": "ERC20InvalidSpender",
|
|
107
|
+
"type": "error"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"anonymous": false,
|
|
111
|
+
"inputs": [
|
|
112
|
+
{
|
|
113
|
+
"indexed": true,
|
|
114
|
+
"internalType": "address",
|
|
115
|
+
"name": "owner",
|
|
116
|
+
"type": "address"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"indexed": true,
|
|
120
|
+
"internalType": "address",
|
|
121
|
+
"name": "spender",
|
|
122
|
+
"type": "address"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"indexed": false,
|
|
126
|
+
"internalType": "uint256",
|
|
127
|
+
"name": "value",
|
|
128
|
+
"type": "uint256"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"name": "Approval",
|
|
132
|
+
"type": "event"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"anonymous": false,
|
|
136
|
+
"inputs": [
|
|
137
|
+
{
|
|
138
|
+
"indexed": true,
|
|
139
|
+
"internalType": "address",
|
|
140
|
+
"name": "from",
|
|
141
|
+
"type": "address"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"indexed": true,
|
|
145
|
+
"internalType": "address",
|
|
146
|
+
"name": "to",
|
|
147
|
+
"type": "address"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"indexed": false,
|
|
151
|
+
"internalType": "uint256",
|
|
152
|
+
"name": "value",
|
|
153
|
+
"type": "uint256"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"name": "Transfer",
|
|
157
|
+
"type": "event"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"inputs": [],
|
|
161
|
+
"name": "ADMIN",
|
|
162
|
+
"outputs": [
|
|
163
|
+
{
|
|
164
|
+
"internalType": "address",
|
|
165
|
+
"name": "",
|
|
166
|
+
"type": "address"
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"stateMutability": "view",
|
|
170
|
+
"type": "function"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"inputs": [
|
|
174
|
+
{
|
|
175
|
+
"internalType": "address",
|
|
176
|
+
"name": "owner",
|
|
177
|
+
"type": "address"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"internalType": "address",
|
|
181
|
+
"name": "spender",
|
|
182
|
+
"type": "address"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"name": "allowance",
|
|
186
|
+
"outputs": [
|
|
187
|
+
{
|
|
188
|
+
"internalType": "uint256",
|
|
189
|
+
"name": "",
|
|
190
|
+
"type": "uint256"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"stateMutability": "view",
|
|
194
|
+
"type": "function"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"inputs": [
|
|
198
|
+
{
|
|
199
|
+
"internalType": "address",
|
|
200
|
+
"name": "spender",
|
|
201
|
+
"type": "address"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"internalType": "uint256",
|
|
205
|
+
"name": "value",
|
|
206
|
+
"type": "uint256"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"name": "approve",
|
|
210
|
+
"outputs": [
|
|
211
|
+
{
|
|
212
|
+
"internalType": "bool",
|
|
213
|
+
"name": "",
|
|
214
|
+
"type": "bool"
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"stateMutability": "nonpayable",
|
|
218
|
+
"type": "function"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"inputs": [
|
|
222
|
+
{
|
|
223
|
+
"internalType": "address",
|
|
224
|
+
"name": "account",
|
|
225
|
+
"type": "address"
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"name": "balanceOf",
|
|
229
|
+
"outputs": [
|
|
230
|
+
{
|
|
231
|
+
"internalType": "uint256",
|
|
232
|
+
"name": "",
|
|
233
|
+
"type": "uint256"
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"stateMutability": "view",
|
|
237
|
+
"type": "function"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"inputs": [],
|
|
241
|
+
"name": "decimals",
|
|
242
|
+
"outputs": [
|
|
243
|
+
{
|
|
244
|
+
"internalType": "uint8",
|
|
245
|
+
"name": "",
|
|
246
|
+
"type": "uint8"
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
"stateMutability": "view",
|
|
250
|
+
"type": "function"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"inputs": [
|
|
254
|
+
{
|
|
255
|
+
"internalType": "address",
|
|
256
|
+
"name": "recipient",
|
|
257
|
+
"type": "address"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"internalType": "uint256",
|
|
261
|
+
"name": "amount",
|
|
262
|
+
"type": "uint256"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"name": "mint",
|
|
266
|
+
"outputs": [],
|
|
267
|
+
"stateMutability": "nonpayable",
|
|
268
|
+
"type": "function"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"inputs": [],
|
|
272
|
+
"name": "name",
|
|
273
|
+
"outputs": [
|
|
274
|
+
{
|
|
275
|
+
"internalType": "string",
|
|
276
|
+
"name": "",
|
|
277
|
+
"type": "string"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"stateMutability": "view",
|
|
281
|
+
"type": "function"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"inputs": [],
|
|
285
|
+
"name": "symbol",
|
|
286
|
+
"outputs": [
|
|
287
|
+
{
|
|
288
|
+
"internalType": "string",
|
|
289
|
+
"name": "",
|
|
290
|
+
"type": "string"
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
"stateMutability": "view",
|
|
294
|
+
"type": "function"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"inputs": [],
|
|
298
|
+
"name": "totalSupply",
|
|
299
|
+
"outputs": [
|
|
300
|
+
{
|
|
301
|
+
"internalType": "uint256",
|
|
302
|
+
"name": "",
|
|
303
|
+
"type": "uint256"
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"stateMutability": "view",
|
|
307
|
+
"type": "function"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"inputs": [
|
|
311
|
+
{
|
|
312
|
+
"internalType": "address",
|
|
313
|
+
"name": "to",
|
|
314
|
+
"type": "address"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"internalType": "uint256",
|
|
318
|
+
"name": "value",
|
|
319
|
+
"type": "uint256"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"name": "transfer",
|
|
323
|
+
"outputs": [
|
|
324
|
+
{
|
|
325
|
+
"internalType": "bool",
|
|
326
|
+
"name": "",
|
|
327
|
+
"type": "bool"
|
|
328
|
+
}
|
|
329
|
+
],
|
|
330
|
+
"stateMutability": "nonpayable",
|
|
331
|
+
"type": "function"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"inputs": [
|
|
335
|
+
{
|
|
336
|
+
"internalType": "address",
|
|
337
|
+
"name": "from",
|
|
338
|
+
"type": "address"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"internalType": "address",
|
|
342
|
+
"name": "to",
|
|
343
|
+
"type": "address"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"internalType": "uint256",
|
|
347
|
+
"name": "value",
|
|
348
|
+
"type": "uint256"
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
"name": "transferFrom",
|
|
352
|
+
"outputs": [
|
|
353
|
+
{
|
|
354
|
+
"internalType": "bool",
|
|
355
|
+
"name": "",
|
|
356
|
+
"type": "bool"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"stateMutability": "nonpayable",
|
|
360
|
+
"type": "function"
|
|
361
|
+
}
|
|
362
|
+
];
|
|
363
|
+
export const ABI = ERC20_ABI;
|
|
364
|
+
export default ERC20_ABI;
|
|
365
|
+
//# sourceMappingURL=ERC20.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ERC20.js","sourceRoot":"","sources":["../../src/abi/ERC20.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG;IAChB;QACE,QAAQ,EAAE;YACR;gBACE,cAAc,EAAE,OAAO;gBACvB,MAAM,EAAE,WAAW;gBACnB,MAAM,EAAE,OAAO;aAChB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,eAAe;gBACvB,MAAM,EAAE,SAAS;aAClB;SACF;QACD,iBAAiB,EAAE,YAAY;QAC/B,MAAM,E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ACT;gBACE,cAAc,EAAE,MAAM;gBACtB,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,MAAM;aACf;SACF;QACD,iBAAiB,EAAE,YAAY;QAC/B,MAAM,EAAE,UAAU;KACnB;IACD;QACE,QAAQ,EAAE;YACR;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,SAAS;aAClB;SACF;QACD,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE;YACT;gBACE,cAAc,EAAE,MAAM;gBACtB,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,MAAM;aACf;SACF;QACD,iBAAiB,EAAE,YAAY;QAC/B,MAAM,EAAE,UAAU;KACnB;CACqB,CAAC;AAEzB,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;AAC7B,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { DelphiClientConfig, BuySharesParams, BuySharesResponse, SellSharesParams, SellSharesResponse, QuoteBuyParams, QuoteBuyResponse, QuoteSellParams, QuoteSellResponse, GetTokenAllowanceParams, GetTokenAllowanceResponse, ApproveTokenParams, ApproveTokenResponse, EnsureTokenApprovalParams, EnsureTokenApprovalResponse, RedeemMarketParams, RedeemMarketResponse, RedeemPositionsParams, RedeemPositionsResponse, LiquidateParams, LiquidateResponse, HealthResponse, ListMarketsParams, ListMarketsResponse, GetMarketParams, GetMarketResponse, ListPositionsParams, ListPositionsResponse } from "../types/index.js";
|
|
2
|
+
import { type DelphiSigner } from "./signer.js";
|
|
3
|
+
import { SubgraphClient } from "./subgraph.js";
|
|
4
|
+
/**
|
|
5
|
+
* DelphiClient — on-chain write operations for the Delphi prediction market.
|
|
6
|
+
*
|
|
7
|
+
* Supports buying/selling shares, quoting trades, managing ERC-20 approvals,
|
|
8
|
+
* and redeeming winning positions — all routed through the Gateway contract.
|
|
9
|
+
*
|
|
10
|
+
* ## Network Configuration
|
|
11
|
+
*
|
|
12
|
+
* The client supports two networks: `"testnet"` (default) and `"mainnet"`.
|
|
13
|
+
* Network-specific defaults are applied automatically, but can be overridden
|
|
14
|
+
* via config or environment variables.
|
|
15
|
+
*
|
|
16
|
+
* ## Signing mechanisms
|
|
17
|
+
*
|
|
18
|
+
* | `signerType` | Description |
|
|
19
|
+
* |-----------------------|------------------------------------------------|
|
|
20
|
+
* | `"cdp_server_wallet"` | Delegate to a CDP Server Wallet v2 (default) |
|
|
21
|
+
* | `"private_key"` | Sign locally with a hex private key |
|
|
22
|
+
*/
|
|
23
|
+
export declare class DelphiClient {
|
|
24
|
+
private readonly signerType;
|
|
25
|
+
private readonly privateKey?;
|
|
26
|
+
private readonly cdpApiKeyId?;
|
|
27
|
+
private readonly cdpApiKeySecret?;
|
|
28
|
+
private readonly cdpWalletSecret?;
|
|
29
|
+
private readonly cdpWalletAddress?;
|
|
30
|
+
private readonly rpcUrl?;
|
|
31
|
+
private readonly chainId?;
|
|
32
|
+
private readonly gatewayAddress?;
|
|
33
|
+
private readonly tokenAddress?;
|
|
34
|
+
private readonly apiBaseUrl?;
|
|
35
|
+
private readonly apiKey?;
|
|
36
|
+
private readonly extraHeaders;
|
|
37
|
+
private readonly subgraphUrl?;
|
|
38
|
+
private signerPromise;
|
|
39
|
+
private tokenClient;
|
|
40
|
+
private walletClient;
|
|
41
|
+
private subgraphClient;
|
|
42
|
+
constructor(config?: DelphiClientConfig & {
|
|
43
|
+
extraHeaders?: Record<string, string>;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Returns (or lazily creates) the signer used for on-chain operations.
|
|
47
|
+
* Public so callers can access publicClient for reading market state.
|
|
48
|
+
*/
|
|
49
|
+
getSigner(): Promise<DelphiSigner>;
|
|
50
|
+
private initSigner;
|
|
51
|
+
private getGatewayAddress;
|
|
52
|
+
getTokenAddress(): `0x${string}`;
|
|
53
|
+
private getTokenClient;
|
|
54
|
+
private getWalletClient;
|
|
55
|
+
quoteBuy(params: QuoteBuyParams): Promise<QuoteBuyResponse>;
|
|
56
|
+
quoteSell(params: QuoteSellParams): Promise<QuoteSellResponse>;
|
|
57
|
+
buyShares(params: BuySharesParams): Promise<BuySharesResponse>;
|
|
58
|
+
sellShares(params: SellSharesParams): Promise<SellSharesResponse>;
|
|
59
|
+
redeemMarket(params: RedeemMarketParams): Promise<RedeemMarketResponse>;
|
|
60
|
+
redeemPositions(params: RedeemPositionsParams): Promise<RedeemPositionsResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Liquidate positions on an expired market for one or more outcome indices.
|
|
63
|
+
*
|
|
64
|
+
* This calls `Gateway.liquidate(marketProxy, outcomeIndices)` via RPC,
|
|
65
|
+
* and returns the burned shares per outcome along with total tokens received.
|
|
66
|
+
*/
|
|
67
|
+
liquidate(params: LiquidateParams): Promise<LiquidateResponse>;
|
|
68
|
+
getTokenAllowance(params: GetTokenAllowanceParams): Promise<GetTokenAllowanceResponse>;
|
|
69
|
+
approveToken(params: ApproveTokenParams): Promise<ApproveTokenResponse>;
|
|
70
|
+
ensureTokenApproval(params: EnsureTokenApprovalParams): Promise<EnsureTokenApprovalResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the native ETH balance for the current signer wallet.
|
|
73
|
+
*/
|
|
74
|
+
getEthBalance(): Promise<bigint>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the ERC-20 token balance for the current signer wallet.
|
|
77
|
+
* Defaults to the configured token address (DELPHI_TOKEN_ADDRESS) when omitted.
|
|
78
|
+
*/
|
|
79
|
+
getErc20Balance(tokenAddress?: `0x${string}`): Promise<bigint>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the ERC-20 token balance and decimals for the current signer wallet.
|
|
82
|
+
* Defaults to the configured token address (DELPHI_TOKEN_ADDRESS) when omitted.
|
|
83
|
+
*/
|
|
84
|
+
getErc20BalanceWithDecimals(tokenAddress?: `0x${string}`): Promise<{
|
|
85
|
+
balance: bigint;
|
|
86
|
+
decimals: number;
|
|
87
|
+
}>;
|
|
88
|
+
private getSubgraphUrl;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the SubgraphClient for direct GraphQL access.
|
|
91
|
+
*
|
|
92
|
+
* Use this for custom queries:
|
|
93
|
+
* ```ts
|
|
94
|
+
* const subgraph = client.getSubgraph();
|
|
95
|
+
* const data = await subgraph.query<{ gatewayBuys: SubgraphBuy[] }>(`{
|
|
96
|
+
* gatewayBuys(first: 10, orderBy: timestamp_, orderDirection: desc) {
|
|
97
|
+
* id buyer marketProxy tokensIn sharesOut timestamp_
|
|
98
|
+
* }
|
|
99
|
+
* }`);
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
getSubgraph(): SubgraphClient;
|
|
103
|
+
private getApiBaseUrl;
|
|
104
|
+
private getApiKey;
|
|
105
|
+
/**
|
|
106
|
+
* Internal helper: make an authenticated GET request to the REST API.
|
|
107
|
+
* Throws on non-2xx responses.
|
|
108
|
+
*/
|
|
109
|
+
private apiGet;
|
|
110
|
+
/**
|
|
111
|
+
* Returns service health status.
|
|
112
|
+
* Does not require authentication.
|
|
113
|
+
*/
|
|
114
|
+
health(): Promise<HealthResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Retrieve markets with pagination and optional filters.
|
|
117
|
+
*/
|
|
118
|
+
listMarkets(params?: ListMarketsParams): Promise<ListMarketsResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Retrieve a single market by ID.
|
|
121
|
+
*/
|
|
122
|
+
getMarket(params: GetMarketParams): Promise<GetMarketResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* Retrieve positions for a given wallet address.
|
|
125
|
+
*/
|
|
126
|
+
listPositions(params: ListPositionsParams): Promise<ListPositionsResponse>;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=DelphiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DelphiClient.d.ts","sourceRoot":"","sources":["../../src/client/DelphiClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA8B/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAGxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAgB;IAG5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAgB;IAGlD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAgB;IAChD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAgB;IAG9C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