Skip to content

TypeError: Cannot read property 'decimal' of undefined when signing contract #1

@Wabinab

Description

@Wabinab

Hi.

I tried to make a transaction using here wallet, but this problem in the title keeps popping up.
here-wallet-sign-transaction-failure

I wonder if it has anything to do with the sdk. I don't directly use this sdk, but via near-wallet-selector. After logging in, I perform the call as below:

import { providers } from 'near-api-js';

async call(method: string, args = {}, deposit = "0") {
    if (this.get_account_id() == null) {
      console.error("please sign in.");
      return;
    }
    const gas = '30000000000000';
    const outcome = await this.wallet.signAndSendTransaction({
      signerId: this.account_id,
      receiverId: this.contract_id,
      actions: [{
        type: 'FunctionCall',
        params: {
          methodName: method,
          args,
          gas,
          deposit
        },
      }]
    });

    return providers.getTransactionLastResult(outcome);
  }

and an example function that cause the error looks like this (it's located in a service file in Angular):

this.walletService.call('activate_receipt', {}, utils.format.parseNearAmount("0.1") ?? "0")

(Note: the above function isn't the only one causing the error. Calling other functions also cause the decimal error).

I wonder what was causing the error. In essence, running the same code in MyNearWallet is successful; yet, it doesn't pass with Here Wallet.

The code is run on testnet. Wallet is connected to testnet as well.

Though one notice one thing: despite wallerhere.testnet (the connected account) having positive non-zero balance, it displays the account balance as $0. Does that affect it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions