import { prepareToSendTx } from '../send'; import { getGasFee } from '../send/fee/getGasFee'; import { IBbcTxData } from '../types'; import { BBC_TESTNET_NETWORK, BBC_ACCOUNT, BSC_ACCOUNT, BNB_ASSET, BUSD_ASSET } from './mock'; export default () => describe('prepareForBbc', () => { it('BBC -> BBC: Transfer BNB', async () => { expect.hasAssertions(); const data = { network: BBC_TESTNET_NETWORK, from: BBC_ACCOUNT.address, to: 'tbnb1rpcs840n83zpzvfjncv62tp4ae8aar72c2am87', value: '0.001', asset: BNB_ASSET, memo: 'test-bnb', } as IBbcTxData; const { fee } = await getGasFee(data); console.log('bbc: ', fee); const { sign, send } = await prepareToSendTx({ ...data, fee } as IBbcTxData); const result = await send(sign(BBC_ACCOUNT.privateKey)); console.log('bbc: ', result); expect(result).toHaveProperty('transactionHash'); }); it('BBC -> BBC: Transfer BUSD', async () => { expect.hasAssertions(); const data = { network: BBC_TESTNET_NETWORK, from: BBC_ACCOUNT.address, to: BBC_ACCOUNT.address, value: '0.001', asset: { ...BUSD_ASSET, networkSymbol: 'BUSD-BAF', }, memo: 'test-bbc-busd', } as IBbcTxData; const { fee } = await getGasFee(data); console.log('bbc -> bbc: ', fee); const { sign, send } = await prepareToSendTx({ ...data, fee } as IBbcTxData); const result = await send(sign(BBC_ACCOUNT.privateKey)); expect(result).toHaveProperty('transactionHash'); }); it('BBC -> BSC: Transfer BUSD', async () => { expect.hasAssertions(); const data = { network: BBC_TESTNET_NETWORK, from: BBC_ACCOUNT.address, to: BSC_ACCOUNT.address, value: '0.001', asset: BNB_ASSET, memo: 'test-bsc-busd', } as IBbcTxData; const { fee } = await getGasFee(data); console.log('bbc -> bsc: ', fee); const { sign, send } = await prepareToSendTx({ ...data, fee } as IBbcTxData); const result = await send(sign(BBC_ACCOUNT.privateKey)); expect(result).toHaveProperty('transactionHash'); }); });