I have a simple smart-contract that holds user funds and that can be withdrawn by sending a signed message.
However, I would like to offer the possibility for users to anticipate the fees they have to pay everytime they send funds to the contract.
I can properly call the contract with the taquito library by using the contract abstraction object:
const operation = await contract.methods
.feedUserAccount(this.tezosAddress)
.send({ amount });
However, when I test it with the EstimationProvider
class, I get a TezosOperationError:
try{
const e = await Tezos.contract.at("KT1KBhwoSeqJt26oK8yjubTfdSgDuaVC87xR");
const o = await Tezos.estimate.transfer({
to: "KT1KBhwoSeqJt26oK8yjubTfdSgDuaVC87xR",
amount: 1,
source: "tz1wWzjK62ft3jufvrua6zfT3sLVmo7776kq",
parameter: {
entrypoint: 'feedUserAccount',
value: {prim:"Left",args:[{prim:"Left",args:[{prim:"Right",args:[{string:"tz1wWzjK62ft3jufvrua6zfT3sLVmo7776kq"}]}]}]}
}
});
console.log(o.suggestedFeeMutez);
Error message:
TezosOperationError {
errors:
[ { kind: 'permanent',
id: 'proto.005-PsBabyM1.michelson_v1.bad_contract_parameter',
contract: 'KT1KBhwoSeqJt26oK8yjubTfdSgDuaVC87xR' },
{ kind: 'permanent',
id: 'proto.005-PsBabyM1.invalidSyntacticConstantError',
location: 0,
expectedForm: [Object],
wrongExpression: [Object] },
{ kind: 'permanent',
id: 'proto.005-PsBabyM1.invalidSyntacticConstantError',
location: 0,
expectedForm: [Object],
wrongExpression: [Object] },
{ kind: 'permanent',
id: 'proto.005-PsBabyM1.invalidSyntacticConstantError',
location: 0,
expectedForm: [Object],
wrongExpression: [Object] },
{ kind: 'permanent',
id: 'proto.005-PsBabyM1.invalidSyntacticConstantError',
location: 0,
expectedForm: [Object],
wrongExpression: [Object] },
{ kind: 'permanent',
id: 'proto.005-PsBabyM1.michelson_v1.invalid_expression_kind',
location: 0,
expected_kinds: [Array],
wrong_kind: 'primitiveApplication' } ],
name: 'TezosOperationError',
id: 'proto.005-PsBabyM1.michelson_v1.invalid_expression_kind',
kind: 'permanent',
message: '(permanent) proto.005-PsBabyM1.michelson_v1.invalid_expression_kind' }
The feedUserAccount
expects a key_hash
and I generated the value
parameter with SmartPY explorer.
But I can't make it work, is it the library or the way I generate the query?
The babylonet contract can be found at this address: KT1KBhwoSeqJt26oK8yjubTfdSgDuaVC87xR