Skip to content
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

fix: fix deprecation warn #801

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export type SubscriptionOptions = {
};
export type ChannelInfoOptions = {
channel?: string;
page?: number;
limit?: number;
};

export type SubscribeUnsubscribeOptions = {
Expand Down
21 changes: 13 additions & 8 deletions packages/restapi/src/lib/pushNotification/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import { Delegate } from './delegate';
import { Alias } from './alias';

export class Channel extends PushNotificationBaseClass {
public delegate!: Delegate
public alias!: Alias
public delegate!: Delegate;
public alias!: Alias;
constructor(signer?: SignerType, env?: ENV, account?: string) {
super(signer, env, account);
this.delegate = new Delegate(signer, env, account)
this.delegate = new Delegate(signer, env, account);
this.alias = new Alias(env!);
}

Expand Down Expand Up @@ -93,9 +93,11 @@ export class Channel extends PushNotificationBaseClass {
if (!validateCAIP(channel!)) {
throw new Error('Invalid CAIP');
}
return await PUSH_CHANNEL._getSubscribers({
return await PUSH_CHANNEL.getSubscribers({
channel: channel!,
env: this.env,
page: options?.page,
limit: options?.limit,
});
} catch (error) {
throw new Error(`Push SDK Error: API : channel::subscribers : ${error}`);
Expand Down Expand Up @@ -257,12 +259,15 @@ export class Channel extends PushNotificationBaseClass {
);
const balance = await this.fetchBalance(pushTokenContract, this.account!);
// get counter
const counter = await this.fetchUpdateCounter(this.coreContract, this.account!);
const counter = await this.fetchUpdateCounter(
this.coreContract,
this.account!
);
const fees = ethers.utils.parseUnits(
config.MIN_TOKEN_BALANCE[this.env!].toString(),
18
);
const totalFees = fees.mul(counter)
const totalFees = fees.mul(counter);
if (totalFees.gte(balance)) {
throw new Error('Insufficient PUSH balance');
}
Expand Down Expand Up @@ -353,8 +358,8 @@ export class Channel extends PushNotificationBaseClass {
throw new Error('Invalid channel address');
}
const channelDetails = await this.info(this.account);
if(channelDetails?.verified_status == 0){
throw new Error("Only verified channel can verify other channel")
if (channelDetails?.verified_status == 0) {
throw new Error('Only verified channel can verify other channel');
}
// if valid, continue with it
const res = await this.verifyChannel(
Expand Down