Skip to content

Commit

Permalink
Merge pull request #75 from MickWang/master
Browse files Browse the repository at this point in the history
update gasPrice to replace 0 for testnet
  • Loading branch information
MickWang authored Jul 19, 2018
2 parents 534b4cd + effcb10 commit c299333
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/attest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('test attest claim', () => {
const identity = Identity.create(privateKey, '123456', '');
const ontId = identity.ontid;
const address = account.address;
const gasPrice = '0';
const gasPrice = '500';
const gasLimit = '30000';

function randomClaim(): Claim {
Expand Down
2 changes: 1 addition & 1 deletion test/claim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('test claim', () => {
* Registers new ONT ID to create transaction with Events and new block
*/
beforeAll(async () => {
const tx = buildRegisterOntidTx(ontid, publicKey, '0', '30000');
const tx = buildRegisterOntidTx(ontid, publicKey, '500', '30000');
tx.payer = account.address;
signTransaction(tx, privateKey);

Expand Down
2 changes: 1 addition & 1 deletion test/deployCodeTx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('test deploy contract', () => {
test('test deploy with avm code', async () => {

const tx = makeDeployCodeTransaction(attestClaimAvmCode,
'name', '1.0', 'alice', 'testmail', 'desc', true, '0', '30000000');
'name', '1.0', 'alice', 'testmail', 'desc', true, '500', '30000000');
tx.payer = account.address;
signTransaction(tx, privateKey);
const result = await restClient.sendRawTransaction(tx.serialize());
Expand Down
2 changes: 1 addition & 1 deletion test/message.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('test message', () => {
}

beforeAll(async () => {
const tx = buildRegisterOntidTx(ontid, publicKey, '0', '30000');
const tx = buildRegisterOntidTx(ontid, publicKey, '500', '30000');
tx.payer = account.address;
signTransaction(tx, privateKey);

Expand Down
6 changes: 3 additions & 3 deletions test/nep5.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { PrivateKey } from '../src/crypto/PrivateKey';
import { RestClient, WebsocketClient } from '../src/index';
import Nep5TxBuilder from '../src/smartcontract/neovm/nep5TxBuilder';
import { signTransaction } from '../src/transaction/transactionBuilder';
import { reverseHex, hexstr2str } from '../src/utils';
import { hexstr2str, reverseHex } from '../src/utils';
import { Address } from './../src/crypto/address';

describe('test nep5', () => {
Expand All @@ -39,14 +39,14 @@ describe('test nep5', () => {
const codeHash = 'cacbaf1024af9eb19f981c084548df14510d85ae';

const contractAddr = new Address(reverseHex(codeHash));
const gasPrice = '0';
const gasPrice = '500';
const gasLimit = '30000';
const restClient = new RestClient('http://127.0.0.1:20334');
const socketClient = new WebsocketClient('http://127.0.0.1:20335');


test('test_init', async () => {
const tx = Nep5TxBuilder.init(contractAddr, '0', gasLimit, account1.address);
const tx = Nep5TxBuilder.init(contractAddr, gasPrice, gasLimit, account1.address);
signTransaction(tx, private1);
const response = await socketClient.sendRawTransaction(tx.serialize(), false, true);
// tslint:disable:no-console
Expand Down
2 changes: 1 addition & 1 deletion test/restClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('test restClient', () => {
* Registers new ONT ID to create transaction with Events and new block
*/
beforeAll(async () => {
const tx = buildRegisterOntidTx(ontid, publicKey, '0', '30000');
const tx = buildRegisterOntidTx(ontid, publicKey, '500', '30000');
tx.payer = account.address;
signTransaction(tx, privateKey);

Expand Down
2 changes: 1 addition & 1 deletion test/rpcClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('test rpc client', () => {
* Registers new ONT ID to create transaction with Events and new block
*/
beforeAll(async () => {
const tx = buildRegisterOntidTx(ontid, publicKey, '0', '30000');
const tx = buildRegisterOntidTx(ontid, publicKey, '500', '30000');
tx.payer = account.address;
signTransaction(tx, privateKey);

Expand Down
8 changes: 4 additions & 4 deletions test/transfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import { signTransaction, signTx } from './../src/transaction/transactionBuilder
describe('test transfer asset', () => {
const socketClient = new WebsocketClient('ws://polaris1.ont.io:20335');
const restClient = new RestClient('http://polaris1.ont.io:20334');
const gasLimit = '300000';
const gasPrice = '0';
const gasLimit = '20000';
const gasPrice = '500';
const adminPrivateKey = new PrivateKey('7c47df9664e7db85c1308c080f398400cb24283f5d922e76b478b5429e821b97');
const adminAddress = new Address('AdLUBSSHUuFaak9j169hiamXUmPuCTnaRz');

Expand All @@ -62,8 +62,8 @@ describe('test transfer asset', () => {
};
test('test transfer asset', async () => {
const from = adminAddress;
const to = new Address('ARswehu2w1jMZU5qhckTdoZV9jogUzXfZX');
const tx = makeTransferTx('ONG', from, to, 2*1e9, gasPrice, gasLimit);
const to = new Address('AH9B261xeBXdKH4jPyafcHcLkS2EKETbUj');
const tx = makeTransferTx('ONG', from, to, 0.1 * 1e9, gasPrice, gasLimit);
signTransaction(tx, adminPrivateKey);
const response = await socketClient.sendRawTransaction(tx.serialize(), false, true);
// tslint:disable:no-console
Expand Down
8 changes: 7 additions & 1 deletion test/tx.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { signTransaction, signTx } from './../src/transaction/transactionBuilder

describe('test ONT ID contract', () => {

const gasPrice = '0';
const gasPrice = '500';
const gasLimit = '30000';
const socketClient = new WebsocketClient('ws://polaris1.ont.io:20335');

Expand Down Expand Up @@ -85,23 +85,29 @@ describe('test ONT ID contract', () => {
const account2 = Account.create(pri2, '123456', '');
const pub2 = pri2.getPublicKey();
const ontid2 = 'did:ont:ALnvzTMkbanffAKzQwxJ3EGoBqYuR6WqcG';
console.log('address2: ' + account2.address.toBase58());

const pri3 = new PrivateKey('7c47df9664e7db85c1308c080f398400cb24283f5d922e76b478b5429e821b97');
const account3 = Account.create(pri3, '123456', '');
const pub3 = pri3.getPublicKey();
const ontid3 = Address.generateOntid(pub3);
console.log('pk3:' + pri3.getPublicKey().serializeHex());
console.log('address3: ' + account3.address.toBase58());


const pri4 = new PrivateKey('7c47df9664e7db85c1308c080f398400cb24283f5d922e76b478b5429e821b98');
const account4 = Account.create(pri4, '123456', '');
const pub4 = pri4.getPublicKey();
const ontid4 = Address.generateOntid(pub4);
console.log('pk4:' + pri4.getPublicKey().serializeHex());
console.log('address4: ' + account4.address.toBase58());


const pri5 = new PrivateKey('7c47df9664e7db85c1308c080f398400cb24283f5d922e76b478b5429e821b99');
const account5 = Account.create(pri5, '123456', '');
const pub5 = pri5.getPublicKey();
const ontid5 = Address.generateOntid(pub5);
console.log('address5: ' + account5.address.toBase58());

test('testRegisterOntid', async () => {

Expand Down

0 comments on commit c299333

Please sign in to comment.