@wallfree-dev/cosmos-core 0.13.42

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.
Files changed (77) hide show
  1. package/LICENSE.md +7 -0
  2. package/index.d.ts +1 -0
  3. package/index.js +18 -0
  4. package/index.js.map +1 -0
  5. package/package.json +59 -0
  6. package/readme.md +11 -0
  7. package/v1/index.d.ts +18 -0
  8. package/v1/index.js +29 -0
  9. package/v1/index.js.map +1 -0
  10. package/v1/node/CosmosNodeClient.d.ts +29 -0
  11. package/v1/node/CosmosNodeClient.js +383 -0
  12. package/v1/node/CosmosNodeClient.js.map +1 -0
  13. package/v1/protocol/CosmosBaseProtocol.d.ts +100 -0
  14. package/v1/protocol/CosmosBaseProtocol.js +999 -0
  15. package/v1/protocol/CosmosBaseProtocol.js.map +1 -0
  16. package/v1/protocol/CosmosCryptoClient.d.ts +8 -0
  17. package/v1/protocol/CosmosCryptoClient.js +90 -0
  18. package/v1/protocol/CosmosCryptoClient.js.map +1 -0
  19. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
  20. package/v1/serializer/v3/schemas/converter/transaction-converter.js +37 -0
  21. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
  22. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +4 -0
  23. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js +3 -0
  24. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js.map +1 -0
  25. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.d.ts +3 -0
  26. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js +3 -0
  27. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js.map +1 -0
  28. package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +100 -0
  29. package/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json +19 -0
  30. package/v1/serializer/v3/validators/transaction-validators.d.ts +7 -0
  31. package/v1/serializer/v3/validators/transaction-validators.js +88 -0
  32. package/v1/serializer/v3/validators/transaction-validators.js.map +1 -0
  33. package/v1/types/crypto.d.ts +2 -0
  34. package/v1/types/crypto.js +3 -0
  35. package/v1/types/crypto.js.map +1 -0
  36. package/v1/types/data/CosmosAddress.d.ts +7 -0
  37. package/v1/types/data/CosmosAddress.js +30 -0
  38. package/v1/types/data/CosmosAddress.js.map +1 -0
  39. package/v1/types/data/CosmosCoin.d.ts +18 -0
  40. package/v1/types/data/CosmosCoin.js +56 -0
  41. package/v1/types/data/CosmosCoin.js.map +1 -0
  42. package/v1/types/data/CosmosFee.d.ts +15 -0
  43. package/v1/types/data/CosmosFee.js +31 -0
  44. package/v1/types/data/CosmosFee.js.map +1 -0
  45. package/v1/types/data/transaction/CosmosTransaction.d.ts +36 -0
  46. package/v1/types/data/transaction/CosmosTransaction.js +109 -0
  47. package/v1/types/data/transaction/CosmosTransaction.js.map +1 -0
  48. package/v1/types/data/transaction/message/CosmosDelegateMessage.d.ts +19 -0
  49. package/v1/types/data/transaction/message/CosmosDelegateMessage.js +70 -0
  50. package/v1/types/data/transaction/message/CosmosDelegateMessage.js.map +1 -0
  51. package/v1/types/data/transaction/message/CosmosMessage.d.ts +39 -0
  52. package/v1/types/data/transaction/message/CosmosMessage.js +48 -0
  53. package/v1/types/data/transaction/message/CosmosMessage.js.map +1 -0
  54. package/v1/types/data/transaction/message/CosmosSendMessage.d.ts +19 -0
  55. package/v1/types/data/transaction/message/CosmosSendMessage.js +83 -0
  56. package/v1/types/data/transaction/message/CosmosSendMessage.js.map +1 -0
  57. package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.d.ts +23 -0
  58. package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +61 -0
  59. package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
  60. package/v1/types/protocol.d.ts +10 -0
  61. package/v1/types/protocol.js +3 -0
  62. package/v1/types/protocol.js.map +1 -0
  63. package/v1/types/rpc.d.ts +292 -0
  64. package/v1/types/rpc.js +3 -0
  65. package/v1/types/rpc.js.map +1 -0
  66. package/v1/types/transaction.d.ts +50 -0
  67. package/v1/types/transaction.js +18 -0
  68. package/v1/types/transaction.js.map +1 -0
  69. package/v1/utils/key.d.ts +3 -0
  70. package/v1/utils/key.js +20 -0
  71. package/v1/utils/key.js.map +1 -0
  72. package/v1/utils/signature.d.ts +2 -0
  73. package/v1/utils/signature.js +13 -0
  74. package/v1/utils/signature.js.map +1 -0
  75. package/v1/utils/transaction.d.ts +1 -0
  76. package/v1/utils/transaction.js +8 -0
  77. package/v1/utils/transaction.js.map +1 -0
package/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2019 Papers AG
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './v1';
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./v1"), exports);
18
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@wallfree-dev/cosmos-core",
3
+ "version": "0.13.42",
4
+ "description": "The @wallfree-dev/cosmos-core is a Cosmos base implementation of the ICoinProtocol interface from @wallfree-dev/coinlib-core.",
5
+ "keywords": [
6
+ "airgap",
7
+ "blockchain",
8
+ "crypto",
9
+ "cosmos"
10
+ ],
11
+ "homepage": "https://www.airgap.it",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/airgap-it/airgap-coin-lib.git"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "scripts": {
21
+ "build": "rm -rf ./dist && tsc && node scripts/copy-files-after-build.js",
22
+ "build-scripts": "tsc scripts/copy-files-after-build.ts",
23
+ "lint": "tslint -c ./tslint.json --project ./tsconfig.json --format stylish --fix",
24
+ "lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
25
+ "lint-ci": "tslint -t json -o ../../lint-reports/cosmos-core.json --project . || true",
26
+ "lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different",
27
+ "test": "",
28
+ "test-ci": "nyc --reporter=lcov pnpm test",
29
+ "browserify": "browserify ./dist/index.js -s airgapCoinLibCosmosCore > ./dist/airgap-coinlib-cosmos-core.min.js"
30
+ },
31
+ "author": "Papers AG <contact@papers.ch> (https://papers.ch)",
32
+ "dependencies": {
33
+ "@wallfree-dev/coinlib-core": "^0.13.42",
34
+ "@wallfree-dev/crypto": "^0.13.42",
35
+ "@wallfree-dev/module-kit": "^0.13.42",
36
+ "@wallfree-dev/serializer": "^0.13.42"
37
+ },
38
+ "nyc": {
39
+ "include": [
40
+ "src/**/*.ts"
41
+ ],
42
+ "exclude": [
43
+ "test/**/*.spec.ts"
44
+ ],
45
+ "extension": [
46
+ ".ts"
47
+ ],
48
+ "require": [
49
+ "ts-node/register"
50
+ ],
51
+ "reporter": [
52
+ "text",
53
+ "text-summary"
54
+ ],
55
+ "report-dir": "../../coverage/cosmos-core",
56
+ "sourceMap": true,
57
+ "instrument": true
58
+ }
59
+ }
package/readme.md ADDED
@@ -0,0 +1,11 @@
1
+ # `cosmos-core`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const cosmosCore = require('cosmos-core');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
package/v1/index.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { CosmosBaseProtocol, CosmosBaseProtocolImpl, CosmosBaseStakingProtocol } from './protocol/CosmosBaseProtocol';
2
+ import { CosmosCryptoConfiguration } from './types/crypto';
3
+ import { CosmosProtocolNetwork, CosmosProtocolOptions } from './types/protocol';
4
+ import { CosmosAddress } from './types/data/CosmosAddress';
5
+ import { CosmosCoin } from './types/data/CosmosCoin';
6
+ import { CosmosFee } from './types/data/CosmosFee';
7
+ import { CosmosSignedTransaction, CosmosTransactionCursor, CosmosUnsignedTransaction, CosmosDelegationActionType } from './types/transaction';
8
+ import { CosmosTransaction } from './types/data/transaction/CosmosTransaction';
9
+ import { CosmosPagedSendTxsResponse, CosmosAccount, CosmosAccountCoin, CosmosAccountValue, CosmosBroadcastSignedTransactionResponse, CosmosDelegation, CosmosNodeInfo, CosmosRewardDetails, CosmosSendTx, CosmosUnbondingDelegation, CosmosValidator, CosmosValidatorCommission, CosmosValidatorCommissionRate, CosmosValidatorDescription } from './types/rpc';
10
+ import { cosmosSignedTransactionToResponse, cosmosTransactionSignRequestToUnsigned, cosmosTransactionSignResponseToSigned, cosmosUnsignedTransactionToRequest } from './serializer/v3/schemas/converter/transaction-converter';
11
+ import { CosmosNodeClient } from './node/CosmosNodeClient';
12
+ import { CosmosSendMessage } from './types/data/transaction/message/CosmosSendMessage';
13
+ import { CosmosMessage } from './types/data/transaction/message/CosmosMessage';
14
+ import { CosmosDelegateMessage } from './types/data/transaction/message/CosmosDelegateMessage';
15
+ import { CosmosWithdrawDelegationRewardMessage } from './types/data/transaction/message/CosmosWithdrawDelegationRewardMessage';
16
+ export { CosmosBaseProtocol, CosmosBaseProtocolImpl, CosmosBaseStakingProtocol, CosmosNodeClient };
17
+ export { CosmosCryptoConfiguration, CosmosProtocolNetwork, CosmosProtocolOptions, CosmosTransaction, CosmosUnsignedTransaction, CosmosDelegationActionType, CosmosSignedTransaction, CosmosTransactionCursor, CosmosAddress, CosmosCoin, CosmosFee, CosmosPagedSendTxsResponse, CosmosMessage, CosmosSendMessage, CosmosDelegateMessage, CosmosWithdrawDelegationRewardMessage, CosmosAccount, CosmosAccountCoin, CosmosAccountValue, CosmosBroadcastSignedTransactionResponse, CosmosDelegation, CosmosNodeInfo, CosmosRewardDetails, CosmosSendTx, CosmosUnbondingDelegation, CosmosValidator, CosmosValidatorCommission, CosmosValidatorCommissionRate, CosmosValidatorDescription };
18
+ export { cosmosSignedTransactionToResponse, cosmosTransactionSignRequestToUnsigned, cosmosTransactionSignResponseToSigned, cosmosUnsignedTransactionToRequest };
package/v1/index.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cosmosUnsignedTransactionToRequest = exports.cosmosTransactionSignResponseToSigned = exports.cosmosTransactionSignRequestToUnsigned = exports.cosmosSignedTransactionToResponse = exports.CosmosWithdrawDelegationRewardMessage = exports.CosmosDelegateMessage = exports.CosmosSendMessage = exports.CosmosFee = exports.CosmosCoin = exports.CosmosAddress = exports.CosmosDelegationActionType = exports.CosmosTransaction = exports.CosmosNodeClient = exports.CosmosBaseProtocolImpl = void 0;
4
+ var CosmosBaseProtocol_1 = require("./protocol/CosmosBaseProtocol");
5
+ Object.defineProperty(exports, "CosmosBaseProtocolImpl", { enumerable: true, get: function () { return CosmosBaseProtocol_1.CosmosBaseProtocolImpl; } });
6
+ var CosmosAddress_1 = require("./types/data/CosmosAddress");
7
+ Object.defineProperty(exports, "CosmosAddress", { enumerable: true, get: function () { return CosmosAddress_1.CosmosAddress; } });
8
+ var CosmosCoin_1 = require("./types/data/CosmosCoin");
9
+ Object.defineProperty(exports, "CosmosCoin", { enumerable: true, get: function () { return CosmosCoin_1.CosmosCoin; } });
10
+ var CosmosFee_1 = require("./types/data/CosmosFee");
11
+ Object.defineProperty(exports, "CosmosFee", { enumerable: true, get: function () { return CosmosFee_1.CosmosFee; } });
12
+ var transaction_1 = require("./types/transaction");
13
+ Object.defineProperty(exports, "CosmosDelegationActionType", { enumerable: true, get: function () { return transaction_1.CosmosDelegationActionType; } });
14
+ var CosmosTransaction_1 = require("./types/data/transaction/CosmosTransaction");
15
+ Object.defineProperty(exports, "CosmosTransaction", { enumerable: true, get: function () { return CosmosTransaction_1.CosmosTransaction; } });
16
+ var transaction_converter_1 = require("./serializer/v3/schemas/converter/transaction-converter");
17
+ Object.defineProperty(exports, "cosmosSignedTransactionToResponse", { enumerable: true, get: function () { return transaction_converter_1.cosmosSignedTransactionToResponse; } });
18
+ Object.defineProperty(exports, "cosmosTransactionSignRequestToUnsigned", { enumerable: true, get: function () { return transaction_converter_1.cosmosTransactionSignRequestToUnsigned; } });
19
+ Object.defineProperty(exports, "cosmosTransactionSignResponseToSigned", { enumerable: true, get: function () { return transaction_converter_1.cosmosTransactionSignResponseToSigned; } });
20
+ Object.defineProperty(exports, "cosmosUnsignedTransactionToRequest", { enumerable: true, get: function () { return transaction_converter_1.cosmosUnsignedTransactionToRequest; } });
21
+ var CosmosNodeClient_1 = require("./node/CosmosNodeClient");
22
+ Object.defineProperty(exports, "CosmosNodeClient", { enumerable: true, get: function () { return CosmosNodeClient_1.CosmosNodeClient; } });
23
+ var CosmosSendMessage_1 = require("./types/data/transaction/message/CosmosSendMessage");
24
+ Object.defineProperty(exports, "CosmosSendMessage", { enumerable: true, get: function () { return CosmosSendMessage_1.CosmosSendMessage; } });
25
+ var CosmosDelegateMessage_1 = require("./types/data/transaction/message/CosmosDelegateMessage");
26
+ Object.defineProperty(exports, "CosmosDelegateMessage", { enumerable: true, get: function () { return CosmosDelegateMessage_1.CosmosDelegateMessage; } });
27
+ var CosmosWithdrawDelegationRewardMessage_1 = require("./types/data/transaction/message/CosmosWithdrawDelegationRewardMessage");
28
+ Object.defineProperty(exports, "CosmosWithdrawDelegationRewardMessage", { enumerable: true, get: function () { return CosmosWithdrawDelegationRewardMessage_1.CosmosWithdrawDelegationRewardMessage; } });
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,oEAAqH;AA2CxF,uGA3CA,2CAAsB,OA2CA;AAxCnD,4DAA0D;AAqDxD,8FArDO,6BAAa,OAqDP;AApDf,sDAAoD;AAqDlD,2FArDO,uBAAU,OAqDP;AApDZ,oDAAkD;AAqDhD,0FArDO,qBAAS,OAqDP;AApDX,mDAK4B;AA0C1B,2GA3CA,wCAA0B,OA2CA;AAzC5B,gFAA8E;AAuC5E,kGAvCO,qCAAiB,OAuCP;AAtBnB,iGAKgE;AAgD9D,kHApDA,yDAAiC,OAoDA;AACjC,uHApDA,8DAAsC,OAoDA;AACtC,sHApDA,6DAAqC,OAoDA;AACrC,mHApDA,0DAAkC,OAoDA;AAlDpC,4DAA0D;AAQsB,iGARvE,mCAAgB,OAQuE;AAPhG,wFAAsF;AAyBpF,kGAzBO,qCAAiB,OAyBP;AAvBnB,gGAA8F;AAwB5F,sGAxBO,6CAAqB,OAwBP;AAvBvB,gIAA8H;AAwB5H,sHAxBO,6EAAqC,OAwBP"}
@@ -0,0 +1,29 @@
1
+ import BigNumber from '@wallfree-dev/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
2
+ import { Amount } from '@wallfree-dev/module-kit';
3
+ import { CosmosAccount, CosmosDelegation, CosmosNodeInfo, CosmosPagedSendTxsResponse, CosmosRewardDetails, CosmosUnbondingDelegation, CosmosValidator } from '../types/rpc';
4
+ export declare class CosmosNodeClient<Units extends string> {
5
+ readonly baseURL: string;
6
+ useCORSProxy: boolean;
7
+ constructor(baseURL: string, useCORSProxy?: boolean);
8
+ fetchBalance(address: string, denom: Units): Promise<{
9
+ total: Amount<Units>;
10
+ available: Amount<Units>;
11
+ }>;
12
+ fetchSendTransactionsFor(address: string, limit: number, offset: number, isSender?: boolean): Promise<CosmosPagedSendTxsResponse>;
13
+ fetchNodeInfo(): Promise<CosmosNodeInfo>;
14
+ broadcastSignedTransaction(tx_bytes: string): Promise<string>;
15
+ fetchAccount(address: string): Promise<CosmosAccount>;
16
+ fetchDelegations(address: string, filterEmpty?: boolean): Promise<CosmosDelegation[]>;
17
+ fetchTotalDelegatedAmount(address: string, denom: Units): Promise<Amount<Units>>;
18
+ fetchValidator(address: string): Promise<CosmosValidator>;
19
+ fetchValidators(): Promise<CosmosValidator[]>;
20
+ fetchSelfDelegation(validatorAddress: string): Promise<CosmosDelegation>;
21
+ fetchUnbondingDelegations(delegatorAddress: string): Promise<CosmosUnbondingDelegation[]>;
22
+ fetchTotalUnbondingAmount(address: string, denom: Units): Promise<Amount<Units>>;
23
+ fetchRewardDetails(delegatorAddress: string): Promise<CosmosRewardDetails[]>;
24
+ fetchTotalReward(delegatorAddress: string, denom: Units): Promise<Amount<Units>>;
25
+ fetchRewardForDelegation(delegatorAddress: string, validatorAddress: string, denom: Units): Promise<Amount<Units>>;
26
+ withdrawAllDelegationRewards(delegatorAddress: string, chainID: string, accountNumber: string, sequence: string, gas: BigNumber, fee: BigNumber, memo: string, simulate?: boolean): Promise<string>;
27
+ withdrawDelegationRewards(delegatorAddress: string, validatorAdress: string, chainID: string, accountNumber: string, sequence: string, gas: BigNumber, fee: BigNumber, memo: string, simulate?: boolean): Promise<string>;
28
+ private url;
29
+ }
@@ -0,0 +1,383 @@
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;
13
+ return g = { next: verb(0), "throw": verb(1), "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 (_) 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
+ exports.CosmosNodeClient = void 0;
43
+ var index_1 = __importDefault(require("@wallfree-dev/coinlib-core/dependencies/src/axios-0.19.0/index"));
44
+ var bignumber_1 = __importDefault(require("@wallfree-dev/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
45
+ var module_kit_1 = require("@wallfree-dev/module-kit");
46
+ var CosmosCoin_1 = require("../types/data/CosmosCoin");
47
+ var CosmosNodeClient = /** @class */ (function () {
48
+ function CosmosNodeClient(baseURL, useCORSProxy) {
49
+ if (useCORSProxy === void 0) { useCORSProxy = false; }
50
+ this.baseURL = baseURL;
51
+ this.useCORSProxy = useCORSProxy;
52
+ }
53
+ CosmosNodeClient.prototype.fetchBalance = function (address, denom) {
54
+ return __awaiter(this, void 0, void 0, function () {
55
+ var response, data, availableBalance, totalBalance;
56
+ return __generator(this, function (_a) {
57
+ switch (_a.label) {
58
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/bank/v1beta1/balances/".concat(address)))];
59
+ case 1:
60
+ response = _a.sent();
61
+ data = response.data.balances;
62
+ if (!(data.length > 0)) return [3 /*break*/, 3];
63
+ availableBalance = CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(data), denom);
64
+ return [4 /*yield*/, Promise.all([
65
+ this.fetchTotalReward(address, denom),
66
+ this.fetchTotalUnbondingAmount(address, denom),
67
+ this.fetchTotalDelegatedAmount(address, denom)
68
+ ])];
69
+ case 2:
70
+ totalBalance = (_a.sent()).reduce(function (current, next) { return current.plus(next.value); }, new bignumber_1.default(availableBalance));
71
+ return [2 /*return*/, {
72
+ total: (0, module_kit_1.newAmount)(totalBalance.decimalPlaces(0, bignumber_1.default.ROUND_FLOOR), denom),
73
+ available: (0, module_kit_1.newAmount)(availableBalance.decimalPlaces(0, bignumber_1.default.ROUND_FLOOR), denom)
74
+ }];
75
+ case 3: return [2 /*return*/, { total: (0, module_kit_1.newAmount)(new bignumber_1.default(0), denom), available: (0, module_kit_1.newAmount)(new bignumber_1.default(0), denom) }];
76
+ }
77
+ });
78
+ });
79
+ };
80
+ CosmosNodeClient.prototype.fetchSendTransactionsFor = function (address, limit, offset, isSender) {
81
+ if (isSender === void 0) { isSender = true; }
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var response;
84
+ return __generator(this, function (_a) {
85
+ switch (_a.label) {
86
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/tx/v1beta1/txs?events=".concat(isSender ? 'transfer.sender' : 'transfer.recipient', "='").concat(address, "'&events=tx.height=0&pagination.limit=").concat(limit, "&pagination.offset=").concat(offset, "&orderBy=2")))];
87
+ case 1:
88
+ response = _a.sent();
89
+ return [2 /*return*/, response.data];
90
+ }
91
+ });
92
+ });
93
+ };
94
+ CosmosNodeClient.prototype.fetchNodeInfo = function () {
95
+ return __awaiter(this, void 0, void 0, function () {
96
+ var response, nodeInfo;
97
+ return __generator(this, function (_a) {
98
+ switch (_a.label) {
99
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/base/tendermint/v1beta1/node_info"))];
100
+ case 1:
101
+ response = _a.sent();
102
+ nodeInfo = response.data.default_node_info;
103
+ return [2 /*return*/, nodeInfo];
104
+ }
105
+ });
106
+ });
107
+ };
108
+ CosmosNodeClient.prototype.broadcastSignedTransaction = function (tx_bytes) {
109
+ return __awaiter(this, void 0, void 0, function () {
110
+ var response;
111
+ return __generator(this, function (_a) {
112
+ switch (_a.label) {
113
+ case 0: return [4 /*yield*/, index_1.default.post(this.url("/cosmos/tx/v1beta1/txs"), {
114
+ tx_bytes: tx_bytes,
115
+ mode: 'BROADCAST_MODE_ASYNC'
116
+ }, {
117
+ headers: {
118
+ 'Content-type': 'application/json'
119
+ }
120
+ })];
121
+ case 1:
122
+ response = _a.sent();
123
+ return [2 /*return*/, response.data.tx_response.txhash];
124
+ }
125
+ });
126
+ });
127
+ };
128
+ CosmosNodeClient.prototype.fetchAccount = function (address) {
129
+ return __awaiter(this, void 0, void 0, function () {
130
+ var response, account;
131
+ return __generator(this, function (_a) {
132
+ switch (_a.label) {
133
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/auth/v1beta1/accounts/".concat(address)))];
134
+ case 1:
135
+ response = _a.sent();
136
+ account = response.data.account;
137
+ return [2 /*return*/, account];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ CosmosNodeClient.prototype.fetchDelegations = function (address, filterEmpty) {
143
+ if (filterEmpty === void 0) { filterEmpty = true; }
144
+ return __awaiter(this, void 0, void 0, function () {
145
+ var response, delegations;
146
+ return __generator(this, function (_a) {
147
+ switch (_a.label) {
148
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/staking/v1beta1/delegations/".concat(address)))];
149
+ case 1:
150
+ response = _a.sent();
151
+ if (response.data === null) {
152
+ return [2 /*return*/, []];
153
+ }
154
+ delegations = response.data.delegation_responses;
155
+ return [2 /*return*/, filterEmpty ? delegations.filter(function (delegation) { return new bignumber_1.default(delegation.balance.amount).gt(0); }) : delegations];
156
+ }
157
+ });
158
+ });
159
+ };
160
+ CosmosNodeClient.prototype.fetchTotalDelegatedAmount = function (address, denom) {
161
+ return __awaiter(this, void 0, void 0, function () {
162
+ var delegations, balances;
163
+ return __generator(this, function (_a) {
164
+ switch (_a.label) {
165
+ case 0: return [4 /*yield*/, this.fetchDelegations(address)];
166
+ case 1:
167
+ delegations = _a.sent();
168
+ balances = delegations.map(function (delegation) { return delegation.balance; });
169
+ return [2 /*return*/, (0, module_kit_1.newAmount)(CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(balances), denom).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR), denom)];
170
+ }
171
+ });
172
+ });
173
+ };
174
+ CosmosNodeClient.prototype.fetchValidator = function (address) {
175
+ return __awaiter(this, void 0, void 0, function () {
176
+ var response, validator;
177
+ return __generator(this, function (_a) {
178
+ switch (_a.label) {
179
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/staking/v1beta1/validators/".concat(address)))];
180
+ case 1:
181
+ response = _a.sent();
182
+ validator = response.data.validator;
183
+ return [2 /*return*/, validator];
184
+ }
185
+ });
186
+ });
187
+ };
188
+ CosmosNodeClient.prototype.fetchValidators = function () {
189
+ return __awaiter(this, void 0, void 0, function () {
190
+ var response, validators;
191
+ return __generator(this, function (_a) {
192
+ switch (_a.label) {
193
+ case 0: return [4 /*yield*/, index_1.default.get(this.url('/cosmos/staking/v1beta1/validators'))];
194
+ case 1:
195
+ response = _a.sent();
196
+ validators = response.data.validators;
197
+ return [2 /*return*/, validators];
198
+ }
199
+ });
200
+ });
201
+ };
202
+ CosmosNodeClient.prototype.fetchSelfDelegation = function (validatorAddress) {
203
+ return __awaiter(this, void 0, void 0, function () {
204
+ var validatorInfo, operatorAddress, response, delegation;
205
+ return __generator(this, function (_a) {
206
+ switch (_a.label) {
207
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/distribution/v1beta1/validators/".concat(validatorAddress)))];
208
+ case 1:
209
+ validatorInfo = _a.sent();
210
+ operatorAddress = validatorInfo.data.operator_address;
211
+ return [4 /*yield*/, index_1.default.get(this.url("/cosmos/staking/v1beta1/validators/".concat(validatorAddress, "/delegations/").concat(operatorAddress)))];
212
+ case 2:
213
+ response = _a.sent();
214
+ delegation = response.data.delegation_response;
215
+ return [2 /*return*/, delegation];
216
+ }
217
+ });
218
+ });
219
+ };
220
+ CosmosNodeClient.prototype.fetchUnbondingDelegations = function (delegatorAddress) {
221
+ return __awaiter(this, void 0, void 0, function () {
222
+ var response, unbondingDelegations;
223
+ return __generator(this, function (_a) {
224
+ switch (_a.label) {
225
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/staking/v1beta1/delegators/".concat(delegatorAddress, "/unbonding_delegations")))];
226
+ case 1:
227
+ response = _a.sent();
228
+ unbondingDelegations = response.data.unbonding_responses;
229
+ return [2 /*return*/, unbondingDelegations];
230
+ }
231
+ });
232
+ });
233
+ };
234
+ CosmosNodeClient.prototype.fetchTotalUnbondingAmount = function (address, denom) {
235
+ return __awaiter(this, void 0, void 0, function () {
236
+ var unbondingDelegations, unbondings, total;
237
+ return __generator(this, function (_a) {
238
+ switch (_a.label) {
239
+ case 0: return [4 /*yield*/, this.fetchUnbondingDelegations(address)];
240
+ case 1:
241
+ unbondingDelegations = _a.sent();
242
+ if (unbondingDelegations) {
243
+ unbondings = unbondingDelegations.map(function (delegation) { return delegation.entries; }).reduce(function (current, next) { return current.concat(next); }, []);
244
+ total = unbondings
245
+ .reduce(function (current, next) { return current.plus(new bignumber_1.default(next.balance)); }, new bignumber_1.default(0))
246
+ .decimalPlaces(0, bignumber_1.default.ROUND_FLOOR);
247
+ return [2 /*return*/, (0, module_kit_1.newAmount)(total, denom)];
248
+ }
249
+ return [2 /*return*/, (0, module_kit_1.newAmount)(new bignumber_1.default(0), denom)];
250
+ }
251
+ });
252
+ });
253
+ };
254
+ CosmosNodeClient.prototype.fetchRewardDetails = function (delegatorAddress) {
255
+ return __awaiter(this, void 0, void 0, function () {
256
+ return __generator(this, function (_a) {
257
+ return [2 /*return*/, index_1.default.get(this.url("/cosmos/distribution/v1beta1/delegators/".concat(delegatorAddress, "/rewards")))
258
+ .then(function (response) { var _a; return ((_a = response.data.rewards) !== null && _a !== void 0 ? _a : []); })
259
+ .catch(function () { return []; })];
260
+ });
261
+ });
262
+ };
263
+ CosmosNodeClient.prototype.fetchTotalReward = function (delegatorAddress, denom) {
264
+ return __awaiter(this, void 0, void 0, function () {
265
+ var totalRewards;
266
+ return __generator(this, function (_a) {
267
+ switch (_a.label) {
268
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/distribution/v1beta1/delegators/".concat(delegatorAddress, "/rewards")))
269
+ .then(function (response) { return response.data.total; })
270
+ .catch(function () { return []; })];
271
+ case 1:
272
+ totalRewards = _a.sent();
273
+ if ((totalRewards === null || totalRewards === void 0 ? void 0 : totalRewards.length) > 0) {
274
+ return [2 /*return*/, (0, module_kit_1.newAmount)(CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(totalRewards), denom).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR), denom)];
275
+ }
276
+ return [2 /*return*/, (0, module_kit_1.newAmount)(new bignumber_1.default(0), denom)];
277
+ }
278
+ });
279
+ });
280
+ };
281
+ CosmosNodeClient.prototype.fetchRewardForDelegation = function (delegatorAddress, validatorAddress, denom) {
282
+ return __awaiter(this, void 0, void 0, function () {
283
+ var totalRewards;
284
+ return __generator(this, function (_a) {
285
+ switch (_a.label) {
286
+ case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/distribution/v1beta1/delegators/".concat(delegatorAddress, "/rewards/").concat(validatorAddress)))
287
+ .then(function (response) { return response.data.rewards; })
288
+ .catch(function () { return []; })];
289
+ case 1:
290
+ totalRewards = _a.sent();
291
+ if ((totalRewards === null || totalRewards === void 0 ? void 0 : totalRewards.length) > 0) {
292
+ return [2 /*return*/, (0, module_kit_1.newAmount)(CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(totalRewards), denom).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR), denom)];
293
+ }
294
+ return [2 /*return*/, (0, module_kit_1.newAmount)(new bignumber_1.default(0), denom)];
295
+ }
296
+ });
297
+ });
298
+ };
299
+ CosmosNodeClient.prototype.withdrawAllDelegationRewards = function (delegatorAddress, chainID, accountNumber, sequence, gas, fee, memo, simulate) {
300
+ if (simulate === void 0) { simulate = false; }
301
+ return __awaiter(this, void 0, void 0, function () {
302
+ var body, response;
303
+ return __generator(this, function (_a) {
304
+ switch (_a.label) {
305
+ case 0:
306
+ body = {
307
+ base_req: {
308
+ from: delegatorAddress,
309
+ memo: memo,
310
+ chain_id: chainID,
311
+ account_number: accountNumber,
312
+ sequence: sequence,
313
+ gas: gas.toFixed(),
314
+ gas_adjustment: '1.2',
315
+ fees: [
316
+ {
317
+ denom: 'uatom',
318
+ amount: fee.toFixed()
319
+ }
320
+ ],
321
+ simulate: simulate
322
+ }
323
+ };
324
+ return [4 /*yield*/, index_1.default.post(this.url("/distribution/delegators/".concat(delegatorAddress, "/rewards")), JSON.stringify(body), {
325
+ headers: {
326
+ 'Content-type': 'application/json'
327
+ }
328
+ })];
329
+ case 1:
330
+ response = _a.sent();
331
+ return [2 /*return*/, response.data.hash];
332
+ }
333
+ });
334
+ });
335
+ };
336
+ CosmosNodeClient.prototype.withdrawDelegationRewards = function (delegatorAddress, validatorAdress, chainID, accountNumber, sequence, gas, fee, memo, simulate) {
337
+ if (simulate === void 0) { simulate = false; }
338
+ return __awaiter(this, void 0, void 0, function () {
339
+ var body, response;
340
+ return __generator(this, function (_a) {
341
+ switch (_a.label) {
342
+ case 0:
343
+ body = {
344
+ base_req: {
345
+ from: delegatorAddress,
346
+ memo: memo,
347
+ chain_id: chainID,
348
+ account_number: accountNumber,
349
+ sequence: sequence,
350
+ gas: gas.toFixed(),
351
+ gas_adjustment: '1.2',
352
+ fees: [
353
+ {
354
+ denom: 'uatom',
355
+ amount: fee.toFixed()
356
+ }
357
+ ],
358
+ simulate: simulate
359
+ }
360
+ };
361
+ return [4 /*yield*/, index_1.default.post(this.url("/distribution/delegators/".concat(delegatorAddress, "/rewards/").concat(validatorAdress)), JSON.stringify(body), {
362
+ headers: {
363
+ 'Content-type': 'application/json'
364
+ }
365
+ })];
366
+ case 1:
367
+ response = _a.sent();
368
+ return [2 /*return*/, response.data.hash];
369
+ }
370
+ });
371
+ });
372
+ };
373
+ CosmosNodeClient.prototype.url = function (path) {
374
+ var result = "".concat(this.baseURL).concat(path);
375
+ if (this.useCORSProxy) {
376
+ result = "https://cors-proxy.airgap.prod.gke.papers.tech/proxy?url=".concat(encodeURI(result));
377
+ }
378
+ return result;
379
+ };
380
+ return CosmosNodeClient;
381
+ }());
382
+ exports.CosmosNodeClient = CosmosNodeClient;
383
+ //# sourceMappingURL=CosmosNodeClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/CosmosNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yGAAqG;AACrG,uHAAgG;AAChG,uDAA4D;AAE5D,uDAAqD;AAarD;IACE,0BACkB,OAAe,EACxB,YAA6B;QAA7B,6BAAA,EAAA,oBAA6B;QADpB,YAAO,GAAP,OAAO,CAAQ;QACxB,iBAAY,GAAZ,YAAY,CAAiB;IACnC,CAAC;IAES,uCAAY,GAAzB,UAA0B,OAAe,EAAE,KAAY;;;;;4BACpC,qBAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,wCAAiC,OAAO,CAAE,CAAC,CAAC,EAAA;;wBAAhF,QAAQ,GAAG,SAAqE;wBAEhF,IAAI,GAAwB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAA;6BAEpD,CAAA,IAAI,CAA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