@dfinity/ledger-icrc 5.0.0-next-2025-10-22.4 → 5.0.0-next-2025-11-05.1
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.
- package/README.md +32 -32
- package/dist/candid/icrc_index-ng.certified.idl.js +2 -0
- package/dist/candid/icrc_index-ng.d.ts +2 -0
- package/dist/candid/icrc_index-ng.did +5 -3
- package/dist/candid/icrc_index-ng.idl.js +2 -0
- package/dist/candid/icrc_ledger.certified.idl.js +2 -0
- package/dist/candid/icrc_ledger.d.ts +2 -0
- package/dist/candid/icrc_ledger.did +5 -3
- package/dist/candid/icrc_ledger.idl.js +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ Returns:
|
|
|
78
78
|
|
|
79
79
|
string
|
|
80
80
|
|
|
81
|
-
[:link: Source](https://github.com/dfinity/
|
|
81
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/utils/ledger.utils.ts#L27)
|
|
82
82
|
|
|
83
83
|
#### :gear: decodeIcrcAccount
|
|
84
84
|
|
|
@@ -97,7 +97,7 @@ Returns:
|
|
|
97
97
|
|
|
98
98
|
IcrcAccount { owner: Principal, subaccount?: Uint8Array }
|
|
99
99
|
|
|
100
|
-
[:link: Source](https://github.com/dfinity/
|
|
100
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/utils/ledger.utils.ts#L67)
|
|
101
101
|
|
|
102
102
|
#### :gear: mapTokenMetadata
|
|
103
103
|
|
|
@@ -120,7 +120,7 @@ Returns:
|
|
|
120
120
|
|
|
121
121
|
- A structured metadata record or `undefined` if required fields are missing.
|
|
122
122
|
|
|
123
|
-
[:link: Source](https://github.com/dfinity/
|
|
123
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/utils/ledger.utils.ts#L118)
|
|
124
124
|
|
|
125
125
|
#### :gear: decodePayment
|
|
126
126
|
|
|
@@ -155,11 +155,11 @@ Returns:
|
|
|
155
155
|
|
|
156
156
|
: string; identifier: string; amount?: number } | undefined
|
|
157
157
|
|
|
158
|
-
[:link: Source](https://github.com/dfinity/
|
|
158
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/utils/payment.utils.ts#L26)
|
|
159
159
|
|
|
160
160
|
### :factory: IcrcCanister
|
|
161
161
|
|
|
162
|
-
[:link: Source](https://github.com/dfinity/
|
|
162
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/canister.ts#L9)
|
|
163
163
|
|
|
164
164
|
#### Methods
|
|
165
165
|
|
|
@@ -181,11 +181,11 @@ Returns:
|
|
|
181
181
|
|
|
182
182
|
The balance of the given account.
|
|
183
183
|
|
|
184
|
-
[:link: Source](https://github.com/dfinity/
|
|
184
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/canister.ts#L18)
|
|
185
185
|
|
|
186
186
|
### :factory: IcrcLedgerCanister
|
|
187
187
|
|
|
188
|
-
[:link: Source](https://github.com/dfinity/
|
|
188
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L44)
|
|
189
189
|
|
|
190
190
|
#### Static Methods
|
|
191
191
|
|
|
@@ -197,7 +197,7 @@ The balance of the given account.
|
|
|
197
197
|
| -------- | ---------------------------------------------------------------------- |
|
|
198
198
|
| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcLedgerCanister` |
|
|
199
199
|
|
|
200
|
-
[:link: Source](https://github.com/dfinity/
|
|
200
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L45)
|
|
201
201
|
|
|
202
202
|
#### Methods
|
|
203
203
|
|
|
@@ -224,7 +224,7 @@ The token metadata (name, symbol, etc.).
|
|
|
224
224
|
| ---------- | ------------------------------------------------------------- |
|
|
225
225
|
| `metadata` | `(params: QueryParams) => Promise<IcrcTokenMetadataResponse>` |
|
|
226
226
|
|
|
227
|
-
[:link: Source](https://github.com/dfinity/
|
|
227
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L59)
|
|
228
228
|
|
|
229
229
|
##### :gear: transactionFee
|
|
230
230
|
|
|
@@ -238,7 +238,7 @@ Returns:
|
|
|
238
238
|
|
|
239
239
|
The ledger transaction fees in Tokens
|
|
240
240
|
|
|
241
|
-
[:link: Source](https://github.com/dfinity/
|
|
241
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L67)
|
|
242
242
|
|
|
243
243
|
##### :gear: balance
|
|
244
244
|
|
|
@@ -256,7 +256,7 @@ Returns:
|
|
|
256
256
|
|
|
257
257
|
The balance of the given account.
|
|
258
258
|
|
|
259
|
-
[:link: Source](https://github.com/dfinity/
|
|
259
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L76)
|
|
260
260
|
|
|
261
261
|
##### :gear: transfer
|
|
262
262
|
|
|
@@ -270,7 +270,7 @@ Parameters:
|
|
|
270
270
|
|
|
271
271
|
- `params`: The parameters to transfer tokens.
|
|
272
272
|
|
|
273
|
-
[:link: Source](https://github.com/dfinity/
|
|
273
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L89)
|
|
274
274
|
|
|
275
275
|
##### :gear: totalTokensSupply
|
|
276
276
|
|
|
@@ -280,7 +280,7 @@ Returns the total supply of tokens.
|
|
|
280
280
|
| ------------------- | ------------------------------------------ |
|
|
281
281
|
| `totalTokensSupply` | `(params: QueryParams) => Promise<bigint>` |
|
|
282
282
|
|
|
283
|
-
[:link: Source](https://github.com/dfinity/
|
|
283
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L105)
|
|
284
284
|
|
|
285
285
|
##### :gear: transferFrom
|
|
286
286
|
|
|
@@ -296,7 +296,7 @@ Parameters:
|
|
|
296
296
|
|
|
297
297
|
- `params`: The parameters to transfer tokens from to.
|
|
298
298
|
|
|
299
|
-
[:link: Source](https://github.com/dfinity/
|
|
299
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L117)
|
|
300
300
|
|
|
301
301
|
##### :gear: approve
|
|
302
302
|
|
|
@@ -312,7 +312,7 @@ Parameters:
|
|
|
312
312
|
|
|
313
313
|
- `params`: The parameters to approve.
|
|
314
314
|
|
|
315
|
-
[:link: Source](https://github.com/dfinity/
|
|
315
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L139)
|
|
316
316
|
|
|
317
317
|
##### :gear: allowance
|
|
318
318
|
|
|
@@ -332,7 +332,7 @@ Returns:
|
|
|
332
332
|
|
|
333
333
|
The token allowance. If there is no active approval, the ledger MUST return `{ allowance = 0; expires_at = null }`.
|
|
334
334
|
|
|
335
|
-
[:link: Source](https://github.com/dfinity/
|
|
335
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L161)
|
|
336
336
|
|
|
337
337
|
##### :gear: consentMessage
|
|
338
338
|
|
|
@@ -350,7 +350,7 @@ Returns:
|
|
|
350
350
|
|
|
351
351
|
- A promise that resolves to the consent message response, which includes the consent message in the specified language and other related information.
|
|
352
352
|
|
|
353
|
-
[:link: Source](https://github.com/dfinity/
|
|
353
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L179)
|
|
354
354
|
|
|
355
355
|
##### :gear: getBlocks
|
|
356
356
|
|
|
@@ -368,7 +368,7 @@ Returns:
|
|
|
368
368
|
|
|
369
369
|
The list of blocks.
|
|
370
370
|
|
|
371
|
-
[:link: Source](https://github.com/dfinity/
|
|
371
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L203)
|
|
372
372
|
|
|
373
373
|
##### :gear: getIndexPrincipal
|
|
374
374
|
|
|
@@ -382,7 +382,7 @@ Returns:
|
|
|
382
382
|
|
|
383
383
|
The principal of the index canister.
|
|
384
384
|
|
|
385
|
-
[:link: Source](https://github.com/dfinity/
|
|
385
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L216)
|
|
386
386
|
|
|
387
387
|
##### :gear: icrc1SupportedStandards
|
|
388
388
|
|
|
@@ -396,7 +396,7 @@ Returns:
|
|
|
396
396
|
|
|
397
397
|
The list of standards.
|
|
398
398
|
|
|
399
|
-
[:link: Source](https://github.com/dfinity/
|
|
399
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L235)
|
|
400
400
|
|
|
401
401
|
##### :gear: icrc10SupportedStandards
|
|
402
402
|
|
|
@@ -410,7 +410,7 @@ Returns:
|
|
|
410
410
|
|
|
411
411
|
The list of standards.
|
|
412
412
|
|
|
413
|
-
[:link: Source](https://github.com/dfinity/
|
|
413
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L245)
|
|
414
414
|
|
|
415
415
|
##### :gear: getMintingAccount
|
|
416
416
|
|
|
@@ -424,11 +424,11 @@ Returns:
|
|
|
424
424
|
|
|
425
425
|
The minting account as a Nullable object.
|
|
426
426
|
|
|
427
|
-
[:link: Source](https://github.com/dfinity/
|
|
427
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/ledger.canister.ts#L257)
|
|
428
428
|
|
|
429
429
|
### :factory: IcrcIndexCanister
|
|
430
430
|
|
|
431
|
-
[:link: Source](https://github.com/dfinity/
|
|
431
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index.canister.ts#L14)
|
|
432
432
|
|
|
433
433
|
#### Static Methods
|
|
434
434
|
|
|
@@ -440,7 +440,7 @@ The minting account as a Nullable object.
|
|
|
440
440
|
| -------- | --------------------------------------------------------------------- |
|
|
441
441
|
| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexCanister` |
|
|
442
442
|
|
|
443
|
-
[:link: Source](https://github.com/dfinity/
|
|
443
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index.canister.ts#L15)
|
|
444
444
|
|
|
445
445
|
#### Methods
|
|
446
446
|
|
|
@@ -460,7 +460,7 @@ Index Canister only holds the transactions ids in state, not the whole transacti
|
|
|
460
460
|
| ----------------- | -------------------------------------------------------------------- |
|
|
461
461
|
| `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |
|
|
462
462
|
|
|
463
|
-
[:link: Source](https://github.com/dfinity/
|
|
463
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index.canister.ts#L34)
|
|
464
464
|
|
|
465
465
|
##### :gear: ledgerId
|
|
466
466
|
|
|
@@ -470,11 +470,11 @@ Returns the ledger canister ID related to the index canister.
|
|
|
470
470
|
| ---------- | --------------------------------------------- |
|
|
471
471
|
| `ledgerId` | `(params: QueryParams) => Promise<Principal>` |
|
|
472
472
|
|
|
473
|
-
[:link: Source](https://github.com/dfinity/
|
|
473
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index.canister.ts#L51)
|
|
474
474
|
|
|
475
475
|
### :factory: IcrcIndexNgCanister
|
|
476
476
|
|
|
477
|
-
[:link: Source](https://github.com/dfinity/
|
|
477
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index-ng.canister.ts#L23)
|
|
478
478
|
|
|
479
479
|
#### Static Methods
|
|
480
480
|
|
|
@@ -486,7 +486,7 @@ Returns the ledger canister ID related to the index canister.
|
|
|
486
486
|
| -------- | ----------------------------------------------------------------------- |
|
|
487
487
|
| `create` | `(options: IcrcLedgerCanisterOptions<_SERVICE>) => IcrcIndexNgCanister` |
|
|
488
488
|
|
|
489
|
-
[:link: Source](https://github.com/dfinity/
|
|
489
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index-ng.canister.ts#L24)
|
|
490
490
|
|
|
491
491
|
#### Methods
|
|
492
492
|
|
|
@@ -511,7 +511,7 @@ Returns:
|
|
|
511
511
|
|
|
512
512
|
The list of transactions and further related information of the given account.
|
|
513
513
|
|
|
514
|
-
[:link: Source](https://github.com/dfinity/
|
|
514
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index-ng.canister.ts#L49)
|
|
515
515
|
|
|
516
516
|
##### :gear: ledgerId
|
|
517
517
|
|
|
@@ -521,7 +521,7 @@ Returns the ledger canister ID related to the index canister.
|
|
|
521
521
|
| ---------- | --------------------------------------------- |
|
|
522
522
|
| `ledgerId` | `(params: QueryParams) => Promise<Principal>` |
|
|
523
523
|
|
|
524
|
-
[:link: Source](https://github.com/dfinity/
|
|
524
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index-ng.canister.ts#L67)
|
|
525
525
|
|
|
526
526
|
##### :gear: status
|
|
527
527
|
|
|
@@ -539,7 +539,7 @@ Returns:
|
|
|
539
539
|
|
|
540
540
|
The status of the index canister.
|
|
541
541
|
|
|
542
|
-
[:link: Source](https://github.com/dfinity/
|
|
542
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index-ng.canister.ts#L78)
|
|
543
543
|
|
|
544
544
|
##### :gear: listSubaccounts
|
|
545
545
|
|
|
@@ -557,7 +557,7 @@ Returns:
|
|
|
557
557
|
|
|
558
558
|
The list of subaccounts.
|
|
559
559
|
|
|
560
|
-
[:link: Source](https://github.com/dfinity/
|
|
560
|
+
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ledger-icrc/src/index-ng.canister.ts#L87)
|
|
561
561
|
|
|
562
562
|
<!-- TSDOC_END -->
|
|
563
563
|
|
|
@@ -30,6 +30,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
30
30
|
});
|
|
31
31
|
const Tokens = IDL.Nat;
|
|
32
32
|
const Burn = IDL.Record({
|
|
33
|
+
fee: IDL.Opt(IDL.Nat),
|
|
33
34
|
from: Account,
|
|
34
35
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
35
36
|
created_at_time: IDL.Opt(IDL.Nat64),
|
|
@@ -38,6 +39,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
38
39
|
});
|
|
39
40
|
const Mint = IDL.Record({
|
|
40
41
|
to: Account,
|
|
42
|
+
fee: IDL.Opt(IDL.Nat),
|
|
41
43
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
42
44
|
created_at_time: IDL.Opt(IDL.Nat64),
|
|
43
45
|
amount: Tokens,
|
|
@@ -27,6 +27,7 @@ export interface Approve {
|
|
|
27
27
|
export type Block = Value;
|
|
28
28
|
export type BlockIndex = bigint;
|
|
29
29
|
export interface Burn {
|
|
30
|
+
fee: [] | [bigint];
|
|
30
31
|
from: Account;
|
|
31
32
|
memo: [] | [Uint8Array | number[]];
|
|
32
33
|
created_at_time: [] | [bigint];
|
|
@@ -89,6 +90,7 @@ export interface ListSubaccountsArgs {
|
|
|
89
90
|
export type Map = Array<[string, Value]>;
|
|
90
91
|
export interface Mint {
|
|
91
92
|
to: Account;
|
|
93
|
+
fee: [] | [bigint];
|
|
92
94
|
memo: [] | [Uint8Array | number[]];
|
|
93
95
|
created_at_time: [] | [bigint];
|
|
94
96
|
amount: Tokens;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 199fb79 (2025-10-29 tags: release-2025-10-30_03-22-base) 'rs/ledger_suite/icrc1/index-ng/index-ng.did' by import-candid
|
|
2
2
|
|
|
3
3
|
type Tokens = nat;
|
|
4
4
|
|
|
@@ -78,14 +78,16 @@ type Burn = record {
|
|
|
78
78
|
memo : opt vec nat8;
|
|
79
79
|
created_at_time : opt nat64;
|
|
80
80
|
amount : Tokens;
|
|
81
|
-
spender : opt Account
|
|
81
|
+
spender : opt Account;
|
|
82
|
+
fee : opt nat
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
type Mint = record {
|
|
85
86
|
to : Account;
|
|
86
87
|
memo : opt vec nat8;
|
|
87
88
|
created_at_time : opt nat64;
|
|
88
|
-
amount : Tokens
|
|
89
|
+
amount : Tokens;
|
|
90
|
+
fee : opt nat
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
type Transfer = record {
|
|
@@ -30,6 +30,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
30
30
|
});
|
|
31
31
|
const Tokens = IDL.Nat;
|
|
32
32
|
const Burn = IDL.Record({
|
|
33
|
+
fee: IDL.Opt(IDL.Nat),
|
|
33
34
|
from: Account,
|
|
34
35
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
35
36
|
created_at_time: IDL.Opt(IDL.Nat64),
|
|
@@ -38,6 +39,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
38
39
|
});
|
|
39
40
|
const Mint = IDL.Record({
|
|
40
41
|
to: Account,
|
|
42
|
+
fee: IDL.Opt(IDL.Nat),
|
|
41
43
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
42
44
|
created_at_time: IDL.Opt(IDL.Nat64),
|
|
43
45
|
amount: Tokens,
|
|
@@ -123,6 +123,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
123
123
|
});
|
|
124
124
|
const Timestamp = IDL.Nat64;
|
|
125
125
|
const Burn = IDL.Record({
|
|
126
|
+
fee: IDL.Opt(IDL.Nat),
|
|
126
127
|
from: Account,
|
|
127
128
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
128
129
|
created_at_time: IDL.Opt(Timestamp),
|
|
@@ -131,6 +132,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
131
132
|
});
|
|
132
133
|
const Mint = IDL.Record({
|
|
133
134
|
to: Account,
|
|
135
|
+
fee: IDL.Opt(IDL.Nat),
|
|
134
136
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
135
137
|
created_at_time: IDL.Opt(Timestamp),
|
|
136
138
|
amount: IDL.Nat,
|
|
@@ -92,6 +92,7 @@ export interface BlockRange {
|
|
|
92
92
|
blocks: Array<Block>;
|
|
93
93
|
}
|
|
94
94
|
export interface Burn {
|
|
95
|
+
fee: [] | [bigint];
|
|
95
96
|
from: Account;
|
|
96
97
|
memo: [] | [Uint8Array | number[]];
|
|
97
98
|
created_at_time: [] | [Timestamp];
|
|
@@ -371,6 +372,7 @@ export type MetadataValue =
|
|
|
371
372
|
| { Text: string };
|
|
372
373
|
export interface Mint {
|
|
373
374
|
to: Account;
|
|
375
|
+
fee: [] | [bigint];
|
|
374
376
|
memo: [] | [Uint8Array | number[]];
|
|
375
377
|
created_at_time: [] | [Timestamp];
|
|
376
378
|
amount: bigint;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 199fb79 (2025-10-29 tags: release-2025-10-30_03-22-base) 'rs/ledger_suite/icrc1/ledger/ledger.did' by import-candid
|
|
2
2
|
|
|
3
3
|
type BlockIndex = nat;
|
|
4
4
|
type Subaccount = blob;
|
|
@@ -235,14 +235,16 @@ type Burn = record {
|
|
|
235
235
|
memo : opt blob;
|
|
236
236
|
created_at_time : opt Timestamp;
|
|
237
237
|
amount : nat;
|
|
238
|
-
spender : opt Account
|
|
238
|
+
spender : opt Account;
|
|
239
|
+
fee : opt nat
|
|
239
240
|
};
|
|
240
241
|
|
|
241
242
|
type Mint = record {
|
|
242
243
|
to : Account;
|
|
243
244
|
memo : opt blob;
|
|
244
245
|
created_at_time : opt Timestamp;
|
|
245
|
-
amount : nat
|
|
246
|
+
amount : nat;
|
|
247
|
+
fee : opt nat
|
|
246
248
|
};
|
|
247
249
|
|
|
248
250
|
type Transfer = record {
|
|
@@ -127,6 +127,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
127
127
|
});
|
|
128
128
|
const Timestamp = IDL.Nat64;
|
|
129
129
|
const Burn = IDL.Record({
|
|
130
|
+
fee: IDL.Opt(IDL.Nat),
|
|
130
131
|
from: Account,
|
|
131
132
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
132
133
|
created_at_time: IDL.Opt(Timestamp),
|
|
@@ -135,6 +136,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
135
136
|
});
|
|
136
137
|
const Mint = IDL.Record({
|
|
137
138
|
to: Account,
|
|
139
|
+
fee: IDL.Opt(IDL.Nat),
|
|
138
140
|
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
139
141
|
created_at_time: IDL.Opt(Timestamp),
|
|
140
142
|
amount: IDL.Nat,
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fromNullable as Ze,nonNullish as Xe,toNullable as Ye}from"@dfinity/utils";var _t=({owner:e,subaccount:t})=>{let c=Ze(t);return{owner:e,...Xe(c)?{subaccount:c}:{}}},ke=({owner:e,subaccount:t})=>({owner:e,subaccount:Ye(t)});import{isNullish as je,toNullable as m}from"@dfinity/utils";var he=({from_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),from_subaccount:m(e),created_at_time:m(c)}),Fe=({spender_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),spender_subaccount:m(e),created_at_time:m(c)}),Pe=({fee:e,created_at_time:t,memo:c,from_subaccount:r,expected_allowance:i,expires_at:n,...d})=>({...d,fee:m(e),memo:m(c),from_subaccount:m(r),created_at_time:m(t),expected_allowance:m(i),expires_at:m(n)}),ve=({userPreferences:{metadata:{utcOffsetMinutes:e,language:t},deriveSpec:c},...r})=>({...r,user_preferences:{metadata:{language:t,utc_offset_minutes:m(e)},device_spec:je(c)?m():m("GenericDisplay"in c?{GenericDisplay:null}:{FieldsDisplay:null})}});var P=class extends Error{};var v=class extends Error{errorType;constructor({msg:t,errorType:c}){super(t),this.errorType=c}},w=class extends Error{constructor(c,r){super();this.message=c;this.error_code=r}},G=class extends Error{},xe=class extends G{},Te=class extends G{},Re=class extends G{},Ge=e=>"GenericError"in e?new w(e.GenericError.description,e.GenericError.error_code):"InsufficientPayment"in e?new xe(e.InsufficientPayment.description):"UnsupportedCanisterCall"in e?new Te(e.UnsupportedCanisterCall.description):"ConsentMessageUnavailable"in e?new Re(e.ConsentMessageUnavailable.description):new G(`Unknown error type ${JSON.stringify(e)}`),ye=class extends Error{},Se=e=>"IndexPrincipalNotSet"in e?new ye("Index principal is not set for this ledger canister."):new w(e.GenericError.description,e.GenericError.error_code);import{createServices as Ie}from"@dfinity/utils";var Ee=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],[]),get_blocks:e.Func([b],[O],[]),get_fee_collectors_ranges:e.Func([],[R],[]),icrc1_balance_of:e.Func([a],[p],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([o],[e.Vec(d)],[]),status:e.Func([],[h],["query"])})};var we=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],["query"]),get_blocks:e.Func([b],[O],["query"]),get_fee_collectors_ranges:e.Func([],[R],["query"]),icrc1_balance_of:e.Func([a],[p],["query"]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([o],[e.Vec(d)],["query"]),status:e.Func([],[h],["query"])})};import{Canister as Je,toNullable as Ke}from"@dfinity/utils";var B=class extends Je{balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:Ke(t.subaccount)})};import{toNullable as Be}from"@dfinity/utils";var C=({account:e,max_results:t,start:c})=>({account:ke(e),max_results:t,start:Be(c)}),Ce=({owner:e,start:t})=>({owner:e,start:Be(t)});var Ve=class e extends B{static create(t){let{service:c,certifiedService:r,canisterId:i}=Ie({options:t,idlFactory:we,certifiedIdlFactory:Ee});return new e(i,c,r)}getTransactions=async({certified:t,...c})=>{let r=await this.caller({certified:t}).get_account_transactions(C(c));if("Err"in r)throw new P(r.Err.message);return r.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()};status=t=>this.caller(t).status();listSubaccounts=({certified:t,...c})=>this.caller({certified:t}).list_subaccounts(Ce(c))};import{Canister as Le,createServices as De}from"@dfinity/utils";var Me=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([_],[e.Vec(u)],[])})};var qe=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([_],[e.Vec(u)],["query"])})};var be=class e extends Le{static create(t){let{service:c,certifiedService:r,canisterId:i}=De({options:t,idlFactory:qe,certifiedIdlFactory:Me});return new e(i,c,r)}getTransactions=async t=>{let c=await this.caller({certified:!0}).get_account_transactions(C(t));if("Err"in c)throw new P(c.Err.message);return c.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()}};import{Canister as et,createServices as tt,toNullable as rt}from"@dfinity/utils";var Ue=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],[]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],[]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],[]),get_blocks:e.Func([_],[A],[]),get_data_certificate:e.Func([],[k],[]),get_transactions:e.Func([R],[H],[]),icrc103_get_allowances:e.Func([W],[Y],[]),icrc106_get_index_principal:e.Func([],[J],[]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],[]),icrc1_balance_of:e.Func([a],[l],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[l],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],[]),icrc1_minting_account:e.Func([],[e.Opt(a)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(K)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[l],[]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],[]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],[]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],[]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],[]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],[]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var ze=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],["query"]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],["query"]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],["query"]),get_blocks:e.Func([_],[A],["query"]),get_data_certificate:e.Func([],[k],["query"]),get_transactions:e.Func([R],[H],["query"]),icrc103_get_allowances:e.Func([W],[Y],["query"]),icrc106_get_index_principal:e.Func([],[J],["query"]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],["query"]),icrc1_balance_of:e.Func([a],[l],["query"]),icrc1_decimals:e.Func([],[e.Nat8],["query"]),icrc1_fee:e.Func([],[l],["query"]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(a)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(K)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[l],["query"]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],["query"]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],["query"]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],["query"]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],["query"]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],["query"]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var Ae=class e extends et{static create(t){let{service:c,certifiedService:r,canisterId:i}=tt({options:t,idlFactory:ze,certifiedIdlFactory:Ue});return new e(i,c,r)}metadata=t=>this.caller(t).icrc1_metadata();transactionFee=t=>this.caller(t).icrc1_fee();balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:rt(t.subaccount)});transfer=async t=>{let c=await this.caller({certified:!0}).icrc1_transfer(he(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer"});return c.Ok};totalTokensSupply=t=>this.caller(t).icrc1_total_supply();transferFrom=async t=>{let c=await this.caller({certified:!0}).icrc2_transfer_from(Fe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer from"});return c.Ok};approve=async t=>{let c=await this.caller({certified:!0}).icrc2_approve(Pe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to entitle the spender to transfer the amount"});return c.Ok};allowance=t=>{let{certified:c,...r}=t;return this.caller({certified:c}).icrc2_allowance({...r})};consentMessage=async t=>{let{icrc21_canister_call_consent_message:c}=this.caller({certified:!0}),r=await c(ve(t));if("Err"in r)throw Ge(r.Err);return r.Ok};getBlocks=t=>this.caller({certified:t.certified}).icrc3_get_blocks(t.args);getIndexPrincipal=async t=>{let{icrc106_get_index_principal:c}=this.caller(t),r=await c();if("Err"in r)throw Se(r.Err);return r.Ok};icrc1SupportedStandards=t=>this.caller(t).icrc1_supported_standards();icrc10SupportedStandards=t=>this.caller(t).icrc10_supported_standards();getMintingAccount=t=>this.caller(t).icrc1_minting_account()};var Qe=(n=>(n.SYMBOL="icrc1:symbol",n.NAME="icrc1:name",n.DECIMALS="icrc1:decimals",n.FEE="icrc1:fee",n.LOGO="icrc1:logo",n))(Qe||{});import{bigEndianCrc32 as ct,encodeBase32 as at,hexStringToUint8Array as nt,isNullish as He,nonNullish as M,notEmptyString as ot,uint8ArrayToHexString as st}from"@dfinity/utils";import{Principal as $e}from"@icp-sdk/core/principal";var it=64,Lt=({owner:e,subaccount:t})=>{if(He(t))return e.toText();let r=(i=>i.replace(/^0+/,""))(st(Uint8Array.from(t)));return r.length===0?e.toText():`${e.toText()}-${We({owner:e,subaccount:t})}.${r}`},We=({owner:e,subaccount:t})=>{let c=ct(Uint8Array.from([...e.toUint8Array(),...t]));return at(c)},Dt=e=>{let[t,c,...r]=e.split(".");if(!ot(t))throw new Error("Invalid account. No string provided.");if(r.length>0)throw new Error("Invalid account string format. Expected at most one '.' separator.");if(He(c))return{owner:$e.fromText(e)};let[i,...n]=t.split("-").reverse(),d=n.reverse().join("-"),a={owner:$e.fromText(d),subaccount:nt(c.padStart(it,"0"))};if(We(a)!==i)throw new Error("Invalid account. Invalid checksum.");return a},er=e=>{let t=e.reduce((r,[i,n])=>{switch(i){case"icrc1:symbol":r={...r,..."Text"in n&&{symbol:n.Text}};break;case"icrc1:name":r={...r,..."Text"in n&&{name:n.Text}};break;case"icrc1:fee":r={...r,..."Nat"in n&&{fee:n.Nat}};break;case"icrc1:decimals":r={...r,..."Nat"in n&&{decimals:Number(n.Nat)}};break;case"icrc1:logo":r={...r,..."Text"in n&&{icon:n.Text}}}return r},{});if((r=>M(r.symbol)&&M(r.name)&&M(r.fee)&&M(r.decimals))(t))return t};import{isNullish as pt,nonNullish as lt}from"@dfinity/utils";var cr=e=>{let t=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,c=e.match(t);if(pt(c))return;let[r,i,n,d]=c;return{token:i,identifier:n,...lt(d)&&!isNaN(parseFloat(d))&&{amount:parseFloat(d)}}};export{G as ConsentMessageError,Re as ConsentMessageUnavailableError,w as GenericError,be as IcrcIndexCanister,Ve as IcrcIndexNgCanister,Ae as IcrcLedgerCanister,Qe as IcrcMetadataResponseEntries,v as IcrcTransferError,P as IndexError,ye as IndexPrincipalNotSetError,xe as InsufficientPaymentError,Te as UnsupportedCanisterCallError,Dt as decodeIcrcAccount,cr as decodePayment,Lt as encodeIcrcAccount,_t as fromCandidAccount,Se as mapIcrc106GetIndexPrincipalError,Ge as mapIcrc21ConsentMessageError,er as mapTokenMetadata,Pe as toApproveArgs,ke as toCandidAccount,ve as toIcrc21ConsentMessageArgs,he as toTransferArg,Fe as toTransferFromArgs};
|
|
1
|
+
import{fromNullable as Ze,nonNullish as Xe,toNullable as Ye}from"@dfinity/utils";var _t=({owner:e,subaccount:t})=>{let c=Ze(t);return{owner:e,...Xe(c)?{subaccount:c}:{}}},ke=({owner:e,subaccount:t})=>({owner:e,subaccount:Ye(t)});import{isNullish as je,toNullable as m}from"@dfinity/utils";var he=({from_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),from_subaccount:m(e),created_at_time:m(c)}),Fe=({spender_subaccount:e,fee:t,created_at_time:c,memo:r,...i})=>({...i,fee:m(t),memo:m(r),spender_subaccount:m(e),created_at_time:m(c)}),Pe=({fee:e,created_at_time:t,memo:c,from_subaccount:r,expected_allowance:i,expires_at:n,...d})=>({...d,fee:m(e),memo:m(c),from_subaccount:m(r),created_at_time:m(t),expected_allowance:m(i),expires_at:m(n)}),ve=({userPreferences:{metadata:{utcOffsetMinutes:e,language:t},deriveSpec:c},...r})=>({...r,user_preferences:{metadata:{language:t,utc_offset_minutes:m(e)},device_spec:je(c)?m():m("GenericDisplay"in c?{GenericDisplay:null}:{FieldsDisplay:null})}});var P=class extends Error{};var v=class extends Error{errorType;constructor({msg:t,errorType:c}){super(t),this.errorType=c}},w=class extends Error{constructor(c,r){super();this.message=c;this.error_code=r}},G=class extends Error{},xe=class extends G{},Te=class extends G{},Re=class extends G{},Ge=e=>"GenericError"in e?new w(e.GenericError.description,e.GenericError.error_code):"InsufficientPayment"in e?new xe(e.InsufficientPayment.description):"UnsupportedCanisterCall"in e?new Te(e.UnsupportedCanisterCall.description):"ConsentMessageUnavailable"in e?new Re(e.ConsentMessageUnavailable.description):new G(`Unknown error type ${JSON.stringify(e)}`),ye=class extends Error{},Se=e=>"IndexPrincipalNotSet"in e?new ye("Index principal is not set for this ledger canister."):new w(e.GenericError.description,e.GenericError.error_code);import{createServices as Ie}from"@dfinity/utils";var Ee=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],[]),get_blocks:e.Func([b],[O],[]),get_fee_collectors_ranges:e.Func([],[R],[]),icrc1_balance_of:e.Func([a],[p],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([o],[e.Vec(d)],[]),status:e.Func([],[h],["query"])})};var we=({IDL:e})=>{let t=e.Rec(),c=e.Record({ledger_id:e.Opt(e.Principal),retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),r=e.Record({ledger_id:e.Principal,retrieve_blocks_from_ledger_interval_seconds:e.Opt(e.Nat64)}),i=e.Variant({Upgrade:c,Init:r}),n=e.Nat,d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Record({max_results:e.Nat,start:e.Opt(n),account:a}),p=e.Nat,f=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),N=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p}),x=e.Record({fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,expected_allowance:e.Opt(p),expires_at:e.Opt(e.Nat64),spender:a}),s=e.Record({to:a,fee:e.Opt(p),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:p,spender:e.Opt(a)}),u=e.Record({burn:e.Opt(f),kind:e.Text,mint:e.Opt(N),approve:e.Opt(x),timestamp:e.Nat64,transfer:e.Opt(s)}),_=e.Record({id:n,transaction:u}),y=e.Record({balance:p,transactions:e.Vec(_),oldest_tx_id:e.Opt(n)}),T=e.Record({message:e.Text}),V=e.Variant({Ok:y,Err:T}),b=e.Record({start:e.Nat,length:e.Nat}),A=e.Vec(e.Tuple(e.Text,t));t.fill(e.Variant({Int:e.Int,Map:A,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(t)}));let k=t,O=e.Record({blocks:e.Vec(k),chain_length:e.Nat64}),R=e.Record({ranges:e.Vec(e.Tuple(a,e.Vec(e.Tuple(n,n))))}),o=e.Record({owner:e.Principal,start:e.Opt(d)}),h=e.Record({num_blocks_synced:n});return e.Service({get_account_transactions:e.Func([g],[V],["query"]),get_blocks:e.Func([b],[O],["query"]),get_fee_collectors_ranges:e.Func([],[R],["query"]),icrc1_balance_of:e.Func([a],[p],["query"]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([o],[e.Vec(d)],["query"]),status:e.Func([],[h],["query"])})};import{Canister as Je,toNullable as Ke}from"@dfinity/utils";var B=class extends Je{balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:Ke(t.subaccount)})};import{toNullable as Be}from"@dfinity/utils";var C=({account:e,max_results:t,start:c})=>({account:ke(e),max_results:t,start:Be(c)}),Ce=({owner:e,start:t})=>({owner:e,start:Be(t)});var Ve=class e extends B{static create(t){let{service:c,certifiedService:r,canisterId:i}=Ie({options:t,idlFactory:we,certifiedIdlFactory:Ee});return new e(i,c,r)}getTransactions=async({certified:t,...c})=>{let r=await this.caller({certified:t}).get_account_transactions(C(c));if("Err"in r)throw new P(r.Err.message);return r.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()};status=t=>this.caller(t).status();listSubaccounts=({certified:t,...c})=>this.caller({certified:t}).list_subaccounts(Ce(c))};import{Canister as Le,createServices as De}from"@dfinity/utils";var Me=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],[]),list_subaccounts:e.Func([_],[e.Vec(u)],[])})};var qe=({IDL:e})=>{let t=e.Record({ledger_id:e.Principal}),c=e.Nat,r=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),i=e.Record({max_results:e.Nat,start:e.Opt(c),account:r}),n=e.Record({from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),d=e.Record({to:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),a=e.Record({fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(e.Nat64),spender:r}),g=e.Record({to:r,fee:e.Opt(e.Nat),from:r,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat,spender:e.Opt(r)}),p=e.Record({burn:e.Opt(n),kind:e.Text,mint:e.Opt(d),approve:e.Opt(a),timestamp:e.Nat64,transfer:e.Opt(g)}),f=e.Record({id:c,transaction:p}),N=e.Record({transactions:e.Vec(f),oldest_tx_id:e.Opt(c)}),x=e.Record({message:e.Text}),s=e.Variant({Ok:N,Err:x}),u=e.Vec(e.Nat8),_=e.Record({owner:e.Principal,start:e.Opt(u)});return e.Service({get_account_transactions:e.Func([i],[s],[]),ledger_id:e.Func([],[e.Principal],["query"]),list_subaccounts:e.Func([_],[e.Vec(u)],["query"])})};var be=class e extends Le{static create(t){let{service:c,certifiedService:r,canisterId:i}=De({options:t,idlFactory:qe,certifiedIdlFactory:Me});return new e(i,c,r)}getTransactions=async t=>{let c=await this.caller({certified:!0}).get_account_transactions(C(t));if("Err"in c)throw new P(c.Err.message);return c.Ok};ledgerId=t=>{let{ledger_id:c}=this.caller(t);return c()}};import{Canister as et,createServices as tt,toNullable as rt}from"@dfinity/utils";var Ue=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],[]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],[]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],[]),get_blocks:e.Func([_],[A],[]),get_data_certificate:e.Func([],[k],[]),get_transactions:e.Func([R],[H],[]),icrc103_get_allowances:e.Func([W],[Y],[]),icrc106_get_index_principal:e.Func([],[J],[]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],[]),icrc1_balance_of:e.Func([a],[l],[]),icrc1_decimals:e.Func([],[e.Nat8],[]),icrc1_fee:e.Func([],[l],[]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],[]),icrc1_minting_account:e.Func([],[e.Opt(a)],[]),icrc1_name:e.Func([],[e.Text],[]),icrc1_supported_standards:e.Func([],[e.Vec(K)],[]),icrc1_symbol:e.Func([],[e.Text],[]),icrc1_total_supply:e.Func([],[l],[]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],[]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],[]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],[]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],[]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],[]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var ze=({IDL:e})=>{let t=e.Rec(),c=e.Rec(),r=e.Rec(),i=e.Record({num_blocks_to_archive:e.Opt(e.Nat64),max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Opt(e.Nat64),more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Opt(e.Principal)}),n=e.Variant({Int:e.Int,Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text}),d=e.Vec(e.Nat8),a=e.Record({owner:e.Principal,subaccount:e.Opt(d)}),g=e.Variant({SetTo:a,Unset:e.Null}),p=e.Record({icrc2:e.Bool}),f=e.Record({change_archive_options:e.Opt(i),token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat),metadata:e.Opt(e.Vec(e.Tuple(e.Text,n))),change_fee_collector:e.Opt(g),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Opt(e.Text),feature_flags:e.Opt(p)}),N=e.Record({decimals:e.Opt(e.Nat8),token_symbol:e.Text,transfer_fee:e.Nat,metadata:e.Vec(e.Tuple(e.Text,n)),minting_account:a,initial_balances:e.Vec(e.Tuple(a,e.Nat)),fee_collector_account:e.Opt(a),archive_options:e.Record({num_blocks_to_archive:e.Nat64,max_transactions_per_response:e.Opt(e.Nat64),trigger_threshold:e.Nat64,more_controller_ids:e.Opt(e.Vec(e.Principal)),max_message_size_bytes:e.Opt(e.Nat64),cycles_for_archive_creation:e.Opt(e.Nat64),node_max_memory_size_bytes:e.Opt(e.Nat64),controller_id:e.Principal}),max_memo_length:e.Opt(e.Nat16),index_principal:e.Opt(e.Principal),token_name:e.Text,feature_flags:e.Opt(p)}),x=e.Variant({Upgrade:e.Opt(f),Init:N}),s=e.Nat,u=e.Record({block_range_end:s,canister_id:e.Principal,block_range_start:s}),_=e.Record({start:s,length:e.Nat}),y=e.Vec(e.Tuple(e.Text,r));r.fill(e.Variant({Int:e.Int,Map:y,Nat:e.Nat,Nat64:e.Nat64,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(r)}));let T=r,V=e.Record({blocks:e.Vec(T)}),b=e.Func([_],[V],["query"]),A=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),first_index:s,blocks:e.Vec(T),chain_length:e.Nat64,archived_blocks:e.Vec(e.Record({callback:b,start:s,length:e.Nat}))}),k=e.Record({certificate:e.Opt(e.Vec(e.Nat8)),hash_tree:e.Vec(e.Nat8)}),O=e.Nat,R=e.Record({start:O,length:e.Nat}),o=e.Nat64,h=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),q=e.Record({to:a,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat}),U=e.Record({fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),z=e.Record({to:a,fee:e.Opt(e.Nat),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,spender:e.Opt(a)}),S=e.Record({burn:e.Opt(h),kind:e.Text,mint:e.Opt(q),approve:e.Opt(U),timestamp:o,transfer:e.Opt(z)}),Q=e.Record({transactions:e.Vec(S)}),$=e.Func([R],[Q],["query"]),H=e.Record({first_index:O,log_length:e.Nat,transactions:e.Vec(S),archived_transactions:e.Vec(e.Record({callback:$,start:O,length:e.Nat}))}),W=e.Record({take:e.Opt(e.Nat),prev_spender:e.Opt(a),from_account:e.Opt(a)}),Z=e.Record({from_account:a,to_spender:a,allowance:e.Nat,expires_at:e.Opt(e.Nat64)}),X=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),AccessDenied:e.Record({reason:e.Text})}),Y=e.Variant({Ok:e.Vec(Z),Err:X}),j=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),IndexPrincipalNotSet:e.Null}),J=e.Variant({Ok:e.Principal,Err:j}),l=e.Nat,K=e.Record({url:e.Text,name:e.Text}),I=e.Record({to:a,fee:e.Opt(l),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(d),created_at_time:e.Opt(o),amount:l}),L=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),D=e.Variant({Ok:s,Err:L}),E=e.Record({utc_offset_minutes:e.Opt(e.Int16),language:e.Text}),ee=e.Record({metadata:E,device_spec:e.Opt(e.Variant({GenericDisplay:e.Null,FieldsDisplay:e.Null}))}),te=e.Record({arg:e.Vec(e.Nat8),method:e.Text,user_preferences:ee}),re=e.Variant({Text:e.Record({content:e.Text}),TokenAmount:e.Record({decimals:e.Nat8,amount:e.Nat64,symbol:e.Text}),TimestampSeconds:e.Record({amount:e.Nat64}),DurationSeconds:e.Record({amount:e.Nat64})}),ce=e.Record({fields:e.Vec(e.Tuple(e.Text,re)),intent:e.Text}),ae=e.Variant({FieldsDisplayMessage:ce,GenericDisplayMessage:e.Text}),ne=e.Record({metadata:E,consent_message:ae}),F=e.Record({description:e.Text}),oe=e.Variant({GenericError:e.Record({description:e.Text,error_code:e.Nat}),InsufficientPayment:F,UnsupportedCanisterCall:F,ConsentMessageUnavailable:F}),se=e.Variant({Ok:ne,Err:oe}),ie=e.Record({account:a,spender:a}),pe=e.Record({allowance:e.Nat,expires_at:e.Opt(o)}),le=e.Record({fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:e.Nat,expected_allowance:e.Opt(e.Nat),expires_at:e.Opt(o),spender:a}),de=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:e.Nat}),AllowanceChanged:e.Record({current_allowance:e.Nat}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,Expired:e.Record({ledger_time:o}),InsufficientFunds:e.Record({balance:e.Nat})}),_e=e.Variant({Ok:s,Err:de}),me=e.Record({to:a,fee:e.Opt(l),spender_subaccount:e.Opt(d),from:a,memo:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(o),amount:l}),ue=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,InsufficientAllowance:e.Record({allowance:l}),BadBurn:e.Record({min_burn_amount:l}),Duplicate:e.Record({duplicate_of:s}),BadFee:e.Record({expected_fee:l}),CreatedInFuture:e.Record({ledger_time:o}),TooOld:e.Null,InsufficientFunds:e.Record({balance:l})}),ge=e.Variant({Ok:s,Err:ue}),fe=e.Record({from:e.Opt(e.Principal)}),Ne=e.Vec(e.Record({end:e.Nat,canister_id:e.Principal,start:e.Nat}));c.fill(e.Variant({Int:e.Int,Map:e.Vec(e.Tuple(e.Text,c)),Nat:e.Nat,Blob:e.Vec(e.Nat8),Text:e.Text,Array:e.Vec(c)})),t.fill(e.Record({log_length:e.Nat,blocks:e.Vec(e.Record({id:e.Nat,block:c})),archived_blocks:e.Vec(e.Record({args:e.Vec(_),callback:e.Func([e.Vec(_)],[t],["query"])}))}));let Oe=e.Record({certificate:e.Vec(e.Nat8),hash_tree:e.Vec(e.Nat8)});return e.Service({archives:e.Func([],[e.Vec(u)],["query"]),get_blocks:e.Func([_],[A],["query"]),get_data_certificate:e.Func([],[k],["query"]),get_transactions:e.Func([R],[H],["query"]),icrc103_get_allowances:e.Func([W],[Y],["query"]),icrc106_get_index_principal:e.Func([],[J],["query"]),icrc10_supported_standards:e.Func([],[e.Vec(e.Record({url:e.Text,name:e.Text}))],["query"]),icrc1_balance_of:e.Func([a],[l],["query"]),icrc1_decimals:e.Func([],[e.Nat8],["query"]),icrc1_fee:e.Func([],[l],["query"]),icrc1_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,n))],["query"]),icrc1_minting_account:e.Func([],[e.Opt(a)],["query"]),icrc1_name:e.Func([],[e.Text],["query"]),icrc1_supported_standards:e.Func([],[e.Vec(K)],["query"]),icrc1_symbol:e.Func([],[e.Text],["query"]),icrc1_total_supply:e.Func([],[l],["query"]),icrc1_transfer:e.Func([I],[D],[]),icrc21_canister_call_consent_message:e.Func([te],[se],[]),icrc2_allowance:e.Func([ie],[pe],["query"]),icrc2_approve:e.Func([le],[_e],[]),icrc2_transfer_from:e.Func([me],[ge],[]),icrc3_get_archives:e.Func([fe],[Ne],["query"]),icrc3_get_blocks:e.Func([e.Vec(_)],[t],["query"]),icrc3_get_tip_certificate:e.Func([],[e.Opt(Oe)],["query"]),icrc3_supported_block_types:e.Func([],[e.Vec(e.Record({url:e.Text,block_type:e.Text}))],["query"]),is_ledger_ready:e.Func([],[e.Bool],["query"])})};var Ae=class e extends et{static create(t){let{service:c,certifiedService:r,canisterId:i}=tt({options:t,idlFactory:ze,certifiedIdlFactory:Ue});return new e(i,c,r)}metadata=t=>this.caller(t).icrc1_metadata();transactionFee=t=>this.caller(t).icrc1_fee();balance=t=>this.caller({certified:t.certified}).icrc1_balance_of({owner:t.owner,subaccount:rt(t.subaccount)});transfer=async t=>{let c=await this.caller({certified:!0}).icrc1_transfer(he(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer"});return c.Ok};totalTokensSupply=t=>this.caller(t).icrc1_total_supply();transferFrom=async t=>{let c=await this.caller({certified:!0}).icrc2_transfer_from(Fe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to transfer from"});return c.Ok};approve=async t=>{let c=await this.caller({certified:!0}).icrc2_approve(Pe(t));if("Err"in c)throw new v({errorType:c.Err,msg:"Failed to entitle the spender to transfer the amount"});return c.Ok};allowance=t=>{let{certified:c,...r}=t;return this.caller({certified:c}).icrc2_allowance({...r})};consentMessage=async t=>{let{icrc21_canister_call_consent_message:c}=this.caller({certified:!0}),r=await c(ve(t));if("Err"in r)throw Ge(r.Err);return r.Ok};getBlocks=t=>this.caller({certified:t.certified}).icrc3_get_blocks(t.args);getIndexPrincipal=async t=>{let{icrc106_get_index_principal:c}=this.caller(t),r=await c();if("Err"in r)throw Se(r.Err);return r.Ok};icrc1SupportedStandards=t=>this.caller(t).icrc1_supported_standards();icrc10SupportedStandards=t=>this.caller(t).icrc10_supported_standards();getMintingAccount=t=>this.caller(t).icrc1_minting_account()};var Qe=(n=>(n.SYMBOL="icrc1:symbol",n.NAME="icrc1:name",n.DECIMALS="icrc1:decimals",n.FEE="icrc1:fee",n.LOGO="icrc1:logo",n))(Qe||{});import{bigEndianCrc32 as ct,encodeBase32 as at,hexStringToUint8Array as nt,isNullish as He,nonNullish as M,notEmptyString as ot,uint8ArrayToHexString as st}from"@dfinity/utils";import{Principal as $e}from"@icp-sdk/core/principal";var it=64,Lt=({owner:e,subaccount:t})=>{if(He(t))return e.toText();let r=(i=>i.replace(/^0+/,""))(st(Uint8Array.from(t)));return r.length===0?e.toText():`${e.toText()}-${We({owner:e,subaccount:t})}.${r}`},We=({owner:e,subaccount:t})=>{let c=ct(Uint8Array.from([...e.toUint8Array(),...t]));return at(c)},Dt=e=>{let[t,c,...r]=e.split(".");if(!ot(t))throw new Error("Invalid account. No string provided.");if(r.length>0)throw new Error("Invalid account string format. Expected at most one '.' separator.");if(He(c))return{owner:$e.fromText(e)};let[i,...n]=t.split("-").reverse(),d=n.reverse().join("-"),a={owner:$e.fromText(d),subaccount:nt(c.padStart(it,"0"))};if(We(a)!==i)throw new Error("Invalid account. Invalid checksum.");return a},er=e=>{let t=e.reduce((r,[i,n])=>{switch(i){case"icrc1:symbol":r={...r,..."Text"in n&&{symbol:n.Text}};break;case"icrc1:name":r={...r,..."Text"in n&&{name:n.Text}};break;case"icrc1:fee":r={...r,..."Nat"in n&&{fee:n.Nat}};break;case"icrc1:decimals":r={...r,..."Nat"in n&&{decimals:Number(n.Nat)}};break;case"icrc1:logo":r={...r,..."Text"in n&&{icon:n.Text}}}return r},{});if((r=>M(r.symbol)&&M(r.name)&&M(r.fee)&&M(r.decimals))(t))return t};import{isNullish as pt,nonNullish as lt}from"@dfinity/utils";var cr=e=>{let t=/^([a-zA-Z]+):([A-Za-z0-9:\-.]+).*?(?:[?&](?:amount|value)=(\d+(?:\.\d+)?))?$/,c=e.match(t);if(pt(c))return;let[r,i,n,d]=c;return{token:i,identifier:n,...lt(d)&&!isNaN(parseFloat(d))&&{amount:parseFloat(d)}}};export{G as ConsentMessageError,Re as ConsentMessageUnavailableError,w as GenericError,be as IcrcIndexCanister,Ve as IcrcIndexNgCanister,Ae as IcrcLedgerCanister,Qe as IcrcMetadataResponseEntries,v as IcrcTransferError,P as IndexError,ye as IndexPrincipalNotSetError,xe as InsufficientPaymentError,Te as UnsupportedCanisterCallError,Dt as decodeIcrcAccount,cr as decodePayment,Lt as encodeIcrcAccount,_t as fromCandidAccount,Se as mapIcrc106GetIndexPrincipalError,Ge as mapIcrc21ConsentMessageError,er as mapTokenMetadata,Pe as toApproveArgs,ke as toCandidAccount,ve as toIcrc21ConsentMessageArgs,he as toTransferArg,Fe as toTransferFromArgs};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|