@thru/programs 0.4.1 → 0.4.2

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 (58) hide show
  1. package/dist/abi-manager/index.cjs +39 -2
  2. package/dist/abi-manager/index.cjs.map +1 -1
  3. package/dist/abi-manager/index.js +2 -2
  4. package/dist/amm/index.cjs +39 -2
  5. package/dist/amm/index.cjs.map +1 -1
  6. package/dist/amm/index.js +1 -1
  7. package/dist/bootstrap-addresses/index.cjs +41 -2
  8. package/dist/bootstrap-addresses/index.cjs.map +1 -1
  9. package/dist/bootstrap-addresses/index.d.cts +8 -1
  10. package/dist/bootstrap-addresses/index.d.ts +8 -1
  11. package/dist/bootstrap-addresses/index.js +1 -1
  12. package/dist/{chunk-TRPUGPZJ.js → chunk-2FFCNXCE.js} +58 -5
  13. package/dist/chunk-2FFCNXCE.js.map +1 -0
  14. package/dist/{chunk-QCJFKBAS.js → chunk-I3DLOUB4.js} +3 -3
  15. package/dist/{chunk-QCJFKBAS.js.map → chunk-I3DLOUB4.js.map} +1 -1
  16. package/dist/clob/index.cjs +41 -2
  17. package/dist/clob/index.cjs.map +1 -1
  18. package/dist/clob/index.d.cts +7 -1
  19. package/dist/clob/index.d.ts +7 -1
  20. package/dist/clob/index.js +3 -2
  21. package/dist/clob/index.js.map +1 -1
  22. package/dist/deploy/index.cjs +39 -2
  23. package/dist/deploy/index.cjs.map +1 -1
  24. package/dist/deploy/index.js +3 -3
  25. package/dist/oracle/index.cjs +39 -2
  26. package/dist/oracle/index.cjs.map +1 -1
  27. package/dist/oracle/index.js +1 -1
  28. package/dist/passkey-manager/index.cjs +42 -5
  29. package/dist/passkey-manager/index.cjs.map +1 -1
  30. package/dist/passkey-manager/index.js +1 -1
  31. package/dist/perp/index.cjs +1785 -162
  32. package/dist/perp/index.cjs.map +1 -1
  33. package/dist/perp/index.d.cts +558 -13
  34. package/dist/perp/index.d.ts +558 -13
  35. package/dist/perp/index.js +1749 -163
  36. package/dist/perp/index.js.map +1 -1
  37. package/dist/ratelimit/index.cjs +4757 -0
  38. package/dist/ratelimit/index.cjs.map +1 -0
  39. package/dist/ratelimit/index.d.cts +171 -0
  40. package/dist/ratelimit/index.d.ts +171 -0
  41. package/dist/ratelimit/index.js +4527 -0
  42. package/dist/ratelimit/index.js.map +1 -0
  43. package/package.json +7 -2
  44. package/src/bootstrap-addresses/index.test.ts +17 -0
  45. package/src/bootstrap-addresses/index.ts +12 -0
  46. package/src/clob/index.ts +7 -0
  47. package/src/perp/abi/thru/program/perp/types.ts +1949 -149
  48. package/src/perp/index.test.ts +189 -3
  49. package/src/perp/index.ts +316 -3
  50. package/src/ratelimit/abi/thru/program/ratelimit/types.ts +5448 -0
  51. package/src/ratelimit/accounts.ts +105 -0
  52. package/src/ratelimit/constants.ts +49 -0
  53. package/src/ratelimit/derivation.ts +93 -0
  54. package/src/ratelimit/index.test.ts +185 -0
  55. package/src/ratelimit/index.ts +30 -0
  56. package/src/ratelimit/instructions.ts +244 -0
  57. package/tsup.config.ts +1 -0
  58. package/dist/chunk-TRPUGPZJ.js.map +0 -1
@@ -4217,6 +4217,153 @@ __tnRegisterDynamicValidate2("ExchangeSetStatusInstruction", (buffer) => {
4217
4217
  const params = result.params;
4218
4218
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
4219
4219
  });
4220
+ var __tn_ir_FundingUpdateInstruction = {
4221
+ typeName: "FundingUpdateInstruction",
4222
+ root: { op: "const", value: 7n }
4223
+ };
4224
+ var FundingUpdateInstruction = class _FundingUpdateInstruction {
4225
+ constructor(buffer) {
4226
+ this.buffer = buffer;
4227
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
4228
+ }
4229
+ static __tnCreateView(buffer, opts) {
4230
+ if (!buffer || buffer.length === void 0) throw new Error("FundingUpdateInstruction.__tnCreateView requires a Uint8Array");
4231
+ return new _FundingUpdateInstruction(new Uint8Array(buffer));
4232
+ }
4233
+ static builder() {
4234
+ return new FundingUpdateInstructionBuilder();
4235
+ }
4236
+ static fromBuilder(builder) {
4237
+ const buffer = builder.build();
4238
+ return _FundingUpdateInstruction.from_array(buffer);
4239
+ }
4240
+ get_market_record_idx() {
4241
+ const offset = 0;
4242
+ return this.view.getUint8(offset);
4243
+ }
4244
+ set_market_record_idx(value) {
4245
+ const offset = 0;
4246
+ this.view.setUint8(offset, value);
4247
+ }
4248
+ get market_record_idx() {
4249
+ return this.get_market_record_idx();
4250
+ }
4251
+ set market_record_idx(value) {
4252
+ this.set_market_record_idx(value);
4253
+ }
4254
+ get_reserved0() {
4255
+ const offset = 1;
4256
+ return this.view.getUint16(offset, true);
4257
+ }
4258
+ set_reserved0(value) {
4259
+ const offset = 1;
4260
+ this.view.setUint16(offset, value, true);
4261
+ }
4262
+ get reserved0() {
4263
+ return this.get_reserved0();
4264
+ }
4265
+ set reserved0(value) {
4266
+ this.set_reserved0(value);
4267
+ }
4268
+ get_reserved1() {
4269
+ const offset = 3;
4270
+ return this.view.getUint32(offset, true);
4271
+ }
4272
+ set_reserved1(value) {
4273
+ const offset = 3;
4274
+ this.view.setUint32(offset, value, true);
4275
+ }
4276
+ get reserved1() {
4277
+ return this.get_reserved1();
4278
+ }
4279
+ set reserved1(value) {
4280
+ this.set_reserved1(value);
4281
+ }
4282
+ static __tnFootprintInternal(__tnParams) {
4283
+ return __tnEvalFootprint2(__tn_ir_FundingUpdateInstruction.root, { params: __tnParams });
4284
+ }
4285
+ static __tnValidateInternal(buffer, __tnParams) {
4286
+ return __tnValidateIrTree2(__tn_ir_FundingUpdateInstruction, buffer, __tnParams);
4287
+ }
4288
+ static __tnInvokeFootprint(__tnParams) {
4289
+ return this.__tnFootprintInternal(__tnParams);
4290
+ }
4291
+ static __tnInvokeValidate(buffer, __tnParams) {
4292
+ return this.__tnValidateInternal(buffer, __tnParams);
4293
+ }
4294
+ static footprintIr() {
4295
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
4296
+ }
4297
+ static footprint() {
4298
+ const irResult = this.footprintIr();
4299
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
4300
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
4301
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for FundingUpdateInstruction");
4302
+ }
4303
+ return __tnBigIntToNumber2(irResult, "FundingUpdateInstruction::footprint");
4304
+ }
4305
+ static validate(buffer, _opts) {
4306
+ if (buffer.length < 7) return { ok: false, code: "tn.buffer_too_small", consumed: 7 };
4307
+ return { ok: true, consumed: 7 };
4308
+ }
4309
+ static new(market_record_idx, reserved0, reserved1) {
4310
+ const buffer = new Uint8Array(7);
4311
+ const view = new DataView(buffer.buffer);
4312
+ view.setUint8(0, market_record_idx);
4313
+ view.setUint16(1, reserved0, true);
4314
+ view.setUint32(3, reserved1, true);
4315
+ return new _FundingUpdateInstruction(buffer);
4316
+ }
4317
+ static from_array(buffer) {
4318
+ if (!buffer || buffer.length === void 0) {
4319
+ return null;
4320
+ }
4321
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
4322
+ const validation = this.validate(buffer);
4323
+ if (!validation.ok) {
4324
+ return null;
4325
+ }
4326
+ return new _FundingUpdateInstruction(buffer);
4327
+ }
4328
+ };
4329
+ var FundingUpdateInstructionBuilder = class {
4330
+ constructor() {
4331
+ this.buffer = new Uint8Array(7);
4332
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
4333
+ }
4334
+ set_market_record_idx(value) {
4335
+ this.view.setUint8(0, value);
4336
+ return this;
4337
+ }
4338
+ set_reserved0(value) {
4339
+ this.view.setUint16(1, value, true);
4340
+ return this;
4341
+ }
4342
+ set_reserved1(value) {
4343
+ this.view.setUint32(3, value, true);
4344
+ return this;
4345
+ }
4346
+ build() {
4347
+ return this.buffer.slice();
4348
+ }
4349
+ buildInto(target, offset = 0) {
4350
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
4351
+ target.set(this.buffer, offset);
4352
+ return target;
4353
+ }
4354
+ finish() {
4355
+ const view = FundingUpdateInstruction.from_array(this.buffer.slice());
4356
+ if (!view) throw new Error("failed to build FundingUpdateInstruction");
4357
+ return view;
4358
+ }
4359
+ };
4360
+ __tnRegisterFootprint2("FundingUpdateInstruction", (params) => FundingUpdateInstruction.__tnInvokeFootprint(params));
4361
+ __tnRegisterValidate2("FundingUpdateInstruction", (buffer, params) => FundingUpdateInstruction.__tnInvokeValidate(buffer, params));
4362
+ __tnRegisterDynamicValidate2("FundingUpdateInstruction", (buffer) => {
4363
+ const result = FundingUpdateInstruction.validate(buffer);
4364
+ const params = result.params;
4365
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
4366
+ });
4220
4367
  var __tn_ir_LiquidateInstruction = {
4221
4368
  typeName: "LiquidateInstruction",
4222
4369
  root: { op: "const", value: 7n }
@@ -6131,25 +6278,25 @@ __tnRegisterDynamicValidate2("MarketSetExchangeStatusInstruction", (buffer) => {
6131
6278
  const params = result.params;
6132
6279
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
6133
6280
  });
6134
- var __tn_ir_MarketSetOracleInstruction = {
6135
- typeName: "MarketSetOracleInstruction",
6136
- root: { op: "const", value: 39n }
6281
+ var __tn_ir_MarketSetFundingInstruction = {
6282
+ typeName: "MarketSetFundingInstruction",
6283
+ root: { op: "const", value: 31n }
6137
6284
  };
6138
- var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6285
+ var MarketSetFundingInstruction = class _MarketSetFundingInstruction {
6139
6286
  constructor(buffer) {
6140
6287
  this.buffer = buffer;
6141
6288
  this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
6142
6289
  }
6143
6290
  static __tnCreateView(buffer, opts) {
6144
- if (!buffer || buffer.length === void 0) throw new Error("MarketSetOracleInstruction.__tnCreateView requires a Uint8Array");
6145
- return new _MarketSetOracleInstruction(new Uint8Array(buffer));
6291
+ if (!buffer || buffer.length === void 0) throw new Error("MarketSetFundingInstruction.__tnCreateView requires a Uint8Array");
6292
+ return new _MarketSetFundingInstruction(new Uint8Array(buffer));
6146
6293
  }
6147
6294
  static builder() {
6148
- return new MarketSetOracleInstructionBuilder();
6295
+ return new MarketSetFundingInstructionBuilder();
6149
6296
  }
6150
6297
  static fromBuilder(builder) {
6151
6298
  const buffer = builder.build();
6152
- return _MarketSetOracleInstruction.from_array(buffer);
6299
+ return _MarketSetFundingInstruction.from_array(buffer);
6153
6300
  }
6154
6301
  get_market_record_idx() {
6155
6302
  const offset = 0;
@@ -6165,95 +6312,109 @@ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6165
6312
  set market_record_idx(value) {
6166
6313
  this.set_market_record_idx(value);
6167
6314
  }
6168
- get_oracle_feed_account_idx() {
6315
+ get_reserved0() {
6169
6316
  const offset = 1;
6170
6317
  return this.view.getUint16(offset, true);
6171
6318
  }
6172
- set_oracle_feed_account_idx(value) {
6319
+ set_reserved0(value) {
6173
6320
  const offset = 1;
6174
6321
  this.view.setUint16(offset, value, true);
6175
6322
  }
6176
- get oracle_feed_account_idx() {
6177
- return this.get_oracle_feed_account_idx();
6323
+ get reserved0() {
6324
+ return this.get_reserved0();
6178
6325
  }
6179
- set oracle_feed_account_idx(value) {
6180
- this.set_oracle_feed_account_idx(value);
6326
+ set reserved0(value) {
6327
+ this.set_reserved0(value);
6181
6328
  }
6182
- get_oracle_exponent() {
6329
+ get_interest_rate() {
6183
6330
  const offset = 3;
6184
- return this.view.getInt32(offset, true);
6331
+ return this.view.getUint32(offset, true);
6185
6332
  }
6186
- set_oracle_exponent(value) {
6333
+ set_interest_rate(value) {
6187
6334
  const offset = 3;
6188
- this.view.setInt32(offset, value, true);
6335
+ this.view.setUint32(offset, value, true);
6189
6336
  }
6190
- get oracle_exponent() {
6191
- return this.get_oracle_exponent();
6337
+ get interest_rate() {
6338
+ return this.get_interest_rate();
6192
6339
  }
6193
- set oracle_exponent(value) {
6194
- this.set_oracle_exponent(value);
6340
+ set interest_rate(value) {
6341
+ this.set_interest_rate(value);
6195
6342
  }
6196
- get_mark_num() {
6343
+ get_clamp_small() {
6197
6344
  const offset = 7;
6198
- return this.view.getBigUint64(offset, true);
6345
+ return this.view.getUint32(offset, true);
6199
6346
  }
6200
- set_mark_num(value) {
6347
+ set_clamp_small(value) {
6201
6348
  const offset = 7;
6202
- this.view.setBigUint64(offset, value, true);
6349
+ this.view.setUint32(offset, value, true);
6203
6350
  }
6204
- get mark_num() {
6205
- return this.get_mark_num();
6351
+ get clamp_small() {
6352
+ return this.get_clamp_small();
6206
6353
  }
6207
- set mark_num(value) {
6208
- this.set_mark_num(value);
6354
+ set clamp_small(value) {
6355
+ this.set_clamp_small(value);
6209
6356
  }
6210
- get_mark_den() {
6357
+ get_clamp_big() {
6358
+ const offset = 11;
6359
+ return this.view.getUint32(offset, true);
6360
+ }
6361
+ set_clamp_big(value) {
6362
+ const offset = 11;
6363
+ this.view.setUint32(offset, value, true);
6364
+ }
6365
+ get clamp_big() {
6366
+ return this.get_clamp_big();
6367
+ }
6368
+ set clamp_big(value) {
6369
+ this.set_clamp_big(value);
6370
+ }
6371
+ get_premium_multiplier() {
6211
6372
  const offset = 15;
6212
- return this.view.getBigUint64(offset, true);
6373
+ return this.view.getUint32(offset, true);
6213
6374
  }
6214
- set_mark_den(value) {
6375
+ set_premium_multiplier(value) {
6215
6376
  const offset = 15;
6216
- this.view.setBigUint64(offset, value, true);
6377
+ this.view.setUint32(offset, value, true);
6217
6378
  }
6218
- get mark_den() {
6219
- return this.get_mark_den();
6379
+ get premium_multiplier() {
6380
+ return this.get_premium_multiplier();
6220
6381
  }
6221
- set mark_den(value) {
6222
- this.set_mark_den(value);
6382
+ set premium_multiplier(value) {
6383
+ this.set_premium_multiplier(value);
6223
6384
  }
6224
- get_max_mark_age_ns() {
6225
- const offset = 23;
6226
- return this.view.getBigUint64(offset, true);
6385
+ get_reserved1() {
6386
+ const offset = 19;
6387
+ return this.view.getUint32(offset, true);
6227
6388
  }
6228
- set_max_mark_age_ns(value) {
6229
- const offset = 23;
6230
- this.view.setBigUint64(offset, value, true);
6389
+ set_reserved1(value) {
6390
+ const offset = 19;
6391
+ this.view.setUint32(offset, value, true);
6231
6392
  }
6232
- get max_mark_age_ns() {
6233
- return this.get_max_mark_age_ns();
6393
+ get reserved1() {
6394
+ return this.get_reserved1();
6234
6395
  }
6235
- set max_mark_age_ns(value) {
6236
- this.set_max_mark_age_ns(value);
6396
+ set reserved1(value) {
6397
+ this.set_reserved1(value);
6237
6398
  }
6238
- get_reserved0() {
6239
- const offset = 31;
6399
+ get_impact_notional() {
6400
+ const offset = 23;
6240
6401
  return this.view.getBigUint64(offset, true);
6241
6402
  }
6242
- set_reserved0(value) {
6243
- const offset = 31;
6403
+ set_impact_notional(value) {
6404
+ const offset = 23;
6244
6405
  this.view.setBigUint64(offset, value, true);
6245
6406
  }
6246
- get reserved0() {
6247
- return this.get_reserved0();
6407
+ get impact_notional() {
6408
+ return this.get_impact_notional();
6248
6409
  }
6249
- set reserved0(value) {
6250
- this.set_reserved0(value);
6410
+ set impact_notional(value) {
6411
+ this.set_impact_notional(value);
6251
6412
  }
6252
6413
  static __tnFootprintInternal(__tnParams) {
6253
- return __tnEvalFootprint2(__tn_ir_MarketSetOracleInstruction.root, { params: __tnParams });
6414
+ return __tnEvalFootprint2(__tn_ir_MarketSetFundingInstruction.root, { params: __tnParams });
6254
6415
  }
6255
6416
  static __tnValidateInternal(buffer, __tnParams) {
6256
- return __tnValidateIrTree2(__tn_ir_MarketSetOracleInstruction, buffer, __tnParams);
6417
+ return __tnValidateIrTree2(__tn_ir_MarketSetFundingInstruction, buffer, __tnParams);
6257
6418
  }
6258
6419
  static __tnInvokeFootprint(__tnParams) {
6259
6420
  return this.__tnFootprintInternal(__tnParams);
@@ -6268,25 +6429,26 @@ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6268
6429
  const irResult = this.footprintIr();
6269
6430
  const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
6270
6431
  if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
6271
- throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for MarketSetOracleInstruction");
6432
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for MarketSetFundingInstruction");
6272
6433
  }
6273
- return __tnBigIntToNumber2(irResult, "MarketSetOracleInstruction::footprint");
6434
+ return __tnBigIntToNumber2(irResult, "MarketSetFundingInstruction::footprint");
6274
6435
  }
6275
6436
  static validate(buffer, _opts) {
6276
- if (buffer.length < 39) return { ok: false, code: "tn.buffer_too_small", consumed: 39 };
6277
- return { ok: true, consumed: 39 };
6437
+ if (buffer.length < 31) return { ok: false, code: "tn.buffer_too_small", consumed: 31 };
6438
+ return { ok: true, consumed: 31 };
6278
6439
  }
6279
- static new(market_record_idx, oracle_feed_account_idx, oracle_exponent, mark_num, mark_den, max_mark_age_ns, reserved0) {
6280
- const buffer = new Uint8Array(39);
6440
+ static new(market_record_idx, reserved0, interest_rate, clamp_small, clamp_big, premium_multiplier, reserved1, impact_notional) {
6441
+ const buffer = new Uint8Array(31);
6281
6442
  const view = new DataView(buffer.buffer);
6282
6443
  view.setUint8(0, market_record_idx);
6283
- view.setUint16(1, oracle_feed_account_idx, true);
6284
- view.setInt32(3, oracle_exponent, true);
6285
- view.setBigUint64(7, mark_num, true);
6286
- view.setBigUint64(15, mark_den, true);
6287
- view.setBigUint64(23, max_mark_age_ns, true);
6288
- view.setBigUint64(31, reserved0, true);
6289
- return new _MarketSetOracleInstruction(buffer);
6444
+ view.setUint16(1, reserved0, true);
6445
+ view.setUint32(3, interest_rate, true);
6446
+ view.setUint32(7, clamp_small, true);
6447
+ view.setUint32(11, clamp_big, true);
6448
+ view.setUint32(15, premium_multiplier, true);
6449
+ view.setUint32(19, reserved1, true);
6450
+ view.setBigUint64(23, impact_notional, true);
6451
+ return new _MarketSetFundingInstruction(buffer);
6290
6452
  }
6291
6453
  static from_array(buffer) {
6292
6454
  if (!buffer || buffer.length === void 0) {
@@ -6297,47 +6459,275 @@ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6297
6459
  if (!validation.ok) {
6298
6460
  return null;
6299
6461
  }
6300
- return new _MarketSetOracleInstruction(buffer);
6462
+ return new _MarketSetFundingInstruction(buffer);
6301
6463
  }
6302
6464
  };
6303
- var MarketSetOracleInstructionBuilder = class {
6465
+ var MarketSetFundingInstructionBuilder = class {
6304
6466
  constructor() {
6305
- this.buffer = new Uint8Array(39);
6467
+ this.buffer = new Uint8Array(31);
6306
6468
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
6307
6469
  }
6308
6470
  set_market_record_idx(value) {
6309
6471
  this.view.setUint8(0, value);
6310
6472
  return this;
6311
6473
  }
6312
- set_oracle_feed_account_idx(value) {
6474
+ set_reserved0(value) {
6313
6475
  this.view.setUint16(1, value, true);
6314
6476
  return this;
6315
6477
  }
6316
- set_oracle_exponent(value) {
6317
- this.view.setInt32(3, value, true);
6478
+ set_interest_rate(value) {
6479
+ this.view.setUint32(3, value, true);
6318
6480
  return this;
6319
6481
  }
6320
- set_mark_num(value) {
6321
- const cast = __tnToBigInt2(value);
6322
- this.view.setBigUint64(7, cast, true);
6482
+ set_clamp_small(value) {
6483
+ this.view.setUint32(7, value, true);
6323
6484
  return this;
6324
6485
  }
6325
- set_mark_den(value) {
6326
- const cast = __tnToBigInt2(value);
6327
- this.view.setBigUint64(15, cast, true);
6486
+ set_clamp_big(value) {
6487
+ this.view.setUint32(11, value, true);
6328
6488
  return this;
6329
6489
  }
6330
- set_max_mark_age_ns(value) {
6331
- const cast = __tnToBigInt2(value);
6332
- this.view.setBigUint64(23, cast, true);
6490
+ set_premium_multiplier(value) {
6491
+ this.view.setUint32(15, value, true);
6333
6492
  return this;
6334
6493
  }
6335
- set_reserved0(value) {
6336
- const cast = __tnToBigInt2(value);
6337
- this.view.setBigUint64(31, cast, true);
6494
+ set_reserved1(value) {
6495
+ this.view.setUint32(19, value, true);
6338
6496
  return this;
6339
6497
  }
6340
- build() {
6498
+ set_impact_notional(value) {
6499
+ const cast = __tnToBigInt2(value);
6500
+ this.view.setBigUint64(23, cast, true);
6501
+ return this;
6502
+ }
6503
+ build() {
6504
+ return this.buffer.slice();
6505
+ }
6506
+ buildInto(target, offset = 0) {
6507
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
6508
+ target.set(this.buffer, offset);
6509
+ return target;
6510
+ }
6511
+ finish() {
6512
+ const view = MarketSetFundingInstruction.from_array(this.buffer.slice());
6513
+ if (!view) throw new Error("failed to build MarketSetFundingInstruction");
6514
+ return view;
6515
+ }
6516
+ };
6517
+ __tnRegisterFootprint2("MarketSetFundingInstruction", (params) => MarketSetFundingInstruction.__tnInvokeFootprint(params));
6518
+ __tnRegisterValidate2("MarketSetFundingInstruction", (buffer, params) => MarketSetFundingInstruction.__tnInvokeValidate(buffer, params));
6519
+ __tnRegisterDynamicValidate2("MarketSetFundingInstruction", (buffer) => {
6520
+ const result = MarketSetFundingInstruction.validate(buffer);
6521
+ const params = result.params;
6522
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
6523
+ });
6524
+ var __tn_ir_MarketSetOracleInstruction = {
6525
+ typeName: "MarketSetOracleInstruction",
6526
+ root: { op: "const", value: 39n }
6527
+ };
6528
+ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6529
+ constructor(buffer) {
6530
+ this.buffer = buffer;
6531
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
6532
+ }
6533
+ static __tnCreateView(buffer, opts) {
6534
+ if (!buffer || buffer.length === void 0) throw new Error("MarketSetOracleInstruction.__tnCreateView requires a Uint8Array");
6535
+ return new _MarketSetOracleInstruction(new Uint8Array(buffer));
6536
+ }
6537
+ static builder() {
6538
+ return new MarketSetOracleInstructionBuilder();
6539
+ }
6540
+ static fromBuilder(builder) {
6541
+ const buffer = builder.build();
6542
+ return _MarketSetOracleInstruction.from_array(buffer);
6543
+ }
6544
+ get_market_record_idx() {
6545
+ const offset = 0;
6546
+ return this.view.getUint8(offset);
6547
+ }
6548
+ set_market_record_idx(value) {
6549
+ const offset = 0;
6550
+ this.view.setUint8(offset, value);
6551
+ }
6552
+ get market_record_idx() {
6553
+ return this.get_market_record_idx();
6554
+ }
6555
+ set market_record_idx(value) {
6556
+ this.set_market_record_idx(value);
6557
+ }
6558
+ get_oracle_feed_account_idx() {
6559
+ const offset = 1;
6560
+ return this.view.getUint16(offset, true);
6561
+ }
6562
+ set_oracle_feed_account_idx(value) {
6563
+ const offset = 1;
6564
+ this.view.setUint16(offset, value, true);
6565
+ }
6566
+ get oracle_feed_account_idx() {
6567
+ return this.get_oracle_feed_account_idx();
6568
+ }
6569
+ set oracle_feed_account_idx(value) {
6570
+ this.set_oracle_feed_account_idx(value);
6571
+ }
6572
+ get_oracle_exponent() {
6573
+ const offset = 3;
6574
+ return this.view.getInt32(offset, true);
6575
+ }
6576
+ set_oracle_exponent(value) {
6577
+ const offset = 3;
6578
+ this.view.setInt32(offset, value, true);
6579
+ }
6580
+ get oracle_exponent() {
6581
+ return this.get_oracle_exponent();
6582
+ }
6583
+ set oracle_exponent(value) {
6584
+ this.set_oracle_exponent(value);
6585
+ }
6586
+ get_mark_num() {
6587
+ const offset = 7;
6588
+ return this.view.getBigUint64(offset, true);
6589
+ }
6590
+ set_mark_num(value) {
6591
+ const offset = 7;
6592
+ this.view.setBigUint64(offset, value, true);
6593
+ }
6594
+ get mark_num() {
6595
+ return this.get_mark_num();
6596
+ }
6597
+ set mark_num(value) {
6598
+ this.set_mark_num(value);
6599
+ }
6600
+ get_mark_den() {
6601
+ const offset = 15;
6602
+ return this.view.getBigUint64(offset, true);
6603
+ }
6604
+ set_mark_den(value) {
6605
+ const offset = 15;
6606
+ this.view.setBigUint64(offset, value, true);
6607
+ }
6608
+ get mark_den() {
6609
+ return this.get_mark_den();
6610
+ }
6611
+ set mark_den(value) {
6612
+ this.set_mark_den(value);
6613
+ }
6614
+ get_max_mark_age_ns() {
6615
+ const offset = 23;
6616
+ return this.view.getBigUint64(offset, true);
6617
+ }
6618
+ set_max_mark_age_ns(value) {
6619
+ const offset = 23;
6620
+ this.view.setBigUint64(offset, value, true);
6621
+ }
6622
+ get max_mark_age_ns() {
6623
+ return this.get_max_mark_age_ns();
6624
+ }
6625
+ set max_mark_age_ns(value) {
6626
+ this.set_max_mark_age_ns(value);
6627
+ }
6628
+ get_reserved0() {
6629
+ const offset = 31;
6630
+ return this.view.getBigUint64(offset, true);
6631
+ }
6632
+ set_reserved0(value) {
6633
+ const offset = 31;
6634
+ this.view.setBigUint64(offset, value, true);
6635
+ }
6636
+ get reserved0() {
6637
+ return this.get_reserved0();
6638
+ }
6639
+ set reserved0(value) {
6640
+ this.set_reserved0(value);
6641
+ }
6642
+ static __tnFootprintInternal(__tnParams) {
6643
+ return __tnEvalFootprint2(__tn_ir_MarketSetOracleInstruction.root, { params: __tnParams });
6644
+ }
6645
+ static __tnValidateInternal(buffer, __tnParams) {
6646
+ return __tnValidateIrTree2(__tn_ir_MarketSetOracleInstruction, buffer, __tnParams);
6647
+ }
6648
+ static __tnInvokeFootprint(__tnParams) {
6649
+ return this.__tnFootprintInternal(__tnParams);
6650
+ }
6651
+ static __tnInvokeValidate(buffer, __tnParams) {
6652
+ return this.__tnValidateInternal(buffer, __tnParams);
6653
+ }
6654
+ static footprintIr() {
6655
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
6656
+ }
6657
+ static footprint() {
6658
+ const irResult = this.footprintIr();
6659
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
6660
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
6661
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for MarketSetOracleInstruction");
6662
+ }
6663
+ return __tnBigIntToNumber2(irResult, "MarketSetOracleInstruction::footprint");
6664
+ }
6665
+ static validate(buffer, _opts) {
6666
+ if (buffer.length < 39) return { ok: false, code: "tn.buffer_too_small", consumed: 39 };
6667
+ return { ok: true, consumed: 39 };
6668
+ }
6669
+ static new(market_record_idx, oracle_feed_account_idx, oracle_exponent, mark_num, mark_den, max_mark_age_ns, reserved0) {
6670
+ const buffer = new Uint8Array(39);
6671
+ const view = new DataView(buffer.buffer);
6672
+ view.setUint8(0, market_record_idx);
6673
+ view.setUint16(1, oracle_feed_account_idx, true);
6674
+ view.setInt32(3, oracle_exponent, true);
6675
+ view.setBigUint64(7, mark_num, true);
6676
+ view.setBigUint64(15, mark_den, true);
6677
+ view.setBigUint64(23, max_mark_age_ns, true);
6678
+ view.setBigUint64(31, reserved0, true);
6679
+ return new _MarketSetOracleInstruction(buffer);
6680
+ }
6681
+ static from_array(buffer) {
6682
+ if (!buffer || buffer.length === void 0) {
6683
+ return null;
6684
+ }
6685
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
6686
+ const validation = this.validate(buffer);
6687
+ if (!validation.ok) {
6688
+ return null;
6689
+ }
6690
+ return new _MarketSetOracleInstruction(buffer);
6691
+ }
6692
+ };
6693
+ var MarketSetOracleInstructionBuilder = class {
6694
+ constructor() {
6695
+ this.buffer = new Uint8Array(39);
6696
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
6697
+ }
6698
+ set_market_record_idx(value) {
6699
+ this.view.setUint8(0, value);
6700
+ return this;
6701
+ }
6702
+ set_oracle_feed_account_idx(value) {
6703
+ this.view.setUint16(1, value, true);
6704
+ return this;
6705
+ }
6706
+ set_oracle_exponent(value) {
6707
+ this.view.setInt32(3, value, true);
6708
+ return this;
6709
+ }
6710
+ set_mark_num(value) {
6711
+ const cast = __tnToBigInt2(value);
6712
+ this.view.setBigUint64(7, cast, true);
6713
+ return this;
6714
+ }
6715
+ set_mark_den(value) {
6716
+ const cast = __tnToBigInt2(value);
6717
+ this.view.setBigUint64(15, cast, true);
6718
+ return this;
6719
+ }
6720
+ set_max_mark_age_ns(value) {
6721
+ const cast = __tnToBigInt2(value);
6722
+ this.view.setBigUint64(23, cast, true);
6723
+ return this;
6724
+ }
6725
+ set_reserved0(value) {
6726
+ const cast = __tnToBigInt2(value);
6727
+ this.view.setBigUint64(31, cast, true);
6728
+ return this;
6729
+ }
6730
+ build() {
6341
6731
  return this.buffer.slice();
6342
6732
  }
6343
6733
  buildInto(target, offset = 0) {
@@ -7988,19 +8378,19 @@ var SeatEntry = class _SeatEntry {
7988
8378
  set head_order_entry_idx(value) {
7989
8379
  this.set_head_order_entry_idx(value);
7990
8380
  }
7991
- get_reserved0() {
8381
+ get_funding_carry() {
7992
8382
  const offset = 76;
7993
8383
  return this.view.getUint32(offset, true);
7994
8384
  }
7995
- set_reserved0(value) {
8385
+ set_funding_carry(value) {
7996
8386
  const offset = 76;
7997
8387
  this.view.setUint32(offset, value, true);
7998
8388
  }
7999
- get reserved0() {
8000
- return this.get_reserved0();
8389
+ get funding_carry() {
8390
+ return this.get_funding_carry();
8001
8391
  }
8002
- set reserved0(value) {
8003
- this.set_reserved0(value);
8392
+ set funding_carry(value) {
8393
+ this.set_funding_carry(value);
8004
8394
  }
8005
8395
  get_entry_notional() {
8006
8396
  const offset = 80;
@@ -8044,35 +8434,40 @@ var SeatEntry = class _SeatEntry {
8044
8434
  set open_ask_notional(value) {
8045
8435
  this.set_open_ask_notional(value);
8046
8436
  }
8047
- get_reserved1() {
8437
+ get_funding_snapshot_lo() {
8048
8438
  const offset = 104;
8049
- const result = [];
8050
- for (let i = 0; i < 16; i++) {
8051
- result.push(this.view.getUint8(offset + i * 1));
8052
- }
8053
- return result;
8439
+ return this.view.getBigUint64(offset, true);
8054
8440
  }
8055
- set_reserved1(value) {
8441
+ set_funding_snapshot_lo(value) {
8056
8442
  const offset = 104;
8057
- if (value.length !== 16) {
8058
- throw new Error("Array length must be 16");
8059
- }
8060
- for (let i = 0; i < 16; i++) {
8061
- this.view.setUint8(offset + i * 1, value[i]);
8062
- }
8443
+ this.view.setBigUint64(offset, value, true);
8063
8444
  }
8064
- get reserved1() {
8065
- return this.get_reserved1();
8445
+ get funding_snapshot_lo() {
8446
+ return this.get_funding_snapshot_lo();
8066
8447
  }
8067
- set reserved1(value) {
8068
- this.set_reserved1(value);
8448
+ set funding_snapshot_lo(value) {
8449
+ this.set_funding_snapshot_lo(value);
8069
8450
  }
8070
- get_non_nullable_reserved() {
8071
- const offset = 120;
8451
+ get_funding_snapshot_hi() {
8452
+ const offset = 112;
8072
8453
  return this.view.getBigUint64(offset, true);
8073
8454
  }
8074
- set_non_nullable_reserved(value) {
8075
- const offset = 120;
8455
+ set_funding_snapshot_hi(value) {
8456
+ const offset = 112;
8457
+ this.view.setBigUint64(offset, value, true);
8458
+ }
8459
+ get funding_snapshot_hi() {
8460
+ return this.get_funding_snapshot_hi();
8461
+ }
8462
+ set funding_snapshot_hi(value) {
8463
+ this.set_funding_snapshot_hi(value);
8464
+ }
8465
+ get_non_nullable_reserved() {
8466
+ const offset = 120;
8467
+ return this.view.getBigUint64(offset, true);
8468
+ }
8469
+ set_non_nullable_reserved(value) {
8470
+ const offset = 120;
8076
8471
  this.view.setBigUint64(offset, value, true);
8077
8472
  }
8078
8473
  get non_nullable_reserved() {
@@ -8159,7 +8554,7 @@ var SeatEntryBuilder = class {
8159
8554
  this.view.setUint32(72, value, true);
8160
8555
  return this;
8161
8556
  }
8162
- set_reserved0(value) {
8557
+ set_funding_carry(value) {
8163
8558
  this.view.setUint32(76, value, true);
8164
8559
  return this;
8165
8560
  }
@@ -8178,12 +8573,14 @@ var SeatEntryBuilder = class {
8178
8573
  this.view.setBigUint64(96, cast, true);
8179
8574
  return this;
8180
8575
  }
8181
- set_reserved1(values) {
8182
- if (values.length !== 16) throw new Error("reserved1 expects 16 elements");
8183
- for (let i = 0; i < values.length; i++) {
8184
- const byteOffset = 104 + i * 1;
8185
- this.view.setUint8(byteOffset, values[i]);
8186
- }
8576
+ set_funding_snapshot_lo(value) {
8577
+ const cast = __tnToBigInt2(value);
8578
+ this.view.setBigUint64(104, cast, true);
8579
+ return this;
8580
+ }
8581
+ set_funding_snapshot_hi(value) {
8582
+ const cast = __tnToBigInt2(value);
8583
+ this.view.setBigUint64(112, cast, true);
8187
8584
  return this;
8188
8585
  }
8189
8586
  set_non_nullable_reserved(value) {
@@ -8212,6 +8609,153 @@ __tnRegisterDynamicValidate2("SeatEntry", (buffer) => {
8212
8609
  const params = result.params;
8213
8610
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
8214
8611
  });
8612
+ var __tn_ir_SettleFundingInstruction = {
8613
+ typeName: "SettleFundingInstruction",
8614
+ root: { op: "const", value: 7n }
8615
+ };
8616
+ var SettleFundingInstruction = class _SettleFundingInstruction {
8617
+ constructor(buffer) {
8618
+ this.buffer = buffer;
8619
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
8620
+ }
8621
+ static __tnCreateView(buffer, opts) {
8622
+ if (!buffer || buffer.length === void 0) throw new Error("SettleFundingInstruction.__tnCreateView requires a Uint8Array");
8623
+ return new _SettleFundingInstruction(new Uint8Array(buffer));
8624
+ }
8625
+ static builder() {
8626
+ return new SettleFundingInstructionBuilder();
8627
+ }
8628
+ static fromBuilder(builder) {
8629
+ const buffer = builder.build();
8630
+ return _SettleFundingInstruction.from_array(buffer);
8631
+ }
8632
+ get_market_record_idx() {
8633
+ const offset = 0;
8634
+ return this.view.getUint8(offset);
8635
+ }
8636
+ set_market_record_idx(value) {
8637
+ const offset = 0;
8638
+ this.view.setUint8(offset, value);
8639
+ }
8640
+ get market_record_idx() {
8641
+ return this.get_market_record_idx();
8642
+ }
8643
+ set market_record_idx(value) {
8644
+ this.set_market_record_idx(value);
8645
+ }
8646
+ get_reserved0() {
8647
+ const offset = 1;
8648
+ return this.view.getUint16(offset, true);
8649
+ }
8650
+ set_reserved0(value) {
8651
+ const offset = 1;
8652
+ this.view.setUint16(offset, value, true);
8653
+ }
8654
+ get reserved0() {
8655
+ return this.get_reserved0();
8656
+ }
8657
+ set reserved0(value) {
8658
+ this.set_reserved0(value);
8659
+ }
8660
+ get_target_seat_idx() {
8661
+ const offset = 3;
8662
+ return this.view.getUint32(offset, true);
8663
+ }
8664
+ set_target_seat_idx(value) {
8665
+ const offset = 3;
8666
+ this.view.setUint32(offset, value, true);
8667
+ }
8668
+ get target_seat_idx() {
8669
+ return this.get_target_seat_idx();
8670
+ }
8671
+ set target_seat_idx(value) {
8672
+ this.set_target_seat_idx(value);
8673
+ }
8674
+ static __tnFootprintInternal(__tnParams) {
8675
+ return __tnEvalFootprint2(__tn_ir_SettleFundingInstruction.root, { params: __tnParams });
8676
+ }
8677
+ static __tnValidateInternal(buffer, __tnParams) {
8678
+ return __tnValidateIrTree2(__tn_ir_SettleFundingInstruction, buffer, __tnParams);
8679
+ }
8680
+ static __tnInvokeFootprint(__tnParams) {
8681
+ return this.__tnFootprintInternal(__tnParams);
8682
+ }
8683
+ static __tnInvokeValidate(buffer, __tnParams) {
8684
+ return this.__tnValidateInternal(buffer, __tnParams);
8685
+ }
8686
+ static footprintIr() {
8687
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
8688
+ }
8689
+ static footprint() {
8690
+ const irResult = this.footprintIr();
8691
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
8692
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
8693
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for SettleFundingInstruction");
8694
+ }
8695
+ return __tnBigIntToNumber2(irResult, "SettleFundingInstruction::footprint");
8696
+ }
8697
+ static validate(buffer, _opts) {
8698
+ if (buffer.length < 7) return { ok: false, code: "tn.buffer_too_small", consumed: 7 };
8699
+ return { ok: true, consumed: 7 };
8700
+ }
8701
+ static new(market_record_idx, reserved0, target_seat_idx) {
8702
+ const buffer = new Uint8Array(7);
8703
+ const view = new DataView(buffer.buffer);
8704
+ view.setUint8(0, market_record_idx);
8705
+ view.setUint16(1, reserved0, true);
8706
+ view.setUint32(3, target_seat_idx, true);
8707
+ return new _SettleFundingInstruction(buffer);
8708
+ }
8709
+ static from_array(buffer) {
8710
+ if (!buffer || buffer.length === void 0) {
8711
+ return null;
8712
+ }
8713
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
8714
+ const validation = this.validate(buffer);
8715
+ if (!validation.ok) {
8716
+ return null;
8717
+ }
8718
+ return new _SettleFundingInstruction(buffer);
8719
+ }
8720
+ };
8721
+ var SettleFundingInstructionBuilder = class {
8722
+ constructor() {
8723
+ this.buffer = new Uint8Array(7);
8724
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
8725
+ }
8726
+ set_market_record_idx(value) {
8727
+ this.view.setUint8(0, value);
8728
+ return this;
8729
+ }
8730
+ set_reserved0(value) {
8731
+ this.view.setUint16(1, value, true);
8732
+ return this;
8733
+ }
8734
+ set_target_seat_idx(value) {
8735
+ this.view.setUint32(3, value, true);
8736
+ return this;
8737
+ }
8738
+ build() {
8739
+ return this.buffer.slice();
8740
+ }
8741
+ buildInto(target, offset = 0) {
8742
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
8743
+ target.set(this.buffer, offset);
8744
+ return target;
8745
+ }
8746
+ finish() {
8747
+ const view = SettleFundingInstruction.from_array(this.buffer.slice());
8748
+ if (!view) throw new Error("failed to build SettleFundingInstruction");
8749
+ return view;
8750
+ }
8751
+ };
8752
+ __tnRegisterFootprint2("SettleFundingInstruction", (params) => SettleFundingInstruction.__tnInvokeFootprint(params));
8753
+ __tnRegisterValidate2("SettleFundingInstruction", (buffer, params) => SettleFundingInstruction.__tnInvokeValidate(buffer, params));
8754
+ __tnRegisterDynamicValidate2("SettleFundingInstruction", (buffer) => {
8755
+ const result = SettleFundingInstruction.validate(buffer);
8756
+ const params = result.params;
8757
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
8758
+ });
8215
8759
  var __tn_ir_TokenBalanceEvent = {
8216
8760
  typeName: "TokenBalanceEvent",
8217
8761
  root: { op: "const", value: 168n }
@@ -9986,6 +10530,262 @@ __tnRegisterDynamicValidate2("ExchangeStatusEvent", (buffer) => {
9986
10530
  const params = result.params;
9987
10531
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
9988
10532
  });
10533
+ var __tn_ir_FundingRoundEvent = {
10534
+ typeName: "FundingRoundEvent",
10535
+ root: { op: "const", value: 88n }
10536
+ };
10537
+ var FundingRoundEvent = class _FundingRoundEvent {
10538
+ constructor(buffer) {
10539
+ this.buffer = buffer;
10540
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
10541
+ }
10542
+ static __tnCreateView(buffer, opts) {
10543
+ if (!buffer || buffer.length === void 0) throw new Error("FundingRoundEvent.__tnCreateView requires a Uint8Array");
10544
+ return new _FundingRoundEvent(new Uint8Array(buffer));
10545
+ }
10546
+ static builder() {
10547
+ return new FundingRoundEventBuilder();
10548
+ }
10549
+ static fromBuilder(builder) {
10550
+ const buffer = builder.build();
10551
+ return _FundingRoundEvent.from_array(buffer);
10552
+ }
10553
+ get_market() {
10554
+ const offset = 0;
10555
+ const slice = this.buffer.subarray(offset, offset + 32);
10556
+ return Pubkey.from_array(slice);
10557
+ }
10558
+ set_market(value) {
10559
+ const sourceBytes = value.buffer;
10560
+ const offset = 0;
10561
+ this.buffer.set(sourceBytes, offset);
10562
+ }
10563
+ get market() {
10564
+ return this.get_market();
10565
+ }
10566
+ set market(value) {
10567
+ this.set_market(value);
10568
+ }
10569
+ get_rate() {
10570
+ const offset = 32;
10571
+ return this.view.getBigInt64(offset, true);
10572
+ }
10573
+ set_rate(value) {
10574
+ const offset = 32;
10575
+ this.view.setBigInt64(offset, value, true);
10576
+ }
10577
+ get rate() {
10578
+ return this.get_rate();
10579
+ }
10580
+ set rate(value) {
10581
+ this.set_rate(value);
10582
+ }
10583
+ get_premium_sum() {
10584
+ const offset = 40;
10585
+ return this.view.getBigInt64(offset, true);
10586
+ }
10587
+ set_premium_sum(value) {
10588
+ const offset = 40;
10589
+ this.view.setBigInt64(offset, value, true);
10590
+ }
10591
+ get premium_sum() {
10592
+ return this.get_premium_sum();
10593
+ }
10594
+ set premium_sum(value) {
10595
+ this.set_premium_sum(value);
10596
+ }
10597
+ get_sample_cnt() {
10598
+ const offset = 48;
10599
+ return this.view.getUint32(offset, true);
10600
+ }
10601
+ set_sample_cnt(value) {
10602
+ const offset = 48;
10603
+ this.view.setUint32(offset, value, true);
10604
+ }
10605
+ get sample_cnt() {
10606
+ return this.get_sample_cnt();
10607
+ }
10608
+ set sample_cnt(value) {
10609
+ this.set_sample_cnt(value);
10610
+ }
10611
+ get_reserved0() {
10612
+ const offset = 52;
10613
+ return this.view.getUint32(offset, true);
10614
+ }
10615
+ set_reserved0(value) {
10616
+ const offset = 52;
10617
+ this.view.setUint32(offset, value, true);
10618
+ }
10619
+ get reserved0() {
10620
+ return this.get_reserved0();
10621
+ }
10622
+ set reserved0(value) {
10623
+ this.set_reserved0(value);
10624
+ }
10625
+ get_index_price() {
10626
+ const offset = 56;
10627
+ return this.view.getBigUint64(offset, true);
10628
+ }
10629
+ set_index_price(value) {
10630
+ const offset = 56;
10631
+ this.view.setBigUint64(offset, value, true);
10632
+ }
10633
+ get index_price() {
10634
+ return this.get_index_price();
10635
+ }
10636
+ set index_price(value) {
10637
+ this.set_index_price(value);
10638
+ }
10639
+ get_funding_index_lo() {
10640
+ const offset = 64;
10641
+ return this.view.getBigUint64(offset, true);
10642
+ }
10643
+ set_funding_index_lo(value) {
10644
+ const offset = 64;
10645
+ this.view.setBigUint64(offset, value, true);
10646
+ }
10647
+ get funding_index_lo() {
10648
+ return this.get_funding_index_lo();
10649
+ }
10650
+ set funding_index_lo(value) {
10651
+ this.set_funding_index_lo(value);
10652
+ }
10653
+ get_funding_index_hi() {
10654
+ const offset = 72;
10655
+ return this.view.getBigUint64(offset, true);
10656
+ }
10657
+ set_funding_index_hi(value) {
10658
+ const offset = 72;
10659
+ this.view.setBigUint64(offset, value, true);
10660
+ }
10661
+ get funding_index_hi() {
10662
+ return this.get_funding_index_hi();
10663
+ }
10664
+ set funding_index_hi(value) {
10665
+ this.set_funding_index_hi(value);
10666
+ }
10667
+ get_round_ns() {
10668
+ const offset = 80;
10669
+ return this.view.getBigUint64(offset, true);
10670
+ }
10671
+ set_round_ns(value) {
10672
+ const offset = 80;
10673
+ this.view.setBigUint64(offset, value, true);
10674
+ }
10675
+ get round_ns() {
10676
+ return this.get_round_ns();
10677
+ }
10678
+ set round_ns(value) {
10679
+ this.set_round_ns(value);
10680
+ }
10681
+ static __tnFootprintInternal(__tnParams) {
10682
+ return __tnEvalFootprint2(__tn_ir_FundingRoundEvent.root, { params: __tnParams });
10683
+ }
10684
+ static __tnValidateInternal(buffer, __tnParams) {
10685
+ return __tnValidateIrTree2(__tn_ir_FundingRoundEvent, buffer, __tnParams);
10686
+ }
10687
+ static __tnInvokeFootprint(__tnParams) {
10688
+ return this.__tnFootprintInternal(__tnParams);
10689
+ }
10690
+ static __tnInvokeValidate(buffer, __tnParams) {
10691
+ return this.__tnValidateInternal(buffer, __tnParams);
10692
+ }
10693
+ static footprintIr() {
10694
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
10695
+ }
10696
+ static footprint() {
10697
+ const irResult = this.footprintIr();
10698
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
10699
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
10700
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for FundingRoundEvent");
10701
+ }
10702
+ return __tnBigIntToNumber2(irResult, "FundingRoundEvent::footprint");
10703
+ }
10704
+ static validate(buffer, _opts) {
10705
+ if (buffer.length < 88) return { ok: false, code: "tn.buffer_too_small", consumed: 88 };
10706
+ return { ok: true, consumed: 88 };
10707
+ }
10708
+ static from_array(buffer) {
10709
+ if (!buffer || buffer.length === void 0) {
10710
+ return null;
10711
+ }
10712
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
10713
+ const validation = this.validate(buffer);
10714
+ if (!validation.ok) {
10715
+ return null;
10716
+ }
10717
+ return new _FundingRoundEvent(buffer);
10718
+ }
10719
+ };
10720
+ var FundingRoundEventBuilder = class {
10721
+ constructor() {
10722
+ this.buffer = new Uint8Array(88);
10723
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
10724
+ }
10725
+ set_market(value) {
10726
+ if (value.length !== 32) throw new Error("market expects 32 bytes");
10727
+ this.buffer.set(value, 0);
10728
+ return this;
10729
+ }
10730
+ set_rate(value) {
10731
+ const cast = __tnToBigInt2(value);
10732
+ this.view.setBigInt64(32, cast, true);
10733
+ return this;
10734
+ }
10735
+ set_premium_sum(value) {
10736
+ const cast = __tnToBigInt2(value);
10737
+ this.view.setBigInt64(40, cast, true);
10738
+ return this;
10739
+ }
10740
+ set_sample_cnt(value) {
10741
+ this.view.setUint32(48, value, true);
10742
+ return this;
10743
+ }
10744
+ set_reserved0(value) {
10745
+ this.view.setUint32(52, value, true);
10746
+ return this;
10747
+ }
10748
+ set_index_price(value) {
10749
+ const cast = __tnToBigInt2(value);
10750
+ this.view.setBigUint64(56, cast, true);
10751
+ return this;
10752
+ }
10753
+ set_funding_index_lo(value) {
10754
+ const cast = __tnToBigInt2(value);
10755
+ this.view.setBigUint64(64, cast, true);
10756
+ return this;
10757
+ }
10758
+ set_funding_index_hi(value) {
10759
+ const cast = __tnToBigInt2(value);
10760
+ this.view.setBigUint64(72, cast, true);
10761
+ return this;
10762
+ }
10763
+ set_round_ns(value) {
10764
+ const cast = __tnToBigInt2(value);
10765
+ this.view.setBigUint64(80, cast, true);
10766
+ return this;
10767
+ }
10768
+ build() {
10769
+ return this.buffer.slice();
10770
+ }
10771
+ buildInto(target, offset = 0) {
10772
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
10773
+ target.set(this.buffer, offset);
10774
+ return target;
10775
+ }
10776
+ finish() {
10777
+ const view = FundingRoundEvent.from_array(this.buffer.slice());
10778
+ if (!view) throw new Error("failed to build FundingRoundEvent");
10779
+ return view;
10780
+ }
10781
+ };
10782
+ __tnRegisterFootprint2("FundingRoundEvent", (params) => FundingRoundEvent.__tnInvokeFootprint(params));
10783
+ __tnRegisterValidate2("FundingRoundEvent", (buffer, params) => FundingRoundEvent.__tnInvokeValidate(buffer, params));
10784
+ __tnRegisterDynamicValidate2("FundingRoundEvent", (buffer) => {
10785
+ const result = FundingRoundEvent.validate(buffer);
10786
+ const params = result.params;
10787
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
10788
+ });
9989
10789
  var __tn_ir_LiquidationEvent = {
9990
10790
  typeName: "LiquidationEvent",
9991
10791
  root: { op: "const", value: 160n }
@@ -10335,7 +11135,7 @@ __tnRegisterDynamicValidate2("LiquidationEvent", (buffer) => {
10335
11135
  });
10336
11136
  var __tn_ir_MarketAccount = {
10337
11137
  typeName: "MarketAccount",
10338
- root: { op: "const", value: 320n }
11138
+ root: { op: "const", value: 448n }
10339
11139
  };
10340
11140
  var MarketAccount = class _MarketAccount {
10341
11141
  constructor(buffer) {
@@ -10704,34 +11504,253 @@ var MarketAccount = class _MarketAccount {
10704
11504
  const offset = 288;
10705
11505
  this.view.setBigUint64(offset, value, true);
10706
11506
  }
10707
- get max_mark_age_ns() {
10708
- return this.get_max_mark_age_ns();
11507
+ get max_mark_age_ns() {
11508
+ return this.get_max_mark_age_ns();
11509
+ }
11510
+ set max_mark_age_ns(value) {
11511
+ this.set_max_mark_age_ns(value);
11512
+ }
11513
+ get_reserved2() {
11514
+ const offset = 296;
11515
+ const result = [];
11516
+ for (let i = 0; i < 24; i++) {
11517
+ result.push(this.view.getUint8(offset + i * 1));
11518
+ }
11519
+ return result;
11520
+ }
11521
+ set_reserved2(value) {
11522
+ const offset = 296;
11523
+ if (value.length !== 24) {
11524
+ throw new Error("Array length must be 24");
11525
+ }
11526
+ for (let i = 0; i < 24; i++) {
11527
+ this.view.setUint8(offset + i * 1, value[i]);
11528
+ }
11529
+ }
11530
+ get reserved2() {
11531
+ return this.get_reserved2();
11532
+ }
11533
+ set reserved2(value) {
11534
+ this.set_reserved2(value);
11535
+ }
11536
+ get_funding_index_lo() {
11537
+ const offset = 320;
11538
+ return this.view.getBigUint64(offset, true);
11539
+ }
11540
+ set_funding_index_lo(value) {
11541
+ const offset = 320;
11542
+ this.view.setBigUint64(offset, value, true);
11543
+ }
11544
+ get funding_index_lo() {
11545
+ return this.get_funding_index_lo();
11546
+ }
11547
+ set funding_index_lo(value) {
11548
+ this.set_funding_index_lo(value);
11549
+ }
11550
+ get_funding_index_hi() {
11551
+ const offset = 328;
11552
+ return this.view.getBigUint64(offset, true);
11553
+ }
11554
+ set_funding_index_hi(value) {
11555
+ const offset = 328;
11556
+ this.view.setBigUint64(offset, value, true);
11557
+ }
11558
+ get funding_index_hi() {
11559
+ return this.get_funding_index_hi();
11560
+ }
11561
+ set funding_index_hi(value) {
11562
+ this.set_funding_index_hi(value);
11563
+ }
11564
+ get_funding_balance() {
11565
+ const offset = 336;
11566
+ return this.view.getBigInt64(offset, true);
11567
+ }
11568
+ set_funding_balance(value) {
11569
+ const offset = 336;
11570
+ this.view.setBigInt64(offset, value, true);
11571
+ }
11572
+ get funding_balance() {
11573
+ return this.get_funding_balance();
11574
+ }
11575
+ set funding_balance(value) {
11576
+ this.set_funding_balance(value);
11577
+ }
11578
+ get_funding_last_round_ns() {
11579
+ const offset = 344;
11580
+ return this.view.getBigUint64(offset, true);
11581
+ }
11582
+ set_funding_last_round_ns(value) {
11583
+ const offset = 344;
11584
+ this.view.setBigUint64(offset, value, true);
11585
+ }
11586
+ get funding_last_round_ns() {
11587
+ return this.get_funding_last_round_ns();
11588
+ }
11589
+ set funding_last_round_ns(value) {
11590
+ this.set_funding_last_round_ns(value);
11591
+ }
11592
+ get_funding_last_sample_ns() {
11593
+ const offset = 352;
11594
+ return this.view.getBigUint64(offset, true);
11595
+ }
11596
+ set_funding_last_sample_ns(value) {
11597
+ const offset = 352;
11598
+ this.view.setBigUint64(offset, value, true);
11599
+ }
11600
+ get funding_last_sample_ns() {
11601
+ return this.get_funding_last_sample_ns();
11602
+ }
11603
+ set funding_last_sample_ns(value) {
11604
+ this.set_funding_last_sample_ns(value);
11605
+ }
11606
+ get_funding_premium_sum() {
11607
+ const offset = 360;
11608
+ return this.view.getBigInt64(offset, true);
11609
+ }
11610
+ set_funding_premium_sum(value) {
11611
+ const offset = 360;
11612
+ this.view.setBigInt64(offset, value, true);
11613
+ }
11614
+ get funding_premium_sum() {
11615
+ return this.get_funding_premium_sum();
11616
+ }
11617
+ set funding_premium_sum(value) {
11618
+ this.set_funding_premium_sum(value);
11619
+ }
11620
+ get_funding_impact_notional() {
11621
+ const offset = 368;
11622
+ return this.view.getBigUint64(offset, true);
11623
+ }
11624
+ set_funding_impact_notional(value) {
11625
+ const offset = 368;
11626
+ this.view.setBigUint64(offset, value, true);
11627
+ }
11628
+ get funding_impact_notional() {
11629
+ return this.get_funding_impact_notional();
11630
+ }
11631
+ set funding_impact_notional(value) {
11632
+ this.set_funding_impact_notional(value);
11633
+ }
11634
+ get_funding_rate() {
11635
+ const offset = 376;
11636
+ return this.view.getBigInt64(offset, true);
11637
+ }
11638
+ set_funding_rate(value) {
11639
+ const offset = 376;
11640
+ this.view.setBigInt64(offset, value, true);
11641
+ }
11642
+ get funding_rate() {
11643
+ return this.get_funding_rate();
11644
+ }
11645
+ set funding_rate(value) {
11646
+ this.set_funding_rate(value);
11647
+ }
11648
+ get_funding_interest_rate() {
11649
+ const offset = 384;
11650
+ return this.view.getUint32(offset, true);
11651
+ }
11652
+ set_funding_interest_rate(value) {
11653
+ const offset = 384;
11654
+ this.view.setUint32(offset, value, true);
11655
+ }
11656
+ get funding_interest_rate() {
11657
+ return this.get_funding_interest_rate();
11658
+ }
11659
+ set funding_interest_rate(value) {
11660
+ this.set_funding_interest_rate(value);
11661
+ }
11662
+ get_funding_clamp_small() {
11663
+ const offset = 388;
11664
+ return this.view.getUint32(offset, true);
11665
+ }
11666
+ set_funding_clamp_small(value) {
11667
+ const offset = 388;
11668
+ this.view.setUint32(offset, value, true);
11669
+ }
11670
+ get funding_clamp_small() {
11671
+ return this.get_funding_clamp_small();
11672
+ }
11673
+ set funding_clamp_small(value) {
11674
+ this.set_funding_clamp_small(value);
11675
+ }
11676
+ get_funding_clamp_big() {
11677
+ const offset = 392;
11678
+ return this.view.getUint32(offset, true);
11679
+ }
11680
+ set_funding_clamp_big(value) {
11681
+ const offset = 392;
11682
+ this.view.setUint32(offset, value, true);
11683
+ }
11684
+ get funding_clamp_big() {
11685
+ return this.get_funding_clamp_big();
11686
+ }
11687
+ set funding_clamp_big(value) {
11688
+ this.set_funding_clamp_big(value);
11689
+ }
11690
+ get_funding_premium_multiplier() {
11691
+ const offset = 396;
11692
+ return this.view.getUint32(offset, true);
11693
+ }
11694
+ set_funding_premium_multiplier(value) {
11695
+ const offset = 396;
11696
+ this.view.setUint32(offset, value, true);
11697
+ }
11698
+ get funding_premium_multiplier() {
11699
+ return this.get_funding_premium_multiplier();
11700
+ }
11701
+ set funding_premium_multiplier(value) {
11702
+ this.set_funding_premium_multiplier(value);
11703
+ }
11704
+ get_funding_sample_cnt() {
11705
+ const offset = 400;
11706
+ return this.view.getUint32(offset, true);
11707
+ }
11708
+ set_funding_sample_cnt(value) {
11709
+ const offset = 400;
11710
+ this.view.setUint32(offset, value, true);
11711
+ }
11712
+ get funding_sample_cnt() {
11713
+ return this.get_funding_sample_cnt();
11714
+ }
11715
+ set funding_sample_cnt(value) {
11716
+ this.set_funding_sample_cnt(value);
11717
+ }
11718
+ get_reserved3() {
11719
+ const offset = 404;
11720
+ return this.view.getUint32(offset, true);
11721
+ }
11722
+ set_reserved3(value) {
11723
+ const offset = 404;
11724
+ this.view.setUint32(offset, value, true);
10709
11725
  }
10710
- set max_mark_age_ns(value) {
10711
- this.set_max_mark_age_ns(value);
11726
+ get reserved3() {
11727
+ return this.get_reserved3();
10712
11728
  }
10713
- get_reserved2() {
10714
- const offset = 296;
11729
+ set reserved3(value) {
11730
+ this.set_reserved3(value);
11731
+ }
11732
+ get_reserved4() {
11733
+ const offset = 408;
10715
11734
  const result = [];
10716
- for (let i = 0; i < 24; i++) {
11735
+ for (let i = 0; i < 40; i++) {
10717
11736
  result.push(this.view.getUint8(offset + i * 1));
10718
11737
  }
10719
11738
  return result;
10720
11739
  }
10721
- set_reserved2(value) {
10722
- const offset = 296;
10723
- if (value.length !== 24) {
10724
- throw new Error("Array length must be 24");
11740
+ set_reserved4(value) {
11741
+ const offset = 408;
11742
+ if (value.length !== 40) {
11743
+ throw new Error("Array length must be 40");
10725
11744
  }
10726
- for (let i = 0; i < 24; i++) {
11745
+ for (let i = 0; i < 40; i++) {
10727
11746
  this.view.setUint8(offset + i * 1, value[i]);
10728
11747
  }
10729
11748
  }
10730
- get reserved2() {
10731
- return this.get_reserved2();
11749
+ get reserved4() {
11750
+ return this.get_reserved4();
10732
11751
  }
10733
- set reserved2(value) {
10734
- this.set_reserved2(value);
11752
+ set reserved4(value) {
11753
+ this.set_reserved4(value);
10735
11754
  }
10736
11755
  static __tnFootprintInternal(__tnParams) {
10737
11756
  return __tnEvalFootprint2(__tn_ir_MarketAccount.root, { params: __tnParams });
@@ -10757,8 +11776,8 @@ var MarketAccount = class _MarketAccount {
10757
11776
  return __tnBigIntToNumber2(irResult, "MarketAccount::footprint");
10758
11777
  }
10759
11778
  static validate(buffer, _opts) {
10760
- if (buffer.length < 320) return { ok: false, code: "tn.buffer_too_small", consumed: 320 };
10761
- return { ok: true, consumed: 320 };
11779
+ if (buffer.length < 448) return { ok: false, code: "tn.buffer_too_small", consumed: 448 };
11780
+ return { ok: true, consumed: 448 };
10762
11781
  }
10763
11782
  static from_array(buffer) {
10764
11783
  if (!buffer || buffer.length === void 0) {
@@ -10774,7 +11793,7 @@ var MarketAccount = class _MarketAccount {
10774
11793
  };
10775
11794
  var MarketAccountBuilder = class {
10776
11795
  constructor() {
10777
- this.buffer = new Uint8Array(320);
11796
+ this.buffer = new Uint8Array(448);
10778
11797
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
10779
11798
  }
10780
11799
  set_magic(value) {
@@ -10901,6 +11920,78 @@ var MarketAccountBuilder = class {
10901
11920
  }
10902
11921
  return this;
10903
11922
  }
11923
+ set_funding_index_lo(value) {
11924
+ const cast = __tnToBigInt2(value);
11925
+ this.view.setBigUint64(320, cast, true);
11926
+ return this;
11927
+ }
11928
+ set_funding_index_hi(value) {
11929
+ const cast = __tnToBigInt2(value);
11930
+ this.view.setBigUint64(328, cast, true);
11931
+ return this;
11932
+ }
11933
+ set_funding_balance(value) {
11934
+ const cast = __tnToBigInt2(value);
11935
+ this.view.setBigInt64(336, cast, true);
11936
+ return this;
11937
+ }
11938
+ set_funding_last_round_ns(value) {
11939
+ const cast = __tnToBigInt2(value);
11940
+ this.view.setBigUint64(344, cast, true);
11941
+ return this;
11942
+ }
11943
+ set_funding_last_sample_ns(value) {
11944
+ const cast = __tnToBigInt2(value);
11945
+ this.view.setBigUint64(352, cast, true);
11946
+ return this;
11947
+ }
11948
+ set_funding_premium_sum(value) {
11949
+ const cast = __tnToBigInt2(value);
11950
+ this.view.setBigInt64(360, cast, true);
11951
+ return this;
11952
+ }
11953
+ set_funding_impact_notional(value) {
11954
+ const cast = __tnToBigInt2(value);
11955
+ this.view.setBigUint64(368, cast, true);
11956
+ return this;
11957
+ }
11958
+ set_funding_rate(value) {
11959
+ const cast = __tnToBigInt2(value);
11960
+ this.view.setBigInt64(376, cast, true);
11961
+ return this;
11962
+ }
11963
+ set_funding_interest_rate(value) {
11964
+ this.view.setUint32(384, value, true);
11965
+ return this;
11966
+ }
11967
+ set_funding_clamp_small(value) {
11968
+ this.view.setUint32(388, value, true);
11969
+ return this;
11970
+ }
11971
+ set_funding_clamp_big(value) {
11972
+ this.view.setUint32(392, value, true);
11973
+ return this;
11974
+ }
11975
+ set_funding_premium_multiplier(value) {
11976
+ this.view.setUint32(396, value, true);
11977
+ return this;
11978
+ }
11979
+ set_funding_sample_cnt(value) {
11980
+ this.view.setUint32(400, value, true);
11981
+ return this;
11982
+ }
11983
+ set_reserved3(value) {
11984
+ this.view.setUint32(404, value, true);
11985
+ return this;
11986
+ }
11987
+ set_reserved4(values) {
11988
+ if (values.length !== 40) throw new Error("reserved4 expects 40 elements");
11989
+ for (let i = 0; i < values.length; i++) {
11990
+ const byteOffset = 408 + i * 1;
11991
+ this.view.setUint8(byteOffset, values[i]);
11992
+ }
11993
+ return this;
11994
+ }
10904
11995
  build() {
10905
11996
  return this.buffer.slice();
10906
11997
  }
@@ -10924,7 +12015,7 @@ __tnRegisterDynamicValidate2("MarketAccount", (buffer) => {
10924
12015
  });
10925
12016
  var __tn_ir_MarketAccountPayload = {
10926
12017
  typeName: "MarketAccountPayload",
10927
- root: { op: "const", value: 319n }
12018
+ root: { op: "const", value: 447n }
10928
12019
  };
10929
12020
  var MarketAccountPayload = class _MarketAccountPayload {
10930
12021
  constructor(buffer) {
@@ -11308,6 +12399,225 @@ var MarketAccountPayload = class _MarketAccountPayload {
11308
12399
  set reserved2(value) {
11309
12400
  this.set_reserved2(value);
11310
12401
  }
12402
+ get_funding_index_lo() {
12403
+ const offset = 319;
12404
+ return this.view.getBigUint64(offset, true);
12405
+ }
12406
+ set_funding_index_lo(value) {
12407
+ const offset = 319;
12408
+ this.view.setBigUint64(offset, value, true);
12409
+ }
12410
+ get funding_index_lo() {
12411
+ return this.get_funding_index_lo();
12412
+ }
12413
+ set funding_index_lo(value) {
12414
+ this.set_funding_index_lo(value);
12415
+ }
12416
+ get_funding_index_hi() {
12417
+ const offset = 327;
12418
+ return this.view.getBigUint64(offset, true);
12419
+ }
12420
+ set_funding_index_hi(value) {
12421
+ const offset = 327;
12422
+ this.view.setBigUint64(offset, value, true);
12423
+ }
12424
+ get funding_index_hi() {
12425
+ return this.get_funding_index_hi();
12426
+ }
12427
+ set funding_index_hi(value) {
12428
+ this.set_funding_index_hi(value);
12429
+ }
12430
+ get_funding_balance() {
12431
+ const offset = 335;
12432
+ return this.view.getBigInt64(offset, true);
12433
+ }
12434
+ set_funding_balance(value) {
12435
+ const offset = 335;
12436
+ this.view.setBigInt64(offset, value, true);
12437
+ }
12438
+ get funding_balance() {
12439
+ return this.get_funding_balance();
12440
+ }
12441
+ set funding_balance(value) {
12442
+ this.set_funding_balance(value);
12443
+ }
12444
+ get_funding_last_round_ns() {
12445
+ const offset = 343;
12446
+ return this.view.getBigUint64(offset, true);
12447
+ }
12448
+ set_funding_last_round_ns(value) {
12449
+ const offset = 343;
12450
+ this.view.setBigUint64(offset, value, true);
12451
+ }
12452
+ get funding_last_round_ns() {
12453
+ return this.get_funding_last_round_ns();
12454
+ }
12455
+ set funding_last_round_ns(value) {
12456
+ this.set_funding_last_round_ns(value);
12457
+ }
12458
+ get_funding_last_sample_ns() {
12459
+ const offset = 351;
12460
+ return this.view.getBigUint64(offset, true);
12461
+ }
12462
+ set_funding_last_sample_ns(value) {
12463
+ const offset = 351;
12464
+ this.view.setBigUint64(offset, value, true);
12465
+ }
12466
+ get funding_last_sample_ns() {
12467
+ return this.get_funding_last_sample_ns();
12468
+ }
12469
+ set funding_last_sample_ns(value) {
12470
+ this.set_funding_last_sample_ns(value);
12471
+ }
12472
+ get_funding_premium_sum() {
12473
+ const offset = 359;
12474
+ return this.view.getBigInt64(offset, true);
12475
+ }
12476
+ set_funding_premium_sum(value) {
12477
+ const offset = 359;
12478
+ this.view.setBigInt64(offset, value, true);
12479
+ }
12480
+ get funding_premium_sum() {
12481
+ return this.get_funding_premium_sum();
12482
+ }
12483
+ set funding_premium_sum(value) {
12484
+ this.set_funding_premium_sum(value);
12485
+ }
12486
+ get_funding_impact_notional() {
12487
+ const offset = 367;
12488
+ return this.view.getBigUint64(offset, true);
12489
+ }
12490
+ set_funding_impact_notional(value) {
12491
+ const offset = 367;
12492
+ this.view.setBigUint64(offset, value, true);
12493
+ }
12494
+ get funding_impact_notional() {
12495
+ return this.get_funding_impact_notional();
12496
+ }
12497
+ set funding_impact_notional(value) {
12498
+ this.set_funding_impact_notional(value);
12499
+ }
12500
+ get_funding_rate() {
12501
+ const offset = 375;
12502
+ return this.view.getBigInt64(offset, true);
12503
+ }
12504
+ set_funding_rate(value) {
12505
+ const offset = 375;
12506
+ this.view.setBigInt64(offset, value, true);
12507
+ }
12508
+ get funding_rate() {
12509
+ return this.get_funding_rate();
12510
+ }
12511
+ set funding_rate(value) {
12512
+ this.set_funding_rate(value);
12513
+ }
12514
+ get_funding_interest_rate() {
12515
+ const offset = 383;
12516
+ return this.view.getUint32(offset, true);
12517
+ }
12518
+ set_funding_interest_rate(value) {
12519
+ const offset = 383;
12520
+ this.view.setUint32(offset, value, true);
12521
+ }
12522
+ get funding_interest_rate() {
12523
+ return this.get_funding_interest_rate();
12524
+ }
12525
+ set funding_interest_rate(value) {
12526
+ this.set_funding_interest_rate(value);
12527
+ }
12528
+ get_funding_clamp_small() {
12529
+ const offset = 387;
12530
+ return this.view.getUint32(offset, true);
12531
+ }
12532
+ set_funding_clamp_small(value) {
12533
+ const offset = 387;
12534
+ this.view.setUint32(offset, value, true);
12535
+ }
12536
+ get funding_clamp_small() {
12537
+ return this.get_funding_clamp_small();
12538
+ }
12539
+ set funding_clamp_small(value) {
12540
+ this.set_funding_clamp_small(value);
12541
+ }
12542
+ get_funding_clamp_big() {
12543
+ const offset = 391;
12544
+ return this.view.getUint32(offset, true);
12545
+ }
12546
+ set_funding_clamp_big(value) {
12547
+ const offset = 391;
12548
+ this.view.setUint32(offset, value, true);
12549
+ }
12550
+ get funding_clamp_big() {
12551
+ return this.get_funding_clamp_big();
12552
+ }
12553
+ set funding_clamp_big(value) {
12554
+ this.set_funding_clamp_big(value);
12555
+ }
12556
+ get_funding_premium_multiplier() {
12557
+ const offset = 395;
12558
+ return this.view.getUint32(offset, true);
12559
+ }
12560
+ set_funding_premium_multiplier(value) {
12561
+ const offset = 395;
12562
+ this.view.setUint32(offset, value, true);
12563
+ }
12564
+ get funding_premium_multiplier() {
12565
+ return this.get_funding_premium_multiplier();
12566
+ }
12567
+ set funding_premium_multiplier(value) {
12568
+ this.set_funding_premium_multiplier(value);
12569
+ }
12570
+ get_funding_sample_cnt() {
12571
+ const offset = 399;
12572
+ return this.view.getUint32(offset, true);
12573
+ }
12574
+ set_funding_sample_cnt(value) {
12575
+ const offset = 399;
12576
+ this.view.setUint32(offset, value, true);
12577
+ }
12578
+ get funding_sample_cnt() {
12579
+ return this.get_funding_sample_cnt();
12580
+ }
12581
+ set funding_sample_cnt(value) {
12582
+ this.set_funding_sample_cnt(value);
12583
+ }
12584
+ get_reserved3() {
12585
+ const offset = 403;
12586
+ return this.view.getUint32(offset, true);
12587
+ }
12588
+ set_reserved3(value) {
12589
+ const offset = 403;
12590
+ this.view.setUint32(offset, value, true);
12591
+ }
12592
+ get reserved3() {
12593
+ return this.get_reserved3();
12594
+ }
12595
+ set reserved3(value) {
12596
+ this.set_reserved3(value);
12597
+ }
12598
+ get_reserved4() {
12599
+ const offset = 407;
12600
+ const result = [];
12601
+ for (let i = 0; i < 40; i++) {
12602
+ result.push(this.view.getUint8(offset + i * 1));
12603
+ }
12604
+ return result;
12605
+ }
12606
+ set_reserved4(value) {
12607
+ const offset = 407;
12608
+ if (value.length !== 40) {
12609
+ throw new Error("Array length must be 40");
12610
+ }
12611
+ for (let i = 0; i < 40; i++) {
12612
+ this.view.setUint8(offset + i * 1, value[i]);
12613
+ }
12614
+ }
12615
+ get reserved4() {
12616
+ return this.get_reserved4();
12617
+ }
12618
+ set reserved4(value) {
12619
+ this.set_reserved4(value);
12620
+ }
11311
12621
  static __tnFootprintInternal(__tnParams) {
11312
12622
  return __tnEvalFootprint2(__tn_ir_MarketAccountPayload.root, { params: __tnParams });
11313
12623
  }
@@ -11332,8 +12642,8 @@ var MarketAccountPayload = class _MarketAccountPayload {
11332
12642
  return __tnBigIntToNumber2(irResult, "MarketAccountPayload::footprint");
11333
12643
  }
11334
12644
  static validate(buffer, _opts) {
11335
- if (buffer.length < 319) return { ok: false, code: "tn.buffer_too_small", consumed: 319 };
11336
- return { ok: true, consumed: 319 };
12645
+ if (buffer.length < 447) return { ok: false, code: "tn.buffer_too_small", consumed: 447 };
12646
+ return { ok: true, consumed: 447 };
11337
12647
  }
11338
12648
  static from_array(buffer) {
11339
12649
  if (!buffer || buffer.length === void 0) {
@@ -11349,7 +12659,7 @@ var MarketAccountPayload = class _MarketAccountPayload {
11349
12659
  };
11350
12660
  var MarketAccountPayloadBuilder = class {
11351
12661
  constructor() {
11352
- this.buffer = new Uint8Array(319);
12662
+ this.buffer = new Uint8Array(447);
11353
12663
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
11354
12664
  }
11355
12665
  set_status_flags(value) {
@@ -11472,6 +12782,78 @@ var MarketAccountPayloadBuilder = class {
11472
12782
  }
11473
12783
  return this;
11474
12784
  }
12785
+ set_funding_index_lo(value) {
12786
+ const cast = __tnToBigInt2(value);
12787
+ this.view.setBigUint64(319, cast, true);
12788
+ return this;
12789
+ }
12790
+ set_funding_index_hi(value) {
12791
+ const cast = __tnToBigInt2(value);
12792
+ this.view.setBigUint64(327, cast, true);
12793
+ return this;
12794
+ }
12795
+ set_funding_balance(value) {
12796
+ const cast = __tnToBigInt2(value);
12797
+ this.view.setBigInt64(335, cast, true);
12798
+ return this;
12799
+ }
12800
+ set_funding_last_round_ns(value) {
12801
+ const cast = __tnToBigInt2(value);
12802
+ this.view.setBigUint64(343, cast, true);
12803
+ return this;
12804
+ }
12805
+ set_funding_last_sample_ns(value) {
12806
+ const cast = __tnToBigInt2(value);
12807
+ this.view.setBigUint64(351, cast, true);
12808
+ return this;
12809
+ }
12810
+ set_funding_premium_sum(value) {
12811
+ const cast = __tnToBigInt2(value);
12812
+ this.view.setBigInt64(359, cast, true);
12813
+ return this;
12814
+ }
12815
+ set_funding_impact_notional(value) {
12816
+ const cast = __tnToBigInt2(value);
12817
+ this.view.setBigUint64(367, cast, true);
12818
+ return this;
12819
+ }
12820
+ set_funding_rate(value) {
12821
+ const cast = __tnToBigInt2(value);
12822
+ this.view.setBigInt64(375, cast, true);
12823
+ return this;
12824
+ }
12825
+ set_funding_interest_rate(value) {
12826
+ this.view.setUint32(383, value, true);
12827
+ return this;
12828
+ }
12829
+ set_funding_clamp_small(value) {
12830
+ this.view.setUint32(387, value, true);
12831
+ return this;
12832
+ }
12833
+ set_funding_clamp_big(value) {
12834
+ this.view.setUint32(391, value, true);
12835
+ return this;
12836
+ }
12837
+ set_funding_premium_multiplier(value) {
12838
+ this.view.setUint32(395, value, true);
12839
+ return this;
12840
+ }
12841
+ set_funding_sample_cnt(value) {
12842
+ this.view.setUint32(399, value, true);
12843
+ return this;
12844
+ }
12845
+ set_reserved3(value) {
12846
+ this.view.setUint32(403, value, true);
12847
+ return this;
12848
+ }
12849
+ set_reserved4(values) {
12850
+ if (values.length !== 40) throw new Error("reserved4 expects 40 elements");
12851
+ for (let i = 0; i < values.length; i++) {
12852
+ const byteOffset = 407 + i * 1;
12853
+ this.view.setUint8(byteOffset, values[i]);
12854
+ }
12855
+ return this;
12856
+ }
11475
12857
  build() {
11476
12858
  return this.buffer.slice();
11477
12859
  }
@@ -13840,7 +15222,7 @@ __tnRegisterDynamicValidate2("OrderPostedEvent", (buffer) => {
13840
15222
  });
13841
15223
  var __tn_ir_PerpEvent = {
13842
15224
  typeName: "PerpEvent",
13843
- root: { op: "align", alignment: 1, node: { op: "add", left: { op: "align", alignment: 8, node: { op: "const", value: 8n } }, right: { op: "align", alignment: 1, node: { op: "switch", tag: "PerpEvent::payload.event_type", cases: [{ value: 1, node: { op: "align", alignment: 1, node: { op: "const", value: 68n } } }, { value: 2, node: { op: "align", alignment: 1, node: { op: "const", value: 104n } } }, { value: 3, node: { op: "align", alignment: 1, node: { op: "const", value: 256n } } }, { value: 4, node: { op: "align", alignment: 1, node: { op: "const", value: 180n } } }, { value: 5, node: { op: "align", alignment: 1, node: { op: "const", value: 112n } } }, { value: 6, node: { op: "align", alignment: 1, node: { op: "const", value: 112n } } }, { value: 7, node: { op: "align", alignment: 1, node: { op: "const", value: 120n } } }, { value: 8, node: { op: "align", alignment: 1, node: { op: "const", value: 168n } } }, { value: 9, node: { op: "align", alignment: 1, node: { op: "const", value: 168n } } }, { value: 10, node: { op: "align", alignment: 1, node: { op: "const", value: 72n } } }, { value: 11, node: { op: "align", alignment: 1, node: { op: "const", value: 104n } } }, { value: 12, node: { op: "align", alignment: 1, node: { op: "const", value: 72n } } }, { value: 13, node: { op: "align", alignment: 1, node: { op: "const", value: 136n } } }, { value: 14, node: { op: "align", alignment: 1, node: { op: "const", value: 72n } } }, { value: 15, node: { op: "align", alignment: 1, node: { op: "const", value: 160n } } }] } } } }
15225
+ root: { op: "align", alignment: 1, node: { op: "add", left: { op: "align", alignment: 8, node: { op: "const", value: 8n } }, right: { op: "align", alignment: 1, node: { op: "switch", tag: "PerpEvent::payload.event_type", cases: [{ value: 1, node: { op: "align", alignment: 1, node: { op: "const", value: 68n } } }, { value: 2, node: { op: "align", alignment: 1, node: { op: "const", value: 104n } } }, { value: 3, node: { op: "align", alignment: 1, node: { op: "const", value: 256n } } }, { value: 4, node: { op: "align", alignment: 1, node: { op: "const", value: 180n } } }, { value: 5, node: { op: "align", alignment: 1, node: { op: "const", value: 112n } } }, { value: 6, node: { op: "align", alignment: 1, node: { op: "const", value: 112n } } }, { value: 7, node: { op: "align", alignment: 1, node: { op: "const", value: 120n } } }, { value: 8, node: { op: "align", alignment: 1, node: { op: "const", value: 168n } } }, { value: 9, node: { op: "align", alignment: 1, node: { op: "const", value: 168n } } }, { value: 10, node: { op: "align", alignment: 1, node: { op: "const", value: 72n } } }, { value: 11, node: { op: "align", alignment: 1, node: { op: "const", value: 104n } } }, { value: 12, node: { op: "align", alignment: 1, node: { op: "const", value: 72n } } }, { value: 13, node: { op: "align", alignment: 1, node: { op: "const", value: 136n } } }, { value: 14, node: { op: "align", alignment: 1, node: { op: "const", value: 72n } } }, { value: 15, node: { op: "align", alignment: 1, node: { op: "const", value: 160n } } }, { value: 16, node: { op: "align", alignment: 1, node: { op: "const", value: 88n } } }] } } } }
13844
15226
  };
13845
15227
  var PerpEvent_payload_Inner = class _PerpEvent_payload_Inner {
13846
15228
  constructor(buffer, descriptor, fieldContext) {
@@ -13919,6 +15301,10 @@ var PerpEvent_payload_Inner = class _PerpEvent_payload_Inner {
13919
15301
  if (!this.descriptor || this.descriptor.tag !== 15) return null;
13920
15302
  return LiquidationEvent.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
13921
15303
  }
15304
+ asFundingRound() {
15305
+ if (!this.descriptor || this.descriptor.tag !== 16) return null;
15306
+ return FundingRoundEvent.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
15307
+ }
13922
15308
  };
13923
15309
  var _PerpEvent = class _PerpEvent {
13924
15310
  constructor(buffer, params) {
@@ -14181,6 +15567,13 @@ _PerpEvent.payloadVariantDescriptors = Object.freeze([
14181
15567
  payloadSize: 160,
14182
15568
  payloadType: "PerpEvent::payload::liquidation",
14183
15569
  createPayloadBuilder: () => __tnMaybeCallBuilder(LiquidationEvent)
15570
+ },
15571
+ {
15572
+ name: "funding_round",
15573
+ tag: 16,
15574
+ payloadSize: 88,
15575
+ payloadType: "PerpEvent::payload::funding_round",
15576
+ createPayloadBuilder: () => __tnMaybeCallBuilder(FundingRoundEvent)
14184
15577
  }
14185
15578
  ]);
14186
15579
  var PerpEvent = _PerpEvent;
@@ -14397,6 +15790,18 @@ var PerpInstruction_payload_Inner = class _PerpInstruction_payload_Inner {
14397
15790
  if (!this.descriptor || this.descriptor.tag !== 17) return null;
14398
15791
  return MarketSetOracleInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
14399
15792
  }
15793
+ asFundingUpdate() {
15794
+ if (!this.descriptor || this.descriptor.tag !== 18) return null;
15795
+ return FundingUpdateInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
15796
+ }
15797
+ asMarketSetFunding() {
15798
+ if (!this.descriptor || this.descriptor.tag !== 19) return null;
15799
+ return MarketSetFundingInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
15800
+ }
15801
+ asSettleFunding() {
15802
+ if (!this.descriptor || this.descriptor.tag !== 20) return null;
15803
+ return SettleFundingInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
15804
+ }
14400
15805
  };
14401
15806
  var _PerpInstruction = class _PerpInstruction {
14402
15807
  constructor(buffer, params) {
@@ -14478,6 +15883,12 @@ var _PerpInstruction = class _PerpInstruction {
14478
15883
  break;
14479
15884
  case 17:
14480
15885
  break;
15886
+ case 18:
15887
+ break;
15888
+ case 19:
15889
+ break;
15890
+ case 20:
15891
+ break;
14481
15892
  default:
14482
15893
  return null;
14483
15894
  }
@@ -14721,6 +16132,27 @@ _PerpInstruction.payloadVariantDescriptors = Object.freeze([
14721
16132
  payloadSize: 39,
14722
16133
  payloadType: "PerpInstruction::payload::market_set_oracle",
14723
16134
  createPayloadBuilder: () => __tnMaybeCallBuilder(MarketSetOracleInstruction)
16135
+ },
16136
+ {
16137
+ name: "funding_update",
16138
+ tag: 18,
16139
+ payloadSize: 7,
16140
+ payloadType: "PerpInstruction::payload::funding_update",
16141
+ createPayloadBuilder: () => __tnMaybeCallBuilder(FundingUpdateInstruction)
16142
+ },
16143
+ {
16144
+ name: "market_set_funding",
16145
+ tag: 19,
16146
+ payloadSize: 31,
16147
+ payloadType: "PerpInstruction::payload::market_set_funding",
16148
+ createPayloadBuilder: () => __tnMaybeCallBuilder(MarketSetFundingInstruction)
16149
+ },
16150
+ {
16151
+ name: "settle_funding",
16152
+ tag: 20,
16153
+ payloadSize: 7,
16154
+ payloadType: "PerpInstruction::payload::settle_funding",
16155
+ createPayloadBuilder: () => __tnMaybeCallBuilder(SettleFundingInstruction)
14724
16156
  }
14725
16157
  ]);
14726
16158
  var PerpInstruction = _PerpInstruction;
@@ -14864,7 +16296,7 @@ __tnRegisterDynamicValidate2("PerpInstruction", (buffer) => {
14864
16296
  });
14865
16297
  var __tn_ir_PerpProgramAccount = {
14866
16298
  typeName: "PerpProgramAccount",
14867
- root: { op: "align", alignment: 1, node: { op: "add", left: { op: "align", alignment: 1, node: { op: "const", value: 1n } }, right: { op: "align", alignment: 1, node: { op: "switch", tag: "PerpProgramAccount::payload.account_tag", cases: [{ value: 121, node: { op: "align", alignment: 1, node: { op: "const", value: 319n } } }, { value: 120, node: { op: "align", alignment: 1, node: { op: "const", value: 95n } } }] } } } }
16299
+ root: { op: "align", alignment: 1, node: { op: "add", left: { op: "align", alignment: 1, node: { op: "const", value: 1n } }, right: { op: "align", alignment: 1, node: { op: "switch", tag: "PerpProgramAccount::payload.account_tag", cases: [{ value: 121, node: { op: "align", alignment: 1, node: { op: "const", value: 447n } } }, { value: 120, node: { op: "align", alignment: 1, node: { op: "const", value: 95n } } }] } } } }
14868
16300
  };
14869
16301
  var PerpProgramAccount_payload_Inner = class _PerpProgramAccount_payload_Inner {
14870
16302
  constructor(buffer, descriptor, fieldContext) {
@@ -15052,7 +16484,7 @@ _PerpProgramAccount.payloadVariantDescriptors = Object.freeze([
15052
16484
  {
15053
16485
  name: "market",
15054
16486
  tag: 121,
15055
- payloadSize: 319,
16487
+ payloadSize: 447,
15056
16488
  payloadType: "PerpProgramAccount::payload::market",
15057
16489
  createPayloadBuilder: () => __tnMaybeCallBuilder(MarketAccountPayload)
15058
16490
  },
@@ -15199,7 +16631,7 @@ __tnRegisterDynamicValidate2("PerpProgramAccount", (buffer) => {
15199
16631
  });
15200
16632
  var __tn_ir_SeatArenaAccount = {
15201
16633
  typeName: "SeatArenaAccount",
15202
- root: { op: "align", alignment: 1, node: { op: "add", left: { op: "add", left: { op: "add", left: { op: "align", alignment: 1, node: { op: "const", value: 320n } }, right: { op: "align", alignment: 1, node: { op: "const", value: 192n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 128n } } }, right: { op: "align", alignment: 1, node: { op: "mul", left: { op: "div", left: { op: "sub", left: { op: "field", param: "__buffer_size" }, right: { op: "const", value: 640n } }, right: { op: "const", value: 128n } }, right: { op: "const", value: 128n } } } } }
16634
+ root: { op: "align", alignment: 1, node: { op: "add", left: { op: "add", left: { op: "add", left: { op: "align", alignment: 1, node: { op: "const", value: 448n } }, right: { op: "align", alignment: 1, node: { op: "const", value: 64n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 128n } } }, right: { op: "align", alignment: 1, node: { op: "mul", left: { op: "div", left: { op: "sub", left: { op: "field", param: "__buffer_size" }, right: { op: "const", value: 640n } }, right: { op: "const", value: 128n } }, right: { op: "const", value: 128n } } } } }
15203
16635
  };
15204
16636
  var SeatArenaAccount = class _SeatArenaAccount {
15205
16637
  constructor(buffer, fieldContext) {
@@ -15231,7 +16663,7 @@ var SeatArenaAccount = class _SeatArenaAccount {
15231
16663
  }
15232
16664
  get_market() {
15233
16665
  const offset = 0;
15234
- const slice = this.buffer.subarray(offset, offset + 320);
16666
+ const slice = this.buffer.subarray(offset, offset + 448);
15235
16667
  return MarketAccount.from_array(slice);
15236
16668
  }
15237
16669
  set_market(value) {
@@ -15246,19 +16678,19 @@ var SeatArenaAccount = class _SeatArenaAccount {
15246
16678
  this.set_market(value);
15247
16679
  }
15248
16680
  get_reserved_market_padding() {
15249
- const offset = 320;
16681
+ const offset = 448;
15250
16682
  const result = [];
15251
- for (let i = 0; i < 192; i++) {
16683
+ for (let i = 0; i < 64; i++) {
15252
16684
  result.push(this.view.getUint8(offset + i * 1));
15253
16685
  }
15254
16686
  return result;
15255
16687
  }
15256
16688
  set_reserved_market_padding(value) {
15257
- const offset = 320;
15258
- if (value.length !== 192) {
15259
- throw new Error("Array length must be 192");
16689
+ const offset = 448;
16690
+ if (value.length !== 64) {
16691
+ throw new Error("Array length must be 64");
15260
16692
  }
15261
- for (let i = 0; i < 192; i++) {
16693
+ for (let i = 0; i < 64; i++) {
15262
16694
  this.view.setUint8(offset + i * 1, value[i]);
15263
16695
  }
15264
16696
  }
@@ -15390,6 +16822,9 @@ var PERP_INSTRUCTION_EXCHANGE_RECOVER_ADMIN = 14;
15390
16822
  var PERP_INSTRUCTION_MARKET_SET_EXCHANGE_STATUS = 15;
15391
16823
  var PERP_INSTRUCTION_LIQUIDATE = 16;
15392
16824
  var PERP_INSTRUCTION_MARKET_SET_ORACLE = 17;
16825
+ var PERP_INSTRUCTION_FUNDING_UPDATE = 18;
16826
+ var PERP_INSTRUCTION_MARKET_SET_FUNDING = 19;
16827
+ var PERP_INSTRUCTION_SETTLE_FUNDING = 20;
15393
16828
  var PERP_DEFAULT_MARKET_RECORD_INDEX = 1;
15394
16829
  var PERP_ERR_PRICE_ABOVE_CAP = -205n;
15395
16830
  var PERP_ERR_INVALID_PRICE_CAP = -206n;
@@ -15403,6 +16838,9 @@ var PERP_ERR_ORACLE_STALE = -213n;
15403
16838
  var PERP_ERR_INVALID_MARGIN_PARAMS = -214n;
15404
16839
  var PERP_ERR_NOT_LIQUIDATABLE = -215n;
15405
16840
  var PERP_ERR_SELF_LIQUIDATION = -216n;
16841
+ var PERP_ERR_FUNDING_DISABLED = -217n;
16842
+ var PERP_ERR_INVALID_FUNDING_PARAMS = -218n;
16843
+ var PERP_ERR_FUNDING_UPDATE_NOT_ALONE = -219n;
15406
16844
  var PERP_ERR_INSUFFICIENT_COLLATERAL = -403n;
15407
16845
  var PERP_ERR_INSUFFICIENT_FUNDS_QUOTE = -401n;
15408
16846
  var PERP_EVENT_SEAT_ASSIGNED = 1;
@@ -15420,6 +16858,7 @@ var PERP_EVENT_EXCHANGE_STATUS = 12;
15420
16858
  var PERP_EVENT_EXCHANGE_ADMIN = 13;
15421
16859
  var PERP_EVENT_MARKET_EXCHANGE_STATUS = 14;
15422
16860
  var PERP_EVENT_LIQUIDATION = 15;
16861
+ var PERP_EVENT_FUNDING_ROUND = 16;
15423
16862
  var PERP_BPS_DENOMINATOR = 10000n;
15424
16863
  var PERP_EVENT_SIDE_BUY = EVENT_SIDE_BUY;
15425
16864
  var PERP_EVENT_SIDE_SELL = EVENT_SIDE_SELL;
@@ -15443,7 +16882,15 @@ var PERP_MODIFY_FLAG_FAIL_IF_OUT_OF_RANGE = 1 << 0;
15443
16882
  var PERP_MODIFY_FLAG_HAS_CLIENT_ID = 1 << 1;
15444
16883
  var PERP_MODIFY_FLAG_HAS_ORDER_ID = 1 << 2;
15445
16884
  var PERP_MARKET_MAGIC = 121;
15446
- var PERP_MARKET_ACCOUNT_SIZE = 320;
16885
+ var PERP_MARKET_ACCOUNT_SIZE = 448;
16886
+ var PERP_FUNDING_RATE_TICK = 1000000n;
16887
+ var PERP_FUNDING_SAMPLE_NS = 60000000000n;
16888
+ var PERP_FUNDING_ROUND_NS = 3600000000000n;
16889
+ var PERP_FUNDING_PREMIUM_DIVISOR = 60n;
16890
+ var PERP_FUNDING_HOURS_PER_RATE = 8n;
16891
+ var PERP_FUNDING_PARAM_MAX = 1e6;
16892
+ var PERP_FUNDING_MULTIPLIER_ONE = 100;
16893
+ var PERP_FUNDING_PREMIUM_MAX = 1000000n;
15447
16894
  var PERP_SEAT_MANAGER_RESERVED_SIZE = 512;
15448
16895
  var PERP_EXCHANGE_META_ACCOUNT_SIZE = 96;
15449
16896
  var PERP_EXCHANGE_META_MAGIC = 0xf17eda2c9e290078n;
@@ -15585,6 +17032,82 @@ function perpMaxSellLots(market, seat, price, mark) {
15585
17032
  const capacity = maxBig(market.maxPositionLots - seat.shortLots - seat.openAskLots, 0n);
15586
17033
  return seat.longLots + minBig(capacity, affordableLots(market, seat, price, mark));
15587
17034
  }
17035
+ function perpFundingEnabled(market) {
17036
+ return (market.funding?.premiumMultiplier ?? 0) !== 0;
17037
+ }
17038
+ function perpFundingHourlyRate(premiumSum, params) {
17039
+ const one = BigInt(PERP_FUNDING_MULTIPLIER_ONE);
17040
+ const multiplier = BigInt(params.premiumMultiplier);
17041
+ const avg = premiumSum / PERP_FUNDING_PREMIUM_DIVISOR * multiplier / one;
17042
+ const small = BigInt(params.clampSmall) * multiplier / one;
17043
+ const big = BigInt(params.clampBig);
17044
+ const r8 = clampBig(avg + clampBig(BigInt(params.interestRate) - avg, -small, small), -big, big);
17045
+ return r8 / PERP_FUNDING_HOURS_PER_RATE;
17046
+ }
17047
+ function perpFundingPremiumSample(index, impactBid, impactAsk) {
17048
+ if (index <= 0n) return 0n;
17049
+ const bid = impactBid > 0n ? impactBid : index;
17050
+ const ask = impactAsk > 0n ? impactAsk : index;
17051
+ const above = bid > index ? bid - index : 0n;
17052
+ const below = ask < index ? index - ask : 0n;
17053
+ return clampBig((above - below) * PERP_FUNDING_RATE_TICK / index, -PERP_FUNDING_PREMIUM_MAX, PERP_FUNDING_PREMIUM_MAX);
17054
+ }
17055
+ function perpFundingParamsProblem(market, params) {
17056
+ const { interestRate, clampSmall, clampBig: big, premiumMultiplier, impactNotional } = params;
17057
+ if (!Number.isInteger(premiumMultiplier) || premiumMultiplier < 0 || premiumMultiplier > PERP_FUNDING_MULTIPLIER_ONE) {
17058
+ return `premiumMultiplier must be 0 (off) or 1..${PERP_FUNDING_MULTIPLIER_ONE}`;
17059
+ }
17060
+ if (premiumMultiplier === 0) return null;
17061
+ if (impactNotional <= 0n) return "impactNotional must be positive";
17062
+ for (const [label, value] of [["interestRate", interestRate], ["clampSmall", clampSmall], ["clampBig", big]]) {
17063
+ if (!Number.isInteger(value) || value < 0 || value > PERP_FUNDING_PARAM_MAX) return `${label} must be 0..${PERP_FUNDING_PARAM_MAX}`;
17064
+ }
17065
+ const gapTicks = (market.initialMarginBps - market.maintenanceMarginBps) * 100;
17066
+ const hourlyCap = Math.floor(big / Number(PERP_FUNDING_HOURS_PER_RATE));
17067
+ if (hourlyCap > gapTicks) {
17068
+ return `clampBig / ${PERP_FUNDING_HOURS_PER_RATE} (${hourlyCap} ticks per hour) exceeds the initial - maintenance margin gap (${gapTicks} ticks)`;
17069
+ }
17070
+ return null;
17071
+ }
17072
+ function perpFundingMaxClampBig(market) {
17073
+ const gapTicks = Math.max(market.initialMarginBps - market.maintenanceMarginBps, 0) * 100;
17074
+ return Math.min(gapTicks * Number(PERP_FUNDING_HOURS_PER_RATE), PERP_FUNDING_PARAM_MAX);
17075
+ }
17076
+ function perpNextFundingRoundNs(funding) {
17077
+ return (funding.lastRoundNs / PERP_FUNDING_ROUND_NS + 1n) * PERP_FUNDING_ROUND_NS;
17078
+ }
17079
+ function perpFundingRoundDue(funding, nowNs) {
17080
+ return nowNs / PERP_FUNDING_ROUND_NS > funding.lastRoundNs / PERP_FUNDING_ROUND_NS;
17081
+ }
17082
+ function perpFundingSampleDue(funding, nowNs) {
17083
+ return nowNs / PERP_FUNDING_SAMPLE_NS > funding.lastSampleNs / PERP_FUNDING_SAMPLE_NS;
17084
+ }
17085
+ function perpSeatFundingCredit(market, seat) {
17086
+ const index = market.funding?.index ?? 0n;
17087
+ const net = seat.longLots - seat.shortLots;
17088
+ return BigInt(seat.fundingCarry ?? 0) - net * (index - (seat.fundingSnapshot ?? 0n));
17089
+ }
17090
+ function perpSettleFunding(market, seat) {
17091
+ const index = market.funding?.index ?? 0n;
17092
+ const credit = perpSeatFundingCredit(market, seat);
17093
+ const paid = floorDiv(credit, PERP_FUNDING_RATE_TICK);
17094
+ const carry = credit - paid * PERP_FUNDING_RATE_TICK;
17095
+ let quantityQuote = seat.quantityQuote + paid;
17096
+ let entryNotional = seat.entryNotional;
17097
+ let badDebt = 0n;
17098
+ if (quantityQuote < 0n) {
17099
+ const shortfall = -quantityQuote;
17100
+ quantityQuote = 0n;
17101
+ if (seat.longLots > 0n) {
17102
+ entryNotional += shortfall;
17103
+ } else {
17104
+ const absorbed = seat.shortLots > 0n ? minBig(shortfall, entryNotional) : 0n;
17105
+ entryNotional -= absorbed;
17106
+ badDebt = shortfall - absorbed;
17107
+ }
17108
+ }
17109
+ return { seat: { ...seat, quantityQuote, entryNotional, fundingSnapshot: index, fundingCarry: Number(carry) }, paid, badDebt };
17110
+ }
15588
17111
  function affordableLots(market, seat, price, mark) {
15589
17112
  const perLot = perpLotInitialMargin(market, price);
15590
17113
  const free = maxBig(perpFreeCollateral(market, seat, mark), 0n);
@@ -15683,6 +17206,7 @@ function createPerpMarketRecordInstruction(args) {
15683
17206
  return buildPerpInstruction("market_record", payload);
15684
17207
  };
15685
17208
  }
17209
+ var PERP_MARKET_CREATE_STATE_UNITS = 51;
15686
17210
  function createPerpMarketCreateInstruction(args) {
15687
17211
  return async (context) => {
15688
17212
  assertU64(args.lotSize, "lotSize");
@@ -15762,6 +17286,27 @@ function createPerpMarketSetOracleInstruction(args) {
15762
17286
  return buildPerpInstruction("market_set_oracle", payload);
15763
17287
  };
15764
17288
  }
17289
+ function createPerpFundingUpdateInstruction(args) {
17290
+ return async () => {
17291
+ const payload = new FundingUpdateInstructionBuilder().set_market_record_idx(assertU8(args.marketRecordIndex, "marketRecordIndex")).set_reserved0(0).set_reserved1(0).build();
17292
+ return buildPerpInstruction("funding_update", payload);
17293
+ };
17294
+ }
17295
+ function createPerpSettleFundingInstruction(args) {
17296
+ const targetSeatIndex = assertPerpSeatIndex(args.targetSeatIndex, "targetSeatIndex");
17297
+ return async () => {
17298
+ const payload = new SettleFundingInstructionBuilder().set_market_record_idx(assertU8(args.marketRecordIndex, "marketRecordIndex")).set_reserved0(0).set_target_seat_idx(targetSeatIndex).build();
17299
+ return buildPerpInstruction("settle_funding", payload);
17300
+ };
17301
+ }
17302
+ function createPerpMarketSetFundingInstruction(args) {
17303
+ for (const label of ["interestRate", "clampSmall", "clampBig", "premiumMultiplier"]) (0, helpers_exports.assertU32)(args[label], label);
17304
+ assertU64(args.impactNotional, "impactNotional");
17305
+ return async () => {
17306
+ const payload = new MarketSetFundingInstructionBuilder().set_market_record_idx(assertU8(args.marketRecordIndex, "marketRecordIndex")).set_reserved0(0).set_interest_rate(args.interestRate).set_clamp_small(args.clampSmall).set_clamp_big(args.clampBig).set_premium_multiplier(args.premiumMultiplier).set_reserved1(0).set_impact_notional(args.impactNotional).build();
17307
+ return buildPerpInstruction("market_set_funding", payload);
17308
+ };
17309
+ }
15765
17310
  function concatPerpInstructions(...instructions) {
15766
17311
  return async (context) => {
15767
17312
  const chunks = [];
@@ -16056,6 +17601,21 @@ function parsePerpEvent(data) {
16056
17601
  targetSide: liquidationSideFromValue(event.get_side())
16057
17602
  };
16058
17603
  }
17604
+ case "funding_round": {
17605
+ const event = payload.asFundingRound();
17606
+ if (!event) throw new Error("perp funding_round event payload is malformed");
17607
+ return {
17608
+ ...base,
17609
+ variant: "funding_round",
17610
+ market: pubkeyViewToAddress(event.get_market()),
17611
+ rate: event.get_rate(),
17612
+ premiumSum: event.get_premium_sum(),
17613
+ sampleCount: event.get_sample_cnt(),
17614
+ indexPrice: event.get_index_price(),
17615
+ fundingIndex: joinI128(event.get_funding_index_lo(), event.get_funding_index_hi()),
17616
+ roundNs: event.get_round_ns()
17617
+ };
17618
+ }
16059
17619
  case "market_status":
16060
17620
  case "exchange_initialized":
16061
17621
  case "exchange_status":
@@ -16113,9 +17673,26 @@ function marketFromView(view) {
16113
17673
  maintenanceMarginBps: view.get_maintenance_margin_bps(),
16114
17674
  liquidationFeeBps: view.get_liquidation_fee_bps(),
16115
17675
  oracleExponent: view.get_oracle_exponent(),
16116
- maxMarkAgeNs: view.get_max_mark_age_ns()
17676
+ maxMarkAgeNs: view.get_max_mark_age_ns(),
17677
+ funding: {
17678
+ index: joinI128(view.get_funding_index_lo(), view.get_funding_index_hi()),
17679
+ balance: view.get_funding_balance(),
17680
+ lastRoundNs: view.get_funding_last_round_ns(),
17681
+ lastSampleNs: view.get_funding_last_sample_ns(),
17682
+ premiumSum: view.get_funding_premium_sum(),
17683
+ sampleCount: view.get_funding_sample_cnt(),
17684
+ rate: view.get_funding_rate(),
17685
+ interestRate: view.get_funding_interest_rate(),
17686
+ clampSmall: view.get_funding_clamp_small(),
17687
+ clampBig: view.get_funding_clamp_big(),
17688
+ premiumMultiplier: view.get_funding_premium_multiplier(),
17689
+ impactNotional: view.get_funding_impact_notional()
17690
+ }
16117
17691
  });
16118
17692
  }
17693
+ function joinI128(lo, hi) {
17694
+ return BigInt.asIntN(128, hi << 64n | lo);
17695
+ }
16119
17696
  function assertPerpMarketHeader(market) {
16120
17697
  const { initialMarginBps: initial, maintenanceMarginBps: maintenance, liquidationFeeBps: fee, markNum, markDen } = market;
16121
17698
  const problem = !(initial >= 1 && initial <= PERP_BPS_DENOMINATOR) ? `initialMarginBps ${initial} is not in 1..${PERP_BPS_DENOMINATOR}` : !(maintenance >= 1 && maintenance < initial) ? `maintenanceMarginBps ${maintenance} is not in 1..${initial - 1}` : fee > PERP_BPS_DENOMINATOR ? `liquidationFeeBps ${fee} is above ${PERP_BPS_DENOMINATOR}` : markDen <= 0n ? `markDen ${markDen} is not positive` : markNum <= 0n ? `markNum ${markNum} is not positive` : null;
@@ -16137,7 +17714,9 @@ function seatEntryFromView(view, seatIndex) {
16137
17714
  headOrderEntryIndex: view.get_head_order_entry_idx(),
16138
17715
  entryNotional: view.get_entry_notional(),
16139
17716
  openBidNotional: view.get_open_bid_notional(),
16140
- openAskNotional: view.get_open_ask_notional()
17717
+ openAskNotional: view.get_open_ask_notional(),
17718
+ fundingSnapshot: joinI128(view.get_funding_snapshot_lo(), view.get_funding_snapshot_hi()),
17719
+ fundingCarry: view.get_funding_carry()
16141
17720
  };
16142
17721
  }
16143
17722
  function orderEntryFromView(view, orderEntryIndex) {
@@ -16237,10 +17816,17 @@ async function sha256(...parts) {
16237
17816
  const digest = await globalThis.crypto.subtle.digest("SHA-256", joined);
16238
17817
  return new Uint8Array(digest);
16239
17818
  }
17819
+ function floorDiv(numerator, denominator) {
17820
+ const quotient = numerator / denominator;
17821
+ return numerator % denominator !== 0n && numerator < 0n !== denominator < 0n ? quotient - 1n : quotient;
17822
+ }
17823
+ function clampBig(value, low, high) {
17824
+ return value < low ? low : value > high ? high : value;
17825
+ }
16240
17826
  function minBig(a, b) {
16241
17827
  return a < b ? a : b;
16242
17828
  }
16243
17829
 
16244
- export { CbookAccount, CbookHeader, CbookHeaderBuilder, CbookLevel, CbookLevelBuilder, ClientId, CreateOrderEntryInstruction, CreateOrderEntryInstructionBuilder, ExchangeAdminEvent, ExchangeAdminEventBuilder, ExchangeInitializeInstruction, ExchangeInitializeInstructionBuilder, ExchangeInitializedEvent, ExchangeInitializedEventBuilder, ExchangeMetaAccount, ExchangeMetaAccountBuilder, ExchangeMetaAccountPayload, ExchangeMetaAccountPayloadBuilder, ExchangeRecoverAdminInstruction, ExchangeRecoverAdminInstructionBuilder, ExchangeSetAdminInstruction, ExchangeSetAdminInstructionBuilder, ExchangeSetStatusInstruction, ExchangeSetStatusInstructionBuilder, ExchangeStatusEvent, ExchangeStatusEventBuilder, LiquidateInstruction, LiquidateInstructionBuilder, LiquidationEvent, LiquidationEventBuilder, MarketAccount, MarketAccountBuilder, MarketAccountPayload, MarketAccountPayloadBuilder, MarketCreateInstruction, MarketCreateInstructionBuilder, MarketCreatedEvent, MarketCreatedEventBuilder, MarketExchangeStatusEvent, MarketExchangeStatusEventBuilder, MarketRecordInstruction, MarketRecordInstructionBuilder, MarketSetExchangeStatusInstruction, MarketSetExchangeStatusInstructionBuilder, MarketSetOracleInstruction, MarketSetOracleInstructionBuilder, MarketSetStatusInstruction, MarketSetStatusInstructionBuilder, MarketStatusEvent, MarketStatusEventBuilder, ModifyOrderEntryInstruction, ModifyOrderEntryInstructionBuilder, OrderArenaAccount, OrderArenaHeader, OrderArenaHeaderBuilder, OrderCancelledEvent, OrderCancelledEventBuilder, OrderEntry, OrderEntryBuilder, OrderEntryRemovedEvent, OrderEntryRemovedEventBuilder, OrderFilledEvent, OrderFilledEventBuilder, OrderModifiedEvent, OrderModifiedEventBuilder, OrderPostedEvent, OrderPostedEventBuilder, PERP_BPS_DENOMINATOR, PERP_CBOOK_EMPTY_PRICE_IN_TICKS, PERP_CBOOK_HEADER_SIZE, PERP_CBOOK_LEVEL_SIZE, PERP_CBOOK_MAX_PRICE_IN_TICKS, PERP_CBOOK_MAX_SIZE, PERP_CLIENT_ID_SIZE, PERP_DEFAULT_MARKET_RECORD_INDEX, PERP_ERR_ARITH_OVERFLOW, PERP_ERR_INSUFFICIENT_COLLATERAL, PERP_ERR_INSUFFICIENT_FUNDS_QUOTE, PERP_ERR_INVALID_MARGIN_PARAMS, PERP_ERR_INVALID_POSITION_LIMIT, PERP_ERR_INVALID_PRICE_CAP, PERP_ERR_NOT_LIQUIDATABLE, PERP_ERR_ORACLE_INVALID, PERP_ERR_ORACLE_MISMATCH, PERP_ERR_ORACLE_MISSING, PERP_ERR_ORACLE_STALE, PERP_ERR_POSITION_LIMIT, PERP_ERR_PRICE_ABOVE_CAP, PERP_ERR_SELF_LIQUIDATION, PERP_EVENT_EXCHANGE_ADMIN, PERP_EVENT_EXCHANGE_INITIALIZED, PERP_EVENT_EXCHANGE_STATUS, PERP_EVENT_LIQUIDATION, PERP_EVENT_MARKET_CREATED, PERP_EVENT_MARKET_EXCHANGE_STATUS, PERP_EVENT_MARKET_STATUS, PERP_EVENT_ORDER_CANCELLED, PERP_EVENT_ORDER_ENTRY_REMOVED, PERP_EVENT_ORDER_FILLED, PERP_EVENT_ORDER_MODIFIED, PERP_EVENT_ORDER_POSTED, PERP_EVENT_REMOVE_REASON_EVICTED, PERP_EVENT_REMOVE_REASON_EXPIRED, PERP_EVENT_REMOVE_REASON_FILLED, PERP_EVENT_REMOVE_REASON_USER, PERP_EVENT_SEAT_ASSIGNED, PERP_EVENT_SIDE_BUY, PERP_EVENT_SIDE_SELL, PERP_EVENT_TOKEN_DEPOSIT, PERP_EVENT_TOKEN_WITHDRAW, PERP_EXCHANGE_META_ACCOUNT_SIZE, PERP_EXCHANGE_META_MAGIC, PERP_EXCHANGE_META_SEED, PERP_EXCHANGE_META_VERSION, PERP_INSTRUCTION_CREATE_ORDER_ENTRY, PERP_INSTRUCTION_EXCHANGE_INITIALIZE, PERP_INSTRUCTION_EXCHANGE_RECOVER_ADMIN, PERP_INSTRUCTION_EXCHANGE_SET_ADMIN, PERP_INSTRUCTION_EXCHANGE_SET_STATUS, PERP_INSTRUCTION_LIQUIDATE, PERP_INSTRUCTION_MARKET_CREATE, PERP_INSTRUCTION_MARKET_RECORD, PERP_INSTRUCTION_MARKET_SET_EXCHANGE_STATUS, PERP_INSTRUCTION_MARKET_SET_ORACLE, PERP_INSTRUCTION_MARKET_SET_STATUS, PERP_INSTRUCTION_MODIFY_ORDER_ENTRY, PERP_INSTRUCTION_SEAT_CREATE, PERP_INSTRUCTION_TOKEN_DEPOSIT, PERP_INSTRUCTION_TOKEN_WITHDRAW, PERP_MARKET_ACCOUNT_SIZE, PERP_MARKET_MAGIC, PERP_MAX_ORDER_EXPIRATION_TIME, PERP_MODIFY_FLAG_FAIL_IF_OUT_OF_RANGE, PERP_MODIFY_FLAG_HAS_CLIENT_ID, PERP_MODIFY_FLAG_HAS_ORDER_ID, PERP_NULL_ACCOUNT_INDEX, PERP_NULL_INDEX, PERP_ORDER_ARENA_ENTRIES_OFFSET, PERP_ORDER_ARENA_HEADER_SIZE, PERP_ORDER_ENTRY_SIZE, PERP_ORDER_FLAG_BUY, PERP_ORDER_FLAG_HAS_CLIENT_ID, PERP_ORDER_TYPE_ALO, PERP_ORDER_TYPE_FOK, PERP_ORDER_TYPE_GTC, PERP_ORDER_TYPE_IOC, PERP_ORDER_TYPE_MTL, PERP_PROGRAM_ADDRESS, PERP_PROGRAM_ADDRESSES, PERP_PROGRAM_META_ADDRESS, PERP_PROGRAM_SEED, PERP_SEAT_ARENA_ENTRIES_OFFSET, PERP_SEAT_ARENA_HEADER_SIZE, PERP_SEAT_ENTRY_SIZE, PERP_SEAT_MANAGER_RESERVED_SIZE, PERP_STATUS_FLAG_DEPOSITS_FROZEN, PERP_STATUS_FLAG_MASK, PERP_STATUS_FLAG_PAUSED, PERP_STATUS_FLAG_POST_ONLY, PERP_STATUS_FLAG_WITHDRAWALS_FROZEN, PerpError, PerpErrorBuilder, PerpEvent, PerpEventBuilder, PerpEvent_payload_Inner, PerpInstruction, PerpInstructionBuilder, PerpInstruction_payload_Inner, PerpProgramAccount, PerpProgramAccountBuilder, PerpProgramAccount_payload_Inner, SeatArenaAccount, SeatArenaHeader, SeatArenaHeaderBuilder, SeatAssignedEvent, SeatAssignedEventBuilder, SeatCreateInstruction, SeatCreateInstructionBuilder, SeatEntry, SeatEntryBuilder, TokenBalanceEvent, TokenBalanceEventBuilder, TokenTransferInstruction, TokenTransferInstructionBuilder, assertPerpSeatIndex, buildPerpOrderBookSnapshot, concatPerpInstructions, createPerpCancelOrderInstruction, createPerpExchangeInitializeInstruction, createPerpExchangeSetAdminInstruction, createPerpExchangeSetStatusInstruction, createPerpLiquidateInstruction, createPerpMarketCreateInstruction, createPerpMarketRecordInstruction, createPerpMarketSetOracleInstruction, createPerpMarketSetStatusInstruction, createPerpModifyOrderEntryInstruction, createPerpOrderEntryInstruction, createPerpSeatCreateInstruction, createPerpTokenDepositInstruction, createPerpTokenWithdrawInstruction, derivePerpExchangeMetaAddress, derivePerpMarketAccounts, parsePerpCbookAccount, parsePerpEvent, parsePerpExchangeMetaAccount, parsePerpMarketAccount, parsePerpOrderArenaAccount, parsePerpSeatArenaAccount, perpAverageEntryPrice, perpBankruptcyPrice, perpCanPostOrder, perpCeilBps, perpEquity, perpFreeCollateral, perpInitialMargin, perpIsLiquidatable, perpLeverageBps, perpLiquidationPreview, perpLiquidationPrice, perpLotInitialMargin, perpMaintenanceMargin, perpMarkFraction, perpMarkFromFeed, perpMarkPrice, perpMarketAccountAddresses, perpMarketReadOnlyAddresses, perpMaxBuyLots, perpMaxLeverage, perpMaxSellLots, perpNotional, perpOrderInitialMargin, perpPositionInitialMargin, perpSeatOrders, perpSideMarginNotional, perpUnrealizedPnl };
17830
+ export { CbookAccount, CbookHeader, CbookHeaderBuilder, CbookLevel, CbookLevelBuilder, ClientId, CreateOrderEntryInstruction, CreateOrderEntryInstructionBuilder, ExchangeAdminEvent, ExchangeAdminEventBuilder, ExchangeInitializeInstruction, ExchangeInitializeInstructionBuilder, ExchangeInitializedEvent, ExchangeInitializedEventBuilder, ExchangeMetaAccount, ExchangeMetaAccountBuilder, ExchangeMetaAccountPayload, ExchangeMetaAccountPayloadBuilder, ExchangeRecoverAdminInstruction, ExchangeRecoverAdminInstructionBuilder, ExchangeSetAdminInstruction, ExchangeSetAdminInstructionBuilder, ExchangeSetStatusInstruction, ExchangeSetStatusInstructionBuilder, ExchangeStatusEvent, ExchangeStatusEventBuilder, FundingRoundEvent, FundingRoundEventBuilder, FundingUpdateInstruction, FundingUpdateInstructionBuilder, LiquidateInstruction, LiquidateInstructionBuilder, LiquidationEvent, LiquidationEventBuilder, MarketAccount, MarketAccountBuilder, MarketAccountPayload, MarketAccountPayloadBuilder, MarketCreateInstruction, MarketCreateInstructionBuilder, MarketCreatedEvent, MarketCreatedEventBuilder, MarketExchangeStatusEvent, MarketExchangeStatusEventBuilder, MarketRecordInstruction, MarketRecordInstructionBuilder, MarketSetExchangeStatusInstruction, MarketSetExchangeStatusInstructionBuilder, MarketSetFundingInstruction, MarketSetFundingInstructionBuilder, MarketSetOracleInstruction, MarketSetOracleInstructionBuilder, MarketSetStatusInstruction, MarketSetStatusInstructionBuilder, MarketStatusEvent, MarketStatusEventBuilder, ModifyOrderEntryInstruction, ModifyOrderEntryInstructionBuilder, OrderArenaAccount, OrderArenaHeader, OrderArenaHeaderBuilder, OrderCancelledEvent, OrderCancelledEventBuilder, OrderEntry, OrderEntryBuilder, OrderEntryRemovedEvent, OrderEntryRemovedEventBuilder, OrderFilledEvent, OrderFilledEventBuilder, OrderModifiedEvent, OrderModifiedEventBuilder, OrderPostedEvent, OrderPostedEventBuilder, PERP_BPS_DENOMINATOR, PERP_CBOOK_EMPTY_PRICE_IN_TICKS, PERP_CBOOK_HEADER_SIZE, PERP_CBOOK_LEVEL_SIZE, PERP_CBOOK_MAX_PRICE_IN_TICKS, PERP_CBOOK_MAX_SIZE, PERP_CLIENT_ID_SIZE, PERP_DEFAULT_MARKET_RECORD_INDEX, PERP_ERR_ARITH_OVERFLOW, PERP_ERR_FUNDING_DISABLED, PERP_ERR_FUNDING_UPDATE_NOT_ALONE, PERP_ERR_INSUFFICIENT_COLLATERAL, PERP_ERR_INSUFFICIENT_FUNDS_QUOTE, PERP_ERR_INVALID_FUNDING_PARAMS, PERP_ERR_INVALID_MARGIN_PARAMS, PERP_ERR_INVALID_POSITION_LIMIT, PERP_ERR_INVALID_PRICE_CAP, PERP_ERR_NOT_LIQUIDATABLE, PERP_ERR_ORACLE_INVALID, PERP_ERR_ORACLE_MISMATCH, PERP_ERR_ORACLE_MISSING, PERP_ERR_ORACLE_STALE, PERP_ERR_POSITION_LIMIT, PERP_ERR_PRICE_ABOVE_CAP, PERP_ERR_SELF_LIQUIDATION, PERP_EVENT_EXCHANGE_ADMIN, PERP_EVENT_EXCHANGE_INITIALIZED, PERP_EVENT_EXCHANGE_STATUS, PERP_EVENT_FUNDING_ROUND, PERP_EVENT_LIQUIDATION, PERP_EVENT_MARKET_CREATED, PERP_EVENT_MARKET_EXCHANGE_STATUS, PERP_EVENT_MARKET_STATUS, PERP_EVENT_ORDER_CANCELLED, PERP_EVENT_ORDER_ENTRY_REMOVED, PERP_EVENT_ORDER_FILLED, PERP_EVENT_ORDER_MODIFIED, PERP_EVENT_ORDER_POSTED, PERP_EVENT_REMOVE_REASON_EVICTED, PERP_EVENT_REMOVE_REASON_EXPIRED, PERP_EVENT_REMOVE_REASON_FILLED, PERP_EVENT_REMOVE_REASON_USER, PERP_EVENT_SEAT_ASSIGNED, PERP_EVENT_SIDE_BUY, PERP_EVENT_SIDE_SELL, PERP_EVENT_TOKEN_DEPOSIT, PERP_EVENT_TOKEN_WITHDRAW, PERP_EXCHANGE_META_ACCOUNT_SIZE, PERP_EXCHANGE_META_MAGIC, PERP_EXCHANGE_META_SEED, PERP_EXCHANGE_META_VERSION, PERP_FUNDING_HOURS_PER_RATE, PERP_FUNDING_MULTIPLIER_ONE, PERP_FUNDING_PARAM_MAX, PERP_FUNDING_PREMIUM_DIVISOR, PERP_FUNDING_PREMIUM_MAX, PERP_FUNDING_RATE_TICK, PERP_FUNDING_ROUND_NS, PERP_FUNDING_SAMPLE_NS, PERP_INSTRUCTION_CREATE_ORDER_ENTRY, PERP_INSTRUCTION_EXCHANGE_INITIALIZE, PERP_INSTRUCTION_EXCHANGE_RECOVER_ADMIN, PERP_INSTRUCTION_EXCHANGE_SET_ADMIN, PERP_INSTRUCTION_EXCHANGE_SET_STATUS, PERP_INSTRUCTION_FUNDING_UPDATE, PERP_INSTRUCTION_LIQUIDATE, PERP_INSTRUCTION_MARKET_CREATE, PERP_INSTRUCTION_MARKET_RECORD, PERP_INSTRUCTION_MARKET_SET_EXCHANGE_STATUS, PERP_INSTRUCTION_MARKET_SET_FUNDING, PERP_INSTRUCTION_MARKET_SET_ORACLE, PERP_INSTRUCTION_MARKET_SET_STATUS, PERP_INSTRUCTION_MODIFY_ORDER_ENTRY, PERP_INSTRUCTION_SEAT_CREATE, PERP_INSTRUCTION_SETTLE_FUNDING, PERP_INSTRUCTION_TOKEN_DEPOSIT, PERP_INSTRUCTION_TOKEN_WITHDRAW, PERP_MARKET_ACCOUNT_SIZE, PERP_MARKET_CREATE_STATE_UNITS, PERP_MARKET_MAGIC, PERP_MAX_ORDER_EXPIRATION_TIME, PERP_MODIFY_FLAG_FAIL_IF_OUT_OF_RANGE, PERP_MODIFY_FLAG_HAS_CLIENT_ID, PERP_MODIFY_FLAG_HAS_ORDER_ID, PERP_NULL_ACCOUNT_INDEX, PERP_NULL_INDEX, PERP_ORDER_ARENA_ENTRIES_OFFSET, PERP_ORDER_ARENA_HEADER_SIZE, PERP_ORDER_ENTRY_SIZE, PERP_ORDER_FLAG_BUY, PERP_ORDER_FLAG_HAS_CLIENT_ID, PERP_ORDER_TYPE_ALO, PERP_ORDER_TYPE_FOK, PERP_ORDER_TYPE_GTC, PERP_ORDER_TYPE_IOC, PERP_ORDER_TYPE_MTL, PERP_PROGRAM_ADDRESS, PERP_PROGRAM_ADDRESSES, PERP_PROGRAM_META_ADDRESS, PERP_PROGRAM_SEED, PERP_SEAT_ARENA_ENTRIES_OFFSET, PERP_SEAT_ARENA_HEADER_SIZE, PERP_SEAT_ENTRY_SIZE, PERP_SEAT_MANAGER_RESERVED_SIZE, PERP_STATUS_FLAG_DEPOSITS_FROZEN, PERP_STATUS_FLAG_MASK, PERP_STATUS_FLAG_PAUSED, PERP_STATUS_FLAG_POST_ONLY, PERP_STATUS_FLAG_WITHDRAWALS_FROZEN, PerpError, PerpErrorBuilder, PerpEvent, PerpEventBuilder, PerpEvent_payload_Inner, PerpInstruction, PerpInstructionBuilder, PerpInstruction_payload_Inner, PerpProgramAccount, PerpProgramAccountBuilder, PerpProgramAccount_payload_Inner, SeatArenaAccount, SeatArenaHeader, SeatArenaHeaderBuilder, SeatAssignedEvent, SeatAssignedEventBuilder, SeatCreateInstruction, SeatCreateInstructionBuilder, SeatEntry, SeatEntryBuilder, SettleFundingInstruction, SettleFundingInstructionBuilder, TokenBalanceEvent, TokenBalanceEventBuilder, TokenTransferInstruction, TokenTransferInstructionBuilder, assertPerpSeatIndex, buildPerpOrderBookSnapshot, concatPerpInstructions, createPerpCancelOrderInstruction, createPerpExchangeInitializeInstruction, createPerpExchangeSetAdminInstruction, createPerpExchangeSetStatusInstruction, createPerpFundingUpdateInstruction, createPerpLiquidateInstruction, createPerpMarketCreateInstruction, createPerpMarketRecordInstruction, createPerpMarketSetFundingInstruction, createPerpMarketSetOracleInstruction, createPerpMarketSetStatusInstruction, createPerpModifyOrderEntryInstruction, createPerpOrderEntryInstruction, createPerpSeatCreateInstruction, createPerpSettleFundingInstruction, createPerpTokenDepositInstruction, createPerpTokenWithdrawInstruction, derivePerpExchangeMetaAddress, derivePerpMarketAccounts, parsePerpCbookAccount, parsePerpEvent, parsePerpExchangeMetaAccount, parsePerpMarketAccount, parsePerpOrderArenaAccount, parsePerpSeatArenaAccount, perpAverageEntryPrice, perpBankruptcyPrice, perpCanPostOrder, perpCeilBps, perpEquity, perpFreeCollateral, perpFundingEnabled, perpFundingHourlyRate, perpFundingMaxClampBig, perpFundingParamsProblem, perpFundingPremiumSample, perpFundingRoundDue, perpFundingSampleDue, perpInitialMargin, perpIsLiquidatable, perpLeverageBps, perpLiquidationPreview, perpLiquidationPrice, perpLotInitialMargin, perpMaintenanceMargin, perpMarkFraction, perpMarkFromFeed, perpMarkPrice, perpMarketAccountAddresses, perpMarketReadOnlyAddresses, perpMaxBuyLots, perpMaxLeverage, perpMaxSellLots, perpNextFundingRoundNs, perpNotional, perpOrderInitialMargin, perpPositionInitialMargin, perpSeatFundingCredit, perpSeatOrders, perpSettleFunding, perpSideMarginNotional, perpUnrealizedPnl };
16245
17831
  //# sourceMappingURL=index.js.map
16246
17832
  //# sourceMappingURL=index.js.map