diff --git a/src/constants/general/index.ts b/src/constants/general/index.ts index 7c97cdfb..8f79e9d4 100644 --- a/src/constants/general/index.ts +++ b/src/constants/general/index.ts @@ -97,6 +97,7 @@ export const VALIDATION = { ERRORS: { INVALID_AMOUNT: 'Amount must be positive', INVALID_SUBACCOUNT_ID: 'Subaccount ID must be between 0 and 255', + INVALID_EXTEND_SUPPLY_PARAMETERS: 'subaccountId, customPayloadRecipient, returnRepayRemainingsFlag, customPayloadSaturationFlag must be provided', MISSING_JETTON_AMOUNT: 'Either amount, liquidationAmount, or supplyAmount must be provided', MISSING_RESPONSE_ADDRESS: 'responseAddress, userAddress, or liquidatorAddress must be provided', INVALID_ASSET_CONFIG: 'Invalid asset configuration provided', diff --git a/src/contracts/AbstractMaster.ts b/src/contracts/AbstractMaster.ts index 85dad733..ca81738c 100644 --- a/src/contracts/AbstractMaster.ts +++ b/src/contracts/AbstractMaster.ts @@ -62,10 +62,10 @@ export interface EvaaParameters { } /** - * Parameters for supply operations - * @interface SupplyParameters + * Base parameters for supply operations + * @type SupplyBaseParameters */ -export interface SupplyParameters { +export type SupplyBaseParameters = { /** Asset configuration for the supply operation */ readonly asset: PoolAssetConfig; /** Unique identifier for this operation */ @@ -82,16 +82,30 @@ export interface SupplyParameters { readonly forwardAmount?: bigint; /** Operation payload cell */ readonly payload: Cell; - /** Optional subaccount identifier (0-255) */ - readonly subaccountId?: number; - /** Whether to return repay remainings */ - readonly returnRepayRemainingsFlag?: boolean; - /** Optional custom payload recipient address */ - readonly customPayloadRecipient?: Address; - /** Whether to saturate custom payload */ - readonly customPayloadSaturationFlag?: boolean; } +/** + * Extended parameters for supply operations + * @type SupplyExtendParameters + */ +export type SupplyExtendParameters = SupplyBaseParameters & { + /** Optional subaccount identifier (0-255) */ + readonly subaccountId: number; + /** Whether to return repay remainings */ + readonly returnRepayRemainingsFlag: boolean; + /** Optional custom payload recipient address */ + readonly customPayloadRecipient: Address; + /** Whether to saturate custom payload */ + readonly customPayloadSaturationFlag: boolean; +}; + + +/** + * Parameters for supply operations + * @type SupplyParameters + */ +export type SupplyParameters = SupplyBaseParameters | SupplyExtendParameters; + /** * Parameters for withdraw operations * @interface WithdrawParameters @@ -343,16 +357,29 @@ export abstract class AbstractEvaaMaster