pub trait Env: EnvBase {
Show 161 methods
// Required methods
fn log_from_linear_memory(
&self,
msg_pos: U32Val,
msg_len: U32Val,
vals_pos: U32Val,
vals_len: U32Val,
) -> Result<Void, Self::Error>;
fn obj_cmp(&self, a: Val, b: Val) -> Result<i64, Self::Error>;
fn contract_event(
&self,
topics: VecObject,
data: Val,
) -> Result<Void, Self::Error>;
fn get_ledger_version(&self) -> Result<U32Val, Self::Error>;
fn get_ledger_sequence(&self) -> Result<U32Val, Self::Error>;
fn get_ledger_timestamp(&self) -> Result<U64Val, Self::Error>;
fn fail_with_error(&self, error: Error) -> Result<Void, Self::Error>;
fn get_ledger_network_id(&self) -> Result<BytesObject, Self::Error>;
fn get_current_contract_address(&self) -> Result<AddressObject, Self::Error>;
fn get_max_live_until_ledger(&self) -> Result<U32Val, Self::Error>;
fn obj_from_u64(&self, v: u64) -> Result<U64Object, Self::Error>;
fn obj_to_u64(&self, obj: U64Object) -> Result<u64, Self::Error>;
fn obj_from_i64(&self, v: i64) -> Result<I64Object, Self::Error>;
fn obj_to_i64(&self, obj: I64Object) -> Result<i64, Self::Error>;
fn obj_from_u128_pieces(
&self,
hi: u64,
lo: u64,
) -> Result<U128Object, Self::Error>;
fn obj_to_u128_lo64(&self, obj: U128Object) -> Result<u64, Self::Error>;
fn obj_to_u128_hi64(&self, obj: U128Object) -> Result<u64, Self::Error>;
fn obj_from_i128_pieces(
&self,
hi: i64,
lo: u64,
) -> Result<I128Object, Self::Error>;
fn obj_to_i128_lo64(&self, obj: I128Object) -> Result<u64, Self::Error>;
fn obj_to_i128_hi64(&self, obj: I128Object) -> Result<i64, Self::Error>;
fn obj_from_u256_pieces(
&self,
hi_hi: u64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64,
) -> Result<U256Object, Self::Error>;
fn u256_val_from_be_bytes(
&self,
bytes: BytesObject,
) -> Result<U256Val, Self::Error>;
fn u256_val_to_be_bytes(
&self,
val: U256Val,
) -> Result<BytesObject, Self::Error>;
fn obj_to_u256_hi_hi(&self, obj: U256Object) -> Result<u64, Self::Error>;
fn obj_to_u256_hi_lo(&self, obj: U256Object) -> Result<u64, Self::Error>;
fn obj_to_u256_lo_hi(&self, obj: U256Object) -> Result<u64, Self::Error>;
fn obj_to_u256_lo_lo(&self, obj: U256Object) -> Result<u64, Self::Error>;
fn obj_from_i256_pieces(
&self,
hi_hi: i64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64,
) -> Result<I256Object, Self::Error>;
fn i256_val_from_be_bytes(
&self,
bytes: BytesObject,
) -> Result<I256Val, Self::Error>;
fn i256_val_to_be_bytes(
&self,
val: I256Val,
) -> Result<BytesObject, Self::Error>;
fn obj_to_i256_hi_hi(&self, obj: I256Object) -> Result<i64, Self::Error>;
fn obj_to_i256_hi_lo(&self, obj: I256Object) -> Result<u64, Self::Error>;
fn obj_to_i256_lo_hi(&self, obj: I256Object) -> Result<u64, Self::Error>;
fn obj_to_i256_lo_lo(&self, obj: I256Object) -> Result<u64, Self::Error>;
fn u256_add(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn u256_sub(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn u256_mul(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn u256_div(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn u256_rem_euclid(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn u256_pow(
&self,
lhs: U256Val,
rhs: U32Val,
) -> Result<U256Val, Self::Error>;
fn u256_shl(
&self,
lhs: U256Val,
rhs: U32Val,
) -> Result<U256Val, Self::Error>;
fn u256_shr(
&self,
lhs: U256Val,
rhs: U32Val,
) -> Result<U256Val, Self::Error>;
fn i256_add(
&self,
lhs: I256Val,
rhs: I256Val,
) -> Result<I256Val, Self::Error>;
fn i256_sub(
&self,
lhs: I256Val,
rhs: I256Val,
) -> Result<I256Val, Self::Error>;
fn i256_mul(
&self,
lhs: I256Val,
rhs: I256Val,
) -> Result<I256Val, Self::Error>;
fn i256_div(
&self,
lhs: I256Val,
rhs: I256Val,
) -> Result<I256Val, Self::Error>;
fn i256_rem_euclid(
&self,
lhs: I256Val,
rhs: I256Val,
) -> Result<I256Val, Self::Error>;
fn i256_pow(
&self,
lhs: I256Val,
rhs: U32Val,
) -> Result<I256Val, Self::Error>;
fn i256_shl(
&self,
lhs: I256Val,
rhs: U32Val,
) -> Result<I256Val, Self::Error>;
fn i256_shr(
&self,
lhs: I256Val,
rhs: U32Val,
) -> Result<I256Val, Self::Error>;
fn timepoint_obj_from_u64(
&self,
v: u64,
) -> Result<TimepointObject, Self::Error>;
fn timepoint_obj_to_u64(
&self,
obj: TimepointObject,
) -> Result<u64, Self::Error>;
fn duration_obj_from_u64(
&self,
v: u64,
) -> Result<DurationObject, Self::Error>;
fn duration_obj_to_u64(
&self,
obj: DurationObject,
) -> Result<u64, Self::Error>;
fn map_new(&self) -> Result<MapObject, Self::Error>;
fn map_put(
&self,
m: MapObject,
k: Val,
v: Val,
) -> Result<MapObject, Self::Error>;
fn map_get(&self, m: MapObject, k: Val) -> Result<Val, Self::Error>;
fn map_del(&self, m: MapObject, k: Val) -> Result<MapObject, Self::Error>;
fn map_len(&self, m: MapObject) -> Result<U32Val, Self::Error>;
fn map_has(&self, m: MapObject, k: Val) -> Result<Bool, Self::Error>;
fn map_key_by_pos(
&self,
m: MapObject,
i: U32Val,
) -> Result<Val, Self::Error>;
fn map_val_by_pos(
&self,
m: MapObject,
i: U32Val,
) -> Result<Val, Self::Error>;
fn map_keys(&self, m: MapObject) -> Result<VecObject, Self::Error>;
fn map_values(&self, m: MapObject) -> Result<VecObject, Self::Error>;
fn map_new_from_linear_memory(
&self,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val,
) -> Result<MapObject, Self::Error>;
fn map_unpack_to_linear_memory(
&self,
map: MapObject,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>;
fn vec_new(&self) -> Result<VecObject, Self::Error>;
fn vec_put(
&self,
v: VecObject,
i: U32Val,
x: Val,
) -> Result<VecObject, Self::Error>;
fn vec_get(&self, v: VecObject, i: U32Val) -> Result<Val, Self::Error>;
fn vec_del(&self, v: VecObject, i: U32Val) -> Result<VecObject, Self::Error>;
fn vec_len(&self, v: VecObject) -> Result<U32Val, Self::Error>;
fn vec_push_front(
&self,
v: VecObject,
x: Val,
) -> Result<VecObject, Self::Error>;
fn vec_pop_front(&self, v: VecObject) -> Result<VecObject, Self::Error>;
fn vec_push_back(
&self,
v: VecObject,
x: Val,
) -> Result<VecObject, Self::Error>;
fn vec_pop_back(&self, v: VecObject) -> Result<VecObject, Self::Error>;
fn vec_front(&self, v: VecObject) -> Result<Val, Self::Error>;
fn vec_back(&self, v: VecObject) -> Result<Val, Self::Error>;
fn vec_insert(
&self,
v: VecObject,
i: U32Val,
x: Val,
) -> Result<VecObject, Self::Error>;
fn vec_append(
&self,
v1: VecObject,
v2: VecObject,
) -> Result<VecObject, Self::Error>;
fn vec_slice(
&self,
v: VecObject,
start: U32Val,
end: U32Val,
) -> Result<VecObject, Self::Error>;
fn vec_first_index_of(
&self,
v: VecObject,
x: Val,
) -> Result<Val, Self::Error>;
fn vec_last_index_of(
&self,
v: VecObject,
x: Val,
) -> Result<Val, Self::Error>;
fn vec_binary_search(
&self,
v: VecObject,
x: Val,
) -> Result<u64, Self::Error>;
fn vec_new_from_linear_memory(
&self,
vals_pos: U32Val,
len: U32Val,
) -> Result<VecObject, Self::Error>;
fn vec_unpack_to_linear_memory(
&self,
vec: VecObject,
vals_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>;
fn put_contract_data(
&self,
k: Val,
v: Val,
t: StorageType,
) -> Result<Void, Self::Error>;
fn has_contract_data(
&self,
k: Val,
t: StorageType,
) -> Result<Bool, Self::Error>;
fn get_contract_data(
&self,
k: Val,
t: StorageType,
) -> Result<Val, Self::Error>;
fn del_contract_data(
&self,
k: Val,
t: StorageType,
) -> Result<Void, Self::Error>;
fn create_contract(
&self,
deployer: AddressObject,
wasm_hash: BytesObject,
salt: BytesObject,
) -> Result<AddressObject, Self::Error>;
fn create_asset_contract(
&self,
serialized_asset: BytesObject,
) -> Result<AddressObject, Self::Error>;
fn upload_wasm(&self, wasm: BytesObject) -> Result<BytesObject, Self::Error>;
fn update_current_contract_wasm(
&self,
hash: BytesObject,
) -> Result<Void, Self::Error>;
fn extend_contract_data_ttl(
&self,
k: Val,
t: StorageType,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>;
fn extend_current_contract_instance_and_code_ttl(
&self,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>;
fn extend_contract_instance_and_code_ttl(
&self,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>;
fn get_contract_id(
&self,
deployer: AddressObject,
salt: BytesObject,
) -> Result<AddressObject, Self::Error>;
fn get_asset_contract_id(
&self,
serialized_asset: BytesObject,
) -> Result<AddressObject, Self::Error>;
fn extend_contract_instance_ttl(
&self,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>;
fn extend_contract_code_ttl(
&self,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>;
fn create_contract_with_constructor(
&self,
deployer: AddressObject,
wasm_hash: BytesObject,
salt: BytesObject,
constructor_args: VecObject,
) -> Result<AddressObject, Self::Error>;
fn call(
&self,
contract: AddressObject,
func: Symbol,
args: VecObject,
) -> Result<Val, Self::Error>;
fn try_call(
&self,
contract: AddressObject,
func: Symbol,
args: VecObject,
) -> Result<Val, Self::Error>;
fn serialize_to_bytes(&self, v: Val) -> Result<BytesObject, Self::Error>;
fn deserialize_from_bytes(&self, b: BytesObject) -> Result<Val, Self::Error>;
fn bytes_copy_to_linear_memory(
&self,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>;
fn bytes_copy_from_linear_memory(
&self,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<BytesObject, Self::Error>;
fn bytes_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val,
) -> Result<BytesObject, Self::Error>;
fn bytes_new(&self) -> Result<BytesObject, Self::Error>;
fn bytes_put(
&self,
b: BytesObject,
i: U32Val,
u: U32Val,
) -> Result<BytesObject, Self::Error>;
fn bytes_get(
&self,
b: BytesObject,
i: U32Val,
) -> Result<U32Val, Self::Error>;
fn bytes_del(
&self,
b: BytesObject,
i: U32Val,
) -> Result<BytesObject, Self::Error>;
fn bytes_len(&self, b: BytesObject) -> Result<U32Val, Self::Error>;
fn bytes_push(
&self,
b: BytesObject,
u: U32Val,
) -> Result<BytesObject, Self::Error>;
fn bytes_pop(&self, b: BytesObject) -> Result<BytesObject, Self::Error>;
fn bytes_front(&self, b: BytesObject) -> Result<U32Val, Self::Error>;
fn bytes_back(&self, b: BytesObject) -> Result<U32Val, Self::Error>;
fn bytes_insert(
&self,
b: BytesObject,
i: U32Val,
u: U32Val,
) -> Result<BytesObject, Self::Error>;
fn bytes_append(
&self,
b1: BytesObject,
b2: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn bytes_slice(
&self,
b: BytesObject,
start: U32Val,
end: U32Val,
) -> Result<BytesObject, Self::Error>;
fn string_copy_to_linear_memory(
&self,
s: StringObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>;
fn symbol_copy_to_linear_memory(
&self,
s: SymbolObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>;
fn string_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val,
) -> Result<StringObject, Self::Error>;
fn symbol_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val,
) -> Result<SymbolObject, Self::Error>;
fn string_len(&self, s: StringObject) -> Result<U32Val, Self::Error>;
fn symbol_len(&self, s: SymbolObject) -> Result<U32Val, Self::Error>;
fn symbol_index_in_linear_memory(
&self,
sym: Symbol,
slices_pos: U32Val,
len: U32Val,
) -> Result<U32Val, Self::Error>;
fn compute_hash_sha256(
&self,
x: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn verify_sig_ed25519(
&self,
k: BytesObject,
x: BytesObject,
s: BytesObject,
) -> Result<Void, Self::Error>;
fn compute_hash_keccak256(
&self,
x: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn recover_key_ecdsa_secp256k1(
&self,
msg_digest: BytesObject,
signature: BytesObject,
recovery_id: U32Val,
) -> Result<BytesObject, Self::Error>;
fn verify_sig_ecdsa_secp256r1(
&self,
public_key: BytesObject,
msg_digest: BytesObject,
signature: BytesObject,
) -> Result<Void, Self::Error>;
fn bls12_381_check_g1_is_in_subgroup(
&self,
point: BytesObject,
) -> Result<Bool, Self::Error>;
fn bls12_381_g1_add(
&self,
point1: BytesObject,
point2: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_g1_mul(
&self,
point: BytesObject,
scalar: U256Val,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_g1_msm(
&self,
vp: VecObject,
vs: VecObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_map_fp_to_g1(
&self,
fp: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_hash_to_g1(
&self,
msg: BytesObject,
dst: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_check_g2_is_in_subgroup(
&self,
point: BytesObject,
) -> Result<Bool, Self::Error>;
fn bls12_381_g2_add(
&self,
point1: BytesObject,
point2: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_g2_mul(
&self,
point: BytesObject,
scalar: U256Val,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_g2_msm(
&self,
vp: VecObject,
vs: VecObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_map_fp2_to_g2(
&self,
fp2: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_hash_to_g2(
&self,
msg: BytesObject,
dst: BytesObject,
) -> Result<BytesObject, Self::Error>;
fn bls12_381_multi_pairing_check(
&self,
vp1: VecObject,
vp2: VecObject,
) -> Result<Bool, Self::Error>;
fn bls12_381_fr_add(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn bls12_381_fr_sub(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn bls12_381_fr_mul(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>;
fn bls12_381_fr_pow(
&self,
lhs: U256Val,
rhs: U64Val,
) -> Result<U256Val, Self::Error>;
fn bls12_381_fr_inv(&self, lhs: U256Val) -> Result<U256Val, Self::Error>;
fn require_auth_for_args(
&self,
address: AddressObject,
args: VecObject,
) -> Result<Void, Self::Error>;
fn require_auth(&self, address: AddressObject) -> Result<Void, Self::Error>;
fn strkey_to_address(
&self,
strkey: Val,
) -> Result<AddressObject, Self::Error>;
fn address_to_strkey(
&self,
address: AddressObject,
) -> Result<StringObject, Self::Error>;
fn authorize_as_curr_contract(
&self,
auth_entires: VecObject,
) -> Result<Void, Self::Error>;
fn dummy0(&self) -> Result<Val, Self::Error>;
fn protocol_gated_dummy(&self) -> Result<Val, Self::Error>;
fn prng_reseed(&self, seed: BytesObject) -> Result<Void, Self::Error>;
fn prng_bytes_new(&self, length: U32Val) -> Result<BytesObject, Self::Error>;
fn prng_u64_in_inclusive_range(
&self,
lo: u64,
hi: u64,
) -> Result<u64, Self::Error>;
fn prng_vec_shuffle(&self, vec: VecObject) -> Result<VecObject, Self::Error>;
}
Expand description
Required Methods§
Sourcefn log_from_linear_memory(
&self,
msg_pos: U32Val,
msg_len: U32Val,
vals_pos: U32Val,
vals_len: U32Val,
) -> Result<Void, Self::Error>
fn log_from_linear_memory( &self, msg_pos: U32Val, msg_len: U32Val, vals_pos: U32Val, vals_len: U32Val, ) -> Result<Void, Self::Error>
Emit a diagnostic event containing a message and sequence of Val
s.
Sourcefn obj_cmp(&self, a: Val, b: Val) -> Result<i64, Self::Error>
fn obj_cmp(&self, a: Val, b: Val) -> Result<i64, Self::Error>
Compare two objects, or at least one object to a non-object, structurally. Returns -1 if a<b, 1 if a>b, or 0 if a==b.
Sourcefn contract_event(
&self,
topics: VecObject,
data: Val,
) -> Result<Void, Self::Error>
fn contract_event( &self, topics: VecObject, data: Val, ) -> Result<Void, Self::Error>
Records a contract event. topics
is expected to be a SCVec
with length <= 4 that cannot contain Vec
, Map
, or Bytes
with length > 32.
Sourcefn get_ledger_version(&self) -> Result<U32Val, Self::Error>
fn get_ledger_version(&self) -> Result<U32Val, Self::Error>
Return the protocol version of the current ledger as a u32.
Sourcefn get_ledger_sequence(&self) -> Result<U32Val, Self::Error>
fn get_ledger_sequence(&self) -> Result<U32Val, Self::Error>
Return the sequence number of the current ledger as a u32.
Sourcefn get_ledger_timestamp(&self) -> Result<U64Val, Self::Error>
fn get_ledger_timestamp(&self) -> Result<U64Val, Self::Error>
Return the timestamp number of the current ledger as a u64.
Sourcefn fail_with_error(&self, error: Error) -> Result<Void, Self::Error>
fn fail_with_error(&self, error: Error) -> Result<Void, Self::Error>
Causes the currently executing contract to fail immediately with a provided error code, which must be of error-type ScErrorType::Contract
. Does not actually return.
Sourcefn get_ledger_network_id(&self) -> Result<BytesObject, Self::Error>
fn get_ledger_network_id(&self) -> Result<BytesObject, Self::Error>
Return the network id (sha256 hash of network passphrase) of the current ledger as Bytes
. The value is always 32 bytes in length.
Sourcefn get_current_contract_address(&self) -> Result<AddressObject, Self::Error>
fn get_current_contract_address(&self) -> Result<AddressObject, Self::Error>
Get the Address object for the current contract.
Sourcefn get_max_live_until_ledger(&self) -> Result<U32Val, Self::Error>
fn get_max_live_until_ledger(&self) -> Result<U32Val, Self::Error>
Returns the max ledger sequence that an entry can live to (inclusive).
Sourcefn obj_from_u64(&self, v: u64) -> Result<U64Object, Self::Error>
fn obj_from_u64(&self, v: u64) -> Result<U64Object, Self::Error>
Convert a u64
to an object containing a u64
.
Sourcefn obj_to_u64(&self, obj: U64Object) -> Result<u64, Self::Error>
fn obj_to_u64(&self, obj: U64Object) -> Result<u64, Self::Error>
Convert an object containing a u64
to a u64
.
Sourcefn obj_from_i64(&self, v: i64) -> Result<I64Object, Self::Error>
fn obj_from_i64(&self, v: i64) -> Result<I64Object, Self::Error>
Convert an i64
to an object containing an i64
.
Sourcefn obj_to_i64(&self, obj: I64Object) -> Result<i64, Self::Error>
fn obj_to_i64(&self, obj: I64Object) -> Result<i64, Self::Error>
Convert an object containing an i64
to an i64
.
Sourcefn obj_from_u128_pieces(
&self,
hi: u64,
lo: u64,
) -> Result<U128Object, Self::Error>
fn obj_from_u128_pieces( &self, hi: u64, lo: u64, ) -> Result<U128Object, Self::Error>
Convert the high and low 64-bit words of a u128 to an object containing a u128.
Sourcefn obj_to_u128_lo64(&self, obj: U128Object) -> Result<u64, Self::Error>
fn obj_to_u128_lo64(&self, obj: U128Object) -> Result<u64, Self::Error>
Extract the low 64 bits from an object containing a u128.
Sourcefn obj_to_u128_hi64(&self, obj: U128Object) -> Result<u64, Self::Error>
fn obj_to_u128_hi64(&self, obj: U128Object) -> Result<u64, Self::Error>
Extract the high 64 bits from an object containing a u128.
Sourcefn obj_from_i128_pieces(
&self,
hi: i64,
lo: u64,
) -> Result<I128Object, Self::Error>
fn obj_from_i128_pieces( &self, hi: i64, lo: u64, ) -> Result<I128Object, Self::Error>
Convert the high and low 64-bit words of an i128 to an object containing an i128.
Sourcefn obj_to_i128_lo64(&self, obj: I128Object) -> Result<u64, Self::Error>
fn obj_to_i128_lo64(&self, obj: I128Object) -> Result<u64, Self::Error>
Extract the low 64 bits from an object containing an i128.
Sourcefn obj_to_i128_hi64(&self, obj: I128Object) -> Result<i64, Self::Error>
fn obj_to_i128_hi64(&self, obj: I128Object) -> Result<i64, Self::Error>
Extract the high 64 bits from an object containing an i128.
Sourcefn obj_from_u256_pieces(
&self,
hi_hi: u64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64,
) -> Result<U256Object, Self::Error>
fn obj_from_u256_pieces( &self, hi_hi: u64, hi_lo: u64, lo_hi: u64, lo_lo: u64, ) -> Result<U256Object, Self::Error>
Convert the four 64-bit words of a u256 (big-endian) to an object containing a u256.
Sourcefn u256_val_from_be_bytes(
&self,
bytes: BytesObject,
) -> Result<U256Val, Self::Error>
fn u256_val_from_be_bytes( &self, bytes: BytesObject, ) -> Result<U256Val, Self::Error>
Create a U256 Val
from its representation as a byte array in big endian.
Sourcefn u256_val_to_be_bytes(&self, val: U256Val) -> Result<BytesObject, Self::Error>
fn u256_val_to_be_bytes(&self, val: U256Val) -> Result<BytesObject, Self::Error>
Return the memory representation of this U256 Val
as a byte array in big endian byte order.
Sourcefn obj_to_u256_hi_hi(&self, obj: U256Object) -> Result<u64, Self::Error>
fn obj_to_u256_hi_hi(&self, obj: U256Object) -> Result<u64, Self::Error>
Extract the highest 64-bits (bits 192-255) from an object containing a u256.
Sourcefn obj_to_u256_hi_lo(&self, obj: U256Object) -> Result<u64, Self::Error>
fn obj_to_u256_hi_lo(&self, obj: U256Object) -> Result<u64, Self::Error>
Extract bits 128-191 from an object containing a u256.
Sourcefn obj_to_u256_lo_hi(&self, obj: U256Object) -> Result<u64, Self::Error>
fn obj_to_u256_lo_hi(&self, obj: U256Object) -> Result<u64, Self::Error>
Extract bits 64-127 from an object containing a u256.
Sourcefn obj_to_u256_lo_lo(&self, obj: U256Object) -> Result<u64, Self::Error>
fn obj_to_u256_lo_lo(&self, obj: U256Object) -> Result<u64, Self::Error>
Extract the lowest 64-bits (bits 0-63) from an object containing a u256.
Sourcefn obj_from_i256_pieces(
&self,
hi_hi: i64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64,
) -> Result<I256Object, Self::Error>
fn obj_from_i256_pieces( &self, hi_hi: i64, hi_lo: u64, lo_hi: u64, lo_lo: u64, ) -> Result<I256Object, Self::Error>
Convert the four 64-bit words of an i256 (big-endian) to an object containing an i256.
Sourcefn i256_val_from_be_bytes(
&self,
bytes: BytesObject,
) -> Result<I256Val, Self::Error>
fn i256_val_from_be_bytes( &self, bytes: BytesObject, ) -> Result<I256Val, Self::Error>
Create a I256 Val
from its representation as a byte array in big endian.
Sourcefn i256_val_to_be_bytes(&self, val: I256Val) -> Result<BytesObject, Self::Error>
fn i256_val_to_be_bytes(&self, val: I256Val) -> Result<BytesObject, Self::Error>
Return the memory representation of this I256 Val
as a byte array in big endian byte order.
Sourcefn obj_to_i256_hi_hi(&self, obj: I256Object) -> Result<i64, Self::Error>
fn obj_to_i256_hi_hi(&self, obj: I256Object) -> Result<i64, Self::Error>
Extract the highest 64-bits (bits 192-255) from an object containing an i256.
Sourcefn obj_to_i256_hi_lo(&self, obj: I256Object) -> Result<u64, Self::Error>
fn obj_to_i256_hi_lo(&self, obj: I256Object) -> Result<u64, Self::Error>
Extract bits 128-191 from an object containing an i256.
Sourcefn obj_to_i256_lo_hi(&self, obj: I256Object) -> Result<u64, Self::Error>
fn obj_to_i256_lo_hi(&self, obj: I256Object) -> Result<u64, Self::Error>
Extract bits 64-127 from an object containing an i256.
Sourcefn obj_to_i256_lo_lo(&self, obj: I256Object) -> Result<u64, Self::Error>
fn obj_to_i256_lo_lo(&self, obj: I256Object) -> Result<u64, Self::Error>
Extract the lowest 64-bits (bits 0-63) from an object containing an i256.
Sourcefn u256_add(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
fn u256_add(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
Performs checked integer addition. Computes lhs + rhs
, returning ScError
if overflow occurred.
Sourcefn u256_sub(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
fn u256_sub(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
Performs checked integer subtraction. Computes lhs - rhs
, returning ScError
if overflow occurred.
Sourcefn u256_mul(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
fn u256_mul(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
Performs checked integer multiplication. Computes lhs * rhs
, returning ScError
if overflow occurred.
Sourcefn u256_div(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
fn u256_div(&self, lhs: U256Val, rhs: U256Val) -> Result<U256Val, Self::Error>
Performs checked integer division. Computes lhs / rhs
, returning ScError
if rhs == 0
or overflow occurred.
Sourcefn u256_rem_euclid(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>
fn u256_rem_euclid( &self, lhs: U256Val, rhs: U256Val, ) -> Result<U256Val, Self::Error>
Performs checked Euclidean modulo. Computes lhs % rhs
, returning ScError
if rhs == 0
or overflow occurred.
Sourcefn u256_pow(&self, lhs: U256Val, rhs: U32Val) -> Result<U256Val, Self::Error>
fn u256_pow(&self, lhs: U256Val, rhs: U32Val) -> Result<U256Val, Self::Error>
Performs checked exponentiation. Computes lhs.exp(rhs)
, returning ScError
if overflow occurred.
Sourcefn u256_shl(&self, lhs: U256Val, rhs: U32Val) -> Result<U256Val, Self::Error>
fn u256_shl(&self, lhs: U256Val, rhs: U32Val) -> Result<U256Val, Self::Error>
Performs checked shift left. Computes lhs << rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.
Sourcefn u256_shr(&self, lhs: U256Val, rhs: U32Val) -> Result<U256Val, Self::Error>
fn u256_shr(&self, lhs: U256Val, rhs: U32Val) -> Result<U256Val, Self::Error>
Performs checked shift right. Computes lhs >> rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.
Sourcefn i256_add(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
fn i256_add(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
Performs checked integer addition. Computes lhs + rhs
, returning ScError
if overflow occurred.
Sourcefn i256_sub(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
fn i256_sub(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
Performs checked integer subtraction. Computes lhs - rhs
, returning ScError
if overflow occurred.
Sourcefn i256_mul(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
fn i256_mul(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
Performs checked integer multiplication. Computes lhs * rhs
, returning ScError
if overflow occurred.
Sourcefn i256_div(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
fn i256_div(&self, lhs: I256Val, rhs: I256Val) -> Result<I256Val, Self::Error>
Performs checked integer division. Computes lhs / rhs
, returning ScError
if rhs == 0
or overflow occurred.
Sourcefn i256_rem_euclid(
&self,
lhs: I256Val,
rhs: I256Val,
) -> Result<I256Val, Self::Error>
fn i256_rem_euclid( &self, lhs: I256Val, rhs: I256Val, ) -> Result<I256Val, Self::Error>
Performs checked Euclidean modulo. Computes lhs % rhs
, returning ScError
if rhs == 0
or overflow occurred.
Sourcefn i256_pow(&self, lhs: I256Val, rhs: U32Val) -> Result<I256Val, Self::Error>
fn i256_pow(&self, lhs: I256Val, rhs: U32Val) -> Result<I256Val, Self::Error>
Performs checked exponentiation. Computes lhs.exp(rhs)
, returning ScError
if overflow occurred.
Sourcefn i256_shl(&self, lhs: I256Val, rhs: U32Val) -> Result<I256Val, Self::Error>
fn i256_shl(&self, lhs: I256Val, rhs: U32Val) -> Result<I256Val, Self::Error>
Performs checked shift left. Computes lhs << rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.
Sourcefn i256_shr(&self, lhs: I256Val, rhs: U32Val) -> Result<I256Val, Self::Error>
fn i256_shr(&self, lhs: I256Val, rhs: U32Val) -> Result<I256Val, Self::Error>
Performs checked shift right. Computes lhs >> rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.
Sourcefn timepoint_obj_from_u64(&self, v: u64) -> Result<TimepointObject, Self::Error>
fn timepoint_obj_from_u64(&self, v: u64) -> Result<TimepointObject, Self::Error>
Convert a u64
to a Timepoint
object.
Sourcefn timepoint_obj_to_u64(&self, obj: TimepointObject) -> Result<u64, Self::Error>
fn timepoint_obj_to_u64(&self, obj: TimepointObject) -> Result<u64, Self::Error>
Convert a Timepoint
object to a u64
.
Sourcefn duration_obj_from_u64(&self, v: u64) -> Result<DurationObject, Self::Error>
fn duration_obj_from_u64(&self, v: u64) -> Result<DurationObject, Self::Error>
Convert a u64
to a Duration
object.
Sourcefn duration_obj_to_u64(&self, obj: DurationObject) -> Result<u64, Self::Error>
fn duration_obj_to_u64(&self, obj: DurationObject) -> Result<u64, Self::Error>
Convert a Duration
object a u64
.
Sourcefn map_put(
&self,
m: MapObject,
k: Val,
v: Val,
) -> Result<MapObject, Self::Error>
fn map_put( &self, m: MapObject, k: Val, v: Val, ) -> Result<MapObject, Self::Error>
Insert a key/value mapping into an existing map, and return the map object handle. If the map already has a mapping for the given key, the previous value is overwritten.
Sourcefn map_get(&self, m: MapObject, k: Val) -> Result<Val, Self::Error>
fn map_get(&self, m: MapObject, k: Val) -> Result<Val, Self::Error>
Get the value for a key from a map. Traps if key is not found.
Sourcefn map_del(&self, m: MapObject, k: Val) -> Result<MapObject, Self::Error>
fn map_del(&self, m: MapObject, k: Val) -> Result<MapObject, Self::Error>
Remove a key/value mapping from a map if it exists, traps if doesn’t.
Sourcefn map_has(&self, m: MapObject, k: Val) -> Result<Bool, Self::Error>
fn map_has(&self, m: MapObject, k: Val) -> Result<Bool, Self::Error>
Test for the presence of a key in a map. Returns Bool.
Sourcefn map_key_by_pos(&self, m: MapObject, i: U32Val) -> Result<Val, Self::Error>
fn map_key_by_pos(&self, m: MapObject, i: U32Val) -> Result<Val, Self::Error>
Get the key from a map at position i
. If i
is an invalid position, return ScError.
Sourcefn map_val_by_pos(&self, m: MapObject, i: U32Val) -> Result<Val, Self::Error>
fn map_val_by_pos(&self, m: MapObject, i: U32Val) -> Result<Val, Self::Error>
Get the value from a map at position i
. If i
is an invalid position, return ScError.
Sourcefn map_keys(&self, m: MapObject) -> Result<VecObject, Self::Error>
fn map_keys(&self, m: MapObject) -> Result<VecObject, Self::Error>
Return a new vector containing all the keys in a map. The new vector is ordered in the original map’s key-sorted order.
Sourcefn map_values(&self, m: MapObject) -> Result<VecObject, Self::Error>
fn map_values(&self, m: MapObject) -> Result<VecObject, Self::Error>
Return a new vector containing all the values in a map. The new vector is ordered in the original map’s key-sorted order.
Sourcefn map_new_from_linear_memory(
&self,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val,
) -> Result<MapObject, Self::Error>
fn map_new_from_linear_memory( &self, keys_pos: U32Val, vals_pos: U32Val, len: U32Val, ) -> Result<MapObject, Self::Error>
Return a new map initialized from a pair of equal-length arrays, one for keys and one for values, given by a pair of linear-memory addresses and a length in Vals.
Sourcefn map_unpack_to_linear_memory(
&self,
map: MapObject,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>
fn map_unpack_to_linear_memory( &self, map: MapObject, keys_pos: U32Val, vals_pos: U32Val, len: U32Val, ) -> Result<Void, Self::Error>
Copy Vals from map
to the array vals_pos
, selecting only the keys identified by the array keys_pos
. Both arrays have len
elements and are identified by linear-memory addresses.
Sourcefn vec_put(
&self,
v: VecObject,
i: U32Val,
x: Val,
) -> Result<VecObject, Self::Error>
fn vec_put( &self, v: VecObject, i: U32Val, x: Val, ) -> Result<VecObject, Self::Error>
Update the value at index i
in the vector. Return the new vector. Trap if the index is out of bounds.
Sourcefn vec_get(&self, v: VecObject, i: U32Val) -> Result<Val, Self::Error>
fn vec_get(&self, v: VecObject, i: U32Val) -> Result<Val, Self::Error>
Returns the element at index i
of the vector. Traps if the index is out of bound.
Sourcefn vec_del(&self, v: VecObject, i: U32Val) -> Result<VecObject, Self::Error>
fn vec_del(&self, v: VecObject, i: U32Val) -> Result<VecObject, Self::Error>
Delete an element in a vector at index i
, shifting all elements after it to the left. Return the new vector. Traps if the index is out of bound.
Sourcefn vec_push_front(&self, v: VecObject, x: Val) -> Result<VecObject, Self::Error>
fn vec_push_front(&self, v: VecObject, x: Val) -> Result<VecObject, Self::Error>
Push a value to the front of a vector.
Sourcefn vec_pop_front(&self, v: VecObject) -> Result<VecObject, Self::Error>
fn vec_pop_front(&self, v: VecObject) -> Result<VecObject, Self::Error>
Removes the first element from the vector and returns the new vector. Traps if original vector is empty.
Sourcefn vec_push_back(&self, v: VecObject, x: Val) -> Result<VecObject, Self::Error>
fn vec_push_back(&self, v: VecObject, x: Val) -> Result<VecObject, Self::Error>
Appends an element to the back of the vector.
Sourcefn vec_pop_back(&self, v: VecObject) -> Result<VecObject, Self::Error>
fn vec_pop_back(&self, v: VecObject) -> Result<VecObject, Self::Error>
Removes the last element from the vector and returns the new vector. Traps if original vector is empty.
Sourcefn vec_front(&self, v: VecObject) -> Result<Val, Self::Error>
fn vec_front(&self, v: VecObject) -> Result<Val, Self::Error>
Return the first element in the vector. Traps if the vector is empty
Sourcefn vec_back(&self, v: VecObject) -> Result<Val, Self::Error>
fn vec_back(&self, v: VecObject) -> Result<Val, Self::Error>
Return the last element in the vector. Traps if the vector is empty
Sourcefn vec_insert(
&self,
v: VecObject,
i: U32Val,
x: Val,
) -> Result<VecObject, Self::Error>
fn vec_insert( &self, v: VecObject, i: U32Val, x: Val, ) -> Result<VecObject, Self::Error>
Inserts an element at index i
within the vector, shifting all elements after it to the right. Traps if the index is out of bound
Sourcefn vec_append(
&self,
v1: VecObject,
v2: VecObject,
) -> Result<VecObject, Self::Error>
fn vec_append( &self, v1: VecObject, v2: VecObject, ) -> Result<VecObject, Self::Error>
Clone the vector v1
, then moves all the elements of vector v2
into it. Return the new vector. Traps if number of elements in the vector overflows a u32.
Sourcefn vec_slice(
&self,
v: VecObject,
start: U32Val,
end: U32Val,
) -> Result<VecObject, Self::Error>
fn vec_slice( &self, v: VecObject, start: U32Val, end: U32Val, ) -> Result<VecObject, Self::Error>
Copy the elements from start
index until end
index, exclusive, in the vector and create a new vector from it. Return the new vector. Traps if the index is out of bound.
Sourcefn vec_first_index_of(&self, v: VecObject, x: Val) -> Result<Val, Self::Error>
fn vec_first_index_of(&self, v: VecObject, x: Val) -> Result<Val, Self::Error>
Get the index of the first occurrence of a given element in the vector. Returns the u32 index of the value if it’s there. Otherwise, it returns Void
.
Sourcefn vec_last_index_of(&self, v: VecObject, x: Val) -> Result<Val, Self::Error>
fn vec_last_index_of(&self, v: VecObject, x: Val) -> Result<Val, Self::Error>
Get the index of the last occurrence of a given element in the vector. Returns the u32 index of the value if it’s there. Otherwise, it returns Void
.
Sourcefn vec_binary_search(&self, v: VecObject, x: Val) -> Result<u64, Self::Error>
fn vec_binary_search(&self, v: VecObject, x: Val) -> Result<u64, Self::Error>
Binary search a sorted vector for a given element. If it exists, the high 32 bits of the return value is 0x0000_0001 and the low 32 bits contain the u32 index of the element. If it does not exist, the high 32 bits of the return value is 0x0000_0000 and the low-32 bits contain the u32 index at which the element would need to be inserted into the vector to maintain sorted order.
Sourcefn vec_new_from_linear_memory(
&self,
vals_pos: U32Val,
len: U32Val,
) -> Result<VecObject, Self::Error>
fn vec_new_from_linear_memory( &self, vals_pos: U32Val, len: U32Val, ) -> Result<VecObject, Self::Error>
Return a new vec initialized from an input slice of Vals given by a linear-memory address and length in Vals.
Sourcefn vec_unpack_to_linear_memory(
&self,
vec: VecObject,
vals_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>
fn vec_unpack_to_linear_memory( &self, vec: VecObject, vals_pos: U32Val, len: U32Val, ) -> Result<Void, Self::Error>
Copy the Vals of a vec into an array at a given linear-memory address and length in Vals.
fn put_contract_data( &self, k: Val, v: Val, t: StorageType, ) -> Result<Void, Self::Error>
fn has_contract_data(&self, k: Val, t: StorageType) -> Result<Bool, Self::Error>
fn get_contract_data(&self, k: Val, t: StorageType) -> Result<Val, Self::Error>
fn del_contract_data(&self, k: Val, t: StorageType) -> Result<Void, Self::Error>
Sourcefn create_contract(
&self,
deployer: AddressObject,
wasm_hash: BytesObject,
salt: BytesObject,
) -> Result<AddressObject, Self::Error>
fn create_contract( &self, deployer: AddressObject, wasm_hash: BytesObject, salt: BytesObject, ) -> Result<AddressObject, Self::Error>
Creates the contract instance on behalf of deployer
. deployer
must authorize this call via Soroban auth framework, i.e. this calls deployer.require_auth
with respective arguments. wasm_hash
must be a hash of the contract code that has already been uploaded on this network. salt
is used to create a unique contract id. Returns the address of the created contract.
Sourcefn create_asset_contract(
&self,
serialized_asset: BytesObject,
) -> Result<AddressObject, Self::Error>
fn create_asset_contract( &self, serialized_asset: BytesObject, ) -> Result<AddressObject, Self::Error>
Creates the instance of Stellar Asset contract corresponding to the provided asset. serialized_asset
is stellar::Asset
XDR serialized to bytes format. Returns the address of the created contract.
Sourcefn upload_wasm(&self, wasm: BytesObject) -> Result<BytesObject, Self::Error>
fn upload_wasm(&self, wasm: BytesObject) -> Result<BytesObject, Self::Error>
Uploads provided wasm
bytecode to the network and returns its identifier (SHA-256 hash). No-op in case if the same Wasm object already exists.
Sourcefn update_current_contract_wasm(
&self,
hash: BytesObject,
) -> Result<Void, Self::Error>
fn update_current_contract_wasm( &self, hash: BytesObject, ) -> Result<Void, Self::Error>
Replaces the executable of the current contract with the provided Wasm code identified by a hash. Wasm entry corresponding to the hash has to already be present in the ledger. The update happens only after the current contract invocation has successfully finished, so this can be safely called in the middle of a function.
Sourcefn extend_contract_data_ttl(
&self,
k: Val,
t: StorageType,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>
fn extend_contract_data_ttl( &self, k: Val, t: StorageType, threshold: U32Val, extend_to: U32Val, ) -> Result<Void, Self::Error>
If the entry’s TTL is below threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledger. If attempting to extend the entry past the maximum allowed value (defined as the current ledger + max_entry_ttl
- 1), and the entry is Persistent
, its new live_until_ledger_seq
will be clamped to the max; if the entry is Temporary
, the function traps.
Sourcefn extend_current_contract_instance_and_code_ttl(
&self,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>
fn extend_current_contract_instance_and_code_ttl( &self, threshold: U32Val, extend_to: U32Val, ) -> Result<Void, Self::Error>
If the TTL for the current contract instance and code (if applicable) is below threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledger. If attempting to extend past the maximum allowed value (defined as the current ledger + max_entry_ttl
- 1), the new live_until_ledger_seq
will be clamped to the max.
Sourcefn extend_contract_instance_and_code_ttl(
&self,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>
fn extend_contract_instance_and_code_ttl( &self, contract: AddressObject, threshold: U32Val, extend_to: U32Val, ) -> Result<Void, Self::Error>
If the TTL for the provided contract instance and code (if applicable) is below threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledger. If attempting to extend past the maximum allowed value (defined as the current ledger + max_entry_ttl
- 1), the new live_until_ledger_seq
will be clamped to the max.
Sourcefn get_contract_id(
&self,
deployer: AddressObject,
salt: BytesObject,
) -> Result<AddressObject, Self::Error>
fn get_contract_id( &self, deployer: AddressObject, salt: BytesObject, ) -> Result<AddressObject, Self::Error>
Get the id of a contract without creating it. deployer
is address of the contract deployer. salt
is used to create a unique contract id. Returns the address of the would-be contract.
Sourcefn get_asset_contract_id(
&self,
serialized_asset: BytesObject,
) -> Result<AddressObject, Self::Error>
fn get_asset_contract_id( &self, serialized_asset: BytesObject, ) -> Result<AddressObject, Self::Error>
Get the id of the Stellar Asset contract corresponding to the provided asset without creating the instance. serialized_asset
is stellar::Asset
XDR serialized to bytes format. Returns the address of the would-be asset contract.
Sourcefn extend_contract_instance_ttl(
&self,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>
fn extend_contract_instance_ttl( &self, contract: AddressObject, threshold: U32Val, extend_to: U32Val, ) -> Result<Void, Self::Error>
If the TTL for the provided contract instance is below threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledger. If attempting to extend past the maximum allowed value (defined as the current ledger + max_entry_ttl
- 1), the new live_until_ledger_seq
will be clamped to the max.
Sourcefn extend_contract_code_ttl(
&self,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val,
) -> Result<Void, Self::Error>
fn extend_contract_code_ttl( &self, contract: AddressObject, threshold: U32Val, extend_to: U32Val, ) -> Result<Void, Self::Error>
If the TTL for the provided contract’s code (if applicable) is below threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledger. If attempting to extend past the maximum allowed value (defined as the current ledger + max_entry_ttl
- 1), the new live_until_ledger_seq
will be clamped to the max.
Sourcefn create_contract_with_constructor(
&self,
deployer: AddressObject,
wasm_hash: BytesObject,
salt: BytesObject,
constructor_args: VecObject,
) -> Result<AddressObject, Self::Error>
fn create_contract_with_constructor( &self, deployer: AddressObject, wasm_hash: BytesObject, salt: BytesObject, constructor_args: VecObject, ) -> Result<AddressObject, Self::Error>
Creates the contract instance on behalf of deployer
. Created contract must be created from a Wasm that has a constructor. deployer
must authorize this call via Soroban auth framework, i.e. this calls deployer.require_auth
with respective arguments. wasm_hash
must be a hash of the contract code that has already been uploaded on this network. salt
is used to create a unique contract id. constructor_args
are forwarded into created contract’s constructor (__constructor
) function. Returns the address of the created contract.
Sourcefn call(
&self,
contract: AddressObject,
func: Symbol,
args: VecObject,
) -> Result<Val, Self::Error>
fn call( &self, contract: AddressObject, func: Symbol, args: VecObject, ) -> Result<Val, Self::Error>
Calls a function in another contract with arguments contained in vector args
. If the call is successful, returns the result of the called function. Traps otherwise.
Sourcefn try_call(
&self,
contract: AddressObject,
func: Symbol,
args: VecObject,
) -> Result<Val, Self::Error>
fn try_call( &self, contract: AddressObject, func: Symbol, args: VecObject, ) -> Result<Val, Self::Error>
Calls a function in another contract with arguments contained in vector args
, returning either the result of the called function or an Error
if the called function failed. The returned error is either a custom ContractError
that the called contract returns explicitly, or an error with type Context
and code InvalidAction
in case of any other error in the called contract (such as a host function failure that caused a trap). try_call
might trap in a few scenarios where the error can’t be meaningfully recovered from, such as running out of budget.
Sourcefn serialize_to_bytes(&self, v: Val) -> Result<BytesObject, Self::Error>
fn serialize_to_bytes(&self, v: Val) -> Result<BytesObject, Self::Error>
Serializes an (SC)Val into XDR opaque Bytes
object.
Sourcefn deserialize_from_bytes(&self, b: BytesObject) -> Result<Val, Self::Error>
fn deserialize_from_bytes(&self, b: BytesObject) -> Result<Val, Self::Error>
Deserialize a Bytes
object to get back the (SC)Val.
Sourcefn bytes_copy_to_linear_memory(
&self,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>
fn bytes_copy_to_linear_memory( &self, b: BytesObject, b_pos: U32Val, lm_pos: U32Val, len: U32Val, ) -> Result<Void, Self::Error>
Copies a slice of bytes from a Bytes
object specified at offset b_pos
with length len
into the linear memory at position lm_pos
. Traps if either the Bytes
object or the linear memory doesn’t have enough bytes.
Sourcefn bytes_copy_from_linear_memory(
&self,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<BytesObject, Self::Error>
fn bytes_copy_from_linear_memory( &self, b: BytesObject, b_pos: U32Val, lm_pos: U32Val, len: U32Val, ) -> Result<BytesObject, Self::Error>
Copies a segment of the linear memory specified at position lm_pos
with length len
, into a Bytes
object at offset b_pos
. The Bytes
object may grow in size to accommodate the new bytes. Traps if the linear memory doesn’t have enough bytes.
Sourcefn bytes_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val,
) -> Result<BytesObject, Self::Error>
fn bytes_new_from_linear_memory( &self, lm_pos: U32Val, len: U32Val, ) -> Result<BytesObject, Self::Error>
Constructs a new Bytes
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.
Sourcefn bytes_new(&self) -> Result<BytesObject, Self::Error>
fn bytes_new(&self) -> Result<BytesObject, Self::Error>
Create an empty new Bytes
object.
Sourcefn bytes_put(
&self,
b: BytesObject,
i: U32Val,
u: U32Val,
) -> Result<BytesObject, Self::Error>
fn bytes_put( &self, b: BytesObject, i: U32Val, u: U32Val, ) -> Result<BytesObject, Self::Error>
Update the value at index i
in the Bytes
object. Return the new Bytes
. Trap if the index is out of bounds.
Sourcefn bytes_get(&self, b: BytesObject, i: U32Val) -> Result<U32Val, Self::Error>
fn bytes_get(&self, b: BytesObject, i: U32Val) -> Result<U32Val, Self::Error>
Returns the element at index i
of the Bytes
object. Traps if the index is out of bound.
Sourcefn bytes_del(
&self,
b: BytesObject,
i: U32Val,
) -> Result<BytesObject, Self::Error>
fn bytes_del( &self, b: BytesObject, i: U32Val, ) -> Result<BytesObject, Self::Error>
Delete an element in a Bytes
object at index i
, shifting all elements after it to the left. Return the new Bytes
. Traps if the index is out of bound.
Sourcefn bytes_len(&self, b: BytesObject) -> Result<U32Val, Self::Error>
fn bytes_len(&self, b: BytesObject) -> Result<U32Val, Self::Error>
Returns length of the Bytes
object.
Sourcefn bytes_push(
&self,
b: BytesObject,
u: U32Val,
) -> Result<BytesObject, Self::Error>
fn bytes_push( &self, b: BytesObject, u: U32Val, ) -> Result<BytesObject, Self::Error>
Appends an element to the back of the Bytes
object.
Sourcefn bytes_pop(&self, b: BytesObject) -> Result<BytesObject, Self::Error>
fn bytes_pop(&self, b: BytesObject) -> Result<BytesObject, Self::Error>
Removes the last element from the Bytes
object and returns the new Bytes
. Traps if original Bytes
is empty.
Sourcefn bytes_front(&self, b: BytesObject) -> Result<U32Val, Self::Error>
fn bytes_front(&self, b: BytesObject) -> Result<U32Val, Self::Error>
Return the first element in the Bytes
object. Traps if the Bytes
is empty
Sourcefn bytes_back(&self, b: BytesObject) -> Result<U32Val, Self::Error>
fn bytes_back(&self, b: BytesObject) -> Result<U32Val, Self::Error>
Return the last element in the Bytes
object. Traps if the Bytes
is empty
Sourcefn bytes_insert(
&self,
b: BytesObject,
i: U32Val,
u: U32Val,
) -> Result<BytesObject, Self::Error>
fn bytes_insert( &self, b: BytesObject, i: U32Val, u: U32Val, ) -> Result<BytesObject, Self::Error>
Inserts an element at index i
within the Bytes
object, shifting all elements after it to the right. Traps if the index is out of bound
Sourcefn bytes_append(
&self,
b1: BytesObject,
b2: BytesObject,
) -> Result<BytesObject, Self::Error>
fn bytes_append( &self, b1: BytesObject, b2: BytesObject, ) -> Result<BytesObject, Self::Error>
Clone the Bytes
object b1
, then moves all the elements of Bytes
object b2
into it. Return the new Bytes
. Traps if its length overflows a u32.
Sourcefn bytes_slice(
&self,
b: BytesObject,
start: U32Val,
end: U32Val,
) -> Result<BytesObject, Self::Error>
fn bytes_slice( &self, b: BytesObject, start: U32Val, end: U32Val, ) -> Result<BytesObject, Self::Error>
Copies the elements from start
index until end
index, exclusive, in the Bytes
object and creates a new Bytes
from it. Returns the new Bytes
. Traps if the index is out of bound.
Sourcefn string_copy_to_linear_memory(
&self,
s: StringObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>
fn string_copy_to_linear_memory( &self, s: StringObject, s_pos: U32Val, lm_pos: U32Val, len: U32Val, ) -> Result<Void, Self::Error>
Copies a slice of bytes from a String
object specified at offset s_pos
with length len
into the linear memory at position lm_pos
. Traps if either the String
object or the linear memory doesn’t have enough bytes.
Sourcefn symbol_copy_to_linear_memory(
&self,
s: SymbolObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val,
) -> Result<Void, Self::Error>
fn symbol_copy_to_linear_memory( &self, s: SymbolObject, s_pos: U32Val, lm_pos: U32Val, len: U32Val, ) -> Result<Void, Self::Error>
Copies a slice of bytes from a Symbol
object specified at offset s_pos
with length len
into the linear memory at position lm_pos
. Traps if either the String
object or the linear memory doesn’t have enough bytes.
Sourcefn string_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val,
) -> Result<StringObject, Self::Error>
fn string_new_from_linear_memory( &self, lm_pos: U32Val, len: U32Val, ) -> Result<StringObject, Self::Error>
Constructs a new String
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.
Sourcefn symbol_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val,
) -> Result<SymbolObject, Self::Error>
fn symbol_new_from_linear_memory( &self, lm_pos: U32Val, len: U32Val, ) -> Result<SymbolObject, Self::Error>
Constructs a new Symbol
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.
Sourcefn string_len(&self, s: StringObject) -> Result<U32Val, Self::Error>
fn string_len(&self, s: StringObject) -> Result<U32Val, Self::Error>
Returns length of the String
object.
Sourcefn symbol_len(&self, s: SymbolObject) -> Result<U32Val, Self::Error>
fn symbol_len(&self, s: SymbolObject) -> Result<U32Val, Self::Error>
Returns length of the Symbol
object.
Sourcefn symbol_index_in_linear_memory(
&self,
sym: Symbol,
slices_pos: U32Val,
len: U32Val,
) -> Result<U32Val, Self::Error>
fn symbol_index_in_linear_memory( &self, sym: Symbol, slices_pos: U32Val, len: U32Val, ) -> Result<U32Val, Self::Error>
Return the index of a Symbol in an array of linear-memory byte-slices, or trap if not found.
fn compute_hash_sha256( &self, x: BytesObject, ) -> Result<BytesObject, Self::Error>
fn verify_sig_ed25519( &self, k: BytesObject, x: BytesObject, s: BytesObject, ) -> Result<Void, Self::Error>
Sourcefn compute_hash_keccak256(
&self,
x: BytesObject,
) -> Result<BytesObject, Self::Error>
fn compute_hash_keccak256( &self, x: BytesObject, ) -> Result<BytesObject, Self::Error>
Returns the keccak256 hash of given input bytes.
Sourcefn recover_key_ecdsa_secp256k1(
&self,
msg_digest: BytesObject,
signature: BytesObject,
recovery_id: U32Val,
) -> Result<BytesObject, Self::Error>
fn recover_key_ecdsa_secp256k1( &self, msg_digest: BytesObject, signature: BytesObject, recovery_id: U32Val, ) -> Result<BytesObject, Self::Error>
Recovers the SEC-1-encoded ECDSA secp256k1 public key that produced a given 64-byte signature
over a given 32-byte msg_digest
for a given recovery_id
byte. Warning: The msg_digest
must be produced by a secure cryptographic hash function on the message, otherwise the attacker can potentially forge signatures. The signature
is the ECDSA signature (r, s)
serialized as fixed-size big endian scalar values, both r
, s
must be non-zero and s
must be in the lower range. Returns a BytesObject
containing 65-bytes representing SEC-1 encoded point in uncompressed format. The recovery_id
is an integer value 0
, 1
, 2
, or 3
, the low bit (0/1) indicates the parity of the y-coordinate of the public_key
(even/odd) and the high bit (3/4) indicate if the r
(x-coordinate of k x G
) has overflown during its computation.
Sourcefn verify_sig_ecdsa_secp256r1(
&self,
public_key: BytesObject,
msg_digest: BytesObject,
signature: BytesObject,
) -> Result<Void, Self::Error>
fn verify_sig_ecdsa_secp256r1( &self, public_key: BytesObject, msg_digest: BytesObject, signature: BytesObject, ) -> Result<Void, Self::Error>
Verifies the signature
using an ECDSA secp256r1 public_key
on a 32-byte msg_digest
. Warning: The msg_digest
must be produced by a secure cryptographic hash function on the message, otherwise the attacker can potentially forge signatures. The public_key
is expected to be 65 bytes in length, representing a SEC-1 encoded point in uncompressed format. The signature
is the ECDSA signature (r, s)
serialized as fixed-size big endian scalar values, both r
, s
must be non-zero and s
must be in the lower range.
Sourcefn bls12_381_check_g1_is_in_subgroup(
&self,
point: BytesObject,
) -> Result<Bool, Self::Error>
fn bls12_381_check_g1_is_in_subgroup( &self, point: BytesObject, ) -> Result<Bool, Self::Error>
Checks if the input G1 point is in the correct subgroup.
Sourcefn bls12_381_g1_add(
&self,
point1: BytesObject,
point2: BytesObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_g1_add( &self, point1: BytesObject, point2: BytesObject, ) -> Result<BytesObject, Self::Error>
Adds two BLS12-381 G1 points given in bytes format and returns the resulting G1 point in bytes format. G1 serialization format: concat(be_bytes(X), be_bytes(Y))
and the most significant three bits of X encodes flags, i.e. bits(X) = [compression_flag, infinity_flag, sort_flag, bit_3, .. bit_383]. This function does NOT perform subgroup check on the inputs.
Sourcefn bls12_381_g1_mul(
&self,
point: BytesObject,
scalar: U256Val,
) -> Result<BytesObject, Self::Error>
fn bls12_381_g1_mul( &self, point: BytesObject, scalar: U256Val, ) -> Result<BytesObject, Self::Error>
Multiplies a BLS12-381 G1 point by a scalar (Fr), and returns the resulting G1 point in bytes format.
Sourcefn bls12_381_g1_msm(
&self,
vp: VecObject,
vs: VecObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_g1_msm( &self, vp: VecObject, vs: VecObject, ) -> Result<BytesObject, Self::Error>
Performs multi-scalar-multiplication (inner product) on a vector of BLS12-381 G1 points (Vec<BytesObject>
) by a vector of scalars (Vec<U256Val>
), and returns the resulting G1 point in bytes format.
Sourcefn bls12_381_map_fp_to_g1(
&self,
fp: BytesObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_map_fp_to_g1( &self, fp: BytesObject, ) -> Result<BytesObject, Self::Error>
Maps a BLS12-381 field element (Fp) to G1 point. The input is a BytesObject containing Fp serialized in big-endian order
Sourcefn bls12_381_hash_to_g1(
&self,
msg: BytesObject,
dst: BytesObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_hash_to_g1( &self, msg: BytesObject, dst: BytesObject, ) -> Result<BytesObject, Self::Error>
Hashes a message to a BLS12-381 G1 point, with implementation following the specification in Hashing to Elliptic Curves (ciphersuite ‘BLS12381G1_XMD:SHA-256_SSWU_RO_’). dst
is the domain separation tag that will be concatenated with the msg
during hashing, it is intended to keep hashing inputs of different applications separate. It is required 0 < len(dst_bytes) < 256
. DST must be chosen with care to avoid compromising the application’s security properties. Refer to section 3.1 in the RFC on requirements of DST.
Sourcefn bls12_381_check_g2_is_in_subgroup(
&self,
point: BytesObject,
) -> Result<Bool, Self::Error>
fn bls12_381_check_g2_is_in_subgroup( &self, point: BytesObject, ) -> Result<Bool, Self::Error>
Checks if the input G2 point is in the correct subgroup.
Sourcefn bls12_381_g2_add(
&self,
point1: BytesObject,
point2: BytesObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_g2_add( &self, point1: BytesObject, point2: BytesObject, ) -> Result<BytesObject, Self::Error>
Adds two BLS12-381 G2 points given in bytes format and returns the resulting G2 point in bytes format. G2 serialization format: concat(be_bytes(X_c1), be_bytes(X_c0), be_bytes(Y_c1), be_bytes(Y_c0)), and the most significant three bits of X_c1 are flags i.e. bits(X_c1) = [compression_flag, infinity_flag, sort_flag, bit_3, .. bit_383]. This function does NOT perform subgroup check on the inputs.
Sourcefn bls12_381_g2_mul(
&self,
point: BytesObject,
scalar: U256Val,
) -> Result<BytesObject, Self::Error>
fn bls12_381_g2_mul( &self, point: BytesObject, scalar: U256Val, ) -> Result<BytesObject, Self::Error>
Multiplies a BLS12-381 G2 point by a scalar (Fr), and returns the resulting G2 point in bytes format.
Sourcefn bls12_381_g2_msm(
&self,
vp: VecObject,
vs: VecObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_g2_msm( &self, vp: VecObject, vs: VecObject, ) -> Result<BytesObject, Self::Error>
Performs multi-scalar-multiplication (inner product) on a vector of BLS12-381 G2 points (Vec<BytesObject>
) by a vector of scalars (Vec<U256Val>
) , and returns the resulting G2 point in bytes format.
Sourcefn bls12_381_map_fp2_to_g2(
&self,
fp2: BytesObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_map_fp2_to_g2( &self, fp2: BytesObject, ) -> Result<BytesObject, Self::Error>
Maps a BLS12-381 quadratic extension field element (Fp2) to G2 point. Fp2 serialization format: concat(be_bytes(c1), be_bytes(c0))
Sourcefn bls12_381_hash_to_g2(
&self,
msg: BytesObject,
dst: BytesObject,
) -> Result<BytesObject, Self::Error>
fn bls12_381_hash_to_g2( &self, msg: BytesObject, dst: BytesObject, ) -> Result<BytesObject, Self::Error>
Hashes a message to a BLS12-381 G2 point, with implementation following the specification in Hashing to Elliptic Curves (ciphersuite ‘BLS12381G2_XMD:SHA-256_SSWU_RO_’). dst
is the domain separation tag that will be concatenated with the msg
during hashing, it is intended to keep hashing inputs of different applications separate. It is required 0 < len(dst_bytes) < 256
. DST must be chosen with care to avoid compromising the application’s security properties. Refer to section 3.1 in the RFC on requirements of DST.
Sourcefn bls12_381_multi_pairing_check(
&self,
vp1: VecObject,
vp2: VecObject,
) -> Result<Bool, Self::Error>
fn bls12_381_multi_pairing_check( &self, vp1: VecObject, vp2: VecObject, ) -> Result<Bool, Self::Error>
performs pairing operation on a vector of G1
(Vec<BytesObject>
) and a vector of G2
points (Vec<BytesObject>
) , return true if the result equals 1_fp12
Sourcefn bls12_381_fr_add(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>
fn bls12_381_fr_add( &self, lhs: U256Val, rhs: U256Val, ) -> Result<U256Val, Self::Error>
performs addition (lhs + rhs) mod r
between two BLS12-381 scalar elements (Fr), where r is the subgroup order
Sourcefn bls12_381_fr_sub(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>
fn bls12_381_fr_sub( &self, lhs: U256Val, rhs: U256Val, ) -> Result<U256Val, Self::Error>
performs subtraction (lhs - rhs) mod r
between two BLS12-381 scalar elements (Fr), where r is the subgroup order
Sourcefn bls12_381_fr_mul(
&self,
lhs: U256Val,
rhs: U256Val,
) -> Result<U256Val, Self::Error>
fn bls12_381_fr_mul( &self, lhs: U256Val, rhs: U256Val, ) -> Result<U256Val, Self::Error>
performs multiplication (lhs * rhs) mod r
between two BLS12-381 scalar elements (Fr), where r is the subgroup order
Sourcefn bls12_381_fr_pow(
&self,
lhs: U256Val,
rhs: U64Val,
) -> Result<U256Val, Self::Error>
fn bls12_381_fr_pow( &self, lhs: U256Val, rhs: U64Val, ) -> Result<U256Val, Self::Error>
performs exponentiation of a BLS12-381 scalar element (Fr) with a u64 exponent i.e. lhs.exp(rhs) mod r
, where r is the subgroup order
Sourcefn bls12_381_fr_inv(&self, lhs: U256Val) -> Result<U256Val, Self::Error>
fn bls12_381_fr_inv(&self, lhs: U256Val) -> Result<U256Val, Self::Error>
performs inversion of a BLS12-381 scalar element (Fr) modulo r (the subgroup order)
Sourcefn require_auth_for_args(
&self,
address: AddressObject,
args: VecObject,
) -> Result<Void, Self::Error>
fn require_auth_for_args( &self, address: AddressObject, args: VecObject, ) -> Result<Void, Self::Error>
Checks if the address has authorized the invocation of the current contract function with the provided arguments. Traps if the invocation hasn’t been authorized.
Sourcefn require_auth(&self, address: AddressObject) -> Result<Void, Self::Error>
fn require_auth(&self, address: AddressObject) -> Result<Void, Self::Error>
Checks if the address has authorized the invocation of the current contract function with all the arguments of the invocation. Traps if the invocation hasn’t been authorized.
Sourcefn strkey_to_address(&self, strkey: Val) -> Result<AddressObject, Self::Error>
fn strkey_to_address(&self, strkey: Val) -> Result<AddressObject, Self::Error>
Converts a provided Stellar strkey address of an account or a contract (‘G…’ or ‘C…’ respectively) to an address object. strkey
can be either BytesObject
or StringObject
(the contents should represent the G.../C...
string in both cases). Any other valid or invalid strkey (e.g. ‘S…’) will trigger an error. Prefer directly using the Address objects whenever possible. This is only useful in the context of custom messaging protocols (e.g. cross-chain).
Sourcefn address_to_strkey(
&self,
address: AddressObject,
) -> Result<StringObject, Self::Error>
fn address_to_strkey( &self, address: AddressObject, ) -> Result<StringObject, Self::Error>
Converts a provided address to Stellar strkey format (‘G…’ for account or ‘C…’ for contract). Prefer directly using the Address objects whenever possible. This is only useful in the context of custom messaging protocols (e.g. cross-chain).
Authorizes sub-contract calls for the next contract call on behalf of the current contract. Every entry in the argument vector corresponds to InvokerContractAuthEntry
contract type that authorizes a tree of require_auth
calls on behalf of the current contract. The entries must not contain any authorizations for the direct contract call, i.e. if current contract needs to call contract function F1 that calls function F2 both of which require auth, only F2 should be present in auth_entries
.
Sourcefn dummy0(&self) -> Result<Val, Self::Error>
fn dummy0(&self) -> Result<Val, Self::Error>
A dummy function taking 0 arguments and performs no-op. This function is for test purpose only, for measuring the roundtrip cost of invoking a host function, i.e. host->Vm->host.
Sourcefn protocol_gated_dummy(&self) -> Result<Val, Self::Error>
fn protocol_gated_dummy(&self) -> Result<Val, Self::Error>
A dummy function for testing the protocol gating. Takes 0 arguments and performs no-op. Essentially this function is always protocol-gated out since it has min_supported_protocol == max_supported_protocol == 19
, thus having no effect on any protocol (Soroban starts at protocol 20). This is required for testing the scenario where ledger protocol version > host function max supported version, and the ledger protocol version must be <= the env
version (which starts at 20, and is a compile-time, non-overridable constant).
Sourcefn prng_reseed(&self, seed: BytesObject) -> Result<Void, Self::Error>
fn prng_reseed(&self, seed: BytesObject) -> Result<Void, Self::Error>
Reseed the frame-local PRNG with a given BytesObject, which should be 32 bytes long.
Sourcefn prng_bytes_new(&self, length: U32Val) -> Result<BytesObject, Self::Error>
fn prng_bytes_new(&self, length: U32Val) -> Result<BytesObject, Self::Error>
Construct a new BytesObject of the given length filled with bytes drawn from the frame-local PRNG.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.