trailsapi

package
v0.63.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

trails-api v1-25.12.16-ee270e57 cd6fea50d2e26fb661de670279f19010f6a3f14a -- Code generated by webrpc-gen@v0.31.3 with golang generator. DO NOT EDIT.

webrpc-gen -schema=trails-api.ridl -target=golang -pkg=trailsapi -client -service=Trails -methodTreeShake -ignore=@onramp -out=./clients/trails-api.gen.go

Index

Constants

View Source
const DefaultAPIServiceURL = "https://trails-api.sequence.app"
View Source
const TrailsPathPrefix = "/rpc/Trails/"
View Source
const WebrpcHeader = "Webrpc"
View Source
const WebrpcHeaderValue = "webrpc@v0.31.3;gen-golang@v0.23.3;trails-api@v1-25.12.16-ee270e57"

Variables

View Source
var (
	ErrWebrpcEndpoint       = WebRPCError{Code: 0, Name: "WebrpcEndpoint", Message: "endpoint error", HTTPStatus: 400}
	ErrWebrpcRequestFailed  = WebRPCError{Code: -1, Name: "WebrpcRequestFailed", Message: "request failed", HTTPStatus: 400}
	ErrWebrpcBadRoute       = WebRPCError{Code: -2, Name: "WebrpcBadRoute", Message: "bad route", HTTPStatus: 404}
	ErrWebrpcBadMethod      = WebRPCError{Code: -3, Name: "WebrpcBadMethod", Message: "bad method", HTTPStatus: 405}
	ErrWebrpcBadRequest     = WebRPCError{Code: -4, Name: "WebrpcBadRequest", Message: "bad request", HTTPStatus: 400}
	ErrWebrpcBadResponse    = WebRPCError{Code: -5, Name: "WebrpcBadResponse", Message: "bad response", HTTPStatus: 500}
	ErrWebrpcServerPanic    = WebRPCError{Code: -6, Name: "WebrpcServerPanic", Message: "server panic", HTTPStatus: 500}
	ErrWebrpcInternalError  = WebRPCError{Code: -7, Name: "WebrpcInternalError", Message: "internal error", HTTPStatus: 500}
	ErrWebrpcClientAborted  = WebRPCError{Code: -8, Name: "WebrpcClientAborted", Message: "request aborted by client", HTTPStatus: 400}
	ErrWebrpcStreamLost     = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400}
	ErrWebrpcStreamFinished = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200}
)

Webrpc errors

View Source
var (
	ErrUnauthorized       = WebRPCError{Code: 1000, Name: "Unauthorized", Message: "Unauthorized access", HTTPStatus: 401}
	ErrPermissionDenied   = WebRPCError{Code: 1001, Name: "PermissionDenied", Message: "Permission denied", HTTPStatus: 403}
	ErrSessionExpired     = WebRPCError{Code: 1002, Name: "SessionExpired", Message: "Session expired", HTTPStatus: 403}
	ErrMethodNotFound     = WebRPCError{Code: 1003, Name: "MethodNotFound", Message: "Method not found", HTTPStatus: 404}
	ErrRequestConflict    = WebRPCError{Code: 1004, Name: "RequestConflict", Message: "Conflict with target resource", HTTPStatus: 409}
	ErrAborted            = WebRPCError{Code: 1005, Name: "Aborted", Message: "Request aborted", HTTPStatus: 400}
	ErrGeoblocked         = WebRPCError{Code: 1006, Name: "Geoblocked", Message: "Geoblocked region", HTTPStatus: 451}
	ErrRateLimited        = WebRPCError{Code: 1007, Name: "RateLimited", Message: "Rate-limited. Please slow down.", HTTPStatus: 429}
	ErrProjectNotFound    = WebRPCError{Code: 1008, Name: "ProjectNotFound", Message: "Project not found", HTTPStatus: 401}
	ErrAccessKeyNotFound  = WebRPCError{Code: 1101, Name: "AccessKeyNotFound", Message: "Access key not found", HTTPStatus: 401}
	ErrAccessKeyMismatch  = WebRPCError{Code: 1102, Name: "AccessKeyMismatch", Message: "Access key mismatch", HTTPStatus: 409}
	ErrInvalidOrigin      = WebRPCError{Code: 1103, Name: "InvalidOrigin", Message: "Invalid origin for Access Key", HTTPStatus: 403}
	ErrInvalidService     = WebRPCError{Code: 1104, Name: "InvalidService", Message: "Service not enabled for Access key", HTTPStatus: 403}
	ErrUnauthorizedUser   = WebRPCError{Code: 1105, Name: "UnauthorizedUser", Message: "Unauthorized user", HTTPStatus: 403}
	ErrQuotaExceeded      = WebRPCError{Code: 1200, Name: "QuotaExceeded", Message: "Quota request exceeded", HTTPStatus: 429}
	ErrQuotaRateLimit     = WebRPCError{Code: 1201, Name: "QuotaRateLimit", Message: "Quota rate limit exceeded", HTTPStatus: 429}
	ErrNoDefaultKey       = WebRPCError{Code: 1300, Name: "NoDefaultKey", Message: "No default access key found", HTTPStatus: 403}
	ErrMaxAccessKeys      = WebRPCError{Code: 1301, Name: "MaxAccessKeys", Message: "Access keys limit reached", HTTPStatus: 403}
	ErrAtLeastOneKey      = WebRPCError{Code: 1302, Name: "AtLeastOneKey", Message: "You need at least one Access Key", HTTPStatus: 403}
	ErrTimeout            = WebRPCError{Code: 1900, Name: "Timeout", Message: "Request timed out", HTTPStatus: 408}
	ErrInvalidArgument    = WebRPCError{Code: 2000, Name: "InvalidArgument", Message: "Invalid argument", HTTPStatus: 400}
	ErrUnexpected         = WebRPCError{Code: 2001, Name: "Unexpected", Message: "Unexpected server error", HTTPStatus: 500}
	ErrUnavailable        = WebRPCError{Code: 2002, Name: "Unavailable", Message: "Unavailable resource", HTTPStatus: 400}
	ErrQueryFailed        = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400}
	ErrIntentStatus       = WebRPCError{Code: 2004, Name: "IntentStatus", Message: "Invalid intent status", HTTPStatus: 422}
	ErrNotFound           = WebRPCError{Code: 8000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400}
	ErrUnsupportedNetwork = WebRPCError{Code: 8008, Name: "UnsupportedNetwork", Message: "Unsupported network", HTTPStatus: 422}
	ErrClientOutdated     = WebRPCError{Code: 8009, Name: "ClientOutdated", Message: "Client is outdated", HTTPStatus: 422}
	ErrIntentsSkipped     = WebRPCError{Code: 7000, Name: "IntentsSkipped", Message: "Intents skipped as client is attempting a transaction that does not require intents", HTTPStatus: 400}
	ErrQuoteExpired       = WebRPCError{Code: 7001, Name: "QuoteExpired", Message: "Intent quote has expired. Please try again.", HTTPStatus: 400}
	ErrIntentsDisabled    = WebRPCError{Code: 9000, Name: "IntentsDisabled", Message: "Intents service is currently unavailable", HTTPStatus: 400}
)

Schema errors

View Source
var CCTPTransferStatus_name = map[uint8]string{
	0: "UNKNOWN",
	1: "ON_HOLD",
	2: "PENDING",
	3: "FETCHING",
	4: "COMPLETE",
	5: "FAILED",
}
View Source
var CCTPTransferStatus_value = map[string]uint8{
	"UNKNOWN":  0,
	"ON_HOLD":  1,
	"PENDING":  2,
	"FETCHING": 3,
	"COMPLETE": 4,
	"FAILED":   5,
}
View Source
var (
	HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"}
)
View Source
var IntentStatus_name = map[uint8]string{
	0: "QUOTED",
	1: "COMMITTED",
	2: "EXECUTING",
	3: "FAILED",
	4: "SUCCEEDED",
	5: "ABORTED",
}
View Source
var IntentStatus_value = map[string]uint8{
	"QUOTED":    0,
	"COMMITTED": 1,
	"EXECUTING": 2,
	"FAILED":    3,
	"SUCCEEDED": 4,
	"ABORTED":   5,
}
View Source
var SortOrder_name = map[uint32]string{
	0: "DESC",
	1: "ASC",
}
View Source
var SortOrder_value = map[string]uint32{
	"DESC": 0,
	"ASC":  1,
}
View Source
var TransactionContext_name = map[uint8]string{
	0: "NONE",
	1: "CCTPV2_MESSAGE",
}
View Source
var TransactionContext_value = map[string]uint8{
	"NONE":           0,
	"CCTPV2_MESSAGE": 1,
}
View Source
var TransactionStatus_name = map[uint8]string{
	0: "UNKNOWN",
	1: "ON_HOLD",
	2: "PENDING",
	3: "RELAYING",
	4: "SENT",
	5: "ERRORED",
	6: "MINING",
	7: "SUCCEEDED",
	8: "FAILED",
	9: "ABORTED",
}
View Source
var TransactionStatus_value = map[string]uint8{
	"UNKNOWN":   0,
	"ON_HOLD":   1,
	"PENDING":   2,
	"RELAYING":  3,
	"SENT":      4,
	"ERRORED":   5,
	"MINING":    6,
	"SUCCEEDED": 7,
	"FAILED":    8,
	"ABORTED":   9,
}
View Source
var TransactionType_name = map[uint8]string{
	0: "UNKNOWN",
	1: "DEPOSIT",
	2: "ORIGIN",
	3: "DESTINATION",
	4: "ROUTE",
}
View Source
var TransactionType_value = map[string]uint8{
	"UNKNOWN":     0,
	"DEPOSIT":     1,
	"ORIGIN":      2,
	"DESTINATION": 3,
	"ROUTE":       4,
}

Functions

func HTTPRequestHeaders

func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)

func PtrTo

func PtrTo[T any](v T) *T

PtrTo is a useful helper when constructing values for optional fields.

func WebRPCSchemaHash

func WebRPCSchemaHash() string

Schema hash generated from your RIDL schema

func WebRPCSchemaVersion

func WebRPCSchemaVersion() string

Schema version of your RIDL schema

func WebRPCVersion

func WebRPCVersion() string

WebRPC description and code-gen version

func WithHTTPRequestHeaders

func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)

Types

type AbortIntentRequest

type AbortIntentRequest struct {
	// intentId is the ID of the intent which has been aborted
	IntentID prototyp.Hash `json:"intentId"`
	// chainId is required to specify which chain the transaction was aborted
	ChainID uint64 `json:"chainId"`
	// abortTransactionHash is the transaction hash of the abort transaction
	// submitted by the user which we validate before updating status
	AbortTransactionHash prototyp.Hash `json:"abortTransactionHash"`
}

type AbortIntentResponse

type AbortIntentResponse struct {
	IntentID prototyp.Hash `json:"intentId"`
	Status   IntentStatus  `json:"status"`
}

type BigInt

type BigInt big.Int

BigInt is an alias of big.Int with custom JSON (decimal string) encoding.

func NewBigInt

func NewBigInt(v int64) BigInt

func (*BigInt) AsInt

func (b *BigInt) AsInt() *big.Int

AsInt exposes the underlying *big.Int.

func (BigInt) MarshalBinary

func (b BigInt) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler. The first byte is the sign byte to represent positive or negative numbers.

func (BigInt) MarshalJSON

func (b BigInt) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (BigInt) MarshalText

func (b BigInt) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*BigInt) Scan

func (b *BigInt) Scan(src interface{}) error

func (BigInt) String

func (b BigInt) String() string

String returns the decimal string representation of the BigInt.

func (*BigInt) UnmarshalBinary

func (b *BigInt) UnmarshalBinary(buff []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler. The first byte is the sign byte to represent positive or negative numbers.

func (*BigInt) UnmarshalJSON

func (b *BigInt) UnmarshalJSON(text []byte) error

UnmarshalJSON implements json.Unmarshaler

func (*BigInt) UnmarshalText

func (b *BigInt) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (BigInt) Value

func (b BigInt) Value() (driver.Value, error)

type CCTPTransfer

type CCTPTransfer struct {
	ID                 uint64             `json:"id" db:"id,omitempty"`
	IntentID           prototyp.Hash      `json:"intentId" db:"intent_id"`
	OriginChainID      uint64             `json:"originChainId" db:"orig_chain_id"`
	DestinationChainID uint64             `json:"destinationChainId" db:"dest_chain_id"`
	OriginTxnID        uint64             `json:"originTxnId" db:"orig_txn_id"`
	OriginTxnHash      prototyp.Hash      `json:"originTxnHash" db:"orig_txn_hash"`
	DestinationTxnID   uint64             `json:"destinationTxnId" db:"dest_txn_id"`
	Message            prototyp.Hash      `json:"message" db:"message,omitempty"`
	Attestation        prototyp.Hash      `json:"attestation" db:"attestation,omitempty"`
	Status             CCTPTransferStatus `json:"status" db:"status"`
	StatusReason       *string            `json:"statusReason" db:"status_reason,omitempty"`
	CreatedAt          time.Time          `json:"createdAt" db:"created_at,omitempty"`
	UpdatedAt          time.Time          `json:"updatedAt" db:"updated_at,omitempty"`
}

type CCTPTransferStatus

type CCTPTransferStatus uint8
const (
	CCTPTransferStatus_UNKNOWN  CCTPTransferStatus = 0
	CCTPTransferStatus_ON_HOLD  CCTPTransferStatus = 1
	CCTPTransferStatus_PENDING  CCTPTransferStatus = 2
	CCTPTransferStatus_FETCHING CCTPTransferStatus = 3
	CCTPTransferStatus_COMPLETE CCTPTransferStatus = 4
	CCTPTransferStatus_FAILED   CCTPTransferStatus = 5
)

func (*CCTPTransferStatus) Is

func (x *CCTPTransferStatus) Is(values ...CCTPTransferStatus) bool

func (CCTPTransferStatus) MarshalText

func (x CCTPTransferStatus) MarshalText() ([]byte, error)

func (CCTPTransferStatus) String

func (x CCTPTransferStatus) String() string

func (*CCTPTransferStatus) UnmarshalText

func (x *CCTPTransferStatus) UnmarshalText(b []byte) error

type ChainGasUsageStatus

type ChainGasUsageStatus string
const (
	ChainGasUsageStatus_NORMAL    ChainGasUsageStatus = "NORMAL"
	ChainGasUsageStatus_BUSY      ChainGasUsageStatus = "BUSY"
	ChainGasUsageStatus_VERY_BUSY ChainGasUsageStatus = "VERY_BUSY"
)

func (*ChainGasUsageStatus) Is

func (x *ChainGasUsageStatus) Is(values ...ChainGasUsageStatus) bool

func (ChainGasUsageStatus) MarshalText

func (x ChainGasUsageStatus) MarshalText() ([]byte, error)

func (*ChainGasUsageStatus) UnmarshalText

func (x *ChainGasUsageStatus) UnmarshalText(b []byte) error

type ChainInfo

type ChainInfo struct {
	// id is the chain id
	ID uint64 `json:"id"`
	// id is the chain full name
	Name string `json:"name"`
	// tokenName/Symbol/Decimals are the native currency details
	TokenName     string `json:"tokenName"`
	TokenSymbol   string `json:"tokenSymbol"`
	TokenDecimals uint8  `json:"tokenDecimals"`
	// is testnet flag informs whether the chain is a testnet
	IsTestnet bool `json:"isTestnet"`
	// supportsBridging indicates whether the chain supports bridging operations
	SupportsBridging bool `json:"supportsBridging"`
	// additional metadata
	LogoURI          string `json:"logoUri"`
	BlockExplorerURL string `json:"blockExplorerUrl"`
}

type ChainMetadata

type ChainMetadata struct {
	ChainID uint64 `json:"chainId"`
	Name    string `json:"name"`
	LogoURI string `json:"logoUri,omitempty"`
	Testnet *bool  `json:"testnet,omitempty"`
}

type CommitIntentRequest

type CommitIntentRequest struct {
	Intent *Intent `json:"intent"`
}

CommitIntent accepts a fully formed Intent and commits it for execution. CommitIntent is called by clients to confirm they wish to commit to the intent and will execute it. We return the intent ID for tracking.

type CommitIntentResponse

type CommitIntentResponse struct {
	IntentID prototyp.Hash `json:"intentId"`
}

type DepositIntentEntry

type DepositIntentEntry struct {
	// EIP-712 TrailsIntent signature (hex)
	IntentSignature prototyp.Hash `json:"intentSignature"`
	// EIP-2612 permit signature (hex, if approval needed)
	PermitSignature *prototyp.Hash `json:"permitSignature"`
	// Permit expiration timestamp
	PermitDeadline *uint64 `json:"permitDeadline"`
	// Permit amount (usually max uint256)
	PermitAmount prototyp.BigInt `json:"permitAmount"`
	// Fee amount in deposit token
	FeeAmount prototyp.BigInt `json:"feeAmount"`
	// Fee token address (same as deposit token)
	FeeToken prototyp.Hash `json:"feeToken"`
	// Address that receives the fee
	FeeCollector prototyp.Hash `json:"feeCollector"`
	// User nonce from Intent Entrypoint contract (provided by client)
	UserNonce uint64 `json:"userNonce"`
	// Intent deadline timestamp
	Deadline uint64 `json:"deadline"`
}

DepositIntentEntry contains gasless deposit metadata stored in JSONB

type DepositSignature

type DepositSignature struct {
	// Required: EIP-712 TrailsIntent signature (hex)
	IntentSignature prototyp.Hash `json:"intentSignature"`
	// Optional: EIP-2612 permit signature (hex, if token approval needed)
	PermitSignature *prototyp.Hash `json:"permitSignature"`
	// Optional: Permit expiration timestamp
	PermitDeadline *uint64 `json:"permitDeadline"`
	// Optional: Permit amount (usually max uint256)
	PermitAmount prototyp.BigInt `json:"permitAmount"`
	// Required: Selected fee option from gasFeeOptions
	SelectedGasFeeOption *FeeOption `json:"selectedGasFeeOption"`
	// Required: User nonce from Intent Entrypoint contract (fetched fresh at execute time)
	UserNonce uint64 `json:"userNonce"`
	// Required: Intent deadline timestamp
	Deadline uint64 `json:"deadline"`
}

DepositSignature contains all gasless deposit signature parameters for ExecuteIntent

type DepositTransaction

type DepositTransaction struct {
	// toAddress is the origin intent address where the deposit is sent to.
	ToAddress prototyp.Hash `json:"toAddress"`
	// tokenAddress is the token being deposited.
	TokenAddress prototyp.Hash `json:"tokenAddress"`
	// decimals is the number of decimals for the token. If the value is null, it
	// means we were unable to retrieve the decimals for the token.
	Decimals *uint8 `json:"decimals"`
	// amount is the token amount being deposited.
	Amount prototyp.BigInt `json:"amount"`
}

DepositTransaction represents a deposit transfer transaction of the token amount to the origin intent address.

type ExecuteIntentRequest

type ExecuteIntentRequest struct {
	IntentID prototyp.Hash `json:"intentId"`
	// Traditional deposit: provide transaction hash
	DepositTransactionHash prototyp.Hash `json:"depositTransactionHash"`
	// Gasless deposit: provide signatures (mutually exclusive with depositTransactionHash)
	DepositSignature *DepositSignature `json:"depositSignature"`
}

ExecuteIntent relays the intent execution request to the intent execution engine. Clients provide the transfer transaction hash that executed the transfer to the intent origin address.

type ExecuteIntentResponse

type ExecuteIntentResponse struct {
	IntentID     prototyp.Hash `json:"intentId"`
	IntentStatus IntentStatus  `json:"intentStatus"`
}

type FeeOption

type FeeOption struct {
	// if value is 0x000...000 or 0xeee...eeee, it is native token
	TokenAddress        prototyp.Hash   `json:"tokenAddress"`
	TokenSymbol         string          `json:"tokenSymbol"`
	TokenDecimals       uint8           `json:"tokenDecimals"`
	Amount              prototyp.BigInt `json:"amount"`
	AmountUSD           float64         `json:"amountUsd"`
	FeeCollectorAddress prototyp.Hash   `json:"feeCollectorAddress"`
	// - isNative: bool
	// - supportsPermit: bool
	Is2612 bool `json:"is2612"`
}

type GasEstimate

type GasEstimate struct {
	TotalGas      uint64  `json:"totalGas"`
	GasPrice      string  `json:"gasPrice"`
	NativeCost    string  `json:"nativeCost"`
	NativeCostUSD float64 `json:"nativeCostUsd"`
}

type GasFeeOptions

type GasFeeOptions struct {
	GasEstimate         *GasEstimate  `json:"gasEstimate"`
	FeeOptions          []*FeeOption  `json:"feeOptions"`
	ExpiresAt           time.Time     `json:"expiresAt"`
	FeeCollectorAddress prototyp.Hash `json:"feeCollectorAddress"`
}

type GetChainsRequest

type GetChainsRequest struct {
	// TODO: use enum eventually..
	RouteProvider *string `json:"routeProvider"`
}

type GetChainsResponse

type GetChainsResponse struct {
	Chains []*ChainInfo `json:"chains"`
}

type GetExactInputRoutesRequest

type GetExactInputRoutesRequest struct {
	OriginChainID      uint64        `json:"originChainId"`
	OriginTokenAddress prototyp.Hash `json:"originTokenAddress"`
	// optionally passed to filter results
	DestinationChainID      *uint64       `json:"destinationChainId"`
	DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"`
}

type GetExactInputRoutesResponse

type GetExactInputRoutesResponse struct {
	Tokens []*TokenInfo `json:"tokens"`
}

type GetExactOutputRoutesRequest

type GetExactOutputRoutesRequest struct {
	DestinationChainID      uint64        `json:"destinationChainId"`
	DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"`
	// optionally passed to filter results to only tokens from this origin chain
	OriginChainID *uint64 `json:"originChainId"`
	// optionally passed to filter results to only this specific origin token
	OriginTokenAddress prototyp.Hash `json:"originTokenAddress"`
	// owner address is used to filter tokens the owner has a balance on.
	//
	// if unspecified, then we filter origin tokens based on popular options
	// as is useful for a qr code deposit flow.
	OwnerAddress prototyp.Hash `json:"ownerAddress"`
}

type GetExactOutputRoutesResponse

type GetExactOutputRoutesResponse struct {
	Tokens []*TokenInfo `json:"tokens"`
}

type GetIntentHistoryRequest

type GetIntentHistoryRequest struct {
	// cursor paging parameters
	Page *Page `json:"page"`
	// optional project id scope filter
	ByProjectID    uint64        `json:"byProjectId"`
	ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"`
}

GetIntentHistory returns the intent history list, with receipt and summary info.

type GetIntentHistoryResponse

type GetIntentHistoryResponse struct {
	Intents  []*IntentHistory `json:"intents"`
	NextPage *Page            `json:"nextPage"`
}

type GetIntentReceiptRequest

type GetIntentReceiptRequest struct {
	IntentID prototyp.Hash `json:"intentId"`
}

GetIntentReceipt returns the current receipt/status of an intent immediately. If you are waiting for a intent to complete, use WaitIntentReceipt.

type GetIntentReceiptResponse

type GetIntentReceiptResponse struct {
	IntentReceipt *IntentReceipt `json:"intentReceipt"`
}

type GetIntentRequest

type GetIntentRequest struct {
	IntentID prototyp.Hash `json:"intentId"`
}

GetIntent queries the database for solved and committed 'intents'

type GetIntentResponse

type GetIntentResponse struct {
	Intent *Intent `json:"intent"`
}

type GetIntentTransactionHistoryRequest

type GetIntentTransactionHistoryRequest struct {
	// cursor paging parameters
	Page *Page `json:"page"`
	// optional project id scope filter
	ByProjectID    uint64        `json:"byProjectId"`
	ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"`
}

DEPRECATED: please use GetIntentHistory instead

type GetIntentTransactionHistoryResponse

type GetIntentTransactionHistoryResponse struct {
	Intents  []*IntentSummary `json:"intents"`
	NextPage *Page            `json:"nextPage"`
}

DEPRECATED: please use GetIntentHistory instead

type GetTokenListRequest

type GetTokenListRequest struct {
	// chainIds is required to specify which chains to get featured tokens for
	ChainIDs []uint64 `json:"chainIds"`
	// optional search query string to search token name/symbol/address.
	// when searching lists, all of the lists will be used in the search automatically.
	SearchQuery string `json:"searchQuery"`
	// optional limit to return per chain, ie. like the top N number of tokens
	// sorted by featured then alphabetically by name.
	Limit int32 `json:"limit"`
	// optional token address to filter results to a specific token, useful for checking
	// if tokenAddress filter is used, the entire token list is searched for the token
	TokenAddress prototyp.Hash `json:"tokenAddress"`
	// optional filter to include all tokens in response, not just featured
	// by default, only featured tokens are returned.
	IncludeAllListed bool `json:"includeAllListed"`
	// optional filter to include external tokens in response, in addition to listed/featured
	// by default, external tokens are not returned.
	IncludeExternal bool `json:"includeExternal"`
	// optional filter to exlude specific token addresses from the response
	ExcludeTokens []prototyp.Hash `json:"excludeTokens"`
}

type GetTokenListResponse

type GetTokenListResponse struct {
	Tokens []*TokenInfo `json:"tokens"`
}

type GetTokenPricesRequest

type GetTokenPricesRequest struct {
	Tokens []*Token `json:"tokens"`
}

type GetTokenPricesResponse

type GetTokenPricesResponse struct {
	TokenPrices []*TokenPrice `json:"tokenPrices"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

type Intent

type Intent struct {
	// id is an internal-only sequential primary key.
	ID uint64 `json:"-" db:"id,omitempty"`
	// Trails/Sequence project id intent originated from
	ProjectID uint64 `json:"-" db:"project_id"`
	// intentId is a deterministic public intent identifier
	// based on the hash of the origin and destination intent addresses.
	IntentID prototyp.Hash `json:"intentId" db:"intent_id"`
	// intent status of different stages of the intent to keep track.
	// note: we also track status in IntentReceipt for execution status.
	Status       IntentStatus        `json:"status" db:"status,omitempty"`
	QuoteRequest *QuoteIntentRequest `json:"quoteRequest" db:"quote_request"`
	// intent owner / main signer
	OwnerAddress             prototyp.Hash            `json:"ownerAddress" db:"owner_address"`
	OriginChainID            uint64                   `json:"originChainId" db:"orig_chain_id"`
	DestinationChainID       uint64                   `json:"destinationChainId" db:"dest_chain_id"`
	OriginIntentAddress      prototyp.Hash            `json:"originIntentAddress" db:"orig_intent_address"`
	DestinationIntentAddress *prototyp.Hash           `json:"destinationIntentAddress,omitempty" db:"dest_intent_address,omitempty"`
	Salt                     prototyp.BigInt          `json:"salt" db:"salt"`
	DepositTransaction       *DepositTransaction      `json:"depositTransaction" db:"deposit_txn"`
	OriginCalls              *IntentCalls             `json:"originCalls" db:"orig_calls"`
	DestinationCalls         *IntentCalls             `json:"destinationCalls" db:"dest_calls,omitempty"`
	OriginPrecondition       *TransactionPrecondition `json:"originPrecondition" db:"orig_precondition"`
	DestinationPrecondition  *TransactionPrecondition `json:"destinationPrecondition" db:"dest_precondition,omitempty"`
	OriginMetaTxn            *MetaTxn                 `json:"originMetaTxn" db:"orig_meta_txn"`
	DestinationMetaTxn       *MetaTxn                 `json:"destinationMetaTxn" db:"dest_meta_txn,omitempty"`
	Quote                    *IntentProviderQuote     `json:"quote" db:"quote"`
	Fees                     *IntentFees              `json:"fees" db:"fees"`
	TrailsVersion            string                   `json:"trailsVersion" db:"trails_version"`
	TrailsContracts          *TrailsContracts         `json:"trailsContracts" db:"trails_contracts"`
	ExpiresAt                time.Time                `json:"expiresAt" db:"expires_at"`
	UpdatedAt                *time.Time               `json:"updatedAt,omitempty" db:"updated_at,omitempty"`
	CreatedAt                *time.Time               `json:"createdAt,omitempty" db:"created_at,omitempty"`
}

Fully formed/quoted/solved, executable intent.

type IntentCalls

type IntentCalls struct {
	ChainID uint64             `json:"chainId"`
	Space   prototyp.BigInt    `json:"space"`
	Nonce   prototyp.BigInt    `json:"nonce"`
	Calls   []*TransactionCall `json:"calls"`
}

type IntentFees

type IntentFees struct {
	// gas fees on origin and destination chains
	OriginGas      *IntentTransactionGasFee `json:"originGas"`
	DestinationGas *IntentTransactionGasFee `json:"destinationGas"`
	// provider fees (swap + bridge + trails)
	Provider *IntentProviderFees `json:"provider"`
	// total fees including provider fees + gas fees
	FeeTokenAddress prototyp.Hash   `json:"feeTokenAddress"`
	FeeTokenTotal   prototyp.BigInt `json:"feeTokenTotal"`
	TotalFeeAmount  prototyp.BigInt `json:"totalFeeAmount"`
	TotalFeeUSD     float64         `json:"totalFeeUsd"`
}

type IntentHistory

type IntentHistory struct {
	// intent deterministic id
	IntentID prototyp.Hash `json:"intentId"`
	// intent status from the 'intents' table
	Status IntentStatus `json:"status"`
	// intent creation and expiration timestamps
	ExpiresAt time.Time  `json:"expiresAt" db:"expires_at"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	// intent receipt from the 'intent_receipts' table
	//
	// NOTE: we will always include a receipt, even if we don't have one
	// in the db, so we can return the receipt.summary
	Receipt *IntentReceipt `json:"receipt"`
}

type IntentProviderFees

type IntentProviderFees struct {
	// quote provider fee component (swap and/or bridge)
	QuoteProvider       string          `json:"quoteProvider"`
	QuoteProviderFee    prototyp.BigInt `json:"quoteProviderFee"`
	QuoteProviderFeeUSD float64         `json:"quoteProviderFeeUsd"`
	// trails provider fee component, denominated in the origin token
	TrailsFee    prototyp.BigInt `json:"trailsFee"`
	TrailsFeeUSD float64         `json:"trailsFeeUsd"`
	// total provider fees, aka, swap + bridge + trails fees
	TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"`
	TotalFeeUSD    float64         `json:"totalFeeUsd"`
}

ProviderFees is the swap+bridge provider fee, trails fee summary and totals

type IntentProviderQuote

type IntentProviderQuote struct {
	RouteProviders           []RouteProvider `json:"routeProviders"`
	RouteProvidersRequestIDs []string        `json:"routeProvidersRequestIds"`
	RouteProvidersFeeUSD     []float64       `json:"routeProvidersFeeUsd"`
	FromAmount               prototyp.BigInt `json:"fromAmount"`
	FromAmountMin            prototyp.BigInt `json:"fromAmountMin"`
	FromAmountUSD            float64         `json:"fromAmountUsd"`
	FromAmountMinUSD         float64         `json:"fromAmountMinUsd"`
	ToAmount                 prototyp.BigInt `json:"toAmount"`
	ToAmountMin              prototyp.BigInt `json:"toAmountMin"`
	ToAmountUSD              float64         `json:"toAmountUsd"`
	ToAmountMinUSD           float64         `json:"toAmountMinUsd"`
	MaxSlippage              float64         `json:"maxSlippage"`
	PriceImpact              float64         `json:"priceImpact"`
	PriceImpactUSD           float64         `json:"priceImpactUsd"`
}

IntentProviderQuote represents the quotes from the underlining providers for both the swap and/or bridge external providers. If we do both a swap and a bridge, then the total amount is the sum of both providers.

type IntentReceipt

type IntentReceipt struct {
	// id is an internal-only sequential primary key.
	ID uint64 `json:"-" db:"id,omitempty"`
	// Trails/Sequence project id intent originated from
	ProjectID uint64 `json:"-" db:"project_id"`
	// intent deterministic id
	IntentID prototyp.Hash `json:"intentId" db:"intent_id"`
	// intent execution status
	Status IntentStatus `json:"status" db:"status,omitempty"`
	// intent owner / main signer
	OwnerAddress prototyp.Hash `json:"ownerAddress" db:"owner_address"`
	// origin chain id where the intent originated from
	OriginChainID uint64 `json:"originChainId" db:"orig_chain_id"`
	// destination chain id where the intent is targetting as final execution
	DestinationChainID uint64 `json:"destinationChainId" db:"dest_chain_id"`
	// deposit transaction transaction is the user-initiated transfer into
	// the origin intent address on the origin chain.
	//
	// also note, that if a user is using the 'gasless' deposit method,
	// then they supply us with an 'intentEntry' signature, and then
	// we relay the deposit as a meta-transaction on their behalf to
	// the intent entrypoint contract.
	//
	// there will also be a deposit transaction to the origin intent address.
	DepositTransactionID uint64             `json:"-" db:"deposit_txn_id"`
	DepositTransaction   *IntentTransaction `json:"depositTransaction" db:"-"`
	// origin intent transaction db reference and runtime type
	OriginTransactionID uint64             `json:"-" db:"orig_txn_id"`
	OriginTransaction   *IntentTransaction `json:"originTransaction" db:"-"`
	// destination intent transaction db reference and runtime type
	// note: this may be null if the intent did not require a destination txn,
	// ie. simple swap on origin chain only with no destination calldata.
	DestinationTransactionID *uint64               `json:"-" db:"dest_txn_id,omitempty"`
	DestinationTransaction   *IntentTransaction    `json:"destinationTransaction" db:"-"`
	Summary                  *IntentReceiptSummary `json:"summary" db:"summary"`
	// timestamp when the intent receipt was updated, usually from status change
	UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"`
	// timestamp of when the intent receipt was created
	CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"`
}

IntentReceipt represents an intent that went through trails, and fully executed as a set of transactions, and is now complete. This method is used to fetch the status of an intent, and also used by the GetIntentTransactionHistory endpoint.

type IntentReceiptSummary

type IntentReceiptSummary struct {
	IntentID            prototyp.Hash   `json:"intentId"`
	Status              IntentStatus    `json:"status"`
	OwnerAddress        prototyp.Hash   `json:"ownerAddress"`
	OriginChainID       uint64          `json:"originChainId"`
	DestinationChainID  uint64          `json:"destinationChainId"`
	TradeType           TradeType       `json:"tradeType"`
	RouteProviders      []RouteProvider `json:"routeProviders"`
	OriginIntentAddress prototyp.Hash   `json:"originIntentAddress"`
	OriginTokenAddress  prototyp.Hash   `json:"originTokenAddress"`
	OriginTokenAmount   prototyp.BigInt `json:"originTokenAmount"`
	OriginTokenMetadata *TokenMetadata  `json:"originTokenMetadata"`
	// NOTE: we will always set this value, even if its to the origin intent address as the same value.
	DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress"`
	// NOTE: for destinationTokenAddress, destinationTokenAmount, destinationToAddress, and destinationTokenMetadata
	// are assigned at execution time for EXACT_INPUT and also if destinationHasCallData is true, as we only
	// know the values once the destination txn has been executed.
	DestinationTokenAddress  *prototyp.Hash   `json:"destinationTokenAddress"`
	DestinationTokenAmount   *prototyp.BigInt `json:"destinationTokenAmount"`
	DestinationToAddress     *prototyp.Hash   `json:"destinationToAddress"`
	DestinationTokenMetadata *TokenMetadata   `json:"destinationTokenMetadata"`
	DestinationHasCallData   bool             `json:"destinationHasCallData"`
	DestinationHasCallValue  bool             `json:"destinationHasCallValue"`
	// memo is just any additional context / note we wanted to share
	// when computing the summary.
	Memo *string `json:"memo"`
	// createdAt is the time the intent quote was created
	CreatedAt time.Time `json:"createdAt"`
	// expiresAt is the time the intent quote expires
	ExpiresAt time.Time `json:"expiresAt"`
	// startedAt is the time the intent execution started
	StartedAt *time.Time `json:"startedAt"`
	// finishedAt is the time the intent execution finished
	FinishedAt *time.Time `json:"finishedAt"`
}

type IntentStatus

type IntentStatus uint8
const (
	// intent has been quoted
	IntentStatus_QUOTED IntentStatus = 0
	// intent has been committed by user
	IntentStatus_COMMITTED IntentStatus = 1
	// intent is in the process of being executed
	IntentStatus_EXECUTING IntentStatus = 2
	// done, intent execution failed
	IntentStatus_FAILED IntentStatus = 3
	// done, intent execution succeeded
	IntentStatus_SUCCEEDED IntentStatus = 4
	// done, intent execution was aborted by user
	IntentStatus_ABORTED IntentStatus = 5
)

func (*IntentStatus) Is

func (x *IntentStatus) Is(values ...IntentStatus) bool

func (IntentStatus) MarshalText

func (x IntentStatus) MarshalText() ([]byte, error)

func (IntentStatus) String

func (x IntentStatus) String() string

func (*IntentStatus) UnmarshalText

func (x *IntentStatus) UnmarshalText(b []byte) error

type IntentSummary

type IntentSummary struct {
	ID uint64 `json:"-"`
	// intent deterministic id
	IntentID prototyp.Hash `json:"intentId"`
	// intent status
	Status IntentStatus `json:"status"`
	// intent owner / main signer
	OwnerAddress prototyp.Hash `json:"ownerAddress"`
	// origin and destination chain ids
	OriginChainID uint64 `json:"originChainId"`
	// - originChainMetadata: ChainMetadata
	DestinationChainID uint64 `json:"destinationChainId"`
	// origin and destination intent addresses
	OriginIntentAddress      prototyp.Hash `json:"originIntentAddress"`
	DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress"`
	// deposit transfer transaction hash and status, which is the init
	// transfer from the owner / main signer into the origin intent
	// address on the origin chain id
	DepositTransactionHash   *prototyp.Hash    `json:"depositTransactionHash"`
	DepositTransactionStatus TransactionStatus `json:"depositTransactionStatus"`
	// origin and destination execution transaction hashes and statuses
	OriginTransactionHash        *prototyp.Hash    `json:"originTransactionHash"`
	OriginTransactionStatus      TransactionStatus `json:"originTransactionStatus"`
	DestinationTransactionHash   *prototyp.Hash    `json:"destinationTransactionHash"`
	DestinationTransactionStatus TransactionStatus `json:"destinationTransactionStatus"`
	OriginTokenAddress           prototyp.Hash     `json:"originTokenAddress"`
	OriginTokenAmount            prototyp.BigInt   `json:"originTokenAmount"`
	OriginTokenMetadata          *TokenMetadata    `json:"originTokenMetadata"`
	DestinationTokenAddress      prototyp.Hash     `json:"destinationTokenAddress"`
	DestinationTokenAmount       prototyp.BigInt   `json:"destinationTokenAmount"`
	DestinationTokenMetadata     *TokenMetadata    `json:"destinationTokenMetadata"`
	DestinationToAddress         prototyp.Hash     `json:"destinationToAddress,omitempty"`
	ExpiresAt                    time.Time         `json:"expiresAt" db:"expires_at"`
	// timestamp when the intent receipt was updated, usually from status change
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	// timestamp of when the intent receipt was created
	CreatedAt time.Time `json:"createdAt"`
}

DEPRECATED: please use GetIntentHistory / IntentReceiptSummary instead IntentSummary represents a summary view of an intent for listing purposes. NOTE: this type is deprecated, please use GetIntentHistory method instead

type IntentTransaction

type IntentTransaction struct {
	// Auto-incrementing id used for table pk
	ID uint64 `json:"-" db:"id,omitempty"`
	// we don't return it in the json, no need. its internal.
	// Intent id this transaction is associated with
	IntentID prototyp.Hash `json:"intentId" db:"intent_id"`
	// Status of this specific transaction
	Status       TransactionStatus `json:"status" db:"status"`
	StatusReason *string           `json:"statusReason" db:"status_reason"`
	// Chain where this transaction executes
	ChainID     uint64             `json:"chainId" db:"chain_id"`
	Type        TransactionType    `json:"type" db:"type"`
	Context     TransactionContext `json:"context" db:"context"`
	FromAddress prototyp.Hash      `json:"fromAddress" db:"from_address"`
	// ie. originIntentAddress, TrailsRouter, or TrailsIntentEntrypoint
	ToAddress prototyp.Hash `json:"toAddress" db:"to_address"`
	// Token being transferred in this transaction
	TokenAddress prototyp.Hash `json:"tokenAddress" db:"token_address"`
	// Amount transferred in this transaction
	TokenAmount prototyp.BigInt `json:"tokenAmount" db:"token_amount"`
	Calldata    prototyp.Hash   `json:"-" db:"calldata,omitempty"`
	// for user-sent deposit txn, this will be null
	MetaTxnID       prototyp.Hash            `json:"metaTxnId,omitempty" db:"meta_txn_id,omitempty"`
	MetaTxnFeeQuote *string                  `json:"metaTxnFeeQuote" db:"fee_quote,omitempty"`
	Precondition    *TransactionPrecondition `json:"precondition" db:"precondition,omitempty"`
	// Gasless deposit metadata (nullable)
	DepositIntentEntry *DepositIntentEntry `json:"depositIntentEntry" db:"deposit_intent_entry,omitempty"`
	// Transaction hash received from the relayer after it's mined.
	TxnHash prototyp.Hash `json:"txnHash,omitempty" db:"txn_hash,omitempty"`
	// On-chain block timestamp when txn was mined
	TxnMinedAt *time.Time `json:"txnMinedAt" db:"txn_mined_at,omitempty"`
	UpdatedAt  *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"`
	CreatedAt  *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"`
}

IntentTransaction represents a single transaction within an intent's execution flow.

type IntentTransactionGasFee

type IntentTransactionGasFee struct {
	ChainID             uint64              `json:"chainId"`
	TotalGasLimit       prototyp.BigInt     `json:"totalGasLimit"`
	GasPrice            prototyp.BigInt     `json:"gasPrice"`
	NativeTokenSymbol   string              `json:"nativeTokenSymbol"`
	NativeTokenPriceUSD *float64            `json:"nativeTokenPriceUsd"`
	ChainGasUsageStatus ChainGasUsageStatus `json:"chainGasUsageStatus"`
	TotalFeeAmount      prototyp.BigInt     `json:"totalFeeAmount"`
	TotalFeeUSD         float64             `json:"totalFeeUsd"`
	// sequence relayer gas fee quotes
	// AKA, meta transaction gas fee quotes for pre-sponsored
	MetaTxnFeeDetails *MetaTxnFeeDetails `json:"metaTxnFeeDetails"`
	// metaTxnGasQuote is like a voucher for gas sponsorship from the relayer
	MetaTxnGasQuote string `json:"metaTxnGasQuote"`
}

type MeldQuote

type MeldQuote struct {
	TransactionType              string  `json:"transactionType"`
	SourceAmount                 float64 `json:"sourceAmount"`
	SourceAmountWithoutFees      float64 `json:"sourceAmountWithoutFees"`
	FiatAmountWithoutFees        float64 `json:"fiatAmountWithoutFees"`
	DestinationAmountWithoutFees float64 `json:"destinationAmountWithoutFees,omitempty"`
	SourceCurrencyCode           string  `json:"sourceCurrencyCode"`
	CountryCode                  string  `json:"countryCode"`
	TotalFee                     float64 `json:"totalFee"`
	NetworkFee                   float64 `json:"networkFee"`
	TransactionFee               float64 `json:"transactionFee"`
	DestinationAmount            float64 `json:"destinationAmount"`
	DestinationCurrencyCode      string  `json:"destinationCurrencyCode"`
	ExchangeRate                 float64 `json:"exchangeRate"`
	PaymentMethodType            string  `json:"paymentMethodType"`
	CustomerScore                float64 `json:"customerScore"`
	ServiceProvider              string  `json:"serviceProvider"`
	InstitutionName              string  `json:"institutionName,omitempty"`
	LowKyc                       bool    `json:"lowKyc,omitempty"`
	PartnerFee                   float64 `json:"partnerFee"`
}

type MetaTxn

type MetaTxn struct {
	ID      string `json:"id"`
	ChainID uint64 `json:"chainId"`
	// fromAddress ...?
	WalletAddress string `json:"walletAddress"`
	// TODO: name it.. toAddress ?
	Contract string `json:"contract"`
	Input    string `json:"input"`
}

MetaTxn is a meta-transaction to be submitted to Sequence Relayer.

type MetaTxnFeeDetails

type MetaTxnFeeDetails struct {
	MetaTxnID         string          `json:"metaTxnId"`
	EstimatedGasLimit prototyp.BigInt `json:"estimatedGasLimit"`
	FeeNative         prototyp.BigInt `json:"feeNative"`
}

type Options

type Options struct {
	// JWTAuthToken is an optional JWT token to authenticate with the api service.
	JWTAuthToken string

	// ProjectAccessKey is an optional project access key to authenticate with the api service.
	// This may be required if no `JWTAuthToken` is provided.
	ProjectAccessKey string

	// TrailsAPIServiceURL is an optional custom URL for the Trails API service.
	// If not provided, the default URL in `DefaultAPIServiceURL` will be used.
	TrailsAPIServiceURL string

	// HTTPClient is an optional custom HTTP client to use for communicating with the
	// api service.
	HTTPClient HTTPClient
}

type Page

type Page struct {
	// Cursor: column to compare before/after to
	Column *string `json:"column,omitempty"`
	// Cursor: return column < before - include to get previous page
	Before *uint64 `json:"before,omitempty"`
	// Cursor: return column > after - include to get next page
	After *uint64 `json:"after,omitempty"`
	// Sorting filter
	Sort []*SortBy `json:"sort,omitempty"`
	// Number of items per page
	PageSize *uint32 `json:"pageSize,omitempty"`
	// Indicates if there are more results available
	More *bool `json:"more,omitempty"`
}

Page represents a results page. This can be used both to request a page and to store the state of a page.

type QuoteIntentRequest

type QuoteIntentRequest struct {
	// intent owner, aka the user address processing the quote
	OwnerAddress prototyp.Hash `json:"ownerAddress"`
	// origin chain and token details
	OriginChainID      uint64        `json:"originChainId"`
	OriginTokenAddress prototyp.Hash `json:"originTokenAddress"`
	// destination chain, token, and execution details
	DestinationChainID      uint64           `json:"destinationChainId"`
	DestinationTokenAddress prototyp.Hash    `json:"destinationTokenAddress"`
	DestinationToAddress    prototyp.Hash    `json:"destinationToAddress"`
	DestinationCallData     *string          `json:"destinationCallData"`
	DestinationCallValue    *prototyp.BigInt `json:"destinationCallValue"`
	// originTokenAmount is used with EXACT_INPUT txns
	OriginTokenAmount *prototyp.BigInt `json:"originTokenAmount"`
	// destinationTokenAmount is used with EXACT_OUTPUT txns
	DestinationTokenAmount *prototyp.BigInt `json:"destinationTokenAmount"`
	// tradeType indicates whether the trade is an exact input or exact output trade.
	// EXACT_OUTPUT is the default if unspecified.
	TradeType *TradeType `json:"tradeType,omitempty"`
	// onlyNativeGasFee indicates that only the native gas fee (ie. eth)
	// option will be returned, even if the user has no balance.
	// this option is useful for smart wallets which have their own gas abstraction.
	OnlyNativeGasFee bool `json:"onlyNativeGasFee,omitempty"`
	// options for additional auxiliary params
	Options *QuoteIntentRequestOptions `json:"options,omitempty"`
}

QuoteIntentRequest represents a user's request to get a quote for a Trails same-chain or cross-chain intent.

type QuoteIntentRequestOptions

type QuoteIntentRequestOptions struct {
	SwapProvider   RouteProvider `json:"swapProvider,omitempty"`
	BridgeProvider RouteProvider `json:"bridgeProvider,omitempty"`
	// slippageTolerance is a decimal amount, for example
	// 0.001 is 0.1% slippage tolerance. If not specified (null),
	// AUTO mode is used where optimal slippage is calculated dynamically based on transaction USD value + routing provider.
	SlippageTolerance      *float64                `json:"slippageTolerance,omitempty"`
	TrailsAddressOverrides *TrailsAddressOverrides `json:"trailsAddressOverrides,omitempty"`
}

type QuoteIntentResponse

type QuoteIntentResponse struct {
	Intent        *Intent        `json:"intent"`
	GasFeeOptions *GasFeeOptions `json:"gasFeeOptions"`
}

QuoteIntent accepts an intent request from the user/app and returns a fully formed/quoted/solved and executable Intent.

NOTE: we use the IntentRequest directly for the QuoteIntent request type. And do not create a QuoteIntentRequest additional type, as its unnecessary.

type RouteProvider

type RouteProvider string
const (
	RouteProvider_AUTO  RouteProvider = "AUTO"
	RouteProvider_CCTP  RouteProvider = "CCTP"
	RouteProvider_LIFI  RouteProvider = "LIFI"
	RouteProvider_RELAY RouteProvider = "RELAY"
	RouteProvider_SUSHI RouteProvider = "SUSHI"
	RouteProvider_ZEROX RouteProvider = "ZEROX"
)

func (*RouteProvider) Is

func (x *RouteProvider) Is(values ...RouteProvider) bool

func (RouteProvider) MarshalText

func (x RouteProvider) MarshalText() ([]byte, error)

func (*RouteProvider) UnmarshalText

func (x *RouteProvider) UnmarshalText(b []byte) error

type RuntimeStatus

type RuntimeStatus struct {
	// overall status, true/false
	HealthOK   bool             `json:"healthOK"`
	Version    string           `json:"version"`
	Branch     string           `json:"branch"`
	CommitHash string           `json:"commitHash"`
	StartTime  time.Time        `json:"startTime"`
	Uptime     string           `json:"uptime"`
	Hostname   string           `json:"hostname"`
	Runnables  interface{}      `json:"runnables"`
	Services   []*ServiceStatus `json:"services"`
}

type SearchIntentsRequest

type SearchIntentsRequest struct {
	ByIntentID                 prototyp.Hash `json:"byIntentId"`
	ByProjectID                uint64        `json:"byProjectId"`
	ByTransactionHash          prototyp.Hash `json:"byTransactionHash"`
	ByOwnerAddress             prototyp.Hash `json:"byOwnerAddress"`
	ByOriginIntentAddress      prototyp.Hash `json:"byOriginIntentAddress"`
	ByDestinationIntentAddress prototyp.Hash `json:"byDestinationIntentAddress"`
	ByQueryString              string        `json:"byQueryString"`
}

SearchIntents searches past intents based on filters. We do not return 'solved' status intents here, only committed/executed/failed/succeeded.

type SearchIntentsResponse

type SearchIntentsResponse struct {
	// NOTE: we intentionally do not return a page here, and limit it to 10 latest results
	Intents []*Intent `json:"intents"`
}

type ServiceStatus

type ServiceStatus struct {
	Name    string `json:"name"`
	Healthy bool   `json:"healthy"`
	Error   string `json:"error,omitempty"`
	Latency string `json:"latency"`
}

type SortBy

type SortBy struct {
	Column string    `json:"column"`
	Order  SortOrder `json:"order"`
}

type SortOrder

type SortOrder uint32
const (
	SortOrder_DESC SortOrder = 0
	SortOrder_ASC  SortOrder = 1
)

func (*SortOrder) Is

func (x *SortOrder) Is(values ...SortOrder) bool

func (SortOrder) MarshalText

func (x SortOrder) MarshalText() ([]byte, error)

func (SortOrder) String

func (x SortOrder) String() string

func (*SortOrder) UnmarshalText

func (x *SortOrder) UnmarshalText(b []byte) error

type Token

type Token struct {
	ChainID      uint64        `json:"chainId"`
	TokenAddress prototyp.Hash `json:"tokenAddress"`
	TokenSymbol  *string       `json:"tokenSymbol,omitempty"`
}

type TokenInfo

type TokenInfo struct {
	ChainID  uint64        `json:"chainId"`
	Address  prototyp.Hash `json:"address"`
	Name     string        `json:"name"`
	Symbol   string        `json:"symbol"`
	Decimals uint8         `json:"decimals"`
	// supportsBridging indicates whether the chain supports bridging operations
	SupportsBridging bool `json:"supportsBridging,omitempty"`
	// additional metadata
	LogoURI      string `json:"logoUri"`
	Featured     bool   `json:"featured"`
	FeatureIndex int    `json:"-"`
}

type TokenMetadata

type TokenMetadata struct {
	ChainID      uint64        `json:"chainId"`
	TokenAddress prototyp.Hash `json:"tokenAddress"`
	Name         string        `json:"name"`
	Symbol       string        `json:"symbol"`
	Decimals     *uint8        `json:"decimals,omitempty"`
	LogoURI      string        `json:"logoUri,omitempty"`
}

type TokenPrice

type TokenPrice struct {
	Token    *Token   `json:"token"`
	PriceUSD *float64 `json:"priceUsd"`
	// - price?: float64
	// - currency: string
	UpdatedAt time.Time `json:"updatedAt"`
}

type TradeType

type TradeType string
const (
	TradeType_EXACT_INPUT  TradeType = "EXACT_INPUT"
	TradeType_EXACT_OUTPUT TradeType = "EXACT_OUTPUT"
)

func (*TradeType) Is

func (x *TradeType) Is(values ...TradeType) bool

func (TradeType) MarshalText

func (x TradeType) MarshalText() ([]byte, error)

func (*TradeType) UnmarshalText

func (x *TradeType) UnmarshalText(b []byte) error

type TrailsAddressOverrides

type TrailsAddressOverrides struct {
	SequenceWalletFactoryAddress              *string `json:"sequenceWalletFactoryAddress"`
	SequenceWalletMainModuleAddress           *string `json:"sequenceWalletMainModuleAddress"`
	SequenceWalletMainModuleUpgradableAddress *string `json:"sequenceWalletMainModuleUpgradableAddress"`
	SequenceWalletGuestModuleAddress          *string `json:"sequenceWalletGuestModuleAddress"`
	SequenceWalletUtilsAddress                *string `json:"sequenceWalletUtilsAddress"`
}

type TrailsClient

type TrailsClient interface {
	Ping(ctx context.Context) (string, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	Clock(ctx context.Context) (time.Time, error)
	QuoteIntent(ctx context.Context, quoteIntentRequest QuoteIntentRequest) (*QuoteIntentResponse, error)
	CommitIntent(ctx context.Context, commitIntentRequest CommitIntentRequest) (*CommitIntentResponse, error)
	ExecuteIntent(ctx context.Context, executeIntentRequest ExecuteIntentRequest) (*ExecuteIntentResponse, error)
	WaitIntentReceipt(ctx context.Context, waitIntentReceiptRequest WaitIntentReceiptRequest) (*WaitIntentReceiptResponse, error)
	GetIntentReceipt(ctx context.Context, getIntentReceiptRequest GetIntentReceiptRequest) (*GetIntentReceiptResponse, error)
	GetIntent(ctx context.Context, getIntentRequest GetIntentRequest) (*GetIntentResponse, error)
	SearchIntents(ctx context.Context, searchIntentsRequest SearchIntentsRequest) (*SearchIntentsResponse, error)
	GetIntentHistory(ctx context.Context, getIntentHistoryRequest GetIntentHistoryRequest) (*GetIntentHistoryResponse, error)
	AbortIntent(ctx context.Context, abortIntentRequest AbortIntentRequest) (*AbortIntentResponse, error)
	// GetChains will return the list of supported chains by Trails.
	GetChains(ctx context.Context, getChainsRequest GetChainsRequest) (*GetChainsResponse, error)
	// GetExactOutputRoutes will return a list of origin tokens, when given a destination chain and token,
	// that can be used to pay/send from an origin chain the exact output amount on the
	// destination chain.
	//
	// The request will include the destination chain and token desired. Optionally, the
	// user can specify an origin chain and token to filter results to only that specific
	// origin token. Additionally, an optional owner address can be provided to filter
	// results to only tokens the owner has a balance on (requires indexer gateway to be
	// configured).
	//
	// The response is a list of origin tokens and their chains which can be used to fulfill
	// the exact output request. These are tokens the user can send FROM to achieve the desired
	// destination token amount.
	//
	// aka, the 'pay' routes
	GetExactOutputRoutes(ctx context.Context, getExactOutputRoutesRequest GetExactOutputRoutesRequest) (*GetExactOutputRoutesResponse, error)
	// GetExactInputRoutes will return a list of destination tokens, when given an origin chain and token,
	// that can be used to send/swap to a destination chain and token.
	//
	// The request will include the origin chain and token used for input. Optionally, the
	// user can specify a destination chain and token to further filter the results.
	//
	// The response is a list of destination tokens and their chains which can be reached from
	// the origin token and chain. These are tokens the user can send TO from the given origin token.
	//
	// aka, the 'swap' routes
	GetExactInputRoutes(ctx context.Context, getExactInputRoutesRequest GetExactInputRoutesRequest) (*GetExactInputRoutesResponse, error)
	// GetTokenList will return a list of tokens based on the provided filters.
	// NOTE: there are many filters and options on GetTokenListRequest
	GetTokenList(ctx context.Context, getTokenListRequest GetTokenListRequest) (*GetTokenListResponse, error)
	// GetTokenPrices will return the live prices for a list of tokens.
	GetTokenPrices(ctx context.Context, getTokenPricesRequest GetTokenPricesRequest) (*GetTokenPricesResponse, error)
	// GetTrailsContracts returns Trails contract addresses used by the Trails Intents stack.
	GetTrailsContracts(ctx context.Context) (*TrailsContracts, error)
	// Deprecated: please use GetIntentHistory instead
	GetIntentTransactionHistory(ctx context.Context, getIntentTransactionHistoryRequest GetIntentTransactionHistoryRequest) (*GetIntentTransactionHistoryResponse, error)
}

func NewClient

func NewClient(clientOptions ...Options) TrailsClient

NewClient creates a new Trails API client instance. Please see https://sequence.build to get a `projectAccessKey`, which is your project's access key used to communicate with Sequence services.

NOTE: the `projectAccessKey` may be optional if you're using a JWT auth token passed in via the `clientOptions`.

func NewTrailsClient

func NewTrailsClient(addr string, client HTTPClient) TrailsClient

type TrailsContracts

type TrailsContracts struct {
	TrailsIntentEntrypointAddress prototyp.Hash `json:"trailsIntentEntrypointAddress"`
	TrailsRouterAddress           prototyp.Hash `json:"trailsRouterAddress"`
	TrailsRouterShimAddress       prototyp.Hash `json:"trailsRouterShimAddress"`
}

type TransactionCall

type TransactionCall struct {
	To              prototyp.Hash   `json:"to"`
	Value           prototyp.BigInt `json:"value"`
	Data            prototyp.Hash   `json:"data"`
	GasLimit        prototyp.BigInt `json:"gasLimit"`
	DelegateCall    *bool           `json:"delegateCall"`
	OnlyFallback    *bool           `json:"onlyFallback"`
	BehaviorOnError *uint8          `json:"behaviorOnError"`
}

type TransactionContext

type TransactionContext uint8
const (
	TransactionContext_NONE TransactionContext = 0
	// Relays Circle's attested CCTP burn message to destination chain, verifying attestation and minting USDC.
	TransactionContext_CCTPV2_MESSAGE TransactionContext = 1
)

func (*TransactionContext) Is

func (x *TransactionContext) Is(values ...TransactionContext) bool

func (TransactionContext) MarshalText

func (x TransactionContext) MarshalText() ([]byte, error)

func (TransactionContext) String

func (x TransactionContext) String() string

func (*TransactionContext) UnmarshalText

func (x *TransactionContext) UnmarshalText(b []byte) error

type TransactionPrecondition

type TransactionPrecondition struct {
	// value must be 'tokenMinBalance' or ”
	Type         string          `json:"type"`
	ChainID      uint64          `json:"chainId"`
	OwnerAddress prototyp.Hash   `json:"ownerAddress"`
	TokenAddress prototyp.Hash   `json:"tokenAddress"`
	MinAmount    prototyp.BigInt `json:"minAmount"`
}

TransactionPrecondition preconditions based on https://eips.ethereum.org/EIPS/eip-7795 NOTE: make sure this struct type matches the relayer TransactionPrecondition type.

type TransactionStatus

type TransactionStatus uint8
const (
	TransactionStatus_UNKNOWN TransactionStatus = 0
	// on hold, ie. waiting for bridge (off-chain burn attestation)
	TransactionStatus_ON_HOLD TransactionStatus = 1
	// ready to be dequeued & sent by the worker
	TransactionStatus_PENDING TransactionStatus = 2
	// worker: sending to Relayer
	TransactionStatus_RELAYING TransactionStatus = 3
	// sent to the blockchain, whether direct, or via Relayer
	TransactionStatus_SENT TransactionStatus = 4
	// encountered error during sending (will be retried)
	TransactionStatus_ERRORED TransactionStatus = 5
	// worker: waiting for receipt
	TransactionStatus_MINING TransactionStatus = 6
	// terminal state: txn is mined onchain with success status
	TransactionStatus_SUCCEEDED TransactionStatus = 7
	// terminal state: txn is mined onchain with failure status
	TransactionStatus_FAILED TransactionStatus = 8
	// terminal state: aborted at one of the stages, and never completed onchain txn
	TransactionStatus_ABORTED TransactionStatus = 9
)

func (*TransactionStatus) Is

func (x *TransactionStatus) Is(values ...TransactionStatus) bool

func (TransactionStatus) MarshalText

func (x TransactionStatus) MarshalText() ([]byte, error)

func (TransactionStatus) String

func (x TransactionStatus) String() string

func (*TransactionStatus) UnmarshalText

func (x *TransactionStatus) UnmarshalText(b []byte) error

type TransactionType

type TransactionType uint8
const (
	TransactionType_UNKNOWN TransactionType = 0
	// Initial token transfer from owner to origin intent address on origin chain, funding the intent execution.
	TransactionType_DEPOSIT TransactionType = 1
	// Origin chain transaction executing intent's origin calls (swaps, bridge preparation, token transfers).
	TransactionType_ORIGIN TransactionType = 2
	// Destination chain transaction executing intent's destination calls (receiving bridged tokens, final swaps/transfers).
	TransactionType_DESTINATION TransactionType = 3
	// Route provider transaction, see TransactionContext for more details.
	TransactionType_ROUTE TransactionType = 4
)

func (*TransactionType) Is

func (x *TransactionType) Is(values ...TransactionType) bool

func (TransactionType) MarshalText

func (x TransactionType) MarshalText() ([]byte, error)

func (TransactionType) String

func (x TransactionType) String() string

func (*TransactionType) UnmarshalText

func (x *TransactionType) UnmarshalText(b []byte) error

type WaitIntentReceiptRequest

type WaitIntentReceiptRequest struct {
	IntentID prototyp.Hash `json:"intentId"`
	// lastReceiptStates is the previously returned status array from a prior
	// WaitIntentReceipt call. This allows the server to only return
	// updates since the last call, allowing for more efficient polling.
	LastReceiptStates []TransactionStatus `json:"lastReceiptStates"`
}

WaitIntentReceipt will block until the intent reaches a terminal status or timeout.

type WaitIntentReceiptResponse

type WaitIntentReceiptResponse struct {
	IntentReceipt *IntentReceipt `json:"intentReceipt"`
	// receiptStates is an array of key statuses within the intentReceipt object
	// for all sub intent transactions.this can be passed back to subsequent
	// WaitIntentReceipt calls to as a form of a stateless cursor to only
	// get updates since last call.
	ReceiptStates []TransactionStatus `json:"receiptStates"`
	// done flag informs a client whether the wait completed successfully (true) or timed out (false).
	// as the clients will keep polling until done is true. NOTE: done does not indicate success,
	// it just indicates the execution is done, to check status see intentReceipt.status.
	Done bool `json:"done"`
}

type WebRPCError

type WebRPCError struct {
	Name       string `json:"error"`
	Code       int    `json:"code"`
	Message    string `json:"msg"`
	Cause      string `json:"cause,omitempty"`
	HTTPStatus int    `json:"status"`
	// contains filtered or unexported fields
}

func ErrorWithCause deprecated

func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError

Deprecated: Use .WithCause() method on WebRPCError.

func (WebRPCError) Error

func (e WebRPCError) Error() string

func (WebRPCError) Is

func (e WebRPCError) Is(target error) bool

func (WebRPCError) Unwrap

func (e WebRPCError) Unwrap() error

func (WebRPCError) WithCause

func (e WebRPCError) WithCause(cause error) WebRPCError

func (WebRPCError) WithCausef

func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError

type WebrpcGenVersions

type WebrpcGenVersions struct {
	WebrpcGenVersion string
	CodeGenName      string
	CodeGenVersion   string
	SchemaName       string
	SchemaVersion    string
}

func VersionFromHeader

func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error)

Jump to

Keyboard shortcuts

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