Skip to content
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

Decouple singleton // Instance based classes #193

Merged
merged 4 commits into from
Jun 3, 2024
Merged

Conversation

0xFirekeeper
Copy link
Member

@0xFirekeeper 0xFirekeeper commented May 31, 2024

Moving towards removing ThirdwebManager dependency for SDKs that want to wrap thirdweb. Also will make it easier to port .NET SDK into Unity SDK later.

Removes old Authenticate and uses thirdweb auth backend based one only.

Removes Nethereum.SIWE, Nethereum.SIWE.Core, Nethereum.GnosisSafe

External and Common APIs affected:

  • Pay is no longer static, goes through SDK.Pay.*
  • Blocks is no longer static, goes through SDK.Blocks.*
  • AuthenticateAndLoginServerSide is now just Authenticate. Previous Authenticate/Verify client side examples removed.
  • Raw Transaction constructor (not through Contract.Prepare) now takes in sdk.
  • Most other raw constructors take in sdk or partial.

Most internal APIs changed, ThirdwebManager Instances all removed except for WalletConnect ScriptableObject Load.
Some utils take in an extra parameter now, some uncommon utils removed.

Adds a couple basic tests for raw sdk initialization, will need to move some of the defaults logic out of ThirdwebManager to make it more user-friendly.

This PR also improves passing down rpc headers when instantiating a ThirdwebClient for readonly purposes, will speed up reads when available. Adds Utils to get headers and get web3.


PR-Codex overview

The focus of this PR is restructuring classes and improving wallet functionalities.

Detailed summary

  • Moved classes to Thirdweb.Pay namespace
  • Updated wallet connection and wallet UI functionalities
  • Enhanced wallet functionalities and IPFS gateway handling

The following files were skipped due to too many changes: Assets/Tests/StorageTests.cs, Assets/Thirdweb/Examples/Scripts/Prefabs/Prefab_BuyWithCrypto.cs, Assets/Thirdweb/Core/Scripts/Pay/ThirdwebPay.BuyWithCrypto.cs, Assets/Thirdweb/Core/Scripts/Pay/ThirdwebPay.GetBuyWithFiatStatus.cs, Assets/Thirdweb/Core/Scripts/Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs, Assets/Thirdweb/Core/Scripts/Pay/ThirdwebPay.GetBuyWithFiatQuote.cs, Assets/Thirdweb/Core/Scripts/Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs, Assets/Thirdweb/Core/Scripts/Pay/ThirdwebPay.GetBuyHistory.cs, Assets/Thirdweb/Core/Scripts/Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs, Assets/Thirdweb/Core/Scripts/WalletsUI/WalletConnectUI.cs, Assets/Thirdweb/Examples/Scripts/Prefabs/Prefab_BuyWithFiat.cs, Assets/Thirdweb/Core/Scripts/EIP712.cs, Assets/Thirdweb/Examples/Scripts/Prefabs/Prefab_Miscellaneous.cs, Assets/Thirdweb/Core/Scripts/ThirdwebSession.cs, Assets/Tests/WalletTests.cs, Assets/Thirdweb/Core/Scripts/Blocks.cs, Assets/Thirdweb/Core/Scripts/ThirdwebSDK.cs, Assets/Thirdweb/Core/Scripts/TransactionManager.cs, Assets/Tests/ThirdwebSDKTests.cs, Assets/Thirdweb/Core/Scripts/Storage/Storage.cs, Assets/Thirdweb/Core/Scripts/Pack.cs, Assets/Thirdweb/Core/Scripts/AccountAbstraction/Core/BundlerClient.cs, Assets/Thirdweb/Core/Scripts/Utils.cs, Assets/Thirdweb/Core/Scripts/Contract.cs, Assets/Thirdweb/Core/Scripts/Transaction.cs, Assets/Thirdweb/Core/Scripts/ERC20.cs, Assets/Thirdweb/Core/Scripts/ERC721.cs, Assets/Thirdweb/Core/Scripts/AccountAbstraction/Core/SmartWallet.cs, Assets/Thirdweb/Core/Scripts/Marketplace.cs, Assets/Thirdweb/Core/Scripts/ERC1155.cs, Assets/Thirdweb/Core/Scripts/Wallet.cs

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Moving towards removing ThirdwebManager dependency for SDKs that want to wrap thirdweb. Also will make it easier to port .NET SDK into Unity SDK later.
Copy link

github-actions bot commented May 31, 2024

Test Results for iOS

  1 files  ±0   16 suites  +1   8m 19s ⏱️ +19s
102 tests +6  102 ✅ +6  0 💤 ±0  0 ❌ ±0 
106 runs  +6  106 ✅ +6  0 💤 ±0  0 ❌ ±0 

Results for commit 3d3fd7a. ± Comparison against base commit 7f62dbf.

This pull request removes 2 and adds 8 tests. Note that renamed tests count towards both.
Authenticate_WithLocalWallet_Success
Verify_WithLocalWallet_Success
ContractRead_Success
ContractWrite_Success
CustomContractRead_Success
CustomContractWrite_Success
IPFSDownload_Success
IPFSUpload_Success
Initialization_Success
WalletSignMessage_Success

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 31, 2024

Test Results for Android

  1 files  ±0   16 suites  +1   8m 9s ⏱️ +7s
102 tests +6  102 ✅ +6  0 💤 ±0  0 ❌ ±0 
106 runs  +6  106 ✅ +6  0 💤 ±0  0 ❌ ±0 

Results for commit 3d3fd7a. ± Comparison against base commit 7f62dbf.

This pull request removes 2 and adds 8 tests. Note that renamed tests count towards both.
Authenticate_WithLocalWallet_Success
Verify_WithLocalWallet_Success
ContractRead_Success
ContractWrite_Success
CustomContractRead_Success
CustomContractWrite_Success
IPFSDownload_Success
IPFSUpload_Success
Initialization_Success
WalletSignMessage_Success

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 31, 2024

Test Results for WebGL

  1 files  ±0   16 suites  +1   8m 15s ⏱️ +18s
102 tests +6  102 ✅ +6  0 💤 ±0  0 ❌ ±0 
106 runs  +6  106 ✅ +6  0 💤 ±0  0 ❌ ±0 

Results for commit 3d3fd7a. ± Comparison against base commit 7f62dbf.

This pull request removes 2 and adds 8 tests. Note that renamed tests count towards both.
Authenticate_WithLocalWallet_Success
Verify_WithLocalWallet_Success
ContractRead_Success
ContractWrite_Success
CustomContractRead_Success
CustomContractWrite_Success
IPFSDownload_Success
IPFSUpload_Success
Initialization_Success
WalletSignMessage_Success

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 31, 2024

Test Results for StandaloneLinux64

  1 files  ±0   16 suites  +1   7m 57s ⏱️ -12s
102 tests +6  102 ✅ +6  0 💤 ±0  0 ❌ ±0 
106 runs  +6  106 ✅ +6  0 💤 ±0  0 ❌ ±0 

Results for commit 3d3fd7a. ± Comparison against base commit 7f62dbf.

This pull request removes 2 and adds 8 tests. Note that renamed tests count towards both.
Authenticate_WithLocalWallet_Success
Verify_WithLocalWallet_Success
ContractRead_Success
ContractWrite_Success
CustomContractRead_Success
CustomContractWrite_Success
IPFSDownload_Success
IPFSUpload_Success
Initialization_Success
WalletSignMessage_Success

♻️ This comment has been updated with latest results.

@0xFirekeeper
Copy link
Member Author

/codex do you even know what this pr is about

Copy link

pr-codex bot commented May 31, 2024

do you even know what this pr is about

@0xFirekeeper This PR involves several changes related to the Thirdweb project. Here are some highlights:

  1. Namespace and Class Changes:

    • Moved ThirdwebPay class to the Thirdweb.Pay namespace.
    • Added a constructor to ThirdwebPay that takes a ThirdwebSDK instance.
  2. Code Refactoring:

    • Updated the rpc value based on conditions in ThirdwebManager.cs.
    • Made changes to the Prefab_SmartWallet.cs file, adding a reference to ThirdwebManager.
    • Updated UserOpUtils.cs.meta and ThirdwebPay.cs.meta files with new guid values.
  3. Functionality Updates:

    • Updated the ThirdwebManagerTests.cs file to check certain conditions.
    • Made changes to the Events class constructor to accept a ThirdwebSDK instance.
    • Updated TransactionReadTests.cs to include the chain ID from the ThirdwebManager SDK instance.
    • Updated ThirdwebInAppWallet.cs and ThirdwebMetamask.cs to include an additional field (_clientId and _appName respectively) in their constructors.
    • Modified the ThirdwebPay.BuyWithFiat method to use ThirdwebManager instance by default.
  4. Wallet and Connection Updates:

    • Updated the ThirdwebSmartWallet.cs file to use the ThirdwebSDK instance instead of SmartWalletConfig.
    • Updated ThirdwebWalletConnect.cs to include supported chains and wallet IDs.
    • Updated the InAppWalletUI.cs file to include a clientId parameter in the Connect method.
  5. Miscellaneous Changes:

    • Made changes to the Prefab_Miscellaneous.prefab file, updating button names.
    • Updated the StorageTests.cs file to include IPFS gateway-related changes.

These changes aim to improve functionality, structure, and maintainability within the Thirdweb project.

@0xFirekeeper 0xFirekeeper merged commit edc3202 into main Jun 3, 2024
13 checks passed
@0xFirekeeper 0xFirekeeper deleted the firekeeper/decouple branch June 3, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant