ioPay Docs
  • Welcome to ioPay Docs
  • 💜IoTeX & Ethereum & Polygon & BNB
  • 💙Solana
  • 🧡BitCoin
  • Developer Guides
    • Web Dapps Development
    • Deep linking
    • Native Mobile Web3 Apps
      • iOS
      • Android
    • Abstract Account Wallet
      • userop-swift (iOS)
      • userop-kotlin (Android)
    • ioPay x dApps Co-promotions Program
  • User Guides
    • Crypto Handle & Custom Domain Setup
  • How to withdraw IOTX from centralized exchanges (Binance)?
  • Walletconnect - iOS
  • Rainbow Kit
Powered by GitBook
On this page
  • Wallet Connect Supported
  • Detecting the Provider
  • Sending a Legacy Transaction
  • Method
  • Method
  • Sending a Versioned Transaction
  • Method
  • Signing a Message
  • Method

Solana

PreviousIoTeX & Ethereum & Polygon & BNBNextBitCoin

Last updated 8 months ago

Wallet Connect Supported

Reffer to

Detecting the Provider

ioPay's mobile in-app browser will both inject a ioPay object into the window of any web application the user visits. ioPay will not inject the provider into iframes or sites using http://.

If a ioPay object exists, Bitcoin & Ordinals dApps can interact with ioPay via the API found at window.ioPay.solana. To detect if ioPay is installed, an application should check for an additional isIoPay flag like so:

const isIoPayInstalled = window?.ioPay?.bitcoin?.isIoPay

Sending a Legacy Transaction

Method

signAndSendTransaction

Returns:

  • Promise - {'signature': obj, ...} : A for an object containing the signature

Example:

const provider = getProvider(); // see "Detecting the Provider"
const transaction = new Transaction();
const { signature } = await provider.signAndSendTransaction(transaction);

// check transaction status
const network = "<NETWORK_URL>";
const connection = new Connection(network);
await connection.getSignatureStatus(signature);

Method

signTransaction - Signing a transaction without sending

Returns:

Example:

const provider = getProvider();
const transaction = new Transaction();
const signedTransaction = await provider.signTransaction(transaction);

// After the transaction has been signed, an application may submit the transaction itself via web3js
const network = "<NETWORK_URL>";
const connection = new Connection(network);
const signature = await connection.sendRawTransaction(signedTransaction.serialize());

Sending a Versioned Transaction

Method

signAndSendTransaction

Returns:

Example:

// The following example show how to build a simple transfer instruction.
const instructions = [
  SystemProgram.transfer({
    fromPubkey: publicKey,
    toPubkey: publicKey,
    lamports: 10,
  }),
];

// create v0 compatible message
const messageV0 = new TransactionMessage({
  payerKey: publicKey,
  recentBlockhash: blockhash,
  instructions,
}).compileToV0Message();
const provider = getProvider();

// make a versioned transaction
const transactionV0 = new VersionedTransaction(messageV0);
const { signature } = await provider.signAndSendTransaction(transactionV0);

// check transaction status
const network = "<NETWORK_URL>";
const connection = new Connection(network);
await connection.getSignatureStatus(signature);

Signing a Message

Method

signMessage - Send a message for the user to sign, request that the encoded message is signed via the user's ioPay wallet

Returns:

  • Promise - String

Example:

const provider = getProvider(); // see "Detecting the Provider"
const message = `Welcome to XXXXX`;
const encodedMessage = new TextEncoder().encode(message);
const signedMessage = await provider.signMessage(encodedMessage, "utf8")

Promise : A for the signed transaction

Promise : A for the signed transaction

💙
Wallect Connect Solana doc
Promise
Promise
Promise