| 1 | { |
| 2 | "data": { |
| 3 | "astraplusplus.ndctools.near": { |
| 4 | "widget": { |
| 5 | "DAO.Proposal.Create": { |
| 6 | "": "const daoId = props.daoId;\\\\nconst accountId = props.accountId ?? context.accountId;\\\\nconst onClose = props.onClose;\\\\n\\\\nconst CoADaoId = props.dev\\\\n ? \\\\\\\"coa.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-coa-v1.ndc-gwg.near\\\\\\\";\\\\nconst VotingBodyDaoId = props.dev\\\\n ? \\\\\\\"voting-body-v1.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"voting-body-v1.ndc-gwg.near\\\\\\\";\\\\nconst TCDaoId = props.dev\\\\n ? \\\\\\\"tc.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-tc-v1.ndc-gwg.near\\\\\\\";\\\\nconst HoMDaoId = props.dev\\\\n ? \\\\\\\"hom.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-hom-v1.ndc-gwg.near\\\\\\\";\\\\nconst registry = props.dev\\\\n ? \\\\\\\"registry-v1.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"registry.i-am-human.near\\\\\\\";\\\\n\\\\nconst isCongressDaoID =\\\\n props.daoId === HoMDaoId ||\\\\n props.daoId === CoADaoId ||\\\\n props.daoId === TCDaoId;\\\\n\\\\nlet permissions = [];\\\\nconst isVotingBodyDao = props.daoId === VotingBodyDaoId;\\\\nconst defaultProposalTypes = [\\\\n {\\\\n text: \\\\\\\"Text\\\\\\\",\\\\n value: \\\\\\\"Vote\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Transfer\\\\\\\",\\\\n value: \\\\\\\"Transfer\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Function Call\\\\\\\",\\\\n value: \\\\\\\"FunctionCall\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Add Member To Role\\\\\\\",\\\\n value: \\\\\\\"AddMemberToRole\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Remove Member From Role\\\\\\\",\\\\n value: \\\\\\\"RemoveMemberFromRole\\\\\\\"\\\\n }\\\\n];\\\\n\\\\nconst congressProposalTypes = {\\\\n [HoMDaoId]: [\\\\n {\\\\n text: \\\\\\\"Text\\\\\\\",\\\\n value: \\\\\\\"Text\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Function Call\\\\\\\",\\\\n value: \\\\\\\"FunctionCall\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Budget Request\\\\\\\",\\\\n value: \\\\\\\"Budget\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Motion Request\\\\\\\",\\\\n value: \\\\\\\"Motion\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Funding Request (Single)\\\\\\\",\\\\n value: \\\\\\\"FundingRequest\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Funding Request (Recurrent)\\\\\\\",\\\\n value: \\\\\\\"RecurrentFundingRequest\\\\\\\"\\\\n }\\\\n ],\\\\n [CoADaoId]: [\\\\n {\\\\n text: \\\\\\\"Text\\\\\\\",\\\\n value: \\\\\\\"Text\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Veto House of Merit proposal\\\\\\\",\\\\n value: \\\\\\\"Veto\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Unban previously banned member\\\\\\\",\\\\n value: \\\\\\\"FunctionCall\\\\\\\",\\\\n powerType: \\\\\\\"Unban\\\\\\\"\\\\n }\\\\n ],\\\\n [TCDaoId]: [\\\\n {\\\\n text: \\\\\\\"Text\\\\\\\",\\\\n value: \\\\\\\"Text\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Dismiss member from the house\\\\\\\",\\\\n value: \\\\\\\"Dismiss\\\\\\\"\\\\n }\\\\n ],\\\\n [VotingBodyDaoId]: [\\\\n {\\\\n text: \\\\\\\"Text (Near Consent)\\\\\\\",\\\\n value: \\\\\\\"Text\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Text Super (Near Supermajority Consent)\\\\\\\",\\\\n value: \\\\\\\"TextSuper\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Dismiss\\\\\\\",\\\\n value: \\\\\\\"Dismiss\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Approve Budget\\\\\\\",\\\\n value: \\\\\\\"ApproveBudget\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Veto big budget item\\\\\\\",\\\\n value: \\\\\\\"Veto\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Dissolve House\\\\\\\",\\\\n value: \\\\\\\"Dissolve\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Function Call\\\\\\\",\\\\n value: \\\\\\\"FunctionCall\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Update Bonds\\\\\\\",\\\\n value: \\\\\\\"UpdateBonds\\\\\\\"\\\\n },\\\\n {\\\\n text: \\\\\\\"Update Vote Duration\\\\\\\",\\\\n value: \\\\\\\"UpdateVoteDuration\\\\\\\"\\\\n }\\\\n ]\\\\n};\\\\n\\\\nconst proposalTypes =\\\\n isCongressDaoID || isVotingBodyDao\\\\n ? congressProposalTypes[props.daoId]\\\\n : defaultProposalTypes;\\\\n\\\\nState.init({ members: [], proposalTypes, daoId });\\\\n\\\\nfunction convertCapitalLetterToSpace(inputString) {\\\\n var resultString = inputString.replace(/([A-Z])/g, \\\\\\\" $1\\\\\\\");\\\\n // Remove leading space if present\\\\n if (resultString.charAt(0) === \\\\\\\" \\\\\\\") {\\\\n resultString = resultString.slice(1);\\\\n }\\\\n return resultString;\\\\n}\\\\n\\\\n// fetch proposal types for congress dao\\\\nif (isCongressDaoID) {\\\\n const policy = useCache(\\\\n () => Near.asyncView(daoId, \\\\\\\"get_members\\\\\\\").then((members) => members),\\\\n daoId + \\\\\\\"-processed_congress_members\\\\\\\",\\\\n { subscribe: false }\\\\n );\\\\n if (policy === null) return;\\\\n\\\\n State.update({\\\\n members: policy.members,\\\\n showCreateProposal: policy.members?.includes(accountId)\\\\n });\\\\n} else if (!isVotingBodyDao) {\\\\n const policy = Near.view(daoId, \\\\\\\"get_policy\\\\\\\");\\\\n if (policy === null) return;\\\\n State.update({\\\\n daoPolicy: policy\\\\n });\\\\n}\\\\n\\\\nconst Wrapper = styled.div`\\\\n margin: 16px auto;\\\\n width: 100%;\\\\n max-width: 900px;\\\\n max-height: 100%;\\\\n display: flex;\\\\n flex-direction: column;\\\\n gap: 24px;\\\\n overflow-y: auto;\\\\n\\\\n @media (max-width: 600px) {\\\\n border-radius: 0;\\\\n }\\\\n\\\\n p {\\\\n line-height: 1.4;\\\\n font-weight: 400;\\\\n font-size: 15px;\\\\n margin: 0;\\\\n }\\\\n\\\\n h3 {\\\\n font-weight: 600;\\\\n font-size: 24px;\\\\n color: #1b1b18;\\\\n }\\\\n\\\\n h5 {\\\\n font-size: 12px;\\\\n font-weight: 400;\\\\n line-height: 1.2;\\\\n color: #6c757d;\\\\n }\\\\n`;\\\\n\\\\nconst CloseButton = styled.button`\\\\n display: flex;\\\\n align-items: center;\\\\n justify-content: center;\\\\n color: rgb(27, 27, 24);\\\\n border-radius: 100px;\\\\n height: 40px;\\\\n width: 40px;\\\\n border: none;\\\\n margin: 0;\\\\n font-size: 26px;\\\\n background-color: rgb(246, 246, 245);\\\\n\\\\n &:hover {\\\\n background-color: rgb(243, 243, 242);\\\\n color: rgb(0, 0, 0);\\\\n }\\\\n`;\\\\n\\\\nreturn (\\\\n <Wrapper>\\\\n <div className=\\\\\\\"d-flex gap-3 flex-wrap\\\\\\\">\\\\n <div>\\\\n <h5>DAO</h5>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{ accountId: daoId, tooltip: true }}\\\\n />\\\\n </div>\\\\n <div>\\\\n <h5>Proposer</h5>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{ accountId: accountId, tooltip: true }}\\\\n />\\\\n </div>\\\\n </div>\\\\n <Widget\\\\n src={`astraplusplus.ndctools.near/widget/Common.Components.Select`}\\\\n props={{\\\\n label: \\\\\\\"Proposal Type\\\\\\\",\\\\n noLabel: false,\\\\n placeholder: \\\\\\\"Select a Proposal Type\\\\\\\",\\\\n options: state.proposalTypes,\\\\n value: state.proposalType,\\\\n onChange: (proposalType) => State.update({ ...state, proposalType }),\\\\n validate: () => {\\\\n if (!state.proposalType) {\\\\n throw {\\\\n message: \\\\\\\"Please select a Proposal Type\\\\\\\"\\\\n };\\\\n }\\\\n\\\\n if (\\\\n !proposalTypes.find(\\\\n ({ value }) => state.proposalType.value === value\\\\n )\\\\n ) {\\\\n throw {\\\\n message: \\\\\\\"Please select a valid Proposal Type\\\\\\\"\\\\n };\\\\n }\\\\n },\\\\n error: undefined\\\\n }}\\\\n />\\\\n <div className=\\\\\\\"d-flex flex-column gap-2\\\\\\\">\\\\n {[\\\\\\\"Text\\\\\\\", \\\\\\\"TextSuper\\\\\\\", \\\\\\\"Vote\\\\\\\", \\\\\\\"Budget\\\\\\\", \\\\\\\"Motion\\\\\\\"].includes(\\\\n state.proposalType.value\\\\n ) && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.Text\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n onClose,\\\\n isCongressDaoID,\\\\n isVotingBodyDao,\\\\n registry,\\\\n dev: props.dev,\\\\n powerType: state.proposalType.powerType,\\\\n kind: state.proposalType.value,\\\\n daoPolicy: state.daoPolicy\\\\n }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"Transfer\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.Transfer\\\\\\\"\\\\n props={{ daoId, onClose, daoPolicy: state.daoPolicy }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"AddMemberToRole\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.AddMemberToRole\\\\\\\"\\\\n props={{ daoId, onClose, daoPolicy: state.daoPolicy }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"RemoveMemberFromRole\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.RemoveMemberFromRole\\\\\\\"\\\\n props={{ daoId, onClose, daoPolicy: state.daoPolicy }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"FunctionCall\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.FunctionCall\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n onClose,\\\\n isCongressDaoID,\\\\n registry,\\\\n isVotingBodyDao,\\\\n dev: props.dev,\\\\n powerType: state.proposalType.powerType,\\\\n daoPolicy: state.daoPolicy\\\\n }}\\\\n />\\\\n )}\\\\n {(state.proposalType.value === \\\\\\\"FundingRequest\\\\\\\" ||\\\\n state.proposalType.value === \\\\\\\"RecurrentFundingRequest\\\\\\\") && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.FundingRequest\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n onClose,\\\\n proposalType: state.proposalType.value,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"Veto\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.Veto\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n dev: props.dev,\\\\n registry,\\\\n isHookCall: props.daoId === CoADaoId\\\\n }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"Dismiss\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.Dismiss\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n dev: props.dev,\\\\n registry,\\\\n isHookCall: props.daoId === TCDaoId\\\\n }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"Dissolve\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.Dissolve\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n dev: props.dev,\\\\n registry\\\\n }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"ApproveBudget\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.ApproveBudget\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n dev: props.dev,\\\\n registry\\\\n }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"UpdateBonds\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.UpdateBonds\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n dev: props.dev,\\\\n registry\\\\n }}\\\\n />\\\\n )}\\\\n {state.proposalType.value === \\\\\\\"UpdateVoteDuration\\\\\\\" && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Create.UpdateVoteDuration\\\\\\\"\\\\n props={{\\\\n daoId,\\\\n dev: props.dev,\\\\n registry\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </Wrapper>\\\\n);\\\\n" |
| 7 | }, |
| 8 | "Common.Components.Button": { |
| 9 | "": "const children = props.children ?? \\\\\\\"Button\\\\\\\";\\\\nconst onClick = props.onClick ?? (() => {});\\\\nconst href = props.href;\\\\nconst variant = props.variant ?? \\\\\\\"primary\\\\\\\"; // primary, success, danger\\\\n\\\\nconst tag = href ? \\\\\\\"a\\\\\\\" : \\\\\\\"button\\\\\\\";\\\\n\\\\nconst Wrapper = styled[tag]`\\\\n display: inline-flex;\\\\n align-items: center;\\\\n justify-content: center;\\\\n gap: 8px;\\\\n border-radius: 100px;\\\\n font-weight: 600;\\\\n font-size: 14px;\\\\n line-height: 15px;\\\\n text-align: center;\\\\n cursor: pointer;\\\\n white-space: nowrap;\\\\n padding: 12px 32px;\\\\n border: 1px solid #d7dbdf;\\\\n\\\\n color: ${(p) => {\\\\n switch (p.variant) {\\\\n case \\\\\\\"primary\\\\\\\":\\\\n return \\\\\\\"#11181c\\\\\\\";\\\\n case \\\\\\\"success\\\\\\\":\\\\n return \\\\\\\"#000\\\\\\\";\\\\n case \\\\\\\"danger\\\\\\\":\\\\n return \\\\\\\"#fff\\\\\\\";\\\\n }\\\\n }} !important;\\\\n background: ${(p) => {\\\\n switch (p.variant) {\\\\n case \\\\\\\"primary\\\\\\\":\\\\n return \\\\\\\"#FBFCFD\\\\\\\";\\\\n case \\\\\\\"success\\\\\\\":\\\\n return \\\\\\\"#59e692\\\\\\\";\\\\n case \\\\\\\"danger\\\\\\\":\\\\n return \\\\\\\"#e5484d\\\\\\\";\\\\n }\\\\n }};\\\\n\\\\n &:hover,\\\\n &:focus {\\\\n text-decoration: none;\\\\n outline: none;\\\\n opacity: 0.9;\\\\n }\\\\n\\\\n &:disabled {\\\\n opacity: 0.7;\\\\n cursor: not-allowed;\\\\n }\\\\n`;\\\\n\\\\nreturn (\\\\n <Wrapper onClick={() => onClick} href={href} variant={variant} {...props}>\\\\n {children}\\\\n </Wrapper>\\\\n);" |
| 10 | }, |
| 11 | "Common.Components.Select": { |
| 12 | "": "const label = props.label ?? \\\\\\\"Label\\\\\\\";\\\\nconst noLabel = props.noLabel ?? false;\\\\nconst placeholder = props.placeholder ?? \\\\\\\"Select an option\\\\\\\";\\\\nconst value = props.value ?? \\\\\\\"\\\\\\\";\\\\nconst options = props.options ?? [];\\\\nconst onChange = props.onChange ?? (() => {});\\\\nconst validate = props.validate ?? (() => {});\\\\nconst error = props.error ?? \\\\\\\"\\\\\\\";\\\\n\\\\nconst Container = styled.div`\\\\n display: flex;\\\\n flex-direction: column;\\\\n align-items: flex-start;\\\\n justify-content: flex-start;\\\\n padding: 0px;\\\\n gap: 0.45em;\\\\n width: 100%;\\\\n`;\\\\n\\\\nconst Label = styled.label`\\\\n font-size: 14px;\\\\n font-weight: 500;\\\\n line-height: 1.2;\\\\n color: #6c757d;\\\\n`;\\\\n\\\\nconst Error = styled.span`\\\\n display: inline-block;\\\\n font-style: normal;\\\\n font-weight: 400;\\\\n font-size: 0.75em;\\\\n line-height: 1.25em;\\\\n color: #ff4d4f;\\\\n height: 0;\\\\n overflow: hidden;\\\\n transition: height 0.3s ease-in-out;\\\\n\\\\n &.show {\\\\n height: 1.25em;\\\\n }\\\\n`;\\\\n\\\\nconst Input = styled.div`\\\\n box-sizing: border-box;\\\\n display: flex;\\\\n flex-direction: row;\\\\n align-items: center;\\\\n justify-content: space-between;\\\\n padding: 0.5em 0.75em;\\\\n gap: 0.5em;\\\\n background: #ffffff;\\\\n border: 1px solid #d0d5dd;\\\\n box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);\\\\n border-radius: 4px;\\\\n color: #101828;\\\\n width: 100%;\\\\n`;\\\\n\\\\nconst Placeholder = styled.span`\\\\n color: #a0a3a8;\\\\n`;\\\\n\\\\nconst scaleOut = styled.keyframes`\\\\n from {\\\\n transform: scaleY(0);\\\\n }\\\\n to {\\\\n transform: scaleY(1);\\\\n }\\\\n`;\\\\n\\\\nconst Content = styled.div`\\\\n display: flex;\\\\n flex-direction: column;\\\\n align-items: flex-start;\\\\n justify-content: flex-start;\\\\n padding: 0;\\\\n gap: 0.5em;\\\\n width: 100%;\\\\n border: 1px solid #d0d5dd;\\\\n border-radius: 4px;\\\\n background: #ffffff;\\\\n z-index: 3 !important;\\\\n\\\\n /* &[data-state=\\\\\\\"open\\\\\\\"] { */\\\\n /* animation: ${scaleOut} 0.2s ease-in-out; */\\\\n /* } */\\\\n /**/\\\\n /* &[data-state=\\\\\\\"closed\\\\\\\"] { */\\\\n /* animation: ${scaleOut} 0.2s ease-in-out reverse; */\\\\n /* } */\\\\n`;\\\\n\\\\nconst Viewport = styled.div`\\\\n display: flex;\\\\n flex-direction: column;\\\\n align-items: flex-start;\\\\n justify-content: flex-start;\\\\n padding: 0;\\\\n width: 100%;\\\\n`;\\\\n\\\\nconst Item = styled.button`\\\\n display: flex;\\\\n flex-direction: row;\\\\n align-items: center;\\\\n justify-content: space-between;\\\\n padding: 0.5em 0.75em;\\\\n gap: 0.5em;\\\\n width: 100%;\\\\n cursor: pointer;\\\\n background: transparent;\\\\n border: none;\\\\n transition: background 0.2s ease-in-out;\\\\n\\\\n &:nth-child(n + 1) {\\\\n border-top: 1px solid #d0d5dd;\\\\n }\\\\n\\\\n &:hover {\\\\n background: #d0d5dd;\\\\n boder: none;\\\\n }\\\\n\\\\n &:focus {\\\\n outline: none;\\\\n }\\\\n`;\\\\n\\\\nreturn (\\\\n <Container>\\\\n {noLabel ? <></> : <Label>{label}</Label>}\\\\n <Select.Root\\\\n value={value?.value}\\\\n onValueChange={(value) =>\\\\n onChange(options.find((option) => option.value === value))\\\\n }\\\\n >\\\\n <Select.Trigger asChild={true}>\\\\n <Input>\\\\n <Select.Value\\\\n aria-label={value.value}\\\\n placeholder={<Placeholder>{placeholder}</Placeholder>}\\\\n />\\\\n <Select.Icon>\\\\n <svg\\\\n width=\\\\\\\"12\\\\\\\"\\\\n height=\\\\\\\"8\\\\\\\"\\\\n viewBox=\\\\\\\"0 0 12 8\\\\\\\"\\\\n fill=\\\\\\\"none\\\\\\\"\\\\n xmlns=\\\\\\\"http://www.w3.org/2000/svg\\\\\\\"\\\\n >\\\\n <path\\\\n d=\\\\\\\"M1 1.5L6 6.5L11 1.5\\\\\\\"\\\\n stroke=\\\\\\\"currentColor\\\\\\\"\\\\n stroke-width=\\\\\\\"1.66667\\\\\\\"\\\\n stroke-linecap=\\\\\\\"round\\\\\\\"\\\\n stroke-linejoin=\\\\\\\"round\\\\\\\"\\\\n />\\\\n </svg>\\\\n </Select.Icon>\\\\n </Input>\\\\n </Select.Trigger>\\\\n\\\\n <Select.Content asChild={true}>\\\\n <Content>\\\\n <Select.Viewport asChild={true}>\\\\n <Viewport>\\\\n {props.options.map(({ text, value }) => (\\\\n <Select.Item value={value} asChild={true}>\\\\n <Item>\\\\n <Select.ItemText>{text}</Select.ItemText>\\\\n <Select.ItemIndicator>\\\\n <svg\\\\n width=\\\\\\\"15\\\\\\\"\\\\n height=\\\\\\\"15\\\\\\\"\\\\n viewBox=\\\\\\\"0 0 15 15\\\\\\\"\\\\n fill=\\\\\\\"none\\\\\\\"\\\\n xmlns=\\\\\\\"http://www.w3.org/2000/svg\\\\\\\"\\\\n >\\\\n <path\\\\n d=\\\\\\\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\\\\\\\"\\\\n fill=\\\\\\\"currentColor\\\\\\\"\\\\n fill-rule=\\\\\\\"evenodd\\\\\\\"\\\\n clip-rule=\\\\\\\"evenodd\\\\\\\"\\\\n />\\\\n </svg>\\\\n </Select.ItemIndicator>\\\\n </Item>\\\\n </Select.Item>\\\\n ))}\\\\n </Viewport>\\\\n </Select.Viewport>\\\\n </Content>\\\\n </Select.Content>\\\\n </Select.Root>\\\\n </Container>\\\\n);" |
| 13 | }, |
| 14 | "DAO.Proposal.Create.Text": { |
| 15 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId ?? \\\\\\\"multi.sputnik-dao.near\\\\\\\";\\\\nconst onClose = props.onClose;\\\\nconst powerType = props.powerType;\\\\nconst isCongressDaoID = props.isCongressDaoID;\\\\nconst isVotingBodyDao = props.isVotingBodyDao;\\\\nconst registry = props.registry;\\\\nconst kind = props.kind;\\\\nconst policy = props.daoPolicy;\\\\n\\\\nconst HoMDaoId = props.dev\\\\n ? \\\\\\\"hom.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-hom-v1.ndc-gwg.near\\\\\\\";\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n description: state.description,\\\\n error: state.error,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nconst handleProposal = () => {\\\\n if (!state.description) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n const gas = 200000000000000;\\\\n const deposit = state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000;\\\\n const args = isCongressDaoID\\\\n ? {\\\\n description: state.description,\\\\n kind: \\\\\\\"Text\\\\\\\"\\\\n }\\\\n : {\\\\n proposal: {\\\\n description: state.description,\\\\n kind: \\\\\\\"Vote\\\\\\\"\\\\n }\\\\n };\\\\n if (isVotingBodyDao) {\\\\n const args = JSON.stringify({\\\\n description: state.description,\\\\n kind: kind,\\\\n caller: accountId\\\\n });\\\\n\\\\n if (!state.proposalQueue) {\\\\n State.update({\\\\n error: \\\\\\\"Please select proposal queue\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n Near.call([\\\\n {\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: args\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ]);\\\\n } else {\\\\n const calls = [\\\\n {\\\\n contractName: daoId,\\\\n methodName:\\\\n isCongressDaoID || isVotingBodyDao\\\\n ? \\\\\\\"create_proposal\\\\\\\"\\\\n : \\\\\\\"add_proposal\\\\\\\",\\\\n args: args,\\\\n gas: gas,\\\\n deposit: policy?.proposal_bond || 100000000000000000000000\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n }\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n {isVotingBodyDao && (\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n This proposal requires\\\\n <a\\\\n href={`https://github.com/near-ndc/voting-v1/blob/master/voting_body/README.md?#quorums-and-thresholds`}\\\\n target=\\\\\\\"_blank\\\\\\\"\\\\n rel=\\\\\\\"noopener noreferrer\\\\\\\"\\\\n style={{ color: \\\\\\\"rgb(68, 152, 224)\\\\\\\" }}\\\\n >\\\\n Near {kind === \\\\\\\"TextSuper\\\\\\\" && \\\\\\\" Super\\\\\\\"} Consent.\\\\n </a>\\\\n </div>\\\\n )}\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Text\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 16 | }, |
| 17 | "DAO.Proposal.Create.Veto": { |
| 18 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId;\\\\nconst isHookCall = props.isHookCall;\\\\nconst onClose = props.onClose;\\\\nconst registry = props.registry;\\\\nconst HoMDaoId = props.dev\\\\n ? \\\\\\\"hom.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-hom-v1.ndc-gwg.near\\\\\\\";\\\\nconst house = props.house;\\\\nconst proposalID = props.proposalID;\\\\nconst description = props.description;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nState.init({\\\\n prop_id: proposalID, // proposal id\\\\n dao: house,\\\\n error: null,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n description: description ?? \\\\\\\"\\\\\\\",\\\\n notificationsData: {}\\\\n});\\\\n\\\\nconst handleProposal = () => {\\\\n let error;\\\\n let args;\\\\n const gas = 20000000000000;\\\\n const deposit = state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000;\\\\n\\\\n if (!isHookCall) {\\\\n if (isEmpty(state.dao) || !isNearAddress(state.dao))\\\\n error = \\\\\\\"Please enter a valid DAO ID\\\\\\\";\\\\n if (isEmpty(state.prop_id)) error = \\\\\\\"Please enter a proposal ID\\\\\\\";\\\\n if (isEmpty(state.description)) error = \\\\\\\"Please enter a description\\\\\\\";\\\\n if (!state.proposalQueue) error = \\\\\\\"Please select proposal queue\\\\\\\";\\\\n\\\\n if (error) {\\\\n State.update({ error });\\\\n return;\\\\n }\\\\n }\\\\n const calls = [];\\\\n if (isHookCall) {\\\\n const fc_args = Buffer.from(\\\\n JSON.stringify({ id: parseInt(state.prop_id) }),\\\\n \\\\\\\"utf-8\\\\\\\"\\\\n ).toString(\\\\\\\"base64\\\\\\\");\\\\n\\\\n args = {\\\\n kind: {\\\\n FunctionCall: {\\\\n receiver_id: HoMDaoId,\\\\n actions: [\\\\n {\\\\n method_name: \\\\\\\"veto_hook\\\\\\\",\\\\n args: fc_args,\\\\n deposit: \\\\\\\"100000000000000000000000\\\\\\\",\\\\n gas: \\\\\\\"50000000000000\\\\\\\"\\\\n }\\\\n ]\\\\n }\\\\n },\\\\n description: state.description\\\\n };\\\\n calls.push({\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"create_proposal\\\\\\\",\\\\n args: args,\\\\n deposit: 100000000000000000000000,\\\\n gas: 200000000000000\\\\n });\\\\n } else {\\\\n args = JSON.stringify({\\\\n description: state.description,\\\\n kind: {\\\\n Veto: {\\\\n prop_id: parseInt(state.prop_id),\\\\n dao: state.dao\\\\n }\\\\n },\\\\n caller: accountId\\\\n });\\\\n\\\\n calls.push({\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: args\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n });\\\\n }\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangePropID = (prop_id) => {\\\\n State.update({\\\\n prop_id,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDao = (dao) => {\\\\n State.update({\\\\n dao,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n {!props.isHookCall && (\\\\n <>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.CongressHouseDropdown\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n house: state.dao,\\\\n label: \\\\\\\"House\\\\\\\",\\\\n placeholder: \\\\\\\"Select house account\\\\\\\",\\\\n onUpdate: onChangeDao,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n </>\\\\n )}\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal ID</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n value={state.prop_id}\\\\n onChange={(e) => onChangePropID(e.target.value)}\\\\n min=\\\\\\\"0\\\\\\\"\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Veto\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 19 | }, |
| 20 | "DAO.Funds.TransactionLine": { |
| 21 | "": "const transfer = props.transfer;\\\\nconst daoId = props.daoId;\\\\nconst type = props.type;\\\\n\\\\nconst direction = transfer.sender == daoId ? \\\\\\\"out\\\\\\\" : \\\\\\\"in\\\\\\\";\\\\nconst explorerUrl = \\\\\\\"https://explorer.near.org\\\\\\\";\\\\n\\\\n// convert timestamp from ns to ms\\\\nconst timestampMillis = Big(transfer.timestamp).div(1000000);\\\\nconst date = new Date(timestampMillis.toNumber()).toLocaleString();\\\\n\\\\nconst ellipsis = (str, length) => {\\\\n if (str.length <= length) {\\\\n return str;\\\\n }\\\\n const mid = Math.floor(length / 2);\\\\n return str.slice(0, mid) + \\\\\\\"...\\\\\\\" + str.slice(str.length - mid);\\\\n};\\\\n\\\\nlet proposalId = null;\\\\n\\\\nif (direction === \\\\\\\"out\\\\\\\") {\\\\n // const res = fetch(\\\\\\\"https://archival-rpc.mainnet.near.org\\\\\\\", {\\\\n // method: \\\\\\\"POST\\\\\\\",\\\\n // headers: {\\\\n // \\\\\\\"Content-Type\\\\\\\": \\\\\\\"application/json\\\\\\\",\\\\n // },\\\\n // body: JSON.stringify({\\\\n // jsonrpc: \\\\\\\"2.0\\\\\\\",\\\\n // id: \\\\\\\"dontcare\\\\\\\",\\\\n // method: \\\\\\\"EXPERIMENTAL_tx_status\\\\\\\",\\\\n // params: [transfer.transaction_id, transfer.sender],\\\\n // }),\\\\n // });\\\\n\\\\n // const argsBase64 = res.body.result.transaction.actions[0].FunctionCall.args;\\\\n // if (argsBase64) {\\\\n // const args = JSON.parse(\\\\n // Buffer.from(argsBase64, \\\\\\\"base64\\\\\\\").toString(\\\\\\\"utf-8\\\\\\\")\\\\n // );\\\\n // proposalId = args.id;\\\\n // }\\\\n const res = fetch(\\\\n \\\\\\\"https://api.pikespeak.ai/tx/graph-by-hash/\\\\\\\" + transfer.transaction_id,\\\\n {\\\\n method: \\\\\\\"GET\\\\\\\",\\\\n headers: {\\\\n \\\\\\\"Content-Type\\\\\\\": \\\\\\\"application/json\\\\\\\",\\\\n \\\\\\\"x-api-key\\\\\\\": \\\\\\\"36f2b87a-7ee6-40d8-80b9-5e68e587a5b5\\\\\\\"\\\\n }\\\\n }\\\\n );\\\\n\\\\n proposalId =\\\\n res.body[0].transaction_graph.transaction.actions[0].action.args.id;\\\\n}\\\\n\\\\nconst TransferDirectionIcon = styled.div`\\\\n background-color: ${(props) =>\\\\n props.direction == \\\\\\\"in\\\\\\\" ? \\\\\\\"#5BC65F\\\\\\\" : \\\\\\\"#DD5E56\\\\\\\"};\\\\n color: white;\\\\n border-radius: 50%;\\\\n margin-right: 1rem;\\\\n height: 50px;\\\\n width: 50px;\\\\n min-width: 50px;\\\\n display: flex;\\\\n align-items: center;\\\\n justify-content: center;\\\\n font-size: 28px;\\\\n`;\\\\n\\\\nconst Container = styled.div`\\\\n display: grid;\\\\n grid-template-columns: 50px auto minmax(120px, 160px) minmax(120px, 160px);\\\\n grid-template-rows: 1fr;\\\\n grid-column-gap: 1rem;\\\\n align-items: center;\\\\n`;\\\\n\\\\ncons;\\\\n\\\\nreturn (\\\\n <Container>\\\\n <TransferDirectionIcon\\\\n direction={direction}\\\\n title={direction == \\\\\\\"in\\\\\\\" ? \\\\\\\"Incoming\\\\\\\" : \\\\\\\"Outgoing\\\\\\\"}\\\\n >\\\\n {direction == \\\\\\\"out\\\\\\\" ? (\\\\n <i className=\\\\\\\"bi bi-arrow-up-short\\\\\\\"></i>\\\\n ) : (\\\\n <i className=\\\\\\\"bi bi-arrow-down-short\\\\\\\"></i>\\\\n )}\\\\n </TransferDirectionIcon>\\\\n <div className=\\\\\\\"d-flex flex-column text-start tx-info gap-1 justify-content-start\\\\\\\">\\\\n <span\\\\n title={direction == \\\\\\\"out\\\\\\\" ? transfer.receiver : transfer.sender}\\\\n >\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId:\\\\n direction == \\\\\\\"out\\\\\\\"\\\\n ? transfer.receiver\\\\n : transfer.sender\\\\n }}\\\\n />\\\\n </span>\\\\n <a\\\\n href={`${explorerUrl}/transactions/${transfer.transaction_id}`}\\\\n target=\\\\\\\"_blank\\\\\\\"\\\\n rel=\\\\\\\"noreferrer\\\\\\\"\\\\n title={transfer.transaction_id}\\\\n >\\\\n {ellipsis(transfer.transaction_id, 10)}\\\\n <i className=\\\\\\\"bi bi-box-arrow-up-right ms-1\\\\\\\"></i>\\\\n </a>\\\\n <span>{date}</span>\\\\n </div>\\\\n <div className=\\\\\\\"d-flex justify-content-end\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"nearui.near/widget/Element.Token\\\\\\\"\\\\n props={{\\\\n amountWithDecimals:\\\\n direction == \\\\\\\"out\\\\\\\" ? -transfer.amount : transfer.amount,\\\\n address: type == \\\\\\\"ft\\\\\\\" ? transfer.contract : \\\\\\\"\\\\\\\"\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"d-flex justify-content-end\\\\\\\">\\\\n {proposalId && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Layout.Modal\\\\\\\"\\\\n props={{\\\\n toggle: (\\\\n <Widget\\\\n src=\\\\\\\"nearui.near/widget/Input.Button\\\\\\\"\\\\n props={{\\\\n children: `Proposal #${proposalId}`,\\\\n variant: \\\\\\\"secondary outline\\\\\\\",\\\\n size: \\\\\\\"sm\\\\\\\"\\\\n }}\\\\n />\\\\n ),\\\\n content: (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposals.index\\\\\\\"\\\\n props={{ daoId: daoId, proposalId: proposalId }}\\\\n />\\\\n )\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </Container>\\\\n);\\\\n" |
| 22 | }, |
| 23 | "Common.Components.Markdown": { |
| 24 | "": "const initialText = props.initialText ?? \\\\\\\"# Hello World\\\\\\\\n\\\\\\\\n\\\\\\\";\\\\nconst height = props.height ?? \\\\\\\"500px\\\\\\\";\\\\n\\\\nconst code = `\\\\n<script src=\\\\\\\"https://unpkg.com/react@18/umd/react.development.js\\\\\\\" crossorigin></script>\\\\n<script src=\\\\\\\"https://unpkg.com/react-dom@18/umd/react-dom.development.js\\\\\\\" crossorigin></script>\\\\n<script src=\\\\\\\"https://unpkg.com/[email protected]/lib/index.js\\\\\\\" crossorigin></script>\\\\n<link rel=\\\\\\\"stylesheet\\\\\\\" href=\\\\\\\"https://unpkg.com/[email protected]/lib/index.css\\\\\\\" />\\\\n\\\\n\\\\n<div id=\\\\\\\"react-root\\\\\\\"></div>\\\\n\\\\n<script>\\\\nfunction TestReact(props) {\\\\n const [value, setValue] = React.useState(props.initialText || \\\\\\\"\\\\\\\");\\\\n return React.createElement(ReactMarkdownEditorLite.default, {\\\\n value,\\\\n view: { menu: true, md: true, html: false },\\\\n canView: { menu: true, md: false, html: false, fullScreen: false, hideMenu: true },\\\\n onChange: ({ text }) => {\\\\n setValue(text);\\\\n window.top.postMessage(text, \\\\\\\"*\\\\\\\");\\\\n },\\\\n renderHTML: () => {},\\\\n className: \\\\\\\"full\\\\\\\",\\\\n }); \\\\n}\\\\n\\\\nconst domContainer = document.querySelector(\\\\\\'#react-root\\\\\\');\\\\nconst root = ReactDOM.createRoot(domContainer);\\\\n\\\\nwindow.addEventListener(\\\\\\\"message\\\\\\\", (event) => {\\\\n root.render(React.createElement(TestReact, {\\\\n initialText: event.data,\\\\n }));\\\\n});\\\\n\\\\n</script>\\\\n`;\\\\n\\\\nreturn (\\\\n <iframe\\\\n className=\\\\\\\"w-100\\\\\\\"\\\\n style={{ \\\\n height: height,\\\\n }}\\\\n srcDoc={code}\\\\n message={initialText}\\\\n onMessage={props.onChange}\\\\n />\\\\n);" |
| 25 | }, |
| 26 | "DAO.Proposal.Create.Dismiss": { |
| 27 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId;\\\\nconst onClose = props.onClose;\\\\nconst registry = props.registry;\\\\nconst isHookCall = props.isHookCall;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n dao: null,\\\\n member: null,\\\\n error: null,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n description: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nconst handleProposal = () => {\\\\n let error;\\\\n let args;\\\\n const gas = 20000000000000;\\\\n const deposit = state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000;\\\\n\\\\n if (!isHookCall) {\\\\n if (isEmpty(state.dao) || !isNearAddress(state.dao))\\\\n error = \\\\\\\"Please select a house\\\\\\\";\\\\n if (isEmpty(state.member) || !isNearAddress(state.member))\\\\n error = \\\\\\\"Please enter a valid member ID\\\\\\\";\\\\n if (isEmpty(state.description)) error = \\\\\\\"Please enter a description\\\\\\\";\\\\n if (!state.proposalQueue) error = \\\\\\\"Please select proposal queue\\\\\\\";\\\\n\\\\n if (error) {\\\\n State.update({ error });\\\\n return;\\\\n }\\\\n }\\\\n const calls = [];\\\\n if (isHookCall) {\\\\n const fc_args = Buffer.from(\\\\n JSON.stringify({ member: state.member }),\\\\n \\\\\\\"utf-8\\\\\\\"\\\\n ).toString(\\\\\\\"base64\\\\\\\");\\\\n\\\\n args = {\\\\n kind: {\\\\n FunctionCall: {\\\\n receiver_id: state.dao,\\\\n actions: [\\\\n {\\\\n method_name: \\\\\\\"dismiss_hook\\\\\\\",\\\\n args: fc_args,\\\\n gas: \\\\\\\"50000000000000\\\\\\\",\\\\n deposit: \\\\\\\"0\\\\\\\"\\\\n }\\\\n ]\\\\n }\\\\n },\\\\n description: state.description\\\\n };\\\\n calls.push({\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"create_proposal\\\\\\\",\\\\n args: args,\\\\n deposit: 100000000000000000000000,\\\\n gas: 200000000000000\\\\n });\\\\n } else {\\\\n const args = JSON.stringify({\\\\n description: state.description,\\\\n kind: { Dismiss: { dao: state.dao, member: state.member } },\\\\n caller: accountId\\\\n });\\\\n\\\\n calls.push({\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: args\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n });\\\\n }\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangeDao = (dao) => {\\\\n State.update({\\\\n dao,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeMember = (member) => {\\\\n State.update({\\\\n member,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n {!isHookCall && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n )}\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.CongressHouseDropdown\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n label: \\\\\\\"House\\\\\\\",\\\\n placeholder: \\\\\\\"Select house account\\\\\\\",\\\\n onUpdate: onChangeDao,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Member</h5>\\\\n <Widget\\\\n src={\\\\n \\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.AccountAutoComplete\\\\\\\"\\\\n }\\\\n props={{\\\\n placeholder: \\\\\\\"Specify member account\\\\\\\",\\\\n accountId: state.member,\\\\n onChange: onChangeMember\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Dismiss\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 28 | }, |
| 29 | "DAO.Proposal.Create.Dissolve": { |
| 30 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId;\\\\nconst onClose = props.onClose;\\\\nconst registry = props.registry;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n dao: null,\\\\n error: null,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n description: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nconst handleProposal = () => {\\\\n if (isEmpty(state.dao) || !isNearAddress(state.dao)) {\\\\n State.update({\\\\n error: \\\\\\\"Please select a house\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 20000000000000;\\\\n const deposit = state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000;\\\\n\\\\n const args = JSON.stringify({\\\\n description: state.description,\\\\n kind: { Dissolve: { dao: state.dao } },\\\\n caller: accountId\\\\n });\\\\n\\\\n const calls = [\\\\n {\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: args\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangeDao = (dao) => {\\\\n State.update({\\\\n dao,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.CongressHouseDropdown\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n label: \\\\\\\"House\\\\\\\",\\\\n placeholder: \\\\\\\"Select house account\\\\\\\",\\\\n onUpdate: onChangeDao\\\\n }}\\\\n />\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Dissolve\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 31 | }, |
| 32 | "DAO.Proposal.Create.Transfer": { |
| 33 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId ?? \\\\\\\"multi.sputnik-dao.near\\\\\\\";\\\\nconst onClose = props.onClose;\\\\nconst policy = props.daoPolicy;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n receiver_id: state.receiver_id,\\\\n amount: state.amount,\\\\n tokenAddress: state.tokenAddress || \\\\\\\"\\\\\\\",\\\\n error: state.error,\\\\n description: state.description,\\\\n notificationsData: {},\\\\n ftMetadata: null,\\\\n storage: undefined\\\\n});\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nconst handleProposal = () => {\\\\n if (!state.amount || state.amount <= 0) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid amount\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (\\\\n !state.receiver_id ||\\\\n receiver_id === \\\\\\\"\\\\\\\" ||\\\\n !isNearAddress(state.receiver_id)\\\\n ) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid recipient\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (state.tokenAddress !== \\\\\\\"\\\\\\\" && !isNearAddress(state.tokenAddress)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid token address\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 200000000000000;\\\\n const deposit = policy?.proposal_bond || 100000000000000000000000;\\\\n\\\\n let ftMetadata = {\\\\n decimals: 24\\\\n };\\\\n if (state.tokenAddress !== \\\\\\\"\\\\\\\") {\\\\n ftMetadata = state.ftMetadata;\\\\n }\\\\n\\\\n const amountInYocto = Big(state.amount)\\\\n .mul(Big(10).pow(ftMetadata.decimals))\\\\n .toFixed();\\\\n\\\\n const calls = [\\\\n {\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"add_proposal\\\\\\\",\\\\n args: {\\\\n proposal: {\\\\n description: state.description ?? defaultDescription,\\\\n kind: {\\\\n Transfer: {\\\\n token_id: state.tokenAddress,\\\\n receiver_id: state.receiver_id,\\\\n amount: amountInYocto\\\\n }\\\\n }\\\\n }\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.storage === null && state.tokenAddress) {\\\\n const depositInYocto = Big(0.125).mul(Big(10).pow(24)).toFixed();\\\\n calls.push({\\\\n contractName: state.tokenAddress,\\\\n methodName: \\\\\\\"storage_deposit\\\\\\\",\\\\n args: {\\\\n account_id: state.receiver_id,\\\\n registration_only: true\\\\n },\\\\n gas: gas,\\\\n deposit: depositInYocto\\\\n });\\\\n }\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nuseEffect(() => {\\\\n if (\\\\n state.tokenAddress &&\\\\n state.receiver_id &&\\\\n isNearAddress(state.receiver_id)\\\\n ) {\\\\n Near.asyncView(state.tokenAddress, \\\\\\\"ft_metadata\\\\\\\", {}).then((ftMetadata) => {\\\\n State.update({\\\\n ftMetadata\\\\n });\\\\n });\\\\n Near.asyncView(state.tokenAddress, \\\\\\\"storage_balance_of\\\\\\\", {\\\\n account_id: state.receiver_id\\\\n }).then((storage) => {\\\\n State.update({\\\\n storage\\\\n });\\\\n });\\\\n }\\\\n}, [state.receiver_id, state.tokenAddress]);\\\\n\\\\nconst onChangeRecipient = (receiver_id) => {\\\\n State.update({\\\\n receiver_id,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeAmount = (amount) => {\\\\n State.update({\\\\n amount,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeToken = (tokenAddress) => {\\\\n State.update({\\\\n tokenAddress,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription = `Transfer proposal`;\\\\n\\\\n// near token icon\\\\nconst NEAR = () => {\\\\n return (\\\\n <svg\\\\n width={\\\\\\\"32px\\\\\\\"}\\\\n height={\\\\\\\"32px\\\\\\\"}\\\\n viewBox=\\\\\\\"0 0 32 32\\\\\\\"\\\\n fill=\\\\\\\"none\\\\\\\"\\\\n xmlns=\\\\\\\"http://www.w3.org/2000/svg\\\\\\\"\\\\n >\\\\n <circle cx=\\\\\\\"16\\\\\\\" cy=\\\\\\\"16\\\\\\\" r=\\\\\\\"16\\\\\\\" fill=\\\\\\\"black\\\\\\\"></circle>\\\\n <g clip-path=\\\\\\\"url(#clip0000000003)\\\\\\\">\\\\n <path\\\\n d=\\\\\\\"M20.8422 8.84471L17.4978 13.776C17.4501 13.847 17.43 13.9328 17.4411 14.0174C17.4522 14.102 17.4938 14.1798 17.5582 14.2363C17.6225 14.2928 17.7053 14.3243 17.7913 14.3249C17.8772 14.3254 17.9604 14.2951 18.0256 14.2395L21.3178 11.4036C21.3371 11.3865 21.361 11.3753 21.3866 11.3714C21.4122 11.3675 21.4383 11.3711 21.4619 11.3818C21.4855 11.3924 21.5054 11.4096 21.5193 11.4314C21.5331 11.4531 21.5403 11.4783 21.54 11.504V20.3824C21.54 20.4095 21.5316 20.4361 21.5158 20.4583C21.5001 20.4806 21.4779 20.4975 21.4522 20.5068C21.4265 20.516 21.3985 20.5172 21.3721 20.5102C21.3456 20.5031 21.322 20.4882 21.3044 20.4673L11.3533 8.63726C11.1933 8.44956 10.994 8.29873 10.7693 8.19525C10.5446 8.09178 10.2999 8.03815 10.0522 8.03809H9.70444C9.2524 8.03809 8.81887 8.21642 8.49922 8.53386C8.17957 8.8513 8 9.28185 8 9.73078V22.2351C8 22.684 8.17957 23.1145 8.49922 23.432C8.81887 23.7494 9.2524 23.9277 9.70444 23.9277V23.9277C9.99591 23.9278 10.2825 23.8537 10.537 23.7125C10.7914 23.5713 11.0051 23.3677 11.1578 23.1211L14.5022 18.1898C14.5499 18.1188 14.57 18.033 14.5589 17.9484C14.5478 17.8638 14.5062 17.7861 14.4418 17.7295C14.3775 17.673 14.2947 17.6415 14.2087 17.641C14.1228 17.6404 14.0396 17.6707 13.9744 17.7264L10.6822 20.5622C10.6629 20.5794 10.639 20.5906 10.6134 20.5944C10.5878 20.5983 10.5617 20.5947 10.5381 20.5841C10.5145 20.5734 10.4946 20.5562 10.4807 20.5345C10.4669 20.5128 10.4597 20.4875 10.46 20.4618V11.5813C10.46 11.5541 10.4684 11.5276 10.4842 11.5053C10.4999 11.483 10.5221 11.4661 10.5478 11.4568C10.5735 11.4476 10.6015 11.4464 10.6279 11.4534C10.6544 11.4605 10.678 11.4755 10.6956 11.4963L20.6456 23.3286C20.8056 23.5163 21.0049 23.6671 21.2296 23.7706C21.4543 23.874 21.699 23.9277 21.9467 23.9277H22.2944C22.5184 23.9279 22.7401 23.8842 22.947 23.7992C23.154 23.7142 23.342 23.5895 23.5004 23.4324C23.6588 23.2752 23.7844 23.0885 23.8702 22.8831C23.9559 22.6776 24 22.4574 24 22.2351V9.73078C24 9.28185 23.8204 8.8513 23.5008 8.53386C23.1811 8.21642 22.7476 8.03809 22.2956 8.03809C22.0041 8.03801 21.7175 8.11211 21.4631 8.25332C21.2086 8.39453 20.9949 8.59814 20.8422 8.84471V8.84471Z\\\\\\\"\\\\n fill=\\\\\\\"white\\\\\\\"\\\\n ></path>\\\\n </g>\\\\n <defs>\\\\n <clipPath id=\\\\\\\"clip00033\\\\\\\">\\\\n <rect\\\\n width=\\\\\\\"16\\\\\\\"\\\\n height=\\\\\\\"16\\\\\\\"\\\\n fill=\\\\\\\"white\\\\\\\"\\\\n transform=\\\\\\\"translate(8 7.9834)\\\\\\\"\\\\n ></rect>\\\\n </clipPath>\\\\n </defs>\\\\n </svg>\\\\n );\\\\n};\\\\n\\\\n\\\\nlet res = fetch(`https://api.pikespeak.ai/account/balance/${daoId}`, {\\\\n method: \\\\\\\"GET\\\\\\\",\\\\n headers: {\\\\n \\\\\\\"Content-Type\\\\\\\": \\\\\\\"application/json\\\\\\\",\\\\n \\\\\\\"x-api-key\\\\\\\": \\\\\\\"36f2b87a-7ee6-40d8-80b9-5e68e587a5b5\\\\\\\"\\\\n }\\\\n});\\\\n\\\\nif (!res) {\\\\n return <Widget src=\\\\\\\"nearui.near/widget/Feedback.Spinner\\\\\\\" />;\\\\n}\\\\nif (res.body && Array.isArray(res.body)) {\\\\n res = res.body\\\\n ?.map((a) => {\\\\n if (a.symbol === \\\\\\\"NEAR [Storage]\\\\\\\") {\\\\n return null;\\\\n }\\\\n const isNEAR = a.contract === \\\\\\\"Near\\\\\\\";\\\\n return {\\\\n text: (\\\\n <div style={{ gap: 10 }} className=\\\\\\\"d-flex align-items-center\\\\\\\">\\\\n <div style={{ gap: 4 }} className=\\\\\\\"d-flex align-items-center\\\\\\\">\\\\n {!isNEAR ? (\\\\n <img width=\\\\\\\"32px\\\\\\\" height=\\\\\\\"32px\\\\\\\" src={a.icon} />\\\\n ) : (\\\\n <NEAR />\\\\n )}\\\\n <div>{a.symbol}</div>\\\\n </div>\\\\n <div>{a?.amount}</div>\\\\n </div>\\\\n ),\\\\n value: isNEAR ? \\\\\\\"\\\\\\\" : a.contract\\\\n };\\\\n })\\\\n .filter((i) => i !== null);\\\\n}\\\\n\\\\nconst Container = styled.div`\\\\n input[type=\\\\\\\"number\\\\\\\"]::-webkit-inner-spin-button,\\\\n input[type=\\\\\\\"number\\\\\\\"]::-webkit-outer-spin-button {\\\\n -webkit-appearance: none;\\\\n margin: 0;\\\\n }\\\\n input[type=\\\\\\\"number\\\\\\\"] {\\\\n -moz-appearance: textfield; /* Firefox */\\\\n }\\\\n`;\\\\n\\\\nreturn (\\\\n <Container>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Recipient</h5>\\\\n <Widget\\\\n src={\\\\n \\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.AccountAutoComplete\\\\\\\"\\\\n }\\\\n props={{\\\\n placeholder: \\\\\\\"Specify target account\\\\\\\",\\\\n accountId: state.receiver_id,\\\\n onChange: onChangeRecipient\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <Widget\\\\n src={`astraplusplus.ndctools.near/widget/Common.Components.Select`}\\\\n props={{\\\\n label: \\\\\\\"Token\\\\\\\",\\\\n noLabel: false,\\\\n placeholder: \\\\\\\"Select Token\\\\\\\",\\\\n options: res ?? [],\\\\n value: state.tokenAddress,\\\\n onChange: (token) => {\\\\n onChangeToken(token.value);\\\\n },\\\\n\\\\n error: undefined\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Amount</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n onChange={(e) => onChangeAmount(e.target.value)}\\\\n min=\\\\\\\"0\\\\\\\"\\\\n />\\\\n </div>\\\\n\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Transfer\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Propose Transfer\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </Container>\\\\n);\\\\n" |
| 34 | }, |
| 35 | "Common.Components.TokenAmount": { |
| 36 | "": "const address = props.address ?? \\\\\\\"\\\\\\\"; // Empty string for NEAR\\\\nconst amountWithDecimals = props.amountWithDecimals ?? 0;\\\\nconst amountWithoutDecimals = props.amountWithoutDecimals; // Automatically converted to the correct value\\\\n\\\\nconst isNEAR = address === \\\\\\\"\\\\\\\" || address.toLowerCase() === \\\\\\\"near\\\\\\\";\\\\n\\\\nlet ftMetadata = {\\\\n symbol: \\\\\\\"NEAR\\\\\\\",\\\\n decimals: 24,\\\\n};\\\\n\\\\nif (!isNEAR) {\\\\n ftMetadata = Near.view(address, \\\\\\\"ft_metadata\\\\\\\", {});\\\\n if (ftMetadata === null) return null;\\\\n}\\\\n\\\\nlet amount = amountWithDecimals;\\\\nif (amountWithoutDecimals !== undefined) {\\\\n amount = Big(amountWithoutDecimals)\\\\n .div(Big(10).pow(ftMetadata.decimals))\\\\n .toString();\\\\n}\\\\n\\\\nconst NEAR = () => {\\\\n return (\\\\n <svg\\\\n width={\\\\\\\"32px\\\\\\\"}\\\\n height={\\\\\\\"32px\\\\\\\"}\\\\n viewBox=\\\\\\\"0 0 32 32\\\\\\\"\\\\n fill=\\\\\\\"none\\\\\\\"\\\\n xmlns=\\\\\\\"http://www.w3.org/2000/svg\\\\\\\"\\\\n >\\\\n <circle cx=\\\\\\\"16\\\\\\\" cy=\\\\\\\"16\\\\\\\" r=\\\\\\\"16\\\\\\\" fill=\\\\\\\"black\\\\\\\"></circle>\\\\n <g clip-path=\\\\\\\"url(#clip0000000003)\\\\\\\">\\\\n <path\\\\n d=\\\\\\\"M20.8422 8.84471L17.4978 13.776C17.4501 13.847 17.43 13.9328 17.4411 14.0174C17.4522 14.102 17.4938 14.1798 17.5582 14.2363C17.6225 14.2928 17.7053 14.3243 17.7913 14.3249C17.8772 14.3254 17.9604 14.2951 18.0256 14.2395L21.3178 11.4036C21.3371 11.3865 21.361 11.3753 21.3866 11.3714C21.4122 11.3675 21.4383 11.3711 21.4619 11.3818C21.4855 11.3924 21.5054 11.4096 21.5193 11.4314C21.5331 11.4531 21.5403 11.4783 21.54 11.504V20.3824C21.54 20.4095 21.5316 20.4361 21.5158 20.4583C21.5001 20.4806 21.4779 20.4975 21.4522 20.5068C21.4265 20.516 21.3985 20.5172 21.3721 20.5102C21.3456 20.5031 21.322 20.4882 21.3044 20.4673L11.3533 8.63726C11.1933 8.44956 10.994 8.29873 10.7693 8.19525C10.5446 8.09178 10.2999 8.03815 10.0522 8.03809H9.70444C9.2524 8.03809 8.81887 8.21642 8.49922 8.53386C8.17957 8.8513 8 9.28185 8 9.73078V22.2351C8 22.684 8.17957 23.1145 8.49922 23.432C8.81887 23.7494 9.2524 23.9277 9.70444 23.9277V23.9277C9.99591 23.9278 10.2825 23.8537 10.537 23.7125C10.7914 23.5713 11.0051 23.3677 11.1578 23.1211L14.5022 18.1898C14.5499 18.1188 14.57 18.033 14.5589 17.9484C14.5478 17.8638 14.5062 17.7861 14.4418 17.7295C14.3775 17.673 14.2947 17.6415 14.2087 17.641C14.1228 17.6404 14.0396 17.6707 13.9744 17.7264L10.6822 20.5622C10.6629 20.5794 10.639 20.5906 10.6134 20.5944C10.5878 20.5983 10.5617 20.5947 10.5381 20.5841C10.5145 20.5734 10.4946 20.5562 10.4807 20.5345C10.4669 20.5128 10.4597 20.4875 10.46 20.4618V11.5813C10.46 11.5541 10.4684 11.5276 10.4842 11.5053C10.4999 11.483 10.5221 11.4661 10.5478 11.4568C10.5735 11.4476 10.6015 11.4464 10.6279 11.4534C10.6544 11.4605 10.678 11.4755 10.6956 11.4963L20.6456 23.3286C20.8056 23.5163 21.0049 23.6671 21.2296 23.7706C21.4543 23.874 21.699 23.9277 21.9467 23.9277H22.2944C22.5184 23.9279 22.7401 23.8842 22.947 23.7992C23.154 23.7142 23.342 23.5895 23.5004 23.4324C23.6588 23.2752 23.7844 23.0885 23.8702 22.8831C23.9559 22.6776 24 22.4574 24 22.2351V9.73078C24 9.28185 23.8204 8.8513 23.5008 8.53386C23.1811 8.21642 22.7476 8.03809 22.2956 8.03809C22.0041 8.03801 21.7175 8.11211 21.4631 8.25332C21.2086 8.39453 20.9949 8.59814 20.8422 8.84471V8.84471Z\\\\\\\"\\\\n fill=\\\\\\\"white\\\\\\\"\\\\n ></path>\\\\n </g>\\\\n <defs>\\\\n <clipPath id=\\\\\\\"clip00033\\\\\\\">\\\\n <rect\\\\n width=\\\\\\\"16\\\\\\\"\\\\n height=\\\\\\\"16\\\\\\\"\\\\n fill=\\\\\\\"white\\\\\\\"\\\\n transform=\\\\\\\"translate(8 7.9834)\\\\\\\"\\\\n ></rect>\\\\n </clipPath>\\\\n </defs>\\\\n </svg>\\\\n );\\\\n};\\\\n\\\\nconst Wrapper = styled.div`\\\\n display: inline-grid;\\\\n grid-template-columns: 32px 1fr;\\\\n grid-template-rows: 1fr 1fr;\\\\n grid-column-gap: 8px;\\\\n\\\\n .icon {\\\\n grid-row: span 2;\\\\n }\\\\n .amount {\\\\n font-size: 18px;\\\\n font-weight: 500;\\\\n line-height: 1.15;\\\\n }\\\\n .symbol {\\\\n font-size: 12px;\\\\n font-weight: 500;\\\\n line-height: 1;\\\\n }\\\\n`;\\\\nreturn (\\\\n <Wrapper>\\\\n <div className=\\\\\\\"icon\\\\\\\">\\\\n <OverlayTrigger\\\\n placement=\\\\\\\"auto\\\\\\\"\\\\n overlay={\\\\n <Tooltip id={`tooltip-${address}`}>\\\\n Token address:\\\\n <strong>{address}</strong>\\\\n </Tooltip>\\\\n }\\\\n show={address === \\\\\\\"\\\\\\\" ? false : undefined}\\\\n show={isNEAR ? false : undefined}\\\\n >\\\\n {!isNEAR ? (\\\\n <img width=\\\\\\\"32px\\\\\\\" height=\\\\\\\"32px\\\\\\\" src={ftMetadata.icon} />\\\\n ) : (\\\\n <NEAR />\\\\n )}\\\\n </OverlayTrigger>\\\\n </div>\\\\n <span className=\\\\\\\"amount\\\\\\\">{amount}</span>\\\\n <span className=\\\\\\\"symbol\\\\\\\">{ftMetadata.symbol}</span>\\\\n </Wrapper>\\\\n);" |
| 37 | }, |
| 38 | "Common.Modals.ProposalArguments": { |
| 39 | "": "const daoId = props.daoId;\\\\nconst proposal = props.proposal;\\\\nconst kind = props.kind ?? proposal.kind;\\\\nconst showCard = props.showCard ?? false;\\\\n\\\\nif (!kind) return \\\\\\\"\\\\\\\";\\\\n\\\\nfunction convertMillisecondsToDaysAndHours(milliseconds) {\\\\n const oneDayInMilliseconds = 24 * 60 * 60 * 1000;\\\\n const days = Math.floor(milliseconds / oneDayInMilliseconds);\\\\n const remainingHours =\\\\n (milliseconds % oneDayInMilliseconds) / (60 * 60 * 1000);\\\\n\\\\n return `${days} days and ${remainingHours} hours`;\\\\n}\\\\n\\\\nconst proposal_type = typeof kind === \\\\\\\"string\\\\\\\" ? kind : Object.keys(kind)?.[0];\\\\n\\\\nconst Wrapper = styled.div`\\\\n h5 {\\\\n color: gray;\\\\n font-size: 14px;\\\\n margin-bottom: 0.5em;\\\\n }\\\\n\\\\n .ndc-card h5 {\\\\n font-size: 1.1em;\\\\n color: #555;\\\\n margin-bottom: 0.4em;\\\\n }\\\\n\\\\n pre {\\\\n margin-bottom: 0;\\\\n\\\\n div {\\\\n border-radius: 5px;\\\\n }\\\\n }\\\\n`;\\\\n\\\\nconst MarkdownContainer = styled.div`\\\\n position: relative;\\\\n width: 100%;\\\\n padding: 24px;\\\\n background-color: #f8f9fa;\\\\n color: #1b1b18;\\\\n border-radius: 14px;\\\\n max-height: 700px;\\\\n overflow-y: auto;\\\\n color: #333;\\\\n line-height: 1.6;\\\\n box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;\\\\n\\\\n h1 {\\\\n font-size: 2em;\\\\n color: #111;\\\\n border-bottom: 1px solid #ccc;\\\\n padding-bottom: 0.3em;\\\\n margin-bottom: 1em;\\\\n }\\\\n\\\\n h2 {\\\\n font-size: 1.5em;\\\\n color: #222;\\\\n margin-bottom: 0.75em;\\\\n }\\\\n\\\\n h3 {\\\\n font-size: 1.3em;\\\\n color: #333;\\\\n margin-bottom: 0.6em;\\\\n }\\\\n\\\\n h4 {\\\\n font-size: 1.2em;\\\\n color: #444;\\\\n margin-bottom: 0.5em;\\\\n }\\\\n\\\\n h5 {\\\\n font-size: 1.1em;\\\\n color: #555;\\\\n margin-bottom: 0.4em;\\\\n }\\\\n\\\\n p {\\\\n font-size: 1em;\\\\n margin-bottom: 1em;\\\\n }\\\\n\\\\n a {\\\\n color: #0645ad;\\\\n text-decoration: none;\\\\n }\\\\n\\\\n a:hover {\\\\n text-decoration: underline;\\\\n }\\\\n`;\\\\n\\\\nconst content = null;\\\\n\\\\nif (proposal_type === \\\\\\\"DismissAndBan\\\\\\\") {\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Member</b>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind.DismissAndBan.member,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n <div>\\\\n <b>House</b>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind.DismissAndBan.house,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n </>\\\\n );\\\\n}\\\\n\\\\nif (proposal_type === \\\\\\\"ApproveBudget\\\\\\\" || proposal_type === \\\\\\\"Veto\\\\\\\") {\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Proposal ID</b>\\\\n <p>{kind[proposal_type].prop_id}</p>\\\\n </div>\\\\n <div>\\\\n <b>House</b>\\\\n <p>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind[proposal_type].dao,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </p>\\\\n </div>\\\\n </>\\\\n );\\\\n}\\\\n\\\\nif (proposal_type === \\\\\\\"Dismiss\\\\\\\") {\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Member</b>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind.Dismiss.member,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n <div>\\\\n <b>House</b>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind.Dismiss.dao,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n </>\\\\n );\\\\n}\\\\n\\\\nif (proposal_type === \\\\\\\"Dissolve\\\\\\\") {\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>House</b>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind.Dissolve.dao,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n </>\\\\n );\\\\n}\\\\n\\\\nif (proposal_type === \\\\\\\"Transfer\\\\\\\")\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Amount</b>\\\\n <div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.TokenAmount\\\\\\\"\\\\n props={{\\\\n amountWithoutDecimals: kind.Transfer.amount,\\\\n address: kind.Transfer.token_id\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n <div>\\\\n <b>Receiver</b>\\\\n <div>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind.Transfer.receiver_id,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n </>\\\\n );\\\\n\\\\nif (\\\\n proposal_type === \\\\\\\"RecurrentFundingRequest\\\\\\\" ||\\\\n proposal_type === \\\\\\\"FundingRequest\\\\\\\"\\\\n)\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Amount</b>\\\\n <div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.TokenAmount\\\\\\\"\\\\n props={{\\\\n amountWithoutDecimals: kind[proposal_type],\\\\n address: kind.Transfer.token_id\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n </>\\\\n );\\\\n\\\\nif (proposal_type === \\\\\\\"UpdateBonds\\\\\\\")\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Pre Vote Bond Amount</b>\\\\n <div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.TokenAmount\\\\\\\"\\\\n props={{\\\\n amountWithoutDecimals: kind[proposal_type].pre_vote_bond,\\\\n address: \\\\\\\"\\\\\\\"\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n <div>\\\\n <b>Active Queue Bond Amount</b>\\\\n <div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.TokenAmount\\\\\\\"\\\\n props={{\\\\n amountWithoutDecimals: kind[proposal_type].active_queue_bond,\\\\n address: \\\\\\\"\\\\\\\"\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n </>\\\\n );\\\\n\\\\nif (proposal_type === \\\\\\\"UpdateVoteDuration\\\\\\\")\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Pre Vote Duration</b>\\\\n <div>\\\\n {convertMillisecondsToDaysAndHours(\\\\n kind[proposal_type].pre_vote_duration\\\\n ) ?? 0}\\\\n </div>\\\\n </div>\\\\n <div>\\\\n <b>Vote Duration</b>\\\\n <div>\\\\n {convertMillisecondsToDaysAndHours(\\\\n kind[proposal_type].vote_duration ?? 0\\\\n )}\\\\n </div>\\\\n </div>\\\\n </>\\\\n );\\\\n\\\\nif (proposal_type === \\\\\\\"FunctionCall\\\\\\\") {\\\\n content = (\\\\n <>\\\\n {kind.FunctionCall.actions.reduce(\\\\n (acc, { method_name, args, deposit }) => {\\\\n return acc.concat(\\\\n <div className=\\\\\\\"d-flex flex-wrap align-items-start w-100 gap-2\\\\\\\">\\\\n <div className=\\\\\\\"info_section\\\\\\\">\\\\n <b>Smart Contract Address</b>\\\\n <div>\\\\n <small className=\\\\\\\"text-muted\\\\\\\">\\\\n {kind.FunctionCall.receiver_id}\\\\n </small>\\\\n </div>\\\\n </div>\\\\n <div className=\\\\\\\"info_section\\\\\\\">\\\\n <b>Method Name</b>\\\\n <div>\\\\n <small className=\\\\\\\"text-muted\\\\\\\">{method_name}</small>\\\\n </div>\\\\n </div>\\\\n\\\\n <div className=\\\\\\\"info_section no-border\\\\\\\">\\\\n <b>Deposit</b>\\\\n <div style={{ zoom: 0.7 }}>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.TokenAmount\\\\\\\"\\\\n props={{\\\\n amountWithoutDecimals: deposit,\\\\n address: \\\\\\\"\\\\\\\"\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n <div className=\\\\\\\"w-100\\\\\\\">\\\\n <b>Arguments</b>\\\\n <Markdown\\\\n // Decode the args (Base64) to String then Parse the Json then format it and display it as markdown code\\\\n text={\\\\n \\\\\\\"```json\\\\\\\\n\\\\\\\" +\\\\n JSON.stringify(\\\\n JSON.parse(Buffer.from(args, \\\\\\\"base64\\\\\\\").toString(\\\\\\\"utf8\\\\\\\")),\\\\n null,\\\\n 2\\\\n ) +\\\\n \\\\\\\"\\\\\\\\n```\\\\\\\"\\\\n }\\\\n />\\\\n </div>\\\\n </div>\\\\n );\\\\n },\\\\n []\\\\n )}\\\\n </>\\\\n );\\\\n}\\\\n\\\\nif (\\\\n proposal_type === \\\\\\\"AddMemberToRole\\\\\\\" ||\\\\n proposal_type === \\\\\\\"RemoveMemberFromRole\\\\\\\"\\\\n)\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Member</b>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind[proposal_type].member_id,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n <div>\\\\n <b>Role</b>\\\\n <p>{kind[proposal_type].role}</p>\\\\n </div>\\\\n </>\\\\n );\\\\n\\\\nif (proposal_type === \\\\\\\"AddBounty\\\\\\\")\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Amount</b>\\\\n <div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.TokenAmount\\\\\\\"\\\\n props={{\\\\n amountWithoutDecimals: kind.AddBounty.bounty.amount,\\\\n address: kind.AddBounty.bounty.token\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n <div>\\\\n <b>Times</b>\\\\n <p>{kind.AddBounty.bounty.times}</p>\\\\n </div>\\\\n <div>\\\\n <b>Deadline</b>\\\\n <p>{new Date(kind.AddBounty.bounty.max_deadline).toLocaleString()}</p>\\\\n </div>\\\\n <div className=\\\\\\\"w-100\\\\\\\">\\\\n <b>Bounty Description</b>\\\\n <MarkdownContainer>\\\\n <Markdown text={kind.AddBounty.bounty.description} />\\\\n </MarkdownContainer>\\\\n </div>\\\\n </>\\\\n );\\\\n\\\\nif (proposal_type === \\\\\\\"BountyDone\\\\\\\")\\\\n content = (\\\\n <>\\\\n <div>\\\\n <b>Receiver</b>\\\\n <Widget\\\\n src=\\\\\\\"mob.near/widget/Profile.ShortInlineBlock\\\\\\\"\\\\n props={{\\\\n accountId: kind.BountyDone.receiver_id,\\\\n tooltip: true\\\\n }}\\\\n />\\\\n </div>\\\\n <div>\\\\n <b>Bounty ID</b>\\\\n <p>{kind.BountyDone.bounty_id}</p>\\\\n </div>\\\\n </>\\\\n );\\\\n\\\\nfunction deepSortObject(obj) {\\\\n if (typeof obj !== \\\\\\\"object\\\\\\\" || obj === null) {\\\\n // Return non-object values as is\\\\n return obj;\\\\n }\\\\n\\\\n if (Array.isArray(obj)) {\\\\n // If the input is an array, recursively sort each element\\\\n return obj.map(deepSortObject).sort();\\\\n }\\\\n\\\\n const sortedObject = {};\\\\n const sortedKeys = Object.keys(obj).sort((keyA, keyB) => {\\\\n // Compare keys in a case-insensitive manner\\\\n return keyA.toLowerCase().localeCompare(keyB.toLowerCase());\\\\n });\\\\n\\\\n for (const key of sortedKeys) {\\\\n sortedObject[key] = deepSortObject(obj[key]);\\\\n }\\\\n\\\\n return sortedObject;\\\\n}\\\\n\\\\n// TODO: ChangePolicy component need some UI improvements to be more readable\\\\nif (proposal_type === \\\\\\\"ChangePolicy\\\\\\\") {\\\\n const old_policy = Near.view(daoId, \\\\\\\"get_policy\\\\\\\");\\\\n if (old_policy === null) return \\\\\\\"\\\\\\\";\\\\n content = (\\\\n <>\\\\n <div className=\\\\\\\"w-100\\\\\\\">\\\\n <b>Policy Changes</b>\\\\n <div\\\\n className=\\\\\\\"w-100\\\\\\\"\\\\n style={{\\\\n maxHeight: \\\\\\\"400px\\\\\\\",\\\\n overflow: \\\\\\\"auto\\\\\\\"\\\\n }}\\\\n >\\\\n <Widget\\\\n src=\\\\\\\"bozon.near/widget/CodeDiff\\\\\\\"\\\\n props={{\\\\n prevCode: JSON.stringify(deepSortObject(old_policy), null, 2),\\\\n currentCode: JSON.stringify(\\\\n deepSortObject(kind.ChangePolicy.policy),\\\\n null,\\\\n 2\\\\n )\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n </>\\\\n );\\\\n}\\\\n\\\\nif (proposal_type === \\\\\\\"ChangeConfig\\\\\\\") {\\\\n const old_config = Near.view(daoId, \\\\\\\"get_config\\\\\\\");\\\\n if (old_config === null) return \\\\\\\"\\\\\\\";\\\\n content = (\\\\n <>\\\\n <div className=\\\\\\\"w-100\\\\\\\">\\\\n <b>Config Changes</b>\\\\n <div\\\\n className=\\\\\\\"w-100\\\\\\\"\\\\n style={{\\\\n maxHeight: \\\\\\\"400px\\\\\\\",\\\\n overflow: \\\\\\\"auto\\\\\\\"\\\\n }}\\\\n >\\\\n <Widget\\\\n src=\\\\\\\"bozon.near/widget/CodeDiff\\\\\\\"\\\\n props={{\\\\n prevCode: JSON.stringify(deepSortObject(old_config), null, 2),\\\\n currentCode: JSON.stringify(\\\\n deepSortObject(kind.ChangeConfig.config),\\\\n null,\\\\n 2\\\\n )\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n </>\\\\n );\\\\n}\\\\n\\\\nif (proposal_type === \\\\\\\"ChangePolicyUpdateParameters\\\\\\\") {\\\\n const old_policy = Near.view(daoId, \\\\\\\"get_policy\\\\\\\");\\\\n if (old_policy === null) return \\\\\\\"\\\\\\\";\\\\n delete old_policy[\\\\\\\"roles\\\\\\\"];\\\\n delete old_policy[\\\\\\\"default_vote_policy\\\\\\\"];\\\\n content = (\\\\n <>\\\\n <div className=\\\\\\\"w-100\\\\\\\">\\\\n <b>Policy Parameters Changes</b>\\\\n <div\\\\n className=\\\\\\\"w-100\\\\\\\"\\\\n style={{\\\\n maxHeight: \\\\\\\"400px\\\\\\\",\\\\n overflow: \\\\\\\"auto\\\\\\\"\\\\n }}\\\\n >\\\\n <Widget\\\\n src=\\\\\\\"bozon.near/widget/CodeDiff\\\\\\\"\\\\n props={{\\\\n prevCode: JSON.stringify(deepSortObject(old_policy), null, 2),\\\\n currentCode: JSON.stringify(\\\\n deepSortObject(kind.ChangePolicyUpdateParameters.parameters),\\\\n null,\\\\n 2\\\\n )\\\\n }}\\\\n />\\\\n </div>\\\\n </div>\\\\n </>\\\\n );\\\\n}\\\\n\\\\nreturn (\\\\n <>\\\\n {content && (\\\\n <Wrapper className={showCard && \\\\\\\"ndc-card p-4\\\\\\\"}>\\\\n <div\\\\n className={\\\\n \\\\\\\"d-flex flex-wrap \\\\\\\" + (showCard ? \\\\\\\" align-items-start \\\\\\\" : \\\\\\\"gap-5\\\\\\\")\\\\n }\\\\n style={\\\\n showCard\\\\n ? {\\\\n rowGap: \\\\\\\"16px\\\\\\\",\\\\n columnGap: \\\\\\\"48px\\\\\\\"\\\\n }\\\\n : {}\\\\n }\\\\n >\\\\n {content}\\\\n </div>\\\\n </Wrapper>\\\\n )}\\\\n </>\\\\n);\\\\n" |
| 40 | }, |
| 41 | "DAO.Proposal.Create.UpdateBonds": { |
| 42 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId;\\\\nconst onClose = props.onClose;\\\\nconst registry = props.registry;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n pre_vote_bond: 0,\\\\n active_queue_bond: 0,\\\\n error: null,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n description: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nconst handleProposal = () => {\\\\n if (isEmpty(state.active_queue_bond)) {\\\\n State.update({\\\\n error: \\\\\\\"Please add active queue bond amount\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (isEmpty(state.pre_vote_bond)) {\\\\n State.update({\\\\n error: \\\\\\\"Please add pre vote bond amount\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 20000000000000;\\\\n const deposit = state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000;\\\\n\\\\n const preVoteBond = Big(state.pre_vote_bond).mul(Big(10).pow(24)).toFixed();\\\\n const activeBond = Big(state.active_queue_bond)\\\\n .mul(Big(10).pow(24))\\\\n .toFixed();\\\\n\\\\n const args = JSON.stringify({\\\\n description: state.description,\\\\n kind: {\\\\n UpdateBonds: {\\\\n pre_vote_bond: preVoteBond,\\\\n active_queue_bond: activeBond\\\\n }\\\\n },\\\\n caller: accountId\\\\n });\\\\n\\\\n const calls = [\\\\n {\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: args\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangePreVoteBond = (pre_vote_bond) => {\\\\n State.update({\\\\n pre_vote_bond,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeActiveQueueBond = (active_queue_bond) => {\\\\n State.update({\\\\n active_queue_bond,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Pre Vote Bond amount (NEAR)</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n onChange={(e) => onChangePreVoteBond(e.target.value)}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Active Queue Bond amount (NEAR)</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n onChange={(e) => onChangeActiveQueueBond(e.target.value)}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Update Bonds\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 43 | }, |
| 44 | "DAO.Proposal.Create.FunctionCall": { |
| 45 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst contractId = props.contractId;\\\\nconst onClose = props.onClose;\\\\nconst daoId = props.daoId;\\\\nconst isCongressDaoID = props.isCongressDaoID;\\\\nconst powerType = props.powerType;\\\\nconst showPowers = props.showPowers ?? true;\\\\nconst registry = props.registry;\\\\nconst isVotingBodyDao = props.isVotingBodyDao;\\\\nconst policy = props.daoPolicy;\\\\n\\\\nconst CoADaoId = props.dev\\\\n ? \\\\\\\"coa.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-coa-v1.ndc-gwg.near\\\\\\\";\\\\nconst VotingBodyDaoId = props.dev\\\\n ? \\\\\\\"voting-body-v1.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"voting-body-v1.ndc-gwg.near\\\\\\\";\\\\nconst TCDaoId = props.dev\\\\n ? \\\\\\\"tc.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-tc-v1.ndc-gwg.near\\\\\\\";\\\\nconst HoMDaoId = props.dev\\\\n ? \\\\\\\"hom.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-hom-v1.ndc-gwg.near\\\\\\\";\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n contractId: state.contractId,\\\\n method_name: state.method_name,\\\\n args: state.args || \\\\\\\"{}\\\\\\\",\\\\n deposit: state.deposit || \\\\\\\"0\\\\\\\",\\\\n gas: \\\\\\\"270\\\\\\\",\\\\n error: undefined,\\\\n receiver_id: null,\\\\n description: null,\\\\n powerType,\\\\n member: null, // for dismiss and ban hook\\\\n house: null, // for dismiss and ban hook\\\\n accounts: null, // for unban hook\\\\n memo: null, // for unban hook\\\\n showReceiverAsOptions: false,\\\\n disableReceiverField: false,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nconst fc_args = Buffer.from(state.args, \\\\\\\"utf-8\\\\\\\").toString(\\\\\\\"base64\\\\\\\");\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nconst handleFunctionCall = () => {\\\\n if (!isCongressDaoID && !VotingBodyDaoId) {\\\\n if (isEmpty(state.contractId) || !isNearAddress(state.contractId)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid contract ID\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n }\\\\n if (state.powerType !== \\\\\\\"Unban\\\\\\\" && state.powerType !== \\\\\\\"DismissAndBan\\\\\\\") {\\\\n if (isEmpty(state.method_name)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid method name\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const is_valid_json = (str) => {\\\\n try {\\\\n JSON.parse(str);\\\\n } catch (e) {\\\\n return false;\\\\n }\\\\n return true;\\\\n };\\\\n\\\\n if (isEmpty(state.args) || !is_valid_json(state.args)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid JSON arguments\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (isEmpty(state.deposit) || state.deposit < 0) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid deposit\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (isEmpty(state.gas) || state.gas <= 0) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid gas\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (state.gas > 270) {\\\\n State.update({\\\\n error: \\\\\\\"Maximum gas allowed is 270Tgas\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n }\\\\n\\\\n const deposit = Big(state.deposit).mul(Big(10).pow(24)).toFixed();\\\\n const gas = Big(state.gas).mul(Big(10).pow(12)).toFixed();\\\\n if (isVotingBodyDao) {\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n Near.call([\\\\n {\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: JSON.stringify({\\\\n kind: {\\\\n FunctionCall: {\\\\n receiver_id: state.receiver_id,\\\\n actions: [\\\\n {\\\\n method_name: state.method_name,\\\\n args: fc_args,\\\\n deposit: deposit,\\\\n gas: gas\\\\n }\\\\n ]\\\\n }\\\\n },\\\\n caller: accountId,\\\\n description: state.description\\\\n })\\\\n },\\\\n deposit: state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000,\\\\n gas: 200000000000000\\\\n }\\\\n ]);\\\\n } else {\\\\n const calls = [];\\\\n if (isCongressDaoID) {\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n let args = {};\\\\n if (state.powerType === \\\\\\\"Unban\\\\\\\") {\\\\n const accountsArray = state.accounts\\\\n ?.split(\\\\\\\",\\\\\\\")\\\\n .map((item) => item.trim());\\\\n if (\\\\n !accountsArray?.length ||\\\\n accountsArray?.some((item) => !isNearAddress(item))\\\\n ) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter valid account IDs\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (isEmpty(state.memo)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid memo\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n args = {\\\\n kind: {\\\\n FunctionCall: {\\\\n receiver_id: registry,\\\\n actions: [\\\\n {\\\\n method_name: \\\\\\\"admin_unflag_accounts\\\\\\\",\\\\n args: Buffer.from(\\\\n JSON.stringify({\\\\n accounts: accountsArray,\\\\n memo: state.memo\\\\n }),\\\\n \\\\\\\"utf-8\\\\\\\"\\\\n ).toString(\\\\\\\"base64\\\\\\\"),\\\\n deposit: deposit,\\\\n gas: gas\\\\n }\\\\n ]\\\\n }\\\\n },\\\\n description: state.description\\\\n };\\\\n } else {\\\\n if (state.powerType === \\\\\\\"DismissAndBan\\\\\\\") {\\\\n if (isEmpty(state.house) || !isNearAddress(state.house)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid house contract ID\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n if (isEmpty(state.member) || !isNearAddress(state.member)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid member ID\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n args = {\\\\n kind: {\\\\n DismissAndBan: {\\\\n member: state.member,\\\\n house: state.house\\\\n }\\\\n },\\\\n description: state.description\\\\n };\\\\n } else {\\\\n if (isEmpty(state.receiver_id) || !isNearAddress(state.receiver_id)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid recipient address\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n args = {\\\\n kind: {\\\\n FunctionCall: {\\\\n receiver_id: state.receiver_id,\\\\n actions: [\\\\n {\\\\n method_name: state.method_name,\\\\n args: fc_args,\\\\n deposit: deposit,\\\\n gas: gas\\\\n }\\\\n ]\\\\n }\\\\n },\\\\n description: state.description\\\\n };\\\\n }\\\\n }\\\\n calls.push({\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"create_proposal\\\\\\\",\\\\n args: args,\\\\n deposit: 100000000000000000000000,\\\\n gas: 200000000000000\\\\n });\\\\n } else {\\\\n calls.push({\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"add_proposal\\\\\\\",\\\\n args: {\\\\n proposal: {\\\\n description: state.description,\\\\n kind: {\\\\n FunctionCall: {\\\\n receiver_id: state.contractId,\\\\n actions: [\\\\n {\\\\n method_name: state.method_name,\\\\n args: fc_args,\\\\n deposit: deposit,\\\\n gas: gas\\\\n }\\\\n ]\\\\n }\\\\n }\\\\n }\\\\n },\\\\n deposit: policy?.proposal_bond || 100000000000000000000000,\\\\n gas: 200000000000000\\\\n });\\\\n }\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n }\\\\n};\\\\n\\\\nconst onChangeContract = (contractId) => {\\\\n State.update({\\\\n contractId,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeMethod = (method_name) => {\\\\n State.update({\\\\n method_name,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeArgs = (args) => {\\\\n State.update({\\\\n args,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeGas = (gas) => {\\\\n State.update({\\\\n gas,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDeposit = (deposit) => {\\\\n State.update({\\\\n deposit,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeRecipient = (receiver_id) => {\\\\n State.update({\\\\n receiver_id,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeHouse = (house) => {\\\\n State.update({\\\\n house,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeMember = (member) => {\\\\n State.update({\\\\n member,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeAccounts = (accounts) => {\\\\n State.update({\\\\n accounts,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeMemo = (memo) => {\\\\n State.update({\\\\n memo,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n\\\\n {state.powerType === \\\\\\\"DismissAndBan\\\\\\\" ? (\\\\n <>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Member</h5>\\\\n <input\\\\n type=\\\\\\\"text\\\\\\\"\\\\n value={state.member}\\\\n onChange={(e) => onChangeMember(e.target.value)}\\\\n placeholder=\\\\\\\"Specify member account\\\\\\\"\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.CongressHouseDropdown\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n label: \\\\\\\"House\\\\\\\",\\\\n placeholder: \\\\\\\"Select house account\\\\\\\",\\\\n onUpdate: (house) => {\\\\n State.update({\\\\n house: house,\\\\n error: undefined\\\\n });\\\\n }\\\\n }}\\\\n />\\\\n </>\\\\n ) : (\\\\n <>\\\\n {state.powerType === \\\\\\\"Unban\\\\\\\" ? (\\\\n <>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Accounts List (separated by comma)</h5>\\\\n <input\\\\n type=\\\\\\\"text\\\\\\\"\\\\n value={state.accounts}\\\\n onChange={(e) => onChangeAccounts(e.target.value)}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Memo</h5>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Markdown\\\\\\\"\\\\n props={{\\\\n value: state.memo,\\\\n onChange: (value) => onChangeMemo(value),\\\\n height: \\\\\\\"160px\\\\\\\",\\\\n initialText: \\\\\\\"\\\\\\\"\\\\n }}\\\\n />\\\\n </div>\\\\n </>\\\\n ) : (\\\\n <>\\\\n {!isCongressDaoID && !isVotingBodyDao && (\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Contract</h5>\\\\n <input\\\\n type=\\\\\\\"text\\\\\\\"\\\\n value={state.contractId}\\\\n onChange={(e) => onChangeContract(e.target.value)}\\\\n />\\\\n </div>\\\\n )}\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Method</h5>\\\\n <input\\\\n disabled={state.powerType && state.method_name}\\\\n type=\\\\\\\"text\\\\\\\"\\\\n value={state.method_name}\\\\n onChange={(e) => onChangeMethod(e.target.value)}\\\\n />\\\\n </div>\\\\n\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Arguments (JSON)</h5>\\\\n <textarea\\\\n type=\\\\\\\"text\\\\\\\"\\\\n value={state.args}\\\\n onChange={(e) => onChangeArgs(e.target.value)}\\\\n className=\\\\\\\"form-control\\\\\\\"\\\\n defaultValue={state.args}\\\\n />\\\\n </div>\\\\n {state.showReceiverAsOptions && (\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.CongressHouseDropdown\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n label: \\\\\\\"Recipient\\\\\\\",\\\\n placeholder: \\\\\\\"Select Recipient account\\\\\\\",\\\\n onUpdate: (house) => {\\\\n State.update({\\\\n receiver_id: house,\\\\n error: undefined\\\\n });\\\\n }\\\\n }}\\\\n />\\\\n </div>\\\\n )}\\\\n {((isCongressDaoID && !state.showReceiverAsOptions) ||\\\\n isVotingBodyDao) && (\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Recipient</h5>\\\\n <input\\\\n disabled={state.disableReceiverField}\\\\n type=\\\\\\\"text\\\\\\\"\\\\n value={state.receiver_id}\\\\n onChange={(e) => onChangeRecipient(e.target.value)}\\\\n placeholder=\\\\\\\"Specify target account\\\\\\\"\\\\n />\\\\n </div>\\\\n )}\\\\n {!isCongressDaoID && !isVotingBodyDao && (\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Gas (Tgas)</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n value={state.gas}\\\\n onChange={(e) => onChangeGas(e.target.value)}\\\\n defaultValue=\\\\\\\"270\\\\\\\"\\\\n />\\\\n </div>\\\\n )}\\\\n </>\\\\n )}\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Deposit (NEAR)</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n value={state.deposit}\\\\n onChange={(e) => onChangeDeposit(e.target.value)}\\\\n defaultValue={0}\\\\n />\\\\n </div>\\\\n </>\\\\n )}\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Function call\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Propose Function Call\\\\\\\",\\\\n onClick: handleFunctionCall,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 46 | }, |
| 47 | "DAO.Proposal.Create.ApproveBudget": { |
| 48 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId;\\\\nconst onClose = props.onClose;\\\\nconst registry = props.registry;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nState.init({\\\\n prop_id: null, // proposal id\\\\n error: null,\\\\n dao: null,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n description: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nconst handleProposal = () => {\\\\n if (isEmpty(state.dao) || !isNearAddress(state.dao)) {\\\\n State.update({\\\\n error: \\\\\\\"Please select an house\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n if (isEmpty(state.prop_id)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a proposal ID\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 20000000000000;\\\\n const deposit = state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000;\\\\n\\\\n const args = JSON.stringify({\\\\n description: state.description,\\\\n kind: {\\\\n ApproveBudget: { prop_id: parseInt(state.prop_id), dao: state.dao }\\\\n },\\\\n caller: accountId\\\\n });\\\\n\\\\n const calls = [\\\\n {\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: args\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangePropID = (prop_id) => {\\\\n State.update({\\\\n prop_id,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDao = (dao) => {\\\\n State.update({\\\\n dao,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.CongressHouseDropdown\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n label: \\\\\\\"House\\\\\\\",\\\\n placeholder: \\\\\\\"Select house account\\\\\\\",\\\\n onUpdate: onChangeDao\\\\n }}\\\\n />\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal ID</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n onChange={(e) => onChangePropID(e.target.value)}\\\\n min=\\\\\\\"0\\\\\\\"\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Approve Budget\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 49 | }, |
| 50 | "DAO.Proposal.Create.FundingRequest": { |
| 51 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId ?? \\\\\\\"multi.sputnik-dao.near\\\\\\\";\\\\nconst onClose = props.onClose;\\\\nconst proposalType = props.proposalType;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n description: null,\\\\n fundingAmt: null,\\\\n error: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nconst handleProposal = () => {\\\\n if (!state.description) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (!state.fundingAmt) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter an amount\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 20000000000000;\\\\n const deposit = 100000000000000000000000;\\\\n const amount = Big(state.fundingAmt).mul(Big(10).pow(24)).toFixed();\\\\n const calls = [\\\\n {\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"create_proposal\\\\\\\",\\\\n args: {\\\\n description: state.description,\\\\n kind: { [proposalType]: amount }\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeAmount = (amt) => {\\\\n State.update({\\\\n fundingAmt: amt,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Amount (NEAR)</h5>\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n onChange={(e) => onChangeAmount(e.target.value)}\\\\n min=\\\\\\\"0\\\\\\\"\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Funding request\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 52 | }, |
| 53 | "DAO.Proposal.Create.AddMemberToRole": { |
| 54 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId ?? \\\\\\\"multi.sputnik-dao.near\\\\\\\";\\\\nconst onClose = props.onClose;\\\\nconst policy = props.daoPolicy;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n member_id: state.member_id,\\\\n role: state.role,\\\\n error: undefined,\\\\n rolesOptions: [],\\\\n description: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nif (policy === null) {\\\\n return <></>;\\\\n}\\\\n\\\\nconst processPolicy = (policy) => {\\\\n const roles = {};\\\\n const options = [];\\\\n policy.roles.forEach((role) => {\\\\n if (role.kind.Group) {\\\\n if (!roles[role.name]) {\\\\n roles[role.name] = role;\\\\n options.push({ text: role.name, value: role.name });\\\\n }\\\\n }\\\\n });\\\\n State.update({ rolesOptions: options });\\\\n return roles;\\\\n};\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nconst allowedRoles = processPolicy(policy);\\\\n\\\\nconst handleProposal = () => {\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (\\\\n !state.member_id ||\\\\n state.member_id === \\\\\\\"\\\\\\\" ||\\\\n !isNearAddress(state.member_id)\\\\n ) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid member ID\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (!state.role || state.role === \\\\\\\"\\\\\\\") {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid role\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 200000000000000;\\\\n const deposit = policy?.proposal_bond || 100000000000000000000000;\\\\n const calls = [\\\\n {\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"add_proposal\\\\\\\",\\\\n args: {\\\\n proposal: {\\\\n description: state.description,\\\\n kind: {\\\\n AddMemberToRole: {\\\\n member_id: state.member_id ?? accountId,\\\\n role: state.role ?? \\\\\\\"council\\\\\\\"\\\\n }\\\\n }\\\\n }\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangeMember = (member_id) => {\\\\n State.update({\\\\n member_id,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeRole = (role) => {\\\\n State.update({\\\\n role,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription = \\\\\\\"Potential member\\\\\\\";\\\\n\\\\nif (allowedRoles === null) {\\\\n return <> </>;\\\\n}\\\\n\\\\nreturn (\\\\n <>\\\\n <div className=\\\\\\\"mb-2\\\\\\\">\\\\n <h5>Account ID</h5>\\\\n <Widget\\\\n src={\\\\n \\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.AccountAutoComplete\\\\\\\"\\\\n }\\\\n props={{\\\\n placeholder: \\\\\\\"Specify member account\\\\\\\",\\\\n accountId: state.member_id,\\\\n onChange: onChangeMember\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-2\\\\\\\">\\\\n <Widget\\\\n src={`astraplusplus.ndctools.near/widget/Common.Components.Select`}\\\\n props={{\\\\n label: \\\\\\\"Role\\\\\\\",\\\\n noLabel: false,\\\\n placeholder: \\\\\\\"Select the role\\\\\\\",\\\\n options: state.rolesOptions,\\\\n value: { text: state.role, value: state.role },\\\\n onChange: (role) => {\\\\n onChangeRole(role.value);\\\\n },\\\\n error: undefined\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Add Member To Role\\\\\\\"\\\\n }}\\\\n />\\\\n\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n \\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Propose To Add Member\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 55 | }, |
| 56 | "DAO.Proposal.Create.UpdateVoteDuration": { |
| 57 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId;\\\\nconst onClose = props.onClose;\\\\nconst registry = props.registry;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nfunction convertHoursToMilliseconds(hours) {\\\\n return hours * 60 * 60 * 1000;\\\\n}\\\\n\\\\nfunction convertDaysToMilliseconds(days) {\\\\n return days * 24 * 60 * 60 * 1000;\\\\n}\\\\n\\\\nState.init({\\\\n pre_vote_hours: 0,\\\\n pre_vote_days: 0,\\\\n vote_hours: 0,\\\\n vote_days: 0,\\\\n error: null,\\\\n attachDeposit: 0,\\\\n proposalQueue: null,\\\\n description: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nconst handleProposal = () => {\\\\n if (isEmpty(state.pre_vote_hours) && isEmpty(state.pre_vote_days)) {\\\\n State.update({\\\\n error: \\\\\\\"Please specify pre vote duration\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (isEmpty(state.vote_hours) && isEmpty(state.vote_days)) {\\\\n State.update({\\\\n error: \\\\\\\"Please specify vote duration\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 20000000000000;\\\\n const deposit = state.attachDeposit\\\\n ? Big(state.attachDeposit)\\\\n : 100000000000000000000000;\\\\n\\\\n const args = JSON.stringify({\\\\n description: state.description,\\\\n kind: {\\\\n UpdateVoteDuration: {\\\\n vote_duration:\\\\n convertHoursToMilliseconds(state.vote_hours) +\\\\n convertDaysToMilliseconds(state.vote_days),\\\\n pre_vote_duration:\\\\n convertHoursToMilliseconds(state.pre_vote_hours) +\\\\n convertDaysToMilliseconds(state.pre_vote_days)\\\\n }\\\\n },\\\\n caller: accountId\\\\n });\\\\n\\\\n const calls = [\\\\n {\\\\n contractName: registry,\\\\n methodName: \\\\\\\"is_human_call\\\\\\\",\\\\n args: {\\\\n ctr: daoId,\\\\n function: \\\\\\\"create_proposal\\\\\\\",\\\\n payload: args\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangePreVoteHours = (pre_vote_hours) => {\\\\n State.update({\\\\n pre_vote_hours,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangePreVoteDays = (pre_vote_days) => {\\\\n State.update({\\\\n pre_vote_days,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeVoteHours = (vote_hours) => {\\\\n State.update({\\\\n vote_hours,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeVoteDays = (vote_days) => {\\\\n State.update({\\\\n vote_days,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeQueue = ({ amount, queue }) => {\\\\n State.update({\\\\n attachDeposit: amount,\\\\n proposalQueue: queue\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription =\\\\n \\\\\\\"### [Your Title Here]\\\\\\\\n\\\\\\\\n#### Description\\\\\\\\n\\\\\\\\n[Detailed description of what the proposal is about.]\\\\\\\\n\\\\\\\\n#### Why This Proposal?\\\\\\\\n\\\\\\\\n[Explanation of why this proposal is necessary or beneficial.]\\\\\\\\n\\\\\\\\n#### Execution Plan\\\\\\\\n\\\\\\\\n[Description of how the proposal will be implemented.]\\\\\\\\n\\\\\\\\n#### Budget\\\\\\\\n\\\\\\\\n[If applicable, outline the budget required to execute this proposal.]\\\\\\\\n\\\\\\\\n#### Timeline\\\\\\\\n\\\\\\\\n[Proposed timeline for the execution of the proposal.]\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.ProposalQueue\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n onUpdate: onChangeQueue,\\\\n dev: props.dev\\\\n }}\\\\n />\\\\n\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Pre Vote Duration</h5>\\\\n <div className=\\\\\\\"d-flex gap-2\\\\\\\">\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n placeholder=\\\\\\\"Days\\\\\\\"\\\\n onChange={(e) => onChangePreVoteDays(e.target.value)}\\\\n />\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n placeholder=\\\\\\\"Hours\\\\\\\"\\\\n onChange={(e) => onChangePreVoteHours(e.target.value)}\\\\n />\\\\n </div>\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Vote Duration</h5>\\\\n <div className=\\\\\\\"d-flex gap-2\\\\\\\">\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n placeholder=\\\\\\\"Days\\\\\\\"\\\\n onChange={(e) => onChangeVoteDays(e.target.value)}\\\\n />\\\\n <input\\\\n type=\\\\\\\"number\\\\\\\"\\\\n placeholder=\\\\\\\"Hours\\\\\\\"\\\\n onChange={(e) => onChangeVoteHours(e.target.value)}\\\\n />\\\\n </div>\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Update Vote duration\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Create Proposal\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 58 | }, |
| 59 | "DAO.Proposal.Create.RemoveMemberFromRole": { |
| 60 | "": "const accountId = props.accountId ?? context.accountId;\\\\nconst daoId = props.daoId ?? \\\\\\\"multi.sputnik-dao.near\\\\\\\";\\\\nconst onClose = props.onClose;\\\\nconst policy = props.daoPolicy;\\\\n\\\\nif (!accountId) {\\\\n return \\\\\\\"Please connect your NEAR wallet :)\\\\\\\";\\\\n}\\\\n\\\\nState.init({\\\\n member_id: state.member_id,\\\\n role: state.role,\\\\n error: undefined,\\\\n rolesOptions: [],\\\\n description: null,\\\\n notificationsData: {}\\\\n});\\\\n\\\\nfunction isNearAddress(address) {\\\\n const ACCOUNT_ID_REGEX =\\\\n /^(([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+\\\\\\\\.)*([a-z\\\\\\\\d]+[-_])*[a-z\\\\\\\\d]+$/;\\\\n return (\\\\n address.length >= 2 &&\\\\n address.length <= 64 &&\\\\n ACCOUNT_ID_REGEX.test(address)\\\\n );\\\\n}\\\\n\\\\nfunction isEmpty(value) {\\\\n return !value || value === \\\\\\\"\\\\\\\";\\\\n}\\\\n\\\\nif (policy === null) {\\\\n return <></>;\\\\n}\\\\n\\\\nconst processPolicy = (policy) => {\\\\n const roles = {};\\\\n const options = [];\\\\n policy.roles.forEach((role) => {\\\\n if (role.kind.Group) {\\\\n if (!roles[role.name]) {\\\\n roles[role.name] = role;\\\\n options.push({ text: role.name, value: role.name });\\\\n }\\\\n }\\\\n });\\\\n State.update({ rolesOptions: options });\\\\n return roles;\\\\n};\\\\n\\\\nconst allowedRoles = processPolicy(policy);\\\\n\\\\nconst handleProposal = () => {\\\\n if (isEmpty(state.description)) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a description\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (\\\\n !state.member_id ||\\\\n state.member_id === \\\\\\\"\\\\\\\" ||\\\\n !isNearAddress(state.member_id)\\\\n ) {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid member ID\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n if (!state.role || state.role === \\\\\\\"\\\\\\\") {\\\\n State.update({\\\\n error: \\\\\\\"Please enter a valid role\\\\\\\"\\\\n });\\\\n return;\\\\n }\\\\n\\\\n const gas = 200000000000000;\\\\n const deposit = policy?.proposal_bond || 100000000000000000000000;\\\\n const calls = [\\\\n {\\\\n contractName: daoId,\\\\n methodName: \\\\\\\"add_proposal\\\\\\\",\\\\n args: {\\\\n proposal: {\\\\n description: state.description,\\\\n kind: {\\\\n RemoveMemberFromRole: {\\\\n member_id: state.member_id ?? accountId,\\\\n role: state.role ?? \\\\\\\"council\\\\\\\"\\\\n }\\\\n }\\\\n }\\\\n },\\\\n gas: gas,\\\\n deposit: deposit\\\\n }\\\\n ];\\\\n if (state.notificationsData) {\\\\n calls.push(state.notificationsData);\\\\n }\\\\n\\\\n Near.call(calls);\\\\n};\\\\n\\\\nconst onChangeMember = (member_id) => {\\\\n State.update({\\\\n member_id,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeRole = (role) => {\\\\n State.update({\\\\n role,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst onChangeDescription = (description) => {\\\\n State.update({\\\\n description,\\\\n error: undefined\\\\n });\\\\n};\\\\n\\\\nconst defaultDescription = \\\\\\\"Remove member\\\\\\\";\\\\n\\\\nreturn (\\\\n <>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Account ID</h5>\\\\n <Widget\\\\n src={\\\\n \\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.AccountAutoComplete\\\\\\\"\\\\n }\\\\n props={{\\\\n placeholder: \\\\\\\"Specify member account\\\\\\\",\\\\n accountId: state.member_id,\\\\n onChange: onChangeMember\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <Widget\\\\n src={`astraplusplus.ndctools.near/widget/Common.Components.Select`}\\\\n props={{\\\\n label: \\\\\\\"Role\\\\\\\",\\\\n noLabel: false,\\\\n placeholder: \\\\\\\"Select the role\\\\\\\",\\\\n options: state.rolesOptions,\\\\n value: { text: state.role, value: state.role },\\\\n onChange: (role) => {\\\\n onChangeRole(role.value);\\\\n },\\\\n error: undefined\\\\n }}\\\\n />\\\\n </div>\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <h5>Proposal Description</h5>\\\\n <Widget\\\\n src={\\\\\\\"devhub.near/widget/devhub.components.molecule.Compose\\\\\\\"}\\\\n props={{\\\\n data: state.description,\\\\n onChange: onChangeDescription,\\\\n autocompleteEnabled: true,\\\\n autoFocus: false,\\\\n placeholder: defaultDescription\\\\n }}\\\\n />\\\\n </div>\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/DAO.Proposal.Common.NotificationRolesSelector\\\\\\\"\\\\n props={{\\\\n daoId: daoId,\\\\n dev: props.dev,\\\\n onUpdate: (v) => {\\\\n State.update({ notificationsData: v });\\\\n },\\\\n proposalType: \\\\\\\"Remove Member From Role\\\\\\\"\\\\n }}\\\\n />\\\\n {state.error && <div className=\\\\\\\"text-danger\\\\\\\">{state.error}</div>}\\\\n <div className=\\\\\\\"ms-auto\\\\\\\">\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Propose To Remove Member\\\\\\\",\\\\n onClick: handleProposal,\\\\n className: \\\\\\\"mt-2\\\\\\\",\\\\n variant: \\\\\\\"success\\\\\\\"\\\\n }}\\\\n />\\\\n {onClose && (\\\\n <Widget\\\\n src=\\\\\\\"astraplusplus.ndctools.near/widget/Common.Components.Button\\\\\\\"\\\\n props={{\\\\n children: \\\\\\\"Close\\\\\\\",\\\\n onClick: onClose,\\\\n className: \\\\\\\"mt-2\\\\\\\"\\\\n }}\\\\n />\\\\n )}\\\\n </div>\\\\n </>\\\\n);\\\\n" |
| 61 | }, |
| 62 | "DAO.Proposal.Common.CongressHouseDropdown": { |
| 63 | "": "const label = props.label;\\\\nconst placeholder = props.placeholder;\\\\nconst onUpdate = props.onUpdate;\\\\nconst house = props.house;\\\\n\\\\nconst CoADaoId = props.dev\\\\n ? \\\\\\\"coa.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-coa-v1.ndc-gwg.near\\\\\\\";\\\\nconst VotingBodyDaoId = props.dev\\\\n ? \\\\\\\"voting-body-v1.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"voting-body-v1.ndc-gwg.near\\\\\\\";\\\\nconst TCDaoId = props.dev\\\\n ? \\\\\\\"tc.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-tc-v1.ndc-gwg.near\\\\\\\";\\\\nconst HoMDaoId = props.dev\\\\n ? \\\\\\\"hom.gwg-testing.near\\\\\\\"\\\\n : \\\\\\\"congress-hom-v1.ndc-gwg.near\\\\\\\";\\\\n\\\\nState.init({\\\\n house: house ? { text: house, value: house } : null\\\\n});\\\\n\\\\nreturn (\\\\n <div className=\\\\\\\"mb-3\\\\\\\">\\\\n <Widget\\\\n src={`astraplusplus.ndctools.near/widget/Common.Components.Select`}\\\\n props={{\\\\n label: label,\\\\n noLabel: false,\\\\n placeholder: placeholder,\\\\n options: [\\\\n { text: \\\\\\\"House of Merit\\\\\\\", value: HoMDaoId },\\\\n { text: \\\\\\\"Council of Advisors\\\\\\\", value: CoADaoId },\\\\n { text: \\\\\\\"Transparency Commission\\\\\\\", value: TCDaoId }\\\\n ],\\\\n value: state.house,\\\\n onChange: (house) => {\\\\n onUpdate(house.value);\\\\n State.update({\\\\n house: house\\\\n });\\\\n },\\\\n error: undefined\\\\n }}\\\\n />\\\\n </div>\\\\n);\\\\n" |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |