@drift-labs/sdk 0.1.18-orders.0 → 0.1.18-orders.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/lib/accounts/bulkAccountLoader.d.ts +31 -0
- package/lib/accounts/bulkAccountLoader.js +175 -0
- package/lib/accounts/bulkUserSubscription.d.ts +7 -0
- package/lib/accounts/bulkUserSubscription.js +28 -0
- package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +49 -0
- package/lib/accounts/pollingClearingHouseAccountSubscriber.js +228 -0
- package/lib/accounts/pollingTokenAccountSubscriber.d.ts +25 -0
- package/lib/accounts/pollingTokenAccountSubscriber.js +79 -0
- package/lib/accounts/pollingUserAccountSubscriber.d.ts +32 -0
- package/lib/accounts/pollingUserAccountSubscriber.js +133 -0
- package/lib/accounts/types.d.ts +34 -25
- package/lib/accounts/utils.d.ts +1 -0
- package/lib/accounts/utils.js +7 -0
- package/lib/accounts/webSocketAccountSubscriber.d.ts +6 -2
- package/lib/accounts/webSocketAccountSubscriber.js +43 -12
- package/lib/accounts/{defaultClearingHouseAccountSubscriber.d.ts → webSocketClearingHouseAccountSubscriber.d.ts} +6 -4
- package/lib/accounts/{defaultClearingHouseAccountSubscriber.js → webSocketClearingHouseAccountSubscriber.js} +5 -4
- package/lib/accounts/{defaultUserAccountSubscriber.d.ts → webSocketUserAccountSubscriber.d.ts} +3 -1
- package/lib/accounts/{defaultUserAccountSubscriber.js → webSocketUserAccountSubscriber.js} +10 -7
- package/lib/addresses.d.ts +2 -2
- package/lib/addresses.js +4 -4
- package/lib/admin.d.ts +3 -0
- package/lib/admin.js +61 -13
- package/lib/clearingHouse.d.ts +20 -4
- package/lib/clearingHouse.js +90 -10
- package/lib/clearingHouseUser.d.ts +12 -4
- package/lib/clearingHouseUser.js +35 -25
- package/lib/config.js +1 -1
- package/lib/constants/markets.d.ts +2 -1
- package/lib/constants/markets.js +35 -14
- package/lib/constants/numericConstants.d.ts +3 -1
- package/lib/constants/numericConstants.js +15 -17
- package/lib/examples/makeTradeExample.js +1 -1
- package/lib/factory/clearingHouse.d.ts +25 -0
- package/lib/factory/clearingHouse.js +64 -0
- package/lib/factory/clearingHouseUser.d.ts +19 -0
- package/lib/factory/clearingHouseUser.js +34 -0
- package/lib/idl/clearing_house.json +366 -17
- package/lib/index.d.ts +9 -3
- package/lib/index.js +10 -3
- package/lib/math/conversion.d.ts +1 -1
- package/lib/math/funding.js +4 -1
- package/lib/math/insuranceFund.d.ts +2 -1
- package/lib/math/insuranceFund.js +3 -6
- package/lib/math/position.d.ts +2 -1
- package/lib/math/position.js +2 -5
- package/lib/math/utils.d.ts +2 -1
- package/lib/math/utils.js +3 -3
- package/lib/mockUSDCFaucet.d.ts +2 -1
- package/lib/orderParams.d.ts +3 -3
- package/lib/orderParams.js +28 -8
- package/lib/orders.d.ts +2 -1
- package/lib/token/index.d.ts +3 -0
- package/lib/token/index.js +38 -0
- package/lib/types.d.ts +20 -8
- package/lib/types.js +2 -2
- package/package.json +11 -3
- package/src/accounts/bulkAccountLoader.ts +215 -0
- package/src/accounts/bulkUserSubscription.ts +28 -0
- package/src/accounts/pollingClearingHouseAccountSubscriber.ts +326 -0
- package/src/accounts/pollingTokenAccountSubscriber.ts +99 -0
- package/src/accounts/pollingUserAccountSubscriber.ts +186 -0
- package/src/accounts/types.ts +40 -30
- package/src/accounts/utils.ts +3 -0
- package/src/accounts/webSocketAccountSubscriber.ts +67 -17
- package/src/accounts/{defaultClearingHouseAccountSubscriber.ts → webSocketClearingHouseAccountSubscriber.ts} +9 -6
- package/src/accounts/{defaultUserAccountSubscriber.ts → webSocketUserAccountSubscriber.ts} +10 -5
- package/src/addresses.ts +6 -4
- package/src/admin.ts +73 -20
- package/src/clearingHouse.ts +125 -25
- package/src/clearingHouseUser.ts +28 -8
- package/src/config.ts +1 -1
- package/src/constants/markets.ts +25 -1
- package/src/constants/numericConstants.ts +2 -1
- package/src/examples/makeTradeExample.ts +4 -1
- package/src/factory/clearingHouse.ts +125 -0
- package/src/factory/clearingHouseUser.ts +73 -0
- package/src/idl/clearing_house.json +366 -17
- package/src/index.ts +9 -3
- package/src/math/conversion.ts +1 -1
- package/src/math/funding.ts +5 -1
- package/src/math/insuranceFund.ts +1 -1
- package/src/math/position.ts +1 -1
- package/src/math/utils.ts +1 -1
- package/src/mockUSDCFaucet.ts +1 -1
- package/src/orderParams.ts +30 -7
- package/src/orders.ts +1 -1
- package/src/token/index.ts +37 -0
- package/src/types.ts +17 -6
- package/lib/accounts/defaultHistoryAccountSubscriber.d.ts +0 -28
- package/lib/accounts/defaultHistoryAccountSubscriber.js +0 -110
- package/src/accounts/defaultHistoryAccountSubscriber.ts +0 -176
|
@@ -53,7 +53,7 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
53
53
|
// Get current price
|
|
54
54
|
const solMarketInfo = __2.Markets.find((market) => market.baseAssetSymbol === 'SOL');
|
|
55
55
|
const currentMarketPrice = __2.calculateMarkPrice(clearingHouse.getMarket(solMarketInfo.marketIndex));
|
|
56
|
-
const formattedPrice = __2.convertToNumber(currentMarketPrice, __2.
|
|
56
|
+
const formattedPrice = __2.convertToNumber(currentMarketPrice, __2.MARK_PRICE_PRECISION);
|
|
57
57
|
console.log(`Current Market Price is $${formattedPrice}`);
|
|
58
58
|
// Estimate the slippage for a $5000 LONG trade
|
|
59
59
|
const solMarketAccount = clearingHouse.getMarket(solMarketInfo.marketIndex);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfirmOptions, Connection, PublicKey } from '@solana/web3.js';
|
|
2
|
+
import { IWallet } from '../types';
|
|
3
|
+
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
4
|
+
import { TxSender } from '../tx/types';
|
|
5
|
+
import { ClearingHouse } from '../clearingHouse';
|
|
6
|
+
import { Admin } from '../admin';
|
|
7
|
+
export declare type ClearingHouseConfigType = 'websocket' | 'polling' | 'custom';
|
|
8
|
+
declare type BaseClearingHouseConfig = {
|
|
9
|
+
type: ClearingHouseConfigType;
|
|
10
|
+
connection: Connection;
|
|
11
|
+
wallet: IWallet;
|
|
12
|
+
programID: PublicKey;
|
|
13
|
+
opts?: ConfirmOptions;
|
|
14
|
+
txSender?: TxSender;
|
|
15
|
+
};
|
|
16
|
+
declare type WebSocketClearingHouseConfiguration = BaseClearingHouseConfig;
|
|
17
|
+
declare type PollingClearingHouseConfiguration = BaseClearingHouseConfig & {
|
|
18
|
+
accountLoader: BulkAccountLoader;
|
|
19
|
+
};
|
|
20
|
+
declare type ClearingHouseConfig = PollingClearingHouseConfiguration | WebSocketClearingHouseConfiguration;
|
|
21
|
+
export declare function getWebSocketClearingHouseConfig(connection: Connection, wallet: IWallet, programID: PublicKey, opts?: ConfirmOptions, txSender?: TxSender): WebSocketClearingHouseConfiguration;
|
|
22
|
+
export declare function getPollingClearingHouseConfig(connection: Connection, wallet: IWallet, programID: PublicKey, accountLoader: BulkAccountLoader, opts?: ConfirmOptions, txSender?: TxSender): PollingClearingHouseConfiguration;
|
|
23
|
+
export declare function getClearingHouse(config: ClearingHouseConfig): ClearingHouse;
|
|
24
|
+
export declare function getAdmin(config: ClearingHouseConfig): Admin;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getAdmin = exports.getClearingHouse = exports.getPollingClearingHouseConfig = exports.getWebSocketClearingHouseConfig = void 0;
|
|
7
|
+
const anchor_1 = require("@project-serum/anchor");
|
|
8
|
+
const clearingHouse_1 = require("../clearingHouse");
|
|
9
|
+
const clearing_house_json_1 = __importDefault(require("../idl/clearing_house.json"));
|
|
10
|
+
const webSocketClearingHouseAccountSubscriber_1 = require("../accounts/webSocketClearingHouseAccountSubscriber");
|
|
11
|
+
const defaultTxSender_1 = require("../tx/defaultTxSender");
|
|
12
|
+
const pollingClearingHouseAccountSubscriber_1 = require("../accounts/pollingClearingHouseAccountSubscriber");
|
|
13
|
+
const admin_1 = require("../admin");
|
|
14
|
+
function getWebSocketClearingHouseConfig(connection, wallet, programID, opts = anchor_1.Provider.defaultOptions(), txSender) {
|
|
15
|
+
return {
|
|
16
|
+
type: 'websocket',
|
|
17
|
+
connection,
|
|
18
|
+
wallet,
|
|
19
|
+
programID,
|
|
20
|
+
opts,
|
|
21
|
+
txSender,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
exports.getWebSocketClearingHouseConfig = getWebSocketClearingHouseConfig;
|
|
25
|
+
function getPollingClearingHouseConfig(connection, wallet, programID, accountLoader, opts = anchor_1.Provider.defaultOptions(), txSender) {
|
|
26
|
+
return {
|
|
27
|
+
type: 'polling',
|
|
28
|
+
connection,
|
|
29
|
+
wallet,
|
|
30
|
+
programID,
|
|
31
|
+
accountLoader,
|
|
32
|
+
opts,
|
|
33
|
+
txSender,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.getPollingClearingHouseConfig = getPollingClearingHouseConfig;
|
|
37
|
+
function getClearingHouse(config) {
|
|
38
|
+
const provider = new anchor_1.Provider(config.connection, config.wallet, config.opts);
|
|
39
|
+
const program = new anchor_1.Program(clearing_house_json_1.default, config.programID, provider);
|
|
40
|
+
let accountSubscriber;
|
|
41
|
+
if (config.type === 'websocket') {
|
|
42
|
+
accountSubscriber = new webSocketClearingHouseAccountSubscriber_1.WebSocketClearingHouseAccountSubscriber(program);
|
|
43
|
+
}
|
|
44
|
+
else if (config.type === 'polling') {
|
|
45
|
+
accountSubscriber = new pollingClearingHouseAccountSubscriber_1.PollingClearingHouseAccountSubscriber(program, config.accountLoader);
|
|
46
|
+
}
|
|
47
|
+
const txSender = config.txSender || new defaultTxSender_1.DefaultTxSender(provider);
|
|
48
|
+
return new clearingHouse_1.ClearingHouse(config.connection, config.wallet, program, accountSubscriber, txSender, config.opts);
|
|
49
|
+
}
|
|
50
|
+
exports.getClearingHouse = getClearingHouse;
|
|
51
|
+
function getAdmin(config) {
|
|
52
|
+
const provider = new anchor_1.Provider(config.connection, config.wallet, config.opts);
|
|
53
|
+
const program = new anchor_1.Program(clearing_house_json_1.default, config.programID, provider);
|
|
54
|
+
let accountSubscriber;
|
|
55
|
+
if (config.type === 'websocket') {
|
|
56
|
+
accountSubscriber = new webSocketClearingHouseAccountSubscriber_1.WebSocketClearingHouseAccountSubscriber(program);
|
|
57
|
+
}
|
|
58
|
+
else if (config.type === 'polling') {
|
|
59
|
+
accountSubscriber = new pollingClearingHouseAccountSubscriber_1.PollingClearingHouseAccountSubscriber(program, config.accountLoader);
|
|
60
|
+
}
|
|
61
|
+
const txSender = config.txSender || new defaultTxSender_1.DefaultTxSender(provider);
|
|
62
|
+
return new admin_1.Admin(config.connection, config.wallet, program, accountSubscriber, txSender, config.opts);
|
|
63
|
+
}
|
|
64
|
+
exports.getAdmin = getAdmin;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import { ClearingHouse } from '../clearingHouse';
|
|
3
|
+
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
4
|
+
import { ClearingHouseUser } from '../clearingHouseUser';
|
|
5
|
+
export declare type ClearingHouseUserConfigType = 'websocket' | 'polling' | 'custom';
|
|
6
|
+
declare type BaseClearingHouseUserConfig = {
|
|
7
|
+
type: ClearingHouseUserConfigType;
|
|
8
|
+
clearingHouse: ClearingHouse;
|
|
9
|
+
authority: PublicKey;
|
|
10
|
+
};
|
|
11
|
+
declare type WebSocketClearingHouseUserConfig = BaseClearingHouseUserConfig;
|
|
12
|
+
declare type PollingClearingHouseUserConfig = BaseClearingHouseUserConfig & {
|
|
13
|
+
accountLoader: BulkAccountLoader;
|
|
14
|
+
};
|
|
15
|
+
declare type ClearingHouseUserConfig = PollingClearingHouseUserConfig | WebSocketClearingHouseUserConfig;
|
|
16
|
+
export declare function getWebSocketClearingHouseUserConfig(clearingHouse: ClearingHouse, authority: PublicKey): WebSocketClearingHouseUserConfig;
|
|
17
|
+
export declare function getPollingClearingHouseUserConfig(clearingHouse: ClearingHouse, authority: PublicKey, accountLoader: BulkAccountLoader): PollingClearingHouseUserConfig;
|
|
18
|
+
export declare function getClearingHouseUser(config: ClearingHouseUserConfig): ClearingHouseUser;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getClearingHouseUser = exports.getPollingClearingHouseUserConfig = exports.getWebSocketClearingHouseUserConfig = void 0;
|
|
4
|
+
const clearingHouseUser_1 = require("../clearingHouseUser");
|
|
5
|
+
const webSocketUserAccountSubscriber_1 = require("../accounts/webSocketUserAccountSubscriber");
|
|
6
|
+
const pollingUserAccountSubscriber_1 = require("../accounts/pollingUserAccountSubscriber");
|
|
7
|
+
function getWebSocketClearingHouseUserConfig(clearingHouse, authority) {
|
|
8
|
+
return {
|
|
9
|
+
type: 'websocket',
|
|
10
|
+
clearingHouse,
|
|
11
|
+
authority,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.getWebSocketClearingHouseUserConfig = getWebSocketClearingHouseUserConfig;
|
|
15
|
+
function getPollingClearingHouseUserConfig(clearingHouse, authority, accountLoader) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'polling',
|
|
18
|
+
clearingHouse,
|
|
19
|
+
authority,
|
|
20
|
+
accountLoader,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.getPollingClearingHouseUserConfig = getPollingClearingHouseUserConfig;
|
|
24
|
+
function getClearingHouseUser(config) {
|
|
25
|
+
let accountSubscriber;
|
|
26
|
+
if (config.type === 'websocket') {
|
|
27
|
+
accountSubscriber = new webSocketUserAccountSubscriber_1.WebSocketUserAccountSubscriber(config.clearingHouse.program, config.authority);
|
|
28
|
+
}
|
|
29
|
+
else if (config.type === 'polling') {
|
|
30
|
+
accountSubscriber = new pollingUserAccountSubscriber_1.PollingUserAccountSubscriber(config.clearingHouse.program, config.authority, config.accountLoader);
|
|
31
|
+
}
|
|
32
|
+
return new clearingHouseUser_1.ClearingHouseUser(config.clearingHouse, config.authority, accountSubscriber);
|
|
33
|
+
}
|
|
34
|
+
exports.getClearingHouseUser = getClearingHouseUser;
|
|
@@ -604,13 +604,69 @@
|
|
|
604
604
|
]
|
|
605
605
|
},
|
|
606
606
|
{
|
|
607
|
-
"name": "
|
|
607
|
+
"name": "cancelOrderByUserId",
|
|
608
608
|
"accounts": [
|
|
609
609
|
{
|
|
610
610
|
"name": "state",
|
|
611
|
+
"isMut": false,
|
|
612
|
+
"isSigner": false
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"name": "orderState",
|
|
616
|
+
"isMut": false,
|
|
617
|
+
"isSigner": false
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
"name": "user",
|
|
621
|
+
"isMut": false,
|
|
622
|
+
"isSigner": false
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"name": "authority",
|
|
626
|
+
"isMut": false,
|
|
627
|
+
"isSigner": true
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"name": "markets",
|
|
611
631
|
"isMut": true,
|
|
612
632
|
"isSigner": false
|
|
613
633
|
},
|
|
634
|
+
{
|
|
635
|
+
"name": "userPositions",
|
|
636
|
+
"isMut": true,
|
|
637
|
+
"isSigner": false
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"name": "userOrders",
|
|
641
|
+
"isMut": true,
|
|
642
|
+
"isSigner": false
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"name": "fundingPaymentHistory",
|
|
646
|
+
"isMut": true,
|
|
647
|
+
"isSigner": false
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"name": "orderHistory",
|
|
651
|
+
"isMut": true,
|
|
652
|
+
"isSigner": false
|
|
653
|
+
}
|
|
654
|
+
],
|
|
655
|
+
"args": [
|
|
656
|
+
{
|
|
657
|
+
"name": "userOrderId",
|
|
658
|
+
"type": "u8"
|
|
659
|
+
}
|
|
660
|
+
]
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"name": "fillOrder",
|
|
664
|
+
"accounts": [
|
|
665
|
+
{
|
|
666
|
+
"name": "state",
|
|
667
|
+
"isMut": false,
|
|
668
|
+
"isSigner": false
|
|
669
|
+
},
|
|
614
670
|
{
|
|
615
671
|
"name": "orderState",
|
|
616
672
|
"isMut": false,
|
|
@@ -666,6 +722,11 @@
|
|
|
666
722
|
"isMut": true,
|
|
667
723
|
"isSigner": false
|
|
668
724
|
},
|
|
725
|
+
{
|
|
726
|
+
"name": "extendedCurveHistory",
|
|
727
|
+
"isMut": true,
|
|
728
|
+
"isSigner": false
|
|
729
|
+
},
|
|
669
730
|
{
|
|
670
731
|
"name": "oracle",
|
|
671
732
|
"isMut": false,
|
|
@@ -737,6 +798,11 @@
|
|
|
737
798
|
"isMut": true,
|
|
738
799
|
"isSigner": false
|
|
739
800
|
},
|
|
801
|
+
{
|
|
802
|
+
"name": "extendedCurveHistory",
|
|
803
|
+
"isMut": true,
|
|
804
|
+
"isSigner": false
|
|
805
|
+
},
|
|
740
806
|
{
|
|
741
807
|
"name": "oracle",
|
|
742
808
|
"isMut": false,
|
|
@@ -1043,6 +1109,78 @@
|
|
|
1043
1109
|
}
|
|
1044
1110
|
]
|
|
1045
1111
|
},
|
|
1112
|
+
{
|
|
1113
|
+
"name": "updateAmmOracleTwap",
|
|
1114
|
+
"accounts": [
|
|
1115
|
+
{
|
|
1116
|
+
"name": "state",
|
|
1117
|
+
"isMut": false,
|
|
1118
|
+
"isSigner": false
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
"name": "markets",
|
|
1122
|
+
"isMut": true,
|
|
1123
|
+
"isSigner": false
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
"name": "oracle",
|
|
1127
|
+
"isMut": false,
|
|
1128
|
+
"isSigner": false
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
"name": "admin",
|
|
1132
|
+
"isMut": false,
|
|
1133
|
+
"isSigner": true
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
"name": "curveHistory",
|
|
1137
|
+
"isMut": true,
|
|
1138
|
+
"isSigner": false
|
|
1139
|
+
}
|
|
1140
|
+
],
|
|
1141
|
+
"args": [
|
|
1142
|
+
{
|
|
1143
|
+
"name": "marketIndex",
|
|
1144
|
+
"type": "u64"
|
|
1145
|
+
}
|
|
1146
|
+
]
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
"name": "resetAmmOracleTwap",
|
|
1150
|
+
"accounts": [
|
|
1151
|
+
{
|
|
1152
|
+
"name": "state",
|
|
1153
|
+
"isMut": false,
|
|
1154
|
+
"isSigner": false
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
"name": "markets",
|
|
1158
|
+
"isMut": true,
|
|
1159
|
+
"isSigner": false
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
"name": "oracle",
|
|
1163
|
+
"isMut": false,
|
|
1164
|
+
"isSigner": false
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"name": "admin",
|
|
1168
|
+
"isMut": false,
|
|
1169
|
+
"isSigner": true
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
"name": "curveHistory",
|
|
1173
|
+
"isMut": true,
|
|
1174
|
+
"isSigner": false
|
|
1175
|
+
}
|
|
1176
|
+
],
|
|
1177
|
+
"args": [
|
|
1178
|
+
{
|
|
1179
|
+
"name": "marketIndex",
|
|
1180
|
+
"type": "u64"
|
|
1181
|
+
}
|
|
1182
|
+
]
|
|
1183
|
+
},
|
|
1046
1184
|
{
|
|
1047
1185
|
"name": "initializeUser",
|
|
1048
1186
|
"accounts": [
|
|
@@ -1284,6 +1422,11 @@
|
|
|
1284
1422
|
"isMut": true,
|
|
1285
1423
|
"isSigner": false
|
|
1286
1424
|
},
|
|
1425
|
+
{
|
|
1426
|
+
"name": "oracle",
|
|
1427
|
+
"isMut": false,
|
|
1428
|
+
"isSigner": false
|
|
1429
|
+
},
|
|
1287
1430
|
{
|
|
1288
1431
|
"name": "curveHistory",
|
|
1289
1432
|
"isMut": true,
|
|
@@ -1301,6 +1444,32 @@
|
|
|
1301
1444
|
}
|
|
1302
1445
|
]
|
|
1303
1446
|
},
|
|
1447
|
+
{
|
|
1448
|
+
"name": "updateCurveHistory",
|
|
1449
|
+
"accounts": [
|
|
1450
|
+
{
|
|
1451
|
+
"name": "admin",
|
|
1452
|
+
"isMut": false,
|
|
1453
|
+
"isSigner": true
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
"name": "state",
|
|
1457
|
+
"isMut": true,
|
|
1458
|
+
"isSigner": false
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
"name": "extendedCurveHistory",
|
|
1462
|
+
"isMut": true,
|
|
1463
|
+
"isSigner": false
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
"name": "curveHistory",
|
|
1467
|
+
"isMut": false,
|
|
1468
|
+
"isSigner": false
|
|
1469
|
+
}
|
|
1470
|
+
],
|
|
1471
|
+
"args": []
|
|
1472
|
+
},
|
|
1304
1473
|
{
|
|
1305
1474
|
"name": "updateMarginRatio",
|
|
1306
1475
|
"accounts": [
|
|
@@ -1771,7 +1940,7 @@
|
|
|
1771
1940
|
"type": "u64"
|
|
1772
1941
|
},
|
|
1773
1942
|
{
|
|
1774
|
-
"name": "
|
|
1943
|
+
"name": "curveRecords",
|
|
1775
1944
|
"type": {
|
|
1776
1945
|
"array": [
|
|
1777
1946
|
{
|
|
@@ -1784,6 +1953,29 @@
|
|
|
1784
1953
|
]
|
|
1785
1954
|
}
|
|
1786
1955
|
},
|
|
1956
|
+
{
|
|
1957
|
+
"name": "ExtendedCurveHistory",
|
|
1958
|
+
"type": {
|
|
1959
|
+
"kind": "struct",
|
|
1960
|
+
"fields": [
|
|
1961
|
+
{
|
|
1962
|
+
"name": "head",
|
|
1963
|
+
"type": "u64"
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
"name": "curveRecords",
|
|
1967
|
+
"type": {
|
|
1968
|
+
"array": [
|
|
1969
|
+
{
|
|
1970
|
+
"defined": "ExtendedCurveRecord"
|
|
1971
|
+
},
|
|
1972
|
+
1024
|
|
1973
|
+
]
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
]
|
|
1977
|
+
}
|
|
1978
|
+
},
|
|
1787
1979
|
{
|
|
1788
1980
|
"name": "DepositHistory",
|
|
1789
1981
|
"type": {
|
|
@@ -1940,6 +2132,15 @@
|
|
|
1940
2132
|
{
|
|
1941
2133
|
"name": "minOrderQuoteAssetAmount",
|
|
1942
2134
|
"type": "u128"
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
"name": "padding",
|
|
2138
|
+
"type": {
|
|
2139
|
+
"array": [
|
|
2140
|
+
"u128",
|
|
2141
|
+
10
|
|
2142
|
+
]
|
|
2143
|
+
}
|
|
1943
2144
|
}
|
|
1944
2145
|
]
|
|
1945
2146
|
}
|
|
@@ -2093,6 +2294,10 @@
|
|
|
2093
2294
|
"name": "orderState",
|
|
2094
2295
|
"type": "publicKey"
|
|
2095
2296
|
},
|
|
2297
|
+
{
|
|
2298
|
+
"name": "extendedCurveHistory",
|
|
2299
|
+
"type": "publicKey"
|
|
2300
|
+
},
|
|
2096
2301
|
{
|
|
2097
2302
|
"name": "padding0",
|
|
2098
2303
|
"type": "u128"
|
|
@@ -2108,14 +2313,6 @@
|
|
|
2108
2313
|
{
|
|
2109
2314
|
"name": "padding3",
|
|
2110
2315
|
"type": "u128"
|
|
2111
|
-
},
|
|
2112
|
-
{
|
|
2113
|
-
"name": "padding4",
|
|
2114
|
-
"type": "u128"
|
|
2115
|
-
},
|
|
2116
|
-
{
|
|
2117
|
-
"name": "padding5",
|
|
2118
|
-
"type": "u128"
|
|
2119
2316
|
}
|
|
2120
2317
|
]
|
|
2121
2318
|
}
|
|
@@ -2292,6 +2489,10 @@
|
|
|
2292
2489
|
"defined": "PositionDirection"
|
|
2293
2490
|
}
|
|
2294
2491
|
},
|
|
2492
|
+
{
|
|
2493
|
+
"name": "userOrderId",
|
|
2494
|
+
"type": "u8"
|
|
2495
|
+
},
|
|
2295
2496
|
{
|
|
2296
2497
|
"name": "quoteAssetAmount",
|
|
2297
2498
|
"type": "u128"
|
|
@@ -2335,6 +2536,22 @@
|
|
|
2335
2536
|
"type": {
|
|
2336
2537
|
"defined": "OrderParamsOptionalAccounts"
|
|
2337
2538
|
}
|
|
2539
|
+
},
|
|
2540
|
+
{
|
|
2541
|
+
"name": "positionLimit",
|
|
2542
|
+
"type": "u128"
|
|
2543
|
+
},
|
|
2544
|
+
{
|
|
2545
|
+
"name": "oraclePriceOffset",
|
|
2546
|
+
"type": "u128"
|
|
2547
|
+
},
|
|
2548
|
+
{
|
|
2549
|
+
"name": "padding0",
|
|
2550
|
+
"type": "bool"
|
|
2551
|
+
},
|
|
2552
|
+
{
|
|
2553
|
+
"name": "padding1",
|
|
2554
|
+
"type": "bool"
|
|
2338
2555
|
}
|
|
2339
2556
|
]
|
|
2340
2557
|
}
|
|
@@ -2435,6 +2652,103 @@
|
|
|
2435
2652
|
]
|
|
2436
2653
|
}
|
|
2437
2654
|
},
|
|
2655
|
+
{
|
|
2656
|
+
"name": "ExtendedCurveRecord",
|
|
2657
|
+
"type": {
|
|
2658
|
+
"kind": "struct",
|
|
2659
|
+
"fields": [
|
|
2660
|
+
{
|
|
2661
|
+
"name": "ts",
|
|
2662
|
+
"type": "i64"
|
|
2663
|
+
},
|
|
2664
|
+
{
|
|
2665
|
+
"name": "recordId",
|
|
2666
|
+
"type": "u128"
|
|
2667
|
+
},
|
|
2668
|
+
{
|
|
2669
|
+
"name": "marketIndex",
|
|
2670
|
+
"type": "u64"
|
|
2671
|
+
},
|
|
2672
|
+
{
|
|
2673
|
+
"name": "pegMultiplierBefore",
|
|
2674
|
+
"type": "u128"
|
|
2675
|
+
},
|
|
2676
|
+
{
|
|
2677
|
+
"name": "baseAssetReserveBefore",
|
|
2678
|
+
"type": "u128"
|
|
2679
|
+
},
|
|
2680
|
+
{
|
|
2681
|
+
"name": "quoteAssetReserveBefore",
|
|
2682
|
+
"type": "u128"
|
|
2683
|
+
},
|
|
2684
|
+
{
|
|
2685
|
+
"name": "sqrtKBefore",
|
|
2686
|
+
"type": "u128"
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
"name": "pegMultiplierAfter",
|
|
2690
|
+
"type": "u128"
|
|
2691
|
+
},
|
|
2692
|
+
{
|
|
2693
|
+
"name": "baseAssetReserveAfter",
|
|
2694
|
+
"type": "u128"
|
|
2695
|
+
},
|
|
2696
|
+
{
|
|
2697
|
+
"name": "quoteAssetReserveAfter",
|
|
2698
|
+
"type": "u128"
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
"name": "sqrtKAfter",
|
|
2702
|
+
"type": "u128"
|
|
2703
|
+
},
|
|
2704
|
+
{
|
|
2705
|
+
"name": "baseAssetAmountLong",
|
|
2706
|
+
"type": "u128"
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
"name": "baseAssetAmountShort",
|
|
2710
|
+
"type": "u128"
|
|
2711
|
+
},
|
|
2712
|
+
{
|
|
2713
|
+
"name": "baseAssetAmount",
|
|
2714
|
+
"type": "i128"
|
|
2715
|
+
},
|
|
2716
|
+
{
|
|
2717
|
+
"name": "openInterest",
|
|
2718
|
+
"type": "u128"
|
|
2719
|
+
},
|
|
2720
|
+
{
|
|
2721
|
+
"name": "totalFee",
|
|
2722
|
+
"type": "u128"
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
"name": "totalFeeMinusDistributions",
|
|
2726
|
+
"type": "u128"
|
|
2727
|
+
},
|
|
2728
|
+
{
|
|
2729
|
+
"name": "adjustmentCost",
|
|
2730
|
+
"type": "i128"
|
|
2731
|
+
},
|
|
2732
|
+
{
|
|
2733
|
+
"name": "oraclePrice",
|
|
2734
|
+
"type": "i128"
|
|
2735
|
+
},
|
|
2736
|
+
{
|
|
2737
|
+
"name": "tradeRecord",
|
|
2738
|
+
"type": "u128"
|
|
2739
|
+
},
|
|
2740
|
+
{
|
|
2741
|
+
"name": "padding",
|
|
2742
|
+
"type": {
|
|
2743
|
+
"array": [
|
|
2744
|
+
"u128",
|
|
2745
|
+
5
|
|
2746
|
+
]
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
]
|
|
2750
|
+
}
|
|
2751
|
+
},
|
|
2438
2752
|
{
|
|
2439
2753
|
"name": "DepositRecord",
|
|
2440
2754
|
"type": {
|
|
@@ -2783,16 +3097,16 @@
|
|
|
2783
3097
|
"type": "i64"
|
|
2784
3098
|
},
|
|
2785
3099
|
{
|
|
2786
|
-
"name": "
|
|
2787
|
-
"type": "
|
|
3100
|
+
"name": "lastOraclePrice",
|
|
3101
|
+
"type": "i128"
|
|
2788
3102
|
},
|
|
2789
3103
|
{
|
|
2790
|
-
"name": "
|
|
2791
|
-
"type": "
|
|
3104
|
+
"name": "minimumBaseAssetTradeSize",
|
|
3105
|
+
"type": "u128"
|
|
2792
3106
|
},
|
|
2793
3107
|
{
|
|
2794
3108
|
"name": "padding1",
|
|
2795
|
-
"type": "
|
|
3109
|
+
"type": "u64"
|
|
2796
3110
|
},
|
|
2797
3111
|
{
|
|
2798
3112
|
"name": "padding2",
|
|
@@ -2861,6 +3175,15 @@
|
|
|
2861
3175
|
{
|
|
2862
3176
|
"name": "fillerReward",
|
|
2863
3177
|
"type": "u128"
|
|
3178
|
+
},
|
|
3179
|
+
{
|
|
3180
|
+
"name": "padding",
|
|
3181
|
+
"type": {
|
|
3182
|
+
"array": [
|
|
3183
|
+
"u64",
|
|
3184
|
+
10
|
|
3185
|
+
]
|
|
3186
|
+
}
|
|
2864
3187
|
}
|
|
2865
3188
|
]
|
|
2866
3189
|
}
|
|
@@ -3212,6 +3535,10 @@
|
|
|
3212
3535
|
"name": "orderId",
|
|
3213
3536
|
"type": "u128"
|
|
3214
3537
|
},
|
|
3538
|
+
{
|
|
3539
|
+
"name": "userOrderId",
|
|
3540
|
+
"type": "u8"
|
|
3541
|
+
},
|
|
3215
3542
|
{
|
|
3216
3543
|
"name": "marketIndex",
|
|
3217
3544
|
"type": "u64"
|
|
@@ -3220,6 +3547,10 @@
|
|
|
3220
3547
|
"name": "price",
|
|
3221
3548
|
"type": "u128"
|
|
3222
3549
|
},
|
|
3550
|
+
{
|
|
3551
|
+
"name": "userBaseAssetAmount",
|
|
3552
|
+
"type": "i128"
|
|
3553
|
+
},
|
|
3223
3554
|
{
|
|
3224
3555
|
"name": "quoteAssetAmount",
|
|
3225
3556
|
"type": "u128"
|
|
@@ -3277,6 +3608,19 @@
|
|
|
3277
3608
|
{
|
|
3278
3609
|
"name": "referrer",
|
|
3279
3610
|
"type": "publicKey"
|
|
3611
|
+
},
|
|
3612
|
+
{
|
|
3613
|
+
"name": "oraclePriceOffset",
|
|
3614
|
+
"type": "i128"
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
"name": "padding",
|
|
3618
|
+
"type": {
|
|
3619
|
+
"array": [
|
|
3620
|
+
"u16",
|
|
3621
|
+
3
|
|
3622
|
+
]
|
|
3623
|
+
}
|
|
3280
3624
|
}
|
|
3281
3625
|
]
|
|
3282
3626
|
}
|
|
@@ -3394,10 +3738,10 @@
|
|
|
3394
3738
|
"name": "Limit"
|
|
3395
3739
|
},
|
|
3396
3740
|
{
|
|
3397
|
-
"name": "
|
|
3741
|
+
"name": "TriggerMarket"
|
|
3398
3742
|
},
|
|
3399
3743
|
{
|
|
3400
|
-
"name": "
|
|
3744
|
+
"name": "TriggerLimit"
|
|
3401
3745
|
}
|
|
3402
3746
|
]
|
|
3403
3747
|
}
|
|
@@ -3715,6 +4059,11 @@
|
|
|
3715
4059
|
"code": 6054,
|
|
3716
4060
|
"name": "MarketOrderMustBeInPlaceAndFill",
|
|
3717
4061
|
"msg": "Market order must be in place and fill"
|
|
4062
|
+
},
|
|
4063
|
+
{
|
|
4064
|
+
"code": 6055,
|
|
4065
|
+
"name": "UserOrderIdAlreadyInUse",
|
|
4066
|
+
"msg": "User Order Id Already In Use"
|
|
3718
4067
|
}
|
|
3719
4068
|
]
|
|
3720
4069
|
}
|