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