mirror of
https://github.com/placeholder-soft/web.git
synced 2026-04-28 10:55:27 +08:00
return the resal discountValidator address on proof endpoints (#874)
This commit is contained in:
@@ -6,7 +6,6 @@ type Database = {
|
||||
};
|
||||
|
||||
export enum ProofTableNamespace {
|
||||
Usernames = 'usernames',
|
||||
UsernamesEarlyAccess = 'usernames_early_access',
|
||||
BNSDiscount = 'basenames_bns_discount',
|
||||
BaseEthHolders = 'basenames_base_eth_holders_discount',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isAddress } from 'viem';
|
||||
import { Address, isAddress } from 'viem';
|
||||
import { isBasenameSupportedChain } from 'apps/web/src/hooks/useBasenameChain';
|
||||
import { hasRegisteredWithDiscount } from 'apps/web/src/utils/proofs/sybil_resistance';
|
||||
import { MerkleTreeProofResponse, ProofsException } from 'apps/web/src/utils/proofs/types';
|
||||
@@ -6,7 +6,21 @@ import {
|
||||
getProofsByNamespaceAndAddress,
|
||||
ProofTableNamespace,
|
||||
} from 'apps/web/src/utils/proofs/proofs_storage';
|
||||
import { USERNAME_CB_ID_DISCOUNT_VALIDATORS } from 'apps/web/src/addresses/usernames';
|
||||
import {
|
||||
USERNAME_BASE_ETH_HOLDERS_DISCOUNT_VALIDATORS,
|
||||
USERNAME_BNS_DISCOUNT_VALIDATORS,
|
||||
USERNAME_CB_ID_DISCOUNT_VALIDATORS,
|
||||
USERNAME_EA_DISCOUNT_VALIDATORS,
|
||||
} from 'apps/web/src/addresses/usernames';
|
||||
|
||||
const validators: {
|
||||
[key in ProofTableNamespace]: Record<number, Address>;
|
||||
} = {
|
||||
[ProofTableNamespace.CBIDDiscount]: USERNAME_CB_ID_DISCOUNT_VALIDATORS,
|
||||
[ProofTableNamespace.BaseEthHolders]: USERNAME_BASE_ETH_HOLDERS_DISCOUNT_VALIDATORS,
|
||||
[ProofTableNamespace.BNSDiscount]: USERNAME_BNS_DISCOUNT_VALIDATORS,
|
||||
[ProofTableNamespace.UsernamesEarlyAccess]: USERNAME_EA_DISCOUNT_VALIDATORS,
|
||||
};
|
||||
|
||||
export function proofValidation(
|
||||
address: string | string[] | undefined,
|
||||
@@ -45,7 +59,7 @@ export async function getWalletProofs(
|
||||
const responseData: MerkleTreeProofResponse = {
|
||||
...content,
|
||||
proofs,
|
||||
discountValidatorAddress: USERNAME_CB_ID_DISCOUNT_VALIDATORS[chain],
|
||||
discountValidatorAddress: validators[namespace][chain],
|
||||
};
|
||||
return responseData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user