Coder Social home page Coder Social logo

contract-dev-issues's Introduction

NEAR Protocol Contract development issues

Issues:

  1. Task: Create an account via RPC (Remote Procedural Calls) and deploy a contract on the account and initialise the contract.

Issue: Account gets created, the contract is deployed successfully but the function call gives a deserialization error Log: "Error while deserilalizing the module"

  1. Task: Delete the previously created account via RPCs

Issue: I tried the following 3 approaches to do this task, (but none of them worked giving an "ActorNoPermission" error)

1.  Revoking the access-key of the sub account and then deleting the account.

2.  Deleting the account without revoking the access key of the sub account.

3.  Creating and deleting the account in one promise itself.

Log: Sample Transaction link: https://explorer.testnet.near.org/transactions/5WgGzPmCnUWUWeSEktfAEoLmhyyemTkZyA4d5WwXHYm7

Contract

// ------------------------------------
// contract initialization
// ------------------------------------

/**
 * initialize contract with owner ID and other config data
 *
 * (note: this method is called "constructor" in the singleton contract code)
 */
function init(owner: AccountId, allow_anonymous: bool = true): void;

// ------------------------------------
// public methods
// ------------------------------------

/**
 * the method creating an account and deploying contract via RPCs
 */
function log(): void;

Usage

Development

To deploy the contract for development, follow these steps:

  1. Clone this repo locally.
  2. Run yarn to install dependencies.
  3. Run yarn dev-dep to deploy the contract (this uses near dev-deploy).
  4. Run export CONTRACT=<the ID of your dev account>.
  5. You can also deploy the contract to a specified account by using yarn dep.
  6. Execute this command for initiliazing the contract
 near call $CONTRACT init '{"owner":"'$CONTRACT'"}' --accountId $CONTRACT

Your contract is now ready to use.

To use the contract you can do any of the following:

Public commands

  • Command description

    near call $CONTRACT <function name> <'{"key": "value>"}'> --accountId <your account ID>

Owner commands

  • Command description

    near call $CONTRACT <function name> <'{"key": "value>"}'> --accountId <your account ID>

contract-dev-issues's People

Contributors

vibhurai avatar

Watchers

 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.