@wormhole-foundation/wormhole-connect 3.0.2-beta.0-development → 3.0.2-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/assets/{basic-ChNCp6rI.js → basic-PUjrTVXb.js} +1 -1
- package/dist/assets/{evm-DSirgd5b.js → evm-CO5UWnAY.js} +2 -2
- package/dist/assets/{index-L-lC4rqb.js → index-1lzfHdT2.js} +1 -1
- package/dist/assets/{index-CHfaLf5J.js → index-DBVZDYF7.js} +1 -1
- package/dist/assets/index-DKlPX3ZI.js +1 -0
- package/dist/assets/{index-BtCrMDAu.js → index-Ddk7n7Ti.js} +1 -1
- package/dist/assets/{index-HhyysXFu.js → index-DyUmO4PR.js} +1 -1
- package/dist/assets/{index-BiwA3Bbq.js → index-MMzKxP1N.js} +1 -1
- package/dist/assets/{secp256k1-Cd7rIav0.js → secp256k1-0LtSM2L1.js} +1 -1
- package/dist/assets/{secp256k1-BQBOR8e3.js → secp256k1-DwTU3j1N.js} +1 -1
- package/dist/assets/{solana-DcwLWeKT.js → solana-DlGdMBSL.js} +4 -4
- package/dist/assets/{w3m-modal-DdptuLHe.js → w3m-modal-DD9Jgepz.js} +1 -1
- package/dist/main.js +72 -70
- package/dist/src/AppRouter.d.ts.map +1 -1
- package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/config/tokens.d.ts +1 -1
- package/dist/src/config/tokens.d.ts.map +1 -1
- package/dist/src/exports/index.d.ts +2 -2
- package/dist/src/exports/index.d.ts.map +1 -1
- package/dist/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/dist/src/icons/Chains/PLUME.d.ts.map +1 -1
- package/dist/src/icons/PoweredBy.d.ts.map +1 -1
- package/dist/src/icons/Routing.d.ts +5 -0
- package/dist/src/icons/Routing.d.ts.map +1 -0
- package/dist/src/icons/Tokens/PLUME.d.ts.map +1 -1
- package/dist/src/store/transferInput.d.ts +1 -1
- package/dist/src/store/transferInput.d.ts.map +1 -1
- package/dist/src/utils/coingecko.d.ts.map +1 -1
- package/dist/src/utils/formatNumber.d.ts +23 -0
- package/dist/src/utils/formatNumber.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +3 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/routes.d.ts +12 -0
- package/dist/src/utils/routes.d.ts.map +1 -0
- package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
- package/dist/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
- package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
- package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
- package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
- package/dist/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/account-Br8E7RB6.js +1 -0
- package/lib/{account-BTK2b2Fv.mjs → account-CVa_3S2g.mjs} +1 -1
- package/lib/{address-8wLqn60W.mjs → address-BApwdEpr.mjs} +96 -96
- package/lib/address-BwQqFkyh.js +1 -0
- package/lib/address-C2pxq9b2.js +1 -0
- package/lib/{address-n0gAFMrZ.mjs → address-f6joE_ig.mjs} +12 -12
- package/lib/aptos-CMRGggVs.js +2 -0
- package/lib/{aptos-CK-j196x.js → aptos-CTKQNmlP.js} +1 -1
- package/lib/{aptos-B-DJQlwt.mjs → aptos-CfFbx7uf.mjs} +9 -9
- package/lib/{aptos-Bwcz9wZX.mjs → aptos-fozuppXh.mjs} +3 -3
- package/lib/{basic-DHWVLmCq.mjs → basic-BA2aRJJn.mjs} +2 -2
- package/lib/{basic-B5ZFelC_.js → basic-DUWaF2I0.js} +1 -1
- package/lib/{basic-E2M-9h1u.js → basic-DeiUayOA.js} +1 -1
- package/lib/{basic-Pour9Ggp.mjs → basic-DoC8u7J8.mjs} +2 -2
- package/lib/{blake2b-C5HyObld.mjs → blake2b-BGxWUAjG.mjs} +23 -23
- package/lib/blake2b-Fj1aPKgL.js +1 -0
- package/lib/{browser-ponyfill-jK8MKVVg.mjs → browser-ponyfill-D5AN8ZPp.mjs} +1 -1
- package/lib/browser-ponyfill-Dn6gsMYK.js +2 -0
- package/lib/{chain-Bm6u6eUF.mjs → chain-DAw2I5H8.mjs} +1 -1
- package/lib/chain-DnPXlO8g.js +1 -0
- package/lib/chunk-KJH4KKG6-BjF7YUcU.js +470 -0
- package/lib/{chunk-KJH4KKG6-DJsu-Y-X.mjs → chunk-KJH4KKG6-DmVjhXO7.mjs} +144 -144
- package/lib/{constants-Cf2YMjNo.js → constants-BtNs_2F4.js} +1 -1
- package/lib/{constants-B7AbX6qr.mjs → constants-Dcc2nVaW.mjs} +3 -3
- package/lib/contract-BEHYQLvJ.js +1 -0
- package/lib/{contract-llnN6ki0.mjs → contract-BkMAZomO.mjs} +123 -123
- package/lib/{core-CF5c7Vev.mjs → core-BHV42Qa0.mjs} +25 -26
- package/lib/core-CV23yxnG.js +889 -0
- package/lib/create-CHcGblj6.js +1 -0
- package/lib/{create-Dm87_0zG.mjs → create-CKLtL7hr.mjs} +1 -1
- package/lib/{evm-BYIGg8e4.mjs → evm-Bf7qbM19.mjs} +42 -42
- package/lib/{evm-B2hUWkt7.js → evm-ClWkquRx.js} +2 -2
- package/lib/{evm-fvvpk-li.mjs → evm-DhMoy8cH.mjs} +6 -6
- package/lib/{evm-DFNbMHoa.js → evm-tXmzU9Xp.js} +2 -2
- package/lib/executor.js +1 -1
- package/lib/executor.mjs +145 -138
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/{index-Cwo5AKUC.mjs → index-1rCCpdwd.mjs} +5 -5
- package/lib/{index-DBCa3k0j.mjs → index-3HvzWPL7.mjs} +9 -9
- package/lib/{index-MOwE6ses.mjs → index-B7ztYPhr.mjs} +21 -22
- package/lib/index-BM-0SeYB.js +1 -0
- package/lib/{index-DiQ8Ytrt.mjs → index-BTnpftLz.mjs} +1 -1
- package/lib/{index-BiCMaXJS.js → index-BWQMi6Rj.js} +1 -1
- package/lib/index-BbgKw2pu.js +1 -0
- package/lib/index-BblcpkoK.js +1 -0
- package/lib/index-Bfblsmud.js +1 -0
- package/lib/{index-C_0yAOSX.mjs → index-BfkFXEnG.mjs} +25082 -24072
- package/lib/{index-fi1sh8vr.mjs → index-BijBPDRn.mjs} +2 -2
- package/lib/index-BoquY9R2.js +337 -0
- package/lib/index-C2NtsO9Q.js +1 -0
- package/lib/{index-CNuk-XLX.mjs → index-C4JmrizV.mjs} +4 -4
- package/lib/index-C8TtXpOf.js +1 -0
- package/lib/index-CB8kOyIP.js +1 -0
- package/lib/index-CInVjUCW.js +1 -0
- package/lib/{index-BF11RebI.mjs → index-CLTklDbp.mjs} +1 -1
- package/lib/index-CQvgeH_r.js +1 -0
- package/lib/{index-DzYjoSJp.mjs → index-CUnOYRFQ.mjs} +23 -24
- package/lib/{index-DGh9LzN1.mjs → index-CWe_BTdo.mjs} +31 -31
- package/lib/{index-2Bz1Np4K.mjs → index-CZ91lJ9M.mjs} +5 -5
- package/lib/{index-Dgy1FO7C.js → index-CgyVnj6U.js} +1 -1
- package/lib/{index-BzJcFdt_.mjs → index-Clr2JjoJ.mjs} +44 -44
- package/lib/index-CnnCCv6Q.js +1 -0
- package/lib/{index-CJnRWlFf.mjs → index-CwxGLNEk.mjs} +48 -49
- package/lib/index-D7BLfz05.js +1 -0
- package/lib/index-DM7C-wvQ.js +3 -0
- package/lib/{index-DhIh3xiW.mjs → index-DNy_sNGr.mjs} +8 -8
- package/lib/{index-BZaRg0yd.mjs → index-DVcaDWmz.mjs} +1 -1
- package/lib/{index-CsAigASU.mjs → index-DWOP9OBp.mjs} +17 -17
- package/lib/{index-CTLz8Fz0.mjs → index-Dda5qc2t.mjs} +13 -14
- package/lib/{index-CLBXF_zH.mjs → index-DeaiBvpG.mjs} +16 -16
- package/lib/index-HOuGP-7b.js +1 -0
- package/lib/{index-Dt2uNp-N.mjs → index-KZve3tYJ.mjs} +4 -4
- package/lib/{index-CJDBidKv.mjs → index-SIyXqCAN.mjs} +41 -41
- package/lib/index-WhVYPMUr.js +1 -0
- package/lib/index-hmjT4xa7.js +1 -0
- package/lib/index-ledagFNU.js +1 -0
- package/lib/index-pbRVlgcN.js +1 -0
- package/lib/{index-BpQXUhR4.mjs → index-qK7AyMAk.mjs} +23 -27
- package/lib/index-ttZu99PZ.js +1 -0
- package/lib/{index.es-BqRBGIq6.mjs → index.es-BXRQf6Oi.mjs} +25 -26
- package/lib/index.es-BjGaOok5.js +11 -0
- package/lib/index.es-D6S74vhi.js +27 -0
- package/lib/{index.es-DgCZuUzB.mjs → index.es-cOw8juwf.mjs} +741 -737
- package/lib/index.js +1 -1
- package/lib/index.mjs +17 -16
- package/lib/mayan.js +3 -3
- package/lib/mayan.mjs +918 -891
- package/lib/mint-CL36R6ED.js +1 -0
- package/lib/{mint-Dc-VsiAn.mjs → mint-DunEG1jV.mjs} +32 -33
- package/lib/ntt.js +1 -1
- package/lib/ntt.mjs +2332 -2373
- package/lib/platform-7vCWzCny.js +1 -0
- package/lib/platform-BKhoO9So.js +1 -0
- package/lib/{platform-B95L0Vxv.mjs → platform-BN6LFtXE.mjs} +16 -16
- package/lib/{platform-DnP_1wGA.mjs → platform-BYLu9SzP.mjs} +4 -4
- package/lib/platform-Bbe26nx7.js +1 -0
- package/lib/{platform-DiG7WY9Z.mjs → platform-DCgWqmh1.mjs} +4 -4
- package/lib/{provider-jsonrpc-CRABh2gN.mjs → provider-jsonrpc-Bmgnrmpy.mjs} +155 -155
- package/lib/provider-jsonrpc-CbtP2Ffg.js +1 -0
- package/lib/{secp256k1-zHHDNAlH.mjs → secp256k1-BDQEvyHq.mjs} +1 -1
- package/lib/{secp256k1-obBDPYM-.mjs → secp256k1-C77Oh9AA.mjs} +1 -1
- package/lib/{secp256k1-2hq3Jk4g.mjs → secp256k1-CCn2vlXj.mjs} +1 -1
- package/lib/{secp256k1-B94G4gyy.js → secp256k1-CHAR40au.js} +1 -1
- package/lib/{secp256k1-DCcAh19h.js → secp256k1-D-DmPYcJ.js} +1 -1
- package/lib/{secp256k1-CjndBUS7.js → secp256k1-DYWDlveU.js} +1 -1
- package/lib/{signer-N_ccpPOz.mjs → signer-BIcn81N5.mjs} +18 -18
- package/lib/signer-H7atraks.js +1 -0
- package/lib/{solana-_Ha4YgiP.mjs → solana-B0QSg7B3.mjs} +30 -30
- package/lib/solana-Cs5VyB20.js +900 -0
- package/lib/solana-uvHG8JV5.js +1 -0
- package/lib/solana-zyfOlbhb.mjs +18 -0
- package/lib/{solanaEmbed.esm-DK5RIquB.mjs → solanaEmbed.esm-BqdznDuW.mjs} +623 -622
- package/lib/solanaEmbed.esm-D8vtESE6.js +10 -0
- package/lib/src/AppRouter.d.ts.map +1 -1
- package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/config/tokens.d.ts +1 -1
- package/lib/src/config/tokens.d.ts.map +1 -1
- package/lib/src/exports/index.d.ts +2 -2
- package/lib/src/exports/index.d.ts.map +1 -1
- package/lib/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/lib/src/icons/Chains/PLUME.d.ts.map +1 -1
- package/lib/src/icons/PoweredBy.d.ts.map +1 -1
- package/lib/src/icons/Routing.d.ts +5 -0
- package/lib/src/icons/Routing.d.ts.map +1 -0
- package/lib/src/icons/Tokens/PLUME.d.ts.map +1 -1
- package/lib/src/store/transferInput.d.ts +1 -1
- package/lib/src/store/transferInput.d.ts.map +1 -1
- package/lib/src/utils/coingecko.d.ts.map +1 -1
- package/lib/src/utils/formatNumber.d.ts +23 -0
- package/lib/src/utils/formatNumber.d.ts.map +1 -0
- package/lib/src/utils/index.d.ts +3 -1
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/routes.d.ts +12 -0
- package/lib/src/utils/routes.d.ts.map +1 -0
- package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
- package/lib/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
- package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
- package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
- package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
- package/lib/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/{sui-CQcQ6w_P.mjs → sui-B38DyOqM.mjs} +44 -44
- package/lib/{sui-BplKFZQu.mjs → sui-BpfnZR4f.mjs} +3 -3
- package/lib/sui-CT9MWY38.js +1 -0
- package/lib/{sui-_hvmCvD8.js → sui-DXQAMRQJ.js} +1 -1
- package/lib/{tokens-DNv0ZNvU.js → tokens-CmINcwKk.js} +31 -31
- package/lib/{tokens-Dl4YwW18.mjs → tokens-YxAPPVy3.mjs} +1726 -1724
- package/lib/transfer-BQ72fByU.js +1 -0
- package/lib/transfer-bTW0j9yh.mjs +58 -0
- package/lib/units-Ckije3Qv.js +1 -0
- package/lib/{units-DPWUSE6J.mjs → units-CtyvuzxQ.mjs} +13 -13
- package/lib/unsignedTransaction-C6Qp42VS.js +1 -0
- package/lib/{unsignedTransaction-DwcUilyN.mjs → unsignedTransaction-CXB-QCUC.mjs} +18 -18
- package/lib/{w3m-modal-BJILsxDp.mjs → w3m-modal-B7LUHLWC.mjs} +2 -2
- package/lib/{w3m-modal-D4CpFxO2.mjs → w3m-modal-BOTzBqbc.mjs} +2 -2
- package/lib/{w3m-modal-CrfHWSrF.js → w3m-modal-BTb03-7B.js} +1 -1
- package/lib/{w3m-modal-CBG2MSPp.js → w3m-modal-xmdf4r6V.js} +1 -1
- package/lib/web3-COTIsLs8.js +22 -0
- package/lib/{address-B-XN4tFw.mjs → web3-DYVeiqSa.mjs} +6599 -6576
- package/package.json +32 -32
- package/dist/assets/index-BWPgrXHs.js +0 -1
- package/lib/account-cRt2xMoW.js +0 -1
- package/lib/address-BGujeWtN.js +0 -22
- package/lib/address-C7DIAk4M.js +0 -1
- package/lib/address-KNhRm6oe.js +0 -1
- package/lib/aptos-f5TqmvqV.js +0 -2
- package/lib/blake2b-B-MRXUPb.js +0 -1
- package/lib/browser-ponyfill-CE6vRkjp.js +0 -2
- package/lib/chain-Hsn22HAP.js +0 -1
- package/lib/chunk-KJH4KKG6-CoyI75Ig.js +0 -470
- package/lib/contract-D2fTrJgn.js +0 -1
- package/lib/core-v0G9f7LX.js +0 -889
- package/lib/create-DoZZ7ciL.js +0 -1
- package/lib/index-B8-KKWD-.js +0 -1
- package/lib/index-BHbvgOMD.js +0 -1
- package/lib/index-BHfUgvSV.js +0 -1
- package/lib/index-BTKC7Hou.js +0 -1
- package/lib/index-BWXglAWd.js +0 -1
- package/lib/index-Bpp8C4u8.js +0 -1
- package/lib/index-CF2fHBHJ.js +0 -3
- package/lib/index-CTPz98nv.js +0 -1
- package/lib/index-ClMoiji-.js +0 -1
- package/lib/index-ClsVcH6F.js +0 -1
- package/lib/index-CqOI6LVu.js +0 -1
- package/lib/index-DCz_4mcz.js +0 -1
- package/lib/index-DKksdvND.js +0 -335
- package/lib/index-DRv3ZpVL.js +0 -1
- package/lib/index-DYqo8IhM.js +0 -1
- package/lib/index-DZubce9o.js +0 -1
- package/lib/index-DprM_IpB.js +0 -1
- package/lib/index-DshEQYMA.js +0 -1
- package/lib/index-JrM783SN.js +0 -1
- package/lib/index.es-C6YhioMN.js +0 -27
- package/lib/index.es-D3Xxxr8I.js +0 -11
- package/lib/mint-DlXC3sGi.js +0 -1
- package/lib/platform-B1XoDKoN.js +0 -1
- package/lib/platform-COuZC5Zc.js +0 -1
- package/lib/platform-NG3efAb2.js +0 -1
- package/lib/provider-jsonrpc-pXNHQF7n.js +0 -1
- package/lib/signer-CCa6npZ3.js +0 -1
- package/lib/solana-BJ3aReZw.mjs +0 -18
- package/lib/solana-BwyVgP30.js +0 -1
- package/lib/solana-CanFuMgA.js +0 -900
- package/lib/solanaEmbed.esm-C--1F7Lx.js +0 -10
- package/lib/sui-Bs83Gy5Z.js +0 -1
- package/lib/units-BvcKDiAx.js +0 -1
- package/lib/unsignedTransaction-dN_5EJf5.js +0 -1
- package/lib/web3-Bu_6UejS.mjs +0 -67
- package/lib/web3-Doz_0RHD.js +0 -1
package/lib/mayan.mjs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
var nt = Object.defineProperty;
|
|
2
2
|
var at = (e, t, n) => t in e ? nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var Y = (e, t, n) => at(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { o } from "./browser-ponyfill-
|
|
5
|
-
import { d as dist, c as commonjsGlobal,
|
|
6
|
-
import { o as object, l as literal, p as pipe, t as transform, u as union, s as string, a as array, n as nullish, c as check, b as number, i as integer, d as optional, e as tuple, f as nullable, g as unknown, r as record, h as boolean, j as lazy, k as parse, m as is, q as bigint, T as Transaction$1, S as SUI_TYPE_ARG$1, v as SUI_CLOCK_OBJECT_ID$1, w as SuiPlatform } from "./platform-
|
|
7
|
-
import { b as blake2b } from "./blake2b-
|
|
8
|
-
import { Z as ZeroAddress } from "./provider-jsonrpc-
|
|
9
|
-
import { C as Contract, t as toBeHex } from "./contract-
|
|
10
|
-
import { p as parseUnits } from "./units-
|
|
11
|
-
import { S as
|
|
4
|
+
import { o } from "./browser-ponyfill-D5AN8ZPp.mjs";
|
|
5
|
+
import { d as dist, c as commonjsGlobal, Z as base58, H as Connection, P as PublicKey$1, _ as ComputeBudgetProgram, $ as SystemProgram, b as bufferPolyfill, a0 as Keypair, a1 as SYSVAR_CLOCK_PUBKEY, a2 as SYSVAR_RENT_PUBKEY, a3 as struct, a4 as TransactionInstruction, a5 as zeroPadValue, a6 as u8, a7 as blob, a8 as u16, a9 as AddressLookupTableAccount, aa as keccak256, ab as axios, ac as deserialize, k as hex, T as TransferState, ad as toChain, ae as AutomaticRoute, o as canonicalAddress, m as isNative, G as parse$1, af as getDeciBps, F as units, u as fromBaseUnits, ag as UnavailableError, L as denoise, W as Wormhole, D as usdcContract, ah as MinAmountError, ai as MessageV0, aj as VersionedTransaction, ak as isSignAndSendSigner, al as isSignOnlySigner, y as networkChainToNativeChainId, O as isCompleted, am as isRedeemed, S as isRefunded, an as isSourceInitiated, ao as isSourceFinalized, Q as isAttested } from "./web3-DYVeiqSa.mjs";
|
|
6
|
+
import { o as object, l as literal, p as pipe, t as transform, u as union, s as string, a as array, n as nullish, c as check, b as number, i as integer, d as optional, e as tuple, f as nullable, g as unknown, r as record, h as boolean, j as lazy, k as parse, m as is, q as bigint, T as Transaction$1, S as SUI_TYPE_ARG$1, v as SUI_CLOCK_OBJECT_ID$1, w as SuiPlatform } from "./platform-BYLu9SzP.mjs";
|
|
7
|
+
import { b as blake2b } from "./blake2b-BGxWUAjG.mjs";
|
|
8
|
+
import { Z as ZeroAddress } from "./provider-jsonrpc-Bmgnrmpy.mjs";
|
|
9
|
+
import { C as Contract, t as toBeHex } from "./contract-BkMAZomO.mjs";
|
|
10
|
+
import { p as parseUnits } from "./units-CtyvuzxQ.mjs";
|
|
11
|
+
import { S as SolanaPlatform, a as SolanaUnsignedTransaction } from "./unsignedTransaction-CXB-QCUC.mjs";
|
|
12
|
+
import { c as createAssociatedTokenAccountIdempotentInstruction, a as createTransferInstruction } from "./transfer-bTW0j9yh.mjs";
|
|
12
13
|
import { S as SuiUnsignedTransaction } from "./unsignedTransaction-BD81leu1.mjs";
|
|
13
|
-
import { E as EvmPlatform } from "./platform-
|
|
14
|
+
import { E as EvmPlatform } from "./platform-BN6LFtXE.mjs";
|
|
14
15
|
import { E as EvmUnsignedTransaction } from "./unsignedTransaction-C0V0UbsS.mjs";
|
|
16
|
+
import { b as getAssociatedTokenAddressSync } from "./mint-DunEG1jV.mjs";
|
|
15
17
|
var sha3 = { exports: {} };
|
|
16
18
|
(function(e) {
|
|
17
19
|
(function() {
|
|
@@ -19,7 +21,7 @@ var sha3 = { exports: {} };
|
|
|
19
21
|
r.JS_SHA3_NO_WINDOW && (a = !1);
|
|
20
22
|
var s = !a && typeof self == "object", u = !r.JS_SHA3_NO_NODE_JS && typeof dist.process == "object" && dist.process.versions && dist.process.versions.node;
|
|
21
23
|
u ? r = commonjsGlobal : s && (r = self);
|
|
22
|
-
var i = !r.JS_SHA3_NO_COMMON_JS && !0 && e.exports, l = !r.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", c = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696],
|
|
24
|
+
var i = !r.JS_SHA3_NO_COMMON_JS && !0 && e.exports, l = !r.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", c = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], p = [4, 1024, 262144, 67108864], b = [1, 256, 65536, 16777216], m = [6, 1536, 393216, 100663296], f = [0, 8, 16, 24], g = [
|
|
23
25
|
1,
|
|
24
26
|
0,
|
|
25
27
|
32898,
|
|
@@ -72,195 +74,195 @@ var sha3 = { exports: {} };
|
|
|
72
74
|
128: 168,
|
|
73
75
|
256: 136
|
|
74
76
|
};
|
|
75
|
-
(r.JS_SHA3_NO_NODE_JS || !Array.isArray) && (Array.isArray = function(
|
|
76
|
-
return Object.prototype.toString.call(
|
|
77
|
-
}), l && (r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(
|
|
78
|
-
return typeof
|
|
77
|
+
(r.JS_SHA3_NO_NODE_JS || !Array.isArray) && (Array.isArray = function(y) {
|
|
78
|
+
return Object.prototype.toString.call(y) === "[object Array]";
|
|
79
|
+
}), l && (r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(y) {
|
|
80
|
+
return typeof y == "object" && y.buffer && y.buffer.constructor === ArrayBuffer;
|
|
79
81
|
});
|
|
80
|
-
for (var
|
|
81
|
-
return function(
|
|
82
|
-
return new H(
|
|
82
|
+
for (var I = function(y, w, S) {
|
|
83
|
+
return function(P) {
|
|
84
|
+
return new H(y, w, y).update(P)[S]();
|
|
83
85
|
};
|
|
84
|
-
},
|
|
85
|
-
return function(
|
|
86
|
-
return new H(
|
|
86
|
+
}, C = function(y, w, S) {
|
|
87
|
+
return function(P, k) {
|
|
88
|
+
return new H(y, w, k).update(P)[S]();
|
|
87
89
|
};
|
|
88
|
-
},
|
|
89
|
-
return function(
|
|
90
|
-
return j["cshake" +
|
|
90
|
+
}, E = function(y, w, S) {
|
|
91
|
+
return function(P, k, O, F) {
|
|
92
|
+
return j["cshake" + y].update(P, k, O, F)[S]();
|
|
91
93
|
};
|
|
92
|
-
}, R = function(
|
|
93
|
-
return function(
|
|
94
|
-
return j["kmac" +
|
|
94
|
+
}, R = function(y, w, S) {
|
|
95
|
+
return function(P, k, O, F) {
|
|
96
|
+
return j["kmac" + y].update(P, k, O, F)[S]();
|
|
95
97
|
};
|
|
96
|
-
}, $ = function(
|
|
98
|
+
}, $ = function(y, w, S, P) {
|
|
97
99
|
for (var k = 0; k < h.length; ++k) {
|
|
98
100
|
var O = h[k];
|
|
99
|
-
|
|
101
|
+
y[O] = w(S, P, O);
|
|
100
102
|
}
|
|
101
|
-
return
|
|
102
|
-
}, N = function(
|
|
103
|
-
var
|
|
104
|
-
return
|
|
105
|
-
return new H(
|
|
106
|
-
},
|
|
107
|
-
return
|
|
108
|
-
}, $(
|
|
109
|
-
}, D = function(
|
|
110
|
-
var
|
|
111
|
-
return
|
|
112
|
-
return new H(
|
|
113
|
-
},
|
|
114
|
-
return
|
|
115
|
-
}, $(
|
|
116
|
-
}, M = function(
|
|
117
|
-
var
|
|
118
|
-
return
|
|
119
|
-
return !O && !
|
|
120
|
-
},
|
|
121
|
-
return
|
|
122
|
-
}, $(
|
|
123
|
-
}, v = function(
|
|
124
|
-
var
|
|
125
|
-
return
|
|
126
|
-
return new q(
|
|
127
|
-
},
|
|
128
|
-
return
|
|
129
|
-
}, $(
|
|
103
|
+
return y;
|
|
104
|
+
}, N = function(y, w) {
|
|
105
|
+
var S = I(y, w, "hex");
|
|
106
|
+
return S.create = function() {
|
|
107
|
+
return new H(y, w, y);
|
|
108
|
+
}, S.update = function(P) {
|
|
109
|
+
return S.create().update(P);
|
|
110
|
+
}, $(S, I, y, w);
|
|
111
|
+
}, D = function(y, w) {
|
|
112
|
+
var S = C(y, w, "hex");
|
|
113
|
+
return S.create = function(P) {
|
|
114
|
+
return new H(y, w, P);
|
|
115
|
+
}, S.update = function(P, k) {
|
|
116
|
+
return S.create(k).update(P);
|
|
117
|
+
}, $(S, C, y, w);
|
|
118
|
+
}, M = function(y, w) {
|
|
119
|
+
var S = _[y], P = E(y, w, "hex");
|
|
120
|
+
return P.create = function(k, O, F) {
|
|
121
|
+
return !O && !F ? j["shake" + y].create(k) : new H(y, w, k).bytepad([O, F], S);
|
|
122
|
+
}, P.update = function(k, O, F, B) {
|
|
123
|
+
return P.create(O, F, B).update(k);
|
|
124
|
+
}, $(P, E, y, w);
|
|
125
|
+
}, v = function(y, w) {
|
|
126
|
+
var S = _[y], P = R(y, w, "hex");
|
|
127
|
+
return P.create = function(k, O, F) {
|
|
128
|
+
return new q(y, w, O).bytepad(["KMAC", F], S).bytepad([k], S);
|
|
129
|
+
}, P.update = function(k, O, F, B) {
|
|
130
|
+
return P.create(k, F, B).update(O);
|
|
131
|
+
}, $(P, R, y, w);
|
|
130
132
|
}, U = [
|
|
131
133
|
{ name: "keccak", padding: b, bits: T, createMethod: N },
|
|
132
134
|
{ name: "sha3", padding: m, bits: T, createMethod: N },
|
|
133
135
|
{ name: "shake", padding: d, bits: A, createMethod: D },
|
|
134
|
-
{ name: "cshake", padding:
|
|
135
|
-
{ name: "kmac", padding:
|
|
136
|
+
{ name: "cshake", padding: p, bits: A, createMethod: M },
|
|
137
|
+
{ name: "kmac", padding: p, bits: A, createMethod: v }
|
|
136
138
|
], j = {}, W = [], V = 0; V < U.length; ++V)
|
|
137
|
-
for (var z = U[V],
|
|
138
|
-
var Q = z.name + "_" +
|
|
139
|
-
if (W.push(Q), j[Q] = z.createMethod(
|
|
140
|
-
var ee = z.name +
|
|
139
|
+
for (var z = U[V], X = z.bits, J = 0; J < X.length; ++J) {
|
|
140
|
+
var Q = z.name + "_" + X[J];
|
|
141
|
+
if (W.push(Q), j[Q] = z.createMethod(X[J], z.padding), z.name !== "sha3") {
|
|
142
|
+
var ee = z.name + X[J];
|
|
141
143
|
W.push(ee), j[ee] = j[Q];
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
|
-
function H(
|
|
145
|
-
this.blocks = [], this.s = [], this.padding =
|
|
146
|
-
for (var
|
|
147
|
-
this.s[
|
|
146
|
+
function H(y, w, S) {
|
|
147
|
+
this.blocks = [], this.s = [], this.padding = w, this.outputBits = S, this.reset = !0, this.finalized = !1, this.block = 0, this.start = 0, this.blockCount = 1600 - (y << 1) >> 5, this.byteCount = this.blockCount << 2, this.outputBlocks = S >> 5, this.extraBytes = (S & 31) >> 3;
|
|
148
|
+
for (var P = 0; P < 50; ++P)
|
|
149
|
+
this.s[P] = 0;
|
|
148
150
|
}
|
|
149
|
-
H.prototype.update = function(
|
|
151
|
+
H.prototype.update = function(y) {
|
|
150
152
|
if (this.finalized)
|
|
151
153
|
throw new Error(n);
|
|
152
|
-
var
|
|
153
|
-
if (
|
|
154
|
-
if (
|
|
155
|
-
if (
|
|
154
|
+
var w, S = typeof y;
|
|
155
|
+
if (S !== "string") {
|
|
156
|
+
if (S === "object") {
|
|
157
|
+
if (y === null)
|
|
156
158
|
throw new Error(t);
|
|
157
|
-
if (l &&
|
|
158
|
-
|
|
159
|
-
else if (!Array.isArray(
|
|
159
|
+
if (l && y.constructor === ArrayBuffer)
|
|
160
|
+
y = new Uint8Array(y);
|
|
161
|
+
else if (!Array.isArray(y) && (!l || !ArrayBuffer.isView(y)))
|
|
160
162
|
throw new Error(t);
|
|
161
163
|
} else
|
|
162
164
|
throw new Error(t);
|
|
163
|
-
|
|
165
|
+
w = !0;
|
|
164
166
|
}
|
|
165
|
-
for (var
|
|
167
|
+
for (var P = this.blocks, k = this.byteCount, O = y.length, F = this.blockCount, B = 0, L = this.s, x, G; B < O; ) {
|
|
166
168
|
if (this.reset)
|
|
167
|
-
for (this.reset = !1,
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
for (
|
|
171
|
-
|
|
169
|
+
for (this.reset = !1, P[0] = this.block, x = 1; x < F + 1; ++x)
|
|
170
|
+
P[x] = 0;
|
|
171
|
+
if (w)
|
|
172
|
+
for (x = this.start; B < O && x < k; ++B)
|
|
173
|
+
P[x >> 2] |= y[B] << f[x++ & 3];
|
|
172
174
|
else
|
|
173
|
-
for (
|
|
174
|
-
G =
|
|
175
|
-
if (this.lastByteIndex =
|
|
176
|
-
for (this.start =
|
|
177
|
-
L[
|
|
178
|
-
|
|
175
|
+
for (x = this.start; B < O && x < k; ++B)
|
|
176
|
+
G = y.charCodeAt(B), G < 128 ? P[x >> 2] |= G << f[x++ & 3] : G < 2048 ? (P[x >> 2] |= (192 | G >> 6) << f[x++ & 3], P[x >> 2] |= (128 | G & 63) << f[x++ & 3]) : G < 55296 || G >= 57344 ? (P[x >> 2] |= (224 | G >> 12) << f[x++ & 3], P[x >> 2] |= (128 | G >> 6 & 63) << f[x++ & 3], P[x >> 2] |= (128 | G & 63) << f[x++ & 3]) : (G = 65536 + ((G & 1023) << 10 | y.charCodeAt(++B) & 1023), P[x >> 2] |= (240 | G >> 18) << f[x++ & 3], P[x >> 2] |= (128 | G >> 12 & 63) << f[x++ & 3], P[x >> 2] |= (128 | G >> 6 & 63) << f[x++ & 3], P[x >> 2] |= (128 | G & 63) << f[x++ & 3]);
|
|
177
|
+
if (this.lastByteIndex = x, x >= k) {
|
|
178
|
+
for (this.start = x - k, this.block = P[F], x = 0; x < F; ++x)
|
|
179
|
+
L[x] ^= P[x];
|
|
180
|
+
Z(L), this.reset = !0;
|
|
179
181
|
} else
|
|
180
|
-
this.start =
|
|
182
|
+
this.start = x;
|
|
181
183
|
}
|
|
182
184
|
return this;
|
|
183
|
-
}, H.prototype.encode = function(
|
|
184
|
-
var
|
|
185
|
-
for (
|
|
186
|
-
k.unshift(
|
|
187
|
-
return
|
|
188
|
-
}, H.prototype.encodeString = function(
|
|
189
|
-
var
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
if (
|
|
185
|
+
}, H.prototype.encode = function(y, w) {
|
|
186
|
+
var S = y & 255, P = 1, k = [S];
|
|
187
|
+
for (y = y >> 8, S = y & 255; S > 0; )
|
|
188
|
+
k.unshift(S), y = y >> 8, S = y & 255, ++P;
|
|
189
|
+
return w ? k.push(P) : k.unshift(P), this.update(k), k.length;
|
|
190
|
+
}, H.prototype.encodeString = function(y) {
|
|
191
|
+
var w, S = typeof y;
|
|
192
|
+
if (S !== "string") {
|
|
193
|
+
if (S === "object") {
|
|
194
|
+
if (y === null)
|
|
193
195
|
throw new Error(t);
|
|
194
|
-
if (l &&
|
|
195
|
-
|
|
196
|
-
else if (!Array.isArray(
|
|
196
|
+
if (l && y.constructor === ArrayBuffer)
|
|
197
|
+
y = new Uint8Array(y);
|
|
198
|
+
else if (!Array.isArray(y) && (!l || !ArrayBuffer.isView(y)))
|
|
197
199
|
throw new Error(t);
|
|
198
200
|
} else
|
|
199
201
|
throw new Error(t);
|
|
200
|
-
|
|
202
|
+
w = !0;
|
|
201
203
|
}
|
|
202
|
-
var
|
|
203
|
-
if (
|
|
204
|
-
|
|
204
|
+
var P = 0, k = y.length;
|
|
205
|
+
if (w)
|
|
206
|
+
P = k;
|
|
205
207
|
else
|
|
206
|
-
for (var O = 0; O <
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
return
|
|
211
|
-
}, H.prototype.bytepad = function(
|
|
212
|
-
for (var
|
|
213
|
-
|
|
214
|
-
var k =
|
|
208
|
+
for (var O = 0; O < y.length; ++O) {
|
|
209
|
+
var F = y.charCodeAt(O);
|
|
210
|
+
F < 128 ? P += 1 : F < 2048 ? P += 2 : F < 55296 || F >= 57344 ? P += 3 : (F = 65536 + ((F & 1023) << 10 | y.charCodeAt(++O) & 1023), P += 4);
|
|
211
|
+
}
|
|
212
|
+
return P += this.encode(P * 8), this.update(y), P;
|
|
213
|
+
}, H.prototype.bytepad = function(y, w) {
|
|
214
|
+
for (var S = this.encode(w), P = 0; P < y.length; ++P)
|
|
215
|
+
S += this.encodeString(y[P]);
|
|
216
|
+
var k = w - S % w, O = [];
|
|
215
217
|
return O.length = k, this.update(O), this;
|
|
216
218
|
}, H.prototype.finalize = function() {
|
|
217
219
|
if (!this.finalized) {
|
|
218
220
|
this.finalized = !0;
|
|
219
|
-
var
|
|
220
|
-
if (
|
|
221
|
-
for (
|
|
222
|
-
|
|
223
|
-
for (
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
var y = this.blocks, w = this.lastByteIndex, S = this.blockCount, P = this.s;
|
|
222
|
+
if (y[w >> 2] |= this.padding[w & 3], this.lastByteIndex === this.byteCount)
|
|
223
|
+
for (y[0] = y[S], w = 1; w < S + 1; ++w)
|
|
224
|
+
y[w] = 0;
|
|
225
|
+
for (y[S - 1] |= 2147483648, w = 0; w < S; ++w)
|
|
226
|
+
P[w] ^= y[w];
|
|
227
|
+
Z(P);
|
|
226
228
|
}
|
|
227
229
|
}, H.prototype.toString = H.prototype.hex = function() {
|
|
228
230
|
this.finalize();
|
|
229
|
-
for (var
|
|
230
|
-
for (k = 0; k <
|
|
231
|
-
|
|
232
|
-
O %
|
|
231
|
+
for (var y = this.blockCount, w = this.s, S = this.outputBlocks, P = this.extraBytes, k = 0, O = 0, F = "", B; O < S; ) {
|
|
232
|
+
for (k = 0; k < y && O < S; ++k, ++O)
|
|
233
|
+
B = w[k], F += c[B >> 4 & 15] + c[B & 15] + c[B >> 12 & 15] + c[B >> 8 & 15] + c[B >> 20 & 15] + c[B >> 16 & 15] + c[B >> 28 & 15] + c[B >> 24 & 15];
|
|
234
|
+
O % y === 0 && (Z(w), k = 0);
|
|
233
235
|
}
|
|
234
|
-
return
|
|
236
|
+
return P && (B = w[k], F += c[B >> 4 & 15] + c[B & 15], P > 1 && (F += c[B >> 12 & 15] + c[B >> 8 & 15]), P > 2 && (F += c[B >> 20 & 15] + c[B >> 16 & 15])), F;
|
|
235
237
|
}, H.prototype.arrayBuffer = function() {
|
|
236
238
|
this.finalize();
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
for (var L = new Uint32Array(
|
|
240
|
-
for (k = 0; k <
|
|
241
|
-
L[O] =
|
|
242
|
-
O %
|
|
239
|
+
var y = this.blockCount, w = this.s, S = this.outputBlocks, P = this.extraBytes, k = 0, O = 0, F = this.outputBits >> 3, B;
|
|
240
|
+
P ? B = new ArrayBuffer(S + 1 << 2) : B = new ArrayBuffer(F);
|
|
241
|
+
for (var L = new Uint32Array(B); O < S; ) {
|
|
242
|
+
for (k = 0; k < y && O < S; ++k, ++O)
|
|
243
|
+
L[O] = w[k];
|
|
244
|
+
O % y === 0 && Z(w);
|
|
243
245
|
}
|
|
244
|
-
return
|
|
246
|
+
return P && (L[k] = w[k], B = B.slice(0, F)), B;
|
|
245
247
|
}, H.prototype.buffer = H.prototype.arrayBuffer, H.prototype.digest = H.prototype.array = function() {
|
|
246
248
|
this.finalize();
|
|
247
|
-
for (var
|
|
248
|
-
for (k = 0; k <
|
|
249
|
-
|
|
250
|
-
O %
|
|
249
|
+
for (var y = this.blockCount, w = this.s, S = this.outputBlocks, P = this.extraBytes, k = 0, O = 0, F = [], B, L; O < S; ) {
|
|
250
|
+
for (k = 0; k < y && O < S; ++k, ++O)
|
|
251
|
+
B = O << 2, L = w[k], F[B] = L & 255, F[B + 1] = L >> 8 & 255, F[B + 2] = L >> 16 & 255, F[B + 3] = L >> 24 & 255;
|
|
252
|
+
O % y === 0 && Z(w);
|
|
251
253
|
}
|
|
252
|
-
return
|
|
254
|
+
return P && (B = O << 2, L = w[k], F[B] = L & 255, P > 1 && (F[B + 1] = L >> 8 & 255), P > 2 && (F[B + 2] = L >> 16 & 255)), F;
|
|
253
255
|
};
|
|
254
|
-
function q(
|
|
255
|
-
H.call(this,
|
|
256
|
+
function q(y, w, S) {
|
|
257
|
+
H.call(this, y, w, S);
|
|
256
258
|
}
|
|
257
259
|
q.prototype = new H(), q.prototype.finalize = function() {
|
|
258
260
|
return this.encode(this.outputBits, !0), H.prototype.finalize.call(this);
|
|
259
261
|
};
|
|
260
|
-
var
|
|
261
|
-
var
|
|
262
|
-
for (
|
|
263
|
-
k =
|
|
262
|
+
var Z = function(y) {
|
|
263
|
+
var w, S, P, k, O, F, B, L, x, G, te, ne, ae, re, ie, se, oe, ue, ce, le, de, pe, ye, me, fe, be, ge, Te, he, Ae, _e, Ie, we, Se, Ce, Me, Pe, Ee, ke, ve, Oe, Re, $e, Be, Fe, xe, De, Ne, Ue, We, Ke, je, He, Ge, Le, Ve, ze, Ye, Je, Ze, Xe, Qe, qe;
|
|
264
|
+
for (P = 0; P < 48; P += 2)
|
|
265
|
+
k = y[0] ^ y[10] ^ y[20] ^ y[30] ^ y[40], O = y[1] ^ y[11] ^ y[21] ^ y[31] ^ y[41], F = y[2] ^ y[12] ^ y[22] ^ y[32] ^ y[42], B = y[3] ^ y[13] ^ y[23] ^ y[33] ^ y[43], L = y[4] ^ y[14] ^ y[24] ^ y[34] ^ y[44], x = y[5] ^ y[15] ^ y[25] ^ y[35] ^ y[45], G = y[6] ^ y[16] ^ y[26] ^ y[36] ^ y[46], te = y[7] ^ y[17] ^ y[27] ^ y[37] ^ y[47], ne = y[8] ^ y[18] ^ y[28] ^ y[38] ^ y[48], ae = y[9] ^ y[19] ^ y[29] ^ y[39] ^ y[49], w = ne ^ (F << 1 | B >>> 31), S = ae ^ (B << 1 | F >>> 31), y[0] ^= w, y[1] ^= S, y[10] ^= w, y[11] ^= S, y[20] ^= w, y[21] ^= S, y[30] ^= w, y[31] ^= S, y[40] ^= w, y[41] ^= S, w = k ^ (L << 1 | x >>> 31), S = O ^ (x << 1 | L >>> 31), y[2] ^= w, y[3] ^= S, y[12] ^= w, y[13] ^= S, y[22] ^= w, y[23] ^= S, y[32] ^= w, y[33] ^= S, y[42] ^= w, y[43] ^= S, w = F ^ (G << 1 | te >>> 31), S = B ^ (te << 1 | G >>> 31), y[4] ^= w, y[5] ^= S, y[14] ^= w, y[15] ^= S, y[24] ^= w, y[25] ^= S, y[34] ^= w, y[35] ^= S, y[44] ^= w, y[45] ^= S, w = L ^ (ne << 1 | ae >>> 31), S = x ^ (ae << 1 | ne >>> 31), y[6] ^= w, y[7] ^= S, y[16] ^= w, y[17] ^= S, y[26] ^= w, y[27] ^= S, y[36] ^= w, y[37] ^= S, y[46] ^= w, y[47] ^= S, w = G ^ (k << 1 | O >>> 31), S = te ^ (O << 1 | k >>> 31), y[8] ^= w, y[9] ^= S, y[18] ^= w, y[19] ^= S, y[28] ^= w, y[29] ^= S, y[38] ^= w, y[39] ^= S, y[48] ^= w, y[49] ^= S, re = y[0], ie = y[1], xe = y[11] << 4 | y[10] >>> 28, De = y[10] << 4 | y[11] >>> 28, Te = y[20] << 3 | y[21] >>> 29, he = y[21] << 3 | y[20] >>> 29, Ze = y[31] << 9 | y[30] >>> 23, Xe = y[30] << 9 | y[31] >>> 23, Re = y[40] << 18 | y[41] >>> 14, $e = y[41] << 18 | y[40] >>> 14, Se = y[2] << 1 | y[3] >>> 31, Ce = y[3] << 1 | y[2] >>> 31, se = y[13] << 12 | y[12] >>> 20, oe = y[12] << 12 | y[13] >>> 20, Ne = y[22] << 10 | y[23] >>> 22, Ue = y[23] << 10 | y[22] >>> 22, Ae = y[33] << 13 | y[32] >>> 19, _e = y[32] << 13 | y[33] >>> 19, Qe = y[42] << 2 | y[43] >>> 30, qe = y[43] << 2 | y[42] >>> 30, Ge = y[5] << 30 | y[4] >>> 2, Le = y[4] << 30 | y[5] >>> 2, Me = y[14] << 6 | y[15] >>> 26, Pe = y[15] << 6 | y[14] >>> 26, ue = y[25] << 11 | y[24] >>> 21, ce = y[24] << 11 | y[25] >>> 21, We = y[34] << 15 | y[35] >>> 17, Ke = y[35] << 15 | y[34] >>> 17, Ie = y[45] << 29 | y[44] >>> 3, we = y[44] << 29 | y[45] >>> 3, me = y[6] << 28 | y[7] >>> 4, fe = y[7] << 28 | y[6] >>> 4, Ve = y[17] << 23 | y[16] >>> 9, ze = y[16] << 23 | y[17] >>> 9, Ee = y[26] << 25 | y[27] >>> 7, ke = y[27] << 25 | y[26] >>> 7, le = y[36] << 21 | y[37] >>> 11, de = y[37] << 21 | y[36] >>> 11, je = y[47] << 24 | y[46] >>> 8, He = y[46] << 24 | y[47] >>> 8, Be = y[8] << 27 | y[9] >>> 5, Fe = y[9] << 27 | y[8] >>> 5, be = y[18] << 20 | y[19] >>> 12, ge = y[19] << 20 | y[18] >>> 12, Ye = y[29] << 7 | y[28] >>> 25, Je = y[28] << 7 | y[29] >>> 25, ve = y[38] << 8 | y[39] >>> 24, Oe = y[39] << 8 | y[38] >>> 24, pe = y[48] << 14 | y[49] >>> 18, ye = y[49] << 14 | y[48] >>> 18, y[0] = re ^ ~se & ue, y[1] = ie ^ ~oe & ce, y[10] = me ^ ~be & Te, y[11] = fe ^ ~ge & he, y[20] = Se ^ ~Me & Ee, y[21] = Ce ^ ~Pe & ke, y[30] = Be ^ ~xe & Ne, y[31] = Fe ^ ~De & Ue, y[40] = Ge ^ ~Ve & Ye, y[41] = Le ^ ~ze & Je, y[2] = se ^ ~ue & le, y[3] = oe ^ ~ce & de, y[12] = be ^ ~Te & Ae, y[13] = ge ^ ~he & _e, y[22] = Me ^ ~Ee & ve, y[23] = Pe ^ ~ke & Oe, y[32] = xe ^ ~Ne & We, y[33] = De ^ ~Ue & Ke, y[42] = Ve ^ ~Ye & Ze, y[43] = ze ^ ~Je & Xe, y[4] = ue ^ ~le & pe, y[5] = ce ^ ~de & ye, y[14] = Te ^ ~Ae & Ie, y[15] = he ^ ~_e & we, y[24] = Ee ^ ~ve & Re, y[25] = ke ^ ~Oe & $e, y[34] = Ne ^ ~We & je, y[35] = Ue ^ ~Ke & He, y[44] = Ye ^ ~Ze & Qe, y[45] = Je ^ ~Xe & qe, y[6] = le ^ ~pe & re, y[7] = de ^ ~ye & ie, y[16] = Ae ^ ~Ie & me, y[17] = _e ^ ~we & fe, y[26] = ve ^ ~Re & Se, y[27] = Oe ^ ~$e & Ce, y[36] = We ^ ~je & Be, y[37] = Ke ^ ~He & Fe, y[46] = Ze ^ ~Qe & Ge, y[47] = Xe ^ ~qe & Le, y[8] = pe ^ ~re & se, y[9] = ye ^ ~ie & oe, y[18] = Ie ^ ~me & be, y[19] = we ^ ~fe & ge, y[28] = Re ^ ~Se & Me, y[29] = $e ^ ~Ce & Pe, y[38] = je ^ ~Be & xe, y[39] = He ^ ~Fe & De, y[48] = Qe ^ ~Ge & Ve, y[49] = qe ^ ~Le & ze, y[0] ^= g[P], y[1] ^= g[P + 1];
|
|
264
266
|
};
|
|
265
267
|
if (i)
|
|
266
268
|
e.exports = j;
|
|
@@ -425,11 +427,11 @@ var sha3Exports = sha3.exports, sha256 = { exports: {} };
|
|
|
425
427
|
e[16] = this.block, e[t >> 2] |= EXTRA[t & 3], this.block = e[16], t >= 56 && (this.hashed || this.hash(), e[0] = this.block, e[16] = e[1] = e[2] = e[3] = e[4] = e[5] = e[6] = e[7] = e[8] = e[9] = e[10] = e[11] = e[12] = e[13] = e[14] = e[15] = 0), e[14] = this.hBytes << 3 | this.bytes >>> 29, e[15] = this.bytes << 3, this.hash();
|
|
426
428
|
}
|
|
427
429
|
}, Sha256.prototype.hash = function() {
|
|
428
|
-
var e = this.h0, t = this.h1, n = this.h2, a = this.h3, r = this.h4, s = this.h5, u = this.h6, i = this.h7, l = this.blocks, c, d,
|
|
430
|
+
var e = this.h0, t = this.h1, n = this.h2, a = this.h3, r = this.h4, s = this.h5, u = this.h6, i = this.h7, l = this.blocks, c, d, p, b, m, f, g, T, A, h, _;
|
|
429
431
|
for (c = 16; c < 64; ++c)
|
|
430
|
-
m = l[c - 15], d = (m >>> 7 | m << 25) ^ (m >>> 18 | m << 14) ^ m >>> 3, m = l[c - 2],
|
|
432
|
+
m = l[c - 15], d = (m >>> 7 | m << 25) ^ (m >>> 18 | m << 14) ^ m >>> 3, m = l[c - 2], p = (m >>> 17 | m << 15) ^ (m >>> 19 | m << 13) ^ m >>> 10, l[c] = l[c - 16] + d + l[c - 7] + p << 0;
|
|
431
433
|
for (_ = t & n, c = 0; c < 64; c += 4)
|
|
432
|
-
this.first ? (this.is224 ? (T = 300032, m = l[0] - 1413257819, i = m - 150054599 << 0, a = m + 24177077 << 0) : (T = 704751109, m = l[0] - 210244248, i = m - 1521486534 << 0, a = m + 143694565 << 0), this.first = !1) : (d = (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10),
|
|
434
|
+
this.first ? (this.is224 ? (T = 300032, m = l[0] - 1413257819, i = m - 150054599 << 0, a = m + 24177077 << 0) : (T = 704751109, m = l[0] - 210244248, i = m - 1521486534 << 0, a = m + 143694565 << 0), this.first = !1) : (d = (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10), p = (r >>> 6 | r << 26) ^ (r >>> 11 | r << 21) ^ (r >>> 25 | r << 7), T = e & t, b = T ^ e & n ^ _, g = r & s ^ ~r & u, m = i + p + g + K[c] + l[c], f = d + b, i = a + m << 0, a = m + f << 0), d = (a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10), p = (i >>> 6 | i << 26) ^ (i >>> 11 | i << 21) ^ (i >>> 25 | i << 7), A = a & e, b = A ^ a & t ^ T, g = i & r ^ ~i & s, m = u + p + g + K[c + 1] + l[c + 1], f = d + b, u = n + m << 0, n = m + f << 0, d = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), p = (u >>> 6 | u << 26) ^ (u >>> 11 | u << 21) ^ (u >>> 25 | u << 7), h = n & a, b = h ^ n & e ^ A, g = u & i ^ ~u & r, m = s + p + g + K[c + 2] + l[c + 2], f = d + b, s = t + m << 0, t = m + f << 0, d = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), p = (s >>> 6 | s << 26) ^ (s >>> 11 | s << 21) ^ (s >>> 25 | s << 7), _ = t & n, b = _ ^ t & a ^ h, g = s & u ^ ~s & i, m = r + p + g + K[c + 3] + l[c + 3], f = d + b, r = e + m << 0, e = m + f << 0;
|
|
433
435
|
this.h0 = this.h0 + e << 0, this.h1 = this.h1 + t << 0, this.h2 = this.h2 + n << 0, this.h3 = this.h3 + a << 0, this.h4 = this.h4 + r << 0, this.h5 = this.h5 + s << 0, this.h6 = this.h6 + u << 0, this.h7 = this.h7 + i << 0;
|
|
434
436
|
}, Sha256.prototype.hex = function() {
|
|
435
437
|
this.finalize();
|
|
@@ -492,8 +494,8 @@ var sha3Exports = sha3.exports, sha256 = { exports: {} };
|
|
|
492
494
|
e.length > 64 && (e = new Sha256(t, !0).update(e).array());
|
|
493
495
|
var c = [], d = [];
|
|
494
496
|
for (a = 0; a < 64; ++a) {
|
|
495
|
-
var
|
|
496
|
-
c[a] = 92 ^
|
|
497
|
+
var p = e[a] || 0;
|
|
498
|
+
c[a] = 92 ^ p, d[a] = 54 ^ p;
|
|
497
499
|
}
|
|
498
500
|
Sha256.call(this, t, n), this.update(d), this.oKeyPad = c, this.inner = !0, this.sharedMemory = n;
|
|
499
501
|
}
|
|
@@ -516,10 +518,10 @@ function base$1(e) {
|
|
|
516
518
|
for (let c = 0; c < t.length; c++)
|
|
517
519
|
t[c] = 255;
|
|
518
520
|
for (let c = 0; c < e.length; c++) {
|
|
519
|
-
const d = e.charAt(c),
|
|
520
|
-
if (t[
|
|
521
|
+
const d = e.charAt(c), p = d.charCodeAt(0);
|
|
522
|
+
if (t[p] !== 255)
|
|
521
523
|
throw new TypeError(d + " is ambiguous");
|
|
522
|
-
t[
|
|
524
|
+
t[p] = c;
|
|
523
525
|
}
|
|
524
526
|
const n = e.length, a = e.charAt(0), r = Math.log(n) / Math.log(256), s = Math.log(256) / Math.log(n);
|
|
525
527
|
function u(c) {
|
|
@@ -527,20 +529,20 @@ function base$1(e) {
|
|
|
527
529
|
throw new TypeError("Expected Uint8Array");
|
|
528
530
|
if (c.length === 0)
|
|
529
531
|
return "";
|
|
530
|
-
let d = 0,
|
|
532
|
+
let d = 0, p = 0, b = 0;
|
|
531
533
|
const m = c.length;
|
|
532
534
|
for (; b !== m && c[b] === 0; )
|
|
533
535
|
b++, d++;
|
|
534
536
|
const f = (m - b) * s + 1 >>> 0, g = new Uint8Array(f);
|
|
535
537
|
for (; b !== m; ) {
|
|
536
538
|
let h = c[b], _ = 0;
|
|
537
|
-
for (let
|
|
538
|
-
h += 256 * g[
|
|
539
|
+
for (let I = f - 1; (h !== 0 || _ < p) && I !== -1; I--, _++)
|
|
540
|
+
h += 256 * g[I] >>> 0, g[I] = h % n >>> 0, h = h / n >>> 0;
|
|
539
541
|
if (h !== 0)
|
|
540
542
|
throw new Error("Non-zero carry");
|
|
541
|
-
|
|
543
|
+
p = _, b++;
|
|
542
544
|
}
|
|
543
|
-
let T = f -
|
|
545
|
+
let T = f - p;
|
|
544
546
|
for (; T !== f && g[T] === 0; )
|
|
545
547
|
T++;
|
|
546
548
|
let A = a.repeat(d);
|
|
@@ -553,9 +555,9 @@ function base$1(e) {
|
|
|
553
555
|
throw new TypeError("Expected String");
|
|
554
556
|
if (c.length === 0)
|
|
555
557
|
return new Uint8Array();
|
|
556
|
-
let d = 0,
|
|
558
|
+
let d = 0, p = 0, b = 0;
|
|
557
559
|
for (; c[d] === a; )
|
|
558
|
-
|
|
560
|
+
p++, d++;
|
|
559
561
|
const m = (c.length - d) * r + 1 >>> 0, f = new Uint8Array(m);
|
|
560
562
|
for (; d < c.length; ) {
|
|
561
563
|
const h = c.charCodeAt(d);
|
|
@@ -564,18 +566,18 @@ function base$1(e) {
|
|
|
564
566
|
let _ = t[h];
|
|
565
567
|
if (_ === 255)
|
|
566
568
|
return;
|
|
567
|
-
let
|
|
568
|
-
for (let
|
|
569
|
-
_ += n * f[
|
|
569
|
+
let I = 0;
|
|
570
|
+
for (let C = m - 1; (_ !== 0 || I < b) && C !== -1; C--, I++)
|
|
571
|
+
_ += n * f[C] >>> 0, f[C] = _ % 256 >>> 0, _ = _ / 256 >>> 0;
|
|
570
572
|
if (_ !== 0)
|
|
571
573
|
throw new Error("Non-zero carry");
|
|
572
|
-
b =
|
|
574
|
+
b = I, d++;
|
|
573
575
|
}
|
|
574
576
|
let g = m - b;
|
|
575
577
|
for (; g !== m && f[g] === 0; )
|
|
576
578
|
g++;
|
|
577
|
-
const T = new Uint8Array(
|
|
578
|
-
let A =
|
|
579
|
+
const T = new Uint8Array(p + (m - g));
|
|
580
|
+
let A = p;
|
|
579
581
|
for (; g !== m; )
|
|
580
582
|
T[A++] = f[g++];
|
|
581
583
|
return T;
|
|
@@ -1831,12 +1833,14 @@ const CompressedSignature = bcs.enum("CompressedSignature", {
|
|
|
1831
1833
|
ED25519: bcs.fixedArray(64, bcs.u8()),
|
|
1832
1834
|
Secp256k1: bcs.fixedArray(64, bcs.u8()),
|
|
1833
1835
|
Secp256r1: bcs.fixedArray(64, bcs.u8()),
|
|
1834
|
-
ZkLogin: bcs.vector(bcs.u8())
|
|
1836
|
+
ZkLogin: bcs.vector(bcs.u8()),
|
|
1837
|
+
Passkey: bcs.vector(bcs.u8())
|
|
1835
1838
|
}), PublicKey = bcs.enum("PublicKey", {
|
|
1836
1839
|
ED25519: bcs.fixedArray(32, bcs.u8()),
|
|
1837
1840
|
Secp256k1: bcs.fixedArray(33, bcs.u8()),
|
|
1838
1841
|
Secp256r1: bcs.fixedArray(33, bcs.u8()),
|
|
1839
|
-
ZkLogin: bcs.vector(bcs.u8())
|
|
1842
|
+
ZkLogin: bcs.vector(bcs.u8()),
|
|
1843
|
+
Passkey: bcs.fixedArray(33, bcs.u8())
|
|
1840
1844
|
}), MultiSigPkMap = bcs.struct("MultiSigPkMap", {
|
|
1841
1845
|
pubKey: PublicKey,
|
|
1842
1846
|
weight: bcs.u8()
|
|
@@ -3047,8 +3051,8 @@ async function setGasPayment(e, t) {
|
|
|
3047
3051
|
}
|
|
3048
3052
|
async function resolveObjectReferences(e, t) {
|
|
3049
3053
|
const n = e.inputs.filter((d) => {
|
|
3050
|
-
var
|
|
3051
|
-
return d.UnresolvedObject && !(d.UnresolvedObject.version || (
|
|
3054
|
+
var p;
|
|
3055
|
+
return d.UnresolvedObject && !(d.UnresolvedObject.version || (p = d.UnresolvedObject) != null && p.initialSharedVersion);
|
|
3052
3056
|
}), a = [
|
|
3053
3057
|
...new Set(
|
|
3054
3058
|
n.map((d) => normalizeSuiObjectId(d.UnresolvedObject.objectId))
|
|
@@ -3061,14 +3065,14 @@ async function resolveObjectReferences(e, t) {
|
|
|
3061
3065
|
})
|
|
3062
3066
|
)
|
|
3063
3067
|
)).flat(), u = new Map(
|
|
3064
|
-
a.map((d,
|
|
3065
|
-
), i = Array.from(u).filter(([d,
|
|
3068
|
+
a.map((d, p) => [d, s[p]])
|
|
3069
|
+
), i = Array.from(u).filter(([d, p]) => p.error).map(([d, p]) => JSON.stringify(p.error));
|
|
3066
3070
|
if (i.length)
|
|
3067
3071
|
throw new Error(`The following input objects are invalid: ${i.join(", ")}`);
|
|
3068
3072
|
const l = s.map((d) => {
|
|
3069
3073
|
if (d.error || !d.data)
|
|
3070
3074
|
throw new Error(`Failed to fetch object: ${d.error}`);
|
|
3071
|
-
const
|
|
3075
|
+
const p = d.data.owner, b = p && typeof p == "object" ? "Shared" in p ? p.Shared.initial_shared_version : "ConsensusAddressOwner" in p ? p.ConsensusAddressOwner.start_version : null : null;
|
|
3072
3076
|
return {
|
|
3073
3077
|
objectId: d.data.objectId,
|
|
3074
3078
|
digest: d.data.digest,
|
|
@@ -3076,27 +3080,27 @@ async function resolveObjectReferences(e, t) {
|
|
|
3076
3080
|
initialSharedVersion: b
|
|
3077
3081
|
};
|
|
3078
3082
|
}), c = new Map(
|
|
3079
|
-
a.map((d,
|
|
3083
|
+
a.map((d, p) => [d, l[p]])
|
|
3080
3084
|
);
|
|
3081
|
-
for (const [d,
|
|
3082
|
-
if (!
|
|
3085
|
+
for (const [d, p] of e.inputs.entries()) {
|
|
3086
|
+
if (!p.UnresolvedObject)
|
|
3083
3087
|
continue;
|
|
3084
3088
|
let b;
|
|
3085
|
-
const m = normalizeSuiAddress(
|
|
3086
|
-
|
|
3089
|
+
const m = normalizeSuiAddress(p.UnresolvedObject.objectId), f = c.get(m);
|
|
3090
|
+
p.UnresolvedObject.initialSharedVersion ?? (f == null ? void 0 : f.initialSharedVersion) ? b = Inputs.SharedObjectRef({
|
|
3087
3091
|
objectId: m,
|
|
3088
|
-
initialSharedVersion:
|
|
3092
|
+
initialSharedVersion: p.UnresolvedObject.initialSharedVersion || (f == null ? void 0 : f.initialSharedVersion),
|
|
3089
3093
|
mutable: isUsedAsMutable(e, d)
|
|
3090
3094
|
}) : isUsedAsReceiving(e, d) && (b = Inputs.ReceivingRef(
|
|
3091
3095
|
{
|
|
3092
3096
|
objectId: m,
|
|
3093
|
-
digest:
|
|
3094
|
-
version:
|
|
3097
|
+
digest: p.UnresolvedObject.digest ?? (f == null ? void 0 : f.digest),
|
|
3098
|
+
version: p.UnresolvedObject.version ?? (f == null ? void 0 : f.version)
|
|
3095
3099
|
}
|
|
3096
|
-
)), e.inputs[e.inputs.indexOf(
|
|
3100
|
+
)), e.inputs[e.inputs.indexOf(p)] = b ?? Inputs.ObjectRef({
|
|
3097
3101
|
objectId: m,
|
|
3098
|
-
digest:
|
|
3099
|
-
version:
|
|
3102
|
+
digest: p.UnresolvedObject.digest ?? (f == null ? void 0 : f.digest),
|
|
3103
|
+
version: p.UnresolvedObject.version ?? (f == null ? void 0 : f.version)
|
|
3100
3104
|
});
|
|
3101
3105
|
}
|
|
3102
3106
|
}
|
|
@@ -3117,14 +3121,14 @@ async function normalizeInputs(e, t) {
|
|
|
3117
3121
|
const u = /* @__PURE__ */ new Map();
|
|
3118
3122
|
s.size > 0 && await Promise.all(
|
|
3119
3123
|
[...s].map(async (i) => {
|
|
3120
|
-
const [l, c, d] = i.split("::"),
|
|
3124
|
+
const [l, c, d] = i.split("::"), p = await t.getNormalizedMoveFunction({
|
|
3121
3125
|
package: l,
|
|
3122
3126
|
module: c,
|
|
3123
3127
|
function: d
|
|
3124
3128
|
});
|
|
3125
3129
|
u.set(
|
|
3126
3130
|
i,
|
|
3127
|
-
|
|
3131
|
+
p.parameters.map((b) => normalizedTypeToMoveTypeSignature(b))
|
|
3128
3132
|
);
|
|
3129
3133
|
})
|
|
3130
3134
|
), r.length && await Promise.all(
|
|
@@ -3144,14 +3148,14 @@ async function normalizeInputs(e, t) {
|
|
|
3144
3148
|
if (d) {
|
|
3145
3149
|
if (d.length !== i.MoveCall.arguments.length)
|
|
3146
3150
|
throw new Error(`Incorrect number of arguments for ${c}`);
|
|
3147
|
-
d.forEach((
|
|
3151
|
+
d.forEach((p, b) => {
|
|
3148
3152
|
var h, _;
|
|
3149
3153
|
const m = l.arguments[b];
|
|
3150
3154
|
if (m.$kind !== "Input") return;
|
|
3151
3155
|
const f = n[m.Input];
|
|
3152
3156
|
if (!f.UnresolvedPure && !f.UnresolvedObject)
|
|
3153
3157
|
return;
|
|
3154
|
-
const g = ((h = f.UnresolvedPure) == null ? void 0 : h.value) ?? ((_ = f.UnresolvedObject) == null ? void 0 : _.objectId), T = getPureBcsSchema(
|
|
3158
|
+
const g = ((h = f.UnresolvedPure) == null ? void 0 : h.value) ?? ((_ = f.UnresolvedObject) == null ? void 0 : _.objectId), T = getPureBcsSchema(p.body);
|
|
3155
3159
|
if (T) {
|
|
3156
3160
|
m.type = "pure", n[n.indexOf(f)] = Inputs.Pure(T.serialize(g));
|
|
3157
3161
|
return;
|
|
@@ -4028,10 +4032,10 @@ sortCommandsAndInputs_fn = function() {
|
|
|
4028
4032
|
var d;
|
|
4029
4033
|
const l = e[i];
|
|
4030
4034
|
if (((d = l.$Intent) == null ? void 0 : d.name) === "AsyncTransactionThunk") {
|
|
4031
|
-
const
|
|
4032
|
-
if (
|
|
4035
|
+
const p = l.$Intent.data.result;
|
|
4036
|
+
if (p == null)
|
|
4033
4037
|
throw new Error("AsyncTransactionThunk has not been resolved");
|
|
4034
|
-
return s(
|
|
4038
|
+
return s(p.Result);
|
|
4035
4039
|
}
|
|
4036
4040
|
const c = r.indexOf(l);
|
|
4037
4041
|
if (c === -1)
|
|
@@ -4123,28 +4127,28 @@ function getCCTPDomain$1(e) {
|
|
|
4123
4127
|
}
|
|
4124
4128
|
function getCCTPBridgePDAs$1(e, t) {
|
|
4125
4129
|
const n = new PublicKey$1(addresses_default$1.CCTP_CORE_PROGRAM_ID), a = new PublicKey$1(addresses_default$1.CCTP_TOKEN_PROGRAM_ID), [r] = PublicKey$1.findProgramAddressSync(
|
|
4126
|
-
[
|
|
4130
|
+
[bufferPolyfill.Buffer.from("message_transmitter")],
|
|
4127
4131
|
n
|
|
4128
4132
|
), [s] = PublicKey$1.findProgramAddressSync(
|
|
4129
|
-
[
|
|
4133
|
+
[bufferPolyfill.Buffer.from("sender_authority")],
|
|
4130
4134
|
a
|
|
4131
4135
|
), [u] = PublicKey$1.findProgramAddressSync(
|
|
4132
|
-
[
|
|
4136
|
+
[bufferPolyfill.Buffer.from("local_token"), e.toBytes()],
|
|
4133
4137
|
a
|
|
4134
4138
|
), [i] = PublicKey$1.findProgramAddressSync(
|
|
4135
|
-
[
|
|
4139
|
+
[bufferPolyfill.Buffer.from("token_messenger")],
|
|
4136
4140
|
a
|
|
4137
4141
|
), [l] = PublicKey$1.findProgramAddressSync(
|
|
4138
|
-
[
|
|
4142
|
+
[bufferPolyfill.Buffer.from("token_minter")],
|
|
4139
4143
|
a
|
|
4140
4144
|
), c = getCCTPDomain$1(t), [d] = PublicKey$1.findProgramAddressSync(
|
|
4141
|
-
[
|
|
4145
|
+
[bufferPolyfill.Buffer.from("remote_token_messenger"), bufferPolyfill.Buffer.from(c.toString())],
|
|
4142
4146
|
a
|
|
4143
|
-
), [
|
|
4144
|
-
[
|
|
4147
|
+
), [p] = PublicKey$1.findProgramAddressSync(
|
|
4148
|
+
[bufferPolyfill.Buffer.from("__event_authority")],
|
|
4145
4149
|
n
|
|
4146
4150
|
), [b] = PublicKey$1.findProgramAddressSync(
|
|
4147
|
-
[
|
|
4151
|
+
[bufferPolyfill.Buffer.from("__event_authority")],
|
|
4148
4152
|
a
|
|
4149
4153
|
);
|
|
4150
4154
|
return {
|
|
@@ -4154,7 +4158,7 @@ function getCCTPBridgePDAs$1(e, t) {
|
|
|
4154
4158
|
tokenMessenger: i,
|
|
4155
4159
|
tokenMinter: l,
|
|
4156
4160
|
eventAuthToken: b,
|
|
4157
|
-
eventAuthCore:
|
|
4161
|
+
eventAuthCore: p,
|
|
4158
4162
|
localToken: u
|
|
4159
4163
|
};
|
|
4160
4164
|
}
|
|
@@ -4168,7 +4172,7 @@ function nativeAddressToHexString$1(e, t) {
|
|
|
4168
4172
|
return `0x${sha3_2562(e)}`;
|
|
4169
4173
|
if (t === chains$1.sui) {
|
|
4170
4174
|
let n = e.startsWith("0x") ? e.substring(2) : e;
|
|
4171
|
-
if (
|
|
4175
|
+
if (bufferPolyfill.Buffer.from(n, "hex").length !== 32)
|
|
4172
4176
|
throw new Error("Invalid sui address: " + e);
|
|
4173
4177
|
return zeroPadValue(e, 32);
|
|
4174
4178
|
} else
|
|
@@ -4176,7 +4180,7 @@ function nativeAddressToHexString$1(e, t) {
|
|
|
4176
4180
|
}
|
|
4177
4181
|
function hexToUint8Array$1(e) {
|
|
4178
4182
|
return new Uint8Array(
|
|
4179
|
-
|
|
4183
|
+
bufferPolyfill.Buffer.from(
|
|
4180
4184
|
e.startsWith("0x") ? e.substring(2) : e,
|
|
4181
4185
|
"hex"
|
|
4182
4186
|
)
|
|
@@ -4245,7 +4249,7 @@ var evmChainIdMap$1 = {
|
|
|
4245
4249
|
function getWormholeChainIdById$1(e) {
|
|
4246
4250
|
return evmChainIdMap$1[e];
|
|
4247
4251
|
}
|
|
4248
|
-
var sdkVersion$1 = [10, 9,
|
|
4252
|
+
var sdkVersion$1 = [10, 9, 2];
|
|
4249
4253
|
function getSdkVersion$1() {
|
|
4250
4254
|
return sdkVersion$1.join("_");
|
|
4251
4255
|
}
|
|
@@ -4259,7 +4263,7 @@ var MAX_U64$1 = BigInt(2) ** BigInt(64) - BigInt(1);
|
|
|
4259
4263
|
function getSafeU64Blob$1(e) {
|
|
4260
4264
|
if (e < BigInt(0) || e > MAX_U64$1)
|
|
4261
4265
|
throw new Error(`Invalid u64: ${e}`);
|
|
4262
|
-
const t =
|
|
4266
|
+
const t = bufferPolyfill.Buffer.alloc(8);
|
|
4263
4267
|
return t.writeBigUInt64LE(e), t;
|
|
4264
4268
|
}
|
|
4265
4269
|
var ZeroPermit$1 = {
|
|
@@ -4274,10 +4278,10 @@ function getQuoteSuitableReferrerAddress$1(e, t) {
|
|
|
4274
4278
|
}
|
|
4275
4279
|
var MCTP_PAYLOAD_TYPE_DEFAULT$1 = 1, MCTP_INIT_ORDER_PAYLOAD_ID$1 = 1, FAST_MCTP_PAYLOAD_TYPE_DEFAULT$1 = 1, FAST_MCTP_PAYLOAD_TYPE_ORDER$1 = 3;
|
|
4276
4280
|
function getHyperCoreUSDCDepositCustomPayload(e, t, n) {
|
|
4277
|
-
const a =
|
|
4281
|
+
const a = bufferPolyfill.Buffer.alloc(109), r = bufferPolyfill.Buffer.from(hexToUint8Array$1(t));
|
|
4278
4282
|
if (r.length !== 20)
|
|
4279
4283
|
throw new Error("Invalid destination address length, expected 20 bytes");
|
|
4280
|
-
const s =
|
|
4284
|
+
const s = bufferPolyfill.Buffer.from(
|
|
4281
4285
|
hexToUint8Array$1(n)
|
|
4282
4286
|
);
|
|
4283
4287
|
if (s.length !== 65)
|
|
@@ -6830,7 +6834,7 @@ function getEvmMctpBridgeParams$1(e, t, n, a) {
|
|
|
6830
6834
|
const r = getWormholeChainIdById$1(Number(n)), s = getWormholeChainIdByName$1(e.fromChain), u = getWormholeChainIdByName$1(e.toChain);
|
|
6831
6835
|
if (s !== r)
|
|
6832
6836
|
throw new Error(`Signer chain id(${Number(n)}) and quote from chain are not same! ${s} !== ${r}`);
|
|
6833
|
-
const i = e.cheaperChain === e.fromChain, l = nativeAddressToHexString$1(t, u), c = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1), d = getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8)),
|
|
6837
|
+
const i = e.cheaperChain === e.fromChain, l = nativeAddressToHexString$1(t, u), c = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1), d = getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8)), p = BigInt(e.effectiveAmountIn64), b = getCCTPDomain$1(e.toChain);
|
|
6834
6838
|
if (!e.mctpMayanContract)
|
|
6835
6839
|
throw new Error("MCTP contract address is missing");
|
|
6836
6840
|
const m = e.mctpMayanContract;
|
|
@@ -6843,7 +6847,7 @@ function getEvmMctpBridgeParams$1(e, t, n, a) {
|
|
|
6843
6847
|
return i && (f = BigInt(0)), {
|
|
6844
6848
|
lockFee: i,
|
|
6845
6849
|
tokenIn: e.mctpInputContract,
|
|
6846
|
-
amountIn:
|
|
6850
|
+
amountIn: p,
|
|
6847
6851
|
redeemFee: c,
|
|
6848
6852
|
gasDrop: d,
|
|
6849
6853
|
destAddr: l,
|
|
@@ -6866,7 +6870,7 @@ function getEvmMctpBridgeTxPayload$1(e, t, n, a) {
|
|
|
6866
6870
|
destAddr: l,
|
|
6867
6871
|
lockFee: c,
|
|
6868
6872
|
redeemFee: d,
|
|
6869
|
-
gasDrop:
|
|
6873
|
+
gasDrop: p,
|
|
6870
6874
|
destDomain: b,
|
|
6871
6875
|
customPayload: m,
|
|
6872
6876
|
payloadType: f,
|
|
@@ -6875,10 +6879,10 @@ function getEvmMctpBridgeTxPayload$1(e, t, n, a) {
|
|
|
6875
6879
|
let A, h;
|
|
6876
6880
|
return c ? A = T.interface.encodeFunctionData(
|
|
6877
6881
|
"bridgeWithLockedFee",
|
|
6878
|
-
[u, i,
|
|
6882
|
+
[u, i, p, d, b, l]
|
|
6879
6883
|
) : A = T.interface.encodeFunctionData(
|
|
6880
6884
|
"bridgeWithFee",
|
|
6881
|
-
[u, i, d,
|
|
6885
|
+
[u, i, d, p, l, b, f, m]
|
|
6882
6886
|
), h = toBeHex(g), {
|
|
6883
6887
|
to: s,
|
|
6884
6888
|
data: A,
|
|
@@ -6901,7 +6905,7 @@ function getEvmMctpCreateOrderParams$1(e, t, n, a) {
|
|
|
6901
6905
|
SystemProgram.programId.toString(),
|
|
6902
6906
|
getWormholeChainIdByName$1("solana")
|
|
6903
6907
|
);
|
|
6904
|
-
const d = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1),
|
|
6908
|
+
const d = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1), p = getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8));
|
|
6905
6909
|
let b = BigInt(e.effectiveAmountIn64);
|
|
6906
6910
|
const m = getAmountOfFractionalAmount$1(
|
|
6907
6911
|
e.minAmountOut,
|
|
@@ -6914,7 +6918,7 @@ function getEvmMctpCreateOrderParams$1(e, t, n, a) {
|
|
|
6914
6918
|
params: {
|
|
6915
6919
|
tokenIn: e.mctpInputContract,
|
|
6916
6920
|
amountIn: b,
|
|
6917
|
-
gasDrop:
|
|
6921
|
+
gasDrop: p,
|
|
6918
6922
|
destAddr: l,
|
|
6919
6923
|
destChain: u,
|
|
6920
6924
|
tokenOut: g,
|
|
@@ -6969,7 +6973,7 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
6969
6973
|
t,
|
|
6970
6974
|
n,
|
|
6971
6975
|
a
|
|
6972
|
-
),
|
|
6976
|
+
), p = "forwardERC20", b = [
|
|
6973
6977
|
e.fromToken.contract,
|
|
6974
6978
|
d._params.params.amountIn,
|
|
6975
6979
|
u,
|
|
@@ -6977,12 +6981,12 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
6977
6981
|
d.data
|
|
6978
6982
|
];
|
|
6979
6983
|
return {
|
|
6980
|
-
data: i.interface.encodeFunctionData(
|
|
6984
|
+
data: i.interface.encodeFunctionData(p, b),
|
|
6981
6985
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
6982
6986
|
value: toBeHex(c),
|
|
6983
6987
|
chainId: a,
|
|
6984
6988
|
_forwarder: {
|
|
6985
|
-
method:
|
|
6989
|
+
method: p,
|
|
6986
6990
|
params: b
|
|
6987
6991
|
}
|
|
6988
6992
|
};
|
|
@@ -6991,7 +6995,7 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
6991
6995
|
e,
|
|
6992
6996
|
t,
|
|
6993
6997
|
a
|
|
6994
|
-
),
|
|
6998
|
+
), p = "forwardERC20", b = [
|
|
6995
6999
|
e.fromToken.contract,
|
|
6996
7000
|
d._params.amountIn,
|
|
6997
7001
|
u,
|
|
@@ -6999,19 +7003,19 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
6999
7003
|
d.data
|
|
7000
7004
|
];
|
|
7001
7005
|
return {
|
|
7002
|
-
data: i.interface.encodeFunctionData(
|
|
7006
|
+
data: i.interface.encodeFunctionData(p, b),
|
|
7003
7007
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
7004
7008
|
value: toBeHex(c),
|
|
7005
7009
|
chainId: a,
|
|
7006
7010
|
_forwarder: {
|
|
7007
|
-
method:
|
|
7011
|
+
method: p,
|
|
7008
7012
|
params: b
|
|
7009
7013
|
}
|
|
7010
7014
|
};
|
|
7011
7015
|
}
|
|
7012
7016
|
else {
|
|
7013
|
-
const { minMiddleAmount: d, evmSwapRouterAddress:
|
|
7014
|
-
if (!d || !
|
|
7017
|
+
const { minMiddleAmount: d, evmSwapRouterAddress: p, evmSwapRouterCalldata: b } = e;
|
|
7018
|
+
if (!d || !p || !b)
|
|
7015
7019
|
throw new Error("MCTP swap requires middle amount, router address and calldata");
|
|
7016
7020
|
if (e.hasAuction) {
|
|
7017
7021
|
if (!Number(e.deadline64))
|
|
@@ -7029,7 +7033,7 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
7029
7033
|
l !== BigInt(0) && (g -= l), c = toBeHex(m._params.params.amountIn);
|
|
7030
7034
|
const T = "swapAndForwardEth", A = [
|
|
7031
7035
|
g,
|
|
7032
|
-
|
|
7036
|
+
p,
|
|
7033
7037
|
b,
|
|
7034
7038
|
e.mctpInputContract,
|
|
7035
7039
|
f,
|
|
@@ -7051,7 +7055,7 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
7051
7055
|
e.fromToken.contract,
|
|
7052
7056
|
m._params.params.amountIn,
|
|
7053
7057
|
u,
|
|
7054
|
-
|
|
7058
|
+
p,
|
|
7055
7059
|
b,
|
|
7056
7060
|
e.mctpInputContract,
|
|
7057
7061
|
f,
|
|
@@ -7082,7 +7086,7 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
7082
7086
|
l !== BigInt(0) && (g -= l), c = toBeHex(m._params.amountIn);
|
|
7083
7087
|
const T = "swapAndForwardEth", A = [
|
|
7084
7088
|
g,
|
|
7085
|
-
|
|
7089
|
+
p,
|
|
7086
7090
|
b,
|
|
7087
7091
|
e.mctpInputContract,
|
|
7088
7092
|
f,
|
|
@@ -7104,7 +7108,7 @@ function getMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
7104
7108
|
e.fromToken.contract,
|
|
7105
7109
|
m._params.amountIn,
|
|
7106
7110
|
u,
|
|
7107
|
-
|
|
7111
|
+
p,
|
|
7108
7112
|
b,
|
|
7109
7113
|
e.mctpInputContract,
|
|
7110
7114
|
f,
|
|
@@ -8424,10 +8428,10 @@ var MayanSwiftArtifact_default$1 = {
|
|
|
8424
8428
|
};
|
|
8425
8429
|
function decodeInstructionArgs(e, t) {
|
|
8426
8430
|
const n = t.subarray(0, 8), a = e.instructions.find(
|
|
8427
|
-
(i) =>
|
|
8431
|
+
(i) => bufferPolyfill.Buffer.from(i.discriminator).toString("hex").toLowerCase() === bufferPolyfill.Buffer.from(n).toString("hex").toLowerCase()
|
|
8428
8432
|
);
|
|
8429
8433
|
if (!a)
|
|
8430
|
-
throw new Error(`Instruction ${
|
|
8434
|
+
throw new Error(`Instruction ${bufferPolyfill.Buffer.from(n).toString("hex")} not in IDL`);
|
|
8431
8435
|
const r = a.args || [], s = {};
|
|
8432
8436
|
let u = 8;
|
|
8433
8437
|
for (const i of r) {
|
|
@@ -8461,8 +8465,8 @@ function decodeType(e, t, n, a) {
|
|
|
8461
8465
|
const [s, u] = e.array, i = [];
|
|
8462
8466
|
let l = n;
|
|
8463
8467
|
for (let c = 0; c < u; c++) {
|
|
8464
|
-
const [d,
|
|
8465
|
-
i.push(d), l =
|
|
8468
|
+
const [d, p] = decodeType(s, t, l, a);
|
|
8469
|
+
i.push(d), l = p;
|
|
8466
8470
|
}
|
|
8467
8471
|
return [i, l];
|
|
8468
8472
|
}
|
|
@@ -8486,8 +8490,8 @@ function decodeType(e, t, n, a) {
|
|
|
8486
8490
|
const c = { variant: i.name };
|
|
8487
8491
|
if (i.fields && i.fields.length) {
|
|
8488
8492
|
const d = [];
|
|
8489
|
-
for (const
|
|
8490
|
-
const [b, m] = decodeType(
|
|
8493
|
+
for (const p of i.fields) {
|
|
8494
|
+
const [b, m] = decodeType(p.type, t, l, a);
|
|
8491
8495
|
d.push(b), l = m;
|
|
8492
8496
|
}
|
|
8493
8497
|
c.fields = d;
|
|
@@ -8510,7 +8514,7 @@ function decodeType(e, t, n, a) {
|
|
|
8510
8514
|
throw new Error(`Unsupported type shape: ${JSON.stringify(e)}`);
|
|
8511
8515
|
}
|
|
8512
8516
|
function decodeJupiterV6InsArgs(e) {
|
|
8513
|
-
return decodeInstructionArgs(jupV6Idl,
|
|
8517
|
+
return decodeInstructionArgs(jupV6Idl, bufferPolyfill.Buffer.from(e));
|
|
8514
8518
|
}
|
|
8515
8519
|
var jupV6Idl = {
|
|
8516
8520
|
instructions: [
|
|
@@ -9442,7 +9446,7 @@ function createAssociatedTokenAccountInstruction$1(e, t, n, a, r = new PublicKey
|
|
|
9442
9446
|
return new TransactionInstruction({
|
|
9443
9447
|
keys: u,
|
|
9444
9448
|
programId: s,
|
|
9445
|
-
data:
|
|
9449
|
+
data: bufferPolyfill.Buffer.from([1])
|
|
9446
9450
|
});
|
|
9447
9451
|
}
|
|
9448
9452
|
var TOKEN_ACCOUNT_LEN$1 = 165;
|
|
@@ -9462,7 +9466,7 @@ async function createInitializeRandomTokenAccountInstructions$1(e, t, n, a, r, s
|
|
|
9462
9466
|
{ pubkey: SYSVAR_RENT_PUBKEY, isWritable: !1, isSigner: !1 }
|
|
9463
9467
|
],
|
|
9464
9468
|
programId: s,
|
|
9465
|
-
data:
|
|
9469
|
+
data: bufferPolyfill.Buffer.from([1])
|
|
9466
9470
|
})), u;
|
|
9467
9471
|
}
|
|
9468
9472
|
var ApproveInstructionData$1 = struct([
|
|
@@ -9474,7 +9478,7 @@ function createApproveInstruction$1(e, t, n, a, r = new PublicKey$1(addresses_de
|
|
|
9474
9478
|
{ pubkey: e, isSigner: !1, isWritable: !0 },
|
|
9475
9479
|
{ pubkey: t, isSigner: !1, isWritable: !1 },
|
|
9476
9480
|
{ pubkey: n, isSigner: !0, isWritable: !1 }
|
|
9477
|
-
], u =
|
|
9481
|
+
], u = bufferPolyfill.Buffer.alloc(ApproveInstructionData$1.span);
|
|
9478
9482
|
return ApproveInstructionData$1.encode(
|
|
9479
9483
|
{
|
|
9480
9484
|
instruction: 4,
|
|
@@ -9485,7 +9489,7 @@ function createApproveInstruction$1(e, t, n, a, r = new PublicKey$1(addresses_de
|
|
|
9485
9489
|
}
|
|
9486
9490
|
var SyncNativeInstructionData$1 = struct([u8("instruction")]);
|
|
9487
9491
|
function createSyncNativeInstruction$1(e) {
|
|
9488
|
-
const t = [{ pubkey: e, isSigner: !1, isWritable: !0 }], n =
|
|
9492
|
+
const t = [{ pubkey: e, isSigner: !1, isWritable: !0 }], n = bufferPolyfill.Buffer.alloc(SyncNativeInstructionData$1.span);
|
|
9489
9493
|
return SyncNativeInstructionData$1.encode({ instruction: 17 }, n), new TransactionInstruction({
|
|
9490
9494
|
keys: t,
|
|
9491
9495
|
programId: new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID),
|
|
@@ -9504,7 +9508,7 @@ function createSplTransferInstruction$1(e, t, n, a, r = new PublicKey$1(addresse
|
|
|
9504
9508
|
{ pubkey: e, isSigner: !1, isWritable: !0 },
|
|
9505
9509
|
{ pubkey: t, isSigner: !1, isWritable: !0 },
|
|
9506
9510
|
{ pubkey: n, isSigner: !0, isWritable: !1 }
|
|
9507
|
-
], u =
|
|
9511
|
+
], u = bufferPolyfill.Buffer.alloc(SplTransferInstructionData$1.span);
|
|
9508
9512
|
return SplTransferInstructionData$1.encode(
|
|
9509
9513
|
{
|
|
9510
9514
|
instruction: 3,
|
|
@@ -9522,7 +9526,7 @@ function deserializeInstructionInfo$1(e) {
|
|
|
9522
9526
|
isSigner: t.isSigner,
|
|
9523
9527
|
isWritable: t.isWritable
|
|
9524
9528
|
})),
|
|
9525
|
-
data:
|
|
9529
|
+
data: bufferPolyfill.Buffer.from(e.data, "base64")
|
|
9526
9530
|
});
|
|
9527
9531
|
}
|
|
9528
9532
|
async function getAddressLookupTableAccounts$1(e, t) {
|
|
@@ -9552,7 +9556,7 @@ function decentralizeClientSwapInstructions$1(e, t) {
|
|
|
9552
9556
|
}
|
|
9553
9557
|
function getAnchorInstructionData$1(e) {
|
|
9554
9558
|
let t = `global:${e}`;
|
|
9555
|
-
return
|
|
9559
|
+
return bufferPolyfill.Buffer.from(sha256Exports.sha256.digest(t)).subarray(0, 8);
|
|
9556
9560
|
}
|
|
9557
9561
|
async function decideRelayer$1() {
|
|
9558
9562
|
let e;
|
|
@@ -9659,7 +9663,7 @@ function createPayloadWriterCreateInstruction(e, t, n, a) {
|
|
|
9659
9663
|
{ pubkey: t, isSigner: !1, isWritable: !0 },
|
|
9660
9664
|
{ pubkey: SystemProgram.programId, isSigner: !1, isWritable: !1 }
|
|
9661
9665
|
], s = 14 + // payload vector length
|
|
9662
|
-
n.length, u =
|
|
9666
|
+
n.length, u = bufferPolyfill.Buffer.alloc(s);
|
|
9663
9667
|
return u.set(getAnchorInstructionData$1("create_simple"), 0), u.writeUint16LE(a, 8), u.writeUint32LE(n.length, 10), u.set(n, 14), new TransactionInstruction({
|
|
9664
9668
|
keys: r,
|
|
9665
9669
|
programId: new PublicKey$1(addresses_default$1.PAYLOAD_WRITER_PROGRAM_ID),
|
|
@@ -9670,7 +9674,7 @@ function createPayloadWriterCloseInstruction(e, t, n) {
|
|
|
9670
9674
|
const a = [
|
|
9671
9675
|
{ pubkey: e, isSigner: !0, isWritable: !0 },
|
|
9672
9676
|
{ pubkey: t, isSigner: !1, isWritable: !0 }
|
|
9673
|
-
], s =
|
|
9677
|
+
], s = bufferPolyfill.Buffer.alloc(10);
|
|
9674
9678
|
return s.set(getAnchorInstructionData$1("close"), 0), s.writeUint16LE(n, 8), new TransactionInstruction({
|
|
9675
9679
|
keys: a,
|
|
9676
9680
|
programId: new PublicKey$1(addresses_default$1.PAYLOAD_WRITER_PROGRAM_ID),
|
|
@@ -9679,16 +9683,16 @@ function createPayloadWriterCloseInstruction(e, t, n) {
|
|
|
9679
9683
|
}
|
|
9680
9684
|
function getWormholePDAs$1(e) {
|
|
9681
9685
|
const t = new PublicKey$1(addresses_default$1.WORMHOLE_PROGRAM_ID), n = new PublicKey$1(e), [a] = PublicKey$1.findProgramAddressSync(
|
|
9682
|
-
[
|
|
9686
|
+
[bufferPolyfill.Buffer.from("Bridge")],
|
|
9683
9687
|
t
|
|
9684
9688
|
), [r] = PublicKey$1.findProgramAddressSync(
|
|
9685
|
-
[
|
|
9689
|
+
[bufferPolyfill.Buffer.from("emitter")],
|
|
9686
9690
|
n
|
|
9687
9691
|
), [s] = PublicKey$1.findProgramAddressSync(
|
|
9688
|
-
[
|
|
9692
|
+
[bufferPolyfill.Buffer.from("Sequence"), r.toBuffer()],
|
|
9689
9693
|
t
|
|
9690
9694
|
), [u] = PublicKey$1.findProgramAddressSync(
|
|
9691
|
-
[
|
|
9695
|
+
[bufferPolyfill.Buffer.from("fee_collector")],
|
|
9692
9696
|
t
|
|
9693
9697
|
);
|
|
9694
9698
|
return {
|
|
@@ -9702,19 +9706,19 @@ var MCTPBridgeWithFeeLayout$1 = struct([
|
|
|
9702
9706
|
blob(8, "instruction")
|
|
9703
9707
|
]);
|
|
9704
9708
|
function createMctpBridgeWithFeeInstruction$1(e, t, n, a, r) {
|
|
9705
|
-
const s = new PublicKey$1(addresses_default$1.WORMHOLE_PROGRAM_ID), u = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default$1.CCTP_CORE_PROGRAM_ID), l = new PublicKey$1(addresses_default$1.CCTP_TOKEN_PROGRAM_ID), c = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), d = new PublicKey$1(a),
|
|
9706
|
-
|
|
9709
|
+
const s = new PublicKey$1(addresses_default$1.WORMHOLE_PROGRAM_ID), u = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default$1.CCTP_CORE_PROGRAM_ID), l = new PublicKey$1(addresses_default$1.CCTP_TOKEN_PROGRAM_ID), c = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), d = new PublicKey$1(a), p = new PublicKey$1(n), b = getAssociatedTokenAddress$1(
|
|
9710
|
+
p,
|
|
9707
9711
|
e,
|
|
9708
9712
|
!0
|
|
9709
9713
|
);
|
|
9710
9714
|
let m;
|
|
9711
|
-
r && r > BigInt(0) ? m = getAssociatedTokenAddress$1(
|
|
9712
|
-
const f = getCCTPBridgePDAs$1(
|
|
9715
|
+
r && r > BigInt(0) ? m = getAssociatedTokenAddress$1(p, d, !1) : m = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID);
|
|
9716
|
+
const f = getCCTPBridgePDAs$1(p, t), g = getWormholePDAs$1(addresses_default$1.MCTP_PROGRAM_ID), T = Keypair.generate(), A = Keypair.generate(), h = [
|
|
9713
9717
|
{ pubkey: e, isWritable: !0, isSigner: !1 },
|
|
9714
9718
|
{ pubkey: b, isWritable: !0, isSigner: !1 },
|
|
9715
9719
|
{ pubkey: d, isWritable: !0, isSigner: !0 },
|
|
9716
9720
|
{ pubkey: m, isWritable: !0, isSigner: !1 },
|
|
9717
|
-
{ pubkey:
|
|
9721
|
+
{ pubkey: p, isWritable: !0, isSigner: !1 },
|
|
9718
9722
|
{ pubkey: f.senderAuthority, isWritable: !1, isSigner: !1 },
|
|
9719
9723
|
{ pubkey: f.tokenMessenger, isWritable: !1, isSigner: !1 },
|
|
9720
9724
|
{ pubkey: f.remoteTokenMessengerKey, isWritable: !1, isSigner: !1 },
|
|
@@ -9735,7 +9739,7 @@ function createMctpBridgeWithFeeInstruction$1(e, t, n, a, r) {
|
|
|
9735
9739
|
{ pubkey: SYSVAR_RENT_PUBKEY, isWritable: !1, isSigner: !1 },
|
|
9736
9740
|
{ pubkey: u, isWritable: !1, isSigner: !1 },
|
|
9737
9741
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
9738
|
-
], _ =
|
|
9742
|
+
], _ = bufferPolyfill.Buffer.alloc(MCTPBridgeWithFeeLayout$1.span);
|
|
9739
9743
|
return MCTPBridgeWithFeeLayout$1.encode(
|
|
9740
9744
|
{
|
|
9741
9745
|
instruction: getAnchorInstructionData$1("bridge_with_fee")
|
|
@@ -9751,23 +9755,23 @@ var MctpBridgeLockFeeLayout$1 = struct([
|
|
|
9751
9755
|
blob(8, "instruction")
|
|
9752
9756
|
]);
|
|
9753
9757
|
function createMctpBridgeLockFeeInstruction$1(e, t, n, a, r) {
|
|
9754
|
-
const s = [], u = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default$1.ASSOCIATED_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default$1.CCTP_CORE_PROGRAM_ID), c = new PublicKey$1(addresses_default$1.CCTP_TOKEN_PROGRAM_ID), d = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID),
|
|
9758
|
+
const s = [], u = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default$1.ASSOCIATED_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default$1.CCTP_CORE_PROGRAM_ID), c = new PublicKey$1(addresses_default$1.CCTP_TOKEN_PROGRAM_ID), d = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), p = new PublicKey$1(a), b = new PublicKey$1(n), m = getAssociatedTokenAddress$1(
|
|
9755
9759
|
b,
|
|
9756
9760
|
e,
|
|
9757
9761
|
!0
|
|
9758
9762
|
), f = getCCTPBridgePDAs$1(b, t), g = Keypair.generate(), [T] = PublicKey$1.findProgramAddressSync(
|
|
9759
|
-
[
|
|
9763
|
+
[bufferPolyfill.Buffer.from("LOCKED_FEE"), b.toBuffer(), g.publicKey.toBytes()],
|
|
9760
9764
|
d
|
|
9761
9765
|
);
|
|
9762
9766
|
let A;
|
|
9763
|
-
r && r > BigInt(0) ? A = getAssociatedTokenAddress$1(b,
|
|
9767
|
+
r && r > BigInt(0) ? A = getAssociatedTokenAddress$1(b, p, !1) : A = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID);
|
|
9764
9768
|
const h = getAssociatedTokenAddress$1(
|
|
9765
9769
|
b,
|
|
9766
9770
|
T,
|
|
9767
9771
|
!0
|
|
9768
9772
|
);
|
|
9769
9773
|
s.push(createAssociatedTokenAccountInstruction$1(
|
|
9770
|
-
|
|
9774
|
+
p,
|
|
9771
9775
|
h,
|
|
9772
9776
|
T,
|
|
9773
9777
|
b
|
|
@@ -9775,7 +9779,7 @@ function createMctpBridgeLockFeeInstruction$1(e, t, n, a, r) {
|
|
|
9775
9779
|
const _ = [
|
|
9776
9780
|
{ pubkey: e, isWritable: !0, isSigner: !1 },
|
|
9777
9781
|
{ pubkey: m, isWritable: !0, isSigner: !1 },
|
|
9778
|
-
{ pubkey:
|
|
9782
|
+
{ pubkey: p, isWritable: !0, isSigner: !0 },
|
|
9779
9783
|
{ pubkey: A, isWritable: !0, isSigner: !1 },
|
|
9780
9784
|
{ pubkey: T, isWritable: !0, isSigner: !1 },
|
|
9781
9785
|
{ pubkey: h, isWritable: !0, isSigner: !1 },
|
|
@@ -9793,37 +9797,37 @@ function createMctpBridgeLockFeeInstruction$1(e, t, n, a, r) {
|
|
|
9793
9797
|
{ pubkey: u, isWritable: !1, isSigner: !1 },
|
|
9794
9798
|
{ pubkey: i, isWritable: !1, isSigner: !1 },
|
|
9795
9799
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
9796
|
-
],
|
|
9800
|
+
], I = bufferPolyfill.Buffer.alloc(MctpBridgeLockFeeLayout$1.span);
|
|
9797
9801
|
MctpBridgeLockFeeLayout$1.encode(
|
|
9798
9802
|
{
|
|
9799
9803
|
instruction: getAnchorInstructionData$1("bridge_locked_fee")
|
|
9800
9804
|
},
|
|
9801
|
-
|
|
9805
|
+
I
|
|
9802
9806
|
);
|
|
9803
|
-
const
|
|
9807
|
+
const C = new TransactionInstruction({
|
|
9804
9808
|
keys: _,
|
|
9805
|
-
data:
|
|
9809
|
+
data: I,
|
|
9806
9810
|
programId: d
|
|
9807
9811
|
});
|
|
9808
|
-
return s.push(
|
|
9812
|
+
return s.push(C), { instructions: s, signer: g };
|
|
9809
9813
|
}
|
|
9810
9814
|
var MctpInitSwapLayout$1 = struct([
|
|
9811
9815
|
blob(8, "instruction")
|
|
9812
9816
|
]);
|
|
9813
9817
|
function createMctpInitSwapInstruction$1(e, t, n, a, r) {
|
|
9814
|
-
const s = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), u = new PublicKey$1(addresses_default$1.CCTP_CORE_PROGRAM_ID), i = new PublicKey$1(addresses_default$1.CCTP_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), c = new PublicKey$1(a), d = new PublicKey$1(n),
|
|
9818
|
+
const s = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), u = new PublicKey$1(addresses_default$1.CCTP_CORE_PROGRAM_ID), i = new PublicKey$1(addresses_default$1.CCTP_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), c = new PublicKey$1(a), d = new PublicKey$1(n), p = getAssociatedTokenAddress$1(
|
|
9815
9819
|
d,
|
|
9816
9820
|
e,
|
|
9817
9821
|
!0
|
|
9818
9822
|
), b = getCCTPBridgePDAs$1(d, t), m = Keypair.generate(), [f] = PublicKey$1.findProgramAddressSync(
|
|
9819
|
-
[
|
|
9823
|
+
[bufferPolyfill.Buffer.from("ORDER_SOLANA_SOURCE"), e.toBuffer()],
|
|
9820
9824
|
l
|
|
9821
9825
|
);
|
|
9822
9826
|
let g;
|
|
9823
9827
|
r && r > BigInt(0) ? g = getAssociatedTokenAddress$1(d, c, !1) : g = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID);
|
|
9824
9828
|
const T = [
|
|
9825
9829
|
{ pubkey: e, isWritable: !1, isSigner: !1 },
|
|
9826
|
-
{ pubkey:
|
|
9830
|
+
{ pubkey: p, isWritable: !0, isSigner: !1 },
|
|
9827
9831
|
{ pubkey: c, isWritable: !0, isSigner: !0 },
|
|
9828
9832
|
{ pubkey: g, isWritable: !0, isSigner: !1 },
|
|
9829
9833
|
{ pubkey: d, isWritable: !0, isSigner: !1 },
|
|
@@ -9841,7 +9845,7 @@ function createMctpInitSwapInstruction$1(e, t, n, a, r) {
|
|
|
9841
9845
|
{ pubkey: new PublicKey$1(addresses_default$1.FEE_MANAGER_PROGRAM_ID), isWritable: !1, isSigner: !1 },
|
|
9842
9846
|
{ pubkey: s, isWritable: !1, isSigner: !1 },
|
|
9843
9847
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
9844
|
-
], A =
|
|
9848
|
+
], A = bufferPolyfill.Buffer.alloc(MctpInitSwapLayout$1.span);
|
|
9845
9849
|
return MctpInitSwapLayout$1.encode(
|
|
9846
9850
|
{
|
|
9847
9851
|
instruction: getAnchorInstructionData$1("create_order")
|
|
@@ -9867,7 +9871,7 @@ var MctpBridgeLedgerLayout$1 = struct([
|
|
|
9867
9871
|
function createMctpBridgeLedgerInstruction$1(e) {
|
|
9868
9872
|
if (e.mode !== "WITH_FEE" && e.mode !== "LOCK_FEE")
|
|
9869
9873
|
throw new Error("Invalid mode: " + e.mode);
|
|
9870
|
-
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress$1(n, e.ledger, !0), r = getWormholeChainIdByName$1(e.toChain), s =
|
|
9874
|
+
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress$1(n, e.ledger, !0), r = getWormholeChainIdByName$1(e.toChain), s = bufferPolyfill.Buffer.from(
|
|
9871
9875
|
hexToUint8Array$1(
|
|
9872
9876
|
nativeAddressToHexString$1(e.destinationAddress, r)
|
|
9873
9877
|
)
|
|
@@ -9875,9 +9879,9 @@ function createMctpBridgeLedgerInstruction$1(e) {
|
|
|
9875
9879
|
getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8))
|
|
9876
9880
|
), l = getSafeU64Blob$1(
|
|
9877
9881
|
getAmountOfFractionalAmount$1(e.feeRedeem, CCTP_TOKEN_DECIMALS$1)
|
|
9878
|
-
), c = getSafeU64Blob$1(e.feeSolana), d = e.referrerAddress ?
|
|
9882
|
+
), c = getSafeU64Blob$1(e.feeSolana), d = e.referrerAddress ? bufferPolyfill.Buffer.from(hexToUint8Array$1(
|
|
9879
9883
|
nativeAddressToHexString$1(e.referrerAddress, r)
|
|
9880
|
-
)) : SystemProgram.programId.toBuffer(),
|
|
9884
|
+
)) : SystemProgram.programId.toBuffer(), p = [
|
|
9881
9885
|
{ pubkey: t, isWritable: !0, isSigner: !0 },
|
|
9882
9886
|
{ pubkey: e.ledger, isWritable: !0, isSigner: !1 },
|
|
9883
9887
|
{ pubkey: a, isWritable: !1, isSigner: !1 },
|
|
@@ -9885,7 +9889,7 @@ function createMctpBridgeLedgerInstruction$1(e) {
|
|
|
9885
9889
|
{ pubkey: n, isWritable: !1, isSigner: !1 },
|
|
9886
9890
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 },
|
|
9887
9891
|
{ pubkey: new PublicKey$1(d), isWritable: !1, isSigner: !1 }
|
|
9888
|
-
], b =
|
|
9892
|
+
], b = bufferPolyfill.Buffer.alloc(MctpBridgeLedgerLayout$1.span);
|
|
9889
9893
|
return MctpBridgeLedgerLayout$1.encode(
|
|
9890
9894
|
{
|
|
9891
9895
|
instruction: getAnchorInstructionData$1("init_bridge_ledger"),
|
|
@@ -9900,7 +9904,7 @@ function createMctpBridgeLedgerInstruction$1(e) {
|
|
|
9900
9904
|
},
|
|
9901
9905
|
b
|
|
9902
9906
|
), new TransactionInstruction({
|
|
9903
|
-
keys:
|
|
9907
|
+
keys: p,
|
|
9904
9908
|
data: b,
|
|
9905
9909
|
programId: new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID)
|
|
9906
9910
|
});
|
|
@@ -9922,7 +9926,7 @@ var MctpSwapLedgerLayout$1 = struct([
|
|
|
9922
9926
|
u8("feeRateRef")
|
|
9923
9927
|
]);
|
|
9924
9928
|
function createMctpSwapLedgerInstruction$1(e) {
|
|
9925
|
-
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress$1(n, e.ledger, !0), r = getWormholeChainIdByName$1(e.toChain), s =
|
|
9929
|
+
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress$1(n, e.ledger, !0), r = getWormholeChainIdByName$1(e.toChain), s = bufferPolyfill.Buffer.from(
|
|
9926
9930
|
hexToUint8Array$1(
|
|
9927
9931
|
nativeAddressToHexString$1(e.destinationAddress, r)
|
|
9928
9932
|
)
|
|
@@ -9930,9 +9934,9 @@ function createMctpSwapLedgerInstruction$1(e) {
|
|
|
9930
9934
|
getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8))
|
|
9931
9935
|
), l = getSafeU64Blob$1(
|
|
9932
9936
|
getAmountOfFractionalAmount$1(e.feeRedeem, CCTP_TOKEN_DECIMALS$1)
|
|
9933
|
-
), c = getSafeU64Blob$1(e.feeSolana), d =
|
|
9937
|
+
), c = getSafeU64Blob$1(e.feeSolana), d = bufferPolyfill.Buffer.from(hexToUint8Array$1(
|
|
9934
9938
|
nativeAddressToHexString$1(e.tokenOut, r)
|
|
9935
|
-
)),
|
|
9939
|
+
)), p = e.referrerAddress ? bufferPolyfill.Buffer.from(hexToUint8Array$1(
|
|
9936
9940
|
nativeAddressToHexString$1(e.referrerAddress, r)
|
|
9937
9941
|
)) : SystemProgram.programId.toBuffer(), b = getSafeU64Blob$1(
|
|
9938
9942
|
getAmountOfFractionalAmount$1(e.amountOutMin, Math.min(8, e.tokenOutDecimals))
|
|
@@ -9942,7 +9946,7 @@ function createMctpSwapLedgerInstruction$1(e) {
|
|
|
9942
9946
|
{ pubkey: a, isWritable: !1, isSigner: !1 },
|
|
9943
9947
|
{ pubkey: n, isWritable: !1, isSigner: !1 },
|
|
9944
9948
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
9945
|
-
], g =
|
|
9949
|
+
], g = bufferPolyfill.Buffer.alloc(MctpSwapLedgerLayout$1.span);
|
|
9946
9950
|
return MctpSwapLedgerLayout$1.encode(
|
|
9947
9951
|
{
|
|
9948
9952
|
instruction: getAnchorInstructionData$1("init_order_ledger"),
|
|
@@ -9955,7 +9959,7 @@ function createMctpSwapLedgerInstruction$1(e) {
|
|
|
9955
9959
|
keyRnd: e.randomKey.toBuffer(),
|
|
9956
9960
|
mode: 3,
|
|
9957
9961
|
tokenOut: d,
|
|
9958
|
-
refAddress:
|
|
9962
|
+
refAddress: p,
|
|
9959
9963
|
amountOutMin: b,
|
|
9960
9964
|
deadline: m,
|
|
9961
9965
|
feeRateRef: e.feeRateRef
|
|
@@ -9971,19 +9975,19 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
9971
9975
|
const u = (s == null ? void 0 : s.forceSkipCctpInstructions) || !1, i = (s == null ? void 0 : s.allowSwapperOffCurve) || !1;
|
|
9972
9976
|
if (e.toChain === "solana")
|
|
9973
9977
|
throw new Error("Unsupported destination chain: " + e.toChain);
|
|
9974
|
-
let l = [], c = [], d = [],
|
|
9978
|
+
let l = [], c = [], d = [], p = [], b = [], m = [], f = [];
|
|
9975
9979
|
const g = Keypair.generate();
|
|
9976
9980
|
let T = null;
|
|
9977
9981
|
l.push(addresses_default$1.LOOKUP_TABLE);
|
|
9978
|
-
const A = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), h = new PublicKey$1(t), _ = Keypair.generate(),
|
|
9982
|
+
const A = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), h = new PublicKey$1(t), _ = Keypair.generate(), I = e.deadline64 ? BigInt(e.deadline64) : BigInt(0);
|
|
9979
9983
|
if (e.hasAuction && !Number(e.deadline64))
|
|
9980
9984
|
throw new Error("Swap mode requires a timeout");
|
|
9981
|
-
const
|
|
9982
|
-
[
|
|
9985
|
+
const C = e.hasAuction ? "LEDGER_ORDER" : "LEDGER_BRIDGE", [E] = PublicKey$1.findProgramAddressSync(
|
|
9986
|
+
[bufferPolyfill.Buffer.from(C), h.toBytes(), _.publicKey.toBytes()],
|
|
9983
9987
|
A
|
|
9984
9988
|
), R = getAssociatedTokenAddress$1(
|
|
9985
9989
|
new PublicKey$1(e.mctpInputContract),
|
|
9986
|
-
|
|
9990
|
+
E,
|
|
9987
9991
|
!0
|
|
9988
9992
|
), $ = e.cheaperChain === "solana" ? "LOCK_FEE" : "WITH_FEE", N = e.toChain === "sui" ? e.toToken.verifiedAddress : e.toToken.contract;
|
|
9989
9993
|
if (e.fromToken.contract === e.mctpInputContract) {
|
|
@@ -9991,7 +9995,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
9991
9995
|
if (e.suggestedPriorityFee > 0 && c.push(ComputeBudgetProgram.setComputeUnitPrice({
|
|
9992
9996
|
microLamports: e.suggestedPriorityFee
|
|
9993
9997
|
})), c.push(
|
|
9994
|
-
createAssociatedTokenAccountInstruction$1(h, R,
|
|
9998
|
+
createAssociatedTokenAccountInstruction$1(h, R, E, new PublicKey$1(e.mctpInputContract))
|
|
9995
9999
|
), c.push(
|
|
9996
10000
|
createSplTransferInstruction$1(
|
|
9997
10001
|
getAssociatedTokenAddress$1(
|
|
@@ -10005,7 +10009,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10005
10009
|
)
|
|
10006
10010
|
), e.hasAuction) {
|
|
10007
10011
|
if (c.push(createMctpSwapLedgerInstruction$1({
|
|
10008
|
-
ledger:
|
|
10012
|
+
ledger: E,
|
|
10009
10013
|
swapperAddress: t,
|
|
10010
10014
|
mintAddress: e.mctpInputContract,
|
|
10011
10015
|
randomKey: _.publicKey,
|
|
@@ -10019,14 +10023,14 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10019
10023
|
tokenOutDecimals: e.toToken.decimals,
|
|
10020
10024
|
referrerAddress: a,
|
|
10021
10025
|
amountOutMin: e.minAmountOut,
|
|
10022
|
-
deadline:
|
|
10026
|
+
deadline: I,
|
|
10023
10027
|
feeRateRef: e.referrerBps
|
|
10024
10028
|
})), !u) {
|
|
10025
10029
|
const {
|
|
10026
10030
|
instruction: v,
|
|
10027
10031
|
signer: U
|
|
10028
10032
|
} = createMctpInitSwapInstruction$1(
|
|
10029
|
-
|
|
10033
|
+
E,
|
|
10030
10034
|
e.toChain,
|
|
10031
10035
|
e.mctpInputContract,
|
|
10032
10036
|
t,
|
|
@@ -10035,7 +10039,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10035
10039
|
c.push(v), d.push(U);
|
|
10036
10040
|
}
|
|
10037
10041
|
} else if (c.push(createMctpBridgeLedgerInstruction$1({
|
|
10038
|
-
ledger:
|
|
10042
|
+
ledger: E,
|
|
10039
10043
|
swapperAddress: t,
|
|
10040
10044
|
mintAddress: e.mctpInputContract,
|
|
10041
10045
|
randomKey: _.publicKey,
|
|
@@ -10053,7 +10057,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10053
10057
|
instruction: v,
|
|
10054
10058
|
signers: U
|
|
10055
10059
|
} = createMctpBridgeWithFeeInstruction$1(
|
|
10056
|
-
|
|
10060
|
+
E,
|
|
10057
10061
|
e.toChain,
|
|
10058
10062
|
e.mctpInputContract,
|
|
10059
10063
|
t,
|
|
@@ -10065,7 +10069,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10065
10069
|
instructions: v,
|
|
10066
10070
|
signer: U
|
|
10067
10071
|
} = createMctpBridgeLockFeeInstruction$1(
|
|
10068
|
-
|
|
10072
|
+
E,
|
|
10069
10073
|
e.toChain,
|
|
10070
10074
|
e.mctpInputContract,
|
|
10071
10075
|
t,
|
|
@@ -10078,7 +10082,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10078
10082
|
minMiddleAmount: e.minMiddleAmount,
|
|
10079
10083
|
middleToken: e.mctpInputContract,
|
|
10080
10084
|
userWallet: t,
|
|
10081
|
-
userLedger:
|
|
10085
|
+
userLedger: E.toString(),
|
|
10082
10086
|
slippageBps: e.slippageBps,
|
|
10083
10087
|
fromToken: e.fromToken.contract,
|
|
10084
10088
|
amountIn64: e.effectiveAmountIn64,
|
|
@@ -10095,7 +10099,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10095
10099
|
), m.push(...v.computeBudgetInstructions), v.setupInstructions && m.push(...v.setupInstructions), m.push(v.swapInstruction), v.cleanupInstruction && m.push(v.cleanupInstruction), b.push(...v.addressLookupTableAddresses), c.push(createAssociatedTokenAccountInstruction$1(
|
|
10096
10100
|
h,
|
|
10097
10101
|
R,
|
|
10098
|
-
|
|
10102
|
+
E,
|
|
10099
10103
|
new PublicKey$1(e.mctpInputContract)
|
|
10100
10104
|
)), c.push(createTransferAllAndCloseInstruction$1(
|
|
10101
10105
|
h,
|
|
@@ -10107,7 +10111,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10107
10111
|
const U = m.length > 0 ? BigInt(0) : BigInt(e.solanaRelayerFee64);
|
|
10108
10112
|
if (e.hasAuction) {
|
|
10109
10113
|
if (c.push(createMctpSwapLedgerInstruction$1({
|
|
10110
|
-
ledger:
|
|
10114
|
+
ledger: E,
|
|
10111
10115
|
swapperAddress: t,
|
|
10112
10116
|
mintAddress: e.mctpInputContract,
|
|
10113
10117
|
randomKey: _.publicKey,
|
|
@@ -10121,14 +10125,14 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10121
10125
|
tokenOutDecimals: e.toToken.decimals,
|
|
10122
10126
|
referrerAddress: a,
|
|
10123
10127
|
amountOutMin: e.minAmountOut,
|
|
10124
|
-
deadline:
|
|
10128
|
+
deadline: I,
|
|
10125
10129
|
feeRateRef: e.referrerBps
|
|
10126
10130
|
})), m.length > 0) {
|
|
10127
10131
|
const {
|
|
10128
10132
|
instruction: j,
|
|
10129
10133
|
signer: W
|
|
10130
10134
|
} = createMctpInitSwapInstruction$1(
|
|
10131
|
-
|
|
10135
|
+
E,
|
|
10132
10136
|
e.toChain,
|
|
10133
10137
|
e.mctpInputContract,
|
|
10134
10138
|
t,
|
|
@@ -10137,7 +10141,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10137
10141
|
c.push(j), d.push(W);
|
|
10138
10142
|
}
|
|
10139
10143
|
} else if (c.push(createMctpBridgeLedgerInstruction$1({
|
|
10140
|
-
ledger:
|
|
10144
|
+
ledger: E,
|
|
10141
10145
|
swapperAddress: t,
|
|
10142
10146
|
mintAddress: e.mctpInputContract,
|
|
10143
10147
|
randomKey: _.publicKey,
|
|
@@ -10155,7 +10159,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10155
10159
|
instruction: j,
|
|
10156
10160
|
signers: W
|
|
10157
10161
|
} = createMctpBridgeWithFeeInstruction$1(
|
|
10158
|
-
|
|
10162
|
+
E,
|
|
10159
10163
|
e.toChain,
|
|
10160
10164
|
e.mctpInputContract,
|
|
10161
10165
|
t,
|
|
@@ -10167,7 +10171,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10167
10171
|
instructions: j,
|
|
10168
10172
|
signer: W
|
|
10169
10173
|
} = createMctpBridgeLockFeeInstruction$1(
|
|
10170
|
-
|
|
10174
|
+
E,
|
|
10171
10175
|
e.toChain,
|
|
10172
10176
|
e.mctpInputContract,
|
|
10173
10177
|
t,
|
|
@@ -10177,7 +10181,7 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10177
10181
|
}
|
|
10178
10182
|
}
|
|
10179
10183
|
const D = await getAddressLookupTableAccounts$1(l.concat(b), r);
|
|
10180
|
-
if (
|
|
10184
|
+
if (p = D.slice(0, l.length), m.length > 0) {
|
|
10181
10185
|
const M = D.slice(l.length);
|
|
10182
10186
|
T = {
|
|
10183
10187
|
messageV0: {
|
|
@@ -10189,28 +10193,28 @@ async function createMctpFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10189
10193
|
tmpTokenAccount: g
|
|
10190
10194
|
};
|
|
10191
10195
|
}
|
|
10192
|
-
return { instructions: c, signers: d, lookupTables:
|
|
10196
|
+
return { instructions: c, signers: d, lookupTables: p, swapMessageV0Params: T };
|
|
10193
10197
|
}
|
|
10194
10198
|
function createSwiftOrderHash$1(e, t, n, a, r) {
|
|
10195
|
-
const u =
|
|
10199
|
+
const u = bufferPolyfill.Buffer.alloc(239);
|
|
10196
10200
|
let i = 0;
|
|
10197
|
-
const l = getWormholeChainIdByName$1(e.fromChain), c =
|
|
10201
|
+
const l = getWormholeChainIdByName$1(e.fromChain), c = bufferPolyfill.Buffer.from(hexToUint8Array$1(nativeAddressToHexString$1(t, l)));
|
|
10198
10202
|
u.set(c, 0), i += 32, u.writeUInt16BE(l, i), i += 2;
|
|
10199
|
-
const d = e.swiftInputContract === ZeroAddress ? nativeAddressToHexString$1(SystemProgram.programId.toString(), getWormholeChainIdByName$1("solana")) : nativeAddressToHexString$1(e.swiftInputContract, l),
|
|
10200
|
-
u.set(
|
|
10201
|
-
const b = getWormholeChainIdByName$1(e.toChain), m =
|
|
10203
|
+
const d = e.swiftInputContract === ZeroAddress ? nativeAddressToHexString$1(SystemProgram.programId.toString(), getWormholeChainIdByName$1("solana")) : nativeAddressToHexString$1(e.swiftInputContract, l), p = bufferPolyfill.Buffer.from(hexToUint8Array$1(d));
|
|
10204
|
+
u.set(p, i), i += 32;
|
|
10205
|
+
const b = getWormholeChainIdByName$1(e.toChain), m = bufferPolyfill.Buffer.from(hexToUint8Array$1(nativeAddressToHexString$1(n, b)));
|
|
10202
10206
|
u.set(m, i), i += 32, u.writeUInt16BE(b, i), i += 2;
|
|
10203
|
-
const f = e.toToken.contract === ZeroAddress ? nativeAddressToHexString$1(SystemProgram.programId.toString(), getWormholeChainIdByName$1("solana")) : nativeAddressToHexString$1(e.toToken.contract, b), g =
|
|
10207
|
+
const f = e.toToken.contract === ZeroAddress ? nativeAddressToHexString$1(SystemProgram.programId.toString(), getWormholeChainIdByName$1("solana")) : nativeAddressToHexString$1(e.toToken.contract, b), g = bufferPolyfill.Buffer.from(hexToUint8Array$1(f));
|
|
10204
10208
|
u.set(g, i), i += 32, u.writeBigUInt64BE(getAmountOfFractionalAmount$1(e.minAmountOut, Math.min(e.toToken.decimals, 8)), i), i += 8, u.writeBigUInt64BE(getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8)), i), i += 8, u.writeBigUInt64BE(BigInt(e.cancelRelayerFee64), i), i += 8, u.writeBigUInt64BE(BigInt(e.refundRelayerFee64), i), i += 8, u.writeBigUInt64BE(BigInt(e.deadline64), i), i += 8;
|
|
10205
|
-
const T = a ?
|
|
10209
|
+
const T = a ? bufferPolyfill.Buffer.from(hexToUint8Array$1(nativeAddressToHexString$1(a, b))) : SystemProgram.programId.toBuffer();
|
|
10206
10210
|
u.set(T, i), i += 32, u.writeUInt8(e.referrerBps, i), i += 1;
|
|
10207
10211
|
const A = e.protocolBps;
|
|
10208
10212
|
u.writeUInt8(A, i), i += 1, u.writeUInt8(e.swiftAuctionMode, i), i += 1;
|
|
10209
|
-
const h =
|
|
10213
|
+
const h = bufferPolyfill.Buffer.from(hexToUint8Array$1(r));
|
|
10210
10214
|
if (u.set(h, i), i += 32, i !== 239)
|
|
10211
10215
|
throw new Error(`Invalid order data size: ${i}`);
|
|
10212
10216
|
const _ = keccak256(u);
|
|
10213
|
-
return
|
|
10217
|
+
return bufferPolyfill.Buffer.from(hexToUint8Array$1(_));
|
|
10214
10218
|
}
|
|
10215
10219
|
var InitSwiftLayout$1 = struct([
|
|
10216
10220
|
blob(8, "instruction"),
|
|
@@ -10245,15 +10249,15 @@ function createSwiftInitInstruction$1(e) {
|
|
|
10245
10249
|
{ pubkey: new PublicKey$1(addresses_default$1.FEE_MANAGER_PROGRAM_ID), isWritable: !1, isSigner: !1 },
|
|
10246
10250
|
{ pubkey: new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), isWritable: !1, isSigner: !1 },
|
|
10247
10251
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
10248
|
-
], s =
|
|
10252
|
+
], s = bufferPolyfill.Buffer.alloc(InitSwiftLayout$1.span), u = e.referrerAddress ? bufferPolyfill.Buffer.from(hexToUint8Array$1(nativeAddressToHexString$1(e.referrerAddress, a))) : SystemProgram.programId.toBuffer(), i = t.fromToken.contract === t.swiftInputContract ? BigInt(t.effectiveAmountIn64) : getAmountOfFractionalAmount$1(t.minMiddleAmount, t.swiftInputDecimals);
|
|
10249
10253
|
return InitSwiftLayout$1.encode({
|
|
10250
10254
|
instruction: getAnchorInstructionData$1("init_order"),
|
|
10251
10255
|
amountInMin: getSafeU64Blob$1(i),
|
|
10252
10256
|
nativeInput: t.swiftInputContract === ZeroAddress ? 1 : 0,
|
|
10253
10257
|
feeSubmit: getSafeU64Blob$1(BigInt(t.submitRelayerFee64)),
|
|
10254
|
-
destAddress:
|
|
10258
|
+
destAddress: bufferPolyfill.Buffer.from(hexToUint8Array$1(nativeAddressToHexString$1(e.destinationAddress, a))),
|
|
10255
10259
|
destinationChain: a,
|
|
10256
|
-
tokenOut:
|
|
10260
|
+
tokenOut: bufferPolyfill.Buffer.from(hexToUint8Array$1(nativeAddressToHexString$1(t.toToken.contract, a))),
|
|
10257
10261
|
amountOutMin: getSafeU64Blob$1(getAmountOfFractionalAmount$1(t.minAmountOut, Math.min(t.toToken.decimals, 8))),
|
|
10258
10262
|
gasDrop: getSafeU64Blob$1(getAmountOfFractionalAmount$1(t.gasDrop, Math.min(getGasDecimal$1(t.toChain), 8))),
|
|
10259
10263
|
feeCancel: getSafeU64Blob$1(BigInt(t.cancelRelayerFee64)),
|
|
@@ -10278,7 +10282,7 @@ async function createSwiftFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10278
10282
|
const u = s.allowSwapperOffCurve || !1;
|
|
10279
10283
|
let i = [], l = [], c = [];
|
|
10280
10284
|
c.push(addresses_default$1.LOOKUP_TABLE);
|
|
10281
|
-
let d = [],
|
|
10285
|
+
let d = [], p = [], b = [];
|
|
10282
10286
|
const m = Keypair.generate();
|
|
10283
10287
|
let f = null;
|
|
10284
10288
|
const g = new PublicKey$1(addresses_default$1.SWIFT_PROGRAM_ID), T = new PublicKey$1(t), A = Keypair.generate();
|
|
@@ -10290,34 +10294,34 @@ async function createSwiftFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10290
10294
|
n,
|
|
10291
10295
|
a,
|
|
10292
10296
|
A.publicKey.toBuffer().toString("hex")
|
|
10293
|
-
), [
|
|
10294
|
-
[
|
|
10297
|
+
), [I] = PublicKey$1.findProgramAddressSync(
|
|
10298
|
+
[bufferPolyfill.Buffer.from("STATE_SOURCE"), _],
|
|
10295
10299
|
g
|
|
10296
|
-
),
|
|
10297
|
-
S,
|
|
10300
|
+
), C = e.swiftInputContract === ZeroAddress ? solMint$1 : new PublicKey$1(e.swiftInputContract), E = getAssociatedTokenAddress$1(
|
|
10298
10301
|
C,
|
|
10302
|
+
I,
|
|
10299
10303
|
!0
|
|
10300
|
-
), R = e.gasless ? new PublicKey$1(e.relayer) : T, $ = getAssociatedTokenAddress$1(
|
|
10304
|
+
), R = e.gasless ? new PublicKey$1(e.relayer) : T, $ = getAssociatedTokenAddress$1(C, R, !1);
|
|
10301
10305
|
if (e.fromToken.contract === e.swiftInputContract)
|
|
10302
10306
|
e.suggestedPriorityFee > 0 && i.push(ComputeBudgetProgram.setComputeUnitPrice({
|
|
10303
10307
|
microLamports: e.suggestedPriorityFee
|
|
10304
10308
|
})), i.push(
|
|
10305
|
-
createAssociatedTokenAccountInstruction$1(R,
|
|
10309
|
+
createAssociatedTokenAccountInstruction$1(R, E, I, C)
|
|
10306
10310
|
), e.swiftInputContract === ZeroAddress ? i.push(
|
|
10307
10311
|
SystemProgram.transfer({
|
|
10308
10312
|
fromPubkey: T,
|
|
10309
|
-
toPubkey:
|
|
10313
|
+
toPubkey: E,
|
|
10310
10314
|
lamports: BigInt(e.effectiveAmountIn64)
|
|
10311
10315
|
}),
|
|
10312
|
-
createSyncNativeInstruction$1(
|
|
10316
|
+
createSyncNativeInstruction$1(E)
|
|
10313
10317
|
) : i.push(
|
|
10314
10318
|
createSplTransferInstruction$1(
|
|
10315
10319
|
getAssociatedTokenAddress$1(
|
|
10316
|
-
|
|
10320
|
+
C,
|
|
10317
10321
|
T,
|
|
10318
10322
|
u
|
|
10319
10323
|
),
|
|
10320
|
-
|
|
10324
|
+
E,
|
|
10321
10325
|
T,
|
|
10322
10326
|
BigInt(e.effectiveAmountIn64)
|
|
10323
10327
|
)
|
|
@@ -10338,22 +10342,22 @@ async function createSwiftFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10338
10342
|
s != null && s.separateSwapTx && D.maxAccountsFilled ? (validateJupSwap$1(M, m.publicKey, T), b = await createInitializeRandomTokenAccountInstructions$1(
|
|
10339
10343
|
r,
|
|
10340
10344
|
R,
|
|
10341
|
-
|
|
10345
|
+
C,
|
|
10342
10346
|
T,
|
|
10343
10347
|
m
|
|
10344
|
-
),
|
|
10348
|
+
), p.push(...M.computeBudgetInstructions), M.setupInstructions && p.push(...M.setupInstructions), p.push(M.swapInstruction), M.cleanupInstruction && p.push(M.cleanupInstruction), d.push(...M.addressLookupTableAddresses), i.push(createAssociatedTokenAccountInstruction$1(R, E, I, C)), i.push(createTransferAllAndCloseInstruction$1(
|
|
10345
10349
|
T,
|
|
10346
|
-
|
|
10350
|
+
C,
|
|
10347
10351
|
m.publicKey,
|
|
10348
|
-
|
|
10352
|
+
E,
|
|
10349
10353
|
R
|
|
10350
10354
|
))) : (i.push(...M.computeBudgetInstructions), M.setupInstructions && i.push(...M.setupInstructions), i.push(M.swapInstruction), M.cleanupInstruction && i.push(M.cleanupInstruction), c.push(...M.addressLookupTableAddresses));
|
|
10351
10355
|
}
|
|
10352
10356
|
i.push(createSwiftInitInstruction$1({
|
|
10353
10357
|
quote: e,
|
|
10354
|
-
state:
|
|
10358
|
+
state: I,
|
|
10355
10359
|
trader: T,
|
|
10356
|
-
stateAccount:
|
|
10360
|
+
stateAccount: E,
|
|
10357
10361
|
randomKey: A.publicKey,
|
|
10358
10362
|
relayerAccount: $,
|
|
10359
10363
|
relayer: R,
|
|
@@ -10362,12 +10366,12 @@ async function createSwiftFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10362
10366
|
referrerAddress: a
|
|
10363
10367
|
}));
|
|
10364
10368
|
const N = await getAddressLookupTableAccounts$1(c.concat(d), r);
|
|
10365
|
-
if (l = N.slice(0, c.length),
|
|
10369
|
+
if (l = N.slice(0, c.length), p.length > 0) {
|
|
10366
10370
|
const D = N.slice(c.length);
|
|
10367
10371
|
f = {
|
|
10368
10372
|
messageV0: {
|
|
10369
10373
|
payerKey: R,
|
|
10370
|
-
instructions:
|
|
10374
|
+
instructions: p,
|
|
10371
10375
|
addressLookupTableAccounts: D
|
|
10372
10376
|
},
|
|
10373
10377
|
createTmpTokenAccountIxs: b,
|
|
@@ -10388,26 +10392,26 @@ async function createHyperCoreDepositFromSolanaInstructions(e, t, n, a, r, s = {
|
|
|
10388
10392
|
const u = s.allowSwapperOffCurve || !1;
|
|
10389
10393
|
let i = [], l = [], c = [], d = [];
|
|
10390
10394
|
d.push(addresses_default$1.LOOKUP_TABLE);
|
|
10391
|
-
let
|
|
10395
|
+
let p = [], b = [], m = [];
|
|
10392
10396
|
const f = Keypair.generate();
|
|
10393
10397
|
let g = null;
|
|
10394
10398
|
const T = new PublicKey$1(t), A = new PublicKey$1(e.hyperCoreParams.initiateTokenContract), h = Math.floor(Math.random() * 65e3), [_] = PublicKey$1.findProgramAddressSync(
|
|
10395
10399
|
[
|
|
10396
|
-
|
|
10400
|
+
bufferPolyfill.Buffer.from("PAYLOAD"),
|
|
10397
10401
|
T.toBuffer(),
|
|
10398
10402
|
(() => {
|
|
10399
|
-
const D =
|
|
10403
|
+
const D = bufferPolyfill.Buffer.alloc(2);
|
|
10400
10404
|
return D.writeUInt16LE(h, 0), D;
|
|
10401
10405
|
})()
|
|
10402
10406
|
],
|
|
10403
10407
|
new PublicKey$1(addresses_default$1.PAYLOAD_WRITER_PROGRAM_ID)
|
|
10404
|
-
),
|
|
10408
|
+
), I = getHyperCoreUSDCDepositCustomPayload(e, n, s.usdcPermitSignature), C = Keypair.generate(), E = new PublicKey$1(addresses_default$1.MCTP_PROGRAM_ID), [R] = PublicKey$1.findProgramAddressSync(
|
|
10405
10409
|
[
|
|
10406
|
-
|
|
10410
|
+
bufferPolyfill.Buffer.from("LEDGER_BRIDGE"),
|
|
10407
10411
|
T.toBytes(),
|
|
10408
|
-
|
|
10412
|
+
C.publicKey.toBytes()
|
|
10409
10413
|
],
|
|
10410
|
-
|
|
10414
|
+
E
|
|
10411
10415
|
), $ = getAssociatedTokenAddress$1(
|
|
10412
10416
|
A,
|
|
10413
10417
|
R,
|
|
@@ -10435,13 +10439,13 @@ async function createHyperCoreDepositFromSolanaInstructions(e, t, n, a, r, s = {
|
|
|
10435
10439
|
createPayloadWriterCreateInstruction(
|
|
10436
10440
|
T,
|
|
10437
10441
|
_,
|
|
10438
|
-
|
|
10442
|
+
I,
|
|
10439
10443
|
h
|
|
10440
10444
|
)
|
|
10441
10445
|
), i.push(
|
|
10442
10446
|
createMctpBridgeLedgerInstruction$1({
|
|
10443
10447
|
ledger: R,
|
|
10444
|
-
randomKey:
|
|
10448
|
+
randomKey: C.publicKey,
|
|
10445
10449
|
swapperAddress: T.toString(),
|
|
10446
10450
|
mintAddress: A.toString(),
|
|
10447
10451
|
mode: "WITH_FEE",
|
|
@@ -10489,7 +10493,7 @@ async function createHyperCoreDepositFromSolanaInstructions(e, t, n, a, r, s = {
|
|
|
10489
10493
|
A,
|
|
10490
10494
|
T,
|
|
10491
10495
|
f
|
|
10492
|
-
), b.push(...M.computeBudgetInstructions), M.setupInstructions && b.push(...M.setupInstructions), b.push(M.swapInstruction), M.cleanupInstruction && b.push(M.cleanupInstruction),
|
|
10496
|
+
), b.push(...M.computeBudgetInstructions), M.setupInstructions && b.push(...M.setupInstructions), b.push(M.swapInstruction), M.cleanupInstruction && b.push(M.cleanupInstruction), p.push(...M.addressLookupTableAddresses);
|
|
10493
10497
|
else {
|
|
10494
10498
|
validateJupSwap$1(M, f.publicKey, T), i.push(...M.computeBudgetInstructions);
|
|
10495
10499
|
const V = await createInitializeRandomTokenAccountInstructions$1(
|
|
@@ -10536,14 +10540,14 @@ async function createHyperCoreDepositFromSolanaInstructions(e, t, n, a, r, s = {
|
|
|
10536
10540
|
createPayloadWriterCreateInstruction(
|
|
10537
10541
|
T,
|
|
10538
10542
|
_,
|
|
10539
|
-
|
|
10543
|
+
I,
|
|
10540
10544
|
h
|
|
10541
10545
|
)
|
|
10542
10546
|
), i.push(createMctpBridgeLedgerInstruction$1({
|
|
10543
10547
|
ledger: R,
|
|
10544
10548
|
swapperAddress: T.toString(),
|
|
10545
10549
|
mintAddress: A.toString(),
|
|
10546
|
-
randomKey:
|
|
10550
|
+
randomKey: C.publicKey,
|
|
10547
10551
|
mode: "WITH_FEE",
|
|
10548
10552
|
feeSolana: v,
|
|
10549
10553
|
amountInMin64: U,
|
|
@@ -10572,7 +10576,7 @@ async function createHyperCoreDepositFromSolanaInstructions(e, t, n, a, r, s = {
|
|
|
10572
10576
|
}
|
|
10573
10577
|
}
|
|
10574
10578
|
const N = await getAddressLookupTableAccounts$1(
|
|
10575
|
-
d.concat(
|
|
10579
|
+
d.concat(p),
|
|
10576
10580
|
r
|
|
10577
10581
|
);
|
|
10578
10582
|
if (c = N.slice(0, d.length), b.length > 0) {
|
|
@@ -10612,8 +10616,8 @@ async function createMonoChainFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
10612
10616
|
throw new Error("Invalid destination address: " + n);
|
|
10613
10617
|
}
|
|
10614
10618
|
let u = [], i = [], l = [];
|
|
10615
|
-
const c = new PublicKey$1(t), d = new PublicKey$1(n),
|
|
10616
|
-
|
|
10619
|
+
const c = new PublicKey$1(t), d = new PublicKey$1(n), p = e.toToken.contract === ZeroAddress ? solMint$1 : new PublicKey$1(e.toToken.contract), b = getAssociatedTokenAddress$1(
|
|
10620
|
+
p,
|
|
10617
10621
|
d,
|
|
10618
10622
|
!0,
|
|
10619
10623
|
e.toToken.standard === "spl2022" ? new PublicKey$1(addresses_default$1.TOKEN_2022_PROGRAM_ID) : new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID)
|
|
@@ -10629,7 +10633,8 @@ async function createMonoChainFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
10629
10633
|
amountIn64: e.effectiveAmountIn64,
|
|
10630
10634
|
expectedAmountOut64: String(m),
|
|
10631
10635
|
depositMode: "MONO_CHAIN",
|
|
10632
|
-
referrerAddress: a
|
|
10636
|
+
referrerAddress: a,
|
|
10637
|
+
referrerBps: e.referrerBps
|
|
10633
10638
|
}), g = decentralizeClientSwapInstructions$1(
|
|
10634
10639
|
f
|
|
10635
10640
|
);
|
|
@@ -10665,29 +10670,29 @@ async function createSwapFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10665
10670
|
if (e.type === "MONO_CHAIN")
|
|
10666
10671
|
return createMonoChainFromSolanaInstructions(e, t, n, u, r, s);
|
|
10667
10672
|
let i = [];
|
|
10668
|
-
const l = r ?? new Connection("https://rpc.ankr.com/solana"), c = new PublicKey$1(addresses_default$1.MAYAN_PROGRAM_ID), d = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID),
|
|
10673
|
+
const l = r ?? new Connection("https://rpc.ankr.com/solana"), c = new PublicKey$1(addresses_default$1.MAYAN_PROGRAM_ID), d = new PublicKey$1(addresses_default$1.TOKEN_PROGRAM_ID), p = new PublicKey$1(t), b = new PublicKey$1(addresses_default$1.AUCTION_PROGRAM_ID);
|
|
10669
10674
|
e.suggestedPriorityFee > 0 && i.push(ComputeBudgetProgram.setComputeUnitPrice({
|
|
10670
10675
|
microLamports: e.suggestedPriorityFee
|
|
10671
10676
|
}));
|
|
10672
10677
|
let m;
|
|
10673
10678
|
u ? m = new PublicKey$1(u) : m = SystemProgram.programId;
|
|
10674
10679
|
const [f, g] = PublicKey$1.findProgramAddressSync(
|
|
10675
|
-
[
|
|
10680
|
+
[bufferPolyfill.Buffer.from("MAYANFEE")],
|
|
10676
10681
|
c
|
|
10677
10682
|
), [T, A] = PublicKey$1.findProgramAddressSync(
|
|
10678
10683
|
[
|
|
10679
|
-
|
|
10684
|
+
bufferPolyfill.Buffer.from("REFERRERFEE"),
|
|
10680
10685
|
m.toBuffer()
|
|
10681
10686
|
],
|
|
10682
10687
|
c
|
|
10683
|
-
), h = Keypair.generate(), _ = Keypair.generate(), [
|
|
10688
|
+
), h = Keypair.generate(), _ = Keypair.generate(), [I, C] = PublicKey$1.findProgramAddressSync(
|
|
10684
10689
|
[
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10690
|
+
bufferPolyfill.Buffer.from("V2STATE"),
|
|
10691
|
+
bufferPolyfill.Buffer.from(h.publicKey.toBytes()),
|
|
10692
|
+
bufferPolyfill.Buffer.from(_.publicKey.toBytes())
|
|
10688
10693
|
],
|
|
10689
10694
|
c
|
|
10690
|
-
),
|
|
10695
|
+
), E = new PublicKey$1(e.fromToken.mint), R = new PublicKey$1(e.toToken.mint), $ = getAssociatedTokenAddress$1(E, p), N = getAssociatedTokenAddress$1(E, I, !0), [
|
|
10691
10696
|
[D, M],
|
|
10692
10697
|
v,
|
|
10693
10698
|
U
|
|
@@ -10697,17 +10702,17 @@ async function createSwapFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10697
10702
|
decideRelayer$1()
|
|
10698
10703
|
]);
|
|
10699
10704
|
(!D || D.data.length === 0) && i.push(createAssociatedTokenAccountInstruction$1(
|
|
10700
|
-
|
|
10705
|
+
p,
|
|
10701
10706
|
$,
|
|
10702
|
-
|
|
10703
|
-
|
|
10707
|
+
p,
|
|
10708
|
+
E
|
|
10704
10709
|
)), (!M || M.data.length === 0) && i.push(createAssociatedTokenAccountInstruction$1(
|
|
10705
|
-
|
|
10710
|
+
p,
|
|
10706
10711
|
N,
|
|
10707
|
-
|
|
10708
|
-
|
|
10712
|
+
I,
|
|
10713
|
+
E
|
|
10709
10714
|
)), e.fromToken.contract === ZeroAddress && (i.push(SystemProgram.transfer({
|
|
10710
|
-
fromPubkey:
|
|
10715
|
+
fromPubkey: p,
|
|
10711
10716
|
toPubkey: $,
|
|
10712
10717
|
lamports: BigInt(e.effectiveAmountIn64)
|
|
10713
10718
|
})), i.push(createSyncNativeInstruction$1($)));
|
|
@@ -10715,10 +10720,10 @@ async function createSwapFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10715
10720
|
i.push(createApproveInstruction$1(
|
|
10716
10721
|
$,
|
|
10717
10722
|
W.publicKey,
|
|
10718
|
-
|
|
10723
|
+
p,
|
|
10719
10724
|
j
|
|
10720
10725
|
)), i.push(SystemProgram.transfer({
|
|
10721
|
-
fromPubkey:
|
|
10726
|
+
fromPubkey: p,
|
|
10722
10727
|
toPubkey: W.publicKey,
|
|
10723
10728
|
lamports: v
|
|
10724
10729
|
}));
|
|
@@ -10726,11 +10731,11 @@ async function createSwapFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10726
10731
|
{ pubkey: W.publicKey, isWritable: !1, isSigner: !0 },
|
|
10727
10732
|
{ pubkey: h.publicKey, isWritable: !1, isSigner: !0 },
|
|
10728
10733
|
{ pubkey: _.publicKey, isWritable: !1, isSigner: !0 },
|
|
10729
|
-
{ pubkey:
|
|
10734
|
+
{ pubkey: I, isWritable: !0, isSigner: !1 },
|
|
10730
10735
|
{ pubkey: $, isWritable: !0, isSigner: !1 },
|
|
10731
|
-
{ pubkey:
|
|
10736
|
+
{ pubkey: p, isWritable: !1, isSigner: !1 },
|
|
10732
10737
|
{ pubkey: N, isWritable: !0, isSigner: !1 },
|
|
10733
|
-
{ pubkey:
|
|
10738
|
+
{ pubkey: E, isWritable: !1, isSigner: !1 },
|
|
10734
10739
|
{ pubkey: R, isWritable: !1, isSigner: !1 },
|
|
10735
10740
|
{ pubkey: b, isWritable: !1, isSigner: !1 },
|
|
10736
10741
|
{ pubkey: m, isWritable: !1, isSigner: !1 },
|
|
@@ -10750,7 +10755,7 @@ async function createSwapFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10750
10755
|
"Destination address is not about token account. It should be a owner address"
|
|
10751
10756
|
);
|
|
10752
10757
|
}
|
|
10753
|
-
const
|
|
10758
|
+
const X = bufferPolyfill.Buffer.from(
|
|
10754
10759
|
hexToUint8Array$1(
|
|
10755
10760
|
nativeAddressToHexString$1(n, z)
|
|
10756
10761
|
)
|
|
@@ -10769,30 +10774,30 @@ async function createSwapFromSolanaInstructions$1(e, t, n, a, r, s = {}) {
|
|
|
10769
10774
|
), q = getAmountOfFractionalAmount$1(
|
|
10770
10775
|
e.gasDrop,
|
|
10771
10776
|
getGasDecimalsInSolana$1(e.toChain)
|
|
10772
|
-
),
|
|
10777
|
+
), Z = e.toToken.contract === ZeroAddress, y = e.fromToken.contract === ZeroAddress;
|
|
10773
10778
|
if (!Number(e.deadline64))
|
|
10774
10779
|
throw new Error("Deadline is not valid");
|
|
10775
|
-
const
|
|
10780
|
+
const w = BigInt(e.deadline64), S = bufferPolyfill.Buffer.alloc(SwapLayout$1.span), P = {
|
|
10776
10781
|
instruction: 101,
|
|
10777
|
-
stateNonce:
|
|
10782
|
+
stateNonce: C,
|
|
10778
10783
|
amount: getSafeU64Blob$1(j),
|
|
10779
10784
|
minAmountOut: getSafeU64Blob$1(J),
|
|
10780
|
-
deadline: getSafeU64Blob$1(
|
|
10785
|
+
deadline: getSafeU64Blob$1(w),
|
|
10781
10786
|
feeSwap: getSafeU64Blob$1(Q),
|
|
10782
10787
|
feeReturn: getSafeU64Blob$1(ee),
|
|
10783
10788
|
feeCancel: getSafeU64Blob$1(H),
|
|
10784
10789
|
gasDrop: getSafeU64Blob$1(q),
|
|
10785
10790
|
destinationChain: z,
|
|
10786
|
-
destinationAddress:
|
|
10787
|
-
unwrapRedeem:
|
|
10788
|
-
unwrapRefund:
|
|
10791
|
+
destinationAddress: X,
|
|
10792
|
+
unwrapRedeem: Z ? 1 : 0,
|
|
10793
|
+
unwrapRefund: y ? 1 : 0,
|
|
10789
10794
|
mayanFeeNonce: g,
|
|
10790
10795
|
referrerFeeNonce: A
|
|
10791
10796
|
};
|
|
10792
|
-
SwapLayout$1.encode(
|
|
10797
|
+
SwapLayout$1.encode(P, S);
|
|
10793
10798
|
const k = new TransactionInstruction({
|
|
10794
10799
|
keys: V,
|
|
10795
|
-
data:
|
|
10800
|
+
data: S,
|
|
10796
10801
|
programId: c
|
|
10797
10802
|
});
|
|
10798
10803
|
return i.push(k), {
|
|
@@ -10813,7 +10818,7 @@ function getEvmSwiftParams$1(e, t, n, a, r) {
|
|
|
10813
10818
|
const l = e.swiftMayanContract;
|
|
10814
10819
|
if (!Number(e.deadline64))
|
|
10815
10820
|
throw new Error("Swift order requires timeout");
|
|
10816
|
-
const c = BigInt(e.deadline64), d = e.swiftInputContract,
|
|
10821
|
+
const c = BigInt(e.deadline64), d = e.swiftInputContract, p = BigInt(e.effectiveAmountIn64);
|
|
10817
10822
|
let b;
|
|
10818
10823
|
a ? b = nativeAddressToHexString$1(
|
|
10819
10824
|
a,
|
|
@@ -10846,7 +10851,7 @@ function getEvmSwiftParams$1(e, t, n, a, r) {
|
|
|
10846
10851
|
return {
|
|
10847
10852
|
contractAddress: l,
|
|
10848
10853
|
tokenIn: d,
|
|
10849
|
-
amountIn:
|
|
10854
|
+
amountIn: p,
|
|
10850
10855
|
order: h
|
|
10851
10856
|
};
|
|
10852
10857
|
}
|
|
@@ -10862,10 +10867,10 @@ function getSwiftFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
10862
10867
|
tokenIn: l,
|
|
10863
10868
|
amountIn: c,
|
|
10864
10869
|
order: d,
|
|
10865
|
-
contractAddress:
|
|
10870
|
+
contractAddress: p
|
|
10866
10871
|
} = getEvmSwiftParams$1(e, t, n, a, r);
|
|
10867
10872
|
let b;
|
|
10868
|
-
const m = new Contract(
|
|
10873
|
+
const m = new Contract(p, MayanSwiftArtifact_default$1.abi);
|
|
10869
10874
|
e.swiftInputContract === ZeroAddress ? b = m.interface.encodeFunctionData(
|
|
10870
10875
|
"createOrderWithEth",
|
|
10871
10876
|
[d]
|
|
@@ -10875,29 +10880,29 @@ function getSwiftFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
10875
10880
|
);
|
|
10876
10881
|
let f, g, T;
|
|
10877
10882
|
if (e.fromToken.contract === e.swiftInputContract)
|
|
10878
|
-
e.fromToken.contract === ZeroAddress ? (f = "forwardEth", g = [
|
|
10883
|
+
e.fromToken.contract === ZeroAddress ? (f = "forwardEth", g = [p, b], T = toBeHex(c)) : (f = "forwardERC20", g = [l, c, u, p, b], T = toBeHex(0));
|
|
10879
10884
|
else {
|
|
10880
10885
|
const { evmSwapRouterAddress: h, evmSwapRouterCalldata: _ } = e;
|
|
10881
10886
|
if (!e.minMiddleAmount || !h || !_)
|
|
10882
10887
|
throw new Error("Swift swap requires middle amount, router address and calldata");
|
|
10883
|
-
const
|
|
10888
|
+
const I = e.fromToken.contract, C = getAmountOfFractionalAmount$1(e.minMiddleAmount, e.swiftInputDecimals);
|
|
10884
10889
|
e.fromToken.contract === ZeroAddress ? (f = "swapAndForwardEth", g = [
|
|
10885
10890
|
c,
|
|
10886
10891
|
h,
|
|
10887
10892
|
_,
|
|
10888
10893
|
e.swiftInputContract,
|
|
10889
|
-
|
|
10890
|
-
|
|
10894
|
+
C,
|
|
10895
|
+
p,
|
|
10891
10896
|
b
|
|
10892
10897
|
], T = toBeHex(c)) : (f = "swapAndForwardERC20", g = [
|
|
10893
|
-
|
|
10898
|
+
I,
|
|
10894
10899
|
c,
|
|
10895
10900
|
u,
|
|
10896
10901
|
h,
|
|
10897
10902
|
_,
|
|
10898
10903
|
e.swiftInputContract,
|
|
10899
|
-
|
|
10900
|
-
|
|
10904
|
+
C,
|
|
10905
|
+
p,
|
|
10901
10906
|
b
|
|
10902
10907
|
], T = toBeHex(0));
|
|
10903
10908
|
}
|
|
@@ -11062,7 +11067,7 @@ function writeBigIntTo16BytesBuffer$1(e) {
|
|
|
11062
11067
|
const t = (1n << 128n) - 1n;
|
|
11063
11068
|
if (e < 0n || e > t)
|
|
11064
11069
|
throw new RangeError("Value must fit in an unsigned 128-bit integer (0 <= value < 2^128)");
|
|
11065
|
-
const n =
|
|
11070
|
+
const n = bufferPolyfill.Buffer.alloc(16);
|
|
11066
11071
|
for (let a = 15; a >= 0; a--)
|
|
11067
11072
|
n[a] = Number(e & 0xFFn), e >>= 8n;
|
|
11068
11073
|
return n;
|
|
@@ -11076,27 +11081,27 @@ function getShuttleParams$1(e, t, n) {
|
|
|
11076
11081
|
throw new Error(`Signer chain id(${Number(n)}) and quote from chain are not same! ${s} !== ${r}`);
|
|
11077
11082
|
let i = [];
|
|
11078
11083
|
i.push(shuttleConstants$1.FAST_MODE_FLAG);
|
|
11079
|
-
const l =
|
|
11084
|
+
const l = bufferPolyfill.Buffer.alloc(8);
|
|
11080
11085
|
l.writeBigUInt64BE(BigInt(a.maxLLFee));
|
|
11081
11086
|
const c = l.subarray(2);
|
|
11082
11087
|
i.push(...c);
|
|
11083
|
-
const d =
|
|
11088
|
+
const d = bufferPolyfill.Buffer.alloc(4);
|
|
11084
11089
|
d.writeUInt32BE(a.fastTransferDeadline), i.push(...d), i.push(shuttleConstants$1.RELAY_REDEEM_MODE);
|
|
11085
|
-
const
|
|
11090
|
+
const p = getAmountOfFractionalAmount$1(
|
|
11086
11091
|
e.gasDrop,
|
|
11087
11092
|
Math.min(6, getGasDecimal$1(e.toChain))
|
|
11088
|
-
), b =
|
|
11089
|
-
b.writeBigUInt64BE(
|
|
11093
|
+
), b = bufferPolyfill.Buffer.alloc(8);
|
|
11094
|
+
b.writeBigUInt64BE(p);
|
|
11090
11095
|
const m = b.subarray(4);
|
|
11091
11096
|
i.push(...m);
|
|
11092
|
-
const f =
|
|
11097
|
+
const f = bufferPolyfill.Buffer.alloc(8);
|
|
11093
11098
|
f.writeBigUInt64BE(BigInt(a.maxRelayingFee));
|
|
11094
11099
|
const g = f.subarray(2);
|
|
11095
11100
|
i.push(...g), i.push(shuttleConstants$1.EXACT_IN_FLAG), i.push(shuttleConstants$1.USDC_INPUT_TOKEN_TYPE);
|
|
11096
11101
|
const T = BigInt(e.effectiveAmountIn64);
|
|
11097
11102
|
if (e.fromToken.contract === e.shuttleInputContract) {
|
|
11098
11103
|
i.push(...Array(8).fill(0));
|
|
11099
|
-
const h =
|
|
11104
|
+
const h = bufferPolyfill.Buffer.alloc(8);
|
|
11100
11105
|
h.writeBigUInt64BE(T), i.push(...h);
|
|
11101
11106
|
} else
|
|
11102
11107
|
i.push(...Array(16).fill(0));
|
|
@@ -11105,28 +11110,28 @@ function getShuttleParams$1(e, t, n) {
|
|
|
11105
11110
|
i.push(shuttleConstants$1.OUTPUT_NATIVE_MODE);
|
|
11106
11111
|
else {
|
|
11107
11112
|
i.push(shuttleConstants$1.OUTPUT_OTHER_MODE);
|
|
11108
|
-
const
|
|
11109
|
-
i.push(...
|
|
11113
|
+
const C = bufferPolyfill.Buffer.from(nativeAddressToHexString$1(e.toToken.contract, u).slice(2), "hex");
|
|
11114
|
+
i.push(...C);
|
|
11110
11115
|
}
|
|
11111
|
-
const h =
|
|
11116
|
+
const h = bufferPolyfill.Buffer.alloc(4);
|
|
11112
11117
|
h.writeUInt32BE(Number(BigInt(e.deadline64))), i.push(...h);
|
|
11113
11118
|
const _ = getAmountOfFractionalAmount$1(e.minAmountOut, e.toToken.decimals);
|
|
11114
11119
|
if (e.toChain === "solana") {
|
|
11115
11120
|
i.push(...Array(8).fill(0));
|
|
11116
|
-
const
|
|
11117
|
-
|
|
11121
|
+
const C = bufferPolyfill.Buffer.alloc(8);
|
|
11122
|
+
C.writeBigUInt64BE(_), i.push(...C);
|
|
11118
11123
|
} else {
|
|
11119
|
-
const
|
|
11120
|
-
i.push(...
|
|
11124
|
+
const C = writeBigIntTo16BytesBuffer$1(_);
|
|
11125
|
+
i.push(...C);
|
|
11121
11126
|
}
|
|
11122
|
-
const
|
|
11123
|
-
i.push(...
|
|
11127
|
+
const I = bufferPolyfill.Buffer.from(a.path.slice(2), "hex");
|
|
11128
|
+
i.push(...I);
|
|
11124
11129
|
} else
|
|
11125
11130
|
i.push(shuttleConstants$1.OUTPUT_USDC_MODE);
|
|
11126
11131
|
return {
|
|
11127
11132
|
destAddr: nativeAddressToHexString$1(t, u),
|
|
11128
11133
|
destChainId: u,
|
|
11129
|
-
serializedParams: `0x${
|
|
11134
|
+
serializedParams: `0x${bufferPolyfill.Buffer.from(i).toString("hex")}`,
|
|
11130
11135
|
contractAddress: e.shuttleContract,
|
|
11131
11136
|
amountIn: T,
|
|
11132
11137
|
bridgeFee: getAmountOfFractionalAmount$1(e.bridgeFee, getGasDecimal$1(e.fromChain))
|
|
@@ -11144,7 +11149,7 @@ function getShuttleFromEvmTxPayload$1(e, t, n, a) {
|
|
|
11144
11149
|
serializedParams: l,
|
|
11145
11150
|
contractAddress: c,
|
|
11146
11151
|
amountIn: d,
|
|
11147
|
-
bridgeFee:
|
|
11152
|
+
bridgeFee: p
|
|
11148
11153
|
} = getShuttleParams$1(e, t, n);
|
|
11149
11154
|
let b;
|
|
11150
11155
|
b = new Contract(c, ShuttleArtifact_default$1.abi).interface.encodeFunctionData(
|
|
@@ -11153,31 +11158,31 @@ function getShuttleFromEvmTxPayload$1(e, t, n, a) {
|
|
|
11153
11158
|
);
|
|
11154
11159
|
let f, g, T;
|
|
11155
11160
|
if (e.fromToken.contract === e.shuttleInputContract)
|
|
11156
|
-
f = "forwardERC20", g = [e.shuttleInputContract, d, r, c, b], T = toBeHex(
|
|
11161
|
+
f = "forwardERC20", g = [e.shuttleInputContract, d, r, c, b], T = toBeHex(p);
|
|
11157
11162
|
else {
|
|
11158
11163
|
const { evmSwapRouterAddress: h, evmSwapRouterCalldata: _ } = e;
|
|
11159
11164
|
if (!e.minMiddleAmount || !h || !_)
|
|
11160
11165
|
throw new Error("Shuttle source chain swap requires middle amount, router address and calldata");
|
|
11161
|
-
const
|
|
11166
|
+
const I = e.fromToken.contract, C = getAmountOfFractionalAmount$1(e.minMiddleAmount, e.shuttleInputDecimals);
|
|
11162
11167
|
e.fromToken.contract === ZeroAddress ? (f = "swapAndForwardEth", g = [
|
|
11163
11168
|
d,
|
|
11164
11169
|
h,
|
|
11165
11170
|
_,
|
|
11166
11171
|
e.shuttleInputContract,
|
|
11167
|
-
|
|
11172
|
+
C,
|
|
11168
11173
|
c,
|
|
11169
11174
|
b
|
|
11170
11175
|
], T = toBeHex(d)) : (f = "swapAndForwardERC20", g = [
|
|
11171
|
-
|
|
11176
|
+
I,
|
|
11172
11177
|
d,
|
|
11173
11178
|
r,
|
|
11174
11179
|
h,
|
|
11175
11180
|
_,
|
|
11176
11181
|
e.shuttleInputContract,
|
|
11177
|
-
|
|
11182
|
+
C,
|
|
11178
11183
|
c,
|
|
11179
11184
|
b
|
|
11180
|
-
], T = toBeHex(
|
|
11185
|
+
], T = toBeHex(p));
|
|
11181
11186
|
}
|
|
11182
11187
|
return {
|
|
11183
11188
|
data: s.interface.encodeFunctionData(f, g),
|
|
@@ -11903,7 +11908,7 @@ function getEvmFastMctpBridgeParams$1(e, t, n, a, r) {
|
|
|
11903
11908
|
const s = getWormholeChainIdById$1(Number(a)), u = getWormholeChainIdByName$1(e.fromChain), i = getWormholeChainIdByName$1(e.toChain);
|
|
11904
11909
|
if (u !== s)
|
|
11905
11910
|
throw new Error(`Signer chain id(${Number(a)}) and quote from chain are not same! ${u} !== ${s}`);
|
|
11906
|
-
const l = nativeAddressToHexString$1(t, i), c = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1), d = getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8)),
|
|
11911
|
+
const l = nativeAddressToHexString$1(t, i), c = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1), d = getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8)), p = BigInt(e.circleMaxFee64), b = BigInt(e.effectiveAmountIn64), m = getCCTPDomain$1(e.toChain);
|
|
11907
11912
|
let f;
|
|
11908
11913
|
if (n ? f = nativeAddressToHexString$1(
|
|
11909
11914
|
n,
|
|
@@ -11926,7 +11931,7 @@ function getEvmFastMctpBridgeParams$1(e, t, n, a, r) {
|
|
|
11926
11931
|
payloadType: FAST_MCTP_PAYLOAD_TYPE_DEFAULT$1,
|
|
11927
11932
|
customPayload: "0x",
|
|
11928
11933
|
minFinalityThreshold: Number(e.fastMctpMinFinality),
|
|
11929
|
-
circleMaxFee:
|
|
11934
|
+
circleMaxFee: p,
|
|
11930
11935
|
contractAddress: g
|
|
11931
11936
|
};
|
|
11932
11937
|
}
|
|
@@ -11942,7 +11947,7 @@ function getEvmFastMctpBridgeTxPayload$1(e, t, n, a, r) {
|
|
|
11942
11947
|
amountIn: l,
|
|
11943
11948
|
destAddr: c,
|
|
11944
11949
|
redeemFee: d,
|
|
11945
|
-
gasDrop:
|
|
11950
|
+
gasDrop: p,
|
|
11946
11951
|
circleMaxFee: b,
|
|
11947
11952
|
referrerAddr: m,
|
|
11948
11953
|
referrerBps: f,
|
|
@@ -11951,15 +11956,15 @@ function getEvmFastMctpBridgeTxPayload$1(e, t, n, a, r) {
|
|
|
11951
11956
|
minFinalityThreshold: A,
|
|
11952
11957
|
payloadType: h
|
|
11953
11958
|
} = s, _ = new Contract(u, MayanFastMctpArtifact_default$1.abi);
|
|
11954
|
-
let
|
|
11955
|
-
return
|
|
11959
|
+
let I, C;
|
|
11960
|
+
return I = _.interface.encodeFunctionData(
|
|
11956
11961
|
"bridge",
|
|
11957
11962
|
[
|
|
11958
11963
|
i,
|
|
11959
11964
|
l,
|
|
11960
11965
|
d,
|
|
11961
11966
|
b,
|
|
11962
|
-
|
|
11967
|
+
p,
|
|
11963
11968
|
c,
|
|
11964
11969
|
g,
|
|
11965
11970
|
m,
|
|
@@ -11968,10 +11973,10 @@ function getEvmFastMctpBridgeTxPayload$1(e, t, n, a, r) {
|
|
|
11968
11973
|
A,
|
|
11969
11974
|
T
|
|
11970
11975
|
]
|
|
11971
|
-
),
|
|
11976
|
+
), C = toBeHex(0), {
|
|
11972
11977
|
to: u,
|
|
11973
|
-
data:
|
|
11974
|
-
value:
|
|
11978
|
+
data: I,
|
|
11979
|
+
value: C,
|
|
11975
11980
|
_params: s
|
|
11976
11981
|
};
|
|
11977
11982
|
}
|
|
@@ -11990,7 +11995,7 @@ function getEvmFastMctpCreateOrderParams$1(e, t, n, a) {
|
|
|
11990
11995
|
SystemProgram.programId.toString(),
|
|
11991
11996
|
getWormholeChainIdByName$1("solana")
|
|
11992
11997
|
);
|
|
11993
|
-
const d = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1),
|
|
11998
|
+
const d = getAmountOfFractionalAmount$1(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS$1), p = BigInt(e.refundRelayerFee64), b = BigInt(e.circleMaxFee64), m = getAmountOfFractionalAmount$1(e.gasDrop, Math.min(getGasDecimal$1(e.toChain), 8)), f = getCCTPDomain$1(e.toChain), g = BigInt(e.effectiveAmountIn64), T = getAmountOfFractionalAmount$1(
|
|
11994
11999
|
e.minAmountOut,
|
|
11995
12000
|
Math.min(8, e.toToken.decimals)
|
|
11996
12001
|
), A = BigInt(e.deadline64), h = e.toToken.contract === ZeroAddress ? nativeAddressToHexString$1(SystemProgram.programId.toString(), getWormholeChainIdByName$1("solana")) : nativeAddressToHexString$1(
|
|
@@ -12010,7 +12015,7 @@ function getEvmFastMctpCreateOrderParams$1(e, t, n, a) {
|
|
|
12010
12015
|
amountOutMin: T,
|
|
12011
12016
|
gasDrop: m,
|
|
12012
12017
|
redeemFee: d,
|
|
12013
|
-
refundFee:
|
|
12018
|
+
refundFee: p,
|
|
12014
12019
|
deadline: A,
|
|
12015
12020
|
referrerAddr: c,
|
|
12016
12021
|
referrerBps: e.referrerBps || 0
|
|
@@ -12031,10 +12036,10 @@ function getEvmFastMctpCreateOrderTxPayload$1(e, t, n, a) {
|
|
|
12031
12036
|
amountIn: l,
|
|
12032
12037
|
circleMaxFee: c,
|
|
12033
12038
|
destDomain: d,
|
|
12034
|
-
minFinalityThreshold:
|
|
12039
|
+
minFinalityThreshold: p
|
|
12035
12040
|
} = r, m = new Contract(s, MayanFastMctpArtifact_default$1.abi).interface.encodeFunctionData(
|
|
12036
12041
|
"createOrder",
|
|
12037
|
-
[i, l, c, d,
|
|
12042
|
+
[i, l, c, d, p, u]
|
|
12038
12043
|
), f = toBeHex(0);
|
|
12039
12044
|
return {
|
|
12040
12045
|
to: s,
|
|
@@ -12107,7 +12112,7 @@ function getFastMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
12107
12112
|
if (e.hasAuction) {
|
|
12108
12113
|
if (!Number(e.deadline64))
|
|
12109
12114
|
throw new Error("Fast Mctp order requires timeout");
|
|
12110
|
-
const
|
|
12115
|
+
const p = getEvmFastMctpCreateOrderTxPayload$1(
|
|
12111
12116
|
e,
|
|
12112
12117
|
t,
|
|
12113
12118
|
n,
|
|
@@ -12115,18 +12120,18 @@ function getFastMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
12115
12120
|
), b = getAmountOfFractionalAmount$1(e.minMiddleAmount, CCTP_TOKEN_DECIMALS$1);
|
|
12116
12121
|
if (e.fromToken.contract === ZeroAddress) {
|
|
12117
12122
|
const m = "swapAndForwardEth", f = [
|
|
12118
|
-
|
|
12123
|
+
p._params.amountIn,
|
|
12119
12124
|
c,
|
|
12120
12125
|
d,
|
|
12121
12126
|
e.fastMctpInputContract,
|
|
12122
12127
|
b,
|
|
12123
|
-
|
|
12124
|
-
|
|
12128
|
+
p._params.contractAddress,
|
|
12129
|
+
p.data
|
|
12125
12130
|
];
|
|
12126
12131
|
return {
|
|
12127
12132
|
data: i.interface.encodeFunctionData(m, f),
|
|
12128
12133
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
12129
|
-
value: toBeHex(
|
|
12134
|
+
value: toBeHex(p._params.amountIn),
|
|
12130
12135
|
chainId: a,
|
|
12131
12136
|
_forwarder: {
|
|
12132
12137
|
method: m,
|
|
@@ -12136,14 +12141,14 @@ function getFastMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
12136
12141
|
} else {
|
|
12137
12142
|
const m = "swapAndForwardERC20", f = [
|
|
12138
12143
|
e.fromToken.contract,
|
|
12139
|
-
|
|
12144
|
+
p._params.amountIn,
|
|
12140
12145
|
u,
|
|
12141
12146
|
c,
|
|
12142
12147
|
d,
|
|
12143
12148
|
e.fastMctpInputContract,
|
|
12144
12149
|
b,
|
|
12145
|
-
|
|
12146
|
-
|
|
12150
|
+
p._params.contractAddress,
|
|
12151
|
+
p.data
|
|
12147
12152
|
];
|
|
12148
12153
|
return {
|
|
12149
12154
|
data: i.interface.encodeFunctionData(m, f),
|
|
@@ -12157,7 +12162,7 @@ function getFastMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
12157
12162
|
};
|
|
12158
12163
|
}
|
|
12159
12164
|
} else {
|
|
12160
|
-
const
|
|
12165
|
+
const p = getEvmFastMctpBridgeTxPayload$1(
|
|
12161
12166
|
e,
|
|
12162
12167
|
t,
|
|
12163
12168
|
n,
|
|
@@ -12165,18 +12170,18 @@ function getFastMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
12165
12170
|
), b = getAmountOfFractionalAmount$1(e.minMiddleAmount, CCTP_TOKEN_DECIMALS$1);
|
|
12166
12171
|
if (e.fromToken.contract === ZeroAddress) {
|
|
12167
12172
|
const m = "swapAndForwardEth", f = [
|
|
12168
|
-
|
|
12173
|
+
p._params.amountIn,
|
|
12169
12174
|
c,
|
|
12170
12175
|
d,
|
|
12171
12176
|
e.fastMctpInputContract,
|
|
12172
12177
|
b,
|
|
12173
|
-
|
|
12174
|
-
|
|
12178
|
+
p._params.contractAddress,
|
|
12179
|
+
p.data
|
|
12175
12180
|
];
|
|
12176
12181
|
return {
|
|
12177
12182
|
data: i.interface.encodeFunctionData(m, f),
|
|
12178
12183
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
12179
|
-
value: toBeHex(
|
|
12184
|
+
value: toBeHex(p._params.amountIn),
|
|
12180
12185
|
chainId: a,
|
|
12181
12186
|
_forwarder: {
|
|
12182
12187
|
method: m,
|
|
@@ -12186,14 +12191,14 @@ function getFastMctpFromEvmTxPayload$1(e, t, n, a, r, s) {
|
|
|
12186
12191
|
} else {
|
|
12187
12192
|
const m = "swapAndForwardERC20", f = [
|
|
12188
12193
|
e.fromToken.contract,
|
|
12189
|
-
|
|
12194
|
+
p._params.amountIn,
|
|
12190
12195
|
u,
|
|
12191
12196
|
c,
|
|
12192
12197
|
d,
|
|
12193
12198
|
e.fastMctpInputContract,
|
|
12194
12199
|
b,
|
|
12195
|
-
|
|
12196
|
-
|
|
12200
|
+
p._params.contractAddress,
|
|
12201
|
+
p.data
|
|
12197
12202
|
];
|
|
12198
12203
|
return {
|
|
12199
12204
|
data: i.interface.encodeFunctionData(m, f),
|
|
@@ -12426,7 +12431,7 @@ function getUsdcDepositInitiatorMctpTxPayload(e, t, n, a) {
|
|
|
12426
12431
|
const r = new Contract(
|
|
12427
12432
|
e.hyperCoreParams.initiateContractAddress,
|
|
12428
12433
|
HCDepositInitiatorArtifact_default.abi
|
|
12429
|
-
), s =
|
|
12434
|
+
), s = bufferPolyfill.Buffer.from(hexToUint8Array$1(a));
|
|
12430
12435
|
if (s.length !== 65)
|
|
12431
12436
|
throw new Error("Invalid USDC permit signature length");
|
|
12432
12437
|
const u = "0x" + s.subarray(0, 32).toString("hex"), i = "0x" + s.subarray(32, 64).toString("hex"), l = s[64];
|
|
@@ -12472,15 +12477,15 @@ function getUsdcDepositInitiatorFastMctpTxPayload(e, t, n, a, r) {
|
|
|
12472
12477
|
const u = new Contract(
|
|
12473
12478
|
e.hyperCoreParams.initiateContractAddress,
|
|
12474
12479
|
HCDepositInitiatorArtifact_default.abi
|
|
12475
|
-
), i =
|
|
12480
|
+
), i = bufferPolyfill.Buffer.from(hexToUint8Array$1(r));
|
|
12476
12481
|
if (i.length !== 65)
|
|
12477
12482
|
throw new Error("Invalid USDC permit signature length");
|
|
12478
12483
|
const l = "0x" + i.subarray(0, 32).toString("hex"), c = "0x" + i.subarray(32, 64).toString("hex"), d = i[64];
|
|
12479
|
-
let
|
|
12480
|
-
a ?
|
|
12484
|
+
let p;
|
|
12485
|
+
a ? p = nativeAddressToHexString$1(
|
|
12481
12486
|
a,
|
|
12482
12487
|
s
|
|
12483
|
-
) :
|
|
12488
|
+
) : p = nativeAddressToHexString$1(
|
|
12484
12489
|
SystemProgram.programId.toString(),
|
|
12485
12490
|
getWormholeChainIdByName$1("solana")
|
|
12486
12491
|
);
|
|
@@ -12494,7 +12499,7 @@ function getUsdcDepositInitiatorFastMctpTxPayload(e, t, n, a, r) {
|
|
|
12494
12499
|
e.hyperCoreParams.failureGasDrop,
|
|
12495
12500
|
Math.min(getGasDecimal$1("arbitrum"), 8)
|
|
12496
12501
|
),
|
|
12497
|
-
|
|
12502
|
+
p,
|
|
12498
12503
|
e.referrerBps,
|
|
12499
12504
|
Number(e.fastMctpMinFinality),
|
|
12500
12505
|
BigInt(e.hyperCoreParams.bridgeAmountUSDC64),
|
|
@@ -12533,7 +12538,7 @@ function getHyperCoreDepositFromEvmTxPayload(e, t, n, a, r, s, u, i = {}) {
|
|
|
12533
12538
|
const l = getWormholeChainIdById$1(Number(r)), c = getWormholeChainIdByName$1(e.fromChain);
|
|
12534
12539
|
if (c !== l)
|
|
12535
12540
|
throw new Error(`Signer chain id(${Number(r)}) and quote from chain are not same! ${c} !== ${l}`);
|
|
12536
|
-
const d = s || ZeroPermit$1,
|
|
12541
|
+
const d = s || ZeroPermit$1, p = new Contract(addresses_default$1.MAYAN_FORWARDER_CONTRACT, MayanForwarderArtifact_default$1.abi);
|
|
12537
12542
|
let b;
|
|
12538
12543
|
if (!Number(e.deadline64))
|
|
12539
12544
|
throw new Error("HyperCore deposit requires timeout");
|
|
@@ -12563,7 +12568,7 @@ function getHyperCoreDepositFromEvmTxPayload(e, t, n, a, r, s, u, i = {}) {
|
|
|
12563
12568
|
b.data
|
|
12564
12569
|
];
|
|
12565
12570
|
return {
|
|
12566
|
-
data:
|
|
12571
|
+
data: p.interface.encodeFunctionData(m, f),
|
|
12567
12572
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
12568
12573
|
value: toBeHex(0),
|
|
12569
12574
|
chainId: r,
|
|
@@ -12588,7 +12593,7 @@ function getHyperCoreDepositFromEvmTxPayload(e, t, n, a, r, s, u, i = {}) {
|
|
|
12588
12593
|
b.data
|
|
12589
12594
|
];
|
|
12590
12595
|
return {
|
|
12591
|
-
data:
|
|
12596
|
+
data: p.interface.encodeFunctionData(T, A),
|
|
12592
12597
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
12593
12598
|
value: toBeHex(BigInt(e.effectiveAmountIn64)),
|
|
12594
12599
|
chainId: r,
|
|
@@ -12610,7 +12615,7 @@ function getHyperCoreDepositFromEvmTxPayload(e, t, n, a, r, s, u, i = {}) {
|
|
|
12610
12615
|
b.data
|
|
12611
12616
|
];
|
|
12612
12617
|
return {
|
|
12613
|
-
data:
|
|
12618
|
+
data: p.interface.encodeFunctionData(T, A),
|
|
12614
12619
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
12615
12620
|
value: toBeHex(0),
|
|
12616
12621
|
chainId: r,
|
|
@@ -12800,22 +12805,22 @@ function getEvmMonoChainTxPayload(e, t, n) {
|
|
|
12800
12805
|
), r = new Contract(
|
|
12801
12806
|
e.monoChainMayanContract,
|
|
12802
12807
|
MayanMonoChainArtifact_default.abi
|
|
12803
|
-
);
|
|
12804
|
-
let
|
|
12805
|
-
return e.toToken.contract === ZeroAddress ?
|
|
12808
|
+
), s = n && e.referrerBps || 0;
|
|
12809
|
+
let u, i;
|
|
12810
|
+
return e.toToken.contract === ZeroAddress ? u = r.interface.encodeFunctionData("transferEth", [
|
|
12806
12811
|
t,
|
|
12807
|
-
n,
|
|
12808
|
-
|
|
12809
|
-
]) :
|
|
12812
|
+
n || ZeroAddress,
|
|
12813
|
+
s
|
|
12814
|
+
]) : u = r.interface.encodeFunctionData("transferToken", [
|
|
12810
12815
|
e.toToken.contract,
|
|
12811
12816
|
a,
|
|
12812
12817
|
t,
|
|
12813
|
-
n,
|
|
12814
|
-
|
|
12815
|
-
]), e.fromToken.contract === ZeroAddress ?
|
|
12818
|
+
n || ZeroAddress,
|
|
12819
|
+
s
|
|
12820
|
+
]), e.fromToken.contract === ZeroAddress ? i = toBeHex(e.effectiveAmountIn64) : i = toBeHex(0), {
|
|
12816
12821
|
to: e.monoChainMayanContract,
|
|
12817
|
-
data:
|
|
12818
|
-
value:
|
|
12822
|
+
data: u,
|
|
12823
|
+
value: i,
|
|
12819
12824
|
_params: {
|
|
12820
12825
|
amountIn: BigInt(e.effectiveAmountIn64),
|
|
12821
12826
|
tokenIn: e.fromToken.contract
|
|
@@ -12849,7 +12854,7 @@ function getMonoChainFromEvmTxPayload(e, t, n, a, r) {
|
|
|
12849
12854
|
throw new Error(
|
|
12850
12855
|
"Mono chain swap requires router address and calldata"
|
|
12851
12856
|
);
|
|
12852
|
-
const
|
|
12857
|
+
const p = getEvmMonoChainTxPayload(
|
|
12853
12858
|
e,
|
|
12854
12859
|
t,
|
|
12855
12860
|
n
|
|
@@ -12859,13 +12864,13 @@ function getMonoChainFromEvmTxPayload(e, t, n, a, r) {
|
|
|
12859
12864
|
);
|
|
12860
12865
|
if (e.fromToken.contract === ZeroAddress) {
|
|
12861
12866
|
const m = "swapAndForwardEth", f = [
|
|
12862
|
-
|
|
12867
|
+
p._params.amountIn,
|
|
12863
12868
|
c,
|
|
12864
12869
|
d,
|
|
12865
12870
|
e.toToken.contract,
|
|
12866
12871
|
b,
|
|
12867
12872
|
e.monoChainMayanContract,
|
|
12868
|
-
|
|
12873
|
+
p.data
|
|
12869
12874
|
];
|
|
12870
12875
|
return {
|
|
12871
12876
|
data: l.interface.encodeFunctionData(
|
|
@@ -12873,7 +12878,7 @@ function getMonoChainFromEvmTxPayload(e, t, n, a, r) {
|
|
|
12873
12878
|
f
|
|
12874
12879
|
),
|
|
12875
12880
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
12876
|
-
value: toBeHex(
|
|
12881
|
+
value: toBeHex(p._params.amountIn),
|
|
12877
12882
|
chainId: a,
|
|
12878
12883
|
_forwarder: {
|
|
12879
12884
|
method: m,
|
|
@@ -12883,14 +12888,14 @@ function getMonoChainFromEvmTxPayload(e, t, n, a, r) {
|
|
|
12883
12888
|
} else {
|
|
12884
12889
|
const m = "swapAndForwardERC20", f = [
|
|
12885
12890
|
e.fromToken.contract,
|
|
12886
|
-
|
|
12891
|
+
p._params.amountIn,
|
|
12887
12892
|
i,
|
|
12888
12893
|
c,
|
|
12889
12894
|
d,
|
|
12890
12895
|
e.toToken.contract,
|
|
12891
12896
|
b,
|
|
12892
12897
|
e.monoChainMayanContract,
|
|
12893
|
-
|
|
12898
|
+
p.data
|
|
12894
12899
|
];
|
|
12895
12900
|
return {
|
|
12896
12901
|
data: l.interface.encodeFunctionData(
|
|
@@ -12909,13 +12914,13 @@ function getMonoChainFromEvmTxPayload(e, t, n, a, r) {
|
|
|
12909
12914
|
}
|
|
12910
12915
|
function getEvmSwapParams$1(e, t, n, a, r, s) {
|
|
12911
12916
|
const u = new PublicKey$1(addresses_default$1.MAYAN_PROGRAM_ID), [i] = PublicKey$1.findProgramAddressSync(
|
|
12912
|
-
[
|
|
12917
|
+
[bufferPolyfill.Buffer.from("MAIN")],
|
|
12913
12918
|
u
|
|
12914
12919
|
), l = getAssociatedTokenAddress$1(
|
|
12915
12920
|
new PublicKey$1(e.fromToken.mint),
|
|
12916
12921
|
i,
|
|
12917
12922
|
!0
|
|
12918
|
-
), c = BigInt(e.effectiveAmountIn64), d = nativeAddressToHexString$1(l.toString(), 1),
|
|
12923
|
+
), c = BigInt(e.effectiveAmountIn64), d = nativeAddressToHexString$1(l.toString(), 1), p = nativeAddressToHexString$1(
|
|
12919
12924
|
addresses_default$1.AUCTION_PROGRAM_ID,
|
|
12920
12925
|
1
|
|
12921
12926
|
);
|
|
@@ -12935,7 +12940,7 @@ function getEvmSwapParams$1(e, t, n, a, r, s) {
|
|
|
12935
12940
|
mayanChainId: 1,
|
|
12936
12941
|
destAddr: nativeAddressToHexString$1(t, g),
|
|
12937
12942
|
destChainId: g,
|
|
12938
|
-
auctionAddr:
|
|
12943
|
+
auctionAddr: p,
|
|
12939
12944
|
referrer: b,
|
|
12940
12945
|
refundAddr: nativeAddressToHexString$1(a, m)
|
|
12941
12946
|
}, h = e.toToken.contract === ZeroAddress, _ = {
|
|
@@ -12951,7 +12956,7 @@ function getEvmSwapParams$1(e, t, n, a, r, s) {
|
|
|
12951
12956
|
),
|
|
12952
12957
|
unwrap: h,
|
|
12953
12958
|
customPayload: "0x"
|
|
12954
|
-
},
|
|
12959
|
+
}, I = {
|
|
12955
12960
|
swapFee: getAmountOfFractionalAmount$1(
|
|
12956
12961
|
e.swapRelayerFee,
|
|
12957
12962
|
Math.min(8, e.fromToken.decimals)
|
|
@@ -12964,51 +12969,51 @@ function getEvmSwapParams$1(e, t, n, a, r, s) {
|
|
|
12964
12969
|
e.refundRelayerFee,
|
|
12965
12970
|
Math.min(8, e.fromToken.decimals)
|
|
12966
12971
|
)
|
|
12967
|
-
},
|
|
12972
|
+
}, C = nativeAddressToHexString$1(
|
|
12968
12973
|
e.toToken.realOriginContractAddress,
|
|
12969
12974
|
e.toToken.realOriginChainId
|
|
12970
|
-
),
|
|
12975
|
+
), E = getAmountOfFractionalAmount$1(
|
|
12971
12976
|
e.bridgeFee,
|
|
12972
12977
|
18
|
|
12973
12978
|
);
|
|
12974
12979
|
return {
|
|
12975
12980
|
amountIn: c,
|
|
12976
12981
|
tokenIn: e.fromToken.contract,
|
|
12977
|
-
tokenOut:
|
|
12982
|
+
tokenOut: C,
|
|
12978
12983
|
tokenOutWChainId: e.toToken.realOriginChainId,
|
|
12979
12984
|
criteria: _,
|
|
12980
12985
|
recipient: A,
|
|
12981
|
-
relayerFees:
|
|
12986
|
+
relayerFees: I,
|
|
12982
12987
|
contractAddress: T,
|
|
12983
|
-
bridgeFee:
|
|
12988
|
+
bridgeFee: E
|
|
12984
12989
|
};
|
|
12985
12990
|
}
|
|
12986
12991
|
function getSwapFromEvmTxPayload$1(e, t, n, a, r, s, u, i, l) {
|
|
12987
12992
|
const c = getWormholeChainIdById$1(Number(s)), d = getWormholeChainIdByName$1(e.fromChain);
|
|
12988
12993
|
if (d !== c)
|
|
12989
12994
|
throw new Error(`Signer chain id(${Number(s)}) and quote from chain are not same! ${d} !== ${c}`);
|
|
12990
|
-
const
|
|
12995
|
+
const p = getQuoteSuitableReferrerAddress$1(e, a);
|
|
12991
12996
|
if (e.toChain === "hypercore")
|
|
12992
12997
|
return getHyperCoreDepositFromEvmTxPayload(
|
|
12993
12998
|
e,
|
|
12994
12999
|
t,
|
|
12995
13000
|
n,
|
|
12996
|
-
|
|
13001
|
+
p,
|
|
12997
13002
|
s,
|
|
12998
13003
|
i,
|
|
12999
13004
|
u,
|
|
13000
13005
|
l
|
|
13001
13006
|
);
|
|
13002
13007
|
if (e.type === "MCTP")
|
|
13003
|
-
return getMctpFromEvmTxPayload$1(e, n,
|
|
13008
|
+
return getMctpFromEvmTxPayload$1(e, n, p, s, i);
|
|
13004
13009
|
if (e.type === "SWIFT")
|
|
13005
|
-
return getSwiftFromEvmTxPayload$1(e, t, n,
|
|
13010
|
+
return getSwiftFromEvmTxPayload$1(e, t, n, p, s);
|
|
13006
13011
|
if (e.type === "SHUTTLE")
|
|
13007
13012
|
return getShuttleFromEvmTxPayload$1(e, n, s);
|
|
13008
13013
|
if (e.type === "FAST_MCTP")
|
|
13009
|
-
return getFastMctpFromEvmTxPayload$1(e, n,
|
|
13014
|
+
return getFastMctpFromEvmTxPayload$1(e, n, p, s, i);
|
|
13010
13015
|
if (e.type === "MONO_CHAIN")
|
|
13011
|
-
return getMonoChainFromEvmTxPayload(e, n,
|
|
13016
|
+
return getMonoChainFromEvmTxPayload(e, n, p, s, i);
|
|
13012
13017
|
if (e.type != "WH")
|
|
13013
13018
|
throw new Error("Unsupported quote type");
|
|
13014
13019
|
if (!Number(e.deadline64))
|
|
@@ -13022,24 +13027,24 @@ function getSwapFromEvmTxPayload$1(e, t, n, a, r, s, u, i, l) {
|
|
|
13022
13027
|
tokenIn: A,
|
|
13023
13028
|
amountIn: h,
|
|
13024
13029
|
contractAddress: _,
|
|
13025
|
-
bridgeFee:
|
|
13030
|
+
bridgeFee: I
|
|
13026
13031
|
} = getEvmSwapParams$1(
|
|
13027
13032
|
e,
|
|
13028
13033
|
n,
|
|
13029
|
-
|
|
13034
|
+
p,
|
|
13030
13035
|
r,
|
|
13031
13036
|
s
|
|
13032
|
-
),
|
|
13037
|
+
), C = new Contract(addresses_default$1.MAYAN_FORWARDER_CONTRACT, MayanForwarderArtifact_default$1.abi), E = new Contract(_, MayanSwapArtifact_default$1.abi);
|
|
13033
13038
|
let R, $, N;
|
|
13034
13039
|
const D = ZeroPermit$1;
|
|
13035
13040
|
if (A === ZeroAddress) {
|
|
13036
|
-
const v =
|
|
13041
|
+
const v = E.interface.encodeFunctionData(
|
|
13037
13042
|
"wrapAndSwapETH",
|
|
13038
13043
|
[b, m, f, g, T]
|
|
13039
13044
|
);
|
|
13040
13045
|
R = "forwardEth", $ = [_, v], N = toBeHex(h);
|
|
13041
13046
|
} else {
|
|
13042
|
-
const v =
|
|
13047
|
+
const v = E.interface.encodeFunctionData(
|
|
13043
13048
|
"swap",
|
|
13044
13049
|
[
|
|
13045
13050
|
b,
|
|
@@ -13051,9 +13056,9 @@ function getSwapFromEvmTxPayload$1(e, t, n, a, r, s, u, i, l) {
|
|
|
13051
13056
|
h
|
|
13052
13057
|
]
|
|
13053
13058
|
);
|
|
13054
|
-
R = "forwardERC20", $ = [A, h, D, _, v], N = toBeHex(
|
|
13059
|
+
R = "forwardERC20", $ = [A, h, D, _, v], N = toBeHex(I);
|
|
13055
13060
|
}
|
|
13056
|
-
const M =
|
|
13061
|
+
const M = C.interface.encodeFunctionData(R, $);
|
|
13057
13062
|
return {
|
|
13058
13063
|
to: addresses_default$1.MAYAN_FORWARDER_CONTRACT,
|
|
13059
13064
|
data: M,
|
|
@@ -13167,9 +13172,9 @@ async function createMctpFromSuiMoveCalls$1(e, t, n, a, r, s, u) {
|
|
|
13167
13172
|
e.minMiddleAmount,
|
|
13168
13173
|
CCTP_TOKEN_DECIMALS$1
|
|
13169
13174
|
);
|
|
13170
|
-
let d,
|
|
13175
|
+
let d, p, b;
|
|
13171
13176
|
if (e.fromToken.contract === e.mctpInputContract)
|
|
13172
|
-
d = new Transaction(),
|
|
13177
|
+
d = new Transaction(), p = await resolveInputCoin$1(
|
|
13173
13178
|
c,
|
|
13174
13179
|
t,
|
|
13175
13180
|
e.mctpInputContract,
|
|
@@ -13192,7 +13197,7 @@ async function createMctpFromSuiMoveCalls$1(e, t, n, a, r, s, u) {
|
|
|
13192
13197
|
inputCoin: u == null ? void 0 : u.inputCoin,
|
|
13193
13198
|
transaction: void 0
|
|
13194
13199
|
});
|
|
13195
|
-
d = Transaction.from(g),
|
|
13200
|
+
d = Transaction.from(g), p = T, b = A ? { result: A } : null;
|
|
13196
13201
|
}
|
|
13197
13202
|
e.hasAuction ? await addInitOrderMoveCalls$1(
|
|
13198
13203
|
e,
|
|
@@ -13203,7 +13208,7 @@ async function createMctpFromSuiMoveCalls$1(e, t, n, a, r, s, u) {
|
|
|
13203
13208
|
l,
|
|
13204
13209
|
s,
|
|
13205
13210
|
{
|
|
13206
|
-
inputCoin: { result:
|
|
13211
|
+
inputCoin: { result: p },
|
|
13207
13212
|
whFeeCoin: b,
|
|
13208
13213
|
builtTransaction: d
|
|
13209
13214
|
}
|
|
@@ -13214,7 +13219,7 @@ async function createMctpFromSuiMoveCalls$1(e, t, n, a, r, s, u) {
|
|
|
13214
13219
|
i,
|
|
13215
13220
|
s,
|
|
13216
13221
|
{
|
|
13217
|
-
inputCoin: { result:
|
|
13222
|
+
inputCoin: { result: p },
|
|
13218
13223
|
builtTransaction: d
|
|
13219
13224
|
}
|
|
13220
13225
|
) : await addBridgeWithFeeMoveCalls$1(
|
|
@@ -13225,7 +13230,7 @@ async function createMctpFromSuiMoveCalls$1(e, t, n, a, r, s, u) {
|
|
|
13225
13230
|
r,
|
|
13226
13231
|
s,
|
|
13227
13232
|
{
|
|
13228
|
-
inputCoin: { result:
|
|
13233
|
+
inputCoin: { result: p },
|
|
13229
13234
|
whFeeCoin: b,
|
|
13230
13235
|
builtTransaction: d
|
|
13231
13236
|
}
|
|
@@ -13289,7 +13294,7 @@ async function addBridgeLockedFeeMoveCalls$1(e, t, n, a, r, s) {
|
|
|
13289
13294
|
r,
|
|
13290
13295
|
i,
|
|
13291
13296
|
s == null ? void 0 : s.inputCoin
|
|
13292
|
-
), d = nativeAddressToHexString$1(n, u),
|
|
13297
|
+
), d = nativeAddressToHexString$1(n, u), p = getCCTPDomain$1(e.toChain), b = getAmountOfFractionalAmount$1(
|
|
13293
13298
|
e.gasDrop,
|
|
13294
13299
|
Math.min(getGasDecimal$1(e.toChain), 8)
|
|
13295
13300
|
), m = getAmountOfFractionalAmount$1(
|
|
@@ -13304,7 +13309,7 @@ async function addBridgeLockedFeeMoveCalls$1(e, t, n, a, r, s) {
|
|
|
13304
13309
|
c,
|
|
13305
13310
|
i.pure.u64(l),
|
|
13306
13311
|
i.pure.address(d),
|
|
13307
|
-
i.pure.u32(
|
|
13312
|
+
i.pure.u32(p),
|
|
13308
13313
|
i.pure.u64(b),
|
|
13309
13314
|
i.pure.u64(m)
|
|
13310
13315
|
]
|
|
@@ -13352,7 +13357,7 @@ async function addInitOrderMoveCalls$1(e, t, n, a, r, s, u, i) {
|
|
|
13352
13357
|
const l = getWormholeChainIdByName$1(e.toChain), c = (i == null ? void 0 : i.builtTransaction) ?? new Transaction(), d = getAmountOfFractionalAmount$1(
|
|
13353
13358
|
e.minMiddleAmount,
|
|
13354
13359
|
CCTP_TOKEN_DECIMALS$1
|
|
13355
|
-
), [
|
|
13360
|
+
), [p] = await Promise.all([
|
|
13356
13361
|
resolveInputCoin$1(
|
|
13357
13362
|
d,
|
|
13358
13363
|
t,
|
|
@@ -13385,11 +13390,11 @@ async function addInitOrderMoveCalls$1(e, t, n, a, r, s, u, i) {
|
|
|
13385
13390
|
SystemProgram.programId.toString(),
|
|
13386
13391
|
getWormholeChainIdByName$1("solana")
|
|
13387
13392
|
);
|
|
13388
|
-
const
|
|
13393
|
+
const I = [
|
|
13389
13394
|
c.object(e.mctpVerifiedInputAddress),
|
|
13390
13395
|
c.pure.u8(MCTP_INIT_ORDER_PAYLOAD_ID$1),
|
|
13391
13396
|
c.pure.address(t),
|
|
13392
|
-
|
|
13397
|
+
p,
|
|
13393
13398
|
c.pure.address(f),
|
|
13394
13399
|
c.pure.u16(l),
|
|
13395
13400
|
c.pure.address(b),
|
|
@@ -13399,19 +13404,19 @@ async function addInitOrderMoveCalls$1(e, t, n, a, r, s, u, i) {
|
|
|
13399
13404
|
c.pure.u64(h),
|
|
13400
13405
|
c.pure.address(_),
|
|
13401
13406
|
c.pure.u8(e.referrerBps)
|
|
13402
|
-
], [
|
|
13407
|
+
], [C] = c.moveCall({
|
|
13403
13408
|
package: s,
|
|
13404
13409
|
module: "calculate_mctp_fee",
|
|
13405
13410
|
function: "prepare_calc_mctp_fee",
|
|
13406
13411
|
typeArguments: [e.mctpInputContract],
|
|
13407
|
-
arguments:
|
|
13408
|
-
}), [
|
|
13412
|
+
arguments: I
|
|
13413
|
+
}), [E] = c.moveCall({
|
|
13409
13414
|
package: s,
|
|
13410
13415
|
module: "calculate_mctp_fee",
|
|
13411
13416
|
function: "calculate_mctp_fee",
|
|
13412
13417
|
arguments: [
|
|
13413
13418
|
c.object(addresses_default$1.SUI_MCTP_FEE_MANAGER_STATE),
|
|
13414
|
-
|
|
13419
|
+
C
|
|
13415
13420
|
]
|
|
13416
13421
|
}), [R] = c.moveCall({
|
|
13417
13422
|
package: r,
|
|
@@ -13419,7 +13424,7 @@ async function addInitOrderMoveCalls$1(e, t, n, a, r, s, u, i) {
|
|
|
13419
13424
|
function: "prepare_initialize_order",
|
|
13420
13425
|
typeArguments: [e.mctpInputContract],
|
|
13421
13426
|
arguments: [
|
|
13422
|
-
...
|
|
13427
|
+
...I.slice(1),
|
|
13423
13428
|
c.pure.u32(g),
|
|
13424
13429
|
c.pure.u64(d)
|
|
13425
13430
|
]
|
|
@@ -13433,7 +13438,7 @@ async function addInitOrderMoveCalls$1(e, t, n, a, r, s, u, i) {
|
|
|
13433
13438
|
c.object(addresses_default$1.SUI_CCTP_CORE_STATE),
|
|
13434
13439
|
c.object(e.mctpVerifiedInputAddress),
|
|
13435
13440
|
R,
|
|
13436
|
-
|
|
13441
|
+
E
|
|
13437
13442
|
]
|
|
13438
13443
|
}), [D, M] = c.moveCall({
|
|
13439
13444
|
package: addresses_default$1.SUI_CCTP_TOKEN_PACKAGE_ID,
|
|
@@ -13521,7 +13526,7 @@ async function addBridgeWithFeeMoveCalls2(e) {
|
|
|
13521
13526
|
r,
|
|
13522
13527
|
i,
|
|
13523
13528
|
s == null ? void 0 : s.inputCoin
|
|
13524
|
-
), d = MCTP_PAYLOAD_TYPE_DEFAULT$1,
|
|
13529
|
+
), d = MCTP_PAYLOAD_TYPE_DEFAULT$1, p = nativeAddressToHexString$1(n, u), b = getCCTPDomain$1(e.toChain), m = getAmountOfFractionalAmount$1(
|
|
13525
13530
|
e.gasDrop,
|
|
13526
13531
|
Math.min(getGasDecimal$1(e.toChain), 8)
|
|
13527
13532
|
), f = getAmountOfFractionalAmount$1(
|
|
@@ -13536,7 +13541,7 @@ async function addBridgeWithFeeMoveCalls2(e) {
|
|
|
13536
13541
|
i.pure.u8(d),
|
|
13537
13542
|
c,
|
|
13538
13543
|
i.pure.u64(l),
|
|
13539
|
-
i.pure.address(
|
|
13544
|
+
i.pure.address(p),
|
|
13540
13545
|
i.pure.u32(b),
|
|
13541
13546
|
i.pure.u64(m),
|
|
13542
13547
|
i.pure.u64(f),
|
|
@@ -13553,7 +13558,7 @@ async function addBridgeWithFeeMoveCalls2(e) {
|
|
|
13553
13558
|
i.object(e.mctpVerifiedInputAddress),
|
|
13554
13559
|
T
|
|
13555
13560
|
]
|
|
13556
|
-
}), [_,
|
|
13561
|
+
}), [_, I] = i.moveCall({
|
|
13557
13562
|
package: addresses_default$1.SUI_CCTP_TOKEN_PACKAGE_ID,
|
|
13558
13563
|
module: "deposit_for_burn",
|
|
13559
13564
|
function: "deposit_for_burn_with_caller_with_package_auth",
|
|
@@ -13568,15 +13573,15 @@ async function addBridgeWithFeeMoveCalls2(e) {
|
|
|
13568
13573
|
i.object("0x403"),
|
|
13569
13574
|
i.object(e.mctpInputTreasury)
|
|
13570
13575
|
]
|
|
13571
|
-
}), [
|
|
13576
|
+
}), [C] = i.moveCall({
|
|
13572
13577
|
package: a,
|
|
13573
13578
|
module: "bridge_with_fee",
|
|
13574
13579
|
function: "publish_bridge_with_fee",
|
|
13575
|
-
arguments: [i.object(addresses_default$1.SUI_MCTP_STATE), A,
|
|
13580
|
+
arguments: [i.object(addresses_default$1.SUI_MCTP_STATE), A, I]
|
|
13576
13581
|
});
|
|
13577
13582
|
return await addPublishWormholeMessage$1(
|
|
13578
13583
|
i,
|
|
13579
|
-
|
|
13584
|
+
C,
|
|
13580
13585
|
r,
|
|
13581
13586
|
BigInt(e.bridgeFee),
|
|
13582
13587
|
t,
|
|
@@ -13609,10 +13614,10 @@ function base(e) {
|
|
|
13609
13614
|
for (let c = 0; c < t.length; c++)
|
|
13610
13615
|
t[c] = 255;
|
|
13611
13616
|
for (let c = 0; c < e.length; c++) {
|
|
13612
|
-
const d = e.charAt(c),
|
|
13613
|
-
if (t[
|
|
13617
|
+
const d = e.charAt(c), p = d.charCodeAt(0);
|
|
13618
|
+
if (t[p] !== 255)
|
|
13614
13619
|
throw new TypeError(d + " is ambiguous");
|
|
13615
|
-
t[
|
|
13620
|
+
t[p] = c;
|
|
13616
13621
|
}
|
|
13617
13622
|
const n = e.length, a = e.charAt(0), r = Math.log(n) / Math.log(256), s = Math.log(256) / Math.log(n);
|
|
13618
13623
|
function u(c) {
|
|
@@ -13620,20 +13625,20 @@ function base(e) {
|
|
|
13620
13625
|
throw new TypeError("Expected Uint8Array");
|
|
13621
13626
|
if (c.length === 0)
|
|
13622
13627
|
return "";
|
|
13623
|
-
let d = 0,
|
|
13628
|
+
let d = 0, p = 0, b = 0;
|
|
13624
13629
|
const m = c.length;
|
|
13625
13630
|
for (; b !== m && c[b] === 0; )
|
|
13626
13631
|
b++, d++;
|
|
13627
13632
|
const f = (m - b) * s + 1 >>> 0, g = new Uint8Array(f);
|
|
13628
13633
|
for (; b !== m; ) {
|
|
13629
13634
|
let h = c[b], _ = 0;
|
|
13630
|
-
for (let
|
|
13631
|
-
h += 256 * g[
|
|
13635
|
+
for (let I = f - 1; (h !== 0 || _ < p) && I !== -1; I--, _++)
|
|
13636
|
+
h += 256 * g[I] >>> 0, g[I] = h % n >>> 0, h = h / n >>> 0;
|
|
13632
13637
|
if (h !== 0)
|
|
13633
13638
|
throw new Error("Non-zero carry");
|
|
13634
|
-
|
|
13639
|
+
p = _, b++;
|
|
13635
13640
|
}
|
|
13636
|
-
let T = f -
|
|
13641
|
+
let T = f - p;
|
|
13637
13642
|
for (; T !== f && g[T] === 0; )
|
|
13638
13643
|
T++;
|
|
13639
13644
|
let A = a.repeat(d);
|
|
@@ -13646,9 +13651,9 @@ function base(e) {
|
|
|
13646
13651
|
throw new TypeError("Expected String");
|
|
13647
13652
|
if (c.length === 0)
|
|
13648
13653
|
return new Uint8Array();
|
|
13649
|
-
let d = 0,
|
|
13654
|
+
let d = 0, p = 0, b = 0;
|
|
13650
13655
|
for (; c[d] === a; )
|
|
13651
|
-
|
|
13656
|
+
p++, d++;
|
|
13652
13657
|
const m = (c.length - d) * r + 1 >>> 0, f = new Uint8Array(m);
|
|
13653
13658
|
for (; d < c.length; ) {
|
|
13654
13659
|
const h = c.charCodeAt(d);
|
|
@@ -13657,18 +13662,18 @@ function base(e) {
|
|
|
13657
13662
|
let _ = t[h];
|
|
13658
13663
|
if (_ === 255)
|
|
13659
13664
|
return;
|
|
13660
|
-
let
|
|
13661
|
-
for (let
|
|
13662
|
-
_ += n * f[
|
|
13665
|
+
let I = 0;
|
|
13666
|
+
for (let C = m - 1; (_ !== 0 || I < b) && C !== -1; C--, I++)
|
|
13667
|
+
_ += n * f[C] >>> 0, f[C] = _ % 256 >>> 0, _ = _ / 256 >>> 0;
|
|
13663
13668
|
if (_ !== 0)
|
|
13664
13669
|
throw new Error("Non-zero carry");
|
|
13665
|
-
b =
|
|
13670
|
+
b = I, d++;
|
|
13666
13671
|
}
|
|
13667
13672
|
let g = m - b;
|
|
13668
13673
|
for (; g !== m && f[g] === 0; )
|
|
13669
13674
|
g++;
|
|
13670
|
-
const T = new Uint8Array(
|
|
13671
|
-
let A =
|
|
13675
|
+
const T = new Uint8Array(p + (m - g));
|
|
13676
|
+
let A = p;
|
|
13672
13677
|
for (; g !== m; )
|
|
13673
13678
|
T[A++] = f[g++];
|
|
13674
13679
|
return T;
|
|
@@ -13724,7 +13729,7 @@ function nativeAddressToHexString(e, t) {
|
|
|
13724
13729
|
}
|
|
13725
13730
|
function hexToUint8Array(e) {
|
|
13726
13731
|
return new Uint8Array(
|
|
13727
|
-
|
|
13732
|
+
bufferPolyfill.Buffer.from(
|
|
13728
13733
|
e.startsWith("0x") ? e.substring(2) : e,
|
|
13729
13734
|
"hex"
|
|
13730
13735
|
)
|
|
@@ -13786,7 +13791,7 @@ var MAX_U64 = BigInt(2) ** BigInt(64) - BigInt(1);
|
|
|
13786
13791
|
function getSafeU64Blob(e) {
|
|
13787
13792
|
if (e < BigInt(0) || e > MAX_U64)
|
|
13788
13793
|
throw new Error(`Invalid u64: ${e}`);
|
|
13789
|
-
const t =
|
|
13794
|
+
const t = bufferPolyfill.Buffer.alloc(8);
|
|
13790
13795
|
return t.writeBigUInt64LE(e), t;
|
|
13791
13796
|
}
|
|
13792
13797
|
var ZeroPermit = {
|
|
@@ -13797,7 +13802,7 @@ var ZeroPermit = {
|
|
|
13797
13802
|
s: `0x${SystemProgram.programId.toBuffer().toString("hex")}`
|
|
13798
13803
|
};
|
|
13799
13804
|
function getQuoteSuitableReferrerAddress(e, t) {
|
|
13800
|
-
return
|
|
13805
|
+
return null;
|
|
13801
13806
|
}
|
|
13802
13807
|
var MCTP_PAYLOAD_TYPE_DEFAULT = 1, MCTP_INIT_ORDER_PAYLOAD_ID = 1, FAST_MCTP_PAYLOAD_TYPE_DEFAULT = 1, FAST_MCTP_PAYLOAD_TYPE_ORDER = 3;
|
|
13803
13808
|
function toQueryString(e) {
|
|
@@ -16363,28 +16368,28 @@ function getCCTPDomain(e) {
|
|
|
16363
16368
|
}
|
|
16364
16369
|
function getCCTPBridgePDAs(e, t) {
|
|
16365
16370
|
const n = new PublicKey$1(addresses_default.CCTP_CORE_PROGRAM_ID), a = new PublicKey$1(addresses_default.CCTP_TOKEN_PROGRAM_ID), [r] = PublicKey$1.findProgramAddressSync(
|
|
16366
|
-
[
|
|
16371
|
+
[bufferPolyfill.Buffer.from("message_transmitter")],
|
|
16367
16372
|
n
|
|
16368
16373
|
), [s] = PublicKey$1.findProgramAddressSync(
|
|
16369
|
-
[
|
|
16374
|
+
[bufferPolyfill.Buffer.from("sender_authority")],
|
|
16370
16375
|
a
|
|
16371
16376
|
), [u] = PublicKey$1.findProgramAddressSync(
|
|
16372
|
-
[
|
|
16377
|
+
[bufferPolyfill.Buffer.from("local_token"), e.toBytes()],
|
|
16373
16378
|
a
|
|
16374
16379
|
), [i] = PublicKey$1.findProgramAddressSync(
|
|
16375
|
-
[
|
|
16380
|
+
[bufferPolyfill.Buffer.from("token_messenger")],
|
|
16376
16381
|
a
|
|
16377
16382
|
), [l] = PublicKey$1.findProgramAddressSync(
|
|
16378
|
-
[
|
|
16383
|
+
[bufferPolyfill.Buffer.from("token_minter")],
|
|
16379
16384
|
a
|
|
16380
16385
|
), c = getCCTPDomain(t), [d] = PublicKey$1.findProgramAddressSync(
|
|
16381
|
-
[
|
|
16386
|
+
[bufferPolyfill.Buffer.from("remote_token_messenger"), bufferPolyfill.Buffer.from(c.toString())],
|
|
16382
16387
|
a
|
|
16383
|
-
), [
|
|
16384
|
-
[
|
|
16388
|
+
), [p] = PublicKey$1.findProgramAddressSync(
|
|
16389
|
+
[bufferPolyfill.Buffer.from("__event_authority")],
|
|
16385
16390
|
n
|
|
16386
16391
|
), [b] = PublicKey$1.findProgramAddressSync(
|
|
16387
|
-
[
|
|
16392
|
+
[bufferPolyfill.Buffer.from("__event_authority")],
|
|
16388
16393
|
a
|
|
16389
16394
|
);
|
|
16390
16395
|
return {
|
|
@@ -16394,7 +16399,7 @@ function getCCTPBridgePDAs(e, t) {
|
|
|
16394
16399
|
tokenMessenger: i,
|
|
16395
16400
|
tokenMinter: l,
|
|
16396
16401
|
eventAuthToken: b,
|
|
16397
|
-
eventAuthCore:
|
|
16402
|
+
eventAuthCore: p,
|
|
16398
16403
|
localToken: u
|
|
16399
16404
|
};
|
|
16400
16405
|
}
|
|
@@ -16402,7 +16407,7 @@ function getEvmMctpBridgeParams(e, t, n, a) {
|
|
|
16402
16407
|
const r = getWormholeChainIdById(Number(n)), s = getWormholeChainIdByName(e.fromChain), u = getWormholeChainIdByName(e.toChain);
|
|
16403
16408
|
if (s !== r)
|
|
16404
16409
|
throw new Error(`Signer chain id(${Number(n)}) and quote from chain are not same! ${s} !== ${r}`);
|
|
16405
|
-
const i = e.cheaperChain === e.fromChain, l = nativeAddressToHexString(t, u), c = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS), d = getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8)),
|
|
16410
|
+
const i = e.cheaperChain === e.fromChain, l = nativeAddressToHexString(t, u), c = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS), d = getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8)), p = BigInt(e.effectiveAmountIn64), b = getCCTPDomain(e.toChain);
|
|
16406
16411
|
if (!e.mctpMayanContract)
|
|
16407
16412
|
throw new Error("MCTP contract address is missing");
|
|
16408
16413
|
const m = e.mctpMayanContract;
|
|
@@ -16415,7 +16420,7 @@ function getEvmMctpBridgeParams(e, t, n, a) {
|
|
|
16415
16420
|
return i && (f = BigInt(0)), {
|
|
16416
16421
|
lockFee: i,
|
|
16417
16422
|
tokenIn: e.mctpInputContract,
|
|
16418
|
-
amountIn:
|
|
16423
|
+
amountIn: p,
|
|
16419
16424
|
redeemFee: c,
|
|
16420
16425
|
gasDrop: d,
|
|
16421
16426
|
destAddr: l,
|
|
@@ -16438,7 +16443,7 @@ function getEvmMctpBridgeTxPayload(e, t, n, a) {
|
|
|
16438
16443
|
destAddr: l,
|
|
16439
16444
|
lockFee: c,
|
|
16440
16445
|
redeemFee: d,
|
|
16441
|
-
gasDrop:
|
|
16446
|
+
gasDrop: p,
|
|
16442
16447
|
destDomain: b,
|
|
16443
16448
|
customPayload: m,
|
|
16444
16449
|
payloadType: f,
|
|
@@ -16447,10 +16452,10 @@ function getEvmMctpBridgeTxPayload(e, t, n, a) {
|
|
|
16447
16452
|
let A, h;
|
|
16448
16453
|
return c ? A = T.interface.encodeFunctionData(
|
|
16449
16454
|
"bridgeWithLockedFee",
|
|
16450
|
-
[u, i,
|
|
16455
|
+
[u, i, p, d, b, l]
|
|
16451
16456
|
) : A = T.interface.encodeFunctionData(
|
|
16452
16457
|
"bridgeWithFee",
|
|
16453
|
-
[u, i, d,
|
|
16458
|
+
[u, i, d, p, l, b, f, m]
|
|
16454
16459
|
), h = toBeHex(g), {
|
|
16455
16460
|
to: s,
|
|
16456
16461
|
data: A,
|
|
@@ -16473,7 +16478,7 @@ function getEvmMctpCreateOrderParams(e, t, n, a) {
|
|
|
16473
16478
|
SystemProgram.programId.toString(),
|
|
16474
16479
|
getWormholeChainIdByName("solana")
|
|
16475
16480
|
);
|
|
16476
|
-
const d = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS),
|
|
16481
|
+
const d = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS), p = getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8));
|
|
16477
16482
|
let b = BigInt(e.effectiveAmountIn64);
|
|
16478
16483
|
const m = getAmountOfFractionalAmount(
|
|
16479
16484
|
e.minAmountOut,
|
|
@@ -16486,7 +16491,7 @@ function getEvmMctpCreateOrderParams(e, t, n, a) {
|
|
|
16486
16491
|
params: {
|
|
16487
16492
|
tokenIn: e.mctpInputContract,
|
|
16488
16493
|
amountIn: b,
|
|
16489
|
-
gasDrop:
|
|
16494
|
+
gasDrop: p,
|
|
16490
16495
|
destAddr: l,
|
|
16491
16496
|
destChain: u,
|
|
16492
16497
|
tokenOut: g,
|
|
@@ -16541,7 +16546,7 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16541
16546
|
t,
|
|
16542
16547
|
n,
|
|
16543
16548
|
a
|
|
16544
|
-
),
|
|
16549
|
+
), p = "forwardERC20", b = [
|
|
16545
16550
|
e.fromToken.contract,
|
|
16546
16551
|
d._params.params.amountIn,
|
|
16547
16552
|
u,
|
|
@@ -16549,12 +16554,12 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16549
16554
|
d.data
|
|
16550
16555
|
];
|
|
16551
16556
|
return {
|
|
16552
|
-
data: i.interface.encodeFunctionData(
|
|
16557
|
+
data: i.interface.encodeFunctionData(p, b),
|
|
16553
16558
|
to: addresses_default.MAYAN_FORWARDER_CONTRACT,
|
|
16554
16559
|
value: toBeHex(c),
|
|
16555
16560
|
chainId: a,
|
|
16556
16561
|
_forwarder: {
|
|
16557
|
-
method:
|
|
16562
|
+
method: p,
|
|
16558
16563
|
params: b
|
|
16559
16564
|
}
|
|
16560
16565
|
};
|
|
@@ -16563,7 +16568,7 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16563
16568
|
e,
|
|
16564
16569
|
t,
|
|
16565
16570
|
a
|
|
16566
|
-
),
|
|
16571
|
+
), p = "forwardERC20", b = [
|
|
16567
16572
|
e.fromToken.contract,
|
|
16568
16573
|
d._params.amountIn,
|
|
16569
16574
|
u,
|
|
@@ -16571,19 +16576,19 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16571
16576
|
d.data
|
|
16572
16577
|
];
|
|
16573
16578
|
return {
|
|
16574
|
-
data: i.interface.encodeFunctionData(
|
|
16579
|
+
data: i.interface.encodeFunctionData(p, b),
|
|
16575
16580
|
to: addresses_default.MAYAN_FORWARDER_CONTRACT,
|
|
16576
16581
|
value: toBeHex(c),
|
|
16577
16582
|
chainId: a,
|
|
16578
16583
|
_forwarder: {
|
|
16579
|
-
method:
|
|
16584
|
+
method: p,
|
|
16580
16585
|
params: b
|
|
16581
16586
|
}
|
|
16582
16587
|
};
|
|
16583
16588
|
}
|
|
16584
16589
|
else {
|
|
16585
|
-
const { minMiddleAmount: d, evmSwapRouterAddress:
|
|
16586
|
-
if (!d || !
|
|
16590
|
+
const { minMiddleAmount: d, evmSwapRouterAddress: p, evmSwapRouterCalldata: b } = e;
|
|
16591
|
+
if (!d || !p || !b)
|
|
16587
16592
|
throw new Error("MCTP swap requires middle amount, router address and calldata");
|
|
16588
16593
|
if (e.hasAuction) {
|
|
16589
16594
|
if (!Number(e.deadline64))
|
|
@@ -16601,7 +16606,7 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16601
16606
|
l !== BigInt(0) && (g -= l), c = toBeHex(m._params.params.amountIn);
|
|
16602
16607
|
const T = "swapAndForwardEth", A = [
|
|
16603
16608
|
g,
|
|
16604
|
-
|
|
16609
|
+
p,
|
|
16605
16610
|
b,
|
|
16606
16611
|
e.mctpInputContract,
|
|
16607
16612
|
f,
|
|
@@ -16623,7 +16628,7 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16623
16628
|
e.fromToken.contract,
|
|
16624
16629
|
m._params.params.amountIn,
|
|
16625
16630
|
u,
|
|
16626
|
-
|
|
16631
|
+
p,
|
|
16627
16632
|
b,
|
|
16628
16633
|
e.mctpInputContract,
|
|
16629
16634
|
f,
|
|
@@ -16654,7 +16659,7 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16654
16659
|
l !== BigInt(0) && (g -= l), c = toBeHex(m._params.amountIn);
|
|
16655
16660
|
const T = "swapAndForwardEth", A = [
|
|
16656
16661
|
g,
|
|
16657
|
-
|
|
16662
|
+
p,
|
|
16658
16663
|
b,
|
|
16659
16664
|
e.mctpInputContract,
|
|
16660
16665
|
f,
|
|
@@ -16676,7 +16681,7 @@ function getMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
16676
16681
|
e.fromToken.contract,
|
|
16677
16682
|
m._params.amountIn,
|
|
16678
16683
|
u,
|
|
16679
|
-
|
|
16684
|
+
p,
|
|
16680
16685
|
b,
|
|
16681
16686
|
e.mctpInputContract,
|
|
16682
16687
|
f,
|
|
@@ -18007,7 +18012,7 @@ function createAssociatedTokenAccountInstruction(e, t, n, a, r = new PublicKey$1
|
|
|
18007
18012
|
return new TransactionInstruction({
|
|
18008
18013
|
keys: u,
|
|
18009
18014
|
programId: s,
|
|
18010
|
-
data:
|
|
18015
|
+
data: bufferPolyfill.Buffer.alloc(0)
|
|
18011
18016
|
});
|
|
18012
18017
|
}
|
|
18013
18018
|
var TOKEN_ACCOUNT_LEN = 165;
|
|
@@ -18027,7 +18032,7 @@ async function createInitializeRandomTokenAccountInstructions(e, t, n, a, r, s =
|
|
|
18027
18032
|
{ pubkey: SYSVAR_RENT_PUBKEY, isWritable: !1, isSigner: !1 }
|
|
18028
18033
|
],
|
|
18029
18034
|
programId: s,
|
|
18030
|
-
data:
|
|
18035
|
+
data: bufferPolyfill.Buffer.from([1])
|
|
18031
18036
|
})), u;
|
|
18032
18037
|
}
|
|
18033
18038
|
var ApproveInstructionData = struct([
|
|
@@ -18039,7 +18044,7 @@ function createApproveInstruction(e, t, n, a, r = new PublicKey$1(addresses_defa
|
|
|
18039
18044
|
{ pubkey: e, isSigner: !1, isWritable: !0 },
|
|
18040
18045
|
{ pubkey: t, isSigner: !1, isWritable: !1 },
|
|
18041
18046
|
{ pubkey: n, isSigner: !0, isWritable: !1 }
|
|
18042
|
-
], u =
|
|
18047
|
+
], u = bufferPolyfill.Buffer.alloc(ApproveInstructionData.span);
|
|
18043
18048
|
return ApproveInstructionData.encode(
|
|
18044
18049
|
{
|
|
18045
18050
|
instruction: 4,
|
|
@@ -18050,7 +18055,7 @@ function createApproveInstruction(e, t, n, a, r = new PublicKey$1(addresses_defa
|
|
|
18050
18055
|
}
|
|
18051
18056
|
var SyncNativeInstructionData = struct([u8("instruction")]);
|
|
18052
18057
|
function createSyncNativeInstruction(e) {
|
|
18053
|
-
const t = [{ pubkey: e, isSigner: !1, isWritable: !0 }], n =
|
|
18058
|
+
const t = [{ pubkey: e, isSigner: !1, isWritable: !0 }], n = bufferPolyfill.Buffer.alloc(SyncNativeInstructionData.span);
|
|
18054
18059
|
return SyncNativeInstructionData.encode({ instruction: 17 }, n), new TransactionInstruction({
|
|
18055
18060
|
keys: t,
|
|
18056
18061
|
programId: new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID),
|
|
@@ -18069,7 +18074,7 @@ function createSplTransferInstruction(e, t, n, a, r = new PublicKey$1(addresses_
|
|
|
18069
18074
|
{ pubkey: e, isSigner: !1, isWritable: !0 },
|
|
18070
18075
|
{ pubkey: t, isSigner: !1, isWritable: !0 },
|
|
18071
18076
|
{ pubkey: n, isSigner: !0, isWritable: !1 }
|
|
18072
|
-
], u =
|
|
18077
|
+
], u = bufferPolyfill.Buffer.alloc(SplTransferInstructionData.span);
|
|
18073
18078
|
return SplTransferInstructionData.encode(
|
|
18074
18079
|
{
|
|
18075
18080
|
instruction: 3,
|
|
@@ -18087,7 +18092,7 @@ function deserializeInstructionInfo(e) {
|
|
|
18087
18092
|
isSigner: t.isSigner,
|
|
18088
18093
|
isWritable: t.isWritable
|
|
18089
18094
|
})),
|
|
18090
|
-
data:
|
|
18095
|
+
data: bufferPolyfill.Buffer.from(e.data, "base64")
|
|
18091
18096
|
});
|
|
18092
18097
|
}
|
|
18093
18098
|
async function getAddressLookupTableAccounts(e, t) {
|
|
@@ -18117,7 +18122,7 @@ function decentralizeClientSwapInstructions(e, t) {
|
|
|
18117
18122
|
}
|
|
18118
18123
|
function getAnchorInstructionData(e) {
|
|
18119
18124
|
let t = `global:${e}`;
|
|
18120
|
-
return
|
|
18125
|
+
return bufferPolyfill.Buffer.from(sha256Exports.sha256.digest(t)).subarray(0, 8);
|
|
18121
18126
|
}
|
|
18122
18127
|
async function decideRelayer() {
|
|
18123
18128
|
let e;
|
|
@@ -18204,16 +18209,16 @@ function createTransferAllAndCloseInstruction(e, t, n, a, r, s = new PublicKey$1
|
|
|
18204
18209
|
}
|
|
18205
18210
|
function getWormholePDAs(e) {
|
|
18206
18211
|
const t = new PublicKey$1(addresses_default.WORMHOLE_PROGRAM_ID), n = new PublicKey$1(e), [a] = PublicKey$1.findProgramAddressSync(
|
|
18207
|
-
[
|
|
18212
|
+
[bufferPolyfill.Buffer.from("Bridge")],
|
|
18208
18213
|
t
|
|
18209
18214
|
), [r] = PublicKey$1.findProgramAddressSync(
|
|
18210
|
-
[
|
|
18215
|
+
[bufferPolyfill.Buffer.from("emitter")],
|
|
18211
18216
|
n
|
|
18212
18217
|
), [s] = PublicKey$1.findProgramAddressSync(
|
|
18213
|
-
[
|
|
18218
|
+
[bufferPolyfill.Buffer.from("Sequence"), r.toBuffer()],
|
|
18214
18219
|
t
|
|
18215
18220
|
), [u] = PublicKey$1.findProgramAddressSync(
|
|
18216
|
-
[
|
|
18221
|
+
[bufferPolyfill.Buffer.from("fee_collector")],
|
|
18217
18222
|
t
|
|
18218
18223
|
);
|
|
18219
18224
|
return {
|
|
@@ -18227,19 +18232,19 @@ var MCTPBridgeWithFeeLayout = struct([
|
|
|
18227
18232
|
blob(8, "instruction")
|
|
18228
18233
|
]);
|
|
18229
18234
|
function createMctpBridgeWithFeeInstruction(e, t, n, a, r) {
|
|
18230
|
-
const s = new PublicKey$1(addresses_default.WORMHOLE_PROGRAM_ID), u = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default.CCTP_CORE_PROGRAM_ID), l = new PublicKey$1(addresses_default.CCTP_TOKEN_PROGRAM_ID), c = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID), d = new PublicKey$1(a),
|
|
18231
|
-
|
|
18235
|
+
const s = new PublicKey$1(addresses_default.WORMHOLE_PROGRAM_ID), u = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default.CCTP_CORE_PROGRAM_ID), l = new PublicKey$1(addresses_default.CCTP_TOKEN_PROGRAM_ID), c = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID), d = new PublicKey$1(a), p = new PublicKey$1(n), b = getAssociatedTokenAddress(
|
|
18236
|
+
p,
|
|
18232
18237
|
e,
|
|
18233
18238
|
!0
|
|
18234
18239
|
);
|
|
18235
18240
|
let m;
|
|
18236
|
-
r && r > BigInt(0) ? m = getAssociatedTokenAddress(
|
|
18237
|
-
const f = getCCTPBridgePDAs(
|
|
18241
|
+
r && r > BigInt(0) ? m = getAssociatedTokenAddress(p, d, !1) : m = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID);
|
|
18242
|
+
const f = getCCTPBridgePDAs(p, t), g = getWormholePDAs(addresses_default.MCTP_PROGRAM_ID), T = Keypair.generate(), A = Keypair.generate(), h = [
|
|
18238
18243
|
{ pubkey: e, isWritable: !0, isSigner: !1 },
|
|
18239
18244
|
{ pubkey: b, isWritable: !0, isSigner: !1 },
|
|
18240
18245
|
{ pubkey: d, isWritable: !0, isSigner: !0 },
|
|
18241
18246
|
{ pubkey: m, isWritable: !0, isSigner: !1 },
|
|
18242
|
-
{ pubkey:
|
|
18247
|
+
{ pubkey: p, isWritable: !0, isSigner: !1 },
|
|
18243
18248
|
{ pubkey: f.senderAuthority, isWritable: !1, isSigner: !1 },
|
|
18244
18249
|
{ pubkey: f.tokenMessenger, isWritable: !1, isSigner: !1 },
|
|
18245
18250
|
{ pubkey: f.remoteTokenMessengerKey, isWritable: !1, isSigner: !1 },
|
|
@@ -18260,7 +18265,7 @@ function createMctpBridgeWithFeeInstruction(e, t, n, a, r) {
|
|
|
18260
18265
|
{ pubkey: SYSVAR_RENT_PUBKEY, isWritable: !1, isSigner: !1 },
|
|
18261
18266
|
{ pubkey: u, isWritable: !1, isSigner: !1 },
|
|
18262
18267
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
18263
|
-
], _ =
|
|
18268
|
+
], _ = bufferPolyfill.Buffer.alloc(MCTPBridgeWithFeeLayout.span);
|
|
18264
18269
|
return MCTPBridgeWithFeeLayout.encode(
|
|
18265
18270
|
{
|
|
18266
18271
|
instruction: getAnchorInstructionData("bridge_with_fee")
|
|
@@ -18276,23 +18281,23 @@ var MctpBridgeLockFeeLayout = struct([
|
|
|
18276
18281
|
blob(8, "instruction")
|
|
18277
18282
|
]);
|
|
18278
18283
|
function createMctpBridgeLockFeeInstruction(e, t, n, a, r) {
|
|
18279
|
-
const s = [], u = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default.ASSOCIATED_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default.CCTP_CORE_PROGRAM_ID), c = new PublicKey$1(addresses_default.CCTP_TOKEN_PROGRAM_ID), d = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID),
|
|
18284
|
+
const s = [], u = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), i = new PublicKey$1(addresses_default.ASSOCIATED_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default.CCTP_CORE_PROGRAM_ID), c = new PublicKey$1(addresses_default.CCTP_TOKEN_PROGRAM_ID), d = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID), p = new PublicKey$1(a), b = new PublicKey$1(n), m = getAssociatedTokenAddress(
|
|
18280
18285
|
b,
|
|
18281
18286
|
e,
|
|
18282
18287
|
!0
|
|
18283
18288
|
), f = getCCTPBridgePDAs(b, t), g = Keypair.generate(), [T] = PublicKey$1.findProgramAddressSync(
|
|
18284
|
-
[
|
|
18289
|
+
[bufferPolyfill.Buffer.from("LOCKED_FEE"), b.toBuffer(), g.publicKey.toBytes()],
|
|
18285
18290
|
d
|
|
18286
18291
|
);
|
|
18287
18292
|
let A;
|
|
18288
|
-
r && r > BigInt(0) ? A = getAssociatedTokenAddress(b,
|
|
18293
|
+
r && r > BigInt(0) ? A = getAssociatedTokenAddress(b, p, !1) : A = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID);
|
|
18289
18294
|
const h = getAssociatedTokenAddress(
|
|
18290
18295
|
b,
|
|
18291
18296
|
T,
|
|
18292
18297
|
!0
|
|
18293
18298
|
);
|
|
18294
18299
|
s.push(createAssociatedTokenAccountInstruction(
|
|
18295
|
-
|
|
18300
|
+
p,
|
|
18296
18301
|
h,
|
|
18297
18302
|
T,
|
|
18298
18303
|
b
|
|
@@ -18300,7 +18305,7 @@ function createMctpBridgeLockFeeInstruction(e, t, n, a, r) {
|
|
|
18300
18305
|
const _ = [
|
|
18301
18306
|
{ pubkey: e, isWritable: !0, isSigner: !1 },
|
|
18302
18307
|
{ pubkey: m, isWritable: !0, isSigner: !1 },
|
|
18303
|
-
{ pubkey:
|
|
18308
|
+
{ pubkey: p, isWritable: !0, isSigner: !0 },
|
|
18304
18309
|
{ pubkey: A, isWritable: !0, isSigner: !1 },
|
|
18305
18310
|
{ pubkey: T, isWritable: !0, isSigner: !1 },
|
|
18306
18311
|
{ pubkey: h, isWritable: !0, isSigner: !1 },
|
|
@@ -18318,37 +18323,37 @@ function createMctpBridgeLockFeeInstruction(e, t, n, a, r) {
|
|
|
18318
18323
|
{ pubkey: u, isWritable: !1, isSigner: !1 },
|
|
18319
18324
|
{ pubkey: i, isWritable: !1, isSigner: !1 },
|
|
18320
18325
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
18321
|
-
],
|
|
18326
|
+
], I = bufferPolyfill.Buffer.alloc(MctpBridgeLockFeeLayout.span);
|
|
18322
18327
|
MctpBridgeLockFeeLayout.encode(
|
|
18323
18328
|
{
|
|
18324
18329
|
instruction: getAnchorInstructionData("bridge_locked_fee")
|
|
18325
18330
|
},
|
|
18326
|
-
|
|
18331
|
+
I
|
|
18327
18332
|
);
|
|
18328
|
-
const
|
|
18333
|
+
const C = new TransactionInstruction({
|
|
18329
18334
|
keys: _,
|
|
18330
|
-
data:
|
|
18335
|
+
data: I,
|
|
18331
18336
|
programId: d
|
|
18332
18337
|
});
|
|
18333
|
-
return s.push(
|
|
18338
|
+
return s.push(C), { instructions: s, signer: g };
|
|
18334
18339
|
}
|
|
18335
18340
|
var MctpInitSwapLayout = struct([
|
|
18336
18341
|
blob(8, "instruction")
|
|
18337
18342
|
]);
|
|
18338
18343
|
function createMctpInitSwapInstruction(e, t, n, a, r) {
|
|
18339
|
-
const s = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), u = new PublicKey$1(addresses_default.CCTP_CORE_PROGRAM_ID), i = new PublicKey$1(addresses_default.CCTP_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID), c = new PublicKey$1(a), d = new PublicKey$1(n),
|
|
18344
|
+
const s = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), u = new PublicKey$1(addresses_default.CCTP_CORE_PROGRAM_ID), i = new PublicKey$1(addresses_default.CCTP_TOKEN_PROGRAM_ID), l = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID), c = new PublicKey$1(a), d = new PublicKey$1(n), p = getAssociatedTokenAddress(
|
|
18340
18345
|
d,
|
|
18341
18346
|
e,
|
|
18342
18347
|
!0
|
|
18343
18348
|
), b = getCCTPBridgePDAs(d, t), m = Keypair.generate(), [f] = PublicKey$1.findProgramAddressSync(
|
|
18344
|
-
[
|
|
18349
|
+
[bufferPolyfill.Buffer.from("ORDER_SOLANA_SOURCE"), e.toBuffer()],
|
|
18345
18350
|
l
|
|
18346
18351
|
);
|
|
18347
18352
|
let g;
|
|
18348
18353
|
r && r > BigInt(0) ? g = getAssociatedTokenAddress(d, c, !1) : g = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID);
|
|
18349
18354
|
const T = [
|
|
18350
18355
|
{ pubkey: e, isWritable: !1, isSigner: !1 },
|
|
18351
|
-
{ pubkey:
|
|
18356
|
+
{ pubkey: p, isWritable: !0, isSigner: !1 },
|
|
18352
18357
|
{ pubkey: c, isWritable: !0, isSigner: !0 },
|
|
18353
18358
|
{ pubkey: g, isWritable: !0, isSigner: !1 },
|
|
18354
18359
|
{ pubkey: d, isWritable: !0, isSigner: !1 },
|
|
@@ -18366,7 +18371,7 @@ function createMctpInitSwapInstruction(e, t, n, a, r) {
|
|
|
18366
18371
|
{ pubkey: new PublicKey$1(addresses_default.FEE_MANAGER_PROGRAM_ID), isWritable: !1, isSigner: !1 },
|
|
18367
18372
|
{ pubkey: s, isWritable: !1, isSigner: !1 },
|
|
18368
18373
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
18369
|
-
], A =
|
|
18374
|
+
], A = bufferPolyfill.Buffer.alloc(MctpInitSwapLayout.span);
|
|
18370
18375
|
return MctpInitSwapLayout.encode(
|
|
18371
18376
|
{
|
|
18372
18377
|
instruction: getAnchorInstructionData("create_order")
|
|
@@ -18392,7 +18397,7 @@ var MctpBridgeLedgerLayout = struct([
|
|
|
18392
18397
|
function createMctpBridgeLedgerInstruction(e) {
|
|
18393
18398
|
if (e.mode !== "WITH_FEE" && e.mode !== "LOCK_FEE")
|
|
18394
18399
|
throw new Error("Invalid mode: " + e.mode);
|
|
18395
|
-
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress(n, e.ledger, !0), r = getWormholeChainIdByName(e.toChain), s =
|
|
18400
|
+
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress(n, e.ledger, !0), r = getWormholeChainIdByName(e.toChain), s = bufferPolyfill.Buffer.from(
|
|
18396
18401
|
hexToUint8Array(
|
|
18397
18402
|
nativeAddressToHexString(e.destinationAddress, r)
|
|
18398
18403
|
)
|
|
@@ -18400,9 +18405,9 @@ function createMctpBridgeLedgerInstruction(e) {
|
|
|
18400
18405
|
getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8))
|
|
18401
18406
|
), l = getSafeU64Blob(
|
|
18402
18407
|
getAmountOfFractionalAmount(e.feeRedeem, CCTP_TOKEN_DECIMALS)
|
|
18403
|
-
), c = getSafeU64Blob(e.feeSolana), d = e.referrerAddress ?
|
|
18408
|
+
), c = getSafeU64Blob(e.feeSolana), d = e.referrerAddress ? bufferPolyfill.Buffer.from(hexToUint8Array(
|
|
18404
18409
|
nativeAddressToHexString(e.referrerAddress, r)
|
|
18405
|
-
)) : SystemProgram.programId.toBuffer(),
|
|
18410
|
+
)) : SystemProgram.programId.toBuffer(), p = [
|
|
18406
18411
|
{ pubkey: t, isWritable: !0, isSigner: !0 },
|
|
18407
18412
|
{ pubkey: e.ledger, isWritable: !0, isSigner: !1 },
|
|
18408
18413
|
{ pubkey: a, isWritable: !1, isSigner: !1 },
|
|
@@ -18410,7 +18415,7 @@ function createMctpBridgeLedgerInstruction(e) {
|
|
|
18410
18415
|
{ pubkey: n, isWritable: !1, isSigner: !1 },
|
|
18411
18416
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 },
|
|
18412
18417
|
{ pubkey: new PublicKey$1(d), isWritable: !1, isSigner: !1 }
|
|
18413
|
-
], b =
|
|
18418
|
+
], b = bufferPolyfill.Buffer.alloc(MctpBridgeLedgerLayout.span);
|
|
18414
18419
|
return MctpBridgeLedgerLayout.encode(
|
|
18415
18420
|
{
|
|
18416
18421
|
instruction: getAnchorInstructionData("init_bridge_ledger"),
|
|
@@ -18425,7 +18430,7 @@ function createMctpBridgeLedgerInstruction(e) {
|
|
|
18425
18430
|
},
|
|
18426
18431
|
b
|
|
18427
18432
|
), new TransactionInstruction({
|
|
18428
|
-
keys:
|
|
18433
|
+
keys: p,
|
|
18429
18434
|
data: b,
|
|
18430
18435
|
programId: new PublicKey$1(addresses_default.MCTP_PROGRAM_ID)
|
|
18431
18436
|
});
|
|
@@ -18447,7 +18452,7 @@ var MctpSwapLedgerLayout = struct([
|
|
|
18447
18452
|
u8("feeRateRef")
|
|
18448
18453
|
]);
|
|
18449
18454
|
function createMctpSwapLedgerInstruction(e) {
|
|
18450
|
-
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress(n, e.ledger, !0), r = getWormholeChainIdByName(e.toChain), s =
|
|
18455
|
+
const t = new PublicKey$1(e.swapperAddress), n = new PublicKey$1(e.mintAddress), a = getAssociatedTokenAddress(n, e.ledger, !0), r = getWormholeChainIdByName(e.toChain), s = bufferPolyfill.Buffer.from(
|
|
18451
18456
|
hexToUint8Array(
|
|
18452
18457
|
nativeAddressToHexString(e.destinationAddress, r)
|
|
18453
18458
|
)
|
|
@@ -18455,9 +18460,9 @@ function createMctpSwapLedgerInstruction(e) {
|
|
|
18455
18460
|
getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8))
|
|
18456
18461
|
), l = getSafeU64Blob(
|
|
18457
18462
|
getAmountOfFractionalAmount(e.feeRedeem, CCTP_TOKEN_DECIMALS)
|
|
18458
|
-
), c = getSafeU64Blob(e.feeSolana), d =
|
|
18463
|
+
), c = getSafeU64Blob(e.feeSolana), d = bufferPolyfill.Buffer.from(hexToUint8Array(
|
|
18459
18464
|
nativeAddressToHexString(e.tokenOut, r)
|
|
18460
|
-
)),
|
|
18465
|
+
)), p = e.referrerAddress ? bufferPolyfill.Buffer.from(hexToUint8Array(
|
|
18461
18466
|
nativeAddressToHexString(e.referrerAddress, r)
|
|
18462
18467
|
)) : SystemProgram.programId.toBuffer(), b = getSafeU64Blob(
|
|
18463
18468
|
getAmountOfFractionalAmount(e.amountOutMin, Math.min(8, e.tokenOutDecimals))
|
|
@@ -18467,7 +18472,7 @@ function createMctpSwapLedgerInstruction(e) {
|
|
|
18467
18472
|
{ pubkey: a, isWritable: !1, isSigner: !1 },
|
|
18468
18473
|
{ pubkey: n, isWritable: !1, isSigner: !1 },
|
|
18469
18474
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
18470
|
-
], g =
|
|
18475
|
+
], g = bufferPolyfill.Buffer.alloc(MctpSwapLedgerLayout.span);
|
|
18471
18476
|
return MctpSwapLedgerLayout.encode(
|
|
18472
18477
|
{
|
|
18473
18478
|
instruction: getAnchorInstructionData("init_order_ledger"),
|
|
@@ -18480,7 +18485,7 @@ function createMctpSwapLedgerInstruction(e) {
|
|
|
18480
18485
|
keyRnd: e.randomKey.toBuffer(),
|
|
18481
18486
|
mode: 3,
|
|
18482
18487
|
tokenOut: d,
|
|
18483
|
-
refAddress:
|
|
18488
|
+
refAddress: p,
|
|
18484
18489
|
amountOutMin: b,
|
|
18485
18490
|
deadline: m,
|
|
18486
18491
|
feeRateRef: e.feeRateRef
|
|
@@ -18496,19 +18501,19 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18496
18501
|
const u = (s == null ? void 0 : s.forceSkipCctpInstructions) || !1, i = (s == null ? void 0 : s.allowSwapperOffCurve) || !1;
|
|
18497
18502
|
if (e.toChain === "solana")
|
|
18498
18503
|
throw new Error("Unsupported destination chain: " + e.toChain);
|
|
18499
|
-
let l = [], c = [], d = [],
|
|
18504
|
+
let l = [], c = [], d = [], p = [], b = [], m = [], f = [];
|
|
18500
18505
|
const g = Keypair.generate();
|
|
18501
18506
|
let T = null;
|
|
18502
18507
|
l.push(addresses_default.LOOKUP_TABLE);
|
|
18503
|
-
const A = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID), h = new PublicKey$1(t), _ = Keypair.generate(),
|
|
18508
|
+
const A = new PublicKey$1(addresses_default.MCTP_PROGRAM_ID), h = new PublicKey$1(t), _ = Keypair.generate(), I = e.deadline64 ? BigInt(e.deadline64) : BigInt(0);
|
|
18504
18509
|
if (e.hasAuction && !Number(e.deadline64))
|
|
18505
18510
|
throw new Error("Swap mode requires a timeout");
|
|
18506
|
-
const
|
|
18507
|
-
[
|
|
18511
|
+
const C = e.hasAuction ? "LEDGER_ORDER" : "LEDGER_BRIDGE", [E] = PublicKey$1.findProgramAddressSync(
|
|
18512
|
+
[bufferPolyfill.Buffer.from(C), h.toBytes(), _.publicKey.toBytes()],
|
|
18508
18513
|
A
|
|
18509
18514
|
), R = getAssociatedTokenAddress(
|
|
18510
18515
|
new PublicKey$1(e.mctpInputContract),
|
|
18511
|
-
|
|
18516
|
+
E,
|
|
18512
18517
|
!0
|
|
18513
18518
|
), $ = e.cheaperChain === "solana" ? "LOCK_FEE" : "WITH_FEE", N = e.toChain === "sui" ? e.toToken.verifiedAddress : e.toToken.contract;
|
|
18514
18519
|
if (e.fromToken.contract === e.mctpInputContract) {
|
|
@@ -18516,7 +18521,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18516
18521
|
if (e.suggestedPriorityFee > 0 && c.push(ComputeBudgetProgram.setComputeUnitPrice({
|
|
18517
18522
|
microLamports: e.suggestedPriorityFee
|
|
18518
18523
|
})), c.push(
|
|
18519
|
-
createAssociatedTokenAccountInstruction(h, R,
|
|
18524
|
+
createAssociatedTokenAccountInstruction(h, R, E, new PublicKey$1(e.mctpInputContract))
|
|
18520
18525
|
), c.push(
|
|
18521
18526
|
createSplTransferInstruction(
|
|
18522
18527
|
getAssociatedTokenAddress(
|
|
@@ -18530,7 +18535,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18530
18535
|
)
|
|
18531
18536
|
), e.hasAuction) {
|
|
18532
18537
|
if (c.push(createMctpSwapLedgerInstruction({
|
|
18533
|
-
ledger:
|
|
18538
|
+
ledger: E,
|
|
18534
18539
|
swapperAddress: t,
|
|
18535
18540
|
mintAddress: e.mctpInputContract,
|
|
18536
18541
|
randomKey: _.publicKey,
|
|
@@ -18544,14 +18549,14 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18544
18549
|
tokenOutDecimals: e.toToken.decimals,
|
|
18545
18550
|
referrerAddress: a,
|
|
18546
18551
|
amountOutMin: e.minAmountOut,
|
|
18547
|
-
deadline:
|
|
18552
|
+
deadline: I,
|
|
18548
18553
|
feeRateRef: e.referrerBps
|
|
18549
18554
|
})), !u) {
|
|
18550
18555
|
const {
|
|
18551
18556
|
instruction: v,
|
|
18552
18557
|
signer: U
|
|
18553
18558
|
} = createMctpInitSwapInstruction(
|
|
18554
|
-
|
|
18559
|
+
E,
|
|
18555
18560
|
e.toChain,
|
|
18556
18561
|
e.mctpInputContract,
|
|
18557
18562
|
t,
|
|
@@ -18560,7 +18565,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18560
18565
|
c.push(v), d.push(U);
|
|
18561
18566
|
}
|
|
18562
18567
|
} else if (c.push(createMctpBridgeLedgerInstruction({
|
|
18563
|
-
ledger:
|
|
18568
|
+
ledger: E,
|
|
18564
18569
|
swapperAddress: t,
|
|
18565
18570
|
mintAddress: e.mctpInputContract,
|
|
18566
18571
|
randomKey: _.publicKey,
|
|
@@ -18578,7 +18583,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18578
18583
|
instruction: v,
|
|
18579
18584
|
signers: U
|
|
18580
18585
|
} = createMctpBridgeWithFeeInstruction(
|
|
18581
|
-
|
|
18586
|
+
E,
|
|
18582
18587
|
e.toChain,
|
|
18583
18588
|
e.mctpInputContract,
|
|
18584
18589
|
t,
|
|
@@ -18590,7 +18595,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18590
18595
|
instructions: v,
|
|
18591
18596
|
signer: U
|
|
18592
18597
|
} = createMctpBridgeLockFeeInstruction(
|
|
18593
|
-
|
|
18598
|
+
E,
|
|
18594
18599
|
e.toChain,
|
|
18595
18600
|
e.mctpInputContract,
|
|
18596
18601
|
t,
|
|
@@ -18603,7 +18608,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18603
18608
|
minMiddleAmount: e.minMiddleAmount,
|
|
18604
18609
|
middleToken: e.mctpInputContract,
|
|
18605
18610
|
userWallet: t,
|
|
18606
|
-
userLedger:
|
|
18611
|
+
userLedger: E.toString(),
|
|
18607
18612
|
slippageBps: e.slippageBps,
|
|
18608
18613
|
fromToken: e.fromToken.contract,
|
|
18609
18614
|
amountIn64: e.effectiveAmountIn64,
|
|
@@ -18620,7 +18625,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18620
18625
|
), m.push(...v.computeBudgetInstructions), v.setupInstructions && m.push(...v.setupInstructions), m.push(v.swapInstruction), v.cleanupInstruction && m.push(v.cleanupInstruction), b.push(...v.addressLookupTableAddresses), c.push(createAssociatedTokenAccountInstruction(
|
|
18621
18626
|
h,
|
|
18622
18627
|
R,
|
|
18623
|
-
|
|
18628
|
+
E,
|
|
18624
18629
|
new PublicKey$1(e.mctpInputContract)
|
|
18625
18630
|
)), c.push(createTransferAllAndCloseInstruction(
|
|
18626
18631
|
h,
|
|
@@ -18632,7 +18637,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18632
18637
|
const U = m.length > 0 ? BigInt(0) : BigInt(e.solanaRelayerFee64);
|
|
18633
18638
|
if (e.hasAuction) {
|
|
18634
18639
|
if (c.push(createMctpSwapLedgerInstruction({
|
|
18635
|
-
ledger:
|
|
18640
|
+
ledger: E,
|
|
18636
18641
|
swapperAddress: t,
|
|
18637
18642
|
mintAddress: e.mctpInputContract,
|
|
18638
18643
|
randomKey: _.publicKey,
|
|
@@ -18646,14 +18651,14 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18646
18651
|
tokenOutDecimals: e.toToken.decimals,
|
|
18647
18652
|
referrerAddress: a,
|
|
18648
18653
|
amountOutMin: e.minAmountOut,
|
|
18649
|
-
deadline:
|
|
18654
|
+
deadline: I,
|
|
18650
18655
|
feeRateRef: e.referrerBps
|
|
18651
18656
|
})), m.length > 0) {
|
|
18652
18657
|
const {
|
|
18653
18658
|
instruction: j,
|
|
18654
18659
|
signer: W
|
|
18655
18660
|
} = createMctpInitSwapInstruction(
|
|
18656
|
-
|
|
18661
|
+
E,
|
|
18657
18662
|
e.toChain,
|
|
18658
18663
|
e.mctpInputContract,
|
|
18659
18664
|
t,
|
|
@@ -18662,7 +18667,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18662
18667
|
c.push(j), d.push(W);
|
|
18663
18668
|
}
|
|
18664
18669
|
} else if (c.push(createMctpBridgeLedgerInstruction({
|
|
18665
|
-
ledger:
|
|
18670
|
+
ledger: E,
|
|
18666
18671
|
swapperAddress: t,
|
|
18667
18672
|
mintAddress: e.mctpInputContract,
|
|
18668
18673
|
randomKey: _.publicKey,
|
|
@@ -18680,7 +18685,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18680
18685
|
instruction: j,
|
|
18681
18686
|
signers: W
|
|
18682
18687
|
} = createMctpBridgeWithFeeInstruction(
|
|
18683
|
-
|
|
18688
|
+
E,
|
|
18684
18689
|
e.toChain,
|
|
18685
18690
|
e.mctpInputContract,
|
|
18686
18691
|
t,
|
|
@@ -18692,7 +18697,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18692
18697
|
instructions: j,
|
|
18693
18698
|
signer: W
|
|
18694
18699
|
} = createMctpBridgeLockFeeInstruction(
|
|
18695
|
-
|
|
18700
|
+
E,
|
|
18696
18701
|
e.toChain,
|
|
18697
18702
|
e.mctpInputContract,
|
|
18698
18703
|
t,
|
|
@@ -18702,7 +18707,7 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18702
18707
|
}
|
|
18703
18708
|
}
|
|
18704
18709
|
const D = await getAddressLookupTableAccounts(l.concat(b), r);
|
|
18705
|
-
if (
|
|
18710
|
+
if (p = D.slice(0, l.length), m.length > 0) {
|
|
18706
18711
|
const M = D.slice(l.length);
|
|
18707
18712
|
T = {
|
|
18708
18713
|
messageV0: {
|
|
@@ -18714,28 +18719,28 @@ async function createMctpFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18714
18719
|
tmpTokenAccount: g
|
|
18715
18720
|
};
|
|
18716
18721
|
}
|
|
18717
|
-
return { instructions: c, signers: d, lookupTables:
|
|
18722
|
+
return { instructions: c, signers: d, lookupTables: p, swapMessageV0Params: T };
|
|
18718
18723
|
}
|
|
18719
18724
|
function createSwiftOrderHash(e, t, n, a, r) {
|
|
18720
|
-
const u =
|
|
18725
|
+
const u = bufferPolyfill.Buffer.alloc(239);
|
|
18721
18726
|
let i = 0;
|
|
18722
|
-
const l = getWormholeChainIdByName(e.fromChain), c =
|
|
18727
|
+
const l = getWormholeChainIdByName(e.fromChain), c = bufferPolyfill.Buffer.from(hexToUint8Array(nativeAddressToHexString(t, l)));
|
|
18723
18728
|
u.set(c, 0), i += 32, u.writeUInt16BE(l, i), i += 2;
|
|
18724
|
-
const d = e.swiftInputContract === ZeroAddress ? nativeAddressToHexString(SystemProgram.programId.toString(), getWormholeChainIdByName("solana")) : nativeAddressToHexString(e.swiftInputContract, l),
|
|
18725
|
-
u.set(
|
|
18726
|
-
const b = getWormholeChainIdByName(e.toChain), m =
|
|
18729
|
+
const d = e.swiftInputContract === ZeroAddress ? nativeAddressToHexString(SystemProgram.programId.toString(), getWormholeChainIdByName("solana")) : nativeAddressToHexString(e.swiftInputContract, l), p = bufferPolyfill.Buffer.from(hexToUint8Array(d));
|
|
18730
|
+
u.set(p, i), i += 32;
|
|
18731
|
+
const b = getWormholeChainIdByName(e.toChain), m = bufferPolyfill.Buffer.from(hexToUint8Array(nativeAddressToHexString(n, b)));
|
|
18727
18732
|
u.set(m, i), i += 32, u.writeUInt16BE(b, i), i += 2;
|
|
18728
|
-
const f = e.toToken.contract === ZeroAddress ? nativeAddressToHexString(SystemProgram.programId.toString(), getWormholeChainIdByName("solana")) : nativeAddressToHexString(e.toToken.contract, b), g =
|
|
18733
|
+
const f = e.toToken.contract === ZeroAddress ? nativeAddressToHexString(SystemProgram.programId.toString(), getWormholeChainIdByName("solana")) : nativeAddressToHexString(e.toToken.contract, b), g = bufferPolyfill.Buffer.from(hexToUint8Array(f));
|
|
18729
18734
|
u.set(g, i), i += 32, u.writeBigUInt64BE(getAmountOfFractionalAmount(e.minAmountOut, Math.min(e.toToken.decimals, 8)), i), i += 8, u.writeBigUInt64BE(getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8)), i), i += 8, u.writeBigUInt64BE(BigInt(e.cancelRelayerFee64), i), i += 8, u.writeBigUInt64BE(BigInt(e.refundRelayerFee64), i), i += 8, u.writeBigUInt64BE(BigInt(e.deadline64), i), i += 8;
|
|
18730
|
-
const T = a ?
|
|
18735
|
+
const T = a ? bufferPolyfill.Buffer.from(hexToUint8Array(nativeAddressToHexString(a, b))) : SystemProgram.programId.toBuffer();
|
|
18731
18736
|
u.set(T, i), i += 32, u.writeUInt8(e.referrerBps, i), i += 1;
|
|
18732
18737
|
const A = e.protocolBps;
|
|
18733
18738
|
u.writeUInt8(A, i), i += 1, u.writeUInt8(e.swiftAuctionMode, i), i += 1;
|
|
18734
|
-
const h =
|
|
18739
|
+
const h = bufferPolyfill.Buffer.from(hexToUint8Array(r));
|
|
18735
18740
|
if (u.set(h, i), i += 32, i !== 239)
|
|
18736
18741
|
throw new Error(`Invalid order data size: ${i}`);
|
|
18737
18742
|
const _ = keccak256(u);
|
|
18738
|
-
return
|
|
18743
|
+
return bufferPolyfill.Buffer.from(hexToUint8Array(_));
|
|
18739
18744
|
}
|
|
18740
18745
|
var InitSwiftLayout = struct([
|
|
18741
18746
|
blob(8, "instruction"),
|
|
@@ -18770,15 +18775,15 @@ function createSwiftInitInstruction(e) {
|
|
|
18770
18775
|
{ pubkey: new PublicKey$1(addresses_default.FEE_MANAGER_PROGRAM_ID), isWritable: !1, isSigner: !1 },
|
|
18771
18776
|
{ pubkey: new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), isWritable: !1, isSigner: !1 },
|
|
18772
18777
|
{ pubkey: SystemProgram.programId, isWritable: !1, isSigner: !1 }
|
|
18773
|
-
], s =
|
|
18778
|
+
], s = bufferPolyfill.Buffer.alloc(InitSwiftLayout.span), u = e.referrerAddress ? bufferPolyfill.Buffer.from(hexToUint8Array(nativeAddressToHexString(e.referrerAddress, a))) : SystemProgram.programId.toBuffer(), i = t.fromToken.contract === t.swiftInputContract ? BigInt(t.effectiveAmountIn64) : getAmountOfFractionalAmount(t.minMiddleAmount, t.swiftInputDecimals);
|
|
18774
18779
|
return InitSwiftLayout.encode({
|
|
18775
18780
|
instruction: getAnchorInstructionData("init_order"),
|
|
18776
18781
|
amountInMin: getSafeU64Blob(i),
|
|
18777
18782
|
nativeInput: t.swiftInputContract === ZeroAddress ? 1 : 0,
|
|
18778
18783
|
feeSubmit: getSafeU64Blob(BigInt(t.submitRelayerFee64)),
|
|
18779
|
-
destAddress:
|
|
18784
|
+
destAddress: bufferPolyfill.Buffer.from(hexToUint8Array(nativeAddressToHexString(e.destinationAddress, a))),
|
|
18780
18785
|
destinationChain: a,
|
|
18781
|
-
tokenOut:
|
|
18786
|
+
tokenOut: bufferPolyfill.Buffer.from(hexToUint8Array(nativeAddressToHexString(t.toToken.contract, a))),
|
|
18782
18787
|
amountOutMin: getSafeU64Blob(getAmountOfFractionalAmount(t.minAmountOut, Math.min(t.toToken.decimals, 8))),
|
|
18783
18788
|
gasDrop: getSafeU64Blob(getAmountOfFractionalAmount(t.gasDrop, Math.min(getGasDecimal(t.toChain), 8))),
|
|
18784
18789
|
feeCancel: getSafeU64Blob(BigInt(t.cancelRelayerFee64)),
|
|
@@ -18803,7 +18808,7 @@ async function createSwiftFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18803
18808
|
const u = s.allowSwapperOffCurve || !1;
|
|
18804
18809
|
let i = [], l = [], c = [];
|
|
18805
18810
|
c.push(addresses_default.LOOKUP_TABLE);
|
|
18806
|
-
let d = [],
|
|
18811
|
+
let d = [], p = [], b = [];
|
|
18807
18812
|
const m = Keypair.generate();
|
|
18808
18813
|
let f = null;
|
|
18809
18814
|
const g = new PublicKey$1(addresses_default.SWIFT_PROGRAM_ID), T = new PublicKey$1(t), A = Keypair.generate();
|
|
@@ -18815,34 +18820,34 @@ async function createSwiftFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18815
18820
|
n,
|
|
18816
18821
|
a,
|
|
18817
18822
|
A.publicKey.toBuffer().toString("hex")
|
|
18818
|
-
), [
|
|
18819
|
-
[
|
|
18823
|
+
), [I] = PublicKey$1.findProgramAddressSync(
|
|
18824
|
+
[bufferPolyfill.Buffer.from("STATE_SOURCE"), _],
|
|
18820
18825
|
g
|
|
18821
|
-
),
|
|
18822
|
-
S,
|
|
18826
|
+
), C = e.swiftInputContract === ZeroAddress ? solMint : new PublicKey$1(e.swiftInputContract), E = getAssociatedTokenAddress(
|
|
18823
18827
|
C,
|
|
18828
|
+
I,
|
|
18824
18829
|
!0
|
|
18825
|
-
), R = e.gasless ? new PublicKey$1(e.relayer) : T, $ = BigInt(e.submitRelayerFee64) > 0n ? getAssociatedTokenAddress(
|
|
18830
|
+
), R = e.gasless ? new PublicKey$1(e.relayer) : T, $ = BigInt(e.submitRelayerFee64) > 0n ? getAssociatedTokenAddress(C, R, !1) : g;
|
|
18826
18831
|
if (e.fromToken.contract === e.swiftInputContract)
|
|
18827
18832
|
e.suggestedPriorityFee > 0 && i.push(ComputeBudgetProgram.setComputeUnitPrice({
|
|
18828
18833
|
microLamports: e.suggestedPriorityFee
|
|
18829
18834
|
})), i.push(
|
|
18830
|
-
createAssociatedTokenAccountInstruction(R,
|
|
18835
|
+
createAssociatedTokenAccountInstruction(R, E, I, C)
|
|
18831
18836
|
), e.swiftInputContract === ZeroAddress ? i.push(
|
|
18832
18837
|
SystemProgram.transfer({
|
|
18833
18838
|
fromPubkey: T,
|
|
18834
|
-
toPubkey:
|
|
18839
|
+
toPubkey: E,
|
|
18835
18840
|
lamports: BigInt(e.effectiveAmountIn64)
|
|
18836
18841
|
}),
|
|
18837
|
-
createSyncNativeInstruction(
|
|
18842
|
+
createSyncNativeInstruction(E)
|
|
18838
18843
|
) : i.push(
|
|
18839
18844
|
createSplTransferInstruction(
|
|
18840
18845
|
getAssociatedTokenAddress(
|
|
18841
|
-
|
|
18846
|
+
C,
|
|
18842
18847
|
T,
|
|
18843
18848
|
u
|
|
18844
18849
|
),
|
|
18845
|
-
|
|
18850
|
+
E,
|
|
18846
18851
|
T,
|
|
18847
18852
|
BigInt(e.effectiveAmountIn64)
|
|
18848
18853
|
)
|
|
@@ -18863,22 +18868,22 @@ async function createSwiftFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18863
18868
|
s != null && s.separateSwapTx && D.maxAccountsFilled ? (validateJupSwap(M, m.publicKey, T), b = await createInitializeRandomTokenAccountInstructions(
|
|
18864
18869
|
r,
|
|
18865
18870
|
R,
|
|
18866
|
-
|
|
18871
|
+
C,
|
|
18867
18872
|
T,
|
|
18868
18873
|
m
|
|
18869
|
-
),
|
|
18874
|
+
), p.push(...M.computeBudgetInstructions), M.setupInstructions && p.push(...M.setupInstructions), p.push(M.swapInstruction), M.cleanupInstruction && p.push(M.cleanupInstruction), d.push(...M.addressLookupTableAddresses), i.push(createAssociatedTokenAccountInstruction(R, E, I, C)), i.push(createTransferAllAndCloseInstruction(
|
|
18870
18875
|
T,
|
|
18871
|
-
|
|
18876
|
+
C,
|
|
18872
18877
|
m.publicKey,
|
|
18873
|
-
|
|
18878
|
+
E,
|
|
18874
18879
|
R
|
|
18875
18880
|
))) : (i.push(...M.computeBudgetInstructions), M.setupInstructions && i.push(...M.setupInstructions), i.push(M.swapInstruction), M.cleanupInstruction && i.push(M.cleanupInstruction), c.push(...M.addressLookupTableAddresses));
|
|
18876
18881
|
}
|
|
18877
18882
|
i.push(createSwiftInitInstruction({
|
|
18878
18883
|
quote: e,
|
|
18879
|
-
state:
|
|
18884
|
+
state: I,
|
|
18880
18885
|
trader: T,
|
|
18881
|
-
stateAccount:
|
|
18886
|
+
stateAccount: E,
|
|
18882
18887
|
randomKey: A.publicKey,
|
|
18883
18888
|
relayerAccount: $,
|
|
18884
18889
|
relayer: R,
|
|
@@ -18887,12 +18892,12 @@ async function createSwiftFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18887
18892
|
referrerAddress: a
|
|
18888
18893
|
}));
|
|
18889
18894
|
const N = await getAddressLookupTableAccounts(c.concat(d), r);
|
|
18890
|
-
if (l = N.slice(0, c.length),
|
|
18895
|
+
if (l = N.slice(0, c.length), p.length > 0) {
|
|
18891
18896
|
const D = N.slice(c.length);
|
|
18892
18897
|
f = {
|
|
18893
18898
|
messageV0: {
|
|
18894
18899
|
payerKey: R,
|
|
18895
|
-
instructions:
|
|
18900
|
+
instructions: p,
|
|
18896
18901
|
addressLookupTableAccounts: D
|
|
18897
18902
|
},
|
|
18898
18903
|
createTmpTokenAccountIxs: b,
|
|
@@ -18919,35 +18924,35 @@ var STATE_SIZE = 420, SwapLayout = struct([
|
|
|
18919
18924
|
u8("referrerFeeNonce")
|
|
18920
18925
|
]);
|
|
18921
18926
|
async function createSwapFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
18922
|
-
const u = getQuoteSuitableReferrerAddress(e
|
|
18927
|
+
const u = getQuoteSuitableReferrerAddress(e);
|
|
18923
18928
|
if (e.type === "MCTP")
|
|
18924
18929
|
return createMctpFromSolanaInstructions(e, t, n, u, r, s);
|
|
18925
18930
|
if (e.type === "SWIFT")
|
|
18926
18931
|
return createSwiftFromSolanaInstructions(e, t, n, u, r, s);
|
|
18927
18932
|
let i = [];
|
|
18928
|
-
const l = r ?? new Connection("https://rpc.ankr.com/solana"), c = new PublicKey$1(addresses_default.MAYAN_PROGRAM_ID), d = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID),
|
|
18933
|
+
const l = r ?? new Connection("https://rpc.ankr.com/solana"), c = new PublicKey$1(addresses_default.MAYAN_PROGRAM_ID), d = new PublicKey$1(addresses_default.TOKEN_PROGRAM_ID), p = new PublicKey$1(t), b = new PublicKey$1(addresses_default.AUCTION_PROGRAM_ID);
|
|
18929
18934
|
e.suggestedPriorityFee > 0 && i.push(ComputeBudgetProgram.setComputeUnitPrice({
|
|
18930
18935
|
microLamports: e.suggestedPriorityFee
|
|
18931
18936
|
}));
|
|
18932
18937
|
let m;
|
|
18933
18938
|
u ? m = new PublicKey$1(u) : m = SystemProgram.programId;
|
|
18934
18939
|
const [f, g] = PublicKey$1.findProgramAddressSync(
|
|
18935
|
-
[
|
|
18940
|
+
[bufferPolyfill.Buffer.from("MAYANFEE")],
|
|
18936
18941
|
c
|
|
18937
18942
|
), [T, A] = PublicKey$1.findProgramAddressSync(
|
|
18938
18943
|
[
|
|
18939
|
-
|
|
18944
|
+
bufferPolyfill.Buffer.from("REFERRERFEE"),
|
|
18940
18945
|
m.toBuffer()
|
|
18941
18946
|
],
|
|
18942
18947
|
c
|
|
18943
|
-
), h = Keypair.generate(), _ = Keypair.generate(), [
|
|
18948
|
+
), h = Keypair.generate(), _ = Keypair.generate(), [I, C] = PublicKey$1.findProgramAddressSync(
|
|
18944
18949
|
[
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18950
|
+
bufferPolyfill.Buffer.from("V2STATE"),
|
|
18951
|
+
bufferPolyfill.Buffer.from(h.publicKey.toBytes()),
|
|
18952
|
+
bufferPolyfill.Buffer.from(_.publicKey.toBytes())
|
|
18948
18953
|
],
|
|
18949
18954
|
c
|
|
18950
|
-
),
|
|
18955
|
+
), E = new PublicKey$1(e.fromToken.mint), R = new PublicKey$1(e.toToken.mint), $ = getAssociatedTokenAddress(E, p), N = getAssociatedTokenAddress(E, I, !0), [
|
|
18951
18956
|
[D, M],
|
|
18952
18957
|
v,
|
|
18953
18958
|
U
|
|
@@ -18957,17 +18962,17 @@ async function createSwapFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18957
18962
|
decideRelayer()
|
|
18958
18963
|
]);
|
|
18959
18964
|
(!D || D.data.length === 0) && i.push(createAssociatedTokenAccountInstruction(
|
|
18960
|
-
|
|
18965
|
+
p,
|
|
18961
18966
|
$,
|
|
18962
|
-
|
|
18963
|
-
|
|
18967
|
+
p,
|
|
18968
|
+
E
|
|
18964
18969
|
)), (!M || M.data.length === 0) && i.push(createAssociatedTokenAccountInstruction(
|
|
18965
|
-
|
|
18970
|
+
p,
|
|
18966
18971
|
N,
|
|
18967
|
-
|
|
18968
|
-
|
|
18972
|
+
I,
|
|
18973
|
+
E
|
|
18969
18974
|
)), e.fromToken.contract === ZeroAddress && (i.push(SystemProgram.transfer({
|
|
18970
|
-
fromPubkey:
|
|
18975
|
+
fromPubkey: p,
|
|
18971
18976
|
toPubkey: $,
|
|
18972
18977
|
lamports: BigInt(e.effectiveAmountIn64)
|
|
18973
18978
|
})), i.push(createSyncNativeInstruction($)));
|
|
@@ -18975,10 +18980,10 @@ async function createSwapFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18975
18980
|
i.push(createApproveInstruction(
|
|
18976
18981
|
$,
|
|
18977
18982
|
W.publicKey,
|
|
18978
|
-
|
|
18983
|
+
p,
|
|
18979
18984
|
j
|
|
18980
18985
|
)), i.push(SystemProgram.transfer({
|
|
18981
|
-
fromPubkey:
|
|
18986
|
+
fromPubkey: p,
|
|
18982
18987
|
toPubkey: W.publicKey,
|
|
18983
18988
|
lamports: v
|
|
18984
18989
|
}));
|
|
@@ -18986,11 +18991,11 @@ async function createSwapFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
18986
18991
|
{ pubkey: W.publicKey, isWritable: !1, isSigner: !0 },
|
|
18987
18992
|
{ pubkey: h.publicKey, isWritable: !1, isSigner: !0 },
|
|
18988
18993
|
{ pubkey: _.publicKey, isWritable: !1, isSigner: !0 },
|
|
18989
|
-
{ pubkey:
|
|
18994
|
+
{ pubkey: I, isWritable: !0, isSigner: !1 },
|
|
18990
18995
|
{ pubkey: $, isWritable: !0, isSigner: !1 },
|
|
18991
|
-
{ pubkey:
|
|
18996
|
+
{ pubkey: p, isWritable: !1, isSigner: !1 },
|
|
18992
18997
|
{ pubkey: N, isWritable: !0, isSigner: !1 },
|
|
18993
|
-
{ pubkey:
|
|
18998
|
+
{ pubkey: E, isWritable: !1, isSigner: !1 },
|
|
18994
18999
|
{ pubkey: R, isWritable: !1, isSigner: !1 },
|
|
18995
19000
|
{ pubkey: b, isWritable: !1, isSigner: !1 },
|
|
18996
19001
|
{ pubkey: m, isWritable: !1, isSigner: !1 },
|
|
@@ -19010,7 +19015,7 @@ async function createSwapFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
19010
19015
|
"Destination address is not about token account. It should be a owner address"
|
|
19011
19016
|
);
|
|
19012
19017
|
}
|
|
19013
|
-
const
|
|
19018
|
+
const X = bufferPolyfill.Buffer.from(
|
|
19014
19019
|
hexToUint8Array(
|
|
19015
19020
|
nativeAddressToHexString(n, z)
|
|
19016
19021
|
)
|
|
@@ -19029,30 +19034,30 @@ async function createSwapFromSolanaInstructions(e, t, n, a, r, s = {}) {
|
|
|
19029
19034
|
), q = getAmountOfFractionalAmount(
|
|
19030
19035
|
e.gasDrop,
|
|
19031
19036
|
getGasDecimalsInSolana(e.toChain)
|
|
19032
|
-
),
|
|
19037
|
+
), Z = e.toToken.contract === ZeroAddress, y = e.fromToken.contract === ZeroAddress;
|
|
19033
19038
|
if (!Number(e.deadline64))
|
|
19034
19039
|
throw new Error("Deadline is not valid");
|
|
19035
|
-
const
|
|
19040
|
+
const w = BigInt(e.deadline64), S = bufferPolyfill.Buffer.alloc(SwapLayout.span), P = {
|
|
19036
19041
|
instruction: 101,
|
|
19037
|
-
stateNonce:
|
|
19042
|
+
stateNonce: C,
|
|
19038
19043
|
amount: getSafeU64Blob(j),
|
|
19039
19044
|
minAmountOut: getSafeU64Blob(J),
|
|
19040
|
-
deadline: getSafeU64Blob(
|
|
19045
|
+
deadline: getSafeU64Blob(w),
|
|
19041
19046
|
feeSwap: getSafeU64Blob(Q),
|
|
19042
19047
|
feeReturn: getSafeU64Blob(ee),
|
|
19043
19048
|
feeCancel: getSafeU64Blob(H),
|
|
19044
19049
|
gasDrop: getSafeU64Blob(q),
|
|
19045
19050
|
destinationChain: z,
|
|
19046
|
-
destinationAddress:
|
|
19047
|
-
unwrapRedeem:
|
|
19048
|
-
unwrapRefund:
|
|
19051
|
+
destinationAddress: X,
|
|
19052
|
+
unwrapRedeem: Z ? 1 : 0,
|
|
19053
|
+
unwrapRefund: y ? 1 : 0,
|
|
19049
19054
|
mayanFeeNonce: g,
|
|
19050
19055
|
referrerFeeNonce: A
|
|
19051
19056
|
};
|
|
19052
|
-
SwapLayout.encode(
|
|
19057
|
+
SwapLayout.encode(P, S);
|
|
19053
19058
|
const k = new TransactionInstruction({
|
|
19054
19059
|
keys: V,
|
|
19055
|
-
data:
|
|
19060
|
+
data: S,
|
|
19056
19061
|
programId: c
|
|
19057
19062
|
});
|
|
19058
19063
|
return i.push(k), {
|
|
@@ -19073,7 +19078,7 @@ function getEvmSwiftParams(e, t, n, a, r) {
|
|
|
19073
19078
|
const l = e.swiftMayanContract;
|
|
19074
19079
|
if (!Number(e.deadline64))
|
|
19075
19080
|
throw new Error("Swift order requires timeout");
|
|
19076
|
-
const c = BigInt(e.deadline64), d = e.swiftInputContract,
|
|
19081
|
+
const c = BigInt(e.deadline64), d = e.swiftInputContract, p = BigInt(e.effectiveAmountIn64);
|
|
19077
19082
|
let b;
|
|
19078
19083
|
a ? b = nativeAddressToHexString(
|
|
19079
19084
|
a,
|
|
@@ -19106,7 +19111,7 @@ function getEvmSwiftParams(e, t, n, a, r) {
|
|
|
19106
19111
|
return {
|
|
19107
19112
|
contractAddress: l,
|
|
19108
19113
|
tokenIn: d,
|
|
19109
|
-
amountIn:
|
|
19114
|
+
amountIn: p,
|
|
19110
19115
|
order: h
|
|
19111
19116
|
};
|
|
19112
19117
|
}
|
|
@@ -19122,10 +19127,10 @@ function getSwiftFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
19122
19127
|
tokenIn: l,
|
|
19123
19128
|
amountIn: c,
|
|
19124
19129
|
order: d,
|
|
19125
|
-
contractAddress:
|
|
19130
|
+
contractAddress: p
|
|
19126
19131
|
} = getEvmSwiftParams(e, t, n, a, r);
|
|
19127
19132
|
let b;
|
|
19128
|
-
const m = new Contract(
|
|
19133
|
+
const m = new Contract(p, MayanSwiftArtifact_default.abi);
|
|
19129
19134
|
e.swiftInputContract === ZeroAddress ? b = m.interface.encodeFunctionData(
|
|
19130
19135
|
"createOrderWithEth",
|
|
19131
19136
|
[d]
|
|
@@ -19135,29 +19140,29 @@ function getSwiftFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
19135
19140
|
);
|
|
19136
19141
|
let f, g, T;
|
|
19137
19142
|
if (e.fromToken.contract === e.swiftInputContract)
|
|
19138
|
-
e.fromToken.contract === ZeroAddress ? (f = "forwardEth", g = [
|
|
19143
|
+
e.fromToken.contract === ZeroAddress ? (f = "forwardEth", g = [p, b], T = toBeHex(c)) : (f = "forwardERC20", g = [l, c, u, p, b], T = toBeHex(0));
|
|
19139
19144
|
else {
|
|
19140
19145
|
const { evmSwapRouterAddress: h, evmSwapRouterCalldata: _ } = e;
|
|
19141
19146
|
if (!e.minMiddleAmount || !h || !_)
|
|
19142
19147
|
throw new Error("Swift swap requires middle amount, router address and calldata");
|
|
19143
|
-
const
|
|
19148
|
+
const I = e.fromToken.contract, C = getAmountOfFractionalAmount(e.minMiddleAmount, e.swiftInputDecimals);
|
|
19144
19149
|
e.fromToken.contract === ZeroAddress ? (f = "swapAndForwardEth", g = [
|
|
19145
19150
|
c,
|
|
19146
19151
|
h,
|
|
19147
19152
|
_,
|
|
19148
19153
|
e.swiftInputContract,
|
|
19149
|
-
|
|
19150
|
-
|
|
19154
|
+
C,
|
|
19155
|
+
p,
|
|
19151
19156
|
b
|
|
19152
19157
|
], T = toBeHex(c)) : (f = "swapAndForwardERC20", g = [
|
|
19153
|
-
|
|
19158
|
+
I,
|
|
19154
19159
|
c,
|
|
19155
19160
|
u,
|
|
19156
19161
|
h,
|
|
19157
19162
|
_,
|
|
19158
19163
|
e.swiftInputContract,
|
|
19159
|
-
|
|
19160
|
-
|
|
19164
|
+
C,
|
|
19165
|
+
p,
|
|
19161
19166
|
b
|
|
19162
19167
|
], T = toBeHex(0));
|
|
19163
19168
|
}
|
|
@@ -19322,7 +19327,7 @@ function writeBigIntTo16BytesBuffer(e) {
|
|
|
19322
19327
|
const t = (1n << 128n) - 1n;
|
|
19323
19328
|
if (e < 0n || e > t)
|
|
19324
19329
|
throw new RangeError("Value must fit in an unsigned 128-bit integer (0 <= value < 2^128)");
|
|
19325
|
-
const n =
|
|
19330
|
+
const n = bufferPolyfill.Buffer.alloc(16);
|
|
19326
19331
|
for (let a = 15; a >= 0; a--)
|
|
19327
19332
|
n[a] = Number(e & 0xFFn), e >>= 8n;
|
|
19328
19333
|
return n;
|
|
@@ -19336,27 +19341,27 @@ function getShuttleParams(e, t, n) {
|
|
|
19336
19341
|
throw new Error(`Signer chain id(${Number(n)}) and quote from chain are not same! ${s} !== ${r}`);
|
|
19337
19342
|
let i = [];
|
|
19338
19343
|
i.push(shuttleConstants.FAST_MODE_FLAG);
|
|
19339
|
-
const l =
|
|
19344
|
+
const l = bufferPolyfill.Buffer.alloc(8);
|
|
19340
19345
|
l.writeBigUInt64BE(BigInt(a.maxLLFee));
|
|
19341
19346
|
const c = l.subarray(2);
|
|
19342
19347
|
i.push(...c);
|
|
19343
|
-
const d =
|
|
19348
|
+
const d = bufferPolyfill.Buffer.alloc(4);
|
|
19344
19349
|
d.writeUInt32BE(a.fastTransferDeadline), i.push(...d), i.push(shuttleConstants.RELAY_REDEEM_MODE);
|
|
19345
|
-
const
|
|
19350
|
+
const p = getAmountOfFractionalAmount(
|
|
19346
19351
|
e.gasDrop,
|
|
19347
19352
|
Math.min(6, getGasDecimal(e.toChain))
|
|
19348
|
-
), b =
|
|
19349
|
-
b.writeBigUInt64BE(
|
|
19353
|
+
), b = bufferPolyfill.Buffer.alloc(8);
|
|
19354
|
+
b.writeBigUInt64BE(p);
|
|
19350
19355
|
const m = b.subarray(4);
|
|
19351
19356
|
i.push(...m);
|
|
19352
|
-
const f =
|
|
19357
|
+
const f = bufferPolyfill.Buffer.alloc(8);
|
|
19353
19358
|
f.writeBigUInt64BE(BigInt(a.maxRelayingFee));
|
|
19354
19359
|
const g = f.subarray(2);
|
|
19355
19360
|
i.push(...g), i.push(shuttleConstants.EXACT_IN_FLAG), i.push(shuttleConstants.USDC_INPUT_TOKEN_TYPE);
|
|
19356
19361
|
const T = BigInt(e.effectiveAmountIn64);
|
|
19357
19362
|
if (e.fromToken.contract === e.shuttleInputContract) {
|
|
19358
19363
|
i.push(...Array(8).fill(0));
|
|
19359
|
-
const h =
|
|
19364
|
+
const h = bufferPolyfill.Buffer.alloc(8);
|
|
19360
19365
|
h.writeBigUInt64BE(T), i.push(...h);
|
|
19361
19366
|
} else
|
|
19362
19367
|
i.push(...Array(16).fill(0));
|
|
@@ -19365,28 +19370,28 @@ function getShuttleParams(e, t, n) {
|
|
|
19365
19370
|
i.push(shuttleConstants.OUTPUT_NATIVE_MODE);
|
|
19366
19371
|
else {
|
|
19367
19372
|
i.push(shuttleConstants.OUTPUT_OTHER_MODE);
|
|
19368
|
-
const
|
|
19369
|
-
i.push(...
|
|
19373
|
+
const C = bufferPolyfill.Buffer.from(nativeAddressToHexString(e.toToken.contract, u).slice(2), "hex");
|
|
19374
|
+
i.push(...C);
|
|
19370
19375
|
}
|
|
19371
|
-
const h =
|
|
19376
|
+
const h = bufferPolyfill.Buffer.alloc(4);
|
|
19372
19377
|
h.writeUInt32BE(Number(BigInt(e.deadline64))), i.push(...h);
|
|
19373
19378
|
const _ = getAmountOfFractionalAmount(e.minAmountOut, e.toToken.decimals);
|
|
19374
19379
|
if (e.toChain === "solana") {
|
|
19375
19380
|
i.push(...Array(8).fill(0));
|
|
19376
|
-
const
|
|
19377
|
-
|
|
19381
|
+
const C = bufferPolyfill.Buffer.alloc(8);
|
|
19382
|
+
C.writeBigUInt64BE(_), i.push(...C);
|
|
19378
19383
|
} else {
|
|
19379
|
-
const
|
|
19380
|
-
i.push(...
|
|
19384
|
+
const C = writeBigIntTo16BytesBuffer(_);
|
|
19385
|
+
i.push(...C);
|
|
19381
19386
|
}
|
|
19382
|
-
const
|
|
19383
|
-
i.push(...
|
|
19387
|
+
const I = bufferPolyfill.Buffer.from(a.path.slice(2), "hex");
|
|
19388
|
+
i.push(...I);
|
|
19384
19389
|
} else
|
|
19385
19390
|
i.push(shuttleConstants.OUTPUT_USDC_MODE);
|
|
19386
19391
|
return {
|
|
19387
19392
|
destAddr: nativeAddressToHexString(t, u),
|
|
19388
19393
|
destChainId: u,
|
|
19389
|
-
serializedParams: `0x${
|
|
19394
|
+
serializedParams: `0x${bufferPolyfill.Buffer.from(i).toString("hex")}`,
|
|
19390
19395
|
contractAddress: e.shuttleContract,
|
|
19391
19396
|
amountIn: T,
|
|
19392
19397
|
bridgeFee: getAmountOfFractionalAmount(e.bridgeFee, getGasDecimal(e.fromChain))
|
|
@@ -19404,7 +19409,7 @@ function getShuttleFromEvmTxPayload(e, t, n, a) {
|
|
|
19404
19409
|
serializedParams: l,
|
|
19405
19410
|
contractAddress: c,
|
|
19406
19411
|
amountIn: d,
|
|
19407
|
-
bridgeFee:
|
|
19412
|
+
bridgeFee: p
|
|
19408
19413
|
} = getShuttleParams(e, t, n);
|
|
19409
19414
|
let b;
|
|
19410
19415
|
b = new Contract(c, ShuttleArtifact_default.abi).interface.encodeFunctionData(
|
|
@@ -19413,31 +19418,31 @@ function getShuttleFromEvmTxPayload(e, t, n, a) {
|
|
|
19413
19418
|
);
|
|
19414
19419
|
let f, g, T;
|
|
19415
19420
|
if (e.fromToken.contract === e.shuttleInputContract)
|
|
19416
|
-
f = "forwardERC20", g = [e.shuttleInputContract, d, r, c, b], T = toBeHex(
|
|
19421
|
+
f = "forwardERC20", g = [e.shuttleInputContract, d, r, c, b], T = toBeHex(p);
|
|
19417
19422
|
else {
|
|
19418
19423
|
const { evmSwapRouterAddress: h, evmSwapRouterCalldata: _ } = e;
|
|
19419
19424
|
if (!e.minMiddleAmount || !h || !_)
|
|
19420
19425
|
throw new Error("Shuttle source chain swap requires middle amount, router address and calldata");
|
|
19421
|
-
const
|
|
19426
|
+
const I = e.fromToken.contract, C = getAmountOfFractionalAmount(e.minMiddleAmount, e.shuttleInputDecimals);
|
|
19422
19427
|
e.fromToken.contract === ZeroAddress ? (f = "swapAndForwardEth", g = [
|
|
19423
19428
|
d,
|
|
19424
19429
|
h,
|
|
19425
19430
|
_,
|
|
19426
19431
|
e.shuttleInputContract,
|
|
19427
|
-
|
|
19432
|
+
C,
|
|
19428
19433
|
c,
|
|
19429
19434
|
b
|
|
19430
19435
|
], T = toBeHex(d)) : (f = "swapAndForwardERC20", g = [
|
|
19431
|
-
|
|
19436
|
+
I,
|
|
19432
19437
|
d,
|
|
19433
19438
|
r,
|
|
19434
19439
|
h,
|
|
19435
19440
|
_,
|
|
19436
19441
|
e.shuttleInputContract,
|
|
19437
|
-
|
|
19442
|
+
C,
|
|
19438
19443
|
c,
|
|
19439
19444
|
b
|
|
19440
|
-
], T = toBeHex(
|
|
19445
|
+
], T = toBeHex(p));
|
|
19441
19446
|
}
|
|
19442
19447
|
return {
|
|
19443
19448
|
data: s.interface.encodeFunctionData(f, g),
|
|
@@ -20163,7 +20168,7 @@ function getEvmFastMctpBridgeParams(e, t, n, a, r) {
|
|
|
20163
20168
|
const s = getWormholeChainIdById(Number(a)), u = getWormholeChainIdByName(e.fromChain), i = getWormholeChainIdByName(e.toChain);
|
|
20164
20169
|
if (u !== s)
|
|
20165
20170
|
throw new Error(`Signer chain id(${Number(a)}) and quote from chain are not same! ${u} !== ${s}`);
|
|
20166
|
-
const l = nativeAddressToHexString(t, i), c = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS), d = getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8)),
|
|
20171
|
+
const l = nativeAddressToHexString(t, i), c = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS), d = getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8)), p = BigInt(e.circleMaxFee64), b = BigInt(e.effectiveAmountIn64), m = getCCTPDomain(e.toChain);
|
|
20167
20172
|
let f;
|
|
20168
20173
|
if (n ? f = nativeAddressToHexString(
|
|
20169
20174
|
n,
|
|
@@ -20186,7 +20191,7 @@ function getEvmFastMctpBridgeParams(e, t, n, a, r) {
|
|
|
20186
20191
|
payloadType: FAST_MCTP_PAYLOAD_TYPE_DEFAULT,
|
|
20187
20192
|
customPayload: "0x",
|
|
20188
20193
|
minFinalityThreshold: Number(e.fastMctpMinFinality),
|
|
20189
|
-
circleMaxFee:
|
|
20194
|
+
circleMaxFee: p,
|
|
20190
20195
|
contractAddress: g
|
|
20191
20196
|
};
|
|
20192
20197
|
}
|
|
@@ -20202,7 +20207,7 @@ function getEvmFastMctpBridgeTxPayload(e, t, n, a, r) {
|
|
|
20202
20207
|
amountIn: l,
|
|
20203
20208
|
destAddr: c,
|
|
20204
20209
|
redeemFee: d,
|
|
20205
|
-
gasDrop:
|
|
20210
|
+
gasDrop: p,
|
|
20206
20211
|
circleMaxFee: b,
|
|
20207
20212
|
referrerAddr: m,
|
|
20208
20213
|
referrerBps: f,
|
|
@@ -20211,15 +20216,15 @@ function getEvmFastMctpBridgeTxPayload(e, t, n, a, r) {
|
|
|
20211
20216
|
minFinalityThreshold: A,
|
|
20212
20217
|
payloadType: h
|
|
20213
20218
|
} = s, _ = new Contract(u, MayanFastMctpArtifact_default.abi);
|
|
20214
|
-
let
|
|
20215
|
-
return
|
|
20219
|
+
let I, C;
|
|
20220
|
+
return I = _.interface.encodeFunctionData(
|
|
20216
20221
|
"bridge",
|
|
20217
20222
|
[
|
|
20218
20223
|
i,
|
|
20219
20224
|
l,
|
|
20220
20225
|
d,
|
|
20221
20226
|
b,
|
|
20222
|
-
|
|
20227
|
+
p,
|
|
20223
20228
|
c,
|
|
20224
20229
|
g,
|
|
20225
20230
|
m,
|
|
@@ -20228,10 +20233,10 @@ function getEvmFastMctpBridgeTxPayload(e, t, n, a, r) {
|
|
|
20228
20233
|
A,
|
|
20229
20234
|
T
|
|
20230
20235
|
]
|
|
20231
|
-
),
|
|
20236
|
+
), C = toBeHex(0), {
|
|
20232
20237
|
to: u,
|
|
20233
|
-
data:
|
|
20234
|
-
value:
|
|
20238
|
+
data: I,
|
|
20239
|
+
value: C,
|
|
20235
20240
|
_params: s
|
|
20236
20241
|
};
|
|
20237
20242
|
}
|
|
@@ -20250,7 +20255,7 @@ function getEvmFastMctpCreateOrderParams(e, t, n, a) {
|
|
|
20250
20255
|
SystemProgram.programId.toString(),
|
|
20251
20256
|
getWormholeChainIdByName("solana")
|
|
20252
20257
|
);
|
|
20253
|
-
const d = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS),
|
|
20258
|
+
const d = getAmountOfFractionalAmount(e.redeemRelayerFee, CCTP_TOKEN_DECIMALS), p = BigInt(e.refundRelayerFee64), b = BigInt(e.circleMaxFee64), m = getAmountOfFractionalAmount(e.gasDrop, Math.min(getGasDecimal(e.toChain), 8)), f = getCCTPDomain(e.toChain), g = BigInt(e.effectiveAmountIn64), T = getAmountOfFractionalAmount(
|
|
20254
20259
|
e.minAmountOut,
|
|
20255
20260
|
Math.min(8, e.toToken.decimals)
|
|
20256
20261
|
), A = BigInt(e.deadline64), h = e.toToken.contract === ZeroAddress ? nativeAddressToHexString(SystemProgram.programId.toString(), getWormholeChainIdByName("solana")) : nativeAddressToHexString(
|
|
@@ -20270,7 +20275,7 @@ function getEvmFastMctpCreateOrderParams(e, t, n, a) {
|
|
|
20270
20275
|
amountOutMin: T,
|
|
20271
20276
|
gasDrop: m,
|
|
20272
20277
|
redeemFee: d,
|
|
20273
|
-
refundFee:
|
|
20278
|
+
refundFee: p,
|
|
20274
20279
|
deadline: A,
|
|
20275
20280
|
referrerAddr: c,
|
|
20276
20281
|
referrerBps: e.referrerBps || 0
|
|
@@ -20291,10 +20296,10 @@ function getEvmFastMctpCreateOrderTxPayload(e, t, n, a) {
|
|
|
20291
20296
|
amountIn: l,
|
|
20292
20297
|
circleMaxFee: c,
|
|
20293
20298
|
destDomain: d,
|
|
20294
|
-
minFinalityThreshold:
|
|
20299
|
+
minFinalityThreshold: p
|
|
20295
20300
|
} = r, m = new Contract(s, MayanFastMctpArtifact_default.abi).interface.encodeFunctionData(
|
|
20296
20301
|
"createOrder",
|
|
20297
|
-
[i, l, c, d,
|
|
20302
|
+
[i, l, c, d, p, u]
|
|
20298
20303
|
), f = toBeHex(0);
|
|
20299
20304
|
return {
|
|
20300
20305
|
to: s,
|
|
@@ -20367,7 +20372,7 @@ function getFastMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
20367
20372
|
if (e.hasAuction) {
|
|
20368
20373
|
if (!Number(e.deadline64))
|
|
20369
20374
|
throw new Error("Fast Mctp order requires timeout");
|
|
20370
|
-
const
|
|
20375
|
+
const p = getEvmFastMctpCreateOrderTxPayload(
|
|
20371
20376
|
e,
|
|
20372
20377
|
t,
|
|
20373
20378
|
n,
|
|
@@ -20375,18 +20380,18 @@ function getFastMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
20375
20380
|
), b = getAmountOfFractionalAmount(e.minMiddleAmount, CCTP_TOKEN_DECIMALS);
|
|
20376
20381
|
if (e.fromToken.contract === ZeroAddress) {
|
|
20377
20382
|
const m = "swapAndForwardEth", f = [
|
|
20378
|
-
|
|
20383
|
+
p._params.amountIn,
|
|
20379
20384
|
c,
|
|
20380
20385
|
d,
|
|
20381
20386
|
e.fastMctpInputContract,
|
|
20382
20387
|
b,
|
|
20383
|
-
|
|
20384
|
-
|
|
20388
|
+
p._params.contractAddress,
|
|
20389
|
+
p.data
|
|
20385
20390
|
];
|
|
20386
20391
|
return {
|
|
20387
20392
|
data: i.interface.encodeFunctionData(m, f),
|
|
20388
20393
|
to: addresses_default.MAYAN_FORWARDER_CONTRACT,
|
|
20389
|
-
value: toBeHex(
|
|
20394
|
+
value: toBeHex(p._params.amountIn),
|
|
20390
20395
|
chainId: a,
|
|
20391
20396
|
_forwarder: {
|
|
20392
20397
|
method: m,
|
|
@@ -20396,14 +20401,14 @@ function getFastMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
20396
20401
|
} else {
|
|
20397
20402
|
const m = "swapAndForwardERC20", f = [
|
|
20398
20403
|
e.fromToken.contract,
|
|
20399
|
-
|
|
20404
|
+
p._params.amountIn,
|
|
20400
20405
|
u,
|
|
20401
20406
|
c,
|
|
20402
20407
|
d,
|
|
20403
20408
|
e.fastMctpInputContract,
|
|
20404
20409
|
b,
|
|
20405
|
-
|
|
20406
|
-
|
|
20410
|
+
p._params.contractAddress,
|
|
20411
|
+
p.data
|
|
20407
20412
|
];
|
|
20408
20413
|
return {
|
|
20409
20414
|
data: i.interface.encodeFunctionData(m, f),
|
|
@@ -20417,7 +20422,7 @@ function getFastMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
20417
20422
|
};
|
|
20418
20423
|
}
|
|
20419
20424
|
} else {
|
|
20420
|
-
const
|
|
20425
|
+
const p = getEvmFastMctpBridgeTxPayload(
|
|
20421
20426
|
e,
|
|
20422
20427
|
t,
|
|
20423
20428
|
n,
|
|
@@ -20425,18 +20430,18 @@ function getFastMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
20425
20430
|
), b = getAmountOfFractionalAmount(e.minMiddleAmount, CCTP_TOKEN_DECIMALS);
|
|
20426
20431
|
if (e.fromToken.contract === ZeroAddress) {
|
|
20427
20432
|
const m = "swapAndForwardEth", f = [
|
|
20428
|
-
|
|
20433
|
+
p._params.amountIn,
|
|
20429
20434
|
c,
|
|
20430
20435
|
d,
|
|
20431
20436
|
e.fastMctpInputContract,
|
|
20432
20437
|
b,
|
|
20433
|
-
|
|
20434
|
-
|
|
20438
|
+
p._params.contractAddress,
|
|
20439
|
+
p.data
|
|
20435
20440
|
];
|
|
20436
20441
|
return {
|
|
20437
20442
|
data: i.interface.encodeFunctionData(m, f),
|
|
20438
20443
|
to: addresses_default.MAYAN_FORWARDER_CONTRACT,
|
|
20439
|
-
value: toBeHex(
|
|
20444
|
+
value: toBeHex(p._params.amountIn),
|
|
20440
20445
|
chainId: a,
|
|
20441
20446
|
_forwarder: {
|
|
20442
20447
|
method: m,
|
|
@@ -20446,14 +20451,14 @@ function getFastMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
20446
20451
|
} else {
|
|
20447
20452
|
const m = "swapAndForwardERC20", f = [
|
|
20448
20453
|
e.fromToken.contract,
|
|
20449
|
-
|
|
20454
|
+
p._params.amountIn,
|
|
20450
20455
|
u,
|
|
20451
20456
|
c,
|
|
20452
20457
|
d,
|
|
20453
20458
|
e.fastMctpInputContract,
|
|
20454
20459
|
b,
|
|
20455
|
-
|
|
20456
|
-
|
|
20460
|
+
p._params.contractAddress,
|
|
20461
|
+
p.data
|
|
20457
20462
|
];
|
|
20458
20463
|
return {
|
|
20459
20464
|
data: i.interface.encodeFunctionData(m, f),
|
|
@@ -20471,13 +20476,13 @@ function getFastMctpFromEvmTxPayload(e, t, n, a, r, s) {
|
|
|
20471
20476
|
}
|
|
20472
20477
|
function getEvmSwapParams(e, t, n, a, r, s) {
|
|
20473
20478
|
const u = new PublicKey$1(addresses_default.MAYAN_PROGRAM_ID), [i] = PublicKey$1.findProgramAddressSync(
|
|
20474
|
-
[
|
|
20479
|
+
[bufferPolyfill.Buffer.from("MAIN")],
|
|
20475
20480
|
u
|
|
20476
20481
|
), l = getAssociatedTokenAddress(
|
|
20477
20482
|
new PublicKey$1(e.fromToken.mint),
|
|
20478
20483
|
i,
|
|
20479
20484
|
!0
|
|
20480
|
-
), c = BigInt(e.effectiveAmountIn64), d = nativeAddressToHexString(l.toString(), 1),
|
|
20485
|
+
), c = BigInt(e.effectiveAmountIn64), d = nativeAddressToHexString(l.toString(), 1), p = nativeAddressToHexString(
|
|
20481
20486
|
addresses_default.AUCTION_PROGRAM_ID,
|
|
20482
20487
|
1
|
|
20483
20488
|
);
|
|
@@ -20497,7 +20502,7 @@ function getEvmSwapParams(e, t, n, a, r, s) {
|
|
|
20497
20502
|
mayanChainId: 1,
|
|
20498
20503
|
destAddr: nativeAddressToHexString(t, g),
|
|
20499
20504
|
destChainId: g,
|
|
20500
|
-
auctionAddr:
|
|
20505
|
+
auctionAddr: p,
|
|
20501
20506
|
referrer: b,
|
|
20502
20507
|
refundAddr: nativeAddressToHexString(a, m)
|
|
20503
20508
|
}, h = e.toToken.contract === ZeroAddress, _ = {
|
|
@@ -20513,7 +20518,7 @@ function getEvmSwapParams(e, t, n, a, r, s) {
|
|
|
20513
20518
|
),
|
|
20514
20519
|
unwrap: h,
|
|
20515
20520
|
customPayload: "0x"
|
|
20516
|
-
},
|
|
20521
|
+
}, I = {
|
|
20517
20522
|
swapFee: getAmountOfFractionalAmount(
|
|
20518
20523
|
e.swapRelayerFee,
|
|
20519
20524
|
Math.min(8, e.fromToken.decimals)
|
|
@@ -20526,30 +20531,30 @@ function getEvmSwapParams(e, t, n, a, r, s) {
|
|
|
20526
20531
|
e.refundRelayerFee,
|
|
20527
20532
|
Math.min(8, e.fromToken.decimals)
|
|
20528
20533
|
)
|
|
20529
|
-
},
|
|
20534
|
+
}, C = nativeAddressToHexString(
|
|
20530
20535
|
e.toToken.realOriginContractAddress,
|
|
20531
20536
|
e.toToken.realOriginChainId
|
|
20532
|
-
),
|
|
20537
|
+
), E = getAmountOfFractionalAmount(
|
|
20533
20538
|
e.bridgeFee,
|
|
20534
20539
|
18
|
|
20535
20540
|
);
|
|
20536
20541
|
return {
|
|
20537
20542
|
amountIn: c,
|
|
20538
20543
|
tokenIn: e.fromToken.contract,
|
|
20539
|
-
tokenOut:
|
|
20544
|
+
tokenOut: C,
|
|
20540
20545
|
tokenOutWChainId: e.toToken.realOriginChainId,
|
|
20541
20546
|
criteria: _,
|
|
20542
20547
|
recipient: A,
|
|
20543
|
-
relayerFees:
|
|
20548
|
+
relayerFees: I,
|
|
20544
20549
|
contractAddress: T,
|
|
20545
|
-
bridgeFee:
|
|
20550
|
+
bridgeFee: E
|
|
20546
20551
|
};
|
|
20547
20552
|
}
|
|
20548
20553
|
function getSwapFromEvmTxPayload(e, t, n, a, r, s, u, i) {
|
|
20549
20554
|
const l = getWormholeChainIdById(Number(s)), c = getWormholeChainIdByName(e.fromChain);
|
|
20550
20555
|
if (c !== l)
|
|
20551
20556
|
throw new Error(`Signer chain id(${Number(s)}) and quote from chain are not same! ${c} !== ${l}`);
|
|
20552
|
-
const d = getQuoteSuitableReferrerAddress(e
|
|
20557
|
+
const d = getQuoteSuitableReferrerAddress(e);
|
|
20553
20558
|
if (e.type === "MCTP")
|
|
20554
20559
|
return getMctpFromEvmTxPayload(e, n, d, s, i);
|
|
20555
20560
|
if (e.type === "SWIFT")
|
|
@@ -20563,7 +20568,7 @@ function getSwapFromEvmTxPayload(e, t, n, a, r, s, u, i) {
|
|
|
20563
20568
|
if (!Number(e.deadline64))
|
|
20564
20569
|
throw new Error("WH mode requires a timeout");
|
|
20565
20570
|
const {
|
|
20566
|
-
relayerFees:
|
|
20571
|
+
relayerFees: p,
|
|
20567
20572
|
recipient: b,
|
|
20568
20573
|
tokenOut: m,
|
|
20569
20574
|
tokenOutWChainId: f,
|
|
@@ -20578,20 +20583,20 @@ function getSwapFromEvmTxPayload(e, t, n, a, r, s, u, i) {
|
|
|
20578
20583
|
d,
|
|
20579
20584
|
r,
|
|
20580
20585
|
s
|
|
20581
|
-
),
|
|
20582
|
-
let
|
|
20586
|
+
), I = new Contract(addresses_default.MAYAN_FORWARDER_CONTRACT, MayanForwarderArtifact_default.abi), C = new Contract(h, MayanSwapArtifact_default.abi);
|
|
20587
|
+
let E, R, $;
|
|
20583
20588
|
const N = ZeroPermit;
|
|
20584
20589
|
if (T === ZeroAddress) {
|
|
20585
|
-
const M =
|
|
20590
|
+
const M = C.interface.encodeFunctionData(
|
|
20586
20591
|
"wrapAndSwapETH",
|
|
20587
|
-
[
|
|
20592
|
+
[p, b, m, f, g]
|
|
20588
20593
|
);
|
|
20589
|
-
|
|
20594
|
+
E = "forwardEth", R = [h, M], $ = toBeHex(A);
|
|
20590
20595
|
} else {
|
|
20591
|
-
const M =
|
|
20596
|
+
const M = C.interface.encodeFunctionData(
|
|
20592
20597
|
"swap",
|
|
20593
20598
|
[
|
|
20594
|
-
|
|
20599
|
+
p,
|
|
20595
20600
|
b,
|
|
20596
20601
|
m,
|
|
20597
20602
|
f,
|
|
@@ -20600,16 +20605,16 @@ function getSwapFromEvmTxPayload(e, t, n, a, r, s, u, i) {
|
|
|
20600
20605
|
A
|
|
20601
20606
|
]
|
|
20602
20607
|
);
|
|
20603
|
-
|
|
20608
|
+
E = "forwardERC20", R = [T, A, N, h, M], $ = toBeHex(_);
|
|
20604
20609
|
}
|
|
20605
|
-
const D =
|
|
20610
|
+
const D = I.interface.encodeFunctionData(E, R);
|
|
20606
20611
|
return {
|
|
20607
20612
|
to: addresses_default.MAYAN_FORWARDER_CONTRACT,
|
|
20608
20613
|
data: D,
|
|
20609
20614
|
value: $,
|
|
20610
20615
|
chainId: s,
|
|
20611
20616
|
_forwarder: {
|
|
20612
|
-
method:
|
|
20617
|
+
method: E,
|
|
20613
20618
|
params: R
|
|
20614
20619
|
}
|
|
20615
20620
|
};
|
|
@@ -20688,9 +20693,9 @@ async function createMctpFromSuiMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20688
20693
|
e.minMiddleAmount,
|
|
20689
20694
|
CCTP_TOKEN_DECIMALS
|
|
20690
20695
|
);
|
|
20691
|
-
let d,
|
|
20696
|
+
let d, p, b;
|
|
20692
20697
|
if (e.fromToken.contract === e.mctpInputContract)
|
|
20693
|
-
d = new Transaction$1(),
|
|
20698
|
+
d = new Transaction$1(), p = await resolveInputCoin(
|
|
20694
20699
|
c,
|
|
20695
20700
|
t,
|
|
20696
20701
|
e.mctpInputContract,
|
|
@@ -20713,7 +20718,7 @@ async function createMctpFromSuiMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20713
20718
|
inputCoin: u == null ? void 0 : u.inputCoin,
|
|
20714
20719
|
transaction: void 0
|
|
20715
20720
|
});
|
|
20716
|
-
d = Transaction$1.from(g),
|
|
20721
|
+
d = Transaction$1.from(g), p = T, b = A ? { result: A } : null;
|
|
20717
20722
|
}
|
|
20718
20723
|
e.hasAuction ? await addInitOrderMoveCalls(
|
|
20719
20724
|
e,
|
|
@@ -20724,7 +20729,7 @@ async function createMctpFromSuiMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20724
20729
|
l,
|
|
20725
20730
|
s,
|
|
20726
20731
|
{
|
|
20727
|
-
inputCoin: { result:
|
|
20732
|
+
inputCoin: { result: p },
|
|
20728
20733
|
whFeeCoin: b,
|
|
20729
20734
|
builtTransaction: d
|
|
20730
20735
|
}
|
|
@@ -20735,7 +20740,7 @@ async function createMctpFromSuiMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20735
20740
|
i,
|
|
20736
20741
|
s,
|
|
20737
20742
|
{
|
|
20738
|
-
inputCoin: { result:
|
|
20743
|
+
inputCoin: { result: p },
|
|
20739
20744
|
builtTransaction: d
|
|
20740
20745
|
}
|
|
20741
20746
|
) : await addBridgeWithFeeMoveCalls(
|
|
@@ -20746,7 +20751,7 @@ async function createMctpFromSuiMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20746
20751
|
r,
|
|
20747
20752
|
s,
|
|
20748
20753
|
{
|
|
20749
|
-
inputCoin: { result:
|
|
20754
|
+
inputCoin: { result: p },
|
|
20750
20755
|
whFeeCoin: b,
|
|
20751
20756
|
builtTransaction: d
|
|
20752
20757
|
}
|
|
@@ -20793,7 +20798,7 @@ async function addBridgeWithFeeMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20793
20798
|
s,
|
|
20794
20799
|
l,
|
|
20795
20800
|
u == null ? void 0 : u.inputCoin
|
|
20796
|
-
),
|
|
20801
|
+
), p = MCTP_PAYLOAD_TYPE_DEFAULT, b = nativeAddressToHexString(n, i), m = getCCTPDomain(e.toChain), f = getAmountOfFractionalAmount(
|
|
20797
20802
|
e.gasDrop,
|
|
20798
20803
|
Math.min(getGasDecimal(e.toChain), 8)
|
|
20799
20804
|
), g = getAmountOfFractionalAmount(
|
|
@@ -20805,7 +20810,7 @@ async function addBridgeWithFeeMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20805
20810
|
function: "prepare_bridge_with_fee",
|
|
20806
20811
|
typeArguments: [e.mctpInputContract],
|
|
20807
20812
|
arguments: [
|
|
20808
|
-
l.pure.u8(
|
|
20813
|
+
l.pure.u8(p),
|
|
20809
20814
|
d,
|
|
20810
20815
|
l.pure.u64(c),
|
|
20811
20816
|
l.pure.address(b),
|
|
@@ -20825,7 +20830,7 @@ async function addBridgeWithFeeMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20825
20830
|
l.object(e.mctpVerifiedInputAddress),
|
|
20826
20831
|
A
|
|
20827
20832
|
]
|
|
20828
|
-
}), [
|
|
20833
|
+
}), [I, C] = l.moveCall({
|
|
20829
20834
|
package: addresses_default.SUI_CCTP_TOKEN_PACKAGE_ID,
|
|
20830
20835
|
module: "deposit_for_burn",
|
|
20831
20836
|
function: "deposit_for_burn_with_caller_with_package_auth",
|
|
@@ -20840,15 +20845,15 @@ async function addBridgeWithFeeMoveCalls(e, t, n, a, r, s, u) {
|
|
|
20840
20845
|
l.object("0x403"),
|
|
20841
20846
|
l.object(e.mctpInputTreasury)
|
|
20842
20847
|
]
|
|
20843
|
-
}), [
|
|
20848
|
+
}), [E] = l.moveCall({
|
|
20844
20849
|
package: a,
|
|
20845
20850
|
module: "bridge_with_fee",
|
|
20846
20851
|
function: "publish_bridge_with_fee",
|
|
20847
|
-
arguments: [l.object(addresses_default.SUI_MCTP_STATE), h,
|
|
20852
|
+
arguments: [l.object(addresses_default.SUI_MCTP_STATE), h, C]
|
|
20848
20853
|
});
|
|
20849
20854
|
return await addPublishWormholeMessage(
|
|
20850
20855
|
l,
|
|
20851
|
-
|
|
20856
|
+
E,
|
|
20852
20857
|
s,
|
|
20853
20858
|
BigInt(e.bridgeFee),
|
|
20854
20859
|
t,
|
|
@@ -20866,7 +20871,7 @@ async function addBridgeLockedFeeMoveCalls(e, t, n, a, r, s) {
|
|
|
20866
20871
|
r,
|
|
20867
20872
|
i,
|
|
20868
20873
|
s == null ? void 0 : s.inputCoin
|
|
20869
|
-
), d = nativeAddressToHexString(n, u),
|
|
20874
|
+
), d = nativeAddressToHexString(n, u), p = getCCTPDomain(e.toChain), b = getAmountOfFractionalAmount(
|
|
20870
20875
|
e.gasDrop,
|
|
20871
20876
|
Math.min(getGasDecimal(e.toChain), 8)
|
|
20872
20877
|
), m = getAmountOfFractionalAmount(
|
|
@@ -20881,7 +20886,7 @@ async function addBridgeLockedFeeMoveCalls(e, t, n, a, r, s) {
|
|
|
20881
20886
|
c,
|
|
20882
20887
|
i.pure.u64(l),
|
|
20883
20888
|
i.pure.address(d),
|
|
20884
|
-
i.pure.u32(
|
|
20889
|
+
i.pure.u32(p),
|
|
20885
20890
|
i.pure.u64(b),
|
|
20886
20891
|
i.pure.u64(m)
|
|
20887
20892
|
]
|
|
@@ -20929,7 +20934,7 @@ async function addInitOrderMoveCalls(e, t, n, a, r, s, u, i) {
|
|
|
20929
20934
|
const l = getWormholeChainIdByName(e.toChain), c = (i == null ? void 0 : i.builtTransaction) ?? new Transaction$1(), d = getAmountOfFractionalAmount(
|
|
20930
20935
|
e.minMiddleAmount,
|
|
20931
20936
|
CCTP_TOKEN_DECIMALS
|
|
20932
|
-
), [
|
|
20937
|
+
), [p] = await Promise.all([
|
|
20933
20938
|
resolveInputCoin(
|
|
20934
20939
|
d,
|
|
20935
20940
|
t,
|
|
@@ -20962,11 +20967,11 @@ async function addInitOrderMoveCalls(e, t, n, a, r, s, u, i) {
|
|
|
20962
20967
|
SystemProgram.programId.toString(),
|
|
20963
20968
|
getWormholeChainIdByName("solana")
|
|
20964
20969
|
);
|
|
20965
|
-
const
|
|
20970
|
+
const I = [
|
|
20966
20971
|
c.object(e.mctpVerifiedInputAddress),
|
|
20967
20972
|
c.pure.u8(MCTP_INIT_ORDER_PAYLOAD_ID),
|
|
20968
20973
|
c.pure.address(t),
|
|
20969
|
-
|
|
20974
|
+
p,
|
|
20970
20975
|
c.pure.address(f),
|
|
20971
20976
|
c.pure.u16(l),
|
|
20972
20977
|
c.pure.address(b),
|
|
@@ -20976,19 +20981,19 @@ async function addInitOrderMoveCalls(e, t, n, a, r, s, u, i) {
|
|
|
20976
20981
|
c.pure.u64(h),
|
|
20977
20982
|
c.pure.address(_),
|
|
20978
20983
|
c.pure.u8(e.referrerBps)
|
|
20979
|
-
], [
|
|
20984
|
+
], [C] = c.moveCall({
|
|
20980
20985
|
package: s,
|
|
20981
20986
|
module: "calculate_mctp_fee",
|
|
20982
20987
|
function: "prepare_calc_mctp_fee",
|
|
20983
20988
|
typeArguments: [e.mctpInputContract],
|
|
20984
|
-
arguments:
|
|
20985
|
-
}), [
|
|
20989
|
+
arguments: I
|
|
20990
|
+
}), [E] = c.moveCall({
|
|
20986
20991
|
package: s,
|
|
20987
20992
|
module: "calculate_mctp_fee",
|
|
20988
20993
|
function: "calculate_mctp_fee",
|
|
20989
20994
|
arguments: [
|
|
20990
20995
|
c.object(addresses_default.SUI_MCTP_FEE_MANAGER_STATE),
|
|
20991
|
-
|
|
20996
|
+
C
|
|
20992
20997
|
]
|
|
20993
20998
|
}), [R] = c.moveCall({
|
|
20994
20999
|
package: r,
|
|
@@ -20996,7 +21001,7 @@ async function addInitOrderMoveCalls(e, t, n, a, r, s, u, i) {
|
|
|
20996
21001
|
function: "prepare_initialize_order",
|
|
20997
21002
|
typeArguments: [e.mctpInputContract],
|
|
20998
21003
|
arguments: [
|
|
20999
|
-
...
|
|
21004
|
+
...I.slice(1),
|
|
21000
21005
|
c.pure.u32(g),
|
|
21001
21006
|
c.pure.u64(d)
|
|
21002
21007
|
]
|
|
@@ -21010,7 +21015,7 @@ async function addInitOrderMoveCalls(e, t, n, a, r, s, u, i) {
|
|
|
21010
21015
|
c.object(addresses_default.SUI_CCTP_CORE_STATE),
|
|
21011
21016
|
c.object(e.mctpVerifiedInputAddress),
|
|
21012
21017
|
R,
|
|
21013
|
-
|
|
21018
|
+
E
|
|
21014
21019
|
]
|
|
21015
21020
|
}), [D, M] = c.moveCall({
|
|
21016
21021
|
package: addresses_default.SUI_CCTP_TOKEN_PACKAGE_ID,
|
|
@@ -21111,8 +21116,7 @@ async function resolveInputCoin(e, t, n, a, r, s) {
|
|
|
21111
21116
|
}
|
|
21112
21117
|
async function createSwapFromSuiMoveCalls(e, t, n, a, r, s, u) {
|
|
21113
21118
|
const i = getQuoteSuitableReferrerAddress(
|
|
21114
|
-
e
|
|
21115
|
-
a
|
|
21119
|
+
e
|
|
21116
21120
|
);
|
|
21117
21121
|
if (e.type === "MCTP")
|
|
21118
21122
|
return createMctpFromSuiMoveCalls(
|
|
@@ -21143,8 +21147,8 @@ const chainNameMap = {
|
|
|
21143
21147
|
Sui: "sui"
|
|
21144
21148
|
}, testnetSupportedChainMap = {
|
|
21145
21149
|
Solana: "solana",
|
|
21146
|
-
|
|
21147
|
-
|
|
21150
|
+
Sepolia: "ethereum",
|
|
21151
|
+
BaseSepolia: "base",
|
|
21148
21152
|
Sui: "sui",
|
|
21149
21153
|
Monad: "monad"
|
|
21150
21154
|
};
|
|
@@ -21208,14 +21212,14 @@ function txStatusToReceipt(e) {
|
|
|
21208
21212
|
for (const c of possibleVaaTypes) {
|
|
21209
21213
|
const d = `${c}SignedVaa`;
|
|
21210
21214
|
if (d in e && e[d] !== null) {
|
|
21211
|
-
const
|
|
21215
|
+
const p = deserialize("Uint8Array", hex.decode(e[d]));
|
|
21212
21216
|
u[c] = {
|
|
21213
21217
|
id: {
|
|
21214
|
-
emitter:
|
|
21215
|
-
sequence:
|
|
21216
|
-
chain:
|
|
21218
|
+
emitter: p.emitterAddress,
|
|
21219
|
+
sequence: p.sequence,
|
|
21220
|
+
chain: p.emitterChain
|
|
21217
21221
|
},
|
|
21218
|
-
attestation:
|
|
21222
|
+
attestation: p
|
|
21219
21223
|
};
|
|
21220
21224
|
}
|
|
21221
21225
|
}
|
|
@@ -21327,8 +21331,43 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21327
21331
|
toMayanAddress(n) {
|
|
21328
21332
|
return isNative(n.address) ? getNativeContractAddress(n.chain) : canonicalAddress(n);
|
|
21329
21333
|
}
|
|
21334
|
+
getFeeInBaseUnits(n, a) {
|
|
21335
|
+
const { fromChain: r, source: s } = n, u = this.getReferralParameters(n), { referrerBps: i, referrer: l, isV2: c } = u, d = r.chain === "Solana";
|
|
21336
|
+
if (!i || !l || !d || !c)
|
|
21337
|
+
return 0n;
|
|
21338
|
+
const p = parse$1(a, s.decimals), b = 65535n, m = BigInt(10 * i);
|
|
21339
|
+
if (m > b)
|
|
21340
|
+
throw new Error("bps exceeds max u16");
|
|
21341
|
+
const f = getDeciBps(p, m);
|
|
21342
|
+
return units(f);
|
|
21343
|
+
}
|
|
21344
|
+
getQuoteAmountIn64(n, a) {
|
|
21345
|
+
const r = n.source.decimals, s = parse$1(a, r), u = this.getFeeInBaseUnits(n, a);
|
|
21346
|
+
if (u <= 0n)
|
|
21347
|
+
return s.amount;
|
|
21348
|
+
const l = units(s) - u;
|
|
21349
|
+
return fromBaseUnits(l, r).amount;
|
|
21350
|
+
}
|
|
21351
|
+
async injectReferralInstructionsForSolana(n, a, r, s, u) {
|
|
21352
|
+
var T;
|
|
21353
|
+
const { fromChain: i, source: l } = a, c = this.getReferralParameters(a), { isV2: d } = c, p = (T = this.referrerAddress()) == null ? void 0 : T.solana, b = this.getFeeInBaseUnits(a, u);
|
|
21354
|
+
if (!p || !b || i.network !== "Mainnet" || !d)
|
|
21355
|
+
return r;
|
|
21356
|
+
const m = [], f = new PublicKey$1(p);
|
|
21357
|
+
if (isNative(l.id.address))
|
|
21358
|
+
m.push(SystemProgram.transfer({
|
|
21359
|
+
fromPubkey: s,
|
|
21360
|
+
toPubkey: f,
|
|
21361
|
+
lamports: b
|
|
21362
|
+
}));
|
|
21363
|
+
else {
|
|
21364
|
+
const A = new PublicKey$1(l.id.address.toString()), h = await SolanaPlatform.getTokenProgramId(n, A), _ = getAssociatedTokenAddressSync(A, f, !0, h), I = getAssociatedTokenAddressSync(A, s, !0, h);
|
|
21365
|
+
await n.getAccountInfo(_) || m.push(createAssociatedTokenAccountIdempotentInstruction(s, _, f, A, h)), m.push(createTransferInstruction(I, _, s, b, void 0, h));
|
|
21366
|
+
}
|
|
21367
|
+
return m.push(...r), m;
|
|
21368
|
+
}
|
|
21330
21369
|
async fetchQuote(n, a) {
|
|
21331
|
-
var
|
|
21370
|
+
var m, f;
|
|
21332
21371
|
const { fromChain: r, toChain: s } = n;
|
|
21333
21372
|
if (this.isTestnetRequest(n)) {
|
|
21334
21373
|
if (!isTestnetSupportedChain(r.chain))
|
|
@@ -21337,7 +21376,7 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21337
21376
|
throw new Error(`Chain ${s.chain} is not supported on testnet. Supported testnet chains: ${supportedChains("Testnet").join(", ")}`);
|
|
21338
21377
|
}
|
|
21339
21378
|
const u = {
|
|
21340
|
-
|
|
21379
|
+
amountIn64: this.getQuoteAmountIn64(n, a.amount),
|
|
21341
21380
|
fromToken: this.toMayanAddress(n.source.id),
|
|
21342
21381
|
toToken: this.toMayanAddress(n.destination.id),
|
|
21343
21382
|
/* @ts-ignore */
|
|
@@ -21346,28 +21385,36 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21346
21385
|
toChain: toMayanChainName(s.network, s.chain),
|
|
21347
21386
|
...this.getDefaultOptions(),
|
|
21348
21387
|
...a.options,
|
|
21349
|
-
...this.getReferralParameters(n),
|
|
21350
21388
|
slippageBps: "auto"
|
|
21351
|
-
}, i =
|
|
21389
|
+
}, i = this.getReferralParameters(n), l = r.chain === "Solana";
|
|
21390
|
+
(!l || l && !i.isV2) && (u.referrer = i.referrer, u.referrerBps = i.referrerBps);
|
|
21391
|
+
const c = {
|
|
21352
21392
|
swift: this.protocols.includes("SWIFT"),
|
|
21353
21393
|
mctp: this.protocols.includes("MCTP"),
|
|
21354
21394
|
monoChain: this.protocols.includes("MONO_CHAIN")
|
|
21355
|
-
},
|
|
21395
|
+
}, d = new URL(this.isTestnetRequest(n) ? generateFetchQuoteUrl({
|
|
21356
21396
|
...u,
|
|
21357
21397
|
/* @ts-ignore */
|
|
21358
21398
|
fromChain: toMayanChainName(r.network, r.chain),
|
|
21359
21399
|
/* @ts-ignore */
|
|
21360
21400
|
toChain: toMayanChainName(s.network, s.chain)
|
|
21361
|
-
},
|
|
21362
|
-
if (!
|
|
21401
|
+
}, c) : generateFetchQuoteUrl$1(u, c));
|
|
21402
|
+
if (!d)
|
|
21363
21403
|
throw new Error("Unable to generate fetch quote URL");
|
|
21364
|
-
|
|
21365
|
-
const
|
|
21366
|
-
if (
|
|
21367
|
-
throw new Error("Unable to fetch quote", { cause:
|
|
21368
|
-
const
|
|
21369
|
-
if (!(!
|
|
21370
|
-
return
|
|
21404
|
+
d.searchParams.has("fullList") || d.searchParams.append("fullList", "true");
|
|
21405
|
+
const p = await axios.get(d.toString());
|
|
21406
|
+
if (p.status !== 200)
|
|
21407
|
+
throw new Error("Unable to fetch quote", { cause: p });
|
|
21408
|
+
const b = (f = (m = p.data) == null ? void 0 : m.quotes) == null ? void 0 : f.filter((g) => this.protocols.includes(g.type));
|
|
21409
|
+
if (!(!b || b.length === 0))
|
|
21410
|
+
return b.length === 1 || b.sort((g, T) => a.options.optimizeFor === "cost" ? T.expectedAmountOut === g.expectedAmountOut ? g.etaSeconds - T.etaSeconds : T.expectedAmountOut - g.expectedAmountOut : a.options.optimizeFor === "speed" ? g.etaSeconds === T.etaSeconds ? T.expectedAmountOut - g.expectedAmountOut : g.etaSeconds - T.etaSeconds : 0), b[0];
|
|
21411
|
+
}
|
|
21412
|
+
getMinAmount(n, a) {
|
|
21413
|
+
try {
|
|
21414
|
+
return parse$1(n, a);
|
|
21415
|
+
} catch {
|
|
21416
|
+
return null;
|
|
21417
|
+
}
|
|
21371
21418
|
}
|
|
21372
21419
|
async quote(n, a) {
|
|
21373
21420
|
var r, s;
|
|
@@ -21384,13 +21431,13 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21384
21431
|
address: Wormhole.parseAddress("Solana", usdcContract.get(n.fromChain.network, "Solana"))
|
|
21385
21432
|
},
|
|
21386
21433
|
amount: parse$1(denoise(u.clientRelayerFeeSuccess || "0", 6), 6)
|
|
21387
|
-
}, l =
|
|
21434
|
+
}, l = parseInt(u.deadline64, 10) * 1e3, c = l ? new Date(l) : void 0;
|
|
21388
21435
|
return {
|
|
21389
21436
|
success: !0,
|
|
21390
21437
|
params: a,
|
|
21391
21438
|
sourceToken: {
|
|
21392
21439
|
token: n.source.id,
|
|
21393
|
-
amount:
|
|
21440
|
+
amount: fromBaseUnits(BigInt(u.effectiveAmountIn64), u.fromToken.decimals)
|
|
21394
21441
|
},
|
|
21395
21442
|
destinationToken: {
|
|
21396
21443
|
token: n.destination.id,
|
|
@@ -21400,20 +21447,18 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21400
21447
|
destinationNativeGas: parse$1(denoise(u.gasDrop, u.toToken.decimals), u.toToken.decimals),
|
|
21401
21448
|
eta: u.etaSeconds * 1e3,
|
|
21402
21449
|
details: u,
|
|
21403
|
-
expires:
|
|
21450
|
+
expires: c
|
|
21404
21451
|
};
|
|
21405
21452
|
} catch (u) {
|
|
21406
21453
|
if (axios.isAxiosError(u)) {
|
|
21407
21454
|
const i = (r = u == null ? void 0 : u.response) == null ? void 0 : r.data;
|
|
21408
21455
|
if ((i == null ? void 0 : i.code) === "AMOUNT_TOO_SMALL") {
|
|
21409
|
-
const l = (s = i == null ? void 0 : i.data) == null ? void 0 : s.minAmountIn;
|
|
21410
|
-
if (
|
|
21411
|
-
const c = parse$1(l, n.source.decimals);
|
|
21456
|
+
const l = (s = i == null ? void 0 : i.data) == null ? void 0 : s.minAmountIn, c = this.getMinAmount(l, n.source.decimals);
|
|
21457
|
+
if (c)
|
|
21412
21458
|
return {
|
|
21413
21459
|
success: !1,
|
|
21414
21460
|
error: new MinAmountError(c)
|
|
21415
21461
|
};
|
|
21416
|
-
}
|
|
21417
21462
|
}
|
|
21418
21463
|
if (i != null && i.msg)
|
|
21419
21464
|
return {
|
|
@@ -21428,104 +21473,84 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21428
21473
|
}
|
|
21429
21474
|
}
|
|
21430
21475
|
async initiate(n, a, r, s) {
|
|
21431
|
-
const u = a.address(),
|
|
21476
|
+
const u = this.getReferralParameters(n), { isV2: i } = u, l = this.referrerAddress(), c = a.address(), d = canonicalAddress(s);
|
|
21432
21477
|
try {
|
|
21433
|
-
const
|
|
21478
|
+
const p = await n.fromChain.getRpc(), b = [];
|
|
21434
21479
|
if (n.fromChain.chain === "Solana") {
|
|
21435
|
-
const { instructions:
|
|
21436
|
-
instructions:
|
|
21437
|
-
payerKey: new PublicKey$1(
|
|
21480
|
+
const { instructions: m, signers: f, lookupTables: g } = await (this.isTestnetRequest(n) ? createSwapFromSolanaInstructions(this.normalizeQuoteForTestnet(r.details), c, d, null, p, { allowSwapperOffCurve: !0 }) : createSwapFromSolanaInstructions$1(r.details, c, d, i ? null : l, p, { allowSwapperOffCurve: !0 })), T = new PublicKey$1(c), A = MessageV0.compile({
|
|
21481
|
+
instructions: await this.injectReferralInstructionsForSolana(p, n, m, T, r.params.amount),
|
|
21482
|
+
payerKey: new PublicKey$1(c),
|
|
21438
21483
|
recentBlockhash: "",
|
|
21439
|
-
addressLookupTableAccounts:
|
|
21440
|
-
}),
|
|
21484
|
+
addressLookupTableAccounts: g
|
|
21485
|
+
}), h = [
|
|
21441
21486
|
new SolanaUnsignedTransaction({
|
|
21442
|
-
transaction: new VersionedTransaction(
|
|
21443
|
-
signers:
|
|
21487
|
+
transaction: new VersionedTransaction(A),
|
|
21488
|
+
signers: f
|
|
21444
21489
|
}, n.fromChain.network, n.fromChain.chain, "Execute Swap")
|
|
21445
21490
|
];
|
|
21446
21491
|
if (isSignAndSendSigner(a)) {
|
|
21447
|
-
const
|
|
21448
|
-
|
|
21492
|
+
const _ = await a.signAndSend(h);
|
|
21493
|
+
b.push(..._.map((I) => ({
|
|
21449
21494
|
chain: n.fromChain.chain,
|
|
21450
|
-
txid:
|
|
21495
|
+
txid: I
|
|
21451
21496
|
})));
|
|
21452
21497
|
} else if (isSignOnlySigner(a)) {
|
|
21453
|
-
const
|
|
21454
|
-
|
|
21498
|
+
const _ = await a.sign(h), I = await SolanaPlatform.sendWait(n.fromChain.chain, p, _);
|
|
21499
|
+
b.push(...I.map((C) => ({
|
|
21455
21500
|
chain: n.fromChain.chain,
|
|
21456
|
-
txid:
|
|
21501
|
+
txid: C
|
|
21457
21502
|
})));
|
|
21458
21503
|
}
|
|
21459
21504
|
} else if (n.fromChain.chain === "Sui") {
|
|
21460
|
-
const
|
|
21461
|
-
new SuiUnsignedTransaction(
|
|
21505
|
+
const m = await (this.isTestnetRequest(n) ? createSwapFromSuiMoveCalls(this.normalizeQuoteForTestnet(r.details), c, d, null, void 0, p) : createSwapFromSuiMoveCalls$1(r.details, c, d, l, void 0, p)), f = [
|
|
21506
|
+
new SuiUnsignedTransaction(m, n.fromChain.network, n.fromChain.chain, "Execute Swap")
|
|
21462
21507
|
];
|
|
21463
21508
|
if (isSignAndSendSigner(a)) {
|
|
21464
|
-
const
|
|
21465
|
-
|
|
21509
|
+
const g = await a.signAndSend(f);
|
|
21510
|
+
b.push(...g.map((T) => ({
|
|
21466
21511
|
chain: n.fromChain.chain,
|
|
21467
|
-
txid:
|
|
21512
|
+
txid: T
|
|
21468
21513
|
})));
|
|
21469
21514
|
} else if (isSignOnlySigner(a)) {
|
|
21470
|
-
const
|
|
21471
|
-
|
|
21515
|
+
const g = await a.sign(f), T = await SuiPlatform.sendWait(n.fromChain.chain, p, g);
|
|
21516
|
+
b.push(...T.map((A) => ({
|
|
21472
21517
|
chain: n.fromChain.chain,
|
|
21473
|
-
txid:
|
|
21518
|
+
txid: A
|
|
21474
21519
|
})));
|
|
21475
21520
|
}
|
|
21476
21521
|
} else {
|
|
21477
|
-
const
|
|
21522
|
+
const m = [], f = networkChainToNativeChainId.get(n.fromChain.network, n.fromChain.chain);
|
|
21478
21523
|
if (!isNative(n.source.id.address)) {
|
|
21479
|
-
const
|
|
21480
|
-
if (
|
|
21481
|
-
const
|
|
21524
|
+
const T = EvmPlatform.getTokenImplementation(await n.fromChain.getRpc(), this.toMayanAddress(n.source.id)), A = addresses_default$1.MAYAN_FORWARDER_CONTRACT, h = await T.allowance(c, A), _ = units(r.sourceToken.amount);
|
|
21525
|
+
if (h < _) {
|
|
21526
|
+
const I = await T.approve.populateTransaction(
|
|
21482
21527
|
// mayan contract address,
|
|
21483
|
-
|
|
21484
|
-
|
|
21528
|
+
A,
|
|
21529
|
+
_
|
|
21485
21530
|
);
|
|
21486
|
-
|
|
21531
|
+
m.push(new EvmUnsignedTransaction({
|
|
21487
21532
|
from: a.address(),
|
|
21488
|
-
chainId:
|
|
21489
|
-
...
|
|
21533
|
+
chainId: f,
|
|
21534
|
+
...I
|
|
21490
21535
|
}, n.fromChain.network, n.fromChain.chain, "Approve Allowance"));
|
|
21491
21536
|
}
|
|
21492
21537
|
}
|
|
21493
|
-
const
|
|
21494
|
-
|
|
21495
|
-
u,
|
|
21496
|
-
i,
|
|
21497
|
-
this.referrerAddress(),
|
|
21498
|
-
u,
|
|
21499
|
-
Number(y),
|
|
21500
|
-
void 0,
|
|
21501
|
-
void 0
|
|
21502
|
-
// permit?
|
|
21503
|
-
) : getSwapFromEvmTxPayload$1(
|
|
21504
|
-
r.details,
|
|
21505
|
-
u,
|
|
21506
|
-
i,
|
|
21507
|
-
this.referrerAddress(),
|
|
21508
|
-
u,
|
|
21509
|
-
Number(y),
|
|
21510
|
-
void 0,
|
|
21511
|
-
void 0
|
|
21512
|
-
// permit?
|
|
21513
|
-
);
|
|
21514
|
-
if (d.push(new EvmUnsignedTransaction({
|
|
21538
|
+
const g = this.isTestnetRequest(n) ? getSwapFromEvmTxPayload(this.normalizeQuoteForTestnet(r.details), c, d, null, c, Number(f), void 0, void 0) : getSwapFromEvmTxPayload$1(r.details, c, d, l, c, Number(f), void 0, void 0);
|
|
21539
|
+
if (m.push(new EvmUnsignedTransaction({
|
|
21515
21540
|
from: a.address(),
|
|
21516
|
-
chainId:
|
|
21517
|
-
...
|
|
21541
|
+
chainId: f,
|
|
21542
|
+
...g
|
|
21518
21543
|
}, n.fromChain.network, n.fromChain.chain, "Execute Swap")), isSignAndSendSigner(a)) {
|
|
21519
|
-
const
|
|
21520
|
-
|
|
21544
|
+
const T = await a.signAndSend(m);
|
|
21545
|
+
b.push(...T.map((A) => ({
|
|
21521
21546
|
chain: n.fromChain.chain,
|
|
21522
|
-
txid:
|
|
21547
|
+
txid: A
|
|
21523
21548
|
})));
|
|
21524
21549
|
} else if (isSignOnlySigner(a)) {
|
|
21525
|
-
const
|
|
21526
|
-
|
|
21550
|
+
const T = await a.sign(m), A = await EvmPlatform.sendWait(n.fromChain.chain, p, T);
|
|
21551
|
+
b.push(...A.map((h) => ({
|
|
21527
21552
|
chain: n.fromChain.chain,
|
|
21528
|
-
txid:
|
|
21553
|
+
txid: h
|
|
21529
21554
|
})));
|
|
21530
21555
|
}
|
|
21531
21556
|
}
|
|
@@ -21533,10 +21558,10 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21533
21558
|
from: n.fromChain.chain,
|
|
21534
21559
|
to: n.toChain.chain,
|
|
21535
21560
|
state: TransferState.SourceInitiated,
|
|
21536
|
-
originTxs:
|
|
21561
|
+
originTxs: b
|
|
21537
21562
|
};
|
|
21538
|
-
} catch (
|
|
21539
|
-
throw console.error(
|
|
21563
|
+
} catch (p) {
|
|
21564
|
+
throw console.error(p), p;
|
|
21540
21565
|
}
|
|
21541
21566
|
}
|
|
21542
21567
|
async *track(n, a) {
|
|
@@ -21571,10 +21596,12 @@ class MayanRouteBase extends AutomaticRoute {
|
|
|
21571
21596
|
};
|
|
21572
21597
|
}
|
|
21573
21598
|
getReferralParameters(n) {
|
|
21574
|
-
const { referrers: a, getReferrerBps: r } = this.constructor;
|
|
21599
|
+
const { referrers: a, getReferrerBps: r, isV2: s } = this.constructor;
|
|
21575
21600
|
return !!(a != null && a.Solana) && typeof r == "function" ? {
|
|
21576
21601
|
referrer: a.Solana,
|
|
21577
|
-
|
|
21602
|
+
// Mayan referrer system expects solana
|
|
21603
|
+
referrerBps: r(n),
|
|
21604
|
+
isV2: s
|
|
21578
21605
|
} : {};
|
|
21579
21606
|
}
|
|
21580
21607
|
}
|