@gearbox-protocol/sdk 14.12.0-next.20 → 14.12.0-next.22
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.
|
@@ -783,10 +783,16 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
783
783
|
async previewDelayedWithdrawal({
|
|
784
784
|
creditAccount,
|
|
785
785
|
amount,
|
|
786
|
-
token
|
|
786
|
+
token,
|
|
787
|
+
intent
|
|
787
788
|
}) {
|
|
788
789
|
const compressor = this.sdk.withdrawalCompressor();
|
|
789
|
-
return compressor.getWithdrawalRequestResult(
|
|
790
|
+
return compressor.getWithdrawalRequestResult(
|
|
791
|
+
creditAccount,
|
|
792
|
+
token,
|
|
793
|
+
amount,
|
|
794
|
+
intent
|
|
795
|
+
);
|
|
790
796
|
}
|
|
791
797
|
/**
|
|
792
798
|
* {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
|
|
@@ -802,17 +808,12 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
802
808
|
};
|
|
803
809
|
}
|
|
804
810
|
/**
|
|
805
|
-
* {@inheritDoc ICreditAccountsService.
|
|
811
|
+
* {@inheritDoc ICreditAccountsService.assembleStartDelayedWithdrawalCalls}
|
|
806
812
|
**/
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
minQuota,
|
|
810
|
-
averageQuota,
|
|
813
|
+
assembleStartDelayedWithdrawalCalls({
|
|
814
|
+
creditFacade,
|
|
811
815
|
preview
|
|
812
816
|
}) {
|
|
813
|
-
const cm = this.sdk.marketRegister.findCreditManager(
|
|
814
|
-
creditAccount.creditManager
|
|
815
|
-
);
|
|
816
817
|
const record = preview.outputs.reduce((acc, o) => {
|
|
817
818
|
const token = o.token.toLowerCase();
|
|
818
819
|
acc[token] = (acc[token] || 0n) + o.amount;
|
|
@@ -820,7 +821,7 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
820
821
|
}, {});
|
|
821
822
|
const balances = Object.entries(record).filter(([, a]) => a > 10n);
|
|
822
823
|
const storeExpectedBalances = {
|
|
823
|
-
target:
|
|
824
|
+
target: creditFacade,
|
|
824
825
|
callData: (0, import_viem.encodeFunctionData)({
|
|
825
826
|
abi: import_generated.iCreditFacadeMulticallV310Abi,
|
|
826
827
|
functionName: "storeExpectedBalances",
|
|
@@ -833,43 +834,22 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
833
834
|
})
|
|
834
835
|
};
|
|
835
836
|
const compareBalances = {
|
|
836
|
-
target:
|
|
837
|
+
target: creditFacade,
|
|
837
838
|
callData: (0, import_viem.encodeFunctionData)({
|
|
838
839
|
abi: import_generated.iCreditFacadeMulticallV310Abi,
|
|
839
840
|
functionName: "compareBalances",
|
|
840
841
|
args: []
|
|
841
842
|
})
|
|
842
843
|
};
|
|
843
|
-
|
|
844
|
-
storeExpectedBalances,
|
|
845
|
-
...preview.requestCalls,
|
|
846
|
-
compareBalances,
|
|
847
|
-
...this.#prepareUpdateQuotas(creditAccount.creditFacade, {
|
|
848
|
-
minQuota,
|
|
849
|
-
averageQuota
|
|
850
|
-
})
|
|
851
|
-
];
|
|
852
|
-
const calls = await this.#prependPriceUpdates(
|
|
853
|
-
creditAccount.creditManager,
|
|
854
|
-
operationCalls,
|
|
855
|
-
creditAccount
|
|
856
|
-
);
|
|
857
|
-
const tx = await this.#multicallTx(cm, creditAccount.creditAccount, calls);
|
|
858
|
-
return { tx, calls, creditFacade: cm.creditFacade };
|
|
844
|
+
return [storeExpectedBalances, ...preview.requestCalls, compareBalances];
|
|
859
845
|
}
|
|
860
846
|
/**
|
|
861
|
-
* {@inheritDoc ICreditAccountsService.
|
|
847
|
+
* {@inheritDoc ICreditAccountsService.assembleClaimDelayedCalls}
|
|
862
848
|
**/
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
minQuota,
|
|
866
|
-
averageQuota,
|
|
849
|
+
assembleClaimDelayedCalls({
|
|
850
|
+
creditFacade,
|
|
867
851
|
claimableNow
|
|
868
852
|
}) {
|
|
869
|
-
const zeroDebt = creditAccount.debt === 0n;
|
|
870
|
-
const cm = this.sdk.marketRegister.findCreditManager(
|
|
871
|
-
creditAccount.creditManager
|
|
872
|
-
);
|
|
873
853
|
const record = claimableNow.outputs.reduce(
|
|
874
854
|
(acc, o) => {
|
|
875
855
|
const token = o.token.toLowerCase();
|
|
@@ -880,7 +860,7 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
880
860
|
);
|
|
881
861
|
const balances = Object.entries(record).filter(([, a]) => a > 10n);
|
|
882
862
|
const storeExpectedBalances = {
|
|
883
|
-
target:
|
|
863
|
+
target: creditFacade,
|
|
884
864
|
callData: (0, import_viem.encodeFunctionData)({
|
|
885
865
|
abi: import_generated.iCreditFacadeMulticallV310Abi,
|
|
886
866
|
functionName: "storeExpectedBalances",
|
|
@@ -893,21 +873,67 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
893
873
|
})
|
|
894
874
|
};
|
|
895
875
|
const compareBalances = {
|
|
896
|
-
target:
|
|
876
|
+
target: creditFacade,
|
|
897
877
|
callData: (0, import_viem.encodeFunctionData)({
|
|
898
878
|
abi: import_generated.iCreditFacadeMulticallV310Abi,
|
|
899
879
|
functionName: "compareBalances",
|
|
900
880
|
args: []
|
|
901
881
|
})
|
|
902
882
|
};
|
|
903
|
-
|
|
883
|
+
return [storeExpectedBalances, ...claimableNow.claimCalls, compareBalances];
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* {@inheritDoc ICreditAccountsService.startDelayedWithdrawal}
|
|
887
|
+
**/
|
|
888
|
+
async startDelayedWithdrawal({
|
|
889
|
+
creditAccount,
|
|
890
|
+
minQuota,
|
|
891
|
+
averageQuota,
|
|
892
|
+
preview
|
|
893
|
+
}) {
|
|
894
|
+
const cm = this.sdk.marketRegister.findCreditManager(
|
|
895
|
+
creditAccount.creditManager
|
|
896
|
+
);
|
|
897
|
+
const operationCalls = [
|
|
898
|
+
...this.assembleStartDelayedWithdrawalCalls({
|
|
899
|
+
creditFacade: cm.creditFacade.address,
|
|
900
|
+
preview
|
|
901
|
+
}),
|
|
902
|
+
...this.#prepareUpdateQuotas(cm.creditFacade.address, {
|
|
903
|
+
minQuota,
|
|
904
|
+
averageQuota
|
|
905
|
+
})
|
|
906
|
+
];
|
|
907
|
+
const calls = await this.#prependPriceUpdates(
|
|
908
|
+
creditAccount.creditManager,
|
|
909
|
+
operationCalls,
|
|
910
|
+
creditAccount
|
|
911
|
+
);
|
|
912
|
+
const tx = await this.#multicallTx(cm, creditAccount.creditAccount, calls);
|
|
913
|
+
return { tx, calls, creditFacade: cm.creditFacade };
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* {@inheritDoc ICreditAccountsService.claimDelayed}
|
|
917
|
+
**/
|
|
918
|
+
async claimDelayed({
|
|
919
|
+
creditAccount,
|
|
920
|
+
minQuota,
|
|
921
|
+
averageQuota,
|
|
922
|
+
claimableNow
|
|
923
|
+
}) {
|
|
924
|
+
const zeroDebt = creditAccount.debt === 0n;
|
|
925
|
+
const cm = this.sdk.marketRegister.findCreditManager(
|
|
926
|
+
creditAccount.creditManager
|
|
927
|
+
);
|
|
928
|
+
const quotaCalls = zeroDebt ? [] : this.#prepareUpdateQuotas(cm.creditFacade.address, {
|
|
904
929
|
minQuota,
|
|
905
930
|
averageQuota
|
|
906
931
|
});
|
|
907
932
|
const operationCalls = [
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
933
|
+
...this.assembleClaimDelayedCalls({
|
|
934
|
+
creditFacade: cm.creditFacade.address,
|
|
935
|
+
claimableNow
|
|
936
|
+
}),
|
|
911
937
|
...quotaCalls
|
|
912
938
|
];
|
|
913
939
|
const calls = zeroDebt ? operationCalls : await this.#prependPriceUpdates(
|
|
@@ -1263,13 +1289,13 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
1263
1289
|
const operationCalls = [
|
|
1264
1290
|
...assetsToWithdraw.map(
|
|
1265
1291
|
(a) => this.#prepareWithdrawToken(
|
|
1266
|
-
|
|
1292
|
+
cm.creditFacade.address,
|
|
1267
1293
|
a.token,
|
|
1268
1294
|
a.balance,
|
|
1269
1295
|
to
|
|
1270
1296
|
)
|
|
1271
1297
|
),
|
|
1272
|
-
...this.#prepareUpdateQuotas(
|
|
1298
|
+
...this.#prepareUpdateQuotas(cm.creditFacade.address, {
|
|
1273
1299
|
minQuota,
|
|
1274
1300
|
averageQuota
|
|
1275
1301
|
})
|
|
@@ -779,10 +779,16 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
779
779
|
async previewDelayedWithdrawal({
|
|
780
780
|
creditAccount,
|
|
781
781
|
amount,
|
|
782
|
-
token
|
|
782
|
+
token,
|
|
783
|
+
intent
|
|
783
784
|
}) {
|
|
784
785
|
const compressor = this.sdk.withdrawalCompressor();
|
|
785
|
-
return compressor.getWithdrawalRequestResult(
|
|
786
|
+
return compressor.getWithdrawalRequestResult(
|
|
787
|
+
creditAccount,
|
|
788
|
+
token,
|
|
789
|
+
amount,
|
|
790
|
+
intent
|
|
791
|
+
);
|
|
786
792
|
}
|
|
787
793
|
/**
|
|
788
794
|
* {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
|
|
@@ -798,17 +804,12 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
798
804
|
};
|
|
799
805
|
}
|
|
800
806
|
/**
|
|
801
|
-
* {@inheritDoc ICreditAccountsService.
|
|
807
|
+
* {@inheritDoc ICreditAccountsService.assembleStartDelayedWithdrawalCalls}
|
|
802
808
|
**/
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
minQuota,
|
|
806
|
-
averageQuota,
|
|
809
|
+
assembleStartDelayedWithdrawalCalls({
|
|
810
|
+
creditFacade,
|
|
807
811
|
preview
|
|
808
812
|
}) {
|
|
809
|
-
const cm = this.sdk.marketRegister.findCreditManager(
|
|
810
|
-
creditAccount.creditManager
|
|
811
|
-
);
|
|
812
813
|
const record = preview.outputs.reduce((acc, o) => {
|
|
813
814
|
const token = o.token.toLowerCase();
|
|
814
815
|
acc[token] = (acc[token] || 0n) + o.amount;
|
|
@@ -816,7 +817,7 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
816
817
|
}, {});
|
|
817
818
|
const balances = Object.entries(record).filter(([, a]) => a > 10n);
|
|
818
819
|
const storeExpectedBalances = {
|
|
819
|
-
target:
|
|
820
|
+
target: creditFacade,
|
|
820
821
|
callData: encodeFunctionData({
|
|
821
822
|
abi: iCreditFacadeMulticallV310Abi,
|
|
822
823
|
functionName: "storeExpectedBalances",
|
|
@@ -829,43 +830,22 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
829
830
|
})
|
|
830
831
|
};
|
|
831
832
|
const compareBalances = {
|
|
832
|
-
target:
|
|
833
|
+
target: creditFacade,
|
|
833
834
|
callData: encodeFunctionData({
|
|
834
835
|
abi: iCreditFacadeMulticallV310Abi,
|
|
835
836
|
functionName: "compareBalances",
|
|
836
837
|
args: []
|
|
837
838
|
})
|
|
838
839
|
};
|
|
839
|
-
|
|
840
|
-
storeExpectedBalances,
|
|
841
|
-
...preview.requestCalls,
|
|
842
|
-
compareBalances,
|
|
843
|
-
...this.#prepareUpdateQuotas(creditAccount.creditFacade, {
|
|
844
|
-
minQuota,
|
|
845
|
-
averageQuota
|
|
846
|
-
})
|
|
847
|
-
];
|
|
848
|
-
const calls = await this.#prependPriceUpdates(
|
|
849
|
-
creditAccount.creditManager,
|
|
850
|
-
operationCalls,
|
|
851
|
-
creditAccount
|
|
852
|
-
);
|
|
853
|
-
const tx = await this.#multicallTx(cm, creditAccount.creditAccount, calls);
|
|
854
|
-
return { tx, calls, creditFacade: cm.creditFacade };
|
|
840
|
+
return [storeExpectedBalances, ...preview.requestCalls, compareBalances];
|
|
855
841
|
}
|
|
856
842
|
/**
|
|
857
|
-
* {@inheritDoc ICreditAccountsService.
|
|
843
|
+
* {@inheritDoc ICreditAccountsService.assembleClaimDelayedCalls}
|
|
858
844
|
**/
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
minQuota,
|
|
862
|
-
averageQuota,
|
|
845
|
+
assembleClaimDelayedCalls({
|
|
846
|
+
creditFacade,
|
|
863
847
|
claimableNow
|
|
864
848
|
}) {
|
|
865
|
-
const zeroDebt = creditAccount.debt === 0n;
|
|
866
|
-
const cm = this.sdk.marketRegister.findCreditManager(
|
|
867
|
-
creditAccount.creditManager
|
|
868
|
-
);
|
|
869
849
|
const record = claimableNow.outputs.reduce(
|
|
870
850
|
(acc, o) => {
|
|
871
851
|
const token = o.token.toLowerCase();
|
|
@@ -876,7 +856,7 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
876
856
|
);
|
|
877
857
|
const balances = Object.entries(record).filter(([, a]) => a > 10n);
|
|
878
858
|
const storeExpectedBalances = {
|
|
879
|
-
target:
|
|
859
|
+
target: creditFacade,
|
|
880
860
|
callData: encodeFunctionData({
|
|
881
861
|
abi: iCreditFacadeMulticallV310Abi,
|
|
882
862
|
functionName: "storeExpectedBalances",
|
|
@@ -889,21 +869,67 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
889
869
|
})
|
|
890
870
|
};
|
|
891
871
|
const compareBalances = {
|
|
892
|
-
target:
|
|
872
|
+
target: creditFacade,
|
|
893
873
|
callData: encodeFunctionData({
|
|
894
874
|
abi: iCreditFacadeMulticallV310Abi,
|
|
895
875
|
functionName: "compareBalances",
|
|
896
876
|
args: []
|
|
897
877
|
})
|
|
898
878
|
};
|
|
899
|
-
|
|
879
|
+
return [storeExpectedBalances, ...claimableNow.claimCalls, compareBalances];
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* {@inheritDoc ICreditAccountsService.startDelayedWithdrawal}
|
|
883
|
+
**/
|
|
884
|
+
async startDelayedWithdrawal({
|
|
885
|
+
creditAccount,
|
|
886
|
+
minQuota,
|
|
887
|
+
averageQuota,
|
|
888
|
+
preview
|
|
889
|
+
}) {
|
|
890
|
+
const cm = this.sdk.marketRegister.findCreditManager(
|
|
891
|
+
creditAccount.creditManager
|
|
892
|
+
);
|
|
893
|
+
const operationCalls = [
|
|
894
|
+
...this.assembleStartDelayedWithdrawalCalls({
|
|
895
|
+
creditFacade: cm.creditFacade.address,
|
|
896
|
+
preview
|
|
897
|
+
}),
|
|
898
|
+
...this.#prepareUpdateQuotas(cm.creditFacade.address, {
|
|
899
|
+
minQuota,
|
|
900
|
+
averageQuota
|
|
901
|
+
})
|
|
902
|
+
];
|
|
903
|
+
const calls = await this.#prependPriceUpdates(
|
|
904
|
+
creditAccount.creditManager,
|
|
905
|
+
operationCalls,
|
|
906
|
+
creditAccount
|
|
907
|
+
);
|
|
908
|
+
const tx = await this.#multicallTx(cm, creditAccount.creditAccount, calls);
|
|
909
|
+
return { tx, calls, creditFacade: cm.creditFacade };
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* {@inheritDoc ICreditAccountsService.claimDelayed}
|
|
913
|
+
**/
|
|
914
|
+
async claimDelayed({
|
|
915
|
+
creditAccount,
|
|
916
|
+
minQuota,
|
|
917
|
+
averageQuota,
|
|
918
|
+
claimableNow
|
|
919
|
+
}) {
|
|
920
|
+
const zeroDebt = creditAccount.debt === 0n;
|
|
921
|
+
const cm = this.sdk.marketRegister.findCreditManager(
|
|
922
|
+
creditAccount.creditManager
|
|
923
|
+
);
|
|
924
|
+
const quotaCalls = zeroDebt ? [] : this.#prepareUpdateQuotas(cm.creditFacade.address, {
|
|
900
925
|
minQuota,
|
|
901
926
|
averageQuota
|
|
902
927
|
});
|
|
903
928
|
const operationCalls = [
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
929
|
+
...this.assembleClaimDelayedCalls({
|
|
930
|
+
creditFacade: cm.creditFacade.address,
|
|
931
|
+
claimableNow
|
|
932
|
+
}),
|
|
907
933
|
...quotaCalls
|
|
908
934
|
];
|
|
909
935
|
const calls = zeroDebt ? operationCalls : await this.#prependPriceUpdates(
|
|
@@ -1259,13 +1285,13 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
1259
1285
|
const operationCalls = [
|
|
1260
1286
|
...assetsToWithdraw.map(
|
|
1261
1287
|
(a) => this.#prepareWithdrawToken(
|
|
1262
|
-
|
|
1288
|
+
cm.creditFacade.address,
|
|
1263
1289
|
a.token,
|
|
1264
1290
|
a.balance,
|
|
1265
1291
|
to
|
|
1266
1292
|
)
|
|
1267
1293
|
),
|
|
1268
|
-
...this.#prepareUpdateQuotas(
|
|
1294
|
+
...this.#prepareUpdateQuotas(cm.creditFacade.address, {
|
|
1269
1295
|
minQuota,
|
|
1270
1296
|
averageQuota
|
|
1271
1297
|
})
|
|
@@ -6,7 +6,7 @@ import type { RWAOpenAccountRequirements } from "../market/rwa/index.js";
|
|
|
6
6
|
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
7
7
|
import type { RouterCASlice } from "../router/index.js";
|
|
8
8
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
9
|
-
import type { AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, DefaultPartialLiquidationParams, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps } from "./types.js";
|
|
9
|
+
import type { AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, DefaultPartialLiquidationParams, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps } from "./types.js";
|
|
10
10
|
import type { RequestableWithdrawal } from "./withdrawal-compressor/index.js";
|
|
11
11
|
/**
|
|
12
12
|
* Options for configuring the credit account service.
|
|
@@ -94,11 +94,19 @@ export declare class CreditAccountsServiceV310 extends SDKConstruct implements I
|
|
|
94
94
|
/**
|
|
95
95
|
* {@inheritDoc ICreditAccountsService.previewDelayedWithdrawal}
|
|
96
96
|
**/
|
|
97
|
-
previewDelayedWithdrawal({ creditAccount, amount, token, }: PreviewDelayedWithdrawalProps): Promise<RequestableWithdrawal>;
|
|
97
|
+
previewDelayedWithdrawal({ creditAccount, amount, token, intent, }: PreviewDelayedWithdrawalProps): Promise<RequestableWithdrawal>;
|
|
98
98
|
/**
|
|
99
99
|
* {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
|
|
100
100
|
**/
|
|
101
101
|
getPendingWithdrawals({ creditAccount, }: GetPendingWithdrawalsProps): Promise<GetPendingWithdrawalsResult>;
|
|
102
|
+
/**
|
|
103
|
+
* {@inheritDoc ICreditAccountsService.assembleStartDelayedWithdrawalCalls}
|
|
104
|
+
**/
|
|
105
|
+
assembleStartDelayedWithdrawalCalls({ creditFacade, preview, }: AssembleStartDelayedWithdrawalCallsProps): Array<MultiCall>;
|
|
106
|
+
/**
|
|
107
|
+
* {@inheritDoc ICreditAccountsService.assembleClaimDelayedCalls}
|
|
108
|
+
**/
|
|
109
|
+
assembleClaimDelayedCalls({ creditFacade, claimableNow, }: AssembleClaimDelayedCallsProps): Array<MultiCall>;
|
|
102
110
|
/**
|
|
103
111
|
* {@inheritDoc ICreditAccountsService.startDelayedWithdrawal}
|
|
104
112
|
**/
|
|
@@ -6,7 +6,7 @@ import type { RWAOpenAccountRequirements } from "../market/rwa/index.js";
|
|
|
6
6
|
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
7
7
|
import type { RouterCASlice, RouterCloseResult } from "../router/index.js";
|
|
8
8
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
9
|
-
import type { ClaimableWithdrawal, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/index.js";
|
|
9
|
+
import type { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/index.js";
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
* Arguments tuple for the credit account compressor's `getCreditAccounts` view method.
|
|
@@ -340,6 +340,7 @@ export interface PreviewDelayedWithdrawalProps {
|
|
|
340
340
|
* Minimal credit account data on which operation is performed
|
|
341
341
|
*/
|
|
342
342
|
creditAccount: Address;
|
|
343
|
+
intent?: DelayedIntent;
|
|
343
344
|
}
|
|
344
345
|
export interface GetPendingWithdrawalsProps {
|
|
345
346
|
/**
|
|
@@ -360,6 +361,32 @@ export interface GetPendingWithdrawalsResult {
|
|
|
360
361
|
**/
|
|
361
362
|
pending: Array<PendingWithdrawal>;
|
|
362
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* Input for {@link ICreditAccountsService.assembleStartDelayedWithdrawalCalls}.
|
|
366
|
+
*/
|
|
367
|
+
export type AssembleStartDelayedWithdrawalCallsProps = {
|
|
368
|
+
/**
|
|
369
|
+
* Credit facade that receives `storeExpectedBalances` / `compareBalances`.
|
|
370
|
+
*/
|
|
371
|
+
creditFacade: Address;
|
|
372
|
+
/**
|
|
373
|
+
* Withdrawal preview: `outputs` for expected balances, `requestCalls` for the body.
|
|
374
|
+
*/
|
|
375
|
+
preview: Pick<RequestableWithdrawal, "outputs" | "requestCalls">;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Input for {@link ICreditAccountsService.assembleClaimDelayedCalls}.
|
|
379
|
+
*/
|
|
380
|
+
export type AssembleClaimDelayedCallsProps = {
|
|
381
|
+
/**
|
|
382
|
+
* Credit facade that receives `storeExpectedBalances` / `compareBalances`.
|
|
383
|
+
*/
|
|
384
|
+
creditFacade: Address;
|
|
385
|
+
/**
|
|
386
|
+
* Claimable withdrawal: `outputs` for expected balances, `claimCalls` for the body.
|
|
387
|
+
*/
|
|
388
|
+
claimableNow: Pick<ClaimableWithdrawal, "outputs" | "claimCalls">;
|
|
389
|
+
};
|
|
363
390
|
export interface StartDelayedWithdrawalProps extends PrepareUpdateQuotasProps {
|
|
364
391
|
/**
|
|
365
392
|
* Withdrawal preview
|
|
@@ -871,6 +898,34 @@ export interface ICreditAccountsService extends Construct {
|
|
|
871
898
|
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
872
899
|
*/
|
|
873
900
|
startDelayedWithdrawal(props: StartDelayedWithdrawalProps): Promise<CreditAccountOperationResult>;
|
|
901
|
+
/**
|
|
902
|
+
* Builds start-delayed-withdrawal multicall calls without price feed updates
|
|
903
|
+
* or quota updates.
|
|
904
|
+
*
|
|
905
|
+
* Same balance bracket as {@link startDelayedWithdrawal}:
|
|
906
|
+
* `storeExpectedBalances` → `preview.requestCalls` → `compareBalances`.
|
|
907
|
+
*
|
|
908
|
+
* Does not prepend price updates and does not build the facade transaction.
|
|
909
|
+
*
|
|
910
|
+
* @param props - {@link AssembleStartDelayedWithdrawalCallsProps}
|
|
911
|
+
* @returns Raw facade multicall payload for the delayed-withdrawal request
|
|
912
|
+
*/
|
|
913
|
+
assembleStartDelayedWithdrawalCalls(props: AssembleStartDelayedWithdrawalCallsProps): Array<MultiCall>;
|
|
914
|
+
/**
|
|
915
|
+
* Builds claim-delayed-withdrawal multicall calls without price feed updates
|
|
916
|
+
* or quota updates.
|
|
917
|
+
*
|
|
918
|
+
* Same balance bracket as {@link claimDelayed}:
|
|
919
|
+
* `storeExpectedBalances` → `claimableNow.claimCalls` → `compareBalances`.
|
|
920
|
+
*
|
|
921
|
+
* Does not prepend price updates, does not update quotas, and does not build
|
|
922
|
+
* the facade transaction. Use for resume / intent assembly where claim is
|
|
923
|
+
* followed by other ops and quotas/prices are applied separately.
|
|
924
|
+
*
|
|
925
|
+
* @param props - {@link AssembleClaimDelayedCallsProps}
|
|
926
|
+
* @returns Raw facade multicall payload for the claim
|
|
927
|
+
*/
|
|
928
|
+
assembleClaimDelayedCalls(props: AssembleClaimDelayedCallsProps): Array<MultiCall>;
|
|
874
929
|
/**
|
|
875
930
|
* Preview delayed withdrawal for given token
|
|
876
931
|
* @param props - {@link PreviewDelayedWithdrawalProps}
|
|
@@ -977,9 +1032,11 @@ export interface ICreditAccountsService extends Construct {
|
|
|
977
1032
|
* Each operation must already carry concrete encoding data (e.g. swap/wrap
|
|
978
1033
|
* `calls`). Unknown operation types throw.
|
|
979
1034
|
*
|
|
980
|
-
* Does not handle close or
|
|
981
|
-
* {@link ICreditAccountsService.assembleCloseCreditAccountCalls} /
|
|
982
|
-
* {@link ICreditAccountsService.assembleRepayCreditAccountCalls}
|
|
1035
|
+
* Does not handle close, repay, start delayed withdrawal, or claim delayed —
|
|
1036
|
+
* use {@link ICreditAccountsService.assembleCloseCreditAccountCalls} /
|
|
1037
|
+
* {@link ICreditAccountsService.assembleRepayCreditAccountCalls} /
|
|
1038
|
+
* {@link ICreditAccountsService.assembleStartDelayedWithdrawalCalls} /
|
|
1039
|
+
* {@link ICreditAccountsService.assembleClaimDelayedCalls}.
|
|
983
1040
|
*
|
|
984
1041
|
* @param props - Encodable operations and account context
|
|
985
1042
|
* @returns Array of facade / adapter multicall calls (without price feed updates)
|