alabarba / bookswapy

Virtual library based on Hyperledger Fabric blockchain to exchange books between privates
1 stars 0 forks source link

Make the method updateBalance callable by a transition object #16

Open alabarba opened 5 years ago

alabarba commented 5 years ago

Here's a couple of options if you want to share logic:

In any of those scenarios, you won't be able to access this.sender or this.tx inside the functions, so make sure to pass everything you need as a parameter.

Problem: How to pass this.tx or this.sender to the updateBalance method when I make it static? (This must work both when making a call with Hurley and when making a call from the lendBook method). More in generale how can I specify the parameters passed to the method in the signature when I pass an object?

```
@Param(yup.object())
id: class

 @Param(MyClass)
 instanceName: MyClass

 Others?

  ```

Same problem in the model how can I define a property as an object?

 ```
  @Validate(MyClass)
  public propertyName: MyClass;

   Others?

 ```

Also not clear the difference between this.tx and this.sender