@firmachain/firma-js 0.2.29 → 0.2.32
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/FirmaAuthzService.d.ts +41 -0
- package/dist/sdk/FirmaAuthzService.js +633 -0
- package/dist/sdk/FirmaBankService.d.ts +2 -1
- package/dist/sdk/FirmaBankService.js +3 -0
- package/dist/sdk/FirmaCosmWasmService.d.ts +38 -0
- package/dist/sdk/FirmaCosmWasmService.js +667 -0
- package/dist/sdk/FirmaDistributionService.d.ts +2 -1
- package/dist/sdk/FirmaDistributionService.js +3 -0
- package/dist/sdk/FirmaIbcService.d.ts +15 -0
- package/dist/sdk/FirmaIbcService.js +144 -0
- package/dist/sdk/FirmaMobileSDK.d.ts +3 -1
- package/dist/sdk/FirmaMobileSDK.js +4 -1
- package/dist/sdk/FirmaSDK.d.ts +7 -1
- package/dist/sdk/FirmaSDK.js +10 -1
- package/dist/sdk/FirmaStakingService.d.ts +18 -5
- package/dist/sdk/FirmaStakingService.js +15 -8
- package/dist/sdk/FirmaUtil.d.ts +7 -0
- package/dist/sdk/FirmaUtil.js +69 -1
- package/dist/sdk/FirmaWalletService.d.ts +3 -0
- package/dist/sdk/FirmaWalletService.js +18 -10
- package/dist/sdk/firmachain/amino/signer.d.ts +1 -2
- package/dist/sdk/firmachain/authz/AuthzQueryClient.d.ts +48 -0
- package/dist/sdk/firmachain/authz/AuthzQueryClient.js +142 -0
- package/dist/sdk/firmachain/authz/AuthzTxClient.d.ts +22 -0
- package/dist/sdk/firmachain/authz/AuthzTxClient.js +44 -0
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +147 -0
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +358 -0
- package/dist/sdk/firmachain/authz/index.d.ts +3 -0
- package/dist/sdk/firmachain/authz/index.js +15 -0
- package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -0
- package/dist/sdk/firmachain/common/ITxClient.js +9 -0
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +50 -0
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +267 -0
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.d.ts +52 -0
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +193 -0
- package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.d.ts +37 -0
- package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.js +56 -0
- package/dist/sdk/firmachain/cosmwasm/index.d.ts +3 -0
- package/dist/sdk/firmachain/cosmwasm/index.js +15 -0
- package/dist/sdk/firmachain/ibc/IbcQueryClient.d.ts +34 -0
- package/dist/sdk/firmachain/ibc/IbcQueryClient.js +71 -0
- package/dist/sdk/firmachain/ibc/IbcTxClient.d.ts +12 -0
- package/dist/sdk/firmachain/ibc/IbcTxClient.js +36 -0
- package/dist/sdk/firmachain/ibc/index.d.ts +3 -0
- package/dist/sdk/firmachain/ibc/index.js +15 -0
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +17 -4
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +38 -18
- package/package.json +4 -2
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +0 -94
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +0 -437
- package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +0 -23
- package/dist/sdk/firmachain/amino/secp256k1wallet.js +0 -141
|
@@ -0,0 +1,71 @@
|
|
|
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.IbcQueryClient = void 0;
|
|
43
|
+
var axios_1 = __importDefault(require("axios"));
|
|
44
|
+
var IbcQueryClient = /** @class */ (function () {
|
|
45
|
+
function IbcQueryClient(baseUrl) {
|
|
46
|
+
this.axios = axios_1.default.create({
|
|
47
|
+
baseURL: baseUrl,
|
|
48
|
+
headers: {
|
|
49
|
+
Accept: "application/json",
|
|
50
|
+
},
|
|
51
|
+
timeout: 15000,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
IbcQueryClient.prototype.getClientState = function (sourceChannel, sourcePort) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var path, result;
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
path = "/ibc/core/channel/v1/channels/" + sourceChannel + "/ports/" + sourcePort + "/client_state";
|
|
61
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
62
|
+
case 1:
|
|
63
|
+
result = _a.sent();
|
|
64
|
+
return [2 /*return*/, result.data];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
return IbcQueryClient;
|
|
70
|
+
}());
|
|
71
|
+
exports.IbcQueryClient = IbcQueryClient;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EncodeObject } from "@cosmjs/proto-signing";
|
|
2
|
+
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
3
|
+
import { ITxClient } from "../common/ITxClient";
|
|
4
|
+
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
|
|
5
|
+
export interface MsgTransferEncodeObject extends EncodeObject {
|
|
6
|
+
readonly typeUrl: "/ibc.applications.transfer.v1.MsgTransfer";
|
|
7
|
+
readonly value: Partial<MsgTransfer>;
|
|
8
|
+
}
|
|
9
|
+
export declare class IbcTxClient extends ITxClient {
|
|
10
|
+
constructor(wallet: FirmaWalletService, address: string);
|
|
11
|
+
msgTransfer(data: MsgTransfer): MsgTransferEncodeObject;
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.IbcTxClient = void 0;
|
|
19
|
+
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
20
|
+
var ITxClient_1 = require("../common/ITxClient");
|
|
21
|
+
var tx_1 = require("cosmjs-types/ibc/applications/transfer/v1/tx");
|
|
22
|
+
var types = [
|
|
23
|
+
["/ibc.applications.transfer.v1.MsgTransfer", tx_1.MsgTransfer],
|
|
24
|
+
];
|
|
25
|
+
var registry = new proto_signing_1.Registry(types);
|
|
26
|
+
var IbcTxClient = /** @class */ (function (_super) {
|
|
27
|
+
__extends(IbcTxClient, _super);
|
|
28
|
+
function IbcTxClient(wallet, address) {
|
|
29
|
+
return _super.call(this, wallet, address, registry) || this;
|
|
30
|
+
}
|
|
31
|
+
IbcTxClient.prototype.msgTransfer = function (data) {
|
|
32
|
+
return { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: data };
|
|
33
|
+
};
|
|
34
|
+
return IbcTxClient;
|
|
35
|
+
}(ITxClient_1.ITxClient));
|
|
36
|
+
exports.IbcTxClient = IbcTxClient;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./IbcTxClient"), exports);
|
|
14
|
+
__exportStar(require("./IbcQueryClient"), exports);
|
|
15
|
+
__exportStar(require("../common"), exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Pagination } from "../common";
|
|
1
2
|
export interface ParamsDataType {
|
|
2
3
|
unbonding_time: string;
|
|
3
4
|
max_validators: number;
|
|
@@ -83,11 +84,23 @@ export declare class StakingQueryClient {
|
|
|
83
84
|
queryGetDelegationInfoFromValidator(address: string, validatorAddress: string): Promise<DelegationInfo>;
|
|
84
85
|
queryGetTotalUndelegateInfo(address: string): Promise<UndelegationInfo[]>;
|
|
85
86
|
querygetTotalRedelegationInfo(address: string): Promise<RedelegationInfo[]>;
|
|
86
|
-
queryGetUndelegationListFromValidator(
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
queryGetUndelegationListFromValidator(valoperAddress: string, paginationKey?: string): Promise<{
|
|
88
|
+
dataList: UndelegationInfo[];
|
|
89
|
+
pagination: Pagination;
|
|
90
|
+
}>;
|
|
91
|
+
queryGetDelegateListFromValidator(valoperAddress: string, paginationKey?: string): Promise<{
|
|
92
|
+
dataList: DelegationInfo[];
|
|
93
|
+
pagination: Pagination;
|
|
94
|
+
}>;
|
|
95
|
+
queryGetTotalDelegationInfo(address: string, paginationKey?: string): Promise<{
|
|
96
|
+
dataList: DelegationInfo[];
|
|
97
|
+
pagination: Pagination;
|
|
98
|
+
}>;
|
|
89
99
|
queryGetParams(): Promise<ParamsDataType>;
|
|
90
100
|
queryGetPool(): Promise<PoolDataType>;
|
|
91
101
|
queryValidator(valoperAddress: string): Promise<ValidatorDataType>;
|
|
92
|
-
queryValidators(): Promise<
|
|
102
|
+
queryValidators(paginationKey?: string): Promise<{
|
|
103
|
+
dataList: ValidatorDataType[];
|
|
104
|
+
pagination: Pagination;
|
|
105
|
+
}>;
|
|
93
106
|
}
|
|
@@ -113,47 +113,62 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
};
|
|
116
|
-
StakingQueryClient.prototype.queryGetUndelegationListFromValidator = function (
|
|
116
|
+
StakingQueryClient.prototype.queryGetUndelegationListFromValidator = function (valoperAddress, paginationKey) {
|
|
117
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
117
118
|
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var path, result;
|
|
119
|
+
var path, result, convertPagination;
|
|
119
120
|
return __generator(this, function (_a) {
|
|
120
121
|
switch (_a.label) {
|
|
121
122
|
case 0:
|
|
122
|
-
path = "/cosmos/staking/v1beta1/validators/" +
|
|
123
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
123
|
+
path = "/cosmos/staking/v1beta1/validators/" + valoperAddress + "/unbonding_delegations";
|
|
124
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
124
125
|
case 1:
|
|
125
126
|
result = _a.sent();
|
|
126
|
-
|
|
127
|
+
convertPagination = {
|
|
128
|
+
next_key: result.data.pagination.next_key,
|
|
129
|
+
total: Number.parseInt(result.data.pagination.total)
|
|
130
|
+
};
|
|
131
|
+
return [2 /*return*/, { dataList: result.data.unbonding_responses, pagination: convertPagination }];
|
|
127
132
|
}
|
|
128
133
|
});
|
|
129
134
|
});
|
|
130
135
|
};
|
|
131
|
-
StakingQueryClient.prototype.queryGetDelegateListFromValidator = function (
|
|
136
|
+
StakingQueryClient.prototype.queryGetDelegateListFromValidator = function (valoperAddress, paginationKey) {
|
|
137
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
132
138
|
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
-
var path, result;
|
|
139
|
+
var path, result, convertPagination;
|
|
134
140
|
return __generator(this, function (_a) {
|
|
135
141
|
switch (_a.label) {
|
|
136
142
|
case 0:
|
|
137
|
-
path = "/cosmos/staking/v1beta1/validators/" +
|
|
138
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
143
|
+
path = "/cosmos/staking/v1beta1/validators/" + valoperAddress + "/delegations";
|
|
144
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
139
145
|
case 1:
|
|
140
146
|
result = _a.sent();
|
|
141
|
-
|
|
147
|
+
convertPagination = {
|
|
148
|
+
next_key: result.data.pagination.next_key,
|
|
149
|
+
total: Number.parseInt(result.data.pagination.total)
|
|
150
|
+
};
|
|
151
|
+
return [2 /*return*/, { dataList: result.data.delegation_responses, pagination: convertPagination }];
|
|
142
152
|
}
|
|
143
153
|
});
|
|
144
154
|
});
|
|
145
155
|
};
|
|
146
|
-
StakingQueryClient.prototype.queryGetTotalDelegationInfo = function (address) {
|
|
156
|
+
StakingQueryClient.prototype.queryGetTotalDelegationInfo = function (address, paginationKey) {
|
|
157
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
147
158
|
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
-
var path, result;
|
|
159
|
+
var path, result, convertPagination;
|
|
149
160
|
return __generator(this, function (_a) {
|
|
150
161
|
switch (_a.label) {
|
|
151
162
|
case 0:
|
|
152
163
|
path = "/cosmos/staking/v1beta1/delegations/" + address;
|
|
153
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
164
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
154
165
|
case 1:
|
|
155
166
|
result = _a.sent();
|
|
156
|
-
|
|
167
|
+
convertPagination = {
|
|
168
|
+
next_key: result.data.pagination.next_key,
|
|
169
|
+
total: Number.parseInt(result.data.pagination.total)
|
|
170
|
+
};
|
|
171
|
+
return [2 /*return*/, { dataList: result.data.delegation_responses, pagination: convertPagination }];
|
|
157
172
|
}
|
|
158
173
|
});
|
|
159
174
|
});
|
|
@@ -203,17 +218,22 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
203
218
|
});
|
|
204
219
|
});
|
|
205
220
|
};
|
|
206
|
-
StakingQueryClient.prototype.queryValidators = function () {
|
|
221
|
+
StakingQueryClient.prototype.queryValidators = function (paginationKey) {
|
|
222
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
207
223
|
return __awaiter(this, void 0, void 0, function () {
|
|
208
|
-
var path, result;
|
|
224
|
+
var path, result, convertPagination;
|
|
209
225
|
return __generator(this, function (_a) {
|
|
210
226
|
switch (_a.label) {
|
|
211
227
|
case 0:
|
|
212
228
|
path = "/cosmos/staking/v1beta1/validators";
|
|
213
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
229
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
214
230
|
case 1:
|
|
215
231
|
result = _a.sent();
|
|
216
|
-
|
|
232
|
+
convertPagination = {
|
|
233
|
+
next_key: result.data.pagination.next_key,
|
|
234
|
+
total: Number.parseInt(result.data.pagination.total)
|
|
235
|
+
};
|
|
236
|
+
return [2 /*return*/, { dataList: result.data.validators, pagination: convertPagination }];
|
|
217
237
|
}
|
|
218
238
|
});
|
|
219
239
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firmachain/firma-js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.32",
|
|
4
4
|
"description": "The Official FirmaChain Javascript SDK written in Typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -36,12 +36,14 @@
|
|
|
36
36
|
"@cosmjs/math": "^0.26.0",
|
|
37
37
|
"@cosmjs/proto-signing": "^0.25.6",
|
|
38
38
|
"@cosmjs/tendermint-rpc": "^0.26.0",
|
|
39
|
+
"@types/pako": "^2.0.0",
|
|
39
40
|
"axios": "^0.21.4",
|
|
40
41
|
"cosmjs-types": "^0.2.0",
|
|
41
42
|
"crypto-js": "^4.1.1",
|
|
42
43
|
"ipfs-http-client": "^52.0.5",
|
|
43
44
|
"protobufjs": "^6.10.2",
|
|
44
|
-
"readline-sync": "^1.4.10"
|
|
45
|
+
"readline-sync": "^1.4.10",
|
|
46
|
+
"pako": "^2.0.2"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@types/chai": "^4.2.21",
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { EnglishMnemonic, HdPath } from "@cosmjs/crypto";
|
|
2
|
-
import { StdSignDoc } from "./signdoc";
|
|
3
|
-
import { AccountData, AminoSignResponse, OfflineAminoSigner } from "./signer";
|
|
4
|
-
import { EncryptionConfiguration, KdfConfiguration } from "./wallet";
|
|
5
|
-
/**
|
|
6
|
-
* This interface describes a JSON object holding the encrypted wallet and the meta data.
|
|
7
|
-
* All fields in here must be JSON types.
|
|
8
|
-
*/
|
|
9
|
-
export interface Secp256k1HdWalletSerialization {
|
|
10
|
-
/** A format+version identifier for this serialization format */
|
|
11
|
-
readonly type: string;
|
|
12
|
-
/** Information about the key derivation function (i.e. password to encryption key) */
|
|
13
|
-
readonly kdf: KdfConfiguration;
|
|
14
|
-
/** Information about the symmetric encryption */
|
|
15
|
-
readonly encryption: EncryptionConfiguration;
|
|
16
|
-
/** An instance of Secp256k1HdWalletData, which is stringified, encrypted and base64 encoded. */
|
|
17
|
-
readonly data: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function extractKdfConfiguration(serialization: string): KdfConfiguration;
|
|
20
|
-
export interface Secp256k1HdWalletOptions {
|
|
21
|
-
/** The password to use when deriving a BIP39 seed from a mnemonic. */
|
|
22
|
-
readonly bip39Password: string;
|
|
23
|
-
/** The BIP-32/SLIP-10 derivation paths. Defaults to the Cosmos Hub/ATOM path `m/44'/118'/0'/0/0`. */
|
|
24
|
-
readonly hdPaths: readonly HdPath[];
|
|
25
|
-
/** The bech32 address prefix (human readable part). Defaults to "cosmos". */
|
|
26
|
-
readonly prefix: string;
|
|
27
|
-
}
|
|
28
|
-
interface Secp256k1HdWalletConstructorOptions extends Partial<Secp256k1HdWalletOptions> {
|
|
29
|
-
readonly seed: Uint8Array;
|
|
30
|
-
}
|
|
31
|
-
export declare class Secp256k1HdWallet implements OfflineAminoSigner {
|
|
32
|
-
/**
|
|
33
|
-
* Restores a wallet from the given BIP39 mnemonic.
|
|
34
|
-
*
|
|
35
|
-
* @param mnemonic Any valid English mnemonic.
|
|
36
|
-
* @param options An optional `Secp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix.
|
|
37
|
-
*/
|
|
38
|
-
static fromMnemonic(mnemonic: string, options?: Partial<Secp256k1HdWalletOptions>): Promise<Secp256k1HdWallet>;
|
|
39
|
-
/**
|
|
40
|
-
* Generates a new wallet with a BIP39 mnemonic of the given length.
|
|
41
|
-
*
|
|
42
|
-
* @param length The number of words in the mnemonic (12, 15, 18, 21 or 24).
|
|
43
|
-
* @param options An optional `Secp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix.
|
|
44
|
-
*/
|
|
45
|
-
static generate(length?: 12 | 15 | 18 | 21 | 24, options?: Partial<Secp256k1HdWalletOptions>): Promise<Secp256k1HdWallet>;
|
|
46
|
-
/**
|
|
47
|
-
* Restores a wallet from an encrypted serialization.
|
|
48
|
-
*
|
|
49
|
-
* @param password The user provided password used to generate an encryption key via a KDF.
|
|
50
|
-
* This is not normalized internally (see "Unicode normalization" to learn more).
|
|
51
|
-
*/
|
|
52
|
-
static deserialize(serialization: string, password: string): Promise<Secp256k1HdWallet>;
|
|
53
|
-
/**
|
|
54
|
-
* Restores a wallet from an encrypted serialization.
|
|
55
|
-
*
|
|
56
|
-
* This is an advanced alternative to calling `deserialize(serialization, password)` directly, which allows
|
|
57
|
-
* you to offload the KDF execution to a non-UI thread (e.g. in a WebWorker).
|
|
58
|
-
*
|
|
59
|
-
* The caller is responsible for ensuring the key was derived with the given KDF configuration. This can be
|
|
60
|
-
* done using `extractKdfConfiguration(serialization)` and `executeKdf(password, kdfConfiguration)` from this package.
|
|
61
|
-
*/
|
|
62
|
-
static deserializeWithEncryptionKey(serialization: string, encryptionKey: Uint8Array): Promise<Secp256k1HdWallet>;
|
|
63
|
-
private static deserializeTypeV1;
|
|
64
|
-
/** Base secret */
|
|
65
|
-
private readonly secret;
|
|
66
|
-
/** BIP39 seed */
|
|
67
|
-
private readonly seed;
|
|
68
|
-
/** Derivation instruction */
|
|
69
|
-
private readonly accounts;
|
|
70
|
-
protected constructor(mnemonic: EnglishMnemonic, options: Secp256k1HdWalletConstructorOptions);
|
|
71
|
-
get mnemonic(): string;
|
|
72
|
-
getAccounts(): Promise<readonly AccountData[]>;
|
|
73
|
-
signAmino(signerAddress: string, signDoc: StdSignDoc): Promise<AminoSignResponse>;
|
|
74
|
-
/**
|
|
75
|
-
* Generates an encrypted serialization of this wallet.
|
|
76
|
-
*
|
|
77
|
-
* @param password The user provided password used to generate an encryption key via a KDF.
|
|
78
|
-
* This is not normalized internally (see "Unicode normalization" to learn more).
|
|
79
|
-
*/
|
|
80
|
-
serialize(password: string): Promise<string>;
|
|
81
|
-
/**
|
|
82
|
-
* Generates an encrypted serialization of this wallet.
|
|
83
|
-
*
|
|
84
|
-
* This is an advanced alternative to calling `serialize(password)` directly, which allows you to
|
|
85
|
-
* offload the KDF execution to a non-UI thread (e.g. in a WebWorker).
|
|
86
|
-
*
|
|
87
|
-
* The caller is responsible for ensuring the key was derived with the given KDF options. If this
|
|
88
|
-
* is not the case, the wallet cannot be restored with the original password.
|
|
89
|
-
*/
|
|
90
|
-
serializeWithEncryptionKey(encryptionKey: Uint8Array, kdfConfiguration: KdfConfiguration): Promise<string>;
|
|
91
|
-
private getKeyPair;
|
|
92
|
-
private getAccountsWithPrivkeys;
|
|
93
|
-
}
|
|
94
|
-
export {};
|