@ic-pay/icpay-sdk 1.3.61

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 (38) hide show
  1. package/README.md +32 -0
  2. package/dist/declarations/icp-ledger/icp-ledger.did.d.ts +82 -0
  3. package/dist/declarations/icp-ledger/icp-ledger.did.js +76 -0
  4. package/dist/declarations/icpay_canister_backend/icpay_canister_backend.did +193 -0
  5. package/dist/declarations/icpay_canister_backend/icpay_canister_backend.did.d.ts +219 -0
  6. package/dist/declarations/icpay_canister_backend/icpay_canister_backend.did.js +231 -0
  7. package/dist/declarations/icrc-ledger/ledger.did +560 -0
  8. package/dist/declarations/icrc-ledger/ledger.did.d.ts +364 -0
  9. package/dist/declarations/icrc-ledger/ledger.did.js +530 -0
  10. package/dist/errors.d.ts +72 -0
  11. package/dist/errors.d.ts.map +1 -0
  12. package/dist/errors.js +162 -0
  13. package/dist/errors.js.map +1 -0
  14. package/dist/events.d.ts +24 -0
  15. package/dist/events.d.ts.map +1 -0
  16. package/dist/events.js +131 -0
  17. package/dist/events.js.map +1 -0
  18. package/dist/index.d.ts +163 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +1211 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/protected.d.ts +28 -0
  23. package/dist/protected.d.ts.map +1 -0
  24. package/dist/protected.js +336 -0
  25. package/dist/protected.js.map +1 -0
  26. package/dist/types/index.d.ts +482 -0
  27. package/dist/types/index.d.ts.map +1 -0
  28. package/dist/types/index.js +3 -0
  29. package/dist/types/index.js.map +1 -0
  30. package/dist/utils.d.ts +15 -0
  31. package/dist/utils.d.ts.map +1 -0
  32. package/dist/utils.js +42 -0
  33. package/dist/utils.js.map +1 -0
  34. package/dist/wallet.d.ts +83 -0
  35. package/dist/wallet.d.ts.map +1 -0
  36. package/dist/wallet.js +261 -0
  37. package/dist/wallet.js.map +1 -0
  38. package/package.json +58 -0
@@ -0,0 +1,530 @@
1
+ export const idlFactory = ({ IDL }) => {
2
+ const GetBlocksResult = IDL.Rec();
3
+ const ICRC3Value = IDL.Rec();
4
+ const Value = IDL.Rec();
5
+ const ChangeArchiveOptions = IDL.Record({
6
+ 'num_blocks_to_archive' : IDL.Opt(IDL.Nat64),
7
+ 'max_transactions_per_response' : IDL.Opt(IDL.Nat64),
8
+ 'trigger_threshold' : IDL.Opt(IDL.Nat64),
9
+ 'more_controller_ids' : IDL.Opt(IDL.Vec(IDL.Principal)),
10
+ 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
11
+ 'cycles_for_archive_creation' : IDL.Opt(IDL.Nat64),
12
+ 'node_max_memory_size_bytes' : IDL.Opt(IDL.Nat64),
13
+ 'controller_id' : IDL.Opt(IDL.Principal),
14
+ });
15
+ const MetadataValue = IDL.Variant({
16
+ 'Int' : IDL.Int,
17
+ 'Nat' : IDL.Nat,
18
+ 'Blob' : IDL.Vec(IDL.Nat8),
19
+ 'Text' : IDL.Text,
20
+ });
21
+ const Subaccount = IDL.Vec(IDL.Nat8);
22
+ const Account = IDL.Record({
23
+ 'owner' : IDL.Principal,
24
+ 'subaccount' : IDL.Opt(Subaccount),
25
+ });
26
+ const ChangeFeeCollector = IDL.Variant({
27
+ 'SetTo' : Account,
28
+ 'Unset' : IDL.Null,
29
+ });
30
+ const FeatureFlags = IDL.Record({ 'icrc2' : IDL.Bool });
31
+ const UpgradeArgs = IDL.Record({
32
+ 'change_archive_options' : IDL.Opt(ChangeArchiveOptions),
33
+ 'token_symbol' : IDL.Opt(IDL.Text),
34
+ 'transfer_fee' : IDL.Opt(IDL.Nat),
35
+ 'metadata' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))),
36
+ 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),
37
+ 'max_memo_length' : IDL.Opt(IDL.Nat16),
38
+ 'index_principal' : IDL.Opt(IDL.Principal),
39
+ 'token_name' : IDL.Opt(IDL.Text),
40
+ 'feature_flags' : IDL.Opt(FeatureFlags),
41
+ });
42
+ const InitArgs = IDL.Record({
43
+ 'decimals' : IDL.Opt(IDL.Nat8),
44
+ 'token_symbol' : IDL.Text,
45
+ 'transfer_fee' : IDL.Nat,
46
+ 'metadata' : IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue)),
47
+ 'minting_account' : Account,
48
+ 'initial_balances' : IDL.Vec(IDL.Tuple(Account, IDL.Nat)),
49
+ 'fee_collector_account' : IDL.Opt(Account),
50
+ 'archive_options' : IDL.Record({
51
+ 'num_blocks_to_archive' : IDL.Nat64,
52
+ 'max_transactions_per_response' : IDL.Opt(IDL.Nat64),
53
+ 'trigger_threshold' : IDL.Nat64,
54
+ 'more_controller_ids' : IDL.Opt(IDL.Vec(IDL.Principal)),
55
+ 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
56
+ 'cycles_for_archive_creation' : IDL.Opt(IDL.Nat64),
57
+ 'node_max_memory_size_bytes' : IDL.Opt(IDL.Nat64),
58
+ 'controller_id' : IDL.Principal,
59
+ }),
60
+ 'max_memo_length' : IDL.Opt(IDL.Nat16),
61
+ 'index_principal' : IDL.Opt(IDL.Principal),
62
+ 'token_name' : IDL.Text,
63
+ 'feature_flags' : IDL.Opt(FeatureFlags),
64
+ });
65
+ const LedgerArg = IDL.Variant({
66
+ 'Upgrade' : IDL.Opt(UpgradeArgs),
67
+ 'Init' : InitArgs,
68
+ });
69
+ const BlockIndex = IDL.Nat;
70
+ const ArchiveInfo = IDL.Record({
71
+ 'block_range_end' : BlockIndex,
72
+ 'canister_id' : IDL.Principal,
73
+ 'block_range_start' : BlockIndex,
74
+ });
75
+ const GetBlocksArgs = IDL.Record({
76
+ 'start' : BlockIndex,
77
+ 'length' : IDL.Nat,
78
+ });
79
+ const Map = IDL.Vec(IDL.Tuple(IDL.Text, Value));
80
+ Value.fill(
81
+ IDL.Variant({
82
+ 'Int' : IDL.Int,
83
+ 'Map' : Map,
84
+ 'Nat' : IDL.Nat,
85
+ 'Nat64' : IDL.Nat64,
86
+ 'Blob' : IDL.Vec(IDL.Nat8),
87
+ 'Text' : IDL.Text,
88
+ 'Array' : IDL.Vec(Value),
89
+ })
90
+ );
91
+ const Block = Value;
92
+ const BlockRange = IDL.Record({ 'blocks' : IDL.Vec(Block) });
93
+ const QueryBlockArchiveFn = IDL.Func(
94
+ [GetBlocksArgs],
95
+ [BlockRange],
96
+ ['query'],
97
+ );
98
+ const GetBlocksResponse = IDL.Record({
99
+ 'certificate' : IDL.Opt(IDL.Vec(IDL.Nat8)),
100
+ 'first_index' : BlockIndex,
101
+ 'blocks' : IDL.Vec(Block),
102
+ 'chain_length' : IDL.Nat64,
103
+ 'archived_blocks' : IDL.Vec(
104
+ IDL.Record({
105
+ 'callback' : QueryBlockArchiveFn,
106
+ 'start' : BlockIndex,
107
+ 'length' : IDL.Nat,
108
+ })
109
+ ),
110
+ });
111
+ const DataCertificate = IDL.Record({
112
+ 'certificate' : IDL.Opt(IDL.Vec(IDL.Nat8)),
113
+ 'hash_tree' : IDL.Vec(IDL.Nat8),
114
+ });
115
+ const TxIndex = IDL.Nat;
116
+ const GetTransactionsRequest = IDL.Record({
117
+ 'start' : TxIndex,
118
+ 'length' : IDL.Nat,
119
+ });
120
+ const Timestamp = IDL.Nat64;
121
+ const Burn = IDL.Record({
122
+ 'from' : Account,
123
+ 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
124
+ 'created_at_time' : IDL.Opt(Timestamp),
125
+ 'amount' : IDL.Nat,
126
+ 'spender' : IDL.Opt(Account),
127
+ });
128
+ const Mint = IDL.Record({
129
+ 'to' : Account,
130
+ 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
131
+ 'created_at_time' : IDL.Opt(Timestamp),
132
+ 'amount' : IDL.Nat,
133
+ });
134
+ const Approve = IDL.Record({
135
+ 'fee' : IDL.Opt(IDL.Nat),
136
+ 'from' : Account,
137
+ 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
138
+ 'created_at_time' : IDL.Opt(Timestamp),
139
+ 'amount' : IDL.Nat,
140
+ 'expected_allowance' : IDL.Opt(IDL.Nat),
141
+ 'expires_at' : IDL.Opt(Timestamp),
142
+ 'spender' : Account,
143
+ });
144
+ const Transfer = IDL.Record({
145
+ 'to' : Account,
146
+ 'fee' : IDL.Opt(IDL.Nat),
147
+ 'from' : Account,
148
+ 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
149
+ 'created_at_time' : IDL.Opt(Timestamp),
150
+ 'amount' : IDL.Nat,
151
+ 'spender' : IDL.Opt(Account),
152
+ });
153
+ const Transaction = IDL.Record({
154
+ 'burn' : IDL.Opt(Burn),
155
+ 'kind' : IDL.Text,
156
+ 'mint' : IDL.Opt(Mint),
157
+ 'approve' : IDL.Opt(Approve),
158
+ 'timestamp' : Timestamp,
159
+ 'transfer' : IDL.Opt(Transfer),
160
+ });
161
+ const TransactionRange = IDL.Record({
162
+ 'transactions' : IDL.Vec(Transaction),
163
+ });
164
+ const QueryArchiveFn = IDL.Func(
165
+ [GetTransactionsRequest],
166
+ [TransactionRange],
167
+ ['query'],
168
+ );
169
+ const GetTransactionsResponse = IDL.Record({
170
+ 'first_index' : TxIndex,
171
+ 'log_length' : IDL.Nat,
172
+ 'transactions' : IDL.Vec(Transaction),
173
+ 'archived_transactions' : IDL.Vec(
174
+ IDL.Record({
175
+ 'callback' : QueryArchiveFn,
176
+ 'start' : TxIndex,
177
+ 'length' : IDL.Nat,
178
+ })
179
+ ),
180
+ });
181
+ const GetAllowancesArgs = IDL.Record({
182
+ 'take' : IDL.Opt(IDL.Nat),
183
+ 'prev_spender' : IDL.Opt(Account),
184
+ 'from_account' : IDL.Opt(Account),
185
+ });
186
+ const Allowance103 = IDL.Record({
187
+ 'from_account' : Account,
188
+ 'to_spender' : Account,
189
+ 'allowance' : IDL.Nat,
190
+ 'expires_at' : IDL.Opt(IDL.Nat64),
191
+ });
192
+ const GetAllowancesError = IDL.Variant({
193
+ 'GenericError' : IDL.Record({
194
+ 'message' : IDL.Text,
195
+ 'error_code' : IDL.Nat,
196
+ }),
197
+ 'AccessDenied' : IDL.Record({ 'reason' : IDL.Text }),
198
+ });
199
+ const icrc103_get_allowances_response = IDL.Variant({
200
+ 'Ok' : IDL.Vec(Allowance103),
201
+ 'Err' : GetAllowancesError,
202
+ });
203
+ const GetIndexPrincipalError = IDL.Variant({
204
+ 'GenericError' : IDL.Record({
205
+ 'description' : IDL.Text,
206
+ 'error_code' : IDL.Nat,
207
+ }),
208
+ 'IndexPrincipalNotSet' : IDL.Null,
209
+ });
210
+ const GetIndexPrincipalResult = IDL.Variant({
211
+ 'Ok' : IDL.Principal,
212
+ 'Err' : GetIndexPrincipalError,
213
+ });
214
+ const Tokens = IDL.Nat;
215
+ const StandardRecord = IDL.Record({ 'url' : IDL.Text, 'name' : IDL.Text });
216
+ const TransferArg = IDL.Record({
217
+ 'to' : Account,
218
+ 'fee' : IDL.Opt(Tokens),
219
+ 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
220
+ 'from_subaccount' : IDL.Opt(Subaccount),
221
+ 'created_at_time' : IDL.Opt(Timestamp),
222
+ 'amount' : Tokens,
223
+ });
224
+ const TransferError = IDL.Variant({
225
+ 'GenericError' : IDL.Record({
226
+ 'message' : IDL.Text,
227
+ 'error_code' : IDL.Nat,
228
+ }),
229
+ 'TemporarilyUnavailable' : IDL.Null,
230
+ 'BadBurn' : IDL.Record({ 'min_burn_amount' : Tokens }),
231
+ 'Duplicate' : IDL.Record({ 'duplicate_of' : BlockIndex }),
232
+ 'BadFee' : IDL.Record({ 'expected_fee' : Tokens }),
233
+ 'CreatedInFuture' : IDL.Record({ 'ledger_time' : Timestamp }),
234
+ 'TooOld' : IDL.Null,
235
+ 'InsufficientFunds' : IDL.Record({ 'balance' : Tokens }),
236
+ });
237
+ const TransferResult = IDL.Variant({
238
+ 'Ok' : BlockIndex,
239
+ 'Err' : TransferError,
240
+ });
241
+ const icrc21_consent_message_metadata = IDL.Record({
242
+ 'utc_offset_minutes' : IDL.Opt(IDL.Int16),
243
+ 'language' : IDL.Text,
244
+ });
245
+ const icrc21_consent_message_spec = IDL.Record({
246
+ 'metadata' : icrc21_consent_message_metadata,
247
+ 'device_spec' : IDL.Opt(
248
+ IDL.Variant({
249
+ 'GenericDisplay' : IDL.Null,
250
+ 'LineDisplay' : IDL.Record({
251
+ 'characters_per_line' : IDL.Nat16,
252
+ 'lines_per_page' : IDL.Nat16,
253
+ }),
254
+ })
255
+ ),
256
+ });
257
+ const icrc21_consent_message_request = IDL.Record({
258
+ 'arg' : IDL.Vec(IDL.Nat8),
259
+ 'method' : IDL.Text,
260
+ 'user_preferences' : icrc21_consent_message_spec,
261
+ });
262
+ const icrc21_consent_message = IDL.Variant({
263
+ 'LineDisplayMessage' : IDL.Record({
264
+ 'pages' : IDL.Vec(IDL.Record({ 'lines' : IDL.Vec(IDL.Text) })),
265
+ }),
266
+ 'GenericDisplayMessage' : IDL.Text,
267
+ });
268
+ const icrc21_consent_info = IDL.Record({
269
+ 'metadata' : icrc21_consent_message_metadata,
270
+ 'consent_message' : icrc21_consent_message,
271
+ });
272
+ const icrc21_error_info = IDL.Record({ 'description' : IDL.Text });
273
+ const icrc21_error = IDL.Variant({
274
+ 'GenericError' : IDL.Record({
275
+ 'description' : IDL.Text,
276
+ 'error_code' : IDL.Nat,
277
+ }),
278
+ 'InsufficientPayment' : icrc21_error_info,
279
+ 'UnsupportedCanisterCall' : icrc21_error_info,
280
+ 'ConsentMessageUnavailable' : icrc21_error_info,
281
+ });
282
+ const icrc21_consent_message_response = IDL.Variant({
283
+ 'Ok' : icrc21_consent_info,
284
+ 'Err' : icrc21_error,
285
+ });
286
+ const AllowanceArgs = IDL.Record({
287
+ 'account' : Account,
288
+ 'spender' : Account,
289
+ });
290
+ const Allowance = IDL.Record({
291
+ 'allowance' : IDL.Nat,
292
+ 'expires_at' : IDL.Opt(Timestamp),
293
+ });
294
+ const ApproveArgs = IDL.Record({
295
+ 'fee' : IDL.Opt(IDL.Nat),
296
+ 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
297
+ 'from_subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)),
298
+ 'created_at_time' : IDL.Opt(Timestamp),
299
+ 'amount' : IDL.Nat,
300
+ 'expected_allowance' : IDL.Opt(IDL.Nat),
301
+ 'expires_at' : IDL.Opt(Timestamp),
302
+ 'spender' : Account,
303
+ });
304
+ const ApproveError = IDL.Variant({
305
+ 'GenericError' : IDL.Record({
306
+ 'message' : IDL.Text,
307
+ 'error_code' : IDL.Nat,
308
+ }),
309
+ 'TemporarilyUnavailable' : IDL.Null,
310
+ 'Duplicate' : IDL.Record({ 'duplicate_of' : BlockIndex }),
311
+ 'BadFee' : IDL.Record({ 'expected_fee' : IDL.Nat }),
312
+ 'AllowanceChanged' : IDL.Record({ 'current_allowance' : IDL.Nat }),
313
+ 'CreatedInFuture' : IDL.Record({ 'ledger_time' : Timestamp }),
314
+ 'TooOld' : IDL.Null,
315
+ 'Expired' : IDL.Record({ 'ledger_time' : Timestamp }),
316
+ 'InsufficientFunds' : IDL.Record({ 'balance' : IDL.Nat }),
317
+ });
318
+ const ApproveResult = IDL.Variant({
319
+ 'Ok' : BlockIndex,
320
+ 'Err' : ApproveError,
321
+ });
322
+ const TransferFromArgs = IDL.Record({
323
+ 'to' : Account,
324
+ 'fee' : IDL.Opt(Tokens),
325
+ 'spender_subaccount' : IDL.Opt(Subaccount),
326
+ 'from' : Account,
327
+ 'memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
328
+ 'created_at_time' : IDL.Opt(Timestamp),
329
+ 'amount' : Tokens,
330
+ });
331
+ const TransferFromError = IDL.Variant({
332
+ 'GenericError' : IDL.Record({
333
+ 'message' : IDL.Text,
334
+ 'error_code' : IDL.Nat,
335
+ }),
336
+ 'TemporarilyUnavailable' : IDL.Null,
337
+ 'InsufficientAllowance' : IDL.Record({ 'allowance' : Tokens }),
338
+ 'BadBurn' : IDL.Record({ 'min_burn_amount' : Tokens }),
339
+ 'Duplicate' : IDL.Record({ 'duplicate_of' : BlockIndex }),
340
+ 'BadFee' : IDL.Record({ 'expected_fee' : Tokens }),
341
+ 'CreatedInFuture' : IDL.Record({ 'ledger_time' : Timestamp }),
342
+ 'TooOld' : IDL.Null,
343
+ 'InsufficientFunds' : IDL.Record({ 'balance' : Tokens }),
344
+ });
345
+ const TransferFromResult = IDL.Variant({
346
+ 'Ok' : BlockIndex,
347
+ 'Err' : TransferFromError,
348
+ });
349
+ const GetArchivesArgs = IDL.Record({ 'from' : IDL.Opt(IDL.Principal) });
350
+ const GetArchivesResult = IDL.Vec(
351
+ IDL.Record({
352
+ 'end' : IDL.Nat,
353
+ 'canister_id' : IDL.Principal,
354
+ 'start' : IDL.Nat,
355
+ })
356
+ );
357
+ ICRC3Value.fill(
358
+ IDL.Variant({
359
+ 'Int' : IDL.Int,
360
+ 'Map' : IDL.Vec(IDL.Tuple(IDL.Text, ICRC3Value)),
361
+ 'Nat' : IDL.Nat,
362
+ 'Blob' : IDL.Vec(IDL.Nat8),
363
+ 'Text' : IDL.Text,
364
+ 'Array' : IDL.Vec(ICRC3Value),
365
+ })
366
+ );
367
+ GetBlocksResult.fill(
368
+ IDL.Record({
369
+ 'log_length' : IDL.Nat,
370
+ 'blocks' : IDL.Vec(IDL.Record({ 'id' : IDL.Nat, 'block' : ICRC3Value })),
371
+ 'archived_blocks' : IDL.Vec(
372
+ IDL.Record({
373
+ 'args' : IDL.Vec(GetBlocksArgs),
374
+ 'callback' : IDL.Func(
375
+ [IDL.Vec(GetBlocksArgs)],
376
+ [GetBlocksResult],
377
+ ['query'],
378
+ ),
379
+ })
380
+ ),
381
+ })
382
+ );
383
+ const ICRC3DataCertificate = IDL.Record({
384
+ 'certificate' : IDL.Vec(IDL.Nat8),
385
+ 'hash_tree' : IDL.Vec(IDL.Nat8),
386
+ });
387
+ return IDL.Service({
388
+ 'archives' : IDL.Func([], [IDL.Vec(ArchiveInfo)], ['query']),
389
+ 'get_blocks' : IDL.Func([GetBlocksArgs], [GetBlocksResponse], ['query']),
390
+ 'get_data_certificate' : IDL.Func([], [DataCertificate], ['query']),
391
+ 'get_transactions' : IDL.Func(
392
+ [GetTransactionsRequest],
393
+ [GetTransactionsResponse],
394
+ ['query'],
395
+ ),
396
+ 'icrc103_get_allowances' : IDL.Func(
397
+ [GetAllowancesArgs],
398
+ [icrc103_get_allowances_response],
399
+ ['query'],
400
+ ),
401
+ 'icrc106_get_index_principal' : IDL.Func(
402
+ [],
403
+ [GetIndexPrincipalResult],
404
+ ['query'],
405
+ ),
406
+ 'icrc10_supported_standards' : IDL.Func(
407
+ [],
408
+ [IDL.Vec(IDL.Record({ 'url' : IDL.Text, 'name' : IDL.Text }))],
409
+ ['query'],
410
+ ),
411
+ 'icrc1_balance_of' : IDL.Func([Account], [Tokens], ['query']),
412
+ 'icrc1_decimals' : IDL.Func([], [IDL.Nat8], ['query']),
413
+ 'icrc1_fee' : IDL.Func([], [Tokens], ['query']),
414
+ 'icrc1_metadata' : IDL.Func(
415
+ [],
416
+ [IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))],
417
+ ['query'],
418
+ ),
419
+ 'icrc1_minting_account' : IDL.Func([], [IDL.Opt(Account)], ['query']),
420
+ 'icrc1_name' : IDL.Func([], [IDL.Text], ['query']),
421
+ 'icrc1_supported_standards' : IDL.Func(
422
+ [],
423
+ [IDL.Vec(StandardRecord)],
424
+ ['query'],
425
+ ),
426
+ 'icrc1_symbol' : IDL.Func([], [IDL.Text], ['query']),
427
+ 'icrc1_total_supply' : IDL.Func([], [Tokens], ['query']),
428
+ 'icrc1_transfer' : IDL.Func([TransferArg], [TransferResult], []),
429
+ 'icrc21_canister_call_consent_message' : IDL.Func(
430
+ [icrc21_consent_message_request],
431
+ [icrc21_consent_message_response],
432
+ [],
433
+ ),
434
+ 'icrc2_allowance' : IDL.Func([AllowanceArgs], [Allowance], ['query']),
435
+ 'icrc2_approve' : IDL.Func([ApproveArgs], [ApproveResult], []),
436
+ 'icrc2_transfer_from' : IDL.Func(
437
+ [TransferFromArgs],
438
+ [TransferFromResult],
439
+ [],
440
+ ),
441
+ 'icrc3_get_archives' : IDL.Func(
442
+ [GetArchivesArgs],
443
+ [GetArchivesResult],
444
+ ['query'],
445
+ ),
446
+ 'icrc3_get_blocks' : IDL.Func(
447
+ [IDL.Vec(GetBlocksArgs)],
448
+ [GetBlocksResult],
449
+ ['query'],
450
+ ),
451
+ 'icrc3_get_tip_certificate' : IDL.Func(
452
+ [],
453
+ [IDL.Opt(ICRC3DataCertificate)],
454
+ ['query'],
455
+ ),
456
+ 'icrc3_supported_block_types' : IDL.Func(
457
+ [],
458
+ [IDL.Vec(IDL.Record({ 'url' : IDL.Text, 'block_type' : IDL.Text }))],
459
+ ['query'],
460
+ ),
461
+ 'is_ledger_ready' : IDL.Func([], [IDL.Bool], ['query']),
462
+ });
463
+ };
464
+ export const init = ({ IDL }) => {
465
+ const ChangeArchiveOptions = IDL.Record({
466
+ 'num_blocks_to_archive' : IDL.Opt(IDL.Nat64),
467
+ 'max_transactions_per_response' : IDL.Opt(IDL.Nat64),
468
+ 'trigger_threshold' : IDL.Opt(IDL.Nat64),
469
+ 'more_controller_ids' : IDL.Opt(IDL.Vec(IDL.Principal)),
470
+ 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
471
+ 'cycles_for_archive_creation' : IDL.Opt(IDL.Nat64),
472
+ 'node_max_memory_size_bytes' : IDL.Opt(IDL.Nat64),
473
+ 'controller_id' : IDL.Opt(IDL.Principal),
474
+ });
475
+ const MetadataValue = IDL.Variant({
476
+ 'Int' : IDL.Int,
477
+ 'Nat' : IDL.Nat,
478
+ 'Blob' : IDL.Vec(IDL.Nat8),
479
+ 'Text' : IDL.Text,
480
+ });
481
+ const Subaccount = IDL.Vec(IDL.Nat8);
482
+ const Account = IDL.Record({
483
+ 'owner' : IDL.Principal,
484
+ 'subaccount' : IDL.Opt(Subaccount),
485
+ });
486
+ const ChangeFeeCollector = IDL.Variant({
487
+ 'SetTo' : Account,
488
+ 'Unset' : IDL.Null,
489
+ });
490
+ const FeatureFlags = IDL.Record({ 'icrc2' : IDL.Bool });
491
+ const UpgradeArgs = IDL.Record({
492
+ 'change_archive_options' : IDL.Opt(ChangeArchiveOptions),
493
+ 'token_symbol' : IDL.Opt(IDL.Text),
494
+ 'transfer_fee' : IDL.Opt(IDL.Nat),
495
+ 'metadata' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))),
496
+ 'change_fee_collector' : IDL.Opt(ChangeFeeCollector),
497
+ 'max_memo_length' : IDL.Opt(IDL.Nat16),
498
+ 'index_principal' : IDL.Opt(IDL.Principal),
499
+ 'token_name' : IDL.Opt(IDL.Text),
500
+ 'feature_flags' : IDL.Opt(FeatureFlags),
501
+ });
502
+ const InitArgs = IDL.Record({
503
+ 'decimals' : IDL.Opt(IDL.Nat8),
504
+ 'token_symbol' : IDL.Text,
505
+ 'transfer_fee' : IDL.Nat,
506
+ 'metadata' : IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue)),
507
+ 'minting_account' : Account,
508
+ 'initial_balances' : IDL.Vec(IDL.Tuple(Account, IDL.Nat)),
509
+ 'fee_collector_account' : IDL.Opt(Account),
510
+ 'archive_options' : IDL.Record({
511
+ 'num_blocks_to_archive' : IDL.Nat64,
512
+ 'max_transactions_per_response' : IDL.Opt(IDL.Nat64),
513
+ 'trigger_threshold' : IDL.Nat64,
514
+ 'more_controller_ids' : IDL.Opt(IDL.Vec(IDL.Principal)),
515
+ 'max_message_size_bytes' : IDL.Opt(IDL.Nat64),
516
+ 'cycles_for_archive_creation' : IDL.Opt(IDL.Nat64),
517
+ 'node_max_memory_size_bytes' : IDL.Opt(IDL.Nat64),
518
+ 'controller_id' : IDL.Principal,
519
+ }),
520
+ 'max_memo_length' : IDL.Opt(IDL.Nat16),
521
+ 'index_principal' : IDL.Opt(IDL.Principal),
522
+ 'token_name' : IDL.Text,
523
+ 'feature_flags' : IDL.Opt(FeatureFlags),
524
+ });
525
+ const LedgerArg = IDL.Variant({
526
+ 'Upgrade' : IDL.Opt(UpgradeArgs),
527
+ 'Init' : InitArgs,
528
+ });
529
+ return [LedgerArg];
530
+ };
@@ -0,0 +1,72 @@
1
+ export declare const ICPAY_ERROR_CODES: {
2
+ readonly WALLET_NOT_CONNECTED: "WALLET_NOT_CONNECTED";
3
+ readonly WALLET_CONNECTION_FAILED: "WALLET_CONNECTION_FAILED";
4
+ readonly WALLET_DISCONNECTED: "WALLET_DISCONNECTED";
5
+ readonly WALLET_SIGNATURE_REJECTED: "WALLET_SIGNATURE_REJECTED";
6
+ readonly WALLET_USER_CANCELLED: "WALLET_USER_CANCELLED";
7
+ readonly WALLET_PROVIDER_NOT_AVAILABLE: "WALLET_PROVIDER_NOT_AVAILABLE";
8
+ readonly UNSUPPORTED_PROVIDER: "UNSUPPORTED_PROVIDER";
9
+ readonly NO_PROVIDERS_AVAILABLE: "NO_PROVIDERS_AVAILABLE";
10
+ readonly INSUFFICIENT_BALANCE: "INSUFFICIENT_BALANCE";
11
+ readonly BALANCE_CHECK_FAILED: "BALANCE_CHECK_FAILED";
12
+ readonly TRANSACTION_FAILED: "TRANSACTION_FAILED";
13
+ readonly TRANSACTION_TIMEOUT: "TRANSACTION_TIMEOUT";
14
+ readonly TRANSACTION_CANCELLED: "TRANSACTION_CANCELLED";
15
+ readonly TRANSACTION_INVALID: "TRANSACTION_INVALID";
16
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
17
+ readonly API_ERROR: "API_ERROR";
18
+ readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
19
+ readonly INVALID_CONFIG: "INVALID_CONFIG";
20
+ readonly MISSING_PUBLISHABLE_KEY: "MISSING_PUBLISHABLE_KEY";
21
+ readonly INVALID_PUBLISHABLE_KEY: "INVALID_PUBLISHABLE_KEY";
22
+ readonly SECRET_KEY_REQUIRED: "SECRET_KEY_REQUIRED";
23
+ readonly LEDGER_NOT_FOUND: "LEDGER_NOT_FOUND";
24
+ readonly LEDGER_NOT_VERIFIED: "LEDGER_NOT_VERIFIED";
25
+ readonly TOKEN_NOT_SUPPORTED: "TOKEN_NOT_SUPPORTED";
26
+ readonly INVALID_LEDGER_SYMBOL: "INVALID_LEDGER_SYMBOL";
27
+ readonly LEDGER_SYMBOL_NOT_FOUND: "LEDGER_SYMBOL_NOT_FOUND";
28
+ readonly ACCOUNT_NOT_FOUND: "ACCOUNT_NOT_FOUND";
29
+ readonly ACCOUNT_INACTIVE: "ACCOUNT_INACTIVE";
30
+ readonly ACCOUNT_INFO_FETCH_FAILED: "ACCOUNT_INFO_FETCH_FAILED";
31
+ readonly TRANSACTION_STATUS_FETCH_FAILED: "TRANSACTION_STATUS_FETCH_FAILED";
32
+ readonly TRANSACTION_SYNC_TRIGGER_FAILED: "TRANSACTION_SYNC_TRIGGER_FAILED";
33
+ readonly BALANCES_FETCH_FAILED: "BALANCES_FETCH_FAILED";
34
+ readonly SINGLE_BALANCE_FETCH_FAILED: "SINGLE_BALANCE_FETCH_FAILED";
35
+ readonly INVALID_USD_AMOUNT: "INVALID_USD_AMOUNT";
36
+ readonly PRICE_NOT_AVAILABLE: "PRICE_NOT_AVAILABLE";
37
+ readonly PRICE_CALCULATION_FAILED: "PRICE_CALCULATION_FAILED";
38
+ readonly TRANSACTION_HISTORY_FETCH_FAILED: "TRANSACTION_HISTORY_FETCH_FAILED";
39
+ readonly PAYMENT_HISTORY_FETCH_FAILED: "PAYMENT_HISTORY_FETCH_FAILED";
40
+ readonly PAYMENTS_BY_PRINCIPAL_FETCH_FAILED: "PAYMENTS_BY_PRINCIPAL_FETCH_FAILED";
41
+ readonly SEND_FUNDS_USD_FAILED: "SEND_FUNDS_USD_FAILED";
42
+ readonly LEDGER_INFO_FETCH_FAILED: "LEDGER_INFO_FETCH_FAILED";
43
+ readonly LEDGERS_WITH_PRICES_FETCH_FAILED: "LEDGERS_WITH_PRICES_FETCH_FAILED";
44
+ readonly VERIFIED_LEDGERS_FETCH_FAILED: "VERIFIED_LEDGERS_FETCH_FAILED";
45
+ readonly ACCOUNT_WALLET_BALANCES_FETCH_FAILED: "ACCOUNT_WALLET_BALANCES_FETCH_FAILED";
46
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
47
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
48
+ };
49
+ export type IcpayErrorCode = typeof ICPAY_ERROR_CODES[keyof typeof ICPAY_ERROR_CODES];
50
+ export interface IcpayErrorDetails {
51
+ code: IcpayErrorCode;
52
+ message: string;
53
+ details?: any;
54
+ retryable?: boolean;
55
+ userAction?: string;
56
+ }
57
+ export declare class IcpayError extends Error {
58
+ code: IcpayErrorCode;
59
+ details?: any;
60
+ retryable: boolean;
61
+ userAction?: string;
62
+ constructor(error: IcpayErrorDetails);
63
+ isUserCancelled(): boolean;
64
+ isRetryable(): boolean;
65
+ isWalletError(): boolean;
66
+ isBalanceError(): boolean;
67
+ isNetworkError(): boolean;
68
+ }
69
+ export declare const createWalletError: (code: IcpayErrorCode, message?: string, details?: any) => IcpayError;
70
+ export declare const createBalanceError: (required: string, available: string, details?: any) => IcpayError;
71
+ export declare const createNetworkError: (message?: string, details?: any) => IcpayError;
72
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EpB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAEtF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,UAAW,SAAQ,KAAK;IAC5B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAEf,KAAK,EAAE,iBAAiB;IAUpC,eAAe,IAAI,OAAO;IAO1B,WAAW,IAAI,OAAO;IAKtB,aAAa,IAAI,OAAO;IAexB,cAAc,IAAI,OAAO;IAWzB,cAAc,IAAI,OAAO;CAQ1B;AAGD,eAAO,MAAM,iBAAiB,GAAI,MAAM,cAAc,EAAE,UAAU,MAAM,EAAE,UAAU,GAAG,KAAG,UAmBzF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,EAAE,UAAU,GAAG,KAAG,UAQvF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,UAAU,GAAG,KAAG,UAQpE,CAAC"}