@zebec-network/admin-sdk 1.0.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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +730 -0
  3. package/dist/artifacts/abi/index.d.ts +161 -0
  4. package/dist/artifacts/abi/index.js +7 -0
  5. package/dist/artifacts/abi/token.json +350 -0
  6. package/dist/artifacts/abi/weth.json +153 -0
  7. package/dist/artifacts/abi/zebecCard.json +1229 -0
  8. package/dist/artifacts/index.d.ts +11 -0
  9. package/dist/artifacts/index.js +11 -0
  10. package/dist/artifacts/typechain-types/OdysseyZebecCard.d.ts +559 -0
  11. package/dist/artifacts/typechain-types/OdysseyZebecCard.js +1 -0
  12. package/dist/artifacts/typechain-types/Token.d.ts +149 -0
  13. package/dist/artifacts/typechain-types/Token.js +1 -0
  14. package/dist/artifacts/typechain-types/Weth.d.ts +179 -0
  15. package/dist/artifacts/typechain-types/Weth.js +1 -0
  16. package/dist/artifacts/typechain-types/ZebecCard.d.ts +723 -0
  17. package/dist/artifacts/typechain-types/ZebecCard.js +1 -0
  18. package/dist/artifacts/typechain-types/common.d.ts +50 -0
  19. package/dist/artifacts/typechain-types/common.js +1 -0
  20. package/dist/artifacts/typechain-types/factories/OdysseyZebecCard__factory.d.ts +735 -0
  21. package/dist/artifacts/typechain-types/factories/OdysseyZebecCard__factory.js +959 -0
  22. package/dist/artifacts/typechain-types/factories/Token__factory.d.ts +280 -0
  23. package/dist/artifacts/typechain-types/factories/Token__factory.js +374 -0
  24. package/dist/artifacts/typechain-types/factories/Weth__factory.d.ts +219 -0
  25. package/dist/artifacts/typechain-types/factories/Weth__factory.js +292 -0
  26. package/dist/artifacts/typechain-types/factories/ZebecCard__factory.d.ts +966 -0
  27. package/dist/artifacts/typechain-types/factories/ZebecCard__factory.js +1253 -0
  28. package/dist/artifacts/typechain-types/factories/index.d.ts +4 -0
  29. package/dist/artifacts/typechain-types/factories/index.js +7 -0
  30. package/dist/artifacts/typechain-types/index.d.ts +9 -0
  31. package/dist/artifacts/typechain-types/index.js +8 -0
  32. package/dist/artifacts/zebec_instant_card.d.ts +3683 -0
  33. package/dist/artifacts/zebec_instant_card.js +1 -0
  34. package/dist/artifacts/zebec_instant_card.json +2801 -0
  35. package/dist/artifacts/zebec_proxy_stream.d.ts +1933 -0
  36. package/dist/artifacts/zebec_proxy_stream.js +1 -0
  37. package/dist/artifacts/zebec_proxy_stream.json +1497 -0
  38. package/dist/artifacts/zebec_stake_v1.d.ts +1679 -0
  39. package/dist/artifacts/zebec_stake_v1.js +1 -0
  40. package/dist/artifacts/zebec_stake_v1.json +1255 -0
  41. package/dist/artifacts/zebec_stream.d.ts +1481 -0
  42. package/dist/artifacts/zebec_stream.js +1 -0
  43. package/dist/artifacts/zebec_stream.json +1243 -0
  44. package/dist/constants.d.ts +32 -0
  45. package/dist/constants.js +115 -0
  46. package/dist/index.d.ts +6 -0
  47. package/dist/index.js +6 -0
  48. package/dist/pda.d.ts +23 -0
  49. package/dist/pda.js +125 -0
  50. package/dist/services/evmCardService.d.ts +189 -0
  51. package/dist/services/evmCardService.js +322 -0
  52. package/dist/services/index.d.ts +6 -0
  53. package/dist/services/index.js +6 -0
  54. package/dist/services/proxyStreamService.d.ts +72 -0
  55. package/dist/services/proxyStreamService.js +302 -0
  56. package/dist/services/solanaCardV2Service.d.ts +50 -0
  57. package/dist/services/solanaCardV2Service.js +717 -0
  58. package/dist/services/stakingService.d.ts +39 -0
  59. package/dist/services/stakingService.js +265 -0
  60. package/dist/services/streamServices.d.ts +50 -0
  61. package/dist/services/streamServices.js +322 -0
  62. package/dist/services/suiCardService.d.ts +91 -0
  63. package/dist/services/suiCardService.js +487 -0
  64. package/dist/types.d.ts +433 -0
  65. package/dist/types.js +1 -0
  66. package/dist/utils.d.ts +5 -0
  67. package/dist/utils.js +39 -0
  68. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,730 @@
1
+ # @zebec-network/admin-sdk
2
+
3
+ Admin SDK for managing Zebec smart contract operations across Solana, EVM-compatible chains, and Sui.
4
+
5
+ Provides typed service classes for configuring payment streams, staking/lockup programs, and card payment infrastructure — covering initialization, fee management, token whitelisting, vault setup, and on-chain data reads.
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ - [Installation](#installation)
12
+ - [Quick Start](#quick-start)
13
+ - [Usage](#usage)
14
+ - [Solana — Stream Admin](#solana--stream-admin)
15
+ - [Solana — Staking Admin](#solana--staking-admin)
16
+ - [Solana — Card Admin](#solana--card-admin)
17
+ - [Solana — Partner Card Admin](#solana--partner-card-admin)
18
+ - [EVM — Card Admin](#evm--card-admin)
19
+ - [Sui — Card Admin](#sui--card-admin)
20
+ - [API Reference](#api-reference)
21
+ - [ZebecStreamAdminService](#zebecstreamadminservice)
22
+ - [ZebecStakeAdminService](#zebecstakeadminservice)
23
+ - [ZebecSolanaCardV2AdminService](#zebecsolanacardv2adminservice)
24
+ - [ZebecSolanaPartnerAdminCardService](#zebecsolanapartneradmincardservice)
25
+ - [ZebecCardService (EVM)](#zebeccardservice-evm)
26
+ - [SuiCardAdminService](#suicardadminservice)
27
+ - [ProxyStreamAdminService](#proxystreamadminservice)
28
+ - [Supported Networks](#supported-networks)
29
+ - [Types](#types)
30
+ - [Utilities](#utilities)
31
+ - [Environment Setup](#environment-setup)
32
+ - [Folder Structure](#folder-structure)
33
+ - [Scripts](#scripts)
34
+
35
+ ---
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ npm install @zebec-network/admin-sdk
41
+ # or
42
+ yarn add @zebec-network/admin-sdk
43
+ ```
44
+
45
+ **Peer dependencies** vary by which chains you use:
46
+
47
+ | Chain | Required peer dep |
48
+ | -------- | --------------------------------------------------- |
49
+ | Solana | `@coral-xyz/anchor`, `@solana/web3.js` |
50
+ | EVM | `ethers@^6` |
51
+ | Sui | `@mysten/sui` |
52
+
53
+ ---
54
+
55
+ ## Quick Start
56
+
57
+ ### Solana Quick Start
58
+
59
+ ```typescript
60
+ import { Connection, Keypair } from "@solana/web3.js";
61
+ import { AnchorProvider, Wallet } from "@coral-xyz/anchor";
62
+ import { ZebecStreamAdminService } from "@zebec-network/admin-sdk";
63
+
64
+ const connection = new Connection(process.env.RPC_URL!);
65
+ const keypair = Keypair.fromSecretKey(/* your key */);
66
+ const provider = new AnchorProvider(connection, new Wallet(keypair), {});
67
+
68
+ const service = ZebecStreamAdminService.create("my-config", provider, "mainnet-beta");
69
+
70
+ const tx = await service.initializeStreamConfig({
71
+ feePercentage: 1, // 100 in basis points
72
+ feeVault: keypair.publicKey,
73
+ // ...other params
74
+ });
75
+ console.log(tx.signature);
76
+ ```
77
+
78
+ ### EVM Quick Start
79
+
80
+ ```typescript
81
+ import { ethers } from "ethers";
82
+ import { ZebecCardService, SupportedChain } from "@zebec-network/admin-sdk";
83
+
84
+ const provider = new ethers.JsonRpcProvider(process.env.EVM_RPC_URL!);
85
+ const signer = new ethers.Wallet(process.env.EVM_PRIVATE_KEY!, provider);
86
+
87
+ const cardService = new ZebecCardService(signer, SupportedChain.Base);
88
+ await cardService.setNativeFee({ feeInPercent: "1" }); // 100 bps
89
+ ```
90
+
91
+ ### Sui Quick Start
92
+
93
+ ```typescript
94
+ import { SuiClient } from "@mysten/sui/client";
95
+ import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
96
+ import {
97
+ SuiCardAdminService,
98
+ SuiSilverCardPackageInfo,
99
+ createSuiSignTransactionMethodFromSigner,
100
+ } from "@zebec-network/admin-sdk";
101
+
102
+ const suiClient = new SuiClient({ url: "https://fullnode.mainnet.sui.io" });
103
+ const keypair = Ed25519Keypair.fromSecretKey(/* your key */);
104
+
105
+ const wallet = {
106
+ address: keypair.toSuiAddress(),
107
+ signTransaction: createSuiSignTransactionMethodFromSigner(keypair),
108
+ };
109
+
110
+ const packageInfo = new SuiSilverCardPackageInfo("mainnet");
111
+ const adminService = await SuiCardAdminService.create(packageInfo, suiClient, wallet);
112
+
113
+ const payload = await adminService.setCardVault({ vaultAddress: "0x..." });
114
+ const result = await payload.execute();
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Usage
120
+
121
+ ### Solana — Stream Admin
122
+
123
+ ```typescript
124
+ import { ZebecStreamAdminService } from "@zebec-network/admin-sdk";
125
+
126
+ const service = ZebecStreamAdminService.create("config-name", provider, "mainnet-beta");
127
+
128
+ // Initialize a new stream config
129
+ const initTx = await service.initializeStreamConfig({
130
+ feePercentage: 1,
131
+ feeVault: adminPublicKey,
132
+ feeTiers: [{ minAmount: 1, maxAmount: 1000, feePercent: 5 }],
133
+ });
134
+
135
+ // Update an existing stream config
136
+ const updateTx = await service.updateStreamConfig({
137
+ feePercentage: 8,
138
+ feeVault: adminPublicKey,
139
+ });
140
+
141
+ // Whitelist tokens for streaming
142
+ const whitelistTx = await service.whiteListTokens({
143
+ tokens: [usdcMint, usdtMint],
144
+ });
145
+
146
+ // Read on-chain data
147
+ const config = await service.getStreamConfigInfo("config-name");
148
+ const tokens = await service.getWhitelistedTokens("config-name");
149
+ const metadata = await service.getStreamMetadataInfo(streamMetadataAddress);
150
+ ```
151
+
152
+ ---
153
+
154
+ ### Solana — Staking Admin
155
+
156
+ ```typescript
157
+ import { ZebecStakeAdminService } from "@zebec-network/admin-sdk";
158
+
159
+ const stakeService = ZebecStakeAdminService.create(provider, "mainnet-beta");
160
+
161
+ // Initialize a lockup program
162
+ const lockupTx = await stakeService.initLockup({
163
+ stakeToken: usdcMint,
164
+ rewardToken: zbcMint,
165
+ name: "my-lockup",
166
+ fee: 5,
167
+ feeVault: adminPublicKey,
168
+ rewardSchemes: [
169
+ { lockupDurationDays: 30, rewardRate: 5 },
170
+ { lockupDurationDays: 90, rewardRate: 12 },
171
+ ],
172
+ minimumStake: "1",
173
+ });
174
+
175
+ // Update an existing lockup
176
+ const updateTx = await stakeService.updateLockup({
177
+ lockupName: "my-lockup",
178
+ fee: 7.5,
179
+ feeVault: adminPublicKey,
180
+ rewardSchemes: [],
181
+ minimumStake: "2",
182
+ });
183
+
184
+ // Read on-chain data
185
+ const lockupInfo = await stakeService.getLockupInfo(lockupAddress);
186
+ const stakeCount = await stakeService.getAllStakesCount(lockupAddress);
187
+ const allStakes = await stakeService.getAllStakesInfo(lockupAddress);
188
+ ```
189
+
190
+ ---
191
+
192
+ ### Solana — Card Admin
193
+
194
+ ```typescript
195
+ import { ZebecSolanaCardV2AdminService } from "@zebec-network/admin-sdk";
196
+
197
+ const cardService = ZebecSolanaCardV2AdminService.create(provider, "mainnet-beta");
198
+
199
+ // Initialize card configuration
200
+ await cardService.initCardConfig({
201
+ nativeFee: 1,
202
+ nonNativeFee: 1.5,
203
+ revenueFee: 0.5,
204
+ cardVault: vaultPublicKey,
205
+ revenueVault: revenuePublicKey,
206
+ minCardAmount: "10",
207
+ maxCardAmount: "1500",
208
+ dailyLimit: "10000",
209
+ });
210
+
211
+ // Update card config
212
+ await cardService.setCardConfig({
213
+ nativeFee: 1.2,
214
+ nonNativeFee: 1.6,
215
+ revenueFee: 0.6,
216
+ cardVault: vaultPublicKey,
217
+ revenueVault: revenuePublicKey,
218
+ minCardAmount: "10",
219
+ maxCardAmount: "1500",
220
+ dailyLimit: "10000",
221
+ });
222
+
223
+ // Manage custom token fees
224
+ await cardService.setCustomFees({ token: usdcMint, fee: 80 });
225
+ await cardService.deleteCustomFees({ token: usdcMint });
226
+
227
+ // Read on-chain data
228
+ const config = await cardService.getCardConfigInfo();
229
+ const purchase = await cardService.getCardPurchaseInfo(purchasePda);
230
+ const userRecord = await cardService.getUserPurchaseRecord(userRecordPda);
231
+ const customFees = await cardService.getCustomTokenFees();
232
+ ```
233
+
234
+ ---
235
+
236
+ ### Solana — Partner Card Admin
237
+
238
+ ```typescript
239
+ import { ZebecSolanaPartnerAdminCardService } from "@zebec-network/admin-sdk";
240
+
241
+ const partnerService = ZebecSolanaPartnerAdminCardService.create(
242
+ "my-partner",
243
+ provider,
244
+ "mainnet-beta"
245
+ );
246
+
247
+ await partnerService.initPartnerCardConfig({ /* params */ });
248
+ await partnerService.setPartnerCardConfig({ /* params */ });
249
+ await partnerService.setPartnerCustomFees({ token: usdcMint, fee: 0.8 });
250
+ await partnerService.deletePartnerCustomFees({ token: usdcMint });
251
+
252
+ const partnerConfig = await partnerService.getPartnerCardConfigInfo();
253
+ const partnerFees = await partnerService.getPartnerCustomTokenFees();
254
+ ```
255
+
256
+ ---
257
+
258
+ ### EVM — Card Admin
259
+
260
+ ```typescript
261
+ import { ZebecCardService, SupportedChain } from "@zebec-network/admin-sdk";
262
+
263
+ const cardService = new ZebecCardService(signer, SupportedChain.Base);
264
+
265
+ // Fee configuration
266
+ await cardService.setNativeFee({ feeInPercent: "1" }); // 1%
267
+ await cardService.setNonNativeFee({ feeInPercent: "1.50" }); // 1.5%
268
+ await cardService.setRevenueFee({ feeInPercent: "0.5" }); // 0.5%
269
+
270
+ // Card limits
271
+ await cardService.setMinCardLimit({ amount: "10" });
272
+ await cardService.setMaxCardLimit({ amount: "1500" });
273
+ await cardService.setDailyLimit({ amount: "10000" });
274
+
275
+ // Vault addresses
276
+ await cardService.setCardVault({ vault: "0xYourVaultAddress" });
277
+ await cardService.setRevenueVault({ vault: "0xYourRevenueVault" });
278
+
279
+ // Read config
280
+ const config = await cardService.getCardConfig();
281
+ console.log(config.nativeFee, config.cardVault);
282
+ ```
283
+
284
+ ---
285
+
286
+ ### Sui — Card Admin
287
+
288
+ All Sui operations return a `SuiTransactionPayload` that must be explicitly executed:
289
+
290
+ ```typescript
291
+ import {
292
+ SuiCardAdminService,
293
+ SuiSilverCardPackageInfo,
294
+ createSuiSignTransactionMethodFromSigner,
295
+ } from "@zebec-network/admin-sdk";
296
+
297
+ const packageInfo = new SuiSilverCardPackageInfo("mainnet");
298
+ const adminService = await SuiCardAdminService.create(packageInfo, suiClient, wallet);
299
+
300
+ // Fee settings
301
+ await (await adminService.setNativeFee({ feePercent: 1 })).execute();
302
+ await (await adminService.setNonNativeFee({ feePercent: 1.5 })).execute();
303
+ await (await adminService.setRevenueFee({ feePercent: 0.5 })).execute();
304
+
305
+ // Vault addresses
306
+ await (await adminService.setCardVault({ vaultAddress: "0x..." })).execute();
307
+ await (await adminService.setRevenueVault({ vaultAddress: "0x..." })).execute();
308
+
309
+ // Card limits
310
+ await (await adminService.setMinCardAmount({ minCardAmount: "10" })).execute();
311
+ await (await adminService.setMaxCardAmount({ maxCardAmount: "1500" })).execute();
312
+ await (await adminService.setDailyLimit({ dailyLimit: "10000" })).execute();
313
+
314
+ // Token address
315
+ await (await adminService.setUsdcAddress({ usdcAddress: "0x..." })).execute();
316
+
317
+ // Fee tiers
318
+ await (await adminService.addFeeTier({ minAmount: "0", maxAmount: "1000", fee: 100 })).execute();
319
+ await (await adminService.updateFeeTier({ minAmount: "0", maxAmount: "1000", fee: 120 })).execute();
320
+ await (await adminService.removeFeeTier({ minAmount: "0", maxAmount: "1000" })).execute();
321
+
322
+ // Swap fees per token type
323
+ await (await adminService.addSwapFee({ tokenType: "0x2::sui::SUI", fee: 200 })).execute();
324
+ await (await adminService.updateSwapFee({ tokenType: "0x2::sui::SUI", fee: 180 })).execute();
325
+ await (await adminService.removeSwapFee({ tokenType: "0x2::sui::SUI" })).execute();
326
+
327
+ // Read on-chain data (no execution needed)
328
+ const config = await adminService.getCardConfig();
329
+ const feeTiers = await adminService.getFeeTierList();
330
+ const swapFees = await adminService.getSwapFeeList();
331
+ ```
332
+
333
+ ---
334
+
335
+ ## API Reference
336
+
337
+ ### ZebecStreamAdminService
338
+
339
+ Manages payment stream configurations on Solana.
340
+
341
+ ```typescript
342
+ static create(
343
+ streamConfigName: string,
344
+ provider: Provider,
345
+ network: RpcNetwork
346
+ ): ZebecStreamAdminService
347
+ ```
348
+
349
+ | Method | Description |
350
+ | ------ | ----------- |
351
+ | `initializeStreamConfig(params)` | Creates a new stream configuration on-chain |
352
+ | `updateStreamConfig(params)` | Updates fee or vault settings on an existing stream config |
353
+ | `whiteListTokens(params)` | Adds tokens to the stream whitelist |
354
+ | `getStreamConfigInfo(configName, commitment?)` | Fetches stream config account data |
355
+ | `getWhitelistedTokens(configName, commitment?)` | Returns all whitelisted token metadata |
356
+ | `getStreamMetadataInfo(streamMetadata, commitment?)` | Fetches stream payment metadata |
357
+
358
+ ---
359
+
360
+ ### ZebecStakeAdminService
361
+
362
+ Manages staking/lockup programs on Solana.
363
+
364
+ ```typescript
365
+ static create(provider: Provider, network: RpcNetwork): ZebecStakeAdminService
366
+ ```
367
+
368
+ | Method | Description |
369
+ | ------ | ----------- |
370
+ | `initLockup(params)` | Creates a new lockup program with reward schemes |
371
+ | `updateLockup(params)` | Updates lockup fee, vault, or reward settings |
372
+ | `getLockupInfo(lockupAddress)` | Fetches lockup account data |
373
+ | `getAllStakesCount(lockupAddress, commitment?)` | Returns the total number of stakes |
374
+ | `getAllStakesInfo(lockupAddress)` | Returns all individual stake records |
375
+ | `getStakeSignatureForStake(stakeInfo)` | Returns the creation transaction signature for a stake |
376
+
377
+ ---
378
+
379
+ ### ZebecSolanaCardV2AdminService
380
+
381
+ Manages card configuration and fees on Solana.
382
+
383
+ ```typescript
384
+ static create(provider: Provider, network: "mainnet-beta" | "devnet"): ZebecSolanaCardV2AdminService
385
+ ```
386
+
387
+ | Method | Description |
388
+ | ------ | ----------- |
389
+ | `initCardConfig(params)` | Initializes card config on-chain |
390
+ | `setCardConfig(params)` | Updates card configuration |
391
+ | `setCustomFees(params)` | Sets a custom fee for a specific token |
392
+ | `deleteCustomFees(params)` | Removes a custom fee for a token |
393
+ | `getCardConfigInfo()` | Fetches card configuration |
394
+ | `getCardPurchaseInfo(cardPurchasePda)` | Fetches a specific card purchase record |
395
+ | `getUserPurchaseRecord(userPurchaseRecordPda)` | Fetches a user's purchase history record |
396
+ | `getCustomTokenFees()` | Returns all custom token fee records |
397
+
398
+ ---
399
+
400
+ ### ZebecSolanaPartnerAdminCardService
401
+
402
+ Manages partner-specific card configuration on Solana.
403
+
404
+ ```typescript
405
+ static create(
406
+ partnershipName: string,
407
+ provider: Provider,
408
+ network: "mainnet-beta" | "devnet"
409
+ ): ZebecSolanaPartnerAdminCardService
410
+ ```
411
+
412
+ Exposes the same surface area as `ZebecSolanaCardV2AdminService` prefixed with `partner`:
413
+ `initPartnerCardConfig`, `setPartnerCardConfig`, `setPartnerCustomFees`, `deletePartnerCustomFees`, `getPartnerCardConfigInfo`, `getPartnerCustomTokenFees`, `getCardPurchaseInfo`, `getPartnerUserPurchaseRecord`.
414
+
415
+ ---
416
+
417
+ ### ZebecCardService (EVM)
418
+
419
+ Manages card configuration on EVM-compatible chains.
420
+
421
+ ```typescript
422
+ constructor(signer: ethers.Signer, chainId: number)
423
+ ```
424
+
425
+ | Method | Description |
426
+ | ------ | ----------- |
427
+ | `setNativeFee(params)` | Sets the native token fee percentage |
428
+ | `setNonNativeFee(params)` | Sets the non-native token fee percentage |
429
+ | `setRevenueFee(params)` | Sets the revenue fee percentage |
430
+ | `setMaxCardLimit(params)` | Sets the maximum card purchase amount |
431
+ | `setMinCardLimit(params)` | Sets the minimum card purchase amount |
432
+ | `setDailyLimit(params)` | Sets the daily purchase limit |
433
+ | `setCardVault(params)` | Sets the card vault address |
434
+ | `setRevenueVault(params)` | Sets the revenue vault address |
435
+ | `getCardConfig()` | Fetches current card configuration |
436
+
437
+ ---
438
+
439
+ ### SuiCardAdminService
440
+
441
+ Manages card configuration on Sui.
442
+
443
+ ```typescript
444
+ static async create(
445
+ packageInfo: SuiSilverCardPackageInfo,
446
+ suiClient: ClientWithCoreApi,
447
+ wallet: WalletInterface
448
+ ): Promise<SuiCardAdminService>
449
+ ```
450
+
451
+ All mutation methods return `Promise<SuiTransactionPayload>` which exposes an `execute()` method.
452
+
453
+ | Method | Description |
454
+ | ------ | ----------- |
455
+ | `getCardConfig()` | Fetches card configuration object |
456
+ | `getFeeTierList()` | Fetches all fee tiers |
457
+ | `getSwapFeeList()` | Fetches all swap fees |
458
+ | `setNativeFee(params)` | Sets native token fee percent |
459
+ | `setNonNativeFee(params)` | Sets non-native token fee percent |
460
+ | `setRevenueFee(params)` | Sets revenue fee percent |
461
+ | `setCardVault(params)` | Sets card vault address |
462
+ | `setRevenueVault(params)` | Sets revenue vault address |
463
+ | `setMinCardAmount(params)` | Sets minimum card amount |
464
+ | `setMaxCardAmount(params)` | Sets maximum card amount |
465
+ | `setDailyLimit(params)` | Sets daily transaction limit |
466
+ | `setUsdcAddress(params)` | Sets USDC token address |
467
+ | `addFeeTier(params)` | Adds a new fee tier range |
468
+ | `updateFeeTier(params)` | Updates an existing fee tier |
469
+ | `removeFeeTier(params)` | Removes a fee tier |
470
+ | `addSwapFee(params)` | Adds a swap fee for a token type |
471
+ | `updateSwapFee(params)` | Updates a swap fee |
472
+ | `removeSwapFee(params)` | Removes a swap fee |
473
+
474
+ ---
475
+
476
+ ### ProxyStreamAdminService
477
+
478
+ Manages proxy stream configurations on Solana.
479
+
480
+ ```typescript
481
+ static create(provider: Provider, network: RpcNetwork): ProxyStreamAdminService
482
+ ```
483
+
484
+ ---
485
+
486
+ ## Supported Networks
487
+
488
+ ### Solana
489
+
490
+ | Network | `RpcNetwork` value |
491
+ | ------- | ----------------- |
492
+ | Mainnet Beta | `"mainnet-beta"` |
493
+ | Devnet | `"devnet"` |
494
+
495
+ ### EVM (`SupportedChain` enum)
496
+
497
+ | Chain | Chain ID |
498
+ | ----- | -------- |
499
+ | Ethereum Mainnet | `1` |
500
+ | Sepolia Testnet | `11155111` |
501
+ | Base | `8453` |
502
+ | BSC | `56` |
503
+ | BSC Testnet | `97` |
504
+ | Polygon | `137` |
505
+ | Polygon Amoy | `80002` |
506
+ | Odyssey | `153153` |
507
+ | Odyssey Testnet | `131313` |
508
+
509
+ ### Sui
510
+
511
+ | Network | `SuiNetwork` value |
512
+ | ------- | ----------------- |
513
+ | Mainnet | `"mainnet"` |
514
+ | Devnet | `"devnet"` |
515
+ | Testnet | `"testnet"` |
516
+
517
+ ---
518
+
519
+ ## Types
520
+
521
+ Key types exported from the package:
522
+
523
+ ```typescript
524
+ // Network
525
+ type RpcNetwork = "mainnet-beta" | "devnet";
526
+ type SuiNetwork = "mainnet" | "devnet" | "testnet";
527
+
528
+ // Solana stream
529
+ type StreamConfigInfo
530
+ type StreamMetadataInfo
531
+ type TokenMetadata
532
+ type StreamFeeTier
533
+ type InitializeStreamConfigParams
534
+ type UpdateStreamConfigParams
535
+ type WhiteListTokensParams
536
+
537
+ // Solana staking
538
+ type LockupInfo
539
+ type StakeInfo
540
+ type RewardScheme
541
+ type InitLockupInstructionData
542
+ type UpdateLockupInstructionData
543
+
544
+ // Solana card
545
+ type CardConfigInfo
546
+ type PartnerCardConfigInfo
547
+ type CardPurchaseInfo
548
+ type UserPurchaseRecordInfo
549
+ type TokenFeeRecord
550
+ type CardFeeTier
551
+ type InitCardConfigParams
552
+ type SetCardConfigParams
553
+ type SetCustomFeesParams
554
+ type DeleteCustomFeesParams
555
+
556
+ // EVM card
557
+ type EvmCardConfig
558
+ type CardPurchaseOfDay
559
+
560
+ // Sui card
561
+ type SuiCardConfig
562
+ type SuiFeeTier
563
+ type SuiFeeTierList
564
+ type SuiSwapFee
565
+ type SuiSwapFeeList
566
+ type WalletInterface
567
+ type SuiSignTransactionMethod
568
+ type SuiTransactionPayload
569
+
570
+ // Shared
571
+ type Numeric = string | number
572
+ type Address // blockchain address string
573
+ type DecimalString // decimal value as string
574
+ type Percent // percentage value
575
+ ```
576
+
577
+ ---
578
+
579
+ ## Utilities
580
+
581
+ ### `createSuiSignTransactionMethodFromSigner`
582
+
583
+ Creates a `SuiSignTransactionMethod` compatible wallet adapter from a Sui keypair or signer.
584
+
585
+ ```typescript
586
+ import { createSuiSignTransactionMethodFromSigner } from "@zebec-network/admin-sdk";
587
+ import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
588
+
589
+ const keypair = Ed25519Keypair.fromSecretKey(secretKey);
590
+ const signTransaction = createSuiSignTransactionMethodFromSigner(keypair);
591
+ // Pass signTransaction into WalletInterface
592
+ ```
593
+
594
+ ### `getCoinDecimals`
595
+
596
+ Fetches decimal precision for a Sui coin type.
597
+
598
+ ```typescript
599
+ import { getCoinDecimals } from "@zebec-network/admin-sdk";
600
+
601
+ const decimals = await getCoinDecimals(suiClient, "0x2::sui::SUI");
602
+ // => 9
603
+ ```
604
+
605
+ ### PDA Derivation (Solana)
606
+
607
+ Helper functions for deriving Program Derived Addresses:
608
+
609
+ ```typescript
610
+ import {
611
+ deriveStreamConfigPda,
612
+ deriveCardConfigPda,
613
+ deriveLockupAddress,
614
+ deriveStakeVaultAddress,
615
+ deriveCardPurchasePda,
616
+ } from "@zebec-network/admin-sdk";
617
+ ```
618
+
619
+ ---
620
+
621
+ ## Environment Setup
622
+
623
+ Copy `.env.example` and fill in your credentials:
624
+
625
+ ```bash
626
+ cp .env.example .env
627
+ ```
628
+
629
+ ```dotenv
630
+ # Solana
631
+ MAINNET_SECRET_KEYS= # Admin keypair secret keys (mainnet)
632
+ DEVNET_SECRET_KEYS= # Admin keypair secret keys (devnet)
633
+ RPC_URL= # Solana mainnet RPC endpoint
634
+ DEVNET_RPC_URL= # Solana devnet RPC endpoint
635
+
636
+ # Sui
637
+ SUI_SECRET_KEYS= # Sui admin keypair secret keys
638
+ HOP_API_KEY= # Hop bridge API
639
+
640
+ # EVM
641
+ EVM_PRIVATE_KEYS= # Admin private keys
642
+ SEPOLIA_RPC_URL= # Sepolia rpc url
643
+ BSC_RPC_URL= # Bsc rpc url
644
+ BASE_RPC_URL= # Base rpc url
645
+ ODYSSEY_RPC_URL= # Odyssey rpc url
646
+ BSC_TESTNET_RPC_URL= # Bsc testnet rpc url
647
+ ONE_INCH_AUTH_TOKEN= # 1inch auth token
648
+ ETHEREUM_RPC_URL= # Ethereum rpc url
649
+ ODYSSEY_TESTNET_RPC_URL= # Odyssey testnet rpc url
650
+ POLYGON_AMOY_RPC_URL= # Polygon amoy rpc url
651
+ POLYGON_RPC_URL= # Polygon rpc url
652
+ ```
653
+
654
+ ---
655
+
656
+ ## Folder Structure
657
+
658
+ ```text
659
+ zebec-admin-sdk/
660
+ ├── src/
661
+ │ ├── artifacts/ # Smart contract definitions
662
+ │ │ ├── abi/ # EVM contract ABIs (JSON)
663
+ │ │ ├── typechain-types/ # Generated TypeChain EVM types
664
+ │ │ ├── zebec_stream.ts # Solana stream program IDL
665
+ │ │ ├── zebec_stake_v1.ts # Solana staking program IDL
666
+ │ │ ├── zebec_instant_card.ts # Solana card program IDL
667
+ │ │ ├── zebec_proxy_stream.ts # Solana proxy stream IDL
668
+ │ │ └── index.ts
669
+ │ ├── services/
670
+ │ │ ├── streamServices.ts # ZebecStreamAdminService
671
+ │ │ ├── stakingService.ts # ZebecStakeAdminService
672
+ │ │ ├── solanaCardV2Service.ts # Solana card services
673
+ │ │ ├── evmCardService.ts # ZebecCardService (EVM)
674
+ │ │ ├── suiCardService.ts # SuiCardAdminService
675
+ │ │ ├── proxyStreamService.ts # ProxyStreamAdminService
676
+ │ │ └── index.ts
677
+ │ ├── constants.ts # Network addresses and chain configs
678
+ │ ├── types.ts # TypeScript type definitions
679
+ │ ├── utils.ts # Utility functions
680
+ │ ├── pda.ts # Solana PDA derivation helpers
681
+ │ └── index.ts # Public entry point
682
+ ├── test/
683
+ │ ├── setup.ts # Test keypair and client setup
684
+ │ └── sui/ # Sui integration tests
685
+ ├── .env.example
686
+ ├── biome.json # Linter / formatter config
687
+ ├── package.json
688
+ └── tsconfig.json
689
+ ```
690
+
691
+ ---
692
+
693
+ ## Scripts
694
+
695
+ | Script | Command | Description |
696
+ | ------ | ------- | ----------- |
697
+ | Build | `yarn build` | Compiles TypeScript to `dist/` |
698
+ | Clean | `yarn clean` | Removes the `dist/` directory |
699
+ | Test | `yarn test` | Runs all integration tests via Mocha |
700
+ | Generate TypeChain | `yarn gen:typechain` | Regenerates TypeChain types from EVM ABIs in `src/artifacts/abi/` |
701
+
702
+ ### Build
703
+
704
+ ```bash
705
+ yarn build
706
+ ```
707
+
708
+ Runs `clean` then `tsc`. Output goes to `dist/` as ESM modules.
709
+
710
+ ### Test
711
+
712
+ ```bash
713
+ yarn test
714
+ ```
715
+
716
+ Runs `ts-mocha` against `test/**/*.test.ts`. Tests are integration tests that hit live RPC endpoints — ensure your `.env` is configured before running.
717
+
718
+ ### Generate TypeChain Types
719
+
720
+ ```bash
721
+ yarn gen:typechain
722
+ ```
723
+
724
+ Re-generates TypeScript types from ABI JSON files in `src/artifacts/abi/`. Run this after updating any EVM contract ABI.
725
+
726
+ ---
727
+
728
+ ## License
729
+
730
+ MIT — © Zebec Network