Skip to content

Commit

Permalink
fix: parse undefined memo sent from api (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
odcey authored Nov 1, 2023
1 parent 82b0212 commit 6d42fdd
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ import axios, { AxiosInstance } from "axios";
import { BigNumber, UnsignedTransaction, ethers } from "ethers";

import {
ChainType,
Allowance,
Approve,
ApproveRoute,
ChainData,
ChainType,
Config,
CosmosAddress,
CosmosBalance,
CosmosChain,
CosmosMsg,
ExecuteRoute,
GetRoute,
Expand All @@ -38,10 +41,7 @@ import {
TransactionRequest,
ValidateBalanceAndApproval,
WASM_TYPE,
WasmHookMsg,
CosmosChain,
CosmosAddress,
CosmosBalance
WasmHookMsg
} from "./types";

import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
Expand All @@ -53,10 +53,10 @@ import { parseStatusResponse } from "./0xsquid/v1/status";
import erc20Abi from "./abi/erc20.json";
import { nativeTokenConstant, uint256MaxValue } from "./constants";
import { ErrorType, SquidError } from "./error";
import { getCosmosBalances } from "./services/getCosmosBalances";
import { getAllEvmTokensBalance } from "./services/getEvmBalances";
import { getChainData, getTokenData } from "./utils";
import { setAxiosInterceptors } from "./utils/setAxiosInterceptors";
import { getAllEvmTokensBalance } from "./services/getEvmBalances";
import { getCosmosBalances } from "./services/getCosmosBalances";

const baseUrl = "https://testnet.api.0xsquid.com/";

Expand Down Expand Up @@ -514,10 +514,14 @@ export class Squid {
// TODO: At the moment there's a limit on Ledger Nano S models
// This limit prevents WASM_TYPE messages to be signed (because payload message is too big)
const aminoTypes = this.getAminoTypeConverters();
const firstMsg = msgs[0];
const formattedMsg = {
...msgs[0],
...firstMsg,
value: {
...msgs[0].value,
...firstMsg.value,
// Memo cannot be undefined, otherwise amino converter throws error
memo: (firstMsg.value as any).memo || "",
// Timeout wasn't formatted in the right way, so getting it manually
timeoutTimestamp: this.getTimeoutTimestamp()
}
};
Expand Down

0 comments on commit 6d42fdd

Please sign in to comment.