@d8x/perpetuals-sdk 0.2.2 → 0.3.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/dist/cjs/abi/central-park/IPerpetualManager.json +142 -12
- package/dist/cjs/abi/testnet/IPerpetualManager.json +130 -0
- package/dist/cjs/abi/zkevmTestnet/IPerpetualManager.json +130 -0
- package/dist/cjs/config/defaultConfig.json +0 -11
- package/dist/cjs/marketData.d.ts +1 -1
- package/dist/cjs/marketData.js +25 -27
- package/dist/cjs/marketData.js.map +1 -1
- package/dist/cjs/nodeSDKTypes.d.ts +3 -1
- package/dist/cjs/nodeSDKTypes.js +1 -1
- package/dist/cjs/nodeSDKTypes.js.map +1 -1
- package/dist/cjs/perpetualDataHandler.d.ts +22 -1
- package/dist/cjs/perpetualDataHandler.js +155 -156
- package/dist/cjs/perpetualDataHandler.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/abi/central-park/IPerpetualManager.json +142 -12
- package/dist/esm/abi/testnet/IPerpetualManager.json +130 -0
- package/dist/esm/abi/zkevmTestnet/IPerpetualManager.json +130 -0
- package/dist/esm/config/defaultConfig.json +0 -11
- package/dist/esm/marketData.d.ts +1 -1
- package/dist/esm/marketData.js +25 -27
- package/dist/esm/marketData.js.map +1 -1
- package/dist/esm/nodeSDKTypes.d.ts +3 -1
- package/dist/esm/nodeSDKTypes.js +1 -1
- package/dist/esm/nodeSDKTypes.js.map +1 -1
- package/dist/esm/perpetualDataHandler.d.ts +22 -1
- package/dist/esm/perpetualDataHandler.js +155 -156
- package/dist/esm/perpetualDataHandler.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/doc/d8x-perpetuals-sdk.md +29 -0
- package/package.json +1 -1
|
@@ -901,7 +901,7 @@
|
|
|
901
901
|
},
|
|
902
902
|
{
|
|
903
903
|
"internalType": "uint64",
|
|
904
|
-
"name": "
|
|
904
|
+
"name": "submittedTimestamp",
|
|
905
905
|
"type": "uint64"
|
|
906
906
|
}
|
|
907
907
|
],
|
|
@@ -1837,7 +1837,7 @@
|
|
|
1837
1837
|
},
|
|
1838
1838
|
{
|
|
1839
1839
|
"internalType": "uint64",
|
|
1840
|
-
"name": "
|
|
1840
|
+
"name": "submittedTimestamp",
|
|
1841
1841
|
"type": "uint64"
|
|
1842
1842
|
}
|
|
1843
1843
|
],
|
|
@@ -2079,7 +2079,7 @@
|
|
|
2079
2079
|
},
|
|
2080
2080
|
{
|
|
2081
2081
|
"internalType": "uint64",
|
|
2082
|
-
"name": "
|
|
2082
|
+
"name": "submittedTimestamp",
|
|
2083
2083
|
"type": "uint64"
|
|
2084
2084
|
}
|
|
2085
2085
|
],
|
|
@@ -2188,7 +2188,7 @@
|
|
|
2188
2188
|
},
|
|
2189
2189
|
{
|
|
2190
2190
|
"internalType": "uint64",
|
|
2191
|
-
"name": "
|
|
2191
|
+
"name": "submittedTimestamp",
|
|
2192
2192
|
"type": "uint64"
|
|
2193
2193
|
}
|
|
2194
2194
|
],
|
|
@@ -2279,7 +2279,7 @@
|
|
|
2279
2279
|
},
|
|
2280
2280
|
{
|
|
2281
2281
|
"internalType": "uint64",
|
|
2282
|
-
"name": "
|
|
2282
|
+
"name": "submittedTimestamp",
|
|
2283
2283
|
"type": "uint64"
|
|
2284
2284
|
}
|
|
2285
2285
|
],
|
|
@@ -2965,7 +2965,7 @@
|
|
|
2965
2965
|
},
|
|
2966
2966
|
{
|
|
2967
2967
|
"internalType": "uint64",
|
|
2968
|
-
"name": "
|
|
2968
|
+
"name": "iLastOpenTimestamp",
|
|
2969
2969
|
"type": "uint64"
|
|
2970
2970
|
},
|
|
2971
2971
|
{
|
|
@@ -3129,7 +3129,7 @@
|
|
|
3129
3129
|
},
|
|
3130
3130
|
{
|
|
3131
3131
|
"internalType": "uint64",
|
|
3132
|
-
"name": "
|
|
3132
|
+
"name": "iLastSettlementPriceUpdateTimestamp",
|
|
3133
3133
|
"type": "uint64"
|
|
3134
3134
|
},
|
|
3135
3135
|
{
|
|
@@ -3321,7 +3321,7 @@
|
|
|
3321
3321
|
},
|
|
3322
3322
|
{
|
|
3323
3323
|
"internalType": "uint64",
|
|
3324
|
-
"name": "
|
|
3324
|
+
"name": "iLastPriceJumpTimestamp",
|
|
3325
3325
|
"type": "uint64"
|
|
3326
3326
|
},
|
|
3327
3327
|
{
|
|
@@ -3411,6 +3411,97 @@
|
|
|
3411
3411
|
"stateMutability": "view",
|
|
3412
3412
|
"type": "function"
|
|
3413
3413
|
},
|
|
3414
|
+
{
|
|
3415
|
+
"inputs": [
|
|
3416
|
+
{
|
|
3417
|
+
"internalType": "uint24[]",
|
|
3418
|
+
"name": "perpetualIds",
|
|
3419
|
+
"type": "uint24[]"
|
|
3420
|
+
}
|
|
3421
|
+
],
|
|
3422
|
+
"name": "getPerpetualStaticInfo",
|
|
3423
|
+
"outputs": [
|
|
3424
|
+
{
|
|
3425
|
+
"components": [
|
|
3426
|
+
{
|
|
3427
|
+
"internalType": "uint24",
|
|
3428
|
+
"name": "id",
|
|
3429
|
+
"type": "uint24"
|
|
3430
|
+
},
|
|
3431
|
+
{
|
|
3432
|
+
"internalType": "address",
|
|
3433
|
+
"name": "limitOrderBookAddr",
|
|
3434
|
+
"type": "address"
|
|
3435
|
+
},
|
|
3436
|
+
{
|
|
3437
|
+
"internalType": "int128",
|
|
3438
|
+
"name": "fInitialMarginRate",
|
|
3439
|
+
"type": "int128"
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
"internalType": "int128",
|
|
3443
|
+
"name": "fMaintenanceMarginRate",
|
|
3444
|
+
"type": "int128"
|
|
3445
|
+
},
|
|
3446
|
+
{
|
|
3447
|
+
"internalType": "uint8",
|
|
3448
|
+
"name": "perpetualState",
|
|
3449
|
+
"type": "uint8"
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
"internalType": "enum AMMPerpLogic.CollateralCurrency",
|
|
3453
|
+
"name": "collCurrencyType",
|
|
3454
|
+
"type": "uint8"
|
|
3455
|
+
},
|
|
3456
|
+
{
|
|
3457
|
+
"internalType": "bytes4",
|
|
3458
|
+
"name": "S2BaseCCY",
|
|
3459
|
+
"type": "bytes4"
|
|
3460
|
+
},
|
|
3461
|
+
{
|
|
3462
|
+
"internalType": "bytes4",
|
|
3463
|
+
"name": "S2QuoteCCY",
|
|
3464
|
+
"type": "bytes4"
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
"internalType": "bytes4",
|
|
3468
|
+
"name": "S3BaseCCY",
|
|
3469
|
+
"type": "bytes4"
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
"internalType": "bytes4",
|
|
3473
|
+
"name": "S3QuoteCCY",
|
|
3474
|
+
"type": "bytes4"
|
|
3475
|
+
},
|
|
3476
|
+
{
|
|
3477
|
+
"internalType": "int128",
|
|
3478
|
+
"name": "fLotSizeBC",
|
|
3479
|
+
"type": "int128"
|
|
3480
|
+
},
|
|
3481
|
+
{
|
|
3482
|
+
"internalType": "int128",
|
|
3483
|
+
"name": "fReferralRebateCC",
|
|
3484
|
+
"type": "int128"
|
|
3485
|
+
},
|
|
3486
|
+
{
|
|
3487
|
+
"internalType": "bytes32[]",
|
|
3488
|
+
"name": "priceIds",
|
|
3489
|
+
"type": "bytes32[]"
|
|
3490
|
+
},
|
|
3491
|
+
{
|
|
3492
|
+
"internalType": "bool[]",
|
|
3493
|
+
"name": "isPyth",
|
|
3494
|
+
"type": "bool[]"
|
|
3495
|
+
}
|
|
3496
|
+
],
|
|
3497
|
+
"internalType": "struct IPerpetualGetter.PerpetualStaticInfo[]",
|
|
3498
|
+
"name": "",
|
|
3499
|
+
"type": "tuple[]"
|
|
3500
|
+
}
|
|
3501
|
+
],
|
|
3502
|
+
"stateMutability": "view",
|
|
3503
|
+
"type": "function"
|
|
3504
|
+
},
|
|
3414
3505
|
{
|
|
3415
3506
|
"inputs": [],
|
|
3416
3507
|
"name": "getPoolCount",
|
|
@@ -3443,6 +3534,45 @@
|
|
|
3443
3534
|
"stateMutability": "view",
|
|
3444
3535
|
"type": "function"
|
|
3445
3536
|
},
|
|
3537
|
+
{
|
|
3538
|
+
"inputs": [
|
|
3539
|
+
{
|
|
3540
|
+
"internalType": "uint8",
|
|
3541
|
+
"name": "_poolFromIdx",
|
|
3542
|
+
"type": "uint8"
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
"internalType": "uint8",
|
|
3546
|
+
"name": "_poolToIdx",
|
|
3547
|
+
"type": "uint8"
|
|
3548
|
+
}
|
|
3549
|
+
],
|
|
3550
|
+
"name": "getPoolStaticInfo",
|
|
3551
|
+
"outputs": [
|
|
3552
|
+
{
|
|
3553
|
+
"internalType": "uint24[][]",
|
|
3554
|
+
"name": "",
|
|
3555
|
+
"type": "uint24[][]"
|
|
3556
|
+
},
|
|
3557
|
+
{
|
|
3558
|
+
"internalType": "address[]",
|
|
3559
|
+
"name": "",
|
|
3560
|
+
"type": "address[]"
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
"internalType": "address[]",
|
|
3564
|
+
"name": "",
|
|
3565
|
+
"type": "address[]"
|
|
3566
|
+
},
|
|
3567
|
+
{
|
|
3568
|
+
"internalType": "address",
|
|
3569
|
+
"name": "_oracleFactoryAddress",
|
|
3570
|
+
"type": "address"
|
|
3571
|
+
}
|
|
3572
|
+
],
|
|
3573
|
+
"stateMutability": "view",
|
|
3574
|
+
"type": "function"
|
|
3575
|
+
},
|
|
3446
3576
|
{
|
|
3447
3577
|
"inputs": [
|
|
3448
3578
|
{
|
|
@@ -4015,7 +4145,7 @@
|
|
|
4015
4145
|
},
|
|
4016
4146
|
{
|
|
4017
4147
|
"internalType": "uint64",
|
|
4018
|
-
"name": "
|
|
4148
|
+
"name": "submittedTimestamp",
|
|
4019
4149
|
"type": "uint64"
|
|
4020
4150
|
}
|
|
4021
4151
|
],
|
|
@@ -4182,7 +4312,7 @@
|
|
|
4182
4312
|
},
|
|
4183
4313
|
{
|
|
4184
4314
|
"internalType": "uint64",
|
|
4185
|
-
"name": "
|
|
4315
|
+
"name": "submittedTimestamp",
|
|
4186
4316
|
"type": "uint64"
|
|
4187
4317
|
}
|
|
4188
4318
|
],
|
|
@@ -4817,7 +4947,7 @@
|
|
|
4817
4947
|
},
|
|
4818
4948
|
{
|
|
4819
4949
|
"internalType": "uint64",
|
|
4820
|
-
"name": "
|
|
4950
|
+
"name": "submittedTimestamp",
|
|
4821
4951
|
"type": "uint64"
|
|
4822
4952
|
}
|
|
4823
4953
|
],
|
|
@@ -5008,7 +5138,7 @@
|
|
|
5008
5138
|
},
|
|
5009
5139
|
{
|
|
5010
5140
|
"internalType": "uint256",
|
|
5011
|
-
"name": "
|
|
5141
|
+
"name": "_maxAcceptableFeedAge",
|
|
5012
5142
|
"type": "uint256"
|
|
5013
5143
|
}
|
|
5014
5144
|
],
|
|
@@ -3411,6 +3411,97 @@
|
|
|
3411
3411
|
"stateMutability": "view",
|
|
3412
3412
|
"type": "function"
|
|
3413
3413
|
},
|
|
3414
|
+
{
|
|
3415
|
+
"inputs": [
|
|
3416
|
+
{
|
|
3417
|
+
"internalType": "uint24[]",
|
|
3418
|
+
"name": "perpetualIds",
|
|
3419
|
+
"type": "uint24[]"
|
|
3420
|
+
}
|
|
3421
|
+
],
|
|
3422
|
+
"name": "getPerpetualStaticInfo",
|
|
3423
|
+
"outputs": [
|
|
3424
|
+
{
|
|
3425
|
+
"components": [
|
|
3426
|
+
{
|
|
3427
|
+
"internalType": "uint24",
|
|
3428
|
+
"name": "id",
|
|
3429
|
+
"type": "uint24"
|
|
3430
|
+
},
|
|
3431
|
+
{
|
|
3432
|
+
"internalType": "address",
|
|
3433
|
+
"name": "limitOrderBookAddr",
|
|
3434
|
+
"type": "address"
|
|
3435
|
+
},
|
|
3436
|
+
{
|
|
3437
|
+
"internalType": "int128",
|
|
3438
|
+
"name": "fInitialMarginRate",
|
|
3439
|
+
"type": "int128"
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
"internalType": "int128",
|
|
3443
|
+
"name": "fMaintenanceMarginRate",
|
|
3444
|
+
"type": "int128"
|
|
3445
|
+
},
|
|
3446
|
+
{
|
|
3447
|
+
"internalType": "uint8",
|
|
3448
|
+
"name": "perpetualState",
|
|
3449
|
+
"type": "uint8"
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
"internalType": "enum AMMPerpLogic.CollateralCurrency",
|
|
3453
|
+
"name": "collCurrencyType",
|
|
3454
|
+
"type": "uint8"
|
|
3455
|
+
},
|
|
3456
|
+
{
|
|
3457
|
+
"internalType": "bytes4",
|
|
3458
|
+
"name": "S2BaseCCY",
|
|
3459
|
+
"type": "bytes4"
|
|
3460
|
+
},
|
|
3461
|
+
{
|
|
3462
|
+
"internalType": "bytes4",
|
|
3463
|
+
"name": "S2QuoteCCY",
|
|
3464
|
+
"type": "bytes4"
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
"internalType": "bytes4",
|
|
3468
|
+
"name": "S3BaseCCY",
|
|
3469
|
+
"type": "bytes4"
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
"internalType": "bytes4",
|
|
3473
|
+
"name": "S3QuoteCCY",
|
|
3474
|
+
"type": "bytes4"
|
|
3475
|
+
},
|
|
3476
|
+
{
|
|
3477
|
+
"internalType": "int128",
|
|
3478
|
+
"name": "fLotSizeBC",
|
|
3479
|
+
"type": "int128"
|
|
3480
|
+
},
|
|
3481
|
+
{
|
|
3482
|
+
"internalType": "int128",
|
|
3483
|
+
"name": "fReferralRebateCC",
|
|
3484
|
+
"type": "int128"
|
|
3485
|
+
},
|
|
3486
|
+
{
|
|
3487
|
+
"internalType": "bytes32[]",
|
|
3488
|
+
"name": "priceIds",
|
|
3489
|
+
"type": "bytes32[]"
|
|
3490
|
+
},
|
|
3491
|
+
{
|
|
3492
|
+
"internalType": "bool[]",
|
|
3493
|
+
"name": "isPyth",
|
|
3494
|
+
"type": "bool[]"
|
|
3495
|
+
}
|
|
3496
|
+
],
|
|
3497
|
+
"internalType": "struct IPerpetualGetter.PerpetualStaticInfo[]",
|
|
3498
|
+
"name": "",
|
|
3499
|
+
"type": "tuple[]"
|
|
3500
|
+
}
|
|
3501
|
+
],
|
|
3502
|
+
"stateMutability": "view",
|
|
3503
|
+
"type": "function"
|
|
3504
|
+
},
|
|
3414
3505
|
{
|
|
3415
3506
|
"inputs": [],
|
|
3416
3507
|
"name": "getPoolCount",
|
|
@@ -3443,6 +3534,45 @@
|
|
|
3443
3534
|
"stateMutability": "view",
|
|
3444
3535
|
"type": "function"
|
|
3445
3536
|
},
|
|
3537
|
+
{
|
|
3538
|
+
"inputs": [
|
|
3539
|
+
{
|
|
3540
|
+
"internalType": "uint8",
|
|
3541
|
+
"name": "_poolFromIdx",
|
|
3542
|
+
"type": "uint8"
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
"internalType": "uint8",
|
|
3546
|
+
"name": "_poolToIdx",
|
|
3547
|
+
"type": "uint8"
|
|
3548
|
+
}
|
|
3549
|
+
],
|
|
3550
|
+
"name": "getPoolStaticInfo",
|
|
3551
|
+
"outputs": [
|
|
3552
|
+
{
|
|
3553
|
+
"internalType": "uint24[][]",
|
|
3554
|
+
"name": "",
|
|
3555
|
+
"type": "uint24[][]"
|
|
3556
|
+
},
|
|
3557
|
+
{
|
|
3558
|
+
"internalType": "address[]",
|
|
3559
|
+
"name": "",
|
|
3560
|
+
"type": "address[]"
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
"internalType": "address[]",
|
|
3564
|
+
"name": "",
|
|
3565
|
+
"type": "address[]"
|
|
3566
|
+
},
|
|
3567
|
+
{
|
|
3568
|
+
"internalType": "address",
|
|
3569
|
+
"name": "_oracleFactoryAddress",
|
|
3570
|
+
"type": "address"
|
|
3571
|
+
}
|
|
3572
|
+
],
|
|
3573
|
+
"stateMutability": "view",
|
|
3574
|
+
"type": "function"
|
|
3575
|
+
},
|
|
3446
3576
|
{
|
|
3447
3577
|
"inputs": [
|
|
3448
3578
|
{
|
|
@@ -3411,6 +3411,97 @@
|
|
|
3411
3411
|
"stateMutability": "view",
|
|
3412
3412
|
"type": "function"
|
|
3413
3413
|
},
|
|
3414
|
+
{
|
|
3415
|
+
"inputs": [
|
|
3416
|
+
{
|
|
3417
|
+
"internalType": "uint24[]",
|
|
3418
|
+
"name": "perpetualIds",
|
|
3419
|
+
"type": "uint24[]"
|
|
3420
|
+
}
|
|
3421
|
+
],
|
|
3422
|
+
"name": "getPerpetualStaticInfo",
|
|
3423
|
+
"outputs": [
|
|
3424
|
+
{
|
|
3425
|
+
"components": [
|
|
3426
|
+
{
|
|
3427
|
+
"internalType": "uint24",
|
|
3428
|
+
"name": "id",
|
|
3429
|
+
"type": "uint24"
|
|
3430
|
+
},
|
|
3431
|
+
{
|
|
3432
|
+
"internalType": "address",
|
|
3433
|
+
"name": "limitOrderBookAddr",
|
|
3434
|
+
"type": "address"
|
|
3435
|
+
},
|
|
3436
|
+
{
|
|
3437
|
+
"internalType": "int128",
|
|
3438
|
+
"name": "fInitialMarginRate",
|
|
3439
|
+
"type": "int128"
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
"internalType": "int128",
|
|
3443
|
+
"name": "fMaintenanceMarginRate",
|
|
3444
|
+
"type": "int128"
|
|
3445
|
+
},
|
|
3446
|
+
{
|
|
3447
|
+
"internalType": "uint8",
|
|
3448
|
+
"name": "perpetualState",
|
|
3449
|
+
"type": "uint8"
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
"internalType": "enum AMMPerpLogic.CollateralCurrency",
|
|
3453
|
+
"name": "collCurrencyType",
|
|
3454
|
+
"type": "uint8"
|
|
3455
|
+
},
|
|
3456
|
+
{
|
|
3457
|
+
"internalType": "bytes4",
|
|
3458
|
+
"name": "S2BaseCCY",
|
|
3459
|
+
"type": "bytes4"
|
|
3460
|
+
},
|
|
3461
|
+
{
|
|
3462
|
+
"internalType": "bytes4",
|
|
3463
|
+
"name": "S2QuoteCCY",
|
|
3464
|
+
"type": "bytes4"
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
"internalType": "bytes4",
|
|
3468
|
+
"name": "S3BaseCCY",
|
|
3469
|
+
"type": "bytes4"
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
"internalType": "bytes4",
|
|
3473
|
+
"name": "S3QuoteCCY",
|
|
3474
|
+
"type": "bytes4"
|
|
3475
|
+
},
|
|
3476
|
+
{
|
|
3477
|
+
"internalType": "int128",
|
|
3478
|
+
"name": "fLotSizeBC",
|
|
3479
|
+
"type": "int128"
|
|
3480
|
+
},
|
|
3481
|
+
{
|
|
3482
|
+
"internalType": "int128",
|
|
3483
|
+
"name": "fReferralRebateCC",
|
|
3484
|
+
"type": "int128"
|
|
3485
|
+
},
|
|
3486
|
+
{
|
|
3487
|
+
"internalType": "bytes32[]",
|
|
3488
|
+
"name": "priceIds",
|
|
3489
|
+
"type": "bytes32[]"
|
|
3490
|
+
},
|
|
3491
|
+
{
|
|
3492
|
+
"internalType": "bool[]",
|
|
3493
|
+
"name": "isPyth",
|
|
3494
|
+
"type": "bool[]"
|
|
3495
|
+
}
|
|
3496
|
+
],
|
|
3497
|
+
"internalType": "struct IPerpetualGetter.PerpetualStaticInfo[]",
|
|
3498
|
+
"name": "",
|
|
3499
|
+
"type": "tuple[]"
|
|
3500
|
+
}
|
|
3501
|
+
],
|
|
3502
|
+
"stateMutability": "view",
|
|
3503
|
+
"type": "function"
|
|
3504
|
+
},
|
|
3414
3505
|
{
|
|
3415
3506
|
"inputs": [],
|
|
3416
3507
|
"name": "getPoolCount",
|
|
@@ -3443,6 +3534,45 @@
|
|
|
3443
3534
|
"stateMutability": "view",
|
|
3444
3535
|
"type": "function"
|
|
3445
3536
|
},
|
|
3537
|
+
{
|
|
3538
|
+
"inputs": [
|
|
3539
|
+
{
|
|
3540
|
+
"internalType": "uint8",
|
|
3541
|
+
"name": "_poolFromIdx",
|
|
3542
|
+
"type": "uint8"
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
"internalType": "uint8",
|
|
3546
|
+
"name": "_poolToIdx",
|
|
3547
|
+
"type": "uint8"
|
|
3548
|
+
}
|
|
3549
|
+
],
|
|
3550
|
+
"name": "getPoolStaticInfo",
|
|
3551
|
+
"outputs": [
|
|
3552
|
+
{
|
|
3553
|
+
"internalType": "uint24[][]",
|
|
3554
|
+
"name": "",
|
|
3555
|
+
"type": "uint24[][]"
|
|
3556
|
+
},
|
|
3557
|
+
{
|
|
3558
|
+
"internalType": "address[]",
|
|
3559
|
+
"name": "",
|
|
3560
|
+
"type": "address[]"
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
"internalType": "address[]",
|
|
3564
|
+
"name": "",
|
|
3565
|
+
"type": "address[]"
|
|
3566
|
+
},
|
|
3567
|
+
{
|
|
3568
|
+
"internalType": "address",
|
|
3569
|
+
"name": "_oracleFactoryAddress",
|
|
3570
|
+
"type": "address"
|
|
3571
|
+
}
|
|
3572
|
+
],
|
|
3573
|
+
"stateMutability": "view",
|
|
3574
|
+
"type": "function"
|
|
3575
|
+
},
|
|
3446
3576
|
{
|
|
3447
3577
|
"inputs": [
|
|
3448
3578
|
{
|
|
@@ -22,17 +22,6 @@
|
|
|
22
22
|
"limitOrderBookFactoryABILocation": "",
|
|
23
23
|
"limitOrderBookABILocation": ""
|
|
24
24
|
},
|
|
25
|
-
{
|
|
26
|
-
"name": "central-park",
|
|
27
|
-
"chainId": 80001,
|
|
28
|
-
"version": 5.1,
|
|
29
|
-
"proxyAddr": "0x4F1C7EE9E881Cc735f39Ca36c649ba9E930B4E4e",
|
|
30
|
-
"nodeURL": "https://polygon-mumbai.blockpi.network/v1/rpc/public",
|
|
31
|
-
"priceFeedConfigNetwork": "testnet",
|
|
32
|
-
"proxyABILocation": "central-park/IPerpetualManager.json",
|
|
33
|
-
"limitOrderBookFactoryABILocation": "central-park/LimitOrderBookFactory.json",
|
|
34
|
-
"limitOrderBookABILocation": "central-park/LimitOrderBook.json"
|
|
35
|
-
},
|
|
36
25
|
{
|
|
37
26
|
"name": "zkevmTestnet",
|
|
38
27
|
"chainId": 1442,
|
package/dist/cjs/marketData.d.ts
CHANGED
|
@@ -305,5 +305,5 @@ export default class MarketData extends PerpetualDataHandler {
|
|
|
305
305
|
* @returns a loyality score (4 worst, 1 best)
|
|
306
306
|
*/
|
|
307
307
|
getTraderLoyalityScore(traderAddr: string, brokerAddr?: string): Promise<number>;
|
|
308
|
-
static _exchangeInfo(_proxyContract: ethers.Contract, _poolStaticInfos: Array<PoolStaticInfo>, _symbolToPerpStaticInfo: Map<string, PerpetualStaticInfo>, _symbolList: Map<string, string>, _priceFeedGetter: PriceFeeds): Promise<ExchangeInfo>;
|
|
308
|
+
static _exchangeInfo(_proxyContract: ethers.Contract, _poolStaticInfos: Array<PoolStaticInfo>, _symbolToPerpStaticInfo: Map<string, PerpetualStaticInfo>, _nestedPerpetualIDs: Array<Array<number>>, _symbolList: Map<string, string>, _priceFeedGetter: PriceFeeds): Promise<ExchangeInfo>;
|
|
309
309
|
}
|
package/dist/cjs/marketData.js
CHANGED
|
@@ -129,7 +129,7 @@ var MarketData = /** @class */ (function (_super) {
|
|
|
129
129
|
if (this.proxyContract == null) {
|
|
130
130
|
throw Error("no proxy contract initialized. Use createProxyInstance().");
|
|
131
131
|
}
|
|
132
|
-
return [4 /*yield*/, MarketData._exchangeInfo(this.proxyContract, this.poolStaticInfos, this.symbolToPerpStaticInfo, this.symbolList, this.priceFeedGetter)];
|
|
132
|
+
return [4 /*yield*/, MarketData._exchangeInfo(this.proxyContract, this.poolStaticInfos, this.symbolToPerpStaticInfo, this.nestedPerpetualIDs, this.symbolList, this.priceFeedGetter)];
|
|
133
133
|
case 1: return [2 /*return*/, _a.sent()];
|
|
134
134
|
}
|
|
135
135
|
});
|
|
@@ -692,6 +692,7 @@ var MarketData = /** @class */ (function (_super) {
|
|
|
692
692
|
// return new copy, not a reference
|
|
693
693
|
var res = {
|
|
694
694
|
id: perpInfo.id,
|
|
695
|
+
poolId: perpInfo.poolId,
|
|
695
696
|
limitOrderBookAddr: perpInfo.limitOrderBookAddr,
|
|
696
697
|
initialMarginRate: perpInfo.initialMarginRate,
|
|
697
698
|
maintenanceMarginRate: perpInfo.maintenanceMarginRate,
|
|
@@ -872,20 +873,17 @@ var MarketData = /** @class */ (function (_super) {
|
|
|
872
873
|
});
|
|
873
874
|
});
|
|
874
875
|
};
|
|
875
|
-
MarketData._exchangeInfo = function (_proxyContract, _poolStaticInfos, _symbolToPerpStaticInfo, _symbolList, _priceFeedGetter) {
|
|
876
|
+
MarketData._exchangeInfo = function (_proxyContract, _poolStaticInfos, _symbolToPerpStaticInfo, _nestedPerpetualIDs, _symbolList, _priceFeedGetter) {
|
|
876
877
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
877
|
-
var
|
|
878
|
+
var factory, info, numPools, allSym, _a, _b, perpSymbol, sInfo, allSymArr, idxPriceMap, j, perpetualIDs, pool, PoolState, k, perp, symS2, symS3, res, _c, indexS2, isS2MktClosed, indexS3, isS3MktClosed, fMidPrice, markPremiumRate, currentFundingRateBps, state, isMktClosed, PerpetualState;
|
|
878
879
|
var e_1, _d;
|
|
879
880
|
return tslib_1.__generator(this, function (_e) {
|
|
880
881
|
switch (_e.label) {
|
|
881
|
-
case 0: return [4 /*yield*/,
|
|
882
|
+
case 0: return [4 /*yield*/, _proxyContract.getOracleFactory()];
|
|
882
883
|
case 1:
|
|
883
|
-
nestedPerpetualIDs = _e.sent();
|
|
884
|
-
return [4 /*yield*/, _proxyContract.getOracleFactory()];
|
|
885
|
-
case 2:
|
|
886
884
|
factory = _e.sent();
|
|
887
885
|
info = { pools: [], oracleFactoryAddr: factory, proxyAddr: _proxyContract.address };
|
|
888
|
-
numPools =
|
|
886
|
+
numPools = _nestedPerpetualIDs.length;
|
|
889
887
|
allSym = new Set();
|
|
890
888
|
try {
|
|
891
889
|
for (_a = tslib_1.__values(_symbolToPerpStaticInfo.keys()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
@@ -906,15 +904,15 @@ var MarketData = /** @class */ (function (_super) {
|
|
|
906
904
|
}
|
|
907
905
|
allSymArr = Array.from(allSym.values());
|
|
908
906
|
return [4 /*yield*/, _priceFeedGetter.fetchPrices(allSymArr)];
|
|
909
|
-
case
|
|
907
|
+
case 2:
|
|
910
908
|
idxPriceMap = _e.sent();
|
|
911
909
|
j = 0;
|
|
912
|
-
_e.label =
|
|
913
|
-
case
|
|
914
|
-
if (!(j < numPools)) return [3 /*break*/,
|
|
915
|
-
perpetualIDs =
|
|
910
|
+
_e.label = 3;
|
|
911
|
+
case 3:
|
|
912
|
+
if (!(j < numPools)) return [3 /*break*/, 11];
|
|
913
|
+
perpetualIDs = _nestedPerpetualIDs[j];
|
|
916
914
|
return [4 /*yield*/, _proxyContract.getLiquidityPool(j + 1)];
|
|
917
|
-
case
|
|
915
|
+
case 4:
|
|
918
916
|
pool = _e.sent();
|
|
919
917
|
PoolState = {
|
|
920
918
|
isRunning: pool.isRunning,
|
|
@@ -929,11 +927,11 @@ var MarketData = /** @class */ (function (_super) {
|
|
|
929
927
|
perpetuals: [],
|
|
930
928
|
};
|
|
931
929
|
k = 0;
|
|
932
|
-
_e.label =
|
|
933
|
-
case
|
|
934
|
-
if (!(k < perpetualIDs.length)) return [3 /*break*/,
|
|
930
|
+
_e.label = 5;
|
|
931
|
+
case 5:
|
|
932
|
+
if (!(k < perpetualIDs.length)) return [3 /*break*/, 9];
|
|
935
933
|
return [4 /*yield*/, _proxyContract.getPerpetual(perpetualIDs[k])];
|
|
936
|
-
case
|
|
934
|
+
case 6:
|
|
937
935
|
perp = _e.sent();
|
|
938
936
|
symS2 = (0, utils_1.contractSymbolToSymbol)(perp.S2BaseCCY, _symbolList) +
|
|
939
937
|
"-" +
|
|
@@ -965,7 +963,7 @@ var MarketData = /** @class */ (function (_super) {
|
|
|
965
963
|
(0, d8XMath_1.floatToABK64x64)(indexS2),
|
|
966
964
|
(0, d8XMath_1.floatToABK64x64)(indexS3),
|
|
967
965
|
])];
|
|
968
|
-
case
|
|
966
|
+
case 7:
|
|
969
967
|
fMidPrice = _e.sent();
|
|
970
968
|
markPremiumRate = (0, d8XMath_1.ABK64x64ToFloat)(perp.currentMarkPremiumRate.fPrice);
|
|
971
969
|
currentFundingRateBps = 1e4 * (0, d8XMath_1.ABK64x64ToFloat)(perp.fCurrentFundingRate);
|
|
@@ -988,17 +986,17 @@ var MarketData = /** @class */ (function (_super) {
|
|
|
988
986
|
isMarketClosed: isMktClosed,
|
|
989
987
|
};
|
|
990
988
|
PoolState.perpetuals.push(PerpetualState);
|
|
991
|
-
_e.label =
|
|
992
|
-
case
|
|
989
|
+
_e.label = 8;
|
|
990
|
+
case 8:
|
|
993
991
|
k++;
|
|
994
|
-
return [3 /*break*/,
|
|
995
|
-
case
|
|
992
|
+
return [3 /*break*/, 5];
|
|
993
|
+
case 9:
|
|
996
994
|
info.pools.push(PoolState);
|
|
997
|
-
_e.label =
|
|
998
|
-
case
|
|
995
|
+
_e.label = 10;
|
|
996
|
+
case 10:
|
|
999
997
|
j++;
|
|
1000
|
-
return [3 /*break*/,
|
|
1001
|
-
case
|
|
998
|
+
return [3 /*break*/, 3];
|
|
999
|
+
case 11: return [2 /*return*/, info];
|
|
1002
1000
|
}
|
|
1003
1001
|
});
|
|
1004
1002
|
});
|