@naculus/connect-appkit-core 0.11.1 → 0.12.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.cjs +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -392,6 +392,9 @@ declare function encodeErc20TransferFrom(from: string, to: string, amount: bigin
|
|
|
392
392
|
*/
|
|
393
393
|
declare function toChainSwitchError(error: unknown, fallback?: WalletErrorCode): WalletError;
|
|
394
394
|
|
|
395
|
+
/** Preserve the useful parts of errors returned by EIP-1193 providers. */
|
|
396
|
+
declare function errorMessage(cause: unknown): string;
|
|
397
|
+
|
|
395
398
|
/**
|
|
396
399
|
* Decode an EVM revert payload into something a user can act on.
|
|
397
400
|
*
|
|
@@ -1212,4 +1215,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
|
|
|
1212
1215
|
refreshedAt: null;
|
|
1213
1216
|
};
|
|
1214
1217
|
|
|
1215
|
-
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 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 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, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, createX402WalletSigner, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeAuthorization, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, 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 };
|
|
1218
|
+
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 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 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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -392,6 +392,9 @@ declare function encodeErc20TransferFrom(from: string, to: string, amount: bigin
|
|
|
392
392
|
*/
|
|
393
393
|
declare function toChainSwitchError(error: unknown, fallback?: WalletErrorCode): WalletError;
|
|
394
394
|
|
|
395
|
+
/** Preserve the useful parts of errors returned by EIP-1193 providers. */
|
|
396
|
+
declare function errorMessage(cause: unknown): string;
|
|
397
|
+
|
|
395
398
|
/**
|
|
396
399
|
* Decode an EVM revert payload into something a user can act on.
|
|
397
400
|
*
|
|
@@ -1212,4 +1215,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
|
|
|
1212
1215
|
refreshedAt: null;
|
|
1213
1216
|
};
|
|
1214
1217
|
|
|
1215
|
-
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 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 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, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, createX402WalletSigner, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeAuthorization, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, 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 };
|
|
1218
|
+
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 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 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, 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 };
|
package/dist/index.js
CHANGED
|
@@ -196,6 +196,27 @@ function toChainSwitchError(error, fallback = "chain_unsupported") {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
// src/error-message.ts
|
|
200
|
+
function errorMessage(cause) {
|
|
201
|
+
if (typeof cause === "string") return cause;
|
|
202
|
+
if (cause instanceof Error) {
|
|
203
|
+
const code = errorCode(cause);
|
|
204
|
+
return code === void 0 ? cause.message : `${cause.message} (code ${code})`;
|
|
205
|
+
}
|
|
206
|
+
if (cause && typeof cause === "object") {
|
|
207
|
+
const message = cause.message;
|
|
208
|
+
if (typeof message === "string") {
|
|
209
|
+
const code = errorCode(cause);
|
|
210
|
+
return code === void 0 ? message : `${message} (code ${code})`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return "Unknown error";
|
|
214
|
+
}
|
|
215
|
+
function errorCode(cause) {
|
|
216
|
+
const code = cause.code;
|
|
217
|
+
return typeof code === "string" || typeof code === "number" ? code : void 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
199
220
|
// src/revert-reason.ts
|
|
200
221
|
var ERROR_STRING_SELECTOR = "08c379a0";
|
|
201
222
|
var PANIC_SELECTOR = "4e487b71";
|
|
@@ -1854,6 +1875,7 @@ export {
|
|
|
1854
1875
|
encodeErc20Approve,
|
|
1855
1876
|
encodeErc20Transfer,
|
|
1856
1877
|
encodeErc20TransferFrom,
|
|
1878
|
+
errorMessage,
|
|
1857
1879
|
explainSpend,
|
|
1858
1880
|
fetchUserOperationReceipt,
|
|
1859
1881
|
findX402Provider,
|