SHOWING: First 60
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
dependencies = [
"fastrand 1.9.0",
"futures-core",
"futures-io",
"memchr",
"parking",
"pin-project-lite",
"waker-fn",
]
[[package]]
name = "futures-macro"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.27",
]
[[package]]
name = "futures-rustls"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28"
dependencies = [
"futures-io",
"rustls",
]
[[package]]
name = "futures-sink"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
[[package]]
name = "futures-task"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
#44,992,583textmsgid ""
"_Name_: [`satoshi`](https://ordinals.com/sat/satoshi). An encoding of the "
"ordinal number using the characters `a` through `z`."
msgstr ""
"_Nome_: [`satoshi`](https://ordinals.com/sat/satoshi). Uma codificação do "
"número ordinal usando os caracteres `a` até `z`."
#: src/overview.md:42
msgid ""
"Arbitrary assets, such as NFTs, security tokens, accounts, or stablecoins "
"can be attached to satoshis using ordinal numbers as stable identifiers."
msgstr ""
"AAtivos arbitrários, como NFTs, tokens de segurança, contas ou stablecoins "
"podem ser anexados a satoshis usando números ordinais como identificadores estáveis."
#: src/overview.md:45
msgid ""
"Ordinals is an open-source project, developed [on "
"GitHub](https://github.com/ordinals/ord). The project consists of a BIP "
"describing the ordinal scheme, an index that communicates with a Bitcoin "
"Core node to track the location of all satoshis, a wallet that allows making "
"ordinal-aware transactions, a block explorer for interactive exploration of "#44,992,582textuse {super::*, ord::subcommand::wallet::balance::Output};
#[test]
fn wallet_balance() {
let rpc_server = test_bitcoincore_rpc::spawn();
create_wallet(&rpc_server);
assert_eq!(
CommandBuilder::new("wallet balance")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>()
.cardinal,
0
);
rpc_server.mine_blocks(1);
assert_eq!(
CommandBuilder::new("wallet balance")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>()
.cardinal,
50 * COIN_VALUE
);
}
#[test]
fn wallet_balance_only_counts_cardinal_utxos() {
let rpc_server = test_bitcoincore_rpc::spawn();
create_wallet(&rpc_server);
assert_eq!(
CommandBuilder::new("wallet balance")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>()
.cardinal,
0
);
inscribe(&rpc_server);
assert_eq!(
CommandBuilder::new("wallet balance")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>()
.cardinal,
100 * COIN_VALUE - 10_000
#44,990,717textuse {super::*, std::num::TryFromIntError};
#[derive(Debug, PartialEq, Copy, Clone, Hash, Eq, Ord, PartialOrd)]
pub(crate) struct RuneId {
pub(crate) height: u32,
pub(crate) index: u16,
}
impl TryFrom<u128> for RuneId {
type Error = TryFromIntError;
fn try_from(n: u128) -> Result<Self, Self::Error> {
Ok(Self {
height: u32::try_from(n >> 16)?,
index: u16::try_from(n & 0xFFFF).unwrap(),
})
}
}
impl From<RuneId> for u128 {
fn from(id: RuneId) -> Self {
u128::from(id.height) << 16 | u128::from(id.index)
}
}
impl Display for RuneId {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "{}/{}", self.height, self.index,)
}
}
impl FromStr for RuneId {
type Err = crate::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let (height, index) = s
.split_once('/')
.ok_or_else(|| anyhow!("invalid rune ID: {s}"))?;
Ok(Self {
height: height.parse()?,
index: index.parse()?,
})
}
}
#[cfg(test)]
mod tests {
use super::*;
#44,989,404textcategories of tests: unit, integration and fuzz. Unit tests can usually be found at
the bottom of a file in a mod block called `tests`. If you add or modify a
function please also add a corresponding test. Integration tests try to test
end-to-end functionality by executing a subcommand of the binary. Those can be
found in the [tests](tests) directory. We don't have a lot of fuzzing but the
basic structure of how we do it can be found in the [fuzz](fuzz) directory.
We strongly recommend installing [just](https://github.com/casey/just) to make
running the tests easier. To run our CI test suite you would do:
```
just ci
```
This corresponds to the commands:
```
cargo fmt -- --check
cargo test --all
cargo test --all -- --ignored
```
Have a look at the [justfile](justfile) to see some more helpful recipes
(commands). Here are a couple more good ones:
```
just fmt
just fuzz
just doc
just watch ltest --all
```
If the tests are failing or hanging, you might need to increase the maximum
number of open files by running `ulimit -n 1024` in your shell before you run
#44,988,787text