models

package
v0.0.0-...-702b61e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_DROPS_PER_KEY uint8 = 10

Variables

This section is empty.

Functions

func RecordDropForWallet

func RecordDropForWallet(pk *Wallet) error

Types

type User

type User struct {
	gorm.Model
	Email             string         `gorm:"size:255;not null;unique" json:"email"`
	SubOrganizationId sql.NullString `gorm:"size:255;unique;default:null" json:"subOrganizationId"`
}

func CreateUser

func CreateUser(email string) (*User, error)

func FindUserByEmail

func FindUserByEmail(email string) (User, error)

func FindUserById

func FindUserById(userId uint) (User, error)

func FindUserBySubOrganizationId

func FindUserBySubOrganizationId(subOrganizationId string) (User, error)

func UpdateUserTurnkeySubOrganization

func UpdateUserTurnkeySubOrganization(userId uint, subOrganizationId string) (*User, error)

func (*User) TurnkeyName

func (user *User) TurnkeyName() string

Given an internal user name, return the name of that user on the Turnkey side We prefix all end-users with "wallet-user-" for convenience

type Wallet

type Wallet struct {
	gorm.Model
	User            User
	UserID          int
	TurnkeyUUID     string `gorm:"size:255; not null"`
	EthereumAddress string `gorm:"size:255; not null"`
	Drops           uint8  `gorm:"default:0"`
}

Represents a Turnkey private key, created by our backend on behalf of a user This private key is bound to a user via Turnkey Policies.

func GetWalletForUser

func GetWalletForUser(u User) (*Wallet, error)

func SaveWalletForUser

func SaveWalletForUser(u *User, walletId, address string) (*Wallet, error)

func (*Wallet) DropsLeft

func (pk *Wallet) DropsLeft() uint8

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL