server: api doc part 2

This commit is contained in:
nym21
2025-10-07 22:10:32 +02:00
parent 7ff79c3164
commit a53f89c849
19 changed files with 640 additions and 465 deletions
@@ -55,12 +55,6 @@ impl AddressBytes {
}
}
impl From<&Address> for AddressBytes {
fn from(value: &Address) -> Self {
Self::try_from((&value.script_pubkey(), OutputType::from(value))).unwrap()
}
}
impl TryFrom<(&ScriptBuf, OutputType)> for AddressBytes {
type Error = Error;
fn try_from(tuple: (&ScriptBuf, OutputType)) -> Result<Self, Self::Error> {
@@ -1,4 +1,3 @@
use bitcoin::Address;
use byteview::ByteView;
use derive_deref::Deref;
use zerocopy::{FromBytes, IntoBytes};
@@ -22,12 +21,6 @@ use super::{AddressBytes, OutputType};
)]
pub struct AddressBytesHash([u8; 8]);
impl From<&Address> for AddressBytesHash {
fn from(value: &Address) -> Self {
Self::from((&AddressBytes::from(value), OutputType::from(value)))
}
}
impl From<(&AddressBytes, OutputType)> for AddressBytesHash {
fn from((address_bytes, outputtype): (&AddressBytes, OutputType)) -> Self {
let mut slice = rapidhash::v3::rapidhash_v3(address_bytes.as_slice()).to_le_bytes();
+2 -8
View File
@@ -1,7 +1,7 @@
use bitcoin::{Address, AddressType, ScriptBuf, opcodes::all::OP_PUSHBYTES_2};
use bitcoin::{AddressType, ScriptBuf, opcodes::all::OP_PUSHBYTES_2};
use brk_error::Error;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde::Serialize;
use strum::Display;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
@@ -632,12 +632,6 @@ impl From<&ScriptBuf> for OutputType {
}
}
impl From<&Address> for OutputType {
fn from(value: &Address) -> Self {
Self::from(&value.script_pubkey())
}
}
impl From<AddressType> for OutputType {
fn from(value: AddressType) -> Self {
match value {
+4 -1
View File
@@ -2,10 +2,13 @@ use std::{fmt, mem};
use bitcoin::hashes::Hash;
use derive_deref::Deref;
use schemars::JsonSchema;
use serde::{Serialize, Serializer};
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
#[derive(Debug, Deref, Clone, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)]
#[derive(
Debug, Deref, Clone, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, JsonSchema,
)]
pub struct Txid([u8; 32]);
impl From<bitcoin::Txid> for Txid {
@@ -3,6 +3,7 @@ use std::ops::{Add, AddAssign};
use allocative::Allocative;
use byteview::ByteView;
use derive_deref::{Deref, DerefMut};
use schemars::JsonSchema;
use serde::Serialize;
use vecdb::{CheckedSub, PrintableIndex, StoredCompressed};
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
@@ -29,6 +30,7 @@ use super::StoredU32;
Serialize,
StoredCompressed,
Allocative,
JsonSchema,
)]
pub struct TxIndex(u32);