-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from klntsky/vishtar/bypass_rollback
Bypass rollback
- Loading branch information
Showing
36 changed files
with
377 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
.charts { | ||
width: 100%; | ||
} | ||
|
||
.yourJettonsHeader { | ||
color: var(--tg-theme-text-color) !important; | ||
} | ||
|
||
.symbolHeader { | ||
color: white !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const badgeType = (input: number) => { | ||
if (input < 0) { | ||
return 'moderateDecrease' | ||
} | ||
if (input > 0) { | ||
return 'moderateIncrease' | ||
} else { | ||
return 'unchanged' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { TChartData } from '../types' | ||
|
||
export const chartColor = (arr: TChartData[]) => { | ||
if (Number(arr[0].Price) >= Number(arr.at(-1)!.Price)) { | ||
return ['red'] | ||
} else { | ||
return ['emerald'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { normalizePrice, timeConverter } from '.' | ||
|
||
export const formatDataToChart = (input: { | ||
chart: [number, number][] | ||
decimals: number | ||
}) => | ||
input.chart.reverse().map(arr => { | ||
return { | ||
date: timeConverter(arr[0]), | ||
Price: normalizePrice(arr[1], input.decimals), | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export { normalizePrice } from './normalizePrice' | ||
export { timeConverter } from './timeConverter' | ||
export { chartColor } from './chartColor' | ||
export { formatDataToChart } from './formatDataToChart' | ||
export { badgeType } from './badgeType' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const normalizePrice = (price: number, decimals?: number) => | ||
price > 0.01 ? Number(price.toFixed(2)) : price.toFixed(decimals || 20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export function timeConverter(UNIX_timestamp: number) { | ||
const a = new Date(UNIX_timestamp * 1000) | ||
const months = [ | ||
'Jan', | ||
'Feb', | ||
'Mar', | ||
'Apr', | ||
'May', | ||
'Jun', | ||
'Jul', | ||
'Aug', | ||
'Sep', | ||
'Oct', | ||
'Nov', | ||
'Dec', | ||
] | ||
const year = a.getFullYear() | ||
const month = months[a.getMonth()] | ||
const date = a.getDate() | ||
const hour = a.getHours() | ||
const min = a.getMinutes() | ||
const sec = a.getSeconds() | ||
const time = | ||
date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec | ||
return time | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import { wallets } from '../../db/schema' | ||
import type { TDbConnection } from '../../types' | ||
import type { TDbConnection, TDbTransaction } from '../../types' | ||
|
||
export const insertUserAdress = (db: TDbConnection, values: typeof wallets.$inferInsert) => { | ||
export const insertUserAdress = ( | ||
db: TDbConnection | TDbTransaction, | ||
values: typeof wallets.$inferInsert, | ||
) => { | ||
return db.insert(wallets).values(values).onConflictDoNothing().returning() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { asc, eq } from 'drizzle-orm' | ||
import { userPurchases } from '../../db/schema' | ||
import type { TDbConnection } from '../../types' | ||
|
||
export const selectFirstUserPurchaseByJettonId = async (db: TDbConnection, jettonId: number) => { | ||
const [firstPurchase] = await db | ||
.select() | ||
.from(userPurchases) | ||
.where(eq(userPurchases.jettonId, jettonId)) | ||
.orderBy(asc(userPurchases.timestamp)) | ||
.limit(1) | ||
|
||
return firstPurchase | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { and, eq } from 'drizzle-orm' | ||
import type { TDbConnection } from '../../types' | ||
import { tokens } from '../schema' | ||
|
||
export const selectTokenByAddressAndWalletId = ( | ||
db: TDbConnection, | ||
address: string, | ||
walletId: number, | ||
) => { | ||
return db | ||
.select() | ||
.from(tokens) | ||
.where(and(eq(tokens.token, address), eq(tokens.walletId, walletId))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { eq } from 'drizzle-orm' | ||
import type { TDbConnection } from '../../types' | ||
import { wallets } from '../schema' | ||
|
||
export const selectWalletById = (db: TDbConnection, walletId: number) => { | ||
return db.select().from(wallets).where(eq(wallets.id, walletId)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import type { TDbConnection } from '../../types' | ||
import type { TDbConnection, TDbTransaction } from '../../types' | ||
import { tokens } from '../schema' | ||
|
||
export const upsertToken = (db: TDbConnection, values: typeof tokens.$inferInsert) => { | ||
export const upsertToken = ( | ||
db: TDbConnection | TDbTransaction, | ||
values: typeof tokens.$inferInsert, | ||
) => { | ||
return db.insert(tokens).values(values).onConflictDoNothing() | ||
} |
Oops, something went wrong.