#Any method for converting Address into BytesN?
11 messages · Page 1 of 1 (latest)
let token_id = BytesN::from_val(&env, &token_address.to_raw());
let token_client = token::Client::new(&env, &token_id);
Looks like it should work but
test.rs
let token_id = env.register_stellar_asset_contract(admin.clone());
let token_address = Address::from_contract_id(&env, &token_id);
Fails with
running 1 test
thread 'test::test_faucet' panicked at 'HostError
Value: Status(UnknownError(0))
Debug events (newest first):
0: "escalating error '' to panic"
1: "contract call invocation resulted in error Status(UnknownError(0))"
2: "unexpected missing nonce"
3: "caught panic 'called `Result::unwrap()` on an `Err` value: ConversionError' from contract function 'Symbol(faucet)'"
4: "invoker account is not configured"
5: "no frames to derive the invoker from"
6: "unexpected missing nonce"
7: "invoker account is not configured"
8: "no frames to derive the invoker from"
9: "unexpected missing nonce"
10: ... elided ...
not sure why your code fails though
ah, let token_id = BytesN::from_val(&env, &token_address.to_raw()); shouldn't work
I don't quite understand what is the intent here. if you have something specific you want to deal with in this release, we can figure out a way around that, but in the next release it should become more straightforward
I can wait for next release. Your issue you linked is what I'll keep my eye on. Thanks
FWIW the only broken case I'm aware of for today is deploying and funding a contract in the same invocation
Mine is less of a case of broken and more "this is weird". Should we not allow cross contract calls to be instantiated with an Address vs BytesN? Like for example the token contract when fire that up from within a contract it'd be nice to be able to fire it up via an Address