@bitgo-beta/abstract-cosmos 1.0.1-beta.19 → 1.0.1-beta.1900
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/resources/MsgCompiled.d.ts +1212 -0
- package/dist/resources/MsgCompiled.js +2761 -0
- package/dist/resources/ProposalCompiled.d.ts +314 -0
- package/dist/resources/ProposalCompiled.js +1090 -0
- package/dist/src/cosmosCoin.d.ts +87 -9
- package/dist/src/cosmosCoin.d.ts.map +1 -1
- package/dist/src/cosmosCoin.js +406 -34
- package/dist/src/index.js +6 -2
- 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 +75 -0
- package/dist/src/lib/StakingActivateBuilder.d.ts +3 -3
- package/dist/src/lib/StakingActivateBuilder.d.ts.map +1 -1
- package/dist/src/lib/StakingActivateBuilder.js +35 -2
- package/dist/src/lib/StakingDeactivateBuilder.d.ts +3 -3
- package/dist/src/lib/StakingDeactivateBuilder.d.ts.map +1 -1
- package/dist/src/lib/StakingDeactivateBuilder.js +35 -2
- 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 +3 -3
- package/dist/src/lib/StakingWithdrawRewardsBuilder.d.ts.map +1 -1
- package/dist/src/lib/StakingWithdrawRewardsBuilder.js +35 -2
- package/dist/src/lib/constants.d.ts +6 -0
- package/dist/src/lib/constants.d.ts.map +1 -1
- package/dist/src/lib/constants.js +8 -2
- package/dist/src/lib/iface.d.ts +71 -7
- package/dist/src/lib/iface.d.ts.map +1 -1
- package/dist/src/lib/iface.js +18 -1
- package/dist/src/lib/index.d.ts +2 -0
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/index.js +34 -4
- package/dist/src/lib/keyPair.js +9 -10
- package/dist/src/lib/protobuf-init.d.ts +9 -0
- package/dist/src/lib/protobuf-init.d.ts.map +1 -0
- package/dist/src/lib/protobuf-init.js +25 -0
- package/dist/src/lib/transaction.d.ts +8 -9
- package/dist/src/lib/transaction.d.ts.map +1 -1
- package/dist/src/lib/transaction.js +151 -70
- package/dist/src/lib/transactionBuilder.d.ts +28 -17
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
- package/dist/src/lib/transactionBuilder.js +33 -8
- package/dist/src/lib/transferBuilder.d.ts +3 -3
- package/dist/src/lib/transferBuilder.d.ts.map +1 -1
- package/dist/src/lib/transferBuilder.js +35 -2
- package/dist/src/lib/utils.d.ts +143 -18
- package/dist/src/lib/utils.d.ts.map +1 -1
- package/dist/src/lib/utils.js +452 -31
- package/dist/tsconfig.tsbuildinfo +1 -10990
- package/package.json +17 -11
- package/.eslintignore +0 -5
- package/.mocharc.yml +0 -8
- package/CHANGELOG.md +0 -17
package/dist/src/cosmosCoin.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { BaseCoin
|
|
3
|
-
import {
|
|
1
|
+
import { AuditDecryptedKeyParams, BaseCoin, BitGoBase, ExplanationResult, KeyPair, MPCAlgorithm, MultisigType, ParsedTransaction, ParseTransactionOptions, SignedTransaction, SignTransactionOptions, VerifyAddressOptions, VerifyTransactionOptions } from '@bitgo-beta/sdk-core';
|
|
2
|
+
import { BaseCoin as StaticsBaseCoin, CoinFamily } from '@bitgo-beta/statics';
|
|
3
|
+
import { Coin } from '@cosmjs/stargate';
|
|
4
|
+
import { Buffer } from 'buffer';
|
|
4
5
|
import { Hash } from 'crypto';
|
|
5
6
|
import * as request from 'superagent';
|
|
7
|
+
import { CosmosKeyPair, CosmosLikeCoinRecoveryOutput, CosmosTransaction, GasAmountDetails, RecoveryOptions, CosmosTransactionBuilder, KeyShares } from './lib';
|
|
6
8
|
/**
|
|
7
9
|
* Cosmos accounts support memo Id based addresses
|
|
8
10
|
*/
|
|
@@ -10,7 +12,7 @@ interface AddressDetails {
|
|
|
10
12
|
address: string;
|
|
11
13
|
memoId?: string | undefined;
|
|
12
14
|
}
|
|
13
|
-
export declare class CosmosCoin extends BaseCoin {
|
|
15
|
+
export declare class CosmosCoin<CustomMessage = never> extends BaseCoin {
|
|
14
16
|
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
|
|
15
17
|
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
|
|
16
18
|
static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
|
|
@@ -28,6 +30,8 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
28
30
|
getFullName(): string;
|
|
29
31
|
/** @inheritDoc */
|
|
30
32
|
supportsTss(): boolean;
|
|
33
|
+
/** inherited doc */
|
|
34
|
+
getDefaultMultisigType(): MultisigType;
|
|
31
35
|
/** @inheritDoc **/
|
|
32
36
|
getMPCAlgorithm(): MPCAlgorithm;
|
|
33
37
|
/** @inheritDoc **/
|
|
@@ -35,6 +39,68 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
35
39
|
/** @inheritDoc **/
|
|
36
40
|
isValidPrv(prv: string): boolean;
|
|
37
41
|
isValidAddress(address: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Builds a funds recovery transaction without BitGo
|
|
44
|
+
* @param {RecoveryOptions} params parameters needed to construct and
|
|
45
|
+
* (maybe) sign the transaction
|
|
46
|
+
*
|
|
47
|
+
* @returns {CosmosLikeCoinRecoveryOutput} the serialized transaction hex string and index
|
|
48
|
+
* of the address being swept
|
|
49
|
+
*/
|
|
50
|
+
recover(params: RecoveryOptions): Promise<CosmosLikeCoinRecoveryOutput>;
|
|
51
|
+
/**
|
|
52
|
+
* Validates the recovery parameters
|
|
53
|
+
*/
|
|
54
|
+
private validateRecoveryParams;
|
|
55
|
+
/**
|
|
56
|
+
* Checks if this is an unsigned sweep operation
|
|
57
|
+
*/
|
|
58
|
+
private isUnsignedSweep;
|
|
59
|
+
/**
|
|
60
|
+
* Gets sender details including address, public key and key shares
|
|
61
|
+
*/
|
|
62
|
+
private getSenderDetails;
|
|
63
|
+
/**
|
|
64
|
+
* Gets key shares from recovery parameters
|
|
65
|
+
*/
|
|
66
|
+
private getKeyShares;
|
|
67
|
+
/**
|
|
68
|
+
* Processes account balances and validates sufficient funds
|
|
69
|
+
*/
|
|
70
|
+
private processBalances;
|
|
71
|
+
/**
|
|
72
|
+
* Builds transaction messages for all balances
|
|
73
|
+
*/
|
|
74
|
+
private buildTransactionMessages;
|
|
75
|
+
/**
|
|
76
|
+
* Builds and signs the transaction
|
|
77
|
+
*/
|
|
78
|
+
private buildAndSignTransaction;
|
|
79
|
+
/**
|
|
80
|
+
* Signs the transaction with MPC
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* Signs the transaction using MPC (Multi-Party Computation)
|
|
84
|
+
* @param unsignedTransaction The unsigned transaction to sign
|
|
85
|
+
* @param txnBuilder The transaction builder instance
|
|
86
|
+
* @param keyShares The key shares for MPC signing
|
|
87
|
+
* @param publicKey The public key for verification
|
|
88
|
+
* @returns The signed transaction output
|
|
89
|
+
* @throws Error if validation fails or signing process encounters an error
|
|
90
|
+
*/
|
|
91
|
+
protected signTransactionWithMpc(unsignedTransaction: CosmosTransaction<CustomMessage>, txnBuilder: CosmosTransactionBuilder, keyShares: KeyShares, publicKey: string): Promise<CosmosLikeCoinRecoveryOutput>;
|
|
92
|
+
/**
|
|
93
|
+
* Builds a redelegate transaction
|
|
94
|
+
* @param {RecoveryOptions} params parameters needed to construct and
|
|
95
|
+
* (maybe) sign the transaction
|
|
96
|
+
*
|
|
97
|
+
* @returns {CosmosLikeCoinRecoveryOutput} the serialized transaction hex string
|
|
98
|
+
*/
|
|
99
|
+
redelegate(params: RecoveryOptions & {
|
|
100
|
+
validatorSrcAddress: string;
|
|
101
|
+
validatorDstAddress: string;
|
|
102
|
+
amountToRedelegate: string;
|
|
103
|
+
}): Promise<CosmosLikeCoinRecoveryOutput>;
|
|
38
104
|
/** @inheritDoc **/
|
|
39
105
|
verifyTransaction(params: VerifyTransactionOptions): Promise<boolean>;
|
|
40
106
|
/** @inheritDoc **/
|
|
@@ -75,7 +141,7 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
75
141
|
/**
|
|
76
142
|
* Helper to fetch account balance
|
|
77
143
|
*/
|
|
78
|
-
protected getAccountBalance(senderAddress: string): Promise<
|
|
144
|
+
protected getAccountBalance(senderAddress: string): Promise<Coin[]>;
|
|
79
145
|
/**
|
|
80
146
|
* Helper to fetch chainId
|
|
81
147
|
*/
|
|
@@ -94,10 +160,7 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
94
160
|
getAddressFromPublicKey(pubKey: string): string;
|
|
95
161
|
/** @inheritDoc **/
|
|
96
162
|
isWalletAddress(params: VerifyAddressOptions): Promise<boolean>;
|
|
97
|
-
/**
|
|
98
|
-
* Retrieves the SHA256 hash function.
|
|
99
|
-
* @returns {Hash} The SHA256 hash function.
|
|
100
|
-
*/
|
|
163
|
+
/** @inheritDoc **/
|
|
101
164
|
getHashFunction(): Hash;
|
|
102
165
|
/**
|
|
103
166
|
* Process address into address and memo id
|
|
@@ -113,6 +176,21 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
113
176
|
* @returns true if memo id is valid
|
|
114
177
|
*/
|
|
115
178
|
isValidMemoId(memoId: string): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Helper method to return the respective coin's base unit
|
|
181
|
+
*/
|
|
182
|
+
getDenomination(): string;
|
|
183
|
+
/**
|
|
184
|
+
* Helper method to fetch gas amount details for respective coin
|
|
185
|
+
*/
|
|
186
|
+
getGasAmountDetails(): GasAmountDetails;
|
|
187
|
+
/**
|
|
188
|
+
* Helper method to get key pair for individual coin
|
|
189
|
+
* @param publicKey
|
|
190
|
+
*/
|
|
191
|
+
getKeyPair(publicKey: string): CosmosKeyPair;
|
|
192
|
+
/** @inheritDoc **/
|
|
193
|
+
auditDecryptedKey({ multiSigType, publicKey, prv }: AuditDecryptedKeyParams): void;
|
|
116
194
|
}
|
|
117
195
|
export {};
|
|
118
196
|
//# sourceMappingURL=cosmosCoin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmosCoin.d.ts","sourceRoot":"","sources":["../../src/cosmosCoin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cosmosCoin.d.ts","sourceRoot":"","sources":["../../src/cosmosCoin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,QAAQ,EAER,SAAS,EAGT,iBAAiB,EAGjB,OAAO,EACP,YAAY,EACZ,YAAY,EAEZ,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EAEjB,sBAAsB,EAGtB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAc,IAAI,EAAe,MAAM,QAAQ,CAAC;AAGvD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,iBAAiB,EAEjB,gBAAgB,EAChB,eAAe,EAGf,wBAAwB,EACxB,SAAS,EAGV,MAAM,OAAO,CAAC;AAKf;;GAEG;AACH,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AASD,qBAAa,UAAU,CAAC,aAAa,GAAG,KAAK,CAAE,SAAQ,QAAQ;IAC7D,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,eAAe,CAAC,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