Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help for requestSignTransactions #1050

Open
ghost opened this issue Dec 23, 2022 · 2 comments
Open

Help for requestSignTransactions #1050

ghost opened this issue Dec 23, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Dec 23, 2022

How do I call the requestSignTransactions?

I am trying to call the nft_mint action on a contract. Here is the code I am trying but it is not working.

  const response = await walletConnection.requestSignTransactions({
    callbackUrl: `http://localhost:3000/callback`,
    transactions: [
      new nearAPI.transactions.Transaction({
        receiverId: my_contract_address,
        actions: [
          {
            functionCall: {
              args: new TextEncoder().encode(
                JSON.stringify({ collection_id: 123 }),
              ),
              deposit: new BN(parseNearAmount('15') || 0),
              gas: new BN(100000000000000),
              methodName: 'nft_mint',
            },
          },
        ],
      }),
    ],
  });

Any help would be appreciated

@ghost ghost added the bug Something isn't working label Dec 23, 2022
@ghost
Copy link
Author

ghost commented Dec 26, 2022

Getting following error now:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'borshSerialize')
    at serializeStruct (index.js:317:1)
    at serializeField (index.js:306:1)
    at index.js:327:1
    at Array.map (<anonymous>)
    at serializeStruct (index.js:326:1)
    at serialize (index.js:349:1)
    at wallet-account.js:168:1
    at Array.map (<anonymous>)
    at WalletConnection.<anonymous> (wallet-account.js:168:1)
    at Generator.next (<anonymous>)
    at wallet-account.js:8:1
    at new Promise (<anonymous>)
    at push../node_modules/near-api-js/lib/wallet-account.js.__awaiter (wallet-account.js:4:1)
    at WalletConnection.requestSignTransactions (wallet-account.js:165:1
)

Screenshot 2022-12-26 at 1 18 59 PM

@ghost
Copy link
Author

ghost commented Jan 6, 2023

Turns out the issue from our end itself.

Once user is redirected to out platform after clicking on "connect", we need to immediately connect the wallet. I think the near-api-js needs the query params returned by the wallet to make a connection.

This needs to be documented somewhere.

@github-project-automation github-project-automation bot moved this to Backlog 🥶 in DevRel Jun 10, 2024
@thisisjoshford thisisjoshford removed this from DevRel Oct 31, 2024
@github-project-automation github-project-automation bot moved this to NEW❗ in DevTools Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: NEW❗
Development

No branches or pull requests

0 participants