Skip to content

Commit

Permalink
wasm tx's signing (#312)
Browse files Browse the repository at this point in the history
* update sdk for signing wasm tx type

* update squid types

---------

Co-authored-by: Juan Manuel Villarraza <[email protected]>
  • Loading branch information
nnoln and jmdev3 authored Jun 3, 2024
1 parent cb446a4 commit 6e4460d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"semver": "^7.5.4"
},
"devDependencies": {
"@0xsquid/squid-types": "0.1.67",
"@0xsquid/squid-types": "0.1.75",
"@babel/core": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
Expand Down
13 changes: 12 additions & 1 deletion src/handlers/cosmos/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from "./cctpProto";

import { fromBech32, toBech32 } from "@cosmjs/encoding";
import { fromBech32, toBech32, toUtf8 } from "@cosmjs/encoding";
import { calculateFee, Coin, GasPrice, StargateClient } from "@cosmjs/stargate";

import {
Expand All @@ -15,8 +15,10 @@ import {
CCTP_TYPE,
RouteRequest,
IBC_TRANSFER_TYPE,
WASM_TYPE,
} from "../../types";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx";
import { MsgDepositForBurn } from "./cctpProto";
import { TokensChains } from "../../utils/TokensChains";

Expand Down Expand Up @@ -85,6 +87,15 @@ export class CosmosHandler {

break;

case WASM_TYPE:
// register execute wasm msg type for signer
signer.registry.register(WASM_TYPE, MsgExecuteContract);

cosmosMsg.value.msg = toUtf8(cosmosMsg.value.msg);
msgs.push(cosmosMsg);

break;

default:
throw new Error(`Cosmos message ${cosmosMsg.typeUrl} not supported`);
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


"@0xsquid/[email protected].67":
version "0.1.67"
resolved "https://registry.npmjs.org/@0xsquid/squid-types/-/squid-types-0.1.67.tgz#ad55b298d36ec108de920cfd3866d01ce29cccb6"
integrity sha512-iZ4+WfHsKVGDg448NrtByRAOnPOdfNnh/BbA8HzuySp4BinqDRVg8fPr6m8WShTzR3YOIsMhqW1OsS5QMHdNZg==
"@0xsquid/[email protected].75":
version "0.1.75"
resolved "https://registry.npmjs.org/@0xsquid/squid-types/-/squid-types-0.1.75.tgz#d5b1b947b65b8960cd039abef2f627155f28a873"
integrity sha512-GmB4k4aKL6H/4XY14K2celuatEHjfFdhxCt/hRNO6V8TiTspf5LYO1LsypERX7woyuCLjA8L/pQBjfBN/FXgGg==
dependencies:
"@axelar-network/axelarjs-sdk" "^0.13.6"
"@ethersproject/providers" "^5.7.2"
Expand Down

0 comments on commit 6e4460d

Please sign in to comment.