@zubari/sdk 0.5.2 → 0.5.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 (45) hide show
  1. package/dist/{PayoutsProtocol-B5z8SEA-.d.ts → PayoutsProtocol-DAa-9A5C.d.ts} +8 -1
  2. package/dist/{PayoutsProtocol-CLiMFe54.d.mts → PayoutsProtocol-DKEQhwYH.d.mts} +8 -1
  3. package/dist/{TransactionService-BtWUjKt_.d.ts → TransactionService-BEkgF1T6.d.ts} +12 -2
  4. package/dist/{TransactionService-Lr_WS6iR.d.mts → TransactionService-CF_C3Kqm.d.mts} +12 -2
  5. package/dist/{WalletManager-DQQwVkoa.d.ts → WalletManager-CeLlZo2y.d.ts} +23 -2
  6. package/dist/{WalletManager-Sbpx4E1-.d.mts → WalletManager-DIx8nENh.d.mts} +23 -2
  7. package/dist/{contracts-B842YprC.d.mts → contracts-JfZDzaV7.d.ts} +11 -2
  8. package/dist/{contracts-s_CDIruh.d.ts → contracts-pugJnFzl.d.mts} +11 -2
  9. package/dist/{index-CTyZlHKg.d.mts → index-c90msmwW.d.mts} +2 -1
  10. package/dist/{index-CTyZlHKg.d.ts → index-c90msmwW.d.ts} +2 -1
  11. package/dist/index.d.mts +5 -5
  12. package/dist/index.d.ts +5 -5
  13. package/dist/index.js +339 -916
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +337 -914
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/protocols/index.d.mts +2 -2
  18. package/dist/protocols/index.d.ts +2 -2
  19. package/dist/protocols/index.js +24 -11
  20. package/dist/protocols/index.js.map +1 -1
  21. package/dist/protocols/index.mjs +24 -11
  22. package/dist/protocols/index.mjs.map +1 -1
  23. package/dist/react/index.d.mts +3 -3
  24. package/dist/react/index.d.ts +3 -3
  25. package/dist/react/index.js +255 -826
  26. package/dist/react/index.js.map +1 -1
  27. package/dist/react/index.mjs +253 -824
  28. package/dist/react/index.mjs.map +1 -1
  29. package/dist/services/index.d.mts +2 -2
  30. package/dist/services/index.d.ts +2 -2
  31. package/dist/services/index.js +179 -767
  32. package/dist/services/index.js.map +1 -1
  33. package/dist/services/index.mjs +177 -765
  34. package/dist/services/index.mjs.map +1 -1
  35. package/dist/storage/index.js +5 -2
  36. package/dist/storage/index.js.map +1 -1
  37. package/dist/storage/index.mjs +5 -2
  38. package/dist/storage/index.mjs.map +1 -1
  39. package/dist/wallet/index.d.mts +3 -3
  40. package/dist/wallet/index.d.ts +3 -3
  41. package/dist/wallet/index.js +262 -854
  42. package/dist/wallet/index.js.map +1 -1
  43. package/dist/wallet/index.mjs +260 -852
  44. package/dist/wallet/index.mjs.map +1 -1
  45. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from '../PayoutsProtocol-CLiMFe54.mjs';
2
- import { T as TxResult, C as Creator, S as SubscriptionPlan, a as Subscription } from '../index-CTyZlHKg.mjs';
1
+ export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from '../PayoutsProtocol-DKEQhwYH.mjs';
2
+ import { T as TxResult, C as Creator, S as SubscriptionPlan, a as Subscription } from '../index-c90msmwW.mjs';
3
3
 
4
4
  /**
5
5
  * ZubariSubscriptionV2Protocol - Subscription payments with integrated payouts
@@ -1,5 +1,5 @@
1
- export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from '../PayoutsProtocol-B5z8SEA-.js';
2
- import { T as TxResult, C as Creator, S as SubscriptionPlan, a as Subscription } from '../index-CTyZlHKg.js';
1
+ export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from '../PayoutsProtocol-DAa-9A5C.js';
2
+ import { T as TxResult, C as Creator, S as SubscriptionPlan, a as Subscription } from '../index-c90msmwW.js';
3
3
 
4
4
  /**
5
5
  * ZubariSubscriptionV2Protocol - Subscription payments with integrated payouts
@@ -3591,10 +3591,23 @@ var ZubariSubscriptionProtocol = class {
3591
3591
  contractAddress;
3592
3592
  chainId;
3593
3593
  abi = ZubariSubscription_default;
3594
+ /** Cached ethers Interface instance (lazy-initialized) */
3595
+ _iface = null;
3594
3596
  constructor(contractAddress, chainId) {
3595
3597
  this.contractAddress = contractAddress;
3596
3598
  this.chainId = chainId;
3597
3599
  }
3600
+ /**
3601
+ * Get or create the cached ethers Interface for encoding/decoding contract calls.
3602
+ * The Interface is created once on first use and reused for all subsequent calls.
3603
+ */
3604
+ async getInterface() {
3605
+ if (!this._iface) {
3606
+ const { Interface } = await import('ethers');
3607
+ this._iface = new Interface(this.abi);
3608
+ }
3609
+ return this._iface;
3610
+ }
3598
3611
  /**
3599
3612
  * Get the contract ABI
3600
3613
  */
@@ -3622,7 +3635,7 @@ var ZubariSubscriptionProtocol = class {
3622
3635
  if (plan.duration <= 0) {
3623
3636
  throw new Error("Plan duration must be greater than 0");
3624
3637
  }
3625
- const iface = new (await import('ethers')).Interface(this.abi);
3638
+ const iface = await this.getInterface();
3626
3639
  const durationDays = Math.ceil(plan.duration / (24 * 60 * 60));
3627
3640
  const data = iface.encodeFunctionData("createPlan", [
3628
3641
  plan.name,
@@ -3647,7 +3660,7 @@ var ZubariSubscriptionProtocol = class {
3647
3660
  * @param signer Wallet signer
3648
3661
  */
3649
3662
  async deactivatePlan(planId, signer) {
3650
- const iface = new (await import('ethers')).Interface(this.abi);
3663
+ const iface = await this.getInterface();
3651
3664
  const data = iface.encodeFunctionData("deactivatePlan", [planId]);
3652
3665
  const result = await signer.sendTransaction({
3653
3666
  to: this.contractAddress,
@@ -3671,7 +3684,7 @@ var ZubariSubscriptionProtocol = class {
3671
3684
  if (months <= 0) {
3672
3685
  throw new Error("Subscription duration must be at least 1 month");
3673
3686
  }
3674
- const iface = new (await import('ethers')).Interface(this.abi);
3687
+ const iface = await this.getInterface();
3675
3688
  const data = iface.encodeFunctionData("subscribe", [planId, months]);
3676
3689
  const result = await signer.sendTransaction({
3677
3690
  to: this.contractAddress,
@@ -3690,7 +3703,7 @@ var ZubariSubscriptionProtocol = class {
3690
3703
  * @param signer Wallet signer
3691
3704
  */
3692
3705
  async cancel(subscriptionId, signer) {
3693
- const iface = new (await import('ethers')).Interface(this.abi);
3706
+ const iface = await this.getInterface();
3694
3707
  const data = iface.encodeFunctionData("cancel", [subscriptionId]);
3695
3708
  const result = await signer.sendTransaction({
3696
3709
  to: this.contractAddress,
@@ -3710,7 +3723,7 @@ var ZubariSubscriptionProtocol = class {
3710
3723
  * @param signer Wallet signer
3711
3724
  */
3712
3725
  async setAutoRenew(subscriptionId, autoRenew, signer) {
3713
- const iface = new (await import('ethers')).Interface(this.abi);
3726
+ const iface = await this.getInterface();
3714
3727
  const data = iface.encodeFunctionData("setAutoRenew", [subscriptionId, autoRenew]);
3715
3728
  const result = await signer.sendTransaction({
3716
3729
  to: this.contractAddress,
@@ -3730,7 +3743,7 @@ var ZubariSubscriptionProtocol = class {
3730
3743
  * @param provider JSON-RPC provider
3731
3744
  */
3732
3745
  async isSubscribed(subscriber, creator, provider) {
3733
- const iface = new (await import('ethers')).Interface(this.abi);
3746
+ const iface = await this.getInterface();
3734
3747
  const data = iface.encodeFunctionData("isSubscribed", [subscriber, creator]);
3735
3748
  try {
3736
3749
  const result = await provider.call({
@@ -3750,7 +3763,7 @@ var ZubariSubscriptionProtocol = class {
3750
3763
  * @param provider JSON-RPC provider
3751
3764
  */
3752
3765
  async getActiveSubscriptionId(subscriber, creator, provider) {
3753
- const iface = new (await import('ethers')).Interface(this.abi);
3766
+ const iface = await this.getInterface();
3754
3767
  const data = iface.encodeFunctionData("activeSubscription", [subscriber, creator]);
3755
3768
  try {
3756
3769
  const result = await provider.call({
@@ -3773,7 +3786,7 @@ var ZubariSubscriptionProtocol = class {
3773
3786
  * @param provider JSON-RPC provider
3774
3787
  */
3775
3788
  async getSubscription(subscriptionId, provider) {
3776
- const iface = new (await import('ethers')).Interface(this.abi);
3789
+ const iface = await this.getInterface();
3777
3790
  const data = iface.encodeFunctionData("getSubscription", [subscriptionId]);
3778
3791
  try {
3779
3792
  const result = await provider.call({
@@ -3819,7 +3832,7 @@ var ZubariSubscriptionProtocol = class {
3819
3832
  * @param provider JSON-RPC provider
3820
3833
  */
3821
3834
  async getPlan(planId, provider) {
3822
- const iface = new (await import('ethers')).Interface(this.abi);
3835
+ const iface = await this.getInterface();
3823
3836
  const data = iface.encodeFunctionData("getPlan", [planId]);
3824
3837
  try {
3825
3838
  const result = await provider.call({
@@ -3855,7 +3868,7 @@ var ZubariSubscriptionProtocol = class {
3855
3868
  * @param provider JSON-RPC provider
3856
3869
  */
3857
3870
  async getCreatorPlanIds(creator, provider) {
3858
- const iface = new (await import('ethers')).Interface(this.abi);
3871
+ const iface = await this.getInterface();
3859
3872
  const data = iface.encodeFunctionData("getCreatorPlans", [creator]);
3860
3873
  try {
3861
3874
  const result = await provider.call({
@@ -3889,7 +3902,7 @@ var ZubariSubscriptionProtocol = class {
3889
3902
  * @param provider JSON-RPC provider
3890
3903
  */
3891
3904
  async getPlatformFeeBps(provider) {
3892
- const iface = new (await import('ethers')).Interface(this.abi);
3905
+ const iface = await this.getInterface();
3893
3906
  const data = iface.encodeFunctionData("platformFeeBps", []);
3894
3907
  try {
3895
3908
  const result = await provider.call({