Inspiration

In order for the Near protocol to acquire web2 users, the Near protocol must be able to smoothly link to the existing web2 site. I thought that the chrome extension was very suitable for this, and I set a goal to link the near protocol to Youtube, the most famous web2 site.

What it does

Using the Chrome extension, it is possible to add or delete elements to the site the user is viewing. We used this near attacher to collect the title, channel ID, and channel information of the YouTube video currently being watched and insert a form element that can transmit NEAR. When the button is pressed by entering the amount and message in this form element, redirection for transaction signing is made to the near web wallet using near-api-js.

If the channel owner to receive NEAR does not yet have a near account, it is okay. We store the received NEAR in the contract using the corresponding channel ID as a key, and later, when the channel owner links the channel ID with his/her near account through OAuth authentication, all NEAR accumulated so far is transferred to the near account.

How we built it

We made a product that can work in chrome extension through react. This product is designed to work only when the domain is youtube.com. Also, the near contract was written in javascript through js-sdk.

Challenges we ran into

In the process of integrating the near web wallet,We learned late that the payable function can only be called with the full access key.

Accomplishments that we're proud of

We are proud to be able to integrate Near Protocol with popular Web2 sites. Also, we are proud that we were able to write contracts through js-sdk.

What we learned

In the process of interworking with near web wallet, we looked at all the codes of near-api-js, near-sdk-js, near-wallet-selector, near-web-wallet, and ref finance-ui. In the future, I would like to reduce the trial and error of other developers by writing about the process of wallet integration, calling a function, and signing with a full access key.

What's next for Near Attacher

We will connect not only Youtube, but also Facebook, Twitter, and all other OAuth-based sites. We will expand the assets that can be transferred. Users will be able to transfer NEP-141 tokens, NFTs, etc. to the owner of the contents on any site through the Near Attacher.

Built With

Share this project:

Updates