Skip to content

Instantly share code, notes, and snippets.

@dpori
Created November 1, 2021 16:47
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpori/380177f111899bfda59e0f17f620bdc5 to your computer and use it in GitHub Desktop.
Save dpori/380177f111899bfda59e0f17f620bdc5 to your computer and use it in GitHub Desktop.
OGY Ledger Candid Interface
type AccountBalanceArgs = record {
account: AccountIdentifier;
};
type AccountIdentifier = text;
type ArchiveOptions = record {
node_max_memory_size_bytes: opt nat32;
max_message_size_bytes: opt nat32;
controller_id: principal;
trigger_threshold: nat64;
num_blocks_to_archive: nat64;
};
type CanisterId = principal;
type BlockHeight = nat64;
type Duration = record {
secs: nat64;
nanos: nat32;
};
type ICPTs = record {
e8s : nat64;
};
type LedgerCanisterInitPayload = record {
minting_account: AccountIdentifier;
initial_values: vec record {AccountIdentifier; ICPTs};
max_message_size_bytes: opt nat32;
transaction_window: opt Duration;
archive_options: opt ArchiveOptions;
send_whitelist: vec record {principal};
};
type Memo = nat64;
type NotifyCanisterArgs = record {
block_height: BlockHeight;
max_fee: ICPTs;
from_subaccount: opt SubAccount;
to_canister: principal;
to_subaccount: opt SubAccount;
};
type SendArgs = record {
memo: Memo;
amount: ICPTs;
fee: ICPTs;
from_subaccount: opt SubAccount;
to: AccountIdentifier;
created_at_time: opt TimeStamp;
};
type SubAccount = vec nat8;
type TimeStamp = record {
timestamp_nanos: nat64;
};
type Transaction = record {
transfer: Transfer;
memo: Memo;
created_at: BlockHeight;
};
type Transfer = variant {
Burn: record {
from: AccountIdentifier;
amount: ICPTs;
};
Mint: record {
to: AccountIdentifier;
amount: ICPTs;
};
Send: record {
from: AccountIdentifier;
to: AccountIdentifier;
amount: ICPTs;
};
};
type HeaderField = record {text; text};
type HttpRequest = record {
url: text;
method: text;
body: vec nat8;
headers: vec HeaderField;
};
type HttpResponse = record {
body: vec nat8;
headers: vec HeaderField;
status_code: nat16;
};
type TipOfChainRes = record {
certification: opt vec nat8;
tip_index: BlockHeight;
};
type Block = record {
parent_hash: Hash;
timestamp: TimeStamp;
transaction: Transaction;
};
type Hash = opt record {
inner: blob;
};
type BlockArg = BlockHeight;
type BlockRes = opt variant {
Ok: opt variant {
Ok: Block;
Err: CanisterId;
};
Err: text;
};
service: (LedgerCanisterInitPayload) -> {
send_dfx : (SendArgs) -> (BlockHeight);
notify_dfx: (NotifyCanisterArgs) -> ();
account_balance_dfx : (AccountBalanceArgs) -> (ICPTs) query;
get_nodes : () -> (vec CanisterId) query;
http_request: (HttpRequest) -> (HttpResponse) query;
total_supply_dfx : (record {}) -> (ICPTs) query;
tip_of_chain_dfx : (record {}) -> (TipOfChainRes) query;
block_dfx : (BlockArg) -> (BlockRes) query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment