GithubHelp home page GithubHelp logo

near-drop-demo's Introduction



Linkdrop example with contract account deployment

About the app

The app allows you to send funds to the Linkdrop contract which will create "Drops". You will have a list of these in local storage and you can remove them at any time. This claims the funds back to your current account.

NOTE: If you follow the wallet link of a drop, be warned it will not create accounts because your contract is not eligible to create the .testnet domain accounts.

Instead, click "Share Drop Link" and visit your own drop.

You will now see a URL Drop heading with some information about the drop. This is what another user would see if they used your URL.

You can either:

  1. claim the funds
  2. create an account
  3. create a contract account (deploys a locked multisig account)

Contract

For more details on the linkdrop contract: https://github.com/near/near-linkdrop

Quickstart

yarn && yarn dev

Deploying your own contract

It's recommended you create a sub account to handle your contract deployments:

near login
near create_account [account_id] --masterAccount [your_account_id] --initialBalance [1-5 N]

Now update config.js and set:

const CONTRACT_NAME = [account_id]

The Linkdrop contract and calling it from JS

All calls to the contract can be found in src/Drops.js.

The original linkdrop contract is here: https://github.com/nearprotocol/near-linkdrop

An additional function is added to the regular linkdrop contract:

pub fn create_limited_contract_account

This takes 3 additional arguments over the existing pub fn create_account_and_claim function. In order to successfully invoke from JS you must pass in the following:

new_account_id: string,
new_public_key: string,
allowance: string,
contract_bytes: [...new Uint8Array(contract_bytes)],
method_names: [...new Uint8Array(new TextEncoder().encode(`
    methods,account,is_limited_too_call
`))]
IMPORTANT: Make sure you have the latest version of NEAR Shell and Node Version > 10.x
  1. Node.js
  2. near-shell
npm i -g near-shell

To run on NEAR testnet

yarn && yarn dev

near-drop-demo's People

Contributors

mattlockyer avatar vgrichina avatar kcole16 avatar chadoh avatar janedegtiareva avatar volovyks avatar chefsale avatar heroes-bounty[bot] avatar

Stargazers

Matej Vukosav avatar Vladimir Podolyan avatar Noe avatar Ryan Strawser avatar Seungwon Choi avatar coldyjudgy avatar  avatar

Watchers

 avatar  avatar James Cloos avatar Bo Yao avatar  avatar

near-drop-demo's Issues

Security Policy violation SECURITY.md

This issue was automatically created by Allstar.

Security Policy Violation
Security policy not enabled.
A SECURITY.md file can give users information about what constitutes a vulnerability and how to report one securely so that information about a bug is not publicly visible. Examples of secure reporting methods include using an issue tracker with private issue support, or encrypted email with a published key.

To fix this, add a SECURITY.md file that explains how to handle vulnerabilities found in your repository. Go to https://github.com/near/near-drop-demo/security/policy to enable.

For more information, see https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository.


This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

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.