"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./types-CjNs2oB0.js"),e=require("./platform-CCG_jgOO.js"),k=require("./multiToken-YoNvxjur.js");require("./index-CS6YnwIH.js");class f extends e.FinalizableRoute{static NATIVE_GAS_DROPOFF_SUPPORTED=!1;static IS_AUTOMATIC=!1;staticConfig=this.constructor.config;static config={contracts:[]};static meta={name:"MultiTokenNttManualRoute"};static supportedNetworks(){return i.MultiTokenNttRoute.resolveSupportedNetworks(this.config.contracts)}static supportedChains(t){return i.MultiTokenNttRoute.resolveSupportedChains(this.config.contracts,t)}static async supportedDestinationTokens(t,n,o){return[await i.MultiTokenNttRoute.getDestinationTokenId(t,n,o,this.config.contracts)]}static isProtocolSupported(t){return t.supportsProtocol("MultiTokenNtt")}getDefaultOptions(){return{}}async isWrappedToken(t){return await i.MultiTokenNttRoute.isWrappedToken(this.wh.getChain(t.chain),t,this.staticConfig.contracts)}async getOriginalToken(t){return await i.MultiTokenNttRoute.getOriginalToken(this.wh.getChain(t.chain),t,this.staticConfig.contracts)}async validate(t,n){if(t.fromChain.chain===t.toChain.chain)return{valid:!1,error:new Error("Source and destination chains must differ"),params:n};const o=n.options??this.getDefaultOptions(),a=e.parse(n.amount,t.source.decimals),s=i.NttRoute.trimAmount(a,t.destination.decimals),r=i.MultiTokenNttRoute.resolveContracts(this.staticConfig.contracts,t.fromChain.chain),u=i.MultiTokenNttRoute.resolveContracts(this.staticConfig.contracts,t.toChain.chain),d=await t.fromChain.getProtocol("MultiTokenNtt",{multiTokenNtt:r}),l=e.isNative(t.source.id.address)?await d.getWrappedNativeToken():t.source.id,m=await d.getOriginalToken(l),g=await d.getSendTransceivers(t.toChain.chain),h=await this.estimateGasLimit(t,m);return{valid:!0,params:{amount:n.amount,normalizedParams:{amount:s,sourceContracts:r,destinationContracts:u,sourceTokenId:t.source.id,destinationTokenId:t.destination.id,originalTokenId:m,sendTransceivers:g,gasLimit:h},options:o}}}async estimateGasLimit(t,n){return i.MultiTokenNttRoute.estimateGasLimit(t,n,this.staticConfig.contracts,this.staticConfig.perTokenOverrides)}async quote(t,n){const o=e.scale(n.normalizedParams.amount,t.destination.decimals),a={success:!0,params:n,sourceToken:{token:t.source.id,amount:n.normalizedParams.amount},destinationToken:{token:t.destination.id,amount:o},eta:e.estimateFinalityTime(t.fromChain.chain)+e.guardianAttestationEta*1e3},{fromChain:s,toChain:r}=t,u=await r.getProtocol("MultiTokenNtt",{multiTokenNtt:n.normalizedParams.destinationContracts}),d=await u.getRateLimitDuration(),l=await i.MultiTokenNttRoute.checkRateLimit(u,s.chain,n.normalizedParams.originalTokenId,o,d);return l&&(a.warnings=l),a}async initiate(t,n,o,a){const{params:s}=o,{fromChain:r}=t,u=e.Wormhole.parseAddress(n.chain(),n.address()),l=(await r.getProtocol("MultiTokenNtt",{multiTokenNtt:s.normalizedParams.sourceContracts})).transfer(u,s.normalizedParams.sourceTokenId.address,e.units(s.normalizedParams.amount),a,s.normalizedParams.gasLimit,this.staticConfig.axelarGasMultiplier),m=await e.signSendWait(r,l,n);return{from:r.chain,to:a.chain,state:e.TransferState.SourceInitiated,originTxs:m,params:s,trackingInfo:{transceiverAttested:{}}}}async complete(t,n){return await i.MultiTokenNttRoute.complete(t,this.wh.getChain(n.to),n)}async resume(t){return await i.MultiTokenNttRoute.resume(t,this.wh,this.staticConfig.contracts)}async finalize(t,n){return await i.MultiTokenNttRoute.finalize(t,this.wh.getChain(n.to),n)}async*track(t,n){return yield*i.MultiTokenNttRoute.track(this.wh,t,!0,n)}}const p={Mainnet:[],Testnet:[e.Wormhole.tokenId("Monad","0xf817257fed379853cDe0fa4F97AB987181B1E5Ea"),e.Wormhole.tokenId("Monad","0x88b8E2161DEDC77EF4ab7585569D2415a1C1055D"),e.Wormhole.tokenId("Monad","0xcf5a6076cfa32686c0Df13aBaDa2b40dec133F1d"),e.Wormhole.tokenId("Monad","0xB5a30b0FDc5EA94A52fDc42e3E9760Cb8449Fb37")]},C={Mainnet:[],Testnet:[{chain:"Sepolia",manager:"0x6c5aAE4622B835058A41879bA5e128019B9047d6",gmpManager:"0xDaeE3A6B4196E3e46015b364F1DAe54CEAE74A91"},{chain:"Monad",manager:"0x600D3C45Cd002E7359D12597Bb8058a0C32A20Df",gmpManager:"0x641a6608e2959c0D7Fe2a5F267DFDA519ED43d98"}]};function T(c,t){return!(p[t.network]||[]).some(o=>e.isSameToken(o,c))}function M(c){const t=C[c];if(!t)throw new Error(`No Monad NTT contracts configured for network ${c}`);return t}function N(c){class t extends k.MultiTokenNttExecutorRoute{static meta={name:"MonadBridgeExecutorRoute"};static config=c;static async supportedDestinationTokens(o,a,s){return T(o,a)?super.supportedDestinationTokens(o,a,s):[]}}return t}function w(c){class t extends f{static meta={name:"MonadBridgeManualRoute"};static config=c;static async supportedDestinationTokens(o,a,s){return T(o,a)?super.supportedDestinationTokens(o,a,s):[]}}return t}exports.getContractsForNetwork=M;exports.monadBridgeExecutorRoute=N;exports.monadBridgeManualRoute=w;
