@swapkit/plugins 4.2.9 → 4.6.18
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/LICENSE +246 -0
- package/dist/chunk-k2pk60qs.js +1 -0
- package/dist/chunk-nbtnyjp9.js +2 -0
- package/dist/src/chainflip/index.cjs +1 -0
- package/dist/src/chainflip/index.js +1 -0
- package/dist/src/evm/index.cjs +1 -0
- package/dist/src/evm/index.js +1 -0
- package/dist/src/garden/index.cjs +1 -0
- package/dist/src/garden/index.js +1 -0
- package/dist/src/harbor/index.cjs +1 -0
- package/dist/src/harbor/index.js +1 -0
- package/dist/src/index.cjs +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/near/index.cjs +1 -0
- package/dist/src/near/index.js +1 -0
- package/dist/src/radix/index.cjs +1 -0
- package/dist/src/radix/index.js +1 -0
- package/dist/{solana → src/solana}/index.cjs +1 -4
- package/dist/src/solana/index.js +1 -0
- package/dist/src/swapkit/index.cjs +1 -0
- package/dist/src/swapkit/index.js +1 -0
- package/dist/src/thorchain/index.cjs +1 -0
- package/dist/src/thorchain/index.js +1 -0
- package/dist/types/chainflip/broker.d.ts +3 -3
- package/dist/types/chainflip/broker.d.ts.map +1 -1
- package/dist/types/chainflip/plugin.d.ts.map +1 -1
- package/dist/types/chainflip/types.d.ts +4 -1
- package/dist/types/chainflip/types.d.ts.map +1 -1
- package/dist/types/evm/index.d.ts +7 -5
- package/dist/types/evm/index.d.ts.map +1 -1
- package/dist/types/garden/plugin.d.ts +6 -4
- package/dist/types/garden/plugin.d.ts.map +1 -1
- package/dist/types/harbor/index.d.ts +20 -0
- package/dist/types/harbor/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/near/plugin.d.ts +7 -1
- package/dist/types/near/plugin.d.ts.map +1 -1
- package/dist/types/near/types.d.ts +17 -0
- package/dist/types/near/types.d.ts.map +1 -1
- package/dist/types/radix/index.d.ts +2 -2
- package/dist/types/radix/index.d.ts.map +1 -1
- package/dist/types/swapkit/index.d.ts +2 -0
- package/dist/types/swapkit/index.d.ts.map +1 -0
- package/dist/types/swapkit/plugin.d.ts +20 -0
- package/dist/types/swapkit/plugin.d.ts.map +1 -0
- package/dist/types/types.d.ts +3 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +5 -3
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +41 -39
- package/dist/chainflip/index.cjs +0 -4
- package/dist/chainflip/index.cjs.map +0 -11
- package/dist/chainflip/index.js +0 -4
- package/dist/chainflip/index.js.map +0 -11
- package/dist/chunk-g305pte1.js +0 -4
- package/dist/chunk-g305pte1.js.map +0 -10
- package/dist/chunk-ykf9bj9d.js +0 -5
- package/dist/chunk-ykf9bj9d.js.map +0 -10
- package/dist/evm/index.cjs +0 -4
- package/dist/evm/index.cjs.map +0 -10
- package/dist/evm/index.js +0 -4
- package/dist/evm/index.js.map +0 -10
- package/dist/garden/index.cjs +0 -4
- package/dist/garden/index.cjs.map +0 -10
- package/dist/garden/index.js +0 -4
- package/dist/garden/index.js.map +0 -10
- package/dist/index.cjs +0 -4
- package/dist/index.cjs.map +0 -10
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -10
- package/dist/near/index.cjs +0 -4
- package/dist/near/index.cjs.map +0 -11
- package/dist/near/index.js +0 -4
- package/dist/near/index.js.map +0 -11
- package/dist/radix/index.cjs +0 -4
- package/dist/radix/index.cjs.map +0 -10
- package/dist/radix/index.js +0 -4
- package/dist/radix/index.js.map +0 -10
- package/dist/solana/index.cjs.map +0 -10
- package/dist/solana/index.js +0 -4
- package/dist/solana/index.js.map +0 -10
- package/dist/thorchain/index.cjs +0 -4
- package/dist/thorchain/index.cjs.map +0 -11
- package/dist/thorchain/index.js +0 -4
- package/dist/thorchain/index.js.map +0 -11
- package/src/chainflip/broker.ts +0 -112
- package/src/chainflip/index.ts +0 -3
- package/src/chainflip/plugin.ts +0 -52
- package/src/chainflip/types.ts +0 -37
- package/src/evm/index.ts +0 -45
- package/src/garden/index.ts +0 -1
- package/src/garden/plugin.ts +0 -54
- package/src/index.ts +0 -37
- package/src/near/index.ts +0 -2
- package/src/near/nearNames.ts +0 -37
- package/src/near/plugin.ts +0 -216
- package/src/near/types.ts +0 -9
- package/src/radix/index.ts +0 -24
- package/src/solana/index.ts +0 -1
- package/src/solana/plugin.ts +0 -26
- package/src/thorchain/index.ts +0 -3
- package/src/thorchain/plugin.ts +0 -492
- package/src/thorchain/shared.ts +0 -17
- package/src/thorchain/types.ts +0 -59
- package/src/types.ts +0 -22
- package/src/utils.ts +0 -42
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AssetValue, SwapParams } from "@swapkit/helpers";
|
|
2
2
|
import type { QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
|
+
import type { Authorization } from "ethers";
|
|
3
4
|
export type WithdrawFeeResponse = {
|
|
4
5
|
egressId: string;
|
|
5
6
|
egressAsset: string;
|
|
@@ -37,5 +38,7 @@ export type SwapRefundParameters = {
|
|
|
37
38
|
refundAddress: string;
|
|
38
39
|
minPrice: string;
|
|
39
40
|
};
|
|
40
|
-
export type RequestSwapDepositAddressParams = Partial<SwapParams<"chainflip", QuoteResponseRoute>> & Partial<DepositChannelRequest
|
|
41
|
+
export type RequestSwapDepositAddressParams = Partial<SwapParams<"chainflip", QuoteResponseRoute>> & Partial<DepositChannelRequest> & {
|
|
42
|
+
authorizations?: Authorization[];
|
|
43
|
+
};
|
|
41
44
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/chainflip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/chainflip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,eAAe,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,oBAAoB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtG,MAAM,MAAM,+BAA+B,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,GAChG,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAAE,cAAc,CAAC,EAAE,aAAa,EAAE,CAAA;CAAE,CAAC"}
|
|
@@ -2,16 +2,18 @@ import { AssetValue, ProviderName, type SwapParams } from "@swapkit/helpers";
|
|
|
2
2
|
import type { QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
3
|
export declare const EVMPlugin: {
|
|
4
4
|
evm: (pluginParams: import("..").SwapKitPluginParams) => {
|
|
5
|
-
supportedSwapkitProviders: readonly [ProviderName.
|
|
5
|
+
supportedSwapkitProviders: readonly [ProviderName.OKX, ProviderName.ONEINCH, ProviderName.PANCAKESWAP, ProviderName.SUSHISWAP_V2, ProviderName.TRADERJOE_V2, ProviderName.UNISWAP_V2, ProviderName.UNISWAP_V3];
|
|
6
6
|
} & {
|
|
7
|
-
approveAssetValue: (
|
|
7
|
+
approveAssetValue: (params: {
|
|
8
8
|
spenderAddress: string;
|
|
9
9
|
assetValue: AssetValue;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
route?: QuoteResponseRoute;
|
|
11
|
+
}) => Promise<string | boolean>;
|
|
12
|
+
isAssetValueApproved: (params: {
|
|
12
13
|
spenderAddress: string;
|
|
13
14
|
assetValue: AssetValue;
|
|
14
|
-
|
|
15
|
+
route?: QuoteResponseRoute;
|
|
16
|
+
}) => Promise<string | boolean>;
|
|
15
17
|
swap: ({ route: { tx, sellAsset }, feeOptionKey }: SwapParams<"evm", QuoteResponseRoute>) => Promise<string>;
|
|
16
18
|
};
|
|
17
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/evm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,YAAY,EAEZ,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/evm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,YAAY,EAEZ,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;2DAIuD,UAAU,CAAC,KAAK,EAAE,kBAAkB,CAAC;;CAyBhH,CAAC"}
|
|
@@ -4,14 +4,16 @@ export declare const GardenPlugin: {
|
|
|
4
4
|
garden: (pluginParams: import("..").SwapKitPluginParams) => {
|
|
5
5
|
supportedSwapkitProviders: readonly [ProviderName.GARDEN];
|
|
6
6
|
} & {
|
|
7
|
-
approveAssetValue: (
|
|
7
|
+
approveAssetValue: (params: {
|
|
8
8
|
spenderAddress: string;
|
|
9
9
|
assetValue: AssetValue;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
route?: QuoteResponseRoute;
|
|
11
|
+
}) => Promise<string | boolean>;
|
|
12
|
+
isAssetValueApproved: (params: {
|
|
12
13
|
spenderAddress: string;
|
|
13
14
|
assetValue: AssetValue;
|
|
14
|
-
|
|
15
|
+
route?: QuoteResponseRoute;
|
|
16
|
+
}) => Promise<string | boolean>;
|
|
15
17
|
swap: ({ route }: SwapParams<"garden", QuoteResponseRoute>) => Promise<string>;
|
|
16
18
|
};
|
|
17
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/garden/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EAGV,YAAY,EAEZ,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/E,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/garden/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EAGV,YAAY,EAEZ,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;0BAIgB,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC;;CAkC/E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AssetValue, ProviderName, type SwapParams } from "@swapkit/helpers";
|
|
2
|
+
import { type QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
|
+
export declare const HarborPlugin: {
|
|
4
|
+
harbor: (pluginParams: import("..").SwapKitPluginParams) => {
|
|
5
|
+
supportedSwapkitProviders: readonly [ProviderName.HARBOR];
|
|
6
|
+
} & {
|
|
7
|
+
approveAssetValue: (params: {
|
|
8
|
+
spenderAddress: string;
|
|
9
|
+
assetValue: AssetValue;
|
|
10
|
+
route?: QuoteResponseRoute;
|
|
11
|
+
}) => Promise<string | boolean>;
|
|
12
|
+
isAssetValueApproved: (params: {
|
|
13
|
+
spenderAddress: string;
|
|
14
|
+
assetValue: AssetValue;
|
|
15
|
+
route?: QuoteResponseRoute;
|
|
16
|
+
}) => Promise<string | boolean>;
|
|
17
|
+
swap: ({ route: { tx, sellAsset, memo, targetAddress, sellAmount }, feeOptionKey, }: SwapParams<"harbor", QuoteResponseRoute>) => Promise<string>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/harbor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,YAAY,EAEZ,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAMrF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;6FAOlB,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC;;CAuB7C,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PluginName, SKPlugins } from "./types";
|
|
2
|
+
import type { createPlugin } from "./utils";
|
|
2
3
|
export * from "./types";
|
|
3
4
|
export * from "./utils";
|
|
5
|
+
export declare function loadDefaultPlugins(): Promise<ReturnType<typeof createPlugin>>;
|
|
4
6
|
export declare function loadPlugin<P extends PluginName>(pluginName: P): Promise<SKPlugins[P]>;
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAmCnF;AAED,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,yBAuCnE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProviderName, type SwapParams } from "@swapkit/helpers";
|
|
2
2
|
import type { QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
|
-
import type { NearAccountInfo, NearNameRegistrationParams } from "./types";
|
|
3
|
+
import type { NearAccountInfo, NearNameRegistrationParams, SwapWithUtxosParams } from "./types";
|
|
4
4
|
export declare const NearPlugin: {
|
|
5
5
|
near: (pluginParams: import("..").SwapKitPluginParams) => {
|
|
6
6
|
supportedSwapkitProviders: readonly [ProviderName.NEAR];
|
|
@@ -14,6 +14,12 @@ export declare const NearPlugin: {
|
|
|
14
14
|
transfer(name: string, newOwner: string): Promise<string>;
|
|
15
15
|
};
|
|
16
16
|
swap(swapParams: SwapParams<"near", QuoteResponseRoute>): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Swap using multiple UTXO inputs from different addresses.
|
|
19
|
+
* Used for HD wallets (xpub-based) where UTXOs are spread across derived addresses.
|
|
20
|
+
* Only applicable when selling from UTXO chains (BTC, LTC, DOGE, etc.)
|
|
21
|
+
*/
|
|
22
|
+
swapWithUtxos(swapParams: SwapWithUtxosParams): Promise<string>;
|
|
17
23
|
};
|
|
18
24
|
};
|
|
19
25
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/near/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/near/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAEZ,KAAK,UAAU,EAGhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK/D,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAKhG,eAAO,MAAM,UAAU;;;;;0BAGG,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;8BAsCpC,MAAM;mCAKD,MAAM;6BAiBZ,0BAA0B;0BAoB7B,MAAM;2BAwBX,MAAM,YAAY,MAAM;;yBAkBlB,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC;QA0D7D;;;;WAIG;kCAC6B,mBAAmB;;CAgErD,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { FeeOption, SwapParams } from "@swapkit/helpers";
|
|
2
|
+
import type { QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
|
+
import type { UTXOForMultiAddressTransfer } from "@swapkit/toolboxes/utxo";
|
|
1
4
|
export type NearAccountInfo = {
|
|
2
5
|
accountId: string;
|
|
3
6
|
balance: string;
|
|
@@ -9,4 +12,18 @@ export type NearNameRegistrationParams = {
|
|
|
9
12
|
name: string;
|
|
10
13
|
publicKey?: string;
|
|
11
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Parameters for swapping with multiple UTXO inputs from different addresses.
|
|
17
|
+
* Used for HD wallets (xpub-based) where UTXOs are spread across derived addresses.
|
|
18
|
+
*/
|
|
19
|
+
export type SwapWithUtxosParams = SwapParams<"near", QuoteResponseRoute> & {
|
|
20
|
+
/** UTXOs to spend, each with derivation info for signing */
|
|
21
|
+
utxos: UTXOForMultiAddressTransfer[];
|
|
22
|
+
/** Optional fee rate in sats/vbyte. If not provided, uses feeOptionKey or defaults to Fast */
|
|
23
|
+
feeRate?: number;
|
|
24
|
+
/** Fee option if feeRate not specified */
|
|
25
|
+
feeOptionKey?: FeeOption;
|
|
26
|
+
/** Optional change address. If not provided, uses first UTXO's address */
|
|
27
|
+
changeAddress?: string;
|
|
28
|
+
};
|
|
12
29
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/near/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/near/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG;IACzE,4DAA4D;IAC5D,KAAK,EAAE,2BAA2B,EAAE,CAAC;IACrC,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type SwapParams } from "@swapkit/helpers";
|
|
2
2
|
import type { QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
3
|
export declare const RadixPlugin: {
|
|
4
4
|
radix: (pluginParams: import("..").SwapKitPluginParams) => {
|
|
5
|
-
supportedSwapkitProviders: readonly [
|
|
5
|
+
supportedSwapkitProviders: readonly [];
|
|
6
6
|
} & {
|
|
7
7
|
swap: ({ route: { tx, sellAmount, sellAsset } }: SwapParams<"radix", QuoteResponseRoute>) => Promise<string>;
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/radix/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/radix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,eAAO,MAAM,WAAW;;;;yDAEqD,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC;;CAiBlH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swapkit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AssetValue, type SwapParams } from "@swapkit/helpers";
|
|
2
|
+
import { type QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
|
+
export declare const SwapKitPlugin: {
|
|
4
|
+
swapkit: (pluginParams: import("..").SwapKitPluginParams) => {
|
|
5
|
+
supportedSwapkitProviders: never[];
|
|
6
|
+
} & {
|
|
7
|
+
approveAssetValue: (params: {
|
|
8
|
+
spenderAddress: string;
|
|
9
|
+
assetValue: AssetValue;
|
|
10
|
+
route?: QuoteResponseRoute;
|
|
11
|
+
}) => Promise<string | boolean>;
|
|
12
|
+
isAssetValueApproved: (params: {
|
|
13
|
+
spenderAddress: string;
|
|
14
|
+
assetValue: AssetValue;
|
|
15
|
+
route?: QuoteResponseRoute;
|
|
16
|
+
}) => Promise<string | boolean>;
|
|
17
|
+
swap: ({ route }: SwapParams<"swapkit", QuoteResponseRoute>) => Promise<string>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/swapkit/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAKV,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,KAAK,kBAAkB,EAIxB,MAAM,sBAAsB,CAAC;AAU9B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;0BAIS,UAAU,CAAC,SAAS,EAAE,kBAAkB,CAAC;;CA8I1E,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ import type { Chain } from "@swapkit/helpers";
|
|
|
2
2
|
import type { FullWallet } from "@swapkit/toolboxes";
|
|
3
3
|
import type { ChainflipPlugin } from "./chainflip";
|
|
4
4
|
import type { EVMPlugin } from "./evm";
|
|
5
|
+
import type { HarborPlugin } from "./harbor";
|
|
5
6
|
import type { NearPlugin } from "./near";
|
|
6
7
|
import type { RadixPlugin } from "./radix";
|
|
7
8
|
import type { SolanaPlugin } from "./solana/plugin";
|
|
9
|
+
import type { SwapKitPlugin } from "./swapkit";
|
|
8
10
|
import type { ThorchainPlugin } from "./thorchain";
|
|
9
11
|
export type * from "./chainflip/types";
|
|
10
12
|
export type * from "./thorchain/types";
|
|
11
|
-
export type SKPlugins = typeof ChainflipPlugin & typeof ThorchainPlugin & typeof RadixPlugin & typeof SolanaPlugin & typeof EVMPlugin & typeof NearPlugin;
|
|
13
|
+
export type SKPlugins = typeof ChainflipPlugin & typeof ThorchainPlugin & typeof RadixPlugin & typeof SolanaPlugin & typeof EVMPlugin & typeof SwapKitPlugin & typeof HarborPlugin & typeof NearPlugin;
|
|
12
14
|
export type PluginName = keyof SKPlugins;
|
|
13
15
|
export type SwapKitPluginParams = {
|
|
14
16
|
getWallet: <T extends Chain>(chain: T) => FullWallet[T];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG,OAAO,eAAe,GAC5C,OAAO,eAAe,GACtB,OAAO,WAAW,GAClB,OAAO,YAAY,GACnB,OAAO,SAAS,GAChB,OAAO,UAAU,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG;IAAE,SAAS,EAAE,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG,OAAO,eAAe,GAC5C,OAAO,eAAe,GACtB,OAAO,WAAW,GAClB,OAAO,YAAY,GACnB,OAAO,SAAS,GAChB,OAAO,aAAa,GACpB,OAAO,YAAY,GACnB,OAAO,UAAU,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG;IAAE,SAAS,EAAE,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC"}
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ApproveMode, ApproveReturnType, ProviderName } from "@swapkit/helpers";
|
|
2
|
-
import {
|
|
2
|
+
import { AssetValue } from "@swapkit/helpers";
|
|
3
|
+
import { type QuoteResponseRoute } from "@swapkit/helpers/api";
|
|
3
4
|
import type { SwapKitPluginParams } from "./types";
|
|
4
5
|
export declare function createPlugin<const Name extends string, T extends (params: SwapKitPluginParams) => Record<string, unknown>, K extends {
|
|
5
6
|
supportedSwapkitProviders?: readonly ProviderName[];
|
|
@@ -10,8 +11,9 @@ export declare function createPlugin<const Name extends string, T extends (param
|
|
|
10
11
|
}): { [key in Name]: (pluginParams: SwapKitPluginParams) => K & ReturnType<T>; };
|
|
11
12
|
export declare function approve<T extends ApproveMode>({ approveMode, getWallet }: {
|
|
12
13
|
approveMode: T;
|
|
13
|
-
} & SwapKitPluginParams): (
|
|
14
|
+
} & SwapKitPluginParams): (params: {
|
|
14
15
|
spenderAddress: string;
|
|
15
16
|
assetValue: AssetValue;
|
|
16
|
-
|
|
17
|
+
route?: QuoteResponseRoute;
|
|
18
|
+
}) => import("node_modules/ts-pattern/dist/types/helpers").Union<Promise<string | boolean>, Promise<string> | ApproveReturnType<T> | Promise<boolean>>;
|
|
17
19
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAY,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAY,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAA2B,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,KAAK,kBAAkB,EAAc,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,YAAY,CAC1B,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,CAAC,SAAS,CAAC,MAAM,EAAE,mBAAmB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,CAAC,SAAS;IAAE,yBAAyB,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,EACjE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE,GAK5C,GAAG,GAAG,IAAI,IAAI,kBAJb,mBAAmB,KACO,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAGZ,CAC9D;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;IAAE,WAAW,EAAE,CAAC,CAAA;CAAE,GAAG,mBAAmB,IACzF,QAAQ;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAAE,sJAqD/G"}
|
package/package.json
CHANGED
|
@@ -1,76 +1,78 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "swapkit-
|
|
2
|
+
"author": "swapkit-dev",
|
|
3
3
|
"dependencies": {
|
|
4
|
+
"@mysten/sui": "~1.44.0",
|
|
5
|
+
"@near-js/transactions": "2.5.0",
|
|
4
6
|
"@near-js/utils": "~2.5.0",
|
|
5
|
-
"@
|
|
6
|
-
"@
|
|
7
|
-
"@solana/web3.js": "~1.98.
|
|
8
|
-
"@swapkit/helpers": "4.
|
|
9
|
-
"@swapkit/toolboxes": "4.
|
|
7
|
+
"@noble/hashes": "2.0.1",
|
|
8
|
+
"@scure/base": "2.0.0",
|
|
9
|
+
"@solana/web3.js": "~1.98.4",
|
|
10
|
+
"@swapkit/helpers": "4.12.3",
|
|
11
|
+
"@swapkit/toolboxes": "4.13.1",
|
|
12
|
+
"@swapkit/utxo-signer": "2.1.0",
|
|
13
|
+
"ethers": "^6.14.0",
|
|
10
14
|
"ts-pattern": "^5.9.0"
|
|
11
15
|
},
|
|
12
16
|
"description": "SwapKit Plugin - Chainflip",
|
|
13
17
|
"devDependencies": {
|
|
14
18
|
"@near-js/utils": "2.5.0",
|
|
15
|
-
"@polkadot/keyring": "13.5.7",
|
|
16
|
-
"@polkadot/util": "13.5.7",
|
|
17
19
|
"@solana/web3.js": "1.98.4",
|
|
18
|
-
"
|
|
20
|
+
"ethers": "6.16.0",
|
|
21
|
+
"ts-pattern": "^5.9.0"
|
|
19
22
|
},
|
|
20
23
|
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"bun": "./src/index.ts",
|
|
23
|
-
"default": "./dist/index.js",
|
|
24
|
-
"require": "./dist/index.cjs",
|
|
25
|
-
"types": "./dist/types/index.d.ts"
|
|
26
|
-
},
|
|
24
|
+
".": { "default": "./dist/src/index.js", "require": "./dist/src/index.cjs", "types": "./dist/types/index.d.ts" },
|
|
27
25
|
"./chainflip": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"require": "./dist/chainflip/index.cjs",
|
|
26
|
+
"default": "./dist/src/chainflip/index.js",
|
|
27
|
+
"require": "./dist/src/chainflip/index.cjs",
|
|
31
28
|
"types": "./dist/types/chainflip/index.d.ts"
|
|
32
29
|
},
|
|
33
30
|
"./evm": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"require": "./dist/evm/index.cjs",
|
|
31
|
+
"default": "./dist/src/evm/index.js",
|
|
32
|
+
"require": "./dist/src/evm/index.cjs",
|
|
37
33
|
"types": "./dist/types/evm/index.d.ts"
|
|
38
34
|
},
|
|
39
35
|
"./garden": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"require": "./dist/garden/index.cjs",
|
|
36
|
+
"default": "./dist/src/garden/index.js",
|
|
37
|
+
"require": "./dist/src/garden/index.cjs",
|
|
43
38
|
"types": "./dist/types/garden/index.d.ts"
|
|
44
39
|
},
|
|
40
|
+
"./harbor": {
|
|
41
|
+
"default": "./dist/src/harbor/index.js",
|
|
42
|
+
"require": "./dist/src/harbor/index.cjs",
|
|
43
|
+
"types": "./dist/types/harbor/index.d.ts"
|
|
44
|
+
},
|
|
45
45
|
"./near": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"require": "./dist/near/index.cjs",
|
|
46
|
+
"default": "./dist/src/near/index.js",
|
|
47
|
+
"require": "./dist/src/near/index.cjs",
|
|
49
48
|
"types": "./dist/types/near/index.d.ts"
|
|
50
49
|
},
|
|
51
50
|
"./radix": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"require": "./dist/radix/index.cjs",
|
|
51
|
+
"default": "./dist/src/radix/index.js",
|
|
52
|
+
"require": "./dist/src/radix/index.cjs",
|
|
55
53
|
"types": "./dist/types/radix/index.d.ts"
|
|
56
54
|
},
|
|
57
55
|
"./solana": {
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"require": "./dist/solana/index.cjs",
|
|
56
|
+
"default": "./dist/src/solana/index.js",
|
|
57
|
+
"require": "./dist/src/solana/index.cjs",
|
|
61
58
|
"types": "./dist/types/solana/index.d.ts"
|
|
62
59
|
},
|
|
60
|
+
"./swapkit": {
|
|
61
|
+
"default": "./dist/src/swapkit/index.js",
|
|
62
|
+
"require": "./dist/src/swapkit/index.cjs",
|
|
63
|
+
"types": "./dist/types/swapkit/index.d.ts"
|
|
64
|
+
},
|
|
63
65
|
"./thorchain": {
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"require": "./dist/thorchain/index.cjs",
|
|
66
|
+
"default": "./dist/src/thorchain/index.js",
|
|
67
|
+
"require": "./dist/src/thorchain/index.cjs",
|
|
67
68
|
"types": "./dist/types/thorchain/index.d.ts"
|
|
68
69
|
}
|
|
69
70
|
},
|
|
70
|
-
"files": ["dist/"
|
|
71
|
+
"files": ["dist/"],
|
|
71
72
|
"homepage": "https://github.com/swapkit/SwapKit",
|
|
72
|
-
"license": "
|
|
73
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
73
74
|
"name": "@swapkit/plugins",
|
|
75
|
+
"publishConfig": { "access": "public" },
|
|
74
76
|
"repository": { "directory": "packages/plugins", "type": "git", "url": "git+https://github.com/swapkit/SwapKit.git" },
|
|
75
77
|
"scripts": {
|
|
76
78
|
"build": "bun run ./build.ts",
|
|
@@ -80,5 +82,5 @@
|
|
|
80
82
|
"type-check:go": "tsgo"
|
|
81
83
|
},
|
|
82
84
|
"type": "module",
|
|
83
|
-
"version": "4.
|
|
85
|
+
"version": "4.6.18"
|
|
84
86
|
}
|
package/dist/chainflip/index.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var P={};k(P,{assetIdentifierToChainflipTicker:()=>y,ChainflipPlugin:()=>_,ChainflipBroker:()=>T});module.exports=D(P);var A=require("@polkadot/keyring"),f=require("@polkadot/util"),s=require("@swapkit/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.SwapKitError("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.SwapKitError("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.SwapKitError("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})})},E=(e)=>async({evmToolbox:r,stateChainAccount:t,assetValue:a})=>{let{chainflipGateway:n}=await import("@swapkit/helpers/contracts"),d=s.AssetValue.from({asset:"ETH.FLIP"});if(!a.eqAsset(d))throw new s.SwapKitError("chainflip_broker_fund_only_flip_supported");if(!e.validateAddress(t))throw new s.SwapKitError("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")]})},T=(e)=>({fundStateChainAccount:E(e),registerAsBroker:S(e),withdrawFee:B(e)});var i=require("@swapkit/helpers"),h=require("@swapkit/helpers/api");var _=w({methods:({getWallet:e})=>({swap:async function(t){if(!(t?.route?.buyAsset&&t.route.meta.chainflip))throw new i.SwapKitError("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.SwapKitError("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.SwapKitError("core_wallet_connection_not_found");let{depositAddress:u}=await h.SwapKitApi.getChainflipDepositChannel({...o,maxBoostFeeBps:l||o.maxBoostFeeBps});return await p.transfer({assetValue:c,isProgramDerivedAddress:!0,recipient:u,sender:p.address})}}),name:"chainflip",properties:{supportedSwapkitProviders:[i.ProviderName.CHAINFLIP,i.ProviderName.CHAINFLIP_STREAMING]}});
|
|
2
|
-
|
|
3
|
-
//# debugId=3974AB53804D9E1C64756E2164756E21
|
|
4
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/chainflip/broker.ts", "../src/chainflip/plugin.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { decodeAddress } from \"@polkadot/keyring\";\nimport { isHex, u8aToHex } from \"@polkadot/util\";\nimport { AssetValue, Chain, SwapKitError, wrapWithThrow } from \"@swapkit/helpers\";\nimport type { getEvmToolbox } from \"@swapkit/toolboxes/evm\";\nimport type { getSubstrateToolbox } from \"@swapkit/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 SwapKitError(\"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 SwapKitError(\"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 SwapKitError(\"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(\"@swapkit/helpers/contracts\");\n\n const flipAssetValue = AssetValue.from({ asset: \"ETH.FLIP\" });\n\n if (!assetValue.eqAsset(flipAssetValue)) {\n throw new SwapKitError(\"chainflip_broker_fund_only_flip_supported\");\n }\n\n if (!chainflipToolbox.validateAddress(stateChainAccount)) {\n throw new SwapKitError(\"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
|
-
"import { AssetValue, type Chain, ProviderName, SwapKitError } from \"@swapkit/helpers\";\nimport { SwapKitApi } from \"@swapkit/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 SwapKitError(\"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 SwapKitError(\"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 SwapKitError(\"core_wallet_connection_not_found\");\n }\n\n const { depositAddress } = await SwapKitApi.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: { supportedSwapkitProviders: [ProviderName.CHAINFLIP, ProviderName.CHAINFLIP_STREAMING] as const },\n});\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": "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",
|
|
9
|
-
"debugId": "3974AB53804D9E1C64756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
package/dist/chainflip/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as C,b as x,c as A}from"../chunk-ykf9bj9d.js";import{decodeAddress as b}from"@polkadot/keyring";import{isHex as y,u8aToHex as S}from"@polkadot/util";import{AssetValue as B,Chain as E,SwapKitError as d,wrapWithThrow as T}from"@swapkit/helpers";var I=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"]]),_=(e)=>()=>{let s=e.api.tx.swapping?.registerAsBroker?.();if(!s)throw new d("chainflip_broker_register");return e.signAndBroadcast({address:e.getAddress(),tx:s})},D=(e)=>({feeAsset:s,recipient:t})=>{let i=s.chain===E.Polkadot,o=T(()=>{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})})},k=(e)=>async({evmToolbox:s,stateChainAccount:t,assetValue:i})=>{let{chainflipGateway:o}=await import("@swapkit/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(b(t));return s.call({abi:o,contractAddress:"0x6995ab7c4d7f4b03f467cf4c8e920427d9621dbd",funcName:"fundStateChainAccount",funcParams:[r,i.getBaseValue("string")]})},V=(e)=>({fundStateChainAccount:k(e),registerAsBroker:_(e),withdrawFee:D(e)});import{AssetValue as P,ProviderName as m,SwapKitError as f}from"@swapkit/helpers";import{SwapKitApi as F}from"@swapkit/helpers/api";var M=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:{supportedSwapkitProviders:[m.CHAINFLIP,m.CHAINFLIP_STREAMING]}});export{I as assetIdentifierToChainflipTicker,M as ChainflipPlugin,V as ChainflipBroker};
|
|
2
|
-
|
|
3
|
-
//# debugId=65E8EC35B2A4CD5764756E2164756E21
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/chainflip/broker.ts", "../src/chainflip/plugin.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { decodeAddress } from \"@polkadot/keyring\";\nimport { isHex, u8aToHex } from \"@polkadot/util\";\nimport { AssetValue, Chain, SwapKitError, wrapWithThrow } from \"@swapkit/helpers\";\nimport type { getEvmToolbox } from \"@swapkit/toolboxes/evm\";\nimport type { getSubstrateToolbox } from \"@swapkit/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 SwapKitError(\"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 SwapKitError(\"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 SwapKitError(\"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(\"@swapkit/helpers/contracts\");\n\n const flipAssetValue = AssetValue.from({ asset: \"ETH.FLIP\" });\n\n if (!assetValue.eqAsset(flipAssetValue)) {\n throw new SwapKitError(\"chainflip_broker_fund_only_flip_supported\");\n }\n\n if (!chainflipToolbox.validateAddress(stateChainAccount)) {\n throw new SwapKitError(\"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
|
-
"import { AssetValue, type Chain, ProviderName, SwapKitError } from \"@swapkit/helpers\";\nimport { SwapKitApi } from \"@swapkit/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 SwapKitError(\"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 SwapKitError(\"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 SwapKitError(\"core_wallet_connection_not_found\");\n }\n\n const { depositAddress } = await SwapKitApi.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: { supportedSwapkitProviders: [ProviderName.CHAINFLIP, ProviderName.CHAINFLIP_STREAMING] as const },\n});\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": "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",
|
|
9
|
-
"debugId": "65E8EC35B2A4CD5764756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
package/dist/chunk-g305pte1.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var l=Object.create;var{getPrototypeOf:f,defineProperty:o,getOwnPropertyNames:u,getOwnPropertyDescriptor:y}=Object,c=Object.prototype.hasOwnProperty;var g=(e,s,n)=>{n=e!=null?l(f(e)):{};let r=s||!e||!e.__esModule?o(n,"default",{value:e,enumerable:!0}):n;for(let t of u(e))if(!c.call(r,t))o(r,t,{get:()=>e[t],enumerable:!0});return r},m=new WeakMap,h=(e)=>{var s=m.get(e),n;if(s)return s;if(s=o({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")u(e).map((r)=>!c.call(s,r)&&o(s,r,{get:()=>e[r],enumerable:!(n=y(e,r))||n.enumerable}));return m.set(e,s),s};var w=(e,s)=>{for(var n in s)o(e,n,{get:s[n],enumerable:!0,configurable:!0,set:(r)=>s[n]=()=>r})};var p=require("@swapkit/helpers");function K({name:e,properties:s,methods:n}){function r(t){return{...n(t),...s}}return{[e]:r}}function M({approveMode:e,getWallet:s}){return function({assetValue:r,spenderAddress:t}){let a=r.chain,d=p.EVMChains.includes(a);if(d&&r.isGasAsset||!d||r.isSynthetic)return Promise.resolve(e==="checkOnly"||"approved");let i=s(a),v=e==="checkOnly"?i.isApproved:i.approve;if(!(r.address&&i.address))throw new p.SwapKitError("core_approve_asset_address_or_from_not_found");return v({amount:r.getBaseValue("bigint"),assetAddress:r.address,from:i.address,spenderAddress:t})}}
|
|
2
|
-
|
|
3
|
-
//# debugId=80D1C10025EEDEDE64756E2164756E21
|
|
4
|
-
//# sourceMappingURL=chunk-g305pte1.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/utils.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import type { ApproveMode, ApproveReturnType, EVMChain, ProviderName } from \"@swapkit/helpers\";\nimport { type AssetValue, EVMChains, SwapKitError } from \"@swapkit/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 { supportedSwapkitProviders?: 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 SwapKitError(\"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": "mqBACyD,IAAzD,8BAGO,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,eAAa,8CAA8C,EAGvE,OAAO,EAAa,CAClB,OAAQ,EAAW,aAAa,QAAQ,EACxC,aAAc,EAAW,QACzB,KAAM,EAAO,QACb,gBACF,CAAC",
|
|
8
|
-
"debugId": "80D1C10025EEDEDE64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/chunk-ykf9bj9d.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var m=Object.create;var{getPrototypeOf:u,defineProperty:a,getOwnPropertyNames:c}=Object;var v=Object.prototype.hasOwnProperty;var P=(e,n,s)=>{s=e!=null?m(u(e)):{};let r=n||!e||!e.__esModule?a(s,"default",{value:e,enumerable:!0}):s;for(let t of c(e))if(!v.call(r,t))a(r,t,{get:()=>e[t],enumerable:!0});return r};var g=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,s)=>(typeof require<"u"?require:n)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});import{EVMChains as l,SwapKitError as f}from"@swapkit/helpers";function T({name:e,properties:n,methods:s}){function r(t){return{...s(t),...n}}return{[e]:r}}function K({approveMode:e,getWallet:n}){return function({assetValue:r,spenderAddress:t}){let i=r.chain,p=l.includes(i);if(p&&r.isGasAsset||!p||r.isSynthetic)return Promise.resolve(e==="checkOnly"||"approved");let o=n(i),d=e==="checkOnly"?o.isApproved:o.approve;if(!(r.address&&o.address))throw new f("core_approve_asset_address_or_from_not_found");return d({amount:r.getBaseValue("bigint"),assetAddress:r.address,from:o.address,spenderAddress:t})}}
|
|
2
|
-
export{P as a,g as b,T as c,K as d};
|
|
3
|
-
|
|
4
|
-
//# debugId=40FBD3551A76E63064756E2164756E21
|
|
5
|
-
//# sourceMappingURL=chunk-ykf9bj9d.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/utils.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import type { ApproveMode, ApproveReturnType, EVMChain, ProviderName } from \"@swapkit/helpers\";\nimport { type AssetValue, EVMChains, SwapKitError } from \"@swapkit/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 { supportedSwapkitProviders?: 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 SwapKitError(\"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": "kjBACA,oBAA0B,kBAAW,yBAG9B,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,EAAa,8CAA8C,EAGvE,OAAO,EAAa,CAClB,OAAQ,EAAW,aAAa,QAAQ,EACxC,aAAc,EAAW,QACzB,KAAM,EAAO,QACb,gBACF,CAAC",
|
|
8
|
-
"debugId": "40FBD3551A76E63064756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/evm/index.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var P={};A(P,{EVMPlugin:()=>E});module.exports=v(P);var e=require("@swapkit/helpers");var E=p({methods:({getWallet:a})=>({approveAssetValue:o({approveMode:e.ApproveMode.Approve,getWallet:a}),isAssetValueApproved:o({approveMode:e.ApproveMode.CheckOnly,getWallet:a}),swap:async function({route:{tx:s,sellAsset:t},feeOptionKey:n}){let r=(await e.AssetValue.from({asset:t,asyncTokenLookup:!0})).chain,i=a(r);if(!(e.EVMChains.includes(r)&&s))throw new e.SwapKitError("core_swap_invalid_params");let{from:u,to:m,data:V,value:c}=s;return i.sendTransaction({data:V,feeOptionKey:n,from:u,to:m,value:BigInt(c)})}}),name:"evm",properties:{supportedSwapkitProviders:[e.ProviderName.CAMELOT_V3,e.ProviderName.OPENOCEAN_V2,e.ProviderName.OKX,e.ProviderName.ONEINCH,e.ProviderName.PANCAKESWAP,e.ProviderName.PANGOLIN_V1,e.ProviderName.SUSHISWAP_V2,e.ProviderName.TRADERJOE_V2,e.ProviderName.UNISWAP_V2,e.ProviderName.UNISWAP_V3]}});
|
|
2
|
-
|
|
3
|
-
//# debugId=E22C9FDCE61DD04464756E2164756E21
|
|
4
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/evm/index.cjs.map
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/evm/index.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import {\n ApproveMode,\n AssetValue,\n type EVMChain,\n EVMChains,\n ProviderName,\n SwapKitError,\n type SwapParams,\n} from \"@swapkit/helpers\";\nimport type { EVMTransaction, QuoteResponseRoute } from \"@swapkit/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 SwapKitError(\"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 supportedSwapkitProviders: [\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
|
-
],
|
|
7
|
-
"mappings": "oDAQO,IARP,8BAYO,IAAM,EAAY,EAAa,CACpC,QAAS,EAAG,gBAAiB,CAC3B,kBAAmB,EAAQ,CAAE,YAAa,cAAY,QAAS,WAAU,CAAC,EAC1E,qBAAsB,EAAQ,CAAE,YAAa,cAAY,UAAW,WAAU,CAAC,EAC/E,KAAM,cAAsB,EAAG,OAAS,KAAI,aAAa,gBAAuD,CAE9G,IAAM,GADa,MAAM,aAAW,KAAK,CAAE,MAAO,EAAW,iBAAkB,EAAK,CAAC,GACzD,MACtB,EAAS,EAAU,CAAQ,EAEjC,GAAI,EAAE,YAAU,SAAS,CAAQ,GAAK,GACpC,MAAM,IAAI,eAAa,0BAA0B,EAGnD,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,0BAA2B,CACzB,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": "E22C9FDCE61DD04464756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/evm/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as t,d as o}from"../chunk-ykf9bj9d.js";import{ApproveMode as p,AssetValue as A,EVMChains as E,ProviderName as e,SwapKitError as P}from"@swapkit/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 P("core_swap_invalid_params");let{from:m,to:V,data:c,value:v}=s;return u.sendTransaction({data:c,feeOptionKey:i,from:m,to:V,value:BigInt(v)})}}),name:"evm",properties:{supportedSwapkitProviders:[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
|
-
|
|
3
|
-
//# debugId=42F030B283FE3F0264756E2164756E21
|
|
4
|
-
//# sourceMappingURL=index.js.map
|