From 3d9f2bc2e3d6f4d16e21ccce9dcbf39e4d107154 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Sat, 27 Sep 2025 10:54:55 +0000 Subject: [PATCH 01/49] [AUTOMATED] Update: proto/clients/api.gen.ts --- packages/trails-api/src/api.gen.ts | 1341 ++++++++++++++++++++++++++++ 1 file changed, 1341 insertions(+) create mode 100644 packages/trails-api/src/api.gen.ts diff --git a/packages/trails-api/src/api.gen.ts b/packages/trails-api/src/api.gen.ts new file mode 100644 index 000000000..12866ef4a --- /dev/null +++ b/packages/trails-api/src/api.gen.ts @@ -0,0 +1,1341 @@ +/* eslint-disable */ +// trails-api v0.4.0 28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3 +// -- +// Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT. +// +// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/api.gen.ts + +export const WebrpcHeader = 'Webrpc' + +export const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;trails-api@v0.4.0' + +// WebRPC description and code-gen version +export const WebRPCVersion = 'v1' + +// Schema version of your RIDL schema +export const WebRPCSchemaVersion = 'v0.4.0' + +// Schema hash generated from your RIDL schema +export const WebRPCSchemaHash = '28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3' + +type WebrpcGenVersions = { + webrpcGenVersion: string + codeGenName: string + codeGenVersion: string + schemaName: string + schemaVersion: string +} + +export function VersionFromHeader(headers: Headers): WebrpcGenVersions { + const headerValue = headers.get(WebrpcHeader) + if (!headerValue) { + return { + webrpcGenVersion: '', + codeGenName: '', + codeGenVersion: '', + schemaName: '', + schemaVersion: '' + } + } + + return parseWebrpcGenVersions(headerValue) +} + +function parseWebrpcGenVersions(header: string): WebrpcGenVersions { + const versions = header.split(';') + if (versions.length < 3) { + return { + webrpcGenVersion: '', + codeGenName: '', + codeGenVersion: '', + schemaName: '', + schemaVersion: '' + } + } + + const [_, webrpcGenVersion] = versions[0]!.split('@') + const [codeGenName, codeGenVersion] = versions[1]!.split('@') + const [schemaName, schemaVersion] = versions[2]!.split('@') + + return { + webrpcGenVersion: webrpcGenVersion ?? '', + codeGenName: codeGenName ?? '', + codeGenVersion: codeGenVersion ?? '', + schemaName: schemaName ?? '', + schemaVersion: schemaVersion ?? '' + } +} + +// +// Types +// + +export enum TradeType { + EXACT_INPUT = 'EXACT_INPUT', + EXACT_OUTPUT = 'EXACT_OUTPUT' +} + +export enum SortOrder { + DESC = 'DESC', + ASC = 'ASC' +} + +export interface Version { + webrpcVersion: string + schemaVersion: string + schemaHash: string + appVersion: string +} + +export interface RuntimeStatus { + healthOK: boolean + startTime: string + uptime: number + ver: string + branch: string + commitHash: string + checks: RuntimeChecks + numTxnsRelayed: { [key: string]: NumTxnsRelayed } +} + +export interface NumTxnsRelayed { + chainID: number + prev: number + current: number + period: number +} + +export interface RuntimeChecks {} + +export interface MetaTxn { + id: string + chainId: string + walletAddress: string + contract: string + input: string +} + +export interface Call { + to: string + value?: string + data?: string + gasLimit?: string + delegateCall?: boolean + onlyFallback?: boolean + behaviorOnError?: number +} + +export interface IntentCallsPayload { + chainId: string + space?: string + nonce?: string + calls: Array +} + +export interface IntentConfig { + id: number + configHash: string + originIntentAddress: string + destinationIntentAddress: string + mainSigner: string + calls: Array + preconditions: Array + executionStatus?: string + metaTxnId?: string + txnHash?: string + updatedAt?: string + createdAt?: string +} + +export interface AddressOverrides { + trailsLiFiSapientSignerAddress?: string + trailsRelaySapientSignerAddress?: string + trailsCCTPV2SapientSignerAddress?: string +} + +export interface TakerFee { + address: string + bps: number +} + +export interface IntentPrecondition { + type: string + chainId: string + data: any +} + +export interface Token { + chainId: number + contractAddress: string + tokenId?: string +} + +export interface Price { + value: number + currency: string +} + +export interface TokenPrice { + token: Token + price?: Price + price24hChange?: Price + price24hVol?: Price + floorPrice: Price + buyPrice: Price + sellPrice: Price + updatedAt: string +} + +export interface ExchangeRate { + name: string + symbol: string + value: number + vsCurrency: string + currencyType: string +} + +export interface Page { + pageSize?: number + page?: number + totalRecords?: number + column?: string + before?: any + after?: any + sort?: Array + more?: boolean +} + +export interface SortBy { + column: string + order: SortOrder +} + +export interface CCTPTransfer { + id: string + sourceTxHash: string + sourceChainId: number + destinationChainId: number + message: string + attestation: string + status: string + createdAt: string + updatedAt: string +} + +export interface CrossChainFee { + providerFee: string + trailsSwapFee: string + providerFeeUSD: number + trailsSwapFeeUSD: number + totalFeeAmount: string + totalFeeUSD: number +} + +export interface MetaTxnFeeDetail { + metaTxnID: string + estimatedGasLimit: string + feeNative: string +} + +export interface ChainExecuteQuote { + chainId: string + totalGasLimit: string + gasPrice: string + totalFeeAmount: string + nativeTokenSymbol: string + nativeTokenPrice?: string + metaTxnFeeDetails: Array + totalFeeUSD?: string +} + +export interface ExecuteQuote { + chainQuotes: Array +} + +export interface TrailsFee { + executeQuote: ExecuteQuote + crossChainFee?: CrossChainFee + takerFeeAmount?: string + takerFeeUSD?: number + trailsFixedFeeUSD: number + feeToken?: string + originTokenTotalAmount?: string + totalFeeAmount?: string + totalFeeUSD?: string + quoteProvider?: string +} + +export interface IntentQuote { + fromAmount: string + fromAmountMin: string + toAmount: string + toAmountMin: string + priceImpact: number + priceImpactUsd: string + maxSlippage: number + quoteProvider: string + quoteProviderRequestId: string + quoteProviderFeeUsd: string + feeQuotes: { [key: string]: string } +} + +export interface API { + /** + * + * Runtime + * + */ + ping(headers?: object, signal?: AbortSignal): Promise + version(headers?: object, signal?: AbortSignal): Promise + runtimeStatus(headers?: object, signal?: AbortSignal): Promise + clock(headers?: object, signal?: AbortSignal): Promise + /** + * + * Chain abstraction + * + */ + getIntentCallsPayloads( + args: GetIntentCallsPayloadsArgs, + headers?: object, + signal?: AbortSignal + ): Promise + commitIntentConfig(args: CommitIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise + getIntentConfig(args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise + /** + * + * CCTP + * + */ + getCCTPTransfer(args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise + queueCCTPTransfer(args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise + /** + * + * Intent Machine Worker + * + */ + queueIntentConfigExecution( + args: QueueIntentConfigExecutionArgs, + headers?: object, + signal?: AbortSignal + ): Promise + getIntentConfigExecutionStatus( + args: GetIntentConfigExecutionStatusArgs, + headers?: object, + signal?: AbortSignal + ): Promise + listIntentConfigs(args: ListIntentConfigsArgs, headers?: object, signal?: AbortSignal): Promise + queueMetaTxnReceipt(args: QueueMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise +} + +export interface PingArgs {} + +export interface PingReturn { + status: boolean +} +export interface VersionArgs {} + +export interface VersionReturn { + version: Version +} +export interface RuntimeStatusArgs {} + +export interface RuntimeStatusReturn { + status: RuntimeStatus +} +export interface ClockArgs {} + +export interface ClockReturn { + serverTime: string +} +export interface GetIntentCallsPayloadsArgs { + userAddress: string + destinationChainId: number + destinationTokenAddress: string + destinationTokenAmount: string + destinationToAddress: string + originChainId: number + originTokenAddress: string + originTokenAmount: string + destinationCallData?: string + destinationCallValue?: string + provider?: string + addressOverrides?: AddressOverrides + destinationSalt?: string + takerFee?: TakerFee + slippageTolerance?: number + tradeType?: TradeType +} + +export interface GetIntentCallsPayloadsReturn { + calls: Array + preconditions: Array + metaTxns: Array + trailsFee: TrailsFee + quote: IntentQuote + feeQuotes: { [key: string]: string } + originIntentAddress: string + destinationIntentAddress: string +} +export interface CommitIntentConfigArgs { + originIntentAddress: string + destinationIntentAddress: string + mainSigner: string + calls: Array + preconditions: Array + addressOverrides?: AddressOverrides +} + +export interface CommitIntentConfigReturn { + config: IntentConfig +} +export interface GetIntentConfigArgs { + intentAddress: string +} + +export interface GetIntentConfigReturn { + config: IntentConfig +} +export interface GetCCTPTransferArgs { + id: string +} + +export interface GetCCTPTransferReturn { + transfer: CCTPTransfer +} +export interface QueueCCTPTransferArgs { + sourceTxHash?: string + metaTxHash?: string + sourceChainId: number + destinationChainId: number +} + +export interface QueueCCTPTransferReturn { + transfer: CCTPTransfer +} +export interface QueueIntentConfigExecutionArgs { + intentConfigId: number +} + +export interface QueueIntentConfigExecutionReturn { + status: boolean +} +export interface GetIntentConfigExecutionStatusArgs { + intentConfigId: number +} + +export interface GetIntentConfigExecutionStatusReturn { + executionStatus: string +} +export interface ListIntentConfigsArgs { + page?: Page + executionStatus?: string +} + +export interface ListIntentConfigsReturn { + page: Page + intentConfigs: Array +} +export interface QueueMetaTxnReceiptArgs { + metaTxID: string +} + +export interface QueueMetaTxnReceiptReturn { + status: boolean +} + +// +// Client +// +export class API implements API { + protected hostname: string + protected fetch: Fetch + protected path = '/rpc/API/' + + constructor(hostname: string, fetch: Fetch) { + this.hostname = hostname.replace(/\/*$/, '') + this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init) + } + + private url(name: string): string { + return this.hostname + this.path + name + } + + ping = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + version = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + version: _data.version + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + runtimeStatus = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + clock = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Clock'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + serverTime: _data.serverTime + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getIntentCallsPayloads = ( + args: GetIntentCallsPayloadsArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentCallsPayloads'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + calls: >_data.calls, + preconditions: >_data.preconditions, + metaTxns: >_data.metaTxns, + trailsFee: _data.trailsFee, + quote: _data.quote, + feeQuotes: <{ [key: string]: string }>_data.feeQuotes, + originIntentAddress: _data.originIntentAddress, + destinationIntentAddress: _data.destinationIntentAddress + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + commitIntentConfig = ( + args: CommitIntentConfigArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('CommitIntentConfig'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + config: _data.config + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getIntentConfig = (args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetIntentConfig'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + config: _data.config + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getCCTPTransfer = (args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + transfer: _data.transfer + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + queueCCTPTransfer = (args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('QueueCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + transfer: _data.transfer + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + queueIntentConfigExecution = ( + args: QueueIntentConfigExecutionArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('QueueIntentConfigExecution'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getIntentConfigExecutionStatus = ( + args: GetIntentConfigExecutionStatusArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentConfigExecutionStatus'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + executionStatus: _data.executionStatus + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + listIntentConfigs = (args: ListIntentConfigsArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('ListIntentConfigs'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + page: _data.page, + intentConfigs: >_data.intentConfigs + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + queueMetaTxnReceipt = ( + args: QueueMetaTxnReceiptArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('QueueMetaTxnReceipt'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } +} + +const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => { + const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json' } + reqHeaders[WebrpcHeader] = WebrpcHeaderValue + + return { + method: 'POST', + headers: reqHeaders, + body: JSON.stringify(body || {}), + signal + } +} + +const buildResponse = (res: Response): Promise => { + return res.text().then(text => { + let data + try { + data = JSON.parse(text) + } catch (error) { + let message = '' + if (error instanceof Error) { + message = error.message + } + throw WebrpcBadResponseError.new({ + status: res.status, + cause: `JSON.parse(): ${message}: response text: ${text}` + }) + } + if (!res.ok) { + const code: number = typeof data.code === 'number' ? data.code : 0 + throw (webrpcErrorByCode[code] || WebrpcError).new(data) + } + return data + }) +} + +// +// Errors +// + +export class WebrpcError extends Error { + name: string + code: number + message: string + status: number + cause?: string + + /** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */ + msg: string + + constructor(name: string, code: number, message: string, status: number, cause?: string) { + super(message) + this.name = name || 'WebrpcError' + this.code = typeof code === 'number' ? code : 0 + this.message = message || `endpoint error ${this.code}` + this.msg = this.message + this.status = typeof status === 'number' ? status : 0 + this.cause = cause + Object.setPrototypeOf(this, WebrpcError.prototype) + } + + static new(payload: any): WebrpcError { + return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause) + } +} + +// Webrpc errors + +export class WebrpcEndpointError extends WebrpcError { + constructor( + name: string = 'WebrpcEndpoint', + code: number = 0, + message: string = `endpoint error`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcEndpointError.prototype) + } +} + +export class WebrpcRequestFailedError extends WebrpcError { + constructor( + name: string = 'WebrpcRequestFailed', + code: number = -1, + message: string = `request failed`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype) + } +} + +export class WebrpcBadRouteError extends WebrpcError { + constructor( + name: string = 'WebrpcBadRoute', + code: number = -2, + message: string = `bad route`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadRouteError.prototype) + } +} + +export class WebrpcBadMethodError extends WebrpcError { + constructor( + name: string = 'WebrpcBadMethod', + code: number = -3, + message: string = `bad method`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadMethodError.prototype) + } +} + +export class WebrpcBadRequestError extends WebrpcError { + constructor( + name: string = 'WebrpcBadRequest', + code: number = -4, + message: string = `bad request`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadRequestError.prototype) + } +} + +export class WebrpcBadResponseError extends WebrpcError { + constructor( + name: string = 'WebrpcBadResponse', + code: number = -5, + message: string = `bad response`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadResponseError.prototype) + } +} + +export class WebrpcServerPanicError extends WebrpcError { + constructor( + name: string = 'WebrpcServerPanic', + code: number = -6, + message: string = `server panic`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcServerPanicError.prototype) + } +} + +export class WebrpcInternalErrorError extends WebrpcError { + constructor( + name: string = 'WebrpcInternalError', + code: number = -7, + message: string = `internal error`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype) + } +} + +export class WebrpcClientDisconnectedError extends WebrpcError { + constructor( + name: string = 'WebrpcClientDisconnected', + code: number = -8, + message: string = `client disconnected`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype) + } +} + +export class WebrpcStreamLostError extends WebrpcError { + constructor( + name: string = 'WebrpcStreamLost', + code: number = -9, + message: string = `stream lost`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcStreamLostError.prototype) + } +} + +export class WebrpcStreamFinishedError extends WebrpcError { + constructor( + name: string = 'WebrpcStreamFinished', + code: number = -10, + message: string = `stream finished`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype) + } +} + +// Schema errors + +export class UnauthorizedError extends WebrpcError { + constructor( + name: string = 'Unauthorized', + code: number = 1000, + message: string = `Unauthorized access`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnauthorizedError.prototype) + } +} + +export class PermissionDeniedError extends WebrpcError { + constructor( + name: string = 'PermissionDenied', + code: number = 1001, + message: string = `Permission denied`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, PermissionDeniedError.prototype) + } +} + +export class SessionExpiredError extends WebrpcError { + constructor( + name: string = 'SessionExpired', + code: number = 1002, + message: string = `Session expired`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, SessionExpiredError.prototype) + } +} + +export class MethodNotFoundError extends WebrpcError { + constructor( + name: string = 'MethodNotFound', + code: number = 1003, + message: string = `Method not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, MethodNotFoundError.prototype) + } +} + +export class RequestConflictError extends WebrpcError { + constructor( + name: string = 'RequestConflict', + code: number = 1004, + message: string = `Conflict with target resource`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, RequestConflictError.prototype) + } +} + +export class AbortedError extends WebrpcError { + constructor( + name: string = 'Aborted', + code: number = 1005, + message: string = `Request aborted`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AbortedError.prototype) + } +} + +export class GeoblockedError extends WebrpcError { + constructor( + name: string = 'Geoblocked', + code: number = 1006, + message: string = `Geoblocked region`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, GeoblockedError.prototype) + } +} + +export class RateLimitedError extends WebrpcError { + constructor( + name: string = 'RateLimited', + code: number = 1007, + message: string = `Rate-limited. Please slow down.`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, RateLimitedError.prototype) + } +} + +export class ProjectNotFoundError extends WebrpcError { + constructor( + name: string = 'ProjectNotFound', + code: number = 1008, + message: string = `Project not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, ProjectNotFoundError.prototype) + } +} + +export class AccessKeyNotFoundError extends WebrpcError { + constructor( + name: string = 'AccessKeyNotFound', + code: number = 1101, + message: string = `Access key not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype) + } +} + +export class AccessKeyMismatchError extends WebrpcError { + constructor( + name: string = 'AccessKeyMismatch', + code: number = 1102, + message: string = `Access key mismatch`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AccessKeyMismatchError.prototype) + } +} + +export class InvalidOriginError extends WebrpcError { + constructor( + name: string = 'InvalidOrigin', + code: number = 1103, + message: string = `Invalid origin for Access Key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidOriginError.prototype) + } +} + +export class InvalidServiceError extends WebrpcError { + constructor( + name: string = 'InvalidService', + code: number = 1104, + message: string = `Service not enabled for Access key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidServiceError.prototype) + } +} + +export class UnauthorizedUserError extends WebrpcError { + constructor( + name: string = 'UnauthorizedUser', + code: number = 1105, + message: string = `Unauthorized user`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnauthorizedUserError.prototype) + } +} + +export class QuotaExceededError extends WebrpcError { + constructor( + name: string = 'QuotaExceeded', + code: number = 1200, + message: string = `Quota request exceeded`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QuotaExceededError.prototype) + } +} + +export class QuotaRateLimitError extends WebrpcError { + constructor( + name: string = 'QuotaRateLimit', + code: number = 1201, + message: string = `Quota rate limit exceeded`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QuotaRateLimitError.prototype) + } +} + +export class NoDefaultKeyError extends WebrpcError { + constructor( + name: string = 'NoDefaultKey', + code: number = 1300, + message: string = `No default access key found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, NoDefaultKeyError.prototype) + } +} + +export class MaxAccessKeysError extends WebrpcError { + constructor( + name: string = 'MaxAccessKeys', + code: number = 1301, + message: string = `Access keys limit reached`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, MaxAccessKeysError.prototype) + } +} + +export class AtLeastOneKeyError extends WebrpcError { + constructor( + name: string = 'AtLeastOneKey', + code: number = 1302, + message: string = `You need at least one Access Key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AtLeastOneKeyError.prototype) + } +} + +export class TimeoutError extends WebrpcError { + constructor( + name: string = 'Timeout', + code: number = 1900, + message: string = `Request timed out`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, TimeoutError.prototype) + } +} + +export class InvalidArgumentError extends WebrpcError { + constructor( + name: string = 'InvalidArgument', + code: number = 2000, + message: string = `Invalid argument`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidArgumentError.prototype) + } +} + +export class UnavailableError extends WebrpcError { + constructor( + name: string = 'Unavailable', + code: number = 2002, + message: string = `Unavailable resource`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnavailableError.prototype) + } +} + +export class QueryFailedError extends WebrpcError { + constructor( + name: string = 'QueryFailed', + code: number = 2003, + message: string = `Query failed`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QueryFailedError.prototype) + } +} + +export class NotFoundError extends WebrpcError { + constructor( + name: string = 'NotFound', + code: number = 8000, + message: string = `Resource not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, NotFoundError.prototype) + } +} + +export class UnsupportedNetworkError extends WebrpcError { + constructor( + name: string = 'UnsupportedNetwork', + code: number = 8008, + message: string = `Unsupported network`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnsupportedNetworkError.prototype) + } +} + +export enum errors { + WebrpcEndpoint = 'WebrpcEndpoint', + WebrpcRequestFailed = 'WebrpcRequestFailed', + WebrpcBadRoute = 'WebrpcBadRoute', + WebrpcBadMethod = 'WebrpcBadMethod', + WebrpcBadRequest = 'WebrpcBadRequest', + WebrpcBadResponse = 'WebrpcBadResponse', + WebrpcServerPanic = 'WebrpcServerPanic', + WebrpcInternalError = 'WebrpcInternalError', + WebrpcClientDisconnected = 'WebrpcClientDisconnected', + WebrpcStreamLost = 'WebrpcStreamLost', + WebrpcStreamFinished = 'WebrpcStreamFinished', + Unauthorized = 'Unauthorized', + PermissionDenied = 'PermissionDenied', + SessionExpired = 'SessionExpired', + MethodNotFound = 'MethodNotFound', + RequestConflict = 'RequestConflict', + Aborted = 'Aborted', + Geoblocked = 'Geoblocked', + RateLimited = 'RateLimited', + ProjectNotFound = 'ProjectNotFound', + AccessKeyNotFound = 'AccessKeyNotFound', + AccessKeyMismatch = 'AccessKeyMismatch', + InvalidOrigin = 'InvalidOrigin', + InvalidService = 'InvalidService', + UnauthorizedUser = 'UnauthorizedUser', + QuotaExceeded = 'QuotaExceeded', + QuotaRateLimit = 'QuotaRateLimit', + NoDefaultKey = 'NoDefaultKey', + MaxAccessKeys = 'MaxAccessKeys', + AtLeastOneKey = 'AtLeastOneKey', + Timeout = 'Timeout', + InvalidArgument = 'InvalidArgument', + Unavailable = 'Unavailable', + QueryFailed = 'QueryFailed', + NotFound = 'NotFound', + UnsupportedNetwork = 'UnsupportedNetwork' +} + +export enum WebrpcErrorCodes { + WebrpcEndpoint = 0, + WebrpcRequestFailed = -1, + WebrpcBadRoute = -2, + WebrpcBadMethod = -3, + WebrpcBadRequest = -4, + WebrpcBadResponse = -5, + WebrpcServerPanic = -6, + WebrpcInternalError = -7, + WebrpcClientDisconnected = -8, + WebrpcStreamLost = -9, + WebrpcStreamFinished = -10, + Unauthorized = 1000, + PermissionDenied = 1001, + SessionExpired = 1002, + MethodNotFound = 1003, + RequestConflict = 1004, + Aborted = 1005, + Geoblocked = 1006, + RateLimited = 1007, + ProjectNotFound = 1008, + AccessKeyNotFound = 1101, + AccessKeyMismatch = 1102, + InvalidOrigin = 1103, + InvalidService = 1104, + UnauthorizedUser = 1105, + QuotaExceeded = 1200, + QuotaRateLimit = 1201, + NoDefaultKey = 1300, + MaxAccessKeys = 1301, + AtLeastOneKey = 1302, + Timeout = 1900, + InvalidArgument = 2000, + Unavailable = 2002, + QueryFailed = 2003, + NotFound = 8000, + UnsupportedNetwork = 8008 +} + +export const webrpcErrorByCode: { [code: number]: any } = { + [0]: WebrpcEndpointError, + [-1]: WebrpcRequestFailedError, + [-2]: WebrpcBadRouteError, + [-3]: WebrpcBadMethodError, + [-4]: WebrpcBadRequestError, + [-5]: WebrpcBadResponseError, + [-6]: WebrpcServerPanicError, + [-7]: WebrpcInternalErrorError, + [-8]: WebrpcClientDisconnectedError, + [-9]: WebrpcStreamLostError, + [-10]: WebrpcStreamFinishedError, + [1000]: UnauthorizedError, + [1001]: PermissionDeniedError, + [1002]: SessionExpiredError, + [1003]: MethodNotFoundError, + [1004]: RequestConflictError, + [1005]: AbortedError, + [1006]: GeoblockedError, + [1007]: RateLimitedError, + [1008]: ProjectNotFoundError, + [1101]: AccessKeyNotFoundError, + [1102]: AccessKeyMismatchError, + [1103]: InvalidOriginError, + [1104]: InvalidServiceError, + [1105]: UnauthorizedUserError, + [1200]: QuotaExceededError, + [1201]: QuotaRateLimitError, + [1300]: NoDefaultKeyError, + [1301]: MaxAccessKeysError, + [1302]: AtLeastOneKeyError, + [1900]: TimeoutError, + [2000]: InvalidArgumentError, + [2002]: UnavailableError, + [2003]: QueryFailedError, + [8000]: NotFoundError, + [8008]: UnsupportedNetworkError +} + +export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise From 4c0021e11683c3aab88853fbe0eb0a91818580e2 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Tue, 30 Sep 2025 16:39:57 +0000 Subject: [PATCH 02/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 1341 +++++++++++++++++++++ 1 file changed, 1341 insertions(+) create mode 100644 packages/trails-api/src/trails-api.gen.ts diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts new file mode 100644 index 000000000..f13a6d027 --- /dev/null +++ b/packages/trails-api/src/trails-api.gen.ts @@ -0,0 +1,1341 @@ +/* eslint-disable */ +// trails-api v0.4.0 28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3 +// -- +// Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT. +// +// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/trails-api.gen.ts + +export const WebrpcHeader = 'Webrpc' + +export const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;trails-api@v0.4.0' + +// WebRPC description and code-gen version +export const WebRPCVersion = 'v1' + +// Schema version of your RIDL schema +export const WebRPCSchemaVersion = 'v0.4.0' + +// Schema hash generated from your RIDL schema +export const WebRPCSchemaHash = '28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3' + +type WebrpcGenVersions = { + webrpcGenVersion: string + codeGenName: string + codeGenVersion: string + schemaName: string + schemaVersion: string +} + +export function VersionFromHeader(headers: Headers): WebrpcGenVersions { + const headerValue = headers.get(WebrpcHeader) + if (!headerValue) { + return { + webrpcGenVersion: '', + codeGenName: '', + codeGenVersion: '', + schemaName: '', + schemaVersion: '' + } + } + + return parseWebrpcGenVersions(headerValue) +} + +function parseWebrpcGenVersions(header: string): WebrpcGenVersions { + const versions = header.split(';') + if (versions.length < 3) { + return { + webrpcGenVersion: '', + codeGenName: '', + codeGenVersion: '', + schemaName: '', + schemaVersion: '' + } + } + + const [_, webrpcGenVersion] = versions[0]!.split('@') + const [codeGenName, codeGenVersion] = versions[1]!.split('@') + const [schemaName, schemaVersion] = versions[2]!.split('@') + + return { + webrpcGenVersion: webrpcGenVersion ?? '', + codeGenName: codeGenName ?? '', + codeGenVersion: codeGenVersion ?? '', + schemaName: schemaName ?? '', + schemaVersion: schemaVersion ?? '' + } +} + +// +// Types +// + +export enum TradeType { + EXACT_INPUT = 'EXACT_INPUT', + EXACT_OUTPUT = 'EXACT_OUTPUT' +} + +export enum SortOrder { + DESC = 'DESC', + ASC = 'ASC' +} + +export interface Version { + webrpcVersion: string + schemaVersion: string + schemaHash: string + appVersion: string +} + +export interface RuntimeStatus { + healthOK: boolean + startTime: string + uptime: number + ver: string + branch: string + commitHash: string + checks: RuntimeChecks + numTxnsRelayed: { [key: string]: NumTxnsRelayed } +} + +export interface NumTxnsRelayed { + chainID: number + prev: number + current: number + period: number +} + +export interface RuntimeChecks {} + +export interface MetaTxn { + id: string + chainId: string + walletAddress: string + contract: string + input: string +} + +export interface Call { + to: string + value?: string + data?: string + gasLimit?: string + delegateCall?: boolean + onlyFallback?: boolean + behaviorOnError?: number +} + +export interface IntentCallsPayload { + chainId: string + space?: string + nonce?: string + calls: Array +} + +export interface IntentConfig { + id: number + configHash: string + originIntentAddress: string + destinationIntentAddress: string + mainSigner: string + calls: Array + preconditions: Array + executionStatus?: string + metaTxnId?: string + txnHash?: string + updatedAt?: string + createdAt?: string +} + +export interface AddressOverrides { + trailsLiFiSapientSignerAddress?: string + trailsRelaySapientSignerAddress?: string + trailsCCTPV2SapientSignerAddress?: string +} + +export interface TakerFee { + address: string + bps: number +} + +export interface IntentPrecondition { + type: string + chainId: string + data: any +} + +export interface Token { + chainId: number + contractAddress: string + tokenId?: string +} + +export interface Price { + value: number + currency: string +} + +export interface TokenPrice { + token: Token + price?: Price + price24hChange?: Price + price24hVol?: Price + floorPrice: Price + buyPrice: Price + sellPrice: Price + updatedAt: string +} + +export interface ExchangeRate { + name: string + symbol: string + value: number + vsCurrency: string + currencyType: string +} + +export interface Page { + pageSize?: number + page?: number + totalRecords?: number + column?: string + before?: any + after?: any + sort?: Array + more?: boolean +} + +export interface SortBy { + column: string + order: SortOrder +} + +export interface CCTPTransfer { + id: string + sourceTxHash: string + sourceChainId: number + destinationChainId: number + message: string + attestation: string + status: string + createdAt: string + updatedAt: string +} + +export interface CrossChainFee { + providerFee: string + trailsSwapFee: string + providerFeeUSD: number + trailsSwapFeeUSD: number + totalFeeAmount: string + totalFeeUSD: number +} + +export interface MetaTxnFeeDetail { + metaTxnID: string + estimatedGasLimit: string + feeNative: string +} + +export interface ChainExecuteQuote { + chainId: string + totalGasLimit: string + gasPrice: string + totalFeeAmount: string + nativeTokenSymbol: string + nativeTokenPrice?: string + metaTxnFeeDetails: Array + totalFeeUSD?: string +} + +export interface ExecuteQuote { + chainQuotes: Array +} + +export interface TrailsFee { + executeQuote: ExecuteQuote + crossChainFee?: CrossChainFee + takerFeeAmount?: string + takerFeeUSD?: number + trailsFixedFeeUSD: number + feeToken?: string + originTokenTotalAmount?: string + totalFeeAmount?: string + totalFeeUSD?: string + quoteProvider?: string +} + +export interface IntentQuote { + fromAmount: string + fromAmountMin: string + toAmount: string + toAmountMin: string + priceImpact: number + priceImpactUsd: string + maxSlippage: number + quoteProvider: string + quoteProviderRequestId: string + quoteProviderFeeUsd: string + feeQuotes: { [key: string]: string } +} + +export interface API { + /** + * + * Runtime + * + */ + ping(headers?: object, signal?: AbortSignal): Promise + version(headers?: object, signal?: AbortSignal): Promise + runtimeStatus(headers?: object, signal?: AbortSignal): Promise + clock(headers?: object, signal?: AbortSignal): Promise + /** + * + * Chain abstraction + * + */ + getIntentCallsPayloads( + args: GetIntentCallsPayloadsArgs, + headers?: object, + signal?: AbortSignal + ): Promise + commitIntentConfig(args: CommitIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise + getIntentConfig(args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise + /** + * + * CCTP + * + */ + getCCTPTransfer(args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise + queueCCTPTransfer(args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise + /** + * + * Intent Machine Worker + * + */ + queueIntentConfigExecution( + args: QueueIntentConfigExecutionArgs, + headers?: object, + signal?: AbortSignal + ): Promise + getIntentConfigExecutionStatus( + args: GetIntentConfigExecutionStatusArgs, + headers?: object, + signal?: AbortSignal + ): Promise + listIntentConfigs(args: ListIntentConfigsArgs, headers?: object, signal?: AbortSignal): Promise + queueMetaTxnReceipt(args: QueueMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise +} + +export interface PingArgs {} + +export interface PingReturn { + status: boolean +} +export interface VersionArgs {} + +export interface VersionReturn { + version: Version +} +export interface RuntimeStatusArgs {} + +export interface RuntimeStatusReturn { + status: RuntimeStatus +} +export interface ClockArgs {} + +export interface ClockReturn { + serverTime: string +} +export interface GetIntentCallsPayloadsArgs { + userAddress: string + destinationChainId: number + destinationTokenAddress: string + destinationTokenAmount: string + destinationToAddress: string + originChainId: number + originTokenAddress: string + originTokenAmount: string + destinationCallData?: string + destinationCallValue?: string + provider?: string + addressOverrides?: AddressOverrides + destinationSalt?: string + takerFee?: TakerFee + slippageTolerance?: number + tradeType?: TradeType +} + +export interface GetIntentCallsPayloadsReturn { + calls: Array + preconditions: Array + metaTxns: Array + trailsFee: TrailsFee + quote: IntentQuote + feeQuotes: { [key: string]: string } + originIntentAddress: string + destinationIntentAddress: string +} +export interface CommitIntentConfigArgs { + originIntentAddress: string + destinationIntentAddress: string + mainSigner: string + calls: Array + preconditions: Array + addressOverrides?: AddressOverrides +} + +export interface CommitIntentConfigReturn { + config: IntentConfig +} +export interface GetIntentConfigArgs { + intentAddress: string +} + +export interface GetIntentConfigReturn { + config: IntentConfig +} +export interface GetCCTPTransferArgs { + id: string +} + +export interface GetCCTPTransferReturn { + transfer: CCTPTransfer +} +export interface QueueCCTPTransferArgs { + sourceTxHash?: string + metaTxHash?: string + sourceChainId: number + destinationChainId: number +} + +export interface QueueCCTPTransferReturn { + transfer: CCTPTransfer +} +export interface QueueIntentConfigExecutionArgs { + intentConfigId: number +} + +export interface QueueIntentConfigExecutionReturn { + status: boolean +} +export interface GetIntentConfigExecutionStatusArgs { + intentConfigId: number +} + +export interface GetIntentConfigExecutionStatusReturn { + executionStatus: string +} +export interface ListIntentConfigsArgs { + page?: Page + executionStatus?: string +} + +export interface ListIntentConfigsReturn { + page: Page + intentConfigs: Array +} +export interface QueueMetaTxnReceiptArgs { + metaTxID: string +} + +export interface QueueMetaTxnReceiptReturn { + status: boolean +} + +// +// Client +// +export class API implements API { + protected hostname: string + protected fetch: Fetch + protected path = '/rpc/API/' + + constructor(hostname: string, fetch: Fetch) { + this.hostname = hostname.replace(/\/*$/, '') + this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init) + } + + private url(name: string): string { + return this.hostname + this.path + name + } + + ping = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + version = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + version: _data.version + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + runtimeStatus = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + clock = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Clock'), createHTTPRequest({}, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + serverTime: _data.serverTime + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getIntentCallsPayloads = ( + args: GetIntentCallsPayloadsArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentCallsPayloads'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + calls: >_data.calls, + preconditions: >_data.preconditions, + metaTxns: >_data.metaTxns, + trailsFee: _data.trailsFee, + quote: _data.quote, + feeQuotes: <{ [key: string]: string }>_data.feeQuotes, + originIntentAddress: _data.originIntentAddress, + destinationIntentAddress: _data.destinationIntentAddress + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + commitIntentConfig = ( + args: CommitIntentConfigArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('CommitIntentConfig'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + config: _data.config + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getIntentConfig = (args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetIntentConfig'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + config: _data.config + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getCCTPTransfer = (args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + transfer: _data.transfer + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + queueCCTPTransfer = (args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('QueueCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + transfer: _data.transfer + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + queueIntentConfigExecution = ( + args: QueueIntentConfigExecutionArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('QueueIntentConfigExecution'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getIntentConfigExecutionStatus = ( + args: GetIntentConfigExecutionStatusArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentConfigExecutionStatus'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + executionStatus: _data.executionStatus + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + listIntentConfigs = (args: ListIntentConfigsArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('ListIntentConfigs'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + page: _data.page, + intentConfigs: >_data.intentConfigs + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + queueMetaTxnReceipt = ( + args: QueueMetaTxnReceiptArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('QueueMetaTxnReceipt'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + status: _data.status + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } +} + +const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => { + const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json' } + reqHeaders[WebrpcHeader] = WebrpcHeaderValue + + return { + method: 'POST', + headers: reqHeaders, + body: JSON.stringify(body || {}), + signal + } +} + +const buildResponse = (res: Response): Promise => { + return res.text().then(text => { + let data + try { + data = JSON.parse(text) + } catch (error) { + let message = '' + if (error instanceof Error) { + message = error.message + } + throw WebrpcBadResponseError.new({ + status: res.status, + cause: `JSON.parse(): ${message}: response text: ${text}` + }) + } + if (!res.ok) { + const code: number = typeof data.code === 'number' ? data.code : 0 + throw (webrpcErrorByCode[code] || WebrpcError).new(data) + } + return data + }) +} + +// +// Errors +// + +export class WebrpcError extends Error { + name: string + code: number + message: string + status: number + cause?: string + + /** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */ + msg: string + + constructor(name: string, code: number, message: string, status: number, cause?: string) { + super(message) + this.name = name || 'WebrpcError' + this.code = typeof code === 'number' ? code : 0 + this.message = message || `endpoint error ${this.code}` + this.msg = this.message + this.status = typeof status === 'number' ? status : 0 + this.cause = cause + Object.setPrototypeOf(this, WebrpcError.prototype) + } + + static new(payload: any): WebrpcError { + return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause) + } +} + +// Webrpc errors + +export class WebrpcEndpointError extends WebrpcError { + constructor( + name: string = 'WebrpcEndpoint', + code: number = 0, + message: string = `endpoint error`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcEndpointError.prototype) + } +} + +export class WebrpcRequestFailedError extends WebrpcError { + constructor( + name: string = 'WebrpcRequestFailed', + code: number = -1, + message: string = `request failed`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype) + } +} + +export class WebrpcBadRouteError extends WebrpcError { + constructor( + name: string = 'WebrpcBadRoute', + code: number = -2, + message: string = `bad route`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadRouteError.prototype) + } +} + +export class WebrpcBadMethodError extends WebrpcError { + constructor( + name: string = 'WebrpcBadMethod', + code: number = -3, + message: string = `bad method`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadMethodError.prototype) + } +} + +export class WebrpcBadRequestError extends WebrpcError { + constructor( + name: string = 'WebrpcBadRequest', + code: number = -4, + message: string = `bad request`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadRequestError.prototype) + } +} + +export class WebrpcBadResponseError extends WebrpcError { + constructor( + name: string = 'WebrpcBadResponse', + code: number = -5, + message: string = `bad response`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcBadResponseError.prototype) + } +} + +export class WebrpcServerPanicError extends WebrpcError { + constructor( + name: string = 'WebrpcServerPanic', + code: number = -6, + message: string = `server panic`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcServerPanicError.prototype) + } +} + +export class WebrpcInternalErrorError extends WebrpcError { + constructor( + name: string = 'WebrpcInternalError', + code: number = -7, + message: string = `internal error`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype) + } +} + +export class WebrpcClientDisconnectedError extends WebrpcError { + constructor( + name: string = 'WebrpcClientDisconnected', + code: number = -8, + message: string = `client disconnected`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype) + } +} + +export class WebrpcStreamLostError extends WebrpcError { + constructor( + name: string = 'WebrpcStreamLost', + code: number = -9, + message: string = `stream lost`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcStreamLostError.prototype) + } +} + +export class WebrpcStreamFinishedError extends WebrpcError { + constructor( + name: string = 'WebrpcStreamFinished', + code: number = -10, + message: string = `stream finished`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype) + } +} + +// Schema errors + +export class UnauthorizedError extends WebrpcError { + constructor( + name: string = 'Unauthorized', + code: number = 1000, + message: string = `Unauthorized access`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnauthorizedError.prototype) + } +} + +export class PermissionDeniedError extends WebrpcError { + constructor( + name: string = 'PermissionDenied', + code: number = 1001, + message: string = `Permission denied`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, PermissionDeniedError.prototype) + } +} + +export class SessionExpiredError extends WebrpcError { + constructor( + name: string = 'SessionExpired', + code: number = 1002, + message: string = `Session expired`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, SessionExpiredError.prototype) + } +} + +export class MethodNotFoundError extends WebrpcError { + constructor( + name: string = 'MethodNotFound', + code: number = 1003, + message: string = `Method not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, MethodNotFoundError.prototype) + } +} + +export class RequestConflictError extends WebrpcError { + constructor( + name: string = 'RequestConflict', + code: number = 1004, + message: string = `Conflict with target resource`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, RequestConflictError.prototype) + } +} + +export class AbortedError extends WebrpcError { + constructor( + name: string = 'Aborted', + code: number = 1005, + message: string = `Request aborted`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AbortedError.prototype) + } +} + +export class GeoblockedError extends WebrpcError { + constructor( + name: string = 'Geoblocked', + code: number = 1006, + message: string = `Geoblocked region`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, GeoblockedError.prototype) + } +} + +export class RateLimitedError extends WebrpcError { + constructor( + name: string = 'RateLimited', + code: number = 1007, + message: string = `Rate-limited. Please slow down.`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, RateLimitedError.prototype) + } +} + +export class ProjectNotFoundError extends WebrpcError { + constructor( + name: string = 'ProjectNotFound', + code: number = 1008, + message: string = `Project not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, ProjectNotFoundError.prototype) + } +} + +export class AccessKeyNotFoundError extends WebrpcError { + constructor( + name: string = 'AccessKeyNotFound', + code: number = 1101, + message: string = `Access key not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype) + } +} + +export class AccessKeyMismatchError extends WebrpcError { + constructor( + name: string = 'AccessKeyMismatch', + code: number = 1102, + message: string = `Access key mismatch`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AccessKeyMismatchError.prototype) + } +} + +export class InvalidOriginError extends WebrpcError { + constructor( + name: string = 'InvalidOrigin', + code: number = 1103, + message: string = `Invalid origin for Access Key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidOriginError.prototype) + } +} + +export class InvalidServiceError extends WebrpcError { + constructor( + name: string = 'InvalidService', + code: number = 1104, + message: string = `Service not enabled for Access key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidServiceError.prototype) + } +} + +export class UnauthorizedUserError extends WebrpcError { + constructor( + name: string = 'UnauthorizedUser', + code: number = 1105, + message: string = `Unauthorized user`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnauthorizedUserError.prototype) + } +} + +export class QuotaExceededError extends WebrpcError { + constructor( + name: string = 'QuotaExceeded', + code: number = 1200, + message: string = `Quota request exceeded`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QuotaExceededError.prototype) + } +} + +export class QuotaRateLimitError extends WebrpcError { + constructor( + name: string = 'QuotaRateLimit', + code: number = 1201, + message: string = `Quota rate limit exceeded`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QuotaRateLimitError.prototype) + } +} + +export class NoDefaultKeyError extends WebrpcError { + constructor( + name: string = 'NoDefaultKey', + code: number = 1300, + message: string = `No default access key found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, NoDefaultKeyError.prototype) + } +} + +export class MaxAccessKeysError extends WebrpcError { + constructor( + name: string = 'MaxAccessKeys', + code: number = 1301, + message: string = `Access keys limit reached`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, MaxAccessKeysError.prototype) + } +} + +export class AtLeastOneKeyError extends WebrpcError { + constructor( + name: string = 'AtLeastOneKey', + code: number = 1302, + message: string = `You need at least one Access Key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AtLeastOneKeyError.prototype) + } +} + +export class TimeoutError extends WebrpcError { + constructor( + name: string = 'Timeout', + code: number = 1900, + message: string = `Request timed out`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, TimeoutError.prototype) + } +} + +export class InvalidArgumentError extends WebrpcError { + constructor( + name: string = 'InvalidArgument', + code: number = 2000, + message: string = `Invalid argument`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidArgumentError.prototype) + } +} + +export class UnavailableError extends WebrpcError { + constructor( + name: string = 'Unavailable', + code: number = 2002, + message: string = `Unavailable resource`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnavailableError.prototype) + } +} + +export class QueryFailedError extends WebrpcError { + constructor( + name: string = 'QueryFailed', + code: number = 2003, + message: string = `Query failed`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QueryFailedError.prototype) + } +} + +export class NotFoundError extends WebrpcError { + constructor( + name: string = 'NotFound', + code: number = 8000, + message: string = `Resource not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, NotFoundError.prototype) + } +} + +export class UnsupportedNetworkError extends WebrpcError { + constructor( + name: string = 'UnsupportedNetwork', + code: number = 8008, + message: string = `Unsupported network`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnsupportedNetworkError.prototype) + } +} + +export enum errors { + WebrpcEndpoint = 'WebrpcEndpoint', + WebrpcRequestFailed = 'WebrpcRequestFailed', + WebrpcBadRoute = 'WebrpcBadRoute', + WebrpcBadMethod = 'WebrpcBadMethod', + WebrpcBadRequest = 'WebrpcBadRequest', + WebrpcBadResponse = 'WebrpcBadResponse', + WebrpcServerPanic = 'WebrpcServerPanic', + WebrpcInternalError = 'WebrpcInternalError', + WebrpcClientDisconnected = 'WebrpcClientDisconnected', + WebrpcStreamLost = 'WebrpcStreamLost', + WebrpcStreamFinished = 'WebrpcStreamFinished', + Unauthorized = 'Unauthorized', + PermissionDenied = 'PermissionDenied', + SessionExpired = 'SessionExpired', + MethodNotFound = 'MethodNotFound', + RequestConflict = 'RequestConflict', + Aborted = 'Aborted', + Geoblocked = 'Geoblocked', + RateLimited = 'RateLimited', + ProjectNotFound = 'ProjectNotFound', + AccessKeyNotFound = 'AccessKeyNotFound', + AccessKeyMismatch = 'AccessKeyMismatch', + InvalidOrigin = 'InvalidOrigin', + InvalidService = 'InvalidService', + UnauthorizedUser = 'UnauthorizedUser', + QuotaExceeded = 'QuotaExceeded', + QuotaRateLimit = 'QuotaRateLimit', + NoDefaultKey = 'NoDefaultKey', + MaxAccessKeys = 'MaxAccessKeys', + AtLeastOneKey = 'AtLeastOneKey', + Timeout = 'Timeout', + InvalidArgument = 'InvalidArgument', + Unavailable = 'Unavailable', + QueryFailed = 'QueryFailed', + NotFound = 'NotFound', + UnsupportedNetwork = 'UnsupportedNetwork' +} + +export enum WebrpcErrorCodes { + WebrpcEndpoint = 0, + WebrpcRequestFailed = -1, + WebrpcBadRoute = -2, + WebrpcBadMethod = -3, + WebrpcBadRequest = -4, + WebrpcBadResponse = -5, + WebrpcServerPanic = -6, + WebrpcInternalError = -7, + WebrpcClientDisconnected = -8, + WebrpcStreamLost = -9, + WebrpcStreamFinished = -10, + Unauthorized = 1000, + PermissionDenied = 1001, + SessionExpired = 1002, + MethodNotFound = 1003, + RequestConflict = 1004, + Aborted = 1005, + Geoblocked = 1006, + RateLimited = 1007, + ProjectNotFound = 1008, + AccessKeyNotFound = 1101, + AccessKeyMismatch = 1102, + InvalidOrigin = 1103, + InvalidService = 1104, + UnauthorizedUser = 1105, + QuotaExceeded = 1200, + QuotaRateLimit = 1201, + NoDefaultKey = 1300, + MaxAccessKeys = 1301, + AtLeastOneKey = 1302, + Timeout = 1900, + InvalidArgument = 2000, + Unavailable = 2002, + QueryFailed = 2003, + NotFound = 8000, + UnsupportedNetwork = 8008 +} + +export const webrpcErrorByCode: { [code: number]: any } = { + [0]: WebrpcEndpointError, + [-1]: WebrpcRequestFailedError, + [-2]: WebrpcBadRouteError, + [-3]: WebrpcBadMethodError, + [-4]: WebrpcBadRequestError, + [-5]: WebrpcBadResponseError, + [-6]: WebrpcServerPanicError, + [-7]: WebrpcInternalErrorError, + [-8]: WebrpcClientDisconnectedError, + [-9]: WebrpcStreamLostError, + [-10]: WebrpcStreamFinishedError, + [1000]: UnauthorizedError, + [1001]: PermissionDeniedError, + [1002]: SessionExpiredError, + [1003]: MethodNotFoundError, + [1004]: RequestConflictError, + [1005]: AbortedError, + [1006]: GeoblockedError, + [1007]: RateLimitedError, + [1008]: ProjectNotFoundError, + [1101]: AccessKeyNotFoundError, + [1102]: AccessKeyMismatchError, + [1103]: InvalidOriginError, + [1104]: InvalidServiceError, + [1105]: UnauthorizedUserError, + [1200]: QuotaExceededError, + [1201]: QuotaRateLimitError, + [1300]: NoDefaultKeyError, + [1301]: MaxAccessKeysError, + [1302]: AtLeastOneKeyError, + [1900]: TimeoutError, + [2000]: InvalidArgumentError, + [2002]: UnavailableError, + [2003]: QueryFailedError, + [8000]: NotFoundError, + [8008]: UnsupportedNetworkError +} + +export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise From 9faeb60055366c41b416482d32506b4ff37cb08e Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Wed, 1 Oct 2025 16:05:34 +0000 Subject: [PATCH 03/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 35 ++++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index f13a6d027..8bc6feae9 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3 +// trails-api v0.4.0 a81a66cc8764837490ea73950ef78928610fa7e6 // -- // Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '28a9163b0bcbdf5cecfc8f2b668550cc1ccadaf3' +export const WebRPCSchemaHash = 'a81a66cc8764837490ea73950ef78928610fa7e6' type WebrpcGenVersions = { webrpcGenVersion: string @@ -280,50 +280,51 @@ export interface IntentQuote { } export interface API { - /** - * - * Runtime - * - */ ping(headers?: object, signal?: AbortSignal): Promise version(headers?: object, signal?: AbortSignal): Promise runtimeStatus(headers?: object, signal?: AbortSignal): Promise clock(headers?: object, signal?: AbortSignal): Promise /** - * - * Chain abstraction - * + * Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. */ getIntentCallsPayloads( args: GetIntentCallsPayloadsArgs, headers?: object, signal?: AbortSignal ): Promise + /** + * Persists intent configuration details to database for later execution, creating a new intent config record. + */ commitIntentConfig(args: CommitIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise - getIntentConfig(args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise /** - * - * CCTP - * + * Retrieves stored intent configuration by wallet address for inspection or execution. */ + getIntentConfig(args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise getCCTPTransfer(args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise queueCCTPTransfer(args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise /** - * - * Intent Machine Worker - * + * Marks an intent config as ready for processing by the execution worker. */ queueIntentConfigExecution( args: QueueIntentConfigExecutionArgs, headers?: object, signal?: AbortSignal ): Promise + /** + * Returns current execution status (pending/processing/executed/failed) for a given intent config. + */ getIntentConfigExecutionStatus( args: GetIntentConfigExecutionStatusArgs, headers?: object, signal?: AbortSignal ): Promise + /** + * Paginated listing of intent configs with optional execution status filtering. + */ listIntentConfigs(args: ListIntentConfigsArgs, headers?: object, signal?: AbortSignal): Promise + /** + * Processes relay transaction receipts to update intent execution status and trigger refund logic. + */ queueMetaTxnReceipt(args: QueueMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise } From 968c75e04f0b80d51b138def3b9b00d2945f50bc Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Wed, 1 Oct 2025 18:36:51 +0000 Subject: [PATCH 04/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 134 ++++++++++++++++------ 1 file changed, 96 insertions(+), 38 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 8bc6feae9..060fbfb86 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 a81a66cc8764837490ea73950ef78928610fa7e6 +// trails-api v0.4.0 d0eb660544cee4bb56919d4aa3135ab30ecb72d0 // -- // Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = 'a81a66cc8764837490ea73950ef78928610fa7e6' +export const WebRPCSchemaHash = 'd0eb660544cee4bb56919d4aa3135ab30ecb72d0' type WebrpcGenVersions = { webrpcGenVersion: string @@ -70,16 +70,16 @@ function parseWebrpcGenVersions(header: string): WebrpcGenVersions { // Types // -export enum TradeType { - EXACT_INPUT = 'EXACT_INPUT', - EXACT_OUTPUT = 'EXACT_OUTPUT' -} - export enum SortOrder { DESC = 'DESC', ASC = 'ASC' } +export enum TradeType { + EXACT_INPUT = 'EXACT_INPUT', + EXACT_OUTPUT = 'EXACT_OUTPUT' +} + export interface Version { webrpcVersion: string schemaVersion: string @@ -147,6 +147,13 @@ export interface IntentConfig { createdAt?: string } +export interface MetaTxnReceipt { + metaTxID: string + status: string + txnReceipt?: string + revertReason?: string +} + export interface AddressOverrides { trailsLiFiSapientSignerAddress?: string trailsRelaySapientSignerAddress?: string @@ -158,6 +165,13 @@ export interface TakerFee { bps: number } +export interface OriginCall { + chainId: number + to: string + transactionData: string + transactionValue: string +} + export interface IntentPrecondition { type: string chainId: string @@ -222,6 +236,56 @@ export interface CCTPTransfer { updatedAt: string } +export interface GetIntentCallsPayloadParams { + userAddress: string + destinationChainId: number + destinationTokenAddress: string + destinationTokenAmount: string + destinationToAddress: string + originChainId: number + originTokenAddress: string + originTokenAmount: string + destinationCallData?: string + destinationCallValue?: string + provider?: string + addressOverrides?: AddressOverrides + destinationSalt?: string + takerFee?: TakerFee + slippageTolerance?: number + tradeType?: TradeType +} + +export interface GetIntentsQuoteParams { + userAddress: string + destinationChainId: number + destinationTokenAddress: string + destinationTokenAmount: string + destinationToAddress: string + originChainId: number + originTokenAddress: string + originTokenAmount: string + destinationCallData?: string + destinationCallValue?: string + provider?: string + addressOverrides?: AddressOverrides + destinationSalt?: string + takerFee?: TakerFee + slippageTolerance?: number + tradeType?: TradeType + exactInputOriginalTokenAmount?: string +} + +export interface IntentCallsPayloads { + calls: Array + preconditions: Array + metaTxns: Array + trailsFee: TrailsFee + quote: IntentQuote + feeQuotes: { [key: string]: string } + originIntentAddress: string + destinationIntentAddress: string +} + export interface CrossChainFee { providerFee: string trailsSwapFee: string @@ -292,6 +356,7 @@ export interface API { headers?: object, signal?: AbortSignal ): Promise + getIntentsQuote(args: GetIntentsQuoteArgs, headers?: object, signal?: AbortSignal): Promise /** * Persists intent configuration details to database for later execution, creating a new intent config record. */ @@ -349,33 +414,18 @@ export interface ClockReturn { serverTime: string } export interface GetIntentCallsPayloadsArgs { - userAddress: string - destinationChainId: number - destinationTokenAddress: string - destinationTokenAmount: string - destinationToAddress: string - originChainId: number - originTokenAddress: string - originTokenAmount: string - destinationCallData?: string - destinationCallValue?: string - provider?: string - addressOverrides?: AddressOverrides - destinationSalt?: string - takerFee?: TakerFee - slippageTolerance?: number - tradeType?: TradeType + params: GetIntentCallsPayloadParams } export interface GetIntentCallsPayloadsReturn { - calls: Array - preconditions: Array - metaTxns: Array - trailsFee: TrailsFee + payloads: IntentCallsPayloads +} +export interface GetIntentsQuoteArgs { + params: GetIntentsQuoteParams +} + +export interface GetIntentsQuoteReturn { quote: IntentQuote - feeQuotes: { [key: string]: string } - originIntentAddress: string - destinationIntentAddress: string } export interface CommitIntentConfigArgs { originIntentAddress: string @@ -530,14 +580,22 @@ export class API implements API { res => { return buildResponse(res).then(_data => { return { - calls: >_data.calls, - preconditions: >_data.preconditions, - metaTxns: >_data.metaTxns, - trailsFee: _data.trailsFee, - quote: _data.quote, - feeQuotes: <{ [key: string]: string }>_data.feeQuotes, - originIntentAddress: _data.originIntentAddress, - destinationIntentAddress: _data.destinationIntentAddress + payloads: _data.payloads + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getIntentsQuote = (args: GetIntentsQuoteArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetIntentsQuote'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + quote: _data.quote } }) }, From 09b5e191f4292508c2533db373e0056803bee842 Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Wed, 1 Oct 2025 20:01:24 +0000 Subject: [PATCH 05/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 90 +++++++++++++++++++++-- 1 file changed, 82 insertions(+), 8 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 060fbfb86..b2beb4b71 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 d0eb660544cee4bb56919d4aa3135ab30ecb72d0 +// trails-api v0.4.0 382b29dc1d49e1b98fb4b074aec76beb06a1cd3d // -- // Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = 'd0eb660544cee4bb56919d4aa3135ab30ecb72d0' +export const WebRPCSchemaHash = '382b29dc1d49e1b98fb4b074aec76beb06a1cd3d' type WebrpcGenVersions = { webrpcGenVersion: string @@ -147,6 +147,23 @@ export interface IntentConfig { createdAt?: string } +export interface IntentTransaction { + originIntentAddress: string + destinationIntentAddress: string + mainSigner: string + metaTxnId?: string + txnHash?: string + executionStatus?: string + originChainId?: number + destinationChainId?: number + originTokenAddress?: string + originTokenAmount?: string + destinationTokenAddress?: string + destinationTokenAmount?: string + destinationToAddress?: string + createdAt?: string +} + export interface MetaTxnReceipt { metaTxID: string status: string @@ -275,6 +292,31 @@ export interface GetIntentsQuoteParams { exactInputOriginalTokenAmount?: string } +export interface CommitIntentConfigParams { + originIntentAddress: string + destinationIntentAddress: string + mainSigner: string + calls: Array + preconditions: Array + addressOverrides?: AddressOverrides + requestParams?: IntentRequestParams +} + +export interface IntentRequestParams { + version: string + userAddress: string + destinationChainId: number + destinationTokenAddress: string + destinationTokenAmount: string + destinationToAddress: string + originChainId: number + originTokenAddress: string + originTokenAmount: string + destinationCallData?: string + destinationCallValue?: string + createdAt: string +} + export interface IntentCallsPayloads { calls: Array preconditions: Array @@ -365,6 +407,14 @@ export interface API { * Retrieves stored intent configuration by wallet address for inspection or execution. */ getIntentConfig(args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise + /** + * Intent transaction history endpoint + */ + getIntentTransactionHistory( + args: GetIntentTransactionHistoryArgs, + headers?: object, + signal?: AbortSignal + ): Promise getCCTPTransfer(args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise queueCCTPTransfer(args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise /** @@ -428,12 +478,7 @@ export interface GetIntentsQuoteReturn { quote: IntentQuote } export interface CommitIntentConfigArgs { - originIntentAddress: string - destinationIntentAddress: string - mainSigner: string - calls: Array - preconditions: Array - addressOverrides?: AddressOverrides + params: CommitIntentConfigParams } export interface CommitIntentConfigReturn { @@ -446,6 +491,15 @@ export interface GetIntentConfigArgs { export interface GetIntentConfigReturn { config: IntentConfig } +export interface GetIntentTransactionHistoryArgs { + accountAddress: string + page?: Page +} + +export interface GetIntentTransactionHistoryReturn { + page: Page + transactions: Array +} export interface GetCCTPTransferArgs { id: string } @@ -639,6 +693,26 @@ export class API implements API { ) } + getIntentTransactionHistory = ( + args: GetIntentTransactionHistoryArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentTransactionHistory'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + page: _data.page, + transactions: >_data.transactions + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + getCCTPTransfer = (args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { return this.fetch(this.url('GetCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( res => { From 20c5cdb7167af41fcd8d41cd03652913c2366366 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 6 Oct 2025 16:31:51 +0000 Subject: [PATCH 06/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 126 +++++++++++----------- 1 file changed, 61 insertions(+), 65 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index b2beb4b71..d0c229c71 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,13 +1,13 @@ /* eslint-disable */ // trails-api v0.4.0 382b29dc1d49e1b98fb4b074aec76beb06a1cd3d // -- -// Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // // webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/trails-api.gen.ts export const WebrpcHeader = 'Webrpc' -export const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;trails-api@v0.4.0' +export const WebrpcHeaderValue = 'webrpc@v0.28.1;gen-typescript@v0.19.0;trails-api@v0.4.0' // WebRPC description and code-gen version export const WebRPCVersion = 'v1' @@ -575,7 +575,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -590,7 +590,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -605,7 +605,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -620,7 +620,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -639,7 +639,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -654,7 +654,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -673,7 +673,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -688,7 +688,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -708,7 +708,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -723,7 +723,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -738,7 +738,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -757,7 +757,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -776,7 +776,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -792,7 +792,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -811,7 +811,7 @@ export class API implements API { }) }, error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) } ) } @@ -835,13 +835,9 @@ const buildResponse = (res: Response): Promise => { try { data = JSON.parse(text) } catch (error) { - let message = '' - if (error instanceof Error) { - message = error.message - } throw WebrpcBadResponseError.new({ status: res.status, - cause: `JSON.parse(): ${message}: response text: ${text}` + cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}` }) } if (!res.ok) { @@ -889,7 +885,7 @@ export class WebrpcEndpointError extends WebrpcError { name: string = 'WebrpcEndpoint', code: number = 0, message: string = `endpoint error`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -902,7 +898,7 @@ export class WebrpcRequestFailedError extends WebrpcError { name: string = 'WebrpcRequestFailed', code: number = -1, message: string = `request failed`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -915,7 +911,7 @@ export class WebrpcBadRouteError extends WebrpcError { name: string = 'WebrpcBadRoute', code: number = -2, message: string = `bad route`, - status: number = 0, + status: number = 404, cause?: string ) { super(name, code, message, status, cause) @@ -928,7 +924,7 @@ export class WebrpcBadMethodError extends WebrpcError { name: string = 'WebrpcBadMethod', code: number = -3, message: string = `bad method`, - status: number = 0, + status: number = 405, cause?: string ) { super(name, code, message, status, cause) @@ -941,7 +937,7 @@ export class WebrpcBadRequestError extends WebrpcError { name: string = 'WebrpcBadRequest', code: number = -4, message: string = `bad request`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -954,7 +950,7 @@ export class WebrpcBadResponseError extends WebrpcError { name: string = 'WebrpcBadResponse', code: number = -5, message: string = `bad response`, - status: number = 0, + status: number = 500, cause?: string ) { super(name, code, message, status, cause) @@ -967,7 +963,7 @@ export class WebrpcServerPanicError extends WebrpcError { name: string = 'WebrpcServerPanic', code: number = -6, message: string = `server panic`, - status: number = 0, + status: number = 500, cause?: string ) { super(name, code, message, status, cause) @@ -980,7 +976,7 @@ export class WebrpcInternalErrorError extends WebrpcError { name: string = 'WebrpcInternalError', code: number = -7, message: string = `internal error`, - status: number = 0, + status: number = 500, cause?: string ) { super(name, code, message, status, cause) @@ -988,16 +984,16 @@ export class WebrpcInternalErrorError extends WebrpcError { } } -export class WebrpcClientDisconnectedError extends WebrpcError { +export class WebrpcClientAbortedError extends WebrpcError { constructor( - name: string = 'WebrpcClientDisconnected', + name: string = 'WebrpcClientAborted', code: number = -8, - message: string = `client disconnected`, - status: number = 0, + message: string = `request aborted by client`, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) - Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype) + Object.setPrototypeOf(this, WebrpcClientAbortedError.prototype) } } @@ -1006,7 +1002,7 @@ export class WebrpcStreamLostError extends WebrpcError { name: string = 'WebrpcStreamLost', code: number = -9, message: string = `stream lost`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -1019,7 +1015,7 @@ export class WebrpcStreamFinishedError extends WebrpcError { name: string = 'WebrpcStreamFinished', code: number = -10, message: string = `stream finished`, - status: number = 0, + status: number = 200, cause?: string ) { super(name, code, message, status, cause) @@ -1034,7 +1030,7 @@ export class UnauthorizedError extends WebrpcError { name: string = 'Unauthorized', code: number = 1000, message: string = `Unauthorized access`, - status: number = 0, + status: number = 401, cause?: string ) { super(name, code, message, status, cause) @@ -1047,7 +1043,7 @@ export class PermissionDeniedError extends WebrpcError { name: string = 'PermissionDenied', code: number = 1001, message: string = `Permission denied`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1060,7 +1056,7 @@ export class SessionExpiredError extends WebrpcError { name: string = 'SessionExpired', code: number = 1002, message: string = `Session expired`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1073,7 +1069,7 @@ export class MethodNotFoundError extends WebrpcError { name: string = 'MethodNotFound', code: number = 1003, message: string = `Method not found`, - status: number = 0, + status: number = 404, cause?: string ) { super(name, code, message, status, cause) @@ -1086,7 +1082,7 @@ export class RequestConflictError extends WebrpcError { name: string = 'RequestConflict', code: number = 1004, message: string = `Conflict with target resource`, - status: number = 0, + status: number = 409, cause?: string ) { super(name, code, message, status, cause) @@ -1099,7 +1095,7 @@ export class AbortedError extends WebrpcError { name: string = 'Aborted', code: number = 1005, message: string = `Request aborted`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -1112,7 +1108,7 @@ export class GeoblockedError extends WebrpcError { name: string = 'Geoblocked', code: number = 1006, message: string = `Geoblocked region`, - status: number = 0, + status: number = 451, cause?: string ) { super(name, code, message, status, cause) @@ -1125,7 +1121,7 @@ export class RateLimitedError extends WebrpcError { name: string = 'RateLimited', code: number = 1007, message: string = `Rate-limited. Please slow down.`, - status: number = 0, + status: number = 429, cause?: string ) { super(name, code, message, status, cause) @@ -1138,7 +1134,7 @@ export class ProjectNotFoundError extends WebrpcError { name: string = 'ProjectNotFound', code: number = 1008, message: string = `Project not found`, - status: number = 0, + status: number = 401, cause?: string ) { super(name, code, message, status, cause) @@ -1151,7 +1147,7 @@ export class AccessKeyNotFoundError extends WebrpcError { name: string = 'AccessKeyNotFound', code: number = 1101, message: string = `Access key not found`, - status: number = 0, + status: number = 401, cause?: string ) { super(name, code, message, status, cause) @@ -1164,7 +1160,7 @@ export class AccessKeyMismatchError extends WebrpcError { name: string = 'AccessKeyMismatch', code: number = 1102, message: string = `Access key mismatch`, - status: number = 0, + status: number = 409, cause?: string ) { super(name, code, message, status, cause) @@ -1177,7 +1173,7 @@ export class InvalidOriginError extends WebrpcError { name: string = 'InvalidOrigin', code: number = 1103, message: string = `Invalid origin for Access Key`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1190,7 +1186,7 @@ export class InvalidServiceError extends WebrpcError { name: string = 'InvalidService', code: number = 1104, message: string = `Service not enabled for Access key`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1203,7 +1199,7 @@ export class UnauthorizedUserError extends WebrpcError { name: string = 'UnauthorizedUser', code: number = 1105, message: string = `Unauthorized user`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1216,7 +1212,7 @@ export class QuotaExceededError extends WebrpcError { name: string = 'QuotaExceeded', code: number = 1200, message: string = `Quota request exceeded`, - status: number = 0, + status: number = 429, cause?: string ) { super(name, code, message, status, cause) @@ -1229,7 +1225,7 @@ export class QuotaRateLimitError extends WebrpcError { name: string = 'QuotaRateLimit', code: number = 1201, message: string = `Quota rate limit exceeded`, - status: number = 0, + status: number = 429, cause?: string ) { super(name, code, message, status, cause) @@ -1242,7 +1238,7 @@ export class NoDefaultKeyError extends WebrpcError { name: string = 'NoDefaultKey', code: number = 1300, message: string = `No default access key found`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1255,7 +1251,7 @@ export class MaxAccessKeysError extends WebrpcError { name: string = 'MaxAccessKeys', code: number = 1301, message: string = `Access keys limit reached`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1268,7 +1264,7 @@ export class AtLeastOneKeyError extends WebrpcError { name: string = 'AtLeastOneKey', code: number = 1302, message: string = `You need at least one Access Key`, - status: number = 0, + status: number = 403, cause?: string ) { super(name, code, message, status, cause) @@ -1281,7 +1277,7 @@ export class TimeoutError extends WebrpcError { name: string = 'Timeout', code: number = 1900, message: string = `Request timed out`, - status: number = 0, + status: number = 408, cause?: string ) { super(name, code, message, status, cause) @@ -1294,7 +1290,7 @@ export class InvalidArgumentError extends WebrpcError { name: string = 'InvalidArgument', code: number = 2000, message: string = `Invalid argument`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -1307,7 +1303,7 @@ export class UnavailableError extends WebrpcError { name: string = 'Unavailable', code: number = 2002, message: string = `Unavailable resource`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -1320,7 +1316,7 @@ export class QueryFailedError extends WebrpcError { name: string = 'QueryFailed', code: number = 2003, message: string = `Query failed`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -1333,7 +1329,7 @@ export class NotFoundError extends WebrpcError { name: string = 'NotFound', code: number = 8000, message: string = `Resource not found`, - status: number = 0, + status: number = 400, cause?: string ) { super(name, code, message, status, cause) @@ -1346,7 +1342,7 @@ export class UnsupportedNetworkError extends WebrpcError { name: string = 'UnsupportedNetwork', code: number = 8008, message: string = `Unsupported network`, - status: number = 0, + status: number = 422, cause?: string ) { super(name, code, message, status, cause) @@ -1363,7 +1359,7 @@ export enum errors { WebrpcBadResponse = 'WebrpcBadResponse', WebrpcServerPanic = 'WebrpcServerPanic', WebrpcInternalError = 'WebrpcInternalError', - WebrpcClientDisconnected = 'WebrpcClientDisconnected', + WebrpcClientAborted = 'WebrpcClientAborted', WebrpcStreamLost = 'WebrpcStreamLost', WebrpcStreamFinished = 'WebrpcStreamFinished', Unauthorized = 'Unauthorized', @@ -1402,7 +1398,7 @@ export enum WebrpcErrorCodes { WebrpcBadResponse = -5, WebrpcServerPanic = -6, WebrpcInternalError = -7, - WebrpcClientDisconnected = -8, + WebrpcClientAborted = -8, WebrpcStreamLost = -9, WebrpcStreamFinished = -10, Unauthorized = 1000, @@ -1441,7 +1437,7 @@ export const webrpcErrorByCode: { [code: number]: any } = { [-5]: WebrpcBadResponseError, [-6]: WebrpcServerPanicError, [-7]: WebrpcInternalErrorError, - [-8]: WebrpcClientDisconnectedError, + [-8]: WebrpcClientAbortedError, [-9]: WebrpcStreamLostError, [-10]: WebrpcStreamFinishedError, [1000]: UnauthorizedError, From 932de305b8a73ce53d5216ca851e1679b6e91884 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 7 Oct 2025 01:29:37 +0000 Subject: [PATCH 07/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index d0c229c71..a799f05e4 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 382b29dc1d49e1b98fb4b074aec76beb06a1cd3d +// trails-api v0.4.0 21fe8892ba70a2368cbf23d158a09a9b61873d6a // -- // Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '382b29dc1d49e1b98fb4b074aec76beb06a1cd3d' +export const WebRPCSchemaHash = '21fe8892ba70a2368cbf23d158a09a9b61873d6a' type WebrpcGenVersions = { webrpcGenVersion: string From 0f90b94d3abd04cd9d00dd8422e5995976dc4e1a Mon Sep 17 00:00:00 2001 From: miguelmota <168240+miguelmota@users.noreply.github.com> Date: Tue, 7 Oct 2025 01:59:29 +0000 Subject: [PATCH 08/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 101 +++++++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index a799f05e4..9c9e76f62 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 21fe8892ba70a2368cbf23d158a09a9b61873d6a +// trails-api v0.4.0 62cf3364b251220bd2fc985fae07f490158c119c // -- // Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '21fe8892ba70a2368cbf23d158a09a9b61873d6a' +export const WebRPCSchemaHash = '62cf3364b251220bd2fc985fae07f490158c119c' type WebrpcGenVersions = { webrpcGenVersion: string @@ -385,6 +385,35 @@ export interface IntentQuote { feeQuotes: { [key: string]: string } } +export interface GetIntentEntrypointDepositParams { + userAddress: string + tokenAddress: string + amount: string + intentAddress: string + chainID: number + deadline: number + intentSignature: string + usePermit?: boolean + permitDeadline?: number + permitSignature?: string +} + +export interface GetIntentEntrypointDepositResult { + depositWalletAddress: string + metaTxn: MetaTxn + feeQuote: string + entrypointAddress: string +} + +export interface GetIntentEntrypointMessageHashParams { + userAddress: string + tokenAddress: string + amount: string + intentAddress: string + chainID: number + deadline: number +} + export interface API { ping(headers?: object, signal?: AbortSignal): Promise version(headers?: object, signal?: AbortSignal): Promise @@ -415,6 +444,22 @@ export interface API { headers?: object, signal?: AbortSignal ): Promise + /** + * Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. + */ + getIntentEntrypointDeposit( + args: GetIntentEntrypointDepositArgs, + headers?: object, + signal?: AbortSignal + ): Promise + /** + * Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. + */ + getIntentEntrypointMessageHash( + args: GetIntentEntrypointMessageHashArgs, + headers?: object, + signal?: AbortSignal + ): Promise getCCTPTransfer(args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise queueCCTPTransfer(args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise /** @@ -500,6 +545,20 @@ export interface GetIntentTransactionHistoryReturn { page: Page transactions: Array } +export interface GetIntentEntrypointDepositArgs { + params: GetIntentEntrypointDepositParams +} + +export interface GetIntentEntrypointDepositReturn { + result: GetIntentEntrypointDepositResult +} +export interface GetIntentEntrypointMessageHashArgs { + params: GetIntentEntrypointMessageHashParams +} + +export interface GetIntentEntrypointMessageHashReturn { + messageHash: string +} export interface GetCCTPTransferArgs { id: string } @@ -713,6 +772,44 @@ export class API implements API { ) } + getIntentEntrypointDeposit = ( + args: GetIntentEntrypointDepositArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentEntrypointDeposit'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + result: _data.result + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) + } + ) + } + + getIntentEntrypointMessageHash = ( + args: GetIntentEntrypointMessageHashArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentEntrypointMessageHash'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + messageHash: _data.messageHash + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) + } + ) + } + getCCTPTransfer = (args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { return this.fetch(this.url('GetCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( res => { From 1e0a1f9543286ec0513c09273cca52808e357389 Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Tue, 7 Oct 2025 08:49:11 +0000 Subject: [PATCH 09/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 9c9e76f62..f9be8cb98 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 62cf3364b251220bd2fc985fae07f490158c119c +// trails-api v0.4.0 639386f692af6385305bf6901cc9f1b6fe21e979 // -- // Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '62cf3364b251220bd2fc985fae07f490158c119c' +export const WebRPCSchemaHash = '639386f692af6385305bf6901cc9f1b6fe21e979' type WebrpcGenVersions = { webrpcGenVersion: string @@ -172,9 +172,11 @@ export interface MetaTxnReceipt { } export interface AddressOverrides { - trailsLiFiSapientSignerAddress?: string - trailsRelaySapientSignerAddress?: string - trailsCCTPV2SapientSignerAddress?: string + sequenceWalletFactoryAddress?: string + sequenceWalletMainModuleAddress?: string + sequenceWalletMainModuleUpgradableAddress?: string + sequenceWalletGuestModuleAddress?: string + sequenceWalletUtilsAddress?: string } export interface TakerFee { From 3ffbfa027c9cbc246a21d276f618449beede9434 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:03:53 +0000 Subject: [PATCH 10/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index f9be8cb98..878886cb9 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 639386f692af6385305bf6901cc9f1b6fe21e979 +// trails-api v0.4.0 8d6fd2f45083b3e8df2e6d6babe1046f788a6d43 // -- // Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '639386f692af6385305bf6901cc9f1b6fe21e979' +export const WebRPCSchemaHash = '8d6fd2f45083b3e8df2e6d6babe1046f788a6d43' type WebrpcGenVersions = { webrpcGenVersion: string @@ -95,7 +95,6 @@ export interface RuntimeStatus { branch: string commitHash: string checks: RuntimeChecks - numTxnsRelayed: { [key: string]: NumTxnsRelayed } } export interface NumTxnsRelayed { From f8989aa4e7a6672378a9909793bc010658e23cff Mon Sep 17 00:00:00 2001 From: shunkakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Fri, 10 Oct 2025 05:27:12 +0000 Subject: [PATCH 11/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 878886cb9..147c0a4c4 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 8d6fd2f45083b3e8df2e6d6babe1046f788a6d43 +// trails-api v0.4.0 fed97360e921855da1cdb97cf0a96404edb2950f // -- // Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '8d6fd2f45083b3e8df2e6d6babe1046f788a6d43' +export const WebRPCSchemaHash = 'fed97360e921855da1cdb97cf0a96404edb2950f' type WebrpcGenVersions = { webrpcGenVersion: string @@ -362,9 +362,6 @@ export interface ExecuteQuote { export interface TrailsFee { executeQuote: ExecuteQuote crossChainFee?: CrossChainFee - takerFeeAmount?: string - takerFeeUSD?: number - trailsFixedFeeUSD: number feeToken?: string originTokenTotalAmount?: string totalFeeAmount?: string From 5b8574a64afdbd70ba1feb6c28fe12c3d27d86ad Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:29:55 +0000 Subject: [PATCH 12/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 56 +++++++++++++++-------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 147c0a4c4..e21fdaaad 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 fed97360e921855da1cdb97cf0a96404edb2950f +// trails-api v0.4.0 7ae581ed6118efc338a137a9a4699e2ec1f87f03 // -- // Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = 'fed97360e921855da1cdb97cf0a96404edb2950f' +export const WebRPCSchemaHash = '7ae581ed6118efc338a137a9a4699e2ec1f87f03' type WebrpcGenVersions = { webrpcGenVersion: string @@ -94,18 +94,8 @@ export interface RuntimeStatus { ver: string branch: string commitHash: string - checks: RuntimeChecks } -export interface NumTxnsRelayed { - chainID: number - prev: number - current: number - period: number -} - -export interface RuntimeChecks {} - export interface MetaTxn { id: string chainId: string @@ -178,11 +168,6 @@ export interface AddressOverrides { sequenceWalletUtilsAddress?: string } -export interface TakerFee { - address: string - bps: number -} - export interface OriginCall { chainId: number to: string @@ -193,7 +178,13 @@ export interface OriginCall { export interface IntentPrecondition { type: string chainId: string - data: any + data: IntentPreconditionData +} + +export interface IntentPreconditionData { + address: string + token: string + min: number } export interface Token { @@ -268,7 +259,6 @@ export interface GetIntentCallsPayloadParams { provider?: string addressOverrides?: AddressOverrides destinationSalt?: string - takerFee?: TakerFee slippageTolerance?: number tradeType?: TradeType } @@ -287,7 +277,6 @@ export interface GetIntentsQuoteParams { provider?: string addressOverrides?: AddressOverrides destinationSalt?: string - takerFee?: TakerFee slippageTolerance?: number tradeType?: TradeType exactInputOriginalTokenAmount?: string @@ -319,6 +308,7 @@ export interface IntentRequestParams { } export interface IntentCallsPayloads { + id: string calls: Array preconditions: Array metaTxns: Array @@ -417,6 +407,10 @@ export interface API { version(headers?: object, signal?: AbortSignal): Promise runtimeStatus(headers?: object, signal?: AbortSignal): Promise clock(headers?: object, signal?: AbortSignal): Promise + /** + * TODO: a lot of overlap with IntentConfig and other stuff.. + */ + executeIntent(args: ExecuteIntentArgs, headers?: object, signal?: AbortSignal): Promise /** * Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. */ @@ -506,6 +500,13 @@ export interface ClockArgs {} export interface ClockReturn { serverTime: string } +export interface ExecuteIntentArgs { + intent: CommitIntentConfigParams +} + +export interface ExecuteIntentReturn { + config: IntentConfig +} export interface GetIntentCallsPayloadsArgs { params: GetIntentCallsPayloadParams } @@ -682,6 +683,21 @@ export class API implements API { ) } + executeIntent = (args: ExecuteIntentArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('ExecuteIntent'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + config: _data.config + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) + } + ) + } + getIntentCallsPayloads = ( args: GetIntentCallsPayloadsArgs, headers?: object, From 755a7eb532e7e2c00e27c296df8e112a172c5ea2 Mon Sep 17 00:00:00 2001 From: miguelmota <168240+miguelmota@users.noreply.github.com> Date: Mon, 13 Oct 2025 18:51:27 +0000 Subject: [PATCH 13/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 70 ++++++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index e21fdaaad..21d31ce44 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 7ae581ed6118efc338a137a9a4699e2ec1f87f03 +// trails-api v0.4.0 c4f41586d79b6d1fd4283fcb3da2527586ebb033 // -- // Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. // @@ -16,7 +16,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '7ae581ed6118efc338a137a9a4699e2ec1f87f03' +export const WebRPCSchemaHash = 'c4f41586d79b6d1fd4283fcb3da2527586ebb033' type WebrpcGenVersions = { webrpcGenVersion: string @@ -382,8 +382,10 @@ export interface GetIntentEntrypointDepositParams { deadline: number intentSignature: string usePermit?: boolean + permitAmount?: string permitDeadline?: number permitSignature?: string + feeAmount?: string } export interface GetIntentEntrypointDepositResult { @@ -400,6 +402,36 @@ export interface GetIntentEntrypointMessageHashParams { intentAddress: string chainID: number deadline: number + nonce: string +} + +export interface GetIntentEntrypointDepositFeeOptionsParams { + userAddress: string + tokenAddress: string + intentAddress: string + amount: string + chainID: number +} + +export interface GetIntentEntrypointDepositFeeOptionsResult { + gasEstimate: GasEstimate + feeOptions: Array + expiresAt: number +} + +export interface GasEstimate { + totalGas: number + gasPrice: string + nativeCost: string + nativeCostUSD: number +} + +export interface FeeOption { + tokenAddress: string + tokenSymbol: string + tokenDecimals: number + amount: string + amountUSD: number } export interface API { @@ -444,6 +476,14 @@ export interface API { headers?: object, signal?: AbortSignal ): Promise + /** + * Calculates fee options for intent entrypoint deposits. + */ + getIntentEntrypointDepositFeeOptions( + args: GetIntentEntrypointDepositFeeOptionsArgs, + headers?: object, + signal?: AbortSignal + ): Promise /** * Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. */ @@ -551,6 +591,13 @@ export interface GetIntentEntrypointDepositArgs { export interface GetIntentEntrypointDepositReturn { result: GetIntentEntrypointDepositResult } +export interface GetIntentEntrypointDepositFeeOptionsArgs { + params: GetIntentEntrypointDepositFeeOptionsParams +} + +export interface GetIntentEntrypointDepositFeeOptionsReturn { + result: GetIntentEntrypointDepositFeeOptionsResult +} export interface GetIntentEntrypointMessageHashArgs { params: GetIntentEntrypointMessageHashParams } @@ -805,6 +852,25 @@ export class API implements API { ) } + getIntentEntrypointDepositFeeOptions = ( + args: GetIntentEntrypointDepositFeeOptionsArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetIntentEntrypointDepositFeeOptions'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + result: _data.result + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) + } + ) + } + getIntentEntrypointMessageHash = ( args: GetIntentEntrypointMessageHashArgs, headers?: object, From 627d0d160523ef64c609b59f030c1f502b9f4386 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 21 Oct 2025 19:25:51 +0000 Subject: [PATCH 14/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 1080 +++++++++++---------- 1 file changed, 551 insertions(+), 529 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 21d31ce44..634e053e8 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,73 +1,133 @@ /* eslint-disable */ -// trails-api v0.4.0 c4f41586d79b6d1fd4283fcb3da2527586ebb033 +// trails-api v0.4.0 debf6c73d2e0a7dbf749261baedad6291eedafab // -- -// Code generated by webrpc-gen@v0.28.1 with typescript generator. DO NOT EDIT. +// Code generated by Webrpc-gen@v0.29.0 with typescript generator. DO NOT EDIT. // // webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/trails-api.gen.ts -export const WebrpcHeader = 'Webrpc' - -export const WebrpcHeaderValue = 'webrpc@v0.28.1;gen-typescript@v0.19.0;trails-api@v0.4.0' - -// WebRPC description and code-gen version -export const WebRPCVersion = 'v1' +// Webrpc description and code-gen version +export const WebrpcVersion = 'v1' // Schema version of your RIDL schema -export const WebRPCSchemaVersion = 'v0.4.0' +export const WebrpcSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = 'c4f41586d79b6d1fd4283fcb3da2527586ebb033' +export const WebrpcSchemaHash = 'debf6c73d2e0a7dbf749261baedad6291eedafab' -type WebrpcGenVersions = { - webrpcGenVersion: string - codeGenName: string - codeGenVersion: string - schemaName: string - schemaVersion: string -} +// +// Client interface +// -export function VersionFromHeader(headers: Headers): WebrpcGenVersions { - const headerValue = headers.get(WebrpcHeader) - if (!headerValue) { - return { - webrpcGenVersion: '', - codeGenName: '', - codeGenVersion: '', - schemaName: '', - schemaVersion: '' - } - } +export interface APIClient { + ping(headers?: object, signal?: AbortSignal): Promise - return parseWebrpcGenVersions(headerValue) -} + version(headers?: object, signal?: AbortSignal): Promise -function parseWebrpcGenVersions(header: string): WebrpcGenVersions { - const versions = header.split(';') - if (versions.length < 3) { - return { - webrpcGenVersion: '', - codeGenName: '', - codeGenVersion: '', - schemaName: '', - schemaVersion: '' - } - } + runtimeStatus(headers?: object, signal?: AbortSignal): Promise - const [_, webrpcGenVersion] = versions[0]!.split('@') - const [codeGenName, codeGenVersion] = versions[1]!.split('@') - const [schemaName, schemaVersion] = versions[2]!.split('@') + clock(headers?: object, signal?: AbortSignal): Promise - return { - webrpcGenVersion: webrpcGenVersion ?? '', - codeGenName: codeGenName ?? '', - codeGenVersion: codeGenVersion ?? '', - schemaName: schemaName ?? '', - schemaVersion: schemaVersion ?? '' - } + /** + * TODO: a lot of overlap with IntentConfig and other stuff.. + */ + executeIntent(req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise + + /** + * Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. + */ + getIntentCallsPayloads( + req: GetIntentCallsPayloadsRequest, + headers?: object, + signal?: AbortSignal + ): Promise + + getIntentsQuote(req: GetIntentsQuoteRequest, headers?: object, signal?: AbortSignal): Promise + + /** + * Persists intent configuration details to database for later execution, creating a new intent config record. + */ + commitIntentConfig(req: CommitIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise + + /** + * Retrieves stored intent configuration by wallet address for inspection or execution. + */ + getIntentConfig(req: GetIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise + + /** + * Intent transaction history endpoint + */ + getIntentTransactionHistory( + req: GetIntentTransactionHistoryRequest, + headers?: object, + signal?: AbortSignal + ): Promise + + /** + * Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. + */ + getIntentEntrypointDeposit( + req: GetIntentEntrypointDepositRequest, + headers?: object, + signal?: AbortSignal + ): Promise + + /** + * Calculates fee options for intent entrypoint deposits. + */ + getIntentEntrypointDepositFeeOptions( + req: GetIntentEntrypointDepositFeeOptionsRequest, + headers?: object, + signal?: AbortSignal + ): Promise + + /** + * Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. + */ + getIntentEntrypointMessageHash( + req: GetIntentEntrypointMessageHashRequest, + headers?: object, + signal?: AbortSignal + ): Promise + + getCCTPTransfer(req: GetCCTPTransferRequest, headers?: object, signal?: AbortSignal): Promise + + queueCCTPTransfer(req: QueueCCTPTransferRequest, headers?: object, signal?: AbortSignal): Promise + + /** + * Marks an intent config as ready for processing by the execution worker. + */ + queueIntentConfigExecution( + req: QueueIntentConfigExecutionRequest, + headers?: object, + signal?: AbortSignal + ): Promise + + /** + * Returns current execution status (pending/processing/executed/failed) for a given intent config. + */ + getIntentConfigExecutionStatus( + req: GetIntentConfigExecutionStatusRequest, + headers?: object, + signal?: AbortSignal + ): Promise + + /** + * Paginated listing of intent configs with optional execution status filtering. + */ + listIntentConfigs(req: ListIntentConfigsRequest, headers?: object, signal?: AbortSignal): Promise + + /** + * Processes relay transaction receipts to update intent execution status and trigger refund logic. + */ + queueMetaTxnReceipt( + req: QueueMetaTxnReceiptRequest, + headers?: object, + signal?: AbortSignal + ): Promise } // -// Types +// Schema types // export enum SortOrder { @@ -403,6 +463,8 @@ export interface GetIntentEntrypointMessageHashParams { chainID: number deadline: number nonce: string + feeAmount: string + feeCollector: string } export interface GetIntentEntrypointDepositFeeOptionsParams { @@ -417,6 +479,7 @@ export interface GetIntentEntrypointDepositFeeOptionsResult { gasEstimate: GasEstimate feeOptions: Array expiresAt: number + feeCollector: string } export interface GasEstimate { @@ -432,231 +495,165 @@ export interface FeeOption { tokenDecimals: number amount: string amountUSD: number + feeCollector: string } -export interface API { - ping(headers?: object, signal?: AbortSignal): Promise - version(headers?: object, signal?: AbortSignal): Promise - runtimeStatus(headers?: object, signal?: AbortSignal): Promise - clock(headers?: object, signal?: AbortSignal): Promise - /** - * TODO: a lot of overlap with IntentConfig and other stuff.. - */ - executeIntent(args: ExecuteIntentArgs, headers?: object, signal?: AbortSignal): Promise - /** - * Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. - */ - getIntentCallsPayloads( - args: GetIntentCallsPayloadsArgs, - headers?: object, - signal?: AbortSignal - ): Promise - getIntentsQuote(args: GetIntentsQuoteArgs, headers?: object, signal?: AbortSignal): Promise - /** - * Persists intent configuration details to database for later execution, creating a new intent config record. - */ - commitIntentConfig(args: CommitIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise - /** - * Retrieves stored intent configuration by wallet address for inspection or execution. - */ - getIntentConfig(args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise - /** - * Intent transaction history endpoint - */ - getIntentTransactionHistory( - args: GetIntentTransactionHistoryArgs, - headers?: object, - signal?: AbortSignal - ): Promise - /** - * Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. - */ - getIntentEntrypointDeposit( - args: GetIntentEntrypointDepositArgs, - headers?: object, - signal?: AbortSignal - ): Promise - /** - * Calculates fee options for intent entrypoint deposits. - */ - getIntentEntrypointDepositFeeOptions( - args: GetIntentEntrypointDepositFeeOptionsArgs, - headers?: object, - signal?: AbortSignal - ): Promise - /** - * Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. - */ - getIntentEntrypointMessageHash( - args: GetIntentEntrypointMessageHashArgs, - headers?: object, - signal?: AbortSignal - ): Promise - getCCTPTransfer(args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise - queueCCTPTransfer(args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise - /** - * Marks an intent config as ready for processing by the execution worker. - */ - queueIntentConfigExecution( - args: QueueIntentConfigExecutionArgs, - headers?: object, - signal?: AbortSignal - ): Promise - /** - * Returns current execution status (pending/processing/executed/failed) for a given intent config. - */ - getIntentConfigExecutionStatus( - args: GetIntentConfigExecutionStatusArgs, - headers?: object, - signal?: AbortSignal - ): Promise - /** - * Paginated listing of intent configs with optional execution status filtering. - */ - listIntentConfigs(args: ListIntentConfigsArgs, headers?: object, signal?: AbortSignal): Promise - /** - * Processes relay transaction receipts to update intent execution status and trigger refund logic. - */ - queueMetaTxnReceipt(args: QueueMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal): Promise -} +export interface PingRequest {} -export interface PingArgs {} - -export interface PingReturn { +export interface PingResponse { status: boolean } -export interface VersionArgs {} -export interface VersionReturn { +export interface VersionRequest {} + +export interface VersionResponse { version: Version } -export interface RuntimeStatusArgs {} -export interface RuntimeStatusReturn { +export interface RuntimeStatusRequest {} + +export interface RuntimeStatusResponse { status: RuntimeStatus } -export interface ClockArgs {} -export interface ClockReturn { +export interface ClockRequest {} + +export interface ClockResponse { serverTime: string } -export interface ExecuteIntentArgs { + +export interface ExecuteIntentRequest { intent: CommitIntentConfigParams } -export interface ExecuteIntentReturn { +export interface ExecuteIntentResponse { config: IntentConfig } -export interface GetIntentCallsPayloadsArgs { + +export interface GetIntentCallsPayloadsRequest { params: GetIntentCallsPayloadParams } -export interface GetIntentCallsPayloadsReturn { +export interface GetIntentCallsPayloadsResponse { payloads: IntentCallsPayloads } -export interface GetIntentsQuoteArgs { + +export interface GetIntentsQuoteRequest { params: GetIntentsQuoteParams } -export interface GetIntentsQuoteReturn { +export interface GetIntentsQuoteResponse { quote: IntentQuote } -export interface CommitIntentConfigArgs { + +export interface CommitIntentConfigRequest { params: CommitIntentConfigParams } -export interface CommitIntentConfigReturn { +export interface CommitIntentConfigResponse { config: IntentConfig } -export interface GetIntentConfigArgs { + +export interface GetIntentConfigRequest { intentAddress: string } -export interface GetIntentConfigReturn { +export interface GetIntentConfigResponse { config: IntentConfig } -export interface GetIntentTransactionHistoryArgs { + +export interface GetIntentTransactionHistoryRequest { accountAddress: string page?: Page } -export interface GetIntentTransactionHistoryReturn { +export interface GetIntentTransactionHistoryResponse { page: Page transactions: Array } -export interface GetIntentEntrypointDepositArgs { + +export interface GetIntentEntrypointDepositRequest { params: GetIntentEntrypointDepositParams } -export interface GetIntentEntrypointDepositReturn { +export interface GetIntentEntrypointDepositResponse { result: GetIntentEntrypointDepositResult } -export interface GetIntentEntrypointDepositFeeOptionsArgs { + +export interface GetIntentEntrypointDepositFeeOptionsRequest { params: GetIntentEntrypointDepositFeeOptionsParams } -export interface GetIntentEntrypointDepositFeeOptionsReturn { +export interface GetIntentEntrypointDepositFeeOptionsResponse { result: GetIntentEntrypointDepositFeeOptionsResult } -export interface GetIntentEntrypointMessageHashArgs { + +export interface GetIntentEntrypointMessageHashRequest { params: GetIntentEntrypointMessageHashParams } -export interface GetIntentEntrypointMessageHashReturn { +export interface GetIntentEntrypointMessageHashResponse { messageHash: string } -export interface GetCCTPTransferArgs { + +export interface GetCCTPTransferRequest { id: string } -export interface GetCCTPTransferReturn { +export interface GetCCTPTransferResponse { transfer: CCTPTransfer } -export interface QueueCCTPTransferArgs { + +export interface QueueCCTPTransferRequest { sourceTxHash?: string metaTxHash?: string sourceChainId: number destinationChainId: number } -export interface QueueCCTPTransferReturn { +export interface QueueCCTPTransferResponse { transfer: CCTPTransfer } -export interface QueueIntentConfigExecutionArgs { + +export interface QueueIntentConfigExecutionRequest { intentConfigId: number } -export interface QueueIntentConfigExecutionReturn { +export interface QueueIntentConfigExecutionResponse { status: boolean } -export interface GetIntentConfigExecutionStatusArgs { + +export interface GetIntentConfigExecutionStatusRequest { intentConfigId: number } -export interface GetIntentConfigExecutionStatusReturn { +export interface GetIntentConfigExecutionStatusResponse { executionStatus: string } -export interface ListIntentConfigsArgs { + +export interface ListIntentConfigsRequest { page?: Page executionStatus?: string } -export interface ListIntentConfigsReturn { +export interface ListIntentConfigsResponse { page: Page intentConfigs: Array } -export interface QueueMetaTxnReceiptArgs { + +export interface QueueMetaTxnReceiptRequest { metaTxID: string } -export interface QueueMetaTxnReceiptReturn { +export interface QueueMetaTxnReceiptResponse { status: boolean } // // Client // -export class API implements API { + +export class API implements APIClient { protected hostname: string protected fetch: Fetch protected path = '/rpc/API/' @@ -670,8 +667,8 @@ export class API implements API { return this.hostname + this.path + name } - ping = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then( + ping = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Ping'), createHttpRequest({}, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -685,8 +682,8 @@ export class API implements API { ) } - version = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then( + version = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Version'), createHttpRequest({}, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -700,8 +697,8 @@ export class API implements API { ) } - runtimeStatus = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then( + runtimeStatus = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('RuntimeStatus'), createHttpRequest({}, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -715,8 +712,8 @@ export class API implements API { ) } - clock = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('Clock'), createHTTPRequest({}, headers, signal)).then( + clock = (headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('Clock'), createHttpRequest({}, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -730,8 +727,8 @@ export class API implements API { ) } - executeIntent = (args: ExecuteIntentArgs, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('ExecuteIntent'), createHTTPRequest(args, headers, signal)).then( + executeIntent = (req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('ExecuteIntent'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -746,11 +743,11 @@ export class API implements API { } getIntentCallsPayloads = ( - args: GetIntentCallsPayloadsArgs, + req: GetIntentCallsPayloadsRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('GetIntentCallsPayloads'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('GetIntentCallsPayloads'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -764,8 +761,8 @@ export class API implements API { ) } - getIntentsQuote = (args: GetIntentsQuoteArgs, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('GetIntentsQuote'), createHTTPRequest(args, headers, signal)).then( + getIntentsQuote = (req: GetIntentsQuoteRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetIntentsQuote'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -780,11 +777,11 @@ export class API implements API { } commitIntentConfig = ( - args: CommitIntentConfigArgs, + req: CommitIntentConfigRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('CommitIntentConfig'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('CommitIntentConfig'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -798,8 +795,8 @@ export class API implements API { ) } - getIntentConfig = (args: GetIntentConfigArgs, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('GetIntentConfig'), createHTTPRequest(args, headers, signal)).then( + getIntentConfig = (req: GetIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetIntentConfig'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -814,11 +811,11 @@ export class API implements API { } getIntentTransactionHistory = ( - args: GetIntentTransactionHistoryArgs, + req: GetIntentTransactionHistoryRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('GetIntentTransactionHistory'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('GetIntentTransactionHistory'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -834,11 +831,11 @@ export class API implements API { } getIntentEntrypointDeposit = ( - args: GetIntentEntrypointDepositArgs, + req: GetIntentEntrypointDepositRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('GetIntentEntrypointDeposit'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('GetIntentEntrypointDeposit'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -853,11 +850,11 @@ export class API implements API { } getIntentEntrypointDepositFeeOptions = ( - args: GetIntentEntrypointDepositFeeOptionsArgs, + req: GetIntentEntrypointDepositFeeOptionsRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('GetIntentEntrypointDepositFeeOptions'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('GetIntentEntrypointDepositFeeOptions'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -872,11 +869,11 @@ export class API implements API { } getIntentEntrypointMessageHash = ( - args: GetIntentEntrypointMessageHashArgs, + req: GetIntentEntrypointMessageHashRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('GetIntentEntrypointMessageHash'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('GetIntentEntrypointMessageHash'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -890,8 +887,8 @@ export class API implements API { ) } - getCCTPTransfer = (args: GetCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('GetCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( + getCCTPTransfer = (req: GetCCTPTransferRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetCCTPTransfer'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -905,8 +902,12 @@ export class API implements API { ) } - queueCCTPTransfer = (args: QueueCCTPTransferArgs, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('QueueCCTPTransfer'), createHTTPRequest(args, headers, signal)).then( + queueCCTPTransfer = ( + req: QueueCCTPTransferRequest, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('QueueCCTPTransfer'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -921,11 +922,11 @@ export class API implements API { } queueIntentConfigExecution = ( - args: QueueIntentConfigExecutionArgs, + req: QueueIntentConfigExecutionRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('QueueIntentConfigExecution'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('QueueIntentConfigExecution'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -940,11 +941,11 @@ export class API implements API { } getIntentConfigExecutionStatus = ( - args: GetIntentConfigExecutionStatusArgs, + req: GetIntentConfigExecutionStatusRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('GetIntentConfigExecutionStatus'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('GetIntentConfigExecutionStatus'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -958,8 +959,12 @@ export class API implements API { ) } - listIntentConfigs = (args: ListIntentConfigsArgs, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('ListIntentConfigs'), createHTTPRequest(args, headers, signal)).then( + listIntentConfigs = ( + req: ListIntentConfigsRequest, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('ListIntentConfigs'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -975,11 +980,11 @@ export class API implements API { } queueMetaTxnReceipt = ( - args: QueueMetaTxnReceiptArgs, + req: QueueMetaTxnReceiptRequest, headers?: object, signal?: AbortSignal - ): Promise => { - return this.fetch(this.url('QueueMetaTxnReceipt'), createHTTPRequest(args, headers, signal)).then( + ): Promise => { + return this.fetch(this.url('QueueMetaTxnReceipt'), createHttpRequest(req, headers, signal)).then( res => { return buildResponse(res).then(_data => { return { @@ -994,9 +999,8 @@ export class API implements API { } } -const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => { +const createHttpRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => { const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json' } - reqHeaders[WebrpcHeader] = WebrpcHeaderValue return { method: 'POST', @@ -1025,10 +1029,14 @@ const buildResponse = (res: Response): Promise => { }) } +export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise + // // Errors // +type WebrpcErrorParams = { name?: string; code?: number; message?: string; status?: number; cause?: string } + export class WebrpcError extends Error { name: string code: number @@ -1036,493 +1044,453 @@ export class WebrpcError extends Error { status: number cause?: string - /** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */ - msg: string - - constructor(name: string, code: number, message: string, status: number, cause?: string) { - super(message) - this.name = name || 'WebrpcError' - this.code = typeof code === 'number' ? code : 0 - this.message = message || `endpoint error ${this.code}` - this.msg = this.message - this.status = typeof status === 'number' ? status : 0 - this.cause = cause + constructor(error: WebrpcErrorParams = {}) { + super(error.message) + this.name = error.name || 'WebrpcEndpointError' + this.code = typeof error.code === 'number' ? error.code : 0 + this.message = error.message || `endpoint error` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcError.prototype) } static new(payload: any): WebrpcError { - return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause) + return new this({ message: payload.message, code: payload.code, status: payload.status, cause: payload.cause }) } } -// Webrpc errors - export class WebrpcEndpointError extends WebrpcError { - constructor( - name: string = 'WebrpcEndpoint', - code: number = 0, - message: string = `endpoint error`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcEndpoint' + this.code = typeof error.code === 'number' ? error.code : 0 + this.message = error.message || `endpoint error` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcEndpointError.prototype) } } export class WebrpcRequestFailedError extends WebrpcError { - constructor( - name: string = 'WebrpcRequestFailed', - code: number = -1, - message: string = `request failed`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcRequestFailed' + this.code = typeof error.code === 'number' ? error.code : -1 + this.message = error.message || `request failed` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype) } } export class WebrpcBadRouteError extends WebrpcError { - constructor( - name: string = 'WebrpcBadRoute', - code: number = -2, - message: string = `bad route`, - status: number = 404, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcBadRoute' + this.code = typeof error.code === 'number' ? error.code : -2 + this.message = error.message || `bad route` + this.status = typeof error.status === 'number' ? error.status : 404 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcBadRouteError.prototype) } } export class WebrpcBadMethodError extends WebrpcError { - constructor( - name: string = 'WebrpcBadMethod', - code: number = -3, - message: string = `bad method`, - status: number = 405, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcBadMethod' + this.code = typeof error.code === 'number' ? error.code : -3 + this.message = error.message || `bad method` + this.status = typeof error.status === 'number' ? error.status : 405 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcBadMethodError.prototype) } } export class WebrpcBadRequestError extends WebrpcError { - constructor( - name: string = 'WebrpcBadRequest', - code: number = -4, - message: string = `bad request`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcBadRequest' + this.code = typeof error.code === 'number' ? error.code : -4 + this.message = error.message || `bad request` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcBadRequestError.prototype) } } export class WebrpcBadResponseError extends WebrpcError { - constructor( - name: string = 'WebrpcBadResponse', - code: number = -5, - message: string = `bad response`, - status: number = 500, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcBadResponse' + this.code = typeof error.code === 'number' ? error.code : -5 + this.message = error.message || `bad response` + this.status = typeof error.status === 'number' ? error.status : 500 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcBadResponseError.prototype) } } export class WebrpcServerPanicError extends WebrpcError { - constructor( - name: string = 'WebrpcServerPanic', - code: number = -6, - message: string = `server panic`, - status: number = 500, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcServerPanic' + this.code = typeof error.code === 'number' ? error.code : -6 + this.message = error.message || `server panic` + this.status = typeof error.status === 'number' ? error.status : 500 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcServerPanicError.prototype) } } export class WebrpcInternalErrorError extends WebrpcError { - constructor( - name: string = 'WebrpcInternalError', - code: number = -7, - message: string = `internal error`, - status: number = 500, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcInternalError' + this.code = typeof error.code === 'number' ? error.code : -7 + this.message = error.message || `internal error` + this.status = typeof error.status === 'number' ? error.status : 500 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype) } } export class WebrpcClientAbortedError extends WebrpcError { - constructor( - name: string = 'WebrpcClientAborted', - code: number = -8, - message: string = `request aborted by client`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcClientAborted' + this.code = typeof error.code === 'number' ? error.code : -8 + this.message = error.message || `request aborted by client` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcClientAbortedError.prototype) } } export class WebrpcStreamLostError extends WebrpcError { - constructor( - name: string = 'WebrpcStreamLost', - code: number = -9, - message: string = `stream lost`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcStreamLost' + this.code = typeof error.code === 'number' ? error.code : -9 + this.message = error.message || `stream lost` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcStreamLostError.prototype) } } export class WebrpcStreamFinishedError extends WebrpcError { - constructor( - name: string = 'WebrpcStreamFinished', - code: number = -10, - message: string = `stream finished`, - status: number = 200, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'WebrpcStreamFinished' + this.code = typeof error.code === 'number' ? error.code : -10 + this.message = error.message || `stream finished` + this.status = typeof error.status === 'number' ? error.status : 200 + this.cause = error.cause Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype) } } +// // Schema errors +// export class UnauthorizedError extends WebrpcError { - constructor( - name: string = 'Unauthorized', - code: number = 1000, - message: string = `Unauthorized access`, - status: number = 401, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'Unauthorized' + this.code = typeof error.code === 'number' ? error.code : 1000 + this.message = error.message || `Unauthorized access` + this.status = typeof error.status === 'number' ? error.status : 401 + this.cause = error.cause Object.setPrototypeOf(this, UnauthorizedError.prototype) } } export class PermissionDeniedError extends WebrpcError { - constructor( - name: string = 'PermissionDenied', - code: number = 1001, - message: string = `Permission denied`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'PermissionDenied' + this.code = typeof error.code === 'number' ? error.code : 1001 + this.message = error.message || `Permission denied` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, PermissionDeniedError.prototype) } } export class SessionExpiredError extends WebrpcError { - constructor( - name: string = 'SessionExpired', - code: number = 1002, - message: string = `Session expired`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'SessionExpired' + this.code = typeof error.code === 'number' ? error.code : 1002 + this.message = error.message || `Session expired` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, SessionExpiredError.prototype) } } export class MethodNotFoundError extends WebrpcError { - constructor( - name: string = 'MethodNotFound', - code: number = 1003, - message: string = `Method not found`, - status: number = 404, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'MethodNotFound' + this.code = typeof error.code === 'number' ? error.code : 1003 + this.message = error.message || `Method not found` + this.status = typeof error.status === 'number' ? error.status : 404 + this.cause = error.cause Object.setPrototypeOf(this, MethodNotFoundError.prototype) } } export class RequestConflictError extends WebrpcError { - constructor( - name: string = 'RequestConflict', - code: number = 1004, - message: string = `Conflict with target resource`, - status: number = 409, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'RequestConflict' + this.code = typeof error.code === 'number' ? error.code : 1004 + this.message = error.message || `Conflict with target resource` + this.status = typeof error.status === 'number' ? error.status : 409 + this.cause = error.cause Object.setPrototypeOf(this, RequestConflictError.prototype) } } export class AbortedError extends WebrpcError { - constructor( - name: string = 'Aborted', - code: number = 1005, - message: string = `Request aborted`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'Aborted' + this.code = typeof error.code === 'number' ? error.code : 1005 + this.message = error.message || `Request aborted` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, AbortedError.prototype) } } export class GeoblockedError extends WebrpcError { - constructor( - name: string = 'Geoblocked', - code: number = 1006, - message: string = `Geoblocked region`, - status: number = 451, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'Geoblocked' + this.code = typeof error.code === 'number' ? error.code : 1006 + this.message = error.message || `Geoblocked region` + this.status = typeof error.status === 'number' ? error.status : 451 + this.cause = error.cause Object.setPrototypeOf(this, GeoblockedError.prototype) } } export class RateLimitedError extends WebrpcError { - constructor( - name: string = 'RateLimited', - code: number = 1007, - message: string = `Rate-limited. Please slow down.`, - status: number = 429, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'RateLimited' + this.code = typeof error.code === 'number' ? error.code : 1007 + this.message = error.message || `Rate-limited. Please slow down.` + this.status = typeof error.status === 'number' ? error.status : 429 + this.cause = error.cause Object.setPrototypeOf(this, RateLimitedError.prototype) } } export class ProjectNotFoundError extends WebrpcError { - constructor( - name: string = 'ProjectNotFound', - code: number = 1008, - message: string = `Project not found`, - status: number = 401, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'ProjectNotFound' + this.code = typeof error.code === 'number' ? error.code : 1008 + this.message = error.message || `Project not found` + this.status = typeof error.status === 'number' ? error.status : 401 + this.cause = error.cause Object.setPrototypeOf(this, ProjectNotFoundError.prototype) } } export class AccessKeyNotFoundError extends WebrpcError { - constructor( - name: string = 'AccessKeyNotFound', - code: number = 1101, - message: string = `Access key not found`, - status: number = 401, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'AccessKeyNotFound' + this.code = typeof error.code === 'number' ? error.code : 1101 + this.message = error.message || `Access key not found` + this.status = typeof error.status === 'number' ? error.status : 401 + this.cause = error.cause Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype) } } export class AccessKeyMismatchError extends WebrpcError { - constructor( - name: string = 'AccessKeyMismatch', - code: number = 1102, - message: string = `Access key mismatch`, - status: number = 409, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'AccessKeyMismatch' + this.code = typeof error.code === 'number' ? error.code : 1102 + this.message = error.message || `Access key mismatch` + this.status = typeof error.status === 'number' ? error.status : 409 + this.cause = error.cause Object.setPrototypeOf(this, AccessKeyMismatchError.prototype) } } export class InvalidOriginError extends WebrpcError { - constructor( - name: string = 'InvalidOrigin', - code: number = 1103, - message: string = `Invalid origin for Access Key`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'InvalidOrigin' + this.code = typeof error.code === 'number' ? error.code : 1103 + this.message = error.message || `Invalid origin for Access Key` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, InvalidOriginError.prototype) } } export class InvalidServiceError extends WebrpcError { - constructor( - name: string = 'InvalidService', - code: number = 1104, - message: string = `Service not enabled for Access key`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'InvalidService' + this.code = typeof error.code === 'number' ? error.code : 1104 + this.message = error.message || `Service not enabled for Access key` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, InvalidServiceError.prototype) } } export class UnauthorizedUserError extends WebrpcError { - constructor( - name: string = 'UnauthorizedUser', - code: number = 1105, - message: string = `Unauthorized user`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'UnauthorizedUser' + this.code = typeof error.code === 'number' ? error.code : 1105 + this.message = error.message || `Unauthorized user` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, UnauthorizedUserError.prototype) } } export class QuotaExceededError extends WebrpcError { - constructor( - name: string = 'QuotaExceeded', - code: number = 1200, - message: string = `Quota request exceeded`, - status: number = 429, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'QuotaExceeded' + this.code = typeof error.code === 'number' ? error.code : 1200 + this.message = error.message || `Quota request exceeded` + this.status = typeof error.status === 'number' ? error.status : 429 + this.cause = error.cause Object.setPrototypeOf(this, QuotaExceededError.prototype) } } export class QuotaRateLimitError extends WebrpcError { - constructor( - name: string = 'QuotaRateLimit', - code: number = 1201, - message: string = `Quota rate limit exceeded`, - status: number = 429, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'QuotaRateLimit' + this.code = typeof error.code === 'number' ? error.code : 1201 + this.message = error.message || `Quota rate limit exceeded` + this.status = typeof error.status === 'number' ? error.status : 429 + this.cause = error.cause Object.setPrototypeOf(this, QuotaRateLimitError.prototype) } } export class NoDefaultKeyError extends WebrpcError { - constructor( - name: string = 'NoDefaultKey', - code: number = 1300, - message: string = `No default access key found`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'NoDefaultKey' + this.code = typeof error.code === 'number' ? error.code : 1300 + this.message = error.message || `No default access key found` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, NoDefaultKeyError.prototype) } } export class MaxAccessKeysError extends WebrpcError { - constructor( - name: string = 'MaxAccessKeys', - code: number = 1301, - message: string = `Access keys limit reached`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'MaxAccessKeys' + this.code = typeof error.code === 'number' ? error.code : 1301 + this.message = error.message || `Access keys limit reached` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, MaxAccessKeysError.prototype) } } export class AtLeastOneKeyError extends WebrpcError { - constructor( - name: string = 'AtLeastOneKey', - code: number = 1302, - message: string = `You need at least one Access Key`, - status: number = 403, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'AtLeastOneKey' + this.code = typeof error.code === 'number' ? error.code : 1302 + this.message = error.message || `You need at least one Access Key` + this.status = typeof error.status === 'number' ? error.status : 403 + this.cause = error.cause Object.setPrototypeOf(this, AtLeastOneKeyError.prototype) } } export class TimeoutError extends WebrpcError { - constructor( - name: string = 'Timeout', - code: number = 1900, - message: string = `Request timed out`, - status: number = 408, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'Timeout' + this.code = typeof error.code === 'number' ? error.code : 1900 + this.message = error.message || `Request timed out` + this.status = typeof error.status === 'number' ? error.status : 408 + this.cause = error.cause Object.setPrototypeOf(this, TimeoutError.prototype) } } export class InvalidArgumentError extends WebrpcError { - constructor( - name: string = 'InvalidArgument', - code: number = 2000, - message: string = `Invalid argument`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'InvalidArgument' + this.code = typeof error.code === 'number' ? error.code : 2000 + this.message = error.message || `Invalid argument` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, InvalidArgumentError.prototype) } } export class UnavailableError extends WebrpcError { - constructor( - name: string = 'Unavailable', - code: number = 2002, - message: string = `Unavailable resource`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'Unavailable' + this.code = typeof error.code === 'number' ? error.code : 2002 + this.message = error.message || `Unavailable resource` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, UnavailableError.prototype) } } export class QueryFailedError extends WebrpcError { - constructor( - name: string = 'QueryFailed', - code: number = 2003, - message: string = `Query failed`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'QueryFailed' + this.code = typeof error.code === 'number' ? error.code : 2003 + this.message = error.message || `Query failed` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, QueryFailedError.prototype) } } export class NotFoundError extends WebrpcError { - constructor( - name: string = 'NotFound', - code: number = 8000, - message: string = `Resource not found`, - status: number = 400, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'NotFound' + this.code = typeof error.code === 'number' ? error.code : 8000 + this.message = error.message || `Resource not found` + this.status = typeof error.status === 'number' ? error.status : 400 + this.cause = error.cause Object.setPrototypeOf(this, NotFoundError.prototype) } } export class UnsupportedNetworkError extends WebrpcError { - constructor( - name: string = 'UnsupportedNetwork', - code: number = 8008, - message: string = `Unsupported network`, - status: number = 422, - cause?: string - ) { - super(name, code, message, status, cause) + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'UnsupportedNetwork' + this.code = typeof error.code === 'number' ? error.code : 8008 + this.message = error.message || `Unsupported network` + this.status = typeof error.status === 'number' ? error.status : 422 + this.cause = error.cause Object.setPrototypeOf(this, UnsupportedNetworkError.prototype) } } @@ -1644,4 +1612,58 @@ export const webrpcErrorByCode: { [code: number]: any } = { [8008]: UnsupportedNetworkError } -export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise +// +// Webrpc +// + +export const WebrpcHeader = 'Webrpc' + +export const WebrpcHeaderValue = 'webrpc@v0.29.0;gen-typescript@v0.20.2;trails-api@v0.4.0' + +type WebrpcGenVersions = { + WebrpcGenVersion: string + codeGenName: string + codeGenVersion: string + schemaName: string + schemaVersion: string +} + +export function VersionFromHeader(headers: Headers): WebrpcGenVersions { + const headerValue = headers.get(WebrpcHeader) + if (!headerValue) { + return { + WebrpcGenVersion: '', + codeGenName: '', + codeGenVersion: '', + schemaName: '', + schemaVersion: '' + } + } + + return parseWebrpcGenVersions(headerValue) +} + +function parseWebrpcGenVersions(header: string): WebrpcGenVersions { + const versions = header.split(';') + if (versions.length < 3) { + return { + WebrpcGenVersion: '', + codeGenName: '', + codeGenVersion: '', + schemaName: '', + schemaVersion: '' + } + } + + const [_, WebrpcGenVersion] = versions[0]!.split('@') + const [codeGenName, codeGenVersion] = versions[1]!.split('@') + const [schemaName, schemaVersion] = versions[2]!.split('@') + + return { + WebrpcGenVersion: WebrpcGenVersion ?? '', + codeGenName: codeGenName ?? '', + codeGenVersion: codeGenVersion ?? '', + schemaName: schemaName ?? '', + schemaVersion: schemaVersion ?? '' + } +} From b1d2781b4ed13f1deb770fa66b7f46bdd22eff98 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:24:12 +0000 Subject: [PATCH 15/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 634e053e8..12bb107f0 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 debf6c73d2e0a7dbf749261baedad6291eedafab +// trails-api v0.4.0 30a311cd323c194a46ebd96b217d6b6be1007672 // -- // Code generated by Webrpc-gen@v0.29.0 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'debf6c73d2e0a7dbf749261baedad6291eedafab' +export const WebrpcSchemaHash = '30a311cd323c194a46ebd96b217d6b6be1007672' // // Client interface @@ -130,6 +130,14 @@ export interface APIClient { // Schema types // +export enum ExecutionStatus { + created = 'created', + pending = 'pending', + processing = 'processing', + executed = 'executed', + failed = 'failed' +} + export enum SortOrder { DESC = 'DESC', ASC = 'ASC' @@ -189,9 +197,11 @@ export interface IntentConfig { mainSigner: string calls: Array preconditions: Array - executionStatus?: string + executionStatus: ExecutionStatus metaTxnId?: string txnHash?: string + processedAt?: string + retryCount: number updatedAt?: string createdAt?: string } @@ -202,7 +212,7 @@ export interface IntentTransaction { mainSigner: string metaTxnId?: string txnHash?: string - executionStatus?: string + executionStatus: ExecutionStatus originChainId?: number destinationChainId?: number originTokenAddress?: string From 3aca32014e1c39a52e48d54d426bde4008447227 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 23 Oct 2025 22:14:19 +0000 Subject: [PATCH 16/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 12bb107f0..78722bbc4 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 30a311cd323c194a46ebd96b217d6b6be1007672 +// trails-api v0.4.0 1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648 // -- // Code generated by Webrpc-gen@v0.29.0 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '30a311cd323c194a46ebd96b217d6b6be1007672' +export const WebrpcSchemaHash = '1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648' // // Client interface @@ -162,6 +162,7 @@ export interface RuntimeStatus { ver: string branch: string commitHash: string + runnables: any } export interface MetaTxn { From c72866790834b6fe489c88ce3897ac3290503895 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 24 Oct 2025 01:40:04 +0000 Subject: [PATCH 17/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 316 +++++++++++++--------- 1 file changed, 186 insertions(+), 130 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 78722bbc4..c384d4462 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,7 +1,7 @@ /* eslint-disable */ -// trails-api v0.4.0 1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648 +// trails-api v0.4.0 36e1205943d9f99bcfd7d279a67514ac8869ec84 // -- -// Code generated by Webrpc-gen@v0.29.0 with typescript generator. DO NOT EDIT. +// Code generated by Webrpc-gen@v0.30.1 with typescript generator. DO NOT EDIT. // // webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/trails-api.gen.ts @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '1f8ef0bd3ab5a1f717035e46d67de5abb2fbc648' +export const WebrpcSchemaHash = '36e1205943d9f99bcfd7d279a67514ac8869ec84' // // Client interface @@ -34,6 +34,7 @@ export interface APIClient { /** * Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. + * TODOXXX: rename to SolveIntent */ getIntentCallsPayloads( req: GetIntentCallsPayloadsRequest, @@ -41,19 +42,25 @@ export interface APIClient { signal?: AbortSignal ): Promise + /** + * TODOXXX: remove + */ getIntentsQuote(req: GetIntentsQuoteRequest, headers?: object, signal?: AbortSignal): Promise /** + * TODOXXX: ExecuteIntent * Persists intent configuration details to database for later execution, creating a new intent config record. */ commitIntentConfig(req: CommitIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise /** + * TODOXXX: GetIntentDetails .. or another name..? * Retrieves stored intent configuration by wallet address for inspection or execution. */ getIntentConfig(req: GetIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise /** + * TODOXXX: keep the name! * Intent transaction history endpoint */ getIntentTransactionHistory( @@ -63,6 +70,7 @@ export interface APIClient { ): Promise /** + * TODOXXX: rename to GetIntentEntryTransaction * Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. */ getIntentEntrypointDeposit( @@ -72,6 +80,7 @@ export interface APIClient { ): Promise /** + * TODOXXX: rename to GetIntentGasFeeOptions * Calculates fee options for intent entrypoint deposits. */ getIntentEntrypointDepositFeeOptions( @@ -81,6 +90,7 @@ export interface APIClient { ): Promise /** + * TODOXXX: remove completely * Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. */ getIntentEntrypointMessageHash( @@ -148,6 +158,14 @@ export enum TradeType { EXACT_OUTPUT = 'EXACT_OUTPUT' } +export interface Transaction { + todo: string +} + +export interface IntentReceipt { + todo: string +} + export interface Version { webrpcVersion: string schemaVersion: string @@ -678,13 +696,37 @@ export class API implements APIClient { return this.hostname + this.path + name } + queryKey = { + ping: () => ['API', 'ping'] as const, + version: () => ['API', 'version'] as const, + runtimeStatus: () => ['API', 'runtimeStatus'] as const, + clock: () => ['API', 'clock'] as const, + executeIntent: (req: ExecuteIntentRequest) => ['API', 'executeIntent', req] as const, + getIntentCallsPayloads: (req: GetIntentCallsPayloadsRequest) => ['API', 'getIntentCallsPayloads', req] as const, + getIntentsQuote: (req: GetIntentsQuoteRequest) => ['API', 'getIntentsQuote', req] as const, + commitIntentConfig: (req: CommitIntentConfigRequest) => ['API', 'commitIntentConfig', req] as const, + getIntentConfig: (req: GetIntentConfigRequest) => ['API', 'getIntentConfig', req] as const, + getIntentTransactionHistory: (req: GetIntentTransactionHistoryRequest) => + ['API', 'getIntentTransactionHistory', req] as const, + getIntentEntrypointDeposit: (req: GetIntentEntrypointDepositRequest) => ['API', 'getIntentEntrypointDeposit', req] as const, + getIntentEntrypointDepositFeeOptions: (req: GetIntentEntrypointDepositFeeOptionsRequest) => + ['API', 'getIntentEntrypointDepositFeeOptions', req] as const, + getIntentEntrypointMessageHash: (req: GetIntentEntrypointMessageHashRequest) => + ['API', 'getIntentEntrypointMessageHash', req] as const, + getCCTPTransfer: (req: GetCCTPTransferRequest) => ['API', 'getCCTPTransfer', req] as const, + queueCCTPTransfer: (req: QueueCCTPTransferRequest) => ['API', 'queueCCTPTransfer', req] as const, + queueIntentConfigExecution: (req: QueueIntentConfigExecutionRequest) => ['API', 'queueIntentConfigExecution', req] as const, + getIntentConfigExecutionStatus: (req: GetIntentConfigExecutionStatusRequest) => + ['API', 'getIntentConfigExecutionStatus', req] as const, + listIntentConfigs: (req: ListIntentConfigsRequest) => ['API', 'listIntentConfigs', req] as const, + queueMetaTxnReceipt: (req: QueueMetaTxnReceiptRequest) => ['API', 'queueMetaTxnReceipt', req] as const + } + ping = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('Ping'), createHttpRequest({}, headers, signal)).then( + return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then( res => { return buildResponse(res).then(_data => { - return { - status: _data.status - } + return JsonDecode(_data, 'PingResponse') }) }, error => { @@ -694,12 +736,10 @@ export class API implements APIClient { } version = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('Version'), createHttpRequest({}, headers, signal)).then( + return this.fetch(this.url('Version'), createHttpRequest('{}', headers, signal)).then( res => { return buildResponse(res).then(_data => { - return { - version: _data.version - } + return JsonDecode(_data, 'VersionResponse') }) }, error => { @@ -709,12 +749,10 @@ export class API implements APIClient { } runtimeStatus = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('RuntimeStatus'), createHttpRequest({}, headers, signal)).then( + return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then( res => { return buildResponse(res).then(_data => { - return { - status: _data.status - } + return JsonDecode(_data, 'RuntimeStatusResponse') }) }, error => { @@ -724,12 +762,10 @@ export class API implements APIClient { } clock = (headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('Clock'), createHttpRequest({}, headers, signal)).then( + return this.fetch(this.url('Clock'), createHttpRequest('{}', headers, signal)).then( res => { return buildResponse(res).then(_data => { - return { - serverTime: _data.serverTime - } + return JsonDecode(_data, 'ClockResponse') }) }, error => { @@ -739,12 +775,13 @@ export class API implements APIClient { } executeIntent = (req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('ExecuteIntent'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('ExecuteIntent'), + createHttpRequest(JsonEncode(req, 'ExecuteIntentRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - config: _data.config - } + return JsonDecode(_data, 'ExecuteIntentResponse') }) }, error => { @@ -758,12 +795,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('GetIntentCallsPayloads'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentCallsPayloads'), + createHttpRequest(JsonEncode(req, 'GetIntentCallsPayloadsRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - payloads: _data.payloads - } + return JsonDecode(_data, 'GetIntentCallsPayloadsResponse') }) }, error => { @@ -773,12 +811,13 @@ export class API implements APIClient { } getIntentsQuote = (req: GetIntentsQuoteRequest, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('GetIntentsQuote'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentsQuote'), + createHttpRequest(JsonEncode(req, 'GetIntentsQuoteRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - quote: _data.quote - } + return JsonDecode(_data, 'GetIntentsQuoteResponse') }) }, error => { @@ -792,12 +831,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('CommitIntentConfig'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('CommitIntentConfig'), + createHttpRequest(JsonEncode(req, 'CommitIntentConfigRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - config: _data.config - } + return JsonDecode(_data, 'CommitIntentConfigResponse') }) }, error => { @@ -807,12 +847,13 @@ export class API implements APIClient { } getIntentConfig = (req: GetIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('GetIntentConfig'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentConfig'), + createHttpRequest(JsonEncode(req, 'GetIntentConfigRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - config: _data.config - } + return JsonDecode(_data, 'GetIntentConfigResponse') }) }, error => { @@ -826,13 +867,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('GetIntentTransactionHistory'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentTransactionHistory'), + createHttpRequest(JsonEncode(req, 'GetIntentTransactionHistoryRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - page: _data.page, - transactions: >_data.transactions - } + return JsonDecode(_data, 'GetIntentTransactionHistoryResponse') }) }, error => { @@ -846,12 +887,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('GetIntentEntrypointDeposit'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentEntrypointDeposit'), + createHttpRequest(JsonEncode(req, 'GetIntentEntrypointDepositRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - result: _data.result - } + return JsonDecode(_data, 'GetIntentEntrypointDepositResponse') }) }, error => { @@ -865,12 +907,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('GetIntentEntrypointDepositFeeOptions'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentEntrypointDepositFeeOptions'), + createHttpRequest(JsonEncode(req, 'GetIntentEntrypointDepositFeeOptionsRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - result: _data.result - } + return JsonDecode(_data, 'GetIntentEntrypointDepositFeeOptionsResponse') }) }, error => { @@ -884,12 +927,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('GetIntentEntrypointMessageHash'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentEntrypointMessageHash'), + createHttpRequest(JsonEncode(req, 'GetIntentEntrypointMessageHashRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - messageHash: _data.messageHash - } + return JsonDecode(_data, 'GetIntentEntrypointMessageHashResponse') }) }, error => { @@ -899,12 +943,13 @@ export class API implements APIClient { } getCCTPTransfer = (req: GetCCTPTransferRequest, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch(this.url('GetCCTPTransfer'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetCCTPTransfer'), + createHttpRequest(JsonEncode(req, 'GetCCTPTransferRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - transfer: _data.transfer - } + return JsonDecode(_data, 'GetCCTPTransferResponse') }) }, error => { @@ -918,12 +963,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('QueueCCTPTransfer'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('QueueCCTPTransfer'), + createHttpRequest(JsonEncode(req, 'QueueCCTPTransferRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - transfer: _data.transfer - } + return JsonDecode(_data, 'QueueCCTPTransferResponse') }) }, error => { @@ -937,12 +983,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('QueueIntentConfigExecution'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('QueueIntentConfigExecution'), + createHttpRequest(JsonEncode(req, 'QueueIntentConfigExecutionRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - status: _data.status - } + return JsonDecode(_data, 'QueueIntentConfigExecutionResponse') }) }, error => { @@ -956,12 +1003,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('GetIntentConfigExecutionStatus'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('GetIntentConfigExecutionStatus'), + createHttpRequest(JsonEncode(req, 'GetIntentConfigExecutionStatusRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - executionStatus: _data.executionStatus - } + return JsonDecode(_data, 'GetIntentConfigExecutionStatusResponse') }) }, error => { @@ -975,13 +1023,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('ListIntentConfigs'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('ListIntentConfigs'), + createHttpRequest(JsonEncode(req, 'ListIntentConfigsRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - page: _data.page, - intentConfigs: >_data.intentConfigs - } + return JsonDecode(_data, 'ListIntentConfigsResponse') }) }, error => { @@ -995,12 +1043,13 @@ export class API implements APIClient { headers?: object, signal?: AbortSignal ): Promise => { - return this.fetch(this.url('QueueMetaTxnReceipt'), createHttpRequest(req, headers, signal)).then( + return this.fetch( + this.url('QueueMetaTxnReceipt'), + createHttpRequest(JsonEncode(req, 'QueueMetaTxnReceiptRequest'), headers, signal) + ).then( res => { return buildResponse(res).then(_data => { - return { - status: _data.status - } + return JsonDecode(_data, 'QueueMetaTxnReceiptResponse') }) }, error => { @@ -1010,15 +1059,9 @@ export class API implements APIClient { } } -const createHttpRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => { +const createHttpRequest = (body: string = '{}', headers: object = {}, signal: AbortSignal | null = null): object => { const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json' } - - return { - method: 'POST', - headers: reqHeaders, - body: JSON.stringify(body || {}), - signal - } + return { method: 'POST', headers: reqHeaders, body, signal } } const buildResponse = (res: Response): Promise => { @@ -1042,6 +1085,22 @@ const buildResponse = (res: Response): Promise => { export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise +export const JsonEncode = (obj: T, _typ: string = ''): string => { + return JSON.stringify(obj) +} + +export const JsonDecode = (data: string | any, _typ: string = ''): T => { + let parsed: any = data + if (typeof data === 'string') { + try { + parsed = JSON.parse(data) + } catch (err) { + throw WebrpcBadResponseError.new({ cause: `JsonDecode: JSON.parse failed: ${(err as Error).message}` }) + } + } + return parsed as T +} + // // Errors // @@ -1049,11 +1108,8 @@ export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise Date: Mon, 27 Oct 2025 13:47:40 +0000 Subject: [PATCH 18/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index c384d4462..48319086c 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 36e1205943d9f99bcfd7d279a67514ac8869ec84 +// trails-api v0.4.0 563242406b1457bb583d99d0c76c9e75e3f3b3f3 // -- // Code generated by Webrpc-gen@v0.30.1 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '36e1205943d9f99bcfd7d279a67514ac8869ec84' +export const WebrpcSchemaHash = '563242406b1457bb583d99d0c76c9e75e3f3b3f3' // // Client interface @@ -209,7 +209,7 @@ export interface IntentCallsPayload { } export interface IntentConfig { - id: number + intentId: string configHash: string originIntentAddress: string destinationIntentAddress: string @@ -217,8 +217,10 @@ export interface IntentConfig { calls: Array preconditions: Array executionStatus: ExecutionStatus - metaTxnId?: string - txnHash?: string + originMetaTxnId?: string + destinationMetaTxnId?: string + originTxnHash?: string + destinationTxnHash?: string processedAt?: string retryCount: number updatedAt?: string @@ -229,8 +231,10 @@ export interface IntentTransaction { originIntentAddress: string destinationIntentAddress: string mainSigner: string - metaTxnId?: string - txnHash?: string + originMetaTxnId?: string + destinationMetaTxnId?: string + originTxnHash?: string + destinationTxnHash?: string executionStatus: ExecutionStatus originChainId?: number destinationChainId?: number @@ -645,7 +649,7 @@ export interface QueueCCTPTransferResponse { } export interface QueueIntentConfigExecutionRequest { - intentConfigId: number + intentConfigId: string } export interface QueueIntentConfigExecutionResponse { @@ -653,7 +657,7 @@ export interface QueueIntentConfigExecutionResponse { } export interface GetIntentConfigExecutionStatusRequest { - intentConfigId: number + intentConfigId: string } export interface GetIntentConfigExecutionStatusResponse { From 95f5f5f3f0a700da1f2aa812fe77e3b43e1b31ff Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 28 Oct 2025 00:10:34 +0000 Subject: [PATCH 19/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 42 ++--------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 48319086c..dbd8c6fde 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v0.4.0 563242406b1457bb583d99d0c76c9e75e3f3b3f3 +// trails-api v0.4.0 983d4771af81d7ad7880e614060edf7a542f0ddd // -- // Code generated by Webrpc-gen@v0.30.1 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v0.4.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '563242406b1457bb583d99d0c76c9e75e3f3b3f3' +export const WebrpcSchemaHash = '983d4771af81d7ad7880e614060edf7a542f0ddd' // // Client interface @@ -27,11 +27,6 @@ export interface APIClient { clock(headers?: object, signal?: AbortSignal): Promise - /** - * TODO: a lot of overlap with IntentConfig and other stuff.. - */ - executeIntent(req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise - /** * Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. * TODOXXX: rename to SolveIntent @@ -158,14 +153,6 @@ export enum TradeType { EXACT_OUTPUT = 'EXACT_OUTPUT' } -export interface Transaction { - todo: string -} - -export interface IntentReceipt { - todo: string -} - export interface Version { webrpcVersion: string schemaVersion: string @@ -555,14 +542,6 @@ export interface ClockResponse { serverTime: string } -export interface ExecuteIntentRequest { - intent: CommitIntentConfigParams -} - -export interface ExecuteIntentResponse { - config: IntentConfig -} - export interface GetIntentCallsPayloadsRequest { params: GetIntentCallsPayloadParams } @@ -705,7 +684,6 @@ export class API implements APIClient { version: () => ['API', 'version'] as const, runtimeStatus: () => ['API', 'runtimeStatus'] as const, clock: () => ['API', 'clock'] as const, - executeIntent: (req: ExecuteIntentRequest) => ['API', 'executeIntent', req] as const, getIntentCallsPayloads: (req: GetIntentCallsPayloadsRequest) => ['API', 'getIntentCallsPayloads', req] as const, getIntentsQuote: (req: GetIntentsQuoteRequest) => ['API', 'getIntentsQuote', req] as const, commitIntentConfig: (req: CommitIntentConfigRequest) => ['API', 'commitIntentConfig', req] as const, @@ -778,22 +756,6 @@ export class API implements APIClient { ) } - executeIntent = (req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch( - this.url('ExecuteIntent'), - createHttpRequest(JsonEncode(req, 'ExecuteIntentRequest'), headers, signal) - ).then( - res => { - return buildResponse(res).then(_data => { - return JsonDecode(_data, 'ExecuteIntentResponse') - }) - }, - error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) - } - ) - } - getIntentCallsPayloads = ( req: GetIntentCallsPayloadsRequest, headers?: object, From 040d4f9038f0cbe050a9642ba360b7c979ad7e82 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 29 Oct 2025 20:24:25 +0000 Subject: [PATCH 20/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 1110 +++++++++------------ 1 file changed, 496 insertions(+), 614 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index dbd8c6fde..3067874d3 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,24 +1,24 @@ /* eslint-disable */ -// trails-api v0.4.0 983d4771af81d7ad7880e614060edf7a542f0ddd +// trails-api v1.0.0 d77c84a0d98b34c7e6d3a9810cc8819aee40b978 // -- -// Code generated by Webrpc-gen@v0.30.1 with typescript generator. DO NOT EDIT. +// Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // -// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/trails-api.gen.ts +// webrpc-gen -schema=trails-api.ridl -target=typescript -client -out=./clients/trails-api.gen.ts // Webrpc description and code-gen version export const WebrpcVersion = 'v1' // Schema version of your RIDL schema -export const WebrpcSchemaVersion = 'v0.4.0' +export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '983d4771af81d7ad7880e614060edf7a542f0ddd' +export const WebrpcSchemaHash = 'd77c84a0d98b34c7e6d3a9810cc8819aee40b978' // // Client interface // -export interface APIClient { +export interface TrailsClient { ping(headers?: object, signal?: AbortSignal): Promise version(headers?: object, signal?: AbortSignal): Promise @@ -27,237 +27,135 @@ export interface APIClient { clock(headers?: object, signal?: AbortSignal): Promise - /** - * Generates complete intent execution payloads including calls, preconditions, meta transactions, and quotes for cross-chain swaps/transfers. - * TODOXXX: rename to SolveIntent - */ - getIntentCallsPayloads( - req: GetIntentCallsPayloadsRequest, - headers?: object, - signal?: AbortSignal - ): Promise - - /** - * TODOXXX: remove - */ - getIntentsQuote(req: GetIntentsQuoteRequest, headers?: object, signal?: AbortSignal): Promise - - /** - * TODOXXX: ExecuteIntent - * Persists intent configuration details to database for later execution, creating a new intent config record. - */ - commitIntentConfig(req: CommitIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise - - /** - * TODOXXX: GetIntentDetails .. or another name..? - * Retrieves stored intent configuration by wallet address for inspection or execution. - */ - getIntentConfig(req: GetIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise - - /** - * TODOXXX: keep the name! - * Intent transaction history endpoint - */ - getIntentTransactionHistory( - req: GetIntentTransactionHistoryRequest, - headers?: object, - signal?: AbortSignal - ): Promise + quoteIntent(req: QuoteIntentRequest, headers?: object, signal?: AbortSignal): Promise - /** - * TODOXXX: rename to GetIntentEntryTransaction - * Generates gasless meta transaction for depositing tokens into an Intent Entrypoint contract. - */ - getIntentEntrypointDeposit( - req: GetIntentEntrypointDepositRequest, - headers?: object, - signal?: AbortSignal - ): Promise - - /** - * TODOXXX: rename to GetIntentGasFeeOptions - * Calculates fee options for intent entrypoint deposits. - */ - getIntentEntrypointDepositFeeOptions( - req: GetIntentEntrypointDepositFeeOptionsRequest, - headers?: object, - signal?: AbortSignal - ): Promise - - /** - * TODOXXX: remove completely - * Calculates the EIP-712 message hash that user needs to sign for intent entrypoint deposit. - */ - getIntentEntrypointMessageHash( - req: GetIntentEntrypointMessageHashRequest, - headers?: object, - signal?: AbortSignal - ): Promise + commitIntent(req: CommitIntentRequest, headers?: object, signal?: AbortSignal): Promise + + executeIntent(req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise - getCCTPTransfer(req: GetCCTPTransferRequest, headers?: object, signal?: AbortSignal): Promise + waitIntentReceipt(req: WaitIntentReceiptRequest, headers?: object, signal?: AbortSignal): Promise - queueCCTPTransfer(req: QueueCCTPTransferRequest, headers?: object, signal?: AbortSignal): Promise + getIntentReceipt(req: GetIntentReceiptRequest, headers?: object, signal?: AbortSignal): Promise - /** - * Marks an intent config as ready for processing by the execution worker. - */ - queueIntentConfigExecution( - req: QueueIntentConfigExecutionRequest, + getIntent(req: GetIntentRequest, headers?: object, signal?: AbortSignal): Promise + + searchIntents(req: SearchIntentsRequest, headers?: object, signal?: AbortSignal): Promise + + getIntentTransactionHistory( + req: GetIntentTransactionHistoryRequest, headers?: object, signal?: AbortSignal - ): Promise + ): Promise - /** - * Returns current execution status (pending/processing/executed/failed) for a given intent config. - */ - getIntentConfigExecutionStatus( - req: GetIntentConfigExecutionStatusRequest, + getIntentGasFeeOptions( + req: GetIntentGasFeeOptionsRequest, headers?: object, signal?: AbortSignal - ): Promise - - /** - * Paginated listing of intent configs with optional execution status filtering. - */ - listIntentConfigs(req: ListIntentConfigsRequest, headers?: object, signal?: AbortSignal): Promise - - /** - * Processes relay transaction receipts to update intent execution status and trigger refund logic. - */ - queueMetaTxnReceipt( - req: QueueMetaTxnReceiptRequest, + ): Promise + + getIntentEntryTransaction( + req: GetIntentEntryTransactionRequest, headers?: object, signal?: AbortSignal - ): Promise + ): Promise } // // Schema types // -export enum ExecutionStatus { - created = 'created', - pending = 'pending', - processing = 'processing', - executed = 'executed', - failed = 'failed' -} - -export enum SortOrder { - DESC = 'DESC', - ASC = 'ASC' -} - export enum TradeType { EXACT_INPUT = 'EXACT_INPUT', EXACT_OUTPUT = 'EXACT_OUTPUT' } -export interface Version { - webrpcVersion: string - schemaVersion: string - schemaHash: string - appVersion: string +export enum QuoteProviderType { + RELAY = 'RELAY', + CCTPV2 = 'CCTPV2', + LIFI = 'LIFI' } -export interface RuntimeStatus { - healthOK: boolean - startTime: string - uptime: number - ver: string - branch: string - commitHash: string - runnables: any +export enum TransactionStatus { + PENDING = 'PENDING', + PROCESSING = 'PROCESSING', + FAILED = 'FAILED', + SUCCEEDED = 'SUCCEEDED' } -export interface MetaTxn { - id: string - chainId: string - walletAddress: string - contract: string - input: string +export enum IntentStatus { + SOLVED = 'SOLVED', + COMMITTED = 'COMMITTED', + EXECUTING = 'EXECUTING', + FAILED = 'FAILED', + SUCCEEDED = 'SUCCEEDED' } -export interface Call { - to: string - value?: string - data?: string - gasLimit?: string - delegateCall?: boolean - onlyFallback?: boolean - behaviorOnError?: number +export enum ChainGasUsageStatus { + NORMAL = 'NORMAL', + BUSY = 'BUSY', + VERY_BUSY = 'VERY_BUSY' } -export interface IntentCallsPayload { - chainId: string - space?: string - nonce?: string - calls: Array +export interface QuoteIntentRequest { + ownerAddress: string + originChainId: number + originTokenAddress: string + originTokenAmount?: bigint + destinationChainId: number + destinationTokenAddress: string + destinationTokenAmount: bigint + destinationToAddress: string + destinationCallData?: string + destinationCallValue?: string + tradeType?: TradeType + options?: QuoteIntentRequestOptions } -export interface IntentConfig { +export interface QuoteIntentRequestOptions { + quoteProvider?: QuoteProviderType + slippageTolerance?: number + trailsAddressOverrides?: TrailsAddressOverrides +} + +export interface Intent { intentId: string - configHash: string + status: IntentStatus + quoteRequest: QuoteIntentRequest + ownerAddress: string originIntentAddress: string destinationIntentAddress: string - mainSigner: string - calls: Array + destinationSalt: bigint + calls: Array preconditions: Array - executionStatus: ExecutionStatus - originMetaTxnId?: string - destinationMetaTxnId?: string - originTxnHash?: string - destinationTxnHash?: string - processedAt?: string - retryCount: number + metaTxns: Array + quote: IntentProviderQuote + fees: IntentFees + executedAt?: string + expiresAt: string updatedAt?: string createdAt?: string } -export interface IntentTransaction { - originIntentAddress: string - destinationIntentAddress: string - mainSigner: string - originMetaTxnId?: string - destinationMetaTxnId?: string - originTxnHash?: string - destinationTxnHash?: string - executionStatus: ExecutionStatus - originChainId?: number - destinationChainId?: number - originTokenAddress?: string - originTokenAmount?: string - destinationTokenAddress?: string - destinationTokenAmount?: string - destinationToAddress?: string - createdAt?: string -} - -export interface MetaTxnReceipt { - metaTxID: string - status: string - txnReceipt?: string - revertReason?: string -} - -export interface AddressOverrides { - sequenceWalletFactoryAddress?: string - sequenceWalletMainModuleAddress?: string - sequenceWalletMainModuleUpgradableAddress?: string - sequenceWalletGuestModuleAddress?: string - sequenceWalletUtilsAddress?: string +export interface IntentCalls { + chainId: number + space?: bigint + nonce?: bigint + calls: Array } -export interface OriginCall { - chainId: number +export interface TransactionCall { to: string - transactionData: string - transactionValue: string + value?: bigint + data?: string + gasLimit?: bigint + delegateCall?: boolean + onlyFallback?: boolean + behaviorOnError?: number } export interface IntentPrecondition { type: string - chainId: string + chainId: number data: IntentPreconditionData } @@ -267,15 +165,91 @@ export interface IntentPreconditionData { min: number } -export interface Token { +export interface MetaTxn { + id: string chainId: number - contractAddress: string - tokenId?: string + walletAddress: string + contract: string + input: string } -export interface Price { - value: number - currency: string +export interface IntentReceipt { + intentId: string + status: IntentStatus + ownerAddress: string + originChainId: number + destinationChainId: number + transferTransactionHash: string + transferTransactionStatus: TransactionStatus + originTransaction: IntentTransaction + destinationTransaction: IntentTransaction + processedAt?: string + retryCount?: number + updatedAt?: string + createdAt?: string +} + +export interface IntentTransaction { + intentId: string + chainId: number + metaTxnId: string + txnHash?: string + toAddress: string + tokenAddress: string + tokenAmount: bigint + txnStatus: TransactionStatus +} + +export interface IntentProviderQuote { + quoteProvider: string + quoteProviderRequestId: string + quoteProviderFeeUsd: number + fromAmount: bigint + fromAmountMin: bigint + toAmount: bigint + toAmountMin: bigint + maxSlippage: number + priceImpact: number + priceImpactUsd: number +} + +export interface IntentFees { + originGas: IntentTransactionGasFee + destinationGas: IntentTransactionGasFee + provider: IntentProviderFees + feeTokenAddress: string + feeTokenTotal: bigint + totalFeeAmount: bigint + totalFeeUsd: number +} + +export interface IntentProviderFees { + quoteProvider: string + quoteProviderFee: bigint + quoteProviderFeeUsd: number + trailsFee: bigint + trailsFeeUsd: number + totalFeeAmount: bigint + totalFeeUsd: number +} + +export interface IntentTransactionGasFee { + chainId: number + totalGasLimit: bigint + gasPrice: bigint + nativeTokenSymbol: string + nativeTokenPriceUsd?: number + chainGasUsageStatus: ChainGasUsageStatus + totalFeeAmount: bigint + totalFeeUsd: string + metaTxnFeeDetails: Array + metaTxnGasQuote: string +} + +export interface MetaTxnFeeDetail { + metaTxnId: string + estimatedGasLimit: bigint + feeNative: bigint } export interface TokenPrice { @@ -289,28 +263,15 @@ export interface TokenPrice { updatedAt: string } -export interface ExchangeRate { - name: string - symbol: string - value: number - vsCurrency: string - currencyType: string -} - -export interface Page { - pageSize?: number - page?: number - totalRecords?: number - column?: string - before?: any - after?: any - sort?: Array - more?: boolean +export interface Token { + chainId: number + tokenAddress: string + tokenId?: string } -export interface SortBy { - column: string - order: SortOrder +export interface Price { + value: number + currency: string } export interface CCTPTransfer { @@ -325,147 +286,19 @@ export interface CCTPTransfer { updatedAt: string } -export interface GetIntentCallsPayloadParams { - userAddress: string - destinationChainId: number - destinationTokenAddress: string - destinationTokenAmount: string - destinationToAddress: string - originChainId: number - originTokenAddress: string - originTokenAmount: string - destinationCallData?: string - destinationCallValue?: string - provider?: string - addressOverrides?: AddressOverrides - destinationSalt?: string - slippageTolerance?: number - tradeType?: TradeType -} - -export interface GetIntentsQuoteParams { - userAddress: string - destinationChainId: number - destinationTokenAddress: string - destinationTokenAmount: string - destinationToAddress: string - originChainId: number - originTokenAddress: string - originTokenAmount: string - destinationCallData?: string - destinationCallValue?: string - provider?: string - addressOverrides?: AddressOverrides - destinationSalt?: string - slippageTolerance?: number - tradeType?: TradeType - exactInputOriginalTokenAmount?: string -} - -export interface CommitIntentConfigParams { - originIntentAddress: string - destinationIntentAddress: string - mainSigner: string - calls: Array - preconditions: Array - addressOverrides?: AddressOverrides - requestParams?: IntentRequestParams -} - -export interface IntentRequestParams { - version: string - userAddress: string - destinationChainId: number - destinationTokenAddress: string - destinationTokenAmount: string - destinationToAddress: string - originChainId: number - originTokenAddress: string - originTokenAmount: string - destinationCallData?: string - destinationCallValue?: string - createdAt: string -} - -export interface IntentCallsPayloads { - id: string - calls: Array - preconditions: Array - metaTxns: Array - trailsFee: TrailsFee - quote: IntentQuote - feeQuotes: { [key: string]: string } - originIntentAddress: string - destinationIntentAddress: string -} - -export interface CrossChainFee { - providerFee: string - trailsSwapFee: string - providerFeeUSD: number - trailsSwapFeeUSD: number - totalFeeAmount: string - totalFeeUSD: number -} - -export interface MetaTxnFeeDetail { - metaTxnID: string - estimatedGasLimit: string - feeNative: string -} - -export interface ChainExecuteQuote { - chainId: string - totalGasLimit: string - gasPrice: string - totalFeeAmount: string - nativeTokenSymbol: string - nativeTokenPrice?: string - metaTxnFeeDetails: Array - totalFeeUSD?: string -} - -export interface ExecuteQuote { - chainQuotes: Array -} - -export interface TrailsFee { - executeQuote: ExecuteQuote - crossChainFee?: CrossChainFee - feeToken?: string - originTokenTotalAmount?: string - totalFeeAmount?: string - totalFeeUSD?: string - quoteProvider?: string -} - -export interface IntentQuote { - fromAmount: string - fromAmountMin: string - toAmount: string - toAmountMin: string - priceImpact: number - priceImpactUsd: string - maxSlippage: number - quoteProvider: string - quoteProviderRequestId: string - quoteProviderFeeUsd: string - feeQuotes: { [key: string]: string } -} - export interface GetIntentEntrypointDepositParams { userAddress: string tokenAddress: string - amount: string + amount: bigint intentAddress: string chainID: number deadline: number intentSignature: string usePermit?: boolean - permitAmount?: string + permitAmount?: bigint permitDeadline?: number permitSignature?: string - feeAmount?: string + feeAmount?: bigint } export interface GetIntentEntrypointDepositResult { @@ -475,23 +308,11 @@ export interface GetIntentEntrypointDepositResult { entrypointAddress: string } -export interface GetIntentEntrypointMessageHashParams { - userAddress: string - tokenAddress: string - amount: string - intentAddress: string - chainID: number - deadline: number - nonce: string - feeAmount: string - feeCollector: string -} - export interface GetIntentEntrypointDepositFeeOptionsParams { userAddress: string tokenAddress: string intentAddress: string - amount: string + amount: bigint chainID: number } @@ -506,7 +327,7 @@ export interface GasEstimate { totalGas: number gasPrice: string nativeCost: string - nativeCostUSD: number + nativeCostUsd: number } export interface FeeOption { @@ -514,161 +335,168 @@ export interface FeeOption { tokenSymbol: string tokenDecimals: number amount: string - amountUSD: number + amountUsd: number feeCollector: string } -export interface PingRequest {} +export interface TrailsAddressOverrides { + sequenceWalletFactoryAddress?: string + sequenceWalletMainModuleAddress?: string + sequenceWalletMainModuleUpgradableAddress?: string + sequenceWalletGuestModuleAddress?: string + sequenceWalletUtilsAddress?: string +} -export interface PingResponse { - status: boolean +export enum SortOrder { + DESC = 'DESC', + ASC = 'ASC' } -export interface VersionRequest {} +export interface Version { + webrpcVersion: string + schemaVersion: string + schemaHash: string + appVersion: string +} -export interface VersionResponse { - version: Version +export interface RuntimeStatus { + healthOK: boolean + startTime: string + uptime: number + ver: string + branch: string + commitHash: string + runnables: any } -export interface RuntimeStatusRequest {} +export interface QuoteIntentResponse { + intent: Intent +} -export interface RuntimeStatusResponse { - status: RuntimeStatus +export interface CommitIntentRequest { + intent: Intent } -export interface ClockRequest {} +export interface CommitIntentResponse { + intentId: string +} -export interface ClockResponse { - serverTime: string +export interface ExecuteIntentRequest { + intentId: string + transferTransactionHash: string } -export interface GetIntentCallsPayloadsRequest { - params: GetIntentCallsPayloadParams +export interface ExecuteIntentResponse { + intentId: string + intentStatus: IntentStatus } -export interface GetIntentCallsPayloadsResponse { - payloads: IntentCallsPayloads +export interface GetIntentReceiptRequest { + intentId: string } -export interface GetIntentsQuoteRequest { - params: GetIntentsQuoteParams +export interface GetIntentReceiptResponse { + intentReceipt: IntentReceipt } -export interface GetIntentsQuoteResponse { - quote: IntentQuote +export interface WaitIntentReceiptRequest { + intentId: string } -export interface CommitIntentConfigRequest { - params: CommitIntentConfigParams +export interface WaitIntentReceiptResponse { + intentReceipt: IntentReceipt + done: boolean } -export interface CommitIntentConfigResponse { - config: IntentConfig +export interface GetIntentRequest { + intentId: string } -export interface GetIntentConfigRequest { - intentAddress: string +export interface GetIntentResponse { + intent: Intent } -export interface GetIntentConfigResponse { - config: IntentConfig +export interface SearchIntentsRequest { + byOriginIntentAddress?: string + byTransferTransactionHash?: string + byOwnerAddress?: string +} + +export interface SearchIntentsResponse { + intents: Array } export interface GetIntentTransactionHistoryRequest { - accountAddress: string page?: Page } export interface GetIntentTransactionHistoryResponse { - page: Page transactions: Array + nextPage?: Page } -export interface GetIntentEntrypointDepositRequest { - params: GetIntentEntrypointDepositParams -} - -export interface GetIntentEntrypointDepositResponse { - result: GetIntentEntrypointDepositResult -} - -export interface GetIntentEntrypointDepositFeeOptionsRequest { +export interface GetIntentGasFeeOptionsRequest { params: GetIntentEntrypointDepositFeeOptionsParams } -export interface GetIntentEntrypointDepositFeeOptionsResponse { +export interface GetIntentGasFeeOptionsResponse { result: GetIntentEntrypointDepositFeeOptionsResult } -export interface GetIntentEntrypointMessageHashRequest { - params: GetIntentEntrypointMessageHashParams -} - -export interface GetIntentEntrypointMessageHashResponse { - messageHash: string -} - -export interface GetCCTPTransferRequest { - id: string +export interface GetIntentEntryTransactionRequest { + params: GetIntentEntrypointDepositParams } -export interface GetCCTPTransferResponse { - transfer: CCTPTransfer +export interface GetIntentEntryTransactionResponse { + result: GetIntentEntrypointDepositResult } -export interface QueueCCTPTransferRequest { - sourceTxHash?: string - metaTxHash?: string - sourceChainId: number - destinationChainId: number +export interface Page { + column?: string + before?: any + after?: any + sort?: Array + pageSize?: number + more?: boolean } -export interface QueueCCTPTransferResponse { - transfer: CCTPTransfer +export interface SortBy { + column: string + order: SortOrder } -export interface QueueIntentConfigExecutionRequest { - intentConfigId: string -} +export interface PingRequest {} -export interface QueueIntentConfigExecutionResponse { +export interface PingResponse { status: boolean } -export interface GetIntentConfigExecutionStatusRequest { - intentConfigId: string -} +export interface VersionRequest {} -export interface GetIntentConfigExecutionStatusResponse { - executionStatus: string +export interface VersionResponse { + version: Version } -export interface ListIntentConfigsRequest { - page?: Page - executionStatus?: string -} +export interface RuntimeStatusRequest {} -export interface ListIntentConfigsResponse { - page: Page - intentConfigs: Array +export interface RuntimeStatusResponse { + status: RuntimeStatus } -export interface QueueMetaTxnReceiptRequest { - metaTxID: string -} +export interface ClockRequest {} -export interface QueueMetaTxnReceiptResponse { - status: boolean +export interface ClockResponse { + serverTime: string } // // Client // -export class API implements APIClient { +export class Trails implements TrailsClient { protected hostname: string protected fetch: Fetch - protected path = '/rpc/API/' + protected path = '/rpc/Trails/' constructor(hostname: string, fetch: Fetch) { this.hostname = hostname.replace(/\/*$/, '') @@ -680,28 +508,21 @@ export class API implements APIClient { } queryKey = { - ping: () => ['API', 'ping'] as const, - version: () => ['API', 'version'] as const, - runtimeStatus: () => ['API', 'runtimeStatus'] as const, - clock: () => ['API', 'clock'] as const, - getIntentCallsPayloads: (req: GetIntentCallsPayloadsRequest) => ['API', 'getIntentCallsPayloads', req] as const, - getIntentsQuote: (req: GetIntentsQuoteRequest) => ['API', 'getIntentsQuote', req] as const, - commitIntentConfig: (req: CommitIntentConfigRequest) => ['API', 'commitIntentConfig', req] as const, - getIntentConfig: (req: GetIntentConfigRequest) => ['API', 'getIntentConfig', req] as const, + ping: () => ['Trails', 'ping'] as const, + version: () => ['Trails', 'version'] as const, + runtimeStatus: () => ['Trails', 'runtimeStatus'] as const, + clock: () => ['Trails', 'clock'] as const, + quoteIntent: (req: QuoteIntentRequest) => ['Trails', 'quoteIntent', req] as const, + commitIntent: (req: CommitIntentRequest) => ['Trails', 'commitIntent', req] as const, + executeIntent: (req: ExecuteIntentRequest) => ['Trails', 'executeIntent', req] as const, + waitIntentReceipt: (req: WaitIntentReceiptRequest) => ['Trails', 'waitIntentReceipt', req] as const, + getIntentReceipt: (req: GetIntentReceiptRequest) => ['Trails', 'getIntentReceipt', req] as const, + getIntent: (req: GetIntentRequest) => ['Trails', 'getIntent', req] as const, + searchIntents: (req: SearchIntentsRequest) => ['Trails', 'searchIntents', req] as const, getIntentTransactionHistory: (req: GetIntentTransactionHistoryRequest) => - ['API', 'getIntentTransactionHistory', req] as const, - getIntentEntrypointDeposit: (req: GetIntentEntrypointDepositRequest) => ['API', 'getIntentEntrypointDeposit', req] as const, - getIntentEntrypointDepositFeeOptions: (req: GetIntentEntrypointDepositFeeOptionsRequest) => - ['API', 'getIntentEntrypointDepositFeeOptions', req] as const, - getIntentEntrypointMessageHash: (req: GetIntentEntrypointMessageHashRequest) => - ['API', 'getIntentEntrypointMessageHash', req] as const, - getCCTPTransfer: (req: GetCCTPTransferRequest) => ['API', 'getCCTPTransfer', req] as const, - queueCCTPTransfer: (req: QueueCCTPTransferRequest) => ['API', 'queueCCTPTransfer', req] as const, - queueIntentConfigExecution: (req: QueueIntentConfigExecutionRequest) => ['API', 'queueIntentConfigExecution', req] as const, - getIntentConfigExecutionStatus: (req: GetIntentConfigExecutionStatusRequest) => - ['API', 'getIntentConfigExecutionStatus', req] as const, - listIntentConfigs: (req: ListIntentConfigsRequest) => ['API', 'listIntentConfigs', req] as const, - queueMetaTxnReceipt: (req: QueueMetaTxnReceiptRequest) => ['API', 'queueMetaTxnReceipt', req] as const + ['Trails', 'getIntentTransactionHistory', req] as const, + getIntentGasFeeOptions: (req: GetIntentGasFeeOptionsRequest) => ['Trails', 'getIntentGasFeeOptions', req] as const, + getIntentEntryTransaction: (req: GetIntentEntryTransactionRequest) => ['Trails', 'getIntentEntryTransaction', req] as const } ping = (headers?: object, signal?: AbortSignal): Promise => { @@ -756,34 +577,11 @@ export class API implements APIClient { ) } - getIntentCallsPayloads = ( - req: GetIntentCallsPayloadsRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('GetIntentCallsPayloads'), - createHttpRequest(JsonEncode(req, 'GetIntentCallsPayloadsRequest'), headers, signal) - ).then( - res => { - return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentCallsPayloadsResponse') - }) - }, - error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) - } - ) - } - - getIntentsQuote = (req: GetIntentsQuoteRequest, headers?: object, signal?: AbortSignal): Promise => { - return this.fetch( - this.url('GetIntentsQuote'), - createHttpRequest(JsonEncode(req, 'GetIntentsQuoteRequest'), headers, signal) - ).then( + quoteIntent = (req: QuoteIntentRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('QuoteIntent'), createHttpRequest(JsonEncode(req, 'QuoteIntentRequest'), headers, signal)).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentsQuoteResponse') + return JsonDecode(_data, 'QuoteIntentResponse') }) }, error => { @@ -792,18 +590,11 @@ export class API implements APIClient { ) } - commitIntentConfig = ( - req: CommitIntentConfigRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('CommitIntentConfig'), - createHttpRequest(JsonEncode(req, 'CommitIntentConfigRequest'), headers, signal) - ).then( + commitIntent = (req: CommitIntentRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('CommitIntent'), createHttpRequest(JsonEncode(req, 'CommitIntentRequest'), headers, signal)).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'CommitIntentConfigResponse') + return JsonDecode(_data, 'CommitIntentResponse') }) }, error => { @@ -812,14 +603,14 @@ export class API implements APIClient { ) } - getIntentConfig = (req: GetIntentConfigRequest, headers?: object, signal?: AbortSignal): Promise => { + executeIntent = (req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise => { return this.fetch( - this.url('GetIntentConfig'), - createHttpRequest(JsonEncode(req, 'GetIntentConfigRequest'), headers, signal) + this.url('ExecuteIntent'), + createHttpRequest(JsonEncode(req, 'ExecuteIntentRequest'), headers, signal) ).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentConfigResponse') + return JsonDecode(_data, 'ExecuteIntentResponse') }) }, error => { @@ -828,18 +619,18 @@ export class API implements APIClient { ) } - getIntentTransactionHistory = ( - req: GetIntentTransactionHistoryRequest, + waitIntentReceipt = ( + req: WaitIntentReceiptRequest, headers?: object, signal?: AbortSignal - ): Promise => { + ): Promise => { return this.fetch( - this.url('GetIntentTransactionHistory'), - createHttpRequest(JsonEncode(req, 'GetIntentTransactionHistoryRequest'), headers, signal) + this.url('WaitIntentReceipt'), + createHttpRequest(JsonEncode(req, 'WaitIntentReceiptRequest'), headers, signal) ).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentTransactionHistoryResponse') + return JsonDecode(_data, 'WaitIntentReceiptResponse') }) }, error => { @@ -848,18 +639,18 @@ export class API implements APIClient { ) } - getIntentEntrypointDeposit = ( - req: GetIntentEntrypointDepositRequest, + getIntentReceipt = ( + req: GetIntentReceiptRequest, headers?: object, signal?: AbortSignal - ): Promise => { + ): Promise => { return this.fetch( - this.url('GetIntentEntrypointDeposit'), - createHttpRequest(JsonEncode(req, 'GetIntentEntrypointDepositRequest'), headers, signal) + this.url('GetIntentReceipt'), + createHttpRequest(JsonEncode(req, 'GetIntentReceiptRequest'), headers, signal) ).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentEntrypointDepositResponse') + return JsonDecode(_data, 'GetIntentReceiptResponse') }) }, error => { @@ -868,18 +659,11 @@ export class API implements APIClient { ) } - getIntentEntrypointDepositFeeOptions = ( - req: GetIntentEntrypointDepositFeeOptionsRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('GetIntentEntrypointDepositFeeOptions'), - createHttpRequest(JsonEncode(req, 'GetIntentEntrypointDepositFeeOptionsRequest'), headers, signal) - ).then( + getIntent = (req: GetIntentRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetIntent'), createHttpRequest(JsonEncode(req, 'GetIntentRequest'), headers, signal)).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentEntrypointDepositFeeOptionsResponse') + return JsonDecode(_data, 'GetIntentResponse') }) }, error => { @@ -888,34 +672,14 @@ export class API implements APIClient { ) } - getIntentEntrypointMessageHash = ( - req: GetIntentEntrypointMessageHashRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('GetIntentEntrypointMessageHash'), - createHttpRequest(JsonEncode(req, 'GetIntentEntrypointMessageHashRequest'), headers, signal) - ).then( - res => { - return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentEntrypointMessageHashResponse') - }) - }, - error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) - } - ) - } - - getCCTPTransfer = (req: GetCCTPTransferRequest, headers?: object, signal?: AbortSignal): Promise => { + searchIntents = (req: SearchIntentsRequest, headers?: object, signal?: AbortSignal): Promise => { return this.fetch( - this.url('GetCCTPTransfer'), - createHttpRequest(JsonEncode(req, 'GetCCTPTransferRequest'), headers, signal) + this.url('SearchIntents'), + createHttpRequest(JsonEncode(req, 'SearchIntentsRequest'), headers, signal) ).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetCCTPTransferResponse') + return JsonDecode(_data, 'SearchIntentsResponse') }) }, error => { @@ -924,58 +688,18 @@ export class API implements APIClient { ) } - queueCCTPTransfer = ( - req: QueueCCTPTransferRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('QueueCCTPTransfer'), - createHttpRequest(JsonEncode(req, 'QueueCCTPTransferRequest'), headers, signal) - ).then( - res => { - return buildResponse(res).then(_data => { - return JsonDecode(_data, 'QueueCCTPTransferResponse') - }) - }, - error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) - } - ) - } - - queueIntentConfigExecution = ( - req: QueueIntentConfigExecutionRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('QueueIntentConfigExecution'), - createHttpRequest(JsonEncode(req, 'QueueIntentConfigExecutionRequest'), headers, signal) - ).then( - res => { - return buildResponse(res).then(_data => { - return JsonDecode(_data, 'QueueIntentConfigExecutionResponse') - }) - }, - error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) - } - ) - } - - getIntentConfigExecutionStatus = ( - req: GetIntentConfigExecutionStatusRequest, + getIntentTransactionHistory = ( + req: GetIntentTransactionHistoryRequest, headers?: object, signal?: AbortSignal - ): Promise => { + ): Promise => { return this.fetch( - this.url('GetIntentConfigExecutionStatus'), - createHttpRequest(JsonEncode(req, 'GetIntentConfigExecutionStatusRequest'), headers, signal) + this.url('GetIntentTransactionHistory'), + createHttpRequest(JsonEncode(req, 'GetIntentTransactionHistoryRequest'), headers, signal) ).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentConfigExecutionStatusResponse') + return JsonDecode(_data, 'GetIntentTransactionHistoryResponse') }) }, error => { @@ -984,18 +708,18 @@ export class API implements APIClient { ) } - listIntentConfigs = ( - req: ListIntentConfigsRequest, + getIntentGasFeeOptions = ( + req: GetIntentGasFeeOptionsRequest, headers?: object, signal?: AbortSignal - ): Promise => { + ): Promise => { return this.fetch( - this.url('ListIntentConfigs'), - createHttpRequest(JsonEncode(req, 'ListIntentConfigsRequest'), headers, signal) + this.url('GetIntentGasFeeOptions'), + createHttpRequest(JsonEncode(req, 'GetIntentGasFeeOptionsRequest'), headers, signal) ).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'ListIntentConfigsResponse') + return JsonDecode(_data, 'GetIntentGasFeeOptionsResponse') }) }, error => { @@ -1004,18 +728,18 @@ export class API implements APIClient { ) } - queueMetaTxnReceipt = ( - req: QueueMetaTxnReceiptRequest, + getIntentEntryTransaction = ( + req: GetIntentEntryTransactionRequest, headers?: object, signal?: AbortSignal - ): Promise => { + ): Promise => { return this.fetch( - this.url('QueueMetaTxnReceipt'), - createHttpRequest(JsonEncode(req, 'QueueMetaTxnReceiptRequest'), headers, signal) + this.url('GetIntentEntryTransaction'), + createHttpRequest(JsonEncode(req, 'GetIntentEntryTransactionRequest'), headers, signal) ).then( res => { return buildResponse(res).then(_data => { - return JsonDecode(_data, 'QueueMetaTxnReceiptResponse') + return JsonDecode(_data, 'GetIntentEntryTransactionResponse') }) }, error => { @@ -1051,11 +775,139 @@ const buildResponse = (res: Response): Promise => { export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise -export const JsonEncode = (obj: T, _typ: string = ''): string => { - return JSON.stringify(obj) +// +// BigInt helpers +// + +const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { + CommitIntentRequest: [['intent', 'Intent']], + GetIntentEntryTransactionRequest: [['params', 'GetIntentEntrypointDepositParams']], + GetIntentEntrypointDepositFeeOptionsParams: ['amount'], + GetIntentEntrypointDepositParams: ['amount', 'permitAmount', 'feeAmount'], + GetIntentGasFeeOptionsRequest: [['params', 'GetIntentEntrypointDepositFeeOptionsParams']], + GetIntentReceiptResponse: [['intentReceipt', 'IntentReceipt']], + GetIntentResponse: [['intent', 'Intent']], + GetIntentTransactionHistoryResponse: [['transactions', 'IntentTransaction[]']], + Intent: [ + ['quoteRequest', 'QuoteIntentRequest'], + 'destinationSalt', + ['calls', 'IntentCalls[]'], + ['quote', 'IntentProviderQuote'], + ['fees', 'IntentFees'] + ], + IntentCalls: ['space', 'nonce', ['calls', 'TransactionCall[]']], + IntentFees: [ + ['originGas', 'IntentTransactionGasFee'], + ['destinationGas', 'IntentTransactionGasFee'], + ['provider', 'IntentProviderFees'], + 'feeTokenTotal', + 'totalFeeAmount' + ], + IntentProviderFees: ['quoteProviderFee', 'trailsFee', 'totalFeeAmount'], + IntentProviderQuote: ['fromAmount', 'fromAmountMin', 'toAmount', 'toAmountMin'], + IntentReceipt: [ + ['originTransaction', 'IntentTransaction'], + ['destinationTransaction', 'IntentTransaction'] + ], + IntentTransaction: ['tokenAmount'], + IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetail[]']], + MetaTxnFeeDetail: ['estimatedGasLimit', 'feeNative'], + QuoteIntentRequest: ['originTokenAmount', 'destinationTokenAmount'], + QuoteIntentResponse: [['intent', 'Intent']], + SearchIntentsResponse: [['intents', 'Intent[]']], + TransactionCall: ['value', 'gasLimit'], + WaitIntentReceiptResponse: [['intentReceipt', 'IntentReceipt']] +} + +// Encode in-place: mutate provided object graph to serialize bigints to strings. +function encodeType(typ: string, obj: any): any { + if (obj == null || typeof obj !== 'object') return obj + const descs = BIG_INT_FIELDS[typ] || [] + if (!descs.length) return obj + for (const d of descs) { + if (Array.isArray(d)) { + const [fieldName, nestedType] = d + if (fieldName.endsWith('[]')) { + const base = fieldName.slice(0, -2) + const arr = obj[base] + if (Array.isArray(arr)) { + for (let i = 0; i < arr.length; i++) arr[i] = encodeType(nestedType, arr[i]) + } + } else if (obj[fieldName]) { + obj[fieldName] = encodeType(nestedType, obj[fieldName]) + } + continue + } + if (d.endsWith('[]')) { + const base = d.slice(0, -2) + const arr = obj[base] + if (Array.isArray(arr)) { + for (let i = 0; i < arr.length; i++) { + if (typeof arr[i] === 'bigint') arr[i] = arr[i].toString() + } + } + continue + } + if (typeof obj[d] === 'bigint') obj[d] = obj[d].toString() + } + return obj +} + +// Decode in-place: mutate object graph; throw if expected numeric string is invalid. +function decodeType(typ: string, obj: any): any { + if (obj == null || typeof obj !== 'object') return obj + const descs = BIG_INT_FIELDS[typ] || [] + if (!descs.length) return obj + for (const d of descs) { + if (Array.isArray(d)) { + const [fieldName, nestedType] = d + if (fieldName.endsWith('[]')) { + const base = fieldName.slice(0, -2) + const arr = obj[base] + if (Array.isArray(arr)) { + for (let i = 0; i < arr.length; i++) arr[i] = decodeType(nestedType, arr[i]) + } + } else if (obj[fieldName]) { + obj[fieldName] = decodeType(nestedType, obj[fieldName]) + } + continue + } + if (d.endsWith('[]')) { + const base = d.slice(0, -2) + const arr = obj[base] + if (Array.isArray(arr)) { + for (let i = 0; i < arr.length; i++) { + const v = arr[i] + if (typeof v === 'string') { + try { + arr[i] = BigInt(v) + } catch (e) { + throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${base}[${i}]: ${v}` }) + } + } + } + } + continue + } + const v = obj[d] + if (typeof v === 'string') { + try { + obj[d] = BigInt(v) + } catch (e) { + throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${d}: ${v}` }) + } + } + } + return obj +} + +// Encode object of given root type to JSON with BigInts converted to decimal strings. +export const JsonEncode = (obj: T, typ: string = ''): string => { + return JSON.stringify(encodeType(typ, obj)) } -export const JsonDecode = (data: string | any, _typ: string = ''): T => { +// Decode data (JSON string or already-parsed object) and convert declared BigInt string fields back to BigInt. +export const JsonDecode = (data: string | any, typ: string = ''): T => { let parsed: any = data if (typeof data === 'string') { try { @@ -1064,7 +916,7 @@ export const JsonDecode = (data: string | any, _typ: string = ''): T => throw WebrpcBadResponseError.new({ cause: `JsonDecode: JSON.parse failed: ${(err as Error).message}` }) } } - return parsed as T + return decodeType(typ, parsed) as T } // @@ -1480,6 +1332,18 @@ export class InvalidArgumentError extends WebrpcError { } } +export class UnexpectedError extends WebrpcError { + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'Unexpected' + this.code = typeof error.code === 'number' ? error.code : 2001 + this.message = error.message || `Unexpected server error` + this.status = typeof error.status === 'number' ? error.status : 500 + if (error.cause !== undefined) this.cause = error.cause + Object.setPrototypeOf(this, UnexpectedError.prototype) + } +} + export class UnavailableError extends WebrpcError { constructor(error: WebrpcErrorParams = {}) { super(error) @@ -1504,6 +1368,18 @@ export class QueryFailedError extends WebrpcError { } } +export class IntentStatusError extends WebrpcError { + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'IntentStatus' + this.code = typeof error.code === 'number' ? error.code : 2004 + this.message = error.message || `Invalid intent status` + this.status = typeof error.status === 'number' ? error.status : 422 + if (error.cause !== undefined) this.cause = error.cause + Object.setPrototypeOf(this, IntentStatusError.prototype) + } +} + export class NotFoundError extends WebrpcError { constructor(error: WebrpcErrorParams = {}) { super(error) @@ -1561,8 +1437,10 @@ export enum errors { AtLeastOneKey = 'AtLeastOneKey', Timeout = 'Timeout', InvalidArgument = 'InvalidArgument', + Unexpected = 'Unexpected', Unavailable = 'Unavailable', QueryFailed = 'QueryFailed', + IntentStatus = 'IntentStatus', NotFound = 'NotFound', UnsupportedNetwork = 'UnsupportedNetwork' } @@ -1600,8 +1478,10 @@ export enum WebrpcErrorCodes { AtLeastOneKey = 1302, Timeout = 1900, InvalidArgument = 2000, + Unexpected = 2001, Unavailable = 2002, QueryFailed = 2003, + IntentStatus = 2004, NotFound = 8000, UnsupportedNetwork = 8008 } @@ -1639,8 +1519,10 @@ export const webrpcErrorByCode: { [code: number]: any } = { [1302]: AtLeastOneKeyError, [1900]: TimeoutError, [2000]: InvalidArgumentError, + [2001]: UnexpectedError, [2002]: UnavailableError, [2003]: QueryFailedError, + [2004]: IntentStatusError, [8000]: NotFoundError, [8008]: UnsupportedNetworkError } @@ -1651,7 +1533,7 @@ export const webrpcErrorByCode: { [code: number]: any } = { export const WebrpcHeader = 'Webrpc' -export const WebrpcHeaderValue = 'webrpc@v0.30.1;gen-typescript@v0.22.0;trails-api@v0.4.0' +export const WebrpcHeaderValue = 'webrpc@v0.30.2;gen-typescript@v0.22.2;trails-api@v1.0.0' type WebrpcGenVersions = { WebrpcGenVersion: string From d736b3ae645f008543ee6d7d16e9fe9634b5c3e6 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 30 Oct 2025 13:56:14 +0000 Subject: [PATCH 21/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 3067874d3..6476fde35 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 d77c84a0d98b34c7e6d3a9810cc8819aee40b978 +// trails-api v1.0.0 f01309b41f30972f5f124ffff33d0a805a73e992 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'd77c84a0d98b34c7e6d3a9810cc8819aee40b978' +export const WebrpcSchemaHash = 'f01309b41f30972f5f124ffff33d0a805a73e992' // // Client interface @@ -76,6 +76,7 @@ export enum QuoteProviderType { } export enum TransactionStatus { + UNKNOWN = 'UNKNOWN', PENDING = 'PENDING', PROCESSING = 'PROCESSING', FAILED = 'FAILED', @@ -83,7 +84,7 @@ export enum TransactionStatus { } export enum IntentStatus { - SOLVED = 'SOLVED', + QUOTED = 'QUOTED', COMMITTED = 'COMMITTED', EXECUTING = 'EXECUTING', FAILED = 'FAILED', @@ -130,7 +131,6 @@ export interface Intent { metaTxns: Array quote: IntentProviderQuote fees: IntentFees - executedAt?: string expiresAt: string updatedAt?: string createdAt?: string @@ -179,7 +179,7 @@ export interface IntentReceipt { ownerAddress: string originChainId: number destinationChainId: number - transferTransactionHash: string + transferTransactionHash?: string transferTransactionStatus: TransactionStatus originTransaction: IntentTransaction destinationTransaction: IntentTransaction @@ -198,6 +198,8 @@ export interface IntentTransaction { tokenAddress: string tokenAmount: bigint txnStatus: TransactionStatus + updatedAt?: string + createdAt?: string } export interface IntentProviderQuote { @@ -282,8 +284,8 @@ export interface CCTPTransfer { message: string attestation: string status: string - createdAt: string - updatedAt: string + updatedAt?: string + createdAt?: string } export interface GetIntentEntrypointDepositParams { From 6f9b40f64c7b4b5b0df64f09848c95758691a9e1 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 30 Oct 2025 18:41:57 +0000 Subject: [PATCH 22/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 6476fde35..d0604dadb 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 f01309b41f30972f5f124ffff33d0a805a73e992 +// trails-api v1.0.0 3db4e7de3a5bd5ac465fd949325f7ae87f8f896d // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'f01309b41f30972f5f124ffff33d0a805a73e992' +export const WebrpcSchemaHash = '3db4e7de3a5bd5ac465fd949325f7ae87f8f896d' // // Client interface @@ -179,7 +179,7 @@ export interface IntentReceipt { ownerAddress: string originChainId: number destinationChainId: number - transferTransactionHash?: string + transferTransactionHash: string transferTransactionStatus: TransactionStatus originTransaction: IntentTransaction destinationTransaction: IntentTransaction From b2234ab671a17281384daed406a6215387df19dc Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:38:39 +0000 Subject: [PATCH 23/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index d0604dadb..d1a8ba4fb 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 3db4e7de3a5bd5ac465fd949325f7ae87f8f896d +// trails-api v1.0.0 637d853041f61166b4ffb5d6fb879fce563c45a8 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '3db4e7de3a5bd5ac465fd949325f7ae87f8f896d' +export const WebrpcSchemaHash = '637d853041f61166b4ffb5d6fb879fce563c45a8' // // Client interface @@ -131,6 +131,7 @@ export interface Intent { metaTxns: Array quote: IntentProviderQuote fees: IntentFees + trailsVersion: string expiresAt: string updatedAt?: string createdAt?: string @@ -244,11 +245,11 @@ export interface IntentTransactionGasFee { chainGasUsageStatus: ChainGasUsageStatus totalFeeAmount: bigint totalFeeUsd: string - metaTxnFeeDetails: Array + metaTxnFeeDetails: MetaTxnFeeDetails metaTxnGasQuote: string } -export interface MetaTxnFeeDetail { +export interface MetaTxnFeeDetails { metaTxnId: string estimatedGasLimit: bigint feeNative: bigint @@ -812,8 +813,8 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { ['destinationTransaction', 'IntentTransaction'] ], IntentTransaction: ['tokenAmount'], - IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetail[]']], - MetaTxnFeeDetail: ['estimatedGasLimit', 'feeNative'], + IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']], + MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'], QuoteIntentRequest: ['originTokenAmount', 'destinationTokenAmount'], QuoteIntentResponse: [['intent', 'Intent']], SearchIntentsResponse: [['intents', 'Intent[]']], From 77b7e623af2417588a1bfb9a93399b2b94e05f01 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 02:50:20 +0000 Subject: [PATCH 24/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index d1a8ba4fb..227aeca0e 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 637d853041f61166b4ffb5d6fb879fce563c45a8 +// trails-api v1.0.0 05ed598bed12799bc48ae5315179931d7f262790 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '637d853041f61166b4ffb5d6fb879fce563c45a8' +export const WebrpcSchemaHash = '05ed598bed12799bc48ae5315179931d7f262790' // // Client interface @@ -126,6 +126,7 @@ export interface Intent { originIntentAddress: string destinationIntentAddress: string destinationSalt: bigint + depositTransaction: DepositTransaction calls: Array preconditions: Array metaTxns: Array @@ -137,6 +138,12 @@ export interface Intent { createdAt?: string } +export interface DepositTransaction { + toAddress: string + tokenAddress: string + amount: bigint +} + export interface IntentCalls { chainId: number space?: bigint @@ -180,8 +187,8 @@ export interface IntentReceipt { ownerAddress: string originChainId: number destinationChainId: number - transferTransactionHash: string - transferTransactionStatus: TransactionStatus + depositTransactionHash: string + depositTransactionStatus: TransactionStatus originTransaction: IntentTransaction destinationTransaction: IntentTransaction processedAt?: string @@ -386,6 +393,7 @@ export interface CommitIntentResponse { export interface ExecuteIntentRequest { intentId: string + depositTransactionHash: string transferTransactionHash: string } @@ -421,7 +429,7 @@ export interface GetIntentResponse { export interface SearchIntentsRequest { byOriginIntentAddress?: string - byTransferTransactionHash?: string + byDepositTransactionHash?: string byOwnerAddress?: string } @@ -784,6 +792,7 @@ export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise Date: Fri, 31 Oct 2025 14:27:11 +0000 Subject: [PATCH 25/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 227aeca0e..de1377b41 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 05ed598bed12799bc48ae5315179931d7f262790 +// trails-api v1.0.0 54cbe231c8762643c1a1b625b01d8a1ba6487cdd // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '05ed598bed12799bc48ae5315179931d7f262790' +export const WebrpcSchemaHash = '54cbe231c8762643c1a1b625b01d8a1ba6487cdd' // // Client interface @@ -141,6 +141,7 @@ export interface Intent { export interface DepositTransaction { toAddress: string tokenAddress: string + decimals?: number amount: bigint } From 8a0ce412eb408d735abf43f55fd5d75a932ea764 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 14:40:44 +0000 Subject: [PATCH 26/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index de1377b41..4f4f9f65a 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 54cbe231c8762643c1a1b625b01d8a1ba6487cdd +// trails-api v1.0.0 10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '54cbe231c8762643c1a1b625b01d8a1ba6487cdd' +export const WebrpcSchemaHash = '10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625' // // Client interface @@ -101,7 +101,6 @@ export interface QuoteIntentRequest { ownerAddress: string originChainId: number originTokenAddress: string - originTokenAmount?: bigint destinationChainId: number destinationTokenAddress: string destinationTokenAmount: bigint @@ -826,7 +825,7 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { IntentTransaction: ['tokenAmount'], IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']], MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'], - QuoteIntentRequest: ['originTokenAmount', 'destinationTokenAmount'], + QuoteIntentRequest: ['destinationTokenAmount'], QuoteIntentResponse: [['intent', 'Intent']], SearchIntentsResponse: [['intents', 'Intent[]']], TransactionCall: ['value', 'gasLimit'], From a5d01883edf8f2587ed1d3789bad302cfac80207 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:12:15 +0000 Subject: [PATCH 27/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 4f4f9f65a..290c48d24 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625 +// trails-api v1.0.0 5669b86e8def11e520b7d1722de60e73a3b9d75b // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '10e80c7e6d8eaec75b8a5368a8ef038e5ab1a625' +export const WebrpcSchemaHash = '5669b86e8def11e520b7d1722de60e73a3b9d75b' // // Client interface @@ -394,7 +394,6 @@ export interface CommitIntentResponse { export interface ExecuteIntentRequest { intentId: string depositTransactionHash: string - transferTransactionHash: string } export interface ExecuteIntentResponse { From b35ee2b2857dd52cf17381586043102b43ad9124 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:39:21 +0000 Subject: [PATCH 28/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 290c48d24..2795f3ef4 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 5669b86e8def11e520b7d1722de60e73a3b9d75b +// trails-api v1.0.0 be6fdd3eab15f477b03ddf9bd7abeb162178b4d0 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '5669b86e8def11e520b7d1722de60e73a3b9d75b' +export const WebrpcSchemaHash = 'be6fdd3eab15f477b03ddf9bd7abeb162178b4d0' // // Client interface @@ -78,9 +78,10 @@ export enum QuoteProviderType { export enum TransactionStatus { UNKNOWN = 'UNKNOWN', PENDING = 'PENDING', - PROCESSING = 'PROCESSING', - FAILED = 'FAILED', - SUCCEEDED = 'SUCCEEDED' + RELAYING = 'RELAYING', + AWAITING_RECEIPT = 'AWAITING_RECEIPT', + FINISHED = 'FINISHED', + FAILED = 'FAILED' } export enum IntentStatus { @@ -200,12 +201,17 @@ export interface IntentReceipt { export interface IntentTransaction { intentId: string chainId: number - metaTxnId: string - txnHash?: string + fromAddress: string toAddress: string tokenAddress: string tokenAmount: bigint - txnStatus: TransactionStatus + calldata: string + metaTxnId: string + metaTxnFeeQuote: string + preconditions: IntentPrecondition + txnHash?: string + status: TransactionStatus + statusReason?: string updatedAt?: string createdAt?: string } From 21ec9050b9d88ad637c6e41fc0e201e635be0ec6 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:25:35 +0000 Subject: [PATCH 29/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 2795f3ef4..1732fda34 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 be6fdd3eab15f477b03ddf9bd7abeb162178b4d0 +// trails-api v1.0.0 57e04bf9ac957ab0646258ce21b9b52859e2d8b3 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'be6fdd3eab15f477b03ddf9bd7abeb162178b4d0' +export const WebrpcSchemaHash = '57e04bf9ac957ab0646258ce21b9b52859e2d8b3' // // Client interface @@ -104,10 +104,11 @@ export interface QuoteIntentRequest { originTokenAddress: string destinationChainId: number destinationTokenAddress: string - destinationTokenAmount: bigint destinationToAddress: string destinationCallData?: string destinationCallValue?: string + originTokenAmount?: bigint + destinationTokenAmount?: bigint tradeType?: TradeType options?: QuoteIntentRequestOptions } @@ -830,7 +831,7 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { IntentTransaction: ['tokenAmount'], IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']], MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'], - QuoteIntentRequest: ['destinationTokenAmount'], + QuoteIntentRequest: ['originTokenAmount', 'destinationTokenAmount'], QuoteIntentResponse: [['intent', 'Intent']], SearchIntentsResponse: [['intents', 'Intent[]']], TransactionCall: ['value', 'gasLimit'], From f41a146c8469b032341f2eb3761f1e3723912d96 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 17:09:42 +0000 Subject: [PATCH 30/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 1732fda34..124a9e779 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 57e04bf9ac957ab0646258ce21b9b52859e2d8b3 +// trails-api v1.0.0 ebcef7106408aa5206a04dd007cb25e18bf014fd // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '57e04bf9ac957ab0646258ce21b9b52859e2d8b3' +export const WebrpcSchemaHash = 'ebcef7106408aa5206a04dd007cb25e18bf014fd' // // Client interface @@ -79,8 +79,8 @@ export enum TransactionStatus { UNKNOWN = 'UNKNOWN', PENDING = 'PENDING', RELAYING = 'RELAYING', - AWAITING_RECEIPT = 'AWAITING_RECEIPT', - FINISHED = 'FINISHED', + MINING = 'MINING', + SUCCEEDED = 'SUCCEEDED', FAILED = 'FAILED' } @@ -193,8 +193,6 @@ export interface IntentReceipt { depositTransactionStatus: TransactionStatus originTransaction: IntentTransaction destinationTransaction: IntentTransaction - processedAt?: string - retryCount?: number updatedAt?: string createdAt?: string } From 02ded2e2d79211f595eb1fff79a1539c810f0424 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:01:43 +0000 Subject: [PATCH 31/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 124a9e779..26f36b2ca 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 ebcef7106408aa5206a04dd007cb25e18bf014fd +// trails-api v1.0.0 04e3b566a4664b522b5144d2c88002fd77dbb760 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'ebcef7106408aa5206a04dd007cb25e18bf014fd' +export const WebrpcSchemaHash = '04e3b566a4664b522b5144d2c88002fd77dbb760' // // Client interface @@ -267,6 +267,10 @@ export interface MetaTxnFeeDetails { feeNative: bigint } +export interface IntentSummary { + intentId: string +} + export interface TokenPrice { token: Token price?: Price @@ -446,7 +450,7 @@ export interface GetIntentTransactionHistoryRequest { } export interface GetIntentTransactionHistoryResponse { - transactions: Array + intents: Array nextPage?: Page } @@ -803,7 +807,6 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { GetIntentGasFeeOptionsRequest: [['params', 'GetIntentEntrypointDepositFeeOptionsParams']], GetIntentReceiptResponse: [['intentReceipt', 'IntentReceipt']], GetIntentResponse: [['intent', 'Intent']], - GetIntentTransactionHistoryResponse: [['transactions', 'IntentTransaction[]']], Intent: [ ['quoteRequest', 'QuoteIntentRequest'], 'destinationSalt', From e084119fbd757e075f029d51f09b9cf924de25b4 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sat, 1 Nov 2025 02:52:52 +0000 Subject: [PATCH 32/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 40 +++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 26f36b2ca..f1af2c5e8 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 04e3b566a4664b522b5144d2c88002fd77dbb760 +// trails-api v1.0.0 005a369b19dfebdb65dde9e0e5ddac91bfc04c44 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '04e3b566a4664b522b5144d2c88002fd77dbb760' +export const WebrpcSchemaHash = '005a369b19dfebdb65dde9e0e5ddac91bfc04c44' // // Client interface @@ -269,6 +269,40 @@ export interface MetaTxnFeeDetails { export interface IntentSummary { intentId: string + status: IntentStatus + ownerAddress: string + originChainId: number + originChainMetadata: ChainMetadata + destinationChainId: number + destinationChainMetadata: ChainMetadata + originIntentAddress: string + destinationIntentAddress: string + depositTransactionHash?: string + depositTransactionStatus: TransactionStatus + originTransactionHash?: string + originTransactionStatus: TransactionStatus + destinationTransactionHash?: string + destinationTransactionStatus: TransactionStatus + originTokenAddress: string + originTokenAmount: bigint + originTokenMetadata: TokenMetadata + destinationTokenAddress: string + destinationTokenAmount: bigint + destinationTokenMetadata: TokenMetadata + updatedAt?: string + createdAt: string +} + +export interface ChainMetadata { + name: string + logoUri?: string +} + +export interface TokenMetadata { + name: string + symbol: string + decimals: number + logoUri?: string } export interface TokenPrice { @@ -807,6 +841,7 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { GetIntentGasFeeOptionsRequest: [['params', 'GetIntentEntrypointDepositFeeOptionsParams']], GetIntentReceiptResponse: [['intentReceipt', 'IntentReceipt']], GetIntentResponse: [['intent', 'Intent']], + GetIntentTransactionHistoryResponse: [['intents', 'IntentSummary[]']], Intent: [ ['quoteRequest', 'QuoteIntentRequest'], 'destinationSalt', @@ -829,6 +864,7 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { ['originTransaction', 'IntentTransaction'], ['destinationTransaction', 'IntentTransaction'] ], + IntentSummary: ['originTokenAmount', 'destinationTokenAmount'], IntentTransaction: ['tokenAmount'], IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']], MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'], From 70b813bb2eebc8f9a548907bb700a385840d2f97 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sun, 2 Nov 2025 02:23:52 +0000 Subject: [PATCH 33/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 60 +++++++++++++++-------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index f1af2c5e8..fd387fcc3 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 005a369b19dfebdb65dde9e0e5ddac91bfc04c44 +// trails-api v1.0.0 0b6de03a213c68572c446338975ad1f080d68655 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '005a369b19dfebdb65dde9e0e5ddac91bfc04c44' +export const WebrpcSchemaHash = '0b6de03a213c68572c446338975ad1f080d68655' // // Client interface @@ -58,6 +58,8 @@ export interface TrailsClient { headers?: object, signal?: AbortSignal ): Promise + + getTokenPrices(req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise } // @@ -272,9 +274,7 @@ export interface IntentSummary { status: IntentStatus ownerAddress: string originChainId: number - originChainMetadata: ChainMetadata destinationChainId: number - destinationChainMetadata: ChainMetadata originIntentAddress: string destinationIntentAddress: string depositTransactionHash?: string @@ -294,37 +294,30 @@ export interface IntentSummary { } export interface ChainMetadata { + chainId: number name: string logoUri?: string + testnet?: boolean } export interface TokenMetadata { + tokenAddress: string name: string symbol: string - decimals: number + decimals?: number logoUri?: string } -export interface TokenPrice { - token: Token - price?: Price - price24hChange?: Price - price24hVol?: Price - floorPrice: Price - buyPrice: Price - sellPrice: Price - updatedAt: string -} - export interface Token { chainId: number tokenAddress: string - tokenId?: string + tokenSymbol?: string } -export interface Price { - value: number - currency: string +export interface TokenPrice { + token: Token + priceUsd?: number + updatedAt: string } export interface CCTPTransfer { @@ -542,6 +535,14 @@ export interface ClockResponse { serverTime: string } +export interface GetTokenPricesRequest { + tokens: Array +} + +export interface GetTokenPricesResponse { + tokenPrices: Array +} + // // Client // @@ -575,7 +576,8 @@ export class Trails implements TrailsClient { getIntentTransactionHistory: (req: GetIntentTransactionHistoryRequest) => ['Trails', 'getIntentTransactionHistory', req] as const, getIntentGasFeeOptions: (req: GetIntentGasFeeOptionsRequest) => ['Trails', 'getIntentGasFeeOptions', req] as const, - getIntentEntryTransaction: (req: GetIntentEntryTransactionRequest) => ['Trails', 'getIntentEntryTransaction', req] as const + getIntentEntryTransaction: (req: GetIntentEntryTransactionRequest) => ['Trails', 'getIntentEntryTransaction', req] as const, + getTokenPrices: (req: GetTokenPricesRequest) => ['Trails', 'getTokenPrices', req] as const } ping = (headers?: object, signal?: AbortSignal): Promise => { @@ -800,6 +802,22 @@ export class Trails implements TrailsClient { } ) } + + getTokenPrices = (req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch( + this.url('GetTokenPrices'), + createHttpRequest(JsonEncode(req, 'GetTokenPricesRequest'), headers, signal) + ).then( + res => { + return buildResponse(res).then(_data => { + return JsonDecode(_data, 'GetTokenPricesResponse') + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) + } + ) + } } const createHttpRequest = (body: string = '{}', headers: object = {}, signal: AbortSignal | null = null): object => { From 4b59bb92add496ee29e234e3a116c80023358293 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:52:14 +0000 Subject: [PATCH 34/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index fd387fcc3..138ecec97 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 0b6de03a213c68572c446338975ad1f080d68655 +// trails-api v1.0.0 6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '0b6de03a213c68572c446338975ad1f080d68655' +export const WebrpcSchemaHash = '6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9' // // Client interface @@ -301,6 +301,7 @@ export interface ChainMetadata { } export interface TokenMetadata { + chainId: number tokenAddress: string name: string symbol: string From ef331f49baba2b4b8f1579e3eecd57d88403d5cb Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Sun, 2 Nov 2025 17:53:37 +0000 Subject: [PATCH 35/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 138ecec97..310ff76ad 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9 +// trails-api v1.0.0 c652c2506895f07c946ff703ae630217360ae825 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '6b5ffa05cd25d7fe78555b8cbc0b193f957c4ed9' +export const WebrpcSchemaHash = 'c652c2506895f07c946ff703ae630217360ae825' // // Client interface @@ -81,6 +81,7 @@ export enum TransactionStatus { UNKNOWN = 'UNKNOWN', PENDING = 'PENDING', RELAYING = 'RELAYING', + RELAYED = 'RELAYED', MINING = 'MINING', SUCCEEDED = 'SUCCEEDED', FAILED = 'FAILED' From 0f759fecaa7ffc0b947ffd0990af8486bdf19dcf Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 3 Nov 2025 01:42:52 +0000 Subject: [PATCH 36/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 310ff76ad..2c78dc764 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 c652c2506895f07c946ff703ae630217360ae825 +// trails-api v1.0.0 a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'c652c2506895f07c946ff703ae630217360ae825' +export const WebrpcSchemaHash = 'a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8' // // Client interface @@ -132,7 +132,7 @@ export interface Intent { destinationSalt: bigint depositTransaction: DepositTransaction calls: Array - preconditions: Array + preconditions: Array metaTxns: Array quote: IntentProviderQuote fees: IntentFees @@ -166,16 +166,12 @@ export interface TransactionCall { behaviorOnError?: number } -export interface IntentPrecondition { +export interface TransactionPrecondition { type: string chainId: number - data: IntentPreconditionData -} - -export interface IntentPreconditionData { - address: string - token: string - min: number + ownerAddress: string + tokenAddress: string + minAmount: bigint } export interface MetaTxn { @@ -210,7 +206,7 @@ export interface IntentTransaction { calldata: string metaTxnId: string metaTxnFeeQuote: string - preconditions: IntentPrecondition + precondition: TransactionPrecondition txnHash?: string status: TransactionStatus statusReason?: string @@ -867,6 +863,7 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { 'destinationSalt', ['depositTransaction', 'DepositTransaction'], ['calls', 'IntentCalls[]'], + ['preconditions', 'TransactionPrecondition[]'], ['quote', 'IntentProviderQuote'], ['fees', 'IntentFees'] ], @@ -885,13 +882,14 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = { ['destinationTransaction', 'IntentTransaction'] ], IntentSummary: ['originTokenAmount', 'destinationTokenAmount'], - IntentTransaction: ['tokenAmount'], + IntentTransaction: ['tokenAmount', ['precondition', 'TransactionPrecondition']], IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']], MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'], QuoteIntentRequest: ['originTokenAmount', 'destinationTokenAmount'], QuoteIntentResponse: [['intent', 'Intent']], SearchIntentsResponse: [['intents', 'Intent[]']], TransactionCall: ['value', 'gasLimit'], + TransactionPrecondition: ['minAmount'], WaitIntentReceiptResponse: [['intentReceipt', 'IntentReceipt']] } From 8365bc3f5133d7577975b878b4ab6235c6f1c944 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Mon, 3 Nov 2025 22:22:22 +0000 Subject: [PATCH 37/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 166 ++++++---------------- 1 file changed, 47 insertions(+), 119 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 2c78dc764..87d237f05 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8 +// trails-api v1.0.0 c41075ba78dccc2053a45ec888ac7d356d6f42a9 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'a60c9fc27cb40ddf164c57c9c9e3ae85ad3a4ce8' +export const WebrpcSchemaHash = 'c41075ba78dccc2053a45ec888ac7d356d6f42a9' // // Client interface @@ -47,18 +47,6 @@ export interface TrailsClient { signal?: AbortSignal ): Promise - getIntentGasFeeOptions( - req: GetIntentGasFeeOptionsRequest, - headers?: object, - signal?: AbortSignal - ): Promise - - getIntentEntryTransaction( - req: GetIntentEntryTransactionRequest, - headers?: object, - signal?: AbortSignal - ): Promise - getTokenPrices(req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise } @@ -188,8 +176,7 @@ export interface IntentReceipt { ownerAddress: string originChainId: number destinationChainId: number - depositTransactionHash: string - depositTransactionStatus: TransactionStatus + depositTransaction: IntentTransaction originTransaction: IntentTransaction destinationTransaction: IntentTransaction updatedAt?: string @@ -203,10 +190,10 @@ export interface IntentTransaction { toAddress: string tokenAddress: string tokenAmount: bigint - calldata: string - metaTxnId: string - metaTxnFeeQuote: string - precondition: TransactionPrecondition + metaTxnId?: string + metaTxnFeeQuote?: string + precondition?: TransactionPrecondition + depositIntentEntry?: DepositIntentEntry txnHash?: string status: TransactionStatus statusReason?: string @@ -330,41 +317,11 @@ export interface CCTPTransfer { createdAt?: string } -export interface GetIntentEntrypointDepositParams { - userAddress: string - tokenAddress: string - amount: bigint - intentAddress: string - chainID: number - deadline: number - intentSignature: string - usePermit?: boolean - permitAmount?: bigint - permitDeadline?: number - permitSignature?: string - feeAmount?: bigint -} - -export interface GetIntentEntrypointDepositResult { - depositWalletAddress: string - metaTxn: MetaTxn - feeQuote: string - entrypointAddress: string -} - -export interface GetIntentEntrypointDepositFeeOptionsParams { - userAddress: string - tokenAddress: string - intentAddress: string - amount: bigint - chainID: number -} - -export interface GetIntentEntrypointDepositFeeOptionsResult { +export interface GasFeeOptions { gasEstimate: GasEstimate feeOptions: Array - expiresAt: number - feeCollector: string + expiresAt: string + feeCollectorAddress: string } export interface GasEstimate { @@ -378,9 +335,31 @@ export interface FeeOption { tokenAddress: string tokenSymbol: string tokenDecimals: number - amount: string + amount: bigint amountUsd: number + feeCollectorAddress: string +} + +export interface DepositSignature { + intentSignature: string + permitSignature?: string + permitDeadline?: number + permitAmount?: bigint + selectedGasFeeOption: FeeOption + userNonce: number + deadline: number +} + +export interface DepositIntentEntry { + intentSignature: string + permitSignature?: string + permitDeadline?: number + permitAmount?: bigint + feeAmount: string + feeToken: string feeCollector: string + userNonce: number + deadline: number } export interface TrailsAddressOverrides { @@ -415,6 +394,7 @@ export interface RuntimeStatus { export interface QuoteIntentResponse { intent: Intent + gasFeeOptions: GasFeeOptions } export interface CommitIntentRequest { @@ -427,7 +407,8 @@ export interface CommitIntentResponse { export interface ExecuteIntentRequest { intentId: string - depositTransactionHash: string + depositTransactionHash?: string + depositSignature?: DepositSignature } export interface ExecuteIntentResponse { @@ -479,22 +460,6 @@ export interface GetIntentTransactionHistoryResponse { nextPage?: Page } -export interface GetIntentGasFeeOptionsRequest { - params: GetIntentEntrypointDepositFeeOptionsParams -} - -export interface GetIntentGasFeeOptionsResponse { - result: GetIntentEntrypointDepositFeeOptionsResult -} - -export interface GetIntentEntryTransactionRequest { - params: GetIntentEntrypointDepositParams -} - -export interface GetIntentEntryTransactionResponse { - result: GetIntentEntrypointDepositResult -} - export interface Page { column?: string before?: any @@ -573,8 +538,6 @@ export class Trails implements TrailsClient { searchIntents: (req: SearchIntentsRequest) => ['Trails', 'searchIntents', req] as const, getIntentTransactionHistory: (req: GetIntentTransactionHistoryRequest) => ['Trails', 'getIntentTransactionHistory', req] as const, - getIntentGasFeeOptions: (req: GetIntentGasFeeOptionsRequest) => ['Trails', 'getIntentGasFeeOptions', req] as const, - getIntentEntryTransaction: (req: GetIntentEntryTransactionRequest) => ['Trails', 'getIntentEntryTransaction', req] as const, getTokenPrices: (req: GetTokenPricesRequest) => ['Trails', 'getTokenPrices', req] as const } @@ -761,46 +724,6 @@ export class Trails implements TrailsClient { ) } - getIntentGasFeeOptions = ( - req: GetIntentGasFeeOptionsRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('GetIntentGasFeeOptions'), - createHttpRequest(JsonEncode(req, 'GetIntentGasFeeOptionsRequest'), headers, signal) - ).then( - res => { - return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentGasFeeOptionsResponse') - }) - }, - error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) - } - ) - } - - getIntentEntryTransaction = ( - req: GetIntentEntryTransactionRequest, - headers?: object, - signal?: AbortSignal - ): Promise => { - return this.fetch( - this.url('GetIntentEntryTransaction'), - createHttpRequest(JsonEncode(req, 'GetIntentEntryTransactionRequest'), headers, signal) - ).then( - res => { - return buildResponse(res).then(_data => { - return JsonDecode(_data, 'GetIntentEntryTransactionResponse') - }) - }, - error => { - throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` }) - } - ) - } - getTokenPrices = (req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise => { return this.fetch( this.url('GetTokenPrices'), @@ -850,11 +773,12 @@ export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise Date: Tue, 4 Nov 2025 01:28:38 +0000 Subject: [PATCH 38/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 87d237f05..152be0fde 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 c41075ba78dccc2053a45ec888ac7d356d6f42a9 +// trails-api v1.0.0 8f454c95cc0ada33868332c071b18e9dfed9c389 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'c41075ba78dccc2053a45ec888ac7d356d6f42a9' +export const WebrpcSchemaHash = '8f454c95cc0ada33868332c071b18e9dfed9c389' // // Client interface From d48fe1053a6730ce9b14ff6e567dff08a0b4d712 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 4 Nov 2025 02:03:50 +0000 Subject: [PATCH 39/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 152be0fde..31c485da8 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 8f454c95cc0ada33868332c071b18e9dfed9c389 +// trails-api v1.0.0 fb8c387446f202180d13383089d42cc09891df9e // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '8f454c95cc0ada33868332c071b18e9dfed9c389' +export const WebrpcSchemaHash = 'fb8c387446f202180d13383089d42cc09891df9e' // // Client interface From 026427d33d8e3ff45d10fbe823d5e4e17dcda0c0 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:42:38 +0000 Subject: [PATCH 40/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 31c485da8..492758957 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 fb8c387446f202180d13383089d42cc09891df9e +// trails-api v1.0.0 5466ab4ac18cc3dba87474e761c45420d9a0d137 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'fb8c387446f202180d13383089d42cc09891df9e' +export const WebrpcSchemaHash = '5466ab4ac18cc3dba87474e761c45420d9a0d137' // // Client interface @@ -195,6 +195,7 @@ export interface IntentTransaction { precondition?: TransactionPrecondition depositIntentEntry?: DepositIntentEntry txnHash?: string + txnMinedAt?: string status: TransactionStatus statusReason?: string updatedAt?: string From 44f4e48142b0c3a698ec4b86f27a441f2a4cd524 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 02:13:28 +0000 Subject: [PATCH 41/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 492758957..516fb12e7 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 5466ab4ac18cc3dba87474e761c45420d9a0d137 +// trails-api v1.0.0 dde1603b363889099a3f3af5ca2dac9a0937cf7a // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '5466ab4ac18cc3dba87474e761c45420d9a0d137' +export const WebrpcSchemaHash = 'dde1603b363889099a3f3af5ca2dac9a0937cf7a' // // Client interface From 9c6b286575c9bbab1fc5fd3c3a455709dd9ac596 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 16:34:28 +0000 Subject: [PATCH 42/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 516fb12e7..d7cf7196a 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 dde1603b363889099a3f3af5ca2dac9a0937cf7a +// trails-api v1.0.0 cbd6d970d0d38194195eb3409777b9ef67cd0714 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'dde1603b363889099a3f3af5ca2dac9a0937cf7a' +export const WebrpcSchemaHash = 'cbd6d970d0d38194195eb3409777b9ef67cd0714' // // Client interface @@ -67,12 +67,14 @@ export enum QuoteProviderType { export enum TransactionStatus { UNKNOWN = 'UNKNOWN', + ON_HOLD = 'ON_HOLD', PENDING = 'PENDING', RELAYING = 'RELAYING', - RELAYED = 'RELAYED', + SENT = 'SENT', MINING = 'MINING', SUCCEEDED = 'SUCCEEDED', - FAILED = 'FAILED' + FAILED = 'FAILED', + ABORTED = 'ABORTED' } export enum IntentStatus { From ee67b75528db9220dfdba05c51bf70ed973a7096 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 16:56:39 +0000 Subject: [PATCH 43/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index d7cf7196a..b1fb24ee1 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 cbd6d970d0d38194195eb3409777b9ef67cd0714 +// trails-api v1.0.0 ceebf8def1df165f16d66ce5580c84fe2375c8b6 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'cbd6d970d0d38194195eb3409777b9ef67cd0714' +export const WebrpcSchemaHash = 'ceebf8def1df165f16d66ce5580c84fe2375c8b6' // // Client interface @@ -180,7 +180,7 @@ export interface IntentReceipt { destinationChainId: number depositTransaction: IntentTransaction originTransaction: IntentTransaction - destinationTransaction: IntentTransaction + destinationTransaction?: IntentTransaction updatedAt?: string createdAt?: string } From 7da9c731927257d630f729f4b40245e3c1be18fb Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Wed, 5 Nov 2025 18:17:20 +0000 Subject: [PATCH 44/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index b1fb24ee1..640d7906e 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 ceebf8def1df165f16d66ce5580c84fe2375c8b6 +// trails-api v1.0.0 8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'ceebf8def1df165f16d66ce5580c84fe2375c8b6' +export const WebrpcSchemaHash = '8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad' // // Client interface From a180f30be780cceef311d1cecb5a2031ab747ac6 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Thu, 6 Nov 2025 11:50:27 +0000 Subject: [PATCH 45/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 640d7906e..83a0334e3 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad +// trails-api v1.0.0 8a39e1f88ba87651e7acb6b8c27fc6682f072eac // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '8b03dcc1b34a3d96a39a3ad70e863e7e1e1a42ad' +export const WebrpcSchemaHash = '8a39e1f88ba87651e7acb6b8c27fc6682f072eac' // // Client interface @@ -393,6 +393,14 @@ export interface RuntimeStatus { branch: string commitHash: string runnables: any + services: Array +} + +export interface ServiceStatus { + name: string + healthy: boolean + error?: string + latency: string } export interface QuoteIntentResponse { From 2e96b29f6022ba36bb64c5e3122ad15ba6da6a72 Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 6 Nov 2025 13:49:58 +0000 Subject: [PATCH 46/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 83a0334e3..d59d74deb 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 8a39e1f88ba87651e7acb6b8c27fc6682f072eac +// trails-api v1.0.0 b7052858fd352cc9ed13923cfd40d354519988a5 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '8a39e1f88ba87651e7acb6b8c27fc6682f072eac' +export const WebrpcSchemaHash = 'b7052858fd352cc9ed13923cfd40d354519988a5' // // Client interface @@ -453,8 +453,9 @@ export interface GetIntentResponse { } export interface SearchIntentsRequest { + byIntentId?: string byOriginIntentAddress?: string - byDepositTransactionHash?: string + byTransactionHash?: string byOwnerAddress?: string } From 3c5b128a6908979d4b3c054e550ebe59dcdf60be Mon Sep 17 00:00:00 2001 From: taylanpince <12650+taylanpince@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:37:19 +0000 Subject: [PATCH 47/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index d59d74deb..fdb03eee6 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 b7052858fd352cc9ed13923cfd40d354519988a5 +// trails-api v1.0.0 9595a664b9e921548f098c902f79fb5365501005 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = 'b7052858fd352cc9ed13923cfd40d354519988a5' +export const WebrpcSchemaHash = '9595a664b9e921548f098c902f79fb5365501005' // // Client interface @@ -454,9 +454,10 @@ export interface GetIntentResponse { export interface SearchIntentsRequest { byIntentId?: string - byOriginIntentAddress?: string + byProjectId?: number byTransactionHash?: string byOwnerAddress?: string + byOriginIntentAddress?: string } export interface SearchIntentsResponse { @@ -465,6 +466,8 @@ export interface SearchIntentsResponse { export interface GetIntentTransactionHistoryRequest { page?: Page + byProjectId?: number + byOwnerAddress?: string } export interface GetIntentTransactionHistoryResponse { From 4b3ff9220a18f9fba52c51fabeb74c4cd48e53a7 Mon Sep 17 00:00:00 2001 From: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Date: Thu, 6 Nov 2025 19:20:46 +0000 Subject: [PATCH 48/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index fdb03eee6..1f20d9be5 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 9595a664b9e921548f098c902f79fb5365501005 +// trails-api v1.0.0 14a0ef58105c745d01c3dadffec0f5a4274977b9 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '9595a664b9e921548f098c902f79fb5365501005' +export const WebrpcSchemaHash = '14a0ef58105c745d01c3dadffec0f5a4274977b9' // // Client interface @@ -71,6 +71,7 @@ export enum TransactionStatus { PENDING = 'PENDING', RELAYING = 'RELAYING', SENT = 'SENT', + ERRORED = 'ERRORED', MINING = 'MINING', SUCCEEDED = 'SUCCEEDED', FAILED = 'FAILED', From ffc6f4445cd7a17f5e6e802467d91a12e5663d1d Mon Sep 17 00:00:00 2001 From: pkieltyka <18831+pkieltyka@users.noreply.github.com> Date: Thu, 6 Nov 2025 19:26:01 +0000 Subject: [PATCH 49/49] [AUTOMATED] Update: proto/clients/trails-api.gen.ts --- packages/trails-api/src/trails-api.gen.ts | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/trails-api/src/trails-api.gen.ts b/packages/trails-api/src/trails-api.gen.ts index 1f20d9be5..89fa5435c 100644 --- a/packages/trails-api/src/trails-api.gen.ts +++ b/packages/trails-api/src/trails-api.gen.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// trails-api v1.0.0 14a0ef58105c745d01c3dadffec0f5a4274977b9 +// trails-api v1.0.0 3926f2d1e537951cf40a23f389d5e2fd67138d85 // -- // Code generated by Webrpc-gen@v0.30.2 with typescript generator. DO NOT EDIT. // @@ -12,7 +12,7 @@ export const WebrpcVersion = 'v1' export const WebrpcSchemaVersion = 'v1.0.0' // Schema hash generated from your RIDL schema -export const WebrpcSchemaHash = '14a0ef58105c745d01c3dadffec0f5a4274977b9' +export const WebrpcSchemaHash = '3926f2d1e537951cf40a23f389d5e2fd67138d85' // // Client interface @@ -1422,6 +1422,18 @@ export class UnsupportedNetworkError extends WebrpcError { } } +export class IntentsDisabledError extends WebrpcError { + constructor(error: WebrpcErrorParams = {}) { + super(error) + this.name = error.name || 'IntentsDisabled' + this.code = typeof error.code === 'number' ? error.code : 9000 + this.message = error.message || `Intents service is currently unavailable` + this.status = typeof error.status === 'number' ? error.status : 400 + if (error.cause !== undefined) this.cause = error.cause + Object.setPrototypeOf(this, IntentsDisabledError.prototype) + } +} + export enum errors { WebrpcEndpoint = 'WebrpcEndpoint', WebrpcRequestFailed = 'WebrpcRequestFailed', @@ -1460,7 +1472,8 @@ export enum errors { QueryFailed = 'QueryFailed', IntentStatus = 'IntentStatus', NotFound = 'NotFound', - UnsupportedNetwork = 'UnsupportedNetwork' + UnsupportedNetwork = 'UnsupportedNetwork', + IntentsDisabled = 'IntentsDisabled' } export enum WebrpcErrorCodes { @@ -1501,7 +1514,8 @@ export enum WebrpcErrorCodes { QueryFailed = 2003, IntentStatus = 2004, NotFound = 8000, - UnsupportedNetwork = 8008 + UnsupportedNetwork = 8008, + IntentsDisabled = 9000 } export const webrpcErrorByCode: { [code: number]: any } = { @@ -1542,7 +1556,8 @@ export const webrpcErrorByCode: { [code: number]: any } = { [2003]: QueryFailedError, [2004]: IntentStatusError, [8000]: NotFoundError, - [8008]: UnsupportedNetworkError + [8008]: UnsupportedNetworkError, + [9000]: IntentsDisabledError } //