@thru/programs 0.2.27 → 0.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/multicall/index.cjs +166 -24
  2. package/dist/multicall/index.cjs.map +1 -1
  3. package/dist/multicall/index.d.cts +39 -3
  4. package/dist/multicall/index.d.ts +39 -3
  5. package/dist/multicall/index.js +166 -25
  6. package/dist/multicall/index.js.map +1 -1
  7. package/dist/passkey-manager/index.cjs +1235 -345
  8. package/dist/passkey-manager/index.cjs.map +1 -1
  9. package/dist/passkey-manager/index.d.cts +45 -11
  10. package/dist/passkey-manager/index.d.ts +45 -11
  11. package/dist/passkey-manager/index.js +1225 -346
  12. package/dist/passkey-manager/index.js.map +1 -1
  13. package/package.json +2 -2
  14. package/src/multicall/abi/thru/common/primitives/types.ts +14 -9
  15. package/src/multicall/abi/thru/program/multicall/types.ts +136 -4
  16. package/src/multicall/index.ts +6 -17
  17. package/src/passkey-manager/abi/thru/blockchain/state_proof/types.ts +11 -6
  18. package/src/passkey-manager/abi/thru/common/primitives/types.ts +19 -14
  19. package/src/passkey-manager/abi/thru/program/passkey_manager/types.ts +1069 -271
  20. package/src/passkey-manager/accounts.ts +79 -40
  21. package/src/passkey-manager/constants.ts +10 -1
  22. package/src/passkey-manager/index.ts +18 -2
  23. package/src/passkey-manager/instructions/add-authority.ts +31 -3
  24. package/src/passkey-manager/instructions/create.ts +106 -11
  25. package/src/passkey-manager/instructions/invoke.ts +9 -0
  26. package/src/passkey-manager/instructions/shared.ts +15 -0
  27. package/src/passkey-manager/instructions/transfer.ts +1 -1
  28. package/src/passkey-manager/instructions/validate.ts +13 -43
  29. package/src/passkey-manager/types.ts +7 -2
  30. package/src/passkey-manager/validate.test.ts +71 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thru/programs",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./token": {
@@ -20,7 +20,7 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@thru/sdk": "0.2.27"
23
+ "@thru/sdk": "0.2.29"
24
24
  },
25
25
  "devDependencies": {
26
26
  "tsup": "^8.5.1",
@@ -44,7 +44,12 @@ type __TnIrContext = {
44
44
  typeName?: string;
45
45
  };
46
46
 
47
- type __TnValidateResult = { ok: boolean; code?: string; consumed?: bigint };
47
+ type __TnValidateResult = {
48
+ ok: boolean;
49
+ code?: string;
50
+ consumed?: bigint;
51
+ params?: Record<string, bigint>;
52
+ };
48
53
  type __TnEvalResult =
49
54
  | { ok: true; value: bigint }
50
55
  | { ok: false; code: string };
@@ -967,7 +972,7 @@ export class DateBuilder {
967
972
 
968
973
  __tnRegisterFootprint("Date", (params) => Date.__tnInvokeFootprint(params));
969
974
  __tnRegisterValidate("Date", (buffer, params) => Date.__tnInvokeValidate(buffer, params));
970
- __tnRegisterDynamicValidate("Date", (buffer) => { const result = Date.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
975
+ __tnRegisterDynamicValidate("Date", (buffer) => { const result = Date.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
971
976
 
972
977
  /* ----- TYPE DEFINITION FOR Duration ----- */
973
978
 
@@ -1131,7 +1136,7 @@ export class DurationBuilder {
1131
1136
 
1132
1137
  __tnRegisterFootprint("Duration", (params) => Duration.__tnInvokeFootprint(params));
1133
1138
  __tnRegisterValidate("Duration", (buffer, params) => Duration.__tnInvokeValidate(buffer, params));
1134
- __tnRegisterDynamicValidate("Duration", (buffer) => { const result = Duration.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1139
+ __tnRegisterDynamicValidate("Duration", (buffer) => { const result = Duration.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1135
1140
 
1136
1141
  /* ----- TYPE DEFINITION FOR FixedPoint ----- */
1137
1142
 
@@ -1295,7 +1300,7 @@ export class FixedPointBuilder {
1295
1300
 
1296
1301
  __tnRegisterFootprint("FixedPoint", (params) => FixedPoint.__tnInvokeFootprint(params));
1297
1302
  __tnRegisterValidate("FixedPoint", (buffer, params) => FixedPoint.__tnInvokeValidate(buffer, params));
1298
- __tnRegisterDynamicValidate("FixedPoint", (buffer) => { const result = FixedPoint.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1303
+ __tnRegisterDynamicValidate("FixedPoint", (buffer) => { const result = FixedPoint.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1299
1304
 
1300
1305
  /* ----- TYPE DEFINITION FOR Hash ----- */
1301
1306
 
@@ -1437,7 +1442,7 @@ export class HashBuilder {
1437
1442
 
1438
1443
  __tnRegisterFootprint("Hash", (params) => Hash.__tnInvokeFootprint(params));
1439
1444
  __tnRegisterValidate("Hash", (buffer, params) => Hash.__tnInvokeValidate(buffer, params));
1440
- __tnRegisterDynamicValidate("Hash", (buffer) => { const result = Hash.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1445
+ __tnRegisterDynamicValidate("Hash", (buffer) => { const result = Hash.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1441
1446
 
1442
1447
  /* ----- TYPE DEFINITION FOR InstructionData ----- */
1443
1448
 
@@ -1837,7 +1842,7 @@ export class InstructionDataBuilder {
1837
1842
 
1838
1843
  __tnRegisterFootprint("InstructionData", (params) => InstructionData.__tnInvokeFootprint(params));
1839
1844
  __tnRegisterValidate("InstructionData", (buffer, params) => InstructionData.__tnInvokeValidate(buffer, params));
1840
- __tnRegisterDynamicValidate("InstructionData", (buffer) => { const result = InstructionData.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1845
+ __tnRegisterDynamicValidate("InstructionData", (buffer) => { const result = InstructionData.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1841
1846
 
1842
1847
  /* ----- TYPE DEFINITION FOR Pubkey ----- */
1843
1848
 
@@ -1979,7 +1984,7 @@ export class PubkeyBuilder {
1979
1984
 
1980
1985
  __tnRegisterFootprint("Pubkey", (params) => Pubkey.__tnInvokeFootprint(params));
1981
1986
  __tnRegisterValidate("Pubkey", (buffer, params) => Pubkey.__tnInvokeValidate(buffer, params));
1982
- __tnRegisterDynamicValidate("Pubkey", (buffer) => { const result = Pubkey.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1987
+ __tnRegisterDynamicValidate("Pubkey", (buffer) => { const result = Pubkey.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1983
1988
 
1984
1989
  /* ----- TYPE DEFINITION FOR Signature ----- */
1985
1990
 
@@ -2121,7 +2126,7 @@ export class SignatureBuilder {
2121
2126
 
2122
2127
  __tnRegisterFootprint("Signature", (params) => Signature.__tnInvokeFootprint(params));
2123
2128
  __tnRegisterValidate("Signature", (buffer, params) => Signature.__tnInvokeValidate(buffer, params));
2124
- __tnRegisterDynamicValidate("Signature", (buffer) => { const result = Signature.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
2129
+ __tnRegisterDynamicValidate("Signature", (buffer) => { const result = Signature.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
2125
2130
 
2126
2131
  /* ----- TYPE DEFINITION FOR Timestamp ----- */
2127
2132
 
@@ -2261,5 +2266,5 @@ export class TimestampBuilder {
2261
2266
 
2262
2267
  __tnRegisterFootprint("Timestamp", (params) => Timestamp.__tnInvokeFootprint(params));
2263
2268
  __tnRegisterValidate("Timestamp", (buffer, params) => Timestamp.__tnInvokeValidate(buffer, params));
2264
- __tnRegisterDynamicValidate("Timestamp", (buffer) => { const result = Timestamp.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
2269
+ __tnRegisterDynamicValidate("Timestamp", (buffer) => { const result = Timestamp.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
2265
2270
 
@@ -46,7 +46,12 @@ type __TnIrContext = {
46
46
  typeName?: string;
47
47
  };
48
48
 
49
- type __TnValidateResult = { ok: boolean; code?: string; consumed?: bigint };
49
+ type __TnValidateResult = {
50
+ ok: boolean;
51
+ code?: string;
52
+ consumed?: bigint;
53
+ params?: Record<string, bigint>;
54
+ };
50
55
  type __TnEvalResult =
51
56
  | { ok: true; value: bigint }
52
57
  | { ok: false; code: string };
@@ -786,7 +791,7 @@ function __tnNormalizeIrError(err: unknown): string {
786
791
 
787
792
  __tnRegisterFootprint("InstructionData", (params) => InstructionData.__tnInvokeFootprint(params));
788
793
  __tnRegisterValidate("InstructionData", (buffer, params) => InstructionData.__tnInvokeValidate(buffer, params));
789
- __tnRegisterDynamicValidate("InstructionData", (buffer) => { const result = InstructionData.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
794
+ __tnRegisterDynamicValidate("InstructionData", (buffer) => { const result = InstructionData.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
790
795
 
791
796
  /* ----- TYPE DEFINITION FOR MulticallArgs ----- */
792
797
 
@@ -850,6 +855,16 @@ export class MulticallArgs {
850
855
  throw new Error("MulticallArgs: field reference '" + path + "' is not available; provide fieldContext when creating this view");
851
856
  }
852
857
 
858
+ static builder(): MulticallArgsBuilder {
859
+ return new MulticallArgsBuilder();
860
+ }
861
+
862
+ static fromBuilder(builder: MulticallArgsBuilder): MulticallArgs | null {
863
+ const buffer = builder.build();
864
+ const params = builder.dynamicParams();
865
+ return MulticallArgs.from_array(buffer, { params });
866
+ }
867
+
853
868
  private static __tnExtractParams(view: DataView, buffer: Uint8Array): { params: MulticallArgs.Params; derived: Record<string, bigint> | null } | null {
854
869
  if (buffer.length < 2) {
855
870
  return null;
@@ -1086,9 +1101,126 @@ export namespace MulticallArgs {
1086
1101
  }
1087
1102
  }
1088
1103
 
1104
+ export class MulticallArgsBuilder {
1105
+ private buffer: Uint8Array;
1106
+ private view: DataView;
1107
+ private __tnJagged_calls: Uint8Array[] | null = null;
1108
+ private __tnCachedParams: MulticallArgs.Params | null = null;
1109
+ private __tnLastBuffer: Uint8Array | null = null;
1110
+ private __tnLastParams: MulticallArgs.Params | null = null;
1111
+
1112
+ constructor() {
1113
+ this.buffer = new Uint8Array(2);
1114
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
1115
+ }
1116
+
1117
+ private __tnInvalidate(): void {
1118
+ this.__tnCachedParams = null;
1119
+ this.__tnLastBuffer = null;
1120
+ this.__tnLastParams = null;
1121
+ }
1122
+
1123
+ set_calls_count(value: number): this {
1124
+ this.view.setUint16(0, value, true);
1125
+ this.__tnInvalidate();
1126
+ return this;
1127
+ }
1128
+
1129
+ set_calls(values: readonly (InstructionData | __TnStructFieldInput)[]): this {
1130
+ const fragments: Uint8Array[] = [];
1131
+ for (let i = 0; i < values.length; i++) {
1132
+ const bytes = __tnResolveStructFieldInput(values[i] as __TnStructFieldInput, "MulticallArgsBuilder::calls[" + i + "]");
1133
+ const validation = __tnInvokeDynamicValidate("InstructionData", bytes);
1134
+ if (!validation.ok || validation.consumed === undefined) throw new Error("MulticallArgsBuilder: field 'calls' element failed validation");
1135
+ if (__tnBigIntToNumber(validation.consumed, "MulticallArgsBuilder::calls") !== bytes.length) throw new Error("MulticallArgsBuilder: field 'calls' element validation did not consume the full buffer");
1136
+ fragments.push(bytes);
1137
+ }
1138
+ this.__tnJagged_calls = fragments;
1139
+ this.set_calls_count(fragments.length);
1140
+ this.__tnInvalidate();
1141
+ return this;
1142
+ }
1143
+
1144
+ build(): Uint8Array {
1145
+ const params = this.__tnComputeParams();
1146
+ const fragments = this.__tnCollectFragments();
1147
+ const size = this.__tnComputeSize(fragments);
1148
+ const buffer = new Uint8Array(size);
1149
+ this.__tnWriteInto(buffer, fragments);
1150
+ this.__tnValidateOrThrow(buffer, params);
1151
+ return buffer;
1152
+ }
1153
+
1154
+ buildInto(target: Uint8Array, offset = 0): Uint8Array {
1155
+ const params = this.__tnComputeParams();
1156
+ const fragments = this.__tnCollectFragments();
1157
+ const size = this.__tnComputeSize(fragments);
1158
+ if (target.length - offset < size) throw new Error("MulticallArgsBuilder: target buffer too small");
1159
+ const slice = target.subarray(offset, offset + size);
1160
+ this.__tnWriteInto(slice, fragments);
1161
+ this.__tnValidateOrThrow(slice, params);
1162
+ return target;
1163
+ }
1164
+
1165
+ finish(): MulticallArgs {
1166
+ const buffer = this.build();
1167
+ const params = this.__tnLastParams ?? this.__tnComputeParams();
1168
+ const view = MulticallArgs.from_array(buffer, { params });
1169
+ if (!view) throw new Error("MulticallArgsBuilder: failed to finalize view");
1170
+ return view;
1171
+ }
1172
+
1173
+ finishView(): MulticallArgs {
1174
+ return this.finish();
1175
+ }
1176
+
1177
+ dynamicParams(): MulticallArgs.Params {
1178
+ return this.__tnComputeParams();
1179
+ }
1180
+
1181
+ private __tnComputeParams(): MulticallArgs.Params {
1182
+ if (this.__tnCachedParams) return this.__tnCachedParams;
1183
+ const params = MulticallArgs.Params.fromValues({
1184
+ calls_calls_count: (() => { const fragments = this.__tnJagged_calls; if (!fragments) throw new Error("MulticallArgsBuilder: field 'calls' must be written before computing params"); return __tnToBigInt(fragments.length); })(),
1185
+ });
1186
+ this.__tnCachedParams = params;
1187
+ return params;
1188
+ }
1189
+
1190
+ private __tnCollectFragments(): Uint8Array[] {
1191
+ const fragments = this.__tnJagged_calls;
1192
+ if (!fragments) throw new Error("MulticallArgsBuilder: field 'calls' must be written before build");
1193
+ return fragments;
1194
+ }
1195
+
1196
+ private __tnComputeSize(fragments: readonly Uint8Array[]): number {
1197
+ let total = this.buffer.length;
1198
+ for (const fragment of fragments) total += fragment.length;
1199
+ return total;
1200
+ }
1201
+
1202
+ private __tnWriteInto(target: Uint8Array, fragments: readonly Uint8Array[]): void {
1203
+ target.set(this.buffer, 0);
1204
+ let cursor = this.buffer.length;
1205
+ for (const fragment of fragments) {
1206
+ target.set(fragment, cursor);
1207
+ cursor += fragment.length;
1208
+ }
1209
+ }
1210
+
1211
+ private __tnValidateOrThrow(buffer: Uint8Array, params: MulticallArgs.Params): void {
1212
+ const result = MulticallArgs.validate(buffer, { params });
1213
+ if (!result.ok) {
1214
+ throw new Error(`${ MulticallArgs }Builder: builder produced invalid buffer (code=${result.code ?? "unknown"})`);
1215
+ }
1216
+ this.__tnLastParams = result.params ?? params;
1217
+ this.__tnLastBuffer = buffer;
1218
+ }
1219
+ }
1220
+
1089
1221
  __tnRegisterFootprint("MulticallArgs", (params) => MulticallArgs.__tnInvokeFootprint(params));
1090
1222
  __tnRegisterValidate("MulticallArgs", (buffer, params) => MulticallArgs.__tnInvokeValidate(buffer, params));
1091
- __tnRegisterDynamicValidate("MulticallArgs", (buffer) => { const result = MulticallArgs.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1223
+ __tnRegisterDynamicValidate("MulticallArgs", (buffer) => { const result = MulticallArgs.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1092
1224
 
1093
1225
  /* ----- TYPE DEFINITION FOR MulticallError ----- */
1094
1226
 
@@ -1228,5 +1360,5 @@ export class MulticallErrorBuilder {
1228
1360
 
1229
1361
  __tnRegisterFootprint("MulticallError", (params) => MulticallError.__tnInvokeFootprint(params));
1230
1362
  __tnRegisterValidate("MulticallError", (buffer, params) => MulticallError.__tnInvokeValidate(buffer, params));
1231
- __tnRegisterDynamicValidate("MulticallError", (buffer) => { const result = MulticallError.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1363
+ __tnRegisterDynamicValidate("MulticallError", (buffer) => { const result = MulticallError.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1232
1364
 
@@ -3,7 +3,10 @@ import {
3
3
  InstructionData,
4
4
  InstructionDataBuilder,
5
5
  } from './abi/thru/common/primitives/types';
6
- import { MulticallArgs } from './abi/thru/program/multicall/types';
6
+ import {
7
+ MulticallArgs,
8
+ MulticallArgsBuilder,
9
+ } from './abi/thru/program/multicall/types';
7
10
 
8
11
  export {
9
12
  InstructionData,
@@ -11,6 +14,7 @@ export {
11
14
  } from './abi/thru/common/primitives/types';
12
15
  export {
13
16
  MulticallArgs,
17
+ MulticallArgsBuilder,
14
18
  MulticallError,
15
19
  } from './abi/thru/program/multicall/types';
16
20
 
@@ -25,11 +29,6 @@ export const MULTICALL_PROGRAM_PUBKEY = new Uint8Array([
25
29
 
26
30
  export const MULTICALL_PROGRAM_ADDRESS = encodeAddress(MULTICALL_PROGRAM_PUBKEY);
27
31
 
28
- function writeU16LE(target: Uint8Array, offset: number, value: number): void {
29
- target[offset] = value & 0xff;
30
- target[offset + 1] = (value >> 8) & 0xff;
31
- }
32
-
33
32
  function assertProgramIdx(programIdx: number): void {
34
33
  if (!Number.isInteger(programIdx) || programIdx < 0 || programIdx > 0xffff) {
35
34
  throw new Error('programIdx must be 0-65535');
@@ -58,17 +57,7 @@ export function buildMulticallInstruction(calls: MulticallCall[]): Uint8Array {
58
57
  if (calls.length > 0xffff) throw new Error('calls length must be 0-65535');
59
58
 
60
59
  const encodedCalls = calls.map(buildInstructionData);
61
- const totalLength = 2 + encodedCalls.reduce((sum, call) => sum + call.length, 0);
62
-
63
- const output = new Uint8Array(totalLength);
64
- let offset = 0;
65
- writeU16LE(output, offset, calls.length);
66
- offset += 2;
67
-
68
- for (const call of encodedCalls) {
69
- output.set(call, offset);
70
- offset += call.length;
71
- }
60
+ const output = new MulticallArgsBuilder().set_calls(encodedCalls).build();
72
61
 
73
62
  const validation = MulticallArgs.validate(output);
74
63
  if (!validation.ok || validation.consumed !== output.length) {
@@ -46,7 +46,12 @@ type __TnIrContext = {
46
46
  typeName?: string;
47
47
  };
48
48
 
49
- type __TnValidateResult = { ok: boolean; code?: string; consumed?: bigint };
49
+ type __TnValidateResult = {
50
+ ok: boolean;
51
+ code?: string;
52
+ consumed?: bigint;
53
+ params?: Record<string, bigint>;
54
+ };
50
55
  type __TnEvalResult =
51
56
  | { ok: true; value: bigint }
52
57
  | { ok: false; code: string };
@@ -786,11 +791,11 @@ function __tnNormalizeIrError(err: unknown): string {
786
791
 
787
792
  __tnRegisterFootprint("Hash", (params) => Hash.__tnInvokeFootprint(params));
788
793
  __tnRegisterValidate("Hash", (buffer, params) => Hash.__tnInvokeValidate(buffer, params));
789
- __tnRegisterDynamicValidate("Hash", (buffer) => { const result = Hash.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
794
+ __tnRegisterDynamicValidate("Hash", (buffer) => { const result = Hash.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
790
795
 
791
796
  __tnRegisterFootprint("Pubkey", (params) => Pubkey.__tnInvokeFootprint(params));
792
797
  __tnRegisterValidate("Pubkey", (buffer, params) => Pubkey.__tnInvokeValidate(buffer, params));
793
- __tnRegisterDynamicValidate("Pubkey", (buffer) => { const result = Pubkey.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
798
+ __tnRegisterDynamicValidate("Pubkey", (buffer) => { const result = Pubkey.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
794
799
 
795
800
  /* ----- TYPE DEFINITION FOR StateProofHeader ----- */
796
801
 
@@ -916,7 +921,7 @@ export class StateProofHeaderBuilder {
916
921
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
917
922
  }
918
923
 
919
- set_type_slot(value: number): this {
924
+ set_type_slot(value: bigint): this {
920
925
  const cast = __tnToBigInt(value);
921
926
  this.view.setBigUint64(0, cast, true);
922
927
  return this;
@@ -947,7 +952,7 @@ export class StateProofHeaderBuilder {
947
952
 
948
953
  __tnRegisterFootprint("StateProofHeader", (params) => StateProofHeader.__tnInvokeFootprint(params));
949
954
  __tnRegisterValidate("StateProofHeader", (buffer, params) => StateProofHeader.__tnInvokeValidate(buffer, params));
950
- __tnRegisterDynamicValidate("StateProofHeader", (buffer) => { const result = StateProofHeader.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
955
+ __tnRegisterDynamicValidate("StateProofHeader", (buffer) => { const result = StateProofHeader.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
951
956
 
952
957
  /* ----- TYPE DEFINITION FOR StateProof ----- */
953
958
 
@@ -1739,5 +1744,5 @@ export class StateProofBuilder {
1739
1744
 
1740
1745
  __tnRegisterFootprint("StateProof", (params) => StateProof.__tnInvokeFootprint(params));
1741
1746
  __tnRegisterValidate("StateProof", (buffer, params) => StateProof.__tnInvokeValidate(buffer, params));
1742
- __tnRegisterDynamicValidate("StateProof", (buffer) => { const result = StateProof.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1747
+ __tnRegisterDynamicValidate("StateProof", (buffer) => { const result = StateProof.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1743
1748
 
@@ -44,7 +44,12 @@ type __TnIrContext = {
44
44
  typeName?: string;
45
45
  };
46
46
 
47
- type __TnValidateResult = { ok: boolean; code?: string; consumed?: bigint };
47
+ type __TnValidateResult = {
48
+ ok: boolean;
49
+ code?: string;
50
+ consumed?: bigint;
51
+ params?: Record<string, bigint>;
52
+ };
48
53
  type __TnEvalResult =
49
54
  | { ok: true; value: bigint }
50
55
  | { ok: false; code: string };
@@ -967,7 +972,7 @@ export class DateBuilder {
967
972
 
968
973
  __tnRegisterFootprint("Date", (params) => Date.__tnInvokeFootprint(params));
969
974
  __tnRegisterValidate("Date", (buffer, params) => Date.__tnInvokeValidate(buffer, params));
970
- __tnRegisterDynamicValidate("Date", (buffer) => { const result = Date.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
975
+ __tnRegisterDynamicValidate("Date", (buffer) => { const result = Date.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
971
976
 
972
977
  /* ----- TYPE DEFINITION FOR Duration ----- */
973
978
 
@@ -1101,7 +1106,7 @@ export class DurationBuilder {
1101
1106
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
1102
1107
  }
1103
1108
 
1104
- set_seconds(value: number): this {
1109
+ set_seconds(value: bigint): this {
1105
1110
  const cast = __tnToBigInt(value);
1106
1111
  this.view.setBigInt64(0, cast, true);
1107
1112
  return this;
@@ -1131,7 +1136,7 @@ export class DurationBuilder {
1131
1136
 
1132
1137
  __tnRegisterFootprint("Duration", (params) => Duration.__tnInvokeFootprint(params));
1133
1138
  __tnRegisterValidate("Duration", (buffer, params) => Duration.__tnInvokeValidate(buffer, params));
1134
- __tnRegisterDynamicValidate("Duration", (buffer) => { const result = Duration.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1139
+ __tnRegisterDynamicValidate("Duration", (buffer) => { const result = Duration.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1135
1140
 
1136
1141
  /* ----- TYPE DEFINITION FOR FixedPoint ----- */
1137
1142
 
@@ -1265,7 +1270,7 @@ export class FixedPointBuilder {
1265
1270
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
1266
1271
  }
1267
1272
 
1268
- set_mantissa(value: number): this {
1273
+ set_mantissa(value: bigint): this {
1269
1274
  const cast = __tnToBigInt(value);
1270
1275
  this.view.setBigInt64(0, cast, true);
1271
1276
  return this;
@@ -1295,7 +1300,7 @@ export class FixedPointBuilder {
1295
1300
 
1296
1301
  __tnRegisterFootprint("FixedPoint", (params) => FixedPoint.__tnInvokeFootprint(params));
1297
1302
  __tnRegisterValidate("FixedPoint", (buffer, params) => FixedPoint.__tnInvokeValidate(buffer, params));
1298
- __tnRegisterDynamicValidate("FixedPoint", (buffer) => { const result = FixedPoint.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1303
+ __tnRegisterDynamicValidate("FixedPoint", (buffer) => { const result = FixedPoint.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1299
1304
 
1300
1305
  /* ----- TYPE DEFINITION FOR Hash ----- */
1301
1306
 
@@ -1437,7 +1442,7 @@ export class HashBuilder {
1437
1442
 
1438
1443
  __tnRegisterFootprint("Hash", (params) => Hash.__tnInvokeFootprint(params));
1439
1444
  __tnRegisterValidate("Hash", (buffer, params) => Hash.__tnInvokeValidate(buffer, params));
1440
- __tnRegisterDynamicValidate("Hash", (buffer) => { const result = Hash.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1445
+ __tnRegisterDynamicValidate("Hash", (buffer) => { const result = Hash.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1441
1446
 
1442
1447
  /* ----- TYPE DEFINITION FOR InstructionData ----- */
1443
1448
 
@@ -1751,7 +1756,7 @@ export class InstructionDataBuilder {
1751
1756
  return this;
1752
1757
  }
1753
1758
 
1754
- set_data_size(value: number): this {
1759
+ set_data_size(value: bigint): this {
1755
1760
  const cast = __tnToBigInt(value);
1756
1761
  this.view.setBigUint64(2, cast, true);
1757
1762
  this.__tnInvalidate();
@@ -1765,7 +1770,7 @@ export class InstructionDataBuilder {
1765
1770
  const elementCount = bytes.length;
1766
1771
  this.__tnFam_data = bytes;
1767
1772
  this.__tnFam_dataCount = elementCount;
1768
- this.set_data_size(elementCount);
1773
+ this.set_data_size(__tnToBigInt(elementCount));
1769
1774
  this.__tnInvalidate();
1770
1775
  });
1771
1776
  }
@@ -1837,7 +1842,7 @@ export class InstructionDataBuilder {
1837
1842
 
1838
1843
  __tnRegisterFootprint("InstructionData", (params) => InstructionData.__tnInvokeFootprint(params));
1839
1844
  __tnRegisterValidate("InstructionData", (buffer, params) => InstructionData.__tnInvokeValidate(buffer, params));
1840
- __tnRegisterDynamicValidate("InstructionData", (buffer) => { const result = InstructionData.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1845
+ __tnRegisterDynamicValidate("InstructionData", (buffer) => { const result = InstructionData.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1841
1846
 
1842
1847
  /* ----- TYPE DEFINITION FOR Pubkey ----- */
1843
1848
 
@@ -1979,7 +1984,7 @@ export class PubkeyBuilder {
1979
1984
 
1980
1985
  __tnRegisterFootprint("Pubkey", (params) => Pubkey.__tnInvokeFootprint(params));
1981
1986
  __tnRegisterValidate("Pubkey", (buffer, params) => Pubkey.__tnInvokeValidate(buffer, params));
1982
- __tnRegisterDynamicValidate("Pubkey", (buffer) => { const result = Pubkey.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
1987
+ __tnRegisterDynamicValidate("Pubkey", (buffer) => { const result = Pubkey.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
1983
1988
 
1984
1989
  /* ----- TYPE DEFINITION FOR Signature ----- */
1985
1990
 
@@ -2121,7 +2126,7 @@ export class SignatureBuilder {
2121
2126
 
2122
2127
  __tnRegisterFootprint("Signature", (params) => Signature.__tnInvokeFootprint(params));
2123
2128
  __tnRegisterValidate("Signature", (buffer, params) => Signature.__tnInvokeValidate(buffer, params));
2124
- __tnRegisterDynamicValidate("Signature", (buffer) => { const result = Signature.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
2129
+ __tnRegisterDynamicValidate("Signature", (buffer) => { const result = Signature.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
2125
2130
 
2126
2131
  /* ----- TYPE DEFINITION FOR Timestamp ----- */
2127
2132
 
@@ -2236,7 +2241,7 @@ export class TimestampBuilder {
2236
2241
  this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
2237
2242
  }
2238
2243
 
2239
- set_seconds(value: number): this {
2244
+ set_seconds(value: bigint): this {
2240
2245
  const cast = __tnToBigInt(value);
2241
2246
  this.view.setBigInt64(0, cast, true);
2242
2247
  return this;
@@ -2261,5 +2266,5 @@ export class TimestampBuilder {
2261
2266
 
2262
2267
  __tnRegisterFootprint("Timestamp", (params) => Timestamp.__tnInvokeFootprint(params));
2263
2268
  __tnRegisterValidate("Timestamp", (buffer, params) => Timestamp.__tnInvokeValidate(buffer, params));
2264
- __tnRegisterDynamicValidate("Timestamp", (buffer) => { const result = Timestamp.validate(buffer); return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed) }; });
2269
+ __tnRegisterDynamicValidate("Timestamp", (buffer) => { const result = Timestamp.validate(buffer); const params = (result as { params?: Record<string, bigint> }).params; return { ok: result.ok, code: result.code, consumed: result.consumed === undefined ? undefined : __tnToBigInt(result.consumed), params }; });
2265
2270