Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.starkfi.io/llms.txt

Use this file to discover all available pages before exploring further.

1

Building a deposit operation

Deposit operation 
POST /yield/deposit

Request Body

ParameterTypeRequiredDescription
providerstringThe provider is the protocol where the user wants to invest their funds. (e.g. jupiter_lend)
assetstringThe asset symbol is chosen by the user.
walletstringUser’s wallet public address
amountstringThe amount the user wants to invest (e.g. 100.00)
chain_namestringThe chain is the network where the user wants to invest their funds.
2

Request example

curl --request POST \
  --url https://api.starkfi.io/order/create \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api_key>' \
  --data '{
  	"provider": "jupiter_lend",
    "asset": "USDC",
    "wallet": "FmTGYpzX27fDqaiytXUdFVaphC5o68G61Q3uhVM2d8bm",
    "amount": "0.01",
    "chain_name": "solana"
}'
3

Expected response

{
    "statusCode": 200,
    "success": true,
    "status": "deposit_yield_strategy_ok",
    "message": "Yield strategy deposited successfully",
    "data": {
        "position_id": "cmonlfpv0000301nmnizxwob4",
        "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAgS22bfvVtZOhr1Ao5ejkqU88w9QuW2nkrUyxjbPcRilgwcj71J70/rvu0J/yTO1674UGxqeljWsbxMzyBLGGTIhSHv8RXo/oDIxDUXee+zF0aH8JxoGfVZG/MkrkRIFKnYRAnp8rwC8ekxRjtwZYsqePDt4B29OZXjYjrMeikbGqxl9d/9fISvdail973OoWIuKzq/h/xTqHG5CFYaOosb3gIRE+8/cf8FyV6ejOFzFvFRe8v54cSEIbvrhfgwTQQYeXyzPK1sDIBzsh2kxDdkBYXtOfawRnLIelHWBYy3JvqgC5ZIwUW4+UWatmCd5Vc8UzUhP8EscD1FvC2CJQgA1veA4oganO3BaPj9y3TzLqfiwk9dDCxaIuRcmdJ+MiQSCv4el+RWy7kuZColtQumOW/ySBZLynRpY6hFkqzWzMMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEcn8RD5rZyCj3b2Rq49ZiVsmScRvvn3bU9qhBHACBPVR6mnvvwFsKRZEO8A58f97e1/yRiQ5ahJERwinC6lqslJomRsm5Gr9y9W+wdHAcnDKneVfnQTMTEQq+wdbs8IgIyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZxvp6877brTo9ZfNqq8l0MbG75MLS9uDkfKYCA0UvXWEK/huRLkhelf0V6yk33/xLN6MW0KY4Ev8Cukm0xsGNHgbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpgtJyjk/h0MsE3SufVrZlQCwvZ4LziCRh1dcUMqZxVrwBEBEAAgMPCwEGBQgMBwQJDREOChDyI8aJUuHythAnAAAAAAAA"
    }
}
The response returned in each operation corresponds to the result of an unsigned transaction generated by our system, along with a position_id.It is recommended to store the position_id in your database (storage) and associate it with the user. Note that each position_id is unique per provider/protocol where the user invests.This identifier is primarily used for position rebalancing across protocols.
4

Signing a operation transaction

When performing an operation, it is essential to never send it directly using sendTransaction or any external broadcast method.For the operation to succeed, it must only be signed and submitted through StarkFi’s internal broadcast system via our HTTP API.
import { Wallet } from "ethers";

const privateKey = "SUA_PRIVATE_KEY_AQUI";
const wallet = new Wallet(privateKey);

const tx = {
  from:                 "0x9b57847b69D0354837F7b723133B9dBCbefb4F9F",
  to:                   "0x23183C87c9c6668edf5974893905AF475c3664c9",
  data:                 "0x40180def000000000000000000000000fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb90000000000000000000000009b57847b69d0354837f7b723133b9dbcbefb4f9f000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000009b57847b69d0354837f7b723133b9dbcbefb4f9f0000000000000000000000001e659faad0181ab1a30891d99f69df115db77eef0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000e3220000000000000000000000000000000000000000000000000000000000000706",
  value:                0n,
  chainId:              42161,
  gasLimit:             82499n,
  maxPriorityFeePerGas: 0n,
  maxFeePerGas:         52514800n,
  nonce:                36,
  type:                 2,
};

const signedTx = await wallet.signTransaction(tx);
console.log("Transação assinada:", signedTx);
You can now submit your signed transaction using our broadcast endpoint.