@tcswap/plugins 4.2.15

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.
Files changed (100) hide show
  1. package/dist/chainflip/index.cjs +4 -0
  2. package/dist/chainflip/index.cjs.map +11 -0
  3. package/dist/chainflip/index.js +4 -0
  4. package/dist/chainflip/index.js.map +11 -0
  5. package/dist/chunk-vzvcxw96.js +5 -0
  6. package/dist/chunk-vzvcxw96.js.map +10 -0
  7. package/dist/chunk-zweecvg1.js +4 -0
  8. package/dist/chunk-zweecvg1.js.map +10 -0
  9. package/dist/evm/index.cjs +4 -0
  10. package/dist/evm/index.cjs.map +10 -0
  11. package/dist/evm/index.js +4 -0
  12. package/dist/evm/index.js.map +10 -0
  13. package/dist/garden/index.cjs +4 -0
  14. package/dist/garden/index.cjs.map +10 -0
  15. package/dist/garden/index.js +4 -0
  16. package/dist/garden/index.js.map +10 -0
  17. package/dist/index.cjs +4 -0
  18. package/dist/index.cjs.map +10 -0
  19. package/dist/index.js +4 -0
  20. package/dist/index.js.map +10 -0
  21. package/dist/near/index.cjs +4 -0
  22. package/dist/near/index.cjs.map +11 -0
  23. package/dist/near/index.js +4 -0
  24. package/dist/near/index.js.map +11 -0
  25. package/dist/radix/index.cjs +4 -0
  26. package/dist/radix/index.cjs.map +10 -0
  27. package/dist/radix/index.js +4 -0
  28. package/dist/radix/index.js.map +10 -0
  29. package/dist/solana/index.cjs +4 -0
  30. package/dist/solana/index.cjs.map +10 -0
  31. package/dist/solana/index.js +4 -0
  32. package/dist/solana/index.js.map +10 -0
  33. package/dist/thorchain/index.cjs +4 -0
  34. package/dist/thorchain/index.cjs.map +11 -0
  35. package/dist/thorchain/index.js +4 -0
  36. package/dist/thorchain/index.js.map +11 -0
  37. package/dist/types/chainflip/broker.d.ts +23 -0
  38. package/dist/types/chainflip/broker.d.ts.map +1 -0
  39. package/dist/types/chainflip/index.d.ts +4 -0
  40. package/dist/types/chainflip/index.d.ts.map +1 -0
  41. package/dist/types/chainflip/plugin.d.ts +13 -0
  42. package/dist/types/chainflip/plugin.d.ts.map +1 -0
  43. package/dist/types/chainflip/types.d.ts +41 -0
  44. package/dist/types/chainflip/types.d.ts.map +1 -0
  45. package/dist/types/evm/index.d.ts +21 -0
  46. package/dist/types/evm/index.d.ts.map +1 -0
  47. package/dist/types/garden/index.d.ts +2 -0
  48. package/dist/types/garden/index.d.ts.map +1 -0
  49. package/dist/types/garden/plugin.d.ts +21 -0
  50. package/dist/types/garden/plugin.d.ts.map +1 -0
  51. package/dist/types/index.d.ts +8 -0
  52. package/dist/types/index.d.ts.map +1 -0
  53. package/dist/types/near/index.d.ts +3 -0
  54. package/dist/types/near/index.d.ts.map +1 -0
  55. package/dist/types/near/nearNames.d.ts +3 -0
  56. package/dist/types/near/nearNames.d.ts.map +1 -0
  57. package/dist/types/near/plugin.d.ts +22 -0
  58. package/dist/types/near/plugin.d.ts.map +1 -0
  59. package/dist/types/near/types.d.ts +12 -0
  60. package/dist/types/near/types.d.ts.map +1 -0
  61. package/dist/types/radix/index.d.ts +13 -0
  62. package/dist/types/radix/index.d.ts.map +1 -0
  63. package/dist/types/solana/index.d.ts +2 -0
  64. package/dist/types/solana/index.d.ts.map +1 -0
  65. package/dist/types/solana/plugin.d.ts +13 -0
  66. package/dist/types/solana/plugin.d.ts.map +1 -0
  67. package/dist/types/thorchain/index.d.ts +4 -0
  68. package/dist/types/thorchain/index.d.ts.map +1 -0
  69. package/dist/types/thorchain/plugin.d.ts +110 -0
  70. package/dist/types/thorchain/plugin.d.ts.map +1 -0
  71. package/dist/types/thorchain/shared.d.ts +21 -0
  72. package/dist/types/thorchain/shared.d.ts.map +1 -0
  73. package/dist/types/thorchain/types.d.ts +64 -0
  74. package/dist/types/thorchain/types.d.ts.map +1 -0
  75. package/dist/types/types.d.ts +19 -0
  76. package/dist/types/types.d.ts.map +1 -0
  77. package/dist/types/utils.d.ts +20 -0
  78. package/dist/types/utils.d.ts.map +1 -0
  79. package/package.json +88 -0
  80. package/src/chainflip/broker.ts +116 -0
  81. package/src/chainflip/index.ts +3 -0
  82. package/src/chainflip/plugin.ts +56 -0
  83. package/src/chainflip/types.ts +37 -0
  84. package/src/evm/index.ts +49 -0
  85. package/src/garden/index.ts +1 -0
  86. package/src/garden/plugin.ts +50 -0
  87. package/src/index.ts +41 -0
  88. package/src/near/index.ts +2 -0
  89. package/src/near/nearNames.ts +37 -0
  90. package/src/near/plugin.ts +214 -0
  91. package/src/near/types.ts +9 -0
  92. package/src/radix/index.ts +28 -0
  93. package/src/solana/index.ts +1 -0
  94. package/src/solana/plugin.ts +30 -0
  95. package/src/thorchain/index.ts +3 -0
  96. package/src/thorchain/plugin.ts +491 -0
  97. package/src/thorchain/shared.ts +17 -0
  98. package/src/thorchain/types.ts +59 -0
  99. package/src/types.ts +26 -0
  100. package/src/utils.ts +46 -0
@@ -0,0 +1,4 @@
1
+ import{a as Hx,b as Jx,c as C}from"../chunk-vzvcxw96.js";import{ApproveMode as g,AssetValue as O,Chain as Z,EVMChains as Lx,FeeOption as S,getChainConfig as m,getMemoForDeposit as F,getMemoForLeaveAndBond as Qx,getMemoForNamePreferredAssetRegister as Rx,getMemoForNameRegister as Xx,getMemoForTcyClaim as Yx,getMemoForTcyStake as c,getMemoForUnbond as Zx,getMemoForWithdraw as $x,getMinAmountByChain as h,MemoType as U,ProviderName as T,USwapError as X,wrapWithThrow as M}from"@tcswap/helpers";import{USwapApi as V}from"@tcswap/helpers/api";import{MayaArbitrumVaultAbi as jx,MayaEthereumVaultAbi as Gx,TCAvalancheDepositABI as _x,TCBaseDepositABI as kx,TCBscDepositABI as Kx,TCEthereumVaultAbi as Nx}from"@tcswap/helpers/contracts";import{Chain as zx}from"@tcswap/helpers";function W({chain:Q,address:P}){if(!P)return!1;return Q===zx.Bitcoin?!P.startsWith("bc1p"):!0}function A({assetValue:Q,from:P,memo:R="",...I}){return{...I,assetValue:Q,from:P,memo:R}}var Ox={[S.Average]:1.2,[S.Fast]:1.5,[S.Fastest]:2},Px={[Z.Avalanche]:_x,[Z.Base]:kx,[Z.BinanceSmartChain]:Kx,[Z.Ethereum]:Nx},Ix={[Z.Arbitrum]:jx,[Z.Ethereum]:Gx},fx=C({methods:p(Z.THORChain),name:"thorchain",properties:{supportedUSwapProviders:[T.THORCHAIN,T.THORCHAIN_STREAMING]}}),Bx=C({methods:p(Z.Maya),name:"mayachain",properties:{supportedUSwapProviders:[T.MAYACHAIN,T.MAYACHAIN_STREAMING]}});function vx(Q){return async function(R){if(Q==="thorchain"&&R===Z.THORChain||Q==="mayachain"&&R===Z.Maya)return{address:"",chain:R,dust_threshold:"0",gas_rate:"0",halted:!1,router:""};let $=(await V.thornode.getInboundAddresses(Q)).find((D)=>D.chain===R);if(!$)throw new X("core_inbound_data_not_found");if($?.halted)throw new X("core_chain_halted");return $}}function p(Q){return function({getWallet:R}){let I=Q===Z.Maya?"mayachain":"thorchain",$=vx(I);async function D({assetValue:x,type:q="checkOnly"}){let z=(await $(x.chain)).router,H=x.chain,L=Lx.includes(H);if(L&&x.isGasAsset||!L||x.isSynthetic)return Promise.resolve(q==="checkOnly"?!0:"approved");let Y=R(H);if(!Y)throw new X("core_wallet_connection_not_found");let j=q==="checkOnly"?Y.isApproved:Y.approve;if(!(x.address&&Y.address))throw new X("core_approve_asset_address_or_from_not_found");return j({amount:x.getBaseValue("bigint"),assetAddress:x.address,from:Y.address,spenderAddress:z})}async function k({assetValue:x,recipient:q,router:z,...H}){let L=I==="thorchain"?Px:Ix,{chain:J,symbol:Y,ticker:j}=x,f=R(J);if(!f)throw new X("core_wallet_connection_not_found");let{address:B}=f;if(!W({address:B,chain:J}))throw new X("core_transaction_invalid_sender_address");let N=A({assetValue:x,from:B,recipient:q,router:z,...H});try{let G=L?.[J];if(!G){let v=R(J);return Q===J&&q===""?v.deposit(N):v.transfer(N)}let{getChecksumAddressFromAsset:_}=await import("@tcswap/toolboxes/evm");return R(J).call({abi:G,contractAddress:z||(await $(J)).router,funcName:"depositWithExpiry",funcParams:[q,_({chain:J,symbol:Y,ticker:j},J),x.getBaseValue("string"),N.memo,H.expiration||Number.parseInt(`${(Date.now()+900000)/1000}`,10)],txOverrides:{from:N.from,value:x.isGasAsset?x.getBaseValue("bigint"):void 0}})}catch(G){let _=typeof G==="string"?G.toLowerCase():G?.message.toLowerCase(),E=_?.includes("insufficient funds"),v=_?.includes("gas"),w=_?.includes("server"),qx=_?.includes("user rejected");throw new X(E?"core_transaction_deposit_insufficient_funds_error":v?"core_transaction_deposit_gas_error":w?"core_transaction_deposit_server_error":qx?"core_transaction_user_rejected":"core_transaction_deposit_error",G)}}async function b({memo:x,assetValue:q}){let z=await V.thornode.getMimirInfo(I);if(z.HALTCHAINGLOBAL>=1||z.HALTTHORCHAIN>=1)throw new X("thorchain_chain_halted");return k({assetValue:q,memo:x,recipient:""})}async function K({assetValue:x,memo:q,feeOptionKey:z=S.Fast}){let{gas_rate:H="0",router:L,address:J}=await $(x.chain);return k({assetValue:x,feeRate:Number.parseInt(H,10)*Ox[z],memo:q,recipient:J,router:L})}function d({assetValue:x}){return D({assetValue:x,type:g.Approve})}function n({assetValue:x}){return D({assetValue:x,type:g.CheckOnly})}function u({assetValue:x,...q}){return b({assetValue:x,memo:Xx(q)})}function r({assetValue:x,payoutAddress:q,name:z,ownerAddress:H}){let L=q||R(x.chain)?.address;if(!L)throw new X("thorchain_preferred_asset_payout_required");return b({assetValue:O.from({chain:Q}),memo:Rx({asset:x.toString(),chain:x.chain,name:z,owner:H,payout:L})})}function o({type:x,assetValue:q,address:z}){let H=x===U.UNBOND?Zx({address:z,unbondAmount:q.getBaseValue("number")}):Qx({address:z,type:x}),L=x===U.BOND?q:h(Q);return b({assetValue:L,memo:H})}async function i({baseAssetValue:x,assetValue:q}){if(x.lte(0)||q.lte(0))throw new X("core_transaction_create_liquidity_invalid_params");let z=R(q.chain).address,H=R(Q).address,L=await M(()=>{return K({assetValue:x,memo:F({...q,address:z})})},"core_transaction_create_liquidity_base_error");return{assetTx:await M(()=>{return K({assetValue:q,memo:F({...q,address:H})})},"core_transaction_create_liquidity_asset_error"),baseAssetTx:L}}function l({assetValue:x,poolAddress:q,address:z,symmetric:H}){if(H&&!z)throw new X("core_transaction_add_liquidity_invalid_params");let L=F({address:H?z:"",chain:q.split(".")[0],symbol:q.split(".")[1]});return K({assetValue:x,memo:L})}async function t({baseAssetValue:x,assetValue:q,baseAssetAddr:z,assetAddr:H,isPendingSymmAsset:L,mode:J="sym"}){let{chain:Y,symbol:j}=q,f=J==="sym",B=x?.gt(0)&&(f||J==="baseAsset"),y=q?.gt(0)&&(f||J==="asset"),N=L||B,G=R(Q).address,_=N?z||G:"",E=f||J==="asset"?H||R(Y).address:"";if(!(B||y))throw new X("core_transaction_add_liquidity_invalid_params");if(N&&!_)throw new X("core_transaction_add_liquidity_base_address");let v=B&&x?await M(()=>{return K({assetValue:x,memo:F({address:E,chain:Y,symbol:j})})},"core_transaction_add_liquidity_base_error"):void 0;return{assetTx:y&&q?await M(()=>{return K({assetValue:q,memo:F({address:_,chain:Y,symbol:j})})},"core_transaction_add_liquidity_asset_error"):void 0,baseAssetTx:v}}function s({memo:x,assetValue:q,percent:z,from:H,to:L}){let J=L==="baseAsset"&&H!=="baseAsset"?O.from({chain:Q}):H==="sym"&&L==="sym"||H==="baseAsset"||H==="asset"?void 0:q,Y=h(H==="asset"?q.chain:Q),j=x||$x({basisPoints:Math.min(1e4,Math.round(z*100)),chain:q.chain,symbol:q.symbol,targetAsset:J?.toString(),ticker:q.ticker});return K({assetValue:Y,memo:j})}async function a({chain:x,thorAddress:q}){let z=await $(x),H=z.dust_threshold,{baseDecimal:L}=m(x),{baseDecimal:J}=m(Z.THORChain);return k({assetValue:O.from({chain:x,fromBaseDecimal:Math.min(L,J),value:x!==Z.THORChain?H:0}),memo:Yx(U.CLAIM_TCY,{address:q}),recipient:z.address,router:z.router})}function e(x){if(x.type==="stake"){if(x.assetValue.toString()!=="THOR.TCY")throw new X("thorchain_asset_is_not_tcy");return k({assetValue:x.assetValue,memo:c(U.STAKE_TCY,{}),recipient:""})}return k({assetValue:O.from({chain:Z.THORChain}),memo:c(U.UNSTAKE_TCY,{unstakeBps:x.unstakeBps}),recipient:""})}async function xx({feeOptionKey:x,route:q}){let{memo:z,expiration:H,targetAddress:L}=q,J=await O.from({asset:q.sellAsset,asyncTokenLookup:!0,value:q.sellAmount});if(!J)throw new X("core_swap_asset_not_recognized");if(!W({address:q.destinationAddress,chain:O.from({asset:q.buyAsset}).chain}))throw new X("core_transaction_invalid_recipient_address");let{address:j}=await $(J.chain);return k({assetValue:J,expiration:Number(H),feeOptionKey:x,memo:z,recipient:j,router:L})}return{addLiquidity:t,addLiquidityPart:l,approveAssetValue:d,claimTcy:a,createLiquidity:i,deposit:k,depositToPool:K,getInboundDataByChain:$,isAssetValueApproved:n,nodeAction:o,registerName:u,registerPreferredAsset:r,stakeTcyAction:e,swap:xx,withdraw:s}}}export{W as validateAddressType,fx as ThorchainPlugin,Bx as MayachainPlugin};
2
+
3
+ //# debugId=494A228AB6F0FC1064756E2164756E21
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/thorchain/plugin.ts", "../src/thorchain/shared.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport {\n ApproveMode,\n type ApproveReturnType,\n AssetValue,\n Chain,\n type ErrorKeys,\n type EVMChain,\n EVMChains,\n FeeOption,\n getChainConfig,\n getMemoForDeposit,\n getMemoForLeaveAndBond,\n getMemoForNamePreferredAssetRegister,\n getMemoForNameRegister,\n getMemoForTcyClaim,\n getMemoForTcyStake,\n getMemoForUnbond,\n getMemoForWithdraw,\n getMinAmountByChain,\n MemoType,\n ProviderName,\n type SwapParams,\n type TCLikeChain,\n USwapError,\n wrapWithThrow,\n} from \"@tcswap/helpers\";\nimport { type InboundAddressesItem, type QuoteResponseRoute, type THORNodeType, USwapApi } from \"@tcswap/helpers/api\";\nimport {\n MayaArbitrumVaultAbi,\n MayaEthereumVaultAbi,\n TCAvalancheDepositABI,\n TCBaseDepositABI,\n TCBscDepositABI,\n TCEthereumVaultAbi,\n} from \"@tcswap/helpers/contracts\";\nimport type { SwapKitPluginParams } from \"../types\";\nimport { createPlugin } from \"../utils\";\nimport { prepareTxParams, validateAddressType } from \"./shared\";\nimport type {\n AddLiquidityParams,\n AddLiquidityPartParams,\n CoreTxParams,\n CreateLiquidityParams,\n NodeActionParams,\n RegisterThornameParams,\n WithdrawParams,\n} from \"./types\";\n\nconst gasFeeMultiplier: Record<FeeOption, number> = {\n [FeeOption.Average]: 1.2,\n [FeeOption.Fast]: 1.5,\n [FeeOption.Fastest]: 2,\n};\n\nconst TCSpecificAbi = {\n [Chain.Avalanche]: TCAvalancheDepositABI,\n [Chain.Base]: TCBaseDepositABI,\n [Chain.BinanceSmartChain]: TCBscDepositABI,\n [Chain.Ethereum]: TCEthereumVaultAbi,\n};\n\nconst MayaSpecificAbi = { [Chain.Arbitrum]: MayaArbitrumVaultAbi, [Chain.Ethereum]: MayaEthereumVaultAbi };\n\nexport const ThorchainPlugin = createPlugin({\n methods: createTCBasedPlugin(Chain.THORChain),\n name: \"thorchain\",\n properties: { supportedUSwapProviders: [ProviderName.THORCHAIN, ProviderName.THORCHAIN_STREAMING] as const },\n});\n\nexport const MayachainPlugin = createPlugin({\n methods: createTCBasedPlugin(Chain.Maya),\n name: \"mayachain\",\n properties: { supportedUSwapProviders: [ProviderName.MAYACHAIN, ProviderName.MAYACHAIN_STREAMING] as const },\n});\n\nfunction getInboundDataFunction(type?: THORNodeType) {\n return async function getInboundDataByChain<T extends Chain>(chain: T) {\n if ((type === \"thorchain\" && chain === Chain.THORChain) || (type === \"mayachain\" && chain === Chain.Maya)) {\n return {\n address: \"\",\n chain,\n dust_threshold: \"0\",\n gas_rate: \"0\",\n halted: false,\n router: \"\",\n } as InboundAddressesItem;\n }\n\n const inboundData = await USwapApi.thornode.getInboundAddresses(type);\n const chainAddressData = inboundData.find((item) => item.chain === chain);\n\n if (!chainAddressData) throw new USwapError(\"core_inbound_data_not_found\");\n if (chainAddressData?.halted) throw new USwapError(\"core_chain_halted\");\n\n return chainAddressData;\n };\n}\n\nfunction createTCBasedPlugin<T extends TCLikeChain>(pluginChain: T) {\n return function plugin({ getWallet }: SwapKitPluginParams) {\n const pluginType = pluginChain === Chain.Maya ? \"mayachain\" : \"thorchain\";\n const getInboundDataByChain = getInboundDataFunction(pluginType);\n\n async function approve<T extends ApproveMode>({\n assetValue,\n type = \"checkOnly\" as T,\n }: {\n type: T;\n assetValue: AssetValue;\n }) {\n const router = (await getInboundDataByChain(assetValue.chain)).router as string;\n\n const chain = assetValue.chain as EVMChain;\n\n const isEVMChain = EVMChains.includes(chain as EVMChain);\n const isNativeEVM = isEVMChain && assetValue.isGasAsset;\n\n if (isNativeEVM || !isEVMChain || assetValue.isSynthetic) {\n return Promise.resolve(type === \"checkOnly\" ? true : \"approved\") as ApproveReturnType<T>;\n }\n\n const wallet = getWallet(chain);\n\n if (!wallet) {\n throw new USwapError(\"core_wallet_connection_not_found\");\n }\n\n const walletAction = type === \"checkOnly\" ? wallet.isApproved : wallet.approve;\n\n if (!(assetValue.address && wallet.address)) {\n throw new USwapError(\"core_approve_asset_address_or_from_not_found\");\n }\n\n return walletAction({\n amount: assetValue.getBaseValue(\"bigint\"),\n assetAddress: assetValue.address,\n from: wallet.address,\n spenderAddress: router,\n });\n }\n\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: TODO\n async function deposit({ assetValue, recipient, router, ...rest }: CoreTxParams & { router?: string }) {\n const abis = pluginType === \"thorchain\" ? TCSpecificAbi : MayaSpecificAbi;\n const { chain, symbol, ticker } = assetValue;\n\n const wallet = getWallet(chain);\n if (!wallet) {\n throw new USwapError(\"core_wallet_connection_not_found\");\n }\n const { address } = wallet;\n const isAddressValidated = validateAddressType({ address, chain });\n if (!isAddressValidated) {\n throw new USwapError(\"core_transaction_invalid_sender_address\");\n }\n\n const params = prepareTxParams({ assetValue, from: address, recipient, router, ...rest });\n\n try {\n const abi = abis?.[chain as keyof typeof abis];\n\n if (!abi) {\n const wallet = getWallet(chain as TCLikeChain);\n const shouldDeposit = pluginChain === chain && recipient === \"\";\n // @Towan: Is that the same action? :)\n return shouldDeposit ? wallet.deposit(params) : wallet.transfer(params);\n }\n\n const { getChecksumAddressFromAsset } = await import(\"@tcswap/toolboxes/evm\");\n const wallet = getWallet(chain as EVMChain);\n\n return wallet.call<string>({\n abi,\n contractAddress: router || ((await getInboundDataByChain(chain)).router as string),\n funcName: \"depositWithExpiry\",\n funcParams: [\n recipient,\n getChecksumAddressFromAsset({ chain, symbol, ticker }, chain as EVMChain),\n assetValue.getBaseValue(\"string\"),\n params.memo,\n rest.expiration || Number.parseInt(`${(Date.now() + 15 * 60 * 1000) / 1000}`, 10),\n ],\n txOverrides: {\n from: params.from,\n value: assetValue.isGasAsset ? assetValue.getBaseValue(\"bigint\") : undefined,\n },\n });\n } catch (error) {\n const errorMessage =\n // @ts-expect-error Fine to use error as string\n typeof error === \"string\" ? error.toLowerCase() : error?.message.toLowerCase();\n const isInsufficientFunds = errorMessage?.includes(\"insufficient funds\");\n const isGas = errorMessage?.includes(\"gas\");\n const isServer = errorMessage?.includes(\"server\");\n const isUserRejected = errorMessage?.includes(\"user rejected\");\n const errorKey: ErrorKeys = isInsufficientFunds\n ? \"core_transaction_deposit_insufficient_funds_error\"\n : isGas\n ? \"core_transaction_deposit_gas_error\"\n : isServer\n ? \"core_transaction_deposit_server_error\"\n : isUserRejected\n ? \"core_transaction_user_rejected\"\n : \"core_transaction_deposit_error\";\n\n throw new USwapError(errorKey, error);\n }\n }\n\n async function depositToProtocol({ memo, assetValue }: { assetValue: AssetValue; memo: string }) {\n const mimir = await USwapApi.thornode.getMimirInfo(pluginType);\n\n // check if trading is halted or not\n if (mimir.HALTCHAINGLOBAL >= 1 || mimir.HALTTHORCHAIN >= 1) {\n throw new USwapError(\"thorchain_chain_halted\");\n }\n\n return deposit({ assetValue, memo, recipient: \"\" });\n }\n\n async function depositToPool({\n assetValue,\n memo,\n feeOptionKey = FeeOption.Fast,\n }: {\n assetValue: AssetValue;\n memo: string;\n feeOptionKey?: FeeOption;\n }) {\n const { gas_rate = \"0\", router, address: poolAddress } = await getInboundDataByChain(assetValue.chain);\n\n return deposit({\n assetValue,\n feeRate: Number.parseInt(gas_rate, 10) * gasFeeMultiplier[feeOptionKey],\n memo,\n recipient: poolAddress,\n router,\n });\n }\n\n function approveAssetValue({ assetValue }: { assetValue: AssetValue }) {\n return approve({ assetValue, type: ApproveMode.Approve });\n }\n\n function isAssetValueApproved({ assetValue }: { assetValue: AssetValue }) {\n return approve({ assetValue, type: ApproveMode.CheckOnly });\n }\n\n function registerName({ assetValue, ...params }: RegisterThornameParams) {\n return depositToProtocol({ assetValue, memo: getMemoForNameRegister(params) });\n }\n\n function registerPreferredAsset({\n assetValue,\n payoutAddress,\n name,\n ownerAddress,\n }: {\n assetValue: AssetValue;\n payoutAddress?: string;\n name: string;\n ownerAddress: string;\n }) {\n const payout = payoutAddress || getWallet(assetValue.chain)?.address;\n\n if (!payout) {\n throw new USwapError(\"thorchain_preferred_asset_payout_required\");\n }\n\n return depositToProtocol({\n assetValue: AssetValue.from({ chain: pluginChain }),\n memo: getMemoForNamePreferredAssetRegister({\n asset: assetValue.toString(),\n chain: assetValue.chain,\n name,\n owner: ownerAddress,\n payout,\n }),\n });\n }\n\n function nodeAction({ type, assetValue, address }: NodeActionParams) {\n const memo =\n type === MemoType.UNBOND\n ? getMemoForUnbond({ address, unbondAmount: assetValue.getBaseValue(\"number\") })\n : getMemoForLeaveAndBond({ address, type });\n\n const assetToTransfer = type === MemoType.BOND ? assetValue : getMinAmountByChain(pluginChain);\n return depositToProtocol({ assetValue: assetToTransfer, memo });\n }\n\n async function createLiquidity({ baseAssetValue, assetValue }: CreateLiquidityParams) {\n if (baseAssetValue.lte(0) || assetValue.lte(0)) {\n throw new USwapError(\"core_transaction_create_liquidity_invalid_params\");\n }\n\n const assetAddress = getWallet(assetValue.chain).address;\n const baseAssetAddress = getWallet(pluginChain).address;\n\n const baseAssetTx = await wrapWithThrow(() => {\n return depositToPool({\n assetValue: baseAssetValue,\n memo: getMemoForDeposit({ ...assetValue, address: assetAddress }),\n });\n }, \"core_transaction_create_liquidity_base_error\");\n\n const assetTx = await wrapWithThrow(() => {\n return depositToPool({ assetValue, memo: getMemoForDeposit({ ...assetValue, address: baseAssetAddress }) });\n }, \"core_transaction_create_liquidity_asset_error\");\n\n return { assetTx, baseAssetTx };\n }\n\n function addLiquidityPart({ assetValue, poolAddress, address, symmetric }: AddLiquidityPartParams) {\n if (symmetric && !address) {\n throw new USwapError(\"core_transaction_add_liquidity_invalid_params\");\n }\n const memo = getMemoForDeposit({\n address: symmetric ? address : \"\",\n chain: poolAddress.split(\".\")[0] as Chain,\n symbol: poolAddress.split(\".\")[1] as string,\n });\n\n return depositToPool({ assetValue, memo });\n }\n\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: TODO\n async function addLiquidity({\n baseAssetValue,\n assetValue,\n baseAssetAddr,\n assetAddr,\n isPendingSymmAsset,\n mode = \"sym\",\n }: AddLiquidityParams) {\n const { chain, symbol } = assetValue;\n const isSym = mode === \"sym\";\n const baseTransfer = baseAssetValue?.gt(0) && (isSym || mode === \"baseAsset\");\n const assetTransfer = assetValue?.gt(0) && (isSym || mode === \"asset\");\n const includeBaseAddress = isPendingSymmAsset || baseTransfer;\n const baseAssetWalletAddress = getWallet(pluginChain).address;\n\n const baseAddress = includeBaseAddress ? baseAssetAddr || baseAssetWalletAddress : \"\";\n const assetAddress = isSym || mode === \"asset\" ? assetAddr || getWallet(chain).address : \"\";\n\n if (!(baseTransfer || assetTransfer)) {\n throw new USwapError(\"core_transaction_add_liquidity_invalid_params\");\n }\n if (includeBaseAddress && !baseAddress) {\n throw new USwapError(\"core_transaction_add_liquidity_base_address\");\n }\n\n const baseAssetTx =\n baseTransfer && baseAssetValue\n ? await wrapWithThrow(() => {\n return depositToPool({\n assetValue: baseAssetValue,\n memo: getMemoForDeposit({ address: assetAddress, chain, symbol }),\n });\n }, \"core_transaction_add_liquidity_base_error\")\n : undefined;\n\n const assetTx =\n assetTransfer && assetValue\n ? await wrapWithThrow(() => {\n return depositToPool({ assetValue, memo: getMemoForDeposit({ address: baseAddress, chain, symbol }) });\n }, \"core_transaction_add_liquidity_asset_error\")\n : undefined;\n\n return { assetTx, baseAssetTx };\n }\n\n function withdraw({ memo, assetValue, percent, from, to }: WithdrawParams) {\n const targetAsset =\n to === \"baseAsset\" && from !== \"baseAsset\"\n ? AssetValue.from({ chain: pluginChain })\n : (from === \"sym\" && to === \"sym\") || from === \"baseAsset\" || from === \"asset\"\n ? undefined\n : assetValue;\n\n const value = getMinAmountByChain(from === \"asset\" ? assetValue.chain : pluginChain);\n const memoString =\n memo ||\n getMemoForWithdraw({\n basisPoints: Math.min(10000, Math.round(percent * 100)),\n chain: assetValue.chain,\n symbol: assetValue.symbol,\n targetAsset: targetAsset?.toString(),\n ticker: assetValue.ticker,\n });\n\n return depositToPool({ assetValue: value, memo: memoString });\n }\n\n async function claimTcy({ chain, thorAddress }: { chain: Chain; thorAddress: string }) {\n const inboundData = await getInboundDataByChain(chain);\n const dust_threshold = inboundData.dust_threshold;\n const { baseDecimal: chainDecimal } = getChainConfig(chain);\n const { baseDecimal: tcDecimal } = getChainConfig(Chain.THORChain);\n\n return deposit({\n assetValue: AssetValue.from({\n chain,\n fromBaseDecimal: Math.min(chainDecimal, tcDecimal),\n value: chain !== Chain.THORChain ? dust_threshold : 0,\n }),\n memo: getMemoForTcyClaim(MemoType.CLAIM_TCY, { address: thorAddress }),\n recipient: inboundData.address,\n router: inboundData.router,\n });\n }\n\n function stakeTcyAction(\n params: { type: \"unstake\"; unstakeBps: number } | { type: \"stake\"; assetValue: AssetValue },\n ) {\n if (params.type === \"stake\") {\n if (params.assetValue.toString() !== \"THOR.TCY\") {\n throw new USwapError(\"thorchain_asset_is_not_tcy\");\n }\n\n return deposit({\n assetValue: params.assetValue,\n memo: getMemoForTcyStake(MemoType.STAKE_TCY, {}),\n recipient: \"\",\n });\n }\n\n return deposit({\n assetValue: AssetValue.from({ chain: Chain.THORChain }),\n memo: getMemoForTcyStake(MemoType.UNSTAKE_TCY, { unstakeBps: params.unstakeBps }),\n recipient: \"\",\n });\n }\n\n async function swap({ feeOptionKey, route }: SwapParams<typeof pluginType, QuoteResponseRoute>) {\n const { memo, expiration, targetAddress } = route;\n\n const assetValue = await AssetValue.from({\n asset: route.sellAsset,\n asyncTokenLookup: true,\n value: route.sellAmount,\n });\n\n if (!assetValue) {\n throw new USwapError(\"core_swap_asset_not_recognized\");\n }\n\n const isRecipientValidated = validateAddressType({\n address: route.destinationAddress,\n chain: AssetValue.from({ asset: route.buyAsset }).chain,\n });\n\n if (!isRecipientValidated) {\n throw new USwapError(\"core_transaction_invalid_recipient_address\");\n }\n\n const { address: recipient } = await getInboundDataByChain(assetValue.chain);\n\n return deposit({\n assetValue,\n expiration: Number(expiration),\n feeOptionKey,\n memo,\n recipient,\n router: targetAddress,\n });\n }\n\n return {\n addLiquidity,\n addLiquidityPart,\n approveAssetValue,\n claimTcy,\n createLiquidity,\n deposit,\n depositToPool,\n getInboundDataByChain,\n isAssetValueApproved,\n nodeAction,\n registerName,\n registerPreferredAsset,\n stakeTcyAction,\n swap,\n withdraw,\n };\n };\n}\n",
6
+ "import { Chain } from \"@tcswap/helpers\";\nimport type { CoreTxParams } from \"./types\";\n\nexport function validateAddressType({ chain, address }: { chain?: Chain; address?: string }) {\n if (!address) return false;\n\n return chain === Chain.Bitcoin ? !address.startsWith(\"bc1p\") : true;\n}\n\nexport function prepareTxParams({\n assetValue,\n from,\n memo = \"\",\n ...restTxParams\n}: CoreTxParams & { from: string; router?: string }) {\n return { ...restTxParams, assetValue, from, memo };\n}\n"
7
+ ],
8
+ "mappings": "yDAIA,sBACE,gBAEA,WACA,eAGA,gBACA,oBACA,uBACA,4BACA,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C,EACtD,KAAM,EAAmB,EAAS,YAAa,CAAE,WAAY,EAAO,UAAW,CAAC,EAChF,UAAW,EACb,CAAC,EAGH,eAAe,EAAI,EAAG,eAAc,SAA4D,CAC9F,IAAQ,OAAM,aAAY,iBAAkB,EAEtC,EAAa,MAAM,EAAW,KAAK,CACvC,MAAO,EAAM,UACb,iBAAkB,GAClB,MAAO,EAAM,UACf,CAAC,EAED,GAAI,CAAC,EACH,MAAM,IAAI,EAAW,gCAAgC,EAQvD,GAAI,CALyB,EAAoB,CAC/C,QAAS,EAAM,mBACf,MAAO,EAAW,KAAK,CAAE,MAAO,EAAM,QAAS,CAAC,EAAE,KACpD,CAAC,EAGC,MAAM,IAAI,EAAW,4CAA4C,EAGnE,IAAQ,QAAS,GAAc,MAAM,EAAsB,EAAW,KAAK,EAE3E,OAAO,EAAQ,CACb,aACA,WAAY,OAAO,CAAU,EAC7B,eACA,OACA,YACA,OAAQ,CACV,CAAC,EAGH,MAAO,CACL,eACA,mBACA,oBACA,WACA,kBACA,UACA,gBACA,wBACA,uBACA,aACA,eACA,yBACA,iBACA,QACA,UACF",
9
+ "debugId": "494A228AB6F0FC1064756E2164756E21",
10
+ "names": []
11
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { AssetValue, Chain } from "@tcswap/helpers";
5
+ import type { getEvmToolbox } from "@tcswap/toolboxes/evm";
6
+ import type { getSubstrateToolbox } from "@tcswap/toolboxes/substrate";
7
+ import type { WithdrawFeeResponse } from "./types";
8
+ type ChainflipToolbox = Awaited<ReturnType<typeof getSubstrateToolbox<typeof Chain.Chainflip>>>;
9
+ export declare const assetIdentifierToChainflipTicker: Map<string, string>;
10
+ export declare const ChainflipBroker: (chainflipToolbox: ChainflipToolbox) => {
11
+ fundStateChainAccount: ({ evmToolbox, stateChainAccount, assetValue, }: {
12
+ evmToolbox: Awaited<ReturnType<typeof getEvmToolbox>>;
13
+ stateChainAccount: string;
14
+ assetValue: AssetValue;
15
+ }) => Promise<string>;
16
+ registerAsBroker: () => string | Promise<string> | Promise<() => void>;
17
+ withdrawFee: ({ feeAsset, recipient }: {
18
+ feeAsset: AssetValue;
19
+ recipient: string;
20
+ }) => Promise<WithdrawFeeResponse>;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=broker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broker.d.ts","sourceRoot":"","sources":["../../../src/chainflip/broker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,KAAK,EAA6B,MAAM,iBAAiB,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,KAAK,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAEhG,eAAO,MAAM,gCAAgC,qBAW3C,CAAC;AAsFH,eAAO,MAAM,eAAe,GAAI,kBAAkB,gBAAgB;4EA3B7D;QACD,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC;QACtD,iBAAiB,EAAE,MAAM,CAAC;QAC1B,UAAU,EAAE,UAAU,CAAC;KACxB;;2CAjDyB;QAAE,QAAQ,EAAE,UAAU,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;CA4ErE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./broker";
2
+ export * from "./plugin";
3
+ export * from "./types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chainflip/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { ProviderName } from "@tcswap/helpers";
5
+ import type { RequestSwapDepositAddressParams } from "./types";
6
+ export declare const ChainflipPlugin: {
7
+ chainflip: (pluginParams: import("..").SwapKitPluginParams) => {
8
+ supportedUSwapProviders: readonly [ProviderName.CHAINFLIP, ProviderName.CHAINFLIP_STREAMING];
9
+ } & {
10
+ swap: (swapParams: RequestSwapDepositAddressParams) => Promise<any>;
11
+ };
12
+ };
13
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/chainflip/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA0B,YAAY,EAAc,MAAM,iBAAiB,CAAC;AAGnF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE/D,eAAO,MAAM,eAAe;;;;2BAEuB,+BAA+B;;CA4ChF,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { AssetValue, SwapParams } from "@tcswap/helpers";
2
+ import type { QuoteResponseRoute } from "@tcswap/helpers/api";
3
+ export type WithdrawFeeResponse = {
4
+ egressId: string;
5
+ egressAsset: string;
6
+ egressAmount: string;
7
+ egressFee: string;
8
+ destinationAddress: string;
9
+ };
10
+ export type DepositChannelRequest = {
11
+ brokerCommissionBPS: number;
12
+ ccmMetadata: ccmMetadata | null;
13
+ maxBoostFeeBps?: number;
14
+ affiliateFees?: AffiliateBroker[];
15
+ refundParameters?: SwapRefundParameters;
16
+ };
17
+ export type ccmMetadata = {
18
+ message: string;
19
+ gasBudget: string;
20
+ cfParameters: string;
21
+ };
22
+ export type SwapDepositResponse = {
23
+ depositChannelId: string;
24
+ depositAddress: string;
25
+ srcChainExpiryBlock: number;
26
+ sellAsset: AssetValue;
27
+ buyAsset: AssetValue;
28
+ recipient: string;
29
+ brokerCommissionBPS: number;
30
+ };
31
+ export type AffiliateBroker = {
32
+ brokerAddress: string;
33
+ basisPoints: number;
34
+ };
35
+ export type SwapRefundParameters = {
36
+ retryDuration: number;
37
+ refundAddress: string;
38
+ minPrice: string;
39
+ };
40
+ export type RequestSwapDepositAddressParams = Partial<SwapParams<"chainflip", QuoteResponseRoute>> & Partial<DepositChannelRequest>;
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/chainflip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,eAAe,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,oBAAoB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtG,MAAM,MAAM,+BAA+B,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,GAChG,OAAO,CAAC,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { AssetValue, ProviderName, type SwapParams } from "@tcswap/helpers";
5
+ import type { QuoteResponseRoute } from "@tcswap/helpers/api";
6
+ export declare const EVMPlugin: {
7
+ evm: (pluginParams: import("..").SwapKitPluginParams) => {
8
+ supportedUSwapProviders: readonly [ProviderName.CAMELOT_V3, ProviderName.OPENOCEAN_V2, ProviderName.OKX, ProviderName.ONEINCH, ProviderName.PANCAKESWAP, ProviderName.PANGOLIN_V1, ProviderName.SUSHISWAP_V2, ProviderName.TRADERJOE_V2, ProviderName.UNISWAP_V2, ProviderName.UNISWAP_V3];
9
+ } & {
10
+ approveAssetValue: ({ assetValue, spenderAddress }: {
11
+ spenderAddress: string;
12
+ assetValue: AssetValue;
13
+ }) => Promise<string> | Promise<boolean>;
14
+ isAssetValueApproved: ({ assetValue, spenderAddress }: {
15
+ spenderAddress: string;
16
+ assetValue: AssetValue;
17
+ }) => Promise<string> | Promise<boolean>;
18
+ swap: ({ route: { tx, sellAsset }, feeOptionKey }: SwapParams<"evm", QuoteResponseRoute>) => Promise<string>;
19
+ };
20
+ };
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/evm/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,UAAU,EAGV,YAAY,EACZ,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,eAAO,MAAM,SAAS;;;;;;;;;;;;2DAIuD,UAAU,CAAC,KAAK,EAAE,kBAAkB,CAAC;;CA4BhH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { GardenPlugin } from "./plugin";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/garden/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { AssetValue, ProviderName, type SwapParams } from "@tcswap/helpers";
5
+ import type { QuoteResponseRoute } from "@tcswap/helpers/api";
6
+ export declare const GardenPlugin: {
7
+ garden: (pluginParams: import("..").SwapKitPluginParams) => {
8
+ supportedUSwapProviders: readonly [ProviderName.GARDEN];
9
+ } & {
10
+ approveAssetValue: ({ assetValue, spenderAddress }: {
11
+ spenderAddress: string;
12
+ assetValue: AssetValue;
13
+ }) => Promise<string> | Promise<boolean>;
14
+ isAssetValueApproved: ({ assetValue, spenderAddress }: {
15
+ spenderAddress: string;
16
+ assetValue: AssetValue;
17
+ }) => Promise<string> | Promise<boolean>;
18
+ swap: ({ route }: SwapParams<"garden", QuoteResponseRoute>) => Promise<string>;
19
+ };
20
+ };
21
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/garden/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAe,UAAU,EAAoB,YAAY,EAAE,KAAK,UAAU,EAAc,MAAM,iBAAiB,CAAC;AACvH,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9E,eAAO,MAAM,YAAY;;;;;;;;;;;;0BAIgB,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC;;CAmC/E,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import type { PluginName, USwapPlugins } from "./types";
5
+ export * from "./types";
6
+ export * from "./utils";
7
+ export declare function loadPlugin<P extends PluginName>(pluginName: P): Promise<USwapPlugins[P]>;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAExD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,4BA+BnE"}
@@ -0,0 +1,3 @@
1
+ export * from "./plugin";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/near/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function validateNearName(name: string): boolean;
2
+ export declare function calculateNearNameCost(name: string): string;
3
+ //# sourceMappingURL=nearNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nearNames.d.ts","sourceRoot":"","sources":["../../../src/near/nearNames.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAStD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoB1D"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { ProviderName, type SwapParams } from "@tcswap/helpers";
5
+ import type { QuoteResponseRoute } from "@tcswap/helpers/api";
6
+ import type { NearAccountInfo, NearNameRegistrationParams } from "./types";
7
+ export declare const NearPlugin: {
8
+ near: (pluginParams: import("..").SwapKitPluginParams) => {
9
+ supportedUSwapProviders: readonly [ProviderName.NEAR];
10
+ } & {
11
+ nearNames: {
12
+ getInfo(name: string): Promise<NearAccountInfo | null>;
13
+ isAvailable(name: string): Promise<boolean>;
14
+ lookupNames(accountId: string): Promise<string[]>;
15
+ register(params: NearNameRegistrationParams): Promise<string>;
16
+ resolve(name: string): Promise<string | null>;
17
+ transfer(name: string, newOwner: string): Promise<string>;
18
+ };
19
+ swap(swapParams: SwapParams<"near", QuoteResponseRoute>): Promise<any>;
20
+ };
21
+ };
22
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/near/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAqB,YAAY,EAAE,KAAK,UAAU,EAAc,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE3E,eAAO,MAAM,UAAU;;;;;0BAGG,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;8BA4CpC,MAAM;mCAKD,MAAM;6BA0BZ,0BAA0B;0BAqB7B,MAAM;2BA6BX,MAAM,YAAY,MAAM;;yBAiBlB,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC;;CAyD/D,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type NearAccountInfo = {
2
+ accountId: string;
3
+ balance: string;
4
+ storageUsed: number;
5
+ codeHash: string;
6
+ publicKeys: string[];
7
+ };
8
+ export type NearNameRegistrationParams = {
9
+ name: string;
10
+ publicKey?: string;
11
+ };
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/near/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { ProviderName, type SwapParams } from "@tcswap/helpers";
5
+ import type { QuoteResponseRoute } from "@tcswap/helpers/api";
6
+ export declare const RadixPlugin: {
7
+ radix: (pluginParams: import("..").SwapKitPluginParams) => {
8
+ supportedUSwapProviders: readonly [ProviderName.CAVIAR_V1];
9
+ } & {
10
+ swap: ({ route: { tx, sellAmount, sellAsset } }: SwapParams<"radix", QuoteResponseRoute>) => Promise<string>;
11
+ };
12
+ };
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/radix/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAqB,YAAY,EAAE,KAAK,UAAU,EAAc,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,eAAO,MAAM,WAAW;;;;yDAEqD,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC;;CAiBlH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { SolanaPlugin } from "./plugin";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/solana/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { ProviderName, type SwapParams } from "@tcswap/helpers";
5
+ import type { QuoteResponseRoute } from "@tcswap/helpers/api";
6
+ export declare const SolanaPlugin: {
7
+ solana: (pluginParams: import("..").SwapKitPluginParams) => {
8
+ supportedUSwapProviders: readonly [ProviderName.JUPITER];
9
+ } & {
10
+ swap: ({ route }: SwapParams<"solana", QuoteResponseRoute>) => Promise<string>;
11
+ };
12
+ };
13
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/solana/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAqB,YAAY,EAAE,KAAK,UAAU,EAAc,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,eAAO,MAAM,YAAY;;;;0BAEsB,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC;;CAmBrF,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { MayachainPlugin, ThorchainPlugin } from "./plugin";
2
+ export { validateAddressType } from "./shared";
3
+ export * from "./types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/thorchain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,cAAc,SAAS,CAAC"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import { AssetValue, Chain, FeeOption, ProviderName, type SwapParams } from "@tcswap/helpers";
5
+ import { type InboundAddressesItem, type QuoteResponseRoute } from "@tcswap/helpers/api";
6
+ import type { SwapKitPluginParams } from "../types";
7
+ import type { AddLiquidityParams, AddLiquidityPartParams, CoreTxParams, CreateLiquidityParams, NodeActionParams, RegisterThornameParams, WithdrawParams } from "./types";
8
+ export declare const ThorchainPlugin: {
9
+ thorchain: (pluginParams: SwapKitPluginParams) => {
10
+ supportedUSwapProviders: readonly [ProviderName.THORCHAIN, ProviderName.THORCHAIN_STREAMING];
11
+ } & {
12
+ addLiquidity: ({ baseAssetValue, assetValue, baseAssetAddr, assetAddr, isPendingSymmAsset, mode, }: AddLiquidityParams) => Promise<{
13
+ assetTx: string | undefined;
14
+ baseAssetTx: string | undefined;
15
+ }>;
16
+ addLiquidityPart: ({ assetValue, poolAddress, address, symmetric }: AddLiquidityPartParams) => Promise<string>;
17
+ approveAssetValue: ({ assetValue }: {
18
+ assetValue: AssetValue;
19
+ }) => Promise<string | boolean | Promise<string>>;
20
+ claimTcy: ({ chain, thorAddress }: {
21
+ chain: Chain;
22
+ thorAddress: string;
23
+ }) => Promise<string>;
24
+ createLiquidity: ({ baseAssetValue, assetValue }: CreateLiquidityParams) => Promise<{
25
+ assetTx: string | undefined;
26
+ baseAssetTx: string | undefined;
27
+ }>;
28
+ deposit: ({ assetValue, recipient, router, ...rest }: CoreTxParams & {
29
+ router?: string;
30
+ }) => Promise<string>;
31
+ depositToPool: ({ assetValue, memo, feeOptionKey, }: {
32
+ assetValue: AssetValue;
33
+ memo: string;
34
+ feeOptionKey?: FeeOption;
35
+ }) => Promise<string>;
36
+ getInboundDataByChain: <T extends Chain>(chain: T) => Promise<InboundAddressesItem>;
37
+ isAssetValueApproved: ({ assetValue }: {
38
+ assetValue: AssetValue;
39
+ }) => Promise<string | boolean | Promise<boolean>>;
40
+ nodeAction: ({ type, assetValue, address }: NodeActionParams) => Promise<string>;
41
+ registerName: ({ assetValue, ...params }: RegisterThornameParams) => Promise<string>;
42
+ registerPreferredAsset: ({ assetValue, payoutAddress, name, ownerAddress, }: {
43
+ assetValue: AssetValue;
44
+ payoutAddress?: string;
45
+ name: string;
46
+ ownerAddress: string;
47
+ }) => Promise<string>;
48
+ stakeTcyAction: (params: {
49
+ type: "unstake";
50
+ unstakeBps: number;
51
+ } | {
52
+ type: "stake";
53
+ assetValue: AssetValue;
54
+ }) => Promise<string>;
55
+ swap: ({ feeOptionKey, route }: SwapParams<"thorchain" | "mayachain", QuoteResponseRoute>) => Promise<string>;
56
+ withdraw: ({ memo, assetValue, percent, from, to }: WithdrawParams) => Promise<string>;
57
+ };
58
+ };
59
+ export declare const MayachainPlugin: {
60
+ mayachain: (pluginParams: SwapKitPluginParams) => {
61
+ supportedUSwapProviders: readonly [ProviderName.MAYACHAIN, ProviderName.MAYACHAIN_STREAMING];
62
+ } & {
63
+ addLiquidity: ({ baseAssetValue, assetValue, baseAssetAddr, assetAddr, isPendingSymmAsset, mode, }: AddLiquidityParams) => Promise<{
64
+ assetTx: string | undefined;
65
+ baseAssetTx: string | undefined;
66
+ }>;
67
+ addLiquidityPart: ({ assetValue, poolAddress, address, symmetric }: AddLiquidityPartParams) => Promise<string>;
68
+ approveAssetValue: ({ assetValue }: {
69
+ assetValue: AssetValue;
70
+ }) => Promise<string | boolean | Promise<string>>;
71
+ claimTcy: ({ chain, thorAddress }: {
72
+ chain: Chain;
73
+ thorAddress: string;
74
+ }) => Promise<string>;
75
+ createLiquidity: ({ baseAssetValue, assetValue }: CreateLiquidityParams) => Promise<{
76
+ assetTx: string | undefined;
77
+ baseAssetTx: string | undefined;
78
+ }>;
79
+ deposit: ({ assetValue, recipient, router, ...rest }: CoreTxParams & {
80
+ router?: string;
81
+ }) => Promise<string>;
82
+ depositToPool: ({ assetValue, memo, feeOptionKey, }: {
83
+ assetValue: AssetValue;
84
+ memo: string;
85
+ feeOptionKey?: FeeOption;
86
+ }) => Promise<string>;
87
+ getInboundDataByChain: <T extends Chain>(chain: T) => Promise<InboundAddressesItem>;
88
+ isAssetValueApproved: ({ assetValue }: {
89
+ assetValue: AssetValue;
90
+ }) => Promise<string | boolean | Promise<boolean>>;
91
+ nodeAction: ({ type, assetValue, address }: NodeActionParams) => Promise<string>;
92
+ registerName: ({ assetValue, ...params }: RegisterThornameParams) => Promise<string>;
93
+ registerPreferredAsset: ({ assetValue, payoutAddress, name, ownerAddress, }: {
94
+ assetValue: AssetValue;
95
+ payoutAddress?: string;
96
+ name: string;
97
+ ownerAddress: string;
98
+ }) => Promise<string>;
99
+ stakeTcyAction: (params: {
100
+ type: "unstake";
101
+ unstakeBps: number;
102
+ } | {
103
+ type: "stake";
104
+ assetValue: AssetValue;
105
+ }) => Promise<string>;
106
+ swap: ({ feeOptionKey, route }: SwapParams<"thorchain" | "mayachain", QuoteResponseRoute>) => Promise<string>;
107
+ withdraw: ({ memo, assetValue, percent, from, to }: WithdrawParams) => Promise<string>;
108
+ };
109
+ };
110
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/thorchain/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,UAAU,EACV,KAAK,EAIL,SAAS,EAYT,YAAY,EACZ,KAAK,UAAU,EAIhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAA+B,MAAM,qBAAqB,CAAC;AAStH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACf,MAAM,SAAS,CAAC;AAiBjB,eAAO,MAAM,eAAe;;;;4GA+QrB,kBAAkB;;;;4EArBsD,sBAAsB;;wBAzExC,UAAU;;;mBA0JV,KAAK;yBAAe,MAAM;;0DAvGpB,qBAAqB;;;;;qBArJS,MAAM;;;wBAmFrF,UAAU;kBAChB,MAAM;2BACG,SAAS;;gCAvJgB,CAAC,SAAS,KAAK,SAAS,CAAC;;wBAwKP,UAAU;;oDAqCnB,gBAAgB;kDAjClB,sBAAsB;;wBAUzD,UAAU;4BACN,MAAM;kBAChB,MAAM;0BACE,MAAM;;;kBAwJJ,SAAS;wBAAc,MAAM;;kBAAa,OAAO;wBAAc,UAAU;;wCAqB9C,UAAU,4BAAoB,kBAAkB,CAAC;4DA9DnC,cAAc;;CAjT3E,CAAC;AAEH,eAAO,MAAM,eAAe;;;;4GAyQrB,kBAAkB;;;;4EArBsD,sBAAsB;;wBAzExC,UAAU;;;mBA0JV,KAAK;yBAAe,MAAM;;0DAvGpB,qBAAqB;;;;;qBArJS,MAAM;;;wBAmFrF,UAAU;kBAChB,MAAM;2BACG,SAAS;;gCAvJgB,CAAC,SAAS,KAAK,SAAS,CAAC;;wBAwKP,UAAU;;oDAqCnB,gBAAgB;kDAjClB,sBAAsB;;wBAUzD,UAAU;4BACN,MAAM;kBAChB,MAAM;0BACE,MAAM;;;kBAwJJ,SAAS;wBAAc,MAAM;;kBAAa,OAAO;wBAAc,UAAU;;wCAqB9C,UAAU,4BAAoB,kBAAkB,CAAC;4DA9DnC,cAAc;;CA3S3E,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Chain } from "@tcswap/helpers";
2
+ import type { CoreTxParams } from "./types";
3
+ export declare function validateAddressType({ chain, address }: {
4
+ chain?: Chain;
5
+ address?: string;
6
+ }): boolean;
7
+ export declare function prepareTxParams({ assetValue, from, memo, ...restTxParams }: CoreTxParams & {
8
+ from: string;
9
+ router?: string;
10
+ }): {
11
+ assetValue: import("@tcswap/helpers").AssetValue;
12
+ from: string;
13
+ memo: string;
14
+ recipient: string;
15
+ feeOptionKey?: import("@tcswap/helpers").FeeOption;
16
+ feeRate?: number;
17
+ data?: string;
18
+ expiration?: number;
19
+ router?: string;
20
+ };
21
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/thorchain/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,WAI1F;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,IAAI,EACJ,IAAS,EACT,GAAG,YAAY,EAChB,EAAE,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;aAAR,MAAM;EAEhD"}
@@ -0,0 +1,64 @@
1
+ import type { AssetValue, FeeOption, MemoType } from "@tcswap/helpers";
2
+ export type AddLiquidityPartParams = {
3
+ assetValue: AssetValue;
4
+ address?: string;
5
+ poolAddress: string;
6
+ symmetric: boolean;
7
+ };
8
+ export type AddLiquidityParams = {
9
+ assetAddr?: string;
10
+ assetValue: AssetValue;
11
+ baseAssetAddr?: string;
12
+ baseAssetValue: AssetValue;
13
+ isPendingSymmAsset?: boolean;
14
+ mode?: "sym" | "baseAsset" | "asset";
15
+ };
16
+ export type CreateLiquidityParams = {
17
+ baseAssetValue: AssetValue;
18
+ assetValue: AssetValue;
19
+ };
20
+ export type CoreTxParams = {
21
+ assetValue: AssetValue;
22
+ recipient: string;
23
+ memo?: string;
24
+ feeOptionKey?: FeeOption;
25
+ feeRate?: number;
26
+ data?: string;
27
+ from?: string;
28
+ expiration?: number;
29
+ };
30
+ export type NodeActionParams = {
31
+ address: string;
32
+ } & ({
33
+ type: MemoType.BOND | MemoType.UNBOND;
34
+ assetValue: AssetValue;
35
+ } | {
36
+ type: MemoType.LEAVE;
37
+ assetValue?: undefined;
38
+ });
39
+ export type RegisterThornameParams = {
40
+ assetValue: AssetValue;
41
+ name: string;
42
+ chain: string;
43
+ address: string;
44
+ owner?: string;
45
+ preferredAsset?: string;
46
+ };
47
+ export type RegisterPreferredAssetParams = {
48
+ assetValue: AssetValue;
49
+ name: string;
50
+ chain: string;
51
+ address: string;
52
+ owner: string;
53
+ };
54
+ type CommonWithdrawParams = {
55
+ assetValue: AssetValue;
56
+ memo?: string;
57
+ percent: number;
58
+ };
59
+ export type WithdrawParams = CommonWithdrawParams & {
60
+ from: "sym" | "baseAsset" | "asset";
61
+ to: "sym" | "baseAsset" | "asset";
62
+ };
63
+ export {};
64
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/thorchain/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,UAAU,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,OAAO,CAAC;CACtC,CAAC;AAEF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O,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG;IAClD,IAAI,EAAE,KAAK,GAAG,WAAW,GAAG,OAAO,CAAC;IACpC,EAAE,EAAE,KAAK,GAAG,WAAW,GAAG,OAAO,CAAC;CACnC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Modifications © 2025 Horizontal Systems.
3
+ */
4
+ import type { Chain } from "@tcswap/helpers";
5
+ import type { FullWallet } from "@tcswap/toolboxes";
6
+ import type { ChainflipPlugin } from "./chainflip";
7
+ import type { EVMPlugin } from "./evm";
8
+ import type { NearPlugin } from "./near";
9
+ import type { RadixPlugin } from "./radix";
10
+ import type { SolanaPlugin } from "./solana/plugin";
11
+ import type { ThorchainPlugin } from "./thorchain";
12
+ export type * from "./chainflip/types";
13
+ export type * from "./thorchain/types";
14
+ export type USwapPlugins = typeof ChainflipPlugin & typeof ThorchainPlugin & typeof RadixPlugin & typeof SolanaPlugin & typeof EVMPlugin & typeof NearPlugin;
15
+ export type PluginName = keyof USwapPlugins;
16
+ export type SwapKitPluginParams = {
17
+ getWallet: <T extends Chain>(chain: T) => FullWallet[T];
18
+ };
19
+ //# sourceMappingURL=types.d.ts.map