Questions tagged [truffle-contract]

The tag has no usage guidance.

75 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
504 views

How can I retrieve transaction hashes using web3 batch requests?

When I send a transaction using Truffle's contract wrappers - or using plain web3 sendTransaction() - I get a tx hash back that I can use to confirm the tx has completed. While using batch requests (...
2
votes
0answers
75 views

this.contract.deployed() is not a function

I'm working on making a React frontend for my smart contract, but I'm having problems connecting it into my React code. Here are the relevant portions of my code: import TruffleContract from '...
2
votes
0answers
147 views

Installing Truffle without npm

I'm a student trying to install a truffle test RPC client (just for simple contract deployment in small scale). I am using a remote Ubuntu machine in my university, and i don't root privileges. ...
2
votes
2answers
127 views

Truffle interaction with my smart contract getting Vm exception

pragma solidity ^0.4.23; contract Hotelbooking { event Transfer( address indexed _from, address indexed _to, uint256 _value ); mapping(address => uint256) public ...
2
votes
1answer
303 views

Pending transactions are not mined

Preconditions I'm running a private network with Geth, having custom smart contracts deployed by Truffle and a simple frontend which using Metamask as a provider to connect the network. Versions ...
2
votes
0answers
130 views

Frontend call --> Transaction does not go through, no error message displayed

I'm trying to build a frontend for my Dapp and first, I wanted to test if I can initiate a transaction at all. I have a Button which calls the storeInput() function. Then, it should invoke the ...
2
votes
3answers
546 views

writing tests in solidity for functions returning multiple values

I have a function that returns multiple values function getInfo(string id) returns(string x,string y){ bytes32 _id= strToBytes(id); return (infostruct[_id].x,infostruct[_id].y) ; } Now i want ...
2
votes
0answers
690 views

Sign transaction using truffle-contract

Is it possible to call contract methods protected with modifier like onlyOwner without access to the node with the keyfile using only private key? I know that I can create raw transaction and sign it ...
2
votes
0answers
243 views

Usage regarding for loop in solidity contract

I am trying to integrate for loop in my smartcontract for adding details to a struct. I have implemented for loop using frontend by calling the function in smartcontract one by one. struct details {...
2
votes
0answers
286 views

Truffle Contract transaction doesn't wait to be mined

I have a thing that has been annoying me when using truffle-contract, ever since updating from Truffle 2 to Truffle 3. I am no longer able to run transactions synchronously - even though it is stated ...
1
vote
1answer
36 views

During gas-free transaction get an error “No relay responded! 4 attempted, 4 pinged”

I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless However, when I'm trying to write some tests it fails and provides me the following error Error:...
1
vote
1answer
241 views

UnimplementedFeatureError: Encoding type “struct BiddingContract.Bidder memory” not yet implemented

The code is broken with the new upgrade v0.5, using Truffle v5.0.1 (core: 5.0.1) struct Bidder { address bidders_address; uint productId; uint bidValue; } struct Product { uint ...
1
vote
0answers
226 views

How to use the latest version of Truffle Contract in a web page?

I'm trying to use version 4.0.0 of truffle-contract in a browser app, so no NodeJS, no require or anything. So I followed the instructions in the doc, downloaded truffle-contract in non-minified ...
1
vote
1answer
57 views

How to process Smart Contracts payable functions in batch?

I am aware that metamask will enable effective security for processing via the web browser a payable function action to a smart contract. What happens in batch? I have an API service which then ...
1
vote
1answer
235 views

truffle-contract cannot deploy in node js

This is the error I get. internal/modules/cjs/loader.js:631 throw new ERR_INVALID_ARG_TYPE('id', 'string', id); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of ...
1
vote
1answer
216 views

Error: Web3ProviderEngine does not support synchronous requests

Error: Web3ProviderEngine does not support synchronous requests. I have an error when deploying contract to rinkeby provider const HDWalletProvider = require('truffle-hdwallet-provider') module....
1
vote
0answers
297 views

Unable to deploy contract using truffle-contract?

I'm trying to deploy a new contract via truffle-contract but for some reason it keeps giving me a Error: Invalid JSON RPC response: "" import Web3 from 'web3' import contract from 'truffle-contract' ...
1
vote
0answers
36 views

truffle can not build success

when I fllow this document step by step enter link description here,I have something wrong with my truffle build,and I delete truffle.js ,this is photo, please help thx!!
1
vote
3answers
398 views

How to transfer token to an address?

Im using truffle and openzeppelin for issuing my ERC20 token. I already can add and buying the token, but still cannot transfer the token to another. when i console.log the contract, it show me: and ...
1
vote
0answers
36 views

Test cases required for Multisig wallet

Can you please suggest me some test use cases that are applicable for a smart contract that has a multi-signature wallet in Ethereum?
1
vote
0answers
345 views

How to catch reverted transaction while using metamask

I'm working with metamask and was testing a transaction that should trigger a revert statement inside my contract. When the error is thrown metamask gives the following output: this was while using ...
1
vote
0answers
291 views

Cannot send transactions to locally deployed smart contract

I setup a ethereum private network following this. Then I tried to deploy smart contract and send transaction to smart contract following this blog post. here is the python file I am using to deploy ...
1
vote
0answers
106 views

Can't call another contract constant function in Remix in Web3 provider mode, but it works in Javascript VM

Remix behaves differently when running Javascript VM and web3 provider mode. I have two contracts: contract ERC20Basic { function totalSupply() public view returns (uint256){} function ...
1
vote
0answers
290 views

Error: authentication needed: password or unlock when deploying a contract with truffle

i am using angular with truffle. I am trying to deploy a contract through truffle migrate. here is my 2_deploy_contracts.js var contractFacotry = artifacts.require('./contractFactory.sol'); module....
1
vote
0answers
338 views

Drizzle React Component ContractData returns empty

My contract call to a simple view function that returns an array of data returns empty using: From testing it appears that ContractData can't deal with more than one return value. If I return one unit ...
1
vote
0answers
80 views

Unexpected revert during selfdestruct

I experience unexpected revert in the line where I invoke bidEnd. it("should create second contract and remove it", function(done) { BiddingsFactory.deployed().then(async function (...
1
vote
0answers
285 views

Using MetaMask with React and Truffle

I currently have my app set up with testrpc + truffle-contract and I'm trying to set the current provider to Rinkeby (or whatever testnet I'm on in MetaMask). However, when I run the following code it ...
1
vote
0answers
310 views

Truffle (4.0) test multiple contracts

I'm trying to test a contract that wrote and compiled, and I need to use another deployed contract to test it. I am writing a test for a specific contract and trying to invoke another deployed ...
1
vote
0answers
412 views

“Truffle unbox react” Not Working Properly

I am facing problems running the basic official setup of react and truffle. Here's what I did: truffle init truffle unbox react truffle develop truffle(develop)> compile truffle(develop)> ...
1
vote
0answers
96 views

Smart contract and Coin integration

I understand how to create contracts in Solidity, and how to create a Coin using Openzepplin. I do not understand how to integrate both. Let say that every transaction on contract (MyContract), will ...
1
vote
0answers
678 views

How can I sign raw transaction generated by truffle?

I can create tokens by the following way. However, I want to sign raw transaction generated by truffle so that I don't need to store my private key online. How can I get raw unsigned transaction? $ ...
1
vote
2answers
508 views

Out of gas when calling smart contract function from web3/Meteor Dapp

The following smart contract function works when called in the Remix-Solidity IDE and connected to testrpc. function submitAsset(string ownerName, string assetName, string assetDesc, string barcode, ...
1
vote
1answer
2k views

*contract* has not been deployed to detected network (network/artifact mismatch)

I'm trying to launch my first DApp using truffle and testrpc. I keep running into the above error once the web page loads. I looked at the Truffle Contract json object and the networks value is empty (...
1
vote
1answer
120 views

passing defaultBlock “pending” param to a truffle-contract call

I need the pending balance of my contract. As far as I understand I could do it with web3: web3.eth.call(callObject [, defaultBlock] [, callback]) Can I pass defaultBlock to truffle-contract ...
1
vote
0answers
146 views

What is the ether-pudding / truffle-artifactor front end?

I am trying to figure out how to interact with a smart contract deployed through truffle. I am looking at the truffle documentation here. They are describing how to call a function in a deployed ...
1
vote
0answers
275 views

How does Truffle Deployer translate arguments from JavaScript to Solidity?

I have a Truffle migration that looks something like this; var MyContract = artifacts.require("./MyContract.sol"); module.exports = function(deployer) { deployer.deploy(MyContract,[ { "...
1
vote
0answers
30 views

Accessing other contract variables(address)

I'm creating a marketplace, which will have two token contracts representing currencyToken and assetToken. I've set separate owner's for both of the token contracts, in their constructor. But when I'm ...
0
votes
0answers
14 views

Can't migrate, ropsten randomly throws out of gas

I have the following migration files with 50 contracts' deployment and their setup (calling each other functions like privileges, access and so on): On the development network everything works fine. ...
0
votes
0answers
111 views

Error: Truffle is currently using solc 0.5.8,

i run migrate in the terminalbut it shows Error: Truffle is currently using solc 0.5.8, but one or more of your contracts specify "pragma solidity ^0.4.27". Please update your truffle config or ...
0
votes
1answer
40 views

Cannot Find Module Error for Truffle-contract

Error:- Uncaught Error: Cannot find module './truffle-contract.min.js' at c (web3.min.js:1) at c (web3.min.js:1) at index.html:27 <!DOCTYPE html> <html lang="en"> <head&...
0
votes
0answers
16 views

Ganache does not show the transferred amount.but it shows theme in account section

as shown in the picture the amount of value which is transferred to contract is shown in the transaction section of Ganache. I mean it shows the amount which is transacted to the address. in the my ...
0
votes
0answers
37 views

Can I use a truffle-contract instance in the data field of web3.eth.sendSignedTransaction?

I use truffle-contract for contract abstraction. const myContract = TruffleContract(MyContractArtifact); myContract.setProvider(web3.currentProvider); I'm using Infura as the web3 provider so need ...
0
votes
0answers
37 views

How to Access Value of Drizzle ContractData Method

I would like to access the value of a Drizzle ContractData method: this outputs: 1000000000: <ContractData contract={name} method="getValue" /> Now, ...
0
votes
0answers
90 views

Hoiw to convert string to address with web3

I am getting address value with html input as string value how do we convert the string to address for parsing with truffle-contract. Here's the method I am using: registerAirline : async() => {...
0
votes
0answers
57 views

Contract has no network id set, cannot lookup artifact data

I am using web3 v1.0.0-beta.37 and truffle contract for server.js configuration. I have defined two contracts FlightSuretyData.sol and FlightSuretyApp.sol FlightSuretyApp contract access functions ...
0
votes
0answers
62 views

Invalid number of arguments in Solidity function

Why am I getting Uncaught (in promise) Error: Invalid number of arguments to Solidity function sol file: uint id = 1; struct Multihash { bytes32 digest; uint8 hashFunction; ...
0
votes
1answer
66 views

async handleSubmit(event) not working

This is the full code of App.js import SimpleStorageContract from "./contracts/SimpleStorage.json"; import getWeb3 from "./utils/getWeb3"; import "./App.css"; class App extends Component { state =...
0
votes
0answers
30 views

How to send a value from interface to smart contract function

I have the below contract to create document details: pragma solidity ^0.5.0; contract Documents { struct Document { uint256 creationDate; uint32 documentCreationTimestamp; ...
0
votes
1answer
85 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
0
votes
1answer
165 views

truffle migrate --network ropsten issues

When i run truffle migrate --network ropsten i don't see the contract deployment but just Compiling your contracts... =========================== > Everything is up to date, there is nothing to ...