Generate Powergate token View Source



Here is an example of an experience for generating a powergate token in the client.


Copy



Code



0
import * as React from "react";
1
import { CreateToken } from "slate-react-system";
2
import { createPow } from "@textile/powergate-client";
3
4
const PowerGate = createPow({ host: "https://grpcweb.slate.textile.io" });
5
6
class Example extends React.Component {
7
  state = {
8
    token: null,
9
  };
10
11
  _handleCreateToken = async () => {
12
    const FFS = await PowerGate.ffs.create();
13
    const token = FFS.token ? FFS.token : null;
14
    PowerGate.setToken(token);
15
    this.setState({ token });
16
  };
17
18
  render() {
19
    return (
20
      <CreateToken token={this.state.token} onClick={this._handleCreateToken} />
21
    );
22
  }
23
}
24
ExperiencesCreateFilecoinAddressCreateFilecoinStorageDealCreateTokenFilecoinBalancesListFilecoinDealsListFilecoinSettingsFriendsListPeersListSendAddressFilecoin

Components
Avatar GroupButtonsCard TabsCarouselCheckboxesColorsDatepickerDropdownsGlobeHover TileIconsInputsLine ChartList EditorLoadersModalsNotificationsRadiosSlidersStatsTablesTabsTogglesTooltipsTypography
View source