@defisaver/positions-sdk 2.1.127-uniswap-2-dev → 2.1.127-uniswap-3-dev
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/cjs/claiming/uniswap.d.ts +2 -1
- package/cjs/claiming/uniswap.js +9 -3
- package/cjs/types/claiming.d.ts +8 -0
- package/esm/claiming/uniswap.d.ts +2 -1
- package/esm/claiming/uniswap.js +9 -3
- package/esm/types/claiming.d.ts +8 -0
- package/package.json +1 -1
- package/src/claiming/uniswap.ts +12 -6
- package/src/types/claiming.ts +9 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types';
|
|
3
|
+
import { UniswapAirdropClaimableToken } from '../types/claiming';
|
|
3
4
|
export declare const fetchUniswapRewardsData: (walletAddress: EthAddress) => Promise<any>;
|
|
4
|
-
export declare const getUniswapRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string,
|
|
5
|
+
export declare const getUniswapRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, UniswapAirdropClaimableToken[]>>;
|
package/cjs/claiming/uniswap.js
CHANGED
|
@@ -56,12 +56,18 @@ const getUniswapRewards = (provider, network, walletAddresses) => __awaiter(void
|
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
58
|
results[walletAddress.toLowerCase()] = [{
|
|
59
|
+
symbol: 'UNI',
|
|
60
|
+
underlyingSymbol: 'UNI',
|
|
61
|
+
label: 'Uniswap Airdrop',
|
|
62
|
+
tokenAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
|
|
59
63
|
amount: (0, tokens_1.assetAmountInEth)(amountToClaim.toString(), 'UNI'),
|
|
60
64
|
walletAddress,
|
|
61
65
|
claimType: claiming_1.ClaimType.UNI_REWARDS,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
additionalClaimFields: {
|
|
67
|
+
index: data.index,
|
|
68
|
+
isClaimed: cumulative,
|
|
69
|
+
proof: data.proof,
|
|
70
|
+
},
|
|
65
71
|
}];
|
|
66
72
|
}
|
|
67
73
|
}
|
package/cjs/types/claiming.d.ts
CHANGED
|
@@ -83,5 +83,13 @@ export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & {
|
|
|
83
83
|
export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
84
84
|
claimType: ClaimType.ETHENA_AIRDROP;
|
|
85
85
|
};
|
|
86
|
+
export type UniswapAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
87
|
+
claimType: ClaimType.UNI_REWARDS;
|
|
88
|
+
additionalClaimFields: {
|
|
89
|
+
index: number;
|
|
90
|
+
isClaimed: boolean;
|
|
91
|
+
proof: string[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
86
94
|
export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
|
|
87
95
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { EthAddress, NetworkNumber } from '../types';
|
|
3
|
+
import { UniswapAirdropClaimableToken } from '../types/claiming';
|
|
3
4
|
export declare const fetchUniswapRewardsData: (walletAddress: EthAddress) => Promise<any>;
|
|
4
|
-
export declare const getUniswapRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string,
|
|
5
|
+
export declare const getUniswapRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, UniswapAirdropClaimableToken[]>>;
|
package/esm/claiming/uniswap.js
CHANGED
|
@@ -49,12 +49,18 @@ export const getUniswapRewards = (provider, network, walletAddresses) => __await
|
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
results[walletAddress.toLowerCase()] = [{
|
|
52
|
+
symbol: 'UNI',
|
|
53
|
+
underlyingSymbol: 'UNI',
|
|
54
|
+
label: 'Uniswap Airdrop',
|
|
55
|
+
tokenAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
|
|
52
56
|
amount: assetAmountInEth(amountToClaim.toString(), 'UNI'),
|
|
53
57
|
walletAddress,
|
|
54
58
|
claimType: ClaimType.UNI_REWARDS,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
additionalClaimFields: {
|
|
60
|
+
index: data.index,
|
|
61
|
+
isClaimed: cumulative,
|
|
62
|
+
proof: data.proof,
|
|
63
|
+
},
|
|
58
64
|
}];
|
|
59
65
|
}
|
|
60
66
|
}
|
package/esm/types/claiming.d.ts
CHANGED
|
@@ -83,5 +83,13 @@ export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & {
|
|
|
83
83
|
export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
84
84
|
claimType: ClaimType.ETHENA_AIRDROP;
|
|
85
85
|
};
|
|
86
|
+
export type UniswapAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
87
|
+
claimType: ClaimType.UNI_REWARDS;
|
|
88
|
+
additionalClaimFields: {
|
|
89
|
+
index: number;
|
|
90
|
+
isClaimed: boolean;
|
|
91
|
+
proof: string[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
86
94
|
export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
|
|
87
95
|
export {};
|
package/package.json
CHANGED
package/src/claiming/uniswap.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Client } from 'viem';
|
|
|
3
3
|
import { assetAmountInEth } from '@defisaver/tokens';
|
|
4
4
|
import { EthAddress, NetworkNumber } from '../types';
|
|
5
5
|
import { UniswapTokenDistributorViem } from '../contracts';
|
|
6
|
-
import { ClaimType } from '../types/claiming';
|
|
6
|
+
import { ClaimType, UniswapAirdropClaimableToken } from '../types/claiming';
|
|
7
7
|
|
|
8
8
|
const EMPTY_DATA = (walletAddress: EthAddress) => ({
|
|
9
9
|
address: walletAddress, index: 0, amount: '0x0', proof: [],
|
|
@@ -26,7 +26,7 @@ export const fetchUniswapRewardsData = async (walletAddress: EthAddress) => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export const getUniswapRewards = async (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => {
|
|
29
|
+
export const getUniswapRewards = async (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]): Promise<Record<string, UniswapAirdropClaimableToken[]>> => {
|
|
30
30
|
// Fetch all API data in parallel (these are external API calls, can't be batched with multicall)
|
|
31
31
|
const apiDataPromises = walletAddresses.map(address => fetchUniswapRewardsData(address));
|
|
32
32
|
const apiDataArray = await Promise.all(apiDataPromises);
|
|
@@ -38,7 +38,7 @@ export const getUniswapRewards = async (provider: Client, network: NetworkNumber
|
|
|
38
38
|
const cumulativeResults = await Promise.all(cumulativePromises);
|
|
39
39
|
|
|
40
40
|
// Process results
|
|
41
|
-
const results: Record<string,
|
|
41
|
+
const results: Record<string, UniswapAirdropClaimableToken[]> = {};
|
|
42
42
|
|
|
43
43
|
for (let i = 0; i < walletAddresses.length; i++) {
|
|
44
44
|
const walletAddress = walletAddresses[i];
|
|
@@ -51,12 +51,18 @@ export const getUniswapRewards = async (provider: Client, network: NetworkNumber
|
|
|
51
51
|
results[walletAddress.toLowerCase() as EthAddress] = [];
|
|
52
52
|
} else {
|
|
53
53
|
results[walletAddress.toLowerCase() as EthAddress] = [{
|
|
54
|
+
symbol: 'UNI',
|
|
55
|
+
underlyingSymbol: 'UNI',
|
|
56
|
+
label: 'Uniswap Airdrop',
|
|
57
|
+
tokenAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
|
|
54
58
|
amount: assetAmountInEth(amountToClaim.toString(), 'UNI'),
|
|
55
59
|
walletAddress,
|
|
56
60
|
claimType: ClaimType.UNI_REWARDS,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
additionalClaimFields: {
|
|
62
|
+
index: data.index,
|
|
63
|
+
isClaimed: cumulative,
|
|
64
|
+
proof: data.proof,
|
|
65
|
+
},
|
|
60
66
|
}];
|
|
61
67
|
}
|
|
62
68
|
}
|
package/src/types/claiming.ts
CHANGED
|
@@ -90,6 +90,15 @@ export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & { claimT
|
|
|
90
90
|
|
|
91
91
|
export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & { claimType: ClaimType.ETHENA_AIRDROP };
|
|
92
92
|
|
|
93
|
+
export type UniswapAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
94
|
+
claimType: ClaimType.UNI_REWARDS,
|
|
95
|
+
additionalClaimFields: {
|
|
96
|
+
index: number;
|
|
97
|
+
isClaimed: boolean;
|
|
98
|
+
proof: string[];
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
93
102
|
export type ClaimableToken =
|
|
94
103
|
AaveRewardsClaimableToken
|
|
95
104
|
| AaveMeritRewardsClaimableToken
|