Documentation ¶
Index ¶
- Variables
- func AddressToHex(address *common.Address) string
- func BytesToBase64(bytes []byte) string
- func ConvertBase64Encoding(str string) ([32]byte, error)
- func CreateEthereumClients() (*EthereumClient, *EthereumClient, error)
- func EstimateGas(wallet *bind.TransactOpts) (opts *bind.TransactOpts)
- func HexToAddress(str string) common.Address
- func HexToBytes(str string) []byte
- func MakeTopicFilterer(param string) [][32]byte
- func ParseSignature(jobSignatureBytes []byte) (uint8, [32]byte, [32]byte, error)
- func SetGas(wallet *bind.TransactOpts, gasLimit uint64) (opts *bind.TransactOpts)
- func StringToBytes32(str string) [32]byte
- func ToChecksumAddress(hexAddress string) string
- type AddOns
- type EthereumClient
- type Group
- type Licenses
- type MethodPricing
- type MultiPartyEscrowChannel
- type OrganizationGroup
- type OrganizationMetaData
- func (metaData OrganizationMetaData) GetConnectionTimeOut() (connectionTimeOut time.Duration)
- func (metaData OrganizationMetaData) GetGroupId() [32]byte
- func (metaData OrganizationMetaData) GetGroupIdString() string
- func (metaData OrganizationMetaData) GetLicenseEndPoints() []string
- func (metaData OrganizationMetaData) GetPaymentAddress() common.Address
- func (metaData *OrganizationMetaData) GetPaymentExpirationThreshold() *big.Int
- func (metaData OrganizationMetaData) GetPaymentStorageEndPoints() []string
- func (metaData OrganizationMetaData) GetRequestTimeOut() time.Duration
- type Payment
- type PaymentChannelStorageClient
- type Pricing
- type PricingDetails
- type Processor
- func (processor *Processor) Close()
- func (processor *Processor) CurrentBlock() (currentBlock *big.Int, err error)
- func (processor *Processor) Enabled() (enabled bool)
- func (processor *Processor) EscrowContractAddress() common.Address
- func (processor *Processor) GetEthHttpClient() *ethclient.Client
- func (processor *Processor) GetEthWSClient() *ethclient.Client
- func (processor *Processor) HasIdentity() bool
- func (processor *Processor) MultiPartyEscrow() *MultiPartyEscrow
- func (processor *Processor) MultiPartyEscrowChannel(channelID *big.Int) (channel *MultiPartyEscrowChannel, ok bool, err error)
- func (processor *Processor) ReconnectToWsClient() error
- type ServiceMetadata
- func (metaData *ServiceMetadata) FreeCallSignerAddress() common.Address
- func (metaData ServiceMetadata) GetDefaultPricing() Pricing
- func (metaData *ServiceMetadata) GetDisplayName() string
- func (metaData *ServiceMetadata) GetDynamicPricingMethodAssociated(methodFullName string) (pricingMethod string, isDynamicPricingEligible bool)
- func (metaData *ServiceMetadata) GetFreeCallsAllowed() int
- func (metaData *ServiceMetadata) GetLicenses() Licenses
- func (metaData *ServiceMetadata) GetMpeAddress() common.Address
- func (metaData *ServiceMetadata) GetServiceType() string
- func (metaData *ServiceMetadata) GetVersion() int
- func (metaData *ServiceMetadata) GetWireEncoding() string
- func (metaData *ServiceMetadata) IsFreeCallAllowed() bool
- func (metaData *ServiceMetadata) IsModelTraining(methodFullName string) (useModelTrainingEndPoint bool)
- type SimulatedEthereumEnvironment
- func (env *SimulatedEthereumEnvironment) Commit() *SimulatedEthereumEnvironment
- func (env *SimulatedEthereumEnvironment) MpeDeposit(from *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
- func (env *SimulatedEthereumEnvironment) MpeOpenChannel(from *bind.TransactOpts, to *bind.TransactOpts, amount int64, expiration int64, ...) *SimulatedEthereumEnvironment
- func (env *SimulatedEthereumEnvironment) SnetApproveMpe(from *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
- func (env *SimulatedEthereumEnvironment) SnetTransferTokens(to *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
- type Subscription
- type Subscriptions
- type Tier
- type TierRange
- type Tiers
Constants ¶
This section is empty.
Variables ¶
var ( // HashPrefix32Bytes is an Ethereum signature prefix: see https://github.com/ethereum/go-ethereum/blob/bf468a81ec261745b25206b2a596eb0ee0a24a74/internal/ethapi/api.go#L361 HashPrefix32Bytes = []byte("\x19Ethereum Signed Message:\n32") )
Functions ¶
func AddressToHex ¶
AddressToHex converts Ethereum address to hex string representation.
func BytesToBase64 ¶
BytesToBase64 converts array of bytes to base64 string.
func ConvertBase64Encoding ¶
func CreateEthereumClients ¶
func CreateEthereumClients() (*EthereumClient, *EthereumClient, error)
func EstimateGas ¶
func EstimateGas(wallet *bind.TransactOpts) (opts *bind.TransactOpts)
func HexToAddress ¶
HexToAddress converts hex string to Ethreum address.
func MakeTopicFilterer ¶
MakeTopicFilterer is used to generate a filter for querying Ethereum logs or contract events. Ethereum topics (such as for events) are 32-byte fixed-size values (common for hashing in Ethereum logs). This function takes a string parameter, converts it into a 32-byte array, and returns it in a slice. This allows developers to create filters when looking for specific events or log entries based on the topic.
func ParseSignature ¶
ParseSignature parses Ethereum signature.
func SetGas ¶
func SetGas(wallet *bind.TransactOpts, gasLimit uint64) (opts *bind.TransactOpts)
func StringToBytes32 ¶
func ToChecksumAddress ¶
Types ¶
type EthereumClient ¶
func CreateHTTPEthereumClient ¶
func CreateHTTPEthereumClient() (*EthereumClient, error)
func CreateWSEthereumClient ¶
func CreateWSEthereumClient() (*EthereumClient, error)
func (*EthereumClient) Close ¶
func (ethereumClient *EthereumClient) Close()
type Group ¶
type Group struct { GroupName string `json:"group_name"` GroupID string `json:"group_id"` PaymentDetails Payment `json:"payment"` LicenseEndpoints []string `json:"license_server_endpoints"` }
Structure to hold the individual group details , an Organization can have multiple groups
type Licenses ¶
type Licenses struct { Subscriptions Subscriptions `json:"subscriptions,omitempty"` Tiers []Tier `json:"tiers"` }
type MethodPricing ¶
type MultiPartyEscrowChannel ¶
type OrganizationGroup ¶
type OrganizationGroup struct { Endpoints []string `json:"endpoints"` GroupID string `json:"group_id"` GroupName string `json:"group_name"` Pricing []Pricing `json:"pricing"` FreeCalls int `json:"free_calls"` FreeCallSigner string `json:"free_call_signer_address"` Licenses Licenses `json:"licenses,omitempty"` AddOns []AddOns `json:"addOns,omitempty"` }
type OrganizationMetaData ¶
type OrganizationMetaData struct { OrgName string `json:"org_name"` OrgID string `json:"org_id"` Groups []Group `json:"groups"` // contains filtered or unexported fields }
func GetOrganizationMetaData ¶
func GetOrganizationMetaData() *OrganizationMetaData
Will be used to load the Organization metadata when Daemon starts To be part of components
func GetOrganizationMetaDataFromIPFS ¶
func GetOrganizationMetaDataFromIPFS(hash string) (*OrganizationMetaData, error)
func InitOrganizationMetaDataFromJson ¶
func InitOrganizationMetaDataFromJson(jsonData []byte) (metaData *OrganizationMetaData, err error)
InitOrganizationMetaDataFromJson Construct the Organization metadata from the JSON Passed
func (OrganizationMetaData) GetConnectionTimeOut ¶
func (metaData OrganizationMetaData) GetConnectionTimeOut() (connectionTimeOut time.Duration)
Get the connection time out defined
func (OrganizationMetaData) GetGroupId ¶
func (metaData OrganizationMetaData) GetGroupId() [32]byte
Return the group id in bytes
func (OrganizationMetaData) GetGroupIdString ¶
func (metaData OrganizationMetaData) GetGroupIdString() string
Get the Group ID the Daemon needs to associate itself to , requests belonging to a different group if will be rejected
func (OrganizationMetaData) GetLicenseEndPoints ¶
func (metaData OrganizationMetaData) GetLicenseEndPoints() []string
func (OrganizationMetaData) GetPaymentAddress ¶
func (metaData OrganizationMetaData) GetPaymentAddress() common.Address
Pass the group Name and retrieve the details of the payment address/ recipient address.
func (*OrganizationMetaData) GetPaymentExpirationThreshold ¶
func (metaData *OrganizationMetaData) GetPaymentExpirationThreshold() *big.Int
Payment expiration threshold
func (OrganizationMetaData) GetPaymentStorageEndPoints ¶
func (metaData OrganizationMetaData) GetPaymentStorageEndPoints() []string
Get the End points of the Payment Storage used to update the storage state
func (OrganizationMetaData) GetRequestTimeOut ¶
func (metaData OrganizationMetaData) GetRequestTimeOut() time.Duration
Get the Request time out defined
type Payment ¶
type Payment struct { PaymentAddress string `json:"payment_address"` PaymentExpirationThreshold *big.Int `json:"payment_expiration_threshold"` PaymentChannelStorageType string `json:"payment_channel_storage_type"` PaymentChannelStorageClient PaymentChannelStorageClient `json:"payment_channel_storage_client"` }
type PaymentChannelStorageClient ¶
type PaymentChannelStorageClient struct { ConnectionTimeout string `json:"connection_timeout" mapstructure:"connection_timeout"` RequestTimeout string `json:"request_timeout" mapstructure:"request_timeout"` Endpoints []string `json:"endpoints"` }
Structure to hold the storage details of the payment
type PricingDetails ¶
type PricingDetails struct { ServiceName string `json:"service_name"` MethodPricing []MethodPricing `json:"method_pricing"` }
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func NewProcessor(metadata *ServiceMetadata) (Processor, error)
NewProcessor creates a new blockchain processor
func (*Processor) CurrentBlock ¶
func (*Processor) EscrowContractAddress ¶
func (*Processor) GetEthHttpClient ¶
func (*Processor) GetEthWSClient ¶
func (*Processor) HasIdentity ¶
func (*Processor) MultiPartyEscrow ¶
func (processor *Processor) MultiPartyEscrow() *MultiPartyEscrow
func (*Processor) MultiPartyEscrowChannel ¶
func (*Processor) ReconnectToWsClient ¶
type ServiceMetadata ¶
type ServiceMetadata struct { Version int `json:"version"` DisplayName string `json:"display_name"` Encoding string `json:"encoding"` ServiceType string `json:"service_type"` Groups []OrganizationGroup `json:"groups"` ModelIpfsHash string `json:"model_ipfs_hash"` ServiceApiSource string `json:"service_api_source"` MpeAddress string `json:"mpe_address"` DynamicPriceMethodMapping map[string]string `json:"dynamic_pricing"` TrainingMethods []string `json:"training_methods"` ProtoFile protoreflect.FileDescriptor `json:"-"` // contains filtered or unexported fields }
func GetServiceMetaDataFromIPFS ¶
func GetServiceMetaDataFromIPFS(hash string) (*ServiceMetadata, error)
func InitServiceMetaDataFromJson ¶
func InitServiceMetaDataFromJson(jsonData []byte) (*ServiceMetadata, error)
func ReadServiceMetaDataFromLocalFile ¶
func ReadServiceMetaDataFromLocalFile(filename string) (*ServiceMetadata, error)
func ServiceMetaData ¶
func ServiceMetaData() *ServiceMetadata
func (*ServiceMetadata) FreeCallSignerAddress ¶
func (metaData *ServiceMetadata) FreeCallSignerAddress() common.Address
func (ServiceMetadata) GetDefaultPricing ¶
func (metaData ServiceMetadata) GetDefaultPricing() Pricing
func (*ServiceMetadata) GetDisplayName ¶
func (metaData *ServiceMetadata) GetDisplayName() string
func (*ServiceMetadata) GetDynamicPricingMethodAssociated ¶
func (metaData *ServiceMetadata) GetDynamicPricingMethodAssociated(methodFullName string) (pricingMethod string, isDynamicPricingEligible bool)
methodFullName , ex "/example_service.Calculator/add"
func (*ServiceMetadata) GetFreeCallsAllowed ¶
func (metaData *ServiceMetadata) GetFreeCallsAllowed() int
func (*ServiceMetadata) GetLicenses ¶
func (metaData *ServiceMetadata) GetLicenses() Licenses
func (*ServiceMetadata) GetMpeAddress ¶
func (metaData *ServiceMetadata) GetMpeAddress() common.Address
func (*ServiceMetadata) GetServiceType ¶
func (metaData *ServiceMetadata) GetServiceType() string
func (*ServiceMetadata) GetVersion ¶
func (metaData *ServiceMetadata) GetVersion() int
func (*ServiceMetadata) GetWireEncoding ¶
func (metaData *ServiceMetadata) GetWireEncoding() string
func (*ServiceMetadata) IsFreeCallAllowed ¶
func (metaData *ServiceMetadata) IsFreeCallAllowed() bool
func (*ServiceMetadata) IsModelTraining ¶
func (metaData *ServiceMetadata) IsModelTraining(methodFullName string) (useModelTrainingEndPoint bool)
IsModelTraining methodFullName , ex "/example_service.Calculator/add"
type SimulatedEthereumEnvironment ¶
type SimulatedEthereumEnvironment struct { SingnetPrivateKey *ecdsa.PrivateKey SingnetWallet *bind.TransactOpts ClientWallet *bind.TransactOpts ClientPrivateKey *ecdsa.PrivateKey ServerWallet *bind.TransactOpts ServerPrivateKey *ecdsa.PrivateKey Backend *simulated.Backend SingularityNetToken *SingularityNetToken MultiPartyEscrowAddress common.Address MultiPartyEscrow *MultiPartyEscrow }
func GetSimulatedEthereumEnvironment ¶
func GetSimulatedEthereumEnvironment() (env SimulatedEthereumEnvironment)
func (*SimulatedEthereumEnvironment) Commit ¶
func (env *SimulatedEthereumEnvironment) Commit() *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) MpeDeposit ¶
func (env *SimulatedEthereumEnvironment) MpeDeposit(from *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) MpeOpenChannel ¶
func (env *SimulatedEthereumEnvironment) MpeOpenChannel(from *bind.TransactOpts, to *bind.TransactOpts, amount int64, expiration int64, groupId [32]byte) *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) SnetApproveMpe ¶
func (env *SimulatedEthereumEnvironment) SnetApproveMpe(from *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) SnetTransferTokens ¶
func (env *SimulatedEthereumEnvironment) SnetTransferTokens(to *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
type Subscription ¶
type Subscription struct { PeriodInDays int `json:"periodInDays"` DiscountInPercentage float64 `json:"discountInPercentage"` PlanName string `json:"planName"` LicenseCost big.Int `json:"licenseCost"` GrpcServiceName string `json:"grpcServiceName,omitempty"` GrpcMethodName string `json:"grpcMethodName,omitempty"` }
type Subscriptions ¶
type Subscriptions struct { Type string `json:"type"` DetailsURL string `json:"detailsUrl"` IsActive string `json:"isActive"` Subscription []Subscription `json:"subscription"` }