@n1xyz/nord-ts 0.1.6 → 0.1.8

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.
Files changed (85) hide show
  1. package/dist/actions.d.ts +57 -0
  2. package/dist/actions.js +186 -0
  3. package/dist/bundle.js +79181 -0
  4. package/dist/{nord/client → client}/Nord.d.ts +90 -107
  5. package/dist/{nord/client → client}/Nord.js +157 -218
  6. package/dist/{nord/client → client}/NordAdmin.d.ts +68 -102
  7. package/dist/{nord/client → client}/NordAdmin.js +109 -140
  8. package/dist/{nord/client → client}/NordUser.d.ts +86 -98
  9. package/dist/{nord/client → client}/NordUser.js +204 -271
  10. package/dist/const.js +5 -8
  11. package/dist/{nord/utils/NordError.js → error.js} +7 -5
  12. package/dist/gen/nord_pb.js +88 -92
  13. package/dist/gen/openapi.d.ts +39 -0
  14. package/dist/gen/openapi.js +1 -2
  15. package/dist/index.d.ts +6 -1
  16. package/dist/index.js +10 -21
  17. package/dist/types.d.ts +5 -50
  18. package/dist/types.js +21 -83
  19. package/dist/utils.d.ts +8 -11
  20. package/dist/utils.js +55 -90
  21. package/dist/websocket/NordWebSocketClient.js +12 -17
  22. package/dist/{nord/models → websocket}/Subscriber.d.ts +1 -1
  23. package/dist/{nord/models → websocket}/Subscriber.js +6 -7
  24. package/dist/websocket/events.js +1 -2
  25. package/dist/websocket/index.d.ts +19 -2
  26. package/dist/websocket/index.js +80 -5
  27. package/package.json +2 -3
  28. package/dist/api/client.d.ts +0 -14
  29. package/dist/api/client.js +0 -45
  30. package/dist/bridge/client.d.ts +0 -151
  31. package/dist/bridge/client.js +0 -434
  32. package/dist/bridge/const.d.ts +0 -23
  33. package/dist/bridge/const.js +0 -47
  34. package/dist/bridge/index.d.ts +0 -4
  35. package/dist/bridge/index.js +0 -23
  36. package/dist/bridge/types.d.ts +0 -120
  37. package/dist/bridge/types.js +0 -18
  38. package/dist/bridge/utils.d.ts +0 -64
  39. package/dist/bridge/utils.js +0 -131
  40. package/dist/gen/common.d.ts +0 -68
  41. package/dist/gen/common.js +0 -215
  42. package/dist/gen/nord.d.ts +0 -882
  43. package/dist/gen/nord.js +0 -6520
  44. package/dist/idl/bridge.d.ts +0 -569
  45. package/dist/idl/bridge.js +0 -8
  46. package/dist/idl/bridge.json +0 -1506
  47. package/dist/idl/index.d.ts +0 -607
  48. package/dist/idl/index.js +0 -8
  49. package/dist/nord/api/actions.d.ts +0 -126
  50. package/dist/nord/api/actions.js +0 -397
  51. package/dist/nord/api/core.d.ts +0 -16
  52. package/dist/nord/api/core.js +0 -81
  53. package/dist/nord/api/market.d.ts +0 -36
  54. package/dist/nord/api/market.js +0 -96
  55. package/dist/nord/api/metrics.d.ts +0 -67
  56. package/dist/nord/api/metrics.js +0 -229
  57. package/dist/nord/api/queries.d.ts +0 -46
  58. package/dist/nord/api/queries.js +0 -109
  59. package/dist/nord/api/triggers.d.ts +0 -7
  60. package/dist/nord/api/triggers.js +0 -38
  61. package/dist/nord/client/NordClient.d.ts +0 -33
  62. package/dist/nord/client/NordClient.js +0 -45
  63. package/dist/nord/index.d.ts +0 -11
  64. package/dist/nord/index.js +0 -36
  65. package/src/const.ts +0 -34
  66. package/src/gen/.gitkeep +0 -0
  67. package/src/gen/nord_pb.ts +0 -5053
  68. package/src/gen/openapi.ts +0 -2864
  69. package/src/index.ts +0 -5
  70. package/src/nord/api/actions.ts +0 -648
  71. package/src/nord/api/core.ts +0 -96
  72. package/src/nord/api/metrics.ts +0 -269
  73. package/src/nord/client/Nord.ts +0 -937
  74. package/src/nord/client/NordAdmin.ts +0 -514
  75. package/src/nord/client/NordClient.ts +0 -79
  76. package/src/nord/client/NordUser.ts +0 -1211
  77. package/src/nord/index.ts +0 -25
  78. package/src/nord/models/Subscriber.ts +0 -56
  79. package/src/nord/utils/NordError.ts +0 -76
  80. package/src/types.ts +0 -377
  81. package/src/utils.ts +0 -269
  82. package/src/websocket/NordWebSocketClient.ts +0 -316
  83. package/src/websocket/events.ts +0 -31
  84. package/src/websocket/index.ts +0 -2
  85. /package/dist/{nord/utils/NordError.d.ts → error.d.ts} +0 -0
@@ -1,57 +1,26 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.NordAdmin = exports.AclRole = void 0;
37
- const protobuf_1 = require("@bufbuild/protobuf");
38
- const proto = __importStar(require("../../gen/nord_pb"));
39
- const utils_1 = require("../../utils");
40
- const actions_1 = require("../api/actions");
41
- const NordError_1 = require("../utils/NordError");
1
+ import { create } from "@bufbuild/protobuf";
2
+ import * as proto from "../gen/nord_pb";
3
+ import { decodeHex, signUserPayload } from "../utils";
4
+ import { createAction, sendAction, expectReceiptKind } from "../actions";
5
+ import { NordError } from "../error";
42
6
  // NOTE: keep in sync with `acl.rs`.
43
- // NOTE: don't forget `number` as int is internally a u32.
44
- var AclRole;
7
+ export var AclRole;
45
8
  (function (AclRole) {
9
+ // note: use 2 ** n instead of 1 << n since js internally
10
+ // casts number to a signed int for bitwise ops. when merging
11
+ // these roles, make sure to use += instead of |=. this will
12
+ // only work when the roles are powers of two.
46
13
  AclRole[AclRole["FEE_MANAGER"] = 1] = "FEE_MANAGER";
47
14
  AclRole[AclRole["MARKET_MANAGER"] = 2] = "MARKET_MANAGER";
48
- // TODO: unsure about this?
49
- AclRole[AclRole["ADMIN"] = -2147483648] = "ADMIN";
50
- })(AclRole || (exports.AclRole = AclRole = {}));
15
+ AclRole[AclRole["ADMIN"] = 2147483648] = "ADMIN";
16
+ })(AclRole || (AclRole = {}));
51
17
  /**
52
18
  * Administrative client capable of submitting privileged configuration actions.
53
19
  */
54
- class NordAdmin {
20
+ export class NordAdmin {
21
+ nord;
22
+ admin;
23
+ signFn;
55
24
  constructor({ nord, admin, signFn, }) {
56
25
  this.nord = nord;
57
26
  this.admin = admin;
@@ -62,25 +31,8 @@ class NordAdmin {
62
31
  * @param nord - Nord instance
63
32
  * @param admin - The user that will be signing actions.
64
33
  * @param signFn - Function to sign messages with the admin's wallet.
65
- *
66
- * `signFn` must sign the _hex-encoded_ message, not the raw message itself, for
67
- * the purpose of being compatible with Solana wallets.
68
- *
69
- * In practice, you will do something along the lines of:
70
- *
71
- * ```typescript
72
- * (x) => wallet.signMessage(new TextEncoder().encode(x.toHex()));
73
- * ```
74
- *
75
- * For a software signing key, this might look more like:
76
- *
77
- * ```typescript
78
- * (x) => nacl.sign.detached(new TextEncoder().encode(x.toHex()), sk);
79
- * ``
80
- *
81
- * where `nacl` is the tweetnacl library.
82
34
  */
83
- static new({ nord, admin, signFn, }) {
35
+ static async new({ nord, admin, signFn, }) {
84
36
  return new NordAdmin({
85
37
  nord,
86
38
  admin,
@@ -95,12 +47,13 @@ class NordAdmin {
95
47
  */
96
48
  async submitAction(kind) {
97
49
  const timestamp = await this.nord.getTimestamp();
98
- const action = (0, actions_1.createAction)(timestamp, 0, kind);
99
- return (0, actions_1.sendAction)(this.nord.webServerUrl, async (xs) => {
100
- const signature = await this.signFn(xs);
101
- if (signature.length !== 64) {
102
- throw new NordError_1.NordError("invalid signature length; must be 64 bytes");
103
- }
50
+ const action = createAction(timestamp, 0, kind);
51
+ return sendAction(this.nord.httpClient, async (xs) => {
52
+ const signature = await signUserPayload({
53
+ payload: xs,
54
+ user: this.admin,
55
+ signTransaction: this.signFn,
56
+ });
104
57
  return Uint8Array.from([...xs, ...signature]);
105
58
  }, action);
106
59
  }
@@ -115,37 +68,43 @@ class NordAdmin {
115
68
  async updateAcl({ target, addRoles, removeRoles, }) {
116
69
  const allRoles = addRoles.concat(removeRoles);
117
70
  if (allRoles.length !== new Set(allRoles).size) {
118
- throw new NordError_1.NordError("duplicate roles in acl update; must be unique");
71
+ throw new NordError("duplicate roles in acl update; must be unique");
119
72
  }
120
73
  let mask = 0;
121
74
  let values = 0;
122
- for (const role of allRoles) {
123
- mask |= role;
124
- }
125
- for (const role of addRoles) {
126
- values |= role;
127
- }
75
+ // using += instead of |= to avoid the internal cast to i32 >:(
76
+ // this works because our roles are powers of two.
77
+ for (const role of allRoles)
78
+ mask += role;
79
+ for (const role of addRoles)
80
+ values += role;
128
81
  const receipt = await this.submitAction({
129
82
  case: "updateAcl",
130
- value: (0, protobuf_1.create)(proto.Action_UpdateAclSchema, {
83
+ value: create(proto.Action_UpdateAclSchema, {
131
84
  aclPubkey: this.admin.toBytes(),
132
85
  targetPubkey: target.toBytes(),
86
+ rolesValue: values,
87
+ rolesMask: mask,
133
88
  }),
134
89
  });
135
- (0, actions_1.expectReceiptKind)(receipt, "aclUpdated", "update acl");
90
+ expectReceiptKind(receipt, "aclUpdated", "update acl");
136
91
  return { ...receipt.kind.value, actionId: receipt.actionId };
137
92
  }
138
93
  /**
139
94
  * Register a new token that can be listed on Nord.
140
95
  *
141
- * @param params - Token configuration values
96
+ * @param tokenDecimals - Decimal shift used when parsing deposits/withdrawals
97
+ * @param weightBps - Risk weight in basis points applied in account value calculations
98
+ * @param viewSymbol - Symbol surfaced to Nord clients
99
+ * @param oracleSymbol - Symbol resolved by the oracle adapter
100
+ * @param mintAddr - Solana mint backing this token
142
101
  * @returns Action identifier and resulting token metadata
143
102
  * @throws {NordError} If the action submission fails
144
103
  */
145
104
  async createToken({ tokenDecimals, weightBps, viewSymbol, oracleSymbol, mintAddr, }) {
146
105
  const receipt = await this.submitAction({
147
106
  case: "createToken",
148
- value: (0, protobuf_1.create)(proto.Action_CreateTokenSchema, {
107
+ value: create(proto.Action_CreateTokenSchema, {
149
108
  aclPubkey: this.admin.toBytes(),
150
109
  tokenDecimals,
151
110
  weightBps,
@@ -154,33 +113,41 @@ class NordAdmin {
154
113
  solAddr: mintAddr.toBytes(),
155
114
  }),
156
115
  });
157
- (0, actions_1.expectReceiptKind)(receipt, "insertTokenResult", "create token");
116
+ expectReceiptKind(receipt, "insertTokenResult", "create token");
158
117
  return { actionId: receipt.actionId, ...receipt.kind.value };
159
118
  }
160
119
  /**
161
120
  * Open a new market with the provided trading parameters.
162
121
  *
163
- * @param params - Market configuration to apply
122
+ * @param sizeDecimals - Decimal shift for contract sizes
123
+ * @param priceDecimals - Decimal shift for price ticks
124
+ * @param imfBps - Base initial margin fraction (IMF) in basis points, see docs/MARKETS.md
125
+ * @param cmfBps - Cancel margin fraction (CMF) in basis points, see docs/MARKETS.md
126
+ * @param mmfBps - Maintenance margin fraction (MMF) in basis points, see docs/MARKETS.md
127
+ * @param marketType - Spot or perpetual market type
128
+ * @param viewSymbol - Symbol exposed to Nord clients
129
+ * @param oracleSymbol - Symbol resolved by the oracle adapter
130
+ * @param baseTokenId - Registered base token backing this market
164
131
  * @returns Action identifier and resulting market metadata
165
132
  * @throws {NordError} If the action submission fails
166
133
  */
167
- async createMarket(params) {
134
+ async createMarket({ sizeDecimals, priceDecimals, imfBps, cmfBps, mmfBps, marketType, viewSymbol, oracleSymbol, baseTokenId, }) {
168
135
  const receipt = await this.submitAction({
169
136
  case: "createMarket",
170
- value: (0, protobuf_1.create)(proto.Action_CreateMarketSchema, {
137
+ value: create(proto.Action_CreateMarketSchema, {
171
138
  aclPubkey: this.admin.toBytes(),
172
- sizeDecimals: params.sizeDecimals,
173
- priceDecimals: params.priceDecimals,
174
- imfBps: params.imfBps,
175
- cmfBps: params.cmfBps,
176
- mmfBps: params.mmfBps,
177
- marketType: params.marketType,
178
- viewSymbol: params.viewSymbol,
179
- oracleSymbol: params.oracleSymbol,
180
- baseTokenId: params.baseTokenId,
139
+ sizeDecimals,
140
+ priceDecimals,
141
+ imfBps,
142
+ cmfBps,
143
+ mmfBps,
144
+ marketType,
145
+ viewSymbol,
146
+ oracleSymbol,
147
+ baseTokenId,
181
148
  }),
182
149
  });
183
- (0, actions_1.expectReceiptKind)(receipt, "insertMarketResult", "create market");
150
+ expectReceiptKind(receipt, "insertMarketResult", "create market");
184
151
  return { actionId: receipt.actionId, ...receipt.kind.value };
185
152
  }
186
153
  /**
@@ -190,32 +157,33 @@ class NordAdmin {
190
157
  * leading `0x` prefix). The engine validates the supplied guardian set index
191
158
  * before applying the update.
192
159
  *
193
- * @param params - Guardian set index and guardian addresses
160
+ * @param guardianSetIndex - Wormhole guardian set index that must already exist
161
+ * @param addresses - 20-byte hex-encoded guardian addresses
194
162
  * @returns Action identifier and guardian update receipt
195
163
  * @throws {NordError} If the action submission fails
196
164
  */
197
- async pythSetWormholeGuardians(params) {
198
- const addresses = params.addresses.map((address) => {
165
+ async pythSetWormholeGuardians({ guardianSetIndex, addresses, }) {
166
+ const parsedAddresses = addresses.map((address) => {
199
167
  try {
200
- const decoded = (0, utils_1.decodeHex)(address);
168
+ const decoded = decodeHex(address);
201
169
  if (decoded.length !== 20) {
202
170
  throw new Error("guardian address must be 20 bytes");
203
171
  }
204
172
  return decoded;
205
173
  }
206
174
  catch (e) {
207
- throw new NordError_1.NordError("invalid guardian address; must be a 20 byte hex address", { cause: e });
175
+ throw new NordError("invalid guardian address; must be a 20 byte hex address", { cause: e });
208
176
  }
209
177
  });
210
178
  const receipt = await this.submitAction({
211
179
  case: "pythSetWormholeGuardians",
212
- value: (0, protobuf_1.create)(proto.Action_PythSetWormholeGuardiansSchema, {
180
+ value: create(proto.Action_PythSetWormholeGuardiansSchema, {
213
181
  aclPubkey: this.admin.toBytes(),
214
- guardianSetIndex: params.guardianSetIndex,
215
- addresses,
182
+ guardianSetIndex,
183
+ addresses: parsedAddresses,
216
184
  }),
217
185
  });
218
- (0, actions_1.expectReceiptKind)(receipt, "updateGuardianSetResult", "update wormhole guardians");
186
+ expectReceiptKind(receipt, "updateGuardianSetResult", "update wormhole guardians");
219
187
  return { actionId: receipt.actionId, ...receipt.kind.value };
220
188
  }
221
189
  /**
@@ -225,32 +193,33 @@ class NordAdmin {
225
193
  * leading `0x` prefix). Use this call to create or update the mapping used
226
194
  * by the oracle integration.
227
195
  *
228
- * @param params - Oracle symbol and price feed identifier
196
+ * @param oracleSymbol - Symbol resolved by the oracle adapter
197
+ * @param priceFeedId - 32-byte hex-encoded Pyth price feed identifier
229
198
  * @returns Action identifier and symbol feed receipt
230
199
  * @throws {NordError} If the action submission fails
231
200
  */
232
- async pythSetSymbolFeed(params) {
201
+ async pythSetSymbolFeed({ oracleSymbol, priceFeedId: priceFeedIdHex, }) {
233
202
  let priceFeedId;
234
203
  try {
235
- priceFeedId = (0, utils_1.decodeHex)(params.priceFeedId);
204
+ priceFeedId = decodeHex(priceFeedIdHex);
236
205
  if (priceFeedId.length !== 32) {
237
206
  throw new Error("price feed id must be 32 bytes");
238
207
  }
239
208
  }
240
209
  catch (e) {
241
- throw new NordError_1.NordError("invalid price feed id; must be a 32 byte hex id", {
210
+ throw new NordError("invalid price feed id; must be a 32 byte hex id", {
242
211
  cause: e,
243
212
  });
244
213
  }
245
214
  const receipt = await this.submitAction({
246
215
  case: "pythSetSymbolFeed",
247
- value: (0, protobuf_1.create)(proto.Action_PythSetSymbolFeedSchema, {
216
+ value: create(proto.Action_PythSetSymbolFeedSchema, {
248
217
  aclPubkey: this.admin.toBytes(),
249
- oracleSymbol: params.oracleSymbol,
218
+ oracleSymbol,
250
219
  priceFeedId,
251
220
  }),
252
221
  });
253
- (0, actions_1.expectReceiptKind)(receipt, "oracleSymbolFeedResult", "set symbol feed");
222
+ expectReceiptKind(receipt, "oracleSymbolFeedResult", "set symbol feed");
254
223
  return { actionId: receipt.actionId, ...receipt.kind.value };
255
224
  }
256
225
  /**
@@ -262,11 +231,11 @@ class NordAdmin {
262
231
  async pause() {
263
232
  const receipt = await this.submitAction({
264
233
  case: "pause",
265
- value: (0, protobuf_1.create)(proto.Action_PauseSchema, {
234
+ value: create(proto.Action_PauseSchema, {
266
235
  aclPubkey: this.admin.toBytes(),
267
236
  }),
268
237
  });
269
- (0, actions_1.expectReceiptKind)(receipt, "paused", "pause");
238
+ expectReceiptKind(receipt, "paused", "pause");
270
239
  return { actionId: receipt.actionId };
271
240
  }
272
241
  /**
@@ -278,47 +247,47 @@ class NordAdmin {
278
247
  async unpause() {
279
248
  const receipt = await this.submitAction({
280
249
  case: "unpause",
281
- value: (0, protobuf_1.create)(proto.Action_UnpauseSchema, {
250
+ value: create(proto.Action_UnpauseSchema, {
282
251
  aclPubkey: this.admin.toBytes(),
283
252
  }),
284
253
  });
285
- (0, actions_1.expectReceiptKind)(receipt, "unpaused", "unpause");
254
+ expectReceiptKind(receipt, "unpaused", "unpause");
286
255
  return { actionId: receipt.actionId };
287
256
  }
288
257
  /**
289
258
  * Freeze an individual market, preventing new trades and orders.
290
259
  *
291
- * @param params - Target market identifier
260
+ * @param marketId - Target market identifier
292
261
  * @returns Action identifier and freeze receipt
293
262
  * @throws {NordError} If the action submission fails
294
263
  */
295
- async freezeMarket(params) {
264
+ async freezeMarket({ marketId, }) {
296
265
  const receipt = await this.submitAction({
297
266
  case: "freezeMarket",
298
- value: (0, protobuf_1.create)(proto.Action_FreezeMarketSchema, {
299
- marketId: params.marketId,
267
+ value: create(proto.Action_FreezeMarketSchema, {
268
+ marketId,
300
269
  aclPubkey: this.admin.toBytes(),
301
270
  }),
302
271
  });
303
- (0, actions_1.expectReceiptKind)(receipt, "marketFreezeUpdated", "freeze market");
272
+ expectReceiptKind(receipt, "marketFreezeUpdated", "freeze market");
304
273
  return { actionId: receipt.actionId, ...receipt.kind.value };
305
274
  }
306
275
  /**
307
276
  * Unfreeze a market that was previously halted.
308
277
  *
309
- * @param params - Target market identifier
278
+ * @param marketId - Target market identifier
310
279
  * @returns Action identifier and freeze receipt
311
280
  * @throws {NordError} If the action submission fails
312
281
  */
313
- async unfreezeMarket(params) {
282
+ async unfreezeMarket({ marketId, }) {
314
283
  const receipt = await this.submitAction({
315
284
  case: "unfreezeMarket",
316
- value: (0, protobuf_1.create)(proto.Action_UnfreezeMarketSchema, {
317
- marketId: params.marketId,
285
+ value: create(proto.Action_UnfreezeMarketSchema, {
286
+ marketId,
318
287
  aclPubkey: this.admin.toBytes(),
319
288
  }),
320
289
  });
321
- (0, actions_1.expectReceiptKind)(receipt, "marketFreezeUpdated", "unfreeze market");
290
+ expectReceiptKind(receipt, "marketFreezeUpdated", "unfreeze market");
322
291
  return { actionId: receipt.actionId, ...receipt.kind.value };
323
292
  }
324
293
  /**
@@ -328,19 +297,19 @@ class NordAdmin {
328
297
  * the default Nord fees; use `updateFeeTier` if you need to change it.
329
298
  * - The first appended tier receives id 1, and subsequent tiers increment the id.
330
299
  *
331
- * @param params - Fee tier configuration to insert
300
+ * @param config - Fee tier configuration to insert
332
301
  * @returns Action identifier and fee tier addition receipt
333
302
  * @throws {NordError} If the action submission fails or the new tier exceeds the maximum range (0-15).
334
303
  */
335
- async addFeeTier(params) {
304
+ async addFeeTier({ config, }) {
336
305
  const receipt = await this.submitAction({
337
306
  case: "addFeeTier",
338
- value: (0, protobuf_1.create)(proto.Action_AddFeeTierSchema, {
307
+ value: create(proto.Action_AddFeeTierSchema, {
339
308
  aclPubkey: this.admin.toBytes(),
340
- config: (0, protobuf_1.create)(proto.FeeTierConfigSchema, params.config),
309
+ config: create(proto.FeeTierConfigSchema, config),
341
310
  }),
342
311
  });
343
- (0, actions_1.expectReceiptKind)(receipt, "feeTierAdded", "add fee tier");
312
+ expectReceiptKind(receipt, "feeTierAdded", "add fee tier");
344
313
  return { actionId: receipt.actionId, ...receipt.kind.value };
345
314
  }
346
315
  /**
@@ -349,20 +318,21 @@ class NordAdmin {
349
318
  * Tier identifiers must already exist; attempting to update a missing tier
350
319
  * causes the action to fail.
351
320
  *
352
- * @param params - Fee tier identifier and updated configuration
321
+ * @param tierId - Existing fee tier identifier to update
322
+ * @param config - Replacement configuration for the tier
353
323
  * @returns Action identifier and fee tier update receipt
354
324
  * @throws {NordError} If the action submission fails or the tier ID exceeds the configured range.
355
325
  */
356
- async updateFeeTier(params) {
326
+ async updateFeeTier({ tierId, config, }) {
357
327
  const receipt = await this.submitAction({
358
328
  case: "updateFeeTier",
359
- value: (0, protobuf_1.create)(proto.Action_UpdateFeeTierSchema, {
329
+ value: create(proto.Action_UpdateFeeTierSchema, {
360
330
  aclPubkey: this.admin.toBytes(),
361
- id: params.tierId,
362
- config: (0, protobuf_1.create)(proto.FeeTierConfigSchema, params.config),
331
+ id: tierId,
332
+ config: create(proto.FeeTierConfigSchema, config),
363
333
  }),
364
334
  });
365
- (0, actions_1.expectReceiptKind)(receipt, "feeTierUpdated", "update fee tier");
335
+ expectReceiptKind(receipt, "feeTierUpdated", "update fee tier");
366
336
  return { actionId: receipt.actionId, ...receipt.kind.value };
367
337
  }
368
338
  /**
@@ -380,14 +350,13 @@ class NordAdmin {
380
350
  async updateAccountsTier(accounts, tierId) {
381
351
  const receipt = await this.submitAction({
382
352
  case: "updateAccountsTier",
383
- value: (0, protobuf_1.create)(proto.Action_UpdateAccountsTierSchema, {
353
+ value: create(proto.Action_UpdateAccountsTierSchema, {
384
354
  aclPubkey: this.admin.toBytes(),
385
355
  accounts,
386
356
  tierId,
387
357
  }),
388
358
  });
389
- (0, actions_1.expectReceiptKind)(receipt, "accountsTierUpdated", "update accounts tier");
359
+ expectReceiptKind(receipt, "accountsTierUpdated", "update accounts tier");
390
360
  return { actionId: receipt.actionId, ...receipt.kind.value };
391
361
  }
392
362
  }
393
- exports.NordAdmin = NordAdmin;