@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.
- package/dist/{PayoutsProtocol-B5z8SEA-.d.ts → PayoutsProtocol-DAa-9A5C.d.ts} +8 -1
- package/dist/{PayoutsProtocol-CLiMFe54.d.mts → PayoutsProtocol-DKEQhwYH.d.mts} +8 -1
- package/dist/{TransactionService-BtWUjKt_.d.ts → TransactionService-BEkgF1T6.d.ts} +12 -2
- package/dist/{TransactionService-Lr_WS6iR.d.mts → TransactionService-CF_C3Kqm.d.mts} +12 -2
- package/dist/{WalletManager-DQQwVkoa.d.ts → WalletManager-CeLlZo2y.d.ts} +23 -2
- package/dist/{WalletManager-Sbpx4E1-.d.mts → WalletManager-DIx8nENh.d.mts} +23 -2
- package/dist/{contracts-B842YprC.d.mts → contracts-JfZDzaV7.d.ts} +11 -2
- package/dist/{contracts-s_CDIruh.d.ts → contracts-pugJnFzl.d.mts} +11 -2
- package/dist/{index-CTyZlHKg.d.mts → index-c90msmwW.d.mts} +2 -1
- package/dist/{index-CTyZlHKg.d.ts → index-c90msmwW.d.ts} +2 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +339 -916
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +337 -914
- package/dist/index.mjs.map +1 -1
- package/dist/protocols/index.d.mts +2 -2
- package/dist/protocols/index.d.ts +2 -2
- package/dist/protocols/index.js +24 -11
- package/dist/protocols/index.js.map +1 -1
- package/dist/protocols/index.mjs +24 -11
- package/dist/protocols/index.mjs.map +1 -1
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +255 -826
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +253 -824
- package/dist/react/index.mjs.map +1 -1
- package/dist/services/index.d.mts +2 -2
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +179 -767
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +177 -765
- package/dist/services/index.mjs.map +1 -1
- package/dist/storage/index.js +5 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/index.mjs +5 -2
- package/dist/storage/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +3 -3
- package/dist/wallet/index.d.ts +3 -3
- package/dist/wallet/index.js +262 -854
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +260 -852
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/protocols/index.mjs
CHANGED
|
@@ -3589,10 +3589,23 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3589
3589
|
contractAddress;
|
|
3590
3590
|
chainId;
|
|
3591
3591
|
abi = ZubariSubscription_default;
|
|
3592
|
+
/** Cached ethers Interface instance (lazy-initialized) */
|
|
3593
|
+
_iface = null;
|
|
3592
3594
|
constructor(contractAddress, chainId) {
|
|
3593
3595
|
this.contractAddress = contractAddress;
|
|
3594
3596
|
this.chainId = chainId;
|
|
3595
3597
|
}
|
|
3598
|
+
/**
|
|
3599
|
+
* Get or create the cached ethers Interface for encoding/decoding contract calls.
|
|
3600
|
+
* The Interface is created once on first use and reused for all subsequent calls.
|
|
3601
|
+
*/
|
|
3602
|
+
async getInterface() {
|
|
3603
|
+
if (!this._iface) {
|
|
3604
|
+
const { Interface } = await import('ethers');
|
|
3605
|
+
this._iface = new Interface(this.abi);
|
|
3606
|
+
}
|
|
3607
|
+
return this._iface;
|
|
3608
|
+
}
|
|
3596
3609
|
/**
|
|
3597
3610
|
* Get the contract ABI
|
|
3598
3611
|
*/
|
|
@@ -3620,7 +3633,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3620
3633
|
if (plan.duration <= 0) {
|
|
3621
3634
|
throw new Error("Plan duration must be greater than 0");
|
|
3622
3635
|
}
|
|
3623
|
-
const iface =
|
|
3636
|
+
const iface = await this.getInterface();
|
|
3624
3637
|
const durationDays = Math.ceil(plan.duration / (24 * 60 * 60));
|
|
3625
3638
|
const data = iface.encodeFunctionData("createPlan", [
|
|
3626
3639
|
plan.name,
|
|
@@ -3645,7 +3658,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3645
3658
|
* @param signer Wallet signer
|
|
3646
3659
|
*/
|
|
3647
3660
|
async deactivatePlan(planId, signer) {
|
|
3648
|
-
const iface =
|
|
3661
|
+
const iface = await this.getInterface();
|
|
3649
3662
|
const data = iface.encodeFunctionData("deactivatePlan", [planId]);
|
|
3650
3663
|
const result = await signer.sendTransaction({
|
|
3651
3664
|
to: this.contractAddress,
|
|
@@ -3669,7 +3682,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3669
3682
|
if (months <= 0) {
|
|
3670
3683
|
throw new Error("Subscription duration must be at least 1 month");
|
|
3671
3684
|
}
|
|
3672
|
-
const iface =
|
|
3685
|
+
const iface = await this.getInterface();
|
|
3673
3686
|
const data = iface.encodeFunctionData("subscribe", [planId, months]);
|
|
3674
3687
|
const result = await signer.sendTransaction({
|
|
3675
3688
|
to: this.contractAddress,
|
|
@@ -3688,7 +3701,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3688
3701
|
* @param signer Wallet signer
|
|
3689
3702
|
*/
|
|
3690
3703
|
async cancel(subscriptionId, signer) {
|
|
3691
|
-
const iface =
|
|
3704
|
+
const iface = await this.getInterface();
|
|
3692
3705
|
const data = iface.encodeFunctionData("cancel", [subscriptionId]);
|
|
3693
3706
|
const result = await signer.sendTransaction({
|
|
3694
3707
|
to: this.contractAddress,
|
|
@@ -3708,7 +3721,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3708
3721
|
* @param signer Wallet signer
|
|
3709
3722
|
*/
|
|
3710
3723
|
async setAutoRenew(subscriptionId, autoRenew, signer) {
|
|
3711
|
-
const iface =
|
|
3724
|
+
const iface = await this.getInterface();
|
|
3712
3725
|
const data = iface.encodeFunctionData("setAutoRenew", [subscriptionId, autoRenew]);
|
|
3713
3726
|
const result = await signer.sendTransaction({
|
|
3714
3727
|
to: this.contractAddress,
|
|
@@ -3728,7 +3741,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3728
3741
|
* @param provider JSON-RPC provider
|
|
3729
3742
|
*/
|
|
3730
3743
|
async isSubscribed(subscriber, creator, provider) {
|
|
3731
|
-
const iface =
|
|
3744
|
+
const iface = await this.getInterface();
|
|
3732
3745
|
const data = iface.encodeFunctionData("isSubscribed", [subscriber, creator]);
|
|
3733
3746
|
try {
|
|
3734
3747
|
const result = await provider.call({
|
|
@@ -3748,7 +3761,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3748
3761
|
* @param provider JSON-RPC provider
|
|
3749
3762
|
*/
|
|
3750
3763
|
async getActiveSubscriptionId(subscriber, creator, provider) {
|
|
3751
|
-
const iface =
|
|
3764
|
+
const iface = await this.getInterface();
|
|
3752
3765
|
const data = iface.encodeFunctionData("activeSubscription", [subscriber, creator]);
|
|
3753
3766
|
try {
|
|
3754
3767
|
const result = await provider.call({
|
|
@@ -3771,7 +3784,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3771
3784
|
* @param provider JSON-RPC provider
|
|
3772
3785
|
*/
|
|
3773
3786
|
async getSubscription(subscriptionId, provider) {
|
|
3774
|
-
const iface =
|
|
3787
|
+
const iface = await this.getInterface();
|
|
3775
3788
|
const data = iface.encodeFunctionData("getSubscription", [subscriptionId]);
|
|
3776
3789
|
try {
|
|
3777
3790
|
const result = await provider.call({
|
|
@@ -3817,7 +3830,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3817
3830
|
* @param provider JSON-RPC provider
|
|
3818
3831
|
*/
|
|
3819
3832
|
async getPlan(planId, provider) {
|
|
3820
|
-
const iface =
|
|
3833
|
+
const iface = await this.getInterface();
|
|
3821
3834
|
const data = iface.encodeFunctionData("getPlan", [planId]);
|
|
3822
3835
|
try {
|
|
3823
3836
|
const result = await provider.call({
|
|
@@ -3853,7 +3866,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3853
3866
|
* @param provider JSON-RPC provider
|
|
3854
3867
|
*/
|
|
3855
3868
|
async getCreatorPlanIds(creator, provider) {
|
|
3856
|
-
const iface =
|
|
3869
|
+
const iface = await this.getInterface();
|
|
3857
3870
|
const data = iface.encodeFunctionData("getCreatorPlans", [creator]);
|
|
3858
3871
|
try {
|
|
3859
3872
|
const result = await provider.call({
|
|
@@ -3887,7 +3900,7 @@ var ZubariSubscriptionProtocol = class {
|
|
|
3887
3900
|
* @param provider JSON-RPC provider
|
|
3888
3901
|
*/
|
|
3889
3902
|
async getPlatformFeeBps(provider) {
|
|
3890
|
-
const iface =
|
|
3903
|
+
const iface = await this.getInterface();
|
|
3891
3904
|
const data = iface.encodeFunctionData("platformFeeBps", []);
|
|
3892
3905
|
try {
|
|
3893
3906
|
const result = await provider.call({
|