How to use the @polkadot/ui-keyring/observable/addresses.subject function in @polkadot/ui-keyring

To help you get started, we’ve selected a few @polkadot/ui-keyring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paritytech / substrate-light-ui / packages / transfer-app / src / Transfer.tsx View on Github external
useEffect(() => {
    const allAddressessub = combineLatest([
      // eslint-disable-next-line @typescript-eslint/unbound-method
      accountObservable.subject.pipe(map(Object.values)),
      // eslint-disable-next-line @typescript-eslint/unbound-method
      addressObservable.subject.pipe(map(Object.values))
    ])
      .pipe(map(flatten))
      .subscribe(setAllAddresses);

    return (): void => {
      allAddressessub.unsubscribe();
    };
  }, []);
github paritytech / substrate-light-ui / packages / transfer-app / src / Saved.tsx View on Github external
renderMyAddresses () {
    const { api } = this.context;
    const { match: { params: { currentAddress } } } = this.props;

    return (
      
        {addressObservable.subject.pipe(
          map((allAddresses: SubjectInfo) =>
            !Object.keys(allAddresses).length
              ? this.renderEmpty()
              : Object.values(allAddresses).map((address: SingleAddress) =>
github paritytech / substrate-light-ui / packages / light-apps / src / ManageAddresses / SavedAddresses.tsx View on Github external
useEffect(() => {
    const addressesSub = addressObservable.subject
      // eslint-disable-next-line @typescript-eslint/unbound-method
      .pipe(map(Object.values))
      .subscribe(setAddresses);

    return (): void => addressesSub.unsubscribe();
  }, []);
github paritytech / substrate-light-ui / packages / ui-components / src / stateful / InputAddress.tsx View on Github external
useEffect(() => {
    const subscription = combineLatest([
      keyringAccounts.subject,
      keyringAddresses.subject
    ]).subscribe(([acc, add]) => {
      setAccounts(acc);
      setAddresses(add);
    });

    return (): void => subscription.unsubscribe();
  }, []);
github polkadot-js / apps / packages / react-hooks / src / useAddresses.tsx View on Github external
useEffect((): () => void => {
    const subscription = addressObservable.subject.subscribe((addresses): void => {
      if (mounted.current) {
        const allAddresses = addresses ? Object.keys(addresses) : [];
        const hasAddresses = allAddresses.length !== 0;

        setState({ allAddresses, hasAddresses });
      }
    });

    return (): void => {
      subscription.unsubscribe();
    };
  }, []);