Features

Swapping Tokens to NFTs

The action of swapping Tokens for an NFT in the escrow of the MPL-Hybrid program is called a capture. The process involves the user capturing an NFT from the escrow in exchange for a set amount of tokens.

If reroll (path) is enabled in the escrow configuration then the metadata index written to the NFT will be picked at random from the pool of available indexes min, max.

Swapping Tokens

await captureV1(umi, {
  // The owner of the asset being swapped.
  owner: umi.identity,
  // The escrow configuration address.
  escrow: publicKey('11111111111111111111111111111111'),
  // The Asset that will be swapped for SPL Tokens.
  asset: publicKey('22222222222222222222222222222222'),
  // The collection assigned to the escrow configuration.
  collection: publicKey('33333333333333333333333333333333'),
  // The fee wallet address.
  feeProjectAccount: publicKey('44444444444444444444444444444444'),
  // The Token Account of the Wallet.
  token: publicKey('55555555555555555555555555555555'),
}).sendAndConfirm(umi)
Previous
Swapping NFTs to Tokens