Options
All
  • Public
  • Public/Protected
  • All
Menu

@tgrospic/rnode-grpc-js

Index

Functions

  • getAddrFromEth(ethAddrRaw: string): string | undefined
  • Parses REV address from ETH address.

    Parameters

    • ethAddrRaw: string

    Returns string | undefined

  • getAddrFromPrivateKey(privateKeyRaw: string): RevAddress | undefined
  • Parses REV address (with ETH address and public key) from private key.

    Parameters

    • privateKeyRaw: string

    Returns RevAddress | undefined

  • getAddrFromPublicKey(publicKeyRaw: string): RevAddress | undefined
  • Parses REV address (with ETH address) from public key.

    Parameters

    • publicKeyRaw: string

    Returns RevAddress | undefined

  • parseRevAddress(text: string): RevAddress | undefined
  • Parses REV address from different sources in string hex format. (private key -> public key -> ETH address -> REV address)

    Parameters

    • text: string

    Returns RevAddress | undefined

  • rhoParToJson(input: Par): any
  • Converts Par object to JSON returned from the RNode gRPC API.

    Example of Rholang return values.

    new return(`rho:rchain:deployId`) in {
    return!("One argument") | // monadic
    return!((true, "A", "B")) | // monadic as tuple
    return!(true, "A", "B") | // polyadic
    return!(true) | return!("A") // multiple values
    }

    And the corresponding converted JSON objects.

    [ 'One argument' ]       // return!("One argument")
    [ [ true, 'A', 'B' ] ] // return!((true, "A", "B"))
    [ true, 'A', 'B' ] // return!(true, "A", "B")
    [ true, 'A' ] // return!(true) | return!("A")

    Parameters

    Returns any

  • Signs deploy data.

    The private key for signing can be in different formats supported by elliptic library.

    NOTE: Signing function can be used independently without this library and JS generated code (see rnode-sign.ts source).

    // Generate new key pair
    const { ec } = require('elliptic')
    const secp256k1 = new ec('secp256k1')
    const key = secp256k1.genKeyPair()

    // Or use existing private key as hex string, Uint8Array, Buffer or ec.KeyPair
    const key = '1bf36a3d89c27ddef7955684b97667c75454317d8964528e57b2308947b250b0'

    const deployData = {
    term: 'new out(`rho:io:stdout`) in { out!("Browser deploy test") }',
    timestamp: Date.now(), // nonce
    phloprice: 1, // price of tinny REV for phlogiston (gas)
    phlolimit: 10e3, // max phlogiston (gas) for deploy execution
    validafterblocknumber: 123, // latest block number
    shardid: 'testnet', // shard name
    }

    // Signed deploy with deployer, sig and sigalgorithm fields populated
    const signed = signDeploy(key, deployData)

    Parameters

    Returns DeploySignedProto

  • verifyRevAddr(revAddr: string): boolean
  • Verifes REV address as hex string.

    Parameters

    • revAddr: string

    Returns boolean

Generated using TypeDoc