mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Merge pull request #752 from ripple/rm-escrow-iou
Disallow escrow of IOU
This commit is contained in:
@@ -546,16 +546,14 @@ memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"maxAmount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
}
|
||||
},
|
||||
"destination": {
|
||||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"amount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
}
|
||||
},
|
||||
"allowCancelAfter": "2014-09-24T21:21:50.000Z"
|
||||
@@ -3171,16 +3169,14 @@ const escrowCreation = {
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"maxAmount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
}
|
||||
},
|
||||
"destination": {
|
||||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"amount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
}
|
||||
},
|
||||
"allowCancelAfter": "2014-09-24T21:21:50.000Z"
|
||||
@@ -3192,7 +3188,7 @@ return api.prepareEscrowCreation(address, escrowCreation).then(prepared =>
|
||||
|
||||
```json
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":\"10000\",\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -26,6 +26,9 @@ function createEscrowCreationTransaction(account: string,
|
||||
Amount: toRippledAmount(payment.destination.amount)
|
||||
}
|
||||
|
||||
if (txJSON.Amount.currency !== undefined) {
|
||||
throw new ValidationError('"Amount" currency must be XRP')
|
||||
}
|
||||
if (payment.condition !== undefined) {
|
||||
txJSON.Condition = payment.condition
|
||||
}
|
||||
|
||||
@@ -649,15 +649,6 @@ describe('RippleAPI', function() {
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - EscrowCreation iou', function() {
|
||||
const hash =
|
||||
'144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE2';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.EscrowCreationIOU,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - EscrowCancellation', function() {
|
||||
const hash =
|
||||
'F346E542FFB7A8398C30A87B952668DAB48B7D421094F8B71776DA19775A3B22';
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"maxAmount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
},
|
||||
"tag": 1
|
||||
},
|
||||
@@ -12,8 +11,7 @@
|
||||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"amount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
},
|
||||
"tag": 2
|
||||
},
|
||||
|
||||
@@ -3,16 +3,14 @@
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"maxAmount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
}
|
||||
},
|
||||
"destination": {
|
||||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"amount": {
|
||||
"value": "0.01",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||
"currency": "XRP"
|
||||
}
|
||||
},
|
||||
"allowCancelAfter": "2014-09-24T21:21:50.000Z"
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
{
|
||||
"type": "escrowCreation",
|
||||
"address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"sequence": 10,
|
||||
"id": "144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE2",
|
||||
"specification": {
|
||||
"source": {
|
||||
"address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"maxAmount": {
|
||||
"currency": "USD",
|
||||
"value": "2"
|
||||
},
|
||||
"tag": 1
|
||||
},
|
||||
"destination": {
|
||||
"address": "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "2",
|
||||
"counterparty": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
|
||||
},
|
||||
"tag": 2
|
||||
},
|
||||
"memos": [
|
||||
{
|
||||
"type": "x2",
|
||||
"format": "text/plain",
|
||||
"data": "mema data"
|
||||
}
|
||||
],
|
||||
"condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"allowCancelAfter": "2015-11-16T06:53:42.000Z",
|
||||
"allowExecuteAfter": "2015-11-16T06:47:42.000Z"
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
"timestamp": "2015-11-16T06:43:00.000Z",
|
||||
"fee": "0.000012",
|
||||
"balanceChanges": {
|
||||
"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh": [
|
||||
{
|
||||
"currency": "XRP",
|
||||
"value": "-0.000014"
|
||||
}
|
||||
]
|
||||
},
|
||||
"orderbookChanges": {},
|
||||
"ledgerVersion": 15,
|
||||
"indexInLedger": 0
|
||||
}
|
||||
}
|
||||
2
test/fixtures/responses/index.js
vendored
2
test/fixtures/responses/index.js
vendored
@@ -36,8 +36,6 @@ module.exports = {
|
||||
notValidated: require('./get-transaction-not-validated.json'),
|
||||
escrowCreation:
|
||||
require('./get-transaction-escrow-create.json'),
|
||||
EscrowCreationIOU:
|
||||
require('./get-transaction-escrow-create-iou.json'),
|
||||
escrowCancellation:
|
||||
require('./get-transaction-escrow-cancellation.json'),
|
||||
escrowExecution:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"0.01\"},\"Condition\":\"8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4\",\"FinishAfter\":464908910,\"SourceTag\":1,\"DestinationTag\":2,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":\"10000\",\"Condition\":\"8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4\",\"FinishAfter\":464908910,\"SourceTag\":1,\"DestinationTag\":2,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":\"10000\",\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
2
test/fixtures/rippled/index.js
vendored
2
test/fixtures/rippled/index.js
vendored
@@ -65,8 +65,6 @@ module.exports = {
|
||||
NotValidated: require('./tx/not-validated.json'),
|
||||
OfferWithExpiration: require('./tx/order-with-expiration.json'),
|
||||
EscrowCreation: require('./tx/escrow-creation.json'),
|
||||
EscrowCreationIOU:
|
||||
require('./tx/escrow-creation-iou.json'),
|
||||
EscrowCancellation:
|
||||
require('./tx/escrow-cancellation.json'),
|
||||
EscrowExecution: require('./tx/escrow-execution.json'),
|
||||
|
||||
@@ -274,9 +274,6 @@ module.exports = function createMockRippled(port) {
|
||||
} else if (request.transaction ===
|
||||
'144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE1') {
|
||||
conn.send(createResponse(request, fixtures.tx.EscrowCreation));
|
||||
} else if (request.transaction ===
|
||||
'144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE2') {
|
||||
conn.send(createResponse(request, fixtures.tx.EscrowCreationIOU));
|
||||
} else if (request.transaction ===
|
||||
'F346E542FFB7A8398C30A87B952668DAB48B7D421094F8B71776DA19775A3B22') {
|
||||
conn.send(createResponse(request, fixtures.tx.EscrowCancellation));
|
||||
|
||||
Reference in New Issue
Block a user