bump banani version to fix bug; seed confirm page

This commit is contained in:
stjet
2025-01-16 20:46:00 +00:00
parent 44d1b9defd
commit b76e9c09fd
7 changed files with 62 additions and 28 deletions

42
package-lock.json generated
View File

@@ -8,8 +8,8 @@
"name": "test",
"version": "0.0.1",
"dependencies": {
"banani": "^1.0.3",
"banani-bns": "^0.0.6",
"banani": "^1.0.5",
"banani-bns": "^0.0.9",
"mongodb": "^6.10.0",
"qrcode": "^1.5.4"
},
@@ -833,9 +833,9 @@
}
},
"node_modules/@sveltejs/kit": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.7.3.tgz",
"integrity": "sha512-Vx7nq5MJ86I8qXYsVidC5PX6xm+uxt8DydvOdmJoyOK7LvGP18OFEG359yY+aa51t6pENvqZAMqAREQQx1OI2Q==",
"version": "2.15.2",
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.15.2.tgz",
"integrity": "sha512-p208T1kdM6zd8k4YXIUM60pLWQ8dZqehXSiqn4NulXHyHibX53uIAL2xtNL8GjxX2IVPqPRT978MwVYhCKExdQ==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
@@ -843,7 +843,7 @@
"@types/cookie": "^0.6.0",
"cookie": "^0.6.0",
"devalue": "^5.1.0",
"esm-env": "^1.0.0",
"esm-env": "^1.2.1",
"import-meta-resolve": "^4.1.0",
"kleur": "^4.1.5",
"magic-string": "^0.30.5",
@@ -860,9 +860,9 @@
"node": ">=18.13"
},
"peerDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1",
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0",
"svelte": "^4.0.0 || ^5.0.0-next.0",
"vite": "^5.0.3"
"vite": "^5.0.3 || ^6.0.0"
}
},
"node_modules/@sveltejs/vite-plugin-svelte": {
@@ -1120,20 +1120,20 @@
"license": "MIT"
},
"node_modules/banani": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/banani/-/banani-1.0.3.tgz",
"integrity": "sha512-2hr3RUXWRUE9yOMH6wlJYaRdwdFUAjWQ8eHz2QRcYHKWjs+b9wnJ0bgAi85DFVKArQtJ3cFZ8oq/TDVB5GHWVw==",
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/banani/-/banani-1.0.6.tgz",
"integrity": "sha512-wB4nijscW0g18aojQqOm4Lqghg9TDHGQe+AnravbZoH37c3fJXSgQV+pKzBqpT3VIzcASfOjFyAqmUsTDWREHA==",
"license": "MIT",
"dependencies": {
"blake2b": "^2.1.4"
}
},
"node_modules/banani-bns": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/banani-bns/-/banani-bns-0.0.6.tgz",
"integrity": "sha512-zLzw2U3TEEKTvyw1ohCJItR4cURb4PODt4wvBj/2YPmqr+TcUBpsE2DU3PryQ3EuE/887BEmmm7fMaC5JoKw9g==",
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/banani-bns/-/banani-bns-0.0.9.tgz",
"integrity": "sha512-G9eRXk24ykHLqSCr2LgqNHyUvuzye0VTpNMZdyD4/8HtZRU05Pv1Dbk1lbINkz0ZVf1Y2Jl6dF0ivXMLWBqIRA==",
"dependencies": {
"banani": "^1.0.3"
"banani": "^1.0.4"
}
},
"node_modules/bindings": {
@@ -1410,9 +1410,9 @@
}
},
"node_modules/esm-env": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.1.4.tgz",
"integrity": "sha512-oO82nKPHKkzIj/hbtuDYy/JHqBHFlMIW36SDiPCVsj87ntDLcWN+sJ1erdVryd4NxODacFTsdrIE3b7IamqbOg==",
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz",
"integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==",
"dev": true,
"license": "MIT"
},
@@ -1928,9 +1928,9 @@
"license": "ISC"
},
"node_modules/nanoid": {
"version": "3.3.7",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
"dev": true,
"funding": [
{

View File

@@ -20,8 +20,8 @@
"vite": "^5.0.3"
},
"dependencies": {
"banani": "^1.0.3",
"banani-bns": "^0.0.6",
"banani": "^1.0.7",
"banani-bns": "^0.0.9",
"mongodb": "^6.10.0",
"qrcode": "^1.5.4"
}

View File

@@ -0,0 +1,31 @@
<script lang="ts">
import { Progress } from "$lib/types";
let { bsf_seed, progress = $bindable() } = $props();
let user_seed: String = $state("");
function continue_to_payment() {
if (user_seed.trim() === bsf_seed) {
progress = Progress.Payment;
} else {
alert(`Seed doesn't match! Your seed is ${bsf_seed}`);
}
}
</script>
<p>Confirm the seed you just saved:</p>
<input type="text" bind:value={user_seed}/>
<br>
<br>
<button class="button" onclick={continue_to_payment}>Continue</button>
<style>
p {
margin-bottom: 15px;
}
input {
min-width: 50vw;
}
</style>

View File

@@ -3,14 +3,14 @@
let { bsf_seed, progress = $bindable() } = $props();
function continue_to_payment() {
progress = Progress.Payment;
function continue_to_confirm() {
progress = Progress.ConfirmSeed;
}
</script>
<p>Save the seed and continue.</p>
<p>Seed (in BNS Seed Format): <code>{bsf_seed}</code></p>
<button class="button" onclick={continue_to_payment}>Continue</button>
<button class="button" onclick={continue_to_confirm}>Continue</button>
<style>
p {
@@ -18,4 +18,3 @@
}
</style>

View File

@@ -1,5 +1,6 @@
export enum Progress {
Seed = "seed",
ConfirmSeed = "confirm_seed",
Payment = "payment",
Declare = "declare",
Done = "done",

View File

@@ -30,7 +30,7 @@ export const POST: RequestHandler = async ({ request }) => {
const receive_wallet = new Wallet(rpc, found.receive_seed);
await receive_wallet.receive_all();
await sleep(1500);
const balance = Number(raw_to_whole((await rpc.get_account_balance(receive_wallet.address)).balance));
const balance = Number(raw_to_whole(BigInt((await rpc.get_account_balance(receive_wallet.address)).balance)));
if (balance < found.price) {
return error(500, `Need to be sent ${found.price}, only got ${balance}`);
}

View File

@@ -4,6 +4,7 @@
import { Progress } from "$lib/types";
import Seed from "$lib/Seed.svelte";
import ConfirmSeed from "$lib/ConfirmSeed.svelte";
import Payment from "$lib/Payment.svelte";
import Declare from "$lib/Declare.svelte";
@@ -40,6 +41,8 @@
<div class="middle">
{#if progress === Progress.Seed}
<Seed bind:progress {bsf_seed}/>
{:else if progress === Progress.ConfirmSeed}
<ConfirmSeed bind:progress {bsf_seed}/>
{:else if progress === Progress.Payment}
<Payment bind:progress {domain} {payment_address} {send_to_pub_key}/>
{:else if progress === Progress.Declare}