mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
Add transactions for payment channels
This commit is contained in:
committed by
wilsonianb
parent
af687a6aed
commit
a574e1158a
114
test/api-test.js
114
test/api-test.js
@@ -320,6 +320,93 @@ describe('RippleAPI', function() {
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('preparePaymentChannelCreate', function() {
|
||||
const localInstructions = _.defaults({
|
||||
maxFee: '0.000012'
|
||||
}, instructions);
|
||||
return this.api.preparePaymentChannelCreate(
|
||||
address, requests.preparePaymentChannelCreate.normal,
|
||||
localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelCreate.normal,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('preparePaymentChannelCreate full', function() {
|
||||
return this.api.preparePaymentChannelCreate(
|
||||
address, requests.preparePaymentChannelCreate.full).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelCreate.full,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('preparePaymentChannelFund', function() {
|
||||
const localInstructions = _.defaults({
|
||||
maxFee: '0.000012'
|
||||
}, instructions);
|
||||
return this.api.preparePaymentChannelFund(
|
||||
address, requests.preparePaymentChannelFund.normal,
|
||||
localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelFund.normal,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('preparePaymentChannelFund full', function() {
|
||||
return this.api.preparePaymentChannelFund(
|
||||
address, requests.preparePaymentChannelFund.full).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelFund.full,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('preparePaymentChannelClaim', function() {
|
||||
const localInstructions = _.defaults({
|
||||
maxFee: '0.000012'
|
||||
}, instructions);
|
||||
return this.api.preparePaymentChannelClaim(
|
||||
address, requests.preparePaymentChannelClaim.normal,
|
||||
localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelClaim.normal,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('preparePaymentChannelClaim with renew', function() {
|
||||
const localInstructions = _.defaults({
|
||||
maxFee: '0.000012'
|
||||
}, instructions);
|
||||
return this.api.preparePaymentChannelClaim(
|
||||
address, requests.preparePaymentChannelClaim.renew,
|
||||
localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelClaim.renew,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('preparePaymentChannelClaim with close', function() {
|
||||
const localInstructions = _.defaults({
|
||||
maxFee: '0.000012'
|
||||
}, instructions);
|
||||
return this.api.preparePaymentChannelClaim(
|
||||
address, requests.preparePaymentChannelClaim.close,
|
||||
localInstructions).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelClaim.close,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('throws on preparePaymentChannelClaim with renew and close', function() {
|
||||
assert.throws(() => {
|
||||
this.api.preparePaymentChannelClaim(
|
||||
address, requests.preparePaymentChannelClaim.full).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelClaim.full,
|
||||
'prepare'));
|
||||
}, this.api.errors.ValidationError);
|
||||
});
|
||||
|
||||
it('throws on preparePaymentChannelClaim with no signature', function() {
|
||||
assert.throws(() => {
|
||||
this.api.preparePaymentChannelClaim(
|
||||
address, requests.preparePaymentChannelClaim.noSignature).then(
|
||||
_.partial(checkResult, responses.preparePaymentChannelClaim.noSignature,
|
||||
'prepare'));
|
||||
}, this.api.errors.ValidationError);
|
||||
});
|
||||
|
||||
it('sign', function() {
|
||||
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV';
|
||||
const result = this.api.sign(requests.sign.normal.txJSON, secret);
|
||||
@@ -680,6 +767,33 @@ describe('RippleAPI', function() {
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - PaymentChannelCreate', function() {
|
||||
const hash =
|
||||
'0E9CA3AB1053FC0C1CBAA75F636FE1EC92F118C7056BBEF5D63E4C116458A16D';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.paymentChannelCreate,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - PaymentChannelFund', function() {
|
||||
const hash =
|
||||
'CD053D8867007A6A4ACB7A432605FE476D088DCB515AFFC886CF2B4EB6D2AE8B';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.paymentChannelFund,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - PaymentChannelClaim', function() {
|
||||
const hash =
|
||||
'81B9ECAE7195EB6E8034AEDF44D8415A7A803E14513FDBB34FA984AB37D59563';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.paymentChannelClaim,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - no Meta', function() {
|
||||
const hash =
|
||||
'AFB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA1B';
|
||||
|
||||
15
test/fixtures/requests/index.js
vendored
15
test/fixtures/requests/index.js
vendored
@@ -36,6 +36,21 @@ module.exports = {
|
||||
normal: require('./prepare-escrow-cancellation'),
|
||||
memos: require('./prepare-escrow-cancellation-memos')
|
||||
},
|
||||
preparePaymentChannelCreate: {
|
||||
normal: require('./prepare-payment-channel-create'),
|
||||
full: require('./prepare-payment-channel-create-full')
|
||||
},
|
||||
preparePaymentChannelFund: {
|
||||
normal: require('./prepare-payment-channel-fund'),
|
||||
full: require('./prepare-payment-channel-fund-full')
|
||||
},
|
||||
preparePaymentChannelClaim: {
|
||||
normal: require('./prepare-payment-channel-claim'),
|
||||
full: require('./prepare-payment-channel-claim-full'),
|
||||
close: require('./prepare-payment-channel-claim-close'),
|
||||
renew: require('./prepare-payment-channel-claim-renew'),
|
||||
noSignature: require('./prepare-payment-channel-claim-no-signature')
|
||||
},
|
||||
prepareTrustline: {
|
||||
simple: require('./prepare-trustline-simple'),
|
||||
complex: require('./prepare-trustline'),
|
||||
|
||||
8
test/fixtures/requests/prepare-payment-channel-claim-close.json
vendored
Normal file
8
test/fixtures/requests/prepare-payment-channel-claim-close.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"balance": "1",
|
||||
"amount": "1",
|
||||
"signature": "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B",
|
||||
"publicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
|
||||
"close": true
|
||||
}
|
||||
9
test/fixtures/requests/prepare-payment-channel-claim-full.json
vendored
Normal file
9
test/fixtures/requests/prepare-payment-channel-claim-full.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"balance": "1",
|
||||
"amount": "1",
|
||||
"signature": "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B",
|
||||
"publicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
|
||||
"renew": true,
|
||||
"close": true
|
||||
}
|
||||
6
test/fixtures/requests/prepare-payment-channel-claim-no-signature.json
vendored
Normal file
6
test/fixtures/requests/prepare-payment-channel-claim-no-signature.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"balance": "1",
|
||||
"amount": "1",
|
||||
"publicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A"
|
||||
}
|
||||
8
test/fixtures/requests/prepare-payment-channel-claim-renew.json
vendored
Normal file
8
test/fixtures/requests/prepare-payment-channel-claim-renew.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"balance": "1",
|
||||
"amount": "1",
|
||||
"signature": "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B",
|
||||
"publicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
|
||||
"renew": true
|
||||
}
|
||||
3
test/fixtures/requests/prepare-payment-channel-claim.json
vendored
Normal file
3
test/fixtures/requests/prepare-payment-channel-claim.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198"
|
||||
}
|
||||
9
test/fixtures/requests/prepare-payment-channel-create-full.json
vendored
Normal file
9
test/fixtures/requests/prepare-payment-channel-create-full.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"amount": "1",
|
||||
"destination": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"settleDelay": 86400,
|
||||
"publicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
|
||||
"cancelAfter": "2017-02-17T15:04:57Z",
|
||||
"destinationTag": 23480,
|
||||
"sourceTag": 11747
|
||||
}
|
||||
6
test/fixtures/requests/prepare-payment-channel-create.json
vendored
Normal file
6
test/fixtures/requests/prepare-payment-channel-create.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"amount": "1",
|
||||
"destination": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"settleDelay": 86400,
|
||||
"publicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A"
|
||||
}
|
||||
5
test/fixtures/requests/prepare-payment-channel-fund-full.json
vendored
Normal file
5
test/fixtures/requests/prepare-payment-channel-fund-full.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"amount": "1",
|
||||
"expiration": "2017-02-17T15:04:57Z"
|
||||
}
|
||||
4
test/fixtures/requests/prepare-payment-channel-fund.json
vendored
Normal file
4
test/fixtures/requests/prepare-payment-channel-fund.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
|
||||
"amount": "1"
|
||||
}
|
||||
28
test/fixtures/responses/get-transaction-payment-channel-claim.json
vendored
Normal file
28
test/fixtures/responses/get-transaction-payment-channel-claim.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"type": "paymentChannelClaim",
|
||||
"address": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"sequence": 99,
|
||||
"id": "81B9ECAE7195EB6E8034AEDF44D8415A7A803E14513FDBB34FA984AB37D59563",
|
||||
"specification": {
|
||||
"channel": "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
|
||||
"balance": "0.801",
|
||||
"publicKey": "EDE059A23CBE00BDD465910EBDA67C86BAD046FA52E1BBBB27159E31980BAFEFB9",
|
||||
"signature": "5567FB8A27D8BF0C556D3D31D034476FC04F43846A6613EB4B1B64C396C833600BE251CE3104CF02DA0085B473E02BA0BA21F794FB1DC95DAD702F3EA761CA02"
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
"timestamp": "2017-03-09T14:09:51.000Z",
|
||||
"fee": "0.000012",
|
||||
"balanceChanges": {
|
||||
"rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa": [
|
||||
{
|
||||
"currency": "XRP",
|
||||
"value": "0.800988"
|
||||
}
|
||||
]
|
||||
},
|
||||
"orderbookChanges": {},
|
||||
"ledgerVersion": 786310,
|
||||
"indexInLedger": 0
|
||||
}
|
||||
}
|
||||
29
test/fixtures/responses/get-transaction-payment-channel-create.json
vendored
Normal file
29
test/fixtures/responses/get-transaction-payment-channel-create.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"type": "paymentChannelCreate",
|
||||
"address": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"sequence": 113,
|
||||
"id": "0E9CA3AB1053FC0C1CBAA75F636FE1EC92F118C7056BBEF5D63E4C116458A16D",
|
||||
"specification": {
|
||||
"amount": "1",
|
||||
"destination": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"sourceTag": 3444675312,
|
||||
"publicKey": "EDE059A23CBE00BDD465910EBDA67C86BAD046FA52E1BBBB27159E31980BAFEFB9",
|
||||
"settleDelay": 90000
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
"timestamp": "2017-03-09T14:09:50.000Z",
|
||||
"fee": "0.000012",
|
||||
"balanceChanges": {
|
||||
"rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK": [
|
||||
{
|
||||
"currency": "XRP",
|
||||
"value": "-1.000012"
|
||||
}
|
||||
]
|
||||
},
|
||||
"orderbookChanges": {},
|
||||
"ledgerVersion": 786309,
|
||||
"indexInLedger": 0
|
||||
}
|
||||
}
|
||||
26
test/fixtures/responses/get-transaction-payment-channel-fund.json
vendored
Normal file
26
test/fixtures/responses/get-transaction-payment-channel-fund.json
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"type": "paymentChannelFund",
|
||||
"address": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"sequence": 114,
|
||||
"id": "CD053D8867007A6A4ACB7A432605FE476D088DCB515AFFC886CF2B4EB6D2AE8B",
|
||||
"specification": {
|
||||
"channel": "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
|
||||
"amount": "1"
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
"timestamp": "2017-03-09T14:09:51.000Z",
|
||||
"fee": "0.000012",
|
||||
"balanceChanges": {
|
||||
"rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK": [
|
||||
{
|
||||
"currency": "XRP",
|
||||
"value": "-1.000012"
|
||||
}
|
||||
]
|
||||
},
|
||||
"orderbookChanges": {},
|
||||
"ledgerVersion": 786310,
|
||||
"indexInLedger": 1
|
||||
}
|
||||
}
|
||||
19
test/fixtures/responses/index.js
vendored
19
test/fixtures/responses/index.js
vendored
@@ -42,6 +42,12 @@ module.exports = {
|
||||
require('./get-transaction-escrow-execution.json'),
|
||||
escrowExecutionSimple:
|
||||
require('./get-transaction-escrow-execution-simple.json'),
|
||||
paymentChannelCreate:
|
||||
require('./get-transaction-payment-channel-create.json'),
|
||||
paymentChannelFund:
|
||||
require('./get-transaction-payment-channel-fund.json'),
|
||||
paymentChannelClaim:
|
||||
require('./get-transaction-payment-channel-claim.json'),
|
||||
amendment: require('./get-transaction-amendment.json'),
|
||||
feeUpdate: require('./get-transaction-fee-update.json')
|
||||
},
|
||||
@@ -105,6 +111,19 @@ module.exports = {
|
||||
normal: require('./prepare-escrow-cancellation'),
|
||||
memos: require('./prepare-escrow-cancellation-memos')
|
||||
},
|
||||
preparePaymentChannelCreate: {
|
||||
normal: require('./prepare-payment-channel-create'),
|
||||
full: require('./prepare-payment-channel-create-full')
|
||||
},
|
||||
preparePaymentChannelFund: {
|
||||
normal: require('./prepare-payment-channel-fund'),
|
||||
full: require('./prepare-payment-channel-fund-full')
|
||||
},
|
||||
preparePaymentChannelClaim: {
|
||||
normal: require('./prepare-payment-channel-claim'),
|
||||
renew: require('./prepare-payment-channel-claim-renew'),
|
||||
close: require('./prepare-payment-channel-claim-close')
|
||||
},
|
||||
prepareTrustline: {
|
||||
simple: require('./prepare-trustline-simple.json'),
|
||||
frozen: require('./prepare-trustline-frozen.json'),
|
||||
|
||||
8
test/fixtures/responses/prepare-payment-channel-claim-close.json
vendored
Normal file
8
test/fixtures/responses/prepare-payment-channel-claim-close.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON": "{\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Balance\":\"1000000\",\"Amount\":\"1000000\",\"Signature\":\"30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B\",\"PublicKey\":\"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A\",\"Fee\":\"12\",\"Sequence\":23,\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelClaim\",\"Flags\":2147614720,\"LastLedgerSequence\":8820051,\"Fee\":\"12\"}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
8
test/fixtures/responses/prepare-payment-channel-claim-renew.json
vendored
Normal file
8
test/fixtures/responses/prepare-payment-channel-claim-renew.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON": "{\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Balance\":\"1000000\",\"Amount\":\"1000000\",\"Signature\":\"30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B\",\"PublicKey\":\"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A\",\"Fee\":\"12\",\"Sequence\":23,\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelClaim\",\"Flags\":2147549184,\"LastLedgerSequence\":8820051,\"Fee\":\"12\"}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
8
test/fixtures/responses/prepare-payment-channel-claim.json
vendored
Normal file
8
test/fixtures/responses/prepare-payment-channel-claim.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON": "{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelClaim\",\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
8
test/fixtures/responses/prepare-payment-channel-create-full.json
vendored
Normal file
8
test/fixtures/responses/prepare-payment-channel-create-full.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON":"{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelCreate\",\"Amount\":\"1000000\",\"Destination\":\"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW\",\"SettleDelay\":86400,\"PublicKey\":\"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A\",\"DestinationTag\":23480,\"SourceTag\":11747,\"CancelAfter\":540659097,\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8819954
|
||||
}
|
||||
}
|
||||
8
test/fixtures/responses/prepare-payment-channel-create.json
vendored
Normal file
8
test/fixtures/responses/prepare-payment-channel-create.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON":"{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelCreate\",\"Amount\":\"1000000\",\"Destination\":\"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW\",\"SettleDelay\":86400,\"PublicKey\":\"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
8
test/fixtures/responses/prepare-payment-channel-fund-full.json
vendored
Normal file
8
test/fixtures/responses/prepare-payment-channel-fund-full.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON":"{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelFund\",\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Amount\":\"1000000\",\"Expiration\":540659097,\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8819954
|
||||
}
|
||||
}
|
||||
8
test/fixtures/responses/prepare-payment-channel-fund.json
vendored
Normal file
8
test/fixtures/responses/prepare-payment-channel-fund.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON":"{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelFund\",\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Amount\":\"1000000\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
3
test/fixtures/rippled/index.js
vendored
3
test/fixtures/rippled/index.js
vendored
@@ -70,6 +70,9 @@ module.exports = {
|
||||
EscrowExecution: require('./tx/escrow-execution.json'),
|
||||
EscrowExecutionSimple:
|
||||
require('./tx/escrow-execution-simple.json'),
|
||||
PaymentChannelCreate: require('./tx/payment-channel-create.json'),
|
||||
PaymentChannelFund: require('./tx/payment-channel-fund.json'),
|
||||
PaymentChannelClaim: require('./tx/payment-channel-claim.json'),
|
||||
Unrecognized: require('./tx/unrecognized.json'),
|
||||
NoMeta: require('./tx/no-meta.json'),
|
||||
LedgerZero: require('./tx/ledger-zero.json'),
|
||||
|
||||
70
test/fixtures/rippled/tx/payment-channel-claim.json
vendored
Normal file
70
test/fixtures/rippled/tx/payment-channel-claim.json
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"result": {
|
||||
"Account": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"Balance": "801000",
|
||||
"Channel": "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
|
||||
"Fee": "12",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 786312,
|
||||
"PublicKey": "EDE059A23CBE00BDD465910EBDA67C86BAD046FA52E1BBBB27159E31980BAFEFB9",
|
||||
"Sequence": 99,
|
||||
"Signature": "5567FB8A27D8BF0C556D3D31D034476FC04F43846A6613EB4B1B64C396C833600BE251CE3104CF02DA0085B473E02BA0BA21F794FB1DC95DAD702F3EA761CA02",
|
||||
"SigningPubKey": "030697E72D738538BBE149CC3E85AA43FE836B5B34810F6370D6BB7D6D4938CEE6",
|
||||
"TransactionType": "PaymentChannelClaim",
|
||||
"TxnSignature": "3044022045EF38CCBE52D81D9A4060DD7203D626BC51B4779246FCFB71E4D0300D774DE002201A12A93081CF8539AF5EB4FB33F173729B499B5D5CD5EB66BD028A35F2ECAFEC",
|
||||
"date": 542383791,
|
||||
"hash": "81B9ECAE7195EB6E8034AEDF44D8415A7A803E14513FDBB34FA984AB37D59563",
|
||||
"inLedger": 786310,
|
||||
"ledger_index": 786310,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"Amount": "1000000",
|
||||
"Balance": "801000",
|
||||
"Destination": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000002",
|
||||
"PublicKey": "EDE059A23CBE00BDD465910EBDA67C86BAD046FA52E1BBBB27159E31980BAFEFB9",
|
||||
"SettleDelay": 90000,
|
||||
"SourceTag": 3444675312
|
||||
},
|
||||
"LedgerEntryType": "PayChannel",
|
||||
"LedgerIndex": "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
|
||||
"PreviousFields": {
|
||||
"Balance": "0"
|
||||
},
|
||||
"PreviousTxnID": "0E9CA3AB1053FC0C1CBAA75F636FE1EC92F118C7056BBEF5D63E4C116458A16D",
|
||||
"PreviousTxnLgrSeq": 786309
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"Balance": "9685416812",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 81,
|
||||
"Sequence": 100
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "659611ECC02612E5352D194628C2133D4983C4815B564F75722DA9327B6434D2",
|
||||
"PreviousFields": {
|
||||
"Balance": "9684615824",
|
||||
"Sequence": 99
|
||||
},
|
||||
"PreviousTxnID": "9502119B8457ADF72DC137EB44DE897D7CD8583CE1C9541CA9A4FD27B4149FBD",
|
||||
"PreviousTxnLgrSeq": 786309
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
86
test/fixtures/rippled/tx/payment-channel-create.json
vendored
Normal file
86
test/fixtures/rippled/tx/payment-channel-create.json
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"id": 0,
|
||||
"result": {
|
||||
"Account": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"Amount": "1000000",
|
||||
"Destination": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"Fee": "12",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 786310,
|
||||
"PublicKey": "EDE059A23CBE00BDD465910EBDA67C86BAD046FA52E1BBBB27159E31980BAFEFB9",
|
||||
"Sequence": 113,
|
||||
"SettleDelay": 90000,
|
||||
"SigningPubKey": "0243D321B6585B7F6EB5B6AEA6B98C5EAD6FE09C09F79722640029538F03F083E5",
|
||||
"SourceTag": 3444675312,
|
||||
"TransactionType": "PaymentChannelCreate",
|
||||
"TxnSignature": "3045022100ECA04F35A18F74E24029060B51AC2AEEECCEB8663A3029DD2966E5F99CB8606F0220581CB2B7C5D8A32717991396B9FD77734CA47CF02654938F06509450B4772052",
|
||||
"date": 542383790,
|
||||
"hash": "0E9CA3AB1053FC0C1CBAA75F636FE1EC92F118C7056BBEF5D63E4C116458A16D",
|
||||
"inLedger": 786309,
|
||||
"ledger_index": 786309,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "PayChannel",
|
||||
"LedgerIndex": "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
|
||||
"NewFields": {
|
||||
"Account": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"Amount": "1000000",
|
||||
"Destination": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"OwnerNode": "0000000000000002",
|
||||
"PublicKey": "EDE059A23CBE00BDD465910EBDA67C86BAD046FA52E1BBBB27159E31980BAFEFB9",
|
||||
"SettleDelay": 90000,
|
||||
"SourceTag": 3444675312
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "659611ECC02612E5352D194628C2133D4983C4815B564F75722DA9327B6434D2",
|
||||
"PreviousTxnID": "450C1D132C21F3CED037F3442075AD0339B5A02EA8BC21D4DD6A13ED2C3A3DD6",
|
||||
"PreviousTxnLgrSeq": 786294
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"Balance": "9583993644",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 91,
|
||||
"Sequence": 114
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "C3C855510E420246A61813C11A999F1246AD3C11E1020AB097BE81877CEA159C",
|
||||
"PreviousFields": {
|
||||
"Balance": "9584993656",
|
||||
"OwnerCount": 90,
|
||||
"Sequence": 113
|
||||
},
|
||||
"PreviousTxnID": "450C1D132C21F3CED037F3442075AD0339B5A02EA8BC21D4DD6A13ED2C3A3DD6",
|
||||
"PreviousTxnLgrSeq": 786294
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"IndexPrevious": "0000000000000001",
|
||||
"Owner": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"RootIndex": "E0E23E1C6AB66761C95738D50927A2B5C0EC62E78E58A591EF285219F9492F13"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "DFF52A9A7C30C3785111879DF606B254CB6E9FFA2271BFFA3406EE2A65929D67"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
69
test/fixtures/rippled/tx/payment-channel-fund.json
vendored
Normal file
69
test/fixtures/rippled/tx/payment-channel-fund.json
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"id": 0,
|
||||
"result": {
|
||||
"Account": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"Amount": "1000000",
|
||||
"Channel": "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
|
||||
"Fee": "12",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 786312,
|
||||
"Sequence": 114,
|
||||
"SigningPubKey": "0243D321B6585B7F6EB5B6AEA6B98C5EAD6FE09C09F79722640029538F03F083E5",
|
||||
"TransactionType": "PaymentChannelFund",
|
||||
"TxnSignature": "304402203F4D2DD537C4EF4CDC2C525190698715A2188733681DB6205C9A6FCBEA3C89E202202526B40DCC025B5D12CD82789D4E37FB16918FFA94CF91113CFD9ADCF9D185A1",
|
||||
"date": 542383791,
|
||||
"hash": "CD053D8867007A6A4ACB7A432605FE476D088DCB515AFFC886CF2B4EB6D2AE8B",
|
||||
"inLedger": 786310,
|
||||
"ledger_index": 786310,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"Amount": "2000000",
|
||||
"Balance": "801000",
|
||||
"Destination": "rBmNDZ7vbTCwakKXsX3pDAwDdQuxM7yBRa",
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000002",
|
||||
"PublicKey": "EDE059A23CBE00BDD465910EBDA67C86BAD046FA52E1BBBB27159E31980BAFEFB9",
|
||||
"SettleDelay": 90000,
|
||||
"SourceTag": 3444675312
|
||||
},
|
||||
"LedgerEntryType": "PayChannel",
|
||||
"LedgerIndex": "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
|
||||
"PreviousFields": {
|
||||
"Amount": "1000000"
|
||||
},
|
||||
"PreviousTxnID": "81B9ECAE7195EB6E8034AEDF44D8415A7A803E14513FDBB34FA984AB37D59563",
|
||||
"PreviousTxnLgrSeq": 786310
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rfAuMkVuZQnQhvdMcUKg4ndBb9SPDhzNmK",
|
||||
"Balance": "9582993632",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 91,
|
||||
"Sequence": 115
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "C3C855510E420246A61813C11A999F1246AD3C11E1020AB097BE81877CEA159C",
|
||||
"PreviousFields": {
|
||||
"Balance": "9583993644",
|
||||
"Sequence": 114
|
||||
},
|
||||
"PreviousTxnID": "9502119B8457ADF72DC137EB44DE897D7CD8583CE1C9541CA9A4FD27B4149FBD",
|
||||
"PreviousTxnLgrSeq": 786309
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 1,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
@@ -284,6 +284,15 @@ module.exports = function createMockRippled(port) {
|
||||
'CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD1369931') {
|
||||
conn.send(createResponse(request,
|
||||
fixtures.tx.EscrowExecutionSimple));
|
||||
} else if (request.transaction ===
|
||||
'0E9CA3AB1053FC0C1CBAA75F636FE1EC92F118C7056BBEF5D63E4C116458A16D') {
|
||||
conn.send(createResponse(request, fixtures.tx.PaymentChannelCreate));
|
||||
} else if (request.transaction ===
|
||||
'CD053D8867007A6A4ACB7A432605FE476D088DCB515AFFC886CF2B4EB6D2AE8B') {
|
||||
conn.send(createResponse(request, fixtures.tx.PaymentChannelFund));
|
||||
} else if (request.transaction ===
|
||||
'81B9ECAE7195EB6E8034AEDF44D8415A7A803E14513FDBB34FA984AB37D59563') {
|
||||
conn.send(createResponse(request, fixtures.tx.PaymentChannelClaim));
|
||||
} else if (request.transaction ===
|
||||
'AFB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA11') {
|
||||
conn.send(createResponse(request, fixtures.tx.Unrecognized));
|
||||
|
||||
Reference in New Issue
Block a user