Skip to content

Commit

Permalink
fix: wallet not being set (user is not created)
Browse files Browse the repository at this point in the history
  • Loading branch information
whilefoo committed Feb 16, 2025
1 parent db4a6cd commit b67dd22
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/adapters/supabase/helpers/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export class Wallet extends Super {
public async upsertWalletAddress(context: Context, address: string) {
const payload = context.payload;

let userData = await this._checkIfUserExists(payload.sender.id);
if (!userData) {
userData = await this._registerNewUser(payload.sender);
}

const registeredWalletData = await this._getRegisteredWalletData(address);

if (!registeredWalletData) {
Expand Down Expand Up @@ -76,15 +81,6 @@ export class Wallet extends Super {
return data as UserRow;
}

private async _getUserData(payload: Context["payload"]) {
let userData = await this._checkIfUserExists(payload.sender.id);
if (!userData) {
const user = payload.sender;
userData = await this._registerNewUser(user);
}
return userData;
}

private async _registerNewUser(user: Context["payload"]["sender"]) {
const { data: userData, error: userError } = await this.supabase
.from("users")
Expand Down

0 comments on commit b67dd22

Please sign in to comment.