-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat(backend): Support Solana SPL as a custom token type #4462
Merged
Merged
Changes from 5 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
dd4dca7
Add comments
bitdivine 94dd476
test
bitdivine b1ea448
++
bitdivine ad0c112
validators
bitdivine 89f422f
Verify that inputs look valid
bitdivine 3fe988b
Simplify by removing the Serde code
bitdivine 4de6dce
Merge remote-tracking branch 'origin/main' into spl-token-backend
bitdivine 08d84e3
doc
bitdivine 1310bb8
Revert "Simplify by removing the Serde code"
bitdivine e9b59db
++
bitdivine a50f0dc
++
bitdivine 4b86a9c
🤖 Apply bindings changes
github-actions[bot] 3b6c913
++
bitdivine 8c13163
++
bitdivine 744a794
Merge remote-tracking branch 'origin/spl-token-backend' into spl-toke…
bitdivine ad2dcbe
++
bitdivine 83fa60d
++
bitdivine 57c5fe6
++
bitdivine 52e8d4b
Enable test
bitdivine 4715763
Merge remote-tracking branch 'origin/main' into spl-token-backend
bitdivine 8587d7a
++
bitdivine 7f1c6c5
++
bitdivine c3c8ea2
simplify
bitdivine 6d2e145
simplify
bitdivine f88e88c
Sanity check ICRC tokens
bitdivine d085f19
++
bitdivine 083bbac
Test ICRC1 validation
bitdivine 4a9b8bc
++
bitdivine 4b78833
++
bitdivine 3079356
++
bitdivine 875ae1d
Merge remote-tracking branch 'origin/main' into spl-token-backend
bitdivine addc38c
Make the token legal
bitdivine f915e45
test
bitdivine 6a0cb1e
test
bitdivine ca9b2dc
test
bitdivine f854100
Merge remote-tracking branch 'origin/main' into spl-token-backend
bitdivine 15011a8
++
bitdivine ddb68f5
Add sol devnet
bitdivine fc6c06d
devnet
bitdivine d3eb5e8
Clumsy solution to variant specialisation
bitdivine 0a60f03
🤖 Apply formatting changes
github-actions[bot] cb3a152
lint
bitdivine a9b4b49
🤖 Apply formatting changes
github-actions[bot] ba06e28
adjust TS tests
AntonioVentilii e82a9dc
Merge branch 'main' into spl-token-backend
bitdivine da773e9
Add a sol devnet token type
bitdivine 85cf22a
++
bitdivine 4e5c95a
Deep variant
bitdivine 31b1a8e
Revert "Deep variant"
bitdivine 1d1e4e4
Merge remote-tracking branch 'origin/main' into spl-token-backend
bitdivine fde7b19
🤖 Apply bindings changes
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//! Tests for the types module. | ||
|
||
mod custom_token { | ||
//! Tests for the custom_token module. | ||
use candid::{Decode, Encode}; | ||
|
||
use crate::types::custom_token::*; | ||
use crate::types::Validate; | ||
|
||
const SPL_TEST_VECTORS: [(&str, bool); 4] = [ | ||
("", false), | ||
("1", false), | ||
("11111111111111111111111111111111", true), | ||
( | ||
"11111111111111111111111111111111111111111111111111111111111111111111111111111111", | ||
false, | ||
), | ||
]; | ||
|
||
#[test] | ||
fn spl_token_id_parsing_validation_works() { | ||
for (input, expected) in SPL_TEST_VECTORS.iter() { | ||
let input = SplTokenId(input.to_string()); | ||
let result = input.validate(); | ||
assert_eq!(*expected, result.is_ok()); | ||
} | ||
} | ||
#[ignore] // This does NOT currently work for candid | ||
#[test] | ||
fn spl_token_validation_works_for_candid() { | ||
for (input, expected) in SPL_TEST_VECTORS.iter() { | ||
let spl_token_id = SplTokenId(input.to_string()); | ||
|
||
let candid = Encode!(&spl_token_id).unwrap(); | ||
let result: Result<SplTokenId, _> = Decode!(&candid, SplTokenId); | ||
assert_eq!(*expected, result.is_ok()); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bs58
is used to verify that the token ID is a valid base58 encoded 32 byte value.