@skip-go/widget 0.0.1 → 0.1.0
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 +44 -0
- package/build/chains/types.d.ts +2 -2
- package/build/hooks/use-assets.d.ts +1 -1
- package/build/hooks/use-route.d.ts +1 -1
- package/build/hooks/use-swap-widget.d.ts +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.es.js +87 -8
- package/build/index.es.js.map +1 -1
- package/build/ui/WebComponent.d.ts +16 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -113,3 +113,47 @@ The `SwapWidgetProvider` component accepts the following prop:
|
|
|
113
113
|
- `apiURL` (Optional): 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.
|
|
114
114
|
|
|
115
115
|
By following these steps, you can easily integrate the Skip Go Widget into your React application and customize it to meet your specific needs.
|
|
116
|
+
|
|
117
|
+
### Web Component
|
|
118
|
+
|
|
119
|
+
The web component is created with the `@r2wc/react-to-web-component` library.
|
|
120
|
+
|
|
121
|
+
In order to register the web-component, you must call the `initializeSwapWidget` function:
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { initializeSwapWidget } from '@skip-go/widget';
|
|
125
|
+
|
|
126
|
+
initializeSwapWidget();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
voila! you can now use the `swap-widget` web-component
|
|
130
|
+
|
|
131
|
+
The props for the web component are the same as `SwapWidgetProps` and `SwapWidgetProviderProps` except that
|
|
132
|
+
they are sent to the web-component as attributes in kebab-case as strings or stringified objects ie.
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
interface SwapWidgetProps {
|
|
136
|
+
colors
|
|
137
|
+
defaultRoute
|
|
138
|
+
routeConfig
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
becomes
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
<swap-widget
|
|
145
|
+
class-name="classname"
|
|
146
|
+
colors='{"primary":"#FF4FFF"}'
|
|
147
|
+
default-route={JSON.stringify({
|
|
148
|
+
srcChainID: 'osmosis-1',
|
|
149
|
+
srcAssetDenom:
|
|
150
|
+
'ibc/1480b8fd20ad5fcae81ea87584d269547dd4d436843c1d20f15e00eb64743ef4',
|
|
151
|
+
})}
|
|
152
|
+
></swap-widget>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
the web-component exposes the `SwapWidgetProviderProps` as attributes on swap-widget as well
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
<swap-widget toaster-props="" endpoint-options="" api-url=""></swap-widget>
|
|
159
|
+
```
|
package/build/chains/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const chainIds: readonly ["eightball-1", "agoric-3", "
|
|
1
|
+
export declare const chainIds: readonly ["acre_9052-1", "eightball-1", "agoric-3", "aioz_168-1", "akashnet-2", "akiro-1", "althea_258432-1", "andromeda-1", "andromeda-1", "arkh", "archway-1", "mantle-1", "xstaxy-1", "aura_6322-2", "beezee-1", "axelar-dojo-1", "laozi-mainnet", "bitcanna-1", "bitsong-2b", "bluechip_1", "bluzelle-9", "bostrom", "canto_7700-1", "carbon-1", "celestia", "cerberus-chain-1", "chimba", "morocco-1", "perun-1", "chihuahua-1", "cifer-2", "cifer-1", "cheqd-mainnet-1", "comdex-1", "commercio-3", "cvn_2032-1", "coreum-mainnet-1", "coss-1", "crescent-1", "centauri-1", "cosmoshub-4", "cronosmainnet_25-1", "crypto-org-chain-mainnet-1", "cudos-1", "mainnet-3", "dhealth", "dig-1", "vota-ash", "desmos-mainnet", "dyson-mainnet-01", "echelon_3000-3", "emoney-3", "dydx-mainnet-1", "dymension_1100-1", "empowerchain-1", "ethos_7003-1", "fetchhub-4", "finschia-2", "colosseum-1", "furya-1", "fxcore", "galaxy-1", "genesis_29-2", "evmos_9001-2", "wormchain", "gitopia", "govgen-1", "helichain", "highbury_710-1", "humans_1089-1", "Antora", "gravity-bridge-3", "imversed_5555555-1", "haqq_11235-1", "ixo-5", "irishub-1", "injective-1", "jackal-1", "joltify_1729-1", "kava_2222-10", "juno-1", "kichain-2", "darchub", "lambda_92000-1", "lava-mainnet-1", "kyve-1", "likecoin-mainnet-2", "kaiyo-1", "logos_7002-1", "loop-1", "loyal-main-02", "LumenX", "lum-network-1", "mars-1", "mayachain-mainnet-v1", "medasdigital-1", "meme-1", "microtick-1", "migaloo-1", "mainnet", "mun-1", "mythos_7001-1", "neura_266-1", "Neutaro-1", "cataclysm-1", "nim_1122-1", "neutron-1", "noble-1", "nois-1", "pirin-1", "nomic-stakenet-3", "nyx", "octa", "odin-mainnet-freya", "odin-mainnet-freya", "exchain-66", "omniflixhub-1", "onex-mainnet-1", "onomy-mainnet-1", "Oraichain", "panacea-3", "passage-1", "passage-2", "osmosis-1", "point_10687-1", "core-1", "planq_7070-2", "pryzm-1", "PUNDIX", "pio-mainnet-1", "pylons-mainnet-1", "quasar-1", "qwoyn-1", "realionetwork_3301-1", "quicksilver-2", "reb_1111-1", "titan-1", "regen-1", "scorum-1", "ssc-1", "secret-4", "seda-1", "pacific-1", "self-1", "sentinelhub-2", "sgenet-1", "ShareRing-VoyagerNet", "shentu-2.2", "shido_9008-1", "sifchain-1", "sixnet", "sommelier-3", "source-1", "stafihub-1", "stargaze-1", "iov-mainnet-ibc", "stratos-1", "stride-1", "sunrise-1", "tenet_1559-1", "teritori-1", "morocco-1", "columbus-5", "phoenix-1", "tgrade-mainnet-1", "thorchain-mainnet-v1", "titan_18888-1", "FUND-MainNet-2", "ununifi-beta-v1", "umee-1", "uptick_117-1", "dimension_37-1", "vidulum-1", "zetachain_7000-1", "sandbox-01", "constantine-3", "arkeo", "artela_11820-1", "aura_6321-3", "axelar-testnet-lisbon-3", "bbn-test1", "bbn-test3", "bitcanna-dev-6", "bitcanna-dev-1", "blockx_190-1", "cascadia_6102-1", "blockspacerace-0", "arabica-11", "mocha-4", "babajaga-1", "cheqd-testnet-6", "chimba-testnet", "banksy-testnet-3", "kitten-04", "coreum-testnet-1", "theta-testnet-001", "malaga-420", "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-4", "INVALID-ID-permtestnet-testnet-1", "test-core-1", "osmo-test-5", "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", "sunrise-test", "swisstronik_1291-1", "symphony-testnet-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", "miniwasm-1", "initiation-1", "minimove-1", "init-ai-1", "birdee-1", "burrito-1"];
|
|
2
2
|
export type ChainId = (typeof chainIds)[number] | (string & {});
|
|
3
|
-
export declare const chainNames: readonly ["
|
|
3
|
+
export declare const chainNames: readonly ["acrechain", "8ball", "agoric", "aioz", "akash", "akiro", "althea", "andromeda", "andromeda1", "arkh", "archway", "assetmantle", "aura1", "aura", "beezee", "axelar", "bandchain", "bitcanna", "bitsong", "bluechip", "bluzelle", "bostrom", "canto", "carbon", "celestia", "cerberus", "chimba", "chronicnetwork", "chain4energy", "chihuahua", "cifer", "cifer1", "cheqd", "comdex", "commercionetwork", "conscious", "coreum", "coss", "crescent", "composable", "cosmoshub", "cronos", "cryptoorgchain", "cudos", "decentr", "dhealth", "dig", "doravota", "desmos", "dyson", "echelon", "emoney", "dydx", "dymension", "empowerchain", "ethos", "fetchhub", "finschia", "firmachain", "furya", "fxcore", "galaxy", "genesisl1", "evmos", "gateway", "gitopia", "govgen", "heli", "highbury", "humans", "idep", "gravitybridge", "imversed", "haqq", "impacthub", "irisnet", "injective", "jackal", "joltify", "kava", "juno", "kichain", "konstellation", "lambda", "lava", "kyve", "likecoin", "kujira", "logos", "loop", "loyal", "lumenx", "lumnetwork", "mars", "mayachain", "medasdigital", "meme", "microtick", "migaloo", "mises", "mun", "mythos", "neura", "neutaro", "nibiru", "nim", "neutron", "noble", "nois", "nolus", "nomic", "nyx", "octa", "odin", "odin", "okexchain", "omniflixhub", "onex", "onomy", "oraichain", "panacea", "passage1", "passage", "osmosis", "point", "persistence", "planq", "pryzm", "pundix", "provenance", "pylons", "quasar", "qwoyn", "realio", "quicksilver", "rebus", "rizon", "regen", "scorum", "saga", "secretnetwork", "seda", "sei", "self", "sentinel", "sge", "shareledger", "shentu", "shido", "sifchain", "six", "sommelier", "source", "stafihub", "stargaze", "starname", "stratos", "stride", "sunrise", "tenet", "teritori", "terpnetwork", "terra", "terra2", "tgrade", "thorchain", "titan", "unification", "ununifi", "umee", "uptick", "xpla", "vidulum", "zetachain", "akashtestnet", "archwaytestnet", "arkeonetworktestnet", "artelatestnet", "auratestnet", "axelartestnet", "babylontestnet1", "babylontestnet", "bitcannadevnet2", "bitcannadevnet", "blockxtestnet", "cascadiatestnet", "celestiatestnet", "celestiatestnet2", "celestiatestnet3", "chain4energytestnet", "cheqdtestnet", "chimbatestnet", "composabletestnet", "coolcattestnet", "coreumtestnet", "cosmoshubtestnet", "cosmwasmtestnet", "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", "osmosistestnet4", "permtestnet", "persistencetestnet", "osmosistestnet", "persistencetestnet2", "planqtestnet", "pryzmtestnet", "quasartestnet", "quicksilvertestnet", "qwoyntestnet", "rsprovidertestnet", "sagatestnet", "secretnetworktestnet", "secretnetworktestnet2", "seidevnet3", "seitestnet", "seitestnet2", "selfchaindevnet", "sgetestnet", "sgetestnet4", "sixtestnet", "soarchaintestnet", "sourcetestnet", "stargazetestnet", "statesettestnet", "stridetestnet", "sunrisetestnet", "swisstroniktestnet", "symphonytestnet", "temporaltestnet", "terpnettestnet", "terpnettestnet2", "terra2testnet", "titantestnet", "ulastestnet", "uniontestnet", "upticktestnet", "vincechaintestnet", "wardenprotocoltestnet", "wavehashtestnet", "xiontestnet", "zetachaintestnet", "blackwing", "civitia", "miniwasm", "initia", "minimove", "init_ai", "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>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AssetsRequest } from '@skip-go/core';
|
|
2
2
|
export declare function useAssets(options?: AssetsRequest): import("@tanstack/react-query/build/legacy/types").UseQueryResult<{
|
|
3
|
-
[k: string]: import("@skip-go/core/dist/shared-
|
|
3
|
+
[k: string]: import("@skip-go/core/dist/shared-Brd7sQzN").a[];
|
|
4
4
|
}, Error>;
|
|
@@ -16,5 +16,5 @@ interface UseRouteArgs extends RouteConfig {
|
|
|
16
16
|
destinationAssetChainID?: string;
|
|
17
17
|
enabled?: boolean;
|
|
18
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-
|
|
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
20
|
export {};
|
|
@@ -31,7 +31,7 @@ export declare function useSwapWidget(): {
|
|
|
31
31
|
onSourceAssetChange: (asset: Asset) => void;
|
|
32
32
|
onSourceChainChange: (chain: Chain, injectAsset?: Asset) => Promise<void>;
|
|
33
33
|
priceImpactThresholdReached: boolean;
|
|
34
|
-
route: import("@skip-go/core/dist/shared-
|
|
34
|
+
route: import("@skip-go/core/dist/shared-Brd7sQzN").R | undefined;
|
|
35
35
|
routeError: string;
|
|
36
36
|
routeLoading: boolean;
|
|
37
37
|
routeWarningMessage: string | undefined;
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './styles/global.css';
|
|
2
2
|
export { SwapWidgetProvider } from './provider';
|
|
3
3
|
export { SwapWidget, SwapWidgetProps } from './ui';
|
|
4
|
+
export { initializeSwapWidget } from './ui/WebComponent';
|
|
4
5
|
export { useAssets } from './provider/assets';
|
|
5
6
|
export { useChains, useChainByID } from './hooks/use-chains';
|