@openocean.finance/widget 1.0.34 → 1.0.36
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/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/cross/adapters/MayanAdapter.js +1 -1
- package/dist/esm/cross/adapters/MayanAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/RelayAdapter.js +24 -1
- package/dist/esm/cross/adapters/RelayAdapter.js.map +1 -1
- package/dist/esm/services/ExecuteRoute.js +6 -4
- package/dist/esm/services/ExecuteRoute.js.map +1 -1
- package/dist/esm/stores/form/FormUpdater.js +3 -1
- package/dist/esm/stores/form/FormUpdater.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/config/version.ts +1 -1
- package/src/cross/adapters/MayanAdapter.ts +1 -1
- package/src/cross/adapters/RelayAdapter.ts +26 -1
- package/src/services/ExecuteRoute.ts +12 -4
- package/src/stores/form/FormUpdater.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openocean.finance/widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
4
4
|
"description": "Openocean Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@mui/icons-material": "6.0.2",
|
|
48
48
|
"@mui/material": "^6.4.8",
|
|
49
49
|
"@mui/system": "^6.4.8",
|
|
50
|
-
"@openocean.finance/wallet-management": "^1.0.
|
|
51
|
-
"@openocean.finance/widget-sdk": "^1.0.
|
|
50
|
+
"@openocean.finance/wallet-management": "^1.0.12",
|
|
51
|
+
"@openocean.finance/widget-sdk": "^1.0.10",
|
|
52
52
|
"@across-protocol/app-sdk": "^0.2.0",
|
|
53
53
|
"@near-wallet-selector/react-hook": "^9.0.0",
|
|
54
54
|
"@reservoir0x/relay-sdk": "^2.4.0",
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@openocean.finance/widget'
|
|
2
|
-
export const version = '1.0.
|
|
2
|
+
export const version = '1.0.36'
|
|
@@ -46,6 +46,30 @@ import {
|
|
|
46
46
|
type SwapStatus,
|
|
47
47
|
} from './BaseSwapAdapter.js'
|
|
48
48
|
|
|
49
|
+
import { defineChain } from 'viem'
|
|
50
|
+
|
|
51
|
+
const hyperEvm = defineChain({
|
|
52
|
+
id: 999,
|
|
53
|
+
name: 'HyperEvm',
|
|
54
|
+
network: 'hyperevm',
|
|
55
|
+
nativeCurrency: {
|
|
56
|
+
decimals: 18,
|
|
57
|
+
name: 'HYPE',
|
|
58
|
+
symbol: 'HYPE',
|
|
59
|
+
},
|
|
60
|
+
rpcUrls: {
|
|
61
|
+
default: {
|
|
62
|
+
http: ['https://rpc.hyperliquid.xyz/evm'],
|
|
63
|
+
},
|
|
64
|
+
public: {
|
|
65
|
+
http: ['https://rpc.hyperliquid.xyz/evm'],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
blockExplorers: {
|
|
69
|
+
default: { name: 'Explorer', url: 'https://hyperevmscan.io' },
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
|
|
49
73
|
const SolanaChainId = 792703809
|
|
50
74
|
|
|
51
75
|
const solanaChain = {
|
|
@@ -79,6 +103,7 @@ export class RelayAdapter extends BaseSwapAdapter {
|
|
|
79
103
|
zksync,
|
|
80
104
|
ronin,
|
|
81
105
|
unichain,
|
|
106
|
+
hyperEvm,
|
|
82
107
|
]
|
|
83
108
|
.map(convertViemChainToRelayChain)
|
|
84
109
|
.concat(solanaChain as any),
|
|
@@ -92,7 +117,7 @@ export class RelayAdapter extends BaseSwapAdapter {
|
|
|
92
117
|
return 'https://storage.googleapis.com/ks-setting-1d682dca/84e906bb-eaeb-45d3-a64c-2aa9c84eb3ea1747759080942.png'
|
|
93
118
|
}
|
|
94
119
|
getSupportedChains(): Chain[] {
|
|
95
|
-
return [NonEvmChain.Solana, ...MAINNET_NETWORKS]
|
|
120
|
+
return [NonEvmChain.Solana, 999, ...MAINNET_NETWORKS]
|
|
96
121
|
// return [...MAINNET_NETWORKS]
|
|
97
122
|
}
|
|
98
123
|
|
|
@@ -452,17 +452,25 @@ async function executeEvmSwap(
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
// Check if current chain matches target chain
|
|
455
|
-
|
|
455
|
+
console.log(
|
|
456
|
+
'walletClient',
|
|
457
|
+
walletClient,
|
|
458
|
+
walletClient.chain,
|
|
459
|
+
walletClient.getChainId
|
|
460
|
+
)
|
|
461
|
+
const currentChainId = await walletClient.getChainId()
|
|
456
462
|
const targetChainId = step.action.fromChainId
|
|
457
463
|
|
|
458
|
-
if (currentChainId
|
|
464
|
+
if (currentChainId != targetChainId) {
|
|
459
465
|
try {
|
|
460
466
|
// Try to switch to target chain
|
|
461
467
|
await walletClient.switchChain({ id: targetChainId })
|
|
462
468
|
|
|
463
469
|
// Get updated walletClient after chain switch
|
|
464
470
|
walletClient = (await getWalletClient(options.wagmiConfig)) as any
|
|
465
|
-
|
|
471
|
+
const currentChainId2 = await walletClient.getChainId()
|
|
472
|
+
|
|
473
|
+
if (!walletClient || currentChainId2 !== targetChainId) {
|
|
466
474
|
throw new Error('Failed to switch chain')
|
|
467
475
|
}
|
|
468
476
|
} catch (error) {
|
|
@@ -549,7 +557,7 @@ async function executeEvmSwap(
|
|
|
549
557
|
: BigInt(amount)
|
|
550
558
|
|
|
551
559
|
const hash = await walletClient.writeContract({
|
|
552
|
-
chain: walletClient.chain,
|
|
560
|
+
chain: walletClient.chain || undefined,
|
|
553
561
|
account: walletClient.account,
|
|
554
562
|
address: step.action.fromToken.address as `0x${string}`,
|
|
555
563
|
abi: [
|
|
@@ -60,9 +60,9 @@ export const FormUpdater: React.FC<{
|
|
|
60
60
|
setSelectedBookmark(toAddress)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
setUserAndDefaultValues(
|
|
64
|
-
|
|
65
|
-
)
|
|
63
|
+
// setUserAndDefaultValues(
|
|
64
|
+
// accountForChainId(reactiveFormValues, account.chainId)
|
|
65
|
+
// )
|
|
66
66
|
}, [
|
|
67
67
|
account.chainId,
|
|
68
68
|
toAddress,
|