Skip to content

Commit e01a235

Browse files
committed
data: add Account & Wallet sur, data model doc
1 parent 86f662b commit e01a235

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed

desk/sur/account.hoon

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
:: /sur/account.hoon
2+
|%
3+
:: Account ID - uuid string used for edit, del, query (not an ETH 0x...)
4+
+$ id @t
5+
:: Wallet ID - foreign key to parent wallet
6+
+$ wallet-id @t
7+
:: Account Name
8+
+$ name @t
9+
:: Note - optional description of the account
10+
+$ note @t
11+
:: TODO: tags, types
12+
+$ account
13+
$: id=id
14+
wallet-id=wallet-id
15+
name=name
16+
note=note
17+
==
18+
:: Accounts - map of account-id to account
19+
+$ accounts (map id account)
20+
++ action
21+
=<
22+
|%
23+
+$ action
24+
$% [%add add]
25+
[%del del]
26+
[%edit edit]
27+
==
28+
+$ add [=id =wallet-id =name =note]
29+
+$ del [=id]
30+
+$ edit [=id =wallet-id =name =note]
31+
--
32+
+$ update
33+
$% [%add =account]
34+
[%del =id]
35+
[%edit =account]
36+
==
37+
--

desk/sur/wallet.hoon

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
:: /sur/wallet.hoon
2+
|%
3+
:: Wallet ID - uuid string used for edit, del, query (not an ETH 0x...)
4+
+$ id @t
5+
:: Wallet Name
6+
+$ name @t
7+
:: Note - optional description of the wallet
8+
+$ note @t
9+
:: TODO: tags, types
10+
+$ wallet
11+
$: id=id
12+
name=name
13+
note=note
14+
==
15+
:: Wallets - map of wallet ids to wallets
16+
+$ wallets (map id wallet)
17+
++ action
18+
=< action
19+
|%
20+
+$ action
21+
$% [%add add]
22+
[%del del]
23+
[%edit edit]
24+
==
25+
+$ add [=id =name =note]
26+
+$ del [=id]
27+
+$ edit [=id =name =note]
28+
--
29+
+$ update
30+
$% [%add =wallet]
31+
[%del =id]
32+
[%edit =wallet]
33+
==
34+
--

notes/data.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Data Model
2+
3+
## Wallets
4+
5+
A wallet is a collection of accounts.
6+
7+
```hoon
8+
:: Wallet ID - uuid string used for edit, del, query (not an ETH 0x...)
9+
+$ id @t
10+
:: Wallet Name
11+
+$ name @t
12+
:: Note - optional description of the wallet
13+
+$ note @t
14+
:: TODO: tags, types
15+
```
16+
17+
## Accounts
18+
19+
An account is a collection of transactions.
20+
21+
```hoon
22+
:: Account ID - uuid string used for edit, del, query (not an ETH 0x...)
23+
+$ id @t
24+
:: Wallet ID - foreign key to parent wallet
25+
+$ wallet-id @t
26+
:: Account Name
27+
+$ name @t
28+
:: Note - optional description of the account
29+
+$ note @t
30+
:: TODO: tags, types
31+
```
32+
33+
## Transactions
34+
35+
A transaction is a credit or debit to an account.
36+
37+
```hoon
38+
:: Transaction ID - uuid string used for edit, del, query (not an ETH 0x...)
39+
+$ id @t
40+
:: CoinGecko Coin ID - external ID that maps to a CG entity (e.g. BTC is 'bitcoin').
41+
:: Used for querying CG API
42+
+$ coin-id @t
43+
:: Timestamp of transaction
44+
+$ date @da
45+
:: Optional description of the TX
46+
+$ note @t
47+
:: TX Amount in currency
48+
:: Note usage of a string for storage; since no maths will be done in the app
49+
:: (for now!), it is simpler for a noob like me to work with. Eventually this
50+
:: will be migrated to using an aura with numerical precision
51+
+$ amount @t
52+
:: optional: cost per unit at the time of the TX (can be roughly auto-populated
53+
:: with CoinGecko History API async, or manually entered by user... or if
54+
:: imported from a CEX, use that value). see note re: string usage for amount,
55+
:: same goes for this
56+
+$ cost-basis @t
57+
:: %buy, %sell
58+
+$ type @ta
59+
:: TODO: tags
60+
```

0 commit comments

Comments
 (0)