简体   繁体   English

Solana spl 代币转账 python

[英]Solana spl token transfer python

I need to automatically transfer NFT from one wallet to another.我需要自动将 NFT 从一个钱包转移到另一个钱包。 I'm using python and couldn't find information anywhere on how to do this.我正在使用 python 并且在任何地方都找不到有关如何执行此操作的信息。 Here is an example transaction https://solscan.io/tx/4JaLzHB44rBA74YiFV2kjDeVu79qWdvcwDiuDdwML9XtysXHchwWwMN4KuGuJph83m8JH56cgXEMMCC2u3cuxqPM .这是一个示例交易https://solscan.io/tx/4JaLzHB44rBA74YiFV2kjDeVu79qWdvcwDiuDdwML9XtysXHchwWwMN4KuGuJph83m8JH56cgXEMMCC2u3cuxqPM The only thing I could find is this How to transfer custom token by '@solana/web3.js' but I'm very far from JS.我唯一能找到的是如何通过'@solana/web3.js'传输自定义令牌,但我离JS很远。 As I understand it, I need to create something like splToken.Token.createTransferInstruction but I could not find an analogue for python.据我了解,我需要创建类似splToken.Token.createTransferInstruction的东西,但我找不到 python 的类似物。 And I also don't understand what token they are transferring, because I don't see the token id anywhere.而且我也不明白他们在转移什么令牌,因为我在任何地方都看不到令牌 ID。 If someone can help - I will be very grateful.如果有人可以提供帮助 - 我将非常感激。 thanks in advance.提前致谢。

In python, you can use the SPL token client included in the solana-py repo at https://github.com/michaelhly/solana-py/tree/master/src/spl/token在 python 中,您可以使用https://github.com/michaelhly/solana-py/tree/master/src/spl/tokensolana-py库中包含的 SPL 令牌客户端

Here's an integration test using transfer_checked , same as the SolScan transaction that you linked: https://github.com/michaelhly/solana-py/blob/f41f020938d1fb257142f18608bcb884adb54479/tests/integration/test_token_client.py#L231这是使用transfer_checked的集成测试,与您链接的 SolScan 事务相同: https://github.com/michaelhly/solana-py/blob/f41f020938d1fb257142f18608bcb884adb54479/tests/integration/test_token_client#23

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM