@debridge-finance/dln-client

中文文档
17.6.2发布于 2024/11/14GPL-3.0-onlyTypeScriptESM + CJS近 30 天下载 1.4万

A client SDK that facilitates interaction deSwap Liquidity Network (DLN) contracts on Solana and EVM blockchains

原始使用文档
文档目录9 节
  1. A note on calculating execution fees and take cost
  2. Solana to EVM
  3. Order creation
  4. Claim
  5. Execution calldata
  6. EVM to Solana
  7. Fulfill
  8. Send unlock
  9. Cancel

dln-client by deBridge

A client SDK that facilitates interaction deSwap Liquidity Network (DLN) contracts on Solana and EVM blockchains. DLN is built on top of the deBridge cross-chain messaging protocol.

A note on calculating execution fees and take cost

Consider looking at https://github.com/debridge-finance/dln-ts-client/pull/63 for definitions

DLN order creation and expenses

Main flow:

Order creation -> Fulfill / Cancel -> Send unlock -> Claim

After order creation you need to send fulfill, unlock transactions. Also, if order has calldata you need to store and execute it.

Solana to EVM

Transactions order:

  1. Order creation (Solana)
  2. Fulfill (EVM) / Cancel (EVM)
  3. Send unlock (EVM)
  4. Claim (Solana)
  5. Execution calldata (Solana)

Order creation

Transaction example. This transaction contains the following expenses and returns:

InstructionSpend typeAccount nameBytes (for alloc)LamportsComment
CreateOrderWithNoncerentgiveOrderState176-2115840
rentgiveOrderWallet165-2039280
rentnonceMaster16-1002240Is added when dln nonce account doesn't exists
tx fee-5000
priority fee

Claim

Claim transaction follows after fulfill/cancel and send unlock transactions in source chain. Transaction example. This transaction contains the following expenses and returns:

InstructionSpend typeAccount nameBytes (for alloc)LamportsComment
ClaimrentclaimToWallet165-2039280Should be returned after claim
rentsubmission194-2241120Should be returned after claim
rent returnconfirmationStorage+5909040
tx fee-5000
priority fee

Execution calldata

Before calldata execution you need to fulfill order. Transaction example. This transaction contains the following expenses and returns:

InstructionSpend typeAccount nameBytes (for alloc)LamportsComment
ExecuteExternalCallrent returnexternalCallStorage+13906080
rent returnexternalCallMeta+1085760
rent returnsubmissionWallet+2039280
tx fee-5000
priority fee

EVM to Solana

Transactions order:

  1. Order creation (EVM)
  2. Fulfill (Solana) / Cancel (Solana)
  3. Send unlock (Solana)
  4. Claim (EVM)
  5. Execution calldata (EVM)

Fulfill

Creates accounts for on-chain data storing which contains order state and additional accounts for calldata.
Transaction example. This transaction contains the following expenses and returns:

InstructionSpend typeAccount nameBytes (for alloc)LamportsComment
FulfillOrderrenttakeOrderState106-1628640
InitializeExtcallMetarentexternalCallMeta200-2282880Creates if order contains calldata
rentexecuteWallet165-2039280Adds if take order token on Solana is SPL and calldata exists
tx fee-5000
priority fee

Send unlock

For availability to claim order in destination chain. Transaction example. This transaction contains the following expenses and returns:

InstructionSpend typeAccount nameBytes (for alloc)LamportsComment
PrepareSendtransfersendFrom= externalCallStorage + externalCallMeta + debridge fix fee (transferred to debridge feeBeneficiary)
transfersendFromWallet= execution fee
SendUnlock / SendBatchUnlockrentnonceStorage16-1002240Is added when debridge nonce account doesn't exist
rentexternalCallStorage76-1419840If batch unlock it would be 108 + (32 * n), where n - amount of orders in batch
rentexternalCallMeta28-1085760
protocol fee-30000000Transfers to feeBeneficiary (prod value, hanoi value is 100000)
execution fee-57823Depends from give chain, transfers to stakingWallet
tx fee-5000
priority fee

Cancel

Calls instead of fulfill if you want to cancel an order. Transaction example. This transaction contains the following expenses:

InstructionSpend typeAccount nameBytes (for alloc)LamportsComment
CancelOrderrenttakeOrderState106-1628640
PrepareSendtransfersendFrom= externalCallStorage + externalCallMeta + debridge fix fee (transferred to debridge feeBeneficiary)
transfersendFromWallet= execution fee
SendUnlockrentnonceStorage16-1002240Is added when debridge nonce account doesn't exist
rentexternalCallStorage76-1419840
rentexternalCallMeta28-1085760
protocol fee-30000000Transfers to feeBeneficiary (prod value, hanoi value is 100000)
execution fee-364728Depends from give chain, transfers to stakingWallet
tx fee-5000
priority fee

版本与发布记录

@debridge-finance/dln-client 共发布 304 个版本,首次发布于 2022/11/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
17.6.2latest2024/11/142 年前
17.6.12024/11/082 年前
17.6.02024/11/052 年前
17.6.0-dev32024/11/052 年前
17.6.0-dev22024/11/052 年前
17.6.0-dev12024/11/052 年前

关于 @debridge-finance/dln-client 的常见问题

@debridge-finance/dln-client 是什么?

A client SDK that facilitates interaction deSwap Liquidity Network (DLN) contracts on Solana and EVM blockchains

如何安装 @debridge-finance/dln-client?

在项目目录运行 npm install @debridge-finance/dln-client,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@solana/web3.js(^1.89.1)、@solana/buffer-layout(^4.0.0)、@solana/buffer-layout-utils(^0.2.0)、@debridge-finance/solana-utils(^5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@debridge-finance/dln-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@debridge-finance/dln-client 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@debridge-finance/dln-client 可以商用吗?

@debridge-finance/dln-client 使用 GPL-3.0-only 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以 GPL-3.0 兼容许可开源,并附带专利与反锁定条款。仅内部使用不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

@debridge-finance/dln-client 的下载量有多少?

根据 npm 官方下载统计,@debridge-finance/dln-client 在 2026/10/12 – 2026/11/10 这 30 天内被下载 14,494 次,日均约 483 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@debridge-finance/dln-client 还在维护吗?

最新版本 17.6.2 发布于 2024/11/14(2 年前);至今共发布 304 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/11/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。