Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: assets endpoints #533

Merged
merged 80 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
526fd1c
feat: assets endpoint
TarikGul Apr 30, 2021
007af5e
lint, add controller configs
TarikGul Apr 30, 2021
6d6c8c2
types | account assets boilerplate
TarikGul Apr 30, 2021
3d2e0db
asset-balancese endpoint
TarikGul May 3, 2021
b58d069
asset-approvals
TarikGul May 4, 2021
cb5c8ee
assets endpoint tests
TarikGul May 4, 2021
69d74f8
asset-balance tests
TarikGul May 4, 2021
0b8ddce
remove consoles
TarikGul May 4, 2021
5de8175
fix: asset-balances response and tests
TarikGul May 4, 2021
ccd94a6
asset-approval test and cleanup
TarikGul May 4, 2021
26de3ee
lint
TarikGul May 4, 2021
4a1504b
add accountAssets to exports
TarikGul May 4, 2021
36561ad
add comment docs
TarikGul May 4, 2021
bdf4a61
lint
TarikGul May 4, 2021
cc01fe9
fix: mockApi `assetsAccount`
TarikGul May 5, 2021
3774082
add refactor storageKeyDoubleMaap inside TypeFactory
TarikGul May 5, 2021
1f3c1c7
Update src/controllers/accounts/AccountsAssetsController.ts
TarikGul May 5, 2021
a19a4ed
Update src/services/accounts/AccountsAssetsService.ts
TarikGul May 5, 2021
4ab745b
Update src/controllers/accounts/AccountsAssetsController.ts
TarikGul May 5, 2021
429cc72
Update src/services/assets/AssetsService.ts
TarikGul May 5, 2021
c1c3ef5
Update src/controllers/assets/AssetsController.ts
TarikGul May 5, 2021
9f77ce1
create queryAssets
TarikGul May 5, 2021
1ce18a0
Merge branch 'tarik-assets-endpoint' of github.com:paritytech/substra…
TarikGul May 5, 2021
c9ba59b
type docs, IAccountAssetsBalances
TarikGul May 5, 2021
c2d608e
fix error message
TarikGul May 5, 2021
c0c5e50
remove sorting assetIds
TarikGul May 5, 2021
88879ec
add docs for queryAssets
TarikGul May 5, 2021
a762b2b
lint
TarikGul May 5, 2021
ed6674c
Update src/services/accounts/AccountsAssetsService.ts
TarikGul May 6, 2021
8f56a70
Update src/services/accounts/AccountsAssetsService.spec.ts
TarikGul May 6, 2021
a84c180
Update src/controllers/assets/AssetsController.ts
TarikGul May 6, 2021
8aabbd8
lint
TarikGul May 6, 2021
ff5565a
Update src/controllers/accounts/AccountsAssetsController.ts
TarikGul May 6, 2021
4440118
Update src/controllers/accounts/AccountsAssetsController.ts
TarikGul May 6, 2021
6569eef
fix parsing for query parameters
TarikGul May 6, 2021
eefa3b1
lint
TarikGul May 6, 2021
ef6a40f
lint
TarikGul May 6, 2021
3e7fc89
Merge branch 'master' of github.com:paritytech/substrate-api-sidecar …
TarikGul May 7, 2021
a29e3f7
change index naming
TarikGul May 7, 2021
331a9be
fix storageKeyDoubleMap naming
TarikGul May 7, 2021
3e51866
lint
TarikGul May 7, 2021
3a84fcd
fix docs
TarikGul May 7, 2021
5f4103c
comments
TarikGul May 7, 2021
fd73394
fix: get keys from singleMap
TarikGul May 7, 2021
6676fd5
refactor queryAllAssets
TarikGul May 7, 2021
1559951
Merge branch 'master' of github.com:paritytech/substrate-api-sidecar …
TarikGul May 7, 2021
81a7f0e
add assets to kilt
TarikGul May 7, 2021
e64a480
docs: AccountsAssetController
TarikGul May 8, 2021
f4adf64
lint
TarikGul May 8, 2021
ac2a6df
docs: AssetsController
TarikGul May 8, 2021
05e2535
lint
TarikGul May 9, 2021
3c3d855
fix routes
TarikGul May 9, 2021
9dc4e82
add error handling to asset-approval
TarikGul May 9, 2021
e52266a
isEmpty to isNone
TarikGul May 9, 2021
584f9ae
fix: change /assets to /pallets/assets
TarikGul May 10, 2021
4f320bd
fix(/accounts/:address/asset-approvals): remove 400 badrequest, repla…
TarikGul May 10, 2021
d07ddbd
fix: change isNone to isSome
TarikGul May 10, 2021
46b5a1e
docs: udpate API docs
TarikGul May 10, 2021
f6fb250
fix indenting
TarikGul May 10, 2021
2da2b29
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
0f7ecc4
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
df23bf3
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
90985fb
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
9194d38
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
ee571b7
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
6b415dd
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
e28417d
Update src/services/accounts/AccountsAssetsService.ts
TarikGul May 11, 2021
4be6088
Update src/services/accounts/AccountsAssetsService.ts
TarikGul May 11, 2021
225313c
Update src/types/responses/AccountAssets.ts
TarikGul May 11, 2021
ed40309
Update src/services/accounts/AccountsAssetsService.ts
TarikGul May 11, 2021
d4670f3
Update src/services/accounts/AccountsAssetsService.ts
TarikGul May 11, 2021
78bc6db
Update src/services/accounts/AccountsAssetsService.ts
TarikGul May 11, 2021
fb05b14
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
3e39f61
Update docs/src/openapi-v1.yaml
TarikGul May 11, 2021
0b4ca9b
update docs
TarikGul May 11, 2021
45ff124
fix parseQueryParamArrayOrThrow
TarikGul May 11, 2021
95b7af7
docs: update them with suggestions rebuild
TarikGul May 11, 2021
b3f2678
Removee isArray sanity check
TarikGul May 11, 2021
3e02d71
Use beta for polkadot deps
emostov May 11, 2021
7a00886
docs: fix pattern for acountId
TarikGul May 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ yarn-error.log
.yarn/*
!.yarn/releases
!.yarn/plugins
/docs/.yarn
166 changes: 83 additions & 83 deletions docs/dist/app.bundle.js

Large diffs are not rendered by default.

250 changes: 250 additions & 0 deletions docs/src/openapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,98 @@ tags:
- name: transaction
- name: paras
paths:
/accounts/{accountId}/asset-balances:
get:
tags:
- accounts
summary: Get an array of asset-balances for an account.
description: Returns information about an accounts asset-balances. This is
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
specific to the assets-pallet for parachains. If no `assets` query parameter
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
is provided, all asset-balances for the given account will be returned.
operationId: getAssetBalances
parameters:
- name: accountId
in: path
description: SS58 address of the account.
required: true
schema:
type: string
pattern: '^[1-9A-HJ-NP-Za-km-z]{8,64}$'
- name: at
in: query
description: Block at which to query asset-balance info for the
specified account.
required: false
schema:
type: string
description: Block height (as a non-negative integer) or hash
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
(as a hex string).
format: unsignedInteger or $hex
- name: assets
in: query
description: An array of AssetId's to be queried. If not inputed by default
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
all asset-balances associated with the `accountId` will be returned. The array
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
format follows Express 4.x API recommendations. ex:`?assets[]=1&assets[]=2&assets[]=3`.
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
required: false
schema:
type: string
description: An array of assetId numbers represented as strings
format: Array of unsignedInteger's
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
responses:
"200":
description: successfull operation
content:
application/json:
schema:
$ref: '#/components/schemas/AccountAssetsBalances'
/accounts/{accountId}/asset-approvals:
get:
tags:
- accounts
summary: Get an asset-approval for an account.
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
description: Returns information about an account's asset-approval transaction.
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
It is required to pass in a delegate and an assetId as query parameters.
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
operationId: getAssetApprovals
parameters:
- name: accountId
in: path
description: SS58 address of the account.
required: true
schema:
type: string
pattern: '^[1-9A-HJ-NP-Za-km-z]{8,64}$'
- name: at
in: query
description: Block at which to query asset-approval info for the
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
specified account.
required: false
schema:
type: string
description: Block height (as a non-negative integer) or hash
(as a hex string).
format: unsignedInteger or $hex
- name: assetId
in: query
description: The `assetId` associated with the asset-approval.
required: true
schema:
type: string
description: An assetId represented as an unsignedInteger.
format: unsignedInteger
- name: delegate
in: query
description: The delegate's `accountId` associated with an asset-approval.
required: true
schema:
type: string
pattern: '^[1-9A-HJ-NP-Za-km-z]{8,64}$'
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
responses:
"200":
description: successfull operation
content:
application/json:
schema:
$ref: '#/components/schemas/AccountAssetsApproval'
/accounts/{accountId}/balance-info:
get:
tags:
Expand Down Expand Up @@ -522,6 +614,37 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
/pallets/assets/{assetId}/asset-info:
get:
tags:
- pallets
summary: Get information and metadata associated with an asset.
description: Returns information associated with an asset which includes
the assets `AssetDetails` and `AssetMetadata`.
operationId: getAssetById
parameters:
- name: assetId
in: path
description: The unsignedInteger Id of an asset.
required: true
schema:
type: string
format: unsignedInteger
- name: at
in: query
description: Block at which to retrieve the assetInfo.
required: false
schema:
type: string
description: Block identifier, as the block height or block hash.
format: unsignedInteger or $hex
responses:
"200":
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PalletsAssetsInfo'
/pallets/staking/progress:
get:
tags:
Expand Down Expand Up @@ -982,6 +1105,133 @@ components:
locks
items:
$ref: '#/components/schemas/BalanceLock'
AccountAssetsBalances:
type: object
properties:
at:
$ref: '#/components/schemas/BlockIdentifiers'
assets:
type: array
description: An array of queried assets.
items:
$ref: '#/components/schemas/AssetsBalance'
AssetsBalance:
type: object
properties:
assetId:
type: string
description: The identifier of the asset.
format: unsignedInteger
balance:
type: string
description: The balance of the asset.
format: unsignedInteger
isFrozen:
type: boolean
description: Whether the asset is frozen for non-admin transfers.
isSufficient:
type: boolean
description: Whether a non-zero balance of this asset is a deposit of sufficient
value to account for the state bloat associated with its balance storage. If set to
`true`, then non-zero balances may be stored without a `consumer` reference (and thus
an ED in the Balances pallet or whatever else is used to control user-account state
growth).
AccountAssetsApproval:
type: object
properties:
at:
$ref: '#/components/schemas/BlockIdentifiers'
amount:
type: string
description: The amount of funds approved for the balance transfer from the owner
to some delegated target.
format: unsignedInteger
deposit:
type: string
description: The amount reserved on the owner's account to hold this item in storage.
format: unsignedInteger
PalletsAssetsInfo:
type: object
properties:
at:
$ref: '#/components/schemas/BlockIdentifiers'
assetInfo:
$ref: '#/components/schemas/AssetInfo'
assetMetadata:
$ref: '#/components/schemas/AssetMetadata'
AssetInfo:
type: object
properties:
owner:
type: string
description: Owner of the assets privileges.
pattern: '^[1-9A-HJ-NP-Za-km-z]{8,64}$'
issuer:
type: string
description: The `AccountId` able to mint tokens.
pattern: '^[1-9A-HJ-NP-Za-km-z]{8,64}$'
admin:
type: string
description: The `AccountId` can that thaw tokens, force transfers and burn token from
TarikGul marked this conversation as resolved.
Show resolved Hide resolved
any account.
pattern: '^[1-9A-HJ-NP-Za-km-z]{8,64}$'
freezer:
type: string
description: The `AccountId` that can freeze tokens.
pattern: '^[1-9A-HJ-NP-Za-km-z]{8,64}$'
supply:
type: string
description: The total supply across accounts.
format: unsignedInteger
deposit:
type: string
description: The balance deposited for this. This pays for the data stored.
format: unsignedInteger
minBalance:
type: string
description: The ED for virtual accounts.
format: unsignedInteger
isSufficient:
type: boolean
description: If `true`, then any account with this asset is given a provider reference. Otherwise, it
requires a consumer reference.
accounts:
type: string
description: The total number of accounts.
format: unsignedInteger
sufficients:
type: string
description: The total number of accounts for which is placed a self-sufficient reference.
approvals:
type: string
description: The total number of approvals.
format: unsignedInteger
isFrozen:
type: boolean
description: Whether the asset is frozen for non-admin transfers.
AssetMetadata:
type: object
properties:
deposit:
type: string
description: The balance deposited for this metadata. This pays for the data
stored in this struct.
format: unsignedInteger
name:
type: string
description: The user friendly name of this asset.
format: $hex
symbol:
type: string
description: The ticker symbol for this asset.
format: $hex
decimals:
type: string
description: The number of decimals this asset uses to represent one unit.
format: unsignedInteger
isFrozen:
type: boolean
description: Whether the asset metadata may be changed by a non Force origin.
StakingLedger:
type: object
properties:
Expand Down
Loading