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. Neo2 provider API
  3. Write Methods

send

Invoke a transfer of a specified amount of a given asset from the connected account to another account.

Input Arguments

Parameter
Description

fromAddress: string

Address of the connected account to send the assets from

toAddress: string

Address of the receiver of the assets to be sent

asset: string

Asset script hash to be sent. Accepts asset symbol only for "MainNet"

amount: string

The parsed amount of the asset to be sent

remark?: string

Description of the transaction to be made

fee?: string

The parsed amount of network fee (in GAS) to include with transaction

network?: string

Network to submit this request to. If omitted, will default to network the wallet is currently set to

broadcastOverride?: boolean

In the case that the dApp would like to be responsible for broadcasting the signed transaction rather than the wallet provider

Success Response

In the case where the "broadcastOverride" input argument is not set, or set to false.

Parameter
Description

txid: string

The transaction ID of the send invocation

nodeURL: string

The node which the transaction was broadcast to. Returned if transaction is broadcast by wallet provider

In the case where the "broadcastOverride" input argument is set to True.

Parameter
Description

txid: string

The transaction ID of the send invocation

signedTx: string

The serialized signed transaction. Only returned if the broadcastOverride input argument was set to True

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

neoline.send({
  fromAddress: 'AWSEU4BXpjGVdw9ajnFBXh8Rg8cgw9f3Zo',
  toAddress: 'ALWNCcuQDoE287UWvYhRZYpPBDfswggbTX',
  asset: 'NEO',
  amount: '1',
  remark: 'NEOLine',
  fee: '0.0001',
  network: 'TestNet',
  broadcastOverride: false
})
.then(result => {
  console.log('Send transaction success!');
  console.log('Transaction ID: ' + result.txid);
  console.log('RPC node URL: ' + result.nodeURL);
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'NO_PROVIDER':
        console.log('No provider available.');
        break;
    case 'RPC_ERROR':
        console.log('There was an error when broadcasting this transaction to the network.');
        break;
    case 'MALFORMED_INPUT':
        console.log('The receiver address provided is not valid.');
        break;
    case 'CANCELED':
        console.log('The user has canceled this transaction.');
        break;
    case 'INSUFFICIENT_FUNDS':
        console.log('The user has insufficient funds to execute this transaction.');
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});

Response

{
  txid: 'cb0cf81cdd75762545965038cea350c717a5d500bb40d4ca80fe45f416f564ac',
  nodeURL: 'https://testnet.api.neoline.io'
}
上一页Write Methods下一页invoke

最后更新于7个月前

这有帮助吗?