@bitgo-beta/sdk-coin-atom 1.1.2-alpha.8 → 1.1.2-alpha.80

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/CHANGELOG.md +440 -0
  2. package/dist/src/atom.d.ts +12 -38
  3. package/dist/src/atom.d.ts.map +1 -1
  4. package/dist/src/atom.js +20 -161
  5. package/dist/src/lib/constants.d.ts +3 -6
  6. package/dist/src/lib/constants.d.ts.map +1 -1
  7. package/dist/src/lib/constants.js +7 -10
  8. package/dist/src/lib/index.d.ts +3 -5
  9. package/dist/src/lib/index.d.ts.map +1 -1
  10. package/dist/src/lib/index.js +11 -10
  11. package/dist/src/lib/keyPair.d.ts +3 -12
  12. package/dist/src/lib/keyPair.d.ts.map +1 -1
  13. package/dist/src/lib/keyPair.js +5 -49
  14. package/dist/src/lib/transactionBuilderFactory.d.ts +7 -11
  15. package/dist/src/lib/transactionBuilderFactory.d.ts.map +1 -1
  16. package/dist/src/lib/transactionBuilderFactory.js +16 -11
  17. package/dist/src/lib/utils.d.ts +5 -158
  18. package/dist/src/lib/utils.d.ts.map +1 -1
  19. package/dist/src/lib/utils.js +9 -475
  20. package/dist/src/tatom.d.ts +0 -8
  21. package/dist/src/tatom.d.ts.map +1 -1
  22. package/dist/src/tatom.js +1 -13
  23. package/package.json +10 -13
  24. package/dist/src/lib/StakingActivateBuilder.d.ts +0 -11
  25. package/dist/src/lib/StakingActivateBuilder.d.ts.map +0 -1
  26. package/dist/src/lib/StakingActivateBuilder.js +0 -31
  27. package/dist/src/lib/StakingDeactivateBuilder.d.ts +0 -11
  28. package/dist/src/lib/StakingDeactivateBuilder.d.ts.map +0 -1
  29. package/dist/src/lib/StakingDeactivateBuilder.js +0 -31
  30. package/dist/src/lib/StakingWithdrawRewardsBuilder.d.ts +0 -11
  31. package/dist/src/lib/StakingWithdrawRewardsBuilder.d.ts.map +0 -1
  32. package/dist/src/lib/StakingWithdrawRewardsBuilder.js +0 -31
  33. package/dist/src/lib/iface.d.ts +0 -45
  34. package/dist/src/lib/iface.d.ts.map +0 -1
  35. package/dist/src/lib/iface.js +0 -3
  36. package/dist/src/lib/transaction.d.ts +0 -57
  37. package/dist/src/lib/transaction.d.ts.map +0 -1
  38. package/dist/src/lib/transaction.js +0 -202
  39. package/dist/src/lib/transactionBuilder.d.ts +0 -76
  40. package/dist/src/lib/transactionBuilder.d.ts.map +0 -1
  41. package/dist/src/lib/transactionBuilder.js +0 -173
  42. package/dist/src/lib/transferBuilder.d.ts +0 -11
  43. package/dist/src/lib/transferBuilder.d.ts.map +0 -1
  44. package/dist/src/lib/transferBuilder.js +0 -31
@@ -1,167 +1,14 @@
1
- /// <reference types="node" />
2
- import { BaseUtils, TransactionType } from '@bitgo-beta/sdk-core';
3
- import { DecodedTxRaw } from '@cosmjs/proto-signing';
1
+ import { CosmosUtils } from '@bitgo-beta/abstract-cosmos';
4
2
  import { Coin } from '@cosmjs/stargate';
5
- import { SignDoc, TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
6
- import { AtomTransaction, DelegateOrUndelegeteMessage, FeeData, MessageData, SendMessage, WithdrawDelegatorRewardsMessage } from './iface';
7
- export declare class Utils implements BaseUtils {
8
- private registry;
3
+ export declare class Utils extends CosmosUtils {
9
4
  /** @inheritdoc */
10
- isValidBlockId(hash: string): boolean;
11
- /** @inheritdoc */
12
- isValidPrivateKey(key: string): boolean;
5
+ isValidAddress(address: string): boolean;
13
6
  /** @inheritdoc */
14
- isValidPublicKey(key: string): boolean;
7
+ isValidValidatorAddress(address: string): boolean;
15
8
  /** @inheritdoc */
16
- isValidSignature(signature: string): boolean;
9
+ isValidContractAddress(address: string): boolean;
17
10
  /** @inheritdoc */
18
- isValidTransactionId(txId: string): boolean;
19
- /**
20
- * Checks if transaction hash is in valid black2b format
21
- */
22
- validateBlake2b(hash: string): boolean;
23
- /**
24
- * Validates if the address matches with regex @see accountAddressRegex
25
- *
26
- * @param {string} address
27
- * @returns {boolean} - the validation result
28
- */
29
- isValidAddress(address: string): boolean;
30
- /**
31
- * Validates if the address matches with regex @see accountAddressRegex
32
- *
33
- * @param {string} address
34
- * @returns {boolean} - the validation result
35
- */
36
- isValidValidatorAddress(address: string): boolean;
37
- /**
38
- * Validates whether amounts are in range
39
- *
40
- * @param {number[]} amounts - the amounts to validate
41
- * @returns {boolean} - the validation result
42
- */
43
- isValidAmounts(amounts: number[]): boolean;
44
- /**
45
- * Validates whether amount is in range
46
- * @param {number} amount
47
- * @returns {boolean} the validation result
48
- */
49
- isValidAmount(amount: number): boolean;
50
- /**
51
- * Decodes raw tx data into messages, signing info, and fee data
52
- * @param {string} txHex - raw base64 tx
53
- * @returns {DecodedTxRaw} Decoded transaction
54
- */
55
- getDecodedTxFromRawBase64(txRaw: string): DecodedTxRaw;
56
- /**
57
- * Returns the array of messages in the body of the decoded transaction
58
- * @param {DecodedTxRaw} decodedTx
59
- * @returns {EncodeObject[]} messages along with type url
60
- */
61
- private getEncodedMessagesFromDecodedTx;
62
- /**
63
- * Pulls the sequence number from a DecodedTxRaw AuthInfo property
64
- * @param {DecodedTxRaw} decodedTx
65
- * @returns {number} sequence
66
- */
67
- getSequenceFromDecodedTx(decodedTx: DecodedTxRaw): number;
68
- /**
69
- * Pulls the typeUrl from the encoded message of a DecodedTxRaw
70
- * @param {DecodedTxRaw} decodedTx
71
- * @returns {string} cosmos proto type url
72
- */
73
- getTypeUrlFromDecodedTx(decodedTx: DecodedTxRaw): string;
74
- /**
75
- * Returns the fee data from the decoded transaction
76
- * @param {DecodedTxRaw} decodedTx
77
- * @returns {FeeData} fee data
78
- */
79
- getGasBudgetFromDecodedTx(decodedTx: DecodedTxRaw): FeeData;
80
- /**
81
- * Returns the publicKey from the decoded transaction
82
- * @param {DecodedTxRaw} decodedTx
83
- * @returns {string | undefined} publicKey in hex format if it exists, undefined otherwise
84
- */
85
- getPublicKeyFromDecodedTx(decodedTx: DecodedTxRaw): string | undefined;
86
- /**
87
- * Returns the array of MessageData[] from the decoded transaction
88
- * @param {DecodedTxRaw} decodedTx
89
- * @returns {MessageData[]} Send transaction message data
90
- */
91
- getSendMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData[];
92
- /**
93
- * Returns the array of MessageData[] from the decoded transaction
94
- * @param {DecodedTxRaw} decodedTx
95
- * @returns {MessageData[]} Delegate of undelegate transaction message data
96
- */
97
- getDelegateOrUndelegateMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData[];
98
- /**
99
- * Returns the array of MessageData[] from the decoded transaction
100
- * @param {DecodedTxRaw} decodedTx
101
- * @returns {MessageData[]} WithdrawDelegatorRewards transaction message data
102
- */
103
- getWithdrawRewardsMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData[];
104
- /**
105
- * Returns the array of MessageData[] from the decoded transaction
106
- * @param {DecodedTxRaw} decodedTx
107
- * @returns {MessageData[]} Delegate of undelegate transaction message data
108
- */
109
- getWithdrawDelegatorRewardsMessageDataFromDecodedTx(decodedTx: DecodedTxRaw): MessageData[];
110
- /**
111
- * Determines bitgo transaction type based on cosmos proto type url
112
- * @param {string} typeUrl
113
- * @returns {TransactionType | undefined} TransactionType if url is supported else undefined
114
- */
115
- getTransactionTypeFromTypeUrl(typeUrl: string): TransactionType | undefined;
116
- /**
117
- * Creates a txRaw from an atom transaction @see AtomTransaction
118
- * @Precondition atomTransaction.publicKey must be defined
119
- * @param {AtomTransaction} atomTransaction
120
- * @returns {TxRaw} Unsigned raw transaction
121
- */
122
- createTxRawFromAtomTransaction(atomTransaction: AtomTransaction): TxRaw;
123
- /**
124
- * Encodes a signature into a txRaw
125
- * @param {string} publicKeyHex publicKey in hex encoded string format
126
- * @param {string} signatureHex signature in hex encoded string format
127
- * @param {TxRaw} unsignedTx raw transaction
128
- * @returns {TxRaw} Signed raw transaction
129
- */
130
- createSignedTxRaw(publicKeyHex: string, signatureHex: string, unsignedTx: {
131
- bodyBytes: Uint8Array;
132
- authInfoBytes: Uint8Array;
133
- }): TxRaw;
134
- /**
135
- * Decodes a raw transaction into a DecodedTxRaw and checks if it has non empty signatures
136
- * @param {string} rawTransaction
137
- * @returns {boolean} true if transaction is signed else false
138
- */
139
- isSignedRawTx(rawTransaction: string): boolean;
140
- /**
141
- * Deserializes base64 enocded raw transaction string into @see AtomTransaction
142
- * @param {string} rawTx base64 enocded raw transaction string
143
- * @returns {AtomTransaction} Deserialized atomTransaction
144
- */
145
- deserializeAtomTransaction(rawTx: string): AtomTransaction;
146
- createAtomTransaction(sequence: number, messages: MessageData[], gasBudget: FeeData, publicKey: string | undefined): AtomTransaction;
147
- createAtomTransactionWithHash(sequence: number, messages: MessageData[], gasBudget: FeeData, publicKey: string | undefined, signature: Buffer | undefined): AtomTransaction;
148
- validateAtomTransaction(tx: AtomTransaction): void;
149
- validateMessageData(messageData: MessageData): void;
150
- validateAmountData(amountArray: Coin[]): void;
151
11
  validateAmount(amount: Coin): void;
152
- validateGasBudget(gasBudget: FeeData): void;
153
- validateSequence(sequence: number): void;
154
- validatePublicKey(publicKey: string | undefined): void;
155
- /**
156
- * Creates a sign doc from an atom transaction @see AtomTransaction
157
- * @Precondition atomTransaction.accountNumber and atomTransaction.chainId must be defined
158
- * @param {AtomTransaction} atomTransaction
159
- * @returns {SignDoc} sign doc
160
- */
161
- createSignDoc(atomTransaction: AtomTransaction, accountNumber: number | undefined, chainId: string | undefined): SignDoc;
162
- validateDelegateOrUndelegateMessage(delegateMessage: DelegateOrUndelegeteMessage): void;
163
- validateWithdrawRewardsMessage(withdrawRewardsMessage: WithdrawDelegatorRewardsMessage): void;
164
- validateSendMessage(sendMessage: SendMessage): void;
165
12
  }
166
13
  declare const utils: Utils;
167
14
  export default utils;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EAIT,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,YAA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