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

Papi migration #559

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4c8cbff
add papi deps and chains
Tbaut Aug 26, 2024
4af4934
wip
Tbaut Aug 28, 2024
0d8fa28
proposal signing
Tbaut Sep 6, 2024
ad0ab8b
usePendingTx not done
Tbaut Sep 11, 2024
b75d8e7
Merge branch 'main' into tbaut-papi
Tbaut Sep 17, 2024
48366a9
creation process
Tbaut Sep 17, 2024
3bcf704
deepTxs hooks compatibilityToken
Tbaut Sep 17, 2024
239dcae
decodedCall
Tbaut Sep 19, 2024
38dbc03
ppl chain etc and many other
Tbaut Sep 19, 2024
dd4a7f9
identity
Tbaut Sep 22, 2024
977942c
payment info
Tbaut Sep 23, 2024
a4298aa
nits hesstring
Tbaut Sep 23, 2024
78158f4
merge main
Tbaut Sep 23, 2024
cb0e720
identity again
Tbaut Sep 23, 2024
33512e1
lint and prettier
Tbaut Sep 23, 2024
ded30e8
Merge branch 'main' of github.com:ChainSafe/Multix into tbaut-papi
Tbaut Sep 24, 2024
3e18115
fix yarn lock
Tbaut Sep 24, 2024
afdd422
usePendingTx
Tbaut Oct 2, 2024
fce91ca
call_hash
Tbaut Oct 2, 2024
884d9c2
fix: tsc without error
Tbaut Oct 3, 2024
de4d550
display with jsonprint
Tbaut Oct 3, 2024
24c8608
fix: bump and fix
Tbaut Oct 8, 2024
7798af0
wallet selector
Tbaut Oct 9, 2024
5804978
best and compatibility token
Tbaut Oct 9, 2024
21ca8d7
fix encoding
Tbaut Oct 10, 2024
60fab71
Merge branch 'main' of github.com:ChainSafe/Multix into tbaut-papi
Tbaut Oct 11, 2024
0b9c1cd
supprt failed multisig tx and proxy test
Tbaut Oct 11, 2024
c530162
fix test
Tbaut Oct 15, 2024
c7b8a28
bump dot-connect & papi
Tbaut Oct 18, 2024
6866d7a
Merge branch 'main' of github.com:ChainSafe/Multix into tbaut-papi
Tbaut Oct 23, 2024
4e01985
fix: transactions test on paseo
Tbaut Oct 23, 2024
e228675
chore: bump papi
Tbaut Oct 30, 2024
63bc469
chore: address bar test fix
Tbaut Oct 30, 2024
098b3b7
chore: landing messaging
Tbaut Oct 30, 2024
62a9e9f
fix: login tests
Tbaut Oct 31, 2024
a71e440
fix: update chopsticks
Tbaut Oct 31, 2024
22e3a6b
fix: update squid and skip tx check for multisig creation
Tbaut Oct 31, 2024
415b02e
fix: remark and identity
Tbaut Oct 31, 2024
37e6403
fix: build
Tbaut Oct 31, 2024
712ee46
fix: identity
Tbaut Oct 31, 2024
10e7211
fix: identity display
Tbaut Oct 31, 2024
037bea2
bump dotconnect to have no uncaught exceptions
Tbaut Nov 5, 2024
cc35fbd
withCompat
Tbaut Nov 5, 2024
151ea50
fix tests
Tbaut Nov 5, 2024
53d6634
clean up
Tbaut Nov 5, 2024
5cef6a0
bump
Tbaut Nov 22, 2024
77ce053
Revert "bump"
Tbaut Nov 22, 2024
ff75a6e
merge main
Tbaut Nov 22, 2024
3fd3729
fix lint
Tbaut Nov 22, 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
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
/packages/ui/src/gql/**/*
/packages/ui/src/interfaces/**/*
/packages/ui/types-and-hooks.tsx
/packages/ui/build/**/*
/packages/ui/build/**/*
.papi
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"lint:fix": "yarn workspaces foreach run lint:fix",
"formatAll": "prettier --write .",
"start:chopsticks-test-build-and-launch-all": "concurrently --kill-others 'npm run start:chopsticks' 'npm run ui:start-with-chopsticks' 'npm run docker:down && npm run docker:db && npm run build:indexer && npm run indexer:start:chopsticks-local' 'npm run start:graphql-server'",
"start:chopsticks": "npx --yes @acala-network/chopsticks@0.10.0-2 --config chopsticks-config.yml",
"start:chopsticks": "npx --yes @acala-network/chopsticks@1.0.0 --config chopsticks-config.yml",
"start:graphql-server": "cd squid && npm run start:graphql-server",
"indexer:start:chopsticks-ci": "cd squid && npm run start:chopsticks-ci",
"indexer:start:chopsticks-local": "cd squid && npm run start:chopsticks-local",
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"plugin:react-hooks/recommended",
"plugin:react/recommended",
"prettier",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/eslint-recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down Expand Up @@ -38,7 +38,7 @@
"react/jsx-tag-spacing": "error",
"prettier/prettier": "error",
"react-hooks/exhaustive-deps": "error",
"react/react-in-jsx-scope": "off",
"react/react-in-jsx-scope": "off"

},
"overrides": [
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/.papi/descriptors/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!.gitignore
!package.json
24 changes: 24 additions & 0 deletions packages/ui/.papi/descriptors/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.1.0-autogenerated.8448668932732983882",
"name": "@polkadot-api/descriptors",
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"browser": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"sideEffects": false,
"peerDependencies": {
"polkadot-api": "*"
}
}
Binary file added packages/ui/.papi/metadata/acala.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/bifrostDot.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/dot.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/dotAssetHub.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/dotPpl.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/hydration.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/khala.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/ksm-asset-hub.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/ksm.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/ksmAssetHub.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/ksmPpl.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/pasPpl.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/paseo.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/phala.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/rhala.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/rococo.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/rococoAssetHub.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/rococoPpl.scale
Binary file not shown.
Binary file added packages/ui/.papi/metadata/wesPpl.scale
Binary file not shown.
74 changes: 74 additions & 0 deletions packages/ui/.papi/polkadot-api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"version": 0,
"descriptorPath": ".papi/descriptors",
"entries": {
"dot": {
"chain": "polkadot",
"metadata": ".papi/metadata/dot.scale"
},
"ksm": {
"chain": "ksmcc3",
"metadata": ".papi/metadata/ksm.scale"
},
"ksmAssetHub": {
"chain": "ksmcc3_asset_hub",
"metadata": ".papi/metadata/ksmAssetHub.scale"
},
"ksmPpl": {
"chain": "ksmcc3_people",
"metadata": ".papi/metadata/ksmPpl.scale"
},
"dotPpl": {
"chain": "polkadot_people",
"metadata": ".papi/metadata/dotPpl.scale"
},
"dotAssetHub": {
"chain": "polkadot_asset_hub",
"metadata": ".papi/metadata/dotAssetHub.scale"
},
"rococo": {
"chain": "rococo_v2_2",
"metadata": ".papi/metadata/rococo.scale"
},
"rococoAssetHub": {
"chain": "rococo_v2_2_asset_hub",
"metadata": ".papi/metadata/rococoAssetHub.scale"
},
"rococoPpl": {
"chain": "rococo_v2_2_people",
"metadata": ".papi/metadata/rococoPpl.scale"
},
"bifrostDot": {
"wsUrl": "wss://eu.bifrost-polkadot-rpc.liebi.com/ws",
"metadata": ".papi/metadata/bifrostDot.scale"
},
"hydration": {
"wsUrl": "wss://rpc.helikon.io/hydradx",
"metadata": ".papi/metadata/hydration.scale"
},
"khala": {
"wsUrl": "wss://khala-api.phala.network/ws",
"metadata": ".papi/metadata/khala.scale"
},
"phala": {
"wsUrl": "wss://api.phala.network/ws",
"metadata": ".papi/metadata/phala.scale"
},
"paseo": {
"wsUrl": "wss://rpc.ibp.network/paseo",
"metadata": ".papi/metadata/paseo.scale"
},
"acala": {
"wsUrl": "wss://acala-rpc.dwellir.com",
"metadata": ".papi/metadata/acala.scale"
},
"pasPpl": {
"wsUrl": "wss://people-paseo.rpc.amforc.com",
"metadata": ".papi/metadata/pasPpl.scale"
},
"wesPpl": {
"wsUrl": "wss://westend-people-rpc.polkadot.io",
"metadata": ".papi/metadata/wesPpl.scale"
}
}
}
2 changes: 1 addition & 1 deletion packages/ui/cypress/fixtures/testAccounts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectedAccount } from '@polkadot/extension-inject/types'
import { InjectedAccount } from 'polkadot-api/pjs-signer'

export interface InjectedAccountWitMnemonic extends InjectedAccount {
mnemonic: string
Expand Down
7 changes: 5 additions & 2 deletions packages/ui/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import '@chainsafe/cypress-polkadot-wallet'

const LOCALSTORAGE_ACCOUNT_NAMES_KEY = 'multix.accountNames'
const LOCALSTORAGE_WATCHED_ACCOUNTS_KEY = 'multix.watchedAccount'
const LOCALSTORAGE_EXTENSION_CONNECTION_KEY = 'multix.canConnectToExtension'
const LOCALSTORAGE_EXTENSION_CONNECTION_KEY = '@reactive-dot/wallet/injected/polkadot-js/connected'
const LOCALSTORAGE_ALLOWED_CONNECTION_KEY = 'multix.canConnectToExtension'
export const MULTIX_DAPP_NAME = 'Multix'

Cypress.Commands.add('rejectCurrentMultisigTx', rejectCurrentMultisigTxs)
Expand Down Expand Up @@ -51,8 +52,10 @@ Cypress.Commands.add(
!!accountNames &&
win.localStorage.setItem(LOCALSTORAGE_ACCOUNT_NAMES_KEY, JSON.stringify(accountNames))

!!extensionConnectionAllowed &&
if (extensionConnectionAllowed) {
win.localStorage.setItem(LOCALSTORAGE_ALLOWED_CONNECTION_KEY, 'true')
win.localStorage.setItem(LOCALSTORAGE_EXTENSION_CONNECTION_KEY, 'true')
}
}
})

Expand Down
1 change: 1 addition & 0 deletions packages/ui/cypress/support/page-objects/landingPage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const landingPage = {
connectionDialog: () => cy.get('[data-cy=dialog-connection]'),
multixIntroHeader: () => cy.get('[data-cy=header-multix-introduction]', { timeout: 10000 }),
interactionPromptLabel: () => cy.get('[data-cy=label-interaction-prompt]'),
noMultisigFoundError: () => cy.get('[data-cy=label-no-multisig-found]', { timeout: 10000 }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Verify extrinsics display', () => {
})
})

it('The router.sell extrinsic is displayed in plank', () => {
it('The Router.sell extrinsic is displayed in plank', () => {
multisigPage.accountHeader().within(() => {
accountDisplay.addressLabel().should('contain.text', expectedMultisigAddress.slice(0, 6))
})
Expand All @@ -28,17 +28,17 @@ describe('Verify extrinsics display', () => {
.within(() => {
multisigPage.pendingTransactionItem().should('have.length', 1)
multisigPage.pendingTransactionItem().within(() => {
multisigPage.pendingTransactionCallName().should('contain.text', 'router.sell')
multisigPage.pendingTransactionCallName().should('contain.text', 'Router.sell')
multisigPage.unknownCallIcon().should('not.exist')
multisigPage.unknownCallAlert().should('not.exist')
expander.paramExpander().click()
expander.contentExpander().should('contain', 'amount_in: 10,000,000,000,000')
expander.contentExpander().should('contain', 'min_amount_out: 72,179')
expander.contentExpander().should('contain', '"amount_in": "10000000000000"')
expander.contentExpander().should('contain', '"min_amount_out": "72179"')
})
})
})

it('A manual omnipool.sell extrinsic creation has input in plank', () => {
it.skip('A manual omnipool.sell extrinsic creation has input in plank', () => {
multisigPage.accountHeader().within(() => {
accountDisplay.addressLabel().should('contain.text', expectedMultisigAddress.slice(0, 6))
})
Expand All @@ -56,7 +56,7 @@ describe('Verify extrinsics display', () => {
sendTxModal.paramField('amount').should('not.contain', 'HDX')
})

it('A manual balances.transferKeepAlive extrinsic has input in HDX', () => {
it.skip('A manual balances.transferKeepAlive extrinsic has input in HDX', () => {
multisigPage.accountHeader().within(() => {
accountDisplay.addressLabel().should('contain.text', expectedMultisigAddress.slice(0, 6))
})
Expand All @@ -74,7 +74,7 @@ describe('Verify extrinsics display', () => {
sendTxModal.paramField('value').should('contain', 'HDX')
})

it('A from call data balances.transferKeepAlive extrinsic has balance displayed in HDX and identicon for destination', () => {
it.skip('A from call data balances.transferKeepAlive extrinsic has balance displayed in HDX and identicon for destination', () => {
const balanceTransferCallData =
'0x0703d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0b00b04e2bde6f'
const sendingAmount = '123 HDX'
Expand All @@ -98,4 +98,25 @@ describe('Verify extrinsics display', () => {
})
})
})

it('A from call data balances.transferKeepAlive extrinsic is correctly displayed', () => {
const balanceTransferCallData =
'0x0703d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0b00b04e2bde6f'
const sendingAmount = '"value": "123000000000000"'
const expectedRecipient = '"dest": "7NPoMQbiA6trJKkjB35uk96MeJD4PGWkLQLH7k7hXEkZpiba"'

multisigPage.accountHeader().within(() => {
accountDisplay.addressLabel().should('contain.text', expectedMultisigAddress.slice(0, 6))
})

multisigPage.newTransactionButton().click()
sendTxModal.sendTxTitle().should('be.visible')
sendTxModal.selectEasySetup().click()
sendTxModal.selectionEasySetupSetupFromCallData().click()
sendTxModal.callDataInput().click().type(balanceTransferCallData)
sendTxModal.sendTxContent().within(() => {
expander.contentExpander().should('contain', sendingAmount)
expander.contentExpander().should('contain', expectedRecipient)
})
})
})
4 changes: 2 additions & 2 deletions packages/ui/cypress/tests/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ describe('Connect Account', () => {
cy.wrap(requests.length).should('eq', 1)
// this request should be from the application Multix
cy.wrap(requests[0].origin).should('eq', MULTIX_DAPP_NAME)
// let's allow it for Alice

// auth is rejected
cy.rejectAuth(requests[0].id, 'Cancelled')
// the ui should then move on to connecting to the rpcs
landingPage
.noAccountFoundError()
.should(
Expand Down
35 changes: 20 additions & 15 deletions packages/ui/cypress/tests/multisig-creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,17 @@ describe('Multisig creation', () => {

verifySignatories()

// this is commented because chopsticks doesnot support archive_unstable_hashByHeight
// see https://github.com/AcalaNetwork/chopsticks/issues/852

// there should be a pending pure proxy creation
multisigPage
.transactionList()
.should('be.visible')
.within(() => {
multisigPage.pendingTransactionItem().should('have.length', 1)
multisigPage.pendingTransactionCallName().should('contain.text', 'proxy.createPure')
})
// multisigPage
// .transactionList()
// .should('be.visible')
// .within(() => {
// multisigPage.pendingTransactionItem().should('have.length', 1)
// multisigPage.pendingTransactionCallName().should('contain.text', 'proxy.createPure')
// })
})

it('Create a multisig without a pure proxy', () => {
Expand Down Expand Up @@ -169,14 +172,16 @@ describe('Multisig creation', () => {
})

verifySignatories()

multisigPage
.transactionList()
.should('be.visible')
.within(() => {
multisigPage.pendingTransactionItem().should('have.length', 1)
multisigPage.pendingTransactionCallName().should('contain.text', 'system.remark')
})
// this is commented because chopsticks doesnot support archive_unstable_hashByHeight
// see https://github.com/AcalaNetwork/chopsticks/issues/852

// multisigPage
// .transactionList()
// .should('be.visible')
// .within(() => {
// multisigPage.pendingTransactionItem().should('have.length', 1)
// multisigPage.pendingTransactionCallName().should('contain.text', 'system.remark')
// })
})
})

Expand Down
4 changes: 2 additions & 2 deletions packages/ui/cypress/tests/transactions.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testAccounts } from '../fixtures/testAccounts'
import { knownMultisigs } from '../fixtures/knownMultisigs'
import { landingPageUrl } from '../fixtures/landingData'
import { landingPageAddressUrl } from '../fixtures/landingData'
import { multisigPage } from '../support/page-objects/multisigPage'
import { notifications } from '../support/page-objects/notifications'
import { sendTxModal } from '../support/page-objects/sendTxModal'
Expand All @@ -20,7 +20,7 @@ const fillAndSubmitTransactionForm = () => {
describe('Perform transactions', () => {
beforeEach(() => {
cy.setupAndVisit({
url: landingPageUrl,
url: landingPageAddressUrl(knownMultisigs['test-simple-multisig-1'].address),
extensionConnectionAllowed: true,
injectExtensionWithAccounts: [
testAccounts['Multisig Member Account 1'],
Expand Down
3 changes: 1 addition & 2 deletions packages/ui/cypress/tests/unknown-transaction.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ describe('Unknown Transaction', () => {
txSigningModal
.callInfoContainer()
.should('be.visible')
.should('contain.text', 'system.remark')
.should('contain.text', 'remark: multix ftw')
.should('contain.text', '"remark": "multix ftw"')
txSigningModal.approveButton().should('be.enabled')
})
})
Expand Down
8 changes: 7 additions & 1 deletion packages/ui/cypress/utils/clickOnConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { waitForAuthRequest } from './waitForAuthRequests'

export const clickOnConnect = () => {
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading your accounts')
landingPage.connectionDialog().should('exist')
landingPage
.connectionDialog()
.within(() => cy.get('button', { includeShadowDom: true }).contains('Connect').click())
waitForAuthRequest()
landingPage
.connectionDialog()
.within(() => cy.get('#close-button', { includeShadowDom: true }).click())
}
Loading
Loading