简体   繁体   English

使用其他费用付款人进行 SOLANA spl 代币转账

[英]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请注意指定为walletCpayer参数: 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.

相关问题 solana spl-token 转移费用“错误:程序(IncorrectProgramId)” - solana spl-token transfer fee "Error: Program(IncorrectProgramId)" 如何在不使用市场/交易所的情况下在我的网站上为 sol 出售自定义 spl-token - How to sell custom spl-token for sol on my website without the use of a market/exchange Solana,如何使用 javascript/wallets 将 NFT(spl 代币)发送到另一个钱包 - Solana, how to send a NFT (spl token) to another wallet using javascript/wallets 使用@Solana\\web3.js 传输 SPL 令牌 - Transferring SPL Token using @Solana\web3.js 我可以将 SOL 从 PDA 帐户转移到 solana 中的另一个普通帐户吗? - Can I transfer SOL from a PDA Account to another normal account in solana? 如何使用 Solana 智能合约发送 spl 代币? - How to send spl-tokens with Solana smart contract? 什么是用于创建程序可用于执行合同付款的转账账户的 Solana 模式? - What is the Solana pattern for creating a transfer account the program can use to execute a contract payment? 如何以编程方式从 Solana 钱包转移 NFT - How to transfer NFTs from Solana Wallet programmatically Solana - 如何获取国外账户的代币余额? - Solana - How to get token balance for a foreign account? 为 Solana 代币创建一个智能合约 - creating a side-smartcontract for Solana Token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM