Skip to content

Commit

Permalink
Merge pull request #270 from nervosnetwork/update-type-of-epoch
Browse files Browse the repository at this point in the history
feat(rpc): update the type of epoch
  • Loading branch information
ashchan authored Jun 22, 2019
2 parents d4756c7 + 509a79b commit 296c515
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
8 changes: 2 additions & 6 deletions packages/ckb-sdk-rpc/__tests__/formatters/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -797,21 +797,17 @@
"toEpoch": [
{
"source": {
"block_reward": "5000000000000",
"epoch_reward": "125000000000000",
"difficulty": "0x100",
"last_block_hash_in_previous_epoch": "0x0000000000000000000000000000000000000000000000000000000000000000",
"length": "1000",
"number": "0",
"remainder_reward": "5000000000000",
"start_number": "0"
},
"target": {
"blockReward": "5000000000000",
"epochReward": "125000000000000",
"difficulty": "0x100",
"lastBlockHashInPreviousEpoch": "0x0000000000000000000000000000000000000000000000000000000000000000",
"length": "1000",
"number": "0",
"remainderReward": "5000000000000",
"startNumber": "0"
}
}
Expand Down
12 changes: 2 additions & 10 deletions packages/ckb-sdk-rpc/src/resultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,9 @@ const formatter = {
},
toEpoch: (epoch: CKB_RPC.Epoch): CKBComponents.Epoch => {
if (!epoch) return epoch
const {
block_reward: blockReward,
last_block_hash_in_previous_epoch: lastBlockHashInPreviousEpoch,
remainder_reward: remainderReward,
start_number: startNumber,
...rest
} = epoch
const { epoch_reward: epochReward, start_number: startNumber, ...rest } = epoch
return {
blockReward,
lastBlockHashInPreviousEpoch,
remainderReward,
epochReward,
startNumber,
...rest,
}
Expand Down
4 changes: 1 addition & 3 deletions packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,10 @@ declare module CKB_RPC {
}

export interface Epoch {
block_reward: string
epoch_reward: string
difficulty: string
last_block_hash_in_previous_epoch: string
length: string
number: string
remainder_reward: string
start_number: string
}

Expand Down
4 changes: 1 addition & 3 deletions packages/ckb-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,10 @@ declare namespace CKBComponents {
}

export interface Epoch {
blockReward: String
epochReward: String
difficulty: String
lastBlockHashInPreviousEpoch: String
length: String
number: String
remainderReward: String
startNumber: String
}

Expand Down

0 comments on commit 296c515

Please sign in to comment.