This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DISCOURSE_URL = process.env.DISCOURSE_URL; | |
const API_KEY = process.env.DISCOURSE_API_KEY; | |
const API_USERNAME = process.env.DISCOURSE_API_USERNAME; | |
if (!DISCOURSE_URL || !API_KEY || !API_USERNAME) { | |
throw new Error("Discourse environment variables are not set"); | |
} | |
// Mapping of chain names to Discourse category IDs | |
const DISCOURSE_CATEGORY_ID: Record<string, number> = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fetchCred } from "@phi/protocol/fetch/cred"; | |
import { fetchArt } from "@phi/protocol/fetch/factory"; | |
import { fetchArtMetadata } from "@phi/protocol/metadata"; | |
import { createSignature } from "@phi/protocol/signature"; | |
import { CredType, Verifier } from "@phi/protocol/types"; | |
import { fetchVerifierList, isVerifierResponse, recoverVerifierAddress, toDataHex } from "@phi/protocol/verifier"; | |
import { Irys } from "@phi/services/irys/client"; | |
import { SignClient } from "@phi/services/sign/client"; | |
import { schemaId, VerifyReceipt } from "@phi/services/sign/schema"; | |
import { fetchWithTimeout } from "@phi/utils/fetch"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Credential = { | |
id: number; | |
votes: number; | |
art: boolean; | |
}; | |
function getQualifiedCredentials( | |
credentials: Credential[], | |
prevThreshold: number, | |
prevMedianVotes: number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
import { ethers } from "ethers"; | |
import fs from "fs"; | |
import WawaNFT from "../lambda-fn/utility/abi/WawaNFT.json"; | |
async function fetchMetadata() { | |
const provider = new ethers.providers.AlchemyProvider("homestead", "<ALCHEMY_API_KEY_ETH>"); | |
const contractAddress = "0x2d9181b954736971bb74043d4782dfe93b55a9af"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { secretId } from "@env"; | |
import { successResponse } from "@object-helpers/apiResponse"; | |
import { createCoupon, generateHashBuffer, serializeCoupon } from "@object-helpers/coupons"; | |
import { getSigKeyfromKMS } from "@utility/getSigKeyfromKMS"; | |
import { simpleRateLimit } from "@utility/rateLimiter"; | |
import { getSecret } from "@utility/secret"; | |
import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda"; | |
import axios from "axios"; | |
import dayjs from "dayjs"; | |
import utc from "dayjs/plugin/utc"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { secretId } from "@env"; | |
import { notVerifyResponse, successResponse } from "@object-helpers/apiResponse"; | |
import { createCoupon, generateHashBuffer, serializeCoupon } from "@object-helpers/coupons"; | |
import { getSecret } from "@object-helpers/phiUtils"; | |
import { getSigKeyfromKMS } from "@utility/getSigKeyfromKMS"; | |
import { simpleRateLimit } from "@utility/rateLimiter"; | |
import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda"; | |
import axios from "axios"; | |
import dayjs from "dayjs"; | |
import utc from "dayjs/plugin/utc"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated 2023/5/3 | |
// This note is a memo to share the method of verifying quest objects. | |
// If any correction is needed in the logic, please contact the PHI team. | |
-------------- PHI -------------- | |
// Related Contract links | |
// PhiMap: '0xe8b6395d223C9D3D85e162f2cb2023bC9088a908', | |
// Polygonscan: https://polygonscan.com/address/0xe8b6395d223C9D3D85e162f2cb2023bC9088a908 | |
// Registry: '0x6532B97295a0728880AE81D5CD7248f32E24e39a', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const abi = [ | |
{ | |
stateMutability: "view", | |
type: "function", | |
name: "pool_count", | |
inputs: [], | |
outputs: [ | |
{ | |
name: "", | |
type: "uint256", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { targetEnv, isLocal } from "../env"; | |
import { getCache, putCache } from "./ddbCache"; | |
const TABLE_NAME = "cache-" + targetEnv; | |
const DEFAULT_TTL = 90000; | |
export type CachedContractCallOptions = { | |
tableName?: string; | |
ttl?: number; | |
toJson?: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { sha3 } from "web3-utils"; | |
import contractAbi from "./abi/ENS.json"; | |
const namehash = require("@ensdomains/eth-ens-namehash"); | |
// Config | |
/* -------------------------------------------------------------------------- */ | |
const secretkey ="<0x123456>" | |
const INFURA_API_KEY ="<aaaaa>" | |
// Definitely long strings (ex. phiphi0320102081028) causes this problem 0x problem. |
NewerOlder