Common functions

The following functions are always present in judger object

Get Event Type

judger.getEventSource()

Returns type of the event.

Returns

Returns string of the event type, which could be "execution" or "token".

Example

judger.getEventSource()
> "execution"

Get Event Chain

judger.getChain()

Returns chain of the event.

Returns

Returns string of the chain name, which could be "eth" "bsc" "polygon" "goerli" or "bitkub".

Example

judger.getChain()
> "eth"

Get Ethereum Transaction

judger.getTransaction()

Return an Ethereum transaction of the event.

Returns

Returns object:

  • hash - string: Hash of the transaction.

  • nonce - number: The number of transactions made by the sender prior to this one.

  • blockHash - string: Hash of the block where this transaction was in. null if pending.

  • blockNumber - number: Block number where this transaction was in. null if pending.

  • transactionIndex - number: Integer of the transactions index position in the block. null if pending.

  • from - string: Address of the sender.

  • to - string: Address of the receiver. null if it’s a contract creation transaction.

  • value - string: Value transferred in wei.

  • gas - number: Gas provided by the sender.

  • gasPrice - string: Gas price provided by the sender in wei.

  • input - string: The data sent along with the transaction.

Example

judger.getTransaction()
> {
    "hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b",
    "nonce": 2,
    "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46",
    "blockNumber": 3,
    "transactionIndex": 0,
    "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
    "value": '123450000000000000',
    "gas": 314159,
    "gasPrice": '2000000000000',
    "input": "0x57cb2fc4"
}

Last updated