Merge pull request #1810 from RoboSats/include-peach-orders

Include Peach orders
This commit is contained in:
KoalaSat
2025-05-09 08:53:26 +00:00
committed by GitHub
12 changed files with 79 additions and 22 deletions

View File

@ -27,6 +27,7 @@ class Nostr:
# Add relays and connect
await client.add_relay("ws://localhost:7777")
await client.add_relay("ws://localhost:7778")
await client.connect()
robot_name = await self.get_robot_name(order)

View File

@ -44,7 +44,7 @@ relay {
bind = "0.0.0.0"
# Port to open for the nostr websocket protocol (restart required)
port = 7777
port = 7778
# Set OS-limit on maximum number of open files/sockets (if 0, don't attempt to set) (restart required)
nofiles = 1000000

View File

@ -56,6 +56,9 @@ const BookControl = ({
const handleHostChange = function (e: React.ChangeEvent<HTMLInputElement>): void {
const coordinator = String(e.target.value);
if (coordinator === 'any') {
federation.refreshBookHosts(coordinator !== 'any');
}
setFav({ ...fav, coordinator });
};

View File

@ -35,7 +35,7 @@ export const FederationContext = createContext<UseFederationStoreType>(initialFe
export const FederationContextProvider = ({
children,
}: FederationContextProviderProps): JSX.Element => {
const { settings, page, origin, hostUrl, open, torStatus, client } =
const { settings, page, origin, hostUrl, open, torStatus, client, fav } =
useContext<UseAppStoreType>(AppContext);
const { setMaker, garage } = useContext<UseGarageStoreType>(GarageContext);
const [federation] = useState(new Federation(origin, settings, hostUrl));
@ -57,7 +57,7 @@ export const FederationContextProvider = ({
if (client !== 'mobile' || torStatus === 'ON' || !settings.useProxy) {
void federation.updateUrl(origin, settings, hostUrl);
void federation.loadLimits();
federation.setConnection(settings);
federation.setConnection(settings, fav.coordinator);
}
}, [settings.network, settings.useProxy, torStatus, settings.connection]);

View File

@ -78,24 +78,28 @@ export class Federation {
public roboPool: RoboPool;
setConnection = (settings: Settings): void => {
setConnection = (settings: Settings, coordinator: string): void => {
this.connection = settings.connection;
this.loading = true;
this.book = {};
this.exchange.loadingCache = this.roboPool.relays.length;
if (this.connection === 'nostr') {
this.roboPool.connect();
this.loadBookNostr();
this.loadBookNostr(coordinator !== 'any');
} else {
this.roboPool.close();
void this.loadBook();
}
};
loadBookNostr = (): void => {
this.loading = true;
this.book = {};
refreshBookHosts: (robosatsOnly: boolean) => void = (robosatsOnly) => {
if (this.connection === 'nostr') {
this.loadBookNostr(robosatsOnly);
}
};
this.exchange.loadingCache = this.roboPool.relays.length;
this.roboPool.subscribeBook({
loadBookNostr = (robosatsOnly: boolean): void => {
this.roboPool.subscribeBook(robosatsOnly, {
onevent: (event) => {
const { dTag, publicOrder } = eventToPublicOrder(event);
if (publicOrder) {

View File

@ -98,10 +98,12 @@ class RoboPool {
});
};
subscribeBook = (events: RoboPoolEvents): void => {
const authors = [...Object.values(defaultFederation), ...Object.values(thirdParties)]
.map((f) => f.nostrHexPubkey)
.filter((item) => item !== undefined);
subscribeBook = (robosatsOnly: boolean, events: RoboPoolEvents): void => {
let scope = Object.values(defaultFederation);
if (!robosatsOnly) {
scope = [...scope, ...Object.values(thirdParties)];
}
const authors = scope.map((f) => f.nostrHexPubkey).filter((item) => item !== undefined);
const requestPending = [
'REQ',
@ -134,11 +136,9 @@ class RoboPool {
};
subscribeRatings = (events: RoboPoolEvents, coordinators?: string[]): void => {
const pubkeys =
coordinators ??
[...Object.values(defaultFederation), ...Object.values(thirdParties)]
.map((f) => f.nostrHexPubkey)
.filter((item) => item !== undefined);
const pubkeys = Object.values(defaultFederation)
.map((f) => f.nostrHexPubkey)
.filter((item) => item !== undefined);
const requestRatings = [
'REQ',

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -0,0 +1,15 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: 4833 9A19 645E 2E53 488E 0E54 79E1 B270 FACD 1BD2
Comment: hello@peachbitcoin.com <hello@peachbitcoin.com>
xjMEYiOtWhYJKwYBBAHaRw8BAQdAsOKDD90QG9Fsr2TQomq1plxf0QGlQdL8OXCS
TTjE+vjNL2hlbGxvQHBlYWNoYml0Y29pbi5jb20gPGhlbGxvQHBlYWNoYml0Y29p
bi5jb20+wo8EEBYKACAFAmIjrVoGCwkHCAMCBBUICgIEFgIBAAIZAQIbAwIeAQAh
CRB54bJw+s0b0hYhBEgzmhlkXi5TSI4OVHnhsnD6zRvSDwIA/A2Z1td84Fos0L8Y
180evwOWDdbbI+8N0Y7GgkoU6iUqAQCgqMyBknoPYF9pvE2RLsYYjh52tWrV9mSI
zEMoH38JAc44BGIjrVoSCisGAQQBl1UBBQEBB0AMyWxwd2kF+8Kn5A6OuYCt8OQv
YbzwKJN3Jvnr4Z+ARgMBCAfCeAQYFggACQUCYiOtWgIbDAAhCRB54bJw+s0b0hYh
BEgzmhlkXi5TSI4OVHnhsnD6zRvSw7UBAIb3PAWG2iIXEapRxLVDkEuQ+RRVn/FU
rSwNRLsCJBsqAQDI9SNIkJuqT2RcP7qeQMj0tcZk9dBV+M48OL9XqPTEDA==
=HMiR
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -9,8 +9,42 @@
"email": null,
"telegram": "https://t.me/p2plightning",
"simplex": null,
"nostr": null,
"website": "https://lnp2pbot.com"
"nostr": "https://njump.me/nprofile1qqs0es4q4yl3t7txceldxjrwkjfk6gdm88q5m6f68qff7683s8udrmqs874xa",
"website": "https://lnp2pbot.com",
"pgp": null,
"fingerprint": null
}
},
"peach": {
"longAlias": "Peach",
"federated": false,
"shortAlias": "peach",
"nostrHexPubkey": "a47457722e10ba3a271fbe7040259a3c4da2cf53bfd1e198138214d235064fc2",
"description": "The easiest way to buy & sell Bitcoin peer-to-peer.",
"contact": {
"email": "hello@peachbitcoin.com",
"telegram": "https://t.me/peachtopeach",
"simplex": null,
"nostr": "https://njump.me/nprofile1qqs2gazhwghppw36yu0muuzqykdrcndzeafml50pnqfcy9xjx5rylsss0wkz7",
"website": "https://peachbitcoin.com",
"pgp": "/static/federation/pgp/48339A19645E2E53488E0E5479E1B270FACD1BD2.asc",
"fingerprint": "48339A19645E2E53488E0E5479E1B270FACD1BD2"
}
},
"mostro": {
"longAlias": "Mostro",
"federated": false,
"shortAlias": "mostro",
"nostrHexPubkey": "82fa8cb978b43c79b2156585bac2c011176a21d2aead6d9f7c575c005be88390",
"description": "Peer-to-peer Lightning Network platform over nostr .",
"contact": {
"email": null,
"telegram": "https://t.me/mostrop2p",
"simplex": null,
"nostr": "https://njump.me/npub1m0str0d7z2ww8rdh20t2n9lx520xjwhaq24p68umqp06wwrwtsnqen40un",
"website": "https://mostro.network",
"pgp": null,
"fingerprint": null
}
}
}