@0xtrails/api 0.9.4 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xtrails/api",
3
- "version": "0.9.4",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Trails API Client SDK",
6
6
  "repository": "https://github.com/0xsequence/trails/tree/master/packages/trails-api",
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable */
2
- // trails-api v1-25.12.24-aa15bcd 894b96262ee91cc331115b7f7aaeb656c8d7b55d
2
+ // trails-api v1 9923827ab0683bd37e4aa9e713fa728b4c930297
3
3
  // --
4
- // Code generated by Webrpc-gen@v0.31.3 with typescript generator. DO NOT EDIT.
4
+ // Code generated by Webrpc-gen@v0.32.2 with typescript generator. DO NOT EDIT.
5
5
  //
6
6
  // webrpc-gen -schema=trails-api.ridl -target=typescript -client -service=Trails -methodTreeShake -ignore=@onramp -out=./clients/trails-api.gen.ts
7
7
 
@@ -9,10 +9,10 @@
9
9
  export const WebrpcVersion = 'v1'
10
10
 
11
11
  // Schema version of your RIDL schema
12
- export const WebrpcSchemaVersion = 'v1-25.12.24-aa15bcd'
12
+ export const WebrpcSchemaVersion = 'v1'
13
13
 
14
14
  // Schema hash generated from your RIDL schema
15
- export const WebrpcSchemaHash = '894b96262ee91cc331115b7f7aaeb656c8d7b55d'
15
+ export const WebrpcSchemaHash = '9923827ab0683bd37e4aa9e713fa728b4c930297'
16
16
 
17
17
  //
18
18
  // Client interface
@@ -100,11 +100,32 @@ export interface TrailsClient {
100
100
  */
101
101
  getTokenPrices(req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPricesResponse>
102
102
 
103
+ /**
104
+ * GetExchangeRate returns the exchange rate from USD to a specified currency.
105
+ */
106
+ getExchangeRate(req: GetExchangeRateRequest, headers?: object, signal?: AbortSignal): Promise<GetExchangeRateResponse>
107
+
108
+ /**
109
+ * GetCountryList returns the list of supported countries for onramp providers.
110
+ */
111
+ getCountryList(headers?: object, signal?: AbortSignal): Promise<GetCountryListResponse>
112
+
103
113
  /**
104
114
  * GetTrailsContracts returns Trails contract addresses used by the Trails Intents stack.
105
115
  */
106
116
  getTrailsContracts(headers?: object, signal?: AbortSignal): Promise<GetTrailsContractsResponse>
107
117
 
118
+ /**
119
+ * GetEarnPools returns aggregated pool information from DeFi protocols (Aave, Morpho).
120
+ * This endpoint provides yield-bearing opportunities across multiple chains.
121
+ */
122
+ getEarnPools(req: GetEarnPoolsRequest, headers?: object, signal?: AbortSignal): Promise<GetEarnPoolsResponse>
123
+
124
+ /**
125
+ * GetFiatCurrencyList returns the list of supported fiat currencies for display preferences.
126
+ */
127
+ getFiatCurrencyList(headers?: object, signal?: AbortSignal): Promise<GetFiatCurrencyListResponse>
128
+
108
129
  /**
109
130
  * @deprecated please use GetIntentHistory instead
110
131
  */
@@ -130,9 +151,17 @@ export enum RouteProvider {
130
151
  LIFI = 'LIFI',
131
152
  RELAY = 'RELAY',
132
153
  SUSHI = 'SUSHI',
154
+ WETH = 'WETH',
133
155
  ZEROX = 'ZEROX'
134
156
  }
135
157
 
158
+ export enum FundMethod {
159
+ WALLET = 'WALLET',
160
+ DIRECT_TRANSFER = 'DIRECT_TRANSFER',
161
+ ONRAMP_MESH = 'ONRAMP_MESH',
162
+ ONRAMP_MELD = 'ONRAMP_MELD'
163
+ }
164
+
136
165
  export enum IntentStatus {
137
166
  QUOTED = 'QUOTED',
138
167
  COMMITTED = 'COMMITTED',
@@ -148,7 +177,8 @@ export enum TransactionType {
148
177
  DEPOSIT = 'DEPOSIT',
149
178
  ORIGIN = 'ORIGIN',
150
179
  DESTINATION = 'DESTINATION',
151
- ROUTE = 'ROUTE'
180
+ ROUTE = 'ROUTE',
181
+ REFUND = 'REFUND'
152
182
  }
153
183
 
154
184
  export enum TransactionContext {
@@ -185,6 +215,16 @@ export enum CCTPTransferStatus {
185
215
  FAILED = 'FAILED'
186
216
  }
187
217
 
218
+ export enum RelayTransferStatus {
219
+ UNKNOWN = 'UNKNOWN',
220
+ ON_HOLD = 'ON_HOLD',
221
+ PENDING = 'PENDING',
222
+ FETCHING = 'FETCHING',
223
+ COMPLETE = 'COMPLETE',
224
+ REFUNDED = 'REFUNDED',
225
+ FAILED = 'FAILED'
226
+ }
227
+
188
228
  export interface QuoteIntentRequest {
189
229
  ownerAddress: string
190
230
  originChainId: number
@@ -197,6 +237,7 @@ export interface QuoteIntentRequest {
197
237
  originTokenAmount?: bigint
198
238
  destinationTokenAmount?: bigint
199
239
  tradeType?: TradeType
240
+ fundMethod?: FundMethod
200
241
  onlyNativeGasFee?: boolean
201
242
  options?: QuoteIntentRequestOptions
202
243
  }
@@ -208,6 +249,12 @@ export interface QuoteIntentRequestOptions {
208
249
  trailsAddressOverrides?: TrailsAddressOverrides
209
250
  }
210
251
 
252
+ export interface PassthroughInfo {
253
+ eligible: boolean
254
+ passthroughTransaction?: PassThroughTransaction
255
+ transactionStates?: Array<TransactionStateInfo>
256
+ }
257
+
211
258
  export interface Intent {
212
259
  intentId: string
213
260
  status: IntentStatus
@@ -219,6 +266,7 @@ export interface Intent {
219
266
  destinationIntentAddress?: string
220
267
  salt: bigint
221
268
  depositTransaction: DepositTransaction
269
+ passthrough?: boolean
222
270
  originCalls: IntentCalls
223
271
  destinationCalls?: IntentCalls
224
272
  originPrecondition: TransactionPrecondition
@@ -239,6 +287,27 @@ export interface DepositTransaction {
239
287
  tokenAddress: string
240
288
  decimals?: number
241
289
  amount: bigint
290
+ chainId: number
291
+ to: string
292
+ data: string
293
+ value: bigint
294
+ }
295
+
296
+ export interface PassThroughTransaction {
297
+ toAddress: string
298
+ tokenAddress: string
299
+ decimals?: number
300
+ amount: bigint
301
+ chainId: number
302
+ to: string
303
+ data: string
304
+ value: bigint
305
+ }
306
+
307
+ export interface TransactionStateInfo {
308
+ id: string
309
+ label: string
310
+ chainId: number
242
311
  }
243
312
 
244
313
  export interface IntentCalls {
@@ -318,6 +387,7 @@ export interface IntentReceipt {
318
387
  depositTransaction: IntentTransaction
319
388
  originTransaction: IntentTransaction
320
389
  destinationTransaction?: IntentTransaction
390
+ refundTransaction?: IntentTransaction
321
391
  summary: IntentReceiptSummary
322
392
  updatedAt?: string
323
393
  createdAt?: string
@@ -480,6 +550,14 @@ export interface TokenPrice {
480
550
  updatedAt: string
481
551
  }
482
552
 
553
+ export interface ExchangeRate {
554
+ name: string
555
+ symbol: string
556
+ value: number
557
+ vsCurrency: string
558
+ currencyType: string
559
+ }
560
+
483
561
  export interface CCTPTransfer {
484
562
  id: number
485
563
  intentId: string
@@ -496,6 +574,21 @@ export interface CCTPTransfer {
496
574
  updatedAt: string
497
575
  }
498
576
 
577
+ export interface RelayTransfer {
578
+ id: number
579
+ intentId: string
580
+ originChainId: number
581
+ destinationChainId: number
582
+ originTxnId: number
583
+ originTxnHash: string
584
+ destinationTxnId: number
585
+ destinationTxnHash: string
586
+ status: number
587
+ statusReason?: string
588
+ createdAt: string
589
+ updatedAt: string
590
+ }
591
+
499
592
  export interface GasFeeOptions {
500
593
  gasEstimate: GasEstimate
501
594
  feeOptions: Array<FeeOption>
@@ -518,6 +611,7 @@ export interface FeeOption {
518
611
  amountUsd: number
519
612
  feeCollectorAddress: string
520
613
  is2612: boolean
614
+ isPassthroughEligible?: boolean
521
615
  }
522
616
 
523
617
  export interface DepositSignature {
@@ -579,6 +673,50 @@ export interface TokenInfo {
579
673
  featured: boolean
580
674
  }
581
675
 
676
+ export interface EarnPool {
677
+ id: string
678
+ name: string
679
+ protocol: string
680
+ chainId: number
681
+ apy: number
682
+ tvl: number
683
+ token: PoolTokenInfo
684
+ depositAddress: string
685
+ isActive: boolean
686
+ poolUrl?: string
687
+ protocolUrl?: string
688
+ wrappedTokenGatewayAddress?: string
689
+ }
690
+
691
+ export interface PoolTokenInfo {
692
+ symbol: string
693
+ name: string
694
+ address: string
695
+ decimals: number
696
+ logoUrl?: string
697
+ }
698
+
699
+ export interface CountryRegion {
700
+ regionCode: string
701
+ name: string
702
+ }
703
+
704
+ export interface Country {
705
+ countryCode: string
706
+ name: string
707
+ flag: string
708
+ flagImageUrl: string
709
+ regions?: Array<CountryRegion>
710
+ }
711
+
712
+ export interface FiatCurrency {
713
+ code: string
714
+ symbol: string
715
+ name: string
716
+ flag: string
717
+ decimals: number
718
+ }
719
+
582
720
  export interface MeldQuote {
583
721
  transactionType: string
584
722
  sourceAmount: number
@@ -628,6 +766,8 @@ export interface ServiceStatus {
628
766
  export interface QuoteIntentResponse {
629
767
  intent: Intent
630
768
  gasFeeOptions: GasFeeOptions
769
+ transactionStates?: Array<TransactionStateInfo>
770
+ passthrough?: PassthroughInfo
631
771
  }
632
772
 
633
773
  export interface CommitIntentRequest {
@@ -765,6 +905,19 @@ export interface GetTokenListResponse {
765
905
  tokens: Array<TokenInfo>
766
906
  }
767
907
 
908
+ export interface GetEarnPoolsRequest {
909
+ chainIds?: Array<number>
910
+ protocols?: Array<string>
911
+ minTvl?: number
912
+ maxApy?: number
913
+ }
914
+
915
+ export interface GetEarnPoolsResponse {
916
+ pools: Array<EarnPool>
917
+ timestamp: string
918
+ cached: boolean
919
+ }
920
+
768
921
  export interface Page {
769
922
  column?: string
770
923
  before?: number
@@ -808,12 +961,32 @@ export interface ClockResponse {
808
961
  serverTime: string
809
962
  }
810
963
 
964
+ export interface GetExchangeRateRequest {
965
+ toCurrency: string
966
+ }
967
+
968
+ export interface GetExchangeRateResponse {
969
+ exchangeRate: ExchangeRate
970
+ }
971
+
972
+ export interface GetCountryListRequest {}
973
+
974
+ export interface GetCountryListResponse {
975
+ countries: Array<Country>
976
+ }
977
+
811
978
  export interface GetTrailsContractsRequest {}
812
979
 
813
980
  export interface GetTrailsContractsResponse {
814
981
  TrailsContracts: TrailsContracts
815
982
  }
816
983
 
984
+ export interface GetFiatCurrencyListRequest {}
985
+
986
+ export interface GetFiatCurrencyListResponse {
987
+ currencies: Array<FiatCurrency>
988
+ }
989
+
817
990
  //
818
991
  // Client
819
992
  //
@@ -850,7 +1023,11 @@ export class Trails implements TrailsClient {
850
1023
  getExactInputRoutes: (req: GetExactInputRoutesRequest) => ['Trails', 'getExactInputRoutes', req] as const,
851
1024
  getTokenList: (req: GetTokenListRequest) => ['Trails', 'getTokenList', req] as const,
852
1025
  getTokenPrices: (req: GetTokenPricesRequest) => ['Trails', 'getTokenPrices', req] as const,
1026
+ getExchangeRate: (req: GetExchangeRateRequest) => ['Trails', 'getExchangeRate', req] as const,
1027
+ getCountryList: () => ['Trails', 'getCountryList'] as const,
853
1028
  getTrailsContracts: () => ['Trails', 'getTrailsContracts'] as const,
1029
+ getEarnPools: (req: GetEarnPoolsRequest) => ['Trails', 'getEarnPools', req] as const,
1030
+ getFiatCurrencyList: () => ['Trails', 'getFiatCurrencyList'] as const,
854
1031
  getIntentTransactionHistory: (req: GetIntentTransactionHistoryRequest) =>
855
1032
  ['Trails', 'getIntentTransactionHistory', req] as const
856
1033
  }
@@ -1096,6 +1273,32 @@ export class Trails implements TrailsClient {
1096
1273
  )
1097
1274
  }
1098
1275
 
1276
+ getExchangeRate = (req: GetExchangeRateRequest, headers?: object, signal?: AbortSignal): Promise<GetExchangeRateResponse> => {
1277
+ return this.fetch(this.url('GetExchangeRate'), createHttpRequest(JsonEncode(req), headers, signal)).then(
1278
+ res => {
1279
+ return buildResponse(res).then(_data => {
1280
+ return JsonDecode<GetExchangeRateResponse>(_data, 'GetExchangeRateResponse')
1281
+ })
1282
+ },
1283
+ error => {
1284
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
1285
+ }
1286
+ )
1287
+ }
1288
+
1289
+ getCountryList = (headers?: object, signal?: AbortSignal): Promise<GetCountryListResponse> => {
1290
+ return this.fetch(this.url('GetCountryList'), createHttpRequest('{}', headers, signal)).then(
1291
+ res => {
1292
+ return buildResponse(res).then(_data => {
1293
+ return JsonDecode<GetCountryListResponse>(_data, 'GetCountryListResponse')
1294
+ })
1295
+ },
1296
+ error => {
1297
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
1298
+ }
1299
+ )
1300
+ }
1301
+
1099
1302
  getTrailsContracts = (headers?: object, signal?: AbortSignal): Promise<GetTrailsContractsResponse> => {
1100
1303
  return this.fetch(this.url('GetTrailsContracts'), createHttpRequest('{}', headers, signal)).then(
1101
1304
  res => {
@@ -1109,6 +1312,32 @@ export class Trails implements TrailsClient {
1109
1312
  )
1110
1313
  }
1111
1314
 
1315
+ getEarnPools = (req: GetEarnPoolsRequest, headers?: object, signal?: AbortSignal): Promise<GetEarnPoolsResponse> => {
1316
+ return this.fetch(this.url('GetEarnPools'), createHttpRequest(JsonEncode(req), headers, signal)).then(
1317
+ res => {
1318
+ return buildResponse(res).then(_data => {
1319
+ return JsonDecode<GetEarnPoolsResponse>(_data, 'GetEarnPoolsResponse')
1320
+ })
1321
+ },
1322
+ error => {
1323
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
1324
+ }
1325
+ )
1326
+ }
1327
+
1328
+ getFiatCurrencyList = (headers?: object, signal?: AbortSignal): Promise<GetFiatCurrencyListResponse> => {
1329
+ return this.fetch(this.url('GetFiatCurrencyList'), createHttpRequest('{}', headers, signal)).then(
1330
+ res => {
1331
+ return buildResponse(res).then(_data => {
1332
+ return JsonDecode<GetFiatCurrencyListResponse>(_data, 'GetFiatCurrencyListResponse')
1333
+ })
1334
+ },
1335
+ error => {
1336
+ throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
1337
+ }
1338
+ )
1339
+ }
1340
+
1112
1341
  getIntentTransactionHistory = (
1113
1342
  req: GetIntentTransactionHistoryRequest,
1114
1343
  headers?: object,
@@ -1165,7 +1394,7 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = {
1165
1394
  CommitIntentRequest: [['intent', 'Intent']],
1166
1395
  DepositIntentEntry: ['permitAmount'],
1167
1396
  DepositSignature: ['permitAmount', ['selectedGasFeeOption', 'FeeOption']],
1168
- DepositTransaction: ['amount'],
1397
+ DepositTransaction: ['amount', 'value'],
1169
1398
  ExecuteIntentRequest: [['depositSignature', 'DepositSignature']],
1170
1399
  FeeOption: ['amount'],
1171
1400
  GasFeeOptions: [['feeOptions', 'FeeOption[]']],
@@ -1204,6 +1433,7 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = {
1204
1433
  ['depositTransaction', 'IntentTransaction'],
1205
1434
  ['originTransaction', 'IntentTransaction'],
1206
1435
  ['destinationTransaction', 'IntentTransaction'],
1436
+ ['refundTransaction', 'IntentTransaction'],
1207
1437
  ['summary', 'IntentReceiptSummary']
1208
1438
  ],
1209
1439
  IntentReceiptSummary: ['originTokenAmount', 'destinationTokenAmount'],
@@ -1211,10 +1441,13 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = {
1211
1441
  IntentTransaction: ['tokenAmount', ['precondition', 'TransactionPrecondition'], ['depositIntentEntry', 'DepositIntentEntry']],
1212
1442
  IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']],
1213
1443
  MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'],
1444
+ PassThroughTransaction: ['amount', 'value'],
1445
+ PassthroughInfo: [['passthroughTransaction', 'PassThroughTransaction']],
1214
1446
  QuoteIntentRequest: ['destinationCallValue', 'originTokenAmount', 'destinationTokenAmount'],
1215
1447
  QuoteIntentResponse: [
1216
1448
  ['intent', 'Intent'],
1217
- ['gasFeeOptions', 'GasFeeOptions']
1449
+ ['gasFeeOptions', 'GasFeeOptions'],
1450
+ ['passthrough', 'PassthroughInfo']
1218
1451
  ],
1219
1452
  SearchIntentsResponse: [['intents', 'Intent[]']],
1220
1453
  TransactionCall: ['value', 'gasLimit'],
@@ -1971,7 +2204,7 @@ export const webrpcErrorByCode: { [code: number]: any } = {
1971
2204
 
1972
2205
  export const WebrpcHeader = 'Webrpc'
1973
2206
 
1974
- export const WebrpcHeaderValue = 'webrpc@v0.31.3;gen-typescript@v0.23.1;trails-api@v1-25.12.24-aa15bcd'
2207
+ export const WebrpcHeaderValue = 'webrpc@v0.32.2;gen-typescript@v0.23.1;trails-api@v1'
1975
2208
 
1976
2209
  type WebrpcGenVersions = {
1977
2210
  WebrpcGenVersion: string