Skip to content
Merged

Nwc #41

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 27 additions & 96 deletions crates/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions crates/otrta-nostr/src/nip91_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ impl NostrProviderDiscovery {
}

fn parse_provider_from_event(&self, event: &Event) -> Result<NostrProvider> {
println!("Parsing event content: {}", event.content);
println!("Event tags: {:?}", event.tags);

let content: ProviderContent = match serde_json::from_str(&event.content) {
Ok(content) => content,
Err(e) => {
Expand All @@ -166,7 +163,6 @@ impl NostrProviderDiscovery {
let mut use_onion = content.use_onion.unwrap_or(false);

let tag_map = parse_tags_to_map(&event.tags);
println!("Parsed tag map: {:?}", tag_map);

if let Some(tag_urls) = tag_map.get("u") {
for url in tag_urls {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Add down migration script here

DROP TABLE IF EXISTS mint_auto_refill_settings;
DROP TABLE IF EXISTS nwc_connections;
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-- Add up migration script here

CREATE TABLE nwc_connections (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
organization_id UUID NOT NULL,
name VARCHAR(255) NOT NULL,
connection_uri TEXT NOT NULL,
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE
);

CREATE TABLE mint_auto_refill_settings (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
mint_id INTEGER NOT NULL,
organization_id UUID NOT NULL,
nwc_connection_id UUID NOT NULL,
min_balance_threshold_msat BIGINT NOT NULL DEFAULT 1000000,
refill_amount_msat BIGINT NOT NULL DEFAULT 10000000,
is_enabled BOOLEAN DEFAULT TRUE,
last_refill_at TIMESTAMP WITH TIME ZONE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
FOREIGN KEY (mint_id) REFERENCES mints(id) ON DELETE CASCADE,
FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE,
FOREIGN KEY (nwc_connection_id) REFERENCES nwc_connections(id) ON DELETE CASCADE,
UNIQUE(mint_id, organization_id)
);

CREATE INDEX idx_nwc_connections_organization_id ON nwc_connections(organization_id);
CREATE INDEX idx_nwc_connections_is_active ON nwc_connections(is_active);
CREATE INDEX idx_mint_auto_refill_settings_organization_id ON mint_auto_refill_settings(organization_id);
CREATE INDEX idx_mint_auto_refill_settings_mint_id ON mint_auto_refill_settings(mint_id);
CREATE INDEX idx_mint_auto_refill_settings_is_enabled ON mint_auto_refill_settings(is_enabled);
CREATE INDEX idx_mint_auto_refill_settings_last_refill_at ON mint_auto_refill_settings(last_refill_at);
Loading