From f4c6104738c89b46cd6fc6b9aa82bf7f1c5ce615 Mon Sep 17 00:00:00 2001 From: Jonathan Amobi Date: Sat, 12 Sep 2026 18:13:26 +0100 Subject: [PATCH] feat: add dynamic splits support to InitializeTransaction Add a split property with discriminated union for bearer_type, enforcing bearer_subaccount when bearer_type is subaccount. --- src/transaction/interface.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/transaction/interface.ts b/src/transaction/interface.ts index 09b4064..8dc75c5 100644 --- a/src/transaction/interface.ts +++ b/src/transaction/interface.ts @@ -74,6 +74,29 @@ export interface InitializeTransaction { * `account` or `subaccount` (defaults to `account`) */ bearer?: string; + + /** + * A dynamic split configuration for this transaction. + * Use this to create splits on the fly without pre-creating a split. + */ + split?: { + /** + * The type of split. Can be `flat` or `percentage` + */ + type: "flat" | "percentage"; + /** + * An array of subaccount objects with subaccount code and share. + * @example [{ "subaccount": "ACCT_pwwualwty4nhq9d", "share": 6000 }] + */ + subaccounts: { subaccount: string; share: number }[]; + /** + * Unique reference for the split + */ + reference?: string; + } & ( + | { bearer_type: "all" | "all-proportional" | "account" } + | { bearer_type: "subaccount"; bearer_subaccount: string } + ); } export interface Response {