diff --git a/src/app/_services/transaction.service.ts b/src/app/_services/transaction.service.ts index 4a46e73..c78642e 100644 --- a/src/app/_services/transaction.service.ts +++ b/src/app/_services/transaction.service.ts @@ -176,7 +176,7 @@ export class TransactionService { const hash = hashFunction.digest(); const methodSignature = hash.toString('hex').substring(0, 8); const abiCoder = new utils.AbiCoder(); - const abi = await abiCoder.encode( + const abi = abiCoder.encode( ['address', 'address', 'address', 'uint256'], [senderAddress, recipientAddress, tokenAddress, value] ); diff --git a/src/app/_services/user.service.ts b/src/app/_services/user.service.ts index 49c99f4..cf6a044 100644 --- a/src/app/_services/user.service.ts +++ b/src/app/_services/user.service.ts @@ -83,47 +83,18 @@ export class UserService { locationType: string, oldPhoneNumber: string ): Promise { - const accountInfo: any = { - vcard: { - fn: [{}], - n: [{}], - tel: [{}], - }, - location: {}, - }; - if (name) { - accountInfo.vcard.fn[0].value = name; - accountInfo.vcard.n[0].value = name.split(' '); - } - if (phoneNumber) { - accountInfo.vcard.tel[0].value = phoneNumber; - } - if (bio) { - accountInfo.products = [bio]; - } - if (gender) { - accountInfo.gender = gender; - } - if (age) { - accountInfo.age = age; - } - if (type) { - accountInfo.type = type; - } - if (businessCategory) { - accountInfo.category = businessCategory; - } - if (location) { - accountInfo.location.area = location; - } - if (userLocation) { - accountInfo.location.area_name = userLocation; - } - if (locationType) { - accountInfo.location.area_type = locationType; - } - await vcardValidation(accountInfo.vcard); - accountInfo.vcard = btoa(vCard.generate(accountInfo.vcard)); + const accountInfo = await this.loadChangesToAccountStructure( + name, + phoneNumber, + age, + type, + bio, + gender, + businessCategory, + userLocation, + location, + locationType + ); const accountKey: string = await User.toKey(address); this.getAccountDetailsFromMeta(accountKey) .pipe(first()) @@ -357,4 +328,60 @@ export class UserService { } this.accountsList.next(this.accounts); } + + async loadChangesToAccountStructure( + name: string, + phoneNumber: string, + age: string, + type: string, + bio: string, + gender: string, + businessCategory: string, + userLocation: string, + location: string, + locationType: string + ): Promise { + const accountInfo: any = { + vcard: { + fn: [{}], + n: [{}], + tel: [{}], + }, + location: {}, + }; + if (name) { + accountInfo.vcard.fn[0].value = name; + accountInfo.vcard.n[0].value = name.split(' '); + } + if (phoneNumber) { + accountInfo.vcard.tel[0].value = phoneNumber; + } + if (bio) { + accountInfo.products = [bio]; + } + if (gender) { + accountInfo.gender = gender; + } + if (age) { + accountInfo.age = age; + } + if (type) { + accountInfo.type = type; + } + if (businessCategory) { + accountInfo.category = businessCategory; + } + if (location) { + accountInfo.location.area = location; + } + if (userLocation) { + accountInfo.location.area_name = userLocation; + } + if (locationType) { + accountInfo.location.area_type = locationType; + } + await vcardValidation(accountInfo.vcard); + accountInfo.vcard = btoa(vCard.generate(accountInfo.vcard)); + return accountInfo; + } }