Skip to content

12.0.0-beta4

Pre-release
Pre-release
Compare
Choose a tag to compare
@overcat overcat released this 22 Nov 09:43
· 8 commits to main since this release
23b7fdd

This version significantly reduces the difficulty of calling contracts.

Update

  • feat: add stellar_sdk.contract.ContractClient and stellar_sdk.contract.ContractClientAsync, this greatly reduces the difficulty of calling contracts, and you can learn more through the documentation and examples. (#998)
    from stellar_sdk import Network, scval
    from stellar_sdk.contract import ContractClient
    
    assembled = ContractClient(
        contract_id="CACZTW72246RA2MOCNKUBRRRRPT26UZ7LXE5ZHH44OGKIMCTQJ74O4D5",
        rpc_url="https://soroban-testnet.stellar.org:443",
        network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE,
    ).invoke(
        function_name="hello",
        parameters=[scval.to_string("world")],
        parse_result_xdr_fn=lambda result: [
            scval.from_string(s).decode() for s in scval.from_vec(result)
        ],
    )
    
    print(f"Result from simulation: {assembled.result}")