@smoothsend/sdk 2.3.3 → 2.3.5

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 (77) hide show
  1. package/dist/aptos/index.cjs +160 -0
  2. package/dist/aptos/index.cjs.map +1 -1
  3. package/dist/aptos/index.d.ts +65 -749
  4. package/dist/aptos/index.js +160 -3
  5. package/dist/aptos/index.js.map +1 -1
  6. package/dist/aptos-entry.d.ts +1 -0
  7. package/dist/aptos-entry.d.ts.map +1 -1
  8. package/dist/aptos-privy/SmoothSendAptosProvider.d.ts +7 -0
  9. package/dist/aptos-privy/SmoothSendAptosProvider.d.ts.map +1 -0
  10. package/dist/aptos-privy/index.cjs +40 -0
  11. package/dist/aptos-privy/index.cjs.map +1 -0
  12. package/dist/aptos-privy/index.d.ts +4 -0
  13. package/dist/aptos-privy/index.d.ts.map +1 -0
  14. package/dist/aptos-privy/index.js +34 -0
  15. package/dist/aptos-privy/index.js.map +1 -0
  16. package/dist/aptos-privy/normalizePrivyAptosWallet.d.ts +4 -0
  17. package/dist/aptos-privy/normalizePrivyAptosWallet.d.ts.map +1 -0
  18. package/dist/aptos-privy/privyAptosSigner.d.ts +32 -0
  19. package/dist/aptos-privy/privyAptosSigner.d.ts.map +1 -0
  20. package/dist/aptos-privy/types.d.ts +71 -0
  21. package/dist/aptos-privy/types.d.ts.map +1 -0
  22. package/dist/aptos-privy/useSmoothSendAptosPrivy.d.ts +13 -0
  23. package/dist/aptos-privy/useSmoothSendAptosPrivy.d.ts.map +1 -0
  24. package/dist/aptos-privy/useSmoothSendPrivyWrite.d.ts +13 -0
  25. package/dist/aptos-privy/useSmoothSendPrivyWrite.d.ts.map +1 -0
  26. package/dist/aptos-privy-entry.d.ts +9 -0
  27. package/dist/aptos-privy-entry.d.ts.map +1 -0
  28. package/dist/avax/SmoothSendAvaxClient.d.ts +4 -2
  29. package/dist/avax/SmoothSendAvaxClient.d.ts.map +1 -1
  30. package/dist/avax/index.cjs +114 -28
  31. package/dist/avax/index.cjs.map +1 -1
  32. package/dist/avax/index.d.ts +57 -6
  33. package/dist/avax/index.d.ts.map +1 -1
  34. package/dist/avax/index.js +113 -29
  35. package/dist/avax/index.js.map +1 -1
  36. package/dist/avax/privySigner.d.ts +12 -0
  37. package/dist/avax/privySigner.d.ts.map +1 -0
  38. package/dist/avax/types.d.ts +6 -0
  39. package/dist/avax/types.d.ts.map +1 -1
  40. package/dist/avax/useSmoothSendAvax.d.ts +6 -2
  41. package/dist/avax/useSmoothSendAvax.d.ts.map +1 -1
  42. package/dist/avax/useSmoothSendPrivyWrite.d.ts +35 -0
  43. package/dist/avax/useSmoothSendPrivyWrite.d.ts.map +1 -0
  44. package/dist/avax/useSmoothSendWrite.d.ts +11 -4
  45. package/dist/avax/useSmoothSendWrite.d.ts.map +1 -1
  46. package/dist/avax-entry.d.ts +1 -1
  47. package/dist/avax-entry.d.ts.map +1 -1
  48. package/dist/chunks/shared-2xx2VLH3.js +453 -0
  49. package/dist/chunks/shared-2xx2VLH3.js.map +1 -0
  50. package/dist/chunks/shared-B8UdyBTN.d.ts +143 -0
  51. package/dist/chunks/shared-BJv1JV1H.cjs +702 -0
  52. package/dist/chunks/shared-BJv1JV1H.cjs.map +1 -0
  53. package/dist/chunks/shared-BXvqbQ6f.d.ts +262 -0
  54. package/dist/chunks/shared-Bh4xtpHv.js +740 -0
  55. package/dist/chunks/shared-Bh4xtpHv.js.map +1 -0
  56. package/dist/chunks/shared-BlIQttCf.d.ts +1279 -0
  57. package/dist/chunks/shared-BoRfHN1w.js +1511 -0
  58. package/dist/chunks/shared-BoRfHN1w.js.map +1 -0
  59. package/dist/chunks/shared-CPpb2n9T.d.ts +780 -0
  60. package/dist/chunks/shared-Cgb7mhwI.d.ts +471 -0
  61. package/dist/chunks/shared-CzR0rIwZ.cjs +635 -0
  62. package/dist/chunks/shared-CzR0rIwZ.cjs.map +1 -0
  63. package/dist/chunks/shared-DQbEIiTE.cjs +746 -0
  64. package/dist/chunks/shared-DQbEIiTE.cjs.map +1 -0
  65. package/dist/chunks/shared-DzwYUjQn.cjs +457 -0
  66. package/dist/chunks/shared-DzwYUjQn.cjs.map +1 -0
  67. package/dist/chunks/shared-KUvoQkzf.d.ts +471 -0
  68. package/dist/chunks/shared-XH1iLZjy.js +629 -0
  69. package/dist/chunks/shared-XH1iLZjy.js.map +1 -0
  70. package/dist/chunks/shared-kovW7ATj.js +694 -0
  71. package/dist/chunks/shared-kovW7ATj.js.map +1 -0
  72. package/dist/index.cjs +43 -28
  73. package/dist/index.cjs.map +1 -1
  74. package/dist/index.d.ts +2 -2
  75. package/dist/index.js +43 -28
  76. package/dist/index.js.map +1 -1
  77. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3112,7 +3112,11 @@ class SmoothSendAvaxClient {
3112
3112
  entryPointAddress: built.entryPoint,
3113
3113
  userOperation: op
3114
3114
  });
3115
- return this.signUserOpHash(hash);
3115
+ return this.signUserOpHash(hash, {
3116
+ chainId: built.chainId,
3117
+ entryPoint: built.entryPoint,
3118
+ sender: built.userOp.sender,
3119
+ });
3116
3120
  }
3117
3121
  });
3118
3122
  return {
@@ -3143,11 +3147,10 @@ class SmoothSendAvaxClient {
3143
3147
  }
3144
3148
  async buildDraft(calls, overrides) {
3145
3149
  const { publicClient, walletClient } = this.config;
3146
- const account = walletClient.account;
3147
- if (!account) {
3148
- throw new Error('[SmoothSend AVAX] walletClient.account missing');
3150
+ const ownerAddress = (this.config.ownerAddress ?? walletClient?.account?.address);
3151
+ if (!ownerAddress) {
3152
+ throw new Error('[SmoothSend AVAX] ownerAddress missing — provide ownerAddress or walletClient.account');
3149
3153
  }
3150
- const ownerAddress = account.address;
3151
3154
  const defaults = await this.submitter.getPublicAaDefaults().catch(() => null);
3152
3155
  const accountFactory = overrides?.accountFactory ??
3153
3156
  this.config.accountFactory ??
@@ -3227,14 +3230,21 @@ class SmoothSendAvaxClient {
3227
3230
  entryPoint
3228
3231
  };
3229
3232
  }
3230
- async signUserOpHash(hash) {
3231
- const account = this.config.walletClient.account;
3232
- if (!account)
3233
+ async signUserOpHash(hash, context) {
3234
+ if (this.config.signUserOpHash) {
3235
+ return this.config.signUserOpHash({
3236
+ hash,
3237
+ chainId: context.chainId,
3238
+ entryPoint: context.entryPoint,
3239
+ sender: context.sender,
3240
+ });
3241
+ }
3242
+ const walletClient = this.config.walletClient;
3243
+ const account = walletClient?.account;
3244
+ if (!walletClient || !account) {
3233
3245
  throw new Error('[SmoothSend AVAX] walletClient.account missing');
3234
- return this.config.walletClient.signMessage({
3235
- account,
3236
- message: { raw: hash }
3237
- });
3246
+ }
3247
+ return walletClient.signMessage({ account, message: { raw: hash } });
3238
3248
  }
3239
3249
  }
3240
3250
  function createSmoothSendAvaxClient(config) {
@@ -3316,23 +3326,25 @@ function useSmoothSendAvax(params) {
3316
3326
  const accountFactory = accountFactoryProp ?? (network === 'mainnet' ? discovered?.simpleAccountFactoryMainnet : discovered?.simpleAccountFactoryFuji);
3317
3327
  const paymasterAddress = (network === 'mainnet' ? discovered?.paymasterMainnet : discovered?.paymasterFuji);
3318
3328
  const { publicClient, walletClient } = params;
3329
+ const ownerAddressFromParams = params.ownerAddress;
3330
+ const signUserOpHash = params.signUserOpHash;
3319
3331
  const submitCall = useCallback(async (params) => {
3320
3332
  setIsPending(true);
3321
3333
  try {
3322
3334
  if (!publicClient) {
3323
3335
  throw new Error('[SmoothSend AVAX] publicClient missing (wagmi usePublicClient)');
3324
3336
  }
3325
- if (!walletClient) {
3337
+ if (!walletClient && !signUserOpHash) {
3326
3338
  throw new Error('[SmoothSend AVAX] walletClient missing (wagmi useWalletClient)');
3327
3339
  }
3328
3340
  if (!smartAccountAddressProp && !accountFactory) {
3329
3341
  throw new Error('[SmoothSend AVAX] No smartAccountAddress or accountFactory provided. Pass them to SmoothSendAvaxProvider or useSmoothSendAvax hook.');
3330
3342
  }
3331
- const account = walletClient.account;
3332
- if (!account) {
3333
- throw new Error('[SmoothSend AVAX] walletClient.account missing — connect wallet (wagmi useWalletClient)');
3343
+ const account = walletClient?.account;
3344
+ const ownerAddress = (ownerAddressFromParams ?? account?.address);
3345
+ if (!ownerAddress) {
3346
+ throw new Error('[SmoothSend AVAX] ownerAddress missing — provide ownerAddress or walletClient.account');
3334
3347
  }
3335
- const ownerAddress = account.address;
3336
3348
  const chainId = Number(publicClient.chain?.id ?? (await publicClient.getChainId()));
3337
3349
  const entryPoint = (await submitter.getSupportedEntryPoints())[0];
3338
3350
  let sender;
@@ -3415,10 +3427,13 @@ function useSmoothSendAvax(params) {
3415
3427
  entryPointAddress: entryPoint,
3416
3428
  userOperation: op,
3417
3429
  });
3418
- return walletClient.signMessage({
3419
- account,
3420
- message: { raw: hash },
3421
- });
3430
+ if (signUserOpHash) {
3431
+ return signUserOpHash({ hash, chainId, entryPoint, sender });
3432
+ }
3433
+ if (!walletClient || !account) {
3434
+ throw new Error('[SmoothSend AVAX] walletClient/account missing for signature');
3435
+ }
3436
+ return walletClient.signMessage({ account, message: { raw: hash } });
3422
3437
  },
3423
3438
  });
3424
3439
  }
@@ -3428,7 +3443,9 @@ function useSmoothSendAvax(params) {
3428
3443
  }, [
3429
3444
  accountFactory,
3430
3445
  accountSalt,
3446
+ ownerAddressFromParams,
3431
3447
  publicClient,
3448
+ signUserOpHash,
3432
3449
  smartAccountAddressProp,
3433
3450
  submitter,
3434
3451
  walletClient,
@@ -3448,17 +3465,14 @@ function useSmoothSendAvax(params) {
3448
3465
  if (!publicClient) {
3449
3466
  throw new Error('[SmoothSend AVAX] publicClient missing (wagmi usePublicClient)');
3450
3467
  }
3451
- if (!walletClient) {
3452
- throw new Error('[SmoothSend AVAX] walletClient missing (wagmi useWalletClient)');
3453
- }
3454
3468
  if (!smartAccountAddressProp && !accountFactory) {
3455
3469
  throw new Error('[SmoothSend AVAX] No smartAccountAddress or accountFactory provided. Pass them to SmoothSendAvaxProvider or useSmoothSendAvax hook.');
3456
3470
  }
3457
- const account = walletClient.account;
3458
- if (!account) {
3459
- throw new Error('[SmoothSend AVAX] walletClient.account missing — connect wallet (wagmi useWalletClient)');
3471
+ const account = walletClient?.account;
3472
+ const ownerAddress = (ownerAddressFromParams ?? account?.address);
3473
+ if (!ownerAddress) {
3474
+ throw new Error('[SmoothSend AVAX] ownerAddress missing — provide ownerAddress or walletClient.account');
3460
3475
  }
3461
- const ownerAddress = account.address;
3462
3476
  let sender;
3463
3477
  if (accountFactory) {
3464
3478
  const predicted = await predictSimpleAccountAddress({
@@ -3540,6 +3554,7 @@ function useSmoothSendAvax(params) {
3540
3554
  }, [
3541
3555
  accountFactory,
3542
3556
  accountSalt,
3557
+ ownerAddressFromParams,
3543
3558
  publicClient,
3544
3559
  smartAccountAddressProp,
3545
3560
  submitter,