Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrl-Felix committed Aug 3, 2024
1 parent 5ad8760 commit 714a84b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,40 @@ tx.add_msg(
client = HTTPClient(api="https://api.evmos.interbloc.org")
tx_response = client.broadcast_transaction(transaction=tx)
````

## Custom Message From Dict
You can add your own messages for unsupported chains by using a dictionary.
```python
account = Account(
seed_phrase="",
hrp='elys'
)
tx = Transaction(
account=account,
chain_id='elystestnet-1',
gas=800000,
)


msg = {
"creator": account.address,
"amount": "1000"
}


tx.add_dict_msg(msg, type_url="/elys.stablestake.MsgBond")

client = HTTPClient(
api="https://api.testnet.elys.network"
)

tx.set_fee(
amount=100,
denom="uelys"
)

client.load_account_data(account=account)
response = client.broadcast_transaction(transaction=tx)

```

1 change: 1 addition & 0 deletions src/mospy/Transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def add_raw_msg(self, unpacked_msg, type_url: str) -> None:
def add_dict_msg(self, msg_dict: dict, type_url: str) -> None:
"""
Add a message as dictionary to the tx body manually.
Note: The message keys and value types must exactly match those defined in the chain's source code.
Args:
msg_dict: Transaction dict
Expand Down

0 comments on commit 714a84b

Please sign in to comment.