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

@cloud-cryptographic-wallet/ethers-adapter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloud-cryptographic-wallet/ethers-adapter

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

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@cloud-cryptographic-wallet/ethers-adapter

npm version

This package allows you to use Signer of ethers with a variety of cloud service key management systems.

Support Cloud Services

Install

$ npm install @cloud-cryptographic-wallet/ethers-adapter ethers

With Cloud Service

AWS KMS

$ npm install @cloud-cryptographic-wallet/aws-kms-signer
import { ethers } from "ethers";
import { AwsKmsSigner } from "@cloud-cryptographic-wallet/aws-kms-signer";
import { EthersAdapter } from "@cloud-cryptographic-wallet/ethers-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 = new ethers.providers.JsonRpcProvider(rpcUrl);
  const signer = new EthersAdapter({ signer: awsKmsSigner }).connect(provider);

  const address = await signer.getAddress();
  console.log(address);
  console.log(ethers.utils.formatEther(await signer.getBalance()));

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

  console.log({ tx });

  const receipt = await tx.wait();

  console.log({ receipt });
}

Cloud Key Management

$ npm install @cloud-cryptographic-wallet/cloud-kms-signer
import { ethers } from "ethers";
import { CloudKmsSigner } from "@cloud-cryptographic-wallet/cloud-kms-signer";
import { EthersAdapter } from "@cloud-cryptographic-wallet/ethers-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 = new ethers.providers.JsonRpcProvider(rpcUrl);
  const signer = new EthersAdapter({ signer: cloudKmsSigner }).connect(
    provider
  );

  const address = await signer.getAddress();
  console.log(address);
  console.log(ethers.utils.formatEther(await signer.getBalance()));

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

  console.log({ tx });

  const receipt = await tx.wait();

  console.log({ receipt });
}

FAQs

Package last updated on 13 Mar 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