Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add sui and solana to hypercore mayan route support
  • Loading branch information
nascob committed Oct 8, 2025
commit 6f79933fb0d587b09010e65a81168e23e747d3be
21 changes: 11 additions & 10 deletions src/routes/mayan/MayanRouteBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,10 @@ export class MayanRouteBase<N extends Network> extends routes.AutomaticRoute<
);

if (request.fromChain.chain === 'Solana') {
// Uncomment and use this when we want to support HyperCore USDC deposits on SOL
// const solanaOptions = {
// allowSwapperOffCurve: true,
// ...(usdcPermitSignature ? { usdcPermitSignature } : {}),
// };
const solanaOptions = {
allowSwapperOffCurve: true,
...(usdcPermitSignature ? { usdcPermitSignature } : {}),
};

const { instructions, signers, lookupTables } =
await (this.isTestnetRequest(request)
Expand All @@ -663,15 +662,15 @@ export class MayanRouteBase<N extends Network> extends routes.AutomaticRoute<
destinationAddress,
null,
rpc,
{ allowSwapperOffCurve: true },
solanaOptions,
)
: createSwapFromSolanaInstructions(
quote.details!,
originAddress,
destinationAddress,
null,
rpc,
{ allowSwapperOffCurve: true },
solanaOptions,
));

const payerKey = new PublicKey(originAddress);
Expand Down Expand Up @@ -732,13 +731,15 @@ export class MayanRouteBase<N extends Network> extends routes.AutomaticRoute<
quote.params.amount,
);

const options: ComposableSuiMoveCallsOptions | undefined =
builtTransaction
const options: ComposableSuiMoveCallsOptions = {
...(builtTransaction
? {
builtTransaction,
inputCoin: { result: remainingAmountCoin },
}
: undefined;
: {}),
...(usdcPermitSignature ? { usdcPermitSignature } : {}),
};

const tx = await (this.isTestnetRequest(request)
? createSwapFromSuiMoveCallsTestnet(
Expand Down
20 changes: 7 additions & 13 deletions src/utils/hypercore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import type {
} from '../routes/mayan/types';
import { TransferWallet } from 'utils/wallet';
import type { WormholeConnectWalletProvider } from 'utils/wallet/types';
import { isEvmChain } from './evm';
import { getWormholeContextV2 } from 'config';
import { isEvmChain } from './evm';

// Note: Hyperliquid bridge = Arbitrum bridge + custom payload for USDC deposit to Hyperliquid

Expand Down Expand Up @@ -63,17 +63,6 @@ export function validateHyperCoreTransfer<N extends Network>(
};
}

// Temporary restriction to EVM for now; SOL and SUI are coming soon
if (!isEvmChain(fromChain.chain)) {
return {
valid: false,
params,
error: new routes.UnavailableError(
new Error('HyperCore only supports EVM source chains'),
),
};
}

return null;
}

Expand Down Expand Up @@ -134,7 +123,11 @@ export async function maybeGetHyperCorePermitSignature<N extends Network>(
throw new Error('No wallet provider available for HyperCore permit');
}

const wallet = walletProvider.getWallet(ARBITRUM, TransferWallet.SENDING) as
const walletToSwitch = isEvmChain(request.fromChain.chain)
? TransferWallet.SENDING
: TransferWallet.RECEIVING;

const wallet = walletProvider.getWallet(ARBITRUM, walletToSwitch) as
| Eip6963Wallet
| undefined;

Expand All @@ -145,6 +138,7 @@ export async function maybeGetHyperCorePermitSignature<N extends Network>(
}

try {
console.log(wallet);
await wallet.switchChain(42161);
} catch (e) {
const reason = e instanceof Error ? `: ${e.message}` : '';
Expand Down