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

Expected input with 32 bytes (256 bits), found 31 bytes #889

Closed
lixianbin1 opened this issue Nov 16, 2022 · 8 comments · Fixed by #891
Closed

Expected input with 32 bytes (256 bits), found 31 bytes #889

lixianbin1 opened this issue Nov 16, 2022 · 8 comments · Fixed by #891

Comments

@lixianbin1
Copy link

I am using assets. compliance. requirements CheckSettle() ,The compliance check was performed, but an error was reported. I passed the value according to the parameters in the wiki, but it was wrong. I used did and Identity, but they all prompted me with errors

//......
const assets = await this.api.assets.getAsset({
    ticker:"LXB"
});
const checkSettle = await assets.compliance.requirements.checkSettle({
    // from:leg.from.owner,
    to:leg.to.owner,
})
@lixianbin1
Copy link
Author

I tried to use assets.settlements.canTransfer, but there is a problem. If A has AICE assets and has issued 600 tokens, and then he transfers them to B 500 tokens, then when B calls assets.settlements.canTransfer to check, the dashboard will prompt that the balance is insufficient, because AICE 500 tokens have been locked and cannot be created again, but A has enough balance to pay, and B can accept(), I think this method is used when creating transfer assets. What if I want to check the settlement information at the receiver?

@F-OBrien
Copy link
Collaborator

What you have stated is the described behavior of canTransfer per the documentation.
See https://github.com/PolymeshAssociation/polymesh-sdk/wiki/api.entities.Asset.Settlements.Settlements#cantransfer

@F-OBrien
Copy link
Collaborator

I am using assets. compliance. requirements CheckSettle() ,The compliance check was performed, but an error was reported. I passed the value according to the parameters in the wiki, but it was wrong. I used did and Identity, but they all prompted me with errors

//......
const assets = await this.api.assets.getAsset({
    ticker:"LXB"
});
const checkSettle = await assets.compliance.requirements.checkSettle({
    // from:leg.from.owner,
    to:leg.to.owner,
})

Thanks for bringing this to our attention. We have replicated your issue and we will investigate.

polymath-eric added a commit that referenced this issue Nov 17, 2022
resolve issue where the types were not being created as Option for
canSettle checks

✅ Closes: #889
@polymath-eric polymath-eric self-assigned this Nov 17, 2022
polymath-eric added a commit that referenced this issue Nov 17, 2022
resolve issue where the types were not being created as Option for
canSettle checks

✅ Closes: #889
@F-OBrien
Copy link
Collaborator

@lixianbin1 as per above you will see Eric has proposed a fix for the type issue with canSettle. You also likely noticed canSettle is marked as deprecated with the suggestion to use canTransfer instead so we would recommend against its use going forward.

The issue you highlighted with canTransfer on already affirmed settlement legs is as it is intended to behave. canTransfer is primarily used before affirming a settlement instructions and considers free balance in addition to compliance rules. i.e. if you want to transfer an additional 500 tokens but you didn't have enough free balance it should correctly fail even if you had a balance greater than 500 when counting locked and unlocked tokens.

If you want to verify compliance requirements for an already affirmed instruction, e.g. prior to finalizing the last leg of the settlement instruction, you can still use canTransfer but you should set the amount to 0 (or less than the available free balance).

const canTransferResult = await myAsset.settlements.canTransfer({
  from: account1,
  to: account2,
  amount: new BigNumber(0),
});

@lixianbin1
Copy link
Author

@F-OBrien OK, thank you very much for your help.

polymath-eric added a commit that referenced this issue Nov 18, 2022
* fix: 🐛 asset.compliance.requirements.canSettle check

resolve issue where the types were not being created as Option for
canSettle checks

✅ Closes: #889

* docs: ✏️ add note to Requirements.canSettle deprecation notice
@prashantasdeveloper
Copy link
Collaborator

🎉 This issue has been resolved in version 18.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@prashantasdeveloper
Copy link
Collaborator

🎉 This issue has been resolved in version 19.0.0-beta.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@prashantasdeveloper
Copy link
Collaborator

🎉 This issue has been resolved in version 19.0.0-alpha.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants