@oydual31/more-vaults-sdk 0.2.8 → 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 +21 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +21 -2
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +338 -2
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +475 -4
- package/dist/viem/index.d.ts +475 -4
- package/dist/viem/index.js +330 -3
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/abis.ts +278 -0
- package/src/viem/chains.ts +16 -3
- 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.cjs
CHANGED
|
@@ -98,10 +98,12 @@ var OFT_ROUTES = {
|
|
|
98
98
|
]: { oft: "0x19cFCE47eD54a88614648DC3f19A5980097007dD", token: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" }
|
|
99
99
|
},
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* USDF — USD Flow OFT. Bridges PYUSD (Ethereum) ↔ USDF (Flow EVM).
|
|
102
|
+
* On Ethereum: underlying is PayPal USD (PYUSD, 0x6c3ea9...).
|
|
103
|
+
* On Flow: the OFT itself IS the token (USDF, 0x2aabea...).
|
|
102
104
|
* Routes verified: Eth→Flow ✓
|
|
103
105
|
*/
|
|
104
|
-
|
|
106
|
+
USDF: {
|
|
105
107
|
[
|
|
106
108
|
747
|
|
107
109
|
/* flowEVMMainnet */
|
|
@@ -111,6 +113,23 @@ var OFT_ROUTES = {
|
|
|
111
113
|
/* ethereum */
|
|
112
114
|
]: { oft: "0xfa0e06b54986ad96de87a8c56fea76fbd8d493f8", token: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8" }
|
|
113
115
|
},
|
|
116
|
+
/**
|
|
117
|
+
* PYUSD — PayPal USD bridged via OFTAdapter (Paxos / LayerZero).
|
|
118
|
+
* Lock/mint architecture: locks PYUSD on Arbitrum, mints PYUSD0 on Flow EVM.
|
|
119
|
+
* On Arbitrum: OFTAdapter wraps native PYUSD (0x46850a...).
|
|
120
|
+
* On Flow: OFTAdapter wraps PYUSD0 (0x99aF3E...), which is the native Paxos token.
|
|
121
|
+
* Routes verified: Arb↔Flow ✓ (EID 30336). No Eth or Base peers.
|
|
122
|
+
*/
|
|
123
|
+
PYUSD: {
|
|
124
|
+
[
|
|
125
|
+
747
|
|
126
|
+
/* flowEVMMainnet */
|
|
127
|
+
]: { oft: "0x26d27d5AF2F6f1c14F40013C8619d97aaf015509", token: "0x99aF3EeA856556646C98c8B9b2548Fe815240750" },
|
|
128
|
+
[
|
|
129
|
+
42161
|
|
130
|
+
/* arbitrum */
|
|
131
|
+
]: { oft: "0x3CD2b89C49D130C08f1d683225b2e5DeB63ff876", token: "0x46850aD61C2B7d64d08c9C754F45254596696984" }
|
|
132
|
+
},
|
|
114
133
|
/**
|
|
115
134
|
* WFLOW — Wrapped FLOW NativeOFTAdapter (issued by Flow Foundation).
|
|
116
135
|
* Routes verified: Eth→Flow ✓
|
|
@@ -810,6 +829,254 @@ var OFT_ABI = [
|
|
|
810
829
|
stateMutability: "view"
|
|
811
830
|
}
|
|
812
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
|
+
];
|
|
813
1080
|
var LZ_ENDPOINT_ABI = [
|
|
814
1081
|
{
|
|
815
1082
|
type: "function",
|
|
@@ -3184,6 +3451,66 @@ async function getVaultDistributionWithTopology(hubClient, vault) {
|
|
|
3184
3451
|
spokeChainIds: topology.spokeChainIds
|
|
3185
3452
|
};
|
|
3186
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
|
+
}
|
|
3187
3514
|
|
|
3188
3515
|
// src/viem/wagmiCompat.ts
|
|
3189
3516
|
function asSdkClient(client) {
|
|
@@ -3193,19 +3520,25 @@ function asSdkClient(client) {
|
|
|
3193
3520
|
|
|
3194
3521
|
exports.ActionType = ActionType;
|
|
3195
3522
|
exports.BRIDGE_ABI = BRIDGE_ABI;
|
|
3523
|
+
exports.BRIDGE_FACET_ABI = BRIDGE_FACET_ABI;
|
|
3196
3524
|
exports.CCManagerNotConfiguredError = CCManagerNotConfiguredError;
|
|
3197
3525
|
exports.CHAIN_IDS = CHAIN_IDS;
|
|
3198
3526
|
exports.CHAIN_ID_TO_EID = CHAIN_ID_TO_EID;
|
|
3199
3527
|
exports.CONFIG_ABI = CONFIG_ABI;
|
|
3528
|
+
exports.CURATOR_CONFIG_ABI = CURATOR_CONFIG_ABI;
|
|
3200
3529
|
exports.CapacityFullError = CapacityFullError;
|
|
3530
|
+
exports.DEX_ABI = DEX_ABI;
|
|
3201
3531
|
exports.EID_TO_CHAIN_ID = EID_TO_CHAIN_ID;
|
|
3202
3532
|
exports.ERC20_ABI = ERC20_ABI;
|
|
3533
|
+
exports.ERC7540_FACET_ABI = ERC7540_FACET_ABI;
|
|
3203
3534
|
exports.EscrowNotConfiguredError = EscrowNotConfiguredError;
|
|
3204
3535
|
exports.InsufficientLiquidityError = InsufficientLiquidityError;
|
|
3536
|
+
exports.LZ_ADAPTER_ABI = LZ_ADAPTER_ABI;
|
|
3205
3537
|
exports.LZ_EIDS = LZ_EIDS;
|
|
3206
3538
|
exports.LZ_ENDPOINT_ABI = LZ_ENDPOINT_ABI;
|
|
3207
3539
|
exports.LZ_TIMEOUTS = LZ_TIMEOUTS;
|
|
3208
3540
|
exports.METADATA_ABI = METADATA_ABI;
|
|
3541
|
+
exports.MULTICALL_ABI = MULTICALL_ABI;
|
|
3209
3542
|
exports.MissingEscrowAddressError = MissingEscrowAddressError;
|
|
3210
3543
|
exports.MoreVaultsError = MoreVaultsError;
|
|
3211
3544
|
exports.NATIVE_SYMBOL = NATIVE_SYMBOL;
|
|
@@ -3236,10 +3569,12 @@ exports.executeCompose = executeCompose;
|
|
|
3236
3569
|
exports.getAllVaultChainIds = getAllVaultChainIds;
|
|
3237
3570
|
exports.getAsyncRequestStatus = getAsyncRequestStatus;
|
|
3238
3571
|
exports.getAsyncRequestStatusLabel = getAsyncRequestStatusLabel;
|
|
3572
|
+
exports.getCuratorVaultStatus = getCuratorVaultStatus;
|
|
3239
3573
|
exports.getFullVaultTopology = getFullVaultTopology;
|
|
3240
3574
|
exports.getInboundRoutes = getInboundRoutes;
|
|
3241
3575
|
exports.getMaxWithdrawable = getMaxWithdrawable;
|
|
3242
3576
|
exports.getOutboundRoutes = getOutboundRoutes;
|
|
3577
|
+
exports.getPendingActions = getPendingActions;
|
|
3243
3578
|
exports.getUserBalances = getUserBalances;
|
|
3244
3579
|
exports.getUserBalancesForRoutes = getUserBalancesForRoutes;
|
|
3245
3580
|
exports.getUserPosition = getUserPosition;
|
|
@@ -3252,6 +3587,7 @@ exports.getVaultSummary = getVaultSummary;
|
|
|
3252
3587
|
exports.getVaultTopology = getVaultTopology;
|
|
3253
3588
|
exports.getWithdrawalRequest = getWithdrawalRequest;
|
|
3254
3589
|
exports.isAsyncMode = isAsyncMode;
|
|
3590
|
+
exports.isCurator = isCurator;
|
|
3255
3591
|
exports.isOnHubChain = isOnHubChain;
|
|
3256
3592
|
exports.mintAsync = mintAsync;
|
|
3257
3593
|
exports.preflightAsync = preflightAsync;
|