Skip to content

Commit

Permalink
feat: include balance-info support for statemine and statemint (#1126)
Browse files Browse the repository at this point in the history
* feat: include balance-info support for statemine and statemint

* add newline char to json

* remove spaces between test endpoints

* fix test endpoint spacing
  • Loading branch information
marshacb committed Nov 3, 2022
1 parent 8cd3084 commit a171305
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 0 deletions.
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/1100000.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x256cb93bca1d4f6e7984ba18ac1028a3766b50979dbbaab139500e3bfbe627af",
"height": "1100000"
},
"nonce": "14",
"tokenSymbol": "KSM",
"free": "273843989329",
"reserved": "3020075999040",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/1300000.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0xa3c04d6812741314b6b089de8a25f36e4f28b04b651aa787653132becc2bb1ae",
"height": "1300000"
},
"nonce": "14",
"tokenSymbol": "KSM",
"free": "273843989329",
"reserved": "3020075999040",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/1800000.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x21e71402596947b239ef5e8b403e943222fc68a53bd3c8fc4e736854ab523df7",
"height": "1800000"
},
"nonce": "14",
"tokenSymbol": "KSM",
"free": "273843989329",
"reserved": "3020075999040",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/450000.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x219b8d60bee1f883a4f7cfecd021e54c23532f4bba9151a4ef1ce904d5245a94",
"height": "450000"
},
"nonce": "10",
"tokenSymbol": "KSM",
"free": "3967171215499",
"reserved": "4026768665380",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/650000.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x5660a5af9e985efeb4e12e47e9a49d28402a0f110a7179a7051030f417ee4461",
"height": "650000"
},
"nonce": "10",
"tokenSymbol": "KSM",
"free": "3967171215499",
"reserved": "4026768665380",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/960000.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x99b2f00e07d5316ac9ace7cacc52a5b2fbc90cb09b95c4d166e6d46255c8a683",
"height": "960000"
},
"nonce": "14",
"tokenSymbol": "KSM",
"free": "273843989329",
"reserved": "3020075999040",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/986791.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x4d9411f046829e0e421f8fc15fdca3a35a0e54074f61dcf632b1af626e063182",
"height": "986791"
},
"nonce": "14",
"tokenSymbol": "KSM",
"free": "273843989329",
"reserved": "3020075999040",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
54 changes: 54 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/balance-info/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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 accountBalance450000 from './450000.json';
import accountBalance650000 from './650000.json';
import accountBalance960000 from './960000.json';
import accountBalance986791 from './986791.json';
import accountBalance1100000 from './1100000.json';
import accountBalance1300000 from './1300000.json';
import accountBalance1800000 from './1800000.json';

export const statemineAccountBalanceEndpoints = [
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=450000',
JSON.stringify(accountBalance450000),
], // v2
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=650000',
JSON.stringify(accountBalance650000),
], // v3
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=960000',
JSON.stringify(accountBalance960000),
], // v4
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=986791',
JSON.stringify(accountBalance986791),
], // v5
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=1100000',
JSON.stringify(accountBalance1100000),
], // v504
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=1300000',
JSON.stringify(accountBalance1300000),
], // v601
[
'/accounts/H4DU1hKQeLkR5bhMeMidarF9bVvrH3k6ybLz84YLs7eRQMu/balance-info?at=1800000',
JSON.stringify(accountBalance1800000),
], // v700
];
2 changes: 2 additions & 0 deletions e2e-tests/endpoints/statemine/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

import { statemineAccountsApprovalsEndpoints } from './asset-approvals';
import { statemineAccountAssetBalanceEndpoints } from './asset-balances';
import { statemineAccountBalanceEndpoints } from './balance-info';

export const statemineAccountAssetEndpoints = [
...statemineAccountBalanceEndpoints,
...statemineAccountAssetBalanceEndpoints,
...statemineAccountsApprovalsEndpoints,
];
1 change: 1 addition & 0 deletions src/chains-config/statemineControllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { initLRUCache, QueryFeeDetailsCache } from './cache';
export const statemineControllers: ControllerConfig = {
controllers: [
'AccountsAssets',
'AccountsBalanceInfo',
'AccountsValidate',
'Blocks',
'BlocksExtrinsics',
Expand Down
1 change: 1 addition & 0 deletions src/chains-config/statemintControllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { initLRUCache, QueryFeeDetailsCache } from './cache';
export const statemintControllers: ControllerConfig = {
controllers: [
'AccountsAssets',
'AccountsBalanceInfo',
'AccountsValidate',
'Blocks',
'BlocksExtrinsics',
Expand Down

0 comments on commit a171305

Please sign in to comment.