storeObjectArrayAddressRef.js 813 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { StoreObject } from './storeObject';
  2. import { BigNumber } from "bignumber.js";
  3. export class StoreObjectArrayAddressRef extends StoreObject {
  4. constructor (address) {
  5. super(null, null, false);
  6. this.address = address;
  7. }
  8. get isRef () {
  9. return true;
  10. }
  11. get type () {
  12. return this.address.type;
  13. }
  14. get value () {
  15. return this.address.value;
  16. }
  17. get number () {
  18. if (this.value instanceof BigNumber) {
  19. return this.value.toNumber();
  20. } else {
  21. return null;
  22. }
  23. }
  24. getRefObj () {
  25. return this.address.refValue;
  26. }
  27. updateRef (stoObj) {
  28. const newArray = this.address.updateArrayObject(stoObj);
  29. this.address.store.updateStore(this.address.refID, newArray);
  30. }
  31. isCompatible (another) {
  32. return this.address.isCompatible(another);
  33. }
  34. }