0

我正在尝试使用 Python 重新创建教程中的步骤 - 发行可替代令牌 ( https://xrpl.org/issue-a-fungible-token.html )。

当我尝试添加一个额外的步骤并尝试将资金从热地址发送到另一个(用户)帐户时,而我在步骤 3 下设置了转账费用 - 将发行人设置配置为某个值(例如 transfer_rate=1020000000),我得到以下错误:

xrpl.asyncio.transaction.reliable_submission.XRPLReliableSubmissionException: Transaction failed, tecPATH_PARTIAL: Path could not send full amount. 

当我不设置转账费用时,从热地址发送到另一个地址是有效的。

可能是什么问题呢?

我用于生成额外用户帐户并尝试将令牌从热地址发送到它的代码:

hot_wallet_2 = generate_faucet_wallet(client, debug=True)

# Create trust line from hot 2 to cold address -----------------------------------
currency_code = "FOO"
trust_set_tx = xrpl.models.transactions.TrustSet(
    account=hot_wallet_2.classic_address,
    limit_amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
        currency=currency_code,
        issuer=cold_wallet.classic_address,
        value="10000000000", # Large limit, arbitrarily chosen
    )
)
ts_prepared = xrpl.transaction.safe_sign_and_autofill_transaction(
    transaction=trust_set_tx,
    wallet=hot_wallet_2,
    client=client,
)
print("Creating trust line from hot address 2 to issuer...")
response = xrpl.transaction.send_reliable_submission(ts_prepared, client)
print(response)

# Send token 2 -------------------------------------------------------------------
issue_quantity = "2000"
send_token_tx = xrpl.models.transactions.Payment(
    account=hot_wallet.classic_address,
    destination=hot_wallet_2.classic_address,
    amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
        currency=currency_code,
        issuer=cold_wallet.classic_address,
        value=issue_quantity
    )
)
pay_prepared = xrpl.transaction.safe_sign_and_autofill_transaction(
    transaction=send_token_tx,
    wallet=hot_wallet,
    client=client,
)
print(f"Sending {issue_quantity} {currency_code} to {hot_wallet_2.classic_address}...")
response = xrpl.transaction.send_reliable_submission(pay_prepared, client)
print(response)
4

1 回答 1

2

这是转让费的预期行为(无论图书馆如何)。你的热钱包不能免除转账费用,所以你需要设置一个SendMax来支付转账费用。

例如:如果您TransferRate1020000000(2% 的费用)并且您想将 100.00 FOO 从您的热地址转移给客户,您需要发送一个Amount100.00 FOO 和一个SendMax102.00 FOO 的付款。

在您的 Python 代码中,我认为这应该有效:

# Send token 2 -------------------------------------------------------------------
issue_quantity = "2000"
transfer_rate = 1.02
send_token_tx = xrpl.models.transactions.Payment(
    account=hot_wallet.classic_address,
    destination=hot_wallet_2.classic_address,
    amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
        currency=currency_code,
        issuer=cold_wallet.classic_address,
        value=issue_quantity
    ),
    send_max=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
        currency=currency_code,
        issuer=cold_wallet.classic_address,
        value=(issue_quantity * transfer_rate)
)

在这种特殊情况下,您可能不需要提供Paths,因为默认路径(直接通过发行人)是正确的。这适用于任何时候您直接将令牌从一个用户帐户转移到另一个用户直接信任发行者的另一个用户帐户。(涉及相同货币代码的多个发行人的更长路径也是可能的。涟漪文章对此进行了一些介绍。)

于 2021-11-10T21:39:59.760 回答