@dfinity/nns 1.0.0 → 2.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.
Files changed (61) hide show
  1. package/README.md +32 -261
  2. package/dist/cjs/index.cjs.js +2 -8
  3. package/dist/cjs/index.cjs.js.map +4 -4
  4. package/dist/esm/{chunk-OFXRZRFU.js → chunk-IJWQXUQ5.js} +2 -2
  5. package/dist/esm/chunk-KCY3PAEP.js +2 -0
  6. package/dist/esm/chunk-KCY3PAEP.js.map +7 -0
  7. package/dist/esm/chunk-LARRGLCK.js +20 -0
  8. package/dist/esm/chunk-LARRGLCK.js.map +7 -0
  9. package/dist/esm/{chunk-QJA26RTP.js → chunk-YKKQOXDQ.js} +2 -2
  10. package/dist/esm/genesis_token.canister.js +1 -1
  11. package/dist/esm/governance.canister.js +1 -1
  12. package/dist/esm/index.js +1 -1
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/sns_wasm.canister.js +1 -1
  15. package/dist/types/canisters/governance/request.converters.d.ts +1 -1
  16. package/dist/types/constants/canister_ids.d.ts +0 -1
  17. package/dist/types/constants/constants.d.ts +0 -4
  18. package/dist/types/errors/governance.errors.d.ts +0 -2
  19. package/dist/types/governance.canister.d.ts +1 -1
  20. package/dist/types/index.d.ts +0 -7
  21. package/dist/types/types/common.d.ts +0 -1
  22. package/package.json +2 -1
  23. package/dist/candid/ledger.certified.idl.d.ts +0 -2
  24. package/dist/candid/ledger.certified.idl.js +0 -245
  25. package/dist/candid/ledger.d.ts +0 -215
  26. package/dist/candid/ledger.did +0 -380
  27. package/dist/candid/ledger.idl.d.ts +0 -2
  28. package/dist/candid/ledger.idl.js +0 -265
  29. package/dist/esm/account_identifier.js +0 -2
  30. package/dist/esm/account_identifier.js.map +0 -7
  31. package/dist/esm/chunk-2MZ7K2GY.js +0 -4
  32. package/dist/esm/chunk-2MZ7K2GY.js.map +0 -7
  33. package/dist/esm/chunk-DGJWOAUC.js +0 -2
  34. package/dist/esm/chunk-DGJWOAUC.js.map +0 -7
  35. package/dist/esm/chunk-H5FXE6EH.js +0 -8
  36. package/dist/esm/chunk-H5FXE6EH.js.map +0 -7
  37. package/dist/esm/chunk-IS3C7V4B.js +0 -2
  38. package/dist/esm/chunk-IS3C7V4B.js.map +0 -7
  39. package/dist/esm/chunk-JCUF5KWH.js +0 -2
  40. package/dist/esm/chunk-JCUF5KWH.js.map +0 -7
  41. package/dist/esm/chunk-TETJJ4EX.js +0 -20
  42. package/dist/esm/chunk-TETJJ4EX.js.map +0 -7
  43. package/dist/esm/chunk-WDXBCCBB.js +0 -2
  44. package/dist/esm/chunk-WDXBCCBB.js.map +0 -7
  45. package/dist/esm/chunk-ZMUQLPST.js +0 -2
  46. package/dist/esm/chunk-ZMUQLPST.js.map +0 -7
  47. package/dist/esm/icp.js +0 -2
  48. package/dist/esm/icp.js.map +0 -7
  49. package/dist/esm/ledger.canister.js +0 -2
  50. package/dist/esm/ledger.canister.js.map +0 -7
  51. package/dist/types/account_identifier.d.ts +0 -29
  52. package/dist/types/canisters/ledger/ledger.request.converts.d.ts +0 -7
  53. package/dist/types/errors/ledger.errors.d.ts +0 -27
  54. package/dist/types/icp.d.ts +0 -22
  55. package/dist/types/ledger.canister.d.ts +0 -48
  56. package/dist/types/types/ledger.options.d.ts +0 -15
  57. package/dist/types/types/ledger_converters.d.ts +0 -19
  58. package/dist/types/utils/account_identifier.utils.d.ts +0 -5
  59. package/dist/types/utils/accounts.utils.d.ts +0 -6
  60. /package/dist/esm/{chunk-OFXRZRFU.js.map → chunk-IJWQXUQ5.js.map} +0 -0
  61. /package/dist/esm/{chunk-QJA26RTP.js.map → chunk-YKKQOXDQ.js.map} +0 -0
@@ -1,380 +0,0 @@
1
- // Generated from IC repo commit b9fc66eafca530e997313aa68aaac31d41e6a875 'rs/rosetta-api/icp_ledger/ledger.did' by import-candid
2
- // This is the official Ledger interface that is guaranteed to be backward compatible.
3
-
4
- // Amount of tokens, measured in 10^-8 of a token.
5
- type Tokens = record {
6
- e8s : nat64;
7
- };
8
-
9
- // Number of nanoseconds from the UNIX epoch in UTC timezone.
10
- type TimeStamp = record {
11
- timestamp_nanos: nat64;
12
- };
13
-
14
- // AccountIdentifier is a 32-byte array.
15
- // The first 4 bytes is big-endian encoding of a CRC32 checksum of the last 28 bytes.
16
- type AccountIdentifier = blob;
17
-
18
- // Subaccount is an arbitrary 32-byte byte array.
19
- // Ledger uses subaccounts to compute the source address, which enables one
20
- // principal to control multiple ledger accounts.
21
- type SubAccount = blob;
22
-
23
- // Sequence number of a block produced by the ledger.
24
- type BlockIndex = nat64;
25
-
26
- type Transaction = record {
27
- memo : Memo;
28
- icrc1_memo: opt blob;
29
- operation : opt Operation;
30
- created_at_time : TimeStamp;
31
- };
32
-
33
- // An arbitrary number associated with a transaction.
34
- // The caller can set it in a `transfer` call as a correlation identifier.
35
- type Memo = nat64;
36
-
37
- // Arguments for the `transfer` call.
38
- type TransferArgs = record {
39
- // Transaction memo.
40
- // See comments for the `Memo` type.
41
- memo: Memo;
42
- // The amount that the caller wants to transfer to the destination address.
43
- amount: Tokens;
44
- // The amount that the caller pays for the transaction.
45
- // Must be 10000 e8s.
46
- fee: Tokens;
47
- // The subaccount from which the caller wants to transfer funds.
48
- // If null, the ledger uses the default (all zeros) subaccount to compute the source address.
49
- // See comments for the `SubAccount` type.
50
- from_subaccount: opt SubAccount;
51
- // The destination account.
52
- // If the transfer is successful, the balance of this address increases by `amount`.
53
- to: AccountIdentifier;
54
- // The point in time when the caller created this request.
55
- // If null, the ledger uses current IC time as the timestamp.
56
- created_at_time: opt TimeStamp;
57
- };
58
-
59
- type TransferError = variant {
60
- // The fee that the caller specified in the transfer request was not the one that ledger expects.
61
- // The caller can change the transfer fee to the `expected_fee` and retry the request.
62
- BadFee : record { expected_fee : Tokens; };
63
- // The account specified by the caller doesn't have enough funds.
64
- InsufficientFunds : record { balance: Tokens; };
65
- // The request is too old.
66
- // The ledger only accepts requests created within 24 hours window.
67
- // This is a non-recoverable error.
68
- TxTooOld : record { allowed_window_nanos: nat64 };
69
- // The caller specified `created_at_time` that is too far in future.
70
- // The caller can retry the request later.
71
- TxCreatedInFuture : null;
72
- // The ledger has already executed the request.
73
- // `duplicate_of` field is equal to the index of the block containing the original transaction.
74
- TxDuplicate : record { duplicate_of: BlockIndex; }
75
- };
76
-
77
- type TransferResult = variant {
78
- Ok : BlockIndex;
79
- Err : TransferError;
80
- };
81
-
82
- // Arguments for the `account_balance` call.
83
- type AccountBalanceArgs = record {
84
- account: AccountIdentifier;
85
- };
86
-
87
- type TransferFeeArg = record {};
88
-
89
- type TransferFee = record {
90
- // The fee to pay to perform a transfer
91
- transfer_fee: Tokens;
92
- };
93
-
94
- type GetBlocksArgs = record {
95
- // The index of the first block to fetch.
96
- start : BlockIndex;
97
- // Max number of blocks to fetch.
98
- length : nat64;
99
- };
100
-
101
- type Operation = variant {
102
- Mint : record {
103
- to : AccountIdentifier;
104
- amount : Tokens;
105
- };
106
- Burn : record {
107
- from : AccountIdentifier;
108
- amount : Tokens;
109
- };
110
- Transfer : record {
111
- from : AccountIdentifier;
112
- to : AccountIdentifier;
113
- amount : Tokens;
114
- fee : Tokens;
115
- };
116
- Approve : record {
117
- from : AccountIdentifier;
118
- spender : AccountIdentifier;
119
- allowance_e8s : int;
120
- fee : Tokens;
121
- expires_at : opt TimeStamp;
122
- };
123
- TransferFrom : record {
124
- from : AccountIdentifier;
125
- to : AccountIdentifier;
126
- spender : AccountIdentifier;
127
- amount : Tokens;
128
- fee : Tokens;
129
- };
130
- };
131
-
132
-
133
-
134
- type Block = record {
135
- parent_hash : opt blob;
136
- transaction : Transaction;
137
- timestamp : TimeStamp;
138
- };
139
-
140
- // A prefix of the block range specified in the [GetBlocksArgs] request.
141
- type BlockRange = record {
142
- // A prefix of the requested block range.
143
- // The index of the first block is equal to [GetBlocksArgs.from].
144
- //
145
- // Note that the number of blocks might be less than the requested
146
- // [GetBlocksArgs.len] for various reasons, for example:
147
- //
148
- // 1. The query might have hit the replica with an outdated state
149
- // that doesn't have the full block range yet.
150
- // 2. The requested range is too large to fit into a single reply.
151
- //
152
- // NOTE: the list of blocks can be empty if:
153
- // 1. [GetBlocksArgs.len] was zero.
154
- // 2. [GetBlocksArgs.from] was larger than the last block known to the canister.
155
- blocks : vec Block;
156
- };
157
-
158
- // An error indicating that the arguments passed to [QueryArchiveFn] were invalid.
159
- type QueryArchiveError = variant {
160
- // [GetBlocksArgs.from] argument was smaller than the first block
161
- // served by the canister that received the request.
162
- BadFirstBlockIndex : record {
163
- requested_index : BlockIndex;
164
- first_valid_index : BlockIndex;
165
- };
166
-
167
- // Reserved for future use.
168
- Other : record {
169
- error_code : nat64;
170
- error_message : text;
171
- };
172
- };
173
-
174
- type QueryArchiveResult = variant {
175
- // Successfully fetched zero or more blocks.
176
- Ok : BlockRange;
177
- // The [GetBlocksArgs] request was invalid.
178
- Err : QueryArchiveError;
179
- };
180
-
181
- // A function that is used for fetching archived ledger blocks.
182
- type QueryArchiveFn = func (GetBlocksArgs) -> (QueryArchiveResult) query;
183
-
184
- // The result of a "query_blocks" call.
185
- //
186
- // The structure of the result is somewhat complicated because the main ledger canister might
187
- // not have all the blocks that the caller requested: One or more "archive" canisters might
188
- // store some of the requested blocks.
189
- //
190
- // Note: as of Q4 2021 when this interface is authored, the IC doesn't support making nested
191
- // query calls within a query call.
192
- type QueryBlocksResponse = record {
193
- // The total number of blocks in the chain.
194
- // If the chain length is positive, the index of the last block is `chain_len - 1`.
195
- chain_length : nat64;
196
-
197
- // System certificate for the hash of the latest block in the chain.
198
- // Only present if `query_blocks` is called in a non-replicated query context.
199
- certificate : opt blob;
200
-
201
- // List of blocks that were available in the ledger when it processed the call.
202
- //
203
- // The blocks form a contiguous range, with the first block having index
204
- // [first_block_index] (see below), and the last block having index
205
- // [first_block_index] + len(blocks) - 1.
206
- //
207
- // The block range can be an arbitrary sub-range of the originally requested range.
208
- blocks : vec Block;
209
-
210
- // The index of the first block in "blocks".
211
- // If the blocks vector is empty, the exact value of this field is not specified.
212
- first_block_index : BlockIndex;
213
-
214
- // Encoding of instructions for fetching archived blocks whose indices fall into the
215
- // requested range.
216
- //
217
- // For each entry `e` in [archived_blocks], `[e.from, e.from + len)` is a sub-range
218
- // of the originally requested block range.
219
- archived_blocks : vec record {
220
- // The index of the first archived block that can be fetched using the callback.
221
- start : BlockIndex;
222
-
223
- // The number of blocks that can be fetch using the callback.
224
- length : nat64;
225
-
226
- // The function that should be called to fetch the archived blocks.
227
- // The range of the blocks accessible using this function is given by [from]
228
- // and [len] fields above.
229
- callback : QueryArchiveFn;
230
- };
231
- };
232
-
233
- type Archive = record {
234
- canister_id: principal;
235
- };
236
-
237
- type Archives = record {
238
- archives: vec Archive;
239
- };
240
-
241
- type Duration = record {
242
- secs: nat64;
243
- nanos: nat32;
244
- };
245
-
246
- type ArchiveOptions = record {
247
- trigger_threshold : nat64;
248
- num_blocks_to_archive : nat64;
249
- node_max_memory_size_bytes: opt nat64;
250
- max_message_size_bytes: opt nat64;
251
- controller_id: principal;
252
- cycles_for_archive_creation: opt nat64;
253
- };
254
-
255
- // Account identifier encoded as a 64-byte ASCII hex string.
256
- type TextAccountIdentifier = text;
257
-
258
- // Arguments for the `send_dfx` call.
259
- type SendArgs = record {
260
- memo: Memo;
261
- amount: Tokens;
262
- fee: Tokens;
263
- from_subaccount: opt SubAccount;
264
- to: TextAccountIdentifier;
265
- created_at_time: opt TimeStamp;
266
- };
267
-
268
- type AccountBalanceArgsDfx = record {
269
- account: TextAccountIdentifier;
270
- };
271
-
272
- type InitArgs = record {
273
- minting_account: TextAccountIdentifier;
274
- icrc1_minting_account: opt Account;
275
- initial_values: vec record {TextAccountIdentifier; Tokens};
276
- max_message_size_bytes: opt nat64;
277
- transaction_window: opt Duration;
278
- archive_options: opt ArchiveOptions;
279
- send_whitelist: vec principal;
280
- transfer_fee: opt Tokens;
281
- token_symbol: opt text;
282
- token_name: opt text;
283
- };
284
-
285
- type Icrc1BlockIndex = nat;
286
- // Number of nanoseconds since the UNIX epoch in UTC timezone.
287
- type Icrc1Timestamp = nat64;
288
- type Icrc1Tokens = nat;
289
-
290
- type Account = record {
291
- owner : principal;
292
- subaccount : opt SubAccount;
293
- };
294
-
295
- type TransferArg = record {
296
- from_subaccount : opt SubAccount;
297
- to : Account;
298
- amount : Icrc1Tokens;
299
- fee : opt Icrc1Tokens;
300
- memo : opt blob;
301
- created_at_time: opt Icrc1Timestamp;
302
- };
303
-
304
- type Icrc1TransferError = variant {
305
- BadFee : record { expected_fee : Icrc1Tokens };
306
- BadBurn : record { min_burn_amount : Icrc1Tokens };
307
- InsufficientFunds : record { balance : Icrc1Tokens };
308
- TooOld;
309
- CreatedInFuture : record { ledger_time : nat64 };
310
- TemporarilyUnavailable;
311
- Duplicate : record { duplicate_of : Icrc1BlockIndex };
312
- GenericError : record { error_code : nat; message : text };
313
- };
314
-
315
- type Icrc1TransferResult = variant {
316
- Ok : Icrc1BlockIndex;
317
- Err : Icrc1TransferError;
318
- };
319
-
320
- // The value returned from the [icrc1_metadata] endpoint.
321
- type Value = variant {
322
- Nat : nat;
323
- Int : int;
324
- Text : text;
325
- Blob : blob;
326
- };
327
-
328
- type UpgradeArgs = record {
329
- maximum_number_of_accounts : opt nat64;
330
- icrc1_minting_account : opt Account;
331
- };
332
-
333
- type LedgerCanisterPayload = variant {
334
- Init: InitArgs;
335
- Upgrade: opt UpgradeArgs;
336
- };
337
-
338
- service: (LedgerCanisterPayload) -> {
339
- // Transfers tokens from a subaccount of the caller to the destination address.
340
- // The source address is computed from the principal of the caller and the specified subaccount.
341
- // When successful, returns the index of the block containing the transaction.
342
- transfer : (TransferArgs) -> (TransferResult);
343
-
344
- // Returns the amount of Tokens on the specified account.
345
- account_balance : (AccountBalanceArgs) -> (Tokens) query;
346
-
347
- // Returns the current transfer_fee.
348
- transfer_fee : (TransferFeeArg) -> (TransferFee) query;
349
-
350
- // Queries blocks in the specified range.
351
- query_blocks : (GetBlocksArgs) -> (QueryBlocksResponse) query;
352
-
353
- // Returns token symbol.
354
- symbol : () -> (record { symbol: text }) query;
355
-
356
- // Returns token name.
357
- name : () -> (record { name: text }) query;
358
-
359
- // Returns token decimals.
360
- decimals : () -> (record { decimals: nat32 }) query;
361
-
362
- // Returns the existing archive canisters information.
363
- archives : () -> (Archives) query;
364
-
365
- send_dfx : (SendArgs) -> (BlockIndex);
366
- account_balance_dfx : (AccountBalanceArgsDfx) -> (Tokens) query;
367
-
368
- // The following methods implement the ICRC-1 Token Standard.
369
- // https://github.com/dfinity/ICRC-1/tree/main/standards/ICRC-1
370
- icrc1_name : () -> (text) query;
371
- icrc1_symbol : () -> (text) query;
372
- icrc1_decimals : () -> (nat8) query;
373
- icrc1_metadata : () -> (vec record { text; Value }) query;
374
- icrc1_total_supply : () -> (Icrc1Tokens) query;
375
- icrc1_fee : () -> (Icrc1Tokens) query;
376
- icrc1_minting_account : () -> (opt Account) query;
377
- icrc1_balance_of : (Account) -> (Icrc1Tokens) query;
378
- icrc1_transfer : (TransferArg) -> (Icrc1TransferResult);
379
- icrc1_supported_standards : () -> (vec record { name : text; url : text }) query;
380
- }
@@ -1,2 +0,0 @@
1
- import type { IDL } from "@dfinity/candid";
2
- export const idlFactory: IDL.InterfaceFactory;
@@ -1,265 +0,0 @@
1
- /* Do not edit. Compiled with ./scripts/compile-idl-js from packages/nns/candid/ledger.did */
2
- export const idlFactory = ({ IDL }) => {
3
- const SubAccount = IDL.Vec(IDL.Nat8);
4
- const Account = IDL.Record({
5
- 'owner' : IDL.Principal,
6
- 'subaccount' : IDL.Opt(SubAccount),
7
- });
8
- const UpgradeArgs = IDL.Record({
9
- 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),
10
- 'icrc1_minting_account' : IDL.Opt(Account),
11
- });
12
- const Tokens = IDL.Record({ 'e8s' : IDL.Nat64 });
13
- const TextAccountIdentifier = IDL.Text;
14
- const Duration = IDL.Record({ 'secs' : IDL.Nat64, 'nanos' : IDL.Nat32 });
15
- const ArchiveOptions = IDL.Record({
16
- 'num_blocks_to_archive' : IDL.Nat64,
17
- 'trigger_threshold' : IDL.Nat64,
18
- 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
19
- 'cycles_for_archive_creation' : IDL.Opt(IDL.Nat64),
20
- 'node_max_memory_size_bytes' : IDL.Opt(IDL.Nat64),
21
- 'controller_id' : IDL.Principal,
22
- });
23
- const InitArgs = IDL.Record({
24
- 'send_whitelist' : IDL.Vec(IDL.Principal),
25
- 'token_symbol' : IDL.Opt(IDL.Text),
26
- 'transfer_fee' : IDL.Opt(Tokens),
27
- 'minting_account' : TextAccountIdentifier,
28
- 'transaction_window' : IDL.Opt(Duration),
29
- 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
30
- 'icrc1_minting_account' : IDL.Opt(Account),
31
- 'archive_options' : IDL.Opt(ArchiveOptions),
32
- 'initial_values' : IDL.Vec(IDL.Tuple(TextAccountIdentifier, Tokens)),
33
- 'token_name' : IDL.Opt(IDL.Text),
34
- });
35
- const LedgerCanisterPayload = IDL.Variant({
36
- 'Upgrade' : IDL.Opt(UpgradeArgs),
37
- 'Init' : InitArgs,
38
- });
39
- const AccountIdentifier = IDL.Vec(IDL.Nat8);
40
- const AccountBalanceArgs = IDL.Record({ 'account' : AccountIdentifier });
41
- const AccountBalanceArgsDfx = IDL.Record({
42
- 'account' : TextAccountIdentifier,
43
- });
44
- const Archive = IDL.Record({ 'canister_id' : IDL.Principal });
45
- const Archives = IDL.Record({ 'archives' : IDL.Vec(Archive) });
46
- const Icrc1Tokens = IDL.Nat;
47
- const Value = IDL.Variant({
48
- 'Int' : IDL.Int,
49
- 'Nat' : IDL.Nat,
50
- 'Blob' : IDL.Vec(IDL.Nat8),
51
- 'Text' : IDL.Text,
52
- });
53
- const Icrc1Timestamp = IDL.Nat64;
54
- const TransferArg = IDL.Record({
55
- 'to' : Account,
56
- 'fee' : IDL.Opt(Icrc1Tokens),
57
- 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
58
- 'from_subaccount' : IDL.Opt(SubAccount),
59
- 'created_at_time' : IDL.Opt(Icrc1Timestamp),
60
- 'amount' : Icrc1Tokens,
61
- });
62
- const Icrc1BlockIndex = IDL.Nat;
63
- const Icrc1TransferError = IDL.Variant({
64
- 'GenericError' : IDL.Record({
65
- 'message' : IDL.Text,
66
- 'error_code' : IDL.Nat,
67
- }),
68
- 'TemporarilyUnavailable' : IDL.Null,
69
- 'BadBurn' : IDL.Record({ 'min_burn_amount' : Icrc1Tokens }),
70
- 'Duplicate' : IDL.Record({ 'duplicate_of' : Icrc1BlockIndex }),
71
- 'BadFee' : IDL.Record({ 'expected_fee' : Icrc1Tokens }),
72
- 'CreatedInFuture' : IDL.Record({ 'ledger_time' : IDL.Nat64 }),
73
- 'TooOld' : IDL.Null,
74
- 'InsufficientFunds' : IDL.Record({ 'balance' : Icrc1Tokens }),
75
- });
76
- const Icrc1TransferResult = IDL.Variant({
77
- 'Ok' : Icrc1BlockIndex,
78
- 'Err' : Icrc1TransferError,
79
- });
80
- const BlockIndex = IDL.Nat64;
81
- const GetBlocksArgs = IDL.Record({
82
- 'start' : BlockIndex,
83
- 'length' : IDL.Nat64,
84
- });
85
- const Memo = IDL.Nat64;
86
- const TimeStamp = IDL.Record({ 'timestamp_nanos' : IDL.Nat64 });
87
- const Operation = IDL.Variant({
88
- 'Approve' : IDL.Record({
89
- 'fee' : Tokens,
90
- 'from' : AccountIdentifier,
91
- 'allowance_e8s' : IDL.Int,
92
- 'expires_at' : IDL.Opt(TimeStamp),
93
- 'spender' : AccountIdentifier,
94
- }),
95
- 'Burn' : IDL.Record({ 'from' : AccountIdentifier, 'amount' : Tokens }),
96
- 'Mint' : IDL.Record({ 'to' : AccountIdentifier, 'amount' : Tokens }),
97
- 'Transfer' : IDL.Record({
98
- 'to' : AccountIdentifier,
99
- 'fee' : Tokens,
100
- 'from' : AccountIdentifier,
101
- 'amount' : Tokens,
102
- }),
103
- 'TransferFrom' : IDL.Record({
104
- 'to' : AccountIdentifier,
105
- 'fee' : Tokens,
106
- 'from' : AccountIdentifier,
107
- 'amount' : Tokens,
108
- 'spender' : AccountIdentifier,
109
- }),
110
- });
111
- const Transaction = IDL.Record({
112
- 'memo' : Memo,
113
- 'icrc1_memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
114
- 'operation' : IDL.Opt(Operation),
115
- 'created_at_time' : TimeStamp,
116
- });
117
- const Block = IDL.Record({
118
- 'transaction' : Transaction,
119
- 'timestamp' : TimeStamp,
120
- 'parent_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)),
121
- });
122
- const BlockRange = IDL.Record({ 'blocks' : IDL.Vec(Block) });
123
- const QueryArchiveError = IDL.Variant({
124
- 'BadFirstBlockIndex' : IDL.Record({
125
- 'requested_index' : BlockIndex,
126
- 'first_valid_index' : BlockIndex,
127
- }),
128
- 'Other' : IDL.Record({
129
- 'error_message' : IDL.Text,
130
- 'error_code' : IDL.Nat64,
131
- }),
132
- });
133
- const QueryArchiveResult = IDL.Variant({
134
- 'Ok' : BlockRange,
135
- 'Err' : QueryArchiveError,
136
- });
137
- const QueryArchiveFn = IDL.Func(
138
- [GetBlocksArgs],
139
- [QueryArchiveResult],
140
- ['query'],
141
- );
142
- const QueryBlocksResponse = IDL.Record({
143
- 'certificate' : IDL.Opt(IDL.Vec(IDL.Nat8)),
144
- 'blocks' : IDL.Vec(Block),
145
- 'chain_length' : IDL.Nat64,
146
- 'first_block_index' : BlockIndex,
147
- 'archived_blocks' : IDL.Vec(
148
- IDL.Record({
149
- 'callback' : QueryArchiveFn,
150
- 'start' : BlockIndex,
151
- 'length' : IDL.Nat64,
152
- })
153
- ),
154
- });
155
- const SendArgs = IDL.Record({
156
- 'to' : TextAccountIdentifier,
157
- 'fee' : Tokens,
158
- 'memo' : Memo,
159
- 'from_subaccount' : IDL.Opt(SubAccount),
160
- 'created_at_time' : IDL.Opt(TimeStamp),
161
- 'amount' : Tokens,
162
- });
163
- const TransferArgs = IDL.Record({
164
- 'to' : AccountIdentifier,
165
- 'fee' : Tokens,
166
- 'memo' : Memo,
167
- 'from_subaccount' : IDL.Opt(SubAccount),
168
- 'created_at_time' : IDL.Opt(TimeStamp),
169
- 'amount' : Tokens,
170
- });
171
- const TransferError = IDL.Variant({
172
- 'TxTooOld' : IDL.Record({ 'allowed_window_nanos' : IDL.Nat64 }),
173
- 'BadFee' : IDL.Record({ 'expected_fee' : Tokens }),
174
- 'TxDuplicate' : IDL.Record({ 'duplicate_of' : BlockIndex }),
175
- 'TxCreatedInFuture' : IDL.Null,
176
- 'InsufficientFunds' : IDL.Record({ 'balance' : Tokens }),
177
- });
178
- const TransferResult = IDL.Variant({
179
- 'Ok' : BlockIndex,
180
- 'Err' : TransferError,
181
- });
182
- const TransferFeeArg = IDL.Record({});
183
- const TransferFee = IDL.Record({ 'transfer_fee' : Tokens });
184
- return IDL.Service({
185
- 'account_balance' : IDL.Func([AccountBalanceArgs], [Tokens], ['query']),
186
- 'account_balance_dfx' : IDL.Func(
187
- [AccountBalanceArgsDfx],
188
- [Tokens],
189
- ['query'],
190
- ),
191
- 'archives' : IDL.Func([], [Archives], ['query']),
192
- 'decimals' : IDL.Func(
193
- [],
194
- [IDL.Record({ 'decimals' : IDL.Nat32 })],
195
- ['query'],
196
- ),
197
- 'icrc1_balance_of' : IDL.Func([Account], [Icrc1Tokens], ['query']),
198
- 'icrc1_decimals' : IDL.Func([], [IDL.Nat8], ['query']),
199
- 'icrc1_fee' : IDL.Func([], [Icrc1Tokens], ['query']),
200
- 'icrc1_metadata' : IDL.Func(
201
- [],
202
- [IDL.Vec(IDL.Tuple(IDL.Text, Value))],
203
- ['query'],
204
- ),
205
- 'icrc1_minting_account' : IDL.Func([], [IDL.Opt(Account)], ['query']),
206
- 'icrc1_name' : IDL.Func([], [IDL.Text], ['query']),
207
- 'icrc1_supported_standards' : IDL.Func(
208
- [],
209
- [IDL.Vec(IDL.Record({ 'url' : IDL.Text, 'name' : IDL.Text }))],
210
- ['query'],
211
- ),
212
- 'icrc1_symbol' : IDL.Func([], [IDL.Text], ['query']),
213
- 'icrc1_total_supply' : IDL.Func([], [Icrc1Tokens], ['query']),
214
- 'icrc1_transfer' : IDL.Func([TransferArg], [Icrc1TransferResult], []),
215
- 'name' : IDL.Func([], [IDL.Record({ 'name' : IDL.Text })], ['query']),
216
- 'query_blocks' : IDL.Func(
217
- [GetBlocksArgs],
218
- [QueryBlocksResponse],
219
- ['query'],
220
- ),
221
- 'send_dfx' : IDL.Func([SendArgs], [BlockIndex], []),
222
- 'symbol' : IDL.Func([], [IDL.Record({ 'symbol' : IDL.Text })], ['query']),
223
- 'transfer' : IDL.Func([TransferArgs], [TransferResult], []),
224
- 'transfer_fee' : IDL.Func([TransferFeeArg], [TransferFee], ['query']),
225
- });
226
- };
227
- export const init = ({ IDL }) => {
228
- const SubAccount = IDL.Vec(IDL.Nat8);
229
- const Account = IDL.Record({
230
- 'owner' : IDL.Principal,
231
- 'subaccount' : IDL.Opt(SubAccount),
232
- });
233
- const UpgradeArgs = IDL.Record({
234
- 'maximum_number_of_accounts' : IDL.Opt(IDL.Nat64),
235
- 'icrc1_minting_account' : IDL.Opt(Account),
236
- });
237
- const Tokens = IDL.Record({ 'e8s' : IDL.Nat64 });
238
- const TextAccountIdentifier = IDL.Text;
239
- const Duration = IDL.Record({ 'secs' : IDL.Nat64, 'nanos' : IDL.Nat32 });
240
- const ArchiveOptions = IDL.Record({
241
- 'num_blocks_to_archive' : IDL.Nat64,
242
- 'trigger_threshold' : IDL.Nat64,
243
- 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
244
- 'cycles_for_archive_creation' : IDL.Opt(IDL.Nat64),
245
- 'node_max_memory_size_bytes' : IDL.Opt(IDL.Nat64),
246
- 'controller_id' : IDL.Principal,
247
- });
248
- const InitArgs = IDL.Record({
249
- 'send_whitelist' : IDL.Vec(IDL.Principal),
250
- 'token_symbol' : IDL.Opt(IDL.Text),
251
- 'transfer_fee' : IDL.Opt(Tokens),
252
- 'minting_account' : TextAccountIdentifier,
253
- 'transaction_window' : IDL.Opt(Duration),
254
- 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
255
- 'icrc1_minting_account' : IDL.Opt(Account),
256
- 'archive_options' : IDL.Opt(ArchiveOptions),
257
- 'initial_values' : IDL.Vec(IDL.Tuple(TextAccountIdentifier, Tokens)),
258
- 'token_name' : IDL.Opt(IDL.Text),
259
- });
260
- const LedgerCanisterPayload = IDL.Variant({
261
- 'Upgrade' : IDL.Opt(UpgradeArgs),
262
- 'Init' : InitArgs,
263
- });
264
- return [LedgerCanisterPayload];
265
- };
@@ -1,2 +0,0 @@
1
- import{c as a,d as b}from"./chunk-H5FXE6EH.js";import"./chunk-2MZ7K2GY.js";import"./chunk-IS3C7V4B.js";export{a as AccountIdentifier,b as SubAccount};
2
- //# sourceMappingURL=account_identifier.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,4 +0,0 @@
1
- import{polling as n}from"@dfinity/agent";var p=()=>import("@dfinity/nns-proto"),l=async({agent:o,canisterId:e,methodName:r,arg:s})=>{let t=await o.call(e,{methodName:r,arg:s,effectiveCanisterId:e});if(!t.response.ok)throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${e}`,` Request ID: ${t.requestId}`,` HTTP status code: ${t.response.status}`,` HTTP status text: ${t.response.statusText}`].join(`
2
- `));let a=await n.pollForResponse(o,e,t.requestId,n.defaultStrategy());return new Uint8Array(a)},u=async({agent:o,canisterId:e,methodName:r,arg:s})=>{let t=await o.query(e,{methodName:r,arg:s});if(t.status=="rejected")throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${e}`,` HTTP status code: ${t.reject_code}`,` HTTP status text: ${t.reject_message}`].join(`
3
- `));return new Uint8Array(t.reply.arg)};export{p as a,l as b,u as c};
4
- //# sourceMappingURL=chunk-2MZ7K2GY.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/proto.utils.ts"],
4
- "sourcesContent": ["import type { Agent } from \"@dfinity/agent\";\nimport { polling } from \"@dfinity/agent\";\nimport type { Principal } from \"@dfinity/principal\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype ModuleType = typeof import(\"@dfinity/nns-proto\");\nexport const importNnsProto = (): Promise<ModuleType> =>\n import(\"@dfinity/nns-proto\");\n\n/**\n * Submits an update call to the IC.\n * @returns The (binary) response if the request succeeded, an error otherwise.\n */\nexport const updateCall = async ({\n agent,\n canisterId,\n methodName,\n arg,\n}: {\n agent: Agent;\n canisterId: Principal;\n methodName: string;\n arg: ArrayBuffer;\n}): Promise<Uint8Array> => {\n const submitResponse = await agent.call(canisterId, {\n methodName,\n arg,\n effectiveCanisterId: canisterId,\n });\n\n if (!submitResponse.response.ok) {\n throw new Error(\n [\n \"Call failed:\",\n ` Method: ${methodName}`,\n ` Canister ID: ${canisterId}`,\n ` Request ID: ${submitResponse.requestId}`,\n ` HTTP status code: ${submitResponse.response.status}`,\n ` HTTP status text: ${submitResponse.response.statusText}`,\n ].join(\"\\n\"),\n );\n }\n\n const blob = await polling.pollForResponse(\n agent,\n canisterId,\n submitResponse.requestId,\n polling.defaultStrategy(),\n );\n\n return new Uint8Array(blob);\n};\n\n/**\n * Submits a query call to the IC.\n * @returns The (binary) response if the request succeeded, an error otherwise.\n */\nexport const queryCall = async ({\n agent,\n canisterId,\n methodName,\n arg,\n}: {\n agent: Agent;\n canisterId: Principal;\n methodName: string;\n arg: ArrayBuffer;\n}): Promise<Uint8Array> => {\n const queryResponse = await agent.query(canisterId, {\n methodName,\n arg,\n });\n\n if (queryResponse.status == \"rejected\") {\n throw new Error(\n [\n \"Call failed:\",\n ` Method: ${methodName}`,\n ` Canister ID: ${canisterId}`,\n ` HTTP status code: ${queryResponse.reject_code}`,\n ` HTTP status text: ${queryResponse.reject_message}`,\n ].join(\"\\n\"),\n );\n }\n\n return new Uint8Array(queryResponse.reply.arg);\n};\n"],
5
- "mappings": "AACA,OAAS,WAAAA,MAAe,iBAKjB,IAAMC,EAAiB,IAC5B,OAAO,oBAAoB,EAMhBC,EAAa,MAAO,CAC/B,MAAAC,EACA,WAAAC,EACA,WAAAC,EACA,IAAAC,CACF,IAK2B,CACzB,IAAMC,EAAiB,MAAMJ,EAAM,KAAKC,EAAY,CAClD,WAAAC,EACA,IAAAC,EACA,oBAAqBF,CACvB,CAAC,EAED,GAAI,CAACG,EAAe,SAAS,GAC3B,MAAM,IAAI,MACR,CACE,eACA,aAAaF,CAAU,GACvB,kBAAkBD,CAAU,GAC5B,iBAAiBG,EAAe,SAAS,GACzC,uBAAuBA,EAAe,SAAS,MAAM,GACrD,uBAAuBA,EAAe,SAAS,UAAU,EAC3D,EAAE,KAAK;AAAA,CAAI,CACb,EAGF,IAAMC,EAAO,MAAMR,EAAQ,gBACzBG,EACAC,EACAG,EAAe,UACfP,EAAQ,gBAAgB,CAC1B,EAEA,OAAO,IAAI,WAAWQ,CAAI,CAC5B,EAMaC,EAAY,MAAO,CAC9B,MAAAN,EACA,WAAAC,EACA,WAAAC,EACA,IAAAC,CACF,IAK2B,CACzB,IAAMI,EAAgB,MAAMP,EAAM,MAAMC,EAAY,CAClD,WAAAC,EACA,IAAAC,CACF,CAAC,EAED,GAAII,EAAc,QAAU,WAC1B,MAAM,IAAI,MACR,CACE,eACA,aAAaL,CAAU,GACvB,kBAAkBD,CAAU,GAC5B,uBAAuBM,EAAc,WAAW,GAChD,uBAAuBA,EAAc,cAAc,EACrD,EAAE,KAAK;AAAA,CAAI,CACb,EAGF,OAAO,IAAI,WAAWA,EAAc,MAAM,GAAG,CAC/C",
6
- "names": ["polling", "importNnsProto", "updateCall", "agent", "canisterId", "methodName", "arg", "submitResponse", "blob", "queryCall", "queryResponse"]
7
- }
@@ -1,2 +0,0 @@
1
- var t=BigInt(1095062083),E=BigInt(1347768404),_=BigInt(1e4),o=BigInt(1e8);export{_ as a,o as b};
2
- //# sourceMappingURL=chunk-DGJWOAUC.js.map