@naculus/connect-appkit-core 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, SessionKeyRail, SessionKeyScope, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, delegationTypedData, ScopeCheckResult, SpendRefusal, Authorization, ListedAuthorization, SpendRequest, SettlementVerification, SolanaSessionKeyInfo, SolanaSessionKeyScope, SolanaSessionKeyManager, SolanaPaymentRpc } from '@naculus/connect-core';
1
+ import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, SessionKeyRail, SessionKeyScope, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, TransactionRequest, delegationTypedData, ScopeCheckResult, SpendRefusal, Authorization, ListedAuthorization, SpendRequest, SettlementVerification, SolanaSessionKeyInfo, SolanaSessionKeyScope, SolanaSessionKeyManager, SolanaPaymentRpc } from '@naculus/connect-core';
2
2
  import { X402TypedDataSigner } from '@naculus/payments-x402';
3
3
  export { X402TypedDataSigner } from '@naculus/payments-x402';
4
4
 
@@ -725,8 +725,17 @@ interface PolicyExecutionCheck {
725
725
  executorAddress?: `0x${string}`;
726
726
  reason: string;
727
727
  }
728
+ /**
729
+ * What an execution adapter prepared for one policy execution.
730
+ *
731
+ * Breaking change: `request` is new and required. Adapters must return the
732
+ * exact transaction they will broadcast as a `TransactionRequest`; `digest`
733
+ * must equal `transactionSigningHash(request)`. Signing refuses any mismatch.
734
+ */
728
735
  interface PreparedPolicyExecution {
729
736
  digest: Hex;
737
+ /** The exact transaction to sign, as connect-core's transaction request. */
738
+ request: TransactionRequest;
730
739
  transaction: SessionKeyTransaction;
731
740
  payload: unknown;
732
741
  }
@@ -813,7 +822,7 @@ interface DelegationPolicyFlow {
813
822
  createPolicy: (scope: Partial<SessionKeyScope>) => Promise<SessionKeyInfo>;
814
823
  revokePolicy: (policyId: string) => Promise<void>;
815
824
  previewPolicyExecution: (policyId: string, tx: SessionKeyTransaction, callCount?: number, atomicity?: AtomicityRequirement) => Promise<DelegationPolicyPreview>;
816
- signPolicyDigest: (policyId: string, digest: `0x${string}`, tx: SessionKeyTransaction) => Promise<`0x${string}`>;
825
+ signPolicyDigest: (policyId: string, prepared: PreparedPolicyExecution) => Promise<`0x${string}`>;
817
826
  executePolicy: (policyId: string, tx: SessionKeyTransaction) => Promise<PolicyExecutionSubmission>;
818
827
  }
819
828
  declare function createDelegationPolicyFlow(deps: DelegationPolicyDeps): DelegationPolicyFlow;
@@ -825,7 +834,7 @@ declare function createDelegationPolicyFlow(deps: DelegationPolicyDeps): Delegat
825
834
  * The session key sends `DelegationManager.redeemDelegations` from its own
826
835
  * address and pays the gas; the chain enforces the delegation's caveats. The
827
836
  * adapter builds that transaction and broadcasts it; the delegation-policy
828
- * flow signs it with connect-core's `signDelegationRedemption`, which
837
+ * flow signs it with connect-core's `signTransactionDelegationRedemption`, which
829
838
  * re-encodes the redemption from the stored delegation and refuses anything
830
839
  * else.
831
840
  *
@@ -1230,4 +1239,5 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
1230
1239
  refreshedAt: null;
1231
1240
  };
1232
1241
 
1233
- export { type AddressValidationLevel, type AssetId, type AtomicSupport, type AuthorizationAmountView, type AuthorizationAssetMetadata, type AuthorizationDescription, type AuthorizationExpiryView, type AuthorizationGrantView, type AuthorizationRecipientView, type ChainCapabilities, type ChainInfo, type CompareCosts, type CompareCostsInput, type ConnectionStatus, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_VERIFY_RETRY, type DecimalsCache, type DelegationFrameworkAdapterOptions, type DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DelegationTypedData, type DescribeAuthorizationOptions, type DestinationIssue, type DestinationValidation, type Eip3009SessionKeyRail, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, type MppSessionChannel, type MppSessionFetch, type MppSessionFetchResult, type MppSessionForceCloseResult, type MppSessionMeter, type MppSessionReceipt, type MppSessionRequest, type MppSessionRequestInit, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type NotificationSettingsUpdate, type PaymentFetch, type PaymentFetchResult, type PaymentRecord, type PaymentVerification, type PaymentVerificationStatus, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, type RedemptionCodec, type RedemptionRpc, type RedemptionTransaction, type RetryOptions, type RouteQuote, type RouteQuoteInput, type RouteQuoteOptions, type SessionKeyRailGrantCheck, type SimulationCallClient, type SimulationTransaction, type SiwxLocation, type SiwxMessageLike, type SiwxResultLike, type SmartAccountOptionsLike, type SmartAccountType, type SolanaIdentity, type SolanaOwnerSigner, type SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, type SolanaSessionKeyFlow, type SolanaSessionKeyFlowDeps, type SolanaSigner, type SolanaWalletFeatures, type SpendExplanation, type TokenIdentity, type TransactionSimulationContext, type VerifyRetryOptions, type ViemChainShape, type WalletChain, type Web3Action, type Web3State, type X402Eip1193Provider, type X402ProviderSources, type X402SignerResolution, type X402SignerUnavailableReason, type X402WalletResolution, __resetResolverForTests, addInAppNotification, applySettlementVerification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, checkSessionKeyRailGrant, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, createX402WalletSigner, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeAuthorization, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, errorMessage, explainSpend, fetchUserOperationReceipt, findX402Provider, formatAuthorizationAmount, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readCurrentMppSessionChannel, readDecimals, readMppRecoveryChannelId, readMppSessionChannel, readMppSessionReceipt, readSolanaRoles, replayNotificationSettings, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, resolveX402Wallet, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
1242
+ export { DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_VERIFY_RETRY, InvalidUserOperationReceiptError, NOTIFICATION_SETTINGS_KEY, __resetResolverForTests, addInAppNotification, applySettlementVerification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, checkSessionKeyRailGrant, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, createX402WalletSigner, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeAuthorization, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, errorMessage, explainSpend, fetchUserOperationReceipt, findX402Provider, formatAuthorizationAmount, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readCurrentMppSessionChannel, readDecimals, readMppRecoveryChannelId, readMppSessionChannel, readMppSessionReceipt, readSolanaRoles, replayNotificationSettings, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, resolveX402Wallet, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
1243
+ export type { AddressValidationLevel, AssetId, AtomicSupport, AuthorizationAmountView, AuthorizationAssetMetadata, AuthorizationDescription, AuthorizationExpiryView, AuthorizationGrantView, AuthorizationRecipientView, ChainCapabilities, ChainInfo, CompareCosts, CompareCostsInput, ConnectionStatus, CostComparison, CostComparisonOperation, CostComparisonOptions, DecimalsCache, DelegationFrameworkAdapterOptions, DelegationPolicyDeps, DelegationPolicyFlow, DelegationPolicyPreview, DelegationTypedData, DescribeAuthorizationOptions, DestinationIssue, DestinationValidation, Eip3009SessionKeyRail, ExecutableQuote, ExecuteRoute, ExecuteRouteError, ExecuteRouteOptions, ExecuteRouteResult, GetRouteQuotes, MppSessionChannel, MppSessionFetch, MppSessionFetchResult, MppSessionForceCloseResult, MppSessionMeter, MppSessionReceipt, MppSessionRequest, MppSessionRequestInit, NotificationSettingsStorage, NotificationSettingsUpdate, PaymentFetch, PaymentFetchResult, PaymentRecord, PaymentVerification, PaymentVerificationStatus, PolicyExecutionAdapter, PolicyExecutionCheck, PolicyExecutionPreview, PolicyExecutionRoute, PolicyExecutionSubmission, PolicySignatureVerifier, PreparedPolicyExecution, RedemptionCodec, RedemptionRpc, RedemptionTransaction, RetryOptions, RouteQuote, RouteQuoteInput, RouteQuoteOptions, SessionKeyRailGrantCheck, SimulationCallClient, SimulationTransaction, SiwxLocation, SiwxMessageLike, SiwxResultLike, SmartAccountOptionsLike, SmartAccountType, SolanaIdentity, SolanaOwnerSigner, SolanaPayer, SolanaRoles, SolanaRolesAbsence, SolanaRolesSource, SolanaRolesState, SolanaSessionKeyFlow, SolanaSessionKeyFlowDeps, SolanaSigner, SolanaWalletFeatures, SpendExplanation, TokenIdentity, TransactionSimulationContext, VerifyRetryOptions, ViemChainShape, WalletChain, Web3Action, Web3State, X402Eip1193Provider, X402ProviderSources, X402SignerResolution, X402SignerUnavailableReason, X402WalletResolution };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, SessionKeyRail, SessionKeyScope, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, delegationTypedData, ScopeCheckResult, SpendRefusal, Authorization, ListedAuthorization, SpendRequest, SettlementVerification, SolanaSessionKeyInfo, SolanaSessionKeyScope, SolanaSessionKeyManager, SolanaPaymentRpc } from '@naculus/connect-core';
1
+ import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, SessionKeyRail, SessionKeyScope, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, TransactionRequest, delegationTypedData, ScopeCheckResult, SpendRefusal, Authorization, ListedAuthorization, SpendRequest, SettlementVerification, SolanaSessionKeyInfo, SolanaSessionKeyScope, SolanaSessionKeyManager, SolanaPaymentRpc } from '@naculus/connect-core';
2
2
  import { X402TypedDataSigner } from '@naculus/payments-x402';
3
3
  export { X402TypedDataSigner } from '@naculus/payments-x402';
4
4
 
@@ -725,8 +725,17 @@ interface PolicyExecutionCheck {
725
725
  executorAddress?: `0x${string}`;
726
726
  reason: string;
727
727
  }
728
+ /**
729
+ * What an execution adapter prepared for one policy execution.
730
+ *
731
+ * Breaking change: `request` is new and required. Adapters must return the
732
+ * exact transaction they will broadcast as a `TransactionRequest`; `digest`
733
+ * must equal `transactionSigningHash(request)`. Signing refuses any mismatch.
734
+ */
728
735
  interface PreparedPolicyExecution {
729
736
  digest: Hex;
737
+ /** The exact transaction to sign, as connect-core's transaction request. */
738
+ request: TransactionRequest;
730
739
  transaction: SessionKeyTransaction;
731
740
  payload: unknown;
732
741
  }
@@ -813,7 +822,7 @@ interface DelegationPolicyFlow {
813
822
  createPolicy: (scope: Partial<SessionKeyScope>) => Promise<SessionKeyInfo>;
814
823
  revokePolicy: (policyId: string) => Promise<void>;
815
824
  previewPolicyExecution: (policyId: string, tx: SessionKeyTransaction, callCount?: number, atomicity?: AtomicityRequirement) => Promise<DelegationPolicyPreview>;
816
- signPolicyDigest: (policyId: string, digest: `0x${string}`, tx: SessionKeyTransaction) => Promise<`0x${string}`>;
825
+ signPolicyDigest: (policyId: string, prepared: PreparedPolicyExecution) => Promise<`0x${string}`>;
817
826
  executePolicy: (policyId: string, tx: SessionKeyTransaction) => Promise<PolicyExecutionSubmission>;
818
827
  }
819
828
  declare function createDelegationPolicyFlow(deps: DelegationPolicyDeps): DelegationPolicyFlow;
@@ -825,7 +834,7 @@ declare function createDelegationPolicyFlow(deps: DelegationPolicyDeps): Delegat
825
834
  * The session key sends `DelegationManager.redeemDelegations` from its own
826
835
  * address and pays the gas; the chain enforces the delegation's caveats. The
827
836
  * adapter builds that transaction and broadcasts it; the delegation-policy
828
- * flow signs it with connect-core's `signDelegationRedemption`, which
837
+ * flow signs it with connect-core's `signTransactionDelegationRedemption`, which
829
838
  * re-encodes the redemption from the stored delegation and refuses anything
830
839
  * else.
831
840
  *
@@ -1230,4 +1239,5 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
1230
1239
  refreshedAt: null;
1231
1240
  };
1232
1241
 
1233
- export { type AddressValidationLevel, type AssetId, type AtomicSupport, type AuthorizationAmountView, type AuthorizationAssetMetadata, type AuthorizationDescription, type AuthorizationExpiryView, type AuthorizationGrantView, type AuthorizationRecipientView, type ChainCapabilities, type ChainInfo, type CompareCosts, type CompareCostsInput, type ConnectionStatus, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_VERIFY_RETRY, type DecimalsCache, type DelegationFrameworkAdapterOptions, type DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DelegationTypedData, type DescribeAuthorizationOptions, type DestinationIssue, type DestinationValidation, type Eip3009SessionKeyRail, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, type MppSessionChannel, type MppSessionFetch, type MppSessionFetchResult, type MppSessionForceCloseResult, type MppSessionMeter, type MppSessionReceipt, type MppSessionRequest, type MppSessionRequestInit, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type NotificationSettingsUpdate, type PaymentFetch, type PaymentFetchResult, type PaymentRecord, type PaymentVerification, type PaymentVerificationStatus, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, type RedemptionCodec, type RedemptionRpc, type RedemptionTransaction, type RetryOptions, type RouteQuote, type RouteQuoteInput, type RouteQuoteOptions, type SessionKeyRailGrantCheck, type SimulationCallClient, type SimulationTransaction, type SiwxLocation, type SiwxMessageLike, type SiwxResultLike, type SmartAccountOptionsLike, type SmartAccountType, type SolanaIdentity, type SolanaOwnerSigner, type SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, type SolanaSessionKeyFlow, type SolanaSessionKeyFlowDeps, type SolanaSigner, type SolanaWalletFeatures, type SpendExplanation, type TokenIdentity, type TransactionSimulationContext, type VerifyRetryOptions, type ViemChainShape, type WalletChain, type Web3Action, type Web3State, type X402Eip1193Provider, type X402ProviderSources, type X402SignerResolution, type X402SignerUnavailableReason, type X402WalletResolution, __resetResolverForTests, addInAppNotification, applySettlementVerification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, checkSessionKeyRailGrant, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, createX402WalletSigner, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeAuthorization, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, errorMessage, explainSpend, fetchUserOperationReceipt, findX402Provider, formatAuthorizationAmount, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readCurrentMppSessionChannel, readDecimals, readMppRecoveryChannelId, readMppSessionChannel, readMppSessionReceipt, readSolanaRoles, replayNotificationSettings, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, resolveX402Wallet, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
1242
+ export { DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_VERIFY_RETRY, InvalidUserOperationReceiptError, NOTIFICATION_SETTINGS_KEY, __resetResolverForTests, addInAppNotification, applySettlementVerification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, checkSessionKeyRailGrant, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, createX402WalletSigner, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeAuthorization, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, errorMessage, explainSpend, fetchUserOperationReceipt, findX402Provider, formatAuthorizationAmount, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readCurrentMppSessionChannel, readDecimals, readMppRecoveryChannelId, readMppSessionChannel, readMppSessionReceipt, readSolanaRoles, replayNotificationSettings, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, resolveX402Wallet, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
1243
+ export type { AddressValidationLevel, AssetId, AtomicSupport, AuthorizationAmountView, AuthorizationAssetMetadata, AuthorizationDescription, AuthorizationExpiryView, AuthorizationGrantView, AuthorizationRecipientView, ChainCapabilities, ChainInfo, CompareCosts, CompareCostsInput, ConnectionStatus, CostComparison, CostComparisonOperation, CostComparisonOptions, DecimalsCache, DelegationFrameworkAdapterOptions, DelegationPolicyDeps, DelegationPolicyFlow, DelegationPolicyPreview, DelegationTypedData, DescribeAuthorizationOptions, DestinationIssue, DestinationValidation, Eip3009SessionKeyRail, ExecutableQuote, ExecuteRoute, ExecuteRouteError, ExecuteRouteOptions, ExecuteRouteResult, GetRouteQuotes, MppSessionChannel, MppSessionFetch, MppSessionFetchResult, MppSessionForceCloseResult, MppSessionMeter, MppSessionReceipt, MppSessionRequest, MppSessionRequestInit, NotificationSettingsStorage, NotificationSettingsUpdate, PaymentFetch, PaymentFetchResult, PaymentRecord, PaymentVerification, PaymentVerificationStatus, PolicyExecutionAdapter, PolicyExecutionCheck, PolicyExecutionPreview, PolicyExecutionRoute, PolicyExecutionSubmission, PolicySignatureVerifier, PreparedPolicyExecution, RedemptionCodec, RedemptionRpc, RedemptionTransaction, RetryOptions, RouteQuote, RouteQuoteInput, RouteQuoteOptions, SessionKeyRailGrantCheck, SimulationCallClient, SimulationTransaction, SiwxLocation, SiwxMessageLike, SiwxResultLike, SmartAccountOptionsLike, SmartAccountType, SolanaIdentity, SolanaOwnerSigner, SolanaPayer, SolanaRoles, SolanaRolesAbsence, SolanaRolesSource, SolanaRolesState, SolanaSessionKeyFlow, SolanaSessionKeyFlowDeps, SolanaSigner, SolanaWalletFeatures, SpendExplanation, TokenIdentity, TransactionSimulationContext, VerifyRetryOptions, ViemChainShape, WalletChain, Web3Action, Web3State, X402Eip1193Provider, X402ProviderSources, X402SignerResolution, X402SignerUnavailableReason, X402WalletResolution };
package/dist/index.js CHANGED
@@ -918,8 +918,21 @@ function createDelegationFrameworkAdapter(options) {
918
918
  execution,
919
919
  unsigned
920
920
  };
921
+ const hex = (value2) => `0x${value2.toString(16)}`;
921
922
  return {
922
923
  digest: codec.signingHash(unsigned),
924
+ // The same redemption as `unsigned`, as a request for the digest check.
925
+ request: {
926
+ type: "eip1559",
927
+ chainId: unsigned.chainId,
928
+ nonce: hex(unsigned.nonce),
929
+ to: unsigned.to,
930
+ value: hex(unsigned.value),
931
+ data: unsigned.data,
932
+ gas: hex(unsigned.gas),
933
+ maxFeePerGas: hex(unsigned.maxFeePerGas),
934
+ maxPriorityFeePerGas: hex(unsigned.maxPriorityFeePerGas)
935
+ },
923
936
  transaction,
924
937
  payload
925
938
  };
@@ -940,6 +953,7 @@ import {
940
953
  delegationTypedData,
941
954
  WalletError as WalletError8
942
955
  } from "@naculus/connect-core";
956
+ import { transactionSigningHash } from "@naculus/connect-core/signing";
943
957
  function delegatesToStatelessDeleGator(delegation) {
944
958
  return delegation.delegated === true && delegation.delegate?.toLowerCase() === DELEGATION_FRAMEWORK2.eip7702StatelessDeleGator.toLowerCase();
945
959
  }
@@ -1215,16 +1229,39 @@ function createDelegationPolicyFlow(deps) {
1215
1229
  reason
1216
1230
  };
1217
1231
  };
1218
- const signVerified = (policyId, digest, tx) => manager.signWithVerifiedOffchainAuthorization(
1219
- policyId,
1220
- (authoritativePolicy) => buildDelegationPolicyMessage(authoritativePolicy, origin),
1221
- deps.verifySignature,
1222
- digest,
1223
- tx
1224
- );
1232
+ const signVerified = (policyId, prepared) => {
1233
+ const { request } = prepared;
1234
+ const computed = `0x${Array.from(
1235
+ transactionSigningHash(request),
1236
+ (byte) => byte.toString(16).padStart(2, "0")
1237
+ ).join("")}`;
1238
+ if (computed !== prepared.digest.toLowerCase()) {
1239
+ throw new WalletError8(
1240
+ "invalid_input",
1241
+ `The prepared digest ${prepared.digest} does not match the signing hash ${computed} of the prepared transaction request.`
1242
+ );
1243
+ }
1244
+ if (!sameExecutionIntent(prepared.transaction, {
1245
+ to: request.to,
1246
+ value: request.value,
1247
+ data: request.data,
1248
+ chainId: request.chainId
1249
+ })) {
1250
+ throw new WalletError8(
1251
+ "invalid_input",
1252
+ "The prepared transaction request differs from the prepared transaction checked by the policy."
1253
+ );
1254
+ }
1255
+ return manager.signTransactionWithVerifiedOffchainAuthorization(
1256
+ policyId,
1257
+ (authoritativePolicy) => buildDelegationPolicyMessage(authoritativePolicy, origin),
1258
+ deps.verifySignature,
1259
+ request
1260
+ );
1261
+ };
1225
1262
  const signRedemption = (policyId, prepared) => {
1226
1263
  const payload = prepared.payload;
1227
- if (!payload?.outerTx || !payload.execution) {
1264
+ if (!payload?.outerTx || !payload.execution || !payload.unsigned) {
1228
1265
  throw new WalletError8(
1229
1266
  "invalid_input",
1230
1267
  "The EIP-7702 adapter did not return a redemption to sign."
@@ -1248,15 +1285,33 @@ function createDelegationPolicyFlow(deps) {
1248
1285
  "The EIP-7702 adapter's execution differs from the requested transaction."
1249
1286
  );
1250
1287
  }
1251
- return manager.signDelegationRedemption(
1288
+ const { unsigned } = payload;
1289
+ const hex = (value) => `0x${value.toString(16)}`;
1290
+ const tx = {
1291
+ type: "eip1559",
1292
+ chainId: unsigned.chainId,
1293
+ nonce: hex(unsigned.nonce),
1294
+ to: unsigned.to,
1295
+ value: hex(unsigned.value),
1296
+ data: unsigned.data,
1297
+ gas: hex(unsigned.gas),
1298
+ maxFeePerGas: hex(unsigned.maxFeePerGas),
1299
+ maxPriorityFeePerGas: hex(unsigned.maxPriorityFeePerGas)
1300
+ };
1301
+ return manager.signTransactionDelegationRedemption(
1252
1302
  policyId,
1253
- prepared.digest,
1254
- payload.outerTx,
1303
+ tx,
1304
+ { gas: payload.outerTx.gas },
1255
1305
  payload.execution
1256
1306
  );
1257
1307
  };
1258
- const signPolicyDigest = async (policyId, digest, tx) => {
1259
- const preview = await previewPolicyExecution(policyId, tx, 1, "any");
1308
+ const signPolicyDigest = async (policyId, prepared) => {
1309
+ const preview = await previewPolicyExecution(
1310
+ policyId,
1311
+ prepared.transaction,
1312
+ 1,
1313
+ "any"
1314
+ );
1260
1315
  if (preview.policy?.scope.mode === "eip7702") {
1261
1316
  throw new WalletError8(
1262
1317
  "method_not_allowed",
@@ -1266,7 +1321,7 @@ function createDelegationPolicyFlow(deps) {
1266
1321
  if (!preview.ready) {
1267
1322
  throw new WalletError8("method_not_allowed", preview.reason);
1268
1323
  }
1269
- return signVerified(policyId, digest, tx);
1324
+ return signVerified(policyId, prepared);
1270
1325
  };
1271
1326
  const executePolicy = async (policyId, tx) => {
1272
1327
  const adapter = deps.adapter;
@@ -1308,7 +1363,7 @@ function createDelegationPolicyFlow(deps) {
1308
1363
  currentCheck.reason || "The on-chain policy authorization is not ready."
1309
1364
  );
1310
1365
  }
1311
- const signature = preview.policy.scope.mode === "eip7702" ? await signRedemption(policyId, prepared) : await signVerified(policyId, prepared.digest, prepared.transaction);
1366
+ const signature = preview.policy.scope.mode === "eip7702" ? await signRedemption(policyId, prepared) : await signVerified(policyId, prepared);
1312
1367
  const submission = await adapter.broadcast({
1313
1368
  policy: preview.policy,
1314
1369
  prepared,