@drift-labs/sdk 0.2.0-master.37 → 0.2.0-master.38
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/lib/admin.d.ts +3 -0
- package/lib/admin.js +27 -0
- package/lib/clearingHouse.d.ts +1 -0
- package/lib/clearingHouse.js +20 -9
- package/lib/clearingHouseUser.js +1 -1
- package/lib/idl/clearing_house.json +90 -0
- package/package.json +1 -1
- package/src/admin.ts +60 -0
- package/src/clearingHouse.ts +40 -21
- package/src/clearingHouseUser.ts +1 -1
- package/src/idl/clearing_house.json +90 -0
package/lib/admin.d.ts
CHANGED
|
@@ -36,12 +36,15 @@ export declare class Admin extends ClearingHouse {
|
|
|
36
36
|
updatePerpMarketOracle(perpMarketIndex: number, oracle: PublicKey, oracleSource: OracleSource): Promise<TransactionSignature>;
|
|
37
37
|
updatePerpMarketStepSizeAndTickSize(perpMarketIndex: number, stepSize: BN, tickSize: BN): Promise<TransactionSignature>;
|
|
38
38
|
updatePerpMarketMinOrderSize(perpMarketIndex: number, orderSize: BN): Promise<TransactionSignature>;
|
|
39
|
+
updateSpotMarketStepSizeAndTickSize(spotMarketIndex: number, stepSize: BN, tickSize: BN): Promise<TransactionSignature>;
|
|
40
|
+
updateSpotMarketMinOrderSize(spotMarketIndex: number, orderSize: BN): Promise<TransactionSignature>;
|
|
39
41
|
updatePerpMarketExpiry(perpMarketIndex: number, expiryTs: BN): Promise<TransactionSignature>;
|
|
40
42
|
updateSpotMarketOracle(spotMarketIndex: number, oracle: PublicKey, oracleSource: OracleSource): Promise<TransactionSignature>;
|
|
41
43
|
updateSpotMarketExpiry(spotMarketIndex: number, expiryTs: BN): Promise<TransactionSignature>;
|
|
42
44
|
updateWhitelistMint(whitelistMint?: PublicKey): Promise<TransactionSignature>;
|
|
43
45
|
updateDiscountMint(discountMint: PublicKey): Promise<TransactionSignature>;
|
|
44
46
|
updateSpotMarketMarginWeights(spotMarketIndex: number, initialAssetWeight: number, maintenanceAssetWeight: number, initialLiabilityWeight: number, maintenanceLiabilityWeight: number, imfFactor?: number): Promise<TransactionSignature>;
|
|
47
|
+
updateSpotMarketBorrowRate(spotMarketIndex: number, optimalUtilization: number, optimalBorrowRate: number, optimalMaxRate: number): Promise<TransactionSignature>;
|
|
45
48
|
updateSpotMarketAssetTier(spotMarketIndex: number, assetTier: AssetTier): Promise<TransactionSignature>;
|
|
46
49
|
updateSpotMarketStatus(spotMarketIndex: number, marketStatus: MarketStatus): Promise<TransactionSignature>;
|
|
47
50
|
updatePerpMarketStatus(perpMarketIndex: number, marketStatus: MarketStatus): Promise<TransactionSignature>;
|
package/lib/admin.js
CHANGED
|
@@ -401,6 +401,24 @@ class Admin extends clearingHouse_1.ClearingHouse {
|
|
|
401
401
|
},
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
+
async updateSpotMarketStepSizeAndTickSize(spotMarketIndex, stepSize, tickSize) {
|
|
405
|
+
return await this.program.rpc.updateSpotMarketStepSizeAndTickSize(stepSize, tickSize, {
|
|
406
|
+
accounts: {
|
|
407
|
+
admin: this.wallet.publicKey,
|
|
408
|
+
state: await this.getStatePublicKey(),
|
|
409
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
async updateSpotMarketMinOrderSize(spotMarketIndex, orderSize) {
|
|
414
|
+
return await this.program.rpc.updateSpotMarketMinOrderSize(orderSize, {
|
|
415
|
+
accounts: {
|
|
416
|
+
admin: this.wallet.publicKey,
|
|
417
|
+
state: await this.getStatePublicKey(),
|
|
418
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
}
|
|
404
422
|
async updatePerpMarketExpiry(perpMarketIndex, expiryTs) {
|
|
405
423
|
return await this.program.rpc.updatePerpMarketExpiry(expiryTs, {
|
|
406
424
|
accounts: {
|
|
@@ -454,6 +472,15 @@ class Admin extends clearingHouse_1.ClearingHouse {
|
|
|
454
472
|
},
|
|
455
473
|
});
|
|
456
474
|
}
|
|
475
|
+
async updateSpotMarketBorrowRate(spotMarketIndex, optimalUtilization, optimalBorrowRate, optimalMaxRate) {
|
|
476
|
+
return await this.program.rpc.updateSpotMarketBorrowRate(optimalUtilization, optimalBorrowRate, optimalMaxRate, {
|
|
477
|
+
accounts: {
|
|
478
|
+
admin: this.wallet.publicKey,
|
|
479
|
+
state: await this.getStatePublicKey(),
|
|
480
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
}
|
|
457
484
|
async updateSpotMarketAssetTier(spotMarketIndex, assetTier) {
|
|
458
485
|
return await this.program.rpc.updateSpotMarketAssetTier(assetTier, {
|
|
459
486
|
accounts: {
|
package/lib/clearingHouse.d.ts
CHANGED
|
@@ -168,6 +168,7 @@ export declare class ClearingHouse {
|
|
|
168
168
|
getPlaceSpotOrderIx(orderParams: OptionalOrderParams): Promise<TransactionInstruction>;
|
|
169
169
|
fillSpotOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Order, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionSignature>;
|
|
170
170
|
getFillSpotOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order?: Order, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionInstruction>;
|
|
171
|
+
addSpotFulfillmentAccounts(marketIndex: number, remainingAccounts: AccountMeta[], fulfillmentConfig?: SerumV3FulfillmentConfigAccount): void;
|
|
171
172
|
addSerumRemainingAccounts(marketIndex: number, remainingAccounts: AccountMeta[], fulfillmentConfig: SerumV3FulfillmentConfigAccount): void;
|
|
172
173
|
triggerOrder(userAccountPublicKey: PublicKey, user: UserAccount, order: Order): Promise<TransactionSignature>;
|
|
173
174
|
getTriggerOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Order): Promise<TransactionInstruction>;
|
package/lib/clearingHouse.js
CHANGED
|
@@ -1271,9 +1271,7 @@ class ClearingHouse {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
const orderId = order.orderId;
|
|
1273
1273
|
const makerOrderId = makerInfo ? makerInfo.order.orderId : null;
|
|
1274
|
-
|
|
1275
|
-
this.addSerumRemainingAccounts(marketIndex, remainingAccounts, fulfillmentConfig);
|
|
1276
|
-
}
|
|
1274
|
+
this.addSpotFulfillmentAccounts(marketIndex, remainingAccounts, fulfillmentConfig);
|
|
1277
1275
|
return await this.program.instruction.fillSpotOrder(orderId, fulfillmentConfig ? fulfillmentConfig.fulfillmentType : null, makerOrderId, {
|
|
1278
1276
|
accounts: {
|
|
1279
1277
|
state: await this.getStatePublicKey(),
|
|
@@ -1286,6 +1284,23 @@ class ClearingHouse {
|
|
|
1286
1284
|
remainingAccounts,
|
|
1287
1285
|
});
|
|
1288
1286
|
}
|
|
1287
|
+
addSpotFulfillmentAccounts(marketIndex, remainingAccounts, fulfillmentConfig) {
|
|
1288
|
+
if (fulfillmentConfig) {
|
|
1289
|
+
this.addSerumRemainingAccounts(marketIndex, remainingAccounts, fulfillmentConfig);
|
|
1290
|
+
}
|
|
1291
|
+
else {
|
|
1292
|
+
remainingAccounts.push({
|
|
1293
|
+
pubkey: this.getSpotMarketAccount(marketIndex).vault,
|
|
1294
|
+
isWritable: false,
|
|
1295
|
+
isSigner: false,
|
|
1296
|
+
});
|
|
1297
|
+
remainingAccounts.push({
|
|
1298
|
+
pubkey: this.getQuoteSpotMarketAccount().vault,
|
|
1299
|
+
isWritable: false,
|
|
1300
|
+
isSigner: false,
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1289
1304
|
addSerumRemainingAccounts(marketIndex, remainingAccounts, fulfillmentConfig) {
|
|
1290
1305
|
remainingAccounts.push({
|
|
1291
1306
|
pubkey: fulfillmentConfig.pubkey,
|
|
@@ -1540,9 +1555,7 @@ class ClearingHouse {
|
|
|
1540
1555
|
isSigner: false,
|
|
1541
1556
|
});
|
|
1542
1557
|
}
|
|
1543
|
-
|
|
1544
|
-
this.addSerumRemainingAccounts(orderParams.marketIndex, remainingAccounts, fulfillmentConfig);
|
|
1545
|
-
}
|
|
1558
|
+
this.addSpotFulfillmentAccounts(orderParams.marketIndex, remainingAccounts, fulfillmentConfig);
|
|
1546
1559
|
return await this.program.instruction.placeAndTakeSpotOrder(orderParams, fulfillmentConfig ? fulfillmentConfig.fulfillmentType : null, makerOrderId, {
|
|
1547
1560
|
accounts: {
|
|
1548
1561
|
state: await this.getStatePublicKey(),
|
|
@@ -1583,9 +1596,7 @@ class ClearingHouse {
|
|
|
1583
1596
|
isSigner: false,
|
|
1584
1597
|
});
|
|
1585
1598
|
}
|
|
1586
|
-
|
|
1587
|
-
this.addSerumRemainingAccounts(orderParams.marketIndex, remainingAccounts, fulfillmentConfig);
|
|
1588
|
-
}
|
|
1599
|
+
this.addSpotFulfillmentAccounts(orderParams.marketIndex, remainingAccounts, fulfillmentConfig);
|
|
1589
1600
|
const takerOrderId = takerInfo.order.orderId;
|
|
1590
1601
|
return await this.program.instruction.placeAndMakeSpotOrder(orderParams, takerOrderId, fulfillmentConfig ? fulfillmentConfig.fulfillmentType : null, {
|
|
1591
1602
|
accounts: {
|
package/lib/clearingHouseUser.js
CHANGED
|
@@ -125,7 +125,7 @@ class ClearingHouseUser {
|
|
|
125
125
|
*/
|
|
126
126
|
getLPBidAsks(marketIndex) {
|
|
127
127
|
const position = this.getUserPosition(marketIndex);
|
|
128
|
-
if (position.lpShares.eq(numericConstants_1.ZERO)) {
|
|
128
|
+
if (position === undefined || position.lpShares.eq(numericConstants_1.ZERO)) {
|
|
129
129
|
return [numericConstants_1.ZERO, numericConstants_1.ZERO];
|
|
130
130
|
}
|
|
131
131
|
const market = this.clearingHouse.getPerpMarketAccount(marketIndex);
|
|
@@ -2708,6 +2708,40 @@
|
|
|
2708
2708
|
}
|
|
2709
2709
|
]
|
|
2710
2710
|
},
|
|
2711
|
+
{
|
|
2712
|
+
"name": "updateSpotMarketBorrowRate",
|
|
2713
|
+
"accounts": [
|
|
2714
|
+
{
|
|
2715
|
+
"name": "admin",
|
|
2716
|
+
"isMut": false,
|
|
2717
|
+
"isSigner": true
|
|
2718
|
+
},
|
|
2719
|
+
{
|
|
2720
|
+
"name": "state",
|
|
2721
|
+
"isMut": false,
|
|
2722
|
+
"isSigner": false
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
"name": "spotMarket",
|
|
2726
|
+
"isMut": true,
|
|
2727
|
+
"isSigner": false
|
|
2728
|
+
}
|
|
2729
|
+
],
|
|
2730
|
+
"args": [
|
|
2731
|
+
{
|
|
2732
|
+
"name": "optimalUtilization",
|
|
2733
|
+
"type": "u32"
|
|
2734
|
+
},
|
|
2735
|
+
{
|
|
2736
|
+
"name": "optimalBorrowRate",
|
|
2737
|
+
"type": "u32"
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
"name": "maxBorrowRate",
|
|
2741
|
+
"type": "u32"
|
|
2742
|
+
}
|
|
2743
|
+
]
|
|
2744
|
+
},
|
|
2711
2745
|
{
|
|
2712
2746
|
"name": "updateSpotMarketMaxTokenDeposits",
|
|
2713
2747
|
"accounts": [
|
|
@@ -2771,6 +2805,62 @@
|
|
|
2771
2805
|
}
|
|
2772
2806
|
]
|
|
2773
2807
|
},
|
|
2808
|
+
{
|
|
2809
|
+
"name": "updateSpotMarketStepSizeAndTickSize",
|
|
2810
|
+
"accounts": [
|
|
2811
|
+
{
|
|
2812
|
+
"name": "admin",
|
|
2813
|
+
"isMut": false,
|
|
2814
|
+
"isSigner": true
|
|
2815
|
+
},
|
|
2816
|
+
{
|
|
2817
|
+
"name": "state",
|
|
2818
|
+
"isMut": false,
|
|
2819
|
+
"isSigner": false
|
|
2820
|
+
},
|
|
2821
|
+
{
|
|
2822
|
+
"name": "spotMarket",
|
|
2823
|
+
"isMut": true,
|
|
2824
|
+
"isSigner": false
|
|
2825
|
+
}
|
|
2826
|
+
],
|
|
2827
|
+
"args": [
|
|
2828
|
+
{
|
|
2829
|
+
"name": "stepSize",
|
|
2830
|
+
"type": "u64"
|
|
2831
|
+
},
|
|
2832
|
+
{
|
|
2833
|
+
"name": "tickSize",
|
|
2834
|
+
"type": "u64"
|
|
2835
|
+
}
|
|
2836
|
+
]
|
|
2837
|
+
},
|
|
2838
|
+
{
|
|
2839
|
+
"name": "updateSpotMarketMinOrderSize",
|
|
2840
|
+
"accounts": [
|
|
2841
|
+
{
|
|
2842
|
+
"name": "admin",
|
|
2843
|
+
"isMut": false,
|
|
2844
|
+
"isSigner": true
|
|
2845
|
+
},
|
|
2846
|
+
{
|
|
2847
|
+
"name": "state",
|
|
2848
|
+
"isMut": false,
|
|
2849
|
+
"isSigner": false
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
"name": "spotMarket",
|
|
2853
|
+
"isMut": true,
|
|
2854
|
+
"isSigner": false
|
|
2855
|
+
}
|
|
2856
|
+
],
|
|
2857
|
+
"args": [
|
|
2858
|
+
{
|
|
2859
|
+
"name": "orderSize",
|
|
2860
|
+
"type": "u64"
|
|
2861
|
+
}
|
|
2862
|
+
]
|
|
2863
|
+
},
|
|
2774
2864
|
{
|
|
2775
2865
|
"name": "updatePerpMarketStatus",
|
|
2776
2866
|
"accounts": [
|
package/package.json
CHANGED
package/src/admin.ts
CHANGED
|
@@ -753,6 +753,43 @@ export class Admin extends ClearingHouse {
|
|
|
753
753
|
});
|
|
754
754
|
}
|
|
755
755
|
|
|
756
|
+
public async updateSpotMarketStepSizeAndTickSize(
|
|
757
|
+
spotMarketIndex: number,
|
|
758
|
+
stepSize: BN,
|
|
759
|
+
tickSize: BN
|
|
760
|
+
): Promise<TransactionSignature> {
|
|
761
|
+
return await this.program.rpc.updateSpotMarketStepSizeAndTickSize(
|
|
762
|
+
stepSize,
|
|
763
|
+
tickSize,
|
|
764
|
+
{
|
|
765
|
+
accounts: {
|
|
766
|
+
admin: this.wallet.publicKey,
|
|
767
|
+
state: await this.getStatePublicKey(),
|
|
768
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
769
|
+
this.program.programId,
|
|
770
|
+
spotMarketIndex
|
|
771
|
+
),
|
|
772
|
+
},
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
public async updateSpotMarketMinOrderSize(
|
|
778
|
+
spotMarketIndex: number,
|
|
779
|
+
orderSize: BN
|
|
780
|
+
): Promise<TransactionSignature> {
|
|
781
|
+
return await this.program.rpc.updateSpotMarketMinOrderSize(orderSize, {
|
|
782
|
+
accounts: {
|
|
783
|
+
admin: this.wallet.publicKey,
|
|
784
|
+
state: await this.getStatePublicKey(),
|
|
785
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
786
|
+
this.program.programId,
|
|
787
|
+
spotMarketIndex
|
|
788
|
+
),
|
|
789
|
+
},
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
|
|
756
793
|
public async updatePerpMarketExpiry(
|
|
757
794
|
perpMarketIndex: number,
|
|
758
795
|
expiryTs: BN
|
|
@@ -852,6 +889,29 @@ export class Admin extends ClearingHouse {
|
|
|
852
889
|
);
|
|
853
890
|
}
|
|
854
891
|
|
|
892
|
+
public async updateSpotMarketBorrowRate(
|
|
893
|
+
spotMarketIndex: number,
|
|
894
|
+
optimalUtilization: number,
|
|
895
|
+
optimalBorrowRate: number,
|
|
896
|
+
optimalMaxRate: number
|
|
897
|
+
): Promise<TransactionSignature> {
|
|
898
|
+
return await this.program.rpc.updateSpotMarketBorrowRate(
|
|
899
|
+
optimalUtilization,
|
|
900
|
+
optimalBorrowRate,
|
|
901
|
+
optimalMaxRate,
|
|
902
|
+
{
|
|
903
|
+
accounts: {
|
|
904
|
+
admin: this.wallet.publicKey,
|
|
905
|
+
state: await this.getStatePublicKey(),
|
|
906
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
907
|
+
this.program.programId,
|
|
908
|
+
spotMarketIndex
|
|
909
|
+
),
|
|
910
|
+
},
|
|
911
|
+
}
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
|
|
855
915
|
public async updateSpotMarketAssetTier(
|
|
856
916
|
spotMarketIndex: number,
|
|
857
917
|
assetTier: AssetTier
|
package/src/clearingHouse.ts
CHANGED
|
@@ -2166,13 +2166,11 @@ export class ClearingHouse {
|
|
|
2166
2166
|
const orderId = order.orderId;
|
|
2167
2167
|
const makerOrderId = makerInfo ? makerInfo.order.orderId : null;
|
|
2168
2168
|
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
);
|
|
2175
|
-
}
|
|
2169
|
+
this.addSpotFulfillmentAccounts(
|
|
2170
|
+
marketIndex,
|
|
2171
|
+
remainingAccounts,
|
|
2172
|
+
fulfillmentConfig
|
|
2173
|
+
);
|
|
2176
2174
|
|
|
2177
2175
|
return await this.program.instruction.fillSpotOrder(
|
|
2178
2176
|
orderId,
|
|
@@ -2192,6 +2190,31 @@ export class ClearingHouse {
|
|
|
2192
2190
|
);
|
|
2193
2191
|
}
|
|
2194
2192
|
|
|
2193
|
+
addSpotFulfillmentAccounts(
|
|
2194
|
+
marketIndex: number,
|
|
2195
|
+
remainingAccounts: AccountMeta[],
|
|
2196
|
+
fulfillmentConfig?: SerumV3FulfillmentConfigAccount
|
|
2197
|
+
) {
|
|
2198
|
+
if (fulfillmentConfig) {
|
|
2199
|
+
this.addSerumRemainingAccounts(
|
|
2200
|
+
marketIndex,
|
|
2201
|
+
remainingAccounts,
|
|
2202
|
+
fulfillmentConfig
|
|
2203
|
+
);
|
|
2204
|
+
} else {
|
|
2205
|
+
remainingAccounts.push({
|
|
2206
|
+
pubkey: this.getSpotMarketAccount(marketIndex).vault,
|
|
2207
|
+
isWritable: false,
|
|
2208
|
+
isSigner: false,
|
|
2209
|
+
});
|
|
2210
|
+
remainingAccounts.push({
|
|
2211
|
+
pubkey: this.getQuoteSpotMarketAccount().vault,
|
|
2212
|
+
isWritable: false,
|
|
2213
|
+
isSigner: false,
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2195
2218
|
addSerumRemainingAccounts(
|
|
2196
2219
|
marketIndex: number,
|
|
2197
2220
|
remainingAccounts: AccountMeta[],
|
|
@@ -2556,13 +2579,11 @@ export class ClearingHouse {
|
|
|
2556
2579
|
});
|
|
2557
2580
|
}
|
|
2558
2581
|
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
);
|
|
2565
|
-
}
|
|
2582
|
+
this.addSpotFulfillmentAccounts(
|
|
2583
|
+
orderParams.marketIndex,
|
|
2584
|
+
remainingAccounts,
|
|
2585
|
+
fulfillmentConfig
|
|
2586
|
+
);
|
|
2566
2587
|
|
|
2567
2588
|
return await this.program.instruction.placeAndTakeSpotOrder(
|
|
2568
2589
|
orderParams,
|
|
@@ -2635,13 +2656,11 @@ export class ClearingHouse {
|
|
|
2635
2656
|
});
|
|
2636
2657
|
}
|
|
2637
2658
|
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
);
|
|
2644
|
-
}
|
|
2659
|
+
this.addSpotFulfillmentAccounts(
|
|
2660
|
+
orderParams.marketIndex,
|
|
2661
|
+
remainingAccounts,
|
|
2662
|
+
fulfillmentConfig
|
|
2663
|
+
);
|
|
2645
2664
|
|
|
2646
2665
|
const takerOrderId = takerInfo.order.orderId;
|
|
2647
2666
|
return await this.program.instruction.placeAndMakeSpotOrder(
|
package/src/clearingHouseUser.ts
CHANGED
|
@@ -214,7 +214,7 @@ export class ClearingHouseUser {
|
|
|
214
214
|
*/
|
|
215
215
|
public getLPBidAsks(marketIndex: number): [BN, BN] {
|
|
216
216
|
const position = this.getUserPosition(marketIndex);
|
|
217
|
-
if (position.lpShares.eq(ZERO)) {
|
|
217
|
+
if (position === undefined || position.lpShares.eq(ZERO)) {
|
|
218
218
|
return [ZERO, ZERO];
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -2708,6 +2708,40 @@
|
|
|
2708
2708
|
}
|
|
2709
2709
|
]
|
|
2710
2710
|
},
|
|
2711
|
+
{
|
|
2712
|
+
"name": "updateSpotMarketBorrowRate",
|
|
2713
|
+
"accounts": [
|
|
2714
|
+
{
|
|
2715
|
+
"name": "admin",
|
|
2716
|
+
"isMut": false,
|
|
2717
|
+
"isSigner": true
|
|
2718
|
+
},
|
|
2719
|
+
{
|
|
2720
|
+
"name": "state",
|
|
2721
|
+
"isMut": false,
|
|
2722
|
+
"isSigner": false
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
"name": "spotMarket",
|
|
2726
|
+
"isMut": true,
|
|
2727
|
+
"isSigner": false
|
|
2728
|
+
}
|
|
2729
|
+
],
|
|
2730
|
+
"args": [
|
|
2731
|
+
{
|
|
2732
|
+
"name": "optimalUtilization",
|
|
2733
|
+
"type": "u32"
|
|
2734
|
+
},
|
|
2735
|
+
{
|
|
2736
|
+
"name": "optimalBorrowRate",
|
|
2737
|
+
"type": "u32"
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
"name": "maxBorrowRate",
|
|
2741
|
+
"type": "u32"
|
|
2742
|
+
}
|
|
2743
|
+
]
|
|
2744
|
+
},
|
|
2711
2745
|
{
|
|
2712
2746
|
"name": "updateSpotMarketMaxTokenDeposits",
|
|
2713
2747
|
"accounts": [
|
|
@@ -2771,6 +2805,62 @@
|
|
|
2771
2805
|
}
|
|
2772
2806
|
]
|
|
2773
2807
|
},
|
|
2808
|
+
{
|
|
2809
|
+
"name": "updateSpotMarketStepSizeAndTickSize",
|
|
2810
|
+
"accounts": [
|
|
2811
|
+
{
|
|
2812
|
+
"name": "admin",
|
|
2813
|
+
"isMut": false,
|
|
2814
|
+
"isSigner": true
|
|
2815
|
+
},
|
|
2816
|
+
{
|
|
2817
|
+
"name": "state",
|
|
2818
|
+
"isMut": false,
|
|
2819
|
+
"isSigner": false
|
|
2820
|
+
},
|
|
2821
|
+
{
|
|
2822
|
+
"name": "spotMarket",
|
|
2823
|
+
"isMut": true,
|
|
2824
|
+
"isSigner": false
|
|
2825
|
+
}
|
|
2826
|
+
],
|
|
2827
|
+
"args": [
|
|
2828
|
+
{
|
|
2829
|
+
"name": "stepSize",
|
|
2830
|
+
"type": "u64"
|
|
2831
|
+
},
|
|
2832
|
+
{
|
|
2833
|
+
"name": "tickSize",
|
|
2834
|
+
"type": "u64"
|
|
2835
|
+
}
|
|
2836
|
+
]
|
|
2837
|
+
},
|
|
2838
|
+
{
|
|
2839
|
+
"name": "updateSpotMarketMinOrderSize",
|
|
2840
|
+
"accounts": [
|
|
2841
|
+
{
|
|
2842
|
+
"name": "admin",
|
|
2843
|
+
"isMut": false,
|
|
2844
|
+
"isSigner": true
|
|
2845
|
+
},
|
|
2846
|
+
{
|
|
2847
|
+
"name": "state",
|
|
2848
|
+
"isMut": false,
|
|
2849
|
+
"isSigner": false
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
"name": "spotMarket",
|
|
2853
|
+
"isMut": true,
|
|
2854
|
+
"isSigner": false
|
|
2855
|
+
}
|
|
2856
|
+
],
|
|
2857
|
+
"args": [
|
|
2858
|
+
{
|
|
2859
|
+
"name": "orderSize",
|
|
2860
|
+
"type": "u64"
|
|
2861
|
+
}
|
|
2862
|
+
]
|
|
2863
|
+
},
|
|
2774
2864
|
{
|
|
2775
2865
|
"name": "updatePerpMarketStatus",
|
|
2776
2866
|
"accounts": [
|