@vaultum/sdk 0.1.7 → 0.1.9

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 CHANGED
@@ -138,6 +138,14 @@ interface AccountCreateResult {
138
138
  userOpHash: Hex;
139
139
  vaultGroupId: number;
140
140
  vaultIndex: number;
141
+ sponsorship?: {
142
+ mode: 'sponsored' | 'self_funded';
143
+ fallbackReason?: string;
144
+ };
145
+ funding?: {
146
+ requiredPrefundWei: string;
147
+ recommendedPrefundWei: string;
148
+ };
141
149
  }
142
150
  interface AccountVerifyResult {
143
151
  address: Address;
@@ -326,18 +334,59 @@ interface FinalizedProposal {
326
334
  userOp: Record<string, unknown>;
327
335
  }
328
336
  interface SettlementTokens {
337
+ chainId: number;
338
+ paymaster: Address | null;
329
339
  tokens: Array<{
330
340
  symbol: string;
331
341
  address: Address;
332
- decimals: number;
342
+ pricing: {
343
+ currentRate: string;
344
+ minRate: string;
345
+ maxRate: string;
346
+ maxChargePerOp: string;
347
+ };
333
348
  }>;
334
349
  }
335
350
  interface SettlementQuote {
336
- token: string;
337
- tokenAmount: string;
338
- gasCostWei: string;
339
- exchangeRate: string;
340
- validUntil: number;
351
+ chainId: number;
352
+ sender: Address;
353
+ token: {
354
+ symbol: string;
355
+ address: Address;
356
+ };
357
+ quote: {
358
+ tokenPerEth: string;
359
+ maxTokenCharge: string;
360
+ postOpGasOverhead: string;
361
+ validAfter: number;
362
+ validUntil: number;
363
+ nonce: string;
364
+ bounds: {
365
+ min: string;
366
+ max: string;
367
+ };
368
+ };
369
+ gasLimits: {
370
+ paymasterVerificationGasLimit: string;
371
+ paymasterPostOpGasLimit: string;
372
+ };
373
+ }
374
+ interface SettlementPrepareResult {
375
+ paymasterAndData: Hex;
376
+ token: {
377
+ symbol: string;
378
+ address: Address;
379
+ };
380
+ quote: {
381
+ tokenPerEth: string;
382
+ validUntil: number;
383
+ bounds: {
384
+ min: string;
385
+ max: string;
386
+ };
387
+ };
388
+ nonce: string;
389
+ policyVersion: number;
341
390
  }
342
391
  type SwapRouteStepType = 'swap' | 'bridge';
343
392
  interface SwapRouteStep {
@@ -1346,6 +1395,7 @@ declare class VaultumClient {
1346
1395
  sessionKeyAddress: Address;
1347
1396
  chain?: string;
1348
1397
  vaultIndex?: number;
1398
+ sponsorshipMode?: 'required' | 'prefer' | 'disabled';
1349
1399
  salt?: Hex;
1350
1400
  owners?: Address[];
1351
1401
  threshold?: number;
@@ -1489,19 +1539,19 @@ declare class VaultumClient {
1489
1539
  getSettlementQuote(params: {
1490
1540
  chain: string;
1491
1541
  sender: Address;
1492
- token: 'USDC' | 'USDT';
1542
+ token: string;
1493
1543
  maxGasCost: string;
1494
1544
  maxFeePerGas: string;
1495
1545
  signal?: AbortSignal;
1496
1546
  }): Promise<SettlementQuote>;
1497
1547
  prepareSettlement(params: {
1498
1548
  chain: string;
1499
- token: 'USDC' | 'USDT';
1549
+ token: string;
1500
1550
  userOp: UserOperation | PackedUserOperation | Record<string, unknown>;
1501
1551
  idempotencyKey?: string;
1502
1552
  timestamp?: number;
1503
1553
  signal?: AbortSignal;
1504
- }): Promise<UserOpResponse>;
1554
+ }): Promise<SettlementPrepareResult>;
1505
1555
  swapQuote(params: {
1506
1556
  wallet: Address;
1507
1557
  fromChain: string;
@@ -2325,4 +2375,4 @@ declare function hashCrossChainRootTypedData(params: CrossChainRootTypedDataPara
2325
2375
 
2326
2376
  declare const VERSION: string;
2327
2377
 
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 };
2378
+ 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 SettlementPrepareResult, 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
@@ -138,6 +138,14 @@ interface AccountCreateResult {
138
138
  userOpHash: Hex;
139
139
  vaultGroupId: number;
140
140
  vaultIndex: number;
141
+ sponsorship?: {
142
+ mode: 'sponsored' | 'self_funded';
143
+ fallbackReason?: string;
144
+ };
145
+ funding?: {
146
+ requiredPrefundWei: string;
147
+ recommendedPrefundWei: string;
148
+ };
141
149
  }
142
150
  interface AccountVerifyResult {
143
151
  address: Address;
@@ -326,18 +334,59 @@ interface FinalizedProposal {
326
334
  userOp: Record<string, unknown>;
327
335
  }
328
336
  interface SettlementTokens {
337
+ chainId: number;
338
+ paymaster: Address | null;
329
339
  tokens: Array<{
330
340
  symbol: string;
331
341
  address: Address;
332
- decimals: number;
342
+ pricing: {
343
+ currentRate: string;
344
+ minRate: string;
345
+ maxRate: string;
346
+ maxChargePerOp: string;
347
+ };
333
348
  }>;
334
349
  }
335
350
  interface SettlementQuote {
336
- token: string;
337
- tokenAmount: string;
338
- gasCostWei: string;
339
- exchangeRate: string;
340
- validUntil: number;
351
+ chainId: number;
352
+ sender: Address;
353
+ token: {
354
+ symbol: string;
355
+ address: Address;
356
+ };
357
+ quote: {
358
+ tokenPerEth: string;
359
+ maxTokenCharge: string;
360
+ postOpGasOverhead: string;
361
+ validAfter: number;
362
+ validUntil: number;
363
+ nonce: string;
364
+ bounds: {
365
+ min: string;
366
+ max: string;
367
+ };
368
+ };
369
+ gasLimits: {
370
+ paymasterVerificationGasLimit: string;
371
+ paymasterPostOpGasLimit: string;
372
+ };
373
+ }
374
+ interface SettlementPrepareResult {
375
+ paymasterAndData: Hex;
376
+ token: {
377
+ symbol: string;
378
+ address: Address;
379
+ };
380
+ quote: {
381
+ tokenPerEth: string;
382
+ validUntil: number;
383
+ bounds: {
384
+ min: string;
385
+ max: string;
386
+ };
387
+ };
388
+ nonce: string;
389
+ policyVersion: number;
341
390
  }
342
391
  type SwapRouteStepType = 'swap' | 'bridge';
343
392
  interface SwapRouteStep {
@@ -1346,6 +1395,7 @@ declare class VaultumClient {
1346
1395
  sessionKeyAddress: Address;
1347
1396
  chain?: string;
1348
1397
  vaultIndex?: number;
1398
+ sponsorshipMode?: 'required' | 'prefer' | 'disabled';
1349
1399
  salt?: Hex;
1350
1400
  owners?: Address[];
1351
1401
  threshold?: number;
@@ -1489,19 +1539,19 @@ declare class VaultumClient {
1489
1539
  getSettlementQuote(params: {
1490
1540
  chain: string;
1491
1541
  sender: Address;
1492
- token: 'USDC' | 'USDT';
1542
+ token: string;
1493
1543
  maxGasCost: string;
1494
1544
  maxFeePerGas: string;
1495
1545
  signal?: AbortSignal;
1496
1546
  }): Promise<SettlementQuote>;
1497
1547
  prepareSettlement(params: {
1498
1548
  chain: string;
1499
- token: 'USDC' | 'USDT';
1549
+ token: string;
1500
1550
  userOp: UserOperation | PackedUserOperation | Record<string, unknown>;
1501
1551
  idempotencyKey?: string;
1502
1552
  timestamp?: number;
1503
1553
  signal?: AbortSignal;
1504
- }): Promise<UserOpResponse>;
1554
+ }): Promise<SettlementPrepareResult>;
1505
1555
  swapQuote(params: {
1506
1556
  wallet: Address;
1507
1557
  fromChain: string;
@@ -2325,4 +2375,4 @@ declare function hashCrossChainRootTypedData(params: CrossChainRootTypedDataPara
2325
2375
 
2326
2376
  declare const VERSION: string;
2327
2377
 
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 };
2378
+ 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 SettlementPrepareResult, 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
@@ -744,13 +744,28 @@ var VaultumClient = class {
744
744
  const data = await res.json().catch(() => ({}));
745
745
  if (!res.ok) {
746
746
  const errBody = data;
747
- const rawCode = errBody.code ?? errBody.error;
747
+ let rawCode;
748
+ let message;
749
+ let details;
750
+ if (typeof errBody.code === "string") rawCode = errBody.code;
751
+ if (typeof errBody.message === "string") message = errBody.message;
752
+ if ("details" in errBody) details = errBody.details;
753
+ const nested = errBody.error;
754
+ if (nested && typeof nested === "object") {
755
+ const nestedErr = nested;
756
+ if (!rawCode && typeof nestedErr.code === "string") rawCode = nestedErr.code;
757
+ if (!message && typeof nestedErr.message === "string") message = nestedErr.message;
758
+ if (details === void 0 && "details" in nestedErr) details = nestedErr.details;
759
+ } else if (typeof nested === "string") {
760
+ if (!rawCode) rawCode = nested;
761
+ }
748
762
  const code = mapErrorCode(rawCode, res.status);
763
+ const fallbackMessage = message ?? (typeof nested === "string" ? nested : void 0) ?? `Request failed: ${res.status}`;
749
764
  throw new VaultumError(
750
- errBody.message ?? errBody.error ?? `Request failed: ${res.status}`,
765
+ fallbackMessage,
751
766
  code,
752
767
  res.status,
753
- errBody.details,
768
+ details,
754
769
  RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status),
755
770
  rawCode
756
771
  );
@@ -911,10 +926,10 @@ var VaultumClient = class {
911
926
  return {
912
927
  vaultGroups: (raw.vaultGroups ?? []).map((g) => ({
913
928
  id: g.id,
914
- vaultIndex: g.vault_index,
929
+ vaultIndex: g.vaultIndex,
915
930
  address: g.address.toLowerCase(),
916
931
  deployments: (g.deployments ?? []).map((d) => ({
917
- chainId: d.chain_id,
932
+ chainId: d.chainId,
918
933
  deployed: d.deployed
919
934
  }))
920
935
  }))
@@ -983,6 +998,7 @@ var VaultumClient = class {
983
998
  type: "create",
984
999
  chain: options.chain ?? this.chain,
985
1000
  vaultIndex: options.vaultIndex,
1001
+ sponsorshipMode: options.sponsorshipMode ?? "prefer",
986
1002
  salt: options.salt,
987
1003
  owners: options.owners?.map((a) => a.toLowerCase()),
988
1004
  threshold: options.threshold,
@@ -1126,16 +1142,57 @@ var VaultumClient = class {
1126
1142
  }
1127
1143
  async getSettlementTokens(options) {
1128
1144
  const chain = options?.chain ?? this.chain ?? "sepolia";
1129
- return this.request("GET", `${API.settlement.tokens}?chain=${chain}`, void 0, { signal: options?.signal });
1145
+ const raw = await this.request("GET", `${API.settlement.tokens}?chain=${chain}`, void 0, {
1146
+ signal: options?.signal
1147
+ });
1148
+ return {
1149
+ chainId: Number(raw.chainId),
1150
+ paymaster: raw.paymaster ? raw.paymaster.toLowerCase() : null,
1151
+ tokens: (raw.tokens ?? []).map((token) => ({
1152
+ symbol: token.symbol,
1153
+ address: token.address.toLowerCase(),
1154
+ pricing: {
1155
+ currentRate: token.pricing.currentRate,
1156
+ minRate: token.pricing.minRate,
1157
+ maxRate: token.pricing.maxRate,
1158
+ maxChargePerOp: token.pricing.maxChargePerOp
1159
+ }
1160
+ }))
1161
+ };
1130
1162
  }
1131
1163
  async getSettlementQuote(params) {
1132
- return this.request("POST", API.settlement.quote, {
1164
+ const raw = await this.request("POST", API.settlement.quote, {
1133
1165
  chain: params.chain,
1134
1166
  sender: params.sender.toLowerCase(),
1135
1167
  token: params.token,
1136
1168
  maxGasCost: params.maxGasCost,
1137
1169
  maxFeePerGas: params.maxFeePerGas
1138
1170
  }, { signal: params.signal });
1171
+ const quote = raw;
1172
+ return {
1173
+ chainId: Number(quote.chainId),
1174
+ sender: quote.sender.toLowerCase(),
1175
+ token: {
1176
+ symbol: quote.token.symbol,
1177
+ address: quote.token.address.toLowerCase()
1178
+ },
1179
+ quote: {
1180
+ tokenPerEth: quote.quote.tokenPerEth,
1181
+ maxTokenCharge: quote.quote.maxTokenCharge,
1182
+ postOpGasOverhead: quote.quote.postOpGasOverhead,
1183
+ validAfter: Number(quote.quote.validAfter),
1184
+ validUntil: Number(quote.quote.validUntil),
1185
+ nonce: quote.quote.nonce,
1186
+ bounds: {
1187
+ min: quote.quote.bounds.min,
1188
+ max: quote.quote.bounds.max
1189
+ }
1190
+ },
1191
+ gasLimits: {
1192
+ paymasterVerificationGasLimit: quote.gasLimits.paymasterVerificationGasLimit,
1193
+ paymasterPostOpGasLimit: quote.gasLimits.paymasterPostOpGasLimit
1194
+ }
1195
+ };
1139
1196
  }
1140
1197
  async prepareSettlement(params) {
1141
1198
  const userOp = isPackedUserOp(params.userOp) ? packedToUserOperation(params.userOp) : isUserOperation(params.userOp) ? normalizeUserOperation(params.userOp) : params.userOp;
@@ -1146,11 +1203,29 @@ var VaultumClient = class {
1146
1203
  };
1147
1204
  const idempotencyKey = params.idempotencyKey ?? autoIdempotencyKey(body);
1148
1205
  const timestamp = params.timestamp ?? nowUnix();
1149
- return this.request("POST", API.settlement.prepare, body, {
1206
+ const raw = await this.request("POST", API.settlement.prepare, body, {
1150
1207
  idempotencyKey,
1151
1208
  timestamp,
1152
1209
  signal: params.signal
1153
1210
  });
1211
+ const prepared = raw;
1212
+ return {
1213
+ paymasterAndData: prepared.paymasterAndData,
1214
+ token: {
1215
+ symbol: prepared.token.symbol,
1216
+ address: prepared.token.address.toLowerCase()
1217
+ },
1218
+ quote: {
1219
+ tokenPerEth: prepared.quote.tokenPerEth,
1220
+ validUntil: Number(prepared.quote.validUntil),
1221
+ bounds: {
1222
+ min: prepared.quote.bounds.min,
1223
+ max: prepared.quote.bounds.max
1224
+ }
1225
+ },
1226
+ nonce: prepared.nonce,
1227
+ policyVersion: Number(prepared.policyVersion)
1228
+ };
1154
1229
  }
1155
1230
  async swapQuote(params) {
1156
1231
  return this.request("POST", API.swap.quote, {
@@ -2067,7 +2142,7 @@ function hashCrossChainRootTypedData(params) {
2067
2142
  }
2068
2143
 
2069
2144
  // src/index.ts
2070
- var VERSION = "0.1.7";
2145
+ var VERSION = "0.1.9";
2071
2146
  // Annotate the CommonJS export names for ESM import in node:
2072
2147
  0 && (module.exports = {
2073
2148
  API,
package/dist/index.mjs CHANGED
@@ -708,13 +708,28 @@ var VaultumClient = class {
708
708
  const data = await res.json().catch(() => ({}));
709
709
  if (!res.ok) {
710
710
  const errBody = data;
711
- const rawCode = errBody.code ?? errBody.error;
711
+ let rawCode;
712
+ let message;
713
+ let details;
714
+ if (typeof errBody.code === "string") rawCode = errBody.code;
715
+ if (typeof errBody.message === "string") message = errBody.message;
716
+ if ("details" in errBody) details = errBody.details;
717
+ const nested = errBody.error;
718
+ if (nested && typeof nested === "object") {
719
+ const nestedErr = nested;
720
+ if (!rawCode && typeof nestedErr.code === "string") rawCode = nestedErr.code;
721
+ if (!message && typeof nestedErr.message === "string") message = nestedErr.message;
722
+ if (details === void 0 && "details" in nestedErr) details = nestedErr.details;
723
+ } else if (typeof nested === "string") {
724
+ if (!rawCode) rawCode = nested;
725
+ }
712
726
  const code = mapErrorCode(rawCode, res.status);
727
+ const fallbackMessage = message ?? (typeof nested === "string" ? nested : void 0) ?? `Request failed: ${res.status}`;
713
728
  throw new VaultumError(
714
- errBody.message ?? errBody.error ?? `Request failed: ${res.status}`,
729
+ fallbackMessage,
715
730
  code,
716
731
  res.status,
717
- errBody.details,
732
+ details,
718
733
  RETRYABLE_CODES.has(code) || RETRYABLE_STATUS.has(res.status),
719
734
  rawCode
720
735
  );
@@ -875,10 +890,10 @@ var VaultumClient = class {
875
890
  return {
876
891
  vaultGroups: (raw.vaultGroups ?? []).map((g) => ({
877
892
  id: g.id,
878
- vaultIndex: g.vault_index,
893
+ vaultIndex: g.vaultIndex,
879
894
  address: g.address.toLowerCase(),
880
895
  deployments: (g.deployments ?? []).map((d) => ({
881
- chainId: d.chain_id,
896
+ chainId: d.chainId,
882
897
  deployed: d.deployed
883
898
  }))
884
899
  }))
@@ -947,6 +962,7 @@ var VaultumClient = class {
947
962
  type: "create",
948
963
  chain: options.chain ?? this.chain,
949
964
  vaultIndex: options.vaultIndex,
965
+ sponsorshipMode: options.sponsorshipMode ?? "prefer",
950
966
  salt: options.salt,
951
967
  owners: options.owners?.map((a) => a.toLowerCase()),
952
968
  threshold: options.threshold,
@@ -1090,16 +1106,57 @@ var VaultumClient = class {
1090
1106
  }
1091
1107
  async getSettlementTokens(options) {
1092
1108
  const chain = options?.chain ?? this.chain ?? "sepolia";
1093
- return this.request("GET", `${API.settlement.tokens}?chain=${chain}`, void 0, { signal: options?.signal });
1109
+ const raw = await this.request("GET", `${API.settlement.tokens}?chain=${chain}`, void 0, {
1110
+ signal: options?.signal
1111
+ });
1112
+ return {
1113
+ chainId: Number(raw.chainId),
1114
+ paymaster: raw.paymaster ? raw.paymaster.toLowerCase() : null,
1115
+ tokens: (raw.tokens ?? []).map((token) => ({
1116
+ symbol: token.symbol,
1117
+ address: token.address.toLowerCase(),
1118
+ pricing: {
1119
+ currentRate: token.pricing.currentRate,
1120
+ minRate: token.pricing.minRate,
1121
+ maxRate: token.pricing.maxRate,
1122
+ maxChargePerOp: token.pricing.maxChargePerOp
1123
+ }
1124
+ }))
1125
+ };
1094
1126
  }
1095
1127
  async getSettlementQuote(params) {
1096
- return this.request("POST", API.settlement.quote, {
1128
+ const raw = await this.request("POST", API.settlement.quote, {
1097
1129
  chain: params.chain,
1098
1130
  sender: params.sender.toLowerCase(),
1099
1131
  token: params.token,
1100
1132
  maxGasCost: params.maxGasCost,
1101
1133
  maxFeePerGas: params.maxFeePerGas
1102
1134
  }, { signal: params.signal });
1135
+ const quote = raw;
1136
+ return {
1137
+ chainId: Number(quote.chainId),
1138
+ sender: quote.sender.toLowerCase(),
1139
+ token: {
1140
+ symbol: quote.token.symbol,
1141
+ address: quote.token.address.toLowerCase()
1142
+ },
1143
+ quote: {
1144
+ tokenPerEth: quote.quote.tokenPerEth,
1145
+ maxTokenCharge: quote.quote.maxTokenCharge,
1146
+ postOpGasOverhead: quote.quote.postOpGasOverhead,
1147
+ validAfter: Number(quote.quote.validAfter),
1148
+ validUntil: Number(quote.quote.validUntil),
1149
+ nonce: quote.quote.nonce,
1150
+ bounds: {
1151
+ min: quote.quote.bounds.min,
1152
+ max: quote.quote.bounds.max
1153
+ }
1154
+ },
1155
+ gasLimits: {
1156
+ paymasterVerificationGasLimit: quote.gasLimits.paymasterVerificationGasLimit,
1157
+ paymasterPostOpGasLimit: quote.gasLimits.paymasterPostOpGasLimit
1158
+ }
1159
+ };
1103
1160
  }
1104
1161
  async prepareSettlement(params) {
1105
1162
  const userOp = isPackedUserOp(params.userOp) ? packedToUserOperation(params.userOp) : isUserOperation(params.userOp) ? normalizeUserOperation(params.userOp) : params.userOp;
@@ -1110,11 +1167,29 @@ var VaultumClient = class {
1110
1167
  };
1111
1168
  const idempotencyKey = params.idempotencyKey ?? autoIdempotencyKey(body);
1112
1169
  const timestamp = params.timestamp ?? nowUnix();
1113
- return this.request("POST", API.settlement.prepare, body, {
1170
+ const raw = await this.request("POST", API.settlement.prepare, body, {
1114
1171
  idempotencyKey,
1115
1172
  timestamp,
1116
1173
  signal: params.signal
1117
1174
  });
1175
+ const prepared = raw;
1176
+ return {
1177
+ paymasterAndData: prepared.paymasterAndData,
1178
+ token: {
1179
+ symbol: prepared.token.symbol,
1180
+ address: prepared.token.address.toLowerCase()
1181
+ },
1182
+ quote: {
1183
+ tokenPerEth: prepared.quote.tokenPerEth,
1184
+ validUntil: Number(prepared.quote.validUntil),
1185
+ bounds: {
1186
+ min: prepared.quote.bounds.min,
1187
+ max: prepared.quote.bounds.max
1188
+ }
1189
+ },
1190
+ nonce: prepared.nonce,
1191
+ policyVersion: Number(prepared.policyVersion)
1192
+ };
1118
1193
  }
1119
1194
  async swapQuote(params) {
1120
1195
  return this.request("POST", API.swap.quote, {
@@ -2031,7 +2106,7 @@ function hashCrossChainRootTypedData(params) {
2031
2106
  }
2032
2107
 
2033
2108
  // src/index.ts
2034
- var VERSION = "0.1.7";
2109
+ var VERSION = "0.1.9";
2035
2110
  export {
2036
2111
  API,
2037
2112
  CONTRACTS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaultum/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "TypeScript SDK for Vaultum smart wallet",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",