@subscrypts/subscrypts-sdk-react 1.6.0
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/LICENSE +21 -0
- package/README.md +2140 -0
- package/dist/components/buttons/SubscryptsButton.d.ts +19 -0
- package/dist/components/buttons/SubscryptsButton.d.ts.map +1 -0
- package/dist/components/buttons/index.d.ts +5 -0
- package/dist/components/buttons/index.d.ts.map +1 -0
- package/dist/components/checkout/CheckoutWizard.d.ts +22 -0
- package/dist/components/checkout/CheckoutWizard.d.ts.map +1 -0
- package/dist/components/checkout/ConfigurationStep.d.ts +15 -0
- package/dist/components/checkout/ConfigurationStep.d.ts.map +1 -0
- package/dist/components/checkout/TransactionStep.d.ts +15 -0
- package/dist/components/checkout/TransactionStep.d.ts.map +1 -0
- package/dist/components/checkout/index.d.ts +7 -0
- package/dist/components/checkout/index.d.ts.map +1 -0
- package/dist/components/guards/SubscriptionGuard.d.ts +25 -0
- package/dist/components/guards/SubscriptionGuard.d.ts.map +1 -0
- package/dist/components/guards/index.d.ts +5 -0
- package/dist/components/guards/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/merchant/MerchantDashboard.d.ts +24 -0
- package/dist/components/merchant/MerchantDashboard.d.ts.map +1 -0
- package/dist/components/merchant/index.d.ts +6 -0
- package/dist/components/merchant/index.d.ts.map +1 -0
- package/dist/components/pricing/PlanCard.d.ts +45 -0
- package/dist/components/pricing/PlanCard.d.ts.map +1 -0
- package/dist/components/pricing/PricingTable.d.ts +68 -0
- package/dist/components/pricing/PricingTable.d.ts.map +1 -0
- package/dist/components/pricing/index.d.ts +10 -0
- package/dist/components/pricing/index.d.ts.map +1 -0
- package/dist/components/shared/ErrorDisplay.d.ts +34 -0
- package/dist/components/shared/ErrorDisplay.d.ts.map +1 -0
- package/dist/components/shared/LoadingSpinner.d.ts +5 -0
- package/dist/components/shared/LoadingSpinner.d.ts.map +1 -0
- package/dist/components/shared/Modal.d.ts +12 -0
- package/dist/components/shared/Modal.d.ts.map +1 -0
- package/dist/components/shared/NetworkSwitchPrompt.d.ts +33 -0
- package/dist/components/shared/NetworkSwitchPrompt.d.ts.map +1 -0
- package/dist/components/shared/SubscryptsErrorBoundary.d.ts +41 -0
- package/dist/components/shared/SubscryptsErrorBoundary.d.ts.map +1 -0
- package/dist/components/subscription/ConfirmDialog.d.ts +44 -0
- package/dist/components/subscription/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/subscription/ManageSubscriptionModal.d.ts +35 -0
- package/dist/components/subscription/ManageSubscriptionModal.d.ts.map +1 -0
- package/dist/components/subscription/SubscriptionCard.d.ts +35 -0
- package/dist/components/subscription/SubscriptionCard.d.ts.map +1 -0
- package/dist/components/subscription/SubscriptionDashboard.d.ts +40 -0
- package/dist/components/subscription/SubscriptionDashboard.d.ts.map +1 -0
- package/dist/components/subscription/index.d.ts +12 -0
- package/dist/components/subscription/index.d.ts.map +1 -0
- package/dist/components/wallet/ConnectWalletModal.d.ts +29 -0
- package/dist/components/wallet/ConnectWalletModal.d.ts.map +1 -0
- package/dist/components/wallet/index.d.ts +6 -0
- package/dist/components/wallet/index.d.ts.map +1 -0
- package/dist/constants/index.d.ts +16 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/context/SubscryptsContext.d.ts +36 -0
- package/dist/context/SubscryptsContext.d.ts.map +1 -0
- package/dist/context/SubscryptsProvider.d.ts +28 -0
- package/dist/context/SubscryptsProvider.d.ts.map +1 -0
- package/dist/context/index.d.ts +7 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/contract/abis/Subscrypts.d.ts +2917 -0
- package/dist/contract/abis/Subscrypts.d.ts.map +1 -0
- package/dist/contract/abis/dexFactoryABI.d.ts +184 -0
- package/dist/contract/abis/dexFactoryABI.d.ts.map +1 -0
- package/dist/contract/abis/dexPairABI.d.ts +775 -0
- package/dist/contract/abis/dexPairABI.d.ts.map +1 -0
- package/dist/contract/abis/dexPositionManagerABI.d.ts +948 -0
- package/dist/contract/abis/dexPositionManagerABI.d.ts.map +1 -0
- package/dist/contract/abis/dexQuoterABI.d.ts +206 -0
- package/dist/contract/abis/dexQuoterABI.d.ts.map +1 -0
- package/dist/contract/abis/dexRouterABI.d.ts +439 -0
- package/dist/contract/abis/dexRouterABI.d.ts.map +1 -0
- package/dist/contract/abis/dexUSDCABI.d.ts +132 -0
- package/dist/contract/abis/dexUSDCABI.d.ts.map +1 -0
- package/dist/contract/abis/index.d.ts +15 -0
- package/dist/contract/abis/index.d.ts.map +1 -0
- package/dist/contract/config.d.ts +40 -0
- package/dist/contract/config.d.ts.map +1 -0
- package/dist/contract/index.d.ts +12 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/methods.d.ts +305 -0
- package/dist/contract/methods.d.ts.map +1 -0
- package/dist/hooks/events/index.d.ts +6 -0
- package/dist/hooks/events/index.d.ts.map +1 -0
- package/dist/hooks/events/useSubscryptsEvents.d.ts +63 -0
- package/dist/hooks/events/useSubscryptsEvents.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +12 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/merchant/index.d.ts +10 -0
- package/dist/hooks/merchant/index.d.ts.map +1 -0
- package/dist/hooks/merchant/useMerchantPlans.d.ts +30 -0
- package/dist/hooks/merchant/useMerchantPlans.d.ts.map +1 -0
- package/dist/hooks/merchant/useMerchantRevenue.d.ts +59 -0
- package/dist/hooks/merchant/useMerchantRevenue.d.ts.map +1 -0
- package/dist/hooks/merchant/useMerchantSubscribers.d.ts +54 -0
- package/dist/hooks/merchant/useMerchantSubscribers.d.ts.map +1 -0
- package/dist/hooks/plans/index.d.ts +12 -0
- package/dist/hooks/plans/index.d.ts.map +1 -0
- package/dist/hooks/plans/usePlan.d.ts +33 -0
- package/dist/hooks/plans/usePlan.d.ts.map +1 -0
- package/dist/hooks/plans/usePlans.d.ts +36 -0
- package/dist/hooks/plans/usePlans.d.ts.map +1 -0
- package/dist/hooks/plans/usePlansByMerchant.d.ts +35 -0
- package/dist/hooks/plans/usePlansByMerchant.d.ts.map +1 -0
- package/dist/hooks/pricing/index.d.ts +10 -0
- package/dist/hooks/pricing/index.d.ts.map +1 -0
- package/dist/hooks/pricing/usePlanPrice.d.ts +59 -0
- package/dist/hooks/pricing/usePlanPrice.d.ts.map +1 -0
- package/dist/hooks/pricing/useSUBSPrice.d.ts +39 -0
- package/dist/hooks/pricing/useSUBSPrice.d.ts.map +1 -0
- package/dist/hooks/subscriptions/index.d.ts +12 -0
- package/dist/hooks/subscriptions/index.d.ts.map +1 -0
- package/dist/hooks/subscriptions/useManageSubscription.d.ts +39 -0
- package/dist/hooks/subscriptions/useManageSubscription.d.ts.map +1 -0
- package/dist/hooks/subscriptions/useMySubscriptions.d.ts +53 -0
- package/dist/hooks/subscriptions/useMySubscriptions.d.ts.map +1 -0
- package/dist/hooks/subscriptions/useSubscribe.d.ts +58 -0
- package/dist/hooks/subscriptions/useSubscribe.d.ts.map +1 -0
- package/dist/hooks/subscriptions/useSubscriptionStatus.d.ts +34 -0
- package/dist/hooks/subscriptions/useSubscriptionStatus.d.ts.map +1 -0
- package/dist/hooks/tokens/index.d.ts +6 -0
- package/dist/hooks/tokens/index.d.ts.map +1 -0
- package/dist/hooks/tokens/useTokenBalance.d.ts +36 -0
- package/dist/hooks/tokens/useTokenBalance.d.ts.map +1 -0
- package/dist/hooks/wallet/index.d.ts +6 -0
- package/dist/hooks/wallet/index.d.ts.map +1 -0
- package/dist/hooks/wallet/useWallet.d.ts +40 -0
- package/dist/hooks/wallet/useWallet.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7850 -0
- package/dist/index.js.map +1 -0
- package/dist/services/cache.service.d.ts +89 -0
- package/dist/services/cache.service.d.ts.map +1 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/token.service.d.ts +43 -0
- package/dist/services/token.service.d.ts.map +1 -0
- package/dist/services/wallet.service.d.ts +46 -0
- package/dist/services/wallet.service.d.ts.map +1 -0
- package/dist/style.css +3 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/types/component.types.d.ts +192 -0
- package/dist/types/component.types.d.ts.map +1 -0
- package/dist/types/contract.types.d.ts +81 -0
- package/dist/types/contract.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/subscription.types.d.ts +65 -0
- package/dist/types/subscription.types.d.ts.map +1 -0
- package/dist/types/wallet.types.d.ts +53 -0
- package/dist/types/wallet.types.d.ts.map +1 -0
- package/dist/utils/errorMessages.d.ts +44 -0
- package/dist/utils/errorMessages.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +60 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/formatters.d.ts +44 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +80 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/permit.utils.d.ts +52 -0
- package/dist/utils/permit.utils.d.ts.map +1 -0
- package/dist/utils/subscriptionHelpers.d.ts +67 -0
- package/dist/utils/subscriptionHelpers.d.ts.map +1 -0
- package/dist/utils/subscriptionStatus.d.ts +48 -0
- package/dist/utils/subscriptionStatus.d.ts.map +1 -0
- package/dist/utils/validators.d.ts +76 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/wallet/ExternalConnector.d.ts +32 -0
- package/dist/wallet/ExternalConnector.d.ts.map +1 -0
- package/dist/wallet/InjectedConnector.d.ts +55 -0
- package/dist/wallet/InjectedConnector.d.ts.map +1 -0
- package/dist/wallet/index.d.ts +9 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/sessionStore.d.ts +28 -0
- package/dist/wallet/sessionStore.d.ts.map +1 -0
- package/dist/wallet/types.d.ts +66 -0
- package/dist/wallet/types.d.ts.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export declare const dexUSDCABI: readonly [{
|
|
2
|
+
readonly anonymous: false;
|
|
3
|
+
readonly inputs: readonly [{
|
|
4
|
+
readonly indexed: true;
|
|
5
|
+
readonly internalType: "address";
|
|
6
|
+
readonly name: "owner";
|
|
7
|
+
readonly type: "address";
|
|
8
|
+
}, {
|
|
9
|
+
readonly indexed: true;
|
|
10
|
+
readonly internalType: "address";
|
|
11
|
+
readonly name: "spender";
|
|
12
|
+
readonly type: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly indexed: false;
|
|
15
|
+
readonly internalType: "uint256";
|
|
16
|
+
readonly name: "value";
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}];
|
|
19
|
+
readonly name: "Approval";
|
|
20
|
+
readonly type: "event";
|
|
21
|
+
}, {
|
|
22
|
+
readonly inputs: readonly [{
|
|
23
|
+
readonly internalType: "address";
|
|
24
|
+
readonly name: "owner";
|
|
25
|
+
readonly type: "address";
|
|
26
|
+
}, {
|
|
27
|
+
readonly internalType: "address";
|
|
28
|
+
readonly name: "spender";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
}];
|
|
31
|
+
readonly name: "allowance";
|
|
32
|
+
readonly outputs: readonly [{
|
|
33
|
+
readonly internalType: "uint256";
|
|
34
|
+
readonly name: "";
|
|
35
|
+
readonly type: "uint256";
|
|
36
|
+
}];
|
|
37
|
+
readonly stateMutability: "view";
|
|
38
|
+
readonly type: "function";
|
|
39
|
+
}, {
|
|
40
|
+
readonly inputs: readonly [{
|
|
41
|
+
readonly internalType: "address";
|
|
42
|
+
readonly name: "spender";
|
|
43
|
+
readonly type: "address";
|
|
44
|
+
}, {
|
|
45
|
+
readonly internalType: "uint256";
|
|
46
|
+
readonly name: "value";
|
|
47
|
+
readonly type: "uint256";
|
|
48
|
+
}];
|
|
49
|
+
readonly name: "approve";
|
|
50
|
+
readonly outputs: readonly [{
|
|
51
|
+
readonly internalType: "bool";
|
|
52
|
+
readonly name: "";
|
|
53
|
+
readonly type: "bool";
|
|
54
|
+
}];
|
|
55
|
+
readonly stateMutability: "nonpayable";
|
|
56
|
+
readonly type: "function";
|
|
57
|
+
}, {
|
|
58
|
+
readonly inputs: readonly [{
|
|
59
|
+
readonly internalType: "address";
|
|
60
|
+
readonly name: "account";
|
|
61
|
+
readonly type: "address";
|
|
62
|
+
}];
|
|
63
|
+
readonly name: "balanceOf";
|
|
64
|
+
readonly outputs: readonly [{
|
|
65
|
+
readonly internalType: "uint256";
|
|
66
|
+
readonly name: "";
|
|
67
|
+
readonly type: "uint256";
|
|
68
|
+
}];
|
|
69
|
+
readonly stateMutability: "view";
|
|
70
|
+
readonly type: "function";
|
|
71
|
+
}, {
|
|
72
|
+
readonly inputs: readonly [];
|
|
73
|
+
readonly name: "decimals";
|
|
74
|
+
readonly outputs: readonly [{
|
|
75
|
+
readonly internalType: "uint8";
|
|
76
|
+
readonly name: "";
|
|
77
|
+
readonly type: "uint8";
|
|
78
|
+
}];
|
|
79
|
+
readonly stateMutability: "view";
|
|
80
|
+
readonly type: "function";
|
|
81
|
+
}, {
|
|
82
|
+
readonly inputs: readonly [];
|
|
83
|
+
readonly name: "symbol";
|
|
84
|
+
readonly outputs: readonly [{
|
|
85
|
+
readonly internalType: "string";
|
|
86
|
+
readonly name: "";
|
|
87
|
+
readonly type: "string";
|
|
88
|
+
}];
|
|
89
|
+
readonly stateMutability: "view";
|
|
90
|
+
readonly type: "function";
|
|
91
|
+
}, {
|
|
92
|
+
readonly inputs: readonly [{
|
|
93
|
+
readonly internalType: "address";
|
|
94
|
+
readonly name: "to";
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
}, {
|
|
97
|
+
readonly internalType: "uint256";
|
|
98
|
+
readonly name: "value";
|
|
99
|
+
readonly type: "uint256";
|
|
100
|
+
}];
|
|
101
|
+
readonly name: "transfer";
|
|
102
|
+
readonly outputs: readonly [{
|
|
103
|
+
readonly internalType: "bool";
|
|
104
|
+
readonly name: "";
|
|
105
|
+
readonly type: "bool";
|
|
106
|
+
}];
|
|
107
|
+
readonly stateMutability: "nonpayable";
|
|
108
|
+
readonly type: "function";
|
|
109
|
+
}, {
|
|
110
|
+
readonly inputs: readonly [{
|
|
111
|
+
readonly internalType: "address";
|
|
112
|
+
readonly name: "from";
|
|
113
|
+
readonly type: "address";
|
|
114
|
+
}, {
|
|
115
|
+
readonly internalType: "address";
|
|
116
|
+
readonly name: "to";
|
|
117
|
+
readonly type: "address";
|
|
118
|
+
}, {
|
|
119
|
+
readonly internalType: "uint256";
|
|
120
|
+
readonly name: "value";
|
|
121
|
+
readonly type: "uint256";
|
|
122
|
+
}];
|
|
123
|
+
readonly name: "transferFrom";
|
|
124
|
+
readonly outputs: readonly [{
|
|
125
|
+
readonly internalType: "bool";
|
|
126
|
+
readonly name: "";
|
|
127
|
+
readonly type: "bool";
|
|
128
|
+
}];
|
|
129
|
+
readonly stateMutability: "nonpayable";
|
|
130
|
+
readonly type: "function";
|
|
131
|
+
}];
|
|
132
|
+
//# sourceMappingURL=dexUSDCABI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dexUSDCABI.d.ts","sourceRoot":"","sources":["../../../src/contract/abis/dexUSDCABI.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4Kb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract ABI Exports
|
|
3
|
+
* Each smart contract the SDK interacts with has its own ABI file
|
|
4
|
+
*/
|
|
5
|
+
export { subscryptsABI } from './Subscrypts';
|
|
6
|
+
export { dexUSDCABI } from './dexUSDCABI';
|
|
7
|
+
export { dexQuoterABI } from './dexQuoterABI';
|
|
8
|
+
export { dexRouterABI } from './dexRouterABI';
|
|
9
|
+
export { dexFactoryABI } from './dexFactoryABI';
|
|
10
|
+
export { dexPairABI } from './dexPairABI';
|
|
11
|
+
export { dexPositionManagerABI } from './dexPositionManagerABI';
|
|
12
|
+
export { subscryptsABI as SUBSCRYPTS_ABI } from './Subscrypts';
|
|
13
|
+
export { dexUSDCABI as ERC20_ABI } from './dexUSDCABI';
|
|
14
|
+
export { dexQuoterABI as DEX_QUOTER_ABI } from './dexQuoterABI';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contract/abis/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,aAAa,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NetworkConfig } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const CHAIN_ID = 42161;
|
|
4
|
+
export declare const CHAIN_NAME = "Arbitrum One";
|
|
5
|
+
export declare const RPC_URLS: string[];
|
|
6
|
+
export declare const DEFAULT_RPC_URL: string;
|
|
7
|
+
export declare const BLOCK_EXPLORER = "https://arbiscan.io";
|
|
8
|
+
export declare const NETWORK_CONFIG: NetworkConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Subscrypts proxy contract address
|
|
11
|
+
* UUPS Diamond Facet pattern - handles both subscriptions and SUBS token
|
|
12
|
+
*/
|
|
13
|
+
export declare const SUBSCRYPTS_ADDRESS = "0xE2E5409C4B4Be5b67C69Cc2C6507B0598D069Eac";
|
|
14
|
+
export declare const SUBS_TOKEN_ADDRESS = "0xE2E5409C4B4Be5b67C69Cc2C6507B0598D069Eac";
|
|
15
|
+
export declare const USDC_ADDRESS = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831";
|
|
16
|
+
export declare const DECIMALS: {
|
|
17
|
+
readonly SUBS: 18;
|
|
18
|
+
readonly USDC: 6;
|
|
19
|
+
readonly ETH: 18;
|
|
20
|
+
};
|
|
21
|
+
export declare const DEX_FACTORY_ADDRESS = "0x1F98431c8aD98523631AE4a59f267346ea31F984";
|
|
22
|
+
export declare const DEX_QUOTER_ADDRESS = "0x61fFE014bA17989E743c5F6cB21bF9697530B21e";
|
|
23
|
+
export declare const DEX_ROUTER_ADDRESS = "0xa51afafe0263b40edaef0df8781ea9aa03e381a3";
|
|
24
|
+
export declare const DEX_POSITION_MANAGER_ADDRESS = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88";
|
|
25
|
+
export declare const DEX_PAIR_ADDRESS = "0xa8C221C5110FA82b0B90A6bA78227C2EE8061f48";
|
|
26
|
+
export declare const UNISWAP_FEE_TIER = 3000;
|
|
27
|
+
export declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
28
|
+
export declare const DEFAULTS: {
|
|
29
|
+
readonly NETWORK: "arbitrum";
|
|
30
|
+
readonly BALANCE_REFRESH_INTERVAL: 30000;
|
|
31
|
+
readonly SUBSCRIPTION_CACHE_TIME: 30000;
|
|
32
|
+
readonly DEFAULT_CYCLE_LIMIT: 12;
|
|
33
|
+
readonly TRANSACTION_DEADLINE_SECONDS: 300;
|
|
34
|
+
readonly PERMIT_DEADLINE_SECONDS: 1800;
|
|
35
|
+
readonly SLIPPAGE_BUFFER_BPS: 50;
|
|
36
|
+
readonly UNISWAP_FEE_TIER: 3000;
|
|
37
|
+
};
|
|
38
|
+
export declare function isArbitrumNetwork(chainId: number): boolean;
|
|
39
|
+
export declare function getSubscryptsAddress(chainId: number): string;
|
|
40
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/contract/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMzC,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAC9B,eAAO,MAAM,UAAU,iBAAiB,CAAC;AAEzC,eAAO,MAAM,QAAQ,UAIpB,CAAC;AAEF,eAAO,MAAM,eAAe,QAAc,CAAC;AAC3C,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,+CAA+C,CAAC;AAG/E,eAAO,MAAM,kBAAkB,+CAAqB,CAAC;AAMrD,eAAO,MAAM,YAAY,+CAA+C,CAAC;AAMzE,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAMX,eAAO,MAAM,mBAAmB,+CAA+C,CAAC;AAChF,eAAO,MAAM,kBAAkB,+CAA+C,CAAC;AAC/E,eAAO,MAAM,kBAAkB,+CAA+C,CAAC;AAC/E,eAAO,MAAM,4BAA4B,+CAA+C,CAAC;AACzF,eAAO,MAAM,gBAAgB,+CAA+C,CAAC;AAE7E,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAMrC,eAAO,MAAM,eAAe,+CAA+C,CAAC;AAM5E,eAAO,MAAM,QAAQ;;;;;;;;;CASX,CAAC;AAMX,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAK5D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized Subscrypts Contract Exports
|
|
3
|
+
*
|
|
4
|
+
* All smart contract interaction files in one place:
|
|
5
|
+
* - config: Network config, addresses, decimals
|
|
6
|
+
* - abis: Contract ABIs (one per file)
|
|
7
|
+
* - methods: Contract method wrappers
|
|
8
|
+
*/
|
|
9
|
+
export * from './config';
|
|
10
|
+
export * from './abis';
|
|
11
|
+
export * from './methods';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
|
|
3
|
+
export declare const getContract: (runner: ethers.ContractRunner) => ethers.Contract;
|
|
4
|
+
export declare const bytes32Encode: (str: string) => string;
|
|
5
|
+
export declare const bytes32Decode: (hex: string) => string;
|
|
6
|
+
export declare const approve: (signer: ethers.Signer, spender: string, amount: bigint) => Promise<any>;
|
|
7
|
+
export declare const burn: (signer: ethers.Signer, amount: bigint) => Promise<any>;
|
|
8
|
+
export declare const burnFrom: (signer: ethers.Signer, account: string, amount: bigint) => Promise<any>;
|
|
9
|
+
export declare const transfer: (signer: ethers.Signer, to: string, amount: bigint) => Promise<any>;
|
|
10
|
+
export declare const transferFrom: (signer: ethers.Signer, from: string, to: string, amount: bigint) => Promise<any>;
|
|
11
|
+
export declare const contractFreezeAccount: (signer: ethers.Signer, account: string, freeze: boolean) => Promise<any>;
|
|
12
|
+
export declare const contractFundAddressCHG: (signer: ethers.Signer, newAddress: string) => Promise<any>;
|
|
13
|
+
export declare const contractSanctionsContractCHG: (signer: ethers.Signer, enabled: boolean, newContract: string) => Promise<any>;
|
|
14
|
+
export declare const contractServiceAccountsCHG: (signer: ethers.Signer, add: boolean, del: boolean, account: string) => Promise<any>;
|
|
15
|
+
export declare const dexGovernanceCHG: (signer: ethers.Signer, factory: string, router: string, pair: string, posMgr: string, quoter: string, usdc: string) => Promise<any>;
|
|
16
|
+
export declare const mintByAdmin: (signer: ethers.Signer, to: string, amount: bigint) => Promise<any>;
|
|
17
|
+
export declare const burnByAdmin: (signer: ethers.Signer, wallet: string, amount: bigint) => Promise<any>;
|
|
18
|
+
export declare const planGoveranceCHG: (signer: ethers.Signer, creationCost: bigint, verifCost: bigint, commission: bigint) => Promise<any>;
|
|
19
|
+
export declare const setHaltStates: (signer: ethers.Signer, noTransfer: boolean, noPlan: boolean, noSub: boolean, noPay: boolean, noUSD: boolean) => Promise<any>;
|
|
20
|
+
export declare const renounceOwnership: (signer: ethers.Signer) => Promise<any>;
|
|
21
|
+
export declare const transferOwnership: (signer: ethers.Signer, newOwner: string) => Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Change plan parameters
|
|
24
|
+
*
|
|
25
|
+
* ⚠️ **WARNING - DESTRUCTIVE OPERATION**: Changing `amount` or `frequency` will
|
|
26
|
+
* automatically disable recurring payment configuration to ALL existing subscriptions
|
|
27
|
+
* to this plan. Subscribers will need to manually re-configure the recurring payments
|
|
28
|
+
* with the new parameters.
|
|
29
|
+
*
|
|
30
|
+
* **Why This Design**: Prevents subscribers from being charged unexpected amounts
|
|
31
|
+
* without explicit consent. Protects both merchant (can change pricing) and
|
|
32
|
+
* subscriber (won't be auto-charged new amount).
|
|
33
|
+
*
|
|
34
|
+
* **Contract behavior**: facetSubscription.sol lines 352-355
|
|
35
|
+
*
|
|
36
|
+
* @param signer - Wallet signer (must be plan owner)
|
|
37
|
+
* @param planId - Plan ID to modify
|
|
38
|
+
* @param merchant - Merchant address (must match plan owner)
|
|
39
|
+
* @param amount - New subscription amount (⚠️ changing this disables all subscriptions)
|
|
40
|
+
* @param frequency - New payment frequency (⚠️ changing this disables all subscriptions)
|
|
41
|
+
* @param referralBonus - Referral reward amount
|
|
42
|
+
* @param commission - Protocol commission
|
|
43
|
+
* @param description - Plan description (bytes32)
|
|
44
|
+
* @param setAttribute - Default attributes (bytes32)
|
|
45
|
+
* @param verifExpDate - Verification expiry timestamp
|
|
46
|
+
* @param active - Plan active status
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // WARNING: This will disable isRecurring and reset remainingCycles
|
|
51
|
+
* // for ALL existing subscriptions
|
|
52
|
+
* await planChange(
|
|
53
|
+
* signer,
|
|
54
|
+
* 1n, // planId
|
|
55
|
+
* merchantAddress,
|
|
56
|
+
* parseEther('10'), // NEW amount (was 5 SUBS)
|
|
57
|
+
* 2592000n, // frequency (30 days)
|
|
58
|
+
* parseEther('1'), // referralBonus
|
|
59
|
+
* 500n, // 5% commission
|
|
60
|
+
* 'Premium Plan',
|
|
61
|
+
* '',
|
|
62
|
+
* 0n,
|
|
63
|
+
* true
|
|
64
|
+
* );
|
|
65
|
+
* // All subscribers must now re-enable recurring payments
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @see planChangeSubscriptionsBulk for non-destructive bulk updates
|
|
69
|
+
*/
|
|
70
|
+
export declare const planChange: (signer: ethers.Signer, planId: bigint, merchant: string, amount: bigint, frequency: bigint, referralBonus: bigint, commission: bigint, description: string, setAttribute: string, verifExpDate: bigint, active: boolean) => Promise<any>;
|
|
71
|
+
export declare const planChangeSubscriptionsBulk: (signer: ethers.Signer, start: bigint, end: bigint, planId: bigint, amount: bigint, frequency: bigint, attribute: string, overrideRecurring: boolean) => Promise<any>;
|
|
72
|
+
export declare const planCreate: (signer: ethers.Signer, currency: bigint, amount: bigint, frequency: bigint, description: string, setAttribute: string, referralBonus: bigint, value?: bigint) => Promise<any>;
|
|
73
|
+
export declare const paySubscriptionWithUsdc: (signer: ethers.Signer, planId: bigint, recurring: boolean, remainingCycles: bigint, referral: string, feeTier: bigint, deadline: bigint, nonce: bigint, permitDeadline: bigint, signature: string, maxUsdc: bigint) => Promise<any>;
|
|
74
|
+
export declare const subscriptionAttributeCHG: (signer: ethers.Signer, subId: bigint, newAttribute: string) => Promise<any>;
|
|
75
|
+
export declare const subscriptionCollect: (signer: ethers.Signer, start: bigint, end: bigint, maxCollect: bigint) => Promise<any>;
|
|
76
|
+
export declare const subscriptionCollectByAddress: (signer: ethers.Signer, subscriber: string, start: bigint, end: bigint, maxCollect: bigint) => Promise<any>;
|
|
77
|
+
export declare const subscriptionCollectByPlan: (signer: ethers.Signer, planId: bigint, start: bigint, end: bigint, maxCollect: bigint) => Promise<any>;
|
|
78
|
+
export declare const subscriptionCollectPassive: (signer: ethers.Signer, from: string, to: string) => Promise<any>;
|
|
79
|
+
export declare const subscriptionCollectPassiveCHG: (signer: ethers.Signer, enable: boolean, newMax: bigint) => Promise<any>;
|
|
80
|
+
export declare const subscriptionCreate: (signer: ethers.Signer, planId: bigint, subscriber: string, recurring: boolean, remainingCycles: bigint, referral: string, onlyCreate: boolean, deductFrom: string) => Promise<any>;
|
|
81
|
+
export declare const subscriptionGift: (signer: ethers.Signer, planId: bigint, subscriber: string, referral: string, giveaway: boolean, deductFrom: string, timeBonus: bigint) => Promise<any>;
|
|
82
|
+
export declare const subscriptionRecurringCHG: (signer: ethers.Signer, subId: bigint, enabled: boolean, cycles: bigint) => Promise<any>;
|
|
83
|
+
export declare const subInternalBurn: (signer: ethers.Signer, from: string, amount: bigint) => Promise<any>;
|
|
84
|
+
export declare const subInternalMint: (signer: ethers.Signer, to: string, amount: bigint) => Promise<any>;
|
|
85
|
+
export declare const subTxIncrement: (signer: ethers.Signer) => Promise<any>;
|
|
86
|
+
export declare const initialize: (signer: ethers.Signer) => Promise<any>;
|
|
87
|
+
export declare const registerFacetSelector: (signer: ethers.Signer, selector: string, facet: string) => Promise<any>;
|
|
88
|
+
export declare const unregisterFacetSelector: (signer: ethers.Signer, selector: string) => Promise<any>;
|
|
89
|
+
export declare const setFacetAdmin: (signer: ethers.Signer, module: string) => Promise<any>;
|
|
90
|
+
export declare const setFacetPaymentUsdc: (signer: ethers.Signer, module: string) => Promise<any>;
|
|
91
|
+
export declare const setFacetSubscription: (signer: ethers.Signer, module: string) => Promise<any>;
|
|
92
|
+
export declare const setFacetView: (signer: ethers.Signer, module: string) => Promise<any>;
|
|
93
|
+
export declare const setProxyLogicAddress: (signer: ethers.Signer, module: string) => Promise<any>;
|
|
94
|
+
export declare const upgradeToAndCall: (signer: ethers.Signer, newImpl: string, data: string) => Promise<any>;
|
|
95
|
+
export declare const cleanPlan: (p: any) => {
|
|
96
|
+
id: any;
|
|
97
|
+
merchantAddress: any;
|
|
98
|
+
currencyCode: any;
|
|
99
|
+
subscriptionAmount: any;
|
|
100
|
+
paymentFrequency: any;
|
|
101
|
+
referralBonus: any;
|
|
102
|
+
commission: any;
|
|
103
|
+
description: string;
|
|
104
|
+
defaultAttributes: string;
|
|
105
|
+
verificationExpiryDate: any;
|
|
106
|
+
subscriberCount: any;
|
|
107
|
+
isActive: any;
|
|
108
|
+
};
|
|
109
|
+
export declare const cleanSub: (s: any) => {
|
|
110
|
+
id: any;
|
|
111
|
+
merchantAddress: any;
|
|
112
|
+
planId: any;
|
|
113
|
+
subscriberAddress: any;
|
|
114
|
+
currencyCode: any;
|
|
115
|
+
subscriptionAmount: any;
|
|
116
|
+
paymentFrequency: any;
|
|
117
|
+
isRecurring: any;
|
|
118
|
+
remainingCycles: any;
|
|
119
|
+
customAttributes: string;
|
|
120
|
+
lastPaymentDate: any;
|
|
121
|
+
nextPaymentDate: any;
|
|
122
|
+
};
|
|
123
|
+
export declare const planAutoIncrement: (runner: ethers.ContractRunner) => Promise<any>;
|
|
124
|
+
export declare const subscriptionAutoIncrement: (runner: ethers.ContractRunner) => Promise<any>;
|
|
125
|
+
export declare const allowance: (runner: ethers.ContractRunner, owner: string, spender: string) => Promise<any>;
|
|
126
|
+
export declare const balanceOf: (runner: ethers.ContractRunner, account: string) => Promise<any>;
|
|
127
|
+
export declare const contractAddress: (runner: ethers.ContractRunner) => Promise<any>;
|
|
128
|
+
export declare const contractFundAddress: (runner: ethers.ContractRunner) => Promise<any>;
|
|
129
|
+
export declare const contractHaltCurrencyUSD: (runner: ethers.ContractRunner) => Promise<any>;
|
|
130
|
+
export declare const contractHaltNonServiceTransfers: (runner: ethers.ContractRunner) => Promise<any>;
|
|
131
|
+
export declare const contractHaltPlanCreation: (runner: ethers.ContractRunner) => Promise<any>;
|
|
132
|
+
export declare const contractHaltSubcriptions: (runner: ethers.ContractRunner) => Promise<any>;
|
|
133
|
+
export declare const contractHaltSubscriptionPayments: (runner: ethers.ContractRunner) => Promise<any>;
|
|
134
|
+
export declare const convertOtherCurrencyToToken: (runner: ethers.ContractRunner, amount: bigint) => Promise<any>;
|
|
135
|
+
export declare const convertTokenToOtherCurrency: (runner: ethers.ContractRunner, amount: bigint) => Promise<any>;
|
|
136
|
+
export declare const decimals: (runner: ethers.ContractRunner) => Promise<any>;
|
|
137
|
+
export declare const dexFactory: (runner: ethers.ContractRunner) => Promise<any>;
|
|
138
|
+
export declare const dexPair: (runner: ethers.ContractRunner) => Promise<any>;
|
|
139
|
+
export declare const dexPositionManager: (runner: ethers.ContractRunner) => Promise<any>;
|
|
140
|
+
export declare const dexQuoter: (runner: ethers.ContractRunner) => Promise<any>;
|
|
141
|
+
export declare const dexRouter: (runner: ethers.ContractRunner) => Promise<any>;
|
|
142
|
+
export declare const dexUSDC: (runner: ethers.ContractRunner) => Promise<any>;
|
|
143
|
+
export declare const getContractDetails: (runner: ethers.ContractRunner) => Promise<any>;
|
|
144
|
+
export declare const getContractHaltStates: (runner: ethers.ContractRunner) => Promise<any>;
|
|
145
|
+
export declare const getPlan: (runner: ethers.ContractRunner, planId: bigint) => Promise<{
|
|
146
|
+
id: any;
|
|
147
|
+
merchantAddress: any;
|
|
148
|
+
currencyCode: any;
|
|
149
|
+
subscriptionAmount: any;
|
|
150
|
+
paymentFrequency: any;
|
|
151
|
+
referralBonus: any;
|
|
152
|
+
commission: any;
|
|
153
|
+
description: string;
|
|
154
|
+
defaultAttributes: string;
|
|
155
|
+
verificationExpiryDate: any;
|
|
156
|
+
subscriberCount: any;
|
|
157
|
+
isActive: any;
|
|
158
|
+
}>;
|
|
159
|
+
export declare const getPlans: (runner: ethers.ContractRunner, start: bigint, end: bigint) => Promise<any[]>;
|
|
160
|
+
export declare const getPlanSubscription: (runner: ethers.ContractRunner, planId: bigint, subscriber: string) => Promise<{
|
|
161
|
+
id: any;
|
|
162
|
+
merchantAddress: any;
|
|
163
|
+
planId: any;
|
|
164
|
+
subscriberAddress: any;
|
|
165
|
+
currencyCode: any;
|
|
166
|
+
subscriptionAmount: any;
|
|
167
|
+
paymentFrequency: any;
|
|
168
|
+
isRecurring: any;
|
|
169
|
+
remainingCycles: any;
|
|
170
|
+
customAttributes: string;
|
|
171
|
+
lastPaymentDate: any;
|
|
172
|
+
nextPaymentDate: any;
|
|
173
|
+
}>;
|
|
174
|
+
export declare const getSubscription: (runner: ethers.ContractRunner, subId: bigint) => Promise<{
|
|
175
|
+
id: any;
|
|
176
|
+
merchantAddress: any;
|
|
177
|
+
planId: any;
|
|
178
|
+
subscriberAddress: any;
|
|
179
|
+
currencyCode: any;
|
|
180
|
+
subscriptionAmount: any;
|
|
181
|
+
paymentFrequency: any;
|
|
182
|
+
isRecurring: any;
|
|
183
|
+
remainingCycles: any;
|
|
184
|
+
customAttributes: string;
|
|
185
|
+
lastPaymentDate: any;
|
|
186
|
+
nextPaymentDate: any;
|
|
187
|
+
}>;
|
|
188
|
+
export declare const getSubscriptionAndPlanDetails: (runner: ethers.ContractRunner) => Promise<any>;
|
|
189
|
+
export declare const getSubscriptions: (runner: ethers.ContractRunner, start: bigint, end: bigint) => Promise<any[]>;
|
|
190
|
+
export declare const getSubscriptionsByAddress: (runner: ethers.ContractRunner, subscriber: string, start: bigint, end: bigint) => Promise<any[]>;
|
|
191
|
+
export declare const getSubscriptionsByPlan: (runner: ethers.ContractRunner, planId: bigint, start: bigint, end: bigint) => Promise<any[]>;
|
|
192
|
+
export declare const name: (runner: ethers.ContractRunner) => Promise<any>;
|
|
193
|
+
export declare const owner: (runner: ethers.ContractRunner) => Promise<any>;
|
|
194
|
+
export declare const planCreationCost: (runner: ethers.ContractRunner) => Promise<any>;
|
|
195
|
+
export declare const planDefaultCommission: (runner: ethers.ContractRunner) => Promise<any>;
|
|
196
|
+
export declare const sanctionsCheckEnabled: (runner: ethers.ContractRunner) => Promise<any>;
|
|
197
|
+
export declare const sanctionsContract: (runner: ethers.ContractRunner) => Promise<any>;
|
|
198
|
+
export declare const subCheckSanctions: (runner: ethers.ContractRunner, from: string, to: string) => Promise<any>;
|
|
199
|
+
export declare const subscriptionCollectPassiveEnabled: (runner: ethers.ContractRunner) => Promise<any>;
|
|
200
|
+
export declare const subscriptionCollectPassiveIndex: (runner: ethers.ContractRunner) => Promise<any>;
|
|
201
|
+
export declare const subscriptionCollectPassiveMax: (runner: ethers.ContractRunner) => Promise<any>;
|
|
202
|
+
export declare const symbol: (runner: ethers.ContractRunner) => Promise<any>;
|
|
203
|
+
export declare const tokenHolders: (runner: ethers.ContractRunner) => Promise<any>;
|
|
204
|
+
export declare const tokenTransactions: (runner: ethers.ContractRunner) => Promise<any>;
|
|
205
|
+
export declare const totalSubscriptionsActive: (runner: ethers.ContractRunner) => Promise<any>;
|
|
206
|
+
export declare const totalSupply: (runner: ethers.ContractRunner) => Promise<any>;
|
|
207
|
+
export declare const UPGRADE_INTERFACE_VERSION: (runner: ethers.ContractRunner) => Promise<any>;
|
|
208
|
+
export declare const facetAdmin: (runner: ethers.ContractRunner) => Promise<any>;
|
|
209
|
+
export declare const facetSubscription: (runner: ethers.ContractRunner) => Promise<any>;
|
|
210
|
+
export declare const facetView: (runner: ethers.ContractRunner) => Promise<any>;
|
|
211
|
+
export declare const proxyLogic: (runner: ethers.ContractRunner) => Promise<any>;
|
|
212
|
+
export declare const facetPaymentUsdc: (runner: ethers.ContractRunner) => Promise<any>;
|
|
213
|
+
export declare const getFacetSelector: (runner: ethers.ContractRunner, selector: string) => Promise<any>;
|
|
214
|
+
export declare const listFacetSelectors: (runner: ethers.ContractRunner) => Promise<any>;
|
|
215
|
+
export declare const registeredSelectors: (runner: ethers.ContractRunner, index: bigint) => Promise<any>;
|
|
216
|
+
export declare const planVerificationCost: (runner: ethers.ContractRunner) => Promise<any>;
|
|
217
|
+
export declare const proxiableUUID: (runner: ethers.ContractRunner) => Promise<any>;
|
|
218
|
+
export declare const quoteUsdcForSubs: (runner: ethers.ContractRunner, subsOut: bigint, feeTier: bigint) => Promise<any>;
|
|
219
|
+
/**
|
|
220
|
+
* Create a subscription with SUBS tokens (with verification)
|
|
221
|
+
*
|
|
222
|
+
* This is a high-level wrapper that:
|
|
223
|
+
* - Captures state before transaction
|
|
224
|
+
* - Executes the transaction
|
|
225
|
+
* - Parses events to extract subscriptionId
|
|
226
|
+
* - Falls back to state verification if event parsing fails
|
|
227
|
+
*
|
|
228
|
+
* @param signer - Ethers signer
|
|
229
|
+
* @param params - Subscription creation parameters
|
|
230
|
+
* @returns subscriptionId and alreadyExist flag
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* const result = await createSubscriptionVerified(signer, {
|
|
235
|
+
* planId: 1n,
|
|
236
|
+
* subscriber: '0x...',
|
|
237
|
+
* recurring: true,
|
|
238
|
+
* remainingCycles: 12n,
|
|
239
|
+
* referral: ethers.ZeroAddress,
|
|
240
|
+
* onlyCreate: false,
|
|
241
|
+
* deductFrom: '0x...'
|
|
242
|
+
* });
|
|
243
|
+
* console.log('Subscription ID:', result.subscriptionId);
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
export declare const createSubscriptionVerified: (signer: ethers.Signer, params: {
|
|
247
|
+
planId: bigint;
|
|
248
|
+
subscriber: string;
|
|
249
|
+
recurring: boolean;
|
|
250
|
+
remainingCycles: bigint;
|
|
251
|
+
referral: string;
|
|
252
|
+
onlyCreate: boolean;
|
|
253
|
+
deductFrom: string;
|
|
254
|
+
}) => Promise<{
|
|
255
|
+
subscriptionId: bigint;
|
|
256
|
+
alreadyExist: boolean;
|
|
257
|
+
}>;
|
|
258
|
+
/**
|
|
259
|
+
* Create a subscription with USDC (with verification)
|
|
260
|
+
*
|
|
261
|
+
* This is a high-level wrapper that:
|
|
262
|
+
* - Captures state before transaction
|
|
263
|
+
* - Executes the USDC payment transaction
|
|
264
|
+
* - Parses events to extract subscriptionId and payment data
|
|
265
|
+
* - Falls back to state verification if event parsing fails
|
|
266
|
+
*
|
|
267
|
+
* @param signer - Ethers signer
|
|
268
|
+
* @param params - USDC payment parameters
|
|
269
|
+
* @param subscriber - Subscriber address (for verification)
|
|
270
|
+
* @returns subscriptionId, existence flag, and payment amounts
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```typescript
|
|
274
|
+
* const result = await paySubscriptionWithUsdcVerified(signer, {
|
|
275
|
+
* planId: 1n,
|
|
276
|
+
* recurring: true,
|
|
277
|
+
* remainingCycles: 12n,
|
|
278
|
+
* referral: ethers.ZeroAddress,
|
|
279
|
+
* feeTier: 3000n,
|
|
280
|
+
* deadline: BigInt(Date.now() / 1000 + 1800),
|
|
281
|
+
* nonce: 0n,
|
|
282
|
+
* permitDeadline: BigInt(Date.now() / 1000 + 1800),
|
|
283
|
+
* signature: '0x...',
|
|
284
|
+
* maxUsdcIn6Cap: 10000000n
|
|
285
|
+
* }, '0xSubscriber...');
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
export declare const paySubscriptionWithUsdcVerified: (signer: ethers.Signer, params: {
|
|
289
|
+
planId: bigint;
|
|
290
|
+
recurring: boolean;
|
|
291
|
+
remainingCycles: bigint;
|
|
292
|
+
referral: string;
|
|
293
|
+
feeTier: bigint;
|
|
294
|
+
deadline: bigint;
|
|
295
|
+
nonce: bigint;
|
|
296
|
+
permitDeadline: bigint;
|
|
297
|
+
signature: string;
|
|
298
|
+
maxUsdcIn6Cap: bigint;
|
|
299
|
+
}, subscriber: string) => Promise<{
|
|
300
|
+
subId: bigint;
|
|
301
|
+
subExist: boolean;
|
|
302
|
+
subsPaid18: bigint;
|
|
303
|
+
usdcSpent6: bigint;
|
|
304
|
+
}>;
|
|
305
|
+
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/contract/methods.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,CAAC,cAAc,oBAExD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAQ3C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAM3C,CAAC;AAMF,eAAO,MAAM,OAAO,GAAU,QAAQ,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,QAAQ,MAAM,iBAGnF,CAAC;AAEF,eAAO,MAAM,IAAI,GAAU,QAAQ,MAAM,CAAC,MAAM,EAAE,QAAQ,MAAM,iBAG/D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,QAAQ,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,QAAQ,MAAM,iBAGpF,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,QAAQ,MAAM,CAAC,MAAM,EAAE,IAAI,MAAM,EAAE,QAAQ,MAAM,iBAG/E,CAAC;AAEF,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DA,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,+BAA+B,GAC1C,QAAQ,MAAM,CAAC,MAAM,EACrB,QAAQ;IACN,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,EACD,YAAY,MAAM,KACjB,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CA8DA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/events/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSubscryptsEvents Hook
|
|
3
|
+
*
|
|
4
|
+
* Subscribe to real-time Subscrypts protocol events.
|
|
5
|
+
* Uses ethers.js contract.on() under the hood with automatic cleanup.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Event callback types
|
|
9
|
+
*/
|
|
10
|
+
export interface SubscryptsEventCallbacks {
|
|
11
|
+
/** Called when a new subscription is created */
|
|
12
|
+
onSubscriptionCreated?: (event: {
|
|
13
|
+
subscriptionId: bigint;
|
|
14
|
+
planId: bigint;
|
|
15
|
+
subscriber: string;
|
|
16
|
+
referral: string;
|
|
17
|
+
}) => void;
|
|
18
|
+
/** Called when a subscription payment is made */
|
|
19
|
+
onSubscriptionPaid?: (event: {
|
|
20
|
+
subscriptionId: bigint;
|
|
21
|
+
payer: string;
|
|
22
|
+
amount: bigint;
|
|
23
|
+
}) => void;
|
|
24
|
+
/** Called when a subscription is stopped/cancelled */
|
|
25
|
+
onSubscriptionStopped?: (event: {
|
|
26
|
+
subscriptionId: bigint;
|
|
27
|
+
subscriber: string;
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
}) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Hook return type
|
|
33
|
+
*/
|
|
34
|
+
export interface UseSubscryptsEventsReturn {
|
|
35
|
+
/** Whether event listeners are active */
|
|
36
|
+
isListening: boolean;
|
|
37
|
+
/** Error if any */
|
|
38
|
+
error: Error | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Subscribe to real-time Subscrypts protocol events.
|
|
42
|
+
* Automatically cleans up listeners on unmount.
|
|
43
|
+
*
|
|
44
|
+
* @param callbacks - Event handlers
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* const { isListening } = useSubscryptsEvents({
|
|
49
|
+
* onSubscriptionCreated: (event) => {
|
|
50
|
+
* console.log('New subscription:', event.subscriptionId);
|
|
51
|
+
* refetchDashboard();
|
|
52
|
+
* },
|
|
53
|
+
* onSubscriptionPaid: (event) => {
|
|
54
|
+
* console.log('Payment made:', event.amount);
|
|
55
|
+
* },
|
|
56
|
+
* onSubscriptionStopped: (event) => {
|
|
57
|
+
* console.log('Subscription stopped:', event.subscriptionId);
|
|
58
|
+
* }
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function useSubscryptsEvents(callbacks: SubscryptsEventCallbacks): UseSubscryptsEventsReturn;
|
|
63
|
+
//# sourceMappingURL=useSubscryptsEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSubscryptsEvents.d.ts","sourceRoot":"","sources":["../../../src/hooks/events/useSubscryptsEvents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,gDAAgD;IAChD,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC9B,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;IAEX,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,KAAK,IAAI,CAAC;IAEX,sDAAsD;IACtD,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC9B,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,wBAAwB,GAClC,yBAAyB,CAgG3B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks API for @subscrypts/subscrypts-sdk-react
|
|
3
|
+
*/
|
|
4
|
+
export { useSubscrypts } from '../context/SubscryptsContext';
|
|
5
|
+
export * from './subscriptions';
|
|
6
|
+
export * from './tokens';
|
|
7
|
+
export * from './wallet';
|
|
8
|
+
export * from './plans';
|
|
9
|
+
export * from './pricing';
|
|
10
|
+
export * from './events';
|
|
11
|
+
export * from './merchant';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,cAAc,iBAAiB,CAAC;AAGhC,cAAc,UAAU,CAAC;AAGzB,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAG1B,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merchant hooks barrel export
|
|
3
|
+
*/
|
|
4
|
+
export { useMerchantPlans } from './useMerchantPlans';
|
|
5
|
+
export type { UseMerchantPlansReturn } from './useMerchantPlans';
|
|
6
|
+
export { useMerchantSubscribers } from './useMerchantSubscribers';
|
|
7
|
+
export type { UseMerchantSubscribersReturn } from './useMerchantSubscribers';
|
|
8
|
+
export { useMerchantRevenue } from './useMerchantRevenue';
|
|
9
|
+
export type { MerchantRevenueData, UseMerchantRevenueReturn } from './useMerchantRevenue';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/merchant/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC"}
|