@swapkit/core 1.0.0-rc.100 → 1.0.0-rc.103

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/index.d.ts CHANGED
@@ -43,8 +43,15 @@ declare type ApisType = {
43
43
  [key in CosmosChain]?: string;
44
44
  };
45
45
 
46
- declare type BaseSwapkitWalletConnectParams = {
47
- chains: Chain[];
46
+ export declare enum ApproveMode {
47
+ Approve = "approve",
48
+ CheckOnly = "checkOnly"
49
+ }
50
+
51
+ export declare type ApproveReturnType<T extends ApproveMode> = T extends "checkOnly" ? Promise<boolean> : Promise<string>;
52
+
53
+ export declare type AvailableProviders<T> = T | {
54
+ [K in ProviderName]?: ProviderMethods;
48
55
  };
49
56
 
50
57
  export declare type ChainWallet<T extends Chain> = WalletMethods[T] & {
@@ -88,11 +95,6 @@ declare type GenericSwapParams = {
88
95
  recipient: string;
89
96
  };
90
97
 
91
- declare type KeystoreWalletConnectParams = BaseSwapkitWalletConnectParams & {
92
- phrase: string;
93
- index?: number;
94
- };
95
-
96
98
  export declare type OldChainWallet = {
97
99
  address: string;
98
100
  balance: AssetValue[];
@@ -103,12 +105,12 @@ export declare type OldWallet = {
103
105
  [key in Chain]: OldChainWallet | null;
104
106
  };
105
107
 
106
- declare type ProviderMethods = {
108
+ export declare type ProviderMethods = {
107
109
  swap: (swapParams: SwapParams) => Promise<string>;
108
110
  [key: string]: any;
109
111
  };
110
112
 
111
- declare type ProviderName = "thorchain" | "chainflip" | "mayachain";
113
+ export declare type ProviderName = "thorchain" | "chainflip" | "mayachain";
112
114
 
113
115
  export declare type QuoteRouteV2 = {
114
116
  buyAsset: string;
@@ -128,7 +130,7 @@ export declare function SwapKit<ExtendedProviders extends {}, ConnectWalletMetho
128
130
  config?: Record<string, any>;
129
131
  apis: Record<string, any>;
130
132
  rpcUrls: Record<string, any>;
131
- }): SwapKitReturnType & ConnectWalletMethods;
133
+ }): SwapKitReturnType & ConnectWalletMethods & AvailableProviders<ExtendedProviders>;
132
134
 
133
135
  /**
134
136
  * @deprecated Use SwapKit instead (import { SwapKit } from "@swapkit/core")
@@ -262,11 +264,13 @@ declare type SwapKitProviders = {
262
264
  [K in ProviderName]?: ProviderMethods;
263
265
  };
264
266
 
265
- declare type SwapKitReturnType = SwapKitProviders & {
267
+ export declare type SwapKitReturnType = SwapKitProviders & {
266
268
  getAddress: (chain: Chain) => string;
267
269
  getWallet: (chain: Chain) => ChainWallet<Chain> | undefined;
268
270
  getWalletWithBalance: (chain: Chain, potentialScamFilter?: boolean) => Promise<ChainWallet<Chain>>;
269
271
  getBalance: (chain: Chain, potentialScamFilter?: boolean) => AssetValue[];
272
+ getExplorerTxUrl: (chain: Chain, txHash: string) => string;
273
+ getExplorerAddressUrl: (chain: Chain, address: string) => string;
270
274
  swap: (params: SwapParams) => Promise<string>;
271
275
  validateAddress: (params: {
272
276
  address: string;
@@ -276,9 +280,9 @@ declare type SwapKitReturnType = SwapKitProviders & {
276
280
  isAssetValueApproved: (assetValue: AssetValue, contractAddress: string) => boolean | Promise<boolean>;
277
281
  };
278
282
 
279
- declare type SwapKitWallet = {
283
+ export declare type SwapKitWallet = {
280
284
  connectMethodName: string;
281
- connect: (params: ConnectWalletParamsLocal) => (connectParams: WalletConnectParams) => void;
285
+ connect: (params: ConnectWalletParamsLocal) => (connectParams: any) => void;
282
286
  };
283
287
 
284
288
  export declare type SwapParams = (SwapWithRouteParams | GenericSwapParams) & {
@@ -314,8 +318,6 @@ export declare type Wallet = {
314
318
  [key in Chain]?: ChainWallet<key>;
315
319
  };
316
320
 
317
- declare type WalletConnectParams = KeystoreWalletConnectParams;
318
-
319
321
  export declare type WalletMethods = {
320
322
  [Chain.Arbitrum]: EVMWallet<typeof ARBToolbox> | null;
321
323
  [Chain.Avalanche]: EVMWallet<typeof AVAXToolbox> | null;
@@ -337,7 +339,7 @@ export declare type WalletMethods = {
337
339
  [Chain.THORChain]: ThorchainWallet | null;
338
340
  };
339
341
 
340
- declare type Wallets = {
342
+ export declare type Wallets = {
341
343
  [K in Chain]?: ChainWallet<K>;
342
344
  };
343
345