Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Sep 8, 2023
1 parent 4e6a25b commit d3822b8
Show file tree
Hide file tree
Showing 28 changed files with 87 additions and 88 deletions.
46 changes: 23 additions & 23 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import {

clear();
console.log(
chalk.red(figlet.textSync("Masa CLI", { horizontalLayout: "full" }))
chalk.red(figlet.textSync("Masa CLI", { horizontalLayout: "full" })),
);

let overrides: Partial<MasaArgs> & {
Expand Down Expand Up @@ -104,7 +104,7 @@ program
(privateKey) => {
overrides.privateKey = privateKey;
reloadMasa(overrides);
}
},
)
.option("-r, --rpcUrl <rpc-url>", "RPC URL override", (rpcUrl) => {
overrides.rpcUrl = rpcUrl;
Expand Down Expand Up @@ -143,7 +143,7 @@ program
.argument("<duration>", "Period of registration")
.description("Creates a masa identity with soul name")
.action((soulName: string, duration: number) =>
identityCreate("ETH", soulName, duration)
identityCreate("ETH", soulName, duration),
);

identity
Expand Down Expand Up @@ -172,7 +172,7 @@ program
(soulNameContractAddress) => {
overrides.soulNameContractAddress = soulNameContractAddress;
reloadMasa(overrides);
}
},
)
.description("Soul Name Commands");

Expand Down Expand Up @@ -211,7 +211,7 @@ program
.argument("<duration>", "period of registration")
.description("Creates a new soul name")
.action((soulName: string, duration: number) =>
soulNameCreate("ETH", soulName, duration)
soulNameCreate("ETH", soulName, duration),
);

soulName
Expand All @@ -226,7 +226,7 @@ program
.argument("<receiver>", "Receiver to receive the Soul Name")
.description("Sends a soul name to that you own to a receiver")
.action((soulName: string, receiver: string) =>
soulNameSend(soulName, receiver)
soulNameSend(soulName, receiver),
);

soulName
Expand Down Expand Up @@ -285,19 +285,19 @@ program
.argument("<credit-score-id>", "ID of the Credit Score to grant access")
.argument(
"<reader-identity-id>",
"ID of the identity that should receive access"
"ID of the identity that should receive access",
)
.description("Creates a Soul Linker Passport")
.action((creditScoreId, readerIdentityId) =>
createLink(masa.creditScore.links, creditScoreId, readerIdentityId)
createLink(masa.creditScore.links, creditScoreId, readerIdentityId),
);

creditScoreLink
.command("establish")
.argument("<passport>", "Masa Soul Linker passport")
.description("Establishes a link to a Credit Score")
.action((passport) =>
establishLink(masa.creditScore.links, "ETH", passport)
establishLink(masa.creditScore.links, "ETH", passport),
);

creditScoreLink
Expand All @@ -310,35 +310,35 @@ program
.command("list")
.argument(
"<credit-score-id>",
"ID of the Credit Score to list all the links of"
"ID of the Credit Score to list all the links of",
)
.description("Lists all soul links for a credit score id")
.action((creditScoreId) =>
listLinks(masa.creditScore.links, creditScoreId)
listLinks(masa.creditScore.links, creditScoreId),
);

creditScoreLink
.command("verify")
.argument("<credit-score-id>", "ID of the Credit Score to grant access")
.option(
"-r, --reader-identity-id <reader-identity-id>",
"ID of the identity that should receive access"
"ID of the identity that should receive access",
)
.description("Verifies a Soul Link")
.action((creditScoreId, { readerIdentityId }) =>
verifyLink(masa.creditScore.links, creditScoreId, readerIdentityId)
verifyLink(masa.creditScore.links, creditScoreId, readerIdentityId),
);

creditScoreLink
.command("break")
.argument("<credit-score-id>", "ID of the Credit Score to grant access")
.argument(
"<reader-identity-id>",
"ID of the identity that should receive access"
"ID of the identity that should receive access",
)
.description("Breaks a Soul Link")
.action((creditScoreId, readerIdentityId) =>
breakLink(masa.creditScore.links, creditScoreId, readerIdentityId)
breakLink(masa.creditScore.links, creditScoreId, readerIdentityId),
);
}
}
Expand Down Expand Up @@ -385,7 +385,7 @@ program
.argument("<contract-address>", "Address of the SBT contract to list")
.option("-a, --address <address>", "Address override")
.action((contractAddress: string, { address }) =>
sbtList(contractAddress, address)
sbtList(contractAddress, address),
);

sbt
Expand All @@ -394,7 +394,7 @@ program
.argument("<sbt-id>", "ID of the SBT to burn")
.description("Burns an SBT")
.action((contractAddress: string, SBTId: string) =>
sbtBurn(contractAddress, SBTId)
sbtBurn(contractAddress, SBTId),
);
}

Expand Down Expand Up @@ -426,7 +426,7 @@ program
.argument("<contract-address>", "Address of the SBT to mint on")
.argument("<soulname>", "Address of the SBT receiver")
.action((contractAddress, soulname) =>
asbtMintFromSoulname(contractAddress, soulname)
asbtMintFromSoulname(contractAddress, soulname),
);
}

Expand All @@ -444,11 +444,11 @@ program
.description("Adds an Authority to the SSSBT")
.argument(
"<contract-address>",
"Address of the SBT to add the authority to"
"Address of the SBT to add the authority to",
)
.argument("<authority-address>", "Address of the Authority")
.action((contractAddress: string, authorityAddress: string) =>
sssbtAddAuthority(contractAddress, authorityAddress)
sssbtAddAuthority(contractAddress, authorityAddress),
);

sssbt
Expand All @@ -457,7 +457,7 @@ program
.argument("<contract-address>", "Address of the SBT to mint on")
.argument("<receiver>", "Address of the SBT receiver")
.action((contractAddress: string, receiver: string) =>
sssbtSign(contractAddress, receiver)
sssbtSign(contractAddress, receiver),
);

sssbt
Expand All @@ -472,9 +472,9 @@ program
contractAddress: string,
authorityAddress: string,
signatureDate: number,
signature: string
signature: string,
) =>
sssbtMint(contractAddress, authorityAddress, signatureDate, signature)
sssbtMint(contractAddress, authorityAddress, signatureDate, signature),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const account = async (address?: string) => {
console.log(
`${symbol}: '${
balance % 1 === 0 ? balance : balance.toFixed(precision)
}'`
}'`,
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/credit-score/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ export const info = async () => {
if (masa.contracts.instances.SoulboundCreditScoreContract.hasAddress) {
console.log("Soulbound Credit Score");
console.log(
`Contract Address: '${masa.contracts.instances.SoulboundCreditScoreContract.address}'`
`Contract Address: '${masa.contracts.instances.SoulboundCreditScoreContract.address}'`,
);
console.log(
`Total Credit Scores: ${(
await masa.contracts.instances.SoulboundCreditScoreContract.totalSupply()
).toNumber()}`
).toNumber()}`,
);
console.log(`Network: '${masa.config.networkName}'`);
} else {
console.error(
`Soulbound Credit Score is not deployed to network: '${masa.config.networkName}'`
`Soulbound Credit Score is not deployed to network: '${masa.config.networkName}'`,
);
}
};
2 changes: 1 addition & 1 deletion src/commands/credit-score/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BigNumber } from "ethers";

export const load = async (creditScoreId?: string) => {
const creditScore = await masa.creditScore.load(
BigNumber.from(creditScoreId)
BigNumber.from(creditScoreId),
);
console.log(JSON.stringify({ creditScore }, null, 2));
};
15 changes: 7 additions & 8 deletions src/commands/green/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,26 @@ import {

export const create = async (
paymentMethod: PaymentMethod,
phoneNumber: string
phoneNumber: string,
): Promise<void> => {
console.log(`Creating Green for phone number: '${phoneNumber}'`);

const generateResult: GenerateGreenResult = await masa.green.generate(
phoneNumber
);
const generateResult: GenerateGreenResult =
await masa.green.generate(phoneNumber);

if (generateResult.success) {
let verifyGreenResult: VerifyGreenResult | undefined;

do {
const code: string = await readLine(
"The code that has been sent to your phone number: "
"The code that has been sent to your phone number: ",
);
verifyGreenResult = await masa.green.verify(phoneNumber, code);

if (verifyGreenResult) {
if (!verifyGreenResult.success) {
console.error(
`Verifying Green failed! '${verifyGreenResult.message}'`
`Verifying Green failed! '${verifyGreenResult.message}'`,
);
}

Expand All @@ -53,12 +52,12 @@ export const create = async (
paymentMethod,
verifyGreenResult.authorityAddress,
verifyGreenResult.signatureDate,
verifyGreenResult.signature
verifyGreenResult.signature,
);

if (mintGreenResult.tokenId) {
console.log(
`Green successfully minted on '${masa.config.networkName}' with token ID: '${mintGreenResult.tokenId}'`
`Green successfully minted on '${masa.config.networkName}' with token ID: '${mintGreenResult.tokenId}'`,
);
}
} while (!mintGreenResult.tokenId);
Expand Down
6 changes: 3 additions & 3 deletions src/commands/green/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ export const info = async () => {
if (masa.contracts.instances.SoulboundGreenContract.hasAddress) {
console.log("Soulbound Green");
console.log(
`Contract Address: '${masa.contracts.instances.SoulboundGreenContract.address}'`
`Contract Address: '${masa.contracts.instances.SoulboundGreenContract.address}'`,
);
console.log(
`Total Greens: ${(
await masa.contracts.instances.SoulboundGreenContract.totalSupply()
).toNumber()}`
).toNumber()}`,
);
console.log(`Network: '${masa.config.networkName}'`);
} else {
console.error(
`Soulbound Green is not deployed to network: '${masa.config.networkName}'`
`Soulbound Green is not deployed to network: '${masa.config.networkName}'`,
);
}
};
4 changes: 2 additions & 2 deletions src/commands/identity/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { PaymentMethod } from "@masa-finance/masa-sdk";
export const create = async (
paymentMethod: PaymentMethod,
soulName: string,
duration: number
duration: number,
) => {
const { success, message } = await masa.identity.createWithSoulName(
paymentMethod,
soulName,
duration
duration,
);

if (!success) {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/identity/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ export const info = async () => {
if (masa.contracts.instances.SoulboundIdentityContract.hasAddress) {
console.log("Soulbound Identity");
console.log(
`Contract Address: '${masa.contracts.instances.SoulboundIdentityContract.address}'`
`Contract Address: '${masa.contracts.instances.SoulboundIdentityContract.address}'`,
);
console.log(
`Total Identities: ${(
await masa.contracts.instances.SoulboundIdentityContract.totalSupply()
).toNumber()}`
).toNumber()}`,
);
console.log(`Network: '${masa.config.networkName}'`);
} else {
console.error(
`Soulbound Identity is not deployed to network: '${masa.config.networkName}'`
`Soulbound Identity is not deployed to network: '${masa.config.networkName}'`,
);
}
};
8 changes: 4 additions & 4 deletions src/commands/sbt/ASBT/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { masa, readLine, verifyContract } from "../../../helpers";
import fs from "fs";

const ReferenceSBTAuthorityPath = require.resolve(
"@masa-finance/masa-contracts-identity/contracts/reference/ReferenceSBTAuthorityFlattened.sol"
"@masa-finance/masa-contracts-identity/contracts/reference/ReferenceSBTAuthorityFlattened.sol",
);

export const deployASBT = async (etherscanKey?: string) => {
Expand All @@ -12,10 +12,10 @@ export const deployASBT = async (etherscanKey?: string) => {
const symbol = await readLine("Enter the ticker of the SBT: ");
const baseTokenUri = await readLine("Enter the URL for the metadata image: ");
const adminAddress = await readLine(
`Admin address (leave empty to use: '${await masa.config.signer.getAddress()}'): `
`Admin address (leave empty to use: '${await masa.config.signer.getAddress()}'): `,
);
const limit = await readLine(
"Enter mint limit (0 = no limit, default = 1): "
"Enter mint limit (0 = no limit, default = 1): ",
);

const deployResult = await masa.asbt.deploy({
Expand All @@ -41,7 +41,7 @@ export const deployASBT = async (etherscanKey?: string) => {
address,
name,
abiEncodedConstructorArguments,
ReferenceSBTAuthority
ReferenceSBTAuthority,
);
}
};
2 changes: 1 addition & 1 deletion src/commands/sbt/ASBT/mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const mintASBT = async (contractAddress: string, receiver: string) => {

export const mintFromSoulname = async (
contractAddress: string,
soulname: string
soulname: string,
) => {
const address = await masa.soulName.resolve(soulname);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/sbt/SSSBT/add-authority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { masa } from "../../../helpers";
*/
export const addAuthoritySSSBT = async (
contractAddress: string,
authorityAddress: string
authorityAddress: string,
) => {
const { contract } = await masa.sssbt.connect(contractAddress);

Expand Down
Loading

0 comments on commit d3822b8

Please sign in to comment.