Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coinzilla Bid Adapter : add Web3 detection signal #12344

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion modules/coinzillaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,28 @@ export const spec = {
const sizes = parseSizesInput(bidRequest.params.size || bidRequest.sizes)[0];
const width = sizes.split('x')[0];
const height = sizes.split('x')[1];
let installed_wallet = '';
if (typeof window.ethereum !== 'undefined' || (typeof window.web3 !== 'undefined')) {
installed_wallet = "ETH";
}
if ((typeof window.cardano !== 'undefined')) {
installed_wallet = "ADA";
}
if ((typeof window.BinanceChain !== 'undefined')) {
installed_wallet = "BNB";
}
if ((typeof window.solana !== 'undefined')) {
installed_wallet = "SOL";
}
if ((typeof window.tron !== 'undefined')) {
installed_wallet = "TRX";
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, it appears this detection is very similar to

eth: typeof window != 'undefined' && !!window.ethereum,

Any chance you could move both detection routines into a utility in /libraries/crypto/index.js ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @patmmccann, we'd love to keep them at this moment as it is to see if there's traction with the web3 targeting.

Our ad codes are already up and running with this targeting on Coinzilla and that's why we'd love to have it available on our Prebid adapter as soon as possible too.

PS: Thank you @ChrisHuie for hinting the linter errors, we didn't changed any other logic, we just added the wallet detection, that's why we don't have unit testing on Prebid.

Our detection is already live at https://coinzillatag.com/lib/display.js

Cheers!

const payload = {
placementId: bidRequest.params.placementId,
width: width,
height: height,
bidId: bidRequest.bidId,
// TODO: is 'page' the right value here?
wd: installed_wallet,
referer: bidderRequest.refererInfo.page,
};
return {
Expand Down