near-api-js 6.2.5 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser-connect.d.ts +3 -23
- package/lib/browser-connect.js +13 -0
- package/lib/connect.d.ts +2 -1
- package/lib/connect.js +1 -1
- package/lib/contract.d.ts +1 -1
- package/lib/contract.js +7 -2
- package/lib/near.d.ts +3 -0
- package/lib/near.js +13 -0
- package/package.json +11 -11
package/lib/browser-connect.d.ts
CHANGED
|
@@ -6,34 +6,14 @@ import '@near-js/signers';
|
|
|
6
6
|
import '@near-js/utils';
|
|
7
7
|
import '@near-js/providers';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Connect to NEAR using the provided configuration.
|
|
11
|
-
*
|
|
12
|
-
* {@link ConnectConfig#networkId} and {@link ConnectConfig#nodeUrl} are required.
|
|
13
|
-
*
|
|
14
|
-
* To sign transactions you can also pass: {@link ConnectConfig#keyStore}
|
|
15
|
-
*
|
|
16
|
-
* Both are passed they are prioritize in that order.
|
|
17
|
-
*
|
|
18
|
-
* @see {@link ConnectConfig}
|
|
19
|
-
* @example
|
|
20
|
-
* ```js
|
|
21
|
-
* async function initNear() {
|
|
22
|
-
* const near = await connect({
|
|
23
|
-
* networkId: 'testnet',
|
|
24
|
-
* nodeUrl: 'https://rpc.testnet.near.org'
|
|
25
|
-
* })
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @module browserConnect
|
|
30
|
-
*/
|
|
31
|
-
|
|
9
|
+
/** @deprecated Will be removed in the next major release */
|
|
32
10
|
interface ConnectConfig extends NearConfig {
|
|
33
11
|
/** @hidden */
|
|
34
12
|
keyPath?: string;
|
|
35
13
|
}
|
|
36
14
|
/**
|
|
15
|
+
* @deprecated Will be removed in the next major release
|
|
16
|
+
*
|
|
37
17
|
* Initialize connection to Near network.
|
|
38
18
|
*/
|
|
39
19
|
declare function connect(config: ConnectConfig): Promise<Near>;
|
package/lib/browser-connect.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,14 +17,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var browser_connect_exports = {};
|
|
20
30
|
__export(browser_connect_exports, {
|
|
21
31
|
connect: () => connect
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(browser_connect_exports);
|
|
34
|
+
var import_depd = __toESM(require("depd"));
|
|
24
35
|
var import_near = require('./near.js');
|
|
25
36
|
async function connect(config) {
|
|
37
|
+
const deprecate = (0, import_depd.default)("connect(config)");
|
|
38
|
+
deprecate(`It will be removed in the next major release, please switch to using Account directly`);
|
|
26
39
|
return new import_near.Near(config);
|
|
27
40
|
}
|
|
28
41
|
// Annotate the CommonJS export names for ESM import in node:
|
package/lib/connect.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import '@near-js/signers';
|
|
|
6
6
|
import '@near-js/utils';
|
|
7
7
|
import '@near-js/providers';
|
|
8
8
|
|
|
9
|
+
/** @deprecated Will be removed in the next major release */
|
|
9
10
|
interface ConnectConfig extends NearConfig {
|
|
10
11
|
/**
|
|
11
12
|
* Initialize an {@link InMemoryKeyStore} by reading the file at keyPath.
|
|
@@ -13,7 +14,7 @@ interface ConnectConfig extends NearConfig {
|
|
|
13
14
|
keyPath?: string;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
|
-
* @deprecated
|
|
17
|
+
* @deprecated Will be removed in the next major release
|
|
17
18
|
*
|
|
18
19
|
* Initialize connection to Near network.
|
|
19
20
|
* @param config The configuration object for connecting to NEAR Protocol.
|
package/lib/connect.js
CHANGED
|
@@ -38,7 +38,7 @@ var import_utils = require("@near-js/utils");
|
|
|
38
38
|
var import_depd = __toESM(require("depd"));
|
|
39
39
|
async function connect(config) {
|
|
40
40
|
const deprecate = (0, import_depd.default)("connect(config)");
|
|
41
|
-
deprecate(
|
|
41
|
+
deprecate(`It will be removed in the next major release, please switch to using Account directly`);
|
|
42
42
|
if (config.logger === false) {
|
|
43
43
|
import_utils.Logger.overrideLogger(void 0);
|
|
44
44
|
} else if (config.logger !== void 0 && config.logger !== null) {
|
package/lib/contract.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Contract, ContractMethods } from '@near-js/accounts';
|
|
1
|
+
export { AbiRoot, Contract, ContractMethods, TypedContract } from '@near-js/accounts';
|
package/lib/contract.js
CHANGED
|
@@ -18,13 +18,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var contract_exports = {};
|
|
20
20
|
__export(contract_exports, {
|
|
21
|
+
AbiRoot: () => import_accounts2.AbiRoot,
|
|
21
22
|
Contract: () => import_accounts.Contract,
|
|
22
|
-
ContractMethods: () => import_accounts.ContractMethods
|
|
23
|
+
ContractMethods: () => import_accounts.ContractMethods,
|
|
24
|
+
TypedContract: () => import_accounts2.TypedContract
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(contract_exports);
|
|
25
27
|
var import_accounts = require("@near-js/accounts");
|
|
28
|
+
var import_accounts2 = require("@near-js/accounts");
|
|
26
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
27
30
|
0 && (module.exports = {
|
|
31
|
+
AbiRoot,
|
|
28
32
|
Contract,
|
|
29
|
-
ContractMethods
|
|
33
|
+
ContractMethods,
|
|
34
|
+
TypedContract
|
|
30
35
|
});
|
package/lib/near.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { Provider } from '@near-js/providers';
|
|
|
15
15
|
* @module near
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
/** @deprecated Will be removed in the next major release */
|
|
18
19
|
interface NearConfig {
|
|
19
20
|
/** Holds {@link "@near-js/crypto".key_pair.KeyPair | KeyPair} for signing transactions */
|
|
20
21
|
keyStore?: KeyStore;
|
|
@@ -75,6 +76,8 @@ interface NearConfig {
|
|
|
75
76
|
provider?: Provider;
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
79
|
+
* @deprecated Will be removed in the next major release
|
|
80
|
+
*
|
|
78
81
|
* This is the main class developers should use to interact with NEAR.
|
|
79
82
|
* @example
|
|
80
83
|
* ```js
|
package/lib/near.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var near_exports = {};
|
|
20
30
|
__export(near_exports, {
|
|
@@ -22,8 +32,11 @@ __export(near_exports, {
|
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(near_exports);
|
|
24
34
|
var import_accounts = require("@near-js/accounts");
|
|
35
|
+
var import_depd = __toESM(require("depd"));
|
|
25
36
|
class Near {
|
|
26
37
|
constructor(config) {
|
|
38
|
+
const deprecate = (0, import_depd.default)("new Near(config)");
|
|
39
|
+
deprecate(`It will be removed in the next major release, please switch to using Account directly`);
|
|
27
40
|
this.config = config;
|
|
28
41
|
this.connection = import_accounts.Connection.fromConfig({
|
|
29
42
|
networkId: config.networkId,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "near-api-js",
|
|
3
3
|
"description": "JavaScript library to interact with NEAR Protocol via RPC API",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/near/near-api-js.git"
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"http-errors": "1.7.2",
|
|
18
18
|
"near-abi": "0.2.0",
|
|
19
19
|
"node-fetch": "2.6.7",
|
|
20
|
-
"@near-js/
|
|
21
|
-
"@near-js/
|
|
22
|
-
"@near-js/keystores": "2.
|
|
23
|
-
"@near-js/keystores-browser": "2.
|
|
24
|
-
"@near-js/keystores-node": "2.
|
|
25
|
-
"@near-js/providers": "2.
|
|
26
|
-
"@near-js/
|
|
27
|
-
"@near-js/
|
|
28
|
-
"@near-js/types": "2.
|
|
29
|
-
"@near-js/utils": "2.
|
|
20
|
+
"@near-js/crypto": "2.3.0",
|
|
21
|
+
"@near-js/accounts": "2.3.0",
|
|
22
|
+
"@near-js/keystores": "2.3.0",
|
|
23
|
+
"@near-js/keystores-browser": "2.3.0",
|
|
24
|
+
"@near-js/keystores-node": "2.3.0",
|
|
25
|
+
"@near-js/providers": "2.3.0",
|
|
26
|
+
"@near-js/transactions": "2.3.0",
|
|
27
|
+
"@near-js/signers": "2.3.0",
|
|
28
|
+
"@near-js/types": "2.3.0",
|
|
29
|
+
"@near-js/utils": "2.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/depd": "^1.1.37",
|