1.0.17 • Published 1 year ago

@snowflake-so/wallet-adapter-snowflake v1.0.17

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
1 year ago

Wallet Adapter | Snowflake Safe

  • Package: snowflake-so/wallet-adapter-snowflake

A Snowflake Safe wallet adapter is built for integrating using @solana/wallet-adapter-react

Installation

npm

npm install @snowflake-so/wallet-adapter-snowflake

yarn add @snowflake-so/wallet-adapter-snowflake

Quick start guide

Connect to Snowflake wallet adapter

Note: The implemented application only works inner Snowflake Safe app.

It is very simple, you just have to add Snowflake Wallet Adapter to the wallets list attributes of the WalletProvider and it will work normally.

import React, { FC, useMemo } from 'react';
import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react';
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import { SnowflakeSafeWalletAdapter } from '@snowflake-so/wallet-adapter-snowflake';
import {
  WalletModalProvider,
  WalletDisconnectButton,
  WalletMultiButton,
} from '@solana/wallet-adapter-react-ui';
import { clusterApiUrl } from '@solana/web3.js';

// Default styles that can be overridden by your app
require('@solana/wallet-adapter-react-ui/styles.css');

export const Wallet: FC = () => {
  // The network can be set to 'devnet', 'testnet', or 'mainnet-beta'.
  const network = WalletAdapterNetwork.Devnet;

  // You can also provide a custom RPC endpoint.
  const endpoint = useMemo(() => clusterApiUrl(network), [network]);

  const wallets = useMemo(() => [new SnowflakeSafeWalletAdapter()], []);

  return (
    <ConnectionProvider endpoint={endpoint}>
      <WalletProvider wallets={wallets} autoConnect>
        <WalletModalProvider>
          <WalletMultiButton />
          <WalletDisconnectButton />
          {/* Your app's components go here, nested within the context providers. */}
        </WalletModalProvider>
      </WalletProvider>
    </ConnectionProvider>
  );
};

Send a transaction

This action will create a multisig proposal on Snowflake Safe.

const txId = await wallet.sendTransaction(
  transaction,
  connection,
  {
    name: 'Unknown proposal', // Multisig proposal name
  } as any
);

Support

Struggle with the SDK integration?

If you have any problem with using the SDK in your system, drop a question our Snowflake Discord #sdk to receive a support from our engineers.

Find a bug or want to contribute to Snowflake?

If you find a bug or have any problem and idea while using the SDK, you can create an issue on SDK Github.

License

Apache License 2.0

1.0.17

1 year ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.14-beta

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago