Documentation ¶
Index ¶
- Variables
- type BlockchainController
- type BlockchainService
- func (s *BlockchainService) Approve(ctx context.Context, spender common.Address, amount *big.Int) (common.Hash, error)
- func (s *BlockchainService) ClaimProviderBalance(ctx context.Context, sessionID [32]byte, to common.Address, amount *big.Int) (common.Hash, error)
- func (s *BlockchainService) CloseSession(ctx context.Context, sessionID common.Hash) (common.Hash, error)
- func (s *BlockchainService) GetAllModels(ctx context.Context) ([]*structs.Model, error)
- func (s *BlockchainService) GetAllProviders(ctx context.Context) ([]*structs.Provider, error)
- func (s *BlockchainService) GetAllowance(ctx context.Context, spender common.Address) (*big.Int, error)
- func (s *BlockchainService) GetBalance(ctx *gin.Context) (*big.Int, *big.Int, error)
- func (s *BlockchainService) GetBidByID(ctx context.Context, ID common.Hash) (*structs.Bid, error)
- func (s *BlockchainService) GetBidsByModelAgent(ctx context.Context, modelId [32]byte, offset *big.Int, limit uint8) ([]*structs.Bid, error)
- func (s *BlockchainService) GetBidsByProvider(ctx context.Context, providerAddr common.Address, offset *big.Int, limit uint8) ([]*structs.Bid, error)
- func (s *BlockchainService) GetLatestBlock(ctx context.Context) (uint64, error)
- func (s *BlockchainService) GetMyAddress(ctx context.Context) (common.Address, error)
- func (s *BlockchainService) GetProviderClaimableBalance(ctx *gin.Context, sessionID common.Hash) (*big.Int, error)
- func (s *BlockchainService) GetSession(ctx *gin.Context, sessionID common.Hash) (*sessionrouter.Session, error)
- func (s *BlockchainService) GetSessions(ctx *gin.Context, user, provider common.Address, offset *big.Int, limit uint8) ([]*structs.Session, error)
- func (s *BlockchainService) GetTodaysBudget(ctx context.Context) (*big.Int, error)
- func (s *BlockchainService) GetTokenSupply(ctx context.Context) (*big.Int, error)
- func (s *BlockchainService) GetTransactions(ctx context.Context, page uint64, limit uint8) ([]structs.RawTransaction, error)
- func (s *BlockchainService) OpenSession(ctx context.Context, approval, approvalSig []byte, stake *big.Int) (common.Hash, error)
- func (s *BlockchainService) OpenSessionByModelId(ctx context.Context, modelID common.Hash, duration *big.Int) (common.Hash, error)
- func (s *BlockchainService) SendETH(ctx *gin.Context, to common.Address, amount *big.Int) (common.Hash, error)
- func (s *BlockchainService) SendMOR(ctx context.Context, to common.Address, amount *big.Int) (common.Hash, error)
- type EventsListener
- type ExplorerClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPrKey = errors.New("cannot get private key") ErrTxOpts = errors.New("failed to get transactOpts") ErrNonce = errors.New("failed to get nonce") ErrEstimateGas = errors.New("failed to estimate gas") ErrSignTx = errors.New("failed to sign transaction") ErrSendTx = errors.New("failed to send transaction") ErrWaitMined = errors.New("failed to wait for transaction to be mined") ErrSessionStore = errors.New("failed to store session") ErrBid = errors.New("failed to get bid") ErrProvider = errors.New("failed to get provider") ErrTokenSupply = errors.New("failed to parse token supply") ErrBudget = errors.New("failed to parse token budget") ErrMyAddress = errors.New("failed to get my address") ErrInitSession = errors.New("failed to initiate session") ErrApprove = errors.New("failed to approve") ErrMarshal = errors.New("failed to marshal open session payload") )
Functions ¶
This section is empty.
Types ¶
type BlockchainController ¶
type BlockchainController struct {
// contains filtered or unexported fields
}
func NewBlockchainController ¶
func NewBlockchainController(service *BlockchainService, log lib.ILogger) *BlockchainController
func (*BlockchainController) RegisterRoutes ¶
func (c *BlockchainController) RegisterRoutes(r interfaces.Router)
type BlockchainService ¶
type BlockchainService struct {
// contains filtered or unexported fields
}
func NewBlockchainService ¶
func NewBlockchainService( ethClient *ethclient.Client, diamonContractAddr common.Address, morTokenAddr common.Address, explorerApiUrl string, privateKey interfaces.PrKeyProvider, sessionStorage *storages.SessionStorage, proxyService *proxyapi.ProxyServiceSender, log lib.ILogger, legacyTx bool, ) *BlockchainService
func (*BlockchainService) ClaimProviderBalance ¶
func (*BlockchainService) CloseSession ¶
func (*BlockchainService) GetAllModels ¶
func (*BlockchainService) GetAllProviders ¶
func (*BlockchainService) GetAllowance ¶
func (*BlockchainService) GetBalance ¶
func (*BlockchainService) GetBidByID ¶
func (*BlockchainService) GetBidsByModelAgent ¶
func (*BlockchainService) GetBidsByProvider ¶
func (*BlockchainService) GetLatestBlock ¶
func (s *BlockchainService) GetLatestBlock(ctx context.Context) (uint64, error)
func (*BlockchainService) GetMyAddress ¶
func (*BlockchainService) GetProviderClaimableBalance ¶
func (*BlockchainService) GetSession ¶
func (s *BlockchainService) GetSession(ctx *gin.Context, sessionID common.Hash) (*sessionrouter.Session, error)
func (*BlockchainService) GetSessions ¶
func (*BlockchainService) GetTodaysBudget ¶
func (*BlockchainService) GetTokenSupply ¶
func (*BlockchainService) GetTransactions ¶
func (s *BlockchainService) GetTransactions(ctx context.Context, page uint64, limit uint8) ([]structs.RawTransaction, error)
func (*BlockchainService) OpenSession ¶
func (*BlockchainService) OpenSessionByModelId ¶
type EventsListener ¶
type EventsListener struct {
// contains filtered or unexported fields
}
func NewEventsListener ¶
func NewEventsListener(client *ethclient.Client, store *storages.SessionStorage, sessionRouter *registries.SessionRouter, wallet interfaces.Wallet, log *lib.Logger) *EventsListener
type ExplorerClient ¶
type ExplorerClient struct {
// contains filtered or unexported fields
}
func NewExplorerClient ¶
func NewExplorerClient(explorerApiUrl string, morTokenAddr string) *ExplorerClient
func (*ExplorerClient) GetEthTransactions ¶
func (e *ExplorerClient) GetEthTransactions(address common.Address, page uint64, limit uint8) ([]structs.RawTransaction, error)
func (*ExplorerClient) GetTokenTransactions ¶
func (e *ExplorerClient) GetTokenTransactions(address common.Address, page uint64, limit uint8) ([]structs.RawTransaction, error)
Click to show internal directories.
Click to hide internal directories.