Add full monorepo: virtual-banker, backend, frontend, docs, scripts, deployment

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-02-10 11:32:49 -08:00
parent aafcd913c2
commit 88bc76da91
815 changed files with 125522 additions and 264 deletions

View File

@@ -0,0 +1,81 @@
package graphql
import (
"context"
"fmt"
"github.com/jackc/pgx/v5/pgxpool"
)
// Resolver handles GraphQL queries
type Resolver struct {
db *pgxpool.Pool
chainID int
}
// NewResolver creates a new GraphQL resolver
func NewResolver(db *pgxpool.Pool, chainID int) *Resolver {
return &Resolver{
db: db,
chainID: chainID,
}
}
// BlockResolver resolves Block queries
type BlockResolver struct {
db *pgxpool.Pool
chainID int
block *Block
}
// Block represents a block in GraphQL
type Block struct {
ChainID int32
Number int32
Hash string
ParentHash string
Timestamp string
Miner string
TransactionCount int32
GasUsed int64
GasLimit int64
}
// TransactionResolver resolves Transaction queries
type TransactionResolver struct {
db *pgxpool.Pool
chainID int
tx *Transaction
}
// Transaction represents a transaction in GraphQL
type Transaction struct {
ChainID int32
Hash string
BlockNumber int32
From string
To *string
Value string
GasPrice *int64
GasUsed *int64
Status *int32
}
// ResolveBlock resolves block query
func (r *Resolver) ResolveBlock(ctx context.Context, args struct {
ChainID int32
Number *int32
}) (*BlockResolver, error) {
// Implementation would fetch block from database
return nil, fmt.Errorf("not implemented")
}
// ResolveTransaction resolves transaction query
func (r *Resolver) ResolveTransaction(ctx context.Context, args struct {
ChainID int32
Hash string
}) (*TransactionResolver, error) {
// Implementation would fetch transaction from database
return nil, fmt.Errorf("not implemented")
}

View File

@@ -0,0 +1,102 @@
type Query {
block(chainId: Int!, number: Int): Block
blockByHash(chainId: Int!, hash: String!): Block
blocks(chainId: Int!, page: Int, pageSize: Int): BlockConnection!
transaction(chainId: Int!, hash: String!): Transaction
transactions(chainId: Int!, page: Int, pageSize: Int): TransactionConnection!
address(chainId: Int!, address: String!): Address
}
type Block {
chainId: Int!
number: Int!
hash: String!
parentHash: String!
timestamp: String!
miner: String!
transactionCount: Int!
gasUsed: Int!
gasLimit: Int!
transactions: [Transaction!]!
}
type Transaction {
chainId: Int!
hash: String!
blockNumber: Int!
from: String!
to: String
value: String!
gasPrice: Int
gasUsed: Int
status: Int
logs: [Log!]!
trace: Trace
}
type Log {
address: String!
topics: [String!]!
data: String!
logIndex: Int!
}
type Trace {
calls: [CallTrace!]!
}
type CallTrace {
type: String!
from: String!
to: String!
value: String!
gas: Int!
gasUsed: Int!
input: String!
output: String!
}
type Address {
address: String!
chainId: Int!
transactionCount: Int!
tokenCount: Int!
isContract: Boolean!
label: String
tags: [String!]!
}
type BlockConnection {
edges: [BlockEdge!]!
pageInfo: PageInfo!
}
type BlockEdge {
node: Block!
cursor: String!
}
type TransactionConnection {
edges: [TransactionEdge!]!
pageInfo: PageInfo!
}
type TransactionEdge {
node: Transaction!
cursor: String!
}
type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}
type Subscription {
newBlock(chainId: Int!): Block!
newTransaction(chainId: Int!): Transaction!
}