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 # Add relays and connect
await client.add_relay("ws://localhost:7777") await client.add_relay("ws://localhost:7777")
await client.add_relay("ws://localhost:7778")
await client.connect() await client.connect()
robot_name = await self.get_robot_name(order) robot_name = await self.get_robot_name(order)

View File

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

View File

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

View File

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

View File

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

View File

@ -98,10 +98,12 @@ class RoboPool {
}); });
}; };
subscribeBook = (events: RoboPoolEvents): void => { subscribeBook = (robosatsOnly: boolean, events: RoboPoolEvents): void => {
const authors = [...Object.values(defaultFederation), ...Object.values(thirdParties)] let scope = Object.values(defaultFederation);
.map((f) => f.nostrHexPubkey) if (!robosatsOnly) {
.filter((item) => item !== undefined); scope = [...scope, ...Object.values(thirdParties)];
}
const authors = scope.map((f) => f.nostrHexPubkey).filter((item) => item !== undefined);
const requestPending = [ const requestPending = [
'REQ', 'REQ',
@ -134,11 +136,9 @@ class RoboPool {
}; };
subscribeRatings = (events: RoboPoolEvents, coordinators?: string[]): void => { subscribeRatings = (events: RoboPoolEvents, coordinators?: string[]): void => {
const pubkeys = const pubkeys = Object.values(defaultFederation)
coordinators ?? .map((f) => f.nostrHexPubkey)
[...Object.values(defaultFederation), ...Object.values(thirdParties)] .filter((item) => item !== undefined);
.map((f) => f.nostrHexPubkey)
.filter((item) => item !== undefined);
const requestRatings = [ const requestRatings = [
'REQ', '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, "email": null,
"telegram": "https://t.me/p2plightning", "telegram": "https://t.me/p2plightning",
"simplex": null, "simplex": null,
"nostr": null, "nostr": "https://njump.me/nprofile1qqs0es4q4yl3t7txceldxjrwkjfk6gdm88q5m6f68qff7683s8udrmqs874xa",
"website": "https://lnp2pbot.com" "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
} }
} }
} }