Skip to content

Commit

Permalink
Merge pull request #206 from hypercerts-org/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bitbeckers authored Aug 30, 2024
2 parents ff21bda + df97d1c commit 8e69e16
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/supabase-ci-production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: roll out supabase migration
name: roll out supabase migration to production
on:
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/supabase-ci-staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: roll out supabase migration
name: roll out supabase migration to staging
on:
push:
branches:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/supabase-ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: verify supabase types
on:
pull_request:

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
# Retrieve <project-id> from dashboard url: https://app.supabase.com/project/<project-id>
PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: supabase/setup-cli@v1
with:
version: latest

- name: Start Supabase local development setup
run: supabase start

- name: Verify generated types are checked in
run: |
supabase gen types typescript --local > src/types/database-generated.types.ts
if ! git diff --ignore-space-at-eol --exit-code --quiet ./src/types/database-generated.types.ts; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"prool": "^0.0.15",
"rimraf": "^5.0.5",
"sinon": "^17.0.1",
"supabase": "^1.187.3",
"supabase": "^1.191.3",
"supertest": "^6.3.4",
"ts-mockito": "^2.6.1",
"tsx": "^4.7.1",
Expand All @@ -66,9 +66,9 @@
},
"dependencies": {
"@hypercerts-org/chainsauce": "1.0.24",
"@hypercerts-org/contracts": "2.0.0-alpha.5",
"@hypercerts-org/marketplace-sdk": "^0.3.32",
"@hypercerts-org/sdk": "^2.0.0-alpha.37",
"@hypercerts-org/contracts": "2.0.0-alpha.7",
"@hypercerts-org/marketplace-sdk": "^0.3.33",
"@hypercerts-org/sdk": "^2.1.1",
"@opentelemetry/instrumentation": "^0.52.1",
"@openzeppelin/merkle-tree": "^1.0.7",
"@supabase/postgrest-js": "^1.15.7",
Expand Down
66 changes: 33 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ const main = async () => {
console.log("🕊️ Seeding contracts...");
await supabase.from("contracts").upsert(
[
{
chain_id: 421614,
contract_address: "0x0A00a2f09cd37B24E7429c5238323bfebCfF3Ed9",
start_block: 69066523,
contract_slug: minterContractSlug,
},
{
chain_id: 421614,
contract_address: "0x1d905Bec93E48C64649300688B99D5F7d11ac412",
start_block: 72624136,
contract_slug: marketplaceContractSlug,
},
{
chain_id: 42220,
contract_address: "0x16bA53B74c234C870c61EFC04cD418B8f2865959",
Expand Down
19 changes: 17 additions & 2 deletions src/clients/evmClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { createPublicClient, fallback, http } from "viem";
import { base, baseSepolia, celo, optimism, sepolia } from "viem/chains";
import {
arbitrumSepolia,
base,
baseSepolia,
celo,
optimism,
sepolia,
} from "viem/chains";
import {
alchemyApiKey,
drpcApiPkey,
Expand All @@ -9,7 +16,7 @@ import {
} from "@/utils/constants.js";

export const getSupportedChains = () => {
if (environment === Environment.TEST) return [11155111, 84532];
if (environment === Environment.TEST) return [11155111, 84532, 421614];
if (environment === Environment.PRODUCTION) return [10, 8453, 42220];
};

Expand All @@ -21,6 +28,8 @@ const selectedNetwork = (chainId: number) => {
return base;
case 42220:
return celo;
case 421614:
return arbitrumSepolia;
case 84532:
return baseSepolia;
case 11155111:
Expand All @@ -38,6 +47,8 @@ export const alchemyUrl = (chainId: number) => {
return `https://base-mainnet.g.alchemy.com/v2/${alchemyApiKey}`;
case 42220:
return;
case 421614:
return `https://arb-sepolia.g.alchemy.com/v2/${alchemyApiKey}`;
case 84532:
return `https://base-sepolia.g.alchemy.com/v2/${alchemyApiKey}`;
case 11155111:
Expand All @@ -55,6 +66,8 @@ const infuraUrl = (chainId: number) => {
return;
case 42220:
return `https://celo-mainnet.infura.io/v3/${infuraApiKey}`;
case 421614:
return `https://arbitrum-sepolia.infura.io/v3/${infuraApiKey}`;
case 84532:
return;
case 11155111:
Expand All @@ -72,6 +85,8 @@ const drpcUrl = (chainId: number) => {
return `https://lb.drpc.org/ogrpc?network=base&dkey=${drpcApiPkey}`;
case 42220:
return `https://lb.drpc.org/ogrpc?network=celo&dkey=${drpcApiPkey}`;
case 421614:
return `https://lb.drpc.org/ogrpc?network=arbitrum-sepolia&dkey=${drpcApiPkey}`;
case 84532:
return;
case 11155111:
Expand Down
6 changes: 6 additions & 0 deletions src/types/database-generated.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export type Database = {
}
claims: {
Row: {
attestations_count: number | null
contracts_id: string
creation_block_number: number
creation_block_timestamp: number
Expand All @@ -142,13 +143,15 @@ export type Database = {
last_update_block_number: number
last_update_block_timestamp: number
owner_address: string | null
sales_count: number | null
token_id: number
units: number | null
uri: string | null
value: number | null
claim_attestation_count: number | null
}
Insert: {
attestations_count?: number | null
contracts_id: string
creation_block_number: number
creation_block_timestamp: number
Expand All @@ -158,12 +161,14 @@ export type Database = {
last_update_block_number: number
last_update_block_timestamp: number
owner_address?: string | null
sales_count?: number | null
token_id: number
units?: number | null
uri?: string | null
value?: number | null
}
Update: {
attestations_count?: number | null
contracts_id?: string
creation_block_number?: number
creation_block_timestamp?: number
Expand All @@ -173,6 +178,7 @@ export type Database = {
last_update_block_number?: number
last_update_block_timestamp?: number
owner_address?: string | null
sales_count?: number | null
token_id?: number
units?: number | null
uri?: string | null
Expand Down
Loading

0 comments on commit 8e69e16

Please sign in to comment.