@tcswap/plugins 4.2.15 → 4.2.16
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/dist/chainflip/index.cjs +2 -2
- package/dist/chainflip/index.cjs.map +1 -1
- package/dist/chainflip/index.js +2 -2
- package/dist/chainflip/index.js.map +2 -2
- package/dist/chunk-awrrj6sh.js +5 -0
- package/dist/chunk-awrrj6sh.js.map +10 -0
- package/dist/chunk-ygsqt852.js +4 -0
- package/dist/chunk-ygsqt852.js.map +10 -0
- package/dist/evm/index.js +2 -2
- package/dist/evm/index.js.map +1 -1
- package/dist/garden/index.js +2 -2
- package/dist/garden/index.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/near/index.js +2 -2
- package/dist/near/index.js.map +1 -1
- package/dist/radix/index.js +2 -2
- package/dist/radix/index.js.map +1 -1
- package/dist/solana/index.cjs +2 -2
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.js +2 -2
- package/dist/solana/index.js.map +2 -2
- package/dist/thorchain/index.cjs +2 -2
- package/dist/thorchain/index.cjs.map +2 -2
- package/dist/thorchain/index.js +2 -2
- package/dist/thorchain/index.js.map +2 -2
- package/package.json +3 -3
package/dist/chainflip/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P={};D(P,{assetIdentifierToChainflipTicker:()=>y,ChainflipPlugin:()=>T,ChainflipBroker:()=>E});module.exports=_(P);var A=require("@polkadot/keyring"),f=require("@polkadot/util"),s=require("@tcswap/helpers"),y=new Map([["ARB.ETH","ArbEth"],["ARB.USDC-0XAF88D065E77C8CC2239327C5EDB3A432268E5831","ArbUsdc"],["BTC.BTC","Btc"],["DOT.DOT","Dot"],["ETH.ETH","Eth"],["ETH.FLIP-0X826180541412D574CF1336D22C0C0A287822678A","Flip"],["ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48","Usdc"],["ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7","Usdt"],["SOL.SOL","Sol"],["SOL.USDC-EPJFWDD5AUFQSSQEM2QN1XZYBAPC8G4WEGGKZWYTDT1V","SolUsdc"]]),S=(e)=>()=>{let r=e.api.tx.swapping?.registerAsBroker?.();if(!r)throw new s.USwapError("chainflip_broker_register");return e.signAndBroadcast({address:e.getAddress(),tx:r})},b=(e)=>({feeAsset:r,recipient:t})=>{let a=r.chain===s.Chain.Polkadot,n=s.wrapWithThrow(()=>{return a?e.encodeAddress(e.decodeAddress(t),"hex"):t},"chainflip_broker_recipient_error");return new Promise((d)=>{let o=e.api.tx?.swapping?.withdraw?.(r.ticker.toLowerCase(),{[r.chain.toLowerCase()]:n});if(!o)throw new s.USwapError("chainflip_broker_withdraw");e.signAndBroadcast({callback:(l)=>{if(!l.status?.isFinalized)return;let c=l.events.find((x)=>x.event.method==="WithdrawalRequested");if(!c)throw new s.USwapError("chainflip_channel_error","Could not find 'WithdrawalRequested' event");let{event:{data:{egressId:p,egressAsset:u,egressAmount:m,egressFee:g,destinationAddress:C}}}=c.toHuman();d({destinationAddress:C,egressAmount:m,egressAsset:u,egressFee:g,egressId:p})},tx:o})})},B=(e)=>async({evmToolbox:r,stateChainAccount:t,assetValue:a})=>{let{chainflipGateway:n}=await import("@tcswap/helpers/contracts"),d=s.AssetValue.from({asset:"ETH.FLIP"});if(!a.eqAsset(d))throw new s.USwapError("chainflip_broker_fund_only_flip_supported");if(!e.validateAddress(t))throw new s.USwapError("chainflip_broker_fund_invalid_address");let o=f.isHex(t)?t:f.u8aToHex(A.decodeAddress(t));return r.call({abi:n,contractAddress:"0x6995ab7c4d7f4b03f467cf4c8e920427d9621dbd",funcName:"fundStateChainAccount",funcParams:[o,a.getBaseValue("string")]})},E=(e)=>({fundStateChainAccount:B(e),registerAsBroker:S(e),withdrawFee:b(e)});var i=require("@tcswap/helpers"),h=require("@tcswap/helpers/api");var T=w({methods:({getWallet:e})=>({swap:async function(t){if(!(t?.route?.buyAsset&&t.route.meta?.chainflip))throw new i.USwapError("core_swap_invalid_params",{...t});let{route:{buyAsset:a,sellAsset:n,sellAmount:d,meta:{chainflip:o}},maxBoostFeeBps:l=0}=t;if(!(n&&a))throw new i.USwapError("core_swap_asset_not_recognized");let c=await i.AssetValue.from({asset:n,asyncTokenLookup:!0,value:d}),p=e(c.chain);if(!p||!("transfer"in p))throw new i.USwapError("core_wallet_connection_not_found");let{depositAddress:u}=await h.USwapApi.getChainflipDepositChannel({...o,maxBoostFeeBps:l||o.maxBoostFeeBps});return await p.transfer({assetValue:c,isProgramDerivedAddress:!0,recipient:u,sender:p.address})}}),name:"chainflip",properties:{supportedUSwapProviders:[i.ProviderName.CHAINFLIP,i.ProviderName.CHAINFLIP_STREAMING]}});
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=BB6934B3238AD73964756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport { AssetValue, type Chain, ProviderName, USwapError } from \"@tcswap/helpers\";\nimport { USwapApi } from \"@tcswap/helpers/api\";\nimport { createPlugin } from \"../utils\";\nimport type { RequestSwapDepositAddressParams } from \"./types\";\n\nexport const ChainflipPlugin = createPlugin({\n methods: ({ getWallet }) => ({\n swap: async function chainflipSwap(swapParams: RequestSwapDepositAddressParams) {\n if (!(swapParams?.route?.buyAsset && swapParams.route.meta?.chainflip)) {\n throw new USwapError(\"core_swap_invalid_params\", { ...swapParams });\n }\n\n const {\n route: {\n buyAsset: buyAssetString,\n sellAsset: sellAssetString,\n sellAmount,\n meta: { chainflip },\n },\n maxBoostFeeBps = 0,\n } = swapParams;\n\n if (!(sellAssetString && buyAssetString)) {\n throw new USwapError(\"core_swap_asset_not_recognized\");\n }\n\n const sellAsset = await AssetValue.from({ asset: sellAssetString, asyncTokenLookup: true, value: sellAmount });\n\n const wallet = getWallet(sellAsset.chain as Exclude<Chain, Chain.Radix>);\n\n if (!wallet || !(\"transfer\" in wallet)) {\n throw new USwapError(\"core_wallet_connection_not_found\");\n }\n\n const { depositAddress } = await USwapApi.getChainflipDepositChannel({\n ...chainflip,\n maxBoostFeeBps: maxBoostFeeBps || chainflip.maxBoostFeeBps,\n });\n\n const tx = await wallet.transfer({\n assetValue: sellAsset,\n isProgramDerivedAddress: true,\n recipient: depositAddress,\n sender: wallet.address,\n });\n\n return tx;\n },\n }),\n name: \"chainflip\",\n properties: { supportedUSwapProviders: [ProviderName.CHAINFLIP, ProviderName.CHAINFLIP_STREAMING] as const },\n});\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": "uHAI8B,IAA9B,+BACA,4BACA,6BAQa,EAAmC,IAAI,IAAoB,CACtE,CAAC,UAAW,QAAQ,EACpB,CAAC,sDAAuD,SAAS,EACjE,CAAC,UAAW,KAAK,EACjB,CAAC,UAAW,KAAK,EACjB,CAAC,UAAW,KAAK,EACjB,CAAC,sDAAuD,MAAM,EAC9D,CAAC,sDAAuD,MAAM,EAC9D,CAAC,sDAAuD,MAAM,EAC9D,CAAC,UAAW,KAAK,EACjB,CAAC,wDAAyD,SAAS,CACrE,CAAC,EAEK,EAAmB,CAAC,IAA8B,IAAM,CAC5D,IAAM,EAAY,EAAQ,IAAI,GAAG,UAAU,mBAAmB,EAE9D,GAAI,CAAC,EACH,MAAM,IAAI,aAAW,2BAA2B,EAGlD,OAAO,EAAQ,iBAAiB,CAAE,QAAS,EAAQ,WAAW,EAAG,GAAI,CAAU,CAAC,GAG5E,EACJ,CAAC,IACD,EAAG,WAAU,eAA6D,CACxE,IAAM,EAAqB,EAAS,QAAU,QAAM,SAE9C,EAAmB,gBAAc,IAAM,CAC3C,OAAO,EAAqB,EAAQ,cAAc,EAAQ,cAAc,CAAS,EAAG,KAAK,EAAI,GAC5F,kCAAkC,EAErC,OAAO,IAAI,QAA6B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AA4B,CAAC,EAA6C,CAC9E,GAAI,EAAE,GAAY,OAAO,UAAY,EAAW,MAAM,MAAM,WAC1D,MAAM,IAAI,aAAW,2BAA4B,IAAK,CAAW,CAAC,EAGpE,IACE,OACE,SAAU,EACV,UAAW,EACX,aACA,MAAQ,cAEV,iBAAiB,GACf,EAEJ,GAAI,EAAE,GAAmB,GACvB,MAAM,IAAI,aAAW,gCAAgC,EAGvD,IAAM,EAAY,MAAM,aAAW,KAAK,CAAE,MAAO,EAAiB,iBAAkB,GAAM,MAAO,CAAW,CAAC,EAEvG,EAAS,EAAU,EAAU,KAAoC,EAEvE,GAAI,CAAC,GAAU,EAAE,aAAc,GAC7B,MAAM,IAAI,aAAW,kCAAkC,EAGzD,IAAQ,kBAAmB,MAAM,WAAS,2BAA2B,IAChE,EACH,eAAgB,GAAkB,EAAU,cAC9C,CAAC,EASD,OAPW,MAAM,EAAO,SAAS,CAC/B,WAAY,EACZ,wBAAyB,GACzB,UAAW,EACX,OAAQ,EAAO,OACjB,CAAC,EAIL,GACA,KAAM,YACN,WAAY,CAAE,wBAAyB,CAAC,eAAa,UAAW,eAAa,mBAAmB,CAAW,CAC7G,CAAC",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "BB6934B3238AD73964756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/chainflip/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as C,b as
|
|
1
|
+
import{a as C,b as A}from"../chunk-awrrj6sh.js";import{decodeAddress as x}from"@polkadot/keyring";import{isHex as y,u8aToHex as S}from"@polkadot/util";import{AssetValue as b,Chain as B,USwapError as d,wrapWithThrow as E}from"@tcswap/helpers";var H=new Map([["ARB.ETH","ArbEth"],["ARB.USDC-0XAF88D065E77C8CC2239327C5EDB3A432268E5831","ArbUsdc"],["BTC.BTC","Btc"],["DOT.DOT","Dot"],["ETH.ETH","Eth"],["ETH.FLIP-0X826180541412D574CF1336D22C0C0A287822678A","Flip"],["ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48","Usdc"],["ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7","Usdt"],["SOL.SOL","Sol"],["SOL.USDC-EPJFWDD5AUFQSSQEM2QN1XZYBAPC8G4WEGGKZWYTDT1V","SolUsdc"]]),T=(e)=>()=>{let s=e.api.tx.swapping?.registerAsBroker?.();if(!s)throw new d("chainflip_broker_register");return e.signAndBroadcast({address:e.getAddress(),tx:s})},_=(e)=>({feeAsset:s,recipient:t})=>{let i=s.chain===B.Polkadot,o=E(()=>{return i?e.encodeAddress(e.decodeAddress(t),"hex"):t},"chainflip_broker_recipient_error");return new Promise((n)=>{let r=e.api.tx?.swapping?.withdraw?.(s.ticker.toLowerCase(),{[s.chain.toLowerCase()]:o});if(!r)throw new d("chainflip_broker_withdraw");e.signAndBroadcast({callback:(c)=>{if(!c.status?.isFinalized)return;let p=c.events.find((g)=>g.event.method==="WithdrawalRequested");if(!p)throw new d("chainflip_channel_error","Could not find 'WithdrawalRequested' event");let{event:{data:{egressId:a,egressAsset:l,egressAmount:u,egressFee:w,destinationAddress:h}}}=p.toHuman();n({destinationAddress:h,egressAmount:u,egressAsset:l,egressFee:w,egressId:a})},tx:r})})},D=(e)=>async({evmToolbox:s,stateChainAccount:t,assetValue:i})=>{let{chainflipGateway:o}=await import("@tcswap/helpers/contracts"),n=b.from({asset:"ETH.FLIP"});if(!i.eqAsset(n))throw new d("chainflip_broker_fund_only_flip_supported");if(!e.validateAddress(t))throw new d("chainflip_broker_fund_invalid_address");let r=y(t)?t:S(x(t));return s.call({abi:o,contractAddress:"0x6995ab7c4d7f4b03f467cf4c8e920427d9621dbd",funcName:"fundStateChainAccount",funcParams:[r,i.getBaseValue("string")]})},U=(e)=>({fundStateChainAccount:D(e),registerAsBroker:T(e),withdrawFee:_(e)});import{AssetValue as P,ProviderName as m,USwapError as f}from"@tcswap/helpers";import{USwapApi as F}from"@tcswap/helpers/api";var q=A({methods:({getWallet:e})=>({swap:async function(t){if(!(t?.route?.buyAsset&&t.route.meta?.chainflip))throw new f("core_swap_invalid_params",{...t});let{route:{buyAsset:i,sellAsset:o,sellAmount:n,meta:{chainflip:r}},maxBoostFeeBps:c=0}=t;if(!(o&&i))throw new f("core_swap_asset_not_recognized");let p=await P.from({asset:o,asyncTokenLookup:!0,value:n}),a=e(p.chain);if(!a||!("transfer"in a))throw new f("core_wallet_connection_not_found");let{depositAddress:l}=await F.getChainflipDepositChannel({...r,maxBoostFeeBps:c||r.maxBoostFeeBps});return await a.transfer({assetValue:p,isProgramDerivedAddress:!0,recipient:l,sender:a.address})}}),name:"chainflip",properties:{supportedUSwapProviders:[m.CHAINFLIP,m.CHAINFLIP_STREAMING]}});export{H as assetIdentifierToChainflipTicker,q as ChainflipPlugin,U as ChainflipBroker};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=AFF486E40677BA0764756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport { decodeAddress } from \"@polkadot/keyring\";\nimport { isHex, u8aToHex } from \"@polkadot/util\";\nimport { AssetValue, Chain, USwapError, wrapWithThrow } from \"@tcswap/helpers\";\nimport type { getEvmToolbox } from \"@tcswap/toolboxes/evm\";\nimport type { getSubstrateToolbox } from \"@tcswap/toolboxes/substrate\";\n\nimport type { WithdrawFeeResponse } from \"./types\";\n\ntype ChainflipToolbox = Awaited<ReturnType<typeof getSubstrateToolbox<typeof Chain.Chainflip>>>;\n\nexport const assetIdentifierToChainflipTicker = new Map<string, string>([\n [\"ARB.ETH\", \"ArbEth\"],\n [\"ARB.USDC-0XAF88D065E77C8CC2239327C5EDB3A432268E5831\", \"ArbUsdc\"],\n [\"BTC.BTC\", \"Btc\"],\n [\"DOT.DOT\", \"Dot\"],\n [\"ETH.ETH\", \"Eth\"],\n [\"ETH.FLIP-0X826180541412D574CF1336D22C0C0A287822678A\", \"Flip\"],\n [\"ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48\", \"Usdc\"],\n [\"ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7\", \"Usdt\"],\n [\"SOL.SOL\", \"Sol\"],\n [\"SOL.USDC-EPJFWDD5AUFQSSQEM2QN1XZYBAPC8G4WEGGKZWYTDT1V\", \"SolUsdc\"],\n]);\n\nconst registerAsBroker = (toolbox: ChainflipToolbox) => () => {\n const extrinsic = toolbox.api.tx.swapping?.registerAsBroker?.();\n\n if (!extrinsic) {\n throw new USwapError(\"chainflip_broker_register\");\n }\n\n return toolbox.signAndBroadcast({ address: toolbox.getAddress(), tx: extrinsic });\n};\n\nconst withdrawFee =\n (toolbox: ChainflipToolbox) =>\n ({ feeAsset, recipient }: { feeAsset: AssetValue; recipient: string }) => {\n const isFeeChainPolkadot = feeAsset.chain === Chain.Polkadot;\n\n const recipientAddress = wrapWithThrow(() => {\n return isFeeChainPolkadot ? toolbox.encodeAddress(toolbox.decodeAddress(recipient), \"hex\") : recipient;\n }, \"chainflip_broker_recipient_error\");\n\n return new Promise<WithdrawFeeResponse>((resolve) => {\n const extrinsic = toolbox.api.tx?.swapping?.withdraw?.(feeAsset.ticker.toLowerCase(), {\n [feeAsset.chain.toLowerCase()]: recipientAddress,\n });\n\n if (!extrinsic) {\n throw new USwapError(\"chainflip_broker_withdraw\");\n }\n\n toolbox.signAndBroadcast({\n callback: (result) => {\n if (!result.status?.isFinalized) {\n return;\n }\n\n const withdrawEvent = result.events.find((event) => event.event.method === \"WithdrawalRequested\");\n\n if (!withdrawEvent) {\n throw new USwapError(\"chainflip_channel_error\", \"Could not find 'WithdrawalRequested' event\");\n }\n const {\n event: {\n data: { egressId, egressAsset, egressAmount, egressFee, destinationAddress },\n },\n } = withdrawEvent.toHuman() as any;\n resolve({ destinationAddress, egressAmount, egressAsset, egressFee, egressId });\n },\n tx: extrinsic,\n });\n });\n };\n\nconst fundStateChainAccount =\n (chainflipToolbox: ChainflipToolbox) =>\n async ({\n evmToolbox,\n stateChainAccount,\n assetValue,\n }: {\n evmToolbox: Awaited<ReturnType<typeof getEvmToolbox>>;\n stateChainAccount: string;\n assetValue: AssetValue;\n }) => {\n const { chainflipGateway } = await import(\"@tcswap/helpers/contracts\");\n\n const flipAssetValue = AssetValue.from({ asset: \"ETH.FLIP\" });\n\n if (!assetValue.eqAsset(flipAssetValue)) {\n throw new USwapError(\"chainflip_broker_fund_only_flip_supported\");\n }\n\n if (!chainflipToolbox.validateAddress(stateChainAccount)) {\n throw new USwapError(\"chainflip_broker_fund_invalid_address\");\n }\n\n const hexAddress = isHex(stateChainAccount) ? stateChainAccount : u8aToHex(decodeAddress(stateChainAccount));\n\n return evmToolbox.call<string>({\n abi: chainflipGateway,\n contractAddress: \"0x6995ab7c4d7f4b03f467cf4c8e920427d9621dbd\",\n funcName: \"fundStateChainAccount\",\n funcParams: [hexAddress, assetValue.getBaseValue(\"string\")],\n });\n };\n\nexport const ChainflipBroker = (chainflipToolbox: ChainflipToolbox) => ({\n fundStateChainAccount: fundStateChainAccount(chainflipToolbox),\n registerAsBroker: registerAsBroker(chainflipToolbox),\n withdrawFee: withdrawFee(chainflipToolbox),\n});\n",
|
|
6
6
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport { AssetValue, type Chain, ProviderName, USwapError } from \"@tcswap/helpers\";\nimport { USwapApi } from \"@tcswap/helpers/api\";\nimport { createPlugin } from \"../utils\";\nimport type { RequestSwapDepositAddressParams } from \"./types\";\n\nexport const ChainflipPlugin = createPlugin({\n methods: ({ getWallet }) => ({\n swap: async function chainflipSwap(swapParams: RequestSwapDepositAddressParams) {\n if (!(swapParams?.route?.buyAsset && swapParams.route.meta?.chainflip)) {\n throw new USwapError(\"core_swap_invalid_params\", { ...swapParams });\n }\n\n const {\n route: {\n buyAsset: buyAssetString,\n sellAsset: sellAssetString,\n sellAmount,\n meta: { chainflip },\n },\n maxBoostFeeBps = 0,\n } = swapParams;\n\n if (!(sellAssetString && buyAssetString)) {\n throw new USwapError(\"core_swap_asset_not_recognized\");\n }\n\n const sellAsset = await AssetValue.from({ asset: sellAssetString, asyncTokenLookup: true, value: sellAmount });\n\n const wallet = getWallet(sellAsset.chain as Exclude<Chain, Chain.Radix>);\n\n if (!wallet || !(\"transfer\" in wallet)) {\n throw new USwapError(\"core_wallet_connection_not_found\");\n }\n\n const { depositAddress } = await USwapApi.getChainflipDepositChannel({\n ...chainflip,\n maxBoostFeeBps: maxBoostFeeBps || chainflip.maxBoostFeeBps,\n });\n\n const tx = await wallet.transfer({\n assetValue: sellAsset,\n isProgramDerivedAddress: true,\n recipient: depositAddress,\n sender: wallet.address,\n });\n\n return tx;\n },\n }),\n name: \"chainflip\",\n properties: { supportedUSwapProviders: [ProviderName.CHAINFLIP, ProviderName.CHAINFLIP_STREAMING] as const },\n});\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": "gDAIA,wBAAS,0BACT,gBAAS,cAAO,uBAChB,qBAAS,WAAY,gBAAO,mBAAY,wBAQjC,IAAM,EAAmC,IAAI,IAAoB,CACtE,CAAC,UAAW,QAAQ,EACpB,CAAC,sDAAuD,SAAS,EACjE,CAAC,UAAW,KAAK,EACjB,CAAC,UAAW,KAAK,EACjB,CAAC,UAAW,KAAK,EACjB,CAAC,sDAAuD,MAAM,EAC9D,CAAC,sDAAuD,MAAM,EAC9D,CAAC,sDAAuD,MAAM,EAC9D,CAAC,UAAW,KAAK,EACjB,CAAC,wDAAyD,SAAS,CACrE,CAAC,EAEK,EAAmB,CAAC,IAA8B,IAAM,CAC5D,IAAM,EAAY,EAAQ,IAAI,GAAG,UAAU,mBAAmB,EAE9D,GAAI,CAAC,EACH,MAAM,IAAI,EAAW,2BAA2B,EAGlD,OAAO,EAAQ,iBAAiB,CAAE,QAAS,EAAQ,WAAW,EAAG,GAAI,CAAU,CAAC,G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CAAC,GAGQ,EAAkB,CAAC,KAAwC,CACtE,sBAAuB,EAAsB,CAAgB,EAC7D,iBAAkB,EAAiB,CAAgB,EACnD,YAAa,EAAY,CAAgB,CAC3C,GC/GA,qBAAS,kBAAwB,gBAAc,wBAC/C,mBAAS,4BAIF,IAAM,EAAkB,EAAa,CAC1C,QAAS,EAAG,gBAAiB,CAC3B,KAAM,cAA4B,CAAC,EAA6C,CAC9E,GAAI,EAAE,GAAY,OAAO,UAAY,EAAW,MAAM,MAAM,WAC1D,MAAM,IAAI,EAAW,2BAA4B,IAAK,CAAW,CAAC,EAGpE,IACE,OACE,SAAU,EACV,UAAW,EACX,aACA,MAAQ,cAEV,iBAAiB,GACf,EAEJ,GAAI,EAAE,GAAmB,GACvB,MAAM,IAAI,EAAW,gCAAgC,EAGvD,IAAM,EAAY,MAAM,EAAW,KAAK,CAAE,MAAO,EAAiB,iBAAkB,GAAM,MAAO,CAAW,CAAC,EAEvG,EAAS,EAAU,EAAU,KAAoC,EAEvE,GAAI,CAAC,GAAU,EAAE,aAAc,GAC7B,MAAM,IAAI,EAAW,kCAAkC,EAGzD,IAAQ,kBAAmB,MAAM,EAAS,2BAA2B,IAChE,EACH,eAAgB,GAAkB,EAAU,cAC9C,CAAC,EASD,OAPW,MAAM,EAAO,SAAS,CAC/B,WAAY,EACZ,wBAAyB,GACzB,UAAW,EACX,OAAQ,EAAO,OACjB,CAAC,EAIL,GACA,KAAM,YACN,WAAY,CAAE,wBAAyB,CAAC,EAAa,UAAW,EAAa,mBAAmB,CAAW,CAC7G,CAAC",
|
|
9
|
+
"debugId": "AFF486E40677BA0764756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var v=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(s,n)=>(typeof require<"u"?require:s)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});import{EVMChains as d,USwapError as c}from"@tcswap/helpers";function y({name:e,properties:s,methods:n}){function r(o){return{...n(o),...s}}return{[e]:r}}function A({approveMode:e,getWallet:s}){return function({assetValue:r,spenderAddress:o}){let i=r.chain,p=d.includes(i);if(p&&r.isGasAsset||!p||r.isSynthetic)return Promise.resolve(e==="checkOnly"||"approved");let t=s(i),a=e==="checkOnly"?t.isApproved:t.approve;if(!(r.address&&t.address))throw new c("core_approve_asset_address_or_from_not_found");return a({amount:r.getBaseValue("bigint"),assetAddress:r.address,from:t.address,spenderAddress:o})}}
|
|
2
|
+
export{v as a,y as b,A as c};
|
|
3
|
+
|
|
4
|
+
//# debugId=43FAF379B77D249264756E2164756E21
|
|
5
|
+
//# sourceMappingURL=chunk-awrrj6sh.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/utils.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport type { ApproveMode, ApproveReturnType, EVMChain, ProviderName } from \"@tcswap/helpers\";\nimport { type AssetValue, EVMChains, USwapError } from \"@tcswap/helpers\";\nimport type { SwapKitPluginParams } from \"./types\";\n\nexport function createPlugin<\n const Name extends string,\n T extends (params: SwapKitPluginParams) => Record<string, unknown>,\n K extends { supportedUSwapProviders?: readonly ProviderName[] },\n>({ name, properties, methods }: { name: Name; properties?: K; methods: T }) {\n function plugin(pluginParams: SwapKitPluginParams) {\n return { ...methods(pluginParams), ...properties } as K & ReturnType<T>;\n }\n\n return { [name]: plugin } as { [key in Name]: typeof plugin };\n}\n\nexport function approve<T extends ApproveMode>({ approveMode, getWallet }: { approveMode: T } & SwapKitPluginParams) {\n return function approve({ assetValue, spenderAddress }: { spenderAddress: string; assetValue: AssetValue }) {\n const evmChain = assetValue.chain as EVMChain;\n const isEVMChain = EVMChains.includes(evmChain);\n const isNativeEVM = isEVMChain && assetValue.isGasAsset;\n\n if (isNativeEVM || !isEVMChain || assetValue.isSynthetic) {\n const isApproved = approveMode === \"checkOnly\" || \"approved\";\n return Promise.resolve(isApproved) as ApproveReturnType<T>;\n }\n\n const wallet = getWallet(evmChain);\n const walletAction = approveMode === \"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,\n });\n };\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "2PAKA,oBAA0B,gBAAW,wBAG9B,SAAS,CAIf,EAAG,OAAM,aAAY,WAAuD,CAC3E,SAAS,CAAM,CAAC,EAAmC,CACjD,MAAO,IAAK,EAAQ,CAAY,KAAM,CAAW,EAGnD,MAAO,EAAG,GAAO,CAAO,EAGnB,SAAS,CAA8B,EAAG,cAAa,aAAuD,CACnH,OAAO,QAAgB,EAAG,aAAY,kBAAsE,CAC1G,IAAM,EAAW,EAAW,MACtB,EAAa,EAAU,SAAS,CAAQ,EAG9C,GAFoB,GAAc,EAAW,YAE1B,CAAC,GAAc,EAAW,YAE3C,OAAO,QAAQ,QADI,IAAgB,aAAe,UACjB,EAGnC,IAAM,EAAS,EAAU,CAAQ,EAC3B,EAAe,IAAgB,YAAc,EAAO,WAAa,EAAO,QAE9E,GAAI,EAAE,EAAW,SAAW,EAAO,SACjC,MAAM,IAAI,EAAW,8CAA8C,EAGrE,OAAO,EAAa,CAClB,OAAQ,EAAW,aAAa,QAAQ,EACxC,aAAc,EAAW,QACzB,KAAM,EAAO,QACb,gBACF,CAAC",
|
|
8
|
+
"debugId": "43FAF379B77D249264756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var{defineProperty:p,getOwnPropertyNames:u,getOwnPropertyDescriptor:v}=Object,l=Object.prototype.hasOwnProperty;function f(e){return this[e]}var h=(e)=>{var r=(c??=new WeakMap).get(e),n;if(r)return r;if(r=p({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var s of u(e))if(!l.call(r,s))p(r,s,{get:f.bind(e,s),enumerable:!(n=v(e,s))||n.enumerable})}return c.set(e,r),r},c;var y=(e)=>e;function A(e,r){this[e]=y.bind(null,r)}var w=(e,r)=>{for(var n in r)p(e,n,{get:r[n],enumerable:!0,configurable:!0,set:A.bind(r,n)})};var o=require("@tcswap/helpers");function T({name:e,properties:r,methods:n}){function s(i){return{...n(i),...r}}return{[e]:s}}function S({approveMode:e,getWallet:r}){return function({assetValue:s,spenderAddress:i}){let a=s.chain,d=o.EVMChains.includes(a);if(d&&s.isGasAsset||!d||s.isSynthetic)return Promise.resolve(e==="checkOnly"||"approved");let t=r(a),m=e==="checkOnly"?t.isApproved:t.approve;if(!(s.address&&t.address))throw new o.USwapError("core_approve_asset_address_or_from_not_found");return m({amount:s.getBaseValue("bigint"),assetAddress:s.address,from:t.address,spenderAddress:i})}}
|
|
2
|
+
|
|
3
|
+
//# debugId=E71BD82CC47099F764756E2164756E21
|
|
4
|
+
//# sourceMappingURL=chunk-ygsqt852.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/utils.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport type { ApproveMode, ApproveReturnType, EVMChain, ProviderName } from \"@tcswap/helpers\";\nimport { type AssetValue, EVMChains, USwapError } from \"@tcswap/helpers\";\nimport type { SwapKitPluginParams } from \"./types\";\n\nexport function createPlugin<\n const Name extends string,\n T extends (params: SwapKitPluginParams) => Record<string, unknown>,\n K extends { supportedUSwapProviders?: readonly ProviderName[] },\n>({ name, properties, methods }: { name: Name; properties?: K; methods: T }) {\n function plugin(pluginParams: SwapKitPluginParams) {\n return { ...methods(pluginParams), ...properties } as K & ReturnType<T>;\n }\n\n return { [name]: plugin } as { [key in Name]: typeof plugin };\n}\n\nexport function approve<T extends ApproveMode>({ approveMode, getWallet }: { approveMode: T } & SwapKitPluginParams) {\n return function approve({ assetValue, spenderAddress }: { spenderAddress: string; assetValue: AssetValue }) {\n const evmChain = assetValue.chain as EVMChain;\n const isEVMChain = EVMChains.includes(evmChain);\n const isNativeEVM = isEVMChain && assetValue.isGasAsset;\n\n if (isNativeEVM || !isEVMChain || assetValue.isSynthetic) {\n const isApproved = approveMode === \"checkOnly\" || \"approved\";\n return Promise.resolve(isApproved) as ApproveReturnType<T>;\n }\n\n const wallet = getWallet(evmChain);\n const walletAction = approveMode === \"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,\n });\n };\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "miBAKuD,IAAvD,6BAGO,SAAS,CAIf,EAAG,OAAM,aAAY,WAAuD,CAC3E,SAAS,CAAM,CAAC,EAAmC,CACjD,MAAO,IAAK,EAAQ,CAAY,KAAM,CAAW,EAGnD,MAAO,EAAG,GAAO,CAAO,EAGnB,SAAS,CAA8B,EAAG,cAAa,aAAuD,CACnH,OAAO,QAAgB,EAAG,aAAY,kBAAsE,CAC1G,IAAM,EAAW,EAAW,MACtB,EAAa,YAAU,SAAS,CAAQ,EAG9C,GAFoB,GAAc,EAAW,YAE1B,CAAC,GAAc,EAAW,YAE3C,OAAO,QAAQ,QADI,IAAgB,aAAe,UACjB,EAGnC,IAAM,EAAS,EAAU,CAAQ,EAC3B,EAAe,IAAgB,YAAc,EAAO,WAAa,EAAO,QAE9E,GAAI,EAAE,EAAW,SAAW,EAAO,SACjC,MAAM,IAAI,aAAW,8CAA8C,EAGrE,OAAO,EAAa,CAClB,OAAQ,EAAW,aAAa,QAAQ,EACxC,aAAc,EAAW,QACzB,KAAM,EAAO,QACb,gBACF,CAAC",
|
|
8
|
+
"debugId": "E71BD82CC47099F764756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/evm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as t,c as o}from"../chunk-awrrj6sh.js";import{ApproveMode as p,AssetValue as A,EVMChains as E,ProviderName as e,USwapError as d}from"@tcswap/helpers";var M=t({methods:({getWallet:a})=>({approveAssetValue:o({approveMode:p.Approve,getWallet:a}),isAssetValueApproved:o({approveMode:p.CheckOnly,getWallet:a}),swap:async function({route:{tx:s,sellAsset:n},feeOptionKey:i}){let r=(await A.from({asset:n,asyncTokenLookup:!0})).chain,u=a(r);if(!(E.includes(r)&&s))throw new d("core_swap_invalid_params");let{from:c,to:m,data:V,value:v}=s;return u.sendTransaction({data:V,feeOptionKey:i,from:c,to:m,value:BigInt(v)})}}),name:"evm",properties:{supportedUSwapProviders:[e.CAMELOT_V3,e.OPENOCEAN_V2,e.OKX,e.ONEINCH,e.PANCAKESWAP,e.PANGOLIN_V1,e.SUSHISWAP_V2,e.TRADERJOE_V2,e.UNISWAP_V2,e.UNISWAP_V3]}});export{M as EVMPlugin};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=A97456A10D4B53DD64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/evm/index.js.map
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport {\n ApproveMode,\n AssetValue,\n type EVMChain,\n EVMChains,\n ProviderName,\n type SwapParams,\n USwapError,\n} from \"@tcswap/helpers\";\nimport type { EVMTransaction, QuoteResponseRoute } from \"@tcswap/helpers/api\";\nimport { approve, createPlugin } from \"../utils\";\n\nexport const EVMPlugin = createPlugin({\n methods: ({ getWallet }) => ({\n approveAssetValue: approve({ approveMode: ApproveMode.Approve, getWallet }),\n isAssetValueApproved: approve({ approveMode: ApproveMode.CheckOnly, getWallet }),\n swap: async function evmSwap({ route: { tx, sellAsset }, feeOptionKey }: SwapParams<\"evm\", QuoteResponseRoute>) {\n const assetValue = await AssetValue.from({ asset: sellAsset, asyncTokenLookup: true });\n const evmChain = assetValue.chain as EVMChain;\n const wallet = getWallet(evmChain);\n\n if (!(EVMChains.includes(evmChain) && tx)) {\n throw new USwapError(\"core_swap_invalid_params\");\n }\n\n const { from, to, data, value } = tx as EVMTransaction;\n return wallet.sendTransaction({ data, feeOptionKey, from, to, value: BigInt(value) });\n },\n }),\n name: \"evm\",\n properties: {\n supportedUSwapProviders: [\n ProviderName.CAMELOT_V3,\n ProviderName.OPENOCEAN_V2,\n ProviderName.OKX,\n ProviderName.ONEINCH,\n ProviderName.PANCAKESWAP,\n ProviderName.PANGOLIN_V1,\n ProviderName.SUSHISWAP_V2,\n ProviderName.TRADERJOE_V2,\n ProviderName.UNISWAP_V2,\n ProviderName.UNISWAP_V3,\n ] as const,\n },\n});\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "gDAIA,sBACE,gBACA,eAEA,kBACA,gBAEA,wBAKK,IAAM,EAAY,EAAa,CACpC,QAAS,EAAG,gBAAiB,CAC3B,kBAAmB,EAAQ,CAAE,YAAa,EAAY,QAAS,WAAU,CAAC,EAC1E,qBAAsB,EAAQ,CAAE,YAAa,EAAY,UAAW,WAAU,CAAC,EAC/E,KAAM,cAAsB,EAAG,OAAS,KAAI,aAAa,gBAAuD,CAE9G,IAAM,GADa,MAAM,EAAW,KAAK,CAAE,MAAO,EAAW,iBAAkB,EAAK,CAAC,GACzD,MACtB,EAAS,EAAU,CAAQ,EAEjC,GAAI,EAAE,EAAU,SAAS,CAAQ,GAAK,GACpC,MAAM,IAAI,EAAW,0BAA0B,EAGjD,IAAQ,OAAM,KAAI,OAAM,SAAU,EAClC,OAAO,EAAO,gBAAgB,CAAE,OAAM,eAAc,OAAM,KAAI,MAAO,OAAO,CAAK,CAAE,CAAC,EAExF,GACA,KAAM,MACN,WAAY,CACV,wBAAyB,CACvB,EAAa,WACb,EAAa,aACb,EAAa,IACb,EAAa,QACb,EAAa,YACb,EAAa,YACb,EAAa,aACb,EAAa,aACb,EAAa,WACb,EAAa,UACf,CACF,CACF,CAAC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "A97456A10D4B53DD64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/garden/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as d,c as n}from"../chunk-awrrj6sh.js";import{VersionedTransaction as f}from"@solana/web3.js";import{ApproveMode as c,AssetValue as g,Chain as v,EVMChains as A,ProviderName as V,USwapError as M}from"@tcswap/helpers";import{match as P}from"ts-pattern";var T=d({methods:({getWallet:a})=>({approveAssetValue:n({approveMode:c.Approve,getWallet:a}),isAssetValueApproved:n({approveMode:c.CheckOnly,getWallet:a}),swap:function({route:u}){let{sellAsset:m,sellAmount:l,targetAddress:o,tx:i}=u,p=g.from({asset:m,value:l});return P(p.chain).returnType().with(...A,(e)=>{let s=a(e),{from:r,to:t,data:w,value:h}=i;return s.sendTransaction({data:w,from:r,to:t,value:BigInt(h)})}).with(v.Solana,async(e)=>{let s=a(e),r=f.deserialize(Buffer.from(i,"base64")),t=await s.signTransaction(r);return s.broadcastTransaction(t)}).otherwise(async(e)=>{if(!o)throw new M("plugin_garden_missing_data",{message:"Missing target address: "});return await a(e).transfer({assetValue:p,recipient:o})})}}),name:"garden",properties:{supportedUSwapProviders:[V.GARDEN]}});export{T as GardenPlugin};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=563E2735648F4F1B64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/garden/index.js.map
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport { VersionedTransaction } from \"@solana/web3.js\";\nimport { ApproveMode, AssetValue, Chain, EVMChains, ProviderName, type SwapParams, USwapError } from \"@tcswap/helpers\";\nimport type { EVMTransaction, QuoteResponseRoute } from \"@tcswap/helpers/api\";\nimport { match } from \"ts-pattern\";\nimport { approve, createPlugin } from \"../utils\";\n\nexport const GardenPlugin = createPlugin({\n methods: ({ getWallet }) => ({\n approveAssetValue: approve({ approveMode: ApproveMode.Approve, getWallet }),\n isAssetValueApproved: approve({ approveMode: ApproveMode.CheckOnly, getWallet }),\n swap: function gardenSwap({ route }: SwapParams<\"garden\", QuoteResponseRoute>) {\n const { sellAsset, sellAmount, targetAddress, tx } = route;\n\n const sellAssetValue = AssetValue.from({ asset: sellAsset, value: sellAmount });\n\n return match(sellAssetValue.chain as Chain)\n .returnType<Promise<string>>()\n .with(...EVMChains, (chain) => {\n const wallet = getWallet(chain);\n\n const { from, to, data, value } = tx as EVMTransaction;\n return wallet.sendTransaction({ data, from, to, value: BigInt(value) });\n })\n .with(Chain.Solana, async (chain) => {\n const wallet = getWallet(chain);\n const transaction = VersionedTransaction.deserialize(Buffer.from(tx as string, \"base64\"));\n\n const signedTransaction = await wallet.signTransaction(transaction);\n\n return wallet.broadcastTransaction(signedTransaction);\n })\n .otherwise(async (chain) => {\n if (!targetAddress) {\n throw new USwapError(\"plugin_garden_missing_data\", { message: \"Missing target address: \" });\n }\n const wallet = getWallet(chain as Exclude<Chain, Chain.Radix>);\n\n const txHash = await wallet.transfer({ assetValue: sellAssetValue, recipient: targetAddress });\n\n return txHash;\n });\n },\n }),\n name: \"garden\",\n properties: { supportedUSwapProviders: [ProviderName.GARDEN] as const },\n});\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "gDAIA,+BAAS,wBACT,sBAAS,gBAAa,WAAY,eAAO,kBAAW,gBAA+B,wBAEnF,gBAAS,mBAGF,IAAM,EAAe,EAAa,CACvC,QAAS,EAAG,gBAAiB,CAC3B,kBAAmB,EAAQ,CAAE,YAAa,EAAY,QAAS,WAAU,CAAC,EAC1E,qBAAsB,EAAQ,CAAE,YAAa,EAAY,UAAW,WAAU,CAAC,EAC/E,KAAM,QAAmB,EAAG,SAAmD,CAC7E,IAAQ,YAAW,aAAY,gBAAe,MAAO,EAE/C,EAAiB,EAAW,KAAK,CAAE,MAAO,EAAW,MAAO,CAAW,CAAC,EAE9E,OAAO,EAAM,EAAe,KAAc,EACvC,WAA4B,EAC5B,KAAK,GAAG,EAAW,CAAC,IAAU,CAC7B,IAAM,EAAS,EAAU,CAAK,GAEtB,OAAM,KAAI,OAAM,SAAU,EAClC,OAAO,EAAO,gBAAgB,CAAE,OAAM,OAAM,KAAI,MAAO,OAAO,CAAK,CAAE,CAAC,EACvE,EACA,KAAK,EAAM,OAAQ,MAAO,IAAU,CACnC,IAAM,EAAS,EAAU,CAAK,EACxB,EAAc,EAAqB,YAAY,OAAO,KAAK,EAAc,QAAQ,CAAC,EAElF,EAAoB,MAAM,EAAO,gBAAgB,CAAW,EAElE,OAAO,EAAO,qBAAqB,CAAiB,EACrD,EACA,UAAU,MAAO,IAAU,CAC1B,GAAI,CAAC,EACH,MAAM,IAAI,EAAW,6BAA8B,CAAE,QAAS,0BAA2B,CAAC,EAM5F,OAFe,MAFA,EAAU,CAAoC,EAEjC,SAAS,CAAE,WAAY,EAAgB,UAAW,CAAc,CAAC,EAG9F,EAEP,GACA,KAAM,SACN,WAAY,CAAE,wBAAyB,CAAC,EAAa,MAAM,CAAW,CACxE,CAAC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "563E2735648F4F1B64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var l={};o(l,{loadPlugin:()=>p,createPlugin:()=>r,approve:()=>e});module.exports=a(l);async function p(t){let{match:n}=await import("ts-pattern");return await n(t).with("chainflip",async()=>{let{ChainflipPlugin:i}=await import("./chainflip/index.cjs");return i}).with("thorchain",async()=>{let{ThorchainPlugin:i}=await import("./thorchain/index.cjs");return i}).with("radix",async()=>{let{RadixPlugin:i}=await import("./radix/index.cjs");return i}).with("evm",async()=>{let{EVMPlugin:i}=await import("./evm/index.cjs");return i}).with("solana",async()=>{let{SolanaPlugin:i}=await import("./solana/index.cjs");return i}).with("near",async()=>{let{NearPlugin:i}=await import("./near/index.cjs");return i}).exhaustive()}
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=77B0AE504CD00CEF64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport type { PluginName, USwapPlugins } from \"./types\";\n\nexport * from \"./types\";\nexport * from \"./utils\";\n\nexport async function loadPlugin<P extends PluginName>(pluginName: P) {\n const { match } = await import(\"ts-pattern\");\n\n const plugin = await match(pluginName as PluginName)\n .with(\"chainflip\", async () => {\n const { ChainflipPlugin } = await import(\"./chainflip\");\n return ChainflipPlugin;\n })\n .with(\"thorchain\", async () => {\n const { ThorchainPlugin } = await import(\"./thorchain\");\n return ThorchainPlugin;\n })\n .with(\"radix\", async () => {\n const { RadixPlugin } = await import(\"./radix\");\n return RadixPlugin;\n })\n .with(\"evm\", async () => {\n const { EVMPlugin } = await import(\"./evm\");\n return EVMPlugin;\n })\n .with(\"solana\", async () => {\n const { SolanaPlugin } = await import(\"./solana\");\n return SolanaPlugin;\n })\n .with(\"near\", async () => {\n const { NearPlugin } = await import(\"./near\");\n return NearPlugin;\n })\n .exhaustive();\n\n return plugin as unknown as USwapPlugins[P];\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "sFASA,eAAsB,CAAgC,CAAC,EAAe,CACpE,IAAQ,SAAU,KAAa,sBA6B/B,OA3Be,MAAM,EAAM,CAAwB,EAChD,KAAK,YAAa,SAAY,CAC7B,IAAQ,mBAAoB,KAAa,iCACzC,OAAO,EACR,EACA,KAAK,YAAa,SAAY,CAC7B,IAAQ,mBAAoB,KAAa,iCACzC,OAAO,EACR,EACA,KAAK,QAAS,SAAY,CACzB,IAAQ,eAAgB,KAAa,6BACrC,OAAO,EACR,EACA,KAAK,MAAO,SAAY,CACvB,IAAQ,aAAc,KAAa,2BACnC,OAAO,EACR,EACA,KAAK,SAAU,SAAY,CAC1B,IAAQ,gBAAiB,KAAa,8BACtC,OAAO,EACR,EACA,KAAK,OAAQ,SAAY,CACxB,IAAQ,cAAe,KAAa,4BACpC,OAAO,EACR,EACA,WAAW",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "77B0AE504CD00CEF64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as t,b as
|
|
1
|
+
import{a as t,b as u,c as s}from"./chunk-awrrj6sh.js";async function r(n){let{match:a}=await import("ts-pattern");return await a(n).with("chainflip",async()=>{let{ChainflipPlugin:i}=await import("./chainflip/index.js");return i}).with("thorchain",async()=>{let{ThorchainPlugin:i}=await import("./thorchain/index.js");return i}).with("radix",async()=>{let{RadixPlugin:i}=await import("./radix/index.js");return i}).with("evm",async()=>{let{EVMPlugin:i}=await import("./evm/index.js");return i}).with("solana",async()=>{let{SolanaPlugin:i}=await import("./solana/index.js");return i}).with("near",async()=>{let{NearPlugin:i}=await import("./near/index.js");return i}).exhaustive()}export{r as loadPlugin,u as createPlugin,s as approve};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=5D09B37EA2DF83C564756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport type { PluginName, USwapPlugins } from \"./types\";\n\nexport * from \"./types\";\nexport * from \"./utils\";\n\nexport async function loadPlugin<P extends PluginName>(pluginName: P) {\n const { match } = await import(\"ts-pattern\");\n\n const plugin = await match(pluginName as PluginName)\n .with(\"chainflip\", async () => {\n const { ChainflipPlugin } = await import(\"./chainflip\");\n return ChainflipPlugin;\n })\n .with(\"thorchain\", async () => {\n const { ThorchainPlugin } = await import(\"./thorchain\");\n return ThorchainPlugin;\n })\n .with(\"radix\", async () => {\n const { RadixPlugin } = await import(\"./radix\");\n return RadixPlugin;\n })\n .with(\"evm\", async () => {\n const { EVMPlugin } = await import(\"./evm\");\n return EVMPlugin;\n })\n .with(\"solana\", async () => {\n const { SolanaPlugin } = await import(\"./solana\");\n return SolanaPlugin;\n })\n .with(\"near\", async () => {\n const { NearPlugin } = await import(\"./near\");\n return NearPlugin;\n })\n .exhaustive();\n\n return plugin as unknown as USwapPlugins[P];\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "sDASA,eAAsB,CAAgC,CAAC,EAAe,CACpE,IAAQ,SAAU,KAAa,sBA6B/B,OA3Be,MAAM,EAAM,CAAwB,EAChD,KAAK,YAAa,SAAY,CAC7B,IAAQ,mBAAoB,KAAa,gCACzC,OAAO,EACR,EACA,KAAK,YAAa,SAAY,CAC7B,IAAQ,mBAAoB,KAAa,gCACzC,OAAO,EACR,EACA,KAAK,QAAS,SAAY,CACzB,IAAQ,eAAgB,KAAa,4BACrC,OAAO,EACR,EACA,KAAK,MAAO,SAAY,CACvB,IAAQ,aAAc,KAAa,0BACnC,OAAO,EACR,EACA,KAAK,SAAU,SAAY,CAC1B,IAAQ,gBAAiB,KAAa,6BACtC,OAAO,EACR,EACA,KAAK,OAAQ,SAAY,CACxB,IAAQ,cAAe,KAAa,2BACpC,OAAO,EACR,EACA,WAAW",
|
|
8
|
+
"debugId": "5D09B37EA2DF83C564756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/near/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as X}from"../chunk-awrrj6sh.js";import{AssetValue as O,Chain as Y,ProviderName as P,USwapError as Q}from"@tcswap/helpers";import{parseNearAmount as G}from"@near-js/utils";var L=2,k=64;function $(J){if(J.length<L||J.length>k)return!1;return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(J)}function V(J){let q=J.length,x;if(q<=2)x="50";else if(q<=3)x="20";else if(q<=4)x="5";else if(q<=5)x="1";else x="0.1";return G(x)||"0"}var z=X({methods:({getWallet:J})=>({nearNames:{async getInfo(q){let x=q.toLowerCase().replace(/\.near$/,"");if(!$(x))throw new Q("plugin_near_invalid_name");let D=`${x}.near`,B=J(Y.Near);if(!B)throw new Q("plugin_near_no_connection");try{let F=await B.provider.query({account_id:D,finality:"final",request_type:"view_account"}),Z=await B.provider.query({account_id:D,finality:"final",request_type:"view_access_key_list"});return{accountId:D,balance:F.amount,codeHash:F.code_hash,publicKeys:Z.keys?.map((K)=>K.public_key)||[],storageUsed:F.storage_usage}}catch(F){if(/UNKNOWN_ACCOUNT|does not exist while viewing/.test(F.message))return null;throw F}},async isAvailable(q){return await this.resolve(q)===null},async lookupNames(q){let x=J(Y.Near);if(!x)throw new Q("plugin_near_no_connection");try{if(await x.provider.query({account_id:q,finality:"final",request_type:"view_account"}),q.endsWith(".near"))return[q];return[]}catch{return[]}},async register(q){let{name:x,publicKey:D}=q,B=x.toLowerCase().replace(/\.near$/,"");if(!$(B))throw new Q("plugin_near_invalid_name");let F=J(Y.Near),Z=D||await F.getPublicKey(),K=V(B);return F.callFunction({args:{new_account_id:`${B}.near`,new_public_key:Z},contractId:"near",deposit:K,methodName:"create_account"})},async resolve(q){let x=q.toLowerCase().replace(/\.near$/,"");if(!$(x))throw new Q("plugin_near_invalid_name");let D=`${x}.near`,B=J(Y.Near);if(!B)throw new Q("plugin_near_no_connection");try{return await B.provider.query({account_id:D,finality:"final",request_type:"view_account"}),D}catch(F){if(/UNKNOWN_ACCOUNT|does not exist while viewing/.test(F.message))return null;throw F}},transfer(q,x){let D=q.toLowerCase().replace(/\.near$/,"");if(!$(D))throw new Q("plugin_near_invalid_name");return J(Y.Near).callFunction({args:{name:D,new_owner:x},contractId:"near",deposit:"1",methodName:"transfer"})}},async swap(q){let{route:{buyAsset:x,sellAsset:D,inboundAddress:B,sellAmount:F,meta:Z}}=q;if(!(D&&x&&Z?.near?.sellAsset))throw new Q("core_swap_asset_not_recognized");if(!B)throw new Q("core_swap_invalid_params",{missing:["inboundAddress"]});let K=await O.from({asset:D,value:F}),b=K.chain,H=J(K.chain);if(b===Y.Near&&!K.isGasAsset){let j=J(K.chain);if(!j)throw new Q("core_wallet_connection_not_found");let y=await j.createContractFunctionCall({args:{amount:K.getBaseValue("string"),msg:JSON.stringify({receiver_id:B}),receiver_id:"intents.near"},attachedDeposit:"1",contractId:K.address,gas:"250000000000000",methodName:"ft_transfer_call",sender:j.address});return j.signAndSendTransaction(y)}if(!H)throw new Q("core_wallet_connection_not_found");return await H.transfer({assetValue:K,isProgramDerivedAddress:!0,recipient:B,sender:H.address})}}),name:"near",properties:{supportedUSwapProviders:[P.NEAR]}});export{z as NearPlugin};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=6C6D0E67ADDA0D7364756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/near/index.js.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"import { parseNearAmount } from \"@near-js/utils\";\n\nconst MINIMUM_NAME_LENGTH = 2;\nconst MAXIMUM_NAME_LENGTH = 64;\n\nexport function validateNearName(name: string): boolean {\n if (name.length < MINIMUM_NAME_LENGTH || name.length > MAXIMUM_NAME_LENGTH) {\n return false;\n }\n\n // Only lowercase letters, numbers, and hyphens\n // Cannot start or end with hyphen\n // No consecutive hyphens\n return /^[a-z0-9]+(-[a-z0-9]+)*$/.test(name);\n}\n\nexport function calculateNearNameCost(name: string): string {\n // Pricing based on name length\n // These are suggested prices, the actual minimum is ~0.00182 NEAR\n const length = name.length;\n\n let costInNear: string;\n if (length <= 2) {\n costInNear = \"50\"; // 50 NEAR for 2-char names\n } else if (length <= 3) {\n costInNear = \"20\"; // 20 NEAR for 3-char names\n } else if (length <= 4) {\n costInNear = \"5\"; // 5 NEAR for 4-char names\n } else if (length <= 5) {\n costInNear = \"1\"; // 1 NEAR for 5-char names\n } else {\n costInNear = \"0.1\"; // 0.1 NEAR for 6+ characters\n }\n\n // Convert NEAR to yoctoNEAR\n return parseNearAmount(costInNear) || \"0\";\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": "yCAIA,qBAAS,WAAY,kBAAO,gBAA+B,wBCJ3D,0BAAS,uBAET,IAAM,EAAsB,EACtB,EAAsB,GAErB,SAAS,CAAgB,CAAC,EAAuB,CACtD,GAAI,EAAK,OAAS,GAAuB,EAAK,OAAS,EACrD,MAAO,GAMT,MAAO,2BAA2B,KAAK,CAAI,EAGtC,SAAS,CAAqB,CAAC,EAAsB,CAG1D,IAAM,EAAS,EAAK,OAEhB,EACJ,GAAI,GAAU,EACZ,EAAa,KACR,QAAI,GAAU,EACnB,EAAa,KACR,QAAI,GAAU,EACnB,EAAa,IACR,QAAI,GAAU,EACnB,EAAa,IAEb,OAAa,MAIf,OAAO,EAAgB,CAAU,GAAK,IDxBjC,IAAM,EAAa,EAAa,CACrC,QAAS,EAAG,gBAAiB,CAC3B,UAAW,MACH,QAAO,CAAC,EAA+C,CAC3D,IAAM,EAAiB,EAAK,YAAY,EAAE,QAAQ,UAAW,EAAE,EAE/D,GAAI,CAAC,EAAiB,CAAc,EAClC,MAAM,IAAI,EAAW,0BAA0B,EAGjD,IAAM,EAAY,GAAG,SACf,EAAS,EAAU,EAAM,IAAI,EAEnC,GAAI,CAAC,EACH,MAAM,IAAI,EAAW,2BAA2B,EAGlD,GAAI,CAEF,IAAM,EAAc,MAAM,E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,OAAQ,EAAU,aAAa,QAAQ,EACvC,IAAK,KAAK,UAAU,CAAE,YAAa,CAAe,CAAC,EACnD,YAAa,cACf,EACA,gBAAiB,IACjB,WAAY,EAAU,QACtB,IAAK,kBACL,WAAY,mBACZ,OAAQ,EAAO,OACjB,CAAC,EAED,OAAO,EAAO,uBAAuB,CAAmB,EAG1D,GAAI,CAAC,EACH,MAAM,IAAI,EAAW,kCAAkC,EAUzD,OAPW,MAAM,EAAO,SAAS,CAC/B,WAAY,EACZ,wBAAyB,GACzB,UAAW,EACX,OAAQ,EAAO,OACjB,CAAC,EAIL,GACA,KAAM,OACN,WAAY,CAAE,wBAAyB,CAAC,EAAa,IAAI,CAAW,CACtE,CAAC",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "6C6D0E67ADDA0D7364756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/radix/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as e}from"../chunk-awrrj6sh.js";import{AssetValue as c,Chain as m,ProviderName as u,USwapError as r}from"@tcswap/helpers";var f=e({methods:({getWallet:o})=>({swap:async function({route:{tx:s,sellAmount:t,sellAsset:i}}){let a=await c.from({asset:i,asyncTokenLookup:!0,value:t});if(m.Radix!==a.chain)throw new r("core_swap_invalid_params");let n=o(a.chain);try{return n.signAndBroadcast({manifest:s})}catch(p){throw new r("core_swap_invalid_params",p)}}}),name:"radix",properties:{supportedUSwapProviders:[u.CAVIAR_V1]}});export{f as RadixPlugin};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=B187E2E8F65FEA8364756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/radix/index.js.map
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport { AssetValue, Chain, ProviderName, type SwapParams, USwapError } from \"@tcswap/helpers\";\nimport type { QuoteResponseRoute } from \"@tcswap/helpers/api\";\nimport { createPlugin } from \"../utils\";\n\nexport const RadixPlugin = createPlugin({\n methods: ({ getWallet }) => ({\n swap: async function radixSwap({ route: { tx, sellAmount, sellAsset } }: SwapParams<\"radix\", QuoteResponseRoute>) {\n const assetValue = await AssetValue.from({ asset: sellAsset, asyncTokenLookup: true, value: sellAmount });\n\n if (Chain.Radix !== assetValue.chain) {\n throw new USwapError(\"core_swap_invalid_params\");\n }\n\n const wallet = getWallet(assetValue.chain);\n try {\n return wallet.signAndBroadcast({ manifest: tx as string });\n } catch (error) {\n throw new USwapError(\"core_swap_invalid_params\", error);\n }\n },\n }),\n name: \"radix\",\n properties: { supportedUSwapProviders: [ProviderName.CAVIAR_V1] as const },\n});\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "yCAIA,qBAAS,WAAY,kBAAO,gBAA+B,wBAIpD,IAAM,EAAc,EAAa,CACtC,QAAS,EAAG,gBAAiB,CAC3B,KAAM,cAAwB,EAAG,OAAS,KAAI,aAAY,cAAwD,CAChH,IAAM,EAAa,MAAM,EAAW,KAAK,CAAE,MAAO,EAAW,iBAAkB,GAAM,MAAO,CAAW,CAAC,EAExG,GAAI,EAAM,QAAU,EAAW,MAC7B,MAAM,IAAI,EAAW,0BAA0B,EAGjD,IAAM,EAAS,EAAU,EAAW,KAAK,EACzC,GAAI,CACF,OAAO,EAAO,iBAAiB,CAAE,SAAU,CAAa,CAAC,EACzD,MAAO,EAAO,CACd,MAAM,IAAI,EAAW,2BAA4B,CAAK,GAG5D,GACA,KAAM,QACN,WAAY,CAAE,wBAAyB,CAAC,EAAa,SAAS,CAAW,CAC3E,CAAC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "B187E2E8F65FEA8364756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/solana/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f={};w(f,{SolanaPlugin:()=>n});module.exports=u(f);var a=require("@tcswap/helpers");var n=e({methods:({getWallet:r})=>({swap:async function({route:i}){let{VersionedTransaction:p}=await import("@solana/web3.js"),{tx:s,sellAsset:c}=i,o=(await a.AssetValue.from({asset:c})).chain;if(!(o===a.Chain.Solana&&s))throw new a.USwapError("core_swap_invalid_params");let t=r(o),l=p.deserialize(Buffer.from(s,"base64")),m=await t.signTransaction(l);return t.broadcastTransaction(m)}}),name:"solana",properties:{supportedUSwapProviders:[a.ProviderName.JUPITER]}});
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=8436D275BF7B383D64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport { AssetValue, Chain, ProviderName, type SwapParams, USwapError } from \"@tcswap/helpers\";\nimport type { QuoteResponseRoute } from \"@tcswap/helpers/api\";\nimport { createPlugin } from \"../utils\";\n\nexport const SolanaPlugin = createPlugin({\n methods: ({ getWallet }) => ({\n swap: async function solanaSwap({ route }: SwapParams<\"solana\", QuoteResponseRoute>) {\n const { VersionedTransaction } = await import(\"@solana/web3.js\");\n const { tx, sellAsset } = route;\n\n const assetValue = await AssetValue.from({ asset: sellAsset });\n\n const chain = assetValue.chain;\n if (!(chain === Chain.Solana && tx)) throw new USwapError(\"core_swap_invalid_params\");\n\n const wallet = getWallet(chain);\n const transaction = VersionedTransaction.deserialize(Buffer.from(tx as string, \"base64\"));\n\n const signedTransaction = await wallet.signTransaction(transaction);\n\n return wallet.broadcastTransaction(signedTransaction);\n },\n }),\n name: \"solana\",\n properties: { supportedUSwapProviders: [ProviderName.JUPITER] as const },\n});\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "uDAI6E,IAA7E,6BAIO,IAAM,EAAe,EAAa,CACvC,QAAS,EAAG,gBAAiB,CAC3B,KAAM,cAAyB,EAAG,SAAmD,CACnF,IAAQ,wBAAyB,KAAa,4BACtC,KAAI,aAAc,EAIpB,GAFa,MAAM,aAAW,KAAK,CAAE,MAAO,CAAU,CAAC,GAEpC,MACzB,GAAI,EAAE,IAAU,QAAM,QAAU,GAAK,MAAM,IAAI,aAAW,0BAA0B,EAEpF,IAAM,EAAS,EAAU,CAAK,EACxB,EAAc,EAAqB,YAAY,OAAO,KAAK,EAAc,QAAQ,CAAC,EAElF,EAAoB,MAAM,EAAO,gBAAgB,CAAW,EAElE,OAAO,EAAO,qBAAqB,CAAiB,EAExD,GACA,KAAM,SACN,WAAY,CAAE,wBAAyB,CAAC,eAAa,OAAO,CAAW,CACzE,CAAC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "8436D275BF7B383D64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/solana/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as l,b as
|
|
1
|
+
import{a as l,b as t}from"../chunk-awrrj6sh.js";import{AssetValue as m,Chain as u,ProviderName as w,USwapError as f}from"@tcswap/helpers";var d=t({methods:({getWallet:e})=>({swap:async function({route:n}){let{VersionedTransaction:r}=await import("@solana/web3.js"),{tx:a,sellAsset:i}=n,s=(await m.from({asset:i})).chain;if(!(s===u.Solana&&a))throw new f("core_swap_invalid_params");let o=e(s),p=r.deserialize(Buffer.from(a,"base64")),c=await o.signTransaction(p);return o.broadcastTransaction(c)}}),name:"solana",properties:{supportedUSwapProviders:[w.JUPITER]}});export{d as SolanaPlugin};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=94EA085F23D2424A64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/solana/index.js.map
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Modifications © 2025 Horizontal Systems.\n */\n\nimport { AssetValue, Chain, ProviderName, type SwapParams, USwapError } from \"@tcswap/helpers\";\nimport type { QuoteResponseRoute } from \"@tcswap/helpers/api\";\nimport { createPlugin } from \"../utils\";\n\nexport const SolanaPlugin = createPlugin({\n methods: ({ getWallet }) => ({\n swap: async function solanaSwap({ route }: SwapParams<\"solana\", QuoteResponseRoute>) {\n const { VersionedTransaction } = await import(\"@solana/web3.js\");\n const { tx, sellAsset } = route;\n\n const assetValue = await AssetValue.from({ asset: sellAsset });\n\n const chain = assetValue.chain;\n if (!(chain === Chain.Solana && tx)) throw new USwapError(\"core_swap_invalid_params\");\n\n const wallet = getWallet(chain);\n const transaction = VersionedTransaction.deserialize(Buffer.from(tx as string, \"base64\"));\n\n const signedTransaction = await wallet.signTransaction(transaction);\n\n return wallet.broadcastTransaction(signedTransaction);\n },\n }),\n name: \"solana\",\n properties: { supportedUSwapProviders: [ProviderName.JUPITER] as const },\n});\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "gDAIA,qBAAS,WAAY,kBAAO,gBAA+B,wBAIpD,IAAM,EAAe,EAAa,CACvC,QAAS,EAAG,gBAAiB,CAC3B,KAAM,cAAyB,EAAG,SAAmD,CACnF,IAAQ,wBAAyB,KAAa,4BACtC,KAAI,aAAc,EAIpB,GAFa,MAAM,EAAW,KAAK,CAAE,MAAO,CAAU,CAAC,GAEpC,MACzB,GAAI,EAAE,IAAU,EAAM,QAAU,GAAK,MAAM,IAAI,EAAW,0BAA0B,EAEpF,IAAM,EAAS,EAAU,CAAK,EACxB,EAAc,EAAqB,YAAY,OAAO,KAAK,EAAc,QAAQ,CAAC,EAElF,EAAoB,MAAM,EAAO,gBAAgB,CAAW,EAElE,OAAO,EAAO,qBAAqB,CAAiB,EAExD,GACA,KAAM,SACN,WAAY,CAAE,wBAAyB,CAAC,EAAa,OAAO,CAAW,CACzE,CAAC",
|
|
8
|
+
"debugId": "94EA085F23D2424A64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/thorchain/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var qx={};xx(qx,{validateAddressType:()=>v,ThorchainPlugin:()=>y,MayachainPlugin:()=>w});module.exports=e(qx);var x=require("@tcswap/helpers"),S=require("@tcswap/helpers/api"),Z=require("@tcswap/helpers/contracts");var T=require("@tcswap/helpers");function v({chain:R,address:O}){if(!O)return!1;return R===T.Chain.Bitcoin?!O.startsWith("bc1p"):!0}function b({assetValue:R,from:O,memo:X="",...P}){return{...P,assetValue:R,from:O,memo:X}}var l={[x.FeeOption.Average]:1.2,[x.FeeOption.Fast]:1.5,[x.FeeOption.Fastest]:2},t={[x.Chain.Avalanche]:Z.TCAvalancheDepositABI,[x.Chain.Base]:Z.TCBaseDepositABI,[x.Chain.BinanceSmartChain]:Z.TCBscDepositABI,[x.Chain.Ethereum]:Z.TCEthereumVaultAbi},s={[x.Chain.Arbitrum]:Z.MayaArbitrumVaultAbi,[x.Chain.Ethereum]:Z.MayaEthereumVaultAbi},y=M({methods:C(x.Chain.THORChain),name:"thorchain",properties:{supportedUSwapProviders:[x.ProviderName.THORCHAIN,x.ProviderName.THORCHAIN_STREAMING]}}),w=M({methods:C(x.Chain.Maya),name:"mayachain",properties:{supportedUSwapProviders:[x.ProviderName.MAYACHAIN,x.ProviderName.MAYACHAIN_STREAMING]}});function a(R){return async function(X){if(R==="thorchain"&&X===x.Chain.THORChain||R==="mayachain"&&X===x.Chain.Maya)return{address:"",chain:X,dust_threshold:"0",gas_rate:"0",halted:!1,router:""};let $=(await S.USwapApi.thornode.getInboundAddresses(R)).find((F)=>F.chain===X);if(!$)throw new x.USwapError("core_inbound_data_not_found");if($?.halted)throw new x.USwapError("core_chain_halted");return $}}function C(R){return function({getWallet:X}){let P=R===x.Chain.Maya?"mayachain":"thorchain",$=a(P);async function F({assetValue:q,type:z="checkOnly"}){let H=(await $(q.chain)).router,J=q.chain,Q=x.EVMChains.includes(J);if(Q&&q.isGasAsset||!Q||q.isSynthetic)return Promise.resolve(z==="checkOnly"?!0:"approved");let Y=X(J);if(!Y)throw new x.USwapError("core_wallet_connection_not_found");let j=z==="checkOnly"?Y.isApproved:Y.approve;if(!(q.address&&Y.address))throw new x.USwapError("core_approve_asset_address_or_from_not_found");return j({amount:q.getBaseValue("bigint"),assetAddress:q.address,from:Y.address,spenderAddress:H})}async function k({assetValue:q,recipient:z,router:H,...J}){let Q=P==="thorchain"?t:s,{chain:L,symbol:Y,ticker:j}=q,I=X(L);if(!I)throw new x.USwapError("core_wallet_connection_not_found");let{address:f}=I;if(!v({address:f,chain:L}))throw new x.USwapError("core_transaction_invalid_sender_address");let N=b({assetValue:q,from:f,recipient:z,router:H,...J});try{let G=Q?.[L];if(!G){let B=X(L);return R===L&&z===""?B.deposit(N):B.transfer(N)}let{getChecksumAddressFromAsset:_}=await import("@tcswap/toolboxes/evm");return X(L).call({abi:G,contractAddress:H||(await $(L)).router,funcName:"depositWithExpiry",funcParams:[z,_({chain:L,symbol:Y,ticker:j},L),q.getBaseValue("string"),N.memo,J.expiration||Number.parseInt(`${(Date.now()+900000)/1000}`,10)],txOverrides:{from:N.from,value:q.isGasAsset?q.getBaseValue("bigint"):void 0}})}catch(G){let _=typeof G==="string"?G.toLowerCase():G?.message.toLowerCase(),U=_?.includes("insufficient funds"),B=_?.includes("gas"),W=_?.includes("server"),i=_?.includes("user rejected");throw new x.USwapError(U?"core_transaction_deposit_insufficient_funds_error":B?"core_transaction_deposit_gas_error":W?"core_transaction_deposit_server_error":i?"core_transaction_user_rejected":"core_transaction_deposit_error",G)}}async function D({memo:q,assetValue:z}){let H=await S.USwapApi.thornode.getMimirInfo(P);if(H.HALTCHAINGLOBAL>=1||H.HALTTHORCHAIN>=1)throw new x.USwapError("thorchain_chain_halted");return k({assetValue:z,memo:q,recipient:""})}async function K({assetValue:q,memo:z,feeOptionKey:H=x.FeeOption.Fast}){let{gas_rate:J="0",router:Q,address:L}=await $(q.chain);return k({assetValue:q,feeRate:Number.parseInt(J,10)*l[H],memo:z,recipient:L,router:Q})}function A({assetValue:q}){return F({assetValue:q,type:x.ApproveMode.Approve})}function g({assetValue:q}){return F({assetValue:q,type:x.ApproveMode.CheckOnly})}function m({assetValue:q,...z}){return D({assetValue:q,memo:x.getMemoForNameRegister(z)})}function c({assetValue:q,payoutAddress:z,name:H,ownerAddress:J}){let Q=z||X(q.chain)?.address;if(!Q)throw new x.USwapError("thorchain_preferred_asset_payout_required");return D({assetValue:x.AssetValue.from({chain:R}),memo:x.getMemoForNamePreferredAssetRegister({asset:q.toString(),chain:q.chain,name:H,owner:J,payout:Q})})}function h({type:q,assetValue:z,address:H}){let J=q===x.MemoType.UNBOND?x.getMemoForUnbond({address:H,unbondAmount:z.getBaseValue("number")}):x.getMemoForLeaveAndBond({address:H,type:q}),Q=q===x.MemoType.BOND?z:x.getMinAmountByChain(R);return D({assetValue:Q,memo:J})}async function V({baseAssetValue:q,assetValue:z}){if(q.lte(0)||z.lte(0))throw new x.USwapError("core_transaction_create_liquidity_invalid_params");let H=X(z.chain).address,J=X(R).address,Q=await x.wrapWithThrow(()=>{return K({assetValue:q,memo:x.getMemoForDeposit({...z,address:H})})},"core_transaction_create_liquidity_base_error");return{assetTx:await x.wrapWithThrow(()=>{return K({assetValue:z,memo:x.getMemoForDeposit({...z,address:J})})},"core_transaction_create_liquidity_asset_error"),baseAssetTx:Q}}function p({assetValue:q,poolAddress:z,address:H,symmetric:J}){if(J&&!H)throw new x.USwapError("core_transaction_add_liquidity_invalid_params");let Q=x.getMemoForDeposit({address:J?H:"",chain:z.split(".")[0],symbol:z.split(".")[1]});return K({assetValue:q,memo:Q})}async function d({baseAssetValue:q,assetValue:z,baseAssetAddr:H,assetAddr:J,isPendingSymmAsset:Q,mode:L="sym"}){let{chain:Y,symbol:j}=z,I=L==="sym",f=q?.gt(0)&&(I||L==="baseAsset"),E=z?.gt(0)&&(I||L==="asset"),N=Q||f,G=X(R).address,_=N?H||G:"",U=I||L==="asset"?J||X(Y).address:"";if(!(f||E))throw new x.USwapError("core_transaction_add_liquidity_invalid_params");if(N&&!_)throw new x.USwapError("core_transaction_add_liquidity_base_address");let B=f&&q?await x.wrapWithThrow(()=>{return K({assetValue:q,memo:x.getMemoForDeposit({address:U,chain:Y,symbol:j})})},"core_transaction_add_liquidity_base_error"):void 0;return{assetTx:E&&z?await x.wrapWithThrow(()=>{return K({assetValue:z,memo:x.getMemoForDeposit({address:_,chain:Y,symbol:j})})},"core_transaction_add_liquidity_asset_error"):void 0,baseAssetTx:B}}function n({memo:q,assetValue:z,percent:H,from:J,to:Q}){let L=Q==="baseAsset"&&J!=="baseAsset"?x.AssetValue.from({chain:R}):J==="sym"&&Q==="sym"||J==="baseAsset"||J==="asset"?void 0:z,Y=x.getMinAmountByChain(J==="asset"?z.chain:R),j=q||x.getMemoForWithdraw({basisPoints:Math.min(1e4,Math.round(H*100)),chain:z.chain,symbol:z.symbol,targetAsset:L?.toString(),ticker:z.ticker});return K({assetValue:Y,memo:j})}async function u({chain:q,thorAddress:z}){let H=await $(q),J=H.dust_threshold,{baseDecimal:Q}=x.getChainConfig(q),{baseDecimal:L}=x.getChainConfig(x.Chain.THORChain);return k({assetValue:x.AssetValue.from({chain:q,fromBaseDecimal:Math.min(Q,L),value:q!==x.Chain.THORChain?J:0}),memo:x.getMemoForTcyClaim(x.MemoType.CLAIM_TCY,{address:z}),recipient:H.address,router:H.router})}function r(q){if(q.type==="stake"){if(q.assetValue.toString()!=="THOR.TCY")throw new x.USwapError("thorchain_asset_is_not_tcy");return k({assetValue:q.assetValue,memo:x.getMemoForTcyStake(x.MemoType.STAKE_TCY,{}),recipient:""})}return k({assetValue:x.AssetValue.from({chain:x.Chain.THORChain}),memo:x.getMemoForTcyStake(x.MemoType.UNSTAKE_TCY,{unstakeBps:q.unstakeBps}),recipient:""})}async function o({feeOptionKey:q,route:z}){let{memo:H,expiration:J,targetAddress:Q}=z,L=await x.AssetValue.from({asset:z.sellAsset,asyncTokenLookup:!0,value:z.sellAmount});if(!L)throw new x.USwapError("core_swap_asset_not_recognized");if(!v({address:z.destinationAddress,chain:x.AssetValue.from({asset:z.buyAsset}).chain}))throw new x.USwapError("core_transaction_invalid_recipient_address");let{address:j}=await $(L.chain);return k({assetValue:L,expiration:Number(J),feeOptionKey:q,memo:H,recipient:j,router:Q})}return{addLiquidity:d,addLiquidityPart:p,approveAssetValue:A,claimTcy:u,createLiquidity:V,deposit:k,depositToPool:K,getInboundDataByChain:$,isAssetValueApproved:g,nodeAction:h,registerName:m,registerPreferredAsset:c,stakeTcyAction:r,swap:o,withdraw:n}}}
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=3DAB2602E0E74B3D64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
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
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
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": "8GA6BO,IAzBP,6BA0BA,iCACA,uCC/BsB,IAAtB,6BAGO,SAAS,CAAmB,EAAG,QAAO,WAAgD,CAC3F,GAAI,CAAC,EAAS,MAAO,GAErB,OAAO,IAAU,QAAM,QAAU,CAAC,EAAQ,WAAW,MAAM,EAAI,GAG1D,SAAS,CAAe,EAC7B,aACA,OACA,OAAO,MACJ,GACgD,CACnD,MAAO,IAAK,EAAc,aAAY,OAAM,MAAK,EDqCnD,IAAM,EA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O,aAAW,KAAK,CAAE,MAAO,EAAM,QAAS,CAAC,EAAE,KACpD,CAAC,EAGC,MAAM,IAAI,aAAW,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,OACA,UACF",
|
|
9
|
+
"debugId": "3DAB2602E0E74B3D64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/thorchain/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Hx,b as
|
|
1
|
+
import{a as Hx,b as C}from"../chunk-awrrj6sh.js";import{ApproveMode as g,AssetValue as O,Chain as Z,EVMChains as Jx,FeeOption as S,getChainConfig as m,getMemoForDeposit as F,getMemoForLeaveAndBond as Lx,getMemoForNamePreferredAssetRegister as Qx,getMemoForNameRegister as Rx,getMemoForTcyClaim as Xx,getMemoForTcyStake as c,getMemoForUnbond as Yx,getMemoForWithdraw as Zx,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 $x,MayaEthereumVaultAbi as jx,TCAvalancheDepositABI as Gx,TCBaseDepositABI as _x,TCBscDepositABI as kx,TCEthereumVaultAbi as Kx}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 Nx={[S.Average]:1.2,[S.Fast]:1.5,[S.Fastest]:2},Ox={[Z.Avalanche]:Gx,[Z.Base]:_x,[Z.BinanceSmartChain]:kx,[Z.Ethereum]:Kx},Px={[Z.Arbitrum]:$x,[Z.Ethereum]:jx},Ix=C({methods:p(Z.THORChain),name:"thorchain",properties:{supportedUSwapProviders:[T.THORCHAIN,T.THORCHAIN_STREAMING]}}),fx=C({methods:p(Z.Maya),name:"mayachain",properties:{supportedUSwapProviders:[T.MAYACHAIN,T.MAYACHAIN_STREAMING]}});function Bx(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",$=Bx(I);async function D({assetValue:x,type:q="checkOnly"}){let z=(await $(x.chain)).router,H=x.chain,L=Jx.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"?Ox:Px,{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)*Nx[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:Rx(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:Qx({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?Yx({address:z,unbondAmount:q.getBaseValue("number")}):Lx({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||Zx({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:Xx(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,Ix as ThorchainPlugin,fx as MayachainPlugin};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=8EA19EFB92F0518F64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
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
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
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": "iDAIA,sBACE,gBAEA,WACA,eAGA,gBACA,oBACA,uBACA,4BACA,2CACA,6BACA,yBACA,yBACA,sBACA,y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a,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": "8EA19EFB92F0518F64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"@polkadot/keyring": "~13.5.7",
|
|
6
6
|
"@polkadot/util": "~13.5.7",
|
|
7
7
|
"@solana/web3.js": "~1.98.0",
|
|
8
|
-
"@tcswap/helpers": "4.5.
|
|
9
|
-
"@tcswap/toolboxes": "4.3.
|
|
8
|
+
"@tcswap/helpers": "4.5.16",
|
|
9
|
+
"@tcswap/toolboxes": "4.3.16",
|
|
10
10
|
"ts-pattern": "^5.9.0"
|
|
11
11
|
},
|
|
12
12
|
"description": "USwap Plugin - Chainflip",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"type-check:go": "tsgo"
|
|
85
85
|
},
|
|
86
86
|
"type": "module",
|
|
87
|
-
"version": "4.2.
|
|
87
|
+
"version": "4.2.16"
|
|
88
88
|
}
|