NeoLine
English
English
  • Welcome to NeoLine
  • 🌵Download NeoLine Wallet
    • Mobile
      • Download iOS Version
      • Download Android Version
    • Google Chrome Extension
      • Download Google Chrome Extension
  • 🧩Create and Manage Neo X Wallet
    • Create Neo X (EVM) Wallet
    • Import Neo X (EVM) wallet
    • How to Bridge GAS Using the NeoLine Chrome Extension?
    • How to add and switch networks?
    • About NeoLine Activity
  • 🙂N3 Wallet
    • Neo N3 Wallet User Guide
      • Neo N3 Wallet | Mobile
      • Neo N3 Wallet | NeoLine Chrome Extension
    • Neo N3 Migration Guide
      • Neo N3 Migration Guide | Mobile
      • Neo N3 Migration Guide | NeoLine Chrome Extension
  • 🔒Hardware Wallet
    • Ledger Hardware Wallet
  • 🌈Getting Started
    • How to Securely and Correctly Backup Your Wallet?
    • One Pass Setting for NeoLine Extension Wallet
    • How to Use the Address Book?
    • How to Speed Up or Cancel a Pending Transaction?
    • How to Delete Unused Wallet Accounts in the NeoLine Wallet?
    • Manage Assets
      • How to Add/Manage Assets?
      • How to Add NFTs
      • How to Use NeoLine Wallet for Transfer and Receive
      • How to Transfer to Other Wallets/Exchanges
    • FAQ
  • Reference
    • Neo3 provider API
      • Read Methods
        • getProvider
        • getBalance
        • getStorage
        • invokeRead
        • invokeReadMulti
        • verifyMessage
        • verifyMessageV2
        • getBlock
        • getTransaction
        • getApplicationLog
        • pickAddress
        • AddressToScriptHash
        • ScriptHashToAddress
      • Write Methods
        • send
        • invoke
        • invokeMultiple
        • signMessage
        • signMessageV2
        • signMessageWithoutSalt
        • signMessageWithoutSaltV2
        • signTransaction
        • switchWalletNetwork
        • switchWalletAccount
      • Common Methods
        • getNetworks
        • getAccount
        • getPublicKey
      • Common Events
        • READY
        • ACCOUNT_CHANGED
        • CONNECTED
        • DISCONNECTED
        • NETWORK_CHANGED
        • BLOCK_HEIGHT_CHANGED
        • TRANSACTION_CONFIRMED
      • Event Methods
        • addEventListener
        • removeEventListener
      • Errors
        • Errors
    • Neo2 provider API
      • Read Methods
        • getProvider
        • getNetworks
        • getAccount
        • getPublicKey
        • getBalance
        • getStorage
        • invokeRead
        • verifyMessage
        • getBlock
        • getTransaction
        • getApplicationLog
      • Write Methods
        • send
        • invoke
        • invokeMulti
        • signMessage
        • deploy
        • switchWalletNetwork
        • switchWalletAccount
      • Events
        • READY
        • ACCOUNT_CHANGED
        • CONNECTED
        • DISCONNECTED
        • NETWORK_CHANGED
        • BLOCK_HEIGHT_CHANGED
        • TRANSACTION_CONFIRMED
      • Event Methods
        • addEventListener
        • removeEventListener
      • Errors
        • Errors
    • Ethereum provider API
    • JSON-RPC API
      • eth_requestAccounts
      • eth_accounts
      • eth_chainId
      • personal_sign
      • eth_signTypedData_v4
      • eth_sendTransaction
      • wallet_addEthereumChain
      • wallet_switchEthereumChain
      • wallet_watchAsset
  • 💬Contact Us
    • Contact Us
由 GitBook 提供支持
在本页
  • Input Arguments
  • Success Response
  • Error Response
  • Example
  • Request
  • Response

这有帮助吗?

  1. Reference
  2. Neo3 provider API
  3. Write Methods

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"
}
上一页signMessageWithoutSaltV2下一页switchWalletNetwork

最后更新于7个月前

这有帮助吗?