The Glider API is wallet agnostic. This means that as long as you can get an EIP-191 signature from the EOA that will own the portfolio, you can use the Glider API.

If you’ve followed along with the Quickstart guide you will notice there’s two cases where your wallet architecture will need to interface with Glider. The first is when you’re creating a portfolio, and the second is when you’re funding a portfolio.

Creating a Portfolio with Para

1

Get the Message to Sign

Fetch the data to be signed by calling the https://api.glider.fi/v1/portfolio/create/signature endpoint.

// First, get the message to sign
const signDataResponse = await fetch(
  `https://api.glider.fi/strategies/sign-data/${strategy.strategyId}`,
  {
    method: "GET",
    headers: {
      "X-API-KEY": "your_api_key_here",
    },
  }
);

const signData = await signDataResponse.json();
const messageToSign = signData.message;
2

Sign the Message

Sign the payload using the owner’s wallet. The Para SDK, using the Viem integration, can be used to sign the message like so:

para.js
import { createParaViemClient, createParaAccount } from "@getpara/viem-v2-integration";
import { http, parseEther } from "viem";
import { mainnet } from "viem/chains";
import Para, { Environment } from "@getpara/web-sdk";

const para = new Para(Environment.BETA, API_KEY);
const account = await createParaAccount(para);
const walletClient = createParaViemClient(para, {
  account: account,
  chain: mainnet,
  transport: http("YOUR_RPC_URL"),
});

const signature = await walletClient.signMessage({
    message: messageToSign,
    account
});

Funding a Portfolio with Para

Funding a portfolio is done by sending funds to a portfolio’s vault address.

1

Get the Portfolio's Vault Address

Fetch the portfolio’s vault address by calling the https://api.glider.fi/v1/portfolio/{portfolioId} endpoint.

2

Send Funds to the Portfolio's Vault

The Para SDK and the Para-Viem client can be used to send funds to the vault.

import Para, { Environment } from "@getpara/react-sdk";
import { createParaViemClient, createParaAccount } from "@getpara/viem-v2-integration";
import { mainnet } from "viem/chains";
import { parseEther } from "viem";

const para = new Para(Environment.BETA, API_KEY);
const account = await createParaAccount(para);
const paraClient = createParaViemClient(para, {
    account,
    chain: mainnet,
    transport: http("YOUR_RPC_URL")
});

const transaction = {
    account: paraClient.account,
    to: "0xRecipientAddress",
    value: parseEther("0.02"),
};

const signedTx = await paraClient.signTransaction(transaction);
const hash = await paraClient.broadcastTransaction({
    serializedTransaction: signedTx
});