I have an issue with invoking a function that uses struct as a parameter.
Before my struct looked like this:
pub struct Proposal { pub end_time: u64, pub url: String, }
On client side I would build the struct and invoke the function like this:
`const proposal = SorobanClient.xdr.ScVal.scvMap([
new SorobanClient.xdr.ScMapEntry({
key: SorobanClient.xdr.ScVal.scvSymbol("end_time"),
val: SorobanClient.nativeToScVal(input.deadline, { type: 'u64' })
}),
new SorobanClient.xdr.ScMapEntry({
key: SorobanClient.xdr.ScVal.scvSymbol("url"),
val: SorobanClient.nativeToScVal(input.proposalUrl)
// val: SorobanClient.nativeToScVal("www.epic.com", { type: 'string' })
}),
])
const creator = new SorobanClient.Address(
input.publicKey
).toScAddress();
console.log('proposal: ', proposal)
const transaction_object = new SorobanClient.TransactionBuilder(
account,
{
fee,
networkPassphrase: SorobanClient.Networks.FUTURENET,
}
)
.addOperation(
// An operation to call increment on the contract
contract.call(
"create_proposal",
SorobanClient.xdr.ScVal.scvAddress(creator),
proposal
))
.setTimeout(30)
.build();`
This worked very well when invoking it. Since then I added one more value into Proposal struct so now it looks like this:
pub struct Proposal { pub end_time: u64, pub url: String, pub min_quorum: i128, }
So client is slightly different when I construct the proposal, but invocation stays the same: