Skip to content

Commit

Permalink
fix: update accounts balance-info and vesting-info to use historicApi (
Browse files Browse the repository at this point in the history
…#709)

* polkadot e2e-vesting-info

* update tests for vesting info

* refactor balance-info

* lint

* return error when vesting info pallet doesnt exist

* kusama e2e tests for vesting info, adjust polkadot ones

* add westend and lint

* cleanup
  • Loading branch information
TarikGul committed Oct 18, 2021
1 parent 5864465 commit d527bbf
Show file tree
Hide file tree
Showing 31 changed files with 417 additions and 87 deletions.
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/balance-info/9625229.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x8c7b804e374421fd4cbed7d8dcba22baaa2c9a47c5af84602c4ff396de11e0ab",
"height": "9625229"
},
"nonce": "5658",
"tokenSymbol": "KSM",
"free": "927815322283",
"reserved": "0",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
5 changes: 5 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/balance-info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import accountBalance1355087 from './1355087.json';
import accountBalance1455087 from './1455087.json';
import accountBalance1655087 from './1655087.json';
import accountBalance8990000 from './8990000.json';
import accountBalance9625229 from './9625229.json';

/**
* When it comes to kusama there are 3 major storage formats we are testing.
Expand Down Expand Up @@ -32,4 +33,8 @@ export const kusamaAccountBalanceEndpoints = [
'/accounts/CdA6gJUJRAZadvkZ2XHyaiunC7hhgY1MaWQ7A7b3dfLQHMk/balance-info?at=8990000',
JSON.stringify(accountBalance8990000),
], //v9090
[
`/accounts/CdA6gJUJRAZadvkZ2XHyaiunC7hhgY1MaWQ7A7b3dfLQHMk/balance-info?at=9625229`,
JSON.stringify(accountBalance9625229),
], //v9110
];
6 changes: 5 additions & 1 deletion e2e-tests/endpoints/kusama/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { kusamaAccountBalanceEndpoints } from './balance-info';
import { kusamaAccountVestingInfoEndpoints } from './vesting-info';

export const kusamaAccountsEndpoints = [...kusamaAccountBalanceEndpoints];
export const kusamaAccountsEndpoints = [
...kusamaAccountBalanceEndpoints,
...kusamaAccountVestingInfoEndpoints,
];
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/vesting-info/3132897.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0xc5b3a62fed58ac86f55a8fbf9f8c8cc3cd441fd7b97991990649a4d8e917157a",
"height": "3132897"
},
"vesting": [
{
"locked": "300000000000000",
"perBlock": "173544625",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/vesting-info/5190210.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x8dee0f5e2032d600f309d44e9f6c79716927d5e454c63fbf0ffde5a84496b642",
"height": "5190210"
},
"vesting": [
{
"locked": "1444780000000000",
"perBlock": "274882040",
"startingBlock": "2073600"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/vesting-info/5626862.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x9ce167f5a3918f55d05f4de76b8bac6fa62b406fa6b4628b6abbb72dae0062a3",
"height": "5626862"
},
"vesting": [
{
"locked": "1444780000000000",
"perBlock": "274882040",
"startingBlock": "2073600"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/vesting-info/7523076.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x89cc6eec8c021e3c8ecdf14f132fec1819afc7f7df7974cf3c7fd19220b3c66b",
"height": "7523076"
},
"vesting": [
{
"locked": "41779888000000000",
"perBlock": "24168916769",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/vesting-info/9123076.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x30cdc4f67b1c723afaa06fccc79f2e27c106178b8857e8afa048f26e8f4daee5",
"height": "9123076"
},
"vesting": [
{
"locked": "41779888000000000",
"perBlock": "24168916769",
"startingBlock": "0"
}
]
}
7 changes: 7 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/vesting-info/9625129.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"at": {
"hash": "0x79f9a49ff3187d2bb39f653b99683d9b5af883e9693054d2475465727297b786",
"height": "9625129"
},
"vesting": []
}
33 changes: 33 additions & 0 deletions e2e-tests/endpoints/kusama/accounts/vesting-info/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import accountVestingInfo3132897 from './3132897.json';
import accountVestingInfo5190210 from './5190210.json';
import accountVestingInfo5626862 from './5626862.json';
import accountVestingInfo7523076 from './7523076.json';
import accountVestingInfo9123076 from './9123076.json';
import accountVestingInfo9625129 from './9625129.json';

export const kusamaAccountVestingInfoEndpoints = [
[
'/accounts/Dz8AripX8Jbpi78u5jjnGZxAQtfC149XBJ5UMEXYPX5EwF2/vesting-info?at=3132897',
JSON.stringify(accountVestingInfo3132897),
], // v2012
[
'/accounts/DWUAQt9zcpnQt5dT48NwWbJuxQ78vKRK9PRkHDkGDn9TJ1j/vesting-info?at=5190210',
JSON.stringify(accountVestingInfo5190210),
], // v2026
[
'/accounts/DWUAQt9zcpnQt5dT48NwWbJuxQ78vKRK9PRkHDkGDn9TJ1j/vesting-info?at=5626862',
JSON.stringify(accountVestingInfo5626862),
], // v2026
[
'/accounts/D3icRvk43Bj69ChTPkx5v4pEQKGqDY95hHXiBB1JBFVwtvP/vesting-info?at=7523076',
JSON.stringify(accountVestingInfo7523076),
], // v9010
[
'/accounts/D3icRvk43Bj69ChTPkx5v4pEQKGqDY95hHXiBB1JBFVwtvP/vesting-info?at=9123076',
JSON.stringify(accountVestingInfo9123076),
], // v9090
[
'/accounts/D3icRvk43Bj69ChTPkx5v4pEQKGqDY95hHXiBB1JBFVwtvP/vesting-info?at=9625129',
JSON.stringify(accountVestingInfo9625129),
], // v9111
];
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/balance-info/7241122.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x9788574c3d041d291af7b04356d02a176f544865216284ee43d5c5d401f07e17",
"height": "7241122"
},
"nonce": "166035",
"tokenSymbol": "DOT",
"free": "111464176358655752",
"reserved": "0",
"miscFrozen": "0",
"feeFrozen": "0",
"locks": []
}
5 changes: 5 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/balance-info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import accountBalance2282256 from './2282256.json';
import accountBalance3574738 from './3574738.json';
import accountBalance4574738 from './4574738.json';
import accountBalance6574738 from './6574738.json';
import accountBalance7241122 from './7241122.json';

export const polkadotAccountBalanceEndpoints = [
[
Expand All @@ -30,4 +31,8 @@ export const polkadotAccountBalanceEndpoints = [
'/accounts/15kUt2i86LHRWCkE3D9Bg1HZAoc2smhn1fwPzDERTb1BXAkX/balance-info?at=6574738',
JSON.stringify(accountBalance6574738),
], // v9080
[
'/accounts/15kUt2i86LHRWCkE3D9Bg1HZAoc2smhn1fwPzDERTb1BXAkX/balance-info?at=7241122',
JSON.stringify(accountBalance7241122),
], // v9110
];
6 changes: 5 additions & 1 deletion e2e-tests/endpoints/polkadot/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { polkadotAccountBalanceEndpoints } from './balance-info';
import { polkadotAccountVestingInfoEndpoints } from './vesting-info';

export const polkadotAccountsEndpoints = [...polkadotAccountBalanceEndpoints];
export const polkadotAccountsEndpoints = [
...polkadotAccountBalanceEndpoints,
...polkadotAccountVestingInfoEndpoints,
];
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/10254.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0xee027b253354da94f1efab36c2e69863cb2718ba15d56697651a0224f3fe808f",
"height": "10254"
},
"vesting": [
{
"locked": "237000000000000",
"perBlock": "22858796",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/111170.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0xa313a09ee6bec7f2f93ec6a0864db3342fe48eafdc642b96be6d8aec84c865e9",
"height": "111170"
},
"vesting": [
{
"locked": "1042000000000000",
"perBlock": "100501543",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/1448.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x1f94608e2d9ef51901551a9fd41e5be9fff29fe51e78b86bfab5fad7cc540683",
"height": "1448"
},
"vesting": [
{
"locked": "702000000000000",
"perBlock": "67708333",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/213327.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x2d62ef40345e7298177b35ab56f3d3c2e48644c6e58ff5bf6202952353825b4f",
"height": "213327"
},
"vesting": [
{
"locked": "25000000000000",
"perBlock": "2411265",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/2413527.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x58e6be686ba31644c1eee141c7aad2fdf5ce461fd6414dc925a5442961e671d5",
"height": "2413527"
},
"vesting": [
{
"locked": "25000000000000",
"perBlock": "2411265",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/4353425.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0xaf36b53f81f2d8e50d4189bf069a3a511a590730fd4cee9dd52ed6d8396cc6c8",
"height": "4353425"
},
"vesting": [
{
"locked": "237000000000000",
"perBlock": "22858796",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/6413249.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0xbd8f0e9e4e1fb155f45abcbfe0a9fe7e9cb5ef5630f5cf709193dea188a5928e",
"height": "6413249"
},
"vesting": [
{
"locked": "1042000000000000",
"perBlock": "100501543",
"startingBlock": "0"
}
]
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/7232861.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0xecf2b44c9f22fa1c4db0019cb24bf7336e431ef51f68cb7910a3d567ca0d62a6",
"height": "7232861"
},
"vesting": [
{
"locked": "702000000000000",
"perBlock": "67708333",
"startingBlock": "0"
}
]
}
43 changes: 43 additions & 0 deletions e2e-tests/endpoints/polkadot/accounts/vesting-info/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import accountVestingInfo1448 from './1448.json';
import accountVestingInfo10254 from './10254.json';
import accountVestingInfo111170 from './111170.json';
import accountVestingInfo213327 from './213327.json';
import accountVestingInfo2413527 from './2413527.json';
import accountVestingInfo4353425 from './4353425.json';
import accountVestingInfo6413249 from './6413249.json';
import accountVestingInfo7232861 from './7232861.json';

export const polkadotAccountVestingInfoEndpoints = [
[
'/accounts/15aKvwRqGVAwuBMaogtQXhuz9EQqUWsZJSAzomyb5xYwgBXA/vesting-info?at=1448',
JSON.stringify(accountVestingInfo1448),
], // v0
[
'/accounts/123PewK4ZYcX7Do8PKzP4KyYbLKMQAAA3EhhZcnBDrxAuidt/vesting-info?at=10254',
JSON.stringify(accountVestingInfo10254),
], // v0
[
'/accounts/16FQxY2L9GbBoE1jYCDRUkJRroYMu5FsKRQfFi29xueu1egj/vesting-info?at=111170',
JSON.stringify(accountVestingInfo111170),
], // v1
[
'/accounts/1BjwMkGfudp4eVAMpqv6CHZJxGsLFkqQv5oaZT9gWc5o7hn/vesting-info?at=213327',
JSON.stringify(accountVestingInfo213327),
], // v6
[
'/accounts/1BjwMkGfudp4eVAMpqv6CHZJxGsLFkqQv5oaZT9gWc5o7hn/vesting-info?at=2413527',
JSON.stringify(accountVestingInfo2413527),
], // v25
[
'/accounts/123PewK4ZYcX7Do8PKzP4KyYbLKMQAAA3EhhZcnBDrxAuidt/vesting-info?at=4353425',
JSON.stringify(accountVestingInfo4353425),
], // v29
[
'/accounts/16FQxY2L9GbBoE1jYCDRUkJRroYMu5FsKRQfFi29xueu1egj/vesting-info?at=6413249',
JSON.stringify(accountVestingInfo6413249),
], // v9080
[
'/accounts/15aKvwRqGVAwuBMaogtQXhuz9EQqUWsZJSAzomyb5xYwgBXA/vesting-info?at=7232861',
JSON.stringify(accountVestingInfo7232861),
], // v9110
];
6 changes: 5 additions & 1 deletion e2e-tests/endpoints/westend/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { westendAccountBalanceEndpoints } from './balance-info';
import { westendAccountVestingInfoEndpoints } from './vesting-info';

export const westendAccountsEndpoints = [...westendAccountBalanceEndpoints];
export const westendAccountsEndpoints = [
...westendAccountBalanceEndpoints,
...westendAccountVestingInfoEndpoints,
];
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/westend/accounts/vesting-info/4802950.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"at": {
"hash": "0x916dfc47eb58617c65e625678e58ad1f532979316941981ba91f5a638146adf6",
"height": "4802950"
},
"vesting": [
{
"locked": "100000000000000",
"perBlock": "1000000000000",
"startingBlock": "4346810"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"at": {
"hash": "0x234ecd92869553e97c495c7419fda4e090c53cd75ea2c1861b6dc21e8361e3ec",
"height": "6052407"
},
"vesting": []
}
13 changes: 13 additions & 0 deletions e2e-tests/endpoints/westend/accounts/vesting-info/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import accountVestingInfo4802950 from './4802950.json';
import accountVestingInfo6052407 from './6052407.json';

export const westendAccountVestingInfoEndpoints = [
[
'/accounts/5H6b7Xsinpxag8DXE6gPv1UEaTrmWNkaKwsiTg7kad7JBTSe/vesting-info?at=4802950',
JSON.stringify(accountVestingInfo4802950),
],
[
'/accounts/5Dw5KnvTs96FaRQFez1Su15XMMJ65QAi4F1ugNBaXUBiGbX6/vesting-info?at=6052407',
JSON.stringify(accountVestingInfo6052407),
],
];

0 comments on commit d527bbf

Please sign in to comment.