Skip to content

Commit

Permalink
build: ICP index canister did files
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Nov 6, 2023
1 parent 014e017 commit b477a58
Show file tree
Hide file tree
Showing 7 changed files with 422 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/ledger-icp/candid/index.certified.idl.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { IDL } from "@dfinity/candid";
export const idlFactory: IDL.InterfaceFactory;
108 changes: 108 additions & 0 deletions packages/ledger-icp/candid/index.certified.idl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ledger-icp/candid/index.did */
export const idlFactory = ({ IDL }) => {
const InitArg = IDL.Record({ 'ledger_id' : IDL.Principal });
const GetAccountIdentifierTransactionsArgs = IDL.Record({
'max_results' : IDL.Nat64,
'start' : IDL.Opt(IDL.Nat64),
'account_identifier' : IDL.Text,
});
const Tokens = IDL.Record({ 'e8s' : IDL.Nat64 });
const TimeStamp = IDL.Record({ 'timestamp_nanos' : IDL.Nat64 });
const Operation = IDL.Variant({
'Approve' : IDL.Record({
'fee' : Tokens,
'from' : IDL.Text,
'allowance' : Tokens,
'expires_at' : IDL.Opt(TimeStamp),
'spender' : IDL.Text,
}),
'Burn' : IDL.Record({ 'from' : IDL.Text, 'amount' : Tokens }),
'Mint' : IDL.Record({ 'to' : IDL.Text, 'amount' : Tokens }),
'Transfer' : IDL.Record({
'to' : IDL.Text,
'fee' : Tokens,
'from' : IDL.Text,
'amount' : Tokens,
}),
'TransferFrom' : IDL.Record({
'to' : IDL.Text,
'fee' : Tokens,
'from' : IDL.Text,
'amount' : Tokens,
'spender' : IDL.Text,
}),
});
const Transaction = IDL.Record({
'memo' : IDL.Nat64,
'icrc1_memo' : IDL.Opt(IDL.Vec(IDL.Nat8)),
'operation' : Operation,
'created_at_time' : IDL.Opt(TimeStamp),
});
const TransactionWithId = IDL.Record({
'id' : IDL.Nat64,
'transaction' : Transaction,
});
const GetAccountIdentifierTransactionsResponse = IDL.Record({
'balance' : IDL.Nat64,
'transactions' : IDL.Vec(TransactionWithId),
'oldest_tx_id' : IDL.Opt(IDL.Nat64),
});
const GetAccountIdentifierTransactionsError = IDL.Record({
'message' : IDL.Text,
});
const GetAccountIdentifierTransactionsResult = IDL.Variant({
'Ok' : GetAccountIdentifierTransactionsResponse,
'Err' : GetAccountIdentifierTransactionsError,
});
const Account = IDL.Record({
'owner' : IDL.Principal,
'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)),
});
const GetAccountTransactionsArgs = IDL.Record({
'max_results' : IDL.Nat,
'start' : IDL.Opt(IDL.Nat),
'account' : Account,
});
const GetBlocksRequest = IDL.Record({
'start' : IDL.Nat,
'length' : IDL.Nat,
});
const GetBlocksResponse = IDL.Record({
'blocks' : IDL.Vec(IDL.Vec(IDL.Nat8)),
'chain_length' : IDL.Nat64,
});
const HttpRequest = IDL.Record({
'url' : IDL.Text,
'method' : IDL.Text,
'body' : IDL.Vec(IDL.Nat8),
'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
});
const HttpResponse = IDL.Record({
'body' : IDL.Vec(IDL.Nat8),
'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
'status_code' : IDL.Nat16,
});
const Status = IDL.Record({ 'num_blocks_synced' : IDL.Nat64 });
return IDL.Service({
'get_account_identifier_balance' : IDL.Func([IDL.Text], [IDL.Nat64], []),
'get_account_identifier_transactions' : IDL.Func(
[GetAccountIdentifierTransactionsArgs],
[GetAccountIdentifierTransactionsResult],
[],
),
'get_account_transactions' : IDL.Func(
[GetAccountTransactionsArgs],
[GetAccountIdentifierTransactionsResult],
[],
),
'get_blocks' : IDL.Func([GetBlocksRequest], [GetBlocksResponse], []),
'http_request' : IDL.Func([HttpRequest], [HttpResponse], []),
'icrc1_balance_of' : IDL.Func([Account], [IDL.Nat64], []),
'ledger_id' : IDL.Func([], [IDL.Principal], []),
'status' : IDL.Func([], [Status], []),
});
};
export const init = ({ IDL }) => {
const InitArg = IDL.Record({ 'ledger_id' : IDL.Principal });
return [InitArg];
};
116 changes: 116 additions & 0 deletions packages/ledger-icp/candid/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import type { ActorMethod } from "@dfinity/agent";
import type { Principal } from "@dfinity/principal";

export interface Account {
owner: Principal;
subaccount: [] | [Uint8Array];
}
export interface GetAccountIdentifierTransactionsArgs {
max_results: bigint;
start: [] | [bigint];
account_identifier: string;
}
export interface GetAccountIdentifierTransactionsError {
message: string;
}
export interface GetAccountIdentifierTransactionsResponse {
balance: bigint;
transactions: Array<TransactionWithId>;
oldest_tx_id: [] | [bigint];
}
export type GetAccountIdentifierTransactionsResult =
| {
Ok: GetAccountIdentifierTransactionsResponse;
}
| { Err: GetAccountIdentifierTransactionsError };
export interface GetAccountTransactionsArgs {
max_results: bigint;
start: [] | [bigint];
account: Account;
}
export interface GetBlocksRequest {
start: bigint;
length: bigint;
}
export interface GetBlocksResponse {
blocks: Array<Uint8Array>;
chain_length: bigint;
}
export interface HttpRequest {
url: string;
method: string;
body: Uint8Array;
headers: Array<[string, string]>;
}
export interface HttpResponse {
body: Uint8Array;
headers: Array<[string, string]>;
status_code: number;
}
export interface InitArg {
ledger_id: Principal;
}
export type Operation =
| {
Approve: {
fee: Tokens;
from: string;
allowance: Tokens;
expires_at: [] | [TimeStamp];
spender: string;
};
}
| { Burn: { from: string; amount: Tokens } }
| { Mint: { to: string; amount: Tokens } }
| {
Transfer: {
to: string;
fee: Tokens;
from: string;
amount: Tokens;
};
}
| {
TransferFrom: {
to: string;
fee: Tokens;
from: string;
amount: Tokens;
spender: string;
};
};
export interface Status {
num_blocks_synced: bigint;
}
export interface TimeStamp {
timestamp_nanos: bigint;
}
export interface Tokens {
e8s: bigint;
}
export interface Transaction {
memo: bigint;
icrc1_memo: [] | [Uint8Array];
operation: Operation;
created_at_time: [] | [TimeStamp];
}
export interface TransactionWithId {
id: bigint;
transaction: Transaction;
}
export interface _SERVICE {
get_account_identifier_balance: ActorMethod<[string], bigint>;
get_account_identifier_transactions: ActorMethod<
[GetAccountIdentifierTransactionsArgs],
GetAccountIdentifierTransactionsResult
>;
get_account_transactions: ActorMethod<
[GetAccountTransactionsArgs],
GetAccountIdentifierTransactionsResult
>;
get_blocks: ActorMethod<[GetBlocksRequest], GetBlocksResponse>;
http_request: ActorMethod<[HttpRequest], HttpResponse>;
icrc1_balance_of: ActorMethod<[Account], bigint>;
ledger_id: ActorMethod<[], Principal>;
status: ActorMethod<[], Status>;
}
81 changes: 81 additions & 0 deletions packages/ledger-icp/candid/index.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Generated from IC repo commit b501a71346fa465cb5d7817c895295150979c180 'rs/rosetta-api/icp_ledger/index/index.did' by import-candid
type Account = record { owner : principal; subaccount : opt vec nat8 };
type GetAccountIdentifierTransactionsArgs = record {
max_results : nat64;
start : opt nat64;
account_identifier : text;
};
type GetAccountTransactionsArgs = record {
account : Account;
// The txid of the last transaction seen by the client.
// If None then the results will start from the most recent
// txid.
start : opt nat;
// Maximum number of transactions to fetch.
max_results : nat;
};
type GetAccountIdentifierTransactionsError = record { message : text };
type GetAccountIdentifierTransactionsResponse = record {
balance : nat64;
transactions : vec TransactionWithId;
oldest_tx_id : opt nat64;
};
type GetBlocksRequest = record { start : nat; length : nat };
type GetBlocksResponse = record { blocks : vec vec nat8; chain_length : nat64 };
type HttpRequest = record {
url : text;
method : text;
body : vec nat8;
headers : vec record { text; text };
};
type HttpResponse = record {
body : vec nat8;
headers : vec record { text; text };
status_code : nat16;
};
type InitArg = record { ledger_id : principal };
type Operation = variant {
Approve : record {
fee : Tokens;
from : text;
allowance : Tokens;
expires_at : opt TimeStamp;
spender : text;
};
Burn : record { from : text; amount : Tokens };
Mint : record { to : text; amount : Tokens };
Transfer : record { to : text; fee : Tokens; from : text; amount : Tokens };
TransferFrom : record {
to : text;
fee : Tokens;
from : text;
amount : Tokens;
spender : text;
};
};
type GetAccountIdentifierTransactionsResult = variant {
Ok : GetAccountIdentifierTransactionsResponse;
Err : GetAccountIdentifierTransactionsError;
};
type Status = record { num_blocks_synced : nat64 };
type TimeStamp = record { timestamp_nanos : nat64 };
type Tokens = record { e8s : nat64 };
type Transaction = record {
memo : nat64;
icrc1_memo : opt vec nat8;
operation : Operation;
created_at_time : opt TimeStamp;
};
type TransactionWithId = record { id : nat64; transaction : Transaction };
service : (InitArg) -> {
get_account_identifier_balance : (text) -> (nat64) query;
get_account_identifier_transactions : (
GetAccountIdentifierTransactionsArgs,
) -> (GetAccountIdentifierTransactionsResult) query;
get_account_transactions : (GetAccountTransactionsArgs) -> (GetAccountIdentifierTransactionsResult) query;
get_blocks : (GetBlocksRequest) -> (GetBlocksResponse) query;
http_request : (HttpRequest) -> (HttpResponse) query;
ledger_id : () -> (principal) query;
status : () -> (Status) query;
icrc1_balance_of : (Account) -> (nat64) query;
}
2 changes: 2 additions & 0 deletions packages/ledger-icp/candid/index.idl.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { IDL } from "@dfinity/candid";
export const idlFactory: IDL.InterfaceFactory;
Loading

0 comments on commit b477a58

Please sign in to comment.