Comparing version 0.4.2 to 0.4.4
@@ -35,3 +35,2 @@ const bs58 = require('bs58'); | ||
newAccountId, | ||
amount, | ||
publicKey, | ||
@@ -44,2 +43,5 @@ }); | ||
} | ||
if (amount !== 0) { | ||
createAccount.amount = amount; | ||
} | ||
@@ -46,0 +48,0 @@ const buffer = CreateAccountTransaction.encode(createAccount).finish(); |
@@ -11,4 +11,4 @@ const createError = require('http-errors'); | ||
const MAX_STATUS_POLL_ATTEMPTS = 5; | ||
const STATUS_POLL_PERIOD_MS = 1000; | ||
const MAX_STATUS_POLL_ATTEMPTS = 10; | ||
const STATUS_POLL_PERIOD_MS = 2000; | ||
@@ -15,0 +15,0 @@ /** |
{ | ||
"name": "nearlib", | ||
"description": "Javascript library to interact with near blockchain", | ||
"version": "0.4.2", | ||
"version": "0.4.4", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -44,2 +44,23 @@ const { Account, KeyPair, Near, InMemoryKeyStore } = require('../'); | ||
test('test dev connect like template', async () => { | ||
window.localStorage = createFakeStorage(); | ||
// Mocking some | ||
let tmpCreate = dev.createAccountWithContractHelper; | ||
let devConfig = dev.getConfig; | ||
dev.getConfig = async () => "THE_CONFIG"; | ||
dev.createAccountWithContractHelper = async (nearConfig, newAccountId, publicKey) => { | ||
expect(nearConfig).toEqual("THE_CONFIG"); | ||
return await dev.createAccountWithLocalNodeConnection(newAccountId, publicKey); | ||
}; | ||
// Calling | ||
let near = await dev.connect(); | ||
// Restoring mocked functions | ||
dev.getConfig = devConfig; | ||
dev.createAccountWithContractHelper = tmpCreate; | ||
let accId = dev.myAccountId; | ||
let accjs = new Account(near.nearClient); | ||
const viewAccountResponse = await accjs.viewAccount(accId); | ||
expect(viewAccountResponse.account_id).toEqual(accId); | ||
}); | ||
test('test dev connect with no account creates a new account', async () => { | ||
@@ -107,3 +128,3 @@ await dev.connect(options); | ||
const newAccountPublicKey = '9AhWenZ3JddamBoyMqnTbp7yVbRuvqAv3zwfrWgfVRJE'; | ||
const createAccountResponse = await account.createAccount(newAccountName, newAccountPublicKey, 1, aliceAccountName); | ||
const createAccountResponse = await account.createAccount(newAccountName, newAccountPublicKey, 0, aliceAccountName); | ||
await nearjs.waitForTransactionResult(createAccountResponse); | ||
@@ -113,3 +134,3 @@ const expectedAccount = { | ||
account_id: newAccountName, | ||
amount: 1, | ||
amount: 0, | ||
code_hash: newAccountCodeHash, | ||
@@ -116,0 +137,0 @@ stake: 0, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
736851
26
15235