decentralcardgame-cardchain-client-ts 0.0.1 → 0.0.2

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.
Files changed (44) hide show
  1. package/DecentralCardGame.cardchain.cardchain/module.ts +632 -632
  2. package/DecentralCardGame.cardchain.cardchain/registry.ts +62 -62
  3. package/cosmos.authz.v1beta1/module.ts +24 -24
  4. package/cosmos.authz.v1beta1/registry.ts +2 -2
  5. package/cosmos.bank.v1beta1/module.ts +24 -24
  6. package/cosmos.bank.v1beta1/registry.ts +2 -2
  7. package/cosmos.base.tendermint.v1beta1/rest.ts +3 -3
  8. package/cosmos.base.tendermint.v1beta1/types/tendermint/crypto/keys.ts +1 -1
  9. package/cosmos.base.tendermint.v1beta1/types/tendermint/types/types.ts +1 -1
  10. package/cosmos.distribution.v1beta1/module.ts +46 -46
  11. package/cosmos.distribution.v1beta1/registry.ts +4 -4
  12. package/cosmos.gov.v1/module.ts +29 -29
  13. package/cosmos.gov.v1/registry.ts +2 -2
  14. package/cosmos.gov.v1beta1/module.ts +47 -47
  15. package/cosmos.gov.v1beta1/registry.ts +4 -4
  16. package/cosmos.group.v1/module.ts +163 -163
  17. package/cosmos.group.v1/registry.ts +18 -18
  18. package/cosmos.group.v1/rest.ts +39 -0
  19. package/cosmos.group.v1/types/cosmos/group/v1/query.ts +150 -0
  20. package/cosmos.staking.v1beta1/module.ts +64 -64
  21. package/cosmos.staking.v1beta1/registry.ts +6 -6
  22. package/cosmos.staking.v1beta1/rest.ts +2 -2
  23. package/cosmos.staking.v1beta1/types/tendermint/crypto/keys.ts +1 -1
  24. package/cosmos.staking.v1beta1/types/tendermint/types/types.ts +1 -1
  25. package/cosmos.tx.v1beta1/rest.ts +3 -3
  26. package/cosmos.tx.v1beta1/types/tendermint/abci/types.ts +1 -1
  27. package/cosmos.tx.v1beta1/types/tendermint/crypto/keys.ts +1 -1
  28. package/cosmos.tx.v1beta1/types/tendermint/types/types.ts +1 -1
  29. package/cosmos.vesting.v1beta1/module.ts +29 -29
  30. package/cosmos.vesting.v1beta1/registry.ts +2 -2
  31. package/cosmos.vesting.v1beta1/rest.ts +4 -1
  32. package/cosmos.vesting.v1beta1/types/cosmos/vesting/v1beta1/tx.ts +2 -0
  33. package/cosmos.vesting.v1beta1/types/cosmos/vesting/v1beta1/vesting.ts +6 -1
  34. package/ibc.applications.interchain_accounts.controller.v1/rest.ts +143 -0
  35. package/ibc.applications.interchain_accounts.controller.v1/types/google/protobuf/any.ts +240 -0
  36. package/ibc.applications.interchain_accounts.controller.v1/types/ibc/applications/interchain_accounts/controller/v1/tx.ts +361 -0
  37. package/ibc.applications.interchain_accounts.controller.v1/types/ibc/applications/interchain_accounts/v1/packet.ts +234 -0
  38. package/ibc.applications.transfer.v1/rest.ts +7 -1
  39. package/ibc.applications.transfer.v1/types/ibc/applications/transfer/v1/tx.ts +28 -6
  40. package/ibc.core.client.v1/rest.ts +16 -16
  41. package/ibc.core.client.v1/types/ibc/core/client/v1/query.ts +1 -1
  42. package/ibc.core.connection.v1/rest.ts +37 -0
  43. package/ibc.core.connection.v1/types/ibc/core/connection/v1/query.ts +110 -1
  44. package/package.json +1 -1
@@ -7,9 +7,9 @@ import { msgTypes } from './registry';
7
7
  import { IgniteClient } from "../client"
8
8
  import { MissingWalletError } from "../helpers"
9
9
  import { Api } from "./rest";
10
- import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
11
10
  import { MsgCreatePermanentLockedAccount } from "./types/cosmos/vesting/v1beta1/tx";
12
11
  import { MsgCreateVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
12
+ import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
13
13
 
14
14
  import { BaseVestingAccount as typeBaseVestingAccount} from "./types"
15
15
  import { ContinuousVestingAccount as typeContinuousVestingAccount} from "./types"
@@ -18,13 +18,7 @@ import { Period as typePeriod} from "./types"
18
18
  import { PeriodicVestingAccount as typePeriodicVestingAccount} from "./types"
19
19
  import { PermanentLockedAccount as typePermanentLockedAccount} from "./types"
20
20
 
21
- export { MsgCreatePeriodicVestingAccount, MsgCreatePermanentLockedAccount, MsgCreateVestingAccount };
22
-
23
- type sendMsgCreatePeriodicVestingAccountParams = {
24
- value: MsgCreatePeriodicVestingAccount,
25
- fee?: StdFee,
26
- memo?: string
27
- };
21
+ export { MsgCreatePermanentLockedAccount, MsgCreateVestingAccount, MsgCreatePeriodicVestingAccount };
28
22
 
29
23
  type sendMsgCreatePermanentLockedAccountParams = {
30
24
  value: MsgCreatePermanentLockedAccount,
@@ -38,11 +32,13 @@ type sendMsgCreateVestingAccountParams = {
38
32
  memo?: string
39
33
  };
40
34
 
41
-
42
- type msgCreatePeriodicVestingAccountParams = {
35
+ type sendMsgCreatePeriodicVestingAccountParams = {
43
36
  value: MsgCreatePeriodicVestingAccount,
37
+ fee?: StdFee,
38
+ memo?: string
44
39
  };
45
40
 
41
+
46
42
  type msgCreatePermanentLockedAccountParams = {
47
43
  value: MsgCreatePermanentLockedAccount,
48
44
  };
@@ -51,6 +47,10 @@ type msgCreateVestingAccountParams = {
51
47
  value: MsgCreateVestingAccount,
52
48
  };
53
49
 
50
+ type msgCreatePeriodicVestingAccountParams = {
51
+ value: MsgCreatePeriodicVestingAccount,
52
+ };
53
+
54
54
 
55
55
  export const registry = new Registry(msgTypes);
56
56
 
@@ -81,20 +81,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
81
81
 
82
82
  return {
83
83
 
84
- async sendMsgCreatePeriodicVestingAccount({ value, fee, memo }: sendMsgCreatePeriodicVestingAccountParams): Promise<DeliverTxResponse> {
85
- if (!signer) {
86
- throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Unable to sign Tx. Signer is not present.')
87
- }
88
- try {
89
- const { address } = (await signer.getAccounts())[0];
90
- const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
91
- let msg = this.msgCreatePeriodicVestingAccount({ value: MsgCreatePeriodicVestingAccount.fromPartial(value) })
92
- return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
93
- } catch (e: any) {
94
- throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Could not broadcast Tx: '+ e.message)
95
- }
96
- },
97
-
98
84
  async sendMsgCreatePermanentLockedAccount({ value, fee, memo }: sendMsgCreatePermanentLockedAccountParams): Promise<DeliverTxResponse> {
99
85
  if (!signer) {
100
86
  throw new Error('TxClient:sendMsgCreatePermanentLockedAccount: Unable to sign Tx. Signer is not present.')
@@ -123,15 +109,21 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
123
109
  }
124
110
  },
125
111
 
126
-
127
- msgCreatePeriodicVestingAccount({ value }: msgCreatePeriodicVestingAccountParams): EncodeObject {
128
- try {
129
- return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.fromPartial( value ) }
112
+ async sendMsgCreatePeriodicVestingAccount({ value, fee, memo }: sendMsgCreatePeriodicVestingAccountParams): Promise<DeliverTxResponse> {
113
+ if (!signer) {
114
+ throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Unable to sign Tx. Signer is not present.')
115
+ }
116
+ try {
117
+ const { address } = (await signer.getAccounts())[0];
118
+ const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
119
+ let msg = this.msgCreatePeriodicVestingAccount({ value: MsgCreatePeriodicVestingAccount.fromPartial(value) })
120
+ return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
130
121
  } catch (e: any) {
131
- throw new Error('TxClient:MsgCreatePeriodicVestingAccount: Could not create message: ' + e.message)
122
+ throw new Error('TxClient:sendMsgCreatePeriodicVestingAccount: Could not broadcast Tx: '+ e.message)
132
123
  }
133
124
  },
134
125
 
126
+
135
127
  msgCreatePermanentLockedAccount({ value }: msgCreatePermanentLockedAccountParams): EncodeObject {
136
128
  try {
137
129
  return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", value: MsgCreatePermanentLockedAccount.fromPartial( value ) }
@@ -148,6 +140,14 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
148
140
  }
149
141
  },
150
142
 
143
+ msgCreatePeriodicVestingAccount({ value }: msgCreatePeriodicVestingAccountParams): EncodeObject {
144
+ try {
145
+ return { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", value: MsgCreatePeriodicVestingAccount.fromPartial( value ) }
146
+ } catch (e: any) {
147
+ throw new Error('TxClient:MsgCreatePeriodicVestingAccount: Could not create message: ' + e.message)
148
+ }
149
+ },
150
+
151
151
  }
152
152
  };
153
153
 
@@ -1,12 +1,12 @@
1
1
  import { GeneratedType } from "@cosmjs/proto-signing";
2
- import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
3
2
  import { MsgCreatePermanentLockedAccount } from "./types/cosmos/vesting/v1beta1/tx";
4
3
  import { MsgCreateVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
4
+ import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
5
5
 
6
6
  const msgTypes: Array<[string, GeneratedType]> = [
7
- ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount],
8
7
  ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount],
9
8
  ["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount],
9
+ ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount],
10
10
 
11
11
  ];
12
12
 
@@ -165,7 +165,10 @@ export type V1Beta1MsgCreateVestingAccountResponse = object;
165
165
  * Period defines a length of time and amount of coins that will vest.
166
166
  */
167
167
  export interface V1Beta1Period {
168
- /** @format int64 */
168
+ /**
169
+ * Period duration in seconds.
170
+ * @format int64
171
+ */
169
172
  length?: string;
170
173
  amount?: V1Beta1Coin[];
171
174
  }
@@ -14,6 +14,7 @@ export interface MsgCreateVestingAccount {
14
14
  fromAddress: string;
15
15
  toAddress: string;
16
16
  amount: Coin[];
17
+ /** end of vesting as unix time (in seconds). */
17
18
  endTime: number;
18
19
  delayed: boolean;
19
20
  }
@@ -51,6 +52,7 @@ export interface MsgCreatePermanentLockedAccountResponse {
51
52
  export interface MsgCreatePeriodicVestingAccount {
52
53
  fromAddress: string;
53
54
  toAddress: string;
55
+ /** start of vesting as unix time (in seconds). */
54
56
  startTime: number;
55
57
  vestingPeriods: Period[];
56
58
  }
@@ -15,6 +15,7 @@ export interface BaseVestingAccount {
15
15
  originalVesting: Coin[];
16
16
  delegatedFree: Coin[];
17
17
  delegatedVesting: Coin[];
18
+ /** Vesting end time, as unix timestamp (in seconds). */
18
19
  endTime: number;
19
20
  }
20
21
 
@@ -23,7 +24,10 @@ export interface BaseVestingAccount {
23
24
  * continuously vests by unlocking coins linearly with respect to time.
24
25
  */
25
26
  export interface ContinuousVestingAccount {
26
- baseVestingAccount: BaseVestingAccount | undefined;
27
+ baseVestingAccount:
28
+ | BaseVestingAccount
29
+ | undefined;
30
+ /** Vesting start time, as unix timestamp (in seconds). */
27
31
  startTime: number;
28
32
  }
29
33
 
@@ -38,6 +42,7 @@ export interface DelayedVestingAccount {
38
42
 
39
43
  /** Period defines a length of time and amount of coins that will vest. */
40
44
  export interface Period {
45
+ /** Period duration in seconds. */
41
46
  length: number;
42
47
  amount: Coin[];
43
48
  }
@@ -9,7 +9,126 @@
9
9
  * ---------------------------------------------------------------
10
10
  */
11
11
 
12
+ /**
13
+ * - TYPE_UNSPECIFIED: Default zero value enumeration
14
+ - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain
15
+ */
16
+ export enum InterchainAccountsv1Type {
17
+ TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
18
+ TYPE_EXECUTE_TX = "TYPE_EXECUTE_TX",
19
+ }
20
+
21
+ /**
22
+ * `Any` contains an arbitrary serialized protocol buffer message along with a
23
+ URL that describes the type of the serialized message.
24
+
25
+ Protobuf library provides support to pack/unpack Any values in the form
26
+ of utility functions or additional generated methods of the Any type.
27
+
28
+ Example 1: Pack and unpack a message in C++.
29
+
30
+ Foo foo = ...;
31
+ Any any;
32
+ any.PackFrom(foo);
33
+ ...
34
+ if (any.UnpackTo(&foo)) {
35
+ ...
36
+ }
37
+
38
+ Example 2: Pack and unpack a message in Java.
39
+
40
+ Foo foo = ...;
41
+ Any any = Any.pack(foo);
42
+ ...
43
+ if (any.is(Foo.class)) {
44
+ foo = any.unpack(Foo.class);
45
+ }
46
+
47
+ Example 3: Pack and unpack a message in Python.
48
+
49
+ foo = Foo(...)
50
+ any = Any()
51
+ any.Pack(foo)
52
+ ...
53
+ if any.Is(Foo.DESCRIPTOR):
54
+ any.Unpack(foo)
55
+ ...
56
+
57
+ Example 4: Pack and unpack a message in Go
58
+
59
+ foo := &pb.Foo{...}
60
+ any, err := anypb.New(foo)
61
+ if err != nil {
62
+ ...
63
+ }
64
+ ...
65
+ foo := &pb.Foo{}
66
+ if err := any.UnmarshalTo(foo); err != nil {
67
+ ...
68
+ }
69
+
70
+ The pack methods provided by protobuf library will by default use
71
+ 'type.googleapis.com/full.type.name' as the type URL and the unpack
72
+ methods only use the fully qualified type name after the last '/'
73
+ in the type URL, for example "foo.bar.com/x/y.z" will yield type
74
+ name "y.z".
75
+
76
+
77
+ JSON
78
+ ====
79
+ The JSON representation of an `Any` value uses the regular
80
+ representation of the deserialized, embedded message, with an
81
+ additional field `@type` which contains the type URL. Example:
82
+
83
+ package google.profile;
84
+ message Person {
85
+ string first_name = 1;
86
+ string last_name = 2;
87
+ }
88
+
89
+ {
90
+ "@type": "type.googleapis.com/google.profile.Person",
91
+ "firstName": <string>,
92
+ "lastName": <string>
93
+ }
94
+
95
+ If the embedded message type is well-known and has a custom JSON
96
+ representation, that representation will be embedded adding a field
97
+ `value` which holds the custom JSON in addition to the `@type`
98
+ field. Example (for message [google.protobuf.Duration][]):
99
+
100
+ {
101
+ "@type": "type.googleapis.com/google.protobuf.Duration",
102
+ "value": "1.212s"
103
+ }
104
+ */
12
105
  export interface ProtobufAny {
106
+ /**
107
+ * A URL/resource name that uniquely identifies the type of the serialized
108
+ * protocol buffer message. This string must contain at least
109
+ * one "/" character. The last segment of the URL's path must represent
110
+ * the fully qualified name of the type (as in
111
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
112
+ * (e.g., leading "." is not accepted).
113
+ *
114
+ * In practice, teams usually precompile into the binary all types that they
115
+ * expect it to use in the context of Any. However, for URLs which use the
116
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
117
+ * server that maps type URLs to message definitions as follows:
118
+ * * If no scheme is provided, `https` is assumed.
119
+ * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
120
+ * value in binary format, or produce an error.
121
+ * * Applications are allowed to cache lookup results based on the
122
+ * URL, or have them precompiled into a binary to avoid any
123
+ * lookup. Therefore, binary compatibility needs to be preserved
124
+ * on changes to types. (Use versioned type names to manage
125
+ * breaking changes.)
126
+ * Note: this functionality is not currently available in the official
127
+ * protobuf release, and it is not used for type URLs beginning with
128
+ * type.googleapis.com.
129
+ * Schemes other than `http`, `https` (or the empty scheme) might be
130
+ * used with implementation specific semantics.
131
+ */
13
132
  "@type"?: string;
14
133
  }
15
134
 
@@ -20,6 +139,30 @@ export interface RpcStatus {
20
139
  details?: ProtobufAny[];
21
140
  }
22
141
 
142
+ /**
143
+ * InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field.
144
+ */
145
+ export interface V1InterchainAccountPacketData {
146
+ /**
147
+ * - TYPE_UNSPECIFIED: Default zero value enumeration
148
+ * - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain
149
+ */
150
+ type?: InterchainAccountsv1Type;
151
+
152
+ /** @format byte */
153
+ data?: string;
154
+ memo?: string;
155
+ }
156
+
157
+ export interface V1MsgRegisterInterchainAccountResponse {
158
+ channel_id?: string;
159
+ }
160
+
161
+ export interface V1MsgSendTxResponse {
162
+ /** @format uint64 */
163
+ sequence?: string;
164
+ }
165
+
23
166
  /**
24
167
  * Params defines the set of on-chain interchain accounts parameters.
25
168
  The following parameters may be used to disable the controller submodule.
@@ -0,0 +1,240 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+
4
+ export const protobufPackage = "google.protobuf";
5
+
6
+ /**
7
+ * `Any` contains an arbitrary serialized protocol buffer message along with a
8
+ * URL that describes the type of the serialized message.
9
+ *
10
+ * Protobuf library provides support to pack/unpack Any values in the form
11
+ * of utility functions or additional generated methods of the Any type.
12
+ *
13
+ * Example 1: Pack and unpack a message in C++.
14
+ *
15
+ * Foo foo = ...;
16
+ * Any any;
17
+ * any.PackFrom(foo);
18
+ * ...
19
+ * if (any.UnpackTo(&foo)) {
20
+ * ...
21
+ * }
22
+ *
23
+ * Example 2: Pack and unpack a message in Java.
24
+ *
25
+ * Foo foo = ...;
26
+ * Any any = Any.pack(foo);
27
+ * ...
28
+ * if (any.is(Foo.class)) {
29
+ * foo = any.unpack(Foo.class);
30
+ * }
31
+ *
32
+ * Example 3: Pack and unpack a message in Python.
33
+ *
34
+ * foo = Foo(...)
35
+ * any = Any()
36
+ * any.Pack(foo)
37
+ * ...
38
+ * if any.Is(Foo.DESCRIPTOR):
39
+ * any.Unpack(foo)
40
+ * ...
41
+ *
42
+ * Example 4: Pack and unpack a message in Go
43
+ *
44
+ * foo := &pb.Foo{...}
45
+ * any, err := anypb.New(foo)
46
+ * if err != nil {
47
+ * ...
48
+ * }
49
+ * ...
50
+ * foo := &pb.Foo{}
51
+ * if err := any.UnmarshalTo(foo); err != nil {
52
+ * ...
53
+ * }
54
+ *
55
+ * The pack methods provided by protobuf library will by default use
56
+ * 'type.googleapis.com/full.type.name' as the type URL and the unpack
57
+ * methods only use the fully qualified type name after the last '/'
58
+ * in the type URL, for example "foo.bar.com/x/y.z" will yield type
59
+ * name "y.z".
60
+ *
61
+ * JSON
62
+ * ====
63
+ * The JSON representation of an `Any` value uses the regular
64
+ * representation of the deserialized, embedded message, with an
65
+ * additional field `@type` which contains the type URL. Example:
66
+ *
67
+ * package google.profile;
68
+ * message Person {
69
+ * string first_name = 1;
70
+ * string last_name = 2;
71
+ * }
72
+ *
73
+ * {
74
+ * "@type": "type.googleapis.com/google.profile.Person",
75
+ * "firstName": <string>,
76
+ * "lastName": <string>
77
+ * }
78
+ *
79
+ * If the embedded message type is well-known and has a custom JSON
80
+ * representation, that representation will be embedded adding a field
81
+ * `value` which holds the custom JSON in addition to the `@type`
82
+ * field. Example (for message [google.protobuf.Duration][]):
83
+ *
84
+ * {
85
+ * "@type": "type.googleapis.com/google.protobuf.Duration",
86
+ * "value": "1.212s"
87
+ * }
88
+ */
89
+ export interface Any {
90
+ /**
91
+ * A URL/resource name that uniquely identifies the type of the serialized
92
+ * protocol buffer message. This string must contain at least
93
+ * one "/" character. The last segment of the URL's path must represent
94
+ * the fully qualified name of the type (as in
95
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
96
+ * (e.g., leading "." is not accepted).
97
+ *
98
+ * In practice, teams usually precompile into the binary all types that they
99
+ * expect it to use in the context of Any. However, for URLs which use the
100
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
101
+ * server that maps type URLs to message definitions as follows:
102
+ *
103
+ * * If no scheme is provided, `https` is assumed.
104
+ * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
105
+ * value in binary format, or produce an error.
106
+ * * Applications are allowed to cache lookup results based on the
107
+ * URL, or have them precompiled into a binary to avoid any
108
+ * lookup. Therefore, binary compatibility needs to be preserved
109
+ * on changes to types. (Use versioned type names to manage
110
+ * breaking changes.)
111
+ *
112
+ * Note: this functionality is not currently available in the official
113
+ * protobuf release, and it is not used for type URLs beginning with
114
+ * type.googleapis.com.
115
+ *
116
+ * Schemes other than `http`, `https` (or the empty scheme) might be
117
+ * used with implementation specific semantics.
118
+ */
119
+ typeUrl: string;
120
+ /** Must be a valid serialized protocol buffer of the above specified type. */
121
+ value: Uint8Array;
122
+ }
123
+
124
+ function createBaseAny(): Any {
125
+ return { typeUrl: "", value: new Uint8Array() };
126
+ }
127
+
128
+ export const Any = {
129
+ encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
130
+ if (message.typeUrl !== "") {
131
+ writer.uint32(10).string(message.typeUrl);
132
+ }
133
+ if (message.value.length !== 0) {
134
+ writer.uint32(18).bytes(message.value);
135
+ }
136
+ return writer;
137
+ },
138
+
139
+ decode(input: _m0.Reader | Uint8Array, length?: number): Any {
140
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
141
+ let end = length === undefined ? reader.len : reader.pos + length;
142
+ const message = createBaseAny();
143
+ while (reader.pos < end) {
144
+ const tag = reader.uint32();
145
+ switch (tag >>> 3) {
146
+ case 1:
147
+ message.typeUrl = reader.string();
148
+ break;
149
+ case 2:
150
+ message.value = reader.bytes();
151
+ break;
152
+ default:
153
+ reader.skipType(tag & 7);
154
+ break;
155
+ }
156
+ }
157
+ return message;
158
+ },
159
+
160
+ fromJSON(object: any): Any {
161
+ return {
162
+ typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "",
163
+ value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(),
164
+ };
165
+ },
166
+
167
+ toJSON(message: Any): unknown {
168
+ const obj: any = {};
169
+ message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl);
170
+ message.value !== undefined
171
+ && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
172
+ return obj;
173
+ },
174
+
175
+ fromPartial<I extends Exact<DeepPartial<Any>, I>>(object: I): Any {
176
+ const message = createBaseAny();
177
+ message.typeUrl = object.typeUrl ?? "";
178
+ message.value = object.value ?? new Uint8Array();
179
+ return message;
180
+ },
181
+ };
182
+
183
+ declare var self: any | undefined;
184
+ declare var window: any | undefined;
185
+ declare var global: any | undefined;
186
+ var globalThis: any = (() => {
187
+ if (typeof globalThis !== "undefined") {
188
+ return globalThis;
189
+ }
190
+ if (typeof self !== "undefined") {
191
+ return self;
192
+ }
193
+ if (typeof window !== "undefined") {
194
+ return window;
195
+ }
196
+ if (typeof global !== "undefined") {
197
+ return global;
198
+ }
199
+ throw "Unable to locate global object";
200
+ })();
201
+
202
+ function bytesFromBase64(b64: string): Uint8Array {
203
+ if (globalThis.Buffer) {
204
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
205
+ } else {
206
+ const bin = globalThis.atob(b64);
207
+ const arr = new Uint8Array(bin.length);
208
+ for (let i = 0; i < bin.length; ++i) {
209
+ arr[i] = bin.charCodeAt(i);
210
+ }
211
+ return arr;
212
+ }
213
+ }
214
+
215
+ function base64FromBytes(arr: Uint8Array): string {
216
+ if (globalThis.Buffer) {
217
+ return globalThis.Buffer.from(arr).toString("base64");
218
+ } else {
219
+ const bin: string[] = [];
220
+ arr.forEach((byte) => {
221
+ bin.push(String.fromCharCode(byte));
222
+ });
223
+ return globalThis.btoa(bin.join(""));
224
+ }
225
+ }
226
+
227
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
228
+
229
+ export type DeepPartial<T> = T extends Builtin ? T
230
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
231
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
232
+ : Partial<T>;
233
+
234
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
235
+ export type Exact<P, I extends P> = P extends Builtin ? P
236
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
237
+
238
+ function isSet(value: any): boolean {
239
+ return value !== null && value !== undefined;
240
+ }