Transfer
POST https://sol.shrine.trade/api/transfer
SOL, or any SPL token, to another wallet. A token transfer creates the recipient's token account when it does not exist yet, paid by the sender.
{ "publicKey": "<sender>", "to": "<recipient>", "amount": 0.1 }
{ "publicKey": "<sender>", "to": "<recipient>", "mint": "<mint>", "amount": "100%" }
| Field | Notes |
|---|---|
mint | Omit for SOL. |
amount | SOL or tokens in normal units, or a percentage of the balance: "100%", "25%". |
priorityFee, jitoTip | Optional, SOL. |
{ "tx": "<base64>", "blockhash": "…", "mint": null, "amount": 0.1, "amountRaw": 100000000, "feeLamports": 0 }
Example
Build, sign, send through the relay. The relay broadcasts through our own Solana endpoint, so the script needs no RPC.
- JavaScript
- Python
import { Keypair, VersionedTransaction } from "@solana/web3.js";
import bs58 from "bs58";
const wallet = Keypair.fromSecretKey(bs58.decode("<your wallet private key, base58>"));
// Every token of this mint the wallet holds, to another wallet.
const { tx } = await (await fetch("https://sol.shrine.trade/api/transfer", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ publicKey: wallet.publicKey.toBase58(), to: "<recipient>", mint: "<mint>", amount: "100%" }),
})).json();
const transaction = VersionedTransaction.deserialize(Buffer.from(tx, "base64"));
transaction.sign([wallet]);
const sent = await (await fetch("https://sol.shrine.trade/api/send", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ signedTx: Buffer.from(transaction.serialize()).toString("base64") }),
})).json();
console.log(sent.status, `https://solscan.io/tx/${sent.signature}`);
import base64, requests
from solders.keypair import Keypair
from solders.transaction import VersionedTransaction
wallet = Keypair.from_base58_string("<your wallet private key, base58>")
# Every token of this mint the wallet holds, to another wallet.
r = requests.post("https://sol.shrine.trade/api/transfer",
json={"publicKey": str(wallet.pubkey()), "to": "<recipient>", "mint": "<mint>", "amount": "100%"}).json()
raw = VersionedTransaction.from_bytes(base64.b64decode(r["tx"]))
signed = VersionedTransaction(raw.message, [wallet])
sent = requests.post("https://sol.shrine.trade/api/send",
json={"signedTx": base64.b64encode(bytes(signed)).decode()}).json()
print(sent["status"], sent["explorer"])