Skip to content

Commit

Permalink
Merge pull request #48 from ubiquity-whilefoo/wallet-fix
Browse files Browse the repository at this point in the history
fix: wallet not being set (user is not created)
  • Loading branch information
whilefoo authored Feb 16, 2025
2 parents db4a6cd + 190afab commit a0dde2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

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 a0dde2c

Please sign in to comment.