I am answering my own question to help others.
There's a example of creating a token using token extensions metadata in the Solana Labs repo. This has been turned into a helper in the @solana-developers/helpers
package.
npm i @solana-developers/helpers
Then:
import { makeTokenMint } from @solana-developers/helpers
Parameters
connection
: Connection.
mintAuthority
: Keypair of the account that will be given permission to make new tokens.
name
: string, name of the token.
symbol
: string, like a ticker symbol. Usually in all-caps.
decimals
: number, how many decimal places the new token will have.
uri
: string, URI to a JSON file containing at minimum a value for image
.
additionalMetadata
: additional metadata as either Record<string, string>
or Array<[string, string]>
(optional).
updateAuthority
: PublicKey (optional) - public key of the account that can update the token.
freezeAuthority
: PublicKey (optional) - public key of the freeze account, default to null
const mintAddress = await makeTokenMint(
connection,
mintAuthority,
"Unit test token",
"TEST",
9,
"https://raw.githubusercontent.com/solana-developers/professional-education/main/labs/sample-token-metadata.json",
);