@agoric/cosmic-proto 0.5.0-u19.1 → 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
package/dist/codegen/binary.js
CHANGED
|
@@ -1,367 +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
|
-
// ---
|
|
31
|
-
// Code generated by the command line utilities is owned by the owner
|
|
32
|
-
// of the input file used when generating it. This code is not
|
|
33
|
-
// standalone and requires a support library to be linked with it. This
|
|
34
|
-
// support library is itself covered by the above license.
|
|
35
|
-
import { utf8Length, utf8Read, utf8Write } from './utf8.js';
|
|
36
|
-
import { int64ToString, readInt32, readUInt32, uInt64ToString, varint32read, varint64read, writeVarint32, writeVarint64, int64FromString, int64Length, writeFixed32, writeByte, zzDecode, zzEncode, } from './varint.js';
|
|
37
|
-
export var WireType;
|
|
38
|
-
(function (WireType) {
|
|
39
|
-
WireType[WireType["Varint"] = 0] = "Varint";
|
|
40
|
-
WireType[WireType["Fixed64"] = 1] = "Fixed64";
|
|
41
|
-
WireType[WireType["Bytes"] = 2] = "Bytes";
|
|
42
|
-
WireType[WireType["Fixed32"] = 5] = "Fixed32";
|
|
43
|
-
})(WireType || (WireType = {}));
|
|
44
|
-
export class BinaryReader {
|
|
45
|
-
buf;
|
|
46
|
-
pos;
|
|
47
|
-
type;
|
|
48
|
-
len;
|
|
49
|
-
assertBounds() {
|
|
50
|
-
if (this.pos > this.len)
|
|
51
|
-
throw new RangeError('premature EOF');
|
|
52
|
-
}
|
|
53
|
-
constructor(buf) {
|
|
54
|
-
this.buf = buf ? new Uint8Array(buf) : new Uint8Array(0);
|
|
55
|
-
this.pos = 0;
|
|
56
|
-
this.type = 0;
|
|
57
|
-
this.len = this.buf.length;
|
|
58
|
-
}
|
|
59
|
-
tag() {
|
|
60
|
-
const tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;
|
|
61
|
-
if (fieldNo <= 0 || wireType < 0 || wireType > 5)
|
|
62
|
-
throw new Error('illegal tag: field no ' + fieldNo + ' wire type ' + wireType);
|
|
63
|
-
return [fieldNo, wireType, tag];
|
|
64
|
-
}
|
|
65
|
-
skip(length) {
|
|
66
|
-
if (typeof length === 'number') {
|
|
67
|
-
if (this.pos + length > this.len)
|
|
68
|
-
throw indexOutOfRange(this, length);
|
|
69
|
-
this.pos += length;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
do {
|
|
73
|
-
if (this.pos >= this.len)
|
|
74
|
-
throw indexOutOfRange(this);
|
|
75
|
-
} while (this.buf[this.pos++] & 128);
|
|
76
|
-
}
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
skipType(wireType) {
|
|
80
|
-
switch (wireType) {
|
|
81
|
-
case WireType.Varint:
|
|
82
|
-
this.skip();
|
|
83
|
-
break;
|
|
84
|
-
case WireType.Fixed64:
|
|
85
|
-
this.skip(8);
|
|
86
|
-
break;
|
|
87
|
-
case WireType.Bytes:
|
|
88
|
-
this.skip(this.uint32());
|
|
89
|
-
break;
|
|
90
|
-
case 3:
|
|
91
|
-
while ((wireType = this.uint32() & 7) !== 4) {
|
|
92
|
-
this.skipType(wireType);
|
|
93
|
-
}
|
|
94
|
-
break;
|
|
95
|
-
case WireType.Fixed32:
|
|
96
|
-
this.skip(4);
|
|
97
|
-
break;
|
|
98
|
-
/* istanbul ignore next */
|
|
99
|
-
default:
|
|
100
|
-
throw Error('invalid wire type ' + wireType + ' at offset ' + this.pos);
|
|
101
|
-
}
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
uint32() {
|
|
105
|
-
return varint32read.bind(this)();
|
|
106
|
-
}
|
|
107
|
-
int32() {
|
|
108
|
-
return this.uint32() | 0;
|
|
109
|
-
}
|
|
110
|
-
sint32() {
|
|
111
|
-
const num = this.uint32();
|
|
112
|
-
return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
|
|
113
|
-
}
|
|
114
|
-
fixed32() {
|
|
115
|
-
const val = readUInt32(this.buf, this.pos);
|
|
116
|
-
this.pos += 4;
|
|
117
|
-
return val;
|
|
118
|
-
}
|
|
119
|
-
sfixed32() {
|
|
120
|
-
const val = readInt32(this.buf, this.pos);
|
|
121
|
-
this.pos += 4;
|
|
122
|
-
return val;
|
|
123
|
-
}
|
|
124
|
-
int64() {
|
|
125
|
-
const [lo, hi] = varint64read.bind(this)();
|
|
126
|
-
return BigInt(int64ToString(lo, hi));
|
|
127
|
-
}
|
|
128
|
-
uint64() {
|
|
129
|
-
const [lo, hi] = varint64read.bind(this)();
|
|
130
|
-
return BigInt(uInt64ToString(lo, hi));
|
|
131
|
-
}
|
|
132
|
-
sint64() {
|
|
133
|
-
let [lo, hi] = varint64read.bind(this)();
|
|
134
|
-
// zig zag
|
|
135
|
-
[lo, hi] = zzDecode(lo, hi);
|
|
136
|
-
return BigInt(int64ToString(lo, hi));
|
|
137
|
-
}
|
|
138
|
-
fixed64() {
|
|
139
|
-
const lo = this.sfixed32();
|
|
140
|
-
const hi = this.sfixed32();
|
|
141
|
-
return BigInt(uInt64ToString(lo, hi));
|
|
142
|
-
}
|
|
143
|
-
sfixed64() {
|
|
144
|
-
const lo = this.sfixed32();
|
|
145
|
-
const hi = this.sfixed32();
|
|
146
|
-
return BigInt(int64ToString(lo, hi));
|
|
147
|
-
}
|
|
148
|
-
float() {
|
|
149
|
-
throw new Error('float not supported');
|
|
150
|
-
}
|
|
151
|
-
double() {
|
|
152
|
-
throw new Error('double not supported');
|
|
153
|
-
}
|
|
154
|
-
bool() {
|
|
155
|
-
const [lo, hi] = varint64read.bind(this)();
|
|
156
|
-
return lo !== 0 || hi !== 0;
|
|
157
|
-
}
|
|
158
|
-
bytes() {
|
|
159
|
-
const len = this.uint32(), start = this.pos;
|
|
160
|
-
this.pos += len;
|
|
161
|
-
this.assertBounds();
|
|
162
|
-
return this.buf.subarray(start, start + len);
|
|
163
|
-
}
|
|
164
|
-
string() {
|
|
165
|
-
const bytes = this.bytes();
|
|
166
|
-
return utf8Read(bytes, 0, bytes.length);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
class Op {
|
|
170
|
-
fn;
|
|
171
|
-
len;
|
|
172
|
-
val;
|
|
173
|
-
next;
|
|
174
|
-
constructor(fn, len, val) {
|
|
175
|
-
this.fn = fn;
|
|
176
|
-
this.len = len;
|
|
177
|
-
this.val = val;
|
|
178
|
-
}
|
|
179
|
-
proceed(buf, pos) {
|
|
180
|
-
if (this.fn) {
|
|
181
|
-
this.fn(this.val, buf, pos);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
class State {
|
|
186
|
-
head;
|
|
187
|
-
tail;
|
|
188
|
-
len;
|
|
189
|
-
next;
|
|
190
|
-
constructor(writer) {
|
|
191
|
-
this.head = writer.head;
|
|
192
|
-
this.tail = writer.tail;
|
|
193
|
-
this.len = writer.len;
|
|
194
|
-
this.next = writer.states;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
export class BinaryWriter {
|
|
198
|
-
len = 0;
|
|
199
|
-
head;
|
|
200
|
-
tail;
|
|
201
|
-
states;
|
|
202
|
-
constructor() {
|
|
203
|
-
this.head = new Op(null, 0, 0);
|
|
204
|
-
this.tail = this.head;
|
|
205
|
-
this.states = null;
|
|
206
|
-
}
|
|
207
|
-
static create() {
|
|
208
|
-
return new BinaryWriter();
|
|
209
|
-
}
|
|
210
|
-
static alloc(size) {
|
|
211
|
-
if (typeof Uint8Array !== 'undefined') {
|
|
212
|
-
return pool(size => new Uint8Array(size), Uint8Array.prototype.subarray)(size);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
return new Array(size);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
_push(fn, len, val) {
|
|
219
|
-
this.tail = this.tail.next = new Op(fn, len, val);
|
|
220
|
-
this.len += len;
|
|
221
|
-
return this;
|
|
222
|
-
}
|
|
223
|
-
finish() {
|
|
224
|
-
let head = this.head.next, pos = 0;
|
|
225
|
-
const buf = BinaryWriter.alloc(this.len);
|
|
226
|
-
while (head) {
|
|
227
|
-
head.proceed(buf, pos);
|
|
228
|
-
pos += head.len;
|
|
229
|
-
head = head.next;
|
|
230
|
-
}
|
|
231
|
-
return buf;
|
|
232
|
-
}
|
|
233
|
-
fork() {
|
|
234
|
-
this.states = new State(this);
|
|
235
|
-
this.head = this.tail = new Op(null, 0, 0);
|
|
236
|
-
this.len = 0;
|
|
237
|
-
return this;
|
|
238
|
-
}
|
|
239
|
-
reset() {
|
|
240
|
-
if (this.states) {
|
|
241
|
-
this.head = this.states.head;
|
|
242
|
-
this.tail = this.states.tail;
|
|
243
|
-
this.len = this.states.len;
|
|
244
|
-
this.states = this.states.next;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
this.head = this.tail = new Op(null, 0, 0);
|
|
248
|
-
this.len = 0;
|
|
249
|
-
}
|
|
250
|
-
return this;
|
|
251
|
-
}
|
|
252
|
-
ldelim() {
|
|
253
|
-
const head = this.head, tail = this.tail, len = this.len;
|
|
254
|
-
this.reset().uint32(len);
|
|
255
|
-
if (len) {
|
|
256
|
-
this.tail.next = head.next; // skip noop
|
|
257
|
-
this.tail = tail;
|
|
258
|
-
this.len += len;
|
|
259
|
-
}
|
|
260
|
-
return this;
|
|
261
|
-
}
|
|
262
|
-
tag(fieldNo, type) {
|
|
263
|
-
return this.uint32(((fieldNo << 3) | type) >>> 0);
|
|
264
|
-
}
|
|
265
|
-
uint32(value) {
|
|
266
|
-
this.len += (this.tail = this.tail.next =
|
|
267
|
-
new Op(writeVarint32, (value = value >>> 0) < 128
|
|
268
|
-
? 1
|
|
269
|
-
: value < 16384
|
|
270
|
-
? 2
|
|
271
|
-
: value < 2097152
|
|
272
|
-
? 3
|
|
273
|
-
: value < 268435456
|
|
274
|
-
? 4
|
|
275
|
-
: 5, value)).len;
|
|
276
|
-
return this;
|
|
277
|
-
}
|
|
278
|
-
int32(value) {
|
|
279
|
-
return value < 0
|
|
280
|
-
? this._push(writeVarint64, 10, int64FromString(value.toString())) // 10 bytes per spec
|
|
281
|
-
: this.uint32(value);
|
|
282
|
-
}
|
|
283
|
-
sint32(value) {
|
|
284
|
-
return this.uint32(((value << 1) ^ (value >> 31)) >>> 0);
|
|
285
|
-
}
|
|
286
|
-
int64(value) {
|
|
287
|
-
const { lo, hi } = int64FromString(value.toString());
|
|
288
|
-
return this._push(writeVarint64, int64Length(lo, hi), { lo, hi });
|
|
289
|
-
}
|
|
290
|
-
// uint64 is the same with int64
|
|
291
|
-
uint64 = BinaryWriter.prototype.int64;
|
|
292
|
-
sint64(value) {
|
|
293
|
-
let { lo, hi } = int64FromString(value.toString());
|
|
294
|
-
// zig zag
|
|
295
|
-
[lo, hi] = zzEncode(lo, hi);
|
|
296
|
-
return this._push(writeVarint64, int64Length(lo, hi), { lo, hi });
|
|
297
|
-
}
|
|
298
|
-
fixed64(value) {
|
|
299
|
-
const { lo, hi } = int64FromString(value.toString());
|
|
300
|
-
return this._push(writeFixed32, 4, lo)._push(writeFixed32, 4, hi);
|
|
301
|
-
}
|
|
302
|
-
// sfixed64 is the same with fixed64
|
|
303
|
-
sfixed64 = BinaryWriter.prototype.fixed64;
|
|
304
|
-
bool(value) {
|
|
305
|
-
return this._push(writeByte, 1, value ? 1 : 0);
|
|
306
|
-
}
|
|
307
|
-
fixed32(value) {
|
|
308
|
-
return this._push(writeFixed32, 4, value >>> 0);
|
|
309
|
-
}
|
|
310
|
-
// sfixed32 is the same with fixed32
|
|
311
|
-
sfixed32 = BinaryWriter.prototype.fixed32;
|
|
312
|
-
float(value) {
|
|
313
|
-
throw new Error('float not supported' + value);
|
|
314
|
-
}
|
|
315
|
-
double(value) {
|
|
316
|
-
throw new Error('double not supported' + value);
|
|
317
|
-
}
|
|
318
|
-
bytes(value) {
|
|
319
|
-
const len = value.length >>> 0;
|
|
320
|
-
if (!len)
|
|
321
|
-
return this._push(writeByte, 1, 0);
|
|
322
|
-
return this.uint32(len)._push(writeBytes, len, value);
|
|
323
|
-
}
|
|
324
|
-
string(value) {
|
|
325
|
-
const len = utf8Length(value);
|
|
326
|
-
return len
|
|
327
|
-
? this.uint32(len)._push(utf8Write, len, value)
|
|
328
|
-
: this._push(writeByte, 1, 0);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
function writeBytes(val, buf, pos) {
|
|
332
|
-
if (typeof Uint8Array !== 'undefined') {
|
|
333
|
-
buf.set(val, pos);
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
for (let i = 0; i < val.length; ++i)
|
|
337
|
-
buf[pos + i] = val[i];
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function pool(alloc, slice, size) {
|
|
341
|
-
const SIZE = size || 8192;
|
|
342
|
-
const MAX = SIZE >>> 1;
|
|
343
|
-
let slab = null;
|
|
344
|
-
let offset = SIZE;
|
|
345
|
-
return function pool_alloc(size) {
|
|
346
|
-
if (size < 1 || size > MAX)
|
|
347
|
-
return alloc(size);
|
|
348
|
-
if (offset + size > SIZE) {
|
|
349
|
-
slab = alloc(SIZE);
|
|
350
|
-
offset = 0;
|
|
351
|
-
}
|
|
352
|
-
const buf = slice.call(slab, offset, (offset += size));
|
|
353
|
-
if (offset & 7)
|
|
354
|
-
// align to 32 bit
|
|
355
|
-
offset = (offset | 7) + 1;
|
|
356
|
-
return buf;
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
function indexOutOfRange(reader, writeLength) {
|
|
360
|
-
return RangeError('index out of range: ' +
|
|
361
|
-
reader.pos +
|
|
362
|
-
' + ' +
|
|
363
|
-
(writeLength || 1) +
|
|
364
|
-
' > ' +
|
|
365
|
-
reader.len);
|
|
366
|
-
}
|
|
367
|
-
//# sourceMappingURL=binary.js.map
|
|
1
|
+
import{utf8Length as t,utf8Read as i,utf8Write as s}from"./utf8.js";import{int64ToString as e,readInt32 as n,readUInt32 as r,uInt64ToString as h,varint32read as o,varint64read as u,writeVarint32 as a,writeVarint64 as l,int64FromString as p,int64Length as d,writeFixed32 as f,writeByte as c,zzDecode as y,zzEncode as x}from"./varint.js";export var WireType;!function(t){t[t.Varint=0]="Varint",t[t.Fixed64=1]="Fixed64",t[t.Bytes=2]="Bytes",t[t.Fixed32=5]="Fixed32"}(WireType||(WireType={}));export class BinaryReader{buf;pos;type;len;assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}constructor(t){this.buf=t?new Uint8Array(t):new Uint8Array(0),this.pos=0,this.type=0,this.len=this.buf.length}tag(){const t=this.uint32(),i=t>>>3,s=7&t;if(i<=0||s<0||s>5)throw new Error("illegal tag: field no "+i+" wire type "+s);return[i,s,t]}skip(t){if("number"==typeof t){if(this.pos+t>this.len)throw B(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw B(this)}while(128&this.buf[this.pos++]);return this}skipType(t){switch(t){case WireType.Varint:this.skip();break;case WireType.Fixed64:this.skip(8);break;case WireType.Bytes:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case WireType.Fixed32:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this}uint32(){return o.bind(this)()}int32(){return 0|this.uint32()}sint32(){const t=this.uint32();return t%2==1?(t+1)/-2:t/2}fixed32(){const t=r(this.buf,this.pos);return this.pos+=4,t}sfixed32(){const t=n(this.buf,this.pos);return this.pos+=4,t}int64(){const[t,i]=u.bind(this)();return BigInt(e(t,i))}uint64(){const[t,i]=u.bind(this)();return BigInt(h(t,i))}sint64(){let[t,i]=u.bind(this)();return[t,i]=y(t,i),BigInt(e(t,i))}fixed64(){const t=this.sfixed32(),i=this.sfixed32();return BigInt(h(t,i))}sfixed64(){const t=this.sfixed32(),i=this.sfixed32();return BigInt(e(t,i))}float(){throw new Error("float not supported")}double(){throw new Error("double not supported")}bool(){const[t,i]=u.bind(this)();return 0!==t||0!==i}bytes(){const t=this.uint32(),i=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(i,i+t)}string(){const t=this.bytes();return i(t,0,t.length)}}class w{fn;len;val;next;constructor(t,i,s){this.fn=t,this.len=i,this.val=s}proceed(t,i){this.fn&&this.fn(this.val,t,i)}}class b{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}}export class BinaryWriter{len=0;head;tail;states;constructor(){this.head=new w(null,0,0),this.tail=this.head,this.states=null}static create(){return new BinaryWriter}static alloc(t){return"undefined"!=typeof Uint8Array?function(t,i,s){const e=s||8192,n=e>>>1;let r=null,h=e;return function(s){if(s<1||s>n)return t(s);h+s>e&&(r=t(e),h=0);const o=i.call(r,h,h+=s);return 7&h&&(h=1+(7|h)),o}}((t=>new Uint8Array(t)),Uint8Array.prototype.subarray)(t):new Array(t)}_push(t,i,s){return this.tail=this.tail.next=new w(t,i,s),this.len+=i,this}finish(){let t=this.head.next,i=0;const s=BinaryWriter.alloc(this.len);for(;t;)t.proceed(s,i),i+=t.len,t=t.next;return s}fork(){return this.states=new b(this),this.head=this.tail=new w(null,0,0),this.len=0,this}reset(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new w(null,0,0),this.len=0),this}ldelim(){const t=this.head,i=this.tail,s=this.len;return this.reset().uint32(s),s&&(this.tail.next=t.next,this.tail=i,this.len+=s),this}tag(t,i){return this.uint32((t<<3|i)>>>0)}uint32(t){return this.len+=(this.tail=this.tail.next=new w(a,(t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(l,10,p(t.toString())):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}int64(t){const{lo:i,hi:s}=p(t.toString());return this._push(l,d(i,s),{lo:i,hi:s})}uint64=BinaryWriter.prototype.int64;sint64(t){let{lo:i,hi:s}=p(t.toString());return[i,s]=x(i,s),this._push(l,d(i,s),{lo:i,hi:s})}fixed64(t){const{lo:i,hi:s}=p(t.toString());return this._push(f,4,i)._push(f,4,s)}sfixed64=BinaryWriter.prototype.fixed64;bool(t){return this._push(c,1,t?1:0)}fixed32(t){return this._push(f,4,t>>>0)}sfixed32=BinaryWriter.prototype.fixed32;float(t){throw new Error("float not supported"+t)}double(t){throw new Error("double not supported"+t)}bytes(t){const i=t.length>>>0;return i?this.uint32(i)._push(g,i,t):this._push(c,1,0)}string(i){const e=t(i);return e?this.uint32(e)._push(s,e,i):this._push(c,1,0)}}function g(t,i,s){if("undefined"!=typeof Uint8Array)i.set(t,s);else for(let e=0;e<t.length;++e)i[s+e]=t[e]}function B(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}
|