![forge-message](https://www.arcblock.io/.netlify/functions/badge/?text=forge-message)

[![docs](https://img.shields.io/badge/powered%20by-arcblock-green.svg)](https://docs.arcblock.io)
[![Gitter](https://badges.gitter.im/ArcBlock/community.svg)](https://gitter.im/ArcBlock/community?utm_source=badge\&utm_medium=badge\&utm_campaign=pr-badge)

> Utility function to encode and format message that can be sent to or received from forge framework.


## Table of Contents

* [Install](#install)
* [Usage](#usage)
* [Documentation](#documentation)
* [Contributors](#contributors)


## Install

```sh
npm i @ocap/message
// OR
bun install @ocap/message
```


## Usage

```js
const { createMessage, formatMessage } = require('@ocap/message');

const message = createMessage('Transaction', {
  from: '',
  nonce: 0,
  signature: 'abc',
  itx: {
    type: 'TransferTx',
    value: {
      to: '2019-04-25',
    },
  },
});

const buffer = message.serializeBinary();
// Then: send the buffer over the wire
```


## Documentation

For full documentation, checkout [https://asset-chain.netlify.com](https://asset-chain.netlify.com/)


## Contributors

| Name           | Website                         |
| -------------- | ------------------------------- |
| **wangshijun** | <https://github.com/wangshijun> |
