helium / helium-wallet-rs

Rust implementation of a helium wallet CLI
Apache License 2.0
255 stars 114 forks source link

Updates for Oracles to transition to helium-lib #401

Open michaeldjeffrey opened 1 month ago

michaeldjeffrey commented 1 month ago

Companion Oracles PR https://github.com/helium/oracles/pull/850

dc::burn_delegated()

The iot_packet_verifier and mobile_packet_verifier in Oracles burn DC on behalf of OUI operators and Data Users respectively.

boosting::start_boost()

The boost_manager starts the clock for boosted hexes when they have yielded their first rewards in an epoch.

Because helium_lib also re-exports helium_anchor_gen::hexboosting, I named the module boosting to hopefully be different enough to avoid confusion.

Multiple hexes can have their boost periods started in a single transaction. Currently, whoever is calling start_boost() needs to make sure to restrict the number of boosted hexes it is providing. It would make sense to me to put that in helium-lib and potentially return multiple transactions for the caller to submit, but I haven't gotten there yet, and have not been able to think of a nice way to provide control over transaction sizes.


Added Keypair conversion

In trying to keep the separation between solana_sdk::signer::keypair::Keypair and helium_lib::keypair::Keypair, rather than providing a helium_lib version of solana_sdk::signature::read_keypair_file, I added a From impl to go from solana to helium-lib.

solana_sdk::signature::read_keypair_file returns a Box<dyn std::error::Error> to cover io::Error and a serde_json::Error. I wasn't sure of a nice way to add this error to helium_lib::error::Error, so I opted for the conversion.

michaeldjeffrey commented 1 month ago

There is a ReadWrite trait in helium-wallet that might make my pubkey conversion unnecessary.