Giter Site home page Giter Site logo

casper-contracts-js-clients's People

Contributors

bufo24 avatar hoffmannjan avatar ipopescu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

casper-contracts-js-clients's Issues

ERC20 Transfer function returns "Invalid Param"

Calling with a publicKey hex

const deployHash = await erc20.transfer(
  KEYS, // Key pair used for signing
  receiverPublicKey, // Receiver public key
  "2000000000", // Amount to transfer
  "10000000000000" // Payment amount
);

Like

const deployHash = await erc20.transfer(
      keys,
      CLPublicKey.fromHex(account),
      amount.toString(),
      '10000000000',
)

Returns

/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/Error.js:24
        var _this = _super.call(this, message) || this;
                           ^
JSONRPCError: Invalid params
    at new JSONRPCError (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/Error.js:24:28)
    at Object.exports.convertJSONToRPCError (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/Error.js:37:16)
    at TransportRequestManager.processResult (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/transports/TransportRequestManager.js:91:31)
    at TransportRequestManager.resolveRes (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/transports/TransportRequestManager.js:113:18)
    at TransportRequestManager.resolveResponse (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/transports/TransportRequestManager.js:53:25)
    at HTTPTransport.<anonymous> (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:112:68)
    at step (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:46:23)
    at Object.next (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:27:53)
    at fulfilled (/mnt/b/projects/uniswap-scripts/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:18:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: -32602,
  data: null
}

Manual Casper Client calls with the same account information work fine. It seems like there's probably an issue with how the public key is being sent.

install_payment_amount is too low

The INSTALL_PAYMENT_AMOUNT value that is defined in .env.cep47.example is too low to meet the wasm.opcode_costs for Testnet. If a user tries to install the contract, using the default amount specified in .env.cep47.example, they will receive this (confusing) error message:
Error: Contract execution: Out of gas error
at getDeploy (./casper-contracts-js-clients/e2e/utils.ts:38:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async test (./casper-contracts-js-clients/e2e/cep47/install.ts:69:3)

After increasing this amount, the contract was successfully installed. The total CSPR required for this was: 129.38669. Please increase the INSTALL_PAYMENT_AMOUNT with a buffer above this value.

Keys library is out of date

import {
  CasperServiceByJsonRPC,
  CLValue,
  CLMap,
  CLValueParsers,
  CLValueBuilder,
  CLKey,
  CLAccountHash,
  Keys,
  CLPublicKey,
  RuntimeArgs,
  CasperClient,
  DeployUtil,
  CLURef,
  CLTypeTag
} from "casper-js-sdk";

Keys from the casper-js-sdk no longer work, library needs to be rebuilt with latest casper-js-sdk.

Installing Erc20 contract is giving error

TypeError: Could not serialize 'object': expected 'e', got 'e'.
    at Serializer.convertSingleValue (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:153:31)
    at TypedJSON.toPlainJson (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/parser.ts:463:36)
    at Object.k [as serializer] (/home/hammad/work/casper-contracts-js-clients/node_modules/casper-js-client-helper/node_modules/casper-js-sdk/dist/lib.node.js:1:72434)
    at /home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:245:48
    at Map.forEach (<anonymous>)
    at convertAsObject (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:241:32)
    at Serializer.convertSingleValue (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:166:20)
    at /home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:260:41
    at Map.forEach (<anonymous>)
    at convertAsObject (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:241:32)
TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at Object.k [as serializer] (/home/hammad/work/casper-contracts-js-clients/node_modules/casper-js-client-helper/node_modules/casper-js-sdk/dist/lib.node.js:1:72463)
    at /home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:245:48
    at Map.forEach (<anonymous>)
    at convertAsObject (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:241:32)
    at Serializer.convertSingleValue (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:166:20)
    at /home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:260:41
    at Map.forEach (<anonymous>)
    at convertAsObject (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:241:32)
    at Serializer.convertSingleValue (/home/hammad/work/casper-contracts-js-clients/node_modules/typedjson/src/serializer.ts:166:20)
(node:22154) UnhandledPromiseRejectionWarning: Error: Invalid params
    at new JSONRPCError (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/Error.js:24:28)
    at Object.exports.convertJSONToRPCError (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/Error.js:37:16)
    at TransportRequestManager.processResult (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/transports/TransportRequestManager.js:91:31)
    at TransportRequestManager.resolveRes (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/transports/TransportRequestManager.js:113:18)
    at TransportRequestManager.resolveResponse (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/transports/TransportRequestManager.js:53:25)
    at HTTPTransport.<anonymous> (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:107:68)
    at step (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:46:23)
    at Object.next (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:27:53)
    at fulfilled (/home/hammad/work/casper-contracts-js-clients/node_modules/@open-rpc/client-js/build/transports/HTTPTransport.js:18:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:22154) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:22154) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

image
image

Contract package hash is undefined

For last 2 weeks (since 3e2048c) users could encounter the following error, when running npm run e2e:cep47:usage:

[cut]

... Contract Hash: hash-97c6f001a6401f25bfe972bf4711221c2b989956e591c83781d3df74cdd4a37e
... Contract Package Hash: undefined
/home/andrew/casper-contracts-js-clients/packages/cep47-client/src/index.ts:46
        const cep47Events = transforms.reduce((acc: any, val: any) => {
                                       ^
TypeError: Cannot read properties of undefined (reading 'slice')
    at /home/andrew/casper-contracts-js-clients/packages/cep47-client/src/index.ts:65:54
    at Array.reduce (<anonymous>)
    at CEP47EventParser (/home/andrew/casper-contracts-js-clients/packages/cep47-client/src/index.ts:46:40)
    at Object.eventHandlerFn (/home/andrew/casper-contracts-js-clients/e2e/cep47/usage.ts:84:42)
    at /home/andrew/casper-contracts-js-clients/node_modules/casper-js-sdk/dist/lib.node.js:1:130483
    at Array.forEach (<anonymous>)
    at e.runEventsLoop (/home/andrew/casper-contracts-js-clients/node_modules/casper-js-sdk/dist/lib.node.js:1:130416)
    at IncomingMessage.<anonymous> (/home/andrew/casper-contracts-js-clients/node_modules/casper-js-sdk/dist/lib.node.js:1:131113)
    at IncomingMessage.emit (node:events:513:28)
    at IncomingMessage.emit (node:domain:489:12)

The problem is that key name was updated in this client, but not in the contract itself (another repo) - PR with such change was approved, but was not merged so far. I pinged the author and now it landed on master: casper-ecosystem/casper-nft-cep47@b1cb5d7.

So issue is resolved, just keeping this for reference ๐Ÿ‘€.

Add support for SECP256K1 keys or update README

Based on this code block in /e2e/cep47/install.ts it's clear we only support ED25519 keys:
const KEYS = Keys.Ed25519.parseKeyFiles( ${MASTER_KEY_PAIR_PATH}/public_key.pem, ${MASTER_KEY_PAIR_PATH}/secret_key.pem );

Could we either add support for SECP256K1 or at least update the README to reflect this limitation?

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.