Get started

This section describes the steps for setting up a connection to Apollo wallet.
Download example client full code https://apollo-wallet.com/download-demo.zip

Use a local test network Solana to get started. RPC url: http://127.0.0.1:8899
https://solana.com/ru/docs/intro/installation

$ solana-test-validator
            

Installing
https://www.npmjs.com/package/apollo-wallet

$ npm i apollo-wallet
            

Import

import { ApolloWallet }  from 'apollo-wallet'
            

Connect
Desktop and Mobile App(PWA): 'https://app.apollo-wallet.com/'
Decentral web version: 'https://apollowallet.ar.io'
This must be selected by the user depending on which version they are using

let url = 'https://app.apollo-wallet.com/' or 'https://apollowallet.ar.io'
const apolloWallet = new ApolloWallet(url)
apolloWallet.connect()
            

Get Addresses

getAdresses(): Get addresses that can sign the transaction

                
const adresses = await apolloWallet.getAdresses()
                
            

Sign transaction

signTransaction(tx, signer): Get a signed transaction
Params:
tx (type array number, Required): Transaction data,
signer (type string, Required): Signer account

                
const messageV0 = new TransactionMessage({
    payerKey: fromPubkey,
    recentBlockhash: blockhash,
    instructions: instructions,
}).compileToV0Message();
const tx = new VersionedTransaction(messageV0);
let txBytes = tx.serialize({
    requireAllSignatures: false,
    verifySignatures: false,
}) 
txData = Array.from(txBytes)

const signer = adresses[0]
const txBytes = await apolloWallet.signTransaction(tx, signer)