@wormhole-foundation/wormhole-connect 4.1.0-beta.0-development → 4.1.0-beta.1-development
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/README.md +1 -1
- package/dist/main.mjs +68 -68
- package/dist/src/config/testnet/chains.d.ts.map +1 -1
- package/dist/src/config/testnet/rpcs.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/sdklegacy/config/TESTNET.d.ts.map +1 -1
- package/lib/{aptos-BRApiL_4.mjs → aptos-B84P9rJZ.mjs} +2 -2
- package/lib/{aptos-d56Mw8DO.js → aptos-DWDR5o78.js} +1 -1
- package/lib/{basic-DjAbnFVK.mjs → basic-BERCwt2M.mjs} +2 -2
- package/lib/{basic-DR75AlQZ.mjs → basic-CukRIaOD.mjs} +2 -2
- package/lib/{basic-BxzNlZH2.js → basic-DJXXfABO.js} +1 -1
- package/lib/{basic-Bj1RjRlj.js → basic-NhXxxbR1.js} +1 -1
- package/lib/{constants-Bkyn6tLV.js → constants-B9TBfA4z.js} +1 -1
- package/lib/{constants-PWEvTwIh.mjs → constants-VaoVbllu.mjs} +4 -4
- package/lib/{core-CkIseV8K.mjs → core-BCZrVb_s.mjs} +5 -5
- package/lib/{core-CCO0WKg_.js → core-BE6SS7Ye.js} +3 -3
- package/lib/{evm-BAU31wxF.js → evm--K7mr7Kr.js} +2 -2
- package/lib/{evm-9NnChBii.js → evm-C5BixKBn.js} +1 -1
- package/lib/{evm-2dSclZz6.mjs → evm-CmmnpcFD.mjs} +3 -3
- package/lib/{evm-CMxUV_bG.mjs → evm-DKaWm7eC.mjs} +3 -3
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/{hypercore-DJV-pPts.js → hypercore-4R7JGmbr.js} +1 -1
- package/lib/{hypercore-Bmlyd4uI.mjs → hypercore-birmbh9T.mjs} +9 -9
- package/lib/{index-arjwwpj2.mjs → index-BN_2mA2n.mjs} +1 -1
- package/lib/{index-C5j1HoFr.js → index-BRFbmsc_.js} +1 -1
- package/lib/{index-CS6YnwIH.js → index-BTcij9Np.js} +1 -1
- package/lib/{index-cRi8si5A.js → index-BUbUhbMe.js} +1 -1
- package/lib/{index-DUyGY36L.js → index-Bs28m4ya.js} +1 -1
- package/lib/{index-B16yfCYF.mjs → index-C8YhpD9T.mjs} +1 -1
- package/lib/{index-BYuhx88C.js → index-C8eqQ_7p.js} +1 -1
- package/lib/{index-CZHdN9pg.js → index-CED5jdrg.js} +1 -1
- package/lib/{index-Cl9Df47-.mjs → index-CH0iw38J.mjs} +1 -1
- package/lib/{index-hyk_rzOj.mjs → index-CR1itkLl.mjs} +700 -683
- package/lib/{index-CHvWl09c.js → index-Cw0jWBks.js} +1 -1
- package/lib/{index-BXsTZ9x_.mjs → index-DSnylejH.mjs} +23 -15
- package/lib/{index-CPGWCfWD.js → index-HrZv1SyT.js} +8 -8
- package/lib/{index-_IZO0QRl.mjs → index-N4FkpEh9.mjs} +1 -1
- package/lib/{index-Ds7-hb1n.mjs → index-Txz5xwr6.mjs} +1 -1
- package/lib/{index-BCKX-m7h.mjs → index-pYTU7pQK.mjs} +1 -1
- package/lib/{index.es-ByyzusUN.mjs → index.es-B0fk_42a.mjs} +3 -3
- package/lib/{index.es-BC9c-IV7.mjs → index.es-CDqFguL5.mjs} +2 -2
- package/lib/{index.es-BmZ1Eaml.js → index.es-Dg6IFrL4.js} +1 -1
- package/lib/{index.es-DxdcaWwJ.js → index.es-DmmqAOLD.js} +3 -3
- package/lib/index.js +1 -1
- package/lib/index.mjs +6 -6
- package/lib/lifi.js +1 -1
- package/lib/lifi.mjs +2 -2
- package/lib/mayan.js +1 -1
- package/lib/mayan.mjs +2 -2
- package/lib/monad.js +1 -1
- package/lib/monad.mjs +1 -1
- package/lib/ntt.js +1 -1
- package/lib/ntt.mjs +1 -1
- package/lib/{secp256k1-BLiUzGcX.js → secp256k1-BkoM1Jum.js} +1 -1
- package/lib/{secp256k1-r0ke-jeG.js → secp256k1-CcVQkYNr.js} +1 -1
- package/lib/{secp256k1-D24BZJAq.js → secp256k1-CglUNI04.js} +1 -1
- package/lib/{secp256k1-rufcCDcw.mjs → secp256k1-DROP2Lhv.mjs} +1 -1
- package/lib/{secp256k1-ZQ8UIhmk.mjs → secp256k1-DzRCmd6a.mjs} +1 -1
- package/lib/{secp256k1-CXRI4XfW.mjs → secp256k1-LTcmQEQ5.mjs} +1 -1
- package/lib/{solana-CXtk3UX1.js → solana-C4k_Yg7w.js} +4 -4
- package/lib/{solana-lhrSUH_P.mjs → solana-D1LVIhGd.mjs} +8 -8
- package/lib/{solanaEmbed.esm-BMynjubZ.js → solanaEmbed.esm--Ac-IlRA.js} +1 -1
- package/lib/{solanaEmbed.esm-CFu0h50b.mjs → solanaEmbed.esm-AvWQUA9e.mjs} +2 -2
- package/lib/src/config/testnet/chains.d.ts.map +1 -1
- package/lib/src/config/testnet/rpcs.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/sdklegacy/config/TESTNET.d.ts.map +1 -1
- package/lib/{sui-CZNJPZ5q.mjs → sui-BPAb7kcs.mjs} +2 -2
- package/lib/{sui-CBxh7zmc.js → sui-CgmDTkXK.js} +1 -1
- package/lib/{tokenHelpers-DZRdlDO-.js → tokenHelpers-CbE0g9BP.js} +1 -1
- package/lib/{tokenHelpers-DT6mPtNP.mjs → tokenHelpers-DvWQs1tu.mjs} +1 -1
- package/lib/{tokens-FIs8YBYj.mjs → tokens-BJDttoCp.mjs} +1 -1
- package/lib/{tokens--uOMY2-j.js → tokens-CvZuVW-g.js} +1 -1
- package/lib/{w3m-modal-B5PtkowQ.js → w3m-modal-ByamyZny.js} +1 -1
- package/lib/{w3m-modal-CBYJj-sR.mjs → w3m-modal-CtQ0TPA4.mjs} +2 -2
- package/lib/{w3m-modal-h85Jyy9l.mjs → w3m-modal-DM5Pf8SH.mjs} +2 -2
- package/lib/{w3m-modal-B3FfPDki.js → w3m-modal-k23UDiov.js} +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./platform-CCG_jgOO.js"),W=require("./index-EbSw7SbC.js"),D=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./platform-CCG_jgOO.js"),W=require("./index-EbSw7SbC.js"),D=require("./index-C8eqQ_7p.js"),g=new e.Interface(["function start((bytes32,address,address,address,address,address,uint256,uint256,uint256,uint256)) returns (address,uint16,uint64)","function receiveMessageAndSwap(bytes)"]),S=new e.Interface(["function quoteExactInputSingle((address,address,uint256,uint24,uint160)) public view returns (uint256,uint160,uint32,uint256)"]),P="https://gfx.relayers.xlabs.xyz/api/v1/swap/quote";class U{static async quoteRelayer(o,t,r){if(e.isNative(t)||e.isNative(r))throw new Error("how did you get here tho?");const n=e.hex.encode(t.toUniversalAddress().toUint8Array(),!1),s=e.hex.encode(r.toUniversalAddress().toUint8Array(),!1),a={targetChain:e.toChainId(o),sourceToken:n,targetToken:s};try{const i=await e.axios.post(P,a);return BigInt(i.data.fee)}catch(i){throw e.axios.isAxiosError(i)?new Error(`Error getting relayer fee: ${i.response?.statusText}`):i}}}const f=100,w={ETH:[e.Wormhole.tokenId("Arbitrum","native"),e.Wormhole.tokenId("Base","native"),e.Wormhole.tokenId("Ethereum","native"),e.Wormhole.tokenId("Optimism","native")],WETH:[e.Wormhole.tokenId("Arbitrum","0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),e.Wormhole.tokenId("Avalanche","0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB"),e.Wormhole.tokenId("Base","0x4200000000000000000000000000000000000006"),e.Wormhole.tokenId("Bsc","0x2170Ed0880ac9A755fd29B2688956BD959F933F8"),e.Wormhole.tokenId("Ethereum","0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),e.Wormhole.tokenId("Optimism","0x4200000000000000000000000000000000000006"),e.Wormhole.tokenId("Polygon","0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619")],wstETH:[e.Wormhole.tokenId("Arbitrum","0x5979D7b546E38E414F7E9822514be443A4800529"),e.Wormhole.tokenId("Base","0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452"),e.Wormhole.tokenId("Ethereum","0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"),e.Wormhole.tokenId("Optimism","0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb"),e.Wormhole.tokenId("Polygon","0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD")],USDT:[e.Wormhole.tokenId("Arbitrum","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),e.Wormhole.tokenId("Avalanche","0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7"),e.Wormhole.tokenId("Base","0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2"),e.Wormhole.tokenId("Bsc","0x55d398326f99059fF775485246999027B3197955"),e.Wormhole.tokenId("Ethereum","0xdAC17F958D2ee523a2206206994597C13D831ec7"),e.Wormhole.tokenId("Optimism","0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"),e.Wormhole.tokenId("Polygon","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"),e.Wormhole.tokenId("Celo","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e")]};class l{network;chain;provider;contracts;chainId;core;tokenBridge;constructor(o,t,r,n){if(this.network=o,this.chain=t,this.provider=r,this.contracts=n,!n.portico)throw new Error("Unsupported chain, no contract addresses for: "+t);this.core=new W.EvmWormholeCore(o,t,r,n),this.tokenBridge=new D.EvmTokenBridge(o,t,r,n),this.chainId=e.networkChainToNativeChainId.get(o,t)}static async fromRpc(o,t){const[r,n]=await e.EvmPlatform.chainFromRpc(o),s=t[n];if(s.network!==r)throw new Error(`Network mismatch: ${s.network} != ${r}`);return new l(r,n,o,s.contracts)}async*transfer(o,t,r,n,s,c,a){const{minAmountStart:i,minAmountFinish:d}=a.swapAmounts;if(i===0n)throw new Error("Invalid min swap amount");if(d===0n)throw new Error("Invalid min swap amount");const u=new e.EvmAddress(o).toString(),[h,k]=e.resolveWrappedToken(this.network,this.chain,r),[A,E]=e.resolveWrappedToken(this.network,t.chain,s),p=e.canonicalAddress(k),T=e.canonicalAddress(await this.getTransferrableToken(p)),C=e.canonicalAddress(t),I=e.canonicalAddress(E),b=new Date().valueOf()%2**4,v=e.PorticoBridge.serializeFlagSet({flags:{shouldWrapNative:h,shouldUnwrapNative:A},recipientChain:e.toChainId(t.chain),bridgeNonce:b,feeTierStart:f,feeTierFinish:f,padding:new Uint8Array(19)}),F=g.encodeFunctionData("start",[[v,p.toLowerCase(),T,I.toLowerCase(),C,c,n.toString(),i.toString(),d.toString(),a.relayerFee.toString()]]),B=this.getTokenGroup(k.address.toString()),m=this.getPorticoAddress(B);h||(yield*this.approve(p,u,n,m));const y=await this.core.getMessageFee(),x={to:m,data:F,value:y+(h?n:0n)};yield this.createUnsignedTransaction(e.addFrom(x,u),"PorticoBridge.Transfer")}async*redeem(o,t){const r=e.toChain(t.payload.payload.flagSet.recipientChain),n=t.payload.payload.finalTokenAddress.toNative(r).toString(),s=this.getTokenGroup(n),c=this.getPorticoAddress(s),i=await new e.Contract(c,g.fragments,this.provider).getFunction("receiveMessageAndSwap").populateTransaction(e.serialize$1(t)),d=new e.EvmAddress(o).toString();yield this.createUnsignedTransaction(e.addFrom(i,d),"PorticoBridge.Redeem")}async isTransferCompleted(o){return await this.tokenBridge.tokenBridge.isTransferCompleted(e.keccak256(o.hash))}async quoteSwap(o,t,r,n){const[,s]=e.resolveWrappedToken(this.network,this.chain,o),[,c]=e.resolveWrappedToken(this.network,this.chain,t),a=e.canonicalAddress(s),i=e.canonicalAddress(c);if(e.isEqualCaseInsensitive(a,i))return n;const d=this.getQuoterAddress(r);return(await new e.Contract(d,S.fragments,this.provider).getFunction("quoteExactInputSingle").staticCall([a,i,n,f,0]))[0]}async quoteRelay(o,t){return await U.quoteRelayer(this.chain,o,t)}async getTransferrableToken(o){const t=e.Wormhole.tokenId(this.chain,o),[,r]=e.resolveWrappedToken(this.network,this.chain,t);if(this.chain==="Ethereum")return r;const n=Object.values(w).find(a=>a.find(i=>i.chain===this.chain&&e.canonicalAddress(i)===e.canonicalAddress(r)));if(!n)throw new Error(`No token group found for ${o} on ${this.chain}`);const s=n.find(a=>a.chain==="Ethereum");if(!s)throw new Error(`No Ethereum origin token found for ${o} on ${this.chain}`);const c=await this.tokenBridge.getWrappedAsset(s);return e.Wormhole.tokenId(this.chain,c.toString())}supportedTokens(){const o=[];for(const[t,r]of Object.entries(w))for(const n of r)n.chain===this.chain&&o.push({group:t,token:n});return o}getTokenGroup(o){const r=this.supportedTokens().find(n=>e.canonicalAddress(n.token)===o);if(!r)throw new Error("Token not found");return r.group}async*approve(o,t,r,n){const s=e.EvmPlatform.getTokenImplementation(this.provider,o);if(await s.allowance(t,n)<r){const a=await s.approve.populateTransaction(n,r);yield this.createUnsignedTransaction(e.addFrom(a,t),"PorticoBridge.Approve")}}createUnsignedTransaction(o,t){return new e.EvmUnsignedTransaction(e.addChainId(o,this.chainId),this.network,this.chain,t,!1)}getPorticoAddress(o){const t=this.contracts.portico;return o==="USDT"&&t.porticoPancakeSwap||t.porticoUniswap}getQuoterAddress(o){const t=this.contracts.portico;return o==="USDT"&&t.pancakeSwapQuoterV2||t.uniswapQuoterV2}}e.registerProtocol(e._platform,"PorticoBridge",l);exports.EvmPorticoBridge=l;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { I as v, i as E, m as C, ah as x, J as T, W as s, l as Q, V as I, aK as b, aV as u, N as d, dc as V, aL as l, L as H, E as B, at as M, H as _, dd as z, X as G, aM as j, au as J, aN as K } from "./platform-Cil_UtAQ.mjs";
|
|
2
2
|
import { EvmWormholeCore as X } from "./index-BKgliEPZ.mjs";
|
|
3
|
-
import { EvmTokenBridge as Y } from "./index-
|
|
3
|
+
import { EvmTokenBridge as Y } from "./index-pYTU7pQK.mjs";
|
|
4
4
|
const F = new v([
|
|
5
5
|
"function start((bytes32,address,address,address,address,address,uint256,uint256,uint256,uint256)) returns (address,uint16,uint64)",
|
|
6
6
|
"function receiveMessageAndSwap(bytes)"
|