Skip to content

Commit

Permalink
chore: release v2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Dec 3, 2024
1 parent 3fb6b52 commit d896b8d
Show file tree
Hide file tree
Showing 35 changed files with 4,363 additions and 96 deletions.
191 changes: 96 additions & 95 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ opt-level = 's'

[workspace.package]
edition = "2021"
version = "2.6.5"
version = "2.8.0"
repository = "https://github.com/ldclabs/ic-panda"
keywords = ["canister", "icp", "panda"]
categories = ["web-programming"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
type Tokens = nat;

type InitArg = record {
ledger_id: principal;
// The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
// responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
// A higher values means that it takes longer for new blocks to show up in the index.
retrieve_blocks_from_ledger_interval_seconds : opt nat64;
};

type UpgradeArg = record {
ledger_id: opt principal;
// The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
// responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
// A higher values means that it takes longer for new blocks to show up in the index.
retrieve_blocks_from_ledger_interval_seconds : opt nat64;
};

type IndexArg = variant {
Init: InitArg;
Upgrade: UpgradeArg;
};

type GetBlocksRequest = record {
start : nat;
length : nat;
};

type Value = variant {
Blob : blob;
Text : text;
Nat : nat;
Nat64: nat64;
Int : int;
Array : vec Value;
Map : Map;
};

type Map = vec record { text; Value };

type Block = Value;

type GetBlocksResponse = record {
chain_length: nat64;
blocks: vec Block;
};

type BlockIndex = nat;

type SubAccount = blob;

type Account = record { owner : principal; subaccount : opt SubAccount };

type Transaction = record {
burn : opt Burn;
kind : text;
mint : opt Mint;
approve : opt Approve;
timestamp : nat64;
transfer : opt Transfer;
};

type Approve = record {
fee : opt nat;
from : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
expected_allowance : opt nat;
expires_at : opt nat64;
spender : Account;
};

type Burn = record {
from : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
spender : opt Account;
};

type Mint = record {
to : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
};

type Transfer = record {
to : Account;
fee : opt nat;
from : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
spender : opt Account;
};

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. If set then the results will start from the next
// most recent txid after start (start won't be included).
start : opt BlockIndex;
// Maximum number of transactions to fetch.
max_results : nat;
};

type TransactionWithId = record {
id : BlockIndex;
transaction : Transaction;
};

type GetTransactions = record {
balance : Tokens;
transactions : vec TransactionWithId;
// The txid of the oldest transaction the account has
oldest_tx_id : opt BlockIndex;
};

type GetTransactionsErr = record {
message : text;
};

type GetTransactionsResult = variant {
Ok : GetTransactions;
Err : GetTransactionsErr;
};

type ListSubaccountsArgs = record {
owner: principal;
start: opt SubAccount;
};

type Status = record {
num_blocks_synced : BlockIndex;
};

type FeeCollectorRanges = record {
ranges : vec record { Account; vec record { BlockIndex; BlockIndex } };
}

service : (index_arg: opt IndexArg) -> {
get_account_transactions : (GetAccountTransactionsArgs) -> (GetTransactionsResult) query;
get_blocks : (GetBlocksRequest) -> (GetBlocksResponse) query;
get_fee_collectors_ranges : () -> (FeeCollectorRanges) query;
icrc1_balance_of : (Account) -> (Tokens) query;
ledger_id : () -> (principal) query;
list_subaccounts : (ListSubaccountsArgs) -> (vec SubAccount) query;
status : () -> (Status) query;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import type { Principal } from '@dfinity/principal';
import type { ActorMethod } from '@dfinity/agent';
import type { IDL } from '@dfinity/candid';

export interface Account {
'owner' : Principal,
'subaccount' : [] | [SubAccount],
}
export interface Approve {
'fee' : [] | [bigint],
'from' : Account,
'memo' : [] | [Uint8Array | number[]],
'created_at_time' : [] | [bigint],
'amount' : bigint,
'expected_allowance' : [] | [bigint],
'expires_at' : [] | [bigint],
'spender' : Account,
}
export type Block = Value;
export type BlockIndex = bigint;
export interface Burn {
'from' : Account,
'memo' : [] | [Uint8Array | number[]],
'created_at_time' : [] | [bigint],
'amount' : bigint,
'spender' : [] | [Account],
}
export interface FeeCollectorRanges {
'ranges' : Array<[Account, Array<[BlockIndex, BlockIndex]>]>,
}
export interface GetAccountTransactionsArgs {
'max_results' : bigint,
'start' : [] | [BlockIndex],
'account' : Account,
}
export interface GetBlocksRequest { 'start' : bigint, 'length' : bigint }
export interface GetBlocksResponse {
'blocks' : Array<Block>,
'chain_length' : bigint,
}
export interface GetTransactions {
'balance' : Tokens,
'transactions' : Array<TransactionWithId>,
'oldest_tx_id' : [] | [BlockIndex],
}
export interface GetTransactionsErr { 'message' : string }
export type GetTransactionsResult = { 'Ok' : GetTransactions } |
{ 'Err' : GetTransactionsErr };
export type IndexArg = { 'Upgrade' : UpgradeArg } |
{ 'Init' : InitArg };
export interface InitArg {
'ledger_id' : Principal,
'retrieve_blocks_from_ledger_interval_seconds' : [] | [bigint],
}
export interface ListSubaccountsArgs {
'owner' : Principal,
'start' : [] | [SubAccount],
}
export type Map = Array<[string, Value]>;
export interface Mint {
'to' : Account,
'memo' : [] | [Uint8Array | number[]],
'created_at_time' : [] | [bigint],
'amount' : bigint,
}
export interface Status { 'num_blocks_synced' : BlockIndex }
export type SubAccount = Uint8Array | number[];
export type Tokens = bigint;
export interface Transaction {
'burn' : [] | [Burn],
'kind' : string,
'mint' : [] | [Mint],
'approve' : [] | [Approve],
'timestamp' : bigint,
'transfer' : [] | [Transfer],
}
export interface TransactionWithId {
'id' : BlockIndex,
'transaction' : Transaction,
}
export interface Transfer {
'to' : Account,
'fee' : [] | [bigint],
'from' : Account,
'memo' : [] | [Uint8Array | number[]],
'created_at_time' : [] | [bigint],
'amount' : bigint,
'spender' : [] | [Account],
}
export interface UpgradeArg {
'ledger_id' : [] | [Principal],
'retrieve_blocks_from_ledger_interval_seconds' : [] | [bigint],
}
export type Value = { 'Int' : bigint } |
{ 'Map' : Map } |
{ 'Nat' : bigint } |
{ 'Nat64' : bigint } |
{ 'Blob' : Uint8Array | number[] } |
{ 'Text' : string } |
{ 'Array' : Array<Value> };
export interface _SERVICE {
'get_account_transactions' : ActorMethod<
[GetAccountTransactionsArgs],
GetTransactionsResult
>,
'get_blocks' : ActorMethod<[GetBlocksRequest], GetBlocksResponse>,
'get_fee_collectors_ranges' : ActorMethod<[], FeeCollectorRanges>,
'icrc1_balance_of' : ActorMethod<[Account], Tokens>,
'ledger_id' : ActorMethod<[], Principal>,
'list_subaccounts' : ActorMethod<[ListSubaccountsArgs], Array<SubAccount>>,
'status' : ActorMethod<[], Status>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
Loading

0 comments on commit d896b8d

Please sign in to comment.