Installation
npm install @getpara/stellar-sdk-v14-integration @stellar/stellar-sdk --save-exact
yarn add @getpara/stellar-sdk-v14-integration @stellar/stellar-sdk --exact
pnpm add @getpara/stellar-sdk-v14-integration @stellar/stellar-sdk --save-exact
bun add @getpara/stellar-sdk-v14-integration @stellar/stellar-sdk --exact
Library Setup
- Hook (React)
- Direct Usage
import { useParaStellarSigner } from "@getpara/react-native-wallet/stellar";
import { Horizon, Networks } from "@stellar/stellar-sdk";
import { Text } from "react-native";
const server = new Horizon.Server("https://horizon.stellar.org");
function StellarExample() {
const { stellarSigner, isLoading } = useParaStellarSigner({
networkPassphrase: Networks.PUBLIC,
});
if (isLoading) return <Text>Loading...</Text>;
console.log("Stellar address:", stellarSigner?.address);
return <Text>Address: {stellarSigner?.address}</Text>;
}
import { createParaStellarSigner } from "@getpara/stellar-sdk-v14-integration";
import { Horizon, Networks } from "@stellar/stellar-sdk";
import { para } from "./para";
const server = new Horizon.Server("https://horizon.stellar.org");
const signer = createParaStellarSigner({
para,
networkPassphrase: Networks.PUBLIC,
});
console.log("Stellar address:", signer.address);
To use the Stellar testnet, replace
Networks.PUBLIC with Networks.TESTNET and use the testnet Horizon URL: https://horizon-testnet.stellar.org. You can fund testnet accounts using Stellar’s Friendbot.