Prerequisites

  • Ensure you have a wallet created.
  • API Key: Ensure you have an API key with the scopes: wallets:transactions.create.

Sending a contract call transaction

import { useWallet, StellarWallet } from '@crossmint/client-sdk-react-ui';

const { wallet } = useWallet();

const stellarWallet = StellarWallet.from(wallet);

const { hash, explorerLink } = await stellarWallet.sendTransaction({
    contractId: "GB3KQJ6N2YIE62YVO67X7W5TQK6Q5ZZ4P2LUVK2U6AU26CJQ626J",
    method: "transfer",
    args: {
        to: "GB3KQJ6N2YIE62YVO67X7W5TQK6Q5ZZ4P2LUVK2U6AU26CJQ626J",
        from: "GB3KQJ6N2YIE62YVO67X7W5TQK6Q5ZZ4P2LUVK2U6AU26CJQ626J",
        amount: "1000000000000000000"
    }
});

Parameters

contractId
string
required
The contract ID to send the transaction to.
method
string
required
The method to call on the contract.
args
Record<string, any>
required
The arguments to pass to the method.

Returns

hash
string
The hash of the transaction.
The explorer link of the transaction.

Sending a serialized transaction

import { useWallet, StellarWallet } from '@crossmint/client-sdk-react-ui';

const { wallet } = useWallet();

const stellarWallet = StellarWallet.from(wallet);

const { hash, explorerLink } = await stellarWallet.sendTransaction({
    transaction: transaction,
    contractId: contractId,
});

Parameters

transaction
string
required
The XDR base64-encoded serialized transaction to send.
contractId
string
required
The contract ID to send the transaction to.

Returns

hash
string
The hash of the transaction.
The explorer link of the transaction.