Skip to content

Instantly share code, notes, and snippets.

View Phathdt's full-sized avatar
😆
there is always a reason to smile

Phathdt Phathdt

😆
there is always a reason to smile
  • Caliber Venture Builder
  • Ho Chi Minh city
View GitHub Profile
[10:20:41.295] Running build in Washington, D.C., USA (East) – iad1
[10:20:41.295] Build machine configuration: 4 cores, 8 GB
[10:20:41.312] Cloning github.com/optimex-xyz/frontend-vercel (Branch: develop, Commit: 77a15c4)
[10:20:42.258] Cloning completed: 946.000ms
[10:20:46.616] Restored build cache from previous deployment (7nJfEnoB618qiS3qyKFi9kfTc36P)
[10:20:46.729] Running "if [ "$VERCEL_ENV" == "production" ]; then exit 1; else exit 0; fi"
[10:20:50.041] Running "vercel build"
[10:20:50.531] Vercel CLI 44.4.3
[10:20:51.189] Running "install" command: `yarn install`...
[10:20:51.609] yarn install v1.22.19
model Lending {
id String @id @default(dbgenerated("gen_uuid_v7()")) @map("id") @db.Uuid
lendingId String @unique @map("lending_id")
status String @default("pending") @map("status") // procesing, liquid, withdrawal
userAddress String @map("user_address")
...
}
model LendingEvent {
@Phathdt
Phathdt / failed
Last active February 22, 2025 15:21
BTCEVM
curl --location 'https://api-stg.bitdex.xyz/v1/solver/trade-info' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Referer: http://localhost:5173/' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'X-Timestamp: 1740230535' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'X-Signature: 0xd78f3002ef58bec0be9b6867cc66508df788fbe90f02376a8ed2021a19d9155c16882d364aa3bb6ad69ca969ae418922180684e0fffa83e7e680fba9add9a4691b' \
--header 'X-Public-Address: 0xBE49A84Ec4A965cc2d251d825662Cac2E5Aacf70' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'Accept: application/json, text/plain, */*' \
{
"data": {
"id": 245,
"trade_id": "0x6c5ed37339c5954d58d66d4edd6493a6407437d652f0337353b6102e73668d77",
"status": "SUBMITTED",
"timestamp": 1740027634,
"from_user_address": "0x03851d846543cd6749d34cab0681adebedd076e1f24c4dcb5e7a2139a1aaf0487c",
"to_user_address": "0x19ce4de99ce88bc4a759e8dbdec42724eecb666f",
"org_id": null,
"created_at": "2025-02-20T05:00:12.012Z",

Quy trình GitFlow

1. Cấu trúc nhánh

Các nhánh chính (Long-running branches)

  • main (production): Nhánh chính chứa code production
  • staging: Nhánh staging để kiểm thử trước khi deploy lên production
  • develop: Nhánh phát triển chính, nơi tích hợp code từ các feature branches

Các nhánh phụ (Short-lived branches)

Next.js and NestJS Authentication with Clerk

1. System Architecture

  • Frontend: Next.js with Clerk (port 3000)
  • Backend: NestJS (port 4000)
  • Authentication: Clerk + Token verification
  • Database: Prisma as ORM

2. Authentication Flow

export const GetSettlementSignatureSchema = z.object({
tradeId: z.string(),
committedQuote: z.string(),
solverFee: z.string(),
tradeDeadline: z.string(),
scriptDeadline: z.string(),
});
export class GetSettlementSignatureDto extends createZodDto(
GetSettlementSignatureSchema
import * as crypto from 'crypto';
import { ethers } from 'ethers';
import { Token, TokenPrice, TokenRepository } from '@bitfi-mock-pmm/token';
import { TradeService } from '@bitfi-mock-pmm/trade';
import { BadRequestException, HttpException, Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { QuoteSessionRepository } from './quote-session.repository';
import {
{
"data": {
"id": 1,
"tradeId": "0xb155a4d6fc0ae4d26e8b67e7720cb1c60b1c30d83b6ac151d2926b4de3edf434",
"status": "PAYMENT_CONFIRMED",
"createdAt": "2024-10-04T10:19:49.098Z",
"updatedAt": "2024-10-04T10:19:52.155Z",
"events": [
{
"tradeId": "0xb155a4d6fc0ae4d26e8b67e7720cb1c60b1c30d83b6ac151d2926b4de3edf434",
@Phathdt
Phathdt / eks.yml
Last active November 10, 2023 09:42
eks
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 4.0"
name = "${var.project} EKS VPC"
cidr = var.vpc_cidr
azs = var.azs
private_subnets = [for k, v in var.azs : cidrsubnet(var.vpc_cidr, 4, k)]
public_subnets = [for k, v in var.azs : cidrsubnet(var.vpc_cidr, 8, k + 48)]