@swapkit/core 1.0.0-rc.110 → 1.0.0-rc.112
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/LICENSE +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -11
- package/dist/index.es.js +624 -592
- package/dist/index.es.js.map +1 -1
- package/package.json +14 -14
- package/src/client/index.ts +27 -29
- package/src/client/old.ts +44 -15
- package/src/helpers/mayanode.ts +31 -0
- package/src/helpers/thornode.ts +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare enum ApproveMode {
|
|
|
51
51
|
export declare type ApproveReturnType<T extends ApproveMode> = T extends "checkOnly" ? Promise<boolean> : Promise<string>;
|
|
52
52
|
|
|
53
53
|
export declare type AvailableProviders<T> = T | {
|
|
54
|
-
[K in
|
|
54
|
+
[K in PluginName]?: ProviderMethods;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
export declare type ChainWallet<T extends Chain> = WalletMethods[T] & {
|
|
@@ -105,13 +105,13 @@ export declare type OldWallet = {
|
|
|
105
105
|
[key in Chain]: OldChainWallet | null;
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
+
export declare type PluginName = "thorchain" | "chainflip" | "mayachain";
|
|
109
|
+
|
|
108
110
|
export declare type ProviderMethods = {
|
|
109
111
|
swap: (swapParams: SwapParams) => Promise<string>;
|
|
110
112
|
[key: string]: any;
|
|
111
113
|
};
|
|
112
114
|
|
|
113
|
-
export declare type ProviderName = "thorchain" | "chainflip" | "mayachain";
|
|
114
|
-
|
|
115
115
|
export declare type QuoteRouteV2 = {
|
|
116
116
|
buyAsset: string;
|
|
117
117
|
sellAsset: string;
|
|
@@ -123,8 +123,8 @@ export declare type QuoteRouteV2 = {
|
|
|
123
123
|
|
|
124
124
|
export declare type SubstrateBasedWallet<T extends typeof PolkadotToolbox | typeof ChainflipToolbox> = Awaited<ReturnType<T>>;
|
|
125
125
|
|
|
126
|
-
export declare function SwapKit<ExtendedProviders extends {}, ConnectWalletMethods extends Record<string, ReturnType<SwapKitWallet["connect"]>>>({ stagenet, wallets,
|
|
127
|
-
|
|
126
|
+
export declare function SwapKit<ExtendedProviders extends {}, ConnectWalletMethods extends Record<string, ReturnType<SwapKitWallet["connect"]>>>({ stagenet, wallets, plugins, config, apis, rpcUrls, }: {
|
|
127
|
+
plugins: SwapKitPlugin[];
|
|
128
128
|
stagenet: boolean;
|
|
129
129
|
wallets: SwapKitWallet[];
|
|
130
130
|
config?: Record<string, any>;
|
|
@@ -228,6 +228,9 @@ export declare class SwapKitCore<T = ""> {
|
|
|
228
228
|
registerThorname: ({ assetValue, ...param }: ThornameRegisterParam & {
|
|
229
229
|
assetValue: AssetValue;
|
|
230
230
|
}) => Promise<string>;
|
|
231
|
+
registerMayaname: ({ assetValue, ...param }: ThornameRegisterParam & {
|
|
232
|
+
assetValue: AssetValue;
|
|
233
|
+
}) => Promise<string>;
|
|
231
234
|
extend: ({ wallets, config, apis, rpcUrls }: ExtendParams<T>) => void;
|
|
232
235
|
estimateMaxSendableAmount: ({ chain, params, }: {
|
|
233
236
|
chain: Chain;
|
|
@@ -252,19 +255,19 @@ export declare class SwapKitCore<T = ""> {
|
|
|
252
255
|
disconnectChain: (chain: Chain) => void;
|
|
253
256
|
}
|
|
254
257
|
|
|
255
|
-
export declare type
|
|
258
|
+
export declare type SwapKitPlugin = ({ wallets, stagenet }: {
|
|
256
259
|
wallets: Wallets;
|
|
257
260
|
stagenet?: boolean;
|
|
258
261
|
}) => {
|
|
259
|
-
name:
|
|
262
|
+
name: PluginName;
|
|
260
263
|
methods: ProviderMethods;
|
|
261
264
|
};
|
|
262
265
|
|
|
263
|
-
declare type
|
|
264
|
-
[K in
|
|
266
|
+
declare type SwapKitPlugins = {
|
|
267
|
+
[K in PluginName]?: ProviderMethods;
|
|
265
268
|
};
|
|
266
269
|
|
|
267
|
-
export declare type SwapKitReturnType =
|
|
270
|
+
export declare type SwapKitReturnType = SwapKitPlugins & {
|
|
268
271
|
getAddress: (chain: Chain) => string;
|
|
269
272
|
getWallet: (chain: Chain) => ChainWallet<Chain> | undefined;
|
|
270
273
|
getWalletWithBalance: (chain: Chain, potentialScamFilter?: boolean) => Promise<ChainWallet<Chain>>;
|
|
@@ -287,7 +290,7 @@ export declare type SwapKitWallet = {
|
|
|
287
290
|
|
|
288
291
|
export declare type SwapParams = (SwapWithRouteParams | GenericSwapParams) & {
|
|
289
292
|
provider?: {
|
|
290
|
-
name:
|
|
293
|
+
name: PluginName;
|
|
291
294
|
config: Record<string, any>;
|
|
292
295
|
};
|
|
293
296
|
};
|