Skip to content

"inj" token maps to IBC asset instead of native INJ in pyinjective #397

@unl1k3ly

Description

@unl1k3ly

Describe the bug

When looking up inj in self.tokens, the SDK resolves it to an IBC asset instead of the native INJ token. This causes unexpected behavior when constructing messages (e.g., MsgSend) if inj is passed instead of INJ.

Steps to Reproduce

from pyinjective.core.composer import Composer

# Assume latest pyinjective SDK + token registry loaded
composer = Composer(network="mainnet", tokens=load_tokens())  # load_tokens is whatever registry loader

print("self.tokens['inj']")
print(composer.tokens["inj"])

print("self.tokens['INJ']")
print(composer.tokens["INJ"])

Outputs

self.tokens['inj']
Token(name='Unknown', symbol='inj', denom='ibc/052AF4B0650990067B8FC5345A39206497BCC12F0ABE94F15415413739B93B26', address='ibc/052AF4B0650990067B8FC5345A39206497BCC12F0ABE94F15415413739B93B26', decimals=0, logo='https://imagedelivery.net/lPzngbR8EltRfBOi_WYaXw/63a231c0-d1c3-4901-1e28-7c4410dfaa00/public', updated=-1)

self.tokens['INJ']
Token(name='Injective', symbol='INJ', denom='inj', address='inj', decimals=18, logo='https://imagedelivery.net/lPzngbR8EltRfBOi_WYaXw/7123d071-0def-459a-16b9-d85e8ea04700/public', updated=-1)

Example:

msg = composer.MsgSend(
    from_address=address.to_acc_bech32(),
    to_address=address.to_acc_bech32(),
    amount="0.1",  # 0.1 INJ
    denom="INJ"
)

vs

msg = composer.MsgSend(
    from_address=address.to_acc_bech32(),
    to_address=address.to_acc_bech32(),
    amount="0.1",  # 0.1 INJ
    denom="inj"
)

Environment

Running on the latest sdk -> 1.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions