@drift-labs/sdk 2.110.0-beta.21 → 2.110.0-beta.23
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/constants/perpMarkets.js +28 -20
- package/lib/browser/constants/spotMarkets.js +22 -16
- package/lib/browser/driftClient.d.ts +2 -0
- package/lib/browser/driftClient.js +56 -0
- package/lib/browser/idl/drift.json +85 -0
- package/lib/node/constants/perpMarkets.js +28 -20
- package/lib/node/constants/spotMarkets.js +22 -16
- package/lib/node/driftClient.d.ts +2 -0
- package/lib/node/driftClient.js +56 -0
- package/lib/node/idl/drift.json +85 -0
- package/package.json +1 -1
- package/src/constants/perpMarkets.ts +28 -20
- package/src/constants/spotMarkets.ts +22 -16
- package/src/driftClient.ts +132 -0
- package/src/idl/drift.json +85 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.110.0-beta.
|
|
1
|
+
2.110.0-beta.23
|
|
@@ -434,9 +434,9 @@ exports.MainnetPerpMarkets = [
|
|
|
434
434
|
symbol: 'DOGE-PERP',
|
|
435
435
|
baseAssetSymbol: 'DOGE',
|
|
436
436
|
marketIndex: 7,
|
|
437
|
-
oracle: new web3_js_1.PublicKey('
|
|
437
|
+
oracle: new web3_js_1.PublicKey('GqjDJZu9bNCebq5PTUbjRrgw1LK84GEexVjrfYJ76YXc'),
|
|
438
438
|
launchTs: 1680808053000,
|
|
439
|
-
oracleSource: __1.OracleSource.
|
|
439
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
440
440
|
pythFeedId: '0xdcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c',
|
|
441
441
|
pythLazerId: 13,
|
|
442
442
|
},
|
|
@@ -518,10 +518,11 @@ exports.MainnetPerpMarkets = [
|
|
|
518
518
|
symbol: 'HNT-PERP',
|
|
519
519
|
baseAssetSymbol: 'HNT',
|
|
520
520
|
marketIndex: 14,
|
|
521
|
-
oracle: new web3_js_1.PublicKey('
|
|
521
|
+
oracle: new web3_js_1.PublicKey('AEPgc6qUTCT8AwdckPcGbJXtcM9bj8mGYAyHE4BscJtm'),
|
|
522
522
|
launchTs: 1692294955000,
|
|
523
|
-
oracleSource: __1.OracleSource.
|
|
523
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
524
524
|
pythFeedId: '0x649fdd7ec08e8e2a20f425729854e90293dcbe2376abc47197a14da6ff339756',
|
|
525
|
+
pythLazerId: 168,
|
|
525
526
|
},
|
|
526
527
|
{
|
|
527
528
|
fullName: 'INJ',
|
|
@@ -636,9 +637,9 @@ exports.MainnetPerpMarkets = [
|
|
|
636
637
|
symbol: 'JUP-PERP',
|
|
637
638
|
baseAssetSymbol: 'JUP',
|
|
638
639
|
marketIndex: 24,
|
|
639
|
-
oracle: new web3_js_1.PublicKey('
|
|
640
|
+
oracle: new web3_js_1.PublicKey('DXqKSHyhTBKEW4qgnL7ycbf3Jca5hCvUgWHFYWsh4KJa'),
|
|
640
641
|
launchTs: 1706713201000,
|
|
641
|
-
oracleSource: __1.OracleSource.
|
|
642
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
642
643
|
pythFeedId: '0x0a0408d619e9380abad35060f9192039ed5042fa6f82301d0e48bb52be830996',
|
|
643
644
|
pythLazerId: 92,
|
|
644
645
|
},
|
|
@@ -751,10 +752,11 @@ exports.MainnetPerpMarkets = [
|
|
|
751
752
|
symbol: 'POPCAT-PERP',
|
|
752
753
|
baseAssetSymbol: 'POPCAT',
|
|
753
754
|
marketIndex: 34,
|
|
754
|
-
oracle: new web3_js_1.PublicKey('
|
|
755
|
+
oracle: new web3_js_1.PublicKey('C5fiAmQyjdfDR4EGepZqnEL3fJwMBav5yoAk6XyKMF6u'),
|
|
755
756
|
launchTs: 1720013054000,
|
|
756
|
-
oracleSource: __1.OracleSource.
|
|
757
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
757
758
|
pythFeedId: '0xb9312a7ee50e189ef045aa3c7842e099b061bd9bdc99ac645956c3b660dc8cce',
|
|
759
|
+
pythLazerId: 130,
|
|
758
760
|
},
|
|
759
761
|
{
|
|
760
762
|
fullName: 'Wen',
|
|
@@ -928,10 +930,11 @@ exports.MainnetPerpMarkets = [
|
|
|
928
930
|
symbol: '1KMEW-PERP',
|
|
929
931
|
baseAssetSymbol: '1KMEW',
|
|
930
932
|
marketIndex: 51,
|
|
931
|
-
oracle: new web3_js_1.PublicKey('
|
|
933
|
+
oracle: new web3_js_1.PublicKey('138RQdT1frDTnEp989V7gUWoQ5yg382ns4ihjvgJLcz7'),
|
|
932
934
|
launchTs: 1729702915000,
|
|
933
|
-
oracleSource: __1.OracleSource.
|
|
935
|
+
oracleSource: __1.OracleSource.PYTH_LAZER_1K,
|
|
934
936
|
pythFeedId: '0x514aed52ca5294177f20187ae883cec4a018619772ddce41efcc36a6448f5d5d',
|
|
937
|
+
pythLazerId: 137,
|
|
935
938
|
},
|
|
936
939
|
{
|
|
937
940
|
fullName: 'MICHI',
|
|
@@ -1016,10 +1019,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1016
1019
|
symbol: 'HYPE-PERP',
|
|
1017
1020
|
baseAssetSymbol: 'HYPE',
|
|
1018
1021
|
marketIndex: 59,
|
|
1019
|
-
oracle: new web3_js_1.PublicKey('
|
|
1022
|
+
oracle: new web3_js_1.PublicKey('3ivZ5AnnUhocgmjiWjT8kDV87S6PpEL3CEHcd3vn2itM'),
|
|
1020
1023
|
launchTs: 1733374800000,
|
|
1021
|
-
oracleSource: __1.OracleSource.
|
|
1024
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1022
1025
|
pythFeedId: '0x4279e31cc369bbcc2faf022b382b080e32a8e689ff20fbc530d2a603eb6cd98b',
|
|
1026
|
+
pythLazerId: 110,
|
|
1023
1027
|
},
|
|
1024
1028
|
{
|
|
1025
1029
|
fullName: 'LiteCoin',
|
|
@@ -1027,10 +1031,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1027
1031
|
symbol: 'LTC-PERP',
|
|
1028
1032
|
baseAssetSymbol: 'LTC',
|
|
1029
1033
|
marketIndex: 60,
|
|
1030
|
-
oracle: new web3_js_1.PublicKey('
|
|
1034
|
+
oracle: new web3_js_1.PublicKey('CrW8rga5bEZP1KBnqoQmPUcnYjrCPYQFbrMja99QKxsK'),
|
|
1031
1035
|
launchTs: 1733374800000,
|
|
1032
|
-
oracleSource: __1.OracleSource.
|
|
1036
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1033
1037
|
pythFeedId: '0x6e3f3fa8253588df9326580180233eb791e03b443a3ba7a1d892e73874e19a54',
|
|
1038
|
+
pythLazerId: 26,
|
|
1034
1039
|
},
|
|
1035
1040
|
{
|
|
1036
1041
|
fullName: 'Magic Eden',
|
|
@@ -1062,10 +1067,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1062
1067
|
symbol: 'AI16Z-PERP',
|
|
1063
1068
|
baseAssetSymbol: 'AI16Z',
|
|
1064
1069
|
marketIndex: 63,
|
|
1065
|
-
oracle: new web3_js_1.PublicKey('
|
|
1070
|
+
oracle: new web3_js_1.PublicKey('3BGheQVvYtBNpBKSUXSTjpyKQc3dh8iiwT91Aiq7KYCU'),
|
|
1066
1071
|
launchTs: 1736384970000,
|
|
1067
|
-
oracleSource: __1.OracleSource.
|
|
1072
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1068
1073
|
pythFeedId: '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
|
|
1074
|
+
pythLazerId: 171,
|
|
1069
1075
|
},
|
|
1070
1076
|
{
|
|
1071
1077
|
fullName: 'TRUMP',
|
|
@@ -1073,10 +1079,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1073
1079
|
symbol: 'TRUMP-PERP',
|
|
1074
1080
|
baseAssetSymbol: 'TRUMP',
|
|
1075
1081
|
marketIndex: 64,
|
|
1076
|
-
oracle: new web3_js_1.PublicKey('
|
|
1082
|
+
oracle: new web3_js_1.PublicKey('FPQjZYvHRGy51guJ77p7n9u9b8eo1ktKRc2D2g5Vysth'),
|
|
1077
1083
|
launchTs: 1737219250000,
|
|
1078
|
-
oracleSource: __1.OracleSource.
|
|
1084
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1079
1085
|
pythFeedId: '0x879551021853eec7a7dc827578e8e69da7e4fa8148339aa0d3d5296405be4b1a',
|
|
1086
|
+
pythLazerId: 203,
|
|
1080
1087
|
},
|
|
1081
1088
|
{
|
|
1082
1089
|
fullName: 'MELANIA',
|
|
@@ -1084,10 +1091,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1084
1091
|
symbol: 'MELANIA-PERP',
|
|
1085
1092
|
baseAssetSymbol: 'MELANIA',
|
|
1086
1093
|
marketIndex: 65,
|
|
1087
|
-
oracle: new web3_js_1.PublicKey('
|
|
1094
|
+
oracle: new web3_js_1.PublicKey('3RgNWYYcZCKf5uZfriK8ASUbGQErhH6YbpdvZQ7ZKDCf'),
|
|
1088
1095
|
launchTs: 1737360280000,
|
|
1089
|
-
oracleSource: __1.OracleSource.
|
|
1096
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1090
1097
|
pythFeedId: '0x8fef7d52c7f4e3a6258d663f9d27e64a1b6fd95ab5f7d545dbf9a515353d0064',
|
|
1098
|
+
pythLazerId: 145,
|
|
1091
1099
|
},
|
|
1092
1100
|
{
|
|
1093
1101
|
fullName: 'BERA',
|
|
@@ -163,8 +163,8 @@ exports.MainnetSpotMarkets = [
|
|
|
163
163
|
symbol: 'USDT',
|
|
164
164
|
marketIndex: 5,
|
|
165
165
|
poolId: 0,
|
|
166
|
-
oracle: new web3_js_1.PublicKey('
|
|
167
|
-
oracleSource: __1.OracleSource.
|
|
166
|
+
oracle: new web3_js_1.PublicKey('JDKJSkxjasBGL3ce1pkrN6tqDzuVUZPWzzkGuyX8m9yN'),
|
|
167
|
+
oracleSource: __1.OracleSource.PYTH_LAZER_STABLE_COIN,
|
|
168
168
|
mint: new web3_js_1.PublicKey('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'),
|
|
169
169
|
precision: numericConstants_1.QUOTE_PRECISION,
|
|
170
170
|
precisionExp: numericConstants_1.QUOTE_PRECISION_EXP,
|
|
@@ -244,8 +244,8 @@ exports.MainnetSpotMarkets = [
|
|
|
244
244
|
symbol: 'JUP',
|
|
245
245
|
marketIndex: 11,
|
|
246
246
|
poolId: 0,
|
|
247
|
-
oracle: new web3_js_1.PublicKey('
|
|
248
|
-
oracleSource: __1.OracleSource.
|
|
247
|
+
oracle: new web3_js_1.PublicKey('DXqKSHyhTBKEW4qgnL7ycbf3Jca5hCvUgWHFYWsh4KJa'),
|
|
248
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
249
249
|
mint: new web3_js_1.PublicKey('JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN'),
|
|
250
250
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
251
251
|
precisionExp: numericConstants_1.SIX,
|
|
@@ -361,14 +361,15 @@ exports.MainnetSpotMarkets = [
|
|
|
361
361
|
symbol: 'POPCAT',
|
|
362
362
|
marketIndex: 20,
|
|
363
363
|
poolId: 0,
|
|
364
|
-
oracle: new web3_js_1.PublicKey('
|
|
365
|
-
oracleSource: __1.OracleSource.
|
|
364
|
+
oracle: new web3_js_1.PublicKey('C5fiAmQyjdfDR4EGepZqnEL3fJwMBav5yoAk6XyKMF6u'),
|
|
365
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
366
366
|
mint: new web3_js_1.PublicKey('7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr'),
|
|
367
367
|
precision: new __1.BN(10).pow(numericConstants_1.NINE),
|
|
368
368
|
precisionExp: numericConstants_1.NINE,
|
|
369
369
|
launchTs: 1720013054000,
|
|
370
370
|
phoenixMarket: new web3_js_1.PublicKey('31XgvAQ1HgFQEk31KdszbPkVXKaQqB1bgYZPoDrFpSR2'),
|
|
371
371
|
pythFeedId: '0xb9312a7ee50e189ef045aa3c7842e099b061bd9bdc99ac645956c3b660dc8cce',
|
|
372
|
+
pythLazerId: 130,
|
|
372
373
|
},
|
|
373
374
|
{
|
|
374
375
|
symbol: 'CLOUD',
|
|
@@ -385,23 +386,25 @@ exports.MainnetSpotMarkets = [
|
|
|
385
386
|
symbol: 'PYUSD',
|
|
386
387
|
marketIndex: 22,
|
|
387
388
|
poolId: 0,
|
|
388
|
-
oracle: new web3_js_1.PublicKey('
|
|
389
|
-
oracleSource: __1.OracleSource.
|
|
389
|
+
oracle: new web3_js_1.PublicKey('5QZMnsyndmphvZF4BNgoMHwVZaREXeE2rpBoCPMxgCCd'),
|
|
390
|
+
oracleSource: __1.OracleSource.PYTH_LAZER_STABLE_COIN,
|
|
390
391
|
mint: new web3_js_1.PublicKey('2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo'),
|
|
391
392
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
392
393
|
precisionExp: numericConstants_1.SIX,
|
|
393
394
|
pythFeedId: '0xc1da1b73d7f01e7ddd54b3766cf7fcd644395ad14f70aa706ec5384c59e76692',
|
|
395
|
+
pythLazerId: 156,
|
|
394
396
|
},
|
|
395
397
|
{
|
|
396
398
|
symbol: 'USDe',
|
|
397
399
|
marketIndex: 23,
|
|
398
400
|
poolId: 0,
|
|
399
|
-
oracle: new web3_js_1.PublicKey('
|
|
400
|
-
oracleSource: __1.OracleSource.
|
|
401
|
+
oracle: new web3_js_1.PublicKey('5uR6oza6teuMRpjsbMi9fDhCDid2hoYdRBiLW7WzcK54'),
|
|
402
|
+
oracleSource: __1.OracleSource.PYTH_LAZER_STABLE_COIN,
|
|
401
403
|
mint: new web3_js_1.PublicKey('DEkqHyPN7GMRJ5cArtQFAWefqbZb33Hyf6s5iCwjEonT'),
|
|
402
404
|
precision: new __1.BN(10).pow(numericConstants_1.NINE),
|
|
403
405
|
precisionExp: numericConstants_1.NINE,
|
|
404
406
|
pythFeedId: '0x6ec879b1e9963de5ee97e9c8710b742d6228252a5e2ca12d4ae81d7fe5ee8c5d',
|
|
407
|
+
pythLazerId: 204,
|
|
405
408
|
},
|
|
406
409
|
{
|
|
407
410
|
symbol: 'sUSDe',
|
|
@@ -536,37 +539,40 @@ exports.MainnetSpotMarkets = [
|
|
|
536
539
|
symbol: 'AI16Z',
|
|
537
540
|
marketIndex: 35,
|
|
538
541
|
poolId: 0,
|
|
539
|
-
oracle: new web3_js_1.PublicKey('
|
|
540
|
-
oracleSource: __1.OracleSource.
|
|
542
|
+
oracle: new web3_js_1.PublicKey('3BGheQVvYtBNpBKSUXSTjpyKQc3dh8iiwT91Aiq7KYCU'),
|
|
543
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
541
544
|
mint: new web3_js_1.PublicKey('HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC'),
|
|
542
545
|
precision: new __1.BN(10).pow(numericConstants_1.NINE),
|
|
543
546
|
precisionExp: numericConstants_1.NINE,
|
|
544
547
|
pythFeedId: '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
|
|
545
548
|
launchTs: 1736384970000,
|
|
549
|
+
pythLazerId: 171,
|
|
546
550
|
},
|
|
547
551
|
{
|
|
548
552
|
symbol: 'TRUMP',
|
|
549
553
|
marketIndex: 36,
|
|
550
554
|
poolId: 0,
|
|
551
|
-
oracle: new web3_js_1.PublicKey('
|
|
552
|
-
oracleSource: __1.OracleSource.
|
|
555
|
+
oracle: new web3_js_1.PublicKey('FPQjZYvHRGy51guJ77p7n9u9b8eo1ktKRc2D2g5Vysth'),
|
|
556
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
553
557
|
mint: new web3_js_1.PublicKey('6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN'),
|
|
554
558
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
555
559
|
precisionExp: numericConstants_1.SIX,
|
|
556
560
|
pythFeedId: '0x879551021853eec7a7dc827578e8e69da7e4fa8148339aa0d3d5296405be4b1a',
|
|
557
561
|
launchTs: 1737219250000,
|
|
562
|
+
pythLazerId: 203,
|
|
558
563
|
},
|
|
559
564
|
{
|
|
560
565
|
symbol: 'MELANIA',
|
|
561
566
|
marketIndex: 37,
|
|
562
567
|
poolId: 0,
|
|
563
|
-
oracle: new web3_js_1.PublicKey('
|
|
564
|
-
oracleSource: __1.OracleSource.
|
|
568
|
+
oracle: new web3_js_1.PublicKey('3RgNWYYcZCKf5uZfriK8ASUbGQErhH6YbpdvZQ7ZKDCf'),
|
|
569
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
565
570
|
mint: new web3_js_1.PublicKey('FUAfBo2jgks6gB4Z4LfZkqSZgzNucisEHqnNebaRxM1P'),
|
|
566
571
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
567
572
|
precisionExp: numericConstants_1.SIX,
|
|
568
573
|
pythFeedId: '0x8fef7d52c7f4e3a6258d663f9d27e64a1b6fd95ab5f7d545dbf9a515353d0064',
|
|
569
574
|
launchTs: 1737360280000,
|
|
575
|
+
pythLazerId: 145,
|
|
570
576
|
},
|
|
571
577
|
{
|
|
572
578
|
symbol: 'AUSD',
|
|
@@ -343,6 +343,8 @@ export declare class DriftClient {
|
|
|
343
343
|
*/
|
|
344
344
|
transferDeposit(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
345
345
|
getTransferDepositIx(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
|
|
346
|
+
transferPools(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
347
|
+
getTransferPoolsIx(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
|
|
346
348
|
updateSpotMarketCumulativeInterest(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
347
349
|
updateSpotMarketCumulativeInterestIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
348
350
|
settleLP(settleeUserAccountPublicKey: PublicKey, marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
@@ -1716,6 +1716,62 @@ class DriftClient {
|
|
|
1716
1716
|
remainingAccounts,
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
1719
|
+
async transferPools(depositFromMarketIndex, depositToMarketIndex, borrowFromMarketIndex, borrowToMarketIndex, depositAmount, borrowAmount, fromSubAccountId, toSubAccountId, txParams) {
|
|
1720
|
+
const { txSig, slot } = await this.sendTransaction(await this.buildTransaction(await this.getTransferPoolsIx(depositFromMarketIndex, depositToMarketIndex, borrowFromMarketIndex, borrowToMarketIndex, depositAmount, borrowAmount, fromSubAccountId, toSubAccountId), txParams), [], this.opts);
|
|
1721
|
+
if (fromSubAccountId === this.activeSubAccountId ||
|
|
1722
|
+
toSubAccountId === this.activeSubAccountId) {
|
|
1723
|
+
this.spotMarketLastSlotCache.set(depositFromMarketIndex, slot);
|
|
1724
|
+
this.spotMarketLastSlotCache.set(depositToMarketIndex, slot);
|
|
1725
|
+
this.spotMarketLastSlotCache.set(borrowFromMarketIndex, slot);
|
|
1726
|
+
this.spotMarketLastSlotCache.set(borrowToMarketIndex, slot);
|
|
1727
|
+
}
|
|
1728
|
+
return txSig;
|
|
1729
|
+
}
|
|
1730
|
+
async getTransferPoolsIx(depositFromMarketIndex, depositToMarketIndex, borrowFromMarketIndex, borrowToMarketIndex, depositAmount, borrowAmount, fromSubAccountId, toSubAccountId) {
|
|
1731
|
+
const fromUser = await (0, pda_1.getUserAccountPublicKey)(this.program.programId, this.wallet.publicKey, fromSubAccountId);
|
|
1732
|
+
const toUser = await (0, pda_1.getUserAccountPublicKey)(this.program.programId, this.wallet.publicKey, toSubAccountId);
|
|
1733
|
+
const userAccounts = [
|
|
1734
|
+
this.getUserAccount(fromSubAccountId),
|
|
1735
|
+
this.getUserAccount(toSubAccountId),
|
|
1736
|
+
];
|
|
1737
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
1738
|
+
userAccounts,
|
|
1739
|
+
useMarketLastSlotCache: true,
|
|
1740
|
+
writableSpotMarketIndexes: [
|
|
1741
|
+
depositFromMarketIndex,
|
|
1742
|
+
depositToMarketIndex,
|
|
1743
|
+
borrowFromMarketIndex,
|
|
1744
|
+
borrowToMarketIndex,
|
|
1745
|
+
],
|
|
1746
|
+
});
|
|
1747
|
+
const tokenPrograms = new Set();
|
|
1748
|
+
const depositFromSpotMarket = this.getSpotMarketAccount(depositFromMarketIndex);
|
|
1749
|
+
const borrowFromSpotMarket = this.getSpotMarketAccount(borrowFromMarketIndex);
|
|
1750
|
+
tokenPrograms.add(this.getTokenProgramForSpotMarket(depositFromSpotMarket).toBase58());
|
|
1751
|
+
tokenPrograms.add(this.getTokenProgramForSpotMarket(borrowFromSpotMarket).toBase58());
|
|
1752
|
+
for (const tokenProgram of tokenPrograms) {
|
|
1753
|
+
remainingAccounts.push({
|
|
1754
|
+
isSigner: false,
|
|
1755
|
+
isWritable: false,
|
|
1756
|
+
pubkey: new web3_js_1.PublicKey(tokenProgram),
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
return await this.program.instruction.transferPools(depositFromMarketIndex, depositToMarketIndex, borrowFromMarketIndex, borrowToMarketIndex, depositAmount !== null && depositAmount !== void 0 ? depositAmount : null, borrowAmount !== null && borrowAmount !== void 0 ? borrowAmount : null, {
|
|
1760
|
+
accounts: {
|
|
1761
|
+
authority: this.wallet.publicKey,
|
|
1762
|
+
fromUser,
|
|
1763
|
+
toUser,
|
|
1764
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
1765
|
+
state: await this.getStatePublicKey(),
|
|
1766
|
+
depositFromSpotMarketVault: this.getSpotMarketAccount(depositFromMarketIndex).vault,
|
|
1767
|
+
depositToSpotMarketVault: this.getSpotMarketAccount(depositToMarketIndex).vault,
|
|
1768
|
+
borrowFromSpotMarketVault: this.getSpotMarketAccount(borrowFromMarketIndex).vault,
|
|
1769
|
+
borrowToSpotMarketVault: this.getSpotMarketAccount(borrowToMarketIndex).vault,
|
|
1770
|
+
driftSigner: this.getSignerPublicKey(),
|
|
1771
|
+
},
|
|
1772
|
+
remainingAccounts,
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1719
1775
|
async updateSpotMarketCumulativeInterest(marketIndex, txParams) {
|
|
1720
1776
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.updateSpotMarketCumulativeInterestIx(marketIndex), txParams), [], this.opts);
|
|
1721
1777
|
return txSig;
|
|
@@ -452,6 +452,91 @@
|
|
|
452
452
|
}
|
|
453
453
|
]
|
|
454
454
|
},
|
|
455
|
+
{
|
|
456
|
+
"name": "transferPools",
|
|
457
|
+
"accounts": [
|
|
458
|
+
{
|
|
459
|
+
"name": "fromUser",
|
|
460
|
+
"isMut": true,
|
|
461
|
+
"isSigner": false
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"name": "toUser",
|
|
465
|
+
"isMut": true,
|
|
466
|
+
"isSigner": false
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "userStats",
|
|
470
|
+
"isMut": true,
|
|
471
|
+
"isSigner": false
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"name": "authority",
|
|
475
|
+
"isMut": false,
|
|
476
|
+
"isSigner": true
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"name": "state",
|
|
480
|
+
"isMut": false,
|
|
481
|
+
"isSigner": false
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"name": "depositFromSpotMarketVault",
|
|
485
|
+
"isMut": true,
|
|
486
|
+
"isSigner": false
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"name": "depositToSpotMarketVault",
|
|
490
|
+
"isMut": true,
|
|
491
|
+
"isSigner": false
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"name": "borrowFromSpotMarketVault",
|
|
495
|
+
"isMut": true,
|
|
496
|
+
"isSigner": false
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"name": "borrowToSpotMarketVault",
|
|
500
|
+
"isMut": true,
|
|
501
|
+
"isSigner": false
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"name": "driftSigner",
|
|
505
|
+
"isMut": false,
|
|
506
|
+
"isSigner": false
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"args": [
|
|
510
|
+
{
|
|
511
|
+
"name": "depositFromMarketIndex",
|
|
512
|
+
"type": "u16"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"name": "depositToMarketIndex",
|
|
516
|
+
"type": "u16"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"name": "borrowFromMarketIndex",
|
|
520
|
+
"type": "u16"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"name": "borrowToMarketIndex",
|
|
524
|
+
"type": "u16"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"name": "depositAmount",
|
|
528
|
+
"type": {
|
|
529
|
+
"option": "u64"
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"name": "borrowAmount",
|
|
534
|
+
"type": {
|
|
535
|
+
"option": "u64"
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
},
|
|
455
540
|
{
|
|
456
541
|
"name": "placePerpOrder",
|
|
457
542
|
"accounts": [
|
|
@@ -434,9 +434,9 @@ exports.MainnetPerpMarkets = [
|
|
|
434
434
|
symbol: 'DOGE-PERP',
|
|
435
435
|
baseAssetSymbol: 'DOGE',
|
|
436
436
|
marketIndex: 7,
|
|
437
|
-
oracle: new web3_js_1.PublicKey('
|
|
437
|
+
oracle: new web3_js_1.PublicKey('GqjDJZu9bNCebq5PTUbjRrgw1LK84GEexVjrfYJ76YXc'),
|
|
438
438
|
launchTs: 1680808053000,
|
|
439
|
-
oracleSource: __1.OracleSource.
|
|
439
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
440
440
|
pythFeedId: '0xdcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c',
|
|
441
441
|
pythLazerId: 13,
|
|
442
442
|
},
|
|
@@ -518,10 +518,11 @@ exports.MainnetPerpMarkets = [
|
|
|
518
518
|
symbol: 'HNT-PERP',
|
|
519
519
|
baseAssetSymbol: 'HNT',
|
|
520
520
|
marketIndex: 14,
|
|
521
|
-
oracle: new web3_js_1.PublicKey('
|
|
521
|
+
oracle: new web3_js_1.PublicKey('AEPgc6qUTCT8AwdckPcGbJXtcM9bj8mGYAyHE4BscJtm'),
|
|
522
522
|
launchTs: 1692294955000,
|
|
523
|
-
oracleSource: __1.OracleSource.
|
|
523
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
524
524
|
pythFeedId: '0x649fdd7ec08e8e2a20f425729854e90293dcbe2376abc47197a14da6ff339756',
|
|
525
|
+
pythLazerId: 168,
|
|
525
526
|
},
|
|
526
527
|
{
|
|
527
528
|
fullName: 'INJ',
|
|
@@ -636,9 +637,9 @@ exports.MainnetPerpMarkets = [
|
|
|
636
637
|
symbol: 'JUP-PERP',
|
|
637
638
|
baseAssetSymbol: 'JUP',
|
|
638
639
|
marketIndex: 24,
|
|
639
|
-
oracle: new web3_js_1.PublicKey('
|
|
640
|
+
oracle: new web3_js_1.PublicKey('DXqKSHyhTBKEW4qgnL7ycbf3Jca5hCvUgWHFYWsh4KJa'),
|
|
640
641
|
launchTs: 1706713201000,
|
|
641
|
-
oracleSource: __1.OracleSource.
|
|
642
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
642
643
|
pythFeedId: '0x0a0408d619e9380abad35060f9192039ed5042fa6f82301d0e48bb52be830996',
|
|
643
644
|
pythLazerId: 92,
|
|
644
645
|
},
|
|
@@ -751,10 +752,11 @@ exports.MainnetPerpMarkets = [
|
|
|
751
752
|
symbol: 'POPCAT-PERP',
|
|
752
753
|
baseAssetSymbol: 'POPCAT',
|
|
753
754
|
marketIndex: 34,
|
|
754
|
-
oracle: new web3_js_1.PublicKey('
|
|
755
|
+
oracle: new web3_js_1.PublicKey('C5fiAmQyjdfDR4EGepZqnEL3fJwMBav5yoAk6XyKMF6u'),
|
|
755
756
|
launchTs: 1720013054000,
|
|
756
|
-
oracleSource: __1.OracleSource.
|
|
757
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
757
758
|
pythFeedId: '0xb9312a7ee50e189ef045aa3c7842e099b061bd9bdc99ac645956c3b660dc8cce',
|
|
759
|
+
pythLazerId: 130,
|
|
758
760
|
},
|
|
759
761
|
{
|
|
760
762
|
fullName: 'Wen',
|
|
@@ -928,10 +930,11 @@ exports.MainnetPerpMarkets = [
|
|
|
928
930
|
symbol: '1KMEW-PERP',
|
|
929
931
|
baseAssetSymbol: '1KMEW',
|
|
930
932
|
marketIndex: 51,
|
|
931
|
-
oracle: new web3_js_1.PublicKey('
|
|
933
|
+
oracle: new web3_js_1.PublicKey('138RQdT1frDTnEp989V7gUWoQ5yg382ns4ihjvgJLcz7'),
|
|
932
934
|
launchTs: 1729702915000,
|
|
933
|
-
oracleSource: __1.OracleSource.
|
|
935
|
+
oracleSource: __1.OracleSource.PYTH_LAZER_1K,
|
|
934
936
|
pythFeedId: '0x514aed52ca5294177f20187ae883cec4a018619772ddce41efcc36a6448f5d5d',
|
|
937
|
+
pythLazerId: 137,
|
|
935
938
|
},
|
|
936
939
|
{
|
|
937
940
|
fullName: 'MICHI',
|
|
@@ -1016,10 +1019,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1016
1019
|
symbol: 'HYPE-PERP',
|
|
1017
1020
|
baseAssetSymbol: 'HYPE',
|
|
1018
1021
|
marketIndex: 59,
|
|
1019
|
-
oracle: new web3_js_1.PublicKey('
|
|
1022
|
+
oracle: new web3_js_1.PublicKey('3ivZ5AnnUhocgmjiWjT8kDV87S6PpEL3CEHcd3vn2itM'),
|
|
1020
1023
|
launchTs: 1733374800000,
|
|
1021
|
-
oracleSource: __1.OracleSource.
|
|
1024
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1022
1025
|
pythFeedId: '0x4279e31cc369bbcc2faf022b382b080e32a8e689ff20fbc530d2a603eb6cd98b',
|
|
1026
|
+
pythLazerId: 110,
|
|
1023
1027
|
},
|
|
1024
1028
|
{
|
|
1025
1029
|
fullName: 'LiteCoin',
|
|
@@ -1027,10 +1031,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1027
1031
|
symbol: 'LTC-PERP',
|
|
1028
1032
|
baseAssetSymbol: 'LTC',
|
|
1029
1033
|
marketIndex: 60,
|
|
1030
|
-
oracle: new web3_js_1.PublicKey('
|
|
1034
|
+
oracle: new web3_js_1.PublicKey('CrW8rga5bEZP1KBnqoQmPUcnYjrCPYQFbrMja99QKxsK'),
|
|
1031
1035
|
launchTs: 1733374800000,
|
|
1032
|
-
oracleSource: __1.OracleSource.
|
|
1036
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1033
1037
|
pythFeedId: '0x6e3f3fa8253588df9326580180233eb791e03b443a3ba7a1d892e73874e19a54',
|
|
1038
|
+
pythLazerId: 26,
|
|
1034
1039
|
},
|
|
1035
1040
|
{
|
|
1036
1041
|
fullName: 'Magic Eden',
|
|
@@ -1062,10 +1067,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1062
1067
|
symbol: 'AI16Z-PERP',
|
|
1063
1068
|
baseAssetSymbol: 'AI16Z',
|
|
1064
1069
|
marketIndex: 63,
|
|
1065
|
-
oracle: new web3_js_1.PublicKey('
|
|
1070
|
+
oracle: new web3_js_1.PublicKey('3BGheQVvYtBNpBKSUXSTjpyKQc3dh8iiwT91Aiq7KYCU'),
|
|
1066
1071
|
launchTs: 1736384970000,
|
|
1067
|
-
oracleSource: __1.OracleSource.
|
|
1072
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1068
1073
|
pythFeedId: '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
|
|
1074
|
+
pythLazerId: 171,
|
|
1069
1075
|
},
|
|
1070
1076
|
{
|
|
1071
1077
|
fullName: 'TRUMP',
|
|
@@ -1073,10 +1079,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1073
1079
|
symbol: 'TRUMP-PERP',
|
|
1074
1080
|
baseAssetSymbol: 'TRUMP',
|
|
1075
1081
|
marketIndex: 64,
|
|
1076
|
-
oracle: new web3_js_1.PublicKey('
|
|
1082
|
+
oracle: new web3_js_1.PublicKey('FPQjZYvHRGy51guJ77p7n9u9b8eo1ktKRc2D2g5Vysth'),
|
|
1077
1083
|
launchTs: 1737219250000,
|
|
1078
|
-
oracleSource: __1.OracleSource.
|
|
1084
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1079
1085
|
pythFeedId: '0x879551021853eec7a7dc827578e8e69da7e4fa8148339aa0d3d5296405be4b1a',
|
|
1086
|
+
pythLazerId: 203,
|
|
1080
1087
|
},
|
|
1081
1088
|
{
|
|
1082
1089
|
fullName: 'MELANIA',
|
|
@@ -1084,10 +1091,11 @@ exports.MainnetPerpMarkets = [
|
|
|
1084
1091
|
symbol: 'MELANIA-PERP',
|
|
1085
1092
|
baseAssetSymbol: 'MELANIA',
|
|
1086
1093
|
marketIndex: 65,
|
|
1087
|
-
oracle: new web3_js_1.PublicKey('
|
|
1094
|
+
oracle: new web3_js_1.PublicKey('3RgNWYYcZCKf5uZfriK8ASUbGQErhH6YbpdvZQ7ZKDCf'),
|
|
1088
1095
|
launchTs: 1737360280000,
|
|
1089
|
-
oracleSource: __1.OracleSource.
|
|
1096
|
+
oracleSource: __1.OracleSource.PYTH_LAZER,
|
|
1090
1097
|
pythFeedId: '0x8fef7d52c7f4e3a6258d663f9d27e64a1b6fd95ab5f7d545dbf9a515353d0064',
|
|
1098
|
+
pythLazerId: 145,
|
|
1091
1099
|
},
|
|
1092
1100
|
{
|
|
1093
1101
|
fullName: 'BERA',
|