Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tburm committed Oct 10, 2023
1 parent 2b77d66 commit 6085cf2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
15 changes: 14 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
Synthetix Documentation
=======================

The ``synthetix`` library provides an interface for interacting with the Synthetix_ protocol smart contracts. Learn more about the Synthetix protocol in the documentation_.

.. toctree::
:maxdepth: 2
:caption: User Guides

guides/quickstart

.. toctree::
:maxdepth: 2
:maxdepth: 1
:caption: Reference

modules/synthetix
modules/utils

Links
-----

- `Python SDK Github <https://github.com/Synthetixio/python-sdk>`_
- `Synthetix V3 Github <https://github.com/Synthetixio/synthetix-v3>`_
- `Synthetix website <https://synthetix.io/>`_
- `Synthetix documentation <https://docs.synthetix.io/>`_

.. _Synthetix: https://synthetix.io/
.. _documentation: https://docs.synthetix.io/
6 changes: 4 additions & 2 deletions src/synthetix/synthetix.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ class Synthetix:
requires a provider RPC endpoint and a wallet address::
snx = Synthetix(
provider_rpc='https://mainnet.infura.io/v3/...',
provider_rpc='https://optimism-mainnet.infura.io/v3/...',
network_id=10,
address='0x12345...'
)
The class can be initialized with a private key to allow for transactions
to be sent::
snx = Synthetix(
provider_rpc='https://mainnet.infura.io/v3/...',
provider_rpc='https://optimism-mainnet.infura.io/v3/...',
network_id=10,
address='0x12345...',
private_key='0xabcde...'
)
Expand Down
10 changes: 8 additions & 2 deletions src/synthetix/utils/wei.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from decimal import Decimal

def wei_to_ether(wei_value: int) -> float:
"""
Convert wei value to ether value::
Expand All @@ -9,7 +11,9 @@ def wei_to_ether(wei_value: int) -> float:
:return: ether value
:rtype: float
"""
return wei_value / 1e18
wei_value = Decimal(wei_value)
ether_value = wei_value / Decimal(1e18)
return float(ether_value)

def ether_to_wei(ether_value: float) -> int:
"""
Expand All @@ -22,4 +26,6 @@ def ether_to_wei(ether_value: float) -> int:
:return: wei value
:rtype: int
"""
return int(ether_value * 1e18)
ether_value = Decimal(ether_value)
wei_value = ether_value * Decimal(1e18)
return int(wei_value)

0 comments on commit 6085cf2

Please sign in to comment.