@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
@@ -4477,6 +4477,153 @@ __tnRegisterDynamicValidate2("ExchangeSetStatusInstruction", (buffer) => {
4477
4477
  const params = result.params;
4478
4478
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
4479
4479
  });
4480
+ var __tn_ir_FundingUpdateInstruction = {
4481
+ typeName: "FundingUpdateInstruction",
4482
+ root: { op: "const", value: 7n }
4483
+ };
4484
+ var FundingUpdateInstruction = class _FundingUpdateInstruction {
4485
+ constructor(buffer) {
4486
+ this.buffer = buffer;
4487
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
4488
+ }
4489
+ static __tnCreateView(buffer, opts) {
4490
+ if (!buffer || buffer.length === void 0) throw new Error("FundingUpdateInstruction.__tnCreateView requires a Uint8Array");
4491
+ return new _FundingUpdateInstruction(new Uint8Array(buffer));
4492
+ }
4493
+ static builder() {
4494
+ return new FundingUpdateInstructionBuilder();
4495
+ }
4496
+ static fromBuilder(builder) {
4497
+ const buffer = builder.build();
4498
+ return _FundingUpdateInstruction.from_array(buffer);
4499
+ }
4500
+ get_market_record_idx() {
4501
+ const offset = 0;
4502
+ return this.view.getUint8(offset);
4503
+ }
4504
+ set_market_record_idx(value) {
4505
+ const offset = 0;
4506
+ this.view.setUint8(offset, value);
4507
+ }
4508
+ get market_record_idx() {
4509
+ return this.get_market_record_idx();
4510
+ }
4511
+ set market_record_idx(value) {
4512
+ this.set_market_record_idx(value);
4513
+ }
4514
+ get_reserved0() {
4515
+ const offset = 1;
4516
+ return this.view.getUint16(offset, true);
4517
+ }
4518
+ set_reserved0(value) {
4519
+ const offset = 1;
4520
+ this.view.setUint16(offset, value, true);
4521
+ }
4522
+ get reserved0() {
4523
+ return this.get_reserved0();
4524
+ }
4525
+ set reserved0(value) {
4526
+ this.set_reserved0(value);
4527
+ }
4528
+ get_reserved1() {
4529
+ const offset = 3;
4530
+ return this.view.getUint32(offset, true);
4531
+ }
4532
+ set_reserved1(value) {
4533
+ const offset = 3;
4534
+ this.view.setUint32(offset, value, true);
4535
+ }
4536
+ get reserved1() {
4537
+ return this.get_reserved1();
4538
+ }
4539
+ set reserved1(value) {
4540
+ this.set_reserved1(value);
4541
+ }
4542
+ static __tnFootprintInternal(__tnParams) {
4543
+ return __tnEvalFootprint2(__tn_ir_FundingUpdateInstruction.root, { params: __tnParams });
4544
+ }
4545
+ static __tnValidateInternal(buffer, __tnParams) {
4546
+ return __tnValidateIrTree2(__tn_ir_FundingUpdateInstruction, buffer, __tnParams);
4547
+ }
4548
+ static __tnInvokeFootprint(__tnParams) {
4549
+ return this.__tnFootprintInternal(__tnParams);
4550
+ }
4551
+ static __tnInvokeValidate(buffer, __tnParams) {
4552
+ return this.__tnValidateInternal(buffer, __tnParams);
4553
+ }
4554
+ static footprintIr() {
4555
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
4556
+ }
4557
+ static footprint() {
4558
+ const irResult = this.footprintIr();
4559
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
4560
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
4561
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for FundingUpdateInstruction");
4562
+ }
4563
+ return __tnBigIntToNumber2(irResult, "FundingUpdateInstruction::footprint");
4564
+ }
4565
+ static validate(buffer, _opts) {
4566
+ if (buffer.length < 7) return { ok: false, code: "tn.buffer_too_small", consumed: 7 };
4567
+ return { ok: true, consumed: 7 };
4568
+ }
4569
+ static new(market_record_idx, reserved0, reserved1) {
4570
+ const buffer = new Uint8Array(7);
4571
+ const view = new DataView(buffer.buffer);
4572
+ view.setUint8(0, market_record_idx);
4573
+ view.setUint16(1, reserved0, true);
4574
+ view.setUint32(3, reserved1, true);
4575
+ return new _FundingUpdateInstruction(buffer);
4576
+ }
4577
+ static from_array(buffer) {
4578
+ if (!buffer || buffer.length === void 0) {
4579
+ return null;
4580
+ }
4581
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
4582
+ const validation = this.validate(buffer);
4583
+ if (!validation.ok) {
4584
+ return null;
4585
+ }
4586
+ return new _FundingUpdateInstruction(buffer);
4587
+ }
4588
+ };
4589
+ var FundingUpdateInstructionBuilder = class {
4590
+ constructor() {
4591
+ this.buffer = new Uint8Array(7);
4592
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
4593
+ }
4594
+ set_market_record_idx(value) {
4595
+ this.view.setUint8(0, value);
4596
+ return this;
4597
+ }
4598
+ set_reserved0(value) {
4599
+ this.view.setUint16(1, value, true);
4600
+ return this;
4601
+ }
4602
+ set_reserved1(value) {
4603
+ this.view.setUint32(3, value, true);
4604
+ return this;
4605
+ }
4606
+ build() {
4607
+ return this.buffer.slice();
4608
+ }
4609
+ buildInto(target, offset = 0) {
4610
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
4611
+ target.set(this.buffer, offset);
4612
+ return target;
4613
+ }
4614
+ finish() {
4615
+ const view = FundingUpdateInstruction.from_array(this.buffer.slice());
4616
+ if (!view) throw new Error("failed to build FundingUpdateInstruction");
4617
+ return view;
4618
+ }
4619
+ };
4620
+ __tnRegisterFootprint2("FundingUpdateInstruction", (params) => FundingUpdateInstruction.__tnInvokeFootprint(params));
4621
+ __tnRegisterValidate2("FundingUpdateInstruction", (buffer, params) => FundingUpdateInstruction.__tnInvokeValidate(buffer, params));
4622
+ __tnRegisterDynamicValidate2("FundingUpdateInstruction", (buffer) => {
4623
+ const result = FundingUpdateInstruction.validate(buffer);
4624
+ const params = result.params;
4625
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
4626
+ });
4480
4627
  var __tn_ir_LiquidateInstruction = {
4481
4628
  typeName: "LiquidateInstruction",
4482
4629
  root: { op: "const", value: 7n }
@@ -6391,25 +6538,25 @@ __tnRegisterDynamicValidate2("MarketSetExchangeStatusInstruction", (buffer) => {
6391
6538
  const params = result.params;
6392
6539
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
6393
6540
  });
6394
- var __tn_ir_MarketSetOracleInstruction = {
6395
- typeName: "MarketSetOracleInstruction",
6396
- root: { op: "const", value: 39n }
6541
+ var __tn_ir_MarketSetFundingInstruction = {
6542
+ typeName: "MarketSetFundingInstruction",
6543
+ root: { op: "const", value: 31n }
6397
6544
  };
6398
- var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6545
+ var MarketSetFundingInstruction = class _MarketSetFundingInstruction {
6399
6546
  constructor(buffer) {
6400
6547
  this.buffer = buffer;
6401
6548
  this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
6402
6549
  }
6403
6550
  static __tnCreateView(buffer, opts) {
6404
- if (!buffer || buffer.length === void 0) throw new Error("MarketSetOracleInstruction.__tnCreateView requires a Uint8Array");
6405
- return new _MarketSetOracleInstruction(new Uint8Array(buffer));
6551
+ if (!buffer || buffer.length === void 0) throw new Error("MarketSetFundingInstruction.__tnCreateView requires a Uint8Array");
6552
+ return new _MarketSetFundingInstruction(new Uint8Array(buffer));
6406
6553
  }
6407
6554
  static builder() {
6408
- return new MarketSetOracleInstructionBuilder();
6555
+ return new MarketSetFundingInstructionBuilder();
6409
6556
  }
6410
6557
  static fromBuilder(builder) {
6411
6558
  const buffer = builder.build();
6412
- return _MarketSetOracleInstruction.from_array(buffer);
6559
+ return _MarketSetFundingInstruction.from_array(buffer);
6413
6560
  }
6414
6561
  get_market_record_idx() {
6415
6562
  const offset = 0;
@@ -6425,95 +6572,109 @@ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6425
6572
  set market_record_idx(value) {
6426
6573
  this.set_market_record_idx(value);
6427
6574
  }
6428
- get_oracle_feed_account_idx() {
6575
+ get_reserved0() {
6429
6576
  const offset = 1;
6430
6577
  return this.view.getUint16(offset, true);
6431
6578
  }
6432
- set_oracle_feed_account_idx(value) {
6579
+ set_reserved0(value) {
6433
6580
  const offset = 1;
6434
6581
  this.view.setUint16(offset, value, true);
6435
6582
  }
6436
- get oracle_feed_account_idx() {
6437
- return this.get_oracle_feed_account_idx();
6583
+ get reserved0() {
6584
+ return this.get_reserved0();
6438
6585
  }
6439
- set oracle_feed_account_idx(value) {
6440
- this.set_oracle_feed_account_idx(value);
6586
+ set reserved0(value) {
6587
+ this.set_reserved0(value);
6441
6588
  }
6442
- get_oracle_exponent() {
6589
+ get_interest_rate() {
6443
6590
  const offset = 3;
6444
- return this.view.getInt32(offset, true);
6591
+ return this.view.getUint32(offset, true);
6445
6592
  }
6446
- set_oracle_exponent(value) {
6593
+ set_interest_rate(value) {
6447
6594
  const offset = 3;
6448
- this.view.setInt32(offset, value, true);
6595
+ this.view.setUint32(offset, value, true);
6449
6596
  }
6450
- get oracle_exponent() {
6451
- return this.get_oracle_exponent();
6597
+ get interest_rate() {
6598
+ return this.get_interest_rate();
6452
6599
  }
6453
- set oracle_exponent(value) {
6454
- this.set_oracle_exponent(value);
6600
+ set interest_rate(value) {
6601
+ this.set_interest_rate(value);
6455
6602
  }
6456
- get_mark_num() {
6603
+ get_clamp_small() {
6457
6604
  const offset = 7;
6458
- return this.view.getBigUint64(offset, true);
6605
+ return this.view.getUint32(offset, true);
6459
6606
  }
6460
- set_mark_num(value) {
6607
+ set_clamp_small(value) {
6461
6608
  const offset = 7;
6462
- this.view.setBigUint64(offset, value, true);
6609
+ this.view.setUint32(offset, value, true);
6463
6610
  }
6464
- get mark_num() {
6465
- return this.get_mark_num();
6611
+ get clamp_small() {
6612
+ return this.get_clamp_small();
6466
6613
  }
6467
- set mark_num(value) {
6468
- this.set_mark_num(value);
6614
+ set clamp_small(value) {
6615
+ this.set_clamp_small(value);
6469
6616
  }
6470
- get_mark_den() {
6617
+ get_clamp_big() {
6618
+ const offset = 11;
6619
+ return this.view.getUint32(offset, true);
6620
+ }
6621
+ set_clamp_big(value) {
6622
+ const offset = 11;
6623
+ this.view.setUint32(offset, value, true);
6624
+ }
6625
+ get clamp_big() {
6626
+ return this.get_clamp_big();
6627
+ }
6628
+ set clamp_big(value) {
6629
+ this.set_clamp_big(value);
6630
+ }
6631
+ get_premium_multiplier() {
6471
6632
  const offset = 15;
6472
- return this.view.getBigUint64(offset, true);
6633
+ return this.view.getUint32(offset, true);
6473
6634
  }
6474
- set_mark_den(value) {
6635
+ set_premium_multiplier(value) {
6475
6636
  const offset = 15;
6476
- this.view.setBigUint64(offset, value, true);
6637
+ this.view.setUint32(offset, value, true);
6477
6638
  }
6478
- get mark_den() {
6479
- return this.get_mark_den();
6639
+ get premium_multiplier() {
6640
+ return this.get_premium_multiplier();
6480
6641
  }
6481
- set mark_den(value) {
6482
- this.set_mark_den(value);
6642
+ set premium_multiplier(value) {
6643
+ this.set_premium_multiplier(value);
6483
6644
  }
6484
- get_max_mark_age_ns() {
6485
- const offset = 23;
6486
- return this.view.getBigUint64(offset, true);
6645
+ get_reserved1() {
6646
+ const offset = 19;
6647
+ return this.view.getUint32(offset, true);
6487
6648
  }
6488
- set_max_mark_age_ns(value) {
6489
- const offset = 23;
6490
- this.view.setBigUint64(offset, value, true);
6649
+ set_reserved1(value) {
6650
+ const offset = 19;
6651
+ this.view.setUint32(offset, value, true);
6491
6652
  }
6492
- get max_mark_age_ns() {
6493
- return this.get_max_mark_age_ns();
6653
+ get reserved1() {
6654
+ return this.get_reserved1();
6494
6655
  }
6495
- set max_mark_age_ns(value) {
6496
- this.set_max_mark_age_ns(value);
6656
+ set reserved1(value) {
6657
+ this.set_reserved1(value);
6497
6658
  }
6498
- get_reserved0() {
6499
- const offset = 31;
6659
+ get_impact_notional() {
6660
+ const offset = 23;
6500
6661
  return this.view.getBigUint64(offset, true);
6501
6662
  }
6502
- set_reserved0(value) {
6503
- const offset = 31;
6663
+ set_impact_notional(value) {
6664
+ const offset = 23;
6504
6665
  this.view.setBigUint64(offset, value, true);
6505
6666
  }
6506
- get reserved0() {
6507
- return this.get_reserved0();
6667
+ get impact_notional() {
6668
+ return this.get_impact_notional();
6508
6669
  }
6509
- set reserved0(value) {
6510
- this.set_reserved0(value);
6670
+ set impact_notional(value) {
6671
+ this.set_impact_notional(value);
6511
6672
  }
6512
6673
  static __tnFootprintInternal(__tnParams) {
6513
- return __tnEvalFootprint2(__tn_ir_MarketSetOracleInstruction.root, { params: __tnParams });
6674
+ return __tnEvalFootprint2(__tn_ir_MarketSetFundingInstruction.root, { params: __tnParams });
6514
6675
  }
6515
6676
  static __tnValidateInternal(buffer, __tnParams) {
6516
- return __tnValidateIrTree2(__tn_ir_MarketSetOracleInstruction, buffer, __tnParams);
6677
+ return __tnValidateIrTree2(__tn_ir_MarketSetFundingInstruction, buffer, __tnParams);
6517
6678
  }
6518
6679
  static __tnInvokeFootprint(__tnParams) {
6519
6680
  return this.__tnFootprintInternal(__tnParams);
@@ -6528,25 +6689,26 @@ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6528
6689
  const irResult = this.footprintIr();
6529
6690
  const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
6530
6691
  if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
6531
- throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for MarketSetOracleInstruction");
6692
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for MarketSetFundingInstruction");
6532
6693
  }
6533
- return __tnBigIntToNumber2(irResult, "MarketSetOracleInstruction::footprint");
6694
+ return __tnBigIntToNumber2(irResult, "MarketSetFundingInstruction::footprint");
6534
6695
  }
6535
6696
  static validate(buffer, _opts) {
6536
- if (buffer.length < 39) return { ok: false, code: "tn.buffer_too_small", consumed: 39 };
6537
- return { ok: true, consumed: 39 };
6697
+ if (buffer.length < 31) return { ok: false, code: "tn.buffer_too_small", consumed: 31 };
6698
+ return { ok: true, consumed: 31 };
6538
6699
  }
6539
- static new(market_record_idx, oracle_feed_account_idx, oracle_exponent, mark_num, mark_den, max_mark_age_ns, reserved0) {
6540
- const buffer = new Uint8Array(39);
6700
+ static new(market_record_idx, reserved0, interest_rate, clamp_small, clamp_big, premium_multiplier, reserved1, impact_notional) {
6701
+ const buffer = new Uint8Array(31);
6541
6702
  const view = new DataView(buffer.buffer);
6542
6703
  view.setUint8(0, market_record_idx);
6543
- view.setUint16(1, oracle_feed_account_idx, true);
6544
- view.setInt32(3, oracle_exponent, true);
6545
- view.setBigUint64(7, mark_num, true);
6546
- view.setBigUint64(15, mark_den, true);
6547
- view.setBigUint64(23, max_mark_age_ns, true);
6548
- view.setBigUint64(31, reserved0, true);
6549
- return new _MarketSetOracleInstruction(buffer);
6704
+ view.setUint16(1, reserved0, true);
6705
+ view.setUint32(3, interest_rate, true);
6706
+ view.setUint32(7, clamp_small, true);
6707
+ view.setUint32(11, clamp_big, true);
6708
+ view.setUint32(15, premium_multiplier, true);
6709
+ view.setUint32(19, reserved1, true);
6710
+ view.setBigUint64(23, impact_notional, true);
6711
+ return new _MarketSetFundingInstruction(buffer);
6550
6712
  }
6551
6713
  static from_array(buffer) {
6552
6714
  if (!buffer || buffer.length === void 0) {
@@ -6557,47 +6719,275 @@ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6557
6719
  if (!validation.ok) {
6558
6720
  return null;
6559
6721
  }
6560
- return new _MarketSetOracleInstruction(buffer);
6722
+ return new _MarketSetFundingInstruction(buffer);
6561
6723
  }
6562
6724
  };
6563
- var MarketSetOracleInstructionBuilder = class {
6725
+ var MarketSetFundingInstructionBuilder = class {
6564
6726
  constructor() {
6565
- this.buffer = new Uint8Array(39);
6727
+ this.buffer = new Uint8Array(31);
6566
6728
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
6567
6729
  }
6568
6730
  set_market_record_idx(value) {
6569
6731
  this.view.setUint8(0, value);
6570
6732
  return this;
6571
6733
  }
6572
- set_oracle_feed_account_idx(value) {
6734
+ set_reserved0(value) {
6573
6735
  this.view.setUint16(1, value, true);
6574
6736
  return this;
6575
6737
  }
6576
- set_oracle_exponent(value) {
6577
- this.view.setInt32(3, value, true);
6738
+ set_interest_rate(value) {
6739
+ this.view.setUint32(3, value, true);
6578
6740
  return this;
6579
6741
  }
6580
- set_mark_num(value) {
6581
- const cast = __tnToBigInt2(value);
6582
- this.view.setBigUint64(7, cast, true);
6742
+ set_clamp_small(value) {
6743
+ this.view.setUint32(7, value, true);
6583
6744
  return this;
6584
6745
  }
6585
- set_mark_den(value) {
6586
- const cast = __tnToBigInt2(value);
6587
- this.view.setBigUint64(15, cast, true);
6746
+ set_clamp_big(value) {
6747
+ this.view.setUint32(11, value, true);
6588
6748
  return this;
6589
6749
  }
6590
- set_max_mark_age_ns(value) {
6591
- const cast = __tnToBigInt2(value);
6592
- this.view.setBigUint64(23, cast, true);
6750
+ set_premium_multiplier(value) {
6751
+ this.view.setUint32(15, value, true);
6593
6752
  return this;
6594
6753
  }
6595
- set_reserved0(value) {
6596
- const cast = __tnToBigInt2(value);
6597
- this.view.setBigUint64(31, cast, true);
6754
+ set_reserved1(value) {
6755
+ this.view.setUint32(19, value, true);
6598
6756
  return this;
6599
6757
  }
6600
- build() {
6758
+ set_impact_notional(value) {
6759
+ const cast = __tnToBigInt2(value);
6760
+ this.view.setBigUint64(23, cast, true);
6761
+ return this;
6762
+ }
6763
+ build() {
6764
+ return this.buffer.slice();
6765
+ }
6766
+ buildInto(target, offset = 0) {
6767
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
6768
+ target.set(this.buffer, offset);
6769
+ return target;
6770
+ }
6771
+ finish() {
6772
+ const view = MarketSetFundingInstruction.from_array(this.buffer.slice());
6773
+ if (!view) throw new Error("failed to build MarketSetFundingInstruction");
6774
+ return view;
6775
+ }
6776
+ };
6777
+ __tnRegisterFootprint2("MarketSetFundingInstruction", (params) => MarketSetFundingInstruction.__tnInvokeFootprint(params));
6778
+ __tnRegisterValidate2("MarketSetFundingInstruction", (buffer, params) => MarketSetFundingInstruction.__tnInvokeValidate(buffer, params));
6779
+ __tnRegisterDynamicValidate2("MarketSetFundingInstruction", (buffer) => {
6780
+ const result = MarketSetFundingInstruction.validate(buffer);
6781
+ const params = result.params;
6782
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
6783
+ });
6784
+ var __tn_ir_MarketSetOracleInstruction = {
6785
+ typeName: "MarketSetOracleInstruction",
6786
+ root: { op: "const", value: 39n }
6787
+ };
6788
+ var MarketSetOracleInstruction = class _MarketSetOracleInstruction {
6789
+ constructor(buffer) {
6790
+ this.buffer = buffer;
6791
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
6792
+ }
6793
+ static __tnCreateView(buffer, opts) {
6794
+ if (!buffer || buffer.length === void 0) throw new Error("MarketSetOracleInstruction.__tnCreateView requires a Uint8Array");
6795
+ return new _MarketSetOracleInstruction(new Uint8Array(buffer));
6796
+ }
6797
+ static builder() {
6798
+ return new MarketSetOracleInstructionBuilder();
6799
+ }
6800
+ static fromBuilder(builder) {
6801
+ const buffer = builder.build();
6802
+ return _MarketSetOracleInstruction.from_array(buffer);
6803
+ }
6804
+ get_market_record_idx() {
6805
+ const offset = 0;
6806
+ return this.view.getUint8(offset);
6807
+ }
6808
+ set_market_record_idx(value) {
6809
+ const offset = 0;
6810
+ this.view.setUint8(offset, value);
6811
+ }
6812
+ get market_record_idx() {
6813
+ return this.get_market_record_idx();
6814
+ }
6815
+ set market_record_idx(value) {
6816
+ this.set_market_record_idx(value);
6817
+ }
6818
+ get_oracle_feed_account_idx() {
6819
+ const offset = 1;
6820
+ return this.view.getUint16(offset, true);
6821
+ }
6822
+ set_oracle_feed_account_idx(value) {
6823
+ const offset = 1;
6824
+ this.view.setUint16(offset, value, true);
6825
+ }
6826
+ get oracle_feed_account_idx() {
6827
+ return this.get_oracle_feed_account_idx();
6828
+ }
6829
+ set oracle_feed_account_idx(value) {
6830
+ this.set_oracle_feed_account_idx(value);
6831
+ }
6832
+ get_oracle_exponent() {
6833
+ const offset = 3;
6834
+ return this.view.getInt32(offset, true);
6835
+ }
6836
+ set_oracle_exponent(value) {
6837
+ const offset = 3;
6838
+ this.view.setInt32(offset, value, true);
6839
+ }
6840
+ get oracle_exponent() {
6841
+ return this.get_oracle_exponent();
6842
+ }
6843
+ set oracle_exponent(value) {
6844
+ this.set_oracle_exponent(value);
6845
+ }
6846
+ get_mark_num() {
6847
+ const offset = 7;
6848
+ return this.view.getBigUint64(offset, true);
6849
+ }
6850
+ set_mark_num(value) {
6851
+ const offset = 7;
6852
+ this.view.setBigUint64(offset, value, true);
6853
+ }
6854
+ get mark_num() {
6855
+ return this.get_mark_num();
6856
+ }
6857
+ set mark_num(value) {
6858
+ this.set_mark_num(value);
6859
+ }
6860
+ get_mark_den() {
6861
+ const offset = 15;
6862
+ return this.view.getBigUint64(offset, true);
6863
+ }
6864
+ set_mark_den(value) {
6865
+ const offset = 15;
6866
+ this.view.setBigUint64(offset, value, true);
6867
+ }
6868
+ get mark_den() {
6869
+ return this.get_mark_den();
6870
+ }
6871
+ set mark_den(value) {
6872
+ this.set_mark_den(value);
6873
+ }
6874
+ get_max_mark_age_ns() {
6875
+ const offset = 23;
6876
+ return this.view.getBigUint64(offset, true);
6877
+ }
6878
+ set_max_mark_age_ns(value) {
6879
+ const offset = 23;
6880
+ this.view.setBigUint64(offset, value, true);
6881
+ }
6882
+ get max_mark_age_ns() {
6883
+ return this.get_max_mark_age_ns();
6884
+ }
6885
+ set max_mark_age_ns(value) {
6886
+ this.set_max_mark_age_ns(value);
6887
+ }
6888
+ get_reserved0() {
6889
+ const offset = 31;
6890
+ return this.view.getBigUint64(offset, true);
6891
+ }
6892
+ set_reserved0(value) {
6893
+ const offset = 31;
6894
+ this.view.setBigUint64(offset, value, true);
6895
+ }
6896
+ get reserved0() {
6897
+ return this.get_reserved0();
6898
+ }
6899
+ set reserved0(value) {
6900
+ this.set_reserved0(value);
6901
+ }
6902
+ static __tnFootprintInternal(__tnParams) {
6903
+ return __tnEvalFootprint2(__tn_ir_MarketSetOracleInstruction.root, { params: __tnParams });
6904
+ }
6905
+ static __tnValidateInternal(buffer, __tnParams) {
6906
+ return __tnValidateIrTree2(__tn_ir_MarketSetOracleInstruction, buffer, __tnParams);
6907
+ }
6908
+ static __tnInvokeFootprint(__tnParams) {
6909
+ return this.__tnFootprintInternal(__tnParams);
6910
+ }
6911
+ static __tnInvokeValidate(buffer, __tnParams) {
6912
+ return this.__tnValidateInternal(buffer, __tnParams);
6913
+ }
6914
+ static footprintIr() {
6915
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
6916
+ }
6917
+ static footprint() {
6918
+ const irResult = this.footprintIr();
6919
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
6920
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
6921
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for MarketSetOracleInstruction");
6922
+ }
6923
+ return __tnBigIntToNumber2(irResult, "MarketSetOracleInstruction::footprint");
6924
+ }
6925
+ static validate(buffer, _opts) {
6926
+ if (buffer.length < 39) return { ok: false, code: "tn.buffer_too_small", consumed: 39 };
6927
+ return { ok: true, consumed: 39 };
6928
+ }
6929
+ static new(market_record_idx, oracle_feed_account_idx, oracle_exponent, mark_num, mark_den, max_mark_age_ns, reserved0) {
6930
+ const buffer = new Uint8Array(39);
6931
+ const view = new DataView(buffer.buffer);
6932
+ view.setUint8(0, market_record_idx);
6933
+ view.setUint16(1, oracle_feed_account_idx, true);
6934
+ view.setInt32(3, oracle_exponent, true);
6935
+ view.setBigUint64(7, mark_num, true);
6936
+ view.setBigUint64(15, mark_den, true);
6937
+ view.setBigUint64(23, max_mark_age_ns, true);
6938
+ view.setBigUint64(31, reserved0, true);
6939
+ return new _MarketSetOracleInstruction(buffer);
6940
+ }
6941
+ static from_array(buffer) {
6942
+ if (!buffer || buffer.length === void 0) {
6943
+ return null;
6944
+ }
6945
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
6946
+ const validation = this.validate(buffer);
6947
+ if (!validation.ok) {
6948
+ return null;
6949
+ }
6950
+ return new _MarketSetOracleInstruction(buffer);
6951
+ }
6952
+ };
6953
+ var MarketSetOracleInstructionBuilder = class {
6954
+ constructor() {
6955
+ this.buffer = new Uint8Array(39);
6956
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
6957
+ }
6958
+ set_market_record_idx(value) {
6959
+ this.view.setUint8(0, value);
6960
+ return this;
6961
+ }
6962
+ set_oracle_feed_account_idx(value) {
6963
+ this.view.setUint16(1, value, true);
6964
+ return this;
6965
+ }
6966
+ set_oracle_exponent(value) {
6967
+ this.view.setInt32(3, value, true);
6968
+ return this;
6969
+ }
6970
+ set_mark_num(value) {
6971
+ const cast = __tnToBigInt2(value);
6972
+ this.view.setBigUint64(7, cast, true);
6973
+ return this;
6974
+ }
6975
+ set_mark_den(value) {
6976
+ const cast = __tnToBigInt2(value);
6977
+ this.view.setBigUint64(15, cast, true);
6978
+ return this;
6979
+ }
6980
+ set_max_mark_age_ns(value) {
6981
+ const cast = __tnToBigInt2(value);
6982
+ this.view.setBigUint64(23, cast, true);
6983
+ return this;
6984
+ }
6985
+ set_reserved0(value) {
6986
+ const cast = __tnToBigInt2(value);
6987
+ this.view.setBigUint64(31, cast, true);
6988
+ return this;
6989
+ }
6990
+ build() {
6601
6991
  return this.buffer.slice();
6602
6992
  }
6603
6993
  buildInto(target, offset = 0) {
@@ -8248,19 +8638,19 @@ var SeatEntry = class _SeatEntry {
8248
8638
  set head_order_entry_idx(value) {
8249
8639
  this.set_head_order_entry_idx(value);
8250
8640
  }
8251
- get_reserved0() {
8641
+ get_funding_carry() {
8252
8642
  const offset = 76;
8253
8643
  return this.view.getUint32(offset, true);
8254
8644
  }
8255
- set_reserved0(value) {
8645
+ set_funding_carry(value) {
8256
8646
  const offset = 76;
8257
8647
  this.view.setUint32(offset, value, true);
8258
8648
  }
8259
- get reserved0() {
8260
- return this.get_reserved0();
8649
+ get funding_carry() {
8650
+ return this.get_funding_carry();
8261
8651
  }
8262
- set reserved0(value) {
8263
- this.set_reserved0(value);
8652
+ set funding_carry(value) {
8653
+ this.set_funding_carry(value);
8264
8654
  }
8265
8655
  get_entry_notional() {
8266
8656
  const offset = 80;
@@ -8304,35 +8694,40 @@ var SeatEntry = class _SeatEntry {
8304
8694
  set open_ask_notional(value) {
8305
8695
  this.set_open_ask_notional(value);
8306
8696
  }
8307
- get_reserved1() {
8697
+ get_funding_snapshot_lo() {
8308
8698
  const offset = 104;
8309
- const result = [];
8310
- for (let i = 0; i < 16; i++) {
8311
- result.push(this.view.getUint8(offset + i * 1));
8312
- }
8313
- return result;
8699
+ return this.view.getBigUint64(offset, true);
8314
8700
  }
8315
- set_reserved1(value) {
8701
+ set_funding_snapshot_lo(value) {
8316
8702
  const offset = 104;
8317
- if (value.length !== 16) {
8318
- throw new Error("Array length must be 16");
8319
- }
8320
- for (let i = 0; i < 16; i++) {
8321
- this.view.setUint8(offset + i * 1, value[i]);
8322
- }
8703
+ this.view.setBigUint64(offset, value, true);
8323
8704
  }
8324
- get reserved1() {
8325
- return this.get_reserved1();
8705
+ get funding_snapshot_lo() {
8706
+ return this.get_funding_snapshot_lo();
8326
8707
  }
8327
- set reserved1(value) {
8328
- this.set_reserved1(value);
8708
+ set funding_snapshot_lo(value) {
8709
+ this.set_funding_snapshot_lo(value);
8329
8710
  }
8330
- get_non_nullable_reserved() {
8331
- const offset = 120;
8711
+ get_funding_snapshot_hi() {
8712
+ const offset = 112;
8332
8713
  return this.view.getBigUint64(offset, true);
8333
8714
  }
8334
- set_non_nullable_reserved(value) {
8335
- const offset = 120;
8715
+ set_funding_snapshot_hi(value) {
8716
+ const offset = 112;
8717
+ this.view.setBigUint64(offset, value, true);
8718
+ }
8719
+ get funding_snapshot_hi() {
8720
+ return this.get_funding_snapshot_hi();
8721
+ }
8722
+ set funding_snapshot_hi(value) {
8723
+ this.set_funding_snapshot_hi(value);
8724
+ }
8725
+ get_non_nullable_reserved() {
8726
+ const offset = 120;
8727
+ return this.view.getBigUint64(offset, true);
8728
+ }
8729
+ set_non_nullable_reserved(value) {
8730
+ const offset = 120;
8336
8731
  this.view.setBigUint64(offset, value, true);
8337
8732
  }
8338
8733
  get non_nullable_reserved() {
@@ -8419,7 +8814,7 @@ var SeatEntryBuilder = class {
8419
8814
  this.view.setUint32(72, value, true);
8420
8815
  return this;
8421
8816
  }
8422
- set_reserved0(value) {
8817
+ set_funding_carry(value) {
8423
8818
  this.view.setUint32(76, value, true);
8424
8819
  return this;
8425
8820
  }
@@ -8438,12 +8833,14 @@ var SeatEntryBuilder = class {
8438
8833
  this.view.setBigUint64(96, cast, true);
8439
8834
  return this;
8440
8835
  }
8441
- set_reserved1(values) {
8442
- if (values.length !== 16) throw new Error("reserved1 expects 16 elements");
8443
- for (let i = 0; i < values.length; i++) {
8444
- const byteOffset = 104 + i * 1;
8445
- this.view.setUint8(byteOffset, values[i]);
8446
- }
8836
+ set_funding_snapshot_lo(value) {
8837
+ const cast = __tnToBigInt2(value);
8838
+ this.view.setBigUint64(104, cast, true);
8839
+ return this;
8840
+ }
8841
+ set_funding_snapshot_hi(value) {
8842
+ const cast = __tnToBigInt2(value);
8843
+ this.view.setBigUint64(112, cast, true);
8447
8844
  return this;
8448
8845
  }
8449
8846
  set_non_nullable_reserved(value) {
@@ -8472,6 +8869,153 @@ __tnRegisterDynamicValidate2("SeatEntry", (buffer) => {
8472
8869
  const params = result.params;
8473
8870
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
8474
8871
  });
8872
+ var __tn_ir_SettleFundingInstruction = {
8873
+ typeName: "SettleFundingInstruction",
8874
+ root: { op: "const", value: 7n }
8875
+ };
8876
+ var SettleFundingInstruction = class _SettleFundingInstruction {
8877
+ constructor(buffer) {
8878
+ this.buffer = buffer;
8879
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
8880
+ }
8881
+ static __tnCreateView(buffer, opts) {
8882
+ if (!buffer || buffer.length === void 0) throw new Error("SettleFundingInstruction.__tnCreateView requires a Uint8Array");
8883
+ return new _SettleFundingInstruction(new Uint8Array(buffer));
8884
+ }
8885
+ static builder() {
8886
+ return new SettleFundingInstructionBuilder();
8887
+ }
8888
+ static fromBuilder(builder) {
8889
+ const buffer = builder.build();
8890
+ return _SettleFundingInstruction.from_array(buffer);
8891
+ }
8892
+ get_market_record_idx() {
8893
+ const offset = 0;
8894
+ return this.view.getUint8(offset);
8895
+ }
8896
+ set_market_record_idx(value) {
8897
+ const offset = 0;
8898
+ this.view.setUint8(offset, value);
8899
+ }
8900
+ get market_record_idx() {
8901
+ return this.get_market_record_idx();
8902
+ }
8903
+ set market_record_idx(value) {
8904
+ this.set_market_record_idx(value);
8905
+ }
8906
+ get_reserved0() {
8907
+ const offset = 1;
8908
+ return this.view.getUint16(offset, true);
8909
+ }
8910
+ set_reserved0(value) {
8911
+ const offset = 1;
8912
+ this.view.setUint16(offset, value, true);
8913
+ }
8914
+ get reserved0() {
8915
+ return this.get_reserved0();
8916
+ }
8917
+ set reserved0(value) {
8918
+ this.set_reserved0(value);
8919
+ }
8920
+ get_target_seat_idx() {
8921
+ const offset = 3;
8922
+ return this.view.getUint32(offset, true);
8923
+ }
8924
+ set_target_seat_idx(value) {
8925
+ const offset = 3;
8926
+ this.view.setUint32(offset, value, true);
8927
+ }
8928
+ get target_seat_idx() {
8929
+ return this.get_target_seat_idx();
8930
+ }
8931
+ set target_seat_idx(value) {
8932
+ this.set_target_seat_idx(value);
8933
+ }
8934
+ static __tnFootprintInternal(__tnParams) {
8935
+ return __tnEvalFootprint2(__tn_ir_SettleFundingInstruction.root, { params: __tnParams });
8936
+ }
8937
+ static __tnValidateInternal(buffer, __tnParams) {
8938
+ return __tnValidateIrTree2(__tn_ir_SettleFundingInstruction, buffer, __tnParams);
8939
+ }
8940
+ static __tnInvokeFootprint(__tnParams) {
8941
+ return this.__tnFootprintInternal(__tnParams);
8942
+ }
8943
+ static __tnInvokeValidate(buffer, __tnParams) {
8944
+ return this.__tnValidateInternal(buffer, __tnParams);
8945
+ }
8946
+ static footprintIr() {
8947
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
8948
+ }
8949
+ static footprint() {
8950
+ const irResult = this.footprintIr();
8951
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
8952
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
8953
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for SettleFundingInstruction");
8954
+ }
8955
+ return __tnBigIntToNumber2(irResult, "SettleFundingInstruction::footprint");
8956
+ }
8957
+ static validate(buffer, _opts) {
8958
+ if (buffer.length < 7) return { ok: false, code: "tn.buffer_too_small", consumed: 7 };
8959
+ return { ok: true, consumed: 7 };
8960
+ }
8961
+ static new(market_record_idx, reserved0, target_seat_idx) {
8962
+ const buffer = new Uint8Array(7);
8963
+ const view = new DataView(buffer.buffer);
8964
+ view.setUint8(0, market_record_idx);
8965
+ view.setUint16(1, reserved0, true);
8966
+ view.setUint32(3, target_seat_idx, true);
8967
+ return new _SettleFundingInstruction(buffer);
8968
+ }
8969
+ static from_array(buffer) {
8970
+ if (!buffer || buffer.length === void 0) {
8971
+ return null;
8972
+ }
8973
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
8974
+ const validation = this.validate(buffer);
8975
+ if (!validation.ok) {
8976
+ return null;
8977
+ }
8978
+ return new _SettleFundingInstruction(buffer);
8979
+ }
8980
+ };
8981
+ var SettleFundingInstructionBuilder = class {
8982
+ constructor() {
8983
+ this.buffer = new Uint8Array(7);
8984
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
8985
+ }
8986
+ set_market_record_idx(value) {
8987
+ this.view.setUint8(0, value);
8988
+ return this;
8989
+ }
8990
+ set_reserved0(value) {
8991
+ this.view.setUint16(1, value, true);
8992
+ return this;
8993
+ }
8994
+ set_target_seat_idx(value) {
8995
+ this.view.setUint32(3, value, true);
8996
+ return this;
8997
+ }
8998
+ build() {
8999
+ return this.buffer.slice();
9000
+ }
9001
+ buildInto(target, offset = 0) {
9002
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
9003
+ target.set(this.buffer, offset);
9004
+ return target;
9005
+ }
9006
+ finish() {
9007
+ const view = SettleFundingInstruction.from_array(this.buffer.slice());
9008
+ if (!view) throw new Error("failed to build SettleFundingInstruction");
9009
+ return view;
9010
+ }
9011
+ };
9012
+ __tnRegisterFootprint2("SettleFundingInstruction", (params) => SettleFundingInstruction.__tnInvokeFootprint(params));
9013
+ __tnRegisterValidate2("SettleFundingInstruction", (buffer, params) => SettleFundingInstruction.__tnInvokeValidate(buffer, params));
9014
+ __tnRegisterDynamicValidate2("SettleFundingInstruction", (buffer) => {
9015
+ const result = SettleFundingInstruction.validate(buffer);
9016
+ const params = result.params;
9017
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
9018
+ });
8475
9019
  var __tn_ir_TokenBalanceEvent = {
8476
9020
  typeName: "TokenBalanceEvent",
8477
9021
  root: { op: "const", value: 168n }
@@ -10246,6 +10790,262 @@ __tnRegisterDynamicValidate2("ExchangeStatusEvent", (buffer) => {
10246
10790
  const params = result.params;
10247
10791
  return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
10248
10792
  });
10793
+ var __tn_ir_FundingRoundEvent = {
10794
+ typeName: "FundingRoundEvent",
10795
+ root: { op: "const", value: 88n }
10796
+ };
10797
+ var FundingRoundEvent = class _FundingRoundEvent {
10798
+ constructor(buffer) {
10799
+ this.buffer = buffer;
10800
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
10801
+ }
10802
+ static __tnCreateView(buffer, opts) {
10803
+ if (!buffer || buffer.length === void 0) throw new Error("FundingRoundEvent.__tnCreateView requires a Uint8Array");
10804
+ return new _FundingRoundEvent(new Uint8Array(buffer));
10805
+ }
10806
+ static builder() {
10807
+ return new FundingRoundEventBuilder();
10808
+ }
10809
+ static fromBuilder(builder) {
10810
+ const buffer = builder.build();
10811
+ return _FundingRoundEvent.from_array(buffer);
10812
+ }
10813
+ get_market() {
10814
+ const offset = 0;
10815
+ const slice = this.buffer.subarray(offset, offset + 32);
10816
+ return Pubkey3.from_array(slice);
10817
+ }
10818
+ set_market(value) {
10819
+ const sourceBytes = value.buffer;
10820
+ const offset = 0;
10821
+ this.buffer.set(sourceBytes, offset);
10822
+ }
10823
+ get market() {
10824
+ return this.get_market();
10825
+ }
10826
+ set market(value) {
10827
+ this.set_market(value);
10828
+ }
10829
+ get_rate() {
10830
+ const offset = 32;
10831
+ return this.view.getBigInt64(offset, true);
10832
+ }
10833
+ set_rate(value) {
10834
+ const offset = 32;
10835
+ this.view.setBigInt64(offset, value, true);
10836
+ }
10837
+ get rate() {
10838
+ return this.get_rate();
10839
+ }
10840
+ set rate(value) {
10841
+ this.set_rate(value);
10842
+ }
10843
+ get_premium_sum() {
10844
+ const offset = 40;
10845
+ return this.view.getBigInt64(offset, true);
10846
+ }
10847
+ set_premium_sum(value) {
10848
+ const offset = 40;
10849
+ this.view.setBigInt64(offset, value, true);
10850
+ }
10851
+ get premium_sum() {
10852
+ return this.get_premium_sum();
10853
+ }
10854
+ set premium_sum(value) {
10855
+ this.set_premium_sum(value);
10856
+ }
10857
+ get_sample_cnt() {
10858
+ const offset = 48;
10859
+ return this.view.getUint32(offset, true);
10860
+ }
10861
+ set_sample_cnt(value) {
10862
+ const offset = 48;
10863
+ this.view.setUint32(offset, value, true);
10864
+ }
10865
+ get sample_cnt() {
10866
+ return this.get_sample_cnt();
10867
+ }
10868
+ set sample_cnt(value) {
10869
+ this.set_sample_cnt(value);
10870
+ }
10871
+ get_reserved0() {
10872
+ const offset = 52;
10873
+ return this.view.getUint32(offset, true);
10874
+ }
10875
+ set_reserved0(value) {
10876
+ const offset = 52;
10877
+ this.view.setUint32(offset, value, true);
10878
+ }
10879
+ get reserved0() {
10880
+ return this.get_reserved0();
10881
+ }
10882
+ set reserved0(value) {
10883
+ this.set_reserved0(value);
10884
+ }
10885
+ get_index_price() {
10886
+ const offset = 56;
10887
+ return this.view.getBigUint64(offset, true);
10888
+ }
10889
+ set_index_price(value) {
10890
+ const offset = 56;
10891
+ this.view.setBigUint64(offset, value, true);
10892
+ }
10893
+ get index_price() {
10894
+ return this.get_index_price();
10895
+ }
10896
+ set index_price(value) {
10897
+ this.set_index_price(value);
10898
+ }
10899
+ get_funding_index_lo() {
10900
+ const offset = 64;
10901
+ return this.view.getBigUint64(offset, true);
10902
+ }
10903
+ set_funding_index_lo(value) {
10904
+ const offset = 64;
10905
+ this.view.setBigUint64(offset, value, true);
10906
+ }
10907
+ get funding_index_lo() {
10908
+ return this.get_funding_index_lo();
10909
+ }
10910
+ set funding_index_lo(value) {
10911
+ this.set_funding_index_lo(value);
10912
+ }
10913
+ get_funding_index_hi() {
10914
+ const offset = 72;
10915
+ return this.view.getBigUint64(offset, true);
10916
+ }
10917
+ set_funding_index_hi(value) {
10918
+ const offset = 72;
10919
+ this.view.setBigUint64(offset, value, true);
10920
+ }
10921
+ get funding_index_hi() {
10922
+ return this.get_funding_index_hi();
10923
+ }
10924
+ set funding_index_hi(value) {
10925
+ this.set_funding_index_hi(value);
10926
+ }
10927
+ get_round_ns() {
10928
+ const offset = 80;
10929
+ return this.view.getBigUint64(offset, true);
10930
+ }
10931
+ set_round_ns(value) {
10932
+ const offset = 80;
10933
+ this.view.setBigUint64(offset, value, true);
10934
+ }
10935
+ get round_ns() {
10936
+ return this.get_round_ns();
10937
+ }
10938
+ set round_ns(value) {
10939
+ this.set_round_ns(value);
10940
+ }
10941
+ static __tnFootprintInternal(__tnParams) {
10942
+ return __tnEvalFootprint2(__tn_ir_FundingRoundEvent.root, { params: __tnParams });
10943
+ }
10944
+ static __tnValidateInternal(buffer, __tnParams) {
10945
+ return __tnValidateIrTree2(__tn_ir_FundingRoundEvent, buffer, __tnParams);
10946
+ }
10947
+ static __tnInvokeFootprint(__tnParams) {
10948
+ return this.__tnFootprintInternal(__tnParams);
10949
+ }
10950
+ static __tnInvokeValidate(buffer, __tnParams) {
10951
+ return this.__tnValidateInternal(buffer, __tnParams);
10952
+ }
10953
+ static footprintIr() {
10954
+ return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
10955
+ }
10956
+ static footprint() {
10957
+ const irResult = this.footprintIr();
10958
+ const maxSafe = __tnToBigInt2(Number.MAX_SAFE_INTEGER);
10959
+ if (__tnBigIntGreaterThan2(irResult, maxSafe)) {
10960
+ throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for FundingRoundEvent");
10961
+ }
10962
+ return __tnBigIntToNumber2(irResult, "FundingRoundEvent::footprint");
10963
+ }
10964
+ static validate(buffer, _opts) {
10965
+ if (buffer.length < 88) return { ok: false, code: "tn.buffer_too_small", consumed: 88 };
10966
+ return { ok: true, consumed: 88 };
10967
+ }
10968
+ static from_array(buffer) {
10969
+ if (!buffer || buffer.length === void 0) {
10970
+ return null;
10971
+ }
10972
+ new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
10973
+ const validation = this.validate(buffer);
10974
+ if (!validation.ok) {
10975
+ return null;
10976
+ }
10977
+ return new _FundingRoundEvent(buffer);
10978
+ }
10979
+ };
10980
+ var FundingRoundEventBuilder = class {
10981
+ constructor() {
10982
+ this.buffer = new Uint8Array(88);
10983
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
10984
+ }
10985
+ set_market(value) {
10986
+ if (value.length !== 32) throw new Error("market expects 32 bytes");
10987
+ this.buffer.set(value, 0);
10988
+ return this;
10989
+ }
10990
+ set_rate(value) {
10991
+ const cast = __tnToBigInt2(value);
10992
+ this.view.setBigInt64(32, cast, true);
10993
+ return this;
10994
+ }
10995
+ set_premium_sum(value) {
10996
+ const cast = __tnToBigInt2(value);
10997
+ this.view.setBigInt64(40, cast, true);
10998
+ return this;
10999
+ }
11000
+ set_sample_cnt(value) {
11001
+ this.view.setUint32(48, value, true);
11002
+ return this;
11003
+ }
11004
+ set_reserved0(value) {
11005
+ this.view.setUint32(52, value, true);
11006
+ return this;
11007
+ }
11008
+ set_index_price(value) {
11009
+ const cast = __tnToBigInt2(value);
11010
+ this.view.setBigUint64(56, cast, true);
11011
+ return this;
11012
+ }
11013
+ set_funding_index_lo(value) {
11014
+ const cast = __tnToBigInt2(value);
11015
+ this.view.setBigUint64(64, cast, true);
11016
+ return this;
11017
+ }
11018
+ set_funding_index_hi(value) {
11019
+ const cast = __tnToBigInt2(value);
11020
+ this.view.setBigUint64(72, cast, true);
11021
+ return this;
11022
+ }
11023
+ set_round_ns(value) {
11024
+ const cast = __tnToBigInt2(value);
11025
+ this.view.setBigUint64(80, cast, true);
11026
+ return this;
11027
+ }
11028
+ build() {
11029
+ return this.buffer.slice();
11030
+ }
11031
+ buildInto(target, offset = 0) {
11032
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
11033
+ target.set(this.buffer, offset);
11034
+ return target;
11035
+ }
11036
+ finish() {
11037
+ const view = FundingRoundEvent.from_array(this.buffer.slice());
11038
+ if (!view) throw new Error("failed to build FundingRoundEvent");
11039
+ return view;
11040
+ }
11041
+ };
11042
+ __tnRegisterFootprint2("FundingRoundEvent", (params) => FundingRoundEvent.__tnInvokeFootprint(params));
11043
+ __tnRegisterValidate2("FundingRoundEvent", (buffer, params) => FundingRoundEvent.__tnInvokeValidate(buffer, params));
11044
+ __tnRegisterDynamicValidate2("FundingRoundEvent", (buffer) => {
11045
+ const result = FundingRoundEvent.validate(buffer);
11046
+ const params = result.params;
11047
+ return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
11048
+ });
10249
11049
  var __tn_ir_LiquidationEvent = {
10250
11050
  typeName: "LiquidationEvent",
10251
11051
  root: { op: "const", value: 160n }
@@ -10595,7 +11395,7 @@ __tnRegisterDynamicValidate2("LiquidationEvent", (buffer) => {
10595
11395
  });
10596
11396
  var __tn_ir_MarketAccount = {
10597
11397
  typeName: "MarketAccount",
10598
- root: { op: "const", value: 320n }
11398
+ root: { op: "const", value: 448n }
10599
11399
  };
10600
11400
  var MarketAccount = class _MarketAccount {
10601
11401
  constructor(buffer) {
@@ -10964,34 +11764,253 @@ var MarketAccount = class _MarketAccount {
10964
11764
  const offset = 288;
10965
11765
  this.view.setBigUint64(offset, value, true);
10966
11766
  }
10967
- get max_mark_age_ns() {
10968
- return this.get_max_mark_age_ns();
11767
+ get max_mark_age_ns() {
11768
+ return this.get_max_mark_age_ns();
11769
+ }
11770
+ set max_mark_age_ns(value) {
11771
+ this.set_max_mark_age_ns(value);
11772
+ }
11773
+ get_reserved2() {
11774
+ const offset = 296;
11775
+ const result = [];
11776
+ for (let i = 0; i < 24; i++) {
11777
+ result.push(this.view.getUint8(offset + i * 1));
11778
+ }
11779
+ return result;
11780
+ }
11781
+ set_reserved2(value) {
11782
+ const offset = 296;
11783
+ if (value.length !== 24) {
11784
+ throw new Error("Array length must be 24");
11785
+ }
11786
+ for (let i = 0; i < 24; i++) {
11787
+ this.view.setUint8(offset + i * 1, value[i]);
11788
+ }
11789
+ }
11790
+ get reserved2() {
11791
+ return this.get_reserved2();
11792
+ }
11793
+ set reserved2(value) {
11794
+ this.set_reserved2(value);
11795
+ }
11796
+ get_funding_index_lo() {
11797
+ const offset = 320;
11798
+ return this.view.getBigUint64(offset, true);
11799
+ }
11800
+ set_funding_index_lo(value) {
11801
+ const offset = 320;
11802
+ this.view.setBigUint64(offset, value, true);
11803
+ }
11804
+ get funding_index_lo() {
11805
+ return this.get_funding_index_lo();
11806
+ }
11807
+ set funding_index_lo(value) {
11808
+ this.set_funding_index_lo(value);
11809
+ }
11810
+ get_funding_index_hi() {
11811
+ const offset = 328;
11812
+ return this.view.getBigUint64(offset, true);
11813
+ }
11814
+ set_funding_index_hi(value) {
11815
+ const offset = 328;
11816
+ this.view.setBigUint64(offset, value, true);
11817
+ }
11818
+ get funding_index_hi() {
11819
+ return this.get_funding_index_hi();
11820
+ }
11821
+ set funding_index_hi(value) {
11822
+ this.set_funding_index_hi(value);
11823
+ }
11824
+ get_funding_balance() {
11825
+ const offset = 336;
11826
+ return this.view.getBigInt64(offset, true);
11827
+ }
11828
+ set_funding_balance(value) {
11829
+ const offset = 336;
11830
+ this.view.setBigInt64(offset, value, true);
11831
+ }
11832
+ get funding_balance() {
11833
+ return this.get_funding_balance();
11834
+ }
11835
+ set funding_balance(value) {
11836
+ this.set_funding_balance(value);
11837
+ }
11838
+ get_funding_last_round_ns() {
11839
+ const offset = 344;
11840
+ return this.view.getBigUint64(offset, true);
11841
+ }
11842
+ set_funding_last_round_ns(value) {
11843
+ const offset = 344;
11844
+ this.view.setBigUint64(offset, value, true);
11845
+ }
11846
+ get funding_last_round_ns() {
11847
+ return this.get_funding_last_round_ns();
11848
+ }
11849
+ set funding_last_round_ns(value) {
11850
+ this.set_funding_last_round_ns(value);
11851
+ }
11852
+ get_funding_last_sample_ns() {
11853
+ const offset = 352;
11854
+ return this.view.getBigUint64(offset, true);
11855
+ }
11856
+ set_funding_last_sample_ns(value) {
11857
+ const offset = 352;
11858
+ this.view.setBigUint64(offset, value, true);
11859
+ }
11860
+ get funding_last_sample_ns() {
11861
+ return this.get_funding_last_sample_ns();
11862
+ }
11863
+ set funding_last_sample_ns(value) {
11864
+ this.set_funding_last_sample_ns(value);
11865
+ }
11866
+ get_funding_premium_sum() {
11867
+ const offset = 360;
11868
+ return this.view.getBigInt64(offset, true);
11869
+ }
11870
+ set_funding_premium_sum(value) {
11871
+ const offset = 360;
11872
+ this.view.setBigInt64(offset, value, true);
11873
+ }
11874
+ get funding_premium_sum() {
11875
+ return this.get_funding_premium_sum();
11876
+ }
11877
+ set funding_premium_sum(value) {
11878
+ this.set_funding_premium_sum(value);
11879
+ }
11880
+ get_funding_impact_notional() {
11881
+ const offset = 368;
11882
+ return this.view.getBigUint64(offset, true);
11883
+ }
11884
+ set_funding_impact_notional(value) {
11885
+ const offset = 368;
11886
+ this.view.setBigUint64(offset, value, true);
11887
+ }
11888
+ get funding_impact_notional() {
11889
+ return this.get_funding_impact_notional();
11890
+ }
11891
+ set funding_impact_notional(value) {
11892
+ this.set_funding_impact_notional(value);
11893
+ }
11894
+ get_funding_rate() {
11895
+ const offset = 376;
11896
+ return this.view.getBigInt64(offset, true);
11897
+ }
11898
+ set_funding_rate(value) {
11899
+ const offset = 376;
11900
+ this.view.setBigInt64(offset, value, true);
11901
+ }
11902
+ get funding_rate() {
11903
+ return this.get_funding_rate();
11904
+ }
11905
+ set funding_rate(value) {
11906
+ this.set_funding_rate(value);
11907
+ }
11908
+ get_funding_interest_rate() {
11909
+ const offset = 384;
11910
+ return this.view.getUint32(offset, true);
11911
+ }
11912
+ set_funding_interest_rate(value) {
11913
+ const offset = 384;
11914
+ this.view.setUint32(offset, value, true);
11915
+ }
11916
+ get funding_interest_rate() {
11917
+ return this.get_funding_interest_rate();
11918
+ }
11919
+ set funding_interest_rate(value) {
11920
+ this.set_funding_interest_rate(value);
11921
+ }
11922
+ get_funding_clamp_small() {
11923
+ const offset = 388;
11924
+ return this.view.getUint32(offset, true);
11925
+ }
11926
+ set_funding_clamp_small(value) {
11927
+ const offset = 388;
11928
+ this.view.setUint32(offset, value, true);
11929
+ }
11930
+ get funding_clamp_small() {
11931
+ return this.get_funding_clamp_small();
11932
+ }
11933
+ set funding_clamp_small(value) {
11934
+ this.set_funding_clamp_small(value);
11935
+ }
11936
+ get_funding_clamp_big() {
11937
+ const offset = 392;
11938
+ return this.view.getUint32(offset, true);
11939
+ }
11940
+ set_funding_clamp_big(value) {
11941
+ const offset = 392;
11942
+ this.view.setUint32(offset, value, true);
11943
+ }
11944
+ get funding_clamp_big() {
11945
+ return this.get_funding_clamp_big();
11946
+ }
11947
+ set funding_clamp_big(value) {
11948
+ this.set_funding_clamp_big(value);
11949
+ }
11950
+ get_funding_premium_multiplier() {
11951
+ const offset = 396;
11952
+ return this.view.getUint32(offset, true);
11953
+ }
11954
+ set_funding_premium_multiplier(value) {
11955
+ const offset = 396;
11956
+ this.view.setUint32(offset, value, true);
11957
+ }
11958
+ get funding_premium_multiplier() {
11959
+ return this.get_funding_premium_multiplier();
11960
+ }
11961
+ set funding_premium_multiplier(value) {
11962
+ this.set_funding_premium_multiplier(value);
11963
+ }
11964
+ get_funding_sample_cnt() {
11965
+ const offset = 400;
11966
+ return this.view.getUint32(offset, true);
11967
+ }
11968
+ set_funding_sample_cnt(value) {
11969
+ const offset = 400;
11970
+ this.view.setUint32(offset, value, true);
11971
+ }
11972
+ get funding_sample_cnt() {
11973
+ return this.get_funding_sample_cnt();
11974
+ }
11975
+ set funding_sample_cnt(value) {
11976
+ this.set_funding_sample_cnt(value);
11977
+ }
11978
+ get_reserved3() {
11979
+ const offset = 404;
11980
+ return this.view.getUint32(offset, true);
11981
+ }
11982
+ set_reserved3(value) {
11983
+ const offset = 404;
11984
+ this.view.setUint32(offset, value, true);
10969
11985
  }
10970
- set max_mark_age_ns(value) {
10971
- this.set_max_mark_age_ns(value);
11986
+ get reserved3() {
11987
+ return this.get_reserved3();
10972
11988
  }
10973
- get_reserved2() {
10974
- const offset = 296;
11989
+ set reserved3(value) {
11990
+ this.set_reserved3(value);
11991
+ }
11992
+ get_reserved4() {
11993
+ const offset = 408;
10975
11994
  const result = [];
10976
- for (let i = 0; i < 24; i++) {
11995
+ for (let i = 0; i < 40; i++) {
10977
11996
  result.push(this.view.getUint8(offset + i * 1));
10978
11997
  }
10979
11998
  return result;
10980
11999
  }
10981
- set_reserved2(value) {
10982
- const offset = 296;
10983
- if (value.length !== 24) {
10984
- throw new Error("Array length must be 24");
12000
+ set_reserved4(value) {
12001
+ const offset = 408;
12002
+ if (value.length !== 40) {
12003
+ throw new Error("Array length must be 40");
10985
12004
  }
10986
- for (let i = 0; i < 24; i++) {
12005
+ for (let i = 0; i < 40; i++) {
10987
12006
  this.view.setUint8(offset + i * 1, value[i]);
10988
12007
  }
10989
12008
  }
10990
- get reserved2() {
10991
- return this.get_reserved2();
12009
+ get reserved4() {
12010
+ return this.get_reserved4();
10992
12011
  }
10993
- set reserved2(value) {
10994
- this.set_reserved2(value);
12012
+ set reserved4(value) {
12013
+ this.set_reserved4(value);
10995
12014
  }
10996
12015
  static __tnFootprintInternal(__tnParams) {
10997
12016
  return __tnEvalFootprint2(__tn_ir_MarketAccount.root, { params: __tnParams });
@@ -11017,8 +12036,8 @@ var MarketAccount = class _MarketAccount {
11017
12036
  return __tnBigIntToNumber2(irResult, "MarketAccount::footprint");
11018
12037
  }
11019
12038
  static validate(buffer, _opts) {
11020
- if (buffer.length < 320) return { ok: false, code: "tn.buffer_too_small", consumed: 320 };
11021
- return { ok: true, consumed: 320 };
12039
+ if (buffer.length < 448) return { ok: false, code: "tn.buffer_too_small", consumed: 448 };
12040
+ return { ok: true, consumed: 448 };
11022
12041
  }
11023
12042
  static from_array(buffer) {
11024
12043
  if (!buffer || buffer.length === void 0) {
@@ -11034,7 +12053,7 @@ var MarketAccount = class _MarketAccount {
11034
12053
  };
11035
12054
  var MarketAccountBuilder = class {
11036
12055
  constructor() {
11037
- this.buffer = new Uint8Array(320);
12056
+ this.buffer = new Uint8Array(448);
11038
12057
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
11039
12058
  }
11040
12059
  set_magic(value) {
@@ -11161,6 +12180,78 @@ var MarketAccountBuilder = class {
11161
12180
  }
11162
12181
  return this;
11163
12182
  }
12183
+ set_funding_index_lo(value) {
12184
+ const cast = __tnToBigInt2(value);
12185
+ this.view.setBigUint64(320, cast, true);
12186
+ return this;
12187
+ }
12188
+ set_funding_index_hi(value) {
12189
+ const cast = __tnToBigInt2(value);
12190
+ this.view.setBigUint64(328, cast, true);
12191
+ return this;
12192
+ }
12193
+ set_funding_balance(value) {
12194
+ const cast = __tnToBigInt2(value);
12195
+ this.view.setBigInt64(336, cast, true);
12196
+ return this;
12197
+ }
12198
+ set_funding_last_round_ns(value) {
12199
+ const cast = __tnToBigInt2(value);
12200
+ this.view.setBigUint64(344, cast, true);
12201
+ return this;
12202
+ }
12203
+ set_funding_last_sample_ns(value) {
12204
+ const cast = __tnToBigInt2(value);
12205
+ this.view.setBigUint64(352, cast, true);
12206
+ return this;
12207
+ }
12208
+ set_funding_premium_sum(value) {
12209
+ const cast = __tnToBigInt2(value);
12210
+ this.view.setBigInt64(360, cast, true);
12211
+ return this;
12212
+ }
12213
+ set_funding_impact_notional(value) {
12214
+ const cast = __tnToBigInt2(value);
12215
+ this.view.setBigUint64(368, cast, true);
12216
+ return this;
12217
+ }
12218
+ set_funding_rate(value) {
12219
+ const cast = __tnToBigInt2(value);
12220
+ this.view.setBigInt64(376, cast, true);
12221
+ return this;
12222
+ }
12223
+ set_funding_interest_rate(value) {
12224
+ this.view.setUint32(384, value, true);
12225
+ return this;
12226
+ }
12227
+ set_funding_clamp_small(value) {
12228
+ this.view.setUint32(388, value, true);
12229
+ return this;
12230
+ }
12231
+ set_funding_clamp_big(value) {
12232
+ this.view.setUint32(392, value, true);
12233
+ return this;
12234
+ }
12235
+ set_funding_premium_multiplier(value) {
12236
+ this.view.setUint32(396, value, true);
12237
+ return this;
12238
+ }
12239
+ set_funding_sample_cnt(value) {
12240
+ this.view.setUint32(400, value, true);
12241
+ return this;
12242
+ }
12243
+ set_reserved3(value) {
12244
+ this.view.setUint32(404, value, true);
12245
+ return this;
12246
+ }
12247
+ set_reserved4(values) {
12248
+ if (values.length !== 40) throw new Error("reserved4 expects 40 elements");
12249
+ for (let i = 0; i < values.length; i++) {
12250
+ const byteOffset = 408 + i * 1;
12251
+ this.view.setUint8(byteOffset, values[i]);
12252
+ }
12253
+ return this;
12254
+ }
11164
12255
  build() {
11165
12256
  return this.buffer.slice();
11166
12257
  }
@@ -11184,7 +12275,7 @@ __tnRegisterDynamicValidate2("MarketAccount", (buffer) => {
11184
12275
  });
11185
12276
  var __tn_ir_MarketAccountPayload = {
11186
12277
  typeName: "MarketAccountPayload",
11187
- root: { op: "const", value: 319n }
12278
+ root: { op: "const", value: 447n }
11188
12279
  };
11189
12280
  var MarketAccountPayload = class _MarketAccountPayload {
11190
12281
  constructor(buffer) {
@@ -11568,6 +12659,225 @@ var MarketAccountPayload = class _MarketAccountPayload {
11568
12659
  set reserved2(value) {
11569
12660
  this.set_reserved2(value);
11570
12661
  }
12662
+ get_funding_index_lo() {
12663
+ const offset = 319;
12664
+ return this.view.getBigUint64(offset, true);
12665
+ }
12666
+ set_funding_index_lo(value) {
12667
+ const offset = 319;
12668
+ this.view.setBigUint64(offset, value, true);
12669
+ }
12670
+ get funding_index_lo() {
12671
+ return this.get_funding_index_lo();
12672
+ }
12673
+ set funding_index_lo(value) {
12674
+ this.set_funding_index_lo(value);
12675
+ }
12676
+ get_funding_index_hi() {
12677
+ const offset = 327;
12678
+ return this.view.getBigUint64(offset, true);
12679
+ }
12680
+ set_funding_index_hi(value) {
12681
+ const offset = 327;
12682
+ this.view.setBigUint64(offset, value, true);
12683
+ }
12684
+ get funding_index_hi() {
12685
+ return this.get_funding_index_hi();
12686
+ }
12687
+ set funding_index_hi(value) {
12688
+ this.set_funding_index_hi(value);
12689
+ }
12690
+ get_funding_balance() {
12691
+ const offset = 335;
12692
+ return this.view.getBigInt64(offset, true);
12693
+ }
12694
+ set_funding_balance(value) {
12695
+ const offset = 335;
12696
+ this.view.setBigInt64(offset, value, true);
12697
+ }
12698
+ get funding_balance() {
12699
+ return this.get_funding_balance();
12700
+ }
12701
+ set funding_balance(value) {
12702
+ this.set_funding_balance(value);
12703
+ }
12704
+ get_funding_last_round_ns() {
12705
+ const offset = 343;
12706
+ return this.view.getBigUint64(offset, true);
12707
+ }
12708
+ set_funding_last_round_ns(value) {
12709
+ const offset = 343;
12710
+ this.view.setBigUint64(offset, value, true);
12711
+ }
12712
+ get funding_last_round_ns() {
12713
+ return this.get_funding_last_round_ns();
12714
+ }
12715
+ set funding_last_round_ns(value) {
12716
+ this.set_funding_last_round_ns(value);
12717
+ }
12718
+ get_funding_last_sample_ns() {
12719
+ const offset = 351;
12720
+ return this.view.getBigUint64(offset, true);
12721
+ }
12722
+ set_funding_last_sample_ns(value) {
12723
+ const offset = 351;
12724
+ this.view.setBigUint64(offset, value, true);
12725
+ }
12726
+ get funding_last_sample_ns() {
12727
+ return this.get_funding_last_sample_ns();
12728
+ }
12729
+ set funding_last_sample_ns(value) {
12730
+ this.set_funding_last_sample_ns(value);
12731
+ }
12732
+ get_funding_premium_sum() {
12733
+ const offset = 359;
12734
+ return this.view.getBigInt64(offset, true);
12735
+ }
12736
+ set_funding_premium_sum(value) {
12737
+ const offset = 359;
12738
+ this.view.setBigInt64(offset, value, true);
12739
+ }
12740
+ get funding_premium_sum() {
12741
+ return this.get_funding_premium_sum();
12742
+ }
12743
+ set funding_premium_sum(value) {
12744
+ this.set_funding_premium_sum(value);
12745
+ }
12746
+ get_funding_impact_notional() {
12747
+ const offset = 367;
12748
+ return this.view.getBigUint64(offset, true);
12749
+ }
12750
+ set_funding_impact_notional(value) {
12751
+ const offset = 367;
12752
+ this.view.setBigUint64(offset, value, true);
12753
+ }
12754
+ get funding_impact_notional() {
12755
+ return this.get_funding_impact_notional();
12756
+ }
12757
+ set funding_impact_notional(value) {
12758
+ this.set_funding_impact_notional(value);
12759
+ }
12760
+ get_funding_rate() {
12761
+ const offset = 375;
12762
+ return this.view.getBigInt64(offset, true);
12763
+ }
12764
+ set_funding_rate(value) {
12765
+ const offset = 375;
12766
+ this.view.setBigInt64(offset, value, true);
12767
+ }
12768
+ get funding_rate() {
12769
+ return this.get_funding_rate();
12770
+ }
12771
+ set funding_rate(value) {
12772
+ this.set_funding_rate(value);
12773
+ }
12774
+ get_funding_interest_rate() {
12775
+ const offset = 383;
12776
+ return this.view.getUint32(offset, true);
12777
+ }
12778
+ set_funding_interest_rate(value) {
12779
+ const offset = 383;
12780
+ this.view.setUint32(offset, value, true);
12781
+ }
12782
+ get funding_interest_rate() {
12783
+ return this.get_funding_interest_rate();
12784
+ }
12785
+ set funding_interest_rate(value) {
12786
+ this.set_funding_interest_rate(value);
12787
+ }
12788
+ get_funding_clamp_small() {
12789
+ const offset = 387;
12790
+ return this.view.getUint32(offset, true);
12791
+ }
12792
+ set_funding_clamp_small(value) {
12793
+ const offset = 387;
12794
+ this.view.setUint32(offset, value, true);
12795
+ }
12796
+ get funding_clamp_small() {
12797
+ return this.get_funding_clamp_small();
12798
+ }
12799
+ set funding_clamp_small(value) {
12800
+ this.set_funding_clamp_small(value);
12801
+ }
12802
+ get_funding_clamp_big() {
12803
+ const offset = 391;
12804
+ return this.view.getUint32(offset, true);
12805
+ }
12806
+ set_funding_clamp_big(value) {
12807
+ const offset = 391;
12808
+ this.view.setUint32(offset, value, true);
12809
+ }
12810
+ get funding_clamp_big() {
12811
+ return this.get_funding_clamp_big();
12812
+ }
12813
+ set funding_clamp_big(value) {
12814
+ this.set_funding_clamp_big(value);
12815
+ }
12816
+ get_funding_premium_multiplier() {
12817
+ const offset = 395;
12818
+ return this.view.getUint32(offset, true);
12819
+ }
12820
+ set_funding_premium_multiplier(value) {
12821
+ const offset = 395;
12822
+ this.view.setUint32(offset, value, true);
12823
+ }
12824
+ get funding_premium_multiplier() {
12825
+ return this.get_funding_premium_multiplier();
12826
+ }
12827
+ set funding_premium_multiplier(value) {
12828
+ this.set_funding_premium_multiplier(value);
12829
+ }
12830
+ get_funding_sample_cnt() {
12831
+ const offset = 399;
12832
+ return this.view.getUint32(offset, true);
12833
+ }
12834
+ set_funding_sample_cnt(value) {
12835
+ const offset = 399;
12836
+ this.view.setUint32(offset, value, true);
12837
+ }
12838
+ get funding_sample_cnt() {
12839
+ return this.get_funding_sample_cnt();
12840
+ }
12841
+ set funding_sample_cnt(value) {
12842
+ this.set_funding_sample_cnt(value);
12843
+ }
12844
+ get_reserved3() {
12845
+ const offset = 403;
12846
+ return this.view.getUint32(offset, true);
12847
+ }
12848
+ set_reserved3(value) {
12849
+ const offset = 403;
12850
+ this.view.setUint32(offset, value, true);
12851
+ }
12852
+ get reserved3() {
12853
+ return this.get_reserved3();
12854
+ }
12855
+ set reserved3(value) {
12856
+ this.set_reserved3(value);
12857
+ }
12858
+ get_reserved4() {
12859
+ const offset = 407;
12860
+ const result = [];
12861
+ for (let i = 0; i < 40; i++) {
12862
+ result.push(this.view.getUint8(offset + i * 1));
12863
+ }
12864
+ return result;
12865
+ }
12866
+ set_reserved4(value) {
12867
+ const offset = 407;
12868
+ if (value.length !== 40) {
12869
+ throw new Error("Array length must be 40");
12870
+ }
12871
+ for (let i = 0; i < 40; i++) {
12872
+ this.view.setUint8(offset + i * 1, value[i]);
12873
+ }
12874
+ }
12875
+ get reserved4() {
12876
+ return this.get_reserved4();
12877
+ }
12878
+ set reserved4(value) {
12879
+ this.set_reserved4(value);
12880
+ }
11571
12881
  static __tnFootprintInternal(__tnParams) {
11572
12882
  return __tnEvalFootprint2(__tn_ir_MarketAccountPayload.root, { params: __tnParams });
11573
12883
  }
@@ -11592,8 +12902,8 @@ var MarketAccountPayload = class _MarketAccountPayload {
11592
12902
  return __tnBigIntToNumber2(irResult, "MarketAccountPayload::footprint");
11593
12903
  }
11594
12904
  static validate(buffer, _opts) {
11595
- if (buffer.length < 319) return { ok: false, code: "tn.buffer_too_small", consumed: 319 };
11596
- return { ok: true, consumed: 319 };
12905
+ if (buffer.length < 447) return { ok: false, code: "tn.buffer_too_small", consumed: 447 };
12906
+ return { ok: true, consumed: 447 };
11597
12907
  }
11598
12908
  static from_array(buffer) {
11599
12909
  if (!buffer || buffer.length === void 0) {
@@ -11609,7 +12919,7 @@ var MarketAccountPayload = class _MarketAccountPayload {
11609
12919
  };
11610
12920
  var MarketAccountPayloadBuilder = class {
11611
12921
  constructor() {
11612
- this.buffer = new Uint8Array(319);
12922
+ this.buffer = new Uint8Array(447);
11613
12923
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
11614
12924
  }
11615
12925
  set_status_flags(value) {
@@ -11732,6 +13042,78 @@ var MarketAccountPayloadBuilder = class {
11732
13042
  }
11733
13043
  return this;
11734
13044
  }
13045
+ set_funding_index_lo(value) {
13046
+ const cast = __tnToBigInt2(value);
13047
+ this.view.setBigUint64(319, cast, true);
13048
+ return this;
13049
+ }
13050
+ set_funding_index_hi(value) {
13051
+ const cast = __tnToBigInt2(value);
13052
+ this.view.setBigUint64(327, cast, true);
13053
+ return this;
13054
+ }
13055
+ set_funding_balance(value) {
13056
+ const cast = __tnToBigInt2(value);
13057
+ this.view.setBigInt64(335, cast, true);
13058
+ return this;
13059
+ }
13060
+ set_funding_last_round_ns(value) {
13061
+ const cast = __tnToBigInt2(value);
13062
+ this.view.setBigUint64(343, cast, true);
13063
+ return this;
13064
+ }
13065
+ set_funding_last_sample_ns(value) {
13066
+ const cast = __tnToBigInt2(value);
13067
+ this.view.setBigUint64(351, cast, true);
13068
+ return this;
13069
+ }
13070
+ set_funding_premium_sum(value) {
13071
+ const cast = __tnToBigInt2(value);
13072
+ this.view.setBigInt64(359, cast, true);
13073
+ return this;
13074
+ }
13075
+ set_funding_impact_notional(value) {
13076
+ const cast = __tnToBigInt2(value);
13077
+ this.view.setBigUint64(367, cast, true);
13078
+ return this;
13079
+ }
13080
+ set_funding_rate(value) {
13081
+ const cast = __tnToBigInt2(value);
13082
+ this.view.setBigInt64(375, cast, true);
13083
+ return this;
13084
+ }
13085
+ set_funding_interest_rate(value) {
13086
+ this.view.setUint32(383, value, true);
13087
+ return this;
13088
+ }
13089
+ set_funding_clamp_small(value) {
13090
+ this.view.setUint32(387, value, true);
13091
+ return this;
13092
+ }
13093
+ set_funding_clamp_big(value) {
13094
+ this.view.setUint32(391, value, true);
13095
+ return this;
13096
+ }
13097
+ set_funding_premium_multiplier(value) {
13098
+ this.view.setUint32(395, value, true);
13099
+ return this;
13100
+ }
13101
+ set_funding_sample_cnt(value) {
13102
+ this.view.setUint32(399, value, true);
13103
+ return this;
13104
+ }
13105
+ set_reserved3(value) {
13106
+ this.view.setUint32(403, value, true);
13107
+ return this;
13108
+ }
13109
+ set_reserved4(values) {
13110
+ if (values.length !== 40) throw new Error("reserved4 expects 40 elements");
13111
+ for (let i = 0; i < values.length; i++) {
13112
+ const byteOffset = 407 + i * 1;
13113
+ this.view.setUint8(byteOffset, values[i]);
13114
+ }
13115
+ return this;
13116
+ }
11735
13117
  build() {
11736
13118
  return this.buffer.slice();
11737
13119
  }
@@ -14100,7 +15482,7 @@ __tnRegisterDynamicValidate2("OrderPostedEvent", (buffer) => {
14100
15482
  });
14101
15483
  var __tn_ir_PerpEvent = {
14102
15484
  typeName: "PerpEvent",
14103
- 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 } } }] } } } }
15485
+ 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 } } }] } } } }
14104
15486
  };
14105
15487
  var PerpEvent_payload_Inner = class _PerpEvent_payload_Inner {
14106
15488
  constructor(buffer, descriptor, fieldContext) {
@@ -14179,6 +15561,10 @@ var PerpEvent_payload_Inner = class _PerpEvent_payload_Inner {
14179
15561
  if (!this.descriptor || this.descriptor.tag !== 15) return null;
14180
15562
  return LiquidationEvent.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
14181
15563
  }
15564
+ asFundingRound() {
15565
+ if (!this.descriptor || this.descriptor.tag !== 16) return null;
15566
+ return FundingRoundEvent.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
15567
+ }
14182
15568
  };
14183
15569
  var _PerpEvent = class _PerpEvent {
14184
15570
  constructor(buffer, params) {
@@ -14441,6 +15827,13 @@ _PerpEvent.payloadVariantDescriptors = Object.freeze([
14441
15827
  payloadSize: 160,
14442
15828
  payloadType: "PerpEvent::payload::liquidation",
14443
15829
  createPayloadBuilder: () => __tnMaybeCallBuilder(LiquidationEvent)
15830
+ },
15831
+ {
15832
+ name: "funding_round",
15833
+ tag: 16,
15834
+ payloadSize: 88,
15835
+ payloadType: "PerpEvent::payload::funding_round",
15836
+ createPayloadBuilder: () => __tnMaybeCallBuilder(FundingRoundEvent)
14444
15837
  }
14445
15838
  ]);
14446
15839
  exports.PerpEvent = _PerpEvent;
@@ -14657,6 +16050,18 @@ var PerpInstruction_payload_Inner = class _PerpInstruction_payload_Inner {
14657
16050
  if (!this.descriptor || this.descriptor.tag !== 17) return null;
14658
16051
  return MarketSetOracleInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
14659
16052
  }
16053
+ asFundingUpdate() {
16054
+ if (!this.descriptor || this.descriptor.tag !== 18) return null;
16055
+ return FundingUpdateInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
16056
+ }
16057
+ asMarketSetFunding() {
16058
+ if (!this.descriptor || this.descriptor.tag !== 19) return null;
16059
+ return MarketSetFundingInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
16060
+ }
16061
+ asSettleFunding() {
16062
+ if (!this.descriptor || this.descriptor.tag !== 20) return null;
16063
+ return SettleFundingInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? void 0 });
16064
+ }
14660
16065
  };
14661
16066
  var _PerpInstruction = class _PerpInstruction {
14662
16067
  constructor(buffer, params) {
@@ -14738,6 +16143,12 @@ var _PerpInstruction = class _PerpInstruction {
14738
16143
  break;
14739
16144
  case 17:
14740
16145
  break;
16146
+ case 18:
16147
+ break;
16148
+ case 19:
16149
+ break;
16150
+ case 20:
16151
+ break;
14741
16152
  default:
14742
16153
  return null;
14743
16154
  }
@@ -14981,6 +16392,27 @@ _PerpInstruction.payloadVariantDescriptors = Object.freeze([
14981
16392
  payloadSize: 39,
14982
16393
  payloadType: "PerpInstruction::payload::market_set_oracle",
14983
16394
  createPayloadBuilder: () => __tnMaybeCallBuilder(MarketSetOracleInstruction)
16395
+ },
16396
+ {
16397
+ name: "funding_update",
16398
+ tag: 18,
16399
+ payloadSize: 7,
16400
+ payloadType: "PerpInstruction::payload::funding_update",
16401
+ createPayloadBuilder: () => __tnMaybeCallBuilder(FundingUpdateInstruction)
16402
+ },
16403
+ {
16404
+ name: "market_set_funding",
16405
+ tag: 19,
16406
+ payloadSize: 31,
16407
+ payloadType: "PerpInstruction::payload::market_set_funding",
16408
+ createPayloadBuilder: () => __tnMaybeCallBuilder(MarketSetFundingInstruction)
16409
+ },
16410
+ {
16411
+ name: "settle_funding",
16412
+ tag: 20,
16413
+ payloadSize: 7,
16414
+ payloadType: "PerpInstruction::payload::settle_funding",
16415
+ createPayloadBuilder: () => __tnMaybeCallBuilder(SettleFundingInstruction)
14984
16416
  }
14985
16417
  ]);
14986
16418
  exports.PerpInstruction = _PerpInstruction;
@@ -15124,7 +16556,7 @@ __tnRegisterDynamicValidate2("PerpInstruction", (buffer) => {
15124
16556
  });
15125
16557
  var __tn_ir_PerpProgramAccount = {
15126
16558
  typeName: "PerpProgramAccount",
15127
- 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 } } }] } } } }
16559
+ 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 } } }] } } } }
15128
16560
  };
15129
16561
  var PerpProgramAccount_payload_Inner = class _PerpProgramAccount_payload_Inner {
15130
16562
  constructor(buffer, descriptor, fieldContext) {
@@ -15312,7 +16744,7 @@ _PerpProgramAccount.payloadVariantDescriptors = Object.freeze([
15312
16744
  {
15313
16745
  name: "market",
15314
16746
  tag: 121,
15315
- payloadSize: 319,
16747
+ payloadSize: 447,
15316
16748
  payloadType: "PerpProgramAccount::payload::market",
15317
16749
  createPayloadBuilder: () => __tnMaybeCallBuilder(MarketAccountPayload)
15318
16750
  },
@@ -15459,7 +16891,7 @@ __tnRegisterDynamicValidate2("PerpProgramAccount", (buffer) => {
15459
16891
  });
15460
16892
  var __tn_ir_SeatArenaAccount = {
15461
16893
  typeName: "SeatArenaAccount",
15462
- 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 } } } } }
16894
+ 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 } } } } }
15463
16895
  };
15464
16896
  var SeatArenaAccount = class _SeatArenaAccount {
15465
16897
  constructor(buffer, fieldContext) {
@@ -15491,7 +16923,7 @@ var SeatArenaAccount = class _SeatArenaAccount {
15491
16923
  }
15492
16924
  get_market() {
15493
16925
  const offset = 0;
15494
- const slice = this.buffer.subarray(offset, offset + 320);
16926
+ const slice = this.buffer.subarray(offset, offset + 448);
15495
16927
  return MarketAccount.from_array(slice);
15496
16928
  }
15497
16929
  set_market(value) {
@@ -15506,19 +16938,19 @@ var SeatArenaAccount = class _SeatArenaAccount {
15506
16938
  this.set_market(value);
15507
16939
  }
15508
16940
  get_reserved_market_padding() {
15509
- const offset = 320;
16941
+ const offset = 448;
15510
16942
  const result = [];
15511
- for (let i = 0; i < 192; i++) {
16943
+ for (let i = 0; i < 64; i++) {
15512
16944
  result.push(this.view.getUint8(offset + i * 1));
15513
16945
  }
15514
16946
  return result;
15515
16947
  }
15516
16948
  set_reserved_market_padding(value) {
15517
- const offset = 320;
15518
- if (value.length !== 192) {
15519
- throw new Error("Array length must be 192");
16949
+ const offset = 448;
16950
+ if (value.length !== 64) {
16951
+ throw new Error("Array length must be 64");
15520
16952
  }
15521
- for (let i = 0; i < 192; i++) {
16953
+ for (let i = 0; i < 64; i++) {
15522
16954
  this.view.setUint8(offset + i * 1, value[i]);
15523
16955
  }
15524
16956
  }
@@ -15650,6 +17082,9 @@ var PERP_INSTRUCTION_EXCHANGE_RECOVER_ADMIN = 14;
15650
17082
  var PERP_INSTRUCTION_MARKET_SET_EXCHANGE_STATUS = 15;
15651
17083
  var PERP_INSTRUCTION_LIQUIDATE = 16;
15652
17084
  var PERP_INSTRUCTION_MARKET_SET_ORACLE = 17;
17085
+ var PERP_INSTRUCTION_FUNDING_UPDATE = 18;
17086
+ var PERP_INSTRUCTION_MARKET_SET_FUNDING = 19;
17087
+ var PERP_INSTRUCTION_SETTLE_FUNDING = 20;
15653
17088
  var PERP_DEFAULT_MARKET_RECORD_INDEX = 1;
15654
17089
  var PERP_ERR_PRICE_ABOVE_CAP = -205n;
15655
17090
  var PERP_ERR_INVALID_PRICE_CAP = -206n;
@@ -15663,6 +17098,9 @@ var PERP_ERR_ORACLE_STALE = -213n;
15663
17098
  var PERP_ERR_INVALID_MARGIN_PARAMS = -214n;
15664
17099
  var PERP_ERR_NOT_LIQUIDATABLE = -215n;
15665
17100
  var PERP_ERR_SELF_LIQUIDATION = -216n;
17101
+ var PERP_ERR_FUNDING_DISABLED = -217n;
17102
+ var PERP_ERR_INVALID_FUNDING_PARAMS = -218n;
17103
+ var PERP_ERR_FUNDING_UPDATE_NOT_ALONE = -219n;
15666
17104
  var PERP_ERR_INSUFFICIENT_COLLATERAL = -403n;
15667
17105
  var PERP_ERR_INSUFFICIENT_FUNDS_QUOTE = -401n;
15668
17106
  var PERP_EVENT_SEAT_ASSIGNED = 1;
@@ -15680,6 +17118,7 @@ var PERP_EVENT_EXCHANGE_STATUS = 12;
15680
17118
  var PERP_EVENT_EXCHANGE_ADMIN = 13;
15681
17119
  var PERP_EVENT_MARKET_EXCHANGE_STATUS = 14;
15682
17120
  var PERP_EVENT_LIQUIDATION = 15;
17121
+ var PERP_EVENT_FUNDING_ROUND = 16;
15683
17122
  var PERP_BPS_DENOMINATOR = 10000n;
15684
17123
  var PERP_EVENT_SIDE_BUY = EVENT_SIDE_BUY;
15685
17124
  var PERP_EVENT_SIDE_SELL = EVENT_SIDE_SELL;
@@ -15703,7 +17142,15 @@ var PERP_MODIFY_FLAG_FAIL_IF_OUT_OF_RANGE = 1 << 0;
15703
17142
  var PERP_MODIFY_FLAG_HAS_CLIENT_ID = 1 << 1;
15704
17143
  var PERP_MODIFY_FLAG_HAS_ORDER_ID = 1 << 2;
15705
17144
  var PERP_MARKET_MAGIC = 121;
15706
- var PERP_MARKET_ACCOUNT_SIZE = 320;
17145
+ var PERP_MARKET_ACCOUNT_SIZE = 448;
17146
+ var PERP_FUNDING_RATE_TICK = 1000000n;
17147
+ var PERP_FUNDING_SAMPLE_NS = 60000000000n;
17148
+ var PERP_FUNDING_ROUND_NS = 3600000000000n;
17149
+ var PERP_FUNDING_PREMIUM_DIVISOR = 60n;
17150
+ var PERP_FUNDING_HOURS_PER_RATE = 8n;
17151
+ var PERP_FUNDING_PARAM_MAX = 1e6;
17152
+ var PERP_FUNDING_MULTIPLIER_ONE = 100;
17153
+ var PERP_FUNDING_PREMIUM_MAX = 1000000n;
15707
17154
  var PERP_SEAT_MANAGER_RESERVED_SIZE = 512;
15708
17155
  var PERP_EXCHANGE_META_ACCOUNT_SIZE = 96;
15709
17156
  var PERP_EXCHANGE_META_MAGIC = 0xf17eda2c9e290078n;
@@ -15845,6 +17292,82 @@ function perpMaxSellLots(market, seat, price, mark) {
15845
17292
  const capacity = maxBig(market.maxPositionLots - seat.shortLots - seat.openAskLots, 0n);
15846
17293
  return seat.longLots + minBig(capacity, affordableLots(market, seat, price, mark));
15847
17294
  }
17295
+ function perpFundingEnabled(market) {
17296
+ return (market.funding?.premiumMultiplier ?? 0) !== 0;
17297
+ }
17298
+ function perpFundingHourlyRate(premiumSum, params) {
17299
+ const one = BigInt(PERP_FUNDING_MULTIPLIER_ONE);
17300
+ const multiplier = BigInt(params.premiumMultiplier);
17301
+ const avg = premiumSum / PERP_FUNDING_PREMIUM_DIVISOR * multiplier / one;
17302
+ const small = BigInt(params.clampSmall) * multiplier / one;
17303
+ const big = BigInt(params.clampBig);
17304
+ const r8 = clampBig(avg + clampBig(BigInt(params.interestRate) - avg, -small, small), -big, big);
17305
+ return r8 / PERP_FUNDING_HOURS_PER_RATE;
17306
+ }
17307
+ function perpFundingPremiumSample(index, impactBid, impactAsk) {
17308
+ if (index <= 0n) return 0n;
17309
+ const bid = impactBid > 0n ? impactBid : index;
17310
+ const ask = impactAsk > 0n ? impactAsk : index;
17311
+ const above = bid > index ? bid - index : 0n;
17312
+ const below = ask < index ? index - ask : 0n;
17313
+ return clampBig((above - below) * PERP_FUNDING_RATE_TICK / index, -PERP_FUNDING_PREMIUM_MAX, PERP_FUNDING_PREMIUM_MAX);
17314
+ }
17315
+ function perpFundingParamsProblem(market, params) {
17316
+ const { interestRate, clampSmall, clampBig: big, premiumMultiplier, impactNotional } = params;
17317
+ if (!Number.isInteger(premiumMultiplier) || premiumMultiplier < 0 || premiumMultiplier > PERP_FUNDING_MULTIPLIER_ONE) {
17318
+ return `premiumMultiplier must be 0 (off) or 1..${PERP_FUNDING_MULTIPLIER_ONE}`;
17319
+ }
17320
+ if (premiumMultiplier === 0) return null;
17321
+ if (impactNotional <= 0n) return "impactNotional must be positive";
17322
+ for (const [label, value] of [["interestRate", interestRate], ["clampSmall", clampSmall], ["clampBig", big]]) {
17323
+ if (!Number.isInteger(value) || value < 0 || value > PERP_FUNDING_PARAM_MAX) return `${label} must be 0..${PERP_FUNDING_PARAM_MAX}`;
17324
+ }
17325
+ const gapTicks = (market.initialMarginBps - market.maintenanceMarginBps) * 100;
17326
+ const hourlyCap = Math.floor(big / Number(PERP_FUNDING_HOURS_PER_RATE));
17327
+ if (hourlyCap > gapTicks) {
17328
+ return `clampBig / ${PERP_FUNDING_HOURS_PER_RATE} (${hourlyCap} ticks per hour) exceeds the initial - maintenance margin gap (${gapTicks} ticks)`;
17329
+ }
17330
+ return null;
17331
+ }
17332
+ function perpFundingMaxClampBig(market) {
17333
+ const gapTicks = Math.max(market.initialMarginBps - market.maintenanceMarginBps, 0) * 100;
17334
+ return Math.min(gapTicks * Number(PERP_FUNDING_HOURS_PER_RATE), PERP_FUNDING_PARAM_MAX);
17335
+ }
17336
+ function perpNextFundingRoundNs(funding) {
17337
+ return (funding.lastRoundNs / PERP_FUNDING_ROUND_NS + 1n) * PERP_FUNDING_ROUND_NS;
17338
+ }
17339
+ function perpFundingRoundDue(funding, nowNs) {
17340
+ return nowNs / PERP_FUNDING_ROUND_NS > funding.lastRoundNs / PERP_FUNDING_ROUND_NS;
17341
+ }
17342
+ function perpFundingSampleDue(funding, nowNs) {
17343
+ return nowNs / PERP_FUNDING_SAMPLE_NS > funding.lastSampleNs / PERP_FUNDING_SAMPLE_NS;
17344
+ }
17345
+ function perpSeatFundingCredit(market, seat) {
17346
+ const index = market.funding?.index ?? 0n;
17347
+ const net = seat.longLots - seat.shortLots;
17348
+ return BigInt(seat.fundingCarry ?? 0) - net * (index - (seat.fundingSnapshot ?? 0n));
17349
+ }
17350
+ function perpSettleFunding(market, seat) {
17351
+ const index = market.funding?.index ?? 0n;
17352
+ const credit = perpSeatFundingCredit(market, seat);
17353
+ const paid = floorDiv(credit, PERP_FUNDING_RATE_TICK);
17354
+ const carry = credit - paid * PERP_FUNDING_RATE_TICK;
17355
+ let quantityQuote = seat.quantityQuote + paid;
17356
+ let entryNotional = seat.entryNotional;
17357
+ let badDebt = 0n;
17358
+ if (quantityQuote < 0n) {
17359
+ const shortfall = -quantityQuote;
17360
+ quantityQuote = 0n;
17361
+ if (seat.longLots > 0n) {
17362
+ entryNotional += shortfall;
17363
+ } else {
17364
+ const absorbed = seat.shortLots > 0n ? minBig(shortfall, entryNotional) : 0n;
17365
+ entryNotional -= absorbed;
17366
+ badDebt = shortfall - absorbed;
17367
+ }
17368
+ }
17369
+ return { seat: { ...seat, quantityQuote, entryNotional, fundingSnapshot: index, fundingCarry: Number(carry) }, paid, badDebt };
17370
+ }
15848
17371
  function affordableLots(market, seat, price, mark) {
15849
17372
  const perLot = perpLotInitialMargin(market, price);
15850
17373
  const free = maxBig(perpFreeCollateral(market, seat, mark), 0n);
@@ -15943,6 +17466,7 @@ function createPerpMarketRecordInstruction(args) {
15943
17466
  return buildPerpInstruction("market_record", payload);
15944
17467
  };
15945
17468
  }
17469
+ var PERP_MARKET_CREATE_STATE_UNITS = 51;
15946
17470
  function createPerpMarketCreateInstruction(args) {
15947
17471
  return async (context) => {
15948
17472
  assertU64(args.lotSize, "lotSize");
@@ -16022,6 +17546,27 @@ function createPerpMarketSetOracleInstruction(args) {
16022
17546
  return buildPerpInstruction("market_set_oracle", payload);
16023
17547
  };
16024
17548
  }
17549
+ function createPerpFundingUpdateInstruction(args) {
17550
+ return async () => {
17551
+ const payload = new FundingUpdateInstructionBuilder().set_market_record_idx(assertU8(args.marketRecordIndex, "marketRecordIndex")).set_reserved0(0).set_reserved1(0).build();
17552
+ return buildPerpInstruction("funding_update", payload);
17553
+ };
17554
+ }
17555
+ function createPerpSettleFundingInstruction(args) {
17556
+ const targetSeatIndex = assertPerpSeatIndex(args.targetSeatIndex, "targetSeatIndex");
17557
+ return async () => {
17558
+ const payload = new SettleFundingInstructionBuilder().set_market_record_idx(assertU8(args.marketRecordIndex, "marketRecordIndex")).set_reserved0(0).set_target_seat_idx(targetSeatIndex).build();
17559
+ return buildPerpInstruction("settle_funding", payload);
17560
+ };
17561
+ }
17562
+ function createPerpMarketSetFundingInstruction(args) {
17563
+ for (const label of ["interestRate", "clampSmall", "clampBig", "premiumMultiplier"]) (0, helpers_exports.assertU32)(args[label], label);
17564
+ assertU64(args.impactNotional, "impactNotional");
17565
+ return async () => {
17566
+ 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();
17567
+ return buildPerpInstruction("market_set_funding", payload);
17568
+ };
17569
+ }
16025
17570
  function concatPerpInstructions(...instructions) {
16026
17571
  return async (context) => {
16027
17572
  const chunks = [];
@@ -16316,6 +17861,21 @@ function parsePerpEvent(data) {
16316
17861
  targetSide: liquidationSideFromValue(event.get_side())
16317
17862
  };
16318
17863
  }
17864
+ case "funding_round": {
17865
+ const event = payload.asFundingRound();
17866
+ if (!event) throw new Error("perp funding_round event payload is malformed");
17867
+ return {
17868
+ ...base,
17869
+ variant: "funding_round",
17870
+ market: pubkeyViewToAddress(event.get_market()),
17871
+ rate: event.get_rate(),
17872
+ premiumSum: event.get_premium_sum(),
17873
+ sampleCount: event.get_sample_cnt(),
17874
+ indexPrice: event.get_index_price(),
17875
+ fundingIndex: joinI128(event.get_funding_index_lo(), event.get_funding_index_hi()),
17876
+ roundNs: event.get_round_ns()
17877
+ };
17878
+ }
16319
17879
  case "market_status":
16320
17880
  case "exchange_initialized":
16321
17881
  case "exchange_status":
@@ -16373,9 +17933,26 @@ function marketFromView(view) {
16373
17933
  maintenanceMarginBps: view.get_maintenance_margin_bps(),
16374
17934
  liquidationFeeBps: view.get_liquidation_fee_bps(),
16375
17935
  oracleExponent: view.get_oracle_exponent(),
16376
- maxMarkAgeNs: view.get_max_mark_age_ns()
17936
+ maxMarkAgeNs: view.get_max_mark_age_ns(),
17937
+ funding: {
17938
+ index: joinI128(view.get_funding_index_lo(), view.get_funding_index_hi()),
17939
+ balance: view.get_funding_balance(),
17940
+ lastRoundNs: view.get_funding_last_round_ns(),
17941
+ lastSampleNs: view.get_funding_last_sample_ns(),
17942
+ premiumSum: view.get_funding_premium_sum(),
17943
+ sampleCount: view.get_funding_sample_cnt(),
17944
+ rate: view.get_funding_rate(),
17945
+ interestRate: view.get_funding_interest_rate(),
17946
+ clampSmall: view.get_funding_clamp_small(),
17947
+ clampBig: view.get_funding_clamp_big(),
17948
+ premiumMultiplier: view.get_funding_premium_multiplier(),
17949
+ impactNotional: view.get_funding_impact_notional()
17950
+ }
16377
17951
  });
16378
17952
  }
17953
+ function joinI128(lo, hi) {
17954
+ return BigInt.asIntN(128, hi << 64n | lo);
17955
+ }
16379
17956
  function assertPerpMarketHeader(market) {
16380
17957
  const { initialMarginBps: initial, maintenanceMarginBps: maintenance, liquidationFeeBps: fee, markNum, markDen } = market;
16381
17958
  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;
@@ -16397,7 +17974,9 @@ function seatEntryFromView(view, seatIndex) {
16397
17974
  headOrderEntryIndex: view.get_head_order_entry_idx(),
16398
17975
  entryNotional: view.get_entry_notional(),
16399
17976
  openBidNotional: view.get_open_bid_notional(),
16400
- openAskNotional: view.get_open_ask_notional()
17977
+ openAskNotional: view.get_open_ask_notional(),
17978
+ fundingSnapshot: joinI128(view.get_funding_snapshot_lo(), view.get_funding_snapshot_hi()),
17979
+ fundingCarry: view.get_funding_carry()
16401
17980
  };
16402
17981
  }
16403
17982
  function orderEntryFromView(view, orderEntryIndex) {
@@ -16497,6 +18076,13 @@ async function sha256(...parts) {
16497
18076
  const digest = await globalThis.crypto.subtle.digest("SHA-256", joined);
16498
18077
  return new Uint8Array(digest);
16499
18078
  }
18079
+ function floorDiv(numerator, denominator) {
18080
+ const quotient = numerator / denominator;
18081
+ return numerator % denominator !== 0n && numerator < 0n !== denominator < 0n ? quotient - 1n : quotient;
18082
+ }
18083
+ function clampBig(value, low, high) {
18084
+ return value < low ? low : value > high ? high : value;
18085
+ }
16500
18086
  function minBig(a, b) {
16501
18087
  return a < b ? a : b;
16502
18088
  }
@@ -16525,6 +18111,10 @@ exports.ExchangeSetStatusInstruction = ExchangeSetStatusInstruction;
16525
18111
  exports.ExchangeSetStatusInstructionBuilder = ExchangeSetStatusInstructionBuilder;
16526
18112
  exports.ExchangeStatusEvent = ExchangeStatusEvent;
16527
18113
  exports.ExchangeStatusEventBuilder = ExchangeStatusEventBuilder;
18114
+ exports.FundingRoundEvent = FundingRoundEvent;
18115
+ exports.FundingRoundEventBuilder = FundingRoundEventBuilder;
18116
+ exports.FundingUpdateInstruction = FundingUpdateInstruction;
18117
+ exports.FundingUpdateInstructionBuilder = FundingUpdateInstructionBuilder;
16528
18118
  exports.LiquidateInstruction = LiquidateInstruction;
16529
18119
  exports.LiquidateInstructionBuilder = LiquidateInstructionBuilder;
16530
18120
  exports.LiquidationEvent = LiquidationEvent;
@@ -16542,6 +18132,8 @@ exports.MarketRecordInstruction = MarketRecordInstruction;
16542
18132
  exports.MarketRecordInstructionBuilder = MarketRecordInstructionBuilder;
16543
18133
  exports.MarketSetExchangeStatusInstruction = MarketSetExchangeStatusInstruction;
16544
18134
  exports.MarketSetExchangeStatusInstructionBuilder = MarketSetExchangeStatusInstructionBuilder;
18135
+ exports.MarketSetFundingInstruction = MarketSetFundingInstruction;
18136
+ exports.MarketSetFundingInstructionBuilder = MarketSetFundingInstructionBuilder;
16545
18137
  exports.MarketSetOracleInstruction = MarketSetOracleInstruction;
16546
18138
  exports.MarketSetOracleInstructionBuilder = MarketSetOracleInstructionBuilder;
16547
18139
  exports.MarketSetStatusInstruction = MarketSetStatusInstruction;
@@ -16573,8 +18165,11 @@ exports.PERP_CBOOK_MAX_SIZE = PERP_CBOOK_MAX_SIZE;
16573
18165
  exports.PERP_CLIENT_ID_SIZE = PERP_CLIENT_ID_SIZE;
16574
18166
  exports.PERP_DEFAULT_MARKET_RECORD_INDEX = PERP_DEFAULT_MARKET_RECORD_INDEX;
16575
18167
  exports.PERP_ERR_ARITH_OVERFLOW = PERP_ERR_ARITH_OVERFLOW;
18168
+ exports.PERP_ERR_FUNDING_DISABLED = PERP_ERR_FUNDING_DISABLED;
18169
+ exports.PERP_ERR_FUNDING_UPDATE_NOT_ALONE = PERP_ERR_FUNDING_UPDATE_NOT_ALONE;
16576
18170
  exports.PERP_ERR_INSUFFICIENT_COLLATERAL = PERP_ERR_INSUFFICIENT_COLLATERAL;
16577
18171
  exports.PERP_ERR_INSUFFICIENT_FUNDS_QUOTE = PERP_ERR_INSUFFICIENT_FUNDS_QUOTE;
18172
+ exports.PERP_ERR_INVALID_FUNDING_PARAMS = PERP_ERR_INVALID_FUNDING_PARAMS;
16578
18173
  exports.PERP_ERR_INVALID_MARGIN_PARAMS = PERP_ERR_INVALID_MARGIN_PARAMS;
16579
18174
  exports.PERP_ERR_INVALID_POSITION_LIMIT = PERP_ERR_INVALID_POSITION_LIMIT;
16580
18175
  exports.PERP_ERR_INVALID_PRICE_CAP = PERP_ERR_INVALID_PRICE_CAP;
@@ -16589,6 +18184,7 @@ exports.PERP_ERR_SELF_LIQUIDATION = PERP_ERR_SELF_LIQUIDATION;
16589
18184
  exports.PERP_EVENT_EXCHANGE_ADMIN = PERP_EVENT_EXCHANGE_ADMIN;
16590
18185
  exports.PERP_EVENT_EXCHANGE_INITIALIZED = PERP_EVENT_EXCHANGE_INITIALIZED;
16591
18186
  exports.PERP_EVENT_EXCHANGE_STATUS = PERP_EVENT_EXCHANGE_STATUS;
18187
+ exports.PERP_EVENT_FUNDING_ROUND = PERP_EVENT_FUNDING_ROUND;
16592
18188
  exports.PERP_EVENT_LIQUIDATION = PERP_EVENT_LIQUIDATION;
16593
18189
  exports.PERP_EVENT_MARKET_CREATED = PERP_EVENT_MARKET_CREATED;
16594
18190
  exports.PERP_EVENT_MARKET_EXCHANGE_STATUS = PERP_EVENT_MARKET_EXCHANGE_STATUS;
@@ -16611,22 +18207,34 @@ exports.PERP_EXCHANGE_META_ACCOUNT_SIZE = PERP_EXCHANGE_META_ACCOUNT_SIZE;
16611
18207
  exports.PERP_EXCHANGE_META_MAGIC = PERP_EXCHANGE_META_MAGIC;
16612
18208
  exports.PERP_EXCHANGE_META_SEED = PERP_EXCHANGE_META_SEED;
16613
18209
  exports.PERP_EXCHANGE_META_VERSION = PERP_EXCHANGE_META_VERSION;
18210
+ exports.PERP_FUNDING_HOURS_PER_RATE = PERP_FUNDING_HOURS_PER_RATE;
18211
+ exports.PERP_FUNDING_MULTIPLIER_ONE = PERP_FUNDING_MULTIPLIER_ONE;
18212
+ exports.PERP_FUNDING_PARAM_MAX = PERP_FUNDING_PARAM_MAX;
18213
+ exports.PERP_FUNDING_PREMIUM_DIVISOR = PERP_FUNDING_PREMIUM_DIVISOR;
18214
+ exports.PERP_FUNDING_PREMIUM_MAX = PERP_FUNDING_PREMIUM_MAX;
18215
+ exports.PERP_FUNDING_RATE_TICK = PERP_FUNDING_RATE_TICK;
18216
+ exports.PERP_FUNDING_ROUND_NS = PERP_FUNDING_ROUND_NS;
18217
+ exports.PERP_FUNDING_SAMPLE_NS = PERP_FUNDING_SAMPLE_NS;
16614
18218
  exports.PERP_INSTRUCTION_CREATE_ORDER_ENTRY = PERP_INSTRUCTION_CREATE_ORDER_ENTRY;
16615
18219
  exports.PERP_INSTRUCTION_EXCHANGE_INITIALIZE = PERP_INSTRUCTION_EXCHANGE_INITIALIZE;
16616
18220
  exports.PERP_INSTRUCTION_EXCHANGE_RECOVER_ADMIN = PERP_INSTRUCTION_EXCHANGE_RECOVER_ADMIN;
16617
18221
  exports.PERP_INSTRUCTION_EXCHANGE_SET_ADMIN = PERP_INSTRUCTION_EXCHANGE_SET_ADMIN;
16618
18222
  exports.PERP_INSTRUCTION_EXCHANGE_SET_STATUS = PERP_INSTRUCTION_EXCHANGE_SET_STATUS;
18223
+ exports.PERP_INSTRUCTION_FUNDING_UPDATE = PERP_INSTRUCTION_FUNDING_UPDATE;
16619
18224
  exports.PERP_INSTRUCTION_LIQUIDATE = PERP_INSTRUCTION_LIQUIDATE;
16620
18225
  exports.PERP_INSTRUCTION_MARKET_CREATE = PERP_INSTRUCTION_MARKET_CREATE;
16621
18226
  exports.PERP_INSTRUCTION_MARKET_RECORD = PERP_INSTRUCTION_MARKET_RECORD;
16622
18227
  exports.PERP_INSTRUCTION_MARKET_SET_EXCHANGE_STATUS = PERP_INSTRUCTION_MARKET_SET_EXCHANGE_STATUS;
18228
+ exports.PERP_INSTRUCTION_MARKET_SET_FUNDING = PERP_INSTRUCTION_MARKET_SET_FUNDING;
16623
18229
  exports.PERP_INSTRUCTION_MARKET_SET_ORACLE = PERP_INSTRUCTION_MARKET_SET_ORACLE;
16624
18230
  exports.PERP_INSTRUCTION_MARKET_SET_STATUS = PERP_INSTRUCTION_MARKET_SET_STATUS;
16625
18231
  exports.PERP_INSTRUCTION_MODIFY_ORDER_ENTRY = PERP_INSTRUCTION_MODIFY_ORDER_ENTRY;
16626
18232
  exports.PERP_INSTRUCTION_SEAT_CREATE = PERP_INSTRUCTION_SEAT_CREATE;
18233
+ exports.PERP_INSTRUCTION_SETTLE_FUNDING = PERP_INSTRUCTION_SETTLE_FUNDING;
16627
18234
  exports.PERP_INSTRUCTION_TOKEN_DEPOSIT = PERP_INSTRUCTION_TOKEN_DEPOSIT;
16628
18235
  exports.PERP_INSTRUCTION_TOKEN_WITHDRAW = PERP_INSTRUCTION_TOKEN_WITHDRAW;
16629
18236
  exports.PERP_MARKET_ACCOUNT_SIZE = PERP_MARKET_ACCOUNT_SIZE;
18237
+ exports.PERP_MARKET_CREATE_STATE_UNITS = PERP_MARKET_CREATE_STATE_UNITS;
16630
18238
  exports.PERP_MARKET_MAGIC = PERP_MARKET_MAGIC;
16631
18239
  exports.PERP_MAX_ORDER_EXPIRATION_TIME = PERP_MAX_ORDER_EXPIRATION_TIME;
16632
18240
  exports.PERP_MODIFY_FLAG_FAIL_IF_OUT_OF_RANGE = PERP_MODIFY_FLAG_FAIL_IF_OUT_OF_RANGE;
@@ -16674,6 +18282,8 @@ exports.SeatCreateInstruction = SeatCreateInstruction;
16674
18282
  exports.SeatCreateInstructionBuilder = SeatCreateInstructionBuilder;
16675
18283
  exports.SeatEntry = SeatEntry;
16676
18284
  exports.SeatEntryBuilder = SeatEntryBuilder;
18285
+ exports.SettleFundingInstruction = SettleFundingInstruction;
18286
+ exports.SettleFundingInstructionBuilder = SettleFundingInstructionBuilder;
16677
18287
  exports.TokenBalanceEvent = TokenBalanceEvent;
16678
18288
  exports.TokenBalanceEventBuilder = TokenBalanceEventBuilder;
16679
18289
  exports.TokenTransferInstruction = TokenTransferInstruction;
@@ -16685,14 +18295,17 @@ exports.createPerpCancelOrderInstruction = createPerpCancelOrderInstruction;
16685
18295
  exports.createPerpExchangeInitializeInstruction = createPerpExchangeInitializeInstruction;
16686
18296
  exports.createPerpExchangeSetAdminInstruction = createPerpExchangeSetAdminInstruction;
16687
18297
  exports.createPerpExchangeSetStatusInstruction = createPerpExchangeSetStatusInstruction;
18298
+ exports.createPerpFundingUpdateInstruction = createPerpFundingUpdateInstruction;
16688
18299
  exports.createPerpLiquidateInstruction = createPerpLiquidateInstruction;
16689
18300
  exports.createPerpMarketCreateInstruction = createPerpMarketCreateInstruction;
16690
18301
  exports.createPerpMarketRecordInstruction = createPerpMarketRecordInstruction;
18302
+ exports.createPerpMarketSetFundingInstruction = createPerpMarketSetFundingInstruction;
16691
18303
  exports.createPerpMarketSetOracleInstruction = createPerpMarketSetOracleInstruction;
16692
18304
  exports.createPerpMarketSetStatusInstruction = createPerpMarketSetStatusInstruction;
16693
18305
  exports.createPerpModifyOrderEntryInstruction = createPerpModifyOrderEntryInstruction;
16694
18306
  exports.createPerpOrderEntryInstruction = createPerpOrderEntryInstruction;
16695
18307
  exports.createPerpSeatCreateInstruction = createPerpSeatCreateInstruction;
18308
+ exports.createPerpSettleFundingInstruction = createPerpSettleFundingInstruction;
16696
18309
  exports.createPerpTokenDepositInstruction = createPerpTokenDepositInstruction;
16697
18310
  exports.createPerpTokenWithdrawInstruction = createPerpTokenWithdrawInstruction;
16698
18311
  exports.derivePerpExchangeMetaAddress = derivePerpExchangeMetaAddress;
@@ -16709,6 +18322,13 @@ exports.perpCanPostOrder = perpCanPostOrder;
16709
18322
  exports.perpCeilBps = perpCeilBps;
16710
18323
  exports.perpEquity = perpEquity;
16711
18324
  exports.perpFreeCollateral = perpFreeCollateral;
18325
+ exports.perpFundingEnabled = perpFundingEnabled;
18326
+ exports.perpFundingHourlyRate = perpFundingHourlyRate;
18327
+ exports.perpFundingMaxClampBig = perpFundingMaxClampBig;
18328
+ exports.perpFundingParamsProblem = perpFundingParamsProblem;
18329
+ exports.perpFundingPremiumSample = perpFundingPremiumSample;
18330
+ exports.perpFundingRoundDue = perpFundingRoundDue;
18331
+ exports.perpFundingSampleDue = perpFundingSampleDue;
16712
18332
  exports.perpInitialMargin = perpInitialMargin;
16713
18333
  exports.perpIsLiquidatable = perpIsLiquidatable;
16714
18334
  exports.perpLeverageBps = perpLeverageBps;
@@ -16724,10 +18344,13 @@ exports.perpMarketReadOnlyAddresses = perpMarketReadOnlyAddresses;
16724
18344
  exports.perpMaxBuyLots = perpMaxBuyLots;
16725
18345
  exports.perpMaxLeverage = perpMaxLeverage;
16726
18346
  exports.perpMaxSellLots = perpMaxSellLots;
18347
+ exports.perpNextFundingRoundNs = perpNextFundingRoundNs;
16727
18348
  exports.perpNotional = perpNotional;
16728
18349
  exports.perpOrderInitialMargin = perpOrderInitialMargin;
16729
18350
  exports.perpPositionInitialMargin = perpPositionInitialMargin;
18351
+ exports.perpSeatFundingCredit = perpSeatFundingCredit;
16730
18352
  exports.perpSeatOrders = perpSeatOrders;
18353
+ exports.perpSettleFunding = perpSettleFunding;
16731
18354
  exports.perpSideMarginNotional = perpSideMarginNotional;
16732
18355
  exports.perpUnrealizedPnl = perpUnrealizedPnl;
16733
18356
  //# sourceMappingURL=index.cjs.map