Skip to content

Commit

Permalink
chore(js-dash-sdk): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pshenmic committed Feb 4, 2025
1 parent ee79545 commit 78d2ac9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import DAPIClient from '@dashevo/dapi-client';
import { Identifier } from '@dashevo/wasm-dpp';

type NonceState = {
value: BigInt,
value: bigint,
lastFetchedAt: number,
};

Expand All @@ -23,7 +23,7 @@ class NonceManager {
this.identityContractNonce = new Map();
}

public setIdentityNonce(identityId: Identifier, nonce: BigInt) {
public setIdentityNonce(identityId: Identifier, nonce: bigint) {
const identityIdStr = identityId.toString();
const nonceState = this.identityNonce.get(identityIdStr);

Expand All @@ -37,7 +37,7 @@ class NonceManager {
}
}

public async getIdentityNonce(identityId: Identifier): Promise<BigInt> {
public async getIdentityNonce(identityId: Identifier): Promise<bigint> {
const identityIdStr = identityId.toString();
let nonceState = this.identityNonce.get(identityIdStr);

Expand Down Expand Up @@ -71,13 +71,13 @@ class NonceManager {
return nonceState.value;
}

public async bumpIdentityNonce(identityId: Identifier): Promise<BigInt> {
public async bumpIdentityNonce(identityId: Identifier): Promise<bigint> {
const nextIdentityNonce = (await this.getIdentityNonce(identityId));
this.setIdentityNonce(identityId, nextIdentityNonce);
return nextIdentityNonce;
}

public setIdentityContractNonce(identityId: Identifier, contractId: Identifier, nonce: BigInt) {
public setIdentityContractNonce(identityId: Identifier, contractId: Identifier, nonce: bigint) {
const identityIdStr = identityId.toString();
const contractIdStr = contractId.toString();

Expand All @@ -103,7 +103,7 @@ class NonceManager {
public async getIdentityContractNonce(
identityId: Identifier,
contractId: Identifier,
): Promise<BigInt> {
): Promise<bigint> {
const identityIdStr = identityId.toString();
const contractIdStr = contractId.toString();

Expand Down Expand Up @@ -151,7 +151,7 @@ class NonceManager {
public async bumpIdentityContractNonce(
identityId: Identifier,
contractId: Identifier,
): Promise<BigInt> {
): Promise<bigint> {
const identityContractNonce = await this.getIdentityContractNonce(identityId, contractId);
// @ts-ignore
const nextIdentityContractNonce = identityContractNonce + 1n;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function update(
.bumpIdentityContractNonce(identityId, dataContractId);

const dataContractUpdateTransition = dpp.dataContract
.createDataContractUpdateTransition(updatedDataContract, BigInt(identityContractNonce));
.createDataContractUpdateTransition(updatedDataContract, identityContractNonce);

this.logger.silly(`[DataContract#update] Created data contract update transition ${dataContract.getId()}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default async function broadcast(

const documentsBatchTransition = dpp.document.createStateTransition(documents, {
[identityId.toString()]: {
[dataContractId.toString()]: identityContractNonce.toString(),
[dataContractId.toString()]: identityContractNonce,
},
});

Expand Down

0 comments on commit 78d2ac9

Please sign in to comment.