mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-11-18 08:06:46 +01:00
adapt and update to nostr-sdk 0.7.0
This commit is contained in:
@@ -5,7 +5,7 @@ import time
|
||||
from datetime import timedelta
|
||||
|
||||
from nostr_sdk import (Keys, Client, Timestamp, Filter, nip04_decrypt, HandleNotification, EventBuilder, PublicKey,
|
||||
Options, Tag, Event, nip04_encrypt)
|
||||
Options, Tag, Event, nip04_encrypt, ClientSigner)
|
||||
|
||||
from nostr_dvm.utils.admin_utils import admin_make_database_updates
|
||||
from nostr_dvm.utils.database_utils import get_or_add_user, update_user_balance, create_sql_table, update_sql_table
|
||||
@@ -35,7 +35,8 @@ class Bot:
|
||||
skip_disconnected_relays = True
|
||||
opts = (Options().wait_for_send(wait_for_send).send_timeout(timedelta(seconds=self.dvm_config.RELAY_TIMEOUT))
|
||||
.skip_disconnected_relays(skip_disconnected_relays))
|
||||
self.client = Client.with_opts(self.keys, opts)
|
||||
signer = ClientSigner.KEYS(self.keys)
|
||||
self.client = Client.with_opts(signer, opts)
|
||||
|
||||
pk = self.keys.public_key()
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import timedelta
|
||||
from sys import platform
|
||||
|
||||
from nostr_sdk import PublicKey, Keys, Client, Tag, Event, EventBuilder, Filter, HandleNotification, Timestamp, \
|
||||
init_logger, LogLevel, Options, nip04_encrypt
|
||||
init_logger, LogLevel, Options, nip04_encrypt, ClientSigner
|
||||
|
||||
import time
|
||||
|
||||
@@ -43,7 +43,10 @@ class DVM:
|
||||
opts = (Options().wait_for_send(wait_for_send).send_timeout(timedelta(seconds=self.dvm_config.RELAY_TIMEOUT))
|
||||
.skip_disconnected_relays(skip_disconnected_relays))
|
||||
|
||||
self.client = Client.with_opts(self.keys, opts)
|
||||
signer = ClientSigner.KEYS(self.keys)
|
||||
self.client = Client.with_opts(signer,opts)
|
||||
|
||||
|
||||
self.job_list = []
|
||||
self.jobs_on_hold_list = []
|
||||
pk = self.keys.public_key()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
from datetime import timedelta
|
||||
|
||||
from nostr_sdk import PublicKey, Options, Keys, Client
|
||||
from nostr_sdk import PublicKey, Options, Keys, Client, ClientSigner
|
||||
|
||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
@@ -20,10 +20,12 @@ def build_external_dvm(pubkey, task, kind, fix_cost, per_unit_cost, config,
|
||||
opts = (Options().wait_for_send(True).send_timeout(timedelta(seconds=config.RELAY_TIMEOUT))
|
||||
.skip_disconnected_relays(True))
|
||||
keys = Keys.from_sk_str(config.PRIVATE_KEY)
|
||||
client = Client.with_opts(keys, opts)
|
||||
signer = ClientSigner.KEYS(keys)
|
||||
client = Client.with_opts(signer, opts)
|
||||
|
||||
|
||||
for relay in config.RELAY_LIST:
|
||||
client.add_relay(relay)
|
||||
client.add_relay(relay)
|
||||
client.connect()
|
||||
|
||||
nip89content_str = nip89_fetch_events_pubkey(client, pubkey, kind)
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
import os
|
||||
|
||||
import requests
|
||||
from nostr_sdk import Keys, PublicKey, Client, nip04_encrypt, EventBuilder, Tag
|
||||
from nostr_sdk import Keys, PublicKey, Client, nip04_encrypt, EventBuilder, Tag, ClientSigner
|
||||
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
||||
@@ -20,7 +20,8 @@ def nwc_zap(connectionstr, bolt11, keys):
|
||||
}
|
||||
}
|
||||
|
||||
client = Client(keys)
|
||||
signer = ClientSigner.KEYS(keys)
|
||||
client = Client(signer)
|
||||
client.add_relay(relay)
|
||||
client.connect()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user