Skip to content

Commit bcfb7ee

Browse files
api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 14.3.1
1 parent 4ea0f08 commit bcfb7ee

File tree

18 files changed

+46
-21
lines changed

18 files changed

+46
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## master
44

5+
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 14.3.1
56
- hw-{ledger, ledger-transports}, keyring, networks, util, util-crypto, x-{bigint, fetch, global, randomvalues, textdecoder, textencoder, ws} 13.2.3
67
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 14.2.3
78
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 14.2.2

api-augment/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.2.3' };
3+
export const packageInfo = { name: '@polkadot/api-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.3.1' };

api-base/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-base', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.2.3' };
3+
export const packageInfo = { name: '@polkadot/api-base', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.3.1' };

api-contract/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-contract', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.2.3' };
3+
export const packageInfo = { name: '@polkadot/api-contract', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.3.1' };

api-derive/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-derive', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.2.3' };
3+
export const packageInfo = { name: '@polkadot/api-derive', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.3.1' };

api-derive/staking/stakerRewards.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ function parseRewards (api: DeriveApi, stashId: AccountId, [erasPoints, erasPref
8181
return {
8282
era,
8383
eraReward,
84+
// This might not always be accurate as you need validator account information in order to see if the rewards have been claimed.
85+
// This is possibly adjusted in `filterRewards` when need be.
8486
isClaimed: claimedRewardsEras.some((c) => c.eq(era)),
8587
isEmpty,
8688
isValidator,
@@ -148,12 +150,26 @@ function filterRewards (eras: EraIndex[], valInfo: [string, DeriveStakingQuery][
148150
return true;
149151
})
150152
.filter(({ validators }) => Object.keys(validators).length !== 0)
151-
.map((reward) =>
152-
objectSpread({}, reward, {
153-
isClaimed: filter.some((f) => reward.era.eq(f)),
153+
.map((reward) => {
154+
let isClaimed = reward.isClaimed;
155+
const valKeys = Object.keys(reward.validators);
156+
157+
if (!reward.isClaimed && valKeys.length) {
158+
for (const key of valKeys) {
159+
const info = queryValidators.find((i) => i.accountId.toString() === key);
160+
161+
if (info) {
162+
isClaimed = info.claimedRewardsEras.toArray().some((era) => era.eq(reward.era));
163+
break;
164+
}
165+
}
166+
}
167+
168+
return objectSpread({}, reward, {
169+
isClaimed,
154170
nominators: reward.nominating.filter((n) => reward.validators[n.validatorId])
155-
})
156-
);
171+
});
172+
});
157173
}
158174

159175
export function _stakerRewardsEras (instanceId: string, api: DeriveApi): (eras: EraIndex[], withActive?: boolean) => Observable<ErasResult> {

api/base/Decorate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
150150
this._rpcCore = new RpcCore(this.#instanceId, this.#registry, {
151151
isPedantic: this._options.isPedantic,
152152
provider,
153+
rpcCacheCapacity: this._options.rpcCacheCapacity,
153154
userRpc: this._options.rpc
154155
}) as (RpcCore & RpcInterface);
155156
this._isConnected = new BehaviorSubject(this._rpcCore.provider.isConnected);

api/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.2.3' };
3+
export const packageInfo = { name: '@polkadot/api', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.3.1' };

api/types/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export interface ApiOptions extends RegisteredTypes {
6767
* @description User-defined RPC methods
6868
*/
6969
rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
70+
/**
71+
* @description Defines the size of the cache for the rpc-core. Defaults to 1024 * 10 * 10.
72+
*/
73+
rpcCacheCapacity?: number;
7074
/**
7175
* @description Overrides for state_call usage (this will be removed in some future version)
7276
*/

rpc-augment/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/rpc-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.2.3' };
3+
export const packageInfo = { name: '@polkadot/rpc-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.3.1' };

0 commit comments

Comments
 (0)