diff --git a/docs/graphql_api.md b/docs/graphql_api.md
index f18568f..40a9b48 100644
--- a/docs/graphql_api.md
+++ b/docs/graphql_api.md
@@ -1,4 +1,4 @@
-# Huobi-chain GraphQL API
+# Muta GraphQL API
>[GraphQL](https://graphql.org) is a query language for APIs and a runtime for fulfilling those queries with your existing data.
@@ -6,7 +6,7 @@ GraphQL provides a complete and understandable description of the data in your A
gives clients the power to ask for exactly what they need and nothing more,
makes it easier to evolve APIs over time, and enables powerful developer tools.
-Huobi-chain has embeded a [Graph*i*QL](https://github.com/graphql/graphiql) for checking and calling API. Started a the Huobi-chain
+Muta has embeded a [Graph**i**QL](https://github.com/graphql/graphiql) for checking and calling API. Started a the Muta
node, and then try open http://127.0.0.1:8000/graphiql in the browser.
@@ -16,21 +16,24 @@ node, and then try open http://127.0.0.1:8000/graphiql in the browser.
* [Query](#query)
* [Mutation](#mutation)
* [Objects](#objects)
- * [Epoch](#epoch)
- * [EpochHeader](#epochheader)
+ * [Block](#block)
+ * [BlockHeader](#blockheader)
+ * [Event](#event)
+ * [ExecResp](#execresp)
+ * [Proof](#proof)
+ * [Receipt](#receipt)
+ * [ReceiptResponse](#receiptresponse)
+ * [SignedTransaction](#signedtransaction)
+ * [Validator](#validator)
* [Inputs](#inputs)
- * [InputDeployAction](#inputdeployaction)
* [InputRawTransaction](#inputrawtransaction)
* [InputTransactionEncryption](#inputtransactionencryption)
- * [InputTransferAction](#inputtransferaction)
- * [Enums](#enums)
- * [ContractType](#contracttype)
* [Scalars](#scalars)
* [Address](#address)
- * [Balance](#balance)
* [Boolean](#boolean)
* [Bytes](#bytes)
* [Hash](#hash)
+ * [Int](#int)
* [String](#string)
* [Uint64](#uint64)
@@ -48,139 +51,127 @@ node, and then try open http://127.0.0.1:8000/graphiql in the browser.
-getLatestEpoch |
-Epoch! |
+getBlock |
+Block! |
-Get the latest epoch
+Get the block
|
-epochId |
-Uint64 |
+height |
+Uint64 |
|
-getBalance |
-Balance! |
+getTransaction |
+SignedTransaction! |
-Get the asset balance of an account
+Get the transaction by hash
|
-address |
-Address! |
+txHash |
+Hash! |
|
-id |
-Hash! |
+getReceipt |
+Receipt! |
-The asset id. Asset is the first-class in Huobi-chain, this means that your assets can be more than one in Huobi-chain, and the UDT(User Defined Token) will be supported in the future
+Get the receipt by transaction hash
|
-epochId |
-Uint64 |
+txHash |
+Hash! |
|
-
-
-
-## Mutation
-
+
+## Mutation
+
+
+
+Field |
+Argument |
+Type |
+Description |
+
+
+
-sendUnsafeTransferTransaction ⚠️ |
-Hash! |
+sendTransaction |
+Hash! |
- ⚠️ DEPRECATED
-
-DON'T use it in production! This is just for development.
+send transaction
-
|
inputRaw |
-InputRawTransaction! |
- |
-
-
-inputAction |
-InputTransferAction! |
+InputRawTransaction! |
|
-inputPrivkey |
-Bytes! |
+inputEncryption |
+InputTransactionEncryption! |
|
-sendUnsafeDeployTransaction ⚠️ |
-Hash! |
+unsafeSendTransaction ⚠️ |
+Hash! |
⚠️ DEPRECATED
@@ -192,17 +183,12 @@ DON'T use it in production! This is just for development.
|
inputRaw |
-InputRawTransaction! |
- |
-
-
-inputAction |
-InputDeployAction! |
+InputRawTransaction! |
|
inputPrivkey |
-Bytes! |
+Bytes! |
|
@@ -210,9 +196,9 @@ DON'T use it in production! This is just for development.
## Objects
-### Epoch
+### Block
-Epoch is a single digital record created within a blockchain. Each epoch contains a record of the previous Epoch, and when linked together these become the “chain”.An epoch is always composed of header and body.
+Block is a single digital record created within a blockchain. Each block contains a record of the previous Block, and when linked together these become the “chain”.A block is always composed of header and body.
@@ -226,28 +212,28 @@ Epoch is a single digital record created within a blockchain. Each epoch contain
header |
-EpochHeader! |
+BlockHeader! |
-The header section of an epoch
+The header section of a block
|
orderedTxHashes |
-[Hash!]! |
+[Hash!]! |
-The body section of an epoch
+The body section of a block
|
-### EpochHeader
+### BlockHeader
-An epoch header is like the metadata of an epoch.
+A block header is like the metadata of a block.
@@ -261,7 +247,7 @@ An epoch header is like the metadata of an epoch.
chainId |
-Hash! |
+Hash! |
Identifier of a chain in order to prevent replay attacks across channels
@@ -269,35 +255,44 @@ Identifier of a chain in order to prevent replay attacks across channels
|
-epochId |
-Uint64! |
+height |
+Uint64! |
-Known as the block height like other blockchain
+block height
+
+ |
+
+
+execHeight |
+Uint64! |
+
+
+The height to which the block has been executed
|
preHash |
-Hash! |
+Hash! |
-The hash of the serialized previous epoch
+The hash of the serialized previous block
|
timestamp |
-Uint64! |
+Uint64! |
-A timestamp that records when the epoch was created
+A timestamp that records when the block was created
|
orderRoot |
-Hash! |
+Hash! |
The merkle root of ordered transactions
@@ -306,7 +301,7 @@ The merkle root of ordered transactions
|
confirmRoot |
-[Hash!]! |
+[Hash!]! |
The merkle roots of all the confirms
@@ -315,7 +310,7 @@ The merkle roots of all the confirms
|
stateRoot |
-Hash! |
+Hash! |
The merkle root of state root
@@ -324,7 +319,7 @@ The merkle root of state root
|
receiptRoot |
-[Hash!]! |
+[Hash!]! |
The merkle roots of receipts
@@ -333,7 +328,7 @@ The merkle roots of receipts
|
cyclesUsed |
-Uint64! |
+[Uint64!]! |
The sum of all transactions costs
@@ -342,168 +337,314 @@ The sum of all transactions costs
|
proposer |
-Address! |
+Address! |
-The address descirbed who packed the epoch
+The address descirbed who packed the block
|
+proof |
+Proof! |
+ |
+
+
validatorVersion |
-Uint64! |
+Uint64! |
The version of validator is designed for cross chain
|
+
+validators |
+[Validator!]! |
+ |
+
-## Inputs
-
-### InputDeployAction
-
-The deploy transfer transaction
+### Event
-Field |
+Field |
+Argument |
Type |
Description |
-code |
-Bytes! |
-
-
-Encoded contract code
-
- |
+service |
+String! |
+ |
-contractType |
-ContractType! |
-
+ | data |
+String! |
+ |
+
+
+
-The type of contract
+### ExecResp
-
+
+
+
+Field |
+Argument |
+Type |
+Description |
+
+
+
+
+ret |
+String! |
+ |
+
+
+isError |
+Boolean! |
+ |
-### InputRawTransaction
+### Proof
-There was many types of transaction in Huobi-chain, A transaction often require computing resources or write data to chain,these resources are valuable so we need to pay some token for them.InputRawTransaction describes information above
+The verifier of the block header proved
-Field |
+Field |
+Argument |
Type |
Description |
-chainId |
-Hash! |
-
-
-Identifier of the chain.
-
- |
+height |
+Uint64! |
+ |
-feeCycle |
-Uint64! |
-
-
-Mostly like the gas limit in Ethereum, describes the fee that you are willing to pay the highest price for the transaction
-
- |
+round |
+Uint64! |
+ |
-feeAssetId |
-Hash! |
-
-
-asset type
-
- |
+blockHash |
+Hash! |
+ |
-nonce |
-Hash! |
-
+ | signature |
+Bytes! |
+ |
+
+
+bitmap |
+Bytes! |
+ |
+
+
+
-Every transaction has its own id, unlike Ethereum's nonce,the nonce in Huobi-chain is an hash
+### Receipt
-
+
-For security and performance reasons, Huobi-chain will only deal with trade request over a period of time,the `timeout` should be `timeout > current_epoch_height` and `timeout < current_epoch_height + timeout_gap`,the `timeout_gap` generally equal to 20.
+### ReceiptResponse
-
+
+
+
+Field |
+Argument |
+Type |
+Description |
+
+
+
+
+serviceName |
+String! |
+ |
+
+
+method |
+String! |
+ |
+
+
+ret |
+String! |
+ |
+
+
+isError |
+Boolean! |
+ |
-### InputTransactionEncryption
-
-Signature of the transaction
+### SignedTransaction
-Field |
+Field |
+Argument |
Type |
Description |
+chainId |
+Hash! |
+ |
+
+
+cyclesLimit |
+Uint64! |
+ |
+
+
+cyclesPrice |
+Uint64! |
+ |
+
+
+nonce |
+Hash! |
+ |
+
+
+timeout |
+Uint64! |
+ |
+
+
+serviceName |
+String! |
+ |
+
+
+method |
+String! |
+ |
+
+
+payload |
+String! |
+ |
+
+
txHash |
-Hash! |
-
-
-The digest of the transaction
-
- |
+Hash! |
+ |
pubkey |
-Bytes! |
-
-
-The public key of transfer
-
- |
+Bytes! |
+ |
signature |
-Bytes! |
-
+ | Bytes! |
+ |
+
+
+
-The signature of the transaction
+### Validator
-
+Validator address set
+
+
+
+
+Field |
+Argument |
+Type |
+Description |
+
+
+
+
+address |
+Address! |
+ |
+
+
+proposeWeight |
+Int! |
+ |
+
+
+voteWeight |
+Int! |
+ |
-### InputTransferAction
+## Inputs
-The action of transfer transaction
+### InputRawTransaction
+
+There was many types of transaction in Muta, A transaction often require computing resources or write data to chain,these resources are valuable so we need to pay some token for them.InputRawTransaction describes information above
@@ -515,68 +656,101 @@ The action of transfer transaction
-carryingAmount |
-Balance! |
+chainId |
+Hash! |
-The amount of the transfer
+Identifier of the chain.
|
-carryingAssetId |
-Hash! |
+cyclesLimit |
+Uint64! |
-The asset of of the transfer
+Mostly like the gas limit in Ethereum, describes the fee that you are willing to pay the highest price for the transaction
|
-receiver |
-Address! |
+cyclesPrice |
+Uint64! |
+ |
+
+
+nonce |
+Hash! |
+
+
+Every transaction has its own id, unlike Ethereum's nonce,the nonce in Muta is an hash
+
+ |
+
+
+timeout |
+Uint64! |
-The receiver of the transfer
+For security and performance reasons, Muta will only deal with trade request over a period of time,the `timeout` should be `timeout > current_block_height` and `timeout < current_block_height + timeout_gap`,the `timeout_gap` generally equal to 20.
|
+
+serviceName |
+String! |
+ |
+
+
+method |
+String! |
+ |
+
+
+payload |
+String! |
+ |
+
-## Enums
-
-### ContractType
+### InputTransactionEncryption
-According to different purposes, Huobi-chain has many contract type
+Signature of the transaction
-Value |
+
+Field |
+Type |
Description |
+
-ASSET |
+txHash |
+Hash! |
-Asset contract often use for creating User Defined Asset(also known as UDT(User Defined Token))
+The digest of the transaction
|
-APP |
+pubkey |
+Bytes! |
-App contract often use for creating DAPP(Decentralized APPlication)
+The public key of transfer
|
-LIBRARY |
+signature |
+Bytes! |
-Library contract often providing reusable and immutable function
+The signature of the transaction
|
@@ -587,11 +761,7 @@ Library contract often providing reusable and immutable function
### Address
-21 bytes of account address, the first bytes of which is the identifier.
-
-### Balance
-
-uint256
+20 bytes of account address
### Boolean
@@ -603,6 +773,8 @@ Bytes corresponding hex string.
The output digest of Keccak hash function
+### Int
+
### String
### Uint64
diff --git a/docs/js_sdk.md b/docs/js_sdk.md
index 60870db..e4d13c5 100644
--- a/docs/js_sdk.md
+++ b/docs/js_sdk.md
@@ -397,7 +397,7 @@ UDT是一种基于数量的无差别资产,类似于以太坊ERC20 token
构建一个Asset
```js
async function example(){
- const createdAsset = await service.createAsset({
+ const createdAsset = await service.create_asset({
name: 'LOVE_COIN',
supply,
symbol: 'LUV'
@@ -415,29 +415,14 @@ async function example(){
```
-##### getAsset
-根据asset_id,查询对应的asset
-```js
-async function example(){
- const asset = await service.getAsset(createdAsset.assetId);
- /*return data:
- Asset {
- asset_id: Hash;
- name: string;
- symbol: string;
- supply: number;
- issuer: Address;
- }
- */
-}
-
-```
-
##### getBalance
获取一个某一用户在某一资产下的余额
```js
async function example(){
- const balance = await service.getBalance(createdAsset.assetId, account.address);
+ const assetId = createdAsset.response.ret.id;
+ const {
+ ret: { balance },
+ } = await service.get_balance({asset_id: assetId, user:account.address});
}
```
diff --git a/docs/js_sdk_examples.md b/docs/js_sdk_examples.md
index 6ad5180..71dff5d 100644
--- a/docs/js_sdk_examples.md
+++ b/docs/js_sdk_examples.md
@@ -421,22 +421,22 @@ export interface Asset {
接下来就非常简单了,我们直接创建一个资产,参数类型和之前的相同,不再赘述:
```typescript
- const createdAsset = await service.createAsset({
- name: 'LOVE_COIN',
- supply: 1314,
- symbol: 'LUV',
- });
- const assetId = createdAsset.asset_id;
-```
-
-我们通过asset_id来查询一个资产的状态:
-```typescript
- const asset = await service.getAsset(assetId);
+ const createdAsset = await service.create_asset({
+ name: 'LOVE_COIN',
+ supply,
+ symbol: 'LUV',
+ });
+ const assetId = createdAsset.response.ret.id;
```
查询一下某个用户的余额:
```typescript
- const balance = await service.getBalance(assetId, '0x2000000000000000000000000000000000000000');
+ const {
+ ret: { balance : balance0x2000000000000000000000000000000000000000},
+ }= await service.get_balance({
+ asset_id : assetId,
+ user : to,
+ });
```
最后是向某个用户发送一定数量的UDT,这里是LOVE_COIN