Giter Site home page Giter Site logo

Comments (7)

tad3j avatar tad3j commented on June 7, 2024 1

Could #5791 be responsible for this error?
Expected Option<*> definition for accountId in ContractEnvironment
I started getting this today with this new version but it works in old one so it seems like a breaking change?

from api.

tad3j avatar tad3j commented on June 7, 2024 1

It's failing on line marked bellow (old version of code) when parsing this abi.
image

Code:

const contract = new PinkContractPromise(
      this.api,
      this.registry,
      contractAbi,
      contractAddress,
      contractKey,
    );
const keyring = new Keyring({ type: 'sr25519' });
const account = keyring.addFromUri('//Alice');
const certificate = await signCertificate({ api: this.api, pair: account });
onst response = await contract.query.encryptContent(
      account.address,
      {
        cert: certificate,
      },
      content,
    );
return response.output.toJSON()['ok'].ok;

from api.

tad3j avatar tad3j commented on June 7, 2024 1

I'm using @phala/sdk. They've said they dont support ink v5 so maybe that's why it didn't work.

EDIT: I've completely removed phala but TX signing is still failing.

from api.

peetzweg avatar peetzweg commented on June 7, 2024

@tad3j Feels unlikely to me but not impossible. Could you share some code and steps to reproduce this? In which context is this happening?

from api.

peetzweg avatar peetzweg commented on June 7, 2024

@tad3j I was able to instantiate a ContractPromise instance without a problem with the latest pjs version.

Here is my code:

import { ApiPromise, WsProvider } from "@polkadot/api";
import { ContractPromise } from "@polkadot/api-contract";
import abi from "./abi.json";

const wsProvider = new WsProvider(`wss://rococo-contracts-rpc.polkadot.io`);
const api = await ApiPromise.create({
  provider: wsProvider,
});
const address = "5EnufwqqxnkWT6hc1LgjYWQGUsqQCtcr5192K2HuQJtRJgCi";

try {
  const contract = new ContractPromise(api, abi, address);
  console.log({ environment: contract.abi.environment });
} catch (error) {
  console.error("Initializing contract error", error);
}

process.exit(0);

You could run it by i.e npx tsx abi.ts

Not sure what the PinkContractPromise is about in your code. Maybe you are using some sort of wrapper library?

from api.

tad3j avatar tad3j commented on June 7, 2024

Strange, maybe it's issue with Phala SDK...will check.

Locking to "@polkadot/types": "10.11.3", (version we used before) fixes the issue.

from api.

peetzweg avatar peetzweg commented on June 7, 2024

@tad3j can you share which sdk you are using? Sounds reasonable that it might cause issues with sdks building ontop of pjs. They have probably not yet upgraded their sdk and this could cause hiccups.

from api.

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.