0xtrails 0.8.0 → 0.8.2

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",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "SDK for Trails",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "@0xsequence/hooks": "5.4.4",
27
27
  "@0xsequence/indexer": "3.0.0-beta.4",
28
28
  "@0xsequence/wallet-primitives": "^0.0.0-20250917144328",
29
- "@0xtrails/api": "^0.8.0",
29
+ "@0xtrails/api": "^0.8.1",
30
30
  "@databeat/tracker": "0.9.3",
31
31
  "@radix-ui/react-tooltip": "1.2.8",
32
32
  "@tanstack/react-query": "5.90.3",
package/src/chains.ts CHANGED
@@ -310,12 +310,29 @@ export function getChainInfo(
310
310
  },
311
311
  ): Chain | null {
312
312
  if (!chainId) return null
313
- const chainInfo =
313
+ const foundChain =
314
314
  getAllChains().find((chain: Chain) => chain.id === chainId) || null
315
315
 
316
- // Use Sequence RPC by default. We'll want to use public RPC when adding chains to user's metamask wallet.
316
+ if (!foundChain) return null
317
+
318
+ // Clone the chain object to avoid mutating the original viem chain objects
319
+ // This is important because we may modify rpcUrls and blockExplorers
320
+ const chainInfo: Chain = {
321
+ ...foundChain,
322
+ rpcUrls: {
323
+ default: { ...foundChain.rpcUrls.default },
324
+ public: foundChain.rpcUrls.public
325
+ ? { ...foundChain.rpcUrls.public }
326
+ : { ...foundChain.rpcUrls.default },
327
+ },
328
+ blockExplorers: foundChain.blockExplorers
329
+ ? { ...foundChain.blockExplorers }
330
+ : undefined,
331
+ }
332
+
333
+ // Use Sequence RPC by default. Only use public RPC when adding chains to user's wallet.
334
+ // When usePublicRpc is true, we keep the original viem RPC URLs (public)
317
335
  if (
318
- chainInfo &&
319
336
  !options?.usePublicRpc &&
320
337
  options?.sequenceProjectAccessKey &&
321
338
  options?.sequenceNodeGatewayUrl
@@ -340,7 +357,7 @@ export function getChainInfo(
340
357
  }
341
358
 
342
359
  // Override explorer URLs for specific chains
343
- if (chainId === katana.id && chainInfo) {
360
+ if (chainId === katana.id) {
344
361
  chainInfo.blockExplorers = {
345
362
  default: {
346
363
  name: "Katanascan",
@@ -350,14 +367,10 @@ export function getChainInfo(
350
367
  }
351
368
 
352
369
  // Add imageUrl property to chain info
353
- if (chainInfo) {
354
- return {
355
- ...chainInfo,
356
- imageUrl: getChainImageUrl(chainId),
357
- } as Chain
358
- }
359
-
360
- return null
370
+ return {
371
+ ...chainInfo,
372
+ imageUrl: getChainImageUrl(chainId),
373
+ } as Chain
361
374
  }
362
375
 
363
376
  // Get testnet chain info from mainnet chain as input
package/src/index.ts CHANGED
@@ -146,14 +146,14 @@ export {
146
146
  buildRefundTransactionWithSignature,
147
147
  signPayload,
148
148
  determineRefundCall,
149
- useTrailsRefund,
150
- } from "./refund.js"
149
+ useIntentRecover,
150
+ } from "./recover.js"
151
151
  export type {
152
152
  BuildRefundTransactionParams,
153
153
  BuildRefundTransactionWithSignatureParams,
154
- UseTrailsRefundParams,
155
- UseTrailsRefundReturn,
156
- } from "./refund.js"
154
+ UseIntentRecoverParams,
155
+ UseIntentRecoverReturn,
156
+ } from "./recover.js"
157
157
  export type {
158
158
  IntentReceipt,
159
159
  IntentTransaction as IntentTransactionReceipt,
package/src/intents.ts CHANGED
@@ -24,10 +24,7 @@ import {
24
24
  type WalletClient,
25
25
  } from "viem"
26
26
  import { getChainInfo, getChainRpcClient } from "./chains.js"
27
- import {
28
- SEQUENCE_V3_CONTRACT_ADDRESSES,
29
- TRAILS_CONTRACTS,
30
- } from "./constants.js"
27
+ import { SEQUENCE_V3_CONTRACT_ADDRESSES } from "./constants.js"
31
28
  import {
32
29
  trackTransactionStarted,
33
30
  trackTransactionSubmitted,
@@ -403,7 +400,6 @@ export async function commitIntent(
403
400
  // Commit the intent that was returned from quoteIntent
404
401
  const response = await trailsClient.commitIntent({
405
402
  intent,
406
- trailsContracts: TRAILS_CONTRACTS,
407
403
  })
408
404
 
409
405
  // Track successful intent commit
package/src/mutations.ts CHANGED
@@ -3,7 +3,6 @@ import type { Intent, DepositSignature } from "@0xtrails/api"
3
3
  import { useTrailsClient } from "./trailsClient.js"
4
4
  import { logger } from "./logger.js"
5
5
  import { getFullErrorMessage } from "./error.js"
6
- import { TRAILS_CONTRACTS } from "./constants.js"
7
6
  import {
8
7
  trackIntentCommitStarted,
9
8
  trackIntentCommitCompleted,
@@ -49,7 +48,6 @@ export function useCommitIntent() {
49
48
  // Commit the intent
50
49
  const response = await trailsClient.commitIntent({
51
50
  intent,
52
- trailsContracts: TRAILS_CONTRACTS,
53
51
  })
54
52
 
55
53
  logger.console.log("[trails-sdk] useCommitIntent: Commit successful", {