-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
87 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Unwraps the promise to allow resolving/rejecting outside the Promise constructor | ||
*/ | ||
export class Deferred<T = void> { | ||
readonly promise: Promise<T>; | ||
resolve!: (value: T) => void; | ||
reject!: (reason?: unknown) => void; | ||
|
||
constructor() { | ||
this.promise = new Promise<T>((resolve, reject) => { | ||
this.resolve = resolve; | ||
this.reject = reject; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { JsonRpcProvider, JsonRpcSigner, Web3Provider } from '@ethersproject/providers'; | ||
import { IBindings } from '@lens-protocol/react-native'; | ||
import { IProvider } from '@walletconnect/modal-react-native'; | ||
|
||
export function bindings(providerPromise: Promise<IProvider>): IBindings { | ||
return { | ||
getProvider: async (): Promise<JsonRpcProvider> => { | ||
const provider = await providerPromise; | ||
|
||
console.log('getProvider', provider); | ||
|
||
if (!provider) { | ||
throw new Error('Provider not defined'); | ||
} | ||
|
||
return new Web3Provider(provider); | ||
}, | ||
getSigner: async (): Promise<JsonRpcSigner> => { | ||
const provider = await providerPromise; | ||
|
||
console.log('getSigner', provider); | ||
|
||
if (!provider) { | ||
throw new Error('Provider not defined'); | ||
} | ||
|
||
const ethersProvider = new Web3Provider(provider); | ||
|
||
return ethersProvider.getSigner(); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.