@d8x/perpetuals-sdk 0.5.3 → 0.5.4

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.
@@ -0,0 +1,161 @@
1
+ [
2
+ {
3
+ "anonymous": false,
4
+ "inputs": [
5
+ {
6
+ "indexed": true,
7
+ "internalType": "address",
8
+ "name": "previousOwner",
9
+ "type": "address"
10
+ },
11
+ {
12
+ "indexed": true,
13
+ "internalType": "address",
14
+ "name": "newOwner",
15
+ "type": "address"
16
+ }
17
+ ],
18
+ "name": "OwnershipTransferred",
19
+ "type": "event"
20
+ },
21
+ {
22
+ "anonymous": false,
23
+ "inputs": [
24
+ {
25
+ "indexed": true,
26
+ "internalType": "uint24",
27
+ "name": "perpetualId",
28
+ "type": "uint24"
29
+ },
30
+ {
31
+ "indexed": false,
32
+ "internalType": "address",
33
+ "name": "perpManagerAddress",
34
+ "type": "address"
35
+ },
36
+ {
37
+ "indexed": false,
38
+ "internalType": "address",
39
+ "name": "limitOrderBookAddress",
40
+ "type": "address"
41
+ }
42
+ ],
43
+ "name": "PerpetualLimitOrderBookDeployed",
44
+ "type": "event"
45
+ },
46
+ {
47
+ "inputs": [],
48
+ "name": "CANCEL_DELAY_SEC",
49
+ "outputs": [
50
+ {
51
+ "internalType": "uint8",
52
+ "name": "",
53
+ "type": "uint8"
54
+ }
55
+ ],
56
+ "stateMutability": "view",
57
+ "type": "function"
58
+ },
59
+ {
60
+ "inputs": [],
61
+ "name": "POSTING_FEE_TBPS",
62
+ "outputs": [
63
+ {
64
+ "internalType": "uint16",
65
+ "name": "",
66
+ "type": "uint16"
67
+ }
68
+ ],
69
+ "stateMutability": "view",
70
+ "type": "function"
71
+ },
72
+ {
73
+ "inputs": [
74
+ {
75
+ "internalType": "address",
76
+ "name": "_perpetualManagerAddr",
77
+ "type": "address"
78
+ },
79
+ {
80
+ "internalType": "uint24",
81
+ "name": "_perpetualId",
82
+ "type": "uint24"
83
+ }
84
+ ],
85
+ "name": "deployLimitOrderBookProxy",
86
+ "outputs": [],
87
+ "stateMutability": "nonpayable",
88
+ "type": "function"
89
+ },
90
+ {
91
+ "inputs": [
92
+ {
93
+ "internalType": "uint24",
94
+ "name": "_perpetualId",
95
+ "type": "uint24"
96
+ }
97
+ ],
98
+ "name": "getOrderBookAddress",
99
+ "outputs": [
100
+ {
101
+ "internalType": "address",
102
+ "name": "",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "stateMutability": "view",
107
+ "type": "function"
108
+ },
109
+ {
110
+ "inputs": [
111
+ {
112
+ "internalType": "uint24",
113
+ "name": "",
114
+ "type": "uint24"
115
+ }
116
+ ],
117
+ "name": "orderBooks",
118
+ "outputs": [
119
+ {
120
+ "internalType": "address",
121
+ "name": "",
122
+ "type": "address"
123
+ }
124
+ ],
125
+ "stateMutability": "view",
126
+ "type": "function"
127
+ },
128
+ {
129
+ "inputs": [],
130
+ "name": "owner",
131
+ "outputs": [
132
+ {
133
+ "internalType": "address",
134
+ "name": "",
135
+ "type": "address"
136
+ }
137
+ ],
138
+ "stateMutability": "view",
139
+ "type": "function"
140
+ },
141
+ {
142
+ "inputs": [],
143
+ "name": "renounceOwnership",
144
+ "outputs": [],
145
+ "stateMutability": "nonpayable",
146
+ "type": "function"
147
+ },
148
+ {
149
+ "inputs": [
150
+ {
151
+ "internalType": "address",
152
+ "name": "newOwner",
153
+ "type": "address"
154
+ }
155
+ ],
156
+ "name": "transferOwnership",
157
+ "outputs": [],
158
+ "stateMutability": "nonpayable",
159
+ "type": "function"
160
+ }
161
+ ]
@@ -0,0 +1,428 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "uint8",
6
+ "name": "_poolId",
7
+ "type": "uint8"
8
+ }
9
+ ],
10
+ "stateMutability": "nonpayable",
11
+ "type": "constructor"
12
+ },
13
+ {
14
+ "anonymous": false,
15
+ "inputs": [
16
+ {
17
+ "indexed": true,
18
+ "internalType": "address",
19
+ "name": "owner",
20
+ "type": "address"
21
+ },
22
+ {
23
+ "indexed": true,
24
+ "internalType": "address",
25
+ "name": "spender",
26
+ "type": "address"
27
+ },
28
+ {
29
+ "indexed": false,
30
+ "internalType": "uint256",
31
+ "name": "value",
32
+ "type": "uint256"
33
+ }
34
+ ],
35
+ "name": "Approval",
36
+ "type": "event"
37
+ },
38
+ {
39
+ "anonymous": false,
40
+ "inputs": [
41
+ {
42
+ "indexed": true,
43
+ "internalType": "address",
44
+ "name": "previousOwner",
45
+ "type": "address"
46
+ },
47
+ {
48
+ "indexed": true,
49
+ "internalType": "address",
50
+ "name": "newOwner",
51
+ "type": "address"
52
+ }
53
+ ],
54
+ "name": "OwnershipTransferred",
55
+ "type": "event"
56
+ },
57
+ {
58
+ "anonymous": false,
59
+ "inputs": [
60
+ {
61
+ "indexed": false,
62
+ "internalType": "address",
63
+ "name": "from",
64
+ "type": "address"
65
+ },
66
+ {
67
+ "indexed": false,
68
+ "internalType": "address",
69
+ "name": "to",
70
+ "type": "address"
71
+ },
72
+ {
73
+ "indexed": false,
74
+ "internalType": "uint256",
75
+ "name": "amountD18",
76
+ "type": "uint256"
77
+ },
78
+ {
79
+ "indexed": false,
80
+ "internalType": "uint256",
81
+ "name": "priceD18",
82
+ "type": "uint256"
83
+ }
84
+ ],
85
+ "name": "P2PTransfer",
86
+ "type": "event"
87
+ },
88
+ {
89
+ "anonymous": false,
90
+ "inputs": [
91
+ {
92
+ "indexed": true,
93
+ "internalType": "address",
94
+ "name": "from",
95
+ "type": "address"
96
+ },
97
+ {
98
+ "indexed": true,
99
+ "internalType": "address",
100
+ "name": "to",
101
+ "type": "address"
102
+ },
103
+ {
104
+ "indexed": false,
105
+ "internalType": "uint256",
106
+ "name": "value",
107
+ "type": "uint256"
108
+ }
109
+ ],
110
+ "name": "Transfer",
111
+ "type": "event"
112
+ },
113
+ {
114
+ "inputs": [
115
+ {
116
+ "internalType": "address",
117
+ "name": "owner",
118
+ "type": "address"
119
+ },
120
+ {
121
+ "internalType": "address",
122
+ "name": "spender",
123
+ "type": "address"
124
+ }
125
+ ],
126
+ "name": "allowance",
127
+ "outputs": [
128
+ {
129
+ "internalType": "uint256",
130
+ "name": "",
131
+ "type": "uint256"
132
+ }
133
+ ],
134
+ "stateMutability": "view",
135
+ "type": "function"
136
+ },
137
+ {
138
+ "inputs": [
139
+ {
140
+ "internalType": "address",
141
+ "name": "spender",
142
+ "type": "address"
143
+ },
144
+ {
145
+ "internalType": "uint256",
146
+ "name": "amount",
147
+ "type": "uint256"
148
+ }
149
+ ],
150
+ "name": "approve",
151
+ "outputs": [
152
+ {
153
+ "internalType": "bool",
154
+ "name": "",
155
+ "type": "bool"
156
+ }
157
+ ],
158
+ "stateMutability": "nonpayable",
159
+ "type": "function"
160
+ },
161
+ {
162
+ "inputs": [
163
+ {
164
+ "internalType": "address",
165
+ "name": "account",
166
+ "type": "address"
167
+ }
168
+ ],
169
+ "name": "balanceOf",
170
+ "outputs": [
171
+ {
172
+ "internalType": "uint256",
173
+ "name": "",
174
+ "type": "uint256"
175
+ }
176
+ ],
177
+ "stateMutability": "view",
178
+ "type": "function"
179
+ },
180
+ {
181
+ "inputs": [
182
+ {
183
+ "internalType": "address",
184
+ "name": "_account",
185
+ "type": "address"
186
+ },
187
+ {
188
+ "internalType": "uint256",
189
+ "name": "_amount",
190
+ "type": "uint256"
191
+ }
192
+ ],
193
+ "name": "burn",
194
+ "outputs": [],
195
+ "stateMutability": "nonpayable",
196
+ "type": "function"
197
+ },
198
+ {
199
+ "inputs": [],
200
+ "name": "decimals",
201
+ "outputs": [
202
+ {
203
+ "internalType": "uint8",
204
+ "name": "",
205
+ "type": "uint8"
206
+ }
207
+ ],
208
+ "stateMutability": "view",
209
+ "type": "function"
210
+ },
211
+ {
212
+ "inputs": [
213
+ {
214
+ "internalType": "address",
215
+ "name": "spender",
216
+ "type": "address"
217
+ },
218
+ {
219
+ "internalType": "uint256",
220
+ "name": "subtractedValue",
221
+ "type": "uint256"
222
+ }
223
+ ],
224
+ "name": "decreaseAllowance",
225
+ "outputs": [
226
+ {
227
+ "internalType": "bool",
228
+ "name": "",
229
+ "type": "bool"
230
+ }
231
+ ],
232
+ "stateMutability": "nonpayable",
233
+ "type": "function"
234
+ },
235
+ {
236
+ "inputs": [
237
+ {
238
+ "internalType": "address",
239
+ "name": "spender",
240
+ "type": "address"
241
+ },
242
+ {
243
+ "internalType": "uint256",
244
+ "name": "addedValue",
245
+ "type": "uint256"
246
+ }
247
+ ],
248
+ "name": "increaseAllowance",
249
+ "outputs": [
250
+ {
251
+ "internalType": "bool",
252
+ "name": "",
253
+ "type": "bool"
254
+ }
255
+ ],
256
+ "stateMutability": "nonpayable",
257
+ "type": "function"
258
+ },
259
+ {
260
+ "inputs": [
261
+ {
262
+ "internalType": "address",
263
+ "name": "_account",
264
+ "type": "address"
265
+ },
266
+ {
267
+ "internalType": "uint256",
268
+ "name": "_amount",
269
+ "type": "uint256"
270
+ }
271
+ ],
272
+ "name": "mint",
273
+ "outputs": [],
274
+ "stateMutability": "nonpayable",
275
+ "type": "function"
276
+ },
277
+ {
278
+ "inputs": [],
279
+ "name": "name",
280
+ "outputs": [
281
+ {
282
+ "internalType": "string",
283
+ "name": "",
284
+ "type": "string"
285
+ }
286
+ ],
287
+ "stateMutability": "view",
288
+ "type": "function"
289
+ },
290
+ {
291
+ "inputs": [],
292
+ "name": "owner",
293
+ "outputs": [
294
+ {
295
+ "internalType": "address",
296
+ "name": "",
297
+ "type": "address"
298
+ }
299
+ ],
300
+ "stateMutability": "view",
301
+ "type": "function"
302
+ },
303
+ {
304
+ "inputs": [],
305
+ "name": "poolId",
306
+ "outputs": [
307
+ {
308
+ "internalType": "uint8",
309
+ "name": "",
310
+ "type": "uint8"
311
+ }
312
+ ],
313
+ "stateMutability": "view",
314
+ "type": "function"
315
+ },
316
+ {
317
+ "inputs": [],
318
+ "name": "renounceOwnership",
319
+ "outputs": [],
320
+ "stateMutability": "nonpayable",
321
+ "type": "function"
322
+ },
323
+ {
324
+ "inputs": [
325
+ {
326
+ "internalType": "address",
327
+ "name": "_account",
328
+ "type": "address"
329
+ }
330
+ ],
331
+ "name": "setTransferRestricted",
332
+ "outputs": [],
333
+ "stateMutability": "nonpayable",
334
+ "type": "function"
335
+ },
336
+ {
337
+ "inputs": [],
338
+ "name": "symbol",
339
+ "outputs": [
340
+ {
341
+ "internalType": "string",
342
+ "name": "",
343
+ "type": "string"
344
+ }
345
+ ],
346
+ "stateMutability": "view",
347
+ "type": "function"
348
+ },
349
+ {
350
+ "inputs": [],
351
+ "name": "totalSupply",
352
+ "outputs": [
353
+ {
354
+ "internalType": "uint256",
355
+ "name": "",
356
+ "type": "uint256"
357
+ }
358
+ ],
359
+ "stateMutability": "view",
360
+ "type": "function"
361
+ },
362
+ {
363
+ "inputs": [
364
+ {
365
+ "internalType": "address",
366
+ "name": "to",
367
+ "type": "address"
368
+ },
369
+ {
370
+ "internalType": "uint256",
371
+ "name": "amount",
372
+ "type": "uint256"
373
+ }
374
+ ],
375
+ "name": "transfer",
376
+ "outputs": [
377
+ {
378
+ "internalType": "bool",
379
+ "name": "",
380
+ "type": "bool"
381
+ }
382
+ ],
383
+ "stateMutability": "nonpayable",
384
+ "type": "function"
385
+ },
386
+ {
387
+ "inputs": [
388
+ {
389
+ "internalType": "address",
390
+ "name": "from",
391
+ "type": "address"
392
+ },
393
+ {
394
+ "internalType": "address",
395
+ "name": "to",
396
+ "type": "address"
397
+ },
398
+ {
399
+ "internalType": "uint256",
400
+ "name": "amount",
401
+ "type": "uint256"
402
+ }
403
+ ],
404
+ "name": "transferFrom",
405
+ "outputs": [
406
+ {
407
+ "internalType": "bool",
408
+ "name": "",
409
+ "type": "bool"
410
+ }
411
+ ],
412
+ "stateMutability": "nonpayable",
413
+ "type": "function"
414
+ },
415
+ {
416
+ "inputs": [
417
+ {
418
+ "internalType": "address",
419
+ "name": "newOwner",
420
+ "type": "address"
421
+ }
422
+ ],
423
+ "name": "transferOwnership",
424
+ "outputs": [],
425
+ "stateMutability": "nonpayable",
426
+ "type": "function"
427
+ }
428
+ ]
@@ -99,7 +99,13 @@ export default class PerpetualDataHandler {
99
99
  getPriceIds(symbol: string): string[];
100
100
  protected static _getSymbolFromPoolId(poolId: number, staticInfos: PoolStaticInfo[]): string;
101
101
  protected static _getPoolIdFromSymbol(symbol: string, staticInfos: PoolStaticInfo[]): number;
102
- getNestedPerpetualIds(_proxyContract: Contract): number[][];
102
+ /**
103
+ * Get perpetual symbols for a given pool
104
+ * @param poolSymbol pool symbol such as "MATIC"
105
+ * @returns array of perpetual symbols in this pool
106
+ */
107
+ getPerpetualSymbolsInPool(poolSymbol: string): string[];
108
+ getNestedPerpetualIds(): number[][];
103
109
  /**
104
110
  * Collect all perpetuals static info
105
111
  * @param {ethers.Contract} _proxyContract perpetuals contract with getter
@@ -293,7 +293,25 @@ var PerpetualDataHandler = /** @class */ (function () {
293
293
  }
294
294
  return j + 1;
295
295
  };
296
- PerpetualDataHandler.prototype.getNestedPerpetualIds = function (_proxyContract) {
296
+ /**
297
+ * Get perpetual symbols for a given pool
298
+ * @param poolSymbol pool symbol such as "MATIC"
299
+ * @returns array of perpetual symbols in this pool
300
+ */
301
+ PerpetualDataHandler.prototype.getPerpetualSymbolsInPool = function (poolSymbol) {
302
+ var _this = this;
303
+ var j = PerpetualDataHandler._getPoolIdFromSymbol(poolSymbol, this.poolStaticInfos);
304
+ var perpIds = this.nestedPerpetualIDs[j - 1];
305
+ var perpSymbols = perpIds.map(function (k) {
306
+ var s = _this.getSymbolFromPerpId(k);
307
+ if (s == undefined) {
308
+ return "";
309
+ }
310
+ return s;
311
+ });
312
+ return perpSymbols;
313
+ };
314
+ PerpetualDataHandler.prototype.getNestedPerpetualIds = function () {
297
315
  return this.nestedPerpetualIDs;
298
316
  };
299
317
  /**