Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Send Earn #1085

Open
wants to merge 75 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
f73c154
Added first part of dummy UI for earn
musidlo Jan 25, 2025
3714681
Added earning form screen
musidlo Jan 28, 2025
ac9984b
Added active earnings screen
musidlo Jan 29, 2025
fea9d29
Added withdraw form
musidlo Jan 29, 2025
6dee9f2
Added earnings and rewards balance
musidlo Jan 31, 2025
45d1499
fix: StartEarning -> Deposit
0xBigBoss Feb 16, 2025
f8a0ee0
feat: add oliveDrab color
0xBigBoss Feb 16, 2025
7a49895
refactor: DepositForm
0xBigBoss Feb 16, 2025
21b2bba
feat(ui): add base style to Shake
0xBigBoss Feb 16, 2025
cec5097
fix: update EarnTerms and DepositForm
0xBigBoss Feb 16, 2025
79735bf
feat(wagmi): add Send Earn
0xBigBoss Feb 16, 2025
6ddbe56
fix: StartEarning -> Deposit
0xBigBoss Feb 16, 2025
b9af0ed
fix(app): update useUserOpTransferMutation
0xBigBoss Feb 16, 2025
13695c8
feat(wagmi): add Send Earn
0xBigBoss Feb 16, 2025
bed6892
feat(app): SendEarn Deposit onchain
0xBigBoss Feb 16, 2025
991aa60
feat(app): SendEarn Deposit onchain
0xBigBoss Feb 16, 2025
f07f892
fix: double render on HomeSidebar
0xBigBoss Feb 16, 2025
2058b7b
feat(playwright): deposit Send Earn spec
0xBigBoss Feb 17, 2025
64d7772
feat(app): add link to Send Earn
0xBigBoss Feb 17, 2025
1ab4dc9
fix(app): do not retry not enough USDC
0xBigBoss Feb 17, 2025
7121491
feat(app): move useSendEarnDepositUserOp to hooks
0xBigBoss Feb 17, 2025
b2c32e4
fix(app): app crash
0xBigBoss Feb 19, 2025
5b155e7
fix(app): improve amount sanitization
0xBigBoss Feb 19, 2025
7e87084
fix(app): enforce minimum deposit amount in DepositForm
0xBigBoss Feb 19, 2025
4263ff0
feat(app): show estimated earnings and APY for Send Earn
0xBigBoss Feb 21, 2025
152ca98
fix(app): update SendEarnVault type to ensure non-null data handling …
0xBigBoss Feb 22, 2025
a245fff
fix(app): adjust minimum deposit to 10 USDC and update form error han…
0xBigBoss Feb 22, 2025
8bc5cdc
shovel: upgrade to latest
0xBigBoss Feb 25, 2025
30f7bf8
feat(shovel): add send_earn_new_affiliate integration
0xBigBoss Feb 25, 2025
bc1f737
feat(wagmi): update SendEarn contracts and add revenue safe configura…
0xBigBoss Feb 25, 2025
50eab56
feat(shovel): add send earn integrations
0xBigBoss Feb 25, 2025
941c747
fix: send earn address
0xBigBoss Feb 26, 2025
e35a023
refactor: organize checkout form and utils
0xBigBoss Feb 26, 2025
1821233
fix(shovel): typo send earn integrations
0xBigBoss Feb 27, 2025
621e266
fix(supabase): specify bigint for id in send_earn_create and send_ear…
0xBigBoss Mar 2, 2025
11f4723
fix: update contract addresses in config for SendEarn and SendEarnFac…
0xBigBoss Mar 2, 2025
408ee99
fix(supabase): update types in send_earn_create and send_earn_new_aff…
0xBigBoss Mar 2, 2025
6c47e5c
refactor: organize checkout form and utils
0xBigBoss Mar 2, 2025
63afb28
fix(shovel): commit shovel snapshot, limit shovel resources
0xBigBoss Mar 2, 2025
2f6f1b8
fix: limit anvil resources
0xBigBoss Mar 2, 2025
34484d7
fix(shovel): set default SHOVEL_VERSION
0xBigBoss Mar 2, 2025
86bc02d
feat(shovel): add send_earn deposits and withdraws
0xBigBoss Mar 5, 2025
ebce9ca
feat(supabase): send earn deposit and withdraw RLS
0xBigBoss Mar 6, 2025
ce637e0
feat(app): add more send earn hooks
0xBigBoss Mar 6, 2025
480e29a
fix: add more memory to anvil
0xBigBoss Mar 6, 2025
42b59ae
feat(app): add sendEarnDepositVault
0xBigBoss Mar 7, 2025
ecf5985
feat(app): add useReferrerVault hook
0xBigBoss Mar 7, 2025
ed6f014
refactor(app): update jsdoc
0xBigBoss Mar 7, 2025
9b07961
refactor: sendEarnUsdcFactoryAddress
0xBigBoss Mar 7, 2025
de21e9b
refactor(app): enhance referrer logic with profile type
0xBigBoss Mar 8, 2025
6d2998b
refactor(app): wip on createAndDeposit affiliate flow
0xBigBoss Mar 8, 2025
8f260ea
fix(tilt): anvil keeps being OOM killed
0xBigBoss Mar 9, 2025
9c87b04
refactor(app): fix calcualating base apy using default vault
0xBigBoss Mar 9, 2025
54a83ed
fix(app): earn summary
0xBigBoss Mar 9, 2025
7b77131
fix(supabase): correct RLS policy for send_earn_balances
0xBigBoss Mar 9, 2025
d8b6e0e
feat(app): add asset to URL path param
0xBigBoss Mar 9, 2025
5e8fcc4
fix(app): refactor coin schemas and improve send earn balance handlin…
0xBigBoss Mar 9, 2025
a86a547
feat(app): reorganize earn feature imports and implement new earnings…
0xBigBoss Mar 9, 2025
0d9e1fd
test(app): add unit tests for toNiceError utility with various error …
0xBigBoss Mar 9, 2025
a54df45
feat(app): add erc20Coins list to coins data for better coin manageme…
0xBigBoss Mar 9, 2025
f93f429
feat(app): formatCoinAmount utility
0xBigBoss Mar 10, 2025
567cb61
feat(app): enhance ActiveEarnings screen with new balances and improv…
0xBigBoss Mar 10, 2025
f11ff57
feat(supabase): add send_earn_activity view
0xBigBoss Mar 10, 2025
375f3de
feat(app): add EarningsFeed and TotalEarning components
0xBigBoss Mar 10, 2025
58ebc10
fix: update @0xsend/send-earn-contracts
0xBigBoss Mar 12, 2025
7817d43
refactor(earn): optimize EarningsSummary calculations with useMemo fo…
0xBigBoss Mar 12, 2025
20645d9
fix(shovel): snapshots and config after send earn update
0xBigBoss Mar 12, 2025
c2adb18
feat(supabase): add created_at to referrals
0xBigBoss Mar 12, 2025
377ed4c
sync snaplet
0xBigBoss Mar 12, 2025
6cd1a8d
feat(supabase): add created_at to referrals
0xBigBoss Mar 12, 2025
76c00d0
fix(snaplet): include receipts
0xBigBoss Mar 13, 2025
bfc8bb6
feat(app): add referrer view
0xBigBoss Mar 13, 2025
2b21fee
feat(app): lookup existing referrer vault
0xBigBoss Mar 13, 2025
282a8fb
feat(app): add ReferredBy component for managing referral codes in ch…
0xBigBoss Mar 13, 2025
037c901
fix(playwright): better tests, clean up on deposit flow
0xBigBoss Mar 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"expo-build-properties": "~0.11.1",
"expo-clipboard": "^5.0.1",
"expo-constants": "~15.4.5",
"expo-crypto": "~12.8.0",
"expo-crypto": "~14.0.2",
"expo-dev-client": "~3.3.8",
"expo-device": "~5.9.3",
"expo-font": "~11.10.2",
Expand Down
1 change: 1 addition & 0 deletions apps/next/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default () => {
'expo-modules-core',
'expo-device',
'expo-image-picker',
'expo-crypto',
],
experimental: {
scrollRestoration: true,
Expand Down
27 changes: 27 additions & 0 deletions apps/next/pages/earn/[asset]/balance.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TopNav } from 'app/components/TopNav'
import { EarningsBalance } from 'app/features/earn/earnings/screen'
import { HomeLayout } from 'app/features/home/layout.web'
import Head from 'next/head'
import { userProtectedGetSSP } from 'utils/userProtected'
import type { NextPageWithLayout } from '../../_app'

export const Page: NextPageWithLayout = () => {
return (
<>
<Head>
<title>Send | Earnings Balance</title>
</Head>
<EarningsBalance />
</>
)
}

export const getServerSideProps = userProtectedGetSSP()

Page.getLayout = (children) => (
<HomeLayout TopNav={<TopNav header="Earnings Balance" backFunction="router" />} fullHeight>
{children}
</HomeLayout>
)

export default Page
26 changes: 26 additions & 0 deletions apps/next/pages/earn/[asset]/deposit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { TopNav } from 'app/components/TopNav'
import { DepositScreen } from 'app/features/earn/deposit/screen'
import { HomeLayout } from 'app/features/home/layout.web'
import Head from 'next/head'
import { userProtectedGetSSP } from 'utils/userProtected'
import type { NextPageWithLayout } from '../../_app'

export const Page: NextPageWithLayout = () => {
return (
<>
<Head>
<title>Send | Start Earning</title>
</Head>
<DepositScreen />
</>
)
}
export const getServerSideProps = userProtectedGetSSP()

Page.getLayout = (children) => (
<HomeLayout TopNav={<TopNav header="Start Earning" backFunction="router" />}>
{children}
</HomeLayout>
)

export default Page
59 changes: 59 additions & 0 deletions apps/next/pages/earn/[asset]/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { TopNav } from 'app/components/TopNav'
import { ActiveEarnings } from 'app/features/earn/active/screen'
import { HomeLayout } from 'app/features/home/layout.web'
import Head from 'next/head'
import { userProtectedGetSSP } from 'utils/userProtected'
import type { NextPageWithLayout } from '../../_app'
import { coinsBySymbol } from 'app/data/coins'
import type { GetServerSideProps } from 'next'
import type { ParsedUrlQuery } from 'node:querystring'
import debug from 'debug'

const log = debug('app:pages:earn:active')

export const Page: NextPageWithLayout = () => {
return (
<>
<Head>
<title>Send | Active Earnings</title>
</Head>
<ActiveEarnings />
</>
)
}

interface Params extends ParsedUrlQuery {
asset?: string
}

export const getServerSideProps: GetServerSideProps = async (context) => {
const { asset } = context.params as Params
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract to helper function


if (!asset) {
log('no asset')
return {
redirect: {
destination: '/earn',
permanent: false,
},
}
}

if (!coinsBySymbol[asset.toUpperCase()]) {
log('coin not supported', asset)
// 404 if coin is not supported
return {
notFound: true,
}
}

return userProtectedGetSSP()(context)
}

Page.getLayout = (children) => (
<HomeLayout TopNav={<TopNav header="Active Earnings" backFunction="root" />}>
{children}
</HomeLayout>
)

export default Page
26 changes: 26 additions & 0 deletions apps/next/pages/earn/[asset]/rewards.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { TopNav } from 'app/components/TopNav'
import { RewardsBalance } from 'app/features/earn/rewards-balance/screen'
import { HomeLayout } from 'app/features/home/layout.web'
import Head from 'next/head'
import { userProtectedGetSSP } from 'utils/userProtected'
import type { NextPageWithLayout } from '../../_app'

export const Page: NextPageWithLayout = () => {
return (
<>
<Head>
<title>Send | Rewards Balance</title>
</Head>
<RewardsBalance />
</>
)
}
export const getServerSideProps = userProtectedGetSSP()

Page.getLayout = (children) => (
<HomeLayout TopNav={<TopNav header="Rewards Balance" backFunction="router" />} fullHeight>
{children}
</HomeLayout>
)

export default Page
27 changes: 27 additions & 0 deletions apps/next/pages/earn/[asset]/withdraw.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TopNav } from 'app/components/TopNav'
import { WithdrawForm } from 'app/features/earn/withdraw/screen'
import { HomeLayout } from 'app/features/home/layout.web'
import Head from 'next/head'
import { userProtectedGetSSP } from 'utils/userProtected'
import type { NextPageWithLayout } from '../../_app'

export const Page: NextPageWithLayout = () => {
return (
<>
<Head>
<title>Send | Withdraw Deposit</title>
</Head>
<WithdrawForm />
</>
)
}

export const getServerSideProps = userProtectedGetSSP()

Page.getLayout = (children) => (
<HomeLayout TopNav={<TopNav header="Withdraw Deposit" backFunction="router" />}>
{children}
</HomeLayout>
)

export default Page
22 changes: 22 additions & 0 deletions apps/next/pages/earn/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { TopNav } from 'app/components/TopNav'
import { EarnScreen } from 'app/features/earn/screen'
import { HomeLayout } from 'app/features/home/layout.web'
import Head from 'next/head'
import type { NextPageWithLayout } from '../_app'

export const Page: NextPageWithLayout = () => {
return (
<>
<Head>
<title>Send | Earn</title>
</Head>
<EarnScreen />
</>
)
}

Page.getLayout = (children) => (
<HomeLayout TopNav={<TopNav header="Earn" backFunction="root" />}>{children}</HomeLayout>
)

export default Page
2 changes: 0 additions & 2 deletions packages/api/src/routers/_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { tagRouter } from './tag'
import { secretShopRouter } from './secretShop'
import { sendAccountRouter } from './sendAccount'
import { accountRecoveryRouter } from './account-recovery/router'
import { referralsRouter } from './referrals'

export const appRouter = createTRPCRouter({
chainAddress: chainAddressRouter,
Expand All @@ -17,7 +16,6 @@ export const appRouter = createTRPCRouter({
distribution: distributionRouter,
secretShop: secretShopRouter,
sendAccount: sendAccountRouter,
referrals: referralsRouter,
})

export type AppRouter = typeof appRouter
Expand Down
44 changes: 0 additions & 44 deletions packages/api/src/routers/referrals.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/api/src/routers/tag.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { PostgrestError } from '@supabase/supabase-js'
import { TRPCError } from '@trpc/server'
import { reward, total } from 'app/data/sendtags'
import { fetchReferrer } from 'app/features/account/sendtag/checkout/checkout-utils'
import { fetchSendtagCheckoutReceipts } from 'app/features/account/sendtag/checkout/checkout-utils.fetchSendtagCheckoutReceipts'
import { assert } from 'app/utils/assert'
import { byteaToHex } from 'app/utils/byteaToHex'
import { hexToBytea } from 'app/utils/hexToBytea'
import { fetchReferrer } from 'app/utils/referrer'
import { supabaseAdmin } from 'app/utils/supabase/admin'
import { throwIf } from 'app/utils/throwIf'
import { byteaTxHash } from 'app/utils/zod'
import debug from 'debug'
import { isAddressEqual, withRetry, zeroAddress } from 'viem'
import { z } from 'zod'
import { createTRPCRouter, protectedProcedure } from '../trpc'
import { byteaToHex } from 'app/utils/byteaToHex'

const log = debug('api:routers:tag')

Expand Down
Loading