Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
code7551 committed Jan 14, 2024
2 parents 5695867 + f80ee89 commit 1a2dfb3
Show file tree
Hide file tree
Showing 38 changed files with 715,534 additions and 920 deletions.
4 changes: 4 additions & 0 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
"axios": "^1.6.2",
"cli-table3": "^0.6.3",
"date-prompt": "^1.0.0",
"inquirer": "^9.2.12",
"inquirer-autocomplete-prompt": "^3.0.1",
"vorpal": "^1.12.0"
},
"devDependencies": {
"@types/inquirer": "9.0.7",
"@types/inquirer-autocomplete-prompt": "3.0.3",
"@types/vorpal": "^1.12.2",
"esbuild": "^0.19.4",
"pkg": "^5.8.1"
Expand Down
300 changes: 300 additions & 0 deletions apps/cli/src/commands/kyc/start-kyc-process.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,300 @@
import Vorpal from "vorpal";
import inquirer from 'inquirer';
import inquirerAutocompletePrompt from 'inquirer-autocomplete-prompt';

inquirer.registerPrompt('autocomplete', inquirerAutocompletePrompt);

export const listOfCountries = [
"afghanistan",
"åland islands",
"albania",
"algeria",
"andorra",
"american samoa",
"angola",
"anguilla",
"antarctica",
"antigua and barbuda",
"argentina",
"armenia",
"aruba",
"australia",
"austria",
"azerbaijan",
"bahamas",
"bahrain",
"bangladesh",
"barbados",
"belarus",
"belgium",
"belize",
"benin",
"bermuda",
"bhutan",
"bolivia",
"bonaire, sint eustatius and saba",
"bosnia and herzegovina",
"botswana",
"bouvet island",
"brazil",
"british indian ocean territory",
"brunei darussalam",
"bulgaria",
"burkina faso",
"burundi",
"cabo verde",
"cambodia",
"cameroon",
"canada",
"cayman islands",
"central african republic",
"chad",
"chile",
"china",
"christmas island",
"cocos",
"colombia",
"comoros",
"congo (the democratic republic of the)",
"congo",
"cook islands",
"costa rica",
"croatia",
"cuba",
"curaçao",
"cyprus",
"czechia",
"cote d'ivoire",
"denmark",
"djibouti",
"dominica",
"dominican republic",
"ecuador",
"egypt",
"el salvador",
"equatorial guinea",
"eritrea",
"estonia",
"eswatini",
"ethiopia",
"falkland islands",
"faroe islands",
"fiji",
"finland",
"france",
"french guiana",
"french polynesia",
"french southern territories",
"gabon",
"gambia",
"georgia",
"germany",
"ghana",
"gibraltar",
"greece",
"greenland",
"grenada",
"guadeloupe",
"guam",
"guatemala",
"guernsey",
"guinea",
"guinea-bissau",
"guyana",
"haiti",
"heard island and mcdonald islands",
"honduras",
"hong kong",
"hungary",
"iceland",
"india",
"indonesia",
"iran",
"iraq",
"ireland",
"isle of man",
"israel",
"italy",
"jamaica",
"japan",
"jersey",
"jordan",
"kazakhstan",
"kenya",
"kiribati",
"korea (the democratic people's republic of)",
"korea (the republic of)",
"kosovo",
"kuwait",
"kyrgyzstan",
"laos",
"latvia",
"lebanon",
"lesotho",
"liberia",
"libya",
"liechtenstein",
"lithuania",
"luxembourg",
"macao",
"madagascar",
"malawi",
"malaysia",
"maldives",
"mali",
"malta",
"marshall islands",
"martinique",
"mauritania",
"mauritius",
"mayotte",
"mexico",
"micronesia",
"moldova",
"monaco",
"mongolia",
"montenegro",
"montserrat",
"morocco",
"mozambique",
"myanmar",
"namibia",
"nauru",
"nepal",
"netherlands",
"new caledonia",
"new zealand",
"nicaragua",
"niger",
"nigeria",
"niue",
"norfolk island",
"northern mariana islands",
"norway",
"oman",
"pakistan",
"palau",
"palestine",
"panama",
"papua new guinea",
"paraguay",
"peru",
"philippines",
"pitcairn",
"poland",
"portugal",
"puerto rico",
"qatar",
"republic of north macedonia",
"romania",
"russia",
"rwanda",
"réunion",
"saint barthélemy",
"saint helena, ascension and tristan da cunha",
"saint kitts and nevis",
"saint lucia",
"saint martin",
"saint pierre and miquelon",
"saint vincent and the grenadines",
"samoa",
"san marino",
"são tomé and príncipe",
"saudi arabia",
"senegal",
"serbia",
"seychelles",
"sierra leone",
"singapore",
"sint maarten",
"slovakia",
"slovenia",
"solomon islands",
"somalia",
"south africa",
"south georgia and the south sandwich islands",
"south sudan",
"spain",
"sri lanka",
"sudan",
"suriname",
"svalbard and jan mayen",
"sweden",
"switzerland",
"syria",
"taiwan",
"tajikistan",
"tanzania, united republic of",
"thailand",
"timor-leste",
"togo",
"tokelau",
"tonga",
"trinidad and tobago",
"tunisia",
"turkey",
"turkmenistan",
"turks and caicos islands",
"tuvalu",
"uganda",
"ukraine",
"united arab emirates",
"united kingdom",
"united states minor outlying islands",
"united states",
"uruguay",
"uzbekistan",
"vanuatu",
"vatican city",
"venezuela",
"vietnam",
"virgin islands (british)",
"virgin islands (u.s.)",
"wallis and futuna",
"western sahara",
"yemen",
"zambia",
"zimbabwe",
]

/**
* Function to start the KYC process for a user.
* @param cli - Vorpal instance
*/
export function startKycProcess(cli: Vorpal) {
cli
.command('kyc', 'Starts the KYC process for a user. The user should provide their country.')
.action(async function (this: Vorpal.CommandInstance) {
const countryPrompt = [{
type: 'autocomplete',
name: 'country',
message: 'Enter your country:',
source: (_: any, input: string) => {
input = input || '';
return new Promise((resolve) => {
const fuzzyResult = listOfCountries.filter(country => country.toLowerCase().includes(input.toLowerCase()));
resolve(fuzzyResult);
});
}
}];
const {country} = await inquirer.prompt(countryPrompt);

if (country) {
let url = '';
if (
country === "china" || //China
country === "hong kong" || //Hong Kong
country === "macedonia" || //Macedonia
country === "turkey" || //Turkey
country === "ukraine" //Ukraine
) {
url = 'https://verify-with.blockpass.org/?clientId=xai_sentry_node__edd_60145';
} else {
url = 'https://verify-with.blockpass.org/?clientId=xai_node_007da';
}
this.log(`Please visit the following URL to start the KYC process: ${url}`);
} else {
this.log("Invalid country. Please try again.");
}
});
}
2 changes: 2 additions & 0 deletions apps/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { setOrAddPricingTiersCommand } from './commands/licenses/set-or-add-pric
import { addPromoCode } from './commands/licenses/add-promo-code.js';
import { removePromoCode } from './commands/licenses/remove-promo-code.js';
import { eventListener } from './commands/event-listener.js';
import { startKycProcess } from './commands/kyc/start-kyc-process.js';
import { generateRevenueReport } from './commands/licenses/generate-revenue-report.js';

const cli = new Vorpal();
Expand Down Expand Up @@ -90,6 +91,7 @@ setReferralDiscountAndRewardPercentages(cli);
setRollupAddress(cli);
toggleAssertionChecking(cli);
totalSupply(cli);
startKycProcess(cli);
generateRevenueReport(cli);

cli
Expand Down
Loading

0 comments on commit 1a2dfb3

Please sign in to comment.