-
Notifications
You must be signed in to change notification settings - Fork 302
Expand file tree
/
Copy pathiface.ts
More file actions
134 lines (115 loc) · 3.03 KB
/
iface.ts
File metadata and controls
134 lines (115 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { TransactionExplanation as BaseTransactionExplanation, TransactionType } from '@bitgo/sdk-core';
import { Coin } from '@cosmjs/stargate';
import { BigNumber } from 'bignumber.js';
/**
* Defines the protobuf typeUrl for the public key
*/
export enum PubKeyTypeUrl {
secp256k1 = '/cosmos.crypto.secp256k1.PubKey',
ethSecp256k1 = '/ethermint.crypto.v1.ethsecp256k1.PubKey',
}
/**
* Defines the amino encoding name for the public key
*/
export enum PubKeyType {
secp256k1 = 'tendermint/PubKeySecp256k1',
ethSecp256k1 = 'tendermint/PubKeyEthSecp256k1',
}
export interface TransactionExplanation extends BaseTransactionExplanation {
type: TransactionType;
}
export interface SendMessage {
fromAddress: string;
toAddress: string;
amount: Coin[];
}
export interface RecoveryOptions {
userKey?: string; // Box A
backupKey?: string; // Box B
bitgoKey?: string;
rootAddress?: string;
recoveryDestination: string;
krsProvider?: string;
walletPassphrase?: string;
}
export interface CosmosLikeCoinRecoveryOutput {
serializedTx?: string;
signableHex?: string;
}
export interface DelegateOrUndelegeteMessage {
delegatorAddress: string;
validatorAddress: string;
amount: Coin;
}
export interface RedelegateMessage {
delegatorAddress: string;
validatorSrcAddress: string;
validatorDstAddress: string;
amount: Coin;
}
export interface WithdrawDelegatorRewardsMessage {
delegatorAddress: string;
validatorAddress: string;
}
export interface ExecuteContractMessage {
sender: string;
contract: string;
msg: Uint8Array;
funds?: Coin[];
}
export type CosmosTransactionMessage<CustomMessage = never> =
| SendMessage
| DelegateOrUndelegeteMessage
| WithdrawDelegatorRewardsMessage
| ExecuteContractMessage
| RedelegateMessage
| CustomMessage;
export interface MessageData<CustomMessage = never> {
typeUrl: string;
value: CosmosTransactionMessage<CustomMessage>;
}
export interface FeeData {
amount: Coin[];
gasLimit: number;
feeGranter?: string;
}
export interface GasAmountDetails {
gasAmount: string;
gasLimit: number;
}
/**
* The transaction data returned from the toJson() function of a transaction
*/
export interface TxData<CustomMessage = never> extends CosmosLikeTransaction<CustomMessage> {
id?: string;
type?: TransactionType;
accountNumber: number;
chainId: string;
}
export interface CosmosLikeTransaction<CustomMessage = never> {
readonly sequence: number;
readonly sendMessages: MessageData<CustomMessage>[];
readonly gasBudget: FeeData;
readonly publicKey?: string;
readonly signature?: Uint8Array;
readonly hash?: string;
readonly memo?: string;
}
export interface KeyShares {
userKeyShare: Buffer;
backupKeyShare: Buffer;
commonKeyChain: string;
}
export interface TransactionBuildParams {
messages: SendMessage[];
chainId: string;
accountDetails: string[];
publicKey: string;
isUnsignedSweep: boolean;
keyShares?: KeyShares;
}
export interface BalanceResult {
nativeBalance: BigNumber;
remainingBalances: Coin[];
actualBalance: BigNumber;
}