View Storage and Retrieval Deals View Source



Here is an example of an experience for getting Filecoin Storage and Retrieval deals from Textile's Powergate.


Storage Deals
AddressRoot CIDStatusTime
t3solnyrrblqlmvi6gmzewzvu62vs7uqvkl22yemzr63bcylbaaqsg44mnipepuafg7efzzx4zwcsi66jgze3q
QmctRftYBfbWAtfz9svcprTnmah4eFJXdAUuBhAA6Z6c84
1594960648
t3ual5q5qo5wolfxsui4ciujfucqwf6gqso4lettcjwl2tyismgol7c4tngvoono5rmytuqotye7oosfjv6g7a
QmUXsfqC1bHbZyD7T341rBXQCfDxA8UaiAmziHcwRRZHsQ
Sealed On Filecoin
1594960738


Retrieval Deals
AddressRoot CIDTime
t3solnyrrblqlmvi6gmzewzvu62vs7uqvkl22yemzr63bcylbaaqsg44mnipepuafg7efzzx4zwcsi66jgze3q
QmctRftYBfbWAtfz9svcprTnmah4eFJXdAUuBhAA6Z6c84
1594960648
t3solnyrrblqlmvi6gmzewzvu62vs7uqvkl22yemzr63bcylbaaqsg44mnipepuafg7efzzx4zwcsi66jgze3q
QmUXsfqC1bHbZyD7T341rBXQCfDxA8UaiAmziHcwRRZHsQ
1594960738



Code



You must include at least one of withIncludeFinal(true) or withIncludePending(true)to ensure you get a response for listStorageDealRecords. Other optional ffsOptions that can be used to specify what data you get back are noted in the table below.


0
import * as React from "react";
1
import {
2
  FilecoinStorageDealsList,
3
  FilecoinRetrievalDealsList,
4
} from "slate-react-system";
5
import { createPow, ffsOptions } from "@textile/powergate-client";
6
7
const PowerGate = createPow({ host: "https://grpcweb.slate.textile.io" });
8
9
const includeFinal = ffsOptions.withIncludeFinal(true);
10
11
const includePending = ffsOptions.withIncludePending(true);
12
13
const { addrsList } = await PowerGate.ffs.addrs();
14
let addresses = addrsList.map((each) => each.addr);
15
const fromAddresses = ffsOptions.withFromAddresses(...addresses);
16
17
class Example extends React.Component {
18
  state = {
19
    storageList: [],
20
    retrievalList: [],
21
  }
22
23
  componentDidMount = async () => {
24
    const FFS = await PowerGate.ffs.create();
25
    const token = FFS.token ? FFS.token : null;
26
    PowerGate.setToken(token);
27
    const storageDeals = await PowerGate.ffs.listStorageDealRecords(
28
      includeFinal,
29
      includePending,
30
      fromAddresses
31
    );
32
    const retrievalDeals = await PowerGate.ffs.listRetrievalDealRecords();
33
    this.setState({ storageList: storageDeals.recordsList, retrievalList: retrievalDeals.recordsList, token });
34
  };
35
36
  render() {
37
    return (
38
      <React.Fragment>
39
        <FilecoinStorageDealsList data={this.state.storageList} />
40
        <FilecoinRetrievalDealsList data={this.state.retrievalList} />
41
      </React.Fragment>
42
    );
43
  }
44
}
45



Accepted Options Properties



To define what type of data you get back from listStorageDealRecords and listRetrievalDealRecords, pass in a destructured list of the below ffsOption functions.

Each of the ffsOption functions take a parameter of their own, whose type is detailed in the table below.


Storage Deals
NameInput TypeDefaultDescription
withIncludeFinal
boolean
false
Specifies whether or not to include final deals in the results. Ignored for listRetrievalDealRecords
withIncludePending
boolean
false
Specifies whether or not to include pending deals in the results. Ignored for listRetrievalDealRecords
withDataCids
...string[]
null
Limits the results to deals for the provided data cids
withFromAddresses
...string[]
null
Limits the results to deals initiated from the provided wallet addresses
withAscending
boolean
false
Specifies to sort the results in ascending order
ExperiencesCreateFilecoinAddressCreateFilecoinStorageDealCreateTokenFilecoinBalancesListFilecoinDealsListFilecoinSettingsFriendsListPeersListSendAddressFilecoin

Components
Avatar GroupButtonsCard TabsCarouselCheckboxesColorsDatepickerDropdownsGlobeHover TileIconsInputsLine ChartList EditorLoadersModalsNotificationsRadiosSlidersStatsTablesTabsTogglesTooltipsTypography
View source