warp-contracts-plugin-signature

1.0.20 • Public • Published

Warp Signature

⚠️ warp-contracts-plugin-signature works with warp-contracts version at least 1.4.13. To sign transactions when using warp-contracts <= 1.4.12, please use warp-contracts-plugin-signature version <= 1.0.12.

This package allows to sign data items with some specific Signer's implementations. Currently, it is possible to sign data items using following signers:

  • InjectedArweaveSigner - ArweaveSigner for browser
  • EthereumSigner
  • InjectedEthereumSigner - EthereumSigner for browser

All the implementations are based on arbundles package.

Example usage:

Injected Arweave Signer

import { InjectedArweaveSigner } from 'warp-contracts-plugin-signature';
import { ArweaveWebWallet } from 'arweave-wallet-connector';
import { WarpFactory } from 'warp-contracts';

const wallet = new ArweaveWebWallet({
  name: 'Your application name',
  logo: 'URL of your logo to be displayed to users'
});

wallet.setUrl('arweave.app');
await wallet.connect();
const userSigner = new InjectedArweaveSigner(wallet);
await userSigner.setPublicKey();

const warp = WarpFactory.forMainnet();
const contract = warp.contract(contract_id).connect(userSigner);

InjectedEthereumSigner

import { EthereumSigner } from 'warp-contracts-plugin-signature';
import { WarpFactory } from 'warp-contracts';

const warp = WarpFactory.forMainnet();
const contract = warp.contract(contract_id).connect(new EthereumSigner(private_key));

InjectedEthereumSigner

import { InjectedEthereumSigner } from 'warp-contracts-plugin-signature';
import { WarpFactory } from 'warp-contracts';
import { providers } from 'ethers';

await window.ethereum.enable();

const wallet = new providers.Web3Provider(window.ethereum);

const userSigner = new InjectedEthereumSigner(wallet);
await userSigner.setPublicKey();

const warp = WarpFactory.forMainnet();
const contract = warp.contract(contract_id).connect(userSigner);

Readme

Keywords

none

Package Sidebar

Install

npm i warp-contracts-plugin-signature

Weekly Downloads

49

Version

1.0.20

License

MIT

Unpacked Size

1.08 MB

Total Files

38

Last publish

Collaborators

  • redstone-finance