Skip to content

Latest commit

 

History

History
91 lines (53 loc) · 4.12 KB

index.md

File metadata and controls

91 lines (53 loc) · 4.12 KB

Table of Contents

index

index.js:22-131

Extends Message

This implements basic functions relating to Dfinity Transactions

Parameters

  • version Number the tx version (optional, default 0)
  • to Buffer the address of the contract this tx is too (optional, default newUint8Array(20))
  • caps Number the number of repsonse capablities this message has (optional, default 0)
  • ticks Number the number of to allocate for this message (optional, default 0)
  • ticksPrice Number the price by ticks (optional, default 0)
  • nonce Number (optional, default 0)
  • data Buffer (optional, default 0)
  • publicKey Buffer (optional, default newUint8Array(32))
  • signature Buffer (optional, default newUint8Array([]))
  • recovery Number (optional, default 0)

serialize

index.js:28-43

serializes the message

Parameters

  • inculdeSig (optional, default this.signature.length!==0)

Returns Buffer

sign

index.js:50-57

signs a message and returns the serialized and signed message

Parameters

  • secretKey Buffer a 32 bytes buffer to use as a secret key

Returns Promise resolve with a Buffer containing the sinded message

hash

index.js:64-70

Gets the SHA-256 hash for some given data

Parameters

  • data Buffer the data to be hashed

Returns Promise resolves with 32 bytes of hashed data

recoverPublicKey

index.js:77-88

Recovers a public key from a signed message

Parameters

  • serialized Buffer the serialized message

Returns Promise resolves with a 32 byte public key

deserialize

index.js:95-114

deserializes the message and returns a new instance of DfinityTx

Parameters

  • raw Buffer the serialized raw messsage

Returns Promise resolve with a new instance of DfinityTx