1.0.1 • Published 5 months ago
@nuvosphere.io/react-native-nuvo-sdk v1.0.1
This is a Nuvo SDK react native
Getting Started
install
# using npm
npm install @nuvosphere.io/react-native-nuvo-sdk
# OR using Yarn
yarn add @nuvosphere.io/react-native-nuvo-sdk
Example
For Android
function handleToLogin() {
rnNuvoSdkRef.current.Login({
appId: APP_ID,
appKey: APP_KEY,
switchAccount:false
}).then((res: any) => {
console.log("login success:", res);setToken
setToken(res);
}).catch((err: any) => {
console.log("exec err:", err)``
setToken(JSON.stringify(err));
});
}
function getUserInfo() {
rnNuvoSdkRef.current.getUserInfo().then((res: any) => {
console.log("getUserInfo success:", res);
setUserInfo(JSON.stringify(res));
});
}
function handleToTransfer() {
rnNuvoSdkRef.current.transfer({
"from": "0xf1181bd15E8780B69a121A8D8946cC1C23972Bd4",
"to": "0xf1181bd15E8780B69a121A8D8946cC1C23972Bd4",
"value": "1000000000000",
"data": "0x",
"chainId": 599
}).then((res: any) => {
console.log("transfer success:", res);
setInfo(JSON.stringify(res));
})
.catch((err: any) => {
console.log("exec err:", err)
setInfo(JSON.stringify(err));
});
;
}
function handleToContractTransfer() {
rnNuvoSdkRef.current.contractTransfer({
"contractAddress": "0x70E45aD1d427532d8E7A86bC2037be0fd00e4829",
"ABI": "function transfer(address to,uint256 amount)",
"method": "transfer",
"args": ['0xf1181bd15E8780B69a121A8D8946cC1C23972Bd4', '100000000000'],
"chainId": 599
}).then((res: any) => {
console.log("handleToContractTransfer success:", res);
setInfo(JSON.stringify(res));
})
.catch((err: any) => {
console.log("exec err:", err)
setInfo(JSON.stringify(err));
});
}
return (
<>
<ModalLayers>
<View>
<Button title="to Login" onPress={() => handleToLogin()}/>
<Text>token: {token}</Text>
{token && (
<>
<Button
onPress={() => handleToContractTransfer()}
title=" contract Payable Method"
/>
<Text>result: {info}</Text>
<Button
onPress={() => handleToTransfer()}
title=" transfer Method"
/>
<Text>result: {info}</Text>
</>
)}
<Button title="Get User Info" onPress={() => getUserInfo()}/>
<Text>user info:{userInfo}</Text>
<RNNuvoSDK
ref={rnNuvoSdkRef}
appId={APP_ID}
apiHost={API_HOST}
oauthHost={OAUTH_URL}
>
</RNNuvoSDK>
</View>
</ModalLayers>
</>
);
1.0.0-beta.14
5 months ago
1.0.0-beta.13
5 months ago
1.0.0-beta.11
5 months ago
1.0.0-beta.12
5 months ago
1.0.0-beta.10
5 months ago
1.0.0-beta.9
5 months ago
1.0.0-beta.8
6 months ago
1.0.0-beta.7
6 months ago
1.0.0-beta.6
6 months ago
1.0.0-beta.5
6 months ago
1.0.0-beta.4
6 months ago
1.0.1
6 months ago
1.0.0-beta.3
6 months ago
1.0.0-beta.2
6 months ago
1.0.0-beta.1
6 months ago
1.0.0
6 months ago