argentlabs / application Goto Github PK
View Code? Open in Web Editor NEWInstructions on how to submit a blockchain application ID
Instructions on how to submit a blockchain application ID
just curious..
const Web3 = require('web3');
const rpcURL = 'https://ropsten.infura.io/v3/<INFURA_PROJECT_ID>';
const contractAddress = '0xcbbfbafedb0eb83016d2a96a4e80d30b20fa3e30';
const email = '[email protected]';
const emailHash =
'0xbe166c9942e280bb26c7e658bec28539d4b24fc633d8be6d4b005cc204933b84';
const abi = [
{
constant: false,
inputs: [{ name: 'hash', type: 'bytes32' }],
name: 'apply',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [{ name: 'email', type: 'string' }],
name: 'getApplicationID',
outputs: [{ name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function'
}
];
const web3 = new Web3(rpcURL);
const contract = new web3.eth.Contract(abi, contractAddress);
contract.methods.apply(emailHash).call((err, result) => {
contract.methods.getApplicationID(email).call((err, result) => {
console.log('getApplicationID', result);
});
});
Am I missing something or is there any problem with the contract?
Did anyone figure it out? Please respond to this.
You can clone and debug here
TIA ๐๐ป
inpage.js:1 Uncaught Error: The MetaMask Web3 object does not support synchronous methods like eth_sendTransaction without a callback parameter. See https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#dizzy-all-async---think-of-metamask-as-a-light-client for details.
at MetamaskInpageProvider.send (inpage.js:1)
at s.send (inpage.js:1)
at n.e [as sendTransaction] (inpage.js:1)
at u.sendTransaction (inpage.js:1)
at u.execute (inpage.js:1)
at :1:10
I think there are some issue in contract, as the apply function always call "this.sendTransaction.apply" function so always getting "Invalid Address"
Uncaught Error: invalid address
at u (web3.min.js:1)
at inputTransactionFormatter (web3.min.js:1)
at web3.min.js:1
at Array.map ()
at i.formatInput (web3.min.js:1)
at i.toPayload (web3.min.js:1)
at r.e [as sendTransaction] (web3.min.js:1)
at c.sendTransaction (web3.min.js:1)
at c.execute (web3.min.js:1)
at Index.html:56
myContract
{
abi: [{
constant: false,
inputs: [{...}],
name: "apply",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function"
}, {
constant: true,
inputs: [{...}],
name: "getApplicationID",
outputs: [{...}],
payable: false,
stateMutability: "view",
type: "function"
}],
eth: {},
at: function(address, callback),
getData: function(),
new: function()
}
var abi = [{"constant": false,"inputs":[{"name": "hash","type": "bytes32"}],"name": "apply","outputs": [],"payable": false,"stateMutability": "nonpayable","type": "function"},{"constant": true,"inputs": [{"name": "email","type": "string"}],"name": "getApplicationID","outputs":[{"name": "","type": "uint256"}],"payable": false,"stateMutability": "view","type": "function"}]
var myContract = web3.eth.contract(abi);
var myContractInstance = myContract.at("0xcbbfbafedb0eb83016d2a96a4e80d30b20fa3e30");
var result = myContractInstance.apply("4183f3a48d92d7b874e0e2dc0353e29aee0031b0a174be6f6a2e7a289e9febca");
console.log(result)
curl -X GET \
'https://api-ropsten.etherscan.io/api?module=contract&action=getabi&address=0xcbbfbafedb0eb83016d2a96a4e80d30b20fa3e30&apikey=2QRMGI15YCHS2SKW2FSXCIA7T31JYKZWKE' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 388297f8-efb6-4d38-82cd-c62cbb4d7f82' \
-H 'cache-control: no-cache' \
-d '[
{
"constant": false,
"inputs": [
{
"name": "hash",
"type": "bytes32"
}
],
"name": "apply",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "email",
"type": "string"
}
],
"name": "getApplicationID",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]'
Always return:
{
"status": "0",
"message": "NOTOK",
"result": "Contract source code not verified"
}
So no way to add the id to the application form ๐
What exactly I have to use to get application ID?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.