upstream sync

This commit is contained in:
Senad Uka
2023-10-19 07:57:48 +02:00
parent 5b1acd1c5f
commit 44efa194fc
5 changed files with 93 additions and 12 deletions

View File

@@ -29,7 +29,7 @@ func NewService(blockchainConfig config.Blockchain) Service {
type Service interface {
CreateContract(ctx context.Context, contractID [32]byte) error
AddIOTData(ctx context.Context, contractID [32]byte, deviceID [32]byte, timestamp *big.Int, data []byte) error
RegisterNewDeviceIDs(ctx context.Context, contractID [32]byte, deviceIDs [][32]byte) error
RegisterNewDeviceID(ctx context.Context, contractID [32]byte, deviceID [32]byte) error
}
func (s *service) signerFunc(address common.Address, txn *types.Transaction) (*types.Transaction, error) {
@@ -100,13 +100,13 @@ func (s *service) CreateContract(ctx context.Context, contractID [32]byte) error
}
// map devices with blockchain contract
func (s *service) RegisterNewDeviceIDs(ctx context.Context, contractID [32]byte, deviceIDs [][32]byte) error {
func (s *service) RegisterNewDeviceID(ctx context.Context, contractID [32]byte, deviceID [32]byte) error {
conn, contract, err := s.getClient(ctx)
if err != nil {
return err
}
txn, err := contract.RegisterNewDeviceIds(s.getTransactOpts(), contractID, deviceIDs)
txn, err := contract.RegisterNewDeviceId(s.getTransactOpts(), contractID, deviceID)
if err != nil {
return err
}