Skip to content

Commit 10bbfe9

Browse files
authored
Merge pull request #224 from InjectiveLabs/fix/msg_subaccount_transfer_amount_translation
Fix/msg subaccount transfer amount translation
2 parents c756152 + 2dd2d28 commit 10bbfe9

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ make tests
8787
```
8888

8989
### Changelogs
90+
** 0.7.0.5 **
91+
* Added the required logic in the MsgSubaccountTransfer message to translate amounts and token into the correct amount and token name representation for the chain
92+
9093
** 0.7.0.4**
9194
* Synchronized decimals for ATOM and WETH in Testnet with the configuration provided by the indexer
9295

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):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
AUTHOR = "Injective Labs"
1919
REQUIRES_PYTHON = ">=3.9"
20-
VERSION = "0.7.0.4"
20+
VERSION = "0.7.0.5"
2121

2222
REQUIRED = [
2323
"aiohttp",

0 commit comments

Comments
 (0)