@firmachain/firma-js 0.2.36 → 0.2.37
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/package.json +5 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -20
- package/dist/sdk/FirmaAuthzService.d.ts +0 -41
- package/dist/sdk/FirmaAuthzService.js +0 -633
- package/dist/sdk/FirmaBankService.d.ts +0 -17
- package/dist/sdk/FirmaBankService.js +0 -236
- package/dist/sdk/FirmaChainService.d.ts +0 -8
- package/dist/sdk/FirmaChainService.js +0 -86
- package/dist/sdk/FirmaConfig.d.ts +0 -18
- package/dist/sdk/FirmaConfig.js +0 -63
- package/dist/sdk/FirmaContractService.d.ts +0 -32
- package/dist/sdk/FirmaContractService.js +0 -434
- package/dist/sdk/FirmaCosmWasmService.d.ts +0 -38
- package/dist/sdk/FirmaCosmWasmService.js +0 -667
- package/dist/sdk/FirmaDistributionService.d.ts +0 -32
- package/dist/sdk/FirmaDistributionService.js +0 -527
- package/dist/sdk/FirmaFeeGrantService.d.ts +0 -21
- package/dist/sdk/FirmaFeeGrantService.js +0 -341
- package/dist/sdk/FirmaGovService.d.ts +0 -35
- package/dist/sdk/FirmaGovService.js +0 -775
- package/dist/sdk/FirmaIbcService.d.ts +0 -15
- package/dist/sdk/FirmaIbcService.js +0 -144
- package/dist/sdk/FirmaIpfsService.d.ts +0 -12
- package/dist/sdk/FirmaIpfsService.js +0 -185
- package/dist/sdk/FirmaMobileSDK.d.ts +0 -29
- package/dist/sdk/FirmaMobileSDK.js +0 -48
- package/dist/sdk/FirmaNftService.d.ts +0 -31
- package/dist/sdk/FirmaNftService.js +0 -372
- package/dist/sdk/FirmaSDK.d.ts +0 -35
- package/dist/sdk/FirmaSDK.js +0 -57
- package/dist/sdk/FirmaSlashingService.d.ts +0 -9
- package/dist/sdk/FirmaSlashingService.js +0 -105
- package/dist/sdk/FirmaStakingService.d.ts +0 -47
- package/dist/sdk/FirmaStakingService.js +0 -611
- package/dist/sdk/FirmaTokenService.d.ts +0 -26
- package/dist/sdk/FirmaTokenService.js +0 -416
- package/dist/sdk/FirmaUtil.d.ts +0 -56
- package/dist/sdk/FirmaUtil.js +0 -430
- package/dist/sdk/FirmaWalletService.d.ts +0 -39
- package/dist/sdk/FirmaWalletService.js +0 -317
- package/dist/sdk/firmachain/amino/addresses.d.ts +0 -5
- package/dist/sdk/firmachain/amino/addresses.js +0 -46
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +0 -281
- package/dist/sdk/firmachain/amino/aminomsgs.js +0 -77
- package/dist/sdk/firmachain/amino/aminotypes.d.ts +0 -22
- package/dist/sdk/firmachain/amino/aminotypes.js +0 -525
- package/dist/sdk/firmachain/amino/coins.d.ts +0 -30
- package/dist/sdk/firmachain/amino/coins.js +0 -69
- package/dist/sdk/firmachain/amino/encoding.d.ts +0 -24
- package/dist/sdk/firmachain/amino/encoding.js +0 -238
- package/dist/sdk/firmachain/amino/multisig.d.ts +0 -10
- package/dist/sdk/firmachain/amino/multisig.js +0 -42
- package/dist/sdk/firmachain/amino/paths.d.ts +0 -6
- package/dist/sdk/firmachain/amino/paths.js +0 -18
- package/dist/sdk/firmachain/amino/pubkeys.d.ts +0 -47
- package/dist/sdk/firmachain/amino/pubkeys.js +0 -29
- package/dist/sdk/firmachain/amino/signature.d.ts +0 -16
- package/dist/sdk/firmachain/amino/signature.js +0 -36
- package/dist/sdk/firmachain/amino/signdoc.d.ts +0 -26
- package/dist/sdk/firmachain/amino/signdoc.js +0 -42
- package/dist/sdk/firmachain/amino/signer.d.ts +0 -32
- package/dist/sdk/firmachain/amino/signer.js +0 -2
- package/dist/sdk/firmachain/amino/stdtx.d.ts +0 -15
- package/dist/sdk/firmachain/amino/stdtx.js +0 -17
- package/dist/sdk/firmachain/amino/wallet.d.ts +0 -32
- package/dist/sdk/firmachain/amino/wallet.js +0 -136
- package/dist/sdk/firmachain/authz/AuthzQueryClient.d.ts +0 -48
- package/dist/sdk/firmachain/authz/AuthzQueryClient.js +0 -142
- package/dist/sdk/firmachain/authz/AuthzTxClient.d.ts +0 -23
- package/dist/sdk/firmachain/authz/AuthzTxClient.js +0 -47
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +0 -147
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +0 -358
- package/dist/sdk/firmachain/authz/index.d.ts +0 -3
- package/dist/sdk/firmachain/authz/index.js +0 -19
- package/dist/sdk/firmachain/bank/BankQueryClient.d.ts +0 -12
- package/dist/sdk/firmachain/bank/BankQueryClient.js +0 -116
- package/dist/sdk/firmachain/bank/BankTxClient.d.ts +0 -18
- package/dist/sdk/firmachain/bank/BankTxClient.js +0 -43
- package/dist/sdk/firmachain/bank/index.d.ts +0 -3
- package/dist/sdk/firmachain/bank/index.js +0 -19
- package/dist/sdk/firmachain/common/CommonTxClient.d.ts +0 -7
- package/dist/sdk/firmachain/common/CommonTxClient.js +0 -79
- package/dist/sdk/firmachain/common/ITxClient.d.ts +0 -18
- package/dist/sdk/firmachain/common/ITxClient.js +0 -117
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +0 -27
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +0 -165
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +0 -14
- package/dist/sdk/firmachain/common/LedgerWallet.js +0 -151
- package/dist/sdk/firmachain/common/QueryCommon.d.ts +0 -4
- package/dist/sdk/firmachain/common/QueryCommon.js +0 -2
- package/dist/sdk/firmachain/common/TendermintQueryClient.d.ts +0 -42
- package/dist/sdk/firmachain/common/TendermintQueryClient.js +0 -111
- package/dist/sdk/firmachain/common/TxCommon.d.ts +0 -87
- package/dist/sdk/firmachain/common/TxCommon.js +0 -18
- package/dist/sdk/firmachain/common/accounts.d.ts +0 -16
- package/dist/sdk/firmachain/common/accounts.js +0 -64
- package/dist/sdk/firmachain/common/index.d.ts +0 -2
- package/dist/sdk/firmachain/common/index.js +0 -18
- package/dist/sdk/firmachain/common/signing.d.ts +0 -10
- package/dist/sdk/firmachain/common/signing.js +0 -79
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +0 -44
- package/dist/sdk/firmachain/common/signingstargateclient.js +0 -361
- package/dist/sdk/firmachain/common/stargateclient.d.ts +0 -46
- package/dist/sdk/firmachain/common/stargateclient.js +0 -211
- package/dist/sdk/firmachain/contract/ContractQueryClient.d.ts +0 -32
- package/dist/sdk/firmachain/contract/ContractQueryClient.js +0 -156
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +0 -18
- package/dist/sdk/firmachain/contract/ContractTxClient.js +0 -43
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +0 -69
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +0 -483
- package/dist/sdk/firmachain/contract/index.d.ts +0 -3
- package/dist/sdk/firmachain/contract/index.js +0 -19
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.d.ts +0 -52
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +0 -193
- package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.d.ts +0 -38
- package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.js +0 -59
- package/dist/sdk/firmachain/cosmwasm/index.d.ts +0 -3
- package/dist/sdk/firmachain/cosmwasm/index.js +0 -19
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.d.ts +0 -18
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +0 -167
- package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +0 -28
- package/dist/sdk/firmachain/distribution/DistributionTxClient.js +0 -51
- package/dist/sdk/firmachain/distribution/index.d.ts +0 -3
- package/dist/sdk/firmachain/distribution/index.js +0 -19
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.d.ts +0 -17
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +0 -86
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +0 -18
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +0 -43
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +0 -76
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +0 -194
- package/dist/sdk/firmachain/feegrant/index.d.ts +0 -2
- package/dist/sdk/firmachain/feegrant/index.js +0 -19
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +0 -128
- package/dist/sdk/firmachain/google/protobuf/any.js +0 -106
- package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +0 -996
- package/dist/sdk/firmachain/google/protobuf/descriptor.js +0 -5329
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +0 -91
- package/dist/sdk/firmachain/google/protobuf/duration.js +0 -107
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +0 -109
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +0 -107
- package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +0 -61
- package/dist/sdk/firmachain/gov/GovQueryClient.js +0 -152
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +0 -23
- package/dist/sdk/firmachain/gov/GovTxClient.js +0 -47
- package/dist/sdk/firmachain/gov/index.d.ts +0 -3
- package/dist/sdk/firmachain/gov/index.js +0 -19
- package/dist/sdk/firmachain/ibc/IbcQueryClient.d.ts +0 -34
- package/dist/sdk/firmachain/ibc/IbcQueryClient.js +0 -71
- package/dist/sdk/firmachain/ibc/IbcTxClient.d.ts +0 -13
- package/dist/sdk/firmachain/ibc/IbcTxClient.js +0 -39
- package/dist/sdk/firmachain/ibc/index.d.ts +0 -3
- package/dist/sdk/firmachain/ibc/index.js +0 -19
- package/dist/sdk/firmachain/nft/NftQueryClient.d.ts +0 -20
- package/dist/sdk/firmachain/nft/NftQueryClient.js +0 -125
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +0 -23
- package/dist/sdk/firmachain/nft/NftTxClient.js +0 -47
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +0 -86
- package/dist/sdk/firmachain/nft/NftTxTypes.js +0 -424
- package/dist/sdk/firmachain/nft/index.d.ts +0 -3
- package/dist/sdk/firmachain/nft/index.js +0 -19
- package/dist/sdk/firmachain/slashing/SlashingQueryClient.d.ts +0 -22
- package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +0 -101
- package/dist/sdk/firmachain/slashing/index.d.ts +0 -2
- package/dist/sdk/firmachain/slashing/index.js +0 -18
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +0 -106
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -243
- package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +0 -33
- package/dist/sdk/firmachain/staking/StakingTxClient.js +0 -55
- package/dist/sdk/firmachain/staking/index.d.ts +0 -3
- package/dist/sdk/firmachain/staking/index.js +0 -19
- package/dist/sdk/firmachain/token/TokenQueryClient.d.ts +0 -24
- package/dist/sdk/firmachain/token/TokenQueryClient.js +0 -106
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +0 -28
- package/dist/sdk/firmachain/token/TokenTxClient.js +0 -51
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +0 -116
- package/dist/sdk/firmachain/token/TokenTxTypes.js +0 -685
- package/dist/sdk/firmachain/token/index.d.ts +0 -3
- package/dist/sdk/firmachain/token/index.js +0 -19
|
@@ -1,667 +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;
|
|
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.FirmaCosmWasmService = void 0;
|
|
43
|
-
var cosmwasm_1 = require("./firmachain/cosmwasm");
|
|
44
|
-
var encoding_1 = require("@cosmjs/encoding");
|
|
45
|
-
var FirmaUtil_1 = require("./FirmaUtil");
|
|
46
|
-
var pako_1 = __importDefault(require("pako"));
|
|
47
|
-
var long_1 = __importDefault(require("long"));
|
|
48
|
-
var FirmaCosmWasmService = /** @class */ (function () {
|
|
49
|
-
function FirmaCosmWasmService(config) {
|
|
50
|
-
this.config = config;
|
|
51
|
-
}
|
|
52
|
-
FirmaCosmWasmService.prototype.getTxClient = function (wallet) {
|
|
53
|
-
return new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
54
|
-
};
|
|
55
|
-
FirmaCosmWasmService.prototype.getGasEstimationStoreCode = function (wallet, wasmCode, accessConfig, txMisc) {
|
|
56
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
var txRaw, error_1;
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
switch (_a.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
_a.trys.push([0, 3, , 4]);
|
|
63
|
-
return [4 /*yield*/, this.getSignedTxStoreCode(wallet, wasmCode, accessConfig, txMisc)];
|
|
64
|
-
case 1:
|
|
65
|
-
txRaw = _a.sent();
|
|
66
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
67
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
68
|
-
case 3:
|
|
69
|
-
error_1 = _a.sent();
|
|
70
|
-
FirmaUtil_1.FirmaUtil.printLog(error_1);
|
|
71
|
-
throw error_1;
|
|
72
|
-
case 4: return [2 /*return*/];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
FirmaCosmWasmService.prototype.storeCode = function (wallet, wasmCode, accessConfig, txMisc) {
|
|
78
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
var txRaw, bankTxClient, error_2;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0:
|
|
84
|
-
_a.trys.push([0, 3, , 4]);
|
|
85
|
-
return [4 /*yield*/, this.getSignedTxStoreCode(wallet, wasmCode, accessConfig, txMisc)];
|
|
86
|
-
case 1:
|
|
87
|
-
txRaw = _a.sent();
|
|
88
|
-
bankTxClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
89
|
-
return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
|
|
90
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
91
|
-
case 3:
|
|
92
|
-
error_2 = _a.sent();
|
|
93
|
-
FirmaUtil_1.FirmaUtil.printLog(error_2);
|
|
94
|
-
throw error_2;
|
|
95
|
-
case 4: return [2 /*return*/];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
FirmaCosmWasmService.prototype.getGasEstimationUpdateAdmin = function (wallet, contractAddress, adminAddress, txMisc) {
|
|
101
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
102
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
-
var txRaw, error_3;
|
|
104
|
-
return __generator(this, function (_a) {
|
|
105
|
-
switch (_a.label) {
|
|
106
|
-
case 0:
|
|
107
|
-
_a.trys.push([0, 3, , 4]);
|
|
108
|
-
return [4 /*yield*/, this.getSignedTxUpdateAdmin(wallet, contractAddress, adminAddress, txMisc)];
|
|
109
|
-
case 1:
|
|
110
|
-
txRaw = _a.sent();
|
|
111
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
112
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
113
|
-
case 3:
|
|
114
|
-
error_3 = _a.sent();
|
|
115
|
-
FirmaUtil_1.FirmaUtil.printLog(error_3);
|
|
116
|
-
throw error_3;
|
|
117
|
-
case 4: return [2 /*return*/];
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
FirmaCosmWasmService.prototype.updateAdmin = function (wallet, contractAddress, adminAddress, txMisc) {
|
|
123
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
124
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
-
var txRaw, bankTxClient, error_4;
|
|
126
|
-
return __generator(this, function (_a) {
|
|
127
|
-
switch (_a.label) {
|
|
128
|
-
case 0:
|
|
129
|
-
_a.trys.push([0, 3, , 4]);
|
|
130
|
-
return [4 /*yield*/, this.getSignedTxUpdateAdmin(wallet, contractAddress, adminAddress, txMisc)];
|
|
131
|
-
case 1:
|
|
132
|
-
txRaw = _a.sent();
|
|
133
|
-
bankTxClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
134
|
-
return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
|
|
135
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
136
|
-
case 3:
|
|
137
|
-
error_4 = _a.sent();
|
|
138
|
-
FirmaUtil_1.FirmaUtil.printLog(error_4);
|
|
139
|
-
throw error_4;
|
|
140
|
-
case 4: return [2 /*return*/];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
FirmaCosmWasmService.prototype.getGasEstimationClearAdmin = function (wallet, contractAddress, txMisc) {
|
|
146
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
147
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
-
var txRaw, error_5;
|
|
149
|
-
return __generator(this, function (_a) {
|
|
150
|
-
switch (_a.label) {
|
|
151
|
-
case 0:
|
|
152
|
-
_a.trys.push([0, 3, , 4]);
|
|
153
|
-
return [4 /*yield*/, this.getSignedTxClearAdmin(wallet, contractAddress, txMisc)];
|
|
154
|
-
case 1:
|
|
155
|
-
txRaw = _a.sent();
|
|
156
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
157
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
158
|
-
case 3:
|
|
159
|
-
error_5 = _a.sent();
|
|
160
|
-
FirmaUtil_1.FirmaUtil.printLog(error_5);
|
|
161
|
-
throw error_5;
|
|
162
|
-
case 4: return [2 /*return*/];
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
FirmaCosmWasmService.prototype.clearAdmin = function (wallet, contractAddress, txMisc) {
|
|
168
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
169
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
170
|
-
var txRaw, bankTxClient, error_6;
|
|
171
|
-
return __generator(this, function (_a) {
|
|
172
|
-
switch (_a.label) {
|
|
173
|
-
case 0:
|
|
174
|
-
_a.trys.push([0, 3, , 4]);
|
|
175
|
-
return [4 /*yield*/, this.getSignedTxClearAdmin(wallet, contractAddress, txMisc)];
|
|
176
|
-
case 1:
|
|
177
|
-
txRaw = _a.sent();
|
|
178
|
-
bankTxClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
179
|
-
return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
|
|
180
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
181
|
-
case 3:
|
|
182
|
-
error_6 = _a.sent();
|
|
183
|
-
FirmaUtil_1.FirmaUtil.printLog(error_6);
|
|
184
|
-
throw error_6;
|
|
185
|
-
case 4: return [2 /*return*/];
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
FirmaCosmWasmService.prototype.getGasEstimationMigrateContract = function (wallet, contractAddress, codeId, msg, txMisc) {
|
|
191
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
192
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
193
|
-
var txRaw, error_7;
|
|
194
|
-
return __generator(this, function (_a) {
|
|
195
|
-
switch (_a.label) {
|
|
196
|
-
case 0:
|
|
197
|
-
_a.trys.push([0, 3, , 4]);
|
|
198
|
-
return [4 /*yield*/, this.getSignedTxMigrateContract(wallet, contractAddress, codeId, msg, txMisc)];
|
|
199
|
-
case 1:
|
|
200
|
-
txRaw = _a.sent();
|
|
201
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
202
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
203
|
-
case 3:
|
|
204
|
-
error_7 = _a.sent();
|
|
205
|
-
FirmaUtil_1.FirmaUtil.printLog(error_7);
|
|
206
|
-
throw error_7;
|
|
207
|
-
case 4: return [2 /*return*/];
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
FirmaCosmWasmService.prototype.migrateContract = function (wallet, contractAddress, codeId, msg, txMisc) {
|
|
213
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
214
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
215
|
-
var txRaw, bankTxClient, error_8;
|
|
216
|
-
return __generator(this, function (_a) {
|
|
217
|
-
switch (_a.label) {
|
|
218
|
-
case 0:
|
|
219
|
-
_a.trys.push([0, 3, , 4]);
|
|
220
|
-
return [4 /*yield*/, this.getSignedTxMigrateContract(wallet, contractAddress, codeId, msg, txMisc)];
|
|
221
|
-
case 1:
|
|
222
|
-
txRaw = _a.sent();
|
|
223
|
-
bankTxClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
224
|
-
return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
|
|
225
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
226
|
-
case 3:
|
|
227
|
-
error_8 = _a.sent();
|
|
228
|
-
FirmaUtil_1.FirmaUtil.printLog(error_8);
|
|
229
|
-
throw error_8;
|
|
230
|
-
case 4: return [2 /*return*/];
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
FirmaCosmWasmService.prototype.getGasEstimationExecuteContract = function (wallet, contractAddress, msg, funds, txMisc) {
|
|
236
|
-
if (funds === void 0) { funds = []; }
|
|
237
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
238
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
239
|
-
var txRaw, error_9;
|
|
240
|
-
return __generator(this, function (_a) {
|
|
241
|
-
switch (_a.label) {
|
|
242
|
-
case 0:
|
|
243
|
-
_a.trys.push([0, 3, , 4]);
|
|
244
|
-
return [4 /*yield*/, this.getSignedTxExecuteContract(wallet, contractAddress, msg, funds, txMisc)];
|
|
245
|
-
case 1:
|
|
246
|
-
txRaw = _a.sent();
|
|
247
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
248
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
249
|
-
case 3:
|
|
250
|
-
error_9 = _a.sent();
|
|
251
|
-
FirmaUtil_1.FirmaUtil.printLog(error_9);
|
|
252
|
-
throw error_9;
|
|
253
|
-
case 4: return [2 /*return*/];
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
};
|
|
258
|
-
FirmaCosmWasmService.prototype.executeContract = function (wallet, contractAddress, msg, funds, txMisc) {
|
|
259
|
-
if (funds === void 0) { funds = []; }
|
|
260
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
261
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
262
|
-
var txRaw, bankTxClient, error_10;
|
|
263
|
-
return __generator(this, function (_a) {
|
|
264
|
-
switch (_a.label) {
|
|
265
|
-
case 0:
|
|
266
|
-
_a.trys.push([0, 3, , 4]);
|
|
267
|
-
return [4 /*yield*/, this.getSignedTxExecuteContract(wallet, contractAddress, msg, funds, txMisc)];
|
|
268
|
-
case 1:
|
|
269
|
-
txRaw = _a.sent();
|
|
270
|
-
bankTxClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
271
|
-
return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
|
|
272
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
273
|
-
case 3:
|
|
274
|
-
error_10 = _a.sent();
|
|
275
|
-
FirmaUtil_1.FirmaUtil.printLog(error_10);
|
|
276
|
-
throw error_10;
|
|
277
|
-
case 4: return [2 /*return*/];
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
};
|
|
282
|
-
FirmaCosmWasmService.prototype.getGasEstimationInstantiateContract = function (wallet, admin, codeId, label, msg, funds, txMisc) {
|
|
283
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
284
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
285
|
-
var txRaw, error_11;
|
|
286
|
-
return __generator(this, function (_a) {
|
|
287
|
-
switch (_a.label) {
|
|
288
|
-
case 0:
|
|
289
|
-
_a.trys.push([0, 3, , 4]);
|
|
290
|
-
return [4 /*yield*/, this.getSignedTxInstantiateContract(wallet, admin, codeId, label, msg, funds, txMisc)];
|
|
291
|
-
case 1:
|
|
292
|
-
txRaw = _a.sent();
|
|
293
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
294
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
295
|
-
case 3:
|
|
296
|
-
error_11 = _a.sent();
|
|
297
|
-
FirmaUtil_1.FirmaUtil.printLog(error_11);
|
|
298
|
-
throw error_11;
|
|
299
|
-
case 4: return [2 /*return*/];
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
};
|
|
304
|
-
FirmaCosmWasmService.prototype.instantiateContract = function (wallet, admin, codeId, label, msg, funds, txMisc) {
|
|
305
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
306
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
307
|
-
var txRaw, bankTxClient, error_12;
|
|
308
|
-
return __generator(this, function (_a) {
|
|
309
|
-
switch (_a.label) {
|
|
310
|
-
case 0:
|
|
311
|
-
_a.trys.push([0, 3, , 4]);
|
|
312
|
-
return [4 /*yield*/, this.getSignedTxInstantiateContract(wallet, admin, codeId, label, msg, funds, txMisc)];
|
|
313
|
-
case 1:
|
|
314
|
-
txRaw = _a.sent();
|
|
315
|
-
bankTxClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
316
|
-
return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
|
|
317
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
318
|
-
case 3:
|
|
319
|
-
error_12 = _a.sent();
|
|
320
|
-
FirmaUtil_1.FirmaUtil.printLog(error_12);
|
|
321
|
-
throw error_12;
|
|
322
|
-
case 4: return [2 /*return*/];
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
};
|
|
327
|
-
FirmaCosmWasmService.prototype.getSignedTxInstantiateContract = function (wallet, admin, codeId, label, msg, funds, txMisc) {
|
|
328
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
329
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
330
|
-
var address, utfMsg, message, txClient, error_13;
|
|
331
|
-
return __generator(this, function (_a) {
|
|
332
|
-
switch (_a.label) {
|
|
333
|
-
case 0:
|
|
334
|
-
_a.trys.push([0, 3, , 4]);
|
|
335
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
336
|
-
case 1:
|
|
337
|
-
address = _a.sent();
|
|
338
|
-
utfMsg = (0, encoding_1.toUtf8)(msg);
|
|
339
|
-
message = cosmwasm_1.CosmWasmTxClient.msgInstantiateContract({ sender: address, admin: admin, codeId: long_1.default.fromString(codeId), label: label, msg: utfMsg, funds: funds });
|
|
340
|
-
txClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
341
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
342
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
343
|
-
case 3:
|
|
344
|
-
error_13 = _a.sent();
|
|
345
|
-
FirmaUtil_1.FirmaUtil.printLog(error_13);
|
|
346
|
-
throw error_13;
|
|
347
|
-
case 4: return [2 /*return*/];
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
};
|
|
352
|
-
FirmaCosmWasmService.prototype.getSignedTxUpdateAdmin = function (wallet, contractAddress, adminAddress, txMisc) {
|
|
353
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
354
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
355
|
-
var address, message, txClient, error_14;
|
|
356
|
-
return __generator(this, function (_a) {
|
|
357
|
-
switch (_a.label) {
|
|
358
|
-
case 0:
|
|
359
|
-
_a.trys.push([0, 3, , 4]);
|
|
360
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
361
|
-
case 1:
|
|
362
|
-
address = _a.sent();
|
|
363
|
-
message = cosmwasm_1.CosmWasmTxClient.msgUpdateAdmin({ sender: address, contract: contractAddress, newAdmin: adminAddress });
|
|
364
|
-
txClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
365
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
366
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
367
|
-
case 3:
|
|
368
|
-
error_14 = _a.sent();
|
|
369
|
-
FirmaUtil_1.FirmaUtil.printLog(error_14);
|
|
370
|
-
throw error_14;
|
|
371
|
-
case 4: return [2 /*return*/];
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
FirmaCosmWasmService.prototype.getSignedTxClearAdmin = function (wallet, contractAddress, txMisc) {
|
|
377
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
378
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
379
|
-
var address, message, txClient, error_15;
|
|
380
|
-
return __generator(this, function (_a) {
|
|
381
|
-
switch (_a.label) {
|
|
382
|
-
case 0:
|
|
383
|
-
_a.trys.push([0, 3, , 4]);
|
|
384
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
385
|
-
case 1:
|
|
386
|
-
address = _a.sent();
|
|
387
|
-
message = cosmwasm_1.CosmWasmTxClient.msgClearAdmin({ sender: address, contract: contractAddress });
|
|
388
|
-
txClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
389
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
390
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
391
|
-
case 3:
|
|
392
|
-
error_15 = _a.sent();
|
|
393
|
-
FirmaUtil_1.FirmaUtil.printLog(error_15);
|
|
394
|
-
throw error_15;
|
|
395
|
-
case 4: return [2 /*return*/];
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
FirmaCosmWasmService.prototype.getSignedTxMigrateContract = function (wallet, contractAddress, codeId, msg, txMisc) {
|
|
401
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
402
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
403
|
-
var address, utfMsg, message, txClient, error_16;
|
|
404
|
-
return __generator(this, function (_a) {
|
|
405
|
-
switch (_a.label) {
|
|
406
|
-
case 0:
|
|
407
|
-
_a.trys.push([0, 3, , 4]);
|
|
408
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
409
|
-
case 1:
|
|
410
|
-
address = _a.sent();
|
|
411
|
-
utfMsg = (0, encoding_1.toUtf8)(msg);
|
|
412
|
-
message = cosmwasm_1.CosmWasmTxClient.msgMigrateContract({ sender: address, contract: contractAddress, codeId: long_1.default.fromString(codeId), msg: utfMsg });
|
|
413
|
-
txClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
414
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
415
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
416
|
-
case 3:
|
|
417
|
-
error_16 = _a.sent();
|
|
418
|
-
FirmaUtil_1.FirmaUtil.printLog(error_16);
|
|
419
|
-
throw error_16;
|
|
420
|
-
case 4: return [2 /*return*/];
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
};
|
|
425
|
-
FirmaCosmWasmService.prototype.getSignedTxExecuteContract = function (wallet, contractAddress, msg, funds, txMisc) {
|
|
426
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
427
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
428
|
-
var address, utfMsg, message, txClient, error_17;
|
|
429
|
-
return __generator(this, function (_a) {
|
|
430
|
-
switch (_a.label) {
|
|
431
|
-
case 0:
|
|
432
|
-
_a.trys.push([0, 3, , 4]);
|
|
433
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
434
|
-
case 1:
|
|
435
|
-
address = _a.sent();
|
|
436
|
-
utfMsg = (0, encoding_1.toUtf8)(msg);
|
|
437
|
-
message = cosmwasm_1.CosmWasmTxClient.msgExecuteContract({ sender: address, contract: contractAddress, msg: utfMsg, funds: funds });
|
|
438
|
-
txClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
439
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
440
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
441
|
-
case 3:
|
|
442
|
-
error_17 = _a.sent();
|
|
443
|
-
FirmaUtil_1.FirmaUtil.printLog(error_17);
|
|
444
|
-
throw error_17;
|
|
445
|
-
case 4: return [2 /*return*/];
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
};
|
|
450
|
-
FirmaCosmWasmService.prototype.getSignedTxStoreCode = function (wallet, wasmCode, accessConfig, txMisc) {
|
|
451
|
-
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
452
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
453
|
-
var address, compressed, message, txClient, error_18;
|
|
454
|
-
return __generator(this, function (_a) {
|
|
455
|
-
switch (_a.label) {
|
|
456
|
-
case 0:
|
|
457
|
-
_a.trys.push([0, 3, , 4]);
|
|
458
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
459
|
-
case 1:
|
|
460
|
-
address = _a.sent();
|
|
461
|
-
compressed = pako_1.default.gzip(wasmCode, { level: 9 });
|
|
462
|
-
message = cosmwasm_1.CosmWasmTxClient.msgStoreCode({ sender: address, wasmByteCode: compressed, instantiatePermission: accessConfig });
|
|
463
|
-
txClient = new cosmwasm_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
|
|
464
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
465
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
466
|
-
case 3:
|
|
467
|
-
error_18 = _a.sent();
|
|
468
|
-
FirmaUtil_1.FirmaUtil.printLog(error_18);
|
|
469
|
-
throw error_18;
|
|
470
|
-
case 4: return [2 /*return*/];
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
});
|
|
474
|
-
};
|
|
475
|
-
// query
|
|
476
|
-
FirmaCosmWasmService.prototype.getCodeList = function () {
|
|
477
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
478
|
-
var queryClient, result, error_19;
|
|
479
|
-
return __generator(this, function (_a) {
|
|
480
|
-
switch (_a.label) {
|
|
481
|
-
case 0:
|
|
482
|
-
_a.trys.push([0, 2, , 3]);
|
|
483
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
484
|
-
return [4 /*yield*/, queryClient.getCodeInfoList()];
|
|
485
|
-
case 1:
|
|
486
|
-
result = _a.sent();
|
|
487
|
-
return [2 /*return*/, result];
|
|
488
|
-
case 2:
|
|
489
|
-
error_19 = _a.sent();
|
|
490
|
-
FirmaUtil_1.FirmaUtil.printLog(error_19);
|
|
491
|
-
throw error_19;
|
|
492
|
-
case 3: return [2 /*return*/];
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
FirmaCosmWasmService.prototype.getCodeData = function (codeId) {
|
|
498
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
499
|
-
var queryClient, result, error_20;
|
|
500
|
-
return __generator(this, function (_a) {
|
|
501
|
-
switch (_a.label) {
|
|
502
|
-
case 0:
|
|
503
|
-
_a.trys.push([0, 2, , 3]);
|
|
504
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
505
|
-
return [4 /*yield*/, queryClient.getCodeData(codeId)];
|
|
506
|
-
case 1:
|
|
507
|
-
result = _a.sent();
|
|
508
|
-
return [2 /*return*/, result];
|
|
509
|
-
case 2:
|
|
510
|
-
error_20 = _a.sent();
|
|
511
|
-
FirmaUtil_1.FirmaUtil.printLog(error_20);
|
|
512
|
-
throw error_20;
|
|
513
|
-
case 3: return [2 /*return*/];
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
|
-
};
|
|
518
|
-
FirmaCosmWasmService.prototype.getContractListFromCodeId = function (codeId) {
|
|
519
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
520
|
-
var queryClient, result, error_21;
|
|
521
|
-
return __generator(this, function (_a) {
|
|
522
|
-
switch (_a.label) {
|
|
523
|
-
case 0:
|
|
524
|
-
_a.trys.push([0, 2, , 3]);
|
|
525
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
526
|
-
return [4 /*yield*/, queryClient.getContractListFromCodeId(codeId)];
|
|
527
|
-
case 1:
|
|
528
|
-
result = _a.sent();
|
|
529
|
-
return [2 /*return*/, result];
|
|
530
|
-
case 2:
|
|
531
|
-
error_21 = _a.sent();
|
|
532
|
-
FirmaUtil_1.FirmaUtil.printLog(error_21);
|
|
533
|
-
throw error_21;
|
|
534
|
-
case 3: return [2 /*return*/];
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
});
|
|
538
|
-
};
|
|
539
|
-
FirmaCosmWasmService.prototype.getContractInfo = function (codeId) {
|
|
540
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
541
|
-
var queryClient, result, error_22;
|
|
542
|
-
return __generator(this, function (_a) {
|
|
543
|
-
switch (_a.label) {
|
|
544
|
-
case 0:
|
|
545
|
-
_a.trys.push([0, 2, , 3]);
|
|
546
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
547
|
-
return [4 /*yield*/, queryClient.getContractInfo(codeId)];
|
|
548
|
-
case 1:
|
|
549
|
-
result = _a.sent();
|
|
550
|
-
return [2 /*return*/, result];
|
|
551
|
-
case 2:
|
|
552
|
-
error_22 = _a.sent();
|
|
553
|
-
FirmaUtil_1.FirmaUtil.printLog(error_22);
|
|
554
|
-
throw error_22;
|
|
555
|
-
case 3: return [2 /*return*/];
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
});
|
|
559
|
-
};
|
|
560
|
-
FirmaCosmWasmService.prototype.getContractHistory = function (codeId) {
|
|
561
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
562
|
-
var queryClient, result, error_23;
|
|
563
|
-
return __generator(this, function (_a) {
|
|
564
|
-
switch (_a.label) {
|
|
565
|
-
case 0:
|
|
566
|
-
_a.trys.push([0, 2, , 3]);
|
|
567
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
568
|
-
return [4 /*yield*/, queryClient.getContractHistory(codeId)];
|
|
569
|
-
case 1:
|
|
570
|
-
result = _a.sent();
|
|
571
|
-
return [2 /*return*/, result];
|
|
572
|
-
case 2:
|
|
573
|
-
error_23 = _a.sent();
|
|
574
|
-
FirmaUtil_1.FirmaUtil.printLog(error_23);
|
|
575
|
-
throw error_23;
|
|
576
|
-
case 3: return [2 /*return*/];
|
|
577
|
-
}
|
|
578
|
-
});
|
|
579
|
-
});
|
|
580
|
-
};
|
|
581
|
-
FirmaCosmWasmService.prototype.getContractRawQueryData = function (contractAddress, hexString) {
|
|
582
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
583
|
-
var queryClient, result, error_24;
|
|
584
|
-
return __generator(this, function (_a) {
|
|
585
|
-
switch (_a.label) {
|
|
586
|
-
case 0:
|
|
587
|
-
_a.trys.push([0, 2, , 3]);
|
|
588
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
589
|
-
return [4 /*yield*/, queryClient.getContractRawQueryData(contractAddress, hexString)];
|
|
590
|
-
case 1:
|
|
591
|
-
result = _a.sent();
|
|
592
|
-
return [2 /*return*/, result];
|
|
593
|
-
case 2:
|
|
594
|
-
error_24 = _a.sent();
|
|
595
|
-
FirmaUtil_1.FirmaUtil.printLog(error_24);
|
|
596
|
-
throw error_24;
|
|
597
|
-
case 3: return [2 /*return*/];
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
FirmaCosmWasmService.prototype.getContractSmartQueryData = function (contractAddress, query) {
|
|
603
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
604
|
-
var queryClient, result, error_25;
|
|
605
|
-
return __generator(this, function (_a) {
|
|
606
|
-
switch (_a.label) {
|
|
607
|
-
case 0:
|
|
608
|
-
_a.trys.push([0, 2, , 3]);
|
|
609
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
610
|
-
return [4 /*yield*/, queryClient.getContractSmartQueryData(contractAddress, query)];
|
|
611
|
-
case 1:
|
|
612
|
-
result = _a.sent();
|
|
613
|
-
return [2 /*return*/, result];
|
|
614
|
-
case 2:
|
|
615
|
-
error_25 = _a.sent();
|
|
616
|
-
FirmaUtil_1.FirmaUtil.printLog(error_25);
|
|
617
|
-
throw error_25;
|
|
618
|
-
case 3: return [2 /*return*/];
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
});
|
|
622
|
-
};
|
|
623
|
-
FirmaCosmWasmService.prototype.getContractState = function (codeId) {
|
|
624
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
625
|
-
var queryClient, result, error_26;
|
|
626
|
-
return __generator(this, function (_a) {
|
|
627
|
-
switch (_a.label) {
|
|
628
|
-
case 0:
|
|
629
|
-
_a.trys.push([0, 2, , 3]);
|
|
630
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
631
|
-
return [4 /*yield*/, queryClient.getContractState(codeId)];
|
|
632
|
-
case 1:
|
|
633
|
-
result = _a.sent();
|
|
634
|
-
return [2 /*return*/, result];
|
|
635
|
-
case 2:
|
|
636
|
-
error_26 = _a.sent();
|
|
637
|
-
FirmaUtil_1.FirmaUtil.printLog(error_26);
|
|
638
|
-
throw error_26;
|
|
639
|
-
case 3: return [2 /*return*/];
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
};
|
|
644
|
-
FirmaCosmWasmService.prototype.getPinnedCodeList = function () {
|
|
645
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
646
|
-
var queryClient, result, error_27;
|
|
647
|
-
return __generator(this, function (_a) {
|
|
648
|
-
switch (_a.label) {
|
|
649
|
-
case 0:
|
|
650
|
-
_a.trys.push([0, 2, , 3]);
|
|
651
|
-
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
652
|
-
return [4 /*yield*/, queryClient.getPinnedCodeList()];
|
|
653
|
-
case 1:
|
|
654
|
-
result = _a.sent();
|
|
655
|
-
return [2 /*return*/, result];
|
|
656
|
-
case 2:
|
|
657
|
-
error_27 = _a.sent();
|
|
658
|
-
FirmaUtil_1.FirmaUtil.printLog(error_27);
|
|
659
|
-
throw error_27;
|
|
660
|
-
case 3: return [2 /*return*/];
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
});
|
|
664
|
-
};
|
|
665
|
-
return FirmaCosmWasmService;
|
|
666
|
-
}());
|
|
667
|
-
exports.FirmaCosmWasmService = FirmaCosmWasmService;
|