@firmachain/firma-js 0.2.52 → 0.2.53

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.
@@ -0,0 +1,63 @@
1
+ import { FirmaConfig } from "./FirmaConfig";
2
+ import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
3
+ import { FirmaWalletService } from "./FirmaWalletService";
4
+ import { TxMisc } from "./firmachain/common";
5
+ import { EncodeObject } from "@cosmjs/proto-signing";
6
+ import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
7
+ import { FirmaCosmWasmCw721Service } from "./FirmaCosmWasmCw721";
8
+ export interface BridgeGlobalTxCounts {
9
+ lock_count: number;
10
+ unlock_count: number;
11
+ deposit_count: number;
12
+ withdraw_count: number;
13
+ }
14
+ export interface BridgeConfig {
15
+ owner: string;
16
+ cw721_address: string;
17
+ }
18
+ export interface NftInfo {
19
+ owner: string;
20
+ token_id: string;
21
+ is_deposit: boolean;
22
+ }
23
+ export declare class CwBridgeMsgData {
24
+ static getMsgDataLock(): {
25
+ action: string;
26
+ target_addr: string;
27
+ };
28
+ static getMsgDataDeposit(toAddress: string): {
29
+ action: string;
30
+ target_addr: string;
31
+ };
32
+ static getMsgDataUnlock(token_id: string): string;
33
+ static getMsgDataWithdraw(token_id: string): string;
34
+ static getMsgDataMint(owner: string, token_id: string, token_uri: string): string;
35
+ }
36
+ export declare class FirmaCosmWasmCwBridgeService {
37
+ private readonly config;
38
+ private readonly cosmwasmService;
39
+ private readonly cw721Service;
40
+ constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService, cw721Service: FirmaCosmWasmCw721Service);
41
+ getCwBridgeMsgData(): typeof CwBridgeMsgData;
42
+ lock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
43
+ getUnsignedTxLock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string): Promise<EncodeObject>;
44
+ deposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
45
+ getUnsignedTxDeposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string): Promise<EncodeObject>;
46
+ unlock(wallet: FirmaWalletService, contractAddress: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
47
+ getUnsignedTxUnlock(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<EncodeObject>;
48
+ withdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
49
+ getUnsignedTxWithdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<EncodeObject>;
50
+ signAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
51
+ getGasEstimationSignAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<number>;
52
+ getGasEstimationLock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string): Promise<number>;
53
+ getGasEstimationDeposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string): Promise<number>;
54
+ getGasEstimationUnlock(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<number>;
55
+ getGasEstimationWithdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<number>;
56
+ getConfig(contractAddress: string): Promise<BridgeConfig>;
57
+ getNftInfo(contractAddress: string, tokenId: string): Promise<NftInfo>;
58
+ getOwnerNfts(contractAddress: string, ownerAddress: string): Promise<string[]>;
59
+ getOwnerNftsInfo(contractAddress: string, ownerAddress: string): Promise<NftInfo[]>;
60
+ getOwnerWithdrawableNfts(contractAddress: string, ownerAddress: string): Promise<NftInfo[]>;
61
+ getOwnerUnlockableNfts(contractAddress: string, ownerAddress: string): Promise<NftInfo[]>;
62
+ getGlobalTxCounts(contractAddress: string): Promise<BridgeGlobalTxCounts>;
63
+ }
@@ -0,0 +1,407 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.FirmaCosmWasmCwBridgeService = exports.CwBridgeMsgData = void 0;
40
+ var FirmaUtil_1 = require("./FirmaUtil");
41
+ var CosmWasmTxClient_1 = require("./firmachain/cosmwasm/CosmWasmTxClient");
42
+ // staic util
43
+ var noFunds = [];
44
+ var CwBridgeMsgData = /** @class */ (function () {
45
+ function CwBridgeMsgData() {
46
+ }
47
+ CwBridgeMsgData.getMsgDataLock = function () {
48
+ return {
49
+ action: "lock",
50
+ target_addr: ""
51
+ };
52
+ };
53
+ CwBridgeMsgData.getMsgDataDeposit = function (toAddress) {
54
+ return {
55
+ action: "deposit",
56
+ target_addr: toAddress
57
+ };
58
+ };
59
+ CwBridgeMsgData.getMsgDataUnlock = function (token_id) {
60
+ return JSON.stringify({
61
+ "unlock": {
62
+ token_id: token_id,
63
+ }
64
+ });
65
+ };
66
+ CwBridgeMsgData.getMsgDataWithdraw = function (token_id) {
67
+ return JSON.stringify({
68
+ "withdraw": {
69
+ token_id: token_id,
70
+ }
71
+ });
72
+ };
73
+ CwBridgeMsgData.getMsgDataMint = function (owner, token_id, token_uri) {
74
+ return JSON.stringify({
75
+ "mint": {
76
+ token_id: token_id,
77
+ owner: owner,
78
+ extension: {},
79
+ token_uri: token_uri
80
+ }
81
+ });
82
+ };
83
+ return CwBridgeMsgData;
84
+ }());
85
+ exports.CwBridgeMsgData = CwBridgeMsgData;
86
+ var FirmaCosmWasmCwBridgeService = /** @class */ (function () {
87
+ function FirmaCosmWasmCwBridgeService(config, cosmwasmService, cw721Service) {
88
+ this.config = config;
89
+ this.cosmwasmService = cosmwasmService;
90
+ this.cw721Service = cw721Service;
91
+ }
92
+ FirmaCosmWasmCwBridgeService.prototype.getCwBridgeMsgData = function () {
93
+ return CwBridgeMsgData;
94
+ };
95
+ FirmaCosmWasmCwBridgeService.prototype.lock = function (wallet, contractAddress, cw721ContractAddress, tokenId, txMisc) {
96
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
97
+ return __awaiter(this, void 0, void 0, function () {
98
+ var msgData;
99
+ return __generator(this, function (_a) {
100
+ switch (_a.label) {
101
+ case 0:
102
+ msgData = CwBridgeMsgData.getMsgDataLock();
103
+ return [4 /*yield*/, this.cw721Service.sendNft(wallet, cw721ContractAddress, contractAddress, tokenId, msgData, txMisc)];
104
+ case 1: return [2 /*return*/, _a.sent()];
105
+ }
106
+ });
107
+ });
108
+ };
109
+ FirmaCosmWasmCwBridgeService.prototype.getUnsignedTxLock = function (wallet, contractAddress, cw721ContractAddress, tokenId) {
110
+ return __awaiter(this, void 0, void 0, function () {
111
+ var msgData;
112
+ return __generator(this, function (_a) {
113
+ switch (_a.label) {
114
+ case 0:
115
+ msgData = CwBridgeMsgData.getMsgDataLock();
116
+ return [4 /*yield*/, this.cw721Service.getUnsignedTxSendNft(wallet, cw721ContractAddress, contractAddress, tokenId, msgData)];
117
+ case 1: return [2 /*return*/, _a.sent()];
118
+ }
119
+ });
120
+ });
121
+ };
122
+ FirmaCosmWasmCwBridgeService.prototype.deposit = function (wallet, contractAddress, cw721ContractAddress, tokenId, toAddress, txMisc) {
123
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
124
+ return __awaiter(this, void 0, void 0, function () {
125
+ var msgData;
126
+ return __generator(this, function (_a) {
127
+ switch (_a.label) {
128
+ case 0:
129
+ msgData = CwBridgeMsgData.getMsgDataDeposit(toAddress);
130
+ return [4 /*yield*/, this.cw721Service.sendNft(wallet, cw721ContractAddress, contractAddress, tokenId, msgData, txMisc)];
131
+ case 1: return [2 /*return*/, _a.sent()];
132
+ }
133
+ });
134
+ });
135
+ };
136
+ FirmaCosmWasmCwBridgeService.prototype.getUnsignedTxDeposit = function (wallet, contractAddress, cw721ContractAddress, tokenId, toAddress) {
137
+ return __awaiter(this, void 0, void 0, function () {
138
+ var msgData;
139
+ return __generator(this, function (_a) {
140
+ switch (_a.label) {
141
+ case 0:
142
+ msgData = CwBridgeMsgData.getMsgDataDeposit(toAddress);
143
+ return [4 /*yield*/, this.cw721Service.getUnsignedTxSendNft(wallet, cw721ContractAddress, contractAddress, tokenId, msgData)];
144
+ case 1: return [2 /*return*/, _a.sent()];
145
+ }
146
+ });
147
+ });
148
+ };
149
+ FirmaCosmWasmCwBridgeService.prototype.unlock = function (wallet, contractAddress, token_id, txMisc) {
150
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
151
+ return __awaiter(this, void 0, void 0, function () {
152
+ var msgData;
153
+ return __generator(this, function (_a) {
154
+ switch (_a.label) {
155
+ case 0:
156
+ msgData = CwBridgeMsgData.getMsgDataUnlock(token_id);
157
+ return [4 /*yield*/, this.cosmwasmService.executeContract(wallet, contractAddress, msgData, noFunds, txMisc)];
158
+ case 1: return [2 /*return*/, _a.sent()];
159
+ }
160
+ });
161
+ });
162
+ };
163
+ FirmaCosmWasmCwBridgeService.prototype.getUnsignedTxUnlock = function (wallet, contractAddress, token_id) {
164
+ return __awaiter(this, void 0, void 0, function () {
165
+ var msgData;
166
+ return __generator(this, function (_a) {
167
+ switch (_a.label) {
168
+ case 0:
169
+ msgData = CwBridgeMsgData.getMsgDataUnlock(token_id);
170
+ return [4 /*yield*/, this.cosmwasmService.getUnsignedTxExecuteContract(wallet, contractAddress, msgData, noFunds)];
171
+ case 1: return [2 /*return*/, _a.sent()];
172
+ }
173
+ });
174
+ });
175
+ };
176
+ FirmaCosmWasmCwBridgeService.prototype.withdraw = function (wallet, contractAddress, token_id, txMisc) {
177
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
178
+ return __awaiter(this, void 0, void 0, function () {
179
+ var msgData;
180
+ return __generator(this, function (_a) {
181
+ switch (_a.label) {
182
+ case 0:
183
+ msgData = CwBridgeMsgData.getMsgDataWithdraw(token_id);
184
+ return [4 /*yield*/, this.cosmwasmService.executeContract(wallet, contractAddress, msgData, noFunds, txMisc)];
185
+ case 1: return [2 /*return*/, _a.sent()];
186
+ }
187
+ });
188
+ });
189
+ };
190
+ FirmaCosmWasmCwBridgeService.prototype.getUnsignedTxWithdraw = function (wallet, contractAddress, token_id) {
191
+ return __awaiter(this, void 0, void 0, function () {
192
+ var msgData;
193
+ return __generator(this, function (_a) {
194
+ switch (_a.label) {
195
+ case 0:
196
+ msgData = CwBridgeMsgData.getMsgDataWithdraw(token_id);
197
+ return [4 /*yield*/, this.cosmwasmService.getUnsignedTxExecuteContract(wallet, contractAddress, msgData, noFunds)];
198
+ case 1: return [2 /*return*/, _a.sent()];
199
+ }
200
+ });
201
+ });
202
+ };
203
+ FirmaCosmWasmCwBridgeService.prototype.signAndBroadcast = function (wallet, msgList, txMisc) {
204
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
205
+ return __awaiter(this, void 0, void 0, function () {
206
+ var txClient, error_1;
207
+ return __generator(this, function (_a) {
208
+ switch (_a.label) {
209
+ case 0:
210
+ _a.trys.push([0, 2, , 3]);
211
+ txClient = new CosmWasmTxClient_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
212
+ return [4 /*yield*/, txClient.signAndBroadcast(msgList, FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
213
+ case 1: return [2 /*return*/, _a.sent()];
214
+ case 2:
215
+ error_1 = _a.sent();
216
+ FirmaUtil_1.FirmaUtil.printLog(error_1);
217
+ throw error_1;
218
+ case 3: return [2 /*return*/];
219
+ }
220
+ });
221
+ });
222
+ };
223
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationSignAndBroadcast = function (wallet, msgList, txMisc) {
224
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
225
+ return __awaiter(this, void 0, void 0, function () {
226
+ var txClient, txRaw, error_2;
227
+ return __generator(this, function (_a) {
228
+ switch (_a.label) {
229
+ case 0:
230
+ _a.trys.push([0, 3, , 4]);
231
+ txClient = new CosmWasmTxClient_1.CosmWasmTxClient(wallet, this.config.rpcAddress);
232
+ return [4 /*yield*/, txClient.sign(msgList, FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
233
+ case 1:
234
+ txRaw = _a.sent();
235
+ return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
236
+ case 2: return [2 /*return*/, _a.sent()];
237
+ case 3:
238
+ error_2 = _a.sent();
239
+ FirmaUtil_1.FirmaUtil.printLog(error_2);
240
+ throw error_2;
241
+ case 4: return [2 /*return*/];
242
+ }
243
+ });
244
+ });
245
+ };
246
+ // gas
247
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationLock = function (wallet, contractAddress, cw721ContractAddress, tokenId) {
248
+ return __awaiter(this, void 0, void 0, function () {
249
+ var msgData;
250
+ return __generator(this, function (_a) {
251
+ switch (_a.label) {
252
+ case 0:
253
+ msgData = CwBridgeMsgData.getMsgDataLock();
254
+ return [4 /*yield*/, this.cw721Service.getGasEstimationSendNft(wallet, cw721ContractAddress, contractAddress, tokenId, msgData)];
255
+ case 1: return [2 /*return*/, _a.sent()];
256
+ }
257
+ });
258
+ });
259
+ };
260
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationDeposit = function (wallet, contractAddress, cw721ContractAddress, tokenId, toAddress) {
261
+ return __awaiter(this, void 0, void 0, function () {
262
+ var msgData;
263
+ return __generator(this, function (_a) {
264
+ switch (_a.label) {
265
+ case 0:
266
+ msgData = CwBridgeMsgData.getMsgDataDeposit(toAddress);
267
+ return [4 /*yield*/, this.cw721Service.getGasEstimationSendNft(wallet, cw721ContractAddress, contractAddress, tokenId, msgData)];
268
+ case 1: return [2 /*return*/, _a.sent()];
269
+ }
270
+ });
271
+ });
272
+ };
273
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationUnlock = function (wallet, contractAddress, token_id) {
274
+ return __awaiter(this, void 0, void 0, function () {
275
+ var msgData;
276
+ return __generator(this, function (_a) {
277
+ switch (_a.label) {
278
+ case 0:
279
+ msgData = CwBridgeMsgData.getMsgDataUnlock(token_id);
280
+ return [4 /*yield*/, this.cosmwasmService.getGasEstimationExecuteContract(wallet, contractAddress, msgData, noFunds)];
281
+ case 1: return [2 /*return*/, _a.sent()];
282
+ }
283
+ });
284
+ });
285
+ };
286
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationWithdraw = function (wallet, contractAddress, token_id) {
287
+ return __awaiter(this, void 0, void 0, function () {
288
+ var msgData;
289
+ return __generator(this, function (_a) {
290
+ switch (_a.label) {
291
+ case 0:
292
+ msgData = CwBridgeMsgData.getMsgDataWithdraw(token_id);
293
+ return [4 /*yield*/, this.cosmwasmService.getGasEstimationExecuteContract(wallet, contractAddress, msgData, noFunds)];
294
+ case 1: return [2 /*return*/, _a.sent()];
295
+ }
296
+ });
297
+ });
298
+ };
299
+ // query
300
+ FirmaCosmWasmCwBridgeService.prototype.getConfig = function (contractAddress) {
301
+ return __awaiter(this, void 0, void 0, function () {
302
+ var query, result;
303
+ return __generator(this, function (_a) {
304
+ switch (_a.label) {
305
+ case 0:
306
+ query = "{\"get_config\": { }}";
307
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
308
+ case 1:
309
+ result = _a.sent();
310
+ return [2 /*return*/, JSON.parse(result)];
311
+ }
312
+ });
313
+ });
314
+ };
315
+ FirmaCosmWasmCwBridgeService.prototype.getNftInfo = function (contractAddress, tokenId) {
316
+ return __awaiter(this, void 0, void 0, function () {
317
+ var query, result;
318
+ return __generator(this, function (_a) {
319
+ switch (_a.label) {
320
+ case 0:
321
+ query = "{\"nft_info\": { \"token_id\": \"" + tokenId + "\" }}";
322
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
323
+ case 1:
324
+ result = _a.sent();
325
+ return [2 /*return*/, JSON.parse(result)];
326
+ }
327
+ });
328
+ });
329
+ };
330
+ FirmaCosmWasmCwBridgeService.prototype.getOwnerNfts = function (contractAddress, ownerAddress) {
331
+ return __awaiter(this, void 0, void 0, function () {
332
+ var query, result;
333
+ return __generator(this, function (_a) {
334
+ switch (_a.label) {
335
+ case 0:
336
+ query = "{\"owner_nfts\": { \"owner_addr\": \"" + ownerAddress + "\" }}";
337
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
338
+ case 1:
339
+ result = _a.sent();
340
+ return [2 /*return*/, JSON.parse(result)];
341
+ }
342
+ });
343
+ });
344
+ };
345
+ FirmaCosmWasmCwBridgeService.prototype.getOwnerNftsInfo = function (contractAddress, ownerAddress) {
346
+ return __awaiter(this, void 0, void 0, function () {
347
+ var query, result;
348
+ return __generator(this, function (_a) {
349
+ switch (_a.label) {
350
+ case 0:
351
+ query = "{\"owner_nfts_info\": { \"owner_addr\": \"" + ownerAddress + "\" }}";
352
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
353
+ case 1:
354
+ result = _a.sent();
355
+ return [2 /*return*/, JSON.parse(result)];
356
+ }
357
+ });
358
+ });
359
+ };
360
+ FirmaCosmWasmCwBridgeService.prototype.getOwnerWithdrawableNfts = function (contractAddress, ownerAddress) {
361
+ return __awaiter(this, void 0, void 0, function () {
362
+ var query, result;
363
+ return __generator(this, function (_a) {
364
+ switch (_a.label) {
365
+ case 0:
366
+ query = "{\"owner_withdrawable_nfts\": { \"owner_addr\": \"" + ownerAddress + "\" }}";
367
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
368
+ case 1:
369
+ result = _a.sent();
370
+ return [2 /*return*/, JSON.parse(result)];
371
+ }
372
+ });
373
+ });
374
+ };
375
+ FirmaCosmWasmCwBridgeService.prototype.getOwnerUnlockableNfts = function (contractAddress, ownerAddress) {
376
+ return __awaiter(this, void 0, void 0, function () {
377
+ var query, result;
378
+ return __generator(this, function (_a) {
379
+ switch (_a.label) {
380
+ case 0:
381
+ query = "{\"owner_unlockable_nfts\": { \"owner_addr\": \"" + ownerAddress + "\" }}";
382
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
383
+ case 1:
384
+ result = _a.sent();
385
+ return [2 /*return*/, JSON.parse(result)];
386
+ }
387
+ });
388
+ });
389
+ };
390
+ FirmaCosmWasmCwBridgeService.prototype.getGlobalTxCounts = function (contractAddress) {
391
+ return __awaiter(this, void 0, void 0, function () {
392
+ var query, result;
393
+ return __generator(this, function (_a) {
394
+ switch (_a.label) {
395
+ case 0:
396
+ query = "{\"global_tx_counts\": {}}";
397
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
398
+ case 1:
399
+ result = _a.sent();
400
+ return [2 /*return*/, JSON.parse(result)];
401
+ }
402
+ });
403
+ });
404
+ };
405
+ return FirmaCosmWasmCwBridgeService;
406
+ }());
407
+ exports.FirmaCosmWasmCwBridgeService = FirmaCosmWasmCwBridgeService;
@@ -1,9 +1,12 @@
1
1
  import { CosmWasmTxClient, TxMisc, CodeInfo, CodeData, ContractInfo, ContractHistoryInfo, ContractStateInfo } from "./firmachain/cosmwasm";
2
+ import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
2
3
  import { FirmaWalletService } from "./FirmaWalletService";
3
4
  import { FirmaConfig } from "./FirmaConfig";
4
5
  import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
5
6
  import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
6
7
  import { AccessConfig } from "cosmjs-types/cosmwasm/wasm/v1/types";
8
+ import { EncodeObject } from "@cosmjs/proto-signing";
9
+ export { AccessConfig, AccessType } from "cosmjs-types/cosmwasm/wasm/v1/types";
7
10
  export declare class FirmaCosmWasmService {
8
11
  private readonly config;
9
12
  constructor(config: FirmaConfig);
@@ -18,13 +21,16 @@ export declare class FirmaCosmWasmService {
18
21
  migrateContract(wallet: FirmaWalletService, contractAddress: string, codeId: string, msg: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
19
22
  getGasEstimationExecuteContract(wallet: FirmaWalletService, contractAddress: string, msg: string, funds?: Coin[], txMisc?: TxMisc): Promise<number>;
20
23
  executeContract(wallet: FirmaWalletService, contractAddress: string, msg: string, funds?: Coin[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
24
+ signAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
25
+ getGasEstimationSignAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<number>;
21
26
  getGasEstimationInstantiateContract(wallet: FirmaWalletService, admin: string, codeId: string, label: string, msg: string, funds: Coin[], txMisc?: TxMisc): Promise<number>;
22
27
  instantiateContract(wallet: FirmaWalletService, admin: string, codeId: string, label: string, msg: string, funds: Coin[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
23
28
  private getSignedTxInstantiateContract;
24
29
  private getSignedTxUpdateAdmin;
25
30
  private getSignedTxClearAdmin;
26
31
  private getSignedTxMigrateContract;
27
- private getSignedTxExecuteContract;
32
+ getUnsignedTxExecuteContract(wallet: FirmaWalletService, contractAddress: string, msg: string, funds: Coin[]): Promise<EncodeObject>;
33
+ getSignedTxExecuteContract(wallet: FirmaWalletService, contractAddress: string, msg: string, funds: Coin[], txMisc?: TxMisc): Promise<TxRaw>;
28
34
  private getSignedTxStoreCode;
29
35
  getCodeList(): Promise<CodeInfo[]>;
30
36
  getCodeData(codeId: string): Promise<CodeData>;