Coder Social home page Coder Social logo

tarasenkofirelabs / wallet-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from metaseth/wallet-example

0.0 0.0 0.0 1.58 MB

This example demonstrates how to integrate your application with NEAR Wallet.

License: MIT License

JavaScript 62.06% TypeScript 18.56% HTML 9.23% CSS 10.14%

wallet-example's Introduction

Example of NEAR Wallet integration

Open in Gitpod

This example demonstrates how to integrate your application with NEAR Wallet. The contract is quite simple. It can store the account_id of last sender and return it. It also shows how you can debug contracts using logs.

Getting started

There are two ways to run this project. The first is the quick and a good way to instantly become familiar with this example. Once familiar, the next step is for a developer to create their own NEAR account and deploy the contract to testnet. This is covered in the following section.

There's a button at the top of this file that says "Open in Gitpod." This will open the project in a new tab with an integrated development environment. The other option is to clone this repository and follow the same instructions.

Quickest option

  1. Install dependencies:
yarn --frozen-lockfile
  1. Build and deploy this smart contract to a development account. This development account will be created automatically and is not intended for reuse:
yarn dev

Your command line which will display a link to localhost similar to:

Server running at http://localhost:1234

Please open that link your browser to continue and see how to log in with NEAR Wallet in a simple webapp.

Standard deploy option

In this second option, the smart contract will get deployed to a specific account created with the NEAR Wallet.

  1. Ensure near-cli is installed by running:
near --version

If needed, install near-cli:

npm install near-cli -g
  1. If you do not have a NEAR account, please create one with NEAR Wallet.

In the project root, login with near-cli by following the instructions after this command:

near login
  1. Modify the top of src/config.js, changing the CONTRACT_NAME to be the NEAR account that was just used to log in.

const CONTRACT_NAME = process.env.CONTRACT_NAME || 'YOUR_ACCOUNT_NAME_HERE'; /* TODO: fill this in! */
  1. Start the example!
yarn start

To Test

yarn asp // as-pect tests
yarn jest // integration tests
yarn test // both

To Explore

  • assembly/main.ts for the contract code
  • src/index.html for the front-end HTML
  • src/main.js for the JavaScript front-end code and how to integrate contracts
  • src/test.js for the JS tests for the contract

Data collection

By using Gitpod in this project, you agree to opt-in to basic, anonymous analytics. No personal information is transmitted. Instead, these usage statistics aid in discovering potential bugs and user flow information.

wallet-example's People

Contributors

behaviary avatar bucanero avatar chadoh avatar dependabot-preview[bot] avatar dependabot[bot] avatar janedegtiareva avatar mikedotexe avatar ninolipartiia4ire avatar tarasenkofirelabs avatar thisisjoshford avatar vgrichina avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.