Launch token through Portal
1) Prepare token metadata
async function uploadTokenMeta(cfg: {
buy: string | null;
creator: string;
description: string;
sell: string | null;
telegram: string | null;
twitter: string | null;
website: string | null;
image_path: string;
}) {
const form = new FormData();
const MUTATION_CREATE = `
mutation Create($file: Upload!, $meta: MetadataInput!) {
create(file: $file, meta: $meta)
}
`;
form.append(
"operations",
JSON.stringify({
query: MUTATION_CREATE,
variables: {
file: null, meta: {
website: cfg.website,
twitter: cfg.twitter,
telegram: cfg.telegram,
description: cfg.description,
creator: "0x0000000000000000000000000000000000000000",
}
},
})
);
form.append(
"map",
JSON.stringify({
"0": ["variables.file"],
})
);
const file = new File([fs.readFileSync(cfg.image_path)], "image.png", {
type: "image/png",
});
form.append("0", file);
const res = await axios.postForm(FlapConfig.api, form, {
headers: {
"Content-Type": "multipart/form-data",
},
});
if (res.status !== 200) {
throw new Error(`failed to upload the token meta: ${res.statusText}`);
}
const cid = res.data.data.create;
return cid;
}2) Call newTokenV5
newTokenV53) Find the salt (vanity suffix)
4) Legacy methods
Last updated