Skip to main content

MintToken

MintToken creates and distributes tokens to the specified address.

Method Options​

Authorisation specification of the MintToken method.

TypeMETHOD_TYPE_WRITE
Access LevelMETHOD_ACCESS_LEVEL_PUBLIC
Roles

    Parameters​

    Request and response parameter message overview:

    Input: MintTokenRequest Message​

    FieldTypeRequiredDescription
    Amount

    meshtrade.type.v1.Amount

    True

    The amount of tokens to mint. Must be specified.

    Address

    string

    True

    The blockchain address to mint tokens to. Must be specified.

    Options

    meshtrade.testing.ledger.token_tap.v1.MintTokenOptions

    False

    Optional parameters for customizing the mint operation.

    Returns: MintTokenResponse Message​

    No response fields documented.

    Code Examples​

    Select supported SDK in the language of your choice for a full example of how to invoke the this method:

    package main

    import (
    "context"
    "log"

    token_tapv1 "github.com/meshtrade/api/go/testing/ledger/token_tap/v1"
    typev1 "github.com/meshtrade/api/go/type/v1"
    )

    func main() {
    ctx := context.Background()

    // Default configuration is used and credentials come from MESH_API_CREDENTIALS
    // environment variable or default discovery methods. Zero config required
    // unless you want custom configuration.
    service, err := token_tapv1.NewTokenTapService()
    if err != nil {
    log.Fatalf("Failed to create service: %v", err)
    }
    defer service.Close()

    // Create a test token (USDC on Stellar)
    testToken := &typev1.Token{
    Code: "USDC",
    Issuer: "GBUQWP3BOUZX34ULNQG23RQ6F4BWFIDBIS7XYPV5NPROCEWV2E2YXNU",
    Ledger: typev1.Ledger_LEDGER_STELLAR,
    }

    // Mint tokens to a test address with optional network-specific options
    request := &token_tapv1.MintTokenRequest{
    // Specify the amount to mint (required)
    Amount: &typev1.Amount{
    Token: testToken,
    Value: &typev1.Decimal{
    Value: "1000000",
    },
    },
    // Specify the recipient address (required)
    Address: "GDQXVHH7QVVQSHCXU7ZDM4C2DAQF7UEQWPX3JHG7LJ2YS6FLXJY5E2SZ",
    // Optional: Network-specific options (Stellar or Solana)
    Options: &token_tapv1.MintTokenOptions{
    MintTokenOptions: &token_tapv1.MintTokenOptions_StellarMintOptions{
    StellarMintOptions: &token_tapv1.StellarMintOptions{
    Options: []*token_tapv1.StellarMintOption{
    {
    StellarMintOption: &token_tapv1.StellarMintOption_StellarMintTokenWithMemo{
    StellarMintTokenWithMemo: &token_tapv1.StellarMintTokenWithMemo{
    Memo: "test-mint-001",
    },
    },
    },
    },
    },
    },
    },
    }

    // Call the MintToken method
    response, err := service.MintToken(ctx, request)
    if err != nil {
    log.Fatalf("MintToken failed: %v", err)
    }

    // Token has been minted successfully
    log.Printf("Token minted successfully: %+v", response)
    }

    Advanced Configuration​

    For advanced client configuration options (custom endpoints, TLS settings, timeouts), see the SDK Configuration Guide.

    Other Methods​