Skip to content

Commit 7342e62

Browse files
Merge pull request #195 from multiversx/remove-erdjs-snippets
Do not handle erdjs-snippets anymore, since they have been removed from mx-sdk-rs's templates folder
2 parents 851669a + c63ac36 commit 7342e62

4 files changed

Lines changed: 12 additions & 42 deletions

File tree

multiversx_sdk_cli/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "5.0.1"
1+
__version__ = "5.1.0"

multiversx_sdk_cli/projects/templates.py

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import json
22
import logging
3-
import os
4-
from pathlib import Path
53
import shutil
4+
from pathlib import Path
65
from typing import Any, List, Tuple
76

87
from multiversx_sdk_cli import errors, utils
98
from multiversx_sdk_cli.projects import shared
109
from multiversx_sdk_cli.projects.project_rust import CargoFile
11-
from multiversx_sdk_cli.projects.templates_config import get_templates_repositories
12-
from multiversx_sdk_cli.projects.templates_repository import TemplatesRepository
10+
from multiversx_sdk_cli.projects.templates_config import \
11+
get_templates_repositories
12+
from multiversx_sdk_cli.projects.templates_repository import \
13+
TemplatesRepository
1314

1415
logger = logging.getLogger("projects.templates")
15-
ERDJS_SNIPPETS_FOLDER_NAME = "erdjs-snippets"
1616

1717

1818
def list_project_templates():
@@ -70,42 +70,11 @@ def _copy_template(template: str, destination_path: Path, project_name: str):
7070
if repo.has_template(template):
7171
source_path = repo.get_template_folder(template)
7272
shutil.copytree(source_path, destination_path)
73-
_copy_erdjs_snippets(template, repo.get_payload_folder(), destination_path, project_name)
7473
return
7574

7675
raise errors.TemplateMissingError(template)
7776

7877

79-
def _copy_erdjs_snippets(template: str, templates_payload_folder: Path, destination_path: Path, project_name: str):
80-
source_erdjs_snippets_folder = templates_payload_folder / ERDJS_SNIPPETS_FOLDER_NAME
81-
source_erdjs_snippets_subfolder = source_erdjs_snippets_folder / template
82-
destination_erdjs_snippets_folder = destination_path.parent / ERDJS_SNIPPETS_FOLDER_NAME
83-
no_snippets = not source_erdjs_snippets_subfolder.is_dir()
84-
85-
logger.info(f"_copy_erdjs_snippets, source_erdjs_snippets_subfolder: {source_erdjs_snippets_subfolder}")
86-
logger.info(f"_copy_erdjs_snippets, destination_erdjs_snippets_folder: {destination_erdjs_snippets_folder}")
87-
88-
if no_snippets:
89-
logger.info(f"_copy_erdjs_snippets: no snippets in template {template}")
90-
return
91-
92-
utils.ensure_folder(destination_erdjs_snippets_folder)
93-
94-
# Copy snippets to destination
95-
# First, copy the subfolder associated with the template
96-
shutil.copytree(source_erdjs_snippets_subfolder, destination_erdjs_snippets_folder / project_name)
97-
98-
# After that, copy the remaining files from the source folder - not recursively (on purpose).
99-
for file in os.listdir(source_erdjs_snippets_folder):
100-
source_file = source_erdjs_snippets_folder / file
101-
destination_file = destination_erdjs_snippets_folder / file
102-
should_copy = source_file.is_file() and not destination_file.exists()
103-
104-
if should_copy:
105-
logger.info(f"_copy_erdjs_snippets, file: {file}")
106-
shutil.copy(source_file, destination_file)
107-
108-
10978
def _load_as_template(directory: Path):
11079
if shared.is_source_clang(directory):
11180
return TemplateClang(directory)

multiversx_sdk_cli/wallet/keyfile.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import base64
22
import os
33
from binascii import b2a_base64, hexlify, unhexlify
4+
from json import dump, load
45
from pathlib import Path
56
from typing import Any
6-
import multiversx_sdk_cli.accounts as accounts
7-
from json import load, dump
87
from uuid import uuid4
98

109
from cryptography.hazmat.backends import default_backend
1110
from cryptography.hazmat.primitives import hashes, hmac
1211
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
1312
from cryptography.hazmat.primitives.kdf.scrypt import Scrypt
13+
14+
import multiversx_sdk_cli.accounts as accounts
1415
from multiversx_sdk_cli import errors
1516

1617

@@ -102,8 +103,8 @@ def make_cyphertext(backend: Any, key: bytes, iv: bytes, secret_key: str):
102103
return encryptor.update(secret_key) + encryptor.finalize()
103104

104105

105-
# erdjs implementation:
106-
# https://github.com/multiversx/mx-sdk-erdjs-walletcore/blob/main/src/userWallet.ts
106+
# sdk-js implementation:
107+
# https://github.com/multiversx/mx-sdk-js-wallet/blob/main/src/userWallet.ts
107108
def format_key_json(uid: str, pubkey: str, iv: bytes, ciphertext: bytes, salt: bytes, mac: bytes) -> Any:
108109
address = accounts.Address(pubkey)
109110

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import setuptools
44

5-
VERSION = "5.0.1"
5+
VERSION = "5.1.0"
66

77
try:
88
with open('./multiversx_sdk_cli/_version.py', 'wt') as versionfile:

0 commit comments

Comments
 (0)