XRPL - 错误 - 发行带有转账费的可替代代币
XRPL - Error - Issue a Fungible Token with Transfer Fee
我正在尝试使用 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)
这是传输费用的预期行为(与图书馆无关)。您的热钱包不免收转账手续费,所以您需要设置一个SendMax
支付转账手续费
例如:如果您的 TransferRate
是 1020000000
(2% 的费用)并且您想从您的热门地址向客户转账 100.00 FOO,您需要发送带有 Amount
的 100.00 FOO 和 SendMax
的 102.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 because the default path (rippling directly through the issuer) is the correct one. That applies any time you're directly transferring a token from one user account to another where both users trust the issuer directly. (Longer paths involving multiple issuers for the same currency code are also possible. The rippling article 稍微介绍一下。)
我正在尝试使用 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)
这是传输费用的预期行为(与图书馆无关)。您的热钱包不免收转账手续费,所以您需要设置一个SendMax
支付转账手续费
例如:如果您的 TransferRate
是 1020000000
(2% 的费用)并且您想从您的热门地址向客户转账 100.00 FOO,您需要发送带有 Amount
的 100.00 FOO 和 SendMax
的 102.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 because the default path (rippling directly through the issuer) is the correct one. That applies any time you're directly transferring a token from one user account to another where both users trust the issuer directly. (Longer paths involving multiple issuers for the same currency code are also possible. The rippling article 稍微介绍一下。)