pepay-streams-sdk 0.1.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/README.md +405 -0
- package/dist/api/index.d.mts +321 -0
- package/dist/api/index.d.ts +321 -0
- package/dist/api/index.js +312 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.mjs +306 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/automation/index.d.mts +140 -0
- package/dist/automation/index.d.ts +140 -0
- package/dist/automation/index.js +331 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/index.mjs +326 -0
- package/dist/automation/index.mjs.map +1 -0
- package/dist/campaigns/index.d.mts +286 -0
- package/dist/campaigns/index.d.ts +286 -0
- package/dist/campaigns/index.js +652 -0
- package/dist/campaigns/index.js.map +1 -0
- package/dist/campaigns/index.mjs +645 -0
- package/dist/campaigns/index.mjs.map +1 -0
- package/dist/claims/index.d.mts +190 -0
- package/dist/claims/index.d.ts +190 -0
- package/dist/claims/index.js +414 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/index.mjs +409 -0
- package/dist/claims/index.mjs.map +1 -0
- package/dist/index-BTG0TRJt.d.mts +555 -0
- package/dist/index-BTG0TRJt.d.ts +555 -0
- package/dist/index.d.mts +170 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +2926 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2888 -0
- package/dist/index.mjs.map +1 -0
- package/dist/marketplace/index.d.mts +225 -0
- package/dist/marketplace/index.d.ts +225 -0
- package/dist/marketplace/index.js +529 -0
- package/dist/marketplace/index.js.map +1 -0
- package/dist/marketplace/index.mjs +524 -0
- package/dist/marketplace/index.mjs.map +1 -0
- package/dist/react/index.d.mts +185 -0
- package/dist/react/index.d.ts +185 -0
- package/dist/react/index.js +340 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +333 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/staking/index.d.mts +158 -0
- package/dist/staking/index.d.ts +158 -0
- package/dist/staking/index.js +359 -0
- package/dist/staking/index.js.map +1 -0
- package/dist/staking/index.mjs +354 -0
- package/dist/staking/index.mjs.map +1 -0
- package/package.json +106 -0
- package/src/api/index.ts +577 -0
- package/src/automation/index.ts +436 -0
- package/src/campaigns/index.ts +835 -0
- package/src/claims/index.ts +530 -0
- package/src/client.ts +518 -0
- package/src/index.ts +101 -0
- package/src/marketplace/index.ts +730 -0
- package/src/react/index.ts +498 -0
- package/src/staking/index.ts +449 -0
- package/src/types/index.ts +631 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
export { Address, Hash, Hex } from 'viem';
|
|
3
|
+
import { P as PepayStreamsConfig, T as TransactionResult } from './index-BTG0TRJt.mjs';
|
|
4
|
+
export { j as ApiCampaign, k as ApiOrder, l as ApiStakingPool, A as AutomationStatus, p as BaseCampaignParams, B as BatchClaimParams, C as CampaignInfo, b as ClaimParams, t as ClaimResult, d as CreateInstantOrderParams, q as CreatePoolParams, f as CreateTradableOrderParams, e as CreateVestedOrderParams, h as EnableAutoReleaseParams, E as EnableAutoWithdrawParams, I as InstantAirdropParams, L as LockParams, s as MerkleClaimParams, M as MetaClaimParams, O as OrderInfo, g as OrderQuote, r as OrderType, i as PaginatedResponse, c as PoolInfo, n as Recipient, R as RecipientStatus, o as RecipientWithCliff, m as TransactionReceipt, U as UserStake, V as VestedAirdropParams, a as VestingParams } from './index-BTG0TRJt.mjs';
|
|
5
|
+
import CampaignsModule from './campaigns/index.mjs';
|
|
6
|
+
import ClaimsModule from './claims/index.mjs';
|
|
7
|
+
import StakingModule from './staking/index.mjs';
|
|
8
|
+
import MarketplaceModule from './marketplace/index.mjs';
|
|
9
|
+
import AutomationModule from './automation/index.mjs';
|
|
10
|
+
import ApiClient from './api/index.mjs';
|
|
11
|
+
export { ApiError } from './api/index.mjs';
|
|
12
|
+
export { CampaignKind, ChangePolicy, DeliveryKind, OrderStatus, StartMode, StatusBits, Visibility } from '@pepay-streams/shared';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Main Pepay Streams SDK Client
|
|
16
|
+
*
|
|
17
|
+
* Unified interface for all Pepay Streams operations:
|
|
18
|
+
* - Campaign creation and management
|
|
19
|
+
* - Token claiming
|
|
20
|
+
* - Staking pools
|
|
21
|
+
* - P2P marketplace
|
|
22
|
+
* - Automation
|
|
23
|
+
* - API queries
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
declare global {
|
|
27
|
+
interface Window {
|
|
28
|
+
ethereum?: {
|
|
29
|
+
request: (args: {
|
|
30
|
+
method: string;
|
|
31
|
+
}) => Promise<Address[]>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Pepay Streams SDK Client
|
|
38
|
+
*
|
|
39
|
+
* The main entry point for interacting with Pepay Streams protocol.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* import { PepayStreamsClient } from '@pepay-streams/sdk';
|
|
44
|
+
*
|
|
45
|
+
* // Read-only client
|
|
46
|
+
* const client = new PepayStreamsClient({
|
|
47
|
+
* rpcUrl: 'https://eth.llamarpc.com',
|
|
48
|
+
* diamondAddress: '0x...',
|
|
49
|
+
* chainId: 1,
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // Client with signer (for transactions)
|
|
53
|
+
* const clientWithSigner = new PepayStreamsClient({
|
|
54
|
+
* rpcUrl: 'https://eth.llamarpc.com',
|
|
55
|
+
* diamondAddress: '0x...',
|
|
56
|
+
* chainId: 1,
|
|
57
|
+
* }).withSigner(walletClient);
|
|
58
|
+
*
|
|
59
|
+
* // Or use browser wallet
|
|
60
|
+
* const browserClient = PepayStreamsClient.fromBrowserWallet({
|
|
61
|
+
* diamondAddress: '0x...',
|
|
62
|
+
* chainId: 1,
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare class PepayStreamsClient {
|
|
67
|
+
readonly publicClient: PublicClient;
|
|
68
|
+
readonly walletClient: WalletClient | undefined;
|
|
69
|
+
readonly diamondAddress: Address;
|
|
70
|
+
readonly chainId: number;
|
|
71
|
+
readonly wethAddress: Address;
|
|
72
|
+
readonly permit2Address: Address;
|
|
73
|
+
readonly campaigns: CampaignsModule;
|
|
74
|
+
readonly claims: ClaimsModule;
|
|
75
|
+
readonly staking: StakingModule;
|
|
76
|
+
readonly marketplace: MarketplaceModule;
|
|
77
|
+
readonly automation: AutomationModule;
|
|
78
|
+
readonly api: ApiClient | undefined;
|
|
79
|
+
constructor(config: PepayStreamsConfig);
|
|
80
|
+
/**
|
|
81
|
+
* Create a client with a wallet for signing transactions
|
|
82
|
+
*/
|
|
83
|
+
withSigner(walletClient: WalletClient): PepayStreamsClientWithSigner;
|
|
84
|
+
/**
|
|
85
|
+
* Create a client from browser wallet (window.ethereum)
|
|
86
|
+
*/
|
|
87
|
+
static fromBrowserWallet(config: {
|
|
88
|
+
diamondAddress: Address;
|
|
89
|
+
chainId: number;
|
|
90
|
+
apiBaseUrl?: string;
|
|
91
|
+
}): Promise<PepayStreamsClientWithSigner>;
|
|
92
|
+
/**
|
|
93
|
+
* Create a client with private key (for Node.js/scripts)
|
|
94
|
+
*/
|
|
95
|
+
static fromPrivateKey(config: PepayStreamsConfig & {
|
|
96
|
+
privateKey: `0x${string}`;
|
|
97
|
+
}): PepayStreamsClientWithSigner;
|
|
98
|
+
/**
|
|
99
|
+
* Get token balance
|
|
100
|
+
*/
|
|
101
|
+
getTokenBalance(token: Address, account: Address): Promise<bigint>;
|
|
102
|
+
/**
|
|
103
|
+
* Get token allowance for Diamond contract
|
|
104
|
+
*/
|
|
105
|
+
getTokenAllowance(token: Address, owner: Address): Promise<bigint>;
|
|
106
|
+
/**
|
|
107
|
+
* Get token info (symbol, decimals, name)
|
|
108
|
+
*/
|
|
109
|
+
getTokenInfo(token: Address): Promise<{
|
|
110
|
+
symbol: string;
|
|
111
|
+
decimals: number;
|
|
112
|
+
name: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Get version of a specific facet
|
|
116
|
+
*
|
|
117
|
+
* @param facetAddress - The address of the facet to query
|
|
118
|
+
*/
|
|
119
|
+
getFacetVersion(facetAddress: Address): Promise<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Get all facet versions
|
|
122
|
+
*/
|
|
123
|
+
getAllVersions(): Promise<{
|
|
124
|
+
facets: Address[];
|
|
125
|
+
versions: string[];
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Check if Diamond contract is in emergency pause
|
|
129
|
+
*/
|
|
130
|
+
isEmergencyPaused(): Promise<boolean>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Client with signer for write operations
|
|
134
|
+
*/
|
|
135
|
+
declare class PepayStreamsClientWithSigner extends PepayStreamsClient {
|
|
136
|
+
readonly walletClient: WalletClient;
|
|
137
|
+
readonly campaigns: CampaignsModule;
|
|
138
|
+
readonly claims: ClaimsModule;
|
|
139
|
+
readonly staking: StakingModule;
|
|
140
|
+
readonly marketplace: MarketplaceModule;
|
|
141
|
+
readonly automation: AutomationModule;
|
|
142
|
+
constructor(publicClient: PublicClient, walletClient: WalletClient, diamondAddress: Address, chainId: number, wethAddress: Address, permit2Address: Address, apiClient?: ApiClient);
|
|
143
|
+
/**
|
|
144
|
+
* Get the connected wallet address
|
|
145
|
+
*/
|
|
146
|
+
get address(): Address;
|
|
147
|
+
/**
|
|
148
|
+
* Approve tokens for the Diamond contract
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* await client.approve(tokenAddress, parseEther('1000'));
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
approve(token: Address, amount: bigint): Promise<TransactionResult>;
|
|
156
|
+
/**
|
|
157
|
+
* Approve max tokens (type(uint256).max)
|
|
158
|
+
*/
|
|
159
|
+
approveMax(token: Address): Promise<TransactionResult>;
|
|
160
|
+
/**
|
|
161
|
+
* Check and approve if needed
|
|
162
|
+
*/
|
|
163
|
+
ensureAllowance(token: Address, requiredAmount: bigint): Promise<TransactionResult | null>;
|
|
164
|
+
/**
|
|
165
|
+
* Get native balance (ETH/BNB)
|
|
166
|
+
*/
|
|
167
|
+
getNativeBalance(): Promise<bigint>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export { ApiClient, AutomationModule, CampaignsModule, ClaimsModule, MarketplaceModule, PepayStreamsClient, PepayStreamsClientWithSigner, PepayStreamsConfig, StakingModule, TransactionResult };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
export { Address, Hash, Hex } from 'viem';
|
|
3
|
+
import { P as PepayStreamsConfig, T as TransactionResult } from './index-BTG0TRJt.js';
|
|
4
|
+
export { j as ApiCampaign, k as ApiOrder, l as ApiStakingPool, A as AutomationStatus, p as BaseCampaignParams, B as BatchClaimParams, C as CampaignInfo, b as ClaimParams, t as ClaimResult, d as CreateInstantOrderParams, q as CreatePoolParams, f as CreateTradableOrderParams, e as CreateVestedOrderParams, h as EnableAutoReleaseParams, E as EnableAutoWithdrawParams, I as InstantAirdropParams, L as LockParams, s as MerkleClaimParams, M as MetaClaimParams, O as OrderInfo, g as OrderQuote, r as OrderType, i as PaginatedResponse, c as PoolInfo, n as Recipient, R as RecipientStatus, o as RecipientWithCliff, m as TransactionReceipt, U as UserStake, V as VestedAirdropParams, a as VestingParams } from './index-BTG0TRJt.js';
|
|
5
|
+
import CampaignsModule from './campaigns/index.js';
|
|
6
|
+
import ClaimsModule from './claims/index.js';
|
|
7
|
+
import StakingModule from './staking/index.js';
|
|
8
|
+
import MarketplaceModule from './marketplace/index.js';
|
|
9
|
+
import AutomationModule from './automation/index.js';
|
|
10
|
+
import ApiClient from './api/index.js';
|
|
11
|
+
export { ApiError } from './api/index.js';
|
|
12
|
+
export { CampaignKind, ChangePolicy, DeliveryKind, OrderStatus, StartMode, StatusBits, Visibility } from '@pepay-streams/shared';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Main Pepay Streams SDK Client
|
|
16
|
+
*
|
|
17
|
+
* Unified interface for all Pepay Streams operations:
|
|
18
|
+
* - Campaign creation and management
|
|
19
|
+
* - Token claiming
|
|
20
|
+
* - Staking pools
|
|
21
|
+
* - P2P marketplace
|
|
22
|
+
* - Automation
|
|
23
|
+
* - API queries
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
declare global {
|
|
27
|
+
interface Window {
|
|
28
|
+
ethereum?: {
|
|
29
|
+
request: (args: {
|
|
30
|
+
method: string;
|
|
31
|
+
}) => Promise<Address[]>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Pepay Streams SDK Client
|
|
38
|
+
*
|
|
39
|
+
* The main entry point for interacting with Pepay Streams protocol.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* import { PepayStreamsClient } from '@pepay-streams/sdk';
|
|
44
|
+
*
|
|
45
|
+
* // Read-only client
|
|
46
|
+
* const client = new PepayStreamsClient({
|
|
47
|
+
* rpcUrl: 'https://eth.llamarpc.com',
|
|
48
|
+
* diamondAddress: '0x...',
|
|
49
|
+
* chainId: 1,
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // Client with signer (for transactions)
|
|
53
|
+
* const clientWithSigner = new PepayStreamsClient({
|
|
54
|
+
* rpcUrl: 'https://eth.llamarpc.com',
|
|
55
|
+
* diamondAddress: '0x...',
|
|
56
|
+
* chainId: 1,
|
|
57
|
+
* }).withSigner(walletClient);
|
|
58
|
+
*
|
|
59
|
+
* // Or use browser wallet
|
|
60
|
+
* const browserClient = PepayStreamsClient.fromBrowserWallet({
|
|
61
|
+
* diamondAddress: '0x...',
|
|
62
|
+
* chainId: 1,
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare class PepayStreamsClient {
|
|
67
|
+
readonly publicClient: PublicClient;
|
|
68
|
+
readonly walletClient: WalletClient | undefined;
|
|
69
|
+
readonly diamondAddress: Address;
|
|
70
|
+
readonly chainId: number;
|
|
71
|
+
readonly wethAddress: Address;
|
|
72
|
+
readonly permit2Address: Address;
|
|
73
|
+
readonly campaigns: CampaignsModule;
|
|
74
|
+
readonly claims: ClaimsModule;
|
|
75
|
+
readonly staking: StakingModule;
|
|
76
|
+
readonly marketplace: MarketplaceModule;
|
|
77
|
+
readonly automation: AutomationModule;
|
|
78
|
+
readonly api: ApiClient | undefined;
|
|
79
|
+
constructor(config: PepayStreamsConfig);
|
|
80
|
+
/**
|
|
81
|
+
* Create a client with a wallet for signing transactions
|
|
82
|
+
*/
|
|
83
|
+
withSigner(walletClient: WalletClient): PepayStreamsClientWithSigner;
|
|
84
|
+
/**
|
|
85
|
+
* Create a client from browser wallet (window.ethereum)
|
|
86
|
+
*/
|
|
87
|
+
static fromBrowserWallet(config: {
|
|
88
|
+
diamondAddress: Address;
|
|
89
|
+
chainId: number;
|
|
90
|
+
apiBaseUrl?: string;
|
|
91
|
+
}): Promise<PepayStreamsClientWithSigner>;
|
|
92
|
+
/**
|
|
93
|
+
* Create a client with private key (for Node.js/scripts)
|
|
94
|
+
*/
|
|
95
|
+
static fromPrivateKey(config: PepayStreamsConfig & {
|
|
96
|
+
privateKey: `0x${string}`;
|
|
97
|
+
}): PepayStreamsClientWithSigner;
|
|
98
|
+
/**
|
|
99
|
+
* Get token balance
|
|
100
|
+
*/
|
|
101
|
+
getTokenBalance(token: Address, account: Address): Promise<bigint>;
|
|
102
|
+
/**
|
|
103
|
+
* Get token allowance for Diamond contract
|
|
104
|
+
*/
|
|
105
|
+
getTokenAllowance(token: Address, owner: Address): Promise<bigint>;
|
|
106
|
+
/**
|
|
107
|
+
* Get token info (symbol, decimals, name)
|
|
108
|
+
*/
|
|
109
|
+
getTokenInfo(token: Address): Promise<{
|
|
110
|
+
symbol: string;
|
|
111
|
+
decimals: number;
|
|
112
|
+
name: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Get version of a specific facet
|
|
116
|
+
*
|
|
117
|
+
* @param facetAddress - The address of the facet to query
|
|
118
|
+
*/
|
|
119
|
+
getFacetVersion(facetAddress: Address): Promise<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Get all facet versions
|
|
122
|
+
*/
|
|
123
|
+
getAllVersions(): Promise<{
|
|
124
|
+
facets: Address[];
|
|
125
|
+
versions: string[];
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Check if Diamond contract is in emergency pause
|
|
129
|
+
*/
|
|
130
|
+
isEmergencyPaused(): Promise<boolean>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Client with signer for write operations
|
|
134
|
+
*/
|
|
135
|
+
declare class PepayStreamsClientWithSigner extends PepayStreamsClient {
|
|
136
|
+
readonly walletClient: WalletClient;
|
|
137
|
+
readonly campaigns: CampaignsModule;
|
|
138
|
+
readonly claims: ClaimsModule;
|
|
139
|
+
readonly staking: StakingModule;
|
|
140
|
+
readonly marketplace: MarketplaceModule;
|
|
141
|
+
readonly automation: AutomationModule;
|
|
142
|
+
constructor(publicClient: PublicClient, walletClient: WalletClient, diamondAddress: Address, chainId: number, wethAddress: Address, permit2Address: Address, apiClient?: ApiClient);
|
|
143
|
+
/**
|
|
144
|
+
* Get the connected wallet address
|
|
145
|
+
*/
|
|
146
|
+
get address(): Address;
|
|
147
|
+
/**
|
|
148
|
+
* Approve tokens for the Diamond contract
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* await client.approve(tokenAddress, parseEther('1000'));
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
approve(token: Address, amount: bigint): Promise<TransactionResult>;
|
|
156
|
+
/**
|
|
157
|
+
* Approve max tokens (type(uint256).max)
|
|
158
|
+
*/
|
|
159
|
+
approveMax(token: Address): Promise<TransactionResult>;
|
|
160
|
+
/**
|
|
161
|
+
* Check and approve if needed
|
|
162
|
+
*/
|
|
163
|
+
ensureAllowance(token: Address, requiredAmount: bigint): Promise<TransactionResult | null>;
|
|
164
|
+
/**
|
|
165
|
+
* Get native balance (ETH/BNB)
|
|
166
|
+
*/
|
|
167
|
+
getNativeBalance(): Promise<bigint>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export { ApiClient, AutomationModule, CampaignsModule, ClaimsModule, MarketplaceModule, PepayStreamsClient, PepayStreamsClientWithSigner, PepayStreamsConfig, StakingModule, TransactionResult };
|