0.2.14 • Published 2 years ago

react-native-v99-sdk v0.2.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-v99-sdk

v99 SDK

Installation

yarn add react-native-v99-sdk

Then install all dependencies

yarn add buffer metro-react-native-babel-preset react-native-quick-crypto readable-stream constants assert @craftzdog/react-native-buffer react-native-device-info react-native-keychain react-native-mmkv babel-plugin-module-resolver

Install pod

cd ios && pod install

Usage

import { ActionType } from 'app-v99-common';
import * as React from 'react';
import { useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import V99SDK from 'react-native-v99-sdk';

const secretKey =
  '-----BEGIN PUBLIC KEY-----' +
  'MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgH8pomuNWl6EU/ImgspO1dbilxfZ' +
  'uXYwt4GILQQcj+iIL9IK4ZVRGRleuumPw21B2d7C2RsoK44w+kEa7Mo8C5cpM/mE' +
  'UEreowgvjGEyqVcDagECMErsXFO9i+8KxZ9WRu4zGHgx7cqUOIy8rT/z+mr4ktar' +
  '9LYzbJzYeflDCytTAgMBAAE=' +
  '-----END PUBLIC KEY-----';

export function App() {
  const [result, setResult] = React.useState<string | undefined>();

  useEffect(async () => {
    const sdk = new V99SDK();

    const isInitialized = await sdk.init('miniapp1', secretKey);
    if (!isInitialized) {
      setResult('SDK is not initialized');
      return;
    }

    const mnemonic = await sdk.wallet.generateMnemonic();
    setResult(mnemonic);

    sdk.app.onSessionExpired(() => {
      console.log('on onSessionExpired');
    });

    sdk.app.onAccountChanged((account) => {
      console.log('on onAccountChanged', account);
    });
  }, []);

  return (
    <View style={styles.container}>
      <Text>Result: {result}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago