difftreelog
feat add bitintToDecimals and sovereign account util
in: master
1 file changed
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth253 return isSuccess;253 return isSuccess;254 }254 }255256 static bigIntToDecimals(number: bigint, decimals = 18) {257 const numberStr = number.toString();258 const dotPos = numberStr.length - decimals;259 260 if (dotPos <= 0) {261 return '0.' + '0'.repeat(Math.abs(dotPos)) + numberStr;262 } else {263 const intPart = numberStr.substring(0, dotPos);264 const fractPart = numberStr.substring(dotPos);265 return intPart + '.' + fractPart;266 }267 }255}268}256269257class UniqueEventHelper {270class UniqueEventHelper {2283 return CrossAccountId.translateSubToEth(subAddress);2296 return CrossAccountId.translateSubToEth(subAddress);2284 }2297 }22982299 paraSiblingSovereignAccount(paraid: number) {2300 // We are getting a *sibling* parachain sovereign account,2301 // so we need a sibling prefix: encoded(b"sibl") == 0x7369626c2302 const siblingPrefix = '0x7369626c';23032304 const encodedParaId = this.helper.getApi().createType('u32', paraid).toHex(true).substring(2);2305 const suffix = '000000000000000000000000000000000000000000000000';23062307 return siblingPrefix + encodedParaId + suffix;2308 }2285}2309}228623102287class StakingGroup extends HelperGroup<UniqueHelper> {2311class StakingGroup extends HelperGroup<UniqueHelper> {2601 super(logger, options.helperBase ?? UniqueHelper);2625 super(logger, options.helperBase ?? UniqueHelper);260226262603 this.balance = new BalanceGroup(this);2627 this.balance = new BalanceGroup(this);2604 this.address = new AddressGroup(this);2605 this.collection = new CollectionGroup(this);2628 this.collection = new CollectionGroup(this);2606 this.nft = new NFTGroup(this);2629 this.nft = new NFTGroup(this);2607 this.rft = new RFTGroup(this);2630 this.rft = new RFTGroup(this);