Skip to content

Commit 542136d

Browse files
author
abel
committed
(fix) Added the required logic in the MsgSubaccountTransfer message to translate amounts and token into the correct amount and token name representation for the chain
1 parent c756152 commit 542136d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

examples/chain_client/16_MsgSubaccountTransfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def main() -> None:
3131
source_subaccount_id=subaccount_id,
3232
destination_subaccount_id=dest_subaccount_id,
3333
amount=100,
34-
denom="inj"
34+
denom="INJ"
3535
)
3636

3737
# build sim tx

pyinjective/composer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,12 +625,13 @@ def MsgSubaccountTransfer(
625625
amount: int,
626626
denom: str,
627627
):
628-
628+
peggy_denom, decimals = Denom.load_peggy_denom(self.network, denom)
629+
be_amount = amount_to_backend(amount, decimals)
629630
return injective_exchange_tx_pb.MsgSubaccountTransfer(
630631
sender=sender,
631632
source_subaccount_id=source_subaccount_id,
632633
destination_subaccount_id=destination_subaccount_id,
633-
amount=self.Coin(amount=amount, denom=denom),
634+
amount=self.Coin(amount=be_amount, denom=peggy_denom),
634635
)
635636

636637
def MsgWithdraw(self, sender: str, subaccount_id: str, amount: float, denom: str):

0 commit comments

Comments
 (0)