@drift-labs/sdk 2.110.0-beta.0 → 2.110.0-beta.10
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/VERSION +1 -1
- package/lib/browser/config.d.ts +2 -0
- package/lib/browser/config.js +7 -0
- package/lib/browser/constants/perpMarkets.js +34 -34
- package/lib/browser/constants/spotMarkets.js +10 -10
- package/lib/browser/dlob/DLOBNode.js +2 -2
- package/lib/browser/driftClient.d.ts +11 -1
- package/lib/browser/driftClient.js +38 -24
- package/lib/browser/driftClientConfig.d.ts +2 -0
- package/lib/browser/idl/drift.json +15 -0
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.js +1 -0
- package/lib/browser/math/market.js +2 -2
- package/lib/browser/swift/swiftOrderSubscriber.js +2 -0
- package/lib/browser/tx/txHandler.d.ts +1 -1
- package/lib/browser/tx/txHandler.js +4 -4
- package/lib/browser/user.js +1 -1
- package/lib/node/config.d.ts +2 -0
- package/lib/node/config.js +7 -0
- package/lib/node/constants/perpMarkets.js +34 -34
- package/lib/node/constants/spotMarkets.js +10 -10
- package/lib/node/dlob/DLOBNode.js +2 -2
- package/lib/node/driftClient.d.ts +11 -1
- package/lib/node/driftClient.js +38 -24
- package/lib/node/driftClientConfig.d.ts +2 -0
- package/lib/node/idl/drift.json +15 -0
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.js +1 -0
- package/lib/node/math/market.js +2 -2
- package/lib/node/swift/swiftOrderSubscriber.js +2 -0
- package/lib/node/tx/txHandler.d.ts +1 -1
- package/lib/node/tx/txHandler.js +4 -4
- package/lib/node/user.js +1 -1
- package/package.json +1 -1
- package/src/config.ts +9 -0
- package/src/constants/perpMarkets.ts +36 -36
- package/src/constants/spotMarkets.ts +10 -10
- package/src/dlob/DLOBNode.ts +2 -2
- package/src/driftClient.ts +84 -43
- package/src/driftClientConfig.ts +2 -0
- package/src/idl/drift.json +15 -0
- package/src/index.ts +1 -0
- package/src/math/market.ts +2 -2
- package/src/swift/swiftOrderSubscriber.ts +4 -0
- package/src/tx/txHandler.ts +5 -5
- package/src/user.ts +1 -1
- package/tests/ci/verifyConstants.ts +3 -3
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.110.0-beta.
|
|
1
|
+
2.110.0-beta.10
|
package/lib/browser/config.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ type DriftConfig = {
|
|
|
17
17
|
V2_ALPHA_TICKET_MINT_ADDRESS: string;
|
|
18
18
|
PERP_MARKETS: PerpMarketConfig[];
|
|
19
19
|
SPOT_MARKETS: SpotMarketConfig[];
|
|
20
|
+
/** @deprecated use MARKET_LOOKUP_TABLES */
|
|
20
21
|
MARKET_LOOKUP_TABLE: string;
|
|
22
|
+
MARKET_LOOKUP_TABLES: string[];
|
|
21
23
|
SERUM_LOOKUP_TABLE?: string;
|
|
22
24
|
PYTH_PULL_ORACLE_LOOKUP_TABLE?: string;
|
|
23
25
|
SB_ON_DEMAND_PID: PublicKey;
|
package/lib/browser/config.js
CHANGED
|
@@ -27,7 +27,9 @@ exports.configs = {
|
|
|
27
27
|
V2_ALPHA_TICKET_MINT_ADDRESS: 'DeEiGWfCMP9psnLGkxGrBBMEAW5Jv8bBGMN8DCtFRCyB',
|
|
28
28
|
PERP_MARKETS: perpMarkets_1.DevnetPerpMarkets,
|
|
29
29
|
SPOT_MARKETS: spotMarkets_1.DevnetSpotMarkets,
|
|
30
|
+
/** @deprecated use MARKET_LOOKUP_TABLES */
|
|
30
31
|
MARKET_LOOKUP_TABLE: 'FaMS3U4uBojvGn5FSDEPimddcXsCfwkKsFgMVVnDdxGb',
|
|
32
|
+
MARKET_LOOKUP_TABLES: ['FaMS3U4uBojvGn5FSDEPimddcXsCfwkKsFgMVVnDdxGb'],
|
|
31
33
|
DRIFT_ORACLE_RECEIVER_ID: exports.DRIFT_ORACLE_RECEIVER_ID,
|
|
32
34
|
SB_ON_DEMAND_PID: on_demand_1.ON_DEMAND_DEVNET_PID,
|
|
33
35
|
},
|
|
@@ -43,7 +45,12 @@ exports.configs = {
|
|
|
43
45
|
V2_ALPHA_TICKET_MINT_ADDRESS: 'Cmvhycb6LQvvzaShGw4iDHRLzeSSryioAsU98DSSkMNa',
|
|
44
46
|
PERP_MARKETS: perpMarkets_1.MainnetPerpMarkets,
|
|
45
47
|
SPOT_MARKETS: spotMarkets_1.MainnetSpotMarkets,
|
|
48
|
+
/** @deprecated use MARKET_LOOKUP_TABLES */
|
|
46
49
|
MARKET_LOOKUP_TABLE: 'Fpys8GRa5RBWfyeN7AaDUwFGD1zkDCA4z3t4CJLV8dfL',
|
|
50
|
+
MARKET_LOOKUP_TABLES: [
|
|
51
|
+
'Fpys8GRa5RBWfyeN7AaDUwFGD1zkDCA4z3t4CJLV8dfL',
|
|
52
|
+
'EiWSskK5HXnBTptiS5DH6gpAJRVNQ3cAhTKBGaiaysAb',
|
|
53
|
+
],
|
|
47
54
|
SERUM_LOOKUP_TABLE: 'GPZkp76cJtNL2mphCvT6FXkJCVPpouidnacckR6rzKDN',
|
|
48
55
|
DRIFT_ORACLE_RECEIVER_ID: exports.DRIFT_ORACLE_RECEIVER_ID,
|
|
49
56
|
SB_ON_DEMAND_PID: on_demand_1.ON_DEMAND_MAINNET_PID,
|
|
@@ -386,9 +386,9 @@ exports.MainnetPerpMarkets = [
|
|
|
386
386
|
symbol: 'APT-PERP',
|
|
387
387
|
baseAssetSymbol: 'APT',
|
|
388
388
|
marketIndex: 3,
|
|
389
|
-
oracle: new web3_js_1.PublicKey('
|
|
389
|
+
oracle: new web3_js_1.PublicKey('CXZhzKePYajrZgZyrzgvHYFKK3c5tNgDrRobAgySo8Nb'),
|
|
390
390
|
launchTs: 1675802661000,
|
|
391
|
-
oracleSource: __1.OracleSource.
|
|
391
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
392
392
|
pythFeedId: '0x03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5',
|
|
393
393
|
pythLazerId: 28,
|
|
394
394
|
},
|
|
@@ -410,9 +410,9 @@ exports.MainnetPerpMarkets = [
|
|
|
410
410
|
symbol: 'POL-PERP',
|
|
411
411
|
baseAssetSymbol: 'POL',
|
|
412
412
|
marketIndex: 5,
|
|
413
|
-
oracle: new web3_js_1.PublicKey('
|
|
413
|
+
oracle: new web3_js_1.PublicKey('HDveCibToLf157NtUqShCEWX3GcF4Aq8Ngt2bst1s1cc'),
|
|
414
414
|
launchTs: 1677690149000,
|
|
415
|
-
oracleSource: __1.OracleSource.
|
|
415
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
416
416
|
pythFeedId: '0xffd11c5a1cfd42f80afb2df4d9f264c15f956d68153335374ec10722edd70472',
|
|
417
417
|
pythLazerId: 32,
|
|
418
418
|
},
|
|
@@ -422,9 +422,9 @@ exports.MainnetPerpMarkets = [
|
|
|
422
422
|
symbol: 'ARB-PERP',
|
|
423
423
|
baseAssetSymbol: 'ARB',
|
|
424
424
|
marketIndex: 6,
|
|
425
|
-
oracle: new web3_js_1.PublicKey('
|
|
425
|
+
oracle: new web3_js_1.PublicKey('5DYEjGpr28q3EsLKAnLXiDq6UeaFgDFZ5Gdwgp5RmPAp'),
|
|
426
426
|
launchTs: 1679501812000,
|
|
427
|
-
oracleSource: __1.OracleSource.
|
|
427
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
428
428
|
pythFeedId: '0x3fa4252848f9f0a1480be62745a4629d9eb1322aebab8a791e344b3b9c1adcf5',
|
|
429
429
|
pythLazerId: 37,
|
|
430
430
|
},
|
|
@@ -446,9 +446,9 @@ exports.MainnetPerpMarkets = [
|
|
|
446
446
|
symbol: 'BNB-PERP',
|
|
447
447
|
baseAssetSymbol: 'BNB',
|
|
448
448
|
marketIndex: 8,
|
|
449
|
-
oracle: new web3_js_1.PublicKey('
|
|
449
|
+
oracle: new web3_js_1.PublicKey('A9J2j1pRB2aPqAbjUTtKy94niSCTuPUrpimfzvpZHKG1'),
|
|
450
450
|
launchTs: 1680808053000,
|
|
451
|
-
oracleSource: __1.OracleSource.
|
|
451
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
452
452
|
pythFeedId: '0x2f95862b045670cd22bee3114c39763a4a08beeb663b145d283c31d7d1101c4f',
|
|
453
453
|
pythLazerId: 15,
|
|
454
454
|
},
|
|
@@ -482,9 +482,9 @@ exports.MainnetPerpMarkets = [
|
|
|
482
482
|
symbol: 'OP-PERP',
|
|
483
483
|
baseAssetSymbol: 'OP',
|
|
484
484
|
marketIndex: 11,
|
|
485
|
-
oracle: new web3_js_1.PublicKey('
|
|
485
|
+
oracle: new web3_js_1.PublicKey('7GPbmQee2T4jMsJg99GuzWyMuzr8c2Uk7rAR9qvvQkzf'),
|
|
486
486
|
launchTs: 1686091480000,
|
|
487
|
-
oracleSource: __1.OracleSource.
|
|
487
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
488
488
|
pythFeedId: '0x385f64d993f7b77d8182ed5003d97c60aa3361f3cecfe711544d2d59165e9bdf',
|
|
489
489
|
pythLazerId: 41,
|
|
490
490
|
},
|
|
@@ -494,9 +494,9 @@ exports.MainnetPerpMarkets = [
|
|
|
494
494
|
symbol: 'RENDER-PERP',
|
|
495
495
|
baseAssetSymbol: 'RENDER',
|
|
496
496
|
marketIndex: 12,
|
|
497
|
-
oracle: new web3_js_1.PublicKey('
|
|
497
|
+
oracle: new web3_js_1.PublicKey('97EqsAGbTnShB7oYWAFFCVVAx8PWXgDYDhcpm99izNQ4'),
|
|
498
498
|
launchTs: 1687201081000,
|
|
499
|
-
oracleSource: __1.OracleSource.
|
|
499
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
500
500
|
pythFeedId: '0x3d4a2bd9535be6ce8059d75eadeba507b043257321aa544717c56fa19b49e35d',
|
|
501
501
|
pythLazerId: 34,
|
|
502
502
|
},
|
|
@@ -529,9 +529,9 @@ exports.MainnetPerpMarkets = [
|
|
|
529
529
|
symbol: 'INJ-PERP',
|
|
530
530
|
baseAssetSymbol: 'INJ',
|
|
531
531
|
marketIndex: 15,
|
|
532
|
-
oracle: new web3_js_1.PublicKey('
|
|
532
|
+
oracle: new web3_js_1.PublicKey('Ac442xcU276nb6gJFUCsNYAwAo6KWuw4xocxmG3nvDym'),
|
|
533
533
|
launchTs: 1698074659000,
|
|
534
|
-
oracleSource: __1.OracleSource.
|
|
534
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
535
535
|
pythFeedId: '0x7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592',
|
|
536
536
|
pythLazerId: 46,
|
|
537
537
|
},
|
|
@@ -541,9 +541,9 @@ exports.MainnetPerpMarkets = [
|
|
|
541
541
|
symbol: 'LINK-PERP',
|
|
542
542
|
baseAssetSymbol: 'LINK',
|
|
543
543
|
marketIndex: 16,
|
|
544
|
-
oracle: new web3_js_1.PublicKey('
|
|
544
|
+
oracle: new web3_js_1.PublicKey('rwyPmfH5xsHdjPf6XsVxvyQEZogX2k4pmhaKEVvgseW'),
|
|
545
545
|
launchTs: 1698074659000,
|
|
546
|
-
oracleSource: __1.OracleSource.
|
|
546
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
547
547
|
pythFeedId: '0x8ac0c70fff57e9aefdf5edf44b51d62c2d433653cbb2cf5cc06bb115af04d221',
|
|
548
548
|
pythLazerId: 19,
|
|
549
549
|
},
|
|
@@ -564,9 +564,9 @@ exports.MainnetPerpMarkets = [
|
|
|
564
564
|
symbol: 'PYTH-PERP',
|
|
565
565
|
baseAssetSymbol: 'PYTH',
|
|
566
566
|
marketIndex: 18,
|
|
567
|
-
oracle: new web3_js_1.PublicKey('
|
|
567
|
+
oracle: new web3_js_1.PublicKey('6Sfx8ZAt6xaEgMXTahR6GrT7oYB6nFBMoVyCmMyHmeJV'),
|
|
568
568
|
launchTs: 1700542800000,
|
|
569
|
-
oracleSource: __1.OracleSource.
|
|
569
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
570
570
|
pythFeedId: '0x0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff',
|
|
571
571
|
pythLazerId: 3,
|
|
572
572
|
},
|
|
@@ -600,9 +600,9 @@ exports.MainnetPerpMarkets = [
|
|
|
600
600
|
symbol: 'SEI-PERP',
|
|
601
601
|
baseAssetSymbol: 'SEI',
|
|
602
602
|
marketIndex: 21,
|
|
603
|
-
oracle: new web3_js_1.PublicKey('
|
|
603
|
+
oracle: new web3_js_1.PublicKey('Edk1TWipQtsaD8nnBXYQV1CEAiQb1GFtEAKeFZCi2A4C'),
|
|
604
604
|
launchTs: 1703173331000,
|
|
605
|
-
oracleSource: __1.OracleSource.
|
|
605
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
606
606
|
pythFeedId: '0x53614f1cb0c031d4af66c04cb9c756234adad0e1cee85303795091499a4084eb',
|
|
607
607
|
pythLazerId: 51,
|
|
608
608
|
},
|
|
@@ -612,9 +612,9 @@ exports.MainnetPerpMarkets = [
|
|
|
612
612
|
symbol: 'AVAX-PERP',
|
|
613
613
|
baseAssetSymbol: 'AVAX',
|
|
614
614
|
marketIndex: 22,
|
|
615
|
-
oracle: new web3_js_1.PublicKey('
|
|
615
|
+
oracle: new web3_js_1.PublicKey('5ASZLwk3GFCwZiDQ3XpmduRqNPEUGHXjELMX85u8McK3'),
|
|
616
616
|
launchTs: 1704209558000,
|
|
617
|
-
oracleSource: __1.OracleSource.
|
|
617
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
618
618
|
pythFeedId: '0x93da3352f9f1d105fdfe4971cfa80e9dd777bfc5d0f683ebb6e1294b92137bb7',
|
|
619
619
|
pythLazerId: 18,
|
|
620
620
|
},
|
|
@@ -648,9 +648,9 @@ exports.MainnetPerpMarkets = [
|
|
|
648
648
|
symbol: 'DYM-PERP',
|
|
649
649
|
baseAssetSymbol: 'DYM',
|
|
650
650
|
marketIndex: 25,
|
|
651
|
-
oracle: new web3_js_1.PublicKey('
|
|
651
|
+
oracle: new web3_js_1.PublicKey('HWDqaKbbNrEsgWPLMeKG39AguefMbHsWcvNSthToXG2t'),
|
|
652
652
|
launchTs: 1708448765000,
|
|
653
|
-
oracleSource: __1.OracleSource.
|
|
653
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
654
654
|
pythFeedId: '0xa9f3b2a89c6f85a6c20a9518abde39b944e839ca49a0c92307c65974d3f14a57',
|
|
655
655
|
pythLazerId: 83,
|
|
656
656
|
},
|
|
@@ -660,9 +660,9 @@ exports.MainnetPerpMarkets = [
|
|
|
660
660
|
symbol: 'TAO-PERP',
|
|
661
661
|
baseAssetSymbol: 'TAO',
|
|
662
662
|
marketIndex: 26,
|
|
663
|
-
oracle: new web3_js_1.PublicKey('
|
|
663
|
+
oracle: new web3_js_1.PublicKey('44fqbLqAkKK5kEj1FFvuEPYq56XoQQL3ABzCPrqsW3Cv'),
|
|
664
664
|
launchTs: 1709136669000,
|
|
665
|
-
oracleSource: __1.OracleSource.
|
|
665
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
666
666
|
pythFeedId: '0x410f41de235f2db824e562ea7ab2d3d3d4ff048316c61d629c0b93f58584e1af',
|
|
667
667
|
pythLazerId: 36,
|
|
668
668
|
},
|
|
@@ -672,9 +672,9 @@ exports.MainnetPerpMarkets = [
|
|
|
672
672
|
symbol: 'W-PERP',
|
|
673
673
|
baseAssetSymbol: 'W',
|
|
674
674
|
marketIndex: 27,
|
|
675
|
-
oracle: new web3_js_1.PublicKey('
|
|
675
|
+
oracle: new web3_js_1.PublicKey('CsFUXiA5dM4eCKjVBBy8tXhXzDkDRNoYjU5rjpHyfNEZ'),
|
|
676
676
|
launchTs: 1710418343000,
|
|
677
|
-
oracleSource: __1.OracleSource.
|
|
677
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
678
678
|
pythFeedId: '0xeff7446475e218517566ea99e72a4abec2e1bd8498b43b7d8331e29dcb059389',
|
|
679
679
|
pythLazerId: 102,
|
|
680
680
|
},
|
|
@@ -833,9 +833,9 @@ exports.MainnetPerpMarkets = [
|
|
|
833
833
|
symbol: 'TON-PERP',
|
|
834
834
|
baseAssetSymbol: 'TON',
|
|
835
835
|
marketIndex: 42,
|
|
836
|
-
oracle: new web3_js_1.PublicKey('
|
|
836
|
+
oracle: new web3_js_1.PublicKey('Cbhiaky9kxDsviokcQaS9qc4HmpAzLaGjfmdSah1qakL'),
|
|
837
837
|
launchTs: 1725551484000,
|
|
838
|
-
oracleSource: __1.OracleSource.
|
|
838
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
839
839
|
pythFeedId: '0x8963217838ab4cf5cadc172203c1f0b763fbaa45f346d8ee50ba994bbcac3026',
|
|
840
840
|
pythLazerId: 12,
|
|
841
841
|
},
|
|
@@ -1038,9 +1038,9 @@ exports.MainnetPerpMarkets = [
|
|
|
1038
1038
|
symbol: 'ME-PERP',
|
|
1039
1039
|
baseAssetSymbol: 'ME',
|
|
1040
1040
|
marketIndex: 61,
|
|
1041
|
-
oracle: new web3_js_1.PublicKey('
|
|
1041
|
+
oracle: new web3_js_1.PublicKey('BboTg1yT114FQkqT6MM3P3G3CcCktuM2RePgU8Gr3K4A'),
|
|
1042
1042
|
launchTs: 1733839936000,
|
|
1043
|
-
oracleSource: __1.OracleSource.
|
|
1043
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1044
1044
|
pythFeedId: '0x91519e3e48571e1232a85a938e714da19fe5ce05107f3eebb8a870b2e8020169',
|
|
1045
1045
|
pythLazerId: 93,
|
|
1046
1046
|
},
|
|
@@ -1050,9 +1050,9 @@ exports.MainnetPerpMarkets = [
|
|
|
1050
1050
|
symbol: 'PENGU-PERP',
|
|
1051
1051
|
baseAssetSymbol: 'PENGU',
|
|
1052
1052
|
marketIndex: 62,
|
|
1053
|
-
oracle: new web3_js_1.PublicKey('
|
|
1053
|
+
oracle: new web3_js_1.PublicKey('4A3KroGPjZxPAeBNF287V3NyRwV2q8iBi1vX7kHxTCh7'),
|
|
1054
1054
|
launchTs: 1734444000000,
|
|
1055
|
-
oracleSource: __1.OracleSource.
|
|
1055
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1056
1056
|
pythFeedId: '0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61',
|
|
1057
1057
|
pythLazerId: 97,
|
|
1058
1058
|
},
|
|
@@ -189,8 +189,8 @@ exports.MainnetSpotMarkets = [
|
|
|
189
189
|
symbol: 'PYTH',
|
|
190
190
|
marketIndex: 7,
|
|
191
191
|
poolId: 0,
|
|
192
|
-
oracle: new web3_js_1.PublicKey('
|
|
193
|
-
oracleSource: __1.OracleSource.
|
|
192
|
+
oracle: new web3_js_1.PublicKey('6Sfx8ZAt6xaEgMXTahR6GrT7oYB6nFBMoVyCmMyHmeJV'),
|
|
193
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
194
194
|
mint: new web3_js_1.PublicKey('HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3'),
|
|
195
195
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
196
196
|
precisionExp: numericConstants_1.SIX,
|
|
@@ -258,8 +258,8 @@ exports.MainnetSpotMarkets = [
|
|
|
258
258
|
symbol: 'RENDER',
|
|
259
259
|
marketIndex: 12,
|
|
260
260
|
poolId: 0,
|
|
261
|
-
oracle: new web3_js_1.PublicKey('
|
|
262
|
-
oracleSource: __1.OracleSource.
|
|
261
|
+
oracle: new web3_js_1.PublicKey('97EqsAGbTnShB7oYWAFFCVVAx8PWXgDYDhcpm99izNQ4'),
|
|
262
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
263
263
|
mint: new web3_js_1.PublicKey('rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof'),
|
|
264
264
|
precision: new __1.BN(10).pow(numericConstants_1.EIGHT),
|
|
265
265
|
precisionExp: numericConstants_1.EIGHT,
|
|
@@ -272,8 +272,8 @@ exports.MainnetSpotMarkets = [
|
|
|
272
272
|
symbol: 'W',
|
|
273
273
|
marketIndex: 13,
|
|
274
274
|
poolId: 0,
|
|
275
|
-
oracle: new web3_js_1.PublicKey('
|
|
276
|
-
oracleSource: __1.OracleSource.
|
|
275
|
+
oracle: new web3_js_1.PublicKey('CsFUXiA5dM4eCKjVBBy8tXhXzDkDRNoYjU5rjpHyfNEZ'),
|
|
276
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
277
277
|
mint: new web3_js_1.PublicKey('85VBFQZC9TZkfaptBWjvUw7YbZjy52A6mjtPGjstQAmQ'),
|
|
278
278
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
279
279
|
precisionExp: numericConstants_1.SIX,
|
|
@@ -473,8 +473,8 @@ exports.MainnetSpotMarkets = [
|
|
|
473
473
|
symbol: 'ME',
|
|
474
474
|
marketIndex: 30,
|
|
475
475
|
poolId: 0,
|
|
476
|
-
oracle: new web3_js_1.PublicKey('
|
|
477
|
-
oracleSource: __1.OracleSource.
|
|
476
|
+
oracle: new web3_js_1.PublicKey('BboTg1yT114FQkqT6MM3P3G3CcCktuM2RePgU8Gr3K4A'),
|
|
477
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
478
478
|
mint: new web3_js_1.PublicKey('MEFNBXixkEbait3xn9bkm8WsJzXtVsaJEn4c8Sam21u'),
|
|
479
479
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
480
480
|
precisionExp: numericConstants_1.SIX,
|
|
@@ -485,8 +485,8 @@ exports.MainnetSpotMarkets = [
|
|
|
485
485
|
symbol: 'PENGU',
|
|
486
486
|
marketIndex: 31,
|
|
487
487
|
poolId: 0,
|
|
488
|
-
oracle: new web3_js_1.PublicKey('
|
|
489
|
-
oracleSource: __1.OracleSource.
|
|
488
|
+
oracle: new web3_js_1.PublicKey('4A3KroGPjZxPAeBNF287V3NyRwV2q8iBi1vX7kHxTCh7'),
|
|
489
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
490
490
|
mint: new web3_js_1.PublicKey('2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv'),
|
|
491
491
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
492
492
|
precisionExp: numericConstants_1.SIX,
|
|
@@ -30,7 +30,7 @@ class OrderNode {
|
|
|
30
30
|
return msg;
|
|
31
31
|
}
|
|
32
32
|
getPrice(oraclePriceData, slot) {
|
|
33
|
-
return (0, __1.getLimitPrice)(this.order, oraclePriceData, slot, undefined, this.applyProtectedMakerOffset);
|
|
33
|
+
return (0, __1.getLimitPrice)(this.order, oraclePriceData, slot, undefined, this.applyProtectedMakerOffset && this.isProtectedMaker);
|
|
34
34
|
}
|
|
35
35
|
isBaseFilled() {
|
|
36
36
|
return this.order.baseAssetAmountFilled.eq(this.order.baseAssetAmount);
|
|
@@ -49,7 +49,7 @@ exports.TakingLimitOrderNode = TakingLimitOrderNode;
|
|
|
49
49
|
class RestingLimitOrderNode extends OrderNode {
|
|
50
50
|
getSortValue(order) {
|
|
51
51
|
let sortValue = order.price;
|
|
52
|
-
if (this.applyProtectedMakerOffset) {
|
|
52
|
+
if (this.applyProtectedMakerOffset && this.isProtectedMaker) {
|
|
53
53
|
const offset = sortValue.divn(1000);
|
|
54
54
|
if ((0, __1.isVariant)(order.direction, 'long')) {
|
|
55
55
|
sortValue = sortValue.sub(offset);
|
|
@@ -60,8 +60,12 @@ export declare class DriftClient {
|
|
|
60
60
|
mustIncludePerpMarketIndexes: Set<number>;
|
|
61
61
|
mustIncludeSpotMarketIndexes: Set<number>;
|
|
62
62
|
authority: PublicKey;
|
|
63
|
+
/** @deprecated use marketLookupTables */
|
|
63
64
|
marketLookupTable: PublicKey;
|
|
65
|
+
/** @deprecated use lookupTableAccounts */
|
|
64
66
|
lookupTableAccount: AddressLookupTableAccount;
|
|
67
|
+
marketLookupTables: PublicKey[];
|
|
68
|
+
lookupTableAccounts: AddressLookupTableAccount[];
|
|
65
69
|
includeDelegates?: boolean;
|
|
66
70
|
authoritySubAccountMap?: Map<string, number[]>;
|
|
67
71
|
skipLoadUsers?: boolean;
|
|
@@ -118,7 +122,9 @@ export declare class DriftClient {
|
|
|
118
122
|
getPhoenixV1FulfillmentConfigs(): Promise<PhoenixV1FulfillmentConfigAccount[]>;
|
|
119
123
|
getOpenbookV2FulfillmentConfig(openbookMarket: PublicKey): Promise<OpenbookV2FulfillmentConfigAccount>;
|
|
120
124
|
getOpenbookV2FulfillmentConfigs(): Promise<OpenbookV2FulfillmentConfigAccount[]>;
|
|
125
|
+
/** @deprecated use fetchAllLookupTableAccounts() */
|
|
121
126
|
fetchMarketLookupTableAccount(): Promise<AddressLookupTableAccount>;
|
|
127
|
+
fetchAllLookupTableAccounts(): Promise<AddressLookupTableAccount[]>;
|
|
122
128
|
/**
|
|
123
129
|
* Update the wallet to use for drift transactions and linked user account
|
|
124
130
|
* @param newWallet
|
|
@@ -554,21 +560,25 @@ export declare class DriftClient {
|
|
|
554
560
|
taker: PublicKey;
|
|
555
561
|
takerStats: PublicKey;
|
|
556
562
|
takerUserAccount: UserAccount;
|
|
563
|
+
signingAuthority: PublicKey;
|
|
557
564
|
}, precedingIxs?: TransactionInstruction[], overrideIxCount?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
558
565
|
getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams: SignedSwiftOrderParams, marketIndex: number, takerInfo: {
|
|
559
566
|
taker: PublicKey;
|
|
560
567
|
takerStats: PublicKey;
|
|
561
568
|
takerUserAccount: UserAccount;
|
|
562
|
-
|
|
569
|
+
signingAuthority: PublicKey;
|
|
570
|
+
}, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): Promise<TransactionInstruction[]>;
|
|
563
571
|
placeAndMakeSwiftPerpOrder(signedSwiftOrderParams: SignedSwiftOrderParams, swiftOrderUuid: Uint8Array, takerInfo: {
|
|
564
572
|
taker: PublicKey;
|
|
565
573
|
takerStats: PublicKey;
|
|
566
574
|
takerUserAccount: UserAccount;
|
|
575
|
+
signingAuthority: PublicKey;
|
|
567
576
|
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): Promise<TransactionSignature>;
|
|
568
577
|
getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams: SignedSwiftOrderParams, swiftOrderUuid: Uint8Array, takerInfo: {
|
|
569
578
|
taker: PublicKey;
|
|
570
579
|
takerStats: PublicKey;
|
|
571
580
|
takerUserAccount: UserAccount;
|
|
581
|
+
signingAuthority: PublicKey;
|
|
572
582
|
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): Promise<TransactionInstruction[]>;
|
|
573
583
|
encodeRFQMakerOrderParams(message: RFQMakerOrderParams): Buffer;
|
|
574
584
|
placeAndMatchRFQOrders(rfqMatches: RFQMatch[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
@@ -191,6 +191,10 @@ class DriftClient {
|
|
|
191
191
|
if (!this.marketLookupTable) {
|
|
192
192
|
this.marketLookupTable = new web3_js_1.PublicKey(config_1.configs[this.env].MARKET_LOOKUP_TABLE);
|
|
193
193
|
}
|
|
194
|
+
this.marketLookupTables = config.marketLookupTables;
|
|
195
|
+
if (!this.marketLookupTables) {
|
|
196
|
+
this.marketLookupTables = config_1.configs[this.env].MARKET_LOOKUP_TABLES.map((tableAddr) => new web3_js_1.PublicKey(tableAddr));
|
|
197
|
+
}
|
|
194
198
|
const delistedMarketSetting = config.delistedMarketSetting || types_2.DelistedMarketSetting.Unsubscribe;
|
|
195
199
|
const noMarketsAndOraclesSpecified = config.perpMarketIndexes === undefined &&
|
|
196
200
|
config.spotMarketIndexes === undefined &&
|
|
@@ -366,6 +370,7 @@ class DriftClient {
|
|
|
366
370
|
const accounts = await this.program.account.openbookV2FulfillmentConfig.all();
|
|
367
371
|
return accounts.map((account) => account.account);
|
|
368
372
|
}
|
|
373
|
+
/** @deprecated use fetchAllLookupTableAccounts() */
|
|
369
374
|
async fetchMarketLookupTableAccount() {
|
|
370
375
|
if (this.lookupTableAccount)
|
|
371
376
|
return this.lookupTableAccount;
|
|
@@ -377,6 +382,18 @@ class DriftClient {
|
|
|
377
382
|
this.lookupTableAccount = lookupTableAccount;
|
|
378
383
|
return lookupTableAccount;
|
|
379
384
|
}
|
|
385
|
+
async fetchAllLookupTableAccounts() {
|
|
386
|
+
if (this.lookupTableAccounts)
|
|
387
|
+
return this.lookupTableAccounts;
|
|
388
|
+
if (!this.marketLookupTables) {
|
|
389
|
+
console.log('Market lookup table address not set');
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const lookupTableAccountResults = await Promise.all(this.marketLookupTables.map((lookupTable) => this.connection.getAddressLookupTable(lookupTable)));
|
|
393
|
+
const lookupTableAccounts = lookupTableAccountResults.map((result) => result.value);
|
|
394
|
+
this.lookupTableAccounts = lookupTableAccounts;
|
|
395
|
+
return lookupTableAccounts;
|
|
396
|
+
}
|
|
380
397
|
/**
|
|
381
398
|
* Update the wallet to use for drift transactions and linked user account
|
|
382
399
|
* @param newWallet
|
|
@@ -2120,8 +2137,8 @@ class DriftClient {
|
|
|
2120
2137
|
return txSig;
|
|
2121
2138
|
}
|
|
2122
2139
|
async preparePlaceOrdersTx(params, txParams, subAccountId, optionalIxs) {
|
|
2123
|
-
const
|
|
2124
|
-
const tx = await this.buildTransaction(await this.getPlaceOrdersIx(params, subAccountId), txParams, undefined,
|
|
2140
|
+
const lookupTableAccounts = await this.fetchAllLookupTableAccounts();
|
|
2141
|
+
const tx = await this.buildTransaction(await this.getPlaceOrdersIx(params, subAccountId), txParams, undefined, lookupTableAccounts, undefined, undefined, optionalIxs);
|
|
2125
2142
|
return {
|
|
2126
2143
|
placeOrdersTx: tx,
|
|
2127
2144
|
};
|
|
@@ -3044,7 +3061,7 @@ class DriftClient {
|
|
|
3044
3061
|
};
|
|
3045
3062
|
// Get recent block hash so that we can re-use it for all transactions. Makes this logic run faster with fewer RPC requests
|
|
3046
3063
|
const recentBlockHash = await this.txHandler.getLatestBlockhashForTransaction();
|
|
3047
|
-
const
|
|
3064
|
+
const lookupTableAccounts = await this.fetchAllLookupTableAccounts();
|
|
3048
3065
|
let earlyExitFailedPlaceAndTakeSim = false;
|
|
3049
3066
|
const prepPlaceAndTakeTx = async () => {
|
|
3050
3067
|
var _a;
|
|
@@ -3061,7 +3078,7 @@ class DriftClient {
|
|
|
3061
3078
|
useSimulatedComputeUnits: false,
|
|
3062
3079
|
};
|
|
3063
3080
|
if (shouldUseSimulationComputeUnits || shouldExitIfSimulationFails) {
|
|
3064
|
-
const placeAndTakeTxToSim = (await this.buildTransaction(placeAndTakeIxs, txParams, undefined,
|
|
3081
|
+
const placeAndTakeTxToSim = (await this.buildTransaction(placeAndTakeIxs, txParams, undefined, lookupTableAccounts, true, recentBlockHash, optionalIxs));
|
|
3065
3082
|
const simulationResult = await txParamProcessor_1.TransactionParamProcessor.getTxSimComputeUnits(placeAndTakeTxToSim, this.connection, (_a = txParams.computeUnitsBufferMultiplier) !== null && _a !== void 0 ? _a : 1.2, txParams.lowerBoundCu);
|
|
3066
3083
|
if (shouldExitIfSimulationFails && !simulationResult.success) {
|
|
3067
3084
|
earlyExitFailedPlaceAndTakeSim = true;
|
|
@@ -3070,17 +3087,17 @@ class DriftClient {
|
|
|
3070
3087
|
txsToSign.placeAndTakeTx = await this.buildTransaction(placeAndTakeIxs, {
|
|
3071
3088
|
...txParamsWithoutImplicitSimulation,
|
|
3072
3089
|
computeUnits: simulationResult.computeUnits,
|
|
3073
|
-
}, undefined,
|
|
3090
|
+
}, undefined, lookupTableAccounts, undefined, recentBlockHash, optionalIxs);
|
|
3074
3091
|
}
|
|
3075
3092
|
else {
|
|
3076
|
-
txsToSign.placeAndTakeTx = await this.buildTransaction(placeAndTakeIxs, txParams, undefined,
|
|
3093
|
+
txsToSign.placeAndTakeTx = await this.buildTransaction(placeAndTakeIxs, txParams, undefined, lookupTableAccounts, undefined, recentBlockHash, optionalIxs);
|
|
3077
3094
|
}
|
|
3078
3095
|
return;
|
|
3079
3096
|
};
|
|
3080
3097
|
const prepCancelOrderTx = async () => {
|
|
3081
3098
|
if (cancelExistingOrders && (0, types_1.isVariant)(orderParams.marketType, 'perp')) {
|
|
3082
3099
|
const cancelOrdersIx = await this.getCancelOrdersIx(orderParams.marketType, orderParams.marketIndex, null, subAccountId);
|
|
3083
|
-
txsToSign.cancelExistingOrdersTx = await this.buildTransaction([cancelOrdersIx], txParams, this.txVersion,
|
|
3100
|
+
txsToSign.cancelExistingOrdersTx = await this.buildTransaction([cancelOrdersIx], txParams, this.txVersion, lookupTableAccounts, undefined, recentBlockHash, optionalIxs);
|
|
3084
3101
|
}
|
|
3085
3102
|
return;
|
|
3086
3103
|
};
|
|
@@ -3088,7 +3105,7 @@ class DriftClient {
|
|
|
3088
3105
|
if (settlePnl && (0, types_1.isVariant)(orderParams.marketType, 'perp')) {
|
|
3089
3106
|
const userAccountPublicKey = await this.getUserAccountPublicKey(subAccountId);
|
|
3090
3107
|
const settlePnlIx = await this.settlePNLIx(userAccountPublicKey, this.getUserAccount(subAccountId), orderParams.marketIndex);
|
|
3091
|
-
txsToSign.settlePnlTx = await this.buildTransaction([settlePnlIx], txParams, this.txVersion,
|
|
3108
|
+
txsToSign.settlePnlTx = await this.buildTransaction([settlePnlIx], txParams, this.txVersion, lookupTableAccounts, undefined, recentBlockHash, optionalIxs);
|
|
3092
3109
|
}
|
|
3093
3110
|
return;
|
|
3094
3111
|
};
|
|
@@ -3252,30 +3269,27 @@ class DriftClient {
|
|
|
3252
3269
|
return Buffer.from(tweetnacl_1.default.sign.detached(message, keypair.secretKey));
|
|
3253
3270
|
}
|
|
3254
3271
|
async placeSwiftTakerOrder(signedSwiftOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideIxCount, txParams) {
|
|
3255
|
-
const ixs = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo,
|
|
3272
|
+
const ixs = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo, precedingIxs, overrideIxCount);
|
|
3256
3273
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
|
|
3257
3274
|
return txSig;
|
|
3258
3275
|
}
|
|
3259
|
-
async getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo,
|
|
3260
|
-
if (!authority && !takerInfo.takerUserAccount) {
|
|
3261
|
-
throw new Error('authority or takerUserAccount must be provided');
|
|
3262
|
-
}
|
|
3276
|
+
async getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideIxCount) {
|
|
3263
3277
|
const remainingAccounts = this.getRemainingAccounts({
|
|
3264
3278
|
userAccounts: [takerInfo.takerUserAccount],
|
|
3265
3279
|
useMarketLastSlotCache: true,
|
|
3266
3280
|
readablePerpMarketIndex: marketIndex,
|
|
3267
3281
|
});
|
|
3268
|
-
const authorityToUse = authority || takerInfo.takerUserAccount.authority;
|
|
3269
3282
|
const messageLengthBuffer = Buffer.alloc(2);
|
|
3270
3283
|
messageLengthBuffer.writeUInt16LE(signedSwiftOrderParams.orderParams.length);
|
|
3271
3284
|
const swiftIxData = Buffer.concat([
|
|
3272
3285
|
signedSwiftOrderParams.signature,
|
|
3273
|
-
|
|
3286
|
+
takerInfo.signingAuthority.toBytes(),
|
|
3274
3287
|
messageLengthBuffer,
|
|
3275
3288
|
signedSwiftOrderParams.orderParams,
|
|
3276
3289
|
]);
|
|
3277
3290
|
const swiftOrderParamsSignatureIx = (0, pythOracleUtils_1.createMinimalEd25519VerifyIx)(overrideIxCount || precedingIxs.length + 1, 12, swiftIxData, 0);
|
|
3278
|
-
const
|
|
3291
|
+
const isDelegateSigner = takerInfo.signingAuthority.equals(takerInfo.takerUserAccount.delegate);
|
|
3292
|
+
const placeTakerSwiftPerpOrderIx = this.program.instruction.placeSwiftTakerOrder(swiftIxData, isDelegateSigner, {
|
|
3279
3293
|
accounts: {
|
|
3280
3294
|
state: await this.getStatePublicKey(),
|
|
3281
3295
|
user: takerInfo.taker,
|
|
@@ -3295,7 +3309,7 @@ class DriftClient {
|
|
|
3295
3309
|
return txSig;
|
|
3296
3310
|
}
|
|
3297
3311
|
async getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [], overrideIxCount) {
|
|
3298
|
-
const [swiftOrderSignatureIx, placeTakerSwiftPerpOrderIx] = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, orderParams.marketIndex, takerInfo,
|
|
3312
|
+
const [swiftOrderSignatureIx, placeTakerSwiftPerpOrderIx] = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, orderParams.marketIndex, takerInfo, precedingIxs, overrideIxCount);
|
|
3299
3313
|
orderParams = (0, orderParams_1.getOrderParams)(orderParams, { marketType: types_1.MarketType.PERP });
|
|
3300
3314
|
const userStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
3301
3315
|
const user = await this.getUserAccountPublicKey(subAccountId);
|
|
@@ -3695,8 +3709,8 @@ class DriftClient {
|
|
|
3695
3709
|
return ixs;
|
|
3696
3710
|
}
|
|
3697
3711
|
async settlePNL(settleeUserAccountPublicKey, settleeUserAccount, marketIndex, txParams, optionalIxs) {
|
|
3698
|
-
const
|
|
3699
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.settlePNLIx(settleeUserAccountPublicKey, settleeUserAccount, marketIndex), txParams, undefined,
|
|
3712
|
+
const lookupTableAccounts = await this.fetchAllLookupTableAccounts();
|
|
3713
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.settlePNLIx(settleeUserAccountPublicKey, settleeUserAccount, marketIndex), txParams, undefined, lookupTableAccounts, undefined, undefined, optionalIxs), [], this.opts);
|
|
3700
3714
|
return txSig;
|
|
3701
3715
|
}
|
|
3702
3716
|
async settlePNLIx(settleeUserAccountPublicKey, settleeUserAccount, marketIndex) {
|
|
@@ -4777,7 +4791,7 @@ class DriftClient {
|
|
|
4777
4791
|
ixs: [pullIx],
|
|
4778
4792
|
payer: this.wallet.publicKey,
|
|
4779
4793
|
computeUnitLimitMultiple: 1.3,
|
|
4780
|
-
lookupTables:
|
|
4794
|
+
lookupTables: await this.fetchAllLookupTableAccounts(),
|
|
4781
4795
|
});
|
|
4782
4796
|
const { txSig } = await this.sendTransaction(tx, [], {
|
|
4783
4797
|
commitment: 'processed',
|
|
@@ -4949,7 +4963,7 @@ class DriftClient {
|
|
|
4949
4963
|
txParams: txParams !== null && txParams !== void 0 ? txParams : this.txParams,
|
|
4950
4964
|
connection: this.connection,
|
|
4951
4965
|
preFlightCommitment: this.opts.preflightCommitment,
|
|
4952
|
-
|
|
4966
|
+
fetchAllMarketLookupTableAccounts: this.fetchAllLookupTableAccounts.bind(this),
|
|
4953
4967
|
lookupTables,
|
|
4954
4968
|
forceVersionedTransaction,
|
|
4955
4969
|
recentBlockhash,
|
|
@@ -4963,7 +4977,7 @@ class DriftClient {
|
|
|
4963
4977
|
txParams: txParams !== null && txParams !== void 0 ? txParams : this.txParams,
|
|
4964
4978
|
connection: this.connection,
|
|
4965
4979
|
preFlightCommitment: this.opts.preflightCommitment,
|
|
4966
|
-
|
|
4980
|
+
fetchAllMarketLookupTableAccounts: this.fetchAllLookupTableAccounts.bind(this),
|
|
4967
4981
|
lookupTables,
|
|
4968
4982
|
forceVersionedTransaction,
|
|
4969
4983
|
});
|
|
@@ -4975,7 +4989,7 @@ class DriftClient {
|
|
|
4975
4989
|
txParams: txParams !== null && txParams !== void 0 ? txParams : this.txParams,
|
|
4976
4990
|
connection: this.connection,
|
|
4977
4991
|
preFlightCommitment: this.opts.preflightCommitment,
|
|
4978
|
-
|
|
4992
|
+
fetchAllMarketLookupTableAccounts: this.fetchAllLookupTableAccounts.bind(this),
|
|
4979
4993
|
lookupTables,
|
|
4980
4994
|
forceVersionedTransaction,
|
|
4981
4995
|
});
|
|
@@ -4987,7 +5001,7 @@ class DriftClient {
|
|
|
4987
5001
|
txParams: txParams !== null && txParams !== void 0 ? txParams : this.txParams,
|
|
4988
5002
|
connection: this.connection,
|
|
4989
5003
|
preFlightCommitment: this.opts.preflightCommitment,
|
|
4990
|
-
|
|
5004
|
+
fetchAllMarketLookupTableAccounts: this.fetchAllLookupTableAccounts.bind(this),
|
|
4991
5005
|
lookupTables,
|
|
4992
5006
|
forceVersionedTransaction,
|
|
4993
5007
|
});
|
|
@@ -19,7 +19,9 @@ export type DriftClientConfig = {
|
|
|
19
19
|
activeSubAccountId?: number;
|
|
20
20
|
perpMarketIndexes?: number[];
|
|
21
21
|
spotMarketIndexes?: number[];
|
|
22
|
+
/** @deprecated use marketLookupTables */
|
|
22
23
|
marketLookupTable?: PublicKey;
|
|
24
|
+
marketLookupTables?: PublicKey[];
|
|
23
25
|
oracleInfos?: OracleInfo[];
|
|
24
26
|
userStats?: boolean;
|
|
25
27
|
authority?: PublicKey;
|
|
@@ -244,6 +244,11 @@
|
|
|
244
244
|
"name": "authority",
|
|
245
245
|
"isMut": false,
|
|
246
246
|
"isSigner": false
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"name": "signer",
|
|
250
|
+
"isMut": false,
|
|
251
|
+
"isSigner": true
|
|
247
252
|
}
|
|
248
253
|
],
|
|
249
254
|
"args": []
|
|
@@ -889,6 +894,10 @@
|
|
|
889
894
|
{
|
|
890
895
|
"name": "swiftOrderParamsMessageBytes",
|
|
891
896
|
"type": "bytes"
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
"name": "isDelegateSigner",
|
|
900
|
+
"type": "bool"
|
|
892
901
|
}
|
|
893
902
|
]
|
|
894
903
|
},
|
|
@@ -12139,6 +12148,12 @@
|
|
|
12139
12148
|
},
|
|
12140
12149
|
{
|
|
12141
12150
|
"name": "InvalidMessageHex"
|
|
12151
|
+
},
|
|
12152
|
+
{
|
|
12153
|
+
"name": "InvalidMessageData"
|
|
12154
|
+
},
|
|
12155
|
+
{
|
|
12156
|
+
"name": "LoadInstructionAtFailed"
|
|
12142
12157
|
}
|
|
12143
12158
|
]
|
|
12144
12159
|
}
|
package/lib/browser/index.d.ts
CHANGED
package/lib/browser/index.js
CHANGED
|
@@ -148,3 +148,4 @@ __exportStar(require("./util/chainClock"), exports);
|
|
|
148
148
|
__exportStar(require("./util/TransactionConfirmationManager"), exports);
|
|
149
149
|
__exportStar(require("./clock/clockSubscriber"), exports);
|
|
150
150
|
__exportStar(require("./math/userStatus"), exports);
|
|
151
|
+
__exportStar(require("./constants/txConstants"), exports);
|
|
@@ -163,9 +163,9 @@ function calculateAvailablePerpLiquidity(market, oraclePriceData, dlob, slot) {
|
|
|
163
163
|
exports.calculateAvailablePerpLiquidity = calculateAvailablePerpLiquidity;
|
|
164
164
|
function calculatePerpMarketBaseLiquidatorFee(market, userHighLeverageMode) {
|
|
165
165
|
if (userHighLeverageMode && market.highLeverageMarginRatioMaintenance > 0) {
|
|
166
|
+
const marginRatio = market.highLeverageMarginRatioMaintenance * 100;
|
|
166
167
|
// min(liquidator_fee, .8 * high_leverage_margin_ratio_maintenance)
|
|
167
|
-
return Math.min(market.liquidatorFee,
|
|
168
|
-
Math.floor(market.highLeverageMarginRatioMaintenance / 5));
|
|
168
|
+
return Math.min(market.liquidatorFee, marginRatio - Math.floor(marginRatio / 5));
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
171
|
return market.liquidatorFee;
|
|
@@ -93,6 +93,7 @@ class SwiftOrderSubscriber {
|
|
|
93
93
|
async getPlaceAndMakeSwiftOrderIxs(orderMessageRaw, swiftOrderParamsMessage, makerOrderParams) {
|
|
94
94
|
const swiftOrderParamsBuf = Buffer.from(orderMessageRaw['order_message'], 'hex');
|
|
95
95
|
const takerAuthority = new web3_js_1.PublicKey(orderMessageRaw['taker_authority']);
|
|
96
|
+
const signingAuthority = new web3_js_1.PublicKey(orderMessageRaw['signing_authority']);
|
|
96
97
|
const takerUserPubkey = await (0, __1.getUserAccountPublicKey)(this.driftClient.program.programId, takerAuthority, swiftOrderParamsMessage.subAccountId);
|
|
97
98
|
const takerUserAccount = (await this.userMap.mustGet(takerUserPubkey.toString())).getUserAccount();
|
|
98
99
|
const ixs = await this.driftClient.getPlaceAndMakeSwiftPerpOrderIxs({
|
|
@@ -102,6 +103,7 @@ class SwiftOrderSubscriber {
|
|
|
102
103
|
taker: takerUserPubkey,
|
|
103
104
|
takerUserAccount,
|
|
104
105
|
takerStats: (0, __1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, takerUserAccount.authority),
|
|
106
|
+
signingAuthority: signingAuthority,
|
|
105
107
|
}, Object.assign({}, makerOrderParams, {
|
|
106
108
|
postOnly: __1.PostOnlyParams.MUST_POST_ONLY,
|
|
107
109
|
immediateOrCancel: true,
|