@n1xyz/nord-ts 0.0.1
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/.eslintignore +1 -0
- package/.eslintrc.js +20 -0
- package/.prettierignore +1 -0
- package/README.md +110 -0
- package/dist/abis/ERC20_ABI.d.ts +39 -0
- package/dist/abis/ERC20_ABI.js +313 -0
- package/dist/abis/NORD_GETTERS_FACET_ABI.d.ts +34 -0
- package/dist/abis/NORD_GETTERS_FACET_ABI.js +195 -0
- package/dist/abis/NORD_RAMP_FACET_ABI.d.ts +35 -0
- package/dist/abis/NORD_RAMP_FACET_ABI.js +144 -0
- package/dist/abis/index.d.ts +3 -0
- package/dist/abis/index.js +9 -0
- package/dist/const.d.ts +11 -0
- package/dist/const.js +34 -0
- package/dist/gen/common.d.ts +63 -0
- package/dist/gen/common.js +205 -0
- package/dist/gen/nord.d.ts +705 -0
- package/dist/gen/nord.js +4784 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -0
- package/dist/nord/Nord.d.ts +76 -0
- package/dist/nord/Nord.js +376 -0
- package/dist/nord/NordImpl.d.ts +7 -0
- package/dist/nord/NordImpl.js +6 -0
- package/dist/nord/NordUser.d.ts +77 -0
- package/dist/nord/NordUser.js +249 -0
- package/dist/nord/actions.d.ts +101 -0
- package/dist/nord/actions.js +254 -0
- package/dist/nord/index.d.ts +2 -0
- package/dist/nord/index.js +9 -0
- package/dist/types.d.ts +343 -0
- package/dist/types.js +92 -0
- package/dist/utils.d.ts +114 -0
- package/dist/utils.js +257 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/icons.js +15 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1415 -0
- package/docs/classes/Nord.html +44 -0
- package/docs/classes/NordUser.html +35 -0
- package/docs/classes/Subscriber.html +6 -0
- package/docs/enums/FillMode.html +5 -0
- package/docs/enums/KeyType.html +4 -0
- package/docs/enums/PeakTpsPeriodUnit.html +15 -0
- package/docs/enums/Side.html +3 -0
- package/docs/functions/assert.html +1 -0
- package/docs/functions/bigIntToProtoU128.html +4 -0
- package/docs/functions/checkPubKeyLength.html +1 -0
- package/docs/functions/checkedFetch.html +6 -0
- package/docs/functions/createWebSocketSubscription.html +12 -0
- package/docs/functions/decodeLengthDelimited.html +10 -0
- package/docs/functions/encodeLengthDelimited.html +6 -0
- package/docs/functions/fillModeToProtoFillMode.html +5 -0
- package/docs/functions/findMarket.html +1 -0
- package/docs/functions/findToken.html +1 -0
- package/docs/functions/makeWalletSignFn.html +6 -0
- package/docs/functions/optExpect.html +5 -0
- package/docs/functions/optMap.html +5 -0
- package/docs/functions/optUnwrap.html +2 -0
- package/docs/functions/panic.html +1 -0
- package/docs/functions/signAction.html +6 -0
- package/docs/functions/toScaledU128.html +8 -0
- package/docs/functions/toScaledU64.html +8 -0
- package/docs/index.html +21 -0
- package/docs/interfaces/Account.html +8 -0
- package/docs/interfaces/ActionInfo.html +8 -0
- package/docs/interfaces/ActionQuery.html +4 -0
- package/docs/interfaces/ActionResponse.html +8 -0
- package/docs/interfaces/ActionsExtendedInfo.html +10 -0
- package/docs/interfaces/ActionsQuery.html +5 -0
- package/docs/interfaces/ActionsResponse.html +6 -0
- package/docs/interfaces/AggregateMetrics.html +12 -0
- package/docs/interfaces/BlockQuery.html +6 -0
- package/docs/interfaces/BlockResponse.html +6 -0
- package/docs/interfaces/BlockSummary.html +8 -0
- package/docs/interfaces/BlockSummaryResponse.html +6 -0
- package/docs/interfaces/DeltaEvent.html +6 -0
- package/docs/interfaces/ERC20TokenInfo.html +5 -0
- package/docs/interfaces/Info.html +3 -0
- package/docs/interfaces/Market.html +6 -0
- package/docs/interfaces/MarketStats.html +7 -0
- package/docs/interfaces/MarketsStatsResponse.html +2 -0
- package/docs/interfaces/NordConfig.html +5 -0
- package/docs/interfaces/Order.html +6 -0
- package/docs/interfaces/OrderInfo.html +6 -0
- package/docs/interfaces/OrderbookOrder.html +6 -0
- package/docs/interfaces/OrderbookResponse.html +10 -0
- package/docs/interfaces/PerpMarketStats.html +5 -0
- package/docs/interfaces/RollmanActionExtendedInfo.html +4 -0
- package/docs/interfaces/RollmanActionInfo.html +4 -0
- package/docs/interfaces/RollmanActionResponse.html +4 -0
- package/docs/interfaces/RollmanActionsResponse.html +2 -0
- package/docs/interfaces/RollmanBlockResponse.html +3 -0
- package/docs/interfaces/SubscriberConfig.html +3 -0
- package/docs/interfaces/Token.html +5 -0
- package/docs/interfaces/Trade.html +5 -0
- package/docs/interfaces/TradeInfo.html +20 -0
- package/docs/interfaces/Trades.html +5 -0
- package/docs/interfaces/TradesQueryParams.html +10 -0
- package/docs/interfaces/TradesResponse.html +12 -0
- package/docs/modules.html +77 -0
- package/docs/types/BigIntValue.html +2 -0
- package/docs/variables/DEBUG_KEYS.html +1 -0
- package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -0
- package/docs/variables/DEV_CONTRACT_ADDRESS.html +1 -0
- package/docs/variables/DEV_TOKEN_INFOS.html +1 -0
- package/docs/variables/DEV_URL.html +1 -0
- package/docs/variables/ERC20_ABI.html +1 -0
- package/docs/variables/EVM_DEV_URL.html +1 -0
- package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +1 -0
- package/docs/variables/MAX_BUFFER_LEN.html +1 -0
- package/docs/variables/NORD_GETTERS_FACET_ABI.html +1 -0
- package/docs/variables/NORD_RAMP_FACET_ABI.html +1 -0
- package/docs/variables/SESSION_TTL.html +1 -0
- package/docs/variables/WEBSERVER_DEV_URL.html +1 -0
- package/docs/variables/ZERO_DECIMAL.html +1 -0
- package/jest.config.ts +9 -0
- package/nodemon.json +4 -0
- package/package.json +61 -0
- package/protoc-generate.sh +23 -0
- package/src/abis/ERC20_ABI.ts +310 -0
- package/src/abis/NORD_GETTERS_FACET_ABI.ts +192 -0
- package/src/abis/NORD_RAMP_FACET_ABI.ts +141 -0
- package/src/abis/index.ts +3 -0
- package/src/const.ts +39 -0
- package/src/gen/common.ts +280 -0
- package/src/gen/nord.ts +5666 -0
- package/src/index.ts +5 -0
- package/src/nord/Nord.ts +504 -0
- package/src/nord/NordImpl.ts +8 -0
- package/src/nord/NordUser.ts +469 -0
- package/src/nord/actions.ts +484 -0
- package/src/nord/index.ts +2 -0
- package/src/types.ts +393 -0
- package/src/utils.ts +300 -0
- package/tests/utils.spec.ts +154 -0
- package/tsconfig.json +24 -0
package/dist/gen/nord.js
ADDED
|
@@ -0,0 +1,4784 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.2.0
|
|
5
|
+
// protoc v5.28.3
|
|
6
|
+
// source: nord.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Receipt_TriggerRemoved = exports.Receipt_TriggerAdded = exports.Receipt_Transferred = exports.Receipt_Unpaused = exports.Receipt_Paused = exports.Receipt_SessionRevoked = exports.Receipt_Liquidated = exports.Receipt_UpdateGuardianSetResult = exports.Receipt_OracleUpdateResult = exports.Receipt_OracleSymbolFeedResult = exports.Receipt_WithdrawResult = exports.Receipt_InsertMarketResult = exports.Receipt_InsertTokenResult = exports.Receipt_DepositResult = exports.Receipt_CancelOrderResult = exports.Receipt_PlaceOrderResult = exports.Receipt_CreateSessionResult = exports.Receipt_Trade = exports.Receipt_Posted = exports.Receipt = exports.Action_RemoveTrigger = exports.Action_AddTrigger = exports.Action_Transfer = exports.Action_Unpause = exports.Action_Pause = exports.Action_RevokeSession = exports.Action_Liquidate = exports.Action_PythPriceFeedUpdate = exports.Action_PythSetSymbolFeed = exports.Action_PythSetWormholeGuardians = exports.Action_Withdraw = exports.Action_Deposit = exports.Action_CancelOrderById = exports.Action_PlaceOrder = exports.Action_CreateMarket = exports.Action_CreateToken = exports.Action_CreateSession = exports.Action = exports.Token = exports.Market = exports.U128 = exports.Error = exports.MarketType = exports.FillMode = exports.TriggerKind = exports.Side = exports.protobufPackage = void 0;
|
|
9
|
+
exports.sideFromJSON = sideFromJSON;
|
|
10
|
+
exports.sideToJSON = sideToJSON;
|
|
11
|
+
exports.triggerKindFromJSON = triggerKindFromJSON;
|
|
12
|
+
exports.triggerKindToJSON = triggerKindToJSON;
|
|
13
|
+
exports.fillModeFromJSON = fillModeFromJSON;
|
|
14
|
+
exports.fillModeToJSON = fillModeToJSON;
|
|
15
|
+
exports.marketTypeFromJSON = marketTypeFromJSON;
|
|
16
|
+
exports.marketTypeToJSON = marketTypeToJSON;
|
|
17
|
+
exports.errorFromJSON = errorFromJSON;
|
|
18
|
+
exports.errorToJSON = errorToJSON;
|
|
19
|
+
/* eslint-disable */
|
|
20
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
21
|
+
const common_1 = require("./common");
|
|
22
|
+
exports.protobufPackage = "nord";
|
|
23
|
+
var Side;
|
|
24
|
+
(function (Side) {
|
|
25
|
+
Side[Side["ASK"] = 0] = "ASK";
|
|
26
|
+
Side[Side["BID"] = 1] = "BID";
|
|
27
|
+
})(Side || (exports.Side = Side = {}));
|
|
28
|
+
function sideFromJSON(object) {
|
|
29
|
+
switch (object) {
|
|
30
|
+
case 0:
|
|
31
|
+
case "ASK":
|
|
32
|
+
return Side.ASK;
|
|
33
|
+
case 1:
|
|
34
|
+
case "BID":
|
|
35
|
+
return Side.BID;
|
|
36
|
+
default:
|
|
37
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum Side");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function sideToJSON(object) {
|
|
41
|
+
switch (object) {
|
|
42
|
+
case Side.ASK:
|
|
43
|
+
return "ASK";
|
|
44
|
+
case Side.BID:
|
|
45
|
+
return "BID";
|
|
46
|
+
default:
|
|
47
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum Side");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var TriggerKind;
|
|
51
|
+
(function (TriggerKind) {
|
|
52
|
+
TriggerKind[TriggerKind["STOP_LOSS"] = 0] = "STOP_LOSS";
|
|
53
|
+
TriggerKind[TriggerKind["TAKE_PROFIT"] = 1] = "TAKE_PROFIT";
|
|
54
|
+
})(TriggerKind || (exports.TriggerKind = TriggerKind = {}));
|
|
55
|
+
function triggerKindFromJSON(object) {
|
|
56
|
+
switch (object) {
|
|
57
|
+
case 0:
|
|
58
|
+
case "STOP_LOSS":
|
|
59
|
+
return TriggerKind.STOP_LOSS;
|
|
60
|
+
case 1:
|
|
61
|
+
case "TAKE_PROFIT":
|
|
62
|
+
return TriggerKind.TAKE_PROFIT;
|
|
63
|
+
default:
|
|
64
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TriggerKind");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function triggerKindToJSON(object) {
|
|
68
|
+
switch (object) {
|
|
69
|
+
case TriggerKind.STOP_LOSS:
|
|
70
|
+
return "STOP_LOSS";
|
|
71
|
+
case TriggerKind.TAKE_PROFIT:
|
|
72
|
+
return "TAKE_PROFIT";
|
|
73
|
+
default:
|
|
74
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TriggerKind");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
var FillMode;
|
|
78
|
+
(function (FillMode) {
|
|
79
|
+
FillMode[FillMode["LIMIT"] = 0] = "LIMIT";
|
|
80
|
+
FillMode[FillMode["POST_ONLY"] = 1] = "POST_ONLY";
|
|
81
|
+
FillMode[FillMode["IMMEDIATE_OR_CANCEL"] = 2] = "IMMEDIATE_OR_CANCEL";
|
|
82
|
+
FillMode[FillMode["FILL_OR_KILL"] = 3] = "FILL_OR_KILL";
|
|
83
|
+
})(FillMode || (exports.FillMode = FillMode = {}));
|
|
84
|
+
function fillModeFromJSON(object) {
|
|
85
|
+
switch (object) {
|
|
86
|
+
case 0:
|
|
87
|
+
case "LIMIT":
|
|
88
|
+
return FillMode.LIMIT;
|
|
89
|
+
case 1:
|
|
90
|
+
case "POST_ONLY":
|
|
91
|
+
return FillMode.POST_ONLY;
|
|
92
|
+
case 2:
|
|
93
|
+
case "IMMEDIATE_OR_CANCEL":
|
|
94
|
+
return FillMode.IMMEDIATE_OR_CANCEL;
|
|
95
|
+
case 3:
|
|
96
|
+
case "FILL_OR_KILL":
|
|
97
|
+
return FillMode.FILL_OR_KILL;
|
|
98
|
+
default:
|
|
99
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum FillMode");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function fillModeToJSON(object) {
|
|
103
|
+
switch (object) {
|
|
104
|
+
case FillMode.LIMIT:
|
|
105
|
+
return "LIMIT";
|
|
106
|
+
case FillMode.POST_ONLY:
|
|
107
|
+
return "POST_ONLY";
|
|
108
|
+
case FillMode.IMMEDIATE_OR_CANCEL:
|
|
109
|
+
return "IMMEDIATE_OR_CANCEL";
|
|
110
|
+
case FillMode.FILL_OR_KILL:
|
|
111
|
+
return "FILL_OR_KILL";
|
|
112
|
+
default:
|
|
113
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum FillMode");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
var MarketType;
|
|
117
|
+
(function (MarketType) {
|
|
118
|
+
MarketType[MarketType["SPOT"] = 0] = "SPOT";
|
|
119
|
+
MarketType[MarketType["PERPETUALS"] = 1] = "PERPETUALS";
|
|
120
|
+
})(MarketType || (exports.MarketType = MarketType = {}));
|
|
121
|
+
function marketTypeFromJSON(object) {
|
|
122
|
+
switch (object) {
|
|
123
|
+
case 0:
|
|
124
|
+
case "SPOT":
|
|
125
|
+
return MarketType.SPOT;
|
|
126
|
+
case 1:
|
|
127
|
+
case "PERPETUALS":
|
|
128
|
+
return MarketType.PERPETUALS;
|
|
129
|
+
default:
|
|
130
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum MarketType");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function marketTypeToJSON(object) {
|
|
134
|
+
switch (object) {
|
|
135
|
+
case MarketType.SPOT:
|
|
136
|
+
return "SPOT";
|
|
137
|
+
case MarketType.PERPETUALS:
|
|
138
|
+
return "PERPETUALS";
|
|
139
|
+
default:
|
|
140
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum MarketType");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Error codes returned by the engine.
|
|
145
|
+
* Some errors has 5bit prefix about error source and 3 bit suffix specifier.
|
|
146
|
+
* Error source prefix indicates were too look into to fix error.
|
|
147
|
+
* For example if order has bad input, it would be order relevant prefix.
|
|
148
|
+
* But if order cannot apply results to balance, it would be balance relevant
|
|
149
|
+
* prefix.
|
|
150
|
+
*/
|
|
151
|
+
var Error;
|
|
152
|
+
(function (Error) {
|
|
153
|
+
Error[Error["DUPLICATE"] = 0] = "DUPLICATE";
|
|
154
|
+
Error[Error["TIMESTAMP_STALE"] = 1] = "TIMESTAMP_STALE";
|
|
155
|
+
Error[Error["DECODE_FAILURE"] = 2] = "DECODE_FAILURE";
|
|
156
|
+
Error[Error["INVALID_SIGNATURE"] = 3] = "INVALID_SIGNATURE";
|
|
157
|
+
Error[Error["MARKET_NOT_FOUND"] = 4] = "MARKET_NOT_FOUND";
|
|
158
|
+
Error[Error["TOKEN_NOT_FOUND"] = 5] = "TOKEN_NOT_FOUND";
|
|
159
|
+
Error[Error["USER_NOT_FOUND"] = 6] = "USER_NOT_FOUND";
|
|
160
|
+
Error[Error["SESSION_NOT_FOUND"] = 7] = "SESSION_NOT_FOUND";
|
|
161
|
+
Error[Error["ORDER_NOT_FOUND"] = 8] = "ORDER_NOT_FOUND";
|
|
162
|
+
Error[Error["ORDER_SIZE_ZERO"] = 9] = "ORDER_SIZE_ZERO";
|
|
163
|
+
Error[Error["ARITHMETIC_OVERFLOW"] = 11] = "ARITHMETIC_OVERFLOW";
|
|
164
|
+
Error[Error["RISK_TOO_HIGH"] = 12] = "RISK_TOO_HIGH";
|
|
165
|
+
Error[Error["INVALID_ORDER_OWNER"] = 14] = "INVALID_ORDER_OWNER";
|
|
166
|
+
Error[Error["KEY_ALREADY_REGISTERED"] = 15] = "KEY_ALREADY_REGISTERED";
|
|
167
|
+
Error[Error["EXPIRY_TIMESTAMP_IN_PAST"] = 16] = "EXPIRY_TIMESTAMP_IN_PAST";
|
|
168
|
+
Error[Error["UPDATE_TIMESTAMP_IN_PAST"] = 17] = "UPDATE_TIMESTAMP_IN_PAST";
|
|
169
|
+
Error[Error["TOO_MANY_OPEN_ORDERS"] = 18] = "TOO_MANY_OPEN_ORDERS";
|
|
170
|
+
Error[Error["INVALID_ACTION_NONCE"] = 20] = "INVALID_ACTION_NONCE";
|
|
171
|
+
Error[Error["WITHDRAW_AMOUNT_TOO_SMALL"] = 21] = "WITHDRAW_AMOUNT_TOO_SMALL";
|
|
172
|
+
Error[Error["PYTH_FEED_NOT_ADDED"] = 93] = "PYTH_FEED_NOT_ADDED";
|
|
173
|
+
Error[Error["PYTH_FEED_MISSING"] = 94] = "PYTH_FEED_MISSING";
|
|
174
|
+
Error[Error["PYTH_FEED_ALREADY_ADDED"] = 95] = "PYTH_FEED_ALREADY_ADDED";
|
|
175
|
+
Error[Error["PYTH_GUARDIAN_SET_UNINITIALIZED"] = 96] = "PYTH_GUARDIAN_SET_UNINITIALIZED";
|
|
176
|
+
Error[Error["PYTH_GUARDIAN_SET_INVALID"] = 97] = "PYTH_GUARDIAN_SET_INVALID";
|
|
177
|
+
/** UNINITIALIZED_PRICES - TODO(deprecate) */
|
|
178
|
+
Error[Error["UNINITIALIZED_PRICES"] = 98] = "UNINITIALIZED_PRICES";
|
|
179
|
+
Error[Error["PYTH_FEED_PRICE_OUT_OF_RANGE"] = 99] = "PYTH_FEED_PRICE_OUT_OF_RANGE";
|
|
180
|
+
Error[Error["INVALID_TOKEN_PARAMETERS"] = 100] = "INVALID_TOKEN_PARAMETERS";
|
|
181
|
+
Error[Error["INDEX_PRICE_OUT_OF_RANGE"] = 103] = "INDEX_PRICE_OUT_OF_RANGE";
|
|
182
|
+
Error[Error["INDEX_DECIMALS_OUT_OF_RANGE"] = 104] = "INDEX_DECIMALS_OUT_OF_RANGE";
|
|
183
|
+
Error[Error["INVALID_STATE_VERSION"] = 105] = "INVALID_STATE_VERSION";
|
|
184
|
+
Error[Error["POSITION_STATE_IS_WRONG_FOR_ORDER"] = 106] = "POSITION_STATE_IS_WRONG_FOR_ORDER";
|
|
185
|
+
Error[Error["INVALID_MARGINS"] = 107] = "INVALID_MARGINS";
|
|
186
|
+
/** ACTION_CANNOT_BE_DELEGATED - means that user cannot execute proposed action on behalf of different user */
|
|
187
|
+
Error[Error["ACTION_CANNOT_BE_DELEGATED"] = 108] = "ACTION_CANNOT_BE_DELEGATED";
|
|
188
|
+
/**
|
|
189
|
+
* MARKET_DECIMALS_EXCEED_LIMITS - Market's decimal parameters exceed either "quote limit" or "base limit"
|
|
190
|
+
* Two mentioned limits were deduced empirically and ensure
|
|
191
|
+
* that certain overflow errors don't happen when value rescaling is performed
|
|
192
|
+
* during order placement.
|
|
193
|
+
*
|
|
194
|
+
* For both perpetuals and spot markets,
|
|
195
|
+
* `quote_token.decimals - market.size_decimals - market.price_decimals` must
|
|
196
|
+
* be within range `[-19; 4]` For spot market, `base_token.decimals -
|
|
197
|
+
* market.size_decimals` must be within range `[-19; 23]`
|
|
198
|
+
*/
|
|
199
|
+
Error[Error["MARKET_DECIMALS_EXCEED_LIMITS"] = 109] = "MARKET_DECIMALS_EXCEED_LIMITS";
|
|
200
|
+
Error[Error["TOO_MANY_TOKENS"] = 110] = "TOO_MANY_TOKENS";
|
|
201
|
+
Error[Error["BANKRUPTCY"] = 111] = "BANKRUPTCY";
|
|
202
|
+
/** TOKEN_ALREADY_REGISTERED - Token with specified blockchain address already registered */
|
|
203
|
+
Error[Error["TOKEN_ALREADY_REGISTERED"] = 112] = "TOKEN_ALREADY_REGISTERED";
|
|
204
|
+
Error[Error["FUNDING_OVERFLOW"] = 123] = "FUNDING_OVERFLOW";
|
|
205
|
+
/**
|
|
206
|
+
* CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED - If there is order to cancel for position, it should be canceled first
|
|
207
|
+
* before reducing position
|
|
208
|
+
*/
|
|
209
|
+
Error[Error["CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED"] = 124] = "CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED";
|
|
210
|
+
Error[Error["PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH"] = 126] = "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH";
|
|
211
|
+
/** UNEXPECTED_TOKEN_ID - Token was found, but not expected to be used in action context */
|
|
212
|
+
Error[Error["UNEXPECTED_TOKEN_ID"] = 127] = "UNEXPECTED_TOKEN_ID";
|
|
213
|
+
Error[Error["SIGNATURE_VERIFICATION"] = 128] = "SIGNATURE_VERIFICATION";
|
|
214
|
+
/** MARKET_NOT_READY - Happens when market is not read to handle orders */
|
|
215
|
+
Error[Error["MARKET_NOT_READY"] = 129] = "MARKET_NOT_READY";
|
|
216
|
+
/**
|
|
217
|
+
* TOKEN_NOT_READY - happens in some situation when token misses some relevant information
|
|
218
|
+
* needed for operation
|
|
219
|
+
*/
|
|
220
|
+
Error[Error["TOKEN_NOT_READY"] = 130] = "TOKEN_NOT_READY";
|
|
221
|
+
Error[Error["OMF_LESS_THAN_OR_EQUAL_IMF"] = 131] = "OMF_LESS_THAN_OR_EQUAL_IMF";
|
|
222
|
+
Error[Error["ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE"] = 132] = "ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE";
|
|
223
|
+
Error[Error["IMMEDIATE_ORDER_GOT_NO_FILLS"] = 133] = "IMMEDIATE_ORDER_GOT_NO_FILLS";
|
|
224
|
+
/** FAILED_TO_FILL_LIMIT - In case there's no price, error if failed to fill at least one of limits */
|
|
225
|
+
Error[Error["FAILED_TO_FILL_LIMIT"] = 134] = "FAILED_TO_FILL_LIMIT";
|
|
226
|
+
Error[Error["POST_ONLY_MUST_NOT_FILL_ANY_OPPOSITE_ORDERS"] = 135] = "POST_ONLY_MUST_NOT_FILL_ANY_OPPOSITE_ORDERS";
|
|
227
|
+
Error[Error["INVALID"] = 136] = "INVALID";
|
|
228
|
+
Error[Error["MAINTENANCE"] = 137] = "MAINTENANCE";
|
|
229
|
+
Error[Error["MINIMUM_SIZE_DECIMALS"] = 138] = "MINIMUM_SIZE_DECIMALS";
|
|
230
|
+
Error[Error["PARAMETERS_WILL_CREATE_NON_OPERATIONAL_MARKET"] = 139] = "PARAMETERS_WILL_CREATE_NON_OPERATIONAL_MARKET";
|
|
231
|
+
Error[Error["ONLY_IMMEDIATE_ORDERS_ALLOWED"] = 140] = "ONLY_IMMEDIATE_ORDERS_ALLOWED";
|
|
232
|
+
Error[Error["TOO_MANY_USER_ACCOUNTS"] = 141] = "TOO_MANY_USER_ACCOUNTS";
|
|
233
|
+
/** ACCOUNT_NOT_FOUND - There's no such account with specified id, */
|
|
234
|
+
Error[Error["ACCOUNT_NOT_FOUND"] = 142] = "ACCOUNT_NOT_FOUND";
|
|
235
|
+
/** ACCOUNT_INVALID_OWNER - Account doesn't belong to user designated by public key or session id */
|
|
236
|
+
Error[Error["ACCOUNT_INVALID_OWNER"] = 143] = "ACCOUNT_INVALID_OWNER";
|
|
237
|
+
/**
|
|
238
|
+
* DUST_ACCOUNT - Operation cannot be made on account because to small amount will be
|
|
239
|
+
* retained on account
|
|
240
|
+
*/
|
|
241
|
+
Error[Error["DUST_ACCOUNT"] = 145] = "DUST_ACCOUNT";
|
|
242
|
+
/** ORDER_EXECUTION - 10011_000 - 3 bit suffix */
|
|
243
|
+
Error[Error["ORDER_EXECUTION"] = 152] = "ORDER_EXECUTION";
|
|
244
|
+
/** ORDER_EXECUTION_EMPTY - 10011_001; */
|
|
245
|
+
Error[Error["ORDER_EXECUTION_EMPTY"] = 153] = "ORDER_EXECUTION_EMPTY";
|
|
246
|
+
/** ORDER_EXECUTION_FILL_OR_KILL - 10011_010; */
|
|
247
|
+
Error[Error["ORDER_EXECUTION_FILL_OR_KILL"] = 154] = "ORDER_EXECUTION_FILL_OR_KILL";
|
|
248
|
+
/**
|
|
249
|
+
* ORDER_EXECUTION_MISSING_LIMITS - Order requires some of its limits specified according to fill mode
|
|
250
|
+
* 10011_011;
|
|
251
|
+
*/
|
|
252
|
+
Error[Error["ORDER_EXECUTION_MISSING_LIMITS"] = 155] = "ORDER_EXECUTION_MISSING_LIMITS";
|
|
253
|
+
/** ORDER_EXECUTION_MISSING_PRICE - 10011_100; */
|
|
254
|
+
Error[Error["ORDER_EXECUTION_MISSING_PRICE"] = 156] = "ORDER_EXECUTION_MISSING_PRICE";
|
|
255
|
+
/** ORDER_EXECUTION_SIZE_LIMIT - 10011_101; */
|
|
256
|
+
Error[Error["ORDER_EXECUTION_SIZE_LIMIT"] = 157] = "ORDER_EXECUTION_SIZE_LIMIT";
|
|
257
|
+
/** BALANCE - 10100_000 */
|
|
258
|
+
Error[Error["BALANCE"] = 160] = "BALANCE";
|
|
259
|
+
/** BALANCE_DEPOSIT_OVERFLOW - 10100_001 */
|
|
260
|
+
Error[Error["BALANCE_DEPOSIT_OVERFLOW"] = 161] = "BALANCE_DEPOSIT_OVERFLOW";
|
|
261
|
+
/** BALANCE_CHANGE_OVERFLOW - 10100_010 */
|
|
262
|
+
Error[Error["BALANCE_CHANGE_OVERFLOW"] = 162] = "BALANCE_CHANGE_OVERFLOW";
|
|
263
|
+
/** BALANCE_CHANGE_LIMIT_EXCEEDED - 10100_011 */
|
|
264
|
+
Error[Error["BALANCE_CHANGE_LIMIT_EXCEEDED"] = 163] = "BALANCE_CHANGE_LIMIT_EXCEEDED";
|
|
265
|
+
/**
|
|
266
|
+
* BALANCE_INSUFFICIENT - Happens when account balances has no sufficient token amount to perform
|
|
267
|
+
* action.
|
|
268
|
+
* 10100_100
|
|
269
|
+
*/
|
|
270
|
+
Error[Error["BALANCE_INSUFFICIENT"] = 164] = "BALANCE_INSUFFICIENT";
|
|
271
|
+
/**
|
|
272
|
+
* UNAUTHENTICATED_L1_ACTION - Happens when an action is meant to come from the settlement contract,
|
|
273
|
+
* but is not authenticated, instead coming from the user channels.
|
|
274
|
+
*/
|
|
275
|
+
Error[Error["UNAUTHENTICATED_L1_ACTION"] = 165] = "UNAUTHENTICATED_L1_ACTION";
|
|
276
|
+
/**
|
|
277
|
+
* ENCODED_ACTION_TOO_LARGE - Happens when an encoded action is too large. This is to mitigate dos
|
|
278
|
+
* attacks due to excessive padding.
|
|
279
|
+
*/
|
|
280
|
+
Error[Error["ENCODED_ACTION_TOO_LARGE"] = 166] = "ENCODED_ACTION_TOO_LARGE";
|
|
281
|
+
/** TRIGGER - 10101_000 */
|
|
282
|
+
Error[Error["TRIGGER"] = 168] = "TRIGGER";
|
|
283
|
+
/**
|
|
284
|
+
* TRIGGER_INVALID_PRICE - Happens when:
|
|
285
|
+
* * Trigger price is "less or equal" to its corresponding pair trigger price
|
|
286
|
+
* * Trigger rice is "less" than market's current index price
|
|
287
|
+
*
|
|
288
|
+
* Binary pattern: 10101_001
|
|
289
|
+
*/
|
|
290
|
+
Error[Error["TRIGGER_INVALID_PRICE"] = 169] = "TRIGGER_INVALID_PRICE";
|
|
291
|
+
Error[Error["Dropped"] = 999] = "Dropped";
|
|
292
|
+
})(Error || (exports.Error = Error = {}));
|
|
293
|
+
function errorFromJSON(object) {
|
|
294
|
+
switch (object) {
|
|
295
|
+
case 0:
|
|
296
|
+
case "DUPLICATE":
|
|
297
|
+
return Error.DUPLICATE;
|
|
298
|
+
case 1:
|
|
299
|
+
case "TIMESTAMP_STALE":
|
|
300
|
+
return Error.TIMESTAMP_STALE;
|
|
301
|
+
case 2:
|
|
302
|
+
case "DECODE_FAILURE":
|
|
303
|
+
return Error.DECODE_FAILURE;
|
|
304
|
+
case 3:
|
|
305
|
+
case "INVALID_SIGNATURE":
|
|
306
|
+
return Error.INVALID_SIGNATURE;
|
|
307
|
+
case 4:
|
|
308
|
+
case "MARKET_NOT_FOUND":
|
|
309
|
+
return Error.MARKET_NOT_FOUND;
|
|
310
|
+
case 5:
|
|
311
|
+
case "TOKEN_NOT_FOUND":
|
|
312
|
+
return Error.TOKEN_NOT_FOUND;
|
|
313
|
+
case 6:
|
|
314
|
+
case "USER_NOT_FOUND":
|
|
315
|
+
return Error.USER_NOT_FOUND;
|
|
316
|
+
case 7:
|
|
317
|
+
case "SESSION_NOT_FOUND":
|
|
318
|
+
return Error.SESSION_NOT_FOUND;
|
|
319
|
+
case 8:
|
|
320
|
+
case "ORDER_NOT_FOUND":
|
|
321
|
+
return Error.ORDER_NOT_FOUND;
|
|
322
|
+
case 9:
|
|
323
|
+
case "ORDER_SIZE_ZERO":
|
|
324
|
+
return Error.ORDER_SIZE_ZERO;
|
|
325
|
+
case 11:
|
|
326
|
+
case "ARITHMETIC_OVERFLOW":
|
|
327
|
+
return Error.ARITHMETIC_OVERFLOW;
|
|
328
|
+
case 12:
|
|
329
|
+
case "RISK_TOO_HIGH":
|
|
330
|
+
return Error.RISK_TOO_HIGH;
|
|
331
|
+
case 14:
|
|
332
|
+
case "INVALID_ORDER_OWNER":
|
|
333
|
+
return Error.INVALID_ORDER_OWNER;
|
|
334
|
+
case 15:
|
|
335
|
+
case "KEY_ALREADY_REGISTERED":
|
|
336
|
+
return Error.KEY_ALREADY_REGISTERED;
|
|
337
|
+
case 16:
|
|
338
|
+
case "EXPIRY_TIMESTAMP_IN_PAST":
|
|
339
|
+
return Error.EXPIRY_TIMESTAMP_IN_PAST;
|
|
340
|
+
case 17:
|
|
341
|
+
case "UPDATE_TIMESTAMP_IN_PAST":
|
|
342
|
+
return Error.UPDATE_TIMESTAMP_IN_PAST;
|
|
343
|
+
case 18:
|
|
344
|
+
case "TOO_MANY_OPEN_ORDERS":
|
|
345
|
+
return Error.TOO_MANY_OPEN_ORDERS;
|
|
346
|
+
case 20:
|
|
347
|
+
case "INVALID_ACTION_NONCE":
|
|
348
|
+
return Error.INVALID_ACTION_NONCE;
|
|
349
|
+
case 21:
|
|
350
|
+
case "WITHDRAW_AMOUNT_TOO_SMALL":
|
|
351
|
+
return Error.WITHDRAW_AMOUNT_TOO_SMALL;
|
|
352
|
+
case 93:
|
|
353
|
+
case "PYTH_FEED_NOT_ADDED":
|
|
354
|
+
return Error.PYTH_FEED_NOT_ADDED;
|
|
355
|
+
case 94:
|
|
356
|
+
case "PYTH_FEED_MISSING":
|
|
357
|
+
return Error.PYTH_FEED_MISSING;
|
|
358
|
+
case 95:
|
|
359
|
+
case "PYTH_FEED_ALREADY_ADDED":
|
|
360
|
+
return Error.PYTH_FEED_ALREADY_ADDED;
|
|
361
|
+
case 96:
|
|
362
|
+
case "PYTH_GUARDIAN_SET_UNINITIALIZED":
|
|
363
|
+
return Error.PYTH_GUARDIAN_SET_UNINITIALIZED;
|
|
364
|
+
case 97:
|
|
365
|
+
case "PYTH_GUARDIAN_SET_INVALID":
|
|
366
|
+
return Error.PYTH_GUARDIAN_SET_INVALID;
|
|
367
|
+
case 98:
|
|
368
|
+
case "UNINITIALIZED_PRICES":
|
|
369
|
+
return Error.UNINITIALIZED_PRICES;
|
|
370
|
+
case 99:
|
|
371
|
+
case "PYTH_FEED_PRICE_OUT_OF_RANGE":
|
|
372
|
+
return Error.PYTH_FEED_PRICE_OUT_OF_RANGE;
|
|
373
|
+
case 100:
|
|
374
|
+
case "INVALID_TOKEN_PARAMETERS":
|
|
375
|
+
return Error.INVALID_TOKEN_PARAMETERS;
|
|
376
|
+
case 103:
|
|
377
|
+
case "INDEX_PRICE_OUT_OF_RANGE":
|
|
378
|
+
return Error.INDEX_PRICE_OUT_OF_RANGE;
|
|
379
|
+
case 104:
|
|
380
|
+
case "INDEX_DECIMALS_OUT_OF_RANGE":
|
|
381
|
+
return Error.INDEX_DECIMALS_OUT_OF_RANGE;
|
|
382
|
+
case 105:
|
|
383
|
+
case "INVALID_STATE_VERSION":
|
|
384
|
+
return Error.INVALID_STATE_VERSION;
|
|
385
|
+
case 106:
|
|
386
|
+
case "POSITION_STATE_IS_WRONG_FOR_ORDER":
|
|
387
|
+
return Error.POSITION_STATE_IS_WRONG_FOR_ORDER;
|
|
388
|
+
case 107:
|
|
389
|
+
case "INVALID_MARGINS":
|
|
390
|
+
return Error.INVALID_MARGINS;
|
|
391
|
+
case 108:
|
|
392
|
+
case "ACTION_CANNOT_BE_DELEGATED":
|
|
393
|
+
return Error.ACTION_CANNOT_BE_DELEGATED;
|
|
394
|
+
case 109:
|
|
395
|
+
case "MARKET_DECIMALS_EXCEED_LIMITS":
|
|
396
|
+
return Error.MARKET_DECIMALS_EXCEED_LIMITS;
|
|
397
|
+
case 110:
|
|
398
|
+
case "TOO_MANY_TOKENS":
|
|
399
|
+
return Error.TOO_MANY_TOKENS;
|
|
400
|
+
case 111:
|
|
401
|
+
case "BANKRUPTCY":
|
|
402
|
+
return Error.BANKRUPTCY;
|
|
403
|
+
case 112:
|
|
404
|
+
case "TOKEN_ALREADY_REGISTERED":
|
|
405
|
+
return Error.TOKEN_ALREADY_REGISTERED;
|
|
406
|
+
case 123:
|
|
407
|
+
case "FUNDING_OVERFLOW":
|
|
408
|
+
return Error.FUNDING_OVERFLOW;
|
|
409
|
+
case 124:
|
|
410
|
+
case "CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED":
|
|
411
|
+
return Error.CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED;
|
|
412
|
+
case 126:
|
|
413
|
+
case "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH":
|
|
414
|
+
return Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH;
|
|
415
|
+
case 127:
|
|
416
|
+
case "UNEXPECTED_TOKEN_ID":
|
|
417
|
+
return Error.UNEXPECTED_TOKEN_ID;
|
|
418
|
+
case 128:
|
|
419
|
+
case "SIGNATURE_VERIFICATION":
|
|
420
|
+
return Error.SIGNATURE_VERIFICATION;
|
|
421
|
+
case 129:
|
|
422
|
+
case "MARKET_NOT_READY":
|
|
423
|
+
return Error.MARKET_NOT_READY;
|
|
424
|
+
case 130:
|
|
425
|
+
case "TOKEN_NOT_READY":
|
|
426
|
+
return Error.TOKEN_NOT_READY;
|
|
427
|
+
case 131:
|
|
428
|
+
case "OMF_LESS_THAN_OR_EQUAL_IMF":
|
|
429
|
+
return Error.OMF_LESS_THAN_OR_EQUAL_IMF;
|
|
430
|
+
case 132:
|
|
431
|
+
case "ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE":
|
|
432
|
+
return Error.ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE;
|
|
433
|
+
case 133:
|
|
434
|
+
case "IMMEDIATE_ORDER_GOT_NO_FILLS":
|
|
435
|
+
return Error.IMMEDIATE_ORDER_GOT_NO_FILLS;
|
|
436
|
+
case 134:
|
|
437
|
+
case "FAILED_TO_FILL_LIMIT":
|
|
438
|
+
return Error.FAILED_TO_FILL_LIMIT;
|
|
439
|
+
case 135:
|
|
440
|
+
case "POST_ONLY_MUST_NOT_FILL_ANY_OPPOSITE_ORDERS":
|
|
441
|
+
return Error.POST_ONLY_MUST_NOT_FILL_ANY_OPPOSITE_ORDERS;
|
|
442
|
+
case 136:
|
|
443
|
+
case "INVALID":
|
|
444
|
+
return Error.INVALID;
|
|
445
|
+
case 137:
|
|
446
|
+
case "MAINTENANCE":
|
|
447
|
+
return Error.MAINTENANCE;
|
|
448
|
+
case 138:
|
|
449
|
+
case "MINIMUM_SIZE_DECIMALS":
|
|
450
|
+
return Error.MINIMUM_SIZE_DECIMALS;
|
|
451
|
+
case 139:
|
|
452
|
+
case "PARAMETERS_WILL_CREATE_NON_OPERATIONAL_MARKET":
|
|
453
|
+
return Error.PARAMETERS_WILL_CREATE_NON_OPERATIONAL_MARKET;
|
|
454
|
+
case 140:
|
|
455
|
+
case "ONLY_IMMEDIATE_ORDERS_ALLOWED":
|
|
456
|
+
return Error.ONLY_IMMEDIATE_ORDERS_ALLOWED;
|
|
457
|
+
case 141:
|
|
458
|
+
case "TOO_MANY_USER_ACCOUNTS":
|
|
459
|
+
return Error.TOO_MANY_USER_ACCOUNTS;
|
|
460
|
+
case 142:
|
|
461
|
+
case "ACCOUNT_NOT_FOUND":
|
|
462
|
+
return Error.ACCOUNT_NOT_FOUND;
|
|
463
|
+
case 143:
|
|
464
|
+
case "ACCOUNT_INVALID_OWNER":
|
|
465
|
+
return Error.ACCOUNT_INVALID_OWNER;
|
|
466
|
+
case 145:
|
|
467
|
+
case "DUST_ACCOUNT":
|
|
468
|
+
return Error.DUST_ACCOUNT;
|
|
469
|
+
case 152:
|
|
470
|
+
case "ORDER_EXECUTION":
|
|
471
|
+
return Error.ORDER_EXECUTION;
|
|
472
|
+
case 153:
|
|
473
|
+
case "ORDER_EXECUTION_EMPTY":
|
|
474
|
+
return Error.ORDER_EXECUTION_EMPTY;
|
|
475
|
+
case 154:
|
|
476
|
+
case "ORDER_EXECUTION_FILL_OR_KILL":
|
|
477
|
+
return Error.ORDER_EXECUTION_FILL_OR_KILL;
|
|
478
|
+
case 155:
|
|
479
|
+
case "ORDER_EXECUTION_MISSING_LIMITS":
|
|
480
|
+
return Error.ORDER_EXECUTION_MISSING_LIMITS;
|
|
481
|
+
case 156:
|
|
482
|
+
case "ORDER_EXECUTION_MISSING_PRICE":
|
|
483
|
+
return Error.ORDER_EXECUTION_MISSING_PRICE;
|
|
484
|
+
case 157:
|
|
485
|
+
case "ORDER_EXECUTION_SIZE_LIMIT":
|
|
486
|
+
return Error.ORDER_EXECUTION_SIZE_LIMIT;
|
|
487
|
+
case 160:
|
|
488
|
+
case "BALANCE":
|
|
489
|
+
return Error.BALANCE;
|
|
490
|
+
case 161:
|
|
491
|
+
case "BALANCE_DEPOSIT_OVERFLOW":
|
|
492
|
+
return Error.BALANCE_DEPOSIT_OVERFLOW;
|
|
493
|
+
case 162:
|
|
494
|
+
case "BALANCE_CHANGE_OVERFLOW":
|
|
495
|
+
return Error.BALANCE_CHANGE_OVERFLOW;
|
|
496
|
+
case 163:
|
|
497
|
+
case "BALANCE_CHANGE_LIMIT_EXCEEDED":
|
|
498
|
+
return Error.BALANCE_CHANGE_LIMIT_EXCEEDED;
|
|
499
|
+
case 164:
|
|
500
|
+
case "BALANCE_INSUFFICIENT":
|
|
501
|
+
return Error.BALANCE_INSUFFICIENT;
|
|
502
|
+
case 165:
|
|
503
|
+
case "UNAUTHENTICATED_L1_ACTION":
|
|
504
|
+
return Error.UNAUTHENTICATED_L1_ACTION;
|
|
505
|
+
case 166:
|
|
506
|
+
case "ENCODED_ACTION_TOO_LARGE":
|
|
507
|
+
return Error.ENCODED_ACTION_TOO_LARGE;
|
|
508
|
+
case 168:
|
|
509
|
+
case "TRIGGER":
|
|
510
|
+
return Error.TRIGGER;
|
|
511
|
+
case 169:
|
|
512
|
+
case "TRIGGER_INVALID_PRICE":
|
|
513
|
+
return Error.TRIGGER_INVALID_PRICE;
|
|
514
|
+
case 999:
|
|
515
|
+
case "Dropped":
|
|
516
|
+
return Error.Dropped;
|
|
517
|
+
default:
|
|
518
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum Error");
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
function errorToJSON(object) {
|
|
522
|
+
switch (object) {
|
|
523
|
+
case Error.DUPLICATE:
|
|
524
|
+
return "DUPLICATE";
|
|
525
|
+
case Error.TIMESTAMP_STALE:
|
|
526
|
+
return "TIMESTAMP_STALE";
|
|
527
|
+
case Error.DECODE_FAILURE:
|
|
528
|
+
return "DECODE_FAILURE";
|
|
529
|
+
case Error.INVALID_SIGNATURE:
|
|
530
|
+
return "INVALID_SIGNATURE";
|
|
531
|
+
case Error.MARKET_NOT_FOUND:
|
|
532
|
+
return "MARKET_NOT_FOUND";
|
|
533
|
+
case Error.TOKEN_NOT_FOUND:
|
|
534
|
+
return "TOKEN_NOT_FOUND";
|
|
535
|
+
case Error.USER_NOT_FOUND:
|
|
536
|
+
return "USER_NOT_FOUND";
|
|
537
|
+
case Error.SESSION_NOT_FOUND:
|
|
538
|
+
return "SESSION_NOT_FOUND";
|
|
539
|
+
case Error.ORDER_NOT_FOUND:
|
|
540
|
+
return "ORDER_NOT_FOUND";
|
|
541
|
+
case Error.ORDER_SIZE_ZERO:
|
|
542
|
+
return "ORDER_SIZE_ZERO";
|
|
543
|
+
case Error.ARITHMETIC_OVERFLOW:
|
|
544
|
+
return "ARITHMETIC_OVERFLOW";
|
|
545
|
+
case Error.RISK_TOO_HIGH:
|
|
546
|
+
return "RISK_TOO_HIGH";
|
|
547
|
+
case Error.INVALID_ORDER_OWNER:
|
|
548
|
+
return "INVALID_ORDER_OWNER";
|
|
549
|
+
case Error.KEY_ALREADY_REGISTERED:
|
|
550
|
+
return "KEY_ALREADY_REGISTERED";
|
|
551
|
+
case Error.EXPIRY_TIMESTAMP_IN_PAST:
|
|
552
|
+
return "EXPIRY_TIMESTAMP_IN_PAST";
|
|
553
|
+
case Error.UPDATE_TIMESTAMP_IN_PAST:
|
|
554
|
+
return "UPDATE_TIMESTAMP_IN_PAST";
|
|
555
|
+
case Error.TOO_MANY_OPEN_ORDERS:
|
|
556
|
+
return "TOO_MANY_OPEN_ORDERS";
|
|
557
|
+
case Error.INVALID_ACTION_NONCE:
|
|
558
|
+
return "INVALID_ACTION_NONCE";
|
|
559
|
+
case Error.WITHDRAW_AMOUNT_TOO_SMALL:
|
|
560
|
+
return "WITHDRAW_AMOUNT_TOO_SMALL";
|
|
561
|
+
case Error.PYTH_FEED_NOT_ADDED:
|
|
562
|
+
return "PYTH_FEED_NOT_ADDED";
|
|
563
|
+
case Error.PYTH_FEED_MISSING:
|
|
564
|
+
return "PYTH_FEED_MISSING";
|
|
565
|
+
case Error.PYTH_FEED_ALREADY_ADDED:
|
|
566
|
+
return "PYTH_FEED_ALREADY_ADDED";
|
|
567
|
+
case Error.PYTH_GUARDIAN_SET_UNINITIALIZED:
|
|
568
|
+
return "PYTH_GUARDIAN_SET_UNINITIALIZED";
|
|
569
|
+
case Error.PYTH_GUARDIAN_SET_INVALID:
|
|
570
|
+
return "PYTH_GUARDIAN_SET_INVALID";
|
|
571
|
+
case Error.UNINITIALIZED_PRICES:
|
|
572
|
+
return "UNINITIALIZED_PRICES";
|
|
573
|
+
case Error.PYTH_FEED_PRICE_OUT_OF_RANGE:
|
|
574
|
+
return "PYTH_FEED_PRICE_OUT_OF_RANGE";
|
|
575
|
+
case Error.INVALID_TOKEN_PARAMETERS:
|
|
576
|
+
return "INVALID_TOKEN_PARAMETERS";
|
|
577
|
+
case Error.INDEX_PRICE_OUT_OF_RANGE:
|
|
578
|
+
return "INDEX_PRICE_OUT_OF_RANGE";
|
|
579
|
+
case Error.INDEX_DECIMALS_OUT_OF_RANGE:
|
|
580
|
+
return "INDEX_DECIMALS_OUT_OF_RANGE";
|
|
581
|
+
case Error.INVALID_STATE_VERSION:
|
|
582
|
+
return "INVALID_STATE_VERSION";
|
|
583
|
+
case Error.POSITION_STATE_IS_WRONG_FOR_ORDER:
|
|
584
|
+
return "POSITION_STATE_IS_WRONG_FOR_ORDER";
|
|
585
|
+
case Error.INVALID_MARGINS:
|
|
586
|
+
return "INVALID_MARGINS";
|
|
587
|
+
case Error.ACTION_CANNOT_BE_DELEGATED:
|
|
588
|
+
return "ACTION_CANNOT_BE_DELEGATED";
|
|
589
|
+
case Error.MARKET_DECIMALS_EXCEED_LIMITS:
|
|
590
|
+
return "MARKET_DECIMALS_EXCEED_LIMITS";
|
|
591
|
+
case Error.TOO_MANY_TOKENS:
|
|
592
|
+
return "TOO_MANY_TOKENS";
|
|
593
|
+
case Error.BANKRUPTCY:
|
|
594
|
+
return "BANKRUPTCY";
|
|
595
|
+
case Error.TOKEN_ALREADY_REGISTERED:
|
|
596
|
+
return "TOKEN_ALREADY_REGISTERED";
|
|
597
|
+
case Error.FUNDING_OVERFLOW:
|
|
598
|
+
return "FUNDING_OVERFLOW";
|
|
599
|
+
case Error.CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED:
|
|
600
|
+
return "CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED";
|
|
601
|
+
case Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH:
|
|
602
|
+
return "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH";
|
|
603
|
+
case Error.UNEXPECTED_TOKEN_ID:
|
|
604
|
+
return "UNEXPECTED_TOKEN_ID";
|
|
605
|
+
case Error.SIGNATURE_VERIFICATION:
|
|
606
|
+
return "SIGNATURE_VERIFICATION";
|
|
607
|
+
case Error.MARKET_NOT_READY:
|
|
608
|
+
return "MARKET_NOT_READY";
|
|
609
|
+
case Error.TOKEN_NOT_READY:
|
|
610
|
+
return "TOKEN_NOT_READY";
|
|
611
|
+
case Error.OMF_LESS_THAN_OR_EQUAL_IMF:
|
|
612
|
+
return "OMF_LESS_THAN_OR_EQUAL_IMF";
|
|
613
|
+
case Error.ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE:
|
|
614
|
+
return "ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE";
|
|
615
|
+
case Error.IMMEDIATE_ORDER_GOT_NO_FILLS:
|
|
616
|
+
return "IMMEDIATE_ORDER_GOT_NO_FILLS";
|
|
617
|
+
case Error.FAILED_TO_FILL_LIMIT:
|
|
618
|
+
return "FAILED_TO_FILL_LIMIT";
|
|
619
|
+
case Error.POST_ONLY_MUST_NOT_FILL_ANY_OPPOSITE_ORDERS:
|
|
620
|
+
return "POST_ONLY_MUST_NOT_FILL_ANY_OPPOSITE_ORDERS";
|
|
621
|
+
case Error.INVALID:
|
|
622
|
+
return "INVALID";
|
|
623
|
+
case Error.MAINTENANCE:
|
|
624
|
+
return "MAINTENANCE";
|
|
625
|
+
case Error.MINIMUM_SIZE_DECIMALS:
|
|
626
|
+
return "MINIMUM_SIZE_DECIMALS";
|
|
627
|
+
case Error.PARAMETERS_WILL_CREATE_NON_OPERATIONAL_MARKET:
|
|
628
|
+
return "PARAMETERS_WILL_CREATE_NON_OPERATIONAL_MARKET";
|
|
629
|
+
case Error.ONLY_IMMEDIATE_ORDERS_ALLOWED:
|
|
630
|
+
return "ONLY_IMMEDIATE_ORDERS_ALLOWED";
|
|
631
|
+
case Error.TOO_MANY_USER_ACCOUNTS:
|
|
632
|
+
return "TOO_MANY_USER_ACCOUNTS";
|
|
633
|
+
case Error.ACCOUNT_NOT_FOUND:
|
|
634
|
+
return "ACCOUNT_NOT_FOUND";
|
|
635
|
+
case Error.ACCOUNT_INVALID_OWNER:
|
|
636
|
+
return "ACCOUNT_INVALID_OWNER";
|
|
637
|
+
case Error.DUST_ACCOUNT:
|
|
638
|
+
return "DUST_ACCOUNT";
|
|
639
|
+
case Error.ORDER_EXECUTION:
|
|
640
|
+
return "ORDER_EXECUTION";
|
|
641
|
+
case Error.ORDER_EXECUTION_EMPTY:
|
|
642
|
+
return "ORDER_EXECUTION_EMPTY";
|
|
643
|
+
case Error.ORDER_EXECUTION_FILL_OR_KILL:
|
|
644
|
+
return "ORDER_EXECUTION_FILL_OR_KILL";
|
|
645
|
+
case Error.ORDER_EXECUTION_MISSING_LIMITS:
|
|
646
|
+
return "ORDER_EXECUTION_MISSING_LIMITS";
|
|
647
|
+
case Error.ORDER_EXECUTION_MISSING_PRICE:
|
|
648
|
+
return "ORDER_EXECUTION_MISSING_PRICE";
|
|
649
|
+
case Error.ORDER_EXECUTION_SIZE_LIMIT:
|
|
650
|
+
return "ORDER_EXECUTION_SIZE_LIMIT";
|
|
651
|
+
case Error.BALANCE:
|
|
652
|
+
return "BALANCE";
|
|
653
|
+
case Error.BALANCE_DEPOSIT_OVERFLOW:
|
|
654
|
+
return "BALANCE_DEPOSIT_OVERFLOW";
|
|
655
|
+
case Error.BALANCE_CHANGE_OVERFLOW:
|
|
656
|
+
return "BALANCE_CHANGE_OVERFLOW";
|
|
657
|
+
case Error.BALANCE_CHANGE_LIMIT_EXCEEDED:
|
|
658
|
+
return "BALANCE_CHANGE_LIMIT_EXCEEDED";
|
|
659
|
+
case Error.BALANCE_INSUFFICIENT:
|
|
660
|
+
return "BALANCE_INSUFFICIENT";
|
|
661
|
+
case Error.UNAUTHENTICATED_L1_ACTION:
|
|
662
|
+
return "UNAUTHENTICATED_L1_ACTION";
|
|
663
|
+
case Error.ENCODED_ACTION_TOO_LARGE:
|
|
664
|
+
return "ENCODED_ACTION_TOO_LARGE";
|
|
665
|
+
case Error.TRIGGER:
|
|
666
|
+
return "TRIGGER";
|
|
667
|
+
case Error.TRIGGER_INVALID_PRICE:
|
|
668
|
+
return "TRIGGER_INVALID_PRICE";
|
|
669
|
+
case Error.Dropped:
|
|
670
|
+
return "Dropped";
|
|
671
|
+
default:
|
|
672
|
+
throw new globalThis.Error("Unrecognized enum value " + object + " for enum Error");
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
function createBaseU128() {
|
|
676
|
+
return { lo: 0n, hi: 0n };
|
|
677
|
+
}
|
|
678
|
+
exports.U128 = {
|
|
679
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
680
|
+
if (message.lo !== 0n) {
|
|
681
|
+
if (BigInt.asUintN(64, message.lo) !== message.lo) {
|
|
682
|
+
throw new globalThis.Error("value provided for field message.lo of type uint64 too large");
|
|
683
|
+
}
|
|
684
|
+
writer.uint32(8).uint64(message.lo);
|
|
685
|
+
}
|
|
686
|
+
if (message.hi !== 0n) {
|
|
687
|
+
if (BigInt.asUintN(64, message.hi) !== message.hi) {
|
|
688
|
+
throw new globalThis.Error("value provided for field message.hi of type uint64 too large");
|
|
689
|
+
}
|
|
690
|
+
writer.uint32(16).uint64(message.hi);
|
|
691
|
+
}
|
|
692
|
+
return writer;
|
|
693
|
+
},
|
|
694
|
+
decode(input, length) {
|
|
695
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
696
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
697
|
+
const message = createBaseU128();
|
|
698
|
+
while (reader.pos < end) {
|
|
699
|
+
const tag = reader.uint32();
|
|
700
|
+
switch (tag >>> 3) {
|
|
701
|
+
case 1:
|
|
702
|
+
if (tag !== 8) {
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
message.lo = reader.uint64();
|
|
706
|
+
continue;
|
|
707
|
+
case 2:
|
|
708
|
+
if (tag !== 16) {
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
message.hi = reader.uint64();
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
reader.skip(tag & 7);
|
|
718
|
+
}
|
|
719
|
+
return message;
|
|
720
|
+
},
|
|
721
|
+
fromJSON(object) {
|
|
722
|
+
return { lo: isSet(object.lo) ? BigInt(object.lo) : 0n, hi: isSet(object.hi) ? BigInt(object.hi) : 0n };
|
|
723
|
+
},
|
|
724
|
+
toJSON(message) {
|
|
725
|
+
const obj = {};
|
|
726
|
+
if (message.lo !== 0n) {
|
|
727
|
+
obj.lo = message.lo.toString();
|
|
728
|
+
}
|
|
729
|
+
if (message.hi !== 0n) {
|
|
730
|
+
obj.hi = message.hi.toString();
|
|
731
|
+
}
|
|
732
|
+
return obj;
|
|
733
|
+
},
|
|
734
|
+
create(base) {
|
|
735
|
+
return exports.U128.fromPartial(base ?? {});
|
|
736
|
+
},
|
|
737
|
+
fromPartial(object) {
|
|
738
|
+
const message = createBaseU128();
|
|
739
|
+
message.lo = object.lo ?? 0n;
|
|
740
|
+
message.hi = object.hi ?? 0n;
|
|
741
|
+
return message;
|
|
742
|
+
},
|
|
743
|
+
};
|
|
744
|
+
function createBaseMarket() {
|
|
745
|
+
return {
|
|
746
|
+
marketId: 0,
|
|
747
|
+
priceDecimals: 0,
|
|
748
|
+
sizeDecimals: 0,
|
|
749
|
+
baseTokenId: 0,
|
|
750
|
+
marketType: 0,
|
|
751
|
+
imfBps: 0,
|
|
752
|
+
cmfBps: 0,
|
|
753
|
+
mmfBps: 0,
|
|
754
|
+
viewSymbol: "",
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
exports.Market = {
|
|
758
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
759
|
+
if (message.marketId !== 0) {
|
|
760
|
+
writer.uint32(8).uint32(message.marketId);
|
|
761
|
+
}
|
|
762
|
+
if (message.priceDecimals !== 0) {
|
|
763
|
+
writer.uint32(16).uint32(message.priceDecimals);
|
|
764
|
+
}
|
|
765
|
+
if (message.sizeDecimals !== 0) {
|
|
766
|
+
writer.uint32(24).uint32(message.sizeDecimals);
|
|
767
|
+
}
|
|
768
|
+
if (message.baseTokenId !== 0) {
|
|
769
|
+
writer.uint32(32).uint32(message.baseTokenId);
|
|
770
|
+
}
|
|
771
|
+
if (message.marketType !== 0) {
|
|
772
|
+
writer.uint32(40).int32(message.marketType);
|
|
773
|
+
}
|
|
774
|
+
if (message.imfBps !== 0) {
|
|
775
|
+
writer.uint32(48).uint32(message.imfBps);
|
|
776
|
+
}
|
|
777
|
+
if (message.cmfBps !== 0) {
|
|
778
|
+
writer.uint32(56).uint32(message.cmfBps);
|
|
779
|
+
}
|
|
780
|
+
if (message.mmfBps !== 0) {
|
|
781
|
+
writer.uint32(64).uint32(message.mmfBps);
|
|
782
|
+
}
|
|
783
|
+
if (message.viewSymbol !== "") {
|
|
784
|
+
writer.uint32(82).string(message.viewSymbol);
|
|
785
|
+
}
|
|
786
|
+
return writer;
|
|
787
|
+
},
|
|
788
|
+
decode(input, length) {
|
|
789
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
790
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
791
|
+
const message = createBaseMarket();
|
|
792
|
+
while (reader.pos < end) {
|
|
793
|
+
const tag = reader.uint32();
|
|
794
|
+
switch (tag >>> 3) {
|
|
795
|
+
case 1:
|
|
796
|
+
if (tag !== 8) {
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
799
|
+
message.marketId = reader.uint32();
|
|
800
|
+
continue;
|
|
801
|
+
case 2:
|
|
802
|
+
if (tag !== 16) {
|
|
803
|
+
break;
|
|
804
|
+
}
|
|
805
|
+
message.priceDecimals = reader.uint32();
|
|
806
|
+
continue;
|
|
807
|
+
case 3:
|
|
808
|
+
if (tag !== 24) {
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
message.sizeDecimals = reader.uint32();
|
|
812
|
+
continue;
|
|
813
|
+
case 4:
|
|
814
|
+
if (tag !== 32) {
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
message.baseTokenId = reader.uint32();
|
|
818
|
+
continue;
|
|
819
|
+
case 5:
|
|
820
|
+
if (tag !== 40) {
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
message.marketType = reader.int32();
|
|
824
|
+
continue;
|
|
825
|
+
case 6:
|
|
826
|
+
if (tag !== 48) {
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
message.imfBps = reader.uint32();
|
|
830
|
+
continue;
|
|
831
|
+
case 7:
|
|
832
|
+
if (tag !== 56) {
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
message.cmfBps = reader.uint32();
|
|
836
|
+
continue;
|
|
837
|
+
case 8:
|
|
838
|
+
if (tag !== 64) {
|
|
839
|
+
break;
|
|
840
|
+
}
|
|
841
|
+
message.mmfBps = reader.uint32();
|
|
842
|
+
continue;
|
|
843
|
+
case 10:
|
|
844
|
+
if (tag !== 82) {
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
message.viewSymbol = reader.string();
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
851
|
+
break;
|
|
852
|
+
}
|
|
853
|
+
reader.skip(tag & 7);
|
|
854
|
+
}
|
|
855
|
+
return message;
|
|
856
|
+
},
|
|
857
|
+
fromJSON(object) {
|
|
858
|
+
return {
|
|
859
|
+
marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
|
|
860
|
+
priceDecimals: isSet(object.priceDecimals) ? globalThis.Number(object.priceDecimals) : 0,
|
|
861
|
+
sizeDecimals: isSet(object.sizeDecimals) ? globalThis.Number(object.sizeDecimals) : 0,
|
|
862
|
+
baseTokenId: isSet(object.baseTokenId) ? globalThis.Number(object.baseTokenId) : 0,
|
|
863
|
+
marketType: isSet(object.marketType) ? marketTypeFromJSON(object.marketType) : 0,
|
|
864
|
+
imfBps: isSet(object.imfBps) ? globalThis.Number(object.imfBps) : 0,
|
|
865
|
+
cmfBps: isSet(object.cmfBps) ? globalThis.Number(object.cmfBps) : 0,
|
|
866
|
+
mmfBps: isSet(object.mmfBps) ? globalThis.Number(object.mmfBps) : 0,
|
|
867
|
+
viewSymbol: isSet(object.viewSymbol) ? globalThis.String(object.viewSymbol) : "",
|
|
868
|
+
};
|
|
869
|
+
},
|
|
870
|
+
toJSON(message) {
|
|
871
|
+
const obj = {};
|
|
872
|
+
if (message.marketId !== 0) {
|
|
873
|
+
obj.marketId = Math.round(message.marketId);
|
|
874
|
+
}
|
|
875
|
+
if (message.priceDecimals !== 0) {
|
|
876
|
+
obj.priceDecimals = Math.round(message.priceDecimals);
|
|
877
|
+
}
|
|
878
|
+
if (message.sizeDecimals !== 0) {
|
|
879
|
+
obj.sizeDecimals = Math.round(message.sizeDecimals);
|
|
880
|
+
}
|
|
881
|
+
if (message.baseTokenId !== 0) {
|
|
882
|
+
obj.baseTokenId = Math.round(message.baseTokenId);
|
|
883
|
+
}
|
|
884
|
+
if (message.marketType !== 0) {
|
|
885
|
+
obj.marketType = marketTypeToJSON(message.marketType);
|
|
886
|
+
}
|
|
887
|
+
if (message.imfBps !== 0) {
|
|
888
|
+
obj.imfBps = Math.round(message.imfBps);
|
|
889
|
+
}
|
|
890
|
+
if (message.cmfBps !== 0) {
|
|
891
|
+
obj.cmfBps = Math.round(message.cmfBps);
|
|
892
|
+
}
|
|
893
|
+
if (message.mmfBps !== 0) {
|
|
894
|
+
obj.mmfBps = Math.round(message.mmfBps);
|
|
895
|
+
}
|
|
896
|
+
if (message.viewSymbol !== "") {
|
|
897
|
+
obj.viewSymbol = message.viewSymbol;
|
|
898
|
+
}
|
|
899
|
+
return obj;
|
|
900
|
+
},
|
|
901
|
+
create(base) {
|
|
902
|
+
return exports.Market.fromPartial(base ?? {});
|
|
903
|
+
},
|
|
904
|
+
fromPartial(object) {
|
|
905
|
+
const message = createBaseMarket();
|
|
906
|
+
message.marketId = object.marketId ?? 0;
|
|
907
|
+
message.priceDecimals = object.priceDecimals ?? 0;
|
|
908
|
+
message.sizeDecimals = object.sizeDecimals ?? 0;
|
|
909
|
+
message.baseTokenId = object.baseTokenId ?? 0;
|
|
910
|
+
message.marketType = object.marketType ?? 0;
|
|
911
|
+
message.imfBps = object.imfBps ?? 0;
|
|
912
|
+
message.cmfBps = object.cmfBps ?? 0;
|
|
913
|
+
message.mmfBps = object.mmfBps ?? 0;
|
|
914
|
+
message.viewSymbol = object.viewSymbol ?? "";
|
|
915
|
+
return message;
|
|
916
|
+
},
|
|
917
|
+
};
|
|
918
|
+
function createBaseToken() {
|
|
919
|
+
return { tokenId: 0, tokenDecimals: 0, weightBps: 0, viewSymbol: "" };
|
|
920
|
+
}
|
|
921
|
+
exports.Token = {
|
|
922
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
923
|
+
if (message.tokenId !== 0) {
|
|
924
|
+
writer.uint32(8).uint32(message.tokenId);
|
|
925
|
+
}
|
|
926
|
+
if (message.tokenDecimals !== 0) {
|
|
927
|
+
writer.uint32(16).uint32(message.tokenDecimals);
|
|
928
|
+
}
|
|
929
|
+
if (message.weightBps !== 0) {
|
|
930
|
+
writer.uint32(32).uint32(message.weightBps);
|
|
931
|
+
}
|
|
932
|
+
if (message.viewSymbol !== "") {
|
|
933
|
+
writer.uint32(42).string(message.viewSymbol);
|
|
934
|
+
}
|
|
935
|
+
return writer;
|
|
936
|
+
},
|
|
937
|
+
decode(input, length) {
|
|
938
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
939
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
940
|
+
const message = createBaseToken();
|
|
941
|
+
while (reader.pos < end) {
|
|
942
|
+
const tag = reader.uint32();
|
|
943
|
+
switch (tag >>> 3) {
|
|
944
|
+
case 1:
|
|
945
|
+
if (tag !== 8) {
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
message.tokenId = reader.uint32();
|
|
949
|
+
continue;
|
|
950
|
+
case 2:
|
|
951
|
+
if (tag !== 16) {
|
|
952
|
+
break;
|
|
953
|
+
}
|
|
954
|
+
message.tokenDecimals = reader.uint32();
|
|
955
|
+
continue;
|
|
956
|
+
case 4:
|
|
957
|
+
if (tag !== 32) {
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
960
|
+
message.weightBps = reader.uint32();
|
|
961
|
+
continue;
|
|
962
|
+
case 5:
|
|
963
|
+
if (tag !== 42) {
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
message.viewSymbol = reader.string();
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
reader.skip(tag & 7);
|
|
973
|
+
}
|
|
974
|
+
return message;
|
|
975
|
+
},
|
|
976
|
+
fromJSON(object) {
|
|
977
|
+
return {
|
|
978
|
+
tokenId: isSet(object.tokenId) ? globalThis.Number(object.tokenId) : 0,
|
|
979
|
+
tokenDecimals: isSet(object.tokenDecimals) ? globalThis.Number(object.tokenDecimals) : 0,
|
|
980
|
+
weightBps: isSet(object.weightBps) ? globalThis.Number(object.weightBps) : 0,
|
|
981
|
+
viewSymbol: isSet(object.viewSymbol) ? globalThis.String(object.viewSymbol) : "",
|
|
982
|
+
};
|
|
983
|
+
},
|
|
984
|
+
toJSON(message) {
|
|
985
|
+
const obj = {};
|
|
986
|
+
if (message.tokenId !== 0) {
|
|
987
|
+
obj.tokenId = Math.round(message.tokenId);
|
|
988
|
+
}
|
|
989
|
+
if (message.tokenDecimals !== 0) {
|
|
990
|
+
obj.tokenDecimals = Math.round(message.tokenDecimals);
|
|
991
|
+
}
|
|
992
|
+
if (message.weightBps !== 0) {
|
|
993
|
+
obj.weightBps = Math.round(message.weightBps);
|
|
994
|
+
}
|
|
995
|
+
if (message.viewSymbol !== "") {
|
|
996
|
+
obj.viewSymbol = message.viewSymbol;
|
|
997
|
+
}
|
|
998
|
+
return obj;
|
|
999
|
+
},
|
|
1000
|
+
create(base) {
|
|
1001
|
+
return exports.Token.fromPartial(base ?? {});
|
|
1002
|
+
},
|
|
1003
|
+
fromPartial(object) {
|
|
1004
|
+
const message = createBaseToken();
|
|
1005
|
+
message.tokenId = object.tokenId ?? 0;
|
|
1006
|
+
message.tokenDecimals = object.tokenDecimals ?? 0;
|
|
1007
|
+
message.weightBps = object.weightBps ?? 0;
|
|
1008
|
+
message.viewSymbol = object.viewSymbol ?? "";
|
|
1009
|
+
return message;
|
|
1010
|
+
},
|
|
1011
|
+
};
|
|
1012
|
+
function createBaseAction() {
|
|
1013
|
+
return { currentTimestamp: 0n, nonce: 0, kind: undefined };
|
|
1014
|
+
}
|
|
1015
|
+
exports.Action = {
|
|
1016
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1017
|
+
if (message.currentTimestamp !== 0n) {
|
|
1018
|
+
if (BigInt.asIntN(64, message.currentTimestamp) !== message.currentTimestamp) {
|
|
1019
|
+
throw new globalThis.Error("value provided for field message.currentTimestamp of type int64 too large");
|
|
1020
|
+
}
|
|
1021
|
+
writer.uint32(8).int64(message.currentTimestamp);
|
|
1022
|
+
}
|
|
1023
|
+
if (message.nonce !== 0) {
|
|
1024
|
+
writer.uint32(16).uint32(message.nonce);
|
|
1025
|
+
}
|
|
1026
|
+
switch (message.kind?.$case) {
|
|
1027
|
+
case "createSession":
|
|
1028
|
+
exports.Action_CreateSession.encode(message.kind.value, writer.uint32(34).fork()).join();
|
|
1029
|
+
break;
|
|
1030
|
+
case "createToken":
|
|
1031
|
+
exports.Action_CreateToken.encode(message.kind.value, writer.uint32(42).fork()).join();
|
|
1032
|
+
break;
|
|
1033
|
+
case "createMarket":
|
|
1034
|
+
exports.Action_CreateMarket.encode(message.kind.value, writer.uint32(50).fork()).join();
|
|
1035
|
+
break;
|
|
1036
|
+
case "placeOrder":
|
|
1037
|
+
exports.Action_PlaceOrder.encode(message.kind.value, writer.uint32(58).fork()).join();
|
|
1038
|
+
break;
|
|
1039
|
+
case "cancelOrderById":
|
|
1040
|
+
exports.Action_CancelOrderById.encode(message.kind.value, writer.uint32(66).fork()).join();
|
|
1041
|
+
break;
|
|
1042
|
+
case "deposit":
|
|
1043
|
+
exports.Action_Deposit.encode(message.kind.value, writer.uint32(74).fork()).join();
|
|
1044
|
+
break;
|
|
1045
|
+
case "withdraw":
|
|
1046
|
+
exports.Action_Withdraw.encode(message.kind.value, writer.uint32(82).fork()).join();
|
|
1047
|
+
break;
|
|
1048
|
+
case "pythSetWormholeGuardians":
|
|
1049
|
+
exports.Action_PythSetWormholeGuardians.encode(message.kind.value, writer.uint32(90).fork()).join();
|
|
1050
|
+
break;
|
|
1051
|
+
case "pythSetSymbolFeed":
|
|
1052
|
+
exports.Action_PythSetSymbolFeed.encode(message.kind.value, writer.uint32(98).fork()).join();
|
|
1053
|
+
break;
|
|
1054
|
+
case "pythPriceFeedUpdate":
|
|
1055
|
+
exports.Action_PythPriceFeedUpdate.encode(message.kind.value, writer.uint32(106).fork()).join();
|
|
1056
|
+
break;
|
|
1057
|
+
case "liquidate":
|
|
1058
|
+
exports.Action_Liquidate.encode(message.kind.value, writer.uint32(114).fork()).join();
|
|
1059
|
+
break;
|
|
1060
|
+
case "revokeSession":
|
|
1061
|
+
exports.Action_RevokeSession.encode(message.kind.value, writer.uint32(122).fork()).join();
|
|
1062
|
+
break;
|
|
1063
|
+
case "pause":
|
|
1064
|
+
exports.Action_Pause.encode(message.kind.value, writer.uint32(130).fork()).join();
|
|
1065
|
+
break;
|
|
1066
|
+
case "unpause":
|
|
1067
|
+
exports.Action_Unpause.encode(message.kind.value, writer.uint32(138).fork()).join();
|
|
1068
|
+
break;
|
|
1069
|
+
case "transfer":
|
|
1070
|
+
exports.Action_Transfer.encode(message.kind.value, writer.uint32(146).fork()).join();
|
|
1071
|
+
break;
|
|
1072
|
+
case "message":
|
|
1073
|
+
common_1.Message.encode(message.kind.value, writer.uint32(154).fork()).join();
|
|
1074
|
+
break;
|
|
1075
|
+
case "addTrigger":
|
|
1076
|
+
exports.Action_AddTrigger.encode(message.kind.value, writer.uint32(258).fork()).join();
|
|
1077
|
+
break;
|
|
1078
|
+
case "removeTrigger":
|
|
1079
|
+
exports.Action_RemoveTrigger.encode(message.kind.value, writer.uint32(266).fork()).join();
|
|
1080
|
+
break;
|
|
1081
|
+
}
|
|
1082
|
+
return writer;
|
|
1083
|
+
},
|
|
1084
|
+
decode(input, length) {
|
|
1085
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1086
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1087
|
+
const message = createBaseAction();
|
|
1088
|
+
while (reader.pos < end) {
|
|
1089
|
+
const tag = reader.uint32();
|
|
1090
|
+
switch (tag >>> 3) {
|
|
1091
|
+
case 1:
|
|
1092
|
+
if (tag !== 8) {
|
|
1093
|
+
break;
|
|
1094
|
+
}
|
|
1095
|
+
message.currentTimestamp = reader.int64();
|
|
1096
|
+
continue;
|
|
1097
|
+
case 2:
|
|
1098
|
+
if (tag !== 16) {
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
message.nonce = reader.uint32();
|
|
1102
|
+
continue;
|
|
1103
|
+
case 4:
|
|
1104
|
+
if (tag !== 34) {
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1107
|
+
message.kind = { $case: "createSession", value: exports.Action_CreateSession.decode(reader, reader.uint32()) };
|
|
1108
|
+
continue;
|
|
1109
|
+
case 5:
|
|
1110
|
+
if (tag !== 42) {
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
message.kind = { $case: "createToken", value: exports.Action_CreateToken.decode(reader, reader.uint32()) };
|
|
1114
|
+
continue;
|
|
1115
|
+
case 6:
|
|
1116
|
+
if (tag !== 50) {
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
message.kind = { $case: "createMarket", value: exports.Action_CreateMarket.decode(reader, reader.uint32()) };
|
|
1120
|
+
continue;
|
|
1121
|
+
case 7:
|
|
1122
|
+
if (tag !== 58) {
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
message.kind = { $case: "placeOrder", value: exports.Action_PlaceOrder.decode(reader, reader.uint32()) };
|
|
1126
|
+
continue;
|
|
1127
|
+
case 8:
|
|
1128
|
+
if (tag !== 66) {
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
message.kind = { $case: "cancelOrderById", value: exports.Action_CancelOrderById.decode(reader, reader.uint32()) };
|
|
1132
|
+
continue;
|
|
1133
|
+
case 9:
|
|
1134
|
+
if (tag !== 74) {
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
message.kind = { $case: "deposit", value: exports.Action_Deposit.decode(reader, reader.uint32()) };
|
|
1138
|
+
continue;
|
|
1139
|
+
case 10:
|
|
1140
|
+
if (tag !== 82) {
|
|
1141
|
+
break;
|
|
1142
|
+
}
|
|
1143
|
+
message.kind = { $case: "withdraw", value: exports.Action_Withdraw.decode(reader, reader.uint32()) };
|
|
1144
|
+
continue;
|
|
1145
|
+
case 11:
|
|
1146
|
+
if (tag !== 90) {
|
|
1147
|
+
break;
|
|
1148
|
+
}
|
|
1149
|
+
message.kind = {
|
|
1150
|
+
$case: "pythSetWormholeGuardians",
|
|
1151
|
+
value: exports.Action_PythSetWormholeGuardians.decode(reader, reader.uint32()),
|
|
1152
|
+
};
|
|
1153
|
+
continue;
|
|
1154
|
+
case 12:
|
|
1155
|
+
if (tag !== 98) {
|
|
1156
|
+
break;
|
|
1157
|
+
}
|
|
1158
|
+
message.kind = {
|
|
1159
|
+
$case: "pythSetSymbolFeed",
|
|
1160
|
+
value: exports.Action_PythSetSymbolFeed.decode(reader, reader.uint32()),
|
|
1161
|
+
};
|
|
1162
|
+
continue;
|
|
1163
|
+
case 13:
|
|
1164
|
+
if (tag !== 106) {
|
|
1165
|
+
break;
|
|
1166
|
+
}
|
|
1167
|
+
message.kind = {
|
|
1168
|
+
$case: "pythPriceFeedUpdate",
|
|
1169
|
+
value: exports.Action_PythPriceFeedUpdate.decode(reader, reader.uint32()),
|
|
1170
|
+
};
|
|
1171
|
+
continue;
|
|
1172
|
+
case 14:
|
|
1173
|
+
if (tag !== 114) {
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
message.kind = { $case: "liquidate", value: exports.Action_Liquidate.decode(reader, reader.uint32()) };
|
|
1177
|
+
continue;
|
|
1178
|
+
case 15:
|
|
1179
|
+
if (tag !== 122) {
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
message.kind = { $case: "revokeSession", value: exports.Action_RevokeSession.decode(reader, reader.uint32()) };
|
|
1183
|
+
continue;
|
|
1184
|
+
case 16:
|
|
1185
|
+
if (tag !== 130) {
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
message.kind = { $case: "pause", value: exports.Action_Pause.decode(reader, reader.uint32()) };
|
|
1189
|
+
continue;
|
|
1190
|
+
case 17:
|
|
1191
|
+
if (tag !== 138) {
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
message.kind = { $case: "unpause", value: exports.Action_Unpause.decode(reader, reader.uint32()) };
|
|
1195
|
+
continue;
|
|
1196
|
+
case 18:
|
|
1197
|
+
if (tag !== 146) {
|
|
1198
|
+
break;
|
|
1199
|
+
}
|
|
1200
|
+
message.kind = { $case: "transfer", value: exports.Action_Transfer.decode(reader, reader.uint32()) };
|
|
1201
|
+
continue;
|
|
1202
|
+
case 19:
|
|
1203
|
+
if (tag !== 154) {
|
|
1204
|
+
break;
|
|
1205
|
+
}
|
|
1206
|
+
message.kind = { $case: "message", value: common_1.Message.decode(reader, reader.uint32()) };
|
|
1207
|
+
continue;
|
|
1208
|
+
case 32:
|
|
1209
|
+
if (tag !== 258) {
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
message.kind = { $case: "addTrigger", value: exports.Action_AddTrigger.decode(reader, reader.uint32()) };
|
|
1213
|
+
continue;
|
|
1214
|
+
case 33:
|
|
1215
|
+
if (tag !== 266) {
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
message.kind = { $case: "removeTrigger", value: exports.Action_RemoveTrigger.decode(reader, reader.uint32()) };
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1222
|
+
break;
|
|
1223
|
+
}
|
|
1224
|
+
reader.skip(tag & 7);
|
|
1225
|
+
}
|
|
1226
|
+
return message;
|
|
1227
|
+
},
|
|
1228
|
+
fromJSON(object) {
|
|
1229
|
+
return {
|
|
1230
|
+
currentTimestamp: isSet(object.currentTimestamp) ? BigInt(object.currentTimestamp) : 0n,
|
|
1231
|
+
nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0,
|
|
1232
|
+
kind: isSet(object.createSession)
|
|
1233
|
+
? { $case: "createSession", value: exports.Action_CreateSession.fromJSON(object.createSession) }
|
|
1234
|
+
: isSet(object.createToken)
|
|
1235
|
+
? { $case: "createToken", value: exports.Action_CreateToken.fromJSON(object.createToken) }
|
|
1236
|
+
: isSet(object.createMarket)
|
|
1237
|
+
? { $case: "createMarket", value: exports.Action_CreateMarket.fromJSON(object.createMarket) }
|
|
1238
|
+
: isSet(object.placeOrder)
|
|
1239
|
+
? { $case: "placeOrder", value: exports.Action_PlaceOrder.fromJSON(object.placeOrder) }
|
|
1240
|
+
: isSet(object.cancelOrderById)
|
|
1241
|
+
? { $case: "cancelOrderById", value: exports.Action_CancelOrderById.fromJSON(object.cancelOrderById) }
|
|
1242
|
+
: isSet(object.deposit)
|
|
1243
|
+
? { $case: "deposit", value: exports.Action_Deposit.fromJSON(object.deposit) }
|
|
1244
|
+
: isSet(object.withdraw)
|
|
1245
|
+
? { $case: "withdraw", value: exports.Action_Withdraw.fromJSON(object.withdraw) }
|
|
1246
|
+
: isSet(object.pythSetWormholeGuardians)
|
|
1247
|
+
? {
|
|
1248
|
+
$case: "pythSetWormholeGuardians",
|
|
1249
|
+
value: exports.Action_PythSetWormholeGuardians.fromJSON(object.pythSetWormholeGuardians),
|
|
1250
|
+
}
|
|
1251
|
+
: isSet(object.pythSetSymbolFeed)
|
|
1252
|
+
? { $case: "pythSetSymbolFeed", value: exports.Action_PythSetSymbolFeed.fromJSON(object.pythSetSymbolFeed) }
|
|
1253
|
+
: isSet(object.pythPriceFeedUpdate)
|
|
1254
|
+
? { $case: "pythPriceFeedUpdate", value: exports.Action_PythPriceFeedUpdate.fromJSON(object.pythPriceFeedUpdate) }
|
|
1255
|
+
: isSet(object.liquidate)
|
|
1256
|
+
? { $case: "liquidate", value: exports.Action_Liquidate.fromJSON(object.liquidate) }
|
|
1257
|
+
: isSet(object.revokeSession)
|
|
1258
|
+
? { $case: "revokeSession", value: exports.Action_RevokeSession.fromJSON(object.revokeSession) }
|
|
1259
|
+
: isSet(object.pause)
|
|
1260
|
+
? { $case: "pause", value: exports.Action_Pause.fromJSON(object.pause) }
|
|
1261
|
+
: isSet(object.unpause)
|
|
1262
|
+
? { $case: "unpause", value: exports.Action_Unpause.fromJSON(object.unpause) }
|
|
1263
|
+
: isSet(object.transfer)
|
|
1264
|
+
? { $case: "transfer", value: exports.Action_Transfer.fromJSON(object.transfer) }
|
|
1265
|
+
: isSet(object.message)
|
|
1266
|
+
? { $case: "message", value: common_1.Message.fromJSON(object.message) }
|
|
1267
|
+
: isSet(object.addTrigger)
|
|
1268
|
+
? { $case: "addTrigger", value: exports.Action_AddTrigger.fromJSON(object.addTrigger) }
|
|
1269
|
+
: isSet(object.removeTrigger)
|
|
1270
|
+
? { $case: "removeTrigger", value: exports.Action_RemoveTrigger.fromJSON(object.removeTrigger) }
|
|
1271
|
+
: undefined,
|
|
1272
|
+
};
|
|
1273
|
+
},
|
|
1274
|
+
toJSON(message) {
|
|
1275
|
+
const obj = {};
|
|
1276
|
+
if (message.currentTimestamp !== 0n) {
|
|
1277
|
+
obj.currentTimestamp = message.currentTimestamp.toString();
|
|
1278
|
+
}
|
|
1279
|
+
if (message.nonce !== 0) {
|
|
1280
|
+
obj.nonce = Math.round(message.nonce);
|
|
1281
|
+
}
|
|
1282
|
+
if (message.kind?.$case === "createSession") {
|
|
1283
|
+
obj.createSession = exports.Action_CreateSession.toJSON(message.kind.value);
|
|
1284
|
+
}
|
|
1285
|
+
if (message.kind?.$case === "createToken") {
|
|
1286
|
+
obj.createToken = exports.Action_CreateToken.toJSON(message.kind.value);
|
|
1287
|
+
}
|
|
1288
|
+
if (message.kind?.$case === "createMarket") {
|
|
1289
|
+
obj.createMarket = exports.Action_CreateMarket.toJSON(message.kind.value);
|
|
1290
|
+
}
|
|
1291
|
+
if (message.kind?.$case === "placeOrder") {
|
|
1292
|
+
obj.placeOrder = exports.Action_PlaceOrder.toJSON(message.kind.value);
|
|
1293
|
+
}
|
|
1294
|
+
if (message.kind?.$case === "cancelOrderById") {
|
|
1295
|
+
obj.cancelOrderById = exports.Action_CancelOrderById.toJSON(message.kind.value);
|
|
1296
|
+
}
|
|
1297
|
+
if (message.kind?.$case === "deposit") {
|
|
1298
|
+
obj.deposit = exports.Action_Deposit.toJSON(message.kind.value);
|
|
1299
|
+
}
|
|
1300
|
+
if (message.kind?.$case === "withdraw") {
|
|
1301
|
+
obj.withdraw = exports.Action_Withdraw.toJSON(message.kind.value);
|
|
1302
|
+
}
|
|
1303
|
+
if (message.kind?.$case === "pythSetWormholeGuardians") {
|
|
1304
|
+
obj.pythSetWormholeGuardians = exports.Action_PythSetWormholeGuardians.toJSON(message.kind.value);
|
|
1305
|
+
}
|
|
1306
|
+
if (message.kind?.$case === "pythSetSymbolFeed") {
|
|
1307
|
+
obj.pythSetSymbolFeed = exports.Action_PythSetSymbolFeed.toJSON(message.kind.value);
|
|
1308
|
+
}
|
|
1309
|
+
if (message.kind?.$case === "pythPriceFeedUpdate") {
|
|
1310
|
+
obj.pythPriceFeedUpdate = exports.Action_PythPriceFeedUpdate.toJSON(message.kind.value);
|
|
1311
|
+
}
|
|
1312
|
+
if (message.kind?.$case === "liquidate") {
|
|
1313
|
+
obj.liquidate = exports.Action_Liquidate.toJSON(message.kind.value);
|
|
1314
|
+
}
|
|
1315
|
+
if (message.kind?.$case === "revokeSession") {
|
|
1316
|
+
obj.revokeSession = exports.Action_RevokeSession.toJSON(message.kind.value);
|
|
1317
|
+
}
|
|
1318
|
+
if (message.kind?.$case === "pause") {
|
|
1319
|
+
obj.pause = exports.Action_Pause.toJSON(message.kind.value);
|
|
1320
|
+
}
|
|
1321
|
+
if (message.kind?.$case === "unpause") {
|
|
1322
|
+
obj.unpause = exports.Action_Unpause.toJSON(message.kind.value);
|
|
1323
|
+
}
|
|
1324
|
+
if (message.kind?.$case === "transfer") {
|
|
1325
|
+
obj.transfer = exports.Action_Transfer.toJSON(message.kind.value);
|
|
1326
|
+
}
|
|
1327
|
+
if (message.kind?.$case === "message") {
|
|
1328
|
+
obj.message = common_1.Message.toJSON(message.kind.value);
|
|
1329
|
+
}
|
|
1330
|
+
if (message.kind?.$case === "addTrigger") {
|
|
1331
|
+
obj.addTrigger = exports.Action_AddTrigger.toJSON(message.kind.value);
|
|
1332
|
+
}
|
|
1333
|
+
if (message.kind?.$case === "removeTrigger") {
|
|
1334
|
+
obj.removeTrigger = exports.Action_RemoveTrigger.toJSON(message.kind.value);
|
|
1335
|
+
}
|
|
1336
|
+
return obj;
|
|
1337
|
+
},
|
|
1338
|
+
create(base) {
|
|
1339
|
+
return exports.Action.fromPartial(base ?? {});
|
|
1340
|
+
},
|
|
1341
|
+
fromPartial(object) {
|
|
1342
|
+
const message = createBaseAction();
|
|
1343
|
+
message.currentTimestamp = object.currentTimestamp ?? 0n;
|
|
1344
|
+
message.nonce = object.nonce ?? 0;
|
|
1345
|
+
if (object.kind?.$case === "createSession" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1346
|
+
message.kind = { $case: "createSession", value: exports.Action_CreateSession.fromPartial(object.kind.value) };
|
|
1347
|
+
}
|
|
1348
|
+
if (object.kind?.$case === "createToken" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1349
|
+
message.kind = { $case: "createToken", value: exports.Action_CreateToken.fromPartial(object.kind.value) };
|
|
1350
|
+
}
|
|
1351
|
+
if (object.kind?.$case === "createMarket" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1352
|
+
message.kind = { $case: "createMarket", value: exports.Action_CreateMarket.fromPartial(object.kind.value) };
|
|
1353
|
+
}
|
|
1354
|
+
if (object.kind?.$case === "placeOrder" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1355
|
+
message.kind = { $case: "placeOrder", value: exports.Action_PlaceOrder.fromPartial(object.kind.value) };
|
|
1356
|
+
}
|
|
1357
|
+
if (object.kind?.$case === "cancelOrderById" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1358
|
+
message.kind = { $case: "cancelOrderById", value: exports.Action_CancelOrderById.fromPartial(object.kind.value) };
|
|
1359
|
+
}
|
|
1360
|
+
if (object.kind?.$case === "deposit" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1361
|
+
message.kind = { $case: "deposit", value: exports.Action_Deposit.fromPartial(object.kind.value) };
|
|
1362
|
+
}
|
|
1363
|
+
if (object.kind?.$case === "withdraw" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1364
|
+
message.kind = { $case: "withdraw", value: exports.Action_Withdraw.fromPartial(object.kind.value) };
|
|
1365
|
+
}
|
|
1366
|
+
if (object.kind?.$case === "pythSetWormholeGuardians" &&
|
|
1367
|
+
object.kind?.value !== undefined &&
|
|
1368
|
+
object.kind?.value !== null) {
|
|
1369
|
+
message.kind = {
|
|
1370
|
+
$case: "pythSetWormholeGuardians",
|
|
1371
|
+
value: exports.Action_PythSetWormholeGuardians.fromPartial(object.kind.value),
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
if (object.kind?.$case === "pythSetSymbolFeed" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1375
|
+
message.kind = { $case: "pythSetSymbolFeed", value: exports.Action_PythSetSymbolFeed.fromPartial(object.kind.value) };
|
|
1376
|
+
}
|
|
1377
|
+
if (object.kind?.$case === "pythPriceFeedUpdate" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1378
|
+
message.kind = { $case: "pythPriceFeedUpdate", value: exports.Action_PythPriceFeedUpdate.fromPartial(object.kind.value) };
|
|
1379
|
+
}
|
|
1380
|
+
if (object.kind?.$case === "liquidate" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1381
|
+
message.kind = { $case: "liquidate", value: exports.Action_Liquidate.fromPartial(object.kind.value) };
|
|
1382
|
+
}
|
|
1383
|
+
if (object.kind?.$case === "revokeSession" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1384
|
+
message.kind = { $case: "revokeSession", value: exports.Action_RevokeSession.fromPartial(object.kind.value) };
|
|
1385
|
+
}
|
|
1386
|
+
if (object.kind?.$case === "pause" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1387
|
+
message.kind = { $case: "pause", value: exports.Action_Pause.fromPartial(object.kind.value) };
|
|
1388
|
+
}
|
|
1389
|
+
if (object.kind?.$case === "unpause" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1390
|
+
message.kind = { $case: "unpause", value: exports.Action_Unpause.fromPartial(object.kind.value) };
|
|
1391
|
+
}
|
|
1392
|
+
if (object.kind?.$case === "transfer" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1393
|
+
message.kind = { $case: "transfer", value: exports.Action_Transfer.fromPartial(object.kind.value) };
|
|
1394
|
+
}
|
|
1395
|
+
if (object.kind?.$case === "message" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1396
|
+
message.kind = { $case: "message", value: common_1.Message.fromPartial(object.kind.value) };
|
|
1397
|
+
}
|
|
1398
|
+
if (object.kind?.$case === "addTrigger" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1399
|
+
message.kind = { $case: "addTrigger", value: exports.Action_AddTrigger.fromPartial(object.kind.value) };
|
|
1400
|
+
}
|
|
1401
|
+
if (object.kind?.$case === "removeTrigger" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
1402
|
+
message.kind = { $case: "removeTrigger", value: exports.Action_RemoveTrigger.fromPartial(object.kind.value) };
|
|
1403
|
+
}
|
|
1404
|
+
return message;
|
|
1405
|
+
},
|
|
1406
|
+
};
|
|
1407
|
+
function createBaseAction_CreateSession() {
|
|
1408
|
+
return { userPubkey: new Uint8Array(0), blstPubkey: new Uint8Array(0), expiryTimestamp: 0n };
|
|
1409
|
+
}
|
|
1410
|
+
exports.Action_CreateSession = {
|
|
1411
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1412
|
+
if (message.userPubkey.length !== 0) {
|
|
1413
|
+
writer.uint32(10).bytes(message.userPubkey);
|
|
1414
|
+
}
|
|
1415
|
+
if (message.blstPubkey.length !== 0) {
|
|
1416
|
+
writer.uint32(18).bytes(message.blstPubkey);
|
|
1417
|
+
}
|
|
1418
|
+
if (message.expiryTimestamp !== 0n) {
|
|
1419
|
+
if (BigInt.asIntN(64, message.expiryTimestamp) !== message.expiryTimestamp) {
|
|
1420
|
+
throw new globalThis.Error("value provided for field message.expiryTimestamp of type int64 too large");
|
|
1421
|
+
}
|
|
1422
|
+
writer.uint32(24).int64(message.expiryTimestamp);
|
|
1423
|
+
}
|
|
1424
|
+
return writer;
|
|
1425
|
+
},
|
|
1426
|
+
decode(input, length) {
|
|
1427
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1428
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1429
|
+
const message = createBaseAction_CreateSession();
|
|
1430
|
+
while (reader.pos < end) {
|
|
1431
|
+
const tag = reader.uint32();
|
|
1432
|
+
switch (tag >>> 3) {
|
|
1433
|
+
case 1:
|
|
1434
|
+
if (tag !== 10) {
|
|
1435
|
+
break;
|
|
1436
|
+
}
|
|
1437
|
+
message.userPubkey = reader.bytes();
|
|
1438
|
+
continue;
|
|
1439
|
+
case 2:
|
|
1440
|
+
if (tag !== 18) {
|
|
1441
|
+
break;
|
|
1442
|
+
}
|
|
1443
|
+
message.blstPubkey = reader.bytes();
|
|
1444
|
+
continue;
|
|
1445
|
+
case 3:
|
|
1446
|
+
if (tag !== 24) {
|
|
1447
|
+
break;
|
|
1448
|
+
}
|
|
1449
|
+
message.expiryTimestamp = reader.int64();
|
|
1450
|
+
continue;
|
|
1451
|
+
}
|
|
1452
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
reader.skip(tag & 7);
|
|
1456
|
+
}
|
|
1457
|
+
return message;
|
|
1458
|
+
},
|
|
1459
|
+
fromJSON(object) {
|
|
1460
|
+
return {
|
|
1461
|
+
userPubkey: isSet(object.userPubkey) ? bytesFromBase64(object.userPubkey) : new Uint8Array(0),
|
|
1462
|
+
blstPubkey: isSet(object.blstPubkey) ? bytesFromBase64(object.blstPubkey) : new Uint8Array(0),
|
|
1463
|
+
expiryTimestamp: isSet(object.expiryTimestamp) ? BigInt(object.expiryTimestamp) : 0n,
|
|
1464
|
+
};
|
|
1465
|
+
},
|
|
1466
|
+
toJSON(message) {
|
|
1467
|
+
const obj = {};
|
|
1468
|
+
if (message.userPubkey.length !== 0) {
|
|
1469
|
+
obj.userPubkey = base64FromBytes(message.userPubkey);
|
|
1470
|
+
}
|
|
1471
|
+
if (message.blstPubkey.length !== 0) {
|
|
1472
|
+
obj.blstPubkey = base64FromBytes(message.blstPubkey);
|
|
1473
|
+
}
|
|
1474
|
+
if (message.expiryTimestamp !== 0n) {
|
|
1475
|
+
obj.expiryTimestamp = message.expiryTimestamp.toString();
|
|
1476
|
+
}
|
|
1477
|
+
return obj;
|
|
1478
|
+
},
|
|
1479
|
+
create(base) {
|
|
1480
|
+
return exports.Action_CreateSession.fromPartial(base ?? {});
|
|
1481
|
+
},
|
|
1482
|
+
fromPartial(object) {
|
|
1483
|
+
const message = createBaseAction_CreateSession();
|
|
1484
|
+
message.userPubkey = object.userPubkey ?? new Uint8Array(0);
|
|
1485
|
+
message.blstPubkey = object.blstPubkey ?? new Uint8Array(0);
|
|
1486
|
+
message.expiryTimestamp = object.expiryTimestamp ?? 0n;
|
|
1487
|
+
return message;
|
|
1488
|
+
},
|
|
1489
|
+
};
|
|
1490
|
+
function createBaseAction_CreateToken() {
|
|
1491
|
+
return {
|
|
1492
|
+
tokenDecimals: 0,
|
|
1493
|
+
weightBps: 0,
|
|
1494
|
+
viewSymbol: "",
|
|
1495
|
+
oracleSymbol: "",
|
|
1496
|
+
ethAddr: new Uint8Array(0),
|
|
1497
|
+
minWithdrawAmount: 0n,
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
exports.Action_CreateToken = {
|
|
1501
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1502
|
+
if (message.tokenDecimals !== 0) {
|
|
1503
|
+
writer.uint32(8).uint32(message.tokenDecimals);
|
|
1504
|
+
}
|
|
1505
|
+
if (message.weightBps !== 0) {
|
|
1506
|
+
writer.uint32(24).uint32(message.weightBps);
|
|
1507
|
+
}
|
|
1508
|
+
if (message.viewSymbol !== "") {
|
|
1509
|
+
writer.uint32(34).string(message.viewSymbol);
|
|
1510
|
+
}
|
|
1511
|
+
if (message.oracleSymbol !== "") {
|
|
1512
|
+
writer.uint32(42).string(message.oracleSymbol);
|
|
1513
|
+
}
|
|
1514
|
+
if (message.ethAddr.length !== 0) {
|
|
1515
|
+
writer.uint32(50).bytes(message.ethAddr);
|
|
1516
|
+
}
|
|
1517
|
+
if (message.minWithdrawAmount !== 0n) {
|
|
1518
|
+
if (BigInt.asUintN(64, message.minWithdrawAmount) !== message.minWithdrawAmount) {
|
|
1519
|
+
throw new globalThis.Error("value provided for field message.minWithdrawAmount of type uint64 too large");
|
|
1520
|
+
}
|
|
1521
|
+
writer.uint32(56).uint64(message.minWithdrawAmount);
|
|
1522
|
+
}
|
|
1523
|
+
return writer;
|
|
1524
|
+
},
|
|
1525
|
+
decode(input, length) {
|
|
1526
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1527
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1528
|
+
const message = createBaseAction_CreateToken();
|
|
1529
|
+
while (reader.pos < end) {
|
|
1530
|
+
const tag = reader.uint32();
|
|
1531
|
+
switch (tag >>> 3) {
|
|
1532
|
+
case 1:
|
|
1533
|
+
if (tag !== 8) {
|
|
1534
|
+
break;
|
|
1535
|
+
}
|
|
1536
|
+
message.tokenDecimals = reader.uint32();
|
|
1537
|
+
continue;
|
|
1538
|
+
case 3:
|
|
1539
|
+
if (tag !== 24) {
|
|
1540
|
+
break;
|
|
1541
|
+
}
|
|
1542
|
+
message.weightBps = reader.uint32();
|
|
1543
|
+
continue;
|
|
1544
|
+
case 4:
|
|
1545
|
+
if (tag !== 34) {
|
|
1546
|
+
break;
|
|
1547
|
+
}
|
|
1548
|
+
message.viewSymbol = reader.string();
|
|
1549
|
+
continue;
|
|
1550
|
+
case 5:
|
|
1551
|
+
if (tag !== 42) {
|
|
1552
|
+
break;
|
|
1553
|
+
}
|
|
1554
|
+
message.oracleSymbol = reader.string();
|
|
1555
|
+
continue;
|
|
1556
|
+
case 6:
|
|
1557
|
+
if (tag !== 50) {
|
|
1558
|
+
break;
|
|
1559
|
+
}
|
|
1560
|
+
message.ethAddr = reader.bytes();
|
|
1561
|
+
continue;
|
|
1562
|
+
case 7:
|
|
1563
|
+
if (tag !== 56) {
|
|
1564
|
+
break;
|
|
1565
|
+
}
|
|
1566
|
+
message.minWithdrawAmount = reader.uint64();
|
|
1567
|
+
continue;
|
|
1568
|
+
}
|
|
1569
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
1572
|
+
reader.skip(tag & 7);
|
|
1573
|
+
}
|
|
1574
|
+
return message;
|
|
1575
|
+
},
|
|
1576
|
+
fromJSON(object) {
|
|
1577
|
+
return {
|
|
1578
|
+
tokenDecimals: isSet(object.tokenDecimals) ? globalThis.Number(object.tokenDecimals) : 0,
|
|
1579
|
+
weightBps: isSet(object.weightBps) ? globalThis.Number(object.weightBps) : 0,
|
|
1580
|
+
viewSymbol: isSet(object.viewSymbol) ? globalThis.String(object.viewSymbol) : "",
|
|
1581
|
+
oracleSymbol: isSet(object.oracleSymbol) ? globalThis.String(object.oracleSymbol) : "",
|
|
1582
|
+
ethAddr: isSet(object.ethAddr) ? bytesFromBase64(object.ethAddr) : new Uint8Array(0),
|
|
1583
|
+
minWithdrawAmount: isSet(object.minWithdrawAmount) ? BigInt(object.minWithdrawAmount) : 0n,
|
|
1584
|
+
};
|
|
1585
|
+
},
|
|
1586
|
+
toJSON(message) {
|
|
1587
|
+
const obj = {};
|
|
1588
|
+
if (message.tokenDecimals !== 0) {
|
|
1589
|
+
obj.tokenDecimals = Math.round(message.tokenDecimals);
|
|
1590
|
+
}
|
|
1591
|
+
if (message.weightBps !== 0) {
|
|
1592
|
+
obj.weightBps = Math.round(message.weightBps);
|
|
1593
|
+
}
|
|
1594
|
+
if (message.viewSymbol !== "") {
|
|
1595
|
+
obj.viewSymbol = message.viewSymbol;
|
|
1596
|
+
}
|
|
1597
|
+
if (message.oracleSymbol !== "") {
|
|
1598
|
+
obj.oracleSymbol = message.oracleSymbol;
|
|
1599
|
+
}
|
|
1600
|
+
if (message.ethAddr.length !== 0) {
|
|
1601
|
+
obj.ethAddr = base64FromBytes(message.ethAddr);
|
|
1602
|
+
}
|
|
1603
|
+
if (message.minWithdrawAmount !== 0n) {
|
|
1604
|
+
obj.minWithdrawAmount = message.minWithdrawAmount.toString();
|
|
1605
|
+
}
|
|
1606
|
+
return obj;
|
|
1607
|
+
},
|
|
1608
|
+
create(base) {
|
|
1609
|
+
return exports.Action_CreateToken.fromPartial(base ?? {});
|
|
1610
|
+
},
|
|
1611
|
+
fromPartial(object) {
|
|
1612
|
+
const message = createBaseAction_CreateToken();
|
|
1613
|
+
message.tokenDecimals = object.tokenDecimals ?? 0;
|
|
1614
|
+
message.weightBps = object.weightBps ?? 0;
|
|
1615
|
+
message.viewSymbol = object.viewSymbol ?? "";
|
|
1616
|
+
message.oracleSymbol = object.oracleSymbol ?? "";
|
|
1617
|
+
message.ethAddr = object.ethAddr ?? new Uint8Array(0);
|
|
1618
|
+
message.minWithdrawAmount = object.minWithdrawAmount ?? 0n;
|
|
1619
|
+
return message;
|
|
1620
|
+
},
|
|
1621
|
+
};
|
|
1622
|
+
function createBaseAction_CreateMarket() {
|
|
1623
|
+
return {
|
|
1624
|
+
sizeDecimals: 0,
|
|
1625
|
+
priceDecimals: 0,
|
|
1626
|
+
imfBps: 0,
|
|
1627
|
+
cmfBps: 0,
|
|
1628
|
+
mmfBps: 0,
|
|
1629
|
+
marketType: 0,
|
|
1630
|
+
viewSymbol: "",
|
|
1631
|
+
oracleSymbol: "",
|
|
1632
|
+
baseTokenId: 0,
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
exports.Action_CreateMarket = {
|
|
1636
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1637
|
+
if (message.sizeDecimals !== 0) {
|
|
1638
|
+
writer.uint32(8).uint32(message.sizeDecimals);
|
|
1639
|
+
}
|
|
1640
|
+
if (message.priceDecimals !== 0) {
|
|
1641
|
+
writer.uint32(16).uint32(message.priceDecimals);
|
|
1642
|
+
}
|
|
1643
|
+
if (message.imfBps !== 0) {
|
|
1644
|
+
writer.uint32(24).uint32(message.imfBps);
|
|
1645
|
+
}
|
|
1646
|
+
if (message.cmfBps !== 0) {
|
|
1647
|
+
writer.uint32(32).uint32(message.cmfBps);
|
|
1648
|
+
}
|
|
1649
|
+
if (message.mmfBps !== 0) {
|
|
1650
|
+
writer.uint32(40).uint32(message.mmfBps);
|
|
1651
|
+
}
|
|
1652
|
+
if (message.marketType !== 0) {
|
|
1653
|
+
writer.uint32(48).int32(message.marketType);
|
|
1654
|
+
}
|
|
1655
|
+
if (message.viewSymbol !== "") {
|
|
1656
|
+
writer.uint32(58).string(message.viewSymbol);
|
|
1657
|
+
}
|
|
1658
|
+
if (message.oracleSymbol !== "") {
|
|
1659
|
+
writer.uint32(66).string(message.oracleSymbol);
|
|
1660
|
+
}
|
|
1661
|
+
if (message.baseTokenId !== 0) {
|
|
1662
|
+
writer.uint32(72).uint32(message.baseTokenId);
|
|
1663
|
+
}
|
|
1664
|
+
return writer;
|
|
1665
|
+
},
|
|
1666
|
+
decode(input, length) {
|
|
1667
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1668
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1669
|
+
const message = createBaseAction_CreateMarket();
|
|
1670
|
+
while (reader.pos < end) {
|
|
1671
|
+
const tag = reader.uint32();
|
|
1672
|
+
switch (tag >>> 3) {
|
|
1673
|
+
case 1:
|
|
1674
|
+
if (tag !== 8) {
|
|
1675
|
+
break;
|
|
1676
|
+
}
|
|
1677
|
+
message.sizeDecimals = reader.uint32();
|
|
1678
|
+
continue;
|
|
1679
|
+
case 2:
|
|
1680
|
+
if (tag !== 16) {
|
|
1681
|
+
break;
|
|
1682
|
+
}
|
|
1683
|
+
message.priceDecimals = reader.uint32();
|
|
1684
|
+
continue;
|
|
1685
|
+
case 3:
|
|
1686
|
+
if (tag !== 24) {
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
message.imfBps = reader.uint32();
|
|
1690
|
+
continue;
|
|
1691
|
+
case 4:
|
|
1692
|
+
if (tag !== 32) {
|
|
1693
|
+
break;
|
|
1694
|
+
}
|
|
1695
|
+
message.cmfBps = reader.uint32();
|
|
1696
|
+
continue;
|
|
1697
|
+
case 5:
|
|
1698
|
+
if (tag !== 40) {
|
|
1699
|
+
break;
|
|
1700
|
+
}
|
|
1701
|
+
message.mmfBps = reader.uint32();
|
|
1702
|
+
continue;
|
|
1703
|
+
case 6:
|
|
1704
|
+
if (tag !== 48) {
|
|
1705
|
+
break;
|
|
1706
|
+
}
|
|
1707
|
+
message.marketType = reader.int32();
|
|
1708
|
+
continue;
|
|
1709
|
+
case 7:
|
|
1710
|
+
if (tag !== 58) {
|
|
1711
|
+
break;
|
|
1712
|
+
}
|
|
1713
|
+
message.viewSymbol = reader.string();
|
|
1714
|
+
continue;
|
|
1715
|
+
case 8:
|
|
1716
|
+
if (tag !== 66) {
|
|
1717
|
+
break;
|
|
1718
|
+
}
|
|
1719
|
+
message.oracleSymbol = reader.string();
|
|
1720
|
+
continue;
|
|
1721
|
+
case 9:
|
|
1722
|
+
if (tag !== 72) {
|
|
1723
|
+
break;
|
|
1724
|
+
}
|
|
1725
|
+
message.baseTokenId = reader.uint32();
|
|
1726
|
+
continue;
|
|
1727
|
+
}
|
|
1728
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1729
|
+
break;
|
|
1730
|
+
}
|
|
1731
|
+
reader.skip(tag & 7);
|
|
1732
|
+
}
|
|
1733
|
+
return message;
|
|
1734
|
+
},
|
|
1735
|
+
fromJSON(object) {
|
|
1736
|
+
return {
|
|
1737
|
+
sizeDecimals: isSet(object.sizeDecimals) ? globalThis.Number(object.sizeDecimals) : 0,
|
|
1738
|
+
priceDecimals: isSet(object.priceDecimals) ? globalThis.Number(object.priceDecimals) : 0,
|
|
1739
|
+
imfBps: isSet(object.imfBps) ? globalThis.Number(object.imfBps) : 0,
|
|
1740
|
+
cmfBps: isSet(object.cmfBps) ? globalThis.Number(object.cmfBps) : 0,
|
|
1741
|
+
mmfBps: isSet(object.mmfBps) ? globalThis.Number(object.mmfBps) : 0,
|
|
1742
|
+
marketType: isSet(object.marketType) ? marketTypeFromJSON(object.marketType) : 0,
|
|
1743
|
+
viewSymbol: isSet(object.viewSymbol) ? globalThis.String(object.viewSymbol) : "",
|
|
1744
|
+
oracleSymbol: isSet(object.oracleSymbol) ? globalThis.String(object.oracleSymbol) : "",
|
|
1745
|
+
baseTokenId: isSet(object.baseTokenId) ? globalThis.Number(object.baseTokenId) : 0,
|
|
1746
|
+
};
|
|
1747
|
+
},
|
|
1748
|
+
toJSON(message) {
|
|
1749
|
+
const obj = {};
|
|
1750
|
+
if (message.sizeDecimals !== 0) {
|
|
1751
|
+
obj.sizeDecimals = Math.round(message.sizeDecimals);
|
|
1752
|
+
}
|
|
1753
|
+
if (message.priceDecimals !== 0) {
|
|
1754
|
+
obj.priceDecimals = Math.round(message.priceDecimals);
|
|
1755
|
+
}
|
|
1756
|
+
if (message.imfBps !== 0) {
|
|
1757
|
+
obj.imfBps = Math.round(message.imfBps);
|
|
1758
|
+
}
|
|
1759
|
+
if (message.cmfBps !== 0) {
|
|
1760
|
+
obj.cmfBps = Math.round(message.cmfBps);
|
|
1761
|
+
}
|
|
1762
|
+
if (message.mmfBps !== 0) {
|
|
1763
|
+
obj.mmfBps = Math.round(message.mmfBps);
|
|
1764
|
+
}
|
|
1765
|
+
if (message.marketType !== 0) {
|
|
1766
|
+
obj.marketType = marketTypeToJSON(message.marketType);
|
|
1767
|
+
}
|
|
1768
|
+
if (message.viewSymbol !== "") {
|
|
1769
|
+
obj.viewSymbol = message.viewSymbol;
|
|
1770
|
+
}
|
|
1771
|
+
if (message.oracleSymbol !== "") {
|
|
1772
|
+
obj.oracleSymbol = message.oracleSymbol;
|
|
1773
|
+
}
|
|
1774
|
+
if (message.baseTokenId !== 0) {
|
|
1775
|
+
obj.baseTokenId = Math.round(message.baseTokenId);
|
|
1776
|
+
}
|
|
1777
|
+
return obj;
|
|
1778
|
+
},
|
|
1779
|
+
create(base) {
|
|
1780
|
+
return exports.Action_CreateMarket.fromPartial(base ?? {});
|
|
1781
|
+
},
|
|
1782
|
+
fromPartial(object) {
|
|
1783
|
+
const message = createBaseAction_CreateMarket();
|
|
1784
|
+
message.sizeDecimals = object.sizeDecimals ?? 0;
|
|
1785
|
+
message.priceDecimals = object.priceDecimals ?? 0;
|
|
1786
|
+
message.imfBps = object.imfBps ?? 0;
|
|
1787
|
+
message.cmfBps = object.cmfBps ?? 0;
|
|
1788
|
+
message.mmfBps = object.mmfBps ?? 0;
|
|
1789
|
+
message.marketType = object.marketType ?? 0;
|
|
1790
|
+
message.viewSymbol = object.viewSymbol ?? "";
|
|
1791
|
+
message.oracleSymbol = object.oracleSymbol ?? "";
|
|
1792
|
+
message.baseTokenId = object.baseTokenId ?? 0;
|
|
1793
|
+
return message;
|
|
1794
|
+
},
|
|
1795
|
+
};
|
|
1796
|
+
function createBaseAction_PlaceOrder() {
|
|
1797
|
+
return {
|
|
1798
|
+
sessionId: 0n,
|
|
1799
|
+
marketId: 0,
|
|
1800
|
+
side: 0,
|
|
1801
|
+
fillMode: 0,
|
|
1802
|
+
isReduceOnly: false,
|
|
1803
|
+
price: 0n,
|
|
1804
|
+
size: 0n,
|
|
1805
|
+
quoteSize: undefined,
|
|
1806
|
+
delegatorAccountId: undefined,
|
|
1807
|
+
clientOrderId: undefined,
|
|
1808
|
+
senderAccountId: undefined,
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
exports.Action_PlaceOrder = {
|
|
1812
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1813
|
+
if (message.sessionId !== 0n) {
|
|
1814
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
1815
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
1816
|
+
}
|
|
1817
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
1818
|
+
}
|
|
1819
|
+
if (message.marketId !== 0) {
|
|
1820
|
+
writer.uint32(16).uint32(message.marketId);
|
|
1821
|
+
}
|
|
1822
|
+
if (message.side !== 0) {
|
|
1823
|
+
writer.uint32(24).int32(message.side);
|
|
1824
|
+
}
|
|
1825
|
+
if (message.fillMode !== 0) {
|
|
1826
|
+
writer.uint32(32).int32(message.fillMode);
|
|
1827
|
+
}
|
|
1828
|
+
if (message.isReduceOnly !== false) {
|
|
1829
|
+
writer.uint32(40).bool(message.isReduceOnly);
|
|
1830
|
+
}
|
|
1831
|
+
if (message.price !== 0n) {
|
|
1832
|
+
if (BigInt.asUintN(64, message.price) !== message.price) {
|
|
1833
|
+
throw new globalThis.Error("value provided for field message.price of type uint64 too large");
|
|
1834
|
+
}
|
|
1835
|
+
writer.uint32(48).uint64(message.price);
|
|
1836
|
+
}
|
|
1837
|
+
if (message.size !== 0n) {
|
|
1838
|
+
if (BigInt.asUintN(64, message.size) !== message.size) {
|
|
1839
|
+
throw new globalThis.Error("value provided for field message.size of type uint64 too large");
|
|
1840
|
+
}
|
|
1841
|
+
writer.uint32(56).uint64(message.size);
|
|
1842
|
+
}
|
|
1843
|
+
if (message.quoteSize !== undefined) {
|
|
1844
|
+
exports.U128.encode(message.quoteSize, writer.uint32(66).fork()).join();
|
|
1845
|
+
}
|
|
1846
|
+
if (message.delegatorAccountId !== undefined) {
|
|
1847
|
+
writer.uint32(256).uint32(message.delegatorAccountId);
|
|
1848
|
+
}
|
|
1849
|
+
if (message.clientOrderId !== undefined) {
|
|
1850
|
+
if (BigInt.asUintN(64, message.clientOrderId) !== message.clientOrderId) {
|
|
1851
|
+
throw new globalThis.Error("value provided for field message.clientOrderId of type uint64 too large");
|
|
1852
|
+
}
|
|
1853
|
+
writer.uint32(264).uint64(message.clientOrderId);
|
|
1854
|
+
}
|
|
1855
|
+
if (message.senderAccountId !== undefined) {
|
|
1856
|
+
writer.uint32(272).uint32(message.senderAccountId);
|
|
1857
|
+
}
|
|
1858
|
+
return writer;
|
|
1859
|
+
},
|
|
1860
|
+
decode(input, length) {
|
|
1861
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1862
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1863
|
+
const message = createBaseAction_PlaceOrder();
|
|
1864
|
+
while (reader.pos < end) {
|
|
1865
|
+
const tag = reader.uint32();
|
|
1866
|
+
switch (tag >>> 3) {
|
|
1867
|
+
case 1:
|
|
1868
|
+
if (tag !== 8) {
|
|
1869
|
+
break;
|
|
1870
|
+
}
|
|
1871
|
+
message.sessionId = reader.uint64();
|
|
1872
|
+
continue;
|
|
1873
|
+
case 2:
|
|
1874
|
+
if (tag !== 16) {
|
|
1875
|
+
break;
|
|
1876
|
+
}
|
|
1877
|
+
message.marketId = reader.uint32();
|
|
1878
|
+
continue;
|
|
1879
|
+
case 3:
|
|
1880
|
+
if (tag !== 24) {
|
|
1881
|
+
break;
|
|
1882
|
+
}
|
|
1883
|
+
message.side = reader.int32();
|
|
1884
|
+
continue;
|
|
1885
|
+
case 4:
|
|
1886
|
+
if (tag !== 32) {
|
|
1887
|
+
break;
|
|
1888
|
+
}
|
|
1889
|
+
message.fillMode = reader.int32();
|
|
1890
|
+
continue;
|
|
1891
|
+
case 5:
|
|
1892
|
+
if (tag !== 40) {
|
|
1893
|
+
break;
|
|
1894
|
+
}
|
|
1895
|
+
message.isReduceOnly = reader.bool();
|
|
1896
|
+
continue;
|
|
1897
|
+
case 6:
|
|
1898
|
+
if (tag !== 48) {
|
|
1899
|
+
break;
|
|
1900
|
+
}
|
|
1901
|
+
message.price = reader.uint64();
|
|
1902
|
+
continue;
|
|
1903
|
+
case 7:
|
|
1904
|
+
if (tag !== 56) {
|
|
1905
|
+
break;
|
|
1906
|
+
}
|
|
1907
|
+
message.size = reader.uint64();
|
|
1908
|
+
continue;
|
|
1909
|
+
case 8:
|
|
1910
|
+
if (tag !== 66) {
|
|
1911
|
+
break;
|
|
1912
|
+
}
|
|
1913
|
+
message.quoteSize = exports.U128.decode(reader, reader.uint32());
|
|
1914
|
+
continue;
|
|
1915
|
+
case 32:
|
|
1916
|
+
if (tag !== 256) {
|
|
1917
|
+
break;
|
|
1918
|
+
}
|
|
1919
|
+
message.delegatorAccountId = reader.uint32();
|
|
1920
|
+
continue;
|
|
1921
|
+
case 33:
|
|
1922
|
+
if (tag !== 264) {
|
|
1923
|
+
break;
|
|
1924
|
+
}
|
|
1925
|
+
message.clientOrderId = reader.uint64();
|
|
1926
|
+
continue;
|
|
1927
|
+
case 34:
|
|
1928
|
+
if (tag !== 272) {
|
|
1929
|
+
break;
|
|
1930
|
+
}
|
|
1931
|
+
message.senderAccountId = reader.uint32();
|
|
1932
|
+
continue;
|
|
1933
|
+
}
|
|
1934
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1935
|
+
break;
|
|
1936
|
+
}
|
|
1937
|
+
reader.skip(tag & 7);
|
|
1938
|
+
}
|
|
1939
|
+
return message;
|
|
1940
|
+
},
|
|
1941
|
+
fromJSON(object) {
|
|
1942
|
+
return {
|
|
1943
|
+
sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
|
|
1944
|
+
marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
|
|
1945
|
+
side: isSet(object.side) ? sideFromJSON(object.side) : 0,
|
|
1946
|
+
fillMode: isSet(object.fillMode) ? fillModeFromJSON(object.fillMode) : 0,
|
|
1947
|
+
isReduceOnly: isSet(object.isReduceOnly) ? globalThis.Boolean(object.isReduceOnly) : false,
|
|
1948
|
+
price: isSet(object.price) ? BigInt(object.price) : 0n,
|
|
1949
|
+
size: isSet(object.size) ? BigInt(object.size) : 0n,
|
|
1950
|
+
quoteSize: isSet(object.quoteSize) ? exports.U128.fromJSON(object.quoteSize) : undefined,
|
|
1951
|
+
delegatorAccountId: isSet(object.delegatorAccountId) ? globalThis.Number(object.delegatorAccountId) : undefined,
|
|
1952
|
+
clientOrderId: isSet(object.clientOrderId) ? BigInt(object.clientOrderId) : undefined,
|
|
1953
|
+
senderAccountId: isSet(object.senderAccountId) ? globalThis.Number(object.senderAccountId) : undefined,
|
|
1954
|
+
};
|
|
1955
|
+
},
|
|
1956
|
+
toJSON(message) {
|
|
1957
|
+
const obj = {};
|
|
1958
|
+
if (message.sessionId !== 0n) {
|
|
1959
|
+
obj.sessionId = message.sessionId.toString();
|
|
1960
|
+
}
|
|
1961
|
+
if (message.marketId !== 0) {
|
|
1962
|
+
obj.marketId = Math.round(message.marketId);
|
|
1963
|
+
}
|
|
1964
|
+
if (message.side !== 0) {
|
|
1965
|
+
obj.side = sideToJSON(message.side);
|
|
1966
|
+
}
|
|
1967
|
+
if (message.fillMode !== 0) {
|
|
1968
|
+
obj.fillMode = fillModeToJSON(message.fillMode);
|
|
1969
|
+
}
|
|
1970
|
+
if (message.isReduceOnly !== false) {
|
|
1971
|
+
obj.isReduceOnly = message.isReduceOnly;
|
|
1972
|
+
}
|
|
1973
|
+
if (message.price !== 0n) {
|
|
1974
|
+
obj.price = message.price.toString();
|
|
1975
|
+
}
|
|
1976
|
+
if (message.size !== 0n) {
|
|
1977
|
+
obj.size = message.size.toString();
|
|
1978
|
+
}
|
|
1979
|
+
if (message.quoteSize !== undefined) {
|
|
1980
|
+
obj.quoteSize = exports.U128.toJSON(message.quoteSize);
|
|
1981
|
+
}
|
|
1982
|
+
if (message.delegatorAccountId !== undefined) {
|
|
1983
|
+
obj.delegatorAccountId = Math.round(message.delegatorAccountId);
|
|
1984
|
+
}
|
|
1985
|
+
if (message.clientOrderId !== undefined) {
|
|
1986
|
+
obj.clientOrderId = message.clientOrderId.toString();
|
|
1987
|
+
}
|
|
1988
|
+
if (message.senderAccountId !== undefined) {
|
|
1989
|
+
obj.senderAccountId = Math.round(message.senderAccountId);
|
|
1990
|
+
}
|
|
1991
|
+
return obj;
|
|
1992
|
+
},
|
|
1993
|
+
create(base) {
|
|
1994
|
+
return exports.Action_PlaceOrder.fromPartial(base ?? {});
|
|
1995
|
+
},
|
|
1996
|
+
fromPartial(object) {
|
|
1997
|
+
const message = createBaseAction_PlaceOrder();
|
|
1998
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
1999
|
+
message.marketId = object.marketId ?? 0;
|
|
2000
|
+
message.side = object.side ?? 0;
|
|
2001
|
+
message.fillMode = object.fillMode ?? 0;
|
|
2002
|
+
message.isReduceOnly = object.isReduceOnly ?? false;
|
|
2003
|
+
message.price = object.price ?? 0n;
|
|
2004
|
+
message.size = object.size ?? 0n;
|
|
2005
|
+
message.quoteSize = (object.quoteSize !== undefined && object.quoteSize !== null)
|
|
2006
|
+
? exports.U128.fromPartial(object.quoteSize)
|
|
2007
|
+
: undefined;
|
|
2008
|
+
message.delegatorAccountId = object.delegatorAccountId ?? undefined;
|
|
2009
|
+
message.clientOrderId = object.clientOrderId ?? undefined;
|
|
2010
|
+
message.senderAccountId = object.senderAccountId ?? undefined;
|
|
2011
|
+
return message;
|
|
2012
|
+
},
|
|
2013
|
+
};
|
|
2014
|
+
function createBaseAction_CancelOrderById() {
|
|
2015
|
+
return { sessionId: 0n, orderId: 0n, delegatorAccountId: undefined, senderAccountId: undefined };
|
|
2016
|
+
}
|
|
2017
|
+
exports.Action_CancelOrderById = {
|
|
2018
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2019
|
+
if (message.sessionId !== 0n) {
|
|
2020
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
2021
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
2022
|
+
}
|
|
2023
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
2024
|
+
}
|
|
2025
|
+
if (message.orderId !== 0n) {
|
|
2026
|
+
if (BigInt.asUintN(64, message.orderId) !== message.orderId) {
|
|
2027
|
+
throw new globalThis.Error("value provided for field message.orderId of type uint64 too large");
|
|
2028
|
+
}
|
|
2029
|
+
writer.uint32(16).uint64(message.orderId);
|
|
2030
|
+
}
|
|
2031
|
+
if (message.delegatorAccountId !== undefined) {
|
|
2032
|
+
writer.uint32(256).uint32(message.delegatorAccountId);
|
|
2033
|
+
}
|
|
2034
|
+
if (message.senderAccountId !== undefined) {
|
|
2035
|
+
writer.uint32(264).uint32(message.senderAccountId);
|
|
2036
|
+
}
|
|
2037
|
+
return writer;
|
|
2038
|
+
},
|
|
2039
|
+
decode(input, length) {
|
|
2040
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2041
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2042
|
+
const message = createBaseAction_CancelOrderById();
|
|
2043
|
+
while (reader.pos < end) {
|
|
2044
|
+
const tag = reader.uint32();
|
|
2045
|
+
switch (tag >>> 3) {
|
|
2046
|
+
case 1:
|
|
2047
|
+
if (tag !== 8) {
|
|
2048
|
+
break;
|
|
2049
|
+
}
|
|
2050
|
+
message.sessionId = reader.uint64();
|
|
2051
|
+
continue;
|
|
2052
|
+
case 2:
|
|
2053
|
+
if (tag !== 16) {
|
|
2054
|
+
break;
|
|
2055
|
+
}
|
|
2056
|
+
message.orderId = reader.uint64();
|
|
2057
|
+
continue;
|
|
2058
|
+
case 32:
|
|
2059
|
+
if (tag !== 256) {
|
|
2060
|
+
break;
|
|
2061
|
+
}
|
|
2062
|
+
message.delegatorAccountId = reader.uint32();
|
|
2063
|
+
continue;
|
|
2064
|
+
case 33:
|
|
2065
|
+
if (tag !== 264) {
|
|
2066
|
+
break;
|
|
2067
|
+
}
|
|
2068
|
+
message.senderAccountId = reader.uint32();
|
|
2069
|
+
continue;
|
|
2070
|
+
}
|
|
2071
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2072
|
+
break;
|
|
2073
|
+
}
|
|
2074
|
+
reader.skip(tag & 7);
|
|
2075
|
+
}
|
|
2076
|
+
return message;
|
|
2077
|
+
},
|
|
2078
|
+
fromJSON(object) {
|
|
2079
|
+
return {
|
|
2080
|
+
sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
|
|
2081
|
+
orderId: isSet(object.orderId) ? BigInt(object.orderId) : 0n,
|
|
2082
|
+
delegatorAccountId: isSet(object.delegatorAccountId) ? globalThis.Number(object.delegatorAccountId) : undefined,
|
|
2083
|
+
senderAccountId: isSet(object.senderAccountId) ? globalThis.Number(object.senderAccountId) : undefined,
|
|
2084
|
+
};
|
|
2085
|
+
},
|
|
2086
|
+
toJSON(message) {
|
|
2087
|
+
const obj = {};
|
|
2088
|
+
if (message.sessionId !== 0n) {
|
|
2089
|
+
obj.sessionId = message.sessionId.toString();
|
|
2090
|
+
}
|
|
2091
|
+
if (message.orderId !== 0n) {
|
|
2092
|
+
obj.orderId = message.orderId.toString();
|
|
2093
|
+
}
|
|
2094
|
+
if (message.delegatorAccountId !== undefined) {
|
|
2095
|
+
obj.delegatorAccountId = Math.round(message.delegatorAccountId);
|
|
2096
|
+
}
|
|
2097
|
+
if (message.senderAccountId !== undefined) {
|
|
2098
|
+
obj.senderAccountId = Math.round(message.senderAccountId);
|
|
2099
|
+
}
|
|
2100
|
+
return obj;
|
|
2101
|
+
},
|
|
2102
|
+
create(base) {
|
|
2103
|
+
return exports.Action_CancelOrderById.fromPartial(base ?? {});
|
|
2104
|
+
},
|
|
2105
|
+
fromPartial(object) {
|
|
2106
|
+
const message = createBaseAction_CancelOrderById();
|
|
2107
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
2108
|
+
message.orderId = object.orderId ?? 0n;
|
|
2109
|
+
message.delegatorAccountId = object.delegatorAccountId ?? undefined;
|
|
2110
|
+
message.senderAccountId = object.senderAccountId ?? undefined;
|
|
2111
|
+
return message;
|
|
2112
|
+
},
|
|
2113
|
+
};
|
|
2114
|
+
function createBaseAction_Deposit() {
|
|
2115
|
+
return { actionNonce: 0n, tokenAddr: new Uint8Array(0), amount: 0n, userPubkey: new Uint8Array(0) };
|
|
2116
|
+
}
|
|
2117
|
+
exports.Action_Deposit = {
|
|
2118
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2119
|
+
if (message.actionNonce !== 0n) {
|
|
2120
|
+
if (BigInt.asUintN(64, message.actionNonce) !== message.actionNonce) {
|
|
2121
|
+
throw new globalThis.Error("value provided for field message.actionNonce of type uint64 too large");
|
|
2122
|
+
}
|
|
2123
|
+
writer.uint32(8).uint64(message.actionNonce);
|
|
2124
|
+
}
|
|
2125
|
+
if (message.tokenAddr.length !== 0) {
|
|
2126
|
+
writer.uint32(18).bytes(message.tokenAddr);
|
|
2127
|
+
}
|
|
2128
|
+
if (message.amount !== 0n) {
|
|
2129
|
+
if (BigInt.asUintN(64, message.amount) !== message.amount) {
|
|
2130
|
+
throw new globalThis.Error("value provided for field message.amount of type uint64 too large");
|
|
2131
|
+
}
|
|
2132
|
+
writer.uint32(24).uint64(message.amount);
|
|
2133
|
+
}
|
|
2134
|
+
if (message.userPubkey.length !== 0) {
|
|
2135
|
+
writer.uint32(34).bytes(message.userPubkey);
|
|
2136
|
+
}
|
|
2137
|
+
return writer;
|
|
2138
|
+
},
|
|
2139
|
+
decode(input, length) {
|
|
2140
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2141
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2142
|
+
const message = createBaseAction_Deposit();
|
|
2143
|
+
while (reader.pos < end) {
|
|
2144
|
+
const tag = reader.uint32();
|
|
2145
|
+
switch (tag >>> 3) {
|
|
2146
|
+
case 1:
|
|
2147
|
+
if (tag !== 8) {
|
|
2148
|
+
break;
|
|
2149
|
+
}
|
|
2150
|
+
message.actionNonce = reader.uint64();
|
|
2151
|
+
continue;
|
|
2152
|
+
case 2:
|
|
2153
|
+
if (tag !== 18) {
|
|
2154
|
+
break;
|
|
2155
|
+
}
|
|
2156
|
+
message.tokenAddr = reader.bytes();
|
|
2157
|
+
continue;
|
|
2158
|
+
case 3:
|
|
2159
|
+
if (tag !== 24) {
|
|
2160
|
+
break;
|
|
2161
|
+
}
|
|
2162
|
+
message.amount = reader.uint64();
|
|
2163
|
+
continue;
|
|
2164
|
+
case 4:
|
|
2165
|
+
if (tag !== 34) {
|
|
2166
|
+
break;
|
|
2167
|
+
}
|
|
2168
|
+
message.userPubkey = reader.bytes();
|
|
2169
|
+
continue;
|
|
2170
|
+
}
|
|
2171
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2172
|
+
break;
|
|
2173
|
+
}
|
|
2174
|
+
reader.skip(tag & 7);
|
|
2175
|
+
}
|
|
2176
|
+
return message;
|
|
2177
|
+
},
|
|
2178
|
+
fromJSON(object) {
|
|
2179
|
+
return {
|
|
2180
|
+
actionNonce: isSet(object.actionNonce) ? BigInt(object.actionNonce) : 0n,
|
|
2181
|
+
tokenAddr: isSet(object.tokenAddr) ? bytesFromBase64(object.tokenAddr) : new Uint8Array(0),
|
|
2182
|
+
amount: isSet(object.amount) ? BigInt(object.amount) : 0n,
|
|
2183
|
+
userPubkey: isSet(object.userPubkey) ? bytesFromBase64(object.userPubkey) : new Uint8Array(0),
|
|
2184
|
+
};
|
|
2185
|
+
},
|
|
2186
|
+
toJSON(message) {
|
|
2187
|
+
const obj = {};
|
|
2188
|
+
if (message.actionNonce !== 0n) {
|
|
2189
|
+
obj.actionNonce = message.actionNonce.toString();
|
|
2190
|
+
}
|
|
2191
|
+
if (message.tokenAddr.length !== 0) {
|
|
2192
|
+
obj.tokenAddr = base64FromBytes(message.tokenAddr);
|
|
2193
|
+
}
|
|
2194
|
+
if (message.amount !== 0n) {
|
|
2195
|
+
obj.amount = message.amount.toString();
|
|
2196
|
+
}
|
|
2197
|
+
if (message.userPubkey.length !== 0) {
|
|
2198
|
+
obj.userPubkey = base64FromBytes(message.userPubkey);
|
|
2199
|
+
}
|
|
2200
|
+
return obj;
|
|
2201
|
+
},
|
|
2202
|
+
create(base) {
|
|
2203
|
+
return exports.Action_Deposit.fromPartial(base ?? {});
|
|
2204
|
+
},
|
|
2205
|
+
fromPartial(object) {
|
|
2206
|
+
const message = createBaseAction_Deposit();
|
|
2207
|
+
message.actionNonce = object.actionNonce ?? 0n;
|
|
2208
|
+
message.tokenAddr = object.tokenAddr ?? new Uint8Array(0);
|
|
2209
|
+
message.amount = object.amount ?? 0n;
|
|
2210
|
+
message.userPubkey = object.userPubkey ?? new Uint8Array(0);
|
|
2211
|
+
return message;
|
|
2212
|
+
},
|
|
2213
|
+
};
|
|
2214
|
+
function createBaseAction_Withdraw() {
|
|
2215
|
+
return { tokenId: 0, sessionId: 0n, amount: 0n };
|
|
2216
|
+
}
|
|
2217
|
+
exports.Action_Withdraw = {
|
|
2218
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2219
|
+
if (message.tokenId !== 0) {
|
|
2220
|
+
writer.uint32(8).uint32(message.tokenId);
|
|
2221
|
+
}
|
|
2222
|
+
if (message.sessionId !== 0n) {
|
|
2223
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
2224
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
2225
|
+
}
|
|
2226
|
+
writer.uint32(16).uint64(message.sessionId);
|
|
2227
|
+
}
|
|
2228
|
+
if (message.amount !== 0n) {
|
|
2229
|
+
if (BigInt.asUintN(64, message.amount) !== message.amount) {
|
|
2230
|
+
throw new globalThis.Error("value provided for field message.amount of type uint64 too large");
|
|
2231
|
+
}
|
|
2232
|
+
writer.uint32(24).uint64(message.amount);
|
|
2233
|
+
}
|
|
2234
|
+
return writer;
|
|
2235
|
+
},
|
|
2236
|
+
decode(input, length) {
|
|
2237
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2238
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2239
|
+
const message = createBaseAction_Withdraw();
|
|
2240
|
+
while (reader.pos < end) {
|
|
2241
|
+
const tag = reader.uint32();
|
|
2242
|
+
switch (tag >>> 3) {
|
|
2243
|
+
case 1:
|
|
2244
|
+
if (tag !== 8) {
|
|
2245
|
+
break;
|
|
2246
|
+
}
|
|
2247
|
+
message.tokenId = reader.uint32();
|
|
2248
|
+
continue;
|
|
2249
|
+
case 2:
|
|
2250
|
+
if (tag !== 16) {
|
|
2251
|
+
break;
|
|
2252
|
+
}
|
|
2253
|
+
message.sessionId = reader.uint64();
|
|
2254
|
+
continue;
|
|
2255
|
+
case 3:
|
|
2256
|
+
if (tag !== 24) {
|
|
2257
|
+
break;
|
|
2258
|
+
}
|
|
2259
|
+
message.amount = reader.uint64();
|
|
2260
|
+
continue;
|
|
2261
|
+
}
|
|
2262
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2263
|
+
break;
|
|
2264
|
+
}
|
|
2265
|
+
reader.skip(tag & 7);
|
|
2266
|
+
}
|
|
2267
|
+
return message;
|
|
2268
|
+
},
|
|
2269
|
+
fromJSON(object) {
|
|
2270
|
+
return {
|
|
2271
|
+
tokenId: isSet(object.tokenId) ? globalThis.Number(object.tokenId) : 0,
|
|
2272
|
+
sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
|
|
2273
|
+
amount: isSet(object.amount) ? BigInt(object.amount) : 0n,
|
|
2274
|
+
};
|
|
2275
|
+
},
|
|
2276
|
+
toJSON(message) {
|
|
2277
|
+
const obj = {};
|
|
2278
|
+
if (message.tokenId !== 0) {
|
|
2279
|
+
obj.tokenId = Math.round(message.tokenId);
|
|
2280
|
+
}
|
|
2281
|
+
if (message.sessionId !== 0n) {
|
|
2282
|
+
obj.sessionId = message.sessionId.toString();
|
|
2283
|
+
}
|
|
2284
|
+
if (message.amount !== 0n) {
|
|
2285
|
+
obj.amount = message.amount.toString();
|
|
2286
|
+
}
|
|
2287
|
+
return obj;
|
|
2288
|
+
},
|
|
2289
|
+
create(base) {
|
|
2290
|
+
return exports.Action_Withdraw.fromPartial(base ?? {});
|
|
2291
|
+
},
|
|
2292
|
+
fromPartial(object) {
|
|
2293
|
+
const message = createBaseAction_Withdraw();
|
|
2294
|
+
message.tokenId = object.tokenId ?? 0;
|
|
2295
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
2296
|
+
message.amount = object.amount ?? 0n;
|
|
2297
|
+
return message;
|
|
2298
|
+
},
|
|
2299
|
+
};
|
|
2300
|
+
function createBaseAction_PythSetWormholeGuardians() {
|
|
2301
|
+
return { guardianSetIndex: 0, addresses: [] };
|
|
2302
|
+
}
|
|
2303
|
+
exports.Action_PythSetWormholeGuardians = {
|
|
2304
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2305
|
+
if (message.guardianSetIndex !== 0) {
|
|
2306
|
+
writer.uint32(8).uint32(message.guardianSetIndex);
|
|
2307
|
+
}
|
|
2308
|
+
for (const v of message.addresses) {
|
|
2309
|
+
writer.uint32(18).bytes(v);
|
|
2310
|
+
}
|
|
2311
|
+
return writer;
|
|
2312
|
+
},
|
|
2313
|
+
decode(input, length) {
|
|
2314
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2315
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2316
|
+
const message = createBaseAction_PythSetWormholeGuardians();
|
|
2317
|
+
while (reader.pos < end) {
|
|
2318
|
+
const tag = reader.uint32();
|
|
2319
|
+
switch (tag >>> 3) {
|
|
2320
|
+
case 1:
|
|
2321
|
+
if (tag !== 8) {
|
|
2322
|
+
break;
|
|
2323
|
+
}
|
|
2324
|
+
message.guardianSetIndex = reader.uint32();
|
|
2325
|
+
continue;
|
|
2326
|
+
case 2:
|
|
2327
|
+
if (tag !== 18) {
|
|
2328
|
+
break;
|
|
2329
|
+
}
|
|
2330
|
+
message.addresses.push(reader.bytes());
|
|
2331
|
+
continue;
|
|
2332
|
+
}
|
|
2333
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2334
|
+
break;
|
|
2335
|
+
}
|
|
2336
|
+
reader.skip(tag & 7);
|
|
2337
|
+
}
|
|
2338
|
+
return message;
|
|
2339
|
+
},
|
|
2340
|
+
fromJSON(object) {
|
|
2341
|
+
return {
|
|
2342
|
+
guardianSetIndex: isSet(object.guardianSetIndex) ? globalThis.Number(object.guardianSetIndex) : 0,
|
|
2343
|
+
addresses: globalThis.Array.isArray(object?.addresses)
|
|
2344
|
+
? object.addresses.map((e) => bytesFromBase64(e))
|
|
2345
|
+
: [],
|
|
2346
|
+
};
|
|
2347
|
+
},
|
|
2348
|
+
toJSON(message) {
|
|
2349
|
+
const obj = {};
|
|
2350
|
+
if (message.guardianSetIndex !== 0) {
|
|
2351
|
+
obj.guardianSetIndex = Math.round(message.guardianSetIndex);
|
|
2352
|
+
}
|
|
2353
|
+
if (message.addresses?.length) {
|
|
2354
|
+
obj.addresses = message.addresses.map((e) => base64FromBytes(e));
|
|
2355
|
+
}
|
|
2356
|
+
return obj;
|
|
2357
|
+
},
|
|
2358
|
+
create(base) {
|
|
2359
|
+
return exports.Action_PythSetWormholeGuardians.fromPartial(base ?? {});
|
|
2360
|
+
},
|
|
2361
|
+
fromPartial(object) {
|
|
2362
|
+
const message = createBaseAction_PythSetWormholeGuardians();
|
|
2363
|
+
message.guardianSetIndex = object.guardianSetIndex ?? 0;
|
|
2364
|
+
message.addresses = object.addresses?.map((e) => e) || [];
|
|
2365
|
+
return message;
|
|
2366
|
+
},
|
|
2367
|
+
};
|
|
2368
|
+
function createBaseAction_PythSetSymbolFeed() {
|
|
2369
|
+
return { oracleSymbol: "", priceFeedId: new Uint8Array(0) };
|
|
2370
|
+
}
|
|
2371
|
+
exports.Action_PythSetSymbolFeed = {
|
|
2372
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2373
|
+
if (message.oracleSymbol !== "") {
|
|
2374
|
+
writer.uint32(10).string(message.oracleSymbol);
|
|
2375
|
+
}
|
|
2376
|
+
if (message.priceFeedId.length !== 0) {
|
|
2377
|
+
writer.uint32(18).bytes(message.priceFeedId);
|
|
2378
|
+
}
|
|
2379
|
+
return writer;
|
|
2380
|
+
},
|
|
2381
|
+
decode(input, length) {
|
|
2382
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2383
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2384
|
+
const message = createBaseAction_PythSetSymbolFeed();
|
|
2385
|
+
while (reader.pos < end) {
|
|
2386
|
+
const tag = reader.uint32();
|
|
2387
|
+
switch (tag >>> 3) {
|
|
2388
|
+
case 1:
|
|
2389
|
+
if (tag !== 10) {
|
|
2390
|
+
break;
|
|
2391
|
+
}
|
|
2392
|
+
message.oracleSymbol = reader.string();
|
|
2393
|
+
continue;
|
|
2394
|
+
case 2:
|
|
2395
|
+
if (tag !== 18) {
|
|
2396
|
+
break;
|
|
2397
|
+
}
|
|
2398
|
+
message.priceFeedId = reader.bytes();
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
2401
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2402
|
+
break;
|
|
2403
|
+
}
|
|
2404
|
+
reader.skip(tag & 7);
|
|
2405
|
+
}
|
|
2406
|
+
return message;
|
|
2407
|
+
},
|
|
2408
|
+
fromJSON(object) {
|
|
2409
|
+
return {
|
|
2410
|
+
oracleSymbol: isSet(object.oracleSymbol) ? globalThis.String(object.oracleSymbol) : "",
|
|
2411
|
+
priceFeedId: isSet(object.priceFeedId) ? bytesFromBase64(object.priceFeedId) : new Uint8Array(0),
|
|
2412
|
+
};
|
|
2413
|
+
},
|
|
2414
|
+
toJSON(message) {
|
|
2415
|
+
const obj = {};
|
|
2416
|
+
if (message.oracleSymbol !== "") {
|
|
2417
|
+
obj.oracleSymbol = message.oracleSymbol;
|
|
2418
|
+
}
|
|
2419
|
+
if (message.priceFeedId.length !== 0) {
|
|
2420
|
+
obj.priceFeedId = base64FromBytes(message.priceFeedId);
|
|
2421
|
+
}
|
|
2422
|
+
return obj;
|
|
2423
|
+
},
|
|
2424
|
+
create(base) {
|
|
2425
|
+
return exports.Action_PythSetSymbolFeed.fromPartial(base ?? {});
|
|
2426
|
+
},
|
|
2427
|
+
fromPartial(object) {
|
|
2428
|
+
const message = createBaseAction_PythSetSymbolFeed();
|
|
2429
|
+
message.oracleSymbol = object.oracleSymbol ?? "";
|
|
2430
|
+
message.priceFeedId = object.priceFeedId ?? new Uint8Array(0);
|
|
2431
|
+
return message;
|
|
2432
|
+
},
|
|
2433
|
+
};
|
|
2434
|
+
function createBaseAction_PythPriceFeedUpdate() {
|
|
2435
|
+
return { rawPythnetData: new Uint8Array(0) };
|
|
2436
|
+
}
|
|
2437
|
+
exports.Action_PythPriceFeedUpdate = {
|
|
2438
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2439
|
+
if (message.rawPythnetData.length !== 0) {
|
|
2440
|
+
writer.uint32(10).bytes(message.rawPythnetData);
|
|
2441
|
+
}
|
|
2442
|
+
return writer;
|
|
2443
|
+
},
|
|
2444
|
+
decode(input, length) {
|
|
2445
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2446
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2447
|
+
const message = createBaseAction_PythPriceFeedUpdate();
|
|
2448
|
+
while (reader.pos < end) {
|
|
2449
|
+
const tag = reader.uint32();
|
|
2450
|
+
switch (tag >>> 3) {
|
|
2451
|
+
case 1:
|
|
2452
|
+
if (tag !== 10) {
|
|
2453
|
+
break;
|
|
2454
|
+
}
|
|
2455
|
+
message.rawPythnetData = reader.bytes();
|
|
2456
|
+
continue;
|
|
2457
|
+
}
|
|
2458
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2459
|
+
break;
|
|
2460
|
+
}
|
|
2461
|
+
reader.skip(tag & 7);
|
|
2462
|
+
}
|
|
2463
|
+
return message;
|
|
2464
|
+
},
|
|
2465
|
+
fromJSON(object) {
|
|
2466
|
+
return {
|
|
2467
|
+
rawPythnetData: isSet(object.rawPythnetData) ? bytesFromBase64(object.rawPythnetData) : new Uint8Array(0),
|
|
2468
|
+
};
|
|
2469
|
+
},
|
|
2470
|
+
toJSON(message) {
|
|
2471
|
+
const obj = {};
|
|
2472
|
+
if (message.rawPythnetData.length !== 0) {
|
|
2473
|
+
obj.rawPythnetData = base64FromBytes(message.rawPythnetData);
|
|
2474
|
+
}
|
|
2475
|
+
return obj;
|
|
2476
|
+
},
|
|
2477
|
+
create(base) {
|
|
2478
|
+
return exports.Action_PythPriceFeedUpdate.fromPartial(base ?? {});
|
|
2479
|
+
},
|
|
2480
|
+
fromPartial(object) {
|
|
2481
|
+
const message = createBaseAction_PythPriceFeedUpdate();
|
|
2482
|
+
message.rawPythnetData = object.rawPythnetData ?? new Uint8Array(0);
|
|
2483
|
+
return message;
|
|
2484
|
+
},
|
|
2485
|
+
};
|
|
2486
|
+
function createBaseAction_Liquidate() {
|
|
2487
|
+
return { liquidatorSessionId: 0n, liquidateeAccountId: 0, liquidatorAccountId: undefined };
|
|
2488
|
+
}
|
|
2489
|
+
exports.Action_Liquidate = {
|
|
2490
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2491
|
+
if (message.liquidatorSessionId !== 0n) {
|
|
2492
|
+
if (BigInt.asUintN(64, message.liquidatorSessionId) !== message.liquidatorSessionId) {
|
|
2493
|
+
throw new globalThis.Error("value provided for field message.liquidatorSessionId of type uint64 too large");
|
|
2494
|
+
}
|
|
2495
|
+
writer.uint32(8).uint64(message.liquidatorSessionId);
|
|
2496
|
+
}
|
|
2497
|
+
if (message.liquidateeAccountId !== 0) {
|
|
2498
|
+
writer.uint32(16).uint32(message.liquidateeAccountId);
|
|
2499
|
+
}
|
|
2500
|
+
if (message.liquidatorAccountId !== undefined) {
|
|
2501
|
+
writer.uint32(24).uint32(message.liquidatorAccountId);
|
|
2502
|
+
}
|
|
2503
|
+
return writer;
|
|
2504
|
+
},
|
|
2505
|
+
decode(input, length) {
|
|
2506
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2507
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2508
|
+
const message = createBaseAction_Liquidate();
|
|
2509
|
+
while (reader.pos < end) {
|
|
2510
|
+
const tag = reader.uint32();
|
|
2511
|
+
switch (tag >>> 3) {
|
|
2512
|
+
case 1:
|
|
2513
|
+
if (tag !== 8) {
|
|
2514
|
+
break;
|
|
2515
|
+
}
|
|
2516
|
+
message.liquidatorSessionId = reader.uint64();
|
|
2517
|
+
continue;
|
|
2518
|
+
case 2:
|
|
2519
|
+
if (tag !== 16) {
|
|
2520
|
+
break;
|
|
2521
|
+
}
|
|
2522
|
+
message.liquidateeAccountId = reader.uint32();
|
|
2523
|
+
continue;
|
|
2524
|
+
case 3:
|
|
2525
|
+
if (tag !== 24) {
|
|
2526
|
+
break;
|
|
2527
|
+
}
|
|
2528
|
+
message.liquidatorAccountId = reader.uint32();
|
|
2529
|
+
continue;
|
|
2530
|
+
}
|
|
2531
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2532
|
+
break;
|
|
2533
|
+
}
|
|
2534
|
+
reader.skip(tag & 7);
|
|
2535
|
+
}
|
|
2536
|
+
return message;
|
|
2537
|
+
},
|
|
2538
|
+
fromJSON(object) {
|
|
2539
|
+
return {
|
|
2540
|
+
liquidatorSessionId: isSet(object.liquidatorSessionId) ? BigInt(object.liquidatorSessionId) : 0n,
|
|
2541
|
+
liquidateeAccountId: isSet(object.liquidateeAccountId) ? globalThis.Number(object.liquidateeAccountId) : 0,
|
|
2542
|
+
liquidatorAccountId: isSet(object.liquidatorAccountId)
|
|
2543
|
+
? globalThis.Number(object.liquidatorAccountId)
|
|
2544
|
+
: undefined,
|
|
2545
|
+
};
|
|
2546
|
+
},
|
|
2547
|
+
toJSON(message) {
|
|
2548
|
+
const obj = {};
|
|
2549
|
+
if (message.liquidatorSessionId !== 0n) {
|
|
2550
|
+
obj.liquidatorSessionId = message.liquidatorSessionId.toString();
|
|
2551
|
+
}
|
|
2552
|
+
if (message.liquidateeAccountId !== 0) {
|
|
2553
|
+
obj.liquidateeAccountId = Math.round(message.liquidateeAccountId);
|
|
2554
|
+
}
|
|
2555
|
+
if (message.liquidatorAccountId !== undefined) {
|
|
2556
|
+
obj.liquidatorAccountId = Math.round(message.liquidatorAccountId);
|
|
2557
|
+
}
|
|
2558
|
+
return obj;
|
|
2559
|
+
},
|
|
2560
|
+
create(base) {
|
|
2561
|
+
return exports.Action_Liquidate.fromPartial(base ?? {});
|
|
2562
|
+
},
|
|
2563
|
+
fromPartial(object) {
|
|
2564
|
+
const message = createBaseAction_Liquidate();
|
|
2565
|
+
message.liquidatorSessionId = object.liquidatorSessionId ?? 0n;
|
|
2566
|
+
message.liquidateeAccountId = object.liquidateeAccountId ?? 0;
|
|
2567
|
+
message.liquidatorAccountId = object.liquidatorAccountId ?? undefined;
|
|
2568
|
+
return message;
|
|
2569
|
+
},
|
|
2570
|
+
};
|
|
2571
|
+
function createBaseAction_RevokeSession() {
|
|
2572
|
+
return { sessionId: 0n };
|
|
2573
|
+
}
|
|
2574
|
+
exports.Action_RevokeSession = {
|
|
2575
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2576
|
+
if (message.sessionId !== 0n) {
|
|
2577
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
2578
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
2579
|
+
}
|
|
2580
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
2581
|
+
}
|
|
2582
|
+
return writer;
|
|
2583
|
+
},
|
|
2584
|
+
decode(input, length) {
|
|
2585
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2586
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2587
|
+
const message = createBaseAction_RevokeSession();
|
|
2588
|
+
while (reader.pos < end) {
|
|
2589
|
+
const tag = reader.uint32();
|
|
2590
|
+
switch (tag >>> 3) {
|
|
2591
|
+
case 1:
|
|
2592
|
+
if (tag !== 8) {
|
|
2593
|
+
break;
|
|
2594
|
+
}
|
|
2595
|
+
message.sessionId = reader.uint64();
|
|
2596
|
+
continue;
|
|
2597
|
+
}
|
|
2598
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2599
|
+
break;
|
|
2600
|
+
}
|
|
2601
|
+
reader.skip(tag & 7);
|
|
2602
|
+
}
|
|
2603
|
+
return message;
|
|
2604
|
+
},
|
|
2605
|
+
fromJSON(object) {
|
|
2606
|
+
return { sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n };
|
|
2607
|
+
},
|
|
2608
|
+
toJSON(message) {
|
|
2609
|
+
const obj = {};
|
|
2610
|
+
if (message.sessionId !== 0n) {
|
|
2611
|
+
obj.sessionId = message.sessionId.toString();
|
|
2612
|
+
}
|
|
2613
|
+
return obj;
|
|
2614
|
+
},
|
|
2615
|
+
create(base) {
|
|
2616
|
+
return exports.Action_RevokeSession.fromPartial(base ?? {});
|
|
2617
|
+
},
|
|
2618
|
+
fromPartial(object) {
|
|
2619
|
+
const message = createBaseAction_RevokeSession();
|
|
2620
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
2621
|
+
return message;
|
|
2622
|
+
},
|
|
2623
|
+
};
|
|
2624
|
+
function createBaseAction_Pause() {
|
|
2625
|
+
return {};
|
|
2626
|
+
}
|
|
2627
|
+
exports.Action_Pause = {
|
|
2628
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
2629
|
+
return writer;
|
|
2630
|
+
},
|
|
2631
|
+
decode(input, length) {
|
|
2632
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2633
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2634
|
+
const message = createBaseAction_Pause();
|
|
2635
|
+
while (reader.pos < end) {
|
|
2636
|
+
const tag = reader.uint32();
|
|
2637
|
+
switch (tag >>> 3) {
|
|
2638
|
+
}
|
|
2639
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2640
|
+
break;
|
|
2641
|
+
}
|
|
2642
|
+
reader.skip(tag & 7);
|
|
2643
|
+
}
|
|
2644
|
+
return message;
|
|
2645
|
+
},
|
|
2646
|
+
fromJSON(_) {
|
|
2647
|
+
return {};
|
|
2648
|
+
},
|
|
2649
|
+
toJSON(_) {
|
|
2650
|
+
const obj = {};
|
|
2651
|
+
return obj;
|
|
2652
|
+
},
|
|
2653
|
+
create(base) {
|
|
2654
|
+
return exports.Action_Pause.fromPartial(base ?? {});
|
|
2655
|
+
},
|
|
2656
|
+
fromPartial(_) {
|
|
2657
|
+
const message = createBaseAction_Pause();
|
|
2658
|
+
return message;
|
|
2659
|
+
},
|
|
2660
|
+
};
|
|
2661
|
+
function createBaseAction_Unpause() {
|
|
2662
|
+
return {};
|
|
2663
|
+
}
|
|
2664
|
+
exports.Action_Unpause = {
|
|
2665
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
2666
|
+
return writer;
|
|
2667
|
+
},
|
|
2668
|
+
decode(input, length) {
|
|
2669
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2670
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2671
|
+
const message = createBaseAction_Unpause();
|
|
2672
|
+
while (reader.pos < end) {
|
|
2673
|
+
const tag = reader.uint32();
|
|
2674
|
+
switch (tag >>> 3) {
|
|
2675
|
+
}
|
|
2676
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2677
|
+
break;
|
|
2678
|
+
}
|
|
2679
|
+
reader.skip(tag & 7);
|
|
2680
|
+
}
|
|
2681
|
+
return message;
|
|
2682
|
+
},
|
|
2683
|
+
fromJSON(_) {
|
|
2684
|
+
return {};
|
|
2685
|
+
},
|
|
2686
|
+
toJSON(_) {
|
|
2687
|
+
const obj = {};
|
|
2688
|
+
return obj;
|
|
2689
|
+
},
|
|
2690
|
+
create(base) {
|
|
2691
|
+
return exports.Action_Unpause.fromPartial(base ?? {});
|
|
2692
|
+
},
|
|
2693
|
+
fromPartial(_) {
|
|
2694
|
+
const message = createBaseAction_Unpause();
|
|
2695
|
+
return message;
|
|
2696
|
+
},
|
|
2697
|
+
};
|
|
2698
|
+
function createBaseAction_Transfer() {
|
|
2699
|
+
return { sessionId: 0n, fromAccountId: 0, tokenId: 0, amount: 0n, toAccountId: undefined };
|
|
2700
|
+
}
|
|
2701
|
+
exports.Action_Transfer = {
|
|
2702
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2703
|
+
if (message.sessionId !== 0n) {
|
|
2704
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
2705
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
2706
|
+
}
|
|
2707
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
2708
|
+
}
|
|
2709
|
+
if (message.fromAccountId !== 0) {
|
|
2710
|
+
writer.uint32(16).uint32(message.fromAccountId);
|
|
2711
|
+
}
|
|
2712
|
+
if (message.tokenId !== 0) {
|
|
2713
|
+
writer.uint32(24).uint32(message.tokenId);
|
|
2714
|
+
}
|
|
2715
|
+
if (message.amount !== 0n) {
|
|
2716
|
+
if (BigInt.asUintN(64, message.amount) !== message.amount) {
|
|
2717
|
+
throw new globalThis.Error("value provided for field message.amount of type uint64 too large");
|
|
2718
|
+
}
|
|
2719
|
+
writer.uint32(32).uint64(message.amount);
|
|
2720
|
+
}
|
|
2721
|
+
if (message.toAccountId !== undefined) {
|
|
2722
|
+
writer.uint32(64).uint32(message.toAccountId);
|
|
2723
|
+
}
|
|
2724
|
+
return writer;
|
|
2725
|
+
},
|
|
2726
|
+
decode(input, length) {
|
|
2727
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2728
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2729
|
+
const message = createBaseAction_Transfer();
|
|
2730
|
+
while (reader.pos < end) {
|
|
2731
|
+
const tag = reader.uint32();
|
|
2732
|
+
switch (tag >>> 3) {
|
|
2733
|
+
case 1:
|
|
2734
|
+
if (tag !== 8) {
|
|
2735
|
+
break;
|
|
2736
|
+
}
|
|
2737
|
+
message.sessionId = reader.uint64();
|
|
2738
|
+
continue;
|
|
2739
|
+
case 2:
|
|
2740
|
+
if (tag !== 16) {
|
|
2741
|
+
break;
|
|
2742
|
+
}
|
|
2743
|
+
message.fromAccountId = reader.uint32();
|
|
2744
|
+
continue;
|
|
2745
|
+
case 3:
|
|
2746
|
+
if (tag !== 24) {
|
|
2747
|
+
break;
|
|
2748
|
+
}
|
|
2749
|
+
message.tokenId = reader.uint32();
|
|
2750
|
+
continue;
|
|
2751
|
+
case 4:
|
|
2752
|
+
if (tag !== 32) {
|
|
2753
|
+
break;
|
|
2754
|
+
}
|
|
2755
|
+
message.amount = reader.uint64();
|
|
2756
|
+
continue;
|
|
2757
|
+
case 8:
|
|
2758
|
+
if (tag !== 64) {
|
|
2759
|
+
break;
|
|
2760
|
+
}
|
|
2761
|
+
message.toAccountId = reader.uint32();
|
|
2762
|
+
continue;
|
|
2763
|
+
}
|
|
2764
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2765
|
+
break;
|
|
2766
|
+
}
|
|
2767
|
+
reader.skip(tag & 7);
|
|
2768
|
+
}
|
|
2769
|
+
return message;
|
|
2770
|
+
},
|
|
2771
|
+
fromJSON(object) {
|
|
2772
|
+
return {
|
|
2773
|
+
sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
|
|
2774
|
+
fromAccountId: isSet(object.fromAccountId) ? globalThis.Number(object.fromAccountId) : 0,
|
|
2775
|
+
tokenId: isSet(object.tokenId) ? globalThis.Number(object.tokenId) : 0,
|
|
2776
|
+
amount: isSet(object.amount) ? BigInt(object.amount) : 0n,
|
|
2777
|
+
toAccountId: isSet(object.toAccountId) ? globalThis.Number(object.toAccountId) : undefined,
|
|
2778
|
+
};
|
|
2779
|
+
},
|
|
2780
|
+
toJSON(message) {
|
|
2781
|
+
const obj = {};
|
|
2782
|
+
if (message.sessionId !== 0n) {
|
|
2783
|
+
obj.sessionId = message.sessionId.toString();
|
|
2784
|
+
}
|
|
2785
|
+
if (message.fromAccountId !== 0) {
|
|
2786
|
+
obj.fromAccountId = Math.round(message.fromAccountId);
|
|
2787
|
+
}
|
|
2788
|
+
if (message.tokenId !== 0) {
|
|
2789
|
+
obj.tokenId = Math.round(message.tokenId);
|
|
2790
|
+
}
|
|
2791
|
+
if (message.amount !== 0n) {
|
|
2792
|
+
obj.amount = message.amount.toString();
|
|
2793
|
+
}
|
|
2794
|
+
if (message.toAccountId !== undefined) {
|
|
2795
|
+
obj.toAccountId = Math.round(message.toAccountId);
|
|
2796
|
+
}
|
|
2797
|
+
return obj;
|
|
2798
|
+
},
|
|
2799
|
+
create(base) {
|
|
2800
|
+
return exports.Action_Transfer.fromPartial(base ?? {});
|
|
2801
|
+
},
|
|
2802
|
+
fromPartial(object) {
|
|
2803
|
+
const message = createBaseAction_Transfer();
|
|
2804
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
2805
|
+
message.fromAccountId = object.fromAccountId ?? 0;
|
|
2806
|
+
message.tokenId = object.tokenId ?? 0;
|
|
2807
|
+
message.amount = object.amount ?? 0n;
|
|
2808
|
+
message.toAccountId = object.toAccountId ?? undefined;
|
|
2809
|
+
return message;
|
|
2810
|
+
},
|
|
2811
|
+
};
|
|
2812
|
+
function createBaseAction_AddTrigger() {
|
|
2813
|
+
return { sessionId: 0n, marketId: 0, kind: 0, side: 0, price: 0n, accountId: undefined };
|
|
2814
|
+
}
|
|
2815
|
+
exports.Action_AddTrigger = {
|
|
2816
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2817
|
+
if (message.sessionId !== 0n) {
|
|
2818
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
2819
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
2820
|
+
}
|
|
2821
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
2822
|
+
}
|
|
2823
|
+
if (message.marketId !== 0) {
|
|
2824
|
+
writer.uint32(16).uint32(message.marketId);
|
|
2825
|
+
}
|
|
2826
|
+
if (message.kind !== 0) {
|
|
2827
|
+
writer.uint32(24).int32(message.kind);
|
|
2828
|
+
}
|
|
2829
|
+
if (message.side !== 0) {
|
|
2830
|
+
writer.uint32(32).int32(message.side);
|
|
2831
|
+
}
|
|
2832
|
+
if (message.price !== 0n) {
|
|
2833
|
+
if (BigInt.asUintN(64, message.price) !== message.price) {
|
|
2834
|
+
throw new globalThis.Error("value provided for field message.price of type uint64 too large");
|
|
2835
|
+
}
|
|
2836
|
+
writer.uint32(40).uint64(message.price);
|
|
2837
|
+
}
|
|
2838
|
+
if (message.accountId !== undefined) {
|
|
2839
|
+
writer.uint32(80).uint32(message.accountId);
|
|
2840
|
+
}
|
|
2841
|
+
return writer;
|
|
2842
|
+
},
|
|
2843
|
+
decode(input, length) {
|
|
2844
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2845
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2846
|
+
const message = createBaseAction_AddTrigger();
|
|
2847
|
+
while (reader.pos < end) {
|
|
2848
|
+
const tag = reader.uint32();
|
|
2849
|
+
switch (tag >>> 3) {
|
|
2850
|
+
case 1:
|
|
2851
|
+
if (tag !== 8) {
|
|
2852
|
+
break;
|
|
2853
|
+
}
|
|
2854
|
+
message.sessionId = reader.uint64();
|
|
2855
|
+
continue;
|
|
2856
|
+
case 2:
|
|
2857
|
+
if (tag !== 16) {
|
|
2858
|
+
break;
|
|
2859
|
+
}
|
|
2860
|
+
message.marketId = reader.uint32();
|
|
2861
|
+
continue;
|
|
2862
|
+
case 3:
|
|
2863
|
+
if (tag !== 24) {
|
|
2864
|
+
break;
|
|
2865
|
+
}
|
|
2866
|
+
message.kind = reader.int32();
|
|
2867
|
+
continue;
|
|
2868
|
+
case 4:
|
|
2869
|
+
if (tag !== 32) {
|
|
2870
|
+
break;
|
|
2871
|
+
}
|
|
2872
|
+
message.side = reader.int32();
|
|
2873
|
+
continue;
|
|
2874
|
+
case 5:
|
|
2875
|
+
if (tag !== 40) {
|
|
2876
|
+
break;
|
|
2877
|
+
}
|
|
2878
|
+
message.price = reader.uint64();
|
|
2879
|
+
continue;
|
|
2880
|
+
case 10:
|
|
2881
|
+
if (tag !== 80) {
|
|
2882
|
+
break;
|
|
2883
|
+
}
|
|
2884
|
+
message.accountId = reader.uint32();
|
|
2885
|
+
continue;
|
|
2886
|
+
}
|
|
2887
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2888
|
+
break;
|
|
2889
|
+
}
|
|
2890
|
+
reader.skip(tag & 7);
|
|
2891
|
+
}
|
|
2892
|
+
return message;
|
|
2893
|
+
},
|
|
2894
|
+
fromJSON(object) {
|
|
2895
|
+
return {
|
|
2896
|
+
sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
|
|
2897
|
+
marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
|
|
2898
|
+
kind: isSet(object.kind) ? triggerKindFromJSON(object.kind) : 0,
|
|
2899
|
+
side: isSet(object.side) ? sideFromJSON(object.side) : 0,
|
|
2900
|
+
price: isSet(object.price) ? BigInt(object.price) : 0n,
|
|
2901
|
+
accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : undefined,
|
|
2902
|
+
};
|
|
2903
|
+
},
|
|
2904
|
+
toJSON(message) {
|
|
2905
|
+
const obj = {};
|
|
2906
|
+
if (message.sessionId !== 0n) {
|
|
2907
|
+
obj.sessionId = message.sessionId.toString();
|
|
2908
|
+
}
|
|
2909
|
+
if (message.marketId !== 0) {
|
|
2910
|
+
obj.marketId = Math.round(message.marketId);
|
|
2911
|
+
}
|
|
2912
|
+
if (message.kind !== 0) {
|
|
2913
|
+
obj.kind = triggerKindToJSON(message.kind);
|
|
2914
|
+
}
|
|
2915
|
+
if (message.side !== 0) {
|
|
2916
|
+
obj.side = sideToJSON(message.side);
|
|
2917
|
+
}
|
|
2918
|
+
if (message.price !== 0n) {
|
|
2919
|
+
obj.price = message.price.toString();
|
|
2920
|
+
}
|
|
2921
|
+
if (message.accountId !== undefined) {
|
|
2922
|
+
obj.accountId = Math.round(message.accountId);
|
|
2923
|
+
}
|
|
2924
|
+
return obj;
|
|
2925
|
+
},
|
|
2926
|
+
create(base) {
|
|
2927
|
+
return exports.Action_AddTrigger.fromPartial(base ?? {});
|
|
2928
|
+
},
|
|
2929
|
+
fromPartial(object) {
|
|
2930
|
+
const message = createBaseAction_AddTrigger();
|
|
2931
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
2932
|
+
message.marketId = object.marketId ?? 0;
|
|
2933
|
+
message.kind = object.kind ?? 0;
|
|
2934
|
+
message.side = object.side ?? 0;
|
|
2935
|
+
message.price = object.price ?? 0n;
|
|
2936
|
+
message.accountId = object.accountId ?? undefined;
|
|
2937
|
+
return message;
|
|
2938
|
+
},
|
|
2939
|
+
};
|
|
2940
|
+
function createBaseAction_RemoveTrigger() {
|
|
2941
|
+
return { sessionId: 0n, marketId: 0, kind: 0, side: 0, accountId: undefined };
|
|
2942
|
+
}
|
|
2943
|
+
exports.Action_RemoveTrigger = {
|
|
2944
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
2945
|
+
if (message.sessionId !== 0n) {
|
|
2946
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
2947
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
2948
|
+
}
|
|
2949
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
2950
|
+
}
|
|
2951
|
+
if (message.marketId !== 0) {
|
|
2952
|
+
writer.uint32(16).uint32(message.marketId);
|
|
2953
|
+
}
|
|
2954
|
+
if (message.kind !== 0) {
|
|
2955
|
+
writer.uint32(24).int32(message.kind);
|
|
2956
|
+
}
|
|
2957
|
+
if (message.side !== 0) {
|
|
2958
|
+
writer.uint32(32).int32(message.side);
|
|
2959
|
+
}
|
|
2960
|
+
if (message.accountId !== undefined) {
|
|
2961
|
+
writer.uint32(80).uint32(message.accountId);
|
|
2962
|
+
}
|
|
2963
|
+
return writer;
|
|
2964
|
+
},
|
|
2965
|
+
decode(input, length) {
|
|
2966
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
2967
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2968
|
+
const message = createBaseAction_RemoveTrigger();
|
|
2969
|
+
while (reader.pos < end) {
|
|
2970
|
+
const tag = reader.uint32();
|
|
2971
|
+
switch (tag >>> 3) {
|
|
2972
|
+
case 1:
|
|
2973
|
+
if (tag !== 8) {
|
|
2974
|
+
break;
|
|
2975
|
+
}
|
|
2976
|
+
message.sessionId = reader.uint64();
|
|
2977
|
+
continue;
|
|
2978
|
+
case 2:
|
|
2979
|
+
if (tag !== 16) {
|
|
2980
|
+
break;
|
|
2981
|
+
}
|
|
2982
|
+
message.marketId = reader.uint32();
|
|
2983
|
+
continue;
|
|
2984
|
+
case 3:
|
|
2985
|
+
if (tag !== 24) {
|
|
2986
|
+
break;
|
|
2987
|
+
}
|
|
2988
|
+
message.kind = reader.int32();
|
|
2989
|
+
continue;
|
|
2990
|
+
case 4:
|
|
2991
|
+
if (tag !== 32) {
|
|
2992
|
+
break;
|
|
2993
|
+
}
|
|
2994
|
+
message.side = reader.int32();
|
|
2995
|
+
continue;
|
|
2996
|
+
case 10:
|
|
2997
|
+
if (tag !== 80) {
|
|
2998
|
+
break;
|
|
2999
|
+
}
|
|
3000
|
+
message.accountId = reader.uint32();
|
|
3001
|
+
continue;
|
|
3002
|
+
}
|
|
3003
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3004
|
+
break;
|
|
3005
|
+
}
|
|
3006
|
+
reader.skip(tag & 7);
|
|
3007
|
+
}
|
|
3008
|
+
return message;
|
|
3009
|
+
},
|
|
3010
|
+
fromJSON(object) {
|
|
3011
|
+
return {
|
|
3012
|
+
sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
|
|
3013
|
+
marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
|
|
3014
|
+
kind: isSet(object.kind) ? triggerKindFromJSON(object.kind) : 0,
|
|
3015
|
+
side: isSet(object.side) ? sideFromJSON(object.side) : 0,
|
|
3016
|
+
accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : undefined,
|
|
3017
|
+
};
|
|
3018
|
+
},
|
|
3019
|
+
toJSON(message) {
|
|
3020
|
+
const obj = {};
|
|
3021
|
+
if (message.sessionId !== 0n) {
|
|
3022
|
+
obj.sessionId = message.sessionId.toString();
|
|
3023
|
+
}
|
|
3024
|
+
if (message.marketId !== 0) {
|
|
3025
|
+
obj.marketId = Math.round(message.marketId);
|
|
3026
|
+
}
|
|
3027
|
+
if (message.kind !== 0) {
|
|
3028
|
+
obj.kind = triggerKindToJSON(message.kind);
|
|
3029
|
+
}
|
|
3030
|
+
if (message.side !== 0) {
|
|
3031
|
+
obj.side = sideToJSON(message.side);
|
|
3032
|
+
}
|
|
3033
|
+
if (message.accountId !== undefined) {
|
|
3034
|
+
obj.accountId = Math.round(message.accountId);
|
|
3035
|
+
}
|
|
3036
|
+
return obj;
|
|
3037
|
+
},
|
|
3038
|
+
create(base) {
|
|
3039
|
+
return exports.Action_RemoveTrigger.fromPartial(base ?? {});
|
|
3040
|
+
},
|
|
3041
|
+
fromPartial(object) {
|
|
3042
|
+
const message = createBaseAction_RemoveTrigger();
|
|
3043
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
3044
|
+
message.marketId = object.marketId ?? 0;
|
|
3045
|
+
message.kind = object.kind ?? 0;
|
|
3046
|
+
message.side = object.side ?? 0;
|
|
3047
|
+
message.accountId = object.accountId ?? undefined;
|
|
3048
|
+
return message;
|
|
3049
|
+
},
|
|
3050
|
+
};
|
|
3051
|
+
function createBaseReceipt() {
|
|
3052
|
+
return { actionId: 0n, kind: undefined };
|
|
3053
|
+
}
|
|
3054
|
+
exports.Receipt = {
|
|
3055
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
3056
|
+
if (message.actionId !== 0n) {
|
|
3057
|
+
if (BigInt.asUintN(64, message.actionId) !== message.actionId) {
|
|
3058
|
+
throw new globalThis.Error("value provided for field message.actionId of type uint64 too large");
|
|
3059
|
+
}
|
|
3060
|
+
writer.uint32(8).uint64(message.actionId);
|
|
3061
|
+
}
|
|
3062
|
+
switch (message.kind?.$case) {
|
|
3063
|
+
case "err":
|
|
3064
|
+
writer.uint32(256).int32(message.kind.value);
|
|
3065
|
+
break;
|
|
3066
|
+
case "createSessionResult":
|
|
3067
|
+
exports.Receipt_CreateSessionResult.encode(message.kind.value, writer.uint32(266).fork()).join();
|
|
3068
|
+
break;
|
|
3069
|
+
case "placeOrderResult":
|
|
3070
|
+
exports.Receipt_PlaceOrderResult.encode(message.kind.value, writer.uint32(274).fork()).join();
|
|
3071
|
+
break;
|
|
3072
|
+
case "cancelOrderResult":
|
|
3073
|
+
exports.Receipt_CancelOrderResult.encode(message.kind.value, writer.uint32(282).fork()).join();
|
|
3074
|
+
break;
|
|
3075
|
+
case "depositResult":
|
|
3076
|
+
exports.Receipt_DepositResult.encode(message.kind.value, writer.uint32(290).fork()).join();
|
|
3077
|
+
break;
|
|
3078
|
+
case "insertTokenResult":
|
|
3079
|
+
exports.Receipt_InsertTokenResult.encode(message.kind.value, writer.uint32(298).fork()).join();
|
|
3080
|
+
break;
|
|
3081
|
+
case "insertMarketResult":
|
|
3082
|
+
exports.Receipt_InsertMarketResult.encode(message.kind.value, writer.uint32(306).fork()).join();
|
|
3083
|
+
break;
|
|
3084
|
+
case "withdrawResult":
|
|
3085
|
+
exports.Receipt_WithdrawResult.encode(message.kind.value, writer.uint32(314).fork()).join();
|
|
3086
|
+
break;
|
|
3087
|
+
case "oracleSymbolFeedResult":
|
|
3088
|
+
exports.Receipt_OracleSymbolFeedResult.encode(message.kind.value, writer.uint32(322).fork()).join();
|
|
3089
|
+
break;
|
|
3090
|
+
case "oracleUpdateResult":
|
|
3091
|
+
exports.Receipt_OracleUpdateResult.encode(message.kind.value, writer.uint32(330).fork()).join();
|
|
3092
|
+
break;
|
|
3093
|
+
case "updateGuardianSetResult":
|
|
3094
|
+
exports.Receipt_UpdateGuardianSetResult.encode(message.kind.value, writer.uint32(338).fork()).join();
|
|
3095
|
+
break;
|
|
3096
|
+
case "liquidated":
|
|
3097
|
+
exports.Receipt_Liquidated.encode(message.kind.value, writer.uint32(346).fork()).join();
|
|
3098
|
+
break;
|
|
3099
|
+
case "sessionRevoked":
|
|
3100
|
+
exports.Receipt_SessionRevoked.encode(message.kind.value, writer.uint32(354).fork()).join();
|
|
3101
|
+
break;
|
|
3102
|
+
case "paused":
|
|
3103
|
+
exports.Receipt_Paused.encode(message.kind.value, writer.uint32(362).fork()).join();
|
|
3104
|
+
break;
|
|
3105
|
+
case "unpaused":
|
|
3106
|
+
exports.Receipt_Unpaused.encode(message.kind.value, writer.uint32(370).fork()).join();
|
|
3107
|
+
break;
|
|
3108
|
+
case "transferred":
|
|
3109
|
+
exports.Receipt_Transferred.encode(message.kind.value, writer.uint32(378).fork()).join();
|
|
3110
|
+
break;
|
|
3111
|
+
case "triggerAdded":
|
|
3112
|
+
exports.Receipt_TriggerAdded.encode(message.kind.value, writer.uint32(514).fork()).join();
|
|
3113
|
+
break;
|
|
3114
|
+
case "triggerRemoved":
|
|
3115
|
+
exports.Receipt_TriggerRemoved.encode(message.kind.value, writer.uint32(522).fork()).join();
|
|
3116
|
+
break;
|
|
3117
|
+
}
|
|
3118
|
+
return writer;
|
|
3119
|
+
},
|
|
3120
|
+
decode(input, length) {
|
|
3121
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
3122
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
3123
|
+
const message = createBaseReceipt();
|
|
3124
|
+
while (reader.pos < end) {
|
|
3125
|
+
const tag = reader.uint32();
|
|
3126
|
+
switch (tag >>> 3) {
|
|
3127
|
+
case 1:
|
|
3128
|
+
if (tag !== 8) {
|
|
3129
|
+
break;
|
|
3130
|
+
}
|
|
3131
|
+
message.actionId = reader.uint64();
|
|
3132
|
+
continue;
|
|
3133
|
+
case 32:
|
|
3134
|
+
if (tag !== 256) {
|
|
3135
|
+
break;
|
|
3136
|
+
}
|
|
3137
|
+
message.kind = { $case: "err", value: reader.int32() };
|
|
3138
|
+
continue;
|
|
3139
|
+
case 33:
|
|
3140
|
+
if (tag !== 266) {
|
|
3141
|
+
break;
|
|
3142
|
+
}
|
|
3143
|
+
message.kind = {
|
|
3144
|
+
$case: "createSessionResult",
|
|
3145
|
+
value: exports.Receipt_CreateSessionResult.decode(reader, reader.uint32()),
|
|
3146
|
+
};
|
|
3147
|
+
continue;
|
|
3148
|
+
case 34:
|
|
3149
|
+
if (tag !== 274) {
|
|
3150
|
+
break;
|
|
3151
|
+
}
|
|
3152
|
+
message.kind = { $case: "placeOrderResult", value: exports.Receipt_PlaceOrderResult.decode(reader, reader.uint32()) };
|
|
3153
|
+
continue;
|
|
3154
|
+
case 35:
|
|
3155
|
+
if (tag !== 282) {
|
|
3156
|
+
break;
|
|
3157
|
+
}
|
|
3158
|
+
message.kind = {
|
|
3159
|
+
$case: "cancelOrderResult",
|
|
3160
|
+
value: exports.Receipt_CancelOrderResult.decode(reader, reader.uint32()),
|
|
3161
|
+
};
|
|
3162
|
+
continue;
|
|
3163
|
+
case 36:
|
|
3164
|
+
if (tag !== 290) {
|
|
3165
|
+
break;
|
|
3166
|
+
}
|
|
3167
|
+
message.kind = { $case: "depositResult", value: exports.Receipt_DepositResult.decode(reader, reader.uint32()) };
|
|
3168
|
+
continue;
|
|
3169
|
+
case 37:
|
|
3170
|
+
if (tag !== 298) {
|
|
3171
|
+
break;
|
|
3172
|
+
}
|
|
3173
|
+
message.kind = {
|
|
3174
|
+
$case: "insertTokenResult",
|
|
3175
|
+
value: exports.Receipt_InsertTokenResult.decode(reader, reader.uint32()),
|
|
3176
|
+
};
|
|
3177
|
+
continue;
|
|
3178
|
+
case 38:
|
|
3179
|
+
if (tag !== 306) {
|
|
3180
|
+
break;
|
|
3181
|
+
}
|
|
3182
|
+
message.kind = {
|
|
3183
|
+
$case: "insertMarketResult",
|
|
3184
|
+
value: exports.Receipt_InsertMarketResult.decode(reader, reader.uint32()),
|
|
3185
|
+
};
|
|
3186
|
+
continue;
|
|
3187
|
+
case 39:
|
|
3188
|
+
if (tag !== 314) {
|
|
3189
|
+
break;
|
|
3190
|
+
}
|
|
3191
|
+
message.kind = { $case: "withdrawResult", value: exports.Receipt_WithdrawResult.decode(reader, reader.uint32()) };
|
|
3192
|
+
continue;
|
|
3193
|
+
case 40:
|
|
3194
|
+
if (tag !== 322) {
|
|
3195
|
+
break;
|
|
3196
|
+
}
|
|
3197
|
+
message.kind = {
|
|
3198
|
+
$case: "oracleSymbolFeedResult",
|
|
3199
|
+
value: exports.Receipt_OracleSymbolFeedResult.decode(reader, reader.uint32()),
|
|
3200
|
+
};
|
|
3201
|
+
continue;
|
|
3202
|
+
case 41:
|
|
3203
|
+
if (tag !== 330) {
|
|
3204
|
+
break;
|
|
3205
|
+
}
|
|
3206
|
+
message.kind = {
|
|
3207
|
+
$case: "oracleUpdateResult",
|
|
3208
|
+
value: exports.Receipt_OracleUpdateResult.decode(reader, reader.uint32()),
|
|
3209
|
+
};
|
|
3210
|
+
continue;
|
|
3211
|
+
case 42:
|
|
3212
|
+
if (tag !== 338) {
|
|
3213
|
+
break;
|
|
3214
|
+
}
|
|
3215
|
+
message.kind = {
|
|
3216
|
+
$case: "updateGuardianSetResult",
|
|
3217
|
+
value: exports.Receipt_UpdateGuardianSetResult.decode(reader, reader.uint32()),
|
|
3218
|
+
};
|
|
3219
|
+
continue;
|
|
3220
|
+
case 43:
|
|
3221
|
+
if (tag !== 346) {
|
|
3222
|
+
break;
|
|
3223
|
+
}
|
|
3224
|
+
message.kind = { $case: "liquidated", value: exports.Receipt_Liquidated.decode(reader, reader.uint32()) };
|
|
3225
|
+
continue;
|
|
3226
|
+
case 44:
|
|
3227
|
+
if (tag !== 354) {
|
|
3228
|
+
break;
|
|
3229
|
+
}
|
|
3230
|
+
message.kind = { $case: "sessionRevoked", value: exports.Receipt_SessionRevoked.decode(reader, reader.uint32()) };
|
|
3231
|
+
continue;
|
|
3232
|
+
case 45:
|
|
3233
|
+
if (tag !== 362) {
|
|
3234
|
+
break;
|
|
3235
|
+
}
|
|
3236
|
+
message.kind = { $case: "paused", value: exports.Receipt_Paused.decode(reader, reader.uint32()) };
|
|
3237
|
+
continue;
|
|
3238
|
+
case 46:
|
|
3239
|
+
if (tag !== 370) {
|
|
3240
|
+
break;
|
|
3241
|
+
}
|
|
3242
|
+
message.kind = { $case: "unpaused", value: exports.Receipt_Unpaused.decode(reader, reader.uint32()) };
|
|
3243
|
+
continue;
|
|
3244
|
+
case 47:
|
|
3245
|
+
if (tag !== 378) {
|
|
3246
|
+
break;
|
|
3247
|
+
}
|
|
3248
|
+
message.kind = { $case: "transferred", value: exports.Receipt_Transferred.decode(reader, reader.uint32()) };
|
|
3249
|
+
continue;
|
|
3250
|
+
case 64:
|
|
3251
|
+
if (tag !== 514) {
|
|
3252
|
+
break;
|
|
3253
|
+
}
|
|
3254
|
+
message.kind = { $case: "triggerAdded", value: exports.Receipt_TriggerAdded.decode(reader, reader.uint32()) };
|
|
3255
|
+
continue;
|
|
3256
|
+
case 65:
|
|
3257
|
+
if (tag !== 522) {
|
|
3258
|
+
break;
|
|
3259
|
+
}
|
|
3260
|
+
message.kind = { $case: "triggerRemoved", value: exports.Receipt_TriggerRemoved.decode(reader, reader.uint32()) };
|
|
3261
|
+
continue;
|
|
3262
|
+
}
|
|
3263
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3264
|
+
break;
|
|
3265
|
+
}
|
|
3266
|
+
reader.skip(tag & 7);
|
|
3267
|
+
}
|
|
3268
|
+
return message;
|
|
3269
|
+
},
|
|
3270
|
+
fromJSON(object) {
|
|
3271
|
+
return {
|
|
3272
|
+
actionId: isSet(object.actionId) ? BigInt(object.actionId) : 0n,
|
|
3273
|
+
kind: isSet(object.err)
|
|
3274
|
+
? { $case: "err", value: errorFromJSON(object.err) }
|
|
3275
|
+
: isSet(object.createSessionResult)
|
|
3276
|
+
? { $case: "createSessionResult", value: exports.Receipt_CreateSessionResult.fromJSON(object.createSessionResult) }
|
|
3277
|
+
: isSet(object.placeOrderResult)
|
|
3278
|
+
? { $case: "placeOrderResult", value: exports.Receipt_PlaceOrderResult.fromJSON(object.placeOrderResult) }
|
|
3279
|
+
: isSet(object.cancelOrderResult)
|
|
3280
|
+
? { $case: "cancelOrderResult", value: exports.Receipt_CancelOrderResult.fromJSON(object.cancelOrderResult) }
|
|
3281
|
+
: isSet(object.depositResult)
|
|
3282
|
+
? { $case: "depositResult", value: exports.Receipt_DepositResult.fromJSON(object.depositResult) }
|
|
3283
|
+
: isSet(object.insertTokenResult)
|
|
3284
|
+
? { $case: "insertTokenResult", value: exports.Receipt_InsertTokenResult.fromJSON(object.insertTokenResult) }
|
|
3285
|
+
: isSet(object.insertMarketResult)
|
|
3286
|
+
? { $case: "insertMarketResult", value: exports.Receipt_InsertMarketResult.fromJSON(object.insertMarketResult) }
|
|
3287
|
+
: isSet(object.withdrawResult)
|
|
3288
|
+
? { $case: "withdrawResult", value: exports.Receipt_WithdrawResult.fromJSON(object.withdrawResult) }
|
|
3289
|
+
: isSet(object.oracleSymbolFeedResult)
|
|
3290
|
+
? {
|
|
3291
|
+
$case: "oracleSymbolFeedResult",
|
|
3292
|
+
value: exports.Receipt_OracleSymbolFeedResult.fromJSON(object.oracleSymbolFeedResult),
|
|
3293
|
+
}
|
|
3294
|
+
: isSet(object.oracleUpdateResult)
|
|
3295
|
+
? { $case: "oracleUpdateResult", value: exports.Receipt_OracleUpdateResult.fromJSON(object.oracleUpdateResult) }
|
|
3296
|
+
: isSet(object.updateGuardianSetResult)
|
|
3297
|
+
? {
|
|
3298
|
+
$case: "updateGuardianSetResult",
|
|
3299
|
+
value: exports.Receipt_UpdateGuardianSetResult.fromJSON(object.updateGuardianSetResult),
|
|
3300
|
+
}
|
|
3301
|
+
: isSet(object.liquidated)
|
|
3302
|
+
? { $case: "liquidated", value: exports.Receipt_Liquidated.fromJSON(object.liquidated) }
|
|
3303
|
+
: isSet(object.sessionRevoked)
|
|
3304
|
+
? { $case: "sessionRevoked", value: exports.Receipt_SessionRevoked.fromJSON(object.sessionRevoked) }
|
|
3305
|
+
: isSet(object.paused)
|
|
3306
|
+
? { $case: "paused", value: exports.Receipt_Paused.fromJSON(object.paused) }
|
|
3307
|
+
: isSet(object.unpaused)
|
|
3308
|
+
? { $case: "unpaused", value: exports.Receipt_Unpaused.fromJSON(object.unpaused) }
|
|
3309
|
+
: isSet(object.transferred)
|
|
3310
|
+
? { $case: "transferred", value: exports.Receipt_Transferred.fromJSON(object.transferred) }
|
|
3311
|
+
: isSet(object.triggerAdded)
|
|
3312
|
+
? { $case: "triggerAdded", value: exports.Receipt_TriggerAdded.fromJSON(object.triggerAdded) }
|
|
3313
|
+
: isSet(object.triggerRemoved)
|
|
3314
|
+
? { $case: "triggerRemoved", value: exports.Receipt_TriggerRemoved.fromJSON(object.triggerRemoved) }
|
|
3315
|
+
: undefined,
|
|
3316
|
+
};
|
|
3317
|
+
},
|
|
3318
|
+
toJSON(message) {
|
|
3319
|
+
const obj = {};
|
|
3320
|
+
if (message.actionId !== 0n) {
|
|
3321
|
+
obj.actionId = message.actionId.toString();
|
|
3322
|
+
}
|
|
3323
|
+
if (message.kind?.$case === "err") {
|
|
3324
|
+
obj.err = errorToJSON(message.kind.value);
|
|
3325
|
+
}
|
|
3326
|
+
if (message.kind?.$case === "createSessionResult") {
|
|
3327
|
+
obj.createSessionResult = exports.Receipt_CreateSessionResult.toJSON(message.kind.value);
|
|
3328
|
+
}
|
|
3329
|
+
if (message.kind?.$case === "placeOrderResult") {
|
|
3330
|
+
obj.placeOrderResult = exports.Receipt_PlaceOrderResult.toJSON(message.kind.value);
|
|
3331
|
+
}
|
|
3332
|
+
if (message.kind?.$case === "cancelOrderResult") {
|
|
3333
|
+
obj.cancelOrderResult = exports.Receipt_CancelOrderResult.toJSON(message.kind.value);
|
|
3334
|
+
}
|
|
3335
|
+
if (message.kind?.$case === "depositResult") {
|
|
3336
|
+
obj.depositResult = exports.Receipt_DepositResult.toJSON(message.kind.value);
|
|
3337
|
+
}
|
|
3338
|
+
if (message.kind?.$case === "insertTokenResult") {
|
|
3339
|
+
obj.insertTokenResult = exports.Receipt_InsertTokenResult.toJSON(message.kind.value);
|
|
3340
|
+
}
|
|
3341
|
+
if (message.kind?.$case === "insertMarketResult") {
|
|
3342
|
+
obj.insertMarketResult = exports.Receipt_InsertMarketResult.toJSON(message.kind.value);
|
|
3343
|
+
}
|
|
3344
|
+
if (message.kind?.$case === "withdrawResult") {
|
|
3345
|
+
obj.withdrawResult = exports.Receipt_WithdrawResult.toJSON(message.kind.value);
|
|
3346
|
+
}
|
|
3347
|
+
if (message.kind?.$case === "oracleSymbolFeedResult") {
|
|
3348
|
+
obj.oracleSymbolFeedResult = exports.Receipt_OracleSymbolFeedResult.toJSON(message.kind.value);
|
|
3349
|
+
}
|
|
3350
|
+
if (message.kind?.$case === "oracleUpdateResult") {
|
|
3351
|
+
obj.oracleUpdateResult = exports.Receipt_OracleUpdateResult.toJSON(message.kind.value);
|
|
3352
|
+
}
|
|
3353
|
+
if (message.kind?.$case === "updateGuardianSetResult") {
|
|
3354
|
+
obj.updateGuardianSetResult = exports.Receipt_UpdateGuardianSetResult.toJSON(message.kind.value);
|
|
3355
|
+
}
|
|
3356
|
+
if (message.kind?.$case === "liquidated") {
|
|
3357
|
+
obj.liquidated = exports.Receipt_Liquidated.toJSON(message.kind.value);
|
|
3358
|
+
}
|
|
3359
|
+
if (message.kind?.$case === "sessionRevoked") {
|
|
3360
|
+
obj.sessionRevoked = exports.Receipt_SessionRevoked.toJSON(message.kind.value);
|
|
3361
|
+
}
|
|
3362
|
+
if (message.kind?.$case === "paused") {
|
|
3363
|
+
obj.paused = exports.Receipt_Paused.toJSON(message.kind.value);
|
|
3364
|
+
}
|
|
3365
|
+
if (message.kind?.$case === "unpaused") {
|
|
3366
|
+
obj.unpaused = exports.Receipt_Unpaused.toJSON(message.kind.value);
|
|
3367
|
+
}
|
|
3368
|
+
if (message.kind?.$case === "transferred") {
|
|
3369
|
+
obj.transferred = exports.Receipt_Transferred.toJSON(message.kind.value);
|
|
3370
|
+
}
|
|
3371
|
+
if (message.kind?.$case === "triggerAdded") {
|
|
3372
|
+
obj.triggerAdded = exports.Receipt_TriggerAdded.toJSON(message.kind.value);
|
|
3373
|
+
}
|
|
3374
|
+
if (message.kind?.$case === "triggerRemoved") {
|
|
3375
|
+
obj.triggerRemoved = exports.Receipt_TriggerRemoved.toJSON(message.kind.value);
|
|
3376
|
+
}
|
|
3377
|
+
return obj;
|
|
3378
|
+
},
|
|
3379
|
+
create(base) {
|
|
3380
|
+
return exports.Receipt.fromPartial(base ?? {});
|
|
3381
|
+
},
|
|
3382
|
+
fromPartial(object) {
|
|
3383
|
+
const message = createBaseReceipt();
|
|
3384
|
+
message.actionId = object.actionId ?? 0n;
|
|
3385
|
+
if (object.kind?.$case === "err" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3386
|
+
message.kind = { $case: "err", value: object.kind.value };
|
|
3387
|
+
}
|
|
3388
|
+
if (object.kind?.$case === "createSessionResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3389
|
+
message.kind = {
|
|
3390
|
+
$case: "createSessionResult",
|
|
3391
|
+
value: exports.Receipt_CreateSessionResult.fromPartial(object.kind.value),
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3394
|
+
if (object.kind?.$case === "placeOrderResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3395
|
+
message.kind = { $case: "placeOrderResult", value: exports.Receipt_PlaceOrderResult.fromPartial(object.kind.value) };
|
|
3396
|
+
}
|
|
3397
|
+
if (object.kind?.$case === "cancelOrderResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3398
|
+
message.kind = { $case: "cancelOrderResult", value: exports.Receipt_CancelOrderResult.fromPartial(object.kind.value) };
|
|
3399
|
+
}
|
|
3400
|
+
if (object.kind?.$case === "depositResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3401
|
+
message.kind = { $case: "depositResult", value: exports.Receipt_DepositResult.fromPartial(object.kind.value) };
|
|
3402
|
+
}
|
|
3403
|
+
if (object.kind?.$case === "insertTokenResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3404
|
+
message.kind = { $case: "insertTokenResult", value: exports.Receipt_InsertTokenResult.fromPartial(object.kind.value) };
|
|
3405
|
+
}
|
|
3406
|
+
if (object.kind?.$case === "insertMarketResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3407
|
+
message.kind = { $case: "insertMarketResult", value: exports.Receipt_InsertMarketResult.fromPartial(object.kind.value) };
|
|
3408
|
+
}
|
|
3409
|
+
if (object.kind?.$case === "withdrawResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3410
|
+
message.kind = { $case: "withdrawResult", value: exports.Receipt_WithdrawResult.fromPartial(object.kind.value) };
|
|
3411
|
+
}
|
|
3412
|
+
if (object.kind?.$case === "oracleSymbolFeedResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3413
|
+
message.kind = {
|
|
3414
|
+
$case: "oracleSymbolFeedResult",
|
|
3415
|
+
value: exports.Receipt_OracleSymbolFeedResult.fromPartial(object.kind.value),
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
if (object.kind?.$case === "oracleUpdateResult" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3419
|
+
message.kind = { $case: "oracleUpdateResult", value: exports.Receipt_OracleUpdateResult.fromPartial(object.kind.value) };
|
|
3420
|
+
}
|
|
3421
|
+
if (object.kind?.$case === "updateGuardianSetResult" &&
|
|
3422
|
+
object.kind?.value !== undefined &&
|
|
3423
|
+
object.kind?.value !== null) {
|
|
3424
|
+
message.kind = {
|
|
3425
|
+
$case: "updateGuardianSetResult",
|
|
3426
|
+
value: exports.Receipt_UpdateGuardianSetResult.fromPartial(object.kind.value),
|
|
3427
|
+
};
|
|
3428
|
+
}
|
|
3429
|
+
if (object.kind?.$case === "liquidated" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3430
|
+
message.kind = { $case: "liquidated", value: exports.Receipt_Liquidated.fromPartial(object.kind.value) };
|
|
3431
|
+
}
|
|
3432
|
+
if (object.kind?.$case === "sessionRevoked" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3433
|
+
message.kind = { $case: "sessionRevoked", value: exports.Receipt_SessionRevoked.fromPartial(object.kind.value) };
|
|
3434
|
+
}
|
|
3435
|
+
if (object.kind?.$case === "paused" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3436
|
+
message.kind = { $case: "paused", value: exports.Receipt_Paused.fromPartial(object.kind.value) };
|
|
3437
|
+
}
|
|
3438
|
+
if (object.kind?.$case === "unpaused" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3439
|
+
message.kind = { $case: "unpaused", value: exports.Receipt_Unpaused.fromPartial(object.kind.value) };
|
|
3440
|
+
}
|
|
3441
|
+
if (object.kind?.$case === "transferred" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3442
|
+
message.kind = { $case: "transferred", value: exports.Receipt_Transferred.fromPartial(object.kind.value) };
|
|
3443
|
+
}
|
|
3444
|
+
if (object.kind?.$case === "triggerAdded" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3445
|
+
message.kind = { $case: "triggerAdded", value: exports.Receipt_TriggerAdded.fromPartial(object.kind.value) };
|
|
3446
|
+
}
|
|
3447
|
+
if (object.kind?.$case === "triggerRemoved" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
3448
|
+
message.kind = { $case: "triggerRemoved", value: exports.Receipt_TriggerRemoved.fromPartial(object.kind.value) };
|
|
3449
|
+
}
|
|
3450
|
+
return message;
|
|
3451
|
+
},
|
|
3452
|
+
};
|
|
3453
|
+
function createBaseReceipt_Posted() {
|
|
3454
|
+
return { side: 0, marketId: 0, price: 0n, size: 0n, orderId: 0n, accountId: 0, clientOrderId: undefined };
|
|
3455
|
+
}
|
|
3456
|
+
exports.Receipt_Posted = {
|
|
3457
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
3458
|
+
if (message.side !== 0) {
|
|
3459
|
+
writer.uint32(8).int32(message.side);
|
|
3460
|
+
}
|
|
3461
|
+
if (message.marketId !== 0) {
|
|
3462
|
+
writer.uint32(16).uint32(message.marketId);
|
|
3463
|
+
}
|
|
3464
|
+
if (message.price !== 0n) {
|
|
3465
|
+
if (BigInt.asUintN(64, message.price) !== message.price) {
|
|
3466
|
+
throw new globalThis.Error("value provided for field message.price of type uint64 too large");
|
|
3467
|
+
}
|
|
3468
|
+
writer.uint32(24).uint64(message.price);
|
|
3469
|
+
}
|
|
3470
|
+
if (message.size !== 0n) {
|
|
3471
|
+
if (BigInt.asUintN(64, message.size) !== message.size) {
|
|
3472
|
+
throw new globalThis.Error("value provided for field message.size of type uint64 too large");
|
|
3473
|
+
}
|
|
3474
|
+
writer.uint32(32).uint64(message.size);
|
|
3475
|
+
}
|
|
3476
|
+
if (message.orderId !== 0n) {
|
|
3477
|
+
if (BigInt.asUintN(64, message.orderId) !== message.orderId) {
|
|
3478
|
+
throw new globalThis.Error("value provided for field message.orderId of type uint64 too large");
|
|
3479
|
+
}
|
|
3480
|
+
writer.uint32(40).uint64(message.orderId);
|
|
3481
|
+
}
|
|
3482
|
+
if (message.accountId !== 0) {
|
|
3483
|
+
writer.uint32(48).uint32(message.accountId);
|
|
3484
|
+
}
|
|
3485
|
+
if (message.clientOrderId !== undefined) {
|
|
3486
|
+
if (BigInt.asUintN(64, message.clientOrderId) !== message.clientOrderId) {
|
|
3487
|
+
throw new globalThis.Error("value provided for field message.clientOrderId of type uint64 too large");
|
|
3488
|
+
}
|
|
3489
|
+
writer.uint32(56).uint64(message.clientOrderId);
|
|
3490
|
+
}
|
|
3491
|
+
return writer;
|
|
3492
|
+
},
|
|
3493
|
+
decode(input, length) {
|
|
3494
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
3495
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
3496
|
+
const message = createBaseReceipt_Posted();
|
|
3497
|
+
while (reader.pos < end) {
|
|
3498
|
+
const tag = reader.uint32();
|
|
3499
|
+
switch (tag >>> 3) {
|
|
3500
|
+
case 1:
|
|
3501
|
+
if (tag !== 8) {
|
|
3502
|
+
break;
|
|
3503
|
+
}
|
|
3504
|
+
message.side = reader.int32();
|
|
3505
|
+
continue;
|
|
3506
|
+
case 2:
|
|
3507
|
+
if (tag !== 16) {
|
|
3508
|
+
break;
|
|
3509
|
+
}
|
|
3510
|
+
message.marketId = reader.uint32();
|
|
3511
|
+
continue;
|
|
3512
|
+
case 3:
|
|
3513
|
+
if (tag !== 24) {
|
|
3514
|
+
break;
|
|
3515
|
+
}
|
|
3516
|
+
message.price = reader.uint64();
|
|
3517
|
+
continue;
|
|
3518
|
+
case 4:
|
|
3519
|
+
if (tag !== 32) {
|
|
3520
|
+
break;
|
|
3521
|
+
}
|
|
3522
|
+
message.size = reader.uint64();
|
|
3523
|
+
continue;
|
|
3524
|
+
case 5:
|
|
3525
|
+
if (tag !== 40) {
|
|
3526
|
+
break;
|
|
3527
|
+
}
|
|
3528
|
+
message.orderId = reader.uint64();
|
|
3529
|
+
continue;
|
|
3530
|
+
case 6:
|
|
3531
|
+
if (tag !== 48) {
|
|
3532
|
+
break;
|
|
3533
|
+
}
|
|
3534
|
+
message.accountId = reader.uint32();
|
|
3535
|
+
continue;
|
|
3536
|
+
case 7:
|
|
3537
|
+
if (tag !== 56) {
|
|
3538
|
+
break;
|
|
3539
|
+
}
|
|
3540
|
+
message.clientOrderId = reader.uint64();
|
|
3541
|
+
continue;
|
|
3542
|
+
}
|
|
3543
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3544
|
+
break;
|
|
3545
|
+
}
|
|
3546
|
+
reader.skip(tag & 7);
|
|
3547
|
+
}
|
|
3548
|
+
return message;
|
|
3549
|
+
},
|
|
3550
|
+
fromJSON(object) {
|
|
3551
|
+
return {
|
|
3552
|
+
side: isSet(object.side) ? sideFromJSON(object.side) : 0,
|
|
3553
|
+
marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
|
|
3554
|
+
price: isSet(object.price) ? BigInt(object.price) : 0n,
|
|
3555
|
+
size: isSet(object.size) ? BigInt(object.size) : 0n,
|
|
3556
|
+
orderId: isSet(object.orderId) ? BigInt(object.orderId) : 0n,
|
|
3557
|
+
accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0,
|
|
3558
|
+
clientOrderId: isSet(object.clientOrderId) ? BigInt(object.clientOrderId) : undefined,
|
|
3559
|
+
};
|
|
3560
|
+
},
|
|
3561
|
+
toJSON(message) {
|
|
3562
|
+
const obj = {};
|
|
3563
|
+
if (message.side !== 0) {
|
|
3564
|
+
obj.side = sideToJSON(message.side);
|
|
3565
|
+
}
|
|
3566
|
+
if (message.marketId !== 0) {
|
|
3567
|
+
obj.marketId = Math.round(message.marketId);
|
|
3568
|
+
}
|
|
3569
|
+
if (message.price !== 0n) {
|
|
3570
|
+
obj.price = message.price.toString();
|
|
3571
|
+
}
|
|
3572
|
+
if (message.size !== 0n) {
|
|
3573
|
+
obj.size = message.size.toString();
|
|
3574
|
+
}
|
|
3575
|
+
if (message.orderId !== 0n) {
|
|
3576
|
+
obj.orderId = message.orderId.toString();
|
|
3577
|
+
}
|
|
3578
|
+
if (message.accountId !== 0) {
|
|
3579
|
+
obj.accountId = Math.round(message.accountId);
|
|
3580
|
+
}
|
|
3581
|
+
if (message.clientOrderId !== undefined) {
|
|
3582
|
+
obj.clientOrderId = message.clientOrderId.toString();
|
|
3583
|
+
}
|
|
3584
|
+
return obj;
|
|
3585
|
+
},
|
|
3586
|
+
create(base) {
|
|
3587
|
+
return exports.Receipt_Posted.fromPartial(base ?? {});
|
|
3588
|
+
},
|
|
3589
|
+
fromPartial(object) {
|
|
3590
|
+
const message = createBaseReceipt_Posted();
|
|
3591
|
+
message.side = object.side ?? 0;
|
|
3592
|
+
message.marketId = object.marketId ?? 0;
|
|
3593
|
+
message.price = object.price ?? 0n;
|
|
3594
|
+
message.size = object.size ?? 0n;
|
|
3595
|
+
message.orderId = object.orderId ?? 0n;
|
|
3596
|
+
message.accountId = object.accountId ?? 0;
|
|
3597
|
+
message.clientOrderId = object.clientOrderId ?? undefined;
|
|
3598
|
+
return message;
|
|
3599
|
+
},
|
|
3600
|
+
};
|
|
3601
|
+
function createBaseReceipt_Trade() {
|
|
3602
|
+
return { orderId: 0n, price: 0n, size: 0n, accountId: 0 };
|
|
3603
|
+
}
|
|
3604
|
+
exports.Receipt_Trade = {
|
|
3605
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
3606
|
+
if (message.orderId !== 0n) {
|
|
3607
|
+
if (BigInt.asUintN(64, message.orderId) !== message.orderId) {
|
|
3608
|
+
throw new globalThis.Error("value provided for field message.orderId of type uint64 too large");
|
|
3609
|
+
}
|
|
3610
|
+
writer.uint32(16).uint64(message.orderId);
|
|
3611
|
+
}
|
|
3612
|
+
if (message.price !== 0n) {
|
|
3613
|
+
if (BigInt.asUintN(64, message.price) !== message.price) {
|
|
3614
|
+
throw new globalThis.Error("value provided for field message.price of type uint64 too large");
|
|
3615
|
+
}
|
|
3616
|
+
writer.uint32(32).uint64(message.price);
|
|
3617
|
+
}
|
|
3618
|
+
if (message.size !== 0n) {
|
|
3619
|
+
if (BigInt.asUintN(64, message.size) !== message.size) {
|
|
3620
|
+
throw new globalThis.Error("value provided for field message.size of type uint64 too large");
|
|
3621
|
+
}
|
|
3622
|
+
writer.uint32(40).uint64(message.size);
|
|
3623
|
+
}
|
|
3624
|
+
if (message.accountId !== 0) {
|
|
3625
|
+
writer.uint32(48).uint32(message.accountId);
|
|
3626
|
+
}
|
|
3627
|
+
return writer;
|
|
3628
|
+
},
|
|
3629
|
+
decode(input, length) {
|
|
3630
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
3631
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
3632
|
+
const message = createBaseReceipt_Trade();
|
|
3633
|
+
while (reader.pos < end) {
|
|
3634
|
+
const tag = reader.uint32();
|
|
3635
|
+
switch (tag >>> 3) {
|
|
3636
|
+
case 2:
|
|
3637
|
+
if (tag !== 16) {
|
|
3638
|
+
break;
|
|
3639
|
+
}
|
|
3640
|
+
message.orderId = reader.uint64();
|
|
3641
|
+
continue;
|
|
3642
|
+
case 4:
|
|
3643
|
+
if (tag !== 32) {
|
|
3644
|
+
break;
|
|
3645
|
+
}
|
|
3646
|
+
message.price = reader.uint64();
|
|
3647
|
+
continue;
|
|
3648
|
+
case 5:
|
|
3649
|
+
if (tag !== 40) {
|
|
3650
|
+
break;
|
|
3651
|
+
}
|
|
3652
|
+
message.size = reader.uint64();
|
|
3653
|
+
continue;
|
|
3654
|
+
case 6:
|
|
3655
|
+
if (tag !== 48) {
|
|
3656
|
+
break;
|
|
3657
|
+
}
|
|
3658
|
+
message.accountId = reader.uint32();
|
|
3659
|
+
continue;
|
|
3660
|
+
}
|
|
3661
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3662
|
+
break;
|
|
3663
|
+
}
|
|
3664
|
+
reader.skip(tag & 7);
|
|
3665
|
+
}
|
|
3666
|
+
return message;
|
|
3667
|
+
},
|
|
3668
|
+
fromJSON(object) {
|
|
3669
|
+
return {
|
|
3670
|
+
orderId: isSet(object.orderId) ? BigInt(object.orderId) : 0n,
|
|
3671
|
+
price: isSet(object.price) ? BigInt(object.price) : 0n,
|
|
3672
|
+
size: isSet(object.size) ? BigInt(object.size) : 0n,
|
|
3673
|
+
accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0,
|
|
3674
|
+
};
|
|
3675
|
+
},
|
|
3676
|
+
toJSON(message) {
|
|
3677
|
+
const obj = {};
|
|
3678
|
+
if (message.orderId !== 0n) {
|
|
3679
|
+
obj.orderId = message.orderId.toString();
|
|
3680
|
+
}
|
|
3681
|
+
if (message.price !== 0n) {
|
|
3682
|
+
obj.price = message.price.toString();
|
|
3683
|
+
}
|
|
3684
|
+
if (message.size !== 0n) {
|
|
3685
|
+
obj.size = message.size.toString();
|
|
3686
|
+
}
|
|
3687
|
+
if (message.accountId !== 0) {
|
|
3688
|
+
obj.accountId = Math.round(message.accountId);
|
|
3689
|
+
}
|
|
3690
|
+
return obj;
|
|
3691
|
+
},
|
|
3692
|
+
create(base) {
|
|
3693
|
+
return exports.Receipt_Trade.fromPartial(base ?? {});
|
|
3694
|
+
},
|
|
3695
|
+
fromPartial(object) {
|
|
3696
|
+
const message = createBaseReceipt_Trade();
|
|
3697
|
+
message.orderId = object.orderId ?? 0n;
|
|
3698
|
+
message.price = object.price ?? 0n;
|
|
3699
|
+
message.size = object.size ?? 0n;
|
|
3700
|
+
message.accountId = object.accountId ?? 0;
|
|
3701
|
+
return message;
|
|
3702
|
+
},
|
|
3703
|
+
};
|
|
3704
|
+
function createBaseReceipt_CreateSessionResult() {
|
|
3705
|
+
return { sessionId: 0n };
|
|
3706
|
+
}
|
|
3707
|
+
exports.Receipt_CreateSessionResult = {
|
|
3708
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
3709
|
+
if (message.sessionId !== 0n) {
|
|
3710
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
3711
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
3712
|
+
}
|
|
3713
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
3714
|
+
}
|
|
3715
|
+
return writer;
|
|
3716
|
+
},
|
|
3717
|
+
decode(input, length) {
|
|
3718
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
3719
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
3720
|
+
const message = createBaseReceipt_CreateSessionResult();
|
|
3721
|
+
while (reader.pos < end) {
|
|
3722
|
+
const tag = reader.uint32();
|
|
3723
|
+
switch (tag >>> 3) {
|
|
3724
|
+
case 1:
|
|
3725
|
+
if (tag !== 8) {
|
|
3726
|
+
break;
|
|
3727
|
+
}
|
|
3728
|
+
message.sessionId = reader.uint64();
|
|
3729
|
+
continue;
|
|
3730
|
+
}
|
|
3731
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3732
|
+
break;
|
|
3733
|
+
}
|
|
3734
|
+
reader.skip(tag & 7);
|
|
3735
|
+
}
|
|
3736
|
+
return message;
|
|
3737
|
+
},
|
|
3738
|
+
fromJSON(object) {
|
|
3739
|
+
return { sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n };
|
|
3740
|
+
},
|
|
3741
|
+
toJSON(message) {
|
|
3742
|
+
const obj = {};
|
|
3743
|
+
if (message.sessionId !== 0n) {
|
|
3744
|
+
obj.sessionId = message.sessionId.toString();
|
|
3745
|
+
}
|
|
3746
|
+
return obj;
|
|
3747
|
+
},
|
|
3748
|
+
create(base) {
|
|
3749
|
+
return exports.Receipt_CreateSessionResult.fromPartial(base ?? {});
|
|
3750
|
+
},
|
|
3751
|
+
fromPartial(object) {
|
|
3752
|
+
const message = createBaseReceipt_CreateSessionResult();
|
|
3753
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
3754
|
+
return message;
|
|
3755
|
+
},
|
|
3756
|
+
};
|
|
3757
|
+
function createBaseReceipt_PlaceOrderResult() {
|
|
3758
|
+
return { posted: undefined, fills: [] };
|
|
3759
|
+
}
|
|
3760
|
+
exports.Receipt_PlaceOrderResult = {
|
|
3761
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
3762
|
+
if (message.posted !== undefined) {
|
|
3763
|
+
exports.Receipt_Posted.encode(message.posted, writer.uint32(10).fork()).join();
|
|
3764
|
+
}
|
|
3765
|
+
for (const v of message.fills) {
|
|
3766
|
+
exports.Receipt_Trade.encode(v, writer.uint32(18).fork()).join();
|
|
3767
|
+
}
|
|
3768
|
+
return writer;
|
|
3769
|
+
},
|
|
3770
|
+
decode(input, length) {
|
|
3771
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
3772
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
3773
|
+
const message = createBaseReceipt_PlaceOrderResult();
|
|
3774
|
+
while (reader.pos < end) {
|
|
3775
|
+
const tag = reader.uint32();
|
|
3776
|
+
switch (tag >>> 3) {
|
|
3777
|
+
case 1:
|
|
3778
|
+
if (tag !== 10) {
|
|
3779
|
+
break;
|
|
3780
|
+
}
|
|
3781
|
+
message.posted = exports.Receipt_Posted.decode(reader, reader.uint32());
|
|
3782
|
+
continue;
|
|
3783
|
+
case 2:
|
|
3784
|
+
if (tag !== 18) {
|
|
3785
|
+
break;
|
|
3786
|
+
}
|
|
3787
|
+
message.fills.push(exports.Receipt_Trade.decode(reader, reader.uint32()));
|
|
3788
|
+
continue;
|
|
3789
|
+
}
|
|
3790
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3791
|
+
break;
|
|
3792
|
+
}
|
|
3793
|
+
reader.skip(tag & 7);
|
|
3794
|
+
}
|
|
3795
|
+
return message;
|
|
3796
|
+
},
|
|
3797
|
+
fromJSON(object) {
|
|
3798
|
+
return {
|
|
3799
|
+
posted: isSet(object.posted) ? exports.Receipt_Posted.fromJSON(object.posted) : undefined,
|
|
3800
|
+
fills: globalThis.Array.isArray(object?.fills) ? object.fills.map((e) => exports.Receipt_Trade.fromJSON(e)) : [],
|
|
3801
|
+
};
|
|
3802
|
+
},
|
|
3803
|
+
toJSON(message) {
|
|
3804
|
+
const obj = {};
|
|
3805
|
+
if (message.posted !== undefined) {
|
|
3806
|
+
obj.posted = exports.Receipt_Posted.toJSON(message.posted);
|
|
3807
|
+
}
|
|
3808
|
+
if (message.fills?.length) {
|
|
3809
|
+
obj.fills = message.fills.map((e) => exports.Receipt_Trade.toJSON(e));
|
|
3810
|
+
}
|
|
3811
|
+
return obj;
|
|
3812
|
+
},
|
|
3813
|
+
create(base) {
|
|
3814
|
+
return exports.Receipt_PlaceOrderResult.fromPartial(base ?? {});
|
|
3815
|
+
},
|
|
3816
|
+
fromPartial(object) {
|
|
3817
|
+
const message = createBaseReceipt_PlaceOrderResult();
|
|
3818
|
+
message.posted = (object.posted !== undefined && object.posted !== null)
|
|
3819
|
+
? exports.Receipt_Posted.fromPartial(object.posted)
|
|
3820
|
+
: undefined;
|
|
3821
|
+
message.fills = object.fills?.map((e) => exports.Receipt_Trade.fromPartial(e)) || [];
|
|
3822
|
+
return message;
|
|
3823
|
+
},
|
|
3824
|
+
};
|
|
3825
|
+
function createBaseReceipt_CancelOrderResult() {
|
|
3826
|
+
return { orderId: 0n, accountId: 0 };
|
|
3827
|
+
}
|
|
3828
|
+
exports.Receipt_CancelOrderResult = {
|
|
3829
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
3830
|
+
if (message.orderId !== 0n) {
|
|
3831
|
+
if (BigInt.asUintN(64, message.orderId) !== message.orderId) {
|
|
3832
|
+
throw new globalThis.Error("value provided for field message.orderId of type uint64 too large");
|
|
3833
|
+
}
|
|
3834
|
+
writer.uint32(8).uint64(message.orderId);
|
|
3835
|
+
}
|
|
3836
|
+
if (message.accountId !== 0) {
|
|
3837
|
+
writer.uint32(16).uint32(message.accountId);
|
|
3838
|
+
}
|
|
3839
|
+
return writer;
|
|
3840
|
+
},
|
|
3841
|
+
decode(input, length) {
|
|
3842
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
3843
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
3844
|
+
const message = createBaseReceipt_CancelOrderResult();
|
|
3845
|
+
while (reader.pos < end) {
|
|
3846
|
+
const tag = reader.uint32();
|
|
3847
|
+
switch (tag >>> 3) {
|
|
3848
|
+
case 1:
|
|
3849
|
+
if (tag !== 8) {
|
|
3850
|
+
break;
|
|
3851
|
+
}
|
|
3852
|
+
message.orderId = reader.uint64();
|
|
3853
|
+
continue;
|
|
3854
|
+
case 2:
|
|
3855
|
+
if (tag !== 16) {
|
|
3856
|
+
break;
|
|
3857
|
+
}
|
|
3858
|
+
message.accountId = reader.uint32();
|
|
3859
|
+
continue;
|
|
3860
|
+
}
|
|
3861
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3862
|
+
break;
|
|
3863
|
+
}
|
|
3864
|
+
reader.skip(tag & 7);
|
|
3865
|
+
}
|
|
3866
|
+
return message;
|
|
3867
|
+
},
|
|
3868
|
+
fromJSON(object) {
|
|
3869
|
+
return {
|
|
3870
|
+
orderId: isSet(object.orderId) ? BigInt(object.orderId) : 0n,
|
|
3871
|
+
accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0,
|
|
3872
|
+
};
|
|
3873
|
+
},
|
|
3874
|
+
toJSON(message) {
|
|
3875
|
+
const obj = {};
|
|
3876
|
+
if (message.orderId !== 0n) {
|
|
3877
|
+
obj.orderId = message.orderId.toString();
|
|
3878
|
+
}
|
|
3879
|
+
if (message.accountId !== 0) {
|
|
3880
|
+
obj.accountId = Math.round(message.accountId);
|
|
3881
|
+
}
|
|
3882
|
+
return obj;
|
|
3883
|
+
},
|
|
3884
|
+
create(base) {
|
|
3885
|
+
return exports.Receipt_CancelOrderResult.fromPartial(base ?? {});
|
|
3886
|
+
},
|
|
3887
|
+
fromPartial(object) {
|
|
3888
|
+
const message = createBaseReceipt_CancelOrderResult();
|
|
3889
|
+
message.orderId = object.orderId ?? 0n;
|
|
3890
|
+
message.accountId = object.accountId ?? 0;
|
|
3891
|
+
return message;
|
|
3892
|
+
},
|
|
3893
|
+
};
|
|
3894
|
+
function createBaseReceipt_DepositResult() {
|
|
3895
|
+
return { tokenId: 0, amount: 0n, accountId: 0, userCreated: false, userPubkey: new Uint8Array(0) };
|
|
3896
|
+
}
|
|
3897
|
+
exports.Receipt_DepositResult = {
|
|
3898
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
3899
|
+
if (message.tokenId !== 0) {
|
|
3900
|
+
writer.uint32(8).uint32(message.tokenId);
|
|
3901
|
+
}
|
|
3902
|
+
if (message.amount !== 0n) {
|
|
3903
|
+
if (BigInt.asUintN(64, message.amount) !== message.amount) {
|
|
3904
|
+
throw new globalThis.Error("value provided for field message.amount of type uint64 too large");
|
|
3905
|
+
}
|
|
3906
|
+
writer.uint32(16).uint64(message.amount);
|
|
3907
|
+
}
|
|
3908
|
+
if (message.accountId !== 0) {
|
|
3909
|
+
writer.uint32(24).uint32(message.accountId);
|
|
3910
|
+
}
|
|
3911
|
+
if (message.userCreated !== false) {
|
|
3912
|
+
writer.uint32(32).bool(message.userCreated);
|
|
3913
|
+
}
|
|
3914
|
+
if (message.userPubkey.length !== 0) {
|
|
3915
|
+
writer.uint32(42).bytes(message.userPubkey);
|
|
3916
|
+
}
|
|
3917
|
+
return writer;
|
|
3918
|
+
},
|
|
3919
|
+
decode(input, length) {
|
|
3920
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
3921
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
3922
|
+
const message = createBaseReceipt_DepositResult();
|
|
3923
|
+
while (reader.pos < end) {
|
|
3924
|
+
const tag = reader.uint32();
|
|
3925
|
+
switch (tag >>> 3) {
|
|
3926
|
+
case 1:
|
|
3927
|
+
if (tag !== 8) {
|
|
3928
|
+
break;
|
|
3929
|
+
}
|
|
3930
|
+
message.tokenId = reader.uint32();
|
|
3931
|
+
continue;
|
|
3932
|
+
case 2:
|
|
3933
|
+
if (tag !== 16) {
|
|
3934
|
+
break;
|
|
3935
|
+
}
|
|
3936
|
+
message.amount = reader.uint64();
|
|
3937
|
+
continue;
|
|
3938
|
+
case 3:
|
|
3939
|
+
if (tag !== 24) {
|
|
3940
|
+
break;
|
|
3941
|
+
}
|
|
3942
|
+
message.accountId = reader.uint32();
|
|
3943
|
+
continue;
|
|
3944
|
+
case 4:
|
|
3945
|
+
if (tag !== 32) {
|
|
3946
|
+
break;
|
|
3947
|
+
}
|
|
3948
|
+
message.userCreated = reader.bool();
|
|
3949
|
+
continue;
|
|
3950
|
+
case 5:
|
|
3951
|
+
if (tag !== 42) {
|
|
3952
|
+
break;
|
|
3953
|
+
}
|
|
3954
|
+
message.userPubkey = reader.bytes();
|
|
3955
|
+
continue;
|
|
3956
|
+
}
|
|
3957
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3958
|
+
break;
|
|
3959
|
+
}
|
|
3960
|
+
reader.skip(tag & 7);
|
|
3961
|
+
}
|
|
3962
|
+
return message;
|
|
3963
|
+
},
|
|
3964
|
+
fromJSON(object) {
|
|
3965
|
+
return {
|
|
3966
|
+
tokenId: isSet(object.tokenId) ? globalThis.Number(object.tokenId) : 0,
|
|
3967
|
+
amount: isSet(object.amount) ? BigInt(object.amount) : 0n,
|
|
3968
|
+
accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0,
|
|
3969
|
+
userCreated: isSet(object.userCreated) ? globalThis.Boolean(object.userCreated) : false,
|
|
3970
|
+
userPubkey: isSet(object.userPubkey) ? bytesFromBase64(object.userPubkey) : new Uint8Array(0),
|
|
3971
|
+
};
|
|
3972
|
+
},
|
|
3973
|
+
toJSON(message) {
|
|
3974
|
+
const obj = {};
|
|
3975
|
+
if (message.tokenId !== 0) {
|
|
3976
|
+
obj.tokenId = Math.round(message.tokenId);
|
|
3977
|
+
}
|
|
3978
|
+
if (message.amount !== 0n) {
|
|
3979
|
+
obj.amount = message.amount.toString();
|
|
3980
|
+
}
|
|
3981
|
+
if (message.accountId !== 0) {
|
|
3982
|
+
obj.accountId = Math.round(message.accountId);
|
|
3983
|
+
}
|
|
3984
|
+
if (message.userCreated !== false) {
|
|
3985
|
+
obj.userCreated = message.userCreated;
|
|
3986
|
+
}
|
|
3987
|
+
if (message.userPubkey.length !== 0) {
|
|
3988
|
+
obj.userPubkey = base64FromBytes(message.userPubkey);
|
|
3989
|
+
}
|
|
3990
|
+
return obj;
|
|
3991
|
+
},
|
|
3992
|
+
create(base) {
|
|
3993
|
+
return exports.Receipt_DepositResult.fromPartial(base ?? {});
|
|
3994
|
+
},
|
|
3995
|
+
fromPartial(object) {
|
|
3996
|
+
const message = createBaseReceipt_DepositResult();
|
|
3997
|
+
message.tokenId = object.tokenId ?? 0;
|
|
3998
|
+
message.amount = object.amount ?? 0n;
|
|
3999
|
+
message.accountId = object.accountId ?? 0;
|
|
4000
|
+
message.userCreated = object.userCreated ?? false;
|
|
4001
|
+
message.userPubkey = object.userPubkey ?? new Uint8Array(0);
|
|
4002
|
+
return message;
|
|
4003
|
+
},
|
|
4004
|
+
};
|
|
4005
|
+
function createBaseReceipt_InsertTokenResult() {
|
|
4006
|
+
return { chainAddr: new Uint8Array(0), token: undefined };
|
|
4007
|
+
}
|
|
4008
|
+
exports.Receipt_InsertTokenResult = {
|
|
4009
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
4010
|
+
if (message.chainAddr.length !== 0) {
|
|
4011
|
+
writer.uint32(10).bytes(message.chainAddr);
|
|
4012
|
+
}
|
|
4013
|
+
if (message.token !== undefined) {
|
|
4014
|
+
exports.Token.encode(message.token, writer.uint32(18).fork()).join();
|
|
4015
|
+
}
|
|
4016
|
+
return writer;
|
|
4017
|
+
},
|
|
4018
|
+
decode(input, length) {
|
|
4019
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4020
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4021
|
+
const message = createBaseReceipt_InsertTokenResult();
|
|
4022
|
+
while (reader.pos < end) {
|
|
4023
|
+
const tag = reader.uint32();
|
|
4024
|
+
switch (tag >>> 3) {
|
|
4025
|
+
case 1:
|
|
4026
|
+
if (tag !== 10) {
|
|
4027
|
+
break;
|
|
4028
|
+
}
|
|
4029
|
+
message.chainAddr = reader.bytes();
|
|
4030
|
+
continue;
|
|
4031
|
+
case 2:
|
|
4032
|
+
if (tag !== 18) {
|
|
4033
|
+
break;
|
|
4034
|
+
}
|
|
4035
|
+
message.token = exports.Token.decode(reader, reader.uint32());
|
|
4036
|
+
continue;
|
|
4037
|
+
}
|
|
4038
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4039
|
+
break;
|
|
4040
|
+
}
|
|
4041
|
+
reader.skip(tag & 7);
|
|
4042
|
+
}
|
|
4043
|
+
return message;
|
|
4044
|
+
},
|
|
4045
|
+
fromJSON(object) {
|
|
4046
|
+
return {
|
|
4047
|
+
chainAddr: isSet(object.chainAddr) ? bytesFromBase64(object.chainAddr) : new Uint8Array(0),
|
|
4048
|
+
token: isSet(object.token) ? exports.Token.fromJSON(object.token) : undefined,
|
|
4049
|
+
};
|
|
4050
|
+
},
|
|
4051
|
+
toJSON(message) {
|
|
4052
|
+
const obj = {};
|
|
4053
|
+
if (message.chainAddr.length !== 0) {
|
|
4054
|
+
obj.chainAddr = base64FromBytes(message.chainAddr);
|
|
4055
|
+
}
|
|
4056
|
+
if (message.token !== undefined) {
|
|
4057
|
+
obj.token = exports.Token.toJSON(message.token);
|
|
4058
|
+
}
|
|
4059
|
+
return obj;
|
|
4060
|
+
},
|
|
4061
|
+
create(base) {
|
|
4062
|
+
return exports.Receipt_InsertTokenResult.fromPartial(base ?? {});
|
|
4063
|
+
},
|
|
4064
|
+
fromPartial(object) {
|
|
4065
|
+
const message = createBaseReceipt_InsertTokenResult();
|
|
4066
|
+
message.chainAddr = object.chainAddr ?? new Uint8Array(0);
|
|
4067
|
+
message.token = (object.token !== undefined && object.token !== null) ? exports.Token.fromPartial(object.token) : undefined;
|
|
4068
|
+
return message;
|
|
4069
|
+
},
|
|
4070
|
+
};
|
|
4071
|
+
function createBaseReceipt_InsertMarketResult() {
|
|
4072
|
+
return { market: undefined };
|
|
4073
|
+
}
|
|
4074
|
+
exports.Receipt_InsertMarketResult = {
|
|
4075
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
4076
|
+
if (message.market !== undefined) {
|
|
4077
|
+
exports.Market.encode(message.market, writer.uint32(10).fork()).join();
|
|
4078
|
+
}
|
|
4079
|
+
return writer;
|
|
4080
|
+
},
|
|
4081
|
+
decode(input, length) {
|
|
4082
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4083
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4084
|
+
const message = createBaseReceipt_InsertMarketResult();
|
|
4085
|
+
while (reader.pos < end) {
|
|
4086
|
+
const tag = reader.uint32();
|
|
4087
|
+
switch (tag >>> 3) {
|
|
4088
|
+
case 1:
|
|
4089
|
+
if (tag !== 10) {
|
|
4090
|
+
break;
|
|
4091
|
+
}
|
|
4092
|
+
message.market = exports.Market.decode(reader, reader.uint32());
|
|
4093
|
+
continue;
|
|
4094
|
+
}
|
|
4095
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4096
|
+
break;
|
|
4097
|
+
}
|
|
4098
|
+
reader.skip(tag & 7);
|
|
4099
|
+
}
|
|
4100
|
+
return message;
|
|
4101
|
+
},
|
|
4102
|
+
fromJSON(object) {
|
|
4103
|
+
return { market: isSet(object.market) ? exports.Market.fromJSON(object.market) : undefined };
|
|
4104
|
+
},
|
|
4105
|
+
toJSON(message) {
|
|
4106
|
+
const obj = {};
|
|
4107
|
+
if (message.market !== undefined) {
|
|
4108
|
+
obj.market = exports.Market.toJSON(message.market);
|
|
4109
|
+
}
|
|
4110
|
+
return obj;
|
|
4111
|
+
},
|
|
4112
|
+
create(base) {
|
|
4113
|
+
return exports.Receipt_InsertMarketResult.fromPartial(base ?? {});
|
|
4114
|
+
},
|
|
4115
|
+
fromPartial(object) {
|
|
4116
|
+
const message = createBaseReceipt_InsertMarketResult();
|
|
4117
|
+
message.market = (object.market !== undefined && object.market !== null)
|
|
4118
|
+
? exports.Market.fromPartial(object.market)
|
|
4119
|
+
: undefined;
|
|
4120
|
+
return message;
|
|
4121
|
+
},
|
|
4122
|
+
};
|
|
4123
|
+
function createBaseReceipt_WithdrawResult() {
|
|
4124
|
+
return { tokenId: 0, amount: 0n, balance: 0n, accountId: 0, userPubkey: new Uint8Array(0) };
|
|
4125
|
+
}
|
|
4126
|
+
exports.Receipt_WithdrawResult = {
|
|
4127
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
4128
|
+
if (message.tokenId !== 0) {
|
|
4129
|
+
writer.uint32(8).uint32(message.tokenId);
|
|
4130
|
+
}
|
|
4131
|
+
if (message.amount !== 0n) {
|
|
4132
|
+
if (BigInt.asUintN(64, message.amount) !== message.amount) {
|
|
4133
|
+
throw new globalThis.Error("value provided for field message.amount of type uint64 too large");
|
|
4134
|
+
}
|
|
4135
|
+
writer.uint32(16).uint64(message.amount);
|
|
4136
|
+
}
|
|
4137
|
+
if (message.balance !== 0n) {
|
|
4138
|
+
if (BigInt.asUintN(64, message.balance) !== message.balance) {
|
|
4139
|
+
throw new globalThis.Error("value provided for field message.balance of type uint64 too large");
|
|
4140
|
+
}
|
|
4141
|
+
writer.uint32(24).uint64(message.balance);
|
|
4142
|
+
}
|
|
4143
|
+
if (message.accountId !== 0) {
|
|
4144
|
+
writer.uint32(32).uint32(message.accountId);
|
|
4145
|
+
}
|
|
4146
|
+
if (message.userPubkey.length !== 0) {
|
|
4147
|
+
writer.uint32(42).bytes(message.userPubkey);
|
|
4148
|
+
}
|
|
4149
|
+
return writer;
|
|
4150
|
+
},
|
|
4151
|
+
decode(input, length) {
|
|
4152
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4153
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4154
|
+
const message = createBaseReceipt_WithdrawResult();
|
|
4155
|
+
while (reader.pos < end) {
|
|
4156
|
+
const tag = reader.uint32();
|
|
4157
|
+
switch (tag >>> 3) {
|
|
4158
|
+
case 1:
|
|
4159
|
+
if (tag !== 8) {
|
|
4160
|
+
break;
|
|
4161
|
+
}
|
|
4162
|
+
message.tokenId = reader.uint32();
|
|
4163
|
+
continue;
|
|
4164
|
+
case 2:
|
|
4165
|
+
if (tag !== 16) {
|
|
4166
|
+
break;
|
|
4167
|
+
}
|
|
4168
|
+
message.amount = reader.uint64();
|
|
4169
|
+
continue;
|
|
4170
|
+
case 3:
|
|
4171
|
+
if (tag !== 24) {
|
|
4172
|
+
break;
|
|
4173
|
+
}
|
|
4174
|
+
message.balance = reader.uint64();
|
|
4175
|
+
continue;
|
|
4176
|
+
case 4:
|
|
4177
|
+
if (tag !== 32) {
|
|
4178
|
+
break;
|
|
4179
|
+
}
|
|
4180
|
+
message.accountId = reader.uint32();
|
|
4181
|
+
continue;
|
|
4182
|
+
case 5:
|
|
4183
|
+
if (tag !== 42) {
|
|
4184
|
+
break;
|
|
4185
|
+
}
|
|
4186
|
+
message.userPubkey = reader.bytes();
|
|
4187
|
+
continue;
|
|
4188
|
+
}
|
|
4189
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4190
|
+
break;
|
|
4191
|
+
}
|
|
4192
|
+
reader.skip(tag & 7);
|
|
4193
|
+
}
|
|
4194
|
+
return message;
|
|
4195
|
+
},
|
|
4196
|
+
fromJSON(object) {
|
|
4197
|
+
return {
|
|
4198
|
+
tokenId: isSet(object.tokenId) ? globalThis.Number(object.tokenId) : 0,
|
|
4199
|
+
amount: isSet(object.amount) ? BigInt(object.amount) : 0n,
|
|
4200
|
+
balance: isSet(object.balance) ? BigInt(object.balance) : 0n,
|
|
4201
|
+
accountId: isSet(object.accountId) ? globalThis.Number(object.accountId) : 0,
|
|
4202
|
+
userPubkey: isSet(object.userPubkey) ? bytesFromBase64(object.userPubkey) : new Uint8Array(0),
|
|
4203
|
+
};
|
|
4204
|
+
},
|
|
4205
|
+
toJSON(message) {
|
|
4206
|
+
const obj = {};
|
|
4207
|
+
if (message.tokenId !== 0) {
|
|
4208
|
+
obj.tokenId = Math.round(message.tokenId);
|
|
4209
|
+
}
|
|
4210
|
+
if (message.amount !== 0n) {
|
|
4211
|
+
obj.amount = message.amount.toString();
|
|
4212
|
+
}
|
|
4213
|
+
if (message.balance !== 0n) {
|
|
4214
|
+
obj.balance = message.balance.toString();
|
|
4215
|
+
}
|
|
4216
|
+
if (message.accountId !== 0) {
|
|
4217
|
+
obj.accountId = Math.round(message.accountId);
|
|
4218
|
+
}
|
|
4219
|
+
if (message.userPubkey.length !== 0) {
|
|
4220
|
+
obj.userPubkey = base64FromBytes(message.userPubkey);
|
|
4221
|
+
}
|
|
4222
|
+
return obj;
|
|
4223
|
+
},
|
|
4224
|
+
create(base) {
|
|
4225
|
+
return exports.Receipt_WithdrawResult.fromPartial(base ?? {});
|
|
4226
|
+
},
|
|
4227
|
+
fromPartial(object) {
|
|
4228
|
+
const message = createBaseReceipt_WithdrawResult();
|
|
4229
|
+
message.tokenId = object.tokenId ?? 0;
|
|
4230
|
+
message.amount = object.amount ?? 0n;
|
|
4231
|
+
message.balance = object.balance ?? 0n;
|
|
4232
|
+
message.accountId = object.accountId ?? 0;
|
|
4233
|
+
message.userPubkey = object.userPubkey ?? new Uint8Array(0);
|
|
4234
|
+
return message;
|
|
4235
|
+
},
|
|
4236
|
+
};
|
|
4237
|
+
function createBaseReceipt_OracleSymbolFeedResult() {
|
|
4238
|
+
return { oracleSymbol: "", feedId: new Uint8Array(0) };
|
|
4239
|
+
}
|
|
4240
|
+
exports.Receipt_OracleSymbolFeedResult = {
|
|
4241
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
4242
|
+
if (message.oracleSymbol !== "") {
|
|
4243
|
+
writer.uint32(10).string(message.oracleSymbol);
|
|
4244
|
+
}
|
|
4245
|
+
if (message.feedId.length !== 0) {
|
|
4246
|
+
writer.uint32(18).bytes(message.feedId);
|
|
4247
|
+
}
|
|
4248
|
+
return writer;
|
|
4249
|
+
},
|
|
4250
|
+
decode(input, length) {
|
|
4251
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4252
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4253
|
+
const message = createBaseReceipt_OracleSymbolFeedResult();
|
|
4254
|
+
while (reader.pos < end) {
|
|
4255
|
+
const tag = reader.uint32();
|
|
4256
|
+
switch (tag >>> 3) {
|
|
4257
|
+
case 1:
|
|
4258
|
+
if (tag !== 10) {
|
|
4259
|
+
break;
|
|
4260
|
+
}
|
|
4261
|
+
message.oracleSymbol = reader.string();
|
|
4262
|
+
continue;
|
|
4263
|
+
case 2:
|
|
4264
|
+
if (tag !== 18) {
|
|
4265
|
+
break;
|
|
4266
|
+
}
|
|
4267
|
+
message.feedId = reader.bytes();
|
|
4268
|
+
continue;
|
|
4269
|
+
}
|
|
4270
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4271
|
+
break;
|
|
4272
|
+
}
|
|
4273
|
+
reader.skip(tag & 7);
|
|
4274
|
+
}
|
|
4275
|
+
return message;
|
|
4276
|
+
},
|
|
4277
|
+
fromJSON(object) {
|
|
4278
|
+
return {
|
|
4279
|
+
oracleSymbol: isSet(object.oracleSymbol) ? globalThis.String(object.oracleSymbol) : "",
|
|
4280
|
+
feedId: isSet(object.feedId) ? bytesFromBase64(object.feedId) : new Uint8Array(0),
|
|
4281
|
+
};
|
|
4282
|
+
},
|
|
4283
|
+
toJSON(message) {
|
|
4284
|
+
const obj = {};
|
|
4285
|
+
if (message.oracleSymbol !== "") {
|
|
4286
|
+
obj.oracleSymbol = message.oracleSymbol;
|
|
4287
|
+
}
|
|
4288
|
+
if (message.feedId.length !== 0) {
|
|
4289
|
+
obj.feedId = base64FromBytes(message.feedId);
|
|
4290
|
+
}
|
|
4291
|
+
return obj;
|
|
4292
|
+
},
|
|
4293
|
+
create(base) {
|
|
4294
|
+
return exports.Receipt_OracleSymbolFeedResult.fromPartial(base ?? {});
|
|
4295
|
+
},
|
|
4296
|
+
fromPartial(object) {
|
|
4297
|
+
const message = createBaseReceipt_OracleSymbolFeedResult();
|
|
4298
|
+
message.oracleSymbol = object.oracleSymbol ?? "";
|
|
4299
|
+
message.feedId = object.feedId ?? new Uint8Array(0);
|
|
4300
|
+
return message;
|
|
4301
|
+
},
|
|
4302
|
+
};
|
|
4303
|
+
function createBaseReceipt_OracleUpdateResult() {
|
|
4304
|
+
return { timestamp: 0n };
|
|
4305
|
+
}
|
|
4306
|
+
exports.Receipt_OracleUpdateResult = {
|
|
4307
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
4308
|
+
if (message.timestamp !== 0n) {
|
|
4309
|
+
if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
|
|
4310
|
+
throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
|
|
4311
|
+
}
|
|
4312
|
+
writer.uint32(8).int64(message.timestamp);
|
|
4313
|
+
}
|
|
4314
|
+
return writer;
|
|
4315
|
+
},
|
|
4316
|
+
decode(input, length) {
|
|
4317
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4318
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4319
|
+
const message = createBaseReceipt_OracleUpdateResult();
|
|
4320
|
+
while (reader.pos < end) {
|
|
4321
|
+
const tag = reader.uint32();
|
|
4322
|
+
switch (tag >>> 3) {
|
|
4323
|
+
case 1:
|
|
4324
|
+
if (tag !== 8) {
|
|
4325
|
+
break;
|
|
4326
|
+
}
|
|
4327
|
+
message.timestamp = reader.int64();
|
|
4328
|
+
continue;
|
|
4329
|
+
}
|
|
4330
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4331
|
+
break;
|
|
4332
|
+
}
|
|
4333
|
+
reader.skip(tag & 7);
|
|
4334
|
+
}
|
|
4335
|
+
return message;
|
|
4336
|
+
},
|
|
4337
|
+
fromJSON(object) {
|
|
4338
|
+
return { timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n };
|
|
4339
|
+
},
|
|
4340
|
+
toJSON(message) {
|
|
4341
|
+
const obj = {};
|
|
4342
|
+
if (message.timestamp !== 0n) {
|
|
4343
|
+
obj.timestamp = message.timestamp.toString();
|
|
4344
|
+
}
|
|
4345
|
+
return obj;
|
|
4346
|
+
},
|
|
4347
|
+
create(base) {
|
|
4348
|
+
return exports.Receipt_OracleUpdateResult.fromPartial(base ?? {});
|
|
4349
|
+
},
|
|
4350
|
+
fromPartial(object) {
|
|
4351
|
+
const message = createBaseReceipt_OracleUpdateResult();
|
|
4352
|
+
message.timestamp = object.timestamp ?? 0n;
|
|
4353
|
+
return message;
|
|
4354
|
+
},
|
|
4355
|
+
};
|
|
4356
|
+
function createBaseReceipt_UpdateGuardianSetResult() {
|
|
4357
|
+
return { guardianSetIndex: 0, addresses: [] };
|
|
4358
|
+
}
|
|
4359
|
+
exports.Receipt_UpdateGuardianSetResult = {
|
|
4360
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
4361
|
+
if (message.guardianSetIndex !== 0) {
|
|
4362
|
+
writer.uint32(8).uint32(message.guardianSetIndex);
|
|
4363
|
+
}
|
|
4364
|
+
for (const v of message.addresses) {
|
|
4365
|
+
writer.uint32(18).bytes(v);
|
|
4366
|
+
}
|
|
4367
|
+
return writer;
|
|
4368
|
+
},
|
|
4369
|
+
decode(input, length) {
|
|
4370
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4371
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4372
|
+
const message = createBaseReceipt_UpdateGuardianSetResult();
|
|
4373
|
+
while (reader.pos < end) {
|
|
4374
|
+
const tag = reader.uint32();
|
|
4375
|
+
switch (tag >>> 3) {
|
|
4376
|
+
case 1:
|
|
4377
|
+
if (tag !== 8) {
|
|
4378
|
+
break;
|
|
4379
|
+
}
|
|
4380
|
+
message.guardianSetIndex = reader.uint32();
|
|
4381
|
+
continue;
|
|
4382
|
+
case 2:
|
|
4383
|
+
if (tag !== 18) {
|
|
4384
|
+
break;
|
|
4385
|
+
}
|
|
4386
|
+
message.addresses.push(reader.bytes());
|
|
4387
|
+
continue;
|
|
4388
|
+
}
|
|
4389
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4390
|
+
break;
|
|
4391
|
+
}
|
|
4392
|
+
reader.skip(tag & 7);
|
|
4393
|
+
}
|
|
4394
|
+
return message;
|
|
4395
|
+
},
|
|
4396
|
+
fromJSON(object) {
|
|
4397
|
+
return {
|
|
4398
|
+
guardianSetIndex: isSet(object.guardianSetIndex) ? globalThis.Number(object.guardianSetIndex) : 0,
|
|
4399
|
+
addresses: globalThis.Array.isArray(object?.addresses)
|
|
4400
|
+
? object.addresses.map((e) => bytesFromBase64(e))
|
|
4401
|
+
: [],
|
|
4402
|
+
};
|
|
4403
|
+
},
|
|
4404
|
+
toJSON(message) {
|
|
4405
|
+
const obj = {};
|
|
4406
|
+
if (message.guardianSetIndex !== 0) {
|
|
4407
|
+
obj.guardianSetIndex = Math.round(message.guardianSetIndex);
|
|
4408
|
+
}
|
|
4409
|
+
if (message.addresses?.length) {
|
|
4410
|
+
obj.addresses = message.addresses.map((e) => base64FromBytes(e));
|
|
4411
|
+
}
|
|
4412
|
+
return obj;
|
|
4413
|
+
},
|
|
4414
|
+
create(base) {
|
|
4415
|
+
return exports.Receipt_UpdateGuardianSetResult.fromPartial(base ?? {});
|
|
4416
|
+
},
|
|
4417
|
+
fromPartial(object) {
|
|
4418
|
+
const message = createBaseReceipt_UpdateGuardianSetResult();
|
|
4419
|
+
message.guardianSetIndex = object.guardianSetIndex ?? 0;
|
|
4420
|
+
message.addresses = object.addresses?.map((e) => e) || [];
|
|
4421
|
+
return message;
|
|
4422
|
+
},
|
|
4423
|
+
};
|
|
4424
|
+
function createBaseReceipt_Liquidated() {
|
|
4425
|
+
return {};
|
|
4426
|
+
}
|
|
4427
|
+
exports.Receipt_Liquidated = {
|
|
4428
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
4429
|
+
return writer;
|
|
4430
|
+
},
|
|
4431
|
+
decode(input, length) {
|
|
4432
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4433
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4434
|
+
const message = createBaseReceipt_Liquidated();
|
|
4435
|
+
while (reader.pos < end) {
|
|
4436
|
+
const tag = reader.uint32();
|
|
4437
|
+
switch (tag >>> 3) {
|
|
4438
|
+
}
|
|
4439
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4440
|
+
break;
|
|
4441
|
+
}
|
|
4442
|
+
reader.skip(tag & 7);
|
|
4443
|
+
}
|
|
4444
|
+
return message;
|
|
4445
|
+
},
|
|
4446
|
+
fromJSON(_) {
|
|
4447
|
+
return {};
|
|
4448
|
+
},
|
|
4449
|
+
toJSON(_) {
|
|
4450
|
+
const obj = {};
|
|
4451
|
+
return obj;
|
|
4452
|
+
},
|
|
4453
|
+
create(base) {
|
|
4454
|
+
return exports.Receipt_Liquidated.fromPartial(base ?? {});
|
|
4455
|
+
},
|
|
4456
|
+
fromPartial(_) {
|
|
4457
|
+
const message = createBaseReceipt_Liquidated();
|
|
4458
|
+
return message;
|
|
4459
|
+
},
|
|
4460
|
+
};
|
|
4461
|
+
function createBaseReceipt_SessionRevoked() {
|
|
4462
|
+
return {};
|
|
4463
|
+
}
|
|
4464
|
+
exports.Receipt_SessionRevoked = {
|
|
4465
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
4466
|
+
return writer;
|
|
4467
|
+
},
|
|
4468
|
+
decode(input, length) {
|
|
4469
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4470
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4471
|
+
const message = createBaseReceipt_SessionRevoked();
|
|
4472
|
+
while (reader.pos < end) {
|
|
4473
|
+
const tag = reader.uint32();
|
|
4474
|
+
switch (tag >>> 3) {
|
|
4475
|
+
}
|
|
4476
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4477
|
+
break;
|
|
4478
|
+
}
|
|
4479
|
+
reader.skip(tag & 7);
|
|
4480
|
+
}
|
|
4481
|
+
return message;
|
|
4482
|
+
},
|
|
4483
|
+
fromJSON(_) {
|
|
4484
|
+
return {};
|
|
4485
|
+
},
|
|
4486
|
+
toJSON(_) {
|
|
4487
|
+
const obj = {};
|
|
4488
|
+
return obj;
|
|
4489
|
+
},
|
|
4490
|
+
create(base) {
|
|
4491
|
+
return exports.Receipt_SessionRevoked.fromPartial(base ?? {});
|
|
4492
|
+
},
|
|
4493
|
+
fromPartial(_) {
|
|
4494
|
+
const message = createBaseReceipt_SessionRevoked();
|
|
4495
|
+
return message;
|
|
4496
|
+
},
|
|
4497
|
+
};
|
|
4498
|
+
function createBaseReceipt_Paused() {
|
|
4499
|
+
return {};
|
|
4500
|
+
}
|
|
4501
|
+
exports.Receipt_Paused = {
|
|
4502
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
4503
|
+
return writer;
|
|
4504
|
+
},
|
|
4505
|
+
decode(input, length) {
|
|
4506
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4507
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4508
|
+
const message = createBaseReceipt_Paused();
|
|
4509
|
+
while (reader.pos < end) {
|
|
4510
|
+
const tag = reader.uint32();
|
|
4511
|
+
switch (tag >>> 3) {
|
|
4512
|
+
}
|
|
4513
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4514
|
+
break;
|
|
4515
|
+
}
|
|
4516
|
+
reader.skip(tag & 7);
|
|
4517
|
+
}
|
|
4518
|
+
return message;
|
|
4519
|
+
},
|
|
4520
|
+
fromJSON(_) {
|
|
4521
|
+
return {};
|
|
4522
|
+
},
|
|
4523
|
+
toJSON(_) {
|
|
4524
|
+
const obj = {};
|
|
4525
|
+
return obj;
|
|
4526
|
+
},
|
|
4527
|
+
create(base) {
|
|
4528
|
+
return exports.Receipt_Paused.fromPartial(base ?? {});
|
|
4529
|
+
},
|
|
4530
|
+
fromPartial(_) {
|
|
4531
|
+
const message = createBaseReceipt_Paused();
|
|
4532
|
+
return message;
|
|
4533
|
+
},
|
|
4534
|
+
};
|
|
4535
|
+
function createBaseReceipt_Unpaused() {
|
|
4536
|
+
return {};
|
|
4537
|
+
}
|
|
4538
|
+
exports.Receipt_Unpaused = {
|
|
4539
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
4540
|
+
return writer;
|
|
4541
|
+
},
|
|
4542
|
+
decode(input, length) {
|
|
4543
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4544
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4545
|
+
const message = createBaseReceipt_Unpaused();
|
|
4546
|
+
while (reader.pos < end) {
|
|
4547
|
+
const tag = reader.uint32();
|
|
4548
|
+
switch (tag >>> 3) {
|
|
4549
|
+
}
|
|
4550
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4551
|
+
break;
|
|
4552
|
+
}
|
|
4553
|
+
reader.skip(tag & 7);
|
|
4554
|
+
}
|
|
4555
|
+
return message;
|
|
4556
|
+
},
|
|
4557
|
+
fromJSON(_) {
|
|
4558
|
+
return {};
|
|
4559
|
+
},
|
|
4560
|
+
toJSON(_) {
|
|
4561
|
+
const obj = {};
|
|
4562
|
+
return obj;
|
|
4563
|
+
},
|
|
4564
|
+
create(base) {
|
|
4565
|
+
return exports.Receipt_Unpaused.fromPartial(base ?? {});
|
|
4566
|
+
},
|
|
4567
|
+
fromPartial(_) {
|
|
4568
|
+
const message = createBaseReceipt_Unpaused();
|
|
4569
|
+
return message;
|
|
4570
|
+
},
|
|
4571
|
+
};
|
|
4572
|
+
function createBaseReceipt_Transferred() {
|
|
4573
|
+
return { fromAccountId: 0, toAccountId: 0, tokenId: 0, amount: 0n, accountCreated: false };
|
|
4574
|
+
}
|
|
4575
|
+
exports.Receipt_Transferred = {
|
|
4576
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
4577
|
+
if (message.fromAccountId !== 0) {
|
|
4578
|
+
writer.uint32(8).uint32(message.fromAccountId);
|
|
4579
|
+
}
|
|
4580
|
+
if (message.toAccountId !== 0) {
|
|
4581
|
+
writer.uint32(16).uint32(message.toAccountId);
|
|
4582
|
+
}
|
|
4583
|
+
if (message.tokenId !== 0) {
|
|
4584
|
+
writer.uint32(24).uint32(message.tokenId);
|
|
4585
|
+
}
|
|
4586
|
+
if (message.amount !== 0n) {
|
|
4587
|
+
if (BigInt.asUintN(64, message.amount) !== message.amount) {
|
|
4588
|
+
throw new globalThis.Error("value provided for field message.amount of type uint64 too large");
|
|
4589
|
+
}
|
|
4590
|
+
writer.uint32(32).uint64(message.amount);
|
|
4591
|
+
}
|
|
4592
|
+
if (message.accountCreated !== false) {
|
|
4593
|
+
writer.uint32(40).bool(message.accountCreated);
|
|
4594
|
+
}
|
|
4595
|
+
return writer;
|
|
4596
|
+
},
|
|
4597
|
+
decode(input, length) {
|
|
4598
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4599
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4600
|
+
const message = createBaseReceipt_Transferred();
|
|
4601
|
+
while (reader.pos < end) {
|
|
4602
|
+
const tag = reader.uint32();
|
|
4603
|
+
switch (tag >>> 3) {
|
|
4604
|
+
case 1:
|
|
4605
|
+
if (tag !== 8) {
|
|
4606
|
+
break;
|
|
4607
|
+
}
|
|
4608
|
+
message.fromAccountId = reader.uint32();
|
|
4609
|
+
continue;
|
|
4610
|
+
case 2:
|
|
4611
|
+
if (tag !== 16) {
|
|
4612
|
+
break;
|
|
4613
|
+
}
|
|
4614
|
+
message.toAccountId = reader.uint32();
|
|
4615
|
+
continue;
|
|
4616
|
+
case 3:
|
|
4617
|
+
if (tag !== 24) {
|
|
4618
|
+
break;
|
|
4619
|
+
}
|
|
4620
|
+
message.tokenId = reader.uint32();
|
|
4621
|
+
continue;
|
|
4622
|
+
case 4:
|
|
4623
|
+
if (tag !== 32) {
|
|
4624
|
+
break;
|
|
4625
|
+
}
|
|
4626
|
+
message.amount = reader.uint64();
|
|
4627
|
+
continue;
|
|
4628
|
+
case 5:
|
|
4629
|
+
if (tag !== 40) {
|
|
4630
|
+
break;
|
|
4631
|
+
}
|
|
4632
|
+
message.accountCreated = reader.bool();
|
|
4633
|
+
continue;
|
|
4634
|
+
}
|
|
4635
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4636
|
+
break;
|
|
4637
|
+
}
|
|
4638
|
+
reader.skip(tag & 7);
|
|
4639
|
+
}
|
|
4640
|
+
return message;
|
|
4641
|
+
},
|
|
4642
|
+
fromJSON(object) {
|
|
4643
|
+
return {
|
|
4644
|
+
fromAccountId: isSet(object.fromAccountId) ? globalThis.Number(object.fromAccountId) : 0,
|
|
4645
|
+
toAccountId: isSet(object.toAccountId) ? globalThis.Number(object.toAccountId) : 0,
|
|
4646
|
+
tokenId: isSet(object.tokenId) ? globalThis.Number(object.tokenId) : 0,
|
|
4647
|
+
amount: isSet(object.amount) ? BigInt(object.amount) : 0n,
|
|
4648
|
+
accountCreated: isSet(object.accountCreated) ? globalThis.Boolean(object.accountCreated) : false,
|
|
4649
|
+
};
|
|
4650
|
+
},
|
|
4651
|
+
toJSON(message) {
|
|
4652
|
+
const obj = {};
|
|
4653
|
+
if (message.fromAccountId !== 0) {
|
|
4654
|
+
obj.fromAccountId = Math.round(message.fromAccountId);
|
|
4655
|
+
}
|
|
4656
|
+
if (message.toAccountId !== 0) {
|
|
4657
|
+
obj.toAccountId = Math.round(message.toAccountId);
|
|
4658
|
+
}
|
|
4659
|
+
if (message.tokenId !== 0) {
|
|
4660
|
+
obj.tokenId = Math.round(message.tokenId);
|
|
4661
|
+
}
|
|
4662
|
+
if (message.amount !== 0n) {
|
|
4663
|
+
obj.amount = message.amount.toString();
|
|
4664
|
+
}
|
|
4665
|
+
if (message.accountCreated !== false) {
|
|
4666
|
+
obj.accountCreated = message.accountCreated;
|
|
4667
|
+
}
|
|
4668
|
+
return obj;
|
|
4669
|
+
},
|
|
4670
|
+
create(base) {
|
|
4671
|
+
return exports.Receipt_Transferred.fromPartial(base ?? {});
|
|
4672
|
+
},
|
|
4673
|
+
fromPartial(object) {
|
|
4674
|
+
const message = createBaseReceipt_Transferred();
|
|
4675
|
+
message.fromAccountId = object.fromAccountId ?? 0;
|
|
4676
|
+
message.toAccountId = object.toAccountId ?? 0;
|
|
4677
|
+
message.tokenId = object.tokenId ?? 0;
|
|
4678
|
+
message.amount = object.amount ?? 0n;
|
|
4679
|
+
message.accountCreated = object.accountCreated ?? false;
|
|
4680
|
+
return message;
|
|
4681
|
+
},
|
|
4682
|
+
};
|
|
4683
|
+
function createBaseReceipt_TriggerAdded() {
|
|
4684
|
+
return {};
|
|
4685
|
+
}
|
|
4686
|
+
exports.Receipt_TriggerAdded = {
|
|
4687
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
4688
|
+
return writer;
|
|
4689
|
+
},
|
|
4690
|
+
decode(input, length) {
|
|
4691
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4692
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4693
|
+
const message = createBaseReceipt_TriggerAdded();
|
|
4694
|
+
while (reader.pos < end) {
|
|
4695
|
+
const tag = reader.uint32();
|
|
4696
|
+
switch (tag >>> 3) {
|
|
4697
|
+
}
|
|
4698
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4699
|
+
break;
|
|
4700
|
+
}
|
|
4701
|
+
reader.skip(tag & 7);
|
|
4702
|
+
}
|
|
4703
|
+
return message;
|
|
4704
|
+
},
|
|
4705
|
+
fromJSON(_) {
|
|
4706
|
+
return {};
|
|
4707
|
+
},
|
|
4708
|
+
toJSON(_) {
|
|
4709
|
+
const obj = {};
|
|
4710
|
+
return obj;
|
|
4711
|
+
},
|
|
4712
|
+
create(base) {
|
|
4713
|
+
return exports.Receipt_TriggerAdded.fromPartial(base ?? {});
|
|
4714
|
+
},
|
|
4715
|
+
fromPartial(_) {
|
|
4716
|
+
const message = createBaseReceipt_TriggerAdded();
|
|
4717
|
+
return message;
|
|
4718
|
+
},
|
|
4719
|
+
};
|
|
4720
|
+
function createBaseReceipt_TriggerRemoved() {
|
|
4721
|
+
return {};
|
|
4722
|
+
}
|
|
4723
|
+
exports.Receipt_TriggerRemoved = {
|
|
4724
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
4725
|
+
return writer;
|
|
4726
|
+
},
|
|
4727
|
+
decode(input, length) {
|
|
4728
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
4729
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4730
|
+
const message = createBaseReceipt_TriggerRemoved();
|
|
4731
|
+
while (reader.pos < end) {
|
|
4732
|
+
const tag = reader.uint32();
|
|
4733
|
+
switch (tag >>> 3) {
|
|
4734
|
+
}
|
|
4735
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4736
|
+
break;
|
|
4737
|
+
}
|
|
4738
|
+
reader.skip(tag & 7);
|
|
4739
|
+
}
|
|
4740
|
+
return message;
|
|
4741
|
+
},
|
|
4742
|
+
fromJSON(_) {
|
|
4743
|
+
return {};
|
|
4744
|
+
},
|
|
4745
|
+
toJSON(_) {
|
|
4746
|
+
const obj = {};
|
|
4747
|
+
return obj;
|
|
4748
|
+
},
|
|
4749
|
+
create(base) {
|
|
4750
|
+
return exports.Receipt_TriggerRemoved.fromPartial(base ?? {});
|
|
4751
|
+
},
|
|
4752
|
+
fromPartial(_) {
|
|
4753
|
+
const message = createBaseReceipt_TriggerRemoved();
|
|
4754
|
+
return message;
|
|
4755
|
+
},
|
|
4756
|
+
};
|
|
4757
|
+
function bytesFromBase64(b64) {
|
|
4758
|
+
if (globalThis.Buffer) {
|
|
4759
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
4760
|
+
}
|
|
4761
|
+
else {
|
|
4762
|
+
const bin = globalThis.atob(b64);
|
|
4763
|
+
const arr = new Uint8Array(bin.length);
|
|
4764
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
4765
|
+
arr[i] = bin.charCodeAt(i);
|
|
4766
|
+
}
|
|
4767
|
+
return arr;
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
function base64FromBytes(arr) {
|
|
4771
|
+
if (globalThis.Buffer) {
|
|
4772
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
4773
|
+
}
|
|
4774
|
+
else {
|
|
4775
|
+
const bin = [];
|
|
4776
|
+
arr.forEach((byte) => {
|
|
4777
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
4778
|
+
});
|
|
4779
|
+
return globalThis.btoa(bin.join(""));
|
|
4780
|
+
}
|
|
4781
|
+
}
|
|
4782
|
+
function isSet(value) {
|
|
4783
|
+
return value !== null && value !== undefined;
|
|
4784
|
+
}
|