@swapkit/plugins 4.0.30 → 4.1.1

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.
@@ -0,0 +1,4 @@
1
+ var x={};T(x,{GardenPlugin:()=>u});module.exports=P(x);var l=require("@solana/web3.js"),a=require("@swapkit/helpers"),m=require("ts-pattern");var u=p({methods:({getWallet:r})=>({swap:function({route:d}){let{sellAsset:w,sellAmount:g,targetAddress:o,tx:i}=d,c=a.AssetValue.from({asset:w,value:g});return m.match(c.chain).returnType().with(...a.EVMChains,(s)=>{let t=r(s),{from:e,to:n,data:h,value:f}=i;return t.sendTransaction({data:h,from:e,to:n,value:BigInt(f)})}).with(a.Chain.Solana,async(s)=>{let t=r(s),e=l.VersionedTransaction.deserialize(Buffer.from(i,"base64")),n=await t.signTransaction(e);return t.broadcastTransaction(n)}).otherwise(async(s)=>{if(!o)throw new a.SwapKitError("plugin_garden_missing_data",{message:"Missing target address: "});return await r(s).transfer({assetValue:c,recipient:o})})}}),name:"garden",properties:{supportedSwapkitProviders:[a.ProviderName.GARDEN]}});
2
+
3
+ //# debugId=690EEC89CFD18DE164756E2164756E21
4
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/garden/plugin.ts"],
4
+ "sourcesContent": [
5
+ "import { VersionedTransaction } from \"@solana/web3.js\";\nimport { AssetValue, Chain, EVMChains, ProviderName, SwapKitError, type SwapParams } from \"@swapkit/helpers\";\nimport type { EVMTransaction, QuoteResponseRoute } from \"@swapkit/helpers/api\";\nimport { match } from \"ts-pattern\";\nimport { createPlugin } from \"../utils\";\n\nexport const GardenPlugin = createPlugin({\n methods: ({ 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 SwapKitError(\"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: { supportedSwapkitProviders: [ProviderName.GARDEN] },\n});\n"
6
+ ],
7
+ "mappings": "uDAAqC,IAArC,6BACA,8BAEA,wBAGO,IAAM,EAAe,EAAa,CACvC,QAAS,EAAG,gBAAiB,CAC3B,KAAM,QAAmB,EAAG,SAAmD,CAC7E,IAAQ,YAAW,aAAY,gBAAe,MAAO,EAE/C,EAAiB,aAAW,KAAK,CAAE,MAAO,EAAW,MAAO,CAAW,CAAC,EAE9E,OAAO,QAAM,EAAe,KAAc,EACvC,WAA4B,EAC5B,KAAK,GAAG,YAAW,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,QAAM,OAAQ,MAAO,IAAU,CACnC,IAAM,EAAS,EAAU,CAAK,EACxB,EAAc,uBAAqB,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,eAAa,6BAA8B,CAAE,QAAS,0BAA2B,CAAC,EAM9F,OAFe,MAFA,EAAU,CAAoC,EAEjC,SAAS,CAAE,WAAY,EAAgB,UAAW,CAAc,CAAC,EAG9F,EAEP,GACA,KAAM,SACN,WAAY,CAAE,0BAA2B,CAAC,eAAa,MAAM,CAAE,CACjE,CAAC",
8
+ "debugId": "690EEC89CFD18DE164756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,4 @@
1
+ import{c}from"../chunk-pqpwxyjh.js";import{VersionedTransaction as w}from"@solana/web3.js";import{AssetValue as g,Chain as h,EVMChains as f,ProviderName as P,SwapKitError as T}from"@swapkit/helpers";import{match as x}from"ts-pattern";var V=c({methods:({getWallet:e})=>({swap:function({route:p}){let{sellAsset:l,sellAmount:m,targetAddress:n,tx:o}=p,i=g.from({asset:l,value:m});return x(i.chain).returnType().with(...f,(a)=>{let s=e(a),{from:t,to:r,data:u,value:d}=o;return s.sendTransaction({data:u,from:t,to:r,value:BigInt(d)})}).with(h.Solana,async(a)=>{let s=e(a),t=w.deserialize(Buffer.from(o,"base64")),r=await s.signTransaction(t);return s.broadcastTransaction(r)}).otherwise(async(a)=>{if(!n)throw new T("plugin_garden_missing_data",{message:"Missing target address: "});return await e(a).transfer({assetValue:i,recipient:n})})}}),name:"garden",properties:{supportedSwapkitProviders:[P.GARDEN]}});export{V as GardenPlugin};
2
+
3
+ //# debugId=FBBE51C2536CD16764756E2164756E21
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/garden/plugin.ts"],
4
+ "sourcesContent": [
5
+ "import { VersionedTransaction } from \"@solana/web3.js\";\nimport { AssetValue, Chain, EVMChains, ProviderName, SwapKitError, type SwapParams } from \"@swapkit/helpers\";\nimport type { EVMTransaction, QuoteResponseRoute } from \"@swapkit/helpers/api\";\nimport { match } from \"ts-pattern\";\nimport { createPlugin } from \"../utils\";\n\nexport const GardenPlugin = createPlugin({\n methods: ({ 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 SwapKitError(\"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: { supportedSwapkitProviders: [ProviderName.GARDEN] },\n});\n"
6
+ ],
7
+ "mappings": "oCAAA,+BAAS,wBACT,qBAAS,WAAY,eAAO,kBAAW,kBAAc,yBAErD,gBAAS,mBAGF,IAAM,EAAe,EAAa,CACvC,QAAS,EAAG,gBAAiB,CAC3B,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,EAAa,6BAA8B,CAAE,QAAS,0BAA2B,CAAC,EAM9F,OAFe,MAFA,EAAU,CAAoC,EAEjC,SAAS,CAAE,WAAY,EAAgB,UAAW,CAAc,CAAC,EAG9F,EAEP,GACA,KAAM,SACN,WAAY,CAAE,0BAA2B,CAAC,EAAa,MAAM,CAAE,CACjE,CAAC",
8
+ "debugId": "FBBE51C2536CD16764756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,2 @@
1
+ export { GardenPlugin } from "./plugin";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/garden/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ProviderName, type SwapParams } from "@swapkit/helpers";
2
+ import type { QuoteResponseRoute } from "@swapkit/helpers/api";
3
+ export declare const GardenPlugin: {
4
+ garden: (pluginParams: import("..").SwapKitPluginParams) => {
5
+ supportedSwapkitProviders: ProviderName[];
6
+ } & {
7
+ swap: ({ route }: SwapParams<"garden", QuoteResponseRoute>) => Promise<string>;
8
+ };
9
+ };
10
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/garden/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,YAAY,EAAgB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC7G,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/E,eAAO,MAAM,YAAY;;;;0BAEgB,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC;;CAmC/E,CAAC"}
package/package.json CHANGED
@@ -4,8 +4,8 @@
4
4
  "@polkadot/keyring": "~13.5.0",
5
5
  "@polkadot/util": "~13.5.0",
6
6
  "@solana/web3.js": "~1.98.0",
7
- "@swapkit/helpers": "4.1.0",
8
- "@swapkit/toolboxes": "4.1.0",
7
+ "@swapkit/helpers": "4.2.1",
8
+ "@swapkit/toolboxes": "4.1.2",
9
9
  "ts-pattern": "~5.8.0"
10
10
  },
11
11
  "description": "SwapKit Plugin - Chainflip",
@@ -27,6 +27,11 @@
27
27
  "require": "./dist/evm/index.cjs",
28
28
  "types": "./dist/types/evm/index.d.ts"
29
29
  },
30
+ "./garden": {
31
+ "default": "./dist/garden/index.js",
32
+ "require": "./dist/garden/index.cjs",
33
+ "types": "./dist/types/garden/index.d.ts"
34
+ },
30
35
  "./near": {
31
36
  "default": "./dist/near/index.js",
32
37
  "require": "./dist/near/index.cjs",
@@ -61,5 +66,5 @@
61
66
  "type-check:go": "tsgo"
62
67
  },
63
68
  "type": "module",
64
- "version": "4.0.30"
69
+ "version": "4.1.1"
65
70
  }