Token Management
Adding a Token
addToken()
addToken()addToken({ contractId: string, networkPassphrase?: string })
-> Promise<{ contractId: string } & { error?: FreighterApiError }>Parameters
Parameter
Type
Description
Example
import { isConnected, addToken } from "@stellar/freighter-api";
const { isConnected: connected } = await isConnected();
if (!connected) return;
const result = await addToken({
contractId: "CC...ABCD",
networkPassphrase: "Test SDF Network ; September 2015", // optional
});
if (result.error) {
console.error(result.error.message);
} else {
console.log(`Token added: ${result.contractId}`);
}Last updated
Was this helpful?
