Options for funding multiple C-addresses in one or more transactions via OnboardingBridgeSDK.batchFundCAddresses.

The source account is charged the sum of all amounts in one transfer per transaction chunk. For any target that fails (blocked, not allowlisted), the corresponding amount is refunded to source.

When the number of targets exceeds BATCH_TX_LIMIT the SDK automatically splits the list into chunks of at most BATCH_TX_LIMIT and submits one transaction per chunk. The optional onProgress callback (passed as the third argument to batchFundCAddresses) is called after each transaction with the running total of recipients processed.

await sdk.batchFundCAddresses(
{
source: keypair.publicKey(),
targets: ['CC...1', 'CC...2', 'CC...3'],
amounts: ['5000000', '3000000', '2000000'],
asset: 'CD...',
},
keypair,
(completed, total, txHash) => {
console.log(`Progress: ${completed}/${total} — tx: ${txHash}`);
},
);
interface BatchFundCOptions {
    amounts: string[];
    asset: string;
    source: string;
    targets: string[];
}

Properties

amounts: string[]

Corresponding amounts for each target, in the token's smallest unit. Must be the same length as targets.

asset: string

Token contract address for all transfers in this batch. The asset must be whitelisted on the bridge contract.

source: string

Source account (G-address) providing all the funds.

targets: string[]

Ordered list of destination C-addresses. Must be the same length as amounts.