Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing bugs #221

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/locales/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@
"title": "Add Account",
"name": "Account name",
"type": "Account type",
"seed": "Seed index (blank for automatic increase)",
"seed": "Seed account index (blank for automatic increase)",
"fromSeed": "Add seed account from mnemonics",
"createSeed": "Add account",
"fromPk": "Import account by private key",
Expand Down
1 change: 1 addition & 0 deletions src/screens/CreateAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class CreateAccount extends Component {
placeholder={translate('createAccount.seed')}
theme="light"
fullWidth
keyboardType='numeric'
onChangeText={val => this.handleIndexChange(val)}
/>
</Section>
Expand Down
17 changes: 14 additions & 3 deletions src/services/QRService.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
TransactionType,
Address,
CosignatureSignedTransaction,
SignedTransaction
SignedTransaction,
RepositoryFactoryHttp,
Mosaic,
UInt64
} from 'symbol-sdk';
import MosaicService from './MosaicService';
import NetworkService from './NetworkService';
Expand Down Expand Up @@ -81,11 +84,19 @@ export default class {
};

static parseRequestTransaction = async (data, network) => {
let networkCurrency = undefined;
const transaction = TransactionMapping.createFromPayload(data.data.payload);
if(transaction.type !== TransactionType.TRANSFER)
throw Error('Transaction type is not a transfer');
if(!transaction.mosaics[0]){
networkCurrency = await new RepositoryFactoryHttp(network.node, {
networkType: network.networkType,
generationHash: network.generationHashSeed
}).getCurrencies().toPromise()
}

const formattedMosaic = await this.formatMosaic(transaction.mosaics[0], network);
const mosaic = transaction.mosaics[0] || (new Mosaic(networkCurrency.currency.mosaicId, UInt64.fromUint(0)));
const formattedMosaic = await this.formatMosaic(mosaic, network);
const formatedTransaction = {
recipientAddress: transaction.recipientAddress.pretty(),
message: transaction.message.payload,
Expand Down Expand Up @@ -135,4 +146,4 @@ export default class {

return formattedMosaic;
}
}
}