Skip to content
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} />;
};


```