-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap contract deployment #8
Comments
My only question is whether to implement |
The implementation in https://github.com/kfichter/qtumjs/commit/b0de48c6a4a5b20f06f9b0e412e006926363e0a8 looks good. However, I think I think a nicer API is to put this method on the Qtum object (this object knows about all the ABI information): class Qtum extends QtumRPC
/**
* Read ABI and bytecode from `this.repo`, and call `createcontract`
* RPC call, and return an instantiated Contract.
*
* @param name The name of the contract definition.
*/
public deploy(name: string, opts: { sender?: string } = {}): Contract {
// call rpc to deploy the contract
}
} And we add The |
Agreed. I pretty much just ripped that deployment syntax from web3 but I think you're right. I'll make those changes. |
Thanks! Btw, sorry for the slow response. I didn't get the GitHub notification (I wasn't a repo watcher and I didn't realize that) |
Haha, no worries. Just trying to help out where I can. |
Contract deployment is a (relatively) common use case for front-end applications, especially contract generators/factories. It makes sense to wrap
createcontract
and replicate the functionality of web3'sContract.new()
.I therefore propose
Contract.deploy(params: any[] = [], opts: IRPCCreateContractRequest = {}): Promise<IRPCCreateContractResult>
.IRPCCreateContractRequest
is defined as:and
IRPCCreateContractResult
is defined as:In order to facilitate this, I also propose a function
encodeConstructorParams
inabi.ts
similar to https://github.com/ethereum/web3.js/blob/2fba1d2f2b4c5c0afb286e30b6b756d33faf9c8a/lib/web3/contract.js#L36:This is implemented and tested in https://github.com/kfichter/qtumjs/commit/b0de48c6a4a5b20f06f9b0e412e006926363e0a8.
The text was updated successfully, but these errors were encountered: