@vaultum/sdk 0.1.5 → 0.1.6
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 +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +24 -5
- package/dist/index.mjs +24 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -108,6 +108,19 @@ interface WaitOptions {
|
|
|
108
108
|
signal?: AbortSignal;
|
|
109
109
|
onProgress?: (result: OperationResult) => void;
|
|
110
110
|
}
|
|
111
|
+
interface VaultDeployment {
|
|
112
|
+
chainId: number;
|
|
113
|
+
deployed: boolean;
|
|
114
|
+
}
|
|
115
|
+
interface VaultGroup {
|
|
116
|
+
id: number;
|
|
117
|
+
vaultIndex: number;
|
|
118
|
+
address: Address;
|
|
119
|
+
deployments: VaultDeployment[];
|
|
120
|
+
}
|
|
121
|
+
interface VaultGroupsResponse {
|
|
122
|
+
vaultGroups: VaultGroup[];
|
|
123
|
+
}
|
|
111
124
|
interface AccountCreateResult {
|
|
112
125
|
chain: string;
|
|
113
126
|
factory: Address;
|
|
@@ -119,6 +132,9 @@ interface AccountCreateResult {
|
|
|
119
132
|
salt: Hex;
|
|
120
133
|
};
|
|
121
134
|
userOp: Record<string, unknown>;
|
|
135
|
+
userOpHash: Hex;
|
|
136
|
+
vaultGroupId: number;
|
|
137
|
+
vaultIndex: number;
|
|
122
138
|
}
|
|
123
139
|
interface AccountVerifyResult {
|
|
124
140
|
address: Address;
|
|
@@ -872,6 +888,7 @@ declare const API: {
|
|
|
872
888
|
readonly walletLinkChallenge: "/api/auth/wallet/link/challenge";
|
|
873
889
|
readonly walletLinkVerify: "/api/auth/wallet/link/verify";
|
|
874
890
|
readonly wallets: "/api/auth/wallets";
|
|
891
|
+
readonly vaults: "/api/auth/vaults";
|
|
875
892
|
};
|
|
876
893
|
readonly accounts: {
|
|
877
894
|
readonly create: "/api/accounts";
|
|
@@ -1134,7 +1151,8 @@ declare class VaultumError extends Error {
|
|
|
1134
1151
|
status?: number | undefined;
|
|
1135
1152
|
details?: unknown | undefined;
|
|
1136
1153
|
retryable: boolean;
|
|
1137
|
-
|
|
1154
|
+
rawCode?: string | undefined;
|
|
1155
|
+
constructor(message: string, code?: SDKErrorCode | undefined, status?: number | undefined, details?: unknown | undefined, retryable?: boolean, rawCode?: string | undefined);
|
|
1138
1156
|
}
|
|
1139
1157
|
declare class VaultumClient {
|
|
1140
1158
|
private baseURL;
|
|
@@ -1215,12 +1233,14 @@ declare class VaultumClient {
|
|
|
1215
1233
|
signal?: AbortSignal;
|
|
1216
1234
|
}): Promise<WalletsResponse>;
|
|
1217
1235
|
wallets(signal?: AbortSignal): Promise<WalletsResponse>;
|
|
1236
|
+
vaults(signal?: AbortSignal): Promise<VaultGroupsResponse>;
|
|
1218
1237
|
getOperation(id: string, signal?: AbortSignal): Promise<OperationResult>;
|
|
1219
1238
|
waitForOperation(id: string, options?: WaitOptions): Promise<OperationResult>;
|
|
1220
1239
|
getCapabilities(signal?: AbortSignal): Promise<Capabilities>;
|
|
1221
1240
|
createAccount(options: {
|
|
1222
1241
|
sessionKeyAddress: Address;
|
|
1223
1242
|
chain?: string;
|
|
1243
|
+
vaultIndex?: number;
|
|
1224
1244
|
salt?: Hex;
|
|
1225
1245
|
owners?: Address[];
|
|
1226
1246
|
threshold?: number;
|
|
@@ -2200,4 +2220,4 @@ declare function hashCrossChainRootTypedData(params: CrossChainRootTypedDataPara
|
|
|
2200
2220
|
|
|
2201
2221
|
declare const VERSION: string;
|
|
2202
2222
|
|
|
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 };
|
|
2223
|
+
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 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
|
@@ -108,6 +108,19 @@ interface WaitOptions {
|
|
|
108
108
|
signal?: AbortSignal;
|
|
109
109
|
onProgress?: (result: OperationResult) => void;
|
|
110
110
|
}
|
|
111
|
+
interface VaultDeployment {
|
|
112
|
+
chainId: number;
|
|
113
|
+
deployed: boolean;
|
|
114
|
+
}
|
|
115
|
+
interface VaultGroup {
|
|
116
|
+
id: number;
|
|
117
|
+
vaultIndex: number;
|
|
118
|
+
address: Address;
|
|
119
|
+
deployments: VaultDeployment[];
|
|
120
|
+
}
|
|
121
|
+
interface VaultGroupsResponse {
|
|
122
|
+
vaultGroups: VaultGroup[];
|
|
123
|
+
}
|
|
111
124
|
interface AccountCreateResult {
|
|
112
125
|
chain: string;
|
|
113
126
|
factory: Address;
|
|
@@ -119,6 +132,9 @@ interface AccountCreateResult {
|
|
|
119
132
|
salt: Hex;
|
|
120
133
|
};
|
|
121
134
|
userOp: Record<string, unknown>;
|
|
135
|
+
userOpHash: Hex;
|
|
136
|
+
vaultGroupId: number;
|
|
137
|
+
vaultIndex: number;
|
|
122
138
|
}
|
|
123
139
|
interface AccountVerifyResult {
|
|
124
140
|
address: Address;
|
|
@@ -872,6 +888,7 @@ declare const API: {
|
|
|
872
888
|
readonly walletLinkChallenge: "/api/auth/wallet/link/challenge";
|
|
873
889
|
readonly walletLinkVerify: "/api/auth/wallet/link/verify";
|
|
874
890
|
readonly wallets: "/api/auth/wallets";
|
|
891
|
+
readonly vaults: "/api/auth/vaults";
|
|
875
892
|
};
|
|
876
893
|
readonly accounts: {
|
|
877
894
|
readonly create: "/api/accounts";
|
|
@@ -1134,7 +1151,8 @@ declare class VaultumError extends Error {
|
|
|
1134
1151
|
status?: number | undefined;
|
|
1135
1152
|
details?: unknown | undefined;
|
|
1136
1153
|
retryable: boolean;
|
|
1137
|
-
|
|
1154
|
+
rawCode?: string | undefined;
|
|
1155
|
+
constructor(message: string, code?: SDKErrorCode | undefined, status?: number | undefined, details?: unknown | undefined, retryable?: boolean, rawCode?: string | undefined);
|
|
1138
1156
|
}
|
|
1139
1157
|
declare class VaultumClient {
|
|
1140
1158
|
private baseURL;
|
|
@@ -1215,12 +1233,14 @@ declare class VaultumClient {
|
|
|
1215
1233
|
signal?: AbortSignal;
|
|
1216
1234
|
}): Promise<WalletsResponse>;
|
|
1217
1235
|
wallets(signal?: AbortSignal): Promise<WalletsResponse>;
|
|
1236
|
+
vaults(signal?: AbortSignal): Promise<VaultGroupsResponse>;
|
|
1218
1237
|
getOperation(id: string, signal?: AbortSignal): Promise<OperationResult>;
|
|
1219
1238
|
waitForOperation(id: string, options?: WaitOptions): Promise<OperationResult>;
|
|
1220
1239
|
getCapabilities(signal?: AbortSignal): Promise<Capabilities>;
|
|
1221
1240
|
createAccount(options: {
|
|
1222
1241
|
sessionKeyAddress: Address;
|
|
1223
1242
|
chain?: string;
|
|
1243
|
+
vaultIndex?: number;
|
|
1224
1244
|
salt?: Hex;
|
|
1225
1245
|
owners?: Address[];
|
|
1226
1246
|
threshold?: number;
|
|
@@ -2200,4 +2220,4 @@ declare function hashCrossChainRootTypedData(params: CrossChainRootTypedDataPara
|
|
|
2200
2220
|
|
|
2201
2221
|
declare const VERSION: string;
|
|
2202
2222
|
|
|
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 };
|
|
2223
|
+
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 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,8 @@ 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"
|
|
69
70
|
},
|
|
70
71
|
accounts: {
|
|
71
72
|
create: "/api/accounts",
|
|
@@ -527,12 +528,13 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
|
527
528
|
]);
|
|
528
529
|
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
529
530
|
var VaultumError = class extends Error {
|
|
530
|
-
constructor(message, code, status, details, retryable = false) {
|
|
531
|
+
constructor(message, code, status, details, retryable = false, rawCode) {
|
|
531
532
|
super(message);
|
|
532
533
|
this.code = code;
|
|
533
534
|
this.status = status;
|
|
534
535
|
this.details = details;
|
|
535
536
|
this.retryable = retryable;
|
|
537
|
+
this.rawCode = rawCode;
|
|
536
538
|
this.name = "VaultumError";
|
|
537
539
|
}
|
|
538
540
|
};
|
|
@@ -735,13 +737,15 @@ var VaultumClient = class {
|
|
|
735
737
|
const data = await res.json().catch(() => ({}));
|
|
736
738
|
if (!res.ok) {
|
|
737
739
|
const errBody = data;
|
|
738
|
-
const
|
|
740
|
+
const rawCode = errBody.code ?? errBody.error;
|
|
741
|
+
const code = mapErrorCode(rawCode, res.status);
|
|
739
742
|
throw new VaultumError(
|
|
740
743
|
errBody.message ?? errBody.error ?? `Request failed: ${res.status}`,
|
|
741
744
|
code,
|
|
742
745
|
res.status,
|
|
743
746
|
errBody.details,
|
|
744
|
-
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status)
|
|
747
|
+
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status),
|
|
748
|
+
rawCode
|
|
745
749
|
);
|
|
746
750
|
}
|
|
747
751
|
let responseCtx = { status: res.status, headers: res.headers, data };
|
|
@@ -883,6 +887,20 @@ var VaultumClient = class {
|
|
|
883
887
|
}))
|
|
884
888
|
};
|
|
885
889
|
}
|
|
890
|
+
async vaults(signal) {
|
|
891
|
+
const raw = await this.request("GET", API.auth.vaults, void 0, { signal });
|
|
892
|
+
return {
|
|
893
|
+
vaultGroups: (raw.vaultGroups ?? []).map((g) => ({
|
|
894
|
+
id: g.id,
|
|
895
|
+
vaultIndex: g.vault_index,
|
|
896
|
+
address: g.address.toLowerCase(),
|
|
897
|
+
deployments: (g.deployments ?? []).map((d) => ({
|
|
898
|
+
chainId: d.chain_id,
|
|
899
|
+
deployed: d.deployed
|
|
900
|
+
}))
|
|
901
|
+
}))
|
|
902
|
+
};
|
|
903
|
+
}
|
|
886
904
|
async getOperation(id, signal) {
|
|
887
905
|
return this.request("GET", API.op.status(id), void 0, { signal });
|
|
888
906
|
}
|
|
@@ -909,6 +927,7 @@ var VaultumClient = class {
|
|
|
909
927
|
sessionKeyAddress: options.sessionKeyAddress.toLowerCase(),
|
|
910
928
|
type: "create",
|
|
911
929
|
chain: options.chain ?? this.chain,
|
|
930
|
+
vaultIndex: options.vaultIndex,
|
|
912
931
|
salt: options.salt,
|
|
913
932
|
owners: options.owners?.map((a) => a.toLowerCase()),
|
|
914
933
|
threshold: options.threshold,
|
|
@@ -1993,7 +2012,7 @@ function hashCrossChainRootTypedData(params) {
|
|
|
1993
2012
|
}
|
|
1994
2013
|
|
|
1995
2014
|
// src/index.ts
|
|
1996
|
-
var VERSION = "0.1.
|
|
2015
|
+
var VERSION = "0.1.6";
|
|
1997
2016
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1998
2017
|
0 && (module.exports = {
|
|
1999
2018
|
API,
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,8 @@ 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"
|
|
24
25
|
},
|
|
25
26
|
accounts: {
|
|
26
27
|
create: "/api/accounts",
|
|
@@ -491,12 +492,13 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
|
491
492
|
]);
|
|
492
493
|
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
493
494
|
var VaultumError = class extends Error {
|
|
494
|
-
constructor(message, code, status, details, retryable = false) {
|
|
495
|
+
constructor(message, code, status, details, retryable = false, rawCode) {
|
|
495
496
|
super(message);
|
|
496
497
|
this.code = code;
|
|
497
498
|
this.status = status;
|
|
498
499
|
this.details = details;
|
|
499
500
|
this.retryable = retryable;
|
|
501
|
+
this.rawCode = rawCode;
|
|
500
502
|
this.name = "VaultumError";
|
|
501
503
|
}
|
|
502
504
|
};
|
|
@@ -699,13 +701,15 @@ var VaultumClient = class {
|
|
|
699
701
|
const data = await res.json().catch(() => ({}));
|
|
700
702
|
if (!res.ok) {
|
|
701
703
|
const errBody = data;
|
|
702
|
-
const
|
|
704
|
+
const rawCode = errBody.code ?? errBody.error;
|
|
705
|
+
const code = mapErrorCode(rawCode, res.status);
|
|
703
706
|
throw new VaultumError(
|
|
704
707
|
errBody.message ?? errBody.error ?? `Request failed: ${res.status}`,
|
|
705
708
|
code,
|
|
706
709
|
res.status,
|
|
707
710
|
errBody.details,
|
|
708
|
-
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status)
|
|
711
|
+
RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status),
|
|
712
|
+
rawCode
|
|
709
713
|
);
|
|
710
714
|
}
|
|
711
715
|
let responseCtx = { status: res.status, headers: res.headers, data };
|
|
@@ -847,6 +851,20 @@ var VaultumClient = class {
|
|
|
847
851
|
}))
|
|
848
852
|
};
|
|
849
853
|
}
|
|
854
|
+
async vaults(signal) {
|
|
855
|
+
const raw = await this.request("GET", API.auth.vaults, void 0, { signal });
|
|
856
|
+
return {
|
|
857
|
+
vaultGroups: (raw.vaultGroups ?? []).map((g) => ({
|
|
858
|
+
id: g.id,
|
|
859
|
+
vaultIndex: g.vault_index,
|
|
860
|
+
address: g.address.toLowerCase(),
|
|
861
|
+
deployments: (g.deployments ?? []).map((d) => ({
|
|
862
|
+
chainId: d.chain_id,
|
|
863
|
+
deployed: d.deployed
|
|
864
|
+
}))
|
|
865
|
+
}))
|
|
866
|
+
};
|
|
867
|
+
}
|
|
850
868
|
async getOperation(id, signal) {
|
|
851
869
|
return this.request("GET", API.op.status(id), void 0, { signal });
|
|
852
870
|
}
|
|
@@ -873,6 +891,7 @@ var VaultumClient = class {
|
|
|
873
891
|
sessionKeyAddress: options.sessionKeyAddress.toLowerCase(),
|
|
874
892
|
type: "create",
|
|
875
893
|
chain: options.chain ?? this.chain,
|
|
894
|
+
vaultIndex: options.vaultIndex,
|
|
876
895
|
salt: options.salt,
|
|
877
896
|
owners: options.owners?.map((a) => a.toLowerCase()),
|
|
878
897
|
threshold: options.threshold,
|
|
@@ -1957,7 +1976,7 @@ function hashCrossChainRootTypedData(params) {
|
|
|
1957
1976
|
}
|
|
1958
1977
|
|
|
1959
1978
|
// src/index.ts
|
|
1960
|
-
var VERSION = "0.1.
|
|
1979
|
+
var VERSION = "0.1.6";
|
|
1961
1980
|
export {
|
|
1962
1981
|
API,
|
|
1963
1982
|
CONTRACTS,
|