mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-24 08:05:02 +01:00
Return proofs for wallet mint function (#520)
* chore: update flake --------- Co-authored-by: thesimplekid <tsk@thesimplekid.com>
This commit is contained in:
141
Cargo.lock
generated
141
Cargo.lock
generated
@@ -246,18 +246,18 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.83"
|
||||
version = "0.1.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
|
||||
checksum = "1b1244b10dcd56c92219da4e14caa97e312079e185f04ba3eea25061561dc0a0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -346,7 +346,7 @@ dependencies = [
|
||||
"sync_wrapper 0.1.2",
|
||||
"tokio",
|
||||
"tokio-tungstenite 0.20.1",
|
||||
"tower",
|
||||
"tower 0.4.13",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
@@ -718,9 +718,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.5"
|
||||
version = "1.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e"
|
||||
checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
@@ -1136,7 +1136,7 @@ dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1405,7 +1405,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1416,7 +1416,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1475,7 +1475,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1559,7 +1559,7 @@ dependencies = [
|
||||
"tokio-stream",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
"tower",
|
||||
"tower 0.4.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1693,7 +1693,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1757,9 +1757,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
|
||||
|
||||
[[package]]
|
||||
name = "gloo-timers"
|
||||
@@ -2232,7 +2232,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3018,7 +3018,7 @@ dependencies = [
|
||||
"pest_meta",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3076,7 +3076,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3174,7 +3174,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3237,7 +3237,7 @@ dependencies = [
|
||||
"prost",
|
||||
"prost-types",
|
||||
"regex",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
@@ -3251,7 +3251,7 @@ dependencies = [
|
||||
"itertools 0.12.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3344,9 +3344,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -3412,9 +3412,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redb"
|
||||
version = "2.3.0"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7c2a94325f9c5826b17c42af11067230f503747f870117a28180e85696e21ba"
|
||||
checksum = "ea0a72cd7140de9fc3e318823b883abf819c20d478ec89ce880466dc2ef263c6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -3518,9 +3518,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.9"
|
||||
version = "0.12.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f"
|
||||
checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"base64 0.22.1",
|
||||
@@ -3553,6 +3553,7 @@ dependencies = [
|
||||
"tokio-rustls 0.26.1",
|
||||
"tokio-socks",
|
||||
"tokio-util",
|
||||
"tower 0.5.2",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
@@ -3635,7 +3636,7 @@ dependencies = [
|
||||
"quote",
|
||||
"rust-embed-utils",
|
||||
"shellexpand",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
@@ -3819,9 +3820,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.18"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248"
|
||||
checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
@@ -3987,9 +3988,9 @@ checksum = "f97841a747eef040fcd2e7b3b9a220a7205926e60488e673d9e4926d27772ce5"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.216"
|
||||
version = "1.0.217"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
|
||||
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@@ -4007,13 +4008,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.216"
|
||||
version = "1.0.217"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
|
||||
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4053,9 +4054,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.11.0"
|
||||
version = "3.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817"
|
||||
checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
@@ -4071,14 +4072,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.11.0"
|
||||
version = "3.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d"
|
||||
checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4329,7 +4330,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"thiserror 1.0.69",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower 0.4.13",
|
||||
"tower-http",
|
||||
]
|
||||
|
||||
@@ -4369,9 +4370,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.91"
|
||||
version = "2.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035"
|
||||
checksum = "987bc0be1cdea8b10216bd06e2ca407d40b9543468fafd3ddfb02f36e77f71f3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4401,7 +4402,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4412,12 +4413,13 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.14.0"
|
||||
version = "3.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c"
|
||||
checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand 2.3.0",
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"rustix 0.38.42",
|
||||
"windows-sys 0.59.0",
|
||||
@@ -4449,7 +4451,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4460,7 +4462,7 @@ checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4575,7 +4577,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4721,7 +4723,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-rustls 0.24.1",
|
||||
"tokio-stream",
|
||||
"tower",
|
||||
"tower 0.4.13",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
@@ -4737,7 +4739,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"prost-build",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4760,6 +4762,21 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project-lite",
|
||||
"sync_wrapper 1.0.2",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.4.4"
|
||||
@@ -4777,7 +4794,7 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower",
|
||||
"tower 0.4.13",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
@@ -4814,7 +4831,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4942,9 +4959,9 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.8.0"
|
||||
version = "2.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df"
|
||||
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
@@ -5064,7 +5081,7 @@ dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5163,7 +5180,7 @@ dependencies = [
|
||||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@@ -5198,7 +5215,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@@ -5516,7 +5533,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@@ -5538,7 +5555,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5558,7 +5575,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@@ -5587,7 +5604,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.91",
|
||||
"syn 2.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -5,6 +5,7 @@ use anyhow::Result;
|
||||
use cdk::amount::SplitTarget;
|
||||
use cdk::cdk_database::{Error, WalletDatabase};
|
||||
use cdk::mint_url::MintUrl;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::{CurrencyUnit, MintQuoteState, NotificationPayload};
|
||||
use cdk::wallet::multi_mint_wallet::WalletKey;
|
||||
use cdk::wallet::{MultiMintWallet, Wallet, WalletSubscription};
|
||||
@@ -71,7 +72,9 @@ pub async fn mint(
|
||||
}
|
||||
}
|
||||
|
||||
let receive_amount = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
let proofs = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
|
||||
let receive_amount = proofs.total_amount()?;
|
||||
|
||||
println!("Received {receive_amount} from mint {mint_url}");
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use cdk::cdk_lightning::MintLightning;
|
||||
use cdk::dhke::construct_proofs;
|
||||
use cdk::mint::FeeReserve;
|
||||
use cdk::mint_url::MintUrl;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::nut17::Params;
|
||||
use cdk::nuts::{
|
||||
CurrencyUnit, Id, KeySet, MintBolt11Request, MintInfo, MintQuoteBolt11Request, MintQuoteState,
|
||||
@@ -137,7 +138,9 @@ pub async fn wallet_mint(
|
||||
}
|
||||
}
|
||||
|
||||
let receive_amount = wallet.mint("e.id, split_target, None).await?;
|
||||
let proofs = wallet.mint("e.id, split_target, None).await?;
|
||||
|
||||
let receive_amount = proofs.total_amount()?;
|
||||
|
||||
println!("Minted: {}", receive_amount);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ use anyhow::{bail, Result};
|
||||
use bip39::Mnemonic;
|
||||
use cdk::amount::SplitTarget;
|
||||
use cdk::cdk_database::WalletMemoryDatabase;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::{
|
||||
CurrencyUnit, MeltBolt11Request, MeltQuoteState, MintBolt11Request, MintQuoteState,
|
||||
NotificationPayload, PreMintSecrets, SecretKey, State,
|
||||
@@ -389,10 +390,12 @@ async fn test_fake_mint_with_witness() -> Result<()> {
|
||||
|
||||
wait_for_mint_to_be_paid(&wallet, &mint_quote.id).await?;
|
||||
|
||||
let mint_amount = wallet
|
||||
let proofs = wallet
|
||||
.mint(&mint_quote.id, SplitTarget::default(), None)
|
||||
.await?;
|
||||
|
||||
let mint_amount = proofs.total_amount()?;
|
||||
|
||||
assert!(mint_amount == 100.into());
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -10,6 +10,7 @@ mod integration_tests_pure {
|
||||
use cdk::amount::SplitTarget;
|
||||
use cdk::cdk_database::mint_memory::MintMemoryDatabase;
|
||||
use cdk::cdk_database::WalletMemoryDatabase;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::{
|
||||
CheckStateRequest, CheckStateResponse, CurrencyUnit, Id, KeySet, KeysetResponse,
|
||||
MeltBolt11Request, MeltQuoteBolt11Request, MeltQuoteBolt11Response, MintBolt11Request,
|
||||
@@ -215,10 +216,10 @@ mod integration_tests_pure {
|
||||
}
|
||||
}
|
||||
|
||||
wallet
|
||||
Ok(wallet
|
||||
.mint("e.id, SplitTarget::default(), None)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
.await?
|
||||
.total_amount()?)
|
||||
}
|
||||
|
||||
mod nut03 {
|
||||
|
||||
@@ -7,6 +7,7 @@ use anyhow::{bail, Result};
|
||||
use bip39::Mnemonic;
|
||||
use cdk::amount::{Amount, SplitTarget};
|
||||
use cdk::cdk_database::WalletMemoryDatabase;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::{
|
||||
CurrencyUnit, MeltQuoteState, MintBolt11Request, MintQuoteState, NotificationPayload,
|
||||
PreMintSecrets, State,
|
||||
@@ -78,10 +79,12 @@ async fn test_regtest_mint_melt_round_trip() -> Result<()> {
|
||||
|
||||
lnd_client.pay_invoice(mint_quote.request).await?;
|
||||
|
||||
let mint_amount = wallet
|
||||
let proofs = wallet
|
||||
.mint(&mint_quote.id, SplitTarget::default(), None)
|
||||
.await?;
|
||||
|
||||
let mint_amount = proofs.total_amount()?;
|
||||
|
||||
assert!(mint_amount == 100.into());
|
||||
|
||||
let invoice = lnd_client.create_invoice(Some(50)).await?;
|
||||
@@ -158,10 +161,12 @@ async fn test_regtest_mint_melt() -> Result<()> {
|
||||
|
||||
lnd_client.pay_invoice(mint_quote.request).await?;
|
||||
|
||||
let mint_amount = wallet
|
||||
let proofs = wallet
|
||||
.mint(&mint_quote.id, SplitTarget::default(), None)
|
||||
.await?;
|
||||
|
||||
let mint_amount = proofs.total_amount()?;
|
||||
|
||||
assert!(mint_amount == 100.into());
|
||||
|
||||
Ok(())
|
||||
@@ -240,10 +245,12 @@ async fn test_pay_invoice_twice() -> Result<()> {
|
||||
|
||||
lnd_client.pay_invoice(mint_quote.request).await?;
|
||||
|
||||
let mint_amount = wallet
|
||||
let proofs = wallet
|
||||
.mint(&mint_quote.id, SplitTarget::default(), None)
|
||||
.await?;
|
||||
|
||||
let mint_amount = proofs.total_amount()?;
|
||||
|
||||
assert_eq!(mint_amount, 100.into());
|
||||
|
||||
let invoice = lnd_client.create_invoice(Some(10)).await?;
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::sync::Arc;
|
||||
use cdk::amount::SplitTarget;
|
||||
use cdk::cdk_database::WalletMemoryDatabase;
|
||||
use cdk::error::Error;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::{CurrencyUnit, MintQuoteState, NotificationPayload};
|
||||
use cdk::wallet::types::SendKind;
|
||||
use cdk::wallet::{Wallet, WalletSubscription};
|
||||
@@ -46,7 +47,8 @@ async fn main() -> Result<(), Error> {
|
||||
}
|
||||
|
||||
// Mint the received amount
|
||||
let receive_amount = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
let proofs = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
let receive_amount = proofs.total_amount()?;
|
||||
println!("Received {} from mint {}", receive_amount, mint_url);
|
||||
|
||||
// Send a token with the specified amount
|
||||
|
||||
@@ -4,6 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use cdk::amount::SplitTarget;
|
||||
use cdk::cdk_database::WalletMemoryDatabase;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::{CurrencyUnit, MintQuoteState, NotificationPayload};
|
||||
use cdk::wallet::{Wallet, WalletSubscription};
|
||||
use cdk::Amount;
|
||||
@@ -49,7 +50,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
// Mint the received amount
|
||||
let receive_amount = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
let proofs = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
let receive_amount = proofs.total_amount()?;
|
||||
println!("Minted {}", receive_amount);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::time::Duration;
|
||||
|
||||
use cdk::amount::SplitTarget;
|
||||
use cdk::cdk_database::WalletMemoryDatabase;
|
||||
use cdk::nuts::nut00::ProofsMethods;
|
||||
use cdk::nuts::{CurrencyUnit, MintQuoteState};
|
||||
use cdk::wallet::types::SendKind;
|
||||
use cdk::wallet::Wallet;
|
||||
@@ -53,8 +54,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
// Mint the received amount
|
||||
let receive_amount = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
|
||||
let proofs = wallet.mint("e.id, SplitTarget::default(), None).await?;
|
||||
let receive_amount = proofs.total_amount()?;
|
||||
println!("Minted {}", receive_amount);
|
||||
|
||||
// Send the token
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::dhke::construct_proofs;
|
||||
use crate::nuts::nut00::ProofsMethods;
|
||||
use crate::nuts::{
|
||||
nut12, MintBolt11Request, MintQuoteBolt11Request, MintQuoteBolt11Response, PreMintSecrets,
|
||||
SecretKey, SpendingConditions, State,
|
||||
Proofs, SecretKey, SpendingConditions, State,
|
||||
};
|
||||
use crate::types::ProofInfo;
|
||||
use crate::util::unix_time;
|
||||
@@ -126,10 +126,10 @@ impl Wallet {
|
||||
|
||||
if mint_quote_response.state == MintQuoteState::Paid {
|
||||
// TODO: Need to pass in keys here
|
||||
let amount = self
|
||||
let proofs = self
|
||||
.mint(&mint_quote.id, SplitTarget::default(), None)
|
||||
.await?;
|
||||
total_amount += amount;
|
||||
total_amount += proofs.total_amount()?;
|
||||
} else if mint_quote.expiry.le(&unix_time()) {
|
||||
self.localstore.remove_mint_quote(&mint_quote.id).await?;
|
||||
}
|
||||
@@ -146,6 +146,7 @@ impl Wallet {
|
||||
/// use cdk::amount::{Amount, SplitTarget};
|
||||
/// use cdk::cdk_database::WalletMemoryDatabase;
|
||||
/// use cdk::nuts::CurrencyUnit;
|
||||
/// use cdk::nuts::nut00::ProofsMethods;
|
||||
/// use cdk::wallet::Wallet;
|
||||
/// use rand::Rng;
|
||||
///
|
||||
@@ -162,7 +163,8 @@ impl Wallet {
|
||||
/// let quote = wallet.mint_quote(amount, None).await?;
|
||||
/// let quote_id = quote.id;
|
||||
/// // To be called after quote request is paid
|
||||
/// let amount_minted = wallet.mint("e_id, SplitTarget::default(), None).await?;
|
||||
/// let minted_proofs = wallet.mint("e_id, SplitTarget::default(), None).await?;
|
||||
/// let minted_amount = minted_proofs.total_amount()?;
|
||||
///
|
||||
/// Ok(())
|
||||
/// }
|
||||
@@ -173,7 +175,7 @@ impl Wallet {
|
||||
quote_id: &str,
|
||||
amount_split_target: SplitTarget,
|
||||
spending_conditions: Option<SpendingConditions>,
|
||||
) -> Result<Amount, Error> {
|
||||
) -> Result<Proofs, Error> {
|
||||
// Check that mint is in store of mints
|
||||
if self
|
||||
.localstore
|
||||
@@ -254,8 +256,6 @@ impl Wallet {
|
||||
&keys,
|
||||
)?;
|
||||
|
||||
let minted_amount = proofs.total_amount()?;
|
||||
|
||||
// Remove filled quote from store
|
||||
self.localstore.remove_mint_quote("e_info.id).await?;
|
||||
|
||||
@@ -272,11 +272,11 @@ impl Wallet {
|
||||
.await?;
|
||||
}
|
||||
|
||||
let proofs = proofs
|
||||
.into_iter()
|
||||
let proof_infos = proofs
|
||||
.iter()
|
||||
.map(|proof| {
|
||||
ProofInfo::new(
|
||||
proof,
|
||||
proof.clone(),
|
||||
self.mint_url.clone(),
|
||||
State::Unspent,
|
||||
quote_info.unit.clone(),
|
||||
@@ -285,8 +285,8 @@ impl Wallet {
|
||||
.collect::<Result<Vec<ProofInfo>, _>>()?;
|
||||
|
||||
// Add new proofs to store
|
||||
self.localstore.update_proofs(proofs, vec![]).await?;
|
||||
self.localstore.update_proofs(proof_infos, vec![]).await?;
|
||||
|
||||
Ok(minted_amount)
|
||||
Ok(proofs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use super::types::SendKind;
|
||||
use super::Error;
|
||||
use crate::amount::SplitTarget;
|
||||
use crate::mint_url::MintUrl;
|
||||
use crate::nuts::{CurrencyUnit, Proof, SecretKey, SpendingConditions, Token};
|
||||
use crate::nuts::{CurrencyUnit, Proof, Proofs, SecretKey, SpendingConditions, Token};
|
||||
use crate::types::Melted;
|
||||
use crate::wallet::types::MintQuote;
|
||||
use crate::{Amount, Wallet};
|
||||
@@ -215,7 +215,7 @@ impl MultiMintWallet {
|
||||
wallet_key: &WalletKey,
|
||||
quote_id: &str,
|
||||
conditions: Option<SpendingConditions>,
|
||||
) -> Result<Amount, Error> {
|
||||
) -> Result<Proofs, Error> {
|
||||
let wallet = self
|
||||
.get_wallet(wallet_key)
|
||||
.await
|
||||
|
||||
49
flake.lock
generated
49
flake.lock
generated
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1733016477,
|
||||
"narHash": "sha256-Hh0khbqBeCtiNS0SJgqdWrQDem9WlPEc2KF5pAY+st0=",
|
||||
"lastModified": 1734808813,
|
||||
"narHash": "sha256-3aH/0Y6ajIlfy7j52FGZ+s4icVX0oHhqBzRdlOeztqg=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "76d64e779e2fbaf172110038492343a8c4e29b55",
|
||||
"rev": "72e2d02dbac80c8c86bf6bf3e785536acf8ee926",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -23,11 +23,11 @@
|
||||
"rust-analyzer-src": []
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732689334,
|
||||
"narHash": "sha256-yKI1KiZ0+bvDvfPTQ1ZT3oP/nIu3jPYm4dnbRd6hYg4=",
|
||||
"lastModified": 1735886062,
|
||||
"narHash": "sha256-TTI7Lt1/hvu3xuUdc2UA9jACoarf/DAKtwHYhsQ/iD8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "a8a983027ca02b363dfc82fbe3f7d9548a8d3dce",
|
||||
"rev": "a65f3516dfcce5cf2157cc19d517b1bb87ed71b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -93,27 +93,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1733016324,
|
||||
"narHash": "sha256-8qwPSE2g1othR1u4uP86NXxm6i7E9nHPyJX3m3lx7Q4=",
|
||||
"lastModified": 1735563628,
|
||||
"narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7e1ca67996afd8233d9033edd26e442836cc2ad6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1730741070,
|
||||
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
|
||||
"rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -143,15 +127,14 @@
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731363552,
|
||||
"narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
|
||||
"lastModified": 1735882644,
|
||||
"narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
|
||||
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -177,11 +160,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731637922,
|
||||
"narHash": "sha256-6iuzRINXyPX4DfUQZIGafpJnzjFXjVRYMymB10/jFFY=",
|
||||
"lastModified": 1735871325,
|
||||
"narHash": "sha256-6Ta5E4mhSfCP6LdkzkG2+BciLOCPeLKuYTJ6lOHW+mI=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "db10c66da18e816030b884388545add8cf096647",
|
||||
"rev": "a599f011db521766cbaf7c2f5874182485554f00",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
Reference in New Issue
Block a user