Skip to content

Commit

Permalink
helper extensions for ITransactionRepository to handle string txids
Browse files Browse the repository at this point in the history
  • Loading branch information
dthorpe committed Nov 16, 2014
1 parent 6ca8951 commit eace669
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions NBitcoin/ITransactionRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,17 @@ public interface ITransactionRepository
Transaction Get(uint256 txId);
void Put(uint256 txId, Transaction tx);
}

public static class TxRepoExtensions
{
public static Transaction Get(this ITransactionRepository repo, string txId)
{
return repo.Get(new uint256(txId));
}

public static void Put(this ITransactionRepository repo, Transaction tx)
{
repo.Put(tx.GetHash(), tx);
}
}
}

0 comments on commit eace669

Please sign in to comment.