diff --git a/web/package.json b/web/package.json index 796156e..eb55986 100644 --- a/web/package.json +++ b/web/package.json @@ -9,8 +9,7 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "test": "vitest", - "lint": "echo TODO", - "lint:temp": "prettier --check . && eslint .", + "lint": "prettier --check . && eslint .", "format": "prettier --write ." }, "devDependencies": { @@ -44,7 +43,7 @@ }, "type": "module", "dependencies": { - "@floating-ui/dom": "1.6.5", + "@floating-ui/dom": "^1.6.5", "date-fns": "^3.6.0", "highlight.js": "11.9.0", "mipd": "^0.0.7", diff --git a/web/src/app.postcss b/web/src/app.postcss index 8ef7d35..b9fb4b6 100644 --- a/web/src/app.postcss +++ b/web/src/app.postcss @@ -1,3 +1,5 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Roboto:wght@100&display=swap'); + @tailwind base; @tailwind components; @tailwind utilities; diff --git a/web/src/lib/components/Account.svelte b/web/src/lib/components/Account.svelte new file mode 100644 index 0000000..0260067 --- /dev/null +++ b/web/src/lib/components/Account.svelte @@ -0,0 +1,57 @@ + + +
+
+
+
+ Hello + {#await address} + 0x.... + {:then result} + {result[0]} + {:catch error} + - {JSON.stringify(error)} + {/await} +
+
+
+
+ +
+
+
+
diff --git a/web/src/lib/components/ConnectView.svelte b/web/src/lib/components/ConnectView.svelte deleted file mode 100644 index 0d61cf7..0000000 --- a/web/src/lib/components/ConnectView.svelte +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/web/src/lib/components/DrawerManager.svelte b/web/src/lib/components/DrawerManager.svelte new file mode 100644 index 0000000..e9d842d --- /dev/null +++ b/web/src/lib/components/DrawerManager.svelte @@ -0,0 +1,44 @@ + + + +
+
+
+
+
+ {$drawerStore.meta.title || '(missing title)'} +
+
+
+
+ +
+
+ {#if $drawerStore.id === 'SendTokens'} + + {:else if $drawerStore.id === 'SubmitQuota'} + + {:else} + + {/if} +
+
diff --git a/web/src/lib/components/Facepile.svelte b/web/src/lib/components/Facepile.svelte new file mode 100644 index 0000000..c3d264d --- /dev/null +++ b/web/src/lib/components/Facepile.svelte @@ -0,0 +1,27 @@ + + +
+ {#each list as item} + {item.name} + {/each} +
diff --git a/web/src/lib/components/Header.svelte b/web/src/lib/components/Header.svelte new file mode 100644 index 0000000..48d8145 --- /dev/null +++ b/web/src/lib/components/Header.svelte @@ -0,0 +1,32 @@ + + + + +
+
+ Joke Logo +
+
+ Gopher Demo +
+
+
+ + + + GitHub + + +
diff --git a/web/src/lib/components/Portfolio.svelte b/web/src/lib/components/Portfolio.svelte new file mode 100644 index 0000000..5db05d2 --- /dev/null +++ b/web/src/lib/components/Portfolio.svelte @@ -0,0 +1,107 @@ + + +
+ +
+
+
Balance
+
+ {#await total} +
+ {:then result} + ${result.toFixed(2)} + {:catch error} + - {JSON.stringify(error)} + {/await} +
+
+
+
+ +
+
Portfolio
+
+ + + + + + + + + + + {#await promise} + + {#each { length: 3 } as _} + + + + + + {/each} + {:then data} + {#each data.tokens as token, i} + handleListClick(i)} + > + + + + + {/each} + {:catch error} +

{error.message}

+ {/await} + +
ASSETBALANCEDISTRIBUTION
+
+ {`${token.logoURI}-LOGO`} +
+
+
{token.name}
+
+
+ {fromWei(token.total, token.decimals)} + {token.symbol} + + +
+
+
+
diff --git a/web/src/lib/components/RequestSendModal.svelte b/web/src/lib/components/RequestSendModal.svelte deleted file mode 100644 index d67370a..0000000 --- a/web/src/lib/components/RequestSendModal.svelte +++ /dev/null @@ -1,131 +0,0 @@ - - -{#if $modalStore[0]} - -{/if} diff --git a/web/src/lib/components/ResponseSendModal.svelte b/web/src/lib/components/ResponseSendModal.svelte deleted file mode 100644 index f16f34e..0000000 --- a/web/src/lib/components/ResponseSendModal.svelte +++ /dev/null @@ -1,177 +0,0 @@ - - -{#if $modalStore[0]} - -{/if} diff --git a/web/src/lib/components/SendTokensDrawer.svelte b/web/src/lib/components/SendTokensDrawer.svelte new file mode 100644 index 0000000..16b5962 --- /dev/null +++ b/web/src/lib/components/SendTokensDrawer.svelte @@ -0,0 +1,240 @@ + + +
+
+ Amount +
+
+
+
+
+
+
+ + + + +
+ + {#each $drawerStore.meta.tokens.values() as token} + + {token.name} + {token.name} + + {/each} + +
+
+
+
+
+
+
+ +
+
+ Destination network +
+
+
+ +
+ + + + + +
+
+ Advanced methods +
+
+
+ +
+
+
+ set custom threshold +
+ +
+ + + WHITELIST A NETWORK + + + {#each balances as balance} + + + {`${balance.chainId}-LOGO`} + + {$drawerStore.meta.networks.get(balance.chainId).name} + + {fromWei(balance.balance, tokenInfo.decimals)} + + + {/each} + + + + +
+
+
+
+ +
+
+ +
+
diff --git a/web/src/lib/components/SubmitTokensDrawer.svelte b/web/src/lib/components/SubmitTokensDrawer.svelte new file mode 100644 index 0000000..71ccaff --- /dev/null +++ b/web/src/lib/components/SubmitTokensDrawer.svelte @@ -0,0 +1,180 @@ + + +
+
+ Quotas +
+
+ +
+
    + {#await quota} +
  • +
    +
  • + {:then response} + {#each response.data as data, index} + {@const network = $drawerStore.meta.networks.get(data.sourceChain)} + {@const balance = $drawerStore.meta.balances + .get(token.symbol) + .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} + {:catch error} +

    {error.message}

    + {/await} +
+
+ +
+ +
diff --git a/web/src/lib/components/TokenList.svelte b/web/src/lib/components/TokenList.svelte deleted file mode 100644 index b4e107d..0000000 --- a/web/src/lib/components/TokenList.svelte +++ /dev/null @@ -1,85 +0,0 @@ - - -{#await promise} -

...waiting

-{:then data} - -
- - - - - - - - - {#each data.tokens as token, i} - handleListClick(i)}> - - - - - {/each} - -
- Token - Balance
{`${token.logoURI}-LOGO`}{token.name} - {fromWei(token.total, token.decimals)}
-
-{:catch error} -

{error.message}

-{/await} diff --git a/web/src/lib/components/Web3Modal.svelte b/web/src/lib/components/Web3Modal.svelte deleted file mode 100644 index f5530cf..0000000 --- a/web/src/lib/components/Web3Modal.svelte +++ /dev/null @@ -1,51 +0,0 @@ - - -{#if $modalStore[0]} - -{/if} diff --git a/web/src/lib/hacks.ts b/web/src/lib/hacks.ts index e105a48..b69e59e 100644 --- a/web/src/lib/hacks.ts +++ b/web/src/lib/hacks.ts @@ -29,13 +29,13 @@ function getProvider() { return storeProvider.provider; } -export async function hacks_getGopherData(): Promise { +export async function hacks_getGopherData(): Promise { const networksResponse = await fetch('https://gopher.test.buildwithsygma.com/networks').then( (r) => r.json() ); const networks = networksResponse.data.reduce( (prev, network) => prev.set(network.chainID, network), - new Map() + new Map() ); const fungibleResponses = await Promise.all( @@ -48,7 +48,7 @@ export async function hacks_getGopherData(): Promise { ) ); - const tokens = new Map(); + const tokens = new Map(); fungibleResponses.forEach((response) => { response.data.forEach((asset) => { if (tokens.has(asset.symbol)) return; @@ -65,7 +65,7 @@ export async function hacks_getGopherData(): Promise { ) ); - const balances = new Map(); + const balances = new Map(); balancesResponses.forEach((balance) => { balances.set(balance.symbol, balance.data); }); @@ -81,7 +81,7 @@ export async function hacks_getGopherData(): Promise { return { raw: { networks, tokens, balances }, tokens: tokensData }; } -export async function hacks_getQuota(value: Object) { +export async function hacks_getQuota(value: object) { const url = new URL('https://gopher.test.buildwithsygma.com/solutions/aggregation'); const account = await getProvider().request({ method: 'eth_requestAccounts', params: [] }); diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index 885d787..3257d39 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -1,56 +1,106 @@ + + + {@html ''} + + + - - - Gopher POC - - - - - GitHub - - - +
+ + - + {#if $selectedProvider} + + {:else} +
+
+

Welcome to Gopher POC.

+
+

Please select wallet

+
+
    + {#if !$providers.length} + No wallets Found GET ONE! + {:else} + {#each $providers as provider} + +
  • selectWallet(provider)} + class="relative bg-white dark:bg-gray-800 p-4 rounded-lg shadow hover:bg-gray-100 dark:hover:bg-gray-700 hover:shadow-lg transition duration-300 flex items-center cursor-pointer" + > + {provider.info.icon} Icon +
    +

    + {provider.info.name} +

    +

    {provider.info.rdns}

    +
    +
  • + {/each} + {/if} +
+
+
+
+ {/if} diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 4a0c24d..6c7ac34 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -1,17 +1,15 @@
- {#if $selectedProvider} - - {:else} -

Welcome to Gopher POC.

- - {/if} + +
diff --git a/yarn.lock b/yarn.lock index fe51af1..8106ddb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -551,7 +551,7 @@ __metadata: languageName: node linkType: hard -"@floating-ui/dom@npm:1.6.5": +"@floating-ui/dom@npm:^1.6.5": version: 1.6.5 resolution: "@floating-ui/dom@npm:1.6.5" dependencies: @@ -6543,7 +6543,7 @@ __metadata: version: 0.0.0-use.local resolution: "web@workspace:web" dependencies: - "@floating-ui/dom": 1.6.5 + "@floating-ui/dom": ^1.6.5 "@skeletonlabs/skeleton": 2.10.0 "@skeletonlabs/tw-plugin": 0.4.0 "@sveltejs/adapter-cloudflare": ^4.4.0