@autonomys/auto-utils 0.1.3 → 0.1.4
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/dist/api.d.ts +2 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +12 -27
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ApiPromise } from '@polkadot/api';
|
|
2
2
|
import type { DomainInput, NetworkInput } from './types/network';
|
|
3
3
|
export declare const activate: (input?: NetworkInput) => Promise<ApiPromise>;
|
|
4
4
|
export declare const activateDomain: (input: DomainInput) => Promise<ApiPromise>;
|
|
5
|
-
export declare const disconnect: () => Promise<void>;
|
|
6
|
-
export declare const disconnectDomain: () => Promise<void>;
|
|
5
|
+
export declare const disconnect: (api: ApiPromise) => Promise<void>;
|
|
7
6
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,eAAe,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEhE,eAAO,MAAM,QAAQ,WAAkB,YAAY,KAAG,QAAQ,UAAU,CAUvE,CAAA;AAED,eAAO,MAAM,cAAc,UAAiB,WAAW,KAAG,QAAQ,UAAU,CAU3E,CAAA;AAED,eAAO,MAAM,UAAU,QAAe,UAAU,KAAG,QAAQ,IAAI,CAG9D,CAAA"}
|
package/dist/api.js
CHANGED
|
@@ -9,48 +9,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.disconnect = exports.activateDomain = exports.activate = void 0;
|
|
13
13
|
const api_1 = require("@polkadot/api");
|
|
14
14
|
const network_1 = require("./network");
|
|
15
|
-
let provider = null;
|
|
16
|
-
let apiInstance = null;
|
|
17
|
-
let domainProvider = null;
|
|
18
|
-
let apiDomainInstance = null;
|
|
19
15
|
const activate = (input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
16
|
// Get the first rpc urls for the network
|
|
21
17
|
const rpcUrl = (0, network_1.getNetworkRpcUrls)(input);
|
|
22
18
|
// Create the provider
|
|
23
|
-
provider = new api_1.WsProvider(rpcUrl[0]);
|
|
19
|
+
const provider = new api_1.WsProvider(rpcUrl[0]);
|
|
24
20
|
// Create the API instance
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
const api = yield api_1.ApiPromise.create({ provider });
|
|
22
|
+
yield api.isReady;
|
|
23
|
+
return api;
|
|
27
24
|
});
|
|
28
25
|
exports.activate = activate;
|
|
29
26
|
const activateDomain = (input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
27
|
// Get the first rpc urls for the network
|
|
31
28
|
const rpcUrl = (0, network_1.getNetworkDomainRpcUrls)(input);
|
|
32
29
|
// Create the provider
|
|
33
|
-
|
|
30
|
+
const provider = new api_1.WsProvider(rpcUrl[0]);
|
|
34
31
|
// Create the API instance
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const api = yield api_1.ApiPromise.create({ provider });
|
|
33
|
+
yield api.isReady;
|
|
34
|
+
return api;
|
|
37
35
|
});
|
|
38
36
|
exports.activateDomain = activateDomain;
|
|
39
|
-
const disconnect = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
// Disconnect the API instance and the provider
|
|
41
|
-
|
|
42
|
-
yield apiInstance.disconnect();
|
|
43
|
-
apiInstance = null;
|
|
44
|
-
provider = null;
|
|
45
|
-
}
|
|
37
|
+
const disconnect = (api) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
// Disconnect the API instance and the provider
|
|
39
|
+
yield api.disconnect();
|
|
46
40
|
});
|
|
47
41
|
exports.disconnect = disconnect;
|
|
48
|
-
const disconnectDomain = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
// Disconnect the API instance and the provider if they exist
|
|
50
|
-
if (apiDomainInstance) {
|
|
51
|
-
yield apiDomainInstance.disconnect();
|
|
52
|
-
apiDomainInstance = null;
|
|
53
|
-
domainProvider = null;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
exports.disconnectDomain = disconnectDomain;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA"}
|
package/dist/types/index.js
CHANGED
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./api"), exports);
|
|
18
17
|
__exportStar(require("./network"), exports);
|
|
19
18
|
__exportStar(require("./wallet"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomys/auto-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"browser": {
|
|
37
37
|
"fs": false
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "bf1aacdebad697135f8cbcf4a359e7c2a9188e24"
|
|
40
40
|
}
|