Minting profiles
Another use case for profiles could be minting-profiles. You might have asset contracts deployed on beam which need to be minted on-demand - but you don't want everyone to be able mint whenever they want, so the contract has a pre-defined allowlist of addresses that are able to mint assets for the contract.
If your contracts support extending this list of addresses, you could simply create a profile and add the address of the profile to the allowlist once.
const minter = await beam.profiles.createProfile("your-minter-id");
// {
// "id": "string",
// "wallets": [
// {
// "id": "string",
// "address": "string",
// ...
// }
// ]
// }
Take the wallet address of the profile you just created, and add it to the allowlist of the contract on-chain. This gives you the possibility to use the minting profile through our SDK to mint assets on demand.
After the address is whitelisted, minting an asset is as simple as creating a new transaction on behalf of the minter profile. As the minter-profile is whitelisted, you (through the api key) are in full control of minting assets. If you would like to mint an asset to a player's profile, it would be as simple as doing the following:
const player = await beam.profiles.getProfile("your-player-id");
const mint = await beam.transactions.createTransaction("your-minter-id", {
interactions: [
{
contract: "0x9eeaecbe2884aa7e82f450e3fc174f30fc2a8de3",
functionName: "_mint",
functionArgs: [player.wallets[0].address, "arg-2", "arg-3", "arg-4"],
},
],
});
// {
// "status": "success",
// "type": "custodial",
// "transactionHash": '0x71f3f259568e9875c41a4350a3912a3a7650d9321ccd1d57641241128b4e504f',
// "explorerUrl": "https://subnets.avax.network/beam/0x71f3f259568e9875c41a4350a3912a3a7650d9321ccd1d57641241128b4e504f"
// }