Base Example
A working code example of minting a license on Story using Base $ETH.
Abstract Chain Example
A working code example of minting a license on Story using Abstract $ETH.
- Constructing a deBridge API call that will return tx data to swap tokens across chains and perform some action (e.g. mint a license on Story)
- Executing the API call to receive that tx data
- Executing the transaction (using the returned tx data) on the source chain

Step 1: Constructing the deBridge API Call
The first step is to construct a deBridge API call. The purpose of this API call is to receive back a response that will contain transaction data so we can then execute it on the source chain. This deBridge order swaps tokens from one chain to another. We can also optionally attach adlnHook
that will execute an arbitrary action upon order completion (ex. after $ETH has been swapped for $IP). This is where the magic happens.
You can learn more about dlnHooks here.
dlnHook
will be a call to mintLicenseTokensCrossChain
, which is a function in this contract that wraps the received $IP to $WIP and then mints a license token on Story.
You can see that mintLicenseTokensCrossChain
looks like this:
DebridgeLicenseTokenMinter.sol
approve
the Royalty Module (what pays for the license minting fee) to spend the $WIP?” This is already done for you, since the Royalty Module is already approved to spend on behalf of Multicall.
The reason we had to make a Multicall contract in the first place, instead of simply bridging directly to $WIP and calling mintLicenseTokens
in the Licensing Module, is because the Royalty Module wouldn’t be approved to spend the $WIP. So we utilize the Multicall contract to take care of that for us instead.
To summarize, we will construct a deBridge API call that says “we want to swap $ETH for $IP, then use a dlnHook to call a smart contract on Story that wraps $IP to $WIP and mints a license on Story”.
Step 1a. Constructing the dlnHook
The dlnHook
is a JSON object that will be attached to the deBridge API call. It will contain the following information:
- The type of action to execute (
evm_transaction_call
) - The address of the contract to call (
DebridgeLicenseTokenMinter.sol
) - The calldata to execute (
mintLicenseTokensCrossChain
)
main.ts
Step 1b. Constructing the deBridge API Call
Now that we have thedlnHook
, we can construct the whole deBridge API call, including the dlnHook
.
You can view deBridge’s documentation on the
create-tx
endpoint here. I also highly recommend checking out the Swagger UI for the create-tx
endpoint as well.Attribute | Description |
---|---|
srcChainId | The ID of the source blockchain (e.g., Ethereum mainnet is 1). |
srcChainTokenIn | The address of the token being swapped on the source chain (ETH in this case). |
srcChainTokenInAmount | The amount of the source token to swap, set to auto for automatic calculation. |
dstChainId | The ID of the destination blockchain (e.g., Story mainnet is 100000013). |
dstChainTokenOut | The address of the token to receive on the destination chain (WIP token). |
dstChainTokenOutAmount | The amount of the destination token to receive. It should be the same as the amount we’re paying in payRoyaltyOnBehalf in step 1a. |
dstChainTokenOutRecipient | This can just be the same as senderAddress . |
senderAddress | The address initiating the transaction. |
srcChainOrderAuthorityAddress | The address authorized to manage the order on the source chain. This can just be the same as senderAddress . |
dstChainOrderAuthorityAddress | The address authorized to manage the order on the destination chain. This can just be the same as senderAddress . |
enableEstimate | A flag to enable transaction simulation and estimation. |
prependOperatingExpenses | A flag to include operating expenses in the transaction. |
dlnHook | The URL-encoded hook that specifies additional actions to execute post-swap. |
main.ts
Step 2: Executing the API Call
Once the API call is constructed, execute it to receive a response. This response includes transaction data and an estimate for running the transaction on the source swap chain (e.g., Ethereum, Solana).Step 3: Executing the Transaction on the Source Chain
Next, you would take the API response and execute the transaction on the source chain.View the docs here on submitting the transaction, including how this would be done differently on Solana.
TypeScript