Skip to content

Commit 4f304a3

Browse files
committed
Merge branch 'master' into ae-tests
2 parents d851398 + dacf9f4 commit 4f304a3

18 files changed

+536
-369
lines changed

.github/workflows/deploy.yml

-24
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We recommend running a [Substrate Contracts Node](https://github.com/paritytech/
1414

1515
### Contract instantiation
1616

17-
Once you have a compiled contract and you are connected to a node, you can use the hosted version of Contracts UI to [add a new contract on-chain](https://paritytech.github.io/contracts-ui/#/instantiate).
17+
Once you have a compiled contract and you are connected to a node, you can use the hosted version of Contracts UI to [add a new contract on-chain](https://contracts-ui.substrate.io/add-contract).
1818

1919
There are 2 instantiation methods:
2020

cypress/e2e/contracts/erc20.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('ERC20 Contract ', () => {
77
const allowance = 25;
88

99
it('contract file uploads', () => {
10-
cy.visit('http://localhost:8081/#/instantiate');
10+
cy.visit('http://localhost:8081/instantiate');
1111
cy.get('[data-cy="file-input"]').attachFile('erc20.contract');
1212
cy.get('[data-cy="next-btn"]').should('not.be.disabled');
1313
});

cypress/e2e/contracts/flipper.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe('Flipper Contract ', () => {
55
const timeout = 25000;
66

77
it('contract file uploads', () => {
8-
cy.visit('http://localhost:8081/#/instantiate');
8+
cy.visit('http://localhost:8081/instantiate');
99
cy.get('[data-cy="file-input"]').attachFile('flipper.contract');
1010
cy.get('[data-cy="next-btn"]').should('not.be.disabled');
1111
});

icons/app.webmanifest

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"icons": [
3+
{ "src": "icon-192.png", "type": "image/png", "sizes": "192x192" },
4+
{ "src": "icon-512.png", "type": "image/png", "sizes": "512x512" }
5+
]
6+
}

icons/apple-touch-icon.png

2.29 KB
Loading

icons/icon-192x192.png

2.24 KB
Loading

icons/icon-32x32.png

1.39 KB
Loading

icons/icon-512x512.png

2.24 KB
Loading

index.html

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<meta charset="utf-8" />
66
<title>Substrate Contracts UI</title>
77
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<link rel="icon" href="icons/icon-32x32.png" sizes="any">
9+
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png">
10+
<link rel="manifest" href="icons/app.webmanifest">
811
</head>
912

1013
<body>

package.json

+11-12
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
"description": "Substrate Contracts UI",
55
"private": true,
66
"type": "module",
7-
"homepage": "https://paritytech.github.io/contracts-ui",
7+
"homepage": "https://contracts-ui.substrate.io",
88
"scripts": {
99
"start": "vite",
1010
"build": "tsc && vite build",
11-
"build-github-pages": "tsc && vite build --config vite.config.ghp.ts",
1211
"lint": "yarn eslint --fix .",
1312
"format": "yarn prettier --write .",
1413
"clean": "rm -rf dist",
@@ -23,16 +22,16 @@
2322
"dependencies": {
2423
"@headlessui/react": "^1.6.1",
2524
"@heroicons/react": "^1.0.6",
26-
"@polkadot/api": "8.3.2",
27-
"@polkadot/api-contract": "8.3.2",
28-
"@polkadot/extension-dapp": "^0.43.1",
29-
"@polkadot/keyring": "^9.1.1",
30-
"@polkadot/types": "8.3.2",
31-
"@polkadot/ui-keyring": "^2.1.1",
32-
"@polkadot/ui-shared": "^2.1.1",
33-
"@polkadot/util": "^9.1.1",
34-
"@polkadot/util-crypto": "^9.1.1",
35-
"big.js": "^6.1.1",
25+
"@polkadot/api": "8.11.3",
26+
"@polkadot/api-contract": "8.11.3",
27+
"@polkadot/extension-dapp": "^0.44.1",
28+
"@polkadot/keyring": "^9.7.2",
29+
"@polkadot/types": "8.11.3",
30+
"@polkadot/ui-keyring": "^2.7.2",
31+
"@polkadot/ui-shared": "^2.7.2",
32+
"@polkadot/util": "^9.7.2",
33+
"@polkadot/util-crypto": "^9.7.2",
34+
"big.js": "^6.2.0",
3635
"buffer": "^6.0.3",
3736
"copy-to-clipboard": "^3.3.1",
3837
"date-fns": "^2.28.0",

src/api/connect.ts

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ export const connect = (endpoint: string, dispatch: React.Dispatch<ApiAction>) =
1414
const provider = new WsProvider(endpoint);
1515
const _api = new ApiPromise({
1616
provider,
17-
types: {
18-
DispatchErrorModule: {
19-
index: 'u8',
20-
error: '[u8; 4]',
21-
},
22-
},
2317
});
2418

2519
// Set listeners for disconnection and reconnection event.
+6-63
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,24 @@
11
// Copyright 2022 @paritytech/contracts-ui authors & contributors
22
// SPDX-License-Identifier: GPL-3.0-only
33

4-
import { useCallback } from 'react';
5-
import { XIcon } from '@heroicons/react/outline';
64
import { Button } from '../common/Button';
7-
import { useLocalStorage } from 'ui/hooks';
85

96
export function HelpBox(): React.ReactElement | null {
10-
const [closedHelpBox, setClosedHelpBox] = useLocalStorage('closedHelpBox', false);
11-
12-
const onClose = useCallback(() => {
13-
setClosedHelpBox(true);
14-
}, [setClosedHelpBox]);
15-
16-
if (closedHelpBox) {
17-
return null;
18-
}
19-
207
return (
21-
<>
22-
{/* <div className="mb-8 pb-8 border-b border-gray-200 dark:border-gray-800">
8+
<div className="mb-8 pb-8 border-b border-gray-200 dark:border-gray-800">
239
<div className="relative border p-4 dark:bg-elevation-1 dark:border-gray-800 border-gray-200 rounded w-auto">
24-
<XIcon
25-
className="w-5 h-5 absolute right-0 top-0 m-1 text-gray-500 justify-self-end cursor-pointer"
26-
aria-hidden="true"
27-
onClick={onClose}
28-
/>
29-
<div className="text-sm font-semibold text-blue-500 pb-1">
30-
Get started writing smart contracts
31-
</div>
10+
<div className="text-sm font-semibold text-blue-500 pb-1">Tell us more about yourself</div>
3211
<div className="text-xs text-gray-500 dark:text-gray-400 pb-2">
33-
Substrate Contracts UI lets you explore and interact with smart contracts written in ink!
34-
- a smart contract language based on Rust!{' '}
35-
<a
36-
href="https://paritytech.github.io/ink-docs/"
37-
target="_blank"
38-
rel="noreferrer"
39-
className="text-blue-500"
40-
>
41-
Learn more
42-
</a>
12+
We would love to know more about you so we can make our products better.
4313
</div>
4414
<div>
45-
<a
46-
href="https://github.com/paritytech/ink/tree/master/examples"
47-
target="_blank"
48-
rel="noreferrer"
49-
>
15+
<a href="https://forms.gle/hif9sHBr3bYPZjt38" target="_blank" rel="noreferrer">
5016
<Button className="border-2 py-1.5 px-3" variant="default">
51-
Explore Examples
17+
Take quick survey
5218
</Button>
5319
</a>
5420
</div>
5521
</div>
56-
</div> */}
57-
<div className="mb-8 pb-8 border-b border-gray-200 dark:border-gray-800">
58-
<div className="relative border p-4 dark:bg-elevation-1 dark:border-gray-800 border-gray-200 rounded w-auto">
59-
<XIcon
60-
className="w-5 h-5 absolute right-0 top-0 m-1 text-gray-500 justify-self-end cursor-pointer"
61-
aria-hidden="true"
62-
onClick={onClose}
63-
/>
64-
<div className="text-sm font-semibold text-blue-500 pb-1">
65-
Tell us more about yourself
66-
</div>
67-
<div className="text-xs text-gray-500 dark:text-gray-400 pb-2">
68-
We would love to know more about you so we can make our products better.
69-
</div>
70-
<div>
71-
<a href="https://forms.gle/hif9sHBr3bYPZjt38" target="_blank" rel="noreferrer">
72-
<Button className="border-2 py-1.5 px-3" variant="default">
73-
Take quick survey
74-
</Button>
75-
</a>
76-
</div>
77-
</div>
78-
</div>
79-
</>
22+
</div>
8023
);
8124
}

src/ui/components/instantiate/DryRun.tsx

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ import { formatBalance, formatNumber } from '@polkadot/util';
55
import { CheckCircleIcon, ExclamationCircleIcon } from '@heroicons/react/outline';
66
import { SidePanel } from '../common/SidePanel';
77
import { Account } from '../account/Account';
8-
import { useInstantiate } from 'ui/contexts';
8+
import { useApi, useInstantiate } from 'ui/contexts';
99

1010
export function DryRun() {
11-
const {
12-
data: { metadata },
13-
dryRunResult,
14-
} = useInstantiate();
15-
11+
const { dryRunResult } = useInstantiate();
12+
const { api } = useApi();
1613
const dryRunError =
17-
metadata && dryRunResult?.result.isErr && dryRunResult?.result.asErr.isModule
18-
? metadata.registry.findMetaError(dryRunResult?.result.asErr.asModule)
14+
api && dryRunResult?.result.isErr && dryRunResult?.result.asErr.isModule
15+
? api.registry.findMetaError(dryRunResult?.result.asErr.asModule)
1916
: null;
2017

2118
return (

src/ui/components/modal/ModalBase.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export const ModalBase = ({ isOpen, setIsOpen, title, children }: ModalProps) =>
2222
<Dialog as="div" className="fixed inset-0 z-99 overflow-y-auto " onClose={closeModal}>
2323
<div className="min-h-screen px-4 text-center">
2424
<Transition.Child
25-
as={Fragment}
2625
enter="ease-out duration-300"
2726
enterFrom="opacity-0"
2827
enterTo="opacity-100"

src/ui/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import { Buffer } from 'buffer';
55
import { createRoot } from 'react-dom/client';
6-
import { HashRouter, Route, Routes } from 'react-router-dom';
6+
import { BrowserRouter, Route, Routes } from 'react-router-dom';
77
import App from 'ui/components/App';
88
import './styles/main.css';
99
import '@polkadot/api-augment';
@@ -26,19 +26,19 @@ const container = document.getElementById('app-root');
2626
const root = createRoot(container!);
2727

2828
root.render(
29-
<HashRouter>
29+
<BrowserRouter>
3030
<Routes>
3131
<Route path="/" element={<App />}>
3232
<Route index element={<Homepage />} />
3333
<Route path="add-contract" element={<AddContract />} />
3434
<Route path="hash-lookup" element={<SelectCodeHash />} />
35-
<Route path="/instantiate" element={<Instantiate />}>
35+
<Route path="instantiate" element={<Instantiate />}>
3636
<Route path=":codeHash" />
3737
</Route>
38-
<Route path="/contract/:address/" element={<Contract />} />
39-
<Route path="/settings" element={<Settings />} />
38+
<Route path="contract/:address/" element={<Contract />} />
39+
<Route path="settings" element={<Settings />} />
4040
<Route path="*" element={<NotFound />} />
4141
</Route>
4242
</Routes>
43-
</HashRouter>
43+
</BrowserRouter>
4444
);

vite.config.ghp.ts

-30
This file was deleted.

0 commit comments

Comments
 (0)