Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ghostnet #18

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@airgap/beacon-sdk": "3.1.1",
"@airgap/beacon-sdk": "3.1.0",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@mui/icons-material": "^5.0.3",
"@mui/material": "^5.0.3",
"@taquito/beacon-wallet": "^10.1.3",
"@taquito/michelson-encoder": "^10.1.2",
"@taquito/taquito": "^10.1.2",
"@taquito/beacon-wallet": "13.0.0",
"@taquito/michelson-encoder": "13.0.0",
"@taquito/taquito": "13.0.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
Expand Down
106 changes: 53 additions & 53 deletions src/app/components/atoms/MainSelect.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
import React from "react";
import { styled } from "@mui/material/styles";
import MenuItem from "@mui/material/MenuItem";
import Select from "@mui/material/Select";
import InputBase from "@mui/material/InputBase";

const MainInput = styled(InputBase)(({ theme, colorType }) => ({
...theme.custom.secondaryFont,
background: `${theme.custom.color[colorType].default} 0% 0% no-repeat padding-box`,
...theme.custom.box,
"& .MuiInputBase-input": {
...theme.custom.secondaryFont,
"padding-left": "30px",
background: `${theme.custom.color[colorType].default} 0% 0% no-repeat padding-box`,
"&:hover": {
"background-color": theme.custom.color[colorType].secondary,
},
"&:focus": {
"background-color": theme.custom.color[colorType].secondary,
},
},
"& .MuiSvgIcon-root": {
...theme.custom.secondaryFont,
"&:hover": {
...theme.custom.secondaryFont,
},
},
}));

const StyledItem = styled(MenuItem)(({ theme }) => ({
...theme.custom.inputFont,
}));

const MainSelect = ({ onChange, defaultValue, text, items, colorType }) => {
colorType = colorType || "type1";

return (
<Select
displayEmpty
defaultValue={defaultValue}
id={text}
onChange={onChange}
colorType={colorType}
input={<MainInput />}
>
{items.map((item) => {
return <StyledItem value={item}>{item}</StyledItem>;
})}
</Select>
);
};

export default MainSelect;
import React from "react";
import { styled } from "@mui/material/styles";
import MenuItem from "@mui/material/MenuItem";
import Select from "@mui/material/Select";
import InputBase from "@mui/material/InputBase";
const MainInput = styled(InputBase)(({ theme, colorType }) => ({
...theme.custom.secondaryFont,
background: `${theme.custom.color[colorType].default} 0% 0% no-repeat padding-box`,
...theme.custom.box,
"& .MuiInputBase-input": {
...theme.custom.secondaryFont,
"paddingLeft": "30px",
background: `${theme.custom.color[colorType].default} 0% 0% no-repeat padding-box`,
"&:hover": {
"backgroundColor": theme.custom.color[colorType].secondary,
},
"&:focus": {
"backgroundColor": theme.custom.color[colorType].secondary,
},
},
"& .MuiSvgIcon-root": {
...theme.custom.secondaryFont,
"&:hover": {
...theme.custom.secondaryFont,
},
},
}));
const StyledItem = styled(MenuItem)(({ theme }) => ({
...theme.custom.inputFont,
}));
const MainSelect = ({ onChange, defaultValue, text, items, colorType }) => {
colorType = colorType || "type1";
return (
<Select
displayEmpty
defaultValue={defaultValue}
id={text}
onChange={onChange}
colorType={colorType}
input={<MainInput />}
>
{items.map((item) => {
return <StyledItem key={item} value={item}>{item}</StyledItem>;
})}
</Select>
);
};
export default MainSelect;
40 changes: 20 additions & 20 deletions src/app/components/atoms/RiskAlert.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import React from "react";

import Alert from "@mui/material/Alert";
import { styled } from "@mui/material/styles";

const ColoredAllert = styled(Alert)(({ theme, colorType }) => ({
...theme.custom.secondaryFont,
background: `${theme.custom.color[colorType].default} 0% 0% no-repeat padding-box`,
margin: "0 auto 5vh auto",
}));

const RiskAlert = () => {
return (
<ColoredAllert variant="filled" colorType="type2" severity="warning">
Use at your own risk!
</ColoredAllert>
);
};

export default RiskAlert;
import React from "react";
import Alert from "@mui/material/Alert";
import { styled } from "@mui/material/styles";
const ColoredAllert = styled(Alert)(({ theme, colorType }) => ({
...theme.custom.secondaryFont,
background: `${theme.custom.color[colorType].default} 0% 0% no-repeat padding-box`,
margin: "0 auto 5vh auto",
}));
const RiskAlert = () => {
return (
<ColoredAllert variant="filled" colorType="type2" severity="warning">
Use at your own risk!
</ColoredAllert>
);
};
export default RiskAlert;
158 changes: 79 additions & 79 deletions src/app/components/hooks/handleDeploy.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
import { MichelsonMap } from "@taquito/michelson-encoder";

import fa2MultiAsset from "../assets/MultiAsset.json";
import fa2GranularMultiAsset from "../assets/GranularMultiAsset.json";
import { BigNumber } from "bignumber.js";

const handleDeploy = async (
admin,
contractName,
contractDescription,
tokensString,
type,
wallet,
setFetching
) => {
setFetching(true);
try {
const tokens = JSON.parse(tokensString);
let metadata = MichelsonMap.fromLiteral({
"": Buffer("tezos-storage:contents", "ascii").toString("hex"),
contents: Buffer(
JSON.stringify({
version: "v0.0.1",
name: contractName,
description: contractDescription,
authors: ["FA2 Bakery"],
source: {
tools: ["Ligo"],
},
interfaces: ["TZIP-012", "TZIP-016"],
}),
"ascii"
).toString("hex"),
});
const storage = {
admin: {
admin: admin,
pending_admin: null,
paused: type == "Basic" ? false : MichelsonMap.fromLiteral({}),
},
assets: {
token_total_supply: MichelsonMap.fromLiteral({}),
ledger: MichelsonMap.fromLiteral({}),
operators: MichelsonMap.fromLiteral({}),
token_metadata: MichelsonMap.fromLiteral({}),
},
metadata: metadata,
};
tokens.forEach((token, index) => {
const tokenSupply = token.supply * new BigNumber(10).pow(token.decimals);
storage.assets.token_total_supply.set(index, tokenSupply);
storage.assets.ledger.set([admin, index], tokenSupply);
storage.assets.token_metadata.set(index, {
token_id: index,
token_info: MichelsonMap.fromLiteral({
symbol: Buffer(token.symbol, "ascii").toString("hex"),
name: Buffer(token.name, "ascii").toString("hex"),
decimals: Buffer(token.decimals, "ascii").toString("hex"),
shouldPreferSymbol: Buffer("true", "ascii").toString("hex"),
description: Buffer(token.description, "ascii").toString("hex"),
thumbnailUri: Buffer(token.icon, "ascii").toString("hex"),
}),
});
});
console.log(fa2MultiAsset);
await wallet
.originate({
code: type == "Basic" ? fa2MultiAsset : fa2GranularMultiAsset,
storage,
})
.send();
} catch (e) {
console.error(e);
} finally {
setFetching(false);
}
};

export default handleDeploy;
import { MichelsonMap } from "@taquito/michelson-encoder";
import fa2MultiAsset from "../assets/MultiAsset.json";
import fa2GranularMultiAsset from "../assets/GranularMultiAsset.json";
import { BigNumber } from "bignumber.js";
const handleDeploy = async (
admin,
contractName,
contractDescription,
tokensString,
type,
wallet,
setFetching
) => {
setFetching(true);
try {
const tokens = JSON.parse(tokensString);
let metadata = MichelsonMap.fromLiteral({
"": Buffer("tezos-storage:contents", "ascii").toString("hex"),
contents: Buffer(
JSON.stringify({
version: "v0.0.1",
name: contractName,
description: contractDescription,
authors: ["FA2 Bakery"],
source: {
tools: ["Ligo"],
},
interfaces: ["TZIP-012", "TZIP-016"],
}),
"ascii"
).toString("hex"),
});
const storage = {
admin: {
admin: admin,
pending_admin: null,
paused: type === "Basic" ? false : MichelsonMap.fromLiteral({}),
},
assets: {
token_total_supply: MichelsonMap.fromLiteral({}),
ledger: MichelsonMap.fromLiteral({}),
operators: MichelsonMap.fromLiteral({}),
token_metadata: MichelsonMap.fromLiteral({}),
},
metadata: metadata,
};
tokens.forEach((token, index) => {
const tokenSupply = token.supply * new BigNumber(10).pow(token.decimals);
storage.assets.token_total_supply.set(index, tokenSupply);
storage.assets.ledger.set([admin, index], tokenSupply);
storage.assets.token_metadata.set(index, {
token_id: index,
token_info: MichelsonMap.fromLiteral({
symbol: Buffer(token.symbol, "ascii").toString("hex"),
name: Buffer(token.name, "ascii").toString("hex"),
decimals: Buffer(token.decimals, "ascii").toString("hex"),
shouldPreferSymbol: Buffer("true", "ascii").toString("hex"),
description: Buffer(token.description, "ascii").toString("hex"),
thumbnailUri: Buffer(token.icon, "ascii").toString("hex"),
}),
});
});
console.log(fa2MultiAsset);
await wallet
.originate({
code: type === "Basic" ? fa2MultiAsset : fa2GranularMultiAsset,
storage,
})
.send();
} catch (e) {
console.error(e);
} finally {
setFetching(false);
}
};
export default handleDeploy;
Loading