@skip-go/client v1.0.0
重大变更
本节介绍如何从旧版本迁移到最新的@skip-go/client。不再提供 SkipClient 类
SkipClient 类已被移除。请改为直接导入并使用各个独立函数:Example import
初始化变更
如果不使用executeRoute:- 在初始化时调用一次
setApiOptions({ apiUrl, apiKey })。 - 或者,在每次单独调用 API 函数时传入
apiUrl和apiKey参数。
executeRoute:- 使用与之前传给
SkipClient构造函数相同的 options 对象调用setClientOptions()。 - 例外:
getCosmosSigner、getEVMSigner和getSVMSigner已从setClientOptions中移除。这些 signer 函数现在会在需要时直接传给executeRoute。 - 重命名:
getEVMSigner现已更名为getEvmSigner,getSVMSigner现已更名为getSvmSigner。
Example migration
构建格式变更
该库的构建格式已从 CommonJS (CJS) 变更为ES Modules (ESM)。此变更可带来更好的 tree-shaking 效果,从而显著减小那些不会使用该库全部功能的应用的 bundle 体积。如果你不使用
executeRoute,并且打包器启用了 tree-shaking,那么最终 bundle 体积应会大幅下降(例如,单个 API 函数的使用场景可能会从约 5MB 降到约 7KB)。已移除 Axios
axios 不再是依赖项。现在所有 API 调用在内部都使用标准的 window.fetch API。CamelCase 更新
API 响应和配置对象中的所有属性名现在都严格遵循camelCase。示例:| 之前 | 之后 |
|---|---|
chainID | chainId |
apiURL | apiUrl |
logoURI | logoUri |
asset.isCW20 | asset.isCw20 |
API 函数强制使用命名参数
部分方法现在要求使用命名参数或 options 对象,而不是位置参数:recommendAssets
旧写法:{ requests: [...] } 对象中。ibcOriginAssets
旧写法:{ assets: [...] } 对象中。getFeeInfoForChain
getFeeInfoForChain 的参数现在应以对象形式传递。旧写法:getRecommendedGasPrice
getRecommendedGasPrice 的参数现在应以对象形式传递。旧写法:已移除内部函数
以下这些此前导出的函数在 v1.0.0 中已不可用。它们属于内部函数,并不打算供集成方直接使用,因为它们由executeRoute 在内部使用:executeTxsexecuteEvmMsg(merged withexecuteEvmTransaction)executeCosmosMessage(merged withexecuteCosmosTransaction)executeEVMTransactionexecuteSVMTransactionsignCosmosMessageDirectsignCosmosMessageAminogetRpcEndpointForChaingetRestEndpointForChainvalidateGasBalancesvalidateEvmGasBalancevalidateEvmTokenApprovalvalidateSvmGasBalancevalidateUserAddressesgetMainnetAndTestnetChainsgetMainnetAndTestnetAssetsgetAccountNumberAndSequence
executeRoute,它会在内部处理所有交易执行流程。如果你的特定用例确实需要访问其中某些函数,请在我们的 Discord 上提交工单。@skip-router/core v4.0.0
重大变更
- 在
SkipClient中移除了clientID参数 - 在
SkipClient中新增了apiKey参数 - 在
SkipClient.route响应中新增了requiredChainAddresses - 在
SkipClient.route请求中新增了smartSwapOptions
Type signature
@skip-router/core v3.0.0
@skip-router/core v2.0.0
重大变更
- 移除了
SkipClient.executeMultiChainMessage方法 - 将
SkipClient.getGasAmountForMessage方法重命名为SkipClient.getCosmosGasAmountForMessage - 将
SkipClient.getFeeForMessage重命名为SkipClient.getCosmosFeeForMe - 将
MultiChainMsg类型重命名为CosmosMsg - 将
SkipClient.executeMultiChainMsgs重命名为SkipClient.executeTxs,并修改了其参数
Diff
SkipClient.executeCosmosMessage的参数已从message:MultiChainMsg改为messages: CosmosMsg[]
Diff
@skip-go/client v1.0.0
Breaking changes
This section details the migration from previous versions to the latest@skip-go/client.No More SkipClient Class
TheSkipClient class has been removed. Instead, import and use individual functions directly:Example import
Initialization Changes
If not usingexecuteRoute:- Call
setApiOptions({ apiUrl, apiKey })once at initialization. - Alternatively, pass
apiUrlandapiKeyas arguments to each individual API function call.
executeRoute:- Call
setClientOptions()with the same options object previously passed to theSkipClientconstructor. - Exception:
getCosmosSigner,getEVMSigner, andgetSVMSignerhave been removed fromsetClientOptions. These signer functions are now passed directly toexecuteRoutewhen needed. - Renamed:
getEVMSigneris nowgetEvmSigner, andgetSVMSigneris nowgetSvmSigner.
Example migration
Build Format Change
The library build format has changed from CommonJS (CJS) toES Modules (ESM).This change enables better tree-shaking, leading to significantly smaller bundle sizes for applications that don’t use all the library’s features.If you’re not using
executeRoute, your final bundle size should decrease dramatically (e.g., from ~5MB to potentially ~7KB for a single API function usage), assuming tree-shaking is enabled in your bundler.Axios Removed
axios is no longer a dependency. All API calls now utilize the standard window.fetch API internally.CamelCase Update
All property names in API responses and configuration objects now strictly adhere tocamelCase.Examples:| Before | After |
|---|---|
chainID | chainId |
apiURL | apiUrl |
logoURI | logoUri |
asset.isCW20 | asset.isCw20 |
Named parameter enforcement for API functions
Some methods now require named parameters or an options object instead of positional arguments:recommendAssets
Old:{ requests: [...] } object.ibcOriginAssets
Old:{ assets: [...] } object.getFeeInfoForChain
Parameters for getFeeInfoForChain should now be passed as an object.Old:getRecommendedGasPrice
Parameters for getRecommendedGasPrice should now be passed as an object.Old:Removed Internal Functions
The following functions that were previously exported are no longer available in v1.0.0. These were internal functions that were not intended for direct use by integrators, as they are used internally byexecuteRoute:executeTxsexecuteEvmMsg(merged withexecuteEvmTransaction)executeCosmosMessage(merged withexecuteCosmosTransaction)executeEVMTransactionexecuteSVMTransactionsignCosmosMessageDirectsignCosmosMessageAminogetRpcEndpointForChaingetRestEndpointForChainvalidateGasBalancesvalidateEvmGasBalancevalidateEvmTokenApprovalvalidateSvmGasBalancevalidateUserAddressesgetMainnetAndTestnetChainsgetMainnetAndTestnetAssetsgetAccountNumberAndSequence
executeRoute instead, which handles all transaction execution internally. If you have a specific use case that requires access to any of these functions, please open a ticket on our Discord.@skip-router/core v4.0.0
Breaking changes
- Removed
clientIDparam inSkipClient - Added
apiKeyparam inSkipClient - Added
requiredChainAddressesinSkipClient.routeresponse - Added
smartSwapOptionsinSkipClient.routerequest
Type signature
@skip-router/core v3.0.0
Breaking changes
- Changed parameter type of
userAddressesfrom a map of chainIDs to addresses to an array ofUserAddresstypes
Type signature
@skip-router/core v2.0.0
Breaking changes
- Removed
SkipClient.executeMultiChainMessagemethod - Renamed
SkipClient.getGasAmountForMessagemethod toSkipClient.getCosmosGasAmountForMessage - Renamed
SkipClient.getFeeForMessagetoSkipClient.getCosmosFeeForMe - Renamed
MultiChainMsgtype toCosmosMsg - Renamed and changed parameters of
SkipClient.executeMultiChainMsgstoSkipClient.executeTxs
Diff
- Param of
SkipClient.executeCosmosMessagechanged frommessage:MultiChainMsgtomessages: CosmosMsg[]
Diff