0

I'm trying to replicate the contracts call for the raw found below:

{ "branch": 
        "BMLgLBqf6dxFBNMLBBDkVtNSJCfQMcNxLiEmUKRmE8bYFrKY1CW", 
        "contents": 
        [ 
            { 
                "kind": "transaction", 
                "source": "MY TEZOS ADDRESS", 
                "fee": "1000", 
                "counter": "29412399", 
                "gas_limit": "8000", 
                "storage_limit": "250", 
                "amount": "0", 
                "destination": "CONTRACT ADDRESS ONE", 
                "parameters": {    
                    "entrypoint": "update_operators", 
                    "value": 
                    [ 
                        { 
                            "prim": "Left", 
                            "args": 
                            [ 
                                { 
                                    "prim": "Pair", 
                                    "args": 
                                    [ 
                                        { "string": "MY TEZOS ADDRESS" }, 
                                        { 
                                            "prim": "Pair", 
                                            "args": 
                                            [ 
                                                { "string": "ADDRESS 1" }, 
                                                { "int": "VALUE" } 
                                            ] 
                                        } 
                                    ] 
                                } 
                            ] 
                        } 
                    ] 
                } 
            }, 
            { 
                "kind": "transaction", 
                "source": "MY TEZOS ADDRESS", 
                "fee": "1500", 
                "counter": "29412400", 
                "gas_limit": "10000", 
                "storage_limit": "250", 
                "amount": "0", 
                "destination": "ADDRESS 1", 
                "parameters": 
                { 
                    "entrypoint": "offer", 
                    "value": 
                    { 
                        "prim": "Pair", 
                        "args": 
                        [ 
                            { 
                                "prim": "Pair", 
                                "args": 
                                [ 
                                    { "string": "VALUE" }, 
                                    { "int": "VALUE" } 
                                ] 
                            }, 
                                    
                            { "prim": "Pair", 
                            "args": 
                            [ 
                                { "int": "VALUE" }, 
                                { "int": "VALUE" } 
                            ] 
                        } 
                    ] 
                } 
            } 
        } 
    ] 
}

The below code is what I got for now:

async myFunction() {
        let contractOne = await this.tezos.contract.at("CONTRACT ADDRESS ONE");
        let contractTwo = await this.tezos.contract.at("ADDRESS 1");
        let batch = await this.tezos.wallet.batch()
            .withContractCall(contractOne.methods.update_operators([{0: {add_operator: ["MY TEZOS ADDRESS", "ADDRESS 1", "VALUE"]}}]))
            .withContractCall(contractTwo.methods.offer("VALUE", "VALUE", "VALUE", "VALUE"));
        try {
            var batchOp = await batch.send();
        } catch (error) {
            console.log("got this error", error)
        }
        console.log(batchOp)
        await batchOp.confirmation();
    }

I keep getting this error (I won't paste all of it as it is quite long but let me know if you need me to add it):

message: 'Http error response: (400) Failed to parse the request body: No case matched:\n'
status: 400,
  statusText: 'Bad Request',

Not sure what to try from now, any help is welcome

1 Answer 1

0

The contract call to update_operators seems to have the wrong parameters, try:

update_operators([{ add_operator: ["MY TEZOS ADDRESS", "ADDRESS 1", "VALUE"] }])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.