-
Notifications
You must be signed in to change notification settings - Fork 3
Basic CLI #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Basic CLI #21
Conversation
db76675 to
98cce75
Compare
crates/coin-store/src/store.rs
Outdated
| use crate::filter::Filter; | ||
|
|
||
| static MIGRATOR: Migrator = sqlx::migrate!(); | ||
| const BLINDING_KEY_LEN: usize = 32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have a single constant, look whether elements already have it (related to the SEED_LEN)
crates/cli-client/src/cli/basic.rs
Outdated
|
|
||
| let results: Vec<UtxoQueryResult> = wallet.store().query(&[filter]).await?; | ||
|
|
||
| // todo: add merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use TODO(whoisgoingtodothat): ....
crates/cli-client/src/cli/basic.rs
Outdated
| .sign_p2pk(&tx, utxos, 0, config.address_params(), *LIQUID_TESTNET_GENESIS)?; | ||
| let native_utxo = (*native_entry.outpoint(), native_entry.txout().clone()); | ||
|
|
||
| // todo: maybe even in transfer native extract fee from input utxo (use as separate one) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not understand this todo
| Utxos { | ||
| /// Sets script for filtering in wallet | ||
| #[arg(long, long = "mine", default_value_t = false)] | ||
| is_mine: bool, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not add it yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I envision a different implementation for that
crates/cli-client/src/cli/common.rs
Outdated
| } | ||
|
|
||
| impl Broadcaster { | ||
| /// Broadcasts created transaction or returns raw transaction as hex string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this commit pls (let's not have comments that state the same thing as function name)
crates/cli-client/src/cli/common.rs
Outdated
|
|
||
| impl Broadcaster { | ||
| /// Broadcasts created transaction or returns raw transaction as hex string | ||
| pub async fn broadcast_tx(&self, wallet: &Wallet, tx: &Transaction, outpoints: &[OutPoint]) -> Result<(), Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need outpoints if we have tx
| CREATE TABLE option_params | ||
| ( | ||
| script_pubkey BLOB NOT NULL PRIMARY KEY, | ||
| start_time BLOB NOT NULL, | ||
| expiry_time BLOB NOT NULL, | ||
| collateral_per_contract BLOB NOT NULL, | ||
| settlement_per_contract BLOB NOT NULL, | ||
| collateral_asset_id BLOB NOT NULL, | ||
| settlement_asset_id BLOB NOT NULL, | ||
| option_token_entropy BLOB NOT NULL, | ||
| grantor_token_entropy BLOB NOT NULL | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is bad design.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss it offline, though in a nutshell this module should not be responsible for that
| async fn insert(&self, name: &str, asset_id: AssetId) -> Result<(), StoreError> { | ||
| let asset_entropy = asset_id.into_inner().0; | ||
|
|
||
| let existing: Option<(i64,)> = sqlx::query_as("SELECT 1 FROM assets WHERE asset_name = ?") | ||
| .bind(name) | ||
| .fetch_optional(&self.pool) | ||
| .await?; | ||
|
|
||
| if existing.is_some() { | ||
| return Err(StoreError::AssetIdAlreadyExists(name.to_string())); | ||
| } | ||
|
|
||
| let mut tx = self.pool.begin().await?; | ||
|
|
||
| sqlx::query("INSERT INTO assets (asset_name, asset_id) VALUES (?, ?)") | ||
| .bind(name) | ||
| .bind(asset_entropy.as_slice()) | ||
| .execute(&mut *tx) | ||
| .await?; | ||
|
|
||
| tx.commit().await?; | ||
|
|
||
| Ok(()) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not according to how I see this thing
74013d5 to
2be661f
Compare
2be661f to
63d87b8
Compare
No description provided.