-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #712 from nervosnetwork/rc/v0.11.0
- Loading branch information
Showing
42 changed files
with
1,377 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Environment** | ||
|
||
- **Operating system**: Linux / macOS / Windows | ||
- **Arch**: x64 | ||
- **Installation**: GitHub Release | ||
|
||
**Describe the bug** | ||
|
||
_Your issue description goes here below. Try to include **actual** vs. **expected behavior** and **steps to reproduce** the issue._ | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. excite come command | ||
3. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'enhancement' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
name: Question issue template | ||
about: Ask a question | ||
title: '' | ||
labels: help wanted | ||
assignees: '' | ||
|
||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
class Api::V1::UdtTransactionsController < ApplicationController | ||
before_action :validate_query_params | ||
before_action :validate_pagination_params, :pagination_params | ||
module Api | ||
module V1 | ||
class UdtTransactionsController < ApplicationController | ||
before_action :validate_query_params | ||
before_action :validate_pagination_params, :pagination_params | ||
|
||
def show | ||
udt = Udt.find_by!(type_hash: params[:id], published: true) | ||
ckb_transactions = udt.ckb_transactions.recent.page(@page).per(@page_size) | ||
options = FastJsonapi::PaginationMetaGenerator.new(request: request, records: ckb_transactions, page: @page, page_size: @page_size).call | ||
def show | ||
udt = Udt.find_by!(type_hash: params[:id], published: true) | ||
ckb_transactions = udt.ckb_transactions.select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase).recent.page(@page).per(@page_size) | ||
json = | ||
Rails.cache.realize(ckb_transactions.cache_key, version: ckb_transactions.cache_version) do | ||
options = FastJsonapi::PaginationMetaGenerator.new(request: request, records: ckb_transactions, page: @page, page_size: @page_size).call | ||
CkbTransactionsSerializer.new(ckb_transactions, options.merge(params: { previews: true })).serialized_json | ||
end | ||
|
||
render json: CkbTransactionSerializer.new(ckb_transactions, options.merge({ params: { previews: true } })) | ||
rescue ActiveRecord::RecordNotFound | ||
raise Api::V1::Exceptions::UdtNotFoundError | ||
end | ||
render json: json | ||
rescue ActiveRecord::RecordNotFound | ||
raise Api::V1::Exceptions::UdtNotFoundError | ||
end | ||
|
||
private | ||
private | ||
|
||
def validate_query_params | ||
validator = Validations::Udt.new(params) | ||
def validate_query_params | ||
validator = Validations::Udt.new(params) | ||
|
||
if validator.invalid? | ||
errors = validator.error_object[:errors] | ||
status = validator.error_object[:status] | ||
if validator.invalid? | ||
errors = validator.error_object[:errors] | ||
status = validator.error_object[:status] | ||
|
||
render json: errors, status: status | ||
end | ||
end | ||
render json: errors, status: status | ||
end | ||
end | ||
|
||
def pagination_params | ||
@page = params[:page] || 1 | ||
@page_size = params[:page_size] || CkbTransaction.default_per_page | ||
def pagination_params | ||
@page = params[:page] || 1 | ||
@page_size = params[:page_size] || CkbTransaction.default_per_page | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.