Solana-Compatible SDK Guide: Connecting Apps & Mini Wallets to Web3 DEX APIs

ยท

Solana is a high-performance blockchain platform designed to deliver fast, secure, and scalable solutions for decentralized applications (DApps) and cryptocurrencies. Utilizing its innovative Proof of History (PoH) consensus algorithm, Solana achieves throughput of tens of thousands of transactions per second (TPS) while maintaining decentralization and security. The platform aims to drive mass blockchain adoption through its technical advantages, supporting complex DApps and global financial systems.

Sonic represents the first atomic SVM chain built specifically for sovereign game economies on Solana.

Installation & Initialization

Ensure your OKX App is updated to version 6.90.1 or later before integration:

npm install @okx-web3/connect

To begin wallet operations, first create an initialization object:

Parameters

Returns

Example

const provider = new OKXUniversalProvider({
  dappMetaData: {
    name: "MyDApp",
    icon: "https://example.com/icon.png"
  }
});

Wallet Connection

Establish connection to retrieve wallet addresses for identification and transaction signing:

Parameters

Returns

Checking Connection Status

Verify current wallet connection:

Returns

Transaction Preparation

Create transaction handler:

const solanaProvider = new OKXSolanaProvider(universalProvider);

Message Signing

Parameters

Returns

Transaction Signing

Parameters

Returns

Batch Transaction Signing

Parameters

Returns

Transaction Signing & Broadcasting

Parameters

Returns

Retrieving Wallet Address

Parameters

Returns

Disconnecting Wallets

Terminates current session. Required before switching wallet connections.

Event Handling

Listen for connection state changes and transaction events.

Error Codes

CodeDescription
UNKNOWN_ERRORUnexpected error
ALREADY_CONNECTED_ERRORExisting active connection
USER_REJECTS_ERRORUser denied request
CHAIN_NOT_SUPPORTEDUnsupported network
CONNECTION_ERRORConnection failure

FAQs

Q: What's the minimum OKX App version required?

A: Version 6.90.1 or higher is required for DApp integration.

Q: Can I connect multiple Solana-compatible chains simultaneously?

A: Yes, specify all required chains in the namespaces parameter during connection.

Q: How do I handle user rejections?

A: Catch USER_REJECTS_ERROR and provide appropriate user feedback.

Q: What transaction formats are supported?