-
Notifications
You must be signed in to change notification settings - Fork 76
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
1 parent
150d53d
commit 439b177
Showing
34 changed files
with
752 additions
and
808 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
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,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using MetaMask.Unity; | ||
using Nethereum.JsonRpc.Client; | ||
using Newtonsoft.Json; | ||
|
||
namespace Thirdweb | ||
{ | ||
public class ThirdwebInterceptor : RequestInterceptor | ||
{ | ||
private readonly ThirdwebSession _thirdwebSession; | ||
|
||
public ThirdwebInterceptor(ThirdwebSession thirdwebSession) | ||
{ | ||
_thirdwebSession = thirdwebSession; | ||
} | ||
|
||
public override async Task<object> InterceptSendRequestAsync<T>(Func<RpcRequest, string, Task<T>> interceptedSendRequestAsync, RpcRequest request, string route = null) | ||
{ | ||
if (request.Method == "eth_accounts" && _thirdwebSession.IsConnected) | ||
{ | ||
return await _thirdwebSession.GetAddress().ConfigureAwait(false); | ||
} | ||
|
||
return await interceptedSendRequestAsync(request, route).ConfigureAwait(false); | ||
} | ||
|
||
public override async Task<object> InterceptSendRequestAsync<T>( | ||
Func<string, string, object[], Task<T>> interceptedSendRequestAsync, | ||
string method, | ||
string route = null, | ||
params object[] paramList | ||
) | ||
{ | ||
if (method == "eth_accounts") | ||
{ | ||
return await _thirdwebSession.GetAddress().ConfigureAwait(false); | ||
} | ||
|
||
return await interceptedSendRequestAsync(method, route, paramList).ConfigureAwait(false); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.