contract

package
v0.0.0-...-365054f Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeIDImport                      = "err_id_import"
	ErrCodeIDSetDefault                  = "err_id_set_default"
	ErrCodeIDUseOrCreate                 = "err_to_id_use_or_create"
	ErrCodeIDUnlock                      = "err_id_unlock"
	ErrCodeIDLocked                      = "err_id_locked"
	ErrCodeIDNotRegistered               = "err_id_not_registered"
	ErrCodeIDStatusUnknown               = "err_id_status_unknown"
	ErrCodeIDCreate                      = "err_id_create"
	ErrCodeIDRegistrationCheck           = "err_id_registration_status_check"
	ErrCodeIDBlockchainRegistrationCheck = "err_id_registration_blockchain_status_check"
	ErrCodeIDRegistrationInProgress      = "err_id_registration_in_progress"
	ErrCodeIDCalculateAddress            = "err_id_calculate_address"
	ErrCodeIDSaveBeneficiaryAddress      = "err_id_save_beneficiary_invalid_address"
	ErrCodeIDGetBeneficiaryAddress       = "err_id_get_beneficiary_address"
	ErrCodeHermesMigration               = "err_id_check_hermes_migration"
	ErrCodeCheckHermesMigrationStatus    = "err_id_check_hermes_migration_status"

	ErrCodePaymentCreate         = "err_payment_create"
	ErrCodePaymentGet            = "err_payment_get"
	ErrCodePaymentGetInvoice     = "err_payment_get_invoice"
	ErrCodePaymentList           = "err_payment_list"
	ErrCodePaymentListCurrencies = "err_payment_list_currencies"
	ErrCodePaymentGetOptions     = "err_payment_get_order_options"
	ErrCodePaymentListGateways   = "err_payment_list_gateways"

	ErrCodeReferralGetToken = "err_referral_get_token"
	ErrCodeBeneficiaryGet   = "err_beneficiary_get"

	ErrCodeConfigSave = "err_config_save"

	ErrCodeConnectionAlreadyExists = "err_connection_already_exists"
	ErrCodeConnectionCancelled     = "err_connection_cancelled"
	ErrCodeConnect                 = "err_connect"
	ErrCodeNoConnectionExists      = "err_no_connection_exists"
	ErrCodeDisconnect              = "err_disconnect"

	ErrCodeFeedbackSubmit = "err_feedback_submit"

	ErrCodeMMNNodeAlreadyClaimed      = "err_mmn_node_already_claimed"
	ErrCodeMMNAPIKey                  = "err_mmn_api_key"
	ErrCodeMMNRegistration            = "err_mmn_registration"
	ErrCodeMMNClaimRedirectURLMissing = "err_mmn_claim_redirect_url_missing"
	ErrCodeMMNClaimLink               = "err_mmn_claim_link"

	ErrCodeNATProbe = "err_nat_probe"

	ErrCodeProposalsQuery          = "err_proposals_query"
	ErrCodeProposalsCountryQuery   = "err_proposals_countries_query"
	ErrCodeProposalsDetectLocation = "err_proposals_detect_location"
	ErrCodeProposalsPrices         = "err_proposals_prices"
	ErrCodeProposalsPresets        = "err_proposals_presets"
	ErrCodeProposalsServiceType    = "err_proposals_service_type"

	ErrCodeServiceList     = "err_service_list"
	ErrCodeServiceGet      = "err_service_get"
	ErrCodeServiceRunning  = "err_service_running"
	ErrCodeServiceLocation = "err_service_location"
	ErrCodeServiceStart    = "err_service_start"
	ErrCodeServiceStop     = "err_service_stop"

	ErrCodeSessionList         = "err_session_list"
	ErrCodeSessionListPaginate = "err_session_list_paginate"
	ErrCodeSessionStats        = "err_session_stats"
	ErrCodeSessionStatsDaily   = "err_session_stats_daily"

	ErrCodeTransactorRegistration          = "err_transactor_registration"
	ErrCodeTransactorFetchFees             = "err_transactor_fetch_fees"
	ErrCodeTransactorDecreaseStake         = "err_transactor_decrease_stake"
	ErrCodeTransactorSettleHistory         = "err_transactor_settle_history"
	ErrCodeTransactorSettleHistoryPaginate = "err_transactor_settle_history_paginate"
	ErrCodeTransactorWithdraw              = "err_transactor_withdraw"
	ErrCodeTransactorSettle                = "err_transactor_settle_into_stake"
	ErrCodeTransactorSettleAsync           = "err_transactor_settle_into_stake_async"
	ErrCodeTransactorNoReward              = "err_transactor_no_reward"
	ErrCodeTransactorBeneficiary           = "err_transactor_beneficiary"
	ErrCodeTransactorBeneficiaryTxStatus   = "err_transactor_beneficiary_tx_status"

	ErrCodeAffiliatorNoReward = "err_affiliator_no_reward"
	ErrCodeAffiliatorFailed   = "err_affiliator_failed"

	ErrCodeActiveHermes                    = "err_get_active_hermes"
	ErrCodeHermesFee                       = "err_hermes_fee"
	ErrCodeHermesSettle                    = "err_hermes_settle"
	ErrCodeHermesSettleAsync               = "err_hermes_settle_async"
	ErrCodeUILocalVersions                 = "err_ui_local_versions"
	ErrCodeUISwitchVersion                 = "err_ui_switch_version"
	ErrCodeUIDownload                      = "err_ui_download"
	ErrCodeUIBundledVersion                = "err_ui_bundled_version"
	ErrCodeUIUsedVersion                   = "err_ui_used_version"
	ErrorCodeProviderSessions              = "err_provider_sessions"
	ErrorCodeProviderTransferredData       = "err_provider_transferred_data"
	ErrorCodeProviderSessionsCount         = "err_provider_sessions_count"
	ErrorCodeProviderConsumersCount        = "err_provider_consumers_count"
	ErrorCodeProviderEarningsSeries        = "err_provider_earnings_series"
	ErrorCodeProviderSessionsSeries        = "err_provider_sessions_series"
	ErrorCodeProviderTransferredDataSeries = "err_provider_transferred_data_series"
	ErrorCodeProviderQuality               = "err_provider_quality"
	ErrorCodeProviderActivityStats         = "err_provider_activity_stats"
	ErrorCodeLatestReleaseInformation      = "err_latest_release_information"
	ErrorCodeProviderServiceEarnings       = "err_provider_service_earnings"
)

Err codes returned from TequilAPI. Once created, do not change the string value, because consumers may depend on it - it's part of the contract.

View Source
const (
	// MigrationStatusRequired means new there is new Hermes and identity required to migrate to it
	MigrationStatusRequired = "required"
	// MigrationStatusFinished means migration to new Hermes finished or not needed
	MigrationStatusFinished = "finished"
)
View Source
const (
	// TermsConsumerAgreed is the key which is used to store terms agreement
	// for consumer features.
	// This key can also be used to address the value directly in the config.
	TermsConsumerAgreed = "terms.consumer-agreed"

	// TermsProviderAgreed is the key which is used to store terms agreement
	// for provider features.
	// This key can also be used to address the value directly in the config.
	TermsProviderAgreed = "terms.provider-agreed"

	// TermsVersion is the key which is used to store terms agreement
	// version for both provider and consumer.
	// This key can also be used to address the value directly in the config.
	TermsVersion = "terms.version"
)
View Source
const AutoNATType = "auto"

AutoNATType passed as nat_compatibility parameter to proposal discovery indicates NAT type should be probed automatically immediately within given request

View Source
const HumanPrecision = 6

HumanPrecision default human ether amount precision

Variables

View Source
var TokensZero = Tokens{Wei: "0", Ether: "0", Human: "0"}

TokensZero zero amount

Functions

func NewEarningsPerHermesDTO

func NewEarningsPerHermesDTO(earnings map[common.Address]pingpong_event.Earnings) map[string]EarningsDTO

NewEarningsPerHermesDTO transforms the pingong value in a public one.

Types

type ActivityStatsResponse

type ActivityStatsResponse struct {
	Online float64 `json:"online_percent"`
	Active float64 `json:"active_percent"`
}

ActivityStatsResponse reflects a node activity stats. swagger:model ActivityStatsResponse

type AuthRequest

type AuthRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

AuthRequest request used to authenticate to API. swagger:model AuthRequest

type AuthResponse

type AuthResponse struct {
	// example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Im15c3QiLCJleHAiOjE2MDEwNDA1NzB9.hnn9FosblyWtx1feSupx3MhZZdkbCuMTaiM6xl54VwQ
	Token string `json:"token"`

	// example: 2019-06-06T11:04:43.910035Z
	ExpiresAt string `json:"expires_at"`
}

AuthResponse response after successful authentication to API. swagger:model AuthResponse

func NewAuthResponse

func NewAuthResponse(jwtToken auth.JWT) AuthResponse

NewAuthResponse maps to API authentication response.

type BalanceDTO

type BalanceDTO struct {
	Balance       *big.Int `json:"balance"`
	BalanceTokens Tokens   `json:"balance_tokens"`
}

BalanceDTO holds balance information. swagger:model BalanceDTO

type BeneficiaryAddressRequest

type BeneficiaryAddressRequest struct {
	Address string `json:"address"`
}

BeneficiaryAddressRequest address of the beneficiary swagger:model BeneficiaryAddressRequest

type BeneficiaryTxStatus

type BeneficiaryTxStatus struct {
	State beneficiary.SettleState `json:"state"`
	Error string                  `json:"error"`
	// example: 0x0000000000000000000000000000000000000001
	ChangeTo string `json:"change_to"`
}

BeneficiaryTxStatus settle with beneficiary transaction status. swagger:model BeneficiaryTxStatus

type BuildInfoDTO

type BuildInfoDTO struct {
	// example: <unknown>
	Commit string `json:"commit"`

	// example: <unknown>
	Branch string `json:"branch"`

	// example: dev-build
	BuildNumber string `json:"build_number"`
}

BuildInfoDTO holds info about build. swagger:model BuildInfoDTO

type ChainSummary

type ChainSummary struct {
	Chains       map[int64]string `json:"chains"`
	CurrentChain int64            `json:"current_chain"`
}

ChainSummary represents a response for token rewards. swagger:model ChainSummary

type ChangePasswordRequest

type ChangePasswordRequest struct {
	Username    string `json:"username"`
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

ChangePasswordRequest request used to change API password. swagger:model ChangePasswordRequest

type CombinedFeesResponse

type CombinedFeesResponse struct {
	Current TransactorFees `json:"current"`
	Last    TransactorFees `json:"last"`

	ServerTime    time.Time `json:"server_time"`
	HermesPercent string    `json:"hermes_percent"`
}

CombinedFeesResponse represents transactor fees. swagger:model CombinedFeesResponse

type ConnectOptions

type ConnectOptions struct {
	// kill switch option restricting communication only through VPN
	// required: false
	// example: true
	DisableKillSwitch bool `json:"kill_switch"`
	// DNS to use
	// required: false
	// default: auto
	// example: auto, provider, system, "1.1.1.1,8.8.8.8"
	DNS connection.DNSOption `json:"dns"`

	ProxyPort int `json:"proxy_port"`
}

ConnectOptions holds tequilapi connect options swagger:model ConnectOptionsDTO

type ConnectionCreateFilter

type ConnectionCreateFilter struct {
	Providers               []string `json:"providers,omitempty"`
	CountryCode             string   `json:"country_code,omitempty"`
	IPType                  string   `json:"ip_type,omitempty"`
	IncludeMonitoringFailed bool     `json:"include_monitoring_failed,omitempty"`
	SortBy                  string   `json:"sort_by,omitempty"`
}

ConnectionCreateFilter describes filter for the connection request to lookup for a requested proposals based on specified params.

type ConnectionCreateRequest

type ConnectionCreateRequest struct {
	// consumer identity
	// required: true
	// example: 0x0000000000000000000000000000000000000001
	ConsumerID string `json:"consumer_id"`

	// provider identity
	// required: true
	// example: 0x0000000000000000000000000000000000000002
	ProviderID string `json:"provider_id"`

	Filter ConnectionCreateFilter `json:"filter"`

	// hermes identity
	// example: 0x0000000000000000000000000000000000000003
	HermesID string `json:"hermes_id"`

	// service type. Possible values are "openvpn", "wireguard" and "noop"
	// required: false
	// default: openvpn
	// example: openvpn
	ServiceType string `json:"service_type"`

	// connect options
	// required: false
	ConnectOptions ConnectOptions `json:"connect_options,omitempty"`
}

ConnectionCreateRequest request used to start a connection. swagger:model ConnectionCreateRequestDTO

func (ConnectionCreateRequest) Event

Event creates a quality connection event to be send as a quality metric.

func (ConnectionCreateRequest) Validate

func (cr ConnectionCreateRequest) Validate() *apierror.APIError

Validate validates fields in request.

type ConnectionDTO

type ConnectionDTO struct {
	ConnectionInfoDTO
	Statistics *ConnectionStatisticsDTO `json:"statistics,omitempty"`
}

ConnectionDTO holds full consumer connection details. swagger:model ConnectionDTO

func NewConnectionDTO

func NewConnectionDTO(session connectionstate.Status, statistics connectionstate.Statistics, throughput bandwidth.Throughput, invoice crypto.Invoice) ConnectionDTO

NewConnectionDTO maps to API connection.

type ConnectionInfoDTO

type ConnectionInfoDTO struct {
	// example: Connected
	Status string `json:"status"`

	// example: 0x00
	ConsumerID string `json:"consumer_id,omitempty"`

	// example: 0x00
	HermesID string `json:"hermes_id,omitempty"`

	// example: {"id":1,"provider_id":"0x71ccbdee7f6afe85a5bc7106323518518cd23b94","service_type":"openvpn","location":{"country":"CA"}}
	Proposal *ProposalDTO `json:"proposal,omitempty"`

	// example: 4cfb0324-daf6-4ad8-448b-e61fe0a1f918
	SessionID string `json:"session_id,omitempty"`
}

ConnectionInfoDTO holds partial consumer connection details. swagger:model ConnectionInfoDTO

func NewConnectionInfoDTO

func NewConnectionInfoDTO(session connectionstate.Status) ConnectionInfoDTO

NewConnectionInfoDTO maps to API connection status.

type ConnectionStatisticsDTO

type ConnectionStatisticsDTO struct {
	// example: 1024
	BytesSent uint64 `json:"bytes_sent"`

	// example: 1024
	BytesReceived uint64 `json:"bytes_received"`

	// Upload speed in bits per second
	// example: 1024
	ThroughputSent uint64 `json:"throughput_sent"`

	// Download speed in bits per second
	// example: 1024
	ThroughputReceived uint64 `json:"throughput_received"`

	// connection duration in seconds
	// example: 60
	Duration int `json:"duration"`

	// example: 500000
	TokensSpent *big.Int `json:"tokens_spent"`

	SpentTokens Tokens `json:"spent_tokens"`
}

ConnectionStatisticsDTO holds consumer connection statistics. swagger:model ConnectionStatisticsDTO

func NewConnectionStatisticsDTO

func NewConnectionStatisticsDTO(session connectionstate.Status, statistics connectionstate.Statistics, throughput bandwidth.Throughput, invoice crypto.Invoice) ConnectionStatisticsDTO

NewConnectionStatisticsDTO maps to API connection stats.

type ConnectionTrafficDTO

type ConnectionTrafficDTO struct {
	// example: 1024
	BytesSent uint64 `json:"bytes_sent"`

	// example: 1024
	BytesReceived uint64 `json:"bytes_received"`
}

ConnectionTrafficDTO holds consumer connection traffic information. swagger:model ConnectionTrafficDTO

type CurrencyExchangeDTO

type CurrencyExchangeDTO struct {
	Amount   float64 `json:"amount"`
	Currency string  `json:"currency"`
}

CurrencyExchangeDTO the value of a given currency. swagger:model CurrencyExchangeDTO

type CurrentPriceResponse

type CurrentPriceResponse struct {
	ServiceType string `json:"service_type"`
	// deprecated
	PricePerHour       *big.Int `json:"price_per_hour"`
	PricePerHourTokens Tokens   `json:"price_per_hour_tokens"`
	// deprecated
	PricePerGiB       *big.Int `json:"price_per_gib"`
	PricePerGiBTokens Tokens   `json:"price_per_gib_tokens"`
}

CurrentPriceResponse represents the price. swagger:model CurrentPriceResponse

type DecreaseStakeRequest

type DecreaseStakeRequest struct {
	ID     string   `json:"id,omitempty"`
	Amount *big.Int `json:"amount,omitempty"`
}

DecreaseStakeRequest represents the decrease stake request swagger:model DecreaseStakeRequest

type DownloadNodeUIRequest

type DownloadNodeUIRequest struct {
	Version string `json:"version"`
}

DownloadNodeUIRequest request for downloading NodeUI version swagger:model DownloadNodeUIRequest

func (*DownloadNodeUIRequest) Valid

Valid validate DownloadNodeUIRequest

type EarningsDTO

type EarningsDTO struct {
	Earnings      Tokens `json:"earnings"`
	EarningsTotal Tokens `json:"earnings_total"`
}

EarningsDTO holds earnings data. swagger:model EarningsDTO

type EarningsPerServiceResponse

type EarningsPerServiceResponse struct {
	EarningsPublic        Tokens `json:"public_tokens"`
	EarningsVPN           Tokens `json:"data_transfer_tokens"`
	EarningsScraping      Tokens `json:"scraping_tokens"`
	EarningsDVPN          Tokens `json:"dvpn_tokens"`
	EarningsTotal         Tokens `json:"total_tokens"`
	TotalEarningsPublic   Tokens `json:"total_public_tokens"`
	TotalEarningsVPN      Tokens `json:"total_data_transfer_tokens"`
	TotalEarningsScraping Tokens `json:"total_scraping_tokens"`
	TotalEarningsDVPN     Tokens `json:"total_dvpn_tokens"`
}

EarningsPerServiceResponse contains information about earnings per service swagger:model EarningsPerServiceResponse

type EncryptedKeyJSON

type EncryptedKeyJSON struct {
	Address string     `json:"address"`
	Crypto  cryptoJSON `json:"crypto"`
	Id      string     `json:"id"`
	Version int        `json:"version"`
}

EncryptedKeyJSON represents response to IdentityExportRequest. swagger:model IdentityExportResponseDTO

type EntertainmentEstimateRequest

type EntertainmentEstimateRequest struct {
	Amount float64
}

EntertainmentEstimateRequest request to estimate entertainment amounts.

func (*EntertainmentEstimateRequest) Bind

Bind fills and validates EntertainmentEstimateRequest from API request.

type EntertainmentEstimateResponse

type EntertainmentEstimateResponse struct {
	VideoMinutes    uint64  `json:"video_minutes"`
	MusicMinutes    uint64  `json:"music_minutes"`
	BrowsingMinutes uint64  `json:"browsing_minutes"`
	TrafficMB       uint64  `json:"traffic_mb"`
	PriceGiB        float64 `json:"price_gib"`
	PriceMin        float64 `json:"price_min"`
}

EntertainmentEstimateResponse represents estimated entertainment. swagger:model EntertainmentEstimateResponse

type FeesDTO

type FeesDTO struct {
	Registration       *big.Int `json:"registration"`
	RegistrationTokens Tokens   `json:"registration_tokens"`
	Settlement         *big.Int `json:"settlement"`
	SettlementTokens   Tokens   `json:"settlement_tokens"`
	// deprecated - confusing name
	Hermes              uint16   `json:"hermes"`
	HermesPercent       string   `json:"hermes_percent"`
	DecreaseStake       *big.Int `json:"decreaseStake"`
	DecreaseStakeTokens Tokens   `json:"decrease_stake_tokens"`
}

FeesDTO represents the transactor fees swagger:model FeesDTO

type FilterPreset

type FilterPreset struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

FilterPreset is a pre-defined proposal filter. swagger:model FilterPreset

func NewFilterPreset

func NewFilterPreset(preset proposal.FilterPreset) FilterPreset

NewFilterPreset maps to the FilterPreset.

type GatewaysResponse

type GatewaysResponse struct {
	Name         string              `json:"name"`
	OrderOptions PaymentOrderOptions `json:"order_options"`
	Currencies   []string            `json:"currencies"`
}

GatewaysResponse holds payment gateway details. swagger:model GatewaysResponse

func ToGatewaysReponse

func ToGatewaysReponse(g []pilvytis.GatewaysResponse) []GatewaysResponse

ToGatewaysReponse converts a pilvytis gateway response to contract.

type HealthCheckDTO

type HealthCheckDTO struct {
	// example: 25h53m33.540493171s
	Uptime string `json:"uptime"`

	// example: 10449
	Process int `json:"process"`

	// example: 0.0.6
	Version   string       `json:"version"`
	BuildInfo BuildInfoDTO `json:"build_info"`
}

HealthCheckDTO holds API healthcheck. swagger:model HealthCheckDTO

type IPDTO

type IPDTO struct {
	// public IP address
	// example: 127.0.0.1
	IP string `json:"ip"`
}

IPDTO describes IP metadata. swagger:model IPDTO

type IdentityBeneficiaryResponse

type IdentityBeneficiaryResponse struct {
	Beneficiary      string `json:"beneficiary"`
	IsChannelAddress bool   `json:"is_channel_address"`
}

IdentityBeneficiaryResponse represents the provider beneficiary address. swagger:model IdentityBeneficiaryResponseDTO

type IdentityCreateRequest

type IdentityCreateRequest struct {
	Passphrase *string `json:"passphrase"`
}

IdentityCreateRequest request used for new identity creation. swagger:model IdentityCreateRequestDTO

func (IdentityCreateRequest) Validate

func (r IdentityCreateRequest) Validate() *apierror.APIError

Validate validates fields in request

type IdentityCurrentRequest

type IdentityCurrentRequest struct {
	Address    *string `json:"id"`
	Passphrase *string `json:"passphrase"`
}

IdentityCurrentRequest request used for current identity remembering. swagger:model IdentityCurrentRequestDTO

func (IdentityCurrentRequest) Validate

Validate validates fields in request

type IdentityDTO

type IdentityDTO struct {
	// identity in Ethereum address format
	// required: true
	// example: 0x0000000000000000000000000000000000000001
	Address            string `json:"id"`
	RegistrationStatus string `json:"registration_status"`
	ChannelAddress     string `json:"channel_address"`

	// deprecated
	Balance       *big.Int `json:"balance"`
	Earnings      *big.Int `json:"earnings"`
	EarningsTotal *big.Int `json:"earnings_total"`

	BalanceTokens       Tokens `json:"balance_tokens"`
	EarningsTokens      Tokens `json:"earnings_tokens"`
	EarningsTotalTokens Tokens `json:"earnings_total_tokens"`

	Stake             *big.Int               `json:"stake"`
	HermesID          string                 `json:"hermes_id"`
	EarningsPerHermes map[string]EarningsDTO `json:"earnings_per_hermes"`
}

IdentityDTO holds identity information. swagger:model IdentityDTO

type IdentityExportRequest

type IdentityExportRequest struct {
	Identity      string `json:"identity,omitempty"`
	NewPassphrase string `json:"newpassphrase,omitempty"`
}

IdentityExportRequest is received in identity export endpoint. swagger:model IdentityExportRequestDTO

func (*IdentityExportRequest) Validate

func (i *IdentityExportRequest) Validate() *apierror.APIError

Validate validates the Export request.

type IdentityImportRequest

type IdentityImportRequest struct {
	Data              []byte `json:"data"`
	CurrentPassphrase string `json:"current_passphrase,omitempty"`

	// Optional. Default values are OK.
	SetDefault    bool   `json:"set_default"`
	NewPassphrase string `json:"new_passphrase"`
}

IdentityImportRequest is received in identity import endpoint. swagger:model IdentityImportRequest

func (*IdentityImportRequest) Validate

func (i *IdentityImportRequest) Validate() *apierror.APIError

Validate validates the import request.

type IdentityRefDTO

type IdentityRefDTO struct {
	// identity in Ethereum address format
	// required: true
	// example: 0x0000000000000000000000000000000000000001
	Address string `json:"id"`
}

IdentityRefDTO represents unique identity reference. swagger:model IdentityRefDTO

func NewIdentityDTO

func NewIdentityDTO(id identity.Identity) IdentityRefDTO

NewIdentityDTO maps to API identity.

type IdentityRegisterRequest

type IdentityRegisterRequest struct {
	// Token: referral token, if the user has one
	ReferralToken *string `json:"referral_token,omitempty"`
	// Beneficiary: beneficiary to set during registration. Optional.
	Beneficiary string `json:"beneficiary,omitempty"`
	// Fee: an agreed amount to pay for registration
	Fee *big.Int `json:"fee"`
}

IdentityRegisterRequest represents the identity registration user input parameters swagger:model IdentityRegisterRequestDTO

type IdentityRegistrationResponse

type IdentityRegistrationResponse struct {
	Status string `json:"status"`
	// Returns true if identity is registered in payments smart contract
	Registered bool `json:"registered"`
}

IdentityRegistrationResponse represents registration status and needed data for registering of given identity swagger:model IdentityRegistrationResponseDTO

type IdentityUnlockRequest

type IdentityUnlockRequest struct {
	Passphrase *string `json:"passphrase"`
}

IdentityUnlockRequest request used for identity unlocking. swagger:model IdentityUnlockRequestDTO

func (IdentityUnlockRequest) Validate

func (r IdentityUnlockRequest) Validate() *apierror.APIError

Validate validates fields in request

type LatestReleaseResponse

type LatestReleaseResponse struct {
	Version string `json:"version"`
}

LatestReleaseResponse latest release info swagger:model LatestReleaseResponse

type ListIdentitiesResponse

type ListIdentitiesResponse struct {
	Identities []IdentityRefDTO `json:"identities"`
}

ListIdentitiesResponse holds list of identities. swagger:model ListIdentitiesResponse

func NewIdentityListResponse

func NewIdentityListResponse(ids []identity.Identity) ListIdentitiesResponse

NewIdentityListResponse maps to API identity list.

type ListProposalFilterPresetsResponse

type ListProposalFilterPresetsResponse struct {
	Items []FilterPreset `json:"items"`
}

ListProposalFilterPresetsResponse holds a list of proposal filter presets. swagger:model ListProposalFilterPresetsResponse

type ListProposalsCountiesResponse

type ListProposalsCountiesResponse map[string]int

ListProposalsCountiesResponse holds number of proposals per country. swagger:model ListProposalsCountiesResponse

type ListProposalsResponse

type ListProposalsResponse struct {
	Proposals []ProposalDTO `json:"proposals"`
}

ListProposalsResponse holds list of proposals. swagger:model ListProposalsResponse

type LocalVersionsResponse

type LocalVersionsResponse struct {
	Versions []versionmanager.LocalVersion `json:"versions"`
}

LocalVersionsResponse local version response swagger:model LocalVersionsResponse

type LocationDTO

type LocationDTO struct {
	// IP address
	// example: 1.2.3.4
	IP string `json:"ip"`
	// Autonomous system number
	// example: 62179
	ASN int `json:"asn"`
	// Internet Service Provider name
	// example: Telia Lietuva, AB
	ISP string `json:"isp"`

	// Continent
	// example: EU
	Continent string `json:"continent"`
	// Node Country
	// example: LT
	Country string `json:"country"`
	// Node Region
	// example: Vilnius region
	Region string `json:"region"`
	// Node City
	// example: Vilnius
	City string `json:"city"`

	// IP type (data_center, residential, etc.)
	// example: residential
	IPType string `json:"ip_type"`
}

LocationDTO describes IP location metadata. swagger:model LocationDTO

type MMNApiKeyRequest

type MMNApiKeyRequest struct {
	ApiKey string `json:"api_key"`
}

MMNApiKeyRequest request used to manage MMN's API key. swagger:model MMNApiKeyRequest

func (MMNApiKeyRequest) Validate

func (r MMNApiKeyRequest) Validate() *apierror.APIError

Validate validates fields in request

type MMNGrantVerificationResponse

type MMNGrantVerificationResponse struct {
	ApiKey                        string `json:"api_key"`
	WalletAddress                 string `json:"wallet_address"`
	IsEligibleForFreeRegistration bool   `json:"is_eligible_for_free_registration"`
}

MMNGrantVerificationResponse message received via redirect from mystnodes.com swagger:model MMNGrantVerificationResponse

type MMNLinkRedirectResponse

type MMNLinkRedirectResponse struct {
	Link string `json:"link"`
}

MMNLinkRedirectResponse claim link response swagger:model MMNLinkRedirectResponse

type MigrationStatus

type MigrationStatus = string

MigrationStatus status of the migration

type MigrationStatusResponse

type MigrationStatusResponse struct {
	Status MigrationStatus `json:"status"`
}

MigrationStatusResponse represents status of the migration swagger:model MigrationStatusResponse

type MonitoringAgentResponse

type MonitoringAgentResponse struct {
	Statuses node.MonitoringAgentStatuses `json:"statuses"`
	Error    string                       `json:"error,omitempty"`
}

MonitoringAgentResponse reflects amount of connectivity statuses for each service_type. swagger:model MonitoringAgentResponse

type MystnodesSSOGrantLoginRequest

type MystnodesSSOGrantLoginRequest struct {
	AuthorizationGrant string `json:"authorization_grant"`
}

MystnodesSSOGrantLoginRequest Mystnodes SSO Grant Login Request

type MystnodesSSOGrantVerificationRequest

type MystnodesSSOGrantVerificationRequest struct {
	AuthorizationGrant    string `json:"authorizationGrant"`
	CodeVerifierBase64url string `json:"codeVerifierBase64url"`
}

MystnodesSSOGrantVerificationRequest Mystnodes SSO Grant Verification Request request

type MystnodesSSOLinkResponse

type MystnodesSSOLinkResponse struct {
	Link string `json:"link"`
}

MystnodesSSOLinkResponse contains a link to initiate auth via mystnodes swagger:model MystnodesSSOLinkResponse

type NATTypeDTO

type NATTypeDTO struct {
	Type  nat.NATType `json:"type"`
	Error string      `json:"error,omitempty"`
}

NATTypeDTO gives information about NAT type in terms of traversal capabilities swagger:model NATTypeDTO

type NodeStatusResponse

type NodeStatusResponse struct {
	Status monitoring.Status `json:"status"`
}

NodeStatusResponse a node status reflects monitoring agent POV on node availability swagger:model NodeStatusResponse

type PageableDTO

type PageableDTO struct {
	// The current page of the items.
	Page int `json:"page"`
	// Number of items per page.
	PageSize int `json:"page_size"`
	// The total items.
	TotalItems int `json:"total_items"`
	// The last page of the items.
	TotalPages int `json:"total_pages"`
}

PageableDTO holds pagination information. swagger:model PageableDTO

func NewPageableDTO

func NewPageableDTO(paginator *utils.Paginator) PageableDTO

NewPageableDTO maps to API pagination DTO.

type PaginationQuery

type PaginationQuery struct {
	// Number of items per page.
	// in: query
	// default: 50
	PageSize int `json:"page_size"`

	// Page to filter the items by.
	// in: query
	// default: 1
	Page int `json:"page"`
}

PaginationQuery allows to page response items.

func NewPaginationQuery

func NewPaginationQuery() PaginationQuery

NewPaginationQuery creates pagination query with default values.

func (*PaginationQuery) Bind

func (q *PaginationQuery) Bind(request *http.Request) *apierror.APIError

Bind creates and validates query from API request.

type PaymentChannelDTO

type PaymentChannelDTO struct {
	// Unique identifier of payment channel
	// example: 0x8fc5f7a1794dc39c6837df10613bddf1ec9810503a50306a8667f702457a739a
	ID string `json:"id"`

	// example: 0x0000000000000000000000000000000000000001
	OwnerID string `json:"owner_id"`

	// example: 0x42a537D649d6853C0a866470f2d084DA0f73b5E4
	HermesID string `json:"hermes_id"`

	// Current unsettled earnings
	// example: 19449034049997187
	Earnings *big.Int `json:"earnings"`

	// Earnings of all history
	// example: 19449034049997187
	EarningsTotal *big.Int `json:"earnings_total"`

	// Beneficiary - eth wallet address
	Beneficiary string `json:"beneficiary"`
}

PaymentChannelDTO represents represents opened payment channel between identity and hermes. swagger:model PaymentChannelDTO

func NewPaymentChannelDTO

func NewPaymentChannelDTO(channel pingpong.HermesChannel) PaymentChannelDTO

NewPaymentChannelDTO maps to API payment channel.

type PaymentOrderOptions

type PaymentOrderOptions struct {
	Minimum   float64   `json:"minimum"`
	Suggested []float64 `json:"suggested"`
}

PaymentOrderOptions represents pilvytis payment order options swagger:model PaymentOrderOptions

func ToPaymentOrderOptions

func ToPaymentOrderOptions(poo *pilvytis.PaymentOrderOptions) *PaymentOrderOptions

ToPaymentOrderOptions - convert pilvytis.PaymentOrderOptions to contract.ToPaymentOrderOptions

type PaymentOrderRequest

type PaymentOrderRequest struct {
	// example: 3.14
	MystAmount string `json:"myst_amount"`

	// example: 20
	AmountUSD string `json:"amount_usd"`

	// example: EUR
	PayCurrency string `json:"pay_currency"`

	// example: US
	Country string `json:"country"`

	// example: MO
	State string `json:"state"`

	// example: mysteriumvpn, mystnodes
	ProjectID string `json:"project_id"`

	// example: {}
	CallerData json.RawMessage `json:"gateway_caller_data"`
}

PaymentOrderRequest holds order request details swagger:model PaymentOrderRequest

func (*PaymentOrderRequest) GatewayOrderRequest

func (o *PaymentOrderRequest) GatewayOrderRequest(identity identity.Identity, gateway string) pilvytis.GatewayOrderRequest

GatewayOrderRequest convenience mapper

type PaymentOrderResponse

type PaymentOrderResponse struct {
	ID     string `json:"id"`
	Status string `json:"status"`

	Identity       string `json:"identity"`
	ChainID        int64  `json:"chain_id"`
	ChannelAddress string `json:"channel_address"`

	GatewayName string `json:"gateway_name"`

	ReceiveMYST string `json:"receive_myst"`
	PayAmount   string `json:"pay_amount"`
	PayCurrency string `json:"pay_currency"`
	Country     string `json:"country"`
	State       string `json:"state"`

	Currency      string `json:"currency"`
	ItemsSubTotal string `json:"items_sub_total"`
	TaxRate       string `json:"tax_rate"`
	TaxSubTotal   string `json:"tax_sub_total"`
	OrderTotal    string `json:"order_total"`

	PublicGatewayData json.RawMessage `json:"public_gateway_data"`
}

PaymentOrderResponse holds payment gateway order details. swagger:model PaymentOrderResponse

func NewPaymentOrderResponse

func NewPaymentOrderResponse(r *pilvytis.GatewayOrderResponse) PaymentOrderResponse

NewPaymentOrderResponse creates an instance of PaymentOrderResponse

func NewPaymentOrdersResponse

func NewPaymentOrdersResponse(r []pilvytis.GatewayOrderResponse) []PaymentOrderResponse

NewPaymentOrdersResponse creates a slice of orders response

type Price

type Price struct {
	Currency      string `json:"currency"`
	PerHour       uint64 `json:"per_hour"`
	PerHourTokens Tokens `json:"per_hour_tokens"`
	PerGiB        uint64 `json:"per_gib"`
	PerGiBTokens  Tokens `json:"per_gib_tokens"`
}

Price represents the service price. swagger:model Price

type ProposalDTO

type ProposalDTO struct {
	// Proposal format.
	Format string `json:"format"`

	// Compatibility level.
	Compatibility int `json:"compatibility"`

	// provider who offers service
	// example: 0x0000000000000000000000000000000000000001
	ProviderID string `json:"provider_id"`

	// type of service provider offers
	// example: openvpn
	ServiceType string `json:"service_type"`

	// Service location
	Location ServiceLocationDTO `json:"location"`

	// Service price
	Price Price `json:"price"`

	// AccessPolicies
	AccessPolicies *[]market.AccessPolicy `json:"access_policies,omitempty"`

	// Quality of the service.
	Quality Quality `json:"quality"`
}

ProposalDTO holds service proposal details. swagger:model ProposalDTO

func NewProposalDTO

func NewProposalDTO(p proposal.PricedServiceProposal) ProposalDTO

NewProposalDTO maps to API service proposal.

func (ProposalDTO) String

func (p ProposalDTO) String() string

type ProviderConsumersCountResponse

type ProviderConsumersCountResponse struct {
	Count int `json:"count"`
}

ProviderConsumersCountResponse reflects a number of unique consumers served during a period of time. swagger:model ProviderConsumersCountResponse

type ProviderEarningsSeriesResponse

type ProviderEarningsSeriesResponse struct {
	Data []ProviderSeriesItem `json:"data"`
}

ProviderEarningsSeriesResponse reflects a earnings series metrics during a period of time. swagger:model ProviderEarningsSeriesResponse

type ProviderSeriesItem

type ProviderSeriesItem struct {
	Value     string `json:"value"`
	Timestamp int64  `json:"timestamp"`
}

ProviderSeriesItem represents a general data series item

type ProviderSession

type ProviderSession struct {
	ID               string `json:"id"`
	ConsumerCountry  string `json:"consumer_country"`
	ServiceType      string `json:"service_type"`
	DurationSeconds  int64  `json:"duration_seconds"`
	StartedAt        string `json:"started_at"`
	Earnings         Tokens `json:"earnings"`
	TransferredBytes int64  `json:"transferred_bytes"`
}

ProviderSession contains provided session information. swagger:model ProviderSession

type ProviderSessionsCountResponse

type ProviderSessionsCountResponse struct {
	Count int `json:"count"`
}

ProviderSessionsCountResponse reflects a number of sessions during a period of time. swagger:model ProviderSessionsCountResponse

type ProviderSessionsResponse

type ProviderSessionsResponse struct {
	Sessions []ProviderSession `json:"sessions"`
}

ProviderSessionsResponse reflects a list of sessions metrics during a period of time. swagger:model ProviderSessionsResponse

func NewProviderSessionsResponse

func NewProviderSessionsResponse(sessionItems []node.SessionItem) *ProviderSessionsResponse

NewProviderSessionsResponse creates response from node.SessionItem slice

type ProviderSessionsSeriesResponse

type ProviderSessionsSeriesResponse struct {
	Data []ProviderSeriesItem `json:"data"`
}

ProviderSessionsSeriesResponse reflects a sessions data series metrics during a period of time. swagger:model ProviderSessionsSeriesResponse

type ProviderTransferredDataResponse

type ProviderTransferredDataResponse struct {
	Bytes int `json:"transferred_data_bytes"`
}

ProviderTransferredDataResponse reflects a number of bytes transferred by provider during a period of time. swagger:model ProviderTransferredDataResponse

type ProviderTransferredDataSeriesResponse

type ProviderTransferredDataSeriesResponse struct {
	Data []ProviderSeriesItem `json:"data"`
}

ProviderTransferredDataSeriesResponse reflects a transferred bytes data series metrics during a period of time. swagger:model ProviderTransferredDataSeriesResponse

type Quality

type Quality struct {
	Quality   float64 `json:"quality"`
	Latency   float64 `json:"latency"`
	Bandwidth float64 `json:"bandwidth"`
	Uptime    float64 `json:"uptime"`
}

Quality holds proposal quality metrics. swagger:model Quality

type QualityInfoResponse

type QualityInfoResponse struct {
	Quality float64 `json:"quality"`
}

QualityInfoResponse reflects a node quality. swagger:model QualityInfoResponse

type ReferralTokenResponse

type ReferralTokenResponse struct {
	Token string `json:"token"`
}

ReferralTokenResponse represents a response for referral token. swagger:model ReferralTokenResponse

type RegistrationPaymentResponse

type RegistrationPaymentResponse struct {
	Paid bool `json:"paid"`
}

RegistrationPaymentResponse holds a registration payment order response. swagger:model RegistrationPaymentResponse

func NewRegistrationPaymentResponse

func NewRegistrationPaymentResponse(r *pilvytis.RegistrationPaymentResponse) RegistrationPaymentResponse

NewRegistrationPaymentResponse creates a registration order response

type RemoteVersionsResponse

type RemoteVersionsResponse struct {
	Versions []versionmanager.RemoteVersion `json:"versions"`
}

RemoteVersionsResponse local version response swagger:model RemoteVersionsResponse

type ServiceAccessPolicies

type ServiceAccessPolicies struct {
	IDs []string `json:"ids"`
}

ServiceAccessPolicies represents the access controls for service start swagger:model ServiceAccessPolicies

type ServiceInfoDTO

type ServiceInfoDTO struct {
	// example: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
	ID string `json:"id,omitempty"`

	// provider identity
	// example: 0x0000000000000000000000000000000000000002
	ProviderID string `json:"provider_id,omitempty"`

	// service type. Possible values are "openvpn", "wireguard" and "noop"
	// example: openvpn
	Type string `json:"type"`

	// options with which service was started. Every service has a unique list of allowed options.
	// example: {"port": 1123, "protocol": "udp"}
	Options interface{} `json:"options,omitempty"`

	// example: Running
	Status string `json:"status"`

	Proposal *ProposalDTO `json:"proposal,omitempty"`

	ConnectionStatistics *ServiceStatisticsDTO `json:"connection_statistics,omitempty"`
}

ServiceInfoDTO represents running service information. swagger:model ServiceInfoDTO

type ServiceListResponse

type ServiceListResponse []ServiceInfoDTO

ServiceListResponse represents a list of running services on the node. swagger:model ServiceListResponse

type ServiceLocationDTO

type ServiceLocationDTO struct {
	// example: EU
	Continent string `json:"continent,omitempty"`
	// example: NL
	Country string `json:"country,omitempty"`
	// example: Amsterdam
	City string `json:"city,omitempty"`

	// Autonomous System Number
	// example: 00001
	ASN int `json:"asn"`
	// example: Telia Lietuva, AB
	ISP string `json:"isp,omitempty"`
	// example: residential
	IPType string `json:"ip_type,omitempty"`
}

ServiceLocationDTO holds service location metadata. swagger:model ServiceLocationDTO

func NewServiceLocationsDTO

func NewServiceLocationsDTO(l market.Location) ServiceLocationDTO

NewServiceLocationsDTO maps to API service location.

type ServiceStartRequest

type ServiceStartRequest struct {
	// provider identity
	// required: true
	// example: 0x0000000000000000000000000000000000000002
	ProviderID string `json:"provider_id"`

	// service type. Possible values are "openvpn", "wireguard" and "noop"
	// required: true
	// example: openvpn
	Type string `json:"type"`

	// access list which determines which identities will be able to receive the service
	// required: false
	AccessPolicies *ServiceAccessPolicies `json:"access_policies,omitempty"`

	// service options. Every service has a unique list of allowed options.
	// required: false
	// example: {"port": 1123, "protocol": "udp"}
	Options interface{} `json:"options"`
}

ServiceStartRequest request used to start a service. swagger:model ServiceStartRequestDTO

type ServiceStatisticsDTO

type ServiceStatisticsDTO struct {
	Attempted  int `json:"attempted"`
	Successful int `json:"successful"`
}

ServiceStatisticsDTO shows the successful and attempted connection count

type SessionDTO

type SessionDTO struct {
	// example: 4cfb0324-daf6-4ad8-448b-e61fe0a1f918
	ID string `json:"id"`

	// example: Consumed
	Direction string `json:"direction"`

	// example: 0x0000000000000000000000000000000000000001
	ConsumerID string `json:"consumer_id"`

	// example: 0x0000000000000000000000000000000000000001
	HermesID string `json:"hermes_id"`

	// example: 0x0000000000000000000000000000000000000001
	ProviderID string `json:"provider_id"`

	// example: openvpn
	ServiceType string `json:"service_type"`

	// example: NL
	ConsumerCountry string `json:"consumer_country"`

	// example: US
	ProviderCountry string `json:"provider_country"`

	// example: 2019-06-06T11:04:43.910035Z
	CreatedAt string `json:"created_at"`

	// duration in seconds
	// example: 120
	Duration uint64 `json:"duration"`

	// example: 1024
	BytesReceived uint64 `json:"bytes_received"`

	// example: 1024
	BytesSent uint64 `json:"bytes_sent"`

	// example: 500000
	Tokens *big.Int `json:"tokens"`

	// example: Completed
	Status string `json:"status"`

	// example: residential
	IPType string `json:"ip_type"`
}

SessionDTO represents the session object. swagger:model SessionDTO

func NewSessionDTO

func NewSessionDTO(se session.History) SessionDTO

NewSessionDTO maps to API session.

type SessionListQuery

type SessionListQuery struct {
	PaginationQuery
	SessionQuery
}

SessionListQuery allows to filter requested sessions. swagger:parameters sessionList

func NewSessionListQuery

func NewSessionListQuery() SessionListQuery

NewSessionListQuery creates session list with default values.

func (*SessionListQuery) Bind

func (q *SessionListQuery) Bind(request *http.Request) *apierror.APIError

Bind creates and validates query from API request.

type SessionListResponse

type SessionListResponse struct {
	Items []SessionDTO `json:"items"`
	PageableDTO
}

SessionListResponse defines session list representable as json. swagger:model SessionListResponse

func NewSessionListResponse

func NewSessionListResponse(sessions []session.History, paginator *utils.Paginator) SessionListResponse

NewSessionListResponse maps to API session list.

type SessionQuery

type SessionQuery struct {
	// Filter the sessions from this date. Formatted in RFC3339 e.g. 2020-07-01.
	// in: query
	DateFrom *strfmt.Date `json:"date_from"`

	// Filter the sessions until this date. Formatted in RFC3339 e.g. 2020-07-30.
	// in: query
	DateTo *strfmt.Date `json:"date_to"`

	// Direction to filter the sessions by. Possible values are "Provided", "Consumed".
	// in: query
	Direction *string `json:"direction"`

	// Consumer identity to filter the sessions by.
	// in: query
	ConsumerID *string `json:"consumer_id"`

	// Hermes ID to filter the sessions by.
	// in: query
	HermesID *string `json:"hermes_id"`

	// Provider identity to filter the sessions by.
	// in: query
	ProviderID *string `json:"provider_id"`

	// Service type to filter the sessions by.
	// in: query
	ServiceType *string `json:"service_type"`

	// Status to filter the sessions by. Possible values are "New", "Completed".
	// in: query
	Status *string `json:"status"`
}

SessionQuery allows to filter requested sessions. swagger:parameters sessionStatsAggregated sessionStatsDaily

func NewSessionQuery

func NewSessionQuery() SessionQuery

NewSessionQuery creates session query with default values.

func (*SessionQuery) Bind

func (q *SessionQuery) Bind(request *http.Request) *apierror.APIError

Bind creates and validates query from API request.

func (*SessionQuery) ToFilter

func (q *SessionQuery) ToFilter() *session.Filter

ToFilter converts API query to storage filter.

type SessionStatsAggregatedResponse

type SessionStatsAggregatedResponse struct {
	Stats SessionStatsDTO `json:"stats"`
}

SessionStatsAggregatedResponse defines aggregated sessions stats response as json. swagger:model SessionStatsAggregatedResponse

func NewSessionStatsAggregatedResponse

func NewSessionStatsAggregatedResponse(stats session.Stats) SessionStatsAggregatedResponse

NewSessionStatsAggregatedResponse maps to API aggregated stats.

type SessionStatsDTO

type SessionStatsDTO struct {
	Count            int      `json:"count"`
	CountConsumers   int      `json:"count_consumers"`
	SumBytesReceived uint64   `json:"sum_bytes_received"`
	SumBytesSent     uint64   `json:"sum_bytes_sent"`
	SumDuration      uint64   `json:"sum_duration"`
	SumTokens        *big.Int `json:"sum_tokens"`
}

SessionStatsDTO represents the session aggregated statistics. swagger:model SessionStatsDTO

func NewSessionStatsDTO

func NewSessionStatsDTO(stats session.Stats) SessionStatsDTO

NewSessionStatsDTO maps to API session stats.

type SessionStatsDailyResponse

type SessionStatsDailyResponse struct {
	Items map[string]SessionStatsDTO `json:"items"`
	Stats SessionStatsDTO            `json:"stats"`
}

SessionStatsDailyResponse defines session stats representable as json. swagger:model SessionStatsDailyResponse

func NewSessionStatsDailyResponse

func NewSessionStatsDailyResponse(stats session.Stats, statsDaily map[time.Time]session.Stats) SessionStatsDailyResponse

NewSessionStatsDailyResponse maps to API session stats grouped by day.

type SettleRequest

type SettleRequest struct {
	HermesIDs  []common.Address `json:"hermes_ids"`
	ProviderID string           `json:"provider_id"`

	// Deprecated
	HermesID string `json:"hermes_id"`
}

SettleRequest represents the request to settle hermes promises swagger:model SettleRequestDTO

type SettleWithBeneficiaryRequest

type SettleWithBeneficiaryRequest struct {
	ProviderID  string `json:"provider_id"`
	HermesID    string `json:"hermes_id"`
	Beneficiary string `json:"beneficiary"`
}

SettleWithBeneficiaryRequest represent the request to settle with new beneficiary address.

type SettlementDTO

type SettlementDTO struct {
	// example: 0x20c070a9be65355adbd2ba479e095e2e8ed7e692596548734984eab75d3fdfa5
	TxHash string `json:"tx_hash"`

	// example: 0x0000000000000000000000000000000000000001
	ProviderID string `json:"provider_id"`

	// example: 0x0000000000000000000000000000000000000001
	HermesID string `json:"hermes_id"`

	// example: 0x0000000000000000000000000000000000000001
	ChannelAddress string `json:"channel_address"`

	// example: 0x0000000000000000000000000000000000000001
	Beneficiary string `json:"beneficiary"`

	// example: 500000
	Amount *big.Int `json:"amount"`

	// example: 2019-06-06T11:04:43.910035Z
	SettledAt string `json:"settled_at"`

	// example: 500000
	Fees *big.Int `json:"fees"`

	// example: false
	IsWithdrawal bool `json:"is_withdrawal"`

	// example: https://example.com
	BlockExplorerURL string `json:"block_explorer_url"`

	// example: internal server error
	Error string `json:"error"`
}

SettlementDTO represents the settlement object. swagger:model SettlementDTO

func NewSettlementDTO

func NewSettlementDTO(settlement pingpong.SettlementHistoryEntry) SettlementDTO

NewSettlementDTO maps to API settlement.

type SettlementListQuery

type SettlementListQuery struct {
	PaginationQuery

	// Filter the settlements from this date. Formatted in RFC3339 e.g. 2020-07-01.
	// in: query
	DateFrom *strfmt.Date `json:"date_from"`

	// Filter the settlements until this date Formatted in RFC3339 e.g. 2020-07-30.
	// in: query
	DateTo *strfmt.Date `json:"date_to"`

	// Provider identity to filter the sessions by.
	// in: query
	ProviderID *string `json:"provider_id"`

	// Hermes ID to filter the sessions by.
	// in: query
	HermesID *string `json:"hermes_id"`

	// Settlement type to filter the sessions by. "settlement" or "withdrawal"
	// in: query
	Types []string `json:"types"`
}

SettlementListQuery allows to filter requested settlements. swagger:parameters settlementList

func NewSettlementListQuery

func NewSettlementListQuery() SettlementListQuery

NewSettlementListQuery creates settlement list query with default values.

func (*SettlementListQuery) Bind

func (q *SettlementListQuery) Bind(request *http.Request) *apierror.APIError

Bind creates and validates query from API request.

func (*SettlementListQuery) ToFilter

ToFilter converts API query to storage filter.

type SettlementListResponse

type SettlementListResponse struct {
	Items           []SettlementDTO `json:"items"`
	WithdrawalTotal string          `json:"withdrawal_total"`
	PageableDTO
}

SettlementListResponse defines settlement list representable as json. swagger:model SettlementListResponse

func NewSettlementListResponse

func NewSettlementListResponse(
	WithdrawalTotal *big.Int,
	settlements []pingpong.SettlementHistoryEntry,
	paginator *utils.Paginator,
) SettlementListResponse

NewSettlementListResponse maps to API settlement list.

type SwitchNodeUIRequest

type SwitchNodeUIRequest struct {
	Version string `json:"version"`
}

SwitchNodeUIRequest request for switching NodeUI version swagger:model SwitchNodeUIRequest

func (*SwitchNodeUIRequest) Valid

Valid validate SwitchNodeUIRequest

type TermsRequest

type TermsRequest struct {
	// example: false
	AgreedProvider *bool `json:"agreed_provider,omitempty"`
	// example: false
	AgreedConsumer *bool `json:"agreed_consumer,omitempty"`
	// example: 0.0.27
	AgreedVersion string `json:"agreed_version,omitempty"`
}

TermsRequest object is accepted by terms endpoints. swagger:model TermsRequest

func (*TermsRequest) ToMap

func (t *TermsRequest) ToMap() map[string]interface{}

ToMap turns a TermsRequest in to an iterable map which can be mapped directly to a user config.

type TermsResponse

type TermsResponse struct {
	// example: false
	AgreedProvider bool `json:"agreed_provider"`
	// example: false
	AgreedConsumer bool `json:"agreed_consumer"`
	// example: 0.0.27
	AgreedVersion string `json:"agreed_version"`
	// example: 0.0.27
	CurrentVersion string `json:"current_version"`
}

TermsResponse object is returned by terms endpoints. swagger:model TermsResponse

func NewTermsResp

func NewTermsResp() *TermsResponse

NewTermsResp builds and returns terms agreement response.

type TokenRewardAmount

type TokenRewardAmount struct {
	Amount *big.Int `json:"amount"`
}

TokenRewardAmount represents a response for token rewards. swagger:model TokenRewardAmount

type Tokens

type Tokens struct {
	Wei   string `json:"wei"`
	Ether string `json:"ether"`
	Human string `json:"human"`
}

Tokens a common response for ethereum blockchain monetary amount

func NewTokens

func NewTokens(amount *big.Int) Tokens

NewTokens convenience constructor for Tokens

func NewTokensFromDecimal

func NewTokensFromDecimal(amount decimal.Decimal) Tokens

NewTokensFromDecimal convenience constructor for Tokens

func (Tokens) String

func (t Tokens) String() string

type TransactorFees

type TransactorFees struct {
	Registration  Tokens `json:"registration"`
	Settlement    Tokens `json:"settlement"`
	DecreaseStake Tokens `json:"decrease_stake"`

	ValidUntil time.Time `json:"valid_until"`
}

TransactorFees represents transactor fees. swagger:model TransactorFees

func NewTransactorFees

func NewTransactorFees(r *registry.Fees) TransactorFees

NewTransactorFees converts registry fees to public api.

type UI

type UI struct {
	BundledVersion string `json:"bundled_version"`
	UsedVersion    string `json:"used_version"`
}

UI ui information swagger:model UI

type WithdrawRequest

type WithdrawRequest struct {
	HermesID    string `json:"hermes_id"`
	ProviderID  string `json:"provider_id"`
	Beneficiary string `json:"beneficiary"`
	FromChainID int64  `json:"from_chain_id"`
	ToChainID   int64  `json:"to_chain_id"`
	Amount      string `json:"amount,omitempty"`
}

WithdrawRequest represents the request to withdraw earnings to l1. swagger:model WithdrawRequestDTO

func (*WithdrawRequest) AmountInMYST

func (w *WithdrawRequest) AmountInMYST() (*big.Int, error)

AmountInMYST will return the amount value converted to big.Int MYST.

Amount can be `nil`

func (*WithdrawRequest) Validate

func (w *WithdrawRequest) Validate() *apierror.APIError

Validate will validate a given request

Jump to

Keyboard shortcuts

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