@vaultum/sdk 0.1.5 → 0.1.7
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 +131 -6
- package/dist/index.d.ts +131 -6
- package/dist/index.js +80 -6
- package/dist/index.mjs +80 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ interface AuthTokenResponse<TUser = ApiUser> {
|
|
|
39
39
|
token: string;
|
|
40
40
|
type: string;
|
|
41
41
|
abilities?: string[];
|
|
42
|
+
expires_in?: number;
|
|
42
43
|
requires_wallet?: boolean;
|
|
43
44
|
}
|
|
44
45
|
interface AuthMeResponse<TUser = ApiUser> {
|
|
@@ -48,13 +49,15 @@ interface LogoutResponse {
|
|
|
48
49
|
message: string;
|
|
49
50
|
}
|
|
50
51
|
interface WalletChallengeResponse {
|
|
52
|
+
challengeId: string;
|
|
51
53
|
message: string;
|
|
52
|
-
|
|
54
|
+
digest: Hex;
|
|
55
|
+
expiresAt?: string;
|
|
53
56
|
}
|
|
54
57
|
interface UserWalletInfo {
|
|
55
58
|
address: Address;
|
|
56
|
-
chainId
|
|
57
|
-
type
|
|
59
|
+
chainId?: number;
|
|
60
|
+
type?: string;
|
|
58
61
|
}
|
|
59
62
|
interface WalletsResponse {
|
|
60
63
|
wallets: UserWalletInfo[];
|
|
@@ -108,6 +111,19 @@ interface WaitOptions {
|
|
|
108
111
|
signal?: AbortSignal;
|
|
109
112
|
onProgress?: (result: OperationResult) => void;
|
|
110
113
|
}
|
|
114
|
+
interface VaultDeployment {
|
|
115
|
+
chainId: number;
|
|
116
|
+
deployed: boolean;
|
|
117
|
+
}
|
|
118
|
+
interface VaultGroup {
|
|
119
|
+
id: number;
|
|
120
|
+
vaultIndex: number;
|
|
121
|
+
address: Address;
|
|
122
|
+
deployments: VaultDeployment[];
|
|
123
|
+
}
|
|
124
|
+
interface VaultGroupsResponse {
|
|
125
|
+
vaultGroups: VaultGroup[];
|
|
126
|
+
}
|
|
111
127
|
interface AccountCreateResult {
|
|
112
128
|
chain: string;
|
|
113
129
|
factory: Address;
|
|
@@ -119,6 +135,9 @@ interface AccountCreateResult {
|
|
|
119
135
|
salt: Hex;
|
|
120
136
|
};
|
|
121
137
|
userOp: Record<string, unknown>;
|
|
138
|
+
userOpHash: Hex;
|
|
139
|
+
vaultGroupId: number;
|
|
140
|
+
vaultIndex: number;
|
|
122
141
|
}
|
|
123
142
|
interface AccountVerifyResult {
|
|
124
143
|
address: Address;
|
|
@@ -850,6 +869,59 @@ interface AddressCapabilities {
|
|
|
850
869
|
chains: number[];
|
|
851
870
|
contracts: string[];
|
|
852
871
|
}
|
|
872
|
+
interface PasskeySignupResponse extends AuthTokenResponse {
|
|
873
|
+
wallet?: {
|
|
874
|
+
address?: string;
|
|
875
|
+
};
|
|
876
|
+
turnkey?: {
|
|
877
|
+
subOrganizationId?: string;
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
interface OtpInitResponse {
|
|
881
|
+
ok: boolean;
|
|
882
|
+
}
|
|
883
|
+
interface OtpVerifyResponse extends AuthTokenResponse {
|
|
884
|
+
turnkey?: {
|
|
885
|
+
verificationToken?: string;
|
|
886
|
+
organizationId?: string;
|
|
887
|
+
session?: string;
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
interface PasskeySuborgsResponse {
|
|
891
|
+
organizationIds: string[];
|
|
892
|
+
}
|
|
893
|
+
interface PortfolioTokenItem {
|
|
894
|
+
chain?: string | null;
|
|
895
|
+
network?: string | null;
|
|
896
|
+
tokenAddress?: string | null;
|
|
897
|
+
isNative: boolean;
|
|
898
|
+
rawBalance?: string | null;
|
|
899
|
+
balance?: string | null;
|
|
900
|
+
symbol?: string | null;
|
|
901
|
+
name?: string | null;
|
|
902
|
+
decimals?: string | null;
|
|
903
|
+
logo?: string | null;
|
|
904
|
+
priceUsd?: string | null;
|
|
905
|
+
priceUpdatedAt?: string | null;
|
|
906
|
+
error?: string | null;
|
|
907
|
+
}
|
|
908
|
+
interface PortfolioTokensResponse {
|
|
909
|
+
address: string;
|
|
910
|
+
chains?: string[];
|
|
911
|
+
networks?: string[];
|
|
912
|
+
count: number;
|
|
913
|
+
items: PortfolioTokenItem[];
|
|
914
|
+
pageKey?: string | null;
|
|
915
|
+
cached?: boolean;
|
|
916
|
+
cacheTtlSeconds?: number;
|
|
917
|
+
error?: string;
|
|
918
|
+
message?: string;
|
|
919
|
+
details?: unknown;
|
|
920
|
+
}
|
|
921
|
+
interface OpWaitResponse {
|
|
922
|
+
state?: string;
|
|
923
|
+
txHash?: string | null;
|
|
924
|
+
}
|
|
853
925
|
|
|
854
926
|
declare const API: {
|
|
855
927
|
readonly op: {
|
|
@@ -872,6 +944,14 @@ declare const API: {
|
|
|
872
944
|
readonly walletLinkChallenge: "/api/auth/wallet/link/challenge";
|
|
873
945
|
readonly walletLinkVerify: "/api/auth/wallet/link/verify";
|
|
874
946
|
readonly wallets: "/api/auth/wallets";
|
|
947
|
+
readonly vaults: "/api/auth/vaults";
|
|
948
|
+
readonly passkeySignup: "/api/auth/passkey/signup";
|
|
949
|
+
readonly otpInit: "/api/auth/passkey/otp/init";
|
|
950
|
+
readonly otpVerify: "/api/auth/passkey/otp/verify";
|
|
951
|
+
readonly passkeySuborgs: "/api/auth/passkey/suborgs";
|
|
952
|
+
};
|
|
953
|
+
readonly portfolio: {
|
|
954
|
+
readonly tokens: "/api/portfolio/tokens";
|
|
875
955
|
};
|
|
876
956
|
readonly accounts: {
|
|
877
957
|
readonly create: "/api/accounts";
|
|
@@ -1134,7 +1214,8 @@ declare class VaultumError extends Error {
|
|
|
1134
1214
|
status?: number | undefined;
|
|
1135
1215
|
details?: unknown | undefined;
|
|
1136
1216
|
retryable: boolean;
|
|
1137
|
-
|
|
1217
|
+
rawCode?: string | undefined;
|
|
1218
|
+
constructor(message: string, code?: SDKErrorCode | undefined, status?: number | undefined, details?: unknown | undefined, retryable?: boolean, rawCode?: string | undefined);
|
|
1138
1219
|
}
|
|
1139
1220
|
declare class VaultumClient {
|
|
1140
1221
|
private baseURL;
|
|
@@ -1161,6 +1242,13 @@ declare class VaultumClient {
|
|
|
1161
1242
|
timestamp?: number;
|
|
1162
1243
|
signal?: AbortSignal;
|
|
1163
1244
|
}): Promise<OperationResult>;
|
|
1245
|
+
submitRaw(params: {
|
|
1246
|
+
chain: string;
|
|
1247
|
+
userOp: Record<string, unknown>;
|
|
1248
|
+
idempotencyKey?: string;
|
|
1249
|
+
timestamp?: number;
|
|
1250
|
+
signal?: AbortSignal;
|
|
1251
|
+
}): Promise<OperationResult>;
|
|
1164
1252
|
simulate(userOp: UserOperation | PackedUserOperation, options?: {
|
|
1165
1253
|
chain?: string;
|
|
1166
1254
|
signal?: AbortSignal;
|
|
@@ -1176,7 +1264,7 @@ declare class VaultumClient {
|
|
|
1176
1264
|
password: string;
|
|
1177
1265
|
signal?: AbortSignal;
|
|
1178
1266
|
}): Promise<AuthTokenResponse>;
|
|
1179
|
-
authMe(signal?: AbortSignal): Promise<
|
|
1267
|
+
authMe(signal?: AbortSignal): Promise<ApiUser>;
|
|
1180
1268
|
authLogout(signal?: AbortSignal): Promise<LogoutResponse>;
|
|
1181
1269
|
authLogoutAll(signal?: AbortSignal): Promise<LogoutResponse>;
|
|
1182
1270
|
walletChallenge(params: {
|
|
@@ -1185,6 +1273,7 @@ declare class VaultumClient {
|
|
|
1185
1273
|
signal?: AbortSignal;
|
|
1186
1274
|
}): Promise<WalletChallengeResponse>;
|
|
1187
1275
|
walletVerify(params: {
|
|
1276
|
+
challengeId: string;
|
|
1188
1277
|
chain: string;
|
|
1189
1278
|
address: Address;
|
|
1190
1279
|
signature: Hex;
|
|
@@ -1196,6 +1285,7 @@ declare class VaultumClient {
|
|
|
1196
1285
|
signal?: AbortSignal;
|
|
1197
1286
|
}): Promise<WalletChallengeResponse>;
|
|
1198
1287
|
walletRegisterVerify(params: {
|
|
1288
|
+
challengeId: string;
|
|
1199
1289
|
chain: string;
|
|
1200
1290
|
address: Address;
|
|
1201
1291
|
signature: Hex;
|
|
@@ -1215,12 +1305,47 @@ declare class VaultumClient {
|
|
|
1215
1305
|
signal?: AbortSignal;
|
|
1216
1306
|
}): Promise<WalletsResponse>;
|
|
1217
1307
|
wallets(signal?: AbortSignal): Promise<WalletsResponse>;
|
|
1308
|
+
vaults(signal?: AbortSignal): Promise<VaultGroupsResponse>;
|
|
1309
|
+
passkeySignup(params: {
|
|
1310
|
+
name: string;
|
|
1311
|
+
email: string;
|
|
1312
|
+
passkey: {
|
|
1313
|
+
encodedChallenge: string;
|
|
1314
|
+
attestation: string;
|
|
1315
|
+
};
|
|
1316
|
+
signal?: AbortSignal;
|
|
1317
|
+
}): Promise<PasskeySignupResponse>;
|
|
1318
|
+
otpInit(params: {
|
|
1319
|
+
email: string;
|
|
1320
|
+
signal?: AbortSignal;
|
|
1321
|
+
}): Promise<OtpInitResponse>;
|
|
1322
|
+
otpVerify(params: {
|
|
1323
|
+
email: string;
|
|
1324
|
+
otpCode: string;
|
|
1325
|
+
publicKey?: string;
|
|
1326
|
+
signal?: AbortSignal;
|
|
1327
|
+
}): Promise<OtpVerifyResponse>;
|
|
1328
|
+
passkeySuborgs(params: {
|
|
1329
|
+
email: string;
|
|
1330
|
+
signal?: AbortSignal;
|
|
1331
|
+
}): Promise<PasskeySuborgsResponse>;
|
|
1332
|
+
getPortfolio(params: {
|
|
1333
|
+
address: string;
|
|
1334
|
+
chains?: string;
|
|
1335
|
+
signal?: AbortSignal;
|
|
1336
|
+
}): Promise<PortfolioTokensResponse>;
|
|
1337
|
+
opWait(id: string, options?: {
|
|
1338
|
+
chain?: string;
|
|
1339
|
+
timeout?: number;
|
|
1340
|
+
signal?: AbortSignal;
|
|
1341
|
+
}): Promise<OpWaitResponse>;
|
|
1218
1342
|
getOperation(id: string, signal?: AbortSignal): Promise<OperationResult>;
|
|
1219
1343
|
waitForOperation(id: string, options?: WaitOptions): Promise<OperationResult>;
|
|
1220
1344
|
getCapabilities(signal?: AbortSignal): Promise<Capabilities>;
|
|
1221
1345
|
createAccount(options: {
|
|
1222
1346
|
sessionKeyAddress: Address;
|
|
1223
1347
|
chain?: string;
|
|
1348
|
+
vaultIndex?: number;
|
|
1224
1349
|
salt?: Hex;
|
|
1225
1350
|
owners?: Address[];
|
|
1226
1351
|
threshold?: number;
|
|
@@ -2200,4 +2325,4 @@ declare function hashCrossChainRootTypedData(params: CrossChainRootTypedDataPara
|
|
|
2200
2325
|
|
|
2201
2326
|
declare const VERSION: string;
|
|
2202
2327
|
|
|
2203
|
-
export { API, type AccountCreateResult, type AccountOperation, type AccountOperations, type AccountRoles, type AccountVerifyResult, type ActorPermissions, type AddressBookEntry, type AddressBookPage, type AddressCapabilities, type AggregatedRecoveryInitiateResponse, type AggregatedRecoveryPrepareExecutionResponse, type AggregatedRecoveryStatus, type AllowlistRoots, type AllowlistStatus, type ApiUser, type ArmedStatus, type AuthMeResponse, type AuthTokenResponse, type Automation, type AutomationDetails, type AutomationExecution, type AutomationExecutionStatus, type AutomationPage, type AutomationResponse, type AutomationStatus, type AutomationType, type BanStatus, CONTRACTS, type CanaryOptIn, type Capabilities, type ContractName, type CrossChainConfig, type CrossChainGasLimit, type CrossChainPendingProposal, type CrossChainReceiverState, type CrossChainRootTypedDataParams, type CrossChainRootTypedMessage, type CrossChainSkipProposal, type CursorPage, type EIP712Template, ENTRYPOINT_V07, type EnabledFeature, type ExecuteCall, FEATURE_IDS, FEATURE_ID_STRINGS, type FeatureConfig, type FeatureInfo, type FeatureInternal, type FinalizedProposal, GOVERNANCE_DOMAIN_NAME, GOVERNANCE_DOMAIN_VERSION, type GloballyPaused, type GuardianApproval, type GuardianConfig, type HasRole, type HealthStatus, type IsGuardian, type LogoutResponse, type NativeLimitConfig, type NativeLimitStatus, type OnChainRecoveryStatus, type OperationResult, type OperationState, type PackedUserOperation, type Proposal, type ProposalCall, type ProposalDigest, type ProposalSignature, type ProposalsPage, type QuoteResponse, type QuoteResponseRaw, type RecoveryGuardians, type RecoveryProposal, type RecoveryProposalInfo, type RecoveryProposalState, type RecoveryStatus, type RegistryFeatures, type RegistryVersion, type RelayEstimate, type RequestContext, type RequestInterceptor, type ResponseContext, type ResponseInterceptor, type RetryConfig, type RoleBudget, type RoleInfo, type RolesInfo, type SDKErrorCode, type SelectorIndex, type SessionKeyCount, type SessionKeyInfo, type SessionKeyList, type SessionKeyPolicySigner, type SessionKeyRoles, type SessionKeyStatus, type SessionKeyTokenLimit, type SettlementQuote, type SettlementTokens, type SpendingLimitBucket, type SpendingLimitPreview, type SpendingLimitStatus, type SpendingLimitSummary, type TargetIndex, type TimestampValidation, type TimingConfig, type TokenLimitConfig, type TokenLimitFullStatus, type TokenLimitStatus, type TokenMaxTransfer, type TriggerAutomationResponse, UserOpBuilder, type UserOpBuilderConfig, type UserOpGasLimits, type UserOpResponse, type UserOpSimulationResponse, type UserOpTemplate, type UserOperation, type UserWalletInfo, VERSION, type ValidatorSelectorPermitted, type VaultState, VaultumClient, type VaultumConfig, VaultumError, type WaitOptions, type WalletChallengeResponse, type WalletsResponse, buildCrossChainRootTypedData, createUserOpBuilder, getUserOpHash, hashCrossChainRootTypedData, packGasFees, packGasLimits, parseQuoteResponse, unpackGasFees, unpackGasLimits };
|
|
2328
|
+
export { API, type AccountCreateResult, type AccountOperation, type AccountOperations, type AccountRoles, type AccountVerifyResult, type ActorPermissions, type AddressBookEntry, type AddressBookPage, type AddressCapabilities, type AggregatedRecoveryInitiateResponse, type AggregatedRecoveryPrepareExecutionResponse, type AggregatedRecoveryStatus, type AllowlistRoots, type AllowlistStatus, type ApiUser, type ArmedStatus, type AuthMeResponse, type AuthTokenResponse, type Automation, type AutomationDetails, type AutomationExecution, type AutomationExecutionStatus, type AutomationPage, type AutomationResponse, type AutomationStatus, type AutomationType, type BanStatus, CONTRACTS, type CanaryOptIn, type Capabilities, type ContractName, type CrossChainConfig, type CrossChainGasLimit, type CrossChainPendingProposal, type CrossChainReceiverState, type CrossChainRootTypedDataParams, type CrossChainRootTypedMessage, type CrossChainSkipProposal, type CursorPage, type EIP712Template, ENTRYPOINT_V07, type EnabledFeature, type ExecuteCall, FEATURE_IDS, FEATURE_ID_STRINGS, type FeatureConfig, type FeatureInfo, type FeatureInternal, type FinalizedProposal, GOVERNANCE_DOMAIN_NAME, GOVERNANCE_DOMAIN_VERSION, type GloballyPaused, type GuardianApproval, type GuardianConfig, type HasRole, type HealthStatus, type IsGuardian, type LogoutResponse, type NativeLimitConfig, type NativeLimitStatus, type OnChainRecoveryStatus, type OpWaitResponse, type OperationResult, type OperationState, type OtpInitResponse, type OtpVerifyResponse, type PackedUserOperation, type PasskeySignupResponse, type PasskeySuborgsResponse, type PortfolioTokenItem, type PortfolioTokensResponse, type Proposal, type ProposalCall, type ProposalDigest, type ProposalSignature, type ProposalsPage, type QuoteResponse, type QuoteResponseRaw, type RecoveryGuardians, type RecoveryProposal, type RecoveryProposalInfo, type RecoveryProposalState, type RecoveryStatus, type RegistryFeatures, type RegistryVersion, type RelayEstimate, type RequestContext, type RequestInterceptor, type ResponseContext, type ResponseInterceptor, type RetryConfig, type RoleBudget, type RoleInfo, type RolesInfo, type SDKErrorCode, type SelectorIndex, type SessionKeyCount, type SessionKeyInfo, type SessionKeyList, type SessionKeyPolicySigner, type SessionKeyRoles, type SessionKeyStatus, type SessionKeyTokenLimit, type SettlementQuote, type SettlementTokens, type SpendingLimitBucket, type SpendingLimitPreview, type SpendingLimitStatus, type SpendingLimitSummary, type TargetIndex, type TimestampValidation, type TimingConfig, type TokenLimitConfig, type TokenLimitFullStatus, type TokenLimitStatus, type TokenMaxTransfer, type TriggerAutomationResponse, UserOpBuilder, type UserOpBuilderConfig, type UserOpGasLimits, type UserOpResponse, type UserOpSimulationResponse, type UserOpTemplate, type UserOperation, type UserWalletInfo, VERSION, type ValidatorSelectorPermitted, type VaultDeployment, type VaultGroup, type VaultGroupsResponse, type VaultState, VaultumClient, type VaultumConfig, VaultumError, type WaitOptions, type WalletChallengeResponse, type WalletsResponse, buildCrossChainRootTypedData, createUserOpBuilder, getUserOpHash, hashCrossChainRootTypedData, packGasFees, packGasLimits, parseQuoteResponse, unpackGasFees, unpackGasLimits };
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ interface AuthTokenResponse<TUser = ApiUser> {
|
|
|
39
39
|
token: string;
|
|
40
40
|
type: string;
|
|
41
41
|
abilities?: string[];
|
|
42
|
+
expires_in?: number;
|
|
42
43
|
requires_wallet?: boolean;
|
|
43
44
|
}
|
|
44
45
|
interface AuthMeResponse<TUser = ApiUser> {
|
|
@@ -48,13 +49,15 @@ interface LogoutResponse {
|
|
|
48
49
|
message: string;
|
|
49
50
|
}
|
|
50
51
|
interface WalletChallengeResponse {
|
|
52
|
+
challengeId: string;
|
|
51
53
|
message: string;
|
|
52
|
-
|
|
54
|
+
digest: Hex;
|
|
55
|
+
expiresAt?: string;
|
|
53
56
|
}
|
|
54
57
|
interface UserWalletInfo {
|
|
55
58
|
address: Address;
|
|
56
|
-
chainId
|
|
57
|
-
type
|
|
59
|
+
chainId?: number;
|
|
60
|
+
type?: string;
|
|
58
61
|
}
|
|
59
62
|
interface WalletsResponse {
|
|
60
63
|
wallets: UserWalletInfo[];
|
|
@@ -108,6 +111,19 @@ interface WaitOptions {
|
|
|
108
111
|
signal?: AbortSignal;
|
|
109
112
|
onProgress?: (result: OperationResult) => void;
|
|
110
113
|
}
|
|
114
|
+
interface VaultDeployment {
|
|
115
|
+
chainId: number;
|
|
116
|
+
deployed: boolean;
|
|
117
|
+
}
|
|
118
|
+
interface VaultGroup {
|
|
119
|
+
id: number;
|
|
120
|
+
vaultIndex: number;
|
|
121
|
+
address: Address;
|
|
122
|
+
deployments: VaultDeployment[];
|
|
123
|
+
}
|
|
124
|
+
interface VaultGroupsResponse {
|
|
125
|
+
vaultGroups: VaultGroup[];
|
|
126
|
+
}
|
|
111
127
|
interface AccountCreateResult {
|
|
112
128
|
chain: string;
|
|
113
129
|
factory: Address;
|
|
@@ -119,6 +135,9 @@ interface AccountCreateResult {
|
|
|
119
135
|
salt: Hex;
|
|
120
136
|
};
|
|
121
137
|
userOp: Record<string, unknown>;
|
|
138
|
+
userOpHash: Hex;
|
|
139
|
+
vaultGroupId: number;
|
|
140
|
+
vaultIndex: number;
|
|
122
141
|
}
|
|
123
142
|
interface AccountVerifyResult {
|
|
124
143
|
address: Address;
|
|
@@ -850,6 +869,59 @@ interface AddressCapabilities {
|
|
|
850
869
|
chains: number[];
|
|
851
870
|
contracts: string[];
|
|
852
871
|
}
|
|
872
|
+
interface PasskeySignupResponse extends AuthTokenResponse {
|
|
873
|
+
wallet?: {
|
|
874
|
+
address?: string;
|
|
875
|
+
};
|
|
876
|
+
turnkey?: {
|
|
877
|
+
subOrganizationId?: string;
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
interface OtpInitResponse {
|
|
881
|
+
ok: boolean;
|
|
882
|
+
}
|
|
883
|
+
interface OtpVerifyResponse extends AuthTokenResponse {
|
|
884
|
+
turnkey?: {
|
|
885
|
+
verificationToken?: string;
|
|
886
|
+
organizationId?: string;
|
|
887
|
+
session?: string;
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
interface PasskeySuborgsResponse {
|
|
891
|
+
organizationIds: string[];
|
|
892
|
+
}
|
|
893
|
+
interface PortfolioTokenItem {
|
|
894
|
+
chain?: string | null;
|
|
895
|
+
network?: string | null;
|
|
896
|
+
tokenAddress?: string | null;
|
|
897
|
+
isNative: boolean;
|
|
898
|
+
rawBalance?: string | null;
|
|
899
|
+
balance?: string | null;
|
|
900
|
+
symbol?: string | null;
|
|
901
|
+
name?: string | null;
|
|
902
|
+
decimals?: string | null;
|
|
903
|
+
logo?: string | null;
|
|
904
|
+
priceUsd?: string | null;
|
|
905
|
+
priceUpdatedAt?: string | null;
|
|
906
|
+
error?: string | null;
|
|
907
|
+
}
|
|
908
|
+
interface PortfolioTokensResponse {
|
|
909
|
+
address: string;
|
|
910
|
+
chains?: string[];
|
|
911
|
+
networks?: string[];
|
|
912
|
+
count: number;
|
|
913
|
+
items: PortfolioTokenItem[];
|
|
914
|
+
pageKey?: string | null;
|
|
915
|
+
cached?: boolean;
|
|
916
|
+
cacheTtlSeconds?: number;
|
|
917
|
+
error?: string;
|
|
918
|
+
message?: string;
|
|
919
|
+
details?: unknown;
|
|
920
|
+
}
|
|
921
|
+
interface OpWaitResponse {
|
|
922
|
+
state?: string;
|
|
923
|
+
txHash?: string | null;
|
|
924
|
+
}
|
|
853
925
|
|
|
854
926
|
declare const API: {
|
|
855
927
|
readonly op: {
|
|
@@ -872,6 +944,14 @@ declare const API: {
|
|
|
872
944
|
readonly walletLinkChallenge: "/api/auth/wallet/link/challenge";
|
|
873
945
|
readonly walletLinkVerify: "/api/auth/wallet/link/verify";
|
|
874
946
|
readonly wallets: "/api/auth/wallets";
|
|
947
|
+
readonly vaults: "/api/auth/vaults";
|
|
948
|
+
readonly passkeySignup: "/api/auth/passkey/signup";
|
|
949
|
+
readonly otpInit: "/api/auth/passkey/otp/init";
|
|
950
|
+
readonly otpVerify: "/api/auth/passkey/otp/verify";
|
|
951
|
+
readonly passkeySuborgs: "/api/auth/passkey/suborgs";
|
|
952
|
+
};
|
|
953
|
+
readonly portfolio: {
|
|
954
|
+
readonly tokens: "/api/portfolio/tokens";
|
|
875
955
|
};
|
|
876
956
|
readonly accounts: {
|
|
877
957
|
readonly create: "/api/accounts";
|
|
@@ -1134,7 +1214,8 @@ declare class VaultumError extends Error {
|
|
|
1134
1214
|
status?: number | undefined;
|
|
1135
1215
|
details?: unknown | undefined;
|
|
1136
1216
|
retryable: boolean;
|
|
1137
|
-
|
|
1217
|
+
rawCode?: string | undefined;
|
|
1218
|
+
constructor(message: string, code?: SDKErrorCode | undefined, status?: number | undefined, details?: unknown | undefined, retryable?: boolean, rawCode?: string | undefined);
|
|
1138
1219
|
}
|
|
1139
1220
|
declare class VaultumClient {
|
|
1140
1221
|
private baseURL;
|
|
@@ -1161,6 +1242,13 @@ declare class VaultumClient {
|
|
|
1161
1242
|
timestamp?: number;
|
|
1162
1243
|
signal?: AbortSignal;
|
|
1163
1244
|
}): Promise<OperationResult>;
|
|
1245
|
+
submitRaw(params: {
|
|
1246
|
+
chain: string;
|
|
1247
|
+
userOp: Record<string, unknown>;
|
|
1248
|
+
idempotencyKey?: string;
|
|
1249
|
+
timestamp?: number;
|
|
1250
|
+
signal?: AbortSignal;
|
|
1251
|
+
}): Promise<OperationResult>;
|
|
1164
1252
|
simulate(userOp: UserOperation | PackedUserOperation, options?: {
|
|
1165
1253
|
chain?: string;
|
|
1166
1254
|
signal?: AbortSignal;
|
|
@@ -1176,7 +1264,7 @@ declare class VaultumClient {
|
|
|
1176
1264
|
password: string;
|
|
1177
1265
|
signal?: AbortSignal;
|
|
1178
1266
|
}): Promise<AuthTokenResponse>;
|
|
1179
|
-
authMe(signal?: AbortSignal): Promise<
|
|
1267
|
+
authMe(signal?: AbortSignal): Promise<ApiUser>;
|
|
1180
1268
|
authLogout(signal?: AbortSignal): Promise<LogoutResponse>;
|
|
1181
1269
|
authLogoutAll(signal?: AbortSignal): Promise<LogoutResponse>;
|
|
1182
1270
|
walletChallenge(params: {
|
|
@@ -1185,6 +1273,7 @@ declare class VaultumClient {
|
|
|
1185
1273
|
signal?: AbortSignal;
|
|
1186
1274
|
}): Promise<WalletChallengeResponse>;
|
|
1187
1275
|
walletVerify(params: {
|
|
1276
|
+
challengeId: string;
|
|
1188
1277
|
chain: string;
|
|
1189
1278
|
address: Address;
|
|
1190
1279
|
signature: Hex;
|
|
@@ -1196,6 +1285,7 @@ declare class VaultumClient {
|
|
|
1196
1285
|
signal?: AbortSignal;
|
|
1197
1286
|
}): Promise<WalletChallengeResponse>;
|
|
1198
1287
|
walletRegisterVerify(params: {
|
|
1288
|
+
challengeId: string;
|
|
1199
1289
|
chain: string;
|
|
1200
1290
|
address: Address;
|
|
1201
1291
|
signature: Hex;
|
|
@@ -1215,12 +1305,47 @@ declare class VaultumClient {
|
|
|
1215
1305
|
signal?: AbortSignal;
|
|
1216
1306
|
}): Promise<WalletsResponse>;
|
|
1217
1307
|
wallets(signal?: AbortSignal): Promise<WalletsResponse>;
|
|
1308
|
+
vaults(signal?: AbortSignal): Promise<VaultGroupsResponse>;
|
|
1309
|
+
passkeySignup(params: {
|
|
1310
|
+
name: string;
|
|
1311
|
+
email: string;
|
|
1312
|
+
passkey: {
|
|
1313
|
+
encodedChallenge: string;
|
|
1314
|
+
attestation: string;
|
|
1315
|
+
};
|
|
1316
|
+
signal?: AbortSignal;
|
|
1317
|
+
}): Promise<PasskeySignupResponse>;
|
|
1318
|
+
otpInit(params: {
|
|
1319
|
+
email: string;
|
|
1320
|
+
signal?: AbortSignal;
|
|
1321
|
+
}): Promise<OtpInitResponse>;
|
|
1322
|
+
otpVerify(params: {
|
|
1323
|
+
email: string;
|
|
1324
|
+
otpCode: string;
|
|
1325
|
+
publicKey?: string;
|
|
1326
|
+
signal?: AbortSignal;
|
|
1327
|
+
}): Promise<OtpVerifyResponse>;
|
|
1328
|
+
passkeySuborgs(params: {
|
|
1329
|
+
email: string;
|
|
1330
|
+
signal?: AbortSignal;
|
|
1331
|
+
}): Promise<PasskeySuborgsResponse>;
|
|
1332
|
+
getPortfolio(params: {
|
|
1333
|
+
address: string;
|
|
1334
|
+
chains?: string;
|
|
1335
|
+
signal?: AbortSignal;
|
|
1336
|
+
}): Promise<PortfolioTokensResponse>;
|
|
1337
|
+
opWait(id: string, options?: {
|
|
1338
|
+
chain?: string;
|
|
1339
|
+
timeout?: number;
|
|
1340
|
+
signal?: AbortSignal;
|
|
1341
|
+
}): Promise<OpWaitResponse>;
|
|
1218
1342
|
getOperation(id: string, signal?: AbortSignal): Promise<OperationResult>;
|
|
1219
1343
|
waitForOperation(id: string, options?: WaitOptions): Promise<OperationResult>;
|
|
1220
1344
|
getCapabilities(signal?: AbortSignal): Promise<Capabilities>;
|
|
1221
1345
|
createAccount(options: {
|
|
1222
1346
|
sessionKeyAddress: Address;
|
|
1223
1347
|
chain?: string;
|
|
1348
|
+
vaultIndex?: number;
|
|
1224
1349
|
salt?: Hex;
|
|
1225
1350
|
owners?: Address[];
|
|
1226
1351
|
threshold?: number;
|
|
@@ -2200,4 +2325,4 @@ declare function hashCrossChainRootTypedData(params: CrossChainRootTypedDataPara
|
|
|
2200
2325
|
|
|
2201
2326
|
declare const VERSION: string;
|
|
2202
2327
|
|
|
2203
|
-
export { API, type AccountCreateResult, type AccountOperation, type AccountOperations, type AccountRoles, type AccountVerifyResult, type ActorPermissions, type AddressBookEntry, type AddressBookPage, type AddressCapabilities, type AggregatedRecoveryInitiateResponse, type AggregatedRecoveryPrepareExecutionResponse, type AggregatedRecoveryStatus, type AllowlistRoots, type AllowlistStatus, type ApiUser, type ArmedStatus, type AuthMeResponse, type AuthTokenResponse, type Automation, type AutomationDetails, type AutomationExecution, type AutomationExecutionStatus, type AutomationPage, type AutomationResponse, type AutomationStatus, type AutomationType, type BanStatus, CONTRACTS, type CanaryOptIn, type Capabilities, type ContractName, type CrossChainConfig, type CrossChainGasLimit, type CrossChainPendingProposal, type CrossChainReceiverState, type CrossChainRootTypedDataParams, type CrossChainRootTypedMessage, type CrossChainSkipProposal, type CursorPage, type EIP712Template, ENTRYPOINT_V07, type EnabledFeature, type ExecuteCall, FEATURE_IDS, FEATURE_ID_STRINGS, type FeatureConfig, type FeatureInfo, type FeatureInternal, type FinalizedProposal, GOVERNANCE_DOMAIN_NAME, GOVERNANCE_DOMAIN_VERSION, type GloballyPaused, type GuardianApproval, type GuardianConfig, type HasRole, type HealthStatus, type IsGuardian, type LogoutResponse, type NativeLimitConfig, type NativeLimitStatus, type OnChainRecoveryStatus, type OperationResult, type OperationState, type PackedUserOperation, type Proposal, type ProposalCall, type ProposalDigest, type ProposalSignature, type ProposalsPage, type QuoteResponse, type QuoteResponseRaw, type RecoveryGuardians, type RecoveryProposal, type RecoveryProposalInfo, type RecoveryProposalState, type RecoveryStatus, type RegistryFeatures, type RegistryVersion, type RelayEstimate, type RequestContext, type RequestInterceptor, type ResponseContext, type ResponseInterceptor, type RetryConfig, type RoleBudget, type RoleInfo, type RolesInfo, type SDKErrorCode, type SelectorIndex, type SessionKeyCount, type SessionKeyInfo, type SessionKeyList, type SessionKeyPolicySigner, type SessionKeyRoles, type SessionKeyStatus, type SessionKeyTokenLimit, type SettlementQuote, type SettlementTokens, type SpendingLimitBucket, type SpendingLimitPreview, type SpendingLimitStatus, type SpendingLimitSummary, type TargetIndex, type TimestampValidation, type TimingConfig, type TokenLimitConfig, type TokenLimitFullStatus, type TokenLimitStatus, type TokenMaxTransfer, type TriggerAutomationResponse, UserOpBuilder, type UserOpBuilderConfig, type UserOpGasLimits, type UserOpResponse, type UserOpSimulationResponse, type UserOpTemplate, type UserOperation, type UserWalletInfo, VERSION, type ValidatorSelectorPermitted, type VaultState, VaultumClient, type VaultumConfig, VaultumError, type WaitOptions, type WalletChallengeResponse, type WalletsResponse, buildCrossChainRootTypedData, createUserOpBuilder, getUserOpHash, hashCrossChainRootTypedData, packGasFees, packGasLimits, parseQuoteResponse, unpackGasFees, unpackGasLimits };
|
|
2328
|
+
export { API, type AccountCreateResult, type AccountOperation, type AccountOperations, type AccountRoles, type AccountVerifyResult, type ActorPermissions, type AddressBookEntry, type AddressBookPage, type AddressCapabilities, type AggregatedRecoveryInitiateResponse, type AggregatedRecoveryPrepareExecutionResponse, type AggregatedRecoveryStatus, type AllowlistRoots, type AllowlistStatus, type ApiUser, type ArmedStatus, type AuthMeResponse, type AuthTokenResponse, type Automation, type AutomationDetails, type AutomationExecution, type AutomationExecutionStatus, type AutomationPage, type AutomationResponse, type AutomationStatus, type AutomationType, type BanStatus, CONTRACTS, type CanaryOptIn, type Capabilities, type ContractName, type CrossChainConfig, type CrossChainGasLimit, type CrossChainPendingProposal, type CrossChainReceiverState, type CrossChainRootTypedDataParams, type CrossChainRootTypedMessage, type CrossChainSkipProposal, type CursorPage, type EIP712Template, ENTRYPOINT_V07, type EnabledFeature, type ExecuteCall, FEATURE_IDS, FEATURE_ID_STRINGS, type FeatureConfig, type FeatureInfo, type FeatureInternal, type FinalizedProposal, GOVERNANCE_DOMAIN_NAME, GOVERNANCE_DOMAIN_VERSION, type GloballyPaused, type GuardianApproval, type GuardianConfig, type HasRole, type HealthStatus, type IsGuardian, type LogoutResponse, type NativeLimitConfig, type NativeLimitStatus, type OnChainRecoveryStatus, type OpWaitResponse, type OperationResult, type OperationState, type OtpInitResponse, type OtpVerifyResponse, type PackedUserOperation, type PasskeySignupResponse, type PasskeySuborgsResponse, type PortfolioTokenItem, type PortfolioTokensResponse, type Proposal, type ProposalCall, type ProposalDigest, type ProposalSignature, type ProposalsPage, type QuoteResponse, type QuoteResponseRaw, type RecoveryGuardians, type RecoveryProposal, type RecoveryProposalInfo, type RecoveryProposalState, type RecoveryStatus, type RegistryFeatures, type RegistryVersion, type RelayEstimate, type RequestContext, type RequestInterceptor, type ResponseContext, type ResponseInterceptor, type RetryConfig, type RoleBudget, type RoleInfo, type RolesInfo, type SDKErrorCode, type SelectorIndex, type SessionKeyCount, type SessionKeyInfo, type SessionKeyList, type SessionKeyPolicySigner, type SessionKeyRoles, type SessionKeyStatus, type SessionKeyTokenLimit, type SettlementQuote, type SettlementTokens, type SpendingLimitBucket, type SpendingLimitPreview, type SpendingLimitStatus, type SpendingLimitSummary, type TargetIndex, type TimestampValidation, type TimingConfig, type TokenLimitConfig, type TokenLimitFullStatus, type TokenLimitStatus, type TokenMaxTransfer, type TriggerAutomationResponse, UserOpBuilder, type UserOpBuilderConfig, type UserOpGasLimits, type UserOpResponse, type UserOpSimulationResponse, type UserOpTemplate, type UserOperation, type UserWalletInfo, VERSION, type ValidatorSelectorPermitted, type VaultDeployment, type VaultGroup, type VaultGroupsResponse, type VaultState, VaultumClient, type VaultumConfig, VaultumError, type WaitOptions, type WalletChallengeResponse, type WalletsResponse, buildCrossChainRootTypedData, createUserOpBuilder, getUserOpHash, hashCrossChainRootTypedData, packGasFees, packGasLimits, parseQuoteResponse, unpackGasFees, unpackGasLimits };
|
package/dist/index.js
CHANGED
|
@@ -65,7 +65,15 @@ var API = {
|
|
|
65
65
|
me: "/api/auth/me",
|
|
66
66
|
walletLinkChallenge: "/api/auth/wallet/link/challenge",
|
|
67
67
|
walletLinkVerify: "/api/auth/wallet/link/verify",
|
|
68
|
-
wallets: "/api/auth/wallets"
|
|
68
|
+
wallets: "/api/auth/wallets",
|
|
69
|
+
vaults: "/api/auth/vaults",
|
|
70
|
+
passkeySignup: "/api/auth/passkey/signup",
|
|
71
|
+
otpInit: "/api/auth/passkey/otp/init",
|
|
72
|
+
otpVerify: "/api/auth/passkey/otp/verify",
|
|
73
|
+
passkeySuborgs: "/api/auth/passkey/suborgs"
|
|
74
|
+
},
|
|
75
|
+
portfolio: {
|
|
76
|
+
tokens: "/api/portfolio/tokens"
|
|
69
77
|
},
|
|
70
78
|
accounts: {
|
|
71
79
|
create: "/api/accounts",
|
|
@@ -527,12 +535,13 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
|
527
535
|
]);
|
|
528
536
|
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
529
537
|
var VaultumError = class extends Error {
|
|
530
|
-
constructor(message, code, status, details, retryable = false) {
|
|
538
|
+
constructor(message, code, status, details, retryable = false, rawCode) {
|
|
531
539
|
super(message);
|
|
532
540
|
this.code = code;
|
|
533
541
|
this.status = status;
|
|
534
542
|
this.details = details;
|
|
535
543
|
this.retryable = retryable;
|
|
544
|
+
this.rawCode = rawCode;
|
|
536
545
|
this.name = "VaultumError";
|
|
537
546
|
}
|
|
538
547
|
};
|
|
@@ -735,13 +744,15 @@ var VaultumClient = class {
|
|
|
735
744
|
const data = await res.json().catch(() => ({}));
|
|
736
745
|
if (!res.ok) {
|
|
737
746
|
const errBody = data;
|
|
738
|
-
const
|
|
747
|
+
const rawCode = errBody.code ?? errBody.error;
|
|
748
|
+
const code = mapErrorCode(rawCode, res.status);
|
|
739
749
|
throw new VaultumError(
|
|
740
750
|
errBody.message ?? errBody.error ?? `Request failed: ${res.status}`,
|
|
741
751
|
code,
|
|
742
752
|
res.status,
|
|
743
753
|
errBody.details,
|
|
744
|
-
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status)
|
|
754
|
+
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status),
|
|
755
|
+
rawCode
|
|
745
756
|
);
|
|
746
757
|
}
|
|
747
758
|
let responseCtx = { status: res.status, headers: res.headers, data };
|
|
@@ -783,6 +794,14 @@ var VaultumClient = class {
|
|
|
783
794
|
signal: options?.signal
|
|
784
795
|
});
|
|
785
796
|
}
|
|
797
|
+
async submitRaw(params) {
|
|
798
|
+
const body = { chain: params.chain, userOp: params.userOp };
|
|
799
|
+
return this.request("POST", API.op.submit, body, {
|
|
800
|
+
idempotencyKey: params.idempotencyKey ?? autoIdempotencyKey(body),
|
|
801
|
+
timestamp: params.timestamp ?? nowUnix(),
|
|
802
|
+
signal: params.signal
|
|
803
|
+
});
|
|
804
|
+
}
|
|
786
805
|
async simulate(userOp, options) {
|
|
787
806
|
const chain = options?.chain ?? this.chain ?? "sepolia";
|
|
788
807
|
const normalized = isPackedUserOp(userOp) ? packedToUserOperation(userOp) : normalizeUserOperation(userOp);
|
|
@@ -799,7 +818,9 @@ var VaultumClient = class {
|
|
|
799
818
|
return r;
|
|
800
819
|
}
|
|
801
820
|
async authMe(signal) {
|
|
802
|
-
|
|
821
|
+
const raw = await this.request("GET", API.auth.me, void 0, { signal });
|
|
822
|
+
if ("user" in raw && isRecord(raw.user)) return raw.user;
|
|
823
|
+
return raw;
|
|
803
824
|
}
|
|
804
825
|
async authLogout(signal) {
|
|
805
826
|
const r = await this.request("POST", API.auth.logout, void 0, { signal });
|
|
@@ -819,6 +840,7 @@ var VaultumClient = class {
|
|
|
819
840
|
}
|
|
820
841
|
async walletVerify(params) {
|
|
821
842
|
const r = await this.request("POST", API.auth.walletVerify, {
|
|
843
|
+
challengeId: params.challengeId,
|
|
822
844
|
chain: params.chain,
|
|
823
845
|
address: params.address.toLowerCase(),
|
|
824
846
|
signature: params.signature.toLowerCase()
|
|
@@ -834,6 +856,7 @@ var VaultumClient = class {
|
|
|
834
856
|
}
|
|
835
857
|
async walletRegisterVerify(params) {
|
|
836
858
|
const r = await this.request("POST", API.auth.walletRegisterVerify, {
|
|
859
|
+
challengeId: params.challengeId,
|
|
837
860
|
chain: params.chain,
|
|
838
861
|
address: params.address.toLowerCase(),
|
|
839
862
|
signature: params.signature.toLowerCase(),
|
|
@@ -883,6 +906,56 @@ var VaultumClient = class {
|
|
|
883
906
|
}))
|
|
884
907
|
};
|
|
885
908
|
}
|
|
909
|
+
async vaults(signal) {
|
|
910
|
+
const raw = await this.request("GET", API.auth.vaults, void 0, { signal });
|
|
911
|
+
return {
|
|
912
|
+
vaultGroups: (raw.vaultGroups ?? []).map((g) => ({
|
|
913
|
+
id: g.id,
|
|
914
|
+
vaultIndex: g.vault_index,
|
|
915
|
+
address: g.address.toLowerCase(),
|
|
916
|
+
deployments: (g.deployments ?? []).map((d) => ({
|
|
917
|
+
chainId: d.chain_id,
|
|
918
|
+
deployed: d.deployed
|
|
919
|
+
}))
|
|
920
|
+
}))
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
async passkeySignup(params) {
|
|
924
|
+
const r = await this.request("POST", API.auth.passkeySignup, {
|
|
925
|
+
name: params.name,
|
|
926
|
+
email: params.email,
|
|
927
|
+
passkey: params.passkey
|
|
928
|
+
}, { signal: params.signal });
|
|
929
|
+
this.setBearer(r.token);
|
|
930
|
+
return r;
|
|
931
|
+
}
|
|
932
|
+
async otpInit(params) {
|
|
933
|
+
return this.request("POST", API.auth.otpInit, { email: params.email }, { signal: params.signal });
|
|
934
|
+
}
|
|
935
|
+
async otpVerify(params) {
|
|
936
|
+
const r = await this.request("POST", API.auth.otpVerify, {
|
|
937
|
+
email: params.email,
|
|
938
|
+
otpCode: params.otpCode,
|
|
939
|
+
publicKey: params.publicKey
|
|
940
|
+
}, { signal: params.signal });
|
|
941
|
+
this.setBearer(r.token);
|
|
942
|
+
return r;
|
|
943
|
+
}
|
|
944
|
+
async passkeySuborgs(params) {
|
|
945
|
+
return this.request("POST", API.auth.passkeySuborgs, { email: params.email }, { signal: params.signal });
|
|
946
|
+
}
|
|
947
|
+
async getPortfolio(params) {
|
|
948
|
+
const q = new URLSearchParams();
|
|
949
|
+
q.set("address", params.address);
|
|
950
|
+
if (params.chains) q.set("chains", params.chains);
|
|
951
|
+
return this.request("GET", `${API.portfolio.tokens}?${q.toString()}`, void 0, { signal: params.signal });
|
|
952
|
+
}
|
|
953
|
+
async opWait(id, options) {
|
|
954
|
+
const q = new URLSearchParams();
|
|
955
|
+
if (options?.chain) q.set("chain", options.chain);
|
|
956
|
+
q.set("timeout", String(options?.timeout ?? 60));
|
|
957
|
+
return this.request("GET", `${API.op.wait(id)}?${q.toString()}`, void 0, { signal: options?.signal });
|
|
958
|
+
}
|
|
886
959
|
async getOperation(id, signal) {
|
|
887
960
|
return this.request("GET", API.op.status(id), void 0, { signal });
|
|
888
961
|
}
|
|
@@ -909,6 +982,7 @@ var VaultumClient = class {
|
|
|
909
982
|
sessionKeyAddress: options.sessionKeyAddress.toLowerCase(),
|
|
910
983
|
type: "create",
|
|
911
984
|
chain: options.chain ?? this.chain,
|
|
985
|
+
vaultIndex: options.vaultIndex,
|
|
912
986
|
salt: options.salt,
|
|
913
987
|
owners: options.owners?.map((a) => a.toLowerCase()),
|
|
914
988
|
threshold: options.threshold,
|
|
@@ -1993,7 +2067,7 @@ function hashCrossChainRootTypedData(params) {
|
|
|
1993
2067
|
}
|
|
1994
2068
|
|
|
1995
2069
|
// src/index.ts
|
|
1996
|
-
var VERSION = "0.1.
|
|
2070
|
+
var VERSION = "0.1.7";
|
|
1997
2071
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1998
2072
|
0 && (module.exports = {
|
|
1999
2073
|
API,
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,15 @@ var API = {
|
|
|
20
20
|
me: "/api/auth/me",
|
|
21
21
|
walletLinkChallenge: "/api/auth/wallet/link/challenge",
|
|
22
22
|
walletLinkVerify: "/api/auth/wallet/link/verify",
|
|
23
|
-
wallets: "/api/auth/wallets"
|
|
23
|
+
wallets: "/api/auth/wallets",
|
|
24
|
+
vaults: "/api/auth/vaults",
|
|
25
|
+
passkeySignup: "/api/auth/passkey/signup",
|
|
26
|
+
otpInit: "/api/auth/passkey/otp/init",
|
|
27
|
+
otpVerify: "/api/auth/passkey/otp/verify",
|
|
28
|
+
passkeySuborgs: "/api/auth/passkey/suborgs"
|
|
29
|
+
},
|
|
30
|
+
portfolio: {
|
|
31
|
+
tokens: "/api/portfolio/tokens"
|
|
24
32
|
},
|
|
25
33
|
accounts: {
|
|
26
34
|
create: "/api/accounts",
|
|
@@ -491,12 +499,13 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
|
491
499
|
]);
|
|
492
500
|
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
493
501
|
var VaultumError = class extends Error {
|
|
494
|
-
constructor(message, code, status, details, retryable = false) {
|
|
502
|
+
constructor(message, code, status, details, retryable = false, rawCode) {
|
|
495
503
|
super(message);
|
|
496
504
|
this.code = code;
|
|
497
505
|
this.status = status;
|
|
498
506
|
this.details = details;
|
|
499
507
|
this.retryable = retryable;
|
|
508
|
+
this.rawCode = rawCode;
|
|
500
509
|
this.name = "VaultumError";
|
|
501
510
|
}
|
|
502
511
|
};
|
|
@@ -699,13 +708,15 @@ var VaultumClient = class {
|
|
|
699
708
|
const data = await res.json().catch(() => ({}));
|
|
700
709
|
if (!res.ok) {
|
|
701
710
|
const errBody = data;
|
|
702
|
-
const
|
|
711
|
+
const rawCode = errBody.code ?? errBody.error;
|
|
712
|
+
const code = mapErrorCode(rawCode, res.status);
|
|
703
713
|
throw new VaultumError(
|
|
704
714
|
errBody.message ?? errBody.error ?? `Request failed: ${res.status}`,
|
|
705
715
|
code,
|
|
706
716
|
res.status,
|
|
707
717
|
errBody.details,
|
|
708
|
-
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status)
|
|
718
|
+
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status),
|
|
719
|
+
rawCode
|
|
709
720
|
);
|
|
710
721
|
}
|
|
711
722
|
let responseCtx = { status: res.status, headers: res.headers, data };
|
|
@@ -747,6 +758,14 @@ var VaultumClient = class {
|
|
|
747
758
|
signal: options?.signal
|
|
748
759
|
});
|
|
749
760
|
}
|
|
761
|
+
async submitRaw(params) {
|
|
762
|
+
const body = { chain: params.chain, userOp: params.userOp };
|
|
763
|
+
return this.request("POST", API.op.submit, body, {
|
|
764
|
+
idempotencyKey: params.idempotencyKey ?? autoIdempotencyKey(body),
|
|
765
|
+
timestamp: params.timestamp ?? nowUnix(),
|
|
766
|
+
signal: params.signal
|
|
767
|
+
});
|
|
768
|
+
}
|
|
750
769
|
async simulate(userOp, options) {
|
|
751
770
|
const chain = options?.chain ?? this.chain ?? "sepolia";
|
|
752
771
|
const normalized = isPackedUserOp(userOp) ? packedToUserOperation(userOp) : normalizeUserOperation(userOp);
|
|
@@ -763,7 +782,9 @@ var VaultumClient = class {
|
|
|
763
782
|
return r;
|
|
764
783
|
}
|
|
765
784
|
async authMe(signal) {
|
|
766
|
-
|
|
785
|
+
const raw = await this.request("GET", API.auth.me, void 0, { signal });
|
|
786
|
+
if ("user" in raw && isRecord(raw.user)) return raw.user;
|
|
787
|
+
return raw;
|
|
767
788
|
}
|
|
768
789
|
async authLogout(signal) {
|
|
769
790
|
const r = await this.request("POST", API.auth.logout, void 0, { signal });
|
|
@@ -783,6 +804,7 @@ var VaultumClient = class {
|
|
|
783
804
|
}
|
|
784
805
|
async walletVerify(params) {
|
|
785
806
|
const r = await this.request("POST", API.auth.walletVerify, {
|
|
807
|
+
challengeId: params.challengeId,
|
|
786
808
|
chain: params.chain,
|
|
787
809
|
address: params.address.toLowerCase(),
|
|
788
810
|
signature: params.signature.toLowerCase()
|
|
@@ -798,6 +820,7 @@ var VaultumClient = class {
|
|
|
798
820
|
}
|
|
799
821
|
async walletRegisterVerify(params) {
|
|
800
822
|
const r = await this.request("POST", API.auth.walletRegisterVerify, {
|
|
823
|
+
challengeId: params.challengeId,
|
|
801
824
|
chain: params.chain,
|
|
802
825
|
address: params.address.toLowerCase(),
|
|
803
826
|
signature: params.signature.toLowerCase(),
|
|
@@ -847,6 +870,56 @@ var VaultumClient = class {
|
|
|
847
870
|
}))
|
|
848
871
|
};
|
|
849
872
|
}
|
|
873
|
+
async vaults(signal) {
|
|
874
|
+
const raw = await this.request("GET", API.auth.vaults, void 0, { signal });
|
|
875
|
+
return {
|
|
876
|
+
vaultGroups: (raw.vaultGroups ?? []).map((g) => ({
|
|
877
|
+
id: g.id,
|
|
878
|
+
vaultIndex: g.vault_index,
|
|
879
|
+
address: g.address.toLowerCase(),
|
|
880
|
+
deployments: (g.deployments ?? []).map((d) => ({
|
|
881
|
+
chainId: d.chain_id,
|
|
882
|
+
deployed: d.deployed
|
|
883
|
+
}))
|
|
884
|
+
}))
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
async passkeySignup(params) {
|
|
888
|
+
const r = await this.request("POST", API.auth.passkeySignup, {
|
|
889
|
+
name: params.name,
|
|
890
|
+
email: params.email,
|
|
891
|
+
passkey: params.passkey
|
|
892
|
+
}, { signal: params.signal });
|
|
893
|
+
this.setBearer(r.token);
|
|
894
|
+
return r;
|
|
895
|
+
}
|
|
896
|
+
async otpInit(params) {
|
|
897
|
+
return this.request("POST", API.auth.otpInit, { email: params.email }, { signal: params.signal });
|
|
898
|
+
}
|
|
899
|
+
async otpVerify(params) {
|
|
900
|
+
const r = await this.request("POST", API.auth.otpVerify, {
|
|
901
|
+
email: params.email,
|
|
902
|
+
otpCode: params.otpCode,
|
|
903
|
+
publicKey: params.publicKey
|
|
904
|
+
}, { signal: params.signal });
|
|
905
|
+
this.setBearer(r.token);
|
|
906
|
+
return r;
|
|
907
|
+
}
|
|
908
|
+
async passkeySuborgs(params) {
|
|
909
|
+
return this.request("POST", API.auth.passkeySuborgs, { email: params.email }, { signal: params.signal });
|
|
910
|
+
}
|
|
911
|
+
async getPortfolio(params) {
|
|
912
|
+
const q = new URLSearchParams();
|
|
913
|
+
q.set("address", params.address);
|
|
914
|
+
if (params.chains) q.set("chains", params.chains);
|
|
915
|
+
return this.request("GET", `${API.portfolio.tokens}?${q.toString()}`, void 0, { signal: params.signal });
|
|
916
|
+
}
|
|
917
|
+
async opWait(id, options) {
|
|
918
|
+
const q = new URLSearchParams();
|
|
919
|
+
if (options?.chain) q.set("chain", options.chain);
|
|
920
|
+
q.set("timeout", String(options?.timeout ?? 60));
|
|
921
|
+
return this.request("GET", `${API.op.wait(id)}?${q.toString()}`, void 0, { signal: options?.signal });
|
|
922
|
+
}
|
|
850
923
|
async getOperation(id, signal) {
|
|
851
924
|
return this.request("GET", API.op.status(id), void 0, { signal });
|
|
852
925
|
}
|
|
@@ -873,6 +946,7 @@ var VaultumClient = class {
|
|
|
873
946
|
sessionKeyAddress: options.sessionKeyAddress.toLowerCase(),
|
|
874
947
|
type: "create",
|
|
875
948
|
chain: options.chain ?? this.chain,
|
|
949
|
+
vaultIndex: options.vaultIndex,
|
|
876
950
|
salt: options.salt,
|
|
877
951
|
owners: options.owners?.map((a) => a.toLowerCase()),
|
|
878
952
|
threshold: options.threshold,
|
|
@@ -1957,7 +2031,7 @@ function hashCrossChainRootTypedData(params) {
|
|
|
1957
2031
|
}
|
|
1958
2032
|
|
|
1959
2033
|
// src/index.ts
|
|
1960
|
-
var VERSION = "0.1.
|
|
2034
|
+
var VERSION = "0.1.7";
|
|
1961
2035
|
export {
|
|
1962
2036
|
API,
|
|
1963
2037
|
CONTRACTS,
|