Skip to content

Commit

Permalink
GITBOOK-25: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
Bojan Angjelkoski authored and gitbook-bot committed Oct 16, 2023
1 parent 96219c1 commit 90817b6
Showing 1 changed file with 5 additions and 26 deletions.
31 changes: 5 additions & 26 deletions .gitbook/core-modules/wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ console.log(txHash);

### MsgExecuteContract (funds example)

In some scenario, depending on the smart contract's function we have to transfer tokens to the smart contract, following cosmwasm convention we use the funds field to transfer tokens to the smart contract from the user's bank module.
In some scenarios, depending on the smart contract's function we have to transfer tokens to the smart contract, following cosmwasm convention, we use the funds field to transfer tokens to the smart contract from the user's bank module.

Below is an example of how we can send the MsgExecuteContract using an `test` contract function.
Below is an example of how we can send the `MsgExecuteContract` using an `test` contract function.

```ts
import {
Expand Down Expand Up @@ -82,32 +82,11 @@ console.log(txHash);

### MsgExecuteContractCompact

There are some compatibility issue parsing the funds array in the previous example with EIP712.
Since MsgExecuteContract can't be converted to EIP712 and then signed by ethereum wallets, we introduced MsgExecuteContractCompact which converts the funds into a string and therefore allows for EIP712 transformation.
Note that the MsgExecuteContract and MsgExecuteContractCompat underlying messages are the same. MsgExecuteContractCompat will just format for EIP712 compatibility.
There are some compatibility issues parsing the `funds` array and `msgs` object in the previous example with EIP712. Since `MsgExecuteContract` can't be properly converted to EIP712 and then signed by Ethereum wallets, we introduced `MsgExecuteContractCompact` which is fully compatible with EIP712. 

An array of funds:
_**Note:**_ _`MsgExecuteContract` and `MsgExecuteContractCompat` underlying messages are the same. `MsgExecuteContractCompat` is just EIP712 compatible._

```ts
const funds = [
{
denom: denom1,
amount: new BigNumberInBase(1).toWei().toFixed(),
},
{
denom: denom2,
amount: new BigNumberInBase(1).toWei().toFixed(),
},
];
```

will be presented as a string like this:

```ts
const funds = "100000000000000000 denom1, 100000000000000000 denom2";
```

Below is an example of how we can send the MsgExecuteContractCompact using an `test` contract function.
Below is an example of how we can send the `MsgExecuteContractCompact` using an `test` contract function.

```ts
import {
Expand Down

0 comments on commit 90817b6

Please sign in to comment.