@snowflake-so/wallet-adapter-snowflake
v1.0.17
Published
- Package: `snowflake-so/wallet-adapter-snowflake`
Downloads
197
Readme
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 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