Skip to content
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

Optimizing data types #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/api/tx/contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c *contract) GetContract(contractName string) (*response.GetContractResult
return &result, nil
}

func (c *contract) PrepareContractTx(contractName string, form modus.Getter) (params map[string]any, contractId int, err error) {
func (c *contract) PrepareContractTx(contractName string, form modus.Getter) (params map[string]any, contractId uint32, err error) {
var contract getContractInfo
if err = c.SendGet("contract/"+contractName, nil, &contract); err != nil {
return
Expand Down Expand Up @@ -106,10 +106,10 @@ func (c *contract) PrepareContractTx(contractName string, form modus.Getter) (pa
return
}
}
return params, int(contract.ID), nil
return params, contract.ID, nil
}

func (c *contract) NewContractTransaction(contractId int, params map[string]any, expedite string) (data, hash []byte, err error) {
func (c *contract) NewContractTransaction(contractId uint32, params map[string]any, expedite string) (data, hash []byte, err error) {
if expedite != "" {
//Uniform use min uint
d, err := decimal.NewFromString(expedite)
Expand Down
4 changes: 2 additions & 2 deletions packages/modus/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ type Contract interface {
// contain Prepare Contract transaction function
// @return params map[string]any "contract params"
// @return contractId int "contract id"
PrepareContractTx(contractName string, form Getter) (params map[string]any, contractId int, err error)
PrepareContractTx(contractName string, form Getter) (params map[string]any, contractId uint32, err error)
// NewContractTransaction
// Build a contract transaction
// @return data []byte "contract transaction data"
// @return hash []byte "transaction data hash"
// expedite: ibax fee
NewContractTransaction(contractId int, params map[string]any, expedite string) (data, hash []byte, err error)
NewContractTransaction(contractId uint32, params map[string]any, expedite string) (data, hash []byte, err error)
// AutoCallContract
// call Contract and return transaction result
AutoCallContract(contractName string, form Getter, expedite string) (*response.TxStatusResult, error)
Expand Down
2 changes: 1 addition & 1 deletion packages/pkg/types/custom_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (

// Header is contain header data
type Header struct {
ID int
ID uint32
EcosystemID int64
KeyID int64
Time int64
Expand Down
6 changes: 3 additions & 3 deletions packages/rpc/tx/contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c *contract) GetContract(contractName string) (*response.GetContractResult
return &result, nil
}

func (c *contract) PrepareContractTx(contractName string, form modus.Getter) (params map[string]any, contractId int, err error) {
func (c *contract) PrepareContractTx(contractName string, form modus.Getter) (params map[string]any, contractId uint32, err error) {
var contract getContractInfo
message := request.RequestParams{
Namespace: request.NamespaceIBAX,
Expand Down Expand Up @@ -162,10 +162,10 @@ func (c *contract) PrepareContractTx(contractName string, form modus.Getter) (pa
return
}
}
return params, int(contract.ID), nil
return params, contract.ID, nil
}

func (c *contract) NewContractTransaction(contractId int, params map[string]any, expedite string) (data, hash []byte, err error) {
func (c *contract) NewContractTransaction(contractId uint32, params map[string]any, expedite string) (data, hash []byte, err error) {
if expedite != "" {
//Uniform use min uint
d, err := decimal.NewFromString(expedite)
Expand Down