Solana Wallet Adapter
@wepin/solana-wallet-adapter is designed to interact with the Solana blockchain, providing an easy-to-use Wallet Adapter based on @solana/wallet-adapter-base.
Install
Once the installation is complete, initialize the WepinSolanaWalletAdapter
instance using the app ID and app key assigned after registering the app. This will enable the use of WepinSolanaWalletAdapter
.
If you're using @solana/wallet-adapter-react
, initialize the adapter as shown below:
Parameters
WepinWalletAdapterConfig <Object>
WepinWalletAdapterConfig <Object>
appId <string> The App ID assigned after application registration.
appKey
<string> The App Key assigned after application registration.network
<string> (optional) The network variable for the supported wallet adapter. For Solana Mainnet, use"solana"
. Must be entered in lowercase. Default is"solana"
.attributes
<object> (optional)defaultLanguage
: Sets the widget's default language. Supported languages areen
,ko
, andja
. Default isen
.defaultCurrency
: Sets the widget's default currency. Supported currencies areUSD
,KRW
, andJPY
. Default isUSD
.
Methods
The following methods are available in the WepinSolanaWalletAdapter
.
connect
Connects to the Wepin Wallet and retrieves the user's Public Key.
parameters
<void>
Return Value
Promise<void>
On successful connection, the adapter's
connected
property will be set totrue
, and thepublicKey
property will hold the user's Public Key.
Example
signMessage
Signs a given message using the user's private key.
parameters
message
<Uint8Array>
The message to sign.
Return Value
Promise<Uint8Array>
The signed message as aUint8Array
.
Example
signTransaction
Signs a Solana transaction object.
parameters
<Transaction | VersionedTransaction>
The Solana transaction object to sign.
Return Value
Promise<Transaction | VersionedTransaction>
The signed transaction object.
Example
disconnect
Disconnects from the Wepin Wallet.
parameters
<void>
Return Value
Promise<void>
Example
Last updated