@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/address-hooks.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ export function decodeBech32(specimen: string, charLimit?: number): {
|
|
|
20
20
|
prefix: string;
|
|
21
21
|
bytes: Uint8Array;
|
|
22
22
|
};
|
|
23
|
-
export function encodeBech32(humanReadablePart: string, bytes: ArrayLike<number>, charLimit?: number):
|
|
24
|
-
export function joinHookedAddress(baseAddress: string, hookData: ArrayLike<number>, charLimit?: number):
|
|
25
|
-
export function encodeAddressHook(baseAddress: string, query: HookQuery, charLimit?: number):
|
|
23
|
+
export function encodeBech32(humanReadablePart: string, bytes: ArrayLike<number>, charLimit?: number): Bech32Address;
|
|
24
|
+
export function joinHookedAddress(baseAddress: string, hookData: ArrayLike<number>, charLimit?: number): Bech32Address;
|
|
25
|
+
export function encodeAddressHook(baseAddress: string, query: HookQuery, charLimit?: number): Bech32Address;
|
|
26
26
|
export function decodeAddressHook(addressHook: string, charLimit?: number): {
|
|
27
27
|
baseAddress: string;
|
|
28
28
|
query: HookQuery;
|
|
@@ -31,6 +31,7 @@ export function splitHookedAddress(specimen: string, charLimit?: number): {
|
|
|
31
31
|
baseAddress: string;
|
|
32
32
|
hookData: Uint8Array;
|
|
33
33
|
};
|
|
34
|
+
export type Bech32Address = `${string}1${string}`;
|
|
34
35
|
/**
|
|
35
36
|
* A
|
|
36
37
|
* record of query keys mapped to query values. `null` values denote valueless
|
package/dist/address-hooks.js
CHANGED
|
@@ -1,217 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* This module provides functions for encoding and decoding address hooks
|
|
3
|
-
* which are comprised of a bech32 base address with an HTTP query string, all
|
|
4
|
-
* wrapped in a bech32 envelope.
|
|
5
|
-
*
|
|
6
|
-
* @module address-hooks.js
|
|
7
|
-
* @example
|
|
8
|
-
*
|
|
9
|
-
* import {
|
|
10
|
-
* encodeAddressHook,
|
|
11
|
-
* decodeAddressHook,
|
|
12
|
-
* } from '@agoric/cosmic-proto/address-hooks.js';
|
|
13
|
-
*
|
|
14
|
-
* const baseAddress = 'agoric1qqp0e5ys';
|
|
15
|
-
* const query = { key: 'value', foo: ['bar', 'baz'] };
|
|
16
|
-
*
|
|
17
|
-
* const addressHook = encodeAddressHook(baseAddress, query);
|
|
18
|
-
* // 'agoric10rchqqplvehk70tzv9ezven0du7kyct6ye4k27faweskcat9qqqstnf2eq'
|
|
19
|
-
*
|
|
20
|
-
* addressHook.startsWith('agoric10rch');
|
|
21
|
-
* // true
|
|
22
|
-
*
|
|
23
|
-
* const decoded = decodeAddressHook(addressHook);
|
|
24
|
-
* // {
|
|
25
|
-
* // baseAddress: 'agoric1qqp0e5ys',
|
|
26
|
-
* // query: { foo: [ 'bar', 'baz' ], key: 'value' }
|
|
27
|
-
* // }
|
|
28
|
-
*/
|
|
29
|
-
/* eslint-disable no-bitwise */
|
|
30
|
-
import { bech32 } from 'bech32';
|
|
31
|
-
import queryString from 'query-string';
|
|
32
|
-
/* global globalThis */
|
|
33
|
-
/** @type {<T>(x: T) => T} */
|
|
34
|
-
const harden = globalThis.harden || Object.freeze;
|
|
35
|
-
// ADDRESS_HOOK_VERSION is the version of the address hook format used in this
|
|
36
|
-
// module.
|
|
37
|
-
const ADDRESS_HOOK_VERSION = 0;
|
|
38
|
-
if ((ADDRESS_HOOK_VERSION & 0x0f) !== ADDRESS_HOOK_VERSION) {
|
|
39
|
-
throw Error(`ADDRESS_HOOK_VERSION ${ADDRESS_HOOK_VERSION} exceeds 0x0f`);
|
|
40
|
-
}
|
|
41
|
-
// ADDRESS_HOOK_BYTE_PREFIX is a magic prefix that identifies a hooked address.
|
|
42
|
-
// Chosen to make bech32 address hooks that look like "agoric10rch..."
|
|
43
|
-
const ADDRESS_HOOK_BYTE_PREFIX = [
|
|
44
|
-
0x78,
|
|
45
|
-
0xf1,
|
|
46
|
-
0x70, // | ADDRESS_HOOK_VERSION
|
|
47
|
-
];
|
|
48
|
-
harden(ADDRESS_HOOK_BYTE_PREFIX);
|
|
49
|
-
/**
|
|
50
|
-
* The default maximum number of characters in a bech32-encoded hooked address.
|
|
51
|
-
*/
|
|
52
|
-
export const DEFAULT_HOOKED_ADDRESS_CHAR_LIMIT = 1024;
|
|
53
|
-
/**
|
|
54
|
-
* @typedef {Record<string, string | (string | null)[] | null>} HookQuery A
|
|
55
|
-
* record of query keys mapped to query values. `null` values denote valueless
|
|
56
|
-
* keys. Array values denote multiple occurrences of a key:
|
|
57
|
-
*
|
|
58
|
-
* { key: null } // '?key'
|
|
59
|
-
* { key: 'value' } // '?key=value'
|
|
60
|
-
* { key: ['value1', 'value2', 'value3'] } // '?key=value1&key=value2&key=value3'
|
|
61
|
-
* { key: ['value1', null, 'value3'] } // '?key=value1&key&key=value3'
|
|
62
|
-
*/
|
|
63
|
-
/**
|
|
64
|
-
* How many bytes are used to store the length of the base address.
|
|
65
|
-
*/
|
|
66
|
-
export const BASE_ADDRESS_LENGTH_BYTES = 2;
|
|
67
|
-
/**
|
|
68
|
-
* @param {string} specimen
|
|
69
|
-
* @param {number} [charLimit]
|
|
70
|
-
* @returns {{ prefix: string; bytes: Uint8Array }}
|
|
71
|
-
*/
|
|
72
|
-
export const decodeBech32 = (specimen, charLimit = DEFAULT_HOOKED_ADDRESS_CHAR_LIMIT) => {
|
|
73
|
-
const { prefix, words } = bech32.decode(specimen, charLimit);
|
|
74
|
-
const rawBytes = bech32.fromWords(words);
|
|
75
|
-
const bytes = new Uint8Array(rawBytes);
|
|
76
|
-
return harden({ prefix, bytes });
|
|
77
|
-
};
|
|
78
|
-
harden(decodeBech32);
|
|
79
|
-
/**
|
|
80
|
-
* @param {string} humanReadablePart
|
|
81
|
-
* @param {ArrayLike<number>} bytes
|
|
82
|
-
* @param {number} [charLimit]
|
|
83
|
-
* @returns {string}
|
|
84
|
-
*/
|
|
85
|
-
export const encodeBech32 = (humanReadablePart, bytes, charLimit = DEFAULT_HOOKED_ADDRESS_CHAR_LIMIT) => {
|
|
86
|
-
const words = bech32.toWords(bytes);
|
|
87
|
-
return bech32.encode(humanReadablePart, words, charLimit);
|
|
88
|
-
};
|
|
89
|
-
harden(encodeBech32);
|
|
90
|
-
/**
|
|
91
|
-
* Join raw base address bytes and hook data into a bech32-encoded hooked
|
|
92
|
-
* address. The bech32-payload is:
|
|
93
|
-
*
|
|
94
|
-
* | offset | 0 | 3 | 3+len(baseAddress) | len(payload)-2 |
|
|
95
|
-
* | ------ | ----- | ----------- | ------------------ | ---------------- |
|
|
96
|
-
* | data | magic | baseAddress | hookData | len(baseAddress) |
|
|
97
|
-
*
|
|
98
|
-
* `magic` is a 3-byte prefix that identifies a hooked address and its version
|
|
99
|
-
* nibble, whose value is 4 bits (between 0 and 0xf (15)). Currently, the only
|
|
100
|
-
* supported version is 0.
|
|
101
|
-
*
|
|
102
|
-
* 0x78, 0xf1, (0x70 | ADDRESS_HOOK_VERSION),
|
|
103
|
-
*
|
|
104
|
-
* This magic prefix encodes as `0rch`, regardless of the version or HRP (e.g.
|
|
105
|
-
* `agoric10rch<rest of payload as bech32><bech32 checksum>`).
|
|
106
|
-
*
|
|
107
|
-
* @param {string} baseAddress
|
|
108
|
-
* @param {ArrayLike<number>} hookData
|
|
109
|
-
* @param {number} [charLimit]
|
|
110
|
-
* @returns {string}
|
|
111
|
-
*/
|
|
112
|
-
export const joinHookedAddress = (baseAddress, hookData, charLimit = DEFAULT_HOOKED_ADDRESS_CHAR_LIMIT) => {
|
|
113
|
-
const { prefix, bytes } = decodeBech32(baseAddress, charLimit);
|
|
114
|
-
const baseAddressLength = bytes.length;
|
|
115
|
-
const b = baseAddressLength;
|
|
116
|
-
const hd = hookData.length;
|
|
117
|
-
const maxBaseAddressLength = 2 ** (BASE_ADDRESS_LENGTH_BYTES * 8);
|
|
118
|
-
if (b >= maxBaseAddressLength) {
|
|
119
|
-
throw RangeError(`Base address length 0x${b.toString(16)} exceeds maximum 0x${maxBaseAddressLength.toString(16)}`);
|
|
120
|
-
}
|
|
121
|
-
if (!Number.isSafeInteger(hd) || hd < 0) {
|
|
122
|
-
throw RangeError(`Hook data length ${hd} is not a non-negative integer`);
|
|
123
|
-
}
|
|
124
|
-
const prefixLength = ADDRESS_HOOK_BYTE_PREFIX.length;
|
|
125
|
-
const hookBuf = new Uint8Array(prefixLength + b + hd + BASE_ADDRESS_LENGTH_BYTES);
|
|
126
|
-
hookBuf.set(ADDRESS_HOOK_BYTE_PREFIX, 0);
|
|
127
|
-
hookBuf[prefixLength - 1] |= ADDRESS_HOOK_VERSION;
|
|
128
|
-
hookBuf.set(bytes, prefixLength);
|
|
129
|
-
hookBuf.set(hookData, prefixLength + b);
|
|
130
|
-
// Append the address length bytes, since we've already ensured these do not
|
|
131
|
-
// exceed maxBaseAddressLength above. These are big-endian because the length
|
|
132
|
-
// is at the end of the payload, so if we want to support more bytes for the
|
|
133
|
-
// length, we just need encroach further into the payload. We can do that
|
|
134
|
-
// without changing the meaning of the bytes at the end of existing payloads.
|
|
135
|
-
let len = b;
|
|
136
|
-
for (let i = 0; i < BASE_ADDRESS_LENGTH_BYTES; i += 1) {
|
|
137
|
-
hookBuf[hookBuf.length - 1 - i] = len & 0xff;
|
|
138
|
-
len >>>= 8;
|
|
139
|
-
}
|
|
140
|
-
return encodeBech32(prefix, hookBuf, charLimit);
|
|
141
|
-
};
|
|
142
|
-
harden(joinHookedAddress);
|
|
143
|
-
/**
|
|
144
|
-
* @param {string} baseAddress
|
|
145
|
-
* @param {HookQuery} query
|
|
146
|
-
* @param {number} [charLimit]
|
|
147
|
-
*/
|
|
148
|
-
export const encodeAddressHook = (baseAddress, query, charLimit) => {
|
|
149
|
-
const queryStr = queryString.stringify(query);
|
|
150
|
-
const te = new TextEncoder();
|
|
151
|
-
const hookData = te.encode(`?${queryStr}`);
|
|
152
|
-
return joinHookedAddress(baseAddress, hookData, charLimit);
|
|
153
|
-
};
|
|
154
|
-
harden(encodeAddressHook);
|
|
155
|
-
/**
|
|
156
|
-
* @param {string} addressHook
|
|
157
|
-
* @param {number} [charLimit]
|
|
158
|
-
* @returns {{ baseAddress: string; query: HookQuery }}
|
|
159
|
-
* @throws {Error} if no hook string or hook string does not start with `?`
|
|
160
|
-
*/
|
|
161
|
-
export const decodeAddressHook = (addressHook, charLimit) => {
|
|
162
|
-
const { baseAddress, hookData } = splitHookedAddress(addressHook, charLimit);
|
|
163
|
-
const hookStr = new TextDecoder().decode(hookData);
|
|
164
|
-
if (hookStr && !hookStr.startsWith('?')) {
|
|
165
|
-
throw Error(`Hook data does not start with '?': ${hookStr}`);
|
|
166
|
-
}
|
|
167
|
-
const parsedQuery = queryString.parse(hookStr);
|
|
168
|
-
/**
|
|
169
|
-
* @type {HookQuery}
|
|
170
|
-
*/
|
|
171
|
-
const query = harden({ ...parsedQuery });
|
|
172
|
-
return harden({ baseAddress, query });
|
|
173
|
-
};
|
|
174
|
-
harden(decodeAddressHook);
|
|
175
|
-
/**
|
|
176
|
-
* @param {string} specimen
|
|
177
|
-
* @param {number} [charLimit]
|
|
178
|
-
* @returns {{ baseAddress: string; hookData: Uint8Array }}
|
|
179
|
-
*/
|
|
180
|
-
export const splitHookedAddress = (specimen, charLimit = DEFAULT_HOOKED_ADDRESS_CHAR_LIMIT) => {
|
|
181
|
-
const { prefix, bytes } = decodeBech32(specimen, charLimit);
|
|
182
|
-
const prefixLength = ADDRESS_HOOK_BYTE_PREFIX.length;
|
|
183
|
-
let version = 0xff;
|
|
184
|
-
for (let i = 0; i < prefixLength; i += 1) {
|
|
185
|
-
let maybeMagicByte = bytes[i];
|
|
186
|
-
if (i === prefixLength - 1) {
|
|
187
|
-
// Final byte has a low version nibble and a high magic nibble.
|
|
188
|
-
version = maybeMagicByte & 0x0f;
|
|
189
|
-
maybeMagicByte &= 0xf0;
|
|
190
|
-
}
|
|
191
|
-
if (maybeMagicByte !== ADDRESS_HOOK_BYTE_PREFIX[i]) {
|
|
192
|
-
return harden({ baseAddress: specimen, hookData: new Uint8Array() });
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (version !== ADDRESS_HOOK_VERSION) {
|
|
196
|
-
throw TypeError(`Unsupported address hook version ${version}`);
|
|
197
|
-
}
|
|
198
|
-
let len = 0;
|
|
199
|
-
for (let i = BASE_ADDRESS_LENGTH_BYTES - 1; i >= 0; i -= 1) {
|
|
200
|
-
const byte = bytes.at(-i - 1);
|
|
201
|
-
if (byte === undefined) {
|
|
202
|
-
throw TypeError(`Cannot get base address length from byte ${-i - 1} of ${bytes.length}`);
|
|
203
|
-
}
|
|
204
|
-
len <<= 8;
|
|
205
|
-
len |= byte;
|
|
206
|
-
}
|
|
207
|
-
const b = len;
|
|
208
|
-
if (b > bytes.length - BASE_ADDRESS_LENGTH_BYTES - prefixLength) {
|
|
209
|
-
throw TypeError(`Base address length 0x${b.toString(16)} is longer than specimen length ${bytes.length - BASE_ADDRESS_LENGTH_BYTES - prefixLength}`);
|
|
210
|
-
}
|
|
211
|
-
const baseAddressBuf = bytes.subarray(prefixLength, prefixLength + b);
|
|
212
|
-
const baseAddress = encodeBech32(prefix, baseAddressBuf, charLimit);
|
|
213
|
-
const hookData = bytes.subarray(prefixLength + b, -BASE_ADDRESS_LENGTH_BYTES);
|
|
214
|
-
return harden({ baseAddress, hookData });
|
|
215
|
-
};
|
|
216
|
-
harden(splitHookedAddress);
|
|
217
|
-
//# sourceMappingURL=address-hooks.js.map
|
|
1
|
+
import{bech32 as e}from"bech32";import o from"query-string";const r=globalThis.harden||Object.freeze;const t=[120,241,112];r(t);export const DEFAULT_HOOKED_ADDRESS_CHAR_LIMIT=1024;export const BASE_ADDRESS_LENGTH_BYTES=2;export const decodeBech32=(o,t=1024)=>{const{prefix:s,words:n}=e.decode(o,t),d=e.fromWords(n),c=new Uint8Array(d);return r({prefix:s,bytes:c})};r(decodeBech32);export const encodeBech32=(o,r,t=1024)=>{const s=e.toWords(r);return e.encode(o,s,t)};r(encodeBech32);export const joinHookedAddress=(e,o,r=1024)=>{const{prefix:s,bytes:n}=decodeBech32(e,r),d=n.length,c=o.length,a=65536;if(d>=a)throw RangeError(`Base address length 0x${d.toString(16)} exceeds maximum 0x${a.toString(16)}`);if(!Number.isSafeInteger(c)||c<0)throw RangeError(`Hook data length ${c} is not a non-negative integer`);const i=t.length,h=new Uint8Array(i+d+c+2);h.set(t,0),h[i-1]|=0,h.set(n,i),h.set(o,i+d);let g=d;for(let e=0;e<2;e+=1)h[h.length-1-e]=255&g,g>>>=8;return encodeBech32(s,h,r)};r(joinHookedAddress);export const encodeAddressHook=(e,r,t)=>{const s=o.stringify(r),n=(new TextEncoder).encode(`?${s}`);return joinHookedAddress(e,n,t)};r(encodeAddressHook);export const decodeAddressHook=(e,t)=>{const{baseAddress:s,hookData:n}=splitHookedAddress(e,t),d=(new TextDecoder).decode(n);if(d&&!d.startsWith("?"))throw Error(`Hook data does not start with '?': ${d}`);const c=o.parse(d),a=r({...c});return r({baseAddress:s,query:a})};r(decodeAddressHook);export const splitHookedAddress=(e,o=1024)=>{const{prefix:s,bytes:n}=decodeBech32(e,o),d=t.length;let c=255;for(let o=0;o<d;o+=1){let s=n[o];if(o===d-1&&(c=15&s,s&=240),s!==t[o])return r({baseAddress:e,hookData:new Uint8Array})}if(0!==c)throw TypeError(`Unsupported address hook version ${c}`);let a=0;for(let e=1;e>=0;e-=1){const o=n.at(-e-1);if(void 0===o)throw TypeError(`Cannot get base address length from byte ${-e-1} of ${n.length}`);a<<=8,a|=o}const i=a;if(i>n.length-2-d)throw TypeError(`Base address length 0x${i.toString(16)} is longer than specimen length ${n.length-2-d}`);const h=n.subarray(d,d+i),g=encodeBech32(s,h,o),l=n.subarray(d+i,-2);return r({baseAddress:g,hookData:l})};r(splitHookedAddress);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-hooks.js","sourceRoot":"","sources":["../src/address-hooks.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,+BAA+B;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,WAAW,MAAM,cAAc,CAAC;AAEvC,uBAAuB;AACvB,6BAA6B;AAC7B,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC;AAElD,8EAA8E;AAC9E,UAAU;AACV,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,KAAK,oBAAoB,EAAE,CAAC;IAC3D,MAAM,KAAK,CAAC,wBAAwB,oBAAoB,eAAe,CAAC,CAAC;AAC3E,CAAC;AAED,+EAA+E;AAC/E,sEAAsE;AACtE,MAAM,wBAAwB,GAAG;IAC/B,IAAI;IACJ,IAAI;IACJ,IAAI,EAAE,yBAAyB;CAChC,CAAC;AACF,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,CAAC;AAEtD;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;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,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,SAAS,CACb,4CAA4C,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,MAAM,EAAE,CACxE,CAAC;QACJ,CAAC;QACD,GAAG,KAAK,CAAC,CAAC;QACV,GAAG,IAAI,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,GAAG,GAAG,CAAC;IACd,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,yBAAyB,GAAG,YAAY,EAAE,CAAC;QAChE,MAAM,SAAS,CACb,yBAAyB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,mCAAmC,KAAK,CAAC,MAAM,GAAG,yBAAyB,GAAG,YAAY,EAAE,CACpI,CAAC;IACJ,CAAC;IAED,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;IACtE,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAEpE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC;IAE9E,OAAO,MAAM,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC;AACF,MAAM,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,51 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as _0 from './lien/genesis.js';
|
|
3
|
-
import * as _1 from './lien/lien.js';
|
|
4
|
-
import * as _2 from './swingset/genesis.js';
|
|
5
|
-
import * as _3 from './swingset/msgs.js';
|
|
6
|
-
import * as _4 from './swingset/query.js';
|
|
7
|
-
import * as _5 from './swingset/swingset.js';
|
|
8
|
-
import * as _6 from './vbank/genesis.js';
|
|
9
|
-
import * as _7 from './vbank/msgs.js';
|
|
10
|
-
import * as _8 from './vbank/query.js';
|
|
11
|
-
import * as _9 from './vbank/vbank.js';
|
|
12
|
-
import * as _10 from './vibc/msgs.js';
|
|
13
|
-
import * as _11 from './vlocalchain/vlocalchain.js';
|
|
14
|
-
import * as _12 from './vstorage/genesis.js';
|
|
15
|
-
import * as _13 from './vstorage/query.js';
|
|
16
|
-
import * as _14 from './vstorage/vstorage.js';
|
|
17
|
-
import * as _15 from './vtransfer/genesis.js';
|
|
18
|
-
export var agoric;
|
|
19
|
-
(function (agoric) {
|
|
20
|
-
agoric.lien = {
|
|
21
|
-
..._0,
|
|
22
|
-
..._1,
|
|
23
|
-
};
|
|
24
|
-
agoric.swingset = {
|
|
25
|
-
..._2,
|
|
26
|
-
..._3,
|
|
27
|
-
..._4,
|
|
28
|
-
..._5,
|
|
29
|
-
};
|
|
30
|
-
agoric.vbank = {
|
|
31
|
-
..._6,
|
|
32
|
-
..._7,
|
|
33
|
-
..._8,
|
|
34
|
-
..._9,
|
|
35
|
-
};
|
|
36
|
-
agoric.vibc = {
|
|
37
|
-
..._10,
|
|
38
|
-
};
|
|
39
|
-
agoric.vlocalchain = {
|
|
40
|
-
..._11,
|
|
41
|
-
};
|
|
42
|
-
agoric.vstorage = {
|
|
43
|
-
..._12,
|
|
44
|
-
..._13,
|
|
45
|
-
..._14,
|
|
46
|
-
};
|
|
47
|
-
agoric.vtransfer = {
|
|
48
|
-
..._15,
|
|
49
|
-
};
|
|
50
|
-
})(agoric || (agoric = {}));
|
|
51
|
-
//# sourceMappingURL=bundle.js.map
|
|
1
|
+
import*as s from"./lien/genesis.js";import*as r from"./lien/lien.js";import*as o from"./swingset/genesis.js";import*as i from"./swingset/msgs.js";import*as a from"./swingset/query.js";import*as m from"./swingset/swingset.js";import*as e from"./vbank/genesis.js";import*as t from"./vbank/msgs.js";import*as n from"./vbank/query.js";import*as g from"./vbank/vbank.js";import*as f from"./vibc/msgs.js";import*as v from"./vlocalchain/vlocalchain.js";import*as p from"./vstorage/genesis.js";import*as j from"./vstorage/query.js";import*as c from"./vstorage/vstorage.js";import*as l from"./vtransfer/genesis.js";export var agoric;!function(b){b.lien={...s,...r},b.swingset={...o,...i,...a,...m},b.vbank={...e,...t,...n,...g},b.vibc={...f},b.vlocalchain={...v},b.vstorage={...p,...j,...c},b.vtransfer={...l}}(agoric||(agoric={}));
|
|
@@ -1,143 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Lien } from './lien.js';
|
|
3
|
-
import { BinaryReader, BinaryWriter } from '../../binary.js';
|
|
4
|
-
import {} from '../../json-safe.js';
|
|
5
|
-
import { isSet } from '../../helpers.js';
|
|
6
|
-
function createBaseGenesisState() {
|
|
7
|
-
return {
|
|
8
|
-
liens: [],
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export const GenesisState = {
|
|
12
|
-
typeUrl: '/agoric.lien.GenesisState',
|
|
13
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
14
|
-
for (const v of message.liens) {
|
|
15
|
-
AccountLien.encode(v, writer.uint32(10).fork()).ldelim();
|
|
16
|
-
}
|
|
17
|
-
return writer;
|
|
18
|
-
},
|
|
19
|
-
decode(input, length) {
|
|
20
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
21
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
22
|
-
const message = createBaseGenesisState();
|
|
23
|
-
while (reader.pos < end) {
|
|
24
|
-
const tag = reader.uint32();
|
|
25
|
-
switch (tag >>> 3) {
|
|
26
|
-
case 1:
|
|
27
|
-
message.liens.push(AccountLien.decode(reader, reader.uint32()));
|
|
28
|
-
break;
|
|
29
|
-
default:
|
|
30
|
-
reader.skipType(tag & 7);
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return message;
|
|
35
|
-
},
|
|
36
|
-
fromJSON(object) {
|
|
37
|
-
return {
|
|
38
|
-
liens: Array.isArray(object?.liens)
|
|
39
|
-
? object.liens.map((e) => AccountLien.fromJSON(e))
|
|
40
|
-
: [],
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
toJSON(message) {
|
|
44
|
-
const obj = {};
|
|
45
|
-
if (message.liens) {
|
|
46
|
-
obj.liens = message.liens.map(e => e ? AccountLien.toJSON(e) : undefined);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
obj.liens = [];
|
|
50
|
-
}
|
|
51
|
-
return obj;
|
|
52
|
-
},
|
|
53
|
-
fromPartial(object) {
|
|
54
|
-
const message = createBaseGenesisState();
|
|
55
|
-
message.liens = object.liens?.map(e => AccountLien.fromPartial(e)) || [];
|
|
56
|
-
return message;
|
|
57
|
-
},
|
|
58
|
-
fromProtoMsg(message) {
|
|
59
|
-
return GenesisState.decode(message.value);
|
|
60
|
-
},
|
|
61
|
-
toProto(message) {
|
|
62
|
-
return GenesisState.encode(message).finish();
|
|
63
|
-
},
|
|
64
|
-
toProtoMsg(message) {
|
|
65
|
-
return {
|
|
66
|
-
typeUrl: '/agoric.lien.GenesisState',
|
|
67
|
-
value: GenesisState.encode(message).finish(),
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
function createBaseAccountLien() {
|
|
72
|
-
return {
|
|
73
|
-
address: '',
|
|
74
|
-
lien: undefined,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export const AccountLien = {
|
|
78
|
-
typeUrl: '/agoric.lien.AccountLien',
|
|
79
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
80
|
-
if (message.address !== '') {
|
|
81
|
-
writer.uint32(10).string(message.address);
|
|
82
|
-
}
|
|
83
|
-
if (message.lien !== undefined) {
|
|
84
|
-
Lien.encode(message.lien, writer.uint32(18).fork()).ldelim();
|
|
85
|
-
}
|
|
86
|
-
return writer;
|
|
87
|
-
},
|
|
88
|
-
decode(input, length) {
|
|
89
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
90
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
91
|
-
const message = createBaseAccountLien();
|
|
92
|
-
while (reader.pos < end) {
|
|
93
|
-
const tag = reader.uint32();
|
|
94
|
-
switch (tag >>> 3) {
|
|
95
|
-
case 1:
|
|
96
|
-
message.address = reader.string();
|
|
97
|
-
break;
|
|
98
|
-
case 2:
|
|
99
|
-
message.lien = Lien.decode(reader, reader.uint32());
|
|
100
|
-
break;
|
|
101
|
-
default:
|
|
102
|
-
reader.skipType(tag & 7);
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return message;
|
|
107
|
-
},
|
|
108
|
-
fromJSON(object) {
|
|
109
|
-
return {
|
|
110
|
-
address: isSet(object.address) ? String(object.address) : '',
|
|
111
|
-
lien: isSet(object.lien) ? Lien.fromJSON(object.lien) : undefined,
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
toJSON(message) {
|
|
115
|
-
const obj = {};
|
|
116
|
-
message.address !== undefined && (obj.address = message.address);
|
|
117
|
-
message.lien !== undefined &&
|
|
118
|
-
(obj.lien = message.lien ? Lien.toJSON(message.lien) : undefined);
|
|
119
|
-
return obj;
|
|
120
|
-
},
|
|
121
|
-
fromPartial(object) {
|
|
122
|
-
const message = createBaseAccountLien();
|
|
123
|
-
message.address = object.address ?? '';
|
|
124
|
-
message.lien =
|
|
125
|
-
object.lien !== undefined && object.lien !== null
|
|
126
|
-
? Lien.fromPartial(object.lien)
|
|
127
|
-
: undefined;
|
|
128
|
-
return message;
|
|
129
|
-
},
|
|
130
|
-
fromProtoMsg(message) {
|
|
131
|
-
return AccountLien.decode(message.value);
|
|
132
|
-
},
|
|
133
|
-
toProto(message) {
|
|
134
|
-
return AccountLien.encode(message).finish();
|
|
135
|
-
},
|
|
136
|
-
toProtoMsg(message) {
|
|
137
|
-
return {
|
|
138
|
-
typeUrl: '/agoric.lien.AccountLien',
|
|
139
|
-
value: AccountLien.encode(message).finish(),
|
|
140
|
-
};
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
//# sourceMappingURL=genesis.js.map
|
|
1
|
+
import{Lien as e}from"./lien.js";import{BinaryReader as n,BinaryWriter as o}from"../../binary.js";import{}from"../../json-safe.js";import{isSet as i}from"../../helpers.js";export const GenesisState={typeUrl:"/agoric.lien.GenesisState",encode(e,n=o.create()){for(const o of e.liens)AccountLien.encode(o,n.uint32(10).fork()).ldelim();return n},decode(e,o){const i=e instanceof n?e:new n(e);let s=void 0===o?i.len:i.pos+o;const t={liens:[]};for(;i.pos<s;){const e=i.uint32();if(e>>>3==1)t.liens.push(AccountLien.decode(i,i.uint32()));else i.skipType(7&e)}return t},fromJSON:e=>({liens:Array.isArray(e?.liens)?e.liens.map((e=>AccountLien.fromJSON(e))):[]}),toJSON(e){const n={};return e.liens?n.liens=e.liens.map((e=>e?AccountLien.toJSON(e):void 0)):n.liens=[],n},fromPartial(e){const n={liens:[]};return n.liens=e.liens?.map((e=>AccountLien.fromPartial(e)))||[],n},fromProtoMsg:e=>GenesisState.decode(e.value),toProto:e=>GenesisState.encode(e).finish(),toProtoMsg:e=>({typeUrl:"/agoric.lien.GenesisState",value:GenesisState.encode(e).finish()})};export const AccountLien={typeUrl:"/agoric.lien.AccountLien",encode:(n,i=o.create())=>(""!==n.address&&i.uint32(10).string(n.address),void 0!==n.lien&&e.encode(n.lien,i.uint32(18).fork()).ldelim(),i),decode(o,i){const s=o instanceof n?o:new n(o);let t=void 0===i?s.len:s.pos+i;const r={address:"",lien:void 0};for(;s.pos<t;){const n=s.uint32();switch(n>>>3){case 1:r.address=s.string();break;case 2:r.lien=e.decode(s,s.uint32());break;default:s.skipType(7&n)}}return r},fromJSON:n=>({address:i(n.address)?String(n.address):"",lien:i(n.lien)?e.fromJSON(n.lien):void 0}),toJSON(n){const o={};return void 0!==n.address&&(o.address=n.address),void 0!==n.lien&&(o.lien=n.lien?e.toJSON(n.lien):void 0),o},fromPartial(n){const o={address:"",lien:void 0};return o.address=n.address??"",o.lien=void 0!==n.lien&&null!==n.lien?e.fromPartial(n.lien):void 0,o},fromProtoMsg:e=>AccountLien.decode(e.value),toProto:e=>AccountLien.encode(e).finish(),toProtoMsg:e=>({typeUrl:"/agoric.lien.AccountLien",value:AccountLien.encode(e).finish()})};
|
|
@@ -1,87 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Coin } from '../../cosmos/base/v1beta1/coin.js';
|
|
3
|
-
import { BinaryReader, BinaryWriter } from '../../binary.js';
|
|
4
|
-
import {} from '../../json-safe.js';
|
|
5
|
-
function createBaseLien() {
|
|
6
|
-
return {
|
|
7
|
-
coins: [],
|
|
8
|
-
delegated: [],
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export const Lien = {
|
|
12
|
-
typeUrl: '/agoric.lien.Lien',
|
|
13
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
14
|
-
for (const v of message.coins) {
|
|
15
|
-
Coin.encode(v, writer.uint32(10).fork()).ldelim();
|
|
16
|
-
}
|
|
17
|
-
for (const v of message.delegated) {
|
|
18
|
-
Coin.encode(v, writer.uint32(18).fork()).ldelim();
|
|
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 = createBaseLien();
|
|
26
|
-
while (reader.pos < end) {
|
|
27
|
-
const tag = reader.uint32();
|
|
28
|
-
switch (tag >>> 3) {
|
|
29
|
-
case 1:
|
|
30
|
-
message.coins.push(Coin.decode(reader, reader.uint32()));
|
|
31
|
-
break;
|
|
32
|
-
case 2:
|
|
33
|
-
message.delegated.push(Coin.decode(reader, reader.uint32()));
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
reader.skipType(tag & 7);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return message;
|
|
41
|
-
},
|
|
42
|
-
fromJSON(object) {
|
|
43
|
-
return {
|
|
44
|
-
coins: Array.isArray(object?.coins)
|
|
45
|
-
? object.coins.map((e) => Coin.fromJSON(e))
|
|
46
|
-
: [],
|
|
47
|
-
delegated: Array.isArray(object?.delegated)
|
|
48
|
-
? object.delegated.map((e) => Coin.fromJSON(e))
|
|
49
|
-
: [],
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
toJSON(message) {
|
|
53
|
-
const obj = {};
|
|
54
|
-
if (message.coins) {
|
|
55
|
-
obj.coins = message.coins.map(e => (e ? Coin.toJSON(e) : undefined));
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
obj.coins = [];
|
|
59
|
-
}
|
|
60
|
-
if (message.delegated) {
|
|
61
|
-
obj.delegated = message.delegated.map(e => e ? Coin.toJSON(e) : undefined);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
obj.delegated = [];
|
|
65
|
-
}
|
|
66
|
-
return obj;
|
|
67
|
-
},
|
|
68
|
-
fromPartial(object) {
|
|
69
|
-
const message = createBaseLien();
|
|
70
|
-
message.coins = object.coins?.map(e => Coin.fromPartial(e)) || [];
|
|
71
|
-
message.delegated = object.delegated?.map(e => Coin.fromPartial(e)) || [];
|
|
72
|
-
return message;
|
|
73
|
-
},
|
|
74
|
-
fromProtoMsg(message) {
|
|
75
|
-
return Lien.decode(message.value);
|
|
76
|
-
},
|
|
77
|
-
toProto(message) {
|
|
78
|
-
return Lien.encode(message).finish();
|
|
79
|
-
},
|
|
80
|
-
toProtoMsg(message) {
|
|
81
|
-
return {
|
|
82
|
-
typeUrl: '/agoric.lien.Lien',
|
|
83
|
-
value: Lien.encode(message).finish(),
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=lien.js.map
|
|
1
|
+
import{Coin as e}from"../../cosmos/base/v1beta1/coin.js";import{BinaryReader as o,BinaryWriter as t}from"../../binary.js";import{}from"../../json-safe.js";export const Lien={typeUrl:"/agoric.lien.Lien",encode(o,n=t.create()){for(const t of o.coins)e.encode(t,n.uint32(10).fork()).ldelim();for(const t of o.delegated)e.encode(t,n.uint32(18).fork()).ldelim();return n},decode(t,n){const i=t instanceof o?t:new o(t);let r=void 0===n?i.len:i.pos+n;const d={coins:[],delegated:[]};for(;i.pos<r;){const o=i.uint32();switch(o>>>3){case 1:d.coins.push(e.decode(i,i.uint32()));break;case 2:d.delegated.push(e.decode(i,i.uint32()));break;default:i.skipType(7&o)}}return d},fromJSON:o=>({coins:Array.isArray(o?.coins)?o.coins.map((o=>e.fromJSON(o))):[],delegated:Array.isArray(o?.delegated)?o.delegated.map((o=>e.fromJSON(o))):[]}),toJSON(o){const t={};return o.coins?t.coins=o.coins.map((o=>o?e.toJSON(o):void 0)):t.coins=[],o.delegated?t.delegated=o.delegated.map((o=>o?e.toJSON(o):void 0)):t.delegated=[],t},fromPartial(o){const t={coins:[],delegated:[]};return t.coins=o.coins?.map((o=>e.fromPartial(o)))||[],t.delegated=o.delegated?.map((o=>e.fromPartial(o)))||[],t},fromProtoMsg:e=>Lien.decode(e.value),toProto:e=>Lien.encode(e).finish(),toProtoMsg:e=>({typeUrl:"/agoric.lien.Lien",value:Lien.encode(e).finish()})};
|