@dfinity/ledger-icrc 6.0.1 → 7.0.0-next-2025-12-11

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 (48) hide show
  1. package/dist/index.d.ts +23 -17
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +4 -4
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +4 -4
  6. package/package.json +4 -5
  7. package/dist/candid/icrc_index-ng.certified.idl.d.ts +0 -2
  8. package/dist/candid/icrc_index-ng.certified.idl.js +0 -151
  9. package/dist/candid/icrc_index-ng.d.ts +0 -154
  10. package/dist/candid/icrc_index-ng.did +0 -156
  11. package/dist/candid/icrc_index-ng.idl.d.ts +0 -2
  12. package/dist/candid/icrc_index-ng.idl.js +0 -151
  13. package/dist/candid/icrc_index.certified.idl.d.ts +0 -2
  14. package/dist/candid/icrc_index.certified.idl.js +0 -99
  15. package/dist/candid/icrc_index.d.ts +0 -108
  16. package/dist/candid/icrc_index.did +0 -98
  17. package/dist/candid/icrc_index.idl.d.ts +0 -2
  18. package/dist/candid/icrc_index.idl.js +0 -99
  19. package/dist/candid/icrc_ledger.certified.idl.d.ts +0 -2
  20. package/dist/candid/icrc_ledger.certified.idl.js +0 -525
  21. package/dist/candid/icrc_ledger.d.ts +0 -590
  22. package/dist/candid/icrc_ledger.did +0 -579
  23. package/dist/candid/icrc_ledger.idl.d.ts +0 -2
  24. package/dist/candid/icrc_ledger.idl.js +0 -545
  25. package/dist/candid/icrc_nft-ledger.certified.idl.d.ts +0 -2
  26. package/dist/candid/icrc_nft-ledger.certified.idl.js +0 -102
  27. package/dist/candid/icrc_nft-ledger.d.ts +0 -80
  28. package/dist/candid/icrc_nft-ledger.did +0 -67
  29. package/dist/candid/icrc_nft-ledger.idl.d.ts +0 -2
  30. package/dist/candid/icrc_nft-ledger.idl.js +0 -106
  31. package/dist/canister.d.ts +0 -13
  32. package/dist/converters/converters.d.ts +0 -16
  33. package/dist/converters/index.converters.d.ts +0 -6
  34. package/dist/converters/ledger.converters.d.ts +0 -6
  35. package/dist/errors/index.errors.d.ts +0 -2
  36. package/dist/errors/ledger.errors.d.ts +0 -25
  37. package/dist/index-ng.canister.d.ts +0 -43
  38. package/dist/index.canister.d.ts +0 -21
  39. package/dist/ledger.canister.d.ts +0 -127
  40. package/dist/types/canister.options.d.ts +0 -5
  41. package/dist/types/index-ng.params.d.ts +0 -12
  42. package/dist/types/index-ng.types.d.ts +0 -1
  43. package/dist/types/index.params.d.ts +0 -7
  44. package/dist/types/index.types.d.ts +0 -1
  45. package/dist/types/ledger.params.d.ts +0 -109
  46. package/dist/types/ledger.responses.d.ts +0 -24
  47. package/dist/utils/ledger.utils.d.ts +0 -31
  48. package/dist/utils/payment.utils.d.ts +0 -28
@@ -1,579 +0,0 @@
1
- // Generated from IC repo commit fa06b0e (2025-11-12 tags: release-2025-11-13_03-24-base) 'rs/ledger_suite/icrc1/ledger/ledger.did' by import-candid
2
-
3
- type BlockIndex = nat;
4
- type Subaccount = blob;
5
- // Number of nanoseconds since the UNIX epoch in UTC timezone.
6
- type Timestamp = nat64;
7
- // Number of nanoseconds between two [Timestamp]s.
8
- type Duration = nat64;
9
- type Tokens = nat;
10
- type TxIndex = nat;
11
- type Allowance = record { allowance : nat; expires_at : opt Timestamp };
12
- type AllowanceArgs = record { account : Account; spender : Account };
13
- type Approve = record {
14
- fee : opt nat;
15
- from : Account;
16
- memo : opt blob;
17
- created_at_time : opt Timestamp;
18
- amount : nat;
19
- expected_allowance : opt nat;
20
- expires_at : opt Timestamp;
21
- spender : Account
22
- };
23
- type ApproveArgs = record {
24
- fee : opt nat;
25
- memo : opt blob;
26
- from_subaccount : opt blob;
27
- created_at_time : opt Timestamp;
28
- amount : nat;
29
- expected_allowance : opt nat;
30
- expires_at : opt Timestamp;
31
- spender : Account
32
- };
33
- type ApproveError = variant {
34
- GenericError : record { message : text; error_code : nat };
35
- TemporarilyUnavailable;
36
- Duplicate : record { duplicate_of : BlockIndex };
37
- BadFee : record { expected_fee : nat };
38
- AllowanceChanged : record { current_allowance : nat };
39
- CreatedInFuture : record { ledger_time : Timestamp };
40
- TooOld;
41
- Expired : record { ledger_time : Timestamp };
42
- InsufficientFunds : record { balance : nat }
43
- };
44
- type ApproveResult = variant { Ok : BlockIndex; Err : ApproveError };
45
-
46
- type HttpRequest = record {
47
- url : text;
48
- method : text;
49
- body : blob;
50
- headers : vec record { text; text }
51
- };
52
- type HttpResponse = record {
53
- body : blob;
54
- headers : vec record { text; text };
55
- status_code : nat16
56
- };
57
-
58
- type Account = record {
59
- owner : principal;
60
- subaccount : opt Subaccount
61
- };
62
-
63
- type TransferArg = record {
64
- from_subaccount : opt Subaccount;
65
- to : Account;
66
- amount : Tokens;
67
- fee : opt Tokens;
68
- memo : opt blob;
69
- created_at_time : opt Timestamp
70
- };
71
-
72
- type TransferError = variant {
73
- BadFee : record { expected_fee : Tokens };
74
- BadBurn : record { min_burn_amount : Tokens };
75
- InsufficientFunds : record { balance : Tokens };
76
- TooOld;
77
- CreatedInFuture : record { ledger_time : Timestamp };
78
- TemporarilyUnavailable;
79
- Duplicate : record { duplicate_of : BlockIndex };
80
- GenericError : record { error_code : nat; message : text }
81
- };
82
-
83
- type TransferResult = variant {
84
- Ok : BlockIndex;
85
- Err : TransferError
86
- };
87
-
88
- // The value returned from the [icrc1_metadata] endpoint.
89
- type MetadataValue = variant {
90
- Nat : nat;
91
- Int : int;
92
- Text : text;
93
- Blob : blob
94
- };
95
-
96
- type FeatureFlags = record {
97
- icrc2 : bool
98
- };
99
-
100
- // The initialization parameters of the Ledger
101
- type InitArgs = record {
102
- minting_account : Account;
103
- fee_collector_account : opt Account;
104
- transfer_fee : nat;
105
- decimals : opt nat8;
106
- max_memo_length : opt nat16;
107
- token_symbol : text;
108
- token_name : text;
109
- metadata : vec record { text; MetadataValue };
110
- initial_balances : vec record { Account; nat };
111
- feature_flags : opt FeatureFlags;
112
- archive_options : record {
113
- num_blocks_to_archive : nat64;
114
- max_transactions_per_response : opt nat64;
115
- trigger_threshold : nat64;
116
- max_message_size_bytes : opt nat64;
117
- cycles_for_archive_creation : opt nat64;
118
- node_max_memory_size_bytes : opt nat64;
119
- controller_id : principal;
120
- more_controller_ids : opt vec principal
121
- };
122
- index_principal : opt principal
123
- };
124
-
125
- type ChangeFeeCollector = variant {
126
- Unset;
127
- SetTo : Account
128
- };
129
-
130
- type ChangeArchiveOptions = record {
131
- num_blocks_to_archive : opt nat64;
132
- max_transactions_per_response : opt nat64;
133
- trigger_threshold : opt nat64;
134
- max_message_size_bytes : opt nat64;
135
- cycles_for_archive_creation : opt nat64;
136
- node_max_memory_size_bytes : opt nat64;
137
- controller_id : opt principal;
138
- more_controller_ids : opt vec principal
139
- };
140
-
141
- type UpgradeArgs = record {
142
- metadata : opt vec record { text; MetadataValue };
143
- token_symbol : opt text;
144
- token_name : opt text;
145
- transfer_fee : opt nat;
146
- change_fee_collector : opt ChangeFeeCollector;
147
- max_memo_length : opt nat16;
148
- feature_flags : opt FeatureFlags;
149
- change_archive_options : opt ChangeArchiveOptions;
150
- index_principal : opt principal
151
- };
152
-
153
- type LedgerArg = variant {
154
- Init : InitArgs;
155
- Upgrade : opt UpgradeArgs
156
- };
157
-
158
- type GetTransactionsRequest = record {
159
- // The index of the first tx to fetch.
160
- start : TxIndex;
161
- // The number of transactions to fetch.
162
- length : nat
163
- };
164
-
165
- type GetTransactionsResponse = record {
166
- // The total number of transactions in the log.
167
- log_length : nat;
168
-
169
- // List of transaction that were available in the ledger when it processed the call.
170
- //
171
- // The transactions form a contiguous range, with the first transaction having index
172
- // [first_index] (see below), and the last transaction having index
173
- // [first_index] + len(transactions) - 1.
174
- //
175
- // The transaction range can be an arbitrary sub-range of the originally requested range.
176
- transactions : vec Transaction;
177
-
178
- // The index of the first transaction in [transactions].
179
- // If the transaction vector is empty, the exact value of this field is not specified.
180
- first_index : TxIndex;
181
-
182
- // Encoding of instructions for fetching archived transactions whose indices fall into the
183
- // requested range.
184
- //
185
- // For each entry `e` in [archived_transactions], `[e.from, e.from + len)` is a sub-range
186
- // of the originally requested transaction range.
187
- archived_transactions : vec record {
188
- // The index of the first archived transaction you can fetch using the [callback].
189
- start : TxIndex;
190
-
191
- // The number of transactions you can fetch using the callback.
192
- length : nat;
193
-
194
- // The function you should call to fetch the archived transactions.
195
- // The range of the transaction accessible using this function is given by [from]
196
- // and [len] fields above.
197
- callback : QueryArchiveFn
198
- }
199
- };
200
-
201
- // A prefix of the transaction range specified in the [GetTransactionsRequest] request.
202
- type TransactionRange = record {
203
- // A prefix of the requested transaction range.
204
- // The index of the first transaction is equal to [GetTransactionsRequest.from].
205
- //
206
- // Note that the number of transactions might be less than the requested
207
- // [GetTransactionsRequest.length] for various reasons, for example:
208
- //
209
- // 1. The query might have hit the replica with an outdated state
210
- // that doesn't have the whole range yet.
211
- // 2. The requested range is too large to fit into a single reply.
212
- //
213
- // NOTE: the list of transactions can be empty if:
214
- //
215
- // 1. [GetTransactionsRequest.length] was zero.
216
- // 2. [GetTransactionsRequest.from] was larger than the last transaction known to
217
- // the canister.
218
- transactions : vec Transaction
219
- };
220
-
221
- // A function for fetching archived transaction.
222
- type QueryArchiveFn = func(GetTransactionsRequest) -> (TransactionRange) query;
223
-
224
- type Transaction = record {
225
- burn : opt Burn;
226
- kind : text;
227
- mint : opt Mint;
228
- approve : opt Approve;
229
- timestamp : Timestamp;
230
- transfer : opt Transfer
231
- };
232
-
233
- type Burn = record {
234
- from : Account;
235
- memo : opt blob;
236
- created_at_time : opt Timestamp;
237
- amount : nat;
238
- spender : opt Account;
239
- fee : opt nat
240
- };
241
-
242
- type Mint = record {
243
- to : Account;
244
- memo : opt blob;
245
- created_at_time : opt Timestamp;
246
- amount : nat;
247
- fee : opt nat
248
- };
249
-
250
- type Transfer = record {
251
- to : Account;
252
- fee : opt nat;
253
- from : Account;
254
- memo : opt blob;
255
- created_at_time : opt Timestamp;
256
- amount : nat;
257
- spender : opt Account
258
- };
259
-
260
- type Value = variant {
261
- Blob : blob;
262
- Text : text;
263
- Nat : nat;
264
- Nat64 : nat64;
265
- Int : int;
266
- Array : vec Value;
267
- Map : Map
268
- };
269
-
270
- type Map = vec record { text; Value };
271
-
272
- type Block = Value;
273
-
274
- type GetBlocksArgs = record {
275
- // The index of the first block to fetch.
276
- start : BlockIndex;
277
- // Max number of blocks to fetch.
278
- length : nat
279
- };
280
-
281
- // A prefix of the block range specified in the [GetBlocksArgs] request.
282
- type BlockRange = record {
283
- // A prefix of the requested block range.
284
- // The index of the first block is equal to [GetBlocksArgs.start].
285
- //
286
- // Note that the number of blocks might be less than the requested
287
- // [GetBlocksArgs.length] for various reasons, for example:
288
- //
289
- // 1. The query might have hit the replica with an outdated state
290
- // that doesn't have the whole range yet.
291
- // 2. The requested range is too large to fit into a single reply.
292
- //
293
- // NOTE: the list of blocks can be empty if:
294
- //
295
- // 1. [GetBlocksArgs.length] was zero.
296
- // 2. [GetBlocksArgs.start] was larger than the last block known to
297
- // the canister.
298
- blocks : vec Block
299
- };
300
-
301
- // A function for fetching archived blocks.
302
- type QueryBlockArchiveFn = func(GetBlocksArgs) -> (BlockRange) query;
303
-
304
- // The result of a "get_blocks" call.
305
- type GetBlocksResponse = record {
306
- // The index of the first block in "blocks".
307
- // If the blocks vector is empty, the exact value of this field is not specified.
308
- first_index : BlockIndex;
309
-
310
- // The total number of blocks in the chain.
311
- // If the chain length is positive, the index of the last block is `chain_len - 1`.
312
- chain_length : nat64;
313
-
314
- // System certificate for the hash of the latest block in the chain.
315
- // Only present if `get_blocks` is called in a non-replicated query context.
316
- certificate : opt blob;
317
-
318
- // List of blocks that were available in the ledger when it processed the call.
319
- //
320
- // The blocks form a contiguous range, with the first block having index
321
- // [first_block_index] (see below), and the last block having index
322
- // [first_block_index] + len(blocks) - 1.
323
- //
324
- // The block range can be an arbitrary sub-range of the originally requested range.
325
- blocks : vec Block;
326
-
327
- // Encoding of instructions for fetching archived blocks.
328
- archived_blocks : vec record {
329
- // The index of the first archived block.
330
- start : BlockIndex;
331
-
332
- // The number of blocks that can be fetched.
333
- length : nat;
334
-
335
- // Callback to fetch the archived blocks.
336
- callback : QueryBlockArchiveFn
337
- }
338
- };
339
-
340
- // Certificate for the block at `block_index`.
341
- type DataCertificate = record {
342
- certificate : opt blob;
343
- hash_tree : blob
344
- };
345
-
346
- type StandardRecord = record { url : text; name : text };
347
-
348
- type TransferFromArgs = record {
349
- spender_subaccount : opt Subaccount;
350
- from : Account;
351
- to : Account;
352
- amount : Tokens;
353
- fee : opt Tokens;
354
- memo : opt blob;
355
- created_at_time : opt Timestamp
356
- };
357
-
358
- type TransferFromResult = variant {
359
- Ok : BlockIndex;
360
- Err : TransferFromError
361
- };
362
-
363
- type TransferFromError = variant {
364
- BadFee : record { expected_fee : Tokens };
365
- BadBurn : record { min_burn_amount : Tokens };
366
- InsufficientFunds : record { balance : Tokens };
367
- InsufficientAllowance : record { allowance : Tokens };
368
- TooOld;
369
- CreatedInFuture : record { ledger_time : Timestamp };
370
- Duplicate : record { duplicate_of : BlockIndex };
371
- TemporarilyUnavailable;
372
- GenericError : record { error_code : nat; message : text }
373
- };
374
-
375
- type ArchiveInfo = record {
376
- canister_id : principal;
377
- block_range_start : BlockIndex;
378
- block_range_end : BlockIndex
379
- };
380
-
381
- type ICRC3Value = variant {
382
- Blob : blob;
383
- Text : text;
384
- Nat : nat;
385
- Int : int;
386
- Array : vec ICRC3Value;
387
- Map : vec record { text; ICRC3Value }
388
- };
389
-
390
- type GetArchivesArgs = record {
391
- // The last archive seen by the client.
392
- // The Ledger will return archives coming
393
- // after this one if set, otherwise it
394
- // will return the first archives.
395
- from : opt principal
396
- };
397
-
398
- type GetArchivesResult = vec record {
399
- // The id of the archive
400
- canister_id : principal;
401
-
402
- // The first block in the archive
403
- start : nat;
404
-
405
- // The last block in the archive
406
- end : nat
407
- };
408
-
409
- type GetBlocksResult = record {
410
- // Total number of blocks in the
411
- // block log
412
- log_length : nat;
413
-
414
- blocks : vec record { id : nat; block : ICRC3Value };
415
-
416
- archived_blocks : vec record {
417
- args : vec GetBlocksArgs;
418
- callback : func(vec GetBlocksArgs) -> (GetBlocksResult) query
419
- }
420
- };
421
-
422
- type ICRC3DataCertificate = record {
423
- // See https://internetcomputer.org/docs/current/references/ic-interface-spec#certification
424
- certificate : blob;
425
-
426
- // CBOR encoded hash_tree
427
- hash_tree : blob
428
- };
429
-
430
- type icrc21_consent_message_metadata = record {
431
- language : text;
432
- utc_offset_minutes : opt int16
433
- };
434
-
435
- type icrc21_consent_message_spec = record {
436
- metadata : icrc21_consent_message_metadata;
437
- device_spec : opt variant {
438
- GenericDisplay;
439
- FieldsDisplay
440
- }
441
- };
442
-
443
- type icrc21_consent_message_request = record {
444
- method : text;
445
- arg : blob;
446
- user_preferences : icrc21_consent_message_spec
447
- };
448
-
449
- type Icrc21Value = variant {
450
- TokenAmount : record {
451
- decimals : nat8;
452
- amount : nat64;
453
- symbol : text
454
- };
455
- TimestampSeconds : record {
456
- amount : nat64
457
- };
458
- DurationSeconds : record {
459
- amount : nat64
460
- };
461
- Text : record {
462
- content : text
463
- }
464
- };
465
-
466
- type FieldsDisplay = record {
467
- intent : text;
468
- fields : vec record { text; Icrc21Value }
469
- };
470
-
471
- type icrc21_consent_message = variant {
472
- GenericDisplayMessage : text;
473
- FieldsDisplayMessage : FieldsDisplay
474
- };
475
-
476
- type icrc21_consent_info = record {
477
- consent_message : icrc21_consent_message;
478
- metadata : icrc21_consent_message_metadata
479
- };
480
-
481
- type icrc21_error_info = record {
482
- description : text
483
- };
484
-
485
- type icrc21_error = variant {
486
- UnsupportedCanisterCall : icrc21_error_info;
487
- ConsentMessageUnavailable : icrc21_error_info;
488
- InsufficientPayment : icrc21_error_info;
489
-
490
- // Any error not covered by the above variants.
491
- GenericError : record {
492
- error_code : nat;
493
- description : text
494
- }
495
- };
496
-
497
- type icrc21_consent_message_response = variant {
498
- Ok : icrc21_consent_info;
499
- Err : icrc21_error
500
- };
501
-
502
- type GetAllowancesArgs = record {
503
- from_account : opt Account;
504
- prev_spender : opt Account;
505
- take : opt nat
506
- };
507
-
508
- type Allowance103 = record {
509
- from_account : Account;
510
- to_spender : Account;
511
- allowance : nat;
512
- expires_at : opt nat64
513
- };
514
-
515
- type GetAllowancesError = variant {
516
- AccessDenied : record {
517
- reason : text
518
- };
519
- GenericError : record {
520
- error_code : nat;
521
- message : text
522
- }
523
- };
524
-
525
- type icrc103_get_allowances_response = variant {
526
- Ok : vec Allowance103;
527
- Err : GetAllowancesError
528
- };
529
-
530
- type GetIndexPrincipalResult = variant {
531
- Ok : principal;
532
- Err : GetIndexPrincipalError
533
- };
534
-
535
- type GetIndexPrincipalError = variant {
536
- IndexPrincipalNotSet;
537
-
538
- // Any error not covered by the above variants.
539
- GenericError : record {
540
- error_code : nat;
541
- description : text
542
- }
543
- };
544
-
545
- service : (ledger_arg : LedgerArg) -> {
546
- archives : () -> (vec ArchiveInfo) query;
547
- get_transactions : (GetTransactionsRequest) -> (GetTransactionsResponse) query;
548
- get_blocks : (GetBlocksArgs) -> (GetBlocksResponse) query;
549
- get_data_certificate : () -> (DataCertificate) query;
550
-
551
- icrc1_name : () -> (text) query;
552
- icrc1_symbol : () -> (text) query;
553
- icrc1_decimals : () -> (nat8) query;
554
- icrc1_metadata : () -> (vec record { text; MetadataValue }) query;
555
- icrc1_total_supply : () -> (Tokens) query;
556
- icrc1_fee : () -> (Tokens) query;
557
- icrc1_minting_account : () -> (opt Account) query;
558
- icrc1_balance_of : (Account) -> (Tokens) query;
559
- icrc1_transfer : (TransferArg) -> (TransferResult);
560
- icrc1_supported_standards : () -> (vec StandardRecord) query;
561
-
562
- icrc2_approve : (ApproveArgs) -> (ApproveResult);
563
- icrc2_allowance : (AllowanceArgs) -> (Allowance) query;
564
- icrc2_transfer_from : (TransferFromArgs) -> (TransferFromResult);
565
-
566
- icrc3_get_archives : (GetArchivesArgs) -> (GetArchivesResult) query;
567
- icrc3_get_tip_certificate : () -> (opt ICRC3DataCertificate) query;
568
- icrc3_get_blocks : (vec GetBlocksArgs) -> (GetBlocksResult) query;
569
- icrc3_supported_block_types : () -> (vec record { block_type : text; url : text }) query;
570
-
571
- icrc21_canister_call_consent_message : (icrc21_consent_message_request) -> (icrc21_consent_message_response);
572
- icrc10_supported_standards : () -> (vec record { name : text; url : text }) query;
573
-
574
- icrc103_get_allowances : (GetAllowancesArgs) -> (icrc103_get_allowances_response) query;
575
-
576
- icrc106_get_index_principal : () -> (GetIndexPrincipalResult) query;
577
-
578
- is_ledger_ready : () -> (bool) query
579
- }
@@ -1,2 +0,0 @@
1
- import type { IDL } from "@icp-sdk/core/candid";
2
- export const idlFactory: IDL.InterfaceFactory;