Documentation ¶
Index ¶
- Constants
- type AAT
- type Account
- func (a *Account) AssignAccountUsers(usersForAccountID map[UserID]*User)
- func (a *Account) CanCreatePortalApp() bool
- func (a *Account) GetDailyLimit() int
- func (a *Account) GetEmailSettings() (Email, map[NotificationEvent]bool, error)
- func (a *Account) GetOwner() (AccountUser, error)
- func (a *Account) GetOwnerID() (UserID, error)
- func (a *Account) GetPortalAppLimit() int
- func (a *Account) GetUser(userID UserID) (AccountUser, error)
- func (a *Account) SubscriptionID() string
- func (a *Account) Table() Table
- type AccountID
- type AccountIntegrations
- type AccountNotification
- type AccountPermissions
- type AccountUser
- type Action
- type Alias
- type AliasDomains
- type Altruist
- type AltruistURL
- type AppEmoji
- type ApplicationWhitelists
- type AuthProvider
- type AuthType
- type BlockedAddress
- type BlockedContract
- type Chain
- func (c Chain) ClearGigastakeApps() Chain
- func (c *Chain) GetChainAliases() []ChainAlias
- func (c *Chain) GetChainAltruists() []Altruist
- func (c *Chain) GetChainCheck(checkType ChainCheckType) Check
- func (c *Chain) GetChainDomains() []ChainDomain
- func (c *Chain) GetGigastakeAppsByProtocolID(protocolID ProtocolID) []GigastakeApp
- func (c *Chain) IsEVM() bool
- func (c *Chain) SetGigastakeApp(gigastakeApp *GigastakeApp)
- func (c *Chain) Table() Table
- type ChainAlias
- type ChainAuthType
- type ChainCheckType
- type ChainDomain
- type ChainGigastakeApp
- type ChainIDWhitelists
- type ChainWhitelists
- type Check
- type Contract
- type CreateAccountUser
- type CreateUser
- type CreateUserResponse
- type DriverOptions
- type Email
- type Environment
- type GatewayConfig
- type GigastakeApp
- type GigastakeAppID
- type GigastakeAppPublicKey
- type GlobalBlockedContracts
- type Method
- type NewChainInput
- type Notification
- type NotificationEvent
- type NotificationType
- type Origin
- type PayPlanType
- type Permissions
- type Plan
- type PlanLite
- type PortalApp
- func (a *PortalApp) AddWhitelist(whitelist Whitelist)
- func (a *PortalApp) ConvertPortalAppToPortalAppLite(appPlan *Plan) PortalAppLite
- func (a *PortalApp) DeleteWhitelist(whitelist Whitelist)
- func (a *PortalApp) GetPublicKeys() []PortalAppPublicKey
- func (a *PortalApp) GetWhitelistsObject() *WhitelistsObject
- func (a *PortalApp) MonthlyLimit() int32
- func (a *PortalApp) Table() Table
- type PortalAppID
- type PortalAppLite
- func (a *PortalAppLite) IsBlockchainWhitelisted(blockchain RelayChainID) bool
- func (a *PortalAppLite) IsChainIDOnPlan(chainID RelayChainID) bool
- func (a *PortalAppLite) IsContractWhitelisted(chainID RelayChainID, contract Contract) bool
- func (a *PortalAppLite) IsMethodWhitelisted(chainID RelayChainID, method Method) bool
- func (a *PortalAppLite) IsOriginWhitelisted(origin Origin) bool
- func (a *PortalAppLite) IsUserAgentWhitelisted(userAgent UserAgent) bool
- func (a *PortalAppLite) PlanType() PayPlanType
- func (a *PortalAppLite) ThroughputLimit() int32
- type PortalAppOrigin
- type PortalAppPublicKey
- type ProtocolAppID
- type ProtocolID
- type ProviderUserID
- type RelayChainID
- type RoleName
- type SavedOnDB
- type Settings
- type SettingsLite
- type Table
- type UpdateAcceptAccountUser
- type UpdateAccount
- type UpdateAccountNotifications
- type UpdateAccountUserRole
- type UpdateAppSettings
- type UpdateChain
- type UpdateGigastakeApp
- type UpdatePortalApp
- type UpdateRemoveAccountUser
- type UpdateUser
- type User
- func (u *User) ArePermissionsEmpty() bool
- func (u *User) DeletePermissions(accountID AccountID) map[AccountID]AccountPermissions
- func (u *User) GetAccountRole(accountID AccountID) RoleName
- func (u *User) HasPermission(accountID AccountID, permission Permissions) bool
- func (u *User) Table() Table
- func (u *User) ToAccountUser(accountID AccountID) AccountUser
- func (u *User) UpsertPermissions(accountID AccountID, role RoleName, accepted bool) (map[AccountID]AccountPermissions, error)
- type UserAgent
- type UserAuthProvider
- type UserID
- type ValidatorChainConfig
- type ValidatorMethodConfig
- type ValidatorMethodStr
- type ValidatorPluginConfig
- func (v *ValidatorPluginConfig) RemoveChainConfigs(chainID RelayChainID)
- func (v *ValidatorPluginConfig) RemoveMethodValidator(methodConfig *ValidatorMethodConfig)
- func (v *ValidatorPluginConfig) UpdateChainConfigs(chainConfig *ValidatorChainConfig)
- func (v *ValidatorPluginConfig) UpdateMethodValidator(methodConfig *ValidatorMethodConfig)
- type Whitelist
- type WhitelistType
- type Whitelists
- type WhitelistsObject
Constants ¶
const ( NotificationEventFull NotificationEvent = "full" NotificationEventHalf NotificationEvent = "half" NotificationEventQuarter NotificationEvent = "quarter" NotificationEventSignedUp NotificationEvent = "signedUp" NotificationEventThreeQuarters NotificationEvent = "threeQuarters" NotificationTypeEmail NotificationType = "email" NotificationTypePortal NotificationType = "portal" NotificationTypeWebhook NotificationType = "webhook" )
const ( ChainAuthTypeBasicAuth ChainAuthType = "basic_auth" ChainAuthTypeBearerToken ChainAuthType = "bearer_token" ChainAuthTypeNone ChainAuthType = "none" ChainCheckTypeArchival ChainCheckType = "archival" ChainCheckTypeChain ChainCheckType = "chain" ChainCheckTypeMerge ChainCheckType = "merge" ChainCheckTypeSync ChainCheckType = "sync" )
const ( TablePortalApps Table = "portal_applications" TableAppSettings Table = "portal_application_settings" TableAppWhitelists Table = "portal_application_whitelists" TablePortalAppAATs Table = "portal_application_aats" TableGigastakeApps Table = "gigastake_applications" TableAccounts Table = "accounts" TableAccountUsers Table = "account_users" TableAccountIntegrations Table = "account_integrations" TableAccountNotifications Table = "account_notifications" TableUsers Table = "users" TableUserAuthProviders Table = "user_auth_providers" TablePayPlans Table = "pay_plans" TableChains Table = "chains" TableChainAltruists Table = "chain_altruists" TableChainChecks Table = "chain_checks" TableChainAliases Table = "chain_aliases" // DEPRECATED - TODO remove when move to only store aliases is complete TableChainAliasDomains Table = "chain_alias_domains" TableChainGigastakeApps Table = "chains_gigastake_applications" TableGlobalBlockedContracts Table = "global_blocked_contracts" TableChainConfig Table = "chain_config" TableMethodValidators Table = "method_validators" TableGatewayConfig Table = "config_gateway" ActionInsert Action = "INSERT" ActionUpdate Action = "UPDATE" ActionDelete Action = "DELETE" )
const ( AuthProviderAuth0 AuthProvider = "auth0" AuthTypeAuth0Github AuthType = "auth0_github" AuthTypeAuth0Google AuthType = "auth0_google" AuthTypeAuth0Username AuthType = "auth0_username" PermReadEndpoint Permissions = "read:endpoint" PermWriteEndpoint Permissions = "write:endpoint" PermDeleteEndpoint Permissions = "delete:endpoint" PermTransferEndpoint Permissions = "transfer:endpoint" RoleOwner RoleName = "OWNER" RoleAdmin RoleName = "ADMIN" RoleMember RoleName = "MEMBER" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AAT ¶
type AAT struct { AppID PortalAppID `json:"appID,omitempty"` ID ProtocolAppID `json:"id"` PublicKey PortalAppPublicKey `json:"publicKey"` Address string `json:"address"` ClientPublicKey string `json:"clientPublicKey"` Signature string `json:"signature"` Version string `json:"version"` // PrivateKey used when read from the DB, will always be "" // Only used for saving to DB // TODO remove when decided to not support saving private key to DB PrivateKey string `json:"privateKey,omitempty"` }
AAT contains the data needed to perform relays
type Account ¶
type Account struct { ID AccountID `json:"id"` Name string `json:"name"` IconURL string `json:"iconURL"` PlanType PayPlanType `json:"planType"` PartnerChainIDs map[RelayChainID]struct{} `json:"partnerBlockchainIDs"` PartnerThroughputLimit int32 `json:"partnerThroughputLimit"` PartnerAppLimit int32 `json:"partnerAppLimit"` Integrations AccountIntegrations `json:"integrations"` EnterpriseLimit int32 `json:"enterpriseLimit"` Notifications map[NotificationType]AccountNotification `json:"notifications"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Deleted bool `json:"deleted"` // PortalApps and Plan are set in cache.go PortalApps map[PortalAppID]*PortalApp `json:"portalApps"` Plan *Plan `json:"payPlan"` // Users assigned when account is fetched in cache.go Users map[UserID]AccountUser `json:"users"` }
Account represents a single account for a single application in the Portal
func (*Account) AssignAccountUsers ¶ added in v2.5.0
AssignAccountUsers assigns all users for the account Called in the PHD cache when an account is fetched by any account endpoints
func (*Account) CanCreatePortalApp ¶ added in v2.10.2
CanCreatePortalApp returns true if the Account can create a new Portal App
func (*Account) GetDailyLimit ¶ added in v2.5.0
GetDailyLimit returns the Account's daily relay limit
func (*Account) GetEmailSettings ¶ added in v2.5.0
func (a *Account) GetEmailSettings() (Email, map[NotificationEvent]bool, error)
GetEmailSettings returns the Account email and notification thresholds
func (*Account) GetOwner ¶
func (a *Account) GetOwner() (AccountUser, error)
GetOwner returns the Account OWNER
func (*Account) GetOwnerID ¶
GetOwnerID returns the Account OWNER's ID
func (*Account) GetPortalAppLimit ¶ added in v2.10.2
GetPortalAppLimit returns the Account's portal app limit
func (*Account) GetUser ¶ added in v2.5.0
func (a *Account) GetUser(userID UserID) (AccountUser, error)
GetUser returns the AccountUser for a given UserID
func (*Account) SubscriptionID ¶ added in v2.5.0
SubscriptionID returns the Stripe Subscription ID
type AccountIntegrations ¶
type AccountIntegrations struct { AccountID AccountID `json:"id,omitempty"` // used for listener StripeSubscriptionID string `json:"stripeSubscriptionID"` CovalentAPIKeyFree string `json:"covalentAPIKeyFree"` CovalentAPIKeyPaid string `json:"covalentAPIKeyPaid"` }
AccountUser represents fields used for integrations with other platforms
func (*AccountIntegrations) Table ¶
func (s *AccountIntegrations) Table() Table
type AccountNotification ¶ added in v2.5.0
type AccountNotification struct { AccountID AccountID `json:"accountID,omitempty"` Type NotificationType `json:"type"` Active bool `json:"active"` Destination string `json:"destination"` Trigger string `json:"trigger"` Events map[NotificationEvent]bool `json:"events"` }
Account Struct Definition and Methods
func (*AccountNotification) Table ¶ added in v2.5.0
func (a *AccountNotification) Table() Table
type AccountPermissions ¶ added in v2.5.0
type AccountPermissions struct { Accepted bool `json:"accepted"` RoleName RoleName `json:"roleName"` Permissions []Permissions `json:"permissions"` }
AccountPermissions stores user role and permissions for a given Account
type AccountUser ¶
type AccountUser struct { AccountID AccountID `json:"accountID,omitempty"` // used for listener ID UserID `json:"id"` Email Email `json:"email"` RoleName RoleName `json:"roleName"` Accepted bool `json:"accepted"` }
Account Struct Definition and Methods
func (*AccountUser) Table ¶
func (a *AccountUser) Table() Table
type Alias ¶
type Alias struct { ChainID RelayChainID `json:"chainID,omitempty"` Alias ChainAlias `json:"alias"` }
Used for mapping listener notification
type AliasDomains ¶
type AliasDomains struct { ChainID RelayChainID `json:"chainID,omitempty"` Alias ChainAlias `json:"alias"` Domains []ChainDomain `json:"domains"` }
DEPRECATED - TODO remove when move to only store aliases is complete
func (*AliasDomains) Table ¶
func (c *AliasDomains) Table() Table
DEPRECATED - TODO remove when move to only store aliases is complete
type Altruist ¶
type Altruist struct { ChainID RelayChainID `json:"chainID,omitempty"` URL AltruistURL `json:"url"` Auth string `json:"auth"` AuthType ChainAuthType `json:"authType"` }
Chain Struct and Methods
type AltruistURL ¶
type AltruistURL string
Enums
func (AltruistURL) IsValid ¶
func (a AltruistURL) IsValid() bool
type ApplicationWhitelists ¶
type ApplicationWhitelists struct { Type WhitelistType `json:"type"` Values []string `json:"values"` }
PortalApp Struct Definition and Methods
type AuthType ¶
type AuthType string
Enums
func (AuthType) IsFederated ¶
func (AuthType) Provider ¶
func (a AuthType) Provider() AuthProvider
type BlockedContract ¶
type BlockedContract struct { BlockedAddress BlockedAddress `json:"blocked_address"` Active bool `json:"active"` }
func (*BlockedContract) Table ¶
func (u *BlockedContract) Table() Table
type Chain ¶
type Chain struct { ID RelayChainID `json:"id"` Blockchain ChainAlias `json:"blockchain"` Description string `json:"description"` IconURL string `json:"iconURL"` EnforceResult string `json:"enforceResult"` Path string `json:"path"` Ticker string `json:"ticker"` AllowedMethods []string `json:"allowedMethods"` LogLimitBlocks int32 `json:"logLimitBlocks"` RequestTimeout int32 `json:"requestTimeout"` Active bool `json:"active"` Altruists map[AltruistURL]Altruist `json:"altruists,omitempty"` Checks map[ChainCheckType]Check `json:"chainChecks,omitempty"` Aliases map[ChainAlias]struct{} `json:"chainAliases,omitempty"` // DEPRECATED - TODO remove when move to only store aliases is complete AliasDomains map[ChainAlias][]ChainDomain `json:"domains,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Deleted bool `json:"deleted"` // GigastakeApps are set inside PHD GigastakeApps map[ProtocolID]map[GigastakeAppID]*GigastakeApp `json:"gigastakeAppsByProtocol,omitempty"` }
Chain Struct and Methods
func (Chain) ClearGigastakeApps ¶
ClearGigastakeApps clears the Chain's GigastakesApps map and returns the updated Chain Used in the PHD cache when cache.Options.ExcludeGigastakeApps is true
func (*Chain) GetChainAliases ¶
func (c *Chain) GetChainAliases() []ChainAlias
GetChainAliases returns a slice of all of a Chain's aliases
func (*Chain) GetChainAltruists ¶
GetChainAltruists returns a slice of all of a Chain's altruists
func (*Chain) GetChainCheck ¶
func (c *Chain) GetChainCheck(checkType ChainCheckType) Check
Get ChainCheck returns a single Chain Check by its type
func (*Chain) GetChainDomains ¶
func (c *Chain) GetChainDomains() []ChainDomain
GetChainDomains returns a slice of all of a Chain's domains
func (*Chain) GetGigastakeAppsByProtocolID ¶ added in v2.12.0
func (c *Chain) GetGigastakeAppsByProtocolID(protocolID ProtocolID) []GigastakeApp
GetGigastakeAppsByProtocolID returns a slice of a Chain's GigastakeApps for a specific protocol
func (*Chain) IsEVM ¶
IsEVM returns a simple bool if the Chain has a Check with type Chain Only EVM chains may have a Check with type Chain
func (*Chain) SetGigastakeApp ¶ added in v2.12.0
func (c *Chain) SetGigastakeApp(gigastakeApp *GigastakeApp)
SetGigastakeApp adds a GigastakeApp to the Chain, updating both the GigastakeAppsByID map (deprecated) and the GigastakeApps map.
type ChainAuthType ¶
type ChainAuthType string
Enums
func (ChainAuthType) IsValid ¶
func (c ChainAuthType) IsValid() bool
type ChainCheckType ¶
type ChainCheckType string
Enums
func (ChainCheckType) IsValid ¶
func (c ChainCheckType) IsValid() bool
type ChainDomain ¶
type ChainDomain string
Enums
func (ChainDomain) GetAlias ¶
func (d ChainDomain) GetAlias() ChainAlias
func (ChainDomain) IsPublicEndpoint ¶
func (d ChainDomain) IsPublicEndpoint() bool
func (ChainDomain) IsValid ¶
func (d ChainDomain) IsValid() bool
func (ChainDomain) IsWildcardDomain ¶
func (d ChainDomain) IsWildcardDomain() bool
type ChainGigastakeApp ¶
type ChainGigastakeApp struct { ChainID RelayChainID `json:"chainID"` GigastakeAppID GigastakeAppID `json:"gigastakeAppID"` }
GigastakeApp represents the relationship between a Chain and GigastakeApp Only used by the listener
func (*ChainGigastakeApp) Table ¶
func (a *ChainGigastakeApp) Table() Table
type ChainIDWhitelists ¶
PortalApp Struct Definition and Methods
type ChainWhitelists ¶
type ChainWhitelists struct { Type WhitelistType `json:"type"` Values []ChainIDWhitelists `json:"values"` }
PortalApp Struct Definition and Methods
type Check ¶
type Check struct { ChainID RelayChainID `json:"chainID,omitempty"` Type ChainCheckType `json:"type"` Payload string `json:"payload"` ResultKey string `json:"resultKey"` Allowance int32 `json:"allowance"` EVMChainID int32 `json:"evmChainID"` }
Chain Struct and Methods
type CreateAccountUser ¶ added in v2.5.0
type CreateAccountUser struct { AccountID AccountID `json:"accountID"` Email Email `json:"email"` RoleName RoleName `json:"roleName"` }
CreateAccountUser contains all fields required to create a new Account User
type CreateUser ¶
type CreateUser struct { Email Email `json:"email"` ProviderUserID ProviderUserID `json:"providerUserID"` }
User Struct Definition and Methods
type CreateUserResponse ¶
User Struct Definition and Methods
type DriverOptions ¶
type DriverOptions struct {
IncludeDeleted bool
}
Provides options for passing to Driver interface methods
type Environment ¶
type Environment string
String ID types
const ( EnvProduction Environment = "production" EnvCanary Environment = "canary" EnvStaging Environment = "staging" EnvTest Environment = "test" EnvLocal Environment = "local" )
func (Environment) IsValid ¶
func (e Environment) IsValid() bool
type GatewayConfig ¶ added in v2.13.0
type GatewayConfig struct { Environment Environment `json:"environment"` Version int `json:"version"` Description string `json:"description"` Config json.RawMessage `json:"config"` }
func (*GatewayConfig) GetJSON ¶ added in v2.13.0
func (g *GatewayConfig) GetJSON() json.RawMessage
func (*GatewayConfig) GetVersion ¶ added in v2.13.0
func (g *GatewayConfig) GetVersion() int
func (*GatewayConfig) IsEmpty ¶ added in v2.14.0
func (c *GatewayConfig) IsEmpty() bool
func (*GatewayConfig) Table ¶ added in v2.13.0
func (g *GatewayConfig) Table() Table
type GigastakeApp ¶
type GigastakeApp struct { ID GigastakeAppID `json:"id"` ProtocolID ProtocolID `json:"protocolID"` ChainIDs map[RelayChainID]struct{} `json:"chainIDs"` Name string `json:"name"` Address string `json:"address"` PublicKey GigastakeAppPublicKey `json:"publicKey"` ClientPublicKey string `json:"clientPublicKey"` Signature string `json:"signature"` Version string `json:"version"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Deleted bool `json:"deleted"` }
GigastakeApp represents a single gigastaked application for a given chain
func (*GigastakeApp) Table ¶
func (a *GigastakeApp) Table() Table
type GigastakeAppPublicKey ¶
type GigastakeAppPublicKey string
GigastakeApp Struct Definition and Methods
type GlobalBlockedContracts ¶
type GlobalBlockedContracts struct {
BlockedAddresses map[BlockedAddress]struct{} `json:"blockedAddresses"`
}
Represents global blocked addresses across the entire Portal
func (*GlobalBlockedContracts) IsContractBlocked ¶
func (g *GlobalBlockedContracts) IsContractBlocked(contract BlockedAddress) bool
type NewChainInput ¶
type NewChainInput struct { Chain *Chain `json:"chain"` GigastakeApps []*GigastakeApp `json:"gigastakeApps"` }
NewChainInput is used for creating a new Chain, including its Gigastake App
type Notification ¶
Listener types
type NotificationEvent ¶
type NotificationEvent string
Enums
func (NotificationEvent) IsValid ¶
func (n NotificationEvent) IsValid() bool
type NotificationType ¶
type NotificationType string
Enums
func (NotificationType) IsValid ¶
func (n NotificationType) IsValid() bool
type PayPlanType ¶
type PayPlanType string
Enums
var ( TestPlanV0 PayPlanType = "TEST_PLAN_V0" TestPlan10K PayPlanType = "TEST_PLAN_10K" TestPlan90k PayPlanType = "TEST_PLAN_90K" FreetierV0 PayPlanType = "FREETIER_V0" PayAsYouGoV0 PayPlanType = "PAY_AS_YOU_GO_V0" Enterprise PayPlanType = "ENTERPRISE" )
func (PayPlanType) Valid ¶
func (p PayPlanType) Valid() bool
type Permissions ¶
type Permissions string
Enums
func (Permissions) IsValid ¶
func (p Permissions) IsValid() bool
func (*Permissions) Scan ¶
func (p *Permissions) Scan(src interface{}) error
type Plan ¶
type Plan struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Type PayPlanType `json:"planType"` ChainIDs map[RelayChainID]struct{} `json:"chainIDs"` // DailyLimit is the daily relay limit for a pay plan DailyLimit int32 `json:"dailyLimit"` // ThroughputLimit is the number of relays-per-second for a pay plan ThroughputLimit int32 `json:"throughputLimit"` // AppLimit is the number of apps permitted for a pay plan AppLimit int32 `json:"appLimit"` // CURRENTLY UNUSED - MonthlyRelayLimit is the number of relays-per-month for a pay plan MonthlyRelayLimit int32 `json:"monthlyRelayLimit"` CreatedAt time.Time `json:"createdAt"` }
Pay Plan Type and Methods
type PlanLite ¶
type PlanLite struct { PlanType PayPlanType `json:"planType,omitempty"` ChainIDs map[RelayChainID]struct{} `json:"chainIDs,omitempty"` ThroughputLimit int32 `json:"throughputLimit,omitempty"` }
PortalApp Struct Definition and Methods
type PortalApp ¶
type PortalApp struct { ID PortalAppID `json:"id"` Name string `json:"name"` Description string `json:"description"` AppEmoji AppEmoji `json:"appEmoji"` AccountID AccountID `json:"accountID"` Settings Settings `json:"settings"` Whitelists Whitelists `json:"whitelists"` AATs map[ProtocolAppID]AAT `json:"aat"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Deleted bool `json:"deleted"` }
PortalApp represents a single application in the Portal
func (*PortalApp) AddWhitelist ¶
AddWhitelist adds a whitelist to the PortalApp pointer's Whitelists field
func (*PortalApp) ConvertPortalAppToPortalAppLite ¶
func (a *PortalApp) ConvertPortalAppToPortalAppLite(appPlan *Plan) PortalAppLite
ConvertPortalAppToPortalAppLite converts a PortalApp to a PortalAppLite for use in the Portal Middleware Returns a copy rather than a pointer as its intended be used at the point of returning the request body
func (*PortalApp) DeleteWhitelist ¶
DeleteWhitelist deletes a whitelist from the PortalApp pointer's Whitelists field
func (*PortalApp) GetPublicKeys ¶
func (a *PortalApp) GetPublicKeys() []PortalAppPublicKey
GetPublicKeys returns all public keys for a PortalApp
func (*PortalApp) GetWhitelistsObject ¶
func (a *PortalApp) GetWhitelistsObject() *WhitelistsObject
GetWhitelistsObject returns a GraphQL-compatible WhitelistsObject struct that contains all whitelists for an application (used for Portal UI)
func (*PortalApp) MonthlyLimit ¶
MonthlyLimit returns the monthly relay limit for a given portal app
type PortalAppLite ¶
type PortalAppLite struct { ID PortalAppID `json:"id"` AccountID AccountID `json:"accountID"` PublicKeys []PortalAppPublicKey `json:"publicKeys"` Settings SettingsLite `json:"settings,omitempty"` Whitelists Whitelists `json:"whitelists,omitempty"` Plan PlanLite `json:"plan,omitempty"` }
PortalAppLite contains only the PortalApp fields actually used in the Portal Middleware.
func (*PortalAppLite) IsBlockchainWhitelisted ¶
func (a *PortalAppLite) IsBlockchainWhitelisted(blockchain RelayChainID) bool
IsBlockchainWhitelisted returns a boolean indicating whether the given BLOCKCHAIN is whitelisted for an application
func (*PortalAppLite) IsChainIDOnPlan ¶
func (a *PortalAppLite) IsChainIDOnPlan(chainID RelayChainID) bool
func (*PortalAppLite) IsContractWhitelisted ¶
func (a *PortalAppLite) IsContractWhitelisted(chainID RelayChainID, contract Contract) bool
IsContractWhitelisted returns a boolean indicating whether the given CONTRACT is whitelisted for a blockchain and application
func (*PortalAppLite) IsMethodWhitelisted ¶
func (a *PortalAppLite) IsMethodWhitelisted(chainID RelayChainID, method Method) bool
IsMethodWhitelisted returns a boolean indicating whether the given METHOD is whitelisted for a blockchain and application
func (*PortalAppLite) IsOriginWhitelisted ¶
func (a *PortalAppLite) IsOriginWhitelisted(origin Origin) bool
IsOriginWhitelisted returns a boolean indicating whether the given ORIGIN is whitelisted for an application
func (*PortalAppLite) IsUserAgentWhitelisted ¶
func (a *PortalAppLite) IsUserAgentWhitelisted(userAgent UserAgent) bool
IsUserAgentWhitelisted returns a boolean indicating whether the given USER AGENT is whitelisted for an application
func (*PortalAppLite) PlanType ¶
func (a *PortalAppLite) PlanType() PayPlanType
func (*PortalAppLite) ThroughputLimit ¶
func (a *PortalAppLite) ThroughputLimit() int32
type ProtocolID ¶ added in v2.12.0
type ProtocolID string
String ID types
const ( ProtocolMorseMainnet ProtocolID = "morse-mainnet" ProtocolShannonMainnet ProtocolID = "shannon-mainnet" ProtocolShannonTestnet ProtocolID = "shannon-testnet" )
func (ProtocolID) IsValid ¶ added in v2.12.0
func (id ProtocolID) IsValid() bool
type ProviderUserID ¶
type ProviderUserID string
Enums
func (ProviderUserID) AuthType ¶
func (pid ProviderUserID) AuthType() AuthType
Currently only Auth0 auth types (`auth0` & `github`) supported. If new auth providers in addition to Auth0 are added in the future this method will need to be updated to parse the ID to determine the auth type.
type Settings ¶
type Settings struct { AppID PortalAppID `json:"appID,omitempty"` Environment Environment `json:"environment"` SecretKey string `json:"secretKey"` SecretKeyRequired bool `json:"secretKeyRequired"` FavoritedChainIDs map[RelayChainID]struct{} `json:"favoritedBlockchainIDs"` // MonthlyRelayLimit sets the monthly limit per-application // Sum of an Account's Apps MonthlyRelayLimits cannot exceed the Account's MonthlyRelayLimit MonthlyRelayLimit int32 `json:"monthlyRelayLimit"` }
PortalApp Struct Definition and Methods
type SettingsLite ¶
type SettingsLite struct { SecretKey string `json:"secretKey,omitempty"` SecretKeyRequired bool `json:"secretKeyRequired,omitempty"` }
PortalApp Struct Definition and Methods
type UpdateAcceptAccountUser ¶
type UpdateAcceptAccountUser struct { DeclinedInvite bool `json:"declined"` AccountID AccountID `json:"accountID"` UserID UserID `json:"userID"` AuthProviderType AuthType `json:"type"` ProviderUserID ProviderUserID `json:"providerUserID"` }
UpdateAccountUserRole contains all fields required to accept an Account User
type UpdateAccount ¶
type UpdateAccount struct { AccountID AccountID `json:"accountID"` Name string `json:"name"` IconURL string `json:"iconURL"` PlanType PayPlanType `json:"planType"` EnterpriseLimit int32 `json:"enterpriseLimit"` StripeSubscriptionID *string `json:"stripeSubscriptionID"` Notifications []UpdateAccountNotifications `json:"notificationSettings,omitempty"` }
UpdateAccount contains all fields required to update an Account
type UpdateAccountNotifications ¶ added in v2.5.0
type UpdateAccountNotifications struct { AccountID AccountID `json:"accountID,omitempty"` NotificationType NotificationType `json:"notificationType"` Active bool `json:"active"` Destination string `json:"destination"` Trigger string `json:"trigger"` Events []NotificationEvent `json:"events"` }
Account Struct Definition and Methods
type UpdateAccountUserRole ¶
type UpdateAccountUserRole struct { UserID UserID `json:"userID"` AccountID AccountID `json:"accountID"` RoleName RoleName `json:"roleName"` }
UpdateAccountUserRole contains all fields required to update an Account User's Role
type UpdateAppSettings ¶
type UpdateAppSettings struct { AppID PortalAppID `json:"appID,omitempty"` Environment Environment `json:"environment"` SecretKey string `json:"secretKey"` SecretKeyRequired bool `json:"secretKeyRequired"` MonthlyRelayLimit int32 `json:"monthlyRelayLimit"` FavoritedChainIDs []string `json:"favoritedChainIDs"` }
PortalApp Struct Definition and Methods
type UpdateChain ¶
type UpdateChain struct { ID RelayChainID `json:"id"` IconURL *string `json:"iconURL"` Blockchain *ChainAlias `json:"blockchain"` Description *string `json:"description"` EnforceResult *string `json:"enforceResult"` Path *string `json:"path"` Ticker *string `json:"ticker"` AllowedMethods []string `json:"allowedMethods"` LogLimitBlocks *int32 `json:"logLimitBlocks"` RequestTimeout *int32 `json:"requestTimeout"` Active *bool `json:"active"` Aliases *map[ChainAlias]struct{} `json:"chainAliases,omitempty"` Altruists *map[AltruistURL]Altruist `json:"altruists,omitempty"` Checks *map[ChainCheckType]Check `json:"chainChecks,omitempty"` // DEPRECATED - TODO remove when move to only store aliases is complete AliasDomains *map[ChainAlias][]ChainDomain `json:"domains,omitempty"` }
Chain Struct and Methods
type UpdateGigastakeApp ¶
type UpdateGigastakeApp struct { ID GigastakeAppID `json:"id"` ChainIDs []RelayChainID `json:"chainIDs"` }
UpdateGigastakeApp represents the fields that can be updated on a GigastakeApp
type UpdatePortalApp ¶
type UpdatePortalApp struct { AppID PortalAppID `json:"appID,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` AppEmoji AppEmoji `json:"appEmoji,omitempty"` Settings *UpdateAppSettings `json:"appSettings,omitempty"` Whitelists *WhitelistsObject `json:"whitelists,omitempty"` }
UpdatePortalApp Struct Definition and Methods
func (*UpdatePortalApp) IsEmpty ¶
func (u *UpdatePortalApp) IsEmpty() bool
type UpdateRemoveAccountUser ¶
type UpdateRemoveAccountUser struct { UserID UserID `json:"userID"` AccountID AccountID `json:"accountID"` }
UpdateRemoveAccountUser contains all fields required to remove an Account User's Role
type UpdateUser ¶
type UpdateUser struct { ID UserID `json:"id"` IconURL *string `json:"iconURL"` UpdatesProduct *bool `json:"updatesProduct"` UpdatesMarketing *bool `json:"updatesMarketing"` BetaTester *bool `json:"betaTester"` }
UpdateUser contains all fields required to update a User
type User ¶
type User struct { ID UserID `json:"id"` Email Email `json:"email"` IconURL string `json:"iconURL"` SignedUp bool `json:"signedUp"` UpdatesProduct bool `json:"updatesProduct"` UpdatesMarketing bool `json:"updatesMarketing"` BetaTester bool `json:"betaTester"` Permissions map[AccountID]AccountPermissions `json:"permissions"` AuthProviders map[AuthType]UserAuthProvider `json:"authProviders"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
User represents a single Portal user
func (*User) ArePermissionsEmpty ¶
func (*User) DeletePermissions ¶
func (u *User) DeletePermissions(accountID AccountID) map[AccountID]AccountPermissions
func (*User) GetAccountRole ¶ added in v2.5.0
func (*User) HasPermission ¶
func (u *User) HasPermission(accountID AccountID, permission Permissions) bool
func (*User) ToAccountUser ¶ added in v2.5.0
func (u *User) ToAccountUser(accountID AccountID) AccountUser
func (*User) UpsertPermissions ¶
type UserAuthProvider ¶
type UserAuthProvider struct { UserID UserID `json:"userID,omitempty"` ProviderUserID ProviderUserID `json:"providerUserID"` Type AuthType `json:"type"` Provider AuthProvider `json:"provider"` Federated bool `json:"federated"` }
UserAuthProvider represents a single auth provider for a user (eg. Auth0)
func (*UserAuthProvider) Table ¶
func (u *UserAuthProvider) Table() Table
type ValidatorChainConfig ¶ added in v2.8.0
type ValidatorChainConfig struct { ChainID RelayChainID `json:"chainID"` ValidRange int32 `json:"validRange"` LogLimitBlocks int32 `json:"logLimitBlocks"` }
func (*ValidatorChainConfig) Table ¶ added in v2.8.0
func (v *ValidatorChainConfig) Table() Table
type ValidatorMethodConfig ¶ added in v2.8.0
type ValidatorMethodConfig struct { Method Method `json:"method"` Validator ValidatorMethodStr `json:"validator"` }
func (*ValidatorMethodConfig) Table ¶ added in v2.8.0
func (v *ValidatorMethodConfig) Table() Table
type ValidatorMethodStr ¶ added in v2.8.0
type ValidatorMethodStr = string
const ( ValidatorMethodBlockRange ValidatorMethodStr = "blockRange" ValidatorMethodLogLimitBlocks ValidatorMethodStr = "logLimitBlocks" ValidatorMethodETHAddress ValidatorMethodStr = "ethAddress" )
type ValidatorPluginConfig ¶ added in v2.8.0
type ValidatorPluginConfig struct { // ChainsValidRanges is a mapping of chain id to the maximum range of blocks (from the estimated current block height) allowed for any relay request ChainsValidRanges map[RelayChainID]int32 `json:"chains_valid_ranges,omitempty"` // ChainsLogLimitBlocks is a mapping of chain id to the maximum number of blocks allowed for any eth_getLogs relay request ChainsLogLimitBlocks map[RelayChainID]int32 `json:"chains_log_limit_blocks,omitempty"` // ArchivalChains is a mapping of mainnet chain IDs to their archival chain IDs (for all chains with an archival variant) ArchivalChains map[RelayChainID]RelayChainID `json:"archival_chains,omitempty"` // MethodValidatorsMap is a mapping of method to a list of validators to be applied to relay requests for that method MethodValidatorsMap map[Method][]ValidatorMethodStr `json:"method_validators,omitempty"` }
func (*ValidatorPluginConfig) RemoveChainConfigs ¶ added in v2.8.0
func (v *ValidatorPluginConfig) RemoveChainConfigs(chainID RelayChainID)
func (*ValidatorPluginConfig) RemoveMethodValidator ¶ added in v2.8.0
func (v *ValidatorPluginConfig) RemoveMethodValidator(methodConfig *ValidatorMethodConfig)
func (*ValidatorPluginConfig) UpdateChainConfigs ¶ added in v2.8.0
func (v *ValidatorPluginConfig) UpdateChainConfigs(chainConfig *ValidatorChainConfig)
func (*ValidatorPluginConfig) UpdateMethodValidator ¶ added in v2.8.0
func (v *ValidatorPluginConfig) UpdateMethodValidator(methodConfig *ValidatorMethodConfig)
type Whitelist ¶
type Whitelist struct { AppID PortalAppID `json:"applicationID"` Type WhitelistType `json:"type"` Value string `json:"value"` ChainID RelayChainID `json:"chain_id"` }
Whitelist (singular) is used by the listener in PHD to receive a single whitelist row
type WhitelistType ¶
type WhitelistType string
Enums
const ( WhitelistTypeOrigins WhitelistType = "origins" WhitelistTypeBlockchains WhitelistType = "blockchains" WhitelistTypeUserAgents WhitelistType = "userAgents" WhitelistTypeContracts WhitelistType = "contracts" WhitelistTypeMethods WhitelistType = "methods" )
func (WhitelistType) IsValid ¶
func (w WhitelistType) IsValid() bool
type Whitelists ¶
type Whitelists struct { Origins map[Origin]struct{} `json:"origins,omitempty"` UserAgents map[UserAgent]struct{} `json:"userAgents,omitempty"` Blockchains map[RelayChainID]struct{} `json:"blockchains,omitempty"` Contracts map[RelayChainID]map[Contract]struct{} `json:"contracts,omitempty"` Methods map[RelayChainID]map[Method]struct{} `json:"methods,omitempty"` }
PortalApp Struct Definition and Methods
func (*Whitelists) IsEmpty ¶
func (w *Whitelists) IsEmpty() bool
type WhitelistsObject ¶
type WhitelistsObject struct { AppWhitelists [3]ApplicationWhitelists `json:"appWhitelists"` ChainWhitelists [2]ChainWhitelists `json:"chainWhitelists"` }
WhitelistsObject is a GraphQL-compatible representation of all the whitelists for a given application (used for the Portal UI) It is also used to update Whitelists for an app (sent from Portal UI to PUB to PHD)