Versions in this module Expand all Collapse all v0 v0.1.0 Oct 13, 2020 Changes in this version + const AccountNameDefault + const AccountNameWildcard + const AllChains + const DefaultBatchCapacity + const DefaultBatchExecutionDelay + const DefaultSwapValidity + const FlagCurencyAll + const FlagCurencyAvailable + const FlagCurencyDisable + const HistoryMaxOperationCount + const MaxAssetIconDataLen + var ErrAccountExists = errors.New("Account Exists") + var ErrAccountIsDisabled = errors.New("Account Is Disabled") + var ErrAccountNotFound = errors.New("Account Not Found") + var ErrAccountStateNotFound = errors.New("Account State Not Found") + var ErrAssetIconToLarge = errors.New("AssetIcon Too Large") + var ErrCurrencyNotAvailable = errors.New("Currency Not Available") + var ErrCurrencyNotCrypto = errors.New("Currency Not Crypto") + var ErrCurrencyNotFound = errors.New("Currency Not found") + var ErrDatabaseError = errors.New("Database Operation failed") + var ErrFeeInfoInvalid = errors.New("Invalid FeeInfo") + var ErrInvalidAccountID = errors.New("Invalid AccountID") + var ErrInvalidAccountOperation = errors.New("Invalid Account Operation") + var ErrInvalidAccountState = errors.New("Invalid Account State") + var ErrInvalidAssetHash = errors.New("Invalid AssetHash") + var ErrInvalidAssetID = errors.New("Invalid AssetID") + var ErrInvalidAssetIcon = errors.New("Invalid AssetIcon") + var ErrInvalidAssetInfo = errors.New("Invalid AssetInfo") + var ErrInvalidBatchID = errors.New("Invalid BatchID") + var ErrInvalidBatchInfoDataType = errors.New("Invalid BatchInfo DataType") + var ErrInvalidBatchInfoID = errors.New("Invalid BatchInfoID") + var ErrInvalidBatchMode = errors.New("Invalid BatchMode") + var ErrInvalidBatchStatus = errors.New("Invalid BatchInfo Status") + var ErrInvalidBatchWithdrawID = errors.New("Invalid BatchWithdrawID") + var ErrInvalidBatchWithdraws = errors.New("Invalid Withdraws") + var ErrInvalidChain = errors.New("Invalid Chain") + var ErrInvalidCryptoAddressID = errors.New("Invalid CryptoAddress ID") + var ErrInvalidCurrencyName = errors.New("Invalid Currency Name") + var ErrInvalidFeeAmount = errors.New("Invalid Fee Amount") + var ErrInvalidFeeID = errors.New("Invalid FeeID") + var ErrInvalidNetwork = errors.New("Invalid Network") + var ErrInvalidOAuthData = errors.New("Invalid OAuth Data") + var ErrInvalidOAuthID = errors.New("Invalid OAuthID") + var ErrInvalidOperationAmount = errors.New("Invalid Operation Amount") + var ErrInvalidOperationInfoID = errors.New("Invalid OperationInfo") + var ErrInvalidOperationStatus = errors.New("Invalid OperationStatus") + var ErrInvalidPasswordHash = errors.New("Invalid PasswordHash") + var ErrInvalidProvider = errors.New("Invalid Provider") + var ErrInvalidProviderID = errors.New("Invalid ProviderID") + var ErrInvalidPublicAddress = errors.New("Invalid Public Address") + var ErrInvalidReferenceID = errors.New("Invalid ReferenceID") + var ErrInvalidRoleName = errors.New("Invalid RoleName") + var ErrInvalidSsmAddressID = errors.New("Invalid SsmAddressID") + var ErrInvalidSsmPublicAddress = errors.New("Invalid PublicAddress ID") + var ErrInvalidSwapAmount = errors.New("Invalid Amount") + var ErrInvalidSwapID = errors.New("Invalid SwapID") + var ErrInvalidSwapInfoID = errors.New("Invalid SwapInfoID") + var ErrInvalidSwapPayload = errors.New("Invalid Swap Payload") + var ErrInvalidSwapType = errors.New("Invalid Swap Type") + var ErrInvalidTransactionID = errors.New("Invalid Transaction ID") + var ErrInvalidUserEmail = errors.New("Invalid User Email") + var ErrInvalidUserID = errors.New("Invalid UserID") + var ErrInvalidUserName = errors.New("Invalid User Name") + var ErrInvalidWithdrawAccount = errors.New("Invalid Withdraw Account") + var ErrInvalidWithdrawAccountCurrency = errors.New("Invalid Withdraw Account Currency") + var ErrInvalidWithdrawAmount = errors.New("Invalid Amount") + var ErrInvalidWithdrawID = errors.New("Invalid WithdrawID") + var ErrInvalidWithdrawInfoData = errors.New("Invalid WithdrawInfo Data") + var ErrInvalidWithdrawInfoID = errors.New("Invalid WithdrawInfoID") + var ErrInvalidWithdrawStatus = errors.New("Invalid WithdrawInfo Status") + var ErrInvalidWithdrawTargetData = errors.New("Invalid WithdrawTarget Data") + var ErrInvalidWithdrawTargetID = errors.New("Invalid WithdrawTargetID") + var ErrOperationInfoUpdateNotPermitted = errors.New("OperationInfo Update Not Permitted") + var ErrUserNotFound = errors.New("User not found") + func AccountModel() []database.Model + func AccountOperationModel() []database.Model + func AccountPage(db database.Context, accountID model.AccountID, countByPage int) ([]model.Account, error) + func AccountPagingCount(db database.Context, countByPage int) (int, error) + func AccountStateModel() []database.Model + func AccountsExists(db database.Context, userID model.UserID, currency model.CurrencyName, ...) bool + func AddAsset(db database.Context, assetHash model.AssetHash, ...) (model.Asset, error) + func AddBatch(db database.Context, network model.BatchNetwork, data model.BatchData, ...) (model.Batch, error) + func AddBatchInfo(db database.Context, batchID model.BatchID, status model.BatchStatus, ...) (model.BatchInfo, error) + func AddFee(db database.Context, withdrawID model.WithdrawID, amount model.Float, ...) (model.Fee, error) + func AddOperationInfo(db database.Context, operation model.OperationInfo) (model.OperationInfo, error) + func AddOrUpdateAccountState(db database.Context, accountSate model.AccountState) (model.AccountState, error) + func AddOrUpdateAssetIcon(db database.Context, entry model.AssetIcon) (model.AssetIcon, error) + func AddOrUpdateAssetInfo(db database.Context, entry model.AssetInfo) (model.AssetInfo, error) + func AddOrUpdateCryptoAddress(db database.Context, address model.CryptoAddress) (model.CryptoAddress, error) + func AddOrUpdateCurrency(db database.Context, currency model.Currency) (model.Currency, error) + func AddOrUpdateFeeInfo(db database.Context, feeInfo model.FeeInfo) (model.FeeInfo, error) + func AddOrUpdateOperationStatus(db database.Context, operation model.OperationStatus) (model.OperationStatus, error) + func AddSsmAddress(db database.Context, address model.SsmAddress, info model.SsmAddressInfo) (model.SsmAddressID, error) + func AddSwap(db database.Context, swapType model.SwapType, ...) (model.Swap, error) + func AddSwapInfo(db database.Context, swapID model.SwapID, status model.SwapStatus, ...) (model.SwapInfo, error) + func AddWithdraw(db database.Context, from, to model.AccountID, amount model.Float, ...) (model.Withdraw, error) + func AddWithdrawInfo(db database.Context, withdrawID model.WithdrawID, status model.WithdrawStatus, ...) (model.WithdrawInfo, error) + func AddWithdrawTarget(db database.Context, withdrawID model.WithdrawID, ...) (model.WithdrawTarget, error) + func AddWithdrawToBatch(db database.Context, batchID model.BatchID, withdraws ...model.WithdrawID) error + func AllAccountCryptoAddresses(db database.Context, accountID model.AccountID) ([]model.CryptoAddress, error) + func AllMempoolCryptoAddresses(db database.Context, chain model.String) ([]model.CryptoAddress, error) + func AllUnconfirmedCryptoAddresses(db database.Context, chain model.String, afterBlock model.BlockID) ([]model.CryptoAddress, error) + func AllUnusedAccountCryptoAddresses(db database.Context, accountID model.AccountID) ([]model.CryptoAddress, error) + func AllUnusedCryptoAddresses(db database.Context, chain model.String) ([]model.CryptoAddress, error) + func AppendAccountOperation(db database.Context, operation model.AccountOperation) (model.AccountOperation, error) + func AppendAccountOperationSlice(db database.Context, operations ...model.AccountOperation) ([]model.AccountOperation, error) + func AppendCurencyRates(db database.Context, currencyRates []model.CurrencyRate) error + func AssetCount(db database.Context) (int64, error) + func AssetHashExists(db database.Context, assetHash model.AssetHash) bool + func AssetModel() []database.Model + func BatchPage(db database.Context, batchID model.BatchID, countByPage int) ([]model.BatchID, error) + func BatchPagingCount(db database.Context, countByPage int) (int, error) + func CheckCredential(ctx context.Context, db database.Context, login, password model.Base58) (model.UserID, bool, error) + func CountCurrencies(db database.Context) int + func CountSsmAddress(db database.Context, chain model.SsmChain, fingerprint model.SsmFingerprint) (int, error) + func CountSsmAddressByState(db database.Context, chain model.SsmChain, fingerprint model.SsmFingerprint, ...) (int, error) + func CreateAccount(db database.Context, account model.Account) (model.Account, error) + func CreateOrUpdateOAuthData(db database.Context, oauthData model.OAuthData) (model.OAuthData, error) + func CreateOrUpdatedCredential(ctx context.Context, db database.Context, credential model.Credential) (model.Credential, error) + func CryptoAddressModel() []database.Model + func CurrencyExists(db database.Context, name model.CurrencyName) bool + func CurrencyModel() []database.Model + func DepositPage(db database.Context, operationInfoID model.OperationInfoID, countByPage int) ([]model.OperationInfoID, error) + func DepositPagingCount(db database.Context, countByPage int) (int, error) + func FeeInfoExists(db database.Context, currency model.CurrencyName) bool + func FeeModel() []database.Model + func FetchBatchByLastStatus(db database.Context, status model.BatchStatus) ([]model.Batch, error) + func FetchBatchReady(db database.Context) ([]model.Batch, error) + func FindAccountOperationByReference(db database.Context, synchroneousType model.SynchroneousType, ...) (model.AccountOperation, error) + func FindActiveOperationInfo(db database.Context) ([]model.OperationInfo, error) + func FindActiveOperationStatus(db database.Context) ([]model.OperationStatus, error) + func FindCryptoAddressesByOperationInfoState(db database.Context, chain model.String, states ...model.String) ([]model.CryptoAddress, error) + func FindCryptoAddressesNotInOperationInfo(db database.Context, chain model.String) ([]model.CryptoAddress, error) + func FindOrCreateOAuth(db database.Context, oauth model.OAuth) (model.OAuth, error) + func FindOrCreateUser(db database.Context, user model.User) (model.User, error) + func FindUserByEmail(db database.Context, email model.UserEmail) (model.User, error) + func FindUserById(db database.Context, userID model.UserID) (model.User, error) + func FindWithdrawByCurrencyNameAndStatus(db database.Context, currency model.CurrencyName, status model.WithdrawStatus) ([]model.Withdraw, error) + func FindWithdrawByUser(db database.Context, userID model.UserID) ([]model.Withdraw, error) + func GeAccountHistory(db database.Context, accountID model.AccountID) ([]model.AccountOperation, error) + func GeAccountHistoryRange(db database.Context, accountID model.AccountID, from, to time.Time) ([]model.AccountOperation, error) + func GetAccountByID(db database.Context, accountID model.AccountID) (model.Account, error) + func GetAccountStatusByAccountID(db database.Context, accountID model.AccountID) (model.AccountState, error) + func GetAccountsByUserAndCurrencyAndName(db database.Context, userID model.UserID, currency model.CurrencyName, ...) ([]model.Account, error) + func GetAsset(db database.Context, assetID model.AssetID) (model.Asset, error) + func GetAssetByCurrencyName(db database.Context, currencyName model.CurrencyName) (model.Asset, error) + func GetAssetByHash(db database.Context, assetHash model.AssetHash) (model.Asset, error) + func GetAssetIcon(db database.Context, assetID model.AssetID) (model.AssetIcon, error) + func GetAssetInfo(db database.Context, assetID model.AssetID) (model.AssetInfo, error) + func GetBatch(db database.Context, ID model.BatchID) (model.Batch, error) + func GetBatchHistory(db database.Context, batchID model.BatchID) ([]model.BatchInfo, error) + func GetBatchInfo(db database.Context, ID model.BatchInfoID) (model.BatchInfo, error) + func GetBatchInfoByStatusAndType(db database.Context, status model.BatchStatus, dataType encoding.DataType) ([]model.BatchInfo, error) + func GetBatchWithdraws(db database.Context, batchID model.BatchID) ([]model.WithdrawID, error) + func GetCryptoAddress(db database.Context, ID model.CryptoAddressID) (model.CryptoAddress, error) + func GetCryptoAddressWithPublicAddress(db database.Context, publicAddress model.String) (model.CryptoAddress, error) + func GetCryptoAddressWithUnconfidential(db database.Context, unconfidential model.String) (model.CryptoAddress, error) + func GetCurrencyByName(db database.Context, name model.CurrencyName) (model.Currency, error) + func GetFee(db database.Context, ID model.FeeID) (model.Fee, error) + func GetFeeByWithdrawID(db database.Context, withdrawID model.WithdrawID) (model.Fee, error) + func GetFeeInfo(db database.Context, currency model.CurrencyName) (model.FeeInfo, error) + func GetLastAccountOperation(db database.Context, accountID model.AccountID) (model.AccountOperation, error) + func GetLastBatchInfo(db database.Context, batchID model.BatchID) (model.BatchInfo, error) + func GetLastBatchInfoByStatusAndNetwork(db database.Context, status model.BatchStatus, network model.BatchNetwork) ([]model.BatchInfo, error) + func GetLastCurencyRates(db database.Context) ([]model.CurrencyRate, error) + func GetLastWithdrawInfo(db database.Context, withdrawID model.WithdrawID) (model.WithdrawInfo, error) + func GetLastWithdrawTargetByStatus(db database.Context, status model.WithdrawStatus) ([]model.WithdrawTarget, error) + func GetNextAccountOperation(db database.Context, accountID model.AccountID, ...) (model.AccountOperation, error) + func GetOperationInfo(db database.Context, operationID model.OperationInfoID) (model.OperationInfo, error) + func GetOperationInfoByCryptoAddress(db database.Context, cryptoAddressID model.CryptoAddressID) ([]model.OperationInfo, error) + func GetOperationInfoByTxId(db database.Context, txID model.TxID) (model.OperationInfo, error) + func GetOperationStatus(db database.Context, operationInfoID model.OperationInfoID) (model.OperationStatus, error) + func GetPreviousAccountOperation(db database.Context, accountID model.AccountID, ...) (model.AccountOperation, error) + func GetSsmAddress(db database.Context, addressID model.SsmAddressID) (model.SsmAddress, error) + func GetSsmAddressByPublicAddress(db database.Context, publicAddress model.SsmPublicAddress) (model.SsmAddress, error) + func GetSsmAddressInfo(db database.Context, addressID model.SsmAddressID) (model.SsmAddressInfo, error) + func GetSsmAddressState(db database.Context, addressID model.SsmAddressID) (model.SsmAddressState, error) + func GetSwap(db database.Context, swapID model.SwapID) (model.Swap, error) + func GetSwapByCryptoAddressID(db database.Context, cryptoAddressID model.CryptoAddressID) (model.Swap, error) + func GetSwapInfo(db database.Context, swapInfoID model.SwapInfoID) (model.SwapInfo, error) + func GetSwapInfoBySwapID(db database.Context, swapID model.SwapID) (model.SwapInfo, error) + func GetUserAccounts(db database.Context, userID model.UserID) ([]model.AccountID, error) + func GetWithdraw(db database.Context, ID model.WithdrawID) (model.Withdraw, error) + func GetWithdrawHistory(db database.Context, withdrawID model.WithdrawID) ([]model.WithdrawInfo, error) + func GetWithdrawInfo(db database.Context, ID model.WithdrawInfoID) (model.WithdrawInfo, error) + func GetWithdrawTarget(db database.Context, ID model.WithdrawTargetID) (model.WithdrawTarget, error) + func GetWithdrawTargetByWithdrawID(db database.Context, withdrawID model.WithdrawID) (model.WithdrawTarget, error) + func HashEntry(entry model.Base58) model.Base58 + func LastAccountCryptoAddress(db database.Context, accountID model.AccountID) (model.CryptoAddress, error) + func ListAllCurrency(db database.Context) ([]model.Currency, error) + func ListAvailableCurrency(db database.Context) ([]model.Currency, error) + func ListBatchNetworksByStatus(db database.Context, status model.BatchStatus) ([]model.BatchNetwork, error) + func ListCancelingWithdrawsAccountOperations(db database.Context) ([]model.AccountOperation, error) + func NextSsmAddressID(db database.Context, chain model.SsmChain, fingerprint model.SsmFingerprint) (model.SsmAddressID, error) + func OperationInfoModel() []database.Model + func QueryAccountList(db database.Context, userID model.UserID, currency model.CurrencyName, ...) ([]model.Account, error) + func QueryCurrencyList(db database.Context, name model.CurrencyName, available int) ([]model.Currency, error) + func ScopeAccountCurrencyName(name model.CurrencyName) func(db *gorm.DB) *gorm.DB + func ScopeAccountID(accountID model.AccountID) func(db *gorm.DB) *gorm.DB + func ScopeAccountName(name model.AccountName) func(db *gorm.DB) *gorm.DB + func ScopeCurencyAvailable(available int) func(db *gorm.DB) *gorm.DB + func ScopeCurencyName(name model.CurrencyName) func(db *gorm.DB) *gorm.DB + func ScopeFirstBefore(blockID model.BlockID) func(db *gorm.DB) *gorm.DB + func ScopeFirstBlockIDAfter(blockID model.BlockID) func(db *gorm.DB) *gorm.DB + func ScopeFirstBlockIDExact(blockID model.BlockID) func(db *gorm.DB) *gorm.DB + func ScopeUserID(userID model.UserID) func(db *gorm.DB) *gorm.DB + func SsmAddressModel() []database.Model + func SwapModel() []database.Model + func SwapPage(db database.Context, swapID model.SwapID, countByPage int) ([]model.SwapID, error) + func SwapPagingCount(db database.Context, countByPage int) (int, error) + func TxAppendAccountOperation(db database.Context, operation model.AccountOperation) (model.AccountOperation, error) + func TxAppendAccountOperationSlice(db database.Context, operations ...model.AccountOperation) ([]model.AccountOperation, error) + func UpdateSsmAddressState(db database.Context, addressID model.SsmAddressID, ...) (model.SsmAddressState, error) + func UserCount(db database.Context) (int, error) + func UserExists(db database.Context, userID model.UserID) bool + func UserHasRole(db database.Context, userID model.UserID, role model.RoleName) (bool, error) + func UserModel() []database.Model + func UserPage(db database.Context, userID model.UserID, countByPage int) ([]model.User, error) + func UserPagingCount(db database.Context, countByPage int) (int, error) + func UserRoles(db database.Context, userID model.UserID) ([]model.RoleName, error) + func WithdrawModel() []database.Model + func WithdrawPage(db database.Context, withdrawID model.WithdrawID, countByPage int) ([]model.WithdrawID, error) + func WithdrawPagingCount(db database.Context, countByPage int) (int, error) + type AccountInfo struct + Account model.Account + Currency model.Currency + Last model.AccountOperation + State model.AccountState + type AccountInfos struct + Accounts []AccountSummary + Active int + Count int + func AccountsInfos(db database.Context) (AccountInfos, error) + func AccountsInfosByUser(db database.Context, userID model.UserID) (AccountInfos, error) + type AccountOperationPrevNext struct + Next model.AccountOperationID + Previous model.AccountOperationID + func GeAccountHistoryWithPrevNext(db database.Context, accountID model.AccountID) ([]AccountOperationPrevNext, error) + type AccountSummary struct + Balance float64 + CurrencyName string + TotalLocked float64 + type BatchInfos struct + Active int + Count int + func BatchsInfos(db database.Context) (BatchInfos, error) + type DepositInfos struct + Active int + Count int + func DepositsInfos(db database.Context) (DepositInfos, error) + type SwapInfos struct + Active int + Count int + func SwapssInfos(db database.Context) (SwapInfos, error) + type WithdrawInfos struct + Active int + Count int + func WithdrawsInfos(db database.Context) (WithdrawInfos, error)