From dc3376ce541ba6b60256b5dec3bb7999430279bb Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Wed, 4 Sep 2024 11:09:03 -0700 Subject: [PATCH] Add createUserBankIfNeeded call to trending rewards bug --- .../trending-challenge-rewards/src/app.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/app.ts b/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/app.ts index 6ada7cabd9b..06faa137eb6 100644 --- a/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/app.ts +++ b/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/app.ts @@ -206,9 +206,9 @@ const getAllChallenges = async ( console.log(`Found ${toDisburse.length} trending challenges to disburse`) let possibleNodeSet: string[] = [] - let possibleChallenges = [] - let impossibleChallenges = [] - let setToChallengeMap = new Map() + const possibleChallenges = [] + const impossibleChallenges = [] + const setToChallengeMap = new Map() for (const challenge of toDisburse) { console.log(`Trying challenge: ${JSON.stringify(challenge)}`) @@ -287,7 +287,18 @@ const getAllChallenges = async ( const encodedUserId = challenge.user_id.toString() const rewards = libs.Rewards - if (rewards === null) throw new Error('rewards object null') + if (rewards === null) { + throw new Error('rewards object null') + } + const solanaWeb3Manager = libs.solanaWeb3Manager + if (solanaWeb3Manager === null) { + throw new Error('solana web3manager not defined') + } + + await solanaWeb3Manager.createUserBankIfNeeded({ + feePayerOverride, + ethAddress: challenge.wallet + }) const args = { challengeId: challenge.challenge_id,