From fb88c9bf09cbcf838cac8e30c9ceb2da2045553e Mon Sep 17 00:00:00 2001 From: BeroBurny Date: Thu, 11 Jul 2024 14:28:21 +0200 Subject: [PATCH 01/12] display name from sepolia sprinter name service --- web/src/lib/components/Account.svelte | 25 +++- web/src/lib/sprinterNameService.abi.ts | 185 +++++++++++++++++++++++++ 2 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 web/src/lib/sprinterNameService.abi.ts diff --git a/web/src/lib/components/Account.svelte b/web/src/lib/components/Account.svelte index 2039299..bb0721d 100644 --- a/web/src/lib/components/Account.svelte +++ b/web/src/lib/components/Account.svelte @@ -1,9 +1,26 @@
{:else} - {#each response as data, index} + {#each response as data} {@const network = getNetworkByChainId($drawerStore.meta.chains, data.sourceChain)} {@const balance = $drawerStore.meta.balances.find( ({ chainId }) => chainId === data.sourceChain )} -
  • -
    - Source Chain Icon -
    -

    - {fromWei(data.amount, token.decimals)} - {token.name} on {network.name} -

    -

    - Balance: {fromWei(balance.balance, token.decimals)} - {token.name} -

    -

    - Fee: {data.fee.amountUSD} USD -

    -
    -
    -
    - {#if !successful[index]} - -

    - Estimated Time {formatDuration(data.duration)} -

    - {:else} - - - - {/if} -
    -
  • + {/each} {/if} {:catch error} diff --git a/web/src/lib/components/TransactionCard.svelte b/web/src/lib/components/TransactionCard.svelte new file mode 100644 index 0000000..687302f --- /dev/null +++ b/web/src/lib/components/TransactionCard.svelte @@ -0,0 +1,125 @@ + + +
  • +
    + Source Chain Icon +
    +

    + {fromWei(data.amount, token.decimals)} + {token.name} on {chain.name} +

    +

    + Balance: {balance} + {token.name} +

    +

    + Fee: {data.fee.amountUSD} USD +

    +
    +
    +
    + {#if !successful} + +

    + Estimated Time {formatDuration(data.duration)} +

    + {:else} + + + + {/if} +
    +
  • From d185ffc99db127294936b939554e4ca0c5c79158 Mon Sep 17 00:00:00 2001 From: BeroBurny Date: Thu, 18 Jul 2024 15:58:23 +0200 Subject: [PATCH 04/12] save 1 --- web/src/lib/components/Account.svelte | 32 ++++- web/src/lib/components/UpdateNameModal.svelte | 111 ++++++++++++++++++ 2 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 web/src/lib/components/UpdateNameModal.svelte diff --git a/web/src/lib/components/Account.svelte b/web/src/lib/components/Account.svelte index bb0721d..32369d1 100644 --- a/web/src/lib/components/Account.svelte +++ b/web/src/lib/components/Account.svelte @@ -1,8 +1,14 @@
    @@ -69,6 +86,17 @@ Send
    +
    + +
    diff --git a/web/src/lib/components/UpdateNameModal.svelte b/web/src/lib/components/UpdateNameModal.svelte new file mode 100644 index 0000000..5abe3fe --- /dev/null +++ b/web/src/lib/components/UpdateNameModal.svelte @@ -0,0 +1,111 @@ + + +{#if $modalStore[0]} + +{/if} From fc7262cde6c4595f0bd3c695f030cde79ea90446 Mon Sep 17 00:00:00 2001 From: BeroBurny Date: Tue, 23 Jul 2024 17:08:39 +0200 Subject: [PATCH 05/12] implement tx transaction --- web/src/lib/components/Account.svelte | 2 +- web/src/lib/components/UpdateNameModal.svelte | 140 +++++++++++------- web/src/lib/stores/sprinter.ts | 2 + 3 files changed, 93 insertions(+), 51 deletions(-) diff --git a/web/src/lib/components/Account.svelte b/web/src/lib/components/Account.svelte index 32369d1..49649a4 100644 --- a/web/src/lib/components/Account.svelte +++ b/web/src/lib/components/Account.svelte @@ -9,6 +9,7 @@ import { Web3 } from 'web3'; import { sprinterNameServiceAbi } from '$lib/sprinterNameService.abi'; import UpdateNameModal from '$lib/components/UpdateNameModal.svelte'; + import { SPRINTER_SEPOLIA_ADDRESS } from '$lib/stores/sprinter'; $: address = $selectedProvider.provider.request({ method: 'eth_requestAccounts', params: [] }); @@ -16,7 +17,6 @@ const SEPOLIA_RPC_PROVIDER = 'https://ethereum-sepolia-rpc.publicnode.com'; const web3 = new Web3(SEPOLIA_RPC_PROVIDER); - const SPRINTER_SEPOLIA_ADDRESS = '0x01D6Dbd6663f2a19aaec09381D3e3826Cdf96C4E'; const sprinterNameService = new web3.eth.Contract( sprinterNameServiceAbi, SPRINTER_SEPOLIA_ADDRESS diff --git a/web/src/lib/components/UpdateNameModal.svelte b/web/src/lib/components/UpdateNameModal.svelte index 5abe3fe..de80d53 100644 --- a/web/src/lib/components/UpdateNameModal.svelte +++ b/web/src/lib/components/UpdateNameModal.svelte @@ -1,11 +1,14 @@ @@ -71,38 +75,74 @@ {$modalStore[0].title ?? '(title missing)'} -
    -
    -
    - set display name + {#if transactions.length} + {#await Promise.all([chains, balances, token])} + ... + {:then [_chains, _balances, _token]} +
    +
      + {#each transactions as data} + {@const network = getNetworkByChainId(_chains, data.sourceChain)} + {@const balance = _balances.find(({ chainId }) => chainId === data.sourceChain)} + + {/each} +
    +
    + {/await} + {:else} +
    + {#if hasError} +
    + +
    +

    Something went wrong

    +

    + Possible to low donation or insufficient funds.
    Try again with different + donation value +

    +
    +
    +
    + {/if} +
    +
    + set display name +
    +
    - -
    -
    -
    - name upholding donation in USDC +
    +
    + name upholding donation in USDC +
    +
    - -
    -
    + + {/if}