Skip to content

Latest commit

 

History

History
1341 lines (943 loc) · 70.6 KB

File metadata and controls

1341 lines (943 loc) · 70.6 KB

near-api-js

7.2.0

Minor Changes

  • #1877 eb345df Thanks @mikedotexe! - Replace Buffer usage with Uint8Array and Web Standard APIs (TextEncoder/TextDecoder, @scure/base) for CommonJS compatibility

  • #1872 dd086d4 Thanks @gagdiez! - Added a signer that knows how to use the legacy keystore

  • #1877 eb345df Thanks @mikedotexe! - Replace secp256k1 native crypto dependency with @noble/curves/secp256k1, adapting to the v2 API (prehash option, signature byte ordering)

Patch Changes

7.1.1

Patch Changes

7.1.0

Minor Changes

7.0.4

Patch Changes

7.0.3

Patch Changes

7.0.2

Patch Changes

7.0.1

Patch Changes

  • #1822 8493b36 Thanks @denbite! - Explicitly declare the return type of Account.signAndSendTransaction so it doesn't fallback to any

  • #1819 e6f4db2 Thanks @gagdiez! - Correctly expose the new Actions interface, which simplify creating actions, and hide the old Action class, which needs a lot of manual work and is incredibly confusing. Importantly, Action (and its different instances) are still being exported as a type, to devs can figure out how to distinguis between different Actions.

  • #1818 a82e47f Thanks @denbite! - Attach finalized blockHash to transaction created using Account.createTransaction to prevent TransactionExpiredError errors.

    Previously, transactions could be created with a blockHash that had not yet fully propagated across the network. In some cases, receiver RPC nodes were unable to look up the referenced block, resulting in TransactionExpiredError failures (often due to a small propagation delay of a few milliseconds).

7.0.0

Major Changes

  • #1691 f8666a0 Thanks @r-near! - Update parseNearAmount to only accept either a numeric string, or actual number, and not undefined, as well as throw error rather than silently return null

  • #1691 f8666a0 Thanks @r-near! - Rename stable viewValidatorsV2 function back to viewValidators

  • #1809 eee87c2 Thanks @gagdiez! - Consolidate functionality of the @near-js/* packages into a single, tree-shakeable near-api-js package

  • #1805 9356419 Thanks @denbite! - Remove no longer needed error utils like getErrorTypeFromErrorMessage, parseRpcError, parseResultError, etc from the package as errors are now handled internally thanks to strongly typed RPC errors and end users can simply catch them in their application using specific error classes imported from rpc-errors sub-path

  • #1781 1caddf4 Thanks @denbite! - Replace TypedError class with a few specific errors created from fully type-safe RPC interfaces

  • #1808 bf7c148 Thanks @denbite! - Rename TypedContract back to Contract

  • #1669 683e1db Thanks @denbite! - Remove no longer maintained packages @near-js/iframe-rpc, @near-js/biometric-ed25519 and @near-js/client with @near-js/cookbook examples

  • #1670 54e4d48 Thanks @denbite! - Remove no longer maintained packages @near-js/keystores, @near-js/keystores-node and @near-js/keystores-browser

  • #1673 5d86344 Thanks @denbite! - Consolidate @near-js/* packages into a single near-api-js codebase

  • #1795 b96c604 Thanks @denbite! - Renovate Provider.query by removing the deprecated inline-argument overload and fully aligning the method with the nearcore RPC API spec.

    Previously supported (no longer works):

    provider.query("view_account", JSON.stringify({ ... }));

    New required usage (fully typed):

    provider.query({
      request_type: "view_account",
      ...
    });

    Once request_type is specified, remaining parameters are inferred automatically by the IDE.

  • #1668 20672fb Thanks @denbite! - Remove deprecated functionality

  • #1813 858783c Thanks @gagdiez! - Renamed actionCreator helper object to simply "actions", and separated the helper addKey into addFullAccessKey and addFunctionCallKey

  • #1589 5cfdab8 Thanks @AlexKushnir1! - Refactor the abstract class Signer to implement every method, except for getPublicKey and signBytes, which are intended for users

Minor Changes

  • #1790 2f7a30d Thanks @denbite! - Introduce many specific errors based on generated response types from OpenAPI spec and which are thrown when calling Provider.sendJsonRpc method

  • #1798 a52592b Thanks @gagdiez! - Added a new multi-key signer which handles multiples keys and transparently rotates them as users ask to sign transactions

  • #1751 85f279e Thanks @denbite! - Add nep413 module that implements signMessage and verifyMessage functions

  • #1748 917ccea Thanks @denbite! - Make Account to take KeyPairString as third parameter

  • #1761 9d8799b Thanks @denbite! - Introduce teraToGas and gigaToGas helper functions to convert Gas amounts conviniently

  • #1761 fcbb1fe Thanks @denbite! - Introduce yoctoToNear and nearToYocto helper functions

  • #1796 c2601e2 Thanks @denbite! - Add a new Provider.viewGlobalContractCode method for retrieving global contract code using either a codeHash, or an accountId identifier.

    Example usage:

    provider.viewGlobalContractCode({
      identifier: { accountId: "global_contract.near" },
    });
    provider.viewGlobalContractCode({
      identifier: { codeHash: "J1arLz48fgXcGyCPVckFwLnewNH6j1uw79thsvwqGYTY" },
    });
  • #1799 a7c3cd9 Thanks @denbite! - Add parseSeedPhrase method, exported via the seed-phrase sub-path, which converts a string seed phrase into a KeyPair.

    For example:

    import { parseSeedPhrase } from "near-api-js/seed-phrase";
    
    const keyPair = parseSeedPhrase("tag interest match ...");
    
    keyPair.getPublicKey().toString(); // ed25519:9uMmkWHW...
    keyPair.toString(); // ed25519:3N6TYZVRrkQxh...
  • #1747 493d9e5 Thanks @denbite! - Add sub-path exports for "tokens", "tokens/mainnet" and "tokens/testnet" to improve tree-shaking

  • #1794 7b6ff4f Thanks @denbite! - Extend the Account constructor to accept an RPC URL string in addition to a Provider, making account instantiation simpler and more ergonomic.

    New supported usage:

    new Account("user.near", "https://rpc.testnet.near.org");

    Previously, users had to always manually create a provider:

    const provider = new JsonRpcProvider({ url: "https://rpc.testnet.near.org" });
    new Account("user.near", provider);
  • #1803 9f3e14d Thanks @denbite! - Export strongly typed RPC error classes behind the rpc-errors sub-path, for end users to reliably handle specific RPC failures.

    For example, end users can now catch action-level errors (e.g. when a transaction fails because the recipient account does not exist):

    import { AccountDoesNotExistActionError } from "near-api-js/rpc-errors";
    
    try {
      await account.transfer({
        amount: nearToYocto(0.01),
        receiverId: "unexisted_account_111.testnet",
      });
    } catch (error) {
      if (error instanceof AccountDoesNotExistActionError) {
        console.error(
          `Transaction ${error.txHash} failed because recipient ${error.accountId} does not exist!`
        );
      }
    }

    Or, RPC request validation and parsing errors can also be handled explicitly (e.g. when an invalid account ID format is included in a transaction):

    import { RpcRequestParseError } from "near-api-js/rpc-errors";
    
    try {
      await account.transfer({
        amount: nearToYocto(0.001),
        receiverId: "account_name_that_fail_validation%.testnet",
      });
    } catch (error) {
      if (error instanceof RpcRequestParseError) {
        // Failed parsing args: the value could not be decoded from borsh due to:
        // invalid value: "account_name_that_fail_validation%.testnet",
        // the Account ID contains an invalid character '%' at index 33
        console.error(error.message);
      }
    }

    Or, some requests may reference data that is no longer available or cannot be resolved by the node (e.g. querying a block that cannot be found):

    import { UnknownBlockError } from "near-api-js/rpc-errors";
    
    const unexistedBlockHeight = 1_000_000_000_000_000;
    
    try {
      await provider.viewBlock({ blockId: unexistedBlockHeight });
    } catch (error) {
      if (error instanceof UnknownBlockError) {
        console.error(
          `Block at height ${unexistedBlockHeight} could not be found on the node!`
        );
      }
    }

    All exported errors ultimately extend the RpcError base class, so applications can also catch and handle any RPC-related error in a single place when fine-grained handling is not required:

    import { RpcError } from "near-api-js/rpc-errors";
    
    try {
      await provider.viewAccessKey({
        accountId: "user.testnet",
        publicKey: "ed25519:EaQnZxCMwh9yhkqW2XE2umd21iNmXep1BkM6Wtw2Qr1b",
      });
    } catch (error) {
      if (error instanceof RpcError) {
        // Access key ed25519:EaQnZx... does not exist at block height ...
        console.error(error.message);
      }
    }
    
    try {
      await provider.viewAccessKey({
        accountId: "user.testnet",
        publicKey: "ed25519:EaQnZxCMwh9yhkqW2XE2umd21iNmXep1BkM6Wtw2Qr1bxxxx", // invalid key here
      });
    } catch (error) {
      if (error instanceof RpcError) {
        // Failed parsing args: invalid key length: expected the input of 32 bytes, but 33 was given
        console.error(error.message);
      }
    }
  • #1754 b3b2947 Thanks @gagdiez! - Added optional signer argument to signing functions on account class

  • #1793 ddceeab Thanks @denbite! - Add concurrent transactions support by introducing nonce caching and automatic retries on InvalidNonceError.

    The following example that previously failed due to nonce collisions, now works reliably:

    await Promise.all([
      account.transfer({
        amount: nearToYocto(1),
        receiverId: "user1.testnet",
      }),
      account.transfer({
        amount: nearToYocto(2),
        receiverId: "user2.testnet",
      }),
      account.transfer({
        amount: nearToYocto(3),
        receiverId: "user3.testnet",
      }),
    ]);

Patch Changes

7.0.0-rc.7

Major Changes

7.0.0-rc.6

Patch Changes

7.0.0-rc.5

Major Changes

  • #1805 9356419 Thanks @denbite! - Remove no longer needed error utils like getErrorTypeFromErrorMessage, parseRpcError, parseResultError, etc from the package as errors are now handled internally thanks to strongly typed RPC errors and end users can simply catch them in their application using specific error classes imported from rpc-errors sub-path

Minor Changes

  • #1803 9f3e14d Thanks @denbite! - Export strongly typed RPC error classes behind the rpc-errors sub-path, for end users to reliably handle specific RPC failures.

    For example, end users can now catch action-level errors (e.g. when a transaction fails because the recipient account does not exist):

    import { AccountDoesNotExistActionError } from "near-api-js/rpc-errors";
    
    try {
      await account.transfer({
        amount: nearToYocto(0.01),
        receiverId: "unexisted_account_111.testnet",
      });
    } catch (error) {
      if (error instanceof AccountDoesNotExistActionError) {
        console.error(
          `Transaction ${error.txHash} failed because recipient ${error.accountId} does not exist!`
        );
      }
    }

    Or, RPC request validation and parsing errors can also be handled explicitly (e.g. when an invalid account ID format is included in a transaction):

    import { RpcRequestParseError } from "near-api-js/rpc-errors";
    
    try {
      await account.transfer({
        amount: nearToYocto(0.001),
        receiverId: "account_name_that_fail_validation%.testnet",
      });
    } catch (error) {
      if (error instanceof RpcRequestParseError) {
        // Failed parsing args: the value could not be decoded from borsh due to:
        // invalid value: "account_name_that_fail_validation%.testnet",
        // the Account ID contains an invalid character '%' at index 33
        console.error(error.message);
      }
    }

    Or, some requests may reference data that is no longer available or cannot be resolved by the node (e.g. querying a block that cannot be found):

    import { UnknownBlockError } from "near-api-js/rpc-errors";
    
    const unexistedBlockHeight = 1_000_000_000_000_000;
    
    try {
      await provider.viewBlock({ blockId: unexistedBlockHeight });
    } catch (error) {
      if (error instanceof UnknownBlockError) {
        console.error(
          `Block at height ${unexistedBlockHeight} could not be found on the node!`
        );
      }
    }

    All exported errors ultimately extend the RpcError base class, so applications can also catch and handle any RPC-related error in a single place when fine-grained handling is not required:

    import { RpcError } from "near-api-js/rpc-errors";
    
    try {
      await provider.viewAccessKey({
        accountId: "user.testnet",
        publicKey: "ed25519:EaQnZxCMwh9yhkqW2XE2umd21iNmXep1BkM6Wtw2Qr1b",
      });
    } catch (error) {
      if (error instanceof RpcError) {
        // Access key ed25519:EaQnZx... does not exist at block height ...
        console.error(error.message);
      }
    }
    
    try {
      await provider.viewAccessKey({
        accountId: "user.testnet",
        publicKey: "ed25519:EaQnZxCMwh9yhkqW2XE2umd21iNmXep1BkM6Wtw2Qr1bxxxx", // invalid key here
      });
    } catch (error) {
      if (error instanceof RpcError) {
        // Failed parsing args: invalid key length: expected the input of 32 bytes, but 33 was given
        console.error(error.message);
      }
    }

7.0.0-rc.4

Patch Changes

7.0.0-rc.3

Minor Changes

  • #1799 a7c3cd9 Thanks @denbite! - Add parseSeedPhrase method, exported via the seed-phrase sub-path, which converts a string seed phrase into a KeyPair.

    For example:

    import { parseSeedPhrase } from "near-api-js/seed-phrase";
    
    const keyPair = parseSeedPhrase("tag interest match ...");
    
    keyPair.getPublicKey().toString(); // ed25519:9uMmkWHW...
    keyPair.toString(); // ed25519:3N6TYZVRrkQxh...

7.0.0-rc.2

Major Changes

  • #1781 1caddf4 Thanks @denbite! - Replace TypedError class with a few specific errors created from fully type-safe RPC interfaces

  • #1795 b96c604 Thanks @denbite! - Renovate Provider.query by removing the deprecated inline-argument overload and fully aligning the method with the nearcore RPC API spec.

    Previously supported (no longer works):

    provider.query("view_account", JSON.stringify({ ... }));

    New required usage (fully typed):

    provider.query({
      request_type: "view_account",
      ...
    });

    Once request_type is specified, remaining parameters are inferred automatically by the IDE.

Minor Changes

  • #1790 2f7a30d Thanks @denbite! - Introduce many specific errors based on generated response types from OpenAPI spec and which are thrown when calling Provider.sendJsonRpc method

  • #1798 a52592b Thanks @gagdiez! - Added a new multi-key signer which handles multiples keys and transparently rotates them as users ask to sign transactions

  • #1796 c2601e2 Thanks @denbite! - Add a new Provider.viewGlobalContractCode method for retrieving global contract code using either a codeHash, or an accountId identifier.

    Example usage:

    provider.viewGlobalContractCode({
      identifier: { accountId: "global_contract.near" },
    });
    provider.viewGlobalContractCode({
      identifier: { codeHash: "J1arLz48fgXcGyCPVckFwLnewNH6j1uw79thsvwqGYTY" },
    });
  • #1794 7b6ff4f Thanks @denbite! - Extend the Account constructor to accept an RPC URL string in addition to a Provider, making account instantiation simpler and more ergonomic.

    New supported usage:

    new Account("user.near", "https://rpc.testnet.near.org");

    Previously, users had to always manually create a provider:

    const provider = new JsonRpcProvider({ url: "https://rpc.testnet.near.org" });
    new Account("user.near", provider);
  • #1793 ddceeab Thanks @denbite! - Add concurrent transactions support by introducing nonce caching and automatic retries on InvalidNonceError.

    The following example that previously failed due to nonce collisions, now works reliably:

    await Promise.all([
      account.transfer({
        amount: nearToYocto(1),
        receiverId: "user1.testnet",
      }),
      account.transfer({
        amount: nearToYocto(2),
        receiverId: "user2.testnet",
      }),
      account.transfer({
        amount: nearToYocto(3),
        receiverId: "user3.testnet",
      }),
    ]);

Patch Changes

  • #1774 741671b Thanks @denbite! - Extend Provider interfaces using types generated from nearcore OpenAPI spec

7.0.0-rc.1

Minor Changes

  • #1761 9d8799b Thanks @denbite! - Introduce teraToGas and gigaToGas helper functions to convert Gas amounts conviniently

  • #1761 fcbb1fe Thanks @denbite! - Introduce yoctoToNear and nearToYocto helper functions

Patch Changes

7.0.0-rc.0

Major Changes

  • #1691 f8666a0 Thanks @r-near! - Update parseNearAmount to only accept either a numeric string, or actual number, and not undefined, as well as throw error rather than silently return null

  • #1691 f8666a0 Thanks @r-near! - Rename stable viewValidatorsV2 function back to viewValidators

  • #1672 eee87c2 Thanks @github-actions! - Consolidate functionality of the @near-js/* packages into a single, tree-shakeable near-api-js package

  • #1669 683e1db Thanks @denbite! - Remove no longer maintained packages @near-js/iframe-rpc, @near-js/biometric-ed25519 and @near-js/client with @near-js/cookbook examples

  • #1670 54e4d48 Thanks @denbite! - Remove no longer maintained packages @near-js/keystores, @near-js/keystores-node and @near-js/keystores-browser

  • #1673 5d86344 Thanks @denbite! - Consolidate @near-js/* packages into a single near-api-js codebase

  • #1668 20672fb Thanks @denbite! - Remove deprecated functionality

  • #1589 5cfdab8 Thanks @AlexKushnir1! - Refactor the abstract class Signer to implement every method, except for getPublicKey and signBytes, which are intended for users

Minor Changes

  • #1751 85f279e Thanks @denbite! - Add nep413 module that implements signMessage and verifyMessage functions

  • #1748 917ccea Thanks @denbite! - Make Account to take KeyPairString as third parameter

  • #1747 493d9e5 Thanks @denbite! - Add sub-path exports for "tokens", "tokens/mainnet" and "tokens/testnet" to improve tree-shaking

  • #1754 b3b2947 Thanks @gagdiez! - Added optional signer argument to signing functions on account class

Patch Changes

6.5.1

Patch Changes

  • #1662 aad9fd6 Thanks @denbite! - Add duplicate of keyToImplicitAddress to @near-js/crypto to prevent cycle dependency between packages

  • #1663 8e9a81b Thanks @denbite! - Remove a redundant assert call in @near-js/providers

  • #1661 5375dcc Thanks @denbite! - Add @near-js/keystores as dependency to @near-js/accounts, not as dev-dep

  • Updated dependencies [aad9fd6, 8e9a81b, 5375dcc]:

    • @near-js/crypto@2.5.1
    • @near-js/utils@2.5.1
    • @near-js/providers@2.5.1
    • @near-js/accounts@2.5.1
    • @near-js/keystores@2.5.1
    • @near-js/keystores-browser@2.5.1
    • @near-js/keystores-node@2.5.1
    • @near-js/signers@2.5.1
    • @near-js/transactions@2.5.1
    • @near-js/types@2.5.1

6.5.0

Minor Changes

  • #1659 d4d33b9 Thanks @denbite! - Add viewValidatorsV2 method to Provider that allows to query data using either epoch_id, or block_id

Patch Changes

  • Updated dependencies [d4d33b9]:
    • @near-js/providers@2.5.0
    • @near-js/accounts@2.5.0
    • @near-js/crypto@2.5.0
    • @near-js/keystores@2.5.0
    • @near-js/keystores-browser@2.5.0
    • @near-js/keystores-node@2.5.0
    • @near-js/signers@2.5.0
    • @near-js/transactions@2.5.0
    • @near-js/types@2.5.0
    • @near-js/utils@2.5.0

6.4.1

Patch Changes

  • #1654 e10be3d Thanks @denbite! - Bring back InMemorySigner to maintain backward compatibility for legacy projects

  • #1652 18a696b Thanks @denbite! - Extend input type for formatNearAmount function

  • Updated dependencies [e10be3d, fdb29a2, 18a696b]:

    • @near-js/accounts@2.4.1
    • @near-js/signers@2.4.1
    • @near-js/crypto@2.4.1
    • @near-js/utils@2.4.1
    • @near-js/keystores@2.4.1
    • @near-js/keystores-browser@2.4.1
    • @near-js/keystores-node@2.4.1
    • @near-js/providers@2.4.1
    • @near-js/transactions@2.4.1
    • @near-js/types@2.4.1

6.4.0

Minor Changes

  • #1648 dc7f602 Thanks @denbite! - Allow Uint8Array as args input for callFunctionRaw and callFunction

Patch Changes

  • Updated dependencies [dc7f602]:
    • @near-js/providers@2.4.0
    • @near-js/accounts@2.4.0
    • @near-js/crypto@2.4.0
    • @near-js/keystores@2.4.0
    • @near-js/keystores-browser@2.4.0
    • @near-js/keystores-node@2.4.0
    • @near-js/signers@2.4.0
    • @near-js/transactions@2.4.0
    • @near-js/types@2.4.0
    • @near-js/utils@2.4.0

6.3.1

Patch Changes

  • #1640 706a5dd Thanks @denbite! - Respect null as a valid result of method of FailoverRpcProvider

  • Updated dependencies [706a5dd]:

    • @near-js/providers@2.3.4
    • @near-js/accounts@2.3.4
    • @near-js/crypto@2.3.4
    • @near-js/keystores@2.3.4
    • @near-js/keystores-browser@2.3.4
    • @near-js/keystores-node@2.3.4
    • @near-js/signers@2.3.4
    • @near-js/transactions@2.3.4
    • @near-js/types@2.3.4
    • @near-js/utils@2.3.4

6.3.0

Minor Changes

Patch Changes

  • #1621 0a99da4 Thanks @denbite! - Add deprecation annotations and warnings to functions/classes that will be removed in the next major release

  • Updated dependencies [0bef0bd, 0a99da4]:

    • @near-js/accounts@2.3.0
    • @near-js/types@2.3.0
    • @near-js/utils@2.3.0
    • @near-js/crypto@2.3.0
    • @near-js/keystores@2.3.0
    • @near-js/keystores-browser@2.3.0
    • @near-js/keystores-node@2.3.0
    • @near-js/providers@2.3.0
    • @near-js/signers@2.3.0
    • @near-js/transactions@2.3.0

6.2.6

Patch Changes

  • #1620 0ce235d Thanks @denbite! - Use optimistic finality as default one for RPC queries made from Account

  • Updated dependencies [0ce235d]:

    • @near-js/accounts@2.2.6
    • @near-js/crypto@2.2.6
    • @near-js/keystores@2.2.6
    • @near-js/keystores-browser@2.2.6
    • @near-js/keystores-node@2.2.6
    • @near-js/providers@2.2.6
    • @near-js/signers@2.2.6
    • @near-js/transactions@2.2.6
    • @near-js/types@2.2.6
    • @near-js/utils@2.2.6

6.2.5

Patch Changes

  • #1613 b78f334 Thanks @denbite! - Provide default value {} for headers as connection.headers could be undefined in some cases

  • #1613 e8a01e9 Thanks @denbite! - Update interfaces of JsonRpcProvider and FailoverRpcProvider to be aligned with Provider

  • #1613 d399fe5 Thanks @denbite! - Make parameter type of function Provider.gasPrice nullable (to be aligned with actual implemention in JsonRpcProvider)

  • Updated dependencies [b78f334, e8a01e9, d399fe5]:

    • @near-js/providers@2.2.5
    • @near-js/accounts@2.2.5
    • @near-js/crypto@2.2.5
    • @near-js/keystores@2.2.5
    • @near-js/keystores-browser@2.2.5
    • @near-js/keystores-node@2.2.5
    • @near-js/signers@2.2.5
    • @near-js/transactions@2.2.5
    • @near-js/types@2.2.5
    • @near-js/utils@2.2.5

6.2.4

Patch Changes

  • #1611 30403a7 Thanks @denbite! - Add signedDelegate to ClassicActions schema to align the indices of deployGlobalContract and useGlobalContract actions

  • Updated dependencies [30403a7]:

    • @near-js/transactions@2.2.4
    • @near-js/accounts@2.2.4
    • @near-js/crypto@2.2.4
    • @near-js/keystores@2.2.4
    • @near-js/keystores-browser@2.2.4
    • @near-js/keystores-node@2.2.4
    • @near-js/providers@2.2.4
    • @near-js/signers@2.2.4
    • @near-js/types@2.2.4
    • @near-js/utils@2.2.4

6.2.3

Patch Changes

  • #1604 edcadb6 Thanks @denbite! - Added generic type for Provider.callFunction to allow client explicitly specify expected return type

  • #1604 4f89a24 Thanks @denbite! - Added generic type for Account.callFunction to allow client explicitly specify expected return type

  • Updated dependencies [edcadb6, 4f89a24]:

    • @near-js/providers@2.2.3
    • @near-js/accounts@2.2.3
    • @near-js/crypto@2.2.3
    • @near-js/keystores@2.2.3
    • @near-js/keystores-browser@2.2.3
    • @near-js/keystores-node@2.2.3
    • @near-js/signers@2.2.3
    • @near-js/transactions@2.2.3
    • @near-js/types@2.2.3
    • @near-js/utils@2.2.3

6.2.2

Patch Changes

  • #1602 3cd7545 Thanks @Elabar! - Fix meta transaction is not signing correctly

  • Updated dependencies [3cd7545]:

    • @near-js/signers@2.2.2
    • @near-js/accounts@2.2.2
    • @near-js/crypto@2.2.2
    • @near-js/keystores@2.2.2
    • @near-js/keystores-browser@2.2.2
    • @near-js/keystores-node@2.2.2
    • @near-js/providers@2.2.2
    • @near-js/transactions@2.2.2
    • @near-js/types@2.2.2
    • @near-js/utils@2.2.2

6.2.1

Patch Changes

6.2.0

Minor Changes

  • #1595 55667eb Thanks @denbite! - Add Account.callFunctionRaw method that returns raw transaction outcome

Patch Changes

  • #1591 bfc969a Thanks @denbite! - Migrate to building with tsup for near-api-js

  • Updated dependencies [e368604, 55667eb]:

    • @near-js/accounts@2.2.0
    • @near-js/crypto@2.2.0
    • @near-js/keystores@2.2.0
    • @near-js/keystores-browser@2.2.0
    • @near-js/keystores-node@2.2.0
    • @near-js/providers@2.2.0
    • @near-js/signers@2.2.0
    • @near-js/transactions@2.2.0
    • @near-js/types@2.2.0
    • @near-js/utils@2.2.0

6.1.0

Minor Changes

Patch Changes

  • Updated dependencies [46e5d4e, fec4678, ff2f6ea, c511649, 99f3486, 34df601, af571dc]:
    • @near-js/accounts@2.1.0
    • @near-js/keystores-browser@2.1.0
    • @near-js/keystores-node@2.1.0
    • @near-js/transactions@2.1.0
    • @near-js/keystores@2.1.0
    • @near-js/providers@2.1.0
    • @near-js/signers@2.1.0
    • @near-js/crypto@2.1.0
    • @near-js/types@2.1.0
    • @near-js/utils@2.1.0

6.0.2

Patch Changes

  • #1556 4971e77 Thanks @denbite! - Rename createTopLevelAccount back to createAccount for the sake of better naming

  • #1560 3349d4b Thanks @denbite! - Fix the bug with ft_balance_of always returning undefined for FungibleToken

  • Updated dependencies [4971e77, 59d3dc9]:

    • @near-js/accounts@2.0.2
    • @near-js/crypto@2.0.2
    • @near-js/keystores-browser@2.0.2
    • @near-js/keystores-node@2.0.2
    • @near-js/keystores@2.0.2
    • @near-js/providers@2.0.2
    • @near-js/signers@2.0.2
    • @near-js/transactions@2.0.2
    • @near-js/types@2.0.2
    • @near-js/utils@2.0.2

6.0.1

Patch Changes

  • #1554 13f93eb Thanks @denbite! - Redeploy recent release as patch

  • Updated dependencies [13f93eb]:

    • @near-js/accounts@2.0.1
    • @near-js/crypto@2.0.1
    • @near-js/keystores@2.0.1
    • @near-js/keystores-browser@2.0.1
    • @near-js/keystores-node@2.0.1
    • @near-js/providers@2.0.1
    • @near-js/signers@2.0.1
    • @near-js/transactions@2.0.1
    • @near-js/types@2.0.1
    • @near-js/utils@2.0.1

6.0.0

Major Changes

Packages are now truly independent and can be imported separately. We strongly encourage users to use the modularized packages instead of the monolithic near-api-js package.

  • Account has received major changes to its interface, we recommend reading the CHANGELOG for the @near-js/accounts package

  • Signer class has received major changes to its interface, we recommend reading the CHANGELOG for the @near-js/signers package

  • Connection has been deprecated, as it is no longer used by the Account class

  • A new package @near-js/tokens has been added, which allows to work with tokens on the NEAR blockchain. This includes the Native NEAR, Fungible Tokens and Non-Fungible Tokens.

  • #1513 a8e1046 Thanks @denbite! - Major update for Signer and Account APIs to streamline development

Patch Changes

  • Updated dependencies [a8e1046]:
    • @near-js/transactions@2.0.0
    • @near-js/providers@2.0.0
    • @near-js/accounts@2.0.0
    • @near-js/signers@2.0.0
    • @near-js/types@2.0.0
    • @near-js/crypto@2.0.0
    • @near-js/keystores@2.0.0
    • @near-js/keystores-browser@2.0.0
    • @near-js/keystores-node@2.0.0
    • @near-js/utils@2.0.0

5.1.1

Patch Changes

  • Updated dependencies [e408cfc, 9cb5f56]:
    • @near-js/providers@1.0.3
    • @near-js/transactions@1.3.3
    • @near-js/accounts@1.4.1
    • @near-js/wallet-account@1.3.3

5.1.0

Minor Changes

Patch Changes

  • Updated dependencies [ef530cf6, c85d12d3]:
    • @near-js/accounts@1.4.0
    • @near-js/providers@1.0.2
    • @near-js/utils@1.1.0
    • @near-js/wallet-account@1.3.2
    • @near-js/crypto@1.4.2
    • @near-js/transactions@1.3.2
    • @near-js/keystores@0.2.2
    • @near-js/keystores-browser@0.2.2
    • @near-js/keystores-node@0.1.2
    • @near-js/signers@0.2.2

5.0.1

Patch Changes

  • Updated dependencies [5b0bbbc1]:
    • @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/accounts@1.3.1
    • @near-js/keystores@0.2.1
    • @near-js/keystores-browser@0.2.1
    • @near-js/keystores-node@0.1.1
    • @near-js/signers@0.2.1
    • @near-js/transactions@1.3.1
    • @near-js/wallet-account@1.3.1

5.0.0

Major Changes

  • #1353 73690557 Thanks @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]:
    • @near-js/accounts@1.3.0
    • @near-js/crypto@1.4.0
    • @near-js/keystores@0.2.0
    • @near-js/keystores-browser@0.2.0
    • @near-js/keystores-node@0.1.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
    • @near-js/wallet-account@1.3.0

4.0.4

Patch Changes

  • #1355 7d5a8244 Thanks @gtsonevv! - Add Secp256k1 support

  • Updated dependencies [9c7db11c, bad95007, 7d5a8244]:

    • @near-js/keystores@0.1.0
    • @near-js/keystores-browser@0.1.0
    • @near-js/utils@0.3.0
    • @near-js/crypto@1.3.0
    • @near-js/accounts@1.2.2
    • @near-js/signers@0.1.5
    • @near-js/transactions@1.2.3
    • @near-js/wallet-account@1.2.3
    • @near-js/keystores-node@0.0.13
    • @near-js/providers@0.2.3

4.0.3

Patch Changes

4.0.2

Patch Changes

  • Updated dependencies [ecdf1741, 92a6f5be]:
    • @near-js/providers@0.2.2
    • @near-js/types@0.2.1
    • @near-js/accounts@1.2.1
    • @near-js/wallet-account@1.2.2
    • @near-js/crypto@1.2.4
    • @near-js/keystores@0.0.12
    • @near-js/transactions@1.2.2
    • @near-js/utils@0.2.2
    • @near-js/keystores-browser@0.0.12
    • @near-js/keystores-node@0.0.12
    • @near-js/signers@0.1.4

4.0.1

Patch Changes

  • Updated dependencies [06baa81d]:
    • @near-js/accounts@1.2.0
    • @near-js/types@0.2.0
    • @near-js/wallet-account@1.2.1
    • @near-js/crypto@1.2.3
    • @near-js/keystores@0.0.11
    • @near-js/providers@0.2.1
    • @near-js/transactions@1.2.1
    • @near-js/utils@0.2.1
    • @near-js/keystores-browser@0.0.11
    • @near-js/keystores-node@0.0.11
    • @near-js/signers@0.1.3

4.0.0

Major Changes

Patch Changes

  • #1292 f739324b Thanks @gtsonevv! - replace ajv with is-my-json-valid

  • Updated dependencies [9060b781, cc401a6c, 3f363113, f739324b]:

    • @near-js/accounts@1.1.0
    • @near-js/transactions@1.2.0
    • @near-js/types@0.1.0
    • @near-js/utils@0.2.0
    • @near-js/crypto@1.2.2
    • @near-js/providers@0.2.0
    • @near-js/wallet-account@1.2.0
    • @near-js/keystores@0.0.10
    • @near-js/keystores-browser@0.0.10
    • @near-js/keystores-node@0.0.10
    • @near-js/signers@0.1.2

3.0.4

Patch Changes

  • Updated dependencies [42dc7e2a]:
    • @near-js/transactions@1.1.2
    • @near-js/accounts@1.0.4
    • @near-js/providers@0.1.1
    • @near-js/wallet-account@1.1.1

3.0.3

Patch Changes

  • Updated dependencies [662cc13d, c4655576, 15885dd1]:
    • @near-js/providers@0.1.0
    • @near-js/utils@0.1.0
    • @near-js/crypto@1.2.1
    • @near-js/wallet-account@1.1.0
    • @near-js/accounts@1.0.3
    • @near-js/transactions@1.1.1
    • @near-js/keystores@0.0.9
    • @near-js/keystores-browser@0.0.9
    • @near-js/keystores-node@0.0.9
    • @near-js/signers@0.1.1

3.0.2

Patch Changes

  • Updated dependencies [1900c490, c6cdc8c7]:
    • @near-js/crypto@1.2.0
    • @near-js/signers@0.1.0
    • @near-js/transactions@1.1.0
    • @near-js/accounts@1.0.2
    • @near-js/keystores@0.0.8
    • @near-js/keystores-browser@0.0.8
    • @near-js/keystores-node@0.0.8
    • @near-js/wallet-account@1.0.2
    • @near-js/providers@0.0.10

3.0.1

Patch Changes

  • Updated dependencies [aeeb1502]:
    • @near-js/crypto@1.1.0
    • @near-js/accounts@1.0.1
    • @near-js/keystores@0.0.7
    • @near-js/keystores-browser@0.0.7
    • @near-js/keystores-node@0.0.7
    • @near-js/signers@0.0.7
    • @near-js/transactions@1.0.1
    • @near-js/wallet-account@1.0.1
    • @near-js/providers@0.0.9

3.0.0

Major Changes

Minor Changes

  • #1215 ecf29e2d Thanks @denbite! - Internal logging library with capabilities for integration with modern logging libraries like Pino, Winston, etc

Patch Changes

2.1.4

Patch Changes

  • Updated dependencies [40fa6465]:
    • @near-js/crypto@0.0.5
    • @near-js/accounts@0.1.4
    • @near-js/keystores@0.0.5
    • @near-js/keystores-browser@0.0.5
    • @near-js/keystores-node@0.0.5
    • @near-js/signers@0.0.5
    • @near-js/transactions@0.2.1
    • @near-js/wallet-account@0.0.7
    • @near-js/providers@0.0.7

2.1.3

Patch Changes

  • #1128 e21ff896 Thanks @andy-haynes! - Compatibility shim for NearSocial/VM

  • Updated dependencies [e21ff896, 00b4d2ba]:

    • @near-js/transactions@0.2.0
    • @near-js/accounts@0.1.3
    • @near-js/providers@0.0.6
    • @near-js/wallet-account@0.0.6

2.1.2

Patch Changes

  • #1124 c1dcf3b8 Thanks @andy-haynes! - Allow use of legacy deps.keyStore path in NearConfig

  • Updated dependencies [bf81ddc1, c1dcf3b8]:

    • @near-js/types@0.0.4
    • @near-js/wallet-account@0.0.5
    • @near-js/accounts@0.1.2
    • @near-js/crypto@0.0.4
    • @near-js/keystores@0.0.4
    • @near-js/providers@0.0.5
    • @near-js/transactions@0.1.1
    • @near-js/utils@0.0.4
    • @near-js/keystores-browser@0.0.4
    • @near-js/keystores-node@0.0.4
    • @near-js/signers@0.0.4

2.1.1

Patch Changes

  • Updated dependencies [d6d53ab1]:
    • @near-js/providers@0.0.4
    • @near-js/accounts@0.1.1
    • @near-js/wallet-account@0.0.4

2.1.0

Minor Changes

Patch Changes

  • #1106 bc53c32c Thanks @austinabell! - Adds missing timestamp_nanosec field to light client proof header

  • Updated dependencies [b713ae78, bc53c32c, b7b6c6a1, d97d2a6e, 4704ee77, 8c6bf391]:

    • @near-js/providers@0.0.3
    • @near-js/types@0.0.3
    • @near-js/accounts@0.1.0
    • @near-js/transactions@0.1.0
    • @near-js/crypto@0.0.3
    • @near-js/keystores@0.0.3
    • @near-js/utils@0.0.3
    • @near-js/wallet-account@0.0.3
    • @near-js/keystores-browser@0.0.3
    • @near-js/keystores-node@0.0.3
    • @near-js/signers@0.0.3

2.0.4

Patch Changes

2.0.3

Patch Changes

  • Updated dependencies [ca458cac]:
    • @near-js/accounts@0.0.2
    • @near-js/crypto@0.0.2
    • @near-js/keystores@0.0.2
    • @near-js/keystores-browser@0.0.2
    • @near-js/keystores-node@0.0.2
    • @near-js/providers@0.0.2
    • @near-js/signers@0.0.2
    • @near-js/transactions@0.0.2
    • @near-js/types@0.0.2
    • @near-js/utils@0.0.2
    • @near-js/wallet-account@0.0.2

2.0.2

Patch Changes

2.0.1

Patch Changes

2.0.0

Major Changes

  • #1006 8ee564c0 Thanks @morgsmccauley! - Make Account.signAndSendTransaction public so transactions can be sent directly from Account instances

  • #1014 8feb1997 Thanks @esaminu! - Make appKeyPrefix a required arg to WalletConnection constructor

    Users that were doing

    new WalletConnection(near);

    will now have to do

    new WalletConnection(near, "undefined");

    If they want to access the keys they had potentially accumulated

  • #935 c740afc8 Thanks @hcho112! - account.viewFunction now takes a single object argument rather than individual args. Callsites will now need to be updated like so:

    -await account.viewFunction(
    -  'wrap.near',
    -  'storage_balance_of',
    -  { account_id: 'example.near' }
    -);
    +await account.viewFunction({
    +  contractId: 'wrap.near',
    +  methodName: 'storage_balance_of',
    +  args: { account_id: 'example.near' },
    +});
  • #1056 b823ada7 Thanks @andy-haynes! - Major functionality in near-api-js has now been broken up into packages under @near-js

    Breaking changes:

    • KeyPairEd25519 no longer supports the fromString static method. This method is now only available on the KeyPair class.

Minor Changes

Patch Changes

  • #1003 726b7953 Thanks @marcinbodnar! - Fix error types. WIth this changes both JsonRpcProvider.query and JsonRpcProvider.sendJsonRpc methods will return proper error type for these errors: AccountDoesNotExist, AccessKeyDoesNotExist, CodeDoesNotExist, InvalidNonce.

    An additional fix to getErrorTypeFromErrorMessage function. Now getErrorTypeFromErrorMessage will not change error type if it already exists.

1.1.0

Minor Changes

Patch Changes