Skip to content

Commit

Permalink
Feat/factories (#67)
Browse files Browse the repository at this point in the history
* feat: fetch a network config when initializing the mxops config

* feat: upgrade from tx builder to factories for contracts

* feat: use the config made for the factories

* feat: use factories for token operations

* Bump version: 2.1.0-dev2 → 2.1.0-dev3

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
EtienneWallet and github-actions[bot] authored Feb 29, 2024
1 parent 020e649 commit 8e4c59d
Show file tree
Hide file tree
Showing 11 changed files with 554 additions and 846 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ steps:
num_decimals: 3
can_upgrade: true
can_add_special_roles: true
can_mint: true
can_burn: true

- type: Python
module_path: ./integration_tests/token_management/scripts/checks.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ steps:
sender: thomas
token_identifier: "%ThomasMeta.identifier"
amount: 100000000 # 100,000.000 TMT
name: "Beautiful Meta"
royalties: 750
hash: "00"
attributes: "metadata:ipfsCID/song.json;tags:song,beautiful,music"
uris:
- https://mypng.com/1
- https://ThomasMetajpg.com/1
4 changes: 2 additions & 2 deletions integration_tests/token_management/scripts/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"JeanToken": {
"IsPaused": False,
"CanUpgrade": True,
"CanMint": True,
"CanBurn": True,
"CanMint": False,
"CanBurn": False,
"CanChangeOwner": False,
"CanPause": False,
"CanFreeze": False,
Expand Down
16 changes: 16 additions & 0 deletions mxops/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
This module contains utils functions related to path navigation
"""

from configparser import ConfigParser
import os
from pathlib import Path
from typing import Dict, List, Optional

from importlib_resources import files
from multiversx_sdk_network_providers import ProxyNetworkProvider
from multiversx_sdk_network_providers.network_config import NetworkConfig

from mxops.enums import NetworkEnum

Expand Down Expand Up @@ -37,6 +40,10 @@ def __init__(self, network: NetworkEnum, config_path: Optional[Path] = None):
default_config = files("mxops.resources").joinpath("default_config.ini")
self.__config.read_string(default_config.read_text())

self.__network_config = ProxyNetworkProvider(
self.get("PROXY")
).get_network_config()

def get_network(self) -> NetworkEnum:
"""
Return the network of the config
Expand All @@ -46,6 +53,15 @@ def get_network(self) -> NetworkEnum:
"""
return self.__network

def get_network_config(self) -> NetworkConfig:
"""
Return the loaded network config
:return: network config
:rtype: NetworkConfig
"""
return self.__network_config

def get(self, option: str) -> str:
"""
return the specified option for the current environment
Expand Down
Loading

0 comments on commit 8e4c59d

Please sign in to comment.