chore: add error tests
This commit is contained in:
parent
6522dfdd26
commit
75d155c67a
@ -4,6 +4,34 @@ namespace bdk {};
|
|||||||
// bdk crate - error module
|
// bdk crate - error module
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
[Error]
|
||||||
|
interface AddressError {
|
||||||
|
Base58();
|
||||||
|
Bech32();
|
||||||
|
WitnessVersion(string error_message);
|
||||||
|
WitnessProgram(string error_message);
|
||||||
|
UncompressedPubkey();
|
||||||
|
ExcessiveScriptSize();
|
||||||
|
UnrecognizedScript();
|
||||||
|
NetworkValidation(Network required, Network found, string address);
|
||||||
|
OtherAddressErr();
|
||||||
|
};
|
||||||
|
|
||||||
|
[Error]
|
||||||
|
interface Bip32Error {
|
||||||
|
CannotDeriveFromHardenedKey();
|
||||||
|
Secp256k1(string error_message);
|
||||||
|
InvalidChildNumber(u32 child_number);
|
||||||
|
InvalidChildNumberFormat();
|
||||||
|
InvalidDerivationPathFormat();
|
||||||
|
UnknownVersion(string version);
|
||||||
|
WrongExtendedKeyLength(u32 length);
|
||||||
|
Base58(string error_message);
|
||||||
|
Hex(string error_message);
|
||||||
|
InvalidPublicKeyHexLength(u32 length);
|
||||||
|
UnknownError(string error_message);
|
||||||
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface Bip39Error {
|
interface Bip39Error {
|
||||||
BadWordCount(u64 word_count);
|
BadWordCount(u64 word_count);
|
||||||
@ -13,28 +41,6 @@ interface Bip39Error {
|
|||||||
AmbiguousLanguages(string languages);
|
AmbiguousLanguages(string languages);
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
|
||||||
interface Bip32Error {
|
|
||||||
CannotDeriveFromHardenedKey();
|
|
||||||
Secp256k1(string e);
|
|
||||||
InvalidChildNumber(u32 child_number);
|
|
||||||
InvalidChildNumberFormat();
|
|
||||||
InvalidDerivationPathFormat();
|
|
||||||
UnknownVersion(string version);
|
|
||||||
WrongExtendedKeyLength(u32 length);
|
|
||||||
Base58(string e);
|
|
||||||
Hex(string e);
|
|
||||||
InvalidPublicKeyHexLength(u32 length);
|
|
||||||
UnknownError(string e);
|
|
||||||
};
|
|
||||||
|
|
||||||
[Error]
|
|
||||||
interface DescriptorKeyError {
|
|
||||||
Parse(string e);
|
|
||||||
InvalidKeyType();
|
|
||||||
Bip32(string e);
|
|
||||||
};
|
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface CalculateFeeError {
|
interface CalculateFeeError {
|
||||||
MissingTxOut(sequence<OutPoint> out_points);
|
MissingTxOut(sequence<OutPoint> out_points);
|
||||||
@ -42,22 +48,15 @@ interface CalculateFeeError {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface WalletCreationError {
|
interface CannotConnectError {
|
||||||
Io(string e);
|
Include(u32 height);
|
||||||
InvalidMagicBytes(sequence<u8> got, sequence<u8> expected);
|
|
||||||
Descriptor();
|
|
||||||
Write();
|
|
||||||
Load();
|
|
||||||
NotInitialized();
|
|
||||||
LoadedGenesisDoesNotMatch();
|
|
||||||
LoadedNetworkDoesNotMatch(Network expected, Network? got);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface CreateTxError {
|
interface CreateTxError {
|
||||||
Descriptor(string e);
|
Descriptor(string error_message);
|
||||||
Persist(string e);
|
Persist(string error_message);
|
||||||
Policy(string e);
|
Policy(string error_message);
|
||||||
SpendingPolicyRequired(string kind);
|
SpendingPolicyRequired(string kind);
|
||||||
Version0();
|
Version0();
|
||||||
Version1Csv();
|
Version1Csv();
|
||||||
@ -69,19 +68,37 @@ interface CreateTxError {
|
|||||||
NoUtxosSelected();
|
NoUtxosSelected();
|
||||||
OutputBelowDustLimit(u64 index);
|
OutputBelowDustLimit(u64 index);
|
||||||
ChangePolicyDescriptor();
|
ChangePolicyDescriptor();
|
||||||
CoinSelection(string e);
|
CoinSelection(string error_message);
|
||||||
InsufficientFunds(u64 needed, u64 available);
|
InsufficientFunds(u64 needed, u64 available);
|
||||||
NoRecipients();
|
NoRecipients();
|
||||||
Psbt(string e);
|
Psbt(string error_message);
|
||||||
MissingKeyOrigin(string key);
|
MissingKeyOrigin(string key);
|
||||||
UnknownUtxo(string outpoint);
|
UnknownUtxo(string outpoint);
|
||||||
MissingNonWitnessUtxo(string outpoint);
|
MissingNonWitnessUtxo(string outpoint);
|
||||||
MiniscriptPsbt(string e);
|
MiniscriptPsbt(string error_message);
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface PersistenceError {
|
interface DescriptorError {
|
||||||
Write(string e);
|
InvalidHdKeyPath();
|
||||||
|
InvalidDescriptorChecksum();
|
||||||
|
HardenedDerivationXpub();
|
||||||
|
MultiPath();
|
||||||
|
Key(string error_message);
|
||||||
|
Policy(string error_message);
|
||||||
|
InvalidDescriptorCharacter(string char);
|
||||||
|
Bip32(string error_message);
|
||||||
|
Base58(string error_message);
|
||||||
|
Pk(string error_message);
|
||||||
|
Miniscript(string error_message);
|
||||||
|
Hex(string error_message);
|
||||||
|
};
|
||||||
|
|
||||||
|
[Error]
|
||||||
|
interface DescriptorKeyError {
|
||||||
|
Parse(string error_message);
|
||||||
|
InvalidKeyType();
|
||||||
|
Bip32(string error_message);
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
@ -100,55 +117,28 @@ interface EsploraError {
|
|||||||
InvalidHttpHeaderValue(string value);
|
InvalidHttpHeaderValue(string value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Error]
|
||||||
|
interface ExtractTxError {
|
||||||
|
AbsurdFeeRate(u64 fee_rate);
|
||||||
|
MissingInputValue();
|
||||||
|
SendingTooMuch();
|
||||||
|
OtherExtractTxErr();
|
||||||
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
enum FeeRateError {
|
enum FeeRateError {
|
||||||
"ArithmeticOverflow"
|
"ArithmeticOverflow"
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface AddressError {
|
interface PersistenceError {
|
||||||
Base58();
|
Write(string error_message);
|
||||||
Bech32();
|
|
||||||
WitnessVersion(string error_message);
|
|
||||||
WitnessProgram(string error_message);
|
|
||||||
UncompressedPubkey();
|
|
||||||
ExcessiveScriptSize();
|
|
||||||
UnrecognizedScript();
|
|
||||||
NetworkValidation(Network required, Network found, string address);
|
|
||||||
OtherAddressErr();
|
|
||||||
};
|
|
||||||
|
|
||||||
[Error]
|
|
||||||
interface TransactionError {
|
|
||||||
Io();
|
|
||||||
OversizedVectorAllocation();
|
|
||||||
InvalidChecksum(string expected, string actual);
|
|
||||||
NonMinimalVarInt();
|
|
||||||
ParseFailed();
|
|
||||||
UnsupportedSegwitFlag(u8 flag);
|
|
||||||
OtherTransactionErr();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface PsbtParseError {
|
interface PsbtParseError {
|
||||||
PsbtEncoding(string e);
|
PsbtEncoding(string error_message);
|
||||||
Base64Encoding(string e);
|
Base64Encoding(string error_message);
|
||||||
};
|
|
||||||
|
|
||||||
[Error]
|
|
||||||
interface DescriptorError {
|
|
||||||
InvalidHdKeyPath();
|
|
||||||
InvalidDescriptorChecksum();
|
|
||||||
HardenedDerivationXpub();
|
|
||||||
MultiPath();
|
|
||||||
Key(string e);
|
|
||||||
Policy(string e);
|
|
||||||
InvalidDescriptorCharacter(string char);
|
|
||||||
Bip32(string e);
|
|
||||||
Base58(string e);
|
|
||||||
Pk(string e);
|
|
||||||
Miniscript(string e);
|
|
||||||
Hex(string e);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
@ -164,9 +154,20 @@ interface SignerError {
|
|||||||
MissingHdKeypath();
|
MissingHdKeypath();
|
||||||
NonStandardSighash();
|
NonStandardSighash();
|
||||||
InvalidSighash();
|
InvalidSighash();
|
||||||
SighashError(string e);
|
SighashError(string error_message);
|
||||||
MiniscriptPsbt(string e);
|
MiniscriptPsbt(string error_message);
|
||||||
External(string e);
|
External(string error_message);
|
||||||
|
};
|
||||||
|
|
||||||
|
[Error]
|
||||||
|
interface TransactionError {
|
||||||
|
Io();
|
||||||
|
OversizedVectorAllocation();
|
||||||
|
InvalidChecksum(string expected, string actual);
|
||||||
|
NonMinimalVarInt();
|
||||||
|
ParseFailed();
|
||||||
|
UnsupportedSegwitFlag(u8 flag);
|
||||||
|
OtherTransactionErr();
|
||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
@ -175,16 +176,15 @@ interface TxidParseError {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
interface ExtractTxError {
|
interface WalletCreationError {
|
||||||
AbsurdFeeRate(u64 fee_rate);
|
Io(string error_message);
|
||||||
MissingInputValue();
|
InvalidMagicBytes(sequence<u8> got, sequence<u8> expected);
|
||||||
SendingTooMuch();
|
Descriptor();
|
||||||
OtherExtractTxErr();
|
Write();
|
||||||
};
|
Load();
|
||||||
|
NotInitialized();
|
||||||
[Error]
|
LoadedGenesisDoesNotMatch();
|
||||||
interface CannotConnectError {
|
LoadedNetworkDoesNotMatch(Network expected, Network? got);
|
||||||
Include(u32 height);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
1790
bdk-ffi/src/error.rs
1790
bdk-ffi/src/error.rs
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user