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

v2.6.0 #88

Merged
merged 4 commits into from
Jan 12, 2024
Merged
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
20 changes: 10 additions & 10 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@itheum/sdk-mx-data-nft",
"version": "2.5.0",
"version": "2.6.0",
"description": "SDK for Itheum's Data NFT Technology on MultiversX Blockchain",
"main": "out/index.js",
"types": "out/index.d.js",
Expand All @@ -26,7 +26,7 @@
"jest": "29.7.0",
"ts-jest": "29.1.1",
"tslint": "6.1.3",
"typedoc": "0.25.4",
"typedoc": "0.25.7",
"typescript": "5.3.3"
},
"repository": {
Expand Down
73 changes: 39 additions & 34 deletions src/abis/data-nft-lease.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,36 +468,16 @@
]
},
{
"name": "getSftsFrozenForAddress",
"name": "getFrozenNonces",
"mutability": "readonly",
"inputs": [
{
"name": "address",
"type": "Address"
}
],
"inputs": [],
"outputs": [
{
"type": "variadic<u64>",
"multi_result": true
}
]
},
{
"name": "getFrozenCount",
"mutability": "readonly",
"inputs": [
{
"name": "address",
"type": "Address"
}
],
"outputs": [
{
"type": "u32"
}
]
},
{
"name": "isWhiteListEnabled",
"mutability": "readonly",
Expand Down Expand Up @@ -792,13 +772,8 @@
]
},
{
"identifier": "frozenSftsPerAddress",
"identifier": "frozenNfts",
"inputs": [
{
"name": "address",
"type": "Address",
"indexed": true
},
{
"name": "nonce",
"type": "u64",
Expand All @@ -807,13 +782,8 @@
]
},
{
"identifier": "unfrozenSftsPerAddress",
"identifier": "unfrozenNfts",
"inputs": [
{
"name": "address",
"type": "Address",
"indexed": true
},
{
"name": "nonce",
"type": "u64",
Expand Down Expand Up @@ -1040,6 +1010,41 @@
"indexed": true
}
]
},
{
"identifier": "claimRoyalties",
"inputs": [
{
"name": "claim_address",
"type": "Address",
"indexed": true
},
{
"name": "token_identifier",
"type": "EgldOrEsdtTokenIdentifier",
"indexed": true
},
{
"name": "nonce",
"type": "u64",
"indexed": true
},
{
"name": "amount",
"type": "BigUint",
"indexed": true
},
{
"name": "tax",
"type": "BigUint",
"indexed": true
},
{
"name": "tax_address",
"type": "Address",
"indexed": true
}
]
}
],
"hasCallback": true,
Expand Down
29 changes: 0 additions & 29 deletions src/minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,35 +137,6 @@ export abstract class Minter {
}
}

/**
* Retrieves a list of nonces that are frozen for address
* @param address The address to check
*/
async viewAddressFrozenNonces(address: IAddress): Promise<number[]> {
const interaction = this.contract.methodsExplicit.getSftsFrozenForAddress([
new AddressValue(address)
]);
const query = interaction.buildQuery();
const queryResponse = await this.networkProvider.queryContract(query);
const endpointDefinition = interaction.getEndpoint();
const { firstValue, returnCode } = new ResultsParser().parseQueryResponse(
queryResponse,
endpointDefinition
);
if (returnCode.isSuccess()) {
const returnValue = firstValue?.valueOf();
const frozenNonces: number[] = returnValue.map((nonce: any) =>
nonce.toNumber()
);
return frozenNonces;
} else {
throw new ErrContractQuery(
'viewAddressFrozenNonces',
returnCode.toString()
);
}
}

/**
* Creates a `burn` transaction
* @param senderAddress the address of the user
Expand Down
23 changes: 23 additions & 0 deletions src/nft-minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,29 @@ export class NftMinter extends Minter {
}
}

/**
* Retrieves a list of nonces that are frozen
*/
async viewFrozenNonces(): Promise<number[]> {
const interaction = this.contract.methodsExplicit.getFrozenNonces();
const query = interaction.buildQuery();
const queryResponse = await this.networkProvider.queryContract(query);
const endpointDefinition = interaction.getEndpoint();
const { firstValue, returnCode } = new ResultsParser().parseQueryResponse(
queryResponse,
endpointDefinition
);
if (returnCode.isSuccess()) {
const returnValue = firstValue?.valueOf();
const frozenNonces: number[] = returnValue.map((nonce: any) =>
nonce.toNumber()
);
return frozenNonces;
} else {
throw new ErrContractQuery('viewFrozenNonces', returnCode.toString());
}
}

/**
* Retrieves the address with update attributes roles for contract collection
*/
Expand Down
29 changes: 29 additions & 0 deletions src/sft-minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,35 @@ export class SftMinter extends Minter {
}
}

/**
* Retrieves a list of nonces that are frozen for address
* @param address The address to check
*/
async viewAddressFrozenNonces(address: IAddress): Promise<number[]> {
const interaction = this.contract.methodsExplicit.getSftsFrozenForAddress([
new AddressValue(address)
]);
const query = interaction.buildQuery();
const queryResponse = await this.networkProvider.queryContract(query);
const endpointDefinition = interaction.getEndpoint();
const { firstValue, returnCode } = new ResultsParser().parseQueryResponse(
queryResponse,
endpointDefinition
);
if (returnCode.isSuccess()) {
const returnValue = firstValue?.valueOf();
const frozenNonces: number[] = returnValue.map((nonce: any) =>
nonce.toNumber()
);
return frozenNonces;
} else {
throw new ErrContractQuery(
'viewAddressFrozenNonces',
returnCode.toString()
);
}
}

/**
* Creates an initialize contract transaction for the contract
* @param senderAddress The address of the sender, must be the admin of the contract
Expand Down