feat: 블록체인(chain) 통합 및 내부 API 추가
All checks were successful
Server CI/CD / deploy (push) Successful in 7s

- internal/chain 패키지 추가 (client, handler, service, repository, model)
- 체인 연동 엔드포인트: 지갑 조회, 잔액, 자산, 인벤토리, 마켓 등
- 관리자 전용 체인 엔드포인트: 민팅, 보상, 템플릿 등록
- 게임 서버용 내부 API (/api/internal/chain/*) + ServerAuth 미들웨어
- 회원가입 시 블록체인 월렛 자동 생성
- 체인 관련 환경변수 및 InternalAPIKey 설정 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 13:18:15 +09:00
parent 1b6260ee4e
commit f8b23e93bf
12 changed files with 1173 additions and 16 deletions

View File

@@ -0,0 +1,27 @@
package chain
import "gorm.io/gorm"
type Repository struct {
db *gorm.DB
}
func NewRepository(db *gorm.DB) *Repository {
return &Repository{db: db}
}
func (r *Repository) Create(w *UserWallet) error {
return r.db.Create(w).Error
}
func (r *Repository) FindByUserID(userID uint) (*UserWallet, error) {
var w UserWallet
err := r.db.Where("user_id = ?", userID).First(&w).Error
return &w, err
}
func (r *Repository) FindByPubKeyHex(pubKeyHex string) (*UserWallet, error) {
var w UserWallet
err := r.db.Where("pub_key_hex = ?", pubKeyHex).First(&w).Error
return &w, err
}