@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.
- package/README.md +25 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +317 -0
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +453 -1
- package/dist/viem/index.d.ts +453 -1
- package/dist/viem/index.js +309 -1
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/abis.ts +278 -0
- package/src/viem/curatorStatus.ts +124 -0
- package/src/viem/index.ts +20 -0
- package/src/viem/types.ts +57 -0
package/dist/viem/index.js
CHANGED
|
@@ -827,6 +827,254 @@ var OFT_ABI = [
|
|
|
827
827
|
stateMutability: "view"
|
|
828
828
|
}
|
|
829
829
|
];
|
|
830
|
+
var MULTICALL_ABI = [
|
|
831
|
+
{
|
|
832
|
+
type: "function",
|
|
833
|
+
name: "submitActions",
|
|
834
|
+
inputs: [
|
|
835
|
+
{ name: "actionsData", type: "bytes[]" }
|
|
836
|
+
],
|
|
837
|
+
outputs: [{ name: "nonce", type: "uint256" }],
|
|
838
|
+
stateMutability: "nonpayable"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
type: "function",
|
|
842
|
+
name: "executeActions",
|
|
843
|
+
inputs: [
|
|
844
|
+
{ name: "actionsNonce", type: "uint256" }
|
|
845
|
+
],
|
|
846
|
+
outputs: [],
|
|
847
|
+
stateMutability: "nonpayable"
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
type: "function",
|
|
851
|
+
name: "getPendingActions",
|
|
852
|
+
inputs: [
|
|
853
|
+
{ name: "actionsNonce", type: "uint256" }
|
|
854
|
+
],
|
|
855
|
+
outputs: [
|
|
856
|
+
{ name: "actionsData", type: "bytes[]" },
|
|
857
|
+
{ name: "pendingUntil", type: "uint256" }
|
|
858
|
+
],
|
|
859
|
+
stateMutability: "view"
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
type: "function",
|
|
863
|
+
name: "getCurrentNonce",
|
|
864
|
+
inputs: [],
|
|
865
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
866
|
+
stateMutability: "view"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
type: "function",
|
|
870
|
+
name: "vetoActions",
|
|
871
|
+
inputs: [
|
|
872
|
+
{ name: "actionsNonces", type: "uint256[]" }
|
|
873
|
+
],
|
|
874
|
+
outputs: [],
|
|
875
|
+
stateMutability: "nonpayable"
|
|
876
|
+
}
|
|
877
|
+
];
|
|
878
|
+
var DEX_ABI = [
|
|
879
|
+
{
|
|
880
|
+
type: "function",
|
|
881
|
+
name: "executeSwap",
|
|
882
|
+
inputs: [
|
|
883
|
+
{
|
|
884
|
+
name: "params",
|
|
885
|
+
type: "tuple",
|
|
886
|
+
components: [
|
|
887
|
+
{ name: "targetContract", type: "address" },
|
|
888
|
+
{ name: "tokenIn", type: "address" },
|
|
889
|
+
{ name: "tokenOut", type: "address" },
|
|
890
|
+
{ name: "maxAmountIn", type: "uint256" },
|
|
891
|
+
{ name: "minAmountOut", type: "uint256" },
|
|
892
|
+
{ name: "swapCallData", type: "bytes" }
|
|
893
|
+
]
|
|
894
|
+
}
|
|
895
|
+
],
|
|
896
|
+
outputs: [{ name: "amountOut", type: "uint256" }],
|
|
897
|
+
stateMutability: "nonpayable"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
type: "function",
|
|
901
|
+
name: "executeBatchSwap",
|
|
902
|
+
inputs: [
|
|
903
|
+
{
|
|
904
|
+
name: "params",
|
|
905
|
+
type: "tuple",
|
|
906
|
+
components: [
|
|
907
|
+
{
|
|
908
|
+
name: "swaps",
|
|
909
|
+
type: "tuple[]",
|
|
910
|
+
components: [
|
|
911
|
+
{ name: "targetContract", type: "address" },
|
|
912
|
+
{ name: "tokenIn", type: "address" },
|
|
913
|
+
{ name: "tokenOut", type: "address" },
|
|
914
|
+
{ name: "maxAmountIn", type: "uint256" },
|
|
915
|
+
{ name: "minAmountOut", type: "uint256" },
|
|
916
|
+
{ name: "swapCallData", type: "bytes" }
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
]
|
|
920
|
+
}
|
|
921
|
+
],
|
|
922
|
+
outputs: [{ name: "amountsOut", type: "uint256[]" }],
|
|
923
|
+
stateMutability: "nonpayable"
|
|
924
|
+
}
|
|
925
|
+
];
|
|
926
|
+
var BRIDGE_FACET_ABI = [
|
|
927
|
+
{
|
|
928
|
+
type: "function",
|
|
929
|
+
name: "executeBridging",
|
|
930
|
+
inputs: [
|
|
931
|
+
{ name: "adapter", type: "address" },
|
|
932
|
+
{ name: "token", type: "address" },
|
|
933
|
+
{ name: "amount", type: "uint256" },
|
|
934
|
+
{ name: "bridgeSpecificParams", type: "bytes" }
|
|
935
|
+
],
|
|
936
|
+
outputs: [],
|
|
937
|
+
stateMutability: "payable"
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
type: "function",
|
|
941
|
+
name: "initVaultActionRequest",
|
|
942
|
+
inputs: [
|
|
943
|
+
{ name: "actionType", type: "uint8" },
|
|
944
|
+
{ name: "actionCallData", type: "bytes" },
|
|
945
|
+
{ name: "amountLimit", type: "uint256" },
|
|
946
|
+
{ name: "extraOptions", type: "bytes" }
|
|
947
|
+
],
|
|
948
|
+
outputs: [{ name: "guid", type: "bytes32" }],
|
|
949
|
+
stateMutability: "payable"
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
type: "function",
|
|
953
|
+
name: "executeRequest",
|
|
954
|
+
inputs: [
|
|
955
|
+
{ name: "guid", type: "bytes32" }
|
|
956
|
+
],
|
|
957
|
+
outputs: [],
|
|
958
|
+
stateMutability: "nonpayable"
|
|
959
|
+
}
|
|
960
|
+
];
|
|
961
|
+
var ERC7540_FACET_ABI = [
|
|
962
|
+
{
|
|
963
|
+
type: "function",
|
|
964
|
+
name: "erc7540RequestDeposit",
|
|
965
|
+
inputs: [
|
|
966
|
+
{ name: "vault", type: "address" },
|
|
967
|
+
{ name: "assets", type: "uint256" }
|
|
968
|
+
],
|
|
969
|
+
outputs: [{ name: "requestId", type: "uint256" }],
|
|
970
|
+
stateMutability: "nonpayable"
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
type: "function",
|
|
974
|
+
name: "erc7540RequestRedeem",
|
|
975
|
+
inputs: [
|
|
976
|
+
{ name: "vault", type: "address" },
|
|
977
|
+
{ name: "shares", type: "uint256" }
|
|
978
|
+
],
|
|
979
|
+
outputs: [{ name: "requestId", type: "uint256" }],
|
|
980
|
+
stateMutability: "nonpayable"
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
type: "function",
|
|
984
|
+
name: "erc7540Deposit",
|
|
985
|
+
inputs: [
|
|
986
|
+
{ name: "vault", type: "address" },
|
|
987
|
+
{ name: "assets", type: "uint256" }
|
|
988
|
+
],
|
|
989
|
+
outputs: [{ name: "shares", type: "uint256" }],
|
|
990
|
+
stateMutability: "nonpayable"
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
type: "function",
|
|
994
|
+
name: "erc7540Redeem",
|
|
995
|
+
inputs: [
|
|
996
|
+
{ name: "vault", type: "address" },
|
|
997
|
+
{ name: "shares", type: "uint256" }
|
|
998
|
+
],
|
|
999
|
+
outputs: [{ name: "assets", type: "uint256" }],
|
|
1000
|
+
stateMutability: "nonpayable"
|
|
1001
|
+
}
|
|
1002
|
+
];
|
|
1003
|
+
var CURATOR_CONFIG_ABI = [
|
|
1004
|
+
{
|
|
1005
|
+
type: "function",
|
|
1006
|
+
name: "curator",
|
|
1007
|
+
inputs: [],
|
|
1008
|
+
outputs: [{ name: "", type: "address" }],
|
|
1009
|
+
stateMutability: "view"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
type: "function",
|
|
1013
|
+
name: "timeLockPeriod",
|
|
1014
|
+
inputs: [],
|
|
1015
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
1016
|
+
stateMutability: "view"
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
type: "function",
|
|
1020
|
+
name: "getAvailableAssets",
|
|
1021
|
+
inputs: [],
|
|
1022
|
+
outputs: [{ name: "", type: "address[]" }],
|
|
1023
|
+
stateMutability: "view"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
type: "function",
|
|
1027
|
+
name: "getMaxSlippagePercent",
|
|
1028
|
+
inputs: [],
|
|
1029
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
1030
|
+
stateMutability: "view"
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
type: "function",
|
|
1034
|
+
name: "getCrossChainAccountingManager",
|
|
1035
|
+
inputs: [],
|
|
1036
|
+
outputs: [{ name: "", type: "address" }],
|
|
1037
|
+
stateMutability: "view"
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
type: "function",
|
|
1041
|
+
name: "paused",
|
|
1042
|
+
inputs: [],
|
|
1043
|
+
outputs: [{ name: "", type: "bool" }],
|
|
1044
|
+
stateMutability: "view"
|
|
1045
|
+
}
|
|
1046
|
+
];
|
|
1047
|
+
var LZ_ADAPTER_ABI = [
|
|
1048
|
+
{
|
|
1049
|
+
type: "function",
|
|
1050
|
+
name: "quoteBridgeFee",
|
|
1051
|
+
inputs: [
|
|
1052
|
+
{ name: "bridgeSpecificParams", type: "bytes" }
|
|
1053
|
+
],
|
|
1054
|
+
outputs: [{ name: "nativeFee", type: "uint256" }],
|
|
1055
|
+
stateMutability: "view"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
type: "function",
|
|
1059
|
+
name: "quoteReadFee",
|
|
1060
|
+
inputs: [
|
|
1061
|
+
{ name: "vaults", type: "address[]" },
|
|
1062
|
+
{ name: "eids", type: "uint32[]" },
|
|
1063
|
+
{ name: "_extraOptions", type: "bytes" }
|
|
1064
|
+
],
|
|
1065
|
+
outputs: [
|
|
1066
|
+
{
|
|
1067
|
+
name: "fee",
|
|
1068
|
+
type: "tuple",
|
|
1069
|
+
components: [
|
|
1070
|
+
{ name: "nativeFee", type: "uint256" },
|
|
1071
|
+
{ name: "lzTokenFee", type: "uint256" }
|
|
1072
|
+
]
|
|
1073
|
+
}
|
|
1074
|
+
],
|
|
1075
|
+
stateMutability: "view"
|
|
1076
|
+
}
|
|
1077
|
+
];
|
|
830
1078
|
var LZ_ENDPOINT_ABI = [
|
|
831
1079
|
{
|
|
832
1080
|
type: "function",
|
|
@@ -3201,6 +3449,66 @@ async function getVaultDistributionWithTopology(hubClient, vault) {
|
|
|
3201
3449
|
spokeChainIds: topology.spokeChainIds
|
|
3202
3450
|
};
|
|
3203
3451
|
}
|
|
3452
|
+
async function getCuratorVaultStatus(publicClient, vault) {
|
|
3453
|
+
const v = getAddress(vault);
|
|
3454
|
+
const [
|
|
3455
|
+
curator,
|
|
3456
|
+
timeLockPeriod,
|
|
3457
|
+
maxSlippagePercent,
|
|
3458
|
+
currentNonce,
|
|
3459
|
+
availableAssets,
|
|
3460
|
+
lzAdapter,
|
|
3461
|
+
paused
|
|
3462
|
+
] = await publicClient.multicall({
|
|
3463
|
+
contracts: [
|
|
3464
|
+
{ address: v, abi: CURATOR_CONFIG_ABI, functionName: "curator" },
|
|
3465
|
+
{ address: v, abi: CURATOR_CONFIG_ABI, functionName: "timeLockPeriod" },
|
|
3466
|
+
{ address: v, abi: CURATOR_CONFIG_ABI, functionName: "getMaxSlippagePercent" },
|
|
3467
|
+
{ address: v, abi: MULTICALL_ABI, functionName: "getCurrentNonce" },
|
|
3468
|
+
{ address: v, abi: CURATOR_CONFIG_ABI, functionName: "getAvailableAssets" },
|
|
3469
|
+
{ address: v, abi: CURATOR_CONFIG_ABI, functionName: "getCrossChainAccountingManager" },
|
|
3470
|
+
{ address: v, abi: CURATOR_CONFIG_ABI, functionName: "paused" }
|
|
3471
|
+
],
|
|
3472
|
+
allowFailure: false
|
|
3473
|
+
});
|
|
3474
|
+
return {
|
|
3475
|
+
curator: getAddress(curator),
|
|
3476
|
+
timeLockPeriod,
|
|
3477
|
+
maxSlippagePercent,
|
|
3478
|
+
currentNonce,
|
|
3479
|
+
availableAssets: availableAssets.map(getAddress),
|
|
3480
|
+
lzAdapter: getAddress(lzAdapter),
|
|
3481
|
+
paused
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3484
|
+
async function getPendingActions(publicClient, vault, nonce) {
|
|
3485
|
+
const v = getAddress(vault);
|
|
3486
|
+
const [actionsResult, block] = await Promise.all([
|
|
3487
|
+
publicClient.readContract({
|
|
3488
|
+
address: v,
|
|
3489
|
+
abi: MULTICALL_ABI,
|
|
3490
|
+
functionName: "getPendingActions",
|
|
3491
|
+
args: [nonce]
|
|
3492
|
+
}),
|
|
3493
|
+
publicClient.getBlock()
|
|
3494
|
+
]);
|
|
3495
|
+
const [actionsData, pendingUntil] = actionsResult;
|
|
3496
|
+
const isExecutable = pendingUntil > 0n && block.timestamp >= pendingUntil;
|
|
3497
|
+
return {
|
|
3498
|
+
nonce,
|
|
3499
|
+
actionsData,
|
|
3500
|
+
pendingUntil,
|
|
3501
|
+
isExecutable
|
|
3502
|
+
};
|
|
3503
|
+
}
|
|
3504
|
+
async function isCurator(publicClient, vault, address) {
|
|
3505
|
+
const curatorAddress = await publicClient.readContract({
|
|
3506
|
+
address: getAddress(vault),
|
|
3507
|
+
abi: CURATOR_CONFIG_ABI,
|
|
3508
|
+
functionName: "curator"
|
|
3509
|
+
});
|
|
3510
|
+
return getAddress(curatorAddress) === getAddress(address);
|
|
3511
|
+
}
|
|
3204
3512
|
|
|
3205
3513
|
// src/viem/wagmiCompat.ts
|
|
3206
3514
|
function asSdkClient(client) {
|
|
@@ -3208,6 +3516,6 @@ function asSdkClient(client) {
|
|
|
3208
3516
|
return client;
|
|
3209
3517
|
}
|
|
3210
3518
|
|
|
3211
|
-
export { ActionType, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, STARGATE_TAXI_CMD, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, canDeposit, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, ensureAllowance, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3519
|
+
export { ActionType, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, DEX_ABI, EID_TO_CHAIN_ID, ERC20_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, STARGATE_TAXI_CMD, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, canDeposit, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, ensureAllowance, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3212
3520
|
//# sourceMappingURL=index.js.map
|
|
3213
3521
|
//# sourceMappingURL=index.js.map
|