@compass-labs/api-sdk 2.2.29-rc.0 → 2.2.29-rc.1
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 +2 -2
- package/dist/commonjs/funcs/creditCreditBundle.d.ts +1 -1
- package/dist/commonjs/funcs/creditCreditBundle.js +1 -1
- package/dist/commonjs/models/components/approvetransferresponse.d.ts +8 -2
- package/dist/commonjs/models/components/approvetransferresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/approvetransferresponse.js +2 -2
- package/dist/commonjs/models/components/approvetransferresponse.js.map +1 -1
- package/dist/commonjs/models/components/creditborrowrequest.d.ts +10 -10
- package/dist/commonjs/models/components/creditborrowrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditborrowrequest.js +3 -3
- package/dist/commonjs/models/components/creditborrowrequest.js.map +1 -1
- package/dist/commonjs/models/components/creditrepayrequest.d.ts +7 -7
- package/dist/commonjs/models/components/creditrepayrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditrepayrequest.js +2 -2
- package/dist/commonjs/models/components/creditrepayrequest.js.map +1 -1
- package/dist/commonjs/models/components/credittransfertoaddressparams.d.ts +44 -0
- package/dist/commonjs/models/components/credittransfertoaddressparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/credittransfertoaddressparams.js +63 -0
- package/dist/commonjs/models/components/credittransfertoaddressparams.js.map +1 -0
- package/dist/commonjs/models/components/credituseroperation.d.ts +5 -4
- package/dist/commonjs/models/components/credituseroperation.d.ts.map +1 -1
- package/dist/commonjs/models/components/credituseroperation.js +3 -0
- package/dist/commonjs/models/components/credituseroperation.js.map +1 -1
- package/dist/commonjs/models/components/depositforburnresponse.d.ts +8 -2
- package/dist/commonjs/models/components/depositforburnresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/depositforburnresponse.js +3 -2
- package/dist/commonjs/models/components/depositforburnresponse.js.map +1 -1
- package/dist/commonjs/models/components/earnmanageresponse.d.ts +8 -2
- package/dist/commonjs/models/components/earnmanageresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/earnmanageresponse.js +3 -2
- package/dist/commonjs/models/components/earnmanageresponse.js.map +1 -1
- package/dist/commonjs/models/components/earnswapresponse.d.ts +11 -2
- package/dist/commonjs/models/components/earnswapresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/earnswapresponse.js +3 -2
- package/dist/commonjs/models/components/earnswapresponse.js.map +1 -1
- package/dist/commonjs/models/components/earntransferresponse.d.ts +11 -2
- package/dist/commonjs/models/components/earntransferresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/earntransferresponse.js +2 -2
- package/dist/commonjs/models/components/earntransferresponse.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/sdk/credit.d.ts +1 -1
- package/dist/commonjs/sdk/credit.js +1 -1
- package/dist/esm/funcs/creditCreditBundle.d.ts +1 -1
- package/dist/esm/funcs/creditCreditBundle.js +1 -1
- package/dist/esm/models/components/approvetransferresponse.d.ts +8 -2
- package/dist/esm/models/components/approvetransferresponse.d.ts.map +1 -1
- package/dist/esm/models/components/approvetransferresponse.js +2 -2
- package/dist/esm/models/components/approvetransferresponse.js.map +1 -1
- package/dist/esm/models/components/creditborrowrequest.d.ts +10 -10
- package/dist/esm/models/components/creditborrowrequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditborrowrequest.js +3 -3
- package/dist/esm/models/components/creditborrowrequest.js.map +1 -1
- package/dist/esm/models/components/creditrepayrequest.d.ts +7 -7
- package/dist/esm/models/components/creditrepayrequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditrepayrequest.js +2 -2
- package/dist/esm/models/components/creditrepayrequest.js.map +1 -1
- package/dist/esm/models/components/credittransfertoaddressparams.d.ts +44 -0
- package/dist/esm/models/components/credittransfertoaddressparams.d.ts.map +1 -0
- package/dist/esm/models/components/credittransfertoaddressparams.js +25 -0
- package/dist/esm/models/components/credittransfertoaddressparams.js.map +1 -0
- package/dist/esm/models/components/credituseroperation.d.ts +5 -4
- package/dist/esm/models/components/credituseroperation.d.ts.map +1 -1
- package/dist/esm/models/components/credituseroperation.js +3 -0
- package/dist/esm/models/components/credituseroperation.js.map +1 -1
- package/dist/esm/models/components/depositforburnresponse.d.ts +8 -2
- package/dist/esm/models/components/depositforburnresponse.d.ts.map +1 -1
- package/dist/esm/models/components/depositforburnresponse.js +3 -2
- package/dist/esm/models/components/depositforburnresponse.js.map +1 -1
- package/dist/esm/models/components/earnmanageresponse.d.ts +8 -2
- package/dist/esm/models/components/earnmanageresponse.d.ts.map +1 -1
- package/dist/esm/models/components/earnmanageresponse.js +3 -2
- package/dist/esm/models/components/earnmanageresponse.js.map +1 -1
- package/dist/esm/models/components/earnswapresponse.d.ts +11 -2
- package/dist/esm/models/components/earnswapresponse.d.ts.map +1 -1
- package/dist/esm/models/components/earnswapresponse.js +3 -2
- package/dist/esm/models/components/earnswapresponse.js.map +1 -1
- package/dist/esm/models/components/earntransferresponse.d.ts +11 -2
- package/dist/esm/models/components/earntransferresponse.d.ts.map +1 -1
- package/dist/esm/models/components/earntransferresponse.js +2 -2
- package/dist/esm/models/components/earntransferresponse.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/sdk/credit.d.ts +1 -1
- package/dist/esm/sdk/credit.js +1 -1
- package/docs/models/components/approvetransferresponse.md +3 -40
- package/docs/models/components/creditborrowrequest.md +3 -3
- package/docs/models/components/creditborrowrequestamountin.md +1 -1
- package/docs/models/components/creditrepayrequest.md +2 -2
- package/docs/models/components/credittransfertoaddressparams.md +28 -0
- package/docs/models/components/credittransfertoaddressparamsamount.md +19 -0
- package/docs/models/components/credituseroperationbody.md +11 -0
- package/docs/models/components/depositforburnresponse.md +3 -37
- package/docs/models/components/earnmanageresponse.md +3 -16
- package/docs/models/components/earnswapresponse.md +3 -37
- package/docs/models/components/earntransferresponse.md +4 -15
- package/docs/models/components/earntransferresponseeip712.md +2 -0
- package/docs/models/components/permittypeddataresponseoutput.md +7 -2
- package/docs/models/components/withdrawamount.md +1 -1
- package/docs/sdks/credit/README.md +1 -1
- package/package.json +1 -1
- package/src/funcs/creditCreditBundle.ts +1 -1
- package/src/models/components/approvetransferresponse.ts +10 -4
- package/src/models/components/creditborrowrequest.ts +13 -13
- package/src/models/components/creditrepayrequest.ts +9 -9
- package/src/models/components/credittransfertoaddressparams.ts +89 -0
- package/src/models/components/credituseroperation.ts +11 -0
- package/src/models/components/depositforburnresponse.ts +11 -4
- package/src/models/components/earnmanageresponse.ts +11 -4
- package/src/models/components/earnswapresponse.ts +14 -4
- package/src/models/components/earntransferresponse.ts +17 -4
- package/src/models/components/index.ts +1 -0
- package/src/sdk/credit.ts +1 -1
|
@@ -6,40 +6,6 @@
|
|
|
6
6
|
import { EarnSwapResponse } from "@compass-labs/api-sdk/models/components";
|
|
7
7
|
|
|
8
8
|
let value: EarnSwapResponse = {
|
|
9
|
-
transaction: {
|
|
10
|
-
chainId: "<id>",
|
|
11
|
-
data: "<value>",
|
|
12
|
-
from: "<value>",
|
|
13
|
-
gas: "<value>",
|
|
14
|
-
to: "<value>",
|
|
15
|
-
value: "<value>",
|
|
16
|
-
nonce: "<value>",
|
|
17
|
-
maxFeePerGas: "<value>",
|
|
18
|
-
maxPriorityFeePerGas: "<value>",
|
|
19
|
-
},
|
|
20
|
-
eip712: {
|
|
21
|
-
domain: {
|
|
22
|
-
chainId: 359509,
|
|
23
|
-
verifyingContract: "<value>",
|
|
24
|
-
},
|
|
25
|
-
types: {
|
|
26
|
-
eip712Domain: [],
|
|
27
|
-
safeTx: [],
|
|
28
|
-
},
|
|
29
|
-
primaryType: "SafeTx",
|
|
30
|
-
message: {
|
|
31
|
-
to: "<value>",
|
|
32
|
-
value: "<value>",
|
|
33
|
-
data: "<value>",
|
|
34
|
-
operation: 0,
|
|
35
|
-
safeTxGas: "<value>",
|
|
36
|
-
baseGas: "<value>",
|
|
37
|
-
gasPrice: "<value>",
|
|
38
|
-
gasToken: "<value>",
|
|
39
|
-
refundReceiver: "<value>",
|
|
40
|
-
nonce: "<value>",
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
9
|
estimatedAmountOut: "<value>",
|
|
44
10
|
};
|
|
45
11
|
```
|
|
@@ -48,6 +14,6 @@ let value: EarnSwapResponse = {
|
|
|
48
14
|
|
|
49
15
|
| Field | Type | Required | Description |
|
|
50
16
|
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
51
|
-
| `transaction` | [components.UnsignedTransaction](../../models/components/unsignedtransaction.md) | :
|
|
52
|
-
| `eip712` | [components.BatchedSafeOperationsResponseOutput](../../models/components/batchedsafeoperationsresponseoutput.md) | :
|
|
53
|
-
| `estimatedAmountOut` | *string* | :heavy_check_mark: |
|
|
17
|
+
| `transaction` | [components.UnsignedTransaction](../../models/components/unsignedtransaction.md) | :heavy_minus_sign: | Unsigned transaction for direct execution. Present when gas_sponsorship=false. |
|
|
18
|
+
| `eip712` | [components.BatchedSafeOperationsResponseOutput](../../models/components/batchedsafeoperationsresponseoutput.md) | :heavy_minus_sign: | EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. |
|
|
19
|
+
| `estimatedAmountOut` | *string* | :heavy_check_mark: | Estimated amount of output token received from the swap. |
|
|
@@ -6,17 +6,6 @@
|
|
|
6
6
|
import { EarnTransferResponse } from "@compass-labs/api-sdk/models/components";
|
|
7
7
|
|
|
8
8
|
let value: EarnTransferResponse = {
|
|
9
|
-
transaction: {
|
|
10
|
-
chainId: "<id>",
|
|
11
|
-
data: "<value>",
|
|
12
|
-
from: "<value>",
|
|
13
|
-
gas: "<value>",
|
|
14
|
-
to: "<value>",
|
|
15
|
-
value: "<value>",
|
|
16
|
-
nonce: "<value>",
|
|
17
|
-
maxFeePerGas: "<value>",
|
|
18
|
-
maxPriorityFeePerGas: "<value>",
|
|
19
|
-
},
|
|
20
9
|
eip712: {
|
|
21
10
|
domain: {
|
|
22
11
|
chainId: 359509,
|
|
@@ -45,7 +34,7 @@ let value: EarnTransferResponse = {
|
|
|
45
34
|
|
|
46
35
|
## Fields
|
|
47
36
|
|
|
48
|
-
| Field
|
|
49
|
-
|
|
|
50
|
-
| `transaction`
|
|
51
|
-
| `eip712`
|
|
37
|
+
| Field | Type | Required | Description |
|
|
38
|
+
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
39
|
+
| `transaction` | [components.UnsignedTransaction](../../models/components/unsignedtransaction.md) | :heavy_minus_sign: | Unsigned transaction for direct execution. Present when gas_sponsorship=false. |
|
|
40
|
+
| `eip712` | *components.EarnTransferResponseEip712* | :heavy_minus_sign: | EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. |
|
|
@@ -11,7 +11,7 @@ let value: PermitTypedDataResponseOutput = {
|
|
|
11
11
|
domain: {
|
|
12
12
|
name: "<value>",
|
|
13
13
|
version: "<value>",
|
|
14
|
-
chainId:
|
|
14
|
+
chainId: 499115,
|
|
15
15
|
verifyingContract: "<value>",
|
|
16
16
|
},
|
|
17
17
|
types: {
|
|
@@ -21,7 +21,12 @@ let value: PermitTypedDataResponseOutput = {
|
|
|
21
21
|
type: "<value>",
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
|
-
permit: [
|
|
24
|
+
permit: [
|
|
25
|
+
{
|
|
26
|
+
name: "<value>",
|
|
27
|
+
type: "<value>",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
25
30
|
},
|
|
26
31
|
primaryType: "Permit",
|
|
27
32
|
message: {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* [creditBorrow](#creditborrow) - Borrow against collateral
|
|
10
10
|
* [creditTransfer](#credittransfer) - Transfer tokens to/from Credit Account
|
|
11
11
|
* [creditRepay](#creditrepay) - Repay debt and withdraw collateral
|
|
12
|
-
* [creditBundle](#creditbundle) - Execute multiple credit actions
|
|
12
|
+
* [creditBundle](#creditbundle) - Execute multiple credit actions
|
|
13
13
|
|
|
14
14
|
## creditPositions
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ import { APICall, APIPromise } from "../types/async.js";
|
|
|
26
26
|
import { Result } from "../types/fp.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Execute multiple credit actions
|
|
29
|
+
* Execute multiple credit actions
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* Compose individual credit operations (supply, withdraw, borrow, repay, swap, transfer)
|
|
@@ -17,8 +17,14 @@ import {
|
|
|
17
17
|
} from "./unsignedtransaction.js";
|
|
18
18
|
|
|
19
19
|
export type ApproveTransferResponse = {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Unsigned approval transaction. Present when gas_sponsorship=false.
|
|
22
|
+
*/
|
|
23
|
+
transaction?: UnsignedTransaction | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* EIP-712 typed data for off-chain permit signing. Present when gas_sponsorship=true.
|
|
26
|
+
*/
|
|
27
|
+
eip712?: PermitTypedDataResponseOutput | null | undefined;
|
|
22
28
|
};
|
|
23
29
|
|
|
24
30
|
/** @internal */
|
|
@@ -27,8 +33,8 @@ export const ApproveTransferResponse$inboundSchema: z.ZodType<
|
|
|
27
33
|
z.ZodTypeDef,
|
|
28
34
|
unknown
|
|
29
35
|
> = z.object({
|
|
30
|
-
transaction: z.nullable(UnsignedTransaction$inboundSchema),
|
|
31
|
-
eip_712: z.nullable(PermitTypedDataResponseOutput$inboundSchema),
|
|
36
|
+
transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
|
|
37
|
+
eip_712: z.nullable(PermitTypedDataResponseOutput$inboundSchema).optional(),
|
|
32
38
|
}).transform((v) => {
|
|
33
39
|
return remap$(v, {
|
|
34
40
|
"eip_712": "eip712",
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./interestratemode.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Amount of token_in to use (in token units, not wei).
|
|
14
|
+
* Amount of token_in to use (in token units, not wei). Omit together with token_in and collateral_token for borrow-only mode.
|
|
15
15
|
*/
|
|
16
16
|
export type CreditBorrowRequestAmountIn = number | string;
|
|
17
17
|
|
|
@@ -35,17 +35,17 @@ export type CreditBorrowRequest = {
|
|
|
35
35
|
*/
|
|
36
36
|
chain: Chain;
|
|
37
37
|
/**
|
|
38
|
-
* Token currently held in the Credit Account to use as input. If the same as collateral_token, no swap is performed.
|
|
38
|
+
* Token currently held in the Credit Account to use as input. If the same as collateral_token, no swap is performed. Omit together with amount_in and collateral_token to borrow against existing collateral.
|
|
39
39
|
*/
|
|
40
|
-
tokenIn
|
|
40
|
+
tokenIn?: string | null | undefined;
|
|
41
41
|
/**
|
|
42
|
-
* Amount of token_in to use (in token units, not wei).
|
|
42
|
+
* Amount of token_in to use (in token units, not wei). Omit together with token_in and collateral_token for borrow-only mode.
|
|
43
43
|
*/
|
|
44
|
-
amountIn
|
|
44
|
+
amountIn?: number | string | null | undefined;
|
|
45
45
|
/**
|
|
46
|
-
* Aave reserve token to supply as collateral.
|
|
46
|
+
* Aave reserve token to supply as collateral. Omit together with token_in and amount_in for borrow-only mode.
|
|
47
47
|
*/
|
|
48
|
-
collateralToken
|
|
48
|
+
collateralToken?: string | null | undefined;
|
|
49
49
|
/**
|
|
50
50
|
* Asset to borrow from Aave.
|
|
51
51
|
*/
|
|
@@ -142,9 +142,9 @@ export function creditBorrowRequestSlippageToJSON(
|
|
|
142
142
|
export type CreditBorrowRequest$Outbound = {
|
|
143
143
|
owner: string;
|
|
144
144
|
chain: string;
|
|
145
|
-
token_in
|
|
146
|
-
amount_in
|
|
147
|
-
collateral_token
|
|
145
|
+
token_in?: string | null | undefined;
|
|
146
|
+
amount_in?: number | string | null | undefined;
|
|
147
|
+
collateral_token?: string | null | undefined;
|
|
148
148
|
borrow_token: string;
|
|
149
149
|
borrow_amount: number | string;
|
|
150
150
|
interest_rate_mode?: string | undefined;
|
|
@@ -163,9 +163,9 @@ export const CreditBorrowRequest$outboundSchema: z.ZodType<
|
|
|
163
163
|
> = z.object({
|
|
164
164
|
owner: z.string(),
|
|
165
165
|
chain: Chain$outboundSchema,
|
|
166
|
-
tokenIn: z.string(),
|
|
167
|
-
amountIn: z.union([z.number(), z.string()]),
|
|
168
|
-
collateralToken: z.string(),
|
|
166
|
+
tokenIn: z.nullable(z.string()).optional(),
|
|
167
|
+
amountIn: z.nullable(z.union([z.number(), z.string()])).optional(),
|
|
168
|
+
collateralToken: z.nullable(z.string()).optional(),
|
|
169
169
|
borrowToken: z.string(),
|
|
170
170
|
borrowAmount: z.union([z.number(), z.string()]),
|
|
171
171
|
interestRateMode: InterestRateMode$outboundSchema.optional(),
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
export type RepayAmount = number | string;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Amount of collateral to withdraw (in token units, not wei).
|
|
19
|
+
* Amount of collateral to withdraw (in token units, not wei). Omit together with withdraw_token for repay-only mode.
|
|
20
20
|
*/
|
|
21
21
|
export type WithdrawAmount = number | string;
|
|
22
22
|
|
|
@@ -51,13 +51,13 @@ export type CreditRepayRequest = {
|
|
|
51
51
|
*/
|
|
52
52
|
interestRateMode?: InterestRateMode | undefined;
|
|
53
53
|
/**
|
|
54
|
-
* Collateral token to withdraw from Aave after repaying debt.
|
|
54
|
+
* Collateral token to withdraw from Aave after repaying debt. Omit together with withdraw_amount for repay-only mode.
|
|
55
55
|
*/
|
|
56
|
-
withdrawToken
|
|
56
|
+
withdrawToken?: string | null | undefined;
|
|
57
57
|
/**
|
|
58
|
-
* Amount of collateral to withdraw (in token units, not wei).
|
|
58
|
+
* Amount of collateral to withdraw (in token units, not wei). Omit together with withdraw_token for repay-only mode.
|
|
59
59
|
*/
|
|
60
|
-
withdrawAmount
|
|
60
|
+
withdrawAmount?: number | string | null | undefined;
|
|
61
61
|
/**
|
|
62
62
|
* Desired output token. If different from withdraw_token, a swap is performed after withdrawal. If None, the withdrawn collateral is kept as-is.
|
|
63
63
|
*/
|
|
@@ -137,8 +137,8 @@ export type CreditRepayRequest$Outbound = {
|
|
|
137
137
|
repay_token: string;
|
|
138
138
|
repay_amount: number | string;
|
|
139
139
|
interest_rate_mode?: string | undefined;
|
|
140
|
-
withdraw_token
|
|
141
|
-
withdraw_amount
|
|
140
|
+
withdraw_token?: string | null | undefined;
|
|
141
|
+
withdraw_amount?: number | string | null | undefined;
|
|
142
142
|
token_out?: string | null | undefined;
|
|
143
143
|
slippage?: number | string | undefined;
|
|
144
144
|
gas_sponsorship?: boolean | undefined;
|
|
@@ -158,8 +158,8 @@ export const CreditRepayRequest$outboundSchema: z.ZodType<
|
|
|
158
158
|
repayToken: z.string(),
|
|
159
159
|
repayAmount: z.union([z.number(), z.string()]),
|
|
160
160
|
interestRateMode: InterestRateMode$outboundSchema.optional(),
|
|
161
|
-
withdrawToken: z.string(),
|
|
162
|
-
withdrawAmount: z.union([z.number(), z.string()]),
|
|
161
|
+
withdrawToken: z.nullable(z.string()).optional(),
|
|
162
|
+
withdrawAmount: z.nullable(z.union([z.number(), z.string()])).optional(),
|
|
163
163
|
tokenOut: z.nullable(z.string()).optional(),
|
|
164
164
|
slippage: z.union([z.number(), z.string()]).optional(),
|
|
165
165
|
gasSponsorship: z.boolean().optional(),
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The amount of tokens to transfer (in token units, not wei).
|
|
10
|
+
*/
|
|
11
|
+
export type CreditTransferToAddressParamsAmount = number | string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Transfer tokens from Credit Account to an arbitrary address.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
*
|
|
18
|
+
* Requires all debt positions to be fully repaid (totalDebtBase == 0)
|
|
19
|
+
* before the transfer is allowed.
|
|
20
|
+
*/
|
|
21
|
+
export type CreditTransferToAddressParams = {
|
|
22
|
+
actionType: "CREDIT_TRANSFER_TO_ADDRESS";
|
|
23
|
+
/**
|
|
24
|
+
* The ERC20 token to transfer from the Credit Account.
|
|
25
|
+
*/
|
|
26
|
+
token: string;
|
|
27
|
+
/**
|
|
28
|
+
* The amount of tokens to transfer (in token units, not wei).
|
|
29
|
+
*/
|
|
30
|
+
amount: number | string;
|
|
31
|
+
/**
|
|
32
|
+
* The destination address to receive the tokens.
|
|
33
|
+
*/
|
|
34
|
+
recipient: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type CreditTransferToAddressParamsAmount$Outbound = number | string;
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const CreditTransferToAddressParamsAmount$outboundSchema: z.ZodType<
|
|
42
|
+
CreditTransferToAddressParamsAmount$Outbound,
|
|
43
|
+
z.ZodTypeDef,
|
|
44
|
+
CreditTransferToAddressParamsAmount
|
|
45
|
+
> = z.union([z.number(), z.string()]);
|
|
46
|
+
|
|
47
|
+
export function creditTransferToAddressParamsAmountToJSON(
|
|
48
|
+
creditTransferToAddressParamsAmount: CreditTransferToAddressParamsAmount,
|
|
49
|
+
): string {
|
|
50
|
+
return JSON.stringify(
|
|
51
|
+
CreditTransferToAddressParamsAmount$outboundSchema.parse(
|
|
52
|
+
creditTransferToAddressParamsAmount,
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export type CreditTransferToAddressParams$Outbound = {
|
|
59
|
+
action_type: "CREDIT_TRANSFER_TO_ADDRESS";
|
|
60
|
+
token: string;
|
|
61
|
+
amount: number | string;
|
|
62
|
+
recipient: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const CreditTransferToAddressParams$outboundSchema: z.ZodType<
|
|
67
|
+
CreditTransferToAddressParams$Outbound,
|
|
68
|
+
z.ZodTypeDef,
|
|
69
|
+
CreditTransferToAddressParams
|
|
70
|
+
> = z.object({
|
|
71
|
+
actionType: z.literal("CREDIT_TRANSFER_TO_ADDRESS"),
|
|
72
|
+
token: z.string(),
|
|
73
|
+
amount: z.union([z.number(), z.string()]),
|
|
74
|
+
recipient: z.string(),
|
|
75
|
+
}).transform((v) => {
|
|
76
|
+
return remap$(v, {
|
|
77
|
+
actionType: "action_type",
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export function creditTransferToAddressParamsToJSON(
|
|
82
|
+
creditTransferToAddressParams: CreditTransferToAddressParams,
|
|
83
|
+
): string {
|
|
84
|
+
return JSON.stringify(
|
|
85
|
+
CreditTransferToAddressParams$outboundSchema.parse(
|
|
86
|
+
creditTransferToAddressParams,
|
|
87
|
+
),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -23,6 +23,11 @@ import {
|
|
|
23
23
|
CreditSupplyParams$Outbound,
|
|
24
24
|
CreditSupplyParams$outboundSchema,
|
|
25
25
|
} from "./creditsupplyparams.js";
|
|
26
|
+
import {
|
|
27
|
+
CreditTransferToAddressParams,
|
|
28
|
+
CreditTransferToAddressParams$Outbound,
|
|
29
|
+
CreditTransferToAddressParams$outboundSchema,
|
|
30
|
+
} from "./credittransfertoaddressparams.js";
|
|
26
31
|
import {
|
|
27
32
|
CreditWithdrawParams,
|
|
28
33
|
CreditWithdrawParams$Outbound,
|
|
@@ -49,6 +54,7 @@ export type CreditUserOperationBody =
|
|
|
49
54
|
| CreditEnableCollateralParams
|
|
50
55
|
| CreditRepayParams
|
|
51
56
|
| CreditSupplyParams
|
|
57
|
+
| CreditTransferToAddressParams
|
|
52
58
|
| CreditWithdrawParams
|
|
53
59
|
| EarnSwapParams
|
|
54
60
|
| EarnTransferFromEOAParams
|
|
@@ -63,6 +69,7 @@ export type CreditUserOperation = {
|
|
|
63
69
|
| CreditEnableCollateralParams
|
|
64
70
|
| CreditRepayParams
|
|
65
71
|
| CreditSupplyParams
|
|
72
|
+
| CreditTransferToAddressParams
|
|
66
73
|
| CreditWithdrawParams
|
|
67
74
|
| EarnSwapParams
|
|
68
75
|
| EarnTransferFromEOAParams
|
|
@@ -75,6 +82,7 @@ export type CreditUserOperationBody$Outbound =
|
|
|
75
82
|
| CreditEnableCollateralParams$Outbound
|
|
76
83
|
| CreditRepayParams$Outbound
|
|
77
84
|
| CreditSupplyParams$Outbound
|
|
85
|
+
| CreditTransferToAddressParams$Outbound
|
|
78
86
|
| CreditWithdrawParams$Outbound
|
|
79
87
|
| EarnSwapParams$Outbound
|
|
80
88
|
| EarnTransferFromEOAParams$Outbound
|
|
@@ -90,6 +98,7 @@ export const CreditUserOperationBody$outboundSchema: z.ZodType<
|
|
|
90
98
|
CreditEnableCollateralParams$outboundSchema,
|
|
91
99
|
CreditRepayParams$outboundSchema,
|
|
92
100
|
CreditSupplyParams$outboundSchema,
|
|
101
|
+
CreditTransferToAddressParams$outboundSchema,
|
|
93
102
|
CreditWithdrawParams$outboundSchema,
|
|
94
103
|
EarnSwapParams$outboundSchema,
|
|
95
104
|
EarnTransferFromEOAParams$outboundSchema,
|
|
@@ -111,6 +120,7 @@ export type CreditUserOperation$Outbound = {
|
|
|
111
120
|
| CreditEnableCollateralParams$Outbound
|
|
112
121
|
| CreditRepayParams$Outbound
|
|
113
122
|
| CreditSupplyParams$Outbound
|
|
123
|
+
| CreditTransferToAddressParams$Outbound
|
|
114
124
|
| CreditWithdrawParams$Outbound
|
|
115
125
|
| EarnSwapParams$Outbound
|
|
116
126
|
| EarnTransferFromEOAParams$Outbound
|
|
@@ -128,6 +138,7 @@ export const CreditUserOperation$outboundSchema: z.ZodType<
|
|
|
128
138
|
CreditEnableCollateralParams$outboundSchema,
|
|
129
139
|
CreditRepayParams$outboundSchema,
|
|
130
140
|
CreditSupplyParams$outboundSchema,
|
|
141
|
+
CreditTransferToAddressParams$outboundSchema,
|
|
131
142
|
CreditWithdrawParams$outboundSchema,
|
|
132
143
|
EarnSwapParams$outboundSchema,
|
|
133
144
|
EarnTransferFromEOAParams$outboundSchema,
|
|
@@ -45,8 +45,14 @@ export type DepositForBurnResponse = {
|
|
|
45
45
|
* Unique bridge identifier for tracking this cross-chain transfer. Use this ID when calling /mint/prepare to complete the transfer. Only present when Redis is configured on the server.
|
|
46
46
|
*/
|
|
47
47
|
bridgeId?: string | null | undefined;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Unsigned transaction for direct execution. Present when gas_sponsorship=false.
|
|
50
|
+
*/
|
|
51
|
+
transaction?: UnsignedTransaction | null | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
|
|
54
|
+
*/
|
|
55
|
+
eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
|
|
50
56
|
/**
|
|
51
57
|
* The transfer speed mode used. 'fast' uses confirmed finality (~30s), 'standard' uses full finality (~15-19 min).
|
|
52
58
|
*/
|
|
@@ -73,8 +79,9 @@ export const DepositForBurnResponse$inboundSchema: z.ZodType<
|
|
|
73
79
|
unknown
|
|
74
80
|
> = z.object({
|
|
75
81
|
bridge_id: z.nullable(z.string()).optional(),
|
|
76
|
-
transaction: z.nullable(UnsignedTransaction$inboundSchema),
|
|
77
|
-
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
82
|
+
transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
|
|
83
|
+
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
84
|
+
.optional(),
|
|
78
85
|
transfer_mode: DepositForBurnResponseTransferMode$inboundSchema,
|
|
79
86
|
fee: z.nullable(z.string()).optional(),
|
|
80
87
|
estimated_time_seconds: z.number().int(),
|
|
@@ -17,8 +17,14 @@ import {
|
|
|
17
17
|
} from "./unsignedtransaction.js";
|
|
18
18
|
|
|
19
19
|
export type EarnManageResponse = {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Unsigned transaction for direct execution. Present when gas_sponsorship=false.
|
|
22
|
+
*/
|
|
23
|
+
transaction?: UnsignedTransaction | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
|
|
26
|
+
*/
|
|
27
|
+
eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
|
|
22
28
|
};
|
|
23
29
|
|
|
24
30
|
/** @internal */
|
|
@@ -27,8 +33,9 @@ export const EarnManageResponse$inboundSchema: z.ZodType<
|
|
|
27
33
|
z.ZodTypeDef,
|
|
28
34
|
unknown
|
|
29
35
|
> = z.object({
|
|
30
|
-
transaction: z.nullable(UnsignedTransaction$inboundSchema),
|
|
31
|
-
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
36
|
+
transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
|
|
37
|
+
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
38
|
+
.optional(),
|
|
32
39
|
}).transform((v) => {
|
|
33
40
|
return remap$(v, {
|
|
34
41
|
"eip_712": "eip712",
|
|
@@ -17,8 +17,17 @@ import {
|
|
|
17
17
|
} from "./unsignedtransaction.js";
|
|
18
18
|
|
|
19
19
|
export type EarnSwapResponse = {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Unsigned transaction for direct execution. Present when gas_sponsorship=false.
|
|
22
|
+
*/
|
|
23
|
+
transaction?: UnsignedTransaction | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
|
|
26
|
+
*/
|
|
27
|
+
eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Estimated amount of output token received from the swap.
|
|
30
|
+
*/
|
|
22
31
|
estimatedAmountOut: string;
|
|
23
32
|
};
|
|
24
33
|
|
|
@@ -28,8 +37,9 @@ export const EarnSwapResponse$inboundSchema: z.ZodType<
|
|
|
28
37
|
z.ZodTypeDef,
|
|
29
38
|
unknown
|
|
30
39
|
> = z.object({
|
|
31
|
-
transaction: z.nullable(UnsignedTransaction$inboundSchema),
|
|
32
|
-
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
40
|
+
transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
|
|
41
|
+
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
42
|
+
.optional(),
|
|
33
43
|
estimated_amount_out: z.string(),
|
|
34
44
|
}).transform((v) => {
|
|
35
45
|
return remap$(v, {
|
|
@@ -20,13 +20,26 @@ import {
|
|
|
20
20
|
UnsignedTransaction$inboundSchema,
|
|
21
21
|
} from "./unsignedtransaction.js";
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
|
|
25
|
+
*/
|
|
23
26
|
export type EarnTransferResponseEip712 =
|
|
24
27
|
| BatchedSafeOperationsResponseOutput
|
|
25
28
|
| Permit2TypedDataOutput;
|
|
26
29
|
|
|
27
30
|
export type EarnTransferResponse = {
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Unsigned transaction for direct execution. Present when gas_sponsorship=false.
|
|
33
|
+
*/
|
|
34
|
+
transaction?: UnsignedTransaction | null | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
|
|
37
|
+
*/
|
|
38
|
+
eip712?:
|
|
39
|
+
| BatchedSafeOperationsResponseOutput
|
|
40
|
+
| Permit2TypedDataOutput
|
|
41
|
+
| null
|
|
42
|
+
| undefined;
|
|
30
43
|
};
|
|
31
44
|
|
|
32
45
|
/** @internal */
|
|
@@ -55,13 +68,13 @@ export const EarnTransferResponse$inboundSchema: z.ZodType<
|
|
|
55
68
|
z.ZodTypeDef,
|
|
56
69
|
unknown
|
|
57
70
|
> = z.object({
|
|
58
|
-
transaction: z.nullable(UnsignedTransaction$inboundSchema),
|
|
71
|
+
transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
|
|
59
72
|
eip_712: z.nullable(
|
|
60
73
|
z.union([
|
|
61
74
|
BatchedSafeOperationsResponseOutput$inboundSchema,
|
|
62
75
|
Permit2TypedDataOutput$inboundSchema,
|
|
63
76
|
]),
|
|
64
|
-
),
|
|
77
|
+
).optional(),
|
|
65
78
|
}).transform((v) => {
|
|
66
79
|
return remap$(v, {
|
|
67
80
|
"eip_712": "eip712",
|
|
@@ -99,6 +99,7 @@ export * from "./creditrepayresponse.js";
|
|
|
99
99
|
export * from "./creditsupplyparams.js";
|
|
100
100
|
export * from "./credittransferrequest.js";
|
|
101
101
|
export * from "./credittransferresponse.js";
|
|
102
|
+
export * from "./credittransfertoaddressparams.js";
|
|
102
103
|
export * from "./credituseroperation.js";
|
|
103
104
|
export * from "./creditwithdrawparams.js";
|
|
104
105
|
export * from "./debtposition.js";
|
package/src/sdk/credit.ts
CHANGED
|
@@ -136,7 +136,7 @@ export class Credit extends ClientSDK {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
* Execute multiple credit actions
|
|
139
|
+
* Execute multiple credit actions
|
|
140
140
|
*
|
|
141
141
|
* @remarks
|
|
142
142
|
* Compose individual credit operations (supply, withdraw, borrow, repay, swap, transfer)
|