convert existing xrpl library into a lerna monorepo

This commit is contained in:
Greg Weisbrod
2021-11-04 23:18:23 -04:00
parent 9647145150
commit 2b42427634
500 changed files with 24357 additions and 10294 deletions

View File

@@ -0,0 +1,27 @@
import binary from 'ripple-binary-codec'
import keypairs from 'ripple-keypairs'
import { xrpToDrops } from './xrpConversion'
/**
* Sign a payment channel claim.
*
* @param channel - Channel identifier specified by the paymentChannelClaim.
* @param amount - Amount specified by the paymentChannelClaim.
* @param privateKey - Private Key to sign paymentChannelClaim with.
* @returns True if the channel is valid.
* @category Utilities
*/
function signPaymentChannelClaim(
channel: string,
amount: string,
privateKey: string,
): string {
const signingData = binary.encodeForSigningClaim({
channel,
amount: xrpToDrops(amount),
})
return keypairs.sign(signingData, privateKey)
}
export default signPaymentChannelClaim