Documentation ¶
Index ¶
- Constants
- Variables
- func AddressToHex(address *common.Address) string
- func BytesToBase64(bytes []byte) string
- func ConvertBase64Encoding(str string) ([32]byte, error)
- func EstimateGas(wallet *bind.TransactOpts) (opts *bind.TransactOpts)
- func FormatHash(ipfsHash string) string
- func HexToAddress(str string) common.Address
- func HexToBytes(str string) []byte
- func ParseSignature(jobSignatureBytes []byte) (uint8, [32]byte, [32]byte, error)
- func RemoveSpecialCharactersfromHash(pString string) string
- func SetGas(wallet *bind.TransactOpts, gasLimit uint64) (opts *bind.TransactOpts)
- func StringToBytes32(str string) [32]byte
- func ToChecksumAddress(hexAddress string) string
- type EthereumClient
- type Group
- 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) 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) HasIdentity() bool
- func (processor *Processor) MultiPartyEscrow() *MultiPartyEscrow
- func (processor *Processor) MultiPartyEscrowChannel(channelID *big.Int) (channel *MultiPartyEscrowChannel, ok bool, err error)
- type ServiceMetadata
- func (metaData *ServiceMetadata) FreeCallSignerAddress() common.Address
- func (metaData ServiceMetadata) GetDefaultPricing() Pricing
- func (metaData *ServiceMetadata) GetDisplayName() string
- func (metaData *ServiceMetadata) GetFreeCallsAllowed() int
- 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
- 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
Constants ¶
const IpfsPrefix = "ipfs://"
{ "version": 1, "display_name": "Entity Disambiguation", "encoding": "proto", "service_type": "grpc", "model_ipfs_hash": "Qmd21xqgX8fkU4fD2bFMNG2Q86wAB4GmGBekQfLoiLtXYv", "mpe_address": "0x34E2EeE197EfAAbEcC495FdF3B1781a3b894eB5f", "groups": [ { "group_name": "default_group", "free_calls": 12, "free_call_signer_address": "0x7DF35C98f41F3Af0df1dc4c7F7D4C19a71Dd059F", "pricing": [ { "price_model": "fixed_price", "price_in_cogs": 1, "default": true } ], "endpoints": [ "https://tz-services-1.snet.sh:8005" ], "group_id": "EoFmN3nvaXpf6ew8jJbIPVghE5NXfYupFF7PkRmVyGQ=" } ], "assets": { "hero_image": "Qmb1n3LxPXLHTUMu7afrpZdpug4WhhcmVVCEwUxjLQafq1/hero_named-entity-disambiguation.png" }, "service_description": { "url": "https://singnet.github.io/nlp-services-misc/users_guide/named-entity-disambiguation-service.html", "description": "Provide further clearity regaridng entities named within a piece of text. For example, \"Paris is the capital of France\", we would want to link \"Paris\" to Paris the city not Paris Hilton in this case.", "short_description": "text of 180 chars" }, "contributors": [ { "name": "dummy dummy", "email_id": "dummy@dummy.io" } ] }
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 ¶ added in v0.1.2
AddressToHex converts Ethereum address to hex string representation.
func BytesToBase64 ¶ added in v0.1.2
BytesToBase64 converts array of bytes to base64 string.
func ConvertBase64Encoding ¶ added in v0.1.3
func EstimateGas ¶ added in v0.1.2
func EstimateGas(wallet *bind.TransactOpts) (opts *bind.TransactOpts)
func FormatHash ¶ added in v0.1.3
func HexToAddress ¶ added in v0.1.2
HexToAddress converts hex string to Ethreum address.
func HexToBytes ¶ added in v0.1.2
HexToBytes converts hex string to bytes array.
func ParseSignature ¶ added in v0.1.2
ParseSignature parses Ethereum signature.
func RemoveSpecialCharactersfromHash ¶ added in v0.1.3
func SetGas ¶ added in v0.1.2
func SetGas(wallet *bind.TransactOpts, gasLimit uint64) (opts *bind.TransactOpts)
func StringToBytes32 ¶ added in v0.1.2
func ToChecksumAddress ¶ added in v1.1.1
Types ¶
type EthereumClient ¶ added in v0.1.3
func GetEthereumClient ¶ added in v0.1.3
func GetEthereumClient() (*EthereumClient, error)
func (*EthereumClient) Close ¶ added in v0.1.3
func (ethereumClient *EthereumClient) Close()
type Group ¶ added in v1.1.0
type Group struct { GroupName string `json:"group_name"` GroupID string `json:"group_id"` PaymentDetails Payment `json:"payment"` }
Structure to hold the individual group details , an Organization can have multiple groups
type MethodPricing ¶ added in v1.1.0
type MultiPartyEscrowChannel ¶ added in v0.1.2
type OrganizationGroup ¶ added in v1.1.0
type OrganizationMetaData ¶ added in v1.1.0
type OrganizationMetaData struct { OrgName string `json:"org_name"` OrgID string `json:"org_id"` Groups []Group `json:"groups"` // contains filtered or unexported fields }
func GetOrganizationMetaData ¶ added in v1.1.0
func GetOrganizationMetaData() *OrganizationMetaData
Will be used to load the Organization metadata when Daemon starts To be part of components
func GetOrganizationMetaDataFromIPFS ¶ added in v1.1.0
func GetOrganizationMetaDataFromIPFS(hash string) (*OrganizationMetaData, error)
func InitOrganizationMetaDataFromJson ¶ added in v1.1.0
func InitOrganizationMetaDataFromJson(jsonData string) (metaData *OrganizationMetaData, err error)
Construct the Organization metadata from the JSON Passed
func (OrganizationMetaData) GetConnectionTimeOut ¶ added in v1.1.0
func (metaData OrganizationMetaData) GetConnectionTimeOut() (connectionTimeOut time.Duration)
Get the connection time out defined
func (OrganizationMetaData) GetGroupId ¶ added in v1.1.0
func (metaData OrganizationMetaData) GetGroupId() [32]byte
Return the group id in bytes
func (OrganizationMetaData) GetGroupIdString ¶ added in v1.1.0
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) GetPaymentAddress ¶ added in v1.1.0
func (metaData OrganizationMetaData) GetPaymentAddress() common.Address
Pass the group Name and retrieve the details of the payment address/ recipient address.
func (*OrganizationMetaData) GetPaymentExpirationThreshold ¶ added in v1.1.0
func (metaData *OrganizationMetaData) GetPaymentExpirationThreshold() *big.Int
Payment expiration threshold
func (OrganizationMetaData) GetPaymentStorageEndPoints ¶ added in v1.1.0
func (metaData OrganizationMetaData) GetPaymentStorageEndPoints() []string
Get the End points of the Payment Storage used to update the storage state
func (OrganizationMetaData) GetRequestTimeOut ¶ added in v1.1.0
func (metaData OrganizationMetaData) GetRequestTimeOut() time.Duration
Get the Request time out defined
type Payment ¶ added in v1.1.0
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 ¶ added in v1.1.0
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 ¶ added in v1.1.0
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 ¶ added in v0.1.2
func (*Processor) EscrowContractAddress ¶ added in v0.1.2
func (*Processor) HasIdentity ¶ added in v0.1.3
func (*Processor) MultiPartyEscrow ¶ added in v0.1.2
func (processor *Processor) MultiPartyEscrow() *MultiPartyEscrow
func (*Processor) MultiPartyEscrowChannel ¶ added in v0.1.2
type ServiceMetadata ¶ added in v0.1.2
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"` MpeAddress string `json:"mpe_address"` // contains filtered or unexported fields }
func GetServiceMetaDataFromIPFS ¶ added in v0.1.3
func GetServiceMetaDataFromIPFS(hash string) (*ServiceMetadata, error)
func InitServiceMetaDataFromJson ¶ added in v0.1.3
func InitServiceMetaDataFromJson(jsonData string) (*ServiceMetadata, error)
func ReadServiceMetaDataFromLocalFile ¶ added in v1.1.0
func ReadServiceMetaDataFromLocalFile(filename string) (*ServiceMetadata, error)
func ServiceMetaData ¶ added in v0.1.3
func ServiceMetaData() *ServiceMetadata
func (*ServiceMetadata) FreeCallSignerAddress ¶
func (metaData *ServiceMetadata) FreeCallSignerAddress() common.Address
func (ServiceMetadata) GetDefaultPricing ¶ added in v1.1.0
func (metaData ServiceMetadata) GetDefaultPricing() Pricing
func (*ServiceMetadata) GetDisplayName ¶ added in v0.1.3
func (metaData *ServiceMetadata) GetDisplayName() string
func (*ServiceMetadata) GetFreeCallsAllowed ¶
func (metaData *ServiceMetadata) GetFreeCallsAllowed() int
func (*ServiceMetadata) GetMpeAddress ¶ added in v0.1.3
func (metaData *ServiceMetadata) GetMpeAddress() common.Address
func (*ServiceMetadata) GetServiceType ¶ added in v0.1.3
func (metaData *ServiceMetadata) GetServiceType() string
func (*ServiceMetadata) GetVersion ¶ added in v0.1.3
func (metaData *ServiceMetadata) GetVersion() int
func (*ServiceMetadata) GetWireEncoding ¶ added in v0.1.3
func (metaData *ServiceMetadata) GetWireEncoding() string
func (*ServiceMetadata) IsFreeCallAllowed ¶
func (metaData *ServiceMetadata) IsFreeCallAllowed() bool
type SimulatedEthereumEnvironment ¶ added in v0.1.2
type SimulatedEthereumEnvironment struct { SingnetPrivateKey *ecdsa.PrivateKey SingnetWallet *bind.TransactOpts ClientWallet *bind.TransactOpts ClientPrivateKey *ecdsa.PrivateKey ServerWallet *bind.TransactOpts ServerPrivateKey *ecdsa.PrivateKey Backend *backends.SimulatedBackend SingularityNetToken *SingularityNetToken MultiPartyEscrowAddress common.Address MultiPartyEscrow *MultiPartyEscrow }
func GetSimulatedEthereumEnvironment ¶ added in v0.1.2
func GetSimulatedEthereumEnvironment() (env SimulatedEthereumEnvironment)
func (*SimulatedEthereumEnvironment) Commit ¶ added in v0.1.2
func (env *SimulatedEthereumEnvironment) Commit() *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) MpeDeposit ¶ added in v0.1.2
func (env *SimulatedEthereumEnvironment) MpeDeposit(from *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) MpeOpenChannel ¶ added in v0.1.2
func (env *SimulatedEthereumEnvironment) MpeOpenChannel(from *bind.TransactOpts, to *bind.TransactOpts, amount int64, expiration int64, groupId [32]byte) *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) SnetApproveMpe ¶ added in v0.1.2
func (env *SimulatedEthereumEnvironment) SnetApproveMpe(from *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment
func (*SimulatedEthereumEnvironment) SnetTransferTokens ¶ added in v0.1.2
func (env *SimulatedEthereumEnvironment) SnetTransferTokens(to *bind.TransactOpts, amount int64) *SimulatedEthereumEnvironment