{"version":3,"sources":["https://lively-kernel.org/lively4/lively4-core/src/blockchain/model/transaction/transactionOutput.js"],"names":["forge","TransactionOutput","constructor","receiverWallet","value","receiverHash","hash","_hash","transactionHash","displayName","substring","transactionDisplayName","receiverDisplayName","sha256","md","create","update","Date","now","digest","toHex"],"mappings":";;;;;;AAAOA,W;;;;;;;;;;;AAAAA,gD;;;;;;;AAEQ,YAAMC,iBAAN,CAAwB;AACrCC,oBAAYC,cAAZ,EAA4BC,KAA5B,EAAmC;AACjC,eAAKC,YAAL,GAAoBF,eAAeG,IAAnC;AACA,eAAKF,KAAL,GAAaA,KAAb;AACA,eAAKE,IAAL,GAAY,KAAKC,KAAL,EAAZ;AACA,eAAKC,eAAL,GAAuB,EAAvB;AACD;;AAED,YAAIC,WAAJ,GAAkB;AAChB,cAAI,CAAC,KAAKH,IAAV,EAAgB;AACd,mBAAO,WAAP;AACD;;AAED,iBAAO,MAAM,KAAKA,IAAL,CAAUI,SAAV,CAAoB,CAApB,EAAuB,EAAvB,CAAb;AACD;;AAED,YAAIC,sBAAJ,GAA6B;AAC3B,cAAI,CAAC,KAAKH,eAAV,EAA2B;AACzB,mBAAO,WAAP;AACD;;AAED,iBAAO,MAAM,KAAKA,eAAL,CAAqBE,SAArB,CAA+B,CAA/B,EAAkC,EAAlC,CAAb;AACD;;AAED,YAAIE,mBAAJ,GAA0B;AACxB,cAAI,CAAC,KAAKP,YAAV,EAAwB;AACtB,mBAAO,WAAP;AACD;;AAED,iBAAO,MAAM,KAAKA,YAAL,CAAkBK,SAAlB,CAA4B,CAA5B,EAA+B,EAA/B,CAAb;AACD;;AAEDH,gBAAQ;AACN,gBAAMM,SAASb,MAAMc,EAAN,CAASD,MAAT,CAAgBE,MAAhB,EAAf;AACAF,iBAAOG,MAAP,CACEC,KAAKC,GAAL,KACA,KAAKb,YADL,GAEA,KAAKD,KAHP;AAKA,iBAAOS,OAAOM,MAAP,GAAgBC,KAAhB,EAAP;AACD;AAxCoC;;yBAAlBnB,iB;;;;;;;;6BAAAA,kD","file":"transactionOutput.js","sourcesContent":["import forge from 'node_modules/node-forge/dist/forge.min.js';\n\nexport default class TransactionOutput {\n  constructor(receiverWallet, value) {\n    this.receiverHash = receiverWallet.hash;\n    this.value = value;\n    this.hash = this._hash();\n    this.transactionHash = \"\";\n  }\n  \n  get displayName() {\n    if (!this.hash) {\n      return \"#NotAName\";\n    }\n    \n    return \"#\" + this.hash.substring(0, 10);\n  }\n  \n  get transactionDisplayName() {\n    if (!this.transactionHash) {\n      return \"#NotAName\";\n    }\n    \n    return \"#\" + this.transactionHash.substring(0, 10);\n  }\n  \n  get receiverDisplayName() {\n    if (!this.receiverHash) {\n      return \"#NotAName\";\n    }\n    \n    return \"#\" + this.receiverHash.substring(0, 10);\n  }\n  \n  _hash() {\n    const sha256 = forge.md.sha256.create();\n    sha256.update(\n      Date.now() + \n      this.receiverHash + \n      this.value\n    );\n    return sha256.digest().toHex();\n  }\n}"]}