@thru/programs 0.2.30 → 0.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/amm/index.cjs +6424 -0
- package/dist/amm/index.cjs.map +1 -0
- package/dist/amm/index.d.cts +1424 -0
- package/dist/amm/index.d.ts +1424 -0
- package/dist/amm/index.js +6360 -0
- package/dist/amm/index.js.map +1 -0
- package/dist/chunk-P5OABVJI.js +28 -0
- package/dist/chunk-P5OABVJI.js.map +1 -0
- package/dist/multicall/index.cjs +1 -1
- package/dist/multicall/index.cjs.map +1 -1
- package/dist/multicall/index.d.cts +2 -2
- package/dist/multicall/index.d.ts +2 -2
- package/dist/multicall/index.js +1 -1
- package/dist/multicall/index.js.map +1 -1
- package/dist/passkey-manager/index.cjs +33 -27
- package/dist/passkey-manager/index.cjs.map +1 -1
- package/dist/passkey-manager/index.d.cts +4 -3
- package/dist/passkey-manager/index.d.ts +4 -3
- package/dist/passkey-manager/index.js +9 -28
- package/dist/passkey-manager/index.js.map +1 -1
- package/dist/token/index.cjs +1760 -275
- package/dist/token/index.cjs.map +1 -1
- package/dist/token/index.d.cts +124 -20
- package/dist/token/index.d.ts +124 -20
- package/dist/token/index.js +1760 -275
- package/dist/token/index.js.map +1 -1
- package/package.json +9 -2
- package/src/amm/abi/thru/common/primitives/types.ts +2269 -0
- package/src/amm/abi/thru/program/amm/types.ts +5621 -0
- package/src/amm/index.test.ts +255 -0
- package/src/amm/index.ts +434 -0
- package/src/helpers/bytes.ts +25 -0
- package/src/multicall/abi/thru/common/primitives/types.ts +5 -6
- package/src/multicall/abi/thru/program/multicall/types.ts +1 -2
- package/src/passkey-manager/abi/thru/blockchain/state_proof/types.ts +0 -1
- package/src/passkey-manager/abi/thru/common/primitives/types.ts +0 -1
- package/src/passkey-manager/abi/thru/program/passkey_manager/types.ts +4 -5
- package/src/passkey-manager/encoding.ts +2 -26
- package/src/token/abi/thru/blockchain/state_proof/types.ts +101 -21
- package/src/token/abi/thru/common/primitives/types.ts +1295 -167
- package/src/token/abi/thru/program/token/types.ts +647 -237
- package/tsup.config.ts +1 -0
package/dist/token/index.cjs
CHANGED
|
@@ -24,6 +24,46 @@ function __tnWarnOnce(message) {
|
|
|
24
24
|
__tnLogWarn(message);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
function __tnResolveBuilderInput(input, context) {
|
|
28
|
+
if (input instanceof Uint8Array) {
|
|
29
|
+
return new Uint8Array(input);
|
|
30
|
+
}
|
|
31
|
+
if (input && typeof input.build === "function") {
|
|
32
|
+
const built = input.build();
|
|
33
|
+
if (!(built instanceof Uint8Array)) {
|
|
34
|
+
throw new Error(`${context}: builder did not return Uint8Array`);
|
|
35
|
+
}
|
|
36
|
+
return new Uint8Array(built);
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`${context}: expected Uint8Array or builder`);
|
|
39
|
+
}
|
|
40
|
+
function __tnCreateFamWriter(parent, fieldName, assign) {
|
|
41
|
+
let hasWritten = false;
|
|
42
|
+
return {
|
|
43
|
+
write(payload) {
|
|
44
|
+
const bytes = __tnResolveBuilderInput(
|
|
45
|
+
payload,
|
|
46
|
+
`flexible array '${fieldName}'`
|
|
47
|
+
);
|
|
48
|
+
const copy = new Uint8Array(bytes);
|
|
49
|
+
assign(copy);
|
|
50
|
+
hasWritten = true;
|
|
51
|
+
return {
|
|
52
|
+
finish() {
|
|
53
|
+
return parent;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
finish() {
|
|
58
|
+
if (!hasWritten) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`flexible array '${fieldName}' requires write() before finish()`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return parent;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
27
67
|
var __tnMask32 = __tnHasNativeBigInt ? (BigInt(1) << BigInt(32)) - BigInt(1) : 4294967295;
|
|
28
68
|
var __tnSignBit32 = __tnHasNativeBigInt ? BigInt(1) << BigInt(31) : 2147483648;
|
|
29
69
|
function __tnToBigInt(value) {
|
|
@@ -248,12 +288,16 @@ if (typeof DataView !== "undefined" && !__tnHasBigIntDataView) {
|
|
|
248
288
|
}
|
|
249
289
|
var __tnFootprintRegistry = {};
|
|
250
290
|
var __tnValidateRegistry = {};
|
|
291
|
+
var __tnDynamicValidateRegistry = {};
|
|
251
292
|
function __tnRegisterFootprint(typeName, fn) {
|
|
252
293
|
__tnFootprintRegistry[typeName] = fn;
|
|
253
294
|
}
|
|
254
295
|
function __tnRegisterValidate(typeName, fn) {
|
|
255
296
|
__tnValidateRegistry[typeName] = fn;
|
|
256
297
|
}
|
|
298
|
+
function __tnRegisterDynamicValidate(typeName, fn) {
|
|
299
|
+
__tnDynamicValidateRegistry[typeName] = fn;
|
|
300
|
+
}
|
|
257
301
|
function __tnInvokeFootprint(typeName, params) {
|
|
258
302
|
const fn = __tnFootprintRegistry[typeName];
|
|
259
303
|
if (!fn) throw new Error(`IR runtime missing footprint for ${typeName}`);
|
|
@@ -264,12 +308,17 @@ function __tnInvokeValidate(typeName, buffer, params) {
|
|
|
264
308
|
if (!fn) throw new Error(`IR runtime missing validate helper for ${typeName}`);
|
|
265
309
|
return fn(buffer, params);
|
|
266
310
|
}
|
|
311
|
+
function __tnInvokeDynamicValidate(typeName, buffer) {
|
|
312
|
+
const fn = __tnDynamicValidateRegistry[typeName];
|
|
313
|
+
if (!fn) throw new Error(`IR runtime missing dynamic validate helper for ${typeName}`);
|
|
314
|
+
return fn(buffer);
|
|
315
|
+
}
|
|
267
316
|
function __tnEvalFootprint(node, ctx) {
|
|
268
|
-
return __tnEvalIrNode(node, ctx);
|
|
317
|
+
return __tnEvalIrNode(node, ctx, __tnToBigInt(0));
|
|
269
318
|
}
|
|
270
319
|
function __tnTryEvalIr(node, ctx) {
|
|
271
320
|
try {
|
|
272
|
-
return { ok: true, value: __tnEvalIrNode(node, ctx) };
|
|
321
|
+
return { ok: true, value: __tnEvalIrNode(node, ctx, __tnToBigInt(0)) };
|
|
273
322
|
} catch (err) {
|
|
274
323
|
return { ok: false, code: __tnNormalizeIrError(err) };
|
|
275
324
|
}
|
|
@@ -293,7 +342,7 @@ function __tnValidateIrTree(ir, buffer, params) {
|
|
|
293
342
|
}
|
|
294
343
|
return { ok: true, consumed: required };
|
|
295
344
|
}
|
|
296
|
-
function __tnEvalIrNode(node, ctx) {
|
|
345
|
+
function __tnEvalIrNode(node, ctx, baseOffset) {
|
|
297
346
|
switch (node.op) {
|
|
298
347
|
case "zero":
|
|
299
348
|
return __tnToBigInt(0);
|
|
@@ -310,18 +359,22 @@ function __tnEvalIrNode(node, ctx) {
|
|
|
310
359
|
}
|
|
311
360
|
return val;
|
|
312
361
|
}
|
|
313
|
-
case "add":
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
362
|
+
case "add": {
|
|
363
|
+
const left = __tnEvalIrNode(node.left, ctx, baseOffset);
|
|
364
|
+
const right = __tnEvalIrNode(
|
|
365
|
+
node.right,
|
|
366
|
+
ctx,
|
|
367
|
+
__tnCheckedAdd(baseOffset, left)
|
|
317
368
|
);
|
|
369
|
+
return __tnCheckedAdd(left, right);
|
|
370
|
+
}
|
|
318
371
|
case "mul":
|
|
319
372
|
return __tnCheckedMul(
|
|
320
|
-
__tnEvalIrNode(node.left, ctx),
|
|
321
|
-
__tnEvalIrNode(node.right, ctx)
|
|
373
|
+
__tnEvalIrNode(node.left, ctx, baseOffset),
|
|
374
|
+
__tnEvalIrNode(node.right, ctx, baseOffset)
|
|
322
375
|
);
|
|
323
376
|
case "align":
|
|
324
|
-
return __tnAlign(__tnEvalIrNode(node.node, ctx), node.alignment);
|
|
377
|
+
return __tnAlign(__tnEvalIrNode(node.node, ctx, baseOffset), node.alignment);
|
|
325
378
|
case "switch": {
|
|
326
379
|
const tagVal = ctx.params[node.tag];
|
|
327
380
|
if (tagVal === void 0) {
|
|
@@ -334,10 +387,10 @@ function __tnEvalIrNode(node, ctx) {
|
|
|
334
387
|
const tagNumber = Number(tagVal);
|
|
335
388
|
for (const caseNode of node.cases) {
|
|
336
389
|
if (caseNode.value === tagNumber) {
|
|
337
|
-
return __tnEvalIrNode(caseNode.node, ctx);
|
|
390
|
+
return __tnEvalIrNode(caseNode.node, ctx, baseOffset);
|
|
338
391
|
}
|
|
339
392
|
}
|
|
340
|
-
if (node.default) return __tnEvalIrNode(node.default, ctx);
|
|
393
|
+
if (node.default) return __tnEvalIrNode(node.default, ctx, baseOffset);
|
|
341
394
|
__tnRaiseIrError(
|
|
342
395
|
"tn.ir.invalid_tag",
|
|
343
396
|
`Unhandled IR switch value ${tagNumber} for '${node.tag}'`
|
|
@@ -357,9 +410,10 @@ function __tnEvalIrNode(node, ctx) {
|
|
|
357
410
|
nestedParams[arg.name] = val;
|
|
358
411
|
}
|
|
359
412
|
if (ctx.buffer) {
|
|
413
|
+
const nestedOffset = __tnBigIntToNumber(baseOffset, "IR nested offset");
|
|
360
414
|
const nestedResult = __tnInvokeValidate(
|
|
361
415
|
node.typeName,
|
|
362
|
-
ctx.buffer,
|
|
416
|
+
ctx.buffer.subarray(nestedOffset),
|
|
363
417
|
nestedParams
|
|
364
418
|
);
|
|
365
419
|
if (!nestedResult.ok) {
|
|
@@ -376,6 +430,36 @@ function __tnEvalIrNode(node, ctx) {
|
|
|
376
430
|
}
|
|
377
431
|
return __tnInvokeFootprint(node.typeName, nestedParams);
|
|
378
432
|
}
|
|
433
|
+
case "sumOverArray": {
|
|
434
|
+
if (!ctx.buffer) {
|
|
435
|
+
__tnRaiseIrError(
|
|
436
|
+
"tn.ir.missing_buffer",
|
|
437
|
+
`Jagged array '${node.fieldName}' requires buffer-backed validation`
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
const count = __tnBigIntToNumber(
|
|
441
|
+
__tnEvalIrNode(node.count, ctx, baseOffset),
|
|
442
|
+
`Jagged array '${node.fieldName}' count`
|
|
443
|
+
);
|
|
444
|
+
let cursor = __tnBigIntToNumber(baseOffset, "IR jagged array offset");
|
|
445
|
+
let total = __tnToBigInt(0);
|
|
446
|
+
for (let i = 0; i < count; i++) {
|
|
447
|
+
const result = __tnInvokeDynamicValidate(
|
|
448
|
+
node.elementTypeName,
|
|
449
|
+
ctx.buffer.subarray(cursor)
|
|
450
|
+
);
|
|
451
|
+
if (!result.ok || result.consumed === void 0) {
|
|
452
|
+
const code = result.code ?? "tn.ir.runtime_error";
|
|
453
|
+
__tnRaiseIrError(
|
|
454
|
+
code,
|
|
455
|
+
`Jagged array '${node.fieldName}' element ${i} failed validation`
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
cursor += __tnBigIntToNumber(result.consumed, "IR jagged element size");
|
|
459
|
+
total = __tnCheckedAdd(total, result.consumed);
|
|
460
|
+
}
|
|
461
|
+
return total;
|
|
462
|
+
}
|
|
379
463
|
default:
|
|
380
464
|
__tnRaiseIrError(
|
|
381
465
|
"tn.ir.runtime_error",
|
|
@@ -399,54 +483,206 @@ function __tnNormalizeIrError(err) {
|
|
|
399
483
|
if (message.length > 0) return `tn.ir.runtime_error: ${message}`;
|
|
400
484
|
return "tn.ir.runtime_error";
|
|
401
485
|
}
|
|
402
|
-
var
|
|
403
|
-
typeName: "
|
|
404
|
-
root: { op: "const", value:
|
|
486
|
+
var __tn_ir_Date = {
|
|
487
|
+
typeName: "Date",
|
|
488
|
+
root: { op: "const", value: 6n }
|
|
405
489
|
};
|
|
406
|
-
var
|
|
490
|
+
var Date = class _Date {
|
|
407
491
|
constructor(buffer) {
|
|
408
492
|
this.buffer = buffer;
|
|
409
493
|
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
410
494
|
}
|
|
411
495
|
static __tnCreateView(buffer, opts) {
|
|
412
|
-
if (!buffer || buffer.length === void 0) throw new Error("
|
|
413
|
-
return new
|
|
496
|
+
if (!buffer || buffer.length === void 0) throw new Error("Date.__tnCreateView requires a Uint8Array");
|
|
497
|
+
return new _Date(new Uint8Array(buffer));
|
|
414
498
|
}
|
|
415
499
|
static builder() {
|
|
416
|
-
return new
|
|
500
|
+
return new DateBuilder();
|
|
417
501
|
}
|
|
418
502
|
static fromBuilder(builder) {
|
|
419
503
|
const buffer = builder.build();
|
|
420
|
-
return
|
|
504
|
+
return _Date.from_array(buffer);
|
|
421
505
|
}
|
|
422
|
-
|
|
506
|
+
get_year() {
|
|
423
507
|
const offset = 0;
|
|
424
|
-
|
|
425
|
-
for (let i = 0; i < 32; i++) {
|
|
426
|
-
result.push(this.view.getUint8(offset + i * 1));
|
|
427
|
-
}
|
|
428
|
-
return result;
|
|
508
|
+
return this.view.getInt32(offset, true);
|
|
429
509
|
}
|
|
430
|
-
|
|
510
|
+
set_year(value) {
|
|
431
511
|
const offset = 0;
|
|
432
|
-
|
|
433
|
-
|
|
512
|
+
this.view.setInt32(offset, value, true);
|
|
513
|
+
}
|
|
514
|
+
get year() {
|
|
515
|
+
return this.get_year();
|
|
516
|
+
}
|
|
517
|
+
set year(value) {
|
|
518
|
+
this.set_year(value);
|
|
519
|
+
}
|
|
520
|
+
get_month() {
|
|
521
|
+
const offset = 4;
|
|
522
|
+
return this.view.getUint8(offset);
|
|
523
|
+
}
|
|
524
|
+
set_month(value) {
|
|
525
|
+
const offset = 4;
|
|
526
|
+
this.view.setUint8(offset, value);
|
|
527
|
+
}
|
|
528
|
+
get month() {
|
|
529
|
+
return this.get_month();
|
|
530
|
+
}
|
|
531
|
+
set month(value) {
|
|
532
|
+
this.set_month(value);
|
|
533
|
+
}
|
|
534
|
+
get_day() {
|
|
535
|
+
const offset = 5;
|
|
536
|
+
return this.view.getUint8(offset);
|
|
537
|
+
}
|
|
538
|
+
set_day(value) {
|
|
539
|
+
const offset = 5;
|
|
540
|
+
this.view.setUint8(offset, value);
|
|
541
|
+
}
|
|
542
|
+
get day() {
|
|
543
|
+
return this.get_day();
|
|
544
|
+
}
|
|
545
|
+
set day(value) {
|
|
546
|
+
this.set_day(value);
|
|
547
|
+
}
|
|
548
|
+
static __tnFootprintInternal(__tnParams) {
|
|
549
|
+
return __tnEvalFootprint(__tn_ir_Date.root, { params: __tnParams });
|
|
550
|
+
}
|
|
551
|
+
static __tnValidateInternal(buffer, __tnParams) {
|
|
552
|
+
return __tnValidateIrTree(__tn_ir_Date, buffer, __tnParams);
|
|
553
|
+
}
|
|
554
|
+
static __tnInvokeFootprint(__tnParams) {
|
|
555
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
556
|
+
}
|
|
557
|
+
static __tnInvokeValidate(buffer, __tnParams) {
|
|
558
|
+
return this.__tnValidateInternal(buffer, __tnParams);
|
|
559
|
+
}
|
|
560
|
+
static footprintIr() {
|
|
561
|
+
return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
|
|
562
|
+
}
|
|
563
|
+
static footprint() {
|
|
564
|
+
const irResult = this.footprintIr();
|
|
565
|
+
const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
|
|
566
|
+
if (__tnBigIntGreaterThan(irResult, maxSafe)) {
|
|
567
|
+
throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for Date");
|
|
434
568
|
}
|
|
435
|
-
|
|
436
|
-
|
|
569
|
+
return __tnBigIntToNumber(irResult, "Date::footprint");
|
|
570
|
+
}
|
|
571
|
+
static validate(buffer, _opts) {
|
|
572
|
+
if (buffer.length < 6) return { ok: false, code: "tn.buffer_too_small", consumed: 6 };
|
|
573
|
+
return { ok: true, consumed: 6 };
|
|
574
|
+
}
|
|
575
|
+
static new(year, month, day) {
|
|
576
|
+
const buffer = new Uint8Array(6);
|
|
577
|
+
const view = new DataView(buffer.buffer);
|
|
578
|
+
view.setInt32(0, year, true);
|
|
579
|
+
view.setUint8(4, month);
|
|
580
|
+
view.setUint8(5, day);
|
|
581
|
+
return new _Date(buffer);
|
|
582
|
+
}
|
|
583
|
+
static from_array(buffer) {
|
|
584
|
+
if (!buffer || buffer.length === void 0) {
|
|
585
|
+
return null;
|
|
437
586
|
}
|
|
587
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
588
|
+
const validation = this.validate(buffer);
|
|
589
|
+
if (!validation.ok) {
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
return new _Date(buffer);
|
|
438
593
|
}
|
|
439
|
-
|
|
440
|
-
|
|
594
|
+
};
|
|
595
|
+
var DateBuilder = class {
|
|
596
|
+
constructor() {
|
|
597
|
+
this.buffer = new Uint8Array(6);
|
|
598
|
+
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
441
599
|
}
|
|
442
|
-
|
|
443
|
-
this.
|
|
600
|
+
set_year(value) {
|
|
601
|
+
this.view.setInt32(0, value, true);
|
|
602
|
+
return this;
|
|
603
|
+
}
|
|
604
|
+
set_month(value) {
|
|
605
|
+
this.view.setUint8(4, value);
|
|
606
|
+
return this;
|
|
607
|
+
}
|
|
608
|
+
set_day(value) {
|
|
609
|
+
this.view.setUint8(5, value);
|
|
610
|
+
return this;
|
|
611
|
+
}
|
|
612
|
+
build() {
|
|
613
|
+
return this.buffer.slice();
|
|
614
|
+
}
|
|
615
|
+
buildInto(target, offset = 0) {
|
|
616
|
+
if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
|
|
617
|
+
target.set(this.buffer, offset);
|
|
618
|
+
return target;
|
|
619
|
+
}
|
|
620
|
+
finish() {
|
|
621
|
+
const view = Date.from_array(this.buffer.slice());
|
|
622
|
+
if (!view) throw new Error("failed to build Date");
|
|
623
|
+
return view;
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
__tnRegisterFootprint("Date", (params) => Date.__tnInvokeFootprint(params));
|
|
627
|
+
__tnRegisterValidate("Date", (buffer, params) => Date.__tnInvokeValidate(buffer, params));
|
|
628
|
+
__tnRegisterDynamicValidate("Date", (buffer) => {
|
|
629
|
+
const result = Date.validate(buffer);
|
|
630
|
+
const params = result.params;
|
|
631
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
632
|
+
});
|
|
633
|
+
var __tn_ir_Duration = {
|
|
634
|
+
typeName: "Duration",
|
|
635
|
+
root: { op: "const", value: 12n }
|
|
636
|
+
};
|
|
637
|
+
var Duration = class _Duration {
|
|
638
|
+
constructor(buffer) {
|
|
639
|
+
this.buffer = buffer;
|
|
640
|
+
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
641
|
+
}
|
|
642
|
+
static __tnCreateView(buffer, opts) {
|
|
643
|
+
if (!buffer || buffer.length === void 0) throw new Error("Duration.__tnCreateView requires a Uint8Array");
|
|
644
|
+
return new _Duration(new Uint8Array(buffer));
|
|
645
|
+
}
|
|
646
|
+
static builder() {
|
|
647
|
+
return new DurationBuilder();
|
|
648
|
+
}
|
|
649
|
+
static fromBuilder(builder) {
|
|
650
|
+
const buffer = builder.build();
|
|
651
|
+
return _Duration.from_array(buffer);
|
|
652
|
+
}
|
|
653
|
+
get_seconds() {
|
|
654
|
+
const offset = 0;
|
|
655
|
+
return this.view.getBigInt64(offset, true);
|
|
656
|
+
}
|
|
657
|
+
set_seconds(value) {
|
|
658
|
+
const offset = 0;
|
|
659
|
+
this.view.setBigInt64(offset, value, true);
|
|
660
|
+
}
|
|
661
|
+
get seconds() {
|
|
662
|
+
return this.get_seconds();
|
|
663
|
+
}
|
|
664
|
+
set seconds(value) {
|
|
665
|
+
this.set_seconds(value);
|
|
666
|
+
}
|
|
667
|
+
get_nanos() {
|
|
668
|
+
const offset = 8;
|
|
669
|
+
return this.view.getInt32(offset, true);
|
|
670
|
+
}
|
|
671
|
+
set_nanos(value) {
|
|
672
|
+
const offset = 8;
|
|
673
|
+
this.view.setInt32(offset, value, true);
|
|
674
|
+
}
|
|
675
|
+
get nanos() {
|
|
676
|
+
return this.get_nanos();
|
|
677
|
+
}
|
|
678
|
+
set nanos(value) {
|
|
679
|
+
this.set_nanos(value);
|
|
444
680
|
}
|
|
445
681
|
static __tnFootprintInternal(__tnParams) {
|
|
446
|
-
return __tnEvalFootprint(
|
|
682
|
+
return __tnEvalFootprint(__tn_ir_Duration.root, { params: __tnParams });
|
|
447
683
|
}
|
|
448
684
|
static __tnValidateInternal(buffer, __tnParams) {
|
|
449
|
-
return __tnValidateIrTree(
|
|
685
|
+
return __tnValidateIrTree(__tn_ir_Duration, buffer, __tnParams);
|
|
450
686
|
}
|
|
451
687
|
static __tnInvokeFootprint(__tnParams) {
|
|
452
688
|
return this.__tnFootprintInternal(__tnParams);
|
|
@@ -461,13 +697,20 @@ var Hash = class _Hash {
|
|
|
461
697
|
const irResult = this.footprintIr();
|
|
462
698
|
const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
|
|
463
699
|
if (__tnBigIntGreaterThan(irResult, maxSafe)) {
|
|
464
|
-
throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for
|
|
700
|
+
throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for Duration");
|
|
465
701
|
}
|
|
466
|
-
return __tnBigIntToNumber(irResult, "
|
|
702
|
+
return __tnBigIntToNumber(irResult, "Duration::footprint");
|
|
467
703
|
}
|
|
468
704
|
static validate(buffer, _opts) {
|
|
469
|
-
if (buffer.length <
|
|
470
|
-
return { ok: true, consumed:
|
|
705
|
+
if (buffer.length < 12) return { ok: false, code: "tn.buffer_too_small", consumed: 12 };
|
|
706
|
+
return { ok: true, consumed: 12 };
|
|
707
|
+
}
|
|
708
|
+
static new(seconds, nanos) {
|
|
709
|
+
const buffer = new Uint8Array(12);
|
|
710
|
+
const view = new DataView(buffer.buffer);
|
|
711
|
+
view.setBigInt64(0, seconds, true);
|
|
712
|
+
view.setInt32(8, nanos, true);
|
|
713
|
+
return new _Duration(buffer);
|
|
471
714
|
}
|
|
472
715
|
static from_array(buffer) {
|
|
473
716
|
if (!buffer || buffer.length === void 0) {
|
|
@@ -478,22 +721,21 @@ var Hash = class _Hash {
|
|
|
478
721
|
if (!validation.ok) {
|
|
479
722
|
return null;
|
|
480
723
|
}
|
|
481
|
-
return new
|
|
724
|
+
return new _Duration(buffer);
|
|
482
725
|
}
|
|
483
726
|
};
|
|
484
|
-
|
|
485
|
-
__tnRegisterValidate("Hash", (buffer, params) => Hash.__tnInvokeValidate(buffer, params));
|
|
486
|
-
var HashBuilder = class {
|
|
727
|
+
var DurationBuilder = class {
|
|
487
728
|
constructor() {
|
|
488
|
-
this.buffer = new Uint8Array(
|
|
729
|
+
this.buffer = new Uint8Array(12);
|
|
489
730
|
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
490
731
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
732
|
+
set_seconds(value) {
|
|
733
|
+
const cast = __tnToBigInt(value);
|
|
734
|
+
this.view.setBigInt64(0, cast, true);
|
|
735
|
+
return this;
|
|
736
|
+
}
|
|
737
|
+
set_nanos(value) {
|
|
738
|
+
this.view.setInt32(8, value, true);
|
|
497
739
|
return this;
|
|
498
740
|
}
|
|
499
741
|
build() {
|
|
@@ -504,12 +746,605 @@ var HashBuilder = class {
|
|
|
504
746
|
target.set(this.buffer, offset);
|
|
505
747
|
return target;
|
|
506
748
|
}
|
|
507
|
-
finish() {
|
|
508
|
-
const view =
|
|
509
|
-
if (!view) throw new Error("failed to build
|
|
510
|
-
return view;
|
|
749
|
+
finish() {
|
|
750
|
+
const view = Duration.from_array(this.buffer.slice());
|
|
751
|
+
if (!view) throw new Error("failed to build Duration");
|
|
752
|
+
return view;
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
__tnRegisterFootprint("Duration", (params) => Duration.__tnInvokeFootprint(params));
|
|
756
|
+
__tnRegisterValidate("Duration", (buffer, params) => Duration.__tnInvokeValidate(buffer, params));
|
|
757
|
+
__tnRegisterDynamicValidate("Duration", (buffer) => {
|
|
758
|
+
const result = Duration.validate(buffer);
|
|
759
|
+
const params = result.params;
|
|
760
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
761
|
+
});
|
|
762
|
+
var __tn_ir_FixedPoint = {
|
|
763
|
+
typeName: "FixedPoint",
|
|
764
|
+
root: { op: "const", value: 9n }
|
|
765
|
+
};
|
|
766
|
+
var FixedPoint = class _FixedPoint {
|
|
767
|
+
constructor(buffer) {
|
|
768
|
+
this.buffer = buffer;
|
|
769
|
+
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
770
|
+
}
|
|
771
|
+
static __tnCreateView(buffer, opts) {
|
|
772
|
+
if (!buffer || buffer.length === void 0) throw new Error("FixedPoint.__tnCreateView requires a Uint8Array");
|
|
773
|
+
return new _FixedPoint(new Uint8Array(buffer));
|
|
774
|
+
}
|
|
775
|
+
static builder() {
|
|
776
|
+
return new FixedPointBuilder();
|
|
777
|
+
}
|
|
778
|
+
static fromBuilder(builder) {
|
|
779
|
+
const buffer = builder.build();
|
|
780
|
+
return _FixedPoint.from_array(buffer);
|
|
781
|
+
}
|
|
782
|
+
get_mantissa() {
|
|
783
|
+
const offset = 0;
|
|
784
|
+
return this.view.getBigInt64(offset, true);
|
|
785
|
+
}
|
|
786
|
+
set_mantissa(value) {
|
|
787
|
+
const offset = 0;
|
|
788
|
+
this.view.setBigInt64(offset, value, true);
|
|
789
|
+
}
|
|
790
|
+
get mantissa() {
|
|
791
|
+
return this.get_mantissa();
|
|
792
|
+
}
|
|
793
|
+
set mantissa(value) {
|
|
794
|
+
this.set_mantissa(value);
|
|
795
|
+
}
|
|
796
|
+
get_scale() {
|
|
797
|
+
const offset = 8;
|
|
798
|
+
return this.view.getUint8(offset);
|
|
799
|
+
}
|
|
800
|
+
set_scale(value) {
|
|
801
|
+
const offset = 8;
|
|
802
|
+
this.view.setUint8(offset, value);
|
|
803
|
+
}
|
|
804
|
+
get scale() {
|
|
805
|
+
return this.get_scale();
|
|
806
|
+
}
|
|
807
|
+
set scale(value) {
|
|
808
|
+
this.set_scale(value);
|
|
809
|
+
}
|
|
810
|
+
static __tnFootprintInternal(__tnParams) {
|
|
811
|
+
return __tnEvalFootprint(__tn_ir_FixedPoint.root, { params: __tnParams });
|
|
812
|
+
}
|
|
813
|
+
static __tnValidateInternal(buffer, __tnParams) {
|
|
814
|
+
return __tnValidateIrTree(__tn_ir_FixedPoint, buffer, __tnParams);
|
|
815
|
+
}
|
|
816
|
+
static __tnInvokeFootprint(__tnParams) {
|
|
817
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
818
|
+
}
|
|
819
|
+
static __tnInvokeValidate(buffer, __tnParams) {
|
|
820
|
+
return this.__tnValidateInternal(buffer, __tnParams);
|
|
821
|
+
}
|
|
822
|
+
static footprintIr() {
|
|
823
|
+
return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
|
|
824
|
+
}
|
|
825
|
+
static footprint() {
|
|
826
|
+
const irResult = this.footprintIr();
|
|
827
|
+
const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
|
|
828
|
+
if (__tnBigIntGreaterThan(irResult, maxSafe)) {
|
|
829
|
+
throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for FixedPoint");
|
|
830
|
+
}
|
|
831
|
+
return __tnBigIntToNumber(irResult, "FixedPoint::footprint");
|
|
832
|
+
}
|
|
833
|
+
static validate(buffer, _opts) {
|
|
834
|
+
if (buffer.length < 9) return { ok: false, code: "tn.buffer_too_small", consumed: 9 };
|
|
835
|
+
return { ok: true, consumed: 9 };
|
|
836
|
+
}
|
|
837
|
+
static new(mantissa, scale) {
|
|
838
|
+
const buffer = new Uint8Array(9);
|
|
839
|
+
const view = new DataView(buffer.buffer);
|
|
840
|
+
view.setBigInt64(0, mantissa, true);
|
|
841
|
+
view.setUint8(8, scale);
|
|
842
|
+
return new _FixedPoint(buffer);
|
|
843
|
+
}
|
|
844
|
+
static from_array(buffer) {
|
|
845
|
+
if (!buffer || buffer.length === void 0) {
|
|
846
|
+
return null;
|
|
847
|
+
}
|
|
848
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
849
|
+
const validation = this.validate(buffer);
|
|
850
|
+
if (!validation.ok) {
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
return new _FixedPoint(buffer);
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
var FixedPointBuilder = class {
|
|
857
|
+
constructor() {
|
|
858
|
+
this.buffer = new Uint8Array(9);
|
|
859
|
+
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
860
|
+
}
|
|
861
|
+
set_mantissa(value) {
|
|
862
|
+
const cast = __tnToBigInt(value);
|
|
863
|
+
this.view.setBigInt64(0, cast, true);
|
|
864
|
+
return this;
|
|
865
|
+
}
|
|
866
|
+
set_scale(value) {
|
|
867
|
+
this.view.setUint8(8, value);
|
|
868
|
+
return this;
|
|
869
|
+
}
|
|
870
|
+
build() {
|
|
871
|
+
return this.buffer.slice();
|
|
872
|
+
}
|
|
873
|
+
buildInto(target, offset = 0) {
|
|
874
|
+
if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
|
|
875
|
+
target.set(this.buffer, offset);
|
|
876
|
+
return target;
|
|
877
|
+
}
|
|
878
|
+
finish() {
|
|
879
|
+
const view = FixedPoint.from_array(this.buffer.slice());
|
|
880
|
+
if (!view) throw new Error("failed to build FixedPoint");
|
|
881
|
+
return view;
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
__tnRegisterFootprint("FixedPoint", (params) => FixedPoint.__tnInvokeFootprint(params));
|
|
885
|
+
__tnRegisterValidate("FixedPoint", (buffer, params) => FixedPoint.__tnInvokeValidate(buffer, params));
|
|
886
|
+
__tnRegisterDynamicValidate("FixedPoint", (buffer) => {
|
|
887
|
+
const result = FixedPoint.validate(buffer);
|
|
888
|
+
const params = result.params;
|
|
889
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
890
|
+
});
|
|
891
|
+
var __tn_ir_Hash = {
|
|
892
|
+
typeName: "Hash",
|
|
893
|
+
root: { op: "const", value: 32n }
|
|
894
|
+
};
|
|
895
|
+
var Hash = class _Hash {
|
|
896
|
+
constructor(buffer) {
|
|
897
|
+
this.buffer = buffer;
|
|
898
|
+
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
899
|
+
}
|
|
900
|
+
static __tnCreateView(buffer, opts) {
|
|
901
|
+
if (!buffer || buffer.length === void 0) throw new Error("Hash.__tnCreateView requires a Uint8Array");
|
|
902
|
+
return new _Hash(new Uint8Array(buffer));
|
|
903
|
+
}
|
|
904
|
+
static builder() {
|
|
905
|
+
return new HashBuilder();
|
|
906
|
+
}
|
|
907
|
+
static fromBuilder(builder) {
|
|
908
|
+
const buffer = builder.build();
|
|
909
|
+
return _Hash.from_array(buffer);
|
|
910
|
+
}
|
|
911
|
+
get_bytes() {
|
|
912
|
+
const offset = 0;
|
|
913
|
+
const result = [];
|
|
914
|
+
for (let i = 0; i < 32; i++) {
|
|
915
|
+
result.push(this.view.getUint8(offset + i * 1));
|
|
916
|
+
}
|
|
917
|
+
return result;
|
|
918
|
+
}
|
|
919
|
+
set_bytes(value) {
|
|
920
|
+
const offset = 0;
|
|
921
|
+
if (value.length !== 32) {
|
|
922
|
+
throw new Error("Array length must be 32");
|
|
923
|
+
}
|
|
924
|
+
for (let i = 0; i < 32; i++) {
|
|
925
|
+
this.view.setUint8(offset + i * 1, value[i]);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
get bytes() {
|
|
929
|
+
return this.get_bytes();
|
|
930
|
+
}
|
|
931
|
+
set bytes(value) {
|
|
932
|
+
this.set_bytes(value);
|
|
933
|
+
}
|
|
934
|
+
static __tnFootprintInternal(__tnParams) {
|
|
935
|
+
return __tnEvalFootprint(__tn_ir_Hash.root, { params: __tnParams });
|
|
936
|
+
}
|
|
937
|
+
static __tnValidateInternal(buffer, __tnParams) {
|
|
938
|
+
return __tnValidateIrTree(__tn_ir_Hash, buffer, __tnParams);
|
|
939
|
+
}
|
|
940
|
+
static __tnInvokeFootprint(__tnParams) {
|
|
941
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
942
|
+
}
|
|
943
|
+
static __tnInvokeValidate(buffer, __tnParams) {
|
|
944
|
+
return this.__tnValidateInternal(buffer, __tnParams);
|
|
945
|
+
}
|
|
946
|
+
static footprintIr() {
|
|
947
|
+
return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
|
|
948
|
+
}
|
|
949
|
+
static footprint() {
|
|
950
|
+
const irResult = this.footprintIr();
|
|
951
|
+
const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
|
|
952
|
+
if (__tnBigIntGreaterThan(irResult, maxSafe)) {
|
|
953
|
+
throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for Hash");
|
|
954
|
+
}
|
|
955
|
+
return __tnBigIntToNumber(irResult, "Hash::footprint");
|
|
956
|
+
}
|
|
957
|
+
static validate(buffer, _opts) {
|
|
958
|
+
if (buffer.length < 32) return { ok: false, code: "tn.buffer_too_small", consumed: 32 };
|
|
959
|
+
return { ok: true, consumed: 32 };
|
|
960
|
+
}
|
|
961
|
+
static from_array(buffer) {
|
|
962
|
+
if (!buffer || buffer.length === void 0) {
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
966
|
+
const validation = this.validate(buffer);
|
|
967
|
+
if (!validation.ok) {
|
|
968
|
+
return null;
|
|
969
|
+
}
|
|
970
|
+
return new _Hash(buffer);
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
var HashBuilder = class {
|
|
974
|
+
constructor() {
|
|
975
|
+
this.buffer = new Uint8Array(32);
|
|
976
|
+
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
977
|
+
}
|
|
978
|
+
set_bytes(values) {
|
|
979
|
+
if (values.length !== 32) throw new Error("bytes expects 32 elements");
|
|
980
|
+
for (let i = 0; i < values.length; i++) {
|
|
981
|
+
const byteOffset = 0 + i * 1;
|
|
982
|
+
this.view.setUint8(byteOffset, values[i]);
|
|
983
|
+
}
|
|
984
|
+
return this;
|
|
985
|
+
}
|
|
986
|
+
build() {
|
|
987
|
+
return this.buffer.slice();
|
|
988
|
+
}
|
|
989
|
+
buildInto(target, offset = 0) {
|
|
990
|
+
if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
|
|
991
|
+
target.set(this.buffer, offset);
|
|
992
|
+
return target;
|
|
993
|
+
}
|
|
994
|
+
finish() {
|
|
995
|
+
const view = Hash.from_array(this.buffer.slice());
|
|
996
|
+
if (!view) throw new Error("failed to build Hash");
|
|
997
|
+
return view;
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
__tnRegisterFootprint("Hash", (params) => Hash.__tnInvokeFootprint(params));
|
|
1001
|
+
__tnRegisterValidate("Hash", (buffer, params) => Hash.__tnInvokeValidate(buffer, params));
|
|
1002
|
+
__tnRegisterDynamicValidate("Hash", (buffer) => {
|
|
1003
|
+
const result = Hash.validate(buffer);
|
|
1004
|
+
const params = result.params;
|
|
1005
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
1006
|
+
});
|
|
1007
|
+
var __tn_ir_InstructionData = {
|
|
1008
|
+
typeName: "InstructionData",
|
|
1009
|
+
root: { op: "align", alignment: 1, node: { op: "add", left: { op: "add", left: { op: "align", alignment: 2, node: { op: "const", value: 2n } }, right: { op: "align", alignment: 8, node: { op: "const", value: 8n } } }, right: { op: "align", alignment: 1, node: { op: "mul", left: { op: "field", param: "data.data_size" }, right: { op: "const", value: 1n } } } } }
|
|
1010
|
+
};
|
|
1011
|
+
var _InstructionData = class _InstructionData {
|
|
1012
|
+
constructor(buffer, params, fieldContext) {
|
|
1013
|
+
this.buffer = buffer;
|
|
1014
|
+
this.__tnFieldContext = null;
|
|
1015
|
+
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1016
|
+
this.__tnFieldContext = fieldContext ?? null;
|
|
1017
|
+
if (params) {
|
|
1018
|
+
this.__tnParams = params;
|
|
1019
|
+
} else {
|
|
1020
|
+
const derived = _InstructionData.__tnExtractParams(this.view, buffer);
|
|
1021
|
+
if (!derived) {
|
|
1022
|
+
throw new Error("InstructionData: failed to derive dynamic parameters");
|
|
1023
|
+
}
|
|
1024
|
+
this.__tnParams = derived.params;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
static __tnCreateView(buffer, opts) {
|
|
1028
|
+
if (!buffer || buffer.length === void 0) throw new Error("InstructionData.__tnCreateView requires a Uint8Array");
|
|
1029
|
+
let params = opts?.params ?? null;
|
|
1030
|
+
if (!params) {
|
|
1031
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1032
|
+
const derived = _InstructionData.__tnExtractParams(view, buffer);
|
|
1033
|
+
if (!derived) throw new Error("InstructionData.__tnCreateView: failed to derive params");
|
|
1034
|
+
params = derived.params;
|
|
1035
|
+
}
|
|
1036
|
+
const instance = new _InstructionData(new Uint8Array(buffer), params, opts?.fieldContext);
|
|
1037
|
+
return instance;
|
|
1038
|
+
}
|
|
1039
|
+
dynamicParams() {
|
|
1040
|
+
return this.__tnParams;
|
|
1041
|
+
}
|
|
1042
|
+
withFieldContext(context) {
|
|
1043
|
+
this.__tnFieldContext = context;
|
|
1044
|
+
return this;
|
|
1045
|
+
}
|
|
1046
|
+
__tnResolveFieldRef(path) {
|
|
1047
|
+
const getterName = `get_${path.replace(/[.]/g, "_")}`;
|
|
1048
|
+
const getter = this[getterName];
|
|
1049
|
+
if (typeof getter === "function") {
|
|
1050
|
+
const value = getter.call(this);
|
|
1051
|
+
return typeof value === "bigint" ? __tnBigIntToNumber(value, "InstructionData::__tnResolveFieldRef") : value;
|
|
1052
|
+
}
|
|
1053
|
+
if (this.__tnFieldContext && Object.prototype.hasOwnProperty.call(this.__tnFieldContext, path)) {
|
|
1054
|
+
const contextValue = this.__tnFieldContext[path];
|
|
1055
|
+
return typeof contextValue === "bigint" ? __tnBigIntToNumber(contextValue, "InstructionData::__tnResolveFieldRef") : contextValue;
|
|
1056
|
+
}
|
|
1057
|
+
throw new Error("InstructionData: field reference '" + path + "' is not available; provide fieldContext when creating this view");
|
|
1058
|
+
}
|
|
1059
|
+
static builder() {
|
|
1060
|
+
return new InstructionDataBuilder();
|
|
1061
|
+
}
|
|
1062
|
+
static fromBuilder(builder) {
|
|
1063
|
+
const buffer = builder.build();
|
|
1064
|
+
const params = builder.dynamicParams();
|
|
1065
|
+
return _InstructionData.from_array(buffer, { params });
|
|
1066
|
+
}
|
|
1067
|
+
static __tnExtractParams(view, buffer) {
|
|
1068
|
+
if (buffer.length < 10) {
|
|
1069
|
+
return null;
|
|
1070
|
+
}
|
|
1071
|
+
const __tnParam_data_data_size = __tnToBigInt(view.getBigUint64(2, true));
|
|
1072
|
+
const __tnExtractedParams = _InstructionData.Params.fromValues({
|
|
1073
|
+
data_data_size: __tnParam_data_data_size
|
|
1074
|
+
});
|
|
1075
|
+
return { params: __tnExtractedParams, derived: null };
|
|
1076
|
+
}
|
|
1077
|
+
get_program_idx() {
|
|
1078
|
+
const offset = 0;
|
|
1079
|
+
return this.view.getUint16(offset, true);
|
|
1080
|
+
}
|
|
1081
|
+
set_program_idx(value) {
|
|
1082
|
+
const offset = 0;
|
|
1083
|
+
this.view.setUint16(offset, value, true);
|
|
1084
|
+
}
|
|
1085
|
+
get program_idx() {
|
|
1086
|
+
return this.get_program_idx();
|
|
1087
|
+
}
|
|
1088
|
+
set program_idx(value) {
|
|
1089
|
+
this.set_program_idx(value);
|
|
1090
|
+
}
|
|
1091
|
+
get_data_size() {
|
|
1092
|
+
const offset = 2;
|
|
1093
|
+
return this.view.getBigUint64(offset, true);
|
|
1094
|
+
}
|
|
1095
|
+
set_data_size(value) {
|
|
1096
|
+
const offset = 2;
|
|
1097
|
+
this.view.setBigUint64(offset, value, true);
|
|
1098
|
+
}
|
|
1099
|
+
get data_size() {
|
|
1100
|
+
return this.get_data_size();
|
|
1101
|
+
}
|
|
1102
|
+
set data_size(value) {
|
|
1103
|
+
this.set_data_size(value);
|
|
1104
|
+
}
|
|
1105
|
+
get_data_length() {
|
|
1106
|
+
return this.__tnResolveFieldRef("data_size");
|
|
1107
|
+
}
|
|
1108
|
+
get_data_at(index) {
|
|
1109
|
+
const offset = 10;
|
|
1110
|
+
return this.view.getUint8(offset + index * 1);
|
|
1111
|
+
}
|
|
1112
|
+
get_data() {
|
|
1113
|
+
const len = this.get_data_length();
|
|
1114
|
+
const result = [];
|
|
1115
|
+
for (let i = 0; i < len; i++) {
|
|
1116
|
+
result.push(this.get_data_at(i));
|
|
1117
|
+
}
|
|
1118
|
+
return result;
|
|
1119
|
+
}
|
|
1120
|
+
set_data_at(index, value) {
|
|
1121
|
+
const offset = 10;
|
|
1122
|
+
this.view.setUint8(offset + index * 1, value);
|
|
1123
|
+
}
|
|
1124
|
+
set_data(value) {
|
|
1125
|
+
const len = Math.min(this.get_data_length(), value.length);
|
|
1126
|
+
for (let i = 0; i < len; i++) {
|
|
1127
|
+
this.set_data_at(i, value[i]);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
get data() {
|
|
1131
|
+
return this.get_data();
|
|
1132
|
+
}
|
|
1133
|
+
set data(value) {
|
|
1134
|
+
this.set_data(value);
|
|
1135
|
+
}
|
|
1136
|
+
static __tnFootprintInternal(__tnParams) {
|
|
1137
|
+
return __tnEvalFootprint(__tn_ir_InstructionData.root, { params: __tnParams });
|
|
1138
|
+
}
|
|
1139
|
+
static __tnValidateInternal(buffer, __tnParams) {
|
|
1140
|
+
return __tnValidateIrTree(__tn_ir_InstructionData, buffer, __tnParams);
|
|
1141
|
+
}
|
|
1142
|
+
static __tnInvokeFootprint(__tnParams) {
|
|
1143
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
1144
|
+
}
|
|
1145
|
+
static __tnInvokeValidate(buffer, __tnParams) {
|
|
1146
|
+
return this.__tnValidateInternal(buffer, __tnParams);
|
|
1147
|
+
}
|
|
1148
|
+
static footprintIr(data_data_size) {
|
|
1149
|
+
const params = _InstructionData.Params.fromValues({
|
|
1150
|
+
data_data_size
|
|
1151
|
+
});
|
|
1152
|
+
return this.footprintIrFromParams(params);
|
|
1153
|
+
}
|
|
1154
|
+
static __tnPackParams(params) {
|
|
1155
|
+
const record = /* @__PURE__ */ Object.create(null);
|
|
1156
|
+
record["data.data_size"] = params.data_data_size;
|
|
1157
|
+
return record;
|
|
1158
|
+
}
|
|
1159
|
+
static footprintIrFromParams(params) {
|
|
1160
|
+
const __tnParams = this.__tnPackParams(params);
|
|
1161
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
1162
|
+
}
|
|
1163
|
+
static footprintFromParams(params) {
|
|
1164
|
+
const irResult = this.footprintIrFromParams(params);
|
|
1165
|
+
const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
|
|
1166
|
+
if (__tnBigIntGreaterThan(irResult, maxSafe)) throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for InstructionData");
|
|
1167
|
+
return __tnBigIntToNumber(irResult, "InstructionData::footprintFromParams");
|
|
1168
|
+
}
|
|
1169
|
+
static footprintFromValues(input) {
|
|
1170
|
+
const params = _InstructionData.params(input);
|
|
1171
|
+
return this.footprintFromParams(params);
|
|
1172
|
+
}
|
|
1173
|
+
static footprint(params) {
|
|
1174
|
+
return this.footprintFromParams(params);
|
|
1175
|
+
}
|
|
1176
|
+
static validate(buffer, opts) {
|
|
1177
|
+
if (!buffer || buffer.length === void 0) {
|
|
1178
|
+
return { ok: false, code: "tn.invalid_buffer" };
|
|
1179
|
+
}
|
|
1180
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1181
|
+
let params = opts?.params ?? null;
|
|
1182
|
+
if (!params) {
|
|
1183
|
+
const extracted = this.__tnExtractParams(view, buffer);
|
|
1184
|
+
if (!extracted) return { ok: false, code: "tn.param_extraction_failed" };
|
|
1185
|
+
params = extracted.params;
|
|
1186
|
+
}
|
|
1187
|
+
const __tnParamsRec = this.__tnPackParams(params);
|
|
1188
|
+
const irResult = this.__tnValidateInternal(buffer, __tnParamsRec);
|
|
1189
|
+
if (!irResult.ok) {
|
|
1190
|
+
return { ok: false, code: irResult.code, consumed: irResult.consumed ? __tnBigIntToNumber(irResult.consumed, "InstructionData::validate") : void 0, params };
|
|
1191
|
+
}
|
|
1192
|
+
const consumed = irResult.consumed ? __tnBigIntToNumber(irResult.consumed, "InstructionData::validate") : void 0;
|
|
1193
|
+
return { ok: true, consumed, params };
|
|
1194
|
+
}
|
|
1195
|
+
static from_array(buffer, opts) {
|
|
1196
|
+
if (!buffer || buffer.length === void 0) {
|
|
1197
|
+
return null;
|
|
1198
|
+
}
|
|
1199
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1200
|
+
let params = opts?.params ?? null;
|
|
1201
|
+
if (!params) {
|
|
1202
|
+
const derived = this.__tnExtractParams(view, buffer);
|
|
1203
|
+
if (!derived) return null;
|
|
1204
|
+
params = derived.params;
|
|
1205
|
+
}
|
|
1206
|
+
const validation = this.validate(buffer, { params });
|
|
1207
|
+
if (!validation.ok) {
|
|
1208
|
+
return null;
|
|
1209
|
+
}
|
|
1210
|
+
const cached = validation.params ?? params;
|
|
1211
|
+
const state = new _InstructionData(buffer, cached);
|
|
1212
|
+
return state;
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
_InstructionData.flexibleArrayWriters = Object.freeze([
|
|
1216
|
+
{ field: "data", method: "data", sizeField: "data_size", paramKey: "data_size", elementSize: 1 }
|
|
1217
|
+
]);
|
|
1218
|
+
var InstructionData = _InstructionData;
|
|
1219
|
+
((InstructionData2) => {
|
|
1220
|
+
InstructionData2.ParamKeys = Object.freeze({
|
|
1221
|
+
data_data_size: "data.data_size"
|
|
1222
|
+
});
|
|
1223
|
+
InstructionData2.Params = {
|
|
1224
|
+
fromValues(input) {
|
|
1225
|
+
return {
|
|
1226
|
+
data_data_size: __tnToBigInt(input.data_data_size)
|
|
1227
|
+
};
|
|
1228
|
+
},
|
|
1229
|
+
fromBuilder(source) {
|
|
1230
|
+
if (source.dynamicParams) {
|
|
1231
|
+
return source.dynamicParams();
|
|
1232
|
+
}
|
|
1233
|
+
if (source.params) {
|
|
1234
|
+
return source.params;
|
|
1235
|
+
}
|
|
1236
|
+
return source;
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
function params(input) {
|
|
1240
|
+
return InstructionData2.Params.fromValues(input);
|
|
1241
|
+
}
|
|
1242
|
+
InstructionData2.params = params;
|
|
1243
|
+
})(InstructionData || (InstructionData = {}));
|
|
1244
|
+
var InstructionDataBuilder = class {
|
|
1245
|
+
constructor() {
|
|
1246
|
+
this.__tnCachedParams = null;
|
|
1247
|
+
this.__tnLastBuffer = null;
|
|
1248
|
+
this.__tnLastParams = null;
|
|
1249
|
+
this.__tnFam_data = null;
|
|
1250
|
+
this.__tnFam_dataCount = null;
|
|
1251
|
+
this.buffer = new Uint8Array(10);
|
|
1252
|
+
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
1253
|
+
}
|
|
1254
|
+
__tnInvalidate() {
|
|
1255
|
+
this.__tnCachedParams = null;
|
|
1256
|
+
this.__tnLastBuffer = null;
|
|
1257
|
+
this.__tnLastParams = null;
|
|
1258
|
+
}
|
|
1259
|
+
set_program_idx(value) {
|
|
1260
|
+
this.view.setUint16(0, value, true);
|
|
1261
|
+
this.__tnInvalidate();
|
|
1262
|
+
return this;
|
|
1263
|
+
}
|
|
1264
|
+
set_data_size(value) {
|
|
1265
|
+
const cast = __tnToBigInt(value);
|
|
1266
|
+
this.view.setBigUint64(2, cast, true);
|
|
1267
|
+
this.__tnInvalidate();
|
|
1268
|
+
return this;
|
|
1269
|
+
}
|
|
1270
|
+
data() {
|
|
1271
|
+
if (!this.__tnFamWriter_data) {
|
|
1272
|
+
this.__tnFamWriter_data = __tnCreateFamWriter(this, "data", (payload) => {
|
|
1273
|
+
const bytes = new Uint8Array(payload);
|
|
1274
|
+
const elementCount = bytes.length;
|
|
1275
|
+
this.__tnFam_data = bytes;
|
|
1276
|
+
this.__tnFam_dataCount = elementCount;
|
|
1277
|
+
this.set_data_size(__tnToBigInt(elementCount));
|
|
1278
|
+
this.__tnInvalidate();
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
return this.__tnFamWriter_data;
|
|
1282
|
+
}
|
|
1283
|
+
build() {
|
|
1284
|
+
const params = this.__tnComputeParams();
|
|
1285
|
+
const size = InstructionData.footprintFromParams(params);
|
|
1286
|
+
const buffer = new Uint8Array(size);
|
|
1287
|
+
this.__tnWriteInto(buffer);
|
|
1288
|
+
this.__tnValidateOrThrow(buffer, params);
|
|
1289
|
+
return buffer;
|
|
1290
|
+
}
|
|
1291
|
+
buildInto(target, offset = 0) {
|
|
1292
|
+
const params = this.__tnComputeParams();
|
|
1293
|
+
const size = InstructionData.footprintFromParams(params);
|
|
1294
|
+
if (target.length - offset < size) throw new Error("InstructionDataBuilder: target buffer too small");
|
|
1295
|
+
const slice = target.subarray(offset, offset + size);
|
|
1296
|
+
this.__tnWriteInto(slice);
|
|
1297
|
+
this.__tnValidateOrThrow(slice, params);
|
|
1298
|
+
return target;
|
|
1299
|
+
}
|
|
1300
|
+
finish() {
|
|
1301
|
+
const buffer = this.build();
|
|
1302
|
+
const params = this.__tnLastParams ?? this.__tnComputeParams();
|
|
1303
|
+
const view = InstructionData.from_array(buffer, { params });
|
|
1304
|
+
if (!view) throw new Error("InstructionDataBuilder: failed to finalize view");
|
|
1305
|
+
return view;
|
|
1306
|
+
}
|
|
1307
|
+
finishView() {
|
|
1308
|
+
return this.finish();
|
|
1309
|
+
}
|
|
1310
|
+
dynamicParams() {
|
|
1311
|
+
return this.__tnComputeParams();
|
|
1312
|
+
}
|
|
1313
|
+
__tnComputeParams() {
|
|
1314
|
+
if (this.__tnCachedParams) return this.__tnCachedParams;
|
|
1315
|
+
const params = InstructionData.Params.fromValues({
|
|
1316
|
+
data_data_size: (() => {
|
|
1317
|
+
if (this.__tnFam_dataCount === null) throw new Error("InstructionDataBuilder: field 'data' must be written before computing params");
|
|
1318
|
+
return __tnToBigInt(this.__tnFam_dataCount);
|
|
1319
|
+
})()
|
|
1320
|
+
});
|
|
1321
|
+
this.__tnCachedParams = params;
|
|
1322
|
+
return params;
|
|
1323
|
+
}
|
|
1324
|
+
__tnWriteInto(target) {
|
|
1325
|
+
target.set(this.buffer, 0);
|
|
1326
|
+
let cursor = this.buffer.length;
|
|
1327
|
+
const __tnLocal_data_bytes = this.__tnFam_data;
|
|
1328
|
+
if (!__tnLocal_data_bytes) throw new Error("InstructionDataBuilder: field 'data' must be written before build");
|
|
1329
|
+
target.set(__tnLocal_data_bytes, cursor);
|
|
1330
|
+
cursor += __tnLocal_data_bytes.length;
|
|
1331
|
+
}
|
|
1332
|
+
__tnValidateOrThrow(buffer, params) {
|
|
1333
|
+
const result = InstructionData.validate(buffer, { params });
|
|
1334
|
+
if (!result.ok) {
|
|
1335
|
+
throw new Error(`${InstructionData}Builder: builder produced invalid buffer (code=${result.code ?? "unknown"})`);
|
|
1336
|
+
}
|
|
1337
|
+
this.__tnLastParams = result.params ?? params;
|
|
1338
|
+
this.__tnLastBuffer = buffer;
|
|
511
1339
|
}
|
|
512
1340
|
};
|
|
1341
|
+
__tnRegisterFootprint("InstructionData", (params) => InstructionData.__tnInvokeFootprint(params));
|
|
1342
|
+
__tnRegisterValidate("InstructionData", (buffer, params) => InstructionData.__tnInvokeValidate(buffer, params));
|
|
1343
|
+
__tnRegisterDynamicValidate("InstructionData", (buffer) => {
|
|
1344
|
+
const result = InstructionData.validate(buffer);
|
|
1345
|
+
const params = result.params;
|
|
1346
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
1347
|
+
});
|
|
513
1348
|
var __tn_ir_Pubkey = {
|
|
514
1349
|
typeName: "Pubkey",
|
|
515
1350
|
root: { op: "const", value: 32n }
|
|
@@ -592,8 +1427,6 @@ var Pubkey = class _Pubkey {
|
|
|
592
1427
|
return new _Pubkey(buffer);
|
|
593
1428
|
}
|
|
594
1429
|
};
|
|
595
|
-
__tnRegisterFootprint("Pubkey", (params) => Pubkey.__tnInvokeFootprint(params));
|
|
596
|
-
__tnRegisterValidate("Pubkey", (buffer, params) => Pubkey.__tnInvokeValidate(buffer, params));
|
|
597
1430
|
var PubkeyBuilder = class {
|
|
598
1431
|
constructor() {
|
|
599
1432
|
this.buffer = new Uint8Array(32);
|
|
@@ -621,6 +1454,13 @@ var PubkeyBuilder = class {
|
|
|
621
1454
|
return view;
|
|
622
1455
|
}
|
|
623
1456
|
};
|
|
1457
|
+
__tnRegisterFootprint("Pubkey", (params) => Pubkey.__tnInvokeFootprint(params));
|
|
1458
|
+
__tnRegisterValidate("Pubkey", (buffer, params) => Pubkey.__tnInvokeValidate(buffer, params));
|
|
1459
|
+
__tnRegisterDynamicValidate("Pubkey", (buffer) => {
|
|
1460
|
+
const result = Pubkey.validate(buffer);
|
|
1461
|
+
const params = result.params;
|
|
1462
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
1463
|
+
});
|
|
624
1464
|
var __tn_ir_Signature = {
|
|
625
1465
|
typeName: "Signature",
|
|
626
1466
|
root: { op: "const", value: 64n }
|
|
@@ -703,8 +1543,6 @@ var Signature = class _Signature {
|
|
|
703
1543
|
return new _Signature(buffer);
|
|
704
1544
|
}
|
|
705
1545
|
};
|
|
706
|
-
__tnRegisterFootprint("Signature", (params) => Signature.__tnInvokeFootprint(params));
|
|
707
|
-
__tnRegisterValidate("Signature", (buffer, params) => Signature.__tnInvokeValidate(buffer, params));
|
|
708
1546
|
var SignatureBuilder = class {
|
|
709
1547
|
constructor() {
|
|
710
1548
|
this.buffer = new Uint8Array(64);
|
|
@@ -732,6 +1570,123 @@ var SignatureBuilder = class {
|
|
|
732
1570
|
return view;
|
|
733
1571
|
}
|
|
734
1572
|
};
|
|
1573
|
+
__tnRegisterFootprint("Signature", (params) => Signature.__tnInvokeFootprint(params));
|
|
1574
|
+
__tnRegisterValidate("Signature", (buffer, params) => Signature.__tnInvokeValidate(buffer, params));
|
|
1575
|
+
__tnRegisterDynamicValidate("Signature", (buffer) => {
|
|
1576
|
+
const result = Signature.validate(buffer);
|
|
1577
|
+
const params = result.params;
|
|
1578
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
1579
|
+
});
|
|
1580
|
+
var __tn_ir_Timestamp = {
|
|
1581
|
+
typeName: "Timestamp",
|
|
1582
|
+
root: { op: "const", value: 8n }
|
|
1583
|
+
};
|
|
1584
|
+
var Timestamp = class _Timestamp {
|
|
1585
|
+
constructor(buffer) {
|
|
1586
|
+
this.buffer = buffer;
|
|
1587
|
+
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1588
|
+
}
|
|
1589
|
+
static __tnCreateView(buffer, opts) {
|
|
1590
|
+
if (!buffer || buffer.length === void 0) throw new Error("Timestamp.__tnCreateView requires a Uint8Array");
|
|
1591
|
+
return new _Timestamp(new Uint8Array(buffer));
|
|
1592
|
+
}
|
|
1593
|
+
static builder() {
|
|
1594
|
+
return new TimestampBuilder();
|
|
1595
|
+
}
|
|
1596
|
+
static fromBuilder(builder) {
|
|
1597
|
+
const buffer = builder.build();
|
|
1598
|
+
return _Timestamp.from_array(buffer);
|
|
1599
|
+
}
|
|
1600
|
+
get_seconds() {
|
|
1601
|
+
const offset = 0;
|
|
1602
|
+
return this.view.getBigInt64(offset, true);
|
|
1603
|
+
}
|
|
1604
|
+
set_seconds(value) {
|
|
1605
|
+
const offset = 0;
|
|
1606
|
+
this.view.setBigInt64(offset, value, true);
|
|
1607
|
+
}
|
|
1608
|
+
get seconds() {
|
|
1609
|
+
return this.get_seconds();
|
|
1610
|
+
}
|
|
1611
|
+
set seconds(value) {
|
|
1612
|
+
this.set_seconds(value);
|
|
1613
|
+
}
|
|
1614
|
+
static __tnFootprintInternal(__tnParams) {
|
|
1615
|
+
return __tnEvalFootprint(__tn_ir_Timestamp.root, { params: __tnParams });
|
|
1616
|
+
}
|
|
1617
|
+
static __tnValidateInternal(buffer, __tnParams) {
|
|
1618
|
+
return __tnValidateIrTree(__tn_ir_Timestamp, buffer, __tnParams);
|
|
1619
|
+
}
|
|
1620
|
+
static __tnInvokeFootprint(__tnParams) {
|
|
1621
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
1622
|
+
}
|
|
1623
|
+
static __tnInvokeValidate(buffer, __tnParams) {
|
|
1624
|
+
return this.__tnValidateInternal(buffer, __tnParams);
|
|
1625
|
+
}
|
|
1626
|
+
static footprintIr() {
|
|
1627
|
+
return this.__tnFootprintInternal(/* @__PURE__ */ Object.create(null));
|
|
1628
|
+
}
|
|
1629
|
+
static footprint() {
|
|
1630
|
+
const irResult = this.footprintIr();
|
|
1631
|
+
const maxSafe = __tnToBigInt(Number.MAX_SAFE_INTEGER);
|
|
1632
|
+
if (__tnBigIntGreaterThan(irResult, maxSafe)) {
|
|
1633
|
+
throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for Timestamp");
|
|
1634
|
+
}
|
|
1635
|
+
return __tnBigIntToNumber(irResult, "Timestamp::footprint");
|
|
1636
|
+
}
|
|
1637
|
+
static validate(buffer, _opts) {
|
|
1638
|
+
if (buffer.length < 8) return { ok: false, code: "tn.buffer_too_small", consumed: 8 };
|
|
1639
|
+
return { ok: true, consumed: 8 };
|
|
1640
|
+
}
|
|
1641
|
+
static new(seconds) {
|
|
1642
|
+
const buffer = new Uint8Array(8);
|
|
1643
|
+
const view = new DataView(buffer.buffer);
|
|
1644
|
+
view.setBigInt64(0, seconds, true);
|
|
1645
|
+
return new _Timestamp(buffer);
|
|
1646
|
+
}
|
|
1647
|
+
static from_array(buffer) {
|
|
1648
|
+
if (!buffer || buffer.length === void 0) {
|
|
1649
|
+
return null;
|
|
1650
|
+
}
|
|
1651
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1652
|
+
const validation = this.validate(buffer);
|
|
1653
|
+
if (!validation.ok) {
|
|
1654
|
+
return null;
|
|
1655
|
+
}
|
|
1656
|
+
return new _Timestamp(buffer);
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
var TimestampBuilder = class {
|
|
1660
|
+
constructor() {
|
|
1661
|
+
this.buffer = new Uint8Array(8);
|
|
1662
|
+
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
1663
|
+
}
|
|
1664
|
+
set_seconds(value) {
|
|
1665
|
+
const cast = __tnToBigInt(value);
|
|
1666
|
+
this.view.setBigInt64(0, cast, true);
|
|
1667
|
+
return this;
|
|
1668
|
+
}
|
|
1669
|
+
build() {
|
|
1670
|
+
return this.buffer.slice();
|
|
1671
|
+
}
|
|
1672
|
+
buildInto(target, offset = 0) {
|
|
1673
|
+
if (target.length - offset < this.buffer.length) throw new Error("target buffer too small");
|
|
1674
|
+
target.set(this.buffer, offset);
|
|
1675
|
+
return target;
|
|
1676
|
+
}
|
|
1677
|
+
finish() {
|
|
1678
|
+
const view = Timestamp.from_array(this.buffer.slice());
|
|
1679
|
+
if (!view) throw new Error("failed to build Timestamp");
|
|
1680
|
+
return view;
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
__tnRegisterFootprint("Timestamp", (params) => Timestamp.__tnInvokeFootprint(params));
|
|
1684
|
+
__tnRegisterValidate("Timestamp", (buffer, params) => Timestamp.__tnInvokeValidate(buffer, params));
|
|
1685
|
+
__tnRegisterDynamicValidate("Timestamp", (buffer) => {
|
|
1686
|
+
const result = Timestamp.validate(buffer);
|
|
1687
|
+
const params = result.params;
|
|
1688
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt(result.consumed), params };
|
|
1689
|
+
});
|
|
735
1690
|
|
|
736
1691
|
// src/token/abi/thru/blockchain/state_proof/types.ts
|
|
737
1692
|
var __tnWarnings2 = /* @__PURE__ */ new Set();
|
|
@@ -749,7 +1704,7 @@ function __tnWarnOnce2(message) {
|
|
|
749
1704
|
__tnLogWarn2(message);
|
|
750
1705
|
}
|
|
751
1706
|
}
|
|
752
|
-
function
|
|
1707
|
+
function __tnResolveBuilderInput2(input, context) {
|
|
753
1708
|
if (input instanceof Uint8Array) {
|
|
754
1709
|
return new Uint8Array(input);
|
|
755
1710
|
}
|
|
@@ -771,7 +1726,7 @@ function __tnCreateVariantSelector(parent, descriptors, assign) {
|
|
|
771
1726
|
}
|
|
772
1727
|
return {
|
|
773
1728
|
writePayload(payload) {
|
|
774
|
-
const bytes =
|
|
1729
|
+
const bytes = __tnResolveBuilderInput2(
|
|
775
1730
|
payload,
|
|
776
1731
|
`variant ${descriptor.name}`
|
|
777
1732
|
);
|
|
@@ -1024,12 +1979,16 @@ if (typeof DataView !== "undefined" && !__tnHasBigIntDataView2) {
|
|
|
1024
1979
|
}
|
|
1025
1980
|
var __tnFootprintRegistry2 = {};
|
|
1026
1981
|
var __tnValidateRegistry2 = {};
|
|
1982
|
+
var __tnDynamicValidateRegistry2 = {};
|
|
1027
1983
|
function __tnRegisterFootprint2(typeName, fn) {
|
|
1028
1984
|
__tnFootprintRegistry2[typeName] = fn;
|
|
1029
1985
|
}
|
|
1030
1986
|
function __tnRegisterValidate2(typeName, fn) {
|
|
1031
1987
|
__tnValidateRegistry2[typeName] = fn;
|
|
1032
1988
|
}
|
|
1989
|
+
function __tnRegisterDynamicValidate2(typeName, fn) {
|
|
1990
|
+
__tnDynamicValidateRegistry2[typeName] = fn;
|
|
1991
|
+
}
|
|
1033
1992
|
function __tnInvokeFootprint2(typeName, params) {
|
|
1034
1993
|
const fn = __tnFootprintRegistry2[typeName];
|
|
1035
1994
|
if (!fn) throw new Error(`IR runtime missing footprint for ${typeName}`);
|
|
@@ -1040,12 +1999,17 @@ function __tnInvokeValidate2(typeName, buffer, params) {
|
|
|
1040
1999
|
if (!fn) throw new Error(`IR runtime missing validate helper for ${typeName}`);
|
|
1041
2000
|
return fn(buffer, params);
|
|
1042
2001
|
}
|
|
2002
|
+
function __tnInvokeDynamicValidate2(typeName, buffer) {
|
|
2003
|
+
const fn = __tnDynamicValidateRegistry2[typeName];
|
|
2004
|
+
if (!fn) throw new Error(`IR runtime missing dynamic validate helper for ${typeName}`);
|
|
2005
|
+
return fn(buffer);
|
|
2006
|
+
}
|
|
1043
2007
|
function __tnEvalFootprint2(node, ctx) {
|
|
1044
|
-
return __tnEvalIrNode2(node, ctx);
|
|
2008
|
+
return __tnEvalIrNode2(node, ctx, __tnToBigInt2(0));
|
|
1045
2009
|
}
|
|
1046
2010
|
function __tnTryEvalIr2(node, ctx) {
|
|
1047
2011
|
try {
|
|
1048
|
-
return { ok: true, value: __tnEvalIrNode2(node, ctx) };
|
|
2012
|
+
return { ok: true, value: __tnEvalIrNode2(node, ctx, __tnToBigInt2(0)) };
|
|
1049
2013
|
} catch (err) {
|
|
1050
2014
|
return { ok: false, code: __tnNormalizeIrError2(err) };
|
|
1051
2015
|
}
|
|
@@ -1069,7 +2033,7 @@ function __tnValidateIrTree2(ir, buffer, params) {
|
|
|
1069
2033
|
}
|
|
1070
2034
|
return { ok: true, consumed: required };
|
|
1071
2035
|
}
|
|
1072
|
-
function __tnEvalIrNode2(node, ctx) {
|
|
2036
|
+
function __tnEvalIrNode2(node, ctx, baseOffset) {
|
|
1073
2037
|
switch (node.op) {
|
|
1074
2038
|
case "zero":
|
|
1075
2039
|
return __tnToBigInt2(0);
|
|
@@ -1086,18 +2050,22 @@ function __tnEvalIrNode2(node, ctx) {
|
|
|
1086
2050
|
}
|
|
1087
2051
|
return val;
|
|
1088
2052
|
}
|
|
1089
|
-
case "add":
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
2053
|
+
case "add": {
|
|
2054
|
+
const left = __tnEvalIrNode2(node.left, ctx, baseOffset);
|
|
2055
|
+
const right = __tnEvalIrNode2(
|
|
2056
|
+
node.right,
|
|
2057
|
+
ctx,
|
|
2058
|
+
__tnCheckedAdd2(baseOffset, left)
|
|
1093
2059
|
);
|
|
2060
|
+
return __tnCheckedAdd2(left, right);
|
|
2061
|
+
}
|
|
1094
2062
|
case "mul":
|
|
1095
2063
|
return __tnCheckedMul2(
|
|
1096
|
-
__tnEvalIrNode2(node.left, ctx),
|
|
1097
|
-
__tnEvalIrNode2(node.right, ctx)
|
|
2064
|
+
__tnEvalIrNode2(node.left, ctx, baseOffset),
|
|
2065
|
+
__tnEvalIrNode2(node.right, ctx, baseOffset)
|
|
1098
2066
|
);
|
|
1099
2067
|
case "align":
|
|
1100
|
-
return __tnAlign2(__tnEvalIrNode2(node.node, ctx), node.alignment);
|
|
2068
|
+
return __tnAlign2(__tnEvalIrNode2(node.node, ctx, baseOffset), node.alignment);
|
|
1101
2069
|
case "switch": {
|
|
1102
2070
|
const tagVal = ctx.params[node.tag];
|
|
1103
2071
|
if (tagVal === void 0) {
|
|
@@ -1110,10 +2078,10 @@ function __tnEvalIrNode2(node, ctx) {
|
|
|
1110
2078
|
const tagNumber = Number(tagVal);
|
|
1111
2079
|
for (const caseNode of node.cases) {
|
|
1112
2080
|
if (caseNode.value === tagNumber) {
|
|
1113
|
-
return __tnEvalIrNode2(caseNode.node, ctx);
|
|
2081
|
+
return __tnEvalIrNode2(caseNode.node, ctx, baseOffset);
|
|
1114
2082
|
}
|
|
1115
2083
|
}
|
|
1116
|
-
if (node.default) return __tnEvalIrNode2(node.default, ctx);
|
|
2084
|
+
if (node.default) return __tnEvalIrNode2(node.default, ctx, baseOffset);
|
|
1117
2085
|
__tnRaiseIrError2(
|
|
1118
2086
|
"tn.ir.invalid_tag",
|
|
1119
2087
|
`Unhandled IR switch value ${tagNumber} for '${node.tag}'`
|
|
@@ -1133,9 +2101,10 @@ function __tnEvalIrNode2(node, ctx) {
|
|
|
1133
2101
|
nestedParams[arg.name] = val;
|
|
1134
2102
|
}
|
|
1135
2103
|
if (ctx.buffer) {
|
|
2104
|
+
const nestedOffset = __tnBigIntToNumber2(baseOffset, "IR nested offset");
|
|
1136
2105
|
const nestedResult = __tnInvokeValidate2(
|
|
1137
2106
|
node.typeName,
|
|
1138
|
-
ctx.buffer,
|
|
2107
|
+
ctx.buffer.subarray(nestedOffset),
|
|
1139
2108
|
nestedParams
|
|
1140
2109
|
);
|
|
1141
2110
|
if (!nestedResult.ok) {
|
|
@@ -1152,6 +2121,36 @@ function __tnEvalIrNode2(node, ctx) {
|
|
|
1152
2121
|
}
|
|
1153
2122
|
return __tnInvokeFootprint2(node.typeName, nestedParams);
|
|
1154
2123
|
}
|
|
2124
|
+
case "sumOverArray": {
|
|
2125
|
+
if (!ctx.buffer) {
|
|
2126
|
+
__tnRaiseIrError2(
|
|
2127
|
+
"tn.ir.missing_buffer",
|
|
2128
|
+
`Jagged array '${node.fieldName}' requires buffer-backed validation`
|
|
2129
|
+
);
|
|
2130
|
+
}
|
|
2131
|
+
const count = __tnBigIntToNumber2(
|
|
2132
|
+
__tnEvalIrNode2(node.count, ctx, baseOffset),
|
|
2133
|
+
`Jagged array '${node.fieldName}' count`
|
|
2134
|
+
);
|
|
2135
|
+
let cursor = __tnBigIntToNumber2(baseOffset, "IR jagged array offset");
|
|
2136
|
+
let total = __tnToBigInt2(0);
|
|
2137
|
+
for (let i = 0; i < count; i++) {
|
|
2138
|
+
const result = __tnInvokeDynamicValidate2(
|
|
2139
|
+
node.elementTypeName,
|
|
2140
|
+
ctx.buffer.subarray(cursor)
|
|
2141
|
+
);
|
|
2142
|
+
if (!result.ok || result.consumed === void 0) {
|
|
2143
|
+
const code = result.code ?? "tn.ir.runtime_error";
|
|
2144
|
+
__tnRaiseIrError2(
|
|
2145
|
+
code,
|
|
2146
|
+
`Jagged array '${node.fieldName}' element ${i} failed validation`
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
cursor += __tnBigIntToNumber2(result.consumed, "IR jagged element size");
|
|
2150
|
+
total = __tnCheckedAdd2(total, result.consumed);
|
|
2151
|
+
}
|
|
2152
|
+
return total;
|
|
2153
|
+
}
|
|
1155
2154
|
default:
|
|
1156
2155
|
__tnRaiseIrError2(
|
|
1157
2156
|
"tn.ir.runtime_error",
|
|
@@ -1175,6 +2174,20 @@ function __tnNormalizeIrError2(err) {
|
|
|
1175
2174
|
if (message.length > 0) return `tn.ir.runtime_error: ${message}`;
|
|
1176
2175
|
return "tn.ir.runtime_error";
|
|
1177
2176
|
}
|
|
2177
|
+
__tnRegisterFootprint2("Hash", (params) => Hash.__tnInvokeFootprint(params));
|
|
2178
|
+
__tnRegisterValidate2("Hash", (buffer, params) => Hash.__tnInvokeValidate(buffer, params));
|
|
2179
|
+
__tnRegisterDynamicValidate2("Hash", (buffer) => {
|
|
2180
|
+
const result = Hash.validate(buffer);
|
|
2181
|
+
const params = result.params;
|
|
2182
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
|
|
2183
|
+
});
|
|
2184
|
+
__tnRegisterFootprint2("Pubkey", (params) => Pubkey.__tnInvokeFootprint(params));
|
|
2185
|
+
__tnRegisterValidate2("Pubkey", (buffer, params) => Pubkey.__tnInvokeValidate(buffer, params));
|
|
2186
|
+
__tnRegisterDynamicValidate2("Pubkey", (buffer) => {
|
|
2187
|
+
const result = Pubkey.validate(buffer);
|
|
2188
|
+
const params = result.params;
|
|
2189
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
|
|
2190
|
+
});
|
|
1178
2191
|
var __tn_ir_StateProofHeader = {
|
|
1179
2192
|
typeName: "StateProofHeader",
|
|
1180
2193
|
root: { op: "const", value: 40n }
|
|
@@ -1264,8 +2277,6 @@ var StateProofHeader = class _StateProofHeader {
|
|
|
1264
2277
|
return new _StateProofHeader(buffer);
|
|
1265
2278
|
}
|
|
1266
2279
|
};
|
|
1267
|
-
__tnRegisterFootprint2("StateProofHeader", (params) => StateProofHeader.__tnInvokeFootprint(params));
|
|
1268
|
-
__tnRegisterValidate2("StateProofHeader", (buffer, params) => StateProofHeader.__tnInvokeValidate(buffer, params));
|
|
1269
2280
|
var StateProofHeaderBuilder = class {
|
|
1270
2281
|
constructor() {
|
|
1271
2282
|
this.buffer = new Uint8Array(40);
|
|
@@ -1295,6 +2306,13 @@ var StateProofHeaderBuilder = class {
|
|
|
1295
2306
|
return view;
|
|
1296
2307
|
}
|
|
1297
2308
|
};
|
|
2309
|
+
__tnRegisterFootprint2("StateProofHeader", (params) => StateProofHeader.__tnInvokeFootprint(params));
|
|
2310
|
+
__tnRegisterValidate2("StateProofHeader", (buffer, params) => StateProofHeader.__tnInvokeValidate(buffer, params));
|
|
2311
|
+
__tnRegisterDynamicValidate2("StateProofHeader", (buffer) => {
|
|
2312
|
+
const result = StateProofHeader.validate(buffer);
|
|
2313
|
+
const params = result.params;
|
|
2314
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
|
|
2315
|
+
});
|
|
1298
2316
|
var __tn_ir_StateProof = {
|
|
1299
2317
|
typeName: "StateProof",
|
|
1300
2318
|
root: { op: "align", alignment: 1, node: { op: "add", left: { op: "align", alignment: 1, node: { op: "const", value: 40n } }, right: { op: "align", alignment: 1, node: { op: "field", param: "proof_body.payload_size" } } } }
|
|
@@ -1866,8 +2884,6 @@ var StateProof = _StateProof;
|
|
|
1866
2884
|
}
|
|
1867
2885
|
StateProof2.params = params;
|
|
1868
2886
|
})(StateProof || (StateProof = {}));
|
|
1869
|
-
__tnRegisterFootprint2("StateProof", (params) => StateProof.__tnInvokeFootprint(params));
|
|
1870
|
-
__tnRegisterValidate2("StateProof", (buffer, params) => StateProof.__tnInvokeValidate(buffer, params));
|
|
1871
2887
|
var StateProofBuilder = class {
|
|
1872
2888
|
constructor() {
|
|
1873
2889
|
this.__tnPayload_proof_body = null;
|
|
@@ -1974,6 +2990,13 @@ var StateProofBuilder = class {
|
|
|
1974
2990
|
this.__tnLastBuffer = buffer;
|
|
1975
2991
|
}
|
|
1976
2992
|
};
|
|
2993
|
+
__tnRegisterFootprint2("StateProof", (params) => StateProof.__tnInvokeFootprint(params));
|
|
2994
|
+
__tnRegisterValidate2("StateProof", (buffer, params) => StateProof.__tnInvokeValidate(buffer, params));
|
|
2995
|
+
__tnRegisterDynamicValidate2("StateProof", (buffer) => {
|
|
2996
|
+
const result = StateProof.validate(buffer);
|
|
2997
|
+
const params = result.params;
|
|
2998
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt2(result.consumed), params };
|
|
2999
|
+
});
|
|
1977
3000
|
|
|
1978
3001
|
// src/token/abi/thru/program/token/types.ts
|
|
1979
3002
|
var __tnWarnings3 = /* @__PURE__ */ new Set();
|
|
@@ -1991,7 +3014,7 @@ function __tnWarnOnce3(message) {
|
|
|
1991
3014
|
__tnLogWarn3(message);
|
|
1992
3015
|
}
|
|
1993
3016
|
}
|
|
1994
|
-
function
|
|
3017
|
+
function __tnResolveBuilderInput3(input, context) {
|
|
1995
3018
|
if (input instanceof Uint8Array) {
|
|
1996
3019
|
return new Uint8Array(input);
|
|
1997
3020
|
}
|
|
@@ -2006,7 +3029,7 @@ function __tnResolveBuilderInput2(input, context) {
|
|
|
2006
3029
|
}
|
|
2007
3030
|
function __tnResolveStructFieldInput(input, context) {
|
|
2008
3031
|
if (input instanceof Uint8Array || input && typeof input.build === "function") {
|
|
2009
|
-
return
|
|
3032
|
+
return __tnResolveBuilderInput3(input, context);
|
|
2010
3033
|
}
|
|
2011
3034
|
if (input && typeof input.asUint8Array === "function") {
|
|
2012
3035
|
const bytes = input.asUint8Array();
|
|
@@ -2037,7 +3060,7 @@ function __tnCreateVariantSelector2(parent, descriptors, assign) {
|
|
|
2037
3060
|
}
|
|
2038
3061
|
return {
|
|
2039
3062
|
writePayload(payload) {
|
|
2040
|
-
const bytes =
|
|
3063
|
+
const bytes = __tnResolveBuilderInput3(
|
|
2041
3064
|
payload,
|
|
2042
3065
|
`variant ${descriptor.name}`
|
|
2043
3066
|
);
|
|
@@ -2284,12 +3307,16 @@ if (typeof DataView !== "undefined" && !__tnHasBigIntDataView3) {
|
|
|
2284
3307
|
}
|
|
2285
3308
|
var __tnFootprintRegistry3 = {};
|
|
2286
3309
|
var __tnValidateRegistry3 = {};
|
|
3310
|
+
var __tnDynamicValidateRegistry3 = {};
|
|
2287
3311
|
function __tnRegisterFootprint3(typeName, fn) {
|
|
2288
3312
|
__tnFootprintRegistry3[typeName] = fn;
|
|
2289
3313
|
}
|
|
2290
3314
|
function __tnRegisterValidate3(typeName, fn) {
|
|
2291
3315
|
__tnValidateRegistry3[typeName] = fn;
|
|
2292
3316
|
}
|
|
3317
|
+
function __tnRegisterDynamicValidate3(typeName, fn) {
|
|
3318
|
+
__tnDynamicValidateRegistry3[typeName] = fn;
|
|
3319
|
+
}
|
|
2293
3320
|
function __tnInvokeFootprint3(typeName, params) {
|
|
2294
3321
|
const fn = __tnFootprintRegistry3[typeName];
|
|
2295
3322
|
if (!fn) throw new Error(`IR runtime missing footprint for ${typeName}`);
|
|
@@ -2300,12 +3327,17 @@ function __tnInvokeValidate3(typeName, buffer, params) {
|
|
|
2300
3327
|
if (!fn) throw new Error(`IR runtime missing validate helper for ${typeName}`);
|
|
2301
3328
|
return fn(buffer, params);
|
|
2302
3329
|
}
|
|
3330
|
+
function __tnInvokeDynamicValidate3(typeName, buffer) {
|
|
3331
|
+
const fn = __tnDynamicValidateRegistry3[typeName];
|
|
3332
|
+
if (!fn) throw new Error(`IR runtime missing dynamic validate helper for ${typeName}`);
|
|
3333
|
+
return fn(buffer);
|
|
3334
|
+
}
|
|
2303
3335
|
function __tnEvalFootprint3(node, ctx) {
|
|
2304
|
-
return __tnEvalIrNode3(node, ctx);
|
|
3336
|
+
return __tnEvalIrNode3(node, ctx, __tnToBigInt3(0));
|
|
2305
3337
|
}
|
|
2306
3338
|
function __tnTryEvalIr3(node, ctx) {
|
|
2307
3339
|
try {
|
|
2308
|
-
return { ok: true, value: __tnEvalIrNode3(node, ctx) };
|
|
3340
|
+
return { ok: true, value: __tnEvalIrNode3(node, ctx, __tnToBigInt3(0)) };
|
|
2309
3341
|
} catch (err) {
|
|
2310
3342
|
return { ok: false, code: __tnNormalizeIrError3(err) };
|
|
2311
3343
|
}
|
|
@@ -2329,7 +3361,7 @@ function __tnValidateIrTree3(ir, buffer, params) {
|
|
|
2329
3361
|
}
|
|
2330
3362
|
return { ok: true, consumed: required };
|
|
2331
3363
|
}
|
|
2332
|
-
function __tnEvalIrNode3(node, ctx) {
|
|
3364
|
+
function __tnEvalIrNode3(node, ctx, baseOffset) {
|
|
2333
3365
|
switch (node.op) {
|
|
2334
3366
|
case "zero":
|
|
2335
3367
|
return __tnToBigInt3(0);
|
|
@@ -2346,18 +3378,22 @@ function __tnEvalIrNode3(node, ctx) {
|
|
|
2346
3378
|
}
|
|
2347
3379
|
return val;
|
|
2348
3380
|
}
|
|
2349
|
-
case "add":
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
3381
|
+
case "add": {
|
|
3382
|
+
const left = __tnEvalIrNode3(node.left, ctx, baseOffset);
|
|
3383
|
+
const right = __tnEvalIrNode3(
|
|
3384
|
+
node.right,
|
|
3385
|
+
ctx,
|
|
3386
|
+
__tnCheckedAdd3(baseOffset, left)
|
|
2353
3387
|
);
|
|
3388
|
+
return __tnCheckedAdd3(left, right);
|
|
3389
|
+
}
|
|
2354
3390
|
case "mul":
|
|
2355
3391
|
return __tnCheckedMul3(
|
|
2356
|
-
__tnEvalIrNode3(node.left, ctx),
|
|
2357
|
-
__tnEvalIrNode3(node.right, ctx)
|
|
3392
|
+
__tnEvalIrNode3(node.left, ctx, baseOffset),
|
|
3393
|
+
__tnEvalIrNode3(node.right, ctx, baseOffset)
|
|
2358
3394
|
);
|
|
2359
3395
|
case "align":
|
|
2360
|
-
return __tnAlign3(__tnEvalIrNode3(node.node, ctx), node.alignment);
|
|
3396
|
+
return __tnAlign3(__tnEvalIrNode3(node.node, ctx, baseOffset), node.alignment);
|
|
2361
3397
|
case "switch": {
|
|
2362
3398
|
const tagVal = ctx.params[node.tag];
|
|
2363
3399
|
if (tagVal === void 0) {
|
|
@@ -2370,10 +3406,10 @@ function __tnEvalIrNode3(node, ctx) {
|
|
|
2370
3406
|
const tagNumber = Number(tagVal);
|
|
2371
3407
|
for (const caseNode of node.cases) {
|
|
2372
3408
|
if (caseNode.value === tagNumber) {
|
|
2373
|
-
return __tnEvalIrNode3(caseNode.node, ctx);
|
|
3409
|
+
return __tnEvalIrNode3(caseNode.node, ctx, baseOffset);
|
|
2374
3410
|
}
|
|
2375
3411
|
}
|
|
2376
|
-
if (node.default) return __tnEvalIrNode3(node.default, ctx);
|
|
3412
|
+
if (node.default) return __tnEvalIrNode3(node.default, ctx, baseOffset);
|
|
2377
3413
|
__tnRaiseIrError3(
|
|
2378
3414
|
"tn.ir.invalid_tag",
|
|
2379
3415
|
`Unhandled IR switch value ${tagNumber} for '${node.tag}'`
|
|
@@ -2393,9 +3429,10 @@ function __tnEvalIrNode3(node, ctx) {
|
|
|
2393
3429
|
nestedParams[arg.name] = val;
|
|
2394
3430
|
}
|
|
2395
3431
|
if (ctx.buffer) {
|
|
3432
|
+
const nestedOffset = __tnBigIntToNumber3(baseOffset, "IR nested offset");
|
|
2396
3433
|
const nestedResult = __tnInvokeValidate3(
|
|
2397
3434
|
node.typeName,
|
|
2398
|
-
ctx.buffer,
|
|
3435
|
+
ctx.buffer.subarray(nestedOffset),
|
|
2399
3436
|
nestedParams
|
|
2400
3437
|
);
|
|
2401
3438
|
if (!nestedResult.ok) {
|
|
@@ -2412,6 +3449,36 @@ function __tnEvalIrNode3(node, ctx) {
|
|
|
2412
3449
|
}
|
|
2413
3450
|
return __tnInvokeFootprint3(node.typeName, nestedParams);
|
|
2414
3451
|
}
|
|
3452
|
+
case "sumOverArray": {
|
|
3453
|
+
if (!ctx.buffer) {
|
|
3454
|
+
__tnRaiseIrError3(
|
|
3455
|
+
"tn.ir.missing_buffer",
|
|
3456
|
+
`Jagged array '${node.fieldName}' requires buffer-backed validation`
|
|
3457
|
+
);
|
|
3458
|
+
}
|
|
3459
|
+
const count = __tnBigIntToNumber3(
|
|
3460
|
+
__tnEvalIrNode3(node.count, ctx, baseOffset),
|
|
3461
|
+
`Jagged array '${node.fieldName}' count`
|
|
3462
|
+
);
|
|
3463
|
+
let cursor = __tnBigIntToNumber3(baseOffset, "IR jagged array offset");
|
|
3464
|
+
let total = __tnToBigInt3(0);
|
|
3465
|
+
for (let i = 0; i < count; i++) {
|
|
3466
|
+
const result = __tnInvokeDynamicValidate3(
|
|
3467
|
+
node.elementTypeName,
|
|
3468
|
+
ctx.buffer.subarray(cursor)
|
|
3469
|
+
);
|
|
3470
|
+
if (!result.ok || result.consumed === void 0) {
|
|
3471
|
+
const code = result.code ?? "tn.ir.runtime_error";
|
|
3472
|
+
__tnRaiseIrError3(
|
|
3473
|
+
code,
|
|
3474
|
+
`Jagged array '${node.fieldName}' element ${i} failed validation`
|
|
3475
|
+
);
|
|
3476
|
+
}
|
|
3477
|
+
cursor += __tnBigIntToNumber3(result.consumed, "IR jagged element size");
|
|
3478
|
+
total = __tnCheckedAdd3(total, result.consumed);
|
|
3479
|
+
}
|
|
3480
|
+
return total;
|
|
3481
|
+
}
|
|
2415
3482
|
default:
|
|
2416
3483
|
__tnRaiseIrError3(
|
|
2417
3484
|
"tn.ir.runtime_error",
|
|
@@ -2435,6 +3502,20 @@ function __tnNormalizeIrError3(err) {
|
|
|
2435
3502
|
if (message.length > 0) return `tn.ir.runtime_error: ${message}`;
|
|
2436
3503
|
return "tn.ir.runtime_error";
|
|
2437
3504
|
}
|
|
3505
|
+
__tnRegisterFootprint3("Pubkey", (params) => Pubkey.__tnInvokeFootprint(params));
|
|
3506
|
+
__tnRegisterValidate3("Pubkey", (buffer, params) => Pubkey.__tnInvokeValidate(buffer, params));
|
|
3507
|
+
__tnRegisterDynamicValidate3("Pubkey", (buffer) => {
|
|
3508
|
+
const result = Pubkey.validate(buffer);
|
|
3509
|
+
const params = result.params;
|
|
3510
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
3511
|
+
});
|
|
3512
|
+
__tnRegisterFootprint3("StateProof", (params) => StateProof.__tnInvokeFootprint(params));
|
|
3513
|
+
__tnRegisterValidate3("StateProof", (buffer, params) => StateProof.__tnInvokeValidate(buffer, params));
|
|
3514
|
+
__tnRegisterDynamicValidate3("StateProof", (buffer) => {
|
|
3515
|
+
const result = StateProof.validate(buffer);
|
|
3516
|
+
const params = result.params;
|
|
3517
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
3518
|
+
});
|
|
2438
3519
|
var __tn_ir_BurnInstruction = {
|
|
2439
3520
|
typeName: "BurnInstruction",
|
|
2440
3521
|
root: { op: "const", value: 14n }
|
|
@@ -2559,8 +3640,6 @@ var BurnInstruction = class _BurnInstruction {
|
|
|
2559
3640
|
return new _BurnInstruction(buffer);
|
|
2560
3641
|
}
|
|
2561
3642
|
};
|
|
2562
|
-
__tnRegisterFootprint3("BurnInstruction", (params) => BurnInstruction.__tnInvokeFootprint(params));
|
|
2563
|
-
__tnRegisterValidate3("BurnInstruction", (buffer, params) => BurnInstruction.__tnInvokeValidate(buffer, params));
|
|
2564
3643
|
var BurnInstructionBuilder = class {
|
|
2565
3644
|
constructor() {
|
|
2566
3645
|
this.buffer = new Uint8Array(14);
|
|
@@ -2597,6 +3676,13 @@ var BurnInstructionBuilder = class {
|
|
|
2597
3676
|
return view;
|
|
2598
3677
|
}
|
|
2599
3678
|
};
|
|
3679
|
+
__tnRegisterFootprint3("BurnInstruction", (params) => BurnInstruction.__tnInvokeFootprint(params));
|
|
3680
|
+
__tnRegisterValidate3("BurnInstruction", (buffer, params) => BurnInstruction.__tnInvokeValidate(buffer, params));
|
|
3681
|
+
__tnRegisterDynamicValidate3("BurnInstruction", (buffer) => {
|
|
3682
|
+
const result = BurnInstruction.validate(buffer);
|
|
3683
|
+
const params = result.params;
|
|
3684
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
3685
|
+
});
|
|
2600
3686
|
var __tn_ir_CloseAccountInstruction = {
|
|
2601
3687
|
typeName: "CloseAccountInstruction",
|
|
2602
3688
|
root: { op: "const", value: 6n }
|
|
@@ -2706,8 +3792,6 @@ var CloseAccountInstruction = class _CloseAccountInstruction {
|
|
|
2706
3792
|
return new _CloseAccountInstruction(buffer);
|
|
2707
3793
|
}
|
|
2708
3794
|
};
|
|
2709
|
-
__tnRegisterFootprint3("CloseAccountInstruction", (params) => CloseAccountInstruction.__tnInvokeFootprint(params));
|
|
2710
|
-
__tnRegisterValidate3("CloseAccountInstruction", (buffer, params) => CloseAccountInstruction.__tnInvokeValidate(buffer, params));
|
|
2711
3795
|
var CloseAccountInstructionBuilder = class {
|
|
2712
3796
|
constructor() {
|
|
2713
3797
|
this.buffer = new Uint8Array(6);
|
|
@@ -2739,6 +3823,13 @@ var CloseAccountInstructionBuilder = class {
|
|
|
2739
3823
|
return view;
|
|
2740
3824
|
}
|
|
2741
3825
|
};
|
|
3826
|
+
__tnRegisterFootprint3("CloseAccountInstruction", (params) => CloseAccountInstruction.__tnInvokeFootprint(params));
|
|
3827
|
+
__tnRegisterValidate3("CloseAccountInstruction", (buffer, params) => CloseAccountInstruction.__tnInvokeValidate(buffer, params));
|
|
3828
|
+
__tnRegisterDynamicValidate3("CloseAccountInstruction", (buffer) => {
|
|
3829
|
+
const result = CloseAccountInstruction.validate(buffer);
|
|
3830
|
+
const params = result.params;
|
|
3831
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
3832
|
+
});
|
|
2742
3833
|
var __tn_ir_FreezeAccountInstruction = {
|
|
2743
3834
|
typeName: "FreezeAccountInstruction",
|
|
2744
3835
|
root: { op: "const", value: 6n }
|
|
@@ -2848,8 +3939,6 @@ var FreezeAccountInstruction = class _FreezeAccountInstruction {
|
|
|
2848
3939
|
return new _FreezeAccountInstruction(buffer);
|
|
2849
3940
|
}
|
|
2850
3941
|
};
|
|
2851
|
-
__tnRegisterFootprint3("FreezeAccountInstruction", (params) => FreezeAccountInstruction.__tnInvokeFootprint(params));
|
|
2852
|
-
__tnRegisterValidate3("FreezeAccountInstruction", (buffer, params) => FreezeAccountInstruction.__tnInvokeValidate(buffer, params));
|
|
2853
3942
|
var FreezeAccountInstructionBuilder = class {
|
|
2854
3943
|
constructor() {
|
|
2855
3944
|
this.buffer = new Uint8Array(6);
|
|
@@ -2881,6 +3970,13 @@ var FreezeAccountInstructionBuilder = class {
|
|
|
2881
3970
|
return view;
|
|
2882
3971
|
}
|
|
2883
3972
|
};
|
|
3973
|
+
__tnRegisterFootprint3("FreezeAccountInstruction", (params) => FreezeAccountInstruction.__tnInvokeFootprint(params));
|
|
3974
|
+
__tnRegisterValidate3("FreezeAccountInstruction", (buffer, params) => FreezeAccountInstruction.__tnInvokeValidate(buffer, params));
|
|
3975
|
+
__tnRegisterDynamicValidate3("FreezeAccountInstruction", (buffer) => {
|
|
3976
|
+
const result = FreezeAccountInstruction.validate(buffer);
|
|
3977
|
+
const params = result.params;
|
|
3978
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
3979
|
+
});
|
|
2884
3980
|
var __tn_ir_MintToInstruction = {
|
|
2885
3981
|
typeName: "MintToInstruction",
|
|
2886
3982
|
root: { op: "const", value: 14n }
|
|
@@ -3005,8 +4101,6 @@ var MintToInstruction = class _MintToInstruction {
|
|
|
3005
4101
|
return new _MintToInstruction(buffer);
|
|
3006
4102
|
}
|
|
3007
4103
|
};
|
|
3008
|
-
__tnRegisterFootprint3("MintToInstruction", (params) => MintToInstruction.__tnInvokeFootprint(params));
|
|
3009
|
-
__tnRegisterValidate3("MintToInstruction", (buffer, params) => MintToInstruction.__tnInvokeValidate(buffer, params));
|
|
3010
4104
|
var MintToInstructionBuilder = class {
|
|
3011
4105
|
constructor() {
|
|
3012
4106
|
this.buffer = new Uint8Array(14);
|
|
@@ -3043,6 +4137,13 @@ var MintToInstructionBuilder = class {
|
|
|
3043
4137
|
return view;
|
|
3044
4138
|
}
|
|
3045
4139
|
};
|
|
4140
|
+
__tnRegisterFootprint3("MintToInstruction", (params) => MintToInstruction.__tnInvokeFootprint(params));
|
|
4141
|
+
__tnRegisterValidate3("MintToInstruction", (buffer, params) => MintToInstruction.__tnInvokeValidate(buffer, params));
|
|
4142
|
+
__tnRegisterDynamicValidate3("MintToInstruction", (buffer) => {
|
|
4143
|
+
const result = MintToInstruction.validate(buffer);
|
|
4144
|
+
const params = result.params;
|
|
4145
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
4146
|
+
});
|
|
3046
4147
|
var __tn_ir_Seed32 = {
|
|
3047
4148
|
typeName: "Seed32",
|
|
3048
4149
|
root: { op: "const", value: 32n }
|
|
@@ -3124,6 +4225,11 @@ _Seed32.__tnElementCount = 32;
|
|
|
3124
4225
|
var Seed32 = _Seed32;
|
|
3125
4226
|
__tnRegisterFootprint3("Seed32", (params) => Seed32.__tnInvokeFootprint(params));
|
|
3126
4227
|
__tnRegisterValidate3("Seed32", (buffer, params) => Seed32.__tnInvokeValidate(buffer, params));
|
|
4228
|
+
__tnRegisterDynamicValidate3("Seed32", (buffer) => {
|
|
4229
|
+
const result = Seed32.validate(buffer);
|
|
4230
|
+
const params = result.params;
|
|
4231
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
4232
|
+
});
|
|
3127
4233
|
var __tn_ir_ThawAccountEventData = {
|
|
3128
4234
|
typeName: "ThawAccountEventData",
|
|
3129
4235
|
root: { op: "const", value: 96n }
|
|
@@ -3231,8 +4337,6 @@ var ThawAccountEventData = class _ThawAccountEventData {
|
|
|
3231
4337
|
return new _ThawAccountEventData(buffer);
|
|
3232
4338
|
}
|
|
3233
4339
|
};
|
|
3234
|
-
__tnRegisterFootprint3("ThawAccountEventData", (params) => ThawAccountEventData.__tnInvokeFootprint(params));
|
|
3235
|
-
__tnRegisterValidate3("ThawAccountEventData", (buffer, params) => ThawAccountEventData.__tnInvokeValidate(buffer, params));
|
|
3236
4340
|
var ThawAccountEventDataBuilder = class {
|
|
3237
4341
|
constructor() {
|
|
3238
4342
|
this.buffer = new Uint8Array(96);
|
|
@@ -3267,6 +4371,13 @@ var ThawAccountEventDataBuilder = class {
|
|
|
3267
4371
|
return view;
|
|
3268
4372
|
}
|
|
3269
4373
|
};
|
|
4374
|
+
__tnRegisterFootprint3("ThawAccountEventData", (params) => ThawAccountEventData.__tnInvokeFootprint(params));
|
|
4375
|
+
__tnRegisterValidate3("ThawAccountEventData", (buffer, params) => ThawAccountEventData.__tnInvokeValidate(buffer, params));
|
|
4376
|
+
__tnRegisterDynamicValidate3("ThawAccountEventData", (buffer) => {
|
|
4377
|
+
const result = ThawAccountEventData.validate(buffer);
|
|
4378
|
+
const params = result.params;
|
|
4379
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
4380
|
+
});
|
|
3270
4381
|
var __tn_ir_ThawAccountInstruction = {
|
|
3271
4382
|
typeName: "ThawAccountInstruction",
|
|
3272
4383
|
root: { op: "const", value: 6n }
|
|
@@ -3376,8 +4487,6 @@ var ThawAccountInstruction = class _ThawAccountInstruction {
|
|
|
3376
4487
|
return new _ThawAccountInstruction(buffer);
|
|
3377
4488
|
}
|
|
3378
4489
|
};
|
|
3379
|
-
__tnRegisterFootprint3("ThawAccountInstruction", (params) => ThawAccountInstruction.__tnInvokeFootprint(params));
|
|
3380
|
-
__tnRegisterValidate3("ThawAccountInstruction", (buffer, params) => ThawAccountInstruction.__tnInvokeValidate(buffer, params));
|
|
3381
4490
|
var ThawAccountInstructionBuilder = class {
|
|
3382
4491
|
constructor() {
|
|
3383
4492
|
this.buffer = new Uint8Array(6);
|
|
@@ -3409,6 +4518,13 @@ var ThawAccountInstructionBuilder = class {
|
|
|
3409
4518
|
return view;
|
|
3410
4519
|
}
|
|
3411
4520
|
};
|
|
4521
|
+
__tnRegisterFootprint3("ThawAccountInstruction", (params) => ThawAccountInstruction.__tnInvokeFootprint(params));
|
|
4522
|
+
__tnRegisterValidate3("ThawAccountInstruction", (buffer, params) => ThawAccountInstruction.__tnInvokeValidate(buffer, params));
|
|
4523
|
+
__tnRegisterDynamicValidate3("ThawAccountInstruction", (buffer) => {
|
|
4524
|
+
const result = ThawAccountInstruction.validate(buffer);
|
|
4525
|
+
const params = result.params;
|
|
4526
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
4527
|
+
});
|
|
3412
4528
|
var __tn_ir_TickerField = {
|
|
3413
4529
|
typeName: "TickerField",
|
|
3414
4530
|
root: { op: "const", value: 9n }
|
|
@@ -3505,8 +4621,6 @@ var TickerField = class _TickerField {
|
|
|
3505
4621
|
return new _TickerField(buffer);
|
|
3506
4622
|
}
|
|
3507
4623
|
};
|
|
3508
|
-
__tnRegisterFootprint3("TickerField", (params) => TickerField.__tnInvokeFootprint(params));
|
|
3509
|
-
__tnRegisterValidate3("TickerField", (buffer, params) => TickerField.__tnInvokeValidate(buffer, params));
|
|
3510
4624
|
var TickerFieldBuilder = class {
|
|
3511
4625
|
constructor() {
|
|
3512
4626
|
this.buffer = new Uint8Array(9);
|
|
@@ -3538,6 +4652,13 @@ var TickerFieldBuilder = class {
|
|
|
3538
4652
|
return view;
|
|
3539
4653
|
}
|
|
3540
4654
|
};
|
|
4655
|
+
__tnRegisterFootprint3("TickerField", (params) => TickerField.__tnInvokeFootprint(params));
|
|
4656
|
+
__tnRegisterValidate3("TickerField", (buffer, params) => TickerField.__tnInvokeValidate(buffer, params));
|
|
4657
|
+
__tnRegisterDynamicValidate3("TickerField", (buffer) => {
|
|
4658
|
+
const result = TickerField.validate(buffer);
|
|
4659
|
+
const params = result.params;
|
|
4660
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
4661
|
+
});
|
|
3541
4662
|
var __tn_ir_TokenAccount = {
|
|
3542
4663
|
typeName: "TokenAccount",
|
|
3543
4664
|
root: { op: "const", value: 73n }
|
|
@@ -3657,8 +4778,6 @@ var TokenAccount = class _TokenAccount {
|
|
|
3657
4778
|
return new _TokenAccount(buffer);
|
|
3658
4779
|
}
|
|
3659
4780
|
};
|
|
3660
|
-
__tnRegisterFootprint3("TokenAccount", (params) => TokenAccount.__tnInvokeFootprint(params));
|
|
3661
|
-
__tnRegisterValidate3("TokenAccount", (buffer, params) => TokenAccount.__tnInvokeValidate(buffer, params));
|
|
3662
4781
|
var TokenAccountBuilder = class {
|
|
3663
4782
|
constructor() {
|
|
3664
4783
|
this.buffer = new Uint8Array(73);
|
|
@@ -3697,6 +4816,13 @@ var TokenAccountBuilder = class {
|
|
|
3697
4816
|
return view;
|
|
3698
4817
|
}
|
|
3699
4818
|
};
|
|
4819
|
+
__tnRegisterFootprint3("TokenAccount", (params) => TokenAccount.__tnInvokeFootprint(params));
|
|
4820
|
+
__tnRegisterValidate3("TokenAccount", (buffer, params) => TokenAccount.__tnInvokeValidate(buffer, params));
|
|
4821
|
+
__tnRegisterDynamicValidate3("TokenAccount", (buffer) => {
|
|
4822
|
+
const result = TokenAccount.validate(buffer);
|
|
4823
|
+
const params = result.params;
|
|
4824
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
4825
|
+
});
|
|
3700
4826
|
var __tn_ir_TokenMintAccount = {
|
|
3701
4827
|
typeName: "TokenMintAccount",
|
|
3702
4828
|
root: { op: "const", value: 115n }
|
|
@@ -3862,8 +4988,6 @@ var TokenMintAccount = class _TokenMintAccount {
|
|
|
3862
4988
|
return new _TokenMintAccount(buffer);
|
|
3863
4989
|
}
|
|
3864
4990
|
};
|
|
3865
|
-
__tnRegisterFootprint3("TokenMintAccount", (params) => TokenMintAccount.__tnInvokeFootprint(params));
|
|
3866
|
-
__tnRegisterValidate3("TokenMintAccount", (buffer, params) => TokenMintAccount.__tnInvokeValidate(buffer, params));
|
|
3867
4991
|
var TokenMintAccountBuilder = class {
|
|
3868
4992
|
constructor() {
|
|
3869
4993
|
this.buffer = new Uint8Array(115);
|
|
@@ -3916,6 +5040,13 @@ var TokenMintAccountBuilder = class {
|
|
|
3916
5040
|
return view;
|
|
3917
5041
|
}
|
|
3918
5042
|
};
|
|
5043
|
+
__tnRegisterFootprint3("TokenMintAccount", (params) => TokenMintAccount.__tnInvokeFootprint(params));
|
|
5044
|
+
__tnRegisterValidate3("TokenMintAccount", (buffer, params) => TokenMintAccount.__tnInvokeValidate(buffer, params));
|
|
5045
|
+
__tnRegisterDynamicValidate3("TokenMintAccount", (buffer) => {
|
|
5046
|
+
const result = TokenMintAccount.validate(buffer);
|
|
5047
|
+
const params = result.params;
|
|
5048
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
5049
|
+
});
|
|
3919
5050
|
var __tn_ir_TokenProgramAccount = {
|
|
3920
5051
|
typeName: "TokenProgramAccount",
|
|
3921
5052
|
root: { op: "align", alignment: 1, node: { op: "align", alignment: 1, node: { op: "switch", tag: "TokenProgramAccount::data.payload_size", cases: [{ value: 73, node: { op: "align", alignment: 1, node: { op: "const", value: 73n } } }, { value: 115, node: { op: "align", alignment: 1, node: { op: "const", value: 115n } } }] } } }
|
|
@@ -3952,7 +5083,6 @@ var TokenProgramAccount = class _TokenProgramAccount {
|
|
|
3952
5083
|
static __tnComputeSequentialLayout(view, buffer) {
|
|
3953
5084
|
const __tnLength = buffer.length;
|
|
3954
5085
|
let __tnParamSeq_data_payload_size = null;
|
|
3955
|
-
let __tnParamSeq_TokenProgramAccount__data_payload_size = null;
|
|
3956
5086
|
let __tnCursorMutable = 0;
|
|
3957
5087
|
const __tnSduAvailable_data = __tnLength - __tnCursorMutable;
|
|
3958
5088
|
let __tnSduSize_data = -1;
|
|
@@ -3967,13 +5097,10 @@ var TokenProgramAccount = class _TokenProgramAccount {
|
|
|
3967
5097
|
return null;
|
|
3968
5098
|
}
|
|
3969
5099
|
__tnParamSeq_data_payload_size = __tnToBigInt3(__tnSduSize_data);
|
|
3970
|
-
__tnParamSeq_TokenProgramAccount__data_payload_size = __tnToBigInt3(__tnSduSize_data);
|
|
3971
5100
|
__tnCursorMutable += __tnSduSize_data;
|
|
3972
5101
|
const params = /* @__PURE__ */ Object.create(null);
|
|
3973
5102
|
if (__tnParamSeq_data_payload_size === null) return null;
|
|
3974
5103
|
params["data_payload_size"] = __tnParamSeq_data_payload_size;
|
|
3975
|
-
if (__tnParamSeq_TokenProgramAccount__data_payload_size === null) return null;
|
|
3976
|
-
params["TokenProgramAccount__data_payload_size"] = __tnParamSeq_TokenProgramAccount__data_payload_size;
|
|
3977
5104
|
return { params, offsets: null, derived: null };
|
|
3978
5105
|
}
|
|
3979
5106
|
static __tnExtractParams(view, buffer) {
|
|
@@ -3982,11 +5109,8 @@ var TokenProgramAccount = class _TokenProgramAccount {
|
|
|
3982
5109
|
const __tnSeqParams = __tnLayout.params;
|
|
3983
5110
|
const __tnParamSeq_data_payload_size = __tnSeqParams["data_payload_size"];
|
|
3984
5111
|
if (__tnParamSeq_data_payload_size === void 0) return null;
|
|
3985
|
-
const __tnParamSeq_TokenProgramAccount__data_payload_size = __tnSeqParams["TokenProgramAccount__data_payload_size"];
|
|
3986
|
-
if (__tnParamSeq_TokenProgramAccount__data_payload_size === void 0) return null;
|
|
3987
5112
|
const __tnExtractedParams = _TokenProgramAccount.Params.fromValues({
|
|
3988
|
-
data_payload_size: __tnParamSeq_data_payload_size
|
|
3989
|
-
TokenProgramAccount__data_payload_size: __tnParamSeq_TokenProgramAccount__data_payload_size
|
|
5113
|
+
data_payload_size: __tnParamSeq_data_payload_size
|
|
3990
5114
|
});
|
|
3991
5115
|
return { params: __tnExtractedParams, derived: null };
|
|
3992
5116
|
}
|
|
@@ -4002,17 +5126,16 @@ var TokenProgramAccount = class _TokenProgramAccount {
|
|
|
4002
5126
|
static __tnInvokeValidate(buffer, __tnParams) {
|
|
4003
5127
|
return this.__tnValidateInternal(buffer, __tnParams);
|
|
4004
5128
|
}
|
|
4005
|
-
static footprintIr(data_payload_size
|
|
5129
|
+
static footprintIr(data_payload_size) {
|
|
4006
5130
|
const params = _TokenProgramAccount.Params.fromValues({
|
|
4007
|
-
data_payload_size
|
|
4008
|
-
TokenProgramAccount__data_payload_size
|
|
5131
|
+
data_payload_size
|
|
4009
5132
|
});
|
|
4010
5133
|
return this.footprintIrFromParams(params);
|
|
4011
5134
|
}
|
|
4012
5135
|
static __tnPackParams(params) {
|
|
4013
5136
|
const record = /* @__PURE__ */ Object.create(null);
|
|
4014
5137
|
record["data.payload_size"] = params.data_payload_size;
|
|
4015
|
-
record["TokenProgramAccount::data.payload_size"] = params.
|
|
5138
|
+
record["TokenProgramAccount::data.payload_size"] = params.data_payload_size;
|
|
4016
5139
|
return record;
|
|
4017
5140
|
}
|
|
4018
5141
|
static footprintIrFromParams(params) {
|
|
@@ -4073,14 +5196,12 @@ var TokenProgramAccount = class _TokenProgramAccount {
|
|
|
4073
5196
|
};
|
|
4074
5197
|
((TokenProgramAccount2) => {
|
|
4075
5198
|
TokenProgramAccount2.ParamKeys = Object.freeze({
|
|
4076
|
-
data_payload_size: "data.payload_size"
|
|
4077
|
-
TokenProgramAccount__data_payload_size: "TokenProgramAccount::data.payload_size"
|
|
5199
|
+
data_payload_size: "data.payload_size"
|
|
4078
5200
|
});
|
|
4079
5201
|
TokenProgramAccount2.Params = {
|
|
4080
5202
|
fromValues(input) {
|
|
4081
5203
|
return {
|
|
4082
|
-
data_payload_size: __tnToBigInt3(input.data_payload_size)
|
|
4083
|
-
TokenProgramAccount__data_payload_size: __tnToBigInt3(input.TokenProgramAccount__data_payload_size)
|
|
5204
|
+
data_payload_size: __tnToBigInt3(input.data_payload_size)
|
|
4084
5205
|
};
|
|
4085
5206
|
},
|
|
4086
5207
|
fromBuilder(source) {
|
|
@@ -4100,6 +5221,11 @@ var TokenProgramAccount = class _TokenProgramAccount {
|
|
|
4100
5221
|
})(TokenProgramAccount || (TokenProgramAccount = {}));
|
|
4101
5222
|
__tnRegisterFootprint3("TokenProgramAccount", (params) => TokenProgramAccount.__tnInvokeFootprint(params));
|
|
4102
5223
|
__tnRegisterValidate3("TokenProgramAccount", (buffer, params) => TokenProgramAccount.__tnInvokeValidate(buffer, params));
|
|
5224
|
+
__tnRegisterDynamicValidate3("TokenProgramAccount", (buffer) => {
|
|
5225
|
+
const result = TokenProgramAccount.validate(buffer);
|
|
5226
|
+
const params = result.params;
|
|
5227
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
5228
|
+
});
|
|
4103
5229
|
var __tn_ir_TransferEventData = {
|
|
4104
5230
|
typeName: "TransferEventData",
|
|
4105
5231
|
root: { op: "const", value: 88n }
|
|
@@ -4233,8 +5359,6 @@ var TransferEventData = class _TransferEventData {
|
|
|
4233
5359
|
return new _TransferEventData(buffer);
|
|
4234
5360
|
}
|
|
4235
5361
|
};
|
|
4236
|
-
__tnRegisterFootprint3("TransferEventData", (params) => TransferEventData.__tnInvokeFootprint(params));
|
|
4237
|
-
__tnRegisterValidate3("TransferEventData", (buffer, params) => TransferEventData.__tnInvokeValidate(buffer, params));
|
|
4238
5362
|
var TransferEventDataBuilder = class {
|
|
4239
5363
|
constructor() {
|
|
4240
5364
|
this.buffer = new Uint8Array(88);
|
|
@@ -4279,6 +5403,13 @@ var TransferEventDataBuilder = class {
|
|
|
4279
5403
|
return view;
|
|
4280
5404
|
}
|
|
4281
5405
|
};
|
|
5406
|
+
__tnRegisterFootprint3("TransferEventData", (params) => TransferEventData.__tnInvokeFootprint(params));
|
|
5407
|
+
__tnRegisterValidate3("TransferEventData", (buffer, params) => TransferEventData.__tnInvokeValidate(buffer, params));
|
|
5408
|
+
__tnRegisterDynamicValidate3("TransferEventData", (buffer) => {
|
|
5409
|
+
const result = TransferEventData.validate(buffer);
|
|
5410
|
+
const params = result.params;
|
|
5411
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
5412
|
+
});
|
|
4282
5413
|
var __tn_ir_TransferInstruction = {
|
|
4283
5414
|
typeName: "TransferInstruction",
|
|
4284
5415
|
root: { op: "const", value: 12n }
|
|
@@ -4388,8 +5519,6 @@ var TransferInstruction = class _TransferInstruction {
|
|
|
4388
5519
|
return new _TransferInstruction(buffer);
|
|
4389
5520
|
}
|
|
4390
5521
|
};
|
|
4391
|
-
__tnRegisterFootprint3("TransferInstruction", (params) => TransferInstruction.__tnInvokeFootprint(params));
|
|
4392
|
-
__tnRegisterValidate3("TransferInstruction", (buffer, params) => TransferInstruction.__tnInvokeValidate(buffer, params));
|
|
4393
5522
|
var TransferInstructionBuilder = class {
|
|
4394
5523
|
constructor() {
|
|
4395
5524
|
this.buffer = new Uint8Array(12);
|
|
@@ -4422,6 +5551,13 @@ var TransferInstructionBuilder = class {
|
|
|
4422
5551
|
return view;
|
|
4423
5552
|
}
|
|
4424
5553
|
};
|
|
5554
|
+
__tnRegisterFootprint3("TransferInstruction", (params) => TransferInstruction.__tnInvokeFootprint(params));
|
|
5555
|
+
__tnRegisterValidate3("TransferInstruction", (buffer, params) => TransferInstruction.__tnInvokeValidate(buffer, params));
|
|
5556
|
+
__tnRegisterDynamicValidate3("TransferInstruction", (buffer) => {
|
|
5557
|
+
const result = TransferInstruction.validate(buffer);
|
|
5558
|
+
const params = result.params;
|
|
5559
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
5560
|
+
});
|
|
4425
5561
|
var __tn_ir_BurnEventData = {
|
|
4426
5562
|
typeName: "BurnEventData",
|
|
4427
5563
|
root: { op: "const", value: 120n }
|
|
@@ -4571,8 +5707,6 @@ var BurnEventData = class _BurnEventData {
|
|
|
4571
5707
|
return new _BurnEventData(buffer);
|
|
4572
5708
|
}
|
|
4573
5709
|
};
|
|
4574
|
-
__tnRegisterFootprint3("BurnEventData", (params) => BurnEventData.__tnInvokeFootprint(params));
|
|
4575
|
-
__tnRegisterValidate3("BurnEventData", (buffer, params) => BurnEventData.__tnInvokeValidate(buffer, params));
|
|
4576
5710
|
var BurnEventDataBuilder = class {
|
|
4577
5711
|
constructor() {
|
|
4578
5712
|
this.buffer = new Uint8Array(120);
|
|
@@ -4622,6 +5756,13 @@ var BurnEventDataBuilder = class {
|
|
|
4622
5756
|
return view;
|
|
4623
5757
|
}
|
|
4624
5758
|
};
|
|
5759
|
+
__tnRegisterFootprint3("BurnEventData", (params) => BurnEventData.__tnInvokeFootprint(params));
|
|
5760
|
+
__tnRegisterValidate3("BurnEventData", (buffer, params) => BurnEventData.__tnInvokeValidate(buffer, params));
|
|
5761
|
+
__tnRegisterDynamicValidate3("BurnEventData", (buffer) => {
|
|
5762
|
+
const result = BurnEventData.validate(buffer);
|
|
5763
|
+
const params = result.params;
|
|
5764
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
5765
|
+
});
|
|
4625
5766
|
var __tn_ir_CloseAccountEventData = {
|
|
4626
5767
|
typeName: "CloseAccountEventData",
|
|
4627
5768
|
root: { op: "const", value: 96n }
|
|
@@ -4729,8 +5870,6 @@ var CloseAccountEventData = class _CloseAccountEventData {
|
|
|
4729
5870
|
return new _CloseAccountEventData(buffer);
|
|
4730
5871
|
}
|
|
4731
5872
|
};
|
|
4732
|
-
__tnRegisterFootprint3("CloseAccountEventData", (params) => CloseAccountEventData.__tnInvokeFootprint(params));
|
|
4733
|
-
__tnRegisterValidate3("CloseAccountEventData", (buffer, params) => CloseAccountEventData.__tnInvokeValidate(buffer, params));
|
|
4734
5873
|
var CloseAccountEventDataBuilder = class {
|
|
4735
5874
|
constructor() {
|
|
4736
5875
|
this.buffer = new Uint8Array(96);
|
|
@@ -4765,6 +5904,13 @@ var CloseAccountEventDataBuilder = class {
|
|
|
4765
5904
|
return view;
|
|
4766
5905
|
}
|
|
4767
5906
|
};
|
|
5907
|
+
__tnRegisterFootprint3("CloseAccountEventData", (params) => CloseAccountEventData.__tnInvokeFootprint(params));
|
|
5908
|
+
__tnRegisterValidate3("CloseAccountEventData", (buffer, params) => CloseAccountEventData.__tnInvokeValidate(buffer, params));
|
|
5909
|
+
__tnRegisterDynamicValidate3("CloseAccountEventData", (buffer) => {
|
|
5910
|
+
const result = CloseAccountEventData.validate(buffer);
|
|
5911
|
+
const params = result.params;
|
|
5912
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
5913
|
+
});
|
|
4768
5914
|
var __tn_ir_FreezeAccountEventData = {
|
|
4769
5915
|
typeName: "FreezeAccountEventData",
|
|
4770
5916
|
root: { op: "const", value: 96n }
|
|
@@ -4872,8 +6018,6 @@ var FreezeAccountEventData = class _FreezeAccountEventData {
|
|
|
4872
6018
|
return new _FreezeAccountEventData(buffer);
|
|
4873
6019
|
}
|
|
4874
6020
|
};
|
|
4875
|
-
__tnRegisterFootprint3("FreezeAccountEventData", (params) => FreezeAccountEventData.__tnInvokeFootprint(params));
|
|
4876
|
-
__tnRegisterValidate3("FreezeAccountEventData", (buffer, params) => FreezeAccountEventData.__tnInvokeValidate(buffer, params));
|
|
4877
6021
|
var FreezeAccountEventDataBuilder = class {
|
|
4878
6022
|
constructor() {
|
|
4879
6023
|
this.buffer = new Uint8Array(96);
|
|
@@ -4908,6 +6052,13 @@ var FreezeAccountEventDataBuilder = class {
|
|
|
4908
6052
|
return view;
|
|
4909
6053
|
}
|
|
4910
6054
|
};
|
|
6055
|
+
__tnRegisterFootprint3("FreezeAccountEventData", (params) => FreezeAccountEventData.__tnInvokeFootprint(params));
|
|
6056
|
+
__tnRegisterValidate3("FreezeAccountEventData", (buffer, params) => FreezeAccountEventData.__tnInvokeValidate(buffer, params));
|
|
6057
|
+
__tnRegisterDynamicValidate3("FreezeAccountEventData", (buffer) => {
|
|
6058
|
+
const result = FreezeAccountEventData.validate(buffer);
|
|
6059
|
+
const params = result.params;
|
|
6060
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
6061
|
+
});
|
|
4911
6062
|
var __tn_ir_InitializeAccountEventData = {
|
|
4912
6063
|
typeName: "InitializeAccountEventData",
|
|
4913
6064
|
root: { op: "const", value: 96n }
|
|
@@ -5015,8 +6166,6 @@ var InitializeAccountEventData = class _InitializeAccountEventData {
|
|
|
5015
6166
|
return new _InitializeAccountEventData(buffer);
|
|
5016
6167
|
}
|
|
5017
6168
|
};
|
|
5018
|
-
__tnRegisterFootprint3("InitializeAccountEventData", (params) => InitializeAccountEventData.__tnInvokeFootprint(params));
|
|
5019
|
-
__tnRegisterValidate3("InitializeAccountEventData", (buffer, params) => InitializeAccountEventData.__tnInvokeValidate(buffer, params));
|
|
5020
6169
|
var InitializeAccountEventDataBuilder = class {
|
|
5021
6170
|
constructor() {
|
|
5022
6171
|
this.buffer = new Uint8Array(96);
|
|
@@ -5051,6 +6200,13 @@ var InitializeAccountEventDataBuilder = class {
|
|
|
5051
6200
|
return view;
|
|
5052
6201
|
}
|
|
5053
6202
|
};
|
|
6203
|
+
__tnRegisterFootprint3("InitializeAccountEventData", (params) => InitializeAccountEventData.__tnInvokeFootprint(params));
|
|
6204
|
+
__tnRegisterValidate3("InitializeAccountEventData", (buffer, params) => InitializeAccountEventData.__tnInvokeValidate(buffer, params));
|
|
6205
|
+
__tnRegisterDynamicValidate3("InitializeAccountEventData", (buffer) => {
|
|
6206
|
+
const result = InitializeAccountEventData.validate(buffer);
|
|
6207
|
+
const params = result.params;
|
|
6208
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
6209
|
+
});
|
|
5054
6210
|
var __tn_ir_InitializeMintEventData = {
|
|
5055
6211
|
typeName: "InitializeMintEventData",
|
|
5056
6212
|
root: { op: "const", value: 115n }
|
|
@@ -5216,8 +6372,6 @@ var InitializeMintEventData = class _InitializeMintEventData {
|
|
|
5216
6372
|
return new _InitializeMintEventData(buffer);
|
|
5217
6373
|
}
|
|
5218
6374
|
};
|
|
5219
|
-
__tnRegisterFootprint3("InitializeMintEventData", (params) => InitializeMintEventData.__tnInvokeFootprint(params));
|
|
5220
|
-
__tnRegisterValidate3("InitializeMintEventData", (buffer, params) => InitializeMintEventData.__tnInvokeValidate(buffer, params));
|
|
5221
6375
|
var InitializeMintEventDataBuilder = class {
|
|
5222
6376
|
constructor() {
|
|
5223
6377
|
this.buffer = new Uint8Array(115);
|
|
@@ -5270,6 +6424,13 @@ var InitializeMintEventDataBuilder = class {
|
|
|
5270
6424
|
return view;
|
|
5271
6425
|
}
|
|
5272
6426
|
};
|
|
6427
|
+
__tnRegisterFootprint3("InitializeMintEventData", (params) => InitializeMintEventData.__tnInvokeFootprint(params));
|
|
6428
|
+
__tnRegisterValidate3("InitializeMintEventData", (buffer, params) => InitializeMintEventData.__tnInvokeValidate(buffer, params));
|
|
6429
|
+
__tnRegisterDynamicValidate3("InitializeMintEventData", (buffer) => {
|
|
6430
|
+
const result = InitializeMintEventData.validate(buffer);
|
|
6431
|
+
const params = result.params;
|
|
6432
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
6433
|
+
});
|
|
5273
6434
|
var __tn_ir_MintToEventData = {
|
|
5274
6435
|
typeName: "MintToEventData",
|
|
5275
6436
|
root: { op: "const", value: 120n }
|
|
@@ -5419,8 +6580,6 @@ var MintToEventData = class _MintToEventData {
|
|
|
5419
6580
|
return new _MintToEventData(buffer);
|
|
5420
6581
|
}
|
|
5421
6582
|
};
|
|
5422
|
-
__tnRegisterFootprint3("MintToEventData", (params) => MintToEventData.__tnInvokeFootprint(params));
|
|
5423
|
-
__tnRegisterValidate3("MintToEventData", (buffer, params) => MintToEventData.__tnInvokeValidate(buffer, params));
|
|
5424
6583
|
var MintToEventDataBuilder = class {
|
|
5425
6584
|
constructor() {
|
|
5426
6585
|
this.buffer = new Uint8Array(120);
|
|
@@ -5470,6 +6629,13 @@ var MintToEventDataBuilder = class {
|
|
|
5470
6629
|
return view;
|
|
5471
6630
|
}
|
|
5472
6631
|
};
|
|
6632
|
+
__tnRegisterFootprint3("MintToEventData", (params) => MintToEventData.__tnInvokeFootprint(params));
|
|
6633
|
+
__tnRegisterValidate3("MintToEventData", (buffer, params) => MintToEventData.__tnInvokeValidate(buffer, params));
|
|
6634
|
+
__tnRegisterDynamicValidate3("MintToEventData", (buffer) => {
|
|
6635
|
+
const result = MintToEventData.validate(buffer);
|
|
6636
|
+
const params = result.params;
|
|
6637
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
6638
|
+
});
|
|
5473
6639
|
var __tn_ir_TokenEvent = {
|
|
5474
6640
|
typeName: "TokenEvent",
|
|
5475
6641
|
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: "TokenEvent::payload.event_type", cases: [{ value: 0, node: { op: "align", alignment: 1, node: { op: "const", value: 115n } } }, { value: 1, node: { op: "align", alignment: 1, node: { op: "const", value: 96n } } }, { value: 2, node: { op: "align", alignment: 1, node: { op: "const", value: 88n } } }, { value: 3, node: { op: "align", alignment: 1, node: { op: "const", value: 120n } } }, { value: 4, node: { op: "align", alignment: 1, node: { op: "const", value: 120n } } }, { value: 5, node: { op: "align", alignment: 1, node: { op: "const", value: 96n } } }, { value: 6, node: { op: "align", alignment: 1, node: { op: "const", value: 96n } } }, { value: 7, node: { op: "align", alignment: 1, node: { op: "const", value: 96n } } }] } } } }
|
|
@@ -5566,13 +6732,8 @@ var _TokenEvent = class _TokenEvent {
|
|
|
5566
6732
|
return null;
|
|
5567
6733
|
}
|
|
5568
6734
|
const __tnParam_payload_event_type = __tnToBigInt3(view.getUint8(0));
|
|
5569
|
-
if (buffer.length < 1) {
|
|
5570
|
-
return null;
|
|
5571
|
-
}
|
|
5572
|
-
const __tnParam_TokenEvent__payload_event_type = __tnToBigInt3(view.getUint8(0));
|
|
5573
6735
|
const __tnExtractedParams = _TokenEvent.Params.fromValues({
|
|
5574
|
-
payload_event_type: __tnParam_payload_event_type
|
|
5575
|
-
TokenEvent__payload_event_type: __tnParam_TokenEvent__payload_event_type
|
|
6736
|
+
payload_event_type: __tnParam_payload_event_type
|
|
5576
6737
|
});
|
|
5577
6738
|
return { params: __tnExtractedParams, derived: null };
|
|
5578
6739
|
}
|
|
@@ -5616,17 +6777,16 @@ var _TokenEvent = class _TokenEvent {
|
|
|
5616
6777
|
static __tnInvokeValidate(buffer, __tnParams) {
|
|
5617
6778
|
return this.__tnValidateInternal(buffer, __tnParams);
|
|
5618
6779
|
}
|
|
5619
|
-
static footprintIr(payload_event_type
|
|
6780
|
+
static footprintIr(payload_event_type) {
|
|
5620
6781
|
const params = _TokenEvent.Params.fromValues({
|
|
5621
|
-
payload_event_type
|
|
5622
|
-
TokenEvent__payload_event_type
|
|
6782
|
+
payload_event_type
|
|
5623
6783
|
});
|
|
5624
6784
|
return this.footprintIrFromParams(params);
|
|
5625
6785
|
}
|
|
5626
6786
|
static __tnPackParams(params) {
|
|
5627
6787
|
const record = /* @__PURE__ */ Object.create(null);
|
|
5628
6788
|
record["payload.event_type"] = params.payload_event_type;
|
|
5629
|
-
record["TokenEvent::payload.event_type"] = params.
|
|
6789
|
+
record["TokenEvent::payload.event_type"] = params.payload_event_type;
|
|
5630
6790
|
return record;
|
|
5631
6791
|
}
|
|
5632
6792
|
static footprintIrFromParams(params) {
|
|
@@ -5747,16 +6907,12 @@ _TokenEvent.payloadVariantDescriptors = Object.freeze([
|
|
|
5747
6907
|
var TokenEvent = _TokenEvent;
|
|
5748
6908
|
((TokenEvent2) => {
|
|
5749
6909
|
TokenEvent2.ParamKeys = Object.freeze({
|
|
5750
|
-
payload_event_type: "payload.event_type"
|
|
5751
|
-
TokenEvent__payload_event_type: "TokenEvent::payload.event_type"
|
|
6910
|
+
payload_event_type: "payload.event_type"
|
|
5752
6911
|
});
|
|
5753
6912
|
TokenEvent2.Params = {
|
|
5754
6913
|
fromValues(input) {
|
|
5755
|
-
const payloadEventType = __tnToBigInt3(input.payload_event_type);
|
|
5756
|
-
const tokenEventPayloadType = input.TokenEvent__payload_event_type !== void 0 ? __tnToBigInt3(input.TokenEvent__payload_event_type) : payloadEventType;
|
|
5757
6914
|
return {
|
|
5758
|
-
payload_event_type:
|
|
5759
|
-
TokenEvent__payload_event_type: tokenEventPayloadType
|
|
6915
|
+
payload_event_type: __tnToBigInt3(input.payload_event_type)
|
|
5760
6916
|
};
|
|
5761
6917
|
},
|
|
5762
6918
|
fromBuilder(source) {
|
|
@@ -5774,8 +6930,6 @@ var TokenEvent = _TokenEvent;
|
|
|
5774
6930
|
}
|
|
5775
6931
|
TokenEvent2.params = params;
|
|
5776
6932
|
})(TokenEvent || (TokenEvent = {}));
|
|
5777
|
-
__tnRegisterFootprint3("TokenEvent", (params) => TokenEvent.__tnInvokeFootprint(params));
|
|
5778
|
-
__tnRegisterValidate3("TokenEvent", (buffer, params) => TokenEvent.__tnInvokeValidate(buffer, params));
|
|
5779
6933
|
var TokenEventBuilder = class {
|
|
5780
6934
|
constructor() {
|
|
5781
6935
|
this.__tnField_event_type = null;
|
|
@@ -5850,10 +7004,11 @@ var TokenEventBuilder = class {
|
|
|
5850
7004
|
}
|
|
5851
7005
|
__tnComputeParams() {
|
|
5852
7006
|
if (this.__tnCachedParams) return this.__tnCachedParams;
|
|
5853
|
-
const eventType = __tnToBigInt3(this.__tnPrefixView.getUint8(0));
|
|
5854
7007
|
const params = TokenEvent.Params.fromValues({
|
|
5855
|
-
payload_event_type:
|
|
5856
|
-
|
|
7008
|
+
payload_event_type: (() => {
|
|
7009
|
+
if (this.__tnField_event_type === null) throw new Error("TokenEventBuilder: missing enum tag");
|
|
7010
|
+
return __tnToBigInt3(this.__tnField_event_type);
|
|
7011
|
+
})()
|
|
5857
7012
|
});
|
|
5858
7013
|
this.__tnCachedParams = params;
|
|
5859
7014
|
return params;
|
|
@@ -5875,25 +7030,98 @@ var TokenEventBuilder = class {
|
|
|
5875
7030
|
this.__tnLastBuffer = buffer;
|
|
5876
7031
|
}
|
|
5877
7032
|
};
|
|
7033
|
+
__tnRegisterFootprint3("TokenEvent", (params) => TokenEvent.__tnInvokeFootprint(params));
|
|
7034
|
+
__tnRegisterValidate3("TokenEvent", (buffer, params) => TokenEvent.__tnInvokeValidate(buffer, params));
|
|
7035
|
+
__tnRegisterDynamicValidate3("TokenEvent", (buffer) => {
|
|
7036
|
+
const result = TokenEvent.validate(buffer);
|
|
7037
|
+
const params = result.params;
|
|
7038
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
7039
|
+
});
|
|
5878
7040
|
var __tn_ir_InitializeAccountInstruction = {
|
|
5879
7041
|
typeName: "InitializeAccountInstruction",
|
|
5880
7042
|
root: { op: "align", alignment: 1, node: { op: "add", left: { op: "add", left: { op: "add", left: { op: "add", left: { op: "align", alignment: 2, node: { op: "const", value: 2n } }, right: { op: "align", alignment: 2, node: { op: "const", value: 2n } } }, right: { op: "align", alignment: 2, node: { op: "const", value: 2n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 32n } } }, right: { op: "align", alignment: 1, node: { op: "call", typeName: "StateProof", args: [{ name: "proof_body.hdr.type_slot", source: "proof_body.hdr.type_slot" }, { name: "proof_body.payload_size", source: "proof_body.payload_size" }] } } } }
|
|
5881
7043
|
};
|
|
5882
7044
|
var InitializeAccountInstruction = class _InitializeAccountInstruction {
|
|
5883
|
-
constructor(buffer) {
|
|
7045
|
+
constructor(buffer, params) {
|
|
5884
7046
|
this.buffer = buffer;
|
|
5885
7047
|
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
7048
|
+
if (params) {
|
|
7049
|
+
this.__tnParams = params;
|
|
7050
|
+
} else {
|
|
7051
|
+
const derived = _InitializeAccountInstruction.__tnExtractParams(this.view, buffer);
|
|
7052
|
+
if (!derived) {
|
|
7053
|
+
throw new Error("InitializeAccountInstruction: failed to derive dynamic parameters");
|
|
7054
|
+
}
|
|
7055
|
+
this.__tnParams = derived.params;
|
|
7056
|
+
}
|
|
5886
7057
|
}
|
|
5887
7058
|
static __tnCreateView(buffer, opts) {
|
|
5888
7059
|
if (!buffer || buffer.length === void 0) throw new Error("InitializeAccountInstruction.__tnCreateView requires a Uint8Array");
|
|
5889
|
-
|
|
7060
|
+
let params = opts?.params ?? null;
|
|
7061
|
+
if (!params) {
|
|
7062
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
7063
|
+
const derived = _InitializeAccountInstruction.__tnExtractParams(view, buffer);
|
|
7064
|
+
if (!derived) throw new Error("InitializeAccountInstruction.__tnCreateView: failed to derive params");
|
|
7065
|
+
params = derived.params;
|
|
7066
|
+
}
|
|
7067
|
+
const instance = new _InitializeAccountInstruction(new Uint8Array(buffer), params);
|
|
7068
|
+
return instance;
|
|
7069
|
+
}
|
|
7070
|
+
dynamicParams() {
|
|
7071
|
+
return this.__tnParams;
|
|
5890
7072
|
}
|
|
5891
7073
|
static builder() {
|
|
5892
7074
|
return new InitializeAccountInstructionBuilder();
|
|
5893
7075
|
}
|
|
5894
7076
|
static fromBuilder(builder) {
|
|
5895
7077
|
const buffer = builder.build();
|
|
5896
|
-
|
|
7078
|
+
const params = builder.dynamicParams();
|
|
7079
|
+
return _InitializeAccountInstruction.from_array(buffer, { params });
|
|
7080
|
+
}
|
|
7081
|
+
static __tnComputeSequentialLayout(view, buffer) {
|
|
7082
|
+
const __tnLength = buffer.length;
|
|
7083
|
+
let __tnParamSeq_proof_body_hdr_type_slot = null;
|
|
7084
|
+
let __tnParamSeq_proof_body_payload_size = null;
|
|
7085
|
+
let __tnCursorMutable = 0;
|
|
7086
|
+
if (__tnCursorMutable + 2 > __tnLength) return null;
|
|
7087
|
+
view.getUint16(__tnCursorMutable, true);
|
|
7088
|
+
__tnCursorMutable += 2;
|
|
7089
|
+
if (__tnCursorMutable + 2 > __tnLength) return null;
|
|
7090
|
+
view.getUint16(__tnCursorMutable, true);
|
|
7091
|
+
__tnCursorMutable += 2;
|
|
7092
|
+
if (__tnCursorMutable + 2 > __tnLength) return null;
|
|
7093
|
+
view.getUint16(__tnCursorMutable, true);
|
|
7094
|
+
__tnCursorMutable += 2;
|
|
7095
|
+
if (__tnCursorMutable + 32 > __tnLength) return null;
|
|
7096
|
+
__tnCursorMutable += 32;
|
|
7097
|
+
const __tnTyperefResult_state_proof = __tnInvokeDynamicValidate3("StateProof", buffer.subarray(__tnCursorMutable));
|
|
7098
|
+
if (!__tnTyperefResult_state_proof.ok || __tnTyperefResult_state_proof.consumed === void 0) return null;
|
|
7099
|
+
const __tnTyperefParams_state_proof = __tnTyperefResult_state_proof.params ?? null;
|
|
7100
|
+
if (!__tnTyperefParams_state_proof || __tnTyperefParams_state_proof["proof_body_hdr_type_slot"] === void 0) return null;
|
|
7101
|
+
__tnParamSeq_proof_body_hdr_type_slot = __tnTyperefParams_state_proof["proof_body_hdr_type_slot"];
|
|
7102
|
+
if (!__tnTyperefParams_state_proof || __tnTyperefParams_state_proof["proof_body_payload_size"] === void 0) return null;
|
|
7103
|
+
__tnParamSeq_proof_body_payload_size = __tnTyperefParams_state_proof["proof_body_payload_size"];
|
|
7104
|
+
__tnCursorMutable += __tnBigIntToNumber3(__tnTyperefResult_state_proof.consumed, "InitializeAccountInstruction::state_proof");
|
|
7105
|
+
const params = /* @__PURE__ */ Object.create(null);
|
|
7106
|
+
if (__tnParamSeq_proof_body_hdr_type_slot === null) return null;
|
|
7107
|
+
params["proof_body_hdr_type_slot"] = __tnParamSeq_proof_body_hdr_type_slot;
|
|
7108
|
+
if (__tnParamSeq_proof_body_payload_size === null) return null;
|
|
7109
|
+
params["proof_body_payload_size"] = __tnParamSeq_proof_body_payload_size;
|
|
7110
|
+
return { params, offsets: null, derived: null };
|
|
7111
|
+
}
|
|
7112
|
+
static __tnExtractParams(view, buffer) {
|
|
7113
|
+
const __tnLayout = _InitializeAccountInstruction.__tnComputeSequentialLayout(view, buffer);
|
|
7114
|
+
if (!__tnLayout || !__tnLayout.params) return null;
|
|
7115
|
+
const __tnSeqParams = __tnLayout.params;
|
|
7116
|
+
const __tnParamSeq_proof_body_hdr_type_slot = __tnSeqParams["proof_body_hdr_type_slot"];
|
|
7117
|
+
if (__tnParamSeq_proof_body_hdr_type_slot === void 0) return null;
|
|
7118
|
+
const __tnParamSeq_proof_body_payload_size = __tnSeqParams["proof_body_payload_size"];
|
|
7119
|
+
if (__tnParamSeq_proof_body_payload_size === void 0) return null;
|
|
7120
|
+
const __tnExtractedParams = _InitializeAccountInstruction.Params.fromValues({
|
|
7121
|
+
proof_body_hdr_type_slot: __tnParamSeq_proof_body_hdr_type_slot,
|
|
7122
|
+
proof_body_payload_size: __tnParamSeq_proof_body_payload_size
|
|
7123
|
+
});
|
|
7124
|
+
return { params: __tnExtractedParams, derived: null };
|
|
5897
7125
|
}
|
|
5898
7126
|
get_token_account_index() {
|
|
5899
7127
|
const offset = 0;
|
|
@@ -5979,51 +7207,122 @@ var InitializeAccountInstruction = class _InitializeAccountInstruction {
|
|
|
5979
7207
|
static __tnFootprintInternal(__tnParams) {
|
|
5980
7208
|
return __tnEvalFootprint3(__tn_ir_InitializeAccountInstruction.root, { params: __tnParams });
|
|
5981
7209
|
}
|
|
5982
|
-
static __tnValidateInternal(buffer, __tnParams) {
|
|
5983
|
-
return __tnValidateIrTree3(__tn_ir_InitializeAccountInstruction, buffer, __tnParams);
|
|
7210
|
+
static __tnValidateInternal(buffer, __tnParams) {
|
|
7211
|
+
return __tnValidateIrTree3(__tn_ir_InitializeAccountInstruction, buffer, __tnParams);
|
|
7212
|
+
}
|
|
7213
|
+
static __tnInvokeFootprint(__tnParams) {
|
|
7214
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
7215
|
+
}
|
|
7216
|
+
static __tnInvokeValidate(buffer, __tnParams) {
|
|
7217
|
+
return this.__tnValidateInternal(buffer, __tnParams);
|
|
7218
|
+
}
|
|
7219
|
+
static footprintIr(proof_body_hdr_type_slot, proof_body_payload_size) {
|
|
7220
|
+
const params = _InitializeAccountInstruction.Params.fromValues({
|
|
7221
|
+
proof_body_hdr_type_slot,
|
|
7222
|
+
proof_body_payload_size
|
|
7223
|
+
});
|
|
7224
|
+
return this.footprintIrFromParams(params);
|
|
7225
|
+
}
|
|
7226
|
+
static __tnPackParams(params) {
|
|
7227
|
+
const record = /* @__PURE__ */ Object.create(null);
|
|
7228
|
+
record["proof_body.hdr.type_slot"] = params.proof_body_hdr_type_slot;
|
|
7229
|
+
record["proof_body.payload_size"] = params.proof_body_payload_size;
|
|
7230
|
+
return record;
|
|
5984
7231
|
}
|
|
5985
|
-
static
|
|
7232
|
+
static footprintIrFromParams(params) {
|
|
7233
|
+
const __tnParams = this.__tnPackParams(params);
|
|
5986
7234
|
return this.__tnFootprintInternal(__tnParams);
|
|
5987
7235
|
}
|
|
5988
|
-
static
|
|
5989
|
-
|
|
7236
|
+
static footprintFromParams(params) {
|
|
7237
|
+
const irResult = this.footprintIrFromParams(params);
|
|
7238
|
+
const maxSafe = __tnToBigInt3(Number.MAX_SAFE_INTEGER);
|
|
7239
|
+
if (__tnBigIntGreaterThan3(irResult, maxSafe)) throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for InitializeAccountInstruction");
|
|
7240
|
+
return __tnBigIntToNumber3(irResult, "InitializeAccountInstruction::footprintFromParams");
|
|
5990
7241
|
}
|
|
5991
|
-
static
|
|
5992
|
-
|
|
7242
|
+
static footprintFromValues(input) {
|
|
7243
|
+
const params = _InitializeAccountInstruction.params(input);
|
|
7244
|
+
return this.footprintFromParams(params);
|
|
5993
7245
|
}
|
|
5994
|
-
static footprint() {
|
|
5995
|
-
|
|
5996
|
-
const maxSafe = __tnToBigInt3(Number.MAX_SAFE_INTEGER);
|
|
5997
|
-
if (__tnBigIntGreaterThan3(irResult, maxSafe)) {
|
|
5998
|
-
throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for InitializeAccountInstruction");
|
|
5999
|
-
}
|
|
6000
|
-
return __tnBigIntToNumber3(irResult, "InitializeAccountInstruction::footprint");
|
|
7246
|
+
static footprint(params) {
|
|
7247
|
+
return this.footprintFromParams(params);
|
|
6001
7248
|
}
|
|
6002
|
-
static validate(
|
|
6003
|
-
|
|
6004
|
-
|
|
7249
|
+
static validate(buffer, opts) {
|
|
7250
|
+
if (!buffer || buffer.length === void 0) {
|
|
7251
|
+
return { ok: false, code: "tn.invalid_buffer" };
|
|
7252
|
+
}
|
|
7253
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
7254
|
+
let params = opts?.params ?? null;
|
|
7255
|
+
if (!params) {
|
|
7256
|
+
return { ok: false, code: "tn.param_extraction_failed" };
|
|
7257
|
+
}
|
|
7258
|
+
const __tnParamsRec = this.__tnPackParams(params);
|
|
7259
|
+
const irResult = this.__tnValidateInternal(buffer, __tnParamsRec);
|
|
7260
|
+
if (!irResult.ok) {
|
|
7261
|
+
return { ok: false, code: irResult.code, consumed: irResult.consumed ? __tnBigIntToNumber3(irResult.consumed, "InitializeAccountInstruction::validate") : void 0, params };
|
|
7262
|
+
}
|
|
7263
|
+
const consumed = irResult.consumed ? __tnBigIntToNumber3(irResult.consumed, "InitializeAccountInstruction::validate") : void 0;
|
|
7264
|
+
return { ok: true, consumed, params };
|
|
6005
7265
|
}
|
|
6006
|
-
static from_array(buffer) {
|
|
7266
|
+
static from_array(buffer, opts) {
|
|
6007
7267
|
if (!buffer || buffer.length === void 0) {
|
|
6008
7268
|
return null;
|
|
6009
7269
|
}
|
|
6010
7270
|
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
6011
|
-
|
|
7271
|
+
let params = opts?.params ?? null;
|
|
7272
|
+
if (!params) {
|
|
7273
|
+
__tnLogWarn3("InitializeAccountInstruction::from_array requires params when IR extraction is unavailable");
|
|
7274
|
+
return null;
|
|
7275
|
+
}
|
|
7276
|
+
const validation = this.validate(buffer, { params });
|
|
6012
7277
|
if (!validation.ok) {
|
|
6013
7278
|
return null;
|
|
6014
7279
|
}
|
|
6015
|
-
|
|
7280
|
+
const cached = validation.params ?? params;
|
|
7281
|
+
const state = new _InitializeAccountInstruction(buffer, cached);
|
|
7282
|
+
return state;
|
|
6016
7283
|
}
|
|
6017
7284
|
};
|
|
6018
|
-
|
|
6019
|
-
|
|
7285
|
+
((InitializeAccountInstruction2) => {
|
|
7286
|
+
InitializeAccountInstruction2.ParamKeys = Object.freeze({
|
|
7287
|
+
proof_body_hdr_type_slot: "proof_body.hdr.type_slot",
|
|
7288
|
+
proof_body_payload_size: "proof_body.payload_size"
|
|
7289
|
+
});
|
|
7290
|
+
InitializeAccountInstruction2.Params = {
|
|
7291
|
+
fromValues(input) {
|
|
7292
|
+
return {
|
|
7293
|
+
proof_body_hdr_type_slot: __tnToBigInt3(input.proof_body_hdr_type_slot),
|
|
7294
|
+
proof_body_payload_size: __tnToBigInt3(input.proof_body_payload_size)
|
|
7295
|
+
};
|
|
7296
|
+
},
|
|
7297
|
+
fromBuilder(source) {
|
|
7298
|
+
if (source.dynamicParams) {
|
|
7299
|
+
return source.dynamicParams();
|
|
7300
|
+
}
|
|
7301
|
+
if (source.params) {
|
|
7302
|
+
return source.params;
|
|
7303
|
+
}
|
|
7304
|
+
return source;
|
|
7305
|
+
}
|
|
7306
|
+
};
|
|
7307
|
+
function params(input) {
|
|
7308
|
+
return InitializeAccountInstruction2.Params.fromValues(input);
|
|
7309
|
+
}
|
|
7310
|
+
InitializeAccountInstruction2.params = params;
|
|
7311
|
+
})(InitializeAccountInstruction || (InitializeAccountInstruction = {}));
|
|
6020
7312
|
var InitializeAccountInstructionBuilder = class {
|
|
6021
7313
|
constructor() {
|
|
7314
|
+
this.__tnCachedParams = null;
|
|
7315
|
+
this.__tnLastBuffer = null;
|
|
7316
|
+
this.__tnLastParams = null;
|
|
6022
7317
|
this.__tnTail_state_proof = null;
|
|
7318
|
+
this.__tnTailParams_state_proof = null;
|
|
6023
7319
|
this.buffer = new Uint8Array(38);
|
|
6024
7320
|
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
6025
7321
|
}
|
|
6026
7322
|
__tnInvalidate() {
|
|
7323
|
+
this.__tnCachedParams = null;
|
|
7324
|
+
this.__tnLastBuffer = null;
|
|
7325
|
+
this.__tnLastParams = null;
|
|
6027
7326
|
}
|
|
6028
7327
|
set_token_account_index(value) {
|
|
6029
7328
|
this.view.setUint16(0, value, true);
|
|
@@ -6048,86 +7347,178 @@ var InitializeAccountInstructionBuilder = class {
|
|
|
6048
7347
|
}
|
|
6049
7348
|
set_state_proof(value) {
|
|
6050
7349
|
const bytes = __tnResolveStructFieldInput(value, "InitializeAccountInstructionBuilder::state_proof");
|
|
7350
|
+
const validation = __tnInvokeDynamicValidate3("StateProof", bytes);
|
|
7351
|
+
if (!validation.ok || validation.consumed === void 0) throw new Error("InitializeAccountInstructionBuilder: field 'state_proof' failed validation");
|
|
7352
|
+
if (__tnBigIntToNumber3(validation.consumed, "InitializeAccountInstructionBuilder::state_proof") !== bytes.length) throw new Error("InitializeAccountInstructionBuilder: field 'state_proof' validation did not consume the full buffer");
|
|
6051
7353
|
this.__tnTail_state_proof = bytes;
|
|
7354
|
+
this.__tnTailParams_state_proof = validation.params ?? null;
|
|
6052
7355
|
this.__tnInvalidate();
|
|
6053
7356
|
return this;
|
|
6054
7357
|
}
|
|
6055
7358
|
build() {
|
|
6056
|
-
const
|
|
6057
|
-
const size =
|
|
7359
|
+
const params = this.__tnComputeParams();
|
|
7360
|
+
const size = InitializeAccountInstruction.footprintFromParams(params);
|
|
6058
7361
|
const buffer = new Uint8Array(size);
|
|
6059
|
-
this.__tnWriteInto(buffer
|
|
6060
|
-
this.__tnValidateOrThrow(buffer);
|
|
7362
|
+
this.__tnWriteInto(buffer);
|
|
7363
|
+
this.__tnValidateOrThrow(buffer, params);
|
|
6061
7364
|
return buffer;
|
|
6062
7365
|
}
|
|
6063
7366
|
buildInto(target, offset = 0) {
|
|
6064
|
-
const
|
|
6065
|
-
const size =
|
|
7367
|
+
const params = this.__tnComputeParams();
|
|
7368
|
+
const size = InitializeAccountInstruction.footprintFromParams(params);
|
|
6066
7369
|
if (target.length - offset < size) throw new Error("InitializeAccountInstructionBuilder: target buffer too small");
|
|
6067
7370
|
const slice = target.subarray(offset, offset + size);
|
|
6068
|
-
this.__tnWriteInto(slice
|
|
6069
|
-
this.__tnValidateOrThrow(slice);
|
|
7371
|
+
this.__tnWriteInto(slice);
|
|
7372
|
+
this.__tnValidateOrThrow(slice, params);
|
|
6070
7373
|
return target;
|
|
6071
7374
|
}
|
|
6072
7375
|
finish() {
|
|
6073
7376
|
const buffer = this.build();
|
|
6074
|
-
const
|
|
7377
|
+
const params = this.__tnLastParams ?? this.__tnComputeParams();
|
|
7378
|
+
const view = InitializeAccountInstruction.from_array(buffer, { params });
|
|
6075
7379
|
if (!view) throw new Error("InitializeAccountInstructionBuilder: failed to finalize view");
|
|
6076
7380
|
return view;
|
|
6077
7381
|
}
|
|
6078
7382
|
finishView() {
|
|
6079
7383
|
return this.finish();
|
|
6080
7384
|
}
|
|
6081
|
-
|
|
6082
|
-
return
|
|
6083
|
-
(() => {
|
|
6084
|
-
const bytes = this.__tnTail_state_proof;
|
|
6085
|
-
if (!bytes) throw new Error("InitializeAccountInstructionBuilder: field 'state_proof' must be set before build()");
|
|
6086
|
-
return bytes;
|
|
6087
|
-
})()
|
|
6088
|
-
];
|
|
7385
|
+
dynamicParams() {
|
|
7386
|
+
return this.__tnComputeParams();
|
|
6089
7387
|
}
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
7388
|
+
__tnComputeParams() {
|
|
7389
|
+
if (this.__tnCachedParams) return this.__tnCachedParams;
|
|
7390
|
+
const params = InitializeAccountInstruction.Params.fromValues({
|
|
7391
|
+
proof_body_hdr_type_slot: (() => {
|
|
7392
|
+
const params2 = this.__tnTailParams_state_proof;
|
|
7393
|
+
if (!params2 || params2["proof_body_hdr_type_slot"] === void 0) throw new Error("InitializeAccountInstructionBuilder: field 'state_proof' must be written before computing params");
|
|
7394
|
+
return params2["proof_body_hdr_type_slot"];
|
|
7395
|
+
})(),
|
|
7396
|
+
proof_body_payload_size: (() => {
|
|
7397
|
+
const params2 = this.__tnTailParams_state_proof;
|
|
7398
|
+
if (!params2 || params2["proof_body_payload_size"] === void 0) throw new Error("InitializeAccountInstructionBuilder: field 'state_proof' must be written before computing params");
|
|
7399
|
+
return params2["proof_body_payload_size"];
|
|
7400
|
+
})()
|
|
7401
|
+
});
|
|
7402
|
+
this.__tnCachedParams = params;
|
|
7403
|
+
return params;
|
|
6096
7404
|
}
|
|
6097
|
-
__tnWriteInto(target
|
|
7405
|
+
__tnWriteInto(target) {
|
|
6098
7406
|
target.set(this.buffer, 0);
|
|
6099
7407
|
let cursor = this.buffer.length;
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
7408
|
+
const __tnLocal_state_proof_bytes = this.__tnTail_state_proof;
|
|
7409
|
+
if (!__tnLocal_state_proof_bytes) throw new Error("InitializeAccountInstructionBuilder: field 'state_proof' must be written before build");
|
|
7410
|
+
target.set(__tnLocal_state_proof_bytes, cursor);
|
|
7411
|
+
cursor += __tnLocal_state_proof_bytes.length;
|
|
6104
7412
|
}
|
|
6105
|
-
__tnValidateOrThrow(buffer) {
|
|
6106
|
-
const result = InitializeAccountInstruction.validate(buffer);
|
|
7413
|
+
__tnValidateOrThrow(buffer, params) {
|
|
7414
|
+
const result = InitializeAccountInstruction.validate(buffer, { params });
|
|
6107
7415
|
if (!result.ok) {
|
|
6108
|
-
throw new Error(
|
|
7416
|
+
throw new Error(`${InitializeAccountInstruction}Builder: builder produced invalid buffer (code=${result.code ?? "unknown"})`);
|
|
6109
7417
|
}
|
|
7418
|
+
this.__tnLastParams = result.params ?? params;
|
|
7419
|
+
this.__tnLastBuffer = buffer;
|
|
6110
7420
|
}
|
|
6111
7421
|
};
|
|
7422
|
+
__tnRegisterFootprint3("InitializeAccountInstruction", (params) => InitializeAccountInstruction.__tnInvokeFootprint(params));
|
|
7423
|
+
__tnRegisterValidate3("InitializeAccountInstruction", (buffer, params) => InitializeAccountInstruction.__tnInvokeValidate(buffer, params));
|
|
7424
|
+
__tnRegisterDynamicValidate3("InitializeAccountInstruction", (buffer) => {
|
|
7425
|
+
const result = InitializeAccountInstruction.validate(buffer);
|
|
7426
|
+
const params = result.params;
|
|
7427
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
7428
|
+
});
|
|
6112
7429
|
var __tn_ir_InitializeMintInstruction = {
|
|
6113
7430
|
typeName: "InitializeMintInstruction",
|
|
6114
7431
|
root: { op: "align", alignment: 1, node: { op: "add", left: { op: "add", left: { op: "add", left: { op: "add", left: { op: "add", left: { op: "add", left: { op: "add", left: { op: "add", left: { op: "align", alignment: 2, node: { op: "const", value: 2n } }, right: { op: "align", alignment: 1, node: { op: "const", value: 1n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 32n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 32n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 32n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 1n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 9n } } }, right: { op: "align", alignment: 1, node: { op: "const", value: 32n } } }, right: { op: "align", alignment: 1, node: { op: "call", typeName: "StateProof", args: [{ name: "proof_body.hdr.type_slot", source: "proof_body.hdr.type_slot" }, { name: "proof_body.payload_size", source: "proof_body.payload_size" }] } } } }
|
|
6115
7432
|
};
|
|
6116
7433
|
var InitializeMintInstruction = class _InitializeMintInstruction {
|
|
6117
|
-
constructor(buffer) {
|
|
7434
|
+
constructor(buffer, params) {
|
|
6118
7435
|
this.buffer = buffer;
|
|
6119
7436
|
this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
7437
|
+
if (params) {
|
|
7438
|
+
this.__tnParams = params;
|
|
7439
|
+
} else {
|
|
7440
|
+
const derived = _InitializeMintInstruction.__tnExtractParams(this.view, buffer);
|
|
7441
|
+
if (!derived) {
|
|
7442
|
+
throw new Error("InitializeMintInstruction: failed to derive dynamic parameters");
|
|
7443
|
+
}
|
|
7444
|
+
this.__tnParams = derived.params;
|
|
7445
|
+
}
|
|
6120
7446
|
}
|
|
6121
7447
|
static __tnCreateView(buffer, opts) {
|
|
6122
7448
|
if (!buffer || buffer.length === void 0) throw new Error("InitializeMintInstruction.__tnCreateView requires a Uint8Array");
|
|
6123
|
-
|
|
7449
|
+
let params = opts?.params ?? null;
|
|
7450
|
+
if (!params) {
|
|
7451
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
7452
|
+
const derived = _InitializeMintInstruction.__tnExtractParams(view, buffer);
|
|
7453
|
+
if (!derived) throw new Error("InitializeMintInstruction.__tnCreateView: failed to derive params");
|
|
7454
|
+
params = derived.params;
|
|
7455
|
+
}
|
|
7456
|
+
const instance = new _InitializeMintInstruction(new Uint8Array(buffer), params);
|
|
7457
|
+
return instance;
|
|
7458
|
+
}
|
|
7459
|
+
dynamicParams() {
|
|
7460
|
+
return this.__tnParams;
|
|
6124
7461
|
}
|
|
6125
7462
|
static builder() {
|
|
6126
7463
|
return new InitializeMintInstructionBuilder();
|
|
6127
7464
|
}
|
|
6128
7465
|
static fromBuilder(builder) {
|
|
6129
7466
|
const buffer = builder.build();
|
|
6130
|
-
|
|
7467
|
+
const params = builder.dynamicParams();
|
|
7468
|
+
return _InitializeMintInstruction.from_array(buffer, { params });
|
|
7469
|
+
}
|
|
7470
|
+
static __tnComputeSequentialLayout(view, buffer) {
|
|
7471
|
+
const __tnLength = buffer.length;
|
|
7472
|
+
let __tnParamSeq_proof_body_hdr_type_slot = null;
|
|
7473
|
+
let __tnParamSeq_proof_body_payload_size = null;
|
|
7474
|
+
let __tnCursorMutable = 0;
|
|
7475
|
+
if (__tnCursorMutable + 2 > __tnLength) return null;
|
|
7476
|
+
view.getUint16(__tnCursorMutable, true);
|
|
7477
|
+
__tnCursorMutable += 2;
|
|
7478
|
+
if (__tnCursorMutable + 1 > __tnLength) return null;
|
|
7479
|
+
view.getUint8(__tnCursorMutable);
|
|
7480
|
+
__tnCursorMutable += 1;
|
|
7481
|
+
if (__tnCursorMutable + 32 > __tnLength) return null;
|
|
7482
|
+
__tnCursorMutable += 32;
|
|
7483
|
+
if (__tnCursorMutable + 32 > __tnLength) return null;
|
|
7484
|
+
__tnCursorMutable += 32;
|
|
7485
|
+
if (__tnCursorMutable + 32 > __tnLength) return null;
|
|
7486
|
+
__tnCursorMutable += 32;
|
|
7487
|
+
if (__tnCursorMutable + 1 > __tnLength) return null;
|
|
7488
|
+
view.getUint8(__tnCursorMutable);
|
|
7489
|
+
__tnCursorMutable += 1;
|
|
7490
|
+
if (__tnCursorMutable + 9 > __tnLength) return null;
|
|
7491
|
+
__tnCursorMutable += 9;
|
|
7492
|
+
if (__tnCursorMutable + 32 > __tnLength) return null;
|
|
7493
|
+
__tnCursorMutable += 32;
|
|
7494
|
+
const __tnTyperefResult_state_proof = __tnInvokeDynamicValidate3("StateProof", buffer.subarray(__tnCursorMutable));
|
|
7495
|
+
if (!__tnTyperefResult_state_proof.ok || __tnTyperefResult_state_proof.consumed === void 0) return null;
|
|
7496
|
+
const __tnTyperefParams_state_proof = __tnTyperefResult_state_proof.params ?? null;
|
|
7497
|
+
if (!__tnTyperefParams_state_proof || __tnTyperefParams_state_proof["proof_body_hdr_type_slot"] === void 0) return null;
|
|
7498
|
+
__tnParamSeq_proof_body_hdr_type_slot = __tnTyperefParams_state_proof["proof_body_hdr_type_slot"];
|
|
7499
|
+
if (!__tnTyperefParams_state_proof || __tnTyperefParams_state_proof["proof_body_payload_size"] === void 0) return null;
|
|
7500
|
+
__tnParamSeq_proof_body_payload_size = __tnTyperefParams_state_proof["proof_body_payload_size"];
|
|
7501
|
+
__tnCursorMutable += __tnBigIntToNumber3(__tnTyperefResult_state_proof.consumed, "InitializeMintInstruction::state_proof");
|
|
7502
|
+
const params = /* @__PURE__ */ Object.create(null);
|
|
7503
|
+
if (__tnParamSeq_proof_body_hdr_type_slot === null) return null;
|
|
7504
|
+
params["proof_body_hdr_type_slot"] = __tnParamSeq_proof_body_hdr_type_slot;
|
|
7505
|
+
if (__tnParamSeq_proof_body_payload_size === null) return null;
|
|
7506
|
+
params["proof_body_payload_size"] = __tnParamSeq_proof_body_payload_size;
|
|
7507
|
+
return { params, offsets: null, derived: null };
|
|
7508
|
+
}
|
|
7509
|
+
static __tnExtractParams(view, buffer) {
|
|
7510
|
+
const __tnLayout = _InitializeMintInstruction.__tnComputeSequentialLayout(view, buffer);
|
|
7511
|
+
if (!__tnLayout || !__tnLayout.params) return null;
|
|
7512
|
+
const __tnSeqParams = __tnLayout.params;
|
|
7513
|
+
const __tnParamSeq_proof_body_hdr_type_slot = __tnSeqParams["proof_body_hdr_type_slot"];
|
|
7514
|
+
if (__tnParamSeq_proof_body_hdr_type_slot === void 0) return null;
|
|
7515
|
+
const __tnParamSeq_proof_body_payload_size = __tnSeqParams["proof_body_payload_size"];
|
|
7516
|
+
if (__tnParamSeq_proof_body_payload_size === void 0) return null;
|
|
7517
|
+
const __tnExtractedParams = _InitializeMintInstruction.Params.fromValues({
|
|
7518
|
+
proof_body_hdr_type_slot: __tnParamSeq_proof_body_hdr_type_slot,
|
|
7519
|
+
proof_body_payload_size: __tnParamSeq_proof_body_payload_size
|
|
7520
|
+
});
|
|
7521
|
+
return { params: __tnExtractedParams, derived: null };
|
|
6131
7522
|
}
|
|
6132
7523
|
get_mint_account_index() {
|
|
6133
7524
|
const offset = 0;
|
|
@@ -6286,42 +7677,113 @@ var InitializeMintInstruction = class _InitializeMintInstruction {
|
|
|
6286
7677
|
static __tnInvokeValidate(buffer, __tnParams) {
|
|
6287
7678
|
return this.__tnValidateInternal(buffer, __tnParams);
|
|
6288
7679
|
}
|
|
6289
|
-
static footprintIr() {
|
|
6290
|
-
|
|
7680
|
+
static footprintIr(proof_body_hdr_type_slot, proof_body_payload_size) {
|
|
7681
|
+
const params = _InitializeMintInstruction.Params.fromValues({
|
|
7682
|
+
proof_body_hdr_type_slot,
|
|
7683
|
+
proof_body_payload_size
|
|
7684
|
+
});
|
|
7685
|
+
return this.footprintIrFromParams(params);
|
|
6291
7686
|
}
|
|
6292
|
-
static
|
|
6293
|
-
const
|
|
7687
|
+
static __tnPackParams(params) {
|
|
7688
|
+
const record = /* @__PURE__ */ Object.create(null);
|
|
7689
|
+
record["proof_body.hdr.type_slot"] = params.proof_body_hdr_type_slot;
|
|
7690
|
+
record["proof_body.payload_size"] = params.proof_body_payload_size;
|
|
7691
|
+
return record;
|
|
7692
|
+
}
|
|
7693
|
+
static footprintIrFromParams(params) {
|
|
7694
|
+
const __tnParams = this.__tnPackParams(params);
|
|
7695
|
+
return this.__tnFootprintInternal(__tnParams);
|
|
7696
|
+
}
|
|
7697
|
+
static footprintFromParams(params) {
|
|
7698
|
+
const irResult = this.footprintIrFromParams(params);
|
|
6294
7699
|
const maxSafe = __tnToBigInt3(Number.MAX_SAFE_INTEGER);
|
|
6295
|
-
if (__tnBigIntGreaterThan3(irResult, maxSafe))
|
|
6296
|
-
|
|
6297
|
-
}
|
|
6298
|
-
return __tnBigIntToNumber3(irResult, "InitializeMintInstruction::footprint");
|
|
7700
|
+
if (__tnBigIntGreaterThan3(irResult, maxSafe)) throw new Error("footprint exceeds Number.MAX_SAFE_INTEGER for InitializeMintInstruction");
|
|
7701
|
+
return __tnBigIntToNumber3(irResult, "InitializeMintInstruction::footprintFromParams");
|
|
6299
7702
|
}
|
|
6300
|
-
static
|
|
6301
|
-
|
|
6302
|
-
return
|
|
7703
|
+
static footprintFromValues(input) {
|
|
7704
|
+
const params = _InitializeMintInstruction.params(input);
|
|
7705
|
+
return this.footprintFromParams(params);
|
|
6303
7706
|
}
|
|
6304
|
-
static
|
|
7707
|
+
static footprint(params) {
|
|
7708
|
+
return this.footprintFromParams(params);
|
|
7709
|
+
}
|
|
7710
|
+
static validate(buffer, opts) {
|
|
7711
|
+
if (!buffer || buffer.length === void 0) {
|
|
7712
|
+
return { ok: false, code: "tn.invalid_buffer" };
|
|
7713
|
+
}
|
|
7714
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
7715
|
+
let params = opts?.params ?? null;
|
|
7716
|
+
if (!params) {
|
|
7717
|
+
return { ok: false, code: "tn.param_extraction_failed" };
|
|
7718
|
+
}
|
|
7719
|
+
const __tnParamsRec = this.__tnPackParams(params);
|
|
7720
|
+
const irResult = this.__tnValidateInternal(buffer, __tnParamsRec);
|
|
7721
|
+
if (!irResult.ok) {
|
|
7722
|
+
return { ok: false, code: irResult.code, consumed: irResult.consumed ? __tnBigIntToNumber3(irResult.consumed, "InitializeMintInstruction::validate") : void 0, params };
|
|
7723
|
+
}
|
|
7724
|
+
const consumed = irResult.consumed ? __tnBigIntToNumber3(irResult.consumed, "InitializeMintInstruction::validate") : void 0;
|
|
7725
|
+
return { ok: true, consumed, params };
|
|
7726
|
+
}
|
|
7727
|
+
static from_array(buffer, opts) {
|
|
6305
7728
|
if (!buffer || buffer.length === void 0) {
|
|
6306
7729
|
return null;
|
|
6307
7730
|
}
|
|
6308
7731
|
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
6309
|
-
|
|
7732
|
+
let params = opts?.params ?? null;
|
|
7733
|
+
if (!params) {
|
|
7734
|
+
__tnLogWarn3("InitializeMintInstruction::from_array requires params when IR extraction is unavailable");
|
|
7735
|
+
return null;
|
|
7736
|
+
}
|
|
7737
|
+
const validation = this.validate(buffer, { params });
|
|
6310
7738
|
if (!validation.ok) {
|
|
6311
7739
|
return null;
|
|
6312
7740
|
}
|
|
6313
|
-
|
|
7741
|
+
const cached = validation.params ?? params;
|
|
7742
|
+
const state = new _InitializeMintInstruction(buffer, cached);
|
|
7743
|
+
return state;
|
|
6314
7744
|
}
|
|
6315
7745
|
};
|
|
6316
|
-
|
|
6317
|
-
|
|
7746
|
+
((InitializeMintInstruction2) => {
|
|
7747
|
+
InitializeMintInstruction2.ParamKeys = Object.freeze({
|
|
7748
|
+
proof_body_hdr_type_slot: "proof_body.hdr.type_slot",
|
|
7749
|
+
proof_body_payload_size: "proof_body.payload_size"
|
|
7750
|
+
});
|
|
7751
|
+
InitializeMintInstruction2.Params = {
|
|
7752
|
+
fromValues(input) {
|
|
7753
|
+
return {
|
|
7754
|
+
proof_body_hdr_type_slot: __tnToBigInt3(input.proof_body_hdr_type_slot),
|
|
7755
|
+
proof_body_payload_size: __tnToBigInt3(input.proof_body_payload_size)
|
|
7756
|
+
};
|
|
7757
|
+
},
|
|
7758
|
+
fromBuilder(source) {
|
|
7759
|
+
if (source.dynamicParams) {
|
|
7760
|
+
return source.dynamicParams();
|
|
7761
|
+
}
|
|
7762
|
+
if (source.params) {
|
|
7763
|
+
return source.params;
|
|
7764
|
+
}
|
|
7765
|
+
return source;
|
|
7766
|
+
}
|
|
7767
|
+
};
|
|
7768
|
+
function params(input) {
|
|
7769
|
+
return InitializeMintInstruction2.Params.fromValues(input);
|
|
7770
|
+
}
|
|
7771
|
+
InitializeMintInstruction2.params = params;
|
|
7772
|
+
})(InitializeMintInstruction || (InitializeMintInstruction = {}));
|
|
6318
7773
|
var InitializeMintInstructionBuilder = class {
|
|
6319
7774
|
constructor() {
|
|
7775
|
+
this.__tnCachedParams = null;
|
|
7776
|
+
this.__tnLastBuffer = null;
|
|
7777
|
+
this.__tnLastParams = null;
|
|
6320
7778
|
this.__tnTail_state_proof = null;
|
|
7779
|
+
this.__tnTailParams_state_proof = null;
|
|
6321
7780
|
this.buffer = new Uint8Array(141);
|
|
6322
7781
|
this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
6323
7782
|
}
|
|
6324
7783
|
__tnInvalidate() {
|
|
7784
|
+
this.__tnCachedParams = null;
|
|
7785
|
+
this.__tnLastBuffer = null;
|
|
7786
|
+
this.__tnLastParams = null;
|
|
6325
7787
|
}
|
|
6326
7788
|
set_mint_account_index(value) {
|
|
6327
7789
|
this.view.setUint16(0, value, true);
|
|
@@ -6370,67 +7832,85 @@ var InitializeMintInstructionBuilder = class {
|
|
|
6370
7832
|
}
|
|
6371
7833
|
set_state_proof(value) {
|
|
6372
7834
|
const bytes = __tnResolveStructFieldInput(value, "InitializeMintInstructionBuilder::state_proof");
|
|
7835
|
+
const validation = __tnInvokeDynamicValidate3("StateProof", bytes);
|
|
7836
|
+
if (!validation.ok || validation.consumed === void 0) throw new Error("InitializeMintInstructionBuilder: field 'state_proof' failed validation");
|
|
7837
|
+
if (__tnBigIntToNumber3(validation.consumed, "InitializeMintInstructionBuilder::state_proof") !== bytes.length) throw new Error("InitializeMintInstructionBuilder: field 'state_proof' validation did not consume the full buffer");
|
|
6373
7838
|
this.__tnTail_state_proof = bytes;
|
|
7839
|
+
this.__tnTailParams_state_proof = validation.params ?? null;
|
|
6374
7840
|
this.__tnInvalidate();
|
|
6375
7841
|
return this;
|
|
6376
7842
|
}
|
|
6377
7843
|
build() {
|
|
6378
|
-
const
|
|
6379
|
-
const size =
|
|
7844
|
+
const params = this.__tnComputeParams();
|
|
7845
|
+
const size = InitializeMintInstruction.footprintFromParams(params);
|
|
6380
7846
|
const buffer = new Uint8Array(size);
|
|
6381
|
-
this.__tnWriteInto(buffer
|
|
6382
|
-
this.__tnValidateOrThrow(buffer);
|
|
7847
|
+
this.__tnWriteInto(buffer);
|
|
7848
|
+
this.__tnValidateOrThrow(buffer, params);
|
|
6383
7849
|
return buffer;
|
|
6384
7850
|
}
|
|
6385
7851
|
buildInto(target, offset = 0) {
|
|
6386
|
-
const
|
|
6387
|
-
const size =
|
|
7852
|
+
const params = this.__tnComputeParams();
|
|
7853
|
+
const size = InitializeMintInstruction.footprintFromParams(params);
|
|
6388
7854
|
if (target.length - offset < size) throw new Error("InitializeMintInstructionBuilder: target buffer too small");
|
|
6389
7855
|
const slice = target.subarray(offset, offset + size);
|
|
6390
|
-
this.__tnWriteInto(slice
|
|
6391
|
-
this.__tnValidateOrThrow(slice);
|
|
7856
|
+
this.__tnWriteInto(slice);
|
|
7857
|
+
this.__tnValidateOrThrow(slice, params);
|
|
6392
7858
|
return target;
|
|
6393
7859
|
}
|
|
6394
7860
|
finish() {
|
|
6395
7861
|
const buffer = this.build();
|
|
6396
|
-
const
|
|
7862
|
+
const params = this.__tnLastParams ?? this.__tnComputeParams();
|
|
7863
|
+
const view = InitializeMintInstruction.from_array(buffer, { params });
|
|
6397
7864
|
if (!view) throw new Error("InitializeMintInstructionBuilder: failed to finalize view");
|
|
6398
7865
|
return view;
|
|
6399
7866
|
}
|
|
6400
7867
|
finishView() {
|
|
6401
7868
|
return this.finish();
|
|
6402
7869
|
}
|
|
6403
|
-
|
|
6404
|
-
return
|
|
6405
|
-
(() => {
|
|
6406
|
-
const bytes = this.__tnTail_state_proof;
|
|
6407
|
-
if (!bytes) throw new Error("InitializeMintInstructionBuilder: field 'state_proof' must be set before build()");
|
|
6408
|
-
return bytes;
|
|
6409
|
-
})()
|
|
6410
|
-
];
|
|
7870
|
+
dynamicParams() {
|
|
7871
|
+
return this.__tnComputeParams();
|
|
6411
7872
|
}
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
7873
|
+
__tnComputeParams() {
|
|
7874
|
+
if (this.__tnCachedParams) return this.__tnCachedParams;
|
|
7875
|
+
const params = InitializeMintInstruction.Params.fromValues({
|
|
7876
|
+
proof_body_hdr_type_slot: (() => {
|
|
7877
|
+
const params2 = this.__tnTailParams_state_proof;
|
|
7878
|
+
if (!params2 || params2["proof_body_hdr_type_slot"] === void 0) throw new Error("InitializeMintInstructionBuilder: field 'state_proof' must be written before computing params");
|
|
7879
|
+
return params2["proof_body_hdr_type_slot"];
|
|
7880
|
+
})(),
|
|
7881
|
+
proof_body_payload_size: (() => {
|
|
7882
|
+
const params2 = this.__tnTailParams_state_proof;
|
|
7883
|
+
if (!params2 || params2["proof_body_payload_size"] === void 0) throw new Error("InitializeMintInstructionBuilder: field 'state_proof' must be written before computing params");
|
|
7884
|
+
return params2["proof_body_payload_size"];
|
|
7885
|
+
})()
|
|
7886
|
+
});
|
|
7887
|
+
this.__tnCachedParams = params;
|
|
7888
|
+
return params;
|
|
6418
7889
|
}
|
|
6419
|
-
__tnWriteInto(target
|
|
7890
|
+
__tnWriteInto(target) {
|
|
6420
7891
|
target.set(this.buffer, 0);
|
|
6421
7892
|
let cursor = this.buffer.length;
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
7893
|
+
const __tnLocal_state_proof_bytes = this.__tnTail_state_proof;
|
|
7894
|
+
if (!__tnLocal_state_proof_bytes) throw new Error("InitializeMintInstructionBuilder: field 'state_proof' must be written before build");
|
|
7895
|
+
target.set(__tnLocal_state_proof_bytes, cursor);
|
|
7896
|
+
cursor += __tnLocal_state_proof_bytes.length;
|
|
6426
7897
|
}
|
|
6427
|
-
__tnValidateOrThrow(buffer) {
|
|
6428
|
-
const result = InitializeMintInstruction.validate(buffer);
|
|
7898
|
+
__tnValidateOrThrow(buffer, params) {
|
|
7899
|
+
const result = InitializeMintInstruction.validate(buffer, { params });
|
|
6429
7900
|
if (!result.ok) {
|
|
6430
|
-
throw new Error(
|
|
7901
|
+
throw new Error(`${InitializeMintInstruction}Builder: builder produced invalid buffer (code=${result.code ?? "unknown"})`);
|
|
6431
7902
|
}
|
|
7903
|
+
this.__tnLastParams = result.params ?? params;
|
|
7904
|
+
this.__tnLastBuffer = buffer;
|
|
6432
7905
|
}
|
|
6433
7906
|
};
|
|
7907
|
+
__tnRegisterFootprint3("InitializeMintInstruction", (params) => InitializeMintInstruction.__tnInvokeFootprint(params));
|
|
7908
|
+
__tnRegisterValidate3("InitializeMintInstruction", (buffer, params) => InitializeMintInstruction.__tnInvokeValidate(buffer, params));
|
|
7909
|
+
__tnRegisterDynamicValidate3("InitializeMintInstruction", (buffer) => {
|
|
7910
|
+
const result = InitializeMintInstruction.validate(buffer);
|
|
7911
|
+
const params = result.params;
|
|
7912
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
7913
|
+
});
|
|
6434
7914
|
var __tn_ir_TokenInstruction = {
|
|
6435
7915
|
typeName: "TokenInstruction",
|
|
6436
7916
|
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: "field", param: "payload.payload_size" } } } }
|
|
@@ -6775,8 +8255,6 @@ var TokenInstruction = _TokenInstruction;
|
|
|
6775
8255
|
}
|
|
6776
8256
|
TokenInstruction3.params = params;
|
|
6777
8257
|
})(TokenInstruction || (TokenInstruction = {}));
|
|
6778
|
-
__tnRegisterFootprint3("TokenInstruction", (params) => TokenInstruction.__tnInvokeFootprint(params));
|
|
6779
|
-
__tnRegisterValidate3("TokenInstruction", (buffer, params) => TokenInstruction.__tnInvokeValidate(buffer, params));
|
|
6780
8258
|
var TokenInstructionBuilder = class {
|
|
6781
8259
|
constructor() {
|
|
6782
8260
|
this.__tnField_tag = null;
|
|
@@ -6881,6 +8359,13 @@ var TokenInstructionBuilder = class {
|
|
|
6881
8359
|
this.__tnLastBuffer = buffer;
|
|
6882
8360
|
}
|
|
6883
8361
|
};
|
|
8362
|
+
__tnRegisterFootprint3("TokenInstruction", (params) => TokenInstruction.__tnInvokeFootprint(params));
|
|
8363
|
+
__tnRegisterValidate3("TokenInstruction", (buffer, params) => TokenInstruction.__tnInvokeValidate(buffer, params));
|
|
8364
|
+
__tnRegisterDynamicValidate3("TokenInstruction", (buffer) => {
|
|
8365
|
+
const result = TokenInstruction.validate(buffer);
|
|
8366
|
+
const params = result.params;
|
|
8367
|
+
return { ok: result.ok, code: result.code, consumed: result.consumed === void 0 ? void 0 : __tnToBigInt3(result.consumed), params };
|
|
8368
|
+
});
|
|
6884
8369
|
|
|
6885
8370
|
// src/token/instructions/shared.ts
|
|
6886
8371
|
function buildTokenInstructionBytes(variant, payload) {
|