CrestFi
  • 🫐CrestFi
  • 🚀Getting Started
    • ☃️How to get started?
    • 🤑Benefits of Using CrestFi
    • 💵Deposit
    • ⏳Start Streaming
    • 💰Withdraw Funds
  • 🔒Safe
    • 🗝️Create Safe
    • 💵Deposit in Safe
    • 💸Sending a Transaction
    • ⚧Signing a Transaction
  • CrestFi Evm
    • 📦CrestFi Evm Sdk
      • CrestFi Stream Client
        • Creating Clients
        • Whitelisting Tokens
        • Deposit into Crest Wallet
        • Withdraw from Crest Wallet
        • Initiating a Stream
        • Pause/Resume/Cancel Stream
        • Updating a Stream
        • Withdraw Streamed Tokens
        • Getting Stream Details
      • CrestFi Bulk Client
        • Bulk Instant Transfer
      • CrestFi Multisig Stream
        • NFT
Powered by GitBook
On this page
Export as PDF
  1. CrestFi Evm
  2. CrestFi Evm Sdk
  3. CrestFi Multisig Stream

NFT

You have the capability to oversee and control your BEP-721 and BEP-1155 standard non-fungible tokens (NFTs) through a Crest safe.

Usage

Initializing the CrestFiMultisigStream

To use the CrestFiMultisigStream class, you need to initialize an instance of it by providing a signer or provider and, optionally, the contract address. Here's how you can do that:

import { CrestFiMultisigStream } from 'crest-multisig-stream';

// Your Ethereum provider or signer
const providerOrSigner = ...;

// Optionally, specify the contract address (default is CORE_CONTRACT_ADDRESS)
const contractAddress = ...;

const crestfiStream = new CrestFiMultisigStream(providerOrSigner, contractAddress);

Depositing ERC-721 Tokens

The depositERC721 method allows you to deposit an ERC-721 token into a safe address. It takes the tokenId, tokenAddress, and safeAddress as parameters and returns a transaction response.

const tokenId = 123; // The ERC-721 token ID
const tokenAddress = '0x...'; // The ERC-721 token contract address
const safeAddress = '0x...'; // The destination safe address

const transactionResponse = await crestfiStream.depositERC721(tokenId, tokenAddress, safeAddress);
console.log(transactionResponse);

Depositing ERC-1155 Tokens

The depositERC1155 method allows you to deposit ERC-1155 tokens into a safe address. It takes the tokenId, tokenAddress, safeAddress, and amount as parameters and returns a transaction Response.

const tokenId = 123; // The ERC-1155 token ID
const tokenAddress = '0x...'; // The ERC-1155 token contract address
const safeAddress = '0x...'; // The destination safe address
const amount = 5; // The amount of tokens to deposit

const transactionResponse = await crestfiStream.depositERC1155(tokenId, tokenAddress, safeAddress, amount);
console.log(transactionResponse);

Transferring ERC-721 Tokens

The transferERC721 method generates transaction data to transfer an ERC-721 token from a safe address to a recipient address. It takes the tokenId, tokenAddress, to, and safeAddress as parameters.

const tokenId = 123; // The ERC-721 token ID
const tokenAddress = '0x...'; // The ERC-721 token contract address
const to = '0x...'; // The recipient address
const safeAddress = '0x...'; // The source safe address

// The Safe SDK can utilize this transactionData to initiate and execute multi-signature transactions.
const transactionData = crestfiStream.transferERC721(tokenId, tokenAddress, to, safeAddress);
console.log(transactionData); 

Transferring ERC-1155 Tokens

The transferERC1155 method generates transaction data to transfer ERC-1155 tokens from a safe address to a recipient address. It takes the tokenAddress, tokenIds, amounts, to, and safeAddress as parameters.

const tokenAddress = '0x...'; // The ERC-1155 token contract address
const tokenIds = [123, 456]; // An array of ERC-1155 token IDs
const amounts = [5, 10]; // An array of corresponding token amounts
const to = '0x...'; // The recipient address
const safeAddress = '0x...'; // The source safe address

// The Safe SDK can utilize this transactionData to initiate and execute multi-signature transactions.
const transactionData = crestfiStream.transferERC1155(tokenAddress, tokenIds, amounts, to, safeAddress);
console.log(transactionData); 
PreviousCrestFi Multisig Stream

Last updated 4 months ago

📦