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

Feature nft allowance tests #1468

Merged
merged 16 commits into from
Feb 23, 2023
Merged

Feature nft allowance tests #1468

merged 16 commits into from
Feb 23, 2023

Conversation

petreze
Copy link
Contributor

@petreze petreze commented Feb 20, 2023

Description:
This PR adds example as well as integration tests around the functionalities provided in HIP-336

Related issue(s):

Fixes #1469

Notes for reviewer:

Show functionalities around approve/delete an allowance for:

  1. single NFT serial numbers
  2. all serial numbers at once
  3. delegating spender obligations

Note that the concept around the ERC standard that Hedera implements in regards
to the allowances for NFTs does not allow users to:

  1. approve allowance for all serials in a NFT collection, then remove allowance for individual serial of the NFT
  2. approve allowance for individual serial of the NFT, then remove allowance for all serials in the NFT collection

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

ochikov and others added 13 commits February 3, 2023 11:39
#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>
* init progress

Signed-off-by: Petar Tonev <[email protected]>

* Extend ethereum flow to accept maxChunks

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: Petar Tonev <[email protected]>
* small refactoring

Signed-off-by: Petar Tonev <[email protected]>

* Fix/update mirror endpoints (#1448)

* Fix _maxAutomaticTokenAssociations in contract create and contract up… (#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Update the mirror node endpoints

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* add missing functionalities from hip-336 nft allowances

Signed-off-by: Petar Tonev <[email protected]>

* small description typo

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>
Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Signed-off-by: ochikov <[email protected]>
Signed-off-by: ochikov <[email protected]>
Signed-off-by: Petar Tonev <[email protected]>
@petreze petreze self-assigned this Feb 20, 2023
@codecov
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

Base: 83.34% // Head: 83.45% // Increases project coverage by +0.10% 🎉

Coverage data is based on head (ab443d3) compared to base (021459b).
Patch coverage: 68.70% of modified lines in pull request are covered.

❗ Current head ab443d3 differs from pull request most recent head 901877e. Consider uploading reports for the commit 901877e to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1468      +/-   ##
===========================================
+ Coverage    83.34%   83.45%   +0.10%     
===========================================
  Files          295      295              
  Lines        73066    73299     +233     
===========================================
+ Hits         60900    61170     +270     
+ Misses       12166    12129      -37     
Impacted Files Coverage Δ
src/Key.js 84.81% <0.00%> (-4.53%) ⬇️
src/ObjectMap.js 93.75% <0.00%> (ø)
src/account/AccountAllowanceAdjustTransaction.js 49.21% <0.00%> (-0.20%) ⬇️
src/account/AccountUpdateTransaction.js 70.29% <0.00%> (ø)
src/client/addressbooks/mainnet.js 100.00% <ø> (ø)
src/topic/TopicMessageQuery.js 65.86% <0.00%> (-4.77%) ⬇️
src/util.js 90.41% <19.44%> (-6.04%) ⬇️
src/network/AddressBookQuery.js 86.78% <28.57%> (+17.64%) ⬆️
src/Executable.js 89.68% <33.33%> (-0.11%) ⬇️
src/account/AccountInfo.js 78.84% <50.00%> (ø)
... and 36 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@petreze petreze linked an issue Feb 21, 2023 that may be closed by this pull request
@petreze petreze marked this pull request as ready for review February 21, 2023 12:19
Signed-off-by: Petar Tonev <[email protected]>
@sonarcloud
Copy link

sonarcloud bot commented Feb 21, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
26.1% 26.1% Duplication

@ochikov ochikov merged commit 381c733 into develop Feb 23, 2023
@ochikov ochikov deleted the feature/nft-allowance-tests branch February 23, 2023 14:43
petreze added a commit that referenced this pull request Mar 7, 2023
* add new status codes (#1400)

Signed-off-by: Petar Tonev <[email protected]>

Signed-off-by: Petar Tonev <[email protected]>

* Release/v2.20.0 beta.4 (#1431)

* added some supportability for hip-583

Signed-off-by: Petar Tonev <[email protected]>

* added deprecation of methods and some refactoring

Signed-off-by: Petar Tonev <[email protected]>

* remove unused aliasEvmAddress field

Signed-off-by: Petar Tonev <[email protected]>

* added creation of AccountId examples

Signed-off-by: Petar Tonev <[email protected]>

* AccountId examples refactoring

Signed-off-by: Petar Tonev <[email protected]>

* init hip583 examples

Signed-off-by: Petar Tonev <[email protected]>

* add examples and fix tx model

Signed-off-by: Petar Tonev <[email protected]>

* after lint

Signed-off-by: Petar Tonev <[email protected]>

* almost finalized the examples, getting data from mirror node works

Signed-off-by: Petar Tonev <[email protected]>

* new proto package version version

Signed-off-by: ochikov <[email protected]>

* use newer version for protobufs

Signed-off-by: ochikov <[email protected]>

* proto updates and examples enhancements

Signed-off-by: Petar Tonev <[email protected]>

* fixed build errors

Signed-off-by: Petar Tonev <[email protected]>

* update the proto package install task

Signed-off-by: ochikov <[email protected]>

* adjusted hip-583 examples

Signed-off-by: Petar Tonev <[email protected]>

* example updates and fixes

Signed-off-by: Petar Tonev <[email protected]>

* update examples and remove unnecessary step

Signed-off-by: Petar Tonev <[email protected]>

* add fromEvmPublicAddress() to AccountId

Signed-off-by: Petar Tonev <[email protected]>

* transfer using evm address enhancements

Signed-off-by: Petar Tonev <[email protected]>

* fixed all of the examples plus added 2 new status codes from services

Signed-off-by: Petar Tonev <[email protected]>

* New proto version

Signed-off-by: ochikov <[email protected]>

* make the sdk to use new proto version

Signed-off-by: ochikov <[email protected]>

* fixed proto files

Signed-off-by: Petar Tonev <[email protected]>

* remove status codes, need separate branch

Signed-off-by: Petar Tonev <[email protected]>

* add new status codes

Signed-off-by: Petar Tonev <[email protected]>

* fixed lint errors after task build

Signed-off-by: Petar Tonev <[email protected]>

* update pnpm lock files

Signed-off-by: ochikov <[email protected]>

* Update the package.json version

Signed-off-by: ochikov <[email protected]>

* Fix/timeout issue (#1414)

* add new status codes (#1400)

Signed-off-by: Petar Tonev <[email protected]>

Signed-off-by: Petar Tonev <[email protected]>

* Fix the workflow for address book update and the workflow for timeout error processing

Signed-off-by: ochikov <[email protected]>

* Integration tests fixes with new account and logging of the failed address book query

Signed-off-by: ochikov <[email protected]>

* remove unused imports

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: petreze <[email protected]>

* Update package.json

Signed-off-by: ochikov <[email protected]>

* Update package.json

Signed-off-by: ochikov <[email protected]>

* fix ping to throw (#1426)

Signed-off-by: ochikov <[email protected]>

* Bump up dependencies (#1402)

* add new status codes (#1400)

Signed-off-by: Petar Tonev <[email protected]>

Signed-off-by: Petar Tonev <[email protected]>

* Bump up dependencies

Signed-off-by: ochikov <[email protected]>

* Cast the values so TS won't throw an error

Signed-off-by: ochikov <[email protected]>

* update package.json with new versions

Signed-off-by: ochikov <[email protected]>

* revert the grpc version update due to breaking changes

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: petreze <[email protected]>

* removed unnecessary check

Signed-off-by: Petar Tonev <[email protected]>

* revert refactor

Signed-off-by: Petar Tonev <[email protected]>

* Removed unnecessary check (#1429)

* removed unnecessary check

Signed-off-by: Petar Tonev <[email protected]>

* Update package.json of cryptography

Signed-off-by: ochikov <[email protected]>

* update the cryptography package used in the sdk

Signed-off-by: ochikov <[email protected]>

* fix integration test for topic message query

Signed-off-by: ochikov <[email protected]>

* remove the only from the failing test

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>

* Fix inaccurate cost calculation (#1430)

* fix inaccurate cost calculation

Signed-off-by: Petar Tonev <[email protected]>

* rename misleading comment

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>

* update the package version

Signed-off-by: ochikov <[email protected]>

* fix get cost and unit test

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: Petar Tonev <[email protected]>

* chore(deps-dev): bump typescript in /examples/react-native-example (#1438)

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.4 to 4.9.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v4.9.4...v4.9.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump react-native in /examples/react-native-example (#1437)

Bumps [react-native](https://github.com/facebook/react-native) from 0.71.1 to 0.71.2.
- [Release notes](https://github.com/facebook/react-native/releases)
- [Changelog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md)
- [Commits](facebook/react-native@v0.71.1...v0.71.2)

---
updated-dependencies:
- dependency-name: react-native
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump react-native-web in /examples/react-native-example (#1436)

Bumps [react-native-web](https://github.com/necolas/react-native-web) from 0.18.10 to 0.18.12.
- [Release notes](https://github.com/necolas/react-native-web/releases)
- [Commits](necolas/react-native-web@0.18.10...0.18.12)

---
updated-dependencies:
- dependency-name: react-native-web
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump ua-parser-js in /examples/react-native-example (#1435)

Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.31 to 0.7.33.
- [Release notes](https://github.com/faisalman/ua-parser-js/releases)
- [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md)
- [Commits](faisalman/ua-parser-js@0.7.31...0.7.33)

---
updated-dependencies:
- dependency-name: ua-parser-js
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump decode-uri-component in /examples/react-native-example (#1434)

Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update axios

Signed-off-by: ochikov <[email protected]>

* update the playwright package

Signed-off-by: ochikov <[email protected]>

* Fix/update mirror endpoints (#1448)

* Fix _maxAutomaticTokenAssociations in contract create and contract up… (#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Update the mirror node endpoints

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Release/v2.20.0 (#1464)

* Fix _maxAutomaticTokenAssociations in contract create and contract up… (#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Feature/extend ethereumflow (#1447)

* init progress

Signed-off-by: Petar Tonev <[email protected]>

* Extend ethereum flow to accept maxChunks

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: Petar Tonev <[email protected]>

* Add delete nft allowances and add delegate spender functionality (#1452)

* small refactoring

Signed-off-by: Petar Tonev <[email protected]>

* Fix/update mirror endpoints (#1448)

* Fix _maxAutomaticTokenAssociations in contract create and contract up… (#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Update the mirror node endpoints

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* add missing functionalities from hip-336 nft allowances

Signed-off-by: Petar Tonev <[email protected]>

* small description typo

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>

* TokenWipe test twean and fix the version in package.json

Signed-off-by: ochikov <[email protected]>

* remove entirely hip-583 supportability

Signed-off-by: Petar Tonev <[email protected]>

* after build

Signed-off-by: Petar Tonev <[email protected]>

* new cryptography version

Signed-off-by: ochikov <[email protected]>

* used new crypto package version and update the last proto version

Signed-off-by: ochikov <[email protected]>

* new proto packages

Signed-off-by: ochikov <[email protected]>

* new packages versions

Signed-off-by: ochikov <[email protected]>

* release/2.20.0

Signed-off-by: ochikov <[email protected]>

* export fee assessment method

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>
Signed-off-by: Petar Tonev <[email protected]>
Co-authored-by: Petar Tonev <[email protected]>

* Feature nft allowance tests (#1468)

* Fix _maxAutomaticTokenAssociations in contract create and contract up… (#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Feature/extend ethereumflow (#1447)

* init progress

Signed-off-by: Petar Tonev <[email protected]>

* Extend ethereum flow to accept maxChunks

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: Petar Tonev <[email protected]>

* Add delete nft allowances and add delegate spender functionality (#1452)

* small refactoring

Signed-off-by: Petar Tonev <[email protected]>

* Fix/update mirror endpoints (#1448)

* Fix _maxAutomaticTokenAssociations in contract create and contract up… (#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Update the mirror node endpoints

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* add missing functionalities from hip-336 nft allowances

Signed-off-by: Petar Tonev <[email protected]>

* small description typo

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>

* TokenWipe test twean and fix the version in package.json

Signed-off-by: ochikov <[email protected]>

* remove entirely hip-583 supportability

Signed-off-by: Petar Tonev <[email protected]>

* after build

Signed-off-by: Petar Tonev <[email protected]>

* new cryptography version

Signed-off-by: ochikov <[email protected]>

* used new crypto package version and update the last proto version

Signed-off-by: ochikov <[email protected]>

* new proto packages

Signed-off-by: ochikov <[email protected]>

* new packages versions

Signed-off-by: ochikov <[email protected]>

* release/2.20.0

Signed-off-by: ochikov <[email protected]>

* export fee assessment method

Signed-off-by: Petar Tonev <[email protected]>

* add tests and examples for add/remove nft allowances

Signed-off-by: Petar Tonev <[email protected]>

* separate nft allowance integration tests

Signed-off-by: Petar Tonev <[email protected]>

* update test description

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>
Signed-off-by: Petar Tonev <[email protected]>
Co-authored-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>

* Release/hip 583 (#1472)

* init hip583

Signed-off-by: Petar Tonev <[email protected]>

* full support

Signed-off-by: Petar Tonev <[email protected]>

* fix example for nft allowances

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>

* update package.json

Signed-off-by: ochikov <[email protected]>

* release/v2.22.0

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: petreze <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
monokaijs pushed a commit to monostarter/u2u-sdk-js that referenced this pull request Jul 5, 2023
* Fix _maxAutomaticTokenAssociations in contract create and contract up… (hashgraph#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Feature/extend ethereumflow (hashgraph#1447)

* init progress

Signed-off-by: Petar Tonev <[email protected]>

* Extend ethereum flow to accept maxChunks

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: Petar Tonev <[email protected]>

* Add delete nft allowances and add delegate spender functionality (hashgraph#1452)

* small refactoring

Signed-off-by: Petar Tonev <[email protected]>

* Fix/update mirror endpoints (hashgraph#1448)

* Fix _maxAutomaticTokenAssociations in contract create and contract up… (hashgraph#1444)

* Fix _maxAutomaticTokenAssociations in contract create and contract update transactions

Signed-off-by: ochikov <[email protected]>

* set the fields default to null

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* Update the mirror node endpoints

Signed-off-by: ochikov <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>

* add missing functionalities from hip-336 nft allowances

Signed-off-by: Petar Tonev <[email protected]>

* small description typo

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: Petar Tonev <[email protected]>
Signed-off-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>

* TokenWipe test twean and fix the version in package.json

Signed-off-by: ochikov <[email protected]>

* remove entirely hip-583 supportability

Signed-off-by: Petar Tonev <[email protected]>

* after build

Signed-off-by: Petar Tonev <[email protected]>

* new cryptography version

Signed-off-by: ochikov <[email protected]>

* used new crypto package version and update the last proto version

Signed-off-by: ochikov <[email protected]>

* new proto packages

Signed-off-by: ochikov <[email protected]>

* new packages versions

Signed-off-by: ochikov <[email protected]>

* release/2.20.0

Signed-off-by: ochikov <[email protected]>

* export fee assessment method

Signed-off-by: Petar Tonev <[email protected]>

* add tests and examples for add/remove nft allowances

Signed-off-by: Petar Tonev <[email protected]>

* separate nft allowance integration tests

Signed-off-by: Petar Tonev <[email protected]>

* update test description

Signed-off-by: Petar Tonev <[email protected]>

---------

Signed-off-by: ochikov <[email protected]>
Signed-off-by: Petar Tonev <[email protected]>
Co-authored-by: ochikov <[email protected]>
Co-authored-by: ochikov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide integration tests and example around NFT allowances
2 participants