wallet: export contractParam

It is needed to be able to create Contracts
from the outside.
This commit is contained in:
Evgenii Stratonikov 2020-03-04 13:58:33 +03:00
parent 0d419d3899
commit 44901ca867

View file

@ -56,7 +56,7 @@ type Contract struct {
Script []byte `json:"script"` Script []byte `json:"script"`
// A list of parameters used deploying this contract. // A list of parameters used deploying this contract.
Parameters []contractParam `json:"parameters"` Parameters []ContractParam `json:"parameters"`
// Indicates whether the contract has been deployed to the blockchain. // Indicates whether the contract has been deployed to the blockchain.
Deployed bool `json:"deployed"` Deployed bool `json:"deployed"`
@ -68,13 +68,15 @@ type contract struct {
Script string `json:"script"` Script string `json:"script"`
// A list of parameters used deploying this contract. // A list of parameters used deploying this contract.
Parameters []contractParam `json:"parameters"` Parameters []ContractParam `json:"parameters"`
// Indicates whether the contract has been deployed to the blockchain. // Indicates whether the contract has been deployed to the blockchain.
Deployed bool `json:"deployed"` Deployed bool `json:"deployed"`
} }
type contractParam struct { // ContractParam is a descriptor of a contract parameter
// containing type and optional name.
type ContractParam struct {
Name string `json:"name"` Name string `json:"name"`
Type smartcontract.ParamType `json:"type"` Type smartcontract.ParamType `json:"type"`
} }
@ -252,8 +254,8 @@ func newAccountFromPrivateKey(p *keys.PrivateKey) *Account {
return a return a
} }
func getContractParams(n int) []contractParam { func getContractParams(n int) []ContractParam {
params := make([]contractParam, n) params := make([]ContractParam, n)
for i := range params { for i := range params {
params[i].Name = fmt.Sprintf("parameter%d", i) params[i].Name = fmt.Sprintf("parameter%d", i)
params[i].Type = smartcontract.SignatureType params[i].Type = smartcontract.SignatureType