@n1xyz/nord-ts 0.0.1 → 0.0.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/.eslintrc.js +11 -0
- package/README.md +148 -65
- package/dist/bridge/NordUser.d.ts +78 -0
- package/dist/bridge/NordUser.js +196 -0
- package/dist/bridge/client.d.ts +150 -0
- package/dist/bridge/client.js +394 -0
- package/dist/bridge/const.d.ts +23 -0
- package/dist/bridge/const.js +47 -0
- package/dist/bridge/index.d.ts +5 -0
- package/dist/bridge/index.js +23 -0
- package/dist/bridge/types.d.ts +118 -0
- package/dist/bridge/types.js +16 -0
- package/dist/bridge/utils.d.ts +64 -0
- package/dist/bridge/utils.js +131 -0
- package/dist/client.d.ts +70 -0
- package/dist/client.js +129 -0
- package/dist/const.d.ts +2 -5
- package/dist/const.js +18 -22
- package/dist/constants/endpoints.d.ts +65 -0
- package/dist/constants/endpoints.js +68 -0
- package/dist/gen/common.d.ts +6 -1
- package/dist/gen/common.js +19 -9
- package/dist/gen/nord.d.ts +75 -17
- package/dist/gen/nord.js +987 -423
- package/dist/idl/bridge.d.ts +2 -0
- package/dist/idl/bridge.js +703 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +18 -2
- package/dist/models/account.d.ts +58 -0
- package/dist/models/account.js +6 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +28 -0
- package/dist/models/market.d.ts +137 -0
- package/dist/models/market.js +6 -0
- package/dist/models/order.d.ts +211 -0
- package/dist/models/order.js +6 -0
- package/dist/models/token.d.ts +50 -0
- package/dist/models/token.js +6 -0
- package/dist/nord/Nord.d.ts +222 -49
- package/dist/nord/Nord.js +290 -278
- package/dist/nord/NordError.d.ts +23 -0
- package/dist/nord/NordError.js +48 -0
- package/dist/nord/NordImpl.d.ts +6 -2
- package/dist/nord/NordImpl.js +21 -1
- package/dist/nord/NordUser.d.ts +208 -42
- package/dist/nord/NordUser.js +389 -157
- package/dist/nord/Subscriber.d.ts +37 -0
- package/dist/nord/Subscriber.js +29 -0
- package/dist/nord/api/actions.d.ts +101 -0
- package/dist/nord/api/actions.js +250 -0
- package/dist/nord/api/core.d.ts +49 -0
- package/dist/nord/api/core.js +121 -0
- package/dist/nord/api/index.d.ts +1 -0
- package/dist/nord/api/index.js +17 -0
- package/dist/nord/api/market.d.ts +36 -0
- package/dist/nord/api/market.js +98 -0
- package/dist/nord/api/metrics.d.ts +67 -0
- package/dist/nord/api/metrics.js +132 -0
- package/dist/nord/api/orderFunctions.d.ts +168 -0
- package/dist/nord/api/orderFunctions.js +133 -0
- package/dist/nord/api/queries.d.ts +81 -0
- package/dist/nord/api/queries.js +187 -0
- package/dist/nord/client/Nord.d.ts +335 -0
- package/dist/nord/client/Nord.js +532 -0
- package/dist/nord/client/NordUser.d.ts +320 -0
- package/dist/nord/client/NordUser.js +701 -0
- package/dist/nord/core.d.ts +48 -0
- package/dist/nord/core.js +97 -0
- package/dist/nord/index.d.ts +9 -2
- package/dist/nord/index.js +30 -6
- package/dist/nord/market.d.ts +36 -0
- package/dist/nord/market.js +90 -0
- package/dist/nord/metrics.d.ts +67 -0
- package/dist/nord/metrics.js +124 -0
- package/dist/nord/models/Subscriber.d.ts +37 -0
- package/dist/nord/models/Subscriber.js +29 -0
- package/dist/nord/queries.d.ts +81 -0
- package/dist/nord/queries.js +181 -0
- package/dist/nord/types.d.ts +88 -0
- package/dist/nord/types.js +2 -0
- package/dist/nord/utils/NordError.d.ts +35 -0
- package/dist/nord/utils/NordError.js +46 -0
- package/dist/nord/websocket.d.ts +49 -0
- package/dist/nord/websocket.js +107 -0
- package/dist/operations/account.d.ts +58 -0
- package/dist/operations/account.js +112 -0
- package/dist/operations/market.d.ts +65 -0
- package/dist/operations/market.js +131 -0
- package/dist/operations/orders.d.ts +57 -0
- package/dist/operations/orders.js +129 -0
- package/dist/solana/NordUser.d.ts +78 -0
- package/dist/solana/NordUser.js +196 -0
- package/dist/solana/client.d.ts +139 -0
- package/dist/solana/client.js +360 -0
- package/dist/solana/const.d.ts +23 -0
- package/dist/solana/const.js +47 -0
- package/dist/solana/index.d.ts +5 -0
- package/dist/solana/index.js +23 -0
- package/dist/solana/types.d.ts +118 -0
- package/dist/solana/types.js +16 -0
- package/dist/solana/utils.d.ts +64 -0
- package/dist/solana/utils.js +131 -0
- package/dist/types/api.d.ts +152 -0
- package/dist/types/api.js +6 -0
- package/dist/types/config.d.ts +34 -0
- package/dist/types/config.js +6 -0
- package/dist/types.d.ts +144 -87
- package/dist/types.js +13 -2
- package/dist/utils/errors.d.ts +96 -0
- package/dist/utils/errors.js +132 -0
- package/dist/utils/http.d.ts +35 -0
- package/dist/utils/http.js +105 -0
- package/dist/utils.d.ts +14 -5
- package/dist/utils.js +26 -7
- package/dist/websocket/NordWebSocketClient.d.ts +71 -0
- package/dist/websocket/NordWebSocketClient.js +343 -0
- package/dist/websocket/client.d.ts +93 -0
- package/dist/websocket/client.js +222 -0
- package/dist/websocket/events.d.ts +19 -0
- package/dist/websocket/events.js +2 -0
- package/dist/websocket/index.d.ts +2 -0
- package/dist/websocket/index.js +5 -0
- package/dist/websocket.d.ts +55 -0
- package/dist/websocket.js +211 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Nord.html +2 -15
- package/docs/classes/NordUser.html +4 -4
- package/docs/enums/FillMode.html +2 -2
- package/docs/enums/KeyType.html +2 -2
- package/docs/enums/PeakTpsPeriodUnit.html +2 -2
- package/docs/enums/Side.html +2 -2
- package/docs/functions/assert.html +1 -1
- package/docs/functions/bigIntToProtoU128.html +1 -1
- package/docs/functions/checkPubKeyLength.html +1 -1
- package/docs/functions/checkedFetch.html +1 -1
- package/docs/functions/decodeLengthDelimited.html +1 -1
- package/docs/functions/encodeLengthDelimited.html +1 -1
- package/docs/functions/fillModeToProtoFillMode.html +1 -1
- package/docs/functions/findMarket.html +1 -1
- package/docs/functions/findToken.html +1 -1
- package/docs/functions/makeWalletSignFn.html +1 -1
- package/docs/functions/optExpect.html +1 -1
- package/docs/functions/optMap.html +1 -1
- package/docs/functions/optUnwrap.html +1 -1
- package/docs/functions/panic.html +1 -1
- package/docs/functions/signAction.html +1 -1
- package/docs/functions/toScaledU128.html +1 -1
- package/docs/functions/toScaledU64.html +1 -1
- package/docs/interfaces/Account.html +2 -2
- package/docs/interfaces/ActionInfo.html +2 -2
- package/docs/interfaces/ActionQuery.html +2 -2
- package/docs/interfaces/ActionResponse.html +2 -2
- package/docs/interfaces/ActionsExtendedInfo.html +2 -2
- package/docs/interfaces/ActionsQuery.html +2 -2
- package/docs/interfaces/ActionsResponse.html +2 -2
- package/docs/interfaces/AggregateMetrics.html +2 -2
- package/docs/interfaces/BlockQuery.html +2 -2
- package/docs/interfaces/BlockResponse.html +2 -2
- package/docs/interfaces/BlockSummary.html +2 -2
- package/docs/interfaces/BlockSummaryResponse.html +2 -2
- package/docs/interfaces/DeltaEvent.html +2 -2
- package/docs/interfaces/ERC20TokenInfo.html +2 -2
- package/docs/interfaces/Info.html +2 -2
- package/docs/interfaces/Market.html +2 -2
- package/docs/interfaces/MarketStats.html +2 -2
- package/docs/interfaces/MarketsStatsResponse.html +2 -2
- package/docs/interfaces/NordConfig.html +2 -2
- package/docs/interfaces/Order.html +2 -2
- package/docs/interfaces/OrderInfo.html +2 -2
- package/docs/interfaces/PerpMarketStats.html +2 -2
- package/docs/interfaces/RollmanActionExtendedInfo.html +2 -2
- package/docs/interfaces/RollmanActionInfo.html +2 -2
- package/docs/interfaces/RollmanActionResponse.html +2 -2
- package/docs/interfaces/RollmanActionsResponse.html +2 -2
- package/docs/interfaces/RollmanBlockResponse.html +2 -2
- package/docs/interfaces/SubscriberConfig.html +2 -2
- package/docs/interfaces/Token.html +2 -2
- package/docs/interfaces/Trade.html +2 -2
- package/docs/interfaces/Trades.html +2 -2
- package/docs/modules.html +0 -7
- package/docs/types/BigIntValue.html +1 -1
- package/docs/variables/DEBUG_KEYS.html +1 -1
- package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
- package/docs/variables/DEV_CONTRACT_ADDRESS.html +1 -1
- package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
- package/docs/variables/DEV_URL.html +1 -1
- package/docs/variables/ERC20_ABI.html +1 -1
- package/docs/variables/EVM_DEV_URL.html +1 -1
- package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +1 -1
- package/docs/variables/MAX_BUFFER_LEN.html +1 -1
- package/docs/variables/NORD_GETTERS_FACET_ABI.html +1 -1
- package/docs/variables/NORD_RAMP_FACET_ABI.html +1 -1
- package/docs/variables/SESSION_TTL.html +1 -1
- package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
- package/docs/variables/ZERO_DECIMAL.html +1 -1
- package/package.json +10 -12
- package/src/bridge/client.ts +487 -0
- package/src/bridge/const.ts +53 -0
- package/src/bridge/index.ts +7 -0
- package/src/bridge/types.ts +127 -0
- package/src/bridge/utils.ts +140 -0
- package/src/const.ts +20 -25
- package/src/gen/common.ts +27 -10
- package/src/gen/nord.ts +1044 -483
- package/src/idl/bridge.ts +702 -0
- package/src/index.ts +24 -5
- package/src/nord/{actions.ts → api/actions.ts} +33 -37
- package/src/nord/api/core.ts +130 -0
- package/src/nord/api/market.ts +125 -0
- package/src/nord/api/metrics.ts +154 -0
- package/src/nord/api/queries.ts +236 -0
- package/src/nord/client/Nord.ts +652 -0
- package/src/nord/client/NordUser.ts +1105 -0
- package/src/nord/index.ts +16 -2
- package/src/nord/models/Subscriber.ts +57 -0
- package/src/nord/utils/NordError.ts +72 -0
- package/src/types.ts +170 -99
- package/src/utils.ts +40 -19
- package/src/websocket/NordWebSocketClient.ts +432 -0
- package/src/websocket/events.ts +31 -0
- package/src/websocket/index.ts +2 -0
- package/tests/utils.spec.ts +24 -24
- package/docs/classes/Subscriber.html +0 -6
- package/docs/functions/createWebSocketSubscription.html +0 -12
- package/docs/interfaces/OrderbookOrder.html +0 -6
- package/docs/interfaces/OrderbookResponse.html +0 -10
- package/docs/interfaces/TradeInfo.html +0 -20
- package/docs/interfaces/TradesQueryParams.html +0 -10
- package/docs/interfaces/TradesResponse.html +0 -12
- package/src/abis/ERC20_ABI.ts +0 -310
- package/src/abis/NORD_GETTERS_FACET_ABI.ts +0 -192
- package/src/abis/NORD_RAMP_FACET_ABI.ts +0 -141
- package/src/abis/index.ts +0 -3
- package/src/nord/Nord.ts +0 -504
- package/src/nord/NordImpl.ts +0 -8
- package/src/nord/NordUser.ts +0 -469
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API endpoint constants
|
|
4
|
+
* @module constants/endpoints
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ENDPOINTS = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* API endpoints
|
|
10
|
+
*/
|
|
11
|
+
exports.ENDPOINTS = {
|
|
12
|
+
/**
|
|
13
|
+
* Markets endpoint
|
|
14
|
+
*/
|
|
15
|
+
MARKETS: '/api/markets',
|
|
16
|
+
/**
|
|
17
|
+
* Orderbook endpoint
|
|
18
|
+
*/
|
|
19
|
+
ORDERBOOK: '/api/orderbook',
|
|
20
|
+
/**
|
|
21
|
+
* Trades endpoint
|
|
22
|
+
*/
|
|
23
|
+
TRADES: '/api/trades',
|
|
24
|
+
/**
|
|
25
|
+
* Candles endpoint
|
|
26
|
+
*/
|
|
27
|
+
CANDLES: '/api/candles',
|
|
28
|
+
/**
|
|
29
|
+
* Timestamp endpoint
|
|
30
|
+
*/
|
|
31
|
+
TIMESTAMP: '/api/timestamp',
|
|
32
|
+
/**
|
|
33
|
+
* Account endpoint
|
|
34
|
+
*/
|
|
35
|
+
ACCOUNT: '/api/account',
|
|
36
|
+
/**
|
|
37
|
+
* Accounts endpoint
|
|
38
|
+
*/
|
|
39
|
+
ACCOUNTS: '/api/accounts',
|
|
40
|
+
/**
|
|
41
|
+
* Balance endpoint
|
|
42
|
+
*/
|
|
43
|
+
BALANCE: '/api/balance',
|
|
44
|
+
/**
|
|
45
|
+
* Balances endpoint
|
|
46
|
+
*/
|
|
47
|
+
BALANCES: '/api/balances',
|
|
48
|
+
/**
|
|
49
|
+
* Order endpoint
|
|
50
|
+
*/
|
|
51
|
+
ORDER: '/api/order',
|
|
52
|
+
/**
|
|
53
|
+
* Orders endpoint
|
|
54
|
+
*/
|
|
55
|
+
ORDERS: '/api/orders',
|
|
56
|
+
/**
|
|
57
|
+
* Place order endpoint
|
|
58
|
+
*/
|
|
59
|
+
PLACE_ORDER: '/api/order/place',
|
|
60
|
+
/**
|
|
61
|
+
* Cancel order endpoint
|
|
62
|
+
*/
|
|
63
|
+
CANCEL_ORDER: '/api/order/cancel',
|
|
64
|
+
/**
|
|
65
|
+
* Metrics endpoint
|
|
66
|
+
*/
|
|
67
|
+
METRICS: '/api/metrics',
|
|
68
|
+
};
|
package/dist/gen/common.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
export declare const protobufPackage = "common";
|
|
3
3
|
export interface Message {
|
|
4
|
-
kind?:
|
|
4
|
+
kind?: //
|
|
5
|
+
/**
|
|
6
|
+
* there are many things to come here, that why enum,
|
|
7
|
+
* from list abi calls, nfts, multi asset transfer
|
|
8
|
+
*/
|
|
9
|
+
{
|
|
5
10
|
$case: "transfer";
|
|
6
11
|
value: Message_Transfer;
|
|
7
12
|
} | undefined;
|
package/dist/gen/common.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
3
|
// versions:
|
|
4
|
-
// protoc-gen-ts_proto v2.
|
|
5
|
-
// protoc
|
|
4
|
+
// protoc-gen-ts_proto v2.6.1
|
|
5
|
+
// protoc v3.21.12
|
|
6
6
|
// source: common.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.Message_Transfer = exports.Message = exports.protobufPackage = void 0;
|
|
@@ -28,12 +28,13 @@ exports.Message = {
|
|
|
28
28
|
while (reader.pos < end) {
|
|
29
29
|
const tag = reader.uint32();
|
|
30
30
|
switch (tag >>> 3) {
|
|
31
|
-
case 1:
|
|
31
|
+
case 1: {
|
|
32
32
|
if (tag !== 10) {
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
message.kind = { $case: "transfer", value: exports.Message_Transfer.decode(reader, reader.uint32()) };
|
|
36
36
|
continue;
|
|
37
|
+
}
|
|
37
38
|
}
|
|
38
39
|
if ((tag & 7) === 4 || tag === 0) {
|
|
39
40
|
break;
|
|
@@ -61,8 +62,13 @@ exports.Message = {
|
|
|
61
62
|
},
|
|
62
63
|
fromPartial(object) {
|
|
63
64
|
const message = createBaseMessage();
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
switch (object.kind?.$case) {
|
|
66
|
+
case "transfer": {
|
|
67
|
+
if (object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
68
|
+
message.kind = { $case: "transfer", value: exports.Message_Transfer.fromPartial(object.kind.value) };
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
66
72
|
}
|
|
67
73
|
return message;
|
|
68
74
|
},
|
|
@@ -98,25 +104,28 @@ exports.Message_Transfer = {
|
|
|
98
104
|
while (reader.pos < end) {
|
|
99
105
|
const tag = reader.uint32();
|
|
100
106
|
switch (tag >>> 3) {
|
|
101
|
-
case 1:
|
|
107
|
+
case 1: {
|
|
102
108
|
if (tag !== 8) {
|
|
103
109
|
break;
|
|
104
110
|
}
|
|
105
111
|
message.tokenId = reader.uint32();
|
|
106
112
|
continue;
|
|
107
|
-
|
|
113
|
+
}
|
|
114
|
+
case 2: {
|
|
108
115
|
if (tag !== 18) {
|
|
109
116
|
break;
|
|
110
117
|
}
|
|
111
118
|
message.userPubkey = reader.bytes();
|
|
112
119
|
continue;
|
|
113
|
-
|
|
120
|
+
}
|
|
121
|
+
case 3: {
|
|
114
122
|
if (tag !== 24) {
|
|
115
123
|
break;
|
|
116
124
|
}
|
|
117
125
|
message.amount = reader.uint64();
|
|
118
126
|
continue;
|
|
119
|
-
|
|
127
|
+
}
|
|
128
|
+
case 7: {
|
|
120
129
|
if (tag === 56) {
|
|
121
130
|
message.channelId.push(reader.uint32());
|
|
122
131
|
continue;
|
|
@@ -129,6 +138,7 @@ exports.Message_Transfer = {
|
|
|
129
138
|
continue;
|
|
130
139
|
}
|
|
131
140
|
break;
|
|
141
|
+
}
|
|
132
142
|
}
|
|
133
143
|
if ((tag & 7) === 4 || tag === 0) {
|
|
134
144
|
break;
|
package/dist/gen/nord.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ export declare function marketTypeToJSON(object: MarketType): string;
|
|
|
37
37
|
*/
|
|
38
38
|
export declare enum Error {
|
|
39
39
|
DUPLICATE = 0,
|
|
40
|
-
TIMESTAMP_STALE = 1,
|
|
41
40
|
DECODE_FAILURE = 2,
|
|
42
41
|
INVALID_SIGNATURE = 3,
|
|
43
42
|
MARKET_NOT_FOUND = 4,
|
|
@@ -67,7 +66,6 @@ export declare enum Error {
|
|
|
67
66
|
INDEX_PRICE_OUT_OF_RANGE = 103,
|
|
68
67
|
INDEX_DECIMALS_OUT_OF_RANGE = 104,
|
|
69
68
|
INVALID_STATE_VERSION = 105,
|
|
70
|
-
POSITION_STATE_IS_WRONG_FOR_ORDER = 106,
|
|
71
69
|
INVALID_MARGINS = 107,
|
|
72
70
|
/** ACTION_CANNOT_BE_DELEGATED - means that user cannot execute proposed action on behalf of different user */
|
|
73
71
|
ACTION_CANNOT_BE_DELEGATED = 108,
|
|
@@ -84,9 +82,6 @@ export declare enum Error {
|
|
|
84
82
|
*/
|
|
85
83
|
MARKET_DECIMALS_EXCEED_LIMITS = 109,
|
|
86
84
|
TOO_MANY_TOKENS = 110,
|
|
87
|
-
BANKRUPTCY = 111,
|
|
88
|
-
/** TOKEN_ALREADY_REGISTERED - Token with specified blockchain address already registered */
|
|
89
|
-
TOKEN_ALREADY_REGISTERED = 112,
|
|
90
85
|
FUNDING_OVERFLOW = 123,
|
|
91
86
|
/**
|
|
92
87
|
* CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED - If there is order to cancel for position, it should be canceled first
|
|
@@ -97,13 +92,13 @@ export declare enum Error {
|
|
|
97
92
|
/** UNEXPECTED_TOKEN_ID - Token was found, but not expected to be used in action context */
|
|
98
93
|
UNEXPECTED_TOKEN_ID = 127,
|
|
99
94
|
SIGNATURE_VERIFICATION = 128,
|
|
100
|
-
/** MARKET_NOT_READY - Happens when market is not read to handle orders */
|
|
101
|
-
MARKET_NOT_READY = 129,
|
|
102
95
|
/**
|
|
103
96
|
* TOKEN_NOT_READY - happens in some situation when token misses some relevant information
|
|
104
|
-
* needed for operation
|
|
97
|
+
* needed for operation, for example index price
|
|
105
98
|
*/
|
|
106
99
|
TOKEN_NOT_READY = 130,
|
|
100
|
+
/** TOKEN_ALREADY_REGISTERED - Token with specified blockchain address already registered */
|
|
101
|
+
TOKEN_ALREADY_REGISTERED = 112,
|
|
107
102
|
OMF_LESS_THAN_OR_EQUAL_IMF = 131,
|
|
108
103
|
ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE = 132,
|
|
109
104
|
IMMEDIATE_ORDER_GOT_NO_FILLS = 133,
|
|
@@ -140,6 +135,11 @@ export declare enum Error {
|
|
|
140
135
|
ORDER_EXECUTION_MISSING_PRICE = 156,
|
|
141
136
|
/** ORDER_EXECUTION_SIZE_LIMIT - 10011_101; */
|
|
142
137
|
ORDER_EXECUTION_SIZE_LIMIT = 157,
|
|
138
|
+
/**
|
|
139
|
+
* ORDER_REDUCE_IS_POST_ONLY - 10011_110;
|
|
140
|
+
* Reduce orders can only be post only.
|
|
141
|
+
*/
|
|
142
|
+
ORDER_REDUCE_IS_POST_ONLY = 158,
|
|
143
143
|
/** BALANCE - 10100_000 */
|
|
144
144
|
BALANCE = 160,
|
|
145
145
|
/** BALANCE_DEPOSIT_OVERFLOW - 10100_001 */
|
|
@@ -174,10 +174,42 @@ export declare enum Error {
|
|
|
174
174
|
* Binary pattern: 10101_001
|
|
175
175
|
*/
|
|
176
176
|
TRIGGER_INVALID_PRICE = 169,
|
|
177
|
+
/** TIMESTAMP - 10110_000 */
|
|
178
|
+
TIMESTAMP = 176,
|
|
179
|
+
/** TIMESTAMP_OUT_OF_THRESHOLD - 10110_001 */
|
|
180
|
+
TIMESTAMP_OUT_OF_THRESHOLD = 177,
|
|
181
|
+
TIMESTAMP_STALE = 178,
|
|
182
|
+
/** BANKRUPTCY - 10111_000 */
|
|
183
|
+
BANKRUPTCY = 184,
|
|
184
|
+
/** BANKRUPTCY_INSUFFICIENT_COVERAGE - 10111_001 */
|
|
185
|
+
BANKRUPTCY_INSUFFICIENT_COVERAGE = 185,
|
|
186
|
+
/**
|
|
187
|
+
* BANKRUPTCY_NOT_FOUND - 10111_010
|
|
188
|
+
* Account is not in bankruptcy state.
|
|
189
|
+
*/
|
|
190
|
+
BANKRUPTCY_NOT_FOUND = 186,
|
|
191
|
+
/**
|
|
192
|
+
* MARKET_NOT_READY - 11000_000
|
|
193
|
+
* Happens when market is not read to handle orders
|
|
194
|
+
*/
|
|
195
|
+
MARKET_NOT_READY = 192,
|
|
196
|
+
MARKET_FROZEN = 193,
|
|
197
|
+
/** POSITION - 11001_000 */
|
|
198
|
+
POSITION = 200,
|
|
199
|
+
POSITION_STATE_ORDER = 202,
|
|
200
|
+
POSITION_STATE_ORDER_PRICE = 203,
|
|
201
|
+
POSITION_STATE_ORDER_SIZE = 204,
|
|
202
|
+
POSITION_STATE_ORDER_SIDE = 205,
|
|
203
|
+
POSITION_SIZE_LIMIT = 206,
|
|
177
204
|
Dropped = 999
|
|
178
205
|
}
|
|
179
206
|
export declare function errorFromJSON(object: any): Error;
|
|
180
207
|
export declare function errorToJSON(object: Error): string;
|
|
208
|
+
export declare enum SpecialAccount {
|
|
209
|
+
FeeVault = 0
|
|
210
|
+
}
|
|
211
|
+
export declare function specialAccountFromJSON(object: any): SpecialAccount;
|
|
212
|
+
export declare function specialAccountToJSON(object: SpecialAccount): string;
|
|
181
213
|
/** Emulation of 128-bit integers since Protobuf doesn't have native support */
|
|
182
214
|
export interface U128 {
|
|
183
215
|
/** Low 64-bit word */
|
|
@@ -306,9 +338,7 @@ export interface Action_CreateToken {
|
|
|
306
338
|
/** / Used to bind to relevant oracle feed */
|
|
307
339
|
oracleSymbol: string;
|
|
308
340
|
/** On chain id for the wrapped asset on the rollup */
|
|
309
|
-
|
|
310
|
-
/** Minimum amount to withdraw per action to disincentivize spam. */
|
|
311
|
-
minWithdrawAmount: bigint;
|
|
341
|
+
solAddr: Uint8Array;
|
|
312
342
|
}
|
|
313
343
|
export interface Action_CreateMarket {
|
|
314
344
|
sizeDecimals: number;
|
|
@@ -345,6 +375,10 @@ export interface Action_CreateMarket {
|
|
|
345
375
|
* This behavior exists because order can be limited by quote size,
|
|
346
376
|
* which converts to order size in a non-linear manner.
|
|
347
377
|
*
|
|
378
|
+
* Some orders can be executed immediately, in this no order will be added to
|
|
379
|
+
* orderbook, no order id created. Consider using `client_order_id` to track
|
|
380
|
+
* execution of such orders.
|
|
381
|
+
*
|
|
348
382
|
* Example: User posts order with size 2^48+100_000. Order fills counter
|
|
349
383
|
* orders and its size is reduced to 2^48-1_000_000 in process. This order
|
|
350
384
|
* will be added to orderbook successfully despite its initial size is above
|
|
@@ -456,6 +490,12 @@ export interface Action_PythPriceFeedUpdate {
|
|
|
456
490
|
/** See https://hermes.pyth.network/docs/#/rest/latest_price_updates */
|
|
457
491
|
rawPythnetData: Uint8Array;
|
|
458
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* Perform final account liquidation procedure.
|
|
495
|
+
* Can be executed only accounts with AV < 0 (bankrupt).
|
|
496
|
+
* After execution, `liquidatee_account_id` is removed from state.
|
|
497
|
+
* See MARKETS.md `Bankruptcy` for details.
|
|
498
|
+
*/
|
|
459
499
|
export interface Action_Liquidate {
|
|
460
500
|
liquidatorSessionId: bigint;
|
|
461
501
|
liquidateeAccountId: number;
|
|
@@ -469,13 +509,19 @@ export interface Action_Pause {
|
|
|
469
509
|
}
|
|
470
510
|
export interface Action_Unpause {
|
|
471
511
|
}
|
|
512
|
+
/** Transfers tokens to specified account. */
|
|
472
513
|
export interface Action_Transfer {
|
|
473
514
|
sessionId: bigint;
|
|
474
515
|
fromAccountId: number;
|
|
475
516
|
tokenId: number;
|
|
476
517
|
amount: bigint;
|
|
477
|
-
/** If target account id isn't specified, new account is created */
|
|
518
|
+
/** If target account id isn't specified, new account is created. */
|
|
478
519
|
toAccountId?: number | undefined;
|
|
520
|
+
/**
|
|
521
|
+
* If specified, than `to_account_id` must be none.
|
|
522
|
+
* Transfer funds to accounts, for example to cover bankruptcies.
|
|
523
|
+
*/
|
|
524
|
+
specialAccount?: SpecialAccount | undefined;
|
|
479
525
|
}
|
|
480
526
|
export interface Action_AddTrigger {
|
|
481
527
|
sessionId: bigint;
|
|
@@ -535,7 +581,7 @@ export interface Receipt {
|
|
|
535
581
|
value: Receipt_UpdateGuardianSetResult;
|
|
536
582
|
} | {
|
|
537
583
|
$case: "liquidated";
|
|
538
|
-
value:
|
|
584
|
+
value: Receipt_AccountLiquidated;
|
|
539
585
|
} | {
|
|
540
586
|
$case: "sessionRevoked";
|
|
541
587
|
value: Receipt_SessionRevoked;
|
|
@@ -563,7 +609,6 @@ export interface Receipt_Posted {
|
|
|
563
609
|
size: bigint;
|
|
564
610
|
orderId: bigint;
|
|
565
611
|
accountId: number;
|
|
566
|
-
clientOrderId?: bigint | undefined;
|
|
567
612
|
}
|
|
568
613
|
export interface Receipt_Trade {
|
|
569
614
|
orderId: bigint;
|
|
@@ -578,6 +623,7 @@ export interface Receipt_CreateSessionResult {
|
|
|
578
623
|
export interface Receipt_PlaceOrderResult {
|
|
579
624
|
posted?: Receipt_Posted | undefined;
|
|
580
625
|
fills: Receipt_Trade[];
|
|
626
|
+
clientOrderId?: bigint | undefined;
|
|
581
627
|
}
|
|
582
628
|
export interface Receipt_CancelOrderResult {
|
|
583
629
|
orderId: bigint;
|
|
@@ -618,7 +664,17 @@ export interface Receipt_UpdateGuardianSetResult {
|
|
|
618
664
|
guardianSetIndex: number;
|
|
619
665
|
addresses: Uint8Array[];
|
|
620
666
|
}
|
|
621
|
-
export interface
|
|
667
|
+
export interface Receipt_PerpPosition {
|
|
668
|
+
marketId: number;
|
|
669
|
+
baseSize: bigint;
|
|
670
|
+
price: bigint;
|
|
671
|
+
}
|
|
672
|
+
/** / Result of bankruptcy liquidation. */
|
|
673
|
+
export interface Receipt_AccountLiquidated {
|
|
674
|
+
liquidatorAccountId: number;
|
|
675
|
+
liquidateeAccountId: number;
|
|
676
|
+
cancelledOrders: bigint[];
|
|
677
|
+
removedPerps: Receipt_PerpPosition[];
|
|
622
678
|
}
|
|
623
679
|
export interface Receipt_SessionRevoked {
|
|
624
680
|
}
|
|
@@ -628,10 +684,11 @@ export interface Receipt_Unpaused {
|
|
|
628
684
|
}
|
|
629
685
|
export interface Receipt_Transferred {
|
|
630
686
|
fromAccountId: number;
|
|
631
|
-
|
|
687
|
+
toUserAccount?: number | undefined;
|
|
632
688
|
tokenId: number;
|
|
633
689
|
amount: bigint;
|
|
634
690
|
accountCreated: boolean;
|
|
691
|
+
toSpecialAccount?: SpecialAccount | undefined;
|
|
635
692
|
}
|
|
636
693
|
export interface Receipt_TriggerAdded {
|
|
637
694
|
}
|
|
@@ -671,7 +728,8 @@ export declare const Receipt_WithdrawResult: MessageFns<Receipt_WithdrawResult>;
|
|
|
671
728
|
export declare const Receipt_OracleSymbolFeedResult: MessageFns<Receipt_OracleSymbolFeedResult>;
|
|
672
729
|
export declare const Receipt_OracleUpdateResult: MessageFns<Receipt_OracleUpdateResult>;
|
|
673
730
|
export declare const Receipt_UpdateGuardianSetResult: MessageFns<Receipt_UpdateGuardianSetResult>;
|
|
674
|
-
export declare const
|
|
731
|
+
export declare const Receipt_PerpPosition: MessageFns<Receipt_PerpPosition>;
|
|
732
|
+
export declare const Receipt_AccountLiquidated: MessageFns<Receipt_AccountLiquidated>;
|
|
675
733
|
export declare const Receipt_SessionRevoked: MessageFns<Receipt_SessionRevoked>;
|
|
676
734
|
export declare const Receipt_Paused: MessageFns<Receipt_Paused>;
|
|
677
735
|
export declare const Receipt_Unpaused: MessageFns<Receipt_Unpaused>;
|