-
Notifications
You must be signed in to change notification settings - Fork 0
/
ledger.private.did
103 lines (89 loc) · 2.51 KB
/
ledger.private.did
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
type Tokens = record {
e8s : nat64;
};
type Duration = record {
secs: nat64;
nanos: nat32;
};
// Number of nanoseconds from the UNIX epoch in UTC timezone.
type TimeStamp = record {
timestamp_nanos: nat64;
};
type ArchiveOptions = record {
trigger_threshold : nat64;
num_blocks_to_archive : nat64;
node_max_memory_size_bytes: opt nat64;
max_message_size_bytes: opt nat64;
controller_id: principal;
cycles_for_archive_creation: opt nat64;
};
// Height of a ledger block.
type BlockHeight = nat64;
// A number associated with a transaction.
// Can be set by the caller in `send` call as a correlation identifier.
type Memo = nat64;
// Account identifier encoded as a 64-byte ASCII hex string.
type AccountIdentifier = text;
// Subaccount is an arbitrary 32-byte byte array.
type SubAccount = blob;
type Transfer = variant {
Burn: record {
from: AccountIdentifier;
amount: Tokens;
};
Mint: record {
to: AccountIdentifier;
amount: Tokens;
};
Send: record {
from: AccountIdentifier;
to: AccountIdentifier;
amount: Tokens;
};
};
type Transaction = record {
transfer: Transfer;
memo: Memo;
created_at: BlockHeight;
};
// Arguments for the `send_dfx` call.
type SendArgs = record {
memo: Memo;
amount: Tokens;
fee: Tokens;
from_subaccount: opt SubAccount;
to: AccountIdentifier;
created_at_time: opt TimeStamp;
};
// Arguments for the `notify` call.
type NotifyCanisterArgs = record {
// The of the block to send a notification about.
block_height: BlockHeight;
// Max fee, should be 10000 e8s.
max_fee: Tokens;
// Subaccount the payment came from.
from_subaccount: opt SubAccount;
// Canister that received the payment.
to_canister: principal;
// Subaccount that received the payment.
to_subaccount: opt SubAccount;
};
type AccountBalanceArgs = record {
account: AccountIdentifier;
};
type LedgerCanisterInitPayload = record {
minting_account: AccountIdentifier;
initial_values: vec record {AccountIdentifier; Tokens};
max_message_size_bytes: opt nat64;
transaction_window: opt Duration;
archive_options: opt ArchiveOptions;
send_whitelist: vec principal;
transfer_fee: opt Tokens;
token_symbol: opt text;
token_name: opt text;
};
service: (LedgerCanisterInitPayload) -> {
send_dfx : (SendArgs) -> (BlockHeight);
notify_dfx: (NotifyCanisterArgs) -> ();
account_balance_dfx : (AccountBalanceArgs) -> (Tokens) query;
}