-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccounts.go
31 lines (25 loc) · 1016 Bytes
/
accounts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Package account provides functions for account management on Flow blockhain.
package accounts
import (
"time"
"github.com/flow-hydraulics/flow-wallet-api/keys"
"gorm.io/gorm"
)
type AccountType string
const AccountTypeCustodial = "custodial"
const AccountTypeNonCustodial = "non-custodial"
// Account struct represents a storable account.
type Account struct {
Address string `json:"address" gorm:"primaryKey"`
Username string `json:"username" gorm:"column:username"`
Password string `json:"-" gorm:"column:password"`
Keys []keys.Storable `json:"keys" gorm:"foreignKey:AccountAddress;references:Address;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
Type AccountType `json:"type" gorm:"default:custodial"`
CreatedAt time.Time `json:"createdAt" `
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}
type AccountRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}