diff --git a/apps/indexer/package.json b/apps/indexer/package.json index 0f9e526a9..08ba8b5a2 100644 --- a/apps/indexer/package.json +++ b/apps/indexer/package.json @@ -24,14 +24,14 @@ "rimraf": "^5.0.5", "tsconfig": "workspace:*", "typescript": "^5.3.3", - "@prisma/client": "^5.9.1", + "@prisma/client": "latest", "prisma": "^5.9.1" }, "dependencies": { "smartsale-contracts": "workspace:*", "smartsale-lib": "workspace:*", "smartsale-chains": "workspace:*", - "@sentry/node": "^7.98.0", + "@sentry/node": "^7.100.1", "lodash": "^4.17.21", "viem": "latest" } diff --git a/apps/indexer/prisma/migrations/20240207214830_initial_schema/migration.sql b/apps/indexer/prisma/migrations/20240207214830_initial_schema/migration.sql new file mode 100644 index 000000000..df315aba9 --- /dev/null +++ b/apps/indexer/prisma/migrations/20240207214830_initial_schema/migration.sql @@ -0,0 +1,55 @@ +-- CreateTable +CREATE TABLE "auction_details" ( + "id" BIGSERIAL NOT NULL, + "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "exact_order_id" BIGINT, + "chain_id" TEXT, + "symbol_auctioning_token" TEXT, + "symbol_bidding_token" TEXT, + "address_auctioning_token" TEXT, + "address_bidding_token" TEXT, + "decimals_auctioning_token" SMALLINT, + "decimals_bidding_token" SMALLINT, + "end_time_timestamp" TIMESTAMP(6), + "order_cancellation_end_date" TIMESTAMP(6), + "starting_time_stamp" TIMESTAMP(6), + "minimum_bidding_amount_per_order" BIGINT, + "min_funding_threshold" BIGINT, + "allow_list_manager" TEXT, + "allow_list_signer" TEXT, + "current_volume" INTEGER, + "current_clearing_order_sell_amount" BIGINT, + "current_clearing_order_buy_amount" BIGINT, + "current_clearing_price" INTEGER, + "current_bidding_amount" BIGINT, + "is_atomic_closure_allowed" BOOLEAN, + "is_private_auction" BOOLEAN, + "interest_score" INTEGER, + "usd_amount_traded" INTEGER, + + CONSTRAINT "auction_details_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "orders" ( + "id" BIGSERIAL NOT NULL, + "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "auction_id" BIGINT, + "sell_amount" BIGINT, + "buy_amount" BIGINT, + "user_id" BIGINT, + "price" INTEGER, + "volume" BIGINT, + "timestamp" TIMESTAMP(6), + + CONSTRAINT "orders_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "users" ( + "id" BIGSERIAL NOT NULL, + "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "address" TEXT NOT NULL, + + CONSTRAINT "users_pkey" PRIMARY KEY ("id","created_at") +); diff --git a/apps/indexer/prisma/migrations/migration_lock.toml b/apps/indexer/prisma/migrations/migration_lock.toml new file mode 100644 index 000000000..fbffa92c2 --- /dev/null +++ b/apps/indexer/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "postgresql" \ No newline at end of file diff --git a/apps/indexer/prisma/schema.prisma b/apps/indexer/prisma/schema.prisma index befdcc011..3529e1f6d 100644 --- a/apps/indexer/prisma/schema.prisma +++ b/apps/indexer/prisma/schema.prisma @@ -4,8 +4,8 @@ generator client { datasource db { provider = "postgresql" - url = env("DATABASE_URL") - directUrl = env("DIRECT_URL") + url = env("DIRECT_URL") + // directUrl = env("DIRECT_URL") } /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info. diff --git a/apps/supabase/.gitignore b/apps/supabase/.gitignore deleted file mode 100644 index 1a3cb7261..000000000 --- a/apps/supabase/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.history -dist/ -node_modules/ -*.log -.env -# Sentry Auth Token -.sentryclirc -# Supabase -.branches -.temp -.env diff --git a/apps/supabase/README.md b/apps/supabase/README.md deleted file mode 100644 index 40ae922b9..000000000 --- a/apps/supabase/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# smartsale-supabase - -Supabase https://supabase.com/docs/guides/cli/getting-started diff --git a/apps/supabase/config.toml b/apps/supabase/config.toml deleted file mode 100644 index c7fa68587..000000000 --- a/apps/supabase/config.toml +++ /dev/null @@ -1,159 +0,0 @@ -# A string used to distinguish different Supabase projects on the same host. Defaults to the -# working directory name when running `supabase init`. -project_id = "supabase" - -[api] -enabled = true -# Port to use for the API URL. -port = 54321 -# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API -# endpoints. public and storage are always included. -schemas = ["public", "storage", "graphql_public"] -# Extra schemas to add to the search_path of every request. public is always included. -extra_search_path = ["public", "extensions"] -# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size -# for accidental or malicious requests. -max_rows = 1000 - -[db] -# Port to use for the local database URL. -port = 54322 -# Port used by db diff command to initialize the shadow database. -shadow_port = 54320 -# The database major version to use. This has to be the same as your remote database's. Run `SHOW -# server_version;` on the remote database to check. -major_version = 15 - -[db.pooler] -enabled = false -# Port to use for the local connection pooler. -port = 54329 -# Specifies when a server connection can be reused by other clients. -# Configure one of the supported pooler modes: `transaction`, `session`. -pool_mode = "transaction" -# How many server connections to allow per user/database pair. -default_pool_size = 20 -# Maximum number of client connections allowed. -max_client_conn = 100 - -[realtime] -enabled = true -# Bind realtime via either IPv4 or IPv6. (default: IPv6) -# ip_version = "IPv6" -# The maximum length in bytes of HTTP request headers. (default: 4096) -# max_header_length = 4096 - -[studio] -enabled = true -# Port to use for Supabase Studio. -port = 54323 -# External URL of the API server that frontend connects to. -api_url = "http://127.0.0.1" - -# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they -# are monitored, and you can view the emails that would have been sent from the web interface. -[inbucket] -enabled = true -# Port to use for the email testing server web interface. -port = 54324 -# Uncomment to expose additional ports for testing user applications that send emails. -# smtp_port = 54325 -# pop3_port = 54326 - -[storage] -enabled = true -# The maximum file size allowed (e.g. "5MB", "500KB"). -file_size_limit = "50MiB" - -[auth] -enabled = true -# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used -# in emails. -site_url = "http://127.0.0.1:3000" -# A list of *exact* URLs that auth providers are permitted to redirect to post authentication. -additional_redirect_urls = ["https://127.0.0.1:3000"] -# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week). -jwt_expiry = 3600 -# If disabled, the refresh token will never expire. -enable_refresh_token_rotation = true -# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds. -# Requires enable_refresh_token_rotation = true. -refresh_token_reuse_interval = 10 -# Allow/disallow new user signups to your project. -enable_signup = true -# Allow/disallow testing manual linking of accounts -enable_manual_linking = false - -[auth.email] -# Allow/disallow new user signups via email to your project. -enable_signup = true -# If enabled, a user will be required to confirm any email change on both the old, and new email -# addresses. If disabled, only the new email is required to confirm. -double_confirm_changes = true -# If enabled, users need to confirm their email address before signing in. -enable_confirmations = false - -# Uncomment to customize email template -# [auth.email.template.invite] -# subject = "You have been invited" -# content_path = "./supabase/templates/invite.html" - -[auth.sms] -# Allow/disallow new user signups via SMS to your project. -enable_signup = true -# If enabled, users need to confirm their phone number before signing in. -enable_confirmations = false -# Template for sending OTP to users -template = "Your code is {{ .Code }} ." - -# Use pre-defined map of phone number to OTP for testing. -[auth.sms.test_otp] -# 4152127777 = "123456" - -# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used. -[auth.hook.custom_access_token] -# enabled = true -# uri = "pg-functions:////" - - -# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`. -[auth.sms.twilio] -enabled = false -account_sid = "" -message_service_sid = "" -# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead: -auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)" - -# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`, -# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`, -# `twitter`, `slack`, `spotify`, `workos`, `zoom`. -[auth.external.apple] -enabled = false -client_id = "" -# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead: -secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)" -# Overrides the default auth redirectUrl. -redirect_uri = "" -# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure, -# or any other third-party OIDC providers. -url = "" - -[analytics] -enabled = false -port = 54327 -vector_port = 54328 -# Configure one of the supported backends: `postgres`, `bigquery`. -backend = "postgres" - -# Experimental features may be deprecated any time -[experimental] -# Configures Postgres storage engine to use OrioleDB (S3) -orioledb_version = "" -# Configures S3 bucket URL, eg. .s3-.amazonaws.com -s3_host = "env(S3_HOST)" -# Configures S3 bucket region, eg. us-east-1 -s3_region = "env(S3_REGION)" -# Configures AWS_ACCESS_KEY_ID for S3 bucket -s3_access_key = "env(S3_ACCESS_KEY)" -# Configures AWS_SECRET_ACCESS_KEY for S3 bucket -s3_secret_key = "env(S3_SECRET_KEY)" diff --git a/apps/supabase/migrations/20240129074946_initial_schema.sql b/apps/supabase/migrations/20240129074946_initial_schema.sql deleted file mode 100644 index f1975e501..000000000 --- a/apps/supabase/migrations/20240129074946_initial_schema.sql +++ /dev/null @@ -1,195 +0,0 @@ -create table "public"."auction_details" ( - "id" bigint generated by default as identity not null, - "created_at" timestamp with time zone not null default now(), - "exact_order_id" bigint, - "chain_id" text, - "symbol_auctioning_token" text, - "symbol_bidding_token" text, - "address_auctioning_token" text, - "address_bidding_token" text, - "decimals_auctioning_token" smallint, - "decimals_bidding_token" smallint, - "end_time_timestamp" timestamp without time zone, - "order_cancellation_end_date" timestamp without time zone, - "starting_time_stamp" timestamp without time zone, - "minimum_bidding_amount_per_order" bigint, - "min_funding_threshold" bigint, - "allow_list_manager" text, - "allow_list_signer" text, - "current_volume" integer, - "current_clearing_order_sell_amount" bigint, - "current_clearing_order_buy_amount" bigint, - "current_clearing_price" integer, - "current_bidding_amount" bigint, - "is_atomic_closure_allowed" boolean, - "is_private_auction" boolean, - "interest_score" integer, - "usd_amount_traded" integer -); - - -alter table "public"."auction_details" enable row level security; - -create table "public"."orders" ( - "id" bigint generated by default as identity not null, - "created_at" timestamp with time zone not null default now(), - "auction_id" bigint, - "sell_amount" bigint, - "buy_amount" bigint, - "user_id" bigint, - "price" integer, - "volume" bigint, - "timestamp" timestamp without time zone -); - - -alter table "public"."orders" enable row level security; - -create table "public"."users" ( - "id" bigint generated by default as identity not null, - "created_at" timestamp with time zone not null default now(), - "address" text not null -); - - -alter table "public"."users" enable row level security; - -CREATE UNIQUE INDEX auction_details_pkey ON public.auction_details USING btree (id); - -CREATE UNIQUE INDEX orders_pkey ON public.orders USING btree (id); - -CREATE UNIQUE INDEX users_pkey ON public.users USING btree (id, created_at); - -alter table "public"."auction_details" add constraint "auction_details_pkey" PRIMARY KEY using index "auction_details_pkey"; - -alter table "public"."orders" add constraint "orders_pkey" PRIMARY KEY using index "orders_pkey"; - -alter table "public"."users" add constraint "users_pkey" PRIMARY KEY using index "users_pkey"; - -grant delete on table "public"."auction_details" to "anon"; - -grant insert on table "public"."auction_details" to "anon"; - -grant references on table "public"."auction_details" to "anon"; - -grant select on table "public"."auction_details" to "anon"; - -grant trigger on table "public"."auction_details" to "anon"; - -grant truncate on table "public"."auction_details" to "anon"; - -grant update on table "public"."auction_details" to "anon"; - -grant delete on table "public"."auction_details" to "authenticated"; - -grant insert on table "public"."auction_details" to "authenticated"; - -grant references on table "public"."auction_details" to "authenticated"; - -grant select on table "public"."auction_details" to "authenticated"; - -grant trigger on table "public"."auction_details" to "authenticated"; - -grant truncate on table "public"."auction_details" to "authenticated"; - -grant update on table "public"."auction_details" to "authenticated"; - -grant delete on table "public"."auction_details" to "service_role"; - -grant insert on table "public"."auction_details" to "service_role"; - -grant references on table "public"."auction_details" to "service_role"; - -grant select on table "public"."auction_details" to "service_role"; - -grant trigger on table "public"."auction_details" to "service_role"; - -grant truncate on table "public"."auction_details" to "service_role"; - -grant update on table "public"."auction_details" to "service_role"; - -grant delete on table "public"."orders" to "anon"; - -grant insert on table "public"."orders" to "anon"; - -grant references on table "public"."orders" to "anon"; - -grant select on table "public"."orders" to "anon"; - -grant trigger on table "public"."orders" to "anon"; - -grant truncate on table "public"."orders" to "anon"; - -grant update on table "public"."orders" to "anon"; - -grant delete on table "public"."orders" to "authenticated"; - -grant insert on table "public"."orders" to "authenticated"; - -grant references on table "public"."orders" to "authenticated"; - -grant select on table "public"."orders" to "authenticated"; - -grant trigger on table "public"."orders" to "authenticated"; - -grant truncate on table "public"."orders" to "authenticated"; - -grant update on table "public"."orders" to "authenticated"; - -grant delete on table "public"."orders" to "service_role"; - -grant insert on table "public"."orders" to "service_role"; - -grant references on table "public"."orders" to "service_role"; - -grant select on table "public"."orders" to "service_role"; - -grant trigger on table "public"."orders" to "service_role"; - -grant truncate on table "public"."orders" to "service_role"; - -grant update on table "public"."orders" to "service_role"; - -grant delete on table "public"."users" to "anon"; - -grant insert on table "public"."users" to "anon"; - -grant references on table "public"."users" to "anon"; - -grant select on table "public"."users" to "anon"; - -grant trigger on table "public"."users" to "anon"; - -grant truncate on table "public"."users" to "anon"; - -grant update on table "public"."users" to "anon"; - -grant delete on table "public"."users" to "authenticated"; - -grant insert on table "public"."users" to "authenticated"; - -grant references on table "public"."users" to "authenticated"; - -grant select on table "public"."users" to "authenticated"; - -grant trigger on table "public"."users" to "authenticated"; - -grant truncate on table "public"."users" to "authenticated"; - -grant update on table "public"."users" to "authenticated"; - -grant delete on table "public"."users" to "service_role"; - -grant insert on table "public"."users" to "service_role"; - -grant references on table "public"."users" to "service_role"; - -grant select on table "public"."users" to "service_role"; - -grant trigger on table "public"."users" to "service_role"; - -grant truncate on table "public"."users" to "service_role"; - -grant update on table "public"."users" to "service_role"; - - diff --git a/apps/supabase/seed.sql b/apps/supabase/seed.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/supabase/tsconfig.json b/apps/supabase/tsconfig.json deleted file mode 100644 index 7556e1d4b..000000000 --- a/apps/supabase/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ESNext"], - "module": "esnext", - "target": "esnext", - "moduleResolution": "bundler", - "moduleDetection": "force", - "allowImportingTsExtensions": true, - "noEmit": true, - "composite": true, - "strict": true, - "downlevelIteration": true, - "skipLibCheck": true, - "jsx": "react-jsx", - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "allowJs": true, - "types": [ - "bun-types" // add Bun global - ] - } -} diff --git a/bun.lockb b/bun.lockb index 67ec16418..108caec82 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 2c1432fd9..2f293f53f 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@types/node": "^20.4.1", "eslint": "^8.44.0", "prettier": "^3.0.0", + "prisma": "latest", "turbo": "^1.11.2" }, "workspaces": {