MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / createRewardedAd

Function createRewardedAd

src/lib/adRewards.js:186–206  ·  view source on GitHub ↗
(offer, step, sessionId)

Source from the content-addressed store, hash-verified

184}
185
186async function createRewardedAd(offer, step, sessionId) {
187 if (!admob?.RewardedAd) {
188 throw new Error("Rewarded ads are not available in this build.");
189 }
190
191 const userId = await getRewardIdentity();
192 const customData = [
193 `session=${sessionId}`,
194 `offer=${offer.id}`,
195 `step=${step}`,
196 `ads=${offer.adsRequired}`,
197 ].join("&");
198
199 return new admob.RewardedAd({
200 adUnitId: adUnitIdRewarded,
201 serverSideVerification: {
202 userId,
203 customData,
204 },
205 });
206}
207
208function waitForRewardedResult(ad) {
209 return new Promise((resolve, reject) => {

Callers 1

showRewardedStepFunction · 0.85

Calls 1

getRewardIdentityFunction · 0.85

Tested by

no test coverage detected