From b2754b4294c1dd45ba331b2ed15b264a5a84e526 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Sat, 27 Sep 2025 10:54:49 +0000 Subject: [PATCH 01/79] [AUTOMATED] Update: proto/clients/api.gen.go --- trails-api/api.gen.go | 1124 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1124 insertions(+) create mode 100644 trails-api/api.gen.go diff --git a/trails-api/api.gen.go b/trails-api/api.gen.go new file mode 100644 index 00000000..59538c98 --- /dev/null +++ b/trails-api/api.gen.go @@ -0,0 +1,1124 @@ +// trails-api v0.4.0 28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3 +// -- +// Code generated by webrpc-gen@v0.25.3 with golang generator. DO NOT EDIT. +// +// webrpc-gen -schema=api.ridl -target=golang -pkg=api -client -out=./clients/api.gen.go +package api + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" + + "github.com/0xsequence/go-sequence/lib/prototyp" +) + +const WebrpcHeader = "Webrpc" + +const WebrpcHeaderValue = "webrpc@v0.25.3;gen-golang@v0.18.4;trails-api@v0.4.0" + +// WebRPC description and code-gen version +func WebRPCVersion() string { + return "v1" +} + +// Schema version of your RIDL schema +func WebRPCSchemaVersion() string { + return "v0.4.0" +} + +// Schema hash generated from your RIDL schema +func WebRPCSchemaHash() string { + return "28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3" +} + +type WebrpcGenVersions struct { + WebrpcGenVersion string + CodeGenName string + CodeGenVersion string + SchemaName string + SchemaVersion string +} + +func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error) { + if h.Get(WebrpcHeader) == "" { + return nil, fmt.Errorf("header is empty or missing") + } + + versions, err := parseWebrpcGenVersions(h.Get(WebrpcHeader)) + if err != nil { + return nil, fmt.Errorf("webrpc header is invalid: %w", err) + } + + return versions, nil +} + +func parseWebrpcGenVersions(header string) (*WebrpcGenVersions, error) { + versions := strings.Split(header, ";") + if len(versions) < 3 { + return nil, fmt.Errorf("expected at least 3 parts while parsing webrpc header: %v", header) + } + + _, webrpcGenVersion, ok := strings.Cut(versions[0], "@") + if !ok { + return nil, fmt.Errorf("webrpc gen version could not be parsed from: %s", versions[0]) + } + + tmplTarget, tmplVersion, ok := strings.Cut(versions[1], "@") + if !ok { + return nil, fmt.Errorf("tmplTarget and tmplVersion could not be parsed from: %s", versions[1]) + } + + schemaName, schemaVersion, ok := strings.Cut(versions[2], "@") + if !ok { + return nil, fmt.Errorf("schema name and schema version could not be parsed from: %s", versions[2]) + } + + return &WebrpcGenVersions{ + WebrpcGenVersion: webrpcGenVersion, + CodeGenName: tmplTarget, + CodeGenVersion: tmplVersion, + SchemaName: schemaName, + SchemaVersion: schemaVersion, + }, nil +} + +// +// Common types +// + +type TradeType string + +const ( + TradeType_EXACT_INPUT TradeType = "EXACT_INPUT" + TradeType_EXACT_OUTPUT TradeType = "EXACT_OUTPUT" +) + +func (x TradeType) MarshalText() ([]byte, error) { + return []byte(x), nil +} + +func (x *TradeType) UnmarshalText(b []byte) error { + *x = TradeType(string(b)) + return nil +} + +func (x *TradeType) Is(values ...TradeType) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +type SortOrder uint32 + +const ( + SortOrder_DESC SortOrder = 0 + SortOrder_ASC SortOrder = 1 +) + +var SortOrder_name = map[uint32]string{ + 0: "DESC", + 1: "ASC", +} + +var SortOrder_value = map[string]uint32{ + "DESC": 0, + "ASC": 1, +} + +func (x SortOrder) String() string { + return SortOrder_name[uint32(x)] +} + +func (x SortOrder) MarshalText() ([]byte, error) { + return []byte(SortOrder_name[uint32(x)]), nil +} + +func (x *SortOrder) UnmarshalText(b []byte) error { + *x = SortOrder(SortOrder_value[string(b)]) + return nil +} + +func (x *SortOrder) Is(values ...SortOrder) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +type Version struct { + WebrpcVersion string `json:"webrpcVersion"` + SchemaVersion string `json:"schemaVersion"` + SchemaHash string `json:"schemaHash"` + AppVersion string `json:"appVersion"` +} + +type RuntimeStatus struct { + // overall status, true/false + HealthOK bool `json:"healthOK"` + StartTime time.Time `json:"startTime"` + Uptime uint64 `json:"uptime"` + Ver string `json:"ver"` + Branch string `json:"branch"` + CommitHash string `json:"commitHash"` + Checks *RuntimeChecks `json:"checks"` + NumTxnsRelayed map[string]*NumTxnsRelayed `json:"numTxnsRelayed"` +} + +type NumTxnsRelayed struct { + ChainID uint64 `json:"chainID"` + Prev uint64 `json:"prev"` + Current uint64 `json:"current"` + Period uint64 `json:"period"` +} + +type RuntimeChecks struct { +} + +// From: `0xsequence/relayer`: https://github.com/0xsequence/relayer/blob/2c695b820970c68c57bfe71810f469412cdec675/proto/relayer.ridl#L502 +// TODO: rename this to MetaTxnRaw (eventually), we can leave it for now to not break compat +// or name it, MetaTxnArgs ..? +type MetaTxn struct { + ID string `json:"id"` + ChainId prototyp.BigInt `json:"chainId"` + WalletAddress string `json:"walletAddress" db:"wallet_address"` + // TODO (later): rename this to `to: string` + Contract string `json:"contract" db:"to_address"` + // TODO: rename to 'execdata' + Input string `json:"input" db:"tx_data"` +} + +type Call 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 IntentCallsPayload struct { + ChainId prototyp.BigInt `json:"chainId"` + Space prototyp.BigInt `json:"space"` + Nonce prototyp.BigInt `json:"nonce"` + Calls []*Call `json:"calls"` +} + +// IntentConfig +type IntentConfig struct { + ID uint64 `json:"id" db:"id,omitempty"` + ConfigHash prototyp.Hash `json:"configHash" db:"config_hash"` + OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` + DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"destination_intent_address"` + MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` + Calls prototyp.JSONString `json:"calls" db:"calls"` + Preconditions prototyp.JSONString `json:"preconditions" db:"preconditions"` + ExecutionStatus *string `json:"executionStatus" db:"execution_status,omitempty"` + MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` + TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` +} + +type AddressOverrides struct { + TrailsLiFiSapientSignerAddress *string `json:"trailsLiFiSapientSignerAddress"` + TrailsRelaySapientSignerAddress *string `json:"trailsRelaySapientSignerAddress"` + TrailsCCTPV2SapientSignerAddress *string `json:"trailsCCTPV2SapientSignerAddress"` +} + +type TakerFee struct { + Address prototyp.Hash `json:"address"` + Bps uint64 `json:"bps"` +} + +type IntentPrecondition struct { + Type string `json:"type"` + ChainId prototyp.BigInt `json:"chainId"` + Data interface{} `json:"data"` +} + +type Token struct { + ChainId uint64 `json:"chainId"` + ContractAddress prototyp.Hash `json:"contractAddress"` + TokenId *string `json:"tokenId"` +} + +type Price struct { + Value float64 `json:"value"` + Currency string `json:"currency"` +} + +type TokenPrice struct { + Token *Token `json:"token"` + Price *Price `json:"price"` + Price24hChange *Price `json:"price24hChange"` + Price24hVol *Price `json:"price24hVol"` + FloorPrice *Price `json:"floorPrice,omitempty"` + BuyPrice *Price `json:"buyPrice,omitempty"` + SellPrice *Price `json:"sellPrice,omitempty"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +type ExchangeRate struct { + Name string `json:"name"` + Symbol string `json:"symbol"` + Value float64 `json:"value"` + VsCurrency string `json:"vsCurrency"` + CurrencyType string `json:"currencyType"` +} + +// TOOD: refactor, we should be returning a cursor always.. +// see indexer/indexer.ridl Page object.. +// +// --- +// +// Page represents a results page. This can be used both to request a page and +// to store the state of a page. +type Page struct { + // Common for both numbered pages and cursor: Number of items per page + // TODO: REMOVE.. + PageSize *uint32 `json:"pageSize"` + // Numbered pages: Page number, this is multiplied by the value of the parameter. + // TODO: REMOVE.. + Page *uint32 `json:"page"` + // Number of total items on this query. + // TODO: REMOVE.. + TotalRecords *uint64 `json:"totalRecords"` + // Cursor: column to compare before/after to + Column *string `json:"column"` + // Cursor: return column < before - include to get previous page + Before *interface{} `json:"before"` + // Cursor: return column > after - include to get next page + After *interface{} `json:"after"` + // Sorting filter + Sort []*SortBy `json:"sort"` + // Indicates if there are more results available + More *bool `json:"more,omitempty"` +} + +type SortBy struct { + Column string `json:"column"` + Order SortOrder `json:"order"` +} + +type CCTPTransfer struct { + ID string `json:"id"` + SourceTxHash string `json:"sourceTxHash"` + SourceChainID uint64 `json:"sourceChainId"` + DestinationChainID uint64 `json:"destinationChainId"` + Message string `json:"message"` + Attestation string `json:"attestation"` + Status string `json:"status"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` +} + +type CrossChainFee struct { + ProviderFee prototyp.BigInt `json:"providerFee"` + TrailsSwapFee prototyp.BigInt `json:"trailsSwapFee"` + ProviderFeeUSD float64 `json:"providerFeeUSD"` + TrailsSwapFeeUSD float64 `json:"trailsSwapFeeUSD"` + TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` + TotalFeeUSD float64 `json:"totalFeeUSD"` +} + +type MetaTxnFeeDetail struct { + MetaTxnID string `json:"metaTxnID"` + EstimatedGasLimit prototyp.BigInt `json:"estimatedGasLimit"` + FeeNative prototyp.BigInt `json:"feeNative"` +} + +type ChainExecuteQuote struct { + ChainId prototyp.BigInt `json:"chainId"` + TotalGasLimit prototyp.BigInt `json:"totalGasLimit"` + GasPrice prototyp.BigInt `json:"gasPrice"` + TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` + NativeTokenSymbol string `json:"nativeTokenSymbol"` + NativeTokenPrice float64 `json:"nativeTokenPrice"` + MetaTxnFeeDetails []*MetaTxnFeeDetail `json:"metaTxnFeeDetails"` + TotalFeeUSD float64 `json:"totalFeeUSD"` +} + +type ExecuteQuote struct { + ChainQuotes []*ChainExecuteQuote `json:"chainQuotes"` +} + +type TrailsFee struct { + ExecuteQuote *ExecuteQuote `json:"executeQuote"` + CrossChainFee *CrossChainFee `json:"crossChainFee"` + TakerFeeAmount prototyp.BigInt `json:"takerFeeAmount"` + TakerFeeUSD *float64 `json:"takerFeeUSD"` + TrailsFixedFeeUSD float64 `json:"trailsFixedFeeUSD"` + FeeToken prototyp.Hash `json:"feeToken"` + OriginTokenTotalAmount prototyp.BigInt `json:"originTokenTotalAmount"` + TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` + TotalFeeUSD float64 `json:"totalFeeUSD"` + QuoteProvider *string `json:"quoteProvider"` +} + +type IntentQuote struct { + FromAmount prototyp.BigInt `json:"fromAmount"` + FromAmountMin prototyp.BigInt `json:"fromAmountMin"` + ToAmount prototyp.BigInt `json:"toAmount"` + ToAmountMin prototyp.BigInt `json:"toAmountMin"` + PriceImpact float64 `json:"priceImpact"` + PriceImpactUsd string `json:"priceImpactUsd"` + MaxSlippage float64 `json:"maxSlippage"` + QuoteProvider string `json:"quoteProvider"` + QuoteProviderRequestId string `json:"quoteProviderRequestId"` + QuoteProviderFeeUsd string `json:"quoteProviderFeeUsd"` + FeeQuotes map[string]string `json:"feeQuotes"` +} + +var methods = map[string]method{ + "/rpc/API/Ping": { + Name: "Ping", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/Version": { + Name: "Version", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/RuntimeStatus": { + Name: "RuntimeStatus", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/Clock": { + Name: "Clock", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/GetIntentCallsPayloads": { + Name: "GetIntentCallsPayloads", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/CommitIntentConfig": { + Name: "CommitIntentConfig", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/GetIntentConfig": { + Name: "GetIntentConfig", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/GetCCTPTransfer": { + Name: "GetCCTPTransfer", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/QueueCCTPTransfer": { + Name: "QueueCCTPTransfer", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/QueueIntentConfigExecution": { + Name: "QueueIntentConfigExecution", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/GetIntentConfigExecutionStatus": { + Name: "GetIntentConfigExecutionStatus", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/ListIntentConfigs": { + Name: "ListIntentConfigs", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/QueueMetaTxnReceipt": { + Name: "QueueMetaTxnReceipt", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, +} + +func WebrpcMethods() map[string]method { + res := make(map[string]method, len(methods)) + for k, v := range methods { + res[k] = v + } + + return res +} + +var WebRPCServices = map[string][]string{ + "API": { + "Ping", + "Version", + "RuntimeStatus", + "Clock", + "GetIntentCallsPayloads", + "CommitIntentConfig", + "GetIntentConfig", + "GetCCTPTransfer", + "QueueCCTPTransfer", + "QueueIntentConfigExecution", + "GetIntentConfigExecutionStatus", + "ListIntentConfigs", + "QueueMetaTxnReceipt", + }, +} + +// +// Server types +// + +type API interface { + // + // Runtime + // + Ping(ctx context.Context) (bool, error) + Version(ctx context.Context) (*Version, error) + RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) + Clock(ctx context.Context) (time.Time, error) + // + // Chain abstraction + // + GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // + // CCTP + // + GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) + QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) + // + // Intent Machine Worker + // + QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) + QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) +} + +// +// Client types +// + +type APIClient interface { + // + // Runtime + // + Ping(ctx context.Context) (bool, error) + Version(ctx context.Context) (*Version, error) + RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) + Clock(ctx context.Context) (time.Time, error) + // + // Chain abstraction + // + GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // + // CCTP + // + GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) + QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) + // + // Intent Machine Worker + // + QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) + QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) +} + +// +// Client +// + +const APIPathPrefix = "/rpc/API/" + +type aPIClient struct { + client HTTPClient + urls [13]string +} + +func NewAPIClient(addr string, client HTTPClient) APIClient { + prefix := urlBase(addr) + APIPathPrefix + urls := [13]string{ + prefix + "Ping", + prefix + "Version", + prefix + "RuntimeStatus", + prefix + "Clock", + prefix + "GetIntentCallsPayloads", + prefix + "CommitIntentConfig", + prefix + "GetIntentConfig", + prefix + "GetCCTPTransfer", + prefix + "QueueCCTPTransfer", + prefix + "QueueIntentConfigExecution", + prefix + "GetIntentConfigExecutionStatus", + prefix + "ListIntentConfigs", + prefix + "QueueMetaTxnReceipt", + } + return &aPIClient{ + client: client, + urls: urls, + } +} + +func (c *aPIClient) Ping(ctx context.Context) (bool, error) { + out := struct { + Ret0 bool `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[0], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) Version(ctx context.Context) (*Version, error) { + out := struct { + Ret0 *Version `json:"version"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[1], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { + out := struct { + Ret0 *RuntimeStatus `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[2], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) Clock(ctx context.Context) (time.Time, error) { + out := struct { + Ret0 time.Time `json:"serverTime"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[3], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) { + in := struct { + Arg0 string `json:"userAddress"` + Arg1 uint64 `json:"destinationChainId"` + Arg2 string `json:"destinationTokenAddress"` + Arg3 string `json:"destinationTokenAmount"` + Arg4 string `json:"destinationToAddress"` + Arg5 uint64 `json:"originChainId"` + Arg6 string `json:"originTokenAddress"` + Arg7 string `json:"originTokenAmount"` + Arg8 *string `json:"destinationCallData"` + Arg9 *string `json:"destinationCallValue"` + Arg10 *string `json:"provider"` + Arg11 *AddressOverrides `json:"addressOverrides"` + Arg12 *string `json:"destinationSalt"` + Arg13 *TakerFee `json:"takerFee"` + Arg14 *float64 `json:"slippageTolerance"` + Arg15 *TradeType `json:"tradeType"` + }{userAddress, destinationChainId, destinationTokenAddress, destinationTokenAmount, destinationToAddress, originChainId, originTokenAddress, originTokenAmount, destinationCallData, destinationCallValue, provider, addressOverrides, destinationSalt, takerFee, slippageTolerance, tradeType} + out := struct { + Ret0 []*IntentCallsPayload `json:"calls"` + Ret1 []*IntentPrecondition `json:"preconditions"` + Ret2 []*MetaTxn `json:"metaTxns"` + Ret3 *TrailsFee `json:"trailsFee"` + Ret4 *IntentQuote `json:"quote"` + Ret5 map[string]string `json:"feeQuotes"` + Ret6 string `json:"originIntentAddress"` + Ret7 string `json:"destinationIntentAddress"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, out.Ret1, out.Ret2, out.Ret3, out.Ret4, out.Ret5, out.Ret6, out.Ret7, err +} + +func (c *aPIClient) CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) { + in := struct { + Arg0 string `json:"originIntentAddress"` + Arg1 string `json:"destinationIntentAddress"` + Arg2 string `json:"mainSigner"` + Arg3 []*IntentCallsPayload `json:"calls"` + Arg4 []*IntentPrecondition `json:"preconditions"` + Arg5 *AddressOverrides `json:"addressOverrides"` + }{originIntentAddress, destinationIntentAddress, mainSigner, calls, preconditions, addressOverrides} + out := struct { + Ret0 *IntentConfig `json:"config"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) { + in := struct { + Arg0 string `json:"intentAddress"` + }{intentAddress} + out := struct { + Ret0 *IntentConfig `json:"config"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) { + in := struct { + Arg0 string `json:"id"` + }{id} + out := struct { + Ret0 *CCTPTransfer `json:"transfer"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) { + in := struct { + Arg0 *string `json:"sourceTxHash"` + Arg1 *string `json:"metaTxHash"` + Arg2 uint64 `json:"sourceChainId"` + Arg3 uint64 `json:"destinationChainId"` + }{sourceTxHash, metaTxHash, sourceChainId, destinationChainId} + out := struct { + Ret0 *CCTPTransfer `json:"transfer"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) { + in := struct { + Arg0 uint64 `json:"intentConfigId"` + }{intentConfigId} + out := struct { + Ret0 bool `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) { + in := struct { + Arg0 uint64 `json:"intentConfigId"` + }{intentConfigId} + out := struct { + Ret0 string `json:"executionStatus"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) { + in := struct { + Arg0 *Page `json:"page"` + Arg1 *string `json:"executionStatus"` + }{page, executionStatus} + out := struct { + Ret0 *Page `json:"page"` + Ret1 []*IntentConfig `json:"intentConfigs"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, out.Ret1, err +} + +func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) { + in := struct { + Arg0 string `json:"metaTxID"` + }{metaTxID} + out := struct { + Ret0 bool `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +// 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 HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +// urlBase helps ensure that addr specifies a scheme. If it is unparsable +// as a URL, it returns addr unchanged. +func urlBase(addr string) string { + // If the addr specifies a scheme, use it. If not, default to + // http. If url.Parse fails on it, return it unchanged. + url, err := url.Parse(addr) + if err != nil { + return addr + } + if url.Scheme == "" { + url.Scheme = "http" + } + return url.String() +} + +// newRequest makes an http.Request from a client, adding common headers. +func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { + req, err := http.NewRequestWithContext(ctx, "POST", url, reqBody) + if err != nil { + return nil, err + } + req.Header.Set("Accept", contentType) + req.Header.Set("Content-Type", contentType) + req.Header.Set(WebrpcHeader, WebrpcHeaderValue) + if headers, ok := HTTPRequestHeaders(ctx); ok { + for k := range headers { + for _, v := range headers[k] { + req.Header.Add(k, v) + } + } + } + return req, nil +} + +// doHTTPRequest is common code to make a request to the remote service. +func doHTTPRequest(ctx context.Context, client HTTPClient, url string, in, out interface{}) (*http.Response, error) { + reqBody, err := json.Marshal(in) + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCausef("failed to marshal JSON body: %w", err) + } + if err = ctx.Err(); err != nil { + return nil, ErrWebrpcRequestFailed.WithCausef("aborted because context was done: %w", err) + } + + req, err := newRequest(ctx, url, bytes.NewBuffer(reqBody), "application/json") + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCausef("could not build request: %w", err) + } + + resp, err := client.Do(req) + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCause(err) + } + + if resp.StatusCode != 200 { + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to read server error response body: %w", err) + } + + var rpcErr WebRPCError + if err := json.Unmarshal(respBody, &rpcErr); err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to unmarshal server error: %w", err) + } + if rpcErr.Cause != "" { + rpcErr.cause = errors.New(rpcErr.Cause) + } + return nil, rpcErr + } + + if out != nil { + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to read response body: %w", err) + } + + err = json.Unmarshal(respBody, &out) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to unmarshal JSON response body: %w", err) + } + } + + return resp, nil +} + +func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error) { + if _, ok := h["Accept"]; ok { + return nil, errors.New("provided header cannot set Accept") + } + if _, ok := h["Content-Type"]; ok { + return nil, errors.New("provided header cannot set Content-Type") + } + + copied := make(http.Header, len(h)) + for k, vv := range h { + if vv == nil { + copied[k] = nil + continue + } + copied[k] = make([]string, len(vv)) + copy(copied[k], vv) + } + + return context.WithValue(ctx, HTTPClientRequestHeadersCtxKey, copied), nil +} + +func HTTPRequestHeaders(ctx context.Context) (http.Header, bool) { + h, ok := ctx.Value(HTTPClientRequestHeadersCtxKey).(http.Header) + return h, ok +} + +// +// Helpers +// + +type method struct { + Name string + Service string + Annotations map[string]string +} + +type contextKey struct { + name string +} + +func (k *contextKey) String() string { + return "webrpc context value " + k.name +} + +var ( + HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} + HTTPRequestCtxKey = &contextKey{"HTTPRequest"} + + ServiceNameCtxKey = &contextKey{"ServiceName"} + + MethodNameCtxKey = &contextKey{"MethodName"} +) + +func ServiceNameFromContext(ctx context.Context) string { + service, _ := ctx.Value(ServiceNameCtxKey).(string) + return service +} + +func MethodNameFromContext(ctx context.Context) string { + method, _ := ctx.Value(MethodNameCtxKey).(string) + return method +} + +func RequestFromContext(ctx context.Context) *http.Request { + r, _ := ctx.Value(HTTPRequestCtxKey).(*http.Request) + return r +} + +func MethodCtx(ctx context.Context) (method, bool) { + req := RequestFromContext(ctx) + if req == nil { + return method{}, false + } + + m, ok := methods[req.URL.Path] + if !ok { + return method{}, false + } + + return m, true +} + +// +// Errors +// + +type WebRPCError struct { + Name string `json:"error"` + Code int `json:"code"` + Message string `json:"msg"` + Cause string `json:"cause,omitempty"` + HTTPStatus int `json:"status"` + cause error +} + +var _ error = WebRPCError{} + +func (e WebRPCError) Error() string { + if e.cause != nil { + return fmt.Sprintf("%s %d: %s: %v", e.Name, e.Code, e.Message, e.cause) + } + return fmt.Sprintf("%s %d: %s", e.Name, e.Code, e.Message) +} + +func (e WebRPCError) Is(target error) bool { + if target == nil { + return false + } + if rpcErr, ok := target.(WebRPCError); ok { + return rpcErr.Code == e.Code + } + return errors.Is(e.cause, target) +} + +func (e WebRPCError) Unwrap() error { + return e.cause +} + +func (e WebRPCError) WithCause(cause error) WebRPCError { + err := e + err.cause = cause + err.Cause = cause.Error() + return err +} + +func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError { + cause := fmt.Errorf(format, args...) + err := e + err.cause = cause + err.Cause = cause.Error() + return err +} + +// Deprecated: Use .WithCause() method on WebRPCError. +func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError { + return rpcErr.WithCause(cause) +} + +// Webrpc errors +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} + ErrWebrpcClientDisconnected = WebRPCError{Code: -8, Name: "WebrpcClientDisconnected", Message: "client disconnected", HTTPStatus: 400} + ErrWebrpcStreamLost = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400} + ErrWebrpcStreamFinished = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200} +) + +// Schema errors +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} + ErrUnavailable = WebRPCError{Code: 2002, Name: "Unavailable", Message: "Unavailable resource", HTTPStatus: 400} + ErrQueryFailed = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400} + ErrNotFound = WebRPCError{Code: 8000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400} + ErrUnsupportedNetwork = WebRPCError{Code: 8008, Name: "UnsupportedNetwork", Message: "Unsupported network", HTTPStatus: 422} +) From ec108822679483c1d2913c6c33c95f95d2bf34c1 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Tue, 30 Sep 2025 16:39:36 +0000 Subject: [PATCH 02/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 1124 ++++++++++++++++++++++++++++++++++ 1 file changed, 1124 insertions(+) create mode 100644 trails-api/trails-api.gen.go diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go new file mode 100644 index 00000000..30229109 --- /dev/null +++ b/trails-api/trails-api.gen.go @@ -0,0 +1,1124 @@ +// trails-api v0.4.0 28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3 +// -- +// Code generated by webrpc-gen@v0.25.3 with golang generator. DO NOT EDIT. +// +// webrpc-gen -schema=api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go +package api + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" + + "github.com/0xsequence/go-sequence/lib/prototyp" +) + +const WebrpcHeader = "Webrpc" + +const WebrpcHeaderValue = "webrpc@v0.25.3;gen-golang@v0.18.4;trails-api@v0.4.0" + +// WebRPC description and code-gen version +func WebRPCVersion() string { + return "v1" +} + +// Schema version of your RIDL schema +func WebRPCSchemaVersion() string { + return "v0.4.0" +} + +// Schema hash generated from your RIDL schema +func WebRPCSchemaHash() string { + return "28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3" +} + +type WebrpcGenVersions struct { + WebrpcGenVersion string + CodeGenName string + CodeGenVersion string + SchemaName string + SchemaVersion string +} + +func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error) { + if h.Get(WebrpcHeader) == "" { + return nil, fmt.Errorf("header is empty or missing") + } + + versions, err := parseWebrpcGenVersions(h.Get(WebrpcHeader)) + if err != nil { + return nil, fmt.Errorf("webrpc header is invalid: %w", err) + } + + return versions, nil +} + +func parseWebrpcGenVersions(header string) (*WebrpcGenVersions, error) { + versions := strings.Split(header, ";") + if len(versions) < 3 { + return nil, fmt.Errorf("expected at least 3 parts while parsing webrpc header: %v", header) + } + + _, webrpcGenVersion, ok := strings.Cut(versions[0], "@") + if !ok { + return nil, fmt.Errorf("webrpc gen version could not be parsed from: %s", versions[0]) + } + + tmplTarget, tmplVersion, ok := strings.Cut(versions[1], "@") + if !ok { + return nil, fmt.Errorf("tmplTarget and tmplVersion could not be parsed from: %s", versions[1]) + } + + schemaName, schemaVersion, ok := strings.Cut(versions[2], "@") + if !ok { + return nil, fmt.Errorf("schema name and schema version could not be parsed from: %s", versions[2]) + } + + return &WebrpcGenVersions{ + WebrpcGenVersion: webrpcGenVersion, + CodeGenName: tmplTarget, + CodeGenVersion: tmplVersion, + SchemaName: schemaName, + SchemaVersion: schemaVersion, + }, nil +} + +// +// Common types +// + +type TradeType string + +const ( + TradeType_EXACT_INPUT TradeType = "EXACT_INPUT" + TradeType_EXACT_OUTPUT TradeType = "EXACT_OUTPUT" +) + +func (x TradeType) MarshalText() ([]byte, error) { + return []byte(x), nil +} + +func (x *TradeType) UnmarshalText(b []byte) error { + *x = TradeType(string(b)) + return nil +} + +func (x *TradeType) Is(values ...TradeType) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +type SortOrder uint32 + +const ( + SortOrder_DESC SortOrder = 0 + SortOrder_ASC SortOrder = 1 +) + +var SortOrder_name = map[uint32]string{ + 0: "DESC", + 1: "ASC", +} + +var SortOrder_value = map[string]uint32{ + "DESC": 0, + "ASC": 1, +} + +func (x SortOrder) String() string { + return SortOrder_name[uint32(x)] +} + +func (x SortOrder) MarshalText() ([]byte, error) { + return []byte(SortOrder_name[uint32(x)]), nil +} + +func (x *SortOrder) UnmarshalText(b []byte) error { + *x = SortOrder(SortOrder_value[string(b)]) + return nil +} + +func (x *SortOrder) Is(values ...SortOrder) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +type Version struct { + WebrpcVersion string `json:"webrpcVersion"` + SchemaVersion string `json:"schemaVersion"` + SchemaHash string `json:"schemaHash"` + AppVersion string `json:"appVersion"` +} + +type RuntimeStatus struct { + // overall status, true/false + HealthOK bool `json:"healthOK"` + StartTime time.Time `json:"startTime"` + Uptime uint64 `json:"uptime"` + Ver string `json:"ver"` + Branch string `json:"branch"` + CommitHash string `json:"commitHash"` + Checks *RuntimeChecks `json:"checks"` + NumTxnsRelayed map[string]*NumTxnsRelayed `json:"numTxnsRelayed"` +} + +type NumTxnsRelayed struct { + ChainID uint64 `json:"chainID"` + Prev uint64 `json:"prev"` + Current uint64 `json:"current"` + Period uint64 `json:"period"` +} + +type RuntimeChecks struct { +} + +// From: `0xsequence/relayer`: https://github.com/0xsequence/relayer/blob/2c695b820970c68c57bfe71810f469412cdec675/proto/relayer.ridl#L502 +// TODO: rename this to MetaTxnRaw (eventually), we can leave it for now to not break compat +// or name it, MetaTxnArgs ..? +type MetaTxn struct { + ID string `json:"id"` + ChainId prototyp.BigInt `json:"chainId"` + WalletAddress string `json:"walletAddress" db:"wallet_address"` + // TODO (later): rename this to `to: string` + Contract string `json:"contract" db:"to_address"` + // TODO: rename to 'execdata' + Input string `json:"input" db:"tx_data"` +} + +type Call 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 IntentCallsPayload struct { + ChainId prototyp.BigInt `json:"chainId"` + Space prototyp.BigInt `json:"space"` + Nonce prototyp.BigInt `json:"nonce"` + Calls []*Call `json:"calls"` +} + +// IntentConfig +type IntentConfig struct { + ID uint64 `json:"id" db:"id,omitempty"` + ConfigHash prototyp.Hash `json:"configHash" db:"config_hash"` + OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` + DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"destination_intent_address"` + MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` + Calls prototyp.JSONString `json:"calls" db:"calls"` + Preconditions prototyp.JSONString `json:"preconditions" db:"preconditions"` + ExecutionStatus *string `json:"executionStatus" db:"execution_status,omitempty"` + MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` + TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` +} + +type AddressOverrides struct { + TrailsLiFiSapientSignerAddress *string `json:"trailsLiFiSapientSignerAddress"` + TrailsRelaySapientSignerAddress *string `json:"trailsRelaySapientSignerAddress"` + TrailsCCTPV2SapientSignerAddress *string `json:"trailsCCTPV2SapientSignerAddress"` +} + +type TakerFee struct { + Address prototyp.Hash `json:"address"` + Bps uint64 `json:"bps"` +} + +type IntentPrecondition struct { + Type string `json:"type"` + ChainId prototyp.BigInt `json:"chainId"` + Data interface{} `json:"data"` +} + +type Token struct { + ChainId uint64 `json:"chainId"` + ContractAddress prototyp.Hash `json:"contractAddress"` + TokenId *string `json:"tokenId"` +} + +type Price struct { + Value float64 `json:"value"` + Currency string `json:"currency"` +} + +type TokenPrice struct { + Token *Token `json:"token"` + Price *Price `json:"price"` + Price24hChange *Price `json:"price24hChange"` + Price24hVol *Price `json:"price24hVol"` + FloorPrice *Price `json:"floorPrice,omitempty"` + BuyPrice *Price `json:"buyPrice,omitempty"` + SellPrice *Price `json:"sellPrice,omitempty"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +type ExchangeRate struct { + Name string `json:"name"` + Symbol string `json:"symbol"` + Value float64 `json:"value"` + VsCurrency string `json:"vsCurrency"` + CurrencyType string `json:"currencyType"` +} + +// TOOD: refactor, we should be returning a cursor always.. +// see indexer/indexer.ridl Page object.. +// +// --- +// +// Page represents a results page. This can be used both to request a page and +// to store the state of a page. +type Page struct { + // Common for both numbered pages and cursor: Number of items per page + // TODO: REMOVE.. + PageSize *uint32 `json:"pageSize"` + // Numbered pages: Page number, this is multiplied by the value of the parameter. + // TODO: REMOVE.. + Page *uint32 `json:"page"` + // Number of total items on this query. + // TODO: REMOVE.. + TotalRecords *uint64 `json:"totalRecords"` + // Cursor: column to compare before/after to + Column *string `json:"column"` + // Cursor: return column < before - include to get previous page + Before *interface{} `json:"before"` + // Cursor: return column > after - include to get next page + After *interface{} `json:"after"` + // Sorting filter + Sort []*SortBy `json:"sort"` + // Indicates if there are more results available + More *bool `json:"more,omitempty"` +} + +type SortBy struct { + Column string `json:"column"` + Order SortOrder `json:"order"` +} + +type CCTPTransfer struct { + ID string `json:"id"` + SourceTxHash string `json:"sourceTxHash"` + SourceChainID uint64 `json:"sourceChainId"` + DestinationChainID uint64 `json:"destinationChainId"` + Message string `json:"message"` + Attestation string `json:"attestation"` + Status string `json:"status"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` +} + +type CrossChainFee struct { + ProviderFee prototyp.BigInt `json:"providerFee"` + TrailsSwapFee prototyp.BigInt `json:"trailsSwapFee"` + ProviderFeeUSD float64 `json:"providerFeeUSD"` + TrailsSwapFeeUSD float64 `json:"trailsSwapFeeUSD"` + TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` + TotalFeeUSD float64 `json:"totalFeeUSD"` +} + +type MetaTxnFeeDetail struct { + MetaTxnID string `json:"metaTxnID"` + EstimatedGasLimit prototyp.BigInt `json:"estimatedGasLimit"` + FeeNative prototyp.BigInt `json:"feeNative"` +} + +type ChainExecuteQuote struct { + ChainId prototyp.BigInt `json:"chainId"` + TotalGasLimit prototyp.BigInt `json:"totalGasLimit"` + GasPrice prototyp.BigInt `json:"gasPrice"` + TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` + NativeTokenSymbol string `json:"nativeTokenSymbol"` + NativeTokenPrice float64 `json:"nativeTokenPrice"` + MetaTxnFeeDetails []*MetaTxnFeeDetail `json:"metaTxnFeeDetails"` + TotalFeeUSD float64 `json:"totalFeeUSD"` +} + +type ExecuteQuote struct { + ChainQuotes []*ChainExecuteQuote `json:"chainQuotes"` +} + +type TrailsFee struct { + ExecuteQuote *ExecuteQuote `json:"executeQuote"` + CrossChainFee *CrossChainFee `json:"crossChainFee"` + TakerFeeAmount prototyp.BigInt `json:"takerFeeAmount"` + TakerFeeUSD *float64 `json:"takerFeeUSD"` + TrailsFixedFeeUSD float64 `json:"trailsFixedFeeUSD"` + FeeToken prototyp.Hash `json:"feeToken"` + OriginTokenTotalAmount prototyp.BigInt `json:"originTokenTotalAmount"` + TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` + TotalFeeUSD float64 `json:"totalFeeUSD"` + QuoteProvider *string `json:"quoteProvider"` +} + +type IntentQuote struct { + FromAmount prototyp.BigInt `json:"fromAmount"` + FromAmountMin prototyp.BigInt `json:"fromAmountMin"` + ToAmount prototyp.BigInt `json:"toAmount"` + ToAmountMin prototyp.BigInt `json:"toAmountMin"` + PriceImpact float64 `json:"priceImpact"` + PriceImpactUsd string `json:"priceImpactUsd"` + MaxSlippage float64 `json:"maxSlippage"` + QuoteProvider string `json:"quoteProvider"` + QuoteProviderRequestId string `json:"quoteProviderRequestId"` + QuoteProviderFeeUsd string `json:"quoteProviderFeeUsd"` + FeeQuotes map[string]string `json:"feeQuotes"` +} + +var methods = map[string]method{ + "/rpc/API/Ping": { + Name: "Ping", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/Version": { + Name: "Version", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/RuntimeStatus": { + Name: "RuntimeStatus", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/Clock": { + Name: "Clock", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/GetIntentCallsPayloads": { + Name: "GetIntentCallsPayloads", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/CommitIntentConfig": { + Name: "CommitIntentConfig", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/GetIntentConfig": { + Name: "GetIntentConfig", + Service: "API", + Annotations: map[string]string{}, + }, + "/rpc/API/GetCCTPTransfer": { + Name: "GetCCTPTransfer", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/QueueCCTPTransfer": { + Name: "QueueCCTPTransfer", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/QueueIntentConfigExecution": { + Name: "QueueIntentConfigExecution", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/GetIntentConfigExecutionStatus": { + Name: "GetIntentConfigExecutionStatus", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/ListIntentConfigs": { + Name: "ListIntentConfigs", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, + "/rpc/API/QueueMetaTxnReceipt": { + Name: "QueueMetaTxnReceipt", + Service: "API", + Annotations: map[string]string{"public": ""}, + }, +} + +func WebrpcMethods() map[string]method { + res := make(map[string]method, len(methods)) + for k, v := range methods { + res[k] = v + } + + return res +} + +var WebRPCServices = map[string][]string{ + "API": { + "Ping", + "Version", + "RuntimeStatus", + "Clock", + "GetIntentCallsPayloads", + "CommitIntentConfig", + "GetIntentConfig", + "GetCCTPTransfer", + "QueueCCTPTransfer", + "QueueIntentConfigExecution", + "GetIntentConfigExecutionStatus", + "ListIntentConfigs", + "QueueMetaTxnReceipt", + }, +} + +// +// Server types +// + +type API interface { + // + // Runtime + // + Ping(ctx context.Context) (bool, error) + Version(ctx context.Context) (*Version, error) + RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) + Clock(ctx context.Context) (time.Time, error) + // + // Chain abstraction + // + GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // + // CCTP + // + GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) + QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) + // + // Intent Machine Worker + // + QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) + QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) +} + +// +// Client types +// + +type APIClient interface { + // + // Runtime + // + Ping(ctx context.Context) (bool, error) + Version(ctx context.Context) (*Version, error) + RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) + Clock(ctx context.Context) (time.Time, error) + // + // Chain abstraction + // + GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // + // CCTP + // + GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) + QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) + // + // Intent Machine Worker + // + QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) + QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) +} + +// +// Client +// + +const APIPathPrefix = "/rpc/API/" + +type aPIClient struct { + client HTTPClient + urls [13]string +} + +func NewAPIClient(addr string, client HTTPClient) APIClient { + prefix := urlBase(addr) + APIPathPrefix + urls := [13]string{ + prefix + "Ping", + prefix + "Version", + prefix + "RuntimeStatus", + prefix + "Clock", + prefix + "GetIntentCallsPayloads", + prefix + "CommitIntentConfig", + prefix + "GetIntentConfig", + prefix + "GetCCTPTransfer", + prefix + "QueueCCTPTransfer", + prefix + "QueueIntentConfigExecution", + prefix + "GetIntentConfigExecutionStatus", + prefix + "ListIntentConfigs", + prefix + "QueueMetaTxnReceipt", + } + return &aPIClient{ + client: client, + urls: urls, + } +} + +func (c *aPIClient) Ping(ctx context.Context) (bool, error) { + out := struct { + Ret0 bool `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[0], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) Version(ctx context.Context) (*Version, error) { + out := struct { + Ret0 *Version `json:"version"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[1], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { + out := struct { + Ret0 *RuntimeStatus `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[2], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) Clock(ctx context.Context) (time.Time, error) { + out := struct { + Ret0 time.Time `json:"serverTime"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[3], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) { + in := struct { + Arg0 string `json:"userAddress"` + Arg1 uint64 `json:"destinationChainId"` + Arg2 string `json:"destinationTokenAddress"` + Arg3 string `json:"destinationTokenAmount"` + Arg4 string `json:"destinationToAddress"` + Arg5 uint64 `json:"originChainId"` + Arg6 string `json:"originTokenAddress"` + Arg7 string `json:"originTokenAmount"` + Arg8 *string `json:"destinationCallData"` + Arg9 *string `json:"destinationCallValue"` + Arg10 *string `json:"provider"` + Arg11 *AddressOverrides `json:"addressOverrides"` + Arg12 *string `json:"destinationSalt"` + Arg13 *TakerFee `json:"takerFee"` + Arg14 *float64 `json:"slippageTolerance"` + Arg15 *TradeType `json:"tradeType"` + }{userAddress, destinationChainId, destinationTokenAddress, destinationTokenAmount, destinationToAddress, originChainId, originTokenAddress, originTokenAmount, destinationCallData, destinationCallValue, provider, addressOverrides, destinationSalt, takerFee, slippageTolerance, tradeType} + out := struct { + Ret0 []*IntentCallsPayload `json:"calls"` + Ret1 []*IntentPrecondition `json:"preconditions"` + Ret2 []*MetaTxn `json:"metaTxns"` + Ret3 *TrailsFee `json:"trailsFee"` + Ret4 *IntentQuote `json:"quote"` + Ret5 map[string]string `json:"feeQuotes"` + Ret6 string `json:"originIntentAddress"` + Ret7 string `json:"destinationIntentAddress"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, out.Ret1, out.Ret2, out.Ret3, out.Ret4, out.Ret5, out.Ret6, out.Ret7, err +} + +func (c *aPIClient) CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) { + in := struct { + Arg0 string `json:"originIntentAddress"` + Arg1 string `json:"destinationIntentAddress"` + Arg2 string `json:"mainSigner"` + Arg3 []*IntentCallsPayload `json:"calls"` + Arg4 []*IntentPrecondition `json:"preconditions"` + Arg5 *AddressOverrides `json:"addressOverrides"` + }{originIntentAddress, destinationIntentAddress, mainSigner, calls, preconditions, addressOverrides} + out := struct { + Ret0 *IntentConfig `json:"config"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) { + in := struct { + Arg0 string `json:"intentAddress"` + }{intentAddress} + out := struct { + Ret0 *IntentConfig `json:"config"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) { + in := struct { + Arg0 string `json:"id"` + }{id} + out := struct { + Ret0 *CCTPTransfer `json:"transfer"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) { + in := struct { + Arg0 *string `json:"sourceTxHash"` + Arg1 *string `json:"metaTxHash"` + Arg2 uint64 `json:"sourceChainId"` + Arg3 uint64 `json:"destinationChainId"` + }{sourceTxHash, metaTxHash, sourceChainId, destinationChainId} + out := struct { + Ret0 *CCTPTransfer `json:"transfer"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) { + in := struct { + Arg0 uint64 `json:"intentConfigId"` + }{intentConfigId} + out := struct { + Ret0 bool `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) { + in := struct { + Arg0 uint64 `json:"intentConfigId"` + }{intentConfigId} + out := struct { + Ret0 string `json:"executionStatus"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) { + in := struct { + Arg0 *Page `json:"page"` + Arg1 *string `json:"executionStatus"` + }{page, executionStatus} + out := struct { + Ret0 *Page `json:"page"` + Ret1 []*IntentConfig `json:"intentConfigs"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, out.Ret1, err +} + +func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) { + in := struct { + Arg0 string `json:"metaTxID"` + }{metaTxID} + out := struct { + Ret0 bool `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +// 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 HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +// urlBase helps ensure that addr specifies a scheme. If it is unparsable +// as a URL, it returns addr unchanged. +func urlBase(addr string) string { + // If the addr specifies a scheme, use it. If not, default to + // http. If url.Parse fails on it, return it unchanged. + url, err := url.Parse(addr) + if err != nil { + return addr + } + if url.Scheme == "" { + url.Scheme = "http" + } + return url.String() +} + +// newRequest makes an http.Request from a client, adding common headers. +func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { + req, err := http.NewRequestWithContext(ctx, "POST", url, reqBody) + if err != nil { + return nil, err + } + req.Header.Set("Accept", contentType) + req.Header.Set("Content-Type", contentType) + req.Header.Set(WebrpcHeader, WebrpcHeaderValue) + if headers, ok := HTTPRequestHeaders(ctx); ok { + for k := range headers { + for _, v := range headers[k] { + req.Header.Add(k, v) + } + } + } + return req, nil +} + +// doHTTPRequest is common code to make a request to the remote service. +func doHTTPRequest(ctx context.Context, client HTTPClient, url string, in, out interface{}) (*http.Response, error) { + reqBody, err := json.Marshal(in) + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCausef("failed to marshal JSON body: %w", err) + } + if err = ctx.Err(); err != nil { + return nil, ErrWebrpcRequestFailed.WithCausef("aborted because context was done: %w", err) + } + + req, err := newRequest(ctx, url, bytes.NewBuffer(reqBody), "application/json") + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCausef("could not build request: %w", err) + } + + resp, err := client.Do(req) + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCause(err) + } + + if resp.StatusCode != 200 { + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to read server error response body: %w", err) + } + + var rpcErr WebRPCError + if err := json.Unmarshal(respBody, &rpcErr); err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to unmarshal server error: %w", err) + } + if rpcErr.Cause != "" { + rpcErr.cause = errors.New(rpcErr.Cause) + } + return nil, rpcErr + } + + if out != nil { + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to read response body: %w", err) + } + + err = json.Unmarshal(respBody, &out) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCausef("failed to unmarshal JSON response body: %w", err) + } + } + + return resp, nil +} + +func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error) { + if _, ok := h["Accept"]; ok { + return nil, errors.New("provided header cannot set Accept") + } + if _, ok := h["Content-Type"]; ok { + return nil, errors.New("provided header cannot set Content-Type") + } + + copied := make(http.Header, len(h)) + for k, vv := range h { + if vv == nil { + copied[k] = nil + continue + } + copied[k] = make([]string, len(vv)) + copy(copied[k], vv) + } + + return context.WithValue(ctx, HTTPClientRequestHeadersCtxKey, copied), nil +} + +func HTTPRequestHeaders(ctx context.Context) (http.Header, bool) { + h, ok := ctx.Value(HTTPClientRequestHeadersCtxKey).(http.Header) + return h, ok +} + +// +// Helpers +// + +type method struct { + Name string + Service string + Annotations map[string]string +} + +type contextKey struct { + name string +} + +func (k *contextKey) String() string { + return "webrpc context value " + k.name +} + +var ( + HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} + HTTPRequestCtxKey = &contextKey{"HTTPRequest"} + + ServiceNameCtxKey = &contextKey{"ServiceName"} + + MethodNameCtxKey = &contextKey{"MethodName"} +) + +func ServiceNameFromContext(ctx context.Context) string { + service, _ := ctx.Value(ServiceNameCtxKey).(string) + return service +} + +func MethodNameFromContext(ctx context.Context) string { + method, _ := ctx.Value(MethodNameCtxKey).(string) + return method +} + +func RequestFromContext(ctx context.Context) *http.Request { + r, _ := ctx.Value(HTTPRequestCtxKey).(*http.Request) + return r +} + +func MethodCtx(ctx context.Context) (method, bool) { + req := RequestFromContext(ctx) + if req == nil { + return method{}, false + } + + m, ok := methods[req.URL.Path] + if !ok { + return method{}, false + } + + return m, true +} + +// +// Errors +// + +type WebRPCError struct { + Name string `json:"error"` + Code int `json:"code"` + Message string `json:"msg"` + Cause string `json:"cause,omitempty"` + HTTPStatus int `json:"status"` + cause error +} + +var _ error = WebRPCError{} + +func (e WebRPCError) Error() string { + if e.cause != nil { + return fmt.Sprintf("%s %d: %s: %v", e.Name, e.Code, e.Message, e.cause) + } + return fmt.Sprintf("%s %d: %s", e.Name, e.Code, e.Message) +} + +func (e WebRPCError) Is(target error) bool { + if target == nil { + return false + } + if rpcErr, ok := target.(WebRPCError); ok { + return rpcErr.Code == e.Code + } + return errors.Is(e.cause, target) +} + +func (e WebRPCError) Unwrap() error { + return e.cause +} + +func (e WebRPCError) WithCause(cause error) WebRPCError { + err := e + err.cause = cause + err.Cause = cause.Error() + return err +} + +func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError { + cause := fmt.Errorf(format, args...) + err := e + err.cause = cause + err.Cause = cause.Error() + return err +} + +// Deprecated: Use .WithCause() method on WebRPCError. +func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError { + return rpcErr.WithCause(cause) +} + +// Webrpc errors +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} + ErrWebrpcClientDisconnected = WebRPCError{Code: -8, Name: "WebrpcClientDisconnected", Message: "client disconnected", HTTPStatus: 400} + ErrWebrpcStreamLost = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400} + ErrWebrpcStreamFinished = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200} +) + +// Schema errors +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} + ErrUnavailable = WebRPCError{Code: 2002, Name: "Unavailable", Message: "Unavailable resource", HTTPStatus: 400} + ErrQueryFailed = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400} + ErrNotFound = WebRPCError{Code: 8000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400} + ErrUnsupportedNetwork = WebRPCError{Code: 8008, Name: "UnsupportedNetwork", Message: "Unsupported network", HTTPStatus: 422} +) From 2c4778fad0fb4658b82d15bcf6fdf24d4bd1c399 Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Wed, 1 Oct 2025 16:05:19 +0000 Subject: [PATCH 03/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 42 ++++++++++++++---------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 30229109..21cfc591 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3 +// trails-api v0.4.0 a81a66cc8764837490ea73950ef78928610fa7e6 // -- // Code generated by webrpc-gen@v0.25.3 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3" + return "a81a66cc8764837490ea73950ef78928610fa7e6" } type WebrpcGenVersions struct { @@ -489,30 +489,25 @@ var WebRPCServices = map[string][]string{ // type API interface { - // - // Runtime - // Ping(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) - // - // Chain abstraction - // + // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + // Persists intent configuration details to database for later execution, creating a new intent config record. CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + // Retrieves stored intent configuration by wallet address for inspection or execution. GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) - // - // CCTP - // GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) - // - // Intent Machine Worker - // + // Marks an intent config as ready for processing by the execution worker. QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + // Returns current execution status (pending/processing/executed/failed) for a given intent config. GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + // Paginated listing of intent configs with optional execution status filtering. ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) + // Processes relay transaction receipts to update intent execution status and trigger refund logic. QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) } @@ -521,30 +516,25 @@ type API interface { // type APIClient interface { - // - // Runtime - // Ping(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) - // - // Chain abstraction - // + // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + // Persists intent configuration details to database for later execution, creating a new intent config record. CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + // Retrieves stored intent configuration by wallet address for inspection or execution. GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) - // - // CCTP - // GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) - // - // Intent Machine Worker - // + // Marks an intent config as ready for processing by the execution worker. QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + // Returns current execution status (pending/processing/executed/failed) for a given intent config. GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + // Paginated listing of intent configs with optional execution status filtering. ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) + // Processes relay transaction receipts to update intent execution status and trigger refund logic. QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) } From 08c5084a5822bef5b233c11d2179389d56a80b8e Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Wed, 1 Oct 2025 18:36:35 +0000 Subject: [PATCH 04/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 209 +++++++++++++++++++++++------------ 1 file changed, 140 insertions(+), 69 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 21cfc591..a3d981c9 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 a81a66cc8764837490ea73950ef78928610fa7e6 +// trails-api v0.4.0 d0eb660544cee4bb56919d4aa3135ab30ecb72d0 // -- // Code generated by webrpc-gen@v0.25.3 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "a81a66cc8764837490ea73950ef78928610fa7e6" + return "d0eb660544cee4bb56919d4aa3135ab30ecb72d0" } type WebrpcGenVersions struct { @@ -94,34 +94,6 @@ func parseWebrpcGenVersions(header string) (*WebrpcGenVersions, error) { // Common types // -type TradeType string - -const ( - TradeType_EXACT_INPUT TradeType = "EXACT_INPUT" - TradeType_EXACT_OUTPUT TradeType = "EXACT_OUTPUT" -) - -func (x TradeType) MarshalText() ([]byte, error) { - return []byte(x), nil -} - -func (x *TradeType) UnmarshalText(b []byte) error { - *x = TradeType(string(b)) - return nil -} - -func (x *TradeType) Is(values ...TradeType) bool { - if x == nil { - return false - } - for _, v := range values { - if *x == v { - return true - } - } - return false -} - type SortOrder uint32 const ( @@ -164,6 +136,34 @@ func (x *SortOrder) Is(values ...SortOrder) bool { return false } +type TradeType string + +const ( + TradeType_EXACT_INPUT TradeType = "EXACT_INPUT" + TradeType_EXACT_OUTPUT TradeType = "EXACT_OUTPUT" +) + +func (x TradeType) MarshalText() ([]byte, error) { + return []byte(x), nil +} + +func (x *TradeType) UnmarshalText(b []byte) error { + *x = TradeType(string(b)) + return nil +} + +func (x *TradeType) Is(values ...TradeType) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + type Version struct { WebrpcVersion string `json:"webrpcVersion"` SchemaVersion string `json:"schemaVersion"` @@ -239,6 +239,14 @@ type IntentConfig struct { CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } +// MetaTxnReceipt +type MetaTxnReceipt struct { + MetaTxID string `json:"metaTxID" db:"meta_tx_id"` + Status string `json:"status" db:"status"` + TxnReceipt *string `json:"txnReceipt" db:"txn_receipt"` + RevertReason *string `json:"revertReason" db:"revert_reason"` +} + type AddressOverrides struct { TrailsLiFiSapientSignerAddress *string `json:"trailsLiFiSapientSignerAddress"` TrailsRelaySapientSignerAddress *string `json:"trailsRelaySapientSignerAddress"` @@ -250,6 +258,13 @@ type TakerFee struct { Bps uint64 `json:"bps"` } +type OriginCall struct { + ChainId prototyp.BigInt `json:"chainId"` + To string `json:"to"` + TransactionData string `json:"transactionData"` + TransactionValue prototyp.BigInt `json:"transactionValue"` +} + type IntentPrecondition struct { Type string `json:"type"` ChainId prototyp.BigInt `json:"chainId"` @@ -332,6 +347,56 @@ type CCTPTransfer struct { UpdatedAt time.Time `json:"updatedAt"` } +type GetIntentCallsPayloadParams struct { + UserAddress prototyp.Hash `json:"userAddress"` + DestinationChainID uint64 `json:"destinationChainId"` + DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` + DestinationTokenAmount string `json:"destinationTokenAmount"` + DestinationToAddress prototyp.Hash `json:"destinationToAddress"` + OriginChainID uint64 `json:"originChainId"` + OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` + OriginTokenAmount string `json:"originTokenAmount"` + DestinationCallData *string `json:"destinationCallData"` + DestinationCallValue *string `json:"destinationCallValue"` + Provider *string `json:"provider"` + AddressOverrides *AddressOverrides `json:"addressOverrides"` + DestinationSalt *string `json:"destinationSalt"` + TakerFee *TakerFee `json:"takerFee"` + SlippageTolerance *float64 `json:"slippageTolerance"` + TradeType *TradeType `json:"tradeType"` +} + +type GetIntentsQuoteParams struct { + UserAddress prototyp.Hash `json:"userAddress"` + DestinationChainID uint64 `json:"destinationChainId"` + DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` + DestinationTokenAmount string `json:"destinationTokenAmount"` + DestinationToAddress prototyp.Hash `json:"destinationToAddress"` + OriginChainID uint64 `json:"originChainId"` + OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` + OriginTokenAmount string `json:"originTokenAmount"` + DestinationCallData *string `json:"destinationCallData"` + DestinationCallValue *string `json:"destinationCallValue"` + Provider *string `json:"provider"` + AddressOverrides *AddressOverrides `json:"addressOverrides"` + DestinationSalt *string `json:"destinationSalt"` + TakerFee *TakerFee `json:"takerFee"` + SlippageTolerance *float64 `json:"slippageTolerance"` + TradeType *TradeType `json:"tradeType"` + ExactInputOriginalTokenAmount *string `json:"exactInputOriginalTokenAmount"` +} + +type IntentCallsPayloads struct { + Calls []*IntentCallsPayload `json:"calls"` + Preconditions []*IntentPrecondition `json:"preconditions"` + MetaTxns []*MetaTxn `json:"metaTxns"` + TrailsFee *TrailsFee `json:"trailsFee"` + Quote *IntentQuote `json:"quote"` + FeeQuotes map[string]string `json:"feeQuotes"` + OriginIntentAddress string `json:"originIntentAddress"` + DestinationIntentAddress string `json:"destinationIntentAddress"` +} + type CrossChainFee struct { ProviderFee prototyp.BigInt `json:"providerFee"` TrailsSwapFee prototyp.BigInt `json:"trailsSwapFee"` @@ -415,6 +480,11 @@ var methods = map[string]method{ Service: "API", Annotations: map[string]string{}, }, + "/rpc/API/GetIntentsQuote": { + Name: "GetIntentsQuote", + Service: "API", + Annotations: map[string]string{}, + }, "/rpc/API/CommitIntentConfig": { Name: "CommitIntentConfig", Service: "API", @@ -473,6 +543,7 @@ var WebRPCServices = map[string][]string{ "RuntimeStatus", "Clock", "GetIntentCallsPayloads", + "GetIntentsQuote", "CommitIntentConfig", "GetIntentConfig", "GetCCTPTransfer", @@ -494,7 +565,8 @@ type API interface { RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. - GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) + GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) // Persists intent configuration details to database for later execution, creating a new intent config record. CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) // Retrieves stored intent configuration by wallet address for inspection or execution. @@ -521,7 +593,8 @@ type APIClient interface { RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. - GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) + GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) + GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) // Persists intent configuration details to database for later execution, creating a new intent config record. CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) // Retrieves stored intent configuration by wallet address for inspection or execution. @@ -546,17 +619,18 @@ const APIPathPrefix = "/rpc/API/" type aPIClient struct { client HTTPClient - urls [13]string + urls [14]string } func NewAPIClient(addr string, client HTTPClient) APIClient { prefix := urlBase(addr) + APIPathPrefix - urls := [13]string{ + urls := [14]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", prefix + "Clock", prefix + "GetIntentCallsPayloads", + prefix + "GetIntentsQuote", prefix + "CommitIntentConfig", prefix + "GetIntentConfig", prefix + "GetCCTPTransfer", @@ -636,34 +710,12 @@ func (c *aPIClient) Clock(ctx context.Context) (time.Time, error) { return out.Ret0, err } -func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, userAddress string, destinationChainId uint64, destinationTokenAddress string, destinationTokenAmount string, destinationToAddress string, originChainId uint64, originTokenAddress string, originTokenAmount string, destinationCallData *string, destinationCallValue *string, provider *string, addressOverrides *AddressOverrides, destinationSalt *string, takerFee *TakerFee, slippageTolerance *float64, tradeType *TradeType) ([]*IntentCallsPayload, []*IntentPrecondition, []*MetaTxn, *TrailsFee, *IntentQuote, map[string]string, string, string, error) { +func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) { in := struct { - Arg0 string `json:"userAddress"` - Arg1 uint64 `json:"destinationChainId"` - Arg2 string `json:"destinationTokenAddress"` - Arg3 string `json:"destinationTokenAmount"` - Arg4 string `json:"destinationToAddress"` - Arg5 uint64 `json:"originChainId"` - Arg6 string `json:"originTokenAddress"` - Arg7 string `json:"originTokenAmount"` - Arg8 *string `json:"destinationCallData"` - Arg9 *string `json:"destinationCallValue"` - Arg10 *string `json:"provider"` - Arg11 *AddressOverrides `json:"addressOverrides"` - Arg12 *string `json:"destinationSalt"` - Arg13 *TakerFee `json:"takerFee"` - Arg14 *float64 `json:"slippageTolerance"` - Arg15 *TradeType `json:"tradeType"` - }{userAddress, destinationChainId, destinationTokenAddress, destinationTokenAmount, destinationToAddress, originChainId, originTokenAddress, originTokenAmount, destinationCallData, destinationCallValue, provider, addressOverrides, destinationSalt, takerFee, slippageTolerance, tradeType} + Arg0 *GetIntentCallsPayloadParams `json:"params"` + }{params} out := struct { - Ret0 []*IntentCallsPayload `json:"calls"` - Ret1 []*IntentPrecondition `json:"preconditions"` - Ret2 []*MetaTxn `json:"metaTxns"` - Ret3 *TrailsFee `json:"trailsFee"` - Ret4 *IntentQuote `json:"quote"` - Ret5 map[string]string `json:"feeQuotes"` - Ret6 string `json:"originIntentAddress"` - Ret7 string `json:"destinationIntentAddress"` + Ret0 *IntentCallsPayloads `json:"payloads"` }{} resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) @@ -674,7 +726,26 @@ func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, userAddress stri } } - return out.Ret0, out.Ret1, out.Ret2, out.Ret3, out.Ret4, out.Ret5, out.Ret6, out.Ret7, err + return out.Ret0, err +} + +func (c *aPIClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) { + in := struct { + Arg0 *GetIntentsQuoteParams `json:"params"` + }{params} + out := struct { + Ret0 *IntentQuote `json:"quote"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err } func (c *aPIClient) CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) { @@ -690,7 +761,7 @@ func (c *aPIClient) CommitIntentConfig(ctx context.Context, originIntentAddress Ret0 *IntentConfig `json:"config"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -709,7 +780,7 @@ func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) ( Ret0 *IntentConfig `json:"config"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -728,7 +799,7 @@ func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -750,7 +821,7 @@ func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -769,7 +840,7 @@ func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfig Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -788,7 +859,7 @@ func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo Ret0 string `json:"executionStatus"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -809,7 +880,7 @@ func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, execution Ret1 []*IntentConfig `json:"intentConfigs"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -828,7 +899,7 @@ func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { From b599cd9b7e854d481975c2173fd2a6ccc966d394 Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Wed, 1 Oct 2025 20:01:12 +0000 Subject: [PATCH 05/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 110 ++++++++++++++++++++++++++++------- 1 file changed, 90 insertions(+), 20 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index a3d981c9..4b6097a6 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 d0eb660544cee4bb56919d4aa3135ab30ecb72d0 +// trails-api v0.4.0 382b29dc1d49e1b98fb4b074aec76beb06a1cd3d // -- // Code generated by webrpc-gen@v0.25.3 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "d0eb660544cee4bb56919d4aa3135ab30ecb72d0" + return "382b29dc1d49e1b98fb4b074aec76beb06a1cd3d" } type WebrpcGenVersions struct { @@ -239,6 +239,24 @@ type IntentConfig struct { CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } +// IntentTransaction represents a transaction that went through the intent machine +type IntentTransaction struct { + OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` + DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"destination_intent_address"` + MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` + MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` + TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` + ExecutionStatus *string `json:"executionStatus" db:"execution_status,omitempty"` + OriginChainID *uint64 `json:"originChainId"` + DestinationChainID *uint64 `json:"destinationChainId"` + OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` + OriginTokenAmount prototyp.BigInt `json:"originTokenAmount"` + DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` + DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` + DestinationToAddress prototyp.Hash `json:"destinationToAddress"` + CreatedAt *string `json:"createdAt"` +} + // MetaTxnReceipt type MetaTxnReceipt struct { MetaTxID string `json:"metaTxID" db:"meta_tx_id"` @@ -386,6 +404,31 @@ type GetIntentsQuoteParams struct { ExactInputOriginalTokenAmount *string `json:"exactInputOriginalTokenAmount"` } +type CommitIntentConfigParams struct { + OriginIntentAddress string `json:"originIntentAddress"` + DestinationIntentAddress string `json:"destinationIntentAddress"` + MainSigner string `json:"mainSigner"` + Calls []*IntentCallsPayload `json:"calls"` + Preconditions []*IntentPrecondition `json:"preconditions"` + AddressOverrides *AddressOverrides `json:"addressOverrides"` + RequestParams *IntentRequestParams `json:"requestParams"` +} + +type IntentRequestParams struct { + Version string `json:"version"` + UserAddress prototyp.Hash `json:"userAddress"` + DestinationChainId uint64 `json:"destinationChainId"` + DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` + DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` + DestinationToAddress prototyp.Hash `json:"destinationToAddress"` + OriginChainId uint64 `json:"originChainId"` + OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` + OriginTokenAmount prototyp.BigInt `json:"originTokenAmount"` + DestinationCallData *string `json:"destinationCallData"` + DestinationCallValue *string `json:"destinationCallValue"` + CreatedAt time.Time `json:"createdAt"` +} + type IntentCallsPayloads struct { Calls []*IntentCallsPayload `json:"calls"` Preconditions []*IntentPrecondition `json:"preconditions"` @@ -495,6 +538,11 @@ var methods = map[string]method{ Service: "API", Annotations: map[string]string{}, }, + "/rpc/API/GetIntentTransactionHistory": { + Name: "GetIntentTransactionHistory", + Service: "API", + Annotations: map[string]string{}, + }, "/rpc/API/GetCCTPTransfer": { Name: "GetCCTPTransfer", Service: "API", @@ -546,6 +594,7 @@ var WebRPCServices = map[string][]string{ "GetIntentsQuote", "CommitIntentConfig", "GetIntentConfig", + "GetIntentTransactionHistory", "GetCCTPTransfer", "QueueCCTPTransfer", "QueueIntentConfigExecution", @@ -568,9 +617,11 @@ type API interface { GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) // Persists intent configuration details to database for later execution, creating a new intent config record. - CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) // Retrieves stored intent configuration by wallet address for inspection or execution. GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // Intent transaction history endpoint + GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) // Marks an intent config as ready for processing by the execution worker. @@ -596,9 +647,11 @@ type APIClient interface { GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) // Persists intent configuration details to database for later execution, creating a new intent config record. - CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) + CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) // Retrieves stored intent configuration by wallet address for inspection or execution. GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // Intent transaction history endpoint + GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) // Marks an intent config as ready for processing by the execution worker. @@ -619,12 +672,12 @@ const APIPathPrefix = "/rpc/API/" type aPIClient struct { client HTTPClient - urls [14]string + urls [15]string } func NewAPIClient(addr string, client HTTPClient) APIClient { prefix := urlBase(addr) + APIPathPrefix - urls := [14]string{ + urls := [15]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -633,6 +686,7 @@ func NewAPIClient(addr string, client HTTPClient) APIClient { prefix + "GetIntentsQuote", prefix + "CommitIntentConfig", prefix + "GetIntentConfig", + prefix + "GetIntentTransactionHistory", prefix + "GetCCTPTransfer", prefix + "QueueCCTPTransfer", prefix + "QueueIntentConfigExecution", @@ -748,15 +802,10 @@ func (c *aPIClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuote return out.Ret0, err } -func (c *aPIClient) CommitIntentConfig(ctx context.Context, originIntentAddress string, destinationIntentAddress string, mainSigner string, calls []*IntentCallsPayload, preconditions []*IntentPrecondition, addressOverrides *AddressOverrides) (*IntentConfig, error) { +func (c *aPIClient) CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) { in := struct { - Arg0 string `json:"originIntentAddress"` - Arg1 string `json:"destinationIntentAddress"` - Arg2 string `json:"mainSigner"` - Arg3 []*IntentCallsPayload `json:"calls"` - Arg4 []*IntentPrecondition `json:"preconditions"` - Arg5 *AddressOverrides `json:"addressOverrides"` - }{originIntentAddress, destinationIntentAddress, mainSigner, calls, preconditions, addressOverrides} + Arg0 *CommitIntentConfigParams `json:"params"` + }{params} out := struct { Ret0 *IntentConfig `json:"config"` }{} @@ -791,6 +840,27 @@ func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) ( return out.Ret0, err } +func (c *aPIClient) GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) { + in := struct { + Arg0 string `json:"accountAddress"` + Arg1 *Page `json:"page"` + }{accountAddress, page} + out := struct { + Ret0 *Page `json:"page"` + Ret1 []*IntentTransaction `json:"transactions"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, out.Ret1, err +} + func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) { in := struct { Arg0 string `json:"id"` @@ -799,7 +869,7 @@ func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -821,7 +891,7 @@ func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -840,7 +910,7 @@ func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfig Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -859,7 +929,7 @@ func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo Ret0 string `json:"executionStatus"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -880,7 +950,7 @@ func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, execution Ret1 []*IntentConfig `json:"intentConfigs"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -899,7 +969,7 @@ func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { From f0924fb1b1b3a0072b521ec2a1a30cf72a7af5f1 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 6 Oct 2025 16:31:37 +0000 Subject: [PATCH 06/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 150 +++++++++++++++++++++-------------- 1 file changed, 89 insertions(+), 61 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 4b6097a6..3f2e3a58 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ // trails-api v0.4.0 382b29dc1d49e1b98fb4b074aec76beb06a1cd3d // -- -// Code generated by webrpc-gen@v0.25.3 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -22,7 +22,7 @@ import ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.25.3;gen-golang@v0.18.4;trails-api@v0.4.0" +const WebrpcHeaderValue = "webrpc@v0.28.1;gen-golang@v0.21.0;trails-api@v0.4.0" // WebRPC description and code-gen version func WebRPCVersion() string { @@ -499,79 +499,79 @@ type IntentQuote struct { var methods = map[string]method{ "/rpc/API/Ping": { - Name: "Ping", - Service: "API", - Annotations: map[string]string{}, + name: "Ping", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/Version": { - Name: "Version", - Service: "API", - Annotations: map[string]string{}, + name: "Version", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/RuntimeStatus": { - Name: "RuntimeStatus", - Service: "API", - Annotations: map[string]string{}, + name: "RuntimeStatus", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/Clock": { - Name: "Clock", - Service: "API", - Annotations: map[string]string{}, + name: "Clock", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/GetIntentCallsPayloads": { - Name: "GetIntentCallsPayloads", - Service: "API", - Annotations: map[string]string{}, + name: "GetIntentCallsPayloads", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/GetIntentsQuote": { - Name: "GetIntentsQuote", - Service: "API", - Annotations: map[string]string{}, + name: "GetIntentsQuote", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/CommitIntentConfig": { - Name: "CommitIntentConfig", - Service: "API", - Annotations: map[string]string{}, + name: "CommitIntentConfig", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/GetIntentConfig": { - Name: "GetIntentConfig", - Service: "API", - Annotations: map[string]string{}, + name: "GetIntentConfig", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/GetIntentTransactionHistory": { - Name: "GetIntentTransactionHistory", - Service: "API", - Annotations: map[string]string{}, + name: "GetIntentTransactionHistory", + service: "API", + annotations: map[string]string{}, }, "/rpc/API/GetCCTPTransfer": { - Name: "GetCCTPTransfer", - Service: "API", - Annotations: map[string]string{"public": ""}, + name: "GetCCTPTransfer", + service: "API", + annotations: map[string]string{"public": ""}, }, "/rpc/API/QueueCCTPTransfer": { - Name: "QueueCCTPTransfer", - Service: "API", - Annotations: map[string]string{"public": ""}, + name: "QueueCCTPTransfer", + service: "API", + annotations: map[string]string{"public": ""}, }, "/rpc/API/QueueIntentConfigExecution": { - Name: "QueueIntentConfigExecution", - Service: "API", - Annotations: map[string]string{"public": ""}, + name: "QueueIntentConfigExecution", + service: "API", + annotations: map[string]string{"public": ""}, }, "/rpc/API/GetIntentConfigExecutionStatus": { - Name: "GetIntentConfigExecutionStatus", - Service: "API", - Annotations: map[string]string{"public": ""}, + name: "GetIntentConfigExecutionStatus", + service: "API", + annotations: map[string]string{"public": ""}, }, "/rpc/API/ListIntentConfigs": { - Name: "ListIntentConfigs", - Service: "API", - Annotations: map[string]string{"public": ""}, + name: "ListIntentConfigs", + service: "API", + annotations: map[string]string{"public": ""}, }, "/rpc/API/QueueMetaTxnReceipt": { - Name: "QueueMetaTxnReceipt", - Service: "API", - Annotations: map[string]string{"public": ""}, + name: "QueueMetaTxnReceipt", + service: "API", + annotations: map[string]string{"public": ""}, }, } @@ -768,6 +768,7 @@ func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, params *GetInten in := struct { Arg0 *GetIntentCallsPayloadParams `json:"params"` }{params} + out := struct { Ret0 *IntentCallsPayloads `json:"payloads"` }{} @@ -787,6 +788,7 @@ func (c *aPIClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuote in := struct { Arg0 *GetIntentsQuoteParams `json:"params"` }{params} + out := struct { Ret0 *IntentQuote `json:"quote"` }{} @@ -806,6 +808,7 @@ func (c *aPIClient) CommitIntentConfig(ctx context.Context, params *CommitIntent in := struct { Arg0 *CommitIntentConfigParams `json:"params"` }{params} + out := struct { Ret0 *IntentConfig `json:"config"` }{} @@ -825,6 +828,7 @@ func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) ( in := struct { Arg0 string `json:"intentAddress"` }{intentAddress} + out := struct { Ret0 *IntentConfig `json:"config"` }{} @@ -845,6 +849,7 @@ func (c *aPIClient) GetIntentTransactionHistory(ctx context.Context, accountAddr Arg0 string `json:"accountAddress"` Arg1 *Page `json:"page"` }{accountAddress, page} + out := struct { Ret0 *Page `json:"page"` Ret1 []*IntentTransaction `json:"transactions"` @@ -865,6 +870,7 @@ func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf in := struct { Arg0 string `json:"id"` }{id} + out := struct { Ret0 *CCTPTransfer `json:"transfer"` }{} @@ -887,6 +893,7 @@ func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, Arg2 uint64 `json:"sourceChainId"` Arg3 uint64 `json:"destinationChainId"` }{sourceTxHash, metaTxHash, sourceChainId, destinationChainId} + out := struct { Ret0 *CCTPTransfer `json:"transfer"` }{} @@ -906,6 +913,7 @@ func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfig in := struct { Arg0 uint64 `json:"intentConfigId"` }{intentConfigId} + out := struct { Ret0 bool `json:"status"` }{} @@ -925,6 +933,7 @@ func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo in := struct { Arg0 uint64 `json:"intentConfigId"` }{intentConfigId} + out := struct { Ret0 string `json:"executionStatus"` }{} @@ -945,6 +954,7 @@ func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, execution Arg0 *Page `json:"page"` Arg1 *string `json:"executionStatus"` }{page, executionStatus} + out := struct { Ret0 *Page `json:"page"` Ret1 []*IntentConfig `json:"intentConfigs"` @@ -965,6 +975,7 @@ func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b in := struct { Arg0 string `json:"metaTxID"` }{metaTxID} + out := struct { Ret0 bool `json:"status"` }{} @@ -1103,9 +1114,26 @@ func HTTPRequestHeaders(ctx context.Context) (http.Header, bool) { // type method struct { - Name string - Service string - Annotations map[string]string + name string + service string + annotations map[string]string +} + +func (m method) Name() string { + return m.name +} + +func (m method) Service() string { + return m.service +} + +func (m method) Annotations() map[string]string { + res := make(map[string]string, len(m.annotations)) + for k, v := range m.annotations { + res[k] = v + } + + return res } type contextKey struct { @@ -1212,17 +1240,17 @@ func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError { // Webrpc errors 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} - ErrWebrpcClientDisconnected = WebRPCError{Code: -8, Name: "WebrpcClientDisconnected", Message: "client disconnected", HTTPStatus: 400} - ErrWebrpcStreamLost = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400} - ErrWebrpcStreamFinished = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200} + 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} ) // Schema errors From 477be66a7f9e625603c5b04905c71afeb8a99236 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 7 Oct 2025 01:29:25 +0000 Subject: [PATCH 07/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 3f2e3a58..5cd357a8 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 382b29dc1d49e1b98fb4b074aec76beb06a1cd3d +// trails-api v0.4.0 21fe8892ba70a2368cbf23d158a09a9b61873d6a // -- // Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "382b29dc1d49e1b98fb4b074aec76beb06a1cd3d" + return "21fe8892ba70a2368cbf23d158a09a9b61873d6a" } type WebrpcGenVersions struct { @@ -173,13 +173,14 @@ type Version struct { type RuntimeStatus struct { // overall status, true/false - HealthOK bool `json:"healthOK"` - StartTime time.Time `json:"startTime"` - Uptime uint64 `json:"uptime"` - Ver string `json:"ver"` - Branch string `json:"branch"` - CommitHash string `json:"commitHash"` - Checks *RuntimeChecks `json:"checks"` + HealthOK bool `json:"healthOK"` + StartTime time.Time `json:"startTime"` + Uptime uint64 `json:"uptime"` + Ver string `json:"ver"` + Branch string `json:"branch"` + CommitHash string `json:"commitHash"` + Checks *RuntimeChecks `json:"checks"` + // TODOXXX: copied from relayer, should we keep it? NumTxnsRelayed map[string]*NumTxnsRelayed `json:"numTxnsRelayed"` } From 66b73f09439e36002c8c4f62b262c00b7533012e Mon Sep 17 00:00:00 2001 From: miguelmota <168240+miguelmota@users.noreply.github.com> Date: Tue, 7 Oct 2025 01:59:13 +0000 Subject: [PATCH 08/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 111 +++++++++++++++++++++++++++++++---- 1 file changed, 101 insertions(+), 10 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 5cd357a8..83f7ba9a 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 21fe8892ba70a2368cbf23d158a09a9b61873d6a +// trails-api v0.4.0 62cf3364b251220bd2fc985fae07f490158c119c // -- // Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "21fe8892ba70a2368cbf23d158a09a9b61873d6a" + return "62cf3364b251220bd2fc985fae07f490158c119c" } type WebrpcGenVersions struct { @@ -498,6 +498,35 @@ type IntentQuote struct { FeeQuotes map[string]string `json:"feeQuotes"` } +type GetIntentEntrypointDepositParams struct { + UserAddress prototyp.Hash `json:"userAddress"` + TokenAddress prototyp.Hash `json:"tokenAddress"` + Amount prototyp.BigInt `json:"amount"` + IntentAddress prototyp.Hash `json:"intentAddress"` + ChainID uint64 `json:"chainID"` + Deadline uint64 `json:"deadline"` + IntentSignature string `json:"intentSignature"` + UsePermit *bool `json:"usePermit"` + PermitDeadline *uint64 `json:"permitDeadline"` + PermitSignature *string `json:"permitSignature"` +} + +type GetIntentEntrypointDepositResult struct { + DepositWalletAddress string `json:"depositWalletAddress"` + MetaTxn *MetaTxn `json:"metaTxn"` + FeeQuote string `json:"feeQuote"` + EntrypointAddress string `json:"entrypointAddress"` +} + +type GetIntentEntrypointMessageHashParams struct { + UserAddress prototyp.Hash `json:"userAddress"` + TokenAddress prototyp.Hash `json:"tokenAddress"` + Amount prototyp.BigInt `json:"amount"` + IntentAddress prototyp.Hash `json:"intentAddress"` + ChainID uint64 `json:"chainID"` + Deadline uint64 `json:"deadline"` +} + var methods = map[string]method{ "/rpc/API/Ping": { name: "Ping", @@ -544,6 +573,16 @@ var methods = map[string]method{ service: "API", annotations: map[string]string{}, }, + "/rpc/API/GetIntentEntrypointDeposit": { + name: "GetIntentEntrypointDeposit", + service: "API", + annotations: map[string]string{"public": ""}, + }, + "/rpc/API/GetIntentEntrypointMessageHash": { + name: "GetIntentEntrypointMessageHash", + service: "API", + annotations: map[string]string{"public": ""}, + }, "/rpc/API/GetCCTPTransfer": { name: "GetCCTPTransfer", service: "API", @@ -596,6 +635,8 @@ var WebRPCServices = map[string][]string{ "CommitIntentConfig", "GetIntentConfig", "GetIntentTransactionHistory", + "GetIntentEntrypointDeposit", + "GetIntentEntrypointMessageHash", "GetCCTPTransfer", "QueueCCTPTransfer", "QueueIntentConfigExecution", @@ -623,6 +664,10 @@ type API interface { GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) // Intent transaction history endpoint GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) + // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. + GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) + // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. + GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) // Marks an intent config as ready for processing by the execution worker. @@ -653,6 +698,10 @@ type APIClient interface { GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) // Intent transaction history endpoint GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) + // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. + GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) + // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. + GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) // Marks an intent config as ready for processing by the execution worker. @@ -673,12 +722,12 @@ const APIPathPrefix = "/rpc/API/" type aPIClient struct { client HTTPClient - urls [15]string + urls [17]string } func NewAPIClient(addr string, client HTTPClient) APIClient { prefix := urlBase(addr) + APIPathPrefix - urls := [15]string{ + urls := [17]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -688,6 +737,8 @@ func NewAPIClient(addr string, client HTTPClient) APIClient { prefix + "CommitIntentConfig", prefix + "GetIntentConfig", prefix + "GetIntentTransactionHistory", + prefix + "GetIntentEntrypointDeposit", + prefix + "GetIntentEntrypointMessageHash", prefix + "GetCCTPTransfer", prefix + "QueueCCTPTransfer", prefix + "QueueIntentConfigExecution", @@ -867,6 +918,46 @@ func (c *aPIClient) GetIntentTransactionHistory(ctx context.Context, accountAddr return out.Ret0, out.Ret1, err } +func (c *aPIClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) { + in := struct { + Arg0 *GetIntentEntrypointDepositParams `json:"params"` + }{params} + + out := struct { + Ret0 *GetIntentEntrypointDepositResult `json:"result"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *aPIClient) GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) { + in := struct { + Arg0 *GetIntentEntrypointMessageHashParams `json:"params"` + }{params} + + out := struct { + Ret0 string `json:"messageHash"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) { in := struct { Arg0 string `json:"id"` @@ -876,7 +967,7 @@ func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -899,7 +990,7 @@ func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -919,7 +1010,7 @@ func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfig Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -939,7 +1030,7 @@ func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo Ret0 string `json:"executionStatus"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -961,7 +1052,7 @@ func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, execution Ret1 []*IntentConfig `json:"intentConfigs"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -981,7 +1072,7 @@ func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { From e0cb08f9f14d78d792e9fca1276940fedb708869 Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Tue, 7 Oct 2025 08:48:56 +0000 Subject: [PATCH 09/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 83f7ba9a..1ff9ec73 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 62cf3364b251220bd2fc985fae07f490158c119c +// trails-api v0.4.0 639386f692af6385305bf6901cc9f1b6fe21e979 // -- // Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "62cf3364b251220bd2fc985fae07f490158c119c" + return "639386f692af6385305bf6901cc9f1b6fe21e979" } type WebrpcGenVersions struct { @@ -267,9 +267,11 @@ type MetaTxnReceipt struct { } type AddressOverrides struct { - TrailsLiFiSapientSignerAddress *string `json:"trailsLiFiSapientSignerAddress"` - TrailsRelaySapientSignerAddress *string `json:"trailsRelaySapientSignerAddress"` - TrailsCCTPV2SapientSignerAddress *string `json:"trailsCCTPV2SapientSignerAddress"` + SequenceWalletFactoryAddress *string `json:"sequenceWalletFactoryAddress"` + SequenceWalletMainModuleAddress *string `json:"sequenceWalletMainModuleAddress"` + SequenceWalletMainModuleUpgradableAddress *string `json:"sequenceWalletMainModuleUpgradableAddress"` + SequenceWalletGuestModuleAddress *string `json:"sequenceWalletGuestModuleAddress"` + SequenceWalletUtilsAddress *string `json:"sequenceWalletUtilsAddress"` } type TakerFee struct { From 7814f47c1b6d14302bad4acded45f8b5444697e2 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:03:45 +0000 Subject: [PATCH 10/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 1ff9ec73..327a6b7f 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 639386f692af6385305bf6901cc9f1b6fe21e979 +// trails-api v0.4.0 8d6fd2f45083b3e8df2e6d6babe1046f788a6d43 // -- // Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "639386f692af6385305bf6901cc9f1b6fe21e979" + return "8d6fd2f45083b3e8df2e6d6babe1046f788a6d43" } type WebrpcGenVersions struct { @@ -180,8 +180,6 @@ type RuntimeStatus struct { Branch string `json:"branch"` CommitHash string `json:"commitHash"` Checks *RuntimeChecks `json:"checks"` - // TODOXXX: copied from relayer, should we keep it? - NumTxnsRelayed map[string]*NumTxnsRelayed `json:"numTxnsRelayed"` } type NumTxnsRelayed struct { From c6366a87788d5e0a8cc1b688aed0fd40013a3de1 Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Fri, 10 Oct 2025 05:26:58 +0000 Subject: [PATCH 11/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 327a6b7f..9fe8b3bd 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 8d6fd2f45083b3e8df2e6d6babe1046f788a6d43 +// trails-api v0.4.0 fed97360e921855da1cdb97cf0a96404edb2950f // -- // Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "8d6fd2f45083b3e8df2e6d6babe1046f788a6d43" + return "fed97360e921855da1cdb97cf0a96404edb2950f" } type WebrpcGenVersions struct { @@ -474,9 +474,6 @@ type ExecuteQuote struct { type TrailsFee struct { ExecuteQuote *ExecuteQuote `json:"executeQuote"` CrossChainFee *CrossChainFee `json:"crossChainFee"` - TakerFeeAmount prototyp.BigInt `json:"takerFeeAmount"` - TakerFeeUSD *float64 `json:"takerFeeUSD"` - TrailsFixedFeeUSD float64 `json:"trailsFixedFeeUSD"` FeeToken prototyp.Hash `json:"feeToken"` OriginTokenTotalAmount prototyp.BigInt `json:"originTokenTotalAmount"` TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` From 0338b1a90946d545d6e489e1eae6b54f8de31eb1 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:29:41 +0000 Subject: [PATCH 12/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 117 ++++++++++++++++++++++------------- 1 file changed, 73 insertions(+), 44 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 9fe8b3bd..3d5ea011 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 fed97360e921855da1cdb97cf0a96404edb2950f +// trails-api v0.4.0 7ae581ed6118efc338a137a9a4699e2ec1f87f03 // -- // Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "fed97360e921855da1cdb97cf0a96404edb2950f" + return "7ae581ed6118efc338a137a9a4699e2ec1f87f03" } type WebrpcGenVersions struct { @@ -173,23 +173,12 @@ type Version struct { type RuntimeStatus struct { // overall status, true/false - HealthOK bool `json:"healthOK"` - StartTime time.Time `json:"startTime"` - Uptime uint64 `json:"uptime"` - Ver string `json:"ver"` - Branch string `json:"branch"` - CommitHash string `json:"commitHash"` - Checks *RuntimeChecks `json:"checks"` -} - -type NumTxnsRelayed struct { - ChainID uint64 `json:"chainID"` - Prev uint64 `json:"prev"` - Current uint64 `json:"current"` - Period uint64 `json:"period"` -} - -type RuntimeChecks struct { + HealthOK bool `json:"healthOK"` + StartTime time.Time `json:"startTime"` + Uptime uint64 `json:"uptime"` + Ver string `json:"ver"` + Branch string `json:"branch"` + CommitHash string `json:"commitHash"` } // From: `0xsequence/relayer`: https://github.com/0xsequence/relayer/blob/2c695b820970c68c57bfe71810f469412cdec675/proto/relayer.ridl#L502 @@ -272,11 +261,6 @@ type AddressOverrides struct { SequenceWalletUtilsAddress *string `json:"sequenceWalletUtilsAddress"` } -type TakerFee struct { - Address prototyp.Hash `json:"address"` - Bps uint64 `json:"bps"` -} - type OriginCall struct { ChainId prototyp.BigInt `json:"chainId"` To string `json:"to"` @@ -284,10 +268,25 @@ type OriginCall struct { TransactionValue prototyp.BigInt `json:"transactionValue"` } +// TODO: fix this.. it should adhere to 7795, which it does not. type IntentPrecondition struct { - Type string `json:"type"` - ChainId prototyp.BigInt `json:"chainId"` - Data interface{} `json:"data"` + // TODO: should be erc20MinAllowance + Type string `json:"type"` + ChainId prototyp.BigInt `json:"chainId"` + Data *IntentPreconditionData `json:"data"` +} + +// transaction preconditions based on https://eips.ethereum.org/EIPS/eip-7795 +// TODOXXX: these values are incorrect, and should match 7795 +// chainId: `0x${string}`; // Hex chain id +// owner: `0x${string}`; // Address +// token: `0x${string}`; // Address +// minAmount: `0x${string}`; // Hex value +type IntentPreconditionData struct { + Address string `json:"address"` + Token string `json:"token"` + // TODOXXX: this probably should be a hex string.. what does ERC + Min uint64 `json:"min"` } type Token struct { @@ -380,7 +379,6 @@ type GetIntentCallsPayloadParams struct { Provider *string `json:"provider"` AddressOverrides *AddressOverrides `json:"addressOverrides"` DestinationSalt *string `json:"destinationSalt"` - TakerFee *TakerFee `json:"takerFee"` SlippageTolerance *float64 `json:"slippageTolerance"` TradeType *TradeType `json:"tradeType"` } @@ -399,7 +397,6 @@ type GetIntentsQuoteParams struct { Provider *string `json:"provider"` AddressOverrides *AddressOverrides `json:"addressOverrides"` DestinationSalt *string `json:"destinationSalt"` - TakerFee *TakerFee `json:"takerFee"` SlippageTolerance *float64 `json:"slippageTolerance"` TradeType *TradeType `json:"tradeType"` ExactInputOriginalTokenAmount *string `json:"exactInputOriginalTokenAmount"` @@ -431,6 +428,7 @@ type IntentRequestParams struct { } type IntentCallsPayloads struct { + ID string `json:"id"` Calls []*IntentCallsPayload `json:"calls"` Preconditions []*IntentPrecondition `json:"preconditions"` MetaTxns []*MetaTxn `json:"metaTxns"` @@ -545,6 +543,11 @@ var methods = map[string]method{ service: "API", annotations: map[string]string{}, }, + "/rpc/API/ExecuteIntent": { + name: "ExecuteIntent", + service: "API", + annotations: map[string]string{}, + }, "/rpc/API/GetIntentCallsPayloads": { name: "GetIntentCallsPayloads", service: "API", @@ -627,6 +630,7 @@ var WebRPCServices = map[string][]string{ "Version", "RuntimeStatus", "Clock", + "ExecuteIntent", "GetIntentCallsPayloads", "GetIntentsQuote", "CommitIntentConfig", @@ -652,6 +656,8 @@ type API interface { Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) + // TODO: a lot of overlap with IntentConfig and other stuff.. + ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) @@ -686,6 +692,8 @@ type APIClient interface { Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) + // TODO: a lot of overlap with IntentConfig and other stuff.. + ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) @@ -719,16 +727,17 @@ const APIPathPrefix = "/rpc/API/" type aPIClient struct { client HTTPClient - urls [17]string + urls [18]string } func NewAPIClient(addr string, client HTTPClient) APIClient { prefix := urlBase(addr) + APIPathPrefix - urls := [17]string{ + urls := [18]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", prefix + "Clock", + prefix + "ExecuteIntent", prefix + "GetIntentCallsPayloads", prefix + "GetIntentsQuote", prefix + "CommitIntentConfig", @@ -813,6 +822,26 @@ func (c *aPIClient) Clock(ctx context.Context) (time.Time, error) { return out.Ret0, err } +func (c *aPIClient) ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) { + in := struct { + Arg0 *CommitIntentConfigParams `json:"intent"` + }{intent} + + out := struct { + Ret0 *IntentConfig `json:"config"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) { in := struct { Arg0 *GetIntentCallsPayloadParams `json:"params"` @@ -822,7 +851,7 @@ func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, params *GetInten Ret0 *IntentCallsPayloads `json:"payloads"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -842,7 +871,7 @@ func (c *aPIClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuote Ret0 *IntentQuote `json:"quote"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -862,7 +891,7 @@ func (c *aPIClient) CommitIntentConfig(ctx context.Context, params *CommitIntent Ret0 *IntentConfig `json:"config"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -882,7 +911,7 @@ func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) ( Ret0 *IntentConfig `json:"config"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -904,7 +933,7 @@ func (c *aPIClient) GetIntentTransactionHistory(ctx context.Context, accountAddr Ret1 []*IntentTransaction `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -924,7 +953,7 @@ func (c *aPIClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetI Ret0 *GetIntentEntrypointDepositResult `json:"result"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -944,7 +973,7 @@ func (c *aPIClient) GetIntentEntrypointMessageHash(ctx context.Context, params * Ret0 string `json:"messageHash"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -964,7 +993,7 @@ func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -987,7 +1016,7 @@ func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1007,7 +1036,7 @@ func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfig Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1027,7 +1056,7 @@ func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo Ret0 string `json:"executionStatus"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1049,7 +1078,7 @@ func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, execution Ret1 []*IntentConfig `json:"intentConfigs"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1069,7 +1098,7 @@ func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { From 2bcac6bfb300d4a6513578200f99e4caf623d2da Mon Sep 17 00:00:00 2001 From: miguelmota <168240+miguelmota@users.noreply.github.com> Date: Mon, 13 Oct 2025 18:51:16 +0000 Subject: [PATCH 13/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 87 +++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 3d5ea011..83dbf164 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 7ae581ed6118efc338a137a9a4699e2ec1f87f03 +// trails-api v0.4.0 c4f41586d79b6d1fd4283fcb3da2527586ebb033 // -- // Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. // @@ -36,7 +36,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "7ae581ed6118efc338a137a9a4699e2ec1f87f03" + return "c4f41586d79b6d1fd4283fcb3da2527586ebb033" } type WebrpcGenVersions struct { @@ -502,8 +502,11 @@ type GetIntentEntrypointDepositParams struct { Deadline uint64 `json:"deadline"` IntentSignature string `json:"intentSignature"` UsePermit *bool `json:"usePermit"` + PermitAmount prototyp.BigInt `json:"permitAmount"` PermitDeadline *uint64 `json:"permitDeadline"` PermitSignature *string `json:"permitSignature"` + // Optional fee parameters + FeeAmount prototyp.BigInt `json:"feeAmount"` } type GetIntentEntrypointDepositResult struct { @@ -520,6 +523,37 @@ type GetIntentEntrypointMessageHashParams struct { IntentAddress prototyp.Hash `json:"intentAddress"` ChainID uint64 `json:"chainID"` Deadline uint64 `json:"deadline"` + Nonce prototyp.BigInt `json:"nonce"` +} + +// Fee options related types +type GetIntentEntrypointDepositFeeOptionsParams struct { + UserAddress prototyp.Hash `json:"userAddress"` + TokenAddress prototyp.Hash `json:"tokenAddress"` + IntentAddress prototyp.Hash `json:"intentAddress"` + Amount prototyp.BigInt `json:"amount"` + ChainID uint64 `json:"chainID"` +} + +type GetIntentEntrypointDepositFeeOptionsResult struct { + GasEstimate *GasEstimate `json:"gasEstimate"` + FeeOptions []*FeeOption `json:"feeOptions"` + ExpiresAt uint64 `json:"expiresAt"` +} + +type GasEstimate struct { + TotalGas uint64 `json:"totalGas"` + GasPrice string `json:"gasPrice"` + NativeCost string `json:"nativeCost"` + NativeCostUSD float64 `json:"nativeCostUSD"` +} + +type FeeOption struct { + TokenAddress string `json:"tokenAddress"` + TokenSymbol string `json:"tokenSymbol"` + TokenDecimals int32 `json:"tokenDecimals"` + Amount string `json:"amount"` + AmountUSD float64 `json:"amountUSD"` } var methods = map[string]method{ @@ -578,6 +612,11 @@ var methods = map[string]method{ service: "API", annotations: map[string]string{"public": ""}, }, + "/rpc/API/GetIntentEntrypointDepositFeeOptions": { + name: "GetIntentEntrypointDepositFeeOptions", + service: "API", + annotations: map[string]string{"public": ""}, + }, "/rpc/API/GetIntentEntrypointMessageHash": { name: "GetIntentEntrypointMessageHash", service: "API", @@ -637,6 +676,7 @@ var WebRPCServices = map[string][]string{ "GetIntentConfig", "GetIntentTransactionHistory", "GetIntentEntrypointDeposit", + "GetIntentEntrypointDepositFeeOptions", "GetIntentEntrypointMessageHash", "GetCCTPTransfer", "QueueCCTPTransfer", @@ -669,6 +709,8 @@ type API interface { GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) + // Calculates fee options for intent entrypoint deposits. + GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) @@ -705,6 +747,8 @@ type APIClient interface { GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) + // Calculates fee options for intent entrypoint deposits. + GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) @@ -727,12 +771,12 @@ const APIPathPrefix = "/rpc/API/" type aPIClient struct { client HTTPClient - urls [18]string + urls [19]string } func NewAPIClient(addr string, client HTTPClient) APIClient { prefix := urlBase(addr) + APIPathPrefix - urls := [18]string{ + urls := [19]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -744,6 +788,7 @@ func NewAPIClient(addr string, client HTTPClient) APIClient { prefix + "GetIntentConfig", prefix + "GetIntentTransactionHistory", prefix + "GetIntentEntrypointDeposit", + prefix + "GetIntentEntrypointDepositFeeOptions", prefix + "GetIntentEntrypointMessageHash", prefix + "GetCCTPTransfer", prefix + "QueueCCTPTransfer", @@ -964,6 +1009,26 @@ func (c *aPIClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetI return out.Ret0, err } +func (c *aPIClient) GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) { + in := struct { + Arg0 *GetIntentEntrypointDepositFeeOptionsParams `json:"params"` + }{params} + + out := struct { + Ret0 *GetIntentEntrypointDepositFeeOptionsResult `json:"result"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + func (c *aPIClient) GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) { in := struct { Arg0 *GetIntentEntrypointMessageHashParams `json:"params"` @@ -973,7 +1038,7 @@ func (c *aPIClient) GetIntentEntrypointMessageHash(ctx context.Context, params * Ret0 string `json:"messageHash"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -993,7 +1058,7 @@ func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1016,7 +1081,7 @@ func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1036,7 +1101,7 @@ func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfig Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1056,7 +1121,7 @@ func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo Ret0 string `json:"executionStatus"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1078,7 +1143,7 @@ func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, execution Ret1 []*IntentConfig `json:"intentConfigs"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1098,7 +1163,7 @@ func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { From 9410646413557dd8753fd928a3b8fb8564381658 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 21 Oct 2025 19:25:36 +0000 Subject: [PATCH 14/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 313 +++++++++++++++-------------------- 1 file changed, 135 insertions(+), 178 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 83dbf164..13d39a3e 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ -// trails-api v0.4.0 c4f41586d79b6d1fd4283fcb3da2527586ebb033 +// trails-api v0.4.0 debf6c73d2e0a7dbf749261baedad6291eedafab // -- -// Code generated by webrpc-gen@v0.28.1 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.29.0 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -20,10 +20,6 @@ import ( "github.com/0xsequence/go-sequence/lib/prototyp" ) -const WebrpcHeader = "Webrpc" - -const WebrpcHeaderValue = "webrpc@v0.28.1;gen-golang@v0.21.0;trails-api@v0.4.0" - // WebRPC description and code-gen version func WebRPCVersion() string { return "v1" @@ -36,62 +32,49 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "c4f41586d79b6d1fd4283fcb3da2527586ebb033" -} - -type WebrpcGenVersions struct { - WebrpcGenVersion string - CodeGenName string - CodeGenVersion string - SchemaName string - SchemaVersion string -} - -func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error) { - if h.Get(WebrpcHeader) == "" { - return nil, fmt.Errorf("header is empty or missing") - } - - versions, err := parseWebrpcGenVersions(h.Get(WebrpcHeader)) - if err != nil { - return nil, fmt.Errorf("webrpc header is invalid: %w", err) - } - - return versions, nil + return "debf6c73d2e0a7dbf749261baedad6291eedafab" } -func parseWebrpcGenVersions(header string) (*WebrpcGenVersions, error) { - versions := strings.Split(header, ";") - if len(versions) < 3 { - return nil, fmt.Errorf("expected at least 3 parts while parsing webrpc header: %v", header) - } - - _, webrpcGenVersion, ok := strings.Cut(versions[0], "@") - if !ok { - return nil, fmt.Errorf("webrpc gen version could not be parsed from: %s", versions[0]) - } - - tmplTarget, tmplVersion, ok := strings.Cut(versions[1], "@") - if !ok { - return nil, fmt.Errorf("tmplTarget and tmplVersion could not be parsed from: %s", versions[1]) - } - - schemaName, schemaVersion, ok := strings.Cut(versions[2], "@") - if !ok { - return nil, fmt.Errorf("schema name and schema version could not be parsed from: %s", versions[2]) - } +// +// Client interface +// - return &WebrpcGenVersions{ - WebrpcGenVersion: webrpcGenVersion, - CodeGenName: tmplTarget, - CodeGenVersion: tmplVersion, - SchemaName: schemaName, - SchemaVersion: schemaVersion, - }, nil +type APIClient interface { + Ping(ctx context.Context) (bool, error) + Version(ctx context.Context) (*Version, error) + RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) + Clock(ctx context.Context) (time.Time, error) + // TODO: a lot of overlap with IntentConfig and other stuff.. + ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) + // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. + GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) + GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) + // Persists intent configuration details to database for later execution, creating a new intent config record. + CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) + // Retrieves stored intent configuration by wallet address for inspection or execution. + GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // Intent transaction history endpoint + GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) + // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. + GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) + // Calculates fee options for intent entrypoint deposits. + GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) + // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. + GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) + GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) + QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) + // Marks an intent config as ready for processing by the execution worker. + QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + // Returns current execution status (pending/processing/executed/failed) for a given intent config. + GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + // Paginated listing of intent configs with optional execution status filtering. + ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) + // Processes relay transaction receipts to update intent execution status and trigger refund logic. + QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) } // -// Common types +// Schema types // type SortOrder uint32 @@ -524,6 +507,8 @@ type GetIntentEntrypointMessageHashParams struct { ChainID uint64 `json:"chainID"` Deadline uint64 `json:"deadline"` Nonce prototyp.BigInt `json:"nonce"` + FeeAmount prototyp.BigInt `json:"feeAmount"` + FeeCollector prototyp.Hash `json:"feeCollector"` } // Fee options related types @@ -536,9 +521,10 @@ type GetIntentEntrypointDepositFeeOptionsParams struct { } type GetIntentEntrypointDepositFeeOptionsResult struct { - GasEstimate *GasEstimate `json:"gasEstimate"` - FeeOptions []*FeeOption `json:"feeOptions"` - ExpiresAt uint64 `json:"expiresAt"` + GasEstimate *GasEstimate `json:"gasEstimate"` + FeeOptions []*FeeOption `json:"feeOptions"` + ExpiresAt uint64 `json:"expiresAt"` + FeeCollector string `json:"feeCollector"` } type GasEstimate struct { @@ -554,6 +540,7 @@ type FeeOption struct { TokenDecimals int32 `json:"tokenDecimals"` Amount string `json:"amount"` AmountUSD float64 `json:"amountUSD"` + FeeCollector string `json:"feeCollector"` } var methods = map[string]method{ @@ -687,89 +674,13 @@ var WebRPCServices = map[string][]string{ }, } -// -// Server types -// - -type API interface { - Ping(ctx context.Context) (bool, error) - Version(ctx context.Context) (*Version, error) - RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) - Clock(ctx context.Context) (time.Time, error) - // TODO: a lot of overlap with IntentConfig and other stuff.. - ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) - // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. - GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) - GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) - // Persists intent configuration details to database for later execution, creating a new intent config record. - CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) - // Retrieves stored intent configuration by wallet address for inspection or execution. - GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) - // Intent transaction history endpoint - GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) - // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. - GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) - // Calculates fee options for intent entrypoint deposits. - GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) - // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. - GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) - GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) - QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) - // Marks an intent config as ready for processing by the execution worker. - QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) - // Returns current execution status (pending/processing/executed/failed) for a given intent config. - GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) - // Paginated listing of intent configs with optional execution status filtering. - ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) - // Processes relay transaction receipts to update intent execution status and trigger refund logic. - QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) -} - -// -// Client types -// - -type APIClient interface { - Ping(ctx context.Context) (bool, error) - Version(ctx context.Context) (*Version, error) - RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) - Clock(ctx context.Context) (time.Time, error) - // TODO: a lot of overlap with IntentConfig and other stuff.. - ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) - // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. - GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) - GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) - // Persists intent configuration details to database for later execution, creating a new intent config record. - CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) - // Retrieves stored intent configuration by wallet address for inspection or execution. - GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) - // Intent transaction history endpoint - GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) - // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. - GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) - // Calculates fee options for intent entrypoint deposits. - GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) - // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. - GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) - GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) - QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) - // Marks an intent config as ready for processing by the execution worker. - QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) - // Returns current execution status (pending/processing/executed/failed) for a given intent config. - GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) - // Paginated listing of intent configs with optional execution status filtering. - ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) - // Processes relay transaction receipts to update intent execution status and trigger refund logic. - QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) -} - // // Client // const APIPathPrefix = "/rpc/API/" -type aPIClient struct { +type apiClient struct { client HTTPClient urls [19]string } @@ -797,13 +708,13 @@ func NewAPIClient(addr string, client HTTPClient) APIClient { prefix + "ListIntentConfigs", prefix + "QueueMetaTxnReceipt", } - return &aPIClient{ + return &apiClient{ client: client, urls: urls, } } -func (c *aPIClient) Ping(ctx context.Context) (bool, error) { +func (c *apiClient) Ping(ctx context.Context) (bool, error) { out := struct { Ret0 bool `json:"status"` }{} @@ -819,7 +730,7 @@ func (c *aPIClient) Ping(ctx context.Context) (bool, error) { return out.Ret0, err } -func (c *aPIClient) Version(ctx context.Context) (*Version, error) { +func (c *apiClient) Version(ctx context.Context) (*Version, error) { out := struct { Ret0 *Version `json:"version"` }{} @@ -835,7 +746,7 @@ func (c *aPIClient) Version(ctx context.Context) (*Version, error) { return out.Ret0, err } -func (c *aPIClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { +func (c *apiClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { out := struct { Ret0 *RuntimeStatus `json:"status"` }{} @@ -851,7 +762,7 @@ func (c *aPIClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { return out.Ret0, err } -func (c *aPIClient) Clock(ctx context.Context) (time.Time, error) { +func (c *apiClient) Clock(ctx context.Context) (time.Time, error) { out := struct { Ret0 time.Time `json:"serverTime"` }{} @@ -867,11 +778,10 @@ func (c *aPIClient) Clock(ctx context.Context) (time.Time, error) { return out.Ret0, err } -func (c *aPIClient) ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) { +func (c *apiClient) ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) { in := struct { Arg0 *CommitIntentConfigParams `json:"intent"` }{intent} - out := struct { Ret0 *IntentConfig `json:"config"` }{} @@ -887,11 +797,10 @@ func (c *aPIClient) ExecuteIntent(ctx context.Context, intent *CommitIntentConfi return out.Ret0, err } -func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) { +func (c *apiClient) GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) { in := struct { Arg0 *GetIntentCallsPayloadParams `json:"params"` }{params} - out := struct { Ret0 *IntentCallsPayloads `json:"payloads"` }{} @@ -907,11 +816,10 @@ func (c *aPIClient) GetIntentCallsPayloads(ctx context.Context, params *GetInten return out.Ret0, err } -func (c *aPIClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) { +func (c *apiClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) { in := struct { Arg0 *GetIntentsQuoteParams `json:"params"` }{params} - out := struct { Ret0 *IntentQuote `json:"quote"` }{} @@ -927,11 +835,10 @@ func (c *aPIClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuote return out.Ret0, err } -func (c *aPIClient) CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) { +func (c *apiClient) CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) { in := struct { Arg0 *CommitIntentConfigParams `json:"params"` }{params} - out := struct { Ret0 *IntentConfig `json:"config"` }{} @@ -947,11 +854,10 @@ func (c *aPIClient) CommitIntentConfig(ctx context.Context, params *CommitIntent return out.Ret0, err } -func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) { +func (c *apiClient) GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) { in := struct { Arg0 string `json:"intentAddress"` }{intentAddress} - out := struct { Ret0 *IntentConfig `json:"config"` }{} @@ -967,12 +873,11 @@ func (c *aPIClient) GetIntentConfig(ctx context.Context, intentAddress string) ( return out.Ret0, err } -func (c *aPIClient) GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) { +func (c *apiClient) GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) { in := struct { Arg0 string `json:"accountAddress"` Arg1 *Page `json:"page"` }{accountAddress, page} - out := struct { Ret0 *Page `json:"page"` Ret1 []*IntentTransaction `json:"transactions"` @@ -989,11 +894,10 @@ func (c *aPIClient) GetIntentTransactionHistory(ctx context.Context, accountAddr return out.Ret0, out.Ret1, err } -func (c *aPIClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) { +func (c *apiClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) { in := struct { Arg0 *GetIntentEntrypointDepositParams `json:"params"` }{params} - out := struct { Ret0 *GetIntentEntrypointDepositResult `json:"result"` }{} @@ -1009,11 +913,10 @@ func (c *aPIClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetI return out.Ret0, err } -func (c *aPIClient) GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) { +func (c *apiClient) GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) { in := struct { Arg0 *GetIntentEntrypointDepositFeeOptionsParams `json:"params"` }{params} - out := struct { Ret0 *GetIntentEntrypointDepositFeeOptionsResult `json:"result"` }{} @@ -1029,11 +932,10 @@ func (c *aPIClient) GetIntentEntrypointDepositFeeOptions(ctx context.Context, pa return out.Ret0, err } -func (c *aPIClient) GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) { +func (c *apiClient) GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) { in := struct { Arg0 *GetIntentEntrypointMessageHashParams `json:"params"` }{params} - out := struct { Ret0 string `json:"messageHash"` }{} @@ -1049,11 +951,10 @@ func (c *aPIClient) GetIntentEntrypointMessageHash(ctx context.Context, params * return out.Ret0, err } -func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) { +func (c *apiClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) { in := struct { Arg0 string `json:"id"` }{id} - out := struct { Ret0 *CCTPTransfer `json:"transfer"` }{} @@ -1069,14 +970,13 @@ func (c *aPIClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf return out.Ret0, err } -func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) { +func (c *apiClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) { in := struct { Arg0 *string `json:"sourceTxHash"` Arg1 *string `json:"metaTxHash"` Arg2 uint64 `json:"sourceChainId"` Arg3 uint64 `json:"destinationChainId"` }{sourceTxHash, metaTxHash, sourceChainId, destinationChainId} - out := struct { Ret0 *CCTPTransfer `json:"transfer"` }{} @@ -1092,11 +992,10 @@ func (c *aPIClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, return out.Ret0, err } -func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) { +func (c *apiClient) QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) { in := struct { Arg0 uint64 `json:"intentConfigId"` }{intentConfigId} - out := struct { Ret0 bool `json:"status"` }{} @@ -1112,11 +1011,10 @@ func (c *aPIClient) QueueIntentConfigExecution(ctx context.Context, intentConfig return out.Ret0, err } -func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) { +func (c *apiClient) GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) { in := struct { Arg0 uint64 `json:"intentConfigId"` }{intentConfigId} - out := struct { Ret0 string `json:"executionStatus"` }{} @@ -1132,12 +1030,11 @@ func (c *aPIClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo return out.Ret0, err } -func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) { +func (c *apiClient) ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) { in := struct { Arg0 *Page `json:"page"` Arg1 *string `json:"executionStatus"` }{page, executionStatus} - out := struct { Ret0 *Page `json:"page"` Ret1 []*IntentConfig `json:"intentConfigs"` @@ -1154,11 +1051,10 @@ func (c *aPIClient) ListIntentConfigs(ctx context.Context, page *Page, execution return out.Ret0, out.Ret1, err } -func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) { +func (c *apiClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) { in := struct { Arg0 string `json:"metaTxID"` }{metaTxID} - out := struct { Ret0 bool `json:"status"` }{} @@ -1174,6 +1070,10 @@ func (c *aPIClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b return out.Ret0, err } +// +// Client helpers +// + // 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. @@ -1293,7 +1193,7 @@ func HTTPRequestHeaders(ctx context.Context) (http.Header, bool) { } // -// Helpers +// Webrpc helpers // type method struct { @@ -1328,12 +1228,10 @@ func (k *contextKey) String() string { } var ( - HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} - HTTPRequestCtxKey = &contextKey{"HTTPRequest"} - - ServiceNameCtxKey = &contextKey{"ServiceName"} - - MethodNameCtxKey = &contextKey{"MethodName"} + HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} // client + HTTPRequestCtxKey = &contextKey{"HTTPRequest"} // server + ServiceNameCtxKey = &contextKey{"ServiceName"} // server + MethodNameCtxKey = &contextKey{"MethodName"} // server ) func ServiceNameFromContext(ctx context.Context) string { @@ -1464,3 +1362,62 @@ var ( ErrNotFound = WebRPCError{Code: 8000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400} ErrUnsupportedNetwork = WebRPCError{Code: 8008, Name: "UnsupportedNetwork", Message: "Unsupported network", HTTPStatus: 422} ) + +// +// Webrpc +// + +const WebrpcHeader = "Webrpc" + +const WebrpcHeaderValue = "webrpc@v0.29.0;gen-golang@v0.22.2;trails-api@v0.4.0" + +type WebrpcGenVersions struct { + WebrpcGenVersion string + CodeGenName string + CodeGenVersion string + SchemaName string + SchemaVersion string +} + +func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error) { + if h.Get(WebrpcHeader) == "" { + return nil, fmt.Errorf("header is empty or missing") + } + + versions, err := parseWebrpcGenVersions(h.Get(WebrpcHeader)) + if err != nil { + return nil, fmt.Errorf("webrpc header is invalid: %w", err) + } + + return versions, nil +} + +func parseWebrpcGenVersions(header string) (*WebrpcGenVersions, error) { + versions := strings.Split(header, ";") + if len(versions) < 3 { + return nil, fmt.Errorf("expected at least 3 parts while parsing webrpc header: %v", header) + } + + _, webrpcGenVersion, ok := strings.Cut(versions[0], "@") + if !ok { + return nil, fmt.Errorf("webrpc gen version could not be parsed from: %s", versions[0]) + } + + tmplTarget, tmplVersion, ok := strings.Cut(versions[1], "@") + if !ok { + return nil, fmt.Errorf("tmplTarget and tmplVersion could not be parsed from: %s", versions[1]) + } + + schemaName, schemaVersion, ok := strings.Cut(versions[2], "@") + if !ok { + return nil, fmt.Errorf("schema name and schema version could not be parsed from: %s", versions[2]) + } + + return &WebrpcGenVersions{ + WebrpcGenVersion: webrpcGenVersion, + CodeGenName: tmplTarget, + CodeGenVersion: tmplVersion, + SchemaName: schemaName, + SchemaVersion: schemaVersion, + }, nil +} From e95b4fba022dcc0d9651355b3123fd0ea081a44d Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:24:01 +0000 Subject: [PATCH 15/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 74 +++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 13d39a3e..1bbe62d9 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 debf6c73d2e0a7dbf749261baedad6291eedafab +// trails-api v0.4.0 30a311cd323c194a46ebd96b217d6b6be1007672 // -- // Code generated by webrpc-gen@v0.29.0 with golang generator. DO NOT EDIT. // @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "debf6c73d2e0a7dbf749261baedad6291eedafab" + return "30a311cd323c194a46ebd96b217d6b6be1007672" } // @@ -77,6 +77,57 @@ type APIClient interface { // Schema types // +type ExecutionStatus uint8 + +const ( + ExecutionStatus_created ExecutionStatus = 0 + ExecutionStatus_pending ExecutionStatus = 1 + ExecutionStatus_processing ExecutionStatus = 2 + ExecutionStatus_executed ExecutionStatus = 3 + ExecutionStatus_failed ExecutionStatus = 4 +) + +var ExecutionStatus_name = map[uint8]string{ + 0: "created", + 1: "pending", + 2: "processing", + 3: "executed", + 4: "failed", +} + +var ExecutionStatus_value = map[string]uint8{ + "created": 0, + "pending": 1, + "processing": 2, + "executed": 3, + "failed": 4, +} + +func (x ExecutionStatus) String() string { + return ExecutionStatus_name[uint8(x)] +} + +func (x ExecutionStatus) MarshalText() ([]byte, error) { + return []byte(ExecutionStatus_name[uint8(x)]), nil +} + +func (x *ExecutionStatus) UnmarshalText(b []byte) error { + *x = ExecutionStatus(ExecutionStatus_value[string(b)]) + return nil +} + +func (x *ExecutionStatus) Is(values ...ExecutionStatus) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + type SortOrder uint32 const ( @@ -196,18 +247,23 @@ type IntentCallsPayload struct { // IntentConfig type IntentConfig struct { - ID uint64 `json:"id" db:"id,omitempty"` + ID uint64 `json:"id" db:"id,omitempty"` + // TODO: This field/column seems to be unused in dev/prod DBs. ConfigHash prototyp.Hash `json:"configHash" db:"config_hash"` OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"destination_intent_address"` MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` Calls prototyp.JSONString `json:"calls" db:"calls"` Preconditions prototyp.JSONString `json:"preconditions" db:"preconditions"` - ExecutionStatus *string `json:"executionStatus" db:"execution_status,omitempty"` - MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` - TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` + ExecutionStatus ExecutionStatus `json:"executionStatus" db:"execution_status,omitempty"` + // TODO: This field/column seems to be unused in dev/prod DBs. + MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` + // TODO: This field/column seems to be unused in dev/prod DBs. + TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` + ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` + RetryCount uint64 `json:"retryCount" db:"retry_count"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } // IntentTransaction represents a transaction that went through the intent machine @@ -217,7 +273,7 @@ type IntentTransaction struct { MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` - ExecutionStatus *string `json:"executionStatus" db:"execution_status,omitempty"` + ExecutionStatus ExecutionStatus `json:"executionStatus" db:"execution_status,omitempty"` OriginChainID *uint64 `json:"originChainId"` DestinationChainID *uint64 `json:"destinationChainId"` OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` From f1240e99a253444462de8008b91522dbbdf48654 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 23 Oct 2025 22:14:10 +0000 Subject: [PATCH 16/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 1bbe62d9..d8a5ebc4 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 30a311cd323c194a46ebd96b217d6b6be1007672 +// trails-api v0.4.0 1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648 // -- // Code generated by webrpc-gen@v0.29.0 with golang generator. DO NOT EDIT. // @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "30a311cd323c194a46ebd96b217d6b6be1007672" + return "1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648" } // @@ -207,12 +207,13 @@ type Version struct { type RuntimeStatus struct { // overall status, true/false - HealthOK bool `json:"healthOK"` - StartTime time.Time `json:"startTime"` - Uptime uint64 `json:"uptime"` - Ver string `json:"ver"` - Branch string `json:"branch"` - CommitHash string `json:"commitHash"` + HealthOK bool `json:"healthOK"` + StartTime time.Time `json:"startTime"` + Uptime uint64 `json:"uptime"` + Ver string `json:"ver"` + Branch string `json:"branch"` + CommitHash string `json:"commitHash"` + Runnables interface{} `json:"runnables"` } // From: `0xsequence/relayer`: https://github.com/0xsequence/relayer/blob/2c695b820970c68c57bfe71810f469412cdec675/proto/relayer.ridl#L502 From 01c57b797b04f3b910bf6484ead33d9108ba9a7a Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 24 Oct 2025 01:39:55 +0000 Subject: [PATCH 17/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index d8a5ebc4..ab73ff9a 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ -// trails-api v0.4.0 1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648 +// trails-api v0.4.0 36e1205943d9f99bcfd7d279a67514ac8869ec84 // -- -// Code generated by webrpc-gen@v0.29.0 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.30.1 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648" + return "36e1205943d9f99bcfd7d279a67514ac8869ec84" } // @@ -47,18 +47,26 @@ type APIClient interface { // TODO: a lot of overlap with IntentConfig and other stuff.. ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. + // TODOXXX: rename to SolveIntent GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) + // TODOXXX: remove GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) + // TODOXXX: ExecuteIntent // Persists intent configuration details to database for later execution, creating a new intent config record. CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) + // TODOXXX: GetIntentDetails .. or another name..? // Retrieves stored intent configuration by wallet address for inspection or execution. GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) + // TODOXXX: keep the name! // Intent transaction history endpoint GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) + // TODOXXX: rename to GetIntentEntryTransaction // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) + // TODOXXX: rename to GetIntentGasFeeOptions // Calculates fee options for intent entrypoint deposits. GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) + // TODOXXX: remove completely // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) @@ -198,6 +206,16 @@ func (x *TradeType) Is(values ...TradeType) bool { return false } +type Transaction struct { + // TODO......... + Todo string `json:"todo"` +} + +type IntentReceipt struct { + // TODO ......... + Todo string `json:"todo"` +} + type Version struct { WebrpcVersion string `json:"webrpcVersion"` SchemaVersion string `json:"schemaVersion"` @@ -1320,6 +1338,9 @@ func MethodCtx(ctx context.Context) (method, bool) { return m, true } +// PtrTo is a useful helper when constructing values for optional fields. +func PtrTo[T any](v T) *T { return &v } + // // Errors // @@ -1426,7 +1447,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.29.0;gen-golang@v0.22.2;trails-api@v0.4.0" +const WebrpcHeaderValue = "webrpc@v0.30.1;gen-golang@v0.23.1;trails-api@v0.4.0" type WebrpcGenVersions struct { WebrpcGenVersion string From 88db19c2e4a0e1f963f5dc78233e92f9b76c8ac8 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:47:33 +0000 Subject: [PATCH 18/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 43 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index ab73ff9a..8057b7c8 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 36e1205943d9f99bcfd7d279a67514ac8869ec84 +// trails-api v0.4.0 563242406b1457bb583d99d0c76c9e75e3f3b3f3 // -- // Code generated by webrpc-gen@v0.30.1 with golang generator. DO NOT EDIT. // @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "36e1205943d9f99bcfd7d279a67514ac8869ec84" + return "563242406b1457bb583d99d0c76c9e75e3f3b3f3" } // @@ -72,9 +72,9 @@ type APIClient interface { GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) // Marks an intent config as ready for processing by the execution worker. - QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) + QueueIntentConfigExecution(ctx context.Context, intentConfigId string) (bool, error) // Returns current execution status (pending/processing/executed/failed) for a given intent config. - GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) + GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId string) (string, error) // Paginated listing of intent configs with optional execution status filtering. ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) // Processes relay transaction receipts to update intent execution status and trigger refund logic. @@ -266,7 +266,10 @@ type IntentCallsPayload struct { // IntentConfig type IntentConfig struct { - ID uint64 `json:"id" db:"id,omitempty"` + // id is an internal-only sequential primary key. + ID uint64 `json:"-" db:"id,omitempty"` + // intentId is a deterministic public intent identifier. + IntentID prototyp.Hash `json:"intentId" db:"intent_id"` // TODO: This field/column seems to be unused in dev/prod DBs. ConfigHash prototyp.Hash `json:"configHash" db:"config_hash"` OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` @@ -275,14 +278,14 @@ type IntentConfig struct { Calls prototyp.JSONString `json:"calls" db:"calls"` Preconditions prototyp.JSONString `json:"preconditions" db:"preconditions"` ExecutionStatus ExecutionStatus `json:"executionStatus" db:"execution_status,omitempty"` - // TODO: This field/column seems to be unused in dev/prod DBs. - MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` - // TODO: This field/column seems to be unused in dev/prod DBs. - TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` - ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` - RetryCount uint64 `json:"retryCount" db:"retry_count"` - UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` + OriginMetaTxnID prototyp.Hash `json:"originMetaTxnId" db:"origin_meta_txn_id,omitempty"` + DestinationMetaTxnID prototyp.Hash `json:"destinationMetaTxnId" db:"destination_meta_txn_id,omitempty"` + OriginTxnHash prototyp.Hash `json:"originTxnHash" db:"origin_txn_hash,omitempty"` + DestinationTxnHash prototyp.Hash `json:"destinationTxnHash" db:"destination_txn_hash,omitempty"` + ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` + RetryCount uint64 `json:"retryCount" db:"retry_count"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } // IntentTransaction represents a transaction that went through the intent machine @@ -290,8 +293,10 @@ type IntentTransaction struct { OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"destination_intent_address"` MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` - MetaTxnID *string `json:"metaTxnId" db:"meta_txn_id,omitempty"` - TxnHash *string `json:"txnHash" db:"txn_hash,omitempty"` + OriginMetaTxnID prototyp.Hash `json:"originMetaTxnId" db:"origin_meta_txn_id,omitempty"` + DestinationMetaTxnID prototyp.Hash `json:"destinationMetaTxnId" db:"destination_meta_txn_id,omitempty"` + OriginTxnHash prototyp.Hash `json:"originTxnHash" db:"origin_txn_hash,omitempty"` + DestinationTxnHash prototyp.Hash `json:"destinationTxnHash" db:"destination_txn_hash,omitempty"` ExecutionStatus ExecutionStatus `json:"executionStatus" db:"execution_status,omitempty"` OriginChainID *uint64 `json:"originChainId"` DestinationChainID *uint64 `json:"destinationChainId"` @@ -1067,9 +1072,9 @@ func (c *apiClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, return out.Ret0, err } -func (c *apiClient) QueueIntentConfigExecution(ctx context.Context, intentConfigId uint64) (bool, error) { +func (c *apiClient) QueueIntentConfigExecution(ctx context.Context, intentConfigId string) (bool, error) { in := struct { - Arg0 uint64 `json:"intentConfigId"` + Arg0 string `json:"intentConfigId"` }{intentConfigId} out := struct { Ret0 bool `json:"status"` @@ -1086,9 +1091,9 @@ func (c *apiClient) QueueIntentConfigExecution(ctx context.Context, intentConfig return out.Ret0, err } -func (c *apiClient) GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId uint64) (string, error) { +func (c *apiClient) GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId string) (string, error) { in := struct { - Arg0 uint64 `json:"intentConfigId"` + Arg0 string `json:"intentConfigId"` }{intentConfigId} out := struct { Ret0 string `json:"executionStatus"` From 50c0992c65367616eb43a2c2da7eccffc5584cd7 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 28 Oct 2025 00:10:23 +0000 Subject: [PATCH 19/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 74 +++++++++--------------------------- 1 file changed, 18 insertions(+), 56 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 8057b7c8..29501552 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v0.4.0 563242406b1457bb583d99d0c76c9e75e3f3b3f3 +// trails-api v0.4.0 983d4771af81d7ad7880e614060edf7a542f0ddd // -- // Code generated by webrpc-gen@v0.30.1 with golang generator. DO NOT EDIT. // @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "563242406b1457bb583d99d0c76c9e75e3f3b3f3" + return "983d4771af81d7ad7880e614060edf7a542f0ddd" } // @@ -44,8 +44,6 @@ type APIClient interface { Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) - // TODO: a lot of overlap with IntentConfig and other stuff.. - ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. // TODOXXX: rename to SolveIntent GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) @@ -206,16 +204,6 @@ func (x *TradeType) Is(values ...TradeType) bool { return false } -type Transaction struct { - // TODO......... - Todo string `json:"todo"` -} - -type IntentReceipt struct { - // TODO ......... - Todo string `json:"todo"` -} - type Version struct { WebrpcVersion string `json:"webrpcVersion"` SchemaVersion string `json:"schemaVersion"` @@ -644,11 +632,6 @@ var methods = map[string]method{ service: "API", annotations: map[string]string{}, }, - "/rpc/API/ExecuteIntent": { - name: "ExecuteIntent", - service: "API", - annotations: map[string]string{}, - }, "/rpc/API/GetIntentCallsPayloads": { name: "GetIntentCallsPayloads", service: "API", @@ -736,7 +719,6 @@ var WebRPCServices = map[string][]string{ "Version", "RuntimeStatus", "Clock", - "ExecuteIntent", "GetIntentCallsPayloads", "GetIntentsQuote", "CommitIntentConfig", @@ -762,17 +744,16 @@ const APIPathPrefix = "/rpc/API/" type apiClient struct { client HTTPClient - urls [19]string + urls [18]string } func NewAPIClient(addr string, client HTTPClient) APIClient { prefix := urlBase(addr) + APIPathPrefix - urls := [19]string{ + urls := [18]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", prefix + "Clock", - prefix + "ExecuteIntent", prefix + "GetIntentCallsPayloads", prefix + "GetIntentsQuote", prefix + "CommitIntentConfig", @@ -858,25 +839,6 @@ func (c *apiClient) Clock(ctx context.Context) (time.Time, error) { return out.Ret0, err } -func (c *apiClient) ExecuteIntent(ctx context.Context, intent *CommitIntentConfigParams) (*IntentConfig, error) { - in := struct { - Arg0 *CommitIntentConfigParams `json:"intent"` - }{intent} - out := struct { - Ret0 *IntentConfig `json:"config"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, err -} - func (c *apiClient) GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) { in := struct { Arg0 *GetIntentCallsPayloadParams `json:"params"` @@ -885,7 +847,7 @@ func (c *apiClient) GetIntentCallsPayloads(ctx context.Context, params *GetInten Ret0 *IntentCallsPayloads `json:"payloads"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -904,7 +866,7 @@ func (c *apiClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuote Ret0 *IntentQuote `json:"quote"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -923,7 +885,7 @@ func (c *apiClient) CommitIntentConfig(ctx context.Context, params *CommitIntent Ret0 *IntentConfig `json:"config"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -942,7 +904,7 @@ func (c *apiClient) GetIntentConfig(ctx context.Context, intentAddress string) ( Ret0 *IntentConfig `json:"config"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -963,7 +925,7 @@ func (c *apiClient) GetIntentTransactionHistory(ctx context.Context, accountAddr Ret1 []*IntentTransaction `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -982,7 +944,7 @@ func (c *apiClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetI Ret0 *GetIntentEntrypointDepositResult `json:"result"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1001,7 +963,7 @@ func (c *apiClient) GetIntentEntrypointDepositFeeOptions(ctx context.Context, pa Ret0 *GetIntentEntrypointDepositFeeOptionsResult `json:"result"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1020,7 +982,7 @@ func (c *apiClient) GetIntentEntrypointMessageHash(ctx context.Context, params * Ret0 string `json:"messageHash"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1039,7 +1001,7 @@ func (c *apiClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1061,7 +1023,7 @@ func (c *apiClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, Ret0 *CCTPTransfer `json:"transfer"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1080,7 +1042,7 @@ func (c *apiClient) QueueIntentConfigExecution(ctx context.Context, intentConfig Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1099,7 +1061,7 @@ func (c *apiClient) GetIntentConfigExecutionStatus(ctx context.Context, intentCo Ret0 string `json:"executionStatus"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1120,7 +1082,7 @@ func (c *apiClient) ListIntentConfigs(ctx context.Context, page *Page, execution Ret1 []*IntentConfig `json:"intentConfigs"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1139,7 +1101,7 @@ func (c *apiClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (b Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { From 735e3510f778f307cdf2d62654fd9c40ed2ba62f Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 29 Oct 2025 20:24:17 +0000 Subject: [PATCH 20/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 1440 +++++++++++++++++++--------------- 1 file changed, 817 insertions(+), 623 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 29501552..fd548789 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,17 +1,19 @@ -// trails-api v0.4.0 983d4771af81d7ad7880e614060edf7a542f0ddd +// trails-api v1.0.0 d77c84a0d98b34c7e6d3a9810cc8819aee40b978 // -- -// Code generated by webrpc-gen@v0.30.1 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // -// webrpc-gen -schema=api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go +// webrpc-gen -schema=trails-api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api import ( "bytes" "context" + "database/sql/driver" "encoding/json" "errors" "fmt" "io" + "math/big" "net/http" "net/url" "strings" @@ -27,102 +29,85 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v0.4.0" + return "v1.0.0" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "983d4771af81d7ad7880e614060edf7a542f0ddd" + return "d77c84a0d98b34c7e6d3a9810cc8819aee40b978" } // // Client interface // -type APIClient interface { +type TrailsClient interface { Ping(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) Clock(ctx context.Context) (time.Time, error) - // Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. - // TODOXXX: rename to SolveIntent - GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) - // TODOXXX: remove - GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) - // TODOXXX: ExecuteIntent - // Persists intent configuration details to database for later execution, creating a new intent config record. - CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) - // TODOXXX: GetIntentDetails .. or another name..? - // Retrieves stored intent configuration by wallet address for inspection or execution. - GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) - // TODOXXX: keep the name! - // Intent transaction history endpoint - GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) - // TODOXXX: rename to GetIntentEntryTransaction - // Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. - GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) - // TODOXXX: rename to GetIntentGasFeeOptions - // Calculates fee options for intent entrypoint deposits. - GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) - // TODOXXX: remove completely - // Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. - GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) - GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) - QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) - // Marks an intent config as ready for processing by the execution worker. - QueueIntentConfigExecution(ctx context.Context, intentConfigId string) (bool, error) - // Returns current execution status (pending/processing/executed/failed) for a given intent config. - GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId string) (string, error) - // Paginated listing of intent configs with optional execution status filtering. - ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) - // Processes relay transaction receipts to update intent execution status and trigger refund logic. - QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, 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) + GetIntentTransactionHistory(ctx context.Context, getIntentTransactionHistoryRequest GetIntentTransactionHistoryRequest) (*GetIntentTransactionHistoryResponse, error) + GetIntentGasFeeOptions(ctx context.Context, getIntentGasFeeOptionsRequest GetIntentGasFeeOptionsRequest) (*GetIntentGasFeeOptionsResponse, error) + GetIntentEntryTransaction(ctx context.Context, getIntentEntryTransactionRequest GetIntentEntryTransactionRequest) (*GetIntentEntryTransactionResponse, error) } // // Schema types // -type ExecutionStatus uint8 +type TradeType string const ( - ExecutionStatus_created ExecutionStatus = 0 - ExecutionStatus_pending ExecutionStatus = 1 - ExecutionStatus_processing ExecutionStatus = 2 - ExecutionStatus_executed ExecutionStatus = 3 - ExecutionStatus_failed ExecutionStatus = 4 + TradeType_EXACT_INPUT TradeType = "EXACT_INPUT" + TradeType_EXACT_OUTPUT TradeType = "EXACT_OUTPUT" ) -var ExecutionStatus_name = map[uint8]string{ - 0: "created", - 1: "pending", - 2: "processing", - 3: "executed", - 4: "failed", +func (x TradeType) MarshalText() ([]byte, error) { + return []byte(x), nil } -var ExecutionStatus_value = map[string]uint8{ - "created": 0, - "pending": 1, - "processing": 2, - "executed": 3, - "failed": 4, +func (x *TradeType) UnmarshalText(b []byte) error { + *x = TradeType(string(b)) + return nil } -func (x ExecutionStatus) String() string { - return ExecutionStatus_name[uint8(x)] +func (x *TradeType) Is(values ...TradeType) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false } -func (x ExecutionStatus) MarshalText() ([]byte, error) { - return []byte(ExecutionStatus_name[uint8(x)]), nil +type QuoteProviderType string + +const ( + QuoteProviderType_RELAY QuoteProviderType = "RELAY" + QuoteProviderType_CCTPV2 QuoteProviderType = "CCTPV2" + QuoteProviderType_LIFI QuoteProviderType = "LIFI" +) + +func (x QuoteProviderType) MarshalText() ([]byte, error) { + return []byte(x), nil } -func (x *ExecutionStatus) UnmarshalText(b []byte) error { - *x = ExecutionStatus(ExecutionStatus_value[string(b)]) +func (x *QuoteProviderType) UnmarshalText(b []byte) error { + *x = QuoteProviderType(string(b)) return nil } -func (x *ExecutionStatus) Is(values ...ExecutionStatus) bool { +func (x *QuoteProviderType) Is(values ...QuoteProviderType) bool { if x == nil { return false } @@ -134,37 +119,43 @@ func (x *ExecutionStatus) Is(values ...ExecutionStatus) bool { return false } -type SortOrder uint32 +type TransactionStatus uint8 const ( - SortOrder_DESC SortOrder = 0 - SortOrder_ASC SortOrder = 1 + TransactionStatus_PENDING TransactionStatus = 0 + TransactionStatus_PROCESSING TransactionStatus = 1 + TransactionStatus_FAILED TransactionStatus = 2 + TransactionStatus_SUCCEEDED TransactionStatus = 3 ) -var SortOrder_name = map[uint32]string{ - 0: "DESC", - 1: "ASC", +var TransactionStatus_name = map[uint8]string{ + 0: "PENDING", + 1: "PROCESSING", + 2: "FAILED", + 3: "SUCCEEDED", } -var SortOrder_value = map[string]uint32{ - "DESC": 0, - "ASC": 1, +var TransactionStatus_value = map[string]uint8{ + "PENDING": 0, + "PROCESSING": 1, + "FAILED": 2, + "SUCCEEDED": 3, } -func (x SortOrder) String() string { - return SortOrder_name[uint32(x)] +func (x TransactionStatus) String() string { + return TransactionStatus_name[uint8(x)] } -func (x SortOrder) MarshalText() ([]byte, error) { - return []byte(SortOrder_name[uint32(x)]), nil +func (x TransactionStatus) MarshalText() ([]byte, error) { + return []byte(TransactionStatus_name[uint8(x)]), nil } -func (x *SortOrder) UnmarshalText(b []byte) error { - *x = SortOrder(SortOrder_value[string(b)]) +func (x *TransactionStatus) UnmarshalText(b []byte) error { + *x = TransactionStatus(TransactionStatus_value[string(b)]) return nil } -func (x *SortOrder) Is(values ...SortOrder) bool { +func (x *TransactionStatus) Is(values ...TransactionStatus) bool { if x == nil { return false } @@ -176,23 +167,46 @@ func (x *SortOrder) Is(values ...SortOrder) bool { return false } -type TradeType string +type IntentStatus uint8 const ( - TradeType_EXACT_INPUT TradeType = "EXACT_INPUT" - TradeType_EXACT_OUTPUT TradeType = "EXACT_OUTPUT" + IntentStatus_SOLVED IntentStatus = 0 + IntentStatus_COMMITTED IntentStatus = 1 + IntentStatus_EXECUTING IntentStatus = 2 + IntentStatus_FAILED IntentStatus = 3 + IntentStatus_SUCCEEDED IntentStatus = 4 ) -func (x TradeType) MarshalText() ([]byte, error) { - return []byte(x), nil +var IntentStatus_name = map[uint8]string{ + 0: "SOLVED", + 1: "COMMITTED", + 2: "EXECUTING", + 3: "FAILED", + 4: "SUCCEEDED", } -func (x *TradeType) UnmarshalText(b []byte) error { - *x = TradeType(string(b)) +var IntentStatus_value = map[string]uint8{ + "SOLVED": 0, + "COMMITTED": 1, + "EXECUTING": 2, + "FAILED": 3, + "SUCCEEDED": 4, +} + +func (x IntentStatus) String() string { + return IntentStatus_name[uint8(x)] +} + +func (x IntentStatus) MarshalText() ([]byte, error) { + return []byte(IntentStatus_name[uint8(x)]), nil +} + +func (x *IntentStatus) UnmarshalText(b []byte) error { + *x = IntentStatus(IntentStatus_value[string(b)]) return nil } -func (x *TradeType) Is(values ...TradeType) bool { +func (x *IntentStatus) Is(values ...IntentStatus) bool { if x == nil { return false } @@ -204,38 +218,104 @@ func (x *TradeType) Is(values ...TradeType) bool { return false } -type Version struct { - WebrpcVersion string `json:"webrpcVersion"` - SchemaVersion string `json:"schemaVersion"` - SchemaHash string `json:"schemaHash"` - AppVersion string `json:"appVersion"` +type ChainGasUsageStatus string + +const ( + ChainGasUsageStatus_NORMAL ChainGasUsageStatus = "NORMAL" + ChainGasUsageStatus_BUSY ChainGasUsageStatus = "BUSY" + ChainGasUsageStatus_VERY_BUSY ChainGasUsageStatus = "VERY_BUSY" +) + +func (x ChainGasUsageStatus) MarshalText() ([]byte, error) { + return []byte(x), nil } -type RuntimeStatus struct { - // overall status, true/false - HealthOK bool `json:"healthOK"` - StartTime time.Time `json:"startTime"` - Uptime uint64 `json:"uptime"` - Ver string `json:"ver"` - Branch string `json:"branch"` - CommitHash string `json:"commitHash"` - Runnables interface{} `json:"runnables"` +func (x *ChainGasUsageStatus) UnmarshalText(b []byte) error { + *x = ChainGasUsageStatus(string(b)) + return nil } -// From: `0xsequence/relayer`: https://github.com/0xsequence/relayer/blob/2c695b820970c68c57bfe71810f469412cdec675/proto/relayer.ridl#L502 -// TODO: rename this to MetaTxnRaw (eventually), we can leave it for now to not break compat -// or name it, MetaTxnArgs ..? -type MetaTxn struct { - ID string `json:"id"` - ChainId prototyp.BigInt `json:"chainId"` - WalletAddress string `json:"walletAddress" db:"wallet_address"` - // TODO (later): rename this to `to: string` - Contract string `json:"contract" db:"to_address"` - // TODO: rename to 'execdata' - Input string `json:"input" db:"tx_data"` +func (x *ChainGasUsageStatus) Is(values ...ChainGasUsageStatus) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false } -type Call struct { +// User goal prior to solving/quoting, aka the intent request. +// +// NOTE: was previously named GetIntentCallsPayloadParams +// +// ............ +type QuoteIntentRequest struct { + OwnerAddress prototyp.Hash `json:"ownerAddress"` + OriginChainID uint64 `json:"originChainId"` + OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` + // TODOXXX: remove this + OriginTokenAmount *prototyp.BigInt `json:"originTokenAmount"` + DestinationChainID uint64 `json:"destinationChainId"` + DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` + DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` + DestinationToAddress prototyp.Hash `json:"destinationToAddress"` + DestinationCallData *string `json:"destinationCallData"` + DestinationCallValue *string `json:"destinationCallValue"` + // NOTE: EXACT_OUTPUT is the default if unspecified + TradeType *TradeType `json:"tradeType"` + Options *QuoteIntentRequestOptions `json:"options"` +} + +type QuoteIntentRequestOptions struct { + QuoteProvider *QuoteProviderType `json:"quoteProvider"` + SlippageTolerance *float64 `json:"slippageTolerance"` + TrailsAddressOverrides *TrailsAddressOverrides `json:"trailsAddressOverrides"` +} + +// Fully formed/quoted/solved, executable intent. +// +// NOTE: was previously named IntentCallsPayloads, and as well IntentConfig +// was pretty much the same thing too, so consolidated into a single type. +// +// db table: 'intents' +type Intent struct { + // id is an internal-only sequential primary key. + ID uint64 `json:"-" db:"id,omitempty"` + // 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"` + OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"orig_intent_address"` + DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"dest_intent_address"` + DestinationSalt prototyp.BigInt `json:"destinationSalt" db:"destination_salt"` + Calls []*IntentCalls `json:"calls" db:"calls"` + Preconditions []*IntentPrecondition `json:"preconditions" db:"preconditions"` + MetaTxns []*MetaTxn `json:"metaTxns" db:"meta_txns"` + Quote *IntentProviderQuote `json:"quote" db:"quote"` + Fees *IntentFees `json:"fees" db:"fees"` + ExecutedAt *time.Time `json:"executedAt,omitempty" db:"executed_at,omitempty"` + 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"` +} + +// NOTE: was previously named IntentCallsPayload +type IntentCalls struct { + ChainID uint64 `json:"chainId"` + Space prototyp.BigInt `json:"space"` + Nonce prototyp.BigInt `json:"nonce"` + Calls []*TransactionCall `json:"calls"` +} + +type TransactionCall struct { To prototyp.Hash `json:"to"` Value prototyp.BigInt `json:"value"` Data prototyp.Hash `json:"data"` @@ -245,85 +325,11 @@ type Call struct { BehaviorOnError *uint8 `json:"behaviorOnError"` } -type IntentCallsPayload struct { - ChainId prototyp.BigInt `json:"chainId"` - Space prototyp.BigInt `json:"space"` - Nonce prototyp.BigInt `json:"nonce"` - Calls []*Call `json:"calls"` -} - -// IntentConfig -type IntentConfig struct { - // id is an internal-only sequential primary key. - ID uint64 `json:"-" db:"id,omitempty"` - // intentId is a deterministic public intent identifier. - IntentID prototyp.Hash `json:"intentId" db:"intent_id"` - // TODO: This field/column seems to be unused in dev/prod DBs. - ConfigHash prototyp.Hash `json:"configHash" db:"config_hash"` - OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` - DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"destination_intent_address"` - MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` - Calls prototyp.JSONString `json:"calls" db:"calls"` - Preconditions prototyp.JSONString `json:"preconditions" db:"preconditions"` - ExecutionStatus ExecutionStatus `json:"executionStatus" db:"execution_status,omitempty"` - OriginMetaTxnID prototyp.Hash `json:"originMetaTxnId" db:"origin_meta_txn_id,omitempty"` - DestinationMetaTxnID prototyp.Hash `json:"destinationMetaTxnId" db:"destination_meta_txn_id,omitempty"` - OriginTxnHash prototyp.Hash `json:"originTxnHash" db:"origin_txn_hash,omitempty"` - DestinationTxnHash prototyp.Hash `json:"destinationTxnHash" db:"destination_txn_hash,omitempty"` - ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` - RetryCount uint64 `json:"retryCount" db:"retry_count"` - UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` -} - -// IntentTransaction represents a transaction that went through the intent machine -type IntentTransaction struct { - OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"origin_intent_address"` - DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"destination_intent_address"` - MainSigner prototyp.Hash `json:"mainSigner" db:"main_signer"` - OriginMetaTxnID prototyp.Hash `json:"originMetaTxnId" db:"origin_meta_txn_id,omitempty"` - DestinationMetaTxnID prototyp.Hash `json:"destinationMetaTxnId" db:"destination_meta_txn_id,omitempty"` - OriginTxnHash prototyp.Hash `json:"originTxnHash" db:"origin_txn_hash,omitempty"` - DestinationTxnHash prototyp.Hash `json:"destinationTxnHash" db:"destination_txn_hash,omitempty"` - ExecutionStatus ExecutionStatus `json:"executionStatus" db:"execution_status,omitempty"` - OriginChainID *uint64 `json:"originChainId"` - DestinationChainID *uint64 `json:"destinationChainId"` - OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` - OriginTokenAmount prototyp.BigInt `json:"originTokenAmount"` - DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` - DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` - DestinationToAddress prototyp.Hash `json:"destinationToAddress"` - CreatedAt *string `json:"createdAt"` -} - -// MetaTxnReceipt -type MetaTxnReceipt struct { - MetaTxID string `json:"metaTxID" db:"meta_tx_id"` - Status string `json:"status" db:"status"` - TxnReceipt *string `json:"txnReceipt" db:"txn_receipt"` - RevertReason *string `json:"revertReason" db:"revert_reason"` -} - -type AddressOverrides struct { - SequenceWalletFactoryAddress *string `json:"sequenceWalletFactoryAddress"` - SequenceWalletMainModuleAddress *string `json:"sequenceWalletMainModuleAddress"` - SequenceWalletMainModuleUpgradableAddress *string `json:"sequenceWalletMainModuleUpgradableAddress"` - SequenceWalletGuestModuleAddress *string `json:"sequenceWalletGuestModuleAddress"` - SequenceWalletUtilsAddress *string `json:"sequenceWalletUtilsAddress"` -} - -type OriginCall struct { - ChainId prototyp.BigInt `json:"chainId"` - To string `json:"to"` - TransactionData string `json:"transactionData"` - TransactionValue prototyp.BigInt `json:"transactionValue"` -} - // TODO: fix this.. it should adhere to 7795, which it does not. type IntentPrecondition struct { // TODO: should be erc20MinAllowance Type string `json:"type"` - ChainId prototyp.BigInt `json:"chainId"` + ChainID uint64 `json:"chainId"` Data *IntentPreconditionData `json:"data"` } @@ -336,21 +342,180 @@ type IntentPrecondition struct { type IntentPreconditionData struct { Address string `json:"address"` Token string `json:"token"` - // TODOXXX: this probably should be a hex string.. what does ERC + // TODOXXX: this probably should be a hex string.. what does ERC, should be string and prototyp.Hash Min uint64 `json:"min"` } -type Token struct { - ChainId uint64 `json:"chainId"` - ContractAddress prototyp.Hash `json:"contractAddress"` - TokenId *string `json:"tokenId"` +// MetaTxn is a meta-transaction to be submitted to Sequence Relayer. +// +// From: `0xsequence/relayer`: https://github.com/0xsequence/relayer/blob/2c695b820970c68c57bfe71810f469412cdec675/proto/relayer.ridl#L502 +// TODO: rename this to MetaTxnRaw (eventually), we can leave it for now to not break compat +// or name it, MetaTxnArgs ..? +// +// NOTE: this was previously named MetaTxn +type MetaTxn struct { + ID string `json:"id"` + ChainID uint64 `json:"chainId"` + // TODO: rename this to 'from: string' ? + WalletAddress string `json:"walletAddress" db:"wallet_address"` + // TODO (later): rename this to `to: string` + Contract string `json:"contract" db:"to_address"` + // TODO: rename to 'execdata' ? + Input string `json:"input" db:"tx_data"` } -type Price struct { - Value float64 `json:"value"` - Currency string `json:"currency"` +// 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. +// +// NOTE: this was previously named IntentTransaction +// +// TODO: this type still needs some review.. for example, I wonder if we should have +// Intent or IntentReceipt split out the differrent transactions per chain as separate +// rows, instead of having it be consolidated.. I kinda prefer having them separate, +// but it could mean we have a new type called IntentTransaction which is that..? +// +// db table: 'intent_receipts' +type IntentReceipt struct { + // id is an internal-only sequential primary key. + ID uint64 `json:"-" db:"id,omitempty"` + // 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"` + // 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 + TransferTransactionHash prototyp.Hash `json:"transferTransactionHash" db:"transfer_txn_hash"` + TransferTransactionStatus TransactionStatus `json:"transferTransactionStatus" db:"transfer_txn_status"` + // 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 + DestinationTransactionID uint64 `json:"-" db:"dest_txn_id"` + DestinationTransaction *IntentTransaction `json:"destinationTransaction" db:"-"` + // Worker fields for tracking background processing + ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` + RetryCount *uint32 `json:"retryCount" db:"retry_count,omitempty"` + // timestamp when the intent receipt was updated, usually from status change + UpdatedAt *string `json:"updatedAt" db:"updated_at,omitempty"` + // timestamp of when the intent receipt was created + CreatedAt *string `json:"createdAt" db:"created_at,omitempty"` +} + +// IntentTransaction represents a single transaction within an intent's execution flow. +// +// db table: 'intent_transactions' +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"` + // Chain where this transaction executes + ChainID uint64 `json:"chainId" db:"chain_id"` + MetaTxnID prototyp.Hash `json:"metaTxnId" db:"meta_txn_id"` + // Transaction hash for this specific transaction + TxnHash prototyp.Hash `json:"txnHash" db:"txn_hash,omitempty"` + // Recipient address (aka, the intentAddress) + 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"` + // TODO: how about calldata here too..? feels useful to have.. + // Status of this specific transaction + TxnStatus TransactionStatus `json:"txnStatus" db:"txn_status"` +} + +// 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. The 'quoteProvider' enum, will indiciate +// multiple providers in that case. +// NOTE: previously named IntentQuote +type IntentProviderQuote struct { + QuoteProvider string `json:"quoteProvider"` + QuoteProviderRequestID string `json:"quoteProviderRequestId"` + QuoteProviderFeeUSD float64 `json:"quoteProviderFeeUsd"` + FromAmount prototyp.BigInt `json:"fromAmount"` + FromAmountMin prototyp.BigInt `json:"fromAmountMin"` + ToAmount prototyp.BigInt `json:"toAmount"` + ToAmountMin prototyp.BigInt `json:"toAmountMin"` + MaxSlippage float64 `json:"maxSlippage"` + PriceImpact float64 `json:"priceImpact"` + PriceImpactUSD float64 `json:"priceImpactUsd"` +} + +// NOTE: previously named TrailsFee +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"` +} + +// ProviderFees is the swap+bridge provider fee, trails fee summary and totals +// NOTE: previously named the CrossChainFee +type IntentProviderFees struct { + // quote provider fee component (swap and/or bridge) + // TODO: what is the providerFee token denomination? is it always origin token..? I think no. + 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 + // TODO: what is this denomination? is it always origin token..? ... + // TODO: rename to totalFees ? and totalFeesUsd ? .. + TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` + TotalFeeUSD float64 `json:"totalFeeUsd"` +} + +// NOTE: previously named ChainExecuteQuote +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 + // TODO: this shouldnt be an array anymore... + MetaTxnFeeDetails []*MetaTxnFeeDetail `json:"metaTxnFeeDetails"` + // metaTxnGasQuote is like a voucher for gas sponsorship from the relayer + MetaTxnGasQuote string `json:"metaTxnGasQuote"` } +type MetaTxnFeeDetail struct { + MetaTxnID string `json:"metaTxnId"` + EstimatedGasLimit prototyp.BigInt `json:"estimatedGasLimit"` + // TODO: whats up with this name? + FeeNative prototyp.BigInt `json:"feeNative"` +} + +// NOTE: this also comes from pricefeed package.. +// lets review, and move it there .. perhaps have types +// here, as seems we need it..? HOWEVER.. it seems +// that trails npm package still uses the sequence api +// for pricing directly, and we're not using the pricefeed +// from trails-api .. I think..? cuz, we don't have GetCoinPrices +// endpoint... so... type TokenPrice struct { Token *Token `json:"token"` Price *Price `json:"price"` @@ -362,46 +527,15 @@ type TokenPrice struct { UpdatedAt *time.Time `json:"updatedAt"` } -type ExchangeRate struct { - Name string `json:"name"` - Symbol string `json:"symbol"` - Value float64 `json:"value"` - VsCurrency string `json:"vsCurrency"` - CurrencyType string `json:"currencyType"` -} - -// TOOD: refactor, we should be returning a cursor always.. -// see indexer/indexer.ridl Page object.. -// -// --- -// -// Page represents a results page. This can be used both to request a page and -// to store the state of a page. -type Page struct { - // Common for both numbered pages and cursor: Number of items per page - // TODO: REMOVE.. - PageSize *uint32 `json:"pageSize"` - // Numbered pages: Page number, this is multiplied by the value of the parameter. - // TODO: REMOVE.. - Page *uint32 `json:"page"` - // Number of total items on this query. - // TODO: REMOVE.. - TotalRecords *uint64 `json:"totalRecords"` - // Cursor: column to compare before/after to - Column *string `json:"column"` - // Cursor: return column < before - include to get previous page - Before *interface{} `json:"before"` - // Cursor: return column > after - include to get next page - After *interface{} `json:"after"` - // Sorting filter - Sort []*SortBy `json:"sort"` - // Indicates if there are more results available - More *bool `json:"more,omitempty"` +type Token struct { + ChainID uint64 `json:"chainId"` + TokenAddress prototyp.Hash `json:"tokenAddress"` + TokenId *string `json:"tokenId"` } -type SortBy struct { - Column string `json:"column"` - Order SortOrder `json:"order"` +type Price struct { + Value float64 `json:"value"` + Currency string `json:"currency"` } type CCTPTransfer struct { @@ -416,134 +550,6 @@ type CCTPTransfer struct { UpdatedAt time.Time `json:"updatedAt"` } -type GetIntentCallsPayloadParams struct { - UserAddress prototyp.Hash `json:"userAddress"` - DestinationChainID uint64 `json:"destinationChainId"` - DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` - DestinationTokenAmount string `json:"destinationTokenAmount"` - DestinationToAddress prototyp.Hash `json:"destinationToAddress"` - OriginChainID uint64 `json:"originChainId"` - OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` - OriginTokenAmount string `json:"originTokenAmount"` - DestinationCallData *string `json:"destinationCallData"` - DestinationCallValue *string `json:"destinationCallValue"` - Provider *string `json:"provider"` - AddressOverrides *AddressOverrides `json:"addressOverrides"` - DestinationSalt *string `json:"destinationSalt"` - SlippageTolerance *float64 `json:"slippageTolerance"` - TradeType *TradeType `json:"tradeType"` -} - -type GetIntentsQuoteParams struct { - UserAddress prototyp.Hash `json:"userAddress"` - DestinationChainID uint64 `json:"destinationChainId"` - DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` - DestinationTokenAmount string `json:"destinationTokenAmount"` - DestinationToAddress prototyp.Hash `json:"destinationToAddress"` - OriginChainID uint64 `json:"originChainId"` - OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` - OriginTokenAmount string `json:"originTokenAmount"` - DestinationCallData *string `json:"destinationCallData"` - DestinationCallValue *string `json:"destinationCallValue"` - Provider *string `json:"provider"` - AddressOverrides *AddressOverrides `json:"addressOverrides"` - DestinationSalt *string `json:"destinationSalt"` - SlippageTolerance *float64 `json:"slippageTolerance"` - TradeType *TradeType `json:"tradeType"` - ExactInputOriginalTokenAmount *string `json:"exactInputOriginalTokenAmount"` -} - -type CommitIntentConfigParams struct { - OriginIntentAddress string `json:"originIntentAddress"` - DestinationIntentAddress string `json:"destinationIntentAddress"` - MainSigner string `json:"mainSigner"` - Calls []*IntentCallsPayload `json:"calls"` - Preconditions []*IntentPrecondition `json:"preconditions"` - AddressOverrides *AddressOverrides `json:"addressOverrides"` - RequestParams *IntentRequestParams `json:"requestParams"` -} - -type IntentRequestParams struct { - Version string `json:"version"` - UserAddress prototyp.Hash `json:"userAddress"` - DestinationChainId uint64 `json:"destinationChainId"` - DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` - DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` - DestinationToAddress prototyp.Hash `json:"destinationToAddress"` - OriginChainId uint64 `json:"originChainId"` - OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` - OriginTokenAmount prototyp.BigInt `json:"originTokenAmount"` - DestinationCallData *string `json:"destinationCallData"` - DestinationCallValue *string `json:"destinationCallValue"` - CreatedAt time.Time `json:"createdAt"` -} - -type IntentCallsPayloads struct { - ID string `json:"id"` - Calls []*IntentCallsPayload `json:"calls"` - Preconditions []*IntentPrecondition `json:"preconditions"` - MetaTxns []*MetaTxn `json:"metaTxns"` - TrailsFee *TrailsFee `json:"trailsFee"` - Quote *IntentQuote `json:"quote"` - FeeQuotes map[string]string `json:"feeQuotes"` - OriginIntentAddress string `json:"originIntentAddress"` - DestinationIntentAddress string `json:"destinationIntentAddress"` -} - -type CrossChainFee struct { - ProviderFee prototyp.BigInt `json:"providerFee"` - TrailsSwapFee prototyp.BigInt `json:"trailsSwapFee"` - ProviderFeeUSD float64 `json:"providerFeeUSD"` - TrailsSwapFeeUSD float64 `json:"trailsSwapFeeUSD"` - TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` - TotalFeeUSD float64 `json:"totalFeeUSD"` -} - -type MetaTxnFeeDetail struct { - MetaTxnID string `json:"metaTxnID"` - EstimatedGasLimit prototyp.BigInt `json:"estimatedGasLimit"` - FeeNative prototyp.BigInt `json:"feeNative"` -} - -type ChainExecuteQuote struct { - ChainId prototyp.BigInt `json:"chainId"` - TotalGasLimit prototyp.BigInt `json:"totalGasLimit"` - GasPrice prototyp.BigInt `json:"gasPrice"` - TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` - NativeTokenSymbol string `json:"nativeTokenSymbol"` - NativeTokenPrice float64 `json:"nativeTokenPrice"` - MetaTxnFeeDetails []*MetaTxnFeeDetail `json:"metaTxnFeeDetails"` - TotalFeeUSD float64 `json:"totalFeeUSD"` -} - -type ExecuteQuote struct { - ChainQuotes []*ChainExecuteQuote `json:"chainQuotes"` -} - -type TrailsFee struct { - ExecuteQuote *ExecuteQuote `json:"executeQuote"` - CrossChainFee *CrossChainFee `json:"crossChainFee"` - FeeToken prototyp.Hash `json:"feeToken"` - OriginTokenTotalAmount prototyp.BigInt `json:"originTokenTotalAmount"` - TotalFeeAmount prototyp.BigInt `json:"totalFeeAmount"` - TotalFeeUSD float64 `json:"totalFeeUSD"` - QuoteProvider *string `json:"quoteProvider"` -} - -type IntentQuote struct { - FromAmount prototyp.BigInt `json:"fromAmount"` - FromAmountMin prototyp.BigInt `json:"fromAmountMin"` - ToAmount prototyp.BigInt `json:"toAmount"` - ToAmountMin prototyp.BigInt `json:"toAmountMin"` - PriceImpact float64 `json:"priceImpact"` - PriceImpactUsd string `json:"priceImpactUsd"` - MaxSlippage float64 `json:"maxSlippage"` - QuoteProvider string `json:"quoteProvider"` - QuoteProviderRequestId string `json:"quoteProviderRequestId"` - QuoteProviderFeeUsd string `json:"quoteProviderFeeUsd"` - FeeQuotes map[string]string `json:"feeQuotes"` -} - type GetIntentEntrypointDepositParams struct { UserAddress prototyp.Hash `json:"userAddress"` TokenAddress prototyp.Hash `json:"tokenAddress"` @@ -567,18 +573,6 @@ type GetIntentEntrypointDepositResult struct { EntrypointAddress string `json:"entrypointAddress"` } -type GetIntentEntrypointMessageHashParams struct { - UserAddress prototyp.Hash `json:"userAddress"` - TokenAddress prototyp.Hash `json:"tokenAddress"` - Amount prototyp.BigInt `json:"amount"` - IntentAddress prototyp.Hash `json:"intentAddress"` - ChainID uint64 `json:"chainID"` - Deadline uint64 `json:"deadline"` - Nonce prototyp.BigInt `json:"nonce"` - FeeAmount prototyp.BigInt `json:"feeAmount"` - FeeCollector prototyp.Hash `json:"feeCollector"` -} - // Fee options related types type GetIntentEntrypointDepositFeeOptionsParams struct { UserAddress prototyp.Hash `json:"userAddress"` @@ -599,7 +593,7 @@ type GasEstimate struct { TotalGas uint64 `json:"totalGas"` GasPrice string `json:"gasPrice"` NativeCost string `json:"nativeCost"` - NativeCostUSD float64 `json:"nativeCostUSD"` + NativeCostUSD float64 `json:"nativeCostUsd"` } type FeeOption struct { @@ -607,100 +601,277 @@ type FeeOption struct { TokenSymbol string `json:"tokenSymbol"` TokenDecimals int32 `json:"tokenDecimals"` Amount string `json:"amount"` - AmountUSD float64 `json:"amountUSD"` + AmountUSD float64 `json:"amountUsd"` FeeCollector string `json:"feeCollector"` } +type TrailsAddressOverrides struct { + SequenceWalletFactoryAddress *string `json:"sequenceWalletFactoryAddress"` + SequenceWalletMainModuleAddress *string `json:"sequenceWalletMainModuleAddress"` + SequenceWalletMainModuleUpgradableAddress *string `json:"sequenceWalletMainModuleUpgradableAddress"` + SequenceWalletGuestModuleAddress *string `json:"sequenceWalletGuestModuleAddress"` + SequenceWalletUtilsAddress *string `json:"sequenceWalletUtilsAddress"` +} + +type SortOrder uint32 + +const ( + SortOrder_DESC SortOrder = 0 + SortOrder_ASC SortOrder = 1 +) + +var SortOrder_name = map[uint32]string{ + 0: "DESC", + 1: "ASC", +} + +var SortOrder_value = map[string]uint32{ + "DESC": 0, + "ASC": 1, +} + +func (x SortOrder) String() string { + return SortOrder_name[uint32(x)] +} + +func (x SortOrder) MarshalText() ([]byte, error) { + return []byte(SortOrder_name[uint32(x)]), nil +} + +func (x *SortOrder) UnmarshalText(b []byte) error { + *x = SortOrder(SortOrder_value[string(b)]) + return nil +} + +func (x *SortOrder) Is(values ...SortOrder) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +type Version struct { + WebrpcVersion string `json:"webrpcVersion"` + SchemaVersion string `json:"schemaVersion"` + SchemaHash string `json:"schemaHash"` + AppVersion string `json:"appVersion"` +} + +type RuntimeStatus struct { + // overall status, true/false + HealthOK bool `json:"healthOK"` + StartTime time.Time `json:"startTime"` + Uptime uint64 `json:"uptime"` + Ver string `json:"ver"` + Branch string `json:"branch"` + CommitHash string `json:"commitHash"` + Runnables interface{} `json:"runnables"` +} + +// 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 QuoteIntentResponse 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 CommitIntentRequest struct { + Intent *Intent `json:"intent"` +} + +type CommitIntentResponse struct { + IntentID prototyp.Hash `json:"intentId"` +} + +// 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 ExecuteIntentRequest struct { + IntentID prototyp.Hash `json:"intentId"` + TransferTransactionHash prototyp.Hash `json:"transferTransactionHash"` +} + +type ExecuteIntentResponse struct { + IntentID prototyp.Hash `json:"intentId"` + IntentStatus IntentStatus `json:"intentStatus"` +} + +// GetIntentReceipt returns the current receipt/status of an intent immediately. +// If you are waiting for a intent to complete, use WaitIntentReceipt. +type GetIntentReceiptRequest struct { + IntentID prototyp.Hash `json:"intentId"` +} + +type GetIntentReceiptResponse struct { + IntentReceipt *IntentReceipt `json:"intentReceipt"` +} + +// WaitIntentReceipt will block until the intent reaches a terminal status or timeout. +type WaitIntentReceiptRequest struct { + IntentID prototyp.Hash `json:"intentId"` +} + +type WaitIntentReceiptResponse struct { + IntentReceipt *IntentReceipt `json:"intentReceipt"` + // 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"` +} + +// GetIntent queries the database for solved and committed 'intents' +type GetIntentRequest struct { + IntentID prototyp.Hash `json:"intentId"` +} + +type GetIntentResponse struct { + Intent *Intent `json:"intent"` +} + +// SearchIntents searches past intents based on filters. +// We do not return 'solved' status intents here, only committed/executed/failed/succeeded. +type SearchIntentsRequest struct { + ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` + ByTransferTransactionHash prototyp.Hash `json:"byTransferTransactionHash"` + ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` +} + +type SearchIntentsResponse struct { + // NOTE: we intentionally do not return a page here, and limit it to 10 latest results + Intents []*Intent `json:"intents"` +} + +// GetIntentTransactionHistory returns the discrete transactions related to an intent. +type GetIntentTransactionHistoryRequest struct { + // cursor paging parameters + Page *Page `json:"page"` +} + +type GetIntentTransactionHistoryResponse struct { + Transactions []*IntentTransaction `json:"transactions"` + NextPage *Page `json:"nextPage"` +} + +// Gas fee options for intent entry (leverages existing Entrypoint fee option params/result types). +type GetIntentGasFeeOptionsRequest struct { + Params *GetIntentEntrypointDepositFeeOptionsParams `json:"params"` +} + +type GetIntentGasFeeOptionsResponse struct { + Result *GetIntentEntrypointDepositFeeOptionsResult `json:"result"` +} + +// Entry transaction (deposit) construction for an intent (leverages existing Entrypoint deposit params/result types). +type GetIntentEntryTransactionRequest struct { + Params *GetIntentEntrypointDepositParams `json:"params"` +} + +type GetIntentEntryTransactionResponse struct { + Result *GetIntentEntrypointDepositResult `json:"result"` +} + +// Page represents a results page. This can be used both to request a page and +// to store the state of a 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 *interface{} `json:"before,omitempty"` + // Cursor: return column > after - include to get next page + After *interface{} `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"` +} + +type SortBy struct { + Column string `json:"column"` + Order SortOrder `json:"order"` +} + var methods = map[string]method{ - "/rpc/API/Ping": { + "/rpc/Trails/Ping": { name: "Ping", - service: "API", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/Version": { + "/rpc/Trails/Version": { name: "Version", - service: "API", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/RuntimeStatus": { + "/rpc/Trails/RuntimeStatus": { name: "RuntimeStatus", - service: "API", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/Clock": { + "/rpc/Trails/Clock": { name: "Clock", - service: "API", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/GetIntentCallsPayloads": { - name: "GetIntentCallsPayloads", - service: "API", + "/rpc/Trails/QuoteIntent": { + name: "QuoteIntent", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/GetIntentsQuote": { - name: "GetIntentsQuote", - service: "API", + "/rpc/Trails/CommitIntent": { + name: "CommitIntent", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/CommitIntentConfig": { - name: "CommitIntentConfig", - service: "API", + "/rpc/Trails/ExecuteIntent": { + name: "ExecuteIntent", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/GetIntentConfig": { - name: "GetIntentConfig", - service: "API", + "/rpc/Trails/WaitIntentReceipt": { + name: "WaitIntentReceipt", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/GetIntentTransactionHistory": { - name: "GetIntentTransactionHistory", - service: "API", + "/rpc/Trails/GetIntentReceipt": { + name: "GetIntentReceipt", + service: "Trails", annotations: map[string]string{}, }, - "/rpc/API/GetIntentEntrypointDeposit": { - name: "GetIntentEntrypointDeposit", - service: "API", - annotations: map[string]string{"public": ""}, - }, - "/rpc/API/GetIntentEntrypointDepositFeeOptions": { - name: "GetIntentEntrypointDepositFeeOptions", - service: "API", - annotations: map[string]string{"public": ""}, - }, - "/rpc/API/GetIntentEntrypointMessageHash": { - name: "GetIntentEntrypointMessageHash", - service: "API", - annotations: map[string]string{"public": ""}, - }, - "/rpc/API/GetCCTPTransfer": { - name: "GetCCTPTransfer", - service: "API", - annotations: map[string]string{"public": ""}, - }, - "/rpc/API/QueueCCTPTransfer": { - name: "QueueCCTPTransfer", - service: "API", - annotations: map[string]string{"public": ""}, + "/rpc/Trails/GetIntent": { + name: "GetIntent", + service: "Trails", + annotations: map[string]string{}, }, - "/rpc/API/QueueIntentConfigExecution": { - name: "QueueIntentConfigExecution", - service: "API", - annotations: map[string]string{"public": ""}, + "/rpc/Trails/SearchIntents": { + name: "SearchIntents", + service: "Trails", + annotations: map[string]string{}, }, - "/rpc/API/GetIntentConfigExecutionStatus": { - name: "GetIntentConfigExecutionStatus", - service: "API", - annotations: map[string]string{"public": ""}, + "/rpc/Trails/GetIntentTransactionHistory": { + name: "GetIntentTransactionHistory", + service: "Trails", + annotations: map[string]string{}, }, - "/rpc/API/ListIntentConfigs": { - name: "ListIntentConfigs", - service: "API", - annotations: map[string]string{"public": ""}, + "/rpc/Trails/GetIntentGasFeeOptions": { + name: "GetIntentGasFeeOptions", + service: "Trails", + annotations: map[string]string{}, }, - "/rpc/API/QueueMetaTxnReceipt": { - name: "QueueMetaTxnReceipt", - service: "API", - annotations: map[string]string{"public": ""}, + "/rpc/Trails/GetIntentEntryTransaction": { + name: "GetIntentEntryTransaction", + service: "Trails", + annotations: map[string]string{}, }, } @@ -714,25 +885,21 @@ func WebrpcMethods() map[string]method { } var WebRPCServices = map[string][]string{ - "API": { + "Trails": { "Ping", "Version", "RuntimeStatus", "Clock", - "GetIntentCallsPayloads", - "GetIntentsQuote", - "CommitIntentConfig", - "GetIntentConfig", + "QuoteIntent", + "CommitIntent", + "ExecuteIntent", + "WaitIntentReceipt", + "GetIntentReceipt", + "GetIntent", + "SearchIntents", "GetIntentTransactionHistory", - "GetIntentEntrypointDeposit", - "GetIntentEntrypointDepositFeeOptions", - "GetIntentEntrypointMessageHash", - "GetCCTPTransfer", - "QueueCCTPTransfer", - "QueueIntentConfigExecution", - "GetIntentConfigExecutionStatus", - "ListIntentConfigs", - "QueueMetaTxnReceipt", + "GetIntentGasFeeOptions", + "GetIntentEntryTransaction", }, } @@ -740,42 +907,38 @@ var WebRPCServices = map[string][]string{ // Client // -const APIPathPrefix = "/rpc/API/" +const TrailsPathPrefix = "/rpc/Trails/" -type apiClient struct { +type trailsClient struct { client HTTPClient - urls [18]string + urls [14]string } -func NewAPIClient(addr string, client HTTPClient) APIClient { - prefix := urlBase(addr) + APIPathPrefix - urls := [18]string{ +func NewTrailsClient(addr string, client HTTPClient) TrailsClient { + prefix := urlBase(addr) + TrailsPathPrefix + urls := [14]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", prefix + "Clock", - prefix + "GetIntentCallsPayloads", - prefix + "GetIntentsQuote", - prefix + "CommitIntentConfig", - prefix + "GetIntentConfig", + prefix + "QuoteIntent", + prefix + "CommitIntent", + prefix + "ExecuteIntent", + prefix + "WaitIntentReceipt", + prefix + "GetIntentReceipt", + prefix + "GetIntent", + prefix + "SearchIntents", prefix + "GetIntentTransactionHistory", - prefix + "GetIntentEntrypointDeposit", - prefix + "GetIntentEntrypointDepositFeeOptions", - prefix + "GetIntentEntrypointMessageHash", - prefix + "GetCCTPTransfer", - prefix + "QueueCCTPTransfer", - prefix + "QueueIntentConfigExecution", - prefix + "GetIntentConfigExecutionStatus", - prefix + "ListIntentConfigs", - prefix + "QueueMetaTxnReceipt", - } - return &apiClient{ + prefix + "GetIntentGasFeeOptions", + prefix + "GetIntentEntryTransaction", + } + return &trailsClient{ client: client, urls: urls, } } -func (c *apiClient) Ping(ctx context.Context) (bool, error) { +func (c *trailsClient) Ping(ctx context.Context) (bool, error) { out := struct { Ret0 bool `json:"status"` }{} @@ -791,7 +954,7 @@ func (c *apiClient) Ping(ctx context.Context) (bool, error) { return out.Ret0, err } -func (c *apiClient) Version(ctx context.Context) (*Version, error) { +func (c *trailsClient) Version(ctx context.Context) (*Version, error) { out := struct { Ret0 *Version `json:"version"` }{} @@ -807,7 +970,7 @@ func (c *apiClient) Version(ctx context.Context) (*Version, error) { return out.Ret0, err } -func (c *apiClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { +func (c *trailsClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { out := struct { Ret0 *RuntimeStatus `json:"status"` }{} @@ -823,7 +986,7 @@ func (c *apiClient) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) { return out.Ret0, err } -func (c *apiClient) Clock(ctx context.Context) (time.Time, error) { +func (c *trailsClient) Clock(ctx context.Context) (time.Time, error) { out := struct { Ret0 time.Time `json:"serverTime"` }{} @@ -839,34 +1002,12 @@ func (c *apiClient) Clock(ctx context.Context) (time.Time, error) { return out.Ret0, err } -func (c *apiClient) GetIntentCallsPayloads(ctx context.Context, params *GetIntentCallsPayloadParams) (*IntentCallsPayloads, error) { - in := struct { - Arg0 *GetIntentCallsPayloadParams `json:"params"` - }{params} - out := struct { - Ret0 *IntentCallsPayloads `json:"payloads"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, err -} - -func (c *apiClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuoteParams) (*IntentQuote, error) { - in := struct { - Arg0 *GetIntentsQuoteParams `json:"params"` - }{params} +func (c *trailsClient) QuoteIntent(ctx context.Context, quoteIntentRequest QuoteIntentRequest) (*QuoteIntentResponse, error) { out := struct { - Ret0 *IntentQuote `json:"quote"` + Ret0 *QuoteIntentResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[4], quoteIntentRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -877,15 +1018,12 @@ func (c *apiClient) GetIntentsQuote(ctx context.Context, params *GetIntentsQuote return out.Ret0, err } -func (c *apiClient) CommitIntentConfig(ctx context.Context, params *CommitIntentConfigParams) (*IntentConfig, error) { - in := struct { - Arg0 *CommitIntentConfigParams `json:"params"` - }{params} +func (c *trailsClient) CommitIntent(ctx context.Context, commitIntentRequest CommitIntentRequest) (*CommitIntentResponse, error) { out := struct { - Ret0 *IntentConfig `json:"config"` + Ret0 *CommitIntentResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[5], commitIntentRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -896,15 +1034,12 @@ func (c *apiClient) CommitIntentConfig(ctx context.Context, params *CommitIntent return out.Ret0, err } -func (c *apiClient) GetIntentConfig(ctx context.Context, intentAddress string) (*IntentConfig, error) { - in := struct { - Arg0 string `json:"intentAddress"` - }{intentAddress} +func (c *trailsClient) ExecuteIntent(ctx context.Context, executeIntentRequest ExecuteIntentRequest) (*ExecuteIntentResponse, error) { out := struct { - Ret0 *IntentConfig `json:"config"` + Ret0 *ExecuteIntentResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], executeIntentRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -915,36 +1050,12 @@ func (c *apiClient) GetIntentConfig(ctx context.Context, intentAddress string) ( return out.Ret0, err } -func (c *apiClient) GetIntentTransactionHistory(ctx context.Context, accountAddress string, page *Page) (*Page, []*IntentTransaction, error) { - in := struct { - Arg0 string `json:"accountAddress"` - Arg1 *Page `json:"page"` - }{accountAddress, page} - out := struct { - Ret0 *Page `json:"page"` - Ret1 []*IntentTransaction `json:"transactions"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, out.Ret1, err -} - -func (c *apiClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetIntentEntrypointDepositParams) (*GetIntentEntrypointDepositResult, error) { - in := struct { - Arg0 *GetIntentEntrypointDepositParams `json:"params"` - }{params} +func (c *trailsClient) WaitIntentReceipt(ctx context.Context, waitIntentReceiptRequest WaitIntentReceiptRequest) (*WaitIntentReceiptResponse, error) { out := struct { - Ret0 *GetIntentEntrypointDepositResult `json:"result"` + Ret0 *WaitIntentReceiptResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], waitIntentReceiptRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -955,15 +1066,12 @@ func (c *apiClient) GetIntentEntrypointDeposit(ctx context.Context, params *GetI return out.Ret0, err } -func (c *apiClient) GetIntentEntrypointDepositFeeOptions(ctx context.Context, params *GetIntentEntrypointDepositFeeOptionsParams) (*GetIntentEntrypointDepositFeeOptionsResult, error) { - in := struct { - Arg0 *GetIntentEntrypointDepositFeeOptionsParams `json:"params"` - }{params} +func (c *trailsClient) GetIntentReceipt(ctx context.Context, getIntentReceiptRequest GetIntentReceiptRequest) (*GetIntentReceiptResponse, error) { out := struct { - Ret0 *GetIntentEntrypointDepositFeeOptionsResult `json:"result"` + Ret0 *GetIntentReceiptResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], getIntentReceiptRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -974,15 +1082,12 @@ func (c *apiClient) GetIntentEntrypointDepositFeeOptions(ctx context.Context, pa return out.Ret0, err } -func (c *apiClient) GetIntentEntrypointMessageHash(ctx context.Context, params *GetIntentEntrypointMessageHashParams) (string, error) { - in := struct { - Arg0 *GetIntentEntrypointMessageHashParams `json:"params"` - }{params} +func (c *trailsClient) GetIntent(ctx context.Context, getIntentRequest GetIntentRequest) (*GetIntentResponse, error) { out := struct { - Ret0 string `json:"messageHash"` + Ret0 *GetIntentResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], getIntentRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -993,15 +1098,12 @@ func (c *apiClient) GetIntentEntrypointMessageHash(ctx context.Context, params * return out.Ret0, err } -func (c *apiClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransfer, error) { - in := struct { - Arg0 string `json:"id"` - }{id} +func (c *trailsClient) SearchIntents(ctx context.Context, searchIntentsRequest SearchIntentsRequest) (*SearchIntentsResponse, error) { out := struct { - Ret0 *CCTPTransfer `json:"transfer"` + Ret0 *SearchIntentsResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], searchIntentsRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1012,18 +1114,12 @@ func (c *apiClient) GetCCTPTransfer(ctx context.Context, id string) (*CCTPTransf return out.Ret0, err } -func (c *apiClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, metaTxHash *string, sourceChainId uint64, destinationChainId uint64) (*CCTPTransfer, error) { - in := struct { - Arg0 *string `json:"sourceTxHash"` - Arg1 *string `json:"metaTxHash"` - Arg2 uint64 `json:"sourceChainId"` - Arg3 uint64 `json:"destinationChainId"` - }{sourceTxHash, metaTxHash, sourceChainId, destinationChainId} +func (c *trailsClient) GetIntentTransactionHistory(ctx context.Context, getIntentTransactionHistoryRequest GetIntentTransactionHistoryRequest) (*GetIntentTransactionHistoryResponse, error) { out := struct { - Ret0 *CCTPTransfer `json:"transfer"` + Ret0 *GetIntentTransactionHistoryResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], getIntentTransactionHistoryRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1034,15 +1130,12 @@ func (c *apiClient) QueueCCTPTransfer(ctx context.Context, sourceTxHash *string, return out.Ret0, err } -func (c *apiClient) QueueIntentConfigExecution(ctx context.Context, intentConfigId string) (bool, error) { - in := struct { - Arg0 string `json:"intentConfigId"` - }{intentConfigId} +func (c *trailsClient) GetIntentGasFeeOptions(ctx context.Context, getIntentGasFeeOptionsRequest GetIntentGasFeeOptionsRequest) (*GetIntentGasFeeOptionsResponse, error) { out := struct { - Ret0 bool `json:"status"` + Ret0 *GetIntentGasFeeOptionsResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], getIntentGasFeeOptionsRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1053,55 +1146,12 @@ func (c *apiClient) QueueIntentConfigExecution(ctx context.Context, intentConfig return out.Ret0, err } -func (c *apiClient) GetIntentConfigExecutionStatus(ctx context.Context, intentConfigId string) (string, error) { - in := struct { - Arg0 string `json:"intentConfigId"` - }{intentConfigId} +func (c *trailsClient) GetIntentEntryTransaction(ctx context.Context, getIntentEntryTransactionRequest GetIntentEntryTransactionRequest) (*GetIntentEntryTransactionResponse, error) { out := struct { - Ret0 string `json:"executionStatus"` + Ret0 *GetIntentEntryTransactionResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, err -} - -func (c *apiClient) ListIntentConfigs(ctx context.Context, page *Page, executionStatus *string) (*Page, []*IntentConfig, error) { - in := struct { - Arg0 *Page `json:"page"` - Arg1 *string `json:"executionStatus"` - }{page, executionStatus} - out := struct { - Ret0 *Page `json:"page"` - Ret1 []*IntentConfig `json:"intentConfigs"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, out.Ret1, err -} - -func (c *apiClient) QueueMetaTxnReceipt(ctx context.Context, metaTxID string) (bool, error) { - in := struct { - Arg0 string `json:"metaTxID"` - }{metaTxID} - out := struct { - Ret0 bool `json:"status"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], getIntentEntryTransactionRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1308,6 +1358,148 @@ func MethodCtx(ctx context.Context) (method, bool) { // PtrTo is a useful helper when constructing values for optional fields. func PtrTo[T any](v T) *T { return &v } +// +// BigInt helpers +// + +// BigInt is an alias of big.Int with custom JSON (decimal string) encoding. +type BigInt big.Int + +func NewBigInt(v int64) BigInt { var bi big.Int; bi.SetInt64(v); return BigInt(bi) } + +// AsInt exposes the underlying *big.Int. +func (b *BigInt) AsInt() *big.Int { return (*big.Int)(b) } + +// String returns the decimal string representation of the BigInt. +func (b BigInt) String() string { return b.AsInt().String() } + +// MarshalText implements encoding.TextMarshaler. +func (b BigInt) MarshalText() ([]byte, error) { + return []byte(fmt.Sprintf("\"%s\"", b.String())), nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (b *BigInt) UnmarshalText(text []byte) error { + if len(text) == 0 { + return nil + } + if len(text) == 4 && text[0] == 'n' && string(text) == "null" { + return nil + } + for _, c := range text { + if c == ' ' || c == '\t' || c == '\n' || c == '\r' { + return fmt.Errorf("BigInt.UnmarshalText: unexpected whitespace in %q", text) + } + } + var digits []byte + if text[0] == '-' || (text[0] >= '0' && text[0] <= '9') { + digits = text + } else { + if len(text) < 2 || text[0] != '"' || text[len(text)-1] != '"' { + return fmt.Errorf("BigInt.UnmarshalText: unsupported format %q", text) + } + digits = text[1 : len(text)-1] + } + i, ok := big.NewInt(0).SetString(string(digits), 10) + if !ok { + return fmt.Errorf("BigInt.UnmarshalText: failed to parse %q", text) + } + *b = BigInt(*i) + return nil +} + +// MarshalJSON implements json.Marshaler +func (b BigInt) MarshalJSON() ([]byte, error) { + return b.MarshalText() +} + +// UnmarshalJSON implements json.Unmarshaler +func (b *BigInt) UnmarshalJSON(text []byte) error { + if string(text) == "null" { + return nil + } + return b.UnmarshalText(text) +} + +// MarshalBinary implements encoding.BinaryMarshaler. The first byte is the sign byte +// to represent positive or negative numbers. +func (b BigInt) MarshalBinary() ([]byte, error) { + bytes := b.AsInt().Bytes() + out := make([]byte, len(bytes)+1) + copy(out[1:], bytes) + if b.AsInt().Sign() < 0 { + // Prepend a sign byte (0xFF for negative) + out[0] = 0xFF + } else { + // For zero or positive numbers, prepend 0x00 + out[0] = 0x00 + } + return out, nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. The first byte is the sign byte +// to represent positive or negative numbers. +func (b *BigInt) UnmarshalBinary(buff []byte) error { + if len(buff) == 0 { + *b = BigInt(*big.NewInt(0)) + return nil + } + // Extract the sign byte + signByte := buff[0] + i := new(big.Int) + if len(buff) > 1 { + i.SetBytes(buff[1:]) + } + // Apply sign if negative + if signByte == 0xFF { + i.Neg(i) + } + *b = BigInt(*i) + return nil +} + +func (b BigInt) Value() (driver.Value, error) { + return b.String(), nil +} + +func (b *BigInt) Scan(src interface{}) error { + if src == nil { + return nil + } + + var svalue string + switch v := src.(type) { + case string: + svalue = v + case []byte: + svalue = string(v) + default: + return fmt.Errorf("BigInt.Scan: unexpected type %T", src) + } + + // pgx driver returns NeX where N is digits and X is exponent + parts := strings.SplitN(svalue, "e", 2) + + var ok bool + i := &big.Int{} + i, ok = i.SetString(parts[0], 10) + if !ok { + return fmt.Errorf("BigInt.Scan: failed to scan value %q", svalue) + } + + if len(parts) >= 2 { + exp := big.NewInt(0) + exp, ok = exp.SetString(parts[1], 10) + if !ok { + return fmt.Errorf("BigInt.Scan failed to scan exp component %q", svalue) + } + i = i.Mul(i, big.NewInt(1).Exp(big.NewInt(10), exp, nil)) + } + + *b = BigInt(*i) + return nil +} + // // Errors // @@ -1402,8 +1594,10 @@ var ( 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} ) @@ -1414,7 +1608,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.30.1;gen-golang@v0.23.1;trails-api@v0.4.0" +const WebrpcHeaderValue = "webrpc@v0.30.2;gen-golang@v0.23.1;trails-api@v1.0.0" type WebrpcGenVersions struct { WebrpcGenVersion string From 57048a890597005c36a364797664838b5edccdf0 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 30 Oct 2025 13:56:06 +0000 Subject: [PATCH 21/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 82 +++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index fd548789..993470b0 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 d77c84a0d98b34c7e6d3a9810cc8819aee40b978 +// trails-api v1.0.0 f01309b41f30972f5f124ffff33d0a805a73e992 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "d77c84a0d98b34c7e6d3a9810cc8819aee40b978" + return "f01309b41f30972f5f124ffff33d0a805a73e992" } // @@ -122,24 +122,27 @@ func (x *QuoteProviderType) Is(values ...QuoteProviderType) bool { type TransactionStatus uint8 const ( - TransactionStatus_PENDING TransactionStatus = 0 - TransactionStatus_PROCESSING TransactionStatus = 1 - TransactionStatus_FAILED TransactionStatus = 2 - TransactionStatus_SUCCEEDED TransactionStatus = 3 + TransactionStatus_UNKNOWN TransactionStatus = 0 + TransactionStatus_PENDING TransactionStatus = 1 + TransactionStatus_PROCESSING TransactionStatus = 2 + TransactionStatus_FAILED TransactionStatus = 3 + TransactionStatus_SUCCEEDED TransactionStatus = 4 ) var TransactionStatus_name = map[uint8]string{ - 0: "PENDING", - 1: "PROCESSING", - 2: "FAILED", - 3: "SUCCEEDED", + 0: "UNKNOWN", + 1: "PENDING", + 2: "PROCESSING", + 3: "FAILED", + 4: "SUCCEEDED", } var TransactionStatus_value = map[string]uint8{ - "PENDING": 0, - "PROCESSING": 1, - "FAILED": 2, - "SUCCEEDED": 3, + "UNKNOWN": 0, + "PENDING": 1, + "PROCESSING": 2, + "FAILED": 3, + "SUCCEEDED": 4, } func (x TransactionStatus) String() string { @@ -170,7 +173,7 @@ func (x *TransactionStatus) Is(values ...TransactionStatus) bool { type IntentStatus uint8 const ( - IntentStatus_SOLVED IntentStatus = 0 + IntentStatus_QUOTED IntentStatus = 0 IntentStatus_COMMITTED IntentStatus = 1 IntentStatus_EXECUTING IntentStatus = 2 IntentStatus_FAILED IntentStatus = 3 @@ -178,7 +181,7 @@ const ( ) var IntentStatus_name = map[uint8]string{ - 0: "SOLVED", + 0: "QUOTED", 1: "COMMITTED", 2: "EXECUTING", 3: "FAILED", @@ -186,7 +189,7 @@ var IntentStatus_name = map[uint8]string{ } var IntentStatus_value = map[string]uint8{ - "SOLVED": 0, + "QUOTED": 0, "COMMITTED": 1, "EXECUTING": 2, "FAILED": 3, @@ -301,7 +304,6 @@ type Intent struct { MetaTxns []*MetaTxn `json:"metaTxns" db:"meta_txns"` Quote *IntentProviderQuote `json:"quote" db:"quote"` Fees *IntentFees `json:"fees" db:"fees"` - ExecutedAt *time.Time `json:"executedAt,omitempty" db:"executed_at,omitempty"` 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"` @@ -392,7 +394,7 @@ type IntentReceipt struct { // 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 - TransferTransactionHash prototyp.Hash `json:"transferTransactionHash" db:"transfer_txn_hash"` + TransferTransactionHash *prototyp.Hash `json:"transferTransactionHash" db:"transfer_txn_hash,omitempty"` TransferTransactionStatus TransactionStatus `json:"transferTransactionStatus" db:"transfer_txn_status"` // origin intent transaction db reference and runtime type OriginTransactionID uint64 `json:"-" db:"orig_txn_id"` @@ -404,9 +406,9 @@ type IntentReceipt struct { ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` RetryCount *uint32 `json:"retryCount" db:"retry_count,omitempty"` // timestamp when the intent receipt was updated, usually from status change - UpdatedAt *string `json:"updatedAt" db:"updated_at,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` // timestamp of when the intent receipt was created - CreatedAt *string `json:"createdAt" db:"created_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } // IntentTransaction represents a single transaction within an intent's execution flow. @@ -432,6 +434,8 @@ type IntentTransaction struct { // TODO: how about calldata here too..? feels useful to have.. // Status of this specific transaction TxnStatus TransactionStatus `json:"txnStatus" db:"txn_status"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } // IntentProviderQuote represents the quotes from the underlining providers for both @@ -517,14 +521,15 @@ type MetaTxnFeeDetail struct { // from trails-api .. I think..? cuz, we don't have GetCoinPrices // endpoint... so... type TokenPrice struct { - Token *Token `json:"token"` - Price *Price `json:"price"` - Price24hChange *Price `json:"price24hChange"` - Price24hVol *Price `json:"price24hVol"` - FloorPrice *Price `json:"floorPrice,omitempty"` - BuyPrice *Price `json:"buyPrice,omitempty"` - SellPrice *Price `json:"sellPrice,omitempty"` - UpdatedAt *time.Time `json:"updatedAt"` + Token *Token `json:"token"` + Price *Price `json:"price"` + Price24hChange *Price `json:"price24hChange"` + Price24hVol *Price `json:"price24hVol"` + FloorPrice *Price `json:"floorPrice,omitempty"` + BuyPrice *Price `json:"buyPrice,omitempty"` + SellPrice *Price `json:"sellPrice,omitempty"` + // TODO: review, copy other types, or not? + UpdatedAt *time.Time `json:"updatedAt"` } type Token struct { @@ -539,15 +544,16 @@ type Price struct { } type CCTPTransfer struct { - ID string `json:"id"` - SourceTxHash string `json:"sourceTxHash"` - SourceChainID uint64 `json:"sourceChainId"` - DestinationChainID uint64 `json:"destinationChainId"` - Message string `json:"message"` - Attestation string `json:"attestation"` - Status string `json:"status"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` + ID string `json:"id"` + SourceTxHash string `json:"sourceTxHash"` + SourceChainID uint64 `json:"sourceChainId"` + DestinationChainID uint64 `json:"destinationChainId"` + Message string `json:"message"` + Attestation string `json:"attestation"` + // TODO use an enum instead? + Status string `json:"status"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } type GetIntentEntrypointDepositParams struct { From 76dba03acc31a0f4daf1528a2d9a083dbac98797 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 30 Oct 2025 18:41:46 +0000 Subject: [PATCH 22/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 993470b0..9053ca76 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 f01309b41f30972f5f124ffff33d0a805a73e992 +// trails-api v1.0.0 3db4e7de3a5bd5ac465fd949325f7ae87f8f896d // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "f01309b41f30972f5f124ffff33d0a805a73e992" + return "3db4e7de3a5bd5ac465fd949325f7ae87f8f896d" } // @@ -394,7 +394,7 @@ type IntentReceipt struct { // 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 - TransferTransactionHash *prototyp.Hash `json:"transferTransactionHash" db:"transfer_txn_hash,omitempty"` + TransferTransactionHash prototyp.Hash `json:"transferTransactionHash" db:"transfer_txn_hash"` TransferTransactionStatus TransactionStatus `json:"transferTransactionStatus" db:"transfer_txn_status"` // origin intent transaction db reference and runtime type OriginTransactionID uint64 `json:"-" db:"orig_txn_id"` From 8f0c35fd7f0820e0558b6b632b547e3ef9f40244 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:38:23 +0000 Subject: [PATCH 23/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 9053ca76..4ba5e929 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 3db4e7de3a5bd5ac465fd949325f7ae87f8f896d +// trails-api v1.0.0 637d853041f61166b4ffb5d6fb879fce563c45a8 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "3db4e7de3a5bd5ac465fd949325f7ae87f8f896d" + return "637d853041f61166b4ffb5d6fb879fce563c45a8" } // @@ -268,14 +268,14 @@ type QuoteIntentRequest struct { DestinationCallData *string `json:"destinationCallData"` DestinationCallValue *string `json:"destinationCallValue"` // NOTE: EXACT_OUTPUT is the default if unspecified - TradeType *TradeType `json:"tradeType"` - Options *QuoteIntentRequestOptions `json:"options"` + TradeType *TradeType `json:"tradeType,omitempty"` + Options *QuoteIntentRequestOptions `json:"options,omitempty"` } type QuoteIntentRequestOptions struct { - QuoteProvider *QuoteProviderType `json:"quoteProvider"` - SlippageTolerance *float64 `json:"slippageTolerance"` - TrailsAddressOverrides *TrailsAddressOverrides `json:"trailsAddressOverrides"` + QuoteProvider *QuoteProviderType `json:"quoteProvider,omitempty"` + SlippageTolerance *float64 `json:"slippageTolerance,omitempty"` + TrailsAddressOverrides *TrailsAddressOverrides `json:"trailsAddressOverrides,omitempty"` } // Fully formed/quoted/solved, executable intent. @@ -304,6 +304,7 @@ type Intent struct { MetaTxns []*MetaTxn `json:"metaTxns" db:"meta_txns"` Quote *IntentProviderQuote `json:"quote" db:"quote"` Fees *IntentFees `json:"fees" db:"fees"` + TrailsVersion string `json:"trailsVersion" db:"trails_version"` 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"` @@ -327,16 +328,14 @@ type TransactionCall struct { BehaviorOnError *uint8 `json:"behaviorOnError"` } -// TODO: fix this.. it should adhere to 7795, which it does not. type IntentPrecondition struct { - // TODO: should be erc20MinAllowance + // TODO: value should be erc20MinAllowance to match 7795 Type string `json:"type"` ChainID uint64 `json:"chainId"` Data *IntentPreconditionData `json:"data"` } // transaction preconditions based on https://eips.ethereum.org/EIPS/eip-7795 -// TODOXXX: these values are incorrect, and should match 7795 // chainId: `0x${string}`; // Hex chain id // owner: `0x${string}`; // Address // token: `0x${string}`; // Address @@ -358,12 +357,14 @@ type IntentPreconditionData struct { type MetaTxn struct { ID string `json:"id"` ChainID uint64 `json:"chainId"` - // TODO: rename this to 'from: string' ? - WalletAddress string `json:"walletAddress" db:"wallet_address"` + // TODO: rename this to 'from: string' ? ... name...?? walletAddress... from..? + // fromAddress ...? + WalletAddress string `json:"walletAddress"` // TODO (later): rename this to `to: string` - Contract string `json:"contract" db:"to_address"` + // TODO: name it.. toAddress ? + Contract string `json:"contract"` // TODO: rename to 'execdata' ? - Input string `json:"input" db:"tx_data"` + Input string `json:"input"` } // IntentReceipt represents an intent that went through trails, and fully executed @@ -500,13 +501,12 @@ type IntentTransactionGasFee struct { TotalFeeUSD float64 `json:"totalFeeUsd"` // sequence relayer gas fee quotes // AKA, meta transaction gas fee quotes for pre-sponsored - // TODO: this shouldnt be an array anymore... - MetaTxnFeeDetails []*MetaTxnFeeDetail `json:"metaTxnFeeDetails"` + MetaTxnFeeDetails *MetaTxnFeeDetails `json:"metaTxnFeeDetails"` // metaTxnGasQuote is like a voucher for gas sponsorship from the relayer MetaTxnGasQuote string `json:"metaTxnGasQuote"` } -type MetaTxnFeeDetail struct { +type MetaTxnFeeDetails struct { MetaTxnID string `json:"metaTxnId"` EstimatedGasLimit prototyp.BigInt `json:"estimatedGasLimit"` // TODO: whats up with this name? From 3e6a1c1403abb738720471f8ae3d07f6954ebff4 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 02:50:10 +0000 Subject: [PATCH 24/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 4ba5e929..6c495ec7 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 637d853041f61166b4ffb5d6fb879fce563c45a8 +// trails-api v1.0.0 05ed598bed12799bc48ae5315179931d7f262790 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "637d853041f61166b4ffb5d6fb879fce563c45a8" + return "05ed598bed12799bc48ae5315179931d7f262790" } // @@ -299,6 +299,7 @@ type Intent struct { OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"orig_intent_address"` DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"dest_intent_address"` DestinationSalt prototyp.BigInt `json:"destinationSalt" db:"destination_salt"` + DepositTransaction *DepositTransaction `json:"depositTransaction" db:"deposit_txn"` Calls []*IntentCalls `json:"calls" db:"calls"` Preconditions []*IntentPrecondition `json:"preconditions" db:"preconditions"` MetaTxns []*MetaTxn `json:"metaTxns" db:"meta_txns"` @@ -310,6 +311,14 @@ type Intent struct { CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } +// DepositTransaction represents a deposit transfer transaction of the token amount +// to the origin intent address. +type DepositTransaction struct { + ToAddress prototyp.Hash `json:"toAddress"` + TokenAddress prototyp.Hash `json:"tokenAddress"` + Amount prototyp.BigInt `json:"amount"` +} + // NOTE: was previously named IntentCallsPayload type IntentCalls struct { ChainID uint64 `json:"chainId"` @@ -392,11 +401,11 @@ type IntentReceipt struct { 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"` - // transfer transaction hash and status, which is the init + // 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 - TransferTransactionHash prototyp.Hash `json:"transferTransactionHash" db:"transfer_txn_hash"` - TransferTransactionStatus TransactionStatus `json:"transferTransactionStatus" db:"transfer_txn_status"` + DepositTransactionHash prototyp.Hash `json:"depositTransactionHash" db:"deposit_txn_hash"` + DepositTransactionStatus TransactionStatus `json:"depositTransactionStatus" db:"deposit_txn_status"` // origin intent transaction db reference and runtime type OriginTransactionID uint64 `json:"-" db:"orig_txn_id"` OriginTransaction *IntentTransaction `json:"originTransaction" db:"-"` @@ -703,7 +712,10 @@ type CommitIntentResponse struct { // Clients provide the transfer transaction hash that executed the transfer to the // intent origin address. type ExecuteIntentRequest struct { - IntentID prototyp.Hash `json:"intentId"` + IntentID prototyp.Hash `json:"intentId"` + DepositTransactionHash prototyp.Hash `json:"depositTransactionHash"` + // TODOXXX: remove this! just leaving here for backwards compat on frontend + // until we update the trails-sdk too (tomorrow) TransferTransactionHash prototyp.Hash `json:"transferTransactionHash"` } @@ -747,9 +759,9 @@ type GetIntentResponse struct { // SearchIntents searches past intents based on filters. // We do not return 'solved' status intents here, only committed/executed/failed/succeeded. type SearchIntentsRequest struct { - ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` - ByTransferTransactionHash prototyp.Hash `json:"byTransferTransactionHash"` - ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` + ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` + ByDepositTransactionHash prototyp.Hash `json:"byDepositTransactionHash"` + ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` } type SearchIntentsResponse struct { From 9c1047449e9a7129292faf60109b4c525fc9f423 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 14:26:54 +0000 Subject: [PATCH 25/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 6c495ec7..b7fd180e 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 05ed598bed12799bc48ae5315179931d7f262790 +// trails-api v1.0.0 54cbe231c8762643c1a1b625b01d8a1ba6487cdd // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "05ed598bed12799bc48ae5315179931d7f262790" + return "54cbe231c8762643c1a1b625b01d8a1ba6487cdd" } // @@ -314,9 +314,15 @@ type Intent struct { // DepositTransaction represents a deposit transfer transaction of the token amount // to the origin intent address. type DepositTransaction struct { - ToAddress prototyp.Hash `json:"toAddress"` - TokenAddress prototyp.Hash `json:"tokenAddress"` - Amount prototyp.BigInt `json:"amount"` + // 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"` } // NOTE: was previously named IntentCallsPayload From 3c9afb2ab73d844eb148f216615f6b71709c97e7 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 14:40:26 +0000 Subject: [PATCH 26/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index b7fd180e..cb2db696 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 54cbe231c8762643c1a1b625b01d8a1ba6487cdd +// trails-api v1.0.0 10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "54cbe231c8762643c1a1b625b01d8a1ba6487cdd" + return "10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625" } // @@ -256,17 +256,15 @@ func (x *ChainGasUsageStatus) Is(values ...ChainGasUsageStatus) bool { // // ............ type QuoteIntentRequest struct { - OwnerAddress prototyp.Hash `json:"ownerAddress"` - OriginChainID uint64 `json:"originChainId"` - OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` - // TODOXXX: remove this - OriginTokenAmount *prototyp.BigInt `json:"originTokenAmount"` - DestinationChainID uint64 `json:"destinationChainId"` - DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` - DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` - DestinationToAddress prototyp.Hash `json:"destinationToAddress"` - DestinationCallData *string `json:"destinationCallData"` - DestinationCallValue *string `json:"destinationCallValue"` + OwnerAddress prototyp.Hash `json:"ownerAddress"` + OriginChainID uint64 `json:"originChainId"` + OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` + DestinationChainID uint64 `json:"destinationChainId"` + DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` + DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` + DestinationToAddress prototyp.Hash `json:"destinationToAddress"` + DestinationCallData *string `json:"destinationCallData"` + DestinationCallValue *string `json:"destinationCallValue"` // NOTE: EXACT_OUTPUT is the default if unspecified TradeType *TradeType `json:"tradeType,omitempty"` Options *QuoteIntentRequestOptions `json:"options,omitempty"` From bf98a5744173d361f10fb79828b87ba656828c36 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:12:13 +0000 Subject: [PATCH 27/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index cb2db696..246534c6 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625 +// trails-api v1.0.0 5669b86e8def11e520b7d1722de60e73a3b9d75b // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625" + return "5669b86e8def11e520b7d1722de60e73a3b9d75b" } // @@ -718,9 +718,6 @@ type CommitIntentResponse struct { type ExecuteIntentRequest struct { IntentID prototyp.Hash `json:"intentId"` DepositTransactionHash prototyp.Hash `json:"depositTransactionHash"` - // TODOXXX: remove this! just leaving here for backwards compat on frontend - // until we update the trails-sdk too (tomorrow) - TransferTransactionHash prototyp.Hash `json:"transferTransactionHash"` } type ExecuteIntentResponse struct { From 736be0c38305375cf23037a125522126a95584fe Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:39:04 +0000 Subject: [PATCH 28/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 63 +++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 246534c6..93682089 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 5669b86e8def11e520b7d1722de60e73a3b9d75b +// trails-api v1.0.0 be6fdd3eab15f477b03ddf9bd7abeb162178b4d0 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "5669b86e8def11e520b7d1722de60e73a3b9d75b" + return "be6fdd3eab15f477b03ddf9bd7abeb162178b4d0" } // @@ -122,27 +122,30 @@ func (x *QuoteProviderType) Is(values ...QuoteProviderType) bool { type TransactionStatus uint8 const ( - TransactionStatus_UNKNOWN TransactionStatus = 0 - TransactionStatus_PENDING TransactionStatus = 1 - TransactionStatus_PROCESSING TransactionStatus = 2 - TransactionStatus_FAILED TransactionStatus = 3 - TransactionStatus_SUCCEEDED TransactionStatus = 4 + TransactionStatus_UNKNOWN TransactionStatus = 0 + TransactionStatus_PENDING TransactionStatus = 1 + TransactionStatus_RELAYING TransactionStatus = 2 + TransactionStatus_AWAITING_RECEIPT TransactionStatus = 3 + TransactionStatus_FINISHED TransactionStatus = 4 + TransactionStatus_FAILED TransactionStatus = 5 ) var TransactionStatus_name = map[uint8]string{ 0: "UNKNOWN", 1: "PENDING", - 2: "PROCESSING", - 3: "FAILED", - 4: "SUCCEEDED", + 2: "RELAYING", + 3: "AWAITING_RECEIPT", + 4: "FINISHED", + 5: "FAILED", } var TransactionStatus_value = map[string]uint8{ - "UNKNOWN": 0, - "PENDING": 1, - "PROCESSING": 2, - "FAILED": 3, - "SUCCEEDED": 4, + "UNKNOWN": 0, + "PENDING": 1, + "RELAYING": 2, + "AWAITING_RECEIPT": 3, + "FINISHED": 4, + "FAILED": 5, } func (x TransactionStatus) String() string { @@ -416,9 +419,8 @@ type IntentReceipt struct { // destination intent transaction db reference and runtime type DestinationTransactionID uint64 `json:"-" db:"dest_txn_id"` DestinationTransaction *IntentTransaction `json:"destinationTransaction" db:"-"` - // Worker fields for tracking background processing - ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` - RetryCount *uint32 `json:"retryCount" db:"retry_count,omitempty"` + ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` + RetryCount *uint32 `json:"retryCount" db:"retry_count,omitempty"` // 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 @@ -435,21 +437,24 @@ type IntentTransaction struct { // Intent id this transaction is associated with IntentID prototyp.Hash `json:"intentId" db:"intent_id"` // Chain where this transaction executes - ChainID uint64 `json:"chainId" db:"chain_id"` - MetaTxnID prototyp.Hash `json:"metaTxnId" db:"meta_txn_id"` - // Transaction hash for this specific transaction - TxnHash prototyp.Hash `json:"txnHash" db:"txn_hash,omitempty"` - // Recipient address (aka, the intentAddress) - ToAddress prototyp.Hash `json:"toAddress" db:"to_address"` + ChainID uint64 `json:"chainId" db:"chain_id"` + FromAddress prototyp.Hash `json:"fromAddress" db:"from_address"` + 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"` - // TODO: how about calldata here too..? feels useful to have.. + TokenAmount prototyp.BigInt `json:"tokenAmount" db:"token_amount"` + Calldata prototyp.Hash `json:"calldata" db:"calldata"` + MetaTxnID prototyp.Hash `json:"metaTxnId" db:"meta_txn_id"` + MetaTxnFeeQuote string `json:"metaTxnFeeQuote" db:"fee_quote"` + Preconditions *IntentPrecondition `json:"preconditions" db:"preconditions"` + // Transaction hash received from the relayer after it's mined. + TxnHash prototyp.Hash `json:"txnHash" db:"txn_hash,omitempty"` // Status of this specific transaction - TxnStatus TransactionStatus `json:"txnStatus" db:"txn_status"` - UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` + Status TransactionStatus `json:"status" db:"status"` + StatusReason *string `json:"statusReason" db:"status_reason,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } // IntentProviderQuote represents the quotes from the underlining providers for both From d933546e72656d34ea3d2b2b55917bcf70524983 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:25:15 +0000 Subject: [PATCH 29/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 93682089..57bda5e1 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 be6fdd3eab15f477b03ddf9bd7abeb162178b4d0 +// trails-api v1.0.0 57e04bf9ac957ab0646258ce21b9b52859e2d8b3 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "be6fdd3eab15f477b03ddf9bd7abeb162178b4d0" + return "57e04bf9ac957ab0646258ce21b9b52859e2d8b3" } // @@ -259,18 +259,26 @@ func (x *ChainGasUsageStatus) Is(values ...ChainGasUsageStatus) bool { // // ............ type QuoteIntentRequest struct { - OwnerAddress prototyp.Hash `json:"ownerAddress"` - OriginChainID uint64 `json:"originChainId"` - OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` - DestinationChainID uint64 `json:"destinationChainId"` - DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` - DestinationTokenAmount prototyp.BigInt `json:"destinationTokenAmount"` - DestinationToAddress prototyp.Hash `json:"destinationToAddress"` - DestinationCallData *string `json:"destinationCallData"` - DestinationCallValue *string `json:"destinationCallValue"` - // NOTE: EXACT_OUTPUT is the default if unspecified - TradeType *TradeType `json:"tradeType,omitempty"` - Options *QuoteIntentRequestOptions `json:"options,omitempty"` + // 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 *string `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"` + // options for additional auxiliary params + Options *QuoteIntentRequestOptions `json:"options,omitempty"` } type QuoteIntentRequestOptions struct { From 46c61e70e2cfd7b6e293bd0462878cacd4909fb9 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 17:09:32 +0000 Subject: [PATCH 30/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 57bda5e1..01ac639d 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 57e04bf9ac957ab0646258ce21b9b52859e2d8b3 +// trails-api v1.0.0 ebcef7106408aa5206a04dd007cb25e18bf014fd // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "57e04bf9ac957ab0646258ce21b9b52859e2d8b3" + return "ebcef7106408aa5206a04dd007cb25e18bf014fd" } // @@ -122,30 +122,30 @@ func (x *QuoteProviderType) Is(values ...QuoteProviderType) bool { type TransactionStatus uint8 const ( - TransactionStatus_UNKNOWN TransactionStatus = 0 - TransactionStatus_PENDING TransactionStatus = 1 - TransactionStatus_RELAYING TransactionStatus = 2 - TransactionStatus_AWAITING_RECEIPT TransactionStatus = 3 - TransactionStatus_FINISHED TransactionStatus = 4 - TransactionStatus_FAILED TransactionStatus = 5 + TransactionStatus_UNKNOWN TransactionStatus = 0 + TransactionStatus_PENDING TransactionStatus = 1 + TransactionStatus_RELAYING TransactionStatus = 2 + TransactionStatus_MINING TransactionStatus = 3 + TransactionStatus_SUCCEEDED TransactionStatus = 4 + TransactionStatus_FAILED TransactionStatus = 5 ) var TransactionStatus_name = map[uint8]string{ 0: "UNKNOWN", 1: "PENDING", 2: "RELAYING", - 3: "AWAITING_RECEIPT", - 4: "FINISHED", + 3: "MINING", + 4: "SUCCEEDED", 5: "FAILED", } var TransactionStatus_value = map[string]uint8{ - "UNKNOWN": 0, - "PENDING": 1, - "RELAYING": 2, - "AWAITING_RECEIPT": 3, - "FINISHED": 4, - "FAILED": 5, + "UNKNOWN": 0, + "PENDING": 1, + "RELAYING": 2, + "MINING": 3, + "SUCCEEDED": 4, + "FAILED": 5, } func (x TransactionStatus) String() string { @@ -427,8 +427,6 @@ type IntentReceipt struct { // destination intent transaction db reference and runtime type DestinationTransactionID uint64 `json:"-" db:"dest_txn_id"` DestinationTransaction *IntentTransaction `json:"destinationTransaction" db:"-"` - ProcessedAt *time.Time `json:"processedAt,omitempty" db:"processed_at,omitempty"` - RetryCount *uint32 `json:"retryCount" db:"retry_count,omitempty"` // 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 From a8edda44022e3592260bfbf769ff707d76b8aa60 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:01:35 +0000 Subject: [PATCH 31/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 01ac639d..5667fde4 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 ebcef7106408aa5206a04dd007cb25e18bf014fd +// trails-api v1.0.0 04e3b566a4664b522b5144d2c88002fd77dbb760 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "ebcef7106408aa5206a04dd007cb25e18bf014fd" + return "04e3b566a4664b522b5144d2c88002fd77dbb760" } // @@ -537,6 +537,12 @@ type MetaTxnFeeDetails struct { FeeNative prototyp.BigInt `json:"feeNative"` } +// IntentSummary represents a summary view of an intent for listing purposes. +type IntentSummary struct { + // intent deterministic id + IntentID prototyp.Hash `json:"intentId"` +} + // NOTE: this also comes from pricefeed package.. // lets review, and move it there .. perhaps have types // here, as seems we need it..? HOWEVER.. it seems @@ -788,8 +794,8 @@ type GetIntentTransactionHistoryRequest struct { } type GetIntentTransactionHistoryResponse struct { - Transactions []*IntentTransaction `json:"transactions"` - NextPage *Page `json:"nextPage"` + Intents []*IntentSummary `json:"intents"` + NextPage *Page `json:"nextPage"` } // Gas fee options for intent entry (leverages existing Entrypoint fee option params/result types). From de58ca4a05478a78db70515668d579136acd98de Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sat, 1 Nov 2025 02:52:40 +0000 Subject: [PATCH 32/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 52 +++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 5667fde4..4e802bea 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 04e3b566a4664b522b5144d2c88002fd77dbb760 +// trails-api v1.0.0 005a369b19dfebdb65dde9e0e5ddac91bfc04c44 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "04e3b566a4664b522b5144d2c88002fd77dbb760" + return "005a369b19dfebdb65dde9e0e5ddac91bfc04c44" } // @@ -443,7 +443,8 @@ type IntentTransaction struct { // Intent id this transaction is associated with IntentID prototyp.Hash `json:"intentId" db:"intent_id"` // Chain where this transaction executes - ChainID uint64 `json:"chainId" db:"chain_id"` + ChainID uint64 `json:"chainId" db:"chain_id"` + // TODO: we can remove the from..? FromAddress prototyp.Hash `json:"fromAddress" db:"from_address"` ToAddress prototyp.Hash `json:"toAddress" db:"to_address"` // Token being transferred in this transaction @@ -539,8 +540,53 @@ type MetaTxnFeeDetails struct { // IntentSummary represents a summary view of an intent for listing purposes. 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 `json:"originChainMetadata"` + DestinationChainID uint64 `json:"destinationChainId"` + DestinationChainMetadata *ChainMetadata `json:"destinationChainMetadata"` + // 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"` + // 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"` +} + +type ChainMetadata struct { + Name string `json:"name"` + LogoUri string `json:"logoUri,omitempty"` +} + +type TokenMetadata struct { + Name string `json:"name"` + Symbol string `json:"symbol"` + Decimals uint8 `json:"decimals"` + LogoUri string `json:"logoUri,omitempty"` } // NOTE: this also comes from pricefeed package.. From f8b11bf784bac8105bcb15e6cb5f88e1f2260ec5 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sun, 2 Nov 2025 02:23:37 +0000 Subject: [PATCH 33/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 85 +++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 4e802bea..8857da95 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 005a369b19dfebdb65dde9e0e5ddac91bfc04c44 +// trails-api v1.0.0 0b6de03a213c68572c446338975ad1f080d68655 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "005a369b19dfebdb65dde9e0e5ddac91bfc04c44" + return "0b6de03a213c68572c446338975ad1f080d68655" } // @@ -56,6 +56,7 @@ type TrailsClient interface { GetIntentTransactionHistory(ctx context.Context, getIntentTransactionHistoryRequest GetIntentTransactionHistoryRequest) (*GetIntentTransactionHistoryResponse, error) GetIntentGasFeeOptions(ctx context.Context, getIntentGasFeeOptionsRequest GetIntentGasFeeOptionsRequest) (*GetIntentGasFeeOptionsResponse, error) GetIntentEntryTransaction(ctx context.Context, getIntentEntryTransactionRequest GetIntentEntryTransactionRequest) (*GetIntentEntryTransactionResponse, error) + GetTokenPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error) } // @@ -548,10 +549,9 @@ type IntentSummary struct { // intent owner / main signer OwnerAddress prototyp.Hash `json:"ownerAddress"` // origin and destination chain ids - OriginChainID uint64 `json:"originChainId"` - OriginChainMetadata *ChainMetadata `json:"originChainMetadata"` - DestinationChainID uint64 `json:"destinationChainId"` - DestinationChainMetadata *ChainMetadata `json:"destinationChainMetadata"` + 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"` @@ -578,45 +578,32 @@ type IntentSummary struct { } type ChainMetadata struct { + ChainID uint64 `json:"chainId"` Name string `json:"name"` - LogoUri string `json:"logoUri,omitempty"` + LogoURI string `json:"logoUri,omitempty"` + Testnet *bool `json:"testnet,omitempty"` } type TokenMetadata struct { - Name string `json:"name"` - Symbol string `json:"symbol"` - Decimals uint8 `json:"decimals"` - LogoUri string `json:"logoUri,omitempty"` -} - -// NOTE: this also comes from pricefeed package.. -// lets review, and move it there .. perhaps have types -// here, as seems we need it..? HOWEVER.. it seems -// that trails npm package still uses the sequence api -// for pricing directly, and we're not using the pricefeed -// from trails-api .. I think..? cuz, we don't have GetCoinPrices -// endpoint... so... -type TokenPrice struct { - Token *Token `json:"token"` - Price *Price `json:"price"` - Price24hChange *Price `json:"price24hChange"` - Price24hVol *Price `json:"price24hVol"` - FloorPrice *Price `json:"floorPrice,omitempty"` - BuyPrice *Price `json:"buyPrice,omitempty"` - SellPrice *Price `json:"sellPrice,omitempty"` - // TODO: review, copy other types, or not? - UpdatedAt *time.Time `json:"updatedAt"` + TokenAddress prototyp.Hash `json:"tokenAddress"` + Name string `json:"name"` + Symbol string `json:"symbol"` + Decimals *uint8 `json:"decimals,omitempty"` + LogoURI string `json:"logoUri,omitempty"` } type Token struct { ChainID uint64 `json:"chainId"` TokenAddress prototyp.Hash `json:"tokenAddress"` - TokenId *string `json:"tokenId"` + TokenSymbol *string `json:"tokenSymbol,omitempty"` } -type Price struct { - Value float64 `json:"value"` - Currency string `json:"currency"` +type TokenPrice struct { + Token *Token `json:"token"` + PriceUSD *float64 `json:"priceUsd"` + // - price?: float64 + // - currency: string + UpdatedAt time.Time `json:"updatedAt"` } type CCTPTransfer struct { @@ -955,6 +942,11 @@ var methods = map[string]method{ service: "Trails", annotations: map[string]string{}, }, + "/rpc/Trails/GetTokenPrices": { + name: "GetTokenPrices", + service: "Trails", + annotations: map[string]string{}, + }, } func WebrpcMethods() map[string]method { @@ -982,6 +974,7 @@ var WebRPCServices = map[string][]string{ "GetIntentTransactionHistory", "GetIntentGasFeeOptions", "GetIntentEntryTransaction", + "GetTokenPrices", }, } @@ -993,12 +986,12 @@ const TrailsPathPrefix = "/rpc/Trails/" type trailsClient struct { client HTTPClient - urls [14]string + urls [15]string } func NewTrailsClient(addr string, client HTTPClient) TrailsClient { prefix := urlBase(addr) + TrailsPathPrefix - urls := [14]string{ + urls := [15]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -1013,6 +1006,7 @@ func NewTrailsClient(addr string, client HTTPClient) TrailsClient { prefix + "GetIntentTransactionHistory", prefix + "GetIntentGasFeeOptions", prefix + "GetIntentEntryTransaction", + prefix + "GetTokenPrices", } return &trailsClient{ client: client, @@ -1244,6 +1238,25 @@ func (c *trailsClient) GetIntentEntryTransaction(ctx context.Context, getIntentE return out.Ret0, err } +func (c *trailsClient) GetTokenPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error) { + in := struct { + Arg0 []*Token `json:"tokens"` + }{tokens} + out := struct { + Ret0 []*TokenPrice `json:"tokenPrices"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + // // Client helpers // From 6744b4de6fb607aa5ec0cae727f1da8ac2734070 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:52:00 +0000 Subject: [PATCH 34/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 8857da95..204253b7 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 0b6de03a213c68572c446338975ad1f080d68655 +// trails-api v1.0.0 6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "0b6de03a213c68572c446338975ad1f080d68655" + return "6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9" } // @@ -585,6 +585,7 @@ type ChainMetadata struct { } type TokenMetadata struct { + ChainID uint64 `json:"chainId"` TokenAddress prototyp.Hash `json:"tokenAddress"` Name string `json:"name"` Symbol string `json:"symbol"` From 6e69c73562efeea1ca1cac91371265098c9bdd0d Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Sun, 2 Nov 2025 17:53:24 +0000 Subject: [PATCH 35/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 204253b7..19eee8e7 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9 +// trails-api v1.0.0 c652c2506895f07c946ff703ae630217360ae825 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9" + return "c652c2506895f07c946ff703ae630217360ae825" } // @@ -123,30 +123,37 @@ func (x *QuoteProviderType) Is(values ...QuoteProviderType) bool { type TransactionStatus uint8 const ( - TransactionStatus_UNKNOWN TransactionStatus = 0 - TransactionStatus_PENDING TransactionStatus = 1 - TransactionStatus_RELAYING TransactionStatus = 2 - TransactionStatus_MINING TransactionStatus = 3 - TransactionStatus_SUCCEEDED TransactionStatus = 4 - TransactionStatus_FAILED TransactionStatus = 5 + TransactionStatus_UNKNOWN TransactionStatus = 0 + // Queued. + TransactionStatus_PENDING TransactionStatus = 1 + // Sending to Relayer. + TransactionStatus_RELAYING TransactionStatus = 2 + // Sent to Relayer. + TransactionStatus_RELAYED TransactionStatus = 3 + // Waiting for receipt. + TransactionStatus_MINING TransactionStatus = 4 + TransactionStatus_SUCCEEDED TransactionStatus = 5 + TransactionStatus_FAILED TransactionStatus = 6 ) var TransactionStatus_name = map[uint8]string{ 0: "UNKNOWN", 1: "PENDING", 2: "RELAYING", - 3: "MINING", - 4: "SUCCEEDED", - 5: "FAILED", + 3: "RELAYED", + 4: "MINING", + 5: "SUCCEEDED", + 6: "FAILED", } var TransactionStatus_value = map[string]uint8{ "UNKNOWN": 0, "PENDING": 1, "RELAYING": 2, - "MINING": 3, - "SUCCEEDED": 4, - "FAILED": 5, + "RELAYED": 3, + "MINING": 4, + "SUCCEEDED": 5, + "FAILED": 6, } func (x TransactionStatus) String() string { From e6ab2d1d00f710e42042e27665022735d48337eb Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 3 Nov 2025 01:42:44 +0000 Subject: [PATCH 36/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 68 ++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 19eee8e7..577d1f8d 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 c652c2506895f07c946ff703ae630217360ae825 +// trails-api v1.0.0 a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "c652c2506895f07c946ff703ae630217360ae825" + return "a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8" } // @@ -312,20 +312,20 @@ type Intent struct { 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"` - OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"orig_intent_address"` - DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"dest_intent_address"` - DestinationSalt prototyp.BigInt `json:"destinationSalt" db:"destination_salt"` - DepositTransaction *DepositTransaction `json:"depositTransaction" db:"deposit_txn"` - Calls []*IntentCalls `json:"calls" db:"calls"` - Preconditions []*IntentPrecondition `json:"preconditions" db:"preconditions"` - MetaTxns []*MetaTxn `json:"metaTxns" db:"meta_txns"` - Quote *IntentProviderQuote `json:"quote" db:"quote"` - Fees *IntentFees `json:"fees" db:"fees"` - TrailsVersion string `json:"trailsVersion" db:"trails_version"` - 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"` + OwnerAddress prototyp.Hash `json:"ownerAddress" db:"owner_address"` + OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"orig_intent_address"` + DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"dest_intent_address"` + DestinationSalt prototyp.BigInt `json:"destinationSalt" db:"destination_salt"` + DepositTransaction *DepositTransaction `json:"depositTransaction" db:"deposit_txn"` + Calls []*IntentCalls `json:"calls" db:"calls"` + Preconditions []*TransactionPrecondition `json:"preconditions" db:"preconditions"` + MetaTxns []*MetaTxn `json:"metaTxns" db:"meta_txns"` + Quote *IntentProviderQuote `json:"quote" db:"quote"` + Fees *IntentFees `json:"fees" db:"fees"` + TrailsVersion string `json:"trailsVersion" db:"trails_version"` + 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"` } // DepositTransaction represents a deposit transfer transaction of the token amount @@ -360,23 +360,15 @@ type TransactionCall struct { BehaviorOnError *uint8 `json:"behaviorOnError"` } -type IntentPrecondition struct { - // TODO: value should be erc20MinAllowance to match 7795 - Type string `json:"type"` - ChainID uint64 `json:"chainId"` - Data *IntentPreconditionData `json:"data"` -} - -// transaction preconditions based on https://eips.ethereum.org/EIPS/eip-7795 -// chainId: `0x${string}`; // Hex chain id -// owner: `0x${string}`; // Address -// token: `0x${string}`; // Address -// minAmount: `0x${string}`; // Hex value -type IntentPreconditionData struct { - Address string `json:"address"` - Token string `json:"token"` - // TODOXXX: this probably should be a hex string.. what does ERC, should be string and prototyp.Hash - Min uint64 `json:"min"` +// TransactionPrecondition preconditions based on https://eips.ethereum.org/EIPS/eip-7795 +// NOTE: make sure this struct type matches the relayer TransactionPrecondition type. +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"` } // MetaTxn is a meta-transaction to be submitted to Sequence Relayer. @@ -458,11 +450,11 @@ type IntentTransaction struct { // 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:"calldata" db:"calldata"` - MetaTxnID prototyp.Hash `json:"metaTxnId" db:"meta_txn_id"` - MetaTxnFeeQuote string `json:"metaTxnFeeQuote" db:"fee_quote"` - Preconditions *IntentPrecondition `json:"preconditions" db:"preconditions"` + TokenAmount prototyp.BigInt `json:"tokenAmount" db:"token_amount"` + Calldata prototyp.Hash `json:"calldata" db:"calldata"` + MetaTxnID prototyp.Hash `json:"metaTxnId" db:"meta_txn_id"` + MetaTxnFeeQuote string `json:"metaTxnFeeQuote" db:"fee_quote"` + Precondition *TransactionPrecondition `json:"precondition" db:"precondition"` // Transaction hash received from the relayer after it's mined. TxnHash prototyp.Hash `json:"txnHash" db:"txn_hash,omitempty"` // Status of this specific transaction From ce0213ba7a31dd6e1381c17bd9449e6d33bee080 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 3 Nov 2025 22:22:15 +0000 Subject: [PATCH 37/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 218 ++++++++++++++--------------------- 1 file changed, 85 insertions(+), 133 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 577d1f8d..dbd06ab0 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8 +// trails-api v1.0.0 c41075ba78dccc2053a45ec888ac7d356d6f42a9 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8" + return "c41075ba78dccc2053a45ec888ac7d356d6f42a9" } // @@ -54,8 +54,6 @@ type TrailsClient interface { GetIntent(ctx context.Context, getIntentRequest GetIntentRequest) (*GetIntentResponse, error) SearchIntents(ctx context.Context, searchIntentsRequest SearchIntentsRequest) (*SearchIntentsResponse, error) GetIntentTransactionHistory(ctx context.Context, getIntentTransactionHistoryRequest GetIntentTransactionHistoryRequest) (*GetIntentTransactionHistoryResponse, error) - GetIntentGasFeeOptions(ctx context.Context, getIntentGasFeeOptionsRequest GetIntentGasFeeOptionsRequest) (*GetIntentGasFeeOptionsResponse, error) - GetIntentEntryTransaction(ctx context.Context, getIntentEntryTransactionRequest GetIntentEntryTransactionRequest) (*GetIntentEntryTransactionResponse, error) GetTokenPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error) } @@ -397,11 +395,6 @@ type MetaTxn struct { // // NOTE: this was previously named IntentTransaction // -// TODO: this type still needs some review.. for example, I wonder if we should have -// Intent or IntentReceipt split out the differrent transactions per chain as separate -// rows, instead of having it be consolidated.. I kinda prefer having them separate, -// but it could mean we have a new type called IntentTransaction which is that..? -// // db table: 'intent_receipts' type IntentReceipt struct { // id is an internal-only sequential primary key. @@ -416,11 +409,17 @@ type IntentReceipt struct { 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 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" db:"deposit_txn_hash"` - DepositTransactionStatus TransactionStatus `json:"depositTransactionStatus" db:"deposit_txn_status"` + // 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:"-"` @@ -444,17 +443,21 @@ type IntentTransaction struct { IntentID prototyp.Hash `json:"intentId" db:"intent_id"` // Chain where this transaction executes ChainID uint64 `json:"chainId" db:"chain_id"` - // TODO: we can remove the from..? + // TODO: any reason to keep 'fromAddress' ? we can get it from chain if we need FromAddress prototyp.Hash `json:"fromAddress" db:"from_address"` - ToAddress prototyp.Hash `json:"toAddress" db:"to_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:"calldata" db:"calldata"` - MetaTxnID prototyp.Hash `json:"metaTxnId" db:"meta_txn_id"` - MetaTxnFeeQuote string `json:"metaTxnFeeQuote" db:"fee_quote"` - Precondition *TransactionPrecondition `json:"precondition" db:"precondition"` + 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" 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" db:"txn_hash,omitempty"` // Status of this specific transaction @@ -619,43 +622,11 @@ type CCTPTransfer struct { CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } -type GetIntentEntrypointDepositParams struct { - UserAddress prototyp.Hash `json:"userAddress"` - TokenAddress prototyp.Hash `json:"tokenAddress"` - Amount prototyp.BigInt `json:"amount"` - IntentAddress prototyp.Hash `json:"intentAddress"` - ChainID uint64 `json:"chainID"` - Deadline uint64 `json:"deadline"` - IntentSignature string `json:"intentSignature"` - UsePermit *bool `json:"usePermit"` - PermitAmount prototyp.BigInt `json:"permitAmount"` - PermitDeadline *uint64 `json:"permitDeadline"` - PermitSignature *string `json:"permitSignature"` - // Optional fee parameters - FeeAmount prototyp.BigInt `json:"feeAmount"` -} - -type GetIntentEntrypointDepositResult struct { - DepositWalletAddress string `json:"depositWalletAddress"` - MetaTxn *MetaTxn `json:"metaTxn"` - FeeQuote string `json:"feeQuote"` - EntrypointAddress string `json:"entrypointAddress"` -} - -// Fee options related types -type GetIntentEntrypointDepositFeeOptionsParams struct { - UserAddress prototyp.Hash `json:"userAddress"` - TokenAddress prototyp.Hash `json:"tokenAddress"` - IntentAddress prototyp.Hash `json:"intentAddress"` - Amount prototyp.BigInt `json:"amount"` - ChainID uint64 `json:"chainID"` -} - -type GetIntentEntrypointDepositFeeOptionsResult struct { - GasEstimate *GasEstimate `json:"gasEstimate"` - FeeOptions []*FeeOption `json:"feeOptions"` - ExpiresAt uint64 `json:"expiresAt"` - FeeCollector string `json:"feeCollector"` +type GasFeeOptions struct { + GasEstimate *GasEstimate `json:"gasEstimate"` + FeeOptions []*FeeOption `json:"feeOptions"` + ExpiresAt time.Time `json:"expiresAt"` + FeeCollectorAddress prototyp.Hash `json:"feeCollectorAddress"` } type GasEstimate struct { @@ -666,12 +637,53 @@ type GasEstimate struct { } type FeeOption struct { - TokenAddress string `json:"tokenAddress"` - TokenSymbol string `json:"tokenSymbol"` - TokenDecimals int32 `json:"tokenDecimals"` - Amount string `json:"amount"` - AmountUSD float64 `json:"amountUsd"` - FeeCollector string `json:"feeCollector"` + // if value is 0x000...000 or 0xeee...eeee, it is native token 1Code has comments. Press enter to view. + 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"` +} + +// DepositSignature contains all gasless deposit signature parameters for ExecuteIntent +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"` +} + +// DepositIntentEntry contains gasless deposit metadata stored in JSONB +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"` } type TrailsAddressOverrides struct { @@ -748,7 +760,8 @@ type RuntimeStatus struct { // NOTE: we use the IntentRequest directly for the QuoteIntent request type. // And do not create a QuoteIntentRequest additional type, as its unnecessary. type QuoteIntentResponse struct { - Intent *Intent `json:"intent"` + Intent *Intent `json:"intent"` + GasFeeOptions *GasFeeOptions `json:"gasFeeOptions"` } // CommitIntent accepts a fully formed Intent and commits it for execution. CommitIntent @@ -766,8 +779,11 @@ type CommitIntentResponse struct { // Clients provide the transfer transaction hash that executed the transfer to the // intent origin address. type ExecuteIntentRequest struct { - IntentID prototyp.Hash `json:"intentId"` + 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"` } type ExecuteIntentResponse struct { @@ -831,24 +847,6 @@ type GetIntentTransactionHistoryResponse struct { NextPage *Page `json:"nextPage"` } -// Gas fee options for intent entry (leverages existing Entrypoint fee option params/result types). -type GetIntentGasFeeOptionsRequest struct { - Params *GetIntentEntrypointDepositFeeOptionsParams `json:"params"` -} - -type GetIntentGasFeeOptionsResponse struct { - Result *GetIntentEntrypointDepositFeeOptionsResult `json:"result"` -} - -// Entry transaction (deposit) construction for an intent (leverages existing Entrypoint deposit params/result types). -type GetIntentEntryTransactionRequest struct { - Params *GetIntentEntrypointDepositParams `json:"params"` -} - -type GetIntentEntryTransactionResponse struct { - Result *GetIntentEntrypointDepositResult `json:"result"` -} - // Page represents a results page. This can be used both to request a page and // to store the state of a page. type Page struct { @@ -932,16 +930,6 @@ var methods = map[string]method{ service: "Trails", annotations: map[string]string{}, }, - "/rpc/Trails/GetIntentGasFeeOptions": { - name: "GetIntentGasFeeOptions", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/GetIntentEntryTransaction": { - name: "GetIntentEntryTransaction", - service: "Trails", - annotations: map[string]string{}, - }, "/rpc/Trails/GetTokenPrices": { name: "GetTokenPrices", service: "Trails", @@ -972,8 +960,6 @@ var WebRPCServices = map[string][]string{ "GetIntent", "SearchIntents", "GetIntentTransactionHistory", - "GetIntentGasFeeOptions", - "GetIntentEntryTransaction", "GetTokenPrices", }, } @@ -986,12 +972,12 @@ const TrailsPathPrefix = "/rpc/Trails/" type trailsClient struct { client HTTPClient - urls [15]string + urls [13]string } func NewTrailsClient(addr string, client HTTPClient) TrailsClient { prefix := urlBase(addr) + TrailsPathPrefix - urls := [15]string{ + urls := [13]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -1004,8 +990,6 @@ func NewTrailsClient(addr string, client HTTPClient) TrailsClient { prefix + "GetIntent", prefix + "SearchIntents", prefix + "GetIntentTransactionHistory", - prefix + "GetIntentGasFeeOptions", - prefix + "GetIntentEntryTransaction", prefix + "GetTokenPrices", } return &trailsClient{ @@ -1206,38 +1190,6 @@ func (c *trailsClient) GetIntentTransactionHistory(ctx context.Context, getInten return out.Ret0, err } -func (c *trailsClient) GetIntentGasFeeOptions(ctx context.Context, getIntentGasFeeOptionsRequest GetIntentGasFeeOptionsRequest) (*GetIntentGasFeeOptionsResponse, error) { - out := struct { - Ret0 *GetIntentGasFeeOptionsResponse - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], getIntentGasFeeOptionsRequest, &out.Ret0) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, err -} - -func (c *trailsClient) GetIntentEntryTransaction(ctx context.Context, getIntentEntryTransactionRequest GetIntentEntryTransactionRequest) (*GetIntentEntryTransactionResponse, error) { - out := struct { - Ret0 *GetIntentEntryTransactionResponse - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], getIntentEntryTransactionRequest, &out.Ret0) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, err -} - func (c *trailsClient) GetTokenPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error) { in := struct { Arg0 []*Token `json:"tokens"` @@ -1246,7 +1198,7 @@ func (c *trailsClient) GetTokenPrices(ctx context.Context, tokens []*Token) ([]* Ret0 []*TokenPrice `json:"tokenPrices"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { From d5b92cc437d5baee05a2f4ba63e6ef90de4eeeb7 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 4 Nov 2025 01:28:29 +0000 Subject: [PATCH 38/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index dbd06ab0..bd3406a3 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 c41075ba78dccc2053a45ec888ac7d356d6f42a9 +// trails-api v1.0.0 8f454c95cc0ada33868332c071b18e9dfed9c389 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "c41075ba78dccc2053a45ec888ac7d356d6f42a9" + return "8f454c95cc0ada33868332c071b18e9dfed9c389" } // @@ -637,7 +637,7 @@ type GasEstimate struct { } type FeeOption struct { - // if value is 0x000...000 or 0xeee...eeee, it is native token 1Code has comments. Press enter to view. + // 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"` From 699bc70b4ff15a3c85b0cc847abdbfc906127621 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 4 Nov 2025 02:03:39 +0000 Subject: [PATCH 39/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index bd3406a3..f334832d 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 8f454c95cc0ada33868332c071b18e9dfed9c389 +// trails-api v1.0.0 fb8c387446f202180d13383089d42cc09891df9e // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "8f454c95cc0ada33868332c071b18e9dfed9c389" + return "fb8c387446f202180d13383089d42cc09891df9e" } // @@ -418,7 +418,7 @@ type IntentReceipt struct { // the intent entrypoint contract. // // there will also be a deposit transaction to the origin intent address. - DepositTransactionID *uint64 `json:"-" db:"deposit_txn_id"` + 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"` @@ -442,8 +442,7 @@ type IntentTransaction struct { // Intent id this transaction is associated with IntentID prototyp.Hash `json:"intentId" db:"intent_id"` // Chain where this transaction executes - ChainID uint64 `json:"chainId" db:"chain_id"` - // TODO: any reason to keep 'fromAddress' ? we can get it from chain if we need + ChainID uint64 `json:"chainId" db:"chain_id"` FromAddress prototyp.Hash `json:"fromAddress" db:"from_address"` // ie. originIntentAddress, TrailsRouter, or TrailsIntentEntrypoint ToAddress prototyp.Hash `json:"toAddress" db:"to_address"` From 5ea903fb39048897d35497d17fc494865b988d79 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:42:23 +0000 Subject: [PATCH 40/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index f334832d..f4d369e2 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 fb8c387446f202180d13383089d42cc09891df9e +// trails-api v1.0.0 5466ab4ac18cc3dba87474e761c45420d9a0d137 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "fb8c387446f202180d13383089d42cc09891df9e" + return "5466ab4ac18cc3dba87474e761c45420d9a0d137" } // @@ -459,6 +459,8 @@ type IntentTransaction struct { DepositIntentEntry *DepositIntentEntry `json:"depositIntentEntry" db:"deposit_intent_entry,omitempty"` // Transaction hash received from the relayer after it's mined. TxnHash prototyp.Hash `json:"txnHash" db:"txn_hash,omitempty"` + // On-chain block timestamp when txn was mined + TxnMinedAt *time.Time `json:"txnMinedAt" db:"txn_mined_at,omitempty"` // Status of this specific transaction Status TransactionStatus `json:"status" db:"status"` StatusReason *string `json:"statusReason" db:"status_reason,omitempty"` From 800d2b893cb5a065707960a877b36e44e8edebee Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 02:13:13 +0000 Subject: [PATCH 41/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index f4d369e2..3fcb3d25 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 5466ab4ac18cc3dba87474e761c45420d9a0d137 +// trails-api v1.0.0 dde1603b363889099a3f3af5ca2dac9a0937cf7a // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "5466ab4ac18cc3dba87474e761c45420d9a0d137" + return "dde1603b363889099a3f3af5ca2dac9a0937cf7a" } // @@ -452,13 +452,13 @@ type IntentTransaction struct { 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" db:"meta_txn_id,omitempty"` + 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" db:"txn_hash,omitempty"` + 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"` // Status of this specific transaction From d363cec7178ec56d1fe25513213ba00e8ba4aa28 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 16:34:20 +0000 Subject: [PATCH 42/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 58 +++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 3fcb3d25..f69c5e27 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 dde1603b363889099a3f3af5ca2dac9a0937cf7a +// trails-api v1.0.0 cbd6d970d0d38194195eb3409777b9ef67cd0714 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "dde1603b363889099a3f3af5ca2dac9a0937cf7a" + return "cbd6d970d0d38194195eb3409777b9ef67cd0714" } // @@ -122,36 +122,46 @@ type TransactionStatus uint8 const ( TransactionStatus_UNKNOWN TransactionStatus = 0 - // Queued. - TransactionStatus_PENDING TransactionStatus = 1 - // Sending to Relayer. - TransactionStatus_RELAYING TransactionStatus = 2 - // Sent to Relayer. - TransactionStatus_RELAYED TransactionStatus = 3 - // Waiting for receipt. - TransactionStatus_MINING TransactionStatus = 4 - TransactionStatus_SUCCEEDED TransactionStatus = 5 - TransactionStatus_FAILED TransactionStatus = 6 + // 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 + // Worker: Waiting for receipt + TransactionStatus_MINING TransactionStatus = 5 + // Txn is mined onchain with success status + TransactionStatus_SUCCEEDED TransactionStatus = 6 + // Txn is mined onchain with failure status + TransactionStatus_FAILED TransactionStatus = 7 + // Flow aborted at one of the stages, and never completed onchain txn + TransactionStatus_ABORTED TransactionStatus = 8 ) var TransactionStatus_name = map[uint8]string{ 0: "UNKNOWN", - 1: "PENDING", - 2: "RELAYING", - 3: "RELAYED", - 4: "MINING", - 5: "SUCCEEDED", - 6: "FAILED", + 1: "ON_HOLD", + 2: "PENDING", + 3: "RELAYING", + 4: "SENT", + 5: "MINING", + 6: "SUCCEEDED", + 7: "FAILED", + 8: "ABORTED", } var TransactionStatus_value = map[string]uint8{ "UNKNOWN": 0, - "PENDING": 1, - "RELAYING": 2, - "RELAYED": 3, - "MINING": 4, - "SUCCEEDED": 5, - "FAILED": 6, + "ON_HOLD": 1, + "PENDING": 2, + "RELAYING": 3, + "SENT": 4, + "MINING": 5, + "SUCCEEDED": 6, + "FAILED": 7, + "ABORTED": 8, } func (x TransactionStatus) String() string { From 372b2b7c3d21e49103f72ab3fc0e33ef2865d347 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 16:56:34 +0000 Subject: [PATCH 43/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index f69c5e27..91d24601 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 cbd6d970d0d38194195eb3409777b9ef67cd0714 +// trails-api v1.0.0 ceebf8def1df165f16d66ce5580c84fe2375c8b6 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "cbd6d970d0d38194195eb3409777b9ef67cd0714" + return "ceebf8def1df165f16d66ce5580c84fe2375c8b6" } // @@ -434,8 +434,10 @@ type IntentReceipt struct { OriginTransactionID uint64 `json:"-" db:"orig_txn_id"` OriginTransaction *IntentTransaction `json:"originTransaction" db:"-"` // destination intent transaction db reference and runtime type - DestinationTransactionID uint64 `json:"-" db:"dest_txn_id"` - DestinationTransaction *IntentTransaction `json:"destinationTransaction" db:"-"` + // 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,omitempty" db:"-"` // 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 From 0caefb1e66e5630c8bd4084cb1459fe6c5f275ea Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 18:17:02 +0000 Subject: [PATCH 44/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 91d24601..24681a15 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 ceebf8def1df165f16d66ce5580c84fe2375c8b6 +// trails-api v1.0.0 8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "ceebf8def1df165f16d66ce5580c84fe2375c8b6" + return "8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad" } // @@ -436,7 +436,7 @@ type IntentReceipt struct { // 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"` + DestinationTransactionID *uint64 `json:"-" db:"dest_txn_id,omitempty"` DestinationTransaction *IntentTransaction `json:"destinationTransaction,omitempty" db:"-"` // timestamp when the intent receipt was updated, usually from status change UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` From ec5d567cd6fe4be41663b6b5aa1e96fe99114d1b Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Thu, 6 Nov 2025 11:50:13 +0000 Subject: [PATCH 45/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 24681a15..cc737e2c 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad +// trails-api v1.0.0 8a39e1f88ba87651e7acb6b8c27fc6682f072eac // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad" + return "8a39e1f88ba87651e7acb6b8c27fc6682f072eac" } // @@ -758,13 +758,21 @@ type Version struct { type RuntimeStatus struct { // overall status, true/false - HealthOK bool `json:"healthOK"` - StartTime time.Time `json:"startTime"` - Uptime uint64 `json:"uptime"` - Ver string `json:"ver"` - Branch string `json:"branch"` - CommitHash string `json:"commitHash"` - Runnables interface{} `json:"runnables"` + HealthOK bool `json:"healthOK"` + StartTime time.Time `json:"startTime"` + Uptime uint64 `json:"uptime"` + Ver string `json:"ver"` + Branch string `json:"branch"` + CommitHash string `json:"commitHash"` + Runnables interface{} `json:"runnables"` + Services []*ServiceStatus `json:"services"` +} + +type ServiceStatus struct { + Name string `json:"name"` + Healthy bool `json:"healthy"` + Error string `json:"error,omitempty"` + Latency string `json:"latency"` } // QuoteIntent accepts an intent request from the user/app and returns From bb4e465205fd2fcc7e19df85be13d91341d929f8 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 6 Nov 2025 13:49:37 +0000 Subject: [PATCH 46/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index cc737e2c..bca556e1 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 8a39e1f88ba87651e7acb6b8c27fc6682f072eac +// trails-api v1.0.0 b7052858fd352cc9ed13923cfd40d354519988a5 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "8a39e1f88ba87651e7acb6b8c27fc6682f072eac" + return "b7052858fd352cc9ed13923cfd40d354519988a5" } // @@ -847,9 +847,10 @@ type GetIntentResponse struct { // SearchIntents searches past intents based on filters. // We do not return 'solved' status intents here, only committed/executed/failed/succeeded. type SearchIntentsRequest struct { - ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` - ByDepositTransactionHash prototyp.Hash `json:"byDepositTransactionHash"` - ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` + ByIntentID prototyp.Hash `json:"byIntentId"` + ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` + ByTransactionHash prototyp.Hash `json:"byTransactionHash"` + ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` } type SearchIntentsResponse struct { From 034ee3f7a643c5d5660c9b735992e951f9f7df51 Mon Sep 17 00:00:00 2001 From: taylanpince <12650+taylanpince@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:37:07 +0000 Subject: [PATCH 47/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index bca556e1..2595b80f 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 b7052858fd352cc9ed13923cfd40d354519988a5 +// trails-api v1.0.0 9595a664b9e921548f098c902f79fb5365501005 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "b7052858fd352cc9ed13923cfd40d354519988a5" + return "9595a664b9e921548f098c902f79fb5365501005" } // @@ -312,6 +312,8 @@ type QuoteIntentRequestOptions struct { 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"` @@ -409,6 +411,8 @@ type MetaTxn struct { 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 @@ -848,9 +852,10 @@ type GetIntentResponse struct { // We do not return 'solved' status intents here, only committed/executed/failed/succeeded. type SearchIntentsRequest struct { ByIntentID prototyp.Hash `json:"byIntentId"` - ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` + ByProjectID *uint64 `json:"byProjectId"` ByTransactionHash prototyp.Hash `json:"byTransactionHash"` ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` + ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` } type SearchIntentsResponse struct { @@ -862,6 +867,9 @@ type SearchIntentsResponse struct { type GetIntentTransactionHistoryRequest struct { // cursor paging parameters Page *Page `json:"page"` + // optional project id scope filter + ByProjectID *uint64 `json:"byProjectId"` + ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` } type GetIntentTransactionHistoryResponse struct { From 31e00ce408e2cea84b91b416c957e4594c1a5d33 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Thu, 6 Nov 2025 19:20:37 +0000 Subject: [PATCH 48/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 50 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 2595b80f..c942943a 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 9595a664b9e921548f098c902f79fb5365501005 +// trails-api v1.0.0 14a0ef58105c745d01c3dadffec0f5a4274977b9 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "9595a664b9e921548f098c902f79fb5365501005" + return "14a0ef58105c745d01c3dadffec0f5a4274977b9" } // @@ -122,22 +122,24 @@ type TransactionStatus uint8 const ( TransactionStatus_UNKNOWN TransactionStatus = 0 - // On hold, ie. waiting for bridge (off-chain burn attestation) + // on hold, ie. waiting for bridge (off-chain burn attestation) TransactionStatus_ON_HOLD TransactionStatus = 1 - // Ready to be dequeued & sent by the worker + // ready to be dequeued & sent by the worker TransactionStatus_PENDING TransactionStatus = 2 - // Worker: sending to Relayer + // worker: sending to Relayer TransactionStatus_RELAYING TransactionStatus = 3 - // Sent to the blockchain, whether direct, or via Relayer + // sent to the blockchain, whether direct, or via Relayer TransactionStatus_SENT TransactionStatus = 4 - // Worker: Waiting for receipt - TransactionStatus_MINING TransactionStatus = 5 - // Txn is mined onchain with success status - TransactionStatus_SUCCEEDED TransactionStatus = 6 - // Txn is mined onchain with failure status - TransactionStatus_FAILED TransactionStatus = 7 - // Flow aborted at one of the stages, and never completed onchain txn - TransactionStatus_ABORTED TransactionStatus = 8 + // 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 ) var TransactionStatus_name = map[uint8]string{ @@ -146,10 +148,11 @@ var TransactionStatus_name = map[uint8]string{ 2: "PENDING", 3: "RELAYING", 4: "SENT", - 5: "MINING", - 6: "SUCCEEDED", - 7: "FAILED", - 8: "ABORTED", + 5: "ERRORED", + 6: "MINING", + 7: "SUCCEEDED", + 8: "FAILED", + 9: "ABORTED", } var TransactionStatus_value = map[string]uint8{ @@ -158,10 +161,11 @@ var TransactionStatus_value = map[string]uint8{ "PENDING": 2, "RELAYING": 3, "SENT": 4, - "MINING": 5, - "SUCCEEDED": 6, - "FAILED": 7, - "ABORTED": 8, + "ERRORED": 5, + "MINING": 6, + "SUCCEEDED": 7, + "FAILED": 8, + "ABORTED": 9, } func (x TransactionStatus) String() string { @@ -479,7 +483,7 @@ type IntentTransaction struct { TxnMinedAt *time.Time `json:"txnMinedAt" db:"txn_mined_at,omitempty"` // Status of this specific transaction Status TransactionStatus `json:"status" db:"status"` - StatusReason *string `json:"statusReason" db:"status_reason,omitempty"` + StatusReason *string `json:"statusReason" db:"status_reason"` UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` } From 807cf5c2cede5a97a3d6f3c02f6b22b5c49a3ee1 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 6 Nov 2025 19:25:54 +0000 Subject: [PATCH 49/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index c942943a..17645cc8 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 14a0ef58105c745d01c3dadffec0f5a4274977b9 +// trails-api v1.0.0 3926f2d1e537951cf40a23f389d5e2fd67138d85 // -- // Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "14a0ef58105c745d01c3dadffec0f5a4274977b9" + return "3926f2d1e537951cf40a23f389d5e2fd67138d85" } // @@ -1681,6 +1681,7 @@ var ( 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} + ErrIntentsDisabled = WebRPCError{Code: 9000, Name: "IntentsDisabled", Message: "Intents service is currently unavailable", HTTPStatus: 400} ) // From 3e25271e24b6c731d60505e47dea0e2e3b2d0eb7 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:22:45 +0000 Subject: [PATCH 50/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 17645cc8..72fe820b 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ // trails-api v1.0.0 3926f2d1e537951cf40a23f389d5e2fd67138d85 // -- -// Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.30.3 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=trails-api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -1690,7 +1690,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.30.2;gen-golang@v0.23.1;trails-api@v1.0.0" +const WebrpcHeaderValue = "webrpc@v0.30.3;gen-golang@v0.23.1;trails-api@v1.0.0" type WebrpcGenVersions struct { WebrpcGenVersion string From 7319a6bdb4dd5cf0aed96ca937e8cfd98d455c9f Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:28:18 +0000 Subject: [PATCH 51/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 72fe820b..b8b66625 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1.0.0 3926f2d1e537951cf40a23f389d5e2fd67138d85 +// trails-api v1.0.0 fee069af4a29b91f817065c04fb874b290307d46 // -- // Code generated by webrpc-gen@v0.30.3 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "3926f2d1e537951cf40a23f389d5e2fd67138d85" + return "fee069af4a29b91f817065c04fb874b290307d46" } // @@ -833,10 +833,19 @@ type GetIntentReceiptResponse struct { // WaitIntentReceipt will block until the intent reaches a terminal status or timeout. 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"` } 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. From 294f0bb95aada2152082fe74d28238035ef2772b Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:59:39 +0000 Subject: [PATCH 52/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index b8b66625..c88dd07f 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ // trails-api v1.0.0 fee069af4a29b91f817065c04fb874b290307d46 // -- -// Code generated by webrpc-gen@v0.30.3 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.30.4 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=trails-api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -1699,7 +1699,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.30.3;gen-golang@v0.23.1;trails-api@v1.0.0" +const WebrpcHeaderValue = "webrpc@v0.30.4;gen-golang@v0.23.1;trails-api@v1.0.0" type WebrpcGenVersions struct { WebrpcGenVersion string From 08c139392153f2f69ac0f54bed7035b4bf5ad994 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Fri, 7 Nov 2025 13:35:37 +0000 Subject: [PATCH 53/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index c88dd07f..910d03e0 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ -// trails-api v1.0.0 fee069af4a29b91f817065c04fb874b290307d46 +// trails-api v1-25.11.7-efaa43b 0a2ec431aa704fb3bb2b2b869fcd626960167c3a // -- -// Code generated by webrpc-gen@v0.30.4 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.31.0 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=trails-api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1.0.0" + return "v1-25.11.7-efaa43b" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "fee069af4a29b91f817065c04fb874b290307d46" + return "0a2ec431aa704fb3bb2b2b869fcd626960167c3a" } // @@ -1699,7 +1699,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.30.4;gen-golang@v0.23.1;trails-api@v1.0.0" +const WebrpcHeaderValue = "webrpc@v0.31.0;gen-golang@v0.23.1;trails-api@v1-25.11.7-efaa43b" type WebrpcGenVersions struct { WebrpcGenVersion string From b1badbfc4bbfb9f159cd1dae6534a7191927dc38 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Sun, 9 Nov 2025 16:56:15 +0000 Subject: [PATCH 54/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 166 ++--------------------------------- 1 file changed, 6 insertions(+), 160 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 910d03e0..d80324ea 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ -// trails-api v1-25.11.7-efaa43b 0a2ec431aa704fb3bb2b2b869fcd626960167c3a +// trails-api v1-25.11.7+942fca0 2ec4d8f78c24fb9872fbd885e12a05c408fa9215 // -- -// Code generated by webrpc-gen@v0.31.0 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=trails-api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.7-efaa43b" + return "v1-25.11.7+942fca0" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "0a2ec431aa704fb3bb2b2b869fcd626960167c3a" + return "2ec4d8f78c24fb9872fbd885e12a05c408fa9215" } // @@ -912,101 +912,6 @@ type SortBy struct { Order SortOrder `json:"order"` } -var methods = map[string]method{ - "/rpc/Trails/Ping": { - name: "Ping", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/Version": { - name: "Version", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/RuntimeStatus": { - name: "RuntimeStatus", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/Clock": { - name: "Clock", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/QuoteIntent": { - name: "QuoteIntent", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/CommitIntent": { - name: "CommitIntent", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/ExecuteIntent": { - name: "ExecuteIntent", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/WaitIntentReceipt": { - name: "WaitIntentReceipt", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/GetIntentReceipt": { - name: "GetIntentReceipt", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/GetIntent": { - name: "GetIntent", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/SearchIntents": { - name: "SearchIntents", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/GetIntentTransactionHistory": { - name: "GetIntentTransactionHistory", - service: "Trails", - annotations: map[string]string{}, - }, - "/rpc/Trails/GetTokenPrices": { - name: "GetTokenPrices", - service: "Trails", - annotations: map[string]string{}, - }, -} - -func WebrpcMethods() map[string]method { - res := make(map[string]method, len(methods)) - for k, v := range methods { - res[k] = v - } - - return res -} - -var WebRPCServices = map[string][]string{ - "Trails": { - "Ping", - "Version", - "RuntimeStatus", - "Clock", - "QuoteIntent", - "CommitIntent", - "ExecuteIntent", - "WaitIntentReceipt", - "GetIntentReceipt", - "GetIntent", - "SearchIntents", - "GetIntentTransactionHistory", - "GetTokenPrices", - }, -} - // // Client // @@ -1378,29 +1283,6 @@ func HTTPRequestHeaders(ctx context.Context) (http.Header, bool) { // Webrpc helpers // -type method struct { - name string - service string - annotations map[string]string -} - -func (m method) Name() string { - return m.name -} - -func (m method) Service() string { - return m.service -} - -func (m method) Annotations() map[string]string { - res := make(map[string]string, len(m.annotations)) - for k, v := range m.annotations { - res[k] = v - } - - return res -} - type contextKey struct { name string } @@ -1410,41 +1292,9 @@ func (k *contextKey) String() string { } var ( - HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} // client - HTTPRequestCtxKey = &contextKey{"HTTPRequest"} // server - ServiceNameCtxKey = &contextKey{"ServiceName"} // server - MethodNameCtxKey = &contextKey{"MethodName"} // server + HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} ) -func ServiceNameFromContext(ctx context.Context) string { - service, _ := ctx.Value(ServiceNameCtxKey).(string) - return service -} - -func MethodNameFromContext(ctx context.Context) string { - method, _ := ctx.Value(MethodNameCtxKey).(string) - return method -} - -func RequestFromContext(ctx context.Context) *http.Request { - r, _ := ctx.Value(HTTPRequestCtxKey).(*http.Request) - return r -} - -func MethodCtx(ctx context.Context) (method, bool) { - req := RequestFromContext(ctx) - if req == nil { - return method{}, false - } - - m, ok := methods[req.URL.Path] - if !ok { - return method{}, false - } - - return m, true -} - // PtrTo is a useful helper when constructing values for optional fields. func PtrTo[T any](v T) *T { return &v } @@ -1693,13 +1543,9 @@ var ( ErrIntentsDisabled = WebRPCError{Code: 9000, Name: "IntentsDisabled", Message: "Intents service is currently unavailable", HTTPStatus: 400} ) -// -// Webrpc -// - const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.0;gen-golang@v0.23.1;trails-api@v1-25.11.7-efaa43b" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.7+942fca0" type WebrpcGenVersions struct { WebrpcGenVersion string From ead144349bcca5c41f596c225a9b928b86fa5174 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Sun, 9 Nov 2025 19:11:50 +0000 Subject: [PATCH 55/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index d80324ea..0dc9f6ff 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.7+942fca0 2ec4d8f78c24fb9872fbd885e12a05c408fa9215 +// trails-api v1-25.11.9+dc2c999 1f32374aeedc5c73f86a8ebd52823eec0e04f7e9 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.7+942fca0" + return "v1-25.11.9+dc2c999" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "2ec4d8f78c24fb9872fbd885e12a05c408fa9215" + return "1f32374aeedc5c73f86a8ebd52823eec0e04f7e9" } // @@ -1545,7 +1545,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.7+942fca0" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.9+dc2c999" type WebrpcGenVersions struct { WebrpcGenVersion string From acadb267e59ccaea045a2a1fd0502ccf9807c77f Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 10 Nov 2025 01:23:14 +0000 Subject: [PATCH 56/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 0dc9f6ff..e308c814 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.9+dc2c999 1f32374aeedc5c73f86a8ebd52823eec0e04f7e9 +// trails-api v1-25.11.10+b0f163f 42e7f689fc0917f3cdbf0908e03bdc04412ac0a0 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.9+dc2c999" + return "v1-25.11.10+b0f163f" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "1f32374aeedc5c73f86a8ebd52823eec0e04f7e9" + return "42e7f689fc0917f3cdbf0908e03bdc04412ac0a0" } // @@ -302,7 +302,8 @@ type QuoteIntentRequest struct { } type QuoteIntentRequestOptions struct { - QuoteProvider *QuoteProviderType `json:"quoteProvider,omitempty"` + // Temporary: using string until proper enum is specified. + QuoteProvider *string `json:"quoteProvider,omitempty"` SlippageTolerance *float64 `json:"slippageTolerance,omitempty"` TrailsAddressOverrides *TrailsAddressOverrides `json:"trailsAddressOverrides,omitempty"` } @@ -1545,7 +1546,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.9+dc2c999" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+b0f163f" type WebrpcGenVersions struct { WebrpcGenVersion string From eca117074806bc192e6db7c9f1bedcfad0ae8aaf Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 10 Nov 2025 01:31:59 +0000 Subject: [PATCH 57/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index e308c814..d209a3d1 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.10+b0f163f 42e7f689fc0917f3cdbf0908e03bdc04412ac0a0 +// trails-api v1-25.11.10+4986c15b 62cc16eba4b94287678a2959a876da21baeca437 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.10+b0f163f" + return "v1-25.11.10+4986c15b" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "42e7f689fc0917f3cdbf0908e03bdc04412ac0a0" + return "62cc16eba4b94287678a2959a876da21baeca437" } // @@ -1546,7 +1546,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+b0f163f" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+4986c15b" type WebrpcGenVersions struct { WebrpcGenVersion string From d710350c71dc50bcc24bb0fe968698d4cb7130e8 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 10 Nov 2025 18:23:09 +0000 Subject: [PATCH 58/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index d209a3d1..ddd6e173 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.10+4986c15b 62cc16eba4b94287678a2959a876da21baeca437 +// trails-api v1-25.11.10+4986c15 8407d99deb0d05ae72dbc61512273b5f233a2f2f // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.10+4986c15b" + return "v1-25.11.10+4986c15" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "62cc16eba4b94287678a2959a876da21baeca437" + return "8407d99deb0d05ae72dbc61512273b5f233a2f2f" } // @@ -866,7 +866,7 @@ type GetIntentResponse struct { // We do not return 'solved' status intents here, only committed/executed/failed/succeeded. type SearchIntentsRequest struct { ByIntentID prototyp.Hash `json:"byIntentId"` - ByProjectID *uint64 `json:"byProjectId"` + ByProjectID uint64 `json:"byProjectId"` ByTransactionHash prototyp.Hash `json:"byTransactionHash"` ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` ByOriginIntentAddress prototyp.Hash `json:"byOriginIntentAddress"` @@ -882,7 +882,7 @@ type GetIntentTransactionHistoryRequest struct { // cursor paging parameters Page *Page `json:"page"` // optional project id scope filter - ByProjectID *uint64 `json:"byProjectId"` + ByProjectID uint64 `json:"byProjectId"` ByOwnerAddress prototyp.Hash `json:"byOwnerAddress"` } @@ -1546,7 +1546,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+4986c15b" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+4986c15" type WebrpcGenVersions struct { WebrpcGenVersion string From 141a32705fb4aaf8ade246f268020e3157c34f81 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 10 Nov 2025 18:48:22 +0000 Subject: [PATCH 59/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index ddd6e173..b2f81a6c 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.10+4986c15 8407d99deb0d05ae72dbc61512273b5f233a2f2f +// trails-api v1-25.11.10+50cc6ba e57425747f67b5ac795974a854b7968476d7a00d // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.10+4986c15" + return "v1-25.11.10+50cc6ba" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "8407d99deb0d05ae72dbc61512273b5f233a2f2f" + return "e57425747f67b5ac795974a854b7968476d7a00d" } // @@ -865,11 +865,12 @@ type GetIntentResponse struct { // SearchIntents searches past intents based on filters. // We do not return 'solved' status intents here, only committed/executed/failed/succeeded. 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"` + 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"` } type SearchIntentsResponse struct { @@ -1546,7 +1547,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+4986c15" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+50cc6ba" type WebrpcGenVersions struct { WebrpcGenVersion string From cc4948fb83da02034a30127d25b3fa4cc807de0a Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 11 Nov 2025 12:51:25 +0000 Subject: [PATCH 60/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index b2f81a6c..03227ac7 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.10+50cc6ba e57425747f67b5ac795974a854b7968476d7a00d +// trails-api v1-25.11.11+3974438 5bcc23aa3d68ad164816b32b7b20548298c8d9b0 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.10+50cc6ba" + return "v1-25.11.11+3974438" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "e57425747f67b5ac795974a854b7968476d7a00d" + return "5bcc23aa3d68ad164816b32b7b20548298c8d9b0" } // @@ -297,6 +297,10 @@ type QuoteIntentRequest struct { // 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"` } @@ -1547,7 +1551,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+50cc6ba" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+3974438" type WebrpcGenVersions struct { WebrpcGenVersion string From f870cc5b6ecc1df31f28e94845651de068f4d47c Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:06:36 +0000 Subject: [PATCH 61/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 03227ac7..feb3d18b 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.11+3974438 5bcc23aa3d68ad164816b32b7b20548298c8d9b0 +// trails-api v1-25.11.11+c55fecd5 2bcff18361635c52a47c47c9917168cdcce65834 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.11+3974438" + return "v1-25.11.11+c55fecd5" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "5bcc23aa3d68ad164816b32b7b20548298c8d9b0" + return "2bcff18361635c52a47c47c9917168cdcce65834" } // @@ -300,7 +300,7 @@ type QuoteIntentRequest struct { // 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"` + OnlyNativeGasFee bool `json:"onlyNativeGasFee,omitempty"` // options for additional auxiliary params Options *QuoteIntentRequestOptions `json:"options,omitempty"` } @@ -1551,7 +1551,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+3974438" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+c55fecd5" type WebrpcGenVersions struct { WebrpcGenVersion string From 16671a985cb32595817f95ecbd040352b2d318dd Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:40:55 +0000 Subject: [PATCH 62/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 53 ++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index feb3d18b..5bc23c01 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.11+c55fecd5 2bcff18361635c52a47c47c9917168cdcce65834 +// trails-api v1-25.11.10+0ef1bad 3fa9de480a3b42fe8129f714bab4fc452e9d4514 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.11+c55fecd5" + return "v1-25.11.10+0ef1bad" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "2bcff18361635c52a47c47c9917168cdcce65834" + return "3fa9de480a3b42fe8129f714bab4fc452e9d4514" } // @@ -285,11 +285,11 @@ type QuoteIntentRequest struct { 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 *string `json:"destinationCallValue"` + 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 @@ -331,20 +331,25 @@ type Intent struct { 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"` - OriginIntentAddress prototyp.Hash `json:"originIntentAddress" db:"orig_intent_address"` - DestinationIntentAddress prototyp.Hash `json:"destinationIntentAddress" db:"dest_intent_address"` - DestinationSalt prototyp.BigInt `json:"destinationSalt" db:"destination_salt"` - DepositTransaction *DepositTransaction `json:"depositTransaction" db:"deposit_txn"` - Calls []*IntentCalls `json:"calls" db:"calls"` - Preconditions []*TransactionPrecondition `json:"preconditions" db:"preconditions"` - MetaTxns []*MetaTxn `json:"metaTxns" db:"meta_txns"` - Quote *IntentProviderQuote `json:"quote" db:"quote"` - Fees *IntentFees `json:"fees" db:"fees"` - TrailsVersion string `json:"trailsVersion" db:"trails_version"` - 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"` + 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,omitempty" db:"dest_calls,omitempty"` + OriginPrecondition *TransactionPrecondition `json:"originPrecondition" db:"orig_precondition"` + DestinationPrecondition *TransactionPrecondition `json:"destinationPrecondition,omitempty" db:"dest_precondition,omitempty"` + OriginMetaTxn *MetaTxn `json:"originMetaTxn" db:"orig_meta_txn"` + DestinationMetaTxn *MetaTxn `json:"destinationMetaTxn,omitempty" db:"dest_meta_txn,omitempty"` + Quote *IntentProviderQuote `json:"quote" db:"quote"` + Fees *IntentFees `json:"fees" db:"fees"` + TrailsVersion string `json:"trailsVersion" db:"trails_version"` + 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"` } // DepositTransaction represents a deposit transfer transaction of the token amount @@ -515,7 +520,7 @@ type IntentProviderQuote struct { type IntentFees struct { // gas fees on origin and destination chains OriginGas *IntentTransactionGasFee `json:"originGas"` - DestinationGas *IntentTransactionGasFee `json:"destinationGas"` + DestinationGas *IntentTransactionGasFee `json:"destinationGas,omitempty"` // provider fees (swap + bridge + trails) Provider *IntentProviderFees `json:"provider"` // total fees including provider fees + gas fees @@ -1551,7 +1556,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+c55fecd5" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+0ef1bad" type WebrpcGenVersions struct { WebrpcGenVersion string From 21a32a027278cbffcd65fd6f0ec7d2a7be45f032 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:26:29 +0000 Subject: [PATCH 63/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 5bc23c01..05695c21 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.10+0ef1bad 3fa9de480a3b42fe8129f714bab4fc452e9d4514 +// trails-api v1-25.11.11+1d06160 15a812f58abc2c95e2e189e0310dacd0596a7508 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.10+0ef1bad" + return "v1-25.11.11+1d06160" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "3fa9de480a3b42fe8129f714bab4fc452e9d4514" + return "15a812f58abc2c95e2e189e0310dacd0596a7508" } // @@ -1556,7 +1556,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.10+0ef1bad" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+1d06160" type WebrpcGenVersions struct { WebrpcGenVersion string From 9155efa13c4c62c0e47a7875be60d7f8ea49c576 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:39:26 +0000 Subject: [PATCH 64/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 05695c21..081591fb 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.11+1d06160 15a812f58abc2c95e2e189e0310dacd0596a7508 +// trails-api v1-25.11.11+1d06160 ee5748afd93083a1de8eba307efcad35285cd8c6 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "15a812f58abc2c95e2e189e0310dacd0596a7508" + return "ee5748afd93083a1de8eba307efcad35285cd8c6" } // @@ -339,11 +339,11 @@ type Intent struct { 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,omitempty" db:"dest_calls,omitempty"` + DestinationCalls *IntentCalls `json:"destinationCalls" db:"dest_calls,omitempty"` OriginPrecondition *TransactionPrecondition `json:"originPrecondition" db:"orig_precondition"` - DestinationPrecondition *TransactionPrecondition `json:"destinationPrecondition,omitempty" db:"dest_precondition,omitempty"` + DestinationPrecondition *TransactionPrecondition `json:"destinationPrecondition" db:"dest_precondition,omitempty"` OriginMetaTxn *MetaTxn `json:"originMetaTxn" db:"orig_meta_txn"` - DestinationMetaTxn *MetaTxn `json:"destinationMetaTxn,omitempty" db:"dest_meta_txn,omitempty"` + 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"` From 59efdfb34e6d556737b12261c3896ed9dd912fff Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:01:51 +0000 Subject: [PATCH 65/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 081591fb..f7c795b2 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.11+1d06160 ee5748afd93083a1de8eba307efcad35285cd8c6 +// trails-api v1-25.11.11+5874e69 33a6141c3a06d537a04fb28c7629368b534dfeba // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.11+1d06160" + return "v1-25.11.11+5874e69" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "ee5748afd93083a1de8eba307efcad35285cd8c6" + return "33a6141c3a06d537a04fb28c7629368b534dfeba" } // @@ -520,7 +520,7 @@ type IntentProviderQuote struct { type IntentFees struct { // gas fees on origin and destination chains OriginGas *IntentTransactionGasFee `json:"originGas"` - DestinationGas *IntentTransactionGasFee `json:"destinationGas,omitempty"` + DestinationGas *IntentTransactionGasFee `json:"destinationGas"` // provider fees (swap + bridge + trails) Provider *IntentProviderFees `json:"provider"` // total fees including provider fees + gas fees @@ -1556,7 +1556,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+1d06160" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+5874e69" type WebrpcGenVersions struct { WebrpcGenVersion string From b98b3c7aec48eb91bcf6d6985e57698923fdd849 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 12 Nov 2025 15:45:41 +0000 Subject: [PATCH 66/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index f7c795b2..fc43d632 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.11+5874e69 33a6141c3a06d537a04fb28c7629368b534dfeba +// trails-api v1-25.11.11+c8ddd1e ebd89d95e8dd3b22ad108ccc213058b6ac9813cb // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.11+5874e69" + return "v1-25.11.11+c8ddd1e" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "33a6141c3a06d537a04fb28c7629368b534dfeba" + return "ebd89d95e8dd3b22ad108ccc213058b6ac9813cb" } // @@ -1556,7 +1556,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+5874e69" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+c8ddd1e" type WebrpcGenVersions struct { WebrpcGenVersion string From 6661ff7010635aab6594776bb470a5a334d0b83f Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:22:31 +0000 Subject: [PATCH 67/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index fc43d632..1b90c337 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.11+c8ddd1e ebd89d95e8dd3b22ad108ccc213058b6ac9813cb +// trails-api v1-25.11.12+c88b9c0 7869f7a0c44bf437072d8f1dfabd3a80677eed64 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.11+c8ddd1e" + return "v1-25.11.12+c88b9c0" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "ebd89d95e8dd3b22ad108ccc213058b6ac9813cb" + return "7869f7a0c44bf437072d8f1dfabd3a80677eed64" } // @@ -1556,7 +1556,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.11+c8ddd1e" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.12+c88b9c0" type WebrpcGenVersions struct { WebrpcGenVersion string From 5fbe9eab9f8f7db0b6064b3abf8ba7d094c59c84 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 12 Nov 2025 19:44:24 +0000 Subject: [PATCH 68/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 1b90c337..982ef556 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.12+c88b9c0 7869f7a0c44bf437072d8f1dfabd3a80677eed64 +// trails-api v1-25.11.12+c88b9c0 77487fbe9b45851805b54a57305e7cc263d06e94 // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -34,7 +34,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "7869f7a0c44bf437072d8f1dfabd3a80677eed64" + return "77487fbe9b45851805b54a57305e7cc263d06e94" } // @@ -675,6 +675,7 @@ type FeeOption struct { Amount prototyp.BigInt `json:"amount"` AmountUSD float64 `json:"amountUsd"` FeeCollectorAddress prototyp.Hash `json:"feeCollectorAddress"` + Is2612 bool `json:"is2612"` } // DepositSignature contains all gasless deposit signature parameters for ExecuteIntent From a4c0998c5f4e62648b5f9be0cc76fda71f535d27 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:06:42 +0000 Subject: [PATCH 69/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 982ef556..78574dc8 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.12+c88b9c0 77487fbe9b45851805b54a57305e7cc263d06e94 +// trails-api v1-25.11.12+a2db2be7 20fe3d1792b8766e384c5b93e4799b7c699cd8bd // -- // Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.12+c88b9c0" + return "v1-25.11.12+a2db2be7" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "77487fbe9b45851805b54a57305e7cc263d06e94" + return "20fe3d1792b8766e384c5b93e4799b7c699cd8bd" } // @@ -1557,7 +1557,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.12+c88b9c0" +const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.12+a2db2be7" type WebrpcGenVersions struct { WebrpcGenVersion string From 587085eb692acd4910b4fa415ae3e5bc79ea6ebc Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 13 Nov 2025 14:30:51 +0000 Subject: [PATCH 70/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 78574dc8..4f7ac757 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,6 +1,6 @@ -// trails-api v1-25.11.12+a2db2be7 20fe3d1792b8766e384c5b93e4799b7c699cd8bd +// trails-api v1-25.11.12+a2db2be d024aae789605a58dbcd47182738ca7da6eda4f2 // -- -// Code generated by webrpc-gen@v0.31.1 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=trails-api.ridl -target=golang -pkg=api -client -out=./clients/trails-api.gen.go package api @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.12+a2db2be7" + return "v1-25.11.12+a2db2be" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "20fe3d1792b8766e384c5b93e4799b7c699cd8bd" + return "d024aae789605a58dbcd47182738ca7da6eda4f2" } // @@ -1557,7 +1557,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.1;gen-golang@v0.23.3;trails-api@v1-25.11.12+a2db2be7" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.12+a2db2be" type WebrpcGenVersions struct { WebrpcGenVersion string From 653823131c2df2f03c47b8338407d47f4388697a Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Fri, 14 Nov 2025 14:14:55 +0000 Subject: [PATCH 71/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 4f7ac757..4315e595 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.12+a2db2be d024aae789605a58dbcd47182738ca7da6eda4f2 +// trails-api v1-25.11.14+2870fe3 dd49aae875015647f45fa67679fc346b0abbb43b // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.12+a2db2be" + return "v1-25.11.14+2870fe3" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "d024aae789605a58dbcd47182738ca7da6eda4f2" + return "dd49aae875015647f45fa67679fc346b0abbb43b" } // @@ -908,9 +908,9 @@ 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 *interface{} `json:"before,omitempty"` + Before *uint64 `json:"before,omitempty"` // Cursor: return column > after - include to get next page - After *interface{} `json:"after,omitempty"` + After *uint64 `json:"after,omitempty"` // Sorting filter Sort []*SortBy `json:"sort,omitempty"` // Number of items per page @@ -1557,7 +1557,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.12+a2db2be" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.14+2870fe3" type WebrpcGenVersions struct { WebrpcGenVersion string From 297738e36fc3b63729ffbaae8b5b5dd8f8831988 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 17 Nov 2025 12:38:22 +0000 Subject: [PATCH 72/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 65 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 4315e595..bbfdfd9c 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.14+2870fe3 dd49aae875015647f45fa67679fc346b0abbb43b +// trails-api v1-25.11.14+9db63bbe 907e9a4690aa7181864692baa21f0728a832801d // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.14+2870fe3" + return "v1-25.11.14+9db63bbe" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "dd49aae875015647f45fa67679fc346b0abbb43b" + return "907e9a4690aa7181864692baa21f0728a832801d" } // @@ -1525,39 +1525,40 @@ var ( // Schema errors 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} - ErrIntentsDisabled = WebRPCError{Code: 9000, Name: "IntentsDisabled", Message: "Intents service is currently unavailable", HTTPStatus: 400} + 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} + ErrIntentsSameChainNative = WebRPCError{Code: 7000, Name: "IntentsSameChainNative", Message: "Intents skipped as client is attempting same-chain native transaction", HTTPStatus: 400} + ErrIntentsDisabled = WebRPCError{Code: 9000, Name: "IntentsDisabled", Message: "Intents service is currently unavailable", HTTPStatus: 400} ) const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.14+2870fe3" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.14+9db63bbe" type WebrpcGenVersions struct { WebrpcGenVersion string From 1633f0d621f0678e0b7787383f9299a7e716046c Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 17 Nov 2025 14:25:59 +0000 Subject: [PATCH 73/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 66 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index bbfdfd9c..bbda370f 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.14+9db63bbe 907e9a4690aa7181864692baa21f0728a832801d +// trails-api v1-25.11.17+51cfdb6 cf968b928496f39525fd4980f5aa06a2561ef20b // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.14+9db63bbe" + return "v1-25.11.17+51cfdb6" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "907e9a4690aa7181864692baa21f0728a832801d" + return "cf968b928496f39525fd4980f5aa06a2561ef20b" } // @@ -1525,40 +1525,40 @@ var ( // Schema errors 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} - ErrIntentsSameChainNative = WebRPCError{Code: 7000, Name: "IntentsSameChainNative", Message: "Intents skipped as client is attempting same-chain native transaction", HTTPStatus: 400} - ErrIntentsDisabled = WebRPCError{Code: 9000, Name: "IntentsDisabled", Message: "Intents service is currently unavailable", HTTPStatus: 400} + 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} + ErrIntentsSkipped = WebRPCError{Code: 7000, Name: "IntentsSkipped", Message: "Intents skipped as client is attempting a transaction that does not require intents", HTTPStatus: 400} + ErrIntentsDisabled = WebRPCError{Code: 9000, Name: "IntentsDisabled", Message: "Intents service is currently unavailable", HTTPStatus: 400} ) const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.14+9db63bbe" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+51cfdb6" type WebrpcGenVersions struct { WebrpcGenVersion string From c70ae07996bff063a3df3a9aaa7c3e6f8d7bc339 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 17 Nov 2025 16:06:53 +0000 Subject: [PATCH 74/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 214 +++++++++++++++++++++++++---------- 1 file changed, 157 insertions(+), 57 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index bbda370f..798646c4 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.17+51cfdb6 cf968b928496f39525fd4980f5aa06a2561ef20b +// trails-api v1-25.11.17+6c3ddd8 2c3a1c45813a5ccce3a074e7d7b8d99723b527d0 // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.17+51cfdb6" + return "v1-25.11.17+6c3ddd8" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "cf968b928496f39525fd4980f5aa06a2561ef20b" + return "2c3a1c45813a5ccce3a074e7d7b8d99723b527d0" } // @@ -118,6 +118,155 @@ func (x *QuoteProviderType) Is(values ...QuoteProviderType) bool { return false } +type IntentStatus uint8 + +const ( + IntentStatus_QUOTED IntentStatus = 0 + IntentStatus_COMMITTED IntentStatus = 1 + IntentStatus_EXECUTING IntentStatus = 2 + IntentStatus_FAILED IntentStatus = 3 + IntentStatus_SUCCEEDED IntentStatus = 4 +) + +var IntentStatus_name = map[uint8]string{ + 0: "QUOTED", + 1: "COMMITTED", + 2: "EXECUTING", + 3: "FAILED", + 4: "SUCCEEDED", +} + +var IntentStatus_value = map[string]uint8{ + "QUOTED": 0, + "COMMITTED": 1, + "EXECUTING": 2, + "FAILED": 3, + "SUCCEEDED": 4, +} + +func (x IntentStatus) String() string { + return IntentStatus_name[uint8(x)] +} + +func (x IntentStatus) MarshalText() ([]byte, error) { + return []byte(IntentStatus_name[uint8(x)]), nil +} + +func (x *IntentStatus) UnmarshalText(b []byte) error { + *x = IntentStatus(IntentStatus_value[string(b)]) + return nil +} + +func (x *IntentStatus) Is(values ...IntentStatus) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +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 +) + +var TransactionType_name = map[uint8]string{ + 0: "UNKNOWN", + 1: "DEPOSIT", + 2: "ORIGIN", + 3: "DESTINATION", + 4: "ROUTE", +} + +var TransactionType_value = map[string]uint8{ + "UNKNOWN": 0, + "DEPOSIT": 1, + "ORIGIN": 2, + "DESTINATION": 3, + "ROUTE": 4, +} + +func (x TransactionType) String() string { + return TransactionType_name[uint8(x)] +} + +func (x TransactionType) MarshalText() ([]byte, error) { + return []byte(TransactionType_name[uint8(x)]), nil +} + +func (x *TransactionType) UnmarshalText(b []byte) error { + *x = TransactionType(TransactionType_value[string(b)]) + return nil +} + +func (x *TransactionType) Is(values ...TransactionType) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +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 +) + +var TransactionContext_name = map[uint8]string{ + 0: "NONE", + 1: "CCTPV2_MESSAGE", +} + +var TransactionContext_value = map[string]uint8{ + "NONE": 0, + "CCTPV2_MESSAGE": 1, +} + +func (x TransactionContext) String() string { + return TransactionContext_name[uint8(x)] +} + +func (x TransactionContext) MarshalText() ([]byte, error) { + return []byte(TransactionContext_name[uint8(x)]), nil +} + +func (x *TransactionContext) UnmarshalText(b []byte) error { + *x = TransactionContext(TransactionContext_value[string(b)]) + return nil +} + +func (x *TransactionContext) Is(values ...TransactionContext) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + type TransactionStatus uint8 const ( @@ -193,57 +342,6 @@ func (x *TransactionStatus) Is(values ...TransactionStatus) bool { return false } -type IntentStatus uint8 - -const ( - IntentStatus_QUOTED IntentStatus = 0 - IntentStatus_COMMITTED IntentStatus = 1 - IntentStatus_EXECUTING IntentStatus = 2 - IntentStatus_FAILED IntentStatus = 3 - IntentStatus_SUCCEEDED IntentStatus = 4 -) - -var IntentStatus_name = map[uint8]string{ - 0: "QUOTED", - 1: "COMMITTED", - 2: "EXECUTING", - 3: "FAILED", - 4: "SUCCEEDED", -} - -var IntentStatus_value = map[string]uint8{ - "QUOTED": 0, - "COMMITTED": 1, - "EXECUTING": 2, - "FAILED": 3, - "SUCCEEDED": 4, -} - -func (x IntentStatus) String() string { - return IntentStatus_name[uint8(x)] -} - -func (x IntentStatus) MarshalText() ([]byte, error) { - return []byte(IntentStatus_name[uint8(x)]), nil -} - -func (x *IntentStatus) UnmarshalText(b []byte) error { - *x = IntentStatus(IntentStatus_value[string(b)]) - return nil -} - -func (x *IntentStatus) Is(values ...IntentStatus) bool { - if x == nil { - return false - } - for _, v := range values { - if *x == v { - return true - } - } - return false -} - type ChainGasUsageStatus string const ( @@ -472,8 +570,10 @@ type IntentTransaction struct { // Intent id this transaction is associated with IntentID prototyp.Hash `json:"intentId" db:"intent_id"` // Chain where this transaction executes - ChainID uint64 `json:"chainId" db:"chain_id"` - FromAddress prototyp.Hash `json:"fromAddress" db:"from_address"` + 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 @@ -1558,7 +1658,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+51cfdb6" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+6c3ddd8" type WebrpcGenVersions struct { WebrpcGenVersion string From 711b96c2cd893ab664213aa001681602bf94acd1 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Tue, 18 Nov 2025 09:17:04 +0000 Subject: [PATCH 75/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 798646c4..2edc7c23 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.17+6c3ddd8 2c3a1c45813a5ccce3a074e7d7b8d99723b527d0 +// trails-api v1-25.11.17+822fb49 cb1f8c28a73c79a0ae2436bad0e1206f204bc835 // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.17+6c3ddd8" + return "v1-25.11.17+822fb49" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "2c3a1c45813a5ccce3a074e7d7b8d99723b527d0" + return "cb1f8c28a73c79a0ae2436bad0e1206f204bc835" } // @@ -1658,7 +1658,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+6c3ddd8" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+822fb49" type WebrpcGenVersions struct { WebrpcGenVersion string From fed25717cc0cfb5ee49c79e03fffeaf9ac94f19f Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 20 Nov 2025 23:12:45 +0000 Subject: [PATCH 76/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 251 ++++++++++++++++++++++++++++++++--- 1 file changed, 232 insertions(+), 19 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 2edc7c23..fc6539fc 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.17+822fb49 cb1f8c28a73c79a0ae2436bad0e1206f204bc835 +// trails-api v1-25.11.17+25340a94 6d939222fe9ec82e442ef3a769f80523fe7603bc // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.17+822fb49" + return "v1-25.11.17+25340a94" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "cb1f8c28a73c79a0ae2436bad0e1206f204bc835" + return "6d939222fe9ec82e442ef3a769f80523fe7603bc" } // @@ -54,7 +54,42 @@ type TrailsClient interface { GetIntent(ctx context.Context, getIntentRequest GetIntentRequest) (*GetIntentResponse, error) SearchIntents(ctx context.Context, searchIntentsRequest SearchIntentsRequest) (*SearchIntentsResponse, error) GetIntentTransactionHistory(ctx context.Context, getIntentTransactionHistoryRequest GetIntentTransactionHistoryRequest) (*GetIntentTransactionHistoryResponse, error) - GetTokenPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, 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 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, along with the + // owner address of who will be sending the funds. This allows us to filter the list + // of possible origin tokens to only those the owner has a balance on. + // + // The response is going to be a list of origin tokens and their chains which can be used + // to fullfill the exact output request. + // + // aka, the 'pay' routes + GetExactOutputRoutes(ctx context.Context, getExactOutputRoutesRequest GetExactOutputRoutesRequest) (*GetExactOutputRoutesResponse, error) + // GetExactInputRoutes will return a list of 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, and + // see if any token routes are availabled / returned. + // + // The resposne is going to be a list of destination tokens and their chains which can be + // reached from the origin token and chain. + // + // aka, the 'swap' routes + GetExactInputRoutes(ctx context.Context, getExactInputRoutesRequest GetExactInputRoutesRequest) (*GetExactInputRoutesResponse, error) + // GetPopularTokens will return a list of popular tokens based on the provided filters. + // This is useful for populating token selection lists. + GetPopularTokens(ctx context.Context, getPopularTokensRequest GetPopularTokensRequest) (*GetPopularTokensResponse, error) + // SearchTokens will search token lists for the specific token. This is useful + // when a user wants to input a specific token name, symbol or address to find, + // outside of the visible list. + SearchTokens(ctx context.Context, searchTokensRequest SearchTokensRequest) (*SearchTokensResponse, error) + // GetTokenPrices will return the live prices for a list of tokens. + GetTokenPrices(ctx context.Context, getTokenPricesRequest GetTokenPricesRequest) (*GetTokenPricesResponse, error) } // @@ -371,11 +406,8 @@ func (x *ChainGasUsageStatus) Is(values ...ChainGasUsageStatus) bool { return false } -// User goal prior to solving/quoting, aka the intent request. -// -// NOTE: was previously named GetIntentCallsPayloadParams -// -// ............ +// QuoteIntentRequest represents a user's request to get a quote for a +// Trails same-chain or cross-chain intent. type QuoteIntentRequest struct { // intent owner, aka the user address processing the quote OwnerAddress prototyp.Hash `json:"ownerAddress"` @@ -775,7 +807,9 @@ type FeeOption struct { Amount prototyp.BigInt `json:"amount"` AmountUSD float64 `json:"amountUsd"` FeeCollectorAddress prototyp.Hash `json:"feeCollectorAddress"` - Is2612 bool `json:"is2612"` + // - isNative: bool + // - supportsPermit: bool + Is2612 bool `json:"is2612"` } // DepositSignature contains all gasless deposit signature parameters for ExecuteIntent @@ -826,6 +860,36 @@ type TrailsAddressOverrides struct { SequenceWalletUtilsAddress *string `json:"sequenceWalletUtilsAddress"` } +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 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"` + // additional metadata + LogoURI string `json:"logoUri"` +} + type SortOrder uint32 const ( @@ -1002,6 +1066,73 @@ type GetIntentTransactionHistoryResponse struct { NextPage *Page `json:"nextPage"` } +type GetTokenPricesRequest struct { + Tokens []*Token `json:"tokens"` +} + +type GetTokenPricesResponse struct { + TokenPrices []*TokenPrice `json:"tokenPrices"` +} + +type GetChainsRequest struct { + // TODO: use enum eventually.. + RouteProvider *string `json:"routeProvider"` +} + +type GetChainsResponse struct { + Chains []*ChainInfo `json:"chains"` +} + +type GetExactOutputRoutesRequest struct { + DestinationChainId uint64 `json:"destinationChainId"` + DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` + // 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 struct { + Tokens []*TokenInfo `json:"tokens"` +} + +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 struct { + Tokens []*TokenInfo `json:"tokens"` +} + +type GetPopularTokensRequest struct { + // all of these are optional..... + // TODO: still thinking about filters + RouteProvider *string `json:"routeProvider"` + Limit *uint32 `json:"limit"` + ChainIds []uint64 `json:"chainIds"` +} + +type GetPopularTokensResponse struct { + Tokens []*TokenInfo `json:"tokens"` +} + +type SearchTokensRequest struct { + // name, symbol, address + Query string `json:"query"` + RouteProvider *string `json:"routeProvider"` + Limit *uint32 `json:"limit"` + ChainIds []uint64 `json:"chainIds"` +} + +type SearchTokensResponse struct { + Tokens []*TokenInfo `json:"tokens"` +} + // Page represents a results page. This can be used both to request a page and // to store the state of a page. type Page struct { @@ -1032,12 +1163,12 @@ const TrailsPathPrefix = "/rpc/Trails/" type trailsClient struct { client HTTPClient - urls [13]string + urls [18]string } func NewTrailsClient(addr string, client HTTPClient) TrailsClient { prefix := urlBase(addr) + TrailsPathPrefix - urls := [13]string{ + urls := [18]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -1050,6 +1181,11 @@ func NewTrailsClient(addr string, client HTTPClient) TrailsClient { prefix + "GetIntent", prefix + "SearchIntents", prefix + "GetIntentTransactionHistory", + prefix + "GetChains", + prefix + "GetExactOutputRoutes", + prefix + "GetExactInputRoutes", + prefix + "GetPopularTokens", + prefix + "SearchTokens", prefix + "GetTokenPrices", } return &trailsClient{ @@ -1250,15 +1386,92 @@ func (c *trailsClient) GetIntentTransactionHistory(ctx context.Context, getInten return out.Ret0, err } -func (c *trailsClient) GetTokenPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error) { - in := struct { - Arg0 []*Token `json:"tokens"` - }{tokens} +func (c *trailsClient) GetChains(ctx context.Context, getChainsRequest GetChainsRequest) (*GetChainsResponse, error) { + out := struct { + Ret0 *GetChainsResponse + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], getChainsRequest, &out.Ret0) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *trailsClient) GetExactOutputRoutes(ctx context.Context, getExactOutputRoutesRequest GetExactOutputRoutesRequest) (*GetExactOutputRoutesResponse, error) { + out := struct { + Ret0 *GetExactOutputRoutesResponse + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], getExactOutputRoutesRequest, &out.Ret0) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *trailsClient) GetExactInputRoutes(ctx context.Context, getExactInputRoutesRequest GetExactInputRoutesRequest) (*GetExactInputRoutesResponse, error) { + out := struct { + Ret0 *GetExactInputRoutesResponse + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], getExactInputRoutesRequest, &out.Ret0) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *trailsClient) GetPopularTokens(ctx context.Context, getPopularTokensRequest GetPopularTokensRequest) (*GetPopularTokensResponse, error) { + out := struct { + Ret0 *GetPopularTokensResponse + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[15], getPopularTokensRequest, &out.Ret0) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *trailsClient) SearchTokens(ctx context.Context, searchTokensRequest SearchTokensRequest) (*SearchTokensResponse, error) { + out := struct { + Ret0 *SearchTokensResponse + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[16], searchTokensRequest, &out.Ret0) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) + } + } + + return out.Ret0, err +} + +func (c *trailsClient) GetTokenPrices(ctx context.Context, getTokenPricesRequest GetTokenPricesRequest) (*GetTokenPricesResponse, error) { out := struct { - Ret0 []*TokenPrice `json:"tokenPrices"` + Ret0 *GetTokenPricesResponse }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[17], getTokenPricesRequest, &out.Ret0) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1658,7 +1871,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+822fb49" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+25340a94" type WebrpcGenVersions struct { WebrpcGenVersion string From a49645925b8f42f10d601661bb53308cc79dd4f4 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:47:01 +0000 Subject: [PATCH 77/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index fc6539fc..df75984e 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.17+25340a94 6d939222fe9ec82e442ef3a769f80523fe7603bc +// trails-api v1-25.11.20+c2a87fea 3a288cdd32693d6fa78e00f46de090086b9c30ec // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.17+25340a94" + return "v1-25.11.20+c2a87fea" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "6d939222fe9ec82e442ef3a769f80523fe7603bc" + return "3a288cdd32693d6fa78e00f46de090086b9c30ec" } // @@ -1084,7 +1084,7 @@ type GetChainsResponse struct { } type GetExactOutputRoutesRequest struct { - DestinationChainId uint64 `json:"destinationChainId"` + DestinationChainID uint64 `json:"destinationChainId"` DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` // owner address is used to filter tokens the owner has a balance on. // @@ -1098,10 +1098,10 @@ type GetExactOutputRoutesResponse struct { } type GetExactInputRoutesRequest struct { - OriginChainId uint64 `json:"originChainId"` + OriginChainID uint64 `json:"originChainId"` OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` // optionally passed to filter results - DestinationChainId *uint64 `json:"destinationChainId"` + DestinationChainID *uint64 `json:"destinationChainId"` DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` } @@ -1871,7 +1871,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.17+25340a94" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.20+c2a87fea" type WebrpcGenVersions struct { WebrpcGenVersion string From 7a0c448de959bfc424fd932844427a155519f5d3 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 21 Nov 2025 23:34:27 +0000 Subject: [PATCH 78/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index df75984e..021df00d 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.20+c2a87fea 3a288cdd32693d6fa78e00f46de090086b9c30ec +// trails-api v1-25.11.21+d52e889 cf16b3b677c4096dfcbf6ab8a409ac3d1aed7bee // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.20+c2a87fea" + return "v1-25.11.21+d52e889" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "3a288cdd32693d6fa78e00f46de090086b9c30ec" + return "cf16b3b677c4096dfcbf6ab8a409ac3d1aed7bee" } // @@ -1084,7 +1084,7 @@ type GetChainsResponse struct { } type GetExactOutputRoutesRequest struct { - DestinationChainID uint64 `json:"destinationChainId"` + DestinationChainId uint64 `json:"destinationChainId"` DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` // owner address is used to filter tokens the owner has a balance on. // @@ -1098,10 +1098,10 @@ type GetExactOutputRoutesResponse struct { } type GetExactInputRoutesRequest struct { - OriginChainID uint64 `json:"originChainId"` + OriginChainId uint64 `json:"originChainId"` OriginTokenAddress prototyp.Hash `json:"originTokenAddress"` // optionally passed to filter results - DestinationChainID *uint64 `json:"destinationChainId"` + DestinationChainId *uint64 `json:"destinationChainId"` DestinationTokenAddress prototyp.Hash `json:"destinationTokenAddress"` } @@ -1871,7 +1871,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.20+c2a87fea" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.21+d52e889" type WebrpcGenVersions struct { WebrpcGenVersion string From fb953c6a421339e58d202dab3ec27f323193bfdc Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sat, 22 Nov 2025 00:56:03 +0000 Subject: [PATCH 79/79] [AUTOMATED] Update: proto/clients/trails-api.gen.go --- trails-api/trails-api.gen.go | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/trails-api/trails-api.gen.go b/trails-api/trails-api.gen.go index 021df00d..a9055166 100644 --- a/trails-api/trails-api.gen.go +++ b/trails-api/trails-api.gen.go @@ -1,4 +1,4 @@ -// trails-api v1-25.11.21+d52e889 cf16b3b677c4096dfcbf6ab8a409ac3d1aed7bee +// trails-api v1-25.11.21+6e5ef30 ddf30c2ffbc5d024003bda5bb08a1802eccd355b // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -29,12 +29,12 @@ func WebRPCVersion() string { // Schema version of your RIDL schema func WebRPCSchemaVersion() string { - return "v1-25.11.21+d52e889" + return "v1-25.11.21+6e5ef30" } // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "cf16b3b677c4096dfcbf6ab8a409ac3d1aed7bee" + return "ddf30c2ffbc5d024003bda5bb08a1802eccd355b" } // @@ -56,28 +56,30 @@ type TrailsClient interface { GetIntentTransactionHistory(ctx context.Context, getIntentTransactionHistoryRequest GetIntentTransactionHistoryRequest) (*GetIntentTransactionHistoryResponse, 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 tokens, when given a destination chain and token, + // 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, along with the - // owner address of who will be sending the funds. This allows us to filter the list - // of possible origin tokens to only those the owner has a balance on. + // 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 going to be a list of origin tokens and their chains which can be used - // to fullfill the exact output request. + // 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 tokens, when given an origin chain and token, + // 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, and - // see if any token routes are availabled / returned. + // user can specify a destination chain and token to further filter the results. // - // The resposne is going to be a list of destination tokens and their chains which can be - // reached from the origin token and chain. + // 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) @@ -1086,6 +1088,10 @@ type GetChainsResponse struct { 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 @@ -1871,7 +1877,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.21+d52e889" +const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;trails-api@v1-25.11.21+6e5ef30" type WebrpcGenVersions struct { WebrpcGenVersion string