Skip to content

Commit

Permalink
Merge remote-tracking branch 'lime/master' into extend-wallet-account
Browse files Browse the repository at this point in the history
  • Loading branch information
gtsonevv committed Jan 14, 2025
2 parents 2baaba4 + c49fd67 commit 519c09d
Show file tree
Hide file tree
Showing 279 changed files with 7,929 additions and 7,674 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
extends:
- 'eslint:recommended'
parserOptions:
ecmaVersion: 2018
ecmaVersion: 2020
sourceType: module
rules:
indent:
Expand Down
8 changes: 0 additions & 8 deletions .eslintrc.js.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .eslintrc.ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ extends:
- 'plugin:@typescript-eslint/eslint-recommended'
- 'plugin:@typescript-eslint/recommended'
parser: '@typescript-eslint/parser'
overrides:
- rules:
"@typescript-eslint/no-explicit-any": "warn"
"@typescript-eslint/no-empty-function": "warn"
files:
- "*.ts"
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 7
version: 9.4.0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.15.0
cache: pnpm

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 7
version: 9.4.0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.15.0

- name: Install Dependencies
run: pnpm install
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/transfer-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Add to DevTools Project'

on:
issues:
types:
- opened
- reopened
pull_request:
types:
- opened
- reopened

jobs:
add-to-project:
name: Add issue/PR to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1.0.0
with:
# add to DevTools Project #156
project-url: https://github.com/orgs/near/projects/156
github-token: ${{ secrets.GH_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/typedoc-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
master

env:
NODE_VERSION: 18.x
NODE_VERSION: 20.15.0
ENTRY_FILE: 'packages'
CONFIG_PATH: 'tsconfig.base.json'
USES_PNPM: 'true'
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 7
version: 9.4.0

- name: Install dependencies
run: pnpm install
Expand Down
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ Tests use sample contract from `near-hello` npm package, see https://github.com/

Follow next steps:

1. [Change hash for the commit with errors in the nearcore](https://github.com/near/near-api-js/blob/master/fetch_error_schema.js#L8-L9)
1. [Optionally, set a specific hash for the commit with errors in the nearcore](https://github.com/near/near-api-js/blob/master/packages/utils/fetch_error_schema.js#L4-L5)
2. Fetch new schema: `node fetch_error_schema.js`
3. `pnpm build` to update `lib/**.js` files
3. `pnpm build` and `pnpm test` to check tests still work
4. `pnpm changeset` to generate a changeset with a minor bump for the @near-js/utils package
5. commit all changes and submit a PR on GitHub

## Packages

Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"name": "@near-js/monorepo",
"private": true,
"engines": {
"node": ">=16.14.0",
"pnpm": ">=7"
"node": ">=20.15.0",
"pnpm": ">=9.4.0"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "turbo run build",
"clean": "turbo run clean",
"lint": "turbo run lint:ts lint:js",
"lint:fix": "turbo run lint:ts:fix lint:js:fix",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"autoclave": "rimraf packages/**/dist && rimraf packages/**/lib && rimraf packages/**/node_modules && rimraf packages/**/coverage && rimraf packages/**/.turbo && rm -rf node_modules",
"test": "turbo run test",
"release": "changeset publish",
Expand All @@ -20,17 +20,18 @@
"devDependencies": {
"@changesets/changelog-github": "0.4.6",
"@changesets/cli": "2.24.4",
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"@typescript-eslint/eslint-plugin": "5.31.0",
"@typescript-eslint/parser": "5.31.0",
"commitlint": "17.0.3",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"commitlint": "19.3.0",
"eslint": "8.20.0",
"husky": "7.0.4",
"rimraf": "3.0.2",
"rimraf": "6.0.1",
"turbo": "1.4.5",
"typedoc": "0.25.3",
"typescript": "4.9.4"
"typedoc": "0.25.13",
"tsconfig": "workspace:*",
"typescript": "5.4.5"
},
"resolutions": {
"near-sandbox": "0.0.18",
Expand Down
60 changes: 60 additions & 0 deletions packages/accounts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# @near-js/accounts

## 1.3.1

### Patch Changes

- Updated dependencies [[`5b0bbbc1`](https://github.com/near/near-api-js/commit/5b0bbbc17ffe7d89d7767e405d2ca700dc2bba40)]:
- @near-js/crypto@1.4.1
- @near-js/providers@1.0.1
- @near-js/types@0.3.1
- @near-js/utils@1.0.1
- @near-js/signers@0.2.1
- @near-js/transactions@1.3.1

## 1.3.0

### Minor Changes

- [#1353](https://github.com/near/near-api-js/pull/1353) [`73690557`](https://github.com/near/near-api-js/commit/73690557c8e2a74386fca62f4ae123abe0651403) Thanks [@andy-haynes](https://github.com/andy-haynes)! - Update to Node.js 20 LTS & pnpm 9.4, modularize packages, simplify dependencies, and update tests

**Breaking Changes**

- `near-api-js@5.0.0`

- The following functions are no longer exported:
- `logWarning`
- `fetchJson`
- the unnamed wrapped `fetch` function exported from `setup-node-fetch.ts`
- The browser bundle is no longer being built in version 5; for browser support please use modules

- `@near-js/providers@1.0.0`

- The following functions are no longer exported:
- `fetchJson`

- `@near-js/utils@1.0.0`
- The following functions are no longer exported:
- `logWarning`

### Patch Changes

- Updated dependencies [[`73690557`](https://github.com/near/near-api-js/commit/73690557c8e2a74386fca62f4ae123abe0651403)]:
- @near-js/crypto@1.4.0
- @near-js/providers@1.0.0
- @near-js/signers@0.2.0
- @near-js/transactions@1.3.0
- @near-js/types@0.3.0
- @near-js/utils@1.0.0

## 1.2.2

### Patch Changes

- [#1355](https://github.com/near/near-api-js/pull/1355) [`7d5a8244`](https://github.com/near/near-api-js/commit/7d5a8244a1683d7b5e82c4da1e40d834167a9a41) Thanks [@gtsonevv](https://github.com/gtsonevv)! - Add Secp256k1 support

- Updated dependencies [[`bad95007`](https://github.com/near/near-api-js/commit/bad95007edde4ed9d5989ded7f2032b9f15f5c23), [`7d5a8244`](https://github.com/near/near-api-js/commit/7d5a8244a1683d7b5e82c4da1e40d834167a9a41)]:
- @near-js/utils@0.3.0
- @near-js/crypto@1.3.0
- @near-js/signers@0.1.5
- @near-js/transactions@1.2.3
- @near-js/providers@0.2.3

## 1.2.1

### Patch Changes
Expand Down
22 changes: 0 additions & 22 deletions packages/accounts/jest.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions packages/accounts/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
preset: 'ts-jest',
collectCoverage: true,
testEnvironment: 'node',
testRegex: "(/tests/.*|(\\.|/)(test|spec))\\.[jt]sx?$",
transform: {
'^.+\\.[tj]s$': ['ts-jest', {
tsconfig: {
allowJs: true,
},
}],
},
};
40 changes: 24 additions & 16 deletions packages/accounts/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@near-js/accounts",
"version": "1.2.1",
"version": "1.3.1",
"description": "Classes encapsulating account-specific functionality",
"main": "lib/index.js",
"main": "lib/esm/index.js",
"type": "module",
"scripts": {
"build": "pnpm compile",
"compile": "tsc -p tsconfig.json",
"lint:js": "eslint -c ../../.eslintrc.js.yml test/**/*.js --no-eslintrc",
"lint:js:fix": "eslint -c ../../.eslintrc.js.yml test/**/*.js --no-eslintrc --fix",
"lint:ts": "eslint -c ../../.eslintrc.ts.yml src/**/*.ts --no-eslintrc",
"lint:ts:fix": "eslint -c ../../.eslintrc.ts.yml src/**/*.ts --no-eslintrc --fix",
"test": "jest test"
"build": "pnpm compile:esm && pnpm compile:cjs",
"compile:esm": "tsc -p tsconfig.json",
"compile:cjs": "tsc -p tsconfig.cjs.json && cjsify ./lib/commonjs",
"lint": "eslint -c ../../.eslintrc.ts.yml src/**/*.ts test/**/*.ts --no-eslintrc",
"lint:fix": "eslint -c ../../.eslintrc.ts.yml src/**/*.ts test/**/*.ts --no-eslintrc --fix",
"test": "jest"
},
"keywords": [],
"author": "",
Expand All @@ -22,27 +22,35 @@
"@near-js/transactions": "workspace:*",
"@near-js/types": "workspace:*",
"@near-js/utils": "workspace:*",
"@noble/hashes": "1.3.3",
"borsh": "1.0.0",
"depd": "2.0.0",
"is-my-json-valid": "^2.20.6",
"isomorphic-unfetch": "^3.1.0",
"lru_map": "0.4.1",
"near-abi": "0.1.1"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@near-js/keystores": "workspace:*",
"@types/node": "18.11.18",
"@types/json-schema": "^7.0.15",
"@types/node": "20.0.0",
"bs58": "4.0.0",
"jest": "26.0.1",
"build": "workspace:*",
"jest": "29.7.0",
"near-hello": "0.5.1",
"near-workspaces": "3.5.0",
"ts-jest": "26.5.6",
"typescript": "4.9.4"
"node-fetch": "2.6.7",
"semver": "7.1.1",
"ts-jest": "29.1.5",
"tsconfig": "workspace:*",
"typescript": "5.4.5"
},
"files": [
"lib"
],
"resolutions": {
"near-sandbox": "0.0.18",
"near-api-js": "4.0.0"
"exports": {
"require": "./lib/commonjs/index.cjs",
"import": "./lib/esm/index.js"
}
}
8 changes: 4 additions & 4 deletions packages/accounts/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class Account implements IntoConnection {
const block = await this.connection.provider.block({ finality: 'final' });
const blockHash = block.header.hash;

const nonce = accessKey.nonce + BigInt(1);
const nonce = accessKey.nonce + 1n;
return await signTransaction(
receiverId, nonce, actions, baseDecode(blockHash), this.connection.signer, this.accountId, this.connection.networkId
);
Expand Down Expand Up @@ -533,7 +533,7 @@ export class Account implements IntoConnection {
const delegateAction = buildDelegateAction({
actions,
maxBlockHeight: BigInt(header.height) + BigInt(blockHeightTtl),
nonce: BigInt(accessKey.nonce) + BigInt(1),
nonce: BigInt(accessKey.nonce) + 1n,
publicKey,
receiverId,
senderId: this.accountId,
Expand Down Expand Up @@ -699,7 +699,7 @@ export class Account implements IntoConnection {
const validatorId = uniquePools[index];
if (state.status === 'fulfilled') {
const currentBN = BigInt(state.value);
if (currentBN !== BigInt(0)) {
if (currentBN !== 0n) {
return {
...result,
stakedValidators: [...result.stakedValidators, { validatorId, amount: currentBN.toString() }],
Expand All @@ -715,7 +715,7 @@ export class Account implements IntoConnection {
}
return result;
},
{ stakedValidators: [], failedValidators: [], total: BigInt(0) });
{ stakedValidators: [], failedValidators: [], total: 0n });

return {
...summary,
Expand Down
Loading

0 comments on commit 519c09d

Please sign in to comment.