Skip to content

Commit

Permalink
Pull latest icp canister versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz committed Apr 30, 2024
1 parent 49b1fdd commit fe9549d
Show file tree
Hide file tree
Showing 7 changed files with 306 additions and 162 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ build: node_modules
.PHONY: install
.SILENT: install
install: build
dfx canister install identity --mode reinstall --yes
dfx canister install identity --argument '(null)' --mode reinstall --yes
$(shell make/install_ledger.sh)
$(shell make/install_ledger_index.sh)
dfx canister install github --mode reinstall --yes
Expand All @@ -31,16 +31,18 @@ install: build
.PHONY: upgrade
.SILENT: upgrade
upgrade: build
dfx canister install identity --mode=upgrade
dfx canister install identity --argument '(null)' --mode=upgrade
dfx canister install icrc1_ledger --mode=upgrade
dfx canister install icrc1_index --mode=upgrade
dfx canister install icrc1_index --argument '(null)' --mode=upgrade
dfx canister install github --mode=upgrade
dfx canister install bounty --mode=upgrade

.PHONY: clean
.SILENT: clean
clean:
rm -fr .dfx
rm -fr node_modules
rm -fr target

# tests
.PHONY: test-1
Expand Down
Binary file modified icp/icrc1/index/ic-icrc1-index.wasm.gz
Binary file not shown.
149 changes: 102 additions & 47 deletions icp/icrc1/index/index.did
Original file line number Diff line number Diff line change
@@ -1,65 +1,113 @@
type TxId = nat;
type Tokens = nat;

type Account = record { owner : principal; subaccount : opt blob };
type InitArg = record {
ledger_id: principal;
};

type UpgradeArg = record {
ledger_id: opt principal;
};

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 {
kind : text;
mint : opt record {
amount : nat;
to : Account;
memo : opt blob;
created_at_time : opt nat64;
};
burn : opt record {
amount : nat;
from : Account;
spender : opt Account;
memo : opt blob;
created_at_time : opt nat64;
};
transfer : opt record {
amount : nat;
from : Account;
to : Account;
spender : opt Account;
memo : opt blob;
created_at_time : opt nat64;
fee : opt nat;
};
approve : opt record {
amount : nat;
from : Account;
spender : opt Account;
expected_allowance : opt nat;
expires_at : opt nat64;
memo : opt blob;
created_at_time : opt nat64;
fee : opt nat;
};
timestamp : nat64;
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.
start : opt TxId;
start : opt BlockIndex;
// Maximum number of transactions to fetch.
max_results : nat;
};

type TransactionWithId = record {
id : TxId;
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 TxId;
oldest_tx_id : opt BlockIndex;
};

type GetTransactionsErr = record {
Expand All @@ -76,13 +124,20 @@ type ListSubaccountsArgs = record {
start: opt SubAccount;
};

// The initialization parameters of the Index canister.
type InitArgs = record {
ledger_id : principal;
type Status = record {
num_blocks_synced : BlockIndex;
};

service : (InitArgs) -> {
get_account_transactions : (GetAccountTransactionsArgs) -> (GetTransactionsResult);
ledger_id : () -> (principal) query;
list_subaccounts : (ListSubaccountsArgs) -> (vec SubAccount) query;
}
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;
}
Binary file modified icp/icrc1/ledger/ic-icrc1-ledger.wasm.gz
Binary file not shown.
Loading

0 comments on commit fe9549d

Please sign in to comment.