Commit Graph

1517 Commits

Author SHA1 Message Date
lunar-mining
c784d0396c util: convert u32 to u64 2021-09-30 17:33:10 +02:00
lunar-mining
29d3040a29 util: decimal() returns usize 2021-09-30 17:14:10 +02:00
lunar-mining
1884a0d6d1 util: remove decimal point if round number 2021-09-30 16:49:36 +02:00
lunar-mining
675b7efd77 util: replaced trim with trim_end_matches 2021-09-30 16:37:50 +02:00
lunar-mining
bbba70b04b util: decode_base10 and encode_base10 test cases 2021-09-30 16:00:42 +02:00
lunar-mining
0aa135c5b5 bin/darkfid: parse transfer params 2021-09-30 12:56:33 +02:00
lunar-mining
676b341f13 util: clean up 2021-09-30 12:19:33 +02:00
lunar-mining
3190f622d2 disabled parse_params. replaced with to_apo() and decimals() 2021-09-30 12:15:48 +02:00
lunar-mining
c43dbb5364 generate_id: added NetworkName. disabled parse_wrapped_token 2021-09-30 11:59:38 +02:00
lunar-mining
6a7e458c82 bin/cashierd: renamed check_token_id to validate_token_id 2021-09-30 11:24:36 +02:00
lunar-mining
a5f0e629ce renamed parse_network to assign_id 2021-09-30 11:22:34 +02:00
lunar-mining
181d337d6e util: refactored util.rs into util directory 2021-09-30 09:47:11 +02:00
parazyd
9d745bf288 service/sol: Close the SPL token account if it has no remaining balance. 2021-09-29 17:42:07 +02:00
parazyd
b220d6d9ff util: Fix infinite loop bug. 2021-09-29 17:30:48 +02:00
parazyd
a71b2775fe bin: Remove unused files. 2021-09-29 17:10:20 +02:00
parazyd
13f94a5ea3 Clean up some error mapping. 2021-09-29 16:50:23 +02:00
parazyd
71f3bcace4 More memory cleanups. 2021-09-29 16:31:35 +02:00
ghassmo
d8f729de55 service/sol: change the return type to SolResult in internal functions 2021-09-29 17:26:50 +03:00
ghassmo
70a5e542f4 cashierd: save the generated solana main keypair in cashierdb if it's not exist 2021-09-29 16:48:36 +03:00
parazyd
e3dffd044f service/sol: Working SPL token deposits. 2021-09-29 15:01:51 +02:00
parazyd
a45f9d3144 Fix amount_in_apo in util.rs.
And some small lints/cleanups.
2021-09-29 14:50:17 +02:00
parazyd
ab73708346 util: Add explicit check if token.len is 44.
This should allow base58 Solana mint addresses.
2021-09-29 13:07:51 +02:00
parazyd
259050da13 service/sol: Initial stab at SPL token transfers. 2021-09-29 11:50:58 +02:00
lunar-mining
f39068c20b src/util: completed f64 to u64 conversion in parse_param 2021-09-29 09:33:07 +02:00
lunar-mining
ffe6afccdf Revert "src/util: made TokenList struct called in darkfid::main()"
This reverts commit 873d259bd2.
2021-09-29 09:04:02 +02:00
lunar-mining
873d259bd2 src/util: made TokenList struct called in darkfid::main() 2021-09-29 08:56:56 +02:00
ghassmo
0b6fe5811b move parsing params functions and NetworkName enum to src/util.rs 2021-09-29 02:39:10 +03:00
ghassmo
ef9e32a86b darkfid: add NetworkName enum and clean up 2021-09-28 21:08:41 +03:00
ghassmo
e8c54c0a49 Merge branch 'master' of github.com:darkrenaissance/darkfi 2021-09-28 20:50:27 +03:00
ghassmo
8f015b548b cashierdb: remove token_id from main_keypair 2021-09-28 20:49:53 +03:00
lunar-mining
685f8e96ff bin/darkfi: test function for f64 -> u64 2021-09-28 19:44:39 +02:00
lunar-mining
0e372a8f57 bin/darkfid: renamed parse_network to parse_params 2021-09-28 19:44:39 +02:00
lunar-mining
712650b58b bin/darkfid: removed testcase 2021-09-28 19:44:39 +02:00
ghassmo
10b3bec61b NetworkName: minor changes 2021-09-28 20:37:46 +03:00
parazyd
61cb717aba service/sol: Pay fees from main wallet when sending tx.
This comes with an implication that the main wallet has some funds
for this operation.
2021-09-28 18:08:11 +02:00
parazyd
b9d82a23e4 Makefile updates. 2021-09-28 18:08:11 +02:00
ghassmo
b90d2c09a1 remove hardcoded network name across the project and use enum instead 2021-09-28 18:55:05 +03:00
parazyd
cf2870061d service/sol: More cleanups. 2021-09-28 17:43:32 +02:00
ghassmo
00bacb3555 Cashierd: listen to notification from bridge listen() function 2021-09-28 18:00:15 +03:00
ghassmo
796c41983f Bridge: implement listen() function 2021-09-28 17:59:40 +03:00
parazyd
c6e4e3f3b4 service/sol: Implement function for fetching SPL Token balance.
It can be used as follows:

fn main() {
    let main_pk = Pubkey::from_str("mainWallet").unwrap();
    let mint_pk = Pubkey::from_str("usdcMint").unwrap();
    let (tokn_pk, _) = get_associated_token_account(&main_pk, &mint_pk);
    let (bal, dec) = get_account_token_balance(
        "https://api.mainnet-beta.solana.com".to_string(),
        &tokn_pk,
        &mint_pk
    ).unwrap();

    println!("Balance:  {}", bal);
    println!("Decimals: {}", dec);
    println!("UI representation: {}", bal / u64::pow(10, dec as u32));
}
2021-09-28 15:46:14 +02:00
parazyd
3ac9d7edbe service/sol: Fix and clean up account subscription handling. 2021-09-28 14:24:48 +02:00
parazyd
a8941a7045 rpc: Add Clone implementation for structs, and use untagged enum. 2021-09-28 14:24:48 +02:00
ghassmo
e6c68c76bf update todo.md 2021-09-28 15:12:16 +03:00
ghassmo
ca85a4e59c cashierdb: attach token_id to the main keypair for tokens & change
asset_id name to token_id in schema and all functions
2021-09-28 14:57:57 +03:00
ghassmo
c142c83bda util: generate_id() function take &str as token_id instead of
json::Value
2021-09-28 14:56:54 +03:00
lunar-mining
2b0dc655c6 bin/darkfid: float->u64 conversion test case 2021-09-28 10:21:46 +02:00
Janus
5c12623b95 Move script subscribe into BtcClient from BitcoinKeys 2021-09-27 09:50:37 -04:00
ghassmo
aed1a17f1f BtcClient: minor changes 2021-09-27 16:16:57 +03:00
ghassmo
d81cca4030 BtcClient: remove hardcoded network endpoints 2021-09-27 15:49:26 +03:00