Skip to content

Commit

Permalink
Consider recurring mini donations ( streams)
Browse files Browse the repository at this point in the history
related to #1483
  • Loading branch information
mohammadranjbarz committed May 9, 2024
1 parent 55e97db commit 35b9832
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 101 deletions.
14 changes: 12 additions & 2 deletions src/givethIoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ export const getEligibleDonations = async (
bottomRankInRound
isReferrerGivbackEligible
referrerWallet
recurringDonation {
id
txHash
}
project {
slug
verified
Expand Down Expand Up @@ -206,7 +210,10 @@ export const getEligibleDonations = async (
projectLink: `https://giveth.io/project/${item.project.slug}`,

isReferrerGivbackEligible: item.isReferrerGivbackEligible,
referrerWallet: item.referrerWallet
referrerWallet: item.referrerWallet,

parentRecurringDonationId: item?.recurringDonation?.id,
parentRecurringDonationTxHash: item?.recurringDonation?.txHash
}
});

Expand Down Expand Up @@ -234,7 +241,10 @@ export const getEligibleDonations = async (
projectLink: `https://giveth.io/project/${item.project.slug}`,

isReferrerGivbackEligible: item.isReferrerGivbackEligible,
referrerWallet: item.referrerWallet
referrerWallet: item.referrerWallet,

parentRecurringDonationId: item?.recurringDonation?.id,
parentRecurringDonationTxHash: item?.recurringDonation?.txHash
}
});
return eligible ?
Expand Down
207 changes: 108 additions & 99 deletions src/types/general.ts
Original file line number Diff line number Diff line change
@@ -1,124 +1,133 @@
import moment from "moment";

export interface FormattedDonation {
amount: string,
currency: string,
createdAt: string,
valueUsd: number,
givbackFactor: number,
projectRank ?: number,
bottomRankInRound ?: number,
givbacksRound ?: number,
giverAddress: string,
txHash: string,
network: string,
source: string,
giverName: string
giverEmail?: string,
projectLink?: string,
niceTokens?: string,
info?: string,

isReferrerGivbackEligible ?:boolean,
referrerWallet ?:string
referrer ?: boolean,
referred ?: boolean
amount: string,
currency: string,
createdAt: string,
valueUsd: number,
givbackFactor: number,
projectRank?: number,
bottomRankInRound?: number,
givbacksRound?: number,
giverAddress: string,
txHash: string,
network: string,
source: string,
giverName: string
giverEmail?: string,
projectLink?: string,
niceTokens?: string,
info?: string,

isReferrerGivbackEligible?: boolean,
referrerWallet?: string
referrer?: boolean,
referred?: boolean,
parentRecurringDonationId?: string,
parentRecurringDonationTxHash?: string,


}

export interface GivethIoDonation {
amount: string,
currency: string,
createdAt: string,
valueUsd: number,
givbackFactor: number,
projectRank ?: number,
powerRound ?: number,
bottomRankInRound ?: number,
giverAddress: string,
transactionId: string,
transactionNetworkId: number,
fromWalletAddress: string,
toWalletAddress: string
chainType: string
source: string,
user: {
name: string,
email: string
}
project: {
slug: string
listed: boolean,
verified: boolean,
projectPower: {
powerRank: number
}
amount: string,
currency: string,
createdAt: string,
valueUsd: number,
givbackFactor: number,
projectRank?: number,
powerRound?: number,
bottomRankInRound?: number,
giverAddress: string,
transactionId: string,
transactionNetworkId: number,
fromWalletAddress: string,
toWalletAddress: string
chainType: string
source: string,
user: {
name: string,
email: string
}

recurringDonation ?: {
id: string,
txHash: string
}
project: {
slug: string
listed: boolean,
verified: boolean,
projectPower: {
powerRank: number
}
}

// giverName: string
// giverEmail: string,
status: string,
isProjectVerified: boolean,
isReferrerGivbackEligible ?:boolean,
referrerWallet ?:string
// giverName: string
// giverEmail: string,
status: string,
isProjectVerified: boolean,
isReferrerGivbackEligible?: boolean,
referrerWallet?: string
}

export interface DonationResponse {
giverAddress: string,
giverEmail: string,
giverName: string,
totalDonationsUsdValue?: number,
totalDonationsUsdValueAfterGivFactor: number,
givback: number,
givbackUsdValue?: string,
share: number,
niceEarned?: number

totalReferralDeductedUsdValue?: number
totalReferralDeductedUsdValueAfterGivFactor?: number

totalReferralAddedUsdValue?: number
totalReferralAddedUsdValueAfterGivFactor?: number
giverAddress: string,
giverEmail: string,
giverName: string,
totalDonationsUsdValue?: number,
totalDonationsUsdValueAfterGivFactor: number,
givback: number,
givbackUsdValue?: string,
share: number,
niceEarned?: number

totalReferralDeductedUsdValue?: number
totalReferralDeductedUsdValueAfterGivFactor?: number

totalReferralAddedUsdValue?: number
totalReferralAddedUsdValueAfterGivFactor?: number
}

export interface MinimalDonation {
giverAddress: string,
giverEmail: string,
giverName: string,
valueUsd: string,
niceTokens?: number,
share?: number,
totalDonationsUsdValue: number
totalDonationsUsdValueAfterGivFactor: number

totalReferralDeductedUsdValue?: number
totalReferralDeductedUsdValueAfterGivFactor?: number

totalReferralAddedUsdValue?: number
totalReferralAddedUsdValueAfterGivFactor?: number
giverAddress: string,
giverEmail: string,
giverName: string,
valueUsd: string,
niceTokens?: number,
share?: number,
totalDonationsUsdValue: number
totalDonationsUsdValueAfterGivFactor: number

totalReferralDeductedUsdValue?: number
totalReferralDeductedUsdValueAfterGivFactor?: number

totalReferralAddedUsdValue?: number
totalReferralAddedUsdValueAfterGivFactor?: number
}

export interface GivbackFactorParams {
topPowerRank: number;
minimumFactor: number;
maximumFactor: number;
topPowerRank: number;
minimumFactor: number;
maximumFactor: number;
}

export interface Project {
id: string,
title: string,
slug: string,
verified: boolean,
link ?: string,
projectPower: {
totalPower: number,
powerRank: number,
round: number
}
id: string,
title: string,
slug: string,
verified: boolean,
link?: string,
projectPower: {
totalPower: number,
powerRank: number,
round: number
}

}

export interface GIVbacksRound {
round: number,
start: string,
end: string
round: number,
start: string,
end: string
}

0 comments on commit 35b9832

Please sign in to comment.