@skip-go/client is a TypeScript library that streamlines interaction with the Skip Go API, enabling cross-chain swaps and transfers across multiple ecosystems.
Install Library
yarn
(or another package manager that doesn’t install peer dependencies by default)
you may need to install these peer dependencies as well:Initialize Library
SkipClient
instance. Instead, you configure the library once and then import and use individual functions directly.setClientOptions
or setApiOptions
. Both functions accept apiUrl
and apiKey
.setClientOptions(options)
: Use this if you plan to use executeRoute
. It configures your API credentials and lets you provide chain-specific settings like endpoints, Amino types, and registry types.setApiOptions(options)
: Use this if you primarily need to configure API interaction (apiUrl
, apiKey
) or set up affiliate fees (chainIdsToAffiliates
). This option does not configure endpointOptions
, aminoTypes
, or registryTypes
.options
type for setClientOptions
or setApiOptions
for full details.apiUrl?: string
: Override the default API URL. Can be passed to setClientOptions
or setApiOptions
, or directly to individual API functions if neither initialization function is called.apiKey?: string
: Your Skip API key. Can be passed to setClientOptions
or setApiOptions
, or directly to individual API functions if neither initialization function is called. Required for certain features.endpointOptions?: EndpointOptions
: Provide RPC and REST endpoints for specific chains (used by setClientOptions
).aminoTypes?: AminoConverters
: Additional amino types for message encoding (used by setClientOptions
).registryTypes?: Iterable<[string, GeneratedType]>
: Additional registry types (used by setClientOptions
).cacheDurationMs?: number
: Duration in milliseconds to cache responses for functions like chains
and assets
(used by setClientOptions
).Setup Signers
Query Basic Info
Get a Route
route
function. See it in context here.Get Required Addresses
route.requiredChainAddresses
array lists the chain IDs for which addresses are needed.getAddress
that retrieves the address based on the chain ID.Execute the Route
executeRoute
will monitor each transaction until it completes, then generate the transaction for the next step and prompt the user to sign it using the appropriate signer.messages
: Generate transaction messages.messagesDirect
: A convenience function that combines the functionality of /route
and /msgs
into a single call. It returns the minimal number of messages required to execute a multi-chain swap or transfer.broadcastTx
: Broadcast transactions to the network.submitTransaction
: Submit and track transactions.
Refer to the API documentation for details on these lower-level functions.Transaction Tracking
executeRoute
, submitTransaction
, or trackTransaction
), you can poll for its status:transactionStatus
- Takes a txHash
and chainId
and returns the current cross-chain status.
executeRoute
(Step 7), it automatically handles the transaction lifecycle, including waiting for completion. The manual tracking functions (submitTransaction
, trackTransaction
, transactionStatus
) are primarily for scenarios where you are not using executeRoute
for full execution (e.g., if you use submitTransaction
directly) or if you need more granular control over the tracking and status polling process.