Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cloud-cryptographic-wallet/web3-provider-adapter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloud-cryptographic-wallet/web3-provider-adapter

[![npm version](https://badge.fury.io/js/@cloud-cryptographic-wallet%2Fweb3-provider-adapter.svg)](https://badge.fury.io/js/@cloud-cryptographic-wallet%2Fweb3-provider-adapter)

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-68.75%
Maintainers
1
Weekly downloads
 
Created
Source

@cloud-cryptographic-wallet/web3-provider-adapter

npm version

This package allows you to use provider of web3.js with a variety of cloud service key management systems.

Support Cloud Services

Install

$ npm install @cloud-cryptographic-wallet/web3-provider-adapter web3

With Cloud Service

AWS KMS

$ npm install @cloud-cryptographic-wallet/aws-kms-signer
import Web3 from "web3";
import { AwsKmsSigner } from "@cloud-cryptographic-wallet/aws-kms-signer";
import { createProvider } from "@cloud-cryptographic-wallet/web3-provider-adapter";

async function sendTxUsingAwsKmsSigner(rpcUrl: string) {
  const region = "us-east-1";
  const keyId = "e9005048-475f-4767-9f2d-0d1fb0c89caf";
  const awsKmsSigner = new AwsKmsSigner(keyId, { region });

  const provider = createProvider({ signers: [awsKmsSigner], rpcUrl });
  const web3 = new Web3(provider as any);

  const address = (await web3.eth.getAccounts())[0];
  console.log(address);
  if (!address) {
    return;
  }

  const tx = await web3.eth.sendTransaction({
    from: address,
    to: address,
  });

  console.log({ tx });
}

Cloud Key Management

$ npm install @cloud-cryptographic-wallet/cloud-kms-signer
import Web3 from "web3";
import { CloudKmsSigner } from "@cloud-cryptographic-wallet/cloud-kms-signer";
import { createProvider } from "@cloud-cryptographic-wallet/web3-provider-adapter";

async function sendTxUsingCloudKmsSigner(rpcUrl: string) {
  const name =
    "projects/aws-kms-provider/locations/asia-northeast1/keyRings/for-e2e-test/cryptoKeys/for-e2e-test/cryptoKeyVersions/1";
  const cloudKmsSigner = new CloudKmsSigner(name);

  const provider = createProvider({ signers: [cloudKmsSigner], rpcUrl });
  const web3 = new Web3(provider as any);

  const address = (await web3.eth.getAccounts())[0];
  console.log(address);
  if (!address) {
    return;
  }

  const tx = await web3.eth.sendTransaction({
    from: address,
    to: address,
  });

  console.log({ tx });
}

FAQs

Package last updated on 13 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc