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
Prev Previous commit
chore: rename fast mctp
  • Loading branch information
priyajeet committed Sep 18, 2025
commit f26cc0029cd81bf5f777df8cf1ab3a06f585da7f
12 changes: 6 additions & 6 deletions src/routes/mayan/MayanRoute.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Network } from '@wormhole-foundation/sdk-base';
import type { routes } from '@wormhole-foundation/sdk-connect';
import { MayanRouteBase } from './MayanRouteBase';
import type { MayanProtocol } from './types';
import { MayanProtocol } from './types';

export class MayanRoute<N extends Network>
extends MayanRouteBase<N>
Expand All @@ -13,10 +13,10 @@ export class MayanRoute<N extends Network>
};

override protocols: MayanProtocol[] = [
'WH',
'MCTP',
'FAST_MCTP',
'SWIFT',
'MONO_CHAIN',
MayanProtocol.WH,
MayanProtocol.MCTP,
MayanProtocol.FAST_MCTP,
MayanProtocol.SWIFT,
MayanProtocol.MONO_CHAIN,
];
}
38 changes: 19 additions & 19 deletions src/routes/mayan/MayanRouteBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@
toMayanChainName,
txStatusToReceipt,
} from './utils';
import type {
import {
MayanProtocol,
Options,
Quote,
QuoteResult,
Receipt,
ReferrerParams,
TransferParams,
ValidatedParams,
ValidationResult,
type Options,
type Quote,
type QuoteResult,
type Receipt,
type ReferrerParams,
type TransferParams,
type ValidatedParams,
type ValidationResult,
} from './types';

export class MayanRouteBase<N extends Network> extends routes.AutomaticRoute<
Expand All @@ -106,11 +106,11 @@
static override IS_AUTOMATIC = true;

protocols: MayanProtocol[] = [
'WH',
'MCTP',
'FAST_MCTP',
'SWIFT',
'MONO_CHAIN',
MayanProtocol.WH,
MayanProtocol.MCTP,
MayanProtocol.FAST_MCTP,
MayanProtocol.SWIFT,
MayanProtocol.MONO_CHAIN,
];

protected isTestnetRequest(request: routes.RouteTransferRequest<N>): boolean {
Expand All @@ -124,7 +124,7 @@
// Helper function to normalize quote for testnet compatibility
protected normalizeQuoteForTestnet(quote: MayanQuote): any {
// Remove properties that don't exist in testnet SDK
const { hyperCoreParams, ...testnetCompatibleQuote } = quote;

Check warning on line 127 in src/routes/mayan/MayanRouteBase.ts

View workflow job for this annotation

GitHub Actions / ESLint

'hyperCoreParams' is assigned a value but never used. Allowed unused vars must match /^_/u
return testnetCompatibleQuote;
}

Expand Down Expand Up @@ -415,10 +415,10 @@
};

const quoteOpts: QuoteOptions = {
swift: this.protocols.includes('SWIFT'),
mctp: this.protocols.includes('MCTP'),
fastMctp: this.protocols.includes('FAST_MCTP'),
monoChain: this.protocols.includes('MONO_CHAIN'),
swift: this.protocols.includes(MayanProtocol.SWIFT),
mctp: this.protocols.includes(MayanProtocol.MCTP),
fastMctp: this.protocols.includes(MayanProtocol.FAST_MCTP),
monoChain: this.protocols.includes(MayanProtocol.MONO_CHAIN),
};

const fetchQuoteUrl = new URL(
Expand Down Expand Up @@ -450,7 +450,7 @@
}

const quotes = res.data?.quotes?.filter((quote: MayanQuote) =>
this.protocols.includes(quote.type),
this.protocols.includes(quote.type as MayanProtocol),
);

if (!quotes || quotes.length === 0) return undefined;
Expand Down
6 changes: 3 additions & 3 deletions src/routes/mayan/MayanRouteFastMCTP.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { routes } from '@wormhole-foundation/sdk-connect';
import type { Network } from '@wormhole-foundation/sdk-base';
import type { MayanProtocol } from './types';
import { MayanProtocol } from './types';
import { MayanRouteBase } from './MayanRouteBase';

export class MayanRouteFastMCTP<N extends Network>
Expand All @@ -9,8 +9,8 @@ export class MayanRouteFastMCTP<N extends Network>
{
static meta = {
name: 'MayanSwapFastMCTP',
provider: 'Mayan Fast MCTP',
provider: 'Mayan MCTP',
};

override protocols: MayanProtocol[] = ['FAST_MCTP'];
override protocols: MayanProtocol[] = [MayanProtocol.FAST_MCTP];
}
4 changes: 2 additions & 2 deletions src/routes/mayan/MayanRouteMCTP.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Network } from '@wormhole-foundation/sdk-base';
import type { routes } from '@wormhole-foundation/sdk-connect';
import { MayanRouteBase } from './MayanRouteBase';
import type { MayanProtocol } from './types';
import { MayanProtocol } from './types';

export class MayanRouteMCTP<N extends Network>
extends MayanRouteBase<N>
Expand All @@ -12,5 +12,5 @@ export class MayanRouteMCTP<N extends Network>
provider: 'Mayan MCTP',
};

override protocols: MayanProtocol[] = ['MCTP'];
override protocols: MayanProtocol[] = [MayanProtocol.MCTP];
}
4 changes: 2 additions & 2 deletions src/routes/mayan/MayanRouteMONOCHAIN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { chainToPlatform } from '@wormhole-foundation/sdk-base';
import type { Chain, Network } from '@wormhole-foundation/sdk-connect';
import type { routes } from '@wormhole-foundation/sdk-connect';
import { MayanRouteBase } from './MayanRouteBase';
import type { MayanProtocol } from './types';
import { MayanProtocol } from './types';

export class MayanRouteMONOCHAIN<N extends Network>
extends MayanRouteBase<N>
Expand All @@ -13,7 +13,7 @@ export class MayanRouteMONOCHAIN<N extends Network>
provider: 'Mayan Mono Chain',
};

override protocols: MayanProtocol[] = ['MONO_CHAIN'];
override protocols: MayanProtocol[] = [MayanProtocol.MONO_CHAIN];

static supportsSameChainSwaps(network: Network, chain: Chain) {
const platform = chainToPlatform(chain);
Expand Down
4 changes: 2 additions & 2 deletions src/routes/mayan/MayanRouteSWIFT.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Network } from '@wormhole-foundation/sdk-base';
import type { routes } from '@wormhole-foundation/sdk-connect';
import { MayanRouteBase } from './MayanRouteBase';
import type { MayanProtocol } from './types';
import { MayanProtocol } from './types';

export class MayanRouteSWIFT<N extends Network>
extends MayanRouteBase<N>
Expand All @@ -12,5 +12,5 @@ export class MayanRouteSWIFT<N extends Network>
provider: 'Mayan Swift',
};

override protocols: MayanProtocol[] = ['SWIFT'];
override protocols: MayanProtocol[] = [MayanProtocol.SWIFT];
}
4 changes: 2 additions & 2 deletions src/routes/mayan/MayanRouteWH.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Network } from '@wormhole-foundation/sdk-base';
import type { routes } from '@wormhole-foundation/sdk-connect';
import { MayanRouteBase } from './MayanRouteBase';
import type { MayanProtocol } from './types';
import { MayanProtocol } from './types';

export class MayanRouteWH<N extends Network>
extends MayanRouteBase<N>
Expand All @@ -12,5 +12,5 @@ export class MayanRouteWH<N extends Network>
provider: 'Mayan WH',
};

override protocols: MayanProtocol[] = ['WH'];
override protocols: MayanProtocol[] = [MayanProtocol.WH];
}
28 changes: 14 additions & 14 deletions src/routes/mayan/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import type { Chain, Network } from '@wormhole-foundation/sdk-base';
import type { routes } from '@wormhole-foundation/sdk-connect';
import type { Quote as MayanQuote } from '@mayanfinance/swap-sdk';

export type MayanProtocol =
| 'WH'
| 'MCTP'
| 'SWIFT'
| 'FAST_MCTP'
| 'SHUTTLE'
| 'MONO_CHAIN';
export enum MayanProtocol {
WH = 'WH',
MCTP = 'MCTP',
SWIFT = 'SWIFT',
FAST_MCTP = 'FAST_MCTP',
SHUTTLE = 'SHUTTLE',
MONO_CHAIN = 'MONO_CHAIN',
}

export type ReferrerParams<N extends Network> = {
getReferrerBps?: (request: routes.RouteTransferRequest<N>) => number;
Expand Down Expand Up @@ -42,6 +43,11 @@ export type Receipt = routes.Receipt;
export type TransferParams = routes.TransferParams<Options>;
export type ValidationResult = routes.ValidationResult<Options>;

interface MayanTx {
txHash: string;
goals: MayanTransactionGoal[];
scannerUrl: string;
}
export interface TransactionStatus {
id: string;
trader: string;
Expand Down Expand Up @@ -136,7 +142,7 @@ export interface TransactionStatus {
fromTokenScannerUrl: string;
toTokenScannerUrl: string;

txs: Tx[];
txs: MayanTx[];

clientStatus: MayanClientStatus;
}
Expand All @@ -160,9 +166,3 @@ export enum MayanTransactionGoal {
// settle on destination
Settle = 'SETTLE',
}

export interface Tx {
txHash: string;
goals: MayanTransactionGoal[];
scannerUrl: string;
}
Loading