Skip to content

Commit

Permalink
fix: fix channel.update
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman035 committed Jan 3, 2024
1 parent 40e5941 commit 4bccf07
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions packages/restapi/src/lib/pushNotification/pushNotificationBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,13 @@ export class PushNotificationBaseClass {
const pushSigner = new Signer(this.signer);
try {
if (pushSigner.isViemSigner(this.signer)) {
const balanceInBigInt = await contract.read.balanceOf({
args: [userAddress],
});
balance = BigInt(balanceInBigInt);
balance = BigInt(
await contract.read.balanceOf({
args: [userAddress],
})
);
} else {
balance = await contract.balanceOf(userAddress);
balance = BigInt(await contract.balanceOf(userAddress));
}
return balance;
} catch (err) {
Expand All @@ -347,12 +348,15 @@ export class PushNotificationBaseClass {
let allowance: bigint;
try {
if (!pushSigner.isViemSigner(this.signer)) {
allowance = await contract!['allowance'](userAddress, spenderAddress);
allowance = BigInt(
await contract!['allowance'](userAddress, spenderAddress)
);
} else {
const allowanceInBigInt = await contract.read.allowance({
args: [userAddress, spenderAddress],
});
allowance = BigInt(allowanceInBigInt);
allowance = BigInt(
await contract.read.allowance({
args: [userAddress, spenderAddress],
})
);
}
return allowance;
} catch (error) {
Expand All @@ -368,12 +372,13 @@ export class PushNotificationBaseClass {
const pushSigner = new Signer(this.signer);
try {
if (!pushSigner.isViemSigner(this.signer)) {
count = await contract!['channelUpdateCounter'](userAddress);
count = BigInt(await contract!['channelUpdateCounter'](userAddress));
} else {
const countInBigInt = await contract.read.channelUpdateCounter({
args: [userAddress],
});
count = BigInt(countInBigInt);
count = BigInt(
await contract.read.channelUpdateCounter({
args: [userAddress],
})
);
}
// add one and return the count
return count + BigInt(1);
Expand Down

0 comments on commit 4bccf07

Please sign in to comment.