Skip to content

fix: fix incentive initialize failed #525

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.1.9-13",
"version": "4.1.12",
"private": true,
"engines": {
"node": ">=16"
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/sdk-core",
"version": "4.1.11",
"version": "4.1.12",
"description": "the core of acala network sdk",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-homa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/sdk-homa",
"version": "4.1.11",
"version": "4.1.12",
"description": "the homa sub module in acala network sdk",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-loan/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/sdk-loan",
"version": "4.1.11",
"version": "4.1.12",
"description": "the loan sub module in acala network sdk",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-payment/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/sdk-payment",
"version": "4.1.11",
"version": "4.1.12",
"description": "the payment acala network sdk",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-swap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/sdk-swap",
"version": "4.1.11",
"version": "4.1.12",
"description": "the swap sub module in acala network sdk",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/sdk",
"version": "4.1.11",
"version": "4.1.12",
"description": "acala network sdk",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
Expand Down
9 changes: 7 additions & 2 deletions packages/sdk/src/incentive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@ export class Incentive implements BaseSDK {
);
});

// subscribe all pool infomations
// subscribe all pool information
private poolInfos$ = memoize((): Observable<BaseIncentivePool[]> => {
return this.storages.poolInfos().observable.pipe(
map((data) => {
// omit NomineesElection
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return data.filter((item) => !(item[0].args[0] as unknown as any).isNomineesElection);
}),
map((data) => {
const allRewardTokens = data.flatMap((item) =>
Array.from(item[1].rewards.entries()).map(([key]) => forceToCurrencyName(key))
Expand All @@ -129,7 +134,7 @@ export class Incentive implements BaseSDK {
const collateral = tokens[forceToCurrencyName(getPoolToken(raw))];
const totalShares = FixedPointNumber.fromInner(item[1].totalShares.toString(), collateral.decimals);

// format rewards infomations
// format rewards information
const rewards: IncentiveReward[] = Array.from(item[1].rewards.entries()).map(([key, values]) => {
const token = tokens[forceToCurrencyName(key)];
const total = FixedPointNumber.fromInner(values[0].toString(), token.decimals);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export function getDeductionEndtimeConfigs(
let call: CallFunction | null = null;

try {
call = api.registry.createType('Call', data.asInline.toHex()) as unknown as CallFunction;
if (data.isInline) {
call = api.registry.createType('Call', data.asInline.toHex()) as unknown as CallFunction;
}
} catch (error) {
console.error(error);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/wormhole-portal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/wormhole-portal",
"version": "4.1.11",
"version": "4.1.12",
"description": "the wormhole wrapper for acala/karura network",
"author": "Acala Developers <[email protected]>",
"license": "Apache-2.0",
Expand Down
Loading