How to use the lisk-sdk.cryptography.getAddressFromPublicKey function in lisk-sdk

To help you get started, we’ve selected a few lisk-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-core / src / transactions / 6_in_transfer_transaction.ts View on Github external
id: this.asset.inTransfer.dappId,
			},
		]);

		const dappTransaction =
			transactions && transactions.length > 0
				? transactions.find(
						tx =>
							tx.type === TRANSACTION_DAPP_TYPE &&
							tx.id === this.asset.inTransfer.dappId
				  )
				: undefined;

		if (dappTransaction) {
			await store.account.cache([
				{ address: cryptography.getAddressFromPublicKey(dappTransaction.senderPublicKey) },
			]);
		}
	}
github LiskHQ / lisk-core / src / transactions / 6_in_transfer_transaction.ts View on Github external
this.asset.amount,
			this.fee
		);
		if (balanceError) {
			errors.push(balanceError);
		}

		const updatedBalance = new BigNum(sender.balance).sub(this.asset.amount);

		const updatedSender = { ...sender, balance: updatedBalance.toString() };

		store.account.set(updatedSender.address, updatedSender);

		const dappTransaction = store.transaction.get(this.asset.inTransfer.dappId);

		const recipient = store.account.get(cryptography.getAddressFromPublicKey(dappTransaction.senderPublicKey));

		const updatedRecipientBalance = new BigNum(recipient.balance).add(
			this.asset.amount
		);
		const updatedRecipient = {
			...recipient,
			balance: updatedRecipientBalance.toString(),
		};

		store.account.set(updatedRecipient.address, updatedRecipient);

		return errors;
	}
github LiskHQ / lisk-core / src / transactions / 6_in_transfer_transaction.ts View on Github external
protected undoAsset(store: transactions.StateStore): ReadonlyArray {
		const errors: transactions.TransactionError[] = [];
		const sender = store.account.get(this.senderId);
		const updatedBalance = new BigNum(sender.balance).add(this.asset.amount);
		const updatedSender = { ...sender, balance: updatedBalance.toString() };

		store.account.set(updatedSender.address, updatedSender);

		const dappTransaction = store.transaction.get(this.asset.inTransfer.dappId);

		const recipient = store.account.get(cryptography.getAddressFromPublicKey(dappTransaction.senderPublicKey));

		const updatedRecipientBalance = new BigNum(recipient.balance).sub(
			this.asset.amount
		);

		if (updatedRecipientBalance.lt(0)) {
			errors.push(
				new TransactionError(
					`Account does not have enough LSK: ${
						recipient.address
					}, balance: ${convertBeddowsToLSK(recipient.balance)}.`,
					this.id
				)
			);
		}
		const updatedRecipient = {