@ic-pay/icpay-sdk 1.3.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/declarations/icp-ledger/icp-ledger.did.d.ts +82 -0
- package/dist/declarations/icp-ledger/icp-ledger.did.js +76 -0
- package/dist/declarations/icpay_canister_backend/icpay_canister_backend.did +193 -0
- package/dist/declarations/icpay_canister_backend/icpay_canister_backend.did.d.ts +219 -0
- package/dist/declarations/icpay_canister_backend/icpay_canister_backend.did.js +231 -0
- package/dist/declarations/icrc-ledger/ledger.did +560 -0
- package/dist/declarations/icrc-ledger/ledger.did.d.ts +364 -0
- package/dist/declarations/icrc-ledger/ledger.did.js +530 -0
- package/dist/errors.d.ts +72 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +162 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +24 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +131 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1211 -0
- package/dist/index.js.map +1 -0
- package/dist/protected.d.ts +28 -0
- package/dist/protected.d.ts.map +1 -0
- package/dist/protected.js +336 -0
- package/dist/protected.js.map +1 -0
- package/dist/types/index.d.ts +482 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils.d.ts +15 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +42 -0
- package/dist/utils.js.map +1 -0
- package/dist/wallet.d.ts +83 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +261 -0
- package/dist/wallet.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ICPay SDK
|
|
2
|
+
|
|
3
|
+
Official SDK for integrating Internet Computer payments with ICPay.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Using pnpm:
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add @ic-pay/icpay-sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Using yarn:
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @ic-pay/icpay-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Using npm:
|
|
18
|
+
```bash
|
|
19
|
+
npm install @ic-pay/icpay-sdk
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Documentation
|
|
23
|
+
|
|
24
|
+
For full usage guides, configuration, API reference, and examples, see the ICPay documentation: [ICPay Docs](https://docs.icpay.org).
|
|
25
|
+
|
|
26
|
+
## Basic Info
|
|
27
|
+
|
|
28
|
+
- Works in browser and Node.js environments
|
|
29
|
+
- TypeScript-ready with bundled types
|
|
30
|
+
- Supports public (publishable key) and private (secret key) usage
|
|
31
|
+
|
|
32
|
+
If you need help getting started, the step-by-step guides and examples on the [ICPay Docs](https://docs.icpay.org) cover common setups and advanced scenarios.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface AccountIdentifier extends Array<number> {}
|
|
2
|
+
export interface Tokens extends bigint {}
|
|
3
|
+
export interface BlockIndex extends bigint {}
|
|
4
|
+
export interface Memo extends bigint {}
|
|
5
|
+
export interface SubAccount extends Array<number> {}
|
|
6
|
+
export interface TimeStamp extends bigint {}
|
|
7
|
+
export interface TransferFee extends bigint {}
|
|
8
|
+
|
|
9
|
+
export interface AccountBalanceArgs {
|
|
10
|
+
account: AccountIdentifier;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AccountBalanceArgsDfx {
|
|
14
|
+
account: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface TransferArgs {
|
|
18
|
+
to: AccountIdentifier;
|
|
19
|
+
fee: TransferFee;
|
|
20
|
+
memo: Memo;
|
|
21
|
+
from_subaccount?: SubAccount;
|
|
22
|
+
created_at_time?: TimeStamp;
|
|
23
|
+
amount: Tokens;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface TransferError {
|
|
27
|
+
BadFee?: { expected_fee: TransferFee };
|
|
28
|
+
BadBurn?: { min_burn_amount: Tokens };
|
|
29
|
+
InsufficientFunds?: { balance: Tokens };
|
|
30
|
+
TooOld?: null;
|
|
31
|
+
CreatedInFuture?: { ledger_time: TimeStamp };
|
|
32
|
+
TemporarilyUnavailable?: null;
|
|
33
|
+
Duplicate?: { duplicate_of: BlockIndex };
|
|
34
|
+
GenericError?: { error_code: number; message: string };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface TransferResult {
|
|
38
|
+
Ok?: BlockIndex;
|
|
39
|
+
Err?: TransferError;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface Block {
|
|
43
|
+
id: BlockIndex;
|
|
44
|
+
parent_hash?: Array<number>;
|
|
45
|
+
timestamp: TimeStamp;
|
|
46
|
+
transaction: {
|
|
47
|
+
Transfer: {
|
|
48
|
+
from: string;
|
|
49
|
+
to: string;
|
|
50
|
+
amount: Tokens;
|
|
51
|
+
fee?: TransferFee;
|
|
52
|
+
memo?: Array<number>;
|
|
53
|
+
created_at_time?: TimeStamp;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ArchiveRange {
|
|
59
|
+
start: BlockIndex;
|
|
60
|
+
length: BlockIndex;
|
|
61
|
+
callback: (args: Array<Block>) => Promise<Array<Block>>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface QueryBlocksArgs {
|
|
65
|
+
start: BlockIndex;
|
|
66
|
+
length: BlockIndex;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface QueryBlocksResponse {
|
|
70
|
+
blocks: Array<Block>;
|
|
71
|
+
archived_blocks: Array<ArchiveRange>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface _SERVICE {
|
|
75
|
+
account_balance: (arg_0: AccountBalanceArgs) => Promise<Tokens>;
|
|
76
|
+
account_balance_dfx: (arg_0: AccountBalanceArgsDfx) => Promise<Tokens>;
|
|
77
|
+
account_transfer: (arg_0: TransferArgs) => Promise<TransferResult>;
|
|
78
|
+
query_blocks: (arg_0: QueryBlocksArgs) => Promise<QueryBlocksResponse>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
82
|
+
export declare const init: (args: { IDL: typeof IDL }) => any[];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export const idlFactory = ({ IDL }) => {
|
|
2
|
+
const AccountIdentifier = IDL.Vec(IDL.Nat8);
|
|
3
|
+
const Tokens = IDL.Nat;
|
|
4
|
+
const BlockIndex = IDL.Nat;
|
|
5
|
+
const Memo = IDL.Nat64;
|
|
6
|
+
const SubAccount = IDL.Vec(IDL.Nat8);
|
|
7
|
+
const TimeStamp = IDL.Nat64;
|
|
8
|
+
const TransferFee = IDL.Nat;
|
|
9
|
+
const AccountBalanceArgs = IDL.Record({
|
|
10
|
+
account: AccountIdentifier,
|
|
11
|
+
});
|
|
12
|
+
const AccountBalanceArgsDfx = IDL.Record({
|
|
13
|
+
account: IDL.Text,
|
|
14
|
+
});
|
|
15
|
+
const TransferArgs = IDL.Record({
|
|
16
|
+
to: AccountIdentifier,
|
|
17
|
+
fee: TransferFee,
|
|
18
|
+
memo: Memo,
|
|
19
|
+
from_subaccount: IDL.Opt(SubAccount),
|
|
20
|
+
created_at_time: IDL.Opt(TimeStamp),
|
|
21
|
+
amount: Tokens,
|
|
22
|
+
});
|
|
23
|
+
const TransferError = IDL.Variant({
|
|
24
|
+
BadFee: IDL.Record({ expected_fee: TransferFee }),
|
|
25
|
+
BadBurn: IDL.Record({ min_burn_amount: Tokens }),
|
|
26
|
+
InsufficientFunds: IDL.Record({ balance: Tokens }),
|
|
27
|
+
TooOld: IDL.Null,
|
|
28
|
+
CreatedInFuture: IDL.Record({ ledger_time: TimeStamp }),
|
|
29
|
+
TemporarilyUnavailable: IDL.Null,
|
|
30
|
+
Duplicate: IDL.Record({ duplicate_of: BlockIndex }),
|
|
31
|
+
GenericError: IDL.Record({ error_code: IDL.Nat, message: IDL.Text }),
|
|
32
|
+
});
|
|
33
|
+
const TransferResult = IDL.Variant({
|
|
34
|
+
Ok: BlockIndex,
|
|
35
|
+
Err: TransferError,
|
|
36
|
+
});
|
|
37
|
+
const Block = IDL.Record({
|
|
38
|
+
id: IDL.Nat,
|
|
39
|
+
parent_hash: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
40
|
+
timestamp: TimeStamp,
|
|
41
|
+
transaction: IDL.Record({
|
|
42
|
+
Transfer: IDL.Record({
|
|
43
|
+
from: IDL.Principal,
|
|
44
|
+
to: IDL.Principal,
|
|
45
|
+
amount: Tokens,
|
|
46
|
+
fee: IDL.Opt(TransferFee),
|
|
47
|
+
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
48
|
+
created_at_time: IDL.Opt(TimeStamp),
|
|
49
|
+
}),
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
const ArchiveRange = IDL.Record({
|
|
53
|
+
start: IDL.Nat,
|
|
54
|
+
length: IDL.Nat,
|
|
55
|
+
callback: IDL.Func([IDL.Vec(Block)], [IDL.Vec(Block)], ['query']),
|
|
56
|
+
});
|
|
57
|
+
return IDL.Service({
|
|
58
|
+
account_balance: IDL.Func([AccountBalanceArgs], [Tokens], ['query']),
|
|
59
|
+
account_balance_dfx: IDL.Func([AccountBalanceArgsDfx], [Tokens], ['query']),
|
|
60
|
+
account_transfer: IDL.Func([TransferArgs], [TransferResult], []),
|
|
61
|
+
query_blocks: IDL.Func([
|
|
62
|
+
IDL.Record({
|
|
63
|
+
start: IDL.Nat,
|
|
64
|
+
length: IDL.Nat,
|
|
65
|
+
}),
|
|
66
|
+
], [
|
|
67
|
+
IDL.Record({
|
|
68
|
+
blocks: IDL.Vec(Block),
|
|
69
|
+
archived_blocks: IDL.Vec(ArchiveRange),
|
|
70
|
+
}),
|
|
71
|
+
], ['query']),
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export const init = ({ IDL }) => {
|
|
75
|
+
return [];
|
|
76
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
type Account = record {
|
|
2
|
+
account_canister_id : nat64;
|
|
3
|
+
platform_fee_percentage : nat16;
|
|
4
|
+
subaccount : opt blob;
|
|
5
|
+
wallet_address : text;
|
|
6
|
+
icp_account_identifier : opt text;
|
|
7
|
+
platform_fee_fixed : opt nat;
|
|
8
|
+
is_active : bool;
|
|
9
|
+
splits : vec SplitRule;
|
|
10
|
+
};
|
|
11
|
+
type AccountRecord = record { account_canister_id : nat64; account : Account };
|
|
12
|
+
type CanisterMetrics = record {
|
|
13
|
+
total_accounts : nat32;
|
|
14
|
+
cycles_balance : nat64;
|
|
15
|
+
controllers : vec principal;
|
|
16
|
+
is_healthy : bool;
|
|
17
|
+
last_update_timestamp : nat64;
|
|
18
|
+
active_accounts : nat32;
|
|
19
|
+
memory_size_bytes : nat64;
|
|
20
|
+
total_transactions : nat32;
|
|
21
|
+
platform_wallet : text;
|
|
22
|
+
};
|
|
23
|
+
type Icrc21ConsentInfo = record {
|
|
24
|
+
metadata : Icrc21ConsentMessageMetadata;
|
|
25
|
+
consent_message : Icrc21ConsentMessage;
|
|
26
|
+
};
|
|
27
|
+
type Icrc21ConsentMessage = variant {
|
|
28
|
+
LineDisplayMessage : record { pages : vec Icrc21Page };
|
|
29
|
+
GenericDisplayMessage : text;
|
|
30
|
+
};
|
|
31
|
+
type Icrc21ConsentMessageMetadata = record {
|
|
32
|
+
utc_offset_minutes : opt int16;
|
|
33
|
+
language : text;
|
|
34
|
+
};
|
|
35
|
+
type Icrc21ConsentMessageRequest = record {
|
|
36
|
+
arg : blob;
|
|
37
|
+
method : text;
|
|
38
|
+
user_preferences : Icrc21ConsentMessageSpec;
|
|
39
|
+
};
|
|
40
|
+
type Icrc21ConsentMessageResponse = variant {
|
|
41
|
+
Ok : Icrc21ConsentInfo;
|
|
42
|
+
Err : Icrc21Error;
|
|
43
|
+
};
|
|
44
|
+
type Icrc21ConsentMessageSpec = record {
|
|
45
|
+
metadata : Icrc21ConsentMessageMetadata;
|
|
46
|
+
device_spec : opt Icrc21DeviceSpec;
|
|
47
|
+
};
|
|
48
|
+
type Icrc21DeviceSpec = variant {
|
|
49
|
+
GenericDisplay;
|
|
50
|
+
LineDisplay : record { characters_per_line : nat16; lines_per_page : nat16 };
|
|
51
|
+
};
|
|
52
|
+
type Icrc21Error = variant {
|
|
53
|
+
GenericError : record { description : text; error_code : nat64 };
|
|
54
|
+
InsufficientPayment : Icrc21ErrorInfo;
|
|
55
|
+
UnsupportedCanisterCall : Icrc21ErrorInfo;
|
|
56
|
+
ConsentMessageUnavailable : Icrc21ErrorInfo;
|
|
57
|
+
};
|
|
58
|
+
type Icrc21ErrorInfo = record { description : text };
|
|
59
|
+
type Icrc21Page = record { lines : vec text };
|
|
60
|
+
type LedgerTransactionNotification = record {
|
|
61
|
+
block_index : nat64;
|
|
62
|
+
ledger_canister_id : text;
|
|
63
|
+
};
|
|
64
|
+
type NotifyResult = record {
|
|
65
|
+
id : text;
|
|
66
|
+
status : TransactionStatus;
|
|
67
|
+
amount : nat;
|
|
68
|
+
};
|
|
69
|
+
type Payout = record {
|
|
70
|
+
id : nat;
|
|
71
|
+
fee : nat;
|
|
72
|
+
status : TransactionStatus;
|
|
73
|
+
account_canister_id : nat64;
|
|
74
|
+
to_principal : text;
|
|
75
|
+
to_subaccount : opt blob;
|
|
76
|
+
from_subaccount : blob;
|
|
77
|
+
icp_account_identifier : opt text;
|
|
78
|
+
timestamp_created : nat64;
|
|
79
|
+
index : opt nat64;
|
|
80
|
+
ledger_canister_id : text;
|
|
81
|
+
timestamp_completed : opt nat64;
|
|
82
|
+
amount : nat;
|
|
83
|
+
status_message : opt text;
|
|
84
|
+
};
|
|
85
|
+
type PublicTxStatus = record { status : TransactionStatus; amount : nat };
|
|
86
|
+
type Refund = record {
|
|
87
|
+
status : TransactionStatus;
|
|
88
|
+
timestamp_platform_to_account : opt nat64;
|
|
89
|
+
account_canister_id : nat64;
|
|
90
|
+
original_tx_id : nat;
|
|
91
|
+
notify_processing : bool;
|
|
92
|
+
timestamp_created : nat64;
|
|
93
|
+
timestamp_to_sender : opt nat64;
|
|
94
|
+
ledger_canister_id : text;
|
|
95
|
+
amount : nat;
|
|
96
|
+
platform_refund_amount : nat;
|
|
97
|
+
index_to_sender : opt nat64;
|
|
98
|
+
index_platform_to_account : opt nat64;
|
|
99
|
+
};
|
|
100
|
+
type Result = variant { Ok; Err : text };
|
|
101
|
+
type Result_1 = variant { Ok : NotifyResult; Err : text };
|
|
102
|
+
type Result_2 = variant { Ok : Payout; Err : text };
|
|
103
|
+
type Result_3 = variant { Ok : nat; Err : text };
|
|
104
|
+
type Result_4 = variant { Ok : text; Err : text };
|
|
105
|
+
type Split = record {
|
|
106
|
+
account_canister_id : nat64;
|
|
107
|
+
index_block : opt nat64;
|
|
108
|
+
timestamp : opt nat64;
|
|
109
|
+
account_percentage : nat16;
|
|
110
|
+
amount : nat;
|
|
111
|
+
};
|
|
112
|
+
type SplitRule = record { account_canister_id : nat64; percentage : nat16 };
|
|
113
|
+
type Transaction = record {
|
|
114
|
+
id : nat;
|
|
115
|
+
status : TransactionStatus;
|
|
116
|
+
account_canister_id : nat64;
|
|
117
|
+
platform_fee_amount : nat;
|
|
118
|
+
transfer_fee : nat;
|
|
119
|
+
memo : opt blob;
|
|
120
|
+
timestamp_to_account : opt nat64;
|
|
121
|
+
notify_processing : bool;
|
|
122
|
+
timestamp : nat64;
|
|
123
|
+
index_received : opt nat64;
|
|
124
|
+
sender_principal_id : text;
|
|
125
|
+
account_amount : nat;
|
|
126
|
+
ledger_canister_id : text;
|
|
127
|
+
splits : vec Split;
|
|
128
|
+
timestamp_received : opt nat64;
|
|
129
|
+
amount : nat;
|
|
130
|
+
};
|
|
131
|
+
type TransactionFilter = record {
|
|
132
|
+
from_timestamp : opt nat64;
|
|
133
|
+
status : opt TransactionStatus;
|
|
134
|
+
account_canister_id : opt nat64;
|
|
135
|
+
from_id : opt nat;
|
|
136
|
+
offset : opt nat32;
|
|
137
|
+
limit : opt nat32;
|
|
138
|
+
to_timestamp : opt nat64;
|
|
139
|
+
ledger_canister_id : opt text;
|
|
140
|
+
};
|
|
141
|
+
type TransactionResult = record {
|
|
142
|
+
transactions : vec Transaction;
|
|
143
|
+
total_count : nat32;
|
|
144
|
+
has_more : bool;
|
|
145
|
+
};
|
|
146
|
+
type TransactionStatus = variant {
|
|
147
|
+
Failed : text;
|
|
148
|
+
Processed;
|
|
149
|
+
Received;
|
|
150
|
+
Completed;
|
|
151
|
+
Pending;
|
|
152
|
+
};
|
|
153
|
+
type WithdrawRequest = record {
|
|
154
|
+
recipient : text;
|
|
155
|
+
ledger_canister_id : text;
|
|
156
|
+
amount : nat;
|
|
157
|
+
};
|
|
158
|
+
service : () -> {
|
|
159
|
+
add_account : (nat64, Account) -> (Result);
|
|
160
|
+
get_account : (nat64) -> (opt Account) query;
|
|
161
|
+
get_account_transactions : (nat64, opt nat32, opt nat32) -> (
|
|
162
|
+
TransactionResult,
|
|
163
|
+
) query;
|
|
164
|
+
get_canister_info : () -> (CanisterMetrics);
|
|
165
|
+
get_controller : () -> (principal) query;
|
|
166
|
+
get_controllers : () -> (vec principal) query;
|
|
167
|
+
get_ledger_transactions : (text, opt nat32, opt nat32) -> (
|
|
168
|
+
TransactionResult,
|
|
169
|
+
) query;
|
|
170
|
+
get_payout : (nat) -> (opt Payout) query;
|
|
171
|
+
get_platform_wallet : () -> (text) query;
|
|
172
|
+
get_refund_by_original_tx_id : (nat) -> (opt Refund) query;
|
|
173
|
+
get_transaction : (nat) -> (opt Transaction) query;
|
|
174
|
+
get_transaction_status_public : (nat64, nat, opt nat64) -> (
|
|
175
|
+
opt PublicTxStatus,
|
|
176
|
+
) query;
|
|
177
|
+
get_transactions : (TransactionFilter) -> (TransactionResult) query;
|
|
178
|
+
icrc21_canister_call_consent_message : (Icrc21ConsentMessageRequest) -> (
|
|
179
|
+
Icrc21ConsentMessageResponse,
|
|
180
|
+
);
|
|
181
|
+
initialize_controllers : () -> (Result);
|
|
182
|
+
list_accounts : () -> (vec AccountRecord) query;
|
|
183
|
+
notify_ledger_transaction : (LedgerTransactionNotification) -> (Result_1);
|
|
184
|
+
remove_account : (nat64) -> (Result);
|
|
185
|
+
request_payout : (nat64, text, nat) -> (Result_2);
|
|
186
|
+
request_refund : (nat) -> (Result_3);
|
|
187
|
+
retry_payout : (nat) -> (Result_2);
|
|
188
|
+
set_controller : (principal) -> (Result);
|
|
189
|
+
set_platform_wallet : (text) -> (Result);
|
|
190
|
+
update_account : (nat64, Account) -> (Result);
|
|
191
|
+
update_controllers : () -> (Result);
|
|
192
|
+
withdraw_funds : (WithdrawRequest) -> (Result_4);
|
|
193
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type { Principal } from '@dfinity/principal';
|
|
2
|
+
import type { ActorMethod } from '@dfinity/agent';
|
|
3
|
+
import type { IDL } from '@dfinity/candid';
|
|
4
|
+
|
|
5
|
+
export interface Account {
|
|
6
|
+
'account_canister_id' : bigint,
|
|
7
|
+
'platform_fee_percentage' : number,
|
|
8
|
+
'subaccount' : [] | [Uint8Array | number[]],
|
|
9
|
+
'wallet_address' : string,
|
|
10
|
+
'icp_account_identifier' : [] | [string],
|
|
11
|
+
'platform_fee_fixed' : [] | [bigint],
|
|
12
|
+
'is_active' : boolean,
|
|
13
|
+
'splits' : Array<SplitRule>,
|
|
14
|
+
}
|
|
15
|
+
export interface AccountRecord {
|
|
16
|
+
'account_canister_id' : bigint,
|
|
17
|
+
'account' : Account,
|
|
18
|
+
}
|
|
19
|
+
export interface CanisterMetrics {
|
|
20
|
+
'total_accounts' : number,
|
|
21
|
+
'cycles_balance' : bigint,
|
|
22
|
+
'controllers' : Array<Principal>,
|
|
23
|
+
'is_healthy' : boolean,
|
|
24
|
+
'last_update_timestamp' : bigint,
|
|
25
|
+
'active_accounts' : number,
|
|
26
|
+
'memory_size_bytes' : bigint,
|
|
27
|
+
'total_transactions' : number,
|
|
28
|
+
'platform_wallet' : string,
|
|
29
|
+
}
|
|
30
|
+
export interface Icrc21ConsentInfo {
|
|
31
|
+
'metadata' : Icrc21ConsentMessageMetadata,
|
|
32
|
+
'consent_message' : Icrc21ConsentMessage,
|
|
33
|
+
}
|
|
34
|
+
export type Icrc21ConsentMessage = {
|
|
35
|
+
'LineDisplayMessage' : { 'pages' : Array<Icrc21Page> }
|
|
36
|
+
} |
|
|
37
|
+
{ 'GenericDisplayMessage' : string };
|
|
38
|
+
export interface Icrc21ConsentMessageMetadata {
|
|
39
|
+
'utc_offset_minutes' : [] | [number],
|
|
40
|
+
'language' : string,
|
|
41
|
+
}
|
|
42
|
+
export interface Icrc21ConsentMessageRequest {
|
|
43
|
+
'arg' : Uint8Array | number[],
|
|
44
|
+
'method' : string,
|
|
45
|
+
'user_preferences' : Icrc21ConsentMessageSpec,
|
|
46
|
+
}
|
|
47
|
+
export type Icrc21ConsentMessageResponse = { 'Ok' : Icrc21ConsentInfo } |
|
|
48
|
+
{ 'Err' : Icrc21Error };
|
|
49
|
+
export interface Icrc21ConsentMessageSpec {
|
|
50
|
+
'metadata' : Icrc21ConsentMessageMetadata,
|
|
51
|
+
'device_spec' : [] | [Icrc21DeviceSpec],
|
|
52
|
+
}
|
|
53
|
+
export type Icrc21DeviceSpec = { 'GenericDisplay' : null } |
|
|
54
|
+
{
|
|
55
|
+
'LineDisplay' : {
|
|
56
|
+
'characters_per_line' : number,
|
|
57
|
+
'lines_per_page' : number,
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export type Icrc21Error = {
|
|
61
|
+
'GenericError' : { 'description' : string, 'error_code' : bigint }
|
|
62
|
+
} |
|
|
63
|
+
{ 'InsufficientPayment' : Icrc21ErrorInfo } |
|
|
64
|
+
{ 'UnsupportedCanisterCall' : Icrc21ErrorInfo } |
|
|
65
|
+
{ 'ConsentMessageUnavailable' : Icrc21ErrorInfo };
|
|
66
|
+
export interface Icrc21ErrorInfo { 'description' : string }
|
|
67
|
+
export interface Icrc21Page { 'lines' : Array<string> }
|
|
68
|
+
export interface LedgerTransactionNotification {
|
|
69
|
+
'block_index' : bigint,
|
|
70
|
+
'ledger_canister_id' : string,
|
|
71
|
+
}
|
|
72
|
+
export interface NotifyResult {
|
|
73
|
+
'id' : string,
|
|
74
|
+
'status' : TransactionStatus,
|
|
75
|
+
'amount' : bigint,
|
|
76
|
+
}
|
|
77
|
+
export interface Payout {
|
|
78
|
+
'id' : bigint,
|
|
79
|
+
'fee' : bigint,
|
|
80
|
+
'status' : TransactionStatus,
|
|
81
|
+
'account_canister_id' : bigint,
|
|
82
|
+
'to_principal' : string,
|
|
83
|
+
'to_subaccount' : [] | [Uint8Array | number[]],
|
|
84
|
+
'from_subaccount' : Uint8Array | number[],
|
|
85
|
+
'icp_account_identifier' : [] | [string],
|
|
86
|
+
'timestamp_created' : bigint,
|
|
87
|
+
'index' : [] | [bigint],
|
|
88
|
+
'ledger_canister_id' : string,
|
|
89
|
+
'timestamp_completed' : [] | [bigint],
|
|
90
|
+
'amount' : bigint,
|
|
91
|
+
'status_message' : [] | [string],
|
|
92
|
+
}
|
|
93
|
+
export interface PublicTxStatus {
|
|
94
|
+
'status' : TransactionStatus,
|
|
95
|
+
'amount' : bigint,
|
|
96
|
+
}
|
|
97
|
+
export interface Refund {
|
|
98
|
+
'status' : TransactionStatus,
|
|
99
|
+
'timestamp_platform_to_account' : [] | [bigint],
|
|
100
|
+
'account_canister_id' : bigint,
|
|
101
|
+
'original_tx_id' : bigint,
|
|
102
|
+
'notify_processing' : boolean,
|
|
103
|
+
'timestamp_created' : bigint,
|
|
104
|
+
'timestamp_to_sender' : [] | [bigint],
|
|
105
|
+
'ledger_canister_id' : string,
|
|
106
|
+
'amount' : bigint,
|
|
107
|
+
'platform_refund_amount' : bigint,
|
|
108
|
+
'index_to_sender' : [] | [bigint],
|
|
109
|
+
'index_platform_to_account' : [] | [bigint],
|
|
110
|
+
}
|
|
111
|
+
export type Result = { 'Ok' : null } |
|
|
112
|
+
{ 'Err' : string };
|
|
113
|
+
export type Result_1 = { 'Ok' : NotifyResult } |
|
|
114
|
+
{ 'Err' : string };
|
|
115
|
+
export type Result_2 = { 'Ok' : Payout } |
|
|
116
|
+
{ 'Err' : string };
|
|
117
|
+
export type Result_3 = { 'Ok' : bigint } |
|
|
118
|
+
{ 'Err' : string };
|
|
119
|
+
export type Result_4 = { 'Ok' : string } |
|
|
120
|
+
{ 'Err' : string };
|
|
121
|
+
export interface Split {
|
|
122
|
+
'account_canister_id' : bigint,
|
|
123
|
+
'index_block' : [] | [bigint],
|
|
124
|
+
'timestamp' : [] | [bigint],
|
|
125
|
+
'account_percentage' : number,
|
|
126
|
+
'amount' : bigint,
|
|
127
|
+
}
|
|
128
|
+
export interface SplitRule {
|
|
129
|
+
'account_canister_id' : bigint,
|
|
130
|
+
'percentage' : number,
|
|
131
|
+
}
|
|
132
|
+
export interface Transaction {
|
|
133
|
+
'id' : bigint,
|
|
134
|
+
'status' : TransactionStatus,
|
|
135
|
+
'account_canister_id' : bigint,
|
|
136
|
+
'platform_fee_amount' : bigint,
|
|
137
|
+
'transfer_fee' : bigint,
|
|
138
|
+
'memo' : [] | [Uint8Array | number[]],
|
|
139
|
+
'timestamp_to_account' : [] | [bigint],
|
|
140
|
+
'notify_processing' : boolean,
|
|
141
|
+
'timestamp' : bigint,
|
|
142
|
+
'index_received' : [] | [bigint],
|
|
143
|
+
'sender_principal_id' : string,
|
|
144
|
+
'account_amount' : bigint,
|
|
145
|
+
'ledger_canister_id' : string,
|
|
146
|
+
'splits' : Array<Split>,
|
|
147
|
+
'timestamp_received' : [] | [bigint],
|
|
148
|
+
'amount' : bigint,
|
|
149
|
+
}
|
|
150
|
+
export interface TransactionFilter {
|
|
151
|
+
'from_timestamp' : [] | [bigint],
|
|
152
|
+
'status' : [] | [TransactionStatus],
|
|
153
|
+
'account_canister_id' : [] | [bigint],
|
|
154
|
+
'from_id' : [] | [bigint],
|
|
155
|
+
'offset' : [] | [number],
|
|
156
|
+
'limit' : [] | [number],
|
|
157
|
+
'to_timestamp' : [] | [bigint],
|
|
158
|
+
'ledger_canister_id' : [] | [string],
|
|
159
|
+
}
|
|
160
|
+
export interface TransactionResult {
|
|
161
|
+
'transactions' : Array<Transaction>,
|
|
162
|
+
'total_count' : number,
|
|
163
|
+
'has_more' : boolean,
|
|
164
|
+
}
|
|
165
|
+
export type TransactionStatus = { 'Failed' : string } |
|
|
166
|
+
{ 'Processed' : null } |
|
|
167
|
+
{ 'Received' : null } |
|
|
168
|
+
{ 'Completed' : null } |
|
|
169
|
+
{ 'Pending' : null };
|
|
170
|
+
export interface WithdrawRequest {
|
|
171
|
+
'recipient' : string,
|
|
172
|
+
'ledger_canister_id' : string,
|
|
173
|
+
'amount' : bigint,
|
|
174
|
+
}
|
|
175
|
+
export interface _SERVICE {
|
|
176
|
+
'add_account' : ActorMethod<[bigint, Account], Result>,
|
|
177
|
+
'get_account' : ActorMethod<[bigint], [] | [Account]>,
|
|
178
|
+
'get_account_transactions' : ActorMethod<
|
|
179
|
+
[bigint, [] | [number], [] | [number]],
|
|
180
|
+
TransactionResult
|
|
181
|
+
>,
|
|
182
|
+
'get_canister_info' : ActorMethod<[], CanisterMetrics>,
|
|
183
|
+
'get_controller' : ActorMethod<[], Principal>,
|
|
184
|
+
'get_controllers' : ActorMethod<[], Array<Principal>>,
|
|
185
|
+
'get_ledger_transactions' : ActorMethod<
|
|
186
|
+
[string, [] | [number], [] | [number]],
|
|
187
|
+
TransactionResult
|
|
188
|
+
>,
|
|
189
|
+
'get_payout' : ActorMethod<[bigint], [] | [Payout]>,
|
|
190
|
+
'get_platform_wallet' : ActorMethod<[], string>,
|
|
191
|
+
'get_refund_by_original_tx_id' : ActorMethod<[bigint], [] | [Refund]>,
|
|
192
|
+
'get_transaction' : ActorMethod<[bigint], [] | [Transaction]>,
|
|
193
|
+
'get_transaction_status_public' : ActorMethod<
|
|
194
|
+
[bigint, bigint, [] | [bigint]],
|
|
195
|
+
[] | [PublicTxStatus]
|
|
196
|
+
>,
|
|
197
|
+
'get_transactions' : ActorMethod<[TransactionFilter], TransactionResult>,
|
|
198
|
+
'icrc21_canister_call_consent_message' : ActorMethod<
|
|
199
|
+
[Icrc21ConsentMessageRequest],
|
|
200
|
+
Icrc21ConsentMessageResponse
|
|
201
|
+
>,
|
|
202
|
+
'initialize_controllers' : ActorMethod<[], Result>,
|
|
203
|
+
'list_accounts' : ActorMethod<[], Array<AccountRecord>>,
|
|
204
|
+
'notify_ledger_transaction' : ActorMethod<
|
|
205
|
+
[LedgerTransactionNotification],
|
|
206
|
+
Result_1
|
|
207
|
+
>,
|
|
208
|
+
'remove_account' : ActorMethod<[bigint], Result>,
|
|
209
|
+
'request_payout' : ActorMethod<[bigint, string, bigint], Result_2>,
|
|
210
|
+
'request_refund' : ActorMethod<[bigint], Result_3>,
|
|
211
|
+
'retry_payout' : ActorMethod<[bigint], Result_2>,
|
|
212
|
+
'set_controller' : ActorMethod<[Principal], Result>,
|
|
213
|
+
'set_platform_wallet' : ActorMethod<[string], Result>,
|
|
214
|
+
'update_account' : ActorMethod<[bigint, Account], Result>,
|
|
215
|
+
'update_controllers' : ActorMethod<[], Result>,
|
|
216
|
+
'withdraw_funds' : ActorMethod<[WithdrawRequest], Result_4>,
|
|
217
|
+
}
|
|
218
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
219
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|