Parakeet Bridge provides a key missing piece of infrastructure by helping users bridge their NFTs between multiple blockchains. <br /> With Parakeet bridge you can transfer your ERC721/ERC1155 tokens across multiple public blockchain networks in a secure
npm install @parakeet/sdkjs
npm i @parakeet/sdk
`
How to approve the bridge
1. Import approve function
`js
import { approve } from '@parakeet/sdk/bridge';
`
2. Use inside your project. All arguments are required
`js
await approve({
srcChainId,
nftCollectionAddress,
tokenId,
provider,
account,
});
`
$3
| Argument | Type | Required | Description |
| -------------------- | :-----: | -------: | ----------------------------------------------------------------- |
| srcChainId | Integer | true | chain Id on the source chain -> chain on which the NFT is present |
| nftCollectionAddress | String | true | contract address of collection on the source chain |
| tokenId | String | true | specific token Id that you want to bridge |
| provider | Object | true | Web3Provider |
| account | String | true | account address |
How to bridge the NFT
1. Import bridge function
`js
import { bridge } from '@parakeet/sdk/bridge';
`
2. Use inside your project. All arguments are required
`js
await bridge({
srcChainId,
dstChainId,
nftCollectionAddress,
tokenId,
provider,
account,
});
`
$3
| Argument | Type | Required | Description |
| -------------------- | :-----: | -------: | --------------------------------------------------------------------------- |
| srcChainId | Integer | true | chain Id on the source chain -> chain where the NFT is currently present |
| dstChainId | Integer | true | chain Id of the destination chain -> chain where you want to bridge the NFT |
| nftCollectionAddress | String | true | contract address of collection on the source chain |
| tokenId | String | true | specific token Id that you want to bridge |
| provider | Object | true | Web3Provider |
| account | String | true | account address |
Example
$3
`js
import { approve, bridge } from '@parakeet/sdk/bridge';
import { useWeb3React } from '@web3-react/core';
const useBridge = () => {
const { account, library } = useWeb3React();
// rinkeby
const srcChainId = 4;
// optimism kovan
const dstChainId = 69;
// address of the NFT collection on the source chain -> on Rinekby(in this example)
const nftCollectionAddress = '...';
// token Id owned by account
const tokenId = '...';
// provider
let provider;
// in case of ethers.js
provider = library.provider;
// in case of web3.js
provider = library.currentProvider;
const bridgeNFT = async () => {
try {
const approveTx = await approve(
srcChainId,
nftCollectionAddress,
tokenId,
provider,
account
);
const bridgeTx = await bridge(
srcChainId,
dstChainId,
nftCollectionAddress,
tokenId,
provider,
account
);
} catch (err) {
console.log(err);
}
return { approveTx, bridgeTx };
};
return { bridgeNFT };
};
``