Documentation
¶
Index ¶
- Constants
- func NewMailgun(m mailgunv3.Mailgun)
- func SendTemplateEmail(content types.SendEmailPayload, templateId string) (types.SendEmailResponse, error)
- func SendTemplateEmailWithJsonAttachment(content types.SendEmailPayload, templateId string) error
- type APIKeyService
- type EmailService
- func (m *EmailService) SendEmail(ctx context.Context, payload types.SendEmailPayload) (types.SendEmailResponse, error)
- func (m *EmailService) SendKYBApprovalEmail(email, firstName string) (types.SendEmailResponse, error)
- func (m *EmailService) SendKYBRejectionEmail(email, firstName, reasonForDecline string) (types.SendEmailResponse, error)
- func (m *EmailService) SendPasswordResetEmail(ctx context.Context, token, email, firstName string) (types.SendEmailResponse, error)
- func (m *EmailService) SendVerificationEmail(ctx context.Context, token, email, firstName string) (types.SendEmailResponse, error)
- func (m *EmailService) SendWelcomeEmail(ctx context.Context, email, firstName string, scopes []string) (types.SendEmailResponse, error)
- type EngineService
- func (s *EngineService) CreateGatewayWebhook() error
- func (s *EngineService) CreateServerWallet(ctx context.Context, label string) (string, error)
- func (s *EngineService) CreateTransferWebhook(ctx context.Context, chainID int64, contractAddress string, toAddress string, ...) (string, string, error)
- func (s *EngineService) DeleteWebhook(ctx context.Context, webhookID string) error
- func (s *EngineService) DeleteWebhookAndRecord(ctx context.Context, webhookID string) error
- func (s *EngineService) GetAddressTransactionHistory(ctx context.Context, chainID int64, walletAddress string, limit int, ...) ([]map[string]interface{}, error)
- func (s *EngineService) GetContractEvents(ctx context.Context, chainID int64, contractAddress string, ...) ([]interface{}, error)
- func (s *EngineService) GetContractEventsRPC(ctx context.Context, rpcEndpoint string, contractAddress string, ...) ([]interface{}, error)
- func (s *EngineService) GetContractEventsWithFallback(ctx context.Context, network *ent.Network, contractAddress string, ...) ([]interface{}, error)
- func (s *EngineService) GetLatestBlock(ctx context.Context, chainID int64) (int64, error)
- func (s *EngineService) GetTransactionStatus(ctx context.Context, queueId string) (result map[string]interface{}, err error)
- func (s *EngineService) GetWebhookByID(ctx context.Context, webhookID string, chainID int64) (*WebhookInfo, error)
- func (s *EngineService) ParseUserOpErrorJSON(errorJSON map[string]interface{}) string
- func (s *EngineService) SendTransactionBatch(ctx context.Context, chainID int64, address string, ...) (queueID string, err error)
- func (s *EngineService) UpdateWebhook(ctx context.Context, webhookID string, webhookPayload map[string]interface{}) error
- func (s *EngineService) WaitForTransactionMined(ctx context.Context, queueId string, timeout time.Duration) (result map[string]interface{}, err error)
- type EtherscanService
- type MailProvider
- type PriorityQueueService
- func (s *PriorityQueueService) AssignLockPaymentOrder(ctx context.Context, order types.LockPaymentOrderFields) error
- func (s *PriorityQueueService) CreatePriorityQueueForBucket(ctx context.Context, bucket *ent.ProvisionBucket)
- func (s *PriorityQueueService) GetProviderRate(ctx context.Context, provider *ent.ProviderProfile, tokenSymbol string, ...) (decimal.Decimal, error)
- func (s *PriorityQueueService) GetProvisionBuckets(ctx context.Context) ([]*ent.ProvisionBucket, error)
- func (s *PriorityQueueService) ProcessBucketQueues() error
- type ReceiveAddressService
- type SlackService
- func (s *SlackService) SendActionFeedbackNotification(firstName, email, submissionID, actionType, reasonForDecline string) error
- func (s *SlackService) SendSubmissionNotification(firstName, email, submissionID string) error
- func (s *SlackService) SendUserSignupNotification(user *ent.User, scopes []string, providerCurrencies []string) error
- type TurnstileResponse
- type TurnstileService
- type WebhookInfo
- type WebhookListResponse
Constants ¶
const ERC20ABI = `` /* 7075-byte string literal not displayed */
ERC20ABI represents a standard ERC20 smart contract
Variables ¶
This section is empty.
Functions ¶
func NewMailgun ¶
NewMailgun initialize mailgunv3.Mailgun and can be used to initialize a mocked Mailgun interface.
func SendTemplateEmail ¶
func SendTemplateEmail(content types.SendEmailPayload, templateId string) (types.SendEmailResponse, error)
SendTemplateEmail sends an email using SendGrid's dynamic template.
func SendTemplateEmailWithJsonAttachment ¶
func SendTemplateEmailWithJsonAttachment(content types.SendEmailPayload, templateId string) error
SendTemplateEmailWithJsonAttachment sends an email using SendGrid's dynamic template with a JSON attachment.
Types ¶
type APIKeyService ¶
type APIKeyService struct{}
APIKeyService provides functionality related to API keys.
func NewAPIKeyService ¶
func NewAPIKeyService() *APIKeyService
NewAPIKeyService creates a new instance of APIKeyService.
func (*APIKeyService) GenerateAPIKey ¶
func (s *APIKeyService) GenerateAPIKey( ctx context.Context, tx *ent.Tx, sender *ent.SenderProfile, provider *ent.ProviderProfile, ) (*ent.APIKey, string, error)
GenerateAPIKey generates a new API key for the user.
func (*APIKeyService) GetAPIKey ¶
func (s *APIKeyService) GetAPIKey( ctx context.Context, sender *ent.SenderProfile, provider *ent.ProviderProfile, ) (*types.APIKeyResponse, error)
GetAPIKey gets the API key for a user profile.
type EmailService ¶
type EmailService struct {
MailProvider MailProvider
}
EmailService provides functionality to sending emails via a mailer provider
func NewEmailService ¶
func NewEmailService(mailProvider MailProvider) *EmailService
NewEmailService creates a new instance of EmailService with a given MailProvider.
func (*EmailService) SendEmail ¶
func (m *EmailService) SendEmail(ctx context.Context, payload types.SendEmailPayload) (types.SendEmailResponse, error)
SendEmail performs the action for sending an email.
func (*EmailService) SendKYBApprovalEmail ¶
func (m *EmailService) SendKYBApprovalEmail(email, firstName string) (types.SendEmailResponse, error)
SendKYBApprovalEmail sends a KYB approval email.
func (*EmailService) SendKYBRejectionEmail ¶
func (m *EmailService) SendKYBRejectionEmail(email, firstName, reasonForDecline string) (types.SendEmailResponse, error)
SendKYBRejectionEmail sends a KYB rejection email.
func (*EmailService) SendPasswordResetEmail ¶
func (m *EmailService) SendPasswordResetEmail(ctx context.Context, token, email, firstName string) (types.SendEmailResponse, error)
SendPasswordResetEmail performs the actions for sending a password reset token to the user email.
func (*EmailService) SendVerificationEmail ¶
func (m *EmailService) SendVerificationEmail(ctx context.Context, token, email, firstName string) (types.SendEmailResponse, error)
SendVerificationEmail performs the actions for sending a verification token to the user email.
func (*EmailService) SendWelcomeEmail ¶
func (m *EmailService) SendWelcomeEmail(ctx context.Context, email, firstName string, scopes []string) (types.SendEmailResponse, error)
SendWelcomeEmail sends a welcome email to the user
type EngineService ¶
type EngineService struct {
// contains filtered or unexported fields
}
EngineService provides functionality for interacting with the engine/thirdweb API
func NewEngineService ¶
func NewEngineService() *EngineService
NewEngineService creates a new instance of EngineService
func (*EngineService) CreateGatewayWebhook ¶
func (s *EngineService) CreateGatewayWebhook() error
CreateGatewayWebhook creates webhooks for gateway contract events across all supported chains for the environment
func (*EngineService) CreateServerWallet ¶
CreateServerWallet creates a new EIP-4337 smart contract account address
func (*EngineService) CreateTransferWebhook ¶
func (s *EngineService) CreateTransferWebhook(ctx context.Context, chainID int64, contractAddress string, toAddress string, orderID string) (string, string, error)
CreateTransferWebhook creates webhooks to listen to transfer events to a specific address on a specific chain
func (*EngineService) DeleteWebhook ¶
func (s *EngineService) DeleteWebhook(ctx context.Context, webhookID string) error
DeleteWebhook deletes a webhook by its ID
func (*EngineService) DeleteWebhookAndRecord ¶
func (s *EngineService) DeleteWebhookAndRecord(ctx context.Context, webhookID string) error
DeleteWebhookAndRecord deletes a webhook from thirdweb and removes the PaymentWebhook record from our database
func (*EngineService) GetAddressTransactionHistory ¶
func (s *EngineService) GetAddressTransactionHistory(ctx context.Context, chainID int64, walletAddress string, limit int, fromBlock int64, toBlock int64) ([]map[string]interface{}, error)
GetAddressTransactionHistory fetches transaction history for any address from thirdweb insight API
func (*EngineService) GetContractEvents ¶
func (s *EngineService) GetContractEvents(ctx context.Context, chainID int64, contractAddress string, payload map[string]string) ([]interface{}, error)
GetContractEvents fetches contract events
func (*EngineService) GetContractEventsRPC ¶
func (s *EngineService) GetContractEventsRPC(ctx context.Context, rpcEndpoint string, contractAddress string, fromBlock int64, toBlock int64, topics []string, txHash string) ([]interface{}, error)
GetContractEventsRPC fetches contract events using RPC for networks not supported by Thirdweb Insight It fetches all events and filters for specified event signatures (gateway events or transfer events)
func (*EngineService) GetContractEventsWithFallback ¶
func (s *EngineService) GetContractEventsWithFallback(ctx context.Context, network *ent.Network, contractAddress string, fromBlock int64, toBlock int64, topics []string, txHash string, eventPayload map[string]string) ([]interface{}, error)
GetContractEventsWithFallback tries ThirdWeb first and falls back to RPC if ThirdWeb fails
func (*EngineService) GetLatestBlock ¶
GetLatestBlock fetches the latest block number for a given chain ID
func (*EngineService) GetTransactionStatus ¶
func (s *EngineService) GetTransactionStatus(ctx context.Context, queueId string) (result map[string]interface{}, err error)
GetTransactionStatus gets the status of a transaction
func (*EngineService) GetWebhookByID ¶
func (s *EngineService) GetWebhookByID(ctx context.Context, webhookID string, chainID int64) (*WebhookInfo, error)
GetWebhookByID fetches a webhook by its ID from thirdweb
func (*EngineService) ParseUserOpErrorJSON ¶
func (s *EngineService) ParseUserOpErrorJSON(errorJSON map[string]interface{}) string
ParseUserOpErrorJSON parses a UserOperation error JSON and returns the decoded error string
func (*EngineService) SendTransactionBatch ¶
func (s *EngineService) SendTransactionBatch(ctx context.Context, chainID int64, address string, txPayload []map[string]interface{}) (queueID string, err error)
SendTransactionBatch sends a batch of transactions
func (*EngineService) UpdateWebhook ¶
func (s *EngineService) UpdateWebhook(ctx context.Context, webhookID string, webhookPayload map[string]interface{}) error
UpdateWebhook updates an existing webhook with new filters
func (*EngineService) WaitForTransactionMined ¶
func (s *EngineService) WaitForTransactionMined(ctx context.Context, queueId string, timeout time.Duration) (result map[string]interface{}, err error)
WaitForTransactionMined waits for a transaction to be mined
type EtherscanService ¶
type EtherscanService struct {
// contains filtered or unexported fields
}
EtherscanService provides functionality for interacting with Etherscan API
func NewEtherscanService ¶
func NewEtherscanService() (*EtherscanService, error)
NewEtherscanService creates a new instance of EtherscanService
func (*EtherscanService) GetAddressTransactionHistory ¶
func (s *EtherscanService) GetAddressTransactionHistory(ctx context.Context, chainID int64, walletAddress string, limit int, fromBlock int64, toBlock int64) ([]map[string]interface{}, error)
GetAddressTransactionHistory fetches transaction history for any address from Etherscan API
type MailProvider ¶
type MailProvider string
const ( MAILGUN_MAIL_PROVIDER MailProvider = "MAILGUN" SENDGRID_MAIL_PROVIDER MailProvider = "SENDGRID" )
type PriorityQueueService ¶
type PriorityQueueService struct{}
func NewPriorityQueueService ¶
func NewPriorityQueueService() *PriorityQueueService
NewPriorityQueueService creates a new instance of PriorityQueueService
func (*PriorityQueueService) AssignLockPaymentOrder ¶
func (s *PriorityQueueService) AssignLockPaymentOrder(ctx context.Context, order types.LockPaymentOrderFields) error
AssignLockPaymentOrders assigns lock payment orders to providers
func (*PriorityQueueService) CreatePriorityQueueForBucket ¶
func (s *PriorityQueueService) CreatePriorityQueueForBucket(ctx context.Context, bucket *ent.ProvisionBucket)
CreatePriorityQueueForBucket creates a priority queue for a bucket and saves it to redis
func (*PriorityQueueService) GetProviderRate ¶
func (s *PriorityQueueService) GetProviderRate(ctx context.Context, provider *ent.ProviderProfile, tokenSymbol string, currency string) (decimal.Decimal, error)
GetProviderRate returns the rate for a provider
func (*PriorityQueueService) GetProvisionBuckets ¶
func (s *PriorityQueueService) GetProvisionBuckets(ctx context.Context) ([]*ent.ProvisionBucket, error)
GetProvisionBuckets returns a list of buckets with their providers
func (*PriorityQueueService) ProcessBucketQueues ¶
func (s *PriorityQueueService) ProcessBucketQueues() error
ProcessBucketQueues creates a priority queue for each bucket and saves it to redis
type ReceiveAddressService ¶
type ReceiveAddressService struct {
// contains filtered or unexported fields
}
ReceiveAddressService provides functionality related to managing receive addresses
func NewReceiveAddressService ¶
func NewReceiveAddressService() *ReceiveAddressService
NewReceiveAddressService creates a new instance of ReceiveAddressService.
func (*ReceiveAddressService) CreateSmartAddress ¶
func (s *ReceiveAddressService) CreateSmartAddress(ctx context.Context, label string) (string, error)
CreateSmartAddress function generates and saves a new EIP-4337 smart contract account address
func (*ReceiveAddressService) CreateTronAddress ¶
CreateTronAddress generates and saves a new Tron address
type SlackService ¶
type SlackService struct {
SlackWebhookURL string
}
func NewSlackService ¶
func NewSlackService(webhookURL string) *SlackService
func (*SlackService) SendActionFeedbackNotification ¶
func (s *SlackService) SendActionFeedbackNotification(firstName, email, submissionID, actionType, reasonForDecline string) error
SendActionFeedbackNotification sends a Slack notification for an action taken on a KYB submission
func (*SlackService) SendSubmissionNotification ¶
func (s *SlackService) SendSubmissionNotification(firstName, email, submissionID string) error
SendSubmissionNotification sends a Slack notification for a new KYB submission
func (*SlackService) SendUserSignupNotification ¶
func (s *SlackService) SendUserSignupNotification(user *ent.User, scopes []string, providerCurrencies []string) error
SendUserSignupNotification sends a Slack notification when a new user signs up
type TurnstileResponse ¶
type TurnstileResponse struct {
Success bool `json:"success"`
ErrorCodes []string `json:"error-codes,omitempty"`
ChallengeTS string `json:"challenge_ts,omitempty"`
Hostname string `json:"hostname,omitempty"`
}
TurnstileResponse represents the response from Cloudflare Turnstile verification
type TurnstileService ¶
type TurnstileService struct{}
TurnstileService handles Cloudflare Turnstile token validation
func NewTurnstileService ¶
func NewTurnstileService() *TurnstileService
NewTurnstileService creates a new instance of TurnstileService
func (*TurnstileService) VerifyToken ¶
func (s *TurnstileService) VerifyToken(token, remoteIP string) error
VerifyToken validates a Turnstile token with Cloudflare
type WebhookInfo ¶
type WebhookInfo struct {
ID string `json:"id"`
Name string `json:"name"`
WebhookURL string `json:"webhook_url"`
WebhookSecret string `json:"webhook_secret"`
Disabled bool `json:"disabled"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
ProjectID string `json:"project_id"`
Filters map[string]interface{} `json:"filters"`
}
WebhookInfo represents a webhook from thirdweb API
type WebhookListResponse ¶
type WebhookListResponse struct {
Data []WebhookInfo `json:"data"`
Meta struct {
Page int `json:"page"`
Limit int `json:"limit"`
TotalItems int `json:"total_items"`
TotalPages int `json:"total_pages"`
} `json:"meta"`
}
WebhookListResponse represents the response from GET /v1/webhooks