@dfinity/ledger-icrc 6.0.1 → 7.0.0-beta-2025-12-18
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/dist/index.d.ts +23 -17
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +4 -4
- package/package.json +4 -5
- package/dist/candid/icrc_index-ng.certified.idl.d.ts +0 -2
- package/dist/candid/icrc_index-ng.certified.idl.js +0 -151
- package/dist/candid/icrc_index-ng.d.ts +0 -154
- package/dist/candid/icrc_index-ng.did +0 -156
- package/dist/candid/icrc_index-ng.idl.d.ts +0 -2
- package/dist/candid/icrc_index-ng.idl.js +0 -151
- package/dist/candid/icrc_index.certified.idl.d.ts +0 -2
- package/dist/candid/icrc_index.certified.idl.js +0 -99
- package/dist/candid/icrc_index.d.ts +0 -108
- package/dist/candid/icrc_index.did +0 -98
- package/dist/candid/icrc_index.idl.d.ts +0 -2
- package/dist/candid/icrc_index.idl.js +0 -99
- package/dist/candid/icrc_ledger.certified.idl.d.ts +0 -2
- package/dist/candid/icrc_ledger.certified.idl.js +0 -525
- package/dist/candid/icrc_ledger.d.ts +0 -590
- package/dist/candid/icrc_ledger.did +0 -579
- package/dist/candid/icrc_ledger.idl.d.ts +0 -2
- package/dist/candid/icrc_ledger.idl.js +0 -545
- package/dist/candid/icrc_nft-ledger.certified.idl.d.ts +0 -2
- package/dist/candid/icrc_nft-ledger.certified.idl.js +0 -102
- package/dist/candid/icrc_nft-ledger.d.ts +0 -80
- package/dist/candid/icrc_nft-ledger.did +0 -67
- package/dist/candid/icrc_nft-ledger.idl.d.ts +0 -2
- package/dist/candid/icrc_nft-ledger.idl.js +0 -106
- package/dist/canister.d.ts +0 -13
- package/dist/converters/converters.d.ts +0 -16
- package/dist/converters/index.converters.d.ts +0 -6
- package/dist/converters/ledger.converters.d.ts +0 -6
- package/dist/errors/index.errors.d.ts +0 -2
- package/dist/errors/ledger.errors.d.ts +0 -25
- package/dist/index-ng.canister.d.ts +0 -43
- package/dist/index.canister.d.ts +0 -21
- package/dist/ledger.canister.d.ts +0 -127
- package/dist/types/canister.options.d.ts +0 -5
- package/dist/types/index-ng.params.d.ts +0 -12
- package/dist/types/index-ng.types.d.ts +0 -1
- package/dist/types/index.params.d.ts +0 -7
- package/dist/types/index.types.d.ts +0 -1
- package/dist/types/ledger.params.d.ts +0 -109
- package/dist/types/ledger.responses.d.ts +0 -24
- package/dist/utils/ledger.utils.d.ts +0 -31
- package/dist/utils/payment.utils.d.ts +0 -28
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
|
-
// This file was automatically generated by @icp-sdk/bindgen@0.2.0.
|
|
6
|
-
// You should NOT make any changes in this file as it will be overwritten.
|
|
7
|
-
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
8
|
-
|
|
9
|
-
import type { ActorMethod } from "@icp-sdk/core/agent";
|
|
10
|
-
import type { IDL } from "@icp-sdk/core/candid";
|
|
11
|
-
import type { Principal } from "@icp-sdk/core/principal";
|
|
12
|
-
|
|
13
|
-
export interface Account {
|
|
14
|
-
owner: Principal;
|
|
15
|
-
subaccount: [] | [Subaccount];
|
|
16
|
-
}
|
|
17
|
-
export type Subaccount = Uint8Array;
|
|
18
|
-
export interface TransferArg {
|
|
19
|
-
to: Account;
|
|
20
|
-
token_id: bigint;
|
|
21
|
-
memo: [] | [Uint8Array];
|
|
22
|
-
from_subaccount: [] | [Uint8Array];
|
|
23
|
-
created_at_time: [] | [bigint];
|
|
24
|
-
}
|
|
25
|
-
export type TransferError =
|
|
26
|
-
| {
|
|
27
|
-
GenericError: { message: string; error_code: bigint };
|
|
28
|
-
}
|
|
29
|
-
| { Duplicate: { duplicate_of: bigint } }
|
|
30
|
-
| { NonExistingTokenId: null }
|
|
31
|
-
| { Unauthorized: null }
|
|
32
|
-
| { CreatedInFuture: { ledger_time: bigint } }
|
|
33
|
-
| { InvalidRecipient: null }
|
|
34
|
-
| { GenericBatchError: { message: string; error_code: bigint } }
|
|
35
|
-
| { TooOld: null };
|
|
36
|
-
export type TransferResult = { Ok: bigint } | { Err: TransferError };
|
|
37
|
-
/**
|
|
38
|
-
* Generic value in accordance with ICRC-3
|
|
39
|
-
*/
|
|
40
|
-
export type Value =
|
|
41
|
-
| { Int: bigint }
|
|
42
|
-
| { Map: Array<[string, Value]> }
|
|
43
|
-
| { Nat: bigint }
|
|
44
|
-
| { Blob: Uint8Array }
|
|
45
|
-
| { Text: string }
|
|
46
|
-
| { Array: Array<Value> };
|
|
47
|
-
export interface _SERVICE {
|
|
48
|
-
icrc7_atomic_batch_transfers: ActorMethod<[], [] | [boolean]>;
|
|
49
|
-
icrc7_balance_of: ActorMethod<[Array<Account>], Array<bigint>>;
|
|
50
|
-
icrc7_collection_metadata: ActorMethod<[], Array<[string, Value]>>;
|
|
51
|
-
icrc7_default_take_value: ActorMethod<[], [] | [bigint]>;
|
|
52
|
-
icrc7_description: ActorMethod<[], [] | [string]>;
|
|
53
|
-
icrc7_logo: ActorMethod<[], [] | [string]>;
|
|
54
|
-
icrc7_max_memo_size: ActorMethod<[], [] | [bigint]>;
|
|
55
|
-
icrc7_max_query_batch_size: ActorMethod<[], [] | [bigint]>;
|
|
56
|
-
icrc7_max_take_value: ActorMethod<[], [] | [bigint]>;
|
|
57
|
-
icrc7_max_update_batch_size: ActorMethod<[], [] | [bigint]>;
|
|
58
|
-
icrc7_name: ActorMethod<[], string>;
|
|
59
|
-
icrc7_owner_of: ActorMethod<[Array<bigint>], Array<[] | [Account]>>;
|
|
60
|
-
icrc7_permitted_drift: ActorMethod<[], [] | [bigint]>;
|
|
61
|
-
icrc7_supply_cap: ActorMethod<[], [] | [bigint]>;
|
|
62
|
-
icrc7_symbol: ActorMethod<[], string>;
|
|
63
|
-
icrc7_token_metadata: ActorMethod<
|
|
64
|
-
[Array<bigint>],
|
|
65
|
-
Array<[] | [Array<[string, Value]>]>
|
|
66
|
-
>;
|
|
67
|
-
icrc7_tokens: ActorMethod<[[] | [bigint], [] | [bigint]], Array<bigint>>;
|
|
68
|
-
icrc7_tokens_of: ActorMethod<
|
|
69
|
-
[Account, [] | [bigint], [] | [bigint]],
|
|
70
|
-
Array<bigint>
|
|
71
|
-
>;
|
|
72
|
-
icrc7_total_supply: ActorMethod<[], bigint>;
|
|
73
|
-
icrc7_transfer: ActorMethod<
|
|
74
|
-
[Array<TransferArg>],
|
|
75
|
-
Array<[] | [TransferResult]>
|
|
76
|
-
>;
|
|
77
|
-
icrc7_tx_window: ActorMethod<[], [] | [bigint]>;
|
|
78
|
-
}
|
|
79
|
-
export declare const idlFactory: IDL.InterfaceFactory;
|
|
80
|
-
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// Generated from dfinity/ICRC commit 07e56ecedb51b7f58b7d06ec82ebf7114db42c6b for file 'ICRCs/ICRC-7/ICRC-7.did'
|
|
2
|
-
|
|
3
|
-
type Subaccount = blob;
|
|
4
|
-
|
|
5
|
-
type Account = record { owner : principal; subaccount : opt Subaccount };
|
|
6
|
-
|
|
7
|
-
// Generic value in accordance with ICRC-3
|
|
8
|
-
type Value = variant {
|
|
9
|
-
Blob : blob;
|
|
10
|
-
Text : text;
|
|
11
|
-
Nat : nat;
|
|
12
|
-
Int : int;
|
|
13
|
-
Array : vec Value;
|
|
14
|
-
Map : vec record { text; Value };
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type TransferArg = record {
|
|
18
|
-
from_subaccount: opt blob; // The subaccount to transfer the token from
|
|
19
|
-
to : Account;
|
|
20
|
-
token_id : nat;
|
|
21
|
-
memo : opt blob;
|
|
22
|
-
created_at_time : opt nat64;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
type TransferResult = variant {
|
|
26
|
-
Ok : nat; // Transaction index for successful transfer
|
|
27
|
-
Err : TransferError;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
type TransferError = variant {
|
|
31
|
-
NonExistingTokenId;
|
|
32
|
-
InvalidRecipient;
|
|
33
|
-
Unauthorized;
|
|
34
|
-
TooOld;
|
|
35
|
-
CreatedInFuture : record { ledger_time: nat64 };
|
|
36
|
-
Duplicate : record { duplicate_of : nat };
|
|
37
|
-
GenericError : record { error_code : nat; message : text };
|
|
38
|
-
GenericBatchError : record { error_code : nat; message : text };
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
service : {
|
|
42
|
-
icrc7_collection_metadata : () -> (vec record { text; Value } ) query;
|
|
43
|
-
icrc7_symbol : () -> (text) query;
|
|
44
|
-
icrc7_name : () -> (text) query;
|
|
45
|
-
icrc7_description : () -> (opt text) query;
|
|
46
|
-
icrc7_logo : () -> (opt text) query;
|
|
47
|
-
icrc7_total_supply : () -> (nat) query;
|
|
48
|
-
icrc7_supply_cap : () -> (opt nat) query;
|
|
49
|
-
icrc7_max_query_batch_size : () -> (opt nat) query;
|
|
50
|
-
icrc7_max_update_batch_size : () -> (opt nat) query;
|
|
51
|
-
icrc7_default_take_value : () -> (opt nat) query;
|
|
52
|
-
icrc7_max_take_value : () -> (opt nat) query;
|
|
53
|
-
icrc7_max_memo_size : () -> (opt nat) query;
|
|
54
|
-
icrc7_atomic_batch_transfers : () -> (opt bool) query;
|
|
55
|
-
icrc7_tx_window : () -> (opt nat) query;
|
|
56
|
-
icrc7_permitted_drift : () -> (opt nat) query;
|
|
57
|
-
icrc7_token_metadata : (token_ids : vec nat)
|
|
58
|
-
-> (vec opt vec record { text; Value }) query;
|
|
59
|
-
icrc7_owner_of : (token_ids : vec nat)
|
|
60
|
-
-> (vec opt Account) query;
|
|
61
|
-
icrc7_balance_of : (vec Account) -> (vec nat) query;
|
|
62
|
-
icrc7_tokens : (prev : opt nat, take : opt nat)
|
|
63
|
-
-> (vec nat) query;
|
|
64
|
-
icrc7_tokens_of : (account : Account, prev : opt nat, take : opt nat)
|
|
65
|
-
-> (vec nat) query;
|
|
66
|
-
icrc7_transfer : (vec TransferArg) -> (vec opt TransferResult);
|
|
67
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
|
-
// This file was automatically generated by @icp-sdk/bindgen@0.2.0.
|
|
6
|
-
// You should NOT make any changes in this file as it will be overwritten.
|
|
7
|
-
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
8
|
-
|
|
9
|
-
export const idlFactory = ({ IDL }) => {
|
|
10
|
-
const Value = IDL.Rec();
|
|
11
|
-
const Subaccount = IDL.Vec(IDL.Nat8);
|
|
12
|
-
const Account = IDL.Record({
|
|
13
|
-
owner: IDL.Principal,
|
|
14
|
-
subaccount: IDL.Opt(Subaccount),
|
|
15
|
-
});
|
|
16
|
-
Value.fill(
|
|
17
|
-
IDL.Variant({
|
|
18
|
-
Int: IDL.Int,
|
|
19
|
-
Map: IDL.Vec(IDL.Tuple(IDL.Text, Value)),
|
|
20
|
-
Nat: IDL.Nat,
|
|
21
|
-
Blob: IDL.Vec(IDL.Nat8),
|
|
22
|
-
Text: IDL.Text,
|
|
23
|
-
Array: IDL.Vec(Value),
|
|
24
|
-
}),
|
|
25
|
-
);
|
|
26
|
-
const TransferArg = IDL.Record({
|
|
27
|
-
to: Account,
|
|
28
|
-
token_id: IDL.Nat,
|
|
29
|
-
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
30
|
-
from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
31
|
-
created_at_time: IDL.Opt(IDL.Nat64),
|
|
32
|
-
});
|
|
33
|
-
const TransferError = IDL.Variant({
|
|
34
|
-
GenericError: IDL.Record({
|
|
35
|
-
message: IDL.Text,
|
|
36
|
-
error_code: IDL.Nat,
|
|
37
|
-
}),
|
|
38
|
-
Duplicate: IDL.Record({ duplicate_of: IDL.Nat }),
|
|
39
|
-
NonExistingTokenId: IDL.Null,
|
|
40
|
-
Unauthorized: IDL.Null,
|
|
41
|
-
CreatedInFuture: IDL.Record({ ledger_time: IDL.Nat64 }),
|
|
42
|
-
InvalidRecipient: IDL.Null,
|
|
43
|
-
GenericBatchError: IDL.Record({
|
|
44
|
-
message: IDL.Text,
|
|
45
|
-
error_code: IDL.Nat,
|
|
46
|
-
}),
|
|
47
|
-
TooOld: IDL.Null,
|
|
48
|
-
});
|
|
49
|
-
const TransferResult = IDL.Variant({ Ok: IDL.Nat, Err: TransferError });
|
|
50
|
-
|
|
51
|
-
return IDL.Service({
|
|
52
|
-
icrc7_atomic_batch_transfers: IDL.Func([], [IDL.Opt(IDL.Bool)], ["query"]),
|
|
53
|
-
icrc7_balance_of: IDL.Func(
|
|
54
|
-
[IDL.Vec(Account)],
|
|
55
|
-
[IDL.Vec(IDL.Nat)],
|
|
56
|
-
["query"],
|
|
57
|
-
),
|
|
58
|
-
icrc7_collection_metadata: IDL.Func(
|
|
59
|
-
[],
|
|
60
|
-
[IDL.Vec(IDL.Tuple(IDL.Text, Value))],
|
|
61
|
-
["query"],
|
|
62
|
-
),
|
|
63
|
-
icrc7_default_take_value: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
64
|
-
icrc7_description: IDL.Func([], [IDL.Opt(IDL.Text)], ["query"]),
|
|
65
|
-
icrc7_logo: IDL.Func([], [IDL.Opt(IDL.Text)], ["query"]),
|
|
66
|
-
icrc7_max_memo_size: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
67
|
-
icrc7_max_query_batch_size: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
68
|
-
icrc7_max_take_value: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
69
|
-
icrc7_max_update_batch_size: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
70
|
-
icrc7_name: IDL.Func([], [IDL.Text], ["query"]),
|
|
71
|
-
icrc7_owner_of: IDL.Func(
|
|
72
|
-
[IDL.Vec(IDL.Nat)],
|
|
73
|
-
[IDL.Vec(IDL.Opt(Account))],
|
|
74
|
-
["query"],
|
|
75
|
-
),
|
|
76
|
-
icrc7_permitted_drift: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
77
|
-
icrc7_supply_cap: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
78
|
-
icrc7_symbol: IDL.Func([], [IDL.Text], ["query"]),
|
|
79
|
-
icrc7_token_metadata: IDL.Func(
|
|
80
|
-
[IDL.Vec(IDL.Nat)],
|
|
81
|
-
[IDL.Vec(IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, Value))))],
|
|
82
|
-
["query"],
|
|
83
|
-
),
|
|
84
|
-
icrc7_tokens: IDL.Func(
|
|
85
|
-
[IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)],
|
|
86
|
-
[IDL.Vec(IDL.Nat)],
|
|
87
|
-
["query"],
|
|
88
|
-
),
|
|
89
|
-
icrc7_tokens_of: IDL.Func(
|
|
90
|
-
[Account, IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)],
|
|
91
|
-
[IDL.Vec(IDL.Nat)],
|
|
92
|
-
["query"],
|
|
93
|
-
),
|
|
94
|
-
icrc7_total_supply: IDL.Func([], [IDL.Nat], ["query"]),
|
|
95
|
-
icrc7_transfer: IDL.Func(
|
|
96
|
-
[IDL.Vec(TransferArg)],
|
|
97
|
-
[IDL.Vec(IDL.Opt(TransferResult))],
|
|
98
|
-
[],
|
|
99
|
-
),
|
|
100
|
-
icrc7_tx_window: IDL.Func([], [IDL.Opt(IDL.Nat)], ["query"]),
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const init = ({ IDL }) => {
|
|
105
|
-
return [];
|
|
106
|
-
};
|
package/dist/canister.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Canister } from "@dfinity/utils";
|
|
2
|
-
import type { _SERVICE as IcrcIndexNgService } from "./candid/icrc_index-ng";
|
|
3
|
-
import type { _SERVICE as IcrcLedgerService, Tokens } from "./candid/icrc_ledger";
|
|
4
|
-
import type { BalanceParams } from "./types/ledger.params";
|
|
5
|
-
export declare abstract class IcrcCanister<T extends IcrcLedgerService | IcrcIndexNgService> extends Canister<T> {
|
|
6
|
-
/**
|
|
7
|
-
* Returns the balance for a given account provided as owner and with optional subaccount.
|
|
8
|
-
*
|
|
9
|
-
* @param {BalanceParams} params The parameters to get the balance of an account.
|
|
10
|
-
* @returns {Promise<Tokens>} The balance of the given account.
|
|
11
|
-
*/
|
|
12
|
-
balance: (params: BalanceParams) => Promise<Tokens>;
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Account } from "../candid/icrc_ledger";
|
|
2
|
-
import type { IcrcAccount } from "../types/ledger.responses";
|
|
3
|
-
/**
|
|
4
|
-
* Converts a Candid Account object to an IcrcAccount, effectively transforming nullable properties into nullish ones.
|
|
5
|
-
*
|
|
6
|
-
* @param {Account} - The Candid Account object to convert.
|
|
7
|
-
* @return {IcrcAccount} - The converted IcrcAccount object.
|
|
8
|
-
*/
|
|
9
|
-
export declare const fromCandidAccount: ({ owner, subaccount: nullableSubaccount, }: Account) => IcrcAccount;
|
|
10
|
-
/**
|
|
11
|
-
* Converts an IcrcAccount to a Candid Account object, effectively transforming nullish properties into nullable ones.
|
|
12
|
-
*
|
|
13
|
-
* @param {IcrcAccount} - The IcrcAccount object to convert.
|
|
14
|
-
* @return {Account} - The converted Candid Account object.
|
|
15
|
-
*/
|
|
16
|
-
export declare const toCandidAccount: ({ owner, subaccount, }: IcrcAccount) => Account;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { GetAccountTransactionsArgs } from "../candid/icrc_index";
|
|
2
|
-
import type { ListSubaccountsArgs } from "../candid/icrc_index-ng";
|
|
3
|
-
import type { ListSubaccountsParams } from "../types/index-ng.params";
|
|
4
|
-
import type { GetAccountTransactionsParams } from "../types/index.params";
|
|
5
|
-
export declare const toGetTransactionsArgs: ({ account, max_results, start, }: GetAccountTransactionsParams) => GetAccountTransactionsArgs;
|
|
6
|
-
export declare const toListSubaccountsParams: ({ owner, start, }: ListSubaccountsParams) => ListSubaccountsArgs;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ApproveArgs, icrc21_consent_message_request as ConsentMessageArgs, TransferArg, TransferFromArgs } from "../candid/icrc_ledger";
|
|
2
|
-
import type { ApproveParams, Icrc21ConsentMessageParams, TransferFromParams, TransferParams } from "../types/ledger.params";
|
|
3
|
-
export declare const toTransferArg: ({ from_subaccount, fee, created_at_time, memo, ...rest }: TransferParams) => TransferArg;
|
|
4
|
-
export declare const toTransferFromArgs: ({ spender_subaccount, fee, created_at_time, memo, ...rest }: TransferFromParams) => TransferFromArgs;
|
|
5
|
-
export declare const toApproveArgs: ({ fee, created_at_time, memo, from_subaccount, expected_allowance, expires_at, ...rest }: ApproveParams) => ApproveArgs;
|
|
6
|
-
export declare const toIcrc21ConsentMessageArgs: ({ userPreferences: { metadata: { utcOffsetMinutes, language }, deriveSpec, }, ...rest }: Icrc21ConsentMessageParams) => ConsentMessageArgs;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { GetIndexPrincipalError, icrc21_error as Icrc21RawError } from "../candid/icrc_ledger";
|
|
2
|
-
export declare class IcrcTransferError<T> extends Error {
|
|
3
|
-
errorType: T;
|
|
4
|
-
constructor({ msg, errorType }: {
|
|
5
|
-
msg?: string;
|
|
6
|
-
errorType: T;
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
export declare class GenericError extends Error {
|
|
10
|
-
readonly message: string;
|
|
11
|
-
readonly error_code: bigint;
|
|
12
|
-
constructor(message: string, error_code: bigint);
|
|
13
|
-
}
|
|
14
|
-
export declare class ConsentMessageError extends Error {
|
|
15
|
-
}
|
|
16
|
-
export declare class InsufficientPaymentError extends ConsentMessageError {
|
|
17
|
-
}
|
|
18
|
-
export declare class UnsupportedCanisterCallError extends ConsentMessageError {
|
|
19
|
-
}
|
|
20
|
-
export declare class ConsentMessageUnavailableError extends ConsentMessageError {
|
|
21
|
-
}
|
|
22
|
-
export declare const mapIcrc21ConsentMessageError: (rawError: Icrc21RawError) => ConsentMessageError;
|
|
23
|
-
export declare class IndexPrincipalNotSetError extends Error {
|
|
24
|
-
}
|
|
25
|
-
export declare const mapIcrc106GetIndexPrincipalError: (err: GetIndexPrincipalError) => GenericError | IndexPrincipalNotSetError;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { Principal } from "@icp-sdk/core/principal";
|
|
3
|
-
import type { SubAccount } from "./candid/icrc_index";
|
|
4
|
-
import type { GetTransactions, _SERVICE as IcrcIndexNgService, Status } from "./candid/icrc_index-ng";
|
|
5
|
-
import { IcrcCanister } from "./canister";
|
|
6
|
-
import type { IcrcLedgerCanisterOptions } from "./types/canister.options";
|
|
7
|
-
import type { GetIndexNgAccountTransactionsParams, ListSubaccountsParams } from "./types/index-ng.params";
|
|
8
|
-
export declare class IcrcIndexNgCanister extends IcrcCanister<IcrcIndexNgService> {
|
|
9
|
-
static create(options: IcrcLedgerCanisterOptions<IcrcIndexNgService>): IcrcIndexNgCanister;
|
|
10
|
-
/**
|
|
11
|
-
* Get the transactions of an account
|
|
12
|
-
*
|
|
13
|
-
* Always certified.
|
|
14
|
-
* `get_account_transactions` needs to be called with an update
|
|
15
|
-
* because the index canisters makes a call to the ledger canister to get the transaction data.
|
|
16
|
-
* Index Canister only holds the transactions ids in state, not the whole transaction data.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Get the transactions of an account.
|
|
20
|
-
*
|
|
21
|
-
* @param {GetAccountTransactionsParams} params The parameters to get the transactions of an account.
|
|
22
|
-
* @returns {Promise<GetTransactions>} The list of transactions and further related information of the given account.
|
|
23
|
-
*/
|
|
24
|
-
getTransactions: ({ certified, ...rest }: GetIndexNgAccountTransactionsParams) => Promise<GetTransactions>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the ledger canister ID related to the index canister.
|
|
27
|
-
*/
|
|
28
|
-
ledgerId: (params: QueryParams) => Promise<Principal>;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the status of the index canister.
|
|
31
|
-
*
|
|
32
|
-
* @param {QueryParams} params The parameters to get the status of the index canister.
|
|
33
|
-
* @returns {Promise<Status>} The status of the index canister.
|
|
34
|
-
*/
|
|
35
|
-
status: (params: QueryParams) => Promise<Status>;
|
|
36
|
-
/**
|
|
37
|
-
* Returns the list of subaccounts for a given owner.
|
|
38
|
-
*
|
|
39
|
-
* @param {ListSubaccountsParams} params The parameters to get the list of subaccounts.
|
|
40
|
-
* @returns {Promise<Array<SubAccount>>} The list of subaccounts.
|
|
41
|
-
*/
|
|
42
|
-
listSubaccounts: ({ certified, ...rest }: ListSubaccountsParams) => Promise<Array<SubAccount>>;
|
|
43
|
-
}
|
package/dist/index.canister.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Canister, type QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { Principal } from "@icp-sdk/core/principal";
|
|
3
|
-
import type { GetTransactions, _SERVICE as IcrcIndexService } from "./candid/icrc_index";
|
|
4
|
-
import type { IcrcLedgerCanisterOptions } from "./types/canister.options";
|
|
5
|
-
import type { GetAccountTransactionsParams } from "./types/index.params";
|
|
6
|
-
export declare class IcrcIndexCanister extends Canister<IcrcIndexService> {
|
|
7
|
-
static create(options: IcrcLedgerCanisterOptions<IcrcIndexService>): IcrcIndexCanister;
|
|
8
|
-
/**
|
|
9
|
-
* Get the transactions of an account
|
|
10
|
-
*
|
|
11
|
-
* Always certified.
|
|
12
|
-
* `get_account_transactions` needs to be called with an update
|
|
13
|
-
* because the index canisters makes a call to the ledger canister to get the transaction data.
|
|
14
|
-
* Index Canister only holds the transactions ids in state, not the whole transaction data.
|
|
15
|
-
*/
|
|
16
|
-
getTransactions: (params: GetAccountTransactionsParams) => Promise<GetTransactions>;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the ledger canister ID related to the index canister.
|
|
19
|
-
*/
|
|
20
|
-
ledgerId: (params: QueryParams) => Promise<Principal>;
|
|
21
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { Canister, type Nullable, type QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { Principal } from "@icp-sdk/core/principal";
|
|
3
|
-
import type { Account, Allowance, BlockIndex, GetBlocksResult, icrc21_consent_info, _SERVICE as IcrcLedgerService, StandardRecord, Tokens } from "./candid/icrc_ledger";
|
|
4
|
-
import type { IcrcLedgerCanisterOptions } from "./types/canister.options";
|
|
5
|
-
import type { AllowanceParams, ApproveParams, BalanceParams, GetBlocksParams, Icrc21ConsentMessageParams, TransferFromParams, TransferParams } from "./types/ledger.params";
|
|
6
|
-
import type { IcrcTokenMetadataResponse } from "./types/ledger.responses";
|
|
7
|
-
export declare class IcrcLedgerCanister extends Canister<IcrcLedgerService> {
|
|
8
|
-
static create(options: IcrcLedgerCanisterOptions<IcrcLedgerService>): IcrcLedgerCanister;
|
|
9
|
-
/**
|
|
10
|
-
* The token metadata (name, symbol, etc.).
|
|
11
|
-
*/
|
|
12
|
-
metadata: (params: QueryParams) => Promise<IcrcTokenMetadataResponse>;
|
|
13
|
-
/**
|
|
14
|
-
* The ledger transaction fees.
|
|
15
|
-
*
|
|
16
|
-
* @returns {Tokens} The ledger transaction fees in Tokens
|
|
17
|
-
*/
|
|
18
|
-
transactionFee: (params: QueryParams) => Promise<Tokens>;
|
|
19
|
-
/**
|
|
20
|
-
* Returns the balance for a given account provided as owner and with optional subaccount.
|
|
21
|
-
*
|
|
22
|
-
* @param {BalanceParams} params The parameters to get the balance of an account.
|
|
23
|
-
* @returns {Promise<Tokens>} The balance of the given account.
|
|
24
|
-
*/
|
|
25
|
-
balance: (params: BalanceParams) => Promise<Tokens>;
|
|
26
|
-
/**
|
|
27
|
-
* Transfers tokens from the sender to the given account.
|
|
28
|
-
*
|
|
29
|
-
* @param {TransferArg} params The parameters to transfer tokens.
|
|
30
|
-
*
|
|
31
|
-
* @throws {IcrcTransferError} If the transfer fails.
|
|
32
|
-
*/
|
|
33
|
-
transfer: (params: TransferParams) => Promise<BlockIndex>;
|
|
34
|
-
/**
|
|
35
|
-
* Returns the total supply of tokens.
|
|
36
|
-
*/
|
|
37
|
-
totalTokensSupply: (params: QueryParams) => Promise<Tokens>;
|
|
38
|
-
/**
|
|
39
|
-
* Transfers a token amount from the `from` account to the `to` account using the allowance of the spender's account (`SpenderAccount = { owner = caller; subaccount = spender_subaccount }`). The ledger draws the fees from the `from` account.
|
|
40
|
-
*
|
|
41
|
-
* Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_transfer_from
|
|
42
|
-
*
|
|
43
|
-
* @param {TransferFromParams} params The parameters to transfer tokens from to.
|
|
44
|
-
*
|
|
45
|
-
* @throws {IcrcTransferError} If the transfer from fails.
|
|
46
|
-
*/
|
|
47
|
-
transferFrom: (params: TransferFromParams) => Promise<BlockIndex>;
|
|
48
|
-
/**
|
|
49
|
-
* This method entitles the `spender` to transfer token `amount` on behalf of the caller from account `{ owner = caller; subaccount = from_subaccount }`.
|
|
50
|
-
*
|
|
51
|
-
* Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_approve
|
|
52
|
-
*
|
|
53
|
-
* @param {ApproveParams} params The parameters to approve.
|
|
54
|
-
*
|
|
55
|
-
* @throws {IcrcTransferError} If the approval fails.
|
|
56
|
-
*/
|
|
57
|
-
approve: (params: ApproveParams) => Promise<BlockIndex>;
|
|
58
|
-
/**
|
|
59
|
-
* Returns the token allowance that the `spender` account can transfer from the specified `account`, and the expiration time for that allowance, if any.
|
|
60
|
-
*
|
|
61
|
-
* Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md#icrc2_allowance
|
|
62
|
-
*
|
|
63
|
-
* @param {AllowanceParams} params The parameters to call the allowance.
|
|
64
|
-
*
|
|
65
|
-
* @returns {Allowance} The token allowance. If there is no active approval, the ledger MUST return `{ allowance = 0; expires_at = null }`.
|
|
66
|
-
*/
|
|
67
|
-
allowance: (params: AllowanceParams) => Promise<Allowance>;
|
|
68
|
-
/**
|
|
69
|
-
* Fetches the consent message for a specified canister call, intended to provide a human-readable message that helps users make informed decisions.
|
|
70
|
-
*
|
|
71
|
-
* @link: https://github.com/dfinity/wg-identity-authentication/blob/main/topics/ICRC-21/icrc_21_consent_msg.md
|
|
72
|
-
*
|
|
73
|
-
* @param {Icrc21ConsentMessageParams} params - The request parameters containing the method name, arguments, and consent preferences (e.g., language).
|
|
74
|
-
* @returns {Promise<icrc21_consent_info>} - A promise that resolves to the consent message response, which includes the consent message in the specified language and other related information.
|
|
75
|
-
*
|
|
76
|
-
* @throws {InsufficientPaymentError} - This error is reserved for future use, in case payment extensions are introduced. For example, if consent messages, which are currently free, begin to require payments.
|
|
77
|
-
* @throws {UnsupportedCanisterCallError} - If the specified canister call is not supported.
|
|
78
|
-
* @throws {ConsentMessageUnavailableError} - If there is no consent message available.
|
|
79
|
-
* @throws {GenericError} - For any other generic errors.
|
|
80
|
-
*/
|
|
81
|
-
consentMessage: (params: Icrc21ConsentMessageParams) => Promise<icrc21_consent_info>;
|
|
82
|
-
/**
|
|
83
|
-
* Fetches the blocks information from the ledger canister,
|
|
84
|
-
*
|
|
85
|
-
* @param {GetBlocksParams} params The parameters to get the blocks.
|
|
86
|
-
* @returns {Promise<GetBlocksResult>} The list of blocks.
|
|
87
|
-
*/
|
|
88
|
-
getBlocks: (params: GetBlocksParams) => Promise<GetBlocksResult>;
|
|
89
|
-
/**
|
|
90
|
-
* Returns the principal of the index canister for the ledger, if one was defined as such.
|
|
91
|
-
*
|
|
92
|
-
* @link: https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-106/ICRC-106.md
|
|
93
|
-
*
|
|
94
|
-
* @returns {Promise<Principal>} The principal of the index canister.
|
|
95
|
-
*
|
|
96
|
-
* @throws {GenericError} - For any errors that occur while fetching the index principal.
|
|
97
|
-
* @throws {IndexPrincipalNotSetError} - If the index principal was not set for the ledger canister.
|
|
98
|
-
*/
|
|
99
|
-
getIndexPrincipal: (params: QueryParams) => Promise<Principal>;
|
|
100
|
-
/**
|
|
101
|
-
* Returns the list of standards this ledger supports by using icrc1_supported_standards.
|
|
102
|
-
*
|
|
103
|
-
* @link: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/README.md#icrc1_supported_standards
|
|
104
|
-
*
|
|
105
|
-
* @returns {Promise<StandardRecord[]>} The list of standards.
|
|
106
|
-
*/
|
|
107
|
-
icrc1SupportedStandards: (params: QueryParams) => Promise<StandardRecord[]>;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the list of standards this ledger supports by using icrc10_supported_standards.
|
|
110
|
-
*
|
|
111
|
-
* @link: https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-10/ICRC-10.md#icrc10_supported_standards
|
|
112
|
-
*
|
|
113
|
-
* @returns {Promise<{ url: string; name: string }[]>} The list of standards.
|
|
114
|
-
*/
|
|
115
|
-
icrc10SupportedStandards: (params: QueryParams) => Promise<{
|
|
116
|
-
url: string;
|
|
117
|
-
name: string;
|
|
118
|
-
}[]>;
|
|
119
|
-
/**
|
|
120
|
-
* Returns the minting account of the Ledger canister.
|
|
121
|
-
*
|
|
122
|
-
* @link: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-1/README.md#icrc1_minting_account
|
|
123
|
-
*
|
|
124
|
-
* @returns {Promise<Nullable<Account>>} The minting account as a Nullable object.
|
|
125
|
-
*/
|
|
126
|
-
getMintingAccount: (params: QueryParams) => Promise<Nullable<Account>>;
|
|
127
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { Subaccount } from "../candid/icrc_ledger";
|
|
3
|
-
import type { IcrcNgTxId } from "./index-ng.types";
|
|
4
|
-
import type { IcrcAccount } from "./ledger.responses";
|
|
5
|
-
export type GetIndexNgAccountTransactionsParams = {
|
|
6
|
-
max_results: bigint;
|
|
7
|
-
start?: IcrcNgTxId;
|
|
8
|
-
account: IcrcAccount;
|
|
9
|
-
} & QueryParams;
|
|
10
|
-
export type ListSubaccountsParams = {
|
|
11
|
-
start?: Subaccount;
|
|
12
|
-
} & Pick<IcrcAccount, "owner"> & QueryParams;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { GetTransactions as IcrcIndexNgGetTransactions, Transaction as IcrcIndexNgTransaction, TransactionWithId as IcrcIndexNgTransactionWithId, Status as IcrcNgStatus, BlockIndex as IcrcNgTxId, } from "../candid/icrc_index-ng";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { GetTransactions as IcrcGetTransactions, Transaction as IcrcTransaction, TransactionWithId as IcrcTransactionWithId, TxId as IcrcTxId, } from "../candid/icrc_index";
|