@zubari/sdk 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{WalletManager-DKPzfA74.d.mts → WalletManager-CQSrvRVs.d.mts} +1 -1
- package/dist/{WalletManager-IOHFgvpT.d.ts → WalletManager-U1YWIUWn.d.ts} +1 -1
- package/dist/{index-BCX8EYxv.d.ts → index--dqjW2SS.d.mts} +2 -3
- package/dist/{index-Be7yLGAO.d.ts → index-Bou-9cAG.d.mts} +54 -1
- package/dist/{index-Be7yLGAO.d.mts → index-Bou-9cAG.d.ts} +54 -1
- package/dist/{index-BrLMTY29.d.mts → index-CkPxa5Bn.d.ts} +2 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +105 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -7
- package/dist/index.mjs.map +1 -1
- package/dist/protocols/index.d.mts +37 -4
- package/dist/protocols/index.d.ts +37 -4
- package/dist/protocols/index.js +105 -3
- package/dist/protocols/index.js.map +1 -1
- package/dist/protocols/index.mjs +105 -3
- package/dist/protocols/index.mjs.map +1 -1
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/services/index.d.mts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +0 -4
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +0 -4
- package/dist/services/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +3 -3
- package/dist/wallet/index.d.ts +3 -3
- package/dist/wallet/index.js +0 -4
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +0 -4
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -158,8 +158,6 @@ var ZUBARI_CONTRACTS = {
|
|
|
158
158
|
// Deploy with: npx hardhat run deploy/deploy.ts --network ethereum-sepolia
|
|
159
159
|
accountFactory: ZERO_ADDRESS,
|
|
160
160
|
// Not yet deployed
|
|
161
|
-
usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
162
|
-
// USDC on Sepolia
|
|
163
161
|
usdt: "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0",
|
|
164
162
|
// USDT on Sepolia
|
|
165
163
|
weth: "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14"
|
|
@@ -175,8 +173,6 @@ var ZUBARI_CONTRACTS = {
|
|
|
175
173
|
entryPoint: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
176
174
|
paymaster: ZERO_ADDRESS,
|
|
177
175
|
accountFactory: ZERO_ADDRESS,
|
|
178
|
-
usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
179
|
-
// USDC on Ethereum
|
|
180
176
|
usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
181
177
|
// USDT on Ethereum
|
|
182
178
|
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
@@ -5422,12 +5418,14 @@ var ZubariSubscriptionProtocol = class {
|
|
|
5422
5418
|
var ZubariPayoutsProtocol = class {
|
|
5423
5419
|
contractAddress;
|
|
5424
5420
|
chainId;
|
|
5425
|
-
|
|
5421
|
+
apiBaseUrl;
|
|
5422
|
+
constructor(contractAddress, chainId, apiBaseUrl) {
|
|
5426
5423
|
this.contractAddress = contractAddress;
|
|
5427
5424
|
this.chainId = chainId;
|
|
5425
|
+
this.apiBaseUrl = apiBaseUrl || "https://ckgwifsxka.us-east-2.awsapprunner.com";
|
|
5428
5426
|
}
|
|
5429
5427
|
/**
|
|
5430
|
-
* Get pending earnings breakdown for the current user
|
|
5428
|
+
* Get pending earnings breakdown for the current user (on-chain)
|
|
5431
5429
|
*/
|
|
5432
5430
|
async getPendingEarnings() {
|
|
5433
5431
|
return {
|
|
@@ -5438,6 +5436,75 @@ var ZubariPayoutsProtocol = class {
|
|
|
5438
5436
|
total: BigInt(0)
|
|
5439
5437
|
};
|
|
5440
5438
|
}
|
|
5439
|
+
/**
|
|
5440
|
+
* Get earnings data from API (includes pending, total, breakdown, and recent payouts)
|
|
5441
|
+
* Requires authentication token
|
|
5442
|
+
*/
|
|
5443
|
+
async getEarnings(authToken) {
|
|
5444
|
+
const response = await fetch(`${this.apiBaseUrl}/api/payouts/earnings`, {
|
|
5445
|
+
headers: {
|
|
5446
|
+
Authorization: `Bearer ${authToken}`,
|
|
5447
|
+
"Content-Type": "application/json"
|
|
5448
|
+
}
|
|
5449
|
+
});
|
|
5450
|
+
if (!response.ok) {
|
|
5451
|
+
const error = await response.json();
|
|
5452
|
+
throw new Error(error.error || "Failed to fetch earnings");
|
|
5453
|
+
}
|
|
5454
|
+
return response.json();
|
|
5455
|
+
}
|
|
5456
|
+
/**
|
|
5457
|
+
* Get payout history with pagination
|
|
5458
|
+
* Requires authentication token
|
|
5459
|
+
*/
|
|
5460
|
+
async getPayoutHistory(authToken, page = 1, limit = 20) {
|
|
5461
|
+
const response = await fetch(
|
|
5462
|
+
`${this.apiBaseUrl}/api/payouts/history?page=${page}&limit=${limit}`,
|
|
5463
|
+
{
|
|
5464
|
+
headers: {
|
|
5465
|
+
Authorization: `Bearer ${authToken}`,
|
|
5466
|
+
"Content-Type": "application/json"
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
);
|
|
5470
|
+
if (!response.ok) {
|
|
5471
|
+
const error = await response.json();
|
|
5472
|
+
throw new Error(error.error || "Failed to fetch payout history");
|
|
5473
|
+
}
|
|
5474
|
+
return response.json();
|
|
5475
|
+
}
|
|
5476
|
+
/**
|
|
5477
|
+
* Get earnings breakdown by source with percentages
|
|
5478
|
+
* Requires authentication token
|
|
5479
|
+
*/
|
|
5480
|
+
async getBreakdown(authToken) {
|
|
5481
|
+
const response = await fetch(`${this.apiBaseUrl}/api/payouts/breakdown`, {
|
|
5482
|
+
headers: {
|
|
5483
|
+
Authorization: `Bearer ${authToken}`,
|
|
5484
|
+
"Content-Type": "application/json"
|
|
5485
|
+
}
|
|
5486
|
+
});
|
|
5487
|
+
if (!response.ok) {
|
|
5488
|
+
const error = await response.json();
|
|
5489
|
+
throw new Error(error.error || "Failed to fetch earnings breakdown");
|
|
5490
|
+
}
|
|
5491
|
+
return response.json();
|
|
5492
|
+
}
|
|
5493
|
+
/**
|
|
5494
|
+
* Get current platform fee
|
|
5495
|
+
*/
|
|
5496
|
+
async getPlatformFee() {
|
|
5497
|
+
const response = await fetch(`${this.apiBaseUrl}/api/payouts/platform-fee`, {
|
|
5498
|
+
headers: {
|
|
5499
|
+
"Content-Type": "application/json"
|
|
5500
|
+
}
|
|
5501
|
+
});
|
|
5502
|
+
if (!response.ok) {
|
|
5503
|
+
const error = await response.json();
|
|
5504
|
+
throw new Error(error.error || "Failed to fetch platform fee");
|
|
5505
|
+
}
|
|
5506
|
+
return response.json();
|
|
5507
|
+
}
|
|
5441
5508
|
/**
|
|
5442
5509
|
* Get historical earnings for a time period
|
|
5443
5510
|
*/
|
|
@@ -5445,7 +5512,26 @@ var ZubariPayoutsProtocol = class {
|
|
|
5445
5512
|
return [];
|
|
5446
5513
|
}
|
|
5447
5514
|
/**
|
|
5448
|
-
* Claim all pending earnings
|
|
5515
|
+
* Claim all pending earnings via API
|
|
5516
|
+
* Requires authentication token and seed phrase
|
|
5517
|
+
*/
|
|
5518
|
+
async claimEarningsViaApi(authToken, seed) {
|
|
5519
|
+
const response = await fetch(`${this.apiBaseUrl}/api/payouts/claim`, {
|
|
5520
|
+
method: "POST",
|
|
5521
|
+
headers: {
|
|
5522
|
+
Authorization: `Bearer ${authToken}`,
|
|
5523
|
+
"Content-Type": "application/json"
|
|
5524
|
+
},
|
|
5525
|
+
body: JSON.stringify({ seed })
|
|
5526
|
+
});
|
|
5527
|
+
if (!response.ok) {
|
|
5528
|
+
const error = await response.json();
|
|
5529
|
+
throw new Error(error.error || "Failed to claim earnings");
|
|
5530
|
+
}
|
|
5531
|
+
return response.json();
|
|
5532
|
+
}
|
|
5533
|
+
/**
|
|
5534
|
+
* Claim all pending earnings (direct contract call)
|
|
5449
5535
|
*/
|
|
5450
5536
|
async claimEarnings() {
|
|
5451
5537
|
return {
|
|
@@ -5519,6 +5605,18 @@ var ZubariPayoutsProtocol = class {
|
|
|
5519
5605
|
status: "pending"
|
|
5520
5606
|
};
|
|
5521
5607
|
}
|
|
5608
|
+
/**
|
|
5609
|
+
* Get the contract address
|
|
5610
|
+
*/
|
|
5611
|
+
getContractAddress() {
|
|
5612
|
+
return this.contractAddress;
|
|
5613
|
+
}
|
|
5614
|
+
/**
|
|
5615
|
+
* Get the chain ID
|
|
5616
|
+
*/
|
|
5617
|
+
getChainId() {
|
|
5618
|
+
return this.chainId;
|
|
5619
|
+
}
|
|
5522
5620
|
};
|
|
5523
5621
|
|
|
5524
5622
|
// src/services/SwapService.ts
|