@zyfai/sdk 0.1.4 → 0.1.5
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 +1 -1
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +8 -10
- package/dist/index.mjs +8 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -377,7 +377,7 @@ console.log("Active wallet count:", wallets.count);
|
|
|
377
377
|
#### Get Smart Wallets by EOA
|
|
378
378
|
|
|
379
379
|
```typescript
|
|
380
|
-
const result = await sdk.
|
|
380
|
+
const result = await sdk.getSmartWalletByEOA("0xYourEOA...");
|
|
381
381
|
console.log("Smart wallets:", result.smartWallets);
|
|
382
382
|
```
|
|
383
383
|
|
package/dist/index.d.mts
CHANGED
|
@@ -177,11 +177,10 @@ interface ActiveWalletsResponse {
|
|
|
177
177
|
wallets: ActiveWallet[];
|
|
178
178
|
count: number;
|
|
179
179
|
}
|
|
180
|
-
interface
|
|
180
|
+
interface SmartWalletByEOAResponse {
|
|
181
181
|
success: boolean;
|
|
182
182
|
eoa: string;
|
|
183
|
-
smartWallet:
|
|
184
|
-
smartWallets: string[];
|
|
183
|
+
smartWallet: Address | null;
|
|
185
184
|
chains: number[];
|
|
186
185
|
}
|
|
187
186
|
interface FirstTopupResponse {
|
|
@@ -647,11 +646,11 @@ declare class ZyfaiSDK {
|
|
|
647
646
|
*
|
|
648
647
|
* @example
|
|
649
648
|
* ```typescript
|
|
650
|
-
* const result = await sdk.
|
|
649
|
+
* const result = await sdk.getSmartWalletByEOA("0x...");
|
|
651
650
|
* console.log("Smart wallets:", result.smartWallets);
|
|
652
651
|
* ```
|
|
653
652
|
*/
|
|
654
|
-
|
|
653
|
+
getSmartWalletByEOA(eoaAddress: string): Promise<SmartWalletByEOAResponse>;
|
|
655
654
|
/**
|
|
656
655
|
* Get the first topup (deposit) information for a wallet
|
|
657
656
|
*
|
|
@@ -814,4 +813,4 @@ declare class ZyfaiSDK {
|
|
|
814
813
|
getRebalanceFrequency(walletAddress: string): Promise<RebalanceFrequencyResponse>;
|
|
815
814
|
}
|
|
816
815
|
|
|
817
|
-
export { type ActionData, type ActiveWallet, type ActiveWalletsResponse, type Address, type ChainConfig, type ChainPortfolio, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type Environment, type FirstTopupResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RebalanceInfo, type RebalanceInfoResponse, type SDKConfig, type Session, type SessionKeyResponse, type
|
|
816
|
+
export { type ActionData, type ActiveWallet, type ActiveWalletsResponse, type Address, type ChainConfig, type ChainPortfolio, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type Environment, type FirstTopupResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RebalanceInfo, type RebalanceInfoResponse, type SDKConfig, type Session, type SessionKeyResponse, type SmartWalletByEOAResponse, type SmartWalletResponse, type SupportedChainId, type TVLResponse, type UserDetails, type UserDetailsResponse, type VolumeResponse, type WithdrawResponse, ZyfaiSDK, getChainConfig, getSupportedChainIds, isSupportedChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -177,11 +177,10 @@ interface ActiveWalletsResponse {
|
|
|
177
177
|
wallets: ActiveWallet[];
|
|
178
178
|
count: number;
|
|
179
179
|
}
|
|
180
|
-
interface
|
|
180
|
+
interface SmartWalletByEOAResponse {
|
|
181
181
|
success: boolean;
|
|
182
182
|
eoa: string;
|
|
183
|
-
smartWallet:
|
|
184
|
-
smartWallets: string[];
|
|
183
|
+
smartWallet: Address | null;
|
|
185
184
|
chains: number[];
|
|
186
185
|
}
|
|
187
186
|
interface FirstTopupResponse {
|
|
@@ -647,11 +646,11 @@ declare class ZyfaiSDK {
|
|
|
647
646
|
*
|
|
648
647
|
* @example
|
|
649
648
|
* ```typescript
|
|
650
|
-
* const result = await sdk.
|
|
649
|
+
* const result = await sdk.getSmartWalletByEOA("0x...");
|
|
651
650
|
* console.log("Smart wallets:", result.smartWallets);
|
|
652
651
|
* ```
|
|
653
652
|
*/
|
|
654
|
-
|
|
653
|
+
getSmartWalletByEOA(eoaAddress: string): Promise<SmartWalletByEOAResponse>;
|
|
655
654
|
/**
|
|
656
655
|
* Get the first topup (deposit) information for a wallet
|
|
657
656
|
*
|
|
@@ -814,4 +813,4 @@ declare class ZyfaiSDK {
|
|
|
814
813
|
getRebalanceFrequency(walletAddress: string): Promise<RebalanceFrequencyResponse>;
|
|
815
814
|
}
|
|
816
815
|
|
|
817
|
-
export { type ActionData, type ActiveWallet, type ActiveWalletsResponse, type Address, type ChainConfig, type ChainPortfolio, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type Environment, type FirstTopupResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RebalanceInfo, type RebalanceInfoResponse, type SDKConfig, type Session, type SessionKeyResponse, type
|
|
816
|
+
export { type ActionData, type ActiveWallet, type ActiveWalletsResponse, type Address, type ChainConfig, type ChainPortfolio, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type Environment, type FirstTopupResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RebalanceInfo, type RebalanceInfoResponse, type SDKConfig, type Session, type SessionKeyResponse, type SmartWalletByEOAResponse, type SmartWalletResponse, type SupportedChainId, type TVLResponse, type UserDetails, type UserDetailsResponse, type VolumeResponse, type WithdrawResponse, ZyfaiSDK, getChainConfig, getSupportedChainIds, isSupportedChain };
|
package/dist/index.js
CHANGED
|
@@ -414,7 +414,7 @@ var SAFE_7579_ADDRESS = "0x7579EE8307284F293B1927136486880611F20002";
|
|
|
414
414
|
var ERC7579_LAUNCHPAD_ADDRESS = "0x7579011aB74c46090561ea277Ba79D510c6C00ff";
|
|
415
415
|
var ACCOUNT_SALTS = {
|
|
416
416
|
staging: "zyfai-staging",
|
|
417
|
-
production: "zyfai
|
|
417
|
+
production: "zyfai"
|
|
418
418
|
};
|
|
419
419
|
var getSafeAccount = async (config) => {
|
|
420
420
|
const {
|
|
@@ -440,8 +440,8 @@ var getSafeAccount = async (config) => {
|
|
|
440
440
|
const saltHex = (0, import_viem3.fromHex)((0, import_viem3.toHex)(effectiveSalt), "bigint");
|
|
441
441
|
const safeAccount = await (0, import_accounts.toSafeSmartAccount)({
|
|
442
442
|
client: publicClient,
|
|
443
|
-
owners: [owner
|
|
444
|
-
// Pass the
|
|
443
|
+
owners: [owner],
|
|
444
|
+
// Pass the owner object with address and signMessage capability
|
|
445
445
|
version: "1.4.1",
|
|
446
446
|
entryPoint: {
|
|
447
447
|
address: import_account_abstraction.entryPoint07Address,
|
|
@@ -512,7 +512,7 @@ var getAccountType = async (address, publicClient) => {
|
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
514
|
var getSmartAccountClient = async (config) => {
|
|
515
|
-
const {
|
|
515
|
+
const { chain, bundlerUrl } = config;
|
|
516
516
|
const safeAccount = await getSafeAccount(config);
|
|
517
517
|
const bundlerClient = (0, import_pimlico.createPimlicoClient)({
|
|
518
518
|
transport: (0, import_viem3.http)(bundlerUrl),
|
|
@@ -1476,11 +1476,11 @@ var ZyfaiSDK = class {
|
|
|
1476
1476
|
*
|
|
1477
1477
|
* @example
|
|
1478
1478
|
* ```typescript
|
|
1479
|
-
* const result = await sdk.
|
|
1479
|
+
* const result = await sdk.getSmartWalletByEOA("0x...");
|
|
1480
1480
|
* console.log("Smart wallets:", result.smartWallets);
|
|
1481
1481
|
* ```
|
|
1482
1482
|
*/
|
|
1483
|
-
async
|
|
1483
|
+
async getSmartWalletByEOA(eoaAddress) {
|
|
1484
1484
|
try {
|
|
1485
1485
|
if (!eoaAddress) {
|
|
1486
1486
|
throw new Error("EOA address is required");
|
|
@@ -1488,14 +1488,12 @@ var ZyfaiSDK = class {
|
|
|
1488
1488
|
const response = await this.httpClient.get(
|
|
1489
1489
|
ENDPOINTS.DATA_BY_EOA(eoaAddress)
|
|
1490
1490
|
);
|
|
1491
|
-
const smartWallet = response.agent ||
|
|
1492
|
-
const smartWallets = smartWallet ? [smartWallet] : [];
|
|
1491
|
+
const smartWallet = response.agent || null;
|
|
1493
1492
|
const chains = response.chains || [];
|
|
1494
1493
|
return {
|
|
1495
1494
|
success: true,
|
|
1496
1495
|
eoa: eoaAddress,
|
|
1497
|
-
smartWallet
|
|
1498
|
-
smartWallets,
|
|
1496
|
+
smartWallet,
|
|
1499
1497
|
chains
|
|
1500
1498
|
};
|
|
1501
1499
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -393,7 +393,7 @@ var SAFE_7579_ADDRESS = "0x7579EE8307284F293B1927136486880611F20002";
|
|
|
393
393
|
var ERC7579_LAUNCHPAD_ADDRESS = "0x7579011aB74c46090561ea277Ba79D510c6C00ff";
|
|
394
394
|
var ACCOUNT_SALTS = {
|
|
395
395
|
staging: "zyfai-staging",
|
|
396
|
-
production: "zyfai
|
|
396
|
+
production: "zyfai"
|
|
397
397
|
};
|
|
398
398
|
var getSafeAccount = async (config) => {
|
|
399
399
|
const {
|
|
@@ -419,8 +419,8 @@ var getSafeAccount = async (config) => {
|
|
|
419
419
|
const saltHex = fromHex(toHex(effectiveSalt), "bigint");
|
|
420
420
|
const safeAccount = await toSafeSmartAccount({
|
|
421
421
|
client: publicClient,
|
|
422
|
-
owners: [owner
|
|
423
|
-
// Pass the
|
|
422
|
+
owners: [owner],
|
|
423
|
+
// Pass the owner object with address and signMessage capability
|
|
424
424
|
version: "1.4.1",
|
|
425
425
|
entryPoint: {
|
|
426
426
|
address: entryPoint07Address,
|
|
@@ -491,7 +491,7 @@ var getAccountType = async (address, publicClient) => {
|
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
493
|
var getSmartAccountClient = async (config) => {
|
|
494
|
-
const {
|
|
494
|
+
const { chain, bundlerUrl } = config;
|
|
495
495
|
const safeAccount = await getSafeAccount(config);
|
|
496
496
|
const bundlerClient = createPimlicoClient({
|
|
497
497
|
transport: http2(bundlerUrl),
|
|
@@ -1455,11 +1455,11 @@ var ZyfaiSDK = class {
|
|
|
1455
1455
|
*
|
|
1456
1456
|
* @example
|
|
1457
1457
|
* ```typescript
|
|
1458
|
-
* const result = await sdk.
|
|
1458
|
+
* const result = await sdk.getSmartWalletByEOA("0x...");
|
|
1459
1459
|
* console.log("Smart wallets:", result.smartWallets);
|
|
1460
1460
|
* ```
|
|
1461
1461
|
*/
|
|
1462
|
-
async
|
|
1462
|
+
async getSmartWalletByEOA(eoaAddress) {
|
|
1463
1463
|
try {
|
|
1464
1464
|
if (!eoaAddress) {
|
|
1465
1465
|
throw new Error("EOA address is required");
|
|
@@ -1467,14 +1467,12 @@ var ZyfaiSDK = class {
|
|
|
1467
1467
|
const response = await this.httpClient.get(
|
|
1468
1468
|
ENDPOINTS.DATA_BY_EOA(eoaAddress)
|
|
1469
1469
|
);
|
|
1470
|
-
const smartWallet = response.agent ||
|
|
1471
|
-
const smartWallets = smartWallet ? [smartWallet] : [];
|
|
1470
|
+
const smartWallet = response.agent || null;
|
|
1472
1471
|
const chains = response.chains || [];
|
|
1473
1472
|
return {
|
|
1474
1473
|
success: true,
|
|
1475
1474
|
eoa: eoaAddress,
|
|
1476
|
-
smartWallet
|
|
1477
|
-
smartWallets,
|
|
1475
|
+
smartWallet,
|
|
1478
1476
|
chains
|
|
1479
1477
|
};
|
|
1480
1478
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "TypeScript SDK for ZyFAI Yield Optimization Engine - Deploy Safe smart wallets, manage session keys, and interact with DeFi protocols",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|