Comments (27)
web3_clientVersion is actually an RPC method of the blockchain. We need support from rpc side or we need to understand when and where it will be called and wrap the method with custom result
from sdk.
I didn't quite understand... can you elaborate it a little? What do you mean by the second sentence?
from sdk.
I didn't quite understand... can you elaborate it a little? What do you mean by the second sentence?
Just like Loom did it for their truffleProvider. We need to do the same. There is no such method in RPCs of Harmony‘s blockchain. We have to manually add the expected return to the TruffleProvider.
@denniswon Would you like to dive in to find solution?
from sdk.
I went through this... https://forum.openzeppelin.com/t/loom-support/1239
but still, I'm running around in circles trying to figure out what I need to do... how to actually solve this, does this mean I can't use OpenZeppelin SDK altogether for this? How can I solve this? Please can you give a detailed example? or a way-around...?
from sdk.
I went through this... https://forum.openzeppelin.com/t/loom-support/1239
but still, I'm running around in circles trying to figure out what I need to do... how to actually solve this, does this mean I can't use OpenZeppelin SDK altogether for this? How can I solve this? Please can you give a detailed example? or a way-around...?
Let me do some modification on my side to the sdk, and i'll make a branch later these days, and you can clone and try to see if it works on your side.
maybe there are more rpc methods needed like getStorageAt, I'll try to understand what loom did to workaround.
from sdk.
@asmitadhungana would you try this branch and see if it works for you
https://github.com/harmony-one/sdk/tree/truffle_provider
but you have to build the sdk manually, please follow this manual:
https://github.com/harmony-one/sdk#bootstrap-and-build
and do reply if it works or not, then we can discuss how to work around it.
from sdk.
Sure! Thanks!
from sdk.
Hey @neeboo, it is not actually working... idk why! My project's versions are set-up as per this package.json file in the documentation https://docs.harmony.one/home/developers/smart-contracts/sample-files#package-json ... but in the github documentation that you share, it says we need to use Node 10.0.0+... can you clarify it to me? What are the standard versions for dependencies for developing a truffle project for Harmony? I think i'm going wrong in there...
from sdk.
The build was checked by one of my seniors and it seems to be working individually... it is not however, working with the project
from sdk.
Hey @neeboo, it is not actually working... idk why! My project's versions are set-up as per this package.json file in the documentation https://docs.harmony.one/home/developers/smart-contracts/sample-files#package-json ... but in the github documentation that you share, it says we need to use Node 10.0.0+... can you clarify it to me? What are the standard versions for dependencies for developing a truffle project for Harmony? I think i'm going wrong in there...
10.0+ is by default, personally i use v12.16.1
I think you would like to test on your local machine first follow this steps.
-
git clone my branch, to some folder say: "/dev/harmony-js"
-
go to "/dev/harmony-js", run
yarn bootstrap && yarn dist
- just go straight to your project javascript file, use relative path to point to the package
const {
Harmony,
TruffleProvider,
} = require('../dev/harmony-js/packages/harmony-core')
// do the truffle thing
Please do tell me whether it works or not, then we can pr to the team, and make a release
from sdk.
Can you post up your truffle-config.js here and the error log? @asmitadhungana
And I'm not quite familiar with OZ cli, would you like to make an example or guide me to some working example ,maybe for ethereum network, which i can debug for harmony?
from sdk.
for OpenZeppelin Cli, it's an interactive cli tool that I've used to make our smart-contract upgradeable...
by using commands:
oz compile: compiles the contract ~truffle compile
oz create: deploys the contract so that it can be upgraded later to a network specified when given the choice in this interactive command
like: oz create
?pick a network: development || stable || other_networks_in_truffle-config.js
since I'd initialzed openeppelin in a truffle folder, and configured the migrations accordingly,
using truffle-migrate, it can deploy an upgradeable contract w/o having to use oz create too...
likewise, it uses truffle-config.js instead of its network.js which would've been created with "openzeppelin init" and used if it was used independently...
you can use this reference for a quick understanding: https://github.com/OpenZeppelin/docs.openzeppelin.com/pull/67/files/46c54a3f21136dddc055dbcb9a2854e36f607e5f
you can use the example in this guide to get to know it easily and deploy it in harmony testnets:
https://docs.openzeppelin.com/learn/upgrading-smart-contracts#:~:text=Upgrading%20Smart%20Contracts,may%20find%20in%20in%20production.
from sdk.
i realized that the inability to find "stable-fork" was due to dry-run simulation while migrating...
now, the error's the same as for oz deploy:
$npx truffle migrate --network testnet --skip-dry-run --reset
Compiling your contracts...
Everything is up to date, there is nothing to compile.
Starting migrations...
Network name: 'testnet'
Network id: 2
Block gas limit: 3321900 (0x32b02c)
1_initial_migration.js
Replacing 'Migrations'
transaction hash: 0xa773c7aa0ce1bb42826fb6ed123e8c8dd884d1c4ea7c0e2fdf2b8e3d9bc2608e
Blocks: 2 Seconds: 20
contract address: 0x6a05F7Ee807e7b4302555209D6A95E5f7b98d72e
block number: 129151
block timestamp: 1591779051
account: 0x3aea49553Ce2E478f1c0c5ACC304a84F5F4d1f98
balance: 6699997.390565589689332405
gas used: 188751 (0x2e14f)
gas price: 1 gwei
value sent: 0 ETH
total cost: 0.000188751 ETH
Saving migration to chain.
Saving artifacts
Total cost: 0.000188751 ETH
2_deploy_contracts.js
Error: Dice deployment failed with error: Returned error: The method web3_clientVersion does not exist/is not available
at Object.ErrorResponse (/media/asmee/H/hello_zepplin/node_modules/web3-eth/node_modules/web3-core-helpers/src/errors.js:29:16)
at /media/asmee/H/hello_zepplin/node_modules/web3-eth/node_modules/web3-core-requestmanager/src/index.js:140:36
at /media/asmee/H/hello_zepplin/node_modules/truffle-provider/wrapper.js:112:9
at TruffleProvider._this.resolveCallback (/media/asmee/H/hello_zepplin/dev/harmony-js/packages/harmony-core/src/truffleProvider.ts:225:7)
at /media/asmee/H/hello_zepplin/dev/harmony-js/packages/harmony-core/src/truffleProvider.ts:176:61
at HttpProvider.callbackHandler (/media/asmee/H/hello_zepplin/dev/harmony-js/packages/harmony-network/src/providers/http.ts:141:7)
at /media/asmee/H/hello_zepplin/dev/harmony-js/packages/harmony-network/src/providers/http.ts:82:30
at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.1.29 (core: 5.1.29)
Node v10.19.0
from sdk.
This is my truffle-config now only with two networks:
require('dotenv').config()
//const {TruffleProvider} = require('@harmony-js/core');
const { TruffleProvider } = require('./dev/harmony-js/packages/harmony-core');
const testnet_mnemonic = process.env.TESTNET_MNEMONIC
const testnet_private_key = process.env.TESTNET_PRIVATE_KEY
const testnet_url = process.env.TESTNET_0_URL
//GAS - Currently using same GAS accross all environments
gasLimit = process.env.GAS_LIMIT
gasPrice = process.env.GAS_PRICE
const HDWalletProvider = require("@truffle/hdwallet-provider");
module.exports = {
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
testnet: {
network_id: '2',
provider: () => {
const truffleProvider = new TruffleProvider(
testnet_url,
{ memonic: testnet_mnemonic },
{ shardID: 0, chainId: 2 },
{ gasLimit: gasLimit, gasPrice: gasPrice },
);
const newAcc = truffleProvider.addByPrivateKey(testnet_private_key);
truffleProvider.setSigner(newAcc);
return truffleProvider;
}
}
},
compilers: {
solc: {
version: "0.6.4" // ex: "0.4.20". (Default: Truffle's installed solc)
}
}
}
from sdk.
@asmitadhungana would you git pull my branch and try again?
from sdk.
@asmitadhungana would you git pull my branch and try again?
sure, thanks!
from sdk.
Hey @neebo, I'm getting the following error while building your updated branch....
And one thing, as per my team member said just a while ago, the previous fix had worked for him... dk why it was throwing that error for me though!
asmee@asmee:/media/asmee/H/fix-test/harmony-js$ yarn dist
yarn run v1.22.4
warning package.json: "dependencies" has dependency "tslib" with range "^1.10.0" that collides with a dependency in "devDependencies" of the same name with version "^1.11.1"
$ yarn packages:bundler && yarn bundle:webpack
warning package.json: "dependencies" has dependency "tslib" with range "^1.10.0" that collides with a dependency in "devDependencies" of the same name with version "^1.11.1"
$ yarn packages:clean && yarn build:ts && ts-node -P scripts/tsconfig.json scripts/bundle.ts
warning package.json: "dependencies" has dependency "tslib" with range "^1.10.0" that collides with a dependency in "devDependencies" of the same name with version "^1.11.1"
$ gulp cleanServer && yarn packages:cleanUnexpected
[12:04:06] Using gulpfile /media/asmee/H/fix-test/harmony-js/gulpfile.js
[12:04:06] Starting 'cleanServer'...
[12:04:08] Finished 'cleanServer' after 1.5 s
warning package.json: "dependencies" has dependency "tslib" with range "^1.10.0" that collides with a dependency in "devDependencies" of the same name with version "^1.11.1"
$ gulp cleanUnexpected
[12:04:09] Using gulpfile /media/asmee/H/fix-test/harmony-js/gulpfile.js
[12:04:09] Starting 'cleanUnexpected'...
[12:04:09] Finished 'cleanUnexpected' after 15 ms
warning package.json: "dependencies" has dependency "tslib" with range "^1.10.0" that collides with a dependency in "devDependencies" of the same name with version "^1.11.1"
$ tsc -b tsconfig.json
warning package.json: "dependencies" has dependency "tslib" with range "^1.10.0" that collides with a dependency in "devDependencies" of the same name with version "^1.11.1"
$ rm -rf dist && cross-env NODE_ENV=production ts-node -P scripts/tsconfig.json scripts/webpack.ts
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
asmee@asmee:/media/asmee/H/fix-test/harmony-js$ Error: write EPIPE
at process.target._send (internal/child_process.js:762:20)
at process.target.send (internal/child_process.js:634:19)
at callback (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:32:17)
at module.exports (/media/asmee/H/fix-test/harmony-js/node_modules/webpack/node_modules/terser-webpack-plugin/dist/worker.js:13:5)
at handle (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:44:8)
at process. (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:55:3)
at process.emit (events.js:198:13)
at process.EventEmitter.emit (domain.js:448:20)
at process.emit (/media/asmee/H/fix-test/harmony-js/node_modules/source-map-support/source-map-support.js:495:21)
at emit (internal/child_process.js:832:12)
Error: write EPIPE
at process.target._send (internal/child_process.js:762:20)
at process.target.send (internal/child_process.js:634:19)
at callback (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:32:17)
at module.exports (/media/asmee/H/fix-test/harmony-js/node_modules/webpack/node_modules/terser-webpack-plugin/dist/worker.js:13:5)
at handle (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:44:8)
at process. (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:55:3)
at process.emit (events.js:198:13)
at process.EventEmitter.emit (domain.js:448:20)
at process.emit (/media/asmee/H/fix-test/harmony-js/node_modules/source-map-support/source-map-support.js:495:21)
at emit (internal/child_process.js:832:12)
Error: write EPIPE
at process.target._send (internal/child_process.js:762:20)
at process.target.send (internal/child_process.js:634:19)
at callback (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:32:17)
at module.exports (/media/asmee/H/fix-test/harmony-js/node_modules/webpack/node_modules/terser-webpack-plugin/dist/worker.js:13:5)
at handle (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:44:8)
at process. (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:55:3)
at process.emit (events.js:198:13)
at process.EventEmitter.emit (domain.js:448:20)
at process.emit (/media/asmee/H/fix-test/harmony-js/node_modules/source-map-support/source-map-support.js:495:21)
at emit (internal/child_process.js:832:12)
Error: write EPIPE
at process.target._send (internal/child_process.js:762:20)
at process.target.send (internal/child_process.js:634:19)
at callback (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:32:17)
at module.exports (/media/asmee/H/fix-test/harmony-js/node_modules/webpack/node_modules/terser-webpack-plugin/dist/worker.js:13:5)
at handle (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:44:8)
at process. (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:55:3)
at process.emit (events.js:198:13)
at process.EventEmitter.emit (domain.js:448:20)
at process.emit (/media/asmee/H/fix-test/harmony-js/node_modules/source-map-support/source-map-support.js:495:21)
at emit (internal/child_process.js:832:12)
Error: write EPIPE
at process.target._send (internal/child_process.js:762:20)
at process.target.send (internal/child_process.js:634:19)
at callback (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:32:17)
at module.exports (/media/asmee/H/fix-test/harmony-js/node_modules/webpack/node_modules/terser-webpack-plugin/dist/worker.js:13:5)
at handle (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:44:8)
at process. (/media/asmee/H/fix-test/harmony-js/node_modules/worker-farm/lib/child/index.js:55:3)
at process.emit (events.js:198:13)
at process.EventEmitter.emit (domain.js:448:20)
at process.emit (/media/asmee/H/fix-test/harmony-js/node_modules/source-map-support/source-map-support.js:495:21)
at emit (internal/child_process.js:832:12)
from sdk.
I searched for this error and here's the link I got: codesandbox/codesandbox-client#4281
from sdk.
It however, got built in my partner's system... Idk why none of the builds are working for mine....
And now, we're getting error in execution of a function after it's gotten deployed...
from sdk.
I searched for this error and here's the link I got: codesandbox/codesandbox-client#4281
Better cleanup your local project and try again.
from sdk.
It however, got built in my partner's system... Idk why none of the builds are working for mine....
And now, we're getting error in execution of a function after it's gotten deployed...
Now what is the error you got?
from sdk.
✖ Upgrading instance at 0xB9CE4120F4e2683E2025723C6fa40EE53d90b086 and calling 'initialize' with no arguments
✖ Upgrading instance at 0xB9CE4120F4e2683E2025723C6fa40EE53d90b086
Proxy dice-contract/Dice at 0xB9CE4120F4e2683E2025723C6fa40EE53d90b086 failed to upgrade with error: Error: gas required exceeds allowance (10000000) or always failing transaction
from sdk.
✖ Upgrading instance at 0xB9CE4120F4e2683E2025723C6fa40EE53d90b086 and calling 'initialize' with no arguments
✖ Upgrading instance at 0xB9CE4120F4e2683E2025723C6fa40EE53d90b086
Proxy dice-contract/Dice at 0xB9CE4120F4e2683E2025723C6fa40EE53d90b086 failed to upgrade with error: Error: gas required exceeds allowance (10000000) or always failing transaction
That i dont know how to solve. Maybe its the gas problem.
You may dig something useful here. https://forum.openzeppelin.com/t/error-gas-required-exceeds-allowance-8000000-or-always-failing-transaction/1856/12
from sdk.
I've already contacted the forum... Might be, I'm the active commentator in there at the moment...
They asked me to know the EVM version that Harmony is using... Can you let me know?
And I'll close this issue since the main problem's been solved. Thank you for all he help @neebo! Much appreciated!
from sdk.
I've already contacted the forum... Might be, I'm the active commentator in there at the moment...
They asked me to know the EVM version that Harmony is using... Can you let me know?
And I'll close this issue since the main problem's been solved. Thank you for all he help @neebo! Much appreciated!
It seems that it is related to ‘EVM‘ gas Limit. Since Harmony use EVM as its smart contract runtime however I am not sure it has the same gas setting to Ethereum. I will dig a bit and let you know
from sdk.
Sure @neeboo , thanks a lot!
It's that the same contract works just fine for Rinkeby (Ethereum's testnet) but when it comes to harmony's testnet, it doesn't...
from sdk.
@neeboo any asnwer yet?
from sdk.
Related Issues (20)
- Can't use the SDK with vite HOT 4
- RangeError: Maximum call stack size exceeded (during getTransactionCount) HOT 16
- Is it possible to delegate/undelegate ONE directly in solidity smart contracts? HOT 1
- Contract event listener stops receiving events HOT 4
- Add method to access hmy_getTransactionsHistory
- Remove encoding library bloat in @hamony-js/staking JavaScript SDK HOT 1
- The transaction is still not confirmed after 20 attempts
- Another Harmony SDK bug `FetchError: invalid json response body at https://api.s0.t.hmny.io/ reason: Unexpected token < in JSON at position 0` HOT 1
- invalid chain id for signer for
- Invalid path on module field HOT 2
- Transaction issue failed when I trying to doing a transaction
- TruffleProvider (HDNode) wallet inadvertently generates a new account/address accompanied with a random private key and mnemonic
- TruffleProvider is not processing web3.eth.getTransaction calls explicitly, causing errors
- Harmony RPC support on evm_increaseTime and evm_decreaseTime in test environments
- Superfluous pop in getRLPSigned
- Dependency Problem with @harmony-js/core
- How to get a specific token off of the harmony blockchain HOT 1
- Returned error: invalid address: 0x0000000000000000000000000000000000000000 HOT 5
- Running concurrent HRC20 token transfers, without an error. HOT 2
- Unable to catch errors some errors from the SDK in transactionBase.js HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.