Giter VIP home page Giter VIP logo

Comments (2)

ascjones avatar ascjones commented on June 27, 2024

Can you show the code you are using to deploy the contract?

from canvas.

naps62 avatar naps62 commented on June 27, 2024

It seems this is now working. Not sure what I changed, other than the fact that I was tired yesterday, from trying around random things in desperation.

This version is currently working. I just need to understand a bit more how the endowment works, since these values were put at random to see what sticks, but at least the deploy itself is working

(I'm building this deploy script while cargo contract deploy isn't working, and also so that I can learn how these pieces work

const { ApiPromise, WsProvider } =require("@polkadot/api");
const { Keyring } = require("@polkadot/keyring");
const { createTestKeyring } = require("@polkadot/keyring/testing");
const { CodePromise } = require("@polkadot/api-contract");
const fs = require("fs");

const ABI = require("../contracts/hello/target/ink/metadata.json");
const WASM = fs.readFileSync("../contracts/hello/target/ink/world.wasm");

(async() => {
  const provider = new WsProvider("ws://127.0.0.1:9944");
  const api = await ApiPromise.create({ provider });

  const keyring = new Keyring({ type: 'sr25519', ss58Format: 42 });
  const alice = keyring.addFromUri('//Alice', { name: 'Alice' });
  const account = (await createTestKeyring().getPairs())[0];

  const code = new CodePromise(api, ABI, WASM)

  code.tx.default({ gasLimit: 100000 * 1000000, salt: null, value: 2230000000000000 })
  .signAndSend(alice, (result) => {
    if (result.status.isInBlock || result.status.isFinalized) {
      // here we have an additional field in the result, containing the blueprint
      blueprint = result.blueprint;
    }
  })
})()

from canvas.

Related Issues (20)

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.