@agoric/cosmic-proto 0.5.0-u19.2 → 0.5.0-u20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/address-hooks.d.ts +4 -3
- package/dist/address-hooks.js +1 -217
- package/dist/address-hooks.js.map +1 -1
- package/dist/codegen/agoric/bundle.js +1 -51
- package/dist/codegen/agoric/lien/genesis.js +1 -143
- package/dist/codegen/agoric/lien/lien.js +1 -87
- package/dist/codegen/agoric/swingset/genesis.js +1 -181
- package/dist/codegen/agoric/swingset/msgs.js +1 -700
- package/dist/codegen/agoric/swingset/query.js +1 -356
- package/dist/codegen/agoric/swingset/swingset.js +1 -816
- package/dist/codegen/agoric/vbank/genesis.js +1 -82
- package/dist/codegen/agoric/vbank/msgs.js +1 -2
- package/dist/codegen/agoric/vbank/query.js +1 -222
- package/dist/codegen/agoric/vbank/vbank.js +1 -237
- package/dist/codegen/agoric/vibc/msgs.js +1 -127
- package/dist/codegen/agoric/vlocalchain/vlocalchain.js +1 -307
- package/dist/codegen/agoric/vstorage/genesis.js +1 -138
- package/dist/codegen/agoric/vstorage/query.js +1 -441
- package/dist/codegen/agoric/vstorage/vstorage.js +1 -128
- package/dist/codegen/agoric/vtransfer/genesis.js +1 -70
- package/dist/codegen/amino/amino.js +1 -2
- package/dist/codegen/amino/bundle.js +1 -6
- package/dist/codegen/binary.js +1 -367
- package/dist/codegen/circle/bundle.d.ts +0 -506
- package/dist/codegen/circle/bundle.js +1 -40
- package/dist/codegen/circle/cctp/v1/attester.js +1 -63
- package/dist/codegen/circle/cctp/v1/burn_message.js +1 -117
- package/dist/codegen/circle/cctp/v1/burning_and_minting_paused.js +1 -63
- package/dist/codegen/circle/cctp/v1/events.js +1 -1612
- package/dist/codegen/circle/cctp/v1/genesis.js +1 -295
- package/dist/codegen/circle/cctp/v1/max_message_body_size.js +1 -69
- package/dist/codegen/circle/cctp/v1/message.js +1 -160
- package/dist/codegen/circle/cctp/v1/nonce.js +1 -80
- package/dist/codegen/circle/cctp/v1/per_message_burn_limit.js +1 -73
- package/dist/codegen/circle/cctp/v1/query.js +1 -2421
- package/dist/codegen/circle/cctp/v1/remote_token_messenger.js +1 -77
- package/dist/codegen/circle/cctp/v1/sending_and_receiving_messages_paused.js +1 -63
- package/dist/codegen/circle/cctp/v1/signature_threshold.js +1 -63
- package/dist/codegen/circle/cctp/v1/token_pair.js +1 -91
- package/dist/codegen/circle/cctp/v1/tx.d.ts +0 -998
- package/dist/codegen/circle/cctp/v1/tx.js +1 -3264
- package/dist/codegen/circle/cctp/v1/tx.js.map +1 -1
- package/dist/codegen/cosmos/auth/v1beta1/auth.js +1 -337
- package/dist/codegen/cosmos/auth/v1beta1/genesis.js +1 -86
- package/dist/codegen/cosmos/auth/v1beta1/query.js +1 -1113
- package/dist/codegen/cosmos/authz/v1beta1/authz.js +1 -334
- package/dist/codegen/cosmos/authz/v1beta1/event.js +1 -161
- package/dist/codegen/cosmos/authz/v1beta1/genesis.js +1 -71
- package/dist/codegen/cosmos/authz/v1beta1/query.js +1 -506
- package/dist/codegen/cosmos/authz/v1beta1/tx.js +1 -415
- package/dist/codegen/cosmos/bank/v1beta1/authz.js +1 -71
- package/dist/codegen/cosmos/bank/v1beta1/bank.js +1 -592
- package/dist/codegen/cosmos/bank/v1beta1/genesis.js +1 -196
- package/dist/codegen/cosmos/bank/v1beta1/query.js +1 -1347
- package/dist/codegen/cosmos/bank/v1beta1/tx.js +1 -267
- package/dist/codegen/cosmos/base/abci/v1beta1/abci.js +1 -1012
- package/dist/codegen/cosmos/base/node/v1beta1/query.js +1 -112
- package/dist/codegen/cosmos/base/query/v1beta1/pagination.js +1 -189
- package/dist/codegen/cosmos/base/reflection/v2alpha1/reflection.js +1 -1755
- package/dist/codegen/cosmos/base/v1beta1/coin.js +1 -257
- package/dist/codegen/cosmos/bundle.js +1 -249
- package/dist/codegen/cosmos/crypto/ed25519/keys.js +1 -123
- package/dist/codegen/cosmos/crypto/hd/v1/hd.js +1 -109
- package/dist/codegen/cosmos/crypto/keyring/v1/record.js +1 -367
- package/dist/codegen/cosmos/crypto/multisig/keys.js +1 -82
- package/dist/codegen/cosmos/crypto/multisig/v1beta1/multisig.js +1 -144
- package/dist/codegen/cosmos/crypto/secp256k1/keys.js +1 -123
- package/dist/codegen/cosmos/crypto/secp256r1/keys.js +1 -125
- package/dist/codegen/cosmos/distribution/v1beta1/distribution.js +1 -978
- package/dist/codegen/cosmos/distribution/v1beta1/genesis.js +1 -837
- package/dist/codegen/cosmos/distribution/v1beta1/query.js +1 -1207
- package/dist/codegen/cosmos/distribution/v1beta1/tx.js +1 -512
- package/dist/codegen/cosmos/feegrant/v1beta1/feegrant.js +1 -412
- package/dist/codegen/cosmos/feegrant/v1beta1/genesis.js +1 -71
- package/dist/codegen/cosmos/feegrant/v1beta1/query.js +1 -461
- package/dist/codegen/cosmos/feegrant/v1beta1/tx.js +1 -267
- package/dist/codegen/cosmos/gov/v1/genesis.js +1 -177
- package/dist/codegen/cosmos/gov/v1/gov.js +1 -928
- package/dist/codegen/cosmos/gov/v1/query.js +1 -1216
- package/dist/codegen/cosmos/gov/v1/tx.js +1 -730
- package/dist/codegen/cosmos/gov/v1beta1/genesis.js +1 -177
- package/dist/codegen/cosmos/gov/v1beta1/gov.js +1 -1003
- package/dist/codegen/cosmos/gov/v1beta1/query.js +1 -1216
- package/dist/codegen/cosmos/gov/v1beta1/tx.js +1 -578
- package/dist/codegen/cosmos/group/v1/events.js +1 -696
- package/dist/codegen/cosmos/group/v1/genesis.js +1 -190
- package/dist/codegen/cosmos/group/v1/query.js +1 -2096
- package/dist/codegen/cosmos/group/v1/tx.js +1 -2073
- package/dist/codegen/cosmos/group/v1/types.js +1 -1387
- package/dist/codegen/cosmos/mint/v1beta1/genesis.js +1 -82
- package/dist/codegen/cosmos/mint/v1beta1/mint.js +1 -211
- package/dist/codegen/cosmos/mint/v1beta1/query.js +1 -330
- package/dist/codegen/cosmos/msg/v1/msg.js +1 -2
- package/dist/codegen/cosmos/params/v1beta1/params.js +1 -171
- package/dist/codegen/cosmos/params/v1beta1/query.js +1 -327
- package/dist/codegen/cosmos/staking/v1beta1/authz.js +1 -240
- package/dist/codegen/cosmos/staking/v1beta1/genesis.js +1 -256
- package/dist/codegen/cosmos/staking/v1beta1/query.js +1 -2069
- package/dist/codegen/cosmos/staking/v1beta1/staking.js +1 -1915
- package/dist/codegen/cosmos/staking/v1beta1/tx.js +1 -968
- package/dist/codegen/cosmos/tx/signing/v1beta1/signing.js +1 -516
- package/dist/codegen/cosmos/tx/v1beta1/service.js +1 -975
- package/dist/codegen/cosmos/tx/v1beta1/tx.js +1 -1256
- package/dist/codegen/cosmos/upgrade/v1beta1/query.js +1 -592
- package/dist/codegen/cosmos/upgrade/v1beta1/tx.js +1 -228
- package/dist/codegen/cosmos/upgrade/v1beta1/upgrade.js +1 -352
- package/dist/codegen/cosmos/vesting/v1beta1/tx.js +1 -865
- package/dist/codegen/cosmos/vesting/v1beta1/vesting.js +1 -674
- package/dist/codegen/cosmos_proto/bundle.js +1 -6
- package/dist/codegen/cosmos_proto/cosmos.js +1 -208
- package/dist/codegen/gogoproto/bundle.js +1 -6
- package/dist/codegen/gogoproto/gogo.js +1 -2
- package/dist/codegen/google/api/annotations.js +1 -2
- package/dist/codegen/google/api/http.js +1 -319
- package/dist/codegen/google/bundle.js +1 -17
- package/dist/codegen/google/protobuf/any.js +1 -77
- package/dist/codegen/google/protobuf/descriptor.js +1 -3421
- package/dist/codegen/google/protobuf/duration.js +1 -79
- package/dist/codegen/google/protobuf/empty.js +1 -50
- package/dist/codegen/google/protobuf/timestamp.js +1 -79
- package/dist/codegen/helpers.js +1 -196
- package/dist/codegen/ibc/applications/interchain_accounts/controller/v1/controller.js +1 -66
- package/dist/codegen/ibc/applications/interchain_accounts/controller/v1/query.js +1 -243
- package/dist/codegen/ibc/applications/interchain_accounts/controller/v1/tx.js +1 -314
- package/dist/codegen/ibc/applications/interchain_accounts/genesis/v1/genesis.js +1 -503
- package/dist/codegen/ibc/applications/interchain_accounts/host/v1/host.js +1 -83
- package/dist/codegen/ibc/applications/interchain_accounts/host/v1/query.js +1 -114
- package/dist/codegen/ibc/applications/interchain_accounts/v1/account.js +1 -86
- package/dist/codegen/ibc/applications/interchain_accounts/v1/metadata.js +1 -119
- package/dist/codegen/ibc/applications/interchain_accounts/v1/packet.js +1 -190
- package/dist/codegen/ibc/applications/transfer/v1/authz.js +1 -178
- package/dist/codegen/ibc/applications/transfer/v1/genesis.js +1 -96
- package/dist/codegen/ibc/applications/transfer/v1/query.js +1 -634
- package/dist/codegen/ibc/applications/transfer/v1/transfer.js +1 -147
- package/dist/codegen/ibc/applications/transfer/v1/tx.js +1 -220
- package/dist/codegen/ibc/applications/transfer/v2/packet.js +1 -103
- package/dist/codegen/ibc/bundle.js +1 -142
- package/dist/codegen/ibc/core/channel/v1/channel.js +1 -845
- package/dist/codegen/ibc/core/channel/v1/genesis.js +1 -281
- package/dist/codegen/ibc/core/channel/v1/query.js +1 -2344
- package/dist/codegen/ibc/core/channel/v1/tx.js +1 -1745
- package/dist/codegen/ibc/core/client/v1/client.js +1 -583
- package/dist/codegen/ibc/core/client/v1/genesis.js +1 -301
- package/dist/codegen/ibc/core/client/v1/query.js +1 -1283
- package/dist/codegen/ibc/core/client/v1/tx.js +1 -587
- package/dist/codegen/ibc/core/commitment/v1/commitment.js +1 -259
- package/dist/codegen/ibc/core/connection/v1/connection.js +1 -678
- package/dist/codegen/ibc/core/connection/v1/genesis.js +1 -122
- package/dist/codegen/ibc/core/connection/v1/query.js +1 -952
- package/dist/codegen/ibc/core/connection/v1/tx.js +1 -843
- package/dist/codegen/ibc/lightclients/localhost/v1/localhost.js +1 -78
- package/dist/codegen/ibc/lightclients/solomachine/v1/solomachine.js +1 -1520
- package/dist/codegen/ibc/lightclients/solomachine/v2/solomachine.js +1 -1514
- package/dist/codegen/ibc/lightclients/tendermint/v1/tendermint.js +1 -628
- package/dist/codegen/icq/bundle.js +1 -17
- package/dist/codegen/icq/v1/genesis.js +1 -78
- package/dist/codegen/icq/v1/icq.js +1 -83
- package/dist/codegen/icq/v1/packet.js +1 -270
- package/dist/codegen/icq/v1/query.js +1 -114
- package/dist/codegen/icq/v1/tx.js +1 -124
- package/dist/codegen/ics23/bundle.js +1 -6
- package/dist/codegen/index.js +1 -23
- package/dist/codegen/json-safe.js +1 -8
- package/dist/codegen/proofs.js +1 -1436
- package/dist/codegen/stride/bundle.js +1 -71
- package/dist/codegen/stride/epochs/genesis.js +1 -227
- package/dist/codegen/stride/epochs/query.js +1 -398
- package/dist/codegen/stride/records/callbacks.js +1 -136
- package/dist/codegen/stride/records/genesis.js +1 -186
- package/dist/codegen/stride/records/params.js +1 -50
- package/dist/codegen/stride/records/query.js +1 -1552
- package/dist/codegen/stride/records/records.js +1 -939
- package/dist/codegen/stride/stakedym/genesis.js +1 -312
- package/dist/codegen/stride/stakedym/query.js +1 -887
- package/dist/codegen/stride/stakedym/stakedym.js +1 -909
- package/dist/codegen/stride/stakedym/tx.js +1 -1661
- package/dist/codegen/stride/stakeibc/address_unbonding.js +1 -135
- package/dist/codegen/stride/stakeibc/callbacks.js +1 -1191
- package/dist/codegen/stride/stakeibc/epoch_tracker.js +1 -115
- package/dist/codegen/stride/stakeibc/genesis.js +1 -135
- package/dist/codegen/stride/stakeibc/gov.js +1 -212
- package/dist/codegen/stride/stakeibc/host_zone.js +1 -544
- package/dist/codegen/stride/stakeibc/ica_account.js +1 -165
- package/dist/codegen/stride/stakeibc/packet.js +1 -113
- package/dist/codegen/stride/stakeibc/params.js +1 -317
- package/dist/codegen/stride/stakeibc/query.js +1 -1372
- package/dist/codegen/stride/stakeibc/trade_route.js +1 -377
- package/dist/codegen/stride/stakeibc/tx.js +1 -3392
- package/dist/codegen/stride/stakeibc/validator.js +1 -170
- package/dist/codegen/stride/staketia/genesis.js +1 -312
- package/dist/codegen/stride/staketia/query.js +1 -887
- package/dist/codegen/stride/staketia/staketia.js +1 -819
- package/dist/codegen/stride/staketia/tx.js +1 -1671
- package/dist/codegen/tendermint/abci/types.d.ts +264 -692
- package/dist/codegen/tendermint/abci/types.js +1 -4434
- package/dist/codegen/tendermint/abci/types.js.map +1 -1
- package/dist/codegen/tendermint/bundle.d.ts +0 -272
- package/dist/codegen/tendermint/bundle.js +1 -42
- package/dist/codegen/tendermint/crypto/keys.js +1 -85
- package/dist/codegen/tendermint/crypto/proof.js +1 -409
- package/dist/codegen/tendermint/libs/bits/types.js +1 -94
- package/dist/codegen/tendermint/p2p/types.js +1 -506
- package/dist/codegen/tendermint/types/block.js +1 -119
- package/dist/codegen/tendermint/types/evidence.js +1 -415
- package/dist/codegen/tendermint/types/params.js +1 -529
- package/dist/codegen/tendermint/types/types.js +1 -1534
- package/dist/codegen/tendermint/types/validator.js +1 -299
- package/dist/codegen/tendermint/version/types.js +1 -155
- package/dist/codegen/utf8.js +1 -138
- package/dist/codegen/varint.js +1 -409
- package/dist/helpers.js +1 -22
- package/dist/index.js +1 -6
- package/package.json +12 -10
|
@@ -1,299 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { PublicKey } from '../crypto/keys.js';
|
|
3
|
-
import { BinaryReader, BinaryWriter } from '../../binary.js';
|
|
4
|
-
import { isSet, bytesFromBase64, base64FromBytes } from '../../helpers.js';
|
|
5
|
-
import {} from '../../json-safe.js';
|
|
6
|
-
function createBaseValidatorSet() {
|
|
7
|
-
return {
|
|
8
|
-
validators: [],
|
|
9
|
-
proposer: undefined,
|
|
10
|
-
totalVotingPower: BigInt(0),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export const ValidatorSet = {
|
|
14
|
-
typeUrl: '/tendermint.types.ValidatorSet',
|
|
15
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
16
|
-
for (const v of message.validators) {
|
|
17
|
-
Validator.encode(v, writer.uint32(10).fork()).ldelim();
|
|
18
|
-
}
|
|
19
|
-
if (message.proposer !== undefined) {
|
|
20
|
-
Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim();
|
|
21
|
-
}
|
|
22
|
-
if (message.totalVotingPower !== BigInt(0)) {
|
|
23
|
-
writer.uint32(24).int64(message.totalVotingPower);
|
|
24
|
-
}
|
|
25
|
-
return writer;
|
|
26
|
-
},
|
|
27
|
-
decode(input, length) {
|
|
28
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
29
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
30
|
-
const message = createBaseValidatorSet();
|
|
31
|
-
while (reader.pos < end) {
|
|
32
|
-
const tag = reader.uint32();
|
|
33
|
-
switch (tag >>> 3) {
|
|
34
|
-
case 1:
|
|
35
|
-
message.validators.push(Validator.decode(reader, reader.uint32()));
|
|
36
|
-
break;
|
|
37
|
-
case 2:
|
|
38
|
-
message.proposer = Validator.decode(reader, reader.uint32());
|
|
39
|
-
break;
|
|
40
|
-
case 3:
|
|
41
|
-
message.totalVotingPower = reader.int64();
|
|
42
|
-
break;
|
|
43
|
-
default:
|
|
44
|
-
reader.skipType(tag & 7);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return message;
|
|
49
|
-
},
|
|
50
|
-
fromJSON(object) {
|
|
51
|
-
return {
|
|
52
|
-
validators: Array.isArray(object?.validators)
|
|
53
|
-
? object.validators.map((e) => Validator.fromJSON(e))
|
|
54
|
-
: [],
|
|
55
|
-
proposer: isSet(object.proposer)
|
|
56
|
-
? Validator.fromJSON(object.proposer)
|
|
57
|
-
: undefined,
|
|
58
|
-
totalVotingPower: isSet(object.totalVotingPower)
|
|
59
|
-
? BigInt(object.totalVotingPower.toString())
|
|
60
|
-
: BigInt(0),
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
toJSON(message) {
|
|
64
|
-
const obj = {};
|
|
65
|
-
if (message.validators) {
|
|
66
|
-
obj.validators = message.validators.map(e => e ? Validator.toJSON(e) : undefined);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
obj.validators = [];
|
|
70
|
-
}
|
|
71
|
-
message.proposer !== undefined &&
|
|
72
|
-
(obj.proposer = message.proposer
|
|
73
|
-
? Validator.toJSON(message.proposer)
|
|
74
|
-
: undefined);
|
|
75
|
-
message.totalVotingPower !== undefined &&
|
|
76
|
-
(obj.totalVotingPower = (message.totalVotingPower || BigInt(0)).toString());
|
|
77
|
-
return obj;
|
|
78
|
-
},
|
|
79
|
-
fromPartial(object) {
|
|
80
|
-
const message = createBaseValidatorSet();
|
|
81
|
-
message.validators =
|
|
82
|
-
object.validators?.map(e => Validator.fromPartial(e)) || [];
|
|
83
|
-
message.proposer =
|
|
84
|
-
object.proposer !== undefined && object.proposer !== null
|
|
85
|
-
? Validator.fromPartial(object.proposer)
|
|
86
|
-
: undefined;
|
|
87
|
-
message.totalVotingPower =
|
|
88
|
-
object.totalVotingPower !== undefined && object.totalVotingPower !== null
|
|
89
|
-
? BigInt(object.totalVotingPower.toString())
|
|
90
|
-
: BigInt(0);
|
|
91
|
-
return message;
|
|
92
|
-
},
|
|
93
|
-
fromProtoMsg(message) {
|
|
94
|
-
return ValidatorSet.decode(message.value);
|
|
95
|
-
},
|
|
96
|
-
toProto(message) {
|
|
97
|
-
return ValidatorSet.encode(message).finish();
|
|
98
|
-
},
|
|
99
|
-
toProtoMsg(message) {
|
|
100
|
-
return {
|
|
101
|
-
typeUrl: '/tendermint.types.ValidatorSet',
|
|
102
|
-
value: ValidatorSet.encode(message).finish(),
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
function createBaseValidator() {
|
|
107
|
-
return {
|
|
108
|
-
address: new Uint8Array(),
|
|
109
|
-
pubKey: PublicKey.fromPartial({}),
|
|
110
|
-
votingPower: BigInt(0),
|
|
111
|
-
proposerPriority: BigInt(0),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
export const Validator = {
|
|
115
|
-
typeUrl: '/tendermint.types.Validator',
|
|
116
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
117
|
-
if (message.address.length !== 0) {
|
|
118
|
-
writer.uint32(10).bytes(message.address);
|
|
119
|
-
}
|
|
120
|
-
if (message.pubKey !== undefined) {
|
|
121
|
-
PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim();
|
|
122
|
-
}
|
|
123
|
-
if (message.votingPower !== BigInt(0)) {
|
|
124
|
-
writer.uint32(24).int64(message.votingPower);
|
|
125
|
-
}
|
|
126
|
-
if (message.proposerPriority !== BigInt(0)) {
|
|
127
|
-
writer.uint32(32).int64(message.proposerPriority);
|
|
128
|
-
}
|
|
129
|
-
return writer;
|
|
130
|
-
},
|
|
131
|
-
decode(input, length) {
|
|
132
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
133
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
134
|
-
const message = createBaseValidator();
|
|
135
|
-
while (reader.pos < end) {
|
|
136
|
-
const tag = reader.uint32();
|
|
137
|
-
switch (tag >>> 3) {
|
|
138
|
-
case 1:
|
|
139
|
-
message.address = reader.bytes();
|
|
140
|
-
break;
|
|
141
|
-
case 2:
|
|
142
|
-
message.pubKey = PublicKey.decode(reader, reader.uint32());
|
|
143
|
-
break;
|
|
144
|
-
case 3:
|
|
145
|
-
message.votingPower = reader.int64();
|
|
146
|
-
break;
|
|
147
|
-
case 4:
|
|
148
|
-
message.proposerPriority = reader.int64();
|
|
149
|
-
break;
|
|
150
|
-
default:
|
|
151
|
-
reader.skipType(tag & 7);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return message;
|
|
156
|
-
},
|
|
157
|
-
fromJSON(object) {
|
|
158
|
-
return {
|
|
159
|
-
address: isSet(object.address)
|
|
160
|
-
? bytesFromBase64(object.address)
|
|
161
|
-
: new Uint8Array(),
|
|
162
|
-
pubKey: isSet(object.pubKey)
|
|
163
|
-
? PublicKey.fromJSON(object.pubKey)
|
|
164
|
-
: undefined,
|
|
165
|
-
votingPower: isSet(object.votingPower)
|
|
166
|
-
? BigInt(object.votingPower.toString())
|
|
167
|
-
: BigInt(0),
|
|
168
|
-
proposerPriority: isSet(object.proposerPriority)
|
|
169
|
-
? BigInt(object.proposerPriority.toString())
|
|
170
|
-
: BigInt(0),
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
toJSON(message) {
|
|
174
|
-
const obj = {};
|
|
175
|
-
message.address !== undefined &&
|
|
176
|
-
(obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array()));
|
|
177
|
-
message.pubKey !== undefined &&
|
|
178
|
-
(obj.pubKey = message.pubKey
|
|
179
|
-
? PublicKey.toJSON(message.pubKey)
|
|
180
|
-
: undefined);
|
|
181
|
-
message.votingPower !== undefined &&
|
|
182
|
-
(obj.votingPower = (message.votingPower || BigInt(0)).toString());
|
|
183
|
-
message.proposerPriority !== undefined &&
|
|
184
|
-
(obj.proposerPriority = (message.proposerPriority || BigInt(0)).toString());
|
|
185
|
-
return obj;
|
|
186
|
-
},
|
|
187
|
-
fromPartial(object) {
|
|
188
|
-
const message = createBaseValidator();
|
|
189
|
-
message.address = object.address ?? new Uint8Array();
|
|
190
|
-
message.pubKey =
|
|
191
|
-
object.pubKey !== undefined && object.pubKey !== null
|
|
192
|
-
? PublicKey.fromPartial(object.pubKey)
|
|
193
|
-
: undefined;
|
|
194
|
-
message.votingPower =
|
|
195
|
-
object.votingPower !== undefined && object.votingPower !== null
|
|
196
|
-
? BigInt(object.votingPower.toString())
|
|
197
|
-
: BigInt(0);
|
|
198
|
-
message.proposerPriority =
|
|
199
|
-
object.proposerPriority !== undefined && object.proposerPriority !== null
|
|
200
|
-
? BigInt(object.proposerPriority.toString())
|
|
201
|
-
: BigInt(0);
|
|
202
|
-
return message;
|
|
203
|
-
},
|
|
204
|
-
fromProtoMsg(message) {
|
|
205
|
-
return Validator.decode(message.value);
|
|
206
|
-
},
|
|
207
|
-
toProto(message) {
|
|
208
|
-
return Validator.encode(message).finish();
|
|
209
|
-
},
|
|
210
|
-
toProtoMsg(message) {
|
|
211
|
-
return {
|
|
212
|
-
typeUrl: '/tendermint.types.Validator',
|
|
213
|
-
value: Validator.encode(message).finish(),
|
|
214
|
-
};
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
function createBaseSimpleValidator() {
|
|
218
|
-
return {
|
|
219
|
-
pubKey: undefined,
|
|
220
|
-
votingPower: BigInt(0),
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
export const SimpleValidator = {
|
|
224
|
-
typeUrl: '/tendermint.types.SimpleValidator',
|
|
225
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
226
|
-
if (message.pubKey !== undefined) {
|
|
227
|
-
PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim();
|
|
228
|
-
}
|
|
229
|
-
if (message.votingPower !== BigInt(0)) {
|
|
230
|
-
writer.uint32(16).int64(message.votingPower);
|
|
231
|
-
}
|
|
232
|
-
return writer;
|
|
233
|
-
},
|
|
234
|
-
decode(input, length) {
|
|
235
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
236
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
237
|
-
const message = createBaseSimpleValidator();
|
|
238
|
-
while (reader.pos < end) {
|
|
239
|
-
const tag = reader.uint32();
|
|
240
|
-
switch (tag >>> 3) {
|
|
241
|
-
case 1:
|
|
242
|
-
message.pubKey = PublicKey.decode(reader, reader.uint32());
|
|
243
|
-
break;
|
|
244
|
-
case 2:
|
|
245
|
-
message.votingPower = reader.int64();
|
|
246
|
-
break;
|
|
247
|
-
default:
|
|
248
|
-
reader.skipType(tag & 7);
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return message;
|
|
253
|
-
},
|
|
254
|
-
fromJSON(object) {
|
|
255
|
-
return {
|
|
256
|
-
pubKey: isSet(object.pubKey)
|
|
257
|
-
? PublicKey.fromJSON(object.pubKey)
|
|
258
|
-
: undefined,
|
|
259
|
-
votingPower: isSet(object.votingPower)
|
|
260
|
-
? BigInt(object.votingPower.toString())
|
|
261
|
-
: BigInt(0),
|
|
262
|
-
};
|
|
263
|
-
},
|
|
264
|
-
toJSON(message) {
|
|
265
|
-
const obj = {};
|
|
266
|
-
message.pubKey !== undefined &&
|
|
267
|
-
(obj.pubKey = message.pubKey
|
|
268
|
-
? PublicKey.toJSON(message.pubKey)
|
|
269
|
-
: undefined);
|
|
270
|
-
message.votingPower !== undefined &&
|
|
271
|
-
(obj.votingPower = (message.votingPower || BigInt(0)).toString());
|
|
272
|
-
return obj;
|
|
273
|
-
},
|
|
274
|
-
fromPartial(object) {
|
|
275
|
-
const message = createBaseSimpleValidator();
|
|
276
|
-
message.pubKey =
|
|
277
|
-
object.pubKey !== undefined && object.pubKey !== null
|
|
278
|
-
? PublicKey.fromPartial(object.pubKey)
|
|
279
|
-
: undefined;
|
|
280
|
-
message.votingPower =
|
|
281
|
-
object.votingPower !== undefined && object.votingPower !== null
|
|
282
|
-
? BigInt(object.votingPower.toString())
|
|
283
|
-
: BigInt(0);
|
|
284
|
-
return message;
|
|
285
|
-
},
|
|
286
|
-
fromProtoMsg(message) {
|
|
287
|
-
return SimpleValidator.decode(message.value);
|
|
288
|
-
},
|
|
289
|
-
toProto(message) {
|
|
290
|
-
return SimpleValidator.encode(message).finish();
|
|
291
|
-
},
|
|
292
|
-
toProtoMsg(message) {
|
|
293
|
-
return {
|
|
294
|
-
typeUrl: '/tendermint.types.SimpleValidator',
|
|
295
|
-
value: SimpleValidator.encode(message).finish(),
|
|
296
|
-
};
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
//# sourceMappingURL=validator.js.map
|
|
1
|
+
import{PublicKey as o}from"../crypto/keys.js";import{BinaryReader as t,BinaryWriter as r}from"../../binary.js";import{isSet as e,bytesFromBase64 as i,base64FromBytes as n}from"../../helpers.js";import{}from"../../json-safe.js";function a(){return{validators:[],proposer:void 0,totalVotingPower:BigInt(0)}}export const ValidatorSet={typeUrl:"/tendermint.types.ValidatorSet",encode(o,t=r.create()){for(const r of o.validators)Validator.encode(r,t.uint32(10).fork()).ldelim();return void 0!==o.proposer&&Validator.encode(o.proposer,t.uint32(18).fork()).ldelim(),o.totalVotingPower!==BigInt(0)&&t.uint32(24).int64(o.totalVotingPower),t},decode(o,r){const e=o instanceof t?o:new t(o);let i=void 0===r?e.len:e.pos+r;const n=a();for(;e.pos<i;){const o=e.uint32();switch(o>>>3){case 1:n.validators.push(Validator.decode(e,e.uint32()));break;case 2:n.proposer=Validator.decode(e,e.uint32());break;case 3:n.totalVotingPower=e.int64();break;default:e.skipType(7&o)}}return n},fromJSON:o=>({validators:Array.isArray(o?.validators)?o.validators.map((o=>Validator.fromJSON(o))):[],proposer:e(o.proposer)?Validator.fromJSON(o.proposer):void 0,totalVotingPower:e(o.totalVotingPower)?BigInt(o.totalVotingPower.toString()):BigInt(0)}),toJSON(o){const t={};return o.validators?t.validators=o.validators.map((o=>o?Validator.toJSON(o):void 0)):t.validators=[],void 0!==o.proposer&&(t.proposer=o.proposer?Validator.toJSON(o.proposer):void 0),void 0!==o.totalVotingPower&&(t.totalVotingPower=(o.totalVotingPower||BigInt(0)).toString()),t},fromPartial(o){const t=a();return t.validators=o.validators?.map((o=>Validator.fromPartial(o)))||[],t.proposer=void 0!==o.proposer&&null!==o.proposer?Validator.fromPartial(o.proposer):void 0,t.totalVotingPower=void 0!==o.totalVotingPower&&null!==o.totalVotingPower?BigInt(o.totalVotingPower.toString()):BigInt(0),t},fromProtoMsg:o=>ValidatorSet.decode(o.value),toProto:o=>ValidatorSet.encode(o).finish(),toProtoMsg:o=>({typeUrl:"/tendermint.types.ValidatorSet",value:ValidatorSet.encode(o).finish()})};function d(){return{address:new Uint8Array,pubKey:o.fromPartial({}),votingPower:BigInt(0),proposerPriority:BigInt(0)}}export const Validator={typeUrl:"/tendermint.types.Validator",encode:(t,e=r.create())=>(0!==t.address.length&&e.uint32(10).bytes(t.address),void 0!==t.pubKey&&o.encode(t.pubKey,e.uint32(18).fork()).ldelim(),t.votingPower!==BigInt(0)&&e.uint32(24).int64(t.votingPower),t.proposerPriority!==BigInt(0)&&e.uint32(32).int64(t.proposerPriority),e),decode(r,e){const i=r instanceof t?r:new t(r);let n=void 0===e?i.len:i.pos+e;const a=d();for(;i.pos<n;){const t=i.uint32();switch(t>>>3){case 1:a.address=i.bytes();break;case 2:a.pubKey=o.decode(i,i.uint32());break;case 3:a.votingPower=i.int64();break;case 4:a.proposerPriority=i.int64();break;default:i.skipType(7&t)}}return a},fromJSON:t=>({address:e(t.address)?i(t.address):new Uint8Array,pubKey:e(t.pubKey)?o.fromJSON(t.pubKey):void 0,votingPower:e(t.votingPower)?BigInt(t.votingPower.toString()):BigInt(0),proposerPriority:e(t.proposerPriority)?BigInt(t.proposerPriority.toString()):BigInt(0)}),toJSON(t){const r={};return void 0!==t.address&&(r.address=n(void 0!==t.address?t.address:new Uint8Array)),void 0!==t.pubKey&&(r.pubKey=t.pubKey?o.toJSON(t.pubKey):void 0),void 0!==t.votingPower&&(r.votingPower=(t.votingPower||BigInt(0)).toString()),void 0!==t.proposerPriority&&(r.proposerPriority=(t.proposerPriority||BigInt(0)).toString()),r},fromPartial(t){const r=d();return r.address=t.address??new Uint8Array,r.pubKey=void 0!==t.pubKey&&null!==t.pubKey?o.fromPartial(t.pubKey):void 0,r.votingPower=void 0!==t.votingPower&&null!==t.votingPower?BigInt(t.votingPower.toString()):BigInt(0),r.proposerPriority=void 0!==t.proposerPriority&&null!==t.proposerPriority?BigInt(t.proposerPriority.toString()):BigInt(0),r},fromProtoMsg:o=>Validator.decode(o.value),toProto:o=>Validator.encode(o).finish(),toProtoMsg:o=>({typeUrl:"/tendermint.types.Validator",value:Validator.encode(o).finish()})};function s(){return{pubKey:void 0,votingPower:BigInt(0)}}export const SimpleValidator={typeUrl:"/tendermint.types.SimpleValidator",encode:(t,e=r.create())=>(void 0!==t.pubKey&&o.encode(t.pubKey,e.uint32(10).fork()).ldelim(),t.votingPower!==BigInt(0)&&e.uint32(16).int64(t.votingPower),e),decode(r,e){const i=r instanceof t?r:new t(r);let n=void 0===e?i.len:i.pos+e;const a=s();for(;i.pos<n;){const t=i.uint32();switch(t>>>3){case 1:a.pubKey=o.decode(i,i.uint32());break;case 2:a.votingPower=i.int64();break;default:i.skipType(7&t)}}return a},fromJSON:t=>({pubKey:e(t.pubKey)?o.fromJSON(t.pubKey):void 0,votingPower:e(t.votingPower)?BigInt(t.votingPower.toString()):BigInt(0)}),toJSON(t){const r={};return void 0!==t.pubKey&&(r.pubKey=t.pubKey?o.toJSON(t.pubKey):void 0),void 0!==t.votingPower&&(r.votingPower=(t.votingPower||BigInt(0)).toString()),r},fromPartial(t){const r=s();return r.pubKey=void 0!==t.pubKey&&null!==t.pubKey?o.fromPartial(t.pubKey):void 0,r.votingPower=void 0!==t.votingPower&&null!==t.votingPower?BigInt(t.votingPower.toString()):BigInt(0),r},fromProtoMsg:o=>SimpleValidator.decode(o.value),toProto:o=>SimpleValidator.encode(o).finish(),toProtoMsg:o=>({typeUrl:"/tendermint.types.SimpleValidator",value:SimpleValidator.encode(o).finish()})};
|
|
@@ -1,155 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { BinaryReader, BinaryWriter } from '../../binary.js';
|
|
3
|
-
import { isSet } from '../../helpers.js';
|
|
4
|
-
import {} from '../../json-safe.js';
|
|
5
|
-
function createBaseApp() {
|
|
6
|
-
return {
|
|
7
|
-
protocol: BigInt(0),
|
|
8
|
-
software: '',
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export const App = {
|
|
12
|
-
typeUrl: '/tendermint.version.App',
|
|
13
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
14
|
-
if (message.protocol !== BigInt(0)) {
|
|
15
|
-
writer.uint32(8).uint64(message.protocol);
|
|
16
|
-
}
|
|
17
|
-
if (message.software !== '') {
|
|
18
|
-
writer.uint32(18).string(message.software);
|
|
19
|
-
}
|
|
20
|
-
return writer;
|
|
21
|
-
},
|
|
22
|
-
decode(input, length) {
|
|
23
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
24
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
25
|
-
const message = createBaseApp();
|
|
26
|
-
while (reader.pos < end) {
|
|
27
|
-
const tag = reader.uint32();
|
|
28
|
-
switch (tag >>> 3) {
|
|
29
|
-
case 1:
|
|
30
|
-
message.protocol = reader.uint64();
|
|
31
|
-
break;
|
|
32
|
-
case 2:
|
|
33
|
-
message.software = reader.string();
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
reader.skipType(tag & 7);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return message;
|
|
41
|
-
},
|
|
42
|
-
fromJSON(object) {
|
|
43
|
-
return {
|
|
44
|
-
protocol: isSet(object.protocol)
|
|
45
|
-
? BigInt(object.protocol.toString())
|
|
46
|
-
: BigInt(0),
|
|
47
|
-
software: isSet(object.software) ? String(object.software) : '',
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
toJSON(message) {
|
|
51
|
-
const obj = {};
|
|
52
|
-
message.protocol !== undefined &&
|
|
53
|
-
(obj.protocol = (message.protocol || BigInt(0)).toString());
|
|
54
|
-
message.software !== undefined && (obj.software = message.software);
|
|
55
|
-
return obj;
|
|
56
|
-
},
|
|
57
|
-
fromPartial(object) {
|
|
58
|
-
const message = createBaseApp();
|
|
59
|
-
message.protocol =
|
|
60
|
-
object.protocol !== undefined && object.protocol !== null
|
|
61
|
-
? BigInt(object.protocol.toString())
|
|
62
|
-
: BigInt(0);
|
|
63
|
-
message.software = object.software ?? '';
|
|
64
|
-
return message;
|
|
65
|
-
},
|
|
66
|
-
fromProtoMsg(message) {
|
|
67
|
-
return App.decode(message.value);
|
|
68
|
-
},
|
|
69
|
-
toProto(message) {
|
|
70
|
-
return App.encode(message).finish();
|
|
71
|
-
},
|
|
72
|
-
toProtoMsg(message) {
|
|
73
|
-
return {
|
|
74
|
-
typeUrl: '/tendermint.version.App',
|
|
75
|
-
value: App.encode(message).finish(),
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
function createBaseConsensus() {
|
|
80
|
-
return {
|
|
81
|
-
block: BigInt(0),
|
|
82
|
-
app: BigInt(0),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
export const Consensus = {
|
|
86
|
-
typeUrl: '/tendermint.version.Consensus',
|
|
87
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
88
|
-
if (message.block !== BigInt(0)) {
|
|
89
|
-
writer.uint32(8).uint64(message.block);
|
|
90
|
-
}
|
|
91
|
-
if (message.app !== BigInt(0)) {
|
|
92
|
-
writer.uint32(16).uint64(message.app);
|
|
93
|
-
}
|
|
94
|
-
return writer;
|
|
95
|
-
},
|
|
96
|
-
decode(input, length) {
|
|
97
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
98
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
99
|
-
const message = createBaseConsensus();
|
|
100
|
-
while (reader.pos < end) {
|
|
101
|
-
const tag = reader.uint32();
|
|
102
|
-
switch (tag >>> 3) {
|
|
103
|
-
case 1:
|
|
104
|
-
message.block = reader.uint64();
|
|
105
|
-
break;
|
|
106
|
-
case 2:
|
|
107
|
-
message.app = reader.uint64();
|
|
108
|
-
break;
|
|
109
|
-
default:
|
|
110
|
-
reader.skipType(tag & 7);
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return message;
|
|
115
|
-
},
|
|
116
|
-
fromJSON(object) {
|
|
117
|
-
return {
|
|
118
|
-
block: isSet(object.block) ? BigInt(object.block.toString()) : BigInt(0),
|
|
119
|
-
app: isSet(object.app) ? BigInt(object.app.toString()) : BigInt(0),
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
toJSON(message) {
|
|
123
|
-
const obj = {};
|
|
124
|
-
message.block !== undefined &&
|
|
125
|
-
(obj.block = (message.block || BigInt(0)).toString());
|
|
126
|
-
message.app !== undefined &&
|
|
127
|
-
(obj.app = (message.app || BigInt(0)).toString());
|
|
128
|
-
return obj;
|
|
129
|
-
},
|
|
130
|
-
fromPartial(object) {
|
|
131
|
-
const message = createBaseConsensus();
|
|
132
|
-
message.block =
|
|
133
|
-
object.block !== undefined && object.block !== null
|
|
134
|
-
? BigInt(object.block.toString())
|
|
135
|
-
: BigInt(0);
|
|
136
|
-
message.app =
|
|
137
|
-
object.app !== undefined && object.app !== null
|
|
138
|
-
? BigInt(object.app.toString())
|
|
139
|
-
: BigInt(0);
|
|
140
|
-
return message;
|
|
141
|
-
},
|
|
142
|
-
fromProtoMsg(message) {
|
|
143
|
-
return Consensus.decode(message.value);
|
|
144
|
-
},
|
|
145
|
-
toProto(message) {
|
|
146
|
-
return Consensus.encode(message).finish();
|
|
147
|
-
},
|
|
148
|
-
toProtoMsg(message) {
|
|
149
|
-
return {
|
|
150
|
-
typeUrl: '/tendermint.version.Consensus',
|
|
151
|
-
value: Consensus.encode(message).finish(),
|
|
152
|
-
};
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
import{BinaryReader as o,BinaryWriter as t}from"../../binary.js";import{isSet as n}from"../../helpers.js";import{}from"../../json-safe.js";function r(){return{protocol:BigInt(0),software:""}}export const App={typeUrl:"/tendermint.version.App",encode:(o,n=t.create())=>(o.protocol!==BigInt(0)&&n.uint32(8).uint64(o.protocol),""!==o.software&&n.uint32(18).string(o.software),n),decode(t,n){const e=t instanceof o?t:new o(t);let i=void 0===n?e.len:e.pos+n;const s=r();for(;e.pos<i;){const o=e.uint32();switch(o>>>3){case 1:s.protocol=e.uint64();break;case 2:s.software=e.string();break;default:e.skipType(7&o)}}return s},fromJSON:o=>({protocol:n(o.protocol)?BigInt(o.protocol.toString()):BigInt(0),software:n(o.software)?String(o.software):""}),toJSON(o){const t={};return void 0!==o.protocol&&(t.protocol=(o.protocol||BigInt(0)).toString()),void 0!==o.software&&(t.software=o.software),t},fromPartial(o){const t=r();return t.protocol=void 0!==o.protocol&&null!==o.protocol?BigInt(o.protocol.toString()):BigInt(0),t.software=o.software??"",t},fromProtoMsg:o=>App.decode(o.value),toProto:o=>App.encode(o).finish(),toProtoMsg:o=>({typeUrl:"/tendermint.version.App",value:App.encode(o).finish()})};function e(){return{block:BigInt(0),app:BigInt(0)}}export const Consensus={typeUrl:"/tendermint.version.Consensus",encode:(o,n=t.create())=>(o.block!==BigInt(0)&&n.uint32(8).uint64(o.block),o.app!==BigInt(0)&&n.uint32(16).uint64(o.app),n),decode(t,n){const r=t instanceof o?t:new o(t);let i=void 0===n?r.len:r.pos+n;const s=e();for(;r.pos<i;){const o=r.uint32();switch(o>>>3){case 1:s.block=r.uint64();break;case 2:s.app=r.uint64();break;default:r.skipType(7&o)}}return s},fromJSON:o=>({block:n(o.block)?BigInt(o.block.toString()):BigInt(0),app:n(o.app)?BigInt(o.app.toString()):BigInt(0)}),toJSON(o){const t={};return void 0!==o.block&&(t.block=(o.block||BigInt(0)).toString()),void 0!==o.app&&(t.app=(o.app||BigInt(0)).toString()),t},fromPartial(o){const t=e();return t.block=void 0!==o.block&&null!==o.block?BigInt(o.block.toString()):BigInt(0),t.app=void 0!==o.app&&null!==o.app?BigInt(o.app.toString()):BigInt(0),t},fromProtoMsg:o=>Consensus.decode(o.value),toProto:o=>Consensus.encode(o).finish(),toProtoMsg:o=>({typeUrl:"/tendermint.version.Consensus",value:Consensus.encode(o).finish()})};
|
package/dist/codegen/utf8.js
CHANGED
|
@@ -1,138 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3
|
|
4
|
-
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
|
5
|
-
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
|
|
6
|
-
*/
|
|
7
|
-
// Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
|
8
|
-
// Redistribution and use in source and binary forms, with or without
|
|
9
|
-
// modification, are permitted provided that the following conditions are
|
|
10
|
-
// met:
|
|
11
|
-
// * Redistributions of source code must retain the above copyright
|
|
12
|
-
// notice, this list of conditions and the following disclaimer.
|
|
13
|
-
// * Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
// notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
// documentation and/or other materials provided with the distribution.
|
|
16
|
-
// * Neither the name of its author, nor the names of its contributors
|
|
17
|
-
// may be used to endorse or promote products derived from this software
|
|
18
|
-
// without specific prior written permission.
|
|
19
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
'use strict';
|
|
31
|
-
/**
|
|
32
|
-
* Calculates the UTF8 byte length of a string.
|
|
33
|
-
* @param {string} string String
|
|
34
|
-
* @returns {number} Byte length
|
|
35
|
-
*/
|
|
36
|
-
export function utf8Length(str) {
|
|
37
|
-
let len = 0, c = 0;
|
|
38
|
-
for (let i = 0; i < str.length; ++i) {
|
|
39
|
-
c = str.charCodeAt(i);
|
|
40
|
-
if (c < 128)
|
|
41
|
-
len += 1;
|
|
42
|
-
else if (c < 2048)
|
|
43
|
-
len += 2;
|
|
44
|
-
else if ((c & 0xfc00) === 0xd800 &&
|
|
45
|
-
(str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
|
46
|
-
++i;
|
|
47
|
-
len += 4;
|
|
48
|
-
}
|
|
49
|
-
else
|
|
50
|
-
len += 3;
|
|
51
|
-
}
|
|
52
|
-
return len;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Reads UTF8 bytes as a string.
|
|
56
|
-
* @param {Uint8Array} buffer Source buffer
|
|
57
|
-
* @param {number} start Source start
|
|
58
|
-
* @param {number} end Source end
|
|
59
|
-
* @returns {string} String read
|
|
60
|
-
*/
|
|
61
|
-
export function utf8Read(buffer, start, end) {
|
|
62
|
-
const len = end - start;
|
|
63
|
-
if (len < 1)
|
|
64
|
-
return '';
|
|
65
|
-
const chunk = [];
|
|
66
|
-
let parts = [], i = 0, // char offset
|
|
67
|
-
t; // temporary
|
|
68
|
-
while (start < end) {
|
|
69
|
-
t = buffer[start++];
|
|
70
|
-
if (t < 128)
|
|
71
|
-
chunk[i++] = t;
|
|
72
|
-
else if (t > 191 && t < 224)
|
|
73
|
-
chunk[i++] = ((t & 31) << 6) | (buffer[start++] & 63);
|
|
74
|
-
else if (t > 239 && t < 365) {
|
|
75
|
-
t =
|
|
76
|
-
(((t & 7) << 18) |
|
|
77
|
-
((buffer[start++] & 63) << 12) |
|
|
78
|
-
((buffer[start++] & 63) << 6) |
|
|
79
|
-
(buffer[start++] & 63)) -
|
|
80
|
-
0x10000;
|
|
81
|
-
chunk[i++] = 0xd800 + (t >> 10);
|
|
82
|
-
chunk[i++] = 0xdc00 + (t & 1023);
|
|
83
|
-
}
|
|
84
|
-
else
|
|
85
|
-
chunk[i++] =
|
|
86
|
-
((t & 15) << 12) |
|
|
87
|
-
((buffer[start++] & 63) << 6) |
|
|
88
|
-
(buffer[start++] & 63);
|
|
89
|
-
if (i > 8191) {
|
|
90
|
-
(parts || (parts = [])).push(String.fromCharCode(...chunk));
|
|
91
|
-
i = 0;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (parts) {
|
|
95
|
-
if (i)
|
|
96
|
-
parts.push(String.fromCharCode(...chunk.slice(0, i)));
|
|
97
|
-
return parts.join('');
|
|
98
|
-
}
|
|
99
|
-
return String.fromCharCode(...chunk.slice(0, i));
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Writes a string as UTF8 bytes.
|
|
103
|
-
* @param {string} string Source string
|
|
104
|
-
* @param {Uint8Array} buffer Destination buffer
|
|
105
|
-
* @param {number} offset Destination offset
|
|
106
|
-
* @returns {number} Bytes written
|
|
107
|
-
*/
|
|
108
|
-
export function utf8Write(str, buffer, offset) {
|
|
109
|
-
const start = offset;
|
|
110
|
-
let c1, // character 1
|
|
111
|
-
c2; // character 2
|
|
112
|
-
for (let i = 0; i < str.length; ++i) {
|
|
113
|
-
c1 = str.charCodeAt(i);
|
|
114
|
-
if (c1 < 128) {
|
|
115
|
-
buffer[offset++] = c1;
|
|
116
|
-
}
|
|
117
|
-
else if (c1 < 2048) {
|
|
118
|
-
buffer[offset++] = (c1 >> 6) | 192;
|
|
119
|
-
buffer[offset++] = (c1 & 63) | 128;
|
|
120
|
-
}
|
|
121
|
-
else if ((c1 & 0xfc00) === 0xd800 &&
|
|
122
|
-
((c2 = str.charCodeAt(i + 1)) & 0xfc00) === 0xdc00) {
|
|
123
|
-
c1 = 0x10000 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff);
|
|
124
|
-
++i;
|
|
125
|
-
buffer[offset++] = (c1 >> 18) | 240;
|
|
126
|
-
buffer[offset++] = ((c1 >> 12) & 63) | 128;
|
|
127
|
-
buffer[offset++] = ((c1 >> 6) & 63) | 128;
|
|
128
|
-
buffer[offset++] = (c1 & 63) | 128;
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
buffer[offset++] = (c1 >> 12) | 224;
|
|
132
|
-
buffer[offset++] = ((c1 >> 6) & 63) | 128;
|
|
133
|
-
buffer[offset++] = (c1 & 63) | 128;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return offset - start;
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=utf8.js.map
|
|
1
|
+
export function utf8Length(t){let r=0,e=0;for(let o=0;o<t.length;++o)e=t.charCodeAt(o),e<128?r+=1:e<2048?r+=2:55296==(64512&e)&&56320==(64512&t.charCodeAt(o+1))?(++o,r+=4):r+=3;return r}export function utf8Read(t,r,e){if(e-r<1)return"";const o=[];let n,f=[],h=0;for(;r<e;)n=t[r++],n<128?o[h++]=n:n>191&&n<224?o[h++]=(31&n)<<6|63&t[r++]:n>239&&n<365?(n=((7&n)<<18|(63&t[r++])<<12|(63&t[r++])<<6|63&t[r++])-65536,o[h++]=55296+(n>>10),o[h++]=56320+(1023&n)):o[h++]=(15&n)<<12|(63&t[r++])<<6|63&t[r++],h>8191&&((f||(f=[])).push(String.fromCharCode(...o)),h=0);return f?(h&&f.push(String.fromCharCode(...o.slice(0,h))),f.join("")):String.fromCharCode(...o.slice(0,h))}export function utf8Write(t,r,e){const o=e;let n,f;for(let o=0;o<t.length;++o)n=t.charCodeAt(o),n<128?r[e++]=n:n<2048?(r[e++]=n>>6|192,r[e++]=63&n|128):55296==(64512&n)&&56320==(64512&(f=t.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&f),++o,r[e++]=n>>18|240,r[e++]=n>>12&63|128,r[e++]=n>>6&63|128,r[e++]=63&n|128):(r[e++]=n>>12|224,r[e++]=n>>6&63|128,r[e++]=63&n|128);return e-o}
|