diff --git a/src/abi-types.ts b/src/abi-types.ts index 7770a8fa..309d40c5 100644 --- a/src/abi-types.ts +++ b/src/abi-types.ts @@ -121,6 +121,24 @@ export class REXDeposit extends Struct { @Struct.field('asset') amount!: Asset } +@Struct.type('rexwithdraw') +export class REXWithdraw extends Struct { + @Struct.field('name') owner!: Name + @Struct.field('asset') amount!: Asset +} + +@Struct.type('rexbuyrex') +export class REXBUYREX extends Struct { + @Struct.field('name') from!: Name + @Struct.field('asset') amount!: Asset +} + +@Struct.type('rexsellrex') +export class REXSELLREX extends Struct { + @Struct.field('name') from!: Name + @Struct.field('asset') rex!: Asset +} + @Struct.type('rexrentcpu') export class REXRentCPU extends Struct { @Struct.field('name') from!: Name diff --git a/src/app.svelte b/src/app.svelte index b6c8a310..3533c14d 100644 --- a/src/app.svelte +++ b/src/app.svelte @@ -8,6 +8,7 @@ import Login from '~/pages/login.svelte' import Dashboard from '~/pages/dashboard/index.svelte' + import Earn from '~/pages/earn/index.svelte' import Request from '~/pages/request/index.svelte' import Send from '~/pages/send/index.svelte' import TokensPurchase from '~/pages/tokens/purchase/index.svelte' @@ -178,6 +179,9 @@ + + + diff --git a/src/components/elements/input/token/selector.svelte b/src/components/elements/input/token/selector.svelte index ddf1bedf..e66d60cc 100644 --- a/src/components/elements/input/token/selector.svelte +++ b/src/components/elements/input/token/selector.svelte @@ -1,6 +1,5 @@ + + + + +
+
+
+
+
(thumbHover = true)} + on:mouseout={() => (thumbHover = false)} + > + {#if holding || thumbHover} +
+ {value + ' %'} +
+ {/if} +
+
+
+
+ + + + diff --git a/src/components/layout/navigation/index.svelte b/src/components/layout/navigation/index.svelte index 4f77dd0c..8fc5816c 100644 --- a/src/components/layout/navigation/index.svelte +++ b/src/components/layout/navigation/index.svelte @@ -30,6 +30,12 @@ name: 'Transfer', path: '/transfer', }, + { + icon: 'battery-charging', + name: 'Earn', + path: '/earn', + }, + ...(banxaIsAvailable($activeBlockchain) ? [ { diff --git a/src/pages/earn/components/label.svelte b/src/pages/earn/components/label.svelte new file mode 100644 index 00000000..a0ad8cf6 --- /dev/null +++ b/src/pages/earn/components/label.svelte @@ -0,0 +1,53 @@ + + + + +
+
+

{header}

+ {#if subheader} +

{subheader}

+ {/if} +
+ +
+ +
+ {#if changeStep} +
+ +
+ {/if} +
diff --git a/src/pages/earn/components/progress.svelte b/src/pages/earn/components/progress.svelte new file mode 100644 index 00000000..c277f404 --- /dev/null +++ b/src/pages/earn/components/progress.svelte @@ -0,0 +1,27 @@ + + + + +
+
+
+
diff --git a/src/pages/earn/index.svelte b/src/pages/earn/index.svelte new file mode 100644 index 00000000..e55c8a48 --- /dev/null +++ b/src/pages/earn/index.svelte @@ -0,0 +1,270 @@ + + + + + + + {#if $step === Step.Error} + switchStep($defaultStep)} /> + {:else if $step === Step.Bootstrap} + toStakeConfirm(Step.Bootstrap)} + /> + {:else if $step === Step.Overview} + switchStep(Step.Stake)} + toUnstake={() => switchStep(Step.Unstake)} + /> + {:else if $step === Step.Stake} + toStakeConfirm(Step.Stake)} + /> + {:else if $step === Step.Unstake} + toStakeConfirm(Step.Unstake)} + /> + {:else if $step === Step.Confirm} + + {/if} + + diff --git a/src/pages/earn/step/bootstrap.svelte b/src/pages/earn/step/bootstrap.svelte new file mode 100644 index 00000000..5d44e0bb --- /dev/null +++ b/src/pages/earn/step/bootstrap.svelte @@ -0,0 +1,124 @@ + + + + +
+
+
How to Earn
+
Earn by staking
+
+
+
+
+ selected amount to stake + + +
+ +
+ +
+
+
+
diff --git a/src/pages/earn/step/confirm.svelte b/src/pages/earn/step/confirm.svelte new file mode 100644 index 00000000..3af52a39 --- /dev/null +++ b/src/pages/earn/step/confirm.svelte @@ -0,0 +1,128 @@ + + + + +
+
+
{action}
+
Review and sign
+ +
+
+ + {action} + + +
+ + + + {amount.value} +
+ {#if usd} +
≈ $ {usd} USD
+ {/if} +
+
+
+ +
+
diff --git a/src/pages/earn/step/error.svelte b/src/pages/earn/step/error.svelte new file mode 100644 index 00000000..7db1791c --- /dev/null +++ b/src/pages/earn/step/error.svelte @@ -0,0 +1,59 @@ + + + + +
+
+

Transfer Failed

+
+ +
+

+ {error} +

+
+ +
+ +
+
diff --git a/src/pages/earn/step/overview.svelte b/src/pages/earn/step/overview.svelte new file mode 100644 index 00000000..097b7430 --- /dev/null +++ b/src/pages/earn/step/overview.svelte @@ -0,0 +1,126 @@ + + + + +
+
+
How to Earn
+
Earn by staking
+
+
+
+
currently staked balance
+
+ {rexBalance} +
+
+ + +
+
+
+
+
diff --git a/src/pages/earn/step/stake.svelte b/src/pages/earn/step/stake.svelte new file mode 100644 index 00000000..2dda38fe --- /dev/null +++ b/src/pages/earn/step/stake.svelte @@ -0,0 +1,116 @@ + + + + +
+
+
Stake
+
Add to your staked balance
+ +
+
+
+ amount to stake +
+ {}} /> +
+ + +
+
+ +
+
diff --git a/src/pages/earn/step/unstake.svelte b/src/pages/earn/step/unstake.svelte new file mode 100644 index 00000000..ff6378a2 --- /dev/null +++ b/src/pages/earn/step/unstake.svelte @@ -0,0 +1,126 @@ + + + + +
+
+
Unstake
+
Remove from your staked balance
+ +
+
+
+ amount to unstake +
+ {}} + /> +
+ + +
+
+ +
+
diff --git a/src/pages/earn/types.ts b/src/pages/earn/types.ts new file mode 100644 index 00000000..ef219601 --- /dev/null +++ b/src/pages/earn/types.ts @@ -0,0 +1,9 @@ +export const enum Step { + Bootstrap, + Overview, + Stake, + Unstake, + Confirm, + Success, + Error, +}