0.0.8 • Published 9 months ago

@apophis-sdk/walletconnect-signer v0.0.8

Weekly downloads
-
License
-
Repository
github
Last release
9 months ago

@apophis-sdk/walletconnect-signer

WalletConnect integration for the Apophis Cosmos SDK.

This integration is built on @reown/appkit and provides a custom adapter

Installation

Install with your favorite package manager's equivalent of:

npm install @apophis-sdk/core @apophis-sdk/walletconnect-signer

You will likely also want to install a frontend integration such as @apophis-sdk/preact.

Usage

Using a proper frontend integration, usage is simple:

import { Any, signals, signers, type Asset, type NetworkConfig } from '@apophis-sdk/core';
import { WalletModal } from '@apophis-sdk/preact';
import { WalletConnectSigner } from '@apophis-sdk/walletconnect-signer';
import { render } from 'preact';

signers.push(WalletConnectSigner);

const assets: Record<string, Asset> = /* your assets here */;
const network: Record<string, NetworkConfig> = /* your network config here */;
const networks = Object.values(network);

signals.network.value ??= /* your network config here */;

// render a `WalletSelector` or `WalletModal`
render((
  <div>
    <UserAddress />
    {!signals.account.value && <WalletModal />}
    <button onClick={handleClick}>Click me!</button>
  </div>
), document.getElementById('app')!);

function handleClick() {
  if (!signals.signer.value || !signals.network.value) return;
  const network = signals.network.value;
  const signer = signals.signer.value; // agnostic of signer implementation
  const tx = signer.tx([
    Any.encode(network, /* your message here */),
  ]);

  await tx.estimateGas(network, signer, true);
  await tx.sign(network, signer);
  await tx.broadcast(); // signer & network are stored internally when signed successfully
}
0.0.8

9 months ago

0.0.7-fix.2

9 months ago

0.0.7-fix.1

9 months ago

0.0.7

9 months ago

0.0.7-alpha.2

10 months ago

0.0.7-alpha.1

10 months ago

0.0.6

10 months ago