@junobuild/functions 0.8.3 → 0.8.4-next-2026-04-17

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 (76) hide show
  1. package/canisters/ckbtc/index.js +1 -1
  2. package/canisters/cketh/index.js +1 -1
  3. package/canisters/cmc/index.js +1 -1
  4. package/canisters/declarations/_idl.d.ts +2 -1
  5. package/canisters/declarations/_types.d.ts +2 -1
  6. package/canisters/declarations/ckbtc/bitcoin.did.d.ts +8 -0
  7. package/canisters/declarations/ckbtc/bitcoin.did.idl.d.ts +2 -0
  8. package/canisters/declarations/ckbtc/minter.did.d.ts +190 -0
  9. package/canisters/declarations/ckbtc/minter.did.idl.d.ts +9 -0
  10. package/canisters/declarations/cketh/minter.did.d.ts +140 -0
  11. package/canisters/declarations/cketh/minter.did.idl.d.ts +8 -0
  12. package/canisters/declarations/cycles-ledger/cycles-ledger.did.d.ts +413 -0
  13. package/canisters/declarations/cycles-ledger/cycles-ledger.did.idl.d.ts +82 -0
  14. package/canisters/declarations/ic-management/ic-management.did.d.ts +18 -4
  15. package/canisters/declarations/ledger-icp/index.did.d.ts +20 -1
  16. package/canisters/declarations/ledger-icp/index.did.idl.d.ts +5 -1
  17. package/canisters/declarations/ledger-icrc/icrc_index.did.d.ts +1 -0
  18. package/canisters/declarations/ledger-icrc/icrc_ledger.did.d.ts +1 -0
  19. package/canisters/declarations/nns/governance.did.d.ts +100 -0
  20. package/canisters/declarations/nns/governance.did.idl.d.ts +11 -0
  21. package/canisters/declarations/nns/governance_test.did.d.ts +100 -0
  22. package/canisters/declarations/nns/governance_test.did.idl.d.ts +11 -0
  23. package/canisters/declarations/nns/sns_wasm.did.d.ts +4 -0
  24. package/canisters/declarations/nns/sns_wasm.did.idl.d.ts +1 -0
  25. package/canisters/declarations/sns/governance.did.d.ts +4 -0
  26. package/canisters/declarations/sns/governance.did.idl.d.ts +1 -0
  27. package/canisters/declarations/sns/governance_test.did.d.ts +4 -0
  28. package/canisters/declarations/sns/governance_test.did.idl.d.ts +1 -0
  29. package/canisters/ic-management/index.js +1 -1
  30. package/canisters/ledger/cycles/index.d.ts +1 -0
  31. package/canisters/ledger/cycles/index.js +2 -0
  32. package/canisters/ledger/cycles/index.js.map +7 -0
  33. package/canisters/ledger/icp/index.d.ts +1 -0
  34. package/canisters/ledger/icp/index.js +1 -1
  35. package/canisters/ledger/icp/index.js.map +4 -4
  36. package/canisters/ledger/icp/ledger.canister.d.ts +5 -5
  37. package/canisters/ledger/icp/schema.d.ts +152 -0
  38. package/canisters/ledger/icrc/index.d.ts +1 -1
  39. package/canisters/ledger/icrc/index.js +1 -1
  40. package/canisters/ledger/icrc/index.js.map +4 -4
  41. package/canisters/ledger/icrc/ledger.canister.d.ts +13 -14
  42. package/canisters/ledger/icrc/schema.d.ts +351 -0
  43. package/canisters/nns/index.js +1 -1
  44. package/canisters/sns/index.js +1 -1
  45. package/chunk-I3WMKZTG.js +2 -0
  46. package/chunk-I3WMKZTG.js.map +7 -0
  47. package/package.json +10 -6
  48. package/src/canisters/declarations/ckbtc/bitcoin.did.d.ts +8 -0
  49. package/src/canisters/declarations/ckbtc/bitcoin.did.idl.js +16 -0
  50. package/src/canisters/declarations/ckbtc/minter.did.d.ts +190 -0
  51. package/src/canisters/declarations/ckbtc/minter.did.idl.js +118 -0
  52. package/src/canisters/declarations/cketh/minter.did.d.ts +140 -0
  53. package/src/canisters/declarations/cketh/minter.did.idl.js +78 -0
  54. package/src/canisters/declarations/cycles-ledger/cycles-ledger.did.d.ts +413 -0
  55. package/src/canisters/declarations/cycles-ledger/cycles-ledger.did.idl.js +806 -0
  56. package/src/canisters/declarations/ic-management/ic-management.did.d.ts +18 -4
  57. package/src/canisters/declarations/ic-management/ic-management.did.idl.js +32 -8
  58. package/src/canisters/declarations/ledger-icp/index.did.d.ts +20 -1
  59. package/src/canisters/declarations/ledger-icp/index.did.idl.js +32 -5
  60. package/src/canisters/declarations/ledger-icrc/icrc_index.did.d.ts +1 -0
  61. package/src/canisters/declarations/ledger-icrc/icrc_index.did.idl.js +2 -0
  62. package/src/canisters/declarations/ledger-icrc/icrc_ledger.did.d.ts +1 -0
  63. package/src/canisters/declarations/ledger-icrc/icrc_ledger.did.idl.js +2 -0
  64. package/src/canisters/declarations/nns/governance.did.d.ts +100 -0
  65. package/src/canisters/declarations/nns/governance.did.idl.js +132 -0
  66. package/src/canisters/declarations/nns/governance_test.did.d.ts +100 -0
  67. package/src/canisters/declarations/nns/governance_test.did.idl.js +132 -0
  68. package/src/canisters/declarations/nns/sns_wasm.did.d.ts +4 -0
  69. package/src/canisters/declarations/nns/sns_wasm.did.idl.js +8 -0
  70. package/src/canisters/declarations/sns/governance.did.d.ts +4 -0
  71. package/src/canisters/declarations/sns/governance.did.idl.js +12 -0
  72. package/src/canisters/declarations/sns/governance_test.did.d.ts +4 -0
  73. package/src/canisters/declarations/sns/governance_test.did.idl.js +12 -0
  74. package/canisters/ledger/icrc/schemas.d.ts +0 -11
  75. package/chunk-I4MVAQHI.js +0 -2
  76. package/chunk-I4MVAQHI.js.map +0 -7
@@ -0,0 +1,806 @@
1
+ /* eslint-disable */
2
+
3
+ // @ts-nocheck
4
+
5
+ // This file was automatically generated by @icp-sdk/bindgen@0.3.0.
6
+ // You should NOT make any changes in this file as it will be overwritten.
7
+ // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
8
+
9
+ import {IDL} from '@icp-sdk/core/candid';
10
+
11
+ export const GetBlocksResult = IDL.Rec();
12
+ export const Value = IDL.Rec();
13
+ export const ChangeIndexId = IDL.Variant({
14
+ SetTo: IDL.Principal,
15
+ Unset: IDL.Null
16
+ });
17
+ export const UpgradeArgs = IDL.Record({
18
+ change_index_id: IDL.Opt(ChangeIndexId),
19
+ max_blocks_per_request: IDL.Opt(IDL.Nat64)
20
+ });
21
+ export const Account = IDL.Record({
22
+ owner: IDL.Principal,
23
+ subaccount: IDL.Opt(IDL.Vec(IDL.Nat8))
24
+ });
25
+ export const InitArgs = IDL.Record({
26
+ initial_balances: IDL.Opt(IDL.Vec(IDL.Tuple(Account, IDL.Nat))),
27
+ index_id: IDL.Opt(IDL.Principal),
28
+ max_blocks_per_request: IDL.Nat64
29
+ });
30
+ export const LedgerArgs = IDL.Variant({
31
+ Upgrade: IDL.Opt(UpgradeArgs),
32
+ Init: InitArgs
33
+ });
34
+ export const SubnetFilter = IDL.Record({subnet_type: IDL.Opt(IDL.Text)});
35
+ export const SubnetSelection = IDL.Variant({
36
+ Filter: SubnetFilter,
37
+ Subnet: IDL.Record({subnet: IDL.Principal})
38
+ });
39
+ export const CanisterSettings = IDL.Record({
40
+ freezing_threshold: IDL.Opt(IDL.Nat),
41
+ controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
42
+ reserved_cycles_limit: IDL.Opt(IDL.Nat),
43
+ memory_allocation: IDL.Opt(IDL.Nat),
44
+ compute_allocation: IDL.Opt(IDL.Nat)
45
+ });
46
+ export const CmcCreateCanisterArgs = IDL.Record({
47
+ subnet_selection: IDL.Opt(SubnetSelection),
48
+ settings: IDL.Opt(CanisterSettings)
49
+ });
50
+ export const CreateCanisterArgs = IDL.Record({
51
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
52
+ created_at_time: IDL.Opt(IDL.Nat64),
53
+ amount: IDL.Nat,
54
+ creation_args: IDL.Opt(CmcCreateCanisterArgs)
55
+ });
56
+ export const BlockIndex = IDL.Nat;
57
+ export const CreateCanisterSuccess = IDL.Record({
58
+ block_id: BlockIndex,
59
+ canister_id: IDL.Principal
60
+ });
61
+ export const CreateCanisterError = IDL.Variant({
62
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
63
+ TemporarilyUnavailable: IDL.Null,
64
+ Duplicate: IDL.Record({
65
+ duplicate_of: IDL.Nat,
66
+ canister_id: IDL.Opt(IDL.Principal)
67
+ }),
68
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
69
+ FailedToCreate: IDL.Record({
70
+ error: IDL.Text,
71
+ refund_block: IDL.Opt(BlockIndex),
72
+ fee_block: IDL.Opt(BlockIndex)
73
+ }),
74
+ TooOld: IDL.Null,
75
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
76
+ });
77
+ export const CreateCanisterFromArgs = IDL.Record({
78
+ spender_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
79
+ from: Account,
80
+ created_at_time: IDL.Opt(IDL.Nat64),
81
+ amount: IDL.Nat,
82
+ creation_args: IDL.Opt(CmcCreateCanisterArgs)
83
+ });
84
+ export const RejectionCode = IDL.Variant({
85
+ NoError: IDL.Null,
86
+ CanisterError: IDL.Null,
87
+ SysTransient: IDL.Null,
88
+ DestinationInvalid: IDL.Null,
89
+ Unknown: IDL.Null,
90
+ SysFatal: IDL.Null,
91
+ CanisterReject: IDL.Null
92
+ });
93
+ export const CreateCanisterFromError = IDL.Variant({
94
+ FailedToCreateFrom: IDL.Record({
95
+ create_from_block: IDL.Opt(BlockIndex),
96
+ rejection_code: RejectionCode,
97
+ refund_block: IDL.Opt(BlockIndex),
98
+ approval_refund_block: IDL.Opt(BlockIndex),
99
+ rejection_reason: IDL.Text
100
+ }),
101
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
102
+ TemporarilyUnavailable: IDL.Null,
103
+ InsufficientAllowance: IDL.Record({allowance: IDL.Nat}),
104
+ Duplicate: IDL.Record({
105
+ duplicate_of: IDL.Nat,
106
+ canister_id: IDL.Opt(IDL.Principal)
107
+ }),
108
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
109
+ TooOld: IDL.Null,
110
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
111
+ });
112
+ export const DepositArgs = IDL.Record({
113
+ to: Account,
114
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8))
115
+ });
116
+ export const DepositResult = IDL.Record({
117
+ balance: IDL.Nat,
118
+ block_index: BlockIndex
119
+ });
120
+ export const HttpRequest = IDL.Record({
121
+ url: IDL.Text,
122
+ method: IDL.Text,
123
+ body: IDL.Vec(IDL.Nat8),
124
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))
125
+ });
126
+ export const HttpResponse = IDL.Record({
127
+ body: IDL.Vec(IDL.Nat8),
128
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
129
+ status_code: IDL.Nat16
130
+ });
131
+ export const GetAllowancesArgs = IDL.Record({
132
+ take: IDL.Opt(IDL.Nat),
133
+ prev_spender: IDL.Opt(Account),
134
+ from_account: IDL.Opt(Account)
135
+ });
136
+ export const Allowances = IDL.Vec(
137
+ IDL.Record({
138
+ from_account: Account,
139
+ to_spender: Account,
140
+ allowance: IDL.Nat,
141
+ expires_at: IDL.Opt(IDL.Nat64)
142
+ })
143
+ );
144
+ export const GetAllowancesError = IDL.Variant({
145
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
146
+ AccessDenied: IDL.Record({reason: IDL.Text})
147
+ });
148
+ export const ICRC103GetAllowancesResponse = IDL.Variant({
149
+ Ok: Allowances,
150
+ Err: GetAllowancesError
151
+ });
152
+ export const GetIndexPrincipalError = IDL.Variant({
153
+ GenericError: IDL.Record({
154
+ description: IDL.Text,
155
+ error_code: IDL.Nat
156
+ }),
157
+ IndexPrincipalNotSet: IDL.Null
158
+ });
159
+ export const GetIndexPrincipalResult = IDL.Variant({
160
+ Ok: IDL.Principal,
161
+ Err: GetIndexPrincipalError
162
+ });
163
+ export const MetadataValue = IDL.Variant({
164
+ Int: IDL.Int,
165
+ Nat: IDL.Nat,
166
+ Blob: IDL.Vec(IDL.Nat8),
167
+ Text: IDL.Text
168
+ });
169
+ export const SupportedStandard = IDL.Record({
170
+ url: IDL.Text,
171
+ name: IDL.Text
172
+ });
173
+ export const TransferArgs = IDL.Record({
174
+ to: Account,
175
+ fee: IDL.Opt(IDL.Nat),
176
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
177
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
178
+ created_at_time: IDL.Opt(IDL.Nat64),
179
+ amount: IDL.Nat
180
+ });
181
+ export const TransferError = IDL.Variant({
182
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
183
+ TemporarilyUnavailable: IDL.Null,
184
+ BadBurn: IDL.Record({min_burn_amount: IDL.Nat}),
185
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
186
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
187
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
188
+ TooOld: IDL.Null,
189
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
190
+ });
191
+ export const AllowanceArgs = IDL.Record({
192
+ account: Account,
193
+ spender: Account
194
+ });
195
+ export const Allowance = IDL.Record({
196
+ allowance: IDL.Nat,
197
+ expires_at: IDL.Opt(IDL.Nat64)
198
+ });
199
+ export const ApproveArgs = IDL.Record({
200
+ fee: IDL.Opt(IDL.Nat),
201
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
202
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
203
+ created_at_time: IDL.Opt(IDL.Nat64),
204
+ amount: IDL.Nat,
205
+ expected_allowance: IDL.Opt(IDL.Nat),
206
+ expires_at: IDL.Opt(IDL.Nat64),
207
+ spender: Account
208
+ });
209
+ export const ApproveError = IDL.Variant({
210
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
211
+ TemporarilyUnavailable: IDL.Null,
212
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
213
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
214
+ AllowanceChanged: IDL.Record({current_allowance: IDL.Nat}),
215
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
216
+ TooOld: IDL.Null,
217
+ Expired: IDL.Record({ledger_time: IDL.Nat64}),
218
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
219
+ });
220
+ export const TransferFromArgs = IDL.Record({
221
+ to: Account,
222
+ fee: IDL.Opt(IDL.Nat),
223
+ spender_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
224
+ from: Account,
225
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
226
+ created_at_time: IDL.Opt(IDL.Nat64),
227
+ amount: IDL.Nat
228
+ });
229
+ export const TransferFromError = IDL.Variant({
230
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
231
+ TemporarilyUnavailable: IDL.Null,
232
+ InsufficientAllowance: IDL.Record({allowance: IDL.Nat}),
233
+ BadBurn: IDL.Record({min_burn_amount: IDL.Nat}),
234
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
235
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
236
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
237
+ TooOld: IDL.Null,
238
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
239
+ });
240
+ export const GetArchivesArgs = IDL.Record({from: IDL.Opt(IDL.Principal)});
241
+ export const GetArchivesResult = IDL.Vec(
242
+ IDL.Record({
243
+ end: IDL.Nat,
244
+ canister_id: IDL.Principal,
245
+ start: IDL.Nat
246
+ })
247
+ );
248
+ export const GetBlocksArgs = IDL.Vec(IDL.Record({start: IDL.Nat, length: IDL.Nat}));
249
+ Value.fill(
250
+ IDL.Variant({
251
+ Int: IDL.Int,
252
+ Map: IDL.Vec(IDL.Tuple(IDL.Text, Value)),
253
+ Nat: IDL.Nat,
254
+ Nat64: IDL.Nat64,
255
+ Blob: IDL.Vec(IDL.Nat8),
256
+ Text: IDL.Text,
257
+ Array: IDL.Vec(Value)
258
+ })
259
+ );
260
+ GetBlocksResult.fill(
261
+ IDL.Record({
262
+ log_length: IDL.Nat,
263
+ blocks: IDL.Vec(IDL.Record({id: IDL.Nat, block: Value})),
264
+ archived_blocks: IDL.Vec(
265
+ IDL.Record({
266
+ args: GetBlocksArgs,
267
+ callback: IDL.Func([GetBlocksArgs], [GetBlocksResult], ['query'])
268
+ })
269
+ )
270
+ })
271
+ );
272
+ export const DataCertificate = IDL.Record({
273
+ certificate: IDL.Vec(IDL.Nat8),
274
+ hash_tree: IDL.Vec(IDL.Nat8)
275
+ });
276
+ export const SupportedBlockType = IDL.Record({
277
+ url: IDL.Text,
278
+ block_type: IDL.Text
279
+ });
280
+ export const WithdrawArgs = IDL.Record({
281
+ to: IDL.Principal,
282
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
283
+ created_at_time: IDL.Opt(IDL.Nat64),
284
+ amount: IDL.Nat
285
+ });
286
+ export const WithdrawError = IDL.Variant({
287
+ FailedToWithdraw: IDL.Record({
288
+ rejection_code: RejectionCode,
289
+ fee_block: IDL.Opt(IDL.Nat),
290
+ rejection_reason: IDL.Text
291
+ }),
292
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
293
+ TemporarilyUnavailable: IDL.Null,
294
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
295
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
296
+ InvalidReceiver: IDL.Record({receiver: IDL.Principal}),
297
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
298
+ TooOld: IDL.Null,
299
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
300
+ });
301
+ export const WithdrawFromArgs = IDL.Record({
302
+ to: IDL.Principal,
303
+ spender_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
304
+ from: Account,
305
+ created_at_time: IDL.Opt(IDL.Nat64),
306
+ amount: IDL.Nat
307
+ });
308
+ export const WithdrawFromError = IDL.Variant({
309
+ GenericError: IDL.Record({message: IDL.Text, error_code: IDL.Nat}),
310
+ TemporarilyUnavailable: IDL.Null,
311
+ InsufficientAllowance: IDL.Record({allowance: IDL.Nat}),
312
+ Duplicate: IDL.Record({duplicate_of: BlockIndex}),
313
+ InvalidReceiver: IDL.Record({receiver: IDL.Principal}),
314
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
315
+ TooOld: IDL.Null,
316
+ FailedToWithdrawFrom: IDL.Record({
317
+ withdraw_from_block: IDL.Opt(IDL.Nat),
318
+ rejection_code: RejectionCode,
319
+ refund_block: IDL.Opt(IDL.Nat),
320
+ approval_refund_block: IDL.Opt(IDL.Nat),
321
+ rejection_reason: IDL.Text
322
+ }),
323
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
324
+ });
325
+
326
+ export const idlService = IDL.Service({
327
+ create_canister: IDL.Func(
328
+ [CreateCanisterArgs],
329
+ [
330
+ IDL.Variant({
331
+ Ok: CreateCanisterSuccess,
332
+ Err: CreateCanisterError
333
+ })
334
+ ],
335
+ []
336
+ ),
337
+ create_canister_from: IDL.Func(
338
+ [CreateCanisterFromArgs],
339
+ [
340
+ IDL.Variant({
341
+ Ok: CreateCanisterSuccess,
342
+ Err: CreateCanisterFromError
343
+ })
344
+ ],
345
+ []
346
+ ),
347
+ deposit: IDL.Func([DepositArgs], [DepositResult], []),
348
+ http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
349
+ icrc103_get_allowances: IDL.Func([GetAllowancesArgs], [ICRC103GetAllowancesResponse], ['query']),
350
+ icrc106_get_index_principal: IDL.Func([], [GetIndexPrincipalResult], ['query']),
351
+ icrc1_balance_of: IDL.Func([Account], [IDL.Nat], ['query']),
352
+ icrc1_decimals: IDL.Func([], [IDL.Nat8], ['query']),
353
+ icrc1_fee: IDL.Func([], [IDL.Nat], ['query']),
354
+ icrc1_metadata: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))], ['query']),
355
+ icrc1_minting_account: IDL.Func([], [IDL.Opt(Account)], ['query']),
356
+ icrc1_name: IDL.Func([], [IDL.Text], ['query']),
357
+ icrc1_supported_standards: IDL.Func([], [IDL.Vec(SupportedStandard)], ['query']),
358
+ icrc1_symbol: IDL.Func([], [IDL.Text], ['query']),
359
+ icrc1_total_supply: IDL.Func([], [IDL.Nat], ['query']),
360
+ icrc1_transfer: IDL.Func([TransferArgs], [IDL.Variant({Ok: BlockIndex, Err: TransferError})], []),
361
+ icrc2_allowance: IDL.Func([AllowanceArgs], [Allowance], ['query']),
362
+ icrc2_approve: IDL.Func([ApproveArgs], [IDL.Variant({Ok: IDL.Nat, Err: ApproveError})], []),
363
+ icrc2_transfer_from: IDL.Func(
364
+ [TransferFromArgs],
365
+ [IDL.Variant({Ok: IDL.Nat, Err: TransferFromError})],
366
+ []
367
+ ),
368
+ icrc3_get_archives: IDL.Func([GetArchivesArgs], [GetArchivesResult], ['query']),
369
+ icrc3_get_blocks: IDL.Func([GetBlocksArgs], [GetBlocksResult], ['query']),
370
+ icrc3_get_tip_certificate: IDL.Func([], [IDL.Opt(DataCertificate)], ['query']),
371
+ icrc3_supported_block_types: IDL.Func([], [IDL.Vec(SupportedBlockType)], ['query']),
372
+ withdraw: IDL.Func([WithdrawArgs], [IDL.Variant({Ok: BlockIndex, Err: WithdrawError})], []),
373
+ withdraw_from: IDL.Func(
374
+ [WithdrawFromArgs],
375
+ [IDL.Variant({Ok: BlockIndex, Err: WithdrawFromError})],
376
+ []
377
+ )
378
+ });
379
+
380
+ export const idlInitArgs = [LedgerArgs];
381
+
382
+ export const idlFactory = ({IDL}) => {
383
+ const GetBlocksResult = IDL.Rec();
384
+ const Value = IDL.Rec();
385
+ const ChangeIndexId = IDL.Variant({
386
+ SetTo: IDL.Principal,
387
+ Unset: IDL.Null
388
+ });
389
+ const UpgradeArgs = IDL.Record({
390
+ change_index_id: IDL.Opt(ChangeIndexId),
391
+ max_blocks_per_request: IDL.Opt(IDL.Nat64)
392
+ });
393
+ const Account = IDL.Record({
394
+ owner: IDL.Principal,
395
+ subaccount: IDL.Opt(IDL.Vec(IDL.Nat8))
396
+ });
397
+ const InitArgs = IDL.Record({
398
+ initial_balances: IDL.Opt(IDL.Vec(IDL.Tuple(Account, IDL.Nat))),
399
+ index_id: IDL.Opt(IDL.Principal),
400
+ max_blocks_per_request: IDL.Nat64
401
+ });
402
+ const LedgerArgs = IDL.Variant({
403
+ Upgrade: IDL.Opt(UpgradeArgs),
404
+ Init: InitArgs
405
+ });
406
+ const SubnetFilter = IDL.Record({subnet_type: IDL.Opt(IDL.Text)});
407
+ const SubnetSelection = IDL.Variant({
408
+ Filter: SubnetFilter,
409
+ Subnet: IDL.Record({subnet: IDL.Principal})
410
+ });
411
+ const CanisterSettings = IDL.Record({
412
+ freezing_threshold: IDL.Opt(IDL.Nat),
413
+ controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
414
+ reserved_cycles_limit: IDL.Opt(IDL.Nat),
415
+ memory_allocation: IDL.Opt(IDL.Nat),
416
+ compute_allocation: IDL.Opt(IDL.Nat)
417
+ });
418
+ const CmcCreateCanisterArgs = IDL.Record({
419
+ subnet_selection: IDL.Opt(SubnetSelection),
420
+ settings: IDL.Opt(CanisterSettings)
421
+ });
422
+ const CreateCanisterArgs = IDL.Record({
423
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
424
+ created_at_time: IDL.Opt(IDL.Nat64),
425
+ amount: IDL.Nat,
426
+ creation_args: IDL.Opt(CmcCreateCanisterArgs)
427
+ });
428
+ const BlockIndex = IDL.Nat;
429
+ const CreateCanisterSuccess = IDL.Record({
430
+ block_id: BlockIndex,
431
+ canister_id: IDL.Principal
432
+ });
433
+ const CreateCanisterError = IDL.Variant({
434
+ GenericError: IDL.Record({
435
+ message: IDL.Text,
436
+ error_code: IDL.Nat
437
+ }),
438
+ TemporarilyUnavailable: IDL.Null,
439
+ Duplicate: IDL.Record({
440
+ duplicate_of: IDL.Nat,
441
+ canister_id: IDL.Opt(IDL.Principal)
442
+ }),
443
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
444
+ FailedToCreate: IDL.Record({
445
+ error: IDL.Text,
446
+ refund_block: IDL.Opt(BlockIndex),
447
+ fee_block: IDL.Opt(BlockIndex)
448
+ }),
449
+ TooOld: IDL.Null,
450
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
451
+ });
452
+ const CreateCanisterFromArgs = IDL.Record({
453
+ spender_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
454
+ from: Account,
455
+ created_at_time: IDL.Opt(IDL.Nat64),
456
+ amount: IDL.Nat,
457
+ creation_args: IDL.Opt(CmcCreateCanisterArgs)
458
+ });
459
+ const RejectionCode = IDL.Variant({
460
+ NoError: IDL.Null,
461
+ CanisterError: IDL.Null,
462
+ SysTransient: IDL.Null,
463
+ DestinationInvalid: IDL.Null,
464
+ Unknown: IDL.Null,
465
+ SysFatal: IDL.Null,
466
+ CanisterReject: IDL.Null
467
+ });
468
+ const CreateCanisterFromError = IDL.Variant({
469
+ FailedToCreateFrom: IDL.Record({
470
+ create_from_block: IDL.Opt(BlockIndex),
471
+ rejection_code: RejectionCode,
472
+ refund_block: IDL.Opt(BlockIndex),
473
+ approval_refund_block: IDL.Opt(BlockIndex),
474
+ rejection_reason: IDL.Text
475
+ }),
476
+ GenericError: IDL.Record({
477
+ message: IDL.Text,
478
+ error_code: IDL.Nat
479
+ }),
480
+ TemporarilyUnavailable: IDL.Null,
481
+ InsufficientAllowance: IDL.Record({allowance: IDL.Nat}),
482
+ Duplicate: IDL.Record({
483
+ duplicate_of: IDL.Nat,
484
+ canister_id: IDL.Opt(IDL.Principal)
485
+ }),
486
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
487
+ TooOld: IDL.Null,
488
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
489
+ });
490
+ const DepositArgs = IDL.Record({
491
+ to: Account,
492
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8))
493
+ });
494
+ const DepositResult = IDL.Record({
495
+ balance: IDL.Nat,
496
+ block_index: BlockIndex
497
+ });
498
+ const HttpRequest = IDL.Record({
499
+ url: IDL.Text,
500
+ method: IDL.Text,
501
+ body: IDL.Vec(IDL.Nat8),
502
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))
503
+ });
504
+ const HttpResponse = IDL.Record({
505
+ body: IDL.Vec(IDL.Nat8),
506
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
507
+ status_code: IDL.Nat16
508
+ });
509
+ const GetAllowancesArgs = IDL.Record({
510
+ take: IDL.Opt(IDL.Nat),
511
+ prev_spender: IDL.Opt(Account),
512
+ from_account: IDL.Opt(Account)
513
+ });
514
+ const Allowances = IDL.Vec(
515
+ IDL.Record({
516
+ from_account: Account,
517
+ to_spender: Account,
518
+ allowance: IDL.Nat,
519
+ expires_at: IDL.Opt(IDL.Nat64)
520
+ })
521
+ );
522
+ const GetAllowancesError = IDL.Variant({
523
+ GenericError: IDL.Record({
524
+ message: IDL.Text,
525
+ error_code: IDL.Nat
526
+ }),
527
+ AccessDenied: IDL.Record({reason: IDL.Text})
528
+ });
529
+ const ICRC103GetAllowancesResponse = IDL.Variant({
530
+ Ok: Allowances,
531
+ Err: GetAllowancesError
532
+ });
533
+ const GetIndexPrincipalError = IDL.Variant({
534
+ GenericError: IDL.Record({
535
+ description: IDL.Text,
536
+ error_code: IDL.Nat
537
+ }),
538
+ IndexPrincipalNotSet: IDL.Null
539
+ });
540
+ const GetIndexPrincipalResult = IDL.Variant({
541
+ Ok: IDL.Principal,
542
+ Err: GetIndexPrincipalError
543
+ });
544
+ const MetadataValue = IDL.Variant({
545
+ Int: IDL.Int,
546
+ Nat: IDL.Nat,
547
+ Blob: IDL.Vec(IDL.Nat8),
548
+ Text: IDL.Text
549
+ });
550
+ const SupportedStandard = IDL.Record({url: IDL.Text, name: IDL.Text});
551
+ const TransferArgs = IDL.Record({
552
+ to: Account,
553
+ fee: IDL.Opt(IDL.Nat),
554
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
555
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
556
+ created_at_time: IDL.Opt(IDL.Nat64),
557
+ amount: IDL.Nat
558
+ });
559
+ const TransferError = IDL.Variant({
560
+ GenericError: IDL.Record({
561
+ message: IDL.Text,
562
+ error_code: IDL.Nat
563
+ }),
564
+ TemporarilyUnavailable: IDL.Null,
565
+ BadBurn: IDL.Record({min_burn_amount: IDL.Nat}),
566
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
567
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
568
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
569
+ TooOld: IDL.Null,
570
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
571
+ });
572
+ const AllowanceArgs = IDL.Record({
573
+ account: Account,
574
+ spender: Account
575
+ });
576
+ const Allowance = IDL.Record({
577
+ allowance: IDL.Nat,
578
+ expires_at: IDL.Opt(IDL.Nat64)
579
+ });
580
+ const ApproveArgs = IDL.Record({
581
+ fee: IDL.Opt(IDL.Nat),
582
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
583
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
584
+ created_at_time: IDL.Opt(IDL.Nat64),
585
+ amount: IDL.Nat,
586
+ expected_allowance: IDL.Opt(IDL.Nat),
587
+ expires_at: IDL.Opt(IDL.Nat64),
588
+ spender: Account
589
+ });
590
+ const ApproveError = IDL.Variant({
591
+ GenericError: IDL.Record({
592
+ message: IDL.Text,
593
+ error_code: IDL.Nat
594
+ }),
595
+ TemporarilyUnavailable: IDL.Null,
596
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
597
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
598
+ AllowanceChanged: IDL.Record({current_allowance: IDL.Nat}),
599
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
600
+ TooOld: IDL.Null,
601
+ Expired: IDL.Record({ledger_time: IDL.Nat64}),
602
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
603
+ });
604
+ const TransferFromArgs = IDL.Record({
605
+ to: Account,
606
+ fee: IDL.Opt(IDL.Nat),
607
+ spender_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
608
+ from: Account,
609
+ memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
610
+ created_at_time: IDL.Opt(IDL.Nat64),
611
+ amount: IDL.Nat
612
+ });
613
+ const TransferFromError = IDL.Variant({
614
+ GenericError: IDL.Record({
615
+ message: IDL.Text,
616
+ error_code: IDL.Nat
617
+ }),
618
+ TemporarilyUnavailable: IDL.Null,
619
+ InsufficientAllowance: IDL.Record({allowance: IDL.Nat}),
620
+ BadBurn: IDL.Record({min_burn_amount: IDL.Nat}),
621
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
622
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
623
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
624
+ TooOld: IDL.Null,
625
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
626
+ });
627
+ const GetArchivesArgs = IDL.Record({from: IDL.Opt(IDL.Principal)});
628
+ const GetArchivesResult = IDL.Vec(
629
+ IDL.Record({
630
+ end: IDL.Nat,
631
+ canister_id: IDL.Principal,
632
+ start: IDL.Nat
633
+ })
634
+ );
635
+ const GetBlocksArgs = IDL.Vec(IDL.Record({start: IDL.Nat, length: IDL.Nat}));
636
+ Value.fill(
637
+ IDL.Variant({
638
+ Int: IDL.Int,
639
+ Map: IDL.Vec(IDL.Tuple(IDL.Text, Value)),
640
+ Nat: IDL.Nat,
641
+ Nat64: IDL.Nat64,
642
+ Blob: IDL.Vec(IDL.Nat8),
643
+ Text: IDL.Text,
644
+ Array: IDL.Vec(Value)
645
+ })
646
+ );
647
+ GetBlocksResult.fill(
648
+ IDL.Record({
649
+ log_length: IDL.Nat,
650
+ blocks: IDL.Vec(IDL.Record({id: IDL.Nat, block: Value})),
651
+ archived_blocks: IDL.Vec(
652
+ IDL.Record({
653
+ args: GetBlocksArgs,
654
+ callback: IDL.Func([GetBlocksArgs], [GetBlocksResult], ['query'])
655
+ })
656
+ )
657
+ })
658
+ );
659
+ const DataCertificate = IDL.Record({
660
+ certificate: IDL.Vec(IDL.Nat8),
661
+ hash_tree: IDL.Vec(IDL.Nat8)
662
+ });
663
+ const SupportedBlockType = IDL.Record({
664
+ url: IDL.Text,
665
+ block_type: IDL.Text
666
+ });
667
+ const WithdrawArgs = IDL.Record({
668
+ to: IDL.Principal,
669
+ from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
670
+ created_at_time: IDL.Opt(IDL.Nat64),
671
+ amount: IDL.Nat
672
+ });
673
+ const WithdrawError = IDL.Variant({
674
+ FailedToWithdraw: IDL.Record({
675
+ rejection_code: RejectionCode,
676
+ fee_block: IDL.Opt(IDL.Nat),
677
+ rejection_reason: IDL.Text
678
+ }),
679
+ GenericError: IDL.Record({
680
+ message: IDL.Text,
681
+ error_code: IDL.Nat
682
+ }),
683
+ TemporarilyUnavailable: IDL.Null,
684
+ Duplicate: IDL.Record({duplicate_of: IDL.Nat}),
685
+ BadFee: IDL.Record({expected_fee: IDL.Nat}),
686
+ InvalidReceiver: IDL.Record({receiver: IDL.Principal}),
687
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
688
+ TooOld: IDL.Null,
689
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
690
+ });
691
+ const WithdrawFromArgs = IDL.Record({
692
+ to: IDL.Principal,
693
+ spender_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
694
+ from: Account,
695
+ created_at_time: IDL.Opt(IDL.Nat64),
696
+ amount: IDL.Nat
697
+ });
698
+ const WithdrawFromError = IDL.Variant({
699
+ GenericError: IDL.Record({
700
+ message: IDL.Text,
701
+ error_code: IDL.Nat
702
+ }),
703
+ TemporarilyUnavailable: IDL.Null,
704
+ InsufficientAllowance: IDL.Record({allowance: IDL.Nat}),
705
+ Duplicate: IDL.Record({duplicate_of: BlockIndex}),
706
+ InvalidReceiver: IDL.Record({receiver: IDL.Principal}),
707
+ CreatedInFuture: IDL.Record({ledger_time: IDL.Nat64}),
708
+ TooOld: IDL.Null,
709
+ FailedToWithdrawFrom: IDL.Record({
710
+ withdraw_from_block: IDL.Opt(IDL.Nat),
711
+ rejection_code: RejectionCode,
712
+ refund_block: IDL.Opt(IDL.Nat),
713
+ approval_refund_block: IDL.Opt(IDL.Nat),
714
+ rejection_reason: IDL.Text
715
+ }),
716
+ InsufficientFunds: IDL.Record({balance: IDL.Nat})
717
+ });
718
+
719
+ return IDL.Service({
720
+ create_canister: IDL.Func(
721
+ [CreateCanisterArgs],
722
+ [
723
+ IDL.Variant({
724
+ Ok: CreateCanisterSuccess,
725
+ Err: CreateCanisterError
726
+ })
727
+ ],
728
+ []
729
+ ),
730
+ create_canister_from: IDL.Func(
731
+ [CreateCanisterFromArgs],
732
+ [
733
+ IDL.Variant({
734
+ Ok: CreateCanisterSuccess,
735
+ Err: CreateCanisterFromError
736
+ })
737
+ ],
738
+ []
739
+ ),
740
+ deposit: IDL.Func([DepositArgs], [DepositResult], []),
741
+ http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
742
+ icrc103_get_allowances: IDL.Func(
743
+ [GetAllowancesArgs],
744
+ [ICRC103GetAllowancesResponse],
745
+ ['query']
746
+ ),
747
+ icrc106_get_index_principal: IDL.Func([], [GetIndexPrincipalResult], ['query']),
748
+ icrc1_balance_of: IDL.Func([Account], [IDL.Nat], ['query']),
749
+ icrc1_decimals: IDL.Func([], [IDL.Nat8], ['query']),
750
+ icrc1_fee: IDL.Func([], [IDL.Nat], ['query']),
751
+ icrc1_metadata: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))], ['query']),
752
+ icrc1_minting_account: IDL.Func([], [IDL.Opt(Account)], ['query']),
753
+ icrc1_name: IDL.Func([], [IDL.Text], ['query']),
754
+ icrc1_supported_standards: IDL.Func([], [IDL.Vec(SupportedStandard)], ['query']),
755
+ icrc1_symbol: IDL.Func([], [IDL.Text], ['query']),
756
+ icrc1_total_supply: IDL.Func([], [IDL.Nat], ['query']),
757
+ icrc1_transfer: IDL.Func(
758
+ [TransferArgs],
759
+ [IDL.Variant({Ok: BlockIndex, Err: TransferError})],
760
+ []
761
+ ),
762
+ icrc2_allowance: IDL.Func([AllowanceArgs], [Allowance], ['query']),
763
+ icrc2_approve: IDL.Func([ApproveArgs], [IDL.Variant({Ok: IDL.Nat, Err: ApproveError})], []),
764
+ icrc2_transfer_from: IDL.Func(
765
+ [TransferFromArgs],
766
+ [IDL.Variant({Ok: IDL.Nat, Err: TransferFromError})],
767
+ []
768
+ ),
769
+ icrc3_get_archives: IDL.Func([GetArchivesArgs], [GetArchivesResult], ['query']),
770
+ icrc3_get_blocks: IDL.Func([GetBlocksArgs], [GetBlocksResult], ['query']),
771
+ icrc3_get_tip_certificate: IDL.Func([], [IDL.Opt(DataCertificate)], ['query']),
772
+ icrc3_supported_block_types: IDL.Func([], [IDL.Vec(SupportedBlockType)], ['query']),
773
+ withdraw: IDL.Func([WithdrawArgs], [IDL.Variant({Ok: BlockIndex, Err: WithdrawError})], []),
774
+ withdraw_from: IDL.Func(
775
+ [WithdrawFromArgs],
776
+ [IDL.Variant({Ok: BlockIndex, Err: WithdrawFromError})],
777
+ []
778
+ )
779
+ });
780
+ };
781
+
782
+ export const init = ({IDL}) => {
783
+ const ChangeIndexId = IDL.Variant({
784
+ SetTo: IDL.Principal,
785
+ Unset: IDL.Null
786
+ });
787
+ const UpgradeArgs = IDL.Record({
788
+ change_index_id: IDL.Opt(ChangeIndexId),
789
+ max_blocks_per_request: IDL.Opt(IDL.Nat64)
790
+ });
791
+ const Account = IDL.Record({
792
+ owner: IDL.Principal,
793
+ subaccount: IDL.Opt(IDL.Vec(IDL.Nat8))
794
+ });
795
+ const InitArgs = IDL.Record({
796
+ initial_balances: IDL.Opt(IDL.Vec(IDL.Tuple(Account, IDL.Nat))),
797
+ index_id: IDL.Opt(IDL.Principal),
798
+ max_blocks_per_request: IDL.Nat64
799
+ });
800
+ const LedgerArgs = IDL.Variant({
801
+ Upgrade: IDL.Opt(UpgradeArgs),
802
+ Init: InitArgs
803
+ });
804
+
805
+ return [LedgerArgs];
806
+ };