@dfinity/ledger-icrc 3.0.0 → 4.0.0

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.
@@ -122,7 +122,7 @@ export const idlFactory = ({ IDL }) => {
122
122
  [IDL.Vec(SubAccount)],
123
123
  [],
124
124
  ),
125
- 'status' : IDL.Func([], [Status], []),
125
+ 'status' : IDL.Func([], [Status], ['query']),
126
126
  });
127
127
  };
128
128
  export const init = ({ IDL }) => {
@@ -1,40 +1,40 @@
1
- // Generated from IC repo commit 047925d (2025-08-06 tags: release-2025-08-07_03-33-base) 'rs/ledger_suite/icrc1/index-ng/index-ng.did' by import-candid
1
+ // Generated from IC repo commit 9173238 (2025-08-18 tags: release-2025-08-28_03-17-snapshot-feature) 'rs/ledger_suite/icrc1/index-ng/index-ng.did' by import-candid
2
2
  type Tokens = nat;
3
3
 
4
4
  type InitArg = record {
5
- ledger_id: principal;
6
- // The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
7
- // responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
8
- // A higher values means that it takes longer for new blocks to show up in the index.
9
- retrieve_blocks_from_ledger_interval_seconds : opt nat64;
5
+ ledger_id : principal;
6
+ // The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
7
+ // responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
8
+ // A higher values means that it takes longer for new blocks to show up in the index.
9
+ retrieve_blocks_from_ledger_interval_seconds : opt nat64
10
10
  };
11
11
 
12
12
  type UpgradeArg = record {
13
- ledger_id: opt principal;
14
- // The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
15
- // responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
16
- // A higher values means that it takes longer for new blocks to show up in the index.
17
- retrieve_blocks_from_ledger_interval_seconds : opt nat64;
13
+ ledger_id : opt principal;
14
+ // The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
15
+ // responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
16
+ // A higher values means that it takes longer for new blocks to show up in the index.
17
+ retrieve_blocks_from_ledger_interval_seconds : opt nat64
18
18
  };
19
19
 
20
20
  type IndexArg = variant {
21
- Init: InitArg;
22
- Upgrade: UpgradeArg;
21
+ Init : InitArg;
22
+ Upgrade : UpgradeArg
23
23
  };
24
24
 
25
25
  type GetBlocksRequest = record {
26
- start : nat;
27
- length : nat;
26
+ start : nat;
27
+ length : nat
28
28
  };
29
29
 
30
30
  type Value = variant {
31
- Blob : blob;
32
- Text : text;
33
- Nat : nat;
34
- Nat64: nat64;
35
- Int : int;
36
- Array : vec Value;
37
- Map : Map;
31
+ Blob : blob;
32
+ Text : text;
33
+ Nat : nat;
34
+ Nat64 : nat64;
35
+ Int : int;
36
+ Array : vec Value;
37
+ Map : Map
38
38
  };
39
39
 
40
40
  type Map = vec record { text; Value };
@@ -42,8 +42,8 @@ type Map = vec record { text; Value };
42
42
  type Block = Value;
43
43
 
44
44
  type GetBlocksResponse = record {
45
- chain_length: nat64;
46
- blocks: vec Block;
45
+ chain_length : nat64;
46
+ blocks : vec Block
47
47
  };
48
48
 
49
49
  type BlockIndex = nat;
@@ -58,7 +58,7 @@ type Transaction = record {
58
58
  mint : opt Mint;
59
59
  approve : opt Approve;
60
60
  timestamp : nat64;
61
- transfer : opt Transfer;
61
+ transfer : opt Transfer
62
62
  };
63
63
 
64
64
  type Approve = record {
@@ -69,7 +69,7 @@ type Approve = record {
69
69
  amount : Tokens;
70
70
  expected_allowance : opt Tokens;
71
71
  expires_at : opt nat64;
72
- spender : Account;
72
+ spender : Account
73
73
  };
74
74
 
75
75
  type Burn = record {
@@ -77,14 +77,14 @@ type Burn = record {
77
77
  memo : opt vec nat8;
78
78
  created_at_time : opt nat64;
79
79
  amount : Tokens;
80
- spender : opt Account;
80
+ spender : opt Account
81
81
  };
82
82
 
83
83
  type Mint = record {
84
84
  to : Account;
85
85
  memo : opt vec nat8;
86
86
  created_at_time : opt nat64;
87
- amount : Tokens;
87
+ amount : Tokens
88
88
  };
89
89
 
90
90
  type Transfer = record {
@@ -94,60 +94,60 @@ type Transfer = record {
94
94
  memo : opt vec nat8;
95
95
  created_at_time : opt nat64;
96
96
  amount : Tokens;
97
- spender : opt Account;
97
+ spender : opt Account
98
98
  };
99
99
 
100
100
  type GetAccountTransactionsArgs = record {
101
- account : Account;
102
- // The txid of the last transaction seen by the client.
103
- // If None then the results will start from the most recent
104
- // txid. If set then the results will start from the next
105
- // most recent txid after start (start won't be included).
106
- start : opt BlockIndex;
107
- // Maximum number of transactions to fetch.
108
- max_results : nat;
101
+ account : Account;
102
+ // The txid of the last transaction seen by the client.
103
+ // If None then the results will start from the most recent
104
+ // txid. If set then the results will start from the next
105
+ // most recent txid after start (start won't be included).
106
+ start : opt BlockIndex;
107
+ // Maximum number of transactions to fetch.
108
+ max_results : nat
109
109
  };
110
110
 
111
111
  type TransactionWithId = record {
112
112
  id : BlockIndex;
113
- transaction : Transaction;
113
+ transaction : Transaction
114
114
  };
115
115
 
116
116
  type GetTransactions = record {
117
117
  balance : Tokens;
118
118
  transactions : vec TransactionWithId;
119
119
  // The txid of the oldest transaction the account has
120
- oldest_tx_id : opt BlockIndex;
120
+ oldest_tx_id : opt BlockIndex
121
121
  };
122
122
 
123
123
  type GetTransactionsErr = record {
124
- message : text;
124
+ message : text
125
125
  };
126
126
 
127
127
  type GetTransactionsResult = variant {
128
128
  Ok : GetTransactions;
129
- Err : GetTransactionsErr;
129
+ Err : GetTransactionsErr
130
130
  };
131
131
 
132
132
  type ListSubaccountsArgs = record {
133
- owner: principal;
134
- start: opt SubAccount;
133
+ owner : principal;
134
+ start : opt SubAccount
135
135
  };
136
136
 
137
137
  type Status = record {
138
- num_blocks_synced : BlockIndex;
138
+ num_blocks_synced : BlockIndex
139
139
  };
140
140
 
141
141
  type FeeCollectorRanges = record {
142
- ranges : vec record { Account; vec record { BlockIndex; BlockIndex } };
142
+ ranges : vec record { Account; vec record { BlockIndex; BlockIndex } }
143
143
  }
144
144
 
145
- service : (index_arg: opt IndexArg) -> {
146
- get_account_transactions : (GetAccountTransactionsArgs) -> (GetTransactionsResult) query;
147
- get_blocks : (GetBlocksRequest) -> (GetBlocksResponse) query;
148
- get_fee_collectors_ranges : () -> (FeeCollectorRanges) query;
149
- icrc1_balance_of : (Account) -> (Tokens) query;
150
- ledger_id : () -> (principal) query;
151
- list_subaccounts : (ListSubaccountsArgs) -> (vec SubAccount) query;
152
- status : () -> (Status) query;
145
+ service : (index_arg : opt IndexArg) -> {
146
+ get_account_transactions : (GetAccountTransactionsArgs) -> (GetTransactionsResult) query;
147
+ get_blocks : (GetBlocksRequest) -> (GetBlocksResponse) query;
148
+ get_fee_collectors_ranges : () -> (FeeCollectorRanges) query;
149
+ icrc1_balance_of : (Account) -> (Tokens) query;
150
+ ledger_id : () -> (principal) query;
151
+ list_subaccounts : (ListSubaccountsArgs) -> (vec SubAccount) query;
152
+ status : () -> (Status) query
153
153
  }
@@ -242,13 +242,7 @@ export const idlFactory = ({ IDL }) => {
242
242
  const icrc21_consent_message_spec = IDL.Record({
243
243
  'metadata' : icrc21_consent_message_metadata,
244
244
  'device_spec' : IDL.Opt(
245
- IDL.Variant({
246
- 'GenericDisplay' : IDL.Null,
247
- 'LineDisplay' : IDL.Record({
248
- 'characters_per_line' : IDL.Nat16,
249
- 'lines_per_page' : IDL.Nat16,
250
- }),
251
- })
245
+ IDL.Variant({ 'GenericDisplay' : IDL.Null, 'FieldsDisplay' : IDL.Null })
252
246
  ),
253
247
  });
254
248
  const icrc21_consent_message_request = IDL.Record({
@@ -256,10 +250,22 @@ export const idlFactory = ({ IDL }) => {
256
250
  'method' : IDL.Text,
257
251
  'user_preferences' : icrc21_consent_message_spec,
258
252
  });
259
- const icrc21_consent_message = IDL.Variant({
260
- 'LineDisplayMessage' : IDL.Record({
261
- 'pages' : IDL.Vec(IDL.Record({ 'lines' : IDL.Vec(IDL.Text) })),
253
+ const Icrc21Value = IDL.Variant({
254
+ 'Text' : IDL.Record({ 'content' : IDL.Text }),
255
+ 'TokenAmount' : IDL.Record({
256
+ 'decimals' : IDL.Nat8,
257
+ 'amount' : IDL.Nat64,
258
+ 'symbol' : IDL.Text,
262
259
  }),
260
+ 'TimestampSeconds' : IDL.Record({ 'amount' : IDL.Nat64 }),
261
+ 'DurationSeconds' : IDL.Record({ 'amount' : IDL.Nat64 }),
262
+ });
263
+ const FieldsDisplay = IDL.Record({
264
+ 'fields' : IDL.Vec(IDL.Tuple(IDL.Text, Icrc21Value)),
265
+ 'intent' : IDL.Text,
266
+ });
267
+ const icrc21_consent_message = IDL.Variant({
268
+ 'FieldsDisplayMessage' : FieldsDisplay,
263
269
  'GenericDisplayMessage' : IDL.Text,
264
270
  });
265
271
  const icrc21_consent_info = IDL.Record({
@@ -371,7 +377,7 @@ export const idlFactory = ({ IDL }) => {
371
377
  'callback' : IDL.Func(
372
378
  [IDL.Vec(GetBlocksArgs)],
373
379
  [GetBlocksResult],
374
- [],
380
+ ['query'],
375
381
  ),
376
382
  })
377
383
  ),
@@ -443,7 +449,7 @@ export const idlFactory = ({ IDL }) => {
443
449
  [IDL.Vec(IDL.Record({ 'url' : IDL.Text, 'block_type' : IDL.Text }))],
444
450
  [],
445
451
  ),
446
- 'is_ledger_ready' : IDL.Func([], [IDL.Bool], []),
452
+ 'is_ledger_ready' : IDL.Func([], [IDL.Bool], ['query']),
447
453
  });
448
454
  };
449
455
  export const init = ({ IDL }) => {
@@ -89,6 +89,10 @@ export type Duration = bigint;
89
89
  export interface FeatureFlags {
90
90
  icrc2: boolean;
91
91
  }
92
+ export interface FieldsDisplay {
93
+ fields: Array<[string, Icrc21Value]>;
94
+ intent: string;
95
+ }
92
96
  export interface GetAllowancesArgs {
93
97
  take: [] | [bigint];
94
98
  prev_spender: [] | [Account];
@@ -174,6 +178,17 @@ export type ICRC3Value =
174
178
  | { Blob: Uint8Array | number[] }
175
179
  | { Text: string }
176
180
  | { Array: Array<ICRC3Value> };
181
+ export type Icrc21Value =
182
+ | { Text: { content: string } }
183
+ | {
184
+ TokenAmount: {
185
+ decimals: number;
186
+ amount: bigint;
187
+ symbol: string;
188
+ };
189
+ }
190
+ | { TimestampSeconds: { amount: bigint } }
191
+ | { DurationSeconds: { amount: bigint } };
177
192
  export interface InitArgs {
178
193
  decimals: [] | [number];
179
194
  token_symbol: string;
@@ -315,7 +330,7 @@ export interface icrc21_consent_info {
315
330
  }
316
331
  export type icrc21_consent_message =
317
332
  | {
318
- LineDisplayMessage: { pages: Array<{ lines: Array<string> }> };
333
+ FieldsDisplayMessage: FieldsDisplay;
319
334
  }
320
335
  | { GenericDisplayMessage: string };
321
336
  export interface icrc21_consent_message_metadata {
@@ -332,17 +347,7 @@ export type icrc21_consent_message_response =
332
347
  | { Err: icrc21_error };
333
348
  export interface icrc21_consent_message_spec {
334
349
  metadata: icrc21_consent_message_metadata;
335
- device_spec:
336
- | []
337
- | [
338
- | { GenericDisplay: null }
339
- | {
340
- LineDisplay: {
341
- characters_per_line: number;
342
- lines_per_page: number;
343
- };
344
- },
345
- ];
350
+ device_spec: [] | [{ GenericDisplay: null } | { FieldsDisplay: null }];
346
351
  }
347
352
  export type icrc21_error =
348
353
  | {