Skip to content

Commit

Permalink
Add ODIS quota check and top-up
Browse files Browse the repository at this point in the history
  • Loading branch information
viral-sangani committed Nov 18, 2023
1 parent 697daaa commit f3ab5d2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/react-app/SocialConnect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class SocialConnectIssuer {
// Method to get obfuscated ID
async getObfuscatedId(plaintextId: string, identifierType: IdentifierPrefix) {
// Fetch the obfuscated identifier using OdisUtils
await this.checkAndTopUpODISQuota();
const { obfuscatedIdentifier } =
await OdisUtils.Identifier.getObfuscatedIdentifier(
plaintextId,
Expand All @@ -73,15 +74,13 @@ export class SocialConnectIssuer {
if (remainingQuota < 1) {
const approvalTxReceipt = (
await this.stableTokenContract.increaseAllowance(
this.odisPaymentsContract.address,
ODIS_PAYMENTS_PROXY_ADDRESS,
ONE_CENT_CUSD
)
).wait();
const walletAddress = await this.wallet.getAddress();
const odisPaymentTxReceipt = (
await this.odisPaymentsContract.payInCUSD(
this.wallet.address,
ONE_CENT_CUSD
)
await this.odisPaymentsContract.payInCUSD(walletAddress, ONE_CENT_CUSD)
).wait();
}
}
Expand Down

0 comments on commit f3ab5d2

Please sign in to comment.