Git Product home page Git Product logo

fireblocks-web3-provider's People

Contributors

a0ngo avatar aquanow-alex avatar arikblocks avatar aviba avatar barakfireblocks avatar dependabot[bot] avatar ediskandarov avatar orenyomtov avatar physo avatar slavasereb avatar yoavbz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fireblocks-web3-provider's Issues

I should get 3.0 but i am getting 1.0

const eip1193Provider = new FireblocksWeb3Provider({
      privateKey: apiSecret,
      apiKey: apiKey,
      vaultAccountIds: this.arg.vaultId,
      chainId: ChainId.BSC,
    });
var gasPriceRaw = await this.provider.getGasPrice();
    var gasPrice = ethers.utils.formatUnits(gasPriceRaw, "gwei");
    gasPrice = gasPrice;

Screenshot 2024-03-25 at 6 34 56 AM

Issue with Web3JS v^1.9.0

Hey team,

I was recently trying to use the provider with Web3js v1.9.0 but it keeps giving an error- Provider does not have a request or send method to use.
While it works perfectly with Web3js v4, wanted to understand if it is possible to use the provider with v1.9.0 as well.

Error
Screenshot 2023-11-08 at 3 01 18 PM

Dependencies
node version: v16.20.0
npm version: 8.19.4
web3: ^1.9.0
@fireblocks/fireblocks-web3-provider: ^1.2.3

`gasless` branch build fails

Hey team fireblocks,

Description

Our team recently integrated the gasless branch within our project and ran into some issues when resolving the @fireblocks-web3-provider dependency in our project. Running npm i for our project, causes build errors when trying to resolve your package. I understand there is a demo that comes with instructions, however following the instructions in an isolated environment still produces the below error.

Screenshots

MicrosoftTeams-image (7)

Files

package.json

To Reproduce

node version v16.20.0
npm version 8.19.4
typescript version 4.0.0
"@fireblocks/fireblocks-web3-provider": "github:fireblocks/fireblocks-web3-provider#gasless", as a dependency in projects package.json

Tasks

The workaround for this was to npm uninstall @types/mocha in the node_modules of the web3-provider, via the package.json of the root project, while also following the demo instructions like so - having a postinstall command run:

"postinstall": "(cd node_modules/@fireblocks/fireblocks-web3-provider && npm install && npm uninstall @types/mocha && npm run build && cp -rf src/abi dist/)",

Any way to resolve this without having to uninstall dependencies of this package?

Refactor: Remove @json-rpc-tools/utils dependency

It depends on tslib for runtime, which throws an error for projects that import @fireblocks/fireblocks-web3-provider and don't use tslib.

Removing the dependency will require replacing the imported type and two functions:

import {
  RequestArguments,
  formatJsonRpcRequest,
  formatJsonRpcResult,
} from "@json-rpc-tools/utils";

Catch errors does not work when using FireblocksWeb3Provider

Hi there, I'm trying to use FireblocksWeb3Provider and create error handling logic around transaction sending.

Apparently, if FireblocksWeb3Provider is used - then try catch section does not work as expected.

Code snipped below is a slightly modified version of example in ethereum development official documentation.

import {
  FireblocksWeb3Provider,
  ChainId,
} from "@fireblocks/fireblocks-web3-provider";
import * as ethers from "ethers";

// A Human-Readable ABI; for interacting with the contract, we
// must include any fragment we wish to use
const abi = [
  "function transferFrom(address from, address to, uint256 tokenId)",
];

// NFT Contract Address
const CONTRACT_ADDRESS = process.env.NFT_CONTRACT_ADDRESS;

const eip1193Provider = new FireblocksWeb3Provider({
  // apiBaseUrl: ApiBaseUrl.Sandbox, // If using a sandbox workspace
  privateKey: process.env.FIREBLOCKS_API_PRIVATE_KEY,
  apiKey: process.env.FIREBLOCKS_API_KEY,
  vaultAccountIds: process.env.FIREBLOCKS_VAULT_ACCOUNT_IDS,
  chainId: ChainId.MAINNET,
});

async function main() {
  const provider = new ethers.providers.Web3Provider(eip1193Provider);
  const signerAddress = process.env.FIREBLOCKS_VAULT_ADDRESS;
  const signer = provider.getSigner(signerAddress);

  const myContract = new ethers.Contract(CONTRACT_ADDRESS, abi, signer);
  const from = signerAddress;
  const to = "0x0000000000000000000000000000000000000000"; // random address

  // Invoke `transferFrom` method
  const tokenId = 2;
  let txnHash = "";
  try {
    txnHash = await myContract.transferFrom(from, to, tokenId);
  } catch (error) {
    console.log("error catch");
  }

  console.log("normal code execution");
}

main().catch((error) => {
  console.log(error);
});

I expect that error catch and the following normal code execution messages are printed in console. Instead I get the following:

$ dotenv -- node --no-warnings src/main.js

/home/eduard/fireblocks-nft-transfer/node_modules/@fireblocks/fireblocks-web3-provider/dist/src/provider.js:166
                throw this.createError({ message: `No ${this.assetId} asset wallet found for vault account with id ${vaultAccountId}` });
                           ^

Error: No ETH asset wallet found for vault account with id 123456
    at FireblocksWeb3Provider.populateAccounts (/home/eduard/fireblocks-nft-transfer/node_modules/@fireblocks/fireblocks-web3-provider/dist/src/provider.js:166:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: -32603,
  data: undefined,
  payload: undefined
}

Node.js v18.12.0

There's a misconfiguration, but the try catch section should still work!

I suspect this there's a floating promise somewhere in library code. Probably in FireblocksWeb3Provider constructor.

Software version

  • @fireblocks/fireblocks-web3-provider 1.2.2
  • ethers: 5.7.2
  • Node.js 18.12.0
  • Ubuntu 20.04 in WSL Linux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.