fibx 0.2.6 → 0.3.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 +38 -195
- package/dist/commands/auth/login.d.ts.map +1 -1
- package/dist/commands/auth/login.js +2 -21
- package/dist/commands/auth/login.js.map +1 -1
- package/dist/commands/auth/verify.d.ts.map +1 -1
- package/dist/commands/auth/verify.js +11 -44
- package/dist/commands/auth/verify.js.map +1 -1
- package/dist/commands/defi/aave.js +1 -3
- package/dist/commands/defi/aave.js.map +1 -1
- package/dist/commands/trade/swap.d.ts.map +1 -1
- package/dist/commands/trade/swap.js +19 -7
- package/dist/commands/trade/swap.js.map +1 -1
- package/dist/commands/wallet/list.d.ts +1 -1
- package/dist/commands/wallet/list.d.ts.map +1 -1
- package/dist/commands/wallet/list.js +18 -26
- package/dist/commands/wallet/list.js.map +1 -1
- package/dist/commands/wallet/send.d.ts.map +1 -1
- package/dist/commands/wallet/send.js +1 -3
- package/dist/commands/wallet/send.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/config.d.ts +1 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +3 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/services/api/client.d.ts +34 -0
- package/dist/services/api/client.d.ts.map +1 -0
- package/dist/services/api/client.js +68 -0
- package/dist/services/api/client.js.map +1 -0
- package/dist/services/chain/client.d.ts +1 -2
- package/dist/services/chain/client.d.ts.map +1 -1
- package/dist/services/chain/client.js +6 -6
- package/dist/services/chain/client.js.map +1 -1
- package/dist/services/chain/constants.js +1 -1
- package/dist/services/chain/constants.js.map +1 -1
- package/dist/services/defi/aave.d.ts +3 -0
- package/dist/services/defi/aave.d.ts.map +1 -1
- package/dist/services/defi/aave.js +170 -50
- package/dist/services/defi/aave.js.map +1 -1
- package/dist/services/defi/abi/aave.d.ts +60 -0
- package/dist/services/defi/abi/aave.d.ts.map +1 -1
- package/dist/services/defi/abi/aave.js +41 -0
- package/dist/services/defi/abi/aave.js.map +1 -1
- package/dist/services/defi/constants.d.ts +1 -0
- package/dist/services/defi/constants.d.ts.map +1 -1
- package/dist/services/defi/constants.js +2 -0
- package/dist/services/defi/constants.js.map +1 -1
- package/dist/services/privy/account.d.ts +5 -2
- package/dist/services/privy/account.d.ts.map +1 -1
- package/dist/services/privy/account.js +19 -21
- package/dist/services/privy/account.js.map +1 -1
- package/dist/services/privy/client.d.ts +1 -14
- package/dist/services/privy/client.d.ts.map +1 -1
- package/dist/services/privy/client.js +6 -62
- package/dist/services/privy/client.js.map +1 -1
- package/package.json +1 -2
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function getPrivyClient(): PrivyClient;
|
|
3
|
-
export declare function findExistingWallet(privy: PrivyClient, email: string): Promise<{
|
|
4
|
-
id: string;
|
|
5
|
-
address: string;
|
|
6
|
-
} | null>;
|
|
7
|
-
export declare function createAgentWallet(privy: PrivyClient, owner?: {
|
|
8
|
-
userId?: string;
|
|
9
|
-
publicKey?: string;
|
|
10
|
-
}): Promise<{
|
|
11
|
-
id: string;
|
|
12
|
-
address: string;
|
|
13
|
-
}>;
|
|
14
|
-
export declare function saveWalletIdToUser(privy: PrivyClient, userId: string, walletId: string): Promise<void>;
|
|
1
|
+
export {};
|
|
15
2
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/services/privy/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/services/privy/client.ts"],"names":[],"mappings":""}
|
|
@@ -1,63 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
throw new FibxError(ErrorCode.PRIVY_ERROR, "PRIVY_APP_ID and PRIVY_APP_SECRET env vars are required");
|
|
8
|
-
}
|
|
9
|
-
return new PrivyClient({ appId, appSecret });
|
|
10
|
-
}
|
|
11
|
-
export async function findExistingWallet(privy, email) {
|
|
12
|
-
try {
|
|
13
|
-
const user = await privy.users().getByEmailAddress({ address: email });
|
|
14
|
-
const serverWalletId = user.custom_metadata?.server_wallet_id;
|
|
15
|
-
if (serverWalletId) {
|
|
16
|
-
try {
|
|
17
|
-
const wallet = await privy.wallets().get(serverWalletId);
|
|
18
|
-
return { id: wallet.id, address: wallet.address };
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
// Wallet likely deleted
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export async function createAgentWallet(privy, owner) {
|
|
31
|
-
try {
|
|
32
|
-
let walletOwner;
|
|
33
|
-
if (owner) {
|
|
34
|
-
walletOwner = owner.userId
|
|
35
|
-
? { user_id: owner.userId }
|
|
36
|
-
: { public_key: owner.publicKey };
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
walletOwner = null;
|
|
40
|
-
}
|
|
41
|
-
const wallet = await privy.wallets().create({
|
|
42
|
-
chain_type: "ethereum",
|
|
43
|
-
owner: walletOwner,
|
|
44
|
-
});
|
|
45
|
-
return { id: wallet.id, address: wallet.address };
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
throw new FibxError(ErrorCode.PRIVY_ERROR, `Failed to create wallet: ${error instanceof Error ? error.message : String(error)}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export async function saveWalletIdToUser(privy, userId, walletId) {
|
|
52
|
-
try {
|
|
53
|
-
await privy.users().setCustomMetadata(userId, {
|
|
54
|
-
custom_metadata: {
|
|
55
|
-
server_wallet_id: walletId,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
throw new FibxError(ErrorCode.PRIVY_ERROR, `Failed to save wallet ID to user metadata: ${error instanceof Error ? error.message : String(error)}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
export {};
|
|
2
|
+
// This module is no longer used.
|
|
3
|
+
// All Privy operations are now proxied through fibx-server backend.
|
|
4
|
+
// The API client is at: src/services/api/client.ts
|
|
5
|
+
//
|
|
6
|
+
// This file is kept as a placeholder. It can be safely deleted.
|
|
63
7
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/services/privy/client.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/services/privy/client.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,oEAAoE;AACpE,mDAAmD;AACnD,EAAE;AACF,gEAAgE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fibx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A powerful CLI for DeFi operations on Base, Citrea, HyperEVM, and Monad, powered by Fibrous.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"prepublishOnly": "npm run build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@privy-io/node": "^0.8.0",
|
|
25
24
|
"chalk": "^5.6.2",
|
|
26
25
|
"commander": "^14.0.3",
|
|
27
26
|
"env-paths": "^3.0.0",
|