@paxoslabs/amplify-sdk 0.2.0-alpha.2 → 0.2.0-alpha.4
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/CHANGELOG.md +2 -0
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
<!-- auto-changelog-above -->
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
## [0.1.1](///compare/v0.1.1-beta.1...v0.1.1) (2025-12-10)
|
|
12
|
+
|
|
11
13
|
## [0.1.1-beta.0](///compare/v0.1.1-alpha.5...v0.1.1-beta.0) (2025-12-10)
|
|
12
14
|
|
|
13
15
|
## [0.1.1-alpha.5](///compare/v0.1.1-alpha.4...v0.1.1-alpha.5) (2025-12-10)
|
package/dist/index.d.mts
CHANGED
|
@@ -655,10 +655,10 @@ declare function setLogLevel(level: LogLevel): void;
|
|
|
655
655
|
/**
|
|
656
656
|
* Parameters required for preparing an approval transaction
|
|
657
657
|
* @interface PrepareApproveDepositTokenTxParams
|
|
658
|
+
* @property {YieldType} yieldType - Yield strategy type (e.g., "PRIME", "TBILL", "LENDING")
|
|
658
659
|
* @property {Address} depositToken - Token contract address to approve
|
|
659
|
-
* @property {Address} boringVaultAddress - Address of the BoringVault to approve spending
|
|
660
660
|
* @property {string} [approvalAmount] - Optional amount to approve (defaults to maximum approval)
|
|
661
|
-
* @property {
|
|
661
|
+
* @property {ChainId} chainId - ID of the chain where the approval will occur
|
|
662
662
|
*/
|
|
663
663
|
interface PrepareApproveDepositTokenTxParams {
|
|
664
664
|
yieldType: YieldType;
|
|
@@ -673,7 +673,7 @@ interface PrepareApproveDepositTokenTxParams {
|
|
|
673
673
|
* @property {Address} address - Address of the ERC20 token being approved
|
|
674
674
|
* @property {'approve'} functionName - Name of the function to call
|
|
675
675
|
* @property {[Address, bigint]} args - Arguments for the approve function:
|
|
676
|
-
* [spender (
|
|
676
|
+
* [spender (CommunityCodeDepositor address), amount]
|
|
677
677
|
*/
|
|
678
678
|
interface ApproveDepositTokenTxData {
|
|
679
679
|
abi: typeof erc20Abi;
|
|
@@ -685,13 +685,13 @@ interface ApproveDepositTokenTxData {
|
|
|
685
685
|
* Prepares the transaction data needed to approve a deposit token for the vault
|
|
686
686
|
*
|
|
687
687
|
* This function prepares an ERC20 approval transaction that allows the vault's
|
|
688
|
-
*
|
|
688
|
+
* CommunityCodeDepositor contract to spend the user's deposit tokens.
|
|
689
689
|
*
|
|
690
690
|
* @example
|
|
691
691
|
* ```typescript
|
|
692
|
-
* const approveData = await
|
|
692
|
+
* const approveData = await prepareApproveDepositTokenTxData({
|
|
693
|
+
* yieldType: "PRIME",
|
|
693
694
|
* depositToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
694
|
-
* boringVaultAddress: '0x1234...',
|
|
695
695
|
* approvalAmount: "1000.0", // Approve 1000 USDC
|
|
696
696
|
* chainId: 1,
|
|
697
697
|
* });
|
|
@@ -699,7 +699,7 @@ interface ApproveDepositTokenTxData {
|
|
|
699
699
|
*
|
|
700
700
|
* @param {PrepareApproveDepositTokenTxParams} params - Parameters for the approval operation
|
|
701
701
|
* @returns {Promise<ApproveDepositTokenTxData>} Promise resolving to the prepared transaction data
|
|
702
|
-
* @throws {APIError} If parameters are invalid
|
|
702
|
+
* @throws {APIError} If parameters are invalid or vault not found
|
|
703
703
|
*/
|
|
704
704
|
declare function prepareApproveDepositTokenTxData({ yieldType, depositToken, approvalAmount, chainId, }: PrepareApproveDepositTokenTxParams): Promise<ApproveDepositTokenTxData>;
|
|
705
705
|
|
package/dist/index.d.ts
CHANGED
|
@@ -655,10 +655,10 @@ declare function setLogLevel(level: LogLevel): void;
|
|
|
655
655
|
/**
|
|
656
656
|
* Parameters required for preparing an approval transaction
|
|
657
657
|
* @interface PrepareApproveDepositTokenTxParams
|
|
658
|
+
* @property {YieldType} yieldType - Yield strategy type (e.g., "PRIME", "TBILL", "LENDING")
|
|
658
659
|
* @property {Address} depositToken - Token contract address to approve
|
|
659
|
-
* @property {Address} boringVaultAddress - Address of the BoringVault to approve spending
|
|
660
660
|
* @property {string} [approvalAmount] - Optional amount to approve (defaults to maximum approval)
|
|
661
|
-
* @property {
|
|
661
|
+
* @property {ChainId} chainId - ID of the chain where the approval will occur
|
|
662
662
|
*/
|
|
663
663
|
interface PrepareApproveDepositTokenTxParams {
|
|
664
664
|
yieldType: YieldType;
|
|
@@ -673,7 +673,7 @@ interface PrepareApproveDepositTokenTxParams {
|
|
|
673
673
|
* @property {Address} address - Address of the ERC20 token being approved
|
|
674
674
|
* @property {'approve'} functionName - Name of the function to call
|
|
675
675
|
* @property {[Address, bigint]} args - Arguments for the approve function:
|
|
676
|
-
* [spender (
|
|
676
|
+
* [spender (CommunityCodeDepositor address), amount]
|
|
677
677
|
*/
|
|
678
678
|
interface ApproveDepositTokenTxData {
|
|
679
679
|
abi: typeof erc20Abi;
|
|
@@ -685,13 +685,13 @@ interface ApproveDepositTokenTxData {
|
|
|
685
685
|
* Prepares the transaction data needed to approve a deposit token for the vault
|
|
686
686
|
*
|
|
687
687
|
* This function prepares an ERC20 approval transaction that allows the vault's
|
|
688
|
-
*
|
|
688
|
+
* CommunityCodeDepositor contract to spend the user's deposit tokens.
|
|
689
689
|
*
|
|
690
690
|
* @example
|
|
691
691
|
* ```typescript
|
|
692
|
-
* const approveData = await
|
|
692
|
+
* const approveData = await prepareApproveDepositTokenTxData({
|
|
693
|
+
* yieldType: "PRIME",
|
|
693
694
|
* depositToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
694
|
-
* boringVaultAddress: '0x1234...',
|
|
695
695
|
* approvalAmount: "1000.0", // Approve 1000 USDC
|
|
696
696
|
* chainId: 1,
|
|
697
697
|
* });
|
|
@@ -699,7 +699,7 @@ interface ApproveDepositTokenTxData {
|
|
|
699
699
|
*
|
|
700
700
|
* @param {PrepareApproveDepositTokenTxParams} params - Parameters for the approval operation
|
|
701
701
|
* @returns {Promise<ApproveDepositTokenTxData>} Promise resolving to the prepared transaction data
|
|
702
|
-
* @throws {APIError} If parameters are invalid
|
|
702
|
+
* @throws {APIError} If parameters are invalid or vault not found
|
|
703
703
|
*/
|
|
704
704
|
declare function prepareApproveDepositTokenTxData({ yieldType, depositToken, approvalAmount, chainId, }: PrepareApproveDepositTokenTxParams): Promise<ApproveDepositTokenTxData>;
|
|
705
705
|
|
package/dist/index.js
CHANGED
|
@@ -29,10 +29,10 @@ async function prepareApproveDepositTokenTxData({
|
|
|
29
29
|
{ endpoint: "prepareApproveDepositToken" }
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
32
|
+
const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
|
|
33
|
+
if (!communityCodeDepositorAddress) {
|
|
34
34
|
throw new chunkCK3BIPWI_js.APIError(
|
|
35
|
-
`
|
|
35
|
+
`Community Code Depositor contract address not configured for vault ${config.id}`,
|
|
36
36
|
{ endpoint: "prepareApproveDepositToken" }
|
|
37
37
|
);
|
|
38
38
|
}
|
|
@@ -49,7 +49,7 @@ async function prepareApproveDepositTokenTxData({
|
|
|
49
49
|
abi: viem.erc20Abi,
|
|
50
50
|
address: depositToken,
|
|
51
51
|
functionName: "approve",
|
|
52
|
-
args: [
|
|
52
|
+
args: [communityCodeDepositorAddress, amount]
|
|
53
53
|
};
|
|
54
54
|
} catch (error) {
|
|
55
55
|
if (error instanceof chunkCK3BIPWI_js.APIError) {
|
|
@@ -357,7 +357,19 @@ async function prepareDepositTxData(params) {
|
|
|
357
357
|
);
|
|
358
358
|
}
|
|
359
359
|
const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
|
|
360
|
+
if (!communityCodeDepositorAddress) {
|
|
361
|
+
throw new chunkCK3BIPWI_js.APIError(
|
|
362
|
+
`Community Code Depositor contract address not found for vault ${vault.id}`,
|
|
363
|
+
{ endpoint: "prepareDepositTransactionData" }
|
|
364
|
+
);
|
|
365
|
+
}
|
|
360
366
|
const accountantAddress = vault.vault.accountantAddress;
|
|
367
|
+
if (!accountantAddress) {
|
|
368
|
+
throw new chunkCK3BIPWI_js.APIError(
|
|
369
|
+
`Accountant contract address not found for vault ${vault.id}`,
|
|
370
|
+
{ endpoint: "prepareDepositTransactionData" }
|
|
371
|
+
);
|
|
372
|
+
}
|
|
361
373
|
const depositAssetAddress = asset.address;
|
|
362
374
|
const [depositAssetDecimalsResult, rateInQuoteResult] = await chunk4ZYCWOFI_js.getRateInQuoteWithAssetDecimals({
|
|
363
375
|
assetAddress: depositAssetAddress,
|