signTransaction

Sign the provided transaction with the account selected by the user.

Input Arguments

Parameter
Description

transaction: TransactionLike

The transaction to sign

magicNumber?: number

Magic number of network found in protocol.json.

Success Response

Parameter
Description

transaction: TransactionLike

Signed transaction

Error Response

Parameter
Description

type: string

The type of error which has occured

description: string

A description of the error which has occured

data: string

Any raw data associated with the error

Example

Request

neolineN3.signTransaction({
  transaction: {
    version: 0,
    nonce: 1262108766,
    systemFee: 997775,
    networkFee: 122862,
    validUntilBlock: 667132,
    attributes: [],
    signers: [{ account: "8ddd95c4b5aa2b049abae570cf9bd4476e9b7667", scopes: 1 }],
    witnesses: [],
    script: "0b110c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d0c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d14c01f0c087472616e736665720c14f563ea40bc283d4d0e05c48ea305b3f2a07340ef41627d5b52"
  },
  magicNumber: 877933390
})
.then(signedTx => {
  console.log('Signed Transaction:', signedTx);
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'UNKNOWN_ERROR':
        console.log(description);
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});

Response

{
  version: 0,
  nonce: 1262108766,
  systemFee: 997775,
  networkFee: 122862,
  validUntilBlock: 667132,
  attributes: [],
  signers: [{ account: "8ddd95c4b5aa2b049abae570cf9bd4476e9b7667", scopes: 1 }],
  witnesses: [{
    invocationScript: "0c408f8bee3201d41706834fb91c8696d59744dfd927bea5a6bddd21d952d231f8836b0386989ecf017a1d0096c0acdb99503d29f65588bc4021b66a80f4b277ad8c",
    verificationScript: "0c2102f9667a14b62a551f25a1b1ec4562e1c963ec6334d1ef5e088f3b5febddf4e6484156e7b327"
  }],
  script: "0b110c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d0c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d14c01f0c087472616e736665720c14f563ea40bc283d4d0e05c48ea305b3f2a07340ef41627d5b52"
}

最后更新于