NAV Navbar

NEO Dapi introduction

NEO Dapi is a generic Dapi standard in the NEO environment that is maintained by NEL in conjunction with O3 and other NEO community members.

The programs that provide Dapi come in a variety of forms, including NEL's Teemo Chrome extension wallet, O3 wallet and other forms.

We do our best to implement the overall consistencey and compatibility of the Dapis, but each Dapi provider (program) varies slightly depending on its own characteristics.

Here we will provide the developer Dapi calling methods (part of which are only related to the NEL's Teemo Chrome extension wallet).

Teemo extension wallet

Teemo is a Chrome extension wallet developed by NEL. The wallet aims to minimize Dapp developers'time spent on the front-end, so that Dapp developers could focus on Dapp development itself, rather than on interactions with NEO.

Another feature of the extension wallet is security.The Teemo wallet protects the user's wallet private key inside the extension, which Dapp cannot access directly. And user authorization is required when signing a signature(sending a transaction) using a private key each time. In fact,the user's address is invisible to the unauthorized Dapp. In this way, users only need to trust and use one and the same wallet and can safely try any novel Dapps without worrying about security issues

Teemo Resources

Teemo Github

Teemo installation and development

Installation and experience

Development Version

Clone the project

Git clone https://github.com/NewEconoLab/TeemoWallet.git

Open Chrome (latest version) Chrome menu - more tools - extensions

Switch to developer mode

Click on "Load unzipped extensions" - select the **TeemoWallet\dist folder

You can configure the **TeemoWallet\test folder as a website (such as http://localhost/).You Can also browse https://teemo.nel.group/test/ ,Free from deploying

Open this website and test the events and all the methods. This website page is also a development example.

Stable Version

Github Release

Download the release ZIP package and unzip it. The other steps are the same as the development version.

Start development

window.addEventListener('Teemo.NEO.READY',(data:CustomEvent)=>{
    console.log("Teemo READY ");
    console.log(JSON.stringify(data.detail))

    const main = new Main();
    main.start();//After listening to this event, you can start the related method call of the plugin.
})

Teemo's Dapi does not need to reference any JS or NPM packages before calling. The JS code that interacts with Teemo is automatically injected into your page, but this injection may not always be done before your first Dapi call code.

In order to always interact with Teemo, we strongly recommend that the "Teemo.NEO.READY" event be captured first before any Dapi method is used. This event represents that the Teemo interaction JS has been injected into your page.

If you are developing with TS (TypeScript), you may also need to add https://github.com/NewEconoLab/TeemoWallet/blob/master/dist/js/inject.d.ts to your directory, which will help the tsc engine. Identify Dapi methods and types.

Read Methods

Read methods do not alter the state of the blockchain. It can help you query information about your user, and provide you with relevant information:

getProvider

Teemo.NEO.getProvider()
.then((provider: Provider) => {
  const {
    name,
    website,
    version,
    compatibility,
    extra,
  } = provider;

  const {
    theme,
    currency,
  } = extra;

  console.log('Provider name: ' + name);
  console.log('Provider website: ' + website);
  console.log('Provider dAPI version: ' + version);
  console.log('Provider dAPI compatibility: ' + JSON.stringify(compatibility));
  console.log('Provider UI theme: ' + theme);
  console.log('Provider Base currency: ' + currency);
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case CONNECTION_DENIED:
      console.log('The user rejected the request to connect with your dApp.');
      break;
  }
});

Example Response

{
  "name": "TeemoWallet",
  "version": "0.1",
  "website": "nel.group",
  "compatibility": [
    "typescript",
    "javascript"
  ],
  "extra": {
    "theme": "",
    "currency": ""
  }
}

Returns information about the dAPI provider, including who this provider is, the version of their dAPI, and the NEP that the interface is compatible with.

Input Arguments

None

Success Response

Parameter Type Description
name String The name of the wallet provider
website String The website of the wallet provider
version String The version of the dAPI that the the wallet supports
compatibility String[] A list of all applicable NEPs which the wallet provider supports
extra Object Provider specific attributes
extra
Parameter Type Description
theme string UI theme of the provider
currency string Base currency set by user

Error Response

Parameter Type 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

getNetworks

dapi.NEO.getNetworks()
.then(response => {
  const {
    networks,
    defaultNetwork,
  } = response.networks;

  console.log('Networks: ' + networks);
  // eg. ["TestNet", "TestNet", "PrivateNet"]

  console.log('Default network: ' + defaultNetwork);
  // eg. "TestNet"
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case CONNECTION_DENIED:
      console.log('The user rejected the request to connect with your dApp');
      break;
  }
});

Example Response

{
  networks: ["TestNet", "TestNet", "PrivateNet"],
  defaultNetwork: "TestNet",
}

Returns the networks the wallet provider has available to connect to, along with the default network the wallet is currently set to.

Input Arguments

None

Success Response

Parameter Type Description
networks String[] A list of all networks which this wallet provider allows access to
defaultNetwork String Network the wallet is currently set to

Error Response

Parameter Type 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

getAccount

Teemo.NEO.getAccount()
.then((account: Account) => {
  const {
    address,
    label,
  } = account;

  console.log('Account address: ' + address);
  console.log('Account label: ' + label);
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case CONNECTION_DENIED:
      console.log('The user rejected the request to connect with your dApp');
      break;
  }
});

Example Response

{
  address: 'AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru',
  label: 'My Spending Wallet'
}

Return the Account that is currently connected to the dApp.

Success Response

Parameter Type Description
address String The address of the account that is currently connected to the dapp
label String A label the users has set to identify their wallet

Error Response

Parameter Type 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

getBalance

Teemo.NEO.getBalance({
  params:{  
    "address": "ASBhJFN3XiDu38EdEQyMY3N2XwGh1gd5WW",  
    "assets": ["74f2dc36a68fdc4682034178eb2220729231db76"]
  },
  network: 'TestNet',
})
.then((results: BalanceResults) => {
  Object.keys(results).forEach(address => {
    const balances = results[address];
    balances.forEach(balance => {
      const { assetID, symbol, amount } = balance

      console.log('Address: ' + address);
      console.log('Asset ID: ' + assetID);
      console.log('Asset symbol: ' + symbol);
      console.log('Amount: ' + amount);
    });
  });
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case CONNECTION_DENIED:
      console.log('The user rejected the request to connect with your dApp');
      break;
  }
});

Single Address with specific balances requested

// input
{
  params: {
    address: 'AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru',
    assets: ["602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7"]
  },
  network: 'TestNet',
}

// output
{
  AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru: [
    {
      assetID: '602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7',
      symbol: 'GAS',
      amount: '0.00000233',
    }
  ],
}

Single Address with all balances requested

// input
{
  params: {
    address: 'AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru',
  },
  network: 'TestNet',
}

// output
{
  AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru: [
    {
      assetID: 'c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b',
      symbol: 'NEO',
      amount: '10',
    },
    {
      assetID: '602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7',
      symbol: 'GAS',
      amount: '777.0001',
    },
    {
      assetID: '74f2dc36a68fdc4682034178eb2220729231db76',
      symbol: 'CGAS',
      amount: '0.00000233',
    },
    {
      assetID: 'fc732edee1efdf968c23c20a9628eaa5a6ccb934',
      symbol: 'NNC',
      amount: '2000',
    }
  ]
}

Multiple address balance queries

// input
{
  params: [
    {
      address: 'AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru',
    },
    {
      address: 'AbKNY45nRDy6B65YPVz1B6YXiTnzRqU2uQ',
      asset: ["602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7"],
    },
  ],
  network: 'TestNet',
}

// output
{
  AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru: [
    {
      assetID: 'c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b',
      symbol: 'NEO',
      amount: '10',
    },
    {
      assetID: '602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7',
      symbol: 'GAS',
      amount: '777.0001',
    },
    {
      assetID: '74f2dc36a68fdc4682034178eb2220729231db76',
      symbol: 'CGAS',
      amount: '0.00000233',
    },
    {
      assetID: 'fc732edee1efdf968c23c20a9628eaa5a6ccb934',
      symbol: 'NNC',
      amount: '2000',
    }
  ],
  AbKNY45nRDy6B65YPVz1B6YXiTnzRqU2uQ: [
    {
      assetID: '602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7',
      symbol: 'GAS',
      amount: '11000',
    }
  ]
}

Allows the DAPP to query the balance of a user, this includes both native assets (NEO/GAS) and NEP-5 tokens

Input Arguments

Parameter Type Description
params BalanceRequest or BalanceRequest[] A list of Balance Request Objects, specifying which addresses, and which assets to query
network String The call will only work for the networks available in the GetNetworks command

Balance Request

Parameter Type Description
address String The address whose balance you want to query
assets String[] A list of contract hash (or symbold on TestNet only) to query the balance for
fetchUTXO? boolean The response will fetch NEO and GAS UTXO's if this attribute is true(Teemo Not yet supported)

Success Response

Parameter Type Description
address_1 BalanceResponse[] This key is the actual address of the query eg. "AeysVbKWiLSuSDhg7DTzUdDyYYKfgjojru"
address_2 BalanceResponse[] This key is the actual address of the query eg. "AbKNY45nRDy6B65YPVz1B6YXiTnzRqU2uQ"
address_n BalanceResponse[] This key is the actual address of the query eg. "AUdawyrLMskxXMUE8osX9mSLKz8R7777kE"

BalanceResponse

Parameter Type Description
assetID String ID of the given asset
symbol String Symbol of the given asset
amount String Double Value of the balance represented as a String
unspent UTXO[]? If fetch utxo's was turned on then the utxo array will be returned for the native assets NEO and GAS(Teemo Not yet supported)

UTXO (Teemo Not yet supported)

Parameter Type Description
asset String Script hash of the native asset
createdAtBlock String Block number where this utxo was created
index Int Output index of the UTXO relative to the txid in which it was created
txid String The transaction id of this UTXO
value String The double value of this UTXO represented as a String

getStorage

Teemo.NEO.getStorage({
    "scriptHash":"03febccf81ac85e3d795bc5cbd4e84e907812aa3",
    "key":"5065746572",
    "network":"TestNet"
})
.then(res => {
  const value = res.result;
  console.log('Storage value: ' + value);
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case CONNECTION_REFUSED:
      console.log('Connection dApp not connected. Please call the "connect" function.');
      break;
    case RPC_ERROR:
      console.log('There was an error when broadcasting this transaction to the network.');
      break;
  }
});

Example Response

{
  result: '4c696e'
}

Returns the raw value located in contract storage

Input Arguments

Parameter Type Description
scriptHash String Scripthash of the contract whose storage you are querying on
key String Key of the storage value to retrieve from the contract
network String Network alias to submit this request to.

Success Response

Parameter Type Description
result String The raw value located in contract storage

Error Response

Parameter Type 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

invokeRead

Teemo.NEO.invokeRead({
  scriptHash: '505663a29d83663a838eee091249abd167e928f5',
  operation: 'calculatorAdd',
  arguments: [
    {
      type: 'integer',
      value: 2
    },
    {
      type: 'integer',
      value: 10
    }
  ],
  network: 'TestNet'
})
.then((result: Object) => {
  console.log('Read invocation result: ' + JSON.stringigy(result));
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case CONNECTION_REFUSED:
      console.log('Connection dApp not connected. Please call the "connect" function.');
      break;
   case RPC_ERROR:
    console.log('There was an error when broadcasting this transaction to the network.');
    break;
  }
});

Example Response

{
  script: '8h89fh398f42f.....89hf2894hf9834',
  state: 'HALT, BREAK',
  gas_consumed: '0.13',
  stack: [
    {
      type: 'Integer',
      value: '1337'
    }
  ]
}

Execute a contract invocation in read-only mode.

Input Arguments

Parameter Type Description
scriptHash String The script hash of the contract you want to invoke a read on
operation String The operation on the smart contract that you want to invoke a read on
args Argument[] The input arguments necessary to perform this operation
network String Network alias to submit this request to. If omitted, will default to "TestNet"

Argument

Parameter Type Description
type String The type of the argument with you are using
value String String representation of the argument which you are using

Success Response

The wallet will return the direct response from the RPC node.

Parameter Type Description
script String The script which was run
state String Status of the executeion
gas_consumed String Estimated amount of GAS to be used to execute the invocation. (Up to 10 free per transaction)
stack Argument[] An array of response arguments

Error Response

Parameter Type 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

invokeReadGroup

Teemo.NEO.invokeReadGroup({
  "group":[
      {
          "scriptHash": "fc732edee1efdf968c23c20a9628eaa5a6ccb934",
          "operation": "totalSupply",
          "arguments": [],
          "network": "TestNet"
      },
      {
          "scriptHash": "fc732edee1efdf968c23c20a9628eaa5a6ccb934",
          "operation": "name",
          "arguments": [],
          "network": "TestNet"
      },
      {
          "scriptHash": "fc732edee1efdf968c23c20a9628eaa5a6ccb934",
          "operation": "symbol",
          "arguments":[],
          "network": "TestNet"
      },
      {
          "scriptHash": "fc732edee1efdf968c23c20a9628eaa5a6ccb934",
          "operation": "decimals",
          "arguments": [],
          "network": "TestNet"
      }
  ]
})
.then((result: Object) => {
  console.log('Read invocation result: ' + JSON.stringigy(result));
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case CONNECTION_REFUSED:
      console.log('Connection dApp not connected. Please call the "connect" function.');
      break;
   case RPC_ERROR:
    console.log('There was an error when broadcasting this transaction to the network.');
    break;
  }
});

Example Response

{
  "script": '8h89fh398f42f.....89hf2894hf9834',
  "state": "HALT, BREAK",
  "gas_consumed": "0.648",
  "stack": [
    {
      "type": "ByteArray",
      "value": "00e8764817"
    },
    {
      "type": "ByteArray",
      "value": "4e454f204e616d6520437265646974"
    },
    {
      "type": "ByteArray",
      "value": "4e4e43"
    },
    {
      "type": "Integer",
      "value": "2"
    }
  ]
}

Execute a contract invocation group in read-only mode.You can get multiple information in the contract at one time, such as getting all the basic information of NEP5 at one time.

Input Parameters

Parameter Type Description
group invokeRead[] An array of invokeRead input arguments

invokeRead

Parameter Type Description
scriptHash String The script hash of the contract you want to invoke a read on
operation String The operation on the smart contract that you want to invoke a read on
args Argument[] The input arguments necessary to perform this operation
network String Network alias to submit this request to. If omitted, will default to "TestNet"

Argument

Parameter Type Description
type String The type of the argument with you are using
value String String representation of the argument which you are using

Success Response

The wallet will return the direct response from the RPC node.

Parameter Type Description
script String The script which was run
state String Status of the executeion
gas_consumed String Estimated amount of GAS to be used to execute the invocation. (Up to 10 free per transaction)
stack Argument[] An array of response arguments

Error Response

Parameter Type 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

getBlock

Teemo.NEO.getBlock({
            blockHeight:1112,
            network:"TestNet",
        }) 
.then(result=>{
    console.log(result);
    document.getElementById("getBlock_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log(error);
    reject();
})

Example Response

{
  "hash": "0xb4864e0cadb79cedc11f58b2a73e9669b784e6f3eef12dcc834bad6540043c5b",
  "size": 686,
  "version": 0,
  "previousblockhash": "0xe44d7b49ca1849633713eb3266e70d63dd4ce7c17d5ea69a33101cdeb94e2bb3",
  "merkleroot": "0x6e16a374409b9e47fbf6bba2966312b350e8c85137badb99d0991baa3a380513",
  "time": 1494421978,
  "index": 1112,
  "nonce": "ffd3824d7059d835",
  "nextconsensus": "AdyQbbn6ENjqWDa5JNYMwN3ikNcA4JeZdk",
  "script": {
    "invocation": "40bcc2d6213bb9e6b0b2f4ad026fb0e93b26699637d047cdb2bd2cd9625058689b8a9b1db5e9ee4806872465f782b30344ed73d3f106384cfe8001ccd202f33ac640710ed0a89eed529e8ea8193853e3dc7169f1c287f3cd66d5667e720b3b6ba1d60c071a9a2d0d69217f6154953cc4a242d579612eeedd8a1172f73d16f9b66acd40fadd8a94368d184e91fd2949e1cc01d27bbb3590d49330cf88a584163c3c83f9dc7c8d530cc14d7cb83f592cc6eaacfa34d40d777c536ae1bde646413f429925405ef0ba5cf018d84ea857073d19062fb18528506c0ab14540612b939ef09647b227f107002032f38b5f34f085602648927e7080c55bb777559e530b6c2042798640562bcd08de9cb9ac9c72fee14b99b60afa7549fd319e76d76dee4d1ecdd5393454ba4a2009c7454396836b200f3a6ef88b0fc720d741f915185f9adb36d356f8",
    "verification": "55210209e7fd41dfb5c2f8dc72eb30358ac100ea8c72da18847befe06eade68cebfcb9210327da12b5c40200e9f65569476bbff2218da4f32548ff43b6387ec1416a231ee821034ff5ceeac41acf22cd5ed2da17a6df4dd8358fcb2bfb1a43208ad0feaab2746b21026ce35b29147ad09e4afe4ec4a7319095f08198fa8babbe3c56e970b143528d2221038dddc06ce687677a53d54f096d2591ba2302068cf123c1f2d75c2dddc542557921039dafd8571a641058ccc832c5e2111ea39b09c0bde36050914384f7a48bce9bf92102d02b1873a0863cd042cc717da31cea0d7cf9db32b74d4c72c01b0011503e2e2257ae"
  },
  "tx": [
    {
      "txid": "0x6e16a374409b9e47fbf6bba2966312b350e8c85137badb99d0991baa3a380513",
      "size": 10,
      "type": "MinerTransaction",
      "version": 0,
      "attributes": [],
      "vin": [],
      "vout": [],
      "sys_fee": "0",
      "net_fee": "0",
      "scripts": [],
      "nonce": 1884936245
    }
  ],
  "confirmations": 2607282,
  "nextblockhash": "0x2bc8072546971a6b87d154544cd823327efa880e608267de8029b4ce2926593a"
}

Get block information based on block height

Input Parameters

Parameter Type Description
blockHeight Number Block height
network String Network category selection

Success Response

The result will be returned directly from the CLI RPC interface

Parameter Type Description
hash String Block hash
size Number Block size (bytes)
version Number The version number of the block execution
previousblockhash String Previous block Hash
merkleroot String Merkel root
time Number Block generation timestamp
index Number Block index (height)
nonce String Block pseudo-random number
nextconsensus String Next master biller
script String Block call signature authentication information
tx TX[] Block containing trading group
confirmations Number Confirmation number (number of blocks after this block)
nextblockhash String Next block hash

Error Response

Parameter Type 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

getTransaction

Teemo.NEO.getTransaction({
            txid:'0c13d46dd72a47b61baf9b14cf787a8325f14cb1bfd5eafb7d407852e53299c6',
            network:"TestNet"
        }) 
.then(result=>{
    console.log(result);
    document.getElementById("getTransaction_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log(error);
    reject();
})

Example Response

{
  "txid": "0x0c13d46dd72a47b61baf9b14cf787a8325f14cb1bfd5eafb7d407852e53299c6",
  "size": 203,
  "type": "InvocationTransaction",
  "version": 0,
  "attributes": [
    {
      "usage": "Script",
      "data": "55d6d86bdec15db437aca45b4e8705333f1fdb07"
    }
  ],
  "vin": [],
  "vout": [],
  "sys_fee": "0",
  "net_fee": "0",
  "scripts": [
    {
      "invocation": "40091fac773afb2a988e62f0652066e0a730b30a943c953b20b2396a0482501a626e34522d2def050c6651c1000cd7b638397f0ab068d878935986e3e027d096fd",
      "verification": "2103ea379c3fa408d71a4021ec77112478f790c698177352d81575328901ae0ee0e4ac"
    }
  ],
  "script": "0233117504201104431455d6d86bdec15db437aca45b4e8705333f1fdb070a736e656f5f707269636553c10873657454797065426797210e7c98582151ceb37f9748c9a1d27d9ae6fd",
  "gas": "0",
  "blockhash": "0x03e55a9ca7e205bf94b0dbf3c22a47af5b0a7d7233cb296067d0121e6cd08229",
  "confirmations": 64041,
  "blocktime": 1555303134
}

Get transaction information based on TXID

Input Parameters

Parameter Type Description
txid String Transaction Hash
network String Network category selection

Success Response

The result will be returned directly from the CLI RPC interface

Parameter Type Description
txid String Transaction Hash
size Number Transaction Size (bytes)
type String Transaction Type
version Number Transaction Version
attributes attribute[] Transaction Additional attribute group
vin UTXOinput[] UTXO Inputs
vout UTXOouttput[] UTXO Outputs
sys_fee String Transaction System fee
net_fee String Transaction Net fee
scripts script[] Transaction Signature authentication information group
script String Transaction Invoke script
gas String Transaction Consume GAS
blockhash String Transaction Block Hash
confirmations Number Transaction Block Confirmation number
blocktime Number Transaction Block timestamp

Error Response

Parameter Type 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

getApplicationLog

Teemo.NEO.getApplicationLog({
            txid:'0c13d46dd72a47b61baf9b14cf787a8325f14cb1bfd5eafb7d407852e53299c6',
            network:"TestNet"
        }) 
.then(result=>{
    console.log(result);
    document.getElementById("getApplicationLog_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log(error);
    reject();
})

Example Response

{
  "txid": "0x0c13d46dd72a47b61baf9b14cf787a8325f14cb1bfd5eafb7d407852e53299c6",
  "executions": [
    {
      "trigger": "Application",
      "contract": "0xad23d4ccc2e8d4f2747ab15c35f2852761b8df51",
      "vmstate": "HALT, BREAK",
      "gas_consumed": "9.509",
      "stack": [
        {
          "type": "Integer",
          "value": "1"
        }
      ],
      "notifications": [
        {
          "contract": "0xfde69a7dd2a1c948977fb3ce512158987c0e2197",
          "state": {
            "type": "Array",
            "value": [
              {
                "type": "ByteArray",
                "value": "6f7261636c654f70657261746f72"
              },
              {
                "type": "ByteArray",
                "value": "55d6d86bdec15db437aca45b4e8705333f1fdb07"
              },
              {
                "type": "ByteArray",
                "value": "736e656f5f7072696365"
              },
              {
                "type": "ByteArray",
                "value": ""
              },
              {
                "type": "ByteArray",
                "value": "20110443"
              },
              {
                "type": "Integer",
                "value": "2"
              }
            ]
          }
        },
        {
          "contract": "0xfde69a7dd2a1c948977fb3ce512158987c0e2197",
          "state": {
            "type": "Array",
            "value": [
              {
                "type": "ByteArray",
                "value": "6f7261636c654f70657261746f72"
              },
              {
                "type": "ByteArray",
                "value": "55d6d86bdec15db437aca45b4e8705333f1fdb07"
              },
              {
                "type": "ByteArray",
                "value": "736e656f5f7072696365"
              },
              {
                "type": "ByteArray",
                "value": ""
              },
              {
                "type": "Integer",
                "value": "1127710905"
              },
              {
                "type": "Integer",
                "value": "5"
              }
            ]
          }
        }
      ]
    }
  ]
}

Get the transaction execution log according to the TXID

Input Parameters

Parameter Type Description
txid String Transaction Hash
network String Network category selection

Success Response

The result will be returned directly from the CLI RPC interface

Parameter Type Description
txid String Transaction Hash
executions execution[] Transaction execution Array
executions.trigger String Transaction execution trigger type
executions.contract String Transaction execution Script Hash
executions.vmstate String Transaction execution VM state(Is the VM crashing halfway)
executions.gas_consumed String Transaction execution Consume GAS
executions.stack TypeValue[] Transaction execution Output stack (contract return value)
executions.notifications notification[] Transaction execution notification Array

notification structure

Parameter Type Description
contract String Contract Hash where the transaction execution notice is located
state TypeValue Transaction execution notification data

Error Response

Parameter Type 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

Write Methods

Write methods will alter the state on the blockchain, and require a user signature.

send

Teemo.NEO.send({
  fromAddress: 'ATaWxfUAiBcQixNPq6TvKHEHPQum9bx79d',
  toAddress: 'ATaWxfUAiBcQixNPq6TvKHEHPQum9bx79d',
  asset: '602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7',
  amount: '0.0001',
  remark: 'Hash puppy clothing purchase. Invoice#abc123',
  fee: '0.0001',
  network: 'MainNet'
})
.then(({txid, nodeUrl}: SendOutput) => {
  console.log('Send transaction success!');
  console.log('Transaction ID: ' + txid);
  console.log('RPC node URL: ' + nodeUrl);
})
.catch(({type: string, description: string, data: any}) => {
  switch(type) {
    case NO_PROVIDER:
      console.log('No provider available.');
      break;
    case SEND_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;
  }
});

Example Response

{
  txid: 'ed54fb38dff371be6e3f96e4880405758c07fe6dd1295eb136fe15f311e9ff77',
  nodeUrl: 'http://seed7.ngd.network:10332',
}

The send API can be used for accepting payments from the user in a cryptocurrency that is located on the NEO blockchain. It requires user authentication in order for the transaction to be relayed. The transaction will be relayed by the wallet.

Input Arguments

Parameter Type Description
fromAddress String The address from where the transaction is being sent. This will be the same value as the one received from the getAccount API
toAddress String The address to where the user should send their funds
asset String The asset which is being requested for payment...e.g NEP5 scripHash, GAS or CGAS
amount String The amount which is being requested for payment
remark String? A transaction attribute remark which may be placed in the transaction, this data will appear in the transaction record on the blockchain
fee String? If a fee is specified then the wallet SHOULD NOT override it, if a fee is not specified the wallet SHOULD allow the user to attach an optional fee
network String Network alias to submit this request to.

Success Response

Parameter Type Description
txid String The transaction id of the send request which can be queried on the blockchain
nodeURL String The node to which the transaction was submitted to

Error Response

Parameter Type 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

Invoke

Teemo.NEO.invoke({
  "scriptHash":"74f2dc36a68fdc4682034178eb2220729231db76",
  "operation":"transfer",
  "arguments":[
      {
        "type":"Address",
        "value":"AHDV7M54NHukq8f76QQtBTbrCqKJrBH9UF"
      },
      {
        "type":"Address",
        "value":"AbU7BUQHW9sa69pTac7pPR3cq4gQHYC1DH"
      },
      {
        "type":"Integer",
        "value":"100000"
      }
  ],
  "fee":"0.001",
  "description":"NNC transfer",
  "network":"TestNet"
})
.then(({txid, nodeUrl}: InvokeOutput) => {
  console.log('Invoke transaction success!');
  console.log('Transaction ID: ' + txid);
  console.log('RPC node URL: ' + nodeUrl);
})
.catch(({type: string, description: string, data: any}) => {
  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 CANCELED:
      console.log('The user has canceled this transaction.');
      break;
  }
});

Example Response

{
  txid: 'ed54fb38dff371be6e3f96e4880405758c07fe6dd1295eb136fe15f311e9ff77',
  nodeUrl: 'http://seed7.ngd.network:10332',
}:

Invoke allows for the generic execution of smart contracts on behalf of the user. It is reccommended to have a general understanding of the NEO blockchain, and to be able successfully use all other commands listed previously in this document before attempting a generic contract execution.

Input arguments

Parameter Type Description
scriptHash String The script hash of the contract that you wish to invoke
operation String The operation on the smart contract that you wish to call. This can be fetched from the contract ABI
args Argument[] A list of arguments necessary to perform on the operation you wish to call
description String For a brief description of the operation, the description will be displayed on the confirmation page of the wallet to help the user understand (the description will not be stored on the Blockchain)
fee String? If a fee is specified then the wallet SHOULD NOT override it, if a fee is not specified the wallet SHOULD allow the user to attach an optional fee
network String Network alias to submit this request to.
attachedAssets AttachedAssets? Describes the assets to attach with the smart contract, e.g. attaching assets to mint tokens during a token sale
assetIntentOverrides AssetIntentOverrides Used to specify the exact UTXO's to use for attached assets. If this is provided fee and attachedAssets will be ignored(Teemo Not yet supported)
triggerContractVerification Boolean? Adds the instruction to invoke the contract verifican trigger(Teemo Not yet supported)

Argument

Parameter Type Description
type String The type of the argument with you are using
value String String representation of the argument which you are using

AttachedAssets

Parameter Type Description
NEO String? The amount of NEO to attach to the contract invocation
GAS String? The amount of GAS to attach to the contract invocation

AssetIntentOverrides(Teemo Not yet supported)

Parameter Type Description
inputs AssetInput[] A list of UTXO inputs to use for this transaction
outputs AssetOutput[] A list of UTXO outputs to use for this transaction

AssetInput(Teemo Not yet supported)

Parameter Type Description
txid String Transaction id to be used as input
index String Index of the UTXO, can be found from transaction details

AssetOutput(Teemo Not yet supported)

Parameter Type Description
asset String asset ID
value String asset amount
address String The address to where the user should send their funds

Success Response

Parameter Type Description
txid String The transaction id of the send request which can be queried on the blockchain
nodeURL String The node to which the transaction was submitted to

Error Response

Parameter Type 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

InvokeGroup

Teemo.NEO.invokeGroup({
  "merge": true,
  "group": [
    {
      "scriptHash": "74f2dc36a68fdc4682034178eb2220729231db76",
      "operation": "transfer",
      "arguments": [
        {
          "type": "Address",
          "value": "AHDV7M54NHukq8f76QQtBTbrCqKJrBH9UF"
        },
        {
          "type": "Address",
          "value": "AbU7BUQHW9sa69pTac7pPR3cq4gQHYC1DH"
        },
        {
          "type": "Integer",
          "value": "100000"
        }
      ],
      "description": "NNC transfer",
      "fee": "0",
      "network": "TestNet"
    },
    {
      "scriptHash": "00d00d0ac467a5b7b2ad04052de154bb9fe8c2ff",
      "operation": "setmoneyin",
      "arguments": [
        {
          "type": "Hook_Txid",
          "value": 0
        },
        {
          "type": "Hash160",
          "value": "74f2dc36a68fdc4682034178eb2220729231db76"
        }
      ],
      "description": "Recharge confirmation",
      "fee": "0.001",
      "network": "TestNet"
    }
  ]
})
.then(({txid, nodeUrl}: InvokeOutput) => {
  console.log('Invoke transaction success!');
  console.log('Transaction ID: ' + txid);
  console.log('RPC node URL: ' + nodeUrl);
})
.catch(({type: string, description: string, data: any}) => {
  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 CANCELED:
      console.log('The user has canceled this transaction.');
      break;
  }
});

Example Response

//merge=true
[
  {
    "txid": "0cba61b8779f3343ff39fbecee596395b06490bce7245412ee788c8620813b63",
    "nodeUrl": "https://api.nel.group/api"
  }
]

//merge=false
[
  {
    "txid": "045e1612d2dd2edf29d6bb45657329bacc299072655691f9cc0f486fb649a30d",
    "nodeUrl": "https://api.nel.group/api"
  },
  {
    "txid": "4747e2b50cbd853c13b24e67d59225816f152a13ee281345751eb51bf811355c",
    "nodeUrl": "https://api.nel.group/api"
  }
]

This method constructs a contract to call a transaction group and sends it, and has two modes: merge mode and non-merge mode:

Merge mode: The wallet will construct each Invoke contract call operation to be entered in order into a single contract invoke transaction body, enabling multiple contract methods to be executed in one transaction. This mode is suitable for small transactions (less costly GAS) for multiple different contracts to be merged into one transaction. Regarding the merge mode, it needs to be paid attention to whether the GAS consumption of the script execution will surpass 10GAS after the merge. In the merge mode, the total fee of the transaction is the sum of the fees in each Invoke element.

Non-merge mode: The wallet will construct each Inovke contract call operation to be entered in order as multiple independent contract invoke transaction bodies. Only after the previous transaction is confirmed as consensus (confirmed on the blockchain), the next transaction will be sent. This mode is suitable for a series of associated contract operations, and is automatically lined up and executed in a logical relationship.

Hook_Txid: This type is specific to the InvokeGroup method, which means that the txid of the previous transaction is used as the input parameter of the next transaction, and both the merge mode and the non-merge mode are supported. However, there are the following restrictions:

  1. Hook_Txid cannot appear in the first Invoke element
  2. The value of Hook_Txid must be 0, meaning that only the txid of the first transaction can be taken.
  3. When using Hook_Txid, you can only define up to two Invoke elements in the merge mode.

Input arguments

Parameter Type Description
merge Boolean Choose to use merge mode
group Invoke[] A list of Invoke

Invoke

Parameter Type Description
scriptHash String The script hash of the contract that you wish to invoke
operation String The operation on the smart contract that you wish to call. This can be fetched from the contract ABI
args Argument[] A list of arguments necessary to perform on the operation you wish to call
description String For a brief description of the operation, the description will be displayed on the confirmation page of the wallet to help the user understand (the description will not be stored on the Blockchain)
fee String? If a fee is specified then the wallet SHOULD NOT override it, if a fee is not specified the wallet SHOULD allow the user to attach an optional fee
network String Network alias to submit this request to.
attachedAssets AttachedAssets? Describes the assets to attach with the smart contract, e.g. attaching assets to mint tokens during a token sale
assetIntentOverrides AssetIntentOverrides Used to specify the exact UTXO's to use for attached assets. If this is provided fee and attachedAssets will be ignored(Teemo Not yet supported)
triggerContractVerification Boolean? Adds the instruction to invoke the contract verifican trigger(Teemo Not yet supported)
Argument
Parameter Type Description
type String The type of the argument with you are using
value String String representation of the argument which you are using

AttachedAssets

Parameter Type Description
NEO String? The amount of NEO to attach to the contract invocation
GAS String? The amount of GAS to attach to the contract invocation

Success Response

Parameter Type Description
[] Array A List of Invoke Response

Invoke Response

Parameter Type Description
txid String The transaction id of the send request which can be queried on the blockchain
nodeURL String The node to which the transaction was submitted to

Error Response

Parameter Type 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

Tool Methods

This type of method is designed to help Dapp validate and transform various types of NEO data and simplify NEO-related code in Dapp development. Most of the conversions are designed to convert the contract data information of getApplicationLog into a form that is easy for humans to understand and which Dapp needs to display.

validateAddress

Teemo.NEO.TOOLS.validateAddress("ASBhJFN3XiDu38EdEQyMY3N2XwGh1gd5WW")
.then(result=>{
    console.log(result);
    console.log("Address verification:"+ result);
    document.getElementById("validateAddress_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("validateAddress_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

true | false

Verify that the entered address is a valid NEO address

Input Arguments

Parameter Type Description
address String Address to be verified

Success Response

Parameter Type Description
result Boolen Validated boolean result

Error Response

Parameter Type 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

getAddressFromScriptHash

Teemo.NEO.TOOLS.getAddressFromScriptHash("72329a15ef9f2ea76cbc8dbc082c72316d87e1ae")
.then(result=>{
    console.log(result);
    console.log("Address:"+ result);
    document.getElementById("getAddressFromScriptHash_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("getAddressFromScriptHash_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

"ASBhJFN3XiDu38EdEQyMY3N2XwGh1gd5WW"

Convert the input scriptHash to an NEO address

Input Arguments

Parameter Type Description
scriptHash String ScriptHash that needs to be converted

Success Response

Parameter Type Description
result String Convert the output NEO address

Error Response

Parameter Type 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

reverseHexstr

Teemo.NEO.TOOLS.reverseHexstr("03febccf81ac85e3d795bc5cbd4e84e907812aa3")
.then(result=>{
    console.log(result);
    document.getElementById("reverseHexstr_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process"); 
    console.log(error);
    document.getElementById("reverseHexstr_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

"a32a8107e9844ebd5cbc95d7e385ac81cfbcfe03"

Reverse the input hexStr

Input Arguments

Parameter Type Description
hexStr String Hexadecimal byte string

Success Response

Parameter Type Description
result String Flip hex string after flipping

Error Response

Parameter Type 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

getStringFromHexstr

Teemo.NEO.TOOLS.getStringFromHexstr("746573742064656d6f")
.then(result=>{
    console.log(result);
    document.getElementById("getStringFromHexstr_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("getStringFromHexstr_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

"test demo"

Convert the input hexStr to a UTF8 string

Input Arguments

Parameter Type Description
hexStr String Hexadecimal byte string

Success Response

Parameter Type Description
result String UTF8 string after conversion

Error Response

Parameter Type 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

getBigIntegerFromHexstr

Teemo.NEO.TOOLS.getBigIntegerFromHexstr("3fb83001")
.then(result=>{
    console.log(result);
    console.log("BigInterger"+ result);
    document.getElementById("getBigIntegerFromHexstr_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("getBigIntegerFromHexstr_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

"19970111"

Convert the input hexStr to a BigInteger string

Input Arguments

Parameter Type Description
hexStr String Hexadecimal byte string

Success Response

Parameter Type Description
result String Converted BigInteger string

Error Response

Parameter Type 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

getBigIntegerFromAssetAmount

Teemo.NEO.TOOLS.getBigIntegerFromAssetAmount({
        "amount":"12345.67890000",
        "assetID":"74f2dc36a68fdc4682034178eb2220729231db76",
        "network":"TestNet"
    })
.then(result=>{
    console.log(result);
    console.log("Decimals"+ result);
    document.getElementById("getDecimalsFromAssetAmount_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("getDecimalsFromAssetAmount_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

"1234567890000"

Convert the entered amount value to a BigInteger string based on the asset precision definition

Input Arguments

Parameter Type Description
amount String The amount of money that needs to be converted
assetID String Asset ID to be converted
network String Network selections that need to be converted

Success Response

Parameter Type Description
result String Converted BigInteger string

Error Response

Parameter Type 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

getDecimalsStrFromAssetAmount

Teemo.NEO.TOOLS.getDecimalsStrFromAssetAmount({
        "amount":"1234567890000",
        "assetID":"74f2dc36a68fdc4682034178eb2220729231db76",
        "network":"TestNet"
    })
.then(result=>{
    console.log(result);
    console.log("BigInteger",result);
    document.getElementById("getBigIntegerFromAssetAmount_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("getBigIntegerFromAssetAmount_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

"12345.6789"

Convert the entered BigInteger string to a numeric value based on the asset precision definition

Input Arguments

Parameter Type Description
amount String The amount of BigInteger strings that need to be converted
assetID String Asset ID to be converted
network String Network selections that need to be converted

Success Response

Parameter Type Description
result String Converted amount value

Error Response

Parameter Type 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

NNS Methods

This type of method helps Dapp to easily handle things related to NNS.

getNamehashFromDomain

Teemo.NEO.NNS.getNamehashFromDomain("test222.neo")
.then(result=>{
    console.log(result);
    document.getElementById("getNamehashFromDomain_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");

    console.log(error);
    document.getElementById("getNamehashFromDomain_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

"68bea578a5565e0a4cb37811cda13d092cd6681f0687261f22b085586577b7b1"

Convert the entered NNS domain name to NameHash

Input Arguments

Parameter Type Description
domain String The NNS domain name to be converted

Success Response

Parameter Type Description
result String Converted NameHash

Error Response

Parameter Type 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

getAddressFromDomain

Teemo.NEO.NNS.getAddressFromDomain({
            "domain":"test222.neo",
            "network":"TestNet"
        })
.then(result=>{
    console.log(result);
    console.log("BigInteger",result);
    document.getElementById("getAddressFromDomain_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("getAddressFromDomain_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

{
  "address": "AHDV7M54NHukq8f76QQtBTbrCqKJrBH9UF",
  "TTL": "1568428640"
}

Parse the entered NNS domain name into an NEO address

Input Arguments

Parameter Type Description
domain String The NNS domain name to be resolved
network String Network type selection

Success Response

Parameter Type Description
address String NEO address resolution result of the NNS domain name
TTL String Expiration time stamp of the NNS domain name

Error Response

Parameter Type 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

getDomainFromAddress

Teemo.NEO.NNS.getDomainFromAddress({
            "address":"AHDV7M54NHukq8f76QQtBTbrCqKJrBH9UF",
            "network":"TestNet"
        })
.then(result=>{
    console.log(result);
    console.log("BigInteger",result);
    document.getElementById("getDomainFromAddress_R").innerText = JSON.stringify(result, null, 2);
    resolve();
})
.catch(error=>{
    console.log("==============Entered the abnormal process");
    console.log(error);
    document.getElementById("getDomainFromAddress_R").innerText = JSON.stringify(error, null, 2);
    reject();
})

Example Response

{
  "namehash": "68bea578a5565e0a4cb37811cda13d092cd6681f0687261f22b085586577b7b1",
  "fullDomainName": "test222.neo",
  "TTL": "1568428640"
}

Reverse the input NEO address to NNS domain name

Input Arguments

Parameter Type Description
address String NEO address to be resolved in reverse
network String Network type selection

Success Response

Parameter Type Description
namehash String Reverse resolution of NNS NameHash
fullDomainName String Reverse resolution of the NNS domain name string
TTL String NNS domain owner sets the NNS expiration timestamp when reverse parsing

Error Response

Parameter Type 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

Events

Events are a way for the wallet to asynchronously with the DAPP when certain changes occur to the state of the wallet that might be relevant for the

READY

On a READY event, the callback will fire with a single argument with information about the wallet provider. At any time a READY event listener is added, it will immidiately be called if the provider is already in a ready state. This provides a single flow for dapp developers since this listener should start any and all interactions with the dapi protocol.

Full event name

Teemo.NEO.READY

Event data

Parameter Type Description
name String The name of the wallet provider
website String The website of the wallet provider
version String The version of the dAPI that the the wallet supports
compatibility String[] A list of all applicable NEPs which the wallet provider supports
extra Object Provider specific attributes
extra
Parameter Type Description
theme string UI theme of the provider

ACCOUNT_CHANGED

On a ACCOUNT_CHANGED event, the callback will fire with a single argument of the new account. This occurs when an account is already connected to the dapp, and the user has changed the connected account from the dapi provider side.

Full event name

Teemo.NEO.ACCOUNT_CHANGED

Event data

Parameter Type Description
address String Address of the new account
label String A label the users has set to identify their wallet

CONNECTED

On a CONNECTED event, the user has approved the connection of the dapp with one of their accounts. This will fire the first time any of one of the following methods are called from the dapp: getAccount, invoke, send.

Full event name

Teemo.NEO.CONNECTED

Event data

Parameter Type Description
address String Address of the new account
label String A label the users has set to identify their wallet

DISCONNECTED

On a DISCONNECTED event, the account connected to the dapp via the dapi provider has been disconnected (logged out).

Full event name

Teemo.NEO.DISCONNECTED

NETWORK_CHANGED

On a NETWORK_CHANGED event, the user has changed the network their provider wallet is connected to. The event will return the updated network details.

Full event name

Teemo.NEO.NETWORK_CHANGED

Event data

Parameter Type Description
networks String[] A list of all networks which this wallet provider allows access to
defaultNetwork String Network the wallet is currently set to

BLOCK_HEIGHT_CHANGED

This event is triggered when the height of the network block is changed (when the block is sent), and Dapp can perform the corresponding action according to this event. This event data contains, new block height, block hash, block timestamp and block containing TXID table

Full event name

Teemo.NEO.BLOCK_HEIGHT_CHANGED

Event data

Parameter Type Description
network String Network Type
blockHeight Number New block index value (height)
blockTime Number New block timestamp
blockHash String New block hash
tx TXID[] The new block contains the TXID group

TRANSACTION_CONFIRMED

This event is triggered when a transaction issued through a wallet (Dapi provider) is consensus (confirmed). Dapp can perform actions based on this event.

Full event name

Teemo.NEO.TRANSACTION_CONFIRMED

Event data

Parameter Type Description
TXID String Transaction Hash
blockHeight Number The block index value (height) of the transaction
blockTime Number Block timestamp of transaction

Event Methods

addEventListener

window.addEventListener('Teemo.NEO.READY',(data:CustomEvent)=>{
    console.log("Teemo READY ");
    console.log(JSON.stringify(data.detail))

    const main = new Main();
    main.start();//After listening to this event, you can start the related method call of the plugin.
})

In the Dapp page, the standard JS event acquisition method window.addEventListener is used to obtain the custom event and event data of the wallet, and the corresponding logic is processed after receiving the event and data.

Note:that events are asynchronous.

Errors

The NEO dAPI will provide these basic errors. It is up to the wallet provider to provide additional information if they choose:

Error Type Meaning
NO_PROVIDER Could not find an instance of the dAPI in the webpage
CONNECTION_DENIED The dAPI provider refused to process this request
RPC_ERROR An RPC error occured when submitting the request
MALFORMED_INPUT An input such as the address is not a valid NEO address
CANCELED The user cancels, or refuses the dapps request
INSUFFICIENT_FUNDS The user does not have a sufficient balance to perform the requested action