Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feat: Multisig creation with remark #1800

Open
wants to merge 105 commits into
base: tbaut-remove-matrix-3rd
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
c2f53be
fix: remove description refactor steps
Tbaut May 20, 2024
8e8a8a8
chore: refactor for useForm
Tbaut May 22, 2024
e57d826
chore: fix flow and confirm/verify
Tbaut May 22, 2024
e5ebeb1
Merge branch 'dev' of github.com:novasamatech/nova-spektr into feat/t…
Tbaut May 23, 2024
eed0cc0
chore: refactor-small-modal
Tbaut May 23, 2024
7522605
feat: remark signing
Tbaut May 27, 2024
9527d65
feat: most models set
Tbaut May 27, 2024
b238976
Merge branch 'dev' of github.com:novasamatech/nova-spektr into feat/t…
Tbaut May 28, 2024
7b05a3c
fix: signer selection
Tbaut May 28, 2024
6088e86
feat: signing step
Tbaut May 28, 2024
5e7b569
feat: wrapping tx as multi working
Tbaut May 28, 2024
d9ac5d6
chore: revert chainId change
Tbaut May 29, 2024
0c0b0f2
fix: lint
Tbaut May 29, 2024
7f1686b
chore: description back
Tbaut May 29, 2024
851be1c
chore: wip
Tbaut May 29, 2024
89ba44b
feat: submition ok
Tbaut May 29, 2024
3fa1ff8
feat: some console lgos
Tbaut May 29, 2024
37bd073
chore: refactor
Tbaut May 29, 2024
a1be2d7
fix: lint
Tbaut May 29, 2024
273179a
chore: add tests on form-model
Tbaut May 30, 2024
e226f12
chore: address comments
Tbaut May 30, 2024
9f5bff7
chore: more tests
Tbaut May 30, 2024
23d8df8
chore: test for confirm wallet
Tbaut May 30, 2024
864cf19
chore: flow-model tests
Tbaut May 30, 2024
ba120db
fix: remove most comments
Tbaut May 31, 2024
6f7f85c
fix: revert chains_dev
Tbaut May 31, 2024
d5f2f10
fix: Update chains_dev.json
Tbaut May 31, 2024
f55410b
fix: Update chains_dev.json
Tbaut May 31, 2024
895234d
fix: don't show multisigs
Tbaut May 31, 2024
b270c50
Revert "fix: don't show multisigs"
Tbaut May 31, 2024
472175c
fix: none step
Tbaut May 31, 2024
08e5885
Revert "Revert "fix: don't show multisigs""
Tbaut May 31, 2024
cdd3c4c
fix: flowfinished to reset
Tbaut May 31, 2024
7e786b4
fix: tests
Tbaut May 31, 2024
ca64671
fix: fix conflicts
Tbaut Jun 26, 2024
2c8b001
feat: remove Matrix
Tbaut Jun 26, 2024
4a38ebc
fix: jest pnpm and lock file
Tbaut Jun 26, 2024
f051537
fix: pnpm version
Tbaut Jun 26, 2024
a319ada
fix: resolve conflicts
Tbaut Jul 1, 2024
9e2504f
chore: merge matrix removal
Tbaut Jul 1, 2024
c0ebc90
fix: network and name first
Tbaut Jul 3, 2024
b7d9e9a
fix: submission
Tbaut Jul 3, 2024
1cc6741
feat: wip
Tbaut Jul 5, 2024
6b0d5ff
feat: style
Tbaut Jul 9, 2024
ed56234
chore: translation
Tbaut Jul 9, 2024
b3a2f53
chore: pull dev
Tbaut Jul 9, 2024
3d3ead0
chore: pull feat/tbaut-remove-matrix-bis
Tbaut Jul 9, 2024
ccbec54
fix: lockfile
Tbaut Jul 9, 2024
88ab70b
Merge branch 'feat/tbaut-remove-matrix-bis' of github.com:novasamatec…
Tbaut Jul 9, 2024
f9dfc36
fix: confirm step
Tbaut Jul 9, 2024
d6f3562
fix: tests
Tbaut Jul 10, 2024
cca7403
fix: fix tests
Tbaut Jul 10, 2024
43c7cdd
fix: fix path
Tbaut Jul 10, 2024
b6fcae0
chore: add test.. failing somehow
Tbaut Jul 11, 2024
8e53023
chore: initialize
Tbaut Jul 12, 2024
bff125e
Update src/renderer/widgets/CreateWallet/model/flow-model.ts
Tbaut Jul 29, 2024
1d1fc7b
fix: start addressing some comments
Tbaut Jul 29, 2024
c0b6212
chore: merge dev and fix conflicts
Tbaut Jul 29, 2024
ed7a1f0
chore: merge upstream
Tbaut Jul 29, 2024
794f18e
fix: steps
Tbaut Jul 29, 2024
a110514
chore: fix lint
Tbaut Jul 29, 2024
cb62a81
fix: add default signatory
Tbaut Jul 30, 2024
73bb376
fix: use .formValidated
Tbaut Jul 30, 2024
73c667f
fix: onSubmit
Tbaut Jul 31, 2024
b378f8c
fix: combobox for own acounts
Tbaut Aug 1, 2024
8c3e8a3
fix: reset fields
Tbaut Aug 1, 2024
be4363f
fix: error for empty name
Tbaut Aug 1, 2024
eb3a264
fix: other_signatories empty
Tbaut Aug 2, 2024
d7c325b
fix: test
Tbaut Aug 2, 2024
6a6bd51
fix: useModalClose
Tbaut Aug 5, 2024
08e7aaa
fix: stray call
Tbaut Aug 5, 2024
0a62d1e
fix: manage names and display options of contacts
Tbaut Aug 5, 2024
6f0d9e7
fix: add signatories as contact
Tbaut Aug 5, 2024
7ad7410
fix: new map then modify it
Tbaut Aug 6, 2024
ac0d8b3
fix: remove wizzard alltogether
Tbaut Aug 6, 2024
b4476c3
Merge branch 'dev' of github.com:novasamatech/nova-spektr into feat/t…
Tbaut Aug 6, 2024
ea4f094
Merge branch 'feat/tbaut-remove-matrix-bis' of github.com:novasamatec…
Tbaut Aug 6, 2024
429570a
fix: make isStep generic
Tbaut Aug 7, 2024
c30786f
fix: lint
Tbaut Aug 7, 2024
b391fac
chore: merge upstream
Tbaut Sep 26, 2024
81fc589
chore: fix pnpm.lock
Tbaut Sep 26, 2024
57a6190
fix: remove chainId change
Tbaut Sep 26, 2024
7e02cfb
fix: forgot one
Tbaut Sep 26, 2024
ec9ab61
chore: fix conflicts and tests
Tbaut Sep 30, 2024
880a948
chore: fix lint
Tbaut Sep 30, 2024
4ca7eaf
fix: pv not displayed and redirect to multisig
Tbaut Sep 30, 2024
f0243ca
fix: remove unused file
Tbaut Oct 1, 2024
9072120
fix: multisig url and prepare Transaction
Tbaut Oct 1, 2024
66f0c7a
fix: remove remark from basket preparation
Tbaut Oct 1, 2024
03f8933
fix: test
Tbaut Oct 1, 2024
9afb2d8
fix: address comment
Tbaut Oct 1, 2024
b6b628a
fix: lint
Tbaut Oct 1, 2024
e5fdffa
fix: filter wallets add fees
Tbaut Oct 3, 2024
81b253b
fix: new design
Tbaut Oct 3, 2024
4fe8250
fix: lint
Tbaut Oct 3, 2024
48abd98
fix: with modal
Tbaut Oct 4, 2024
915c924
fix: move MultisigCreationFees to widgets
Tbaut Oct 4, 2024
fb19f8d
Merge branch 'tbaut-remove-matrix-3rd' of github.com:novasamatech/nov…
Tbaut Oct 7, 2024
eca080e
fix: add signer selection
Tbaut Oct 7, 2024
4225fe4
fix: tests
Tbaut Oct 7, 2024
6df54fd
fix: support showing pv accounts
Tbaut Oct 8, 2024
9e54200
fix: title on signer selection
Tbaut Oct 8, 2024
a082863
fix: with asset but only the selected one
Tbaut Oct 8, 2024
37afac5
fix: sub to wallet balances
Tbaut Oct 8, 2024
23d2b58
fix: wallet icon and name
Tbaut Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"nodemon": "^2.0.18",
"npm-run-all": "^4.1.5",
"playwright": "^1.44.1",
"pnpm": "^9.2.0",
"pnpm": "^9.4.0",
"postcss": "^8.4.31",
"postcss-loader": "^7.3.3",
"prettier": "3.3.3",
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/renderer/entities/contact/model/contact-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const createContactFx = createEffect(async (contact: Omit<Contact, 'id'>): Promi
return storageService.contacts.create(contact);
});

const createContactsFx = createEffect((contacts: Omit<Contact, 'id'>[]): Promise<Contact | undefined>[] => {
return contacts.map(async (contact) => storageService.contacts.create(contact));
});

const updateContactFx = createEffect(async ({ id, ...rest }: Contact): Promise<Contact> => {
await storageService.contacts.update(id, rest);

Expand Down Expand Up @@ -51,6 +55,7 @@ export const contactModel = {
$contacts,
effects: {
createContactFx,
createContactsFx,
deleteContactFx,
updateContactFx,
},
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/entities/contact/ui/ContactList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const ContactList = ({ children }: PropsWithChildren) => {

return (
<div className="flex flex-col gap-y-2">
<div className="grid grid-cols-[250px,250px,1fr] items-center px-3">
<div className="grid grid-cols-[250px,1fr] items-center px-3">
<FootnoteText className="text-text-secondary">{t('addressBook.contactList.nameColumnTitle')}</FootnoteText>
</div>

Expand Down
3 changes: 3 additions & 0 deletions src/renderer/entities/transaction/lib/callDataDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@

const getCallDataParser: Record<
TransactionType,
(decoded: SubmittableExtrinsic<'promise'>, chainId: ChainId) => Record<string, any>

Check warning on line 168 in src/renderer/entities/transaction/lib/callDataDecoder.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
> = {
[TransactionType.TRANSFER]: (decoded): Record<string, any> => {

Check warning on line 170 in src/renderer/entities/transaction/lib/callDataDecoder.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return { dest: decoded.args[0].toString(), value: decoded.args[1].toString() };
},
[TransactionType.ASSET_TRANSFER]: (decoded): Record<string, any> => {

Check warning on line 173 in src/renderer/entities/transaction/lib/callDataDecoder.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return {
assetId: decoded.args[0].toString(),
dest: decoded.args[1].toString(),
Expand Down Expand Up @@ -362,6 +362,9 @@
call: decoded.args[2].toHex(),
};
},
[TransactionType.REMARK]: (decoded): Record<string, any> => {
Tbaut marked this conversation as resolved.
Show resolved Hide resolved
return { remark: decoded.args[0].toString() };
},
[TransactionType.UNLOCK]: (decoded): Record<string, any> => {
return {
class: decoded.args[0].toString(),
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/entities/transaction/lib/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ const TransactionTitles: Record<TransactionType, string> = {
[TransactionType.REMOVE_PROXY]: 'operations.titles.removeProxy',
[TransactionType.REMOVE_PURE_PROXY]: 'operations.titles.removePureProxy',
[TransactionType.PROXY]: 'operations.titles.proxy',
// Remark
[TransactionType.REMARK]: 'operations.titles.remark',
// Governance
[TransactionType.UNLOCK]: 'operations.titles.unlock',
[TransactionType.VOTE]: 'operations.titles.vote',
Expand Down Expand Up @@ -277,6 +279,9 @@ const TransactionTitlesModal: Record<TransactionType, (crossChain: boolean) => s
[TransactionType.REMOVE_PROXY]: () => 'operations.modalTitles.removeProxy',
[TransactionType.REMOVE_PURE_PROXY]: () => 'operations.modalTitles.removePureProxy',
[TransactionType.PROXY]: () => 'operations.modalTitles.proxy',
// Remark
[TransactionType.REMARK]: () => 'operations.modalTitles.remark',
// Governance
[TransactionType.UNLOCK]: () => 'operations.modalTitles.unlockOn',
[TransactionType.VOTE]: () => 'operations.modalTitles.vote',
[TransactionType.REVOTE]: () => 'operations.modalTitles.revote',
Expand Down
12 changes: 12 additions & 0 deletions src/renderer/entities/transaction/lib/extrinsicService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,17 @@ export const getUnsignedTransaction: Record<
options,
);
},

[TransactionType.REMARK]: (transaction, info, options) => {
return methods.system.remark(
{
remark: transaction.args.remark,
},
info,
options,
);
},

[TransactionType.UNLOCK]: (transaction, info, options) => {
return convictionVotingMethods.unlock(
{
Expand Down Expand Up @@ -532,6 +543,7 @@ export const getExtrinsic: Record<
[TransactionType.CREATE_PURE_PROXY]: ({ proxyType, delay, index }, api) => {
return api.tx.proxy.createPure(proxyType, delay, index);
},
[TransactionType.REMARK]: ({ remark }, api) => api.tx.system.remark(remark),
[TransactionType.UNLOCK]: ({ target, trackId }, api) => {
return api.tx.convictionVoting.unlock(trackId, target);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const TransactionIcons: Record<TransactionType, IconNames> = {
[TransactionType.REMOVE_PROXY]: 'proxyConfirm',
[TransactionType.REMOVE_PURE_PROXY]: 'proxyConfirm',
[TransactionType.PROXY]: 'unknownConfirm',
// Remark
[TransactionType.REMARK]: 'unknownConfirm',
// Governance
[TransactionType.UNLOCK]: 'unlockMst',
[TransactionType.VOTE]: 'voteMst',
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/entities/transaction/lib/transactionIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const TransactionIcons: Record<TransactionType, IconNames> = {
[TransactionType.REMOVE_PROXY]: 'proxyMst',
[TransactionType.REMOVE_PURE_PROXY]: 'proxyMst',
[TransactionType.PROXY]: 'unknownMst',
// Remark
[TransactionType.REMARK]: 'unknownMst',
// Governance
[TransactionType.UNLOCK]: 'unlockMst',
[TransactionType.VOTE]: 'voteMst',
Expand Down
1 change: 1 addition & 0 deletions src/renderer/entities/wallet/lib/wallet-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function isWalletConnectGroup(wallet?: Wallet): wallet is WalletConnectGroup {
}

const VALID_SIGNATORY_WALLET_TYPES = [
WalletType.POLKADOT_VAULT,
WalletType.SINGLE_PARITY_SIGNER,
WalletType.MULTISHARD_PARITY_SIGNER,
WalletType.WALLET_CONNECT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { useI18n } from '@app/providers';
import { type MultisigCreated } from '@shared/core';
import { WalletType } from '@shared/core';
import { BodyText } from '@shared/ui';
import { ChainTitle } from '@entities/chain';
import { WalletIcon } from '@entities/wallet';

type Props = {
notification: MultisigCreated;
};

export const MultisigCreatedNotification = ({
notification: { threshold, signatories, multisigAccountName },
notification: { threshold, signatories, multisigAccountName, chainId },
}: Props) => {
const { t } = useI18n();

Expand All @@ -33,6 +34,9 @@ export const MultisigCreatedNotification = ({
signatoriesLength: signatories.length,
name: multisigAccountName,
}}
components={{
chain: <ChainTitle chainId={chainId} fontClass="text-text-primary text-body" />,
}}
/>
</BodyText>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/pages/Basket/lib/operation-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export const getOperationTitle = (transaction: BasketTransaction, chain: Chain):
[TransactionType.VOTE]: 'operations.modalTitles.vote',
[TransactionType.REVOTE]: 'operations.modalTitles.revote',
[TransactionType.REMOVE_VOTE]: 'operations.modalTitles.removeVote',
// Remark
[TransactionType.REMARK]: 'operations.modalTitles.remarkOn',
};

// @ts-expect-error TODO fix not all types used
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/pages/Basket/model/basket-page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ const validateFx = createEffect(({ transactions, feeMap }: ValidateParams) => {
| XcmTransactionTypes
| MultisigTransactionTypes
| UtilityTransactionTypes

// TODO: Add remove vote types
| TransactionType.REMOVE_VOTE
| TransactionType.REMARK
>,
EventCallable<ValidationStartedParams>
> = {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/pages/Basket/model/sign-operations-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const startDataPreparationFx = createEffect(async ({ transactions, ...preparatio
| TransactionType.VOTE
| TransactionType.REMOVE_VOTE
| TransactionType.REVOTE
| TransactionType.REMARK
>,
(dataParams: DataParams) => Promise<unknown>
> = {
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/pages/Basket/ui/SignOperation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export const SignOperation = () => {
const Components: Record<
Exclude<
TransactionType,
TransferTransactionTypes | XcmTransactionTypes | MultisigTransactionTypes | UtilityTransactionTypes
| TransferTransactionTypes
| XcmTransactionTypes
| MultisigTransactionTypes
| UtilityTransactionTypes
| TransactionType.REMARK
>,
() => ReactNode
> = {
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/pages/Basket/ui/SignOperations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export const SignOperations = () => {
const Components: Record<
Exclude<
TransactionType,
TransferTransactionTypes | XcmTransactionTypes | MultisigTransactionTypes | UtilityTransactionTypes
| TransferTransactionTypes
| XcmTransactionTypes
| MultisigTransactionTypes
| UtilityTransactionTypes
| TransactionType.REMARK
>,
() => ReactNode
> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type Props = {
txPayload: Uint8Array;
signature: HexString;
rejectReason?: string;

isReject?: boolean;
onClose: () => void;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ChainType,
ConnectionType,
CryptoType,
ExternalType,
SigningType,
WalletType,
} from '@shared/core';
Expand Down Expand Up @@ -76,7 +77,7 @@ describe('features/multisigs/model/multisigs-model', () => {
chainId: '0x01',
name: 'Westend',
options: [ChainOptions.MULTISIG],
externalApi: { multisig: [{ url: 'http://mock-url' }] },
externalApi: { [ExternalType.PROXY]: [{ url: 'http://mock-url' }] },
},
}),
});
Expand Down
12 changes: 9 additions & 3 deletions src/renderer/processes/multisigs/model/multisigs-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const multisigSaved = createEvent<GetMultisigsResult>();
const $multisigChains = combine(networkModel.$chains, (chains) => {
return Object.values(chains).filter((chain) => {
const isMultisigSupported = multisigUtils.isMultisigSupported(chain);
const hasIndexerUrl = chain.externalApi?.[ExternalType.MULTISIG]?.[0]?.url;
const hasIndexerUrl =
networkUtils.isMultisigSupported(chain.options) && chain.externalApi?.[ExternalType.PROXY]?.[0]?.url;

return isMultisigSupported && hasIndexerUrl;
});
Expand All @@ -48,8 +49,13 @@ type GetMultisigsResult = {

const getMultisigsFx = createEffect(({ chains, wallets }: GetMultisigsParams) => {
for (const chain of chains) {
const accounts = walletUtils.getAccountsBy(wallets, (a) => accountUtils.isChainIdMatch(a, chain.chainId));
const multisigIndexerUrl = chain.externalApi?.[ExternalType.MULTISIG]?.[0]?.url;
const filteredWallets = walletUtils.getWalletsFilteredAccounts(wallets, {
walletFn: (w) => !walletUtils.isMultisig(w) && !walletUtils.isWatchOnly(w) && !walletUtils.isProxied(w),
});
const accounts = walletUtils.getAccountsBy(filteredWallets || [], (a) =>
accountUtils.isChainIdMatch(a, chain.chainId),
);
const multisigIndexerUrl = chain.externalApi?.[ExternalType.PROXY]?.[0]?.url;
const boundMultisigSaved = scopeBind(multisigSaved, { safe: true });

if (!multisigIndexerUrl || !accounts.length) continue;
Expand Down
Loading
Loading