// Data interface{} `json:"data"`
// }
-func BuildLockTransaction(accountIDSent, assetIDLocked, contractControlProgram string, amountLocked, txFee uint64) []byte {
+// BuildLockTransaction build locked contract transaction.
+func BuildLockTransaction(accountIDLocked, assetIDLocked, contractControlProgram string, amountLocked, txFee uint64) []byte {
data := []byte(`{
"actions":[
{
- "account_id":"` + accountIDSent + `",
+ "account_id":"` + accountIDLocked + `",
"amount":` + strconv.FormatUint(amountLocked, 10) + `,
"asset_id":"` + assetIDLocked + `",
"type":"spend_account"
"type":"control_program"
},
{
- "account_id":"` + accountIDSent + `",
+ "account_id":"` + accountIDLocked + `",
"amount":` + strconv.FormatUint(txFee, 10) + `,
"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"type":"spend_account"
Data TransactionData `json:"data"`
}
+// SignTransaction sign built contract transaction.
func SignTransaction(password, transaction string) string {
data := []byte(`{
"password": "` + password + `",
Data TransactionID `json:"data"`
}
+// SubmitTransaction submit raw singed contract transaction.
func SubmitTransaction(rawTransaction string) string {
data := []byte(`{"raw_transaction": "` + rawTransaction + `"}`)
body := request(submitTransactionURL, data)
Data GotTransactionInfo `json:"data"`
}
-// GetContractUTXOID get contract UTXO ID by transaction ID and control program.
+// GetContractUTXOID get contract UTXO ID by transaction ID and contract control program.
func GetContractUTXOID(transactionID, controlProgram string) (string, error) {
data := []byte(`{"tx_id":"` + transactionID + `"}`)
body := request(getTransactionURL, data)