Solana Provider
Last updated
Last updated
You can interact with Solana blockchains using @solana/web3.js together with the Wepin Provider.
Chain ID | Network Name | Network Variable |
---|---|---|
Once the installation is complete, initialize the WepinProvider instance using the app ID and app key assigned after registering the app. This will enable the use of WepinProvider.
Here's how to initialize the Wepin Provider.
attributes
<object> optional
defaultLanguage
: The language to be displayed on the widget (default: 'ko'
) Currently, only 'ko'
, 'en'
and 'ja'
are supported.
defaultCurrency
: The currency to be displayed on the widget (default: 'KRW'
) Currently, only 'KRW'
, 'USD'
and 'JPY'
are supported.
Promise
<void>
It checks if WepinProvider is initialized properly.
<void>
<boolean>
Returns true
if init was successful, otherwise returns false
.
It allows changing the language and currency of the widget.
attributes
<object>
language
<string>
It specifies the language to be displayed on the widget. Currently supported languages are en
, ko
and ja
currency
<string>
It specifies the currency to be displayed on the widget. Currently supported currencies are USD
, KRW
and JPY
<boolean>
It returns true
if the change was successful, otherwise returns false
.
Methods can be used after initializing the Wepin Provider.
It returns the provider for the specified network.
network
<string>
The Network Variable value for providers supported by Wepin, such as "solana" for Solana Mainnet, must be entered in lowercase. For the complete list, please refer to the Supported Networks for Solana Provider.
Promise
<BaseProvider> - A solana provider
It terminates the use of WepinProvider.
<void>
<void>
You can send JSON-RPC requests to interact with the Solana blockchain.
Connects to the Wepin Wallet and requests permission to share the user's account address (Public Key). Once the connection is approved, the application can make further requests, such as signing messages or transactions.
<void>
Promise
<object>
publicKey
<string> - Solana Account's Address(Public Key)
Signs a serialized transaction. Takes the transaction as a hex string and returns the signed transaction.
<object>
message
<string> - A transaction serialized and converted to a hex string.
Promise
<Transaction> - A Transaction that includes a signature.
Signs and submits the serialized transaction to the Solana network. Returns the signature of the transaction.
<object>
message
<string> - A transaction serialized and converted to a hex string.
Promise
<object>
signature
<TransactionSignature> - The signature of the Transaction.
Signs a message with a specified account's address (Public Key). Takes the account address and the message to be signed as input.
<array>
<string>
- The address (Public Key) of the account that signs the transaction.
<string>
- The message to be signed.
Promise
<Transaction> - A Transaction that includes a signature.
Switches the network. Supports switching between Solana Mainnet and Devnet, and returns the address, network name, and chain ID of the switched network.
<object>
chainId
<string> - The chainId of the network to switch to. Only Solana chains (solana , solana ) are supported.
Promise
<object>
address
<string> - The account address (Public Key) on the switched network.
network
<string> - The name of the switched network.
chainId
<string> - The chain ID of the switched network.
In addition to the methods provided by Wepin, Solana RPC HTTP methods are also available.
Returns all information associated with the account of provided Pubkey
PubKey
<string> - Address of the account to retrieve (encoded in base-58).
<object>
commitment
<string> optional
Default Commitment - finalize
processed - Fetches the latest block processed by the node, which is not yet finalized and may change.
confirmed - Fetches the latest block approved by a majority in the cluster.
finalized - Fetches the latest block finalized by a majority in the cluster.
encoding
<string> optional
Encoding format for account data.
base58, base64, base64+zstd, jsonParsed
dataSlice
<object> optional - Request a slice of the account's data. Used only with base58
, base64
, or base64+zstd
encoding.
length
<usize> - Number of bytes to return.
offset
<usize> - Byte offset to start reading from.
minContextSlot
<number> optional
Minimum slot for executing the request.
context
<object>
apiVersion
<string> - solana-core version
slot
<number> - Slot at which the operation was executed.
value
<object> nullable
lamports
<u64> - Account balance in lamports.
owner
<string> - Address of the program managing this account (encoded in base-58).
data
<[string, encoding] | object> - Data associated with the account.
executable
<boolean> - Boolean indicating if the account contains a program (read-only).
rentEpoch
<u64> - the epoch at which this account will next owe rent, as u64
size
<u64> - Size of the account data.
Returns the lamport balance of the account of provided Pubkey.
Pubkey
<string> - Address of the account to check balance (encoded in base-58).
<object>
commitment
<string> optional
Default Commitment - finalize
processed - Fetches the latest block processed by the node, which is not yet finalized and may change.
confirmed - Fetches the latest block approved by a majority in the cluster.
finalized - Fetches the latest block finalized by a majority in the cluster.
minContextSlot
<number> optional
Minimum slot for executing the request.
context
<object>
apiVersion
<string> - solana-core version
slot
<number> - Slot at which the operation was executed.
value
<number> - Account balance.
Returns the latest blockhash.
<object> optional
commitment
<string> optional
Default Commitment - finalize
processed - Fetches the latest block processed by the node, which is not yet finalized and may change.
confirmed - Fetches the latest block approved by a majority in the cluster.
finalized - Fetches the latest block finalized by a majority in the cluster.
minContextSlot
<number> optional
Minimum slot for executing the request.
context
<object>
apiVersion
<string> - solana-core version
slot
<number> - Slot at which the operation was executed.
value
<object>
blockhash
<string> - a Hash as base-58 encoded string
lastValidBlockHeight
<number> - last block height at which the blockhash will be valid
Returns all SPL Token accounts by token owner.
PubKey
<string> - the account address (Pubkey as base-58 encoded string)
<object> - Filter for SPL Token accounts to query; requires either mint
or programId
.
mint
<string> - Address of a specific token’s Mint (encoded in base-58).
programId
<string> - ID of a specific program (encoded in base-58).
<object>
commitment
<string> optional
Default Commitment - finalize
processed - Fetches the latest block processed by the node, which is not yet finalized and may change.
confirmed - Fetches the latest block approved by a majority in the cluster.
finalized - Fetches the latest block finalized by a majority in the cluster.
minContextSlot
<number> optional
Minimum slot for executing the request.
encoding
<string> optional
Encoding format for account data.
base58, base64, base64+zstd, jsonParsed.
dataSlice
<object> optional - Used only with base58
, base64
, or base64+zstd
encoding.
length
<usize> - Number of bytes to return.
offset
<usize> - Byte offset to start reading from.
context
<object>
apiVersion
<string> - solana-core version.
slot
<number> - Slot at which the operation was executed.
value
<Array<object>> - Array of SPL Token account objects.
pubkey
<string> - Address of the retrieved account.
account
<object> - Account details.
lamports
<u64> - Account balance in lamports.
data
<object> - Token state data associated with the account.
parsed
<object>
info
<object> - Account information.
isNative
<boolean> - Indicates if the account is native; usually false.
mint
<string> - Address of the token’s mint associated with the account.
owner
<string> - Owner of the token account.
state
<string> - Token account status.
tokenAmount
<object> - Token balance information.
amount
<string> - Raw amount of tokens as a string, ignoring decimals.
decimals
<number> - Number of decimals configured for token's mint.
uiAmount
<number> - Token amount as a float, accounting for decimals. DEPRECATED
uiAmountString
<string> - Token amount as a string, accounting for decimals.
type
<string> - Type of info
; usually account
.
program
<string> - Program to which the account belongs.
space
<number> - Account data size in bytes.
executable
<boolean> - Indicates if the account is executable.
owner
<string> - Program address that owns the account.
rentEpoch
<u64> - the epoch at which this account will next owe rent, as u64
size
<u64> - Data size of the account.
Returns the token balance of an SPL Token account.
PubKey
<string> - ATA(Associated Token Account) address (encoded in base-58).
context
<object>
apiVersion
<string> - solana-core version
slot
<number> - Slot at which the operation was executed.
value
<object>
amount
<string> - Raw amount of tokens as a string, ignoring decimals.
decimals
<number> - Number of decimals configured for token's mint.
uiAmount
<number> nullable - Token amount as a float, accounting for decimals. DEPRECATED
uiAmountString
<string> - Token amount as a string, accounting for decimals.
For more details on Solana network providers, please refer to the link below.
solana:mainnet
Solana Mainnet
solana
solana:devnet
Solana Devnet
solana-devnet