mirror of
https://github.com/aljazceru/hypergolic.git
synced 2025-12-17 21:44:21 +01:00
problem: can't fetch rocket events
This commit is contained in:
110
package-lock.json
generated
110
package-lock.json
generated
@@ -10,6 +10,8 @@
|
||||
"dependencies": {
|
||||
"@internationalized/date": "^3.5.4",
|
||||
"@nostr-dev-kit/ndk": "^2.8.2",
|
||||
"@nostr-dev-kit/ndk-cache-dexie": "^2.4.2",
|
||||
"@nostr-dev-kit/ndk-svelte": "^2.2.15",
|
||||
"@sveltejs/adapter-static": "^3.0.1",
|
||||
"bits-ui": "^0.21.10",
|
||||
"clsx": "^2.1.1",
|
||||
@@ -690,6 +692,103 @@
|
||||
"websocket-polyfill": "^0.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-cache-dexie": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@nostr-dev-kit/ndk-cache-dexie/-/ndk-cache-dexie-2.4.2.tgz",
|
||||
"integrity": "sha512-ZHhaP6D0uCa7/XzZQYtu0QrF4eEpOnL9a7lcC3Nu/QmyyUiAHd+w6OEz6u5u+Rg3AgRAzDsfntJg915l5xSKBw==",
|
||||
"dependencies": {
|
||||
"@nostr-dev-kit/ndk": "2.8.2",
|
||||
"debug": "^4.3.4",
|
||||
"dexie": "^4.0.2",
|
||||
"nostr-tools": "^2.4.0",
|
||||
"typescript-lru-cache": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-cache-dexie/node_modules/@noble/ciphers": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.5.3.tgz",
|
||||
"integrity": "sha512-B0+6IIHiqEs3BPMT0hcRmHvEj2QHOLu+uwt+tqDDeVd0oyVzh7BPrDcPjRnV1PV/5LaknXJJQvOuRGR0zQJz+w==",
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-cache-dexie/node_modules/@noble/curves": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
|
||||
"integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "1.3.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-cache-dexie/node_modules/@noble/curves/node_modules/@noble/hashes": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
|
||||
"integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-cache-dexie/node_modules/@noble/hashes": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz",
|
||||
"integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==",
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-cache-dexie/node_modules/@scure/base": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz",
|
||||
"integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-cache-dexie/node_modules/nostr-tools": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.7.0.tgz",
|
||||
"integrity": "sha512-jJoL2J1CBiKDxaXZww27nY/Wsuxzx7AULxmGKFce4sskDu1tohNyfnzYQ8BvDyvkstU8kNZUAXPL32tre33uig==",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^0.5.1",
|
||||
"@noble/curves": "1.2.0",
|
||||
"@noble/hashes": "1.3.1",
|
||||
"@scure/base": "1.1.1",
|
||||
"@scure/bip32": "1.3.1",
|
||||
"@scure/bip39": "1.2.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"nostr-wasm": "v0.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": ">=5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@nostr-dev-kit/ndk-svelte": {
|
||||
"version": "2.2.15",
|
||||
"resolved": "https://registry.npmjs.org/@nostr-dev-kit/ndk-svelte/-/ndk-svelte-2.2.15.tgz",
|
||||
"integrity": "sha512-Ev/r2ccefXDH2u+GyONvdkp4Ij9ilbS5trZRsXyT2G+BRqWZfKE+3wtslUMueKYUcrt0EFVFIexvN9amDy6mbw==",
|
||||
"dependencies": {
|
||||
"@nostr-dev-kit/ndk": "2.8.2",
|
||||
"svelte": "^4.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgjs/parseargs": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
||||
@@ -1783,6 +1882,11 @@
|
||||
"resolved": "https://registry.npmjs.org/devalue/-/devalue-5.0.0.tgz",
|
||||
"integrity": "sha512-gO+/OMXF7488D+u3ue+G7Y4AA3ZmUnB3eHJXmBTgNHvr4ZNzl36A0ZtG+XCRNYCkYx/bFmw4qtkoFLa+wSrwAA=="
|
||||
},
|
||||
"node_modules/dexie": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmjs.org/dexie/-/dexie-4.0.7.tgz",
|
||||
"integrity": "sha512-M+Lo6rk4pekIfrc2T0o2tvVJwL6EAAM/B78DNfb8aaxFVoI1f8/rz5KTxuAnApkwqTSuxx7T5t0RKH7qprapGg=="
|
||||
},
|
||||
"node_modules/didyoumean": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
|
||||
@@ -2793,6 +2897,12 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/nostr-wasm": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.1.0.tgz",
|
||||
"integrity": "sha512-78BTryCLcLYv96ONU8Ws3Q1JzjlAt+43pWQhIl86xZmWeegYCNLPml7yQ+gG3vR6V5h4XGj+TxO+SS5dsThQIA==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
"dependencies": {
|
||||
"@internationalized/date": "^3.5.4",
|
||||
"@nostr-dev-kit/ndk": "^2.8.2",
|
||||
"@nostr-dev-kit/ndk-cache-dexie": "^2.4.2",
|
||||
"@nostr-dev-kit/ndk-svelte": "^2.2.15",
|
||||
"@sveltejs/adapter-static": "^3.0.1",
|
||||
"bits-ui": "^0.21.10",
|
||||
"clsx": "^2.1.1",
|
||||
|
||||
24
src/lib/ndk.ts
Normal file
24
src/lib/ndk.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import NDKSvelte from '@nostr-dev-kit/ndk-svelte';
|
||||
import NDKCacheAdapterDexie from '@nostr-dev-kit/ndk-cache-dexie';
|
||||
|
||||
import { writable } from 'svelte/store';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
const _ndk = new NDKSvelte({
|
||||
explicitRelayUrls: [
|
||||
'wss://purplepag.es',
|
||||
'wss://relay.nostr.band',
|
||||
'wss://nos.lol',
|
||||
'wss://relay.nostrocket.org'
|
||||
],
|
||||
enableOutboxModel: false,
|
||||
clientName: 'nostrocket'
|
||||
//clientNip89: "31990:fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52:1716498133442",
|
||||
});
|
||||
|
||||
//we need to check for browser environment before calling window because svelte is slightly retarded when used client side only
|
||||
if (browser && window.indexedDB) {
|
||||
_ndk.cacheAdapter = new NDKCacheAdapterDexie({ dbName: 'gulag' });
|
||||
}
|
||||
|
||||
export const ndk = writable(_ndk);
|
||||
11
src/lib/stores/session.ts
Normal file
11
src/lib/stores/session.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { NDKEvent, NDKUser } from "@nostr-dev-kit/ndk";
|
||||
import type NDKSvelte from "@nostr-dev-kit/ndk-svelte";
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
export const currentUser = writable<NDKUser | undefined>(undefined);
|
||||
|
||||
export async function prepareUserSession(ndk: NDKSvelte, user: NDKUser): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
//implement any session set up stuff here
|
||||
});
|
||||
}
|
||||
@@ -1,11 +1,34 @@
|
||||
<script>
|
||||
import { RocketSolid } from 'svelte-awesome-icons';
|
||||
import '../app.css';
|
||||
<script lang="ts">
|
||||
import { ModeWatcher } from 'mode-watcher';
|
||||
import '../app.css';
|
||||
import SidePanelLayout from '../layouts/SidePanelLayout.svelte';
|
||||
import { ndk } from '@/ndk';
|
||||
import type { NDKUser } from '@nostr-dev-kit/ndk';
|
||||
import { currentUser, prepareUserSession } from '@/stores/session';
|
||||
|
||||
let sessionStarted = false;
|
||||
let connected = false;
|
||||
let user: NDKUser | undefined;
|
||||
|
||||
$ndk.connect(5000).then(() => {
|
||||
connected = true;
|
||||
});
|
||||
|
||||
$: if (connected && !sessionStarted && $ndk.signer) {
|
||||
$ndk.signer.user().then((u) => {
|
||||
$currentUser = u;
|
||||
user = u;
|
||||
prepareUserSession($ndk, user).then(() => {
|
||||
sessionStarted = true;
|
||||
});
|
||||
});
|
||||
sessionStarted = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<ModeWatcher />
|
||||
<SidePanelLayout>
|
||||
<div slot="content"><slot></slot></div>
|
||||
</SidePanelLayout>
|
||||
|
||||
<style></style>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script>
|
||||
|
||||
import Rockets from "../../views/rockets/Rockets.svelte";
|
||||
|
||||
|
||||
</script>
|
||||
<Rockets />
|
||||
8
src/routes/rockets/[id]/+page.svelte
Normal file
8
src/routes/rockets/[id]/+page.svelte
Normal file
@@ -0,0 +1,8 @@
|
||||
<script>
|
||||
|
||||
import { page } from "$app/stores";
|
||||
//flow: fetch all 31108's with this d-tag, sort by WoT, put Nostrocket Name Service one at the top. Dedupe same rocket (same state, shadows) from multiple users, just show them all as everyone agreeing.
|
||||
//second pass: fetch ignition event for each, rebuild current state and validate all proofs, compute votepower and display only the states with > 50%.
|
||||
|
||||
</script>
|
||||
{$page.params.id}
|
||||
@@ -1,9 +1,25 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import type { NDKEventStore } from '@nostr-dev-kit/ndk-svelte';
|
||||
import Heading from '../../components/Heading.svelte';
|
||||
import SidePanelLayout from '../../layouts/SidePanelLayout.svelte';
|
||||
import type { NDKEvent } from '@nostr-dev-kit/ndk';
|
||||
import { onDestroy } from 'svelte';
|
||||
import { ndk } from '@/ndk';
|
||||
//flow: fetch all 31108's. For now, just validate that the author is the same as the ignition author. If naming conflicts, look for namerocket listing.
|
||||
|
||||
let entries: NDKEventStore<NDKEvent> | undefined;
|
||||
onDestroy(() => {
|
||||
entries?.unsubscribe();
|
||||
});
|
||||
|
||||
entries = $ndk.storeSubscribe([{ kinds: [31108 as number] }], { subId: 'rockets' });
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<Heading title="Rockets" />
|
||||
{#if entries && $entries}
|
||||
{#each $entries as e} <div on:click={()=>{console.log(e.rawEvent())}}>{e.tags}</div> <br /> {/each}
|
||||
{/if}
|
||||
<div
|
||||
class="max-w-sm rounded-lg border border-gray-200 bg-white shadow dark:border-gray-700 dark:bg-gray-800"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user