@airgap/coinlib-core 0.13.45-beta.1 → 0.13.45-beta.3
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/actions/Action.js +30 -83
- package/actions/Action.js.map +1 -1
- package/actions/LinkedAction.js +18 -82
- package/actions/LinkedAction.js.map +1 -1
- package/actions/RepeatableAction.js +20 -83
- package/actions/RepeatableAction.js.map +1 -1
- package/actions/SimpleAction.js +12 -74
- package/actions/SimpleAction.js.map +1 -1
- package/actions/StateMachine.js +16 -17
- package/actions/StateMachine.js.map +1 -1
- package/data/KeyPair.d.ts +0 -1
- package/data/Lazy.js +15 -64
- package/data/Lazy.js.map +1 -1
- package/data/RPCBody.js +3 -6
- package/data/RPCBody.js.map +1 -1
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +12 -12
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +88 -130
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +1 -1
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +3 -3
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +57 -61
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +1 -1
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +96 -96
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +1 -1
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +1 -2
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +1 -1
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +8 -10
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +22 -28
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +9 -10
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +10 -11
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +7 -8
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +1 -1
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +3 -3
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +61 -63
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +1 -1
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +4 -4
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +61 -63
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +1 -1
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +1 -1
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +2 -3
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +111 -111
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +15 -15
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +47 -76
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +46 -61
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +61 -106
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +6 -6
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +95 -100
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +33 -33
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +9 -9
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +46 -75
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +45 -70
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +41 -41
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +4 -4
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +2 -2
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +58 -63
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +30 -33
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +18 -20
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +5 -12
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +13 -13
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +78 -78
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +2 -2
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +45 -45
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +75 -76
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +115 -178
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +6 -9
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +78 -83
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +27 -36
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +25 -26
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +1 -1
- package/dependencies/src/cosmjs/index.d.ts +14 -230
- package/dependencies/src/cosmjs/index.js +373 -480
- package/dependencies/src/cosmjs/index.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/index.js +15 -19
- package/dependencies/src/eciesjs-0.3.9/src/index.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +37 -28
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +38 -30
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/utils.js +33 -24
- package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +42 -34
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +1 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +6 -10
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -1
- package/errors/coinlib-error.js +16 -37
- package/errors/coinlib-error.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.js +89 -148
- package/errors/index.js.map +1 -1
- package/index.js +19 -19
- package/index.js.map +1 -1
- package/interfaces/IAirGapSignedTransaction.d.ts +1 -1
- package/interfaces/IAirGapTransaction.js +3 -3
- package/interfaces/IAirGapTransaction.js.map +1 -1
- package/networks.js +9 -9
- package/networks.js.map +1 -1
- package/package.json +1 -1
- package/protocols/BlockExplorerProtocol.js +7 -54
- package/protocols/BlockExplorerProtocol.js.map +1 -1
- package/protocols/CryptoClient.js +19 -78
- package/protocols/CryptoClient.js.map +1 -1
- package/protocols/Ed25519CryptoClient.js +30 -98
- package/protocols/Ed25519CryptoClient.js.map +1 -1
- package/protocols/ICoinSubProtocol.js +1 -1
- package/protocols/ICoinSubProtocol.js.map +1 -1
- package/protocols/NonExtendedProtocol.js +26 -29
- package/protocols/NonExtendedProtocol.js.map +1 -1
- package/protocols/Secp256k1CryptoClient.js +9 -73
- package/protocols/Secp256k1CryptoClient.js.map +1 -1
- package/protocols/Sr25519CryptoClient.js +12 -76
- package/protocols/Sr25519CryptoClient.js.map +1 -1
- package/utils/AES.js +81 -132
- package/utils/AES.js.map +1 -1
- package/utils/ErrorWithData.js +5 -23
- package/utils/ErrorWithData.js.map +1 -1
- package/utils/Network.js +1 -1
- package/utils/Network.js.map +1 -1
- package/utils/ProtocolBlockExplorer.js +3 -4
- package/utils/ProtocolBlockExplorer.js.map +1 -1
- package/utils/ProtocolNetwork.js +11 -16
- package/utils/ProtocolNetwork.js.map +1 -1
- package/utils/ProtocolSymbols.d.ts +1 -1
- package/utils/ProtocolSymbols.js +6 -6
- package/utils/ProtocolSymbols.js.map +1 -1
- package/utils/array.js +14 -15
- package/utils/array.js.map +1 -1
- package/utils/assert.js +8 -12
- package/utils/assert.js.map +1 -1
- package/utils/base64Check.d.ts +0 -1
- package/utils/base64Check.js +15 -15
- package/utils/base64Check.js.map +1 -1
- package/utils/blake2b.js +11 -14
- package/utils/blake2b.js.map +1 -1
- package/utils/buffer.d.ts +0 -1
- package/utils/buffer.js +1 -1
- package/utils/buffer.js.map +1 -1
- package/utils/cache.js +38 -87
- package/utils/cache.js.map +1 -1
- package/utils/error.js +2 -3
- package/utils/error.js.map +1 -1
- package/utils/hex.d.ts +1 -2
- package/utils/hex.js +31 -38
- package/utils/hex.js.map +1 -1
- package/utils/interfaces.js +3 -4
- package/utils/interfaces.js.map +1 -1
- package/utils/object.js +5 -7
- package/utils/object.js.map +1 -1
- package/utils/padStart.js +1 -2
- package/utils/padStart.js.map +1 -1
- package/utils/remote-data/HttpRemoteData.js +24 -107
- package/utils/remote-data/HttpRemoteData.js.map +1 -1
- package/utils/remote-data/IpfsRemoteData.js +32 -116
- package/utils/remote-data/IpfsRemoteData.js.map +1 -1
- package/utils/remote-data/RemoteData.d.ts +0 -1
- package/utils/remote-data/RemoteData.js +3 -4
- package/utils/remote-data/RemoteData.js.map +1 -1
- package/utils/remote-data/RemoteDataFactory.d.ts +2 -2
- package/utils/remote-data/RemoteDataFactory.js +13 -20
- package/utils/remote-data/RemoteDataFactory.js.map +1 -1
- package/utils/remote-data/Sha256RemoteData.d.ts +0 -1
- package/utils/remote-data/Sha256RemoteData.js +44 -117
- package/utils/remote-data/Sha256RemoteData.js.map +1 -1
- package/utils/string.js +8 -9
- package/utils/string.js.map +1 -1
- package/utils/type.js +3 -4
- package/utils/type.js.map +1 -1
- package/utils/xxhash.d.ts +0 -1
- package/utils/xxhash.js +9 -11
- package/utils/xxhash.js.map +1 -1
- package/wallet/AirGapCoinWallet.js +64 -183
- package/wallet/AirGapCoinWallet.js.map +1 -1
- package/wallet/AirGapMarketWallet.js +88 -201
- package/wallet/AirGapMarketWallet.js.map +1 -1
- package/wallet/AirGapNFTWallet.js +48 -165
- package/wallet/AirGapNFTWallet.js.map +1 -1
- package/wallet/AirGapWallet.js +58 -145
- package/wallet/AirGapWallet.js.map +1 -1
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -26,91 +15,54 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
26
15
|
}) : function(o, v) {
|
|
27
16
|
o["default"] = v;
|
|
28
17
|
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
-
function step(op) {
|
|
50
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
-
while (_) try {
|
|
52
|
-
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;
|
|
53
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
-
switch (op[0]) {
|
|
55
|
-
case 0: case 1: t = op; break;
|
|
56
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
-
default:
|
|
60
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
-
if (t[2]) _.ops.pop();
|
|
65
|
-
_.trys.pop(); continue;
|
|
66
|
-
}
|
|
67
|
-
op = body.call(thisArg, _);
|
|
68
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
73
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
|
-
if (ar || !(i in from)) {
|
|
75
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
76
|
-
ar[i] = from[i];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
81
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
82
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
37
|
};
|
|
84
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
39
|
exports.decodeTxBytes = exports.encodeTxBytes = exports.prepareSignBytes = void 0;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
40
|
+
const long_1 = __importDefault(require("long"));
|
|
41
|
+
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
|
|
42
|
+
const base64js = __importStar(require("base64-js"));
|
|
89
43
|
function isTsProtoGeneratedType(type) {
|
|
90
44
|
return typeof type.fromPartial === 'function';
|
|
91
45
|
}
|
|
92
|
-
|
|
93
|
-
encode
|
|
94
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
46
|
+
const MsgSend = {
|
|
47
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
95
48
|
if (message.fromAddress !== '') {
|
|
96
49
|
writer.uint32(10).string(message.fromAddress);
|
|
97
50
|
}
|
|
98
51
|
if (message.toAddress !== '') {
|
|
99
52
|
writer.uint32(18).string(message.toAddress);
|
|
100
53
|
}
|
|
101
|
-
for (
|
|
102
|
-
var v = _a[_i];
|
|
54
|
+
for (const v of message.amount) {
|
|
103
55
|
Coin.encode(v, writer.uint32(26).fork()).ldelim();
|
|
104
56
|
}
|
|
105
57
|
return writer;
|
|
106
58
|
},
|
|
107
|
-
decode
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
59
|
+
decode(input, length) {
|
|
60
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
61
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
62
|
+
const message = { ...baseMsgSend };
|
|
111
63
|
message.amount = [];
|
|
112
64
|
while (reader.pos < end) {
|
|
113
|
-
|
|
65
|
+
const tag = reader.uint32();
|
|
114
66
|
switch (tag >>> 3) {
|
|
115
67
|
case 1:
|
|
116
68
|
message.fromAddress = reader.string();
|
|
@@ -128,38 +80,35 @@ var MsgSend = {
|
|
|
128
80
|
}
|
|
129
81
|
return message;
|
|
130
82
|
},
|
|
131
|
-
fromJSON
|
|
132
|
-
|
|
133
|
-
var message = __assign({}, baseMsgSend);
|
|
83
|
+
fromJSON(object) {
|
|
84
|
+
const message = { ...baseMsgSend };
|
|
134
85
|
message.fromAddress = object.fromAddress !== undefined && object.fromAddress !== null ? String(object.fromAddress) : '';
|
|
135
86
|
message.toAddress = object.toAddress !== undefined && object.toAddress !== null ? String(object.toAddress) : '';
|
|
136
|
-
message.amount = (
|
|
87
|
+
message.amount = (object.amount ?? []).map((e) => Coin.fromJSON(e));
|
|
137
88
|
return message;
|
|
138
89
|
},
|
|
139
|
-
toJSON
|
|
140
|
-
|
|
90
|
+
toJSON(message) {
|
|
91
|
+
const obj = {};
|
|
141
92
|
message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
|
|
142
93
|
message.toAddress !== undefined && (obj.toAddress = message.toAddress);
|
|
143
94
|
if (message.amount) {
|
|
144
|
-
obj.amount = message.amount.map(
|
|
95
|
+
obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
145
96
|
}
|
|
146
97
|
else {
|
|
147
98
|
obj.amount = [];
|
|
148
99
|
}
|
|
149
100
|
return obj;
|
|
150
101
|
},
|
|
151
|
-
fromPartial
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
message.
|
|
155
|
-
message.
|
|
156
|
-
message.amount = ((_c = object.amount) === null || _c === void 0 ? void 0 : _c.map(function (e) { return Coin.fromPartial(e); })) || [];
|
|
102
|
+
fromPartial(object) {
|
|
103
|
+
const message = { ...baseMsgSend };
|
|
104
|
+
message.fromAddress = object.fromAddress ?? '';
|
|
105
|
+
message.toAddress = object.toAddress ?? '';
|
|
106
|
+
message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || [];
|
|
157
107
|
return message;
|
|
158
108
|
}
|
|
159
109
|
};
|
|
160
|
-
|
|
161
|
-
encode
|
|
162
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
110
|
+
const MsgWithdrawDelegatorReward = {
|
|
111
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
163
112
|
if (message.delegatorAddress !== '') {
|
|
164
113
|
writer.uint32(10).string(message.delegatorAddress);
|
|
165
114
|
}
|
|
@@ -168,12 +117,12 @@ var MsgWithdrawDelegatorReward = {
|
|
|
168
117
|
}
|
|
169
118
|
return writer;
|
|
170
119
|
},
|
|
171
|
-
decode
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
120
|
+
decode(input, length) {
|
|
121
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
122
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
123
|
+
const message = { ...baseMsgWithdrawDelegatorReward };
|
|
175
124
|
while (reader.pos < end) {
|
|
176
|
-
|
|
125
|
+
const tag = reader.uint32();
|
|
177
126
|
switch (tag >>> 3) {
|
|
178
127
|
case 1:
|
|
179
128
|
message.delegatorAddress = reader.string();
|
|
@@ -188,32 +137,30 @@ var MsgWithdrawDelegatorReward = {
|
|
|
188
137
|
}
|
|
189
138
|
return message;
|
|
190
139
|
},
|
|
191
|
-
fromJSON
|
|
192
|
-
|
|
140
|
+
fromJSON(object) {
|
|
141
|
+
const message = { ...baseMsgWithdrawDelegatorReward };
|
|
193
142
|
message.delegatorAddress =
|
|
194
143
|
object.delegatorAddress !== undefined && object.delegatorAddress !== null ? String(object.delegatorAddress) : '';
|
|
195
144
|
message.validatorAddress =
|
|
196
145
|
object.validatorAddress !== undefined && object.validatorAddress !== null ? String(object.validatorAddress) : '';
|
|
197
146
|
return message;
|
|
198
147
|
},
|
|
199
|
-
toJSON
|
|
200
|
-
|
|
148
|
+
toJSON(message) {
|
|
149
|
+
const obj = {};
|
|
201
150
|
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
|
|
202
151
|
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
|
|
203
152
|
return obj;
|
|
204
153
|
},
|
|
205
|
-
fromPartial
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
message.
|
|
209
|
-
message.validatorAddress = (_b = object.validatorAddress) !== null && _b !== void 0 ? _b : '';
|
|
154
|
+
fromPartial(object) {
|
|
155
|
+
const message = { ...baseMsgWithdrawDelegatorReward };
|
|
156
|
+
message.delegatorAddress = object.delegatorAddress ?? '';
|
|
157
|
+
message.validatorAddress = object.validatorAddress ?? '';
|
|
210
158
|
return message;
|
|
211
159
|
}
|
|
212
160
|
};
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
encode
|
|
216
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
161
|
+
const baseSignDoc = { chainId: '', accountNumber: long_1.default.UZERO };
|
|
162
|
+
const SignDoc = {
|
|
163
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
217
164
|
if (message.bodyBytes.length !== 0) {
|
|
218
165
|
writer.uint32(10).bytes(message.bodyBytes);
|
|
219
166
|
}
|
|
@@ -228,14 +175,14 @@ var SignDoc = {
|
|
|
228
175
|
}
|
|
229
176
|
return writer;
|
|
230
177
|
},
|
|
231
|
-
decode
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
178
|
+
decode(input, length) {
|
|
179
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
180
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
181
|
+
const message = { ...baseSignDoc };
|
|
235
182
|
message.bodyBytes = new Uint8Array();
|
|
236
183
|
message.authInfoBytes = new Uint8Array();
|
|
237
184
|
while (reader.pos < end) {
|
|
238
|
-
|
|
185
|
+
const tag = reader.uint32();
|
|
239
186
|
switch (tag >>> 3) {
|
|
240
187
|
case 1:
|
|
241
188
|
message.bodyBytes = reader.bytes();
|
|
@@ -256,8 +203,8 @@ var SignDoc = {
|
|
|
256
203
|
}
|
|
257
204
|
return message;
|
|
258
205
|
},
|
|
259
|
-
fromJSON
|
|
260
|
-
|
|
206
|
+
fromJSON(object) {
|
|
207
|
+
const message = { ...baseSignDoc };
|
|
261
208
|
message.bodyBytes = object.bodyBytes !== undefined && object.bodyBytes !== null ? bytesFromBase64(object.bodyBytes) : new Uint8Array();
|
|
262
209
|
message.authInfoBytes =
|
|
263
210
|
object.authInfoBytes !== undefined && object.authInfoBytes !== null ? bytesFromBase64(object.authInfoBytes) : new Uint8Array();
|
|
@@ -266,8 +213,8 @@ var SignDoc = {
|
|
|
266
213
|
object.accountNumber !== undefined && object.accountNumber !== null ? long_1.default.fromString(object.accountNumber) : long_1.default.UZERO;
|
|
267
214
|
return message;
|
|
268
215
|
},
|
|
269
|
-
toJSON
|
|
270
|
-
|
|
216
|
+
toJSON(message) {
|
|
217
|
+
const obj = {};
|
|
271
218
|
message.bodyBytes !== undefined &&
|
|
272
219
|
(obj.bodyBytes = base64FromBytes(message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array()));
|
|
273
220
|
message.authInfoBytes !== undefined &&
|
|
@@ -276,21 +223,19 @@ var SignDoc = {
|
|
|
276
223
|
message.accountNumber !== undefined && (obj.accountNumber = (message.accountNumber || long_1.default.UZERO).toString());
|
|
277
224
|
return obj;
|
|
278
225
|
},
|
|
279
|
-
fromPartial
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
message.
|
|
283
|
-
message.
|
|
284
|
-
message.chainId = (_c = object.chainId) !== null && _c !== void 0 ? _c : '';
|
|
226
|
+
fromPartial(object) {
|
|
227
|
+
const message = { ...baseSignDoc };
|
|
228
|
+
message.bodyBytes = object.bodyBytes ?? new Uint8Array();
|
|
229
|
+
message.authInfoBytes = object.authInfoBytes ?? new Uint8Array();
|
|
230
|
+
message.chainId = object.chainId ?? '';
|
|
285
231
|
message.accountNumber =
|
|
286
232
|
object.accountNumber !== undefined && object.accountNumber !== null ? long_1.default.fromValue(object.accountNumber) : long_1.default.UZERO;
|
|
287
233
|
return message;
|
|
288
234
|
}
|
|
289
235
|
};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
encode
|
|
293
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
236
|
+
const baseMsgUndelegate = { delegatorAddress: '', validatorAddress: '' };
|
|
237
|
+
const MsgUndelegate = {
|
|
238
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
294
239
|
if (message.delegatorAddress !== '') {
|
|
295
240
|
writer.uint32(10).string(message.delegatorAddress);
|
|
296
241
|
}
|
|
@@ -302,12 +247,12 @@ var MsgUndelegate = {
|
|
|
302
247
|
}
|
|
303
248
|
return writer;
|
|
304
249
|
},
|
|
305
|
-
decode
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
250
|
+
decode(input, length) {
|
|
251
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
252
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
253
|
+
const message = { ...baseMsgUndelegate };
|
|
309
254
|
while (reader.pos < end) {
|
|
310
|
-
|
|
255
|
+
const tag = reader.uint32();
|
|
311
256
|
switch (tag >>> 3) {
|
|
312
257
|
case 1:
|
|
313
258
|
message.delegatorAddress = reader.string();
|
|
@@ -325,8 +270,8 @@ var MsgUndelegate = {
|
|
|
325
270
|
}
|
|
326
271
|
return message;
|
|
327
272
|
},
|
|
328
|
-
fromJSON
|
|
329
|
-
|
|
273
|
+
fromJSON(object) {
|
|
274
|
+
const message = { ...baseMsgUndelegate };
|
|
330
275
|
message.delegatorAddress =
|
|
331
276
|
object.delegatorAddress !== undefined && object.delegatorAddress !== null ? String(object.delegatorAddress) : '';
|
|
332
277
|
message.validatorAddress =
|
|
@@ -334,26 +279,24 @@ var MsgUndelegate = {
|
|
|
334
279
|
message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromJSON(object.amount) : undefined;
|
|
335
280
|
return message;
|
|
336
281
|
},
|
|
337
|
-
toJSON
|
|
338
|
-
|
|
282
|
+
toJSON(message) {
|
|
283
|
+
const obj = {};
|
|
339
284
|
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
|
|
340
285
|
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
|
|
341
286
|
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
|
|
342
287
|
return obj;
|
|
343
288
|
},
|
|
344
|
-
fromPartial
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
message.
|
|
348
|
-
message.validatorAddress = (_b = object.validatorAddress) !== null && _b !== void 0 ? _b : '';
|
|
289
|
+
fromPartial(object) {
|
|
290
|
+
const message = { ...baseMsgUndelegate };
|
|
291
|
+
message.delegatorAddress = object.delegatorAddress ?? '';
|
|
292
|
+
message.validatorAddress = object.validatorAddress ?? '';
|
|
349
293
|
message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined;
|
|
350
294
|
return message;
|
|
351
295
|
}
|
|
352
296
|
};
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
encode
|
|
356
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
297
|
+
const baseMsgDelegate = { delegatorAddress: '', validatorAddress: '' };
|
|
298
|
+
const MsgDelegate = {
|
|
299
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
357
300
|
if (message.delegatorAddress !== '') {
|
|
358
301
|
writer.uint32(10).string(message.delegatorAddress);
|
|
359
302
|
}
|
|
@@ -365,12 +308,12 @@ var MsgDelegate = {
|
|
|
365
308
|
}
|
|
366
309
|
return writer;
|
|
367
310
|
},
|
|
368
|
-
decode
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
311
|
+
decode(input, length) {
|
|
312
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
313
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
314
|
+
const message = { ...baseMsgDelegate };
|
|
372
315
|
while (reader.pos < end) {
|
|
373
|
-
|
|
316
|
+
const tag = reader.uint32();
|
|
374
317
|
switch (tag >>> 3) {
|
|
375
318
|
case 1:
|
|
376
319
|
message.delegatorAddress = reader.string();
|
|
@@ -388,8 +331,8 @@ var MsgDelegate = {
|
|
|
388
331
|
}
|
|
389
332
|
return message;
|
|
390
333
|
},
|
|
391
|
-
fromJSON
|
|
392
|
-
|
|
334
|
+
fromJSON(object) {
|
|
335
|
+
const message = { ...baseMsgDelegate };
|
|
393
336
|
message.delegatorAddress =
|
|
394
337
|
object.delegatorAddress !== undefined && object.delegatorAddress !== null ? String(object.delegatorAddress) : '';
|
|
395
338
|
message.validatorAddress =
|
|
@@ -397,23 +340,22 @@ var MsgDelegate = {
|
|
|
397
340
|
message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromJSON(object.amount) : undefined;
|
|
398
341
|
return message;
|
|
399
342
|
},
|
|
400
|
-
toJSON
|
|
401
|
-
|
|
343
|
+
toJSON(message) {
|
|
344
|
+
const obj = {};
|
|
402
345
|
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
|
|
403
346
|
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
|
|
404
347
|
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
|
|
405
348
|
return obj;
|
|
406
349
|
},
|
|
407
|
-
fromPartial
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
message.
|
|
411
|
-
message.validatorAddress = (_b = object.validatorAddress) !== null && _b !== void 0 ? _b : '';
|
|
350
|
+
fromPartial(object) {
|
|
351
|
+
const message = { ...baseMsgDelegate };
|
|
352
|
+
message.delegatorAddress = object.delegatorAddress ?? '';
|
|
353
|
+
message.validatorAddress = object.validatorAddress ?? '';
|
|
412
354
|
message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined;
|
|
413
355
|
return message;
|
|
414
356
|
}
|
|
415
357
|
};
|
|
416
|
-
|
|
358
|
+
const defaultRegistryTypes = [
|
|
417
359
|
['/cosmos.bank.v1beta1.MsgSend', MsgSend],
|
|
418
360
|
['/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward', MsgWithdrawDelegatorReward],
|
|
419
361
|
['/cosmos.staking.v1beta1.MsgUndelegate', MsgUndelegate],
|
|
@@ -422,53 +364,55 @@ var defaultRegistryTypes = [
|
|
|
422
364
|
function isTxBodyEncodeObject(encodeObject) {
|
|
423
365
|
return encodeObject.typeUrl === '/cosmos.tx.v1beta1.TxBody';
|
|
424
366
|
}
|
|
425
|
-
|
|
426
|
-
|
|
367
|
+
const lookupType = (typeUrl) => {
|
|
368
|
+
const types = new Map([...defaultRegistryTypes]);
|
|
427
369
|
return types.get(typeUrl);
|
|
428
370
|
};
|
|
429
|
-
|
|
430
|
-
|
|
371
|
+
const lookupTypeWithError = (typeUrl) => {
|
|
372
|
+
const type = lookupType(typeUrl);
|
|
431
373
|
if (!type) {
|
|
432
|
-
throw new Error(
|
|
374
|
+
throw new Error(`Unregistered type url: ${typeUrl}`);
|
|
433
375
|
}
|
|
434
376
|
return type;
|
|
435
377
|
};
|
|
436
|
-
|
|
437
|
-
|
|
378
|
+
const encode = (encodeObject) => {
|
|
379
|
+
const { value, typeUrl } = encodeObject;
|
|
438
380
|
if (isTxBodyEncodeObject(encodeObject)) {
|
|
439
381
|
return encodeTxBody(value);
|
|
440
382
|
}
|
|
441
|
-
|
|
442
|
-
|
|
383
|
+
const type = lookupTypeWithError(typeUrl);
|
|
384
|
+
const instance = isTsProtoGeneratedType(type) ? type.fromPartial(value) : type.create(value);
|
|
443
385
|
return type.encode(instance).finish();
|
|
444
386
|
};
|
|
445
|
-
|
|
446
|
-
|
|
387
|
+
const encodeAsAny = (encodeObject) => {
|
|
388
|
+
const binaryValue = encode(encodeObject);
|
|
447
389
|
return Any.fromPartial({
|
|
448
390
|
typeUrl: encodeObject.typeUrl,
|
|
449
391
|
value: binaryValue
|
|
450
392
|
});
|
|
451
393
|
};
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
394
|
+
const encodeTxBody = (txBodyFields) => {
|
|
395
|
+
const wrappedMessages = txBodyFields.messages.map((message) => encodeAsAny(message));
|
|
396
|
+
const txBody = TxBody.fromPartial({
|
|
397
|
+
...txBodyFields,
|
|
398
|
+
messages: wrappedMessages
|
|
399
|
+
});
|
|
455
400
|
return TxBody.encode(txBody).finish();
|
|
456
401
|
};
|
|
457
|
-
|
|
458
|
-
encode
|
|
459
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
402
|
+
const PubKey = {
|
|
403
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
460
404
|
if (message.key.length !== 0) {
|
|
461
405
|
writer.uint32(10).bytes(message.key);
|
|
462
406
|
}
|
|
463
407
|
return writer;
|
|
464
408
|
},
|
|
465
|
-
decode
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
409
|
+
decode(input, length) {
|
|
410
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
411
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
412
|
+
const message = { ...basePubKey };
|
|
469
413
|
message.key = new Uint8Array();
|
|
470
414
|
while (reader.pos < end) {
|
|
471
|
-
|
|
415
|
+
const tag = reader.uint32();
|
|
472
416
|
switch (tag >>> 3) {
|
|
473
417
|
case 1:
|
|
474
418
|
message.key = reader.bytes();
|
|
@@ -480,20 +424,19 @@ var PubKey = {
|
|
|
480
424
|
}
|
|
481
425
|
return message;
|
|
482
426
|
},
|
|
483
|
-
fromJSON
|
|
484
|
-
|
|
427
|
+
fromJSON(object) {
|
|
428
|
+
const message = { ...basePubKey };
|
|
485
429
|
message.key = object.key !== undefined && object.key !== null ? bytesFromBase64(object.key) : new Uint8Array();
|
|
486
430
|
return message;
|
|
487
431
|
},
|
|
488
|
-
toJSON
|
|
489
|
-
|
|
432
|
+
toJSON(message) {
|
|
433
|
+
const obj = {};
|
|
490
434
|
message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
|
|
491
435
|
return obj;
|
|
492
436
|
},
|
|
493
|
-
fromPartial
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : new Uint8Array();
|
|
437
|
+
fromPartial(object) {
|
|
438
|
+
const message = { ...basePubKey };
|
|
439
|
+
message.key = object.key ?? new Uint8Array();
|
|
497
440
|
return message;
|
|
498
441
|
}
|
|
499
442
|
};
|
|
@@ -506,8 +449,8 @@ function fromBase64(base64String) {
|
|
|
506
449
|
}
|
|
507
450
|
return base64js.toByteArray(base64String);
|
|
508
451
|
}
|
|
509
|
-
|
|
510
|
-
|
|
452
|
+
const encodePubkey = (pubKey) => {
|
|
453
|
+
const pubkeyProto = PubKey.fromPartial({
|
|
511
454
|
key: fromBase64(pubKey.value)
|
|
512
455
|
});
|
|
513
456
|
return Any.fromPartial({
|
|
@@ -563,7 +506,7 @@ var SignMode;
|
|
|
563
506
|
SignMode[SignMode["SIGN_MODE_LEGACY_AMINO_JSON"] = 127] = "SIGN_MODE_LEGACY_AMINO_JSON";
|
|
564
507
|
SignMode[SignMode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
565
508
|
})(SignMode || (SignMode = {}));
|
|
566
|
-
|
|
509
|
+
const signModeFromJSON = (object) => {
|
|
567
510
|
switch (object) {
|
|
568
511
|
case 0:
|
|
569
512
|
case 'SIGN_MODE_UNSPECIFIED':
|
|
@@ -583,8 +526,14 @@ var signModeFromJSON = function (object) {
|
|
|
583
526
|
return SignMode.UNRECOGNIZED;
|
|
584
527
|
}
|
|
585
528
|
};
|
|
586
|
-
|
|
587
|
-
|
|
529
|
+
class Int53 {
|
|
530
|
+
static fromString(str) {
|
|
531
|
+
if (!str.match(/^-?[0-9]+$/)) {
|
|
532
|
+
throw new Error('Invalid string format');
|
|
533
|
+
}
|
|
534
|
+
return new Int53(Number.parseInt(str, 10));
|
|
535
|
+
}
|
|
536
|
+
constructor(input) {
|
|
588
537
|
if (Number.isNaN(input)) {
|
|
589
538
|
throw new Error('Input is not a number');
|
|
590
539
|
}
|
|
@@ -596,34 +545,26 @@ var Int53 = /** @class */ (function () {
|
|
|
596
545
|
}
|
|
597
546
|
this.data = input;
|
|
598
547
|
}
|
|
599
|
-
|
|
600
|
-
if (!str.match(/^-?[0-9]+$/)) {
|
|
601
|
-
throw new Error('Invalid string format');
|
|
602
|
-
}
|
|
603
|
-
return new Int53(Number.parseInt(str, 10));
|
|
604
|
-
};
|
|
605
|
-
Int53.prototype.toNumber = function () {
|
|
548
|
+
toNumber() {
|
|
606
549
|
return this.data;
|
|
607
|
-
}
|
|
608
|
-
|
|
550
|
+
}
|
|
551
|
+
toString() {
|
|
609
552
|
return this.data.toString();
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
encode: function (message, writer) {
|
|
615
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
const ModeInfo_Single = {
|
|
556
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
616
557
|
if (message.mode !== 0) {
|
|
617
558
|
writer.uint32(8).int32(message.mode);
|
|
618
559
|
}
|
|
619
560
|
return writer;
|
|
620
561
|
},
|
|
621
|
-
decode
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
562
|
+
decode(input, length) {
|
|
563
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
564
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
565
|
+
const message = { ...baseModeInfo_Single };
|
|
625
566
|
while (reader.pos < end) {
|
|
626
|
-
|
|
567
|
+
const tag = reader.uint32();
|
|
627
568
|
switch (tag >>> 3) {
|
|
628
569
|
case 1:
|
|
629
570
|
message.mode = reader.int32();
|
|
@@ -635,49 +576,47 @@ var ModeInfo_Single = {
|
|
|
635
576
|
}
|
|
636
577
|
return message;
|
|
637
578
|
},
|
|
638
|
-
fromJSON
|
|
639
|
-
|
|
579
|
+
fromJSON(object) {
|
|
580
|
+
const message = { ...baseModeInfo_Single };
|
|
640
581
|
message.mode = object.mode !== undefined && object.mode !== null ? signModeFromJSON(object.mode) : 0;
|
|
641
582
|
return message;
|
|
642
583
|
},
|
|
643
|
-
toJSON
|
|
644
|
-
|
|
584
|
+
toJSON(message) {
|
|
585
|
+
const obj = {};
|
|
645
586
|
message.mode !== undefined && (obj.mode = signModeToJSON(message.mode));
|
|
646
587
|
return obj;
|
|
647
588
|
},
|
|
648
|
-
fromPartial
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
message.mode = (_a = object.mode) !== null && _a !== void 0 ? _a : 0;
|
|
589
|
+
fromPartial(object) {
|
|
590
|
+
const message = { ...baseModeInfo_Single };
|
|
591
|
+
message.mode = object.mode ?? 0;
|
|
652
592
|
return message;
|
|
653
593
|
}
|
|
654
594
|
};
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
encode
|
|
669
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
595
|
+
const baseMsgWithdrawDelegatorReward = { delegatorAddress: '', validatorAddress: '' };
|
|
596
|
+
const baseSignerInfo = { sequence: long_1.default.UZERO };
|
|
597
|
+
const baseFee = { gasLimit: long_1.default.UZERO, payer: '', granter: '' };
|
|
598
|
+
const baseMsgSend = { fromAddress: '', toAddress: '' };
|
|
599
|
+
const baseModeInfo_Single = { mode: 0 };
|
|
600
|
+
const baseTxRaw = {};
|
|
601
|
+
const basePubKey = {};
|
|
602
|
+
const baseModeInfo = {};
|
|
603
|
+
const baseAuthInfo = {};
|
|
604
|
+
const baseAny = { typeUrl: '' };
|
|
605
|
+
const baseTxBody = { memo: '', timeoutHeight: long_1.default.UZERO };
|
|
606
|
+
const baseCoin = { denom: '', amount: '' };
|
|
607
|
+
const ModeInfo = {
|
|
608
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
670
609
|
if (message.single !== undefined) {
|
|
671
610
|
ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim();
|
|
672
611
|
}
|
|
673
612
|
return writer;
|
|
674
613
|
},
|
|
675
|
-
decode
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
614
|
+
decode(input, length) {
|
|
615
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
616
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
617
|
+
const message = { ...baseModeInfo };
|
|
679
618
|
while (reader.pos < end) {
|
|
680
|
-
|
|
619
|
+
const tag = reader.uint32();
|
|
681
620
|
switch (tag >>> 3) {
|
|
682
621
|
case 1:
|
|
683
622
|
message.single = ModeInfo_Single.decode(reader, reader.uint32());
|
|
@@ -689,25 +628,24 @@ var ModeInfo = {
|
|
|
689
628
|
}
|
|
690
629
|
return message;
|
|
691
630
|
},
|
|
692
|
-
fromJSON
|
|
693
|
-
|
|
631
|
+
fromJSON(object) {
|
|
632
|
+
const message = { ...baseModeInfo };
|
|
694
633
|
message.single = object.single !== undefined && object.single !== null ? ModeInfo_Single.fromJSON(object.single) : undefined;
|
|
695
634
|
return message;
|
|
696
635
|
},
|
|
697
|
-
toJSON
|
|
698
|
-
|
|
636
|
+
toJSON(message) {
|
|
637
|
+
const obj = {};
|
|
699
638
|
message.single !== undefined && (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined);
|
|
700
639
|
return obj;
|
|
701
640
|
},
|
|
702
|
-
fromPartial
|
|
703
|
-
|
|
641
|
+
fromPartial(object) {
|
|
642
|
+
const message = { ...baseModeInfo };
|
|
704
643
|
message.single = object.single !== undefined && object.single !== null ? ModeInfo_Single.fromPartial(object.single) : undefined;
|
|
705
644
|
return message;
|
|
706
645
|
}
|
|
707
646
|
};
|
|
708
|
-
|
|
709
|
-
encode
|
|
710
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
647
|
+
const SignerInfo = {
|
|
648
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
711
649
|
if (message.publicKey !== undefined) {
|
|
712
650
|
Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim();
|
|
713
651
|
}
|
|
@@ -719,12 +657,12 @@ var SignerInfo = {
|
|
|
719
657
|
}
|
|
720
658
|
return writer;
|
|
721
659
|
},
|
|
722
|
-
decode
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
660
|
+
decode(input, length) {
|
|
661
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
662
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
663
|
+
const message = { ...baseSignerInfo };
|
|
726
664
|
while (reader.pos < end) {
|
|
727
|
-
|
|
665
|
+
const tag = reader.uint32();
|
|
728
666
|
switch (tag >>> 3) {
|
|
729
667
|
case 1:
|
|
730
668
|
message.publicKey = Any.decode(reader, reader.uint32());
|
|
@@ -742,31 +680,30 @@ var SignerInfo = {
|
|
|
742
680
|
}
|
|
743
681
|
return message;
|
|
744
682
|
},
|
|
745
|
-
fromJSON
|
|
746
|
-
|
|
683
|
+
fromJSON(object) {
|
|
684
|
+
const message = { ...baseSignerInfo };
|
|
747
685
|
message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromJSON(object.publicKey) : undefined;
|
|
748
686
|
message.modeInfo = object.modeInfo !== undefined && object.modeInfo !== null ? ModeInfo.fromJSON(object.modeInfo) : undefined;
|
|
749
687
|
message.sequence = object.sequence !== undefined && object.sequence !== null ? long_1.default.fromString(object.sequence) : long_1.default.UZERO;
|
|
750
688
|
return message;
|
|
751
689
|
},
|
|
752
|
-
toJSON
|
|
753
|
-
|
|
690
|
+
toJSON(message) {
|
|
691
|
+
const obj = {};
|
|
754
692
|
message.publicKey !== undefined && (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined);
|
|
755
693
|
message.modeInfo !== undefined && (obj.modeInfo = message.modeInfo ? ModeInfo.toJSON(message.modeInfo) : undefined);
|
|
756
694
|
message.sequence !== undefined && (obj.sequence = (message.sequence || long_1.default.UZERO).toString());
|
|
757
695
|
return obj;
|
|
758
696
|
},
|
|
759
|
-
fromPartial
|
|
760
|
-
|
|
697
|
+
fromPartial(object) {
|
|
698
|
+
const message = { ...baseSignerInfo };
|
|
761
699
|
message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined;
|
|
762
700
|
message.modeInfo = object.modeInfo !== undefined && object.modeInfo !== null ? ModeInfo.fromPartial(object.modeInfo) : undefined;
|
|
763
701
|
message.sequence = object.sequence !== undefined && object.sequence !== null ? long_1.default.fromValue(object.sequence) : long_1.default.UZERO;
|
|
764
702
|
return message;
|
|
765
703
|
}
|
|
766
704
|
};
|
|
767
|
-
|
|
768
|
-
encode
|
|
769
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
705
|
+
const Coin = {
|
|
706
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
770
707
|
if (message.denom !== '') {
|
|
771
708
|
writer.uint32(10).string(message.denom);
|
|
772
709
|
}
|
|
@@ -775,12 +712,12 @@ var Coin = {
|
|
|
775
712
|
}
|
|
776
713
|
return writer;
|
|
777
714
|
},
|
|
778
|
-
decode
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
715
|
+
decode(input, length) {
|
|
716
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
717
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
718
|
+
const message = { ...baseCoin };
|
|
782
719
|
while (reader.pos < end) {
|
|
783
|
-
|
|
720
|
+
const tag = reader.uint32();
|
|
784
721
|
switch (tag >>> 3) {
|
|
785
722
|
case 1:
|
|
786
723
|
message.denom = reader.string();
|
|
@@ -795,31 +732,28 @@ var Coin = {
|
|
|
795
732
|
}
|
|
796
733
|
return message;
|
|
797
734
|
},
|
|
798
|
-
fromJSON
|
|
799
|
-
|
|
735
|
+
fromJSON(object) {
|
|
736
|
+
const message = { ...baseCoin };
|
|
800
737
|
message.denom = object.denom !== undefined && object.denom !== null ? String(object.denom) : '';
|
|
801
738
|
message.amount = object.amount !== undefined && object.amount !== null ? String(object.amount) : '';
|
|
802
739
|
return message;
|
|
803
740
|
},
|
|
804
|
-
toJSON
|
|
805
|
-
|
|
741
|
+
toJSON(message) {
|
|
742
|
+
const obj = {};
|
|
806
743
|
message.denom !== undefined && (obj.denom = message.denom);
|
|
807
744
|
message.amount !== undefined && (obj.amount = message.amount);
|
|
808
745
|
return obj;
|
|
809
746
|
},
|
|
810
|
-
fromPartial
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
message.
|
|
814
|
-
message.amount = (_b = object.amount) !== null && _b !== void 0 ? _b : '';
|
|
747
|
+
fromPartial(object) {
|
|
748
|
+
const message = { ...baseCoin };
|
|
749
|
+
message.denom = object.denom ?? '';
|
|
750
|
+
message.amount = object.amount ?? '';
|
|
815
751
|
return message;
|
|
816
752
|
}
|
|
817
753
|
};
|
|
818
|
-
|
|
819
|
-
encode
|
|
820
|
-
|
|
821
|
-
for (var _i = 0, _a = message.amount; _i < _a.length; _i++) {
|
|
822
|
-
var v = _a[_i];
|
|
754
|
+
const Fee = {
|
|
755
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
756
|
+
for (const v of message.amount) {
|
|
823
757
|
Coin.encode(v, writer.uint32(10).fork()).ldelim();
|
|
824
758
|
}
|
|
825
759
|
if (!message.gasLimit.isZero()) {
|
|
@@ -833,13 +767,13 @@ var Fee = {
|
|
|
833
767
|
}
|
|
834
768
|
return writer;
|
|
835
769
|
},
|
|
836
|
-
decode
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
770
|
+
decode(input, length) {
|
|
771
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
772
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
773
|
+
const message = { ...baseFee };
|
|
840
774
|
message.amount = [];
|
|
841
775
|
while (reader.pos < end) {
|
|
842
|
-
|
|
776
|
+
const tag = reader.uint32();
|
|
843
777
|
switch (tag >>> 3) {
|
|
844
778
|
case 1:
|
|
845
779
|
message.amount.push(Coin.decode(reader, reader.uint32()));
|
|
@@ -860,19 +794,18 @@ var Fee = {
|
|
|
860
794
|
}
|
|
861
795
|
return message;
|
|
862
796
|
},
|
|
863
|
-
fromJSON
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
message.amount = ((_a = object.amount) !== null && _a !== void 0 ? _a : []).map(function (e) { return Coin.fromJSON(e); });
|
|
797
|
+
fromJSON(object) {
|
|
798
|
+
const message = { ...baseFee };
|
|
799
|
+
message.amount = (object.amount ?? []).map((e) => Coin.fromJSON(e));
|
|
867
800
|
message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? long_1.default.fromString(object.gasLimit) : long_1.default.UZERO;
|
|
868
801
|
message.payer = object.payer !== undefined && object.payer !== null ? String(object.payer) : '';
|
|
869
802
|
message.granter = object.granter !== undefined && object.granter !== null ? String(object.granter) : '';
|
|
870
803
|
return message;
|
|
871
804
|
},
|
|
872
|
-
toJSON
|
|
873
|
-
|
|
805
|
+
toJSON(message) {
|
|
806
|
+
const obj = {};
|
|
874
807
|
if (message.amount) {
|
|
875
|
-
obj.amount = message.amount.map(
|
|
808
|
+
obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
|
|
876
809
|
}
|
|
877
810
|
else {
|
|
878
811
|
obj.amount = [];
|
|
@@ -882,21 +815,18 @@ var Fee = {
|
|
|
882
815
|
message.granter !== undefined && (obj.granter = message.granter);
|
|
883
816
|
return obj;
|
|
884
817
|
},
|
|
885
|
-
fromPartial
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
message.amount = ((_a = object.amount) === null || _a === void 0 ? void 0 : _a.map(function (e) { return Coin.fromPartial(e); })) || [];
|
|
818
|
+
fromPartial(object) {
|
|
819
|
+
const message = { ...baseFee };
|
|
820
|
+
message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || [];
|
|
889
821
|
message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? long_1.default.fromValue(object.gasLimit) : long_1.default.UZERO;
|
|
890
|
-
message.payer =
|
|
891
|
-
message.granter =
|
|
822
|
+
message.payer = object.payer ?? '';
|
|
823
|
+
message.granter = object.granter ?? '';
|
|
892
824
|
return message;
|
|
893
825
|
}
|
|
894
826
|
};
|
|
895
|
-
|
|
896
|
-
encode
|
|
897
|
-
|
|
898
|
-
for (var _i = 0, _a = message.signerInfos; _i < _a.length; _i++) {
|
|
899
|
-
var v = _a[_i];
|
|
827
|
+
const AuthInfo = {
|
|
828
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
829
|
+
for (const v of message.signerInfos) {
|
|
900
830
|
SignerInfo.encode(v, writer.uint32(10).fork()).ldelim();
|
|
901
831
|
}
|
|
902
832
|
if (message.fee !== undefined) {
|
|
@@ -904,13 +834,13 @@ var AuthInfo = {
|
|
|
904
834
|
}
|
|
905
835
|
return writer;
|
|
906
836
|
},
|
|
907
|
-
decode
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
837
|
+
decode(input, length) {
|
|
838
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
839
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
840
|
+
const message = { ...baseAuthInfo };
|
|
911
841
|
message.signerInfos = [];
|
|
912
842
|
while (reader.pos < end) {
|
|
913
|
-
|
|
843
|
+
const tag = reader.uint32();
|
|
914
844
|
switch (tag >>> 3) {
|
|
915
845
|
case 1:
|
|
916
846
|
message.signerInfos.push(SignerInfo.decode(reader, reader.uint32()));
|
|
@@ -925,17 +855,16 @@ var AuthInfo = {
|
|
|
925
855
|
}
|
|
926
856
|
return message;
|
|
927
857
|
},
|
|
928
|
-
fromJSON
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
message.signerInfos = ((_a = object.signerInfos) !== null && _a !== void 0 ? _a : []).map(function (e) { return SignerInfo.fromJSON(e); });
|
|
858
|
+
fromJSON(object) {
|
|
859
|
+
const message = { ...baseAuthInfo };
|
|
860
|
+
message.signerInfos = (object.signerInfos ?? []).map((e) => SignerInfo.fromJSON(e));
|
|
932
861
|
message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromJSON(object.fee) : undefined;
|
|
933
862
|
return message;
|
|
934
863
|
},
|
|
935
|
-
toJSON
|
|
936
|
-
|
|
864
|
+
toJSON(message) {
|
|
865
|
+
const obj = {};
|
|
937
866
|
if (message.signerInfos) {
|
|
938
|
-
obj.signerInfos = message.signerInfos.map(
|
|
867
|
+
obj.signerInfos = message.signerInfos.map((e) => (e ? SignerInfo.toJSON(e) : undefined));
|
|
939
868
|
}
|
|
940
869
|
else {
|
|
941
870
|
obj.signerInfos = [];
|
|
@@ -943,17 +872,15 @@ var AuthInfo = {
|
|
|
943
872
|
message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined);
|
|
944
873
|
return obj;
|
|
945
874
|
},
|
|
946
|
-
fromPartial
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
message.signerInfos = ((_a = object.signerInfos) === null || _a === void 0 ? void 0 : _a.map(function (e) { return SignerInfo.fromPartial(e); })) || [];
|
|
875
|
+
fromPartial(object) {
|
|
876
|
+
const message = { ...baseAuthInfo };
|
|
877
|
+
message.signerInfos = object.signerInfos?.map((e) => SignerInfo.fromPartial(e)) || [];
|
|
950
878
|
message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromPartial(object.fee) : undefined;
|
|
951
879
|
return message;
|
|
952
880
|
}
|
|
953
881
|
};
|
|
954
|
-
|
|
955
|
-
encode
|
|
956
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
882
|
+
const Any = {
|
|
883
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
957
884
|
if (message.typeUrl !== '') {
|
|
958
885
|
writer.uint32(10).string(message.typeUrl);
|
|
959
886
|
}
|
|
@@ -962,13 +889,13 @@ var Any = {
|
|
|
962
889
|
}
|
|
963
890
|
return writer;
|
|
964
891
|
},
|
|
965
|
-
decode
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
892
|
+
decode(input, length) {
|
|
893
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
894
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
895
|
+
const message = { ...baseAny };
|
|
969
896
|
message.value = new Uint8Array();
|
|
970
897
|
while (reader.pos < end) {
|
|
971
|
-
|
|
898
|
+
const tag = reader.uint32();
|
|
972
899
|
switch (tag >>> 3) {
|
|
973
900
|
case 1:
|
|
974
901
|
message.typeUrl = reader.string();
|
|
@@ -983,31 +910,28 @@ var Any = {
|
|
|
983
910
|
}
|
|
984
911
|
return message;
|
|
985
912
|
},
|
|
986
|
-
fromJSON
|
|
987
|
-
|
|
913
|
+
fromJSON(object) {
|
|
914
|
+
const message = { ...baseAny };
|
|
988
915
|
message.typeUrl = object.typeUrl !== undefined && object.typeUrl !== null ? String(object.typeUrl) : '';
|
|
989
916
|
message.value = object.value !== undefined && object.value !== null ? bytesFromBase64(object.value) : new Uint8Array();
|
|
990
917
|
return message;
|
|
991
918
|
},
|
|
992
|
-
toJSON
|
|
993
|
-
|
|
919
|
+
toJSON(message) {
|
|
920
|
+
const obj = {};
|
|
994
921
|
message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl);
|
|
995
922
|
message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
|
|
996
923
|
return obj;
|
|
997
924
|
},
|
|
998
|
-
fromPartial
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
message.
|
|
1002
|
-
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : new Uint8Array();
|
|
925
|
+
fromPartial(object) {
|
|
926
|
+
const message = { ...baseAny };
|
|
927
|
+
message.typeUrl = object.typeUrl ?? '';
|
|
928
|
+
message.value = object.value ?? new Uint8Array();
|
|
1003
929
|
return message;
|
|
1004
930
|
}
|
|
1005
931
|
};
|
|
1006
|
-
|
|
1007
|
-
encode
|
|
1008
|
-
|
|
1009
|
-
for (var _i = 0, _a = message.messages; _i < _a.length; _i++) {
|
|
1010
|
-
var v = _a[_i];
|
|
932
|
+
const TxBody = {
|
|
933
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
934
|
+
for (const v of message.messages) {
|
|
1011
935
|
Any.encode(v, writer.uint32(10).fork()).ldelim();
|
|
1012
936
|
}
|
|
1013
937
|
if (message.memo !== '') {
|
|
@@ -1016,25 +940,23 @@ var TxBody = {
|
|
|
1016
940
|
if (!message.timeoutHeight.isZero()) {
|
|
1017
941
|
writer.uint32(24).uint64(message.timeoutHeight);
|
|
1018
942
|
}
|
|
1019
|
-
for (
|
|
1020
|
-
var v = _c[_b];
|
|
943
|
+
for (const v of message.extensionOptions) {
|
|
1021
944
|
Any.encode(v, writer.uint32(8186).fork()).ldelim();
|
|
1022
945
|
}
|
|
1023
|
-
for (
|
|
1024
|
-
var v = _e[_d];
|
|
946
|
+
for (const v of message.nonCriticalExtensionOptions) {
|
|
1025
947
|
Any.encode(v, writer.uint32(16378).fork()).ldelim();
|
|
1026
948
|
}
|
|
1027
949
|
return writer;
|
|
1028
950
|
},
|
|
1029
|
-
decode
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
951
|
+
decode(input, length) {
|
|
952
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
953
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
954
|
+
const message = { ...baseTxBody };
|
|
1033
955
|
message.messages = [];
|
|
1034
956
|
message.extensionOptions = [];
|
|
1035
957
|
message.nonCriticalExtensionOptions = [];
|
|
1036
958
|
while (reader.pos < end) {
|
|
1037
|
-
|
|
959
|
+
const tag = reader.uint32();
|
|
1038
960
|
switch (tag >>> 3) {
|
|
1039
961
|
case 1:
|
|
1040
962
|
message.messages.push(Any.decode(reader, reader.uint32()));
|
|
@@ -1058,21 +980,20 @@ var TxBody = {
|
|
|
1058
980
|
}
|
|
1059
981
|
return message;
|
|
1060
982
|
},
|
|
1061
|
-
fromJSON
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
message.messages = ((_a = object.messages) !== null && _a !== void 0 ? _a : []).map(function (e) { return Any.fromJSON(e); });
|
|
983
|
+
fromJSON(object) {
|
|
984
|
+
const message = { ...baseTxBody };
|
|
985
|
+
message.messages = (object.messages ?? []).map((e) => Any.fromJSON(e));
|
|
1065
986
|
message.memo = object.memo !== undefined && object.memo !== null ? String(object.memo) : '';
|
|
1066
987
|
message.timeoutHeight =
|
|
1067
988
|
object.timeoutHeight !== undefined && object.timeoutHeight !== null ? long_1.default.fromString(object.timeoutHeight) : long_1.default.UZERO;
|
|
1068
|
-
message.extensionOptions = (
|
|
1069
|
-
message.nonCriticalExtensionOptions = (
|
|
989
|
+
message.extensionOptions = (object.extensionOptions ?? []).map((e) => Any.fromJSON(e));
|
|
990
|
+
message.nonCriticalExtensionOptions = (object.nonCriticalExtensionOptions ?? []).map((e) => Any.fromJSON(e));
|
|
1070
991
|
return message;
|
|
1071
992
|
},
|
|
1072
|
-
toJSON
|
|
1073
|
-
|
|
993
|
+
toJSON(message) {
|
|
994
|
+
const obj = {};
|
|
1074
995
|
if (message.messages) {
|
|
1075
|
-
obj.messages = message.messages.map(
|
|
996
|
+
obj.messages = message.messages.map((e) => (e ? Any.toJSON(e) : undefined));
|
|
1076
997
|
}
|
|
1077
998
|
else {
|
|
1078
999
|
obj.messages = [];
|
|
@@ -1080,55 +1001,52 @@ var TxBody = {
|
|
|
1080
1001
|
message.memo !== undefined && (obj.memo = message.memo);
|
|
1081
1002
|
message.timeoutHeight !== undefined && (obj.timeoutHeight = (message.timeoutHeight || long_1.default.UZERO).toString());
|
|
1082
1003
|
if (message.extensionOptions) {
|
|
1083
|
-
obj.extensionOptions = message.extensionOptions.map(
|
|
1004
|
+
obj.extensionOptions = message.extensionOptions.map((e) => (e ? Any.toJSON(e) : undefined));
|
|
1084
1005
|
}
|
|
1085
1006
|
else {
|
|
1086
1007
|
obj.extensionOptions = [];
|
|
1087
1008
|
}
|
|
1088
1009
|
if (message.nonCriticalExtensionOptions) {
|
|
1089
|
-
obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map(
|
|
1010
|
+
obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => (e ? Any.toJSON(e) : undefined));
|
|
1090
1011
|
}
|
|
1091
1012
|
else {
|
|
1092
1013
|
obj.nonCriticalExtensionOptions = [];
|
|
1093
1014
|
}
|
|
1094
1015
|
return obj;
|
|
1095
1016
|
},
|
|
1096
|
-
fromPartial
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
message.
|
|
1100
|
-
message.memo = (_b = object.memo) !== null && _b !== void 0 ? _b : '';
|
|
1017
|
+
fromPartial(object) {
|
|
1018
|
+
const message = { ...baseTxBody };
|
|
1019
|
+
message.messages = object.messages?.map((e) => Any.fromPartial(e)) || [];
|
|
1020
|
+
message.memo = object.memo ?? '';
|
|
1101
1021
|
message.timeoutHeight =
|
|
1102
1022
|
object.timeoutHeight !== undefined && object.timeoutHeight !== null ? long_1.default.fromValue(object.timeoutHeight) : long_1.default.UZERO;
|
|
1103
|
-
message.extensionOptions =
|
|
1104
|
-
message.nonCriticalExtensionOptions =
|
|
1023
|
+
message.extensionOptions = object.extensionOptions?.map((e) => Any.fromPartial(e)) || [];
|
|
1024
|
+
message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map((e) => Any.fromPartial(e)) || [];
|
|
1105
1025
|
return message;
|
|
1106
1026
|
}
|
|
1107
1027
|
};
|
|
1108
|
-
|
|
1109
|
-
encode
|
|
1110
|
-
if (writer === void 0) { writer = minimal_js_1.default.Writer.create(); }
|
|
1028
|
+
const TxRaw = {
|
|
1029
|
+
encode(message, writer = minimal_js_1.default.Writer.create()) {
|
|
1111
1030
|
if (message.bodyBytes.length !== 0) {
|
|
1112
1031
|
writer.uint32(10).bytes(message.bodyBytes);
|
|
1113
1032
|
}
|
|
1114
1033
|
if (message.authInfoBytes.length !== 0) {
|
|
1115
1034
|
writer.uint32(18).bytes(message.authInfoBytes);
|
|
1116
1035
|
}
|
|
1117
|
-
for (
|
|
1118
|
-
var v = _a[_i];
|
|
1036
|
+
for (const v of message.signatures) {
|
|
1119
1037
|
writer.uint32(26).bytes(v);
|
|
1120
1038
|
}
|
|
1121
1039
|
return writer;
|
|
1122
1040
|
},
|
|
1123
|
-
decode
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1041
|
+
decode(input, length) {
|
|
1042
|
+
const reader = input instanceof minimal_js_1.default.Reader ? input : new minimal_js_1.default.Reader(input);
|
|
1043
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1044
|
+
const message = { ...baseTxRaw };
|
|
1127
1045
|
message.signatures = [];
|
|
1128
1046
|
message.bodyBytes = new Uint8Array();
|
|
1129
1047
|
message.authInfoBytes = new Uint8Array();
|
|
1130
1048
|
while (reader.pos < end) {
|
|
1131
|
-
|
|
1049
|
+
const tag = reader.uint32();
|
|
1132
1050
|
switch (tag >>> 3) {
|
|
1133
1051
|
case 1:
|
|
1134
1052
|
message.bodyBytes = reader.bytes();
|
|
@@ -1146,79 +1064,71 @@ var TxRaw = {
|
|
|
1146
1064
|
}
|
|
1147
1065
|
return message;
|
|
1148
1066
|
},
|
|
1149
|
-
fromJSON
|
|
1150
|
-
|
|
1151
|
-
var message = __assign({}, baseTxRaw);
|
|
1067
|
+
fromJSON(object) {
|
|
1068
|
+
const message = { ...baseTxRaw };
|
|
1152
1069
|
message.bodyBytes = object.bodyBytes !== undefined && object.bodyBytes !== null ? bytesFromBase64(object.bodyBytes) : new Uint8Array();
|
|
1153
1070
|
message.authInfoBytes =
|
|
1154
1071
|
object.authInfoBytes !== undefined && object.authInfoBytes !== null ? bytesFromBase64(object.authInfoBytes) : new Uint8Array();
|
|
1155
|
-
message.signatures = (
|
|
1072
|
+
message.signatures = (object.signatures ?? []).map((e) => bytesFromBase64(e));
|
|
1156
1073
|
return message;
|
|
1157
1074
|
},
|
|
1158
|
-
toJSON
|
|
1159
|
-
|
|
1075
|
+
toJSON(message) {
|
|
1076
|
+
const obj = {};
|
|
1160
1077
|
message.bodyBytes !== undefined &&
|
|
1161
1078
|
(obj.bodyBytes = base64FromBytes(message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array()));
|
|
1162
1079
|
message.authInfoBytes !== undefined &&
|
|
1163
1080
|
(obj.authInfoBytes = base64FromBytes(message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array()));
|
|
1164
1081
|
if (message.signatures) {
|
|
1165
|
-
obj.signatures = message.signatures.map(
|
|
1082
|
+
obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array()));
|
|
1166
1083
|
}
|
|
1167
1084
|
else {
|
|
1168
1085
|
obj.signatures = [];
|
|
1169
1086
|
}
|
|
1170
1087
|
return obj;
|
|
1171
1088
|
},
|
|
1172
|
-
fromPartial
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
message.
|
|
1176
|
-
message.
|
|
1177
|
-
message.signatures = ((_c = object.signatures) === null || _c === void 0 ? void 0 : _c.map(function (e) { return e; })) || [];
|
|
1089
|
+
fromPartial(object) {
|
|
1090
|
+
const message = { ...baseTxRaw };
|
|
1091
|
+
message.bodyBytes = object.bodyBytes ?? new Uint8Array();
|
|
1092
|
+
message.authInfoBytes = object.authInfoBytes ?? new Uint8Array();
|
|
1093
|
+
message.signatures = object.signatures?.map((e) => e) || [];
|
|
1178
1094
|
return message;
|
|
1179
1095
|
}
|
|
1180
1096
|
};
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
var authInfo = {
|
|
1097
|
+
const makeAuthInfoBytes = (signers, feeAmount, gasLimit, signMode = 1) => {
|
|
1098
|
+
const authInfo = {
|
|
1184
1099
|
signerInfos: makeSignerInfos(signers, signMode),
|
|
1185
1100
|
fee: {
|
|
1186
|
-
amount:
|
|
1101
|
+
amount: [...feeAmount],
|
|
1187
1102
|
gasLimit: long_1.default.fromNumber(gasLimit)
|
|
1188
1103
|
}
|
|
1189
1104
|
};
|
|
1190
1105
|
return AuthInfo.encode(AuthInfo.fromPartial(authInfo)).finish();
|
|
1191
1106
|
};
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
},
|
|
1201
|
-
sequence: long_1.default.fromNumber(sequence)
|
|
1202
|
-
});
|
|
1203
|
-
});
|
|
1107
|
+
const makeSignerInfos = (signers, signMode = 1) => {
|
|
1108
|
+
return signers.map(({ pubKey, sequence }) => ({
|
|
1109
|
+
publicKey: pubKey,
|
|
1110
|
+
modeInfo: {
|
|
1111
|
+
single: { mode: signMode }
|
|
1112
|
+
},
|
|
1113
|
+
sequence: long_1.default.fromNumber(sequence)
|
|
1114
|
+
}));
|
|
1204
1115
|
};
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
for (
|
|
1116
|
+
const bytesFromBase64 = (b64) => {
|
|
1117
|
+
const bin = atob(b64);
|
|
1118
|
+
const arr = new Uint8Array(bin.length);
|
|
1119
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
1209
1120
|
arr[i] = bin.charCodeAt(i);
|
|
1210
1121
|
}
|
|
1211
1122
|
return arr;
|
|
1212
1123
|
};
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
for (
|
|
1216
|
-
var byte = _a[_i];
|
|
1124
|
+
const base64FromBytes = (arr) => {
|
|
1125
|
+
const bin = [];
|
|
1126
|
+
for (const byte of arr) {
|
|
1217
1127
|
bin.push(String.fromCharCode(byte));
|
|
1218
1128
|
}
|
|
1219
1129
|
return btoa(bin.join(''));
|
|
1220
1130
|
};
|
|
1221
|
-
|
|
1131
|
+
const makeSignDoc = (bodyBytes, authInfoBytes, chainId, accountNumber) => {
|
|
1222
1132
|
return {
|
|
1223
1133
|
bodyBytes: bodyBytes,
|
|
1224
1134
|
authInfoBytes: authInfoBytes,
|
|
@@ -1226,36 +1136,29 @@ var makeSignDoc = function (bodyBytes, authInfoBytes, chainId, accountNumber) {
|
|
|
1226
1136
|
accountNumber: long_1.default.fromNumber(accountNumber)
|
|
1227
1137
|
};
|
|
1228
1138
|
};
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
signed
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
authInfoBytes: signed.authInfoBytes,
|
|
1240
|
-
signatures: [fromBase64(signature.signature)]
|
|
1241
|
-
})];
|
|
1139
|
+
const prepareTxRaw = async (txBodyEncodeObject, fee, Uint8pubKey, sequence, signature, chainId, accountNumber) => {
|
|
1140
|
+
const pubKey = encodePubkey(encodeSecp256k1Pubkey(Uint8pubKey));
|
|
1141
|
+
const txBodyBytes = encode(txBodyEncodeObject);
|
|
1142
|
+
const gasLimit = Int53.fromString(fee.gas).toNumber();
|
|
1143
|
+
const authInfoBytes = makeAuthInfoBytes([{ pubKey, sequence }], fee.amount, gasLimit);
|
|
1144
|
+
const signed = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
1145
|
+
return TxRaw.fromPartial({
|
|
1146
|
+
bodyBytes: signed.bodyBytes,
|
|
1147
|
+
authInfoBytes: signed.authInfoBytes,
|
|
1148
|
+
signatures: [fromBase64(signature.signature)]
|
|
1242
1149
|
});
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
return [2 /*return*/, makeSignBytes(signDoc)];
|
|
1253
|
-
});
|
|
1254
|
-
}); };
|
|
1150
|
+
};
|
|
1151
|
+
const prepareSignBytes = async (txBodyEncodeObject, fee, pubKey, sequence, chainId, accountNumber) => {
|
|
1152
|
+
const encodedPubKey = encodePubkey(encodeSecp256k1Pubkey(pubKey));
|
|
1153
|
+
const txBodyBytes = encode(txBodyEncodeObject);
|
|
1154
|
+
const gasLimit = Int53.fromString(fee.gas).toNumber();
|
|
1155
|
+
const authInfoBytes = makeAuthInfoBytes([{ pubKey: encodedPubKey, sequence }], fee.amount, gasLimit);
|
|
1156
|
+
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
1157
|
+
return makeSignBytes(signDoc);
|
|
1158
|
+
};
|
|
1255
1159
|
exports.prepareSignBytes = prepareSignBytes;
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
var signDoc = SignDoc.fromPartial({
|
|
1160
|
+
const makeSignBytes = ({ accountNumber, authInfoBytes, bodyBytes, chainId }) => {
|
|
1161
|
+
const signDoc = SignDoc.fromPartial({
|
|
1259
1162
|
accountNumber: accountNumber,
|
|
1260
1163
|
authInfoBytes: authInfoBytes,
|
|
1261
1164
|
bodyBytes: bodyBytes,
|
|
@@ -1263,35 +1166,25 @@ var makeSignBytes = function (_a) {
|
|
|
1263
1166
|
});
|
|
1264
1167
|
return SignDoc.encode(signDoc).finish();
|
|
1265
1168
|
};
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
return
|
|
1269
|
-
|
|
1270
|
-
case 0: return [4 /*yield*/, prepareTxRaw(txBodyEncodeObject, fee, pubKey, sequence, signature, chainId, accountNumber)];
|
|
1271
|
-
case 1:
|
|
1272
|
-
txRaw = _a.sent();
|
|
1273
|
-
return [2 /*return*/, TxRaw.encode(txRaw).finish()];
|
|
1274
|
-
}
|
|
1275
|
-
});
|
|
1276
|
-
}); };
|
|
1169
|
+
const encodeTxBytes = async (txBodyEncodeObject, fee, pubKey, sequence, signature, chainId, accountNumber) => {
|
|
1170
|
+
const txRaw = await prepareTxRaw(txBodyEncodeObject, fee, pubKey, sequence, signature, chainId, accountNumber);
|
|
1171
|
+
return TxRaw.encode(txRaw).finish();
|
|
1172
|
+
};
|
|
1277
1173
|
exports.encodeTxBytes = encodeTxBytes;
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
}];
|
|
1294
|
-
});
|
|
1295
|
-
}); };
|
|
1174
|
+
const decodeTxBytes = async (bytes) => {
|
|
1175
|
+
const decoded = TxRaw.decode(bytes);
|
|
1176
|
+
const body = TxBody.decode(decoded.bodyBytes);
|
|
1177
|
+
const authInfo = AuthInfo.decode(decoded.authInfoBytes);
|
|
1178
|
+
const messages = body.messages.map((msg) => ({
|
|
1179
|
+
typeUrl: msg.typeUrl,
|
|
1180
|
+
value: lookupTypeWithError(msg.typeUrl).decode(msg.value)
|
|
1181
|
+
}));
|
|
1182
|
+
return {
|
|
1183
|
+
messages,
|
|
1184
|
+
memo: body.memo,
|
|
1185
|
+
fee: authInfo.fee,
|
|
1186
|
+
signerInfos: authInfo.signerInfos
|
|
1187
|
+
};
|
|
1188
|
+
};
|
|
1296
1189
|
exports.decodeTxBytes = decodeTxBytes;
|
|
1297
1190
|
//# sourceMappingURL=index.js.map
|