Socket
Socket
Sign inDemoInstall

near-api-js

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

near-api-js - npm Package Compare versions

Comparing version 0.27.0 to 0.28.0-preview

0

.github/ISSUE_TEMPLATE/bug_report.md

@@ -0,0 +0,0 @@ ---

require('error-polyfill');
window.nearApi = require('./lib/browser-index');
window.Buffer = Buffer;

@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct

@@ -0,0 +0,0 @@ # Contributing to NEAR

@@ -0,0 +0,0 @@ const https = require('https');

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BN from 'bn.js';

4

lib/account.js

@@ -86,2 +86,3 @@ 'use strict';

if (!error.message.match(/Transaction \w+ doesn't exist/)) {
error.context = new providers_1.ErrorContext(serialize_1.base_encode(txHash));
throw error;

@@ -98,3 +99,3 @@ }

}
throw new providers_1.TypedError(`Exceeded ${TX_STATUS_RETRY_NUMBER} status check attempts for transaction ${serialize_1.base_encode(txHash)}.`, 'RetriesExceeded');
throw new providers_1.TypedError(`Exceeded ${TX_STATUS_RETRY_NUMBER} status check attempts for transaction ${serialize_1.base_encode(txHash)}.`, 'RetriesExceeded', new providers_1.ErrorContext(serialize_1.base_encode(txHash)));
}

@@ -124,2 +125,3 @@ /**

else {
error.context = new providers_1.ErrorContext(serialize_1.base_encode(txHash));
throw error;

@@ -126,0 +128,0 @@ }

export * as keyStores from './key_stores/browser-index';
export * from './common-index';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import * as providers from './providers';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Provider } from './providers';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Account } from './account';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare namespace schema {

@@ -0,0 +0,0 @@ import { TypedError } from '../utils/errors';

@@ -0,0 +0,0 @@ "use strict";

export * as keyStores from './key_stores/index';
export * from './common-index';

@@ -0,0 +0,0 @@ "use strict";

@@ -9,3 +9,3 @@ import { KeyStore } from './keystore';

* Sets a local storage item
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -17,3 +17,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -25,3 +25,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -41,3 +41,3 @@ */

* Gets the account(s) from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -48,3 +48,3 @@ */

* Helper function to retrieve a local storage key
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the storage keythat's sought

@@ -51,0 +51,0 @@ * @returns {string} An example might be: `near-api-js:keystore:near-friend:default`

@@ -15,3 +15,3 @@ "use strict";

* Sets a local storage item
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -25,3 +25,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -39,3 +39,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -72,3 +72,3 @@ */

* Gets the account(s) from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -90,3 +90,3 @@ */

* Helper function to retrieve a local storage key
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the storage keythat's sought

@@ -93,0 +93,0 @@ * @returns {string} An example might be: `near-api-js:keystore:near-friend:default`

@@ -0,0 +0,0 @@ import { KeyStore } from './keystore';

@@ -0,0 +0,0 @@ "use strict";

@@ -11,3 +11,3 @@ import { KeyStore } from './keystore';

* Sets an in-memory storage item
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -19,3 +19,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -27,3 +27,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -43,3 +43,3 @@ */

* Gets the account(s) from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -46,0 +46,0 @@ */

@@ -16,3 +16,3 @@ "use strict";

* Sets an in-memory storage item
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -26,3 +26,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -40,3 +40,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -67,3 +67,3 @@ */

* Gets the account(s) from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -70,0 +70,0 @@ */

@@ -0,0 +0,0 @@ import { KeyStore } from './keystore';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { KeyPair } from '../utils/key_pair';

@@ -0,0 +0,0 @@ "use strict";

@@ -14,3 +14,3 @@ import { KeyStore } from './keystore';

* Sets a storage item to the first index of a key store array
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -22,3 +22,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -30,3 +30,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -46,3 +46,3 @@ */

* Gets the account(s) from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -49,0 +49,0 @@ */

@@ -18,3 +18,3 @@ "use strict";

* Sets a storage item to the first index of a key store array
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -24,7 +24,7 @@ * @param keyPair The key pair to store in local storage

async setKey(networkId, accountId, keyPair) {
this.keyStores[0].setKey(networkId, accountId, keyPair);
await this.keyStores[0].setKey(networkId, accountId, keyPair);
}
/**
* Gets a key from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -44,3 +44,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -50,3 +50,3 @@ */

for (const keyStore of this.keyStores) {
keyStore.removeKey(networkId, accountId);
await keyStore.removeKey(networkId, accountId);
}

@@ -59,3 +59,3 @@ }

for (const keyStore of this.keyStores) {
keyStore.clear();
await keyStore.clear();
}

@@ -78,3 +78,3 @@ }

* Gets the account(s) from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -81,0 +81,0 @@ */

@@ -10,3 +10,3 @@ import { KeyPair } from '../utils/key_pair';

* Sets a storage item in a file, unencrypted
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -18,3 +18,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -26,3 +26,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -43,3 +43,3 @@ */

* Gets the account(s) from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -46,0 +46,0 @@ */

@@ -57,3 +57,3 @@ "use strict";

* Sets a storage item in a file, unencrypted
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -69,3 +69,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -84,3 +84,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -120,3 +120,3 @@ */

* Gets the account(s) from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -123,0 +123,0 @@ */

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -0,0 +0,0 @@ "use strict";

import { Provider, FinalExecutionOutcome, ExecutionOutcomeWithId, getTransactionLastResult, FinalExecutionStatusBasic } from './provider';
import { JsonRpcProvider, TypedError } from './json-rpc-provider';
export { Provider, FinalExecutionOutcome, JsonRpcProvider, ExecutionOutcomeWithId, FinalExecutionStatusBasic, getTransactionLastResult, TypedError };
import { JsonRpcProvider, TypedError, ErrorContext } from './json-rpc-provider';
export { Provider, FinalExecutionOutcome, JsonRpcProvider, ExecutionOutcomeWithId, FinalExecutionStatusBasic, getTransactionLastResult, TypedError, ErrorContext };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypedError = exports.getTransactionLastResult = exports.FinalExecutionStatusBasic = exports.JsonRpcProvider = exports.Provider = void 0;
exports.ErrorContext = exports.TypedError = exports.getTransactionLastResult = exports.FinalExecutionStatusBasic = exports.JsonRpcProvider = exports.Provider = void 0;
const provider_1 = require("./provider");

@@ -11,1 +11,2 @@ Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return provider_1.Provider; } });

Object.defineProperty(exports, "TypedError", { enumerable: true, get: function () { return json_rpc_provider_1.TypedError; } });
Object.defineProperty(exports, "ErrorContext", { enumerable: true, get: function () { return json_rpc_provider_1.ErrorContext; } });
import { Provider, FinalExecutionOutcome, NodeStatusResult, BlockId, Finality, BlockResult, ChunkId, ChunkResult, EpochValidatorInfo, GenesisConfig, LightClientProof, LightClientProofRequest } from './provider';
import { Network } from '../utils/network';
import { ConnectionInfo } from '../utils/web';
import { TypedError } from '../utils/errors';
import { TypedError, ErrorContext } from '../utils/errors';
import { SignedTransaction } from '../transaction';
export { TypedError };
export { TypedError, ErrorContext };
export declare class JsonRpcProvider extends Provider {

@@ -8,0 +8,0 @@ readonly connection: ConnectionInfo;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonRpcProvider = exports.TypedError = void 0;
exports.JsonRpcProvider = exports.ErrorContext = exports.TypedError = void 0;
const depd_1 = __importDefault(require("depd"));

@@ -13,2 +13,3 @@ const provider_1 = require("./provider");

Object.defineProperty(exports, "TypedError", { enumerable: true, get: function () { return errors_1.TypedError; } });
Object.defineProperty(exports, "ErrorContext", { enumerable: true, get: function () { return errors_1.ErrorContext; } });
const serialize_1 = require("../utils/serialize");

@@ -15,0 +16,0 @@ const rpc_errors_1 = require("../utils/rpc_errors");

@@ -0,0 +0,0 @@ import { Network } from '../utils/network';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare const GasLimitExceeded: string;

@@ -45,3 +45,3 @@ {

"AccessKeyNotFound": "Signer \"{{account_id}}\" doesn't have access key with the given public_key {{public_key}}",
"NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {} for operation costing {}",
"NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {{balance}} for operation costing {{cost}}",
"NotEnoughAllowance": "Access Key {account_id}:{public_key} does not have enough balance {{allowance}} for transaction costing {{cost}}",

@@ -62,4 +62,4 @@ "Expired": "Transaction has expired",

"MethodNameMismatch": "Transaction method name {{method_name}} isn't allowed by the access key",
"DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover the rent",
"DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover it's storage",
"DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover the rent",
"DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover it's storage",
"InvalidReceiver": "Invalid receiver account ID {{receiver_id}} according to requirements",

@@ -66,0 +66,0 @@ "DeleteKeyDoesNotExist": "Account {{account_id}} tries to remove an access key that doesn't exist",

@@ -14,3 +14,3 @@ import { Signature, PublicKey } from './utils/key_pair';

* @param accountId accountId to retrieve from.
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
*/

@@ -22,3 +22,3 @@ abstract getPublicKey(accountId?: string, networkId?: string): Promise<PublicKey>;

* @param accountId accountId to use for signing.
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
*/

@@ -36,3 +36,3 @@ abstract signMessage(message: Uint8Array, accountId?: string, networkId?: string): Promise<Signature>;

* @param accountId The NEAR account to assign a public key to
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<PublicKey>}

@@ -44,3 +44,3 @@ */

* @param accountId The NEAR account to assign a public key to
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<PublicKey>} Returns the public key or null if not found

@@ -52,3 +52,3 @@ */

* @param accountId the NEAR account signing the message
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<Signature>}

@@ -55,0 +55,0 @@ */

@@ -26,3 +26,3 @@ "use strict";

* @param accountId The NEAR account to assign a public key to
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<PublicKey>}

@@ -38,3 +38,3 @@ */

* @param accountId The NEAR account to assign a public key to
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<PublicKey>} Returns the public key or null if not found

@@ -52,3 +52,3 @@ */

* @param accountId the NEAR account signing the message
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<Signature>}

@@ -55,0 +55,0 @@ */

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -190,3 +190,3 @@ "use strict";

* @param accountId The human-readable NEAR account name
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
*/

@@ -193,0 +193,0 @@ async function signTransactionObject(transaction, signer, accountId, networkId) {

@@ -0,0 +0,0 @@ export declare abstract class Enum {

@@ -0,0 +0,0 @@ "use strict";

@@ -9,3 +9,8 @@ export declare class PositionalArgsError extends Error {

type: string;
constructor(message?: string, type?: string);
context?: ErrorContext;
constructor(message?: string, type?: string, context?: ErrorContext);
}
export declare class ErrorContext {
transactionHash?: string;
constructor(transactionHash?: string);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypedError = exports.ArgumentTypeError = exports.PositionalArgsError = void 0;
exports.ErrorContext = exports.TypedError = exports.ArgumentTypeError = exports.PositionalArgsError = void 0;
class PositionalArgsError extends Error {

@@ -17,7 +17,14 @@ constructor() {

class TypedError extends Error {
constructor(message, type) {
constructor(message, type, context) {
super(message);
this.type = type || 'UntypedError';
this.context = context;
}
}
exports.TypedError = TypedError;
class ErrorContext {
constructor(transactionHash) {
this.transactionHash = transactionHash;
}
}
exports.ErrorContext = ErrorContext;

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import * as key_pair from './key_pair';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Assignable } from './enums';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface Network {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,0 +0,0 @@ import { ServerError } from '../generated/rpc_error_types';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface ConnectionInfo {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ import { Account } from './account';

@@ -0,0 +0,0 @@ "use strict";

{
"name": "near-api-js",
"description": "JavaScript library to interact with NEAR Protocol via RPC API",
"version": "0.27.0",
"version": "0.28.0-preview",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

@@ -0,0 +0,0 @@ # near-api-js

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -6,3 +6,3 @@ 'use strict';

addKey, functionCall, fullAccessKey, functionCallAccessKey, deleteKey, stake, AccessKey, deleteAccount } from './transaction';
import { FinalExecutionOutcome, TypedError } from './providers';
import { FinalExecutionOutcome, TypedError, ErrorContext } from './providers';
import { Connection } from './connection';

@@ -122,2 +122,3 @@ import {base_decode, base_encode} from './utils/serialize';

if (!error.message.match(/Transaction \w+ doesn't exist/)) {
error.context = new ErrorContext(base_encode(txHash));
throw error;

@@ -134,3 +135,6 @@ }

}
throw new TypedError(`Exceeded ${TX_STATUS_RETRY_NUMBER} status check attempts for transaction ${base_encode(txHash)}.`, 'RetriesExceeded');
throw new TypedError(
`Exceeded ${TX_STATUS_RETRY_NUMBER} status check attempts for transaction ${base_encode(txHash)}.`,
'RetriesExceeded',
new ErrorContext(base_encode(txHash)));
}

@@ -165,2 +169,3 @@

} else {
error.context = new ErrorContext(base_encode(txHash));
throw error;

@@ -167,0 +172,0 @@ }

@@ -0,0 +0,0 @@ import { Provider, JsonRpcProvider } from './providers';

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -0,0 +0,0 @@ import { TypedError } from '../utils/errors';

@@ -18,3 +18,3 @@ import { KeyStore } from './keystore';

* Sets a local storage item
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -29,3 +29,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -44,3 +44,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -80,3 +80,3 @@ */

* Gets the account(s) from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -99,3 +99,3 @@ */

* Helper function to retrieve a local storage key
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the storage keythat's sought

@@ -102,0 +102,0 @@ * @returns {string} An example might be: `near-api-js:keystore:near-friend:default`

@@ -17,3 +17,3 @@ import { KeyStore } from './keystore';

* Sets an in-memory storage item
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -28,3 +28,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -43,3 +43,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -73,3 +73,3 @@ */

* Gets the account(s) from in-memory storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -76,0 +76,0 @@ */

@@ -0,0 +0,0 @@

@@ -0,0 +0,0 @@ import { KeyPair } from '../utils/key_pair';

@@ -20,3 +20,3 @@ import { KeyStore } from './keystore';

* Sets a storage item to the first index of a key store array
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -26,3 +26,3 @@ * @param keyPair The key pair to store in local storage

async setKey(networkId: string, accountId: string, keyPair: KeyPair): Promise<void> {
this.keyStores[0].setKey(networkId, accountId, keyPair);
await this.keyStores[0].setKey(networkId, accountId, keyPair);
}

@@ -32,3 +32,3 @@

* Gets a key from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -49,3 +49,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -55,3 +55,3 @@ */

for (const keyStore of this.keyStores) {
keyStore.removeKey(networkId, accountId);
await keyStore.removeKey(networkId, accountId);
}

@@ -65,3 +65,3 @@ }

for (const keyStore of this.keyStores) {
keyStore.clear();
await keyStore.clear();
}

@@ -86,3 +86,3 @@ }

* Gets the account(s) from the array of key stores
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -89,0 +89,0 @@ */

@@ -65,3 +65,3 @@ import fs from 'fs';

* Sets a storage item in a file, unencrypted
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -78,3 +78,3 @@ * @param keyPair The key pair to store in local storage

* Gets a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -94,3 +94,3 @@ * @returns {Promise<KeyPair>}

* Removes a key from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @param accountId The NEAR account tied to the key pair

@@ -134,3 +134,3 @@ */

* Gets the account(s) from local storage
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns{Promise<string[]>}

@@ -137,0 +137,0 @@ */

import { Provider, FinalExecutionOutcome, ExecutionOutcomeWithId, getTransactionLastResult, FinalExecutionStatusBasic } from './provider';
import { JsonRpcProvider, TypedError } from './json-rpc-provider';
import { JsonRpcProvider, TypedError, ErrorContext } from './json-rpc-provider';

@@ -12,3 +12,4 @@ export {

getTransactionLastResult,
TypedError
TypedError,
ErrorContext
};

@@ -9,3 +9,3 @@ import depd from 'depd';

import { ConnectionInfo, fetchJson } from '../utils/web';
import { TypedError } from '../utils/errors';
import { TypedError, ErrorContext } from '../utils/errors';
import { base_encode } from '../utils/serialize';

@@ -15,3 +15,3 @@ import { parseRpcError } from '../utils/rpc_errors';

export { TypedError };
export { TypedError, ErrorContext };

@@ -18,0 +18,0 @@ /// Keep ids unique across all connections.

@@ -45,3 +45,3 @@ {

"AccessKeyNotFound": "Signer \"{{account_id}}\" doesn't have access key with the given public_key {{public_key}}",
"NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {} for operation costing {}",
"NotEnoughBalance": "Sender {{signer_id}} does not have enough balance {{balance}} for operation costing {{cost}}",
"NotEnoughAllowance": "Access Key {account_id}:{public_key} does not have enough balance {{allowance}} for transaction costing {{cost}}",

@@ -62,4 +62,4 @@ "Expired": "Transaction has expired",

"MethodNameMismatch": "Transaction method name {{method_name}} isn't allowed by the access key",
"DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover the rent",
"DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {balance{}}, which is enough to cover it's storage",
"DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover the rent",
"DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {{balance}}, which is enough to cover it's storage",
"InvalidReceiver": "Invalid receiver account ID {{receiver_id}} according to requirements",

@@ -66,0 +66,0 @@ "DeleteKeyDoesNotExist": "Account {{account_id}} tries to remove an access key that doesn't exist",

@@ -18,3 +18,3 @@ import sha256 from 'js-sha256';

* @param accountId accountId to retrieve from.
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
*/

@@ -27,3 +27,3 @@ abstract async getPublicKey(accountId?: string, networkId?: string): Promise<PublicKey>;

* @param accountId accountId to use for signing.
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
*/

@@ -47,3 +47,3 @@ abstract async signMessage(message: Uint8Array, accountId?: string, networkId?: string): Promise<Signature>;

* @param accountId The NEAR account to assign a public key to
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<PublicKey>}

@@ -60,3 +60,3 @@ */

* @param accountId The NEAR account to assign a public key to
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<PublicKey>} Returns the public key or null if not found

@@ -75,3 +75,3 @@ */

* @param accountId the NEAR account signing the message
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
* @returns {Promise<Signature>}

@@ -78,0 +78,0 @@ */

@@ -210,3 +210,3 @@ import sha256 from 'js-sha256';

* @param accountId The human-readable NEAR account name
* @param networkId The targeted network. (ex. default, devnet, betanet, etc…)
* @param networkId The targeted network. (ex. default, betanet, etc…)
*/

@@ -213,0 +213,0 @@ async function signTransactionObject(transaction: Transaction, signer: Signer, accountId?: string, networkId?: string): Promise<[Uint8Array, SignedTransaction]> {

@@ -0,0 +0,0 @@ export abstract class Enum {

@@ -15,6 +15,15 @@ export class PositionalArgsError extends Error {

type: string;
constructor(message?: string, type?: string) {
context?: ErrorContext;
constructor(message?: string, type?: string, context?: ErrorContext) {
super(message);
this.type = type || 'UntypedError';
this.context = context;
}
}
export class ErrorContext {
transactionHash?: string;
constructor(transactionHash?: string) {
this.transactionHash = transactionHash;
}
}

@@ -0,0 +0,0 @@ import BN from 'bn.js';

@@ -0,0 +0,0 @@

@@ -0,0 +0,0 @@ import nacl from 'tweetnacl';

@@ -0,0 +0,0 @@ export interface Network {

@@ -0,0 +0,0 @@

@@ -0,0 +0,0 @@ import bs58 from 'bs58';

@@ -0,0 +0,0 @@ import createError from 'http-errors';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ import { Account } from './account';

@@ -23,3 +23,3 @@ const nearApi = require('../lib/index');

const keyPair = nearApi.utils.KeyPair.fromRandom('ed25519');
await workingAccount.addKey(keyPair.getPublicKey(), contractId, '', '100000000000000000000');
await workingAccount.addKey(keyPair.getPublicKey(), contractId, '', '2000000000000000000000000');

@@ -26,0 +26,0 @@ // Override in the key store the workingAccount key to the given access key.

@@ -20,9 +20,2 @@ module.exports = function getConfig(env) {

};
case 'devnet':
return {
networkId: 'devnet',
nodeUrl: 'https://rpc.devnet.near.org',
walletUrl: 'https://wallet.devnet.near.org',
helperUrl: 'https://helper.devnet.near.org',
};
case 'betanet':

@@ -29,0 +22,0 @@ return {

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ const nearApi = require('../../lib/index');

@@ -0,0 +0,0 @@ const nearApi = require('../../lib/index');

@@ -0,0 +0,0 @@ const nearApi = require('../../lib/index');

@@ -0,0 +0,0 @@ const nearApi = require('../../lib/index');

@@ -0,0 +0,0 @@ // Unit tests for simple util code

@@ -0,0 +0,0 @@ const nearApi = require('../../lib/index');

@@ -0,0 +0,0 @@

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc