Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions app/bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"tsc": "tsc --noEmit"
},
"dependencies": {
"@sentry/node": "8.42.0",
"@sentry/profiling-node": "8.42.0",
"@sentry/node": "8.44.0",
"@sentry/profiling-node": "8.44.0",
"discord.js": "14.16.3",
"i18next": "23.16.8",
"ramda": "0.30.1"
Expand All @@ -40,7 +40,7 @@
"@jest/globals": "29.7.0",
"@jest/types": "29.6.3",
"@sentry/cli": "2.39.1",
"@types/node": "22.10.1",
"@types/node": "22.10.2",
"@types/ramda": "0.30.2",
"jest": "29.7.0",
"jest-junit": "16.0.0",
Expand Down
7 changes: 4 additions & 3 deletions app/bot/src/offer/archive-offer-thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import { sendToThread } from '@echo/bot/helpers/send-to-thread'
import { getOfferThreadOnEchoChannel } from '@echo/bot/offer/get-offer-thread-on-echo-channel'
import { archiveOfferThread as firestoreArchiveOfferThread } from '@echo/firestore/crud/offer-thread/archive-offer-thread'
import type { Offer } from '@echo/model/types/offer'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import i18next from 'i18next'
import { isNil, pipe } from 'ramda'
import { setTimeout } from 'node:timers/promises'
import { isNil } from 'ramda'

export async function archiveOfferThread(offer: Offer) {
const { offerThread, thread } = await getOfferThreadOnEchoChannel(offer)
if (!isNil(thread) && !isNil(offerThread)) {
await sendToThread(thread, {
content: i18next.t('offer.thread.close')
})
await pipe(deleteThread, delayPromise(archiveThreadDelay))(thread)
await setTimeout(archiveThreadDelay)
await deleteThread(thread)
logger.info({ thread }, 'thread deleted')
const archiveOfferThread = await firestoreArchiveOfferThread(offerThread.offerId)
logger.info({ offerThread: archiveOfferThread }, 'archived thread in Firestore')
Expand Down
7 changes: 4 additions & 3 deletions app/bot/src/swap/archive-swap-thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import { sendToThread } from '@echo/bot/helpers/send-to-thread'
import { getSwapThreadOnEchoChannel } from '@echo/bot/swap/get-swap-thread-on-echo-channel'
import { archiveOfferThread as firestoreArchiveOfferThread } from '@echo/firestore/crud/offer-thread/archive-offer-thread'
import type { SwapDocument } from '@echo/firestore/types/model/swap-document'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import i18next from 'i18next'
import { isNil, pipe } from 'ramda'
import { setTimeout } from 'node:timers/promises'
import { isNil } from 'ramda'

export async function archiveSwapThread(swap: SwapDocument) {
const { offerThread, thread } = await getSwapThreadOnEchoChannel(swap)
if (!isNil(thread) && !isNil(offerThread)) {
await sendToThread(thread, {
content: i18next.t('offer.thread.close')
})
await pipe(deleteThread, delayPromise(archiveThreadDelay))(thread)
await setTimeout(archiveThreadDelay)
await deleteThread(thread)
logger.info({ thread }, 'thread deleted')
const archiveOfferThread = await firestoreArchiveOfferThread(offerThread.offerId)
logger.info({ offerThread: archiveOfferThread }, 'archived thread in Firestore')
Expand Down
2 changes: 1 addition & 1 deletion app/firestore-functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"firebase-admin": "12.7.0",
"firebase-functions": "6.1.1",
"firebase-functions": "6.1.2",
"google-auth-library": "9.15.0",
"ramda": "0.30.1"
},
Expand Down
12 changes: 6 additions & 6 deletions app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@
"@echo/ui": "workspace:*",
"@echo/utils": "workspace:*",
"@next/bundle-analyzer": "14.2.20",
"@sentry/nextjs": "8.42.0",
"@sentry/nextjs": "8.44.0",
"@vercel/speed-insights": "1.1.0",
"next": "14.2.20",
"next-auth": "5.0.0-beta.25",
"next-intl": "3.25.3",
"next-intl": "3.26.1",
"p-filter": "4.1.0",
"ramda": "0.30.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"tailwindcss": "3.4.16"
},
"devDependencies": {
"@swc/core": "1.10.0",
"@types/node": "22.10.1",
"@swc/core": "1.10.1",
"@types/node": "22.10.2",
"@types/ramda": "0.30.2",
"@types/react": "18.3.14",
"@types/react-dom": "18.3.2",
"@types/react": "18.3.16",
"@types/react-dom": "18.3.5",
"pino-pretty": "11.3.0",
"typescript": "5.7.2"
}
Expand Down
11 changes: 6 additions & 5 deletions app/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
},
"dependencies": {
"@headlessui/react": "2.2.0",
"@sentry/nextjs": "8.42.0",
"@sentry/nextjs": "8.44.0",
"dayjs": "1.11.13",
"delay": "6.0.0",
"next-auth": "5.0.0-beta.25",
"next-intl": "3.25.3",
"next-intl": "3.26.1",
"ramda": "0.30.1",
"react": "18.3.1",
"react-dom": "18.3.1",
Expand All @@ -36,10 +37,10 @@
"@storybook/addon-webpack5-compiler-swc": "1.0.5",
"@storybook/nextjs": "8.4.7",
"@storybook/react": "8.4.7",
"@types/node": "22.10.1",
"@types/node": "22.10.2",
"@types/ramda": "0.30.2",
"@types/react": "18.3.14",
"@types/react-dom": "18.3.2",
"@types/react": "18.3.16",
"@types/react-dom": "18.3.5",
"typescript": "5.7.2"
}
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/accept-offer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import type { HexString } from '@echo/model/types/hex-string'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function acceptOffer(): Promise<HexString> {
return pipe(toPromise, delayPromise(800))('0xOfferAccepted')
return rangeDelay(800, 1600, { value: '0xOfferAccepted' })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/approve-erc721-contract.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import type { HexString } from '@echo/model/types/hex-string'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function approveErc721Contract(): Promise<HexString> {
return pipe(toPromise, delayPromise(800))('0xwhatever')
return rangeDelay(800, 1600, { value: '0xwhatever' })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/are-nfts-in-escrow.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export async function areNftsInEscrow(): Promise<boolean> {
return pipe(toPromise, delayPromise(800))(true)
return rangeDelay(800, 1600, { value: true })
}
6 changes: 3 additions & 3 deletions app/storybook/src/mocks/cancel-listing.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ListingState } from '@echo/model/constants/listing-state'
import { listingMock } from '@echo/model/mocks/listing-mock'
import type { Listing } from '@echo/model/types/listing'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { toPromise } from '@echo/utils/helpers/to-promise'
import { rangeDelay } from 'delay'
import { assoc, pipe } from 'ramda'

export function cancelListing(): Promise<Listing> {
return pipe(assoc('state', ListingState.Cancelled), assoc('locked', true), toPromise, delayPromise(800))(listingMock)
const value = pipe(assoc('state', ListingState.Cancelled), assoc('locked', true))(listingMock)
return rangeDelay(800, 1600, { value })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/cancel-offer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import type { HexString } from '@echo/model/types/hex-string'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function cancelOffer(): Promise<HexString> {
return pipe(toPromise, delayPromise(800))('0xOfferCanceled')
return rangeDelay(800, 1600, { value: '0xOfferCanceled' })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/create-listing.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { listingMock } from '@echo/model/mocks/listing-mock'
import type { Listing } from '@echo/model/types/listing'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { toPromise } from '@echo/utils/helpers/to-promise'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function createListing(): Promise<Listing> {
return pipe(toPromise, delayPromise(800))(listingMock)
return rangeDelay(800, 1600, { value: listingMock })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/create-offer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import type { HexString } from '@echo/model/types/hex-string'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function createOffer(): Promise<HexString> {
return pipe(toPromise, delayPromise(800))('0xOfferCreated')
return rangeDelay(800, 1600, { value: '0xOfferCreated' })
}
5 changes: 3 additions & 2 deletions app/storybook/src/mocks/get-all-erc20-token-balances.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { Erc20Token, TokenBalance } from '@echo/model/types/token'
import { getErc20TokenBalance } from '@echo/storybook/mocks/get-erc20-token-balance'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { nonEmptyMap } from '@echo/utils/helpers/non-empty-map'
import { nonEmptyPromiseAll } from '@echo/utils/helpers/non-empty-promise-all'
import { rangeDelay } from 'delay'
import { type NonEmptyArray, pipe } from 'ramda'

export async function getAllErc20TokenBalances(
tokens: NonEmptyArray<Erc20Token>
): Promise<NonEmptyArray<TokenBalance<Erc20Token>>> {
return pipe(nonEmptyMap(getErc20TokenBalance), nonEmptyPromiseAll, delayPromise(800))(tokens)
const value = await pipe(nonEmptyMap(getErc20TokenBalance), nonEmptyPromiseAll)(tokens)
return rangeDelay(800, 1600, { value })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/get-echo-trading-fees.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export async function getEchoTradingFees(): Promise<bigint> {
return pipe(toPromise, delayPromise(800))(BigInt(0))
return rangeDelay(800, 1600, { value: BigInt(0) })
}
16 changes: 11 additions & 5 deletions app/storybook/src/mocks/get-erc20-token-balance.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import type { Erc20Token, TokenBalance } from '@echo/model/types/token'
import { rangeDelay } from 'delay'

export function getErc20TokenBalance(token: Erc20Token): Promise<TokenBalance<Erc20Token>> {
function getBalance(token: Erc20Token): number {
switch (token.name) {
case 'WETH':
return Promise.resolve({ token, balance: 0.987654 })
return 0.987654
case 'USDB':
return Promise.resolve({ token, balance: 1234.56789 })
return 1234.56789
case 'USDC':
return Promise.resolve({ token, balance: 2000 })
return 2000
default:
return Promise.resolve({ token, balance: 987654 })
return 987654
}
}

export function getErc20TokenBalance(token: Erc20Token): Promise<TokenBalance<Erc20Token>> {
const balance = getBalance(token)
return rangeDelay(800, 1600, { value: { token, balance } })
}
7 changes: 3 additions & 4 deletions app/storybook/src/mocks/get-erc721-contract-approval.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { contractApprovalStore } from '@echo/storybook/mocks/stores/contract-approval-store'
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { pipe, prop } from 'ramda'
import { rangeDelay } from 'delay'

export function getErc721ContractApproval(): Promise<boolean> {
return pipe(prop('approved'), toPromise, delayPromise(800))(contractApprovalStore.getState())
const value = contractApprovalStore.getState().approved
return rangeDelay(800, 1600, { value })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/get-offer-by-id-contract.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { offerMockFromJohnnycage } from '@echo/model/mocks/offer-mock'
import type { Offer } from '@echo/model/types/offer'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { toPromise } from '@echo/utils/helpers/to-promise'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function getOfferByIdContract(): Promise<Offer> {
return pipe(toPromise, delayPromise(800))(offerMockFromJohnnycage)
return rangeDelay(800, 1600, { value: offerMockFromJohnnycage })
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/redeem-offer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import type { HexString } from '@echo/model/types/hex-string'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function redeemOffer(): Promise<HexString> {
return pipe(toPromise, delayPromise(800))('0xOfferRedeemed')
return rangeDelay(800, 1600, { value: '0xOfferRedeemed' })
}
11 changes: 3 additions & 8 deletions app/storybook/src/mocks/reject-offer.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { OfferState } from '@echo/model/constants/offer-state'
import { offerMockToJohnnycage } from '@echo/model/mocks/offer-mock'
import type { Offer } from '@echo/model/types/offer'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { toPromise } from '@echo/utils/helpers/to-promise'
import { rangeDelay } from 'delay'
import { assoc, pipe } from 'ramda'

export function rejectOffer(): Promise<Offer> {
return pipe(
assoc('state', OfferState.Rejected),
assoc('locked', true),
toPromise,
delayPromise(800)
)(offerMockToJohnnycage)
const value = pipe(assoc('state', OfferState.Rejected), assoc('locked', true))(offerMockToJohnnycage)
return rangeDelay(800, 1600, { value })
}
10 changes: 5 additions & 5 deletions app/storybook/src/mocks/search-collections.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { collectionToSearchResult } from '@echo/model/mappers/collection/collection-to-search-result'
import { collectionMocks } from '@echo/model/mocks/collection-mock'
import type { SearchResult } from '@echo/model/types/search-result'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { promiseAll } from '@echo/utils/helpers/promise-all'
import { toPromise } from '@echo/utils/helpers/to-promise'
import { rangeDelay } from 'delay'
import { either, filter, map, pipe, propSatisfies, test, toLower } from 'ramda'

export function searchCollections(query: string): Promise<SearchResult[]> {
export async function searchCollections(query: string): Promise<SearchResult[]> {
const regex = new RegExp(toLower(query), 'ig')
const search = pipe(toLower, test(regex))
return pipe(
const value = await pipe(
filter(either(propSatisfies(search, 'name'), propSatisfies(search, 'slug'))),
map(pipe(collectionToSearchResult, toPromise)),
promiseAll,
delayPromise(1000)
promiseAll
)(collectionMocks)
return rangeDelay(800, 1600, { value })
}
10 changes: 5 additions & 5 deletions app/storybook/src/mocks/search-users.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { userToSearchResult } from '@echo/model/mappers/user/user-to-search-result'
import { userMocks } from '@echo/model/mocks/user-mock'
import type { SearchResult } from '@echo/model/types/search-result'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { promiseAll } from '@echo/utils/helpers/promise-all'
import { toPromise } from '@echo/utils/helpers/to-promise'
import { rangeDelay } from 'delay'
import { filter, map, pathSatisfies, pipe, test, toLower } from 'ramda'

export function searchUsers(query: string): Promise<SearchResult[]> {
export async function searchUsers(query: string): Promise<SearchResult[]> {
const regex = new RegExp(toLower(query), 'ig')
const search = pipe(toLower, test(regex))
return pipe(
const value = await pipe(
filter(pathSatisfies(search, ['discord', 'username'])),
map(pipe(userToSearchResult, toPromise)),
promiseAll,
delayPromise(1000)
promiseAll
)(userMocks)
return rangeDelay(800, 1600, { value })
}
11 changes: 4 additions & 7 deletions app/storybook/src/mocks/sign-nonce.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import { toPromise } from '@echo/utils/helpers/to-promise'
import type { SignNonceResult } from '@echo/web3-dom/services/sign-nonce'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function signNonce(): Promise<SignNonceResult> {
return pipe(
toPromise,
delayPromise(800)
)({ message: 'message', signature: '0xaF1c962f799954E2a43fFdEA5Acaa942d53E1F84' })
return rangeDelay(800, 1600, {
value: { message: 'message', signature: '0xaF1c962f799954E2a43fFdEA5Acaa942d53E1F84' }
})
}
6 changes: 2 additions & 4 deletions app/storybook/src/mocks/swap.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { toPromise } from '@echo/utils/helpers/to-promise'
import { delayPromise } from '@echo/utils/helpers/delay-promise'
import type { HexString } from '@echo/model/types/hex-string'
import { pipe } from 'ramda'
import { rangeDelay } from 'delay'

export function swap(): Promise<HexString> {
return pipe(toPromise, delayPromise(800))('0xOfferExecuted')
return rangeDelay(800, 1600, { value: '0xOfferExecuted' })
}
Loading
Loading