Include Peach orders

This commit is contained in:
koalasat
2025-03-15 16:28:35 +01:00
parent 05d75b566f
commit 23e66ef8d4
8 changed files with 53 additions and 15 deletions

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',

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,22 @@
"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"
} }
},
"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"
}
} }
} }