@keplr-wallet/cosmos 0.9.4-rc.0 → 0.9.7
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/build/account/account.spec.d.ts +1 -0
- package/build/account/account.spec.js +76 -0
- package/build/account/account.spec.js.map +1 -0
- package/build/account/index.js +7 -4
- package/build/account/index.js.map +1 -1
- package/build/stargate/proto/generated/codecimpl.d.ts +146 -0
- package/build/stargate/proto/generated/codecimpl.js +167 -0
- package/package.json +7 -6
- package/src/account/account.spec.ts +88 -0
- package/src/account/index.ts +9 -7
- package/src/stargate/proto/generated/codecimpl.d.ts +146 -0
- package/src/stargate/proto/generated/codecimpl.js +167 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("./index");
|
|
4
|
+
describe("Test account parse", () => {
|
|
5
|
+
test("Test fromAminoJSON", () => {
|
|
6
|
+
// Base account
|
|
7
|
+
let account = index_1.BaseAccount.fromAminoJSON({
|
|
8
|
+
height: "8409557",
|
|
9
|
+
result: {
|
|
10
|
+
type: "cosmos-sdk/BaseAccount",
|
|
11
|
+
value: {
|
|
12
|
+
address: "cosmos1vv6hruquzpty4xpks9znkw8gys5x4nsnqw9f4k",
|
|
13
|
+
public_key: {
|
|
14
|
+
type: "tendermint/PubKeySecp256k1",
|
|
15
|
+
value: "Avn3xBbmE0+MEyWMuxhmjjiX1GtCUVyv/Mavg8OcRIm4",
|
|
16
|
+
},
|
|
17
|
+
account_number: "9736",
|
|
18
|
+
sequence: "971",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
expect(account.getAddress()).toBe("cosmos1vv6hruquzpty4xpks9znkw8gys5x4nsnqw9f4k");
|
|
23
|
+
expect(account.getSequence().toString()).toBe("971");
|
|
24
|
+
expect(account.getAccountNumber().toString()).toBe("9736");
|
|
25
|
+
expect(account.getType()).toBe("cosmos-sdk/BaseAccount");
|
|
26
|
+
// Vesting account
|
|
27
|
+
account = index_1.BaseAccount.fromAminoJSON({
|
|
28
|
+
height: "8409738",
|
|
29
|
+
result: {
|
|
30
|
+
type: "cosmos-sdk/DelayedVestingAccount",
|
|
31
|
+
value: {
|
|
32
|
+
base_vesting_account: {
|
|
33
|
+
base_account: {
|
|
34
|
+
address: "cosmos1x3rhderemr703f4lxktk2da99vl5crs28ur3xl",
|
|
35
|
+
public_key: {
|
|
36
|
+
type: "tendermint/PubKeySecp256k1",
|
|
37
|
+
value: "A+Zzm/8QhyL00ISXgiAgeW6zeqZHezVFi2w3iQkJeKyP",
|
|
38
|
+
},
|
|
39
|
+
account_number: "367245",
|
|
40
|
+
sequence: "7",
|
|
41
|
+
},
|
|
42
|
+
original_vesting: [{ denom: "uatom", amount: "16666660000" }],
|
|
43
|
+
delegated_free: [],
|
|
44
|
+
delegated_vesting: [],
|
|
45
|
+
end_time: "1719752607",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
expect(account.getAddress()).toBe("cosmos1x3rhderemr703f4lxktk2da99vl5crs28ur3xl");
|
|
51
|
+
expect(account.getSequence().toString()).toBe("7");
|
|
52
|
+
expect(account.getAccountNumber().toString()).toBe("367245");
|
|
53
|
+
expect(account.getType()).toBe("cosmos-sdk/DelayedVestingAccount");
|
|
54
|
+
// Custom account that embeds the base account (ethermint)
|
|
55
|
+
account = index_1.BaseAccount.fromAminoJSON({
|
|
56
|
+
height: "449",
|
|
57
|
+
result: {
|
|
58
|
+
base_account: {
|
|
59
|
+
address: "evmos1w3ygakvq5snf30pca5g8pnyvvfr7x28djnj34m",
|
|
60
|
+
public_key: {
|
|
61
|
+
type: "tendermint/PubKeySecp256k1",
|
|
62
|
+
value: "AulWtcPTIZWd/CnkFkQOMqDOwU7e+U/Iq8Tli1nhBq6j",
|
|
63
|
+
},
|
|
64
|
+
account_number: "11",
|
|
65
|
+
sequence: "1",
|
|
66
|
+
},
|
|
67
|
+
code_hash: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
expect(account.getAddress()).toBe("evmos1w3ygakvq5snf30pca5g8pnyvvfr7x28djnj34m");
|
|
71
|
+
expect(account.getSequence().toString()).toBe("1");
|
|
72
|
+
expect(account.getAccountNumber().toString()).toBe("11");
|
|
73
|
+
expect(account.getType()).toBe("");
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=account.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.spec.js","sourceRoot":"","sources":["../../src/account/account.spec.ts"],"names":[],"mappings":"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"}
|
package/build/account/index.js
CHANGED
|
@@ -36,6 +36,12 @@ class BaseAccount {
|
|
|
36
36
|
}
|
|
37
37
|
const type = obj.type || "";
|
|
38
38
|
let value = "value" in obj ? obj.value : obj;
|
|
39
|
+
// If the chain modifies the account type, handle the case where the account type embeds the base account.
|
|
40
|
+
// (Actually, the only existent case is ethermint, and this is the line for handling ethermint)
|
|
41
|
+
const baseAccount = value.BaseAccount || value.baseAccount || value.base_account;
|
|
42
|
+
if (baseAccount) {
|
|
43
|
+
value = baseAccount;
|
|
44
|
+
}
|
|
39
45
|
// If the account is the vesting account that embeds the base vesting account,
|
|
40
46
|
// the actual base account exists under the base vesting account.
|
|
41
47
|
// But, this can be different according to the version of cosmos-sdk.
|
|
@@ -57,11 +63,8 @@ class BaseAccount {
|
|
|
57
63
|
address = defaultBech32Address;
|
|
58
64
|
}
|
|
59
65
|
const accountNumber = value.account_number;
|
|
60
|
-
if (accountNumber == null) {
|
|
61
|
-
throw new Error(`Account's account number is unknown: ${JSON.stringify(obj)}`);
|
|
62
|
-
}
|
|
63
66
|
const sequence = value.sequence;
|
|
64
|
-
return new BaseAccount(type, address, new unit_1.Int(accountNumber), new unit_1.Int(sequence !== null && sequence !== void 0 ? sequence : "0"));
|
|
67
|
+
return new BaseAccount(type, address, new unit_1.Int(accountNumber !== null && accountNumber !== void 0 ? accountNumber : "0"), new unit_1.Int(sequence !== null && sequence !== void 0 ? sequence : "0"));
|
|
65
68
|
}
|
|
66
69
|
getType() {
|
|
67
70
|
return this.type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAyC;AAUzC,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAyC;AAUzC,MAAa,WAAW;IAgFtB,YACqB,IAAY,EACZ,OAAe,EACf,aAAkB,EAClB,QAAa;QAHb,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,kBAAa,GAAb,aAAa,CAAK;QAClB,aAAQ,GAAR,QAAQ,CAAK;IAC/B,CAAC;IApFG,MAAM,CAAO,aAAa,CAC/B,QAAuB,EACvB,OAAe;IACf,4FAA4F;IAC5F,+GAA+G;IAC/G,uBAAgC,KAAK;;YAErC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;YAE9D,OAAO,WAAW,CAAC,aAAa,CAC9B,MAAM,CAAC,IAAI,EACX,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CACpC,CAAC;QACJ,CAAC;KAAA;IAEM,MAAM,CAAC,aAAa,CACzB,GAQgC;IAChC,4FAA4F;IAC5F,+GAA+G;IAC/G,uBAA+B,EAAE;QAEjC,IAAI,QAAQ,IAAI,GAAG,EAAE;YACnB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;SAClB;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QAE5B,IAAI,KAAK,GAAG,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;QAE7C,0GAA0G;QAC1G,+FAA+F;QAC/F,MAAM,WAAW,GACf,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,YAAY,CAAC;QAC/D,IAAI,WAAW,EAAE;YACf,KAAK,GAAG,WAAW,CAAC;SACrB;QAED,8EAA8E;QAC9E,iEAAiE;QACjE,qEAAqE;QACrE,8CAA8C;QAC9C,MAAM,kBAAkB,GACtB,KAAK,CAAC,kBAAkB;YACxB,KAAK,CAAC,kBAAkB;YACxB,KAAK,CAAC,oBAAoB,CAAC;QAC7B,IAAI,kBAAkB,EAAE;YACtB,KAAK;gBACH,kBAAkB,CAAC,WAAW;oBAC9B,kBAAkB,CAAC,WAAW;oBAC9B,kBAAkB,CAAC,YAAY,CAAC;SACnC;QAED,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,EAAE;YACZ,IAAI,CAAC,oBAAoB,EAAE;gBACzB,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;aACzE;YACD,OAAO,GAAG,oBAAoB,CAAC;SAChC;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC;QAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEhC,OAAO,IAAI,WAAW,CACpB,IAAI,EACJ,OAAO,EACP,IAAI,UAAG,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,GAAG,CAAC,EAC7B,IAAI,UAAG,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,GAAG,CAAC,CACzB,CAAC;IACJ,CAAC;IASD,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAtGD,kCAsGC"}
|
|
@@ -2227,6 +2227,152 @@ export namespace cosmos {
|
|
|
2227
2227
|
public toJSON(): { [k: string]: any };
|
|
2228
2228
|
}
|
|
2229
2229
|
}
|
|
2230
|
+
|
|
2231
|
+
/** Namespace abci. */
|
|
2232
|
+
namespace abci {
|
|
2233
|
+
|
|
2234
|
+
/** Namespace v1beta1. */
|
|
2235
|
+
namespace v1beta1 {
|
|
2236
|
+
|
|
2237
|
+
/** Properties of a MsgData. */
|
|
2238
|
+
interface IMsgData {
|
|
2239
|
+
|
|
2240
|
+
/** MsgData msgType */
|
|
2241
|
+
msgType?: (string|null);
|
|
2242
|
+
|
|
2243
|
+
/** MsgData data */
|
|
2244
|
+
data?: (Uint8Array|null);
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
/** Represents a MsgData. */
|
|
2248
|
+
class MsgData implements IMsgData {
|
|
2249
|
+
|
|
2250
|
+
/**
|
|
2251
|
+
* Constructs a new MsgData.
|
|
2252
|
+
* @param [p] Properties to set
|
|
2253
|
+
*/
|
|
2254
|
+
constructor(p?: cosmos.base.abci.v1beta1.IMsgData);
|
|
2255
|
+
|
|
2256
|
+
/** MsgData msgType. */
|
|
2257
|
+
public msgType: string;
|
|
2258
|
+
|
|
2259
|
+
/** MsgData data. */
|
|
2260
|
+
public data: Uint8Array;
|
|
2261
|
+
|
|
2262
|
+
/**
|
|
2263
|
+
* Creates a new MsgData instance using the specified properties.
|
|
2264
|
+
* @param [properties] Properties to set
|
|
2265
|
+
* @returns MsgData instance
|
|
2266
|
+
*/
|
|
2267
|
+
public static create(properties?: cosmos.base.abci.v1beta1.IMsgData): cosmos.base.abci.v1beta1.MsgData;
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* Encodes the specified MsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.MsgData.verify|verify} messages.
|
|
2271
|
+
* @param m MsgData message or plain object to encode
|
|
2272
|
+
* @param [w] Writer to encode to
|
|
2273
|
+
* @returns Writer
|
|
2274
|
+
*/
|
|
2275
|
+
public static encode(m: cosmos.base.abci.v1beta1.IMsgData, w?: $protobuf.Writer): $protobuf.Writer;
|
|
2276
|
+
|
|
2277
|
+
/**
|
|
2278
|
+
* Decodes a MsgData message from the specified reader or buffer.
|
|
2279
|
+
* @param r Reader or buffer to decode from
|
|
2280
|
+
* @param [l] Message length if known beforehand
|
|
2281
|
+
* @returns MsgData
|
|
2282
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2283
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2284
|
+
*/
|
|
2285
|
+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): cosmos.base.abci.v1beta1.MsgData;
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* Creates a MsgData message from a plain object. Also converts values to their respective internal types.
|
|
2289
|
+
* @param d Plain object
|
|
2290
|
+
* @returns MsgData
|
|
2291
|
+
*/
|
|
2292
|
+
public static fromObject(d: { [k: string]: any }): cosmos.base.abci.v1beta1.MsgData;
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* Creates a plain object from a MsgData message. Also converts values to other types if specified.
|
|
2296
|
+
* @param m MsgData
|
|
2297
|
+
* @param [o] Conversion options
|
|
2298
|
+
* @returns Plain object
|
|
2299
|
+
*/
|
|
2300
|
+
public static toObject(m: cosmos.base.abci.v1beta1.MsgData, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Converts this MsgData to JSON.
|
|
2304
|
+
* @returns JSON object
|
|
2305
|
+
*/
|
|
2306
|
+
public toJSON(): { [k: string]: any };
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
/** Properties of a TxMsgData. */
|
|
2310
|
+
interface ITxMsgData {
|
|
2311
|
+
|
|
2312
|
+
/** TxMsgData data */
|
|
2313
|
+
data?: (cosmos.base.abci.v1beta1.IMsgData[]|null);
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
/** Represents a TxMsgData. */
|
|
2317
|
+
class TxMsgData implements ITxMsgData {
|
|
2318
|
+
|
|
2319
|
+
/**
|
|
2320
|
+
* Constructs a new TxMsgData.
|
|
2321
|
+
* @param [p] Properties to set
|
|
2322
|
+
*/
|
|
2323
|
+
constructor(p?: cosmos.base.abci.v1beta1.ITxMsgData);
|
|
2324
|
+
|
|
2325
|
+
/** TxMsgData data. */
|
|
2326
|
+
public data: cosmos.base.abci.v1beta1.IMsgData[];
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* Creates a new TxMsgData instance using the specified properties.
|
|
2330
|
+
* @param [properties] Properties to set
|
|
2331
|
+
* @returns TxMsgData instance
|
|
2332
|
+
*/
|
|
2333
|
+
public static create(properties?: cosmos.base.abci.v1beta1.ITxMsgData): cosmos.base.abci.v1beta1.TxMsgData;
|
|
2334
|
+
|
|
2335
|
+
/**
|
|
2336
|
+
* Encodes the specified TxMsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.TxMsgData.verify|verify} messages.
|
|
2337
|
+
* @param m TxMsgData message or plain object to encode
|
|
2338
|
+
* @param [w] Writer to encode to
|
|
2339
|
+
* @returns Writer
|
|
2340
|
+
*/
|
|
2341
|
+
public static encode(m: cosmos.base.abci.v1beta1.ITxMsgData, w?: $protobuf.Writer): $protobuf.Writer;
|
|
2342
|
+
|
|
2343
|
+
/**
|
|
2344
|
+
* Decodes a TxMsgData message from the specified reader or buffer.
|
|
2345
|
+
* @param r Reader or buffer to decode from
|
|
2346
|
+
* @param [l] Message length if known beforehand
|
|
2347
|
+
* @returns TxMsgData
|
|
2348
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2349
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2350
|
+
*/
|
|
2351
|
+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): cosmos.base.abci.v1beta1.TxMsgData;
|
|
2352
|
+
|
|
2353
|
+
/**
|
|
2354
|
+
* Creates a TxMsgData message from a plain object. Also converts values to their respective internal types.
|
|
2355
|
+
* @param d Plain object
|
|
2356
|
+
* @returns TxMsgData
|
|
2357
|
+
*/
|
|
2358
|
+
public static fromObject(d: { [k: string]: any }): cosmos.base.abci.v1beta1.TxMsgData;
|
|
2359
|
+
|
|
2360
|
+
/**
|
|
2361
|
+
* Creates a plain object from a TxMsgData message. Also converts values to other types if specified.
|
|
2362
|
+
* @param m TxMsgData
|
|
2363
|
+
* @param [o] Conversion options
|
|
2364
|
+
* @returns Plain object
|
|
2365
|
+
*/
|
|
2366
|
+
public static toObject(m: cosmos.base.abci.v1beta1.TxMsgData, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* Converts this TxMsgData to JSON.
|
|
2370
|
+
* @returns JSON object
|
|
2371
|
+
*/
|
|
2372
|
+
public toJSON(): { [k: string]: any };
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2230
2376
|
}
|
|
2231
2377
|
|
|
2232
2378
|
/** Namespace crypto. */
|
|
@@ -2235,6 +2235,173 @@ exports.cosmos = $root.cosmos = (() => {
|
|
|
2235
2235
|
})();
|
|
2236
2236
|
return v1beta1;
|
|
2237
2237
|
})();
|
|
2238
|
+
base.abci = (function () {
|
|
2239
|
+
const abci = {};
|
|
2240
|
+
abci.v1beta1 = (function () {
|
|
2241
|
+
const v1beta1 = {};
|
|
2242
|
+
v1beta1.MsgData = (function () {
|
|
2243
|
+
function MsgData(p) {
|
|
2244
|
+
if (p)
|
|
2245
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2246
|
+
if (p[ks[i]] != null)
|
|
2247
|
+
this[ks[i]] = p[ks[i]];
|
|
2248
|
+
}
|
|
2249
|
+
MsgData.prototype.msgType = "";
|
|
2250
|
+
MsgData.prototype.data = $util.newBuffer([]);
|
|
2251
|
+
MsgData.create = function create(properties) {
|
|
2252
|
+
return new MsgData(properties);
|
|
2253
|
+
};
|
|
2254
|
+
MsgData.encode = function encode(m, w) {
|
|
2255
|
+
if (!w)
|
|
2256
|
+
w = $Writer.create();
|
|
2257
|
+
if (m.msgType != null && Object.hasOwnProperty.call(m, "msgType"))
|
|
2258
|
+
w.uint32(10).string(m.msgType);
|
|
2259
|
+
if (m.data != null && Object.hasOwnProperty.call(m, "data"))
|
|
2260
|
+
w.uint32(18).bytes(m.data);
|
|
2261
|
+
return w;
|
|
2262
|
+
};
|
|
2263
|
+
MsgData.decode = function decode(r, l) {
|
|
2264
|
+
if (!(r instanceof $Reader))
|
|
2265
|
+
r = $Reader.create(r);
|
|
2266
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.cosmos.base.abci.v1beta1.MsgData();
|
|
2267
|
+
while (r.pos < c) {
|
|
2268
|
+
var t = r.uint32();
|
|
2269
|
+
switch (t >>> 3) {
|
|
2270
|
+
case 1:
|
|
2271
|
+
m.msgType = r.string();
|
|
2272
|
+
break;
|
|
2273
|
+
case 2:
|
|
2274
|
+
m.data = r.bytes();
|
|
2275
|
+
break;
|
|
2276
|
+
default:
|
|
2277
|
+
r.skipType(t & 7);
|
|
2278
|
+
break;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
return m;
|
|
2282
|
+
};
|
|
2283
|
+
MsgData.fromObject = function fromObject(d) {
|
|
2284
|
+
if (d instanceof $root.cosmos.base.abci.v1beta1.MsgData)
|
|
2285
|
+
return d;
|
|
2286
|
+
var m = new $root.cosmos.base.abci.v1beta1.MsgData();
|
|
2287
|
+
if (d.msgType != null) {
|
|
2288
|
+
m.msgType = String(d.msgType);
|
|
2289
|
+
}
|
|
2290
|
+
if (d.data != null) {
|
|
2291
|
+
if (typeof d.data === "string")
|
|
2292
|
+
$util.base64.decode(d.data, m.data = $util.newBuffer($util.base64.length(d.data)), 0);
|
|
2293
|
+
else if (d.data.length)
|
|
2294
|
+
m.data = d.data;
|
|
2295
|
+
}
|
|
2296
|
+
return m;
|
|
2297
|
+
};
|
|
2298
|
+
MsgData.toObject = function toObject(m, o) {
|
|
2299
|
+
if (!o)
|
|
2300
|
+
o = {};
|
|
2301
|
+
var d = {};
|
|
2302
|
+
if (o.defaults) {
|
|
2303
|
+
d.msgType = "";
|
|
2304
|
+
if (o.bytes === String)
|
|
2305
|
+
d.data = "";
|
|
2306
|
+
else {
|
|
2307
|
+
d.data = [];
|
|
2308
|
+
if (o.bytes !== Array)
|
|
2309
|
+
d.data = $util.newBuffer(d.data);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
if (m.msgType != null && m.hasOwnProperty("msgType")) {
|
|
2313
|
+
d.msgType = m.msgType;
|
|
2314
|
+
}
|
|
2315
|
+
if (m.data != null && m.hasOwnProperty("data")) {
|
|
2316
|
+
d.data = o.bytes === String ? $util.base64.encode(m.data, 0, m.data.length) : o.bytes === Array ? Array.prototype.slice.call(m.data) : m.data;
|
|
2317
|
+
}
|
|
2318
|
+
return d;
|
|
2319
|
+
};
|
|
2320
|
+
MsgData.prototype.toJSON = function toJSON() {
|
|
2321
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2322
|
+
};
|
|
2323
|
+
return MsgData;
|
|
2324
|
+
})();
|
|
2325
|
+
v1beta1.TxMsgData = (function () {
|
|
2326
|
+
function TxMsgData(p) {
|
|
2327
|
+
this.data = [];
|
|
2328
|
+
if (p)
|
|
2329
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2330
|
+
if (p[ks[i]] != null)
|
|
2331
|
+
this[ks[i]] = p[ks[i]];
|
|
2332
|
+
}
|
|
2333
|
+
TxMsgData.prototype.data = $util.emptyArray;
|
|
2334
|
+
TxMsgData.create = function create(properties) {
|
|
2335
|
+
return new TxMsgData(properties);
|
|
2336
|
+
};
|
|
2337
|
+
TxMsgData.encode = function encode(m, w) {
|
|
2338
|
+
if (!w)
|
|
2339
|
+
w = $Writer.create();
|
|
2340
|
+
if (m.data != null && m.data.length) {
|
|
2341
|
+
for (var i = 0; i < m.data.length; ++i)
|
|
2342
|
+
$root.cosmos.base.abci.v1beta1.MsgData.encode(m.data[i], w.uint32(10).fork()).ldelim();
|
|
2343
|
+
}
|
|
2344
|
+
return w;
|
|
2345
|
+
};
|
|
2346
|
+
TxMsgData.decode = function decode(r, l) {
|
|
2347
|
+
if (!(r instanceof $Reader))
|
|
2348
|
+
r = $Reader.create(r);
|
|
2349
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.cosmos.base.abci.v1beta1.TxMsgData();
|
|
2350
|
+
while (r.pos < c) {
|
|
2351
|
+
var t = r.uint32();
|
|
2352
|
+
switch (t >>> 3) {
|
|
2353
|
+
case 1:
|
|
2354
|
+
if (!(m.data && m.data.length))
|
|
2355
|
+
m.data = [];
|
|
2356
|
+
m.data.push($root.cosmos.base.abci.v1beta1.MsgData.decode(r, r.uint32()));
|
|
2357
|
+
break;
|
|
2358
|
+
default:
|
|
2359
|
+
r.skipType(t & 7);
|
|
2360
|
+
break;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
return m;
|
|
2364
|
+
};
|
|
2365
|
+
TxMsgData.fromObject = function fromObject(d) {
|
|
2366
|
+
if (d instanceof $root.cosmos.base.abci.v1beta1.TxMsgData)
|
|
2367
|
+
return d;
|
|
2368
|
+
var m = new $root.cosmos.base.abci.v1beta1.TxMsgData();
|
|
2369
|
+
if (d.data) {
|
|
2370
|
+
if (!Array.isArray(d.data))
|
|
2371
|
+
throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: array expected");
|
|
2372
|
+
m.data = [];
|
|
2373
|
+
for (var i = 0; i < d.data.length; ++i) {
|
|
2374
|
+
if (typeof d.data[i] !== "object")
|
|
2375
|
+
throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: object expected");
|
|
2376
|
+
m.data[i] = $root.cosmos.base.abci.v1beta1.MsgData.fromObject(d.data[i]);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
return m;
|
|
2380
|
+
};
|
|
2381
|
+
TxMsgData.toObject = function toObject(m, o) {
|
|
2382
|
+
if (!o)
|
|
2383
|
+
o = {};
|
|
2384
|
+
var d = {};
|
|
2385
|
+
if (o.arrays || o.defaults) {
|
|
2386
|
+
d.data = [];
|
|
2387
|
+
}
|
|
2388
|
+
if (m.data && m.data.length) {
|
|
2389
|
+
d.data = [];
|
|
2390
|
+
for (var j = 0; j < m.data.length; ++j) {
|
|
2391
|
+
d.data[j] = $root.cosmos.base.abci.v1beta1.MsgData.toObject(m.data[j], o);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
return d;
|
|
2395
|
+
};
|
|
2396
|
+
TxMsgData.prototype.toJSON = function toJSON() {
|
|
2397
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2398
|
+
};
|
|
2399
|
+
return TxMsgData;
|
|
2400
|
+
})();
|
|
2401
|
+
return v1beta1;
|
|
2402
|
+
})();
|
|
2403
|
+
return abci;
|
|
2404
|
+
})();
|
|
2238
2405
|
return base;
|
|
2239
2406
|
})();
|
|
2240
2407
|
cosmos.crypto = (function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keplr-wallet/cosmos",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"author": "chainapsis",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,21 +10,22 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"clean": "rm -rf node_modules; rm -rf build",
|
|
13
|
-
"build": "
|
|
14
|
-
"
|
|
13
|
+
"build": "yarn build:proto && tsc",
|
|
14
|
+
"build:proto": "mkdir -p build/stargate/proto/generated && cp ./src/stargate/proto/generated/* ./build/stargate/proto/generated",
|
|
15
|
+
"dev": "yarn build:proto && tsc -w",
|
|
15
16
|
"test": "jest --passWithNoTests",
|
|
16
17
|
"lint-test": "eslint \"src/**/*\" && prettier --check \"src/**/*\"",
|
|
17
18
|
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"@cosmjs/launchpad": "^0.24.0-alpha.25",
|
|
21
|
-
"@keplr-wallet/types": "^0.9.
|
|
22
|
-
"@keplr-wallet/unit": "^0.9.
|
|
22
|
+
"@keplr-wallet/types": "^0.9.6",
|
|
23
|
+
"@keplr-wallet/unit": "^0.9.6",
|
|
23
24
|
"axios": "^0.21.0",
|
|
24
25
|
"bech32": "^1.1.4",
|
|
25
26
|
"buffer": "^6.0.3",
|
|
26
27
|
"long": "^4.0.0",
|
|
27
28
|
"protobufjs": "^6.10.2"
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "5295e9b866f01459b7809b54b6cf9c146b115721"
|
|
30
31
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { BaseAccount } from "./index";
|
|
2
|
+
|
|
3
|
+
describe("Test account parse", () => {
|
|
4
|
+
test("Test fromAminoJSON", () => {
|
|
5
|
+
// Base account
|
|
6
|
+
let account = BaseAccount.fromAminoJSON({
|
|
7
|
+
height: "8409557",
|
|
8
|
+
result: {
|
|
9
|
+
type: "cosmos-sdk/BaseAccount",
|
|
10
|
+
value: {
|
|
11
|
+
address: "cosmos1vv6hruquzpty4xpks9znkw8gys5x4nsnqw9f4k",
|
|
12
|
+
public_key: {
|
|
13
|
+
type: "tendermint/PubKeySecp256k1",
|
|
14
|
+
value: "Avn3xBbmE0+MEyWMuxhmjjiX1GtCUVyv/Mavg8OcRIm4",
|
|
15
|
+
},
|
|
16
|
+
account_number: "9736",
|
|
17
|
+
sequence: "971",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
expect(account.getAddress()).toBe(
|
|
23
|
+
"cosmos1vv6hruquzpty4xpks9znkw8gys5x4nsnqw9f4k"
|
|
24
|
+
);
|
|
25
|
+
expect(account.getSequence().toString()).toBe("971");
|
|
26
|
+
expect(account.getAccountNumber().toString()).toBe("9736");
|
|
27
|
+
expect(account.getType()).toBe("cosmos-sdk/BaseAccount");
|
|
28
|
+
|
|
29
|
+
// Vesting account
|
|
30
|
+
account = BaseAccount.fromAminoJSON({
|
|
31
|
+
height: "8409738",
|
|
32
|
+
result: {
|
|
33
|
+
type: "cosmos-sdk/DelayedVestingAccount",
|
|
34
|
+
value: {
|
|
35
|
+
base_vesting_account: {
|
|
36
|
+
base_account: {
|
|
37
|
+
address: "cosmos1x3rhderemr703f4lxktk2da99vl5crs28ur3xl",
|
|
38
|
+
public_key: {
|
|
39
|
+
type: "tendermint/PubKeySecp256k1",
|
|
40
|
+
value: "A+Zzm/8QhyL00ISXgiAgeW6zeqZHezVFi2w3iQkJeKyP",
|
|
41
|
+
},
|
|
42
|
+
account_number: "367245",
|
|
43
|
+
sequence: "7",
|
|
44
|
+
},
|
|
45
|
+
original_vesting: [{ denom: "uatom", amount: "16666660000" }],
|
|
46
|
+
delegated_free: [],
|
|
47
|
+
delegated_vesting: [],
|
|
48
|
+
end_time: "1719752607",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
expect(account.getAddress()).toBe(
|
|
55
|
+
"cosmos1x3rhderemr703f4lxktk2da99vl5crs28ur3xl"
|
|
56
|
+
);
|
|
57
|
+
expect(account.getSequence().toString()).toBe("7");
|
|
58
|
+
expect(account.getAccountNumber().toString()).toBe("367245");
|
|
59
|
+
expect(account.getType()).toBe("cosmos-sdk/DelayedVestingAccount");
|
|
60
|
+
|
|
61
|
+
// Custom account that embeds the base account (ethermint)
|
|
62
|
+
account = BaseAccount.fromAminoJSON({
|
|
63
|
+
height: "449",
|
|
64
|
+
result: {
|
|
65
|
+
base_account: {
|
|
66
|
+
address: "evmos1w3ygakvq5snf30pca5g8pnyvvfr7x28djnj34m",
|
|
67
|
+
public_key: {
|
|
68
|
+
type: "tendermint/PubKeySecp256k1",
|
|
69
|
+
value: "AulWtcPTIZWd/CnkFkQOMqDOwU7e+U/Iq8Tli1nhBq6j",
|
|
70
|
+
},
|
|
71
|
+
account_number: "11",
|
|
72
|
+
sequence: "1",
|
|
73
|
+
},
|
|
74
|
+
code_hash:
|
|
75
|
+
"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
|
76
|
+
},
|
|
77
|
+
// Above makes the type error.
|
|
78
|
+
// But, just test that it can be parsed with ignoring the type error.
|
|
79
|
+
} as any);
|
|
80
|
+
|
|
81
|
+
expect(account.getAddress()).toBe(
|
|
82
|
+
"evmos1w3ygakvq5snf30pca5g8pnyvvfr7x28djnj34m"
|
|
83
|
+
);
|
|
84
|
+
expect(account.getSequence().toString()).toBe("1");
|
|
85
|
+
expect(account.getAccountNumber().toString()).toBe("11");
|
|
86
|
+
expect(account.getType()).toBe("");
|
|
87
|
+
});
|
|
88
|
+
});
|
package/src/account/index.ts
CHANGED
|
@@ -46,6 +46,14 @@ export class BaseAccount implements Account {
|
|
|
46
46
|
|
|
47
47
|
let value = "value" in obj ? obj.value : obj;
|
|
48
48
|
|
|
49
|
+
// If the chain modifies the account type, handle the case where the account type embeds the base account.
|
|
50
|
+
// (Actually, the only existent case is ethermint, and this is the line for handling ethermint)
|
|
51
|
+
const baseAccount =
|
|
52
|
+
value.BaseAccount || value.baseAccount || value.base_account;
|
|
53
|
+
if (baseAccount) {
|
|
54
|
+
value = baseAccount;
|
|
55
|
+
}
|
|
56
|
+
|
|
49
57
|
// If the account is the vesting account that embeds the base vesting account,
|
|
50
58
|
// the actual base account exists under the base vesting account.
|
|
51
59
|
// But, this can be different according to the version of cosmos-sdk.
|
|
@@ -70,18 +78,12 @@ export class BaseAccount implements Account {
|
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
const accountNumber = value.account_number;
|
|
73
|
-
if (accountNumber == null) {
|
|
74
|
-
throw new Error(
|
|
75
|
-
`Account's account number is unknown: ${JSON.stringify(obj)}`
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
81
|
const sequence = value.sequence;
|
|
80
82
|
|
|
81
83
|
return new BaseAccount(
|
|
82
84
|
type,
|
|
83
85
|
address,
|
|
84
|
-
new Int(accountNumber),
|
|
86
|
+
new Int(accountNumber ?? "0"),
|
|
85
87
|
new Int(sequence ?? "0")
|
|
86
88
|
);
|
|
87
89
|
}
|
|
@@ -2227,6 +2227,152 @@ export namespace cosmos {
|
|
|
2227
2227
|
public toJSON(): { [k: string]: any };
|
|
2228
2228
|
}
|
|
2229
2229
|
}
|
|
2230
|
+
|
|
2231
|
+
/** Namespace abci. */
|
|
2232
|
+
namespace abci {
|
|
2233
|
+
|
|
2234
|
+
/** Namespace v1beta1. */
|
|
2235
|
+
namespace v1beta1 {
|
|
2236
|
+
|
|
2237
|
+
/** Properties of a MsgData. */
|
|
2238
|
+
interface IMsgData {
|
|
2239
|
+
|
|
2240
|
+
/** MsgData msgType */
|
|
2241
|
+
msgType?: (string|null);
|
|
2242
|
+
|
|
2243
|
+
/** MsgData data */
|
|
2244
|
+
data?: (Uint8Array|null);
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
/** Represents a MsgData. */
|
|
2248
|
+
class MsgData implements IMsgData {
|
|
2249
|
+
|
|
2250
|
+
/**
|
|
2251
|
+
* Constructs a new MsgData.
|
|
2252
|
+
* @param [p] Properties to set
|
|
2253
|
+
*/
|
|
2254
|
+
constructor(p?: cosmos.base.abci.v1beta1.IMsgData);
|
|
2255
|
+
|
|
2256
|
+
/** MsgData msgType. */
|
|
2257
|
+
public msgType: string;
|
|
2258
|
+
|
|
2259
|
+
/** MsgData data. */
|
|
2260
|
+
public data: Uint8Array;
|
|
2261
|
+
|
|
2262
|
+
/**
|
|
2263
|
+
* Creates a new MsgData instance using the specified properties.
|
|
2264
|
+
* @param [properties] Properties to set
|
|
2265
|
+
* @returns MsgData instance
|
|
2266
|
+
*/
|
|
2267
|
+
public static create(properties?: cosmos.base.abci.v1beta1.IMsgData): cosmos.base.abci.v1beta1.MsgData;
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* Encodes the specified MsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.MsgData.verify|verify} messages.
|
|
2271
|
+
* @param m MsgData message or plain object to encode
|
|
2272
|
+
* @param [w] Writer to encode to
|
|
2273
|
+
* @returns Writer
|
|
2274
|
+
*/
|
|
2275
|
+
public static encode(m: cosmos.base.abci.v1beta1.IMsgData, w?: $protobuf.Writer): $protobuf.Writer;
|
|
2276
|
+
|
|
2277
|
+
/**
|
|
2278
|
+
* Decodes a MsgData message from the specified reader or buffer.
|
|
2279
|
+
* @param r Reader or buffer to decode from
|
|
2280
|
+
* @param [l] Message length if known beforehand
|
|
2281
|
+
* @returns MsgData
|
|
2282
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2283
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2284
|
+
*/
|
|
2285
|
+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): cosmos.base.abci.v1beta1.MsgData;
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* Creates a MsgData message from a plain object. Also converts values to their respective internal types.
|
|
2289
|
+
* @param d Plain object
|
|
2290
|
+
* @returns MsgData
|
|
2291
|
+
*/
|
|
2292
|
+
public static fromObject(d: { [k: string]: any }): cosmos.base.abci.v1beta1.MsgData;
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* Creates a plain object from a MsgData message. Also converts values to other types if specified.
|
|
2296
|
+
* @param m MsgData
|
|
2297
|
+
* @param [o] Conversion options
|
|
2298
|
+
* @returns Plain object
|
|
2299
|
+
*/
|
|
2300
|
+
public static toObject(m: cosmos.base.abci.v1beta1.MsgData, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Converts this MsgData to JSON.
|
|
2304
|
+
* @returns JSON object
|
|
2305
|
+
*/
|
|
2306
|
+
public toJSON(): { [k: string]: any };
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
/** Properties of a TxMsgData. */
|
|
2310
|
+
interface ITxMsgData {
|
|
2311
|
+
|
|
2312
|
+
/** TxMsgData data */
|
|
2313
|
+
data?: (cosmos.base.abci.v1beta1.IMsgData[]|null);
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
/** Represents a TxMsgData. */
|
|
2317
|
+
class TxMsgData implements ITxMsgData {
|
|
2318
|
+
|
|
2319
|
+
/**
|
|
2320
|
+
* Constructs a new TxMsgData.
|
|
2321
|
+
* @param [p] Properties to set
|
|
2322
|
+
*/
|
|
2323
|
+
constructor(p?: cosmos.base.abci.v1beta1.ITxMsgData);
|
|
2324
|
+
|
|
2325
|
+
/** TxMsgData data. */
|
|
2326
|
+
public data: cosmos.base.abci.v1beta1.IMsgData[];
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* Creates a new TxMsgData instance using the specified properties.
|
|
2330
|
+
* @param [properties] Properties to set
|
|
2331
|
+
* @returns TxMsgData instance
|
|
2332
|
+
*/
|
|
2333
|
+
public static create(properties?: cosmos.base.abci.v1beta1.ITxMsgData): cosmos.base.abci.v1beta1.TxMsgData;
|
|
2334
|
+
|
|
2335
|
+
/**
|
|
2336
|
+
* Encodes the specified TxMsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.TxMsgData.verify|verify} messages.
|
|
2337
|
+
* @param m TxMsgData message or plain object to encode
|
|
2338
|
+
* @param [w] Writer to encode to
|
|
2339
|
+
* @returns Writer
|
|
2340
|
+
*/
|
|
2341
|
+
public static encode(m: cosmos.base.abci.v1beta1.ITxMsgData, w?: $protobuf.Writer): $protobuf.Writer;
|
|
2342
|
+
|
|
2343
|
+
/**
|
|
2344
|
+
* Decodes a TxMsgData message from the specified reader or buffer.
|
|
2345
|
+
* @param r Reader or buffer to decode from
|
|
2346
|
+
* @param [l] Message length if known beforehand
|
|
2347
|
+
* @returns TxMsgData
|
|
2348
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
2349
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
2350
|
+
*/
|
|
2351
|
+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): cosmos.base.abci.v1beta1.TxMsgData;
|
|
2352
|
+
|
|
2353
|
+
/**
|
|
2354
|
+
* Creates a TxMsgData message from a plain object. Also converts values to their respective internal types.
|
|
2355
|
+
* @param d Plain object
|
|
2356
|
+
* @returns TxMsgData
|
|
2357
|
+
*/
|
|
2358
|
+
public static fromObject(d: { [k: string]: any }): cosmos.base.abci.v1beta1.TxMsgData;
|
|
2359
|
+
|
|
2360
|
+
/**
|
|
2361
|
+
* Creates a plain object from a TxMsgData message. Also converts values to other types if specified.
|
|
2362
|
+
* @param m TxMsgData
|
|
2363
|
+
* @param [o] Conversion options
|
|
2364
|
+
* @returns Plain object
|
|
2365
|
+
*/
|
|
2366
|
+
public static toObject(m: cosmos.base.abci.v1beta1.TxMsgData, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* Converts this TxMsgData to JSON.
|
|
2370
|
+
* @returns JSON object
|
|
2371
|
+
*/
|
|
2372
|
+
public toJSON(): { [k: string]: any };
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2230
2376
|
}
|
|
2231
2377
|
|
|
2232
2378
|
/** Namespace crypto. */
|
|
@@ -2235,6 +2235,173 @@ exports.cosmos = $root.cosmos = (() => {
|
|
|
2235
2235
|
})();
|
|
2236
2236
|
return v1beta1;
|
|
2237
2237
|
})();
|
|
2238
|
+
base.abci = (function () {
|
|
2239
|
+
const abci = {};
|
|
2240
|
+
abci.v1beta1 = (function () {
|
|
2241
|
+
const v1beta1 = {};
|
|
2242
|
+
v1beta1.MsgData = (function () {
|
|
2243
|
+
function MsgData(p) {
|
|
2244
|
+
if (p)
|
|
2245
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2246
|
+
if (p[ks[i]] != null)
|
|
2247
|
+
this[ks[i]] = p[ks[i]];
|
|
2248
|
+
}
|
|
2249
|
+
MsgData.prototype.msgType = "";
|
|
2250
|
+
MsgData.prototype.data = $util.newBuffer([]);
|
|
2251
|
+
MsgData.create = function create(properties) {
|
|
2252
|
+
return new MsgData(properties);
|
|
2253
|
+
};
|
|
2254
|
+
MsgData.encode = function encode(m, w) {
|
|
2255
|
+
if (!w)
|
|
2256
|
+
w = $Writer.create();
|
|
2257
|
+
if (m.msgType != null && Object.hasOwnProperty.call(m, "msgType"))
|
|
2258
|
+
w.uint32(10).string(m.msgType);
|
|
2259
|
+
if (m.data != null && Object.hasOwnProperty.call(m, "data"))
|
|
2260
|
+
w.uint32(18).bytes(m.data);
|
|
2261
|
+
return w;
|
|
2262
|
+
};
|
|
2263
|
+
MsgData.decode = function decode(r, l) {
|
|
2264
|
+
if (!(r instanceof $Reader))
|
|
2265
|
+
r = $Reader.create(r);
|
|
2266
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.cosmos.base.abci.v1beta1.MsgData();
|
|
2267
|
+
while (r.pos < c) {
|
|
2268
|
+
var t = r.uint32();
|
|
2269
|
+
switch (t >>> 3) {
|
|
2270
|
+
case 1:
|
|
2271
|
+
m.msgType = r.string();
|
|
2272
|
+
break;
|
|
2273
|
+
case 2:
|
|
2274
|
+
m.data = r.bytes();
|
|
2275
|
+
break;
|
|
2276
|
+
default:
|
|
2277
|
+
r.skipType(t & 7);
|
|
2278
|
+
break;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
return m;
|
|
2282
|
+
};
|
|
2283
|
+
MsgData.fromObject = function fromObject(d) {
|
|
2284
|
+
if (d instanceof $root.cosmos.base.abci.v1beta1.MsgData)
|
|
2285
|
+
return d;
|
|
2286
|
+
var m = new $root.cosmos.base.abci.v1beta1.MsgData();
|
|
2287
|
+
if (d.msgType != null) {
|
|
2288
|
+
m.msgType = String(d.msgType);
|
|
2289
|
+
}
|
|
2290
|
+
if (d.data != null) {
|
|
2291
|
+
if (typeof d.data === "string")
|
|
2292
|
+
$util.base64.decode(d.data, m.data = $util.newBuffer($util.base64.length(d.data)), 0);
|
|
2293
|
+
else if (d.data.length)
|
|
2294
|
+
m.data = d.data;
|
|
2295
|
+
}
|
|
2296
|
+
return m;
|
|
2297
|
+
};
|
|
2298
|
+
MsgData.toObject = function toObject(m, o) {
|
|
2299
|
+
if (!o)
|
|
2300
|
+
o = {};
|
|
2301
|
+
var d = {};
|
|
2302
|
+
if (o.defaults) {
|
|
2303
|
+
d.msgType = "";
|
|
2304
|
+
if (o.bytes === String)
|
|
2305
|
+
d.data = "";
|
|
2306
|
+
else {
|
|
2307
|
+
d.data = [];
|
|
2308
|
+
if (o.bytes !== Array)
|
|
2309
|
+
d.data = $util.newBuffer(d.data);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
if (m.msgType != null && m.hasOwnProperty("msgType")) {
|
|
2313
|
+
d.msgType = m.msgType;
|
|
2314
|
+
}
|
|
2315
|
+
if (m.data != null && m.hasOwnProperty("data")) {
|
|
2316
|
+
d.data = o.bytes === String ? $util.base64.encode(m.data, 0, m.data.length) : o.bytes === Array ? Array.prototype.slice.call(m.data) : m.data;
|
|
2317
|
+
}
|
|
2318
|
+
return d;
|
|
2319
|
+
};
|
|
2320
|
+
MsgData.prototype.toJSON = function toJSON() {
|
|
2321
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2322
|
+
};
|
|
2323
|
+
return MsgData;
|
|
2324
|
+
})();
|
|
2325
|
+
v1beta1.TxMsgData = (function () {
|
|
2326
|
+
function TxMsgData(p) {
|
|
2327
|
+
this.data = [];
|
|
2328
|
+
if (p)
|
|
2329
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
2330
|
+
if (p[ks[i]] != null)
|
|
2331
|
+
this[ks[i]] = p[ks[i]];
|
|
2332
|
+
}
|
|
2333
|
+
TxMsgData.prototype.data = $util.emptyArray;
|
|
2334
|
+
TxMsgData.create = function create(properties) {
|
|
2335
|
+
return new TxMsgData(properties);
|
|
2336
|
+
};
|
|
2337
|
+
TxMsgData.encode = function encode(m, w) {
|
|
2338
|
+
if (!w)
|
|
2339
|
+
w = $Writer.create();
|
|
2340
|
+
if (m.data != null && m.data.length) {
|
|
2341
|
+
for (var i = 0; i < m.data.length; ++i)
|
|
2342
|
+
$root.cosmos.base.abci.v1beta1.MsgData.encode(m.data[i], w.uint32(10).fork()).ldelim();
|
|
2343
|
+
}
|
|
2344
|
+
return w;
|
|
2345
|
+
};
|
|
2346
|
+
TxMsgData.decode = function decode(r, l) {
|
|
2347
|
+
if (!(r instanceof $Reader))
|
|
2348
|
+
r = $Reader.create(r);
|
|
2349
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.cosmos.base.abci.v1beta1.TxMsgData();
|
|
2350
|
+
while (r.pos < c) {
|
|
2351
|
+
var t = r.uint32();
|
|
2352
|
+
switch (t >>> 3) {
|
|
2353
|
+
case 1:
|
|
2354
|
+
if (!(m.data && m.data.length))
|
|
2355
|
+
m.data = [];
|
|
2356
|
+
m.data.push($root.cosmos.base.abci.v1beta1.MsgData.decode(r, r.uint32()));
|
|
2357
|
+
break;
|
|
2358
|
+
default:
|
|
2359
|
+
r.skipType(t & 7);
|
|
2360
|
+
break;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
return m;
|
|
2364
|
+
};
|
|
2365
|
+
TxMsgData.fromObject = function fromObject(d) {
|
|
2366
|
+
if (d instanceof $root.cosmos.base.abci.v1beta1.TxMsgData)
|
|
2367
|
+
return d;
|
|
2368
|
+
var m = new $root.cosmos.base.abci.v1beta1.TxMsgData();
|
|
2369
|
+
if (d.data) {
|
|
2370
|
+
if (!Array.isArray(d.data))
|
|
2371
|
+
throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: array expected");
|
|
2372
|
+
m.data = [];
|
|
2373
|
+
for (var i = 0; i < d.data.length; ++i) {
|
|
2374
|
+
if (typeof d.data[i] !== "object")
|
|
2375
|
+
throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: object expected");
|
|
2376
|
+
m.data[i] = $root.cosmos.base.abci.v1beta1.MsgData.fromObject(d.data[i]);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
return m;
|
|
2380
|
+
};
|
|
2381
|
+
TxMsgData.toObject = function toObject(m, o) {
|
|
2382
|
+
if (!o)
|
|
2383
|
+
o = {};
|
|
2384
|
+
var d = {};
|
|
2385
|
+
if (o.arrays || o.defaults) {
|
|
2386
|
+
d.data = [];
|
|
2387
|
+
}
|
|
2388
|
+
if (m.data && m.data.length) {
|
|
2389
|
+
d.data = [];
|
|
2390
|
+
for (var j = 0; j < m.data.length; ++j) {
|
|
2391
|
+
d.data[j] = $root.cosmos.base.abci.v1beta1.MsgData.toObject(m.data[j], o);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
return d;
|
|
2395
|
+
};
|
|
2396
|
+
TxMsgData.prototype.toJSON = function toJSON() {
|
|
2397
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
2398
|
+
};
|
|
2399
|
+
return TxMsgData;
|
|
2400
|
+
})();
|
|
2401
|
+
return v1beta1;
|
|
2402
|
+
})();
|
|
2403
|
+
return abci;
|
|
2404
|
+
})();
|
|
2238
2405
|
return base;
|
|
2239
2406
|
})();
|
|
2240
2407
|
cosmos.crypto = (function () {
|