Add Connection class

This commit is contained in:
Michael Vines
2018-08-23 10:52:48 -07:00
parent 79ab826678
commit 4df189513e
12 changed files with 526 additions and 70 deletions

View File

@ -0,0 +1,45 @@
// @flow
import {Connection} from '../src/connection';
import {Account} from '../src/account';
const url = 'http://localhost:8899';
//const url = 'http://master.testnet.solana.com:8899';
test.skip('get balance', async () => {
const account = new Account();
const connection = new Connection(url);
const balance = await connection.getBalance(account.publicKey);
expect(balance).toBeGreaterThanOrEqual(0);
});
test.skip('throws on bad transaction', () => {
const connection = new Connection(url);
expect(connection.confirmTransaction('bad transaction signature'))
.rejects.toThrow('Invalid request');
});
test.skip('get transaction count', async () => {
const connection = new Connection(url);
const count = await connection.getTransactionCount();
expect(count).toBeGreaterThanOrEqual(0);
});
test.skip('get last Id', async () => {
const connection = new Connection(url);
const lastId = await connection.getLastId();
expect(lastId.length).toBeGreaterThanOrEqual(43);
});
test.skip('get finality', async () => {
const connection = new Connection(url);
const finality = await connection.getFinality();
expect(finality).toBeGreaterThanOrEqual(0);
});