@gnolang/tm2-js-client 1.3.3 → 2.0.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/README.md +1 -1
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.cjs +12 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.mjs +12 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.cjs +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.mjs +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.cjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.mjs +11 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/index.cjs +92 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -0
- package/dist/proto/google/protobuf/any.cjs +84 -0
- package/dist/proto/google/protobuf/any.cjs.map +1 -0
- package/dist/proto/google/protobuf/any.d.cts +141 -0
- package/dist/proto/google/protobuf/any.d.cts.map +1 -0
- package/dist/proto/google/protobuf/any.d.mts +141 -0
- package/dist/proto/google/protobuf/any.d.mts.map +1 -0
- package/dist/proto/google/protobuf/any.mjs +83 -0
- package/dist/proto/google/protobuf/any.mjs.map +1 -0
- package/dist/proto/index.cjs +2 -0
- package/dist/proto/index.d.cts +2 -0
- package/dist/proto/index.d.mts +2 -0
- package/dist/proto/index.mjs +3 -0
- package/dist/proto/tm2/abci.cjs +182 -0
- package/dist/proto/tm2/abci.cjs.map +1 -0
- package/dist/proto/tm2/abci.d.cts +33 -0
- package/dist/proto/tm2/abci.d.cts.map +1 -0
- package/dist/proto/tm2/abci.d.mts +33 -0
- package/dist/proto/tm2/abci.d.mts.map +1 -0
- package/dist/proto/tm2/abci.mjs +181 -0
- package/dist/proto/tm2/abci.mjs.map +1 -0
- package/dist/proto/tm2/tx.cjs +263 -0
- package/dist/proto/tm2/tx.cjs.map +1 -0
- package/dist/proto/tm2/tx.d.cts +49 -0
- package/dist/proto/tm2/tx.d.cts.map +1 -0
- package/dist/proto/tm2/tx.d.mts +49 -0
- package/dist/proto/tm2/tx.d.mts.map +1 -0
- package/dist/proto/tm2/tx.mjs +258 -0
- package/dist/proto/tm2/tx.mjs.map +1 -0
- package/dist/provider/endpoints.cjs +43 -0
- package/dist/provider/endpoints.cjs.map +1 -0
- package/dist/provider/endpoints.d.cts +33 -0
- package/dist/provider/endpoints.d.cts.map +1 -0
- package/dist/provider/endpoints.d.mts +33 -0
- package/dist/provider/endpoints.d.mts.map +1 -0
- package/dist/provider/endpoints.mjs +39 -0
- package/dist/provider/endpoints.mjs.map +1 -0
- package/dist/provider/errors/errors.cjs +122 -0
- package/dist/provider/errors/errors.cjs.map +1 -0
- package/dist/provider/errors/errors.d.cts +62 -0
- package/dist/provider/errors/errors.d.cts.map +1 -0
- package/dist/provider/errors/errors.d.mts +62 -0
- package/dist/provider/errors/errors.d.mts.map +1 -0
- package/dist/provider/errors/errors.mjs +104 -0
- package/dist/provider/errors/errors.mjs.map +1 -0
- package/dist/provider/errors/messages.cjs +40 -0
- package/dist/provider/errors/messages.cjs.map +1 -0
- package/dist/provider/errors/messages.mjs +23 -0
- package/dist/provider/errors/messages.mjs.map +1 -0
- package/dist/provider/index.cjs +12 -0
- package/dist/provider/index.d.cts +11 -0
- package/dist/provider/index.d.mts +11 -0
- package/dist/provider/index.mjs +13 -0
- package/dist/provider/jsonrpc/index.cjs +1 -0
- package/dist/provider/jsonrpc/index.d.cts +1 -0
- package/dist/provider/jsonrpc/index.d.mts +1 -0
- package/dist/provider/jsonrpc/index.mjs +2 -0
- package/dist/provider/jsonrpc/jsonrpc.cjs +20 -0
- package/dist/provider/jsonrpc/jsonrpc.cjs.map +1 -0
- package/dist/provider/jsonrpc/jsonrpc.d.cts +16 -0
- package/dist/provider/jsonrpc/jsonrpc.d.cts.map +1 -0
- package/dist/provider/jsonrpc/jsonrpc.d.mts +16 -0
- package/dist/provider/jsonrpc/jsonrpc.d.mts.map +1 -0
- package/dist/provider/jsonrpc/jsonrpc.mjs +19 -0
- package/dist/provider/jsonrpc/jsonrpc.mjs.map +1 -0
- package/dist/provider/provider.cjs +130 -0
- package/dist/provider/provider.cjs.map +1 -0
- package/dist/provider/provider.d.cts +130 -0
- package/dist/provider/provider.d.cts.map +1 -0
- package/dist/provider/provider.d.mts +130 -0
- package/dist/provider/provider.d.mts.map +1 -0
- package/dist/provider/provider.mjs +130 -0
- package/dist/provider/provider.mjs.map +1 -0
- package/dist/provider/types/abci.cjs +6 -0
- package/dist/provider/types/abci.cjs.map +1 -0
- package/dist/provider/types/abci.d.cts +42 -0
- package/dist/provider/types/abci.d.cts.map +1 -0
- package/dist/provider/types/abci.d.mts +42 -0
- package/dist/provider/types/abci.d.mts.map +1 -0
- package/dist/provider/types/abci.mjs +6 -0
- package/dist/provider/types/abci.mjs.map +1 -0
- package/dist/provider/types/common.d.cts +186 -0
- package/dist/provider/types/common.d.cts.map +1 -0
- package/dist/provider/types/common.d.mts +186 -0
- package/dist/provider/types/common.d.mts.map +1 -0
- package/dist/provider/types/jsonrpc.d.cts +30 -0
- package/dist/provider/types/jsonrpc.d.cts.map +1 -0
- package/dist/provider/types/jsonrpc.d.mts +30 -0
- package/dist/provider/types/jsonrpc.d.mts.map +1 -0
- package/dist/provider/utility/adapters.cjs +241 -0
- package/dist/provider/utility/adapters.cjs.map +1 -0
- package/dist/provider/utility/adapters.d.cts +19 -0
- package/dist/provider/utility/adapters.d.cts.map +1 -0
- package/dist/provider/utility/adapters.d.mts +19 -0
- package/dist/provider/utility/adapters.d.mts.map +1 -0
- package/dist/provider/utility/adapters.mjs +231 -0
- package/dist/provider/utility/adapters.mjs.map +1 -0
- package/dist/provider/utility/errors.utility.cjs +38 -0
- package/dist/provider/utility/errors.utility.cjs.map +1 -0
- package/dist/provider/utility/errors.utility.mjs +38 -0
- package/dist/provider/utility/errors.utility.mjs.map +1 -0
- package/dist/provider/utility/index.cjs +3 -0
- package/dist/provider/utility/index.d.cts +3 -0
- package/dist/provider/utility/index.d.mts +3 -0
- package/dist/provider/utility/index.mjs +4 -0
- package/dist/provider/utility/provider.utility.cjs +122 -0
- package/dist/provider/utility/provider.utility.cjs.map +1 -0
- package/{bin/provider/utility/provider.utility.d.ts → dist/provider/utility/provider.utility.d.cts} +15 -10
- package/dist/provider/utility/provider.utility.d.cts.map +1 -0
- package/dist/provider/utility/provider.utility.d.mts +45 -0
- package/dist/provider/utility/provider.utility.d.mts.map +1 -0
- package/dist/provider/utility/provider.utility.mjs +116 -0
- package/dist/provider/utility/provider.utility.mjs.map +1 -0
- package/dist/provider/utility/requests.utility.cjs +75 -0
- package/dist/provider/utility/requests.utility.cjs.map +1 -0
- package/dist/provider/utility/requests.utility.d.cts +40 -0
- package/dist/provider/utility/requests.utility.d.cts.map +1 -0
- package/dist/provider/utility/requests.utility.d.mts +40 -0
- package/dist/provider/utility/requests.utility.d.mts.map +1 -0
- package/dist/provider/utility/requests.utility.mjs +68 -0
- package/dist/provider/utility/requests.utility.mjs.map +1 -0
- package/dist/provider/websocket/index.cjs +1 -0
- package/dist/provider/websocket/index.d.cts +1 -0
- package/dist/provider/websocket/index.d.mts +1 -0
- package/dist/provider/websocket/index.mjs +2 -0
- package/dist/provider/websocket/ws.cjs +27 -0
- package/dist/provider/websocket/ws.cjs.map +1 -0
- package/dist/provider/websocket/ws.d.cts +21 -0
- package/dist/provider/websocket/ws.d.cts.map +1 -0
- package/dist/provider/websocket/ws.d.mts +21 -0
- package/dist/provider/websocket/ws.d.mts.map +1 -0
- package/dist/provider/websocket/ws.mjs +26 -0
- package/dist/provider/websocket/ws.mjs.map +1 -0
- package/dist/services/index.cjs +1 -0
- package/dist/services/index.d.cts +2 -0
- package/dist/services/index.d.mts +2 -0
- package/dist/services/index.mjs +2 -0
- package/dist/services/rest/restService.cjs +16 -0
- package/dist/services/rest/restService.cjs.map +1 -0
- package/dist/services/rest/restService.d.cts +9 -0
- package/dist/services/rest/restService.d.cts.map +1 -0
- package/dist/services/rest/restService.d.mts +9 -0
- package/dist/services/rest/restService.d.mts.map +1 -0
- package/dist/services/rest/restService.mjs +14 -0
- package/dist/services/rest/restService.mjs.map +1 -0
- package/dist/services/rest/restService.types.d.cts +11 -0
- package/dist/services/rest/restService.types.d.cts.map +1 -0
- package/dist/services/rest/restService.types.d.mts +11 -0
- package/dist/services/rest/restService.types.d.mts.map +1 -0
- package/dist/wallet/index.cjs +8 -0
- package/dist/wallet/index.d.cts +7 -0
- package/dist/wallet/index.d.mts +7 -0
- package/dist/wallet/index.mjs +9 -0
- package/dist/wallet/key/index.cjs +1 -0
- package/dist/wallet/key/index.mjs +2 -0
- package/dist/wallet/key/key.cjs +46 -0
- package/dist/wallet/key/key.cjs.map +1 -0
- package/dist/wallet/key/key.d.cts +26 -0
- package/dist/wallet/key/key.d.cts.map +1 -0
- package/dist/wallet/key/key.d.mts +26 -0
- package/dist/wallet/key/key.d.mts.map +1 -0
- package/dist/wallet/key/key.mjs +45 -0
- package/dist/wallet/key/key.mjs.map +1 -0
- package/dist/wallet/ledger/index.cjs +1 -0
- package/dist/wallet/ledger/index.d.cts +1 -0
- package/dist/wallet/ledger/index.d.mts +1 -0
- package/dist/wallet/ledger/index.mjs +2 -0
- package/dist/wallet/ledger/ledger.cjs +49 -0
- package/dist/wallet/ledger/ledger.cjs.map +1 -0
- package/dist/wallet/ledger/ledger.d.cts +27 -0
- package/dist/wallet/ledger/ledger.d.cts.map +1 -0
- package/dist/wallet/ledger/ledger.d.mts +27 -0
- package/dist/wallet/ledger/ledger.d.mts.map +1 -0
- package/dist/wallet/ledger/ledger.mjs +48 -0
- package/dist/wallet/ledger/ledger.mjs.map +1 -0
- package/dist/wallet/signer.d.cts +33 -0
- package/dist/wallet/signer.d.cts.map +1 -0
- package/dist/wallet/signer.d.mts +33 -0
- package/dist/wallet/signer.d.mts.map +1 -0
- package/dist/wallet/types/sign.cjs +6 -0
- package/dist/wallet/types/sign.cjs.map +1 -0
- package/dist/wallet/types/sign.d.cts +20 -0
- package/dist/wallet/types/sign.d.cts.map +1 -0
- package/dist/wallet/types/sign.d.mts +20 -0
- package/dist/wallet/types/sign.d.mts.map +1 -0
- package/dist/wallet/types/sign.mjs +6 -0
- package/dist/wallet/types/sign.mjs.map +1 -0
- package/dist/wallet/types/wallet.d.cts +9 -0
- package/dist/wallet/types/wallet.d.cts.map +1 -0
- package/dist/wallet/types/wallet.d.mts +9 -0
- package/dist/wallet/types/wallet.d.mts.map +1 -0
- package/dist/wallet/utility/index.cjs +1 -0
- package/dist/wallet/utility/index.d.cts +1 -0
- package/dist/wallet/utility/index.d.mts +1 -0
- package/dist/wallet/utility/index.mjs +2 -0
- package/dist/wallet/utility/utility.cjs +83 -0
- package/dist/wallet/utility/utility.cjs.map +1 -0
- package/dist/wallet/utility/utility.d.cts +42 -0
- package/dist/wallet/utility/utility.d.cts.map +1 -0
- package/dist/wallet/utility/utility.d.mts +42 -0
- package/dist/wallet/utility/utility.d.mts.map +1 -0
- package/dist/wallet/utility/utility.mjs +75 -0
- package/dist/wallet/utility/utility.mjs.map +1 -0
- package/dist/wallet/wallet.cjs +223 -0
- package/dist/wallet/wallet.cjs.map +1 -0
- package/dist/wallet/wallet.d.cts +113 -0
- package/dist/wallet/wallet.d.cts.map +1 -0
- package/dist/wallet/wallet.d.mts +113 -0
- package/dist/wallet/wallet.d.mts.map +1 -0
- package/dist/wallet/wallet.mjs +222 -0
- package/dist/wallet/wallet.mjs.map +1 -0
- package/package.json +57 -38
- package/bin/index.d.ts +0 -4
- package/bin/index.js +0 -20
- package/bin/proto/google/protobuf/any.d.ts +0 -145
- package/bin/proto/google/protobuf/any.js +0 -113
- package/bin/proto/index.d.ts +0 -2
- package/bin/proto/index.js +0 -20
- package/bin/proto/tm2/abci.d.ts +0 -37
- package/bin/proto/tm2/abci.js +0 -277
- package/bin/proto/tm2/multisig.d.ts +0 -43
- package/bin/proto/tm2/multisig.js +0 -322
- package/bin/proto/tm2/multisig.test.d.ts +0 -1
- package/bin/proto/tm2/multisig.test.js +0 -63
- package/bin/proto/tm2/tx.d.ts +0 -52
- package/bin/proto/tm2/tx.js +0 -360
- package/bin/provider/endpoints.d.ts +0 -29
- package/bin/provider/endpoints.js +0 -37
- package/bin/provider/errors/errors.d.ts +0 -59
- package/bin/provider/errors/errors.js +0 -173
- package/bin/provider/errors/index.d.ts +0 -1
- package/bin/provider/errors/index.js +0 -17
- package/bin/provider/errors/messages.d.ts +0 -19
- package/bin/provider/errors/messages.js +0 -41
- package/bin/provider/index.d.ts +0 -7
- package/bin/provider/index.js +0 -23
- package/bin/provider/jsonrpc/index.d.ts +0 -1
- package/bin/provider/jsonrpc/index.js +0 -17
- package/bin/provider/jsonrpc/jsonrpc.d.ts +0 -31
- package/bin/provider/jsonrpc/jsonrpc.js +0 -327
- package/bin/provider/jsonrpc/jsonrpc.test.d.ts +0 -1
- package/bin/provider/jsonrpc/jsonrpc.test.js +0 -488
- package/bin/provider/provider.d.ts +0 -98
- package/bin/provider/provider.js +0 -2
- package/bin/provider/types/abci.d.ts +0 -39
- package/bin/provider/types/abci.js +0 -4
- package/bin/provider/types/common.d.ts +0 -184
- package/bin/provider/types/common.js +0 -3
- package/bin/provider/types/index.d.ts +0 -3
- package/bin/provider/types/index.js +0 -19
- package/bin/provider/types/jsonrpc.d.ts +0 -26
- package/bin/provider/types/jsonrpc.js +0 -2
- package/bin/provider/utility/errors.utility.d.ts +0 -11
- package/bin/provider/utility/errors.utility.js +0 -56
- package/bin/provider/utility/index.d.ts +0 -2
- package/bin/provider/utility/index.js +0 -18
- package/bin/provider/utility/provider.utility.js +0 -244
- package/bin/provider/utility/requests.utility.d.ts +0 -35
- package/bin/provider/utility/requests.utility.js +0 -80
- package/bin/provider/websocket/index.d.ts +0 -1
- package/bin/provider/websocket/index.js +0 -17
- package/bin/provider/websocket/ws.d.ts +0 -58
- package/bin/provider/websocket/ws.js +0 -415
- package/bin/provider/websocket/ws.test.d.ts +0 -1
- package/bin/provider/websocket/ws.test.js +0 -648
- package/bin/services/index.d.ts +0 -2
- package/bin/services/index.js +0 -18
- package/bin/services/rest/restService.d.ts +0 -4
- package/bin/services/rest/restService.js +0 -72
- package/bin/services/rest/restService.types.d.ts +0 -6
- package/bin/services/rest/restService.types.js +0 -2
- package/bin/wallet/index.d.ts +0 -6
- package/bin/wallet/index.js +0 -22
- package/bin/wallet/key/index.d.ts +0 -1
- package/bin/wallet/key/index.js +0 -17
- package/bin/wallet/key/key.d.ts +0 -21
- package/bin/wallet/key/key.js +0 -102
- package/bin/wallet/key/key.test.d.ts +0 -1
- package/bin/wallet/key/key.test.js +0 -121
- package/bin/wallet/ledger/index.d.ts +0 -1
- package/bin/wallet/ledger/index.js +0 -17
- package/bin/wallet/ledger/ledger.d.ts +0 -22
- package/bin/wallet/ledger/ledger.js +0 -109
- package/bin/wallet/signer.d.ts +0 -29
- package/bin/wallet/signer.js +0 -2
- package/bin/wallet/types/index.d.ts +0 -2
- package/bin/wallet/types/index.js +0 -18
- package/bin/wallet/types/sign.d.ts +0 -16
- package/bin/wallet/types/sign.js +0 -4
- package/bin/wallet/types/wallet.d.ts +0 -5
- package/bin/wallet/types/wallet.js +0 -2
- package/bin/wallet/utility/index.d.ts +0 -1
- package/bin/wallet/utility/index.js +0 -17
- package/bin/wallet/utility/utility.d.ts +0 -36
- package/bin/wallet/utility/utility.js +0 -117
- package/bin/wallet/wallet.d.ts +0 -106
- package/bin/wallet/wallet.js +0 -361
- package/bin/wallet/wallet.test.d.ts +0 -1
- package/bin/wallet/wallet.test.js +0 -423
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var crypto_1 = require("@cosmjs/crypto");
|
|
43
|
-
var axios_1 = __importDefault(require("axios"));
|
|
44
|
-
var jest_mock_extended_1 = require("jest-mock-extended");
|
|
45
|
-
var long_1 = __importDefault(require("long"));
|
|
46
|
-
var proto_1 = require("../../proto");
|
|
47
|
-
var endpoints_1 = require("../endpoints");
|
|
48
|
-
var messages_1 = require("../errors/messages");
|
|
49
|
-
var types_1 = require("../types");
|
|
50
|
-
var utility_1 = require("../utility");
|
|
51
|
-
var jsonrpc_1 = require("./jsonrpc");
|
|
52
|
-
jest.mock('axios');
|
|
53
|
-
var mockedAxios = axios_1.default;
|
|
54
|
-
var mockURL = '127.0.0.1:26657';
|
|
55
|
-
describe('JSON-RPC Provider', function () {
|
|
56
|
-
test('estimateGas', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var tx, expectedEstimation, mockABCIResponse, provider, estimation;
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
switch (_a.label) {
|
|
60
|
-
case 0:
|
|
61
|
-
tx = proto_1.Tx.fromJSON({
|
|
62
|
-
signatures: [],
|
|
63
|
-
fee: {
|
|
64
|
-
gasFee: '',
|
|
65
|
-
gasWanted: new long_1.default(0),
|
|
66
|
-
},
|
|
67
|
-
messages: [],
|
|
68
|
-
memo: '',
|
|
69
|
-
});
|
|
70
|
-
expectedEstimation = 44900;
|
|
71
|
-
mockABCIResponse = (0, jest_mock_extended_1.mock)();
|
|
72
|
-
mockABCIResponse.response.Value =
|
|
73
|
-
'CiMiIW1zZzowLHN1Y2Nlc3M6dHJ1ZSxsb2c6LGV2ZW50czpbXRCAiXoYyL0F';
|
|
74
|
-
mockedAxios.post.mockResolvedValue({
|
|
75
|
-
data: (0, utility_1.newResponse)(mockABCIResponse),
|
|
76
|
-
});
|
|
77
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
78
|
-
return [4 /*yield*/, provider.estimateGas(tx)];
|
|
79
|
-
case 1:
|
|
80
|
-
estimation = _a.sent();
|
|
81
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
82
|
-
expect(estimation).toEqual(expectedEstimation);
|
|
83
|
-
return [2 /*return*/];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}); });
|
|
87
|
-
test('getNetwork', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
-
var mockInfo, provider, info;
|
|
89
|
-
return __generator(this, function (_a) {
|
|
90
|
-
switch (_a.label) {
|
|
91
|
-
case 0:
|
|
92
|
-
mockInfo = (0, jest_mock_extended_1.mock)();
|
|
93
|
-
mockInfo.listening = false;
|
|
94
|
-
mockedAxios.post.mockResolvedValue({
|
|
95
|
-
data: (0, utility_1.newResponse)(mockInfo),
|
|
96
|
-
});
|
|
97
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
98
|
-
return [4 /*yield*/, provider.getNetwork()];
|
|
99
|
-
case 1:
|
|
100
|
-
info = _a.sent();
|
|
101
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
102
|
-
expect(info).toEqual(mockInfo);
|
|
103
|
-
return [2 /*return*/];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}); });
|
|
107
|
-
test('getBlock', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
108
|
-
var mockInfo, provider, info;
|
|
109
|
-
return __generator(this, function (_a) {
|
|
110
|
-
switch (_a.label) {
|
|
111
|
-
case 0:
|
|
112
|
-
mockInfo = (0, jest_mock_extended_1.mock)();
|
|
113
|
-
mockedAxios.post.mockResolvedValue({
|
|
114
|
-
data: (0, utility_1.newResponse)(mockInfo),
|
|
115
|
-
});
|
|
116
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
117
|
-
return [4 /*yield*/, provider.getBlock(0)];
|
|
118
|
-
case 1:
|
|
119
|
-
info = _a.sent();
|
|
120
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
121
|
-
expect(info).toEqual(mockInfo);
|
|
122
|
-
return [2 /*return*/];
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}); });
|
|
126
|
-
test('getBlockResult', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
127
|
-
var mockResult, provider, result;
|
|
128
|
-
return __generator(this, function (_a) {
|
|
129
|
-
switch (_a.label) {
|
|
130
|
-
case 0:
|
|
131
|
-
mockResult = (0, jest_mock_extended_1.mock)();
|
|
132
|
-
mockedAxios.post.mockResolvedValue({
|
|
133
|
-
data: (0, utility_1.newResponse)(mockResult),
|
|
134
|
-
});
|
|
135
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
136
|
-
return [4 /*yield*/, provider.getBlockResult(0)];
|
|
137
|
-
case 1:
|
|
138
|
-
result = _a.sent();
|
|
139
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
140
|
-
expect(result).toEqual(mockResult);
|
|
141
|
-
return [2 /*return*/];
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}); });
|
|
145
|
-
describe('sendTransaction', function () {
|
|
146
|
-
var _a;
|
|
147
|
-
var validResult = {
|
|
148
|
-
error: null,
|
|
149
|
-
data: null,
|
|
150
|
-
Log: '',
|
|
151
|
-
hash: 'hash123',
|
|
152
|
-
};
|
|
153
|
-
var mockError = '/std.UnauthorizedError';
|
|
154
|
-
var mockLog = 'random error message';
|
|
155
|
-
var invalidResult = {
|
|
156
|
-
error: (_a = {},
|
|
157
|
-
_a[types_1.ABCIErrorKey] = mockError,
|
|
158
|
-
_a),
|
|
159
|
-
data: null,
|
|
160
|
-
Log: mockLog,
|
|
161
|
-
hash: '',
|
|
162
|
-
};
|
|
163
|
-
test.each([
|
|
164
|
-
[validResult, validResult.hash, '', ''], // no error
|
|
165
|
-
[invalidResult, invalidResult.hash, messages_1.UnauthorizedErrorMessage, mockLog], // error out
|
|
166
|
-
])('case %#', function (response, expectedHash, expectedErr, expectedLog) { return __awaiter(void 0, void 0, void 0, function () {
|
|
167
|
-
var provider, tx, e_1;
|
|
168
|
-
return __generator(this, function (_a) {
|
|
169
|
-
switch (_a.label) {
|
|
170
|
-
case 0:
|
|
171
|
-
mockedAxios.post.mockResolvedValue({
|
|
172
|
-
data: (0, utility_1.newResponse)(response),
|
|
173
|
-
});
|
|
174
|
-
_a.label = 1;
|
|
175
|
-
case 1:
|
|
176
|
-
_a.trys.push([1, 3, , 4]);
|
|
177
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
178
|
-
return [4 /*yield*/, provider.sendTransaction('encoded tx', endpoints_1.TransactionEndpoint.BROADCAST_TX_SYNC)];
|
|
179
|
-
case 2:
|
|
180
|
-
tx = _a.sent();
|
|
181
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
182
|
-
expect(tx.hash).toEqual(expectedHash);
|
|
183
|
-
if (expectedErr != '') {
|
|
184
|
-
fail('expected error');
|
|
185
|
-
}
|
|
186
|
-
return [3 /*break*/, 4];
|
|
187
|
-
case 3:
|
|
188
|
-
e_1 = _a.sent();
|
|
189
|
-
expect(e_1.message).toBe(expectedErr);
|
|
190
|
-
expect(e_1.log).toBe(expectedLog);
|
|
191
|
-
return [3 /*break*/, 4];
|
|
192
|
-
case 4: return [2 /*return*/];
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}); });
|
|
196
|
-
});
|
|
197
|
-
test('waitForTransaction', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
198
|
-
var emptyBlock, tx, encodedTx, txHash, filledBlock, latestBlock, startBlock, mockStatus, responseMap, provider, receivedTx;
|
|
199
|
-
return __generator(this, function (_a) {
|
|
200
|
-
switch (_a.label) {
|
|
201
|
-
case 0:
|
|
202
|
-
emptyBlock = (0, jest_mock_extended_1.mock)();
|
|
203
|
-
emptyBlock.block.data = {
|
|
204
|
-
txs: [],
|
|
205
|
-
};
|
|
206
|
-
tx = {
|
|
207
|
-
messages: [],
|
|
208
|
-
signatures: [],
|
|
209
|
-
memo: 'tx memo',
|
|
210
|
-
};
|
|
211
|
-
encodedTx = proto_1.Tx.encode(tx).finish();
|
|
212
|
-
txHash = (0, crypto_1.sha256)(encodedTx);
|
|
213
|
-
filledBlock = (0, jest_mock_extended_1.mock)();
|
|
214
|
-
filledBlock.block.data = {
|
|
215
|
-
txs: [(0, utility_1.uint8ArrayToBase64)(encodedTx)],
|
|
216
|
-
};
|
|
217
|
-
latestBlock = 5;
|
|
218
|
-
startBlock = latestBlock - 2;
|
|
219
|
-
mockStatus = (0, jest_mock_extended_1.mock)();
|
|
220
|
-
mockStatus.sync_info.latest_block_height = "".concat(latestBlock);
|
|
221
|
-
responseMap = new Map([
|
|
222
|
-
[latestBlock, filledBlock],
|
|
223
|
-
[latestBlock - 1, emptyBlock],
|
|
224
|
-
[startBlock, emptyBlock],
|
|
225
|
-
]);
|
|
226
|
-
mockedAxios.post.mockImplementation(function (url, params, config) {
|
|
227
|
-
var request = params;
|
|
228
|
-
if (request.method == endpoints_1.CommonEndpoint.STATUS) {
|
|
229
|
-
return Promise.resolve({
|
|
230
|
-
data: (0, utility_1.newResponse)(mockStatus),
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
if (!request.params) {
|
|
234
|
-
return Promise.reject('invalid params');
|
|
235
|
-
}
|
|
236
|
-
var blockNum = +request.params[0];
|
|
237
|
-
var info = responseMap.get(blockNum);
|
|
238
|
-
return Promise.resolve({
|
|
239
|
-
data: (0, utility_1.newResponse)(info),
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
243
|
-
return [4 /*yield*/, provider.waitForTransaction((0, utility_1.uint8ArrayToBase64)(txHash), startBlock)];
|
|
244
|
-
case 1:
|
|
245
|
-
receivedTx = _a.sent();
|
|
246
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
247
|
-
expect(receivedTx).toEqual(tx);
|
|
248
|
-
return [2 /*return*/];
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}); });
|
|
252
|
-
test('getConsensusParams', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
253
|
-
var mockParams, provider, params;
|
|
254
|
-
return __generator(this, function (_a) {
|
|
255
|
-
switch (_a.label) {
|
|
256
|
-
case 0:
|
|
257
|
-
mockParams = (0, jest_mock_extended_1.mock)();
|
|
258
|
-
mockParams.block_height = '1';
|
|
259
|
-
mockedAxios.post.mockResolvedValue({
|
|
260
|
-
data: (0, utility_1.newResponse)(mockParams),
|
|
261
|
-
});
|
|
262
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
263
|
-
return [4 /*yield*/, provider.getConsensusParams(1)];
|
|
264
|
-
case 1:
|
|
265
|
-
params = _a.sent();
|
|
266
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
267
|
-
expect(params).toEqual(mockParams);
|
|
268
|
-
return [2 /*return*/];
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
}); });
|
|
272
|
-
test('getStatus', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
273
|
-
var mockStatus, provider, status;
|
|
274
|
-
return __generator(this, function (_a) {
|
|
275
|
-
switch (_a.label) {
|
|
276
|
-
case 0:
|
|
277
|
-
mockStatus = (0, jest_mock_extended_1.mock)();
|
|
278
|
-
mockStatus.validator_info.address = 'address';
|
|
279
|
-
mockedAxios.post.mockResolvedValue({
|
|
280
|
-
data: (0, utility_1.newResponse)(mockStatus),
|
|
281
|
-
});
|
|
282
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
283
|
-
return [4 /*yield*/, provider.getStatus()];
|
|
284
|
-
case 1:
|
|
285
|
-
status = _a.sent();
|
|
286
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
287
|
-
expect(status).toEqual(mockStatus);
|
|
288
|
-
return [2 /*return*/];
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
}); });
|
|
292
|
-
test('getBlockNumber', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
293
|
-
var expectedBlockNumber, mockStatus, provider, blockNumber;
|
|
294
|
-
return __generator(this, function (_a) {
|
|
295
|
-
switch (_a.label) {
|
|
296
|
-
case 0:
|
|
297
|
-
expectedBlockNumber = 10;
|
|
298
|
-
mockStatus = (0, jest_mock_extended_1.mock)();
|
|
299
|
-
mockStatus.sync_info.latest_block_height = "".concat(expectedBlockNumber);
|
|
300
|
-
mockedAxios.post.mockResolvedValue({
|
|
301
|
-
data: (0, utility_1.newResponse)(mockStatus),
|
|
302
|
-
});
|
|
303
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
304
|
-
return [4 /*yield*/, provider.getBlockNumber()];
|
|
305
|
-
case 1:
|
|
306
|
-
blockNumber = _a.sent();
|
|
307
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
308
|
-
expect(blockNumber).toEqual(expectedBlockNumber);
|
|
309
|
-
return [2 /*return*/];
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}); });
|
|
313
|
-
describe('getBalance', function () {
|
|
314
|
-
var denomination = 'atom';
|
|
315
|
-
test.each([
|
|
316
|
-
['"5gnot,100atom"', 100], // balance found
|
|
317
|
-
['"5universe"', 0], // balance not found
|
|
318
|
-
['""', 0], // account doesn't exist
|
|
319
|
-
])('case %#', function (existing, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
320
|
-
var mockABCIResponse, provider, balance;
|
|
321
|
-
return __generator(this, function (_a) {
|
|
322
|
-
switch (_a.label) {
|
|
323
|
-
case 0:
|
|
324
|
-
mockABCIResponse = (0, jest_mock_extended_1.mock)();
|
|
325
|
-
mockABCIResponse.response.ResponseBase = {
|
|
326
|
-
Log: '',
|
|
327
|
-
Info: '',
|
|
328
|
-
Data: (0, utility_1.stringToBase64)(existing),
|
|
329
|
-
Error: null,
|
|
330
|
-
Events: null,
|
|
331
|
-
};
|
|
332
|
-
mockedAxios.post.mockResolvedValue({
|
|
333
|
-
data: (0, utility_1.newResponse)(mockABCIResponse),
|
|
334
|
-
});
|
|
335
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
336
|
-
return [4 /*yield*/, provider.getBalance('address', denomination)];
|
|
337
|
-
case 1:
|
|
338
|
-
balance = _a.sent();
|
|
339
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
340
|
-
expect(balance).toBe(expected);
|
|
341
|
-
return [2 /*return*/];
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
}); });
|
|
345
|
-
});
|
|
346
|
-
describe('getSequence', function () {
|
|
347
|
-
var validAccount = {
|
|
348
|
-
BaseAccount: {
|
|
349
|
-
address: 'random address',
|
|
350
|
-
coins: '',
|
|
351
|
-
public_key: null,
|
|
352
|
-
account_number: '0',
|
|
353
|
-
sequence: '10',
|
|
354
|
-
},
|
|
355
|
-
};
|
|
356
|
-
test.each([
|
|
357
|
-
[
|
|
358
|
-
JSON.stringify(validAccount),
|
|
359
|
-
parseInt(validAccount.BaseAccount.sequence, 10),
|
|
360
|
-
], // account exists
|
|
361
|
-
['null', 0], // account doesn't exist
|
|
362
|
-
])('case %#', function (response, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
363
|
-
var mockABCIResponse, provider, sequence;
|
|
364
|
-
return __generator(this, function (_a) {
|
|
365
|
-
switch (_a.label) {
|
|
366
|
-
case 0:
|
|
367
|
-
mockABCIResponse = (0, jest_mock_extended_1.mock)();
|
|
368
|
-
mockABCIResponse.response.ResponseBase = {
|
|
369
|
-
Log: '',
|
|
370
|
-
Info: '',
|
|
371
|
-
Data: (0, utility_1.stringToBase64)(response),
|
|
372
|
-
Error: null,
|
|
373
|
-
Events: null,
|
|
374
|
-
};
|
|
375
|
-
mockedAxios.post.mockResolvedValue({
|
|
376
|
-
data: (0, utility_1.newResponse)(mockABCIResponse),
|
|
377
|
-
});
|
|
378
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
379
|
-
return [4 /*yield*/, provider.getAccountSequence('address')];
|
|
380
|
-
case 1:
|
|
381
|
-
sequence = _a.sent();
|
|
382
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
383
|
-
expect(sequence).toBe(expected);
|
|
384
|
-
return [2 /*return*/];
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
}); });
|
|
388
|
-
});
|
|
389
|
-
describe('getAccountNumber', function () {
|
|
390
|
-
var validAccount = {
|
|
391
|
-
BaseAccount: {
|
|
392
|
-
address: 'random address',
|
|
393
|
-
coins: '',
|
|
394
|
-
public_key: null,
|
|
395
|
-
account_number: '10',
|
|
396
|
-
sequence: '0',
|
|
397
|
-
},
|
|
398
|
-
};
|
|
399
|
-
test.each([
|
|
400
|
-
[
|
|
401
|
-
JSON.stringify(validAccount),
|
|
402
|
-
parseInt(validAccount.BaseAccount.account_number, 10),
|
|
403
|
-
], // account exists
|
|
404
|
-
['null', 0], // account doesn't exist
|
|
405
|
-
])('case %#', function (response, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
406
|
-
var mockABCIResponse, provider, accountNumber, e_2;
|
|
407
|
-
return __generator(this, function (_a) {
|
|
408
|
-
switch (_a.label) {
|
|
409
|
-
case 0:
|
|
410
|
-
mockABCIResponse = (0, jest_mock_extended_1.mock)();
|
|
411
|
-
mockABCIResponse.response.ResponseBase = {
|
|
412
|
-
Log: '',
|
|
413
|
-
Info: '',
|
|
414
|
-
Data: (0, utility_1.stringToBase64)(response),
|
|
415
|
-
Error: null,
|
|
416
|
-
Events: null,
|
|
417
|
-
};
|
|
418
|
-
mockedAxios.post.mockResolvedValue({
|
|
419
|
-
data: (0, utility_1.newResponse)(mockABCIResponse),
|
|
420
|
-
});
|
|
421
|
-
_a.label = 1;
|
|
422
|
-
case 1:
|
|
423
|
-
_a.trys.push([1, 3, , 4]);
|
|
424
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
425
|
-
return [4 /*yield*/, provider.getAccountNumber('address')];
|
|
426
|
-
case 2:
|
|
427
|
-
accountNumber = _a.sent();
|
|
428
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
429
|
-
expect(accountNumber).toBe(expected);
|
|
430
|
-
return [3 /*break*/, 4];
|
|
431
|
-
case 3:
|
|
432
|
-
e_2 = _a.sent();
|
|
433
|
-
expect(e_2.message).toContain('account is not initialized');
|
|
434
|
-
return [3 /*break*/, 4];
|
|
435
|
-
case 4: return [2 /*return*/];
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
}); });
|
|
439
|
-
});
|
|
440
|
-
describe('getAccount', function () {
|
|
441
|
-
var validAccount = {
|
|
442
|
-
BaseAccount: {
|
|
443
|
-
address: 'random address',
|
|
444
|
-
coins: '',
|
|
445
|
-
public_key: { '@type': 'pktype', value: 'pk' },
|
|
446
|
-
account_number: '10',
|
|
447
|
-
sequence: '42',
|
|
448
|
-
},
|
|
449
|
-
};
|
|
450
|
-
test.each([
|
|
451
|
-
[JSON.stringify(validAccount), validAccount], // account exists
|
|
452
|
-
['null', null], // account doesn't exist
|
|
453
|
-
])('case %#', function (response, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
454
|
-
var mockABCIResponse, provider, account, e_3;
|
|
455
|
-
return __generator(this, function (_a) {
|
|
456
|
-
switch (_a.label) {
|
|
457
|
-
case 0:
|
|
458
|
-
mockABCIResponse = (0, jest_mock_extended_1.mock)();
|
|
459
|
-
mockABCIResponse.response.ResponseBase = {
|
|
460
|
-
Log: '',
|
|
461
|
-
Info: '',
|
|
462
|
-
Data: (0, utility_1.stringToBase64)(response),
|
|
463
|
-
Error: null,
|
|
464
|
-
Events: null,
|
|
465
|
-
};
|
|
466
|
-
mockedAxios.post.mockResolvedValue({
|
|
467
|
-
data: (0, utility_1.newResponse)(mockABCIResponse),
|
|
468
|
-
});
|
|
469
|
-
_a.label = 1;
|
|
470
|
-
case 1:
|
|
471
|
-
_a.trys.push([1, 3, , 4]);
|
|
472
|
-
provider = new jsonrpc_1.JSONRPCProvider(mockURL);
|
|
473
|
-
return [4 /*yield*/, provider.getAccount('address')];
|
|
474
|
-
case 2:
|
|
475
|
-
account = _a.sent();
|
|
476
|
-
expect(axios_1.default.post).toHaveBeenCalled();
|
|
477
|
-
expect(account).toStrictEqual(expected);
|
|
478
|
-
return [3 /*break*/, 4];
|
|
479
|
-
case 3:
|
|
480
|
-
e_3 = _a.sent();
|
|
481
|
-
expect(e_3.message).toContain('account is not initialized');
|
|
482
|
-
return [3 /*break*/, 4];
|
|
483
|
-
case 4: return [2 /*return*/];
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}); });
|
|
487
|
-
});
|
|
488
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { ABCIAccount, BlockInfo, BlockResult, BroadcastAsGeneric, BroadcastTransactionMap, ConsensusParams, NetworkInfo, Status } from './types';
|
|
2
|
-
import { Tx } from '../proto';
|
|
3
|
-
/**
|
|
4
|
-
* Read-only abstraction for accessing blockchain data
|
|
5
|
-
*/
|
|
6
|
-
export interface Provider {
|
|
7
|
-
/**
|
|
8
|
-
* Fetches the denomination balance of the account
|
|
9
|
-
* @param {string} address the bech32 address of the account
|
|
10
|
-
* @param {string} [denomination=ugnot] the balance denomination
|
|
11
|
-
* @param {number} [height=0] the height for querying.
|
|
12
|
-
* If omitted, the latest height is used
|
|
13
|
-
*/
|
|
14
|
-
getBalance(address: string, denomination?: string, height?: number): Promise<number>;
|
|
15
|
-
/**
|
|
16
|
-
* Fetches the account sequence
|
|
17
|
-
* @param {string} address the bech32 address of the account
|
|
18
|
-
* @param {number} [height=0] the height for querying.
|
|
19
|
-
* If omitted, the latest height is used.
|
|
20
|
-
* @deprecated use {@link getAccount} instead
|
|
21
|
-
*/
|
|
22
|
-
getAccountSequence(address: string, height?: number): Promise<number>;
|
|
23
|
-
/**
|
|
24
|
-
* Fetches the account number. Errors out if the account
|
|
25
|
-
* is not initialized
|
|
26
|
-
* @param {string} address the bech32 address of the account
|
|
27
|
-
* @param {number} [height=0] the height for querying.
|
|
28
|
-
* If omitted, the latest height is used
|
|
29
|
-
* @deprecated use {@link getAccount} instead
|
|
30
|
-
*/
|
|
31
|
-
getAccountNumber(address: string, height?: number): Promise<number>;
|
|
32
|
-
/**
|
|
33
|
-
* Fetches the account. Errors out if the account
|
|
34
|
-
* is not initialized
|
|
35
|
-
* @param {string} address the bech32 address of the account
|
|
36
|
-
* @param {number} [height=0] the height for querying.
|
|
37
|
-
* If omitted, the latest height is used
|
|
38
|
-
*/
|
|
39
|
-
getAccount(address: string, height?: number): Promise<ABCIAccount>;
|
|
40
|
-
/**
|
|
41
|
-
* Fetches the block at the specific height, if any
|
|
42
|
-
* @param {number} height the height for querying
|
|
43
|
-
*/
|
|
44
|
-
getBlock(height: number): Promise<BlockInfo>;
|
|
45
|
-
/**
|
|
46
|
-
* Fetches the block at the specific height, if any
|
|
47
|
-
* @param {number} height the height for querying
|
|
48
|
-
*/
|
|
49
|
-
getBlockResult(height: number): Promise<BlockResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Fetches the latest block number from the chain
|
|
52
|
-
*/
|
|
53
|
-
getBlockNumber(): Promise<number>;
|
|
54
|
-
/**
|
|
55
|
-
* Fetches the network information
|
|
56
|
-
*/
|
|
57
|
-
getNetwork(): Promise<NetworkInfo>;
|
|
58
|
-
/**
|
|
59
|
-
* Fetches the consensus params for the specific block height
|
|
60
|
-
* @param {number} height the height for querying
|
|
61
|
-
*/
|
|
62
|
-
getConsensusParams(height: number): Promise<ConsensusParams>;
|
|
63
|
-
/**
|
|
64
|
-
* Fetches the current node status
|
|
65
|
-
*/
|
|
66
|
-
getStatus(): Promise<Status>;
|
|
67
|
-
/**
|
|
68
|
-
* Fetches the current (recommended) average gas price
|
|
69
|
-
*/
|
|
70
|
-
getGasPrice(): Promise<number>;
|
|
71
|
-
/**
|
|
72
|
-
* Estimates the gas limit for the transaction
|
|
73
|
-
* @param {Tx} tx the transaction that needs estimating
|
|
74
|
-
*/
|
|
75
|
-
estimateGas(tx: Tx): Promise<number>;
|
|
76
|
-
/**
|
|
77
|
-
* Sends the transaction to the node. If the type of endpoint
|
|
78
|
-
* is a broadcast commit, waits for the transaction to be committed to the chain.
|
|
79
|
-
* The transaction needs to be signed beforehand.
|
|
80
|
-
* Returns the transaction broadcast result.
|
|
81
|
-
* @param {string} tx the base64-encoded signed transaction
|
|
82
|
-
* @param {BroadcastType} endpoint the transaction broadcast type (sync / commit)
|
|
83
|
-
*/
|
|
84
|
-
sendTransaction<K extends keyof BroadcastTransactionMap>(tx: string, endpoint: K): Promise<BroadcastAsGeneric<K>['result']>;
|
|
85
|
-
/**
|
|
86
|
-
* Waits for the transaction to be committed on the chain.
|
|
87
|
-
* NOTE: This method will not take in the fromHeight parameter once
|
|
88
|
-
* proper transaction indexing is added - the implementation should
|
|
89
|
-
* simply try to fetch the transaction first to see if it's included in a block
|
|
90
|
-
* before starting to wait for it; Until then, this method should be used
|
|
91
|
-
* in the sequence:
|
|
92
|
-
* get latest block -> send transaction -> waitForTransaction(block before send)
|
|
93
|
-
* @param {string} hash The transaction hash
|
|
94
|
-
* @param {number} [fromHeight=latest] The block height used to begin the search
|
|
95
|
-
* @param {number} [timeout=15000] Optional wait timeout in MS
|
|
96
|
-
*/
|
|
97
|
-
waitForTransaction(hash: string, fromHeight?: number, timeout?: number): Promise<Tx>;
|
|
98
|
-
}
|
package/bin/provider/provider.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export interface ABCIResponse {
|
|
2
|
-
response: {
|
|
3
|
-
ResponseBase: ABCIResponseBase;
|
|
4
|
-
Key: string | null;
|
|
5
|
-
Value: string | null;
|
|
6
|
-
Proof: MerkleProof | null;
|
|
7
|
-
Height: string;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export interface ABCIResponseBase {
|
|
11
|
-
Error: {
|
|
12
|
-
[key: string]: string;
|
|
13
|
-
} | null;
|
|
14
|
-
Data: string | null;
|
|
15
|
-
Events: string | null;
|
|
16
|
-
Log: string;
|
|
17
|
-
Info: string;
|
|
18
|
-
}
|
|
19
|
-
interface MerkleProof {
|
|
20
|
-
ops: {
|
|
21
|
-
type: string;
|
|
22
|
-
key: string | null;
|
|
23
|
-
data: string | null;
|
|
24
|
-
}[];
|
|
25
|
-
}
|
|
26
|
-
export interface ABCIAccount {
|
|
27
|
-
BaseAccount: {
|
|
28
|
-
address: string;
|
|
29
|
-
coins: string;
|
|
30
|
-
public_key: {
|
|
31
|
-
'@type': string;
|
|
32
|
-
value: string;
|
|
33
|
-
} | null;
|
|
34
|
-
account_number: string;
|
|
35
|
-
sequence: string;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export declare const ABCIErrorKey = "@type";
|
|
39
|
-
export {};
|