@bitgo-beta/abstract-cosmos 1.0.1-beta.6 → 1.0.1-beta.600
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/.eslintignore +1 -1
- package/CHANGELOG.md +786 -0
- package/dist/resources/MsgCompiled.d.ts +1212 -0
- package/dist/resources/MsgCompiled.js +2761 -0
- package/dist/src/cosmosCoin.d.ts +93 -6
- package/dist/src/cosmosCoin.d.ts.map +1 -1
- package/dist/src/cosmosCoin.js +380 -119
- 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 +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 +4 -0
- package/dist/src/lib/constants.d.ts.map +1 -1
- package/dist/src/lib/constants.js +6 -2
- package/dist/src/lib/iface.d.ts +45 -4
- 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 +7 -1
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/index.js +43 -5
- package/dist/src/lib/keyPair.js +6 -7
- package/dist/src/lib/transaction.d.ts +13 -2
- package/dist/src/lib/transaction.d.ts.map +1 -1
- package/dist/src/lib/transaction.js +159 -73
- package/dist/src/lib/transactionBuilder.d.ts +31 -6
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
- package/dist/src/lib/transactionBuilder.js +99 -4
- 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 +199 -12
- package/dist/src/lib/utils.d.ts.map +1 -1
- package/dist/src/lib/utils.js +498 -33
- package/dist/tsconfig.tsbuildinfo +1 -10814
- package/package.json +13 -10
- package/resources/MsgCompiled.d.ts +1212 -0
- package/resources/MsgCompiled.js +2761 -0
package/dist/src/cosmosCoin.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { BaseCoin, BitGoBase, KeyPair, MPCAlgorithm, ParsedTransaction, ParseTransactionOptions, SignedTransaction, SignTransactionOptions, VerifyAddressOptions, VerifyTransactionOptions } from '@bitgo-beta/sdk-core';
|
|
1
|
+
import { BaseCoin, BitGoBase, ExplanationResult, KeyPair, MPCAlgorithm, ParsedTransaction, ParseTransactionOptions, SignedTransaction, SignTransactionOptions, VerifyAddressOptions, VerifyTransactionOptions } from '@bitgo-beta/sdk-core';
|
|
3
2
|
import { BaseCoin as StaticsBaseCoin, CoinFamily } from '@bitgo-beta/statics';
|
|
3
|
+
import { Buffer } from 'buffer';
|
|
4
4
|
import { Hash } from 'crypto';
|
|
5
|
+
import * as request from 'superagent';
|
|
6
|
+
import { CosmosKeyPair, CosmosLikeCoinRecoveryOutput, GasAmountDetails, RecoveryOptions } from './lib';
|
|
5
7
|
/**
|
|
6
8
|
* Cosmos accounts support memo Id based addresses
|
|
7
9
|
*/
|
|
@@ -13,6 +15,10 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
13
15
|
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
|
|
14
16
|
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
|
|
15
17
|
static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of TransactionBuilderFactory for the coin specific sdk
|
|
20
|
+
*/
|
|
21
|
+
getBuilder(): any;
|
|
16
22
|
/** @inheritDoc **/
|
|
17
23
|
getBaseFactor(): string | number;
|
|
18
24
|
/** @inheritDoc **/
|
|
@@ -29,18 +35,88 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
29
35
|
isValidPub(pub: string): boolean;
|
|
30
36
|
/** @inheritDoc **/
|
|
31
37
|
isValidPrv(prv: string): boolean;
|
|
32
|
-
verifyTransaction(params: VerifyTransactionOptions): Promise<boolean>;
|
|
33
38
|
isValidAddress(address: string): boolean;
|
|
34
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Builds a funds recovery transaction without BitGo
|
|
41
|
+
* @param {RecoveryOptions} params parameters needed to construct and
|
|
42
|
+
* (maybe) sign the transaction
|
|
43
|
+
*
|
|
44
|
+
* @returns {CosmosLikeCoinRecoveryOutput} the serialized transaction hex string and index
|
|
45
|
+
* of the address being swept
|
|
46
|
+
*/
|
|
47
|
+
recover(params: RecoveryOptions): Promise<CosmosLikeCoinRecoveryOutput>;
|
|
48
|
+
/**
|
|
49
|
+
* Builds a redelegate transaction
|
|
50
|
+
* @param {RecoveryOptions} params parameters needed to construct and
|
|
51
|
+
* (maybe) sign the transaction
|
|
52
|
+
*
|
|
53
|
+
* @returns {CosmosLikeCoinRecoveryOutput} the serialized transaction hex string
|
|
54
|
+
*/
|
|
55
|
+
redelegate(params: RecoveryOptions & {
|
|
56
|
+
validatorSrcAddress: string;
|
|
57
|
+
validatorDstAddress: string;
|
|
58
|
+
amountToRedelegate: string;
|
|
59
|
+
}): Promise<CosmosLikeCoinRecoveryOutput>;
|
|
60
|
+
/** @inheritDoc **/
|
|
61
|
+
verifyTransaction(params: VerifyTransactionOptions): Promise<boolean>;
|
|
62
|
+
/** @inheritDoc **/
|
|
63
|
+
explainTransaction(options: {
|
|
64
|
+
txHex: string;
|
|
65
|
+
}): Promise<ExplanationResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Sign a transaction with a single private key
|
|
68
|
+
* @param params parameters in the form of { txPrebuild: {txHex}, prv }
|
|
69
|
+
* @returns signed transaction in the form of { txHex }
|
|
70
|
+
*/
|
|
71
|
+
signTransaction(params: SignTransactionOptions & {
|
|
72
|
+
txPrebuild: {
|
|
73
|
+
txHex: string;
|
|
74
|
+
};
|
|
75
|
+
prv: string;
|
|
76
|
+
}): Promise<SignedTransaction>;
|
|
35
77
|
/** @inheritDoc **/
|
|
36
78
|
parseTransaction(params: ParseTransactionOptions & {
|
|
37
79
|
txHex: string;
|
|
38
80
|
}): Promise<ParsedTransaction>;
|
|
81
|
+
/**
|
|
82
|
+
* Get the public node url from the Environments constant we have defined
|
|
83
|
+
*/
|
|
84
|
+
protected getPublicNodeUrl(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Get account number from public node
|
|
87
|
+
*/
|
|
88
|
+
protected getAccountFromNode(senderAddress: string): Promise<request.Response>;
|
|
89
|
+
/**
|
|
90
|
+
* Get balance from public node
|
|
91
|
+
*/
|
|
92
|
+
protected getBalanceFromNode(senderAddress: string): Promise<request.Response>;
|
|
93
|
+
/**
|
|
94
|
+
* Get chain id from public node
|
|
95
|
+
*/
|
|
96
|
+
protected getChainIdFromNode(): Promise<request.Response>;
|
|
97
|
+
/**
|
|
98
|
+
* Helper to fetch account balance
|
|
99
|
+
*/
|
|
100
|
+
protected getAccountBalance(senderAddress: string): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Helper to fetch chainId
|
|
103
|
+
*/
|
|
104
|
+
protected getChainId(): Promise<string>;
|
|
105
|
+
/**
|
|
106
|
+
* Helper to fetch account number
|
|
107
|
+
*/
|
|
108
|
+
protected getAccountDetails(senderAddress: string): Promise<string[]>;
|
|
39
109
|
/** @inheritDoc **/
|
|
40
110
|
generateKeyPair(seed?: Buffer): KeyPair;
|
|
111
|
+
/**
|
|
112
|
+
* Retrieves the address from a public key.
|
|
113
|
+
* @param {string} pubKey - The public key.
|
|
114
|
+
* @returns {string} The corresponding address.
|
|
115
|
+
*/
|
|
41
116
|
getAddressFromPublicKey(pubKey: string): string;
|
|
42
117
|
/** @inheritDoc **/
|
|
43
118
|
isWalletAddress(params: VerifyAddressOptions): Promise<boolean>;
|
|
119
|
+
/** @inheritDoc **/
|
|
44
120
|
getHashFunction(): Hash;
|
|
45
121
|
/**
|
|
46
122
|
* Process address into address and memo id
|
|
@@ -56,8 +132,19 @@ export declare class CosmosCoin extends BaseCoin {
|
|
|
56
132
|
* @returns true if memo id is valid
|
|
57
133
|
*/
|
|
58
134
|
isValidMemoId(memoId: string): boolean;
|
|
59
|
-
|
|
60
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Helper method to return the respective coin's base unit
|
|
137
|
+
*/
|
|
138
|
+
getDenomination(): string;
|
|
139
|
+
/**
|
|
140
|
+
* Helper method to fetch gas amount details for respective coin
|
|
141
|
+
*/
|
|
142
|
+
getGasAmountDetails(): GasAmountDetails;
|
|
143
|
+
/**
|
|
144
|
+
* Helper method to get key pair for individual coin
|
|
145
|
+
* @param publicKey
|
|
146
|
+
*/
|
|
147
|
+
getKeyPair(publicKey: string): CosmosKeyPair;
|
|
61
148
|
}
|
|
62
149
|
export {};
|
|
63
150
|
//# 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,QAAQ,EAER,SAAS,EAGT,iBAAiB,EAGjB,OAAO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