@smoothsend/sdk 2.2.2 → 2.2.3

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 (59) 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 +1869 -0
  9. package/dist/avax/index.cjs.map +1 -0
  10. package/dist/avax/index.d.ts +306 -7
  11. package/dist/avax/index.js +1849 -0
  12. package/dist/avax/index.js.map +1 -0
  13. package/dist/avax-entry.d.ts +24 -0
  14. package/dist/avax-entry.d.ts.map +1 -0
  15. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs +1519 -0
  16. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs.map +1 -0
  17. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js +1511 -0
  18. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js.map +1 -0
  19. package/dist/chunks/SmoothSendSDK.d-9GBgZONY.d.ts +262 -0
  20. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs +1237 -0
  21. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs.map +1 -0
  22. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js +1228 -0
  23. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js.map +1 -0
  24. package/dist/chunks/shared-CNF22ESH.js +557 -0
  25. package/dist/chunks/shared-CNF22ESH.js.map +1 -0
  26. package/dist/chunks/shared-CaQMAGQR.js +1511 -0
  27. package/dist/chunks/shared-CaQMAGQR.js.map +1 -0
  28. package/dist/chunks/shared-Cn4duBJT.d.ts +1279 -0
  29. package/dist/chunks/shared-DEurKmpI.cjs +1519 -0
  30. package/dist/chunks/shared-DEurKmpI.cjs.map +1 -0
  31. package/dist/chunks/shared-RVkwmkG7.d.ts +262 -0
  32. package/dist/chunks/shared-x1-VC-Li.cjs +568 -0
  33. package/dist/chunks/shared-x1-VC-Li.cjs.map +1 -0
  34. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs +1865 -0
  35. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs.map +1 -0
  36. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js +1848 -0
  37. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js.map +1 -0
  38. package/dist/chunks/version-CNF22ESH.js +557 -0
  39. package/dist/chunks/version-CNF22ESH.js.map +1 -0
  40. package/dist/chunks/version-x1-VC-Li.cjs +568 -0
  41. package/dist/chunks/version-x1-VC-Li.cjs.map +1 -0
  42. package/dist/chunks/version.d-Cn4duBJT.d.ts +1279 -0
  43. package/dist/index.cjs +5209 -0
  44. package/dist/index.cjs.map +1 -0
  45. package/dist/index.d.ts +11 -2853
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.esm.js +1 -1
  48. package/dist/index.js +61 -102
  49. package/dist/index.js.map +1 -1
  50. package/dist/stellar/index.cjs +27 -0
  51. package/dist/stellar/index.cjs.map +1 -0
  52. package/dist/stellar/index.d.ts +214 -0
  53. package/dist/stellar/index.js +3 -0
  54. package/dist/stellar/index.js.map +1 -0
  55. package/dist/stellar-entry.d.ts +37 -0
  56. package/dist/stellar-entry.d.ts.map +1 -0
  57. package/dist/version.d.ts +2 -0
  58. package/dist/version.d.ts.map +1 -0
  59. package/package.json +23 -24
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,oCAAoC,EACzC,KAAK,oBAAoB,EACzB,aAA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BAAoB,EACpB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,8BAA8B,CAAC;AAGtC,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.esm.js CHANGED
@@ -5156,7 +5156,7 @@ function createTrueGaslessClient(config) {
5156
5156
  * SDK version
5157
5157
  * @public
5158
5158
  */
5159
- const VERSION = '2.2.1';
5159
+ const VERSION = '2.2.3';
5160
5160
 
5161
5161
  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 };
5162
5162
  //# sourceMappingURL=index.esm.js.map
package/dist/index.js CHANGED
@@ -1,14 +1,10 @@
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 require$$0, { 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';
12
8
 
13
9
  /**
14
10
  * Error handling system for SmoothSend SDK v2
@@ -2166,10 +2162,10 @@ class SmoothSendTransactionSubmitter {
2166
2162
  * @param masterAccount - The user's wallet account (from wallet adapter)
2167
2163
  */
2168
2164
  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 }));
2165
+ const network = this.network === 'mainnet' ? Network.MAINNET : Network.TESTNET;
2166
+ const aptosClient = new Aptos(new AptosConfig({ network }));
2171
2167
  // Generate fresh in-memory session keypair
2172
- const sessionAccount = tsSdk.Account.generate();
2168
+ const sessionAccount = Account.generate();
2173
2169
  const expiresAtMs = Date.now() + this._parseDuration(this.sessionDuration);
2174
2170
  // Step 1: Register session key on-chain via pre-compiled Move script
2175
2171
  const setupTx = await aptosClient.transaction.build.simple({
@@ -2177,7 +2173,7 @@ class SmoothSendTransactionSubmitter {
2177
2173
  withFeePayer: true,
2178
2174
  data: {
2179
2175
  bytecode: ADD_PERMISSIONED_HANDLE_BYTECODE,
2180
- functionArguments: [tsSdk.MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
2176
+ functionArguments: [MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
2181
2177
  },
2182
2178
  options: {
2183
2179
  replayProtectionNonce: BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)),
@@ -2205,7 +2201,7 @@ class SmoothSendTransactionSubmitter {
2205
2201
  data: {
2206
2202
  function: '0x1::account_abstraction::add_authentication_function',
2207
2203
  functionArguments: [
2208
- tsSdk.AccountAddress.fromString('0x1'),
2204
+ AccountAddress.fromString('0x1'),
2209
2205
  'permissioned_delegation',
2210
2206
  'authenticate',
2211
2207
  ],
@@ -2227,7 +2223,7 @@ class SmoothSendTransactionSubmitter {
2227
2223
  }
2228
2224
  // Build AbstractedAccount — signs future txs with session key,
2229
2225
  // sender on-chain = master address, chain validates via permissioned_delegation
2230
- const abstractedAccount = tsSdk.AbstractedAccount.fromPermissionedSigner({
2226
+ const abstractedAccount = AbstractedAccount.fromPermissionedSigner({
2231
2227
  signer: sessionAccount,
2232
2228
  accountAddress: masterAccount.accountAddress,
2233
2229
  });
@@ -2542,18 +2538,18 @@ function createSmoothSendSubmitter(apiKey, options) {
2542
2538
  * ```
2543
2539
  */
2544
2540
  function useSmoothSend(submitter) {
2545
- const { account, signTransaction, signAndSubmitTransaction: walletSignAndSubmit, } = walletAdapterReact.useWallet();
2541
+ const { account, signTransaction, signAndSubmitTransaction: walletSignAndSubmit, } = useWallet();
2546
2542
  // Track session state reactively so UI updates when session is created/expires
2547
2543
  const initialHasSession = submitter?.hasSession?.() ?? false;
2548
- const [hasSessionState, setHasSessionState] = require$$0.useState(initialHasSession);
2544
+ const [hasSessionState, setHasSessionState] = useState(initialHasSession);
2549
2545
  // Prefetch the sponsored-functions list on mount so the first transaction
2550
2546
  // benefits from an already-populated cache with no added latency.
2551
- require$$0.useEffect(() => {
2547
+ useEffect(() => {
2552
2548
  submitter.getSponsoredFunctions().catch(() => {
2553
2549
  // Fail-open: getSponsoredFunctions already handles errors internally
2554
2550
  });
2555
2551
  }, [submitter]);
2556
- require$$0.useEffect(() => {
2552
+ useEffect(() => {
2557
2553
  if (!submitter)
2558
2554
  return;
2559
2555
  const refresh = () => {
@@ -2564,7 +2560,7 @@ function useSmoothSend(submitter) {
2564
2560
  const timer = setInterval(refresh, 1000);
2565
2561
  return () => clearInterval(timer);
2566
2562
  }, [submitter]);
2567
- const signAndSubmitTransaction = require$$0.useCallback(async (input) => {
2563
+ const signAndSubmitTransaction = useCallback(async (input) => {
2568
2564
  if (!account?.address) {
2569
2565
  throw new Error('[SmoothSend] Wallet not connected');
2570
2566
  }
@@ -2639,8 +2635,8 @@ function useSmoothSend(submitter) {
2639
2635
  if (sponsored && signTransaction) {
2640
2636
  try {
2641
2637
  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 }));
2638
+ const network = config.network === 'mainnet' ? Network.MAINNET : Network.TESTNET;
2639
+ const aptos = new Aptos(new AptosConfig({ network }));
2644
2640
  // Build transaction with fee-payer placeholder (AccountAddress.ZERO).
2645
2641
  // replayProtectionNonce (AIP-123): random nonce instead of sequence number
2646
2642
  // so concurrent gasless calls from many users never conflict.
@@ -2886,7 +2882,7 @@ const avaxExecuteAbi = [
2886
2882
  },
2887
2883
  ];
2888
2884
  function encodeAvaxExecuteCalldata(to, value, data = '0x') {
2889
- return viem.encodeFunctionData({
2885
+ return encodeFunctionData({
2890
2886
  abi: avaxExecuteAbi,
2891
2887
  functionName: 'execute',
2892
2888
  args: [to, value, data],
@@ -2923,21 +2919,21 @@ function userOperationAvaxToViem(u) {
2923
2919
  const ic = u.initCode;
2924
2920
  out = {
2925
2921
  ...out,
2926
- factory: viem.slice(ic, 0, 20),
2927
- factoryData: viem.slice(ic, 20),
2922
+ factory: slice(ic, 0, 20),
2923
+ factoryData: slice(ic, 20),
2928
2924
  };
2929
2925
  }
2930
2926
  if (u.paymasterAndData && u.paymasterAndData !== '0x') {
2931
2927
  const pm = u.paymasterAndData;
2932
- if (viem.size(pm) < 52) {
2928
+ if (size(pm) < 52) {
2933
2929
  throw new Error('[SmoothSend AVAX] paymasterAndData too short');
2934
2930
  }
2935
2931
  out = {
2936
2932
  ...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',
2933
+ paymaster: slice(pm, 0, 20),
2934
+ paymasterVerificationGasLimit: hexToBigInt(slice(pm, 20, 36)),
2935
+ paymasterPostOpGasLimit: hexToBigInt(slice(pm, 36, 52)),
2936
+ paymasterData: size(pm) > 52 ? slice(pm, 52) : '0x',
2941
2937
  };
2942
2938
  }
2943
2939
  else if (u.paymaster) {
@@ -2956,7 +2952,7 @@ function userOperationAvaxToViem(u) {
2956
2952
  return out;
2957
2953
  }
2958
2954
  function hashUserOperationAvax(params) {
2959
- return accountAbstraction.getUserOperationHash({
2955
+ return getUserOperationHash({
2960
2956
  chainId: params.chainId,
2961
2957
  entryPointAddress: params.entryPointAddress,
2962
2958
  entryPointVersion: '0.7',
@@ -2965,9 +2961,9 @@ function hashUserOperationAvax(params) {
2965
2961
  }
2966
2962
  /** EntryPoint v0.7 `getNonce(sender, key)` with key `0`. */
2967
2963
  async function readAvaxSenderNonce(params) {
2968
- return actions.readContract(params.publicClient, {
2964
+ return readContract(params.publicClient, {
2969
2965
  address: params.entryPointAddress,
2970
- abi: accountAbstraction.entryPoint07Abi,
2966
+ abi: entryPoint07Abi,
2971
2967
  functionName: 'getNonce',
2972
2968
  args: [params.sender, params.key ?? 0n],
2973
2969
  });
@@ -3001,7 +2997,7 @@ const SIMPLE_ACCOUNT_FACTORY_ABI = [
3001
2997
  ];
3002
2998
  async function predictSimpleAccountAddress(params) {
3003
2999
  const salt = params.salt ?? 0n;
3004
- const addr = await actions.readContract(params.publicClient, {
3000
+ const addr = await readContract(params.publicClient, {
3005
3001
  address: params.factory,
3006
3002
  abi: SIMPLE_ACCOUNT_FACTORY_ABI,
3007
3003
  functionName: 'getAddress',
@@ -3010,7 +3006,7 @@ async function predictSimpleAccountAddress(params) {
3010
3006
  return addr;
3011
3007
  }
3012
3008
  function encodeCreateAccountFactoryData(owner, salt) {
3013
- return viem.encodeFunctionData({
3009
+ return encodeFunctionData({
3014
3010
  abi: SIMPLE_ACCOUNT_FACTORY_ABI,
3015
3011
  functionName: 'createAccount',
3016
3012
  args: [owner, salt],
@@ -4402,9 +4398,9 @@ if (process.env.NODE_ENV === 'production') {
4402
4398
 
4403
4399
  var jsxRuntimeExports = jsxRuntime.exports;
4404
4400
 
4405
- const SmoothSendAvaxContext = require$$0.createContext(null);
4401
+ const SmoothSendAvaxContext = createContext(null);
4406
4402
  function SmoothSendAvaxProvider({ apiKey, network = 'testnet', smartAccountAddress, accountFactory, accountSalt, children, }) {
4407
- const value = require$$0.useMemo(() => ({
4403
+ const value = useMemo(() => ({
4408
4404
  apiKey,
4409
4405
  network,
4410
4406
  smartAccountAddress,
@@ -4414,7 +4410,7 @@ function SmoothSendAvaxProvider({ apiKey, network = 'testnet', smartAccountAddre
4414
4410
  return (jsxRuntimeExports.jsx(SmoothSendAvaxContext.Provider, { value: value, children: children }));
4415
4411
  }
4416
4412
  function useSmoothSendAvaxContext() {
4417
- return require$$0.useContext(SmoothSendAvaxContext);
4413
+ return useContext(SmoothSendAvaxContext);
4418
4414
  }
4419
4415
  function useSmoothSendAvax(params) {
4420
4416
  const ctx = useSmoothSendAvaxContext();
@@ -4429,9 +4425,9 @@ function useSmoothSendAvax(params) {
4429
4425
  if (!smartAccountAddressProp && !accountFactory) {
4430
4426
  throw new Error('[SmoothSend AVAX] Provide smartAccountAddress and/or accountFactory (SimpleAccountFactory)');
4431
4427
  }
4432
- const submitter = require$$0.useMemo(() => new SmoothSendAvaxSubmitter({ apiKey, network }), [apiKey, network]);
4428
+ const submitter = useMemo(() => new SmoothSendAvaxSubmitter({ apiKey, network }), [apiKey, network]);
4433
4429
  const { publicClient, walletClient } = params;
4434
- const submitCall = require$$0.useCallback(async (call) => {
4430
+ const submitCall = useCallback(async (call) => {
4435
4431
  if (!publicClient) {
4436
4432
  throw new Error('[SmoothSend AVAX] publicClient missing (wagmi usePublicClient)');
4437
4433
  }
@@ -4501,10 +4497,10 @@ function useSmoothSendAvax(params) {
4501
4497
  return submitter.submitSponsoredUserOperation({
4502
4498
  userOp: {
4503
4499
  sender,
4504
- nonce: viem.toHex(nonce),
4500
+ nonce: toHex(nonce),
4505
4501
  callData,
4506
- maxFeePerGas: viem.toHex(maxFeePerGas),
4507
- maxPriorityFeePerGas: viem.toHex(maxPriorityFeePerGas),
4502
+ maxFeePerGas: toHex(maxFeePerGas),
4503
+ maxPriorityFeePerGas: toHex(maxPriorityFeePerGas),
4508
4504
  ...(factory && factoryData ? { factory, factoryData } : {}),
4509
4505
  },
4510
4506
  mode: call.mode ?? 'developer-sponsored',
@@ -4594,8 +4590,8 @@ class SmoothSendSession {
4594
4590
  static async create(options, submitter) {
4595
4591
  // Resolve network from options or submitter config
4596
4592
  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 }));
4593
+ const aptosNetwork = network === 'mainnet' ? Network.MAINNET : Network.TESTNET;
4594
+ const aptosClient = new Aptos(new AptosConfig({ network: aptosNetwork }));
4599
4595
  const feature = await aptosClient.view({
4600
4596
  payload: {
4601
4597
  function: '0x1::features::is_permissioned_signer_enabled',
@@ -4606,7 +4602,7 @@ class SmoothSendSession {
4606
4602
  throw new Error('[SmoothSend] Session keys unavailable on this network (permissioned signer feature disabled).');
4607
4603
  }
4608
4604
  // Generate a fresh Ed25519 session keypair (lives in memory, never persisted)
4609
- const sessionAccount = tsSdk.Account.generate();
4605
+ const sessionAccount = Account.generate();
4610
4606
  // Client-side expiry tracking (the bytecode script doesn't take an expiry arg)
4611
4607
  const nowSecs = Math.floor(Date.now() / 1000);
4612
4608
  const expirationTimeSecs = nowSecs + parseDurationToSeconds(options.expiresIn);
@@ -4618,7 +4614,7 @@ class SmoothSendSession {
4618
4614
  withFeePayer: true,
4619
4615
  data: {
4620
4616
  bytecode: ADD_PERMISSIONED_HANDLE_BYTECODE,
4621
- functionArguments: [tsSdk.MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
4617
+ functionArguments: [MoveVector.U8(sessionAccount.publicKey.toUint8Array())],
4622
4618
  },
4623
4619
  options: {
4624
4620
  replayProtectionNonce: BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)),
@@ -4648,7 +4644,7 @@ class SmoothSendSession {
4648
4644
  data: {
4649
4645
  function: '0x1::account_abstraction::add_authentication_function',
4650
4646
  functionArguments: [
4651
- tsSdk.AccountAddress.fromString('0x1'),
4647
+ AccountAddress.fromString('0x1'),
4652
4648
  'permissioned_delegation',
4653
4649
  'authenticate',
4654
4650
  ],
@@ -4664,7 +4660,7 @@ class SmoothSendSession {
4664
4660
  }
4665
4661
  // Build AbstractedAccount — signs future txs with session key but
4666
4662
  // sender on-chain = master address. Chain validates via permissioned_delegation.
4667
- const abstractedAccount = tsSdk.AbstractedAccount.fromPermissionedSigner({
4663
+ const abstractedAccount = AbstractedAccount.fromPermissionedSigner({
4668
4664
  signer: sessionAccount,
4669
4665
  accountAddress: options.signer.accountAddress,
4670
4666
  });
@@ -5054,10 +5050,10 @@ class TrueGaslessClient {
5054
5050
  baseUrl: this.config.proxyUrl, // Use custom proxy URL if provided
5055
5051
  });
5056
5052
  const networkMap = {
5057
- testnet: tsSdk.Network.TESTNET,
5058
- mainnet: tsSdk.Network.MAINNET,
5053
+ testnet: Network.TESTNET,
5054
+ mainnet: Network.MAINNET,
5059
5055
  };
5060
- this.aptos = new tsSdk.Aptos(new tsSdk.AptosConfig({ network: networkMap[this.config.network] }));
5056
+ this.aptos = new Aptos(new AptosConfig({ network: networkMap[this.config.network] }));
5061
5057
  }
5062
5058
  log(message, data) {
5063
5059
  if (this.config.debug) {
@@ -5129,6 +5125,8 @@ function createTrueGaslessClient(config) {
5129
5125
  return new TrueGaslessClient(config);
5130
5126
  }
5131
5127
 
5128
+ const VERSION = '2.2.3';
5129
+
5132
5130
  /**
5133
5131
  * SmoothSend SDK v2.0
5134
5132
  *
@@ -5155,52 +5153,13 @@ function createTrueGaslessClient(config) {
5155
5153
  * const result = await sdk.transfer({ from, to, token: 'XLM', amount: '100', chain: 'stellar-testnet' }, stellarWallet);
5156
5154
  * ```
5157
5155
  */
5158
- // Main SDK export
5159
- /**
5160
- * SDK version
5161
- * @public
5162
- */
5163
- const VERSION = '2.2.1';
5164
-
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;
5156
+ if (typeof window !== 'undefined') {
5157
+ console.warn('[@smoothsend/sdk] You are importing the full SDK. ' +
5158
+ 'Consider using subpath imports for smaller bundles:\\n' +
5159
+ ' - import { ... } from "@smoothsend/sdk/avax"\\n' +
5160
+ ' - import { ... } from "@smoothsend/sdk/aptos"\\n' +
5161
+ ' - import { ... } from "@smoothsend/sdk/stellar"');
5162
+ }
5163
+
5164
+ 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
5165
  //# sourceMappingURL=index.js.map