@smoothsend/sdk 2.2.2 → 2.2.4

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.
Files changed (61) hide show
  1. package/dist/aptos/index.cjs +1256 -0
  2. package/dist/aptos/index.cjs.map +1 -0
  3. package/dist/aptos/index.d.ts +783 -0
  4. package/dist/aptos/index.js +1230 -0
  5. package/dist/aptos/index.js.map +1 -0
  6. package/dist/aptos-entry.d.ts +36 -0
  7. package/dist/aptos-entry.d.ts.map +1 -0
  8. package/dist/avax/index.cjs +530 -0
  9. package/dist/avax/index.cjs.map +1 -0
  10. package/dist/avax/index.d.ts +316 -7
  11. package/dist/avax/index.js +510 -0
  12. package/dist/avax/index.js.map +1 -0
  13. package/dist/avax/useSmoothSendAvax.d.ts +10 -0
  14. package/dist/avax/useSmoothSendAvax.d.ts.map +1 -1
  15. package/dist/avax-entry.d.ts +24 -0
  16. package/dist/avax-entry.d.ts.map +1 -0
  17. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs +1519 -0
  18. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs.map +1 -0
  19. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js +1511 -0
  20. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js.map +1 -0
  21. package/dist/chunks/SmoothSendSDK.d-9GBgZONY.d.ts +262 -0
  22. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs +1237 -0
  23. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs.map +1 -0
  24. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js +1228 -0
  25. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js.map +1 -0
  26. package/dist/chunks/shared-CNF22ESH.js +557 -0
  27. package/dist/chunks/shared-CNF22ESH.js.map +1 -0
  28. package/dist/chunks/shared-CaQMAGQR.js +1511 -0
  29. package/dist/chunks/shared-CaQMAGQR.js.map +1 -0
  30. package/dist/chunks/shared-Cn4duBJT.d.ts +1279 -0
  31. package/dist/chunks/shared-DEurKmpI.cjs +1519 -0
  32. package/dist/chunks/shared-DEurKmpI.cjs.map +1 -0
  33. package/dist/chunks/shared-RVkwmkG7.d.ts +262 -0
  34. package/dist/chunks/shared-x1-VC-Li.cjs +568 -0
  35. package/dist/chunks/shared-x1-VC-Li.cjs.map +1 -0
  36. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs +1865 -0
  37. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs.map +1 -0
  38. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js +1848 -0
  39. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js.map +1 -0
  40. package/dist/chunks/version-CNF22ESH.js +557 -0
  41. package/dist/chunks/version-CNF22ESH.js.map +1 -0
  42. package/dist/chunks/version-x1-VC-Li.cjs +568 -0
  43. package/dist/chunks/version-x1-VC-Li.cjs.map +1 -0
  44. package/dist/chunks/version.d-Cn4duBJT.d.ts +1279 -0
  45. package/dist/index.cjs +3870 -0
  46. package/dist/index.cjs.map +1 -0
  47. package/dist/index.d.ts +11 -2853
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.esm.js +1 -1
  50. package/dist/index.js +78 -1458
  51. package/dist/index.js.map +1 -1
  52. package/dist/stellar/index.cjs +27 -0
  53. package/dist/stellar/index.cjs.map +1 -0
  54. package/dist/stellar/index.d.ts +214 -0
  55. package/dist/stellar/index.js +3 -0
  56. package/dist/stellar/index.js.map +1 -0
  57. package/dist/stellar-entry.d.ts +37 -0
  58. package/dist/stellar-entry.d.ts.map +1 -0
  59. package/dist/version.d.ts +2 -0
  60. package/dist/version.d.ts.map +1 -0
  61. package/package.json +23 -24
package/dist/index.js CHANGED
@@ -1,14 +1,11 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var axios = require('axios');
6
- var tsSdk = require('@aptos-labs/ts-sdk');
7
- var require$$0 = require('react');
8
- var walletAdapterReact = require('@aptos-labs/wallet-adapter-react');
9
- var viem = require('viem');
10
- var accountAbstraction = require('viem/account-abstraction');
11
- var actions = require('viem/actions');
1
+ import axios from 'axios';
2
+ import { Network, Aptos, AptosConfig, Account, MoveVector, AccountAddress, AbstractedAccount } from '@aptos-labs/ts-sdk';
3
+ import { useState, useEffect, useCallback, createContext, useMemo, useContext } from 'react';
4
+ import { useWallet } from '@aptos-labs/wallet-adapter-react';
5
+ import { encodeFunctionData, slice, size, hexToBigInt, toHex } from 'viem';
6
+ import { getUserOperationHash, entryPoint07Abi } from 'viem/account-abstraction';
7
+ import { readContract } from 'viem/actions';
8
+ import { jsx } from 'react/jsx-runtime';
12
9
 
13
10
  /**
14
11
  * Error handling system for SmoothSend SDK v2
@@ -2166,10 +2163,10 @@ class SmoothSendTransactionSubmitter {
2166
2163
  * @param masterAccount - The user's wallet account (from wallet adapter)
2167
2164
  */
2168
2165
  async createSession(masterAccount) {
2169
- const network = this.network === 'mainnet' ? tsSdk.Network.MAINNET : tsSdk.Network.TESTNET;
2170
- const aptosClient = new tsSdk.Aptos(new tsSdk.AptosConfig({ network }));
2166
+ const network = this.network === 'mainnet' ? Network.MAINNET : Network.TESTNET;
2167
+ const aptosClient = new Aptos(new AptosConfig({ network }));
2171
2168
  // Generate fresh in-memory session keypair
2172
- const sessionAccount = tsSdk.Account.generate();
2169
+ const sessionAccount = Account.generate();
2173
2170
  const expiresAtMs = Date.now() + this._parseDuration(this.sessionDuration);
2174
2171
  // Step 1: Register session key on-chain via pre-compiled Move script
2175
2172
  const setupTx = await aptosClient.transaction.build.simple({
@@ -2177,7 +2174,7 @@ class SmoothSendTransactionSubmitter {
2177
2174
  withFeePayer: true,
2178
2175
  data: {
2179
2176
  bytecode: ADD_PERMISSIONED_HANDLE_BYTECODE,
2180
- functionArguments: [tsSdk.MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
2177
+ functionArguments: [MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
2181
2178
  },
2182
2179
  options: {
2183
2180
  replayProtectionNonce: BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)),
@@ -2205,7 +2202,7 @@ class SmoothSendTransactionSubmitter {
2205
2202
  data: {
2206
2203
  function: '0x1::account_abstraction::add_authentication_function',
2207
2204
  functionArguments: [
2208
- tsSdk.AccountAddress.fromString('0x1'),
2205
+ AccountAddress.fromString('0x1'),
2209
2206
  'permissioned_delegation',
2210
2207
  'authenticate',
2211
2208
  ],
@@ -2227,7 +2224,7 @@ class SmoothSendTransactionSubmitter {
2227
2224
  }
2228
2225
  // Build AbstractedAccount — signs future txs with session key,
2229
2226
  // sender on-chain = master address, chain validates via permissioned_delegation
2230
- const abstractedAccount = tsSdk.AbstractedAccount.fromPermissionedSigner({
2227
+ const abstractedAccount = AbstractedAccount.fromPermissionedSigner({
2231
2228
  signer: sessionAccount,
2232
2229
  accountAddress: masterAccount.accountAddress,
2233
2230
  });
@@ -2542,18 +2539,18 @@ function createSmoothSendSubmitter(apiKey, options) {
2542
2539
  * ```
2543
2540
  */
2544
2541
  function useSmoothSend(submitter) {
2545
- const { account, signTransaction, signAndSubmitTransaction: walletSignAndSubmit, } = walletAdapterReact.useWallet();
2542
+ const { account, signTransaction, signAndSubmitTransaction: walletSignAndSubmit, } = useWallet();
2546
2543
  // Track session state reactively so UI updates when session is created/expires
2547
2544
  const initialHasSession = submitter?.hasSession?.() ?? false;
2548
- const [hasSessionState, setHasSessionState] = require$$0.useState(initialHasSession);
2545
+ const [hasSessionState, setHasSessionState] = useState(initialHasSession);
2549
2546
  // Prefetch the sponsored-functions list on mount so the first transaction
2550
2547
  // benefits from an already-populated cache with no added latency.
2551
- require$$0.useEffect(() => {
2548
+ useEffect(() => {
2552
2549
  submitter.getSponsoredFunctions().catch(() => {
2553
2550
  // Fail-open: getSponsoredFunctions already handles errors internally
2554
2551
  });
2555
2552
  }, [submitter]);
2556
- require$$0.useEffect(() => {
2553
+ useEffect(() => {
2557
2554
  if (!submitter)
2558
2555
  return;
2559
2556
  const refresh = () => {
@@ -2564,7 +2561,7 @@ function useSmoothSend(submitter) {
2564
2561
  const timer = setInterval(refresh, 1000);
2565
2562
  return () => clearInterval(timer);
2566
2563
  }, [submitter]);
2567
- const signAndSubmitTransaction = require$$0.useCallback(async (input) => {
2564
+ const signAndSubmitTransaction = useCallback(async (input) => {
2568
2565
  if (!account?.address) {
2569
2566
  throw new Error('[SmoothSend] Wallet not connected');
2570
2567
  }
@@ -2639,8 +2636,8 @@ function useSmoothSend(submitter) {
2639
2636
  if (sponsored && signTransaction) {
2640
2637
  try {
2641
2638
  const config = submitter.getConfig();
2642
- const network = config.network === 'mainnet' ? tsSdk.Network.MAINNET : tsSdk.Network.TESTNET;
2643
- const aptos = new tsSdk.Aptos(new tsSdk.AptosConfig({ network }));
2639
+ const network = config.network === 'mainnet' ? Network.MAINNET : Network.TESTNET;
2640
+ const aptos = new Aptos(new AptosConfig({ network }));
2644
2641
  // Build transaction with fee-payer placeholder (AccountAddress.ZERO).
2645
2642
  // replayProtectionNonce (AIP-123): random nonce instead of sequence number
2646
2643
  // so concurrent gasless calls from many users never conflict.
@@ -2886,7 +2883,7 @@ const avaxExecuteAbi = [
2886
2883
  },
2887
2884
  ];
2888
2885
  function encodeAvaxExecuteCalldata(to, value, data = '0x') {
2889
- return viem.encodeFunctionData({
2886
+ return encodeFunctionData({
2890
2887
  abi: avaxExecuteAbi,
2891
2888
  functionName: 'execute',
2892
2889
  args: [to, value, data],
@@ -2923,21 +2920,21 @@ function userOperationAvaxToViem(u) {
2923
2920
  const ic = u.initCode;
2924
2921
  out = {
2925
2922
  ...out,
2926
- factory: viem.slice(ic, 0, 20),
2927
- factoryData: viem.slice(ic, 20),
2923
+ factory: slice(ic, 0, 20),
2924
+ factoryData: slice(ic, 20),
2928
2925
  };
2929
2926
  }
2930
2927
  if (u.paymasterAndData && u.paymasterAndData !== '0x') {
2931
2928
  const pm = u.paymasterAndData;
2932
- if (viem.size(pm) < 52) {
2929
+ if (size(pm) < 52) {
2933
2930
  throw new Error('[SmoothSend AVAX] paymasterAndData too short');
2934
2931
  }
2935
2932
  out = {
2936
2933
  ...out,
2937
- paymaster: viem.slice(pm, 0, 20),
2938
- paymasterVerificationGasLimit: viem.hexToBigInt(viem.slice(pm, 20, 36)),
2939
- paymasterPostOpGasLimit: viem.hexToBigInt(viem.slice(pm, 36, 52)),
2940
- paymasterData: viem.size(pm) > 52 ? viem.slice(pm, 52) : '0x',
2934
+ paymaster: slice(pm, 0, 20),
2935
+ paymasterVerificationGasLimit: hexToBigInt(slice(pm, 20, 36)),
2936
+ paymasterPostOpGasLimit: hexToBigInt(slice(pm, 36, 52)),
2937
+ paymasterData: size(pm) > 52 ? slice(pm, 52) : '0x',
2941
2938
  };
2942
2939
  }
2943
2940
  else if (u.paymaster) {
@@ -2956,7 +2953,7 @@ function userOperationAvaxToViem(u) {
2956
2953
  return out;
2957
2954
  }
2958
2955
  function hashUserOperationAvax(params) {
2959
- return accountAbstraction.getUserOperationHash({
2956
+ return getUserOperationHash({
2960
2957
  chainId: params.chainId,
2961
2958
  entryPointAddress: params.entryPointAddress,
2962
2959
  entryPointVersion: '0.7',
@@ -2965,9 +2962,9 @@ function hashUserOperationAvax(params) {
2965
2962
  }
2966
2963
  /** EntryPoint v0.7 `getNonce(sender, key)` with key `0`. */
2967
2964
  async function readAvaxSenderNonce(params) {
2968
- return actions.readContract(params.publicClient, {
2965
+ return readContract(params.publicClient, {
2969
2966
  address: params.entryPointAddress,
2970
- abi: accountAbstraction.entryPoint07Abi,
2967
+ abi: entryPoint07Abi,
2971
2968
  functionName: 'getNonce',
2972
2969
  args: [params.sender, params.key ?? 0n],
2973
2970
  });
@@ -3001,7 +2998,7 @@ const SIMPLE_ACCOUNT_FACTORY_ABI = [
3001
2998
  ];
3002
2999
  async function predictSimpleAccountAddress(params) {
3003
3000
  const salt = params.salt ?? 0n;
3004
- const addr = await actions.readContract(params.publicClient, {
3001
+ const addr = await readContract(params.publicClient, {
3005
3002
  address: params.factory,
3006
3003
  abi: SIMPLE_ACCOUNT_FACTORY_ABI,
3007
3004
  functionName: 'getAddress',
@@ -3010,7 +3007,7 @@ async function predictSimpleAccountAddress(params) {
3010
3007
  return addr;
3011
3008
  }
3012
3009
  function encodeCreateAccountFactoryData(owner, salt) {
3013
- return viem.encodeFunctionData({
3010
+ return encodeFunctionData({
3014
3011
  abi: SIMPLE_ACCOUNT_FACTORY_ABI,
3015
3012
  functionName: 'createAccount',
3016
3013
  args: [owner, salt],
@@ -3047,1374 +3044,19 @@ async function fetchAvaxAaPublicDefaults(gatewayUrl = 'https://proxy.smoothsend.
3047
3044
  };
3048
3045
  }
3049
3046
 
3050
- var jsxRuntime = {exports: {}};
3051
-
3052
- var reactJsxRuntime_production_min = {};
3053
-
3054
- /**
3055
- * @license React
3056
- * react-jsx-runtime.production.min.js
3057
- *
3058
- * Copyright (c) Facebook, Inc. and its affiliates.
3059
- *
3060
- * This source code is licensed under the MIT license found in the
3061
- * LICENSE file in the root directory of this source tree.
3062
- */
3063
-
3064
- var hasRequiredReactJsxRuntime_production_min;
3065
-
3066
- function requireReactJsxRuntime_production_min () {
3067
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
3068
- hasRequiredReactJsxRuntime_production_min = 1;
3069
- var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
3070
- function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
3071
- return reactJsxRuntime_production_min;
3072
- }
3073
-
3074
- var reactJsxRuntime_development = {};
3075
-
3076
- /**
3077
- * @license React
3078
- * react-jsx-runtime.development.js
3079
- *
3080
- * Copyright (c) Facebook, Inc. and its affiliates.
3081
- *
3082
- * This source code is licensed under the MIT license found in the
3083
- * LICENSE file in the root directory of this source tree.
3084
- */
3085
-
3086
- var hasRequiredReactJsxRuntime_development;
3087
-
3088
- function requireReactJsxRuntime_development () {
3089
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
3090
- hasRequiredReactJsxRuntime_development = 1;
3091
-
3092
- if (process.env.NODE_ENV !== "production") {
3093
- (function() {
3094
-
3095
- var React = require$$0;
3096
-
3097
- // ATTENTION
3098
- // When adding new symbols to this file,
3099
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
3100
- // The Symbol used to tag the ReactElement-like types.
3101
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
3102
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
3103
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
3104
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
3105
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
3106
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
3107
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
3108
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
3109
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
3110
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
3111
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
3112
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
3113
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
3114
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
3115
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
3116
- function getIteratorFn(maybeIterable) {
3117
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
3118
- return null;
3119
- }
3120
-
3121
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
3122
-
3123
- if (typeof maybeIterator === 'function') {
3124
- return maybeIterator;
3125
- }
3126
-
3127
- return null;
3128
- }
3129
-
3130
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
3131
-
3132
- function error(format) {
3133
- {
3134
- {
3135
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
3136
- args[_key2 - 1] = arguments[_key2];
3137
- }
3138
-
3139
- printWarning('error', format, args);
3140
- }
3141
- }
3142
- }
3143
-
3144
- function printWarning(level, format, args) {
3145
- // When changing this logic, you might want to also
3146
- // update consoleWithStackDev.www.js as well.
3147
- {
3148
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
3149
- var stack = ReactDebugCurrentFrame.getStackAddendum();
3150
-
3151
- if (stack !== '') {
3152
- format += '%s';
3153
- args = args.concat([stack]);
3154
- } // eslint-disable-next-line react-internal/safe-string-coercion
3155
-
3156
-
3157
- var argsWithFormat = args.map(function (item) {
3158
- return String(item);
3159
- }); // Careful: RN currently depends on this prefix
3160
-
3161
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
3162
- // breaks IE9: https://github.com/facebook/react/issues/13610
3163
- // eslint-disable-next-line react-internal/no-production-logging
3164
-
3165
- Function.prototype.apply.call(console[level], console, argsWithFormat);
3166
- }
3167
- }
3168
-
3169
- // -----------------------------------------------------------------------------
3170
-
3171
- var enableScopeAPI = false; // Experimental Create Event Handle API.
3172
- var enableCacheElement = false;
3173
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
3174
-
3175
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
3176
- // stuff. Intended to enable React core members to more easily debug scheduling
3177
- // issues in DEV builds.
3178
-
3179
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
3180
-
3181
- var REACT_MODULE_REFERENCE;
3182
-
3183
- {
3184
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
3185
- }
3186
-
3187
- function isValidElementType(type) {
3188
- if (typeof type === 'string' || typeof type === 'function') {
3189
- return true;
3190
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
3191
-
3192
-
3193
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
3194
- return true;
3195
- }
3196
-
3197
- if (typeof type === 'object' && type !== null) {
3198
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
3199
- // types supported by any Flight configuration anywhere since
3200
- // we don't know which Flight build this will end up being used
3201
- // with.
3202
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
3203
- return true;
3204
- }
3205
- }
3206
-
3207
- return false;
3208
- }
3209
-
3210
- function getWrappedName(outerType, innerType, wrapperName) {
3211
- var displayName = outerType.displayName;
3212
-
3213
- if (displayName) {
3214
- return displayName;
3215
- }
3216
-
3217
- var functionName = innerType.displayName || innerType.name || '';
3218
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
3219
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
3220
-
3221
-
3222
- function getContextName(type) {
3223
- return type.displayName || 'Context';
3224
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
3225
-
3226
-
3227
- function getComponentNameFromType(type) {
3228
- if (type == null) {
3229
- // Host root, text node or just invalid type.
3230
- return null;
3231
- }
3232
-
3233
- {
3234
- if (typeof type.tag === 'number') {
3235
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
3236
- }
3237
- }
3238
-
3239
- if (typeof type === 'function') {
3240
- return type.displayName || type.name || null;
3241
- }
3242
-
3243
- if (typeof type === 'string') {
3244
- return type;
3245
- }
3246
-
3247
- switch (type) {
3248
- case REACT_FRAGMENT_TYPE:
3249
- return 'Fragment';
3250
-
3251
- case REACT_PORTAL_TYPE:
3252
- return 'Portal';
3253
-
3254
- case REACT_PROFILER_TYPE:
3255
- return 'Profiler';
3256
-
3257
- case REACT_STRICT_MODE_TYPE:
3258
- return 'StrictMode';
3259
-
3260
- case REACT_SUSPENSE_TYPE:
3261
- return 'Suspense';
3262
-
3263
- case REACT_SUSPENSE_LIST_TYPE:
3264
- return 'SuspenseList';
3265
-
3266
- }
3267
-
3268
- if (typeof type === 'object') {
3269
- switch (type.$$typeof) {
3270
- case REACT_CONTEXT_TYPE:
3271
- var context = type;
3272
- return getContextName(context) + '.Consumer';
3273
-
3274
- case REACT_PROVIDER_TYPE:
3275
- var provider = type;
3276
- return getContextName(provider._context) + '.Provider';
3277
-
3278
- case REACT_FORWARD_REF_TYPE:
3279
- return getWrappedName(type, type.render, 'ForwardRef');
3280
-
3281
- case REACT_MEMO_TYPE:
3282
- var outerName = type.displayName || null;
3283
-
3284
- if (outerName !== null) {
3285
- return outerName;
3286
- }
3287
-
3288
- return getComponentNameFromType(type.type) || 'Memo';
3289
-
3290
- case REACT_LAZY_TYPE:
3291
- {
3292
- var lazyComponent = type;
3293
- var payload = lazyComponent._payload;
3294
- var init = lazyComponent._init;
3295
-
3296
- try {
3297
- return getComponentNameFromType(init(payload));
3298
- } catch (x) {
3299
- return null;
3300
- }
3301
- }
3302
-
3303
- // eslint-disable-next-line no-fallthrough
3304
- }
3305
- }
3306
-
3307
- return null;
3308
- }
3309
-
3310
- var assign = Object.assign;
3311
-
3312
- // Helpers to patch console.logs to avoid logging during side-effect free
3313
- // replaying on render function. This currently only patches the object
3314
- // lazily which won't cover if the log function was extracted eagerly.
3315
- // We could also eagerly patch the method.
3316
- var disabledDepth = 0;
3317
- var prevLog;
3318
- var prevInfo;
3319
- var prevWarn;
3320
- var prevError;
3321
- var prevGroup;
3322
- var prevGroupCollapsed;
3323
- var prevGroupEnd;
3324
-
3325
- function disabledLog() {}
3326
-
3327
- disabledLog.__reactDisabledLog = true;
3328
- function disableLogs() {
3329
- {
3330
- if (disabledDepth === 0) {
3331
- /* eslint-disable react-internal/no-production-logging */
3332
- prevLog = console.log;
3333
- prevInfo = console.info;
3334
- prevWarn = console.warn;
3335
- prevError = console.error;
3336
- prevGroup = console.group;
3337
- prevGroupCollapsed = console.groupCollapsed;
3338
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
3339
-
3340
- var props = {
3341
- configurable: true,
3342
- enumerable: true,
3343
- value: disabledLog,
3344
- writable: true
3345
- }; // $FlowFixMe Flow thinks console is immutable.
3346
-
3347
- Object.defineProperties(console, {
3348
- info: props,
3349
- log: props,
3350
- warn: props,
3351
- error: props,
3352
- group: props,
3353
- groupCollapsed: props,
3354
- groupEnd: props
3355
- });
3356
- /* eslint-enable react-internal/no-production-logging */
3357
- }
3358
-
3359
- disabledDepth++;
3360
- }
3361
- }
3362
- function reenableLogs() {
3363
- {
3364
- disabledDepth--;
3365
-
3366
- if (disabledDepth === 0) {
3367
- /* eslint-disable react-internal/no-production-logging */
3368
- var props = {
3369
- configurable: true,
3370
- enumerable: true,
3371
- writable: true
3372
- }; // $FlowFixMe Flow thinks console is immutable.
3373
-
3374
- Object.defineProperties(console, {
3375
- log: assign({}, props, {
3376
- value: prevLog
3377
- }),
3378
- info: assign({}, props, {
3379
- value: prevInfo
3380
- }),
3381
- warn: assign({}, props, {
3382
- value: prevWarn
3383
- }),
3384
- error: assign({}, props, {
3385
- value: prevError
3386
- }),
3387
- group: assign({}, props, {
3388
- value: prevGroup
3389
- }),
3390
- groupCollapsed: assign({}, props, {
3391
- value: prevGroupCollapsed
3392
- }),
3393
- groupEnd: assign({}, props, {
3394
- value: prevGroupEnd
3395
- })
3396
- });
3397
- /* eslint-enable react-internal/no-production-logging */
3398
- }
3399
-
3400
- if (disabledDepth < 0) {
3401
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
3402
- }
3403
- }
3404
- }
3405
-
3406
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
3407
- var prefix;
3408
- function describeBuiltInComponentFrame(name, source, ownerFn) {
3409
- {
3410
- if (prefix === undefined) {
3411
- // Extract the VM specific prefix used by each line.
3412
- try {
3413
- throw Error();
3414
- } catch (x) {
3415
- var match = x.stack.trim().match(/\n( *(at )?)/);
3416
- prefix = match && match[1] || '';
3417
- }
3418
- } // We use the prefix to ensure our stacks line up with native stack frames.
3419
-
3420
-
3421
- return '\n' + prefix + name;
3422
- }
3423
- }
3424
- var reentry = false;
3425
- var componentFrameCache;
3426
-
3427
- {
3428
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
3429
- componentFrameCache = new PossiblyWeakMap();
3430
- }
3431
-
3432
- function describeNativeComponentFrame(fn, construct) {
3433
- // If something asked for a stack inside a fake render, it should get ignored.
3434
- if ( !fn || reentry) {
3435
- return '';
3436
- }
3437
-
3438
- {
3439
- var frame = componentFrameCache.get(fn);
3440
-
3441
- if (frame !== undefined) {
3442
- return frame;
3443
- }
3444
- }
3445
-
3446
- var control;
3447
- reentry = true;
3448
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
3449
-
3450
- Error.prepareStackTrace = undefined;
3451
- var previousDispatcher;
3452
-
3453
- {
3454
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
3455
- // for warnings.
3456
-
3457
- ReactCurrentDispatcher.current = null;
3458
- disableLogs();
3459
- }
3460
-
3461
- try {
3462
- // This should throw.
3463
- if (construct) {
3464
- // Something should be setting the props in the constructor.
3465
- var Fake = function () {
3466
- throw Error();
3467
- }; // $FlowFixMe
3468
-
3469
-
3470
- Object.defineProperty(Fake.prototype, 'props', {
3471
- set: function () {
3472
- // We use a throwing setter instead of frozen or non-writable props
3473
- // because that won't throw in a non-strict mode function.
3474
- throw Error();
3475
- }
3476
- });
3477
-
3478
- if (typeof Reflect === 'object' && Reflect.construct) {
3479
- // We construct a different control for this case to include any extra
3480
- // frames added by the construct call.
3481
- try {
3482
- Reflect.construct(Fake, []);
3483
- } catch (x) {
3484
- control = x;
3485
- }
3486
-
3487
- Reflect.construct(fn, [], Fake);
3488
- } else {
3489
- try {
3490
- Fake.call();
3491
- } catch (x) {
3492
- control = x;
3493
- }
3494
-
3495
- fn.call(Fake.prototype);
3496
- }
3497
- } else {
3498
- try {
3499
- throw Error();
3500
- } catch (x) {
3501
- control = x;
3502
- }
3503
-
3504
- fn();
3505
- }
3506
- } catch (sample) {
3507
- // This is inlined manually because closure doesn't do it for us.
3508
- if (sample && control && typeof sample.stack === 'string') {
3509
- // This extracts the first frame from the sample that isn't also in the control.
3510
- // Skipping one frame that we assume is the frame that calls the two.
3511
- var sampleLines = sample.stack.split('\n');
3512
- var controlLines = control.stack.split('\n');
3513
- var s = sampleLines.length - 1;
3514
- var c = controlLines.length - 1;
3515
-
3516
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
3517
- // We expect at least one stack frame to be shared.
3518
- // Typically this will be the root most one. However, stack frames may be
3519
- // cut off due to maximum stack limits. In this case, one maybe cut off
3520
- // earlier than the other. We assume that the sample is longer or the same
3521
- // and there for cut off earlier. So we should find the root most frame in
3522
- // the sample somewhere in the control.
3523
- c--;
3524
- }
3525
-
3526
- for (; s >= 1 && c >= 0; s--, c--) {
3527
- // Next we find the first one that isn't the same which should be the
3528
- // frame that called our sample function and the control.
3529
- if (sampleLines[s] !== controlLines[c]) {
3530
- // In V8, the first line is describing the message but other VMs don't.
3531
- // If we're about to return the first line, and the control is also on the same
3532
- // line, that's a pretty good indicator that our sample threw at same line as
3533
- // the control. I.e. before we entered the sample frame. So we ignore this result.
3534
- // This can happen if you passed a class to function component, or non-function.
3535
- if (s !== 1 || c !== 1) {
3536
- do {
3537
- s--;
3538
- c--; // We may still have similar intermediate frames from the construct call.
3539
- // The next one that isn't the same should be our match though.
3540
-
3541
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
3542
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
3543
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
3544
- // but we have a user-provided "displayName"
3545
- // splice it in to make the stack more readable.
3546
-
3547
-
3548
- if (fn.displayName && _frame.includes('<anonymous>')) {
3549
- _frame = _frame.replace('<anonymous>', fn.displayName);
3550
- }
3551
-
3552
- {
3553
- if (typeof fn === 'function') {
3554
- componentFrameCache.set(fn, _frame);
3555
- }
3556
- } // Return the line we found.
3557
-
3558
-
3559
- return _frame;
3560
- }
3561
- } while (s >= 1 && c >= 0);
3562
- }
3563
-
3564
- break;
3565
- }
3566
- }
3567
- }
3568
- } finally {
3569
- reentry = false;
3570
-
3571
- {
3572
- ReactCurrentDispatcher.current = previousDispatcher;
3573
- reenableLogs();
3574
- }
3575
-
3576
- Error.prepareStackTrace = previousPrepareStackTrace;
3577
- } // Fallback to just using the name if we couldn't make it throw.
3578
-
3579
-
3580
- var name = fn ? fn.displayName || fn.name : '';
3581
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
3582
-
3583
- {
3584
- if (typeof fn === 'function') {
3585
- componentFrameCache.set(fn, syntheticFrame);
3586
- }
3587
- }
3588
-
3589
- return syntheticFrame;
3590
- }
3591
- function describeFunctionComponentFrame(fn, source, ownerFn) {
3592
- {
3593
- return describeNativeComponentFrame(fn, false);
3594
- }
3595
- }
3596
-
3597
- function shouldConstruct(Component) {
3598
- var prototype = Component.prototype;
3599
- return !!(prototype && prototype.isReactComponent);
3600
- }
3601
-
3602
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
3603
-
3604
- if (type == null) {
3605
- return '';
3606
- }
3607
-
3608
- if (typeof type === 'function') {
3609
- {
3610
- return describeNativeComponentFrame(type, shouldConstruct(type));
3611
- }
3612
- }
3613
-
3614
- if (typeof type === 'string') {
3615
- return describeBuiltInComponentFrame(type);
3616
- }
3617
-
3618
- switch (type) {
3619
- case REACT_SUSPENSE_TYPE:
3620
- return describeBuiltInComponentFrame('Suspense');
3621
-
3622
- case REACT_SUSPENSE_LIST_TYPE:
3623
- return describeBuiltInComponentFrame('SuspenseList');
3624
- }
3625
-
3626
- if (typeof type === 'object') {
3627
- switch (type.$$typeof) {
3628
- case REACT_FORWARD_REF_TYPE:
3629
- return describeFunctionComponentFrame(type.render);
3630
-
3631
- case REACT_MEMO_TYPE:
3632
- // Memo may contain any component type so we recursively resolve it.
3633
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
3634
-
3635
- case REACT_LAZY_TYPE:
3636
- {
3637
- var lazyComponent = type;
3638
- var payload = lazyComponent._payload;
3639
- var init = lazyComponent._init;
3640
-
3641
- try {
3642
- // Lazy may contain any component type so we recursively resolve it.
3643
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
3644
- } catch (x) {}
3645
- }
3646
- }
3647
- }
3648
-
3649
- return '';
3650
- }
3651
-
3652
- var hasOwnProperty = Object.prototype.hasOwnProperty;
3653
-
3654
- var loggedTypeFailures = {};
3655
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
3656
-
3657
- function setCurrentlyValidatingElement(element) {
3658
- {
3659
- if (element) {
3660
- var owner = element._owner;
3661
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
3662
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
3663
- } else {
3664
- ReactDebugCurrentFrame.setExtraStackFrame(null);
3665
- }
3666
- }
3667
- }
3668
-
3669
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
3670
- {
3671
- // $FlowFixMe This is okay but Flow doesn't know it.
3672
- var has = Function.call.bind(hasOwnProperty);
3673
-
3674
- for (var typeSpecName in typeSpecs) {
3675
- if (has(typeSpecs, typeSpecName)) {
3676
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
3677
- // fail the render phase where it didn't fail before. So we log it.
3678
- // After these have been cleaned up, we'll let them throw.
3679
-
3680
- try {
3681
- // This is intentionally an invariant that gets caught. It's the same
3682
- // behavior as without this statement except with a better message.
3683
- if (typeof typeSpecs[typeSpecName] !== 'function') {
3684
- // eslint-disable-next-line react-internal/prod-error-codes
3685
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
3686
- err.name = 'Invariant Violation';
3687
- throw err;
3688
- }
3689
-
3690
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
3691
- } catch (ex) {
3692
- error$1 = ex;
3693
- }
3694
-
3695
- if (error$1 && !(error$1 instanceof Error)) {
3696
- setCurrentlyValidatingElement(element);
3697
-
3698
- error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
3699
-
3700
- setCurrentlyValidatingElement(null);
3701
- }
3702
-
3703
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
3704
- // Only monitor this failure once because there tends to be a lot of the
3705
- // same error.
3706
- loggedTypeFailures[error$1.message] = true;
3707
- setCurrentlyValidatingElement(element);
3708
-
3709
- error('Failed %s type: %s', location, error$1.message);
3710
-
3711
- setCurrentlyValidatingElement(null);
3712
- }
3713
- }
3714
- }
3715
- }
3716
- }
3717
-
3718
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
3719
-
3720
- function isArray(a) {
3721
- return isArrayImpl(a);
3722
- }
3723
-
3724
- /*
3725
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
3726
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
3727
- *
3728
- * The functions in this module will throw an easier-to-understand,
3729
- * easier-to-debug exception with a clear errors message message explaining the
3730
- * problem. (Instead of a confusing exception thrown inside the implementation
3731
- * of the `value` object).
3732
- */
3733
- // $FlowFixMe only called in DEV, so void return is not possible.
3734
- function typeName(value) {
3735
- {
3736
- // toStringTag is needed for namespaced types like Temporal.Instant
3737
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
3738
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
3739
- return type;
3740
- }
3741
- } // $FlowFixMe only called in DEV, so void return is not possible.
3742
-
3743
-
3744
- function willCoercionThrow(value) {
3745
- {
3746
- try {
3747
- testStringCoercion(value);
3748
- return false;
3749
- } catch (e) {
3750
- return true;
3751
- }
3752
- }
3753
- }
3754
-
3755
- function testStringCoercion(value) {
3756
- // If you ended up here by following an exception call stack, here's what's
3757
- // happened: you supplied an object or symbol value to React (as a prop, key,
3758
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
3759
- // coerce it to a string using `'' + value`, an exception was thrown.
3760
- //
3761
- // The most common types that will cause this exception are `Symbol` instances
3762
- // and Temporal objects like `Temporal.Instant`. But any object that has a
3763
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
3764
- // exception. (Library authors do this to prevent users from using built-in
3765
- // numeric operators like `+` or comparison operators like `>=` because custom
3766
- // methods are needed to perform accurate arithmetic or comparison.)
3767
- //
3768
- // To fix the problem, coerce this object or symbol value to a string before
3769
- // passing it to React. The most reliable way is usually `String(value)`.
3770
- //
3771
- // To find which value is throwing, check the browser or debugger console.
3772
- // Before this exception was thrown, there should be `console.error` output
3773
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
3774
- // problem and how that type was used: key, atrribute, input value prop, etc.
3775
- // In most cases, this console output also shows the component and its
3776
- // ancestor components where the exception happened.
3777
- //
3778
- // eslint-disable-next-line react-internal/safe-string-coercion
3779
- return '' + value;
3780
- }
3781
- function checkKeyStringCoercion(value) {
3782
- {
3783
- if (willCoercionThrow(value)) {
3784
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
3785
-
3786
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
3787
- }
3788
- }
3789
- }
3790
-
3791
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
3792
- var RESERVED_PROPS = {
3793
- key: true,
3794
- ref: true,
3795
- __self: true,
3796
- __source: true
3797
- };
3798
- var specialPropKeyWarningShown;
3799
- var specialPropRefWarningShown;
3800
-
3801
- function hasValidRef(config) {
3802
- {
3803
- if (hasOwnProperty.call(config, 'ref')) {
3804
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
3805
-
3806
- if (getter && getter.isReactWarning) {
3807
- return false;
3808
- }
3809
- }
3810
- }
3811
-
3812
- return config.ref !== undefined;
3813
- }
3814
-
3815
- function hasValidKey(config) {
3816
- {
3817
- if (hasOwnProperty.call(config, 'key')) {
3818
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
3819
-
3820
- if (getter && getter.isReactWarning) {
3821
- return false;
3822
- }
3823
- }
3824
- }
3825
-
3826
- return config.key !== undefined;
3827
- }
3828
-
3829
- function warnIfStringRefCannotBeAutoConverted(config, self) {
3830
- {
3831
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
3832
- }
3833
- }
3834
-
3835
- function defineKeyPropWarningGetter(props, displayName) {
3836
- {
3837
- var warnAboutAccessingKey = function () {
3838
- if (!specialPropKeyWarningShown) {
3839
- specialPropKeyWarningShown = true;
3840
-
3841
- error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
3842
- }
3843
- };
3844
-
3845
- warnAboutAccessingKey.isReactWarning = true;
3846
- Object.defineProperty(props, 'key', {
3847
- get: warnAboutAccessingKey,
3848
- configurable: true
3849
- });
3850
- }
3851
- }
3852
-
3853
- function defineRefPropWarningGetter(props, displayName) {
3854
- {
3855
- var warnAboutAccessingRef = function () {
3856
- if (!specialPropRefWarningShown) {
3857
- specialPropRefWarningShown = true;
3858
-
3859
- error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
3860
- }
3861
- };
3862
-
3863
- warnAboutAccessingRef.isReactWarning = true;
3864
- Object.defineProperty(props, 'ref', {
3865
- get: warnAboutAccessingRef,
3866
- configurable: true
3867
- });
3868
- }
3869
- }
3870
- /**
3871
- * Factory method to create a new React element. This no longer adheres to
3872
- * the class pattern, so do not use new to call it. Also, instanceof check
3873
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
3874
- * if something is a React Element.
3875
- *
3876
- * @param {*} type
3877
- * @param {*} props
3878
- * @param {*} key
3879
- * @param {string|object} ref
3880
- * @param {*} owner
3881
- * @param {*} self A *temporary* helper to detect places where `this` is
3882
- * different from the `owner` when React.createElement is called, so that we
3883
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
3884
- * functions, and as long as `this` and owner are the same, there will be no
3885
- * change in behavior.
3886
- * @param {*} source An annotation object (added by a transpiler or otherwise)
3887
- * indicating filename, line number, and/or other information.
3888
- * @internal
3889
- */
3890
-
3891
-
3892
- var ReactElement = function (type, key, ref, self, source, owner, props) {
3893
- var element = {
3894
- // This tag allows us to uniquely identify this as a React Element
3895
- $$typeof: REACT_ELEMENT_TYPE,
3896
- // Built-in properties that belong on the element
3897
- type: type,
3898
- key: key,
3899
- ref: ref,
3900
- props: props,
3901
- // Record the component responsible for creating this element.
3902
- _owner: owner
3903
- };
3904
-
3905
- {
3906
- // The validation flag is currently mutative. We put it on
3907
- // an external backing store so that we can freeze the whole object.
3908
- // This can be replaced with a WeakMap once they are implemented in
3909
- // commonly used development environments.
3910
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
3911
- // the validation flag non-enumerable (where possible, which should
3912
- // include every environment we run tests in), so the test framework
3913
- // ignores it.
3914
-
3915
- Object.defineProperty(element._store, 'validated', {
3916
- configurable: false,
3917
- enumerable: false,
3918
- writable: true,
3919
- value: false
3920
- }); // self and source are DEV only properties.
3921
-
3922
- Object.defineProperty(element, '_self', {
3923
- configurable: false,
3924
- enumerable: false,
3925
- writable: false,
3926
- value: self
3927
- }); // Two elements created in two different places should be considered
3928
- // equal for testing purposes and therefore we hide it from enumeration.
3929
-
3930
- Object.defineProperty(element, '_source', {
3931
- configurable: false,
3932
- enumerable: false,
3933
- writable: false,
3934
- value: source
3935
- });
3936
-
3937
- if (Object.freeze) {
3938
- Object.freeze(element.props);
3939
- Object.freeze(element);
3940
- }
3941
- }
3942
-
3943
- return element;
3944
- };
3945
- /**
3946
- * https://github.com/reactjs/rfcs/pull/107
3947
- * @param {*} type
3948
- * @param {object} props
3949
- * @param {string} key
3950
- */
3951
-
3952
- function jsxDEV(type, config, maybeKey, source, self) {
3953
- {
3954
- var propName; // Reserved names are extracted
3955
-
3956
- var props = {};
3957
- var key = null;
3958
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
3959
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
3960
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
3961
- // but as an intermediary step, we will use jsxDEV for everything except
3962
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
3963
- // key is explicitly declared to be undefined or not.
3964
-
3965
- if (maybeKey !== undefined) {
3966
- {
3967
- checkKeyStringCoercion(maybeKey);
3968
- }
3969
-
3970
- key = '' + maybeKey;
3971
- }
3972
-
3973
- if (hasValidKey(config)) {
3974
- {
3975
- checkKeyStringCoercion(config.key);
3976
- }
3977
-
3978
- key = '' + config.key;
3979
- }
3980
-
3981
- if (hasValidRef(config)) {
3982
- ref = config.ref;
3983
- warnIfStringRefCannotBeAutoConverted(config, self);
3984
- } // Remaining properties are added to a new props object
3985
-
3986
-
3987
- for (propName in config) {
3988
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
3989
- props[propName] = config[propName];
3990
- }
3991
- } // Resolve default props
3992
-
3993
-
3994
- if (type && type.defaultProps) {
3995
- var defaultProps = type.defaultProps;
3996
-
3997
- for (propName in defaultProps) {
3998
- if (props[propName] === undefined) {
3999
- props[propName] = defaultProps[propName];
4000
- }
4001
- }
4002
- }
4003
-
4004
- if (key || ref) {
4005
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
4006
-
4007
- if (key) {
4008
- defineKeyPropWarningGetter(props, displayName);
4009
- }
4010
-
4011
- if (ref) {
4012
- defineRefPropWarningGetter(props, displayName);
4013
- }
4014
- }
4015
-
4016
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
4017
- }
4018
- }
4019
-
4020
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
4021
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
4022
-
4023
- function setCurrentlyValidatingElement$1(element) {
4024
- {
4025
- if (element) {
4026
- var owner = element._owner;
4027
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
4028
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
4029
- } else {
4030
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
4031
- }
4032
- }
4033
- }
4034
-
4035
- var propTypesMisspellWarningShown;
4036
-
4037
- {
4038
- propTypesMisspellWarningShown = false;
4039
- }
4040
- /**
4041
- * Verifies the object is a ReactElement.
4042
- * See https://reactjs.org/docs/react-api.html#isvalidelement
4043
- * @param {?object} object
4044
- * @return {boolean} True if `object` is a ReactElement.
4045
- * @final
4046
- */
4047
-
4048
-
4049
- function isValidElement(object) {
4050
- {
4051
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
4052
- }
4053
- }
4054
-
4055
- function getDeclarationErrorAddendum() {
4056
- {
4057
- if (ReactCurrentOwner$1.current) {
4058
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
4059
-
4060
- if (name) {
4061
- return '\n\nCheck the render method of `' + name + '`.';
4062
- }
4063
- }
4064
-
4065
- return '';
4066
- }
4067
- }
4068
-
4069
- function getSourceInfoErrorAddendum(source) {
4070
- {
4071
-
4072
- return '';
4073
- }
4074
- }
4075
- /**
4076
- * Warn if there's no key explicitly set on dynamic arrays of children or
4077
- * object keys are not valid. This allows us to keep track of children between
4078
- * updates.
4079
- */
4080
-
4081
-
4082
- var ownerHasKeyUseWarning = {};
4083
-
4084
- function getCurrentComponentErrorInfo(parentType) {
4085
- {
4086
- var info = getDeclarationErrorAddendum();
4087
-
4088
- if (!info) {
4089
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
4090
-
4091
- if (parentName) {
4092
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
4093
- }
4094
- }
4095
-
4096
- return info;
4097
- }
4098
- }
4099
- /**
4100
- * Warn if the element doesn't have an explicit key assigned to it.
4101
- * This element is in an array. The array could grow and shrink or be
4102
- * reordered. All children that haven't already been validated are required to
4103
- * have a "key" property assigned to it. Error statuses are cached so a warning
4104
- * will only be shown once.
4105
- *
4106
- * @internal
4107
- * @param {ReactElement} element Element that requires a key.
4108
- * @param {*} parentType element's parent's type.
4109
- */
4110
-
4111
-
4112
- function validateExplicitKey(element, parentType) {
4113
- {
4114
- if (!element._store || element._store.validated || element.key != null) {
4115
- return;
4116
- }
4117
-
4118
- element._store.validated = true;
4119
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
4120
-
4121
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
4122
- return;
4123
- }
4124
-
4125
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
4126
- // property, it may be the creator of the child that's responsible for
4127
- // assigning it a key.
4128
-
4129
- var childOwner = '';
4130
-
4131
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
4132
- // Give the component that originally created this child.
4133
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
4134
- }
4135
-
4136
- setCurrentlyValidatingElement$1(element);
4137
-
4138
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
4139
-
4140
- setCurrentlyValidatingElement$1(null);
4141
- }
4142
- }
4143
- /**
4144
- * Ensure that every element either is passed in a static location, in an
4145
- * array with an explicit keys property defined, or in an object literal
4146
- * with valid key property.
4147
- *
4148
- * @internal
4149
- * @param {ReactNode} node Statically passed child of any type.
4150
- * @param {*} parentType node's parent's type.
4151
- */
4152
-
4153
-
4154
- function validateChildKeys(node, parentType) {
4155
- {
4156
- if (typeof node !== 'object') {
4157
- return;
4158
- }
4159
-
4160
- if (isArray(node)) {
4161
- for (var i = 0; i < node.length; i++) {
4162
- var child = node[i];
4163
-
4164
- if (isValidElement(child)) {
4165
- validateExplicitKey(child, parentType);
4166
- }
4167
- }
4168
- } else if (isValidElement(node)) {
4169
- // This element was passed in a valid location.
4170
- if (node._store) {
4171
- node._store.validated = true;
4172
- }
4173
- } else if (node) {
4174
- var iteratorFn = getIteratorFn(node);
4175
-
4176
- if (typeof iteratorFn === 'function') {
4177
- // Entry iterators used to provide implicit keys,
4178
- // but now we print a separate warning for them later.
4179
- if (iteratorFn !== node.entries) {
4180
- var iterator = iteratorFn.call(node);
4181
- var step;
4182
-
4183
- while (!(step = iterator.next()).done) {
4184
- if (isValidElement(step.value)) {
4185
- validateExplicitKey(step.value, parentType);
4186
- }
4187
- }
4188
- }
4189
- }
4190
- }
4191
- }
4192
- }
4193
- /**
4194
- * Given an element, validate that its props follow the propTypes definition,
4195
- * provided by the type.
4196
- *
4197
- * @param {ReactElement} element
4198
- */
4199
-
4200
-
4201
- function validatePropTypes(element) {
4202
- {
4203
- var type = element.type;
4204
-
4205
- if (type === null || type === undefined || typeof type === 'string') {
4206
- return;
4207
- }
4208
-
4209
- var propTypes;
4210
-
4211
- if (typeof type === 'function') {
4212
- propTypes = type.propTypes;
4213
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
4214
- // Inner props are checked in the reconciler.
4215
- type.$$typeof === REACT_MEMO_TYPE)) {
4216
- propTypes = type.propTypes;
4217
- } else {
4218
- return;
4219
- }
4220
-
4221
- if (propTypes) {
4222
- // Intentionally inside to avoid triggering lazy initializers:
4223
- var name = getComponentNameFromType(type);
4224
- checkPropTypes(propTypes, element.props, 'prop', name, element);
4225
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
4226
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
4227
-
4228
- var _name = getComponentNameFromType(type);
4229
-
4230
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
4231
- }
4232
-
4233
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
4234
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
4235
- }
4236
- }
4237
- }
4238
- /**
4239
- * Given a fragment, validate that it can only be provided with fragment props
4240
- * @param {ReactElement} fragment
4241
- */
4242
-
4243
-
4244
- function validateFragmentProps(fragment) {
4245
- {
4246
- var keys = Object.keys(fragment.props);
4247
-
4248
- for (var i = 0; i < keys.length; i++) {
4249
- var key = keys[i];
4250
-
4251
- if (key !== 'children' && key !== 'key') {
4252
- setCurrentlyValidatingElement$1(fragment);
4253
-
4254
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
4255
-
4256
- setCurrentlyValidatingElement$1(null);
4257
- break;
4258
- }
4259
- }
4260
-
4261
- if (fragment.ref !== null) {
4262
- setCurrentlyValidatingElement$1(fragment);
4263
-
4264
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
4265
-
4266
- setCurrentlyValidatingElement$1(null);
4267
- }
4268
- }
4269
- }
4270
-
4271
- var didWarnAboutKeySpread = {};
4272
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
4273
- {
4274
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
4275
- // succeed and there will likely be errors in render.
4276
-
4277
- if (!validType) {
4278
- var info = '';
4279
-
4280
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
4281
- info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
4282
- }
4283
-
4284
- var sourceInfo = getSourceInfoErrorAddendum();
4285
-
4286
- if (sourceInfo) {
4287
- info += sourceInfo;
4288
- } else {
4289
- info += getDeclarationErrorAddendum();
4290
- }
4291
-
4292
- var typeString;
4293
-
4294
- if (type === null) {
4295
- typeString = 'null';
4296
- } else if (isArray(type)) {
4297
- typeString = 'array';
4298
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
4299
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
4300
- info = ' Did you accidentally export a JSX literal instead of a component?';
4301
- } else {
4302
- typeString = typeof type;
4303
- }
4304
-
4305
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
4306
- }
4307
-
4308
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
4309
- // TODO: Drop this when these are no longer allowed as the type argument.
4310
-
4311
- if (element == null) {
4312
- return element;
4313
- } // Skip key warning if the type isn't valid since our key validation logic
4314
- // doesn't expect a non-string/function type and can throw confusing errors.
4315
- // We don't want exception behavior to differ between dev and prod.
4316
- // (Rendering will throw with a helpful message and as soon as the type is
4317
- // fixed, the key warnings will appear.)
4318
-
4319
-
4320
- if (validType) {
4321
- var children = props.children;
4322
-
4323
- if (children !== undefined) {
4324
- if (isStaticChildren) {
4325
- if (isArray(children)) {
4326
- for (var i = 0; i < children.length; i++) {
4327
- validateChildKeys(children[i], type);
4328
- }
4329
-
4330
- if (Object.freeze) {
4331
- Object.freeze(children);
4332
- }
4333
- } else {
4334
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
4335
- }
4336
- } else {
4337
- validateChildKeys(children, type);
4338
- }
4339
- }
4340
- }
4341
-
4342
- {
4343
- if (hasOwnProperty.call(props, 'key')) {
4344
- var componentName = getComponentNameFromType(type);
4345
- var keys = Object.keys(props).filter(function (k) {
4346
- return k !== 'key';
4347
- });
4348
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
4349
-
4350
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
4351
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
4352
-
4353
- error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
4354
-
4355
- didWarnAboutKeySpread[componentName + beforeExample] = true;
4356
- }
4357
- }
4358
- }
4359
-
4360
- if (type === REACT_FRAGMENT_TYPE) {
4361
- validateFragmentProps(element);
4362
- } else {
4363
- validatePropTypes(element);
4364
- }
4365
-
4366
- return element;
4367
- }
4368
- } // These two functions exist to still get child warnings in dev
4369
- // even with the prod transform. This means that jsxDEV is purely
4370
- // opt-in behavior for better messages but that we won't stop
4371
- // giving you warnings if you use production apis.
4372
-
4373
- function jsxWithValidationStatic(type, props, key) {
4374
- {
4375
- return jsxWithValidation(type, props, key, true);
4376
- }
4377
- }
4378
- function jsxWithValidationDynamic(type, props, key) {
4379
- {
4380
- return jsxWithValidation(type, props, key, false);
4381
- }
4382
- }
4383
-
4384
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
4385
- // for now we can ship identical prod functions
4386
-
4387
- var jsxs = jsxWithValidationStatic ;
4388
-
4389
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
4390
- reactJsxRuntime_development.jsx = jsx;
4391
- reactJsxRuntime_development.jsxs = jsxs;
4392
- })();
4393
- }
4394
- return reactJsxRuntime_development;
4395
- }
4396
-
4397
- if (process.env.NODE_ENV === 'production') {
4398
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
4399
- } else {
4400
- jsxRuntime.exports = requireReactJsxRuntime_development();
4401
- }
4402
-
4403
- var jsxRuntimeExports = jsxRuntime.exports;
4404
-
4405
- const SmoothSendAvaxContext = require$$0.createContext(null);
3047
+ const SmoothSendAvaxContext = createContext(null);
4406
3048
  function SmoothSendAvaxProvider({ apiKey, network = 'testnet', smartAccountAddress, accountFactory, accountSalt, children, }) {
4407
- const value = require$$0.useMemo(() => ({
3049
+ const value = useMemo(() => ({
4408
3050
  apiKey,
4409
3051
  network,
4410
3052
  smartAccountAddress,
4411
3053
  accountFactory,
4412
3054
  accountSalt: accountSalt ?? 0n,
4413
3055
  }), [apiKey, network, smartAccountAddress, accountFactory, accountSalt]);
4414
- return (jsxRuntimeExports.jsx(SmoothSendAvaxContext.Provider, { value: value, children: children }));
3056
+ return (jsx(SmoothSendAvaxContext.Provider, { value: value, children: children }));
4415
3057
  }
4416
3058
  function useSmoothSendAvaxContext() {
4417
- return require$$0.useContext(SmoothSendAvaxContext);
3059
+ return useContext(SmoothSendAvaxContext);
4418
3060
  }
4419
3061
  function useSmoothSendAvax(params) {
4420
3062
  const ctx = useSmoothSendAvaxContext();
@@ -4429,9 +3071,9 @@ function useSmoothSendAvax(params) {
4429
3071
  if (!smartAccountAddressProp && !accountFactory) {
4430
3072
  throw new Error('[SmoothSend AVAX] Provide smartAccountAddress and/or accountFactory (SimpleAccountFactory)');
4431
3073
  }
4432
- const submitter = require$$0.useMemo(() => new SmoothSendAvaxSubmitter({ apiKey, network }), [apiKey, network]);
3074
+ const submitter = useMemo(() => new SmoothSendAvaxSubmitter({ apiKey, network }), [apiKey, network]);
4433
3075
  const { publicClient, walletClient } = params;
4434
- const submitCall = require$$0.useCallback(async (call) => {
3076
+ const submitCall = useCallback(async (call) => {
4435
3077
  if (!publicClient) {
4436
3078
  throw new Error('[SmoothSend AVAX] publicClient missing (wagmi usePublicClient)');
4437
3079
  }
@@ -4501,10 +3143,10 @@ function useSmoothSendAvax(params) {
4501
3143
  return submitter.submitSponsoredUserOperation({
4502
3144
  userOp: {
4503
3145
  sender,
4504
- nonce: viem.toHex(nonce),
3146
+ nonce: toHex(nonce),
4505
3147
  callData,
4506
- maxFeePerGas: viem.toHex(maxFeePerGas),
4507
- maxPriorityFeePerGas: viem.toHex(maxPriorityFeePerGas),
3148
+ maxFeePerGas: toHex(maxFeePerGas),
3149
+ maxPriorityFeePerGas: toHex(maxPriorityFeePerGas),
4508
3150
  ...(factory && factoryData ? { factory, factoryData } : {}),
4509
3151
  },
4510
3152
  mode: call.mode ?? 'developer-sponsored',
@@ -4530,7 +3172,22 @@ function useSmoothSendAvax(params) {
4530
3172
  submitter,
4531
3173
  walletClient,
4532
3174
  ]);
4533
- return { submitter, submitCall };
3175
+ const submitSponsoredUserOp = useCallback(async (args) => {
3176
+ if (args.calls.length === 0) {
3177
+ throw new Error('[SmoothSend AVAX] No calls provided');
3178
+ }
3179
+ // For now, use the first call (single execution)
3180
+ const call = args.calls[0];
3181
+ return submitCall({
3182
+ to: call.to,
3183
+ data: call.data,
3184
+ value: call.value,
3185
+ mode: args.sponsorshipMode,
3186
+ paymaster: args.paymaster,
3187
+ waitForReceipt: args.waitForReceipt,
3188
+ });
3189
+ }, [submitCall]);
3190
+ return { submitter, submitCall, submitSponsoredUserOp };
4534
3191
  }
4535
3192
 
4536
3193
  // ─── helpers ────────────────────────────────────────────────────────────────
@@ -4594,8 +3251,8 @@ class SmoothSendSession {
4594
3251
  static async create(options, submitter) {
4595
3252
  // Resolve network from options or submitter config
4596
3253
  const network = options.network ?? submitter.getConfig().network ?? 'testnet';
4597
- const aptosNetwork = network === 'mainnet' ? tsSdk.Network.MAINNET : tsSdk.Network.TESTNET;
4598
- const aptosClient = new tsSdk.Aptos(new tsSdk.AptosConfig({ network: aptosNetwork }));
3254
+ const aptosNetwork = network === 'mainnet' ? Network.MAINNET : Network.TESTNET;
3255
+ const aptosClient = new Aptos(new AptosConfig({ network: aptosNetwork }));
4599
3256
  const feature = await aptosClient.view({
4600
3257
  payload: {
4601
3258
  function: '0x1::features::is_permissioned_signer_enabled',
@@ -4606,7 +3263,7 @@ class SmoothSendSession {
4606
3263
  throw new Error('[SmoothSend] Session keys unavailable on this network (permissioned signer feature disabled).');
4607
3264
  }
4608
3265
  // Generate a fresh Ed25519 session keypair (lives in memory, never persisted)
4609
- const sessionAccount = tsSdk.Account.generate();
3266
+ const sessionAccount = Account.generate();
4610
3267
  // Client-side expiry tracking (the bytecode script doesn't take an expiry arg)
4611
3268
  const nowSecs = Math.floor(Date.now() / 1000);
4612
3269
  const expirationTimeSecs = nowSecs + parseDurationToSeconds(options.expiresIn);
@@ -4618,7 +3275,7 @@ class SmoothSendSession {
4618
3275
  withFeePayer: true,
4619
3276
  data: {
4620
3277
  bytecode: ADD_PERMISSIONED_HANDLE_BYTECODE,
4621
- functionArguments: [tsSdk.MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
3278
+ functionArguments: [MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
4622
3279
  },
4623
3280
  options: {
4624
3281
  replayProtectionNonce: BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)),
@@ -4648,7 +3305,7 @@ class SmoothSendSession {
4648
3305
  data: {
4649
3306
  function: '0x1::account_abstraction::add_authentication_function',
4650
3307
  functionArguments: [
4651
- tsSdk.AccountAddress.fromString('0x1'),
3308
+ AccountAddress.fromString('0x1'),
4652
3309
  'permissioned_delegation',
4653
3310
  'authenticate',
4654
3311
  ],
@@ -4664,7 +3321,7 @@ class SmoothSendSession {
4664
3321
  }
4665
3322
  // Build AbstractedAccount — signs future txs with session key but
4666
3323
  // sender on-chain = master address. Chain validates via permissioned_delegation.
4667
- const abstractedAccount = tsSdk.AbstractedAccount.fromPermissionedSigner({
3324
+ const abstractedAccount = AbstractedAccount.fromPermissionedSigner({
4668
3325
  signer: sessionAccount,
4669
3326
  accountAddress: options.signer.accountAddress,
4670
3327
  });
@@ -5054,10 +3711,10 @@ class TrueGaslessClient {
5054
3711
  baseUrl: this.config.proxyUrl, // Use custom proxy URL if provided
5055
3712
  });
5056
3713
  const networkMap = {
5057
- testnet: tsSdk.Network.TESTNET,
5058
- mainnet: tsSdk.Network.MAINNET,
3714
+ testnet: Network.TESTNET,
3715
+ mainnet: Network.MAINNET,
5059
3716
  };
5060
- this.aptos = new tsSdk.Aptos(new tsSdk.AptosConfig({ network: networkMap[this.config.network] }));
3717
+ this.aptos = new Aptos(new AptosConfig({ network: networkMap[this.config.network] }));
5061
3718
  }
5062
3719
  log(message, data) {
5063
3720
  if (this.config.debug) {
@@ -5129,6 +3786,8 @@ function createTrueGaslessClient(config) {
5129
3786
  return new TrueGaslessClient(config);
5130
3787
  }
5131
3788
 
3789
+ const VERSION = '2.2.3';
3790
+
5132
3791
  /**
5133
3792
  * SmoothSend SDK v2.0
5134
3793
  *
@@ -5155,52 +3814,13 @@ function createTrueGaslessClient(config) {
5155
3814
  * const result = await sdk.transfer({ from, to, token: 'XLM', amount: '100', chain: 'stellar-testnet' }, stellarWallet);
5156
3815
  * ```
5157
3816
  */
5158
- // Main SDK export
5159
- /**
5160
- * SDK version
5161
- * @public
5162
- */
5163
- const VERSION = '2.2.1';
3817
+ if (typeof window !== 'undefined') {
3818
+ console.warn('[@smoothsend/sdk] You are importing the full SDK. ' +
3819
+ 'Consider using subpath imports for smaller bundles:\\n' +
3820
+ ' - import { ... } from "@smoothsend/sdk/avax"\\n' +
3821
+ ' - import { ... } from "@smoothsend/sdk/aptos"\\n' +
3822
+ ' - import { ... } from "@smoothsend/sdk/stellar"');
3823
+ }
5164
3824
 
5165
- exports.APTOS_ERROR_CODES = APTOS_ERROR_CODES;
5166
- exports.AptosAdapter = AptosAdapter;
5167
- exports.AuthenticationError = AuthenticationError;
5168
- exports.AvaxSubmitter = AvaxSubmitter;
5169
- exports.CHAIN_ECOSYSTEM_MAP = CHAIN_ECOSYSTEM_MAP;
5170
- exports.ENTRY_POINT_V07_ADDRESS = ENTRY_POINT_V07_ADDRESS;
5171
- exports.HttpClient = HttpClient;
5172
- exports.NetworkError = NetworkError;
5173
- exports.RateLimitError = RateLimitError;
5174
- exports.SIMPLE_ACCOUNT_FACTORY_ABI = SIMPLE_ACCOUNT_FACTORY_ABI;
5175
- exports.STELLAR_ERROR_CODES = STELLAR_ERROR_CODES;
5176
- exports.ScriptComposerClient = ScriptComposerClient;
5177
- exports.SmoothSendAvaxProvider = SmoothSendAvaxProvider;
5178
- exports.SmoothSendAvaxSubmitter = SmoothSendAvaxSubmitter;
5179
- exports.SmoothSendError = SmoothSendError;
5180
- exports.SmoothSendSDK = SmoothSendSDK;
5181
- exports.SmoothSendSession = SmoothSendSession;
5182
- exports.SmoothSendTransactionSubmitter = SmoothSendTransactionSubmitter;
5183
- exports.StellarAdapter = StellarAdapter;
5184
- exports.StellarCAddressAdapter = StellarCAddressAdapter;
5185
- exports.TrueGaslessClient = TrueGaslessClient;
5186
- exports.VERSION = VERSION;
5187
- exports.ValidationError = ValidationError;
5188
- exports.avaxExecuteAbi = avaxExecuteAbi;
5189
- exports.createErrorFromResponse = createErrorFromResponse;
5190
- exports.createNetworkError = createNetworkError;
5191
- exports.createScriptComposerClient = createScriptComposerClient;
5192
- exports.createSmoothSendAvaxSubmitter = createSmoothSendAvaxSubmitter;
5193
- exports.createSmoothSendSubmitter = createSmoothSendSubmitter;
5194
- exports.createTrueGaslessClient = createTrueGaslessClient;
5195
- exports.default = SmoothSendSDK;
5196
- exports.encodeAvaxExecuteCalldata = encodeAvaxExecuteCalldata;
5197
- exports.encodeCreateAccountFactoryData = encodeCreateAccountFactoryData;
5198
- exports.fetchAvaxAaPublicDefaults = fetchAvaxAaPublicDefaults;
5199
- exports.hashUserOperationAvax = hashUserOperationAvax;
5200
- exports.predictSimpleAccountAddress = predictSimpleAccountAddress;
5201
- exports.readAvaxSenderNonce = readAvaxSenderNonce;
5202
- exports.useSmoothSend = useSmoothSend;
5203
- exports.useSmoothSendAvax = useSmoothSendAvax;
5204
- exports.useSmoothSendAvaxContext = useSmoothSendAvaxContext;
5205
- exports.userOperationAvaxToViem = userOperationAvaxToViem;
3825
+ export { APTOS_ERROR_CODES, AptosAdapter, AuthenticationError, AvaxSubmitter, CHAIN_ECOSYSTEM_MAP, ENTRY_POINT_V07_ADDRESS, HttpClient, NetworkError, RateLimitError, SIMPLE_ACCOUNT_FACTORY_ABI, STELLAR_ERROR_CODES, ScriptComposerClient, SmoothSendAvaxProvider, SmoothSendAvaxSubmitter, SmoothSendError, SmoothSendSDK, SmoothSendSession, SmoothSendTransactionSubmitter, StellarAdapter, StellarCAddressAdapter, TrueGaslessClient, VERSION, ValidationError, avaxExecuteAbi, createErrorFromResponse, createNetworkError, createScriptComposerClient, createSmoothSendAvaxSubmitter, createSmoothSendSubmitter, createTrueGaslessClient, SmoothSendSDK as default, encodeAvaxExecuteCalldata, encodeCreateAccountFactoryData, fetchAvaxAaPublicDefaults, hashUserOperationAvax, predictSimpleAccountAddress, readAvaxSenderNonce, useSmoothSend, useSmoothSendAvax, useSmoothSendAvaxContext, userOperationAvaxToViem };
5206
3826
  //# sourceMappingURL=index.js.map