@thru/programs 0.3.3 → 0.3.5

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 (122) hide show
  1. package/README.md +123 -37
  2. package/dist/abi-manager/index.cjs +9568 -0
  3. package/dist/abi-manager/index.cjs.map +1 -0
  4. package/dist/abi-manager/index.d.cts +2169 -0
  5. package/dist/abi-manager/index.d.ts +2169 -0
  6. package/dist/abi-manager/index.js +4 -0
  7. package/dist/abi-manager/index.js.map +1 -0
  8. package/dist/amm/index.cjs +1 -3
  9. package/dist/amm/index.cjs.map +1 -1
  10. package/dist/amm/index.d.cts +1 -1
  11. package/dist/amm/index.d.ts +1 -1
  12. package/dist/amm/index.js +2 -2
  13. package/dist/amm/index.js.map +1 -1
  14. package/dist/chunk-6IC6CO5S.js +9443 -0
  15. package/dist/chunk-6IC6CO5S.js.map +1 -0
  16. package/dist/chunk-7DRJVAYI.js +8587 -0
  17. package/dist/chunk-7DRJVAYI.js.map +1 -0
  18. package/dist/chunk-7FBCBZIY.js +41 -0
  19. package/dist/chunk-7FBCBZIY.js.map +1 -0
  20. package/dist/chunk-BNYDH4ZP.js +4351 -0
  21. package/dist/chunk-BNYDH4ZP.js.map +1 -0
  22. package/dist/chunk-OODN6LJA.js +6567 -0
  23. package/dist/chunk-OODN6LJA.js.map +1 -0
  24. package/dist/chunk-YX7BLFQZ.js +81 -0
  25. package/dist/chunk-YX7BLFQZ.js.map +1 -0
  26. package/dist/clob/index.cjs +19361 -6851
  27. package/dist/clob/index.cjs.map +1 -1
  28. package/dist/clob/index.d.cts +1243 -63
  29. package/dist/clob/index.d.ts +1243 -63
  30. package/dist/clob/index.js +6826 -2818
  31. package/dist/clob/index.js.map +1 -1
  32. package/dist/deploy/index.cjs +24734 -0
  33. package/dist/deploy/index.cjs.map +1 -0
  34. package/dist/deploy/index.d.cts +180 -0
  35. package/dist/deploy/index.d.ts +180 -0
  36. package/dist/deploy/index.js +1846 -0
  37. package/dist/deploy/index.js.map +1 -0
  38. package/dist/helpers-DD7q61nr.d.cts +7 -0
  39. package/dist/helpers-DD7q61nr.d.ts +7 -0
  40. package/dist/manager/index.cjs +6680 -0
  41. package/dist/manager/index.cjs.map +1 -0
  42. package/dist/manager/index.d.cts +1279 -0
  43. package/dist/manager/index.d.ts +1279 -0
  44. package/dist/manager/index.js +4 -0
  45. package/dist/manager/index.js.map +1 -0
  46. package/dist/passkey-manager/index.cjs +4 -5
  47. package/dist/passkey-manager/index.cjs.map +1 -1
  48. package/dist/passkey-manager/index.js +2 -2
  49. package/dist/token/index.js +1 -8585
  50. package/dist/token/index.js.map +1 -1
  51. package/dist/uploader/index.cjs +4442 -0
  52. package/dist/uploader/index.cjs.map +1 -0
  53. package/dist/uploader/index.d.cts +761 -0
  54. package/dist/uploader/index.d.ts +761 -0
  55. package/dist/uploader/index.js +4 -0
  56. package/dist/uploader/index.js.map +1 -0
  57. package/package.json +22 -2
  58. package/src/abi-manager/abi/thru/blockchain/state_proof/types.ts +1906 -0
  59. package/src/abi-manager/abi/thru/common/primitives/types.ts +2428 -0
  60. package/src/abi-manager/abi/thru/program/abi_manager/types.ts +7037 -0
  61. package/src/abi-manager/accounts.ts +91 -0
  62. package/src/abi-manager/constants.ts +19 -0
  63. package/src/abi-manager/derivation.ts +86 -0
  64. package/src/abi-manager/errors.ts +48 -0
  65. package/src/abi-manager/index.test.ts +136 -0
  66. package/src/abi-manager/index.ts +56 -0
  67. package/src/abi-manager/instructions.ts +573 -0
  68. package/src/abi-manager/types.ts +150 -0
  69. package/src/amm/index.test.ts +8 -2
  70. package/src/amm/index.ts +1 -1
  71. package/src/clob/abi/thru/program/clob/types.ts +6981 -3070
  72. package/src/clob/exchange-client.test.ts +592 -0
  73. package/src/clob/exchange-client.ts +953 -0
  74. package/src/clob/exchange.test.ts +18 -16
  75. package/src/clob/exchange.ts +4 -0
  76. package/src/clob/index.test.ts +134 -7
  77. package/src/clob/index.ts +303 -10
  78. package/src/clob/price.test.ts +32 -0
  79. package/src/clob/price.ts +77 -0
  80. package/src/deploy/accounts.ts +208 -0
  81. package/src/deploy/chain.ts +163 -0
  82. package/src/deploy/constants.ts +25 -0
  83. package/src/deploy/deploy.test.ts +349 -0
  84. package/src/deploy/errors.ts +72 -0
  85. package/src/deploy/index.ts +44 -0
  86. package/src/deploy/inspection.ts +146 -0
  87. package/src/deploy/seeds.ts +29 -0
  88. package/src/deploy/types.ts +178 -0
  89. package/src/deploy/uploader.test.ts +326 -0
  90. package/src/deploy/uploader.ts +558 -0
  91. package/src/deploy/validation-imports.test.ts +55 -0
  92. package/src/deploy/validation.ts +183 -0
  93. package/src/deploy/workflows.test.ts +422 -0
  94. package/src/deploy/workflows.ts +1088 -0
  95. package/src/helpers/bytes.test.ts +58 -0
  96. package/src/helpers/bytes.ts +28 -3
  97. package/src/manager/abi/thru/blockchain/state_proof/types.ts +1906 -0
  98. package/src/manager/abi/thru/common/primitives/types.ts +2428 -0
  99. package/src/manager/abi/thru/program/manager/types.ts +3814 -0
  100. package/src/manager/accounts.ts +44 -0
  101. package/src/manager/constants.ts +16 -0
  102. package/src/manager/derivation.ts +32 -0
  103. package/src/manager/errors.ts +47 -0
  104. package/src/manager/index.test.ts +108 -0
  105. package/src/manager/index.ts +68 -0
  106. package/src/manager/instructions.ts +281 -0
  107. package/src/manager/types.ts +95 -0
  108. package/src/manager/validation.ts +35 -0
  109. package/src/uploader/abi/thru/common/primitives/types.ts +2428 -0
  110. package/src/uploader/abi/thru/program/uploader/types.ts +3022 -0
  111. package/src/uploader/accounts.ts +38 -0
  112. package/src/uploader/constants.ts +14 -0
  113. package/src/uploader/derivation.ts +34 -0
  114. package/src/uploader/errors.ts +25 -0
  115. package/src/uploader/index.test.ts +107 -0
  116. package/src/uploader/index.ts +34 -0
  117. package/src/uploader/instructions.ts +163 -0
  118. package/src/uploader/types.ts +67 -0
  119. package/src/utils/helpers.ts +121 -0
  120. package/tsup.config.ts +4 -0
  121. package/dist/chunk-P5OABVJI.js +0 -28
  122. package/dist/chunk-P5OABVJI.js.map +0 -1
@@ -0,0 +1,761 @@
1
+ import { P as ProgramSeed, I as InstructionData } from '../helpers-DD7q61nr.cjs';
2
+ export { A as AccountLookupContext } from '../helpers-DD7q61nr.cjs';
3
+ import { Account } from '@thru/sdk';
4
+
5
+ declare const UPLOADER_PROGRAM_PUBKEY: Uint8Array<ArrayBufferLike>;
6
+ declare const UPLOADER_PROGRAM_ADDRESS: string;
7
+ declare const UPLOADER_META_SIZE = 65;
8
+ declare const UPLOADER_STATE_OPEN = 1;
9
+ declare const UPLOADER_STATE_FINALIZED = 2;
10
+ declare const UPLOADER_DEFAULT_CHUNK_SIZE = 30720;
11
+ declare const UPLOADER_MIN_CHUNK_SIZE = 1024;
12
+ declare const UPLOADER_MAX_CHUNK_SIZE = 31000;
13
+
14
+ interface UploadAddresses {
15
+ metaAccountAddress: string;
16
+ metaAccountBytes: Uint8Array;
17
+ bufferAccountAddress: string;
18
+ bufferAccountBytes: Uint8Array;
19
+ }
20
+ interface UploaderProgramMetaInfo {
21
+ authorityAddress: string;
22
+ expectedHash: Uint8Array;
23
+ state: number;
24
+ }
25
+ interface UploadIndices {
26
+ bufferAccountIdx: number;
27
+ metaAccountIdx: number;
28
+ }
29
+ type UploaderInstructionArgs = (UploadIndices & {
30
+ kind: 'create';
31
+ authorityAccountIdx: number;
32
+ bufferSize: number;
33
+ expectedHash: Uint8Array;
34
+ seed: ProgramSeed;
35
+ }) | (UploadIndices & {
36
+ kind: 'write';
37
+ data: Uint8Array;
38
+ offset: number;
39
+ }) | (UploadIndices & {
40
+ kind: 'destroy';
41
+ }) | (UploadIndices & {
42
+ kind: 'finalize';
43
+ expectedHash: Uint8Array;
44
+ });
45
+ interface UploadAccounts {
46
+ bufferAccount: Uint8Array;
47
+ metaAccount: Uint8Array;
48
+ }
49
+ interface CreateUploadBufferInstructionArgs extends UploadAccounts {
50
+ authorityAccount: Uint8Array;
51
+ bufferSize: number;
52
+ expectedHash: Uint8Array;
53
+ seed: ProgramSeed;
54
+ }
55
+ interface WriteUploadInstructionArgs extends UploadAccounts {
56
+ data: Uint8Array;
57
+ offset: number;
58
+ }
59
+ type DestroyUploadInstructionArgs = UploadAccounts;
60
+ interface FinalizeUploadInstructionArgs extends UploadAccounts {
61
+ expectedHash: Uint8Array;
62
+ }
63
+
64
+ declare function deriveUploadAddresses(seed: ProgramSeed, uploaderProgramAddress?: string | Uint8Array): UploadAddresses;
65
+
66
+ declare function parseUploaderProgramMeta(account: Account | Uint8Array): UploaderProgramMetaInfo;
67
+
68
+ declare function buildUploaderInstructionBytes(args: UploaderInstructionArgs): Uint8Array;
69
+ declare function createUploadBufferInstruction(args: CreateUploadBufferInstructionArgs): InstructionData;
70
+ declare function createWriteUploadInstruction(args: WriteUploadInstructionArgs): InstructionData;
71
+ declare function createDestroyUploadInstruction(args: DestroyUploadInstructionArgs): InstructionData;
72
+ declare function createFinalizeUploadInstruction(args: FinalizeUploadInstructionArgs): InstructionData;
73
+
74
+ declare const UPLOADER_ERRORS: {
75
+ readonly 1: "NOT_AUTHORIZED";
76
+ readonly 2: "INVALID_ARGS";
77
+ readonly 3: "META_ACCOUNT_MISSING";
78
+ readonly 4: "BUFFER_ACCOUNT_MISSING";
79
+ readonly 5: "ACCOUNT_NOT_OPEN";
80
+ readonly 6: "HASH_MISMATCH";
81
+ readonly 7: "WRITE_OVERFLOW";
82
+ readonly 8: "WRITE_OUT_OF_BOUNDS";
83
+ readonly 9: "INVALID_ACCOUNT_INDEX";
84
+ readonly 10: "INVALID_META_SIZE";
85
+ readonly 11: "ACCOUNT_RELATIONSHIP";
86
+ readonly 12: "INVALID_INSTRUCTION";
87
+ };
88
+ type UploaderErrorName = (typeof UPLOADER_ERRORS)[keyof typeof UPLOADER_ERRORS];
89
+ declare function uploaderErrorName(code: number | bigint): UploaderErrorName | undefined;
90
+
91
+ type __TnValidateResult$1 = {
92
+ ok: boolean;
93
+ code?: string;
94
+ consumed?: bigint;
95
+ params?: Record<string, bigint>;
96
+ };
97
+ declare class Hash {
98
+ private buffer;
99
+ private view;
100
+ private constructor();
101
+ static __tnCreateView(buffer: Uint8Array, opts?: {
102
+ fieldContext?: Record<string, number | bigint>;
103
+ }): Hash;
104
+ static builder(): HashBuilder;
105
+ static fromBuilder(builder: HashBuilder): Hash | null;
106
+ get_bytes(): number[];
107
+ set_bytes(value: number[]): void;
108
+ get bytes(): number[];
109
+ set bytes(value: number[]);
110
+ private static __tnFootprintInternal;
111
+ private static __tnValidateInternal;
112
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
113
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult$1;
114
+ static footprintIr(): bigint;
115
+ static footprint(): number;
116
+ static validate(buffer: Uint8Array, _opts?: {
117
+ params?: never;
118
+ }): {
119
+ ok: boolean;
120
+ code?: string;
121
+ consumed?: number;
122
+ };
123
+ static from_array(buffer: Uint8Array): Hash | null;
124
+ }
125
+ declare class HashBuilder {
126
+ private buffer;
127
+ private view;
128
+ constructor();
129
+ set_bytes(values: number[]): this;
130
+ build(): Uint8Array;
131
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
132
+ finish(): Hash;
133
+ }
134
+ declare class Pubkey {
135
+ private buffer;
136
+ private view;
137
+ private constructor();
138
+ static __tnCreateView(buffer: Uint8Array, opts?: {
139
+ fieldContext?: Record<string, number | bigint>;
140
+ }): Pubkey;
141
+ static builder(): PubkeyBuilder;
142
+ static fromBuilder(builder: PubkeyBuilder): Pubkey | null;
143
+ get_bytes(): number[];
144
+ set_bytes(value: number[]): void;
145
+ get bytes(): number[];
146
+ set bytes(value: number[]);
147
+ private static __tnFootprintInternal;
148
+ private static __tnValidateInternal;
149
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
150
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult$1;
151
+ static footprintIr(): bigint;
152
+ static footprint(): number;
153
+ static validate(buffer: Uint8Array, _opts?: {
154
+ params?: never;
155
+ }): {
156
+ ok: boolean;
157
+ code?: string;
158
+ consumed?: number;
159
+ };
160
+ static from_array(buffer: Uint8Array): Pubkey | null;
161
+ }
162
+ declare class PubkeyBuilder {
163
+ private buffer;
164
+ private view;
165
+ constructor();
166
+ set_bytes(values: number[]): this;
167
+ build(): Uint8Array;
168
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
169
+ finish(): Pubkey;
170
+ }
171
+
172
+ type __TnValidateResult = {
173
+ ok: boolean;
174
+ code?: string;
175
+ consumed?: bigint;
176
+ params?: Record<string, bigint>;
177
+ };
178
+ type __TnBuilderLike = {
179
+ build(): Uint8Array;
180
+ };
181
+ type __TnVariantDescriptor = {
182
+ readonly name: string;
183
+ readonly tag: number;
184
+ readonly payloadSize: number | null;
185
+ readonly payloadType?: string;
186
+ readonly createPayloadBuilder?: () => unknown | null;
187
+ };
188
+ type __TnVariantSelectorResult<Parent> = {
189
+ select(name: string): {
190
+ writePayload(payload: Uint8Array | __TnBuilderLike): {
191
+ finish(): Parent;
192
+ };
193
+ };
194
+ finish(): Parent;
195
+ };
196
+ type __TnFamWriterResult<Parent> = {
197
+ write(payload: Uint8Array | __TnBuilderLike): {
198
+ finish(): Parent;
199
+ };
200
+ finish(): Parent;
201
+ };
202
+ declare class DestroyArgs {
203
+ private buffer;
204
+ private view;
205
+ private constructor();
206
+ static __tnCreateView(buffer: Uint8Array, opts?: {
207
+ fieldContext?: Record<string, number | bigint>;
208
+ }): DestroyArgs;
209
+ static builder(): DestroyArgsBuilder;
210
+ static fromBuilder(builder: DestroyArgsBuilder): DestroyArgs | null;
211
+ get_buffer_account_idx(): number;
212
+ set_buffer_account_idx(value: number): void;
213
+ get buffer_account_idx(): number;
214
+ set buffer_account_idx(value: number);
215
+ get_meta_account_idx(): number;
216
+ set_meta_account_idx(value: number): void;
217
+ get meta_account_idx(): number;
218
+ set meta_account_idx(value: number);
219
+ private static __tnFootprintInternal;
220
+ private static __tnValidateInternal;
221
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
222
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult;
223
+ static footprintIr(): bigint;
224
+ static footprint(): number;
225
+ static validate(buffer: Uint8Array, _opts?: {
226
+ params?: never;
227
+ }): {
228
+ ok: boolean;
229
+ code?: string;
230
+ consumed?: number;
231
+ };
232
+ static new(buffer_account_idx: number, meta_account_idx: number): DestroyArgs;
233
+ static from_array(buffer: Uint8Array): DestroyArgs | null;
234
+ }
235
+ declare class DestroyArgsBuilder {
236
+ private buffer;
237
+ private view;
238
+ constructor();
239
+ set_buffer_account_idx(value: number): this;
240
+ set_meta_account_idx(value: number): this;
241
+ build(): Uint8Array;
242
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
243
+ finish(): DestroyArgs;
244
+ }
245
+ declare class UploaderError {
246
+ private buffer;
247
+ private view;
248
+ private constructor();
249
+ static __tnCreateView(buffer: Uint8Array, opts?: {
250
+ fieldContext?: Record<string, number | bigint>;
251
+ }): UploaderError;
252
+ static builder(): UploaderErrorBuilder;
253
+ static fromBuilder(builder: UploaderErrorBuilder): UploaderError | null;
254
+ get_code(): bigint;
255
+ set_code(value: bigint): void;
256
+ get code(): bigint;
257
+ set code(value: bigint);
258
+ private static __tnFootprintInternal;
259
+ private static __tnValidateInternal;
260
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
261
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult;
262
+ static footprintIr(): bigint;
263
+ static footprint(): number;
264
+ static validate(buffer: Uint8Array, _opts?: {
265
+ params?: never;
266
+ }): {
267
+ ok: boolean;
268
+ code?: string;
269
+ consumed?: number;
270
+ };
271
+ static new(code: bigint): UploaderError;
272
+ static from_array(buffer: Uint8Array): UploaderError | null;
273
+ }
274
+ declare class UploaderErrorBuilder {
275
+ private buffer;
276
+ private view;
277
+ constructor();
278
+ set_code(value: bigint): this;
279
+ build(): Uint8Array;
280
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
281
+ finish(): UploaderError;
282
+ }
283
+ declare class UploaderProgramMeta {
284
+ private buffer;
285
+ private view;
286
+ private constructor();
287
+ static __tnCreateView(buffer: Uint8Array, opts?: {
288
+ fieldContext?: Record<string, number | bigint>;
289
+ }): UploaderProgramMeta;
290
+ static builder(): UploaderProgramMetaBuilder;
291
+ static fromBuilder(builder: UploaderProgramMetaBuilder): UploaderProgramMeta | null;
292
+ get_authority(): Pubkey;
293
+ set_authority(value: Pubkey): void;
294
+ get authority(): Pubkey;
295
+ set authority(value: Pubkey);
296
+ get_expected_account_hash(): Hash;
297
+ set_expected_account_hash(value: Hash): void;
298
+ get expected_account_hash(): Hash;
299
+ set expected_account_hash(value: Hash);
300
+ get_state(): number;
301
+ set_state(value: number): void;
302
+ get state(): number;
303
+ set state(value: number);
304
+ private static __tnFootprintInternal;
305
+ private static __tnValidateInternal;
306
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
307
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult;
308
+ static footprintIr(): bigint;
309
+ static footprint(): number;
310
+ static validate(buffer: Uint8Array, _opts?: {
311
+ params?: never;
312
+ }): {
313
+ ok: boolean;
314
+ code?: string;
315
+ consumed?: number;
316
+ };
317
+ static from_array(buffer: Uint8Array): UploaderProgramMeta | null;
318
+ }
319
+ declare class UploaderProgramMetaBuilder {
320
+ private buffer;
321
+ private view;
322
+ constructor();
323
+ set_authority(value: Uint8Array): this;
324
+ set_expected_account_hash(value: Uint8Array): this;
325
+ set_state(value: number): this;
326
+ build(): Uint8Array;
327
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
328
+ finish(): UploaderProgramMeta;
329
+ }
330
+ declare class WriteArgs {
331
+ private buffer;
332
+ private view;
333
+ private __tnFieldContext;
334
+ private __tnParams;
335
+ private constructor();
336
+ static __tnCreateView(buffer: Uint8Array, opts?: {
337
+ params?: WriteArgs.Params;
338
+ fieldContext?: Record<string, number | bigint>;
339
+ }): WriteArgs;
340
+ dynamicParams(): WriteArgs.Params;
341
+ withFieldContext(context: Record<string, number | bigint>): this;
342
+ private __tnResolveFieldRef;
343
+ static builder(): WriteArgsBuilder;
344
+ static fromBuilder(builder: WriteArgsBuilder): WriteArgs | null;
345
+ static readonly flexibleArrayWriters: readonly [{
346
+ readonly field: "data";
347
+ readonly method: "data";
348
+ readonly sizeField: "data_len";
349
+ readonly paramKey: "data_len";
350
+ readonly elementSize: 1;
351
+ }];
352
+ private static __tnExtractParams;
353
+ get_buffer_account_idx(): number;
354
+ set_buffer_account_idx(value: number): void;
355
+ get buffer_account_idx(): number;
356
+ set buffer_account_idx(value: number);
357
+ get_meta_account_idx(): number;
358
+ set_meta_account_idx(value: number): void;
359
+ get meta_account_idx(): number;
360
+ set meta_account_idx(value: number);
361
+ get_data_len(): number;
362
+ set_data_len(value: number): void;
363
+ get data_len(): number;
364
+ set data_len(value: number);
365
+ get_data_offset(): number;
366
+ set_data_offset(value: number): void;
367
+ get data_offset(): number;
368
+ set data_offset(value: number);
369
+ get_data_length(): number;
370
+ get_data_at(index: number): number;
371
+ get_data(): number[];
372
+ set_data_at(index: number, value: number): void;
373
+ set_data(value: number[]): void;
374
+ get data(): number[];
375
+ set data(value: number[]);
376
+ private static __tnFootprintInternal;
377
+ private static __tnValidateInternal;
378
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
379
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult;
380
+ static footprintIr(data_data_len: number | bigint): bigint;
381
+ private static __tnPackParams;
382
+ static footprintIrFromParams(params: WriteArgs.Params): bigint;
383
+ static footprintFromParams(params: WriteArgs.Params): number;
384
+ static footprintFromValues(input: {
385
+ data_data_len: number | bigint;
386
+ }): number;
387
+ static footprint(params: WriteArgs.Params): number;
388
+ static validate(buffer: Uint8Array, opts?: {
389
+ params?: WriteArgs.Params;
390
+ }): {
391
+ ok: boolean;
392
+ code?: string;
393
+ consumed?: number;
394
+ params?: WriteArgs.Params;
395
+ };
396
+ static from_array(buffer: Uint8Array, opts?: {
397
+ params?: WriteArgs.Params;
398
+ }): WriteArgs | null;
399
+ }
400
+ declare namespace WriteArgs {
401
+ type Params = {
402
+ /** ABI path: data.data_len */
403
+ readonly data_data_len: bigint;
404
+ };
405
+ const ParamKeys: Readonly<{
406
+ readonly data_data_len: "data.data_len";
407
+ }>;
408
+ const Params: {
409
+ fromValues(input: {
410
+ data_data_len: number | bigint;
411
+ }): Params;
412
+ fromBuilder(source: {
413
+ dynamicParams(): Params;
414
+ } | {
415
+ params: Params;
416
+ } | Params): Params;
417
+ };
418
+ function params(input: {
419
+ data_data_len: number | bigint;
420
+ }): Params;
421
+ }
422
+ declare class WriteArgsBuilder {
423
+ private buffer;
424
+ private view;
425
+ private __tnCachedParams;
426
+ private __tnLastBuffer;
427
+ private __tnLastParams;
428
+ private __tnFam_data;
429
+ private __tnFam_dataCount;
430
+ private __tnFamWriter_data?;
431
+ constructor();
432
+ private __tnInvalidate;
433
+ set_buffer_account_idx(value: number): this;
434
+ set_meta_account_idx(value: number): this;
435
+ set_data_len(value: number): this;
436
+ set_data_offset(value: number): this;
437
+ data(): __TnFamWriterResult<WriteArgsBuilder>;
438
+ build(): Uint8Array;
439
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
440
+ finish(): WriteArgs;
441
+ finishView(): WriteArgs;
442
+ dynamicParams(): WriteArgs.Params;
443
+ private __tnComputeParams;
444
+ private __tnWriteInto;
445
+ private __tnValidateOrThrow;
446
+ }
447
+ declare class CreateArgs {
448
+ private buffer;
449
+ private view;
450
+ private __tnFieldContext;
451
+ private __tnParams;
452
+ private constructor();
453
+ static __tnCreateView(buffer: Uint8Array, opts?: {
454
+ params?: CreateArgs.Params;
455
+ fieldContext?: Record<string, number | bigint>;
456
+ }): CreateArgs;
457
+ dynamicParams(): CreateArgs.Params;
458
+ withFieldContext(context: Record<string, number | bigint>): this;
459
+ private __tnResolveFieldRef;
460
+ static builder(): CreateArgsBuilder;
461
+ static fromBuilder(builder: CreateArgsBuilder): CreateArgs | null;
462
+ static readonly flexibleArrayWriters: readonly [{
463
+ readonly field: "seed";
464
+ readonly method: "seed";
465
+ readonly sizeField: "seed_len";
466
+ readonly paramKey: "seed_len";
467
+ readonly elementSize: 1;
468
+ }];
469
+ private static __tnExtractParams;
470
+ get_buffer_account_idx(): number;
471
+ set_buffer_account_idx(value: number): void;
472
+ get buffer_account_idx(): number;
473
+ set buffer_account_idx(value: number);
474
+ get_meta_account_idx(): number;
475
+ set_meta_account_idx(value: number): void;
476
+ get meta_account_idx(): number;
477
+ set meta_account_idx(value: number);
478
+ get_authority_account_idx(): number;
479
+ set_authority_account_idx(value: number): void;
480
+ get authority_account_idx(): number;
481
+ set authority_account_idx(value: number);
482
+ get_buffer_account_sz(): number;
483
+ set_buffer_account_sz(value: number): void;
484
+ get buffer_account_sz(): number;
485
+ set buffer_account_sz(value: number);
486
+ get_expected_account_hash(): Hash;
487
+ set_expected_account_hash(value: Hash): void;
488
+ get expected_account_hash(): Hash;
489
+ set expected_account_hash(value: Hash);
490
+ get_seed_len(): number;
491
+ set_seed_len(value: number): void;
492
+ get seed_len(): number;
493
+ set seed_len(value: number);
494
+ get_seed_length(): number;
495
+ get_seed_at(index: number): number;
496
+ get_seed(): number[];
497
+ set_seed_at(index: number, value: number): void;
498
+ set_seed(value: number[]): void;
499
+ get seed(): number[];
500
+ set seed(value: number[]);
501
+ private static __tnFootprintInternal;
502
+ private static __tnValidateInternal;
503
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
504
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult;
505
+ static footprintIr(seed_seed_len: number | bigint): bigint;
506
+ private static __tnPackParams;
507
+ static footprintIrFromParams(params: CreateArgs.Params): bigint;
508
+ static footprintFromParams(params: CreateArgs.Params): number;
509
+ static footprintFromValues(input: {
510
+ seed_seed_len: number | bigint;
511
+ }): number;
512
+ static footprint(params: CreateArgs.Params): number;
513
+ static validate(buffer: Uint8Array, opts?: {
514
+ params?: CreateArgs.Params;
515
+ }): {
516
+ ok: boolean;
517
+ code?: string;
518
+ consumed?: number;
519
+ params?: CreateArgs.Params;
520
+ };
521
+ static from_array(buffer: Uint8Array, opts?: {
522
+ params?: CreateArgs.Params;
523
+ }): CreateArgs | null;
524
+ }
525
+ declare namespace CreateArgs {
526
+ type Params = {
527
+ /** ABI path: seed.seed_len */
528
+ readonly seed_seed_len: bigint;
529
+ };
530
+ const ParamKeys: Readonly<{
531
+ readonly seed_seed_len: "seed.seed_len";
532
+ }>;
533
+ const Params: {
534
+ fromValues(input: {
535
+ seed_seed_len: number | bigint;
536
+ }): Params;
537
+ fromBuilder(source: {
538
+ dynamicParams(): Params;
539
+ } | {
540
+ params: Params;
541
+ } | Params): Params;
542
+ };
543
+ function params(input: {
544
+ seed_seed_len: number | bigint;
545
+ }): Params;
546
+ }
547
+ declare class CreateArgsBuilder {
548
+ private buffer;
549
+ private view;
550
+ private __tnCachedParams;
551
+ private __tnLastBuffer;
552
+ private __tnLastParams;
553
+ private __tnFam_seed;
554
+ private __tnFam_seedCount;
555
+ private __tnFamWriter_seed?;
556
+ constructor();
557
+ private __tnInvalidate;
558
+ set_buffer_account_idx(value: number): this;
559
+ set_meta_account_idx(value: number): this;
560
+ set_authority_account_idx(value: number): this;
561
+ set_buffer_account_sz(value: number): this;
562
+ set_expected_account_hash(value: Uint8Array): this;
563
+ set_seed_len(value: number): this;
564
+ seed(): __TnFamWriterResult<CreateArgsBuilder>;
565
+ build(): Uint8Array;
566
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
567
+ finish(): CreateArgs;
568
+ finishView(): CreateArgs;
569
+ dynamicParams(): CreateArgs.Params;
570
+ private __tnComputeParams;
571
+ private __tnWriteInto;
572
+ private __tnValidateOrThrow;
573
+ }
574
+ declare class FinalizeArgs {
575
+ private buffer;
576
+ private view;
577
+ private constructor();
578
+ static __tnCreateView(buffer: Uint8Array, opts?: {
579
+ fieldContext?: Record<string, number | bigint>;
580
+ }): FinalizeArgs;
581
+ static builder(): FinalizeArgsBuilder;
582
+ static fromBuilder(builder: FinalizeArgsBuilder): FinalizeArgs | null;
583
+ get_buffer_account_idx(): number;
584
+ set_buffer_account_idx(value: number): void;
585
+ get buffer_account_idx(): number;
586
+ set buffer_account_idx(value: number);
587
+ get_meta_account_idx(): number;
588
+ set_meta_account_idx(value: number): void;
589
+ get meta_account_idx(): number;
590
+ set meta_account_idx(value: number);
591
+ get_expected_account_hash(): Hash;
592
+ set_expected_account_hash(value: Hash): void;
593
+ get expected_account_hash(): Hash;
594
+ set expected_account_hash(value: Hash);
595
+ private static __tnFootprintInternal;
596
+ private static __tnValidateInternal;
597
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
598
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult;
599
+ static footprintIr(): bigint;
600
+ static footprint(): number;
601
+ static validate(buffer: Uint8Array, _opts?: {
602
+ params?: never;
603
+ }): {
604
+ ok: boolean;
605
+ code?: string;
606
+ consumed?: number;
607
+ };
608
+ static from_array(buffer: Uint8Array): FinalizeArgs | null;
609
+ }
610
+ declare class FinalizeArgsBuilder {
611
+ private buffer;
612
+ private view;
613
+ constructor();
614
+ set_buffer_account_idx(value: number): this;
615
+ set_meta_account_idx(value: number): this;
616
+ set_expected_account_hash(value: Uint8Array): this;
617
+ build(): Uint8Array;
618
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
619
+ finish(): FinalizeArgs;
620
+ }
621
+ declare class UploaderInstruction_payload_Inner {
622
+ private buffer;
623
+ private descriptor;
624
+ private view;
625
+ private __tnFieldContext;
626
+ private constructor();
627
+ static __tnCreate(payload: Uint8Array, descriptor: __TnVariantDescriptor | null, fieldContext?: Record<string, number | bigint>): UploaderInstruction_payload_Inner;
628
+ bytes(): Uint8Array;
629
+ variant(): __TnVariantDescriptor | null;
630
+ asCreate(): CreateArgs | null;
631
+ asWrite(): WriteArgs | null;
632
+ asDestroy(): DestroyArgs | null;
633
+ asFinalize(): FinalizeArgs | null;
634
+ }
635
+ declare class UploaderInstruction {
636
+ private buffer;
637
+ private view;
638
+ private static readonly __tnFieldOffset_payload;
639
+ private __tnParams;
640
+ private constructor();
641
+ static __tnCreateView(buffer: Uint8Array, opts?: {
642
+ params?: UploaderInstruction.Params;
643
+ fieldContext?: Record<string, number | bigint>;
644
+ }): UploaderInstruction;
645
+ dynamicParams(): UploaderInstruction.Params;
646
+ static builder(): UploaderInstructionBuilder;
647
+ static fromBuilder(builder: UploaderInstructionBuilder): UploaderInstruction | null;
648
+ static readonly payloadVariantDescriptors: readonly [{
649
+ readonly name: "create";
650
+ readonly tag: 0;
651
+ readonly payloadSize: null;
652
+ readonly payloadType: "UploaderInstruction::payload::create";
653
+ readonly createPayloadBuilder: () => unknown;
654
+ }, {
655
+ readonly name: "write";
656
+ readonly tag: 1;
657
+ readonly payloadSize: null;
658
+ readonly payloadType: "UploaderInstruction::payload::write";
659
+ readonly createPayloadBuilder: () => unknown;
660
+ }, {
661
+ readonly name: "destroy";
662
+ readonly tag: 2;
663
+ readonly payloadSize: 4;
664
+ readonly payloadType: "UploaderInstruction::payload::destroy";
665
+ readonly createPayloadBuilder: () => unknown;
666
+ }, {
667
+ readonly name: "finalize";
668
+ readonly tag: 3;
669
+ readonly payloadSize: 36;
670
+ readonly payloadType: "UploaderInstruction::payload::finalize";
671
+ readonly createPayloadBuilder: () => unknown;
672
+ }];
673
+ static __tnComputeSequentialLayout(view: DataView, buffer: Uint8Array): {
674
+ params: Record<string, bigint> | null;
675
+ offsets: Record<string, number> | null;
676
+ derived: Record<string, bigint> | null;
677
+ } | null;
678
+ private static __tnExtractParams;
679
+ get_tag(): number;
680
+ set_tag(value: number): void;
681
+ get tag(): number;
682
+ set tag(value: number);
683
+ payloadVariant(): typeof UploaderInstruction.payloadVariantDescriptors[number] | null;
684
+ payload(): UploaderInstruction_payload_Inner;
685
+ private static __tnFootprintInternal;
686
+ private static __tnValidateInternal;
687
+ static __tnInvokeFootprint(__tnParams: Record<string, bigint>): bigint;
688
+ static __tnInvokeValidate(buffer: Uint8Array, __tnParams: Record<string, bigint>): __TnValidateResult;
689
+ static footprintIr(payload_payload_size: number | bigint, payload_tag: number | bigint): bigint;
690
+ private static __tnPackParams;
691
+ static footprintIrFromParams(params: UploaderInstruction.Params): bigint;
692
+ static footprintFromParams(params: UploaderInstruction.Params): number;
693
+ static footprintFromValues(input: {
694
+ payload_payload_size: number | bigint;
695
+ payload_tag: number | bigint;
696
+ }): number;
697
+ static footprint(params: UploaderInstruction.Params): number;
698
+ static validate(buffer: Uint8Array, opts?: {
699
+ params?: UploaderInstruction.Params;
700
+ }): {
701
+ ok: boolean;
702
+ code?: string;
703
+ consumed?: number;
704
+ params?: UploaderInstruction.Params;
705
+ };
706
+ static from_array(buffer: Uint8Array, opts?: {
707
+ params?: UploaderInstruction.Params;
708
+ }): UploaderInstruction | null;
709
+ }
710
+ declare namespace UploaderInstruction {
711
+ type Params = {
712
+ /** ABI path: payload.payload_size */
713
+ readonly payload_payload_size: bigint;
714
+ /** ABI path: payload.tag */
715
+ readonly payload_tag: bigint;
716
+ };
717
+ const ParamKeys: Readonly<{
718
+ readonly payload_payload_size: "payload.payload_size";
719
+ readonly payload_tag: "payload.tag";
720
+ }>;
721
+ const Params: {
722
+ fromValues(input: {
723
+ payload_payload_size: number | bigint;
724
+ payload_tag: number | bigint;
725
+ }): Params;
726
+ fromBuilder(source: {
727
+ dynamicParams(): Params;
728
+ } | {
729
+ params: Params;
730
+ } | Params): Params;
731
+ };
732
+ function params(input: {
733
+ payload_payload_size: number | bigint;
734
+ payload_tag: number | bigint;
735
+ }): Params;
736
+ }
737
+ declare class UploaderInstructionBuilder {
738
+ private __tnPrefixBuffer;
739
+ private __tnPrefixView;
740
+ private __tnField_tag;
741
+ private __tnPayload_payload;
742
+ private __tnCachedParams;
743
+ private __tnLastBuffer;
744
+ private __tnLastParams;
745
+ private __tnVariantSelector_payload?;
746
+ constructor();
747
+ private __tnInvalidate;
748
+ private __tnAssign_tag;
749
+ set_tag(value: number): this;
750
+ payload(): __TnVariantSelectorResult<UploaderInstructionBuilder>;
751
+ build(): Uint8Array;
752
+ buildInto(target: Uint8Array, offset?: number): Uint8Array;
753
+ finish(): UploaderInstruction;
754
+ finishView(): UploaderInstruction;
755
+ dynamicParams(): UploaderInstruction.Params;
756
+ private __tnComputeParams;
757
+ private __tnWriteInto;
758
+ private __tnValidateOrThrow;
759
+ }
760
+
761
+ export { CreateArgs, CreateArgsBuilder, type CreateUploadBufferInstructionArgs, DestroyArgs, DestroyArgsBuilder, type DestroyUploadInstructionArgs, FinalizeArgs, FinalizeArgsBuilder, type FinalizeUploadInstructionArgs, InstructionData, ProgramSeed, UPLOADER_DEFAULT_CHUNK_SIZE, UPLOADER_ERRORS, UPLOADER_MAX_CHUNK_SIZE, UPLOADER_META_SIZE, UPLOADER_MIN_CHUNK_SIZE, UPLOADER_PROGRAM_ADDRESS, UPLOADER_PROGRAM_PUBKEY, UPLOADER_STATE_FINALIZED, UPLOADER_STATE_OPEN, type UploadAddresses, UploaderError, UploaderErrorBuilder, type UploaderErrorName, UploaderInstruction, type UploaderInstructionArgs, UploaderInstructionBuilder, UploaderInstruction_payload_Inner, UploaderProgramMeta, UploaderProgramMetaBuilder, type UploaderProgramMetaInfo, WriteArgs, WriteArgsBuilder, type WriteUploadInstructionArgs, buildUploaderInstructionBytes, createDestroyUploadInstruction, createFinalizeUploadInstruction, createUploadBufferInstruction, createWriteUploadInstruction, deriveUploadAddresses, parseUploaderProgramMeta, uploaderErrorName };