@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
@@ -3108,6 +3108,193 @@ __tnRegisterFootprint("ExchangeSetStatusInstruction", (params) => ExchangeSetSta
3108
3108
  __tnRegisterValidate("ExchangeSetStatusInstruction", (buffer, params) => ExchangeSetStatusInstruction.__tnInvokeValidate(buffer, params));
3109
3109
  __tnRegisterDynamicValidate("ExchangeSetStatusInstruction", (buffer) => { const result = ExchangeSetStatusInstruction.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
3110
3110
 
3111
+ /* ----- TYPE DEFINITION FOR FundingUpdateInstruction ----- */
3112
+
3113
+ const __tn_ir_FundingUpdateInstruction = {
3114
+ typeName: "FundingUpdateInstruction",
3115
+ root: { op: "const", value: 7n }
3116
+ } as const;
3117
+
3118
+ export class FundingUpdateInstruction {
3119
+ private view: DataView;
3120
+
3121
+ private constructor(private buffer: Uint8Array) {
3122
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
3123
+ }
3124
+
3125
+ static __tnCreateView(buffer: Uint8Array, opts?: { fieldContext?: Record<string, number | bigint> }): FundingUpdateInstruction {
3126
+ if (!buffer || buffer.length === undefined) throw new Error("FundingUpdateInstruction.__tnCreateView requires a Uint8Array");
3127
+ return new FundingUpdateInstruction(new Uint8Array(buffer));
3128
+ }
3129
+
3130
+ static builder(): FundingUpdateInstructionBuilder {
3131
+ return new FundingUpdateInstructionBuilder();
3132
+ }
3133
+
3134
+ static fromBuilder(builder: FundingUpdateInstructionBuilder): FundingUpdateInstruction | null {
3135
+ const buffer = builder.build();
3136
+ return FundingUpdateInstruction.from_array(buffer);
3137
+ }
3138
+
3139
+ get_market_record_idx(): number {
3140
+ const offset = 0;
3141
+ return this.view.getUint8(offset);
3142
+ }
3143
+
3144
+ set_market_record_idx(value: number): void {
3145
+ const offset = 0;
3146
+ this.view.setUint8(offset, value);
3147
+ }
3148
+
3149
+ get market_record_idx(): number {
3150
+ return this.get_market_record_idx();
3151
+ }
3152
+
3153
+ set market_record_idx(value: number) {
3154
+ this.set_market_record_idx(value);
3155
+ }
3156
+
3157
+ get_reserved0(): number {
3158
+ const offset = 1;
3159
+ return this.view.getUint16(offset, true); /* little-endian */
3160
+ }
3161
+
3162
+ set_reserved0(value: number): void {
3163
+ const offset = 1;
3164
+ this.view.setUint16(offset, value, true); /* little-endian */
3165
+ }
3166
+
3167
+ get reserved0(): number {
3168
+ return this.get_reserved0();
3169
+ }
3170
+
3171
+ set reserved0(value: number) {
3172
+ this.set_reserved0(value);
3173
+ }
3174
+
3175
+ get_reserved1(): number {
3176
+ const offset = 3;
3177
+ return this.view.getUint32(offset, true); /* little-endian */
3178
+ }
3179
+
3180
+ set_reserved1(value: number): void {
3181
+ const offset = 3;
3182
+ this.view.setUint32(offset, value, true); /* little-endian */
3183
+ }
3184
+
3185
+ get reserved1(): number {
3186
+ return this.get_reserved1();
3187
+ }
3188
+
3189
+ set reserved1(value: number) {
3190
+ this.set_reserved1(value);
3191
+ }
3192
+
3193
+ private static __tnFootprintInternal(__tnParams: Record<string, bigint>): bigint {
3194
+ return __tnEvalFootprint(__tn_ir_FundingUpdateInstruction.root, { params: __tnParams });
3195
+ }
3196
+
3197
+ private static __tnValidateInternal(buffer: Uint8Array, __tnParams: Record<string, bigint>): { ok: boolean; code?: string; consumed?: bigint } {
3198
+ return __tnValidateIrTree(__tn_ir_FundingUpdateInstruction, buffer, __tnParams);
3199
+ }
3200
+
3201
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint {
3202
+ return this.__tnFootprintInternal(__tnParams);
3203
+ }
3204
+
3205
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult {
3206
+ return this.__tnValidateInternal(buffer, __tnParams);
3207
+ }
3208
+
3209
+ static footprintIr(): bigint {
3210
+ return this.__tnFootprintInternal(Object.create(null));
3211
+ }
3212
+
3213
+ static footprint(): number {
3214
+ const irResult = this.footprintIr();
3215
+ const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
3216
+ if (__tnBigIntGreaterThan(irResult, maxSafe)) {
3217
+ throw new Error('footprint exceeds Number.MAX_SAFE_INTEGER for FundingUpdateInstruction');
3218
+ }
3219
+ return __tnBigIntToNumber(irResult, 'FundingUpdateInstruction::footprint');
3220
+ }
3221
+
3222
+ static validate(buffer: Uint8Array, _opts?: { params?: never }): { ok: boolean; code?: string; consumed?: number } {
3223
+ if (buffer.length < 7) return { ok: false, code: "tn.buffer_too_small", consumed: 7 };
3224
+ return { ok: true, consumed: 7 };
3225
+ }
3226
+
3227
+ static new(market_record_idx: number, reserved0: number, reserved1: number): FundingUpdateInstruction {
3228
+ const buffer = new Uint8Array(7);
3229
+ const view = new DataView(buffer.buffer);
3230
+
3231
+ let offset = 0;
3232
+ view.setUint8(0, market_record_idx); /* market_record_idx */
3233
+ view.setUint16(1, reserved0, true); /* reserved0 (little-endian) */
3234
+ view.setUint32(3, reserved1, true); /* reserved1 (little-endian) */
3235
+
3236
+ return new FundingUpdateInstruction(buffer);
3237
+ }
3238
+
3239
+ static from_array(buffer: Uint8Array): FundingUpdateInstruction | null {
3240
+ if (!buffer || buffer.length === undefined) {
3241
+ return null;
3242
+ }
3243
+ const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
3244
+ const validation = this.validate(buffer);
3245
+ if (!validation.ok) {
3246
+ return null;
3247
+ }
3248
+ return new FundingUpdateInstruction(buffer);
3249
+ }
3250
+
3251
+ }
3252
+
3253
+ export class FundingUpdateInstructionBuilder {
3254
+ private buffer: Uint8Array;
3255
+ private view: DataView;
3256
+
3257
+ constructor() {
3258
+ this.buffer = new Uint8Array(7);
3259
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
3260
+ }
3261
+
3262
+ set_market_record_idx(value: number): this {
3263
+ this.view.setUint8(0, value);
3264
+ return this;
3265
+ }
3266
+
3267
+ set_reserved0(value: number): this {
3268
+ this.view.setUint16(1, value, true);
3269
+ return this;
3270
+ }
3271
+
3272
+ set_reserved1(value: number): this {
3273
+ this.view.setUint32(3, value, true);
3274
+ return this;
3275
+ }
3276
+
3277
+ build(): Uint8Array {
3278
+ return this.buffer.slice();
3279
+ }
3280
+
3281
+ buildInto(target: Uint8Array, offset = 0): Uint8Array {
3282
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
3283
+ target.set(this.buffer, offset);
3284
+ return target;
3285
+ }
3286
+
3287
+ finish(): FundingUpdateInstruction {
3288
+ const view = FundingUpdateInstruction.from_array(this.buffer.slice());
3289
+ if (!view) throw new Error("failed to build FundingUpdateInstruction");
3290
+ return view;
3291
+ }
3292
+ }
3293
+
3294
+ __tnRegisterFootprint("FundingUpdateInstruction", (params) => FundingUpdateInstruction.__tnInvokeFootprint(params));
3295
+ __tnRegisterValidate("FundingUpdateInstruction", (buffer, params) => FundingUpdateInstruction.__tnInvokeValidate(buffer, params));
3296
+ __tnRegisterDynamicValidate("FundingUpdateInstruction", (buffer) => { const result = FundingUpdateInstruction.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
3297
+
3111
3298
  /* ----- TYPE DEFINITION FOR LiquidateInstruction ----- */
3112
3299
 
3113
3300
  const __tn_ir_LiquidateInstruction = {
@@ -5468,32 +5655,32 @@ __tnRegisterFootprint("MarketSetExchangeStatusInstruction", (params) => MarketSe
5468
5655
  __tnRegisterValidate("MarketSetExchangeStatusInstruction", (buffer, params) => MarketSetExchangeStatusInstruction.__tnInvokeValidate(buffer, params));
5469
5656
  __tnRegisterDynamicValidate("MarketSetExchangeStatusInstruction", (buffer) => { const result = MarketSetExchangeStatusInstruction.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
5470
5657
 
5471
- /* ----- TYPE DEFINITION FOR MarketSetOracleInstruction ----- */
5658
+ /* ----- TYPE DEFINITION FOR MarketSetFundingInstruction ----- */
5472
5659
 
5473
- const __tn_ir_MarketSetOracleInstruction = {
5474
- typeName: "MarketSetOracleInstruction",
5475
- root: { op: "const", value: 39n }
5660
+ const __tn_ir_MarketSetFundingInstruction = {
5661
+ typeName: "MarketSetFundingInstruction",
5662
+ root: { op: "const", value: 31n }
5476
5663
  } as const;
5477
5664
 
5478
- export class MarketSetOracleInstruction {
5665
+ export class MarketSetFundingInstruction {
5479
5666
  private view: DataView;
5480
5667
 
5481
5668
  private constructor(private buffer: Uint8Array) {
5482
5669
  this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
5483
5670
  }
5484
5671
 
5485
- static __tnCreateView(buffer: Uint8Array, opts?: { fieldContext?: Record<string, number | bigint> }): MarketSetOracleInstruction {
5486
- if (!buffer || buffer.length === undefined) throw new Error("MarketSetOracleInstruction.__tnCreateView requires a Uint8Array");
5487
- return new MarketSetOracleInstruction(new Uint8Array(buffer));
5672
+ static __tnCreateView(buffer: Uint8Array, opts?: { fieldContext?: Record<string, number | bigint> }): MarketSetFundingInstruction {
5673
+ if (!buffer || buffer.length === undefined) throw new Error("MarketSetFundingInstruction.__tnCreateView requires a Uint8Array");
5674
+ return new MarketSetFundingInstruction(new Uint8Array(buffer));
5488
5675
  }
5489
5676
 
5490
- static builder(): MarketSetOracleInstructionBuilder {
5491
- return new MarketSetOracleInstructionBuilder();
5677
+ static builder(): MarketSetFundingInstructionBuilder {
5678
+ return new MarketSetFundingInstructionBuilder();
5492
5679
  }
5493
5680
 
5494
- static fromBuilder(builder: MarketSetOracleInstructionBuilder): MarketSetOracleInstruction | null {
5681
+ static fromBuilder(builder: MarketSetFundingInstructionBuilder): MarketSetFundingInstruction | null {
5495
5682
  const buffer = builder.build();
5496
- return MarketSetOracleInstruction.from_array(buffer);
5683
+ return MarketSetFundingInstruction.from_array(buffer);
5497
5684
  }
5498
5685
 
5499
5686
  get_market_record_idx(): number {
@@ -5514,111 +5701,419 @@ export class MarketSetOracleInstruction {
5514
5701
  this.set_market_record_idx(value);
5515
5702
  }
5516
5703
 
5517
- get_oracle_feed_account_idx(): number {
5704
+ get_reserved0(): number {
5518
5705
  const offset = 1;
5519
5706
  return this.view.getUint16(offset, true); /* little-endian */
5520
5707
  }
5521
5708
 
5522
- set_oracle_feed_account_idx(value: number): void {
5709
+ set_reserved0(value: number): void {
5523
5710
  const offset = 1;
5524
5711
  this.view.setUint16(offset, value, true); /* little-endian */
5525
5712
  }
5526
5713
 
5527
- get oracle_feed_account_idx(): number {
5528
- return this.get_oracle_feed_account_idx();
5714
+ get reserved0(): number {
5715
+ return this.get_reserved0();
5529
5716
  }
5530
5717
 
5531
- set oracle_feed_account_idx(value: number) {
5532
- this.set_oracle_feed_account_idx(value);
5718
+ set reserved0(value: number) {
5719
+ this.set_reserved0(value);
5533
5720
  }
5534
5721
 
5535
- get_oracle_exponent(): number {
5722
+ get_interest_rate(): number {
5536
5723
  const offset = 3;
5537
- return this.view.getInt32(offset, true); /* little-endian */
5724
+ return this.view.getUint32(offset, true); /* little-endian */
5538
5725
  }
5539
5726
 
5540
- set_oracle_exponent(value: number): void {
5727
+ set_interest_rate(value: number): void {
5541
5728
  const offset = 3;
5542
- this.view.setInt32(offset, value, true); /* little-endian */
5729
+ this.view.setUint32(offset, value, true); /* little-endian */
5543
5730
  }
5544
5731
 
5545
- get oracle_exponent(): number {
5546
- return this.get_oracle_exponent();
5732
+ get interest_rate(): number {
5733
+ return this.get_interest_rate();
5547
5734
  }
5548
5735
 
5549
- set oracle_exponent(value: number) {
5550
- this.set_oracle_exponent(value);
5736
+ set interest_rate(value: number) {
5737
+ this.set_interest_rate(value);
5551
5738
  }
5552
5739
 
5553
- get_mark_num(): bigint {
5740
+ get_clamp_small(): number {
5554
5741
  const offset = 7;
5555
- return this.view.getBigUint64(offset, true); /* little-endian */
5742
+ return this.view.getUint32(offset, true); /* little-endian */
5556
5743
  }
5557
5744
 
5558
- set_mark_num(value: bigint): void {
5745
+ set_clamp_small(value: number): void {
5559
5746
  const offset = 7;
5560
- this.view.setBigUint64(offset, value, true); /* little-endian */
5747
+ this.view.setUint32(offset, value, true); /* little-endian */
5561
5748
  }
5562
5749
 
5563
- get mark_num(): bigint {
5564
- return this.get_mark_num();
5750
+ get clamp_small(): number {
5751
+ return this.get_clamp_small();
5565
5752
  }
5566
5753
 
5567
- set mark_num(value: bigint) {
5568
- this.set_mark_num(value);
5754
+ set clamp_small(value: number) {
5755
+ this.set_clamp_small(value);
5569
5756
  }
5570
5757
 
5571
- get_mark_den(): bigint {
5758
+ get_clamp_big(): number {
5759
+ const offset = 11;
5760
+ return this.view.getUint32(offset, true); /* little-endian */
5761
+ }
5762
+
5763
+ set_clamp_big(value: number): void {
5764
+ const offset = 11;
5765
+ this.view.setUint32(offset, value, true); /* little-endian */
5766
+ }
5767
+
5768
+ get clamp_big(): number {
5769
+ return this.get_clamp_big();
5770
+ }
5771
+
5772
+ set clamp_big(value: number) {
5773
+ this.set_clamp_big(value);
5774
+ }
5775
+
5776
+ get_premium_multiplier(): number {
5572
5777
  const offset = 15;
5573
- return this.view.getBigUint64(offset, true); /* little-endian */
5778
+ return this.view.getUint32(offset, true); /* little-endian */
5574
5779
  }
5575
5780
 
5576
- set_mark_den(value: bigint): void {
5781
+ set_premium_multiplier(value: number): void {
5577
5782
  const offset = 15;
5578
- this.view.setBigUint64(offset, value, true); /* little-endian */
5783
+ this.view.setUint32(offset, value, true); /* little-endian */
5579
5784
  }
5580
5785
 
5581
- get mark_den(): bigint {
5582
- return this.get_mark_den();
5786
+ get premium_multiplier(): number {
5787
+ return this.get_premium_multiplier();
5583
5788
  }
5584
5789
 
5585
- set mark_den(value: bigint) {
5586
- this.set_mark_den(value);
5790
+ set premium_multiplier(value: number) {
5791
+ this.set_premium_multiplier(value);
5587
5792
  }
5588
5793
 
5589
- get_max_mark_age_ns(): bigint {
5590
- const offset = 23;
5591
- return this.view.getBigUint64(offset, true); /* little-endian */
5794
+ get_reserved1(): number {
5795
+ const offset = 19;
5796
+ return this.view.getUint32(offset, true); /* little-endian */
5592
5797
  }
5593
5798
 
5594
- set_max_mark_age_ns(value: bigint): void {
5595
- const offset = 23;
5596
- this.view.setBigUint64(offset, value, true); /* little-endian */
5799
+ set_reserved1(value: number): void {
5800
+ const offset = 19;
5801
+ this.view.setUint32(offset, value, true); /* little-endian */
5597
5802
  }
5598
5803
 
5599
- get max_mark_age_ns(): bigint {
5600
- return this.get_max_mark_age_ns();
5804
+ get reserved1(): number {
5805
+ return this.get_reserved1();
5601
5806
  }
5602
5807
 
5603
- set max_mark_age_ns(value: bigint) {
5604
- this.set_max_mark_age_ns(value);
5808
+ set reserved1(value: number) {
5809
+ this.set_reserved1(value);
5605
5810
  }
5606
5811
 
5607
- get_reserved0(): bigint {
5608
- const offset = 31;
5812
+ get_impact_notional(): bigint {
5813
+ const offset = 23;
5609
5814
  return this.view.getBigUint64(offset, true); /* little-endian */
5610
5815
  }
5611
5816
 
5612
- set_reserved0(value: bigint): void {
5613
- const offset = 31;
5817
+ set_impact_notional(value: bigint): void {
5818
+ const offset = 23;
5614
5819
  this.view.setBigUint64(offset, value, true); /* little-endian */
5615
5820
  }
5616
5821
 
5617
- get reserved0(): bigint {
5618
- return this.get_reserved0();
5822
+ get impact_notional(): bigint {
5823
+ return this.get_impact_notional();
5619
5824
  }
5620
5825
 
5621
- set reserved0(value: bigint) {
5826
+ set impact_notional(value: bigint) {
5827
+ this.set_impact_notional(value);
5828
+ }
5829
+
5830
+ private static __tnFootprintInternal(__tnParams: Record<string, bigint>): bigint {
5831
+ return __tnEvalFootprint(__tn_ir_MarketSetFundingInstruction.root, { params: __tnParams });
5832
+ }
5833
+
5834
+ private static __tnValidateInternal(buffer: Uint8Array, __tnParams: Record<string, bigint>): { ok: boolean; code?: string; consumed?: bigint } {
5835
+ return __tnValidateIrTree(__tn_ir_MarketSetFundingInstruction, buffer, __tnParams);
5836
+ }
5837
+
5838
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint {
5839
+ return this.__tnFootprintInternal(__tnParams);
5840
+ }
5841
+
5842
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult {
5843
+ return this.__tnValidateInternal(buffer, __tnParams);
5844
+ }
5845
+
5846
+ static footprintIr(): bigint {
5847
+ return this.__tnFootprintInternal(Object.create(null));
5848
+ }
5849
+
5850
+ static footprint(): number {
5851
+ const irResult = this.footprintIr();
5852
+ const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
5853
+ if (__tnBigIntGreaterThan(irResult, maxSafe)) {
5854
+ throw new Error('footprint exceeds Number.MAX_SAFE_INTEGER for MarketSetFundingInstruction');
5855
+ }
5856
+ return __tnBigIntToNumber(irResult, 'MarketSetFundingInstruction::footprint');
5857
+ }
5858
+
5859
+ static validate(buffer: Uint8Array, _opts?: { params?: never }): { ok: boolean; code?: string; consumed?: number } {
5860
+ if (buffer.length < 31) return { ok: false, code: "tn.buffer_too_small", consumed: 31 };
5861
+ return { ok: true, consumed: 31 };
5862
+ }
5863
+
5864
+ static new(market_record_idx: number, reserved0: number, interest_rate: number, clamp_small: number, clamp_big: number, premium_multiplier: number, reserved1: number, impact_notional: bigint): MarketSetFundingInstruction {
5865
+ const buffer = new Uint8Array(31);
5866
+ const view = new DataView(buffer.buffer);
5867
+
5868
+ let offset = 0;
5869
+ view.setUint8(0, market_record_idx); /* market_record_idx */
5870
+ view.setUint16(1, reserved0, true); /* reserved0 (little-endian) */
5871
+ view.setUint32(3, interest_rate, true); /* interest_rate (little-endian) */
5872
+ view.setUint32(7, clamp_small, true); /* clamp_small (little-endian) */
5873
+ view.setUint32(11, clamp_big, true); /* clamp_big (little-endian) */
5874
+ view.setUint32(15, premium_multiplier, true); /* premium_multiplier (little-endian) */
5875
+ view.setUint32(19, reserved1, true); /* reserved1 (little-endian) */
5876
+ view.setBigUint64(23, impact_notional, true); /* impact_notional (little-endian) */
5877
+
5878
+ return new MarketSetFundingInstruction(buffer);
5879
+ }
5880
+
5881
+ static from_array(buffer: Uint8Array): MarketSetFundingInstruction | null {
5882
+ if (!buffer || buffer.length === undefined) {
5883
+ return null;
5884
+ }
5885
+ const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
5886
+ const validation = this.validate(buffer);
5887
+ if (!validation.ok) {
5888
+ return null;
5889
+ }
5890
+ return new MarketSetFundingInstruction(buffer);
5891
+ }
5892
+
5893
+ }
5894
+
5895
+ export class MarketSetFundingInstructionBuilder {
5896
+ private buffer: Uint8Array;
5897
+ private view: DataView;
5898
+
5899
+ constructor() {
5900
+ this.buffer = new Uint8Array(31);
5901
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
5902
+ }
5903
+
5904
+ set_market_record_idx(value: number): this {
5905
+ this.view.setUint8(0, value);
5906
+ return this;
5907
+ }
5908
+
5909
+ set_reserved0(value: number): this {
5910
+ this.view.setUint16(1, value, true);
5911
+ return this;
5912
+ }
5913
+
5914
+ set_interest_rate(value: number): this {
5915
+ this.view.setUint32(3, value, true);
5916
+ return this;
5917
+ }
5918
+
5919
+ set_clamp_small(value: number): this {
5920
+ this.view.setUint32(7, value, true);
5921
+ return this;
5922
+ }
5923
+
5924
+ set_clamp_big(value: number): this {
5925
+ this.view.setUint32(11, value, true);
5926
+ return this;
5927
+ }
5928
+
5929
+ set_premium_multiplier(value: number): this {
5930
+ this.view.setUint32(15, value, true);
5931
+ return this;
5932
+ }
5933
+
5934
+ set_reserved1(value: number): this {
5935
+ this.view.setUint32(19, value, true);
5936
+ return this;
5937
+ }
5938
+
5939
+ set_impact_notional(value: bigint): this {
5940
+ const cast = __tnToBigInt(value);
5941
+ this.view.setBigUint64(23, cast, true);
5942
+ return this;
5943
+ }
5944
+
5945
+ build(): Uint8Array {
5946
+ return this.buffer.slice();
5947
+ }
5948
+
5949
+ buildInto(target: Uint8Array, offset = 0): Uint8Array {
5950
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
5951
+ target.set(this.buffer, offset);
5952
+ return target;
5953
+ }
5954
+
5955
+ finish(): MarketSetFundingInstruction {
5956
+ const view = MarketSetFundingInstruction.from_array(this.buffer.slice());
5957
+ if (!view) throw new Error("failed to build MarketSetFundingInstruction");
5958
+ return view;
5959
+ }
5960
+ }
5961
+
5962
+ __tnRegisterFootprint("MarketSetFundingInstruction", (params) => MarketSetFundingInstruction.__tnInvokeFootprint(params));
5963
+ __tnRegisterValidate("MarketSetFundingInstruction", (buffer, params) => MarketSetFundingInstruction.__tnInvokeValidate(buffer, params));
5964
+ __tnRegisterDynamicValidate("MarketSetFundingInstruction", (buffer) => { const result = MarketSetFundingInstruction.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
5965
+
5966
+ /* ----- TYPE DEFINITION FOR MarketSetOracleInstruction ----- */
5967
+
5968
+ const __tn_ir_MarketSetOracleInstruction = {
5969
+ typeName: "MarketSetOracleInstruction",
5970
+ root: { op: "const", value: 39n }
5971
+ } as const;
5972
+
5973
+ export class MarketSetOracleInstruction {
5974
+ private view: DataView;
5975
+
5976
+ private constructor(private buffer: Uint8Array) {
5977
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
5978
+ }
5979
+
5980
+ static __tnCreateView(buffer: Uint8Array, opts?: { fieldContext?: Record<string, number | bigint> }): MarketSetOracleInstruction {
5981
+ if (!buffer || buffer.length === undefined) throw new Error("MarketSetOracleInstruction.__tnCreateView requires a Uint8Array");
5982
+ return new MarketSetOracleInstruction(new Uint8Array(buffer));
5983
+ }
5984
+
5985
+ static builder(): MarketSetOracleInstructionBuilder {
5986
+ return new MarketSetOracleInstructionBuilder();
5987
+ }
5988
+
5989
+ static fromBuilder(builder: MarketSetOracleInstructionBuilder): MarketSetOracleInstruction | null {
5990
+ const buffer = builder.build();
5991
+ return MarketSetOracleInstruction.from_array(buffer);
5992
+ }
5993
+
5994
+ get_market_record_idx(): number {
5995
+ const offset = 0;
5996
+ return this.view.getUint8(offset);
5997
+ }
5998
+
5999
+ set_market_record_idx(value: number): void {
6000
+ const offset = 0;
6001
+ this.view.setUint8(offset, value);
6002
+ }
6003
+
6004
+ get market_record_idx(): number {
6005
+ return this.get_market_record_idx();
6006
+ }
6007
+
6008
+ set market_record_idx(value: number) {
6009
+ this.set_market_record_idx(value);
6010
+ }
6011
+
6012
+ get_oracle_feed_account_idx(): number {
6013
+ const offset = 1;
6014
+ return this.view.getUint16(offset, true); /* little-endian */
6015
+ }
6016
+
6017
+ set_oracle_feed_account_idx(value: number): void {
6018
+ const offset = 1;
6019
+ this.view.setUint16(offset, value, true); /* little-endian */
6020
+ }
6021
+
6022
+ get oracle_feed_account_idx(): number {
6023
+ return this.get_oracle_feed_account_idx();
6024
+ }
6025
+
6026
+ set oracle_feed_account_idx(value: number) {
6027
+ this.set_oracle_feed_account_idx(value);
6028
+ }
6029
+
6030
+ get_oracle_exponent(): number {
6031
+ const offset = 3;
6032
+ return this.view.getInt32(offset, true); /* little-endian */
6033
+ }
6034
+
6035
+ set_oracle_exponent(value: number): void {
6036
+ const offset = 3;
6037
+ this.view.setInt32(offset, value, true); /* little-endian */
6038
+ }
6039
+
6040
+ get oracle_exponent(): number {
6041
+ return this.get_oracle_exponent();
6042
+ }
6043
+
6044
+ set oracle_exponent(value: number) {
6045
+ this.set_oracle_exponent(value);
6046
+ }
6047
+
6048
+ get_mark_num(): bigint {
6049
+ const offset = 7;
6050
+ return this.view.getBigUint64(offset, true); /* little-endian */
6051
+ }
6052
+
6053
+ set_mark_num(value: bigint): void {
6054
+ const offset = 7;
6055
+ this.view.setBigUint64(offset, value, true); /* little-endian */
6056
+ }
6057
+
6058
+ get mark_num(): bigint {
6059
+ return this.get_mark_num();
6060
+ }
6061
+
6062
+ set mark_num(value: bigint) {
6063
+ this.set_mark_num(value);
6064
+ }
6065
+
6066
+ get_mark_den(): bigint {
6067
+ const offset = 15;
6068
+ return this.view.getBigUint64(offset, true); /* little-endian */
6069
+ }
6070
+
6071
+ set_mark_den(value: bigint): void {
6072
+ const offset = 15;
6073
+ this.view.setBigUint64(offset, value, true); /* little-endian */
6074
+ }
6075
+
6076
+ get mark_den(): bigint {
6077
+ return this.get_mark_den();
6078
+ }
6079
+
6080
+ set mark_den(value: bigint) {
6081
+ this.set_mark_den(value);
6082
+ }
6083
+
6084
+ get_max_mark_age_ns(): bigint {
6085
+ const offset = 23;
6086
+ return this.view.getBigUint64(offset, true); /* little-endian */
6087
+ }
6088
+
6089
+ set_max_mark_age_ns(value: bigint): void {
6090
+ const offset = 23;
6091
+ this.view.setBigUint64(offset, value, true); /* little-endian */
6092
+ }
6093
+
6094
+ get max_mark_age_ns(): bigint {
6095
+ return this.get_max_mark_age_ns();
6096
+ }
6097
+
6098
+ set max_mark_age_ns(value: bigint) {
6099
+ this.set_max_mark_age_ns(value);
6100
+ }
6101
+
6102
+ get_reserved0(): bigint {
6103
+ const offset = 31;
6104
+ return this.view.getBigUint64(offset, true); /* little-endian */
6105
+ }
6106
+
6107
+ set_reserved0(value: bigint): void {
6108
+ const offset = 31;
6109
+ this.view.setBigUint64(offset, value, true); /* little-endian */
6110
+ }
6111
+
6112
+ get reserved0(): bigint {
6113
+ return this.get_reserved0();
6114
+ }
6115
+
6116
+ set reserved0(value: bigint) {
5622
6117
  this.set_reserved0(value);
5623
6118
  }
5624
6119
 
@@ -7771,22 +8266,22 @@ export class SeatEntry {
7771
8266
  this.set_head_order_entry_idx(value);
7772
8267
  }
7773
8268
 
7774
- get_reserved0(): number {
8269
+ get_funding_carry(): number {
7775
8270
  const offset = 76;
7776
8271
  return this.view.getUint32(offset, true); /* little-endian */
7777
8272
  }
7778
8273
 
7779
- set_reserved0(value: number): void {
8274
+ set_funding_carry(value: number): void {
7780
8275
  const offset = 76;
7781
8276
  this.view.setUint32(offset, value, true); /* little-endian */
7782
8277
  }
7783
8278
 
7784
- get reserved0(): number {
7785
- return this.get_reserved0();
8279
+ get funding_carry(): number {
8280
+ return this.get_funding_carry();
7786
8281
  }
7787
8282
 
7788
- set reserved0(value: number) {
7789
- this.set_reserved0(value);
8283
+ set funding_carry(value: number) {
8284
+ this.set_funding_carry(value);
7790
8285
  }
7791
8286
 
7792
8287
  get_entry_notional(): bigint {
@@ -7843,31 +8338,40 @@ export class SeatEntry {
7843
8338
  this.set_open_ask_notional(value);
7844
8339
  }
7845
8340
 
7846
- get_reserved1(): number[] {
8341
+ get_funding_snapshot_lo(): bigint {
7847
8342
  const offset = 104;
7848
- const result: number[] = [];
7849
- for (let i = 0; i < 16; i++) {
7850
- result.push(this.view.getUint8((offset + i * 1)));
7851
- }
7852
- return result;
8343
+ return this.view.getBigUint64(offset, true); /* little-endian */
7853
8344
  }
7854
8345
 
7855
- set_reserved1(value: number[]): void {
8346
+ set_funding_snapshot_lo(value: bigint): void {
7856
8347
  const offset = 104;
7857
- if (value.length !== 16) {
7858
- throw new Error('Array length must be 16');
7859
- }
7860
- for (let i = 0; i < 16; i++) {
7861
- this.view.setUint8((offset + i * 1), value[i]);
7862
- }
8348
+ this.view.setBigUint64(offset, value, true); /* little-endian */
7863
8349
  }
7864
8350
 
7865
- get reserved1(): number[] {
7866
- return this.get_reserved1();
8351
+ get funding_snapshot_lo(): bigint {
8352
+ return this.get_funding_snapshot_lo();
7867
8353
  }
7868
8354
 
7869
- set reserved1(value: number[]) {
7870
- this.set_reserved1(value);
8355
+ set funding_snapshot_lo(value: bigint) {
8356
+ this.set_funding_snapshot_lo(value);
8357
+ }
8358
+
8359
+ get_funding_snapshot_hi(): bigint {
8360
+ const offset = 112;
8361
+ return this.view.getBigUint64(offset, true); /* little-endian */
8362
+ }
8363
+
8364
+ set_funding_snapshot_hi(value: bigint): void {
8365
+ const offset = 112;
8366
+ this.view.setBigUint64(offset, value, true); /* little-endian */
8367
+ }
8368
+
8369
+ get funding_snapshot_hi(): bigint {
8370
+ return this.get_funding_snapshot_hi();
8371
+ }
8372
+
8373
+ set funding_snapshot_hi(value: bigint) {
8374
+ this.set_funding_snapshot_hi(value);
7871
8375
  }
7872
8376
 
7873
8377
  get_non_nullable_reserved(): bigint {
@@ -7986,7 +8490,7 @@ export class SeatEntryBuilder {
7986
8490
  return this;
7987
8491
  }
7988
8492
 
7989
- set_reserved0(value: number): this {
8493
+ set_funding_carry(value: number): this {
7990
8494
  this.view.setUint32(76, value, true);
7991
8495
  return this;
7992
8496
  }
@@ -8009,12 +8513,15 @@ export class SeatEntryBuilder {
8009
8513
  return this;
8010
8514
  }
8011
8515
 
8012
- set_reserved1(values: number[]): this {
8013
- if (values.length !== 16) throw new Error("reserved1 expects 16 elements");
8014
- for (let i = 0; i < values.length; i++) {
8015
- const byteOffset = 104 + i * 1;
8016
- this.view.setUint8(byteOffset, values[i]);
8017
- }
8516
+ set_funding_snapshot_lo(value: bigint): this {
8517
+ const cast = __tnToBigInt(value);
8518
+ this.view.setBigUint64(104, cast, true);
8519
+ return this;
8520
+ }
8521
+
8522
+ set_funding_snapshot_hi(value: bigint): this {
8523
+ const cast = __tnToBigInt(value);
8524
+ this.view.setBigUint64(112, cast, true);
8018
8525
  return this;
8019
8526
  }
8020
8527
 
@@ -8041,9 +8548,196 @@ export class SeatEntryBuilder {
8041
8548
  }
8042
8549
  }
8043
8550
 
8044
- __tnRegisterFootprint("SeatEntry", (params) => SeatEntry.__tnInvokeFootprint(params));
8045
- __tnRegisterValidate("SeatEntry", (buffer, params) => SeatEntry.__tnInvokeValidate(buffer, params));
8046
- __tnRegisterDynamicValidate("SeatEntry", (buffer) => { const result = SeatEntry.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
8551
+ __tnRegisterFootprint("SeatEntry", (params) => SeatEntry.__tnInvokeFootprint(params));
8552
+ __tnRegisterValidate("SeatEntry", (buffer, params) => SeatEntry.__tnInvokeValidate(buffer, params));
8553
+ __tnRegisterDynamicValidate("SeatEntry", (buffer) => { const result = SeatEntry.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
8554
+
8555
+ /* ----- TYPE DEFINITION FOR SettleFundingInstruction ----- */
8556
+
8557
+ const __tn_ir_SettleFundingInstruction = {
8558
+ typeName: "SettleFundingInstruction",
8559
+ root: { op: "const", value: 7n }
8560
+ } as const;
8561
+
8562
+ export class SettleFundingInstruction {
8563
+ private view: DataView;
8564
+
8565
+ private constructor(private buffer: Uint8Array) {
8566
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
8567
+ }
8568
+
8569
+ static __tnCreateView(buffer: Uint8Array, opts?: { fieldContext?: Record<string, number | bigint> }): SettleFundingInstruction {
8570
+ if (!buffer || buffer.length === undefined) throw new Error("SettleFundingInstruction.__tnCreateView requires a Uint8Array");
8571
+ return new SettleFundingInstruction(new Uint8Array(buffer));
8572
+ }
8573
+
8574
+ static builder(): SettleFundingInstructionBuilder {
8575
+ return new SettleFundingInstructionBuilder();
8576
+ }
8577
+
8578
+ static fromBuilder(builder: SettleFundingInstructionBuilder): SettleFundingInstruction | null {
8579
+ const buffer = builder.build();
8580
+ return SettleFundingInstruction.from_array(buffer);
8581
+ }
8582
+
8583
+ get_market_record_idx(): number {
8584
+ const offset = 0;
8585
+ return this.view.getUint8(offset);
8586
+ }
8587
+
8588
+ set_market_record_idx(value: number): void {
8589
+ const offset = 0;
8590
+ this.view.setUint8(offset, value);
8591
+ }
8592
+
8593
+ get market_record_idx(): number {
8594
+ return this.get_market_record_idx();
8595
+ }
8596
+
8597
+ set market_record_idx(value: number) {
8598
+ this.set_market_record_idx(value);
8599
+ }
8600
+
8601
+ get_reserved0(): number {
8602
+ const offset = 1;
8603
+ return this.view.getUint16(offset, true); /* little-endian */
8604
+ }
8605
+
8606
+ set_reserved0(value: number): void {
8607
+ const offset = 1;
8608
+ this.view.setUint16(offset, value, true); /* little-endian */
8609
+ }
8610
+
8611
+ get reserved0(): number {
8612
+ return this.get_reserved0();
8613
+ }
8614
+
8615
+ set reserved0(value: number) {
8616
+ this.set_reserved0(value);
8617
+ }
8618
+
8619
+ get_target_seat_idx(): number {
8620
+ const offset = 3;
8621
+ return this.view.getUint32(offset, true); /* little-endian */
8622
+ }
8623
+
8624
+ set_target_seat_idx(value: number): void {
8625
+ const offset = 3;
8626
+ this.view.setUint32(offset, value, true); /* little-endian */
8627
+ }
8628
+
8629
+ get target_seat_idx(): number {
8630
+ return this.get_target_seat_idx();
8631
+ }
8632
+
8633
+ set target_seat_idx(value: number) {
8634
+ this.set_target_seat_idx(value);
8635
+ }
8636
+
8637
+ private static __tnFootprintInternal(__tnParams: Record<string, bigint>): bigint {
8638
+ return __tnEvalFootprint(__tn_ir_SettleFundingInstruction.root, { params: __tnParams });
8639
+ }
8640
+
8641
+ private static __tnValidateInternal(buffer: Uint8Array, __tnParams: Record<string, bigint>): { ok: boolean; code?: string; consumed?: bigint } {
8642
+ return __tnValidateIrTree(__tn_ir_SettleFundingInstruction, buffer, __tnParams);
8643
+ }
8644
+
8645
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint {
8646
+ return this.__tnFootprintInternal(__tnParams);
8647
+ }
8648
+
8649
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult {
8650
+ return this.__tnValidateInternal(buffer, __tnParams);
8651
+ }
8652
+
8653
+ static footprintIr(): bigint {
8654
+ return this.__tnFootprintInternal(Object.create(null));
8655
+ }
8656
+
8657
+ static footprint(): number {
8658
+ const irResult = this.footprintIr();
8659
+ const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
8660
+ if (__tnBigIntGreaterThan(irResult, maxSafe)) {
8661
+ throw new Error('footprint exceeds Number.MAX_SAFE_INTEGER for SettleFundingInstruction');
8662
+ }
8663
+ return __tnBigIntToNumber(irResult, 'SettleFundingInstruction::footprint');
8664
+ }
8665
+
8666
+ static validate(buffer: Uint8Array, _opts?: { params?: never }): { ok: boolean; code?: string; consumed?: number } {
8667
+ if (buffer.length < 7) return { ok: false, code: "tn.buffer_too_small", consumed: 7 };
8668
+ return { ok: true, consumed: 7 };
8669
+ }
8670
+
8671
+ static new(market_record_idx: number, reserved0: number, target_seat_idx: number): SettleFundingInstruction {
8672
+ const buffer = new Uint8Array(7);
8673
+ const view = new DataView(buffer.buffer);
8674
+
8675
+ let offset = 0;
8676
+ view.setUint8(0, market_record_idx); /* market_record_idx */
8677
+ view.setUint16(1, reserved0, true); /* reserved0 (little-endian) */
8678
+ view.setUint32(3, target_seat_idx, true); /* target_seat_idx (little-endian) */
8679
+
8680
+ return new SettleFundingInstruction(buffer);
8681
+ }
8682
+
8683
+ static from_array(buffer: Uint8Array): SettleFundingInstruction | null {
8684
+ if (!buffer || buffer.length === undefined) {
8685
+ return null;
8686
+ }
8687
+ const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
8688
+ const validation = this.validate(buffer);
8689
+ if (!validation.ok) {
8690
+ return null;
8691
+ }
8692
+ return new SettleFundingInstruction(buffer);
8693
+ }
8694
+
8695
+ }
8696
+
8697
+ export class SettleFundingInstructionBuilder {
8698
+ private buffer: Uint8Array;
8699
+ private view: DataView;
8700
+
8701
+ constructor() {
8702
+ this.buffer = new Uint8Array(7);
8703
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
8704
+ }
8705
+
8706
+ set_market_record_idx(value: number): this {
8707
+ this.view.setUint8(0, value);
8708
+ return this;
8709
+ }
8710
+
8711
+ set_reserved0(value: number): this {
8712
+ this.view.setUint16(1, value, true);
8713
+ return this;
8714
+ }
8715
+
8716
+ set_target_seat_idx(value: number): this {
8717
+ this.view.setUint32(3, value, true);
8718
+ return this;
8719
+ }
8720
+
8721
+ build(): Uint8Array {
8722
+ return this.buffer.slice();
8723
+ }
8724
+
8725
+ buildInto(target: Uint8Array, offset = 0): Uint8Array {
8726
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
8727
+ target.set(this.buffer, offset);
8728
+ return target;
8729
+ }
8730
+
8731
+ finish(): SettleFundingInstruction {
8732
+ const view = SettleFundingInstruction.from_array(this.buffer.slice());
8733
+ if (!view) throw new Error("failed to build SettleFundingInstruction");
8734
+ return view;
8735
+ }
8736
+ }
8737
+
8738
+ __tnRegisterFootprint("SettleFundingInstruction", (params) => SettleFundingInstruction.__tnInvokeFootprint(params));
8739
+ __tnRegisterValidate("SettleFundingInstruction", (buffer, params) => SettleFundingInstruction.__tnInvokeValidate(buffer, params));
8740
+ __tnRegisterDynamicValidate("SettleFundingInstruction", (buffer) => { const result = SettleFundingInstruction.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
8047
8741
 
8048
8742
  /* ----- TYPE DEFINITION FOR TokenBalanceEvent ----- */
8049
8743
 
@@ -10197,29 +10891,352 @@ export class ExchangeStatusEventBuilder {
10197
10891
  return this;
10198
10892
  }
10199
10893
 
10200
- set_new_status_flags(value: number): this {
10201
- this.view.setUint8(1, value);
10894
+ set_new_status_flags(value: number): this {
10895
+ this.view.setUint8(1, value);
10896
+ return this;
10897
+ }
10898
+
10899
+ set_reserved0(values: number[]): this {
10900
+ if (values.length !== 6) throw new Error("reserved0 expects 6 elements");
10901
+ for (let i = 0; i < values.length; i++) {
10902
+ const byteOffset = 2 + i * 1;
10903
+ this.view.setUint8(byteOffset, values[i]);
10904
+ }
10905
+ return this;
10906
+ }
10907
+
10908
+ set_exchange_meta(value: Uint8Array): this {
10909
+ if (value.length !== 32) throw new Error("exchange_meta expects 32 bytes");
10910
+ this.buffer.set(value, 8);
10911
+ return this;
10912
+ }
10913
+
10914
+ set_exchange_admin(value: Uint8Array): this {
10915
+ if (value.length !== 32) throw new Error("exchange_admin expects 32 bytes");
10916
+ this.buffer.set(value, 40);
10917
+ return this;
10918
+ }
10919
+
10920
+ build(): Uint8Array {
10921
+ return this.buffer.slice();
10922
+ }
10923
+
10924
+ buildInto(target: Uint8Array, offset = 0): Uint8Array {
10925
+ if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
10926
+ target.set(this.buffer, offset);
10927
+ return target;
10928
+ }
10929
+
10930
+ finish(): ExchangeStatusEvent {
10931
+ const view = ExchangeStatusEvent.from_array(this.buffer.slice());
10932
+ if (!view) throw new Error("failed to build ExchangeStatusEvent");
10933
+ return view;
10934
+ }
10935
+ }
10936
+
10937
+ __tnRegisterFootprint("ExchangeStatusEvent", (params) => ExchangeStatusEvent.__tnInvokeFootprint(params));
10938
+ __tnRegisterValidate("ExchangeStatusEvent", (buffer, params) => ExchangeStatusEvent.__tnInvokeValidate(buffer, params));
10939
+ __tnRegisterDynamicValidate("ExchangeStatusEvent", (buffer) => { const result = ExchangeStatusEvent.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
10940
+
10941
+ /* ----- TYPE DEFINITION FOR FundingRoundEvent ----- */
10942
+
10943
+ const __tn_ir_FundingRoundEvent = {
10944
+ typeName: "FundingRoundEvent",
10945
+ root: { op: "const", value: 88n }
10946
+ } as const;
10947
+
10948
+ export class FundingRoundEvent {
10949
+ private view: DataView;
10950
+
10951
+ private constructor(private buffer: Uint8Array) {
10952
+ this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
10953
+ }
10954
+
10955
+ static __tnCreateView(buffer: Uint8Array, opts?: { fieldContext?: Record<string, number | bigint> }): FundingRoundEvent {
10956
+ if (!buffer || buffer.length === undefined) throw new Error("FundingRoundEvent.__tnCreateView requires a Uint8Array");
10957
+ return new FundingRoundEvent(new Uint8Array(buffer));
10958
+ }
10959
+
10960
+ static builder(): FundingRoundEventBuilder {
10961
+ return new FundingRoundEventBuilder();
10962
+ }
10963
+
10964
+ static fromBuilder(builder: FundingRoundEventBuilder): FundingRoundEvent | null {
10965
+ const buffer = builder.build();
10966
+ return FundingRoundEvent.from_array(buffer);
10967
+ }
10968
+
10969
+ get_market(): Pubkey {
10970
+ const offset = 0;
10971
+ const slice = this.buffer.subarray(offset, offset + 32);
10972
+ return Pubkey.from_array(slice)!;
10973
+ }
10974
+
10975
+ set_market(value: Pubkey): void {
10976
+ /* Copy bytes from source struct to this field */
10977
+ const sourceBytes = (value as any).buffer as Uint8Array;
10978
+ const offset = 0;
10979
+ this.buffer.set(sourceBytes, offset);
10980
+ }
10981
+
10982
+ get market(): Pubkey {
10983
+ return this.get_market();
10984
+ }
10985
+
10986
+ set market(value: Pubkey) {
10987
+ this.set_market(value);
10988
+ }
10989
+
10990
+ get_rate(): bigint {
10991
+ const offset = 32;
10992
+ return this.view.getBigInt64(offset, true); /* little-endian */
10993
+ }
10994
+
10995
+ set_rate(value: bigint): void {
10996
+ const offset = 32;
10997
+ this.view.setBigInt64(offset, value, true); /* little-endian */
10998
+ }
10999
+
11000
+ get rate(): bigint {
11001
+ return this.get_rate();
11002
+ }
11003
+
11004
+ set rate(value: bigint) {
11005
+ this.set_rate(value);
11006
+ }
11007
+
11008
+ get_premium_sum(): bigint {
11009
+ const offset = 40;
11010
+ return this.view.getBigInt64(offset, true); /* little-endian */
11011
+ }
11012
+
11013
+ set_premium_sum(value: bigint): void {
11014
+ const offset = 40;
11015
+ this.view.setBigInt64(offset, value, true); /* little-endian */
11016
+ }
11017
+
11018
+ get premium_sum(): bigint {
11019
+ return this.get_premium_sum();
11020
+ }
11021
+
11022
+ set premium_sum(value: bigint) {
11023
+ this.set_premium_sum(value);
11024
+ }
11025
+
11026
+ get_sample_cnt(): number {
11027
+ const offset = 48;
11028
+ return this.view.getUint32(offset, true); /* little-endian */
11029
+ }
11030
+
11031
+ set_sample_cnt(value: number): void {
11032
+ const offset = 48;
11033
+ this.view.setUint32(offset, value, true); /* little-endian */
11034
+ }
11035
+
11036
+ get sample_cnt(): number {
11037
+ return this.get_sample_cnt();
11038
+ }
11039
+
11040
+ set sample_cnt(value: number) {
11041
+ this.set_sample_cnt(value);
11042
+ }
11043
+
11044
+ get_reserved0(): number {
11045
+ const offset = 52;
11046
+ return this.view.getUint32(offset, true); /* little-endian */
11047
+ }
11048
+
11049
+ set_reserved0(value: number): void {
11050
+ const offset = 52;
11051
+ this.view.setUint32(offset, value, true); /* little-endian */
11052
+ }
11053
+
11054
+ get reserved0(): number {
11055
+ return this.get_reserved0();
11056
+ }
11057
+
11058
+ set reserved0(value: number) {
11059
+ this.set_reserved0(value);
11060
+ }
11061
+
11062
+ get_index_price(): bigint {
11063
+ const offset = 56;
11064
+ return this.view.getBigUint64(offset, true); /* little-endian */
11065
+ }
11066
+
11067
+ set_index_price(value: bigint): void {
11068
+ const offset = 56;
11069
+ this.view.setBigUint64(offset, value, true); /* little-endian */
11070
+ }
11071
+
11072
+ get index_price(): bigint {
11073
+ return this.get_index_price();
11074
+ }
11075
+
11076
+ set index_price(value: bigint) {
11077
+ this.set_index_price(value);
11078
+ }
11079
+
11080
+ get_funding_index_lo(): bigint {
11081
+ const offset = 64;
11082
+ return this.view.getBigUint64(offset, true); /* little-endian */
11083
+ }
11084
+
11085
+ set_funding_index_lo(value: bigint): void {
11086
+ const offset = 64;
11087
+ this.view.setBigUint64(offset, value, true); /* little-endian */
11088
+ }
11089
+
11090
+ get funding_index_lo(): bigint {
11091
+ return this.get_funding_index_lo();
11092
+ }
11093
+
11094
+ set funding_index_lo(value: bigint) {
11095
+ this.set_funding_index_lo(value);
11096
+ }
11097
+
11098
+ get_funding_index_hi(): bigint {
11099
+ const offset = 72;
11100
+ return this.view.getBigUint64(offset, true); /* little-endian */
11101
+ }
11102
+
11103
+ set_funding_index_hi(value: bigint): void {
11104
+ const offset = 72;
11105
+ this.view.setBigUint64(offset, value, true); /* little-endian */
11106
+ }
11107
+
11108
+ get funding_index_hi(): bigint {
11109
+ return this.get_funding_index_hi();
11110
+ }
11111
+
11112
+ set funding_index_hi(value: bigint) {
11113
+ this.set_funding_index_hi(value);
11114
+ }
11115
+
11116
+ get_round_ns(): bigint {
11117
+ const offset = 80;
11118
+ return this.view.getBigUint64(offset, true); /* little-endian */
11119
+ }
11120
+
11121
+ set_round_ns(value: bigint): void {
11122
+ const offset = 80;
11123
+ this.view.setBigUint64(offset, value, true); /* little-endian */
11124
+ }
11125
+
11126
+ get round_ns(): bigint {
11127
+ return this.get_round_ns();
11128
+ }
11129
+
11130
+ set round_ns(value: bigint) {
11131
+ this.set_round_ns(value);
11132
+ }
11133
+
11134
+ private static __tnFootprintInternal(__tnParams: Record<string, bigint>): bigint {
11135
+ return __tnEvalFootprint(__tn_ir_FundingRoundEvent.root, { params: __tnParams });
11136
+ }
11137
+
11138
+ private static __tnValidateInternal(buffer: Uint8Array, __tnParams: Record<string, bigint>): { ok: boolean; code?: string; consumed?: bigint } {
11139
+ return __tnValidateIrTree(__tn_ir_FundingRoundEvent, buffer, __tnParams);
11140
+ }
11141
+
11142
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint {
11143
+ return this.__tnFootprintInternal(__tnParams);
11144
+ }
11145
+
11146
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult {
11147
+ return this.__tnValidateInternal(buffer, __tnParams);
11148
+ }
11149
+
11150
+ static footprintIr(): bigint {
11151
+ return this.__tnFootprintInternal(Object.create(null));
11152
+ }
11153
+
11154
+ static footprint(): number {
11155
+ const irResult = this.footprintIr();
11156
+ const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
11157
+ if (__tnBigIntGreaterThan(irResult, maxSafe)) {
11158
+ throw new Error('footprint exceeds Number.MAX_SAFE_INTEGER for FundingRoundEvent');
11159
+ }
11160
+ return __tnBigIntToNumber(irResult, 'FundingRoundEvent::footprint');
11161
+ }
11162
+
11163
+ static validate(buffer: Uint8Array, _opts?: { params?: never }): { ok: boolean; code?: string; consumed?: number } {
11164
+ if (buffer.length < 88) return { ok: false, code: "tn.buffer_too_small", consumed: 88 };
11165
+ return { ok: true, consumed: 88 };
11166
+ }
11167
+
11168
+ static from_array(buffer: Uint8Array): FundingRoundEvent | null {
11169
+ if (!buffer || buffer.length === undefined) {
11170
+ return null;
11171
+ }
11172
+ const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
11173
+ const validation = this.validate(buffer);
11174
+ if (!validation.ok) {
11175
+ return null;
11176
+ }
11177
+ return new FundingRoundEvent(buffer);
11178
+ }
11179
+
11180
+ }
11181
+
11182
+ export class FundingRoundEventBuilder {
11183
+ private buffer: Uint8Array;
11184
+ private view: DataView;
11185
+
11186
+ constructor() {
11187
+ this.buffer = new Uint8Array(88);
11188
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
11189
+ }
11190
+
11191
+ set_market(value: Uint8Array): this {
11192
+ if (value.length !== 32) throw new Error("market expects 32 bytes");
11193
+ this.buffer.set(value, 0);
11194
+ return this;
11195
+ }
11196
+
11197
+ set_rate(value: bigint): this {
11198
+ const cast = __tnToBigInt(value);
11199
+ this.view.setBigInt64(32, cast, true);
11200
+ return this;
11201
+ }
11202
+
11203
+ set_premium_sum(value: bigint): this {
11204
+ const cast = __tnToBigInt(value);
11205
+ this.view.setBigInt64(40, cast, true);
11206
+ return this;
11207
+ }
11208
+
11209
+ set_sample_cnt(value: number): this {
11210
+ this.view.setUint32(48, value, true);
11211
+ return this;
11212
+ }
11213
+
11214
+ set_reserved0(value: number): this {
11215
+ this.view.setUint32(52, value, true);
11216
+ return this;
11217
+ }
11218
+
11219
+ set_index_price(value: bigint): this {
11220
+ const cast = __tnToBigInt(value);
11221
+ this.view.setBigUint64(56, cast, true);
10202
11222
  return this;
10203
11223
  }
10204
11224
 
10205
- set_reserved0(values: number[]): this {
10206
- if (values.length !== 6) throw new Error("reserved0 expects 6 elements");
10207
- for (let i = 0; i < values.length; i++) {
10208
- const byteOffset = 2 + i * 1;
10209
- this.view.setUint8(byteOffset, values[i]);
10210
- }
11225
+ set_funding_index_lo(value: bigint): this {
11226
+ const cast = __tnToBigInt(value);
11227
+ this.view.setBigUint64(64, cast, true);
10211
11228
  return this;
10212
11229
  }
10213
11230
 
10214
- set_exchange_meta(value: Uint8Array): this {
10215
- if (value.length !== 32) throw new Error("exchange_meta expects 32 bytes");
10216
- this.buffer.set(value, 8);
11231
+ set_funding_index_hi(value: bigint): this {
11232
+ const cast = __tnToBigInt(value);
11233
+ this.view.setBigUint64(72, cast, true);
10217
11234
  return this;
10218
11235
  }
10219
11236
 
10220
- set_exchange_admin(value: Uint8Array): this {
10221
- if (value.length !== 32) throw new Error("exchange_admin expects 32 bytes");
10222
- this.buffer.set(value, 40);
11237
+ set_round_ns(value: bigint): this {
11238
+ const cast = __tnToBigInt(value);
11239
+ this.view.setBigUint64(80, cast, true);
10223
11240
  return this;
10224
11241
  }
10225
11242
 
@@ -10233,16 +11250,16 @@ export class ExchangeStatusEventBuilder {
10233
11250
  return target;
10234
11251
  }
10235
11252
 
10236
- finish(): ExchangeStatusEvent {
10237
- const view = ExchangeStatusEvent.from_array(this.buffer.slice());
10238
- if (!view) throw new Error("failed to build ExchangeStatusEvent");
11253
+ finish(): FundingRoundEvent {
11254
+ const view = FundingRoundEvent.from_array(this.buffer.slice());
11255
+ if (!view) throw new Error("failed to build FundingRoundEvent");
10239
11256
  return view;
10240
11257
  }
10241
11258
  }
10242
11259
 
10243
- __tnRegisterFootprint("ExchangeStatusEvent", (params) => ExchangeStatusEvent.__tnInvokeFootprint(params));
10244
- __tnRegisterValidate("ExchangeStatusEvent", (buffer, params) => ExchangeStatusEvent.__tnInvokeValidate(buffer, params));
10245
- __tnRegisterDynamicValidate("ExchangeStatusEvent", (buffer) => { const result = ExchangeStatusEvent.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
11260
+ __tnRegisterFootprint("FundingRoundEvent", (params) => FundingRoundEvent.__tnInvokeFootprint(params));
11261
+ __tnRegisterValidate("FundingRoundEvent", (buffer, params) => FundingRoundEvent.__tnInvokeValidate(buffer, params));
11262
+ __tnRegisterDynamicValidate("FundingRoundEvent", (buffer) => { const result = FundingRoundEvent.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
10246
11263
 
10247
11264
  /* ----- TYPE DEFINITION FOR LiquidationEvent ----- */
10248
11265
 
@@ -10684,7 +11701,7 @@ __tnRegisterDynamicValidate("LiquidationEvent", (buffer) => { const result = Liq
10684
11701
 
10685
11702
  const __tn_ir_MarketAccount = {
10686
11703
  typeName: "MarketAccount",
10687
- root: { op: "const", value: 320n }
11704
+ root: { op: "const", value: 448n }
10688
11705
  } as const;
10689
11706
 
10690
11707
  export class MarketAccount {
@@ -11194,6 +12211,285 @@ export class MarketAccount {
11194
12211
  this.set_reserved2(value);
11195
12212
  }
11196
12213
 
12214
+ get_funding_index_lo(): bigint {
12215
+ const offset = 320;
12216
+ return this.view.getBigUint64(offset, true); /* little-endian */
12217
+ }
12218
+
12219
+ set_funding_index_lo(value: bigint): void {
12220
+ const offset = 320;
12221
+ this.view.setBigUint64(offset, value, true); /* little-endian */
12222
+ }
12223
+
12224
+ get funding_index_lo(): bigint {
12225
+ return this.get_funding_index_lo();
12226
+ }
12227
+
12228
+ set funding_index_lo(value: bigint) {
12229
+ this.set_funding_index_lo(value);
12230
+ }
12231
+
12232
+ get_funding_index_hi(): bigint {
12233
+ const offset = 328;
12234
+ return this.view.getBigUint64(offset, true); /* little-endian */
12235
+ }
12236
+
12237
+ set_funding_index_hi(value: bigint): void {
12238
+ const offset = 328;
12239
+ this.view.setBigUint64(offset, value, true); /* little-endian */
12240
+ }
12241
+
12242
+ get funding_index_hi(): bigint {
12243
+ return this.get_funding_index_hi();
12244
+ }
12245
+
12246
+ set funding_index_hi(value: bigint) {
12247
+ this.set_funding_index_hi(value);
12248
+ }
12249
+
12250
+ get_funding_balance(): bigint {
12251
+ const offset = 336;
12252
+ return this.view.getBigInt64(offset, true); /* little-endian */
12253
+ }
12254
+
12255
+ set_funding_balance(value: bigint): void {
12256
+ const offset = 336;
12257
+ this.view.setBigInt64(offset, value, true); /* little-endian */
12258
+ }
12259
+
12260
+ get funding_balance(): bigint {
12261
+ return this.get_funding_balance();
12262
+ }
12263
+
12264
+ set funding_balance(value: bigint) {
12265
+ this.set_funding_balance(value);
12266
+ }
12267
+
12268
+ get_funding_last_round_ns(): bigint {
12269
+ const offset = 344;
12270
+ return this.view.getBigUint64(offset, true); /* little-endian */
12271
+ }
12272
+
12273
+ set_funding_last_round_ns(value: bigint): void {
12274
+ const offset = 344;
12275
+ this.view.setBigUint64(offset, value, true); /* little-endian */
12276
+ }
12277
+
12278
+ get funding_last_round_ns(): bigint {
12279
+ return this.get_funding_last_round_ns();
12280
+ }
12281
+
12282
+ set funding_last_round_ns(value: bigint) {
12283
+ this.set_funding_last_round_ns(value);
12284
+ }
12285
+
12286
+ get_funding_last_sample_ns(): bigint {
12287
+ const offset = 352;
12288
+ return this.view.getBigUint64(offset, true); /* little-endian */
12289
+ }
12290
+
12291
+ set_funding_last_sample_ns(value: bigint): void {
12292
+ const offset = 352;
12293
+ this.view.setBigUint64(offset, value, true); /* little-endian */
12294
+ }
12295
+
12296
+ get funding_last_sample_ns(): bigint {
12297
+ return this.get_funding_last_sample_ns();
12298
+ }
12299
+
12300
+ set funding_last_sample_ns(value: bigint) {
12301
+ this.set_funding_last_sample_ns(value);
12302
+ }
12303
+
12304
+ get_funding_premium_sum(): bigint {
12305
+ const offset = 360;
12306
+ return this.view.getBigInt64(offset, true); /* little-endian */
12307
+ }
12308
+
12309
+ set_funding_premium_sum(value: bigint): void {
12310
+ const offset = 360;
12311
+ this.view.setBigInt64(offset, value, true); /* little-endian */
12312
+ }
12313
+
12314
+ get funding_premium_sum(): bigint {
12315
+ return this.get_funding_premium_sum();
12316
+ }
12317
+
12318
+ set funding_premium_sum(value: bigint) {
12319
+ this.set_funding_premium_sum(value);
12320
+ }
12321
+
12322
+ get_funding_impact_notional(): bigint {
12323
+ const offset = 368;
12324
+ return this.view.getBigUint64(offset, true); /* little-endian */
12325
+ }
12326
+
12327
+ set_funding_impact_notional(value: bigint): void {
12328
+ const offset = 368;
12329
+ this.view.setBigUint64(offset, value, true); /* little-endian */
12330
+ }
12331
+
12332
+ get funding_impact_notional(): bigint {
12333
+ return this.get_funding_impact_notional();
12334
+ }
12335
+
12336
+ set funding_impact_notional(value: bigint) {
12337
+ this.set_funding_impact_notional(value);
12338
+ }
12339
+
12340
+ get_funding_rate(): bigint {
12341
+ const offset = 376;
12342
+ return this.view.getBigInt64(offset, true); /* little-endian */
12343
+ }
12344
+
12345
+ set_funding_rate(value: bigint): void {
12346
+ const offset = 376;
12347
+ this.view.setBigInt64(offset, value, true); /* little-endian */
12348
+ }
12349
+
12350
+ get funding_rate(): bigint {
12351
+ return this.get_funding_rate();
12352
+ }
12353
+
12354
+ set funding_rate(value: bigint) {
12355
+ this.set_funding_rate(value);
12356
+ }
12357
+
12358
+ get_funding_interest_rate(): number {
12359
+ const offset = 384;
12360
+ return this.view.getUint32(offset, true); /* little-endian */
12361
+ }
12362
+
12363
+ set_funding_interest_rate(value: number): void {
12364
+ const offset = 384;
12365
+ this.view.setUint32(offset, value, true); /* little-endian */
12366
+ }
12367
+
12368
+ get funding_interest_rate(): number {
12369
+ return this.get_funding_interest_rate();
12370
+ }
12371
+
12372
+ set funding_interest_rate(value: number) {
12373
+ this.set_funding_interest_rate(value);
12374
+ }
12375
+
12376
+ get_funding_clamp_small(): number {
12377
+ const offset = 388;
12378
+ return this.view.getUint32(offset, true); /* little-endian */
12379
+ }
12380
+
12381
+ set_funding_clamp_small(value: number): void {
12382
+ const offset = 388;
12383
+ this.view.setUint32(offset, value, true); /* little-endian */
12384
+ }
12385
+
12386
+ get funding_clamp_small(): number {
12387
+ return this.get_funding_clamp_small();
12388
+ }
12389
+
12390
+ set funding_clamp_small(value: number) {
12391
+ this.set_funding_clamp_small(value);
12392
+ }
12393
+
12394
+ get_funding_clamp_big(): number {
12395
+ const offset = 392;
12396
+ return this.view.getUint32(offset, true); /* little-endian */
12397
+ }
12398
+
12399
+ set_funding_clamp_big(value: number): void {
12400
+ const offset = 392;
12401
+ this.view.setUint32(offset, value, true); /* little-endian */
12402
+ }
12403
+
12404
+ get funding_clamp_big(): number {
12405
+ return this.get_funding_clamp_big();
12406
+ }
12407
+
12408
+ set funding_clamp_big(value: number) {
12409
+ this.set_funding_clamp_big(value);
12410
+ }
12411
+
12412
+ get_funding_premium_multiplier(): number {
12413
+ const offset = 396;
12414
+ return this.view.getUint32(offset, true); /* little-endian */
12415
+ }
12416
+
12417
+ set_funding_premium_multiplier(value: number): void {
12418
+ const offset = 396;
12419
+ this.view.setUint32(offset, value, true); /* little-endian */
12420
+ }
12421
+
12422
+ get funding_premium_multiplier(): number {
12423
+ return this.get_funding_premium_multiplier();
12424
+ }
12425
+
12426
+ set funding_premium_multiplier(value: number) {
12427
+ this.set_funding_premium_multiplier(value);
12428
+ }
12429
+
12430
+ get_funding_sample_cnt(): number {
12431
+ const offset = 400;
12432
+ return this.view.getUint32(offset, true); /* little-endian */
12433
+ }
12434
+
12435
+ set_funding_sample_cnt(value: number): void {
12436
+ const offset = 400;
12437
+ this.view.setUint32(offset, value, true); /* little-endian */
12438
+ }
12439
+
12440
+ get funding_sample_cnt(): number {
12441
+ return this.get_funding_sample_cnt();
12442
+ }
12443
+
12444
+ set funding_sample_cnt(value: number) {
12445
+ this.set_funding_sample_cnt(value);
12446
+ }
12447
+
12448
+ get_reserved3(): number {
12449
+ const offset = 404;
12450
+ return this.view.getUint32(offset, true); /* little-endian */
12451
+ }
12452
+
12453
+ set_reserved3(value: number): void {
12454
+ const offset = 404;
12455
+ this.view.setUint32(offset, value, true); /* little-endian */
12456
+ }
12457
+
12458
+ get reserved3(): number {
12459
+ return this.get_reserved3();
12460
+ }
12461
+
12462
+ set reserved3(value: number) {
12463
+ this.set_reserved3(value);
12464
+ }
12465
+
12466
+ get_reserved4(): number[] {
12467
+ const offset = 408;
12468
+ const result: number[] = [];
12469
+ for (let i = 0; i < 40; i++) {
12470
+ result.push(this.view.getUint8((offset + i * 1)));
12471
+ }
12472
+ return result;
12473
+ }
12474
+
12475
+ set_reserved4(value: number[]): void {
12476
+ const offset = 408;
12477
+ if (value.length !== 40) {
12478
+ throw new Error('Array length must be 40');
12479
+ }
12480
+ for (let i = 0; i < 40; i++) {
12481
+ this.view.setUint8((offset + i * 1), value[i]);
12482
+ }
12483
+ }
12484
+
12485
+ get reserved4(): number[] {
12486
+ return this.get_reserved4();
12487
+ }
12488
+
12489
+ set reserved4(value: number[]) {
12490
+ this.set_reserved4(value);
12491
+ }
12492
+
11197
12493
  private static __tnFootprintInternal(__tnParams: Record<string, bigint>): bigint {
11198
12494
  return __tnEvalFootprint(__tn_ir_MarketAccount.root, { params: __tnParams });
11199
12495
  }
@@ -11224,8 +12520,8 @@ export class MarketAccount {
11224
12520
  }
11225
12521
 
11226
12522
  static validate(buffer: Uint8Array, _opts?: { params?: never }): { ok: boolean; code?: string; consumed?: number } {
11227
- if (buffer.length < 320) return { ok: false, code: "tn.buffer_too_small", consumed: 320 };
11228
- return { ok: true, consumed: 320 };
12523
+ if (buffer.length < 448) return { ok: false, code: "tn.buffer_too_small", consumed: 448 };
12524
+ return { ok: true, consumed: 448 };
11229
12525
  }
11230
12526
 
11231
12527
  static from_array(buffer: Uint8Array): MarketAccount | null {
@@ -11247,7 +12543,7 @@ export class MarketAccountBuilder {
11247
12543
  private view: DataView;
11248
12544
 
11249
12545
  constructor() {
11250
- this.buffer = new Uint8Array(320);
12546
+ this.buffer = new Uint8Array(448);
11251
12547
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
11252
12548
  }
11253
12549
 
@@ -11353,48 +12649,135 @@ export class MarketAccountBuilder {
11353
12649
  return this;
11354
12650
  }
11355
12651
 
11356
- set_mark_num(value: bigint): this {
12652
+ set_mark_num(value: bigint): this {
12653
+ const cast = __tnToBigInt(value);
12654
+ this.view.setBigUint64(256, cast, true);
12655
+ return this;
12656
+ }
12657
+
12658
+ set_mark_den(value: bigint): this {
12659
+ const cast = __tnToBigInt(value);
12660
+ this.view.setBigUint64(264, cast, true);
12661
+ return this;
12662
+ }
12663
+
12664
+ set_initial_margin_bps(value: number): this {
12665
+ this.view.setUint32(272, value, true);
12666
+ return this;
12667
+ }
12668
+
12669
+ set_maintenance_margin_bps(value: number): this {
12670
+ this.view.setUint32(276, value, true);
12671
+ return this;
12672
+ }
12673
+
12674
+ set_liquidation_fee_bps(value: number): this {
12675
+ this.view.setUint32(280, value, true);
12676
+ return this;
12677
+ }
12678
+
12679
+ set_oracle_exponent(value: number): this {
12680
+ this.view.setInt32(284, value, true);
12681
+ return this;
12682
+ }
12683
+
12684
+ set_max_mark_age_ns(value: bigint): this {
12685
+ const cast = __tnToBigInt(value);
12686
+ this.view.setBigUint64(288, cast, true);
12687
+ return this;
12688
+ }
12689
+
12690
+ set_reserved2(values: number[]): this {
12691
+ if (values.length !== 24) throw new Error("reserved2 expects 24 elements");
12692
+ for (let i = 0; i < values.length; i++) {
12693
+ const byteOffset = 296 + i * 1;
12694
+ this.view.setUint8(byteOffset, values[i]);
12695
+ }
12696
+ return this;
12697
+ }
12698
+
12699
+ set_funding_index_lo(value: bigint): this {
12700
+ const cast = __tnToBigInt(value);
12701
+ this.view.setBigUint64(320, cast, true);
12702
+ return this;
12703
+ }
12704
+
12705
+ set_funding_index_hi(value: bigint): this {
12706
+ const cast = __tnToBigInt(value);
12707
+ this.view.setBigUint64(328, cast, true);
12708
+ return this;
12709
+ }
12710
+
12711
+ set_funding_balance(value: bigint): this {
12712
+ const cast = __tnToBigInt(value);
12713
+ this.view.setBigInt64(336, cast, true);
12714
+ return this;
12715
+ }
12716
+
12717
+ set_funding_last_round_ns(value: bigint): this {
12718
+ const cast = __tnToBigInt(value);
12719
+ this.view.setBigUint64(344, cast, true);
12720
+ return this;
12721
+ }
12722
+
12723
+ set_funding_last_sample_ns(value: bigint): this {
12724
+ const cast = __tnToBigInt(value);
12725
+ this.view.setBigUint64(352, cast, true);
12726
+ return this;
12727
+ }
12728
+
12729
+ set_funding_premium_sum(value: bigint): this {
12730
+ const cast = __tnToBigInt(value);
12731
+ this.view.setBigInt64(360, cast, true);
12732
+ return this;
12733
+ }
12734
+
12735
+ set_funding_impact_notional(value: bigint): this {
11357
12736
  const cast = __tnToBigInt(value);
11358
- this.view.setBigUint64(256, cast, true);
12737
+ this.view.setBigUint64(368, cast, true);
11359
12738
  return this;
11360
12739
  }
11361
12740
 
11362
- set_mark_den(value: bigint): this {
12741
+ set_funding_rate(value: bigint): this {
11363
12742
  const cast = __tnToBigInt(value);
11364
- this.view.setBigUint64(264, cast, true);
12743
+ this.view.setBigInt64(376, cast, true);
11365
12744
  return this;
11366
12745
  }
11367
12746
 
11368
- set_initial_margin_bps(value: number): this {
11369
- this.view.setUint32(272, value, true);
12747
+ set_funding_interest_rate(value: number): this {
12748
+ this.view.setUint32(384, value, true);
11370
12749
  return this;
11371
12750
  }
11372
12751
 
11373
- set_maintenance_margin_bps(value: number): this {
11374
- this.view.setUint32(276, value, true);
12752
+ set_funding_clamp_small(value: number): this {
12753
+ this.view.setUint32(388, value, true);
11375
12754
  return this;
11376
12755
  }
11377
12756
 
11378
- set_liquidation_fee_bps(value: number): this {
11379
- this.view.setUint32(280, value, true);
12757
+ set_funding_clamp_big(value: number): this {
12758
+ this.view.setUint32(392, value, true);
11380
12759
  return this;
11381
12760
  }
11382
12761
 
11383
- set_oracle_exponent(value: number): this {
11384
- this.view.setInt32(284, value, true);
12762
+ set_funding_premium_multiplier(value: number): this {
12763
+ this.view.setUint32(396, value, true);
11385
12764
  return this;
11386
12765
  }
11387
12766
 
11388
- set_max_mark_age_ns(value: bigint): this {
11389
- const cast = __tnToBigInt(value);
11390
- this.view.setBigUint64(288, cast, true);
12767
+ set_funding_sample_cnt(value: number): this {
12768
+ this.view.setUint32(400, value, true);
11391
12769
  return this;
11392
12770
  }
11393
12771
 
11394
- set_reserved2(values: number[]): this {
11395
- if (values.length !== 24) throw new Error("reserved2 expects 24 elements");
12772
+ set_reserved3(value: number): this {
12773
+ this.view.setUint32(404, value, true);
12774
+ return this;
12775
+ }
12776
+
12777
+ set_reserved4(values: number[]): this {
12778
+ if (values.length !== 40) throw new Error("reserved4 expects 40 elements");
11396
12779
  for (let i = 0; i < values.length; i++) {
11397
- const byteOffset = 296 + i * 1;
12780
+ const byteOffset = 408 + i * 1;
11398
12781
  this.view.setUint8(byteOffset, values[i]);
11399
12782
  }
11400
12783
  return this;
@@ -11425,7 +12808,7 @@ __tnRegisterDynamicValidate("MarketAccount", (buffer) => { const result = Market
11425
12808
 
11426
12809
  const __tn_ir_MarketAccountPayload = {
11427
12810
  typeName: "MarketAccountPayload",
11428
- root: { op: "const", value: 319n }
12811
+ root: { op: "const", value: 447n }
11429
12812
  } as const;
11430
12813
 
11431
12814
  export class MarketAccountPayload {
@@ -11917,6 +13300,285 @@ export class MarketAccountPayload {
11917
13300
  this.set_reserved2(value);
11918
13301
  }
11919
13302
 
13303
+ get_funding_index_lo(): bigint {
13304
+ const offset = 319;
13305
+ return this.view.getBigUint64(offset, true); /* little-endian */
13306
+ }
13307
+
13308
+ set_funding_index_lo(value: bigint): void {
13309
+ const offset = 319;
13310
+ this.view.setBigUint64(offset, value, true); /* little-endian */
13311
+ }
13312
+
13313
+ get funding_index_lo(): bigint {
13314
+ return this.get_funding_index_lo();
13315
+ }
13316
+
13317
+ set funding_index_lo(value: bigint) {
13318
+ this.set_funding_index_lo(value);
13319
+ }
13320
+
13321
+ get_funding_index_hi(): bigint {
13322
+ const offset = 327;
13323
+ return this.view.getBigUint64(offset, true); /* little-endian */
13324
+ }
13325
+
13326
+ set_funding_index_hi(value: bigint): void {
13327
+ const offset = 327;
13328
+ this.view.setBigUint64(offset, value, true); /* little-endian */
13329
+ }
13330
+
13331
+ get funding_index_hi(): bigint {
13332
+ return this.get_funding_index_hi();
13333
+ }
13334
+
13335
+ set funding_index_hi(value: bigint) {
13336
+ this.set_funding_index_hi(value);
13337
+ }
13338
+
13339
+ get_funding_balance(): bigint {
13340
+ const offset = 335;
13341
+ return this.view.getBigInt64(offset, true); /* little-endian */
13342
+ }
13343
+
13344
+ set_funding_balance(value: bigint): void {
13345
+ const offset = 335;
13346
+ this.view.setBigInt64(offset, value, true); /* little-endian */
13347
+ }
13348
+
13349
+ get funding_balance(): bigint {
13350
+ return this.get_funding_balance();
13351
+ }
13352
+
13353
+ set funding_balance(value: bigint) {
13354
+ this.set_funding_balance(value);
13355
+ }
13356
+
13357
+ get_funding_last_round_ns(): bigint {
13358
+ const offset = 343;
13359
+ return this.view.getBigUint64(offset, true); /* little-endian */
13360
+ }
13361
+
13362
+ set_funding_last_round_ns(value: bigint): void {
13363
+ const offset = 343;
13364
+ this.view.setBigUint64(offset, value, true); /* little-endian */
13365
+ }
13366
+
13367
+ get funding_last_round_ns(): bigint {
13368
+ return this.get_funding_last_round_ns();
13369
+ }
13370
+
13371
+ set funding_last_round_ns(value: bigint) {
13372
+ this.set_funding_last_round_ns(value);
13373
+ }
13374
+
13375
+ get_funding_last_sample_ns(): bigint {
13376
+ const offset = 351;
13377
+ return this.view.getBigUint64(offset, true); /* little-endian */
13378
+ }
13379
+
13380
+ set_funding_last_sample_ns(value: bigint): void {
13381
+ const offset = 351;
13382
+ this.view.setBigUint64(offset, value, true); /* little-endian */
13383
+ }
13384
+
13385
+ get funding_last_sample_ns(): bigint {
13386
+ return this.get_funding_last_sample_ns();
13387
+ }
13388
+
13389
+ set funding_last_sample_ns(value: bigint) {
13390
+ this.set_funding_last_sample_ns(value);
13391
+ }
13392
+
13393
+ get_funding_premium_sum(): bigint {
13394
+ const offset = 359;
13395
+ return this.view.getBigInt64(offset, true); /* little-endian */
13396
+ }
13397
+
13398
+ set_funding_premium_sum(value: bigint): void {
13399
+ const offset = 359;
13400
+ this.view.setBigInt64(offset, value, true); /* little-endian */
13401
+ }
13402
+
13403
+ get funding_premium_sum(): bigint {
13404
+ return this.get_funding_premium_sum();
13405
+ }
13406
+
13407
+ set funding_premium_sum(value: bigint) {
13408
+ this.set_funding_premium_sum(value);
13409
+ }
13410
+
13411
+ get_funding_impact_notional(): bigint {
13412
+ const offset = 367;
13413
+ return this.view.getBigUint64(offset, true); /* little-endian */
13414
+ }
13415
+
13416
+ set_funding_impact_notional(value: bigint): void {
13417
+ const offset = 367;
13418
+ this.view.setBigUint64(offset, value, true); /* little-endian */
13419
+ }
13420
+
13421
+ get funding_impact_notional(): bigint {
13422
+ return this.get_funding_impact_notional();
13423
+ }
13424
+
13425
+ set funding_impact_notional(value: bigint) {
13426
+ this.set_funding_impact_notional(value);
13427
+ }
13428
+
13429
+ get_funding_rate(): bigint {
13430
+ const offset = 375;
13431
+ return this.view.getBigInt64(offset, true); /* little-endian */
13432
+ }
13433
+
13434
+ set_funding_rate(value: bigint): void {
13435
+ const offset = 375;
13436
+ this.view.setBigInt64(offset, value, true); /* little-endian */
13437
+ }
13438
+
13439
+ get funding_rate(): bigint {
13440
+ return this.get_funding_rate();
13441
+ }
13442
+
13443
+ set funding_rate(value: bigint) {
13444
+ this.set_funding_rate(value);
13445
+ }
13446
+
13447
+ get_funding_interest_rate(): number {
13448
+ const offset = 383;
13449
+ return this.view.getUint32(offset, true); /* little-endian */
13450
+ }
13451
+
13452
+ set_funding_interest_rate(value: number): void {
13453
+ const offset = 383;
13454
+ this.view.setUint32(offset, value, true); /* little-endian */
13455
+ }
13456
+
13457
+ get funding_interest_rate(): number {
13458
+ return this.get_funding_interest_rate();
13459
+ }
13460
+
13461
+ set funding_interest_rate(value: number) {
13462
+ this.set_funding_interest_rate(value);
13463
+ }
13464
+
13465
+ get_funding_clamp_small(): number {
13466
+ const offset = 387;
13467
+ return this.view.getUint32(offset, true); /* little-endian */
13468
+ }
13469
+
13470
+ set_funding_clamp_small(value: number): void {
13471
+ const offset = 387;
13472
+ this.view.setUint32(offset, value, true); /* little-endian */
13473
+ }
13474
+
13475
+ get funding_clamp_small(): number {
13476
+ return this.get_funding_clamp_small();
13477
+ }
13478
+
13479
+ set funding_clamp_small(value: number) {
13480
+ this.set_funding_clamp_small(value);
13481
+ }
13482
+
13483
+ get_funding_clamp_big(): number {
13484
+ const offset = 391;
13485
+ return this.view.getUint32(offset, true); /* little-endian */
13486
+ }
13487
+
13488
+ set_funding_clamp_big(value: number): void {
13489
+ const offset = 391;
13490
+ this.view.setUint32(offset, value, true); /* little-endian */
13491
+ }
13492
+
13493
+ get funding_clamp_big(): number {
13494
+ return this.get_funding_clamp_big();
13495
+ }
13496
+
13497
+ set funding_clamp_big(value: number) {
13498
+ this.set_funding_clamp_big(value);
13499
+ }
13500
+
13501
+ get_funding_premium_multiplier(): number {
13502
+ const offset = 395;
13503
+ return this.view.getUint32(offset, true); /* little-endian */
13504
+ }
13505
+
13506
+ set_funding_premium_multiplier(value: number): void {
13507
+ const offset = 395;
13508
+ this.view.setUint32(offset, value, true); /* little-endian */
13509
+ }
13510
+
13511
+ get funding_premium_multiplier(): number {
13512
+ return this.get_funding_premium_multiplier();
13513
+ }
13514
+
13515
+ set funding_premium_multiplier(value: number) {
13516
+ this.set_funding_premium_multiplier(value);
13517
+ }
13518
+
13519
+ get_funding_sample_cnt(): number {
13520
+ const offset = 399;
13521
+ return this.view.getUint32(offset, true); /* little-endian */
13522
+ }
13523
+
13524
+ set_funding_sample_cnt(value: number): void {
13525
+ const offset = 399;
13526
+ this.view.setUint32(offset, value, true); /* little-endian */
13527
+ }
13528
+
13529
+ get funding_sample_cnt(): number {
13530
+ return this.get_funding_sample_cnt();
13531
+ }
13532
+
13533
+ set funding_sample_cnt(value: number) {
13534
+ this.set_funding_sample_cnt(value);
13535
+ }
13536
+
13537
+ get_reserved3(): number {
13538
+ const offset = 403;
13539
+ return this.view.getUint32(offset, true); /* little-endian */
13540
+ }
13541
+
13542
+ set_reserved3(value: number): void {
13543
+ const offset = 403;
13544
+ this.view.setUint32(offset, value, true); /* little-endian */
13545
+ }
13546
+
13547
+ get reserved3(): number {
13548
+ return this.get_reserved3();
13549
+ }
13550
+
13551
+ set reserved3(value: number) {
13552
+ this.set_reserved3(value);
13553
+ }
13554
+
13555
+ get_reserved4(): number[] {
13556
+ const offset = 407;
13557
+ const result: number[] = [];
13558
+ for (let i = 0; i < 40; i++) {
13559
+ result.push(this.view.getUint8((offset + i * 1)));
13560
+ }
13561
+ return result;
13562
+ }
13563
+
13564
+ set_reserved4(value: number[]): void {
13565
+ const offset = 407;
13566
+ if (value.length !== 40) {
13567
+ throw new Error('Array length must be 40');
13568
+ }
13569
+ for (let i = 0; i < 40; i++) {
13570
+ this.view.setUint8((offset + i * 1), value[i]);
13571
+ }
13572
+ }
13573
+
13574
+ get reserved4(): number[] {
13575
+ return this.get_reserved4();
13576
+ }
13577
+
13578
+ set reserved4(value: number[]) {
13579
+ this.set_reserved4(value);
13580
+ }
13581
+
11920
13582
  private static __tnFootprintInternal(__tnParams: Record<string, bigint>): bigint {
11921
13583
  return __tnEvalFootprint(__tn_ir_MarketAccountPayload.root, { params: __tnParams });
11922
13584
  }
@@ -11947,8 +13609,8 @@ export class MarketAccountPayload {
11947
13609
  }
11948
13610
 
11949
13611
  static validate(buffer: Uint8Array, _opts?: { params?: never }): { ok: boolean; code?: string; consumed?: number } {
11950
- if (buffer.length < 319) return { ok: false, code: "tn.buffer_too_small", consumed: 319 };
11951
- return { ok: true, consumed: 319 };
13612
+ if (buffer.length < 447) return { ok: false, code: "tn.buffer_too_small", consumed: 447 };
13613
+ return { ok: true, consumed: 447 };
11952
13614
  }
11953
13615
 
11954
13616
  static from_array(buffer: Uint8Array): MarketAccountPayload | null {
@@ -11970,7 +13632,7 @@ export class MarketAccountPayloadBuilder {
11970
13632
  private view: DataView;
11971
13633
 
11972
13634
  constructor() {
11973
- this.buffer = new Uint8Array(319);
13635
+ this.buffer = new Uint8Array(447);
11974
13636
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
11975
13637
  }
11976
13638
 
@@ -12118,6 +13780,93 @@ export class MarketAccountPayloadBuilder {
12118
13780
  return this;
12119
13781
  }
12120
13782
 
13783
+ set_funding_index_lo(value: bigint): this {
13784
+ const cast = __tnToBigInt(value);
13785
+ this.view.setBigUint64(319, cast, true);
13786
+ return this;
13787
+ }
13788
+
13789
+ set_funding_index_hi(value: bigint): this {
13790
+ const cast = __tnToBigInt(value);
13791
+ this.view.setBigUint64(327, cast, true);
13792
+ return this;
13793
+ }
13794
+
13795
+ set_funding_balance(value: bigint): this {
13796
+ const cast = __tnToBigInt(value);
13797
+ this.view.setBigInt64(335, cast, true);
13798
+ return this;
13799
+ }
13800
+
13801
+ set_funding_last_round_ns(value: bigint): this {
13802
+ const cast = __tnToBigInt(value);
13803
+ this.view.setBigUint64(343, cast, true);
13804
+ return this;
13805
+ }
13806
+
13807
+ set_funding_last_sample_ns(value: bigint): this {
13808
+ const cast = __tnToBigInt(value);
13809
+ this.view.setBigUint64(351, cast, true);
13810
+ return this;
13811
+ }
13812
+
13813
+ set_funding_premium_sum(value: bigint): this {
13814
+ const cast = __tnToBigInt(value);
13815
+ this.view.setBigInt64(359, cast, true);
13816
+ return this;
13817
+ }
13818
+
13819
+ set_funding_impact_notional(value: bigint): this {
13820
+ const cast = __tnToBigInt(value);
13821
+ this.view.setBigUint64(367, cast, true);
13822
+ return this;
13823
+ }
13824
+
13825
+ set_funding_rate(value: bigint): this {
13826
+ const cast = __tnToBigInt(value);
13827
+ this.view.setBigInt64(375, cast, true);
13828
+ return this;
13829
+ }
13830
+
13831
+ set_funding_interest_rate(value: number): this {
13832
+ this.view.setUint32(383, value, true);
13833
+ return this;
13834
+ }
13835
+
13836
+ set_funding_clamp_small(value: number): this {
13837
+ this.view.setUint32(387, value, true);
13838
+ return this;
13839
+ }
13840
+
13841
+ set_funding_clamp_big(value: number): this {
13842
+ this.view.setUint32(391, value, true);
13843
+ return this;
13844
+ }
13845
+
13846
+ set_funding_premium_multiplier(value: number): this {
13847
+ this.view.setUint32(395, value, true);
13848
+ return this;
13849
+ }
13850
+
13851
+ set_funding_sample_cnt(value: number): this {
13852
+ this.view.setUint32(399, value, true);
13853
+ return this;
13854
+ }
13855
+
13856
+ set_reserved3(value: number): this {
13857
+ this.view.setUint32(403, value, true);
13858
+ return this;
13859
+ }
13860
+
13861
+ set_reserved4(values: number[]): this {
13862
+ if (values.length !== 40) throw new Error("reserved4 expects 40 elements");
13863
+ for (let i = 0; i < values.length; i++) {
13864
+ const byteOffset = 407 + i * 1;
13865
+ this.view.setUint8(byteOffset, values[i]);
13866
+ }
13867
+ return this;
13868
+ }
13869
+
12121
13870
  build(): Uint8Array {
12122
13871
  return this.buffer.slice();
12123
13872
  }
@@ -15078,7 +16827,7 @@ __tnRegisterDynamicValidate("OrderPostedEvent", (buffer) => { const result = Ord
15078
16827
 
15079
16828
  const __tn_ir_PerpEvent = {
15080
16829
  typeName: "PerpEvent",
15081
- 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 } } }] } } } }
16830
+ 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 } } }] } } } }
15082
16831
  } as const;
15083
16832
 
15084
16833
  export class PerpEvent_payload_Inner {
@@ -15176,6 +16925,11 @@ export class PerpEvent_payload_Inner {
15176
16925
  return LiquidationEvent.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? undefined });
15177
16926
  }
15178
16927
 
16928
+ asFundingRound(): FundingRoundEvent | null {
16929
+ if (!this.descriptor || this.descriptor.tag !== 16) return null;
16930
+ return FundingRoundEvent.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? undefined });
16931
+ }
16932
+
15179
16933
  }
15180
16934
 
15181
16935
  export class PerpEvent {
@@ -15329,6 +17083,13 @@ export class PerpEvent {
15329
17083
  payloadType: "PerpEvent::payload::liquidation",
15330
17084
  createPayloadBuilder: () => __tnMaybeCallBuilder(LiquidationEvent),
15331
17085
  },
17086
+ {
17087
+ name: "funding_round",
17088
+ tag: 16,
17089
+ payloadSize: 88,
17090
+ payloadType: "PerpEvent::payload::funding_round",
17091
+ createPayloadBuilder: () => __tnMaybeCallBuilder(FundingRoundEvent),
17092
+ },
15332
17093
  ] as const);
15333
17094
 
15334
17095
  private static __tnExtractParams(view: DataView, buffer: Uint8Array): { params: PerpEvent.Params; derived: Record<string, bigint> | null } | null {
@@ -15721,6 +17482,21 @@ export class PerpInstruction_payload_Inner {
15721
17482
  return MarketSetOracleInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? undefined });
15722
17483
  }
15723
17484
 
17485
+ asFundingUpdate(): FundingUpdateInstruction | null {
17486
+ if (!this.descriptor || this.descriptor.tag !== 18) return null;
17487
+ return FundingUpdateInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? undefined });
17488
+ }
17489
+
17490
+ asMarketSetFunding(): MarketSetFundingInstruction | null {
17491
+ if (!this.descriptor || this.descriptor.tag !== 19) return null;
17492
+ return MarketSetFundingInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? undefined });
17493
+ }
17494
+
17495
+ asSettleFunding(): SettleFundingInstruction | null {
17496
+ if (!this.descriptor || this.descriptor.tag !== 20) return null;
17497
+ return SettleFundingInstruction.__tnCreateView(new Uint8Array(this.buffer), { fieldContext: this.__tnFieldContext ?? undefined });
17498
+ }
17499
+
15724
17500
  }
15725
17501
 
15726
17502
  export class PerpInstruction {
@@ -15874,6 +17650,27 @@ export class PerpInstruction {
15874
17650
  payloadType: "PerpInstruction::payload::market_set_oracle",
15875
17651
  createPayloadBuilder: () => __tnMaybeCallBuilder(MarketSetOracleInstruction),
15876
17652
  },
17653
+ {
17654
+ name: "funding_update",
17655
+ tag: 18,
17656
+ payloadSize: 7,
17657
+ payloadType: "PerpInstruction::payload::funding_update",
17658
+ createPayloadBuilder: () => __tnMaybeCallBuilder(FundingUpdateInstruction),
17659
+ },
17660
+ {
17661
+ name: "market_set_funding",
17662
+ tag: 19,
17663
+ payloadSize: 31,
17664
+ payloadType: "PerpInstruction::payload::market_set_funding",
17665
+ createPayloadBuilder: () => __tnMaybeCallBuilder(MarketSetFundingInstruction),
17666
+ },
17667
+ {
17668
+ name: "settle_funding",
17669
+ tag: 20,
17670
+ payloadSize: 7,
17671
+ payloadType: "PerpInstruction::payload::settle_funding",
17672
+ createPayloadBuilder: () => __tnMaybeCallBuilder(SettleFundingInstruction),
17673
+ },
15877
17674
  ] as const);
15878
17675
 
15879
17676
  static __tnComputeSequentialLayout(view: DataView, buffer: Uint8Array): { params: Record<string, bigint> | null; offsets: Record<string, number> | null; derived: Record<string, bigint> | null } | null {
@@ -15904,6 +17701,9 @@ export class PerpInstruction {
15904
17701
  case 15: break;
15905
17702
  case 16: break;
15906
17703
  case 17: break;
17704
+ case 18: break;
17705
+ case 19: break;
17706
+ case 20: break;
15907
17707
  default: return null;
15908
17708
  }
15909
17709
  if (__tnCursorMutable > __tnLength) return null;
@@ -16220,7 +18020,7 @@ __tnRegisterDynamicValidate("PerpInstruction", (buffer) => { const result = Perp
16220
18020
 
16221
18021
  const __tn_ir_PerpProgramAccount = {
16222
18022
  typeName: "PerpProgramAccount",
16223
- 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 } } }] } } } }
18023
+ 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 } } }] } } } }
16224
18024
  } as const;
16225
18025
 
16226
18026
  export class PerpProgramAccount_payload_Inner {
@@ -16304,7 +18104,7 @@ export class PerpProgramAccount {
16304
18104
  {
16305
18105
  name: "market",
16306
18106
  tag: 121,
16307
- payloadSize: 319,
18107
+ payloadSize: 447,
16308
18108
  payloadType: "PerpProgramAccount::payload::market",
16309
18109
  createPayloadBuilder: () => __tnMaybeCallBuilder(MarketAccountPayload),
16310
18110
  },
@@ -16609,7 +18409,7 @@ __tnRegisterDynamicValidate("PerpProgramAccount", (buffer) => { const result = P
16609
18409
 
16610
18410
  const __tn_ir_SeatArenaAccount = {
16611
18411
  typeName: "SeatArenaAccount",
16612
- 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 } } } } }
18412
+ 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 } } } } }
16613
18413
  } as const;
16614
18414
 
16615
18415
  export class SeatArenaAccount {
@@ -16647,7 +18447,7 @@ export class SeatArenaAccount {
16647
18447
 
16648
18448
  get_market(): MarketAccount {
16649
18449
  const offset = 0;
16650
- const slice = this.buffer.subarray(offset, offset + 320);
18450
+ const slice = this.buffer.subarray(offset, offset + 448);
16651
18451
  return MarketAccount.from_array(slice)!;
16652
18452
  }
16653
18453
 
@@ -16667,20 +18467,20 @@ export class SeatArenaAccount {
16667
18467
  }
16668
18468
 
16669
18469
  get_reserved_market_padding(): number[] {
16670
- const offset = 320;
18470
+ const offset = 448;
16671
18471
  const result: number[] = [];
16672
- for (let i = 0; i < 192; i++) {
18472
+ for (let i = 0; i < 64; i++) {
16673
18473
  result.push(this.view.getUint8((offset + i * 1)));
16674
18474
  }
16675
18475
  return result;
16676
18476
  }
16677
18477
 
16678
18478
  set_reserved_market_padding(value: number[]): void {
16679
- const offset = 320;
16680
- if (value.length !== 192) {
16681
- throw new Error('Array length must be 192');
18479
+ const offset = 448;
18480
+ if (value.length !== 64) {
18481
+ throw new Error('Array length must be 64');
16682
18482
  }
16683
- for (let i = 0; i < 192; i++) {
18483
+ for (let i = 0; i < 64; i++) {
16684
18484
  this.view.setUint8((offset + i * 1), value[i]);
16685
18485
  }
16686
18486
  }