[英]Use another Fee Payer for SOLANA spl-token Transfer
I was actually developing a token in SOLANA Blockchain and stuck in a place.我实际上是在 SOLANA 区块链中开发一个代币并被困在一个地方。 The problem is.问题是。
I need to transfer a custom token ( Eg: MyCustomToken ) I created ( Not SOL ) from one wallet to another and charge the gas fee from another wallet.我需要将我创建的自定义令牌(例如: MyCustomToken )(不是 SOL )从一个钱包转移到另一个钱包,并从另一个钱包收取汽油费。 So the process is,所以过程是,
Wallet A : The token Sender Wallet B : The token Reciever Wallet C : The Fee payer.钱包 A :代币发送者钱包 B :代币接收者钱包 C :费用支付者。
I saw that it is possible with --fee-payer argument in the case of SOLANA, but I haven't found a way for Tokens I created.我看到在 SOLANA 的情况下可以使用 --fee-payer 参数,但我还没有找到我创建的令牌的方法。 Is there a good solution for this?有没有好的解决方案? Please help.请帮忙。
Thanks in Advance提前致谢
The spl-token
CLI has the same --fee-payer
argument that you can use to set the fee payer, AKA "Wallet C" in your example. spl-token
CLI 具有相同的--fee-payer
参数,您可以使用它来设置费用支付者,在您的示例中也称为“钱包 C”。
If you're using JS, you'd set it when sending your transaction, ie:如果您使用的是 JS,您可以在发送交易时设置它,即:
await transfer(connection, walletC, walletATokenAccount, walletB, walletA, amount, []);
Note the payer
argument specified as walletC
: https://github.com/solana-labs/solana-program-library/blob/2ad468f8b751e819dd68007064495ce2e69ff863/token/js/src/actions/transfer.ts#L18请注意指定为walletC
的payer
参数: https ://github.com/solana-labs/solana-program-library/blob/2ad468f8b751e819dd68007064495ce2e69ff863/token/js/src/actions/transfer.ts#L18
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.