Skip to content

feat: add asset-conversion endpoints #1324

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

Merged
merged 9 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
2 changes: 1 addition & 1 deletion docs/dist/app.bundle.js

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions docs/src/openapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,66 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/PalletsAssetsInfo'
/pallets/asset-conversion/liquidity-pools:
get:
tags:
- pallets
summary: Get information related to existing liquidity pools.
description: Returns a list of the existing liquidity pools and its corresponding
tokens at a given block height. If no block is specified, it returns the latest list
available.
parameters:
- name: at
in: query
description: Block at which to retrieve the liquidity pools information.
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/LiquidityPools'
"400":
description: invalid blockId supplied for at query param
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/pallets/asset-conversion/next-available-id:
get:
tags:
- pallets
summary: Get the next available liquidity pool id.
description: Returns the next available liquidity pool's id at a given
block height. If no block is specified, it returns the latest list
available.
parameters:
- name: at
in: query
description: Block at which to retrieve the next liquidity pool's id.
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/NextAvailableId'
"400":
description: invalid blockId supplied for at query param
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/pallets/{palletId}/consts:
get:
tags:
Expand Down Expand Up @@ -2051,6 +2111,27 @@ components:
description: An array of queried assets.
items:
$ref: '#/components/schemas/AssetsBalance'
LiquidityPools:
type: object
properties:
at:
$ref: '#/components/schemas/BlockIdentifiers'
pools:
type: array
description: Array containing existent liquidity pool's token id.
example: "[{\"reserves\":[{\"parents\":\"1\",\"interior\":{\"here\":
null}},{\"parents\":\"0\",\"interior\":{\"x2\":[{\"palletInstance\":
\"50\"},{\"generalIndex\":\"2\"}]}}],\"lpToken\":{\"lpToken\":\"1\"}
},{\"lpToken\":{\"lpToken\":\"0\"}}]"
NextAvailableId:
type: object
properties:
at:
$ref: '#/components/schemas/BlockIdentifiers'
id:
type: string
description: Next availabe liquidity pool's id.
example: "4"
AccountBalanceInfo:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"at": {
"hash": "0x775221e0ea695a7b7077943687c1393ae6902a5a82a4fefebe618bf36e83101b",
"height": "5235874"
},
"amount": null,
"deposit": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import accountsApprovals5235874 from './5235874.json';

export const assetHubWestendAccountsApprovalsEndpoints = [
[
'/accounts/5ESM47S6Yrx48SsuSvmDe3HQJm5czh5grYekv4diqCT3f7wM/asset-approvals?assetId=301&delegate=5Di8DkuGHV7rBvJ8XLHZP8Hrq9p6RqiiPdnqGqvxMD88Xhrc&at=5235874',
JSON.stringify(accountsApprovals5235874),
],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"at": {
"hash": "0x0483066dddcf582bbcce0f25acc3f4a50b068adf95292dc23126b187ae59cb82",
"height": "1800000"
},
"assets": [
{
"assetId": "301",
"balance": "99999999999999999999501000970900000050",
"isFrozen": false,
"isSufficient": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import accountAssetBalance1800000 from './1800000.json';

export const assetHubWestendAccountAssetBalanceEndpoints = [
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/asset-balances?assets[]=301&at=1800000',
JSON.stringify(accountAssetBalance1800000),
],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"at": {
"hash": "0x0483066dddcf582bbcce0f25acc3f4a50b068adf95292dc23126b187ae59cb82",
"height": "1800000"
},
"nonce": "0",
"tokenSymbol": "WND",
"free": "0",
"reserved": "0",
"miscFrozen": "0",
"feeFrozen": "0",
"frozen": "frozen does not exist for this runtime",
"locks": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import accountBalance1800000 from './1800000.json';

export const assetHubWestendAccountBalanceEndpoints = [
[
'/accounts/5Gj8nd1DqK3p6Dqpao9bGnDwLaxYgEGxFwPL2ZwjGvt2kSWv/balance-info?at=1800000',
JSON.stringify(accountBalance1800000),
],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { assetHubWestendAccountsApprovalsEndpoints } from './asset-approvals';
import { assetHubWestendAccountAssetBalanceEndpoints } from './asset-balances';
import { assetHubWestendAccountBalanceEndpoints } from './balance-info';

export const assetHubWestendAccountEndpoints = [
...assetHubWestendAccountBalanceEndpoints,
...assetHubWestendAccountAssetBalanceEndpoints,
...assetHubWestendAccountsApprovalsEndpoints,
];
Loading