@zyfai/sdk 0.7.1 → 0.8.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/dist/index.d.mts CHANGED
@@ -14,7 +14,7 @@ type Hex = `0x${string}`;
14
14
  */
15
15
  type Strategy = "conservative" | "aggressive" | "yieldmaxxing";
16
16
  /** Public asset symbols supported by the SDK */
17
- type SupportedAsset = "USDC" | "WETH" | "EURC" | "NVDAc";
17
+ type SupportedAsset = "USDC" | "WETH" | "EURC" | "USDT" | "PYUSD" | "NVDAc";
18
18
  /** Optional per-chain RPC URLs for on-chain reads and writes. */
19
19
  interface RpcUrlsConfig {
20
20
  /** Ethereum mainnet */
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ type Hex = `0x${string}`;
14
14
  */
15
15
  type Strategy = "conservative" | "aggressive" | "yieldmaxxing";
16
16
  /** Public asset symbols supported by the SDK */
17
- type SupportedAsset = "USDC" | "WETH" | "EURC" | "NVDAc";
17
+ type SupportedAsset = "USDC" | "WETH" | "EURC" | "USDT" | "PYUSD" | "NVDAc";
18
18
  /** Optional per-chain RPC URLs for on-chain reads and writes. */
19
19
  interface RpcUrlsConfig {
20
20
  /** Ethereum mainnet */
package/dist/index.js CHANGED
@@ -548,6 +548,33 @@ var ERC20_ABI = [
548
548
  outputs: [{ name: "", type: "uint256" }]
549
549
  }
550
550
  ];
551
+ var ERC20_TRANSFER_LEGACY_ABI = [
552
+ {
553
+ name: "transfer",
554
+ type: "function",
555
+ stateMutability: "nonpayable",
556
+ inputs: [
557
+ { name: "to", type: "address" },
558
+ { name: "amount", type: "uint256" }
559
+ ],
560
+ outputs: []
561
+ }
562
+ ];
563
+ var ERC20_TRANSFER_WITH_BOOL_ABI = [
564
+ {
565
+ name: "transfer",
566
+ type: "function",
567
+ stateMutability: "nonpayable",
568
+ inputs: [
569
+ { name: "to", type: "address" },
570
+ { name: "amount", type: "uint256" }
571
+ ],
572
+ outputs: [{ name: "", type: "bool" }]
573
+ }
574
+ ];
575
+ function erc20TransferWriteAbi(assetSymbol) {
576
+ return assetSymbol === "USDT" ? ERC20_TRANSFER_LEGACY_ABI : ERC20_TRANSFER_WITH_BOOL_ABI;
577
+ }
551
578
  var IDENTITY_REGISTRY_ABI = (0, import_viem.parseAbi)([
552
579
  "function register() external returns (uint256 agentId)",
553
580
  "function register(string tokenUri) external returns (uint256 agentId)",
@@ -645,8 +672,12 @@ var MIN_PORTFOLIO_BALANCE = {
645
672
  1: {
646
673
  USDC: 10000n * 10n ** 6n,
647
674
  // 10,000 USDC (6 decimals)
648
- EURC: 10000n * 10n ** 6n
675
+ EURC: 10000n * 10n ** 6n,
649
676
  // 10,000 EURC (6 decimals)
677
+ USDT: 10000n * 10n ** 6n,
678
+ // 10,000 USDT (6 decimals)
679
+ PYUSD: 10000n * 10n ** 6n
680
+ // 10,000 PYUSD (6 decimals)
650
681
  },
651
682
  8453: {
652
683
  USDC: 10n * 10n ** 6n,
@@ -746,7 +777,7 @@ var ASSET_CONFIGS = {
746
777
  displayName: "USDC",
747
778
  icon: "/ai-dashboard/usdc-token.png",
748
779
  decimals: 6,
749
- tokenSymbols: ["USDC", "USDC.e", "USDT", "USDT0"],
780
+ tokenSymbols: ["USDC", "USDC.e", "USDT0"],
750
781
  tokenSymbolsByChainId: {
751
782
  1: "USDC",
752
783
  8453: "USDC",
@@ -817,6 +848,36 @@ var ASSET_CONFIGS = {
817
848
  },
818
849
  enabled: true
819
850
  },
851
+ USDT: {
852
+ symbol: "USDT",
853
+ assetType: "usdt",
854
+ displayName: "USDT",
855
+ icon: "https://etherscan.io/token/images/tethernew_32.svg",
856
+ decimals: 6,
857
+ tokenSymbols: ["USDT"],
858
+ tokenSymbolsByChainId: {
859
+ 1: "USDT"
860
+ },
861
+ addresses: {
862
+ 1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
863
+ },
864
+ enabled: true
865
+ },
866
+ PYUSD: {
867
+ symbol: "PYUSD",
868
+ assetType: "pyusd",
869
+ displayName: "PYUSD",
870
+ icon: "https://etherscan.io/token/images/PYUSD_32.png",
871
+ decimals: 6,
872
+ tokenSymbols: ["PYUSD"],
873
+ tokenSymbolsByChainId: {
874
+ 1: "PYUSD"
875
+ },
876
+ addresses: {
877
+ 1: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8"
878
+ },
879
+ enabled: true
880
+ },
820
881
  // Coinbase B20 tokenized NVIDIA equity. Base only, and only reachable through
821
882
  // protocols with delayed withdrawals — see the `yieldmaxxing` strategy.
822
883
  NVDAc: {
@@ -896,6 +957,8 @@ var MANAGED_ASSET_ORDER = [
896
957
  "USDC",
897
958
  "WETH",
898
959
  "EURC",
960
+ "USDT",
961
+ "PYUSD",
899
962
  "NVDAc"
900
963
  ];
901
964
  function getManagedAssets() {
@@ -1140,7 +1203,7 @@ var signSessionKey = async (config, sessions, allPublicClients, signingParams) =
1140
1203
 
1141
1204
  // src/utils/strategy.ts
1142
1205
  var PUBLIC_STRATEGIES = `"conservative", "aggressive" or "yieldmaxxing"`;
1143
- var SUPPORTED_ASSETS = `"USDC", "WETH", "EURC" or "NVDAc"`;
1206
+ var SUPPORTED_ASSETS = Object.entries(ASSET_CONFIGS).filter(([, config]) => config?.enabled === true).map(([symbol]) => `"${symbol}"`).join(", ");
1144
1207
  function toInternalStrategy(publicStrategy) {
1145
1208
  switch (publicStrategy) {
1146
1209
  case "conservative":
@@ -1220,20 +1283,12 @@ function removeUnusedFields(obj) {
1220
1283
  return result;
1221
1284
  }
1222
1285
  function convertAssetInternally(asset) {
1223
- if (asset === "USDC") {
1224
- return "usdc";
1225
- }
1226
- if (asset === "WETH") {
1227
- return "eth";
1228
- }
1229
- if (asset === "EURC") {
1230
- return "eurc";
1231
- }
1232
- if (asset === "NVDAc") {
1233
- return "nvdac";
1286
+ const assetType = ASSET_CONFIGS[asset]?.assetType;
1287
+ if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac") {
1288
+ return assetType;
1234
1289
  }
1235
1290
  throw new Error(
1236
- `Invalid asset: ${asset}. Must be ${SUPPORTED_ASSETS}.`
1291
+ `Invalid asset: ${asset}. Must be one of: ${SUPPORTED_ASSETS}.`
1237
1292
  );
1238
1293
  }
1239
1294
  function convertStrategiesToPublic(array) {
@@ -3186,7 +3241,9 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3186
3241
  throw new Error("Valid amount is required");
3187
3242
  }
3188
3243
  if (!asset) {
3189
- throw new Error("Asset is required (USDC, WETH, or EURC)");
3244
+ throw new Error(
3245
+ "Asset is required (USDC, WETH, EURC, USDT, PYUSD, or NVDAc)"
3246
+ );
3190
3247
  }
3191
3248
  if (strategy !== void 0 && !isValidPublicStrategy(strategy)) {
3192
3249
  throw new Error(
@@ -3262,7 +3319,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3262
3319
  }
3263
3320
  const txHash = await walletClient.writeContract({
3264
3321
  address: token,
3265
- abi: ERC20_ABI,
3322
+ abi: erc20TransferWriteAbi(assetSymbol),
3266
3323
  functionName: "transfer",
3267
3324
  args: [safeAddress, amountBigInt],
3268
3325
  chain: chainConfig.chain,
package/dist/index.mjs CHANGED
@@ -479,6 +479,33 @@ var ERC20_ABI = [
479
479
  outputs: [{ name: "", type: "uint256" }]
480
480
  }
481
481
  ];
482
+ var ERC20_TRANSFER_LEGACY_ABI = [
483
+ {
484
+ name: "transfer",
485
+ type: "function",
486
+ stateMutability: "nonpayable",
487
+ inputs: [
488
+ { name: "to", type: "address" },
489
+ { name: "amount", type: "uint256" }
490
+ ],
491
+ outputs: []
492
+ }
493
+ ];
494
+ var ERC20_TRANSFER_WITH_BOOL_ABI = [
495
+ {
496
+ name: "transfer",
497
+ type: "function",
498
+ stateMutability: "nonpayable",
499
+ inputs: [
500
+ { name: "to", type: "address" },
501
+ { name: "amount", type: "uint256" }
502
+ ],
503
+ outputs: [{ name: "", type: "bool" }]
504
+ }
505
+ ];
506
+ function erc20TransferWriteAbi(assetSymbol) {
507
+ return assetSymbol === "USDT" ? ERC20_TRANSFER_LEGACY_ABI : ERC20_TRANSFER_WITH_BOOL_ABI;
508
+ }
482
509
  var IDENTITY_REGISTRY_ABI = parseAbi([
483
510
  "function register() external returns (uint256 agentId)",
484
511
  "function register(string tokenUri) external returns (uint256 agentId)",
@@ -576,8 +603,12 @@ var MIN_PORTFOLIO_BALANCE = {
576
603
  1: {
577
604
  USDC: 10000n * 10n ** 6n,
578
605
  // 10,000 USDC (6 decimals)
579
- EURC: 10000n * 10n ** 6n
606
+ EURC: 10000n * 10n ** 6n,
580
607
  // 10,000 EURC (6 decimals)
608
+ USDT: 10000n * 10n ** 6n,
609
+ // 10,000 USDT (6 decimals)
610
+ PYUSD: 10000n * 10n ** 6n
611
+ // 10,000 PYUSD (6 decimals)
581
612
  },
582
613
  8453: {
583
614
  USDC: 10n * 10n ** 6n,
@@ -683,7 +714,7 @@ var ASSET_CONFIGS = {
683
714
  displayName: "USDC",
684
715
  icon: "/ai-dashboard/usdc-token.png",
685
716
  decimals: 6,
686
- tokenSymbols: ["USDC", "USDC.e", "USDT", "USDT0"],
717
+ tokenSymbols: ["USDC", "USDC.e", "USDT0"],
687
718
  tokenSymbolsByChainId: {
688
719
  1: "USDC",
689
720
  8453: "USDC",
@@ -754,6 +785,36 @@ var ASSET_CONFIGS = {
754
785
  },
755
786
  enabled: true
756
787
  },
788
+ USDT: {
789
+ symbol: "USDT",
790
+ assetType: "usdt",
791
+ displayName: "USDT",
792
+ icon: "https://etherscan.io/token/images/tethernew_32.svg",
793
+ decimals: 6,
794
+ tokenSymbols: ["USDT"],
795
+ tokenSymbolsByChainId: {
796
+ 1: "USDT"
797
+ },
798
+ addresses: {
799
+ 1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
800
+ },
801
+ enabled: true
802
+ },
803
+ PYUSD: {
804
+ symbol: "PYUSD",
805
+ assetType: "pyusd",
806
+ displayName: "PYUSD",
807
+ icon: "https://etherscan.io/token/images/PYUSD_32.png",
808
+ decimals: 6,
809
+ tokenSymbols: ["PYUSD"],
810
+ tokenSymbolsByChainId: {
811
+ 1: "PYUSD"
812
+ },
813
+ addresses: {
814
+ 1: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8"
815
+ },
816
+ enabled: true
817
+ },
757
818
  // Coinbase B20 tokenized NVIDIA equity. Base only, and only reachable through
758
819
  // protocols with delayed withdrawals — see the `yieldmaxxing` strategy.
759
820
  NVDAc: {
@@ -833,6 +894,8 @@ var MANAGED_ASSET_ORDER = [
833
894
  "USDC",
834
895
  "WETH",
835
896
  "EURC",
897
+ "USDT",
898
+ "PYUSD",
836
899
  "NVDAc"
837
900
  ];
838
901
  function getManagedAssets() {
@@ -1091,7 +1154,7 @@ var signSessionKey = async (config, sessions, allPublicClients, signingParams) =
1091
1154
 
1092
1155
  // src/utils/strategy.ts
1093
1156
  var PUBLIC_STRATEGIES = `"conservative", "aggressive" or "yieldmaxxing"`;
1094
- var SUPPORTED_ASSETS = `"USDC", "WETH", "EURC" or "NVDAc"`;
1157
+ var SUPPORTED_ASSETS = Object.entries(ASSET_CONFIGS).filter(([, config]) => config?.enabled === true).map(([symbol]) => `"${symbol}"`).join(", ");
1095
1158
  function toInternalStrategy(publicStrategy) {
1096
1159
  switch (publicStrategy) {
1097
1160
  case "conservative":
@@ -1171,20 +1234,12 @@ function removeUnusedFields(obj) {
1171
1234
  return result;
1172
1235
  }
1173
1236
  function convertAssetInternally(asset) {
1174
- if (asset === "USDC") {
1175
- return "usdc";
1176
- }
1177
- if (asset === "WETH") {
1178
- return "eth";
1179
- }
1180
- if (asset === "EURC") {
1181
- return "eurc";
1182
- }
1183
- if (asset === "NVDAc") {
1184
- return "nvdac";
1237
+ const assetType = ASSET_CONFIGS[asset]?.assetType;
1238
+ if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac") {
1239
+ return assetType;
1185
1240
  }
1186
1241
  throw new Error(
1187
- `Invalid asset: ${asset}. Must be ${SUPPORTED_ASSETS}.`
1242
+ `Invalid asset: ${asset}. Must be one of: ${SUPPORTED_ASSETS}.`
1188
1243
  );
1189
1244
  }
1190
1245
  function convertStrategiesToPublic(array) {
@@ -3137,7 +3192,9 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3137
3192
  throw new Error("Valid amount is required");
3138
3193
  }
3139
3194
  if (!asset) {
3140
- throw new Error("Asset is required (USDC, WETH, or EURC)");
3195
+ throw new Error(
3196
+ "Asset is required (USDC, WETH, EURC, USDT, PYUSD, or NVDAc)"
3197
+ );
3141
3198
  }
3142
3199
  if (strategy !== void 0 && !isValidPublicStrategy(strategy)) {
3143
3200
  throw new Error(
@@ -3213,7 +3270,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3213
3270
  }
3214
3271
  const txHash = await walletClient.writeContract({
3215
3272
  address: token,
3216
- abi: ERC20_ABI,
3273
+ abi: erc20TransferWriteAbi(assetSymbol),
3217
3274
  functionName: "transfer",
3218
3275
  args: [safeAddress, amountBigInt],
3219
3276
  chain: chainConfig.chain,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "TypeScript SDK for self-custodial Zyfai yield agents: discover DeFi opportunities and manage deposits, withdrawals, positions, and strategies across Ethereum, Base, and Arbitrum",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",