@oydual31/more-vaults-sdk 0.2.9 → 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.
@@ -829,6 +829,254 @@ var OFT_ABI = [
829
829
  stateMutability: "view"
830
830
  }
831
831
  ];
832
+ var MULTICALL_ABI = [
833
+ {
834
+ type: "function",
835
+ name: "submitActions",
836
+ inputs: [
837
+ { name: "actionsData", type: "bytes[]" }
838
+ ],
839
+ outputs: [{ name: "nonce", type: "uint256" }],
840
+ stateMutability: "nonpayable"
841
+ },
842
+ {
843
+ type: "function",
844
+ name: "executeActions",
845
+ inputs: [
846
+ { name: "actionsNonce", type: "uint256" }
847
+ ],
848
+ outputs: [],
849
+ stateMutability: "nonpayable"
850
+ },
851
+ {
852
+ type: "function",
853
+ name: "getPendingActions",
854
+ inputs: [
855
+ { name: "actionsNonce", type: "uint256" }
856
+ ],
857
+ outputs: [
858
+ { name: "actionsData", type: "bytes[]" },
859
+ { name: "pendingUntil", type: "uint256" }
860
+ ],
861
+ stateMutability: "view"
862
+ },
863
+ {
864
+ type: "function",
865
+ name: "getCurrentNonce",
866
+ inputs: [],
867
+ outputs: [{ name: "", type: "uint256" }],
868
+ stateMutability: "view"
869
+ },
870
+ {
871
+ type: "function",
872
+ name: "vetoActions",
873
+ inputs: [
874
+ { name: "actionsNonces", type: "uint256[]" }
875
+ ],
876
+ outputs: [],
877
+ stateMutability: "nonpayable"
878
+ }
879
+ ];
880
+ var DEX_ABI = [
881
+ {
882
+ type: "function",
883
+ name: "executeSwap",
884
+ inputs: [
885
+ {
886
+ name: "params",
887
+ type: "tuple",
888
+ components: [
889
+ { name: "targetContract", type: "address" },
890
+ { name: "tokenIn", type: "address" },
891
+ { name: "tokenOut", type: "address" },
892
+ { name: "maxAmountIn", type: "uint256" },
893
+ { name: "minAmountOut", type: "uint256" },
894
+ { name: "swapCallData", type: "bytes" }
895
+ ]
896
+ }
897
+ ],
898
+ outputs: [{ name: "amountOut", type: "uint256" }],
899
+ stateMutability: "nonpayable"
900
+ },
901
+ {
902
+ type: "function",
903
+ name: "executeBatchSwap",
904
+ inputs: [
905
+ {
906
+ name: "params",
907
+ type: "tuple",
908
+ components: [
909
+ {
910
+ name: "swaps",
911
+ type: "tuple[]",
912
+ components: [
913
+ { name: "targetContract", type: "address" },
914
+ { name: "tokenIn", type: "address" },
915
+ { name: "tokenOut", type: "address" },
916
+ { name: "maxAmountIn", type: "uint256" },
917
+ { name: "minAmountOut", type: "uint256" },
918
+ { name: "swapCallData", type: "bytes" }
919
+ ]
920
+ }
921
+ ]
922
+ }
923
+ ],
924
+ outputs: [{ name: "amountsOut", type: "uint256[]" }],
925
+ stateMutability: "nonpayable"
926
+ }
927
+ ];
928
+ var BRIDGE_FACET_ABI = [
929
+ {
930
+ type: "function",
931
+ name: "executeBridging",
932
+ inputs: [
933
+ { name: "adapter", type: "address" },
934
+ { name: "token", type: "address" },
935
+ { name: "amount", type: "uint256" },
936
+ { name: "bridgeSpecificParams", type: "bytes" }
937
+ ],
938
+ outputs: [],
939
+ stateMutability: "payable"
940
+ },
941
+ {
942
+ type: "function",
943
+ name: "initVaultActionRequest",
944
+ inputs: [
945
+ { name: "actionType", type: "uint8" },
946
+ { name: "actionCallData", type: "bytes" },
947
+ { name: "amountLimit", type: "uint256" },
948
+ { name: "extraOptions", type: "bytes" }
949
+ ],
950
+ outputs: [{ name: "guid", type: "bytes32" }],
951
+ stateMutability: "payable"
952
+ },
953
+ {
954
+ type: "function",
955
+ name: "executeRequest",
956
+ inputs: [
957
+ { name: "guid", type: "bytes32" }
958
+ ],
959
+ outputs: [],
960
+ stateMutability: "nonpayable"
961
+ }
962
+ ];
963
+ var ERC7540_FACET_ABI = [
964
+ {
965
+ type: "function",
966
+ name: "erc7540RequestDeposit",
967
+ inputs: [
968
+ { name: "vault", type: "address" },
969
+ { name: "assets", type: "uint256" }
970
+ ],
971
+ outputs: [{ name: "requestId", type: "uint256" }],
972
+ stateMutability: "nonpayable"
973
+ },
974
+ {
975
+ type: "function",
976
+ name: "erc7540RequestRedeem",
977
+ inputs: [
978
+ { name: "vault", type: "address" },
979
+ { name: "shares", type: "uint256" }
980
+ ],
981
+ outputs: [{ name: "requestId", type: "uint256" }],
982
+ stateMutability: "nonpayable"
983
+ },
984
+ {
985
+ type: "function",
986
+ name: "erc7540Deposit",
987
+ inputs: [
988
+ { name: "vault", type: "address" },
989
+ { name: "assets", type: "uint256" }
990
+ ],
991
+ outputs: [{ name: "shares", type: "uint256" }],
992
+ stateMutability: "nonpayable"
993
+ },
994
+ {
995
+ type: "function",
996
+ name: "erc7540Redeem",
997
+ inputs: [
998
+ { name: "vault", type: "address" },
999
+ { name: "shares", type: "uint256" }
1000
+ ],
1001
+ outputs: [{ name: "assets", type: "uint256" }],
1002
+ stateMutability: "nonpayable"
1003
+ }
1004
+ ];
1005
+ var CURATOR_CONFIG_ABI = [
1006
+ {
1007
+ type: "function",
1008
+ name: "curator",
1009
+ inputs: [],
1010
+ outputs: [{ name: "", type: "address" }],
1011
+ stateMutability: "view"
1012
+ },
1013
+ {
1014
+ type: "function",
1015
+ name: "timeLockPeriod",
1016
+ inputs: [],
1017
+ outputs: [{ name: "", type: "uint256" }],
1018
+ stateMutability: "view"
1019
+ },
1020
+ {
1021
+ type: "function",
1022
+ name: "getAvailableAssets",
1023
+ inputs: [],
1024
+ outputs: [{ name: "", type: "address[]" }],
1025
+ stateMutability: "view"
1026
+ },
1027
+ {
1028
+ type: "function",
1029
+ name: "getMaxSlippagePercent",
1030
+ inputs: [],
1031
+ outputs: [{ name: "", type: "uint256" }],
1032
+ stateMutability: "view"
1033
+ },
1034
+ {
1035
+ type: "function",
1036
+ name: "getCrossChainAccountingManager",
1037
+ inputs: [],
1038
+ outputs: [{ name: "", type: "address" }],
1039
+ stateMutability: "view"
1040
+ },
1041
+ {
1042
+ type: "function",
1043
+ name: "paused",
1044
+ inputs: [],
1045
+ outputs: [{ name: "", type: "bool" }],
1046
+ stateMutability: "view"
1047
+ }
1048
+ ];
1049
+ var LZ_ADAPTER_ABI = [
1050
+ {
1051
+ type: "function",
1052
+ name: "quoteBridgeFee",
1053
+ inputs: [
1054
+ { name: "bridgeSpecificParams", type: "bytes" }
1055
+ ],
1056
+ outputs: [{ name: "nativeFee", type: "uint256" }],
1057
+ stateMutability: "view"
1058
+ },
1059
+ {
1060
+ type: "function",
1061
+ name: "quoteReadFee",
1062
+ inputs: [
1063
+ { name: "vaults", type: "address[]" },
1064
+ { name: "eids", type: "uint32[]" },
1065
+ { name: "_extraOptions", type: "bytes" }
1066
+ ],
1067
+ outputs: [
1068
+ {
1069
+ name: "fee",
1070
+ type: "tuple",
1071
+ components: [
1072
+ { name: "nativeFee", type: "uint256" },
1073
+ { name: "lzTokenFee", type: "uint256" }
1074
+ ]
1075
+ }
1076
+ ],
1077
+ stateMutability: "view"
1078
+ }
1079
+ ];
832
1080
  var LZ_ENDPOINT_ABI = [
833
1081
  {
834
1082
  type: "function",
@@ -3203,6 +3451,66 @@ async function getVaultDistributionWithTopology(hubClient, vault) {
3203
3451
  spokeChainIds: topology.spokeChainIds
3204
3452
  };
3205
3453
  }
3454
+ async function getCuratorVaultStatus(publicClient, vault) {
3455
+ const v = viem.getAddress(vault);
3456
+ const [
3457
+ curator,
3458
+ timeLockPeriod,
3459
+ maxSlippagePercent,
3460
+ currentNonce,
3461
+ availableAssets,
3462
+ lzAdapter,
3463
+ paused
3464
+ ] = await publicClient.multicall({
3465
+ contracts: [
3466
+ { address: v, abi: CURATOR_CONFIG_ABI, functionName: "curator" },
3467
+ { address: v, abi: CURATOR_CONFIG_ABI, functionName: "timeLockPeriod" },
3468
+ { address: v, abi: CURATOR_CONFIG_ABI, functionName: "getMaxSlippagePercent" },
3469
+ { address: v, abi: MULTICALL_ABI, functionName: "getCurrentNonce" },
3470
+ { address: v, abi: CURATOR_CONFIG_ABI, functionName: "getAvailableAssets" },
3471
+ { address: v, abi: CURATOR_CONFIG_ABI, functionName: "getCrossChainAccountingManager" },
3472
+ { address: v, abi: CURATOR_CONFIG_ABI, functionName: "paused" }
3473
+ ],
3474
+ allowFailure: false
3475
+ });
3476
+ return {
3477
+ curator: viem.getAddress(curator),
3478
+ timeLockPeriod,
3479
+ maxSlippagePercent,
3480
+ currentNonce,
3481
+ availableAssets: availableAssets.map(viem.getAddress),
3482
+ lzAdapter: viem.getAddress(lzAdapter),
3483
+ paused
3484
+ };
3485
+ }
3486
+ async function getPendingActions(publicClient, vault, nonce) {
3487
+ const v = viem.getAddress(vault);
3488
+ const [actionsResult, block] = await Promise.all([
3489
+ publicClient.readContract({
3490
+ address: v,
3491
+ abi: MULTICALL_ABI,
3492
+ functionName: "getPendingActions",
3493
+ args: [nonce]
3494
+ }),
3495
+ publicClient.getBlock()
3496
+ ]);
3497
+ const [actionsData, pendingUntil] = actionsResult;
3498
+ const isExecutable = pendingUntil > 0n && block.timestamp >= pendingUntil;
3499
+ return {
3500
+ nonce,
3501
+ actionsData,
3502
+ pendingUntil,
3503
+ isExecutable
3504
+ };
3505
+ }
3506
+ async function isCurator(publicClient, vault, address) {
3507
+ const curatorAddress = await publicClient.readContract({
3508
+ address: viem.getAddress(vault),
3509
+ abi: CURATOR_CONFIG_ABI,
3510
+ functionName: "curator"
3511
+ });
3512
+ return viem.getAddress(curatorAddress) === viem.getAddress(address);
3513
+ }
3206
3514
 
3207
3515
  // src/viem/wagmiCompat.ts
3208
3516
  function asSdkClient(client) {
@@ -3212,19 +3520,25 @@ function asSdkClient(client) {
3212
3520
 
3213
3521
  exports.ActionType = ActionType;
3214
3522
  exports.BRIDGE_ABI = BRIDGE_ABI;
3523
+ exports.BRIDGE_FACET_ABI = BRIDGE_FACET_ABI;
3215
3524
  exports.CCManagerNotConfiguredError = CCManagerNotConfiguredError;
3216
3525
  exports.CHAIN_IDS = CHAIN_IDS;
3217
3526
  exports.CHAIN_ID_TO_EID = CHAIN_ID_TO_EID;
3218
3527
  exports.CONFIG_ABI = CONFIG_ABI;
3528
+ exports.CURATOR_CONFIG_ABI = CURATOR_CONFIG_ABI;
3219
3529
  exports.CapacityFullError = CapacityFullError;
3530
+ exports.DEX_ABI = DEX_ABI;
3220
3531
  exports.EID_TO_CHAIN_ID = EID_TO_CHAIN_ID;
3221
3532
  exports.ERC20_ABI = ERC20_ABI;
3533
+ exports.ERC7540_FACET_ABI = ERC7540_FACET_ABI;
3222
3534
  exports.EscrowNotConfiguredError = EscrowNotConfiguredError;
3223
3535
  exports.InsufficientLiquidityError = InsufficientLiquidityError;
3536
+ exports.LZ_ADAPTER_ABI = LZ_ADAPTER_ABI;
3224
3537
  exports.LZ_EIDS = LZ_EIDS;
3225
3538
  exports.LZ_ENDPOINT_ABI = LZ_ENDPOINT_ABI;
3226
3539
  exports.LZ_TIMEOUTS = LZ_TIMEOUTS;
3227
3540
  exports.METADATA_ABI = METADATA_ABI;
3541
+ exports.MULTICALL_ABI = MULTICALL_ABI;
3228
3542
  exports.MissingEscrowAddressError = MissingEscrowAddressError;
3229
3543
  exports.MoreVaultsError = MoreVaultsError;
3230
3544
  exports.NATIVE_SYMBOL = NATIVE_SYMBOL;
@@ -3255,10 +3569,12 @@ exports.executeCompose = executeCompose;
3255
3569
  exports.getAllVaultChainIds = getAllVaultChainIds;
3256
3570
  exports.getAsyncRequestStatus = getAsyncRequestStatus;
3257
3571
  exports.getAsyncRequestStatusLabel = getAsyncRequestStatusLabel;
3572
+ exports.getCuratorVaultStatus = getCuratorVaultStatus;
3258
3573
  exports.getFullVaultTopology = getFullVaultTopology;
3259
3574
  exports.getInboundRoutes = getInboundRoutes;
3260
3575
  exports.getMaxWithdrawable = getMaxWithdrawable;
3261
3576
  exports.getOutboundRoutes = getOutboundRoutes;
3577
+ exports.getPendingActions = getPendingActions;
3262
3578
  exports.getUserBalances = getUserBalances;
3263
3579
  exports.getUserBalancesForRoutes = getUserBalancesForRoutes;
3264
3580
  exports.getUserPosition = getUserPosition;
@@ -3271,6 +3587,7 @@ exports.getVaultSummary = getVaultSummary;
3271
3587
  exports.getVaultTopology = getVaultTopology;
3272
3588
  exports.getWithdrawalRequest = getWithdrawalRequest;
3273
3589
  exports.isAsyncMode = isAsyncMode;
3590
+ exports.isCurator = isCurator;
3274
3591
  exports.isOnHubChain = isOnHubChain;
3275
3592
  exports.mintAsync = mintAsync;
3276
3593
  exports.preflightAsync = preflightAsync;