Skip to content

Commit

Permalink
Fix: rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Sep 25, 2023
1 parent 8f77ce8 commit 40e95a5
Show file tree
Hide file tree
Showing 52 changed files with 1,699 additions and 405 deletions.
1 change: 0 additions & 1 deletion cmd/api/handlers/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func GetInfo() gin.HandlerFunc {
}
c.SecureJSON(http.StatusOK, AccountInfo{
Address: acc.Address,
Alias: acc.Alias,
TxCount: stats.Count,
Balance: balance,
LastAction: stats.LastAction.UTC(),
Expand Down
1 change: 0 additions & 1 deletion cmd/api/handlers/bigmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func GetBigMap() gin.HandlerFunc {
if handleError(c, ctx.Storage, err, 0) {
return
}
res.ContractAlias = destination.Alias

operation, err := ctx.Operations.Last(
c.Request.Context(),
Expand Down
80 changes: 6 additions & 74 deletions cmd/api/handlers/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,13 @@ type Contract struct {
LastAction time.Time `json:"last_action,omitempty" extensions:"x-nullable"`
TxCount int64 `json:"tx_count,omitempty" extensions:"x-nullable"`
MigrationsCount int64 `json:"migrations_count,omitempty" extensions:"x-nullable"`
Alias string `json:"alias,omitempty" extensions:"x-nullable"`
DelegateAlias string `json:"delegate_alias,omitempty" extensions:"x-nullable"`
Slug string `json:"slug,omitempty" extensions:"x-nullable"`
}

// FromModel -
func (c *Contract) FromModel(contract contract.Contract) {
c.Address = contract.Account.Address
c.Alias = contract.Account.Alias
c.Delegate = contract.Delegate.Address
c.DelegateAlias = contract.Delegate.Alias
c.TxCount = contract.TxCount
c.LastAction = contract.LastAction

Expand Down Expand Up @@ -215,15 +211,13 @@ type ContractWithStats struct {
type RecentlyCalledContract struct {
ID int64 `json:"id"`
Address string `json:"address"`
Alias string `json:"alias,omitempty" extensions:"x-nullable"`
LastAction time.Time `json:"last_action,omitempty" extensions:"x-nullable"`
TxCount int64 `json:"tx_count,omitempty" extensions:"x-nullable"`
}

// FromModel -
func (c *RecentlyCalledContract) FromModel(contract contract.Contract) {
c.Address = contract.Account.Address
c.Alias = contract.Account.Alias
c.TxCount = contract.TxCount
c.LastAction = contract.LastAction
c.ID = contract.ID
Expand Down Expand Up @@ -253,13 +247,12 @@ type BigMapResponseItem struct {

// GetBigMapResponse -
type GetBigMapResponse struct {
Address string `json:"address"`
Network string `json:"network"`
Ptr int64 `json:"ptr"`
ActiveKeys uint `json:"active_keys"`
TotalKeys uint `json:"total_keys"`
ContractAlias string `json:"contract_alias,omitempty" extensions:"x-nullable"`
Typedef []ast.Typedef `json:"typedef,omitempty" extensions:"x-nullable"`
Address string `json:"address"`
Network string `json:"network"`
Ptr int64 `json:"ptr"`
ActiveKeys uint `json:"active_keys"`
TotalKeys uint `json:"total_keys"`
Typedef []ast.Typedef `json:"typedef,omitempty" extensions:"x-nullable"`
}

// Migration -
Expand All @@ -272,58 +265,6 @@ type Migration struct {
Kind string `json:"kind"`
}

// TokenContract -
type TokenContract struct {
Network string `json:"network"`
Level int64 `json:"level"`
Timestamp time.Time `json:"timestamp"`
LastAction time.Time `json:"last_action"`
Address string `json:"address"`
Manager string `json:"manager,omitempty" extensions:"x-nullable"`
Delegate string `json:"delegate,omitempty" extensions:"x-nullable"`
Alias string `json:"alias,omitempty" extensions:"x-nullable"`
DelegateAlias string `json:"delegate_alias,omitempty" extensions:"x-nullable"`
Type string `json:"type"`
Balance int64 `json:"balance"`
TxCount int64 `json:"tx_count"`
Methods map[string]TokenMethodStats `json:"methods,omitempty" extensions:"x-nullable"`
}

// TokenMethodStats -
type TokenMethodStats struct {
CallCount int64 `json:"call_count"`
AverageConsumedGas int64 `json:"average_consumed_gas"`
}

// PageableTokenContracts -
type PageableTokenContracts struct {
Total int64 `json:"total"`
Tokens []TokenContract `json:"tokens"`
}

// TokenTransfer -
type TokenTransfer struct {
Contract string `json:"contract"`
Network string `json:"network"`
Protocol string `json:"protocol"`
Hash string `json:"hash"`
Counter int64 `json:"counter,omitempty" extensions:"x-nullable"`
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
Level int64 `json:"level"`
From string `json:"from,omitempty" extensions:"x-nullable"`
To string `json:"to"`
Amount int64 `json:"amount"`
Source string `json:"source"`
Nonce *int64 `json:"nonce,omitempty" extensions:"x-nullable"`
}

// PageableTokenTransfers -
type PageableTokenTransfers struct {
Transfers []TokenTransfer `json:"transfers"`
LastID string `json:"last_id,omitempty" extensions:"x-nullable"`
}

// BigMapDiffItem -
type BigMapDiffItem struct {
Value interface{} `json:"value"`
Expand Down Expand Up @@ -397,14 +338,6 @@ type GetErrorLocationResponse struct {
EndColumn int `json:"end_col"`
}

// Alias -
type Alias struct {
Alias string `json:"alias" example:"Contract alias"`
Network string `json:"network" example:"babylonnet"`
Address string `json:"address" example:"KT1CeekjGVRc5ASmgWDc658NBExetoKNuiqz"`
Slug string `json:"slug" example:"contract_slug"`
}

// Protocol -
type Protocol struct {
Hash string `json:"hash" example:"PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb"`
Expand Down Expand Up @@ -497,7 +430,6 @@ type Screenshot struct {
// AccountInfo -
type AccountInfo struct {
Address string `json:"address"`
Alias string `json:"alias,omitempty" extensions:"x-nullable"`
Balance int64 `json:"balance"`
TxCount int64 `json:"tx_count"`
LastAction time.Time `json:"last_action"`
Expand Down
11 changes: 0 additions & 11 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,6 @@ type SeedConfig struct {
AvatarURL string `yaml:"avatar_url"`
Token string `yaml:"token"`
} `yaml:"user"`
Subscriptions []struct {
Address string `yaml:"address"`
Network string `yaml:"network"`
Alias string `yaml:"alias"`
WatchMask uint `yaml:"watch_mask"`
} `yaml:"subscriptions"`
Aliases []struct {
Alias string `yaml:"alias"`
Network string `yaml:"network"`
Address string `yaml:"address"`
} `yaml:"aliases"`
Accounts []struct {
PrivateKey string `yaml:"private_key"`
PublicKeyHash string `yaml:"public_key_hash"`
Expand Down
2 changes: 1 addition & 1 deletion internal/models/account/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Account struct {
ID int64 `bun:"id,pk,notnull,autoincrement"`
Type types.AccountType `bun:"type,type:SMALLINT"`
Address string `bun:"address"`
Alias string
Level int64 `bun:"level"`
}

// GetID -
Expand Down
1 change: 1 addition & 0 deletions internal/models/contract/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Script struct {
bun.BaseModel `bun:"scripts"`

ID int64 `bun:"id,pk,notnull,autoincrement"`
Level int64 `bun:"level"`
Hash string `bun:"hash"`
Code []byte `bun:",type:bytea"`
Parameter []byte `bun:",type:bytea"`
Expand Down
152 changes: 152 additions & 0 deletions internal/models/mock/model.go

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

Loading

0 comments on commit 40e95a5

Please sign in to comment.