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

deploy

Will deploy a compiled smart contract to the blockchain with the provided input parameters. The GAS cost for deploying the contract will be calculated by the provider, and displayed to the user upon tx acceptance or rejection.

Input Arguments

Parameter
Description

network?: string

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

name: string

The name of the contract to be deployed

version: string

The version of the contract to be deployed

author: string

The author of the contract to be deployed

email: string

The email of the contract to be deployed

description: string

The description of the contract to be deployed

needsStorage?: boolean

Whether or not the contract will use storage

dynamicInvoke?: boolean

Whether or not the contract will be performing dynamic invocations of other smart contracts

isPayable?: boolean

Whether or not the contract will be able to accept native assets

parameterList: string

The list of input argument types for the Main function on the contract. https://docs.neo.org/en-us/sc/Parameter.html

returnType: string

The list of output returnType argument types. https://docs.neo.org/en-us/sc/Parameter.html

code: string

The hex of the compiled smart contract avm

netowrkFee: number

The network fee to execute the transaction, in addition to the deploy fee which will be added automatically

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 invocation

nodeURL: string

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

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

Parameter
Description

txid: string

The transaction ID of the 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.deploy({
  network: 'TestNet',
  name: 'Hello world!',
  version: 'v1.0.0',
  author: 'NEOLine',
  email: 'info@neoline.network',
  description: 'My first contract.',
  needsStorage: true,
  dynamicInvoke: false,
  isPayable: false,
  parameterList: '0710',
  returnType: '05',
  code: '53c56b0d57616b652075702c204e454f21680f4e656f2e52756e74696d652e4c6f6761006c7566',
  networkFee: '0.001'
})
.then(({txid, nodeURL}: InvokeOutput) => {
  console.log('Deploy transaction success!');
  console.log('Transaction ID: ' + txid);
  console.log('RPC node URL: ' + nodeURL);
})
.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

{
  txid: '629b5f35e42aa6b65cd97ae3a95f89547596f4e2783c8778428c7f32df07918e',
  nodeUrl: 'https://testnet.api.neoline.io'
};  
上一页signMessage下一页switchWalletNetwork

最后更新于7个月前

这有帮助吗?