Removed obsolete TODOS

This commit is contained in:
Ethan Frey 2020-01-23 14:29:02 +01:00
parent 624180bcd3
commit 7440bfb6f1
4 changed files with 6 additions and 13 deletions

View File

@ -91,7 +91,6 @@ export class CosmosCodec implements TxCodec {
throw new Error("Nonce is required");
}
const parsed = unmarshalTx(bytes);
// TODO: this needs access to token list
return parseTx(parsed, chainId, nonce, this.tokens);
}

View File

@ -89,14 +89,13 @@ export class CosmosConnection implements BlockchainConnection {
private readonly restClient: RestClient;
private readonly chainData: ChainData;
private readonly primaryToken: Token;
// TODO: deprecate this???
private readonly supportedTokens: readonly Token[];
private readonly _prefix: CosmosBech32Prefix;
private readonly tokenInfo: TokenInfos;
// these are derived from arguments (cached for use in multiple functions)
private readonly primaryToken: Token;
private readonly supportedTokens: readonly Token[];
private get prefix(): CosmosBech32Prefix {
return this._prefix;
}

View File

@ -45,9 +45,6 @@ export function decodeFullSignature(signature: amino.StdSignature, nonce: number
};
}
// TODO: this needs access to token list - we need something more like amountToCoin and coinToAmount here
// and wire that info all the way from both connection and codec.
// TODO: return null vs throw exception for undefined???
export const decodeAmount = (tokens: TokenInfos) => (coin: amino.Coin): Amount => {
return coinToAmount(tokens, coin);
@ -69,7 +66,6 @@ export function parseMsg(msg: amino.Msg, chainId: ChainId, tokens: TokenInfos):
chainId: chainId,
sender: msgValue.from_address as Address,
recipient: msgValue.to_address as Address,
// TODO: this needs access to token list
amount: decodeAmount(tokens)(msgValue.amount[0]),
};
}
@ -94,9 +90,7 @@ export function parseTx(tx: amino.Tx, chainId: ChainId, nonce: Nonce, tokens: To
}
const [primarySignature] = txValue.signatures.map(signature => decodeFullSignature(signature, nonce));
// TODO: this needs access to token list
const msg = parseMsg(txValue.msg[0], chainId, tokens);
// TODO: this needs access to token list
const fee = parseFee(txValue.fee, tokens);
const transaction = {

View File

@ -16,7 +16,7 @@ export interface TokenInfo extends Token {
export type TokenInfos = ReadonlyArray<TokenInfo>;
// TODO: alias amino types
// TODO: return null vs throw exception for undefined???
export function amountToCoin(lookup: ReadonlyArray<TokenInfo>, amount: Amount): amino.Coin {
const match = lookup.find(({ tokenTicker }) => tokenTicker === amount.tokenTicker);
if (!match) {
@ -28,6 +28,7 @@ export function amountToCoin(lookup: ReadonlyArray<TokenInfo>, amount: Amount):
};
}
// TODO: return null vs throw exception for undefined???
export function coinToAmount(tokens: TokenInfos, coin: amino.Coin): Amount {
const match = tokens.find(({ denom }) => denom === coin.denom);
if (!match) {