Skip to content

[RN] Update changelog #1833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions .changeset/cold-dryers-dream.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ Enables passing a custom JWT to the embeddedWallet:

```javascript
import {
EmbeddedWallet,
embeddedWallet,
ThirdwebProvider,
useCreateWalletInstance,
useSetConnectedWallet,
} from '@thirdweb-dev/react-native';
import {Button} from 'react-native';
import React from 'react';
useConnect,
} from "@thirdweb-dev/react-native";
import { Button } from "react-native";
import React from "react";

const App = () => {
return (
Expand All @@ -24,35 +22,24 @@ const App = () => {
embeddedWallet({
custom_auth: true, // when true, it will not display a UI
}),
]}>
]}
>
<AppInner />
</ThirdwebProvider>
);
};

const AppInner = () => {
const createInstance = useCreateWalletInstance();
const setConnectedWallet = useSetConnectedWallet();
const connect = useConnect();

const triggerConnect = async () => {
const embeddedWalletConfig = embeddedWallet();

if (embeddedWalletConfig) {
const instance = createInstance(embeddedWalletConfig);

if (instance) {
await (instance as EmbeddedWallet).connect({
loginType: 'custom_jwt_auth',
encryptionKey: 'hello',
jwtToken: 'customJwt' || '',
});
setConnectedWallet(instance); // this sets the active wallet on the provider enabling all thirdweb hooks
}
}
connect(embeddedWallet(), {
loginType: "custom_jwt_auth",
encryptionKey: "strong-encryption-key",
jwtToken: "your-jwt-token",
});
};

return <Button title={'Connect with custom JWT'} onPress={triggerConnect} />;
return <Button title={"Connect with custom JWT"} onPress={triggerConnect} />;
};


```