mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Sign and verify payment channel claim
This commit is contained in:
@@ -452,6 +452,37 @@ describe('RippleAPI', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('signPaymentChannelClaim', function() {
|
||||
const privateKey =
|
||||
'ACCD3309DB14D1A4FC9B1DAE608031F4408C85C73EE05E035B7DC8B25840107A';
|
||||
const result = this.api.signPaymentChannelClaim(
|
||||
requests.signPaymentChannelClaim.channel,
|
||||
requests.signPaymentChannelClaim.amount, privateKey);
|
||||
checkResult(responses.signPaymentChannelClaim,
|
||||
'signPaymentChannelClaim', result)
|
||||
});
|
||||
|
||||
it('verifyPaymentChannelClaim', function() {
|
||||
const publicKey =
|
||||
'02F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D8';
|
||||
const result = this.api.verifyPaymentChannelClaim(
|
||||
requests.signPaymentChannelClaim.channel,
|
||||
requests.signPaymentChannelClaim.amount,
|
||||
responses.signPaymentChannelClaim, publicKey);
|
||||
checkResult(true, 'verifyPaymentChannelClaim', result)
|
||||
});
|
||||
|
||||
it('verifyPaymentChannelClaim - invalid', function() {
|
||||
const publicKey =
|
||||
'03A6523FE4281DA48A6FD77FAF3CB77F5C7001ABA0B32BCEDE0369AC009758D7D9';
|
||||
const result = this.api.verifyPaymentChannelClaim(
|
||||
requests.signPaymentChannelClaim.channel,
|
||||
requests.signPaymentChannelClaim.amount,
|
||||
responses.signPaymentChannelClaim, publicKey);
|
||||
checkResult(false,
|
||||
'verifyPaymentChannelClaim', result)
|
||||
});
|
||||
|
||||
it('combine', function() {
|
||||
const combined = this.api.combine(requests.combine.setDomain);
|
||||
checkResult(responses.combine.single, 'sign', combined);
|
||||
|
||||
1
test/fixtures/requests/index.js
vendored
1
test/fixtures/requests/index.js
vendored
@@ -61,6 +61,7 @@ module.exports = {
|
||||
escrow: require('./sign-escrow.json'),
|
||||
signAs: require('./sign-as')
|
||||
},
|
||||
signPaymentChannelClaim: require('./sign-payment-channel-claim'),
|
||||
getPaths: {
|
||||
normal: require('./getpaths/normal'),
|
||||
UsdToUsd: require('./getpaths/usd2usd'),
|
||||
|
||||
4
test/fixtures/requests/sign-payment-channel-claim.json
vendored
Normal file
4
test/fixtures/requests/sign-payment-channel-claim.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"channel": "3E18C05AD40319B809520F1A136370C4075321B285217323396D6FD9EE1E9037",
|
||||
"amount": ".00001"
|
||||
}
|
||||
1
test/fixtures/responses/index.js
vendored
1
test/fixtures/responses/index.js
vendored
@@ -134,6 +134,7 @@ module.exports = {
|
||||
escrow: require('./sign-escrow.json'),
|
||||
signAs: require('./sign-as')
|
||||
},
|
||||
signPaymentChannelClaim: require('./sign-payment-channel-claim'),
|
||||
combine: {
|
||||
single: require('./combine.json')
|
||||
},
|
||||
|
||||
1
test/fixtures/responses/sign-payment-channel-claim.json
vendored
Normal file
1
test/fixtures/responses/sign-payment-channel-claim.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"3045022100B5C54654221F154347679B97AE7791CBEF5E6772A3F894F9C781B8F1B400F89F022021E466D29DC5AEB5DFAFC76E8A88D2E388EBD25A84143B6AC3B647F479CB89B7"
|
||||
Reference in New Issue
Block a user