Skip to content

Commit

Permalink
Merge branch 'master' into hotfix/print-all-errors
Browse files Browse the repository at this point in the history
# Conflicts:
#	dist/near-api-js.js
#	dist/near-api-js.min.js
#	lib/browser-index.js
#	lib/index.js
#	lib/providers/json-rpc-provider.js
#	lib/providers/provider.js
#	lib/utils/index.js
#	lib/utils/rpc_errors.js
#	lib/utils/serialize.js
  • Loading branch information
mikedotexe committed Jun 22, 2020
2 parents 462c455 + b9b2c06 commit f571e5b
Show file tree
Hide file tree
Showing 21 changed files with 690 additions and 398 deletions.
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. MacOS]
- Version [e.g. 22]


**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'enchancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
9 changes: 5 additions & 4 deletions lib/account.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 2 additions & 13 deletions lib/browser-index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions lib/common-index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions lib/common-index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 2 additions & 14 deletions lib/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/key_stores/unencrypted_file_system_keystore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions lib/providers/json-rpc-provider.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 48 additions & 2 deletions lib/providers/provider.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "near-api-js",
"description": "JavaScript library to interact with NEAR Protocol via RPC API",
"version": "0.25.1",
"version": "0.26.0",
"repository": {
"type": "git",
"url": "git+https://github.com/near/near-api-js.git"
Expand All @@ -14,6 +14,7 @@
"@types/bn.js": "^4.11.5",
"bn.js": "^5.0.0",
"bs58": "^4.0.0",
"depd": "^2.0.0",
"error-polyfill": "^0.1.2",
"http-errors": "^1.7.2",
"js-sha256": "^0.9.0",
Expand Down Expand Up @@ -46,7 +47,7 @@
"collectCoverage": true
},
"keywords": [],
"license": "MIT",
"license": "(MIT AND Apache-2.0)",
"scripts": {
"dist": "yarn browserify && yarn doc",
"browserify": "browserify browser-exports.js -i node-fetch -i http -i https -o dist/near-api-js.js && browserify browser-exports.js -i node-fetch -g uglifyify -o dist/near-api-js.min.js",
Expand Down
11 changes: 6 additions & 5 deletions src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import { ServerError } from './generated/rpc_error_types';
// Default amount of gas to be sent with the function calls. Used to pay for the fees
// incurred while running the contract execution. The unused amount will be refunded back to
// the originator.
// Default value is set to equal to max_prepaid_gas as discussed here:
// https://github.com/near/near-api-js/pull/191#discussion_r369671912
const DEFAULT_FUNC_CALL_GAS = new BN('10000000000000000');
// Due to protocol changes that charge upfront for the maximum possible gas price inflation due to
// full blocks, the price of max_prepaid_gas is decreased to `300 * 10**12`.
// For discussion see https://github.com/nearprotocol/NEPs/issues/67
const DEFAULT_FUNC_CALL_GAS = new BN('300000000000000');

// Default number of retries before giving up on a transactioin.
// Default number of retries before giving up on a transaction.
const TX_STATUS_RETRY_NUMBER = 10;

// Default wait until next retry in millis.
Expand Down Expand Up @@ -365,7 +366,7 @@ export class Account {
async getAccountBalance(): Promise<AccountBalance> {
const genesisConfig = await this.connection.provider.experimental_genesisConfig();
const state = await this.state();

const costPerByte = new BN(genesisConfig.runtime_config.storage_amount_per_byte);
const stateStaked = new BN(state.storage_usage).mul(costPerByte);
const staked = new BN(state.locked);
Expand Down
39 changes: 2 additions & 37 deletions src/browser-index.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,2 @@
'use strict';

import * as providers from './providers';
import * as utils from './utils';
import * as keyStores from './key_stores/browser-index';
import * as transactions from './transaction';

import { Account } from './account';
import * as accountCreator from './account_creator';
import { Connection } from './connection';
import { Signer, InMemorySigner } from './signer';
import { Contract } from './contract';
import { KeyPair } from './utils/key_pair';
import { connect } from './near';

// TODO: Deprecate and remove WalletAccount
import { WalletAccount, WalletConnection } from './wallet-account';

export {
accountCreator,
keyStores,
providers,
utils,
transactions,

Account,
Connection,
Contract,
InMemorySigner,
Signer,
KeyPair,

connect,

WalletAccount,
WalletConnection
};
export * as keyStores from './key_stores/browser-index';
export * from './common-index';
Loading

0 comments on commit f571e5b

Please sign in to comment.