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

fix(PE-7344): update handlers to integrate with token spec #59

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

atticusofsparta
Copy link
Contributor

@atticusofsparta atticusofsparta commented Jan 15, 2025

Updates handlers to match responses on like handlers from https://github.com/permaweb/aos/blob/main/blueprints/token.lua

Adds a new test specifically for this spec, apart from our existing balances test

@atticusofsparta atticusofsparta force-pushed the PE-7344-update-token-spec branch from fb07989 to 0d96d3a Compare January 15, 2025 21:06
Balance = tostring(balRes),
Ticker = Ticker,
Account = addressToCheck,
Address = addressToCheck,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left in for backwards compatibility

assert.strictEqual(typeof balanceData, 'string');
assert.strictEqual(typeof balanceTag, 'string');
assert.strictEqual(balanceData, balanceTag);
assert.strictEqual(Number.isInteger(parseInt(balanceData)), true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specific to ANTs - in the case of other tokens these would need to be modified to bint checking

)?.value;
assert(errorRef, 'Error notice is not a reply message');
const errorTag = errorMessage.Tags.find((t) => t.name === 'Error');
assert.strictEqual(errorTag.value, 'Insufficient Balance!');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is mainly for integration with other platforms i wasn't certain on how granular to go here, so decided on exact error messages being enforced.

Comment on lines 92 to 104
if msg.reply then
msg.reply({
Action = "Transfer-Error",
["Message-Id"] = msg.Id,
Error = "Insufficient Balance!",
})
else
ao.send({
Target = msg.From,
Action = "Transfer-Error",
["Message-Id"] = msg.Id,
Error = "Insufficient Balance!",
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense 79bd001

Copy link
Collaborator

@dtfiedler dtfiedler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap the msg.reply or ao.send and avoid using it everywhere

@atticusofsparta atticusofsparta merged commit e3863a5 into develop Jan 24, 2025
5 checks passed
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.

2 participants