Skip to content
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
48 changes: 42 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.54.0",
"@golevelup/nestjs-rabbitmq": "^4.0.0",
"@multiversx/sdk-core": "^13.2.2",
"@multiversx/sdk-core": "^15.0.0",
"@multiversx/sdk-exchange": "^0.2.21",
"@multiversx/sdk-nestjs-auth": "6.0.0",
"@multiversx/sdk-nestjs-cache": "6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/common/protocol/protocol.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class ProtocolService {
}

const shardCount = await this.getShardCount();
const addressHex = new Address(address).hex();
const addressHex = new Address(address).toHex();

return AddressUtils.computeShard(addressHex, shardCount);
}
Expand Down
25 changes: 13 additions & 12 deletions src/endpoints/transactions.batch/transactions.batch.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Address, Transaction as ErdJsTransaction, TransactionHash, TransactionOptions, TransactionPayload, TransactionVersion } from "@multiversx/sdk-core/out";
import { Signature } from "@multiversx/sdk-core/out/signature";
import { Address, Transaction as ErdJsTransaction, TransactionComputer } from "@multiversx/sdk-core";
import { BinaryUtils } from "@multiversx/sdk-nestjs-common";
import { CacheService } from "@multiversx/sdk-nestjs-cache";
import { Injectable, Logger } from "@nestjs/common";
Expand All @@ -19,12 +18,14 @@ import { TransactionCreate } from "../transactions/entities/transaction.create";
@Injectable()
export class TransactionsBatchService {
private readonly logger: Logger;
private readonly transactionComputer: TransactionComputer;

constructor(
private readonly cachingService: CacheService,
private readonly transactionService: TransactionService,
) {
this.logger = new Logger(TransactionsBatchService.name);
this.transactionComputer = new TransactionComputer();
}

async startTransactionBatch(batch: TransactionBatch, sourceIp: string): Promise<TransactionBatch> {
Expand All @@ -37,26 +38,26 @@ export class TransactionsBatchService {
const tx = item.transaction.tx;

const trans = new ErdJsTransaction({
nonce: tx.nonce,
value: tx.value,
nonce: BigInt(tx.nonce),
value: BigInt(tx.value || 0),
receiver: new Address(tx.receiver),
gasPrice: tx.gasPrice,
gasLimit: tx.gasLimit,
data: tx.data ? new TransactionPayload(BinaryUtils.base64Decode(tx.data ?? '')) : undefined,
gasPrice: BigInt(tx.gasPrice),
gasLimit: BigInt(tx.gasLimit),
data: tx.data ? new Uint8Array(Buffer.from(BinaryUtils.base64Decode(tx.data ?? ''), 'utf8')) : new Uint8Array(),
chainID: tx.chainID,
version: new TransactionVersion(tx.version),
options: tx.options ? new TransactionOptions(tx.options) : undefined,
version: tx.version,
options: tx.options || 0,
guardian: tx.guardian ? new Address(tx.guardian) : undefined,
sender: new Address(tx.sender),
});

if (tx.guardianSignature) {
trans.applyGuardianSignature(new Signature(tx.guardianSignature));
trans.guardianSignature = new Uint8Array(Buffer.from(tx.guardianSignature, 'hex'));
}

trans.applySignature(new Signature(tx.signature));
trans.signature = new Uint8Array(Buffer.from(tx.signature, 'hex'));

item.transaction.hash = TransactionHash.compute(trans).toString();
item.transaction.hash = this.transactionComputer.computeTransactionHash(trans);
}
}

Expand Down