@burningflames/inj-exchange-sdk 0.0.0-stage → 0.1.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.
Files changed (70) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +7 -0
  3. package/README.md +198 -2
  4. package/dist/ApiManager-BcwRSg4p.cjs +14 -0
  5. package/dist/ApiManager-VsZ_7GMj.js +9 -0
  6. package/dist/MsgIncreasePositionMargin-7_g04vle.d.ts +2285 -0
  7. package/dist/MsgIncreasePositionMargin-UQn6vCje.d.cts +2284 -0
  8. package/dist/bank-c5iv-fbg.cjs +480 -0
  9. package/dist/bank-xWl_W05K.js +451 -0
  10. package/dist/chain-CgjV0b1c.js +5868 -0
  11. package/dist/chain-LTb0TjXc.cjs +5903 -0
  12. package/dist/clients/chain.cjs +8 -0
  13. package/dist/clients/chain.d.cts +2 -0
  14. package/dist/clients/chain.d.ts +2 -0
  15. package/dist/clients/chain.js +1 -0
  16. package/dist/clients/indexer.cjs +14 -0
  17. package/dist/clients/indexer.d.cts +2 -0
  18. package/dist/clients/indexer.d.ts +2 -0
  19. package/dist/clients/indexer.js +1 -0
  20. package/dist/coin-8_Vn0T8-.cjs +73 -0
  21. package/dist/coin-CowdNxVV.js +68 -0
  22. package/dist/decimal-CIFXn110.js +27 -0
  23. package/dist/decimal-DJMaLHQO.cjs +38 -0
  24. package/dist/eip712-88KVCEnw.d.cts +21 -0
  25. package/dist/eip712-88KVCEnw.d.ts +21 -0
  26. package/dist/errors-CKG7zTvs.cjs +36 -0
  27. package/dist/errors-MWG_E5zA.js +25 -0
  28. package/dist/exchange-BPRx-kFI.js +4637 -0
  29. package/dist/exchange-CTLbPuA7.cjs +4966 -0
  30. package/dist/index-B3bDzB4S.d.cts +2169 -0
  31. package/dist/index-BHLUinQA.d.ts +220 -0
  32. package/dist/index-BPpDV6JA.d.cts +182 -0
  33. package/dist/index-BT_zyZW9.d.cts +220 -0
  34. package/dist/index-DcQT-y4U.d.ts +2169 -0
  35. package/dist/index-DfoLUPEo.d.ts +183 -0
  36. package/dist/index.cjs +73 -0
  37. package/dist/index.d.cts +11 -0
  38. package/dist/index.d.ts +11 -0
  39. package/dist/index.js +13 -0
  40. package/dist/indexer-D7XfYsAZ.js +21699 -0
  41. package/dist/indexer-DI7-gHOA.cjs +21770 -0
  42. package/dist/msgs-Bi5b52-R.js +11359 -0
  43. package/dist/msgs-DNyc0UtV.cjs +11442 -0
  44. package/dist/msgs.cjs +16 -0
  45. package/dist/msgs.d.cts +2 -0
  46. package/dist/msgs.d.ts +2 -0
  47. package/dist/msgs.js +1 -0
  48. package/dist/query-DGTA8Lz_.js +13375 -0
  49. package/dist/query-L1m6tP9I.cjs +13530 -0
  50. package/dist/stream-BgKRWG60.d.cts +46 -0
  51. package/dist/stream-BgKRWG60.d.ts +46 -0
  52. package/dist/stream-D8ZvUQFy.cjs +29 -0
  53. package/dist/stream-RhVNTED5.js +18 -0
  54. package/dist/tendermint-CF_W9U6D.d.ts +49 -0
  55. package/dist/tendermint-zj8c-dVM.d.cts +49 -0
  56. package/dist/tx-BRaw1C6e.d.ts +66 -0
  57. package/dist/tx-BgpasOOk.cjs +464 -0
  58. package/dist/tx-CCt0zqng.d.cts +66 -0
  59. package/dist/tx-COcDYlg3.js +411 -0
  60. package/dist/tx-DIg8nbnn.cjs +1091 -0
  61. package/dist/tx-GN0SFql2.js +1026 -0
  62. package/dist/types.cjs +38 -0
  63. package/dist/types.d.cts +13 -0
  64. package/dist/types.d.ts +13 -0
  65. package/dist/types.js +26 -0
  66. package/dist/utils.cjs +131 -0
  67. package/dist/utils.d.cts +2 -0
  68. package/dist/utils.d.ts +2 -0
  69. package/dist/utils.js +115 -0
  70. package/package.json +124 -4
@@ -0,0 +1,220 @@
1
+ import { ChannelCredentials, ChannelOptions } from "@grpc/grpc-js";
2
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
3
+ import { C as TxEncodeResponse, F as QuerySubaccountPositionsResponse, G as PageRequest, I as QuerySubaccountTradeNonceResponse, K as PageResponse, L as QueryTraderDerivativeOrdersResponse, N as QueryExchangeParamsResponse, P as QuerySubaccountDepositsResponse, R as QueryTraderSpotOrdersResponse, S as TxEncodeRequest, U as Metadata, W as Coin, _ as BroadcastMode, b as SimulateResponse, q as Any, v as BroadcastTxResponse, x as TxDecodeResponse, y as GetTxResponse } from "./MsgIncreasePositionMargin-7_g04vle.js";
4
+ import { a as TxRaw, c as PaginationOption, s as Pagination } from "./tx-BRaw1C6e.js";
5
+ import { n as BlockResponse } from "./tendermint-CF_W9U6D.js";
6
+ /**
7
+ * BaseAccount defines a base account type. It contains all the necessary fields
8
+ * for basic account functionality. Any custom account type should extend this
9
+ * type for additional functionality (e.g. vesting).
10
+ */
11
+ interface BaseAccount {
12
+ address: string;
13
+ pubKey: Any | undefined;
14
+ accountNumber: number;
15
+ sequence: number;
16
+ }
17
+ declare const BaseAccount: MessageFns$2<BaseAccount>;
18
+ type Builtin$2 = Date | Function | Uint8Array | string | number | boolean | undefined;
19
+ type DeepPartial$2<T> = T extends Builtin$2 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$2<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$2<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$2<T[K]>; } : Partial<T>;
20
+ type KeysOfUnion$2<T> = T extends T ? keyof T : never;
21
+ type Exact$2<P, I> = P extends Builtin$2 ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact$2<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion$2<P>>]: never; };
22
+ interface MessageFns$2<T> {
23
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
24
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
25
+ fromJSON(object: any): T;
26
+ toJSON(message: T): unknown;
27
+ create<I extends Exact$2<DeepPartial$2<T>, I>>(base?: I): T;
28
+ fromPartial<I extends Exact$2<DeepPartial$2<T>, I>>(object: I): T;
29
+ }
30
+ interface AccountResponse {
31
+ codeHash: string;
32
+ baseAccount: SanitizedBaseAccount;
33
+ }
34
+ interface AccountsResponse {
35
+ pagination: Pagination;
36
+ accounts: AccountResponse[];
37
+ }
38
+ type SanitizedBaseAccount = Omit<BaseAccount, "pubKey"> & {
39
+ pubKey: {
40
+ key: string;
41
+ typeUrl: string;
42
+ } | undefined;
43
+ };
44
+ declare class ChainAuthApiClient {
45
+ private client;
46
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
47
+ private decodeAccount;
48
+ fetchAccounts(params?: PaginationOption): Promise<AccountsResponse>;
49
+ fetchAccount(address: string): Promise<AccountResponse>;
50
+ }
51
+ /** Since: cosmos-sdk 0.43 */
52
+ /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */
53
+ interface QueryGrantsRequest {
54
+ granter: string;
55
+ grantee: string;
56
+ /** Optional, msg_type_url, when set, will query only grants matching given msg type. */
57
+ msgTypeUrl: string;
58
+ /** pagination defines an pagination for the request. */
59
+ pagination: PageRequest | undefined;
60
+ }
61
+ declare const QueryGrantsRequest: MessageFns$1<QueryGrantsRequest>;
62
+ type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined;
63
+ type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$1<T[K]>; } : Partial<T>;
64
+ type KeysOfUnion$1<T> = T extends T ? keyof T : never;
65
+ type Exact$1<P, I> = P extends Builtin$1 ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact$1<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion$1<P>>]: never; };
66
+ interface MessageFns$1<T> {
67
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
68
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
69
+ fromJSON(object: any): T;
70
+ toJSON(message: T): unknown;
71
+ create<I extends Exact$1<DeepPartial$1<T>, I>>(base?: I): T;
72
+ fromPartial<I extends Exact$1<DeepPartial$1<T>, I>>(object: I): T;
73
+ }
74
+ type SantizedGrant = {
75
+ authorization?: {
76
+ msg: string;
77
+ };
78
+ expiration: number;
79
+ authorizationType: string;
80
+ };
81
+ type SantizedGranterGrant = SantizedGrant & {
82
+ granter: string;
83
+ grantee: string;
84
+ };
85
+ type SanitzedGranteeGrant = SantizedGranterGrant;
86
+ declare class ChainAuthZApiClient {
87
+ private client;
88
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
89
+ private sanitizeGrant;
90
+ fetchGrants(params: Omit<QueryGrantsRequest, "msgTypeUrl" | "pagination"> & {
91
+ msgTypeUrl?: string;
92
+ pagination?: PaginationOption;
93
+ }): Promise<{
94
+ grants: SantizedGrant[];
95
+ pagination: Pagination;
96
+ }>;
97
+ fetchGranterGrants(granter: string, pagination?: PaginationOption): Promise<{
98
+ grants: SantizedGranterGrant[];
99
+ pagination: Pagination;
100
+ }>;
101
+ fetchGranteeGrants(grantee: string, pagination?: PaginationOption): Promise<{
102
+ grants: SanitzedGranteeGrant[];
103
+ pagination: Pagination;
104
+ }>;
105
+ }
106
+ /** QueryBalanceResponse is the response type for the Query/Balance RPC method. */
107
+ interface QueryBalanceResponse {
108
+ /** balance is the balance of the coin. */
109
+ balance: Coin | undefined;
110
+ }
111
+ /**
112
+ * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
113
+ * method.
114
+ */
115
+ interface QueryAllBalancesResponse {
116
+ /** balances is the balances of all the coins. */
117
+ balances: Coin[];
118
+ /** pagination defines the pagination in the response. */
119
+ pagination: PageResponse | undefined;
120
+ }
121
+ /**
122
+ * QuerySpendableBalancesResponse defines the gRPC response structure for querying
123
+ * an account's spendable balances.
124
+ *
125
+ * Since: cosmos-sdk 0.46
126
+ */
127
+ interface QuerySpendableBalancesResponse {
128
+ /** balances is the spendable balances of all the coins. */
129
+ balances: Coin[];
130
+ /** pagination defines the pagination in the response. */
131
+ pagination: PageResponse | undefined;
132
+ }
133
+ /**
134
+ * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for
135
+ * querying an account's spendable balance for a specific denom.
136
+ *
137
+ * Since: cosmos-sdk 0.47
138
+ */
139
+ interface QuerySpendableBalanceByDenomResponse {
140
+ /** balance is the balance of the coin. */
141
+ balance: Coin | undefined;
142
+ }
143
+ /**
144
+ * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC
145
+ * method.
146
+ */
147
+ interface QueryDenomMetadataResponse {
148
+ /** metadata describes and provides all the client information for the requested token. */
149
+ metadata: Metadata | undefined;
150
+ }
151
+ declare const QueryBalanceResponse: MessageFns<QueryBalanceResponse>;
152
+ declare const QueryAllBalancesResponse: MessageFns<QueryAllBalancesResponse>;
153
+ declare const QuerySpendableBalancesResponse: MessageFns<QuerySpendableBalancesResponse>;
154
+ declare const QuerySpendableBalanceByDenomResponse: MessageFns<QuerySpendableBalanceByDenomResponse>;
155
+ declare const QueryDenomMetadataResponse: MessageFns<QueryDenomMetadataResponse>;
156
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
157
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]>; } : Partial<T>;
158
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
159
+ type Exact<P, I> = P extends Builtin ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; };
160
+ interface MessageFns<T> {
161
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
162
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
163
+ fromJSON(object: any): T;
164
+ toJSON(message: T): unknown;
165
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
166
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
167
+ }
168
+ declare class ChainBankApiClient {
169
+ private client;
170
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
171
+ fetchBalance(params: {
172
+ accountAddress: string;
173
+ denom: string;
174
+ }): Promise<QueryBalanceResponse["balance"]>;
175
+ fetchBalances(address: string, pagination?: PaginationOption): Promise<{
176
+ balances: QueryAllBalancesResponse["balances"];
177
+ pagination: Pagination;
178
+ }>;
179
+ fetchSpendableBalances(address: string, pagination?: PaginationOption): Promise<{
180
+ balances: QuerySpendableBalancesResponse["balances"];
181
+ pagination: Pagination;
182
+ }>;
183
+ fetchSpendableBalanceByDenom(params: {
184
+ accountAddress: string;
185
+ denom: string;
186
+ }): Promise<QuerySpendableBalanceByDenomResponse["balance"]>;
187
+ fetchDenomMetadata(denom: string): Promise<QueryDenomMetadataResponse["metadata"]>;
188
+ }
189
+ declare class ChainExchangeApiClient {
190
+ private client;
191
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
192
+ fetchParams(): Promise<QueryExchangeParamsResponse["params"]>;
193
+ fetchSubaccountDeposits(subaccountId: string): Promise<QuerySubaccountDepositsResponse["deposits"]>;
194
+ fetchSubaccountPositions(subaccountId: string): Promise<QuerySubaccountPositionsResponse["state"]>;
195
+ fetchSubaccountTradeNonce(subaccountId: string): Promise<QuerySubaccountTradeNonceResponse["nonce"]>;
196
+ fetchSpotOrders(params: {
197
+ marketId: string;
198
+ subaccountId?: string;
199
+ }): Promise<QueryTraderSpotOrdersResponse["orders"]>;
200
+ fetchDerivativeOrders(params: {
201
+ marketId: string;
202
+ subaccountId?: string;
203
+ }): Promise<QueryTraderDerivativeOrdersResponse["orders"]>;
204
+ }
205
+ declare class ChainTendermintApiClient {
206
+ private client;
207
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
208
+ fetchLatestBlock(): Promise<BlockResponse>;
209
+ fetchBlockByHeight(height: number): Promise<BlockResponse>;
210
+ }
211
+ declare class ChainTxApiClient {
212
+ private client;
213
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
214
+ broadcast(txRaw: TxRaw, mode?: BroadcastMode): Promise<BroadcastTxResponse["txResponse"]>;
215
+ simulate(txRaw: TxRaw): Promise<SimulateResponse>;
216
+ fetchTx(hash: string): Promise<GetTxResponse>;
217
+ decodeTx(txBytes: Buffer): Promise<TxDecodeResponse["tx"]>;
218
+ encodeTx(tx: TxEncodeRequest["tx"]): Promise<TxEncodeResponse["txBytes"]>;
219
+ }
220
+ export { ChainAuthZApiClient as a, ChainBankApiClient as i, ChainTendermintApiClient as n, ChainAuthApiClient as o, ChainExchangeApiClient as r, ChainTxApiClient as t };
@@ -0,0 +1,182 @@
1
+ import { B as PageResponse, G as Commit, H as Block$1, K as Data, U as EvidenceList, V as Any, W as BlockID, _ as EvmChainId, g as ChainId, q as Consensus, z as PageRequest } from "./MsgIncreasePositionMargin-UQn6vCje.cjs";
2
+ import { a as TxRaw, c as PaginationOption, i as StdFee, n as CreateTransactionResult, o as Msg, s as Pagination, t as CreateTransactionParams } from "./tx-CCt0zqng.cjs";
3
+ import { t as Eip712TypedData } from "./eip712-88KVCEnw.cjs";
4
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
5
+ import { n as BlockResponse, t as Block$2 } from "./tendermint-zj8c-dVM.cjs";
6
+ declare function getEthereumAddress(injectiveAddress: string): string;
7
+ declare function getInjectiveAddress(ethAddress: string): string;
8
+ /**
9
+ * Chain format is the fixed-point string the chain stores: the human value
10
+ * shifted by 18 decimals, as a plain integer. "1.5" becomes
11
+ * "1500000000000000000".
12
+ */
13
+ declare function toChainFormat(value: string | number, decimals?: number): string;
14
+ /**
15
+ * The Cosmos SDK decimal string the EIP-712 payload signs: the same value as
16
+ * toChainFormat, but with the decimal point restored. "1.5" becomes
17
+ * "1.500000000000000000".
18
+ */
19
+ declare function toCosmosSdkDecString(value: string | number, decimals?: number): string;
20
+ /**
21
+ * The typed data an EIP-712 signer signs for a transaction. The message is two
22
+ * JSON strings rather than nested objects, which is what the chain's verifier
23
+ * rebuilds and compares against.
24
+ *
25
+ * Building the payload is as far as the SDK goes: it holds no key, so the
26
+ * caller signs these bytes with whatever account it owns and hands the
27
+ * signature to `createTransaction`.
28
+ */
29
+ declare function getEip712TypedDataV2({ msgs, tx, fee, evmChainId }: {
30
+ msgs: Msg | Msg[];
31
+ tx: {
32
+ accountNumber: number;
33
+ sequence: number;
34
+ chainId: ChainId;
35
+ memo?: string;
36
+ timeoutHeight?: number;
37
+ };
38
+ fee: StdFee;
39
+ evmChainId: EvmChainId;
40
+ }): Eip712TypedData;
41
+ declare function hexToBytes(hex: string): Uint8Array;
42
+ declare function bytesToHex(bytes: Uint8Array): string;
43
+ declare function hexToBase64(hex: string): string;
44
+ /** Turns a caller's paging request into the proto request, key decoded. */
45
+ declare function toPageRequest(option: PaginationOption | undefined): PageRequest | undefined;
46
+ /** Turns the proto response's paging into the shape a caller receives. */
47
+ declare function toPagination(response: PageResponse | undefined): Pagination;
48
+ /**
49
+ * Block is tendermint type Block, with the Header proposer address
50
+ * field converted to bech32 string.
51
+ */
52
+ interface Block {
53
+ header: Header | undefined;
54
+ data: Data | undefined;
55
+ evidence: EvidenceList | undefined;
56
+ lastCommit: Commit | undefined;
57
+ }
58
+ /** Header defines the structure of a Tendermint block header. */
59
+ interface Header {
60
+ /** basic block info */
61
+ version: Consensus | undefined;
62
+ chainId: string;
63
+ height: number;
64
+ time: Date | undefined;
65
+ /** prev block info */
66
+ lastBlockId: BlockID | undefined;
67
+ /** hashes of block data */
68
+ lastCommitHash: Buffer;
69
+ /** transactions */
70
+ dataHash: Buffer;
71
+ /** hashes from the app output from the prev block */
72
+ validatorsHash: Buffer;
73
+ /** validators for the next block */
74
+ nextValidatorsHash: Buffer;
75
+ /** consensus params for current block */
76
+ consensusHash: Buffer;
77
+ /** state after txs from the previous block */
78
+ appHash: Buffer;
79
+ /** root hash of all results from the txs from the previous block */
80
+ lastResultsHash: Buffer;
81
+ /** consensus info */
82
+ evidenceHash: Buffer;
83
+ /**
84
+ * proposer_address is the original block proposer address, formatted as a Bech32 string.
85
+ * In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string
86
+ * for better UX.
87
+ */
88
+ proposerAddress: string;
89
+ }
90
+ declare const Block: MessageFns$2<Block>;
91
+ declare const Header: MessageFns$2<Header>;
92
+ type Builtin$2 = Date | Function | Uint8Array | string | number | boolean | undefined;
93
+ type DeepPartial$2<T> = T extends Builtin$2 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$2<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$2<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$2<T[K]>; } : Partial<T>;
94
+ type KeysOfUnion$2<T> = T extends T ? keyof T : never;
95
+ type Exact$2<P, I> = P extends Builtin$2 ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact$2<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion$2<P>>]: never; };
96
+ interface MessageFns$2<T> {
97
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
98
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
99
+ fromJSON(object: any): T;
100
+ toJSON(message: T): unknown;
101
+ create<I extends Exact$2<DeepPartial$2<T>, I>>(base?: I): T;
102
+ fromPartial<I extends Exact$2<DeepPartial$2<T>, I>>(object: I): T;
103
+ }
104
+ /** GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. */
105
+ interface GetLatestBlockResponse {
106
+ blockId: BlockID | undefined;
107
+ /** Deprecated: please use `sdk_block` instead */
108
+ block: Block$1 | undefined;
109
+ /** Since: cosmos-sdk 0.47 */
110
+ sdkBlock: Block | undefined;
111
+ }
112
+ declare const GetLatestBlockResponse: MessageFns$1<GetLatestBlockResponse>;
113
+ type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined;
114
+ type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$1<T[K]>; } : Partial<T>;
115
+ type KeysOfUnion$1<T> = T extends T ? keyof T : never;
116
+ type Exact$1<P, I> = P extends Builtin$1 ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact$1<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion$1<P>>]: never; };
117
+ interface MessageFns$1<T> {
118
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
119
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
120
+ fromJSON(object: any): T;
121
+ toJSON(message: T): unknown;
122
+ create<I extends Exact$1<DeepPartial$1<T>, I>>(base?: I): T;
123
+ fromPartial<I extends Exact$1<DeepPartial$1<T>, I>>(object: I): T;
124
+ }
125
+ type AnyBlock = Block$1 | Block;
126
+ declare function sanitizeBlock(block: AnyBlock): Block$2;
127
+ declare function sanitizeLatestBlock(response: GetLatestBlockResponse): BlockResponse;
128
+ interface ExtensionOptionsWeb3Tx {
129
+ /**
130
+ * typedDataChainID used only in EIP712 Domain and should match
131
+ * Ethereum network ID in a Web3 provider (e.g. Metamask).
132
+ */
133
+ typedDataChainID: number;
134
+ /**
135
+ * feePayer is an account address for the fee payer. It will be validated
136
+ * during EIP712 signature checking.
137
+ */
138
+ feePayer: string;
139
+ /**
140
+ * feePayerSig is a signature data from the fee paying account,
141
+ * allows to perform fee delegation when using EIP712 Domain.
142
+ */
143
+ feePayerSig: Buffer;
144
+ }
145
+ declare const ExtensionOptionsWeb3Tx: MessageFns<ExtensionOptionsWeb3Tx>;
146
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
147
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]>; } : Partial<T>;
148
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
149
+ type Exact<P, I> = P extends Builtin ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; };
150
+ interface MessageFns<T> {
151
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
152
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
153
+ fromJSON(object: any): T;
154
+ toJSON(message: T): unknown;
155
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
156
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
157
+ }
158
+ declare function createTxBytes(txRaw: TxRaw): Buffer;
159
+ /**
160
+ * The extension a web3 transaction carries: the EVM chain id it was signed
161
+ * for and, when the fee is delegated, the paying account and its signature.
162
+ */
163
+ declare function createWeb3Extension({ evmChainId, feePayer, feePayerSig }: {
164
+ evmChainId: EvmChainId;
165
+ feePayer?: string;
166
+ feePayerSig?: Buffer;
167
+ }): ExtensionOptionsWeb3Tx;
168
+ /**
169
+ * Appends the web3 extension to a transaction body, which is what makes the
170
+ * transaction readable by an EIP-712 signer.
171
+ */
172
+ declare function createTxRawEIP712({ txRaw, extension, nonCriticalExtension }: {
173
+ txRaw: TxRaw;
174
+ extension: ExtensionOptionsWeb3Tx;
175
+ nonCriticalExtension?: Any | Any[];
176
+ }): TxRaw;
177
+ /**
178
+ * Builds a transaction body and auth info for one signer and returns everything
179
+ * a DIRECT signer needs, without signing anything.
180
+ */
181
+ declare function createTransaction(params: CreateTransactionParams): CreateTransactionResult;
182
+ export { sanitizeBlock as a, toPagination as c, hexToBytes as d, getEip712TypedDataV2 as f, getInjectiveAddress as g, getEthereumAddress as h, createWeb3Extension as i, bytesToHex as l, toCosmosSdkDecString as m, createTxBytes as n, sanitizeLatestBlock as o, toChainFormat as p, createTxRawEIP712 as r, toPageRequest as s, createTransaction as t, hexToBase64 as u };
@@ -0,0 +1,220 @@
1
+ import { ChannelCredentials, ChannelOptions } from "@grpc/grpc-js";
2
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
3
+ import { A as BroadcastTxResponse, B as PageResponse, C as QueryTraderDerivativeOrdersResponse, F as TxEncodeResponse, M as SimulateResponse, N as TxDecodeResponse, P as TxEncodeRequest, R as Coin, S as QuerySubaccountTradeNonceResponse, V as Any, b as QuerySubaccountDepositsResponse, h as Metadata, j as GetTxResponse, k as BroadcastMode, w as QueryTraderSpotOrdersResponse, x as QuerySubaccountPositionsResponse, y as QueryExchangeParamsResponse, z as PageRequest } from "./MsgIncreasePositionMargin-UQn6vCje.cjs";
4
+ import { a as TxRaw, c as PaginationOption, s as Pagination } from "./tx-CCt0zqng.cjs";
5
+ import { n as BlockResponse } from "./tendermint-zj8c-dVM.cjs";
6
+ /**
7
+ * BaseAccount defines a base account type. It contains all the necessary fields
8
+ * for basic account functionality. Any custom account type should extend this
9
+ * type for additional functionality (e.g. vesting).
10
+ */
11
+ interface BaseAccount {
12
+ address: string;
13
+ pubKey: Any | undefined;
14
+ accountNumber: number;
15
+ sequence: number;
16
+ }
17
+ declare const BaseAccount: MessageFns$2<BaseAccount>;
18
+ type Builtin$2 = Date | Function | Uint8Array | string | number | boolean | undefined;
19
+ type DeepPartial$2<T> = T extends Builtin$2 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$2<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$2<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$2<T[K]>; } : Partial<T>;
20
+ type KeysOfUnion$2<T> = T extends T ? keyof T : never;
21
+ type Exact$2<P, I> = P extends Builtin$2 ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact$2<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion$2<P>>]: never; };
22
+ interface MessageFns$2<T> {
23
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
24
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
25
+ fromJSON(object: any): T;
26
+ toJSON(message: T): unknown;
27
+ create<I extends Exact$2<DeepPartial$2<T>, I>>(base?: I): T;
28
+ fromPartial<I extends Exact$2<DeepPartial$2<T>, I>>(object: I): T;
29
+ }
30
+ interface AccountResponse {
31
+ codeHash: string;
32
+ baseAccount: SanitizedBaseAccount;
33
+ }
34
+ interface AccountsResponse {
35
+ pagination: Pagination;
36
+ accounts: AccountResponse[];
37
+ }
38
+ type SanitizedBaseAccount = Omit<BaseAccount, "pubKey"> & {
39
+ pubKey: {
40
+ key: string;
41
+ typeUrl: string;
42
+ } | undefined;
43
+ };
44
+ declare class ChainAuthApiClient {
45
+ private client;
46
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
47
+ private decodeAccount;
48
+ fetchAccounts(params?: PaginationOption): Promise<AccountsResponse>;
49
+ fetchAccount(address: string): Promise<AccountResponse>;
50
+ }
51
+ /** Since: cosmos-sdk 0.43 */
52
+ /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */
53
+ interface QueryGrantsRequest {
54
+ granter: string;
55
+ grantee: string;
56
+ /** Optional, msg_type_url, when set, will query only grants matching given msg type. */
57
+ msgTypeUrl: string;
58
+ /** pagination defines an pagination for the request. */
59
+ pagination: PageRequest | undefined;
60
+ }
61
+ declare const QueryGrantsRequest: MessageFns$1<QueryGrantsRequest>;
62
+ type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined;
63
+ type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$1<T[K]>; } : Partial<T>;
64
+ type KeysOfUnion$1<T> = T extends T ? keyof T : never;
65
+ type Exact$1<P, I> = P extends Builtin$1 ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact$1<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion$1<P>>]: never; };
66
+ interface MessageFns$1<T> {
67
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
68
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
69
+ fromJSON(object: any): T;
70
+ toJSON(message: T): unknown;
71
+ create<I extends Exact$1<DeepPartial$1<T>, I>>(base?: I): T;
72
+ fromPartial<I extends Exact$1<DeepPartial$1<T>, I>>(object: I): T;
73
+ }
74
+ type SantizedGrant = {
75
+ authorization?: {
76
+ msg: string;
77
+ };
78
+ expiration: number;
79
+ authorizationType: string;
80
+ };
81
+ type SantizedGranterGrant = SantizedGrant & {
82
+ granter: string;
83
+ grantee: string;
84
+ };
85
+ type SanitzedGranteeGrant = SantizedGranterGrant;
86
+ declare class ChainAuthZApiClient {
87
+ private client;
88
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
89
+ private sanitizeGrant;
90
+ fetchGrants(params: Omit<QueryGrantsRequest, "msgTypeUrl" | "pagination"> & {
91
+ msgTypeUrl?: string;
92
+ pagination?: PaginationOption;
93
+ }): Promise<{
94
+ grants: SantizedGrant[];
95
+ pagination: Pagination;
96
+ }>;
97
+ fetchGranterGrants(granter: string, pagination?: PaginationOption): Promise<{
98
+ grants: SantizedGranterGrant[];
99
+ pagination: Pagination;
100
+ }>;
101
+ fetchGranteeGrants(grantee: string, pagination?: PaginationOption): Promise<{
102
+ grants: SanitzedGranteeGrant[];
103
+ pagination: Pagination;
104
+ }>;
105
+ }
106
+ /** QueryBalanceResponse is the response type for the Query/Balance RPC method. */
107
+ interface QueryBalanceResponse {
108
+ /** balance is the balance of the coin. */
109
+ balance: Coin | undefined;
110
+ }
111
+ /**
112
+ * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
113
+ * method.
114
+ */
115
+ interface QueryAllBalancesResponse {
116
+ /** balances is the balances of all the coins. */
117
+ balances: Coin[];
118
+ /** pagination defines the pagination in the response. */
119
+ pagination: PageResponse | undefined;
120
+ }
121
+ /**
122
+ * QuerySpendableBalancesResponse defines the gRPC response structure for querying
123
+ * an account's spendable balances.
124
+ *
125
+ * Since: cosmos-sdk 0.46
126
+ */
127
+ interface QuerySpendableBalancesResponse {
128
+ /** balances is the spendable balances of all the coins. */
129
+ balances: Coin[];
130
+ /** pagination defines the pagination in the response. */
131
+ pagination: PageResponse | undefined;
132
+ }
133
+ /**
134
+ * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for
135
+ * querying an account's spendable balance for a specific denom.
136
+ *
137
+ * Since: cosmos-sdk 0.47
138
+ */
139
+ interface QuerySpendableBalanceByDenomResponse {
140
+ /** balance is the balance of the coin. */
141
+ balance: Coin | undefined;
142
+ }
143
+ /**
144
+ * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC
145
+ * method.
146
+ */
147
+ interface QueryDenomMetadataResponse {
148
+ /** metadata describes and provides all the client information for the requested token. */
149
+ metadata: Metadata | undefined;
150
+ }
151
+ declare const QueryBalanceResponse: MessageFns<QueryBalanceResponse>;
152
+ declare const QueryAllBalancesResponse: MessageFns<QueryAllBalancesResponse>;
153
+ declare const QuerySpendableBalancesResponse: MessageFns<QuerySpendableBalancesResponse>;
154
+ declare const QuerySpendableBalanceByDenomResponse: MessageFns<QuerySpendableBalanceByDenomResponse>;
155
+ declare const QueryDenomMetadataResponse: MessageFns<QueryDenomMetadataResponse>;
156
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
157
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]>; } : Partial<T>;
158
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
159
+ type Exact<P, I> = P extends Builtin ? P : P & { [K in keyof P as Extract<K, keyof I>]: Exact<P[K], I[K & keyof I]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; };
160
+ interface MessageFns<T> {
161
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
162
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
163
+ fromJSON(object: any): T;
164
+ toJSON(message: T): unknown;
165
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
166
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
167
+ }
168
+ declare class ChainBankApiClient {
169
+ private client;
170
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
171
+ fetchBalance(params: {
172
+ accountAddress: string;
173
+ denom: string;
174
+ }): Promise<QueryBalanceResponse["balance"]>;
175
+ fetchBalances(address: string, pagination?: PaginationOption): Promise<{
176
+ balances: QueryAllBalancesResponse["balances"];
177
+ pagination: Pagination;
178
+ }>;
179
+ fetchSpendableBalances(address: string, pagination?: PaginationOption): Promise<{
180
+ balances: QuerySpendableBalancesResponse["balances"];
181
+ pagination: Pagination;
182
+ }>;
183
+ fetchSpendableBalanceByDenom(params: {
184
+ accountAddress: string;
185
+ denom: string;
186
+ }): Promise<QuerySpendableBalanceByDenomResponse["balance"]>;
187
+ fetchDenomMetadata(denom: string): Promise<QueryDenomMetadataResponse["metadata"]>;
188
+ }
189
+ declare class ChainExchangeApiClient {
190
+ private client;
191
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
192
+ fetchParams(): Promise<QueryExchangeParamsResponse["params"]>;
193
+ fetchSubaccountDeposits(subaccountId: string): Promise<QuerySubaccountDepositsResponse["deposits"]>;
194
+ fetchSubaccountPositions(subaccountId: string): Promise<QuerySubaccountPositionsResponse["state"]>;
195
+ fetchSubaccountTradeNonce(subaccountId: string): Promise<QuerySubaccountTradeNonceResponse["nonce"]>;
196
+ fetchSpotOrders(params: {
197
+ marketId: string;
198
+ subaccountId?: string;
199
+ }): Promise<QueryTraderSpotOrdersResponse["orders"]>;
200
+ fetchDerivativeOrders(params: {
201
+ marketId: string;
202
+ subaccountId?: string;
203
+ }): Promise<QueryTraderDerivativeOrdersResponse["orders"]>;
204
+ }
205
+ declare class ChainTendermintApiClient {
206
+ private client;
207
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
208
+ fetchLatestBlock(): Promise<BlockResponse>;
209
+ fetchBlockByHeight(height: number): Promise<BlockResponse>;
210
+ }
211
+ declare class ChainTxApiClient {
212
+ private client;
213
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
214
+ broadcast(txRaw: TxRaw, mode?: BroadcastMode): Promise<BroadcastTxResponse["txResponse"]>;
215
+ simulate(txRaw: TxRaw): Promise<SimulateResponse>;
216
+ fetchTx(hash: string): Promise<GetTxResponse>;
217
+ decodeTx(txBytes: Buffer): Promise<TxDecodeResponse["tx"]>;
218
+ encodeTx(tx: TxEncodeRequest["tx"]): Promise<TxEncodeResponse["txBytes"]>;
219
+ }
220
+ export { ChainAuthZApiClient as a, ChainBankApiClient as i, ChainTendermintApiClient as n, ChainAuthApiClient as o, ChainExchangeApiClient as r, ChainTxApiClient as t };