Skip to content

Instantly share code, notes, and snippets.

@jimmychu0807
Created March 4, 2020 12:06
Show Gist options
  • Save jimmychu0807/d88ba3e87bc2e0ad49b269772bab99a0 to your computer and use it in GitHub Desktop.
Save jimmychu0807/d88ba3e87bc2e0ad49b269772bab99a0 to your computer and use it in GitHub Desktop.
Markdium-用 Substrate Front-end Template 輕鬆打造你的 React 應用
//...
import { SubstrateContextProvider, useSubstrate } from './substrate-lib';
import { DeveloperConsole } from './substrate-lib/components';
//...
function Main() {
const [accountAddress, setAccountAddress] = useState(null);
const { apiState, keyring, keyringState } = useSubstrate();
const accountPair =
accountAddress &&
keyringState === 'READY' &&
keyring.getPair(accountAddress);
//...
return (
)
}
export default function App () {
return (
<SubstrateContextProvider>
<Main />
</SubstrateContextProvider>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment