Skip to content

Commit

Permalink
Merge pull request #1007 from novasamatech/rc/1.0.5-124
Browse files Browse the repository at this point in the history
Release candidate - 1.0.5
  • Loading branch information
stepanLav authored Aug 5, 2023
2 parents bb61414 + dacbede commit 305114f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nova-spektr",
"description": "Polkadot Enterprise application",
"version": "1.0.4",
"version": "1.0.5",
"main": "./release/build/main.js",
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/services/transaction/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type ITransactionService = {
getTransactionDeposit: (threshold: Threshold, api: ApiPromise) => string;
getTransactionHash: (transaction: Transaction, api: ApiPromise) => HashData;
decodeCallData: (api: ApiPromise, accountId: Address, callData: CallData) => DecodedTransaction;
verifySignature: (payload: string | Uint8Array, signature: HexString, accountId: AccountId) => Boolean;
verifySignature: (payload: Uint8Array, signature: HexString, accountId: AccountId) => Boolean;
};

// =====================================================
Expand Down
14 changes: 8 additions & 6 deletions src/renderer/services/transaction/transactionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
UnsignedTransaction,
} from '@substrate/txwrapper-polkadot';
import { Weight } from '@polkadot/types/interfaces';
import { signatureVerify } from '@polkadot/util-crypto';
import { blake2AsU8a, signatureVerify } from '@polkadot/util-crypto';

import { AccountId, HexString, Threshold } from '@renderer/domain/shared-kernel';
import { Transaction, TransactionType } from '@renderer/domain/transaction';
Expand Down Expand Up @@ -99,7 +99,7 @@ export const useTransaction = (): ITransactionService => {
[TransactionType.ASSET_TRANSFER]: (transaction, info, options) => {
return methods.assets.transfer(
{
id: transaction.args.assetId,
id: transaction.args.asset,
target: transaction.args.dest,
amount: transaction.args.value,
},
Expand All @@ -113,7 +113,7 @@ export const useTransaction = (): ITransactionService => {
{
dest: transaction.args.dest,
amount: transaction.args.value,
currencyId: transaction.args.assetId,
currencyId: transaction.args.asset,
},
info,
options,
Expand All @@ -122,7 +122,7 @@ export const useTransaction = (): ITransactionService => {
{
dest: transaction.args.dest,
amount: transaction.args.value,
currencyId: transaction.args.assetId,
currencyId: transaction.args.asset,
},
info,
options,
Expand Down Expand Up @@ -440,8 +440,10 @@ export const useTransaction = (): ITransactionService => {
});
};

const verifySignature = (payload: string | Uint8Array, signature: HexString, accountId: AccountId): Boolean => {
return signatureVerify(payload, signature, accountId).isValid;
const verifySignature = (payload: Uint8Array, signature: HexString, accountId: AccountId): Boolean => {
const payloadToVerify = payload.length > 256 ? blake2AsU8a(payload) : payload;

return signatureVerify(payloadToVerify, signature, accountId).isValid;
};

return {
Expand Down

0 comments on commit 305114f

Please sign in to comment.