@bitgo/abstract-cosmos 11.12.3 → 11.13.1
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/.mocharc.yml +1 -1
- package/CHANGELOG.md +10 -0
- package/LICENSE +191 -0
- package/dist/src/cosmosCoin.d.ts +154 -0
- package/dist/src/cosmosCoin.d.ts.map +1 -0
- package/dist/src/cosmosCoin.js +582 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/lib/ContractCallBuilder.d.ts +13 -0
- package/dist/src/lib/ContractCallBuilder.d.ts.map +1 -0
- package/dist/src/lib/ContractCallBuilder.js +61 -0
- package/dist/src/lib/StakingActivateBuilder.d.ts +13 -0
- package/dist/src/lib/StakingActivateBuilder.d.ts.map +1 -0
- package/dist/src/lib/StakingActivateBuilder.js +61 -0
- package/dist/src/lib/StakingDeactivateBuilder.d.ts +13 -0
- package/dist/src/lib/StakingDeactivateBuilder.d.ts.map +1 -0
- package/dist/src/lib/StakingDeactivateBuilder.js +61 -0
- package/dist/src/lib/StakingRedelegateBuilder.d.ts +13 -0
- package/dist/src/lib/StakingRedelegateBuilder.d.ts.map +1 -0
- package/dist/src/lib/StakingRedelegateBuilder.js +61 -0
- package/dist/src/lib/StakingWithdrawRewardsBuilder.d.ts +13 -0
- package/dist/src/lib/StakingWithdrawRewardsBuilder.d.ts.map +1 -0
- package/dist/src/lib/StakingWithdrawRewardsBuilder.js +61 -0
- package/dist/src/lib/constants.d.ts +11 -0
- package/dist/src/lib/constants.d.ts.map +1 -0
- package/dist/src/lib/constants.js +14 -0
- package/dist/src/lib/iface.d.ts +90 -0
- package/dist/src/lib/iface.d.ts.map +1 -0
- package/dist/src/lib/iface.js +20 -0
- package/dist/src/lib/index.d.ts +14 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +63 -0
- package/dist/src/lib/keyPair.d.ts +18 -0
- package/dist/src/lib/keyPair.d.ts.map +1 -0
- package/dist/src/lib/keyPair.js +51 -0
- package/dist/src/lib/transaction.d.ts +64 -0
- package/dist/src/lib/transaction.d.ts.map +1 -0
- package/dist/src/lib/transaction.js +333 -0
- package/dist/src/lib/transactionBuilder.d.ts +86 -0
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
- package/dist/src/lib/transactionBuilder.js +181 -0
- package/dist/src/lib/transferBuilder.d.ts +13 -0
- package/dist/src/lib/transferBuilder.d.ts.map +1 -0
- package/dist/src/lib/transferBuilder.js +61 -0
- package/dist/src/lib/utils.d.ts +351 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +856 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { BaseUtils, TransactionType } from '@bitgo/sdk-core';
|
|
2
|
+
import { DecodedTxRaw } from '@cosmjs/proto-signing';
|
|
3
|
+
import { Coin } from '@cosmjs/stargate';
|
|
4
|
+
import { SignDoc, TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
|
|
5
|
+
import { Any } from 'cosmjs-types/google/protobuf/any';
|
|
6
|
+
import { Hash } from 'crypto';
|
|
7
|
+
import { CosmosLikeTransaction, DelegateOrUndelegeteMessage, ExecuteContractMessage, FeeData, MessageData, RedelegateMessage, SendMessage, WithdrawDelegatorRewardsMessage } from './iface';
|
|
8
|
+
export declare class CosmosUtils<CustomMessage = never> implements BaseUtils {
|
|
9
|
+
protected registry: any;
|
|
10
|
+
constructor();
|
|
11
|
+
/** @inheritdoc */
|
|
12
|
+
isValidBlockId(hash: string): boolean;
|
|
13
|
+
/** @inheritdoc */
|
|
14
|
+
isValidPrivateKey(key: string): boolean;
|
|
15
|
+
/** @inheritdoc */
|
|
16
|
+
isValidPublicKey(key: string): boolean;
|
|
17
|
+
/** @inheritdoc */
|
|
18
|
+
isValidSignature(signature: string): boolean;
|
|
19
|
+
/** @inheritdoc */
|
|
20
|
+
isValidTransactionId(txId: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if transaction hash is in valid black2b format
|
|
23
|
+
*/
|
|
24
|
+
validateBlake2b(hash: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Validates whether amounts are in range
|
|
27
|
+
*
|
|
28
|
+
* @param {number[]} amounts - the amounts to validate
|
|
29
|
+
* @returns {boolean} - the validation result
|
|
30
|
+
*/
|
|
31
|
+
isValidAmounts(amounts: number[]): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Validates whether amount is in range
|
|
34
|
+
* @param {number} amount
|
|
35
|
+
* @returns {boolean} the validation result
|
|
36
|
+
*/
|
|
37
|
+
isValidAmount(amount: number): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Decodes raw tx data into messages, signing info, and fee data
|
|
40
|
+
* @param {string} txHex - raw base64 tx
|
|
41
|
+
* @returns {DecodedTxRaw} Decoded transaction
|
|
42
|
+
*/
|
|
43
|
+
getDecodedTxFromRawBase64(txRaw: string): DecodedTxRaw;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the array of messages in the body of the decoded transaction
|
|
46
|
+
* @param {DecodedTxRaw} decodedTx
|
|
47
|
+
* @returns {EncodeObject[]} messages along with type url
|
|
48
|
+
*/
|
|
49
|
+
private getEncodedMessagesFromDecodedTx;
|
|
50
|
+
/**
|
|
51
|
+
* Checks the txn sequence is valid or not
|
|
52
|
+
* @param {number} sequence
|
|
53
|
+
*/
|
|
54
|
+
validateSequence(sequence: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Pulls the sequence number from a DecodedTxRaw AuthInfo property
|
|
57
|
+
* @param {DecodedTxRaw} decodedTx
|
|
58
|
+
* @returns {number} sequence
|
|
59
|
+
*/
|
|
60
|
+
getSequenceFromDecodedTx(decodedTx: DecodedTxRaw): number;
|
|
61
|
+
/**
|
|
62
|
+
* Pulls the typeUrl from the encoded message of a DecodedTxRaw
|
|
63
|
+
* @param {DecodedTxRaw} decodedTx
|
|
64
|
+
* @returns {string} cosmos proto type url
|
|
65
|
+
*/
|
|
66
|
+
getTypeUrlFromDecodedTx(decodedTx: DecodedTxRaw): string;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the fee data from the decoded transaction
|
|
69
|
+
* @param {DecodedTxRaw} decodedTx
|
|
70
|
+
* @returns {FeeData} fee data
|
|
71
|
+
*/
|
|
72
|
+
getGasBudgetFromDecodedTx(decodedTx: DecodedTxRaw): FeeData;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the publicKey from the decoded transaction
|
|
75
|
+
* @param {DecodedTxRaw} decodedTx
|
|
76
|
+
* @returns {string | undefined} publicKey in hex format if it exists, undefined otherwise
|
|
77
|
+
*/
|
|
78
|
+
getPublicKeyFromDecodedTx(decodedTx: DecodedTxRaw): string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the array of MessageData[] from the decoded transaction
|
|
81
|
+
* @param {DecodedTxRaw} decodedTx
|
|
82
|
+
* @returns {MessageData[]} Send transaction message data
|
|
83
|
+
*/
|
|
84
|
+
protected getSendMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData<CustomMessage>[];
|
|
85
|
+
/**
|
|
86
|
+
* Returns the array of MessageData[] from the decoded transaction
|
|
87
|
+
* @param {DecodedTxRaw} decodedTx
|
|
88
|
+
* @returns {MessageData[]} Delegate of undelegate transaction message data
|
|
89
|
+
*/
|
|
90
|
+
getDelegateOrUndelegateMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData<CustomMessage>[];
|
|
91
|
+
/**
|
|
92
|
+
* Returns the array of MessageData[] from the decoded transaction
|
|
93
|
+
* @param {DecodedTxRaw} decodedTx
|
|
94
|
+
* @returns {MessageData[]} Redelegate transaction message data
|
|
95
|
+
*/
|
|
96
|
+
getRedelegateMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData<CustomMessage>[];
|
|
97
|
+
/**
|
|
98
|
+
* Returns the array of MessageData[] from the decoded transaction
|
|
99
|
+
* @param {DecodedTxRaw} decodedTx
|
|
100
|
+
* @returns {MessageData[]} WithdrawDelegatorRewards transaction message data
|
|
101
|
+
*/
|
|
102
|
+
getWithdrawRewardsMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData<CustomMessage>[];
|
|
103
|
+
/**
|
|
104
|
+
* Returns the array of MessageData[] from the decoded transaction
|
|
105
|
+
* @param {DecodedTxRaw} decodedTx
|
|
106
|
+
* @returns {MessageData[]} Delegate of undelegate transaction message data
|
|
107
|
+
*/
|
|
108
|
+
getWithdrawDelegatorRewardsMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData<CustomMessage>[];
|
|
109
|
+
/**
|
|
110
|
+
* Get a cosmos chain address from its equivalent hex
|
|
111
|
+
* @param {string} prefix
|
|
112
|
+
* @param {string} addressHex
|
|
113
|
+
* @returns {string}
|
|
114
|
+
*/
|
|
115
|
+
getCosmosLikeAddressFromHex(prefix: string, addressHex: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Get a EVM chain address from its equivalent hex
|
|
118
|
+
* @param {string} prefix
|
|
119
|
+
* @param {string} addressHex
|
|
120
|
+
* @returns {string}
|
|
121
|
+
*/
|
|
122
|
+
getEvmLikeAddressFromCosmos(cosmosLikeAddress: string): string;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the array of MessageData[] from the decoded transaction
|
|
125
|
+
* @param {DecodedTxRaw} decodedTx
|
|
126
|
+
* @returns {MessageData[]} Execute contract transaction message data
|
|
127
|
+
*/
|
|
128
|
+
getExecuteContractMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData<CustomMessage>[];
|
|
129
|
+
/**
|
|
130
|
+
* Returns the array of MessageData[] from the decoded transaction
|
|
131
|
+
* @param {DecodedTxRaw} decodedTx
|
|
132
|
+
* @returns {MessageData[]} Custom transaction message data
|
|
133
|
+
*/
|
|
134
|
+
getCustomMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData<CustomMessage>[];
|
|
135
|
+
/**
|
|
136
|
+
* Determines bitgo transaction type based on cosmos proto type url
|
|
137
|
+
* @param {string} typeUrl
|
|
138
|
+
* @returns {TransactionType | undefined} TransactionType if url is supported else undefined
|
|
139
|
+
*/
|
|
140
|
+
getTransactionTypeFromTypeUrl(typeUrl: string): TransactionType | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Takes a hex encoded pubkey, converts it to the Amino JSON representation (type/value wrapper)
|
|
143
|
+
* and returns it as protobuf `Any`
|
|
144
|
+
* @param {string} pubkey hex encoded compressed secp256k1 public key
|
|
145
|
+
* @returns {Any} pubkey encoded as protobuf `Any`
|
|
146
|
+
*/
|
|
147
|
+
getEncodedPubkey(pubkey: string): Any;
|
|
148
|
+
/**
|
|
149
|
+
* Gets the send messages used in the final step of encoding a transaction. This allows for any final processing needed.
|
|
150
|
+
* @param {CosmosLikeTransaction} cosmosLikeTransaction transaction to get send messages from
|
|
151
|
+
* @returns {Any[]} processed send messages
|
|
152
|
+
*/
|
|
153
|
+
getSendMessagesForEncodingTx(cosmosLikeTransaction: CosmosLikeTransaction<CustomMessage>): Any[];
|
|
154
|
+
/**
|
|
155
|
+
* Creates a txRaw from an cosmos like transaction @see CosmosLikeTransaction
|
|
156
|
+
* @Precondition cosmosLikeTransaction.publicKey must be defined
|
|
157
|
+
* @param {CosmosLikeTransaction} cosmosLikeTransaction
|
|
158
|
+
* @returns {TxRaw} Unsigned raw transaction
|
|
159
|
+
*/
|
|
160
|
+
createTxRawFromCosmosLikeTransaction(cosmosLikeTransaction: CosmosLikeTransaction<CustomMessage>): TxRaw;
|
|
161
|
+
/**
|
|
162
|
+
* Encodes a signature into a txRaw
|
|
163
|
+
* @param {string} publicKeyHex publicKey in hex encoded string format
|
|
164
|
+
* @param {string} signatureHex signature in hex encoded string format
|
|
165
|
+
* @param {TxRaw} unsignedTx raw transaction
|
|
166
|
+
* @returns {TxRaw} Signed raw transaction
|
|
167
|
+
*/
|
|
168
|
+
createSignedTxRaw(publicKeyHex: string, signatureHex: string, unsignedTx: {
|
|
169
|
+
bodyBytes: Uint8Array;
|
|
170
|
+
authInfoBytes: Uint8Array;
|
|
171
|
+
}): TxRaw;
|
|
172
|
+
/**
|
|
173
|
+
* Decodes a raw transaction into a DecodedTxRaw and checks if it has non empty signatures
|
|
174
|
+
* @param {string} rawTransaction
|
|
175
|
+
* @returns {boolean} true if transaction is signed else false
|
|
176
|
+
*/
|
|
177
|
+
isSignedRawTx(rawTransaction: string): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Returns whether or not the string is a valid protocol public key
|
|
180
|
+
* @param {string | undefined} publicKey - the public key to be validated
|
|
181
|
+
*/
|
|
182
|
+
validatePublicKey(publicKey: string | undefined): void;
|
|
183
|
+
/**
|
|
184
|
+
* Creates a sign doc from an cosmos like transaction @see CosmosLikeTransaction
|
|
185
|
+
* @Precondition cosmosLikeTransaction.accountNumber and cosmosLikeTransaction.chainId must be defined
|
|
186
|
+
* @param {CosmosLikeTransaction} cosmosLikeTransaction
|
|
187
|
+
* @returns {SignDoc} sign doc
|
|
188
|
+
*/
|
|
189
|
+
createSignDoc(cosmosLikeTransaction: CosmosLikeTransaction<CustomMessage>, accountNumber: number | undefined, chainId: string | undefined): SignDoc;
|
|
190
|
+
/**
|
|
191
|
+
* Returns whether or not the string is a valid hex
|
|
192
|
+
* @param hexString - hex string format
|
|
193
|
+
* @returns {boolean} true if string is hex else false
|
|
194
|
+
*/
|
|
195
|
+
isValidHexString(hexString: string): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Validates the WithdrawDelegatorRewardsMessage
|
|
198
|
+
* @param {WithdrawDelegatorRewardsMessage} withdrawRewardsMessage - The WithdrawDelegatorRewardsMessage to validate.
|
|
199
|
+
* @throws {InvalidTransactionError} Throws an error if the validatorAddress or delegatorAddress is invalid or missing.
|
|
200
|
+
*/
|
|
201
|
+
validateWithdrawRewardsMessage(withdrawRewardsMessage: WithdrawDelegatorRewardsMessage): void;
|
|
202
|
+
/**
|
|
203
|
+
* Helper method to check if the specified properties in an object are missing or null.
|
|
204
|
+
* @param {Object} obj - The object to check.
|
|
205
|
+
* @param {string[]} keys - An array of property keys to check.
|
|
206
|
+
* @throws {Error} Throws an error if any of the specified properties are missing or null.
|
|
207
|
+
*/
|
|
208
|
+
isObjPropertyNull(obj: {
|
|
209
|
+
[key: string]: any;
|
|
210
|
+
}, keys: Array<string>): void;
|
|
211
|
+
/**
|
|
212
|
+
* Validates the DelegateOrUndelegeteMessage
|
|
213
|
+
* @param {DelegateOrUndelegeteMessage} delegateMessage - The DelegateOrUndelegeteMessage to validate.
|
|
214
|
+
* @throws {InvalidTransactionError} Throws an error if the validatorAddress, delegatorAddress, or amount is invalid or missing.
|
|
215
|
+
*/
|
|
216
|
+
validateDelegateOrUndelegateMessage(delegateMessage: DelegateOrUndelegeteMessage): void;
|
|
217
|
+
/**
|
|
218
|
+
* Validates the RedelegateMessage
|
|
219
|
+
* @param {DelegateOrUndelegeteMessage} redelegateMessage - The RedelegateMessage to validate.
|
|
220
|
+
* @throws {InvalidTransactionError} Throws an error if the validatorSrcAddress, validatorDstAddress, delegatorAddress, or amount is invalid or missing.
|
|
221
|
+
*/
|
|
222
|
+
validateRedelegateMessage(redelegateMessage: RedelegateMessage): void;
|
|
223
|
+
/**
|
|
224
|
+
* Validates the CustomMessage
|
|
225
|
+
* @param {CustomMessage} customMessage - The CustomMessage to validate.
|
|
226
|
+
* @throws {InvalidTransactionError} Throws an error if the custom message is invalid or missing required fields.
|
|
227
|
+
* @throws {NotSupported} Throws an error if the custom message data is not supported.
|
|
228
|
+
*/
|
|
229
|
+
validateCustomMessage(customMessage: CustomMessage): void;
|
|
230
|
+
/**
|
|
231
|
+
* Validates the MessageData
|
|
232
|
+
* @param {MessageData} messageData - The MessageData to validate.
|
|
233
|
+
* @throws {InvalidTransactionError} Throws an error if the messageData is invalid or missing required fields.
|
|
234
|
+
*/
|
|
235
|
+
validateMessageData(messageData: MessageData<CustomMessage>): void;
|
|
236
|
+
/**
|
|
237
|
+
* Validates the Cosmos-like transaction.
|
|
238
|
+
* @param {CosmosLikeTransaction} tx - The transaction to validate.
|
|
239
|
+
* @throws {InvalidTransactionError} Throws an error if the transaction is invalid or missing required fields.
|
|
240
|
+
*/
|
|
241
|
+
validateTransaction(tx: CosmosLikeTransaction<CustomMessage>): void;
|
|
242
|
+
/**
|
|
243
|
+
* Creates a Cosmos-like transaction.
|
|
244
|
+
* @param {number} sequence - The sender address sequence number for the transaction.
|
|
245
|
+
* @param {MessageData[]} messages - The array of message data for the transaction.
|
|
246
|
+
* @param {FeeData} gasBudget - The fee data for the transaction.
|
|
247
|
+
* @param {string} [publicKey] - The public key associated with the sender.
|
|
248
|
+
* @param {string} [memo] - The memo for the transaction.
|
|
249
|
+
* @returns {CosmosLikeTransaction} Returns the created Cosmos-like transaction.
|
|
250
|
+
* @throws {InvalidTransactionError} Throws an error if the created transaction is invalid.
|
|
251
|
+
*/
|
|
252
|
+
createTransaction(sequence: number, messages: MessageData<CustomMessage>[], gasBudget: FeeData, publicKey?: string, memo?: string): CosmosLikeTransaction<CustomMessage>;
|
|
253
|
+
/**
|
|
254
|
+
* Creates a Cosmos-like transaction with a hash.
|
|
255
|
+
* @param {number} sequence - The sender address sequence number for the transaction.
|
|
256
|
+
* @param {MessageData[]} messages - The array of message data for the transaction.
|
|
257
|
+
* @param {FeeData} gasBudget - The fee data for the transaction.
|
|
258
|
+
* @param {string} [publicKey] - The public key associated with the transaction.
|
|
259
|
+
* @param {Buffer} [signature] - The signature for the transaction.
|
|
260
|
+
* @param {string} [memo] - The memo for the transaction.
|
|
261
|
+
* @returns {CosmosLikeTransaction} Returns the created Cosmos-like transaction with the hash and signature if provided.
|
|
262
|
+
*/
|
|
263
|
+
createTransactionWithHash(sequence: number, messages: MessageData<CustomMessage>[], gasBudget: FeeData, publicKey?: string, signature?: Buffer, memo?: string): CosmosLikeTransaction<CustomMessage>;
|
|
264
|
+
/**
|
|
265
|
+
* Deserializes base64 enocded raw transaction string into @see CosmosLikeTransaction
|
|
266
|
+
* @param {string} rawTx base64 enocded raw transaction string
|
|
267
|
+
* @returns {CosmosLikeTransaction} Deserialized cosmosLikeTransaction
|
|
268
|
+
*/
|
|
269
|
+
deserializeTransaction(rawTx: string): CosmosLikeTransaction<CustomMessage>;
|
|
270
|
+
/**
|
|
271
|
+
* Validates an array of coin amounts.
|
|
272
|
+
* @param {Coin[]} amountArray - The array of coin amounts to validate.
|
|
273
|
+
* @param {TransactionType} transactionType - optional field for transaction type
|
|
274
|
+
*/
|
|
275
|
+
validateAmountData(amountArray: Coin[], transactionType?: TransactionType): void;
|
|
276
|
+
/**
|
|
277
|
+
* Validates the gas limit and gas amount for a transaction.
|
|
278
|
+
* @param {FeeData} gasBudget - The gas budget to validate.
|
|
279
|
+
* @throws {InvalidTransactionError} Throws an error if the gas budget is invalid.
|
|
280
|
+
*/
|
|
281
|
+
validateGasBudget(gasBudget: FeeData): void;
|
|
282
|
+
/**
|
|
283
|
+
* Validates a send message for a transaction.
|
|
284
|
+
* @param {SendMessage} sendMessage - The send message to validate.
|
|
285
|
+
* @throws {InvalidTransactionError} Throws an error if the send message is invalid.
|
|
286
|
+
*/
|
|
287
|
+
validateSendMessage(sendMessage: SendMessage): void;
|
|
288
|
+
/**
|
|
289
|
+
* Validates a coin amount.
|
|
290
|
+
* @param {Coin} amount - The coin amount to validate.
|
|
291
|
+
* @param {TransactionType} transactionType - optional field for transaction type
|
|
292
|
+
* @throws {InvalidTransactionError} Throws an error if the coin amount is invalid.
|
|
293
|
+
*/
|
|
294
|
+
validateAmount(amount: Coin, transactionType?: TransactionType): void;
|
|
295
|
+
/**
|
|
296
|
+
* Checks if a cosmos like Bech32 address matches given regular expression and
|
|
297
|
+
* validates memoId if present
|
|
298
|
+
* @param {string} address
|
|
299
|
+
* @param {RegExp} regExp Regular expression to validate the root address against after trimming the memoId
|
|
300
|
+
* @returns {boolean} true if address is valid
|
|
301
|
+
*/
|
|
302
|
+
protected isValidCosmosLikeAddressWithMemoId(address: string, regExp: RegExp): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Checks if address is valid Bech32 and matches given regular expression
|
|
305
|
+
* @param {string} address
|
|
306
|
+
* @param {RegExp} regExp Regular expression to validate the address against
|
|
307
|
+
* @returns {boolean} true if address is valid
|
|
308
|
+
*/
|
|
309
|
+
protected isValidBech32AddressMatchingRegex(address: string, regExp: RegExp): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Return boolean indicating whether a memo id is valid
|
|
312
|
+
*
|
|
313
|
+
* @param memoId memo id
|
|
314
|
+
* @returns true if memo id is valid
|
|
315
|
+
*/
|
|
316
|
+
isValidMemoId(memoId: string): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Validates if the address matches with regex @see accountAddressRegex
|
|
319
|
+
* @param {string} address
|
|
320
|
+
* @returns {boolean} - the validation result
|
|
321
|
+
*/
|
|
322
|
+
isValidValidatorAddress(address: string): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Validates if the address matches with regex @see accountAddressRegex
|
|
325
|
+
* @param {string} address
|
|
326
|
+
* @returns {boolean} - the validation result
|
|
327
|
+
*/
|
|
328
|
+
isValidAddress(address: string): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Validates if the address matches with regex @see contractAddressRegex
|
|
331
|
+
* @param {string} address
|
|
332
|
+
* @returns {boolean} - the validation result
|
|
333
|
+
*/
|
|
334
|
+
isValidContractAddress(address: string): boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Validates a execute contract message
|
|
337
|
+
* @param {ExecuteContractMessage} message - The execute contract message to validate
|
|
338
|
+
* @param {TransactionType} transactionType - optional field for transaction type
|
|
339
|
+
* @throws {InvalidTransactionError} Throws an error if the message is invalid
|
|
340
|
+
*/
|
|
341
|
+
validateExecuteContractMessage(message: ExecuteContractMessage, transactionType?: TransactionType): void;
|
|
342
|
+
/**
|
|
343
|
+
* Get coin specific hash function
|
|
344
|
+
* @returns {Hash} The hash function
|
|
345
|
+
*/
|
|
346
|
+
getHashFunction(): Hash;
|
|
347
|
+
getTokenDenomsUsingCoinFamily(coinFamily: string): string[];
|
|
348
|
+
}
|
|
349
|
+
declare const utils: CosmosUtils<never>;
|
|
350
|
+
export default utils;
|
|
351
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKT,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,YAAY,EAQb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAwB,MAAM,kBAAkB,CAAC;AAG9D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,kCAAkC,CAAC;AAEvD,OAAO,EAAc,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAKjB,qBAAa,WAAW,CAAC,aAAa,GAAG,KAAK,CAAE,YAAW,SAAS;IAClE,SAAS,CAAC,QAAQ,MAAC;;IAQnB,kBAAkB;IAClB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIrC,kBAAkB;IAClB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IASvC,kBAAkB;IAClB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAStC,kBAAkB;IAClB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI5C,kBAAkB;IAClB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI3C;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOtC;;;;;OAK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