Skip to content

Commit f22e0c9

Browse files
committedJun 5, 2017
doc built
1 parent f475eee commit f22e0c9

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed
 

‎docs/index.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -3582,8 +3582,10 @@ return api.preparePaymentChannelFund(address, paymentChannelFund).then(prepared
35823582

35833583
## sign
35843584

3585-
`sign(txJSON: string, secret: string, options: Object): {signedTransaction: string, id: string}`
3586-
`sign(txJSON: string, keypair: Object, options: Object): {signedTransaction: string, id: string}`
3585+
```
3586+
sign(txJSON: string, secret: string, options: Object): {signedTransaction: string, id: string}
3587+
sign(txJSON: string, keypair: Object, options: Object): {signedTransaction: string, id: string}
3588+
```
35873589

35883590
Sign a prepared transaction. The signed transaction must subsequently be [submitted](#submit).
35893591

@@ -3593,11 +3595,13 @@ Name | Type | Description
35933595
---- | ---- | -----------
35943596
txJSON | string | Transaction represented as a JSON string in rippled format.
35953597
keypair | object | *Optional* The private and public key of the account that is initiating the transaction.
3598+
(This field is exclusive with keypair).
35963599
*keypair.* privateKey | string | The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key of the account that is initiating the transaction.
35973600
*keypair.* publicKey | string | The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key of the account that is initiating the transaction.
35983601
options | object | *Optional* Options that control the type of signature that will be generated.
35993602
*options.* signAs | [address](#ripple-address) | *Optional* The account that the signature should count for in multisigning.
3600-
secret | secret string | *Optional* The secret of the account that is initiating the transaction.(This field is exclusive with keypair).
3603+
secret | secret string | *Optional* The secret of the account that is initiating the transaction.
3604+
(This field is exclusive with keypair).
36013605

36023606
### Return Value
36033607

‎docs/src/sign.md.ejs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## sign
22

3-
`sign(txJSON: string, secret: string, options: Object): {signedTransaction: string, id: string}
4-
sign(txJSON: string, keypair: Object, options: Object): {signedTransaction: string, id: string}`
3+
```
4+
sign(txJSON: string, secret: string, options: Object): {signedTransaction: string, id: string}
5+
sign(txJSON: string, keypair: Object, options: Object): {signedTransaction: string, id: string}
6+
```
57

68
Sign a prepared transaction. The signed transaction must subsequently be [submitted](#submit).
79

‎src/common/schemas/input/sign.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"secret": {
1111
"type": "string",
1212
"format": "secret",
13-
"description": "The secret of the account that is initiating the transaction.(This field is exclusive with keypair).",
13+
"description": "The secret of the account that is initiating the transaction.\n(This field is exclusive with keypair)."
1414
},
1515
"keypair": {
1616
"type": "object",
@@ -24,7 +24,7 @@
2424
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key of the account that is initiating the transaction."
2525
}
2626
},
27-
"description": "The private and public key of the account that is initiating the transaction.",
27+
"description": "The private and public key of the account that is initiating the transaction.\n(This field is exclusive with keypair).",
2828
"required": ["privateKey", "publicKey"]
2929
},
3030
"options": {

‎src/transaction/sign.js

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ function computeSignature(tx: Object, privateKey: string, signAs: ?string) {
1515
function sign(txJSON: string, keypair, options?: Object = {}
1616
): {signedTransaction: string; id: string} {
1717
if(typeof(keypair) === 'string') {
18-
validate.sign({txJSON, keypair})
19-
// we can't validate that the secret matches the account because
20-
// the secret could correspond to the regular key
2118
keypair = keypairs.deriveKeypair(keypair)
2219
}
2320
const tx = JSON.parse(txJSON)

‎test/api-test.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ describe('RippleAPI', function() {
452452
const result = this.api.sign(requests.sign.normal.txJSON, keypair);
453453
assert.throws(() => {
454454
const tx = JSON.stringify(binary.decode(result.signedTransaction));
455-
this.api.signWithKeypair(tx, keypair);
455+
this.api.sign(tx, keypair);
456456
}, /txJSON must not contain "TxnSignature" or "Signers" properties/);
457457
});
458458

@@ -858,6 +858,7 @@ describe('RippleAPI', function() {
858858
_.partial(checkResult,
859859
responses.getTransaction.paymentChannelClaim,
860860
'getTransaction'));
861+
});
861862

862863
it('getTransaction - no Meta', function() {
863864
const hash =
@@ -1597,14 +1598,14 @@ describe('RippleAPI - offline', function() {
15971598
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV';
15981599
const settings = requests.prepareSettings.domain;
15991600
const instructions = {
1600-
sequence: 23,
1601-
maxLedgerVersion: 8820051,
1602-
fee: '0.000012'
1601+
sequence: 23,
1602+
maxLedgerVersion: 8820051,
1603+
fee: '0.000012'
16031604
};
16041605
return api.prepareSettings(address, settings, instructions).then(data => {
1605-
checkResult(responses.prepareSettings.flags, 'prepare', data);
1606-
assert.deepEqual(api.sign(data.txJSON, secret),
1607-
responses.prepareSettings.signed);
1606+
checkResult(responses.prepareSettings.flags, 'prepare', data);
1607+
assert.deepEqual(api.sign(data.txJSON, secret),
1608+
responses.prepareSettings.signed);
16081609
});
16091610
});
16101611

0 commit comments

Comments
 (0)