Prepare: repay an agent credit line
credit_repayUnsigned transactions repaying a line's USDG debt from the wallet (anyone may): an amount, or amount "all"; exact USDG approval to the line first (all: the debt plus a hundredth of a percent for interest until it lands; repay takes only what is owed). With close: true (a JSON boolean; the owner only): repay everything and take every credit and any USDG left back to the wallet. With unwind: true (a JSON boolean; the owner only; a line whose market has a pool): no USDG needed, the line sells its own CREDIT in its pool into the debt (sellAndRepay: by default enough to repay it all, at a minimum of the whole debt, then closes the line; sell and min_usdg to choose). Repaying, closing and an unwind at the whole debt work before CREDIT's price starts and during a write-off too. Check each transaction's to: a line the factory confirms (isAccount), or USDG for an exact approval.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sell | No | With unwind: CREDIT to sell, or "all" (default: enough for the whole debt), in whole units as a decimal string, like "1.5" | |
| close | No | The owner: repay everything and take every credit back | |
| amount | No | USDG to repay, or "all", in whole units as a decimal string, like "1.5" | |
| unwind | No | The owner: sell the line's CREDIT into its debt, no USDG needed | |
| wallet | Yes | The wallet's address (0x...); the transactions are built for it to sign | |
| account | Yes | The line's address | |
| min_usdg | No | With unwind: the least USDG the sale must bring (default: the whole debt when selling all or the default amount, else 97% of the pool's price), in whole units as a decimal string, like "1.5" | |
| then_close | No | With unwind: close the line after (default true when the sale covers the debt) |