diff --git a/examples/README.md b/examples/README.md index 828e8eba..1e1710b4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -37,6 +37,14 @@ Update [depositEth.ts](./depositEth.ts#L14) with your deposit amount then run yarn deposit-eth ``` +## Deposit NFT + +Update [depositNft.ts](./depositNft.ts#L14) with your token address and id then run + +```sh +yarn deposit-nft +``` + ## Prepare Eth Withdrawal Update [createEthWithdrawal.ts](./createEthWithdrawal.ts#L12) with your withdrawal amount then run diff --git a/examples/depositNft.ts b/examples/depositNft.ts new file mode 100644 index 00000000..e2c8fb00 --- /dev/null +++ b/examples/depositNft.ts @@ -0,0 +1,23 @@ +import { Config, ImmutableX } from '@imtbl/core-sdk'; +import { generateWalletConnection } from './libs/walletConnection'; + +(async () => { + try { + const walletConnection = await generateWalletConnection('goerli'); + + // IMX class client + const client = new ImmutableX(Config.SANDBOX); + + // Deposit ERC721 + const depositResponse = await client.deposit(walletConnection.ethSigner, { + type: 'ERC721', + tokenId: '', // TOKEN_ID + tokenAddress: '' // COLLECTION_CONTRACT_ADDRESS + }); + + console.log('depositResponse', depositResponse); + } catch (err) { + console.error(err); + process.exit(1); + } +})(); \ No newline at end of file diff --git a/examples/package.json b/examples/package.json index 61aa36d0..24a68c48 100644 --- a/examples/package.json +++ b/examples/package.json @@ -10,6 +10,7 @@ "create-exchange-transfer": "ts-node -r dotenv/config createExchangeTransfer.ts", "create-nft-primary-txn": "ts-node -r dotenv/config createNftPrimaryTransaction.ts", "deposit-eth": "ts-node -r dotenv/config depositEth.ts", + "deposit-nft": "ts-node -r dotenv/config depositNft.ts", "create-eth-withdrawal": "ts-node -r dotenv/config createEthWithdrawal.ts", "complete-eth-withdrawal": "ts-node -r dotenv/config completeEthWithdrawal.ts", "create-project": "ts-node -r dotenv/config createProject.ts",