Skip to content

Commit

Permalink
bypass to fix polkadot-js/api#5923
Browse files Browse the repository at this point in the history
  • Loading branch information
ironoa committed Jun 28, 2024
1 parent 3ff8094 commit bf9d7d1
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 102 deletions.
4 changes: 2 additions & 2 deletions charts/polkadot-k8s-payouts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description: Polkadot K8s Payouts
name: polkadot-k8s-payouts
version: v1.2.11
appVersion: v1.2.11
version: v1.2.12
appVersion: v1.2.12
apiVersion: v2
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polkadot-payouts",
"version": "1.2.11",
"version": "1.2.12",
"description": "Automated transfers among accounts",
"repository": "[email protected]:w3f/accountant.git",
"author": "W3F Infrastructure Team <[email protected]>",
Expand All @@ -20,7 +20,7 @@
"start": "NODE_OPTIONS='--max-old-space-size=4096' node ./dist/index.js start"
},
"dependencies": {
"@polkadot/api": "^11.3.1",
"@polkadot/api": "^12.0.1",
"@w3f/config": "^0.1.1",
"@w3f/logger": "^0.4.3",
"async-wait-until": "^1.2.6",
Expand Down
18 changes: 15 additions & 3 deletions src/claimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,21 @@ export class Claimer {
})

const claimedIdx: Set<number> = new Set<number>
const stakingQuery = await this.api.derive.staking.query(validatorAddress,{withLedger:true, withClaimedRewardsEras: true})
stakingQuery.stakingLedger.legacyClaimedRewards.forEach(r=>claimedIdx.add(r.toNumber()))
stakingQuery.claimedRewardsEras.forEach(r=>claimedIdx.add(r.toNumber()))

console.time("stakingQuery")
// const stakingQuery = await this.api.derive.staking.query(validatorAddress,{withLedger:true, withClaimedRewardsEras: false}) //withClaimedRewardsEras: true is heavy apparently => https://github.com/polkadot-js/api/issues/5923
// stakingQuery.stakingLedger.legacyClaimedRewards.forEach(r=>claimedIdx.add(r.toNumber()))
// stakingQuery.claimedRewardsEras.forEach(r=>claimedIdx.add(r.toNumber()))

//bypass to fix https://github.com/polkadot-js/api/issues/5923
for (const i of ownRewardsIdx) {
const tmp = await this.api.query.staking.claimedRewards(i,validatorAddress)
if(tmp.length){
claimedIdx.add(i)
}
}
console.timeEnd("stakingQuery")


const unclaimed: number[] = Array.from(setDifference(ownRewardsIdx,claimedIdx))
this.logger.debug(unclaimed.toString())
Expand Down
190 changes: 95 additions & 95 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -907,16 +907,16 @@
resolved "https://registry.yarnpkg.com/@polkadot-api/utils/-/utils-0.0.1.tgz#908b22becac705149d7cc946532143d0fb003bfc"
integrity sha512-3j+pRmlF9SgiYDabSdZsBSsN5XHbpXOAce1lWj56IEEaFZVjsiCaxDOA7C9nCcgfVXuvnbxqqEGQvnY+QfBAUw==

"@polkadot/api-augment@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-11.3.1.tgz#c7deeac438b017613e244c25505216a9d4c3977e"
integrity sha512-Yj+6rb6h0WwY3yJ+UGhjGW+tyMRFUMsKQuGw+eFsXdjiNU9UoXsAqA2dG7Q1F+oeX/g+y2gLGBezNoCwbl6HfA==
dependencies:
"@polkadot/api-base" "11.3.1"
"@polkadot/rpc-augment" "11.3.1"
"@polkadot/types" "11.3.1"
"@polkadot/types-augment" "11.3.1"
"@polkadot/types-codec" "11.3.1"
"@polkadot/api-augment@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-12.0.1.tgz#30c8f94e216591db02c6aadd84a56dbf7f9303ed"
integrity sha512-ZgjuqAnUnwoszccxljxY84LnUI1dR39xy7/fOmNtT4+WSHewB3uZneAWvIckXMANMZgzLaLagzQx+OmnSOuzlA==
dependencies:
"@polkadot/api-base" "12.0.1"
"@polkadot/rpc-augment" "12.0.1"
"@polkadot/types" "12.0.1"
"@polkadot/types-augment" "12.0.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/util" "^12.6.2"
tslib "^2.6.2"

Expand All @@ -933,13 +933,13 @@
"@polkadot/types-codec" "9.14.2"
"@polkadot/util" "^10.4.2"

"@polkadot/api-base@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-11.3.1.tgz#6c74c88d4a4b3d22344bb8715a135493f5a3dd33"
integrity sha512-b8UkNL00NN7+3QaLCwL5cKg+7YchHoKCAhwKusWHNBZkkO6Oo2BWilu0dZkPJOyqV9P389Kbd9+oH+SKs9u2VQ==
"@polkadot/api-base@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-12.0.1.tgz#0d55917a2d23b3d8a14734d5e90d85a21e554221"
integrity sha512-DaUPvmd0Fbbvlkd8X0ThF6C6jtupgvPKS4+9jMET+W56nUAttKnSA8rG30K7h4bMf9qKvj/IMGrQ0ZIOY0rbIg==
dependencies:
"@polkadot/rpc-core" "11.3.1"
"@polkadot/types" "11.3.1"
"@polkadot/rpc-core" "12.0.1"
"@polkadot/types" "12.0.1"
"@polkadot/util" "^12.6.2"
rxjs "^7.8.1"
tslib "^2.6.2"
Expand All @@ -955,17 +955,17 @@
"@polkadot/util" "^10.4.2"
rxjs "^7.8.0"

"@polkadot/api-derive@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-11.3.1.tgz#3617655b6dab56d5beb8efbf7383ab457370df35"
integrity sha512-9dopzrh4cRuft1nANmBvMY/hEhFDu0VICMTOGxQLOl8NMfcOFPTLAN0JhSBUoicGZhV+c4vpv01NBx/7/IL1HA==
dependencies:
"@polkadot/api" "11.3.1"
"@polkadot/api-augment" "11.3.1"
"@polkadot/api-base" "11.3.1"
"@polkadot/rpc-core" "11.3.1"
"@polkadot/types" "11.3.1"
"@polkadot/types-codec" "11.3.1"
"@polkadot/api-derive@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-12.0.1.tgz#182b27e1a5bb0fa033d7a56936ffa074ce3163f2"
integrity sha512-lENXzrCYzMQVxg8utGjGZQo/qW1iuJlHbmud1THnvUgYB36g41LR/YLSZEzyNkGT6q1W04Qe1z6+W59dWAYmkg==
dependencies:
"@polkadot/api" "12.0.1"
"@polkadot/api-augment" "12.0.1"
"@polkadot/api-base" "12.0.1"
"@polkadot/rpc-core" "12.0.1"
"@polkadot/types" "12.0.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/util" "^12.6.2"
"@polkadot/util-crypto" "^12.6.2"
rxjs "^7.8.1"
Expand All @@ -987,23 +987,23 @@
"@polkadot/util-crypto" "^10.4.2"
rxjs "^7.8.0"

"@polkadot/api@11.3.1", "@polkadot/api@^11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-11.3.1.tgz#6092aea8147ea03873b3f383cceae0390a67f71d"
integrity sha512-q4kFIIHTLvKxM24b0Eo8hJevsPMme+aITJGrDML9BgdZYTRN14+cu5nXiCsQvaEamdyYj+uCXWe2OV9X7pPxsA==
"@polkadot/api@12.0.1", "@polkadot/api@^12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-12.0.1.tgz#3067a0466d9a645a8d3a30a772854dc3eae65fb5"
integrity sha512-l4z2SYTJs9CWab3qKPrmDkNj8+CGRWHgvq50vIxgBBvFKhSBO0TGBoJM5Mf38Tl6kw/3mJzRkKaG23+Y8LW9Rw==
dependencies:
"@polkadot/api-augment" "11.3.1"
"@polkadot/api-base" "11.3.1"
"@polkadot/api-derive" "11.3.1"
"@polkadot/api-augment" "12.0.1"
"@polkadot/api-base" "12.0.1"
"@polkadot/api-derive" "12.0.1"
"@polkadot/keyring" "^12.6.2"
"@polkadot/rpc-augment" "11.3.1"
"@polkadot/rpc-core" "11.3.1"
"@polkadot/rpc-provider" "11.3.1"
"@polkadot/types" "11.3.1"
"@polkadot/types-augment" "11.3.1"
"@polkadot/types-codec" "11.3.1"
"@polkadot/types-create" "11.3.1"
"@polkadot/types-known" "11.3.1"
"@polkadot/rpc-augment" "12.0.1"
"@polkadot/rpc-core" "12.0.1"
"@polkadot/rpc-provider" "12.0.1"
"@polkadot/types" "12.0.1"
"@polkadot/types-augment" "12.0.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/types-create" "12.0.1"
"@polkadot/types-known" "12.0.1"
"@polkadot/util" "^12.6.2"
"@polkadot/util-crypto" "^12.6.2"
eventemitter3 "^5.0.1"
Expand Down Expand Up @@ -1069,14 +1069,14 @@
"@substrate/ss58-registry" "^1.44.0"
tslib "^2.6.2"

"@polkadot/rpc-augment@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-11.3.1.tgz#b589ef5b7ab578cf274077604543071ce9889301"
integrity sha512-2PaDcKNju4QYQpxwVkWbRU3M0t340nMX9cMo+8awgvgL1LliV/fUDZueMKLuSS910JJMTPQ7y2pK4eQgMt08gQ==
"@polkadot/rpc-augment@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-12.0.1.tgz#256dbec4e76c64efda226bf5cb3c807242450f2f"
integrity sha512-mSVjr1aHcNFWq3tPb8Tntp1oFvc42zjurR+VHk0WIdJLkq7hVFO4X8j+Z5qKMomSE0thuhbnZm4Qgya8M9LNKQ==
dependencies:
"@polkadot/rpc-core" "11.3.1"
"@polkadot/types" "11.3.1"
"@polkadot/types-codec" "11.3.1"
"@polkadot/rpc-core" "12.0.1"
"@polkadot/types" "12.0.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/util" "^12.6.2"
tslib "^2.6.2"

Expand All @@ -1091,14 +1091,14 @@
"@polkadot/types-codec" "9.14.2"
"@polkadot/util" "^10.4.2"

"@polkadot/rpc-core@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-11.3.1.tgz#c23e23ee5c403c4edb207d603ae4dc16e69bc710"
integrity sha512-KKNepsDd/mpmXcA6v/h14eFFPEzLGd7nrvx2UUXUxoZ0Fq2MH1hplP3s93k1oduNY/vOXJR2K9S4dKManA6GVQ==
"@polkadot/rpc-core@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-12.0.1.tgz#031398576fd39c77dfec32c27f9e6e691ca34ebc"
integrity sha512-mSAvcUA+skCODKW4tJNR5fzxCmCHFYkLgKE8J3h7poaG1MX4xeSDaquvYFncC2wrhuP2Xxke1UYmFGZlrBq9tQ==
dependencies:
"@polkadot/rpc-augment" "11.3.1"
"@polkadot/rpc-provider" "11.3.1"
"@polkadot/types" "11.3.1"
"@polkadot/rpc-augment" "12.0.1"
"@polkadot/rpc-provider" "12.0.1"
"@polkadot/types" "12.0.1"
"@polkadot/util" "^12.6.2"
rxjs "^7.8.1"
tslib "^2.6.2"
Expand All @@ -1115,14 +1115,14 @@
"@polkadot/util" "^10.4.2"
rxjs "^7.8.0"

"@polkadot/rpc-provider@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-11.3.1.tgz#1d1289bf42d065b5f04f9baa46ef90d96940819e"
integrity sha512-pqERChoHo45hd3WAgW8UuzarRF+G/o/eXEbl0PXLubiayw4X4qCmIzmtntUcKYgxGNcYGZaG87ZU8OjN97m6UA==
"@polkadot/rpc-provider@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-12.0.1.tgz#d56d1d674d5c79a3d1ad27b307601a387859b96d"
integrity sha512-3LyoGIl3lfDFVuajVZMvB+rVh5s2+PujdmHT4GFqH0XZm9tMBNzIT4kdC7VV5Ra728C6c6j1GTNJ0ARvxEPbww==
dependencies:
"@polkadot/keyring" "^12.6.2"
"@polkadot/types" "11.3.1"
"@polkadot/types-support" "11.3.1"
"@polkadot/types" "12.0.1"
"@polkadot/types-support" "12.0.1"
"@polkadot/util" "^12.6.2"
"@polkadot/util-crypto" "^12.6.2"
"@polkadot/x-fetch" "^12.6.2"
Expand Down Expand Up @@ -1155,13 +1155,13 @@
optionalDependencies:
"@substrate/connect" "0.7.19"

"@polkadot/types-augment@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-11.3.1.tgz#1f7f553f0ca6eb8fbc0306901edc045fe18729e1"
integrity sha512-eR3HVpvUmB3v7q2jTWVmVfAVfb1/kuNn7ij94Zqadg/fuUq0pKqIOKwkUj3OxRM3A/5BnW3MbgparjKD3r+fyw==
"@polkadot/types-augment@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-12.0.1.tgz#4f3cbc03d76775dc48417f3a6e74297e142e7c48"
integrity sha512-VwzAUJCLwuVabRFlUQOTgovYHXQdrgHF4Aaqxb4gTQEsaDnpdcGBypy1dS861qROMOlSMySanO82o3N3Nvexfg==
dependencies:
"@polkadot/types" "11.3.1"
"@polkadot/types-codec" "11.3.1"
"@polkadot/types" "12.0.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/util" "^12.6.2"
tslib "^2.6.2"

Expand All @@ -1175,10 +1175,10 @@
"@polkadot/types-codec" "9.14.2"
"@polkadot/util" "^10.4.2"

"@polkadot/types-codec@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-11.3.1.tgz#2767cf482cd49afdd5dce9701615f68ec59cec5e"
integrity sha512-i7IiiuuL+Z/jFoKTA9xeh4wGQnhnNNjMT0+1ohvlOvnFsoKZKFQQOaDPPntGJVL1JDCV+KjkN2uQKZSeW8tguQ==
"@polkadot/types-codec@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-12.0.1.tgz#97f9f470216be2d800e0b6083fba3caa29cf7a78"
integrity sha512-yF4ZOUlxzTMYwWw7CrXyehhQQhXnaojATTPbIDo3PRHKHAiZes1MXR6qHaBU7p/S6EaUPNOKBQmopSVYN+zUVg==
dependencies:
"@polkadot/util" "^12.6.2"
"@polkadot/x-bigint" "^12.6.2"
Expand All @@ -1193,12 +1193,12 @@
"@polkadot/util" "^10.4.2"
"@polkadot/x-bigint" "^10.4.2"

"@polkadot/types-create@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-11.3.1.tgz#3ac2c8283f61555f9e572ca30e3485b95a0a54e2"
integrity sha512-pBXtpz5FehcRJ6j5MzFUIUN8ZWM7z6HbqK1GxBmYbJVRElcGcOg7a/rL2pQVphU0Rx1E8bSO4thzGf4wUxSX7w==
"@polkadot/types-create@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-12.0.1.tgz#e7337808ca0aa089a5594abdbe939d998202b205"
integrity sha512-zPzjRx+AjZk6F5VeAZnEx5ZF5cl0zngp3Ez0HbkM+5Jhh2d+j0dQkfNpf6h26prMTjYItsXMrr1xxWv1GgcFjg==
dependencies:
"@polkadot/types-codec" "11.3.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/util" "^12.6.2"
tslib "^2.6.2"

Expand All @@ -1211,15 +1211,15 @@
"@polkadot/types-codec" "9.14.2"
"@polkadot/util" "^10.4.2"

"@polkadot/types-known@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-11.3.1.tgz#fc34ed29ac2474db6b66805a15d12008226346bb"
integrity sha512-3BIof7u6tn9bk3ZCIxA07iNoQ3uj4+vn3DTOjCKECozkRlt6V+kWRvqh16Hc0SHMg/QjcMb2fIu/WZhka1McUQ==
"@polkadot/types-known@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-12.0.1.tgz#c55d2b1e58c01e9bbd89743aca1434568ad308e0"
integrity sha512-8VVSy9MthWNqzCQMPLR02GlJhYb4H7SlAk5/9OdAAuoA86svFItQTaKyfUGC26I3uaKtS3/8RgPo3SihJgPHEQ==
dependencies:
"@polkadot/networks" "^12.6.2"
"@polkadot/types" "11.3.1"
"@polkadot/types-codec" "11.3.1"
"@polkadot/types-create" "11.3.1"
"@polkadot/types" "12.0.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/types-create" "12.0.1"
"@polkadot/util" "^12.6.2"
tslib "^2.6.2"

Expand All @@ -1235,10 +1235,10 @@
"@polkadot/types-create" "9.14.2"
"@polkadot/util" "^10.4.2"

"@polkadot/types-support@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-11.3.1.tgz#dee02a67784baa13177fe9957f5d8d62e8a7e570"
integrity sha512-jTFz1GKyF7nI29yIOq4v0NiWTOf5yX4HahJNeFD8TcxoLhF+6tH/XXqrUXJEfbaTlSrRWiW1LZYlb+snctqKHA==
"@polkadot/types-support@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-12.0.1.tgz#a5b65fe351a26348973a9bf019b3645be4637510"
integrity sha512-5Y5rTmgG0XSPIQR32+fdtvhU+VzahCs+vGnU9yuvT570aLHVqu0nNHRQa/uOtpLcHwgjZPr3ljOgAo0ViaL1UA==
dependencies:
"@polkadot/util" "^12.6.2"
tslib "^2.6.2"
Expand All @@ -1251,15 +1251,15 @@
"@babel/runtime" "^7.20.13"
"@polkadot/util" "^10.4.2"

"@polkadot/types@11.3.1":
version "11.3.1"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-11.3.1.tgz#bab61b701218158099e3f548d20efc27cbf1287f"
integrity sha512-5c7uRFXQTT11Awi6T0yFIdAfD6xGDAOz06Kp7M5S9OGNZY28wSPk5x6BYfNphWPaIBmHHewYJB5qmnrdYQAWKQ==
"@polkadot/types@12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-12.0.1.tgz#800593a91ec752c43fb23c8e606ae923db59f315"
integrity sha512-4R3hwlMMThdF43DmbWnZTh2nQ1VwBJxKNx5mr7Pq8FereepW62W+1TkwcdekPtPZ+PmcbjmKxzt7JNmiXxjf+w==
dependencies:
"@polkadot/keyring" "^12.6.2"
"@polkadot/types-augment" "11.3.1"
"@polkadot/types-codec" "11.3.1"
"@polkadot/types-create" "11.3.1"
"@polkadot/types-augment" "12.0.1"
"@polkadot/types-codec" "12.0.1"
"@polkadot/types-create" "12.0.1"
"@polkadot/util" "^12.6.2"
"@polkadot/util-crypto" "^12.6.2"
rxjs "^7.8.1"
Expand Down

0 comments on commit bf9d7d1

Please sign in to comment.