@skip-go/widget 1.2.1-alpha.7 → 1.2.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.
- package/README.md +159 -167
- package/build/ast/_constants.d.ts +1 -0
- package/build/ast/_types.d.ts +14 -0
- package/build/ast/get-chains-paths.d.ts +6 -0
- package/build/ast/parse-asset-list-json.d.ts +7 -0
- package/build/ast/parse-chain-json.d.ts +7 -0
- package/build/ast/parse-chain-paths.d.ts +9 -0
- package/build/ast/validate-chains-paths.d.ts +6 -0
- package/build/ast/write-entrypoints.d.ts +7 -0
- package/build/chains/assets.d.ts +3 -0
- package/build/chains/chain-infos.d.ts +3 -0
- package/build/chains/chains.d.ts +3 -0
- package/build/chains/explorers.d.ts +3 -0
- package/build/chains/index.d.ts +7 -0
- package/build/chains/pretty.d.ts +2 -0
- package/build/chains/types.d.ts +6 -0
- package/build/constants/abis.d.ts +2 -0
- package/build/constants/defaults.d.ts +5 -0
- package/build/constants/finality.d.ts +2 -0
- package/build/constants/gas.d.ts +3 -0
- package/build/constants/ledger-warning.d.ts +2 -0
- package/build/constants/swap-venues.d.ts +4 -0
- package/build/constants/wagmi.d.ts +2 -0
- package/build/hooks/use-account.d.ts +46 -0
- package/build/hooks/use-assets.d.ts +4 -0
- package/build/hooks/use-auto-set-address.d.ts +11 -0
- package/build/hooks/use-balances-by-chain.d.ts +15 -0
- package/build/hooks/use-bridges.d.ts +7 -0
- package/build/hooks/use-broadcasted-txs.d.ts +24 -0
- package/build/hooks/use-chains.d.ts +10 -0
- package/build/hooks/use-finality-time-estimate.d.ts +2 -0
- package/build/hooks/use-fix-radix-ui-wheel-event.d.ts +1 -0
- package/build/hooks/use-inject-fonts-to-document-head.d.ts +1 -0
- package/build/hooks/use-make-wallets.d.ts +21 -0
- package/build/hooks/use-route.d.ts +20 -0
- package/build/hooks/use-skip-client.d.ts +9 -0
- package/build/hooks/use-swap-widget.d.ts +81 -0
- package/build/hooks/use-usd-value.d.ts +8 -0
- package/build/index.d.ts +5 -0
- package/build/index.es.js +5201 -0
- package/build/index.es.js.map +1 -0
- package/build/lib/cosmos-kit.d.ts +3 -0
- package/build/lib/react-query.d.ts +2 -0
- package/build/lib/solana-adapter.d.ts +2 -0
- package/build/lib/viem/chains.d.ts +66 -0
- package/build/lib/wagmi.d.ts +8986 -0
- package/build/provider/assets.d.ts +16 -0
- package/build/provider/index.d.ts +25 -0
- package/build/provider/skip-provider.d.ts +12 -0
- package/build/provider/wallet/cosmos.d.ts +6 -0
- package/build/provider/wallet/evm.d.ts +6 -0
- package/build/provider/wallet/solana.d.ts +6 -0
- package/build/scripts/codegen.d.ts +1 -0
- package/build/store/disclosures.d.ts +44 -0
- package/build/store/settings.d.ts +17 -0
- package/build/store/swap-widget.d.ts +107 -0
- package/build/store/track-wallet.d.ts +24 -0
- package/build/store/tx-history.d.ts +36 -0
- package/build/styles/fonts.d.ts +1 -0
- package/build/ui/AdaptiveLink.d.ts +5 -0
- package/build/ui/AssetInput.d.ts +20 -0
- package/build/ui/AssetSelect/AssetSelectContent.d.ts +11 -0
- package/build/ui/AssetSelect/index.d.ts +11 -0
- package/build/ui/AssetValue.d.ts +7 -0
- package/build/ui/Button/HistoryButton.d.ts +2 -0
- package/build/ui/Button/SettingsButton.d.ts +2 -0
- package/build/ui/Button/ShareButton.d.ts +3 -0
- package/build/ui/ChainSelect/ChainSelectContent.d.ts +8 -0
- package/build/ui/ChainSelect/ChainSelectTrigger.d.ts +7 -0
- package/build/ui/ChainSelect/index.d.ts +9 -0
- package/build/ui/ChainSymbol.d.ts +5 -0
- package/build/ui/ConnectedWalletButton.d.ts +8 -0
- package/build/ui/ConversionRate.d.ts +22 -0
- package/build/ui/CraftedBySkip.d.ts +1 -0
- package/build/ui/Dialog/Dialog.d.ts +7 -0
- package/build/ui/Dialog/DialogContent.d.ts +7 -0
- package/build/ui/Dialog/DialogTrigger.d.ts +5 -0
- package/build/ui/Dialog/context.d.ts +7 -0
- package/build/ui/HistoryDialog/DescriptionList.d.ts +5 -0
- package/build/ui/HistoryDialog/HistoryClearButton.d.ts +4 -0
- package/build/ui/HistoryDialog/HistoryList.d.ts +14 -0
- package/build/ui/HistoryDialog/RenderDate.d.ts +5 -0
- package/build/ui/HistoryDialog/SyncState.d.ts +4 -0
- package/build/ui/HistoryDialog/index.d.ts +1 -0
- package/build/ui/Icon/ExpandArrow.d.ts +2 -0
- package/build/ui/Icon/GearIcon.d.ts +1 -0
- package/build/ui/Icon/HistoryIcon.d.ts +2 -0
- package/build/ui/Icon/ShareIcon.d.ts +2 -0
- package/build/ui/Icon/SkipLogo.d.ts +2 -0
- package/build/ui/Icon/SpinnerIcon.d.ts +2 -0
- package/build/ui/JsonDialog.d.ts +1 -0
- package/build/ui/PreviewRoute/AlertCollapse.d.ts +13 -0
- package/build/ui/PreviewRoute/ChainStep.d.ts +30 -0
- package/build/ui/PreviewRoute/SetAddressDialog.d.ts +12 -0
- package/build/ui/PreviewRoute/index.d.ts +25 -0
- package/build/ui/PreviewRoute/make-actions.d.ts +29 -0
- package/build/ui/PreviewRoute/make-chain-ids-with-actions.d.ts +11 -0
- package/build/ui/PreviewRoute/make-step-state.d.ts +17 -0
- package/build/ui/PreviewRoute/types.d.ts +21 -0
- package/build/ui/PriceImpactWarning.d.ts +7 -0
- package/build/ui/SettingsDialog/GasSetting.d.ts +1 -0
- package/build/ui/SettingsDialog/PurgeSetting.d.ts +1 -0
- package/build/ui/SettingsDialog/SaveIndicator.d.ts +1 -0
- package/build/ui/SettingsDialog/SlippageSetting.d.ts +1 -0
- package/build/ui/SettingsDialog/index.d.ts +1 -0
- package/build/ui/SimpleTooltip.d.ts +11 -0
- package/build/ui/SwapDetails.d.ts +11 -0
- package/build/ui/TransactionDialog.d.ts +13 -0
- package/build/ui/UsdValue.d.ts +27 -0
- package/build/ui/WalletModal/WalletListItem.d.ts +8 -0
- package/build/ui/WalletModal/WalletModal.d.ts +10 -0
- package/build/ui/WalletModal/context.d.ts +13 -0
- package/build/ui/WalletModal/index.d.ts +3 -0
- package/build/ui/WebComponent.d.ts +16 -0
- package/build/ui/Widget.d.ts +1 -0
- package/build/ui/index.d.ts +5 -0
- package/build/utils/assert.d.ts +2 -0
- package/build/utils/chain.d.ts +9 -0
- package/build/utils/clients.d.ts +4 -0
- package/build/utils/error.d.ts +1 -0
- package/build/utils/explorer.d.ts +5 -0
- package/build/utils/intl.d.ts +4 -0
- package/build/utils/ledger-warning.d.ts +3 -0
- package/build/utils/link.d.ts +4 -0
- package/build/utils/number.d.ts +4 -0
- package/build/utils/os.d.ts +3 -0
- package/build/utils/random.d.ts +1 -0
- package/build/utils/ui.d.ts +2 -0
- package/build/utils/usd.d.ts +5 -0
- package/build/utils/wallet.d.ts +7 -0
- package/package.json +2 -6
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface MinimalWallet {
|
|
2
|
+
walletName: string;
|
|
3
|
+
walletPrettyName: string;
|
|
4
|
+
walletInfo: {
|
|
5
|
+
logo?: string | {
|
|
6
|
+
major: string;
|
|
7
|
+
minor: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
connect: () => Promise<void>;
|
|
11
|
+
disconnect: () => Promise<void>;
|
|
12
|
+
isWalletConnected: boolean;
|
|
13
|
+
isAvailable?: boolean;
|
|
14
|
+
getAddress?: (props: {
|
|
15
|
+
signRequired?: boolean;
|
|
16
|
+
context?: 'recovery' | 'destination';
|
|
17
|
+
}) => Promise<string | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export declare const useMakeWallets: () => {
|
|
20
|
+
makeWallets: (chainID: string) => MinimalWallet[];
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BridgeType, ExperimentalFeature, SmartSwapOptions, SwapVenueRequest } from '@skip-go/core';
|
|
2
|
+
export interface RouteConfig {
|
|
3
|
+
experimentalFeatures?: ExperimentalFeature[];
|
|
4
|
+
allowMultiTx?: boolean;
|
|
5
|
+
allowUnsafe?: boolean;
|
|
6
|
+
bridges?: BridgeType[];
|
|
7
|
+
swapVenues?: SwapVenueRequest[];
|
|
8
|
+
smartSwapOptions?: SmartSwapOptions;
|
|
9
|
+
}
|
|
10
|
+
interface UseRouteArgs extends RouteConfig {
|
|
11
|
+
direction: 'swap-in' | 'swap-out';
|
|
12
|
+
amount: string;
|
|
13
|
+
sourceAsset?: string;
|
|
14
|
+
sourceAssetChainID?: string;
|
|
15
|
+
destinationAsset?: string;
|
|
16
|
+
destinationAssetChainID?: string;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function useRoute({ direction, amount, sourceAsset, sourceAssetChainID, destinationAsset, destinationAssetChainID, enabled, swapVenues, bridges, experimentalFeatures, allowMultiTx, allowUnsafe, smartSwapOptions, }: UseRouteArgs): import("@tanstack/react-query/build/legacy/types").UseQueryResult<import("@skip-go/core/dist/shared-Brd7sQzN").R | undefined, Error>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useSkipClient(): import("@skip-go/core").SkipRouter;
|
|
2
|
+
export declare function useSkipConfig(): {
|
|
3
|
+
apiURL: string | undefined;
|
|
4
|
+
endpointOptions: {
|
|
5
|
+
endpoints?: Record<string, import("@skip-go/core").EndpointOptions> | undefined;
|
|
6
|
+
getRpcEndpointForChain?: ((chainID: string) => Promise<string>) | undefined;
|
|
7
|
+
getRestEndpointForChain?: ((chainID: string) => Promise<string>) | undefined;
|
|
8
|
+
} | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { GasPrice } from '@cosmjs/stargate';
|
|
2
|
+
import { Asset, BridgeType } from '@skip-go/core';
|
|
3
|
+
import { MouseEvent } from 'react';
|
|
4
|
+
import { Chain } from './use-chains';
|
|
5
|
+
export interface DefaultRouteConfig {
|
|
6
|
+
amountIn?: number;
|
|
7
|
+
amountOut?: number;
|
|
8
|
+
srcChainID?: string;
|
|
9
|
+
srcAssetDenom?: string;
|
|
10
|
+
destChainID?: string;
|
|
11
|
+
destAssetDenom?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function useSwapWidget(): {
|
|
14
|
+
amountIn: string;
|
|
15
|
+
amountOut: string;
|
|
16
|
+
bridges: BridgeType[];
|
|
17
|
+
destinationAsset: Asset | undefined;
|
|
18
|
+
destinationChain: Chain | undefined;
|
|
19
|
+
direction: "swap-in" | "swap-out";
|
|
20
|
+
isAmountError: string | boolean;
|
|
21
|
+
noRouteFound: boolean;
|
|
22
|
+
numberOfTransactions: number;
|
|
23
|
+
onAllTransactionComplete: () => void;
|
|
24
|
+
onBridgeChange: (bridges: BridgeType[]) => void;
|
|
25
|
+
onDestinationAmountChange: (amount: string) => void;
|
|
26
|
+
onDestinationAssetChange: (asset: Asset) => void;
|
|
27
|
+
onDestinationChainChange: (chain: Chain, injectAsset?: Asset) => Promise<void>;
|
|
28
|
+
onInvertDirection: () => Promise<void>;
|
|
29
|
+
onSourceAmountChange: (amount: string) => void;
|
|
30
|
+
onSourceAmountMax: <T extends HTMLElement>(event: MouseEvent<T, globalThis.MouseEvent>) => false | undefined;
|
|
31
|
+
onSourceAssetChange: (asset: Asset) => void;
|
|
32
|
+
onSourceChainChange: (chain: Chain, injectAsset?: Asset) => Promise<void>;
|
|
33
|
+
priceImpactThresholdReached: boolean;
|
|
34
|
+
route: import("@skip-go/core/dist/shared-Brd7sQzN").R | undefined;
|
|
35
|
+
routeError: string;
|
|
36
|
+
routeLoading: boolean;
|
|
37
|
+
routeWarningMessage: string | undefined;
|
|
38
|
+
routeWarningTitle: string | undefined;
|
|
39
|
+
sourceAsset: Asset | undefined;
|
|
40
|
+
sourceChain: Chain | undefined;
|
|
41
|
+
sourceFeeAmount: string | undefined;
|
|
42
|
+
sourceFeeAsset: Asset | undefined;
|
|
43
|
+
swapPriceImpactPercent: number | undefined;
|
|
44
|
+
usdDiffPercent: number | undefined;
|
|
45
|
+
shareable: {
|
|
46
|
+
link: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export interface SwapWidgetStore {
|
|
50
|
+
amountIn: string;
|
|
51
|
+
amountOut: string;
|
|
52
|
+
sourceChain?: Chain;
|
|
53
|
+
sourceAsset?: Asset;
|
|
54
|
+
sourceFeeAsset?: Asset;
|
|
55
|
+
sourceGasPrice?: GasPrice;
|
|
56
|
+
destinationChain?: Chain;
|
|
57
|
+
destinationAsset?: Asset;
|
|
58
|
+
direction: 'swap-in' | 'swap-out';
|
|
59
|
+
gasRequired?: string;
|
|
60
|
+
bridges: BridgeType[];
|
|
61
|
+
}
|
|
62
|
+
export declare const defaultValues: SwapWidgetStore;
|
|
63
|
+
export declare const useSwapWidgetStore: import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<Omit<import("zustand").StoreApi<SwapWidgetStore>, "subscribe"> & {
|
|
64
|
+
subscribe: {
|
|
65
|
+
(listener: (selectedState: SwapWidgetStore, previousSelectedState: SwapWidgetStore) => void): () => void;
|
|
66
|
+
<U>(selector: (state: SwapWidgetStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
67
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
68
|
+
fireImmediately?: boolean | undefined;
|
|
69
|
+
} | undefined): () => void;
|
|
70
|
+
};
|
|
71
|
+
}, "persist"> & {
|
|
72
|
+
persist: {
|
|
73
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SwapWidgetStore, unknown>>) => void;
|
|
74
|
+
clearStorage: () => void;
|
|
75
|
+
rehydrate: () => void | Promise<void>;
|
|
76
|
+
hasHydrated: () => boolean;
|
|
77
|
+
onHydrate: (fn: (state: SwapWidgetStore) => void) => () => void;
|
|
78
|
+
onFinishHydration: (fn: (state: SwapWidgetStore) => void) => () => void;
|
|
79
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SwapWidgetStore, unknown>>;
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Args = {
|
|
2
|
+
chainId: string;
|
|
3
|
+
denom: string;
|
|
4
|
+
coingeckoID?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function useUsdValue(args: Args): import("@tanstack/react-query/build/legacy/types").UseQueryResult<number, Error>;
|
|
8
|
+
export declare function useUsdDiffValue([args1, args2]: [Args, Args]): import("@tanstack/react-query/build/legacy/types").UseQueryResult<number, Error>;
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SwapWidgetProvider } from './provider';
|
|
2
|
+
export { SwapWidget, SwapWidgetProps } from './ui';
|
|
3
|
+
export { initializeSwapWidget } from './ui/WebComponent';
|
|
4
|
+
export { useAssets } from './provider/assets';
|
|
5
|
+
export { useChains, useChainByID } from './hooks/use-chains';
|