Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
This package provide tools to interact with Soroban contracts in Python. The goal is to provide a simple feature set while not depending on the Rust SDK. This can be useful in environment where Rust and the SDK might be more difficult to get working (like a Raspberry Pi).
pip install soroban
This provides a simple way to call contracts without needing to install the Rust SDK and is a higher level interface compared to using the Python SDK.
import soroban
soroban.invoke(contract_id="AAAA...", function_name="increment")
Identity and Network configurations are automatically pulled from the local configuration or the current working directory. See bellow.
It also provides a CLI
soroban invoke C... version --source-account=...
The main feature is to be able to call a Soroban contract function: soroban.invoke
.
import soroban
soroban.invoke(contract_id="AAAA...", function_name="increment")
It also supports passing arguments as a list of stellar_sdk.SCVal
. This list
can be easily generated
import json
import soroban
args = json.load(...)
args = soroban.Parameters(args=args)
soroban.invoke(contract_id="AAAA...", function_name="init", args=args)
The following JSON syntax is supported. Note that vectors are also supported:
[
{
"name": "issuer",
"type": "address",
"value": "C..."
},
{
"name": "distributor",
"type": "int128",
"value": 10
},
{
"name": "claimants",
"type": "vec",
"value": [
{
"type": "uint32",
"value": 12
},
{
"type": "int64",
"value": 20
}
]
}
]
A few helper functions are also provided:
soroban.create_account
: create and fund an account from a source account;soroban.create_asset
: create an asset using the classical issuer/distributor model.The source account and the network to use are set by instantiating soroban.Identity
and soroban.NetworkConfig
, respectively:
import soroban
identity = soroban.Identity()
network = soroban.NetworkConfig()
In both cases, the configuration can be set by either adjusting init arguments, setting up environment variables or using configuration files in toml.
The default path for soroban.Identity
is identity.toml
and for soroban.NetworkConfig
it
is testnet.toml
. Here are examples of these files:
secret_key = "S..."
horizon_url = "https://horizon-testnet.stellar.org"
rpc_url = "https://soroban-testnet.stellar.org"
network_passphrase = "Test SDF Network ; September 2015"
Any of these fields can be set as an environment variable.
This repository has no affiliation with the Stellar Developer Foundation. The official CLI can be found here https://github.com/stellar/soroban-cli Should this become useful, I am happy to transfer it as well to the SDF org!
FAQs
API and CLI for Soroban contracts in Python
We found that soroban demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.