Use an enum for Coin/NetworkId

It originally wasn't an enum so software which had yet to update before an
integration wouldn't error (as now enums are strictly typed). The strict typing
is preferable though.
This commit is contained in:
Luke Parker
2023-04-18 02:01:53 -04:00
parent 6f3b5f4535
commit 9da0eb69c7
15 changed files with 97 additions and 70 deletions

View File

@@ -1,7 +1,7 @@
use rand_core::{RngCore, OsRng};
use serai_client::{
primitives::{BITCOIN_NET_ID, BITCOIN, BlockHash, SeraiAddress, Amount, Balance},
primitives::{Amount, NetworkId, Coin, Balance, BlockHash, SeraiAddress},
in_instructions::{
primitives::{InInstruction, InInstructionWithBalance, Batch},
InInstructionsEvent,
@@ -15,7 +15,7 @@ use common::{serai, in_instructions::provide_batch};
serai_test!(
async fn publish_batch() {
let network = BITCOIN_NET_ID;
let network = NetworkId::Bitcoin;
let id = 0;
let mut block_hash = BlockHash([0; 32]);
@@ -24,7 +24,7 @@ serai_test!(
let mut address = SeraiAddress::new([0; 32]);
OsRng.fill_bytes(&mut address.0);
let coin = BITCOIN;
let coin = Coin::Bitcoin;
let amount = Amount(OsRng.next_u64().saturating_add(1));
let balance = Balance { coin, amount };