API Reference WASM¶
This page contains a list of all Datastructures and Classes used within the IN3 WASM-Client.
Main Module¶
Importing incubed is as easy as
import Client from "in3-wasm"
While the In3Client-class is the default import, the following imports can be used:
This file is part of the Incubed project. Sources: https://github.com/slockit/in3-c
Class the IN3 Class the SimpleSigner Interface the EthAPI Interface the iguration of the IN3-Client. This can be paritally overriden for every request. Interface a configuration of a in3-server. Interface a local weight of a n3-node. (This is used internally to weight the requests) Interface a JSONRPC-Request with N3-Extension Interface a JSONRPC-Responset with N3-Extension Interface the Signer Interface Collection of different util-functions. Type literal the ABI Type literal the ABIField Type alias a 20 byte Address encoded as Hex (starting with 0x) Type literal the Block Type BlockNumber or predefined Block Type alias data encoded as Hex (starting with 0x) Type alias a 32 byte Hash encoded as Hex (starting with 0x) Type a Hexcoded String (starting with 0x) Type literal the Log Type literal the LogFilter Type a BigInteger encoded as hex. Type literal Signature Type literal the Transaction Type literal the TransactionDetail Type literal the TransactionReceipt Type literal the TxRequest
Package in3.d.ts¶
Type IN3¶
Source: in3.d.ts
supporting both ES6 and UMD usage collection of util-functions.void
freeAll () frees all Incubed instances. onInit (fn:) registers a function to be called as soon as the wasm is ready.If it is already initialized it will call it right away.void
handler:) changes the storage handler, which is called to read and write to the cache.void
fn:) changes the transport-function. config:Partial<IN3Config> ) creates a new client. eth1 API. the signer, if specified this interface will be used to sign transactions, if not, sending transaction will not be possible. collection of util-functions.any
free () disposes the Client. This must be called in order to free allocated memory! send (request:RPCRequest ,callback:) sends a raw request.if the request is a array the response will be a array as well.If the callback is given it will be called with the response, if not a Promise will be returned.This function supports callback so it can be used as a Provider for the web3.Promise<any>
sendRPC (method:string
,params:any
[]) sends a RPC-Requests specified by name and params.void
config:Partial<IN3Config> ) sets configuration properties. You can pass a partial object specifieing any of defined properties.
Type SimpleSigner¶
Source: in3.d.ts
pks:any
[]) constructor the accounts client:IN3 ,tx:Transaction ) optiional method which allows to change the transaction-data before sending it. This can be used for redirecting it through a multisig. signing of any data.if hashFirst is true the data should be hashed first, otherwise the data is the hash.string
pk:Hash ) add accountPromise<boolean>
account:Address ) returns true if the account is supported (or unlocked)
Type EthAPI¶
Source: in3.d.ts
the client the signer (optional)Promise<number>
blockNumber () Returns the number of most recent block. (as number)Promise<string>
call (tx:Transaction ,block:BlockType ) Executes a new message call immediately without creating a transaction on the block chain.Promise<any>
Executes a function of a contract, by passing a [method-signature](https://github.com/ethereumjs/ethereumjs-abi/blob/master/README.md#simple-encoding-and-decoding) and the arguments, which will then be ABI-encoded and send as eth_call.Promise<string>
chainId () Returns the EIP155 chain ID used for transaction signing at the current best block. Null is returned if not available.any
client:IN3 ) constructor contract atany
decode event dataPromise<number>
tx:Transaction ) Makes a call or transaction, which won’t be added to the blockchain and returns the used gas, which can be used for estimating the used gas.Promise<number>
gasPrice () Returns the current price per gas in wei. (as number)Promise<bigint>
Returns the balance of the account of given address in wei (as hex). hash:Hash ,includeTransactions:boolean
) Returns information about a block by hash. block:BlockType ,includeTransactions:boolean
) Returns information about a block by block number.Promise<number>
block:Hash ) Returns the number of transactions in a block from a block matching the given block hash.Promise<number>
block:Hash ) Returns the number of transactions in a block from a block matching the given block number.Promise<string>
Returns code at a given address.Promise<>
id:Quantity ) Polling method for a filter, which returns an array of logs which occurred since last poll.Promise<>
id:Quantity ) Returns an array of all logs matching filter with given id.Promise<>
Returns an array of all logs matching a given filter object.Promise<string>
Returns the value from a storage position at a given address. Returns information about a transaction by block hash and transaction index position. Returns information about a transaction by block number and transaction index position. hash:Hash ) Returns the information about a transaction requested by transaction hash.Promise<number>
Returns the number of transactions sent from an address. (as number) hash:Hash ) Returns the receipt of a transaction by transaction hash.Note That the receipt is available even for pending transactions. Returns information about a uncle of a block by hash and uncle index position.Note: An uncle doesn’t contain individual transactions. Returns information about a uncle of a block number and uncle index position.Note: An uncle doesn’t contain individual transactions.Promise<number>
hash:Hash ) Returns the number of uncles in a block from a block matching the given block hash.Promise<number>
block:BlockType ) Returns the number of uncles in a block from a block matching the given block hash. data:Data ) a Hexcoded String (starting with 0x)Promise<string>
Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.Promise<string>
Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.Promise<string>
Creates a filter in the node, to notify when new pending transactions arrive.Promise<string>
Returns the current ethereum protocol version.Promise<string>
data:Data ) Creates new message call transaction or a contract creation for signed transactions.Promise<>
args:TxRequest ) sends a Transaction signs any kind of message using the x19Ethereum Signed Message:n-prefixPromise<>
syncing () Returns the current ethereum protocol version. id:Quantity ) Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.
Type IN3Config¶
Source: in3.d.ts
the iguration of the IN3-Client. This can be paritally overriden for every request.
boolean
if true the config will be adjusted depending on the request (optional)boolean
if true the nodelist will be automaticly updated if the lastBlock is newerexample: true (optional)number
number of seconds requests can be cached. (optional)string
servers to filter for the given chain. The chain-id based on EIP-155.example: 0x1string
main chain-registry contractexample: 0xe36179e2286ef405e929C90ad3E70E649B22a945 (optional)number
the number in percent needed in order reach finality (% of signature of the validators)example: 50 (optional)'json'
|'jsonRef'
|'cbor'
the format for sending the data to the client. Default is json, but using cbor means using only 30-40% of the payload since it is using binary encodingexample: json (optional)boolean
if true, the request should include the codes of all accounts. otherwise only the the codeHash is returned. In this case the client may ask by calling eth_getCode() afterwardsexample: true (optional)boolean
if true, the in3-section of thr response will be kept. Otherwise it will be removed after validating the data. This is useful for debugging or if the proof should be used afterwards. (optional)any
the client key to sign requestsexample: 0x387a8233c96e1fc0ad5e284353276177af2186e7afa85296f106336e376669f7 (optional)string
main chain-id, where the chain registry is running.example: 0x1 (optional)number
max number of attempts in case a response is rejectedexample: 10 (optional)number
number of number of blocks cached in memoryexample: 100 (optional)number
number of max bytes used to cache the code in memoryexample: 100000 (optional)number
min stake of the server. Only nodes owning at least this amount will be chosen.number
the limit of nodes to store in the client.example: 150 (optional)'none'
|'standard'
|'full'
if true the nodes should send a proof of the responseexample: true (optional)number
if specified, the blocknumber latest will be replaced by blockNumber- specified valueexample: 6 (optional)number
the number of request send when getting a first answerexample: 3boolean
if true the the request may be handled without proof in case of an error. (use with care!) (optional)string
url of one or more rpc-endpoints to use. (list can be comma seperated) (optional) the nodelist per chain (optional)number
number of signatures requestedexample: 2 (optional)number
specifies the number of milliseconds before the request times out. increasing may be helpful if the device uses a slow connection.example: 3000 (optional)string
[] if the client sends a array of blockhashes the server will not deliver any signatures or blockheaders for these blocks, but only return a string with a number. This is automaticly updated by the cache, but can be overriden per request. (optional)
Type IN3NodeConfig¶
Source: in3.d.ts
a configuration of a in3-server.
string
the address of the node, which is the public address it iis signing with.example: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679number
the capacity of the node.example: 100 (optional)string
[] the list of supported chainsexample: 0x1number
the deposit of the node in weiexample: 12350000number
the index within the contractexample: 13 (optional)number
the properties of the node.example: 3 (optional)number
the UNIX-timestamp when the node was registeredexample: 1563279168 (optional)number
the time (in seconds) until an owner is able to receive his deposit back after he unregisters himselfexample: 3600 (optional)number
the UNIX-timestamp when the node is allowed to be deregisterexample: 1563279168 (optional)string
the endpoint to post toexample: https://in3.slock.it
Type IN3NodeWeight¶
Source: in3.d.ts
a local weight of a n3-node. (This is used internally to weight the requests)
number
average time of a response in msexample: 240 (optional)number
blacklisted because of failed requests until the timestampexample: 1529074639623 (optional)number
timestamp of the last request in msexample: 1529074632623 (optional)number
last price (optional)number
number of uses.example: 147 (optional)number
factor the weight this noe (default 1.0)example: 0.5 (optional)
Type Signer¶
Source: in3.d.ts
client:IN3 ,tx:Transaction ) optiional method which allows to change the transaction-data before sending it. This can be used for redirecting it through a multisig. signing of any data.if hashFirst is true the data should be hashed first, otherwise the data is the hash.Promise<boolean>
account:Address ) returns true if the account is supported (or unlocked)
Type Utils¶
Source: in3.d.ts
Collection of different util-functions.
any
[] decodes the given data as ABI-encoded (without the methodHash) signature:string
,args:any
[]) encodes the given arguments as ABI-encoded (including the methodHash)string
fields:ABIField []) create signature def:ABI ) a Hexcoded String (starting with 0x)any
decode event create a signature (65 bytes) for the given message and kexy calculates the keccack hash for the given data. generates the public address from the private key.string
args:any
[]) solidity sha3 takes raw signature (65 bytes) and splits it into a signature object. converts any value to a Uint8Array.optionally the target length can be specified (in bytes) address:Address ,chainId:number
) generates a checksum Address for the given address.If the chainId is passed, it will be included accord to EIP 1191 converts any value to a hex string (with prefix 0x).optionally the target length can be specified (in bytes)
Type ABI¶
Source: in3.d.ts
boolean
the anonymous (optional)boolean
the constant (optional) ABIField [] the inputs (optional)string
the name (optional) ABIField [] the outputs (optional)boolean
the payable (optional)'nonpayable'
|'payable'
|'view'
|'pure'
the stateMutability (optional)'event'
|'function'
|'constructor'
|'fallback'
the type
Type Address¶
Source: in3.d.ts
a 20 byte Address encoded as Hex (starting with 0x)
a Hexcoded String (starting with 0x)
= string
Type Block¶
Source: in3.d.ts
20 Bytes - the address of the author of the block (the beneficiary to whom the mining rewards were given) integer of the difficulty for this block the ‘extra data’ field of this block the maximum gas allowed in this block the total used gas by all transactions in this block hash of the block. null when its pending block 256 Bytes - the bloom filter for the logs of the block. null when its pending block 20 Bytes - alias of ‘author’ 8 bytes hash of the generated proof-of-work. null when its pending block. Missing in case of PoA. The block number. null when its pending block hash of the parent block 32 Bytes - the root of the receipts trie of the block Data [] PoA-Fields SHA3 of the uncles data in the block integer the size of this block in bytes 32 Bytes - the root of the final state trie of the block the unix timestamp for when the block was collated integer of the total difficulty of the chain until this blockstring
| [] Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter 32 Bytes - the root of the transaction trie of the block Hash [] Array of uncle hashes
Type Data¶
Source: in3.d.ts
data encoded as Hex (starting with 0x)
a Hexcoded String (starting with 0x)
= string
Type Hash¶
Source: in3.d.ts
a 32 byte Hash encoded as Hex (starting with 0x)
a Hexcoded String (starting with 0x)
= string
Type Log¶
Source: in3.d.ts
20 Bytes - address from which this log originated. Hash, 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log. the block number where this log was in. null when its pending. null when its pending log. contains the non-indexed arguments of the log. integer of the log index position in the block. null when its pending log.boolean
true when the log was removed, due to a chain reorganization. false if its a valid log. Data [] - Array of 0 to 4 32 Bytes DATA of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.) Hash, 32 Bytes - hash of the transactions this log was created from. null when its pending log. integer of the transactions index position log was created from. null when its pending log.
Type LogFilter¶
Source: in3.d.ts
(optional) 20 Bytes - Contract address or a list of addresses from which logs should originate. Quantity or Tag - (optional) (default: latest) Integer block number, or ‘latest’ for the last mined block or ‘pending’, ‘earliest’ for not yet mined transactions. å(optional) The maximum number of entries to retrieve (latest first). Quantity or Tag - (optional) (default: latest) Integer block number, or ‘latest’ for the last mined block or ‘pending’, ‘earliest’ for not yet mined transactions.string
|string
[] [] (optional) Array of 32 Bytes Data topics. Topics are order-dependent. It’s possible to pass in null to match any topic, or a subarray of multiple topics of which one should be matching.
Type Transaction¶
Source: in3.d.ts
any
optional chain id (optional)string
4 byte hash of the method signature followed by encoded parameters. For details see Ethereum Contract ABI. 20 Bytes - The address the transaction is send from. Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions. Integer of the gas price used for each paid gas. nonce (optional when creating new contract) 20 Bytes - The address the transaction is directed to. Integer of the value sent with this transaction.
Type TransactionDetail¶
Source: in3.d.ts
32 Bytes - hash of the block where this transaction was in. null when its pending. block number where this transaction was in. null when its pending. the chain id of the transaction, if any.any
(optional) conditional submission, Block number in block or timestamp in time or null. (parity-feature) creates contract address 20 Bytes - address of the sender. gas provided by the sender. gas price provided by the sender in Wei. 32 Bytes - hash of the transaction. the data send along with the transaction. the number of transactions made by the sender prior to this one.any
optional: the private key to use for signing (optional) public key of the signer. the R field of the signature. raw transaction data the standardised V field of the signature (0 or 1). 20 Bytes - address of the receiver. null when its a contract creation transaction. integer of the transactions index position in the block. null when its pending. the standardised V field of the signature. value transferred in Wei.
Type TransactionReceipt¶
Source: in3.d.ts
32 Bytes - hash of the block where this transaction was in. block number where this transaction was in. 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null. The total amount of gas used when this transaction was executed in the block. 20 Bytes - The address of the sender. The amount of gas used by this specific transaction alone. Log [] Array of log objects, which this transaction generated. 256 Bytes - A bloom filter of logs/events generated by contracts during transaction execution. Used to efficiently rule out transactions without expected logs. 32 Bytes - Merkle root of the state trie after the transaction has been executed (optional after Byzantium hard fork EIP609) 0x0 indicates transaction failure , 0x1 indicates transaction success. Set for blocks mined after Byzantium hard fork EIP609, null before. 20 Bytes - The address of the receiver. null when it’s a contract creation transaction. 32 Bytes - hash of the transaction. Integer of the transactions index position in the block.
Type TxRequest¶
Source: in3.d.ts
any
[] the argument to pass to the method (optional)number
number of block to wait before confirming (optional) the data to send (optional) address of the account to use (optional)number
the gas needed (optional)number
the gasPrice used (optional)string
the ABI of the method to be used (optional)number
the nonce (optional) raw private key in order to sign (optional) contract (optional) the value in wei (optional)