-
Notifications
You must be signed in to change notification settings - Fork 0
Add Anchor examples basic #13
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
base: main
Are you sure you want to change the base?
Conversation
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.
29fe205 to
ee3f30f
Compare
README.md
Outdated
| - **delegate-approve** - Approve delegate | ||
| - [Action](typescript-client/actions/delegate-approve.ts) | ||
| - **delegate-revoke** - Revoke delegate | ||
| - [Action](typescript-client/actions/delegate-revoke.ts) | ||
|
|
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.
revert?
| pub mod light_token_anchor_transfer_interface { | ||
| use super::*; | ||
|
|
||
| pub fn transfer(ctx: Context<TransferAccounts>, amount: u64, decimals: u8) -> Result<()> { |
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.
this wont work with spl or t22 only light to light.
Pls extend so that it works with any token
e389743 to
09acd52
Compare
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.
| declare_id!("672fL1Nm191MbPoygNM9DRiG2psBELn97XUpGbU3jW7E"); | ||
|
|
||
| pub const LIGHT_CPI_SIGNER: CpiSigner = | ||
| derive_light_cpi_signer!("672fL1Nm191MbPoygNM9DRiG2psBELn97XUpGbU3jW7E"); |
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.
🟡 Duplicate program ID between create-and-transfer and token-transfer programs
Both create-and-transfer and token-transfer programs declare the same program ID 672fL1Nm191MbPoygNM9DRiG2psBELn97XUpGbU3jW7E and the same LIGHT_CPI_SIGNER.
Click to expand
Impact
Both programs are listed as workspace members in Anchor.toml (lines 13-14) and Cargo.toml (lines 9-10). When attempting to build or deploy both programs:
- Only one can be deployed to that address on-chain
- Build artifacts may overwrite each other
- The Anchor workspace will have conflicting program configurations
Code references
basic-macros/create-and-transfer/src/lib.rs:8:declare_id!("672fL1Nm191MbPoygNM9DRiG2psBELn97XUpGbU3jW7E")basic-macros/create-and-transfer/token-transfer/src/lib.rs:8:declare_id!("672fL1Nm191MbPoygNM9DRiG2psBELn97XUpGbU3jW7E")
The programs appear to be nearly identical code duplicates, suggesting token-transfer should either be removed or given a unique program ID.
Recommendation: Either remove the duplicate token-transfer program, or assign it a unique program ID by generating a new keypair and updating both the declare_id! and derive_light_cpi_signer! macros.
Was this helpful? React with 👍 or 👎 to provide feedback.
Basic instruction examples: approve, burn, close, create-ata, create-mint, create-token-account, freeze, mint-to, revoke, thaw, transfer-checked, transfer-interface. Basic macro examples: counter, create-ata, create-mint, create-token-account, create-and-transfer with token-transfer.
09acd52 to
6caa10b
Compare
Summary
programs/anchor/workspace with basic SPL token instruction examplesbasic-instructions/- approve, burn, close, create-ata, create-mint, create-token-account, freeze, mint-to, mint-to-checked, revoke, thaw, transfer-checked, transfer-interfacebasic-macros/- counter, create-ata, create-mint, create-token-accountTest plan
cargo test-sbfin each program directorycargo build-sbf