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