-
Notifications
You must be signed in to change notification settings - Fork 54
/
types.ts
67 lines (59 loc) · 2.35 KB
/
types.ts
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
import { Balance, BehaviorObservable, DelegationTracker, TransactionalTracker, TransactionsTracker } from './services';
import { Cardano, NetworkInfo, ProtocolParametersRequiredByWallet, TimeSettings } from '@cardano-sdk/core';
import { GroupedAddress } from './KeyManagement';
import { NftMetadata } from './NftMetadata';
import { SelectionSkeleton } from '@cardano-sdk/cip2';
import { TxInternals } from './Transaction';
export type InitializeTxProps = {
outputs?: Set<Cardano.TxOut>;
certificates?: Cardano.Certificate[];
withdrawals?: Cardano.Withdrawal[];
options?: {
validityInterval?: Cardano.ValidityInterval;
};
};
export interface FinalizeTxProps {
readonly body: Cardano.TxBodyAlonzo;
}
export type Asset = Cardano.Asset & {
nftMetadata?: NftMetadata;
};
export type Assets = Map<Cardano.AssetId, Asset>;
export interface MinimumCoinQuantity {
minimumCoin: Cardano.Lovelace;
coinMissing: Cardano.Lovelace;
}
export type MinimumCoinQuantityPerOutput = Map<Cardano.TxOut, MinimumCoinQuantity>;
export interface InitializeTxPropsValidationResult {
minimumCoinQuantities: MinimumCoinQuantityPerOutput;
}
export type InitializeTxResult = TxInternals & { inputSelection: SelectionSkeleton };
export interface Wallet {
name: string;
readonly balance: TransactionalTracker<Balance>;
readonly delegation: DelegationTracker;
readonly utxo: TransactionalTracker<Cardano.Utxo[]>;
readonly transactions: TransactionsTracker;
readonly tip$: BehaviorObservable<Cardano.Tip>;
readonly timeSettings$: BehaviorObservable<TimeSettings[]>;
readonly genesisParameters$: BehaviorObservable<Cardano.CompactGenesis>;
readonly networkInfo$: BehaviorObservable<NetworkInfo>;
readonly protocolParameters$: BehaviorObservable<ProtocolParametersRequiredByWallet>;
readonly addresses$: BehaviorObservable<GroupedAddress[]>;
readonly assets$: BehaviorObservable<Assets>;
/**
* Compute minimum coin quantity for each transaction output
*/
validateInitializeTxProps(props: InitializeTxProps): Promise<InitializeTxPropsValidationResult>;
/**
* @throws InputSelectionError
*/
initializeTx(props: InitializeTxProps): Promise<InitializeTxResult>;
finalizeTx(props: TxInternals): Promise<Cardano.NewTxAlonzo>;
/**
* @throws {Cardano.TxSubmissionError}
*/
submitTx(tx: Cardano.NewTxAlonzo): Promise<void>;
sync(): void;
shutdown(): void;
}