Skip to content

Commit

Permalink
crud methods and retrieve methods
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmasken committed Jan 28, 2024
1 parent d800324 commit 81493a3
Show file tree
Hide file tree
Showing 123 changed files with 1,483 additions and 1,139 deletions.
8 changes: 4 additions & 4 deletions .dfx/local/canister_ids.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"__Candid_UI": {
"local": "bd3sg-teaaa-aaaaa-qaaba-cai"
"local": "be2us-64aaa-aaaaa-qaabq-cai"
},
"assets": {
"local": "br5f7-7uaaa-aaaaa-qaaca-cai"
"local": "bw4dl-smaaa-aaaaa-qaacq-cai"
},
"backend": {
"local": "bw4dl-smaaa-aaaaa-qaacq-cai"
"local": "bd3sg-teaaa-aaaaa-qaaba-cai"
},
"ckbtc_ledger": {
"local": "bkyz2-fmaaa-aaaaa-qaaaq-cai"
},
"icrc1_index": {
"local": "be2us-64aaa-aaaaa-qaabq-cai"
"local": "br5f7-7uaaa-aaaaa-qaaca-cai"
}
}
53 changes: 32 additions & 21 deletions .dfx/local/canisters/backend/backend.did
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type User =
name: text;
phone: text;
phone_notifications: bool;
wallet: principal;
wallet: text;
};
type Trie =
variant {
Expand All @@ -31,6 +31,13 @@ type Result =
err: text;
ok: text;
};
type Response =
record {
data: opt text;
error_text: opt text;
status: nat16;
status_text: text;
};
type List =
opt record {
record {
Expand All @@ -56,6 +63,29 @@ type Branch =
right: Trie;
size: nat;
};
type Backend =
service {
create: (User) -> (UserId);
delete: (UserId) -> (bool);
getAllUsers: () -> (Trie) query;
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
getFundingAddress: () -> (text);
getFundingBalance: () -> (text);
getInvoice: () -> (Account);
getLogs: () -> (vec text) query;
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
read: (UserId) -> (opt User) query;
saveTransaction: (Transaction) -> (TransactionId);
setCourierApiKey: (text) -> (Response);
transactionsLength: () -> (text) query;
transferFromCanistertoSubAccount: () -> (Result);
transferFromSubAccountToSubAccount: (text, nat) -> (Result);
update: (UserId, User) -> (bool);
userLength: () -> (text) query;
whoami: () -> (principal);
};
type AssocList =
opt record {
record {
Expand All @@ -69,23 +99,4 @@ type Account =
owner: principal;
subaccount: opt Subaccount;
};
service : {
create: (User) -> (UserId);
delete: (UserId) -> (bool);
getAllUsers: () -> (Trie) query;
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
getFundingAddress: () -> (text);
getFundingBalance: () -> (text);
getInvoice: () -> (Account);
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
read: (UserId) -> (opt User) query;
saveTransaction: (Transaction) -> (TransactionId);
transactionsLength: () -> (text) query;
transferFromCanistertoSubAccount: () -> (Result);
transferFromSubAccountToSubAccount: (text, nat) -> (Result);
update: (UserId, User) -> (bool);
userLength: () -> (text) query;
whoami: () -> (principal);
}
service : (nat) -> Backend
4 changes: 3 additions & 1 deletion .dfx/local/canisters/backend/backend.most
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ type User =
name : Text;
phone : Text;
phone_notifications : Bool;
wallet : Principal
wallet : Text
};
type UserId = Nat32;
actor {
stable var courierApiKey : Text;
stable var latestTransactionIndex : Nat;
stable var next : Nat32;
stable var nextTransaction : Nat32;
stable var transactions :
Expand Down
4 changes: 3 additions & 1 deletion .dfx/local/canisters/backend/backend.old.most
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ type User =
name : Text;
phone : Text;
phone_notifications : Bool;
wallet : Principal
wallet : Text
};
type UserId = Nat32;
actor {
stable var courierApiKey : Text;
stable var latestTransactionIndex : Nat;
stable var next : Nat32;
stable var nextTransaction : Nat32;
stable var transactions :
Expand Down
Binary file modified .dfx/local/canisters/backend/backend.wasm
Binary file not shown.
53 changes: 32 additions & 21 deletions .dfx/local/canisters/backend/constructor.did
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type User =
name: text;
phone: text;
phone_notifications: bool;
wallet: principal;
wallet: text;
};
type Trie =
variant {
Expand All @@ -31,6 +31,13 @@ type Result =
err: text;
ok: text;
};
type Response =
record {
data: opt text;
error_text: opt text;
status: nat16;
status_text: text;
};
type List =
opt record {
record {
Expand All @@ -56,6 +63,29 @@ type Branch =
right: Trie;
size: nat;
};
type Backend =
service {
create: (User) -> (UserId);
delete: (UserId) -> (bool);
getAllUsers: () -> (Trie) query;
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
getFundingAddress: () -> (text);
getFundingBalance: () -> (text);
getInvoice: () -> (Account);
getLogs: () -> (vec text) query;
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
read: (UserId) -> (opt User) query;
saveTransaction: (Transaction) -> (TransactionId);
setCourierApiKey: (text) -> (Response);
transactionsLength: () -> (text) query;
transferFromCanistertoSubAccount: () -> (Result);
transferFromSubAccountToSubAccount: (text, nat) -> (Result);
update: (UserId, User) -> (bool);
userLength: () -> (text) query;
whoami: () -> (principal);
};
type AssocList =
opt record {
record {
Expand All @@ -69,23 +99,4 @@ type Account =
owner: principal;
subaccount: opt Subaccount;
};
service : {
create: (User) -> (UserId);
delete: (UserId) -> (bool);
getAllUsers: () -> (Trie) query;
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
getFundingAddress: () -> (text);
getFundingBalance: () -> (text);
getInvoice: () -> (Account);
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
read: (UserId) -> (opt User) query;
saveTransaction: (Transaction) -> (TransactionId);
transactionsLength: () -> (text) query;
transferFromCanistertoSubAccount: () -> (Result);
transferFromSubAccountToSubAccount: (text, nat) -> (Result);
update: (UserId, User) -> (bool);
userLength: () -> (text) query;
whoami: () -> (principal);
}
service : (nat) -> Backend
11 changes: 10 additions & 1 deletion .dfx/local/canisters/backend/constructor.old.did
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type User =
name: text;
phone: text;
phone_notifications: bool;
wallet: principal;
wallet: text;
};
type Trie =
variant {
Expand All @@ -31,6 +31,13 @@ type Result =
err: text;
ok: text;
};
type Response =
record {
data: opt text;
error_text: opt text;
status: nat16;
status_text: text;
};
type List =
opt record {
record {
Expand Down Expand Up @@ -78,10 +85,12 @@ service : {
getFundingAddress: () -> (text);
getFundingBalance: () -> (text);
getInvoice: () -> (Account);
getLogs: () -> (vec text) query;
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
read: (UserId) -> (opt User) query;
saveTransaction: (Transaction) -> (TransactionId);
setCourierApiKey: (text) -> (Response);
transactionsLength: () -> (text) query;
transferFromCanistertoSubAccount: () -> (Result);
transferFromSubAccountToSubAccount: (text, nat) -> (Result);
Expand Down
2 changes: 1 addition & 1 deletion .dfx/local/canisters/backend/init_args.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
()
(nat)
147 changes: 57 additions & 90 deletions .dfx/local/canisters/backend/service.did
Original file line number Diff line number Diff line change
@@ -1,91 +1,58 @@
type UserId = nat32;
type User =
record {
created_at: int;
email: text;
email_notifications: bool;
id: nat;
name: text;
phone: text;
phone_notifications: bool;
wallet: principal;
};
type Trie =
variant {
branch: Branch;
"empty";
leaf: Leaf;
};
type TransactionId = nat32;
type Transaction =
record {
amount: nat;
created_at: int;
from: principal;
memo: text;
to: principal;
};
type Subaccount = blob;
type Result =
variant {
err: text;
ok: text;
};
type List =
opt record {
record {
Key;
User;
};
List;
};
type Leaf =
record {
keyvals: AssocList;
size: nat;
};
type Key =
record {
hash: Hash;
key: UserId;
};
type Account = record { owner : principal; subaccount : opt Subaccount };
type AssocList = opt record { record { Key; User }; List };
type Backend = service {
create : (User) -> (UserId);
delete : (UserId) -> (bool);
getAllUsers : () -> (Trie) query;
getCanisterAddress : () -> (text);
getCanisterBalance : () -> (text);
getFundingAddress : () -> (text);
getFundingBalance : () -> (text);
getInvoice : () -> (Account);
getLogs : () -> (vec text) query;
getTradingAddress : () -> (text);
getTradingBalance : () -> (text);
read : (UserId) -> (opt User) query;
saveTransaction : (Transaction) -> (TransactionId);
setCourierApiKey : (text) -> (Response);
transactionsLength : () -> (text) query;
transferFromCanistertoSubAccount : () -> (Result);
transferFromSubAccountToSubAccount : (text, nat) -> (Result);
update : (UserId, User) -> (bool);
userLength : () -> (text) query;
whoami : () -> (principal);
};
type Branch = record { left : Trie; size : nat; right : Trie };
type Hash = nat32;
type Branch =
record {
left: Trie;
right: Trie;
size: nat;
};
type AssocList =
opt record {
record {
Key;
User;
};
List;
};
type Account =
record {
owner: principal;
subaccount: opt Subaccount;
};
service : {
create: (User) -> (UserId);
delete: (UserId) -> (bool);
getAllUsers: () -> (Trie) query;
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
getFundingAddress: () -> (text);
getFundingBalance: () -> (text);
getInvoice: () -> (Account);
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
read: (UserId) -> (opt User) query;
saveTransaction: (Transaction) -> (TransactionId);
transactionsLength: () -> (text) query;
transferFromCanistertoSubAccount: () -> (Result);
transferFromSubAccountToSubAccount: (text, nat) -> (Result);
update: (UserId, User) -> (bool);
userLength: () -> (text) query;
whoami: () -> (principal);
}
type Key = record { key : UserId; hash : Hash };
type Leaf = record { size : nat; keyvals : AssocList };
type List = opt record { record { Key; User }; List };
type Response = record {
status : nat16;
data : opt text;
status_text : text;
error_text : opt text;
};
type Result = variant { ok : text; err : text };
type Subaccount = vec nat8;
type Transaction = record {
to : principal;
from : principal;
memo : text;
created_at : int;
amount : nat;
};
type TransactionId = nat32;
type Trie = variant { branch : Branch; leaf : Leaf; "empty" };
type User = record {
id : nat;
phone_notifications : bool;
name : text;
email_notifications : bool;
created_at : int;
email : text;
wallet : text;
phone : text;
};
type UserId = nat32;
service : Backend
Loading

0 comments on commit 81493a3

Please sign in to comment.