@openocean.finance/widget 1.0.46 → 1.0.49

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.
Files changed (54) hide show
  1. package/dist/esm/AppDrawer.style.d.ts +1 -1
  2. package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +2 -2
  3. package/dist/esm/components/AmountInput/AmountInput.style.d.ts +1 -1
  4. package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -1
  5. package/dist/esm/components/Avatar/Avatar.style.d.ts +1 -1
  6. package/dist/esm/components/Avatar/SmallAvatar.d.ts +1 -1
  7. package/dist/esm/components/ButtonTertiary.d.ts +1 -1
  8. package/dist/esm/components/Card/CardHeader.d.ts +1 -1
  9. package/dist/esm/components/Card/CardIconButton.d.ts +1 -1
  10. package/dist/esm/components/ContractComponent/NFT/NFT.style.d.ts +1 -1
  11. package/dist/esm/components/Header/Header.style.d.ts +2 -2
  12. package/dist/esm/components/Header/SettingsButton.style.d.ts +2 -2
  13. package/dist/esm/components/ListItem/ListItem.d.ts +1 -1
  14. package/dist/esm/components/Search/SearchInput.style.d.ts +1 -1
  15. package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  16. package/dist/esm/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  17. package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +2 -2
  18. package/dist/esm/components/StepActions/StepActions.style.d.ts +1 -1
  19. package/dist/esm/components/Tabs/Tabs.style.d.ts +2 -2
  20. package/dist/esm/components/Tabs/Tabs.style.js +5 -2
  21. package/dist/esm/components/Tabs/Tabs.style.js.map +1 -1
  22. package/dist/esm/components/TokenList/TokenList.style.d.ts +2 -2
  23. package/dist/esm/config/defaultChainIds.js +1 -0
  24. package/dist/esm/config/defaultChainIds.js.map +1 -1
  25. package/dist/esm/config/version.d.ts +1 -1
  26. package/dist/esm/config/version.js +1 -1
  27. package/dist/esm/cross/adapters/LifiAdapter.js +3 -1
  28. package/dist/esm/cross/adapters/LifiAdapter.js.map +1 -1
  29. package/dist/esm/cross/adapters/NearIntentsAdapter.js +1 -0
  30. package/dist/esm/cross/adapters/NearIntentsAdapter.js.map +1 -1
  31. package/dist/esm/cross/adapters/RelayAdapter.js +3 -2
  32. package/dist/esm/cross/adapters/RelayAdapter.js.map +1 -1
  33. package/dist/esm/cross/constants/index.d.ts +13 -1
  34. package/dist/esm/cross/constants/index.js +13 -0
  35. package/dist/esm/cross/constants/index.js.map +1 -1
  36. package/dist/esm/cross/crossChainQuote.js +1 -1
  37. package/dist/esm/cross/crossChainQuote.js.map +1 -1
  38. package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +4 -4
  39. package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
  40. package/dist/esm/services/DebridgeService.js +8 -0
  41. package/dist/esm/services/DebridgeService.js.map +1 -1
  42. package/dist/esm/services/ExecuteRoute.js +1 -1
  43. package/dist/esm/services/ExecuteRoute.js.map +1 -1
  44. package/package.json +3 -3
  45. package/src/components/Tabs/Tabs.style.tsx +5 -2
  46. package/src/config/defaultChainIds.ts +1 -0
  47. package/src/config/version.ts +1 -1
  48. package/src/cross/adapters/LifiAdapter.ts +4 -2
  49. package/src/cross/adapters/NearIntentsAdapter.ts +1 -0
  50. package/src/cross/adapters/RelayAdapter.ts +3 -2
  51. package/src/cross/constants/index.ts +13 -0
  52. package/src/cross/crossChainQuote.ts +1 -1
  53. package/src/services/DebridgeService.ts +55 -47
  54. package/src/services/ExecuteRoute.ts +1 -1
@@ -166,6 +166,18 @@ export const NativeCurrencies = {
166
166
  address: '0x4200000000000000000000000000000000000006',
167
167
  },
168
168
  },
169
+ [ChainId.FLR]: {
170
+ name: 'Flare',
171
+ symbol: 'FLR',
172
+ decimals: 18,
173
+ address: '0x0000000000000000000000000000000000000000',
174
+ wrapped: {
175
+ name: 'Wrapped FLR',
176
+ symbol: 'WFLR',
177
+ decimals: 18,
178
+ address: '0x0000000000000000000000000000000000000000',
179
+ },
180
+ },
169
181
  }
170
182
  export const MAINNET_NETWORKS = [
171
183
  ChainId.ETH,
@@ -185,6 +197,7 @@ export const MAINNET_NETWORKS = [
185
197
  ChainId.SCL,
186
198
  ChainId.CEL,
187
199
  ChainId.MONAD,
200
+ ChainId.FLR,
188
201
  ] as const
189
202
 
190
203
  export interface Currency {
@@ -90,7 +90,7 @@ export async function getCrossChainQuote({
90
90
  quoteResults.push({ adapter, quote })
91
91
  }
92
92
  } catch (error) {
93
- errorMsg = error instanceof Error || error?.message ? error.message : 'Unknown error'
93
+ errorMsg = error instanceof Error ? error.message : (error && typeof error === 'object' && 'message' in error ? String(error.message) : 'Unknown error')
94
94
  // Ignore individual adapter errors, continue getting quotes from other adapters
95
95
  console.warn(`Failed to get quote from ${adapter.getName()}:`, error)
96
96
  }
@@ -68,6 +68,7 @@ const DEBRIDGE_CHAIN_IDS: Record<number | string, string> = {
68
68
  5000: '100000023', // Mantle
69
69
  747: '100000009', // Flow
70
70
  32769: '100000008', // Zilliqa
71
+ 14: '14', // Flare
71
72
  // Other EVM chain IDs use numeric strings directly
72
73
  }
73
74
 
@@ -168,6 +169,13 @@ const NATIVE_TOKENS: Record<number, Asset> = {
168
169
  symbol: 'SOL',
169
170
  icon: 'https://s3.openocean.finance/token_logos/logos/solana/So11111111111111111111111111111111111111112.png',
170
171
  },
172
+ 14: {
173
+ chainId: 14,
174
+ name: 'Flare',
175
+ address: '0x0000000000000000000000000000000000000000',
176
+ decimals: 18,
177
+ symbol: 'FLR',
178
+ },
171
179
  }
172
180
 
173
181
  export class DebridgeService {
@@ -358,40 +366,40 @@ export class DebridgeService {
358
366
  const queryParams =
359
367
  account && receiver
360
368
  ? {
361
- srcChainId: debridgeSrcChainId,
362
- srcChainTokenIn: debridgeSrcToken,
363
- srcChainTokenInAmount: inAmount,
364
- dstChainId: debridgeDstChainId,
365
- dstChainTokenOut: debridgeDstToken,
366
- dstChainTokenOutRecipient: receiver || account,
367
- senderAddress: account,
368
- referralCode: DebridgeService.REFERRAL_CODE.toString(), // Ensure referralCode is string
369
- srcChainRefundAddress: account,
370
- srcChainOrderAuthorityAddress: account,
371
- dstChainOrderAuthorityAddress: receiver || account,
372
- enableEstimate: false,
373
- prependOperatingExpenses: true,
374
- additionalTakerRewardBps: 0,
375
- allowedTaker:
376
- debridgeDstChainId === '7565164'
377
- ? '2snHHreXbpJ7UwZxPe37gnUNf7Wx7wv6UKDSR2JckKuS'
378
- : '0x555CE236C0220695b68341bc48C68d52210cC35b',
379
- deBridgeApp: 'DESWAP',
380
- ptp: false,
381
- tab: new Date().getTime(),
382
- }
369
+ srcChainId: debridgeSrcChainId,
370
+ srcChainTokenIn: debridgeSrcToken,
371
+ srcChainTokenInAmount: inAmount,
372
+ dstChainId: debridgeDstChainId,
373
+ dstChainTokenOut: debridgeDstToken,
374
+ dstChainTokenOutRecipient: receiver || account,
375
+ senderAddress: account,
376
+ referralCode: DebridgeService.REFERRAL_CODE.toString(), // Ensure referralCode is string
377
+ srcChainRefundAddress: account,
378
+ srcChainOrderAuthorityAddress: account,
379
+ dstChainOrderAuthorityAddress: receiver || account,
380
+ enableEstimate: false,
381
+ prependOperatingExpenses: true,
382
+ additionalTakerRewardBps: 0,
383
+ allowedTaker:
384
+ debridgeDstChainId === '7565164'
385
+ ? '2snHHreXbpJ7UwZxPe37gnUNf7Wx7wv6UKDSR2JckKuS'
386
+ : '0x555CE236C0220695b68341bc48C68d52210cC35b',
387
+ deBridgeApp: 'DESWAP',
388
+ ptp: false,
389
+ tab: new Date().getTime(),
390
+ }
383
391
  : {
384
- srcChainId: debridgeSrcChainId,
385
- srcChainTokenIn: debridgeSrcToken,
386
- srcChainTokenInAmount: inAmount,
387
- dstChainTokenOutAmount: 'auto',
388
- dstChainId: debridgeDstChainId,
389
- dstChainTokenOut: debridgeDstToken,
390
- referralCode: DebridgeService.REFERRAL_CODE.toString(), // Ensure referralCode is string
391
- prependOperatingExpenses: true,
392
- additionalTakerRewardBps: 0,
393
- tab: new Date().getTime(),
394
- }
392
+ srcChainId: debridgeSrcChainId,
393
+ srcChainTokenIn: debridgeSrcToken,
394
+ srcChainTokenInAmount: inAmount,
395
+ dstChainTokenOutAmount: 'auto',
396
+ dstChainId: debridgeDstChainId,
397
+ dstChainTokenOut: debridgeDstToken,
398
+ referralCode: DebridgeService.REFERRAL_CODE.toString(), // Ensure referralCode is string
399
+ prependOperatingExpenses: true,
400
+ additionalTakerRewardBps: 0,
401
+ tab: new Date().getTime(),
402
+ }
395
403
 
396
404
  const url = new URL(
397
405
  `${DebridgeService.DEBRIDGE_QUOTE_URL}/dln/order/create-tx`
@@ -430,10 +438,10 @@ export class DebridgeService {
430
438
  Number.parseFloat(slippage_tolerance.toString()) / 100
431
439
  const minOutAmount = outAmount
432
440
  ? (
433
- (BigInt(outAmount) *
434
- BigInt(Math.floor((1 - slippagePercent) * 10000))) /
435
- BigInt(10000)
436
- ).toString()
441
+ (BigInt(outAmount) *
442
+ BigInt(Math.floor((1 - slippagePercent) * 10000))) /
443
+ BigInt(10000)
444
+ ).toString()
437
445
  : '0'
438
446
 
439
447
  // Determine fee token (native token of source chain)
@@ -486,16 +494,16 @@ export class DebridgeService {
486
494
  // Fee details
487
495
  feeCosts: finalFeeToken
488
496
  ? [
489
- {
490
- name: 'Debridge Fee',
491
- description: 'Protocol fee charged by Debridge',
492
- token: finalFeeToken,
493
- amount: feeAmount,
494
- amountUSD: '0', // USD value of fee not directly available
495
- percentage: '0', // Percentage calculation complex
496
- included: false, // Assume fee is paid separately or via tx.value
497
- },
498
- ]
497
+ {
498
+ name: 'Debridge Fee',
499
+ description: 'Protocol fee charged by Debridge',
500
+ token: finalFeeToken,
501
+ amount: feeAmount,
502
+ amountUSD: '0', // USD value of fee not directly available
503
+ percentage: '0', // Percentage calculation complex
504
+ included: false, // Assume fee is paid separately or via tx.value
505
+ },
506
+ ]
499
507
  : [],
500
508
  // Include potential operating expense as another fee?
501
509
  // const operatingExpense = estimation?.srcChainTokenIn?.approximateOperatingExpense;
@@ -943,7 +943,7 @@ async function executeBitcoinSwap(
943
943
 
944
944
 
945
945
  default:
946
- throw new Error(`Unsupported wallet: ${connector.name}`);
946
+ throw new Error(`Unsupported wallet: ${connector?.name || 'Unknown'}`);
947
947
  }
948
948
  }
949
949
  );