@firmachain/firma-js 0.2.48 → 0.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +43 -0
- package/dist/sdk/FirmaCosmWasmCw721.js +318 -0
- package/dist/sdk/FirmaSDK.d.ts +3 -1
- package/dist/sdk/FirmaSDK.js +4 -1
- package/dist/sdk/FirmaStakingService.d.ts +7 -1
- package/dist/sdk/FirmaStakingService.js +11 -3
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +1 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FirmaConfig } from "./FirmaConfig";
|
|
2
|
+
import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
|
|
3
|
+
import { Uint64 } from "@cosmjs/math";
|
|
4
|
+
export interface ExpireAll {
|
|
5
|
+
never: string;
|
|
6
|
+
at_height: Uint64;
|
|
7
|
+
at_time: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Cw721NftInfo {
|
|
10
|
+
access: {
|
|
11
|
+
owner: string;
|
|
12
|
+
approvals: Cw721Approval[];
|
|
13
|
+
};
|
|
14
|
+
info: {
|
|
15
|
+
token_uri: string;
|
|
16
|
+
extension: Object;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface Cw721ContractInfo {
|
|
20
|
+
name: string;
|
|
21
|
+
symbol: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Cw721Approval {
|
|
24
|
+
spender: string;
|
|
25
|
+
expires: ExpireAll;
|
|
26
|
+
}
|
|
27
|
+
export declare class FirmaCosmWasmCw721Service {
|
|
28
|
+
private readonly config;
|
|
29
|
+
private readonly cosmwasmService;
|
|
30
|
+
constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService);
|
|
31
|
+
getOwnerFromNftID(contractAddress: string, tokenId: string): Promise<string>;
|
|
32
|
+
getApproval(contractAddress: string, tokenId: string, spender: string, isIncludeExpired?: boolean): Promise<Cw721Approval>;
|
|
33
|
+
getApprovals(contractAddress: string, tokenId: string, isIncludeExpired?: boolean): Promise<Cw721Approval[]>;
|
|
34
|
+
getAllOperators(contractAddress: string, owner: string, isIncludeExpired?: boolean): Promise<Cw721Approval[]>;
|
|
35
|
+
getTotalNfts(contractAddress: string): Promise<number>;
|
|
36
|
+
getContractInfo(contractAddress: string): Promise<Cw721ContractInfo>;
|
|
37
|
+
getNftTokenUri(contractAddress: string, tokenId: string): Promise<string>;
|
|
38
|
+
getNftData(contractAddress: string, tokenId: string): Promise<Cw721NftInfo>;
|
|
39
|
+
getNFTIdListOfOwner(contractAddress: string, owner: string): Promise<string[]>;
|
|
40
|
+
getAllNftIdList(contractAddress: string): Promise<string[]>;
|
|
41
|
+
getMinter(contractAddress: string): Promise<string>;
|
|
42
|
+
getExtension(contractAddress: string): Promise<any>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
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.FirmaCosmWasmCw721Service = void 0;
|
|
40
|
+
var FirmaUtil_1 = require("./FirmaUtil");
|
|
41
|
+
var FirmaCosmWasmCw721Service = /** @class */ (function () {
|
|
42
|
+
function FirmaCosmWasmCw721Service(config, cosmwasmService) {
|
|
43
|
+
this.config = config;
|
|
44
|
+
this.cosmwasmService = cosmwasmService;
|
|
45
|
+
}
|
|
46
|
+
// query
|
|
47
|
+
FirmaCosmWasmCw721Service.prototype.getOwnerFromNftID = function (contractAddress, tokenId) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
var query, result, data, error_1;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
_a.trys.push([0, 2, , 3]);
|
|
54
|
+
query = "{\"owner_of\": { \"token_id\": \"" + tokenId + "\" }}";
|
|
55
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
56
|
+
case 1:
|
|
57
|
+
result = _a.sent();
|
|
58
|
+
data = JSON.parse(result);
|
|
59
|
+
return [2 /*return*/, data.owner];
|
|
60
|
+
case 2:
|
|
61
|
+
error_1 = _a.sent();
|
|
62
|
+
FirmaUtil_1.FirmaUtil.printLog(error_1);
|
|
63
|
+
throw error_1;
|
|
64
|
+
case 3: return [2 /*return*/];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
FirmaCosmWasmCw721Service.prototype.getApproval = function (contractAddress, tokenId, spender, isIncludeExpired) {
|
|
70
|
+
if (isIncludeExpired === void 0) { isIncludeExpired = false; }
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var query, result, data, error_2;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
_a.trys.push([0, 2, , 3]);
|
|
77
|
+
query = "{\"approval\": { \"token_id\": \"" + tokenId + "\", \"spender\" : \"" + spender + "\", \"include_expired\" : " + isIncludeExpired + " }}";
|
|
78
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
79
|
+
case 1:
|
|
80
|
+
result = _a.sent();
|
|
81
|
+
data = JSON.parse(result);
|
|
82
|
+
return [2 /*return*/, data.approval];
|
|
83
|
+
case 2:
|
|
84
|
+
error_2 = _a.sent();
|
|
85
|
+
FirmaUtil_1.FirmaUtil.printLog(error_2);
|
|
86
|
+
throw error_2;
|
|
87
|
+
case 3: return [2 /*return*/];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
FirmaCosmWasmCw721Service.prototype.getApprovals = function (contractAddress, tokenId, isIncludeExpired) {
|
|
93
|
+
if (isIncludeExpired === void 0) { isIncludeExpired = false; }
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
var query, result, data, error_3;
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
_a.trys.push([0, 2, , 3]);
|
|
100
|
+
query = "{\"approvals\": { \"token_id\": \"" + tokenId + "\", \"include_expired\" : " + isIncludeExpired + " }}";
|
|
101
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
102
|
+
case 1:
|
|
103
|
+
result = _a.sent();
|
|
104
|
+
data = JSON.parse(result);
|
|
105
|
+
return [2 /*return*/, data.approvals];
|
|
106
|
+
case 2:
|
|
107
|
+
error_3 = _a.sent();
|
|
108
|
+
FirmaUtil_1.FirmaUtil.printLog(error_3);
|
|
109
|
+
throw error_3;
|
|
110
|
+
case 3: return [2 /*return*/];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
FirmaCosmWasmCw721Service.prototype.getAllOperators = function (contractAddress, owner, isIncludeExpired) {
|
|
116
|
+
if (isIncludeExpired === void 0) { isIncludeExpired = false; }
|
|
117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var query, result, data, error_4;
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
_a.trys.push([0, 2, , 3]);
|
|
123
|
+
query = "{\"all_operators\": { \"owner\": \"" + owner + "\", \"include_expired\" : " + isIncludeExpired + " }}";
|
|
124
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
125
|
+
case 1:
|
|
126
|
+
result = _a.sent();
|
|
127
|
+
data = JSON.parse(result);
|
|
128
|
+
return [2 /*return*/, data.operators];
|
|
129
|
+
case 2:
|
|
130
|
+
error_4 = _a.sent();
|
|
131
|
+
FirmaUtil_1.FirmaUtil.printLog(error_4);
|
|
132
|
+
throw error_4;
|
|
133
|
+
case 3: return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
FirmaCosmWasmCw721Service.prototype.getTotalNfts = function (contractAddress) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
+
var query, result, data, error_5;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
_a.trys.push([0, 2, , 3]);
|
|
145
|
+
query = "{\"num_tokens\": { }}";
|
|
146
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
147
|
+
case 1:
|
|
148
|
+
result = _a.sent();
|
|
149
|
+
data = JSON.parse(result);
|
|
150
|
+
return [2 /*return*/, data.count];
|
|
151
|
+
case 2:
|
|
152
|
+
error_5 = _a.sent();
|
|
153
|
+
FirmaUtil_1.FirmaUtil.printLog(error_5);
|
|
154
|
+
throw error_5;
|
|
155
|
+
case 3: return [2 /*return*/];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
FirmaCosmWasmCw721Service.prototype.getContractInfo = function (contractAddress) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
var query, result, data, error_6;
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
switch (_a.label) {
|
|
165
|
+
case 0:
|
|
166
|
+
_a.trys.push([0, 2, , 3]);
|
|
167
|
+
query = "{\"contract_info\": { }}";
|
|
168
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
169
|
+
case 1:
|
|
170
|
+
result = _a.sent();
|
|
171
|
+
data = JSON.parse(result);
|
|
172
|
+
return [2 /*return*/, data];
|
|
173
|
+
case 2:
|
|
174
|
+
error_6 = _a.sent();
|
|
175
|
+
FirmaUtil_1.FirmaUtil.printLog(error_6);
|
|
176
|
+
throw error_6;
|
|
177
|
+
case 3: return [2 /*return*/];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
FirmaCosmWasmCw721Service.prototype.getNftTokenUri = function (contractAddress, tokenId) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
+
var query, result, data, error_7;
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
switch (_a.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
_a.trys.push([0, 2, , 3]);
|
|
189
|
+
query = "{\"nft_info\": { \"token_id\": \"" + tokenId + "\" }}";
|
|
190
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
191
|
+
case 1:
|
|
192
|
+
result = _a.sent();
|
|
193
|
+
data = JSON.parse(result);
|
|
194
|
+
return [2 /*return*/, data.token_uri];
|
|
195
|
+
case 2:
|
|
196
|
+
error_7 = _a.sent();
|
|
197
|
+
FirmaUtil_1.FirmaUtil.printLog(error_7);
|
|
198
|
+
throw error_7;
|
|
199
|
+
case 3: return [2 /*return*/];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
FirmaCosmWasmCw721Service.prototype.getNftData = function (contractAddress, tokenId) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
206
|
+
var query, result, data, error_8;
|
|
207
|
+
return __generator(this, function (_a) {
|
|
208
|
+
switch (_a.label) {
|
|
209
|
+
case 0:
|
|
210
|
+
_a.trys.push([0, 2, , 3]);
|
|
211
|
+
query = "{\"all_nft_info\": { \"token_id\": \"" + tokenId + "\" }}";
|
|
212
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
213
|
+
case 1:
|
|
214
|
+
result = _a.sent();
|
|
215
|
+
data = JSON.parse(result);
|
|
216
|
+
return [2 /*return*/, data];
|
|
217
|
+
case 2:
|
|
218
|
+
error_8 = _a.sent();
|
|
219
|
+
FirmaUtil_1.FirmaUtil.printLog(error_8);
|
|
220
|
+
throw error_8;
|
|
221
|
+
case 3: return [2 /*return*/];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
FirmaCosmWasmCw721Service.prototype.getNFTIdListOfOwner = function (contractAddress, owner) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
+
var query, result, data, error_9;
|
|
229
|
+
return __generator(this, function (_a) {
|
|
230
|
+
switch (_a.label) {
|
|
231
|
+
case 0:
|
|
232
|
+
_a.trys.push([0, 2, , 3]);
|
|
233
|
+
query = "{\"tokens\": { \"owner\": \"" + owner + "\" }}";
|
|
234
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
235
|
+
case 1:
|
|
236
|
+
result = _a.sent();
|
|
237
|
+
data = JSON.parse(result);
|
|
238
|
+
return [2 /*return*/, data.tokens];
|
|
239
|
+
case 2:
|
|
240
|
+
error_9 = _a.sent();
|
|
241
|
+
FirmaUtil_1.FirmaUtil.printLog(error_9);
|
|
242
|
+
throw error_9;
|
|
243
|
+
case 3: return [2 /*return*/];
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
// TODO: for many items, limit, start_after can be added later
|
|
249
|
+
FirmaCosmWasmCw721Service.prototype.getAllNftIdList = function (contractAddress) {
|
|
250
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
251
|
+
var query, result, data, error_10;
|
|
252
|
+
return __generator(this, function (_a) {
|
|
253
|
+
switch (_a.label) {
|
|
254
|
+
case 0:
|
|
255
|
+
_a.trys.push([0, 2, , 3]);
|
|
256
|
+
query = "{\"all_tokens\": { }}";
|
|
257
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
258
|
+
case 1:
|
|
259
|
+
result = _a.sent();
|
|
260
|
+
data = JSON.parse(result);
|
|
261
|
+
return [2 /*return*/, data.tokens];
|
|
262
|
+
case 2:
|
|
263
|
+
error_10 = _a.sent();
|
|
264
|
+
FirmaUtil_1.FirmaUtil.printLog(error_10);
|
|
265
|
+
throw error_10;
|
|
266
|
+
case 3: return [2 /*return*/];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
FirmaCosmWasmCw721Service.prototype.getMinter = function (contractAddress) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
273
|
+
var query, result, data, error_11;
|
|
274
|
+
return __generator(this, function (_a) {
|
|
275
|
+
switch (_a.label) {
|
|
276
|
+
case 0:
|
|
277
|
+
_a.trys.push([0, 2, , 3]);
|
|
278
|
+
query = "{\"minter\": { }}";
|
|
279
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
280
|
+
case 1:
|
|
281
|
+
result = _a.sent();
|
|
282
|
+
data = JSON.parse(result);
|
|
283
|
+
return [2 /*return*/, data.minter];
|
|
284
|
+
case 2:
|
|
285
|
+
error_11 = _a.sent();
|
|
286
|
+
FirmaUtil_1.FirmaUtil.printLog(error_11);
|
|
287
|
+
throw error_11;
|
|
288
|
+
case 3: return [2 /*return*/];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
// NOTICE: need to check how to use extension
|
|
294
|
+
FirmaCosmWasmCw721Service.prototype.getExtension = function (contractAddress) {
|
|
295
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
296
|
+
var query, result, data, error_12;
|
|
297
|
+
return __generator(this, function (_a) {
|
|
298
|
+
switch (_a.label) {
|
|
299
|
+
case 0:
|
|
300
|
+
_a.trys.push([0, 2, , 3]);
|
|
301
|
+
query = "{\"extension\": { \"msg\": {} }}";
|
|
302
|
+
return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
|
|
303
|
+
case 1:
|
|
304
|
+
result = _a.sent();
|
|
305
|
+
data = JSON.parse(result);
|
|
306
|
+
return [2 /*return*/, data];
|
|
307
|
+
case 2:
|
|
308
|
+
error_12 = _a.sent();
|
|
309
|
+
FirmaUtil_1.FirmaUtil.printLog(error_12);
|
|
310
|
+
throw error_12;
|
|
311
|
+
case 3: return [2 /*return*/];
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
return FirmaCosmWasmCw721Service;
|
|
317
|
+
}());
|
|
318
|
+
exports.FirmaCosmWasmCw721Service = FirmaCosmWasmCw721Service;
|
package/dist/sdk/FirmaSDK.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { FirmaCosmWasmCw20Service } from "./FirmaCosmWasmCw20";
|
|
|
16
16
|
import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
|
|
17
17
|
import { FirmaIbcService } from "./FirmaIbcService";
|
|
18
18
|
import { FirmaMintService } from "./FirmaMintService";
|
|
19
|
+
import { FirmaCosmWasmCw721Service } from "./FirmaCosmWasmCw721";
|
|
19
20
|
export declare class FirmaSDK {
|
|
20
21
|
Config: FirmaConfig;
|
|
21
22
|
Wallet: FirmaWalletService;
|
|
@@ -35,5 +36,6 @@ export declare class FirmaSDK {
|
|
|
35
36
|
Ibc: FirmaIbcService;
|
|
36
37
|
Mint: FirmaMintService;
|
|
37
38
|
Cw20: FirmaCosmWasmCw20Service;
|
|
38
|
-
|
|
39
|
+
Cw721: FirmaCosmWasmCw721Service;
|
|
40
|
+
constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, Ipfs?: IpfsService, BlockChain?: ChainService, Slashing?: SlashingService, Authz?: FirmaAuthzService, CosmWasm?: FirmaCosmWasmService, Ibc?: FirmaIbcService, Mint?: FirmaMintService, Cw20?: FirmaCosmWasmCw20Service, Cw721?: FirmaCosmWasmCw721Service);
|
|
39
41
|
}
|
package/dist/sdk/FirmaSDK.js
CHANGED
|
@@ -19,8 +19,9 @@ var FirmaCosmWasmCw20_1 = require("./FirmaCosmWasmCw20");
|
|
|
19
19
|
var FirmaCosmWasmService_1 = require("./FirmaCosmWasmService");
|
|
20
20
|
var FirmaIbcService_1 = require("./FirmaIbcService");
|
|
21
21
|
var FirmaMintService_1 = require("./FirmaMintService");
|
|
22
|
+
var FirmaCosmWasmCw721_1 = require("./FirmaCosmWasmCw721");
|
|
22
23
|
var FirmaSDK = /** @class */ (function () {
|
|
23
|
-
function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc, Mint, Cw20) {
|
|
24
|
+
function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc, Mint, Cw20, Cw721) {
|
|
24
25
|
if (Wallet === void 0) { Wallet = new FirmaWalletService_1.FirmaWalletService(Config); }
|
|
25
26
|
if (Bank === void 0) { Bank = new FirmaBankService_1.FirmaBankService(Config); }
|
|
26
27
|
if (FeeGrant === void 0) { FeeGrant = new FirmaFeeGrantService_1.FirmaFeeGrantService(Config); }
|
|
@@ -38,6 +39,7 @@ var FirmaSDK = /** @class */ (function () {
|
|
|
38
39
|
if (Ibc === void 0) { Ibc = new FirmaIbcService_1.FirmaIbcService(Config); }
|
|
39
40
|
if (Mint === void 0) { Mint = new FirmaMintService_1.FirmaMintService(Config); }
|
|
40
41
|
if (Cw20 === void 0) { Cw20 = new FirmaCosmWasmCw20_1.FirmaCosmWasmCw20Service(Config, CosmWasm); }
|
|
42
|
+
if (Cw721 === void 0) { Cw721 = new FirmaCosmWasmCw721_1.FirmaCosmWasmCw721Service(Config, CosmWasm); }
|
|
41
43
|
this.Config = Config;
|
|
42
44
|
this.Wallet = Wallet;
|
|
43
45
|
this.Bank = Bank;
|
|
@@ -56,6 +58,7 @@ var FirmaSDK = /** @class */ (function () {
|
|
|
56
58
|
this.Ibc = Ibc;
|
|
57
59
|
this.Mint = Mint;
|
|
58
60
|
this.Cw20 = Cw20;
|
|
61
|
+
this.Cw721 = Cw721;
|
|
59
62
|
FirmaUtil_1.FirmaUtil.config = Config;
|
|
60
63
|
}
|
|
61
64
|
return FirmaSDK;
|
|
@@ -4,6 +4,12 @@ import { FirmaConfig } from "./FirmaConfig";
|
|
|
4
4
|
import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
|
|
5
5
|
import { Description } from "cosmjs-types/cosmos/staking/v1beta1/staking";
|
|
6
6
|
import { MsgCreateValidator } from "cosmjs-types/cosmos/staking/v1beta1/tx";
|
|
7
|
+
export declare enum StakingValidatorStatus {
|
|
8
|
+
ALL = "",
|
|
9
|
+
BONDED = "BOND_STATUS_BONDED",
|
|
10
|
+
UNBONDED = "BOND_STATUS_UNBONDED",
|
|
11
|
+
UNBONDING = "BOND_STATUS_UNBONDING"
|
|
12
|
+
}
|
|
7
13
|
export declare class FirmaStakingService {
|
|
8
14
|
private readonly config;
|
|
9
15
|
constructor(config: FirmaConfig);
|
|
@@ -40,7 +46,7 @@ export declare class FirmaStakingService {
|
|
|
40
46
|
getParams(): Promise<ParamsDataType>;
|
|
41
47
|
getPool(): Promise<PoolDataType>;
|
|
42
48
|
getValidator(valoperAddress: string): Promise<ValidatorDataType>;
|
|
43
|
-
getValidatorList(paginationKey?: string): Promise<{
|
|
49
|
+
getValidatorList(status?: StakingValidatorStatus, paginationKey?: string): Promise<{
|
|
44
50
|
dataList: ValidatorDataType[];
|
|
45
51
|
pagination: Pagination;
|
|
46
52
|
}>;
|
|
@@ -36,9 +36,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.FirmaStakingService = void 0;
|
|
39
|
+
exports.FirmaStakingService = exports.StakingValidatorStatus = void 0;
|
|
40
40
|
var staking_1 = require("./firmachain/staking");
|
|
41
41
|
var FirmaUtil_1 = require("./FirmaUtil");
|
|
42
|
+
var StakingValidatorStatus;
|
|
43
|
+
(function (StakingValidatorStatus) {
|
|
44
|
+
StakingValidatorStatus["ALL"] = "";
|
|
45
|
+
StakingValidatorStatus["BONDED"] = "BOND_STATUS_BONDED";
|
|
46
|
+
StakingValidatorStatus["UNBONDED"] = "BOND_STATUS_UNBONDED";
|
|
47
|
+
StakingValidatorStatus["UNBONDING"] = "BOND_STATUS_UNBONDING";
|
|
48
|
+
})(StakingValidatorStatus = exports.StakingValidatorStatus || (exports.StakingValidatorStatus = {}));
|
|
42
49
|
var FirmaStakingService = /** @class */ (function () {
|
|
43
50
|
function FirmaStakingService(config) {
|
|
44
51
|
this.config = config;
|
|
@@ -584,7 +591,8 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
584
591
|
});
|
|
585
592
|
});
|
|
586
593
|
};
|
|
587
|
-
FirmaStakingService.prototype.getValidatorList = function (paginationKey) {
|
|
594
|
+
FirmaStakingService.prototype.getValidatorList = function (status, paginationKey) {
|
|
595
|
+
if (status === void 0) { status = StakingValidatorStatus.ALL; }
|
|
588
596
|
if (paginationKey === void 0) { paginationKey = ""; }
|
|
589
597
|
return __awaiter(this, void 0, void 0, function () {
|
|
590
598
|
var queryClient, result, error_24;
|
|
@@ -593,7 +601,7 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
593
601
|
case 0:
|
|
594
602
|
_a.trys.push([0, 2, , 3]);
|
|
595
603
|
queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
|
|
596
|
-
return [4 /*yield*/, queryClient.queryValidators(paginationKey)];
|
|
604
|
+
return [4 /*yield*/, queryClient.queryValidators(status.toString(), paginationKey)];
|
|
597
605
|
case 1:
|
|
598
606
|
result = _a.sent();
|
|
599
607
|
return [2 /*return*/, result];
|
|
@@ -99,7 +99,7 @@ export declare class StakingQueryClient {
|
|
|
99
99
|
queryGetParams(): Promise<ParamsDataType>;
|
|
100
100
|
queryGetPool(): Promise<PoolDataType>;
|
|
101
101
|
queryValidator(valoperAddress: string): Promise<ValidatorDataType>;
|
|
102
|
-
queryValidators(paginationKey?: string): Promise<{
|
|
102
|
+
queryValidators(status: string, paginationKey?: string): Promise<{
|
|
103
103
|
dataList: ValidatorDataType[];
|
|
104
104
|
pagination: Pagination;
|
|
105
105
|
}>;
|
|
@@ -121,7 +121,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
121
121
|
switch (_a.label) {
|
|
122
122
|
case 0:
|
|
123
123
|
path = "/cosmos/staking/v1beta1/validators/" + valoperAddress + "/unbonding_delegations";
|
|
124
|
-
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
124
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey, "pagination.limit": 50 } })];
|
|
125
125
|
case 1:
|
|
126
126
|
result = _a.sent();
|
|
127
127
|
convertPagination = {
|
|
@@ -141,7 +141,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
141
141
|
switch (_a.label) {
|
|
142
142
|
case 0:
|
|
143
143
|
path = "/cosmos/staking/v1beta1/validators/" + valoperAddress + "/delegations";
|
|
144
|
-
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
144
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey, "pagination.limit": 50 } })];
|
|
145
145
|
case 1:
|
|
146
146
|
result = _a.sent();
|
|
147
147
|
convertPagination = {
|
|
@@ -161,7 +161,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
161
161
|
switch (_a.label) {
|
|
162
162
|
case 0:
|
|
163
163
|
path = "/cosmos/staking/v1beta1/delegations/" + address;
|
|
164
|
-
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
164
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey, "pagination.limit": 50 } })];
|
|
165
165
|
case 1:
|
|
166
166
|
result = _a.sent();
|
|
167
167
|
convertPagination = {
|
|
@@ -218,7 +218,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
218
218
|
});
|
|
219
219
|
});
|
|
220
220
|
};
|
|
221
|
-
StakingQueryClient.prototype.queryValidators = function (paginationKey) {
|
|
221
|
+
StakingQueryClient.prototype.queryValidators = function (status, paginationKey) {
|
|
222
222
|
if (paginationKey === void 0) { paginationKey = ""; }
|
|
223
223
|
return __awaiter(this, void 0, void 0, function () {
|
|
224
224
|
var path, result, convertPagination;
|
|
@@ -226,7 +226,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
226
226
|
switch (_a.label) {
|
|
227
227
|
case 0:
|
|
228
228
|
path = "/cosmos/staking/v1beta1/validators";
|
|
229
|
-
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
229
|
+
return [4 /*yield*/, this.axios.get(path, { params: { status: status, "pagination.key": paginationKey, "pagination.limit": 50 } })];
|
|
230
230
|
case 1:
|
|
231
231
|
result = _a.sent();
|
|
232
232
|
convertPagination = {
|