Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Uniity 4.15.0 Docs (#451)
Browse files Browse the repository at this point in the history
* pay updates

* blocks updates

* zksync note

* rename
  • Loading branch information
0xFirekeeper authored Jun 4, 2024
1 parent c657ef7 commit f53efca
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/app/unity/blocks/getblock/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Get block data by block number.

```csharp
BigInteger blockNumber = 1234567;
var block = await Blocks.GetBlock(blockNumber);
var block = await ThirdwebManager.Instance.SDK.Blocks.GetBlock(blockNumber);
```
2 changes: 1 addition & 1 deletion src/app/unity/blocks/getblockwithtransactions/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Get block data by block number, including transaction data.

```csharp
BigInteger blockNumber = 1234567;
var blockWithTransactions = await Blocks.GetBlockWithTransactions(blockNumber);
var blockWithTransactions = await ThirdwebManager.Instance.SDK.Blocks.GetBlockWithTransactions(blockNumber);
```
2 changes: 1 addition & 1 deletion src/app/unity/blocks/getlatestblocknumber/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Get the latest block number.
## Usage

```csharp
BigInteger blockNumber = await Blocks.GetLatestBlockNumber();
BigInteger blockNumber = await ThirdwebManager.Instance.SDK.Blocks.GetLatestBlockNumber();
```
2 changes: 1 addition & 1 deletion src/app/unity/blocks/getlatestblocktimestamp/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Get the latest block timestamp.
## Usage

```csharp
BigInteger blocktimestamp = await Blocks.GetLatestBlockTimestamp();
BigInteger blocktimestamp = await ThirdwebManager.Instance.SDK.Blocks.GetLatestBlockTimestamp();
```
2 changes: 1 addition & 1 deletion src/app/unity/pay/buywithcrypto/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using Thirdweb.Pay;

public async void Buy()
{
string txHash = await ThirdwebPay.BuyWithCrypto(_quote);
string txHash = await ThirdwebManager.Instance.SDK.Pay.BuyWithCrypto(_quote);
ThirdwebDebug.Log($"Transaction hash: {txHash}");
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/app/unity/pay/buywithfiat/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using Thirdweb.Pay;

public async void Buy()
{
string intentId = await ThirdwebPay.BuyWithFiat(_quote);
string intentId = await ThirdwebManager.Instance.SDK.Pay.BuyWithFiat(_quote);
ThirdwebDebug.Log($"Intent ID: {intentId}");
}
```
Expand Down
4 changes: 2 additions & 2 deletions src/app/unity/pay/getbuyhistory/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public async void GetBuyHistory()
{
string connectedAddress = await ThirdwebManager.Instance.SDK.Wallet.GetAddress();

BuyHistoryResult history = await ThirdwebPay.GetBuyHistory(walletAddress: connectedAddress, start: 0, count: 1);
BuyHistoryResult history = await ThirdwebManager.Instance.SDK.Pay.GetBuyHistory(walletAddress: connectedAddress, start: 0, count: 1);
ThirdwebDebug.Log($"History: {JsonConvert.SerializeObject(history, Formatting.Indented)}");

BuyHistoryResult historyNext = await ThirdwebPay.GetBuyHistory(walletAddress: connectedAddress, start: 1, count: 10, cursor: history.NextCursor, pageSize: null);
BuyHistoryResult historyNext = await ThirdwebManager.Instance.SDK.Pay.GetBuyHistory(walletAddress: connectedAddress, start: 1, count: 10, cursor: history.NextCursor, pageSize: null);
ThirdwebDebug.Log($"History Next: {JsonConvert.SerializeObject(historyNext, Formatting.Indented)}");
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/app/unity/pay/getbuywithcryptoquote/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async void GetQuote()
toAmount: "2" // I want to buy 2 WMATIC
);

BuyWithCryptoQuoteResult quote = await ThirdwebPay.GetBuyWithCryptoQuote(swapQuoteParams);
BuyWithCryptoQuoteResult quote = await ThirdwebManager.Instance.SDK.Pay.GetBuyWithCryptoQuote(swapQuoteParams);
ThirdwebDebug.Log($"Quote: {JsonConvert.SerializeObject(quote, Formatting.Indented)}");
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/app/unity/pay/getbuywithcryptostatus/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using Thirdweb.Pay;

public async void GetStatus()
{
BuyWithCryptoStatusResult status = await ThirdwebPay.GetBuyWithCryptoStatus(_txHash);
BuyWithCryptoStatusResult status = await ThirdwebManager.Instance.SDK.Pay.GetBuyWithCryptoStatus(_txHash);
if (status.Status == SwapStatus.FAILED.ToString())
ThirdwebDebug.LogWarning($"Failed! Reason: {status.FailureMessage}");

Expand Down
2 changes: 1 addition & 1 deletion src/app/unity/pay/getbuywithfiatcurrencies/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using Thirdweb.Pay;
[ContextMenu("Get Supported Currencies")]
public async void GetSupportedCurrencies()
{
List<string> currencies = await ThirdwebPay.GetBuyWithFiatCurrencies();
List<string> currencies = await ThirdwebManager.Instance.SDK.Pay.GetBuyWithFiatCurrencies();
ThirdwebDebug.Log($"Supported Currencies: {JsonConvert.SerializeObject(currencies, Formatting.Indented)}");
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/app/unity/pay/getbuywithfiatquote/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async void GetQuote()
toAmount: "20" // I want to buy 20 MATIC
);

BuyWithFiatQuoteResult quote = await ThirdwebPay.GetBuyWithFiatQuote(fiatQuoteParams);
BuyWithFiatQuoteResult quote = await ThirdwebManager.Instance.SDK.Pay.GetBuyWithFiatQuote(fiatQuoteParams);
ThirdwebDebug.Log($"Quote: {JsonConvert.SerializeObject(quote, Formatting.Indented)}");
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/app/unity/pay/getbuywithfiatstatus/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using Thirdweb.Pay;

public async void GetStatus()
{
var status = await ThirdwebPay.GetBuyWithFiatStatus(_intentId);
var status = await ThirdwebManager.Instance.SDK.Pay.GetBuyWithFiatStatus(_intentId);
if (status.Status == OnRampStatus.PAYMENT_FAILED.ToString() || status.Status == OnRampStatus.ON_RAMP_TRANSFER_FAILED.ToString())
ThirdwebDebug.LogWarning($"Failed! Reason: {status.FailureMessage}");

Expand Down
2 changes: 1 addition & 1 deletion src/app/unity/wallets/prefab/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ From the `Inspector` window, you can configure the options for the `ConnectWalle
The list of wallets you want to support.
Each wallet you provide appears as a button in the dropdown.

Supports `EmbeddedWallet`, `MetaMask`, `Coinbase`, `WalletConnect`, `LocalWallet`, `HyperPlay`, `Injected` (window.ethereum).
Supports `InAppWallet`, `MetaMask`, `Coinbase`, `WalletConnect`, `LocalWallet`, `HyperPlay`, `Injected` (window.ethereum).

Some wallet providers may not be supported on some native platforms.

Expand Down
6 changes: 6 additions & 0 deletions src/app/unity/wallets/providers/account-abstraction/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ var connection = new WalletConnection(
var address = await sdk.Wallet.Connect(connection);
```

## ZkSync Support

ZkSync chains make use of native account abstraction, whereby the user's EOA is the smart account. We support this as well.

The only difference is that no account factory or additional parameters are needed, simply set gasless to true, connect to ZkSync with a SmartWallet provider, and you're good to go.

## Additional Options

Smart accounts, through paymasters, can be seen as a "plugin" to your user wallets, whereby all gas fees can be sponsored onchain.
Expand Down
10 changes: 5 additions & 5 deletions src/app/unity/wallets/providers/in-app-wallet/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var sdk = ThirdwebManager.Instance.SDK;

// Configure the connection
var connection = new WalletConnection(
provider: WalletProvider.EmbeddedWallet,
provider: WalletProvider.InAppWallet,
chainId: 1,
email: "[email protected]",
);
Expand All @@ -41,7 +41,7 @@ var sdk = ThirdwebManager.Instance.SDK;

// Configure the connection
var connection = new WalletConnection(
provider: WalletProvider.EmbeddedWallet,
provider: WalletProvider.InAppWallet,
chainId: 1,
phoneNumber: "+1234567890",
authOptions: new AuthOptions(
Expand All @@ -67,7 +67,7 @@ var sdk = ThirdwebManager.Instance.SDK;

// Configure the connection
var connection = new WalletConnection(
provider: WalletProvider.EmbeddedWallet,
provider: WalletProvider.InAppWallet,
chainId: 1,
authOptions: new AuthOptions(
authProvider: AuthProvider.Google,
Expand All @@ -94,7 +94,7 @@ var sdk = ThirdwebManager.Instance.SDK;

// Configure the connection
var connection = new WalletConnection(
provider: WalletProvider.EmbeddedWallet,
provider: WalletProvider.InAppWallet,
chainId: 1,
authOptions: new AuthOptions(
authProvider: AuthProvider.JWT,
Expand Down Expand Up @@ -141,4 +141,4 @@ If using Custom Auth flow, attempts to connect directly after verifying the auth

## Miscellaneous

You may modify the `WalletProvider_EmbeddedWallet` prefab to fit your app's design, it is primarily used during the Email OTP process.
You may modify the `WalletProvider_InAppWallet` prefab to fit your app's design, it is primarily used during the Email OTP process.

0 comments on commit f53efca

Please sign in to comment.