Does testnet bitcoin pockets assist redirections?

0
81
Does testnet bitcoin pockets assist redirections?


We try to combine bitcoin testnet pockets with react native dapp usin deep linking. Such that when person tries to ship btc he can be directed to bitcoin testnet pockets and as soon as transaction is submitted person can be redirected again to react native dapp.

tried following code pattern :

deeplink used:

bitcoin:${bitcoinAddress}?quantity=${quantity}&label=${label}&message=${message}&r=${encodeURIComponent(
      redirectUrl
    )}&callback=${encodeURIComponent(callbackUrl)}

pockets app used:

https://play.google.com/retailer/apps/particulars?id=de.schildbach.wallet_test&hl=en&gl=US

import React, { AppState,useEffect } from "react";
import { Linking, View, Button } from "react-native";

const App = () => {
  const onPressHandler = () => {
    const bitcoinAddress = "2NCXR2f6QsrUf4Kfpz99bctNA96vUw9j4bP";
    const quantity = "0.000001";
    const label = "Take a look at transaction";
    const message = "It is a check transaction";
    const callbackUrl = "myapp://transaction_callback";
    const redirectUrl = "myapp://redirect_back";

    // Create the deep hyperlink URL with the callback and redirect URLs
    const deepLinkUrl = `bitcoin:${bitcoinAddress}?quantity=${quantity}&label=${label}&message=${message}&r=${encodeURIComponent(
      redirectUrl
    )}&callback=${encodeURIComponent(callbackUrl)}`;

    // Open the deep hyperlink URL within the person's Bitcoin pockets app
    Linking.openURL(deepLinkUrl);
  };

  operate handleUrl(url) {
    // Deal with the deep hyperlink URL right here
    console.log('Acquired deep hyperlink:', url);
  }
  
  operate handleAppStateChange(appState) {
    if (appState === 'lively') {
      Linking.getInitialURL().then(url => {
        console.log("check herrr")
        handleUrl(url)
      });
    }
  }

  useEffect(() => {
    AppState.addEventListener('change', handleAppStateChange);
    return () => AppState.removeEventListener('change', handleAppStateChange);

  }, []);

  return (
    // your app code right here
    <View>
      <Textual content>check</Textual content>
      <Button title="Press me" onPress={onPressHandler} shade="#841584" />
    </View>
  );
};

export default App;

Are there another wallets which assist redirections again to dapp and which assist testnet?

LEAVE A REPLY

Please enter your comment!
Please enter your name here