Options
All
  • Public
  • Public/Protected
  • All
Menu

CodeChain JavaScript SDK

Index

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

ActionJSON

AssetTransferOutputValue

AssetTransferOutputValue: AssetTransferOutput | object

EcdsaSignature

EcdsaSignature: string

KeyStoreType

KeyStoreType: "local" | "memory" | object | object

KeyType

KeyType: "asset" | "platform"

NetworkId

NetworkId: string

TimelockType

TimelockType: "block" | "blockAge" | "time" | "timeAge"

Variables

Const RLP

RLP: any = require("rlp")

Functions

Const blake128

  • blake128(data: Buffer | string): string
  • Gets data's 128 bit blake hash.

    Parameters

    • data: Buffer | string

      buffer or hexadecimal string

    Returns string

    16 byte hexadecimal string

Const blake128WithKey

  • blake128WithKey(data: Buffer | string, key: Uint8Array): string
  • Gets data's 128 bit blake hash by using the key.

    Parameters

    • data: Buffer | string

      buffer or hexadecimal string

    • key: Uint8Array

    Returns string

    16 byte hexadecimal string

Const blake160

  • blake160(data: Buffer | string): string
  • Gets data's 160 bit blake hash.

    Parameters

    • data: Buffer | string

      buffer or hexadecimal string

    Returns string

    20 byte hexadecimal string

Const blake160WithKey

  • blake160WithKey(data: Buffer | string, key: Uint8Array): string
  • Gets data's 160 bit blake hash by using the key.

    Parameters

    • data: Buffer | string

      buffer or hexadecimal string

    • key: Uint8Array

    Returns string

    20 byte hexadecimal string

Const blake256

  • blake256(data: Buffer | string): string
  • Gets data's 256 bit blake hash.

    Parameters

    • data: Buffer | string

      buffer or hexadecimal string

    Returns string

    32 byte hexadecimal string

Const blake256WithKey

  • blake256WithKey(data: Buffer | string, key: Uint8Array): string
  • Gets data's 256 bit blake hash by using the key.

    Parameters

    • data: Buffer | string

      buffer or hexadecimal string

    • key: Uint8Array

    Returns string

    32 byte hexadecimal string

checkAmount

  • checkAmount(amount: U64Value): void

checkApprover

  • checkApprover(approver: PlatformAddressValue | null): void
  • Parameters

    • approver: PlatformAddressValue | null

    Returns void

checkAssetAddressRecipient

  • checkAssetAddressRecipient(recipient: AssetAddressValue): void

checkAssetOutPoint

checkAssetType

  • checkAssetType(value: H160Value): void

checkBytes

  • checkBytes(bytes: Buffer): void

checkCertifier

  • checkCertifier(certifier: PlatformAddressValue): void
  • Parameters

    • certifier: PlatformAddressValue

    Returns void

checkExpiration

  • checkExpiration(expiration: U64Value): void

checkHandlerId

  • checkHandlerId(handlerId: number): void

checkIndex

  • checkIndex(index: number): void

checkIndices

  • checkIndices(indices: Array<number>): void

checkKey

  • checkKey(key: H512Value): void

checkLockScript

  • checkLockScript(lockScript: Buffer): void

checkLockScriptHash

  • checkLockScriptHash(value: H160Value): void

checkMetadata

  • checkMetadata(metadata: string | object): void

checkNetworkId

checkOrder

  • checkOrder(order: Order | null): void

checkOwners

  • checkOwners(owners: Array<PlatformAddressValue>): void
  • Parameters

    • owners: Array<PlatformAddressValue>

    Returns void

checkParameters

  • checkParameters(parameters: Buffer[]): void

checkPayer

  • checkPayer(payer: PlatformAddressValue): void

checkPlatformAddressRecipient

  • checkPlatformAddressRecipient(recipient: PlatformAddressValue): void
  • Parameters

    • recipient: PlatformAddressValue

    Returns void

checkSecret

  • checkSecret(value: H256Value): void

checkShardId

  • checkShardId(shardId: number): void

checkSignature

  • checkSignature(signature: string): void

checkTimelock

  • checkTimelock(timelock: Timelock | null): void

checkTracker

  • checkTracker(value: H256Value): void

checkTransactionHash

  • checkTransactionHash(value: H256Value): void

checkTransferBurns

checkTransferInputs

checkTransferOutputs

checkUnlockScript

  • checkUnlockScript(unlockScript: Buffer): void

checkUsers

  • checkUsers(users: Array<PlatformAddressValue>): void
  • Parameters

    • users: Array<PlatformAddressValue>

    Returns void

checkregistrar

  • checkregistrar(registrar: PlatformAddressValue | null): void
  • Parameters

    • registrar: PlatformAddressValue | null

    Returns void

convertTimelockToEncodeObject

  • convertTimelockToEncodeObject(timelock: Timelock | null): number[][]

decomposeRecipient

  • decomposeRecipient(recipient: AssetAddress): object

fromJSONToSignedTransaction

fromJSONToTransaction

Const generatePrivateKey

  • generatePrivateKey(): string
  • Generates a private key.

    Returns string

    32 byte hexadecimal string of private key

Const getAccountIdFromPrivate

  • getAccountIdFromPrivate(priv: string): string
  • Gets account id from private key.

    Parameters

    • priv: string

      32 byte hexadecimal string of private key

    Returns string

    20 byte hexadecimal string of account id

Const getAccountIdFromPublic

  • getAccountIdFromPublic(publicKey: string): string
  • Gets account id from the given public key.

    Parameters

    • publicKey: string

      64 byte hexadecimal string of uncompressed public key

    Returns string

    20 byte hexadecimal string of account id

getMinimumFee

Const getPublicFromPrivate

  • getPublicFromPrivate(priv: string): string
  • Gets public key from private key.

    Parameters

    • priv: string

      32 byte hexadecimal string of private key

    Returns string

    64 byte hexadecimal string of public key

isIpAddressString

  • isIpAddressString(value: any): boolean

isIpCidrAddressString

  • isIpCidrAddressString(value: any): boolean

isKeyStore

  • isKeyStore(value: any): boolean

isKeyStoreType

  • isKeyStoreType(value: any): boolean

isNonNegativeInterger

  • isNonNegativeInterger(value: any): boolean

isPortNumber

  • isPortNumber(value: any): boolean

isShardIdValue

  • isShardIdValue(value: any): boolean

isSocketAddressString

  • isSocketAddressString(value: any): boolean

Const recoverEcdsa

  • Gets public key from the message and signature.

    Parameters

    • message: string

      arbitrary length string

    • signature: EcdsaSignature

      65 byte hexstring of ECDSA signature

    Returns string

    64 byte hexstring public key

Const ripemd160

  • ripemd160(data: Buffer | string): string
  • Gets data's 160 bit RIPEMD hash.

    Parameters

    • data: Buffer | string

      buffer or hexadecimal string

    Returns string

    20 byte hexadecimal string

Const signEcdsa

  • Gets signature for message from private key.

    Parameters

    • message: string

      arbitrary length string

    • priv: string

      32 byte hexstring of private key

    Returns EcdsaSignature

    65 byte hexstring of ECDSA signature

Const toHex

  • toHex(buffer: Buffer): string
  • Converts buffer to hexadecimal string.

    Parameters

    • buffer: Buffer

      arbritrary length of data

    Returns string

    hexadecimal string

Const verifyEcdsa

  • verifyEcdsa(message: string, signature: EcdsaSignature, pub: string): boolean
  • Checks if the signature from signEcdsa is correct.

    Parameters

    • message: string

      arbitrary length string

    • signature: EcdsaSignature

      65 byte hexstring of ECDSA signature

    • pub: string

      64 byte hexstring of public key

    Returns boolean

    if signature is valid, true. Else false.

Generated using TypeDoc