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

ens-proxy-sdk

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ens-proxy-sdk - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

package.json
{
"name": "ens-proxy-sdk",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "SDK for interacting with smart contracts via an ENS proxy",

@@ -34,19 +34,3 @@ # ENS Proxy SDK

This same address is used across Mainnet, Ropsten, Rinkeby and Goerli.
- An example of creating your own OwnableEnsProxy:
```ts
const signer = ethers.provider.getSigner();
const ownableEnsProxyFactory = new Contract(
OWNABLE_ENS_PROXY_FACTORY_ADDRESS,
ownableEnsProxyJson.abi,
signer,
) as OwnableEnsProxyFactory;
await ownableEnsProxyFactory.deployed();
const tx = await ownableEnsProxyFactory.connect(signer).createEnsProxy();
const receipt = await tx.wait();
const { ensProxyAddress } = (receipt.events?.[0] as OwnableEnsProxyCreatedEvent)
.args;
const ownableSafeEns = new SafeEns(ensProxyAddress, signer);
```
## Installation

@@ -72,19 +56,53 @@

Example of using PublicEnsProxy:
```ts
import { SafeEns, PUBLIC_ENS_PROXY_ADDRESS } from "ens-proxy-sdk";
import { ethers } from "ethers";
const signer = ethers.provider.getSigner();
const safeEns = new SafeEns(PUBLIC_ENS_PROXY_ADDRESS, signer);
// Send eth (NOTE: units are in wei):
safeEns.sendEth("omarsayha.eth", "100000000000000000");
// NOTE: Since there are thousands of smart contracts you can interact with,
// the following example expects you to replace everything starting with YOUR
const contract = safeEns.newContract<YourContractType>(
yourContractAddress,
yourContractAbi,
// Use public ens to send eth to omarsayha.eth
const publicSafeEns = new SafeEns(PUBLIC_ENS_PROXY_ADDRESS, signer);
const publicSendEthTx = await publicSafeEns.sendEth(
"omarsayha.eth",
"100000000000000000", // NOTE: units are in wei
);
// Interact with a contract using the proxy:
const tx1 = await contract.yourMintMethod("omarsayha.eth");
await publicSendEthTx.wait();
```
// Interact with a contract without using the proxy:
const tx2 = await contract.baseContract.yourTransferMethod("omarsayha.eth");
Example of using your own OwnableEnsProxy:
```ts
import {
SafeEns,
OwnableEnsProxyFactory,
OwnableEnsProxyCreatedEvent,
OwnableEnsProxyFactoryJson,
OWNABLE_ENS_PROXY_FACTORY_ADDRESS,
} from "ens-proxy-sdk";
import { ethers } from "ethers";
const signer = ethers.provider.getSigner();
// Create your own ownable ens proxy
const ownableEnsProxyFactory = new Contract(
OWNABLE_ENS_PROXY_FACTORY_ADDRESS,
OwnableEnsProxyFactoryJson.abi,
signer,
) as OwnableEnsProxyFactory;
await ownableEnsProxyFactory.deployed();
const createEnsProxyTx = await ownableEnsProxyFactory
.connect(signer)
.createEnsProxy();
const createEnsProxyTxReceipt = await createEnsProxyTx.wait();
const { ensProxyAddress } = (
createEnsProxyTxReceipt.events?.[0] as OwnableEnsProxyCreatedEvent
).args;
// Use the created ownable ens proxy to send eth
const ownableSafeEns = new SafeEns(ensProxyAddress, signer);
const ownableSendEthTx = await ownableSafeEns.sendEth(
"omarsayha.eth",
"100000000000000000", // NOTE: units are in wei
);
await ownableSendEthTx.wait();
```
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