@skip-go/widget 0.0.1-alpha.0 → 0.0.1-alpha.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 +69 -49
- package/build/chains/types.d.ts +2 -2
- package/build/index.es.js +98 -49
- package/build/index.es.js.map +1 -1
- package/build/store/swap-widget.d.ts +18 -1
- package/build/ui/index.d.ts +2 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,62 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Skip Go Widget
|
|
2
2
|
|
|
3
|
-
The `@skip-go/widget` package is an npm package
|
|
3
|
+
The `@skip-go/widget` package is an npm package providing a React component for a full swap interface using the [Skip API](https://skip.money/).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
To install the package, run the following command:
|
|
8
|
+
|
|
7
9
|
```bash
|
|
8
10
|
npm install @skip-go/widget
|
|
9
11
|
```
|
|
10
12
|
|
|
11
13
|
## Quick Start Guide
|
|
12
14
|
|
|
13
|
-
1. Wrap
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
15
|
+
### 1. Wrap Your App with `SwapWidgetProvider`
|
|
16
|
+
|
|
17
|
+
First, wrap your application or the relevant page with the `SwapWidgetProvider` component:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { SwapWidgetProvider } from '@skip-go/widget';
|
|
21
|
+
|
|
22
|
+
function App() {
|
|
23
|
+
return (
|
|
24
|
+
<SwapWidgetProvider>
|
|
25
|
+
<YourApp />
|
|
26
|
+
</SwapWidgetProvider>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Use the `SwapWidget` Component
|
|
32
|
+
|
|
33
|
+
Next, use the `SwapWidget` component to render the swap interface:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { SwapWidget } from '@skip-go/widget';
|
|
37
|
+
|
|
38
|
+
const SwapPage = () => {
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
style={{
|
|
42
|
+
width: '450px',
|
|
43
|
+
height: '820px',
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<SwapWidget
|
|
47
|
+
colors={{
|
|
48
|
+
primary: '#FF4FFF',
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Component Props
|
|
51
57
|
|
|
52
58
|
### SwapWidget
|
|
53
59
|
|
|
60
|
+
The `SwapWidget` component accepts the following props:
|
|
61
|
+
|
|
54
62
|
```tsx
|
|
55
63
|
interface SwapWidgetProps {
|
|
56
|
-
colors?:{
|
|
57
|
-
primary?: string; // Custom
|
|
58
|
-
}
|
|
59
|
-
defaultRoute?: {
|
|
64
|
+
colors?: {
|
|
65
|
+
primary?: string; // Custom primary color for the widget. Defaults to `#FF486E`.
|
|
66
|
+
};
|
|
67
|
+
defaultRoute?: {
|
|
68
|
+
// Default route for the widget.
|
|
60
69
|
amountIn?: number;
|
|
61
70
|
amountOut?: number;
|
|
62
71
|
srcChainID?: string;
|
|
@@ -64,26 +73,37 @@ interface SwapWidgetProps {
|
|
|
64
73
|
destChainID?: string;
|
|
65
74
|
destAssetDenom?: string;
|
|
66
75
|
};
|
|
67
|
-
endpointOptions?: {
|
|
76
|
+
endpointOptions?: {
|
|
77
|
+
// Endpoint options to override endpoints. Defaults to Skip proxied endpoints. Please reach out to us first if you want to be whitelisted.
|
|
68
78
|
endpoints?: Record<string, EndpointOptions>;
|
|
69
79
|
getRpcEndpointForChain?: (chainID: string) => Promise<string>;
|
|
70
80
|
getRestEndpointForChain?: (chainID: string) => Promise<string>;
|
|
71
81
|
};
|
|
72
|
-
apiURL?: string // Custom API URL to override Skip API endpoint. Defaults to Skip proxied endpoints. Please reach out to us first if you want to be whitelisted.
|
|
82
|
+
apiURL?: string; // Custom API URL to override Skip API endpoint. Defaults to Skip proxied endpoints. Please reach out to us first if you want to be whitelisted.
|
|
73
83
|
routeConfig?: {
|
|
74
|
-
experimentalFeatures?: [
|
|
84
|
+
experimentalFeatures?: ['hyperlane'];
|
|
75
85
|
allowMultiTx?: boolean;
|
|
76
86
|
allowUnsafe?: boolean;
|
|
77
|
-
bridges?: (
|
|
87
|
+
bridges?: ('IBC' | 'AXELAR' | 'CCTP' | 'HYPERLANE')[];
|
|
78
88
|
swapVenues?: {
|
|
79
89
|
name: string;
|
|
80
90
|
chainID: string;
|
|
81
91
|
}[];
|
|
92
|
+
};
|
|
82
93
|
className?: string;
|
|
83
94
|
style?: React.CSSProperties;
|
|
95
|
+
settings?: {
|
|
96
|
+
customGasAmount?: number; // custom gas amount for validation defaults to 200_000
|
|
97
|
+
slippage?: number; //percentage of slippage 0-100. defaults to 3
|
|
98
|
+
};
|
|
99
|
+
onlyTestnet?: boolean; // Only show testnet chains
|
|
84
100
|
}
|
|
85
101
|
```
|
|
86
102
|
|
|
87
103
|
### SwapWidgetProvider
|
|
88
104
|
|
|
89
|
-
|
|
105
|
+
The `SwapWidgetProvider` component accepts the following prop:
|
|
106
|
+
|
|
107
|
+
- `toasterProps` (Optional): Props for the toaster component. Refer to [ToasterProps](https://react-hot-toast.com/docs/toast-options) for more details. Defaults to `{ position: 'top-right' }`.
|
|
108
|
+
|
|
109
|
+
By following these steps, you can easily integrate the Skip Go Widget into your React application and customize it to meet your specific needs.
|
package/build/chains/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const chainIds: readonly ["eightball-1", "acre_9052-1", "agoric-3", "aioz_168-1", "akashnet-2", "akiro-1", "althea_258432-1", "andromeda-1", "andromeda-1", "arkh", "archway-1", "mantle-1", "aura_6322-2", "xstaxy-1", "axelar-dojo-1", "laozi-mainnet", "beezee-1", "
|
|
1
|
+
export declare const chainIds: readonly ["eightball-1", "acre_9052-1", "agoric-3", "aioz_168-1", "akashnet-2", "akiro-1", "althea_258432-1", "andromeda-1", "andromeda-1", "arkh", "archway-1", "mantle-1", "aura_6322-2", "xstaxy-1", "bitcanna-1", "axelar-dojo-1", "laozi-mainnet", "beezee-1", "bluzelle-9", "bitsong-2b", "bostrom", "canto_7700-1", "carbon-1", "cerberus-chain-1", "celestia", "perun-1", "chimba", "chihuahua-1", "morocco-1", "cheqd-mainnet-1", "cifer-2", "cifer-1", "comdex-1", "commercio-3", "cvn_2032-1", "coreum-mainnet-1", "coss-1", "centauri-1", "cosmoshub-4", "cronosmainnet_25-1", "crypto-org-chain-mainnet-1", "crescent-1", "cudos-1", "mainnet-3", "desmos-mainnet", "dhealth", "dig-1", "vota-ash", "dydx-mainnet-1", "dyson-mainnet-01", "dymension_1100-1", "echelon_3000-3", "emoney-3", "empowerchain-1", "ethos_7003-1", "evmos_9001-2", "fetchhub-4", "furya-1", "finschia-2", "colosseum-1", "galaxy-1", "genesis_29-2", "wormchain", "fxcore", "govgen-1", "gitopia", "haqq_11235-1", "gravity-bridge-3", "highbury_710-1", "Antora", "imversed_5555555-1", "humans_1089-1", "ixo-5", "irishub-1", "injective-1", "joltify_1729-1", "jackal-1", "kava_2222-10", "juno-1", "kichain-2", "darchub", "kaiyo-1", "kyve-1", "lambda_92000-1", "lava-mainnet-1", "likecoin-mainnet-2", "logos_7002-1", "loop-1", "loyal-main-02", "LumenX", "lum-network-1", "mayachain-mainnet-v1", "mars-1", "medasdigital-1", "microtick-1", "meme-1", "mainnet", "migaloo-1", "mun-1", "mythos_7001-1", "neura_266-1", "Neutaro-1", "nim_1122-1", "neutron-1", "cataclysm-1", "noble-1", "nois-1", "nomic-stakenet-3", "pirin-1", "nyx", "octa", "odin-mainnet-freya", "odin-mainnet-freya", "exchain-66", "onex-mainnet-1", "onomy-mainnet-1", "omniflixhub-1", "Oraichain", "panacea-3", "passage-2", "passage-1", "osmosis-1", "core-1", "point_10687-1", "planq_7070-2", "pio-mainnet-1", "pryzm-1", "PUNDIX", "pylons-mainnet-1", "quasar-1", "qwoyn-1", "quicksilver-2", "realionetwork_3301-1", "regen-1", "reb_1111-1", "titan-1", "ssc-1", "scorum-1", "seda-1", "secret-4", "sentinelhub-2", "ShareRing-VoyagerNet", "pacific-1", "sgenet-1", "shentu-2.2", "shido_9008-1", "sifchain-1", "sixnet", "sommelier-3", "source-1", "stafihub-1", "iov-mainnet-ibc", "stargaze-1", "stratos-1", "stride-1", "sunrise-1", "tenet_1559-1", "teritori-1", "morocco-1", "columbus-5", "tgrade-mainnet-1", "phoenix-1", "thorchain-mainnet-v1", "titan_18888-1", "umee-1", "FUND-MainNet-2", "ununifi-beta-v1", "vidulum-1", "uptick_117-1", "dimension_37-1", "zetachain_7000-1", "sandbox-01", "constantine-3", "arkeo", "artela_11820-1", "aura_6321-3", "axelar-testnet-lisbon-3", "bbn-test3", "bbn-test1", "bitcanna-dev-1", "bitcanna-dev-6", "blockx_190-1", "cascadia_6102-1", "blockspacerace-0", "arabica-11", "babajaga-1", "mocha-4", "cheqd-testnet-6", "chimba-testnet", "banksy-testnet-3", "kitten-04", "coreum-testnet-1", "malaga-420", "theta-testnet-001", "coss-testnet-1", "cudos-testnet-public-3", "deardoge-testnet", "morpheus-apollo-3", "vota-testnet", "vota-vk", "dydx-testnet-4", "elystestnet-1", "circulus-1", "entrypoint-pubtest-2", "evmos_9000-4", "dorado-1", "ebony-2", "galactica_9302-1", "gitopia-janus-testnet-2", "berberis-1", "testnet-1", "prajna-1", "devnet-1", "pandora-8", "imversed-test-1", "injective-888", "canine-1", "mesomelas-1", "uni-6", "kichain-t-4", "harpoon-4", "korellia-2", "kaon-1", "lava-testnet-2", "lava-testnet-1", "likecoin-public-testnet-5", "lumenx-test", "mantra-hongbai-1", "ares-1", "narwhal-2", "neura_268-1", "neura_267-1", "pion-1", "nibiru-devnet-1", "nibiru-devnet-2", "nibiru-testnet-1", "nibiru-testnet-2", "grand-1", "nois-testnet-005", "rila-1", "sandbox", "okp4-nemeton-1", "osmo-test-5", "osmo-test-4", "INVALID-ID-permtestnet-testnet-1", "test-core-1", "test-core-2", "planq_7077-1", "indigo-1", "quasar-test-1", "rhye-2", "earendel-1", "provider", "ssc-testnet-1", "pulsar-3", "pulsar-2", "sei-devnet-3", "atlantic-1", "atlantic-2", "self-dev-1", "sge-network-3", "sge-network-4", "fivenet", "soarchaintestnet", "sourcetest-1", "elgafar-1", "stateset-1-testnet", "stride-testnet-1", "swisstronik_1291-1", "temporal-test-2", "90u-4", "90u-2", "pisco-1", "titan_18889-1", "ulas", "union-testnet-8", "uptick_7000-2", "vince_1903-1", "buenavista-1", "INVALID-ID-wavehashtestnet-testnet-1", "xion-testnet-1", "athens_7001-1", "tomcat-1", "landlord-1", "init-ai-1", "initiation-1", "minimove-1", "miniwasm-1", "birdee-1", "burrito-1"];
|
|
2
2
|
export type ChainId = (typeof chainIds)[number] | (string & {});
|
|
3
|
-
export declare const chainNames: readonly ["8ball", "acrechain", "agoric", "aioz", "akash", "akiro", "althea", "andromeda1", "andromeda", "arkh", "archway", "assetmantle", "aura", "aura1", "
|
|
3
|
+
export declare const chainNames: readonly ["8ball", "acrechain", "agoric", "aioz", "akash", "akiro", "althea", "andromeda1", "andromeda", "arkh", "archway", "assetmantle", "aura", "aura1", "bitcanna", "axelar", "bandchain", "beezee", "bluzelle", "bitsong", "bostrom", "canto", "carbon", "cerberus", "celestia", "chain4energy", "chimba", "chihuahua", "chronicnetwork", "cheqd", "cifer", "cifer1", "comdex", "commercionetwork", "conscious", "coreum", "coss", "composable", "cosmoshub", "cronos", "cryptoorgchain", "crescent", "cudos", "decentr", "desmos", "dhealth", "dig", "doravota", "dydx", "dyson", "dymension", "echelon", "emoney", "empowerchain", "ethos", "evmos", "fetchhub", "furya", "finschia", "firmachain", "galaxy", "genesisl1", "gateway", "fxcore", "govgen", "gitopia", "haqq", "gravitybridge", "highbury", "idep", "imversed", "humans", "impacthub", "irisnet", "injective", "joltify", "jackal", "kava", "juno", "kichain", "konstellation", "kujira", "kyve", "lambda", "lava", "likecoin", "logos", "loop", "loyal", "lumenx", "lumnetwork", "mayachain", "mars", "medasdigital", "microtick", "meme", "mises", "migaloo", "mun", "mythos", "neura", "neutaro", "nim", "neutron", "nibiru", "noble", "nois", "nomic", "nolus", "nyx", "octa", "odin", "odin", "okexchain", "onex", "onomy", "omniflixhub", "oraichain", "panacea", "passage", "passage1", "osmosis", "persistence", "point", "planq", "provenance", "pryzm", "pundix", "pylons", "quasar", "qwoyn", "quicksilver", "realio", "regen", "rebus", "rizon", "saga", "scorum", "seda", "secretnetwork", "sentinel", "shareledger", "sei", "sge", "shentu", "shido", "sifchain", "six", "sommelier", "source", "stafihub", "starname", "stargaze", "stratos", "stride", "sunrise", "tenet", "teritori", "terpnetwork", "terra", "tgrade", "terra2", "thorchain", "titan", "umee", "unification", "ununifi", "vidulum", "uptick", "xpla", "zetachain", "akashtestnet", "archwaytestnet", "arkeonetworktestnet", "artelatestnet", "auratestnet", "axelartestnet", "babylontestnet", "babylontestnet1", "bitcannadevnet", "bitcannadevnet2", "blockxtestnet", "cascadiatestnet", "celestiatestnet", "celestiatestnet2", "chain4energytestnet", "celestiatestnet3", "cheqdtestnet", "chimbatestnet", "composabletestnet", "coolcattestnet", "coreumtestnet", "cosmwasmtestnet", "cosmoshubtestnet", "cosstestnet", "cudostestnet", "deardogetestnet", "desmostestnet", "doravotatestnet", "doravotatestnet2", "dydxtestnet", "elystestnet", "empowertestnet", "entrypointtestnet", "evmostestnet", "fetchhubtestnet", "finschiatestnet", "galacticatestnet", "gitopiatestnet", "hedgetestnet", "humanstestnet", "hypersigntestnet", "impacthubdevnet", "impacthubtestnet", "imversedtestnet", "injectivetestnet", "jackaltestnet", "jackaltestnet2", "junotestnet", "kichaintestnet", "kujiratestnet", "kyvedevnet", "kyvetestnet", "lavatestnet", "lavatestnet1", "likecointestnet", "lumenxtestnet", "mantrachaintestnet", "marstestnet", "migalootestnet", "neuradevnet", "neuratestnet", "neutrontestnet", "nibirudevnet", "nibirudevnet2", "nibirutestnet", "nibirutestnet2", "nobletestnet", "noistestnet", "nolustestnet", "nyxtestnet", "okp4testnet", "osmosistestnet", "osmosistestnet4", "permtestnet", "persistencetestnet", "persistencetestnet2", "planqtestnet", "pryzmtestnet", "quasartestnet", "quicksilvertestnet", "qwoyntestnet", "rsprovidertestnet", "sagatestnet", "secretnetworktestnet", "secretnetworktestnet2", "seidevnet3", "seitestnet", "seitestnet2", "selfchaindevnet", "sgetestnet", "sgetestnet4", "sixtestnet", "soarchaintestnet", "sourcetestnet", "stargazetestnet", "statesettestnet", "stridetestnet", "swisstroniktestnet", "temporaltestnet", "terpnettestnet", "terpnettestnet2", "terra2testnet", "titantestnet", "ulastestnet", "uniontestnet", "upticktestnet", "vincechaintestnet", "wardenprotocoltestnet", "wavehashtestnet", "xiontestnet", "zetachaintestnet", "blackwing", "civitia", "init_ai", "initia", "minimove", "miniwasm", "tucana", "noon"];
|
|
4
4
|
export type ChainName = (typeof chainNames)[number] | (string & {});
|
|
5
5
|
export declare const chainIdToName: Record<ChainId, ChainName>;
|
|
6
6
|
export declare const chainNameToId: Record<ChainName, ChainId>;
|