@liquidium/client 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -13
- package/dist/index.cjs +264 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -41
- package/dist/index.d.ts +85 -41
- package/dist/index.js +265 -99
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -834,7 +834,7 @@ interface CreateBorrowRequest {
|
|
|
834
834
|
poolId: string;
|
|
835
835
|
/** Amount to borrow in the borrow asset's base units. */
|
|
836
836
|
amount: bigint;
|
|
837
|
-
/** External-chain address that receives the borrowed asset. */
|
|
837
|
+
/** External-chain address that receives the borrowed asset. Must match the borrow pool chain. */
|
|
838
838
|
receiverAddress: string;
|
|
839
839
|
/** Wallet address that signs the borrow authorization. */
|
|
840
840
|
signerWalletAddress: string;
|
|
@@ -863,7 +863,7 @@ interface CreateWithdrawRequest {
|
|
|
863
863
|
poolId: string;
|
|
864
864
|
/** Amount to withdraw in the pool asset's base units. */
|
|
865
865
|
amount: bigint;
|
|
866
|
-
/** External-chain address that receives the withdrawn asset. */
|
|
866
|
+
/** External-chain address that receives the withdrawn asset. Must match the pool chain. */
|
|
867
867
|
receiverAddress: string;
|
|
868
868
|
/** Wallet address that signs the withdraw authorization. */
|
|
869
869
|
signerWalletAddress: string;
|
|
@@ -1014,9 +1014,9 @@ interface EstimateInflowFeeRequest {
|
|
|
1014
1014
|
/** Chain to estimate for. */
|
|
1015
1015
|
chain: Chain;
|
|
1016
1016
|
}
|
|
1017
|
-
/** Fee estimate for an inflow target. */
|
|
1017
|
+
/** Fee estimate for an inflow target, rounded up to the asset's fee unit. */
|
|
1018
1018
|
interface InflowFeeEstimate {
|
|
1019
|
-
/** Estimated total fee in the asset's base units. */
|
|
1019
|
+
/** Estimated total fee rounded up in the asset's base units. */
|
|
1020
1020
|
totalFee: bigint;
|
|
1021
1021
|
}
|
|
1022
1022
|
/** Request for ERC-20 approval and deposit planning. */
|
|
@@ -1170,12 +1170,13 @@ declare class LendingModule {
|
|
|
1170
1170
|
* Estimates the network/deposit fee for an inflow target.
|
|
1171
1171
|
*
|
|
1172
1172
|
* ETH stablecoin deposit-address estimates are served by the deposit-address
|
|
1173
|
-
* canister. BTC estimates
|
|
1173
|
+
* canister. BTC estimates include the ckBTC minter deposit fee and ledger fee.
|
|
1174
1174
|
*
|
|
1175
1175
|
* @param request - Asset and chain pair to estimate for.
|
|
1176
|
-
* @returns Total fee estimate in the asset's base units.
|
|
1176
|
+
* @returns Total fee estimate rounded up in the asset's base units.
|
|
1177
1177
|
*/
|
|
1178
1178
|
estimateInflowFee(request: EstimateInflowFeeRequest): Promise<InflowFeeEstimate>;
|
|
1179
|
+
private estimateBtcInflowFee;
|
|
1179
1180
|
private sendAndSubmitNativeSupplyInflow;
|
|
1180
1181
|
private submitSupplyFlowInflow;
|
|
1181
1182
|
private executeContractSupply;
|
|
@@ -1199,6 +1200,7 @@ declare class LendingModule {
|
|
|
1199
1200
|
private requireApi;
|
|
1200
1201
|
private requireEvmReadClient;
|
|
1201
1202
|
private getPoolById;
|
|
1203
|
+
private normalizeOutflowReceiverAddress;
|
|
1202
1204
|
private sendEthContractTransaction;
|
|
1203
1205
|
private waitForExpectedAllowance;
|
|
1204
1206
|
}
|
|
@@ -1574,11 +1576,13 @@ interface CreateInstantLoanRequest {
|
|
|
1574
1576
|
*/
|
|
1575
1577
|
borrowAsset: InstantLoanAsset;
|
|
1576
1578
|
/**
|
|
1577
|
-
*
|
|
1579
|
+
* Intended credited collateral amount, in base units.
|
|
1578
1580
|
*
|
|
1579
|
-
* This is used to validate LTV and initialize the loan record
|
|
1580
|
-
*
|
|
1581
|
-
* `decimals` value.
|
|
1581
|
+
* This is used to validate LTV and initialize the loan record before
|
|
1582
|
+
* deposit/inflow fees are deducted. For BTC, pass satoshis. For token assets,
|
|
1583
|
+
* convert the UI amount using the selected pool's `decimals` value. After
|
|
1584
|
+
* creation, use `loan.initialDeposit.amount` as the fee-inclusive transfer
|
|
1585
|
+
* amount to send to `loan.initialDeposit.target`.
|
|
1582
1586
|
*/
|
|
1583
1587
|
collateralAmount: bigint;
|
|
1584
1588
|
/**
|
|
@@ -1736,6 +1740,23 @@ interface InstantLoanRepayment {
|
|
|
1736
1740
|
/** Address or ICRC account where the repayment should be sent. */
|
|
1737
1741
|
target: SupplyTarget;
|
|
1738
1742
|
}
|
|
1743
|
+
/** Initial collateral deposit quote returned when an instant loan is created. */
|
|
1744
|
+
interface InstantLoanInitialDeposit {
|
|
1745
|
+
/** Full amount to send to the deposit target, including the estimated inflow fee. */
|
|
1746
|
+
amount: bigint;
|
|
1747
|
+
/** Decimal scale for `amount`, `collateralAmount`, and `inflowFeeAmount`. */
|
|
1748
|
+
decimals: bigint;
|
|
1749
|
+
/** Intended credited collateral amount in base units, before inflow fees. */
|
|
1750
|
+
collateralAmount: bigint;
|
|
1751
|
+
/** Inflow fee amount in base units added to the transfer amount. */
|
|
1752
|
+
inflowFeeAmount: bigint;
|
|
1753
|
+
/** Collateral asset to deposit. */
|
|
1754
|
+
asset: MarketAsset;
|
|
1755
|
+
/** Chain used for the collateral deposit. */
|
|
1756
|
+
chain: MarketChain;
|
|
1757
|
+
/** Address or ICRC account where the collateral should be sent. */
|
|
1758
|
+
target: SupplyTarget;
|
|
1759
|
+
}
|
|
1739
1760
|
/** Current lending position backing the instant loan. */
|
|
1740
1761
|
interface InstantLoanPositionSummary {
|
|
1741
1762
|
/** Current collateral amount in the collateral asset's base units. */
|
|
@@ -1760,9 +1781,45 @@ declare const InstantLoanStatus: {
|
|
|
1760
1781
|
readonly active: "active";
|
|
1761
1782
|
readonly settling: "settling";
|
|
1762
1783
|
readonly closed: "closed";
|
|
1784
|
+
readonly expired: "expired";
|
|
1763
1785
|
};
|
|
1764
1786
|
type InstantLoanStatus = (typeof InstantLoanStatus)[keyof typeof InstantLoanStatus];
|
|
1765
|
-
/**
|
|
1787
|
+
/** Immutable terms selected for an instant loan. */
|
|
1788
|
+
interface InstantLoanTerms {
|
|
1789
|
+
/** Maximum loan-to-value ratio in basis points. */
|
|
1790
|
+
ltvMaxBps: bigint;
|
|
1791
|
+
/** Seconds allowed for the collateral deposit before timeout. */
|
|
1792
|
+
depositWindowSeconds: bigint;
|
|
1793
|
+
}
|
|
1794
|
+
/** Collateral leg selected for an instant loan. */
|
|
1795
|
+
interface InstantLoanCollateral {
|
|
1796
|
+
/** Principal text of the collateral pool. */
|
|
1797
|
+
poolId: string;
|
|
1798
|
+
/** Collateral asset symbol. */
|
|
1799
|
+
asset: MarketAsset;
|
|
1800
|
+
/** Chain used for collateral deposits. */
|
|
1801
|
+
chain: MarketChain;
|
|
1802
|
+
/** Decimal scale for collateral amounts. */
|
|
1803
|
+
decimals: bigint;
|
|
1804
|
+
/** Intended credited collateral amount in base units, before inflow fees. */
|
|
1805
|
+
amount: bigint;
|
|
1806
|
+
}
|
|
1807
|
+
/** Borrow leg selected for an instant loan. */
|
|
1808
|
+
interface InstantLoanBorrow {
|
|
1809
|
+
/** Principal text of the borrow pool. */
|
|
1810
|
+
poolId: string;
|
|
1811
|
+
/** Borrow asset symbol. */
|
|
1812
|
+
asset: MarketAsset;
|
|
1813
|
+
/** Chain used for repayment. */
|
|
1814
|
+
chain: MarketChain;
|
|
1815
|
+
/** Decimal scale for borrow and debt amounts. */
|
|
1816
|
+
decimals: bigint;
|
|
1817
|
+
/** Requested borrow amount in base units. */
|
|
1818
|
+
amount: bigint;
|
|
1819
|
+
/** Destination that receives the borrowed asset. */
|
|
1820
|
+
destination: InstantLoanAccount;
|
|
1821
|
+
}
|
|
1822
|
+
/** Hydrated instant-loan state plus generated quote targets. */
|
|
1766
1823
|
interface InstantLoan {
|
|
1767
1824
|
/** Canister-assigned loan id. */
|
|
1768
1825
|
loanId: bigint;
|
|
@@ -1772,32 +1829,17 @@ interface InstantLoan {
|
|
|
1772
1829
|
status: InstantLoanStatus;
|
|
1773
1830
|
/** Generated lending profile principal used by the instant loan. */
|
|
1774
1831
|
profileId: string;
|
|
1775
|
-
/**
|
|
1776
|
-
|
|
1777
|
-
/**
|
|
1778
|
-
|
|
1779
|
-
/**
|
|
1780
|
-
|
|
1781
|
-
poolId: string;
|
|
1782
|
-
asset: MarketAsset;
|
|
1783
|
-
chain: MarketChain;
|
|
1784
|
-
amount: bigint;
|
|
1785
|
-
};
|
|
1786
|
-
/** Borrow-side pool, asset, chain, requested amount, and destination. */
|
|
1787
|
-
borrow: {
|
|
1788
|
-
poolId: string;
|
|
1789
|
-
asset: MarketAsset;
|
|
1790
|
-
chain: MarketChain;
|
|
1791
|
-
amount: bigint;
|
|
1792
|
-
destination: InstantLoanAccount;
|
|
1793
|
-
};
|
|
1832
|
+
/** Immutable loan terms. */
|
|
1833
|
+
terms: InstantLoanTerms;
|
|
1834
|
+
/** Collateral-side pool, asset, chain, decimals, and requested credited amount. */
|
|
1835
|
+
collateral: InstantLoanCollateral;
|
|
1836
|
+
/** Borrow-side pool, asset, chain, decimals, requested amount, and destination. */
|
|
1837
|
+
borrow: InstantLoanBorrow;
|
|
1794
1838
|
/** Destination used for collateral refunds or withdrawals. */
|
|
1795
1839
|
refundDestination: InstantLoanAccount;
|
|
1796
|
-
/**
|
|
1797
|
-
|
|
1798
|
-
/**
|
|
1799
|
-
repayTarget: SupplyTarget;
|
|
1800
|
-
/** Current actionable repayment quote. */
|
|
1840
|
+
/** Current actionable initial collateral deposit quote. */
|
|
1841
|
+
initialDeposit: InstantLoanInitialDeposit;
|
|
1842
|
+
/** Current repayment quote. Amount fields are zero when the loan has no debt. */
|
|
1801
1843
|
repayment: InstantLoanRepayment;
|
|
1802
1844
|
/** Current lending position state for the generated profile. */
|
|
1803
1845
|
position: InstantLoanPositionSummary;
|
|
@@ -1825,8 +1867,8 @@ interface InstantLoanCandidate {
|
|
|
1825
1867
|
collateralAsset: MarketAsset;
|
|
1826
1868
|
/** Borrow asset symbol. */
|
|
1827
1869
|
borrowAsset: MarketAsset;
|
|
1828
|
-
/** Collateral amount
|
|
1829
|
-
|
|
1870
|
+
/** Collateral amount in base units. */
|
|
1871
|
+
collateralAmount: bigint;
|
|
1830
1872
|
}
|
|
1831
1873
|
|
|
1832
1874
|
/** Accountless instant-loan creation, lookup, recovery, and canister query helpers. */
|
|
@@ -1838,7 +1880,7 @@ declare class InstantLoansModule {
|
|
|
1838
1880
|
constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, lending: LendingModule, positions: PositionsModule);
|
|
1839
1881
|
/**
|
|
1840
1882
|
* Creates a profileless instant loan and returns canonical canister state plus
|
|
1841
|
-
* deposit
|
|
1883
|
+
* generated initial-deposit and repayment quote targets.
|
|
1842
1884
|
*
|
|
1843
1885
|
* Choose `collateralPoolId` and `borrowPoolId` from
|
|
1844
1886
|
* `client.market.listPools()`, convert UI amounts to base units with the
|
|
@@ -1851,7 +1893,7 @@ declare class InstantLoansModule {
|
|
|
1851
1893
|
* SDK maps it to the canister's internal `ltv_timer_s` field.
|
|
1852
1894
|
*
|
|
1853
1895
|
* @param request - Pool ids, assets, base-unit amounts, LTV limit, timeout, and destinations.
|
|
1854
|
-
* @returns Hydrated loan state plus generated deposit and repayment targets.
|
|
1896
|
+
* @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
|
|
1855
1897
|
*/
|
|
1856
1898
|
create(request: CreateInstantLoanRequest): Promise<InstantLoan>;
|
|
1857
1899
|
/**
|
|
@@ -1861,7 +1903,7 @@ declare class InstantLoansModule {
|
|
|
1861
1903
|
* from the instant-loans canister.
|
|
1862
1904
|
*
|
|
1863
1905
|
* @param request - Canister loan id or short public reference.
|
|
1864
|
-
* @returns Hydrated loan state plus generated deposit and repayment targets.
|
|
1906
|
+
* @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
|
|
1865
1907
|
*/
|
|
1866
1908
|
get(request: InstantLoanGetRequest): Promise<InstantLoan>;
|
|
1867
1909
|
/**
|
|
@@ -1914,8 +1956,10 @@ declare class InstantLoansModule {
|
|
|
1914
1956
|
*/
|
|
1915
1957
|
findByAddress(address: string): Promise<InstantLoanCandidate[]>;
|
|
1916
1958
|
private mapLoanRecord;
|
|
1959
|
+
private getCollateralAmountHint;
|
|
1917
1960
|
private mapLoanWire;
|
|
1918
1961
|
private hydrateLoan;
|
|
1962
|
+
private createInitialDepositQuote;
|
|
1919
1963
|
private estimateRepaymentInflowFee;
|
|
1920
1964
|
private requireApi;
|
|
1921
1965
|
private validateInstantLoanLtvPolicy;
|
|
@@ -2213,4 +2257,4 @@ interface ExecuteWithOptions {
|
|
|
2213
2257
|
*/
|
|
2214
2258
|
declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
|
|
2215
2259
|
|
|
2216
|
-
export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateProfileParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type FindPoolQuery, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, HistoryModule, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanAuthorization, type InstantLoanCandidate, type InstantLoanConfig, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanGetRequest, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesRequest, type LtvCalculation, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, PositionsModule, type PrepareCreateProfileOptions, QuoteModule, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendBtcTransactionRequest, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WalletExecutionParams, type WalletTransferSupplyFlowRequest, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };
|
|
2260
|
+
export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateProfileParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type FindPoolQuery, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, HistoryModule, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanAuthorization, type InstantLoanBorrow, type InstantLoanCandidate, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesRequest, type LtvCalculation, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, PositionsModule, type PrepareCreateProfileOptions, QuoteModule, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendBtcTransactionRequest, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WalletExecutionParams, type WalletTransferSupplyFlowRequest, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };
|
package/dist/index.d.ts
CHANGED
|
@@ -834,7 +834,7 @@ interface CreateBorrowRequest {
|
|
|
834
834
|
poolId: string;
|
|
835
835
|
/** Amount to borrow in the borrow asset's base units. */
|
|
836
836
|
amount: bigint;
|
|
837
|
-
/** External-chain address that receives the borrowed asset. */
|
|
837
|
+
/** External-chain address that receives the borrowed asset. Must match the borrow pool chain. */
|
|
838
838
|
receiverAddress: string;
|
|
839
839
|
/** Wallet address that signs the borrow authorization. */
|
|
840
840
|
signerWalletAddress: string;
|
|
@@ -863,7 +863,7 @@ interface CreateWithdrawRequest {
|
|
|
863
863
|
poolId: string;
|
|
864
864
|
/** Amount to withdraw in the pool asset's base units. */
|
|
865
865
|
amount: bigint;
|
|
866
|
-
/** External-chain address that receives the withdrawn asset. */
|
|
866
|
+
/** External-chain address that receives the withdrawn asset. Must match the pool chain. */
|
|
867
867
|
receiverAddress: string;
|
|
868
868
|
/** Wallet address that signs the withdraw authorization. */
|
|
869
869
|
signerWalletAddress: string;
|
|
@@ -1014,9 +1014,9 @@ interface EstimateInflowFeeRequest {
|
|
|
1014
1014
|
/** Chain to estimate for. */
|
|
1015
1015
|
chain: Chain;
|
|
1016
1016
|
}
|
|
1017
|
-
/** Fee estimate for an inflow target. */
|
|
1017
|
+
/** Fee estimate for an inflow target, rounded up to the asset's fee unit. */
|
|
1018
1018
|
interface InflowFeeEstimate {
|
|
1019
|
-
/** Estimated total fee in the asset's base units. */
|
|
1019
|
+
/** Estimated total fee rounded up in the asset's base units. */
|
|
1020
1020
|
totalFee: bigint;
|
|
1021
1021
|
}
|
|
1022
1022
|
/** Request for ERC-20 approval and deposit planning. */
|
|
@@ -1170,12 +1170,13 @@ declare class LendingModule {
|
|
|
1170
1170
|
* Estimates the network/deposit fee for an inflow target.
|
|
1171
1171
|
*
|
|
1172
1172
|
* ETH stablecoin deposit-address estimates are served by the deposit-address
|
|
1173
|
-
* canister. BTC estimates
|
|
1173
|
+
* canister. BTC estimates include the ckBTC minter deposit fee and ledger fee.
|
|
1174
1174
|
*
|
|
1175
1175
|
* @param request - Asset and chain pair to estimate for.
|
|
1176
|
-
* @returns Total fee estimate in the asset's base units.
|
|
1176
|
+
* @returns Total fee estimate rounded up in the asset's base units.
|
|
1177
1177
|
*/
|
|
1178
1178
|
estimateInflowFee(request: EstimateInflowFeeRequest): Promise<InflowFeeEstimate>;
|
|
1179
|
+
private estimateBtcInflowFee;
|
|
1179
1180
|
private sendAndSubmitNativeSupplyInflow;
|
|
1180
1181
|
private submitSupplyFlowInflow;
|
|
1181
1182
|
private executeContractSupply;
|
|
@@ -1199,6 +1200,7 @@ declare class LendingModule {
|
|
|
1199
1200
|
private requireApi;
|
|
1200
1201
|
private requireEvmReadClient;
|
|
1201
1202
|
private getPoolById;
|
|
1203
|
+
private normalizeOutflowReceiverAddress;
|
|
1202
1204
|
private sendEthContractTransaction;
|
|
1203
1205
|
private waitForExpectedAllowance;
|
|
1204
1206
|
}
|
|
@@ -1574,11 +1576,13 @@ interface CreateInstantLoanRequest {
|
|
|
1574
1576
|
*/
|
|
1575
1577
|
borrowAsset: InstantLoanAsset;
|
|
1576
1578
|
/**
|
|
1577
|
-
*
|
|
1579
|
+
* Intended credited collateral amount, in base units.
|
|
1578
1580
|
*
|
|
1579
|
-
* This is used to validate LTV and initialize the loan record
|
|
1580
|
-
*
|
|
1581
|
-
* `decimals` value.
|
|
1581
|
+
* This is used to validate LTV and initialize the loan record before
|
|
1582
|
+
* deposit/inflow fees are deducted. For BTC, pass satoshis. For token assets,
|
|
1583
|
+
* convert the UI amount using the selected pool's `decimals` value. After
|
|
1584
|
+
* creation, use `loan.initialDeposit.amount` as the fee-inclusive transfer
|
|
1585
|
+
* amount to send to `loan.initialDeposit.target`.
|
|
1582
1586
|
*/
|
|
1583
1587
|
collateralAmount: bigint;
|
|
1584
1588
|
/**
|
|
@@ -1736,6 +1740,23 @@ interface InstantLoanRepayment {
|
|
|
1736
1740
|
/** Address or ICRC account where the repayment should be sent. */
|
|
1737
1741
|
target: SupplyTarget;
|
|
1738
1742
|
}
|
|
1743
|
+
/** Initial collateral deposit quote returned when an instant loan is created. */
|
|
1744
|
+
interface InstantLoanInitialDeposit {
|
|
1745
|
+
/** Full amount to send to the deposit target, including the estimated inflow fee. */
|
|
1746
|
+
amount: bigint;
|
|
1747
|
+
/** Decimal scale for `amount`, `collateralAmount`, and `inflowFeeAmount`. */
|
|
1748
|
+
decimals: bigint;
|
|
1749
|
+
/** Intended credited collateral amount in base units, before inflow fees. */
|
|
1750
|
+
collateralAmount: bigint;
|
|
1751
|
+
/** Inflow fee amount in base units added to the transfer amount. */
|
|
1752
|
+
inflowFeeAmount: bigint;
|
|
1753
|
+
/** Collateral asset to deposit. */
|
|
1754
|
+
asset: MarketAsset;
|
|
1755
|
+
/** Chain used for the collateral deposit. */
|
|
1756
|
+
chain: MarketChain;
|
|
1757
|
+
/** Address or ICRC account where the collateral should be sent. */
|
|
1758
|
+
target: SupplyTarget;
|
|
1759
|
+
}
|
|
1739
1760
|
/** Current lending position backing the instant loan. */
|
|
1740
1761
|
interface InstantLoanPositionSummary {
|
|
1741
1762
|
/** Current collateral amount in the collateral asset's base units. */
|
|
@@ -1760,9 +1781,45 @@ declare const InstantLoanStatus: {
|
|
|
1760
1781
|
readonly active: "active";
|
|
1761
1782
|
readonly settling: "settling";
|
|
1762
1783
|
readonly closed: "closed";
|
|
1784
|
+
readonly expired: "expired";
|
|
1763
1785
|
};
|
|
1764
1786
|
type InstantLoanStatus = (typeof InstantLoanStatus)[keyof typeof InstantLoanStatus];
|
|
1765
|
-
/**
|
|
1787
|
+
/** Immutable terms selected for an instant loan. */
|
|
1788
|
+
interface InstantLoanTerms {
|
|
1789
|
+
/** Maximum loan-to-value ratio in basis points. */
|
|
1790
|
+
ltvMaxBps: bigint;
|
|
1791
|
+
/** Seconds allowed for the collateral deposit before timeout. */
|
|
1792
|
+
depositWindowSeconds: bigint;
|
|
1793
|
+
}
|
|
1794
|
+
/** Collateral leg selected for an instant loan. */
|
|
1795
|
+
interface InstantLoanCollateral {
|
|
1796
|
+
/** Principal text of the collateral pool. */
|
|
1797
|
+
poolId: string;
|
|
1798
|
+
/** Collateral asset symbol. */
|
|
1799
|
+
asset: MarketAsset;
|
|
1800
|
+
/** Chain used for collateral deposits. */
|
|
1801
|
+
chain: MarketChain;
|
|
1802
|
+
/** Decimal scale for collateral amounts. */
|
|
1803
|
+
decimals: bigint;
|
|
1804
|
+
/** Intended credited collateral amount in base units, before inflow fees. */
|
|
1805
|
+
amount: bigint;
|
|
1806
|
+
}
|
|
1807
|
+
/** Borrow leg selected for an instant loan. */
|
|
1808
|
+
interface InstantLoanBorrow {
|
|
1809
|
+
/** Principal text of the borrow pool. */
|
|
1810
|
+
poolId: string;
|
|
1811
|
+
/** Borrow asset symbol. */
|
|
1812
|
+
asset: MarketAsset;
|
|
1813
|
+
/** Chain used for repayment. */
|
|
1814
|
+
chain: MarketChain;
|
|
1815
|
+
/** Decimal scale for borrow and debt amounts. */
|
|
1816
|
+
decimals: bigint;
|
|
1817
|
+
/** Requested borrow amount in base units. */
|
|
1818
|
+
amount: bigint;
|
|
1819
|
+
/** Destination that receives the borrowed asset. */
|
|
1820
|
+
destination: InstantLoanAccount;
|
|
1821
|
+
}
|
|
1822
|
+
/** Hydrated instant-loan state plus generated quote targets. */
|
|
1766
1823
|
interface InstantLoan {
|
|
1767
1824
|
/** Canister-assigned loan id. */
|
|
1768
1825
|
loanId: bigint;
|
|
@@ -1772,32 +1829,17 @@ interface InstantLoan {
|
|
|
1772
1829
|
status: InstantLoanStatus;
|
|
1773
1830
|
/** Generated lending profile principal used by the instant loan. */
|
|
1774
1831
|
profileId: string;
|
|
1775
|
-
/**
|
|
1776
|
-
|
|
1777
|
-
/**
|
|
1778
|
-
|
|
1779
|
-
/**
|
|
1780
|
-
|
|
1781
|
-
poolId: string;
|
|
1782
|
-
asset: MarketAsset;
|
|
1783
|
-
chain: MarketChain;
|
|
1784
|
-
amount: bigint;
|
|
1785
|
-
};
|
|
1786
|
-
/** Borrow-side pool, asset, chain, requested amount, and destination. */
|
|
1787
|
-
borrow: {
|
|
1788
|
-
poolId: string;
|
|
1789
|
-
asset: MarketAsset;
|
|
1790
|
-
chain: MarketChain;
|
|
1791
|
-
amount: bigint;
|
|
1792
|
-
destination: InstantLoanAccount;
|
|
1793
|
-
};
|
|
1832
|
+
/** Immutable loan terms. */
|
|
1833
|
+
terms: InstantLoanTerms;
|
|
1834
|
+
/** Collateral-side pool, asset, chain, decimals, and requested credited amount. */
|
|
1835
|
+
collateral: InstantLoanCollateral;
|
|
1836
|
+
/** Borrow-side pool, asset, chain, decimals, requested amount, and destination. */
|
|
1837
|
+
borrow: InstantLoanBorrow;
|
|
1794
1838
|
/** Destination used for collateral refunds or withdrawals. */
|
|
1795
1839
|
refundDestination: InstantLoanAccount;
|
|
1796
|
-
/**
|
|
1797
|
-
|
|
1798
|
-
/**
|
|
1799
|
-
repayTarget: SupplyTarget;
|
|
1800
|
-
/** Current actionable repayment quote. */
|
|
1840
|
+
/** Current actionable initial collateral deposit quote. */
|
|
1841
|
+
initialDeposit: InstantLoanInitialDeposit;
|
|
1842
|
+
/** Current repayment quote. Amount fields are zero when the loan has no debt. */
|
|
1801
1843
|
repayment: InstantLoanRepayment;
|
|
1802
1844
|
/** Current lending position state for the generated profile. */
|
|
1803
1845
|
position: InstantLoanPositionSummary;
|
|
@@ -1825,8 +1867,8 @@ interface InstantLoanCandidate {
|
|
|
1825
1867
|
collateralAsset: MarketAsset;
|
|
1826
1868
|
/** Borrow asset symbol. */
|
|
1827
1869
|
borrowAsset: MarketAsset;
|
|
1828
|
-
/** Collateral amount
|
|
1829
|
-
|
|
1870
|
+
/** Collateral amount in base units. */
|
|
1871
|
+
collateralAmount: bigint;
|
|
1830
1872
|
}
|
|
1831
1873
|
|
|
1832
1874
|
/** Accountless instant-loan creation, lookup, recovery, and canister query helpers. */
|
|
@@ -1838,7 +1880,7 @@ declare class InstantLoansModule {
|
|
|
1838
1880
|
constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, lending: LendingModule, positions: PositionsModule);
|
|
1839
1881
|
/**
|
|
1840
1882
|
* Creates a profileless instant loan and returns canonical canister state plus
|
|
1841
|
-
* deposit
|
|
1883
|
+
* generated initial-deposit and repayment quote targets.
|
|
1842
1884
|
*
|
|
1843
1885
|
* Choose `collateralPoolId` and `borrowPoolId` from
|
|
1844
1886
|
* `client.market.listPools()`, convert UI amounts to base units with the
|
|
@@ -1851,7 +1893,7 @@ declare class InstantLoansModule {
|
|
|
1851
1893
|
* SDK maps it to the canister's internal `ltv_timer_s` field.
|
|
1852
1894
|
*
|
|
1853
1895
|
* @param request - Pool ids, assets, base-unit amounts, LTV limit, timeout, and destinations.
|
|
1854
|
-
* @returns Hydrated loan state plus generated deposit and repayment targets.
|
|
1896
|
+
* @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
|
|
1855
1897
|
*/
|
|
1856
1898
|
create(request: CreateInstantLoanRequest): Promise<InstantLoan>;
|
|
1857
1899
|
/**
|
|
@@ -1861,7 +1903,7 @@ declare class InstantLoansModule {
|
|
|
1861
1903
|
* from the instant-loans canister.
|
|
1862
1904
|
*
|
|
1863
1905
|
* @param request - Canister loan id or short public reference.
|
|
1864
|
-
* @returns Hydrated loan state plus generated deposit and repayment targets.
|
|
1906
|
+
* @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
|
|
1865
1907
|
*/
|
|
1866
1908
|
get(request: InstantLoanGetRequest): Promise<InstantLoan>;
|
|
1867
1909
|
/**
|
|
@@ -1914,8 +1956,10 @@ declare class InstantLoansModule {
|
|
|
1914
1956
|
*/
|
|
1915
1957
|
findByAddress(address: string): Promise<InstantLoanCandidate[]>;
|
|
1916
1958
|
private mapLoanRecord;
|
|
1959
|
+
private getCollateralAmountHint;
|
|
1917
1960
|
private mapLoanWire;
|
|
1918
1961
|
private hydrateLoan;
|
|
1962
|
+
private createInitialDepositQuote;
|
|
1919
1963
|
private estimateRepaymentInflowFee;
|
|
1920
1964
|
private requireApi;
|
|
1921
1965
|
private validateInstantLoanLtvPolicy;
|
|
@@ -2213,4 +2257,4 @@ interface ExecuteWithOptions {
|
|
|
2213
2257
|
*/
|
|
2214
2258
|
declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
|
|
2215
2259
|
|
|
2216
|
-
export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateProfileParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type FindPoolQuery, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, HistoryModule, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanAuthorization, type InstantLoanCandidate, type InstantLoanConfig, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanGetRequest, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesRequest, type LtvCalculation, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, PositionsModule, type PrepareCreateProfileOptions, QuoteModule, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendBtcTransactionRequest, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WalletExecutionParams, type WalletTransferSupplyFlowRequest, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };
|
|
2260
|
+
export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateProfileParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type FindPoolQuery, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, HistoryModule, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanAuthorization, type InstantLoanBorrow, type InstantLoanCandidate, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesRequest, type LtvCalculation, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, PositionsModule, type PrepareCreateProfileOptions, QuoteModule, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendBtcTransactionRequest, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WalletExecutionParams, type WalletTransferSupplyFlowRequest, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };
|