Skip to main content

TipLink

The main class to interface with tiplink.io urls and keypairs.

Functionality includes creating a new TipLink with Keypair and url as well as getting a Keypair from a TipLink url.

Import

import { TipLink } from '@tiplink/api';

Class Definition

export class TipLink {
url: URL; // Standard lib
keypair: Keypair; // import { Keypair } from '@solana/web3.js';

public static async create(): Promise<TipLink> {}

public static async fromUrl(url: URL): Promise<TipLink> {}

public static async fromLink(link: string): Promise<TipLink> {}
}

Example Usage

import { TipLink } from '@tiplink/api';

// Create A New TipLink
TipLink.create().then(tiplink => {
console.log("link: ", tiplink.url.toString());
console.log("publicKey: ", tiplink.keypair.publicKey.toBase58());
return tiplink;
});

// Get Public Key from TipLink
const getPublicKeyString = async (link_string) => {
const tiplink = await TipLink.fromLink(tp);
return tiplink.keypair.publicKey.toBase58();
};

const tp = 'https://tiplink.io/i#5jC3aFcBJR4g4BQ5D';
getPublicKeyString(tp).then((publicKeyString) => {
console.log("publicKey (which can be used to fund the TipLink): ", publicKeyString);
});