@airgap/cosmos-core 0.13.11-beta.14
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/LICENSE.md +7 -0
- package/README.md +11 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +59 -0
- package/v1/index.d.ts +18 -0
- package/v1/index.js +29 -0
- package/v1/index.js.map +1 -0
- package/v1/node/CosmosNodeClient.d.ts +29 -0
- package/v1/node/CosmosNodeClient.js +383 -0
- package/v1/node/CosmosNodeClient.js.map +1 -0
- package/v1/protocol/CosmosBaseProtocol.d.ts +109 -0
- package/v1/protocol/CosmosBaseProtocol.js +1005 -0
- package/v1/protocol/CosmosBaseProtocol.js.map +1 -0
- package/v1/protocol/CosmosCryptoClient.d.ts +8 -0
- package/v1/protocol/CosmosCryptoClient.js +90 -0
- package/v1/protocol/CosmosCryptoClient.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +37 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +4 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +100 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json +19 -0
- package/v1/serializer/v3/validators/transaction-validators.d.ts +7 -0
- package/v1/serializer/v3/validators/transaction-validators.js +88 -0
- package/v1/serializer/v3/validators/transaction-validators.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/data/CosmosAddress.d.ts +7 -0
- package/v1/types/data/CosmosAddress.js +30 -0
- package/v1/types/data/CosmosAddress.js.map +1 -0
- package/v1/types/data/CosmosCoin.d.ts +18 -0
- package/v1/types/data/CosmosCoin.js +56 -0
- package/v1/types/data/CosmosCoin.js.map +1 -0
- package/v1/types/data/CosmosFee.d.ts +15 -0
- package/v1/types/data/CosmosFee.js +31 -0
- package/v1/types/data/CosmosFee.js.map +1 -0
- package/v1/types/data/transaction/CosmosTransaction.d.ts +36 -0
- package/v1/types/data/transaction/CosmosTransaction.js +109 -0
- package/v1/types/data/transaction/CosmosTransaction.js.map +1 -0
- package/v1/types/data/transaction/message/CosmosDelegateMessage.d.ts +19 -0
- package/v1/types/data/transaction/message/CosmosDelegateMessage.js +70 -0
- package/v1/types/data/transaction/message/CosmosDelegateMessage.js.map +1 -0
- package/v1/types/data/transaction/message/CosmosMessage.d.ts +38 -0
- package/v1/types/data/transaction/message/CosmosMessage.js +47 -0
- package/v1/types/data/transaction/message/CosmosMessage.js.map +1 -0
- package/v1/types/data/transaction/message/CosmosSendMessage.d.ts +19 -0
- package/v1/types/data/transaction/message/CosmosSendMessage.js +83 -0
- package/v1/types/data/transaction/message/CosmosSendMessage.js.map +1 -0
- package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.d.ts +23 -0
- package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +61 -0
- package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
- package/v1/types/protocol.d.ts +10 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/rpc.d.ts +286 -0
- package/v1/types/rpc.js +3 -0
- package/v1/types/rpc.js.map +1 -0
- package/v1/types/transaction.d.ts +50 -0
- package/v1/types/transaction.js +18 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/key.d.ts +3 -0
- package/v1/utils/key.js +20 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/signature.d.ts +2 -0
- package/v1/utils/signature.js +13 -0
- package/v1/utils/signature.js.map +1 -0
- package/v1/utils/transaction.d.ts +1 -0
- package/v1/utils/transaction.js +8 -0
- package/v1/utils/transaction.js.map +1 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { DelegateeDetails, DelegatorDetails } from '@airgap/coinlib-core';
|
|
2
|
+
import { DelegationDetails } from '@airgap/coinlib-core/src/protocols/ICoinDelegateProtocol';
|
|
3
|
+
import { Address, AirGapProtocol, FeeDefaults, KeyPair, PublicKey, SecretKey, Amount, AirGapTransaction, AirGapTransactionsWithCursor, Balance, CryptoDerivative, ProtocolMetadata, Signature, TransactionConfiguration, TransactionDetails } from '@airgap/module-kit';
|
|
4
|
+
import { CosmosCryptoConfiguration } from '../types/crypto';
|
|
5
|
+
import { CosmosTransaction } from '../types/data/transaction/CosmosTransaction';
|
|
6
|
+
import { CosmosProtocolNetwork, CosmosProtocolOptions } from '../types/protocol';
|
|
7
|
+
import { CosmosDelegation, CosmosUnbondingDelegation, CosmosValidator } from '../types/rpc';
|
|
8
|
+
import { CosmosDelegationActionType, CosmosSignedTransaction, CosmosTransactionCursor, CosmosUnsignedTransaction } from '../types/transaction';
|
|
9
|
+
export interface CosmosBaseProtocol<_Units extends string> extends AirGapProtocol<{
|
|
10
|
+
AddressResult: Address;
|
|
11
|
+
ProtocolNetwork: CosmosProtocolNetwork;
|
|
12
|
+
CryptoConfiguration: CosmosCryptoConfiguration;
|
|
13
|
+
SignedTransaction: CosmosSignedTransaction;
|
|
14
|
+
TransactionCursor: CosmosTransactionCursor;
|
|
15
|
+
Units: _Units;
|
|
16
|
+
FeeEstimation: FeeDefaults<_Units>;
|
|
17
|
+
UnsignedTransaction: CosmosUnsignedTransaction;
|
|
18
|
+
}, 'Crypto', 'FetchDataForAddress'> {
|
|
19
|
+
getKeyPairFromSecretKey(secretKey: SecretKey): Promise<KeyPair>;
|
|
20
|
+
}
|
|
21
|
+
export interface CosmosBaseStakingProtocol<_Units extends string> extends CosmosBaseProtocol<_Units> {
|
|
22
|
+
getDefaultDelegatee(): Promise<Address>;
|
|
23
|
+
getCurrentDelegateesForPublicKey(publicKey: PublicKey): Promise<Address[]>;
|
|
24
|
+
getCurrentDelegateesForAddress(address: string): Promise<Address[]>;
|
|
25
|
+
getDelegateeDetails(address: string): Promise<DelegateeDetails>;
|
|
26
|
+
isPublicKeyDelegating(publicKey: PublicKey): Promise<boolean>;
|
|
27
|
+
isAddressDelegating(address: string): Promise<boolean>;
|
|
28
|
+
getDelegatorDetailsFromPublicKey(publicKey: PublicKey): Promise<DelegatorDetails>;
|
|
29
|
+
getDelegatorDetailsFromAddress(address: string): Promise<DelegatorDetails>;
|
|
30
|
+
getDelegationDetailsFromPublicKey(publicKey: PublicKey, delegatees: string[]): Promise<DelegationDetails>;
|
|
31
|
+
getDelegationDetailsFromAddress(address: string, delegatees: string[]): Promise<DelegationDetails>;
|
|
32
|
+
prepareDelegatorActionFromPublicKey(publicKey: PublicKey, type: CosmosDelegationActionType, data?: {
|
|
33
|
+
validator: Address;
|
|
34
|
+
amount?: Amount<_Units>;
|
|
35
|
+
}): Promise<CosmosTransaction[]>;
|
|
36
|
+
undelegate(publicKey: PublicKey, validatorAddress: Address, amount: Amount<_Units>, memo?: string): Promise<CosmosTransaction>;
|
|
37
|
+
delegate(publicKey: PublicKey, validatorAddress: Address | string[], amount: Amount<_Units>, undelegate: boolean, memo?: string): Promise<CosmosTransaction>;
|
|
38
|
+
withdrawDelegationRewards(publicKey: PublicKey, validatorAddresses: Address[], memo?: string): Promise<CosmosTransaction>;
|
|
39
|
+
withdrawAllDelegationRewards(delegatorAddress: Address, fee: Amount<_Units>, memo?: string): Promise<string>;
|
|
40
|
+
fetchTotalReward(delegatorAddress: Address): Promise<Amount<_Units>>;
|
|
41
|
+
fetchRewardForDelegation(delegatorAddress: Address, validatorAddress: Address): Promise<Amount<_Units>>;
|
|
42
|
+
fetchDelegations(address: Address): Promise<CosmosDelegation[]>;
|
|
43
|
+
fetchTotalDelegatedAmount(address: Address): Promise<Amount<_Units>>;
|
|
44
|
+
fetchValidator(address: Address): Promise<CosmosValidator>;
|
|
45
|
+
fetchValidators(): Promise<CosmosValidator[]>;
|
|
46
|
+
fetchUnbondingDelegations(delegatorAddress: Address): Promise<CosmosUnbondingDelegation[]>;
|
|
47
|
+
fetchTotalUnbondingAmount(address: Address): Promise<Amount<_Units>>;
|
|
48
|
+
fetchSelfDelegation(address: Address): Promise<CosmosDelegation>;
|
|
49
|
+
}
|
|
50
|
+
export declare abstract class CosmosBaseProtocolImpl<_Units extends string> implements CosmosBaseStakingProtocol<_Units> {
|
|
51
|
+
protected readonly options: CosmosProtocolOptions<_Units>;
|
|
52
|
+
private readonly nodeClient;
|
|
53
|
+
private readonly cryptoClient;
|
|
54
|
+
private readonly cryptoConfiguration;
|
|
55
|
+
constructor(options: CosmosProtocolOptions<_Units>);
|
|
56
|
+
getKeyPairFromSecretKey(secretKey: SecretKey): Promise<KeyPair>;
|
|
57
|
+
getCryptoConfiguration(): Promise<CosmosCryptoConfiguration>;
|
|
58
|
+
getKeyPairFromDerivative(derivative: CryptoDerivative): Promise<KeyPair>;
|
|
59
|
+
signTransactionWithSecretKey(transaction: CosmosUnsignedTransaction, secretKey: SecretKey): Promise<CosmosSignedTransaction>;
|
|
60
|
+
abstract getMetadata(): Promise<ProtocolMetadata<_Units, _Units>>;
|
|
61
|
+
getAddressFromPublicKey(publicKey: PublicKey): Promise<string>;
|
|
62
|
+
getDetailsFromTransaction(transaction: CosmosSignedTransaction | CosmosUnsignedTransaction, publicKey: PublicKey): Promise<AirGapTransaction<_Units, _Units>[]>;
|
|
63
|
+
private getDetailsFromSignedTransaction;
|
|
64
|
+
private getDetailsFromUnsignedTransaction;
|
|
65
|
+
getNetwork(): Promise<CosmosProtocolNetwork>;
|
|
66
|
+
getTransactionsForPublicKey(publicKey: PublicKey, limit: number, cursor?: CosmosTransactionCursor | undefined): Promise<AirGapTransactionsWithCursor<CosmosTransactionCursor, _Units, _Units>>;
|
|
67
|
+
getBalanceOfPublicKey(publicKey: PublicKey, configuration?: undefined): Promise<Balance<_Units>>;
|
|
68
|
+
getTransactionMaxAmountWithPublicKey(publicKey: PublicKey, to: string[], configuration?: TransactionConfiguration<_Units> | undefined): Promise<Amount<_Units>>;
|
|
69
|
+
abstract getTransactionFeeWithPublicKey(publicKey: PublicKey, details: TransactionDetails<_Units>[]): Promise<FeeDefaults<_Units>>;
|
|
70
|
+
prepareTransactionWithPublicKey(publicKey: PublicKey, details: TransactionDetails<_Units>[], configuration?: TransactionConfiguration<_Units> | undefined): Promise<CosmosUnsignedTransaction>;
|
|
71
|
+
broadcastTransaction(transaction: CosmosSignedTransaction): Promise<string>;
|
|
72
|
+
signMessageWithKeyPair(message: string, keyPair: KeyPair): Promise<Signature>;
|
|
73
|
+
verifyMessageWithPublicKey(message: string, signature: Signature, publicKey: PublicKey): Promise<boolean>;
|
|
74
|
+
decryptAsymmetricWithKeyPair(payload: string, keyPair: KeyPair): Promise<string>;
|
|
75
|
+
encryptAsymmetricWithPublicKey(payload: string, publicKey: PublicKey): Promise<string>;
|
|
76
|
+
encryptAESWithSecretKey(payload: string, secretKey: SecretKey): Promise<string>;
|
|
77
|
+
decryptAESWithSecretKey(payload: string, secretKey: SecretKey): Promise<string>;
|
|
78
|
+
getTransactionsForAddress(address: string, limit: number, cursor?: CosmosTransactionCursor | undefined): Promise<AirGapTransactionsWithCursor<CosmosTransactionCursor, _Units, _Units>>;
|
|
79
|
+
getBalanceOfAddress(address: string, _configuration?: undefined): Promise<Balance<_Units>>;
|
|
80
|
+
getDefaultDelegatee(): Promise<string>;
|
|
81
|
+
getCurrentDelegateesForPublicKey(publicKey: PublicKey): Promise<string[]>;
|
|
82
|
+
getCurrentDelegateesForAddress(address: string): Promise<string[]>;
|
|
83
|
+
getDelegateeDetails(address: string): Promise<DelegateeDetails>;
|
|
84
|
+
isPublicKeyDelegating(publicKey: PublicKey): Promise<boolean>;
|
|
85
|
+
isAddressDelegating(address: string): Promise<boolean>;
|
|
86
|
+
getDelegatorDetailsFromPublicKey(publicKey: PublicKey): Promise<DelegatorDetails>;
|
|
87
|
+
getDelegatorDetailsFromAddress(address: string): Promise<DelegatorDetails>;
|
|
88
|
+
private getDelegatorDetails;
|
|
89
|
+
private getAvailableDelegatorActions;
|
|
90
|
+
getDelegationDetailsFromPublicKey(publicKey: PublicKey, delegatees: string[]): Promise<DelegationDetails>;
|
|
91
|
+
getDelegationDetailsFromAddress(address: string, delegatees: string[]): Promise<DelegationDetails>;
|
|
92
|
+
prepareDelegatorActionFromPublicKey(publicKey: PublicKey, type: CosmosDelegationActionType, data?: {
|
|
93
|
+
validator: string;
|
|
94
|
+
amount?: Amount<_Units> | undefined;
|
|
95
|
+
} | undefined): Promise<CosmosTransaction[]>;
|
|
96
|
+
undelegate(publicKey: PublicKey, validatorAddress: string, amount: Amount<_Units>, memo?: string | undefined): Promise<CosmosTransaction>;
|
|
97
|
+
delegate(publicKey: PublicKey, validatorAddress: string | string[], amount: Amount<_Units>, undelegate: boolean, memo?: string | undefined): Promise<CosmosTransaction>;
|
|
98
|
+
withdrawDelegationRewards(publicKey: PublicKey, _validatorAddresses: string[], memo?: string | undefined): Promise<CosmosTransaction>;
|
|
99
|
+
withdrawAllDelegationRewards(delegatorAddress: string, fee: Amount<_Units>, memo?: string | undefined): Promise<string>;
|
|
100
|
+
fetchTotalReward(delegatorAddress: string): Promise<Amount<_Units>>;
|
|
101
|
+
fetchRewardForDelegation(delegatorAddress: string, validatorAddress: string): Promise<Amount<_Units>>;
|
|
102
|
+
fetchDelegations(address: string): Promise<CosmosDelegation[]>;
|
|
103
|
+
fetchTotalDelegatedAmount(address: string): Promise<Amount<_Units>>;
|
|
104
|
+
fetchValidator(address: string): Promise<CosmosValidator>;
|
|
105
|
+
fetchValidators(): Promise<CosmosValidator[]>;
|
|
106
|
+
fetchUnbondingDelegations(delegatorAddress: string): Promise<CosmosUnbondingDelegation[]>;
|
|
107
|
+
fetchTotalUnbondingAmount(address: string): Promise<Amount<_Units>>;
|
|
108
|
+
fetchSelfDelegation(address: string): Promise<CosmosDelegation>;
|
|
109
|
+
}
|