diff --git a/docs/reference/unity.md b/docs/reference/unity.md new file mode 100644 index 000000000..7b9cee2c4 --- /dev/null +++ b/docs/reference/unity.md @@ -0,0 +1,17 @@ +--- +title: Unity SDK reference +authors: Tim McMackin +last_update: + date: 6 December 2023 +--- + +The Tezos SDK for Unity provides several objects that your Unity project can use to work with Tezos. +These pages provide reference for the most important of these objects: + +- [API object](./unity/API): Provides information about the Tezos blockchain, such as what tokens accounts or contracts control +- [DAppMetadata object](./unity/DAppMetadata): Provides read-only properties that describe the project +- [MessageReceiver object](./unity/MessageReceiver): Provides events that you can add listeners to, such as when users connect their wallets +- [TokenContract object](./unity/TokenContract): Provides a built-in FA2-compatible smart contract and convenience methods to work with it +- [Wallet object](./unity/Wallet): Provides methods to connect to wallets and send transactions from the connected account + +The SDK also provides Unity prefabs that are prerequisites for the SDK; see [Prefabs](./unity/prefabs). diff --git a/docs/reference/unity/API.md b/docs/reference/unity/API.md new file mode 100644 index 000000000..5b1472898 --- /dev/null +++ b/docs/reference/unity/API.md @@ -0,0 +1,509 @@ +--- +title: Unity SDK API object +sidebar_label: API object +authors: Tim McMackin +last_update: + date: 6 December 2023 +--- + +The Unity SDK class `TezosSDK.Tezos.API.TezosAPI`, which is available at runtime as the `TezosManager.Instance.Tezos.API` object, provides information about the Tezos blockchain, such as what tokens accounts or contracts control. + +## Properties + +None. + +## Methods + +### `GetTezosBalance()` + +```csharp +IEnumerator GetTezosBalance(Action callback, string address); +``` + +Returns the balance of the specified account address in mutez. + +Example: + +```csharp +public void RunGetTezosBalance() +{ + Debug.Log("Getting balance"); + var routine = TezosManager.Instance.Tezos.API.GetTezosBalance( + HandleTezosBalance, + myAddress + ); + StartCoroutine(routine); +} + +private void HandleTezosBalance(ulong balanceMutez) +{ + Debug.Log(balanceMutez/1000000); +} +``` + +### `ReadView()` + +```csharp +IEnumerator ReadView(string contractAddress, + string entrypoint, + string input, + Action callback); +``` + +Returns the response from a contract [view](../../smart-contracts/views). + +Example: + +TODO + +```csharp +``` + +### `GetTokensForOwner()` + +```csharp +IEnumerator GetTokensForOwner( + Action> callback, + string owner, + bool withMetadata, + long maxItems, + TokensForOwnerOrder orderBy); +``` + +Gets the tokens that an account owns. + +Example: + +```csharp +public void RunGetTokensForOwner() +{ + var routine = TezosManager.Instance.Tezos.API.GetTokensForOwner( + callback: HandleTokenBalances, + owner: myAddress, + withMetadata: true, + maxItems: 10, + orderBy: new TokensForOwnerOrder.ByLastTimeAsc(0) + ); + StartCoroutine(routine); +} + +private void HandleTokenBalances(IEnumerable tokenBalances) +{ + List tokens = new List(tokenBalances); + foreach (var tb in tokens) + { + Debug.Log($"{tb.Balance} tokens on contract {tb.TokenContract.Address}"); + } +} +``` + +### `GetOwnersForToken()` + +```csharp +IEnumerator GetOwnersForToken( + Action> callback, + string contractAddress, + uint tokenId, + long maxItems, + OwnersForTokenOrder orderBy); +``` + +Gets the accounts that own the specified token. + +Example: + +```csharp +public void RunGetOwnersForToken() +{ + var routine = TezosManager.Instance.Tezos.API.GetOwnersForToken( + callback: HandleTokenOwners, + contractAddress: TezosManager.Instance.Tezos.TokenContract.Address, + tokenId: 0, + maxItems: 10, + orderBy: new OwnersForTokenOrder.ByLastTimeAsc(0) + ); + StartCoroutine(routine); +} + +private void HandleTokenOwners(IEnumerable tokenBalances) +{ + List tokens = new List(tokenBalances); + foreach (var tb in tokens) + { + Debug.Log($"{tb.Balance} tokens on contract {tb.TokenContract.Address}"); + } +} +``` + +### `GetOwnersForContract()` + +```csharp +IEnumerator GetOwnersForContract( + Action> callback, + string contractAddress, + long maxItems, + OwnersForContractOrder orderBy); +``` + +Gets the accounts that own tokens on the specified contract. + +Example: + +```csharp +public void RunGetOwnersForContract() +{ + var routine = TezosManager.Instance.Tezos.API.GetOwnersForContract( + callback: HandleOwnersForContract, + contractAddress: TezosManager.Instance.Tezos.TokenContract.Address, + maxItems: 10, + orderBy: new OwnersForContractOrder.ByLastTimeAsc(0) + ); + StartCoroutine(routine); +} + +private void HandleOwnersForContract(IEnumerable tokenBalances) +{ + List tokens = new List(tokenBalances); + foreach (var tb in tokens) + { + Debug.Log($"{tb.Owner} owns {tb.Balance} tokens on contract {tb.TokenContract.Address}"); + } +} +``` + +### `IsHolderOfContract()` + +```csharp +IEnumerator IsHolderOfContract( + Action callback, + string wallet, + string contractAddress); +``` + +Returns true if the specified account owns any token in the specified contract. + +Example: + +```csharp +public void GetIsHolderOfContract() +{ + var routine = TezosManager.Instance.Tezos.API.IsHolderOfContract( + callback: HandleIsHolderOfContract, + wallet: myAddress, + contractAddress: TezosManager.Instance.Tezos.TokenContract.Address + ); + StartCoroutine(routine); +} + +private void HandleIsHolderOfContract(bool response) +{ + Debug.Log(response); +} +``` + +### `IsHolderOfToken()` + +```csharp +IEnumerator IsHolderOfToken( + Action callback, + string wallet, + string contractAddress, + uint tokenId); +``` + +Returns true if the specified account owns the specified token in the specified contract. + +Example: + +```csharp +public void GetIsHolderOfToken() +{ + var routine = TezosManager.Instance.Tezos.API.IsHolderOfToken( + callback: HandleIsHolderOfToken, + wallet: myAddress, + contractAddress: TezosManager.Instance.Tezos.TokenContract.Address, + tokenId: 0 + ); + StartCoroutine(routine); +} + +private void HandleIsHolderOfToken(bool response) +{ + Debug.Log(response); +} +``` + +### `GetTokenMetadata()` + +```csharp +IEnumerator GetTokenMetadata( + Action callback, + string contractAddress, + uint tokenId); +``` + +Gets the metadata for the specified token. + +Example: + +```csharp +public void RunGetTokenMetadata() +{ + var routine = TezosManager.Instance.Tezos.API.GetTokenMetadata( + callback: HandleGetTokenMetadata, + contractAddress: TezosManager.Instance.Tezos.TokenContract.Address, + tokenId: 0 + ); + StartCoroutine(routine); +} + +private void HandleGetTokenMetadata(JsonElement tokenMetadata) +{ + Debug.Log(tokenMetadata.GetProperty("name")); +} +``` + +### `GetContractMetadata()` + +```csharp +public IEnumerator GetContractMetadata( + Action callback, + string contractAddress); +``` + +Gets the metadata for the specified contract. +Most contracts, including the built-in FA2 contract, do not have metadata. + +Example: + +```csharp +public void RunGetContractMetadata() +{ + var routine = TezosManager.Instance.Tezos.API.GetContractMetadata( + callback: HandleGetContractMetadata, + contractAddress: TezosManager.Instance.Tezos.TokenContract.Address + ); + StartCoroutine(routine); +} + +private void HandleGetContractMetadata(JsonElement contractMetadata) +{ + Debug.Log(contractMetadata); +} +``` + +### `GetTokensForContract()` + +```csharp +IEnumerator GetTokensForContract( + Action> callback, + string contractAddress, + bool withMetadata, + long maxItems, + TokensForContractOrder orderBy); +``` + +Gets the tokens in a contract. + +Example: + +```csharp +public void RunGetTokensForContract() +{ + timesCalled = 0; + var routine = TezosManager.Instance.Tezos.API.GetTokensForContract( + callback: HandleGetTokensForContract, + contractAddress: TezosManager.Instance.Tezos.TokenContract.Address, + withMetadata: true, + maxItems: 10, + orderBy: new TokensForContractOrder.ByLastTimeAsc(0) + ); + StartCoroutine(routine); +} + +private void HandleGetTokensForContract(IEnumerable tokenList) +{ + List tokens = new List(tokenList); + foreach (var tk in tokens) + { + Debug.Log(tk.TokenId); + } +} +``` + +The callback returns a list of tokens, but not all of the fields in the `Token` objects are populated by default. +You can populate the fields you want to retrieve by editing the `GetTokensForContract` method of the `TezosSDK.Tezos.API.TezosAPI` class. + +The methods in this class retrieves information about Tezos via the [TZKT](https://tzkt.io/) block explorer. +To change the information that the `GetTokensForContract` method retrieves, update the URL to add fields. + +The default URL looks like this: + +```csharp +var url = + $"tokens?contract={contractAddress}&select=contract,tokenId as token_id" + + $"{(withMetadata ? ",metadata as token_metadata" : "")},holdersCount as holders_count,id," + + $"lastTime as last_time&{sort}&limit={maxItems}"; +``` + +To get the total supply of each token type, add the `totalSupply` field to the URL, like this: + +```csharp +var url = + $"tokens?contract={contractAddress}&select=contract,tokenId as token_id" + + $"{(withMetadata ? ",metadata as token_metadata" : "")},holdersCount as holders_count,id," + + $"totalSupply as total_supply," + + $"lastTime as last_time&{sort}&limit={maxItems}"; +``` + +Now when you run the `GetTokensForContract` method, the data passed to the callback includes the total supply of each token: + +```csharp +private void HandleGetTokensForContract(IEnumerable tokenList) +{ + List tokens = new List(tokenList); + foreach (var tk in tokens) + { + Debug.Log($"Token ID {tk.TokenId} has total supply {tk.TotalSupply} among {tk.HoldersCount} holders"); + } +} +``` + +For information about what fields you can add to this URL, see the [TZKT API reference](https://api.tzkt.io/). + +### `GetOperationStatus()` + +```csharp +IEnumerator GetOperationStatus( + Action callback, + string operationHash); +``` + +Returns true if the specified operation was successful, false if it failed, or null (or HTTP 204) if it doesn't exist. + +Example: + +```csharp +public void HandleTransfer() +{ + TezosManager + .Instance + .Tezos + .TokenContract + .Transfer( + completedCallback: TransferCompleted, + destination: address.text, + tokenId: int.Parse(id.text), + amount: int.Parse(amount.text)); +} + +private void TransferCompleted(string txHash) +{ + Debug.Log($"Transfer complete with transaction hash {txHash}"); + var routine = TezosManager.Instance.Tezos.API.GetOperationStatus( + callback: HandleGetOperationStatus, + operationHash: txHash + ); + StartCoroutine(routine); +} + +private void HandleGetOperationStatus(bool? result) +{ + Debug.Log(result); +} +``` + +### `GetLatestBlockLevel()` + +```csharp +IEnumerator GetLatestBlockLevel( + Action callback); +``` + +Returns the block level, or the number of blocks since the genesis block. + +Example: + +```csharp +public void RunGetLatestBlockLevel() +{ + var routine = TezosManager.Instance.Tezos.API.GetLatestBlockLevel( + callback: HandleGetLatestBlockLevel + ); + StartCoroutine(routine); +} + +private void HandleGetLatestBlockLevel(int blockLevel) +{ + Debug.Log(blockLevel); +} +``` + +### `GetAccountCounter()` + +```csharp +IEnumerator GetAccountCounter( + Action callback, + string address); +``` + +Returns the counter for implicit accounts, which is a unique number that you can use to ensure that transactions are not duplicated. + +Example: + +```csharp +public void RunGetAccountCounter() +{ + var routine = TezosManager.Instance.Tezos.API.GetAccountCounter( + callback: HandleGetAccountCounter, + address: myAddress + ); + StartCoroutine(routine); +} + +private void HandleGetAccountCounter(int counter) +{ + Debug.Log(counter); +} +``` + +### `GetOriginatedContractsForOwner()` + +```csharp +IEnumerator GetOriginatedContractsForOwner( + Action> callback, + string creator, + string codeHash, + long maxItems, + OriginatedContractsForOwnerOrder orderBy); +``` + +Gets the contracts that the specified account deployed (originated). +Optionally, you can pass the hash of a contract to return only contracts that match that hash. +For example, the hash of the contract in the [`TokenContract`](./TokenContract) object, which is in the `Resources/Contracts/FA2TokenContractCodeHash.txt` file, is `199145999`. + +Example: + +```csharp +public void RunGetOriginatedContractsForOwner() +{ + var routine = TezosManager.Instance.Tezos.API.GetOriginatedContractsForOwner( + callback: HandleGetOriginatedContractsForOwner, + creator: myAddress, + codeHash: "", + maxItems: 10, + orderBy: new OriginatedContractsForOwnerOrder.ByLastActivityTimeAsc(0) + + ); + StartCoroutine(routine); +} + +private void HandleGetOriginatedContractsForOwner(IEnumerable contractList) +{ + List contracts = new List(contractList); + foreach (var contract in contracts) + { + Debug.Log(contract.Address); + } +} +``` diff --git a/docs/reference/unity/DAppMetadata.md b/docs/reference/unity/DAppMetadata.md new file mode 100644 index 000000000..2e9a3dc4f --- /dev/null +++ b/docs/reference/unity/DAppMetadata.md @@ -0,0 +1,22 @@ +--- +title: Unity SDK DAppMetadata object +sidebar_label: DAppMetadata object +authors: Tim McMackin +last_update: + date: 6 December 2023 +--- + +The Unity SDK class `TezosSDK.Tezos.DAppMetadata`, which is available at runtime as the `TezosManager.Instance.Tezos.DAppMetadata` object, provides read-only properties that provide access to the values that you set on the `TezosManager` prefab in the Unity Editor. + +## Properties + +These properties are read-only: + +- `Name`: The name of the project, which is shown in wallet applications when users connect to the project +- `Url`: The home page of the project +- `Icon`: The URL to a favicon for the project +- `Description`: A description of hte project + +## Methods + +None. diff --git a/docs/reference/unity/MessageReceiver.md b/docs/reference/unity/MessageReceiver.md new file mode 100644 index 000000000..be9d01cc8 --- /dev/null +++ b/docs/reference/unity/MessageReceiver.md @@ -0,0 +1,82 @@ +--- +title: Unity SDK MessageReceiver object +sidebar_label: MessageReceiver object +authors: Tim McMackin +last_update: + date: 6 December 2023 +--- + +The Unity SDK class `TezosSDK.Beacon.WalletMessageReceiver`, which is available at runtime as the `TezosManager.Instance.MessageReceiver` object, provides events that you can add listeners to. + +These events are asynchronous. +For example, if your project makes multiple calls to smart contracts, the `ContractCallCompleted` event runs multiple times, not necessarily in the order that you called the contracts. + +## Example + +This code adds a listener for the `AccountConnected` and `AccountDisconnected` events: + +```csharp +private void Start() +{ + TezosManager.Instance.MessageReceiver.AccountConnected += OnAccountConnected; + TezosManager.Instance.MessageReceiver.AccountDisconnected += OnAccountDisconnected; +} + +private void OnAccountConnected(AccountInfo accountInfo) +{ + Debug.Log(accountInfo.Address); +} + +private void OnAccountDisconnected(AccountInfo accountInfo) +{ + Debug.Log(accountInfo.Address); + Debug.Log("Account disconnected."); +} +``` + +## Events + +### `public event Action AccountConnected` + +Runs when an account connects successfully. +Returns a `TezosSDK.Beacon.AccountInfo` object with information that includes the address of the connected account. + +### `public event Action AccountConnectionFailed` + +Runs when a connection to an account fails. +Returns a `TezosSDK.Beacon.ErrorInfo` object with an error message. + +### `public event Action AccountDisconnected` + +Runs when an account disconnects successfully. +Returns a `TezosSDK.Beacon.AccountInfo` object with information that includes the address of the connected account. + +### `public event Action ContractCallCompleted` + +Runs when a call to a smart contract is confirmed on the blockchain. +Returns a `TezosSDK.Beacon.OperationResult` object with the hash of the transaction. + +### `public event Action ContractCallFailed` + +Runs when a call to a smart contract fails. +Returns a `TezosSDK.Beacon.ErrorInfo` object with an error message. + +### `public event Action ContractCallInjected` + +Runs when a call to a smart contract is sent to Tezos but before it has been included in a block and confirmed. +Returns a `TezosSDK.Beacon.OperationResult` object with the hash of the transaction. + +### `public event Action HandshakeReceived` + +Runs when a handshake with a user's wallet application is received. +Returns a `TezosSDK.Beacon.HandshakeData` object with the data that applications need to connect to the wallet. + +### `public event Action PairingCompleted` + +Runs when the user's wallet is connected to the project but before the user has approved the connection in the wallet app. +Returns a `TezosSDK.Beacon.PairingDoneData` object with details about the pairing, such as the dApp's public key and the timestamp of pairing completion. + +### `public event Action PayloadSigned` + +Runs when the user signs a payload. +Returns a `TezosSDK.Beacon.PairingDoneData` object with the signed payload. diff --git a/docs/reference/unity/TokenContract.md b/docs/reference/unity/TokenContract.md new file mode 100644 index 000000000..090b38c0e --- /dev/null +++ b/docs/reference/unity/TokenContract.md @@ -0,0 +1,149 @@ +--- +title: Unity SDK TokenContract object +sidebar_label: TokenContract object +authors: Tim McMackin +last_update: + date: 6 December 2023 +--- + +The Unity SDK class `TezosSDK.Tezos.API.Models.TokenContract`, which is available at runtime as the `TezosManager.Instance.Tezos.TokenContract` object, provides a built-in FA2-compatible smart contract and convenience methods to work with it. + +For information about FA2 contracts and tokens, see [FA2 tokens](../../architecture/tokens/FA2). + +## Properties + +These properties are populated after you deploy the contract with the `Deploy()` method: + +- `Address`: The address of the deployed contract +- `TokensCount`: The total number of token types in the contract +- `LastActivityTime`: The timestamp of the last time tokens were minted or transferred + +## Methods + +### Constructors + +The `TokenContract` class has constructors, but they are for internal use. +Use the `Deploy()` method instead. + +### `Deploy()` + +```csharp +void Deploy(Action completedCallback) +``` + +Deploys (originates) a contract based on the built-in contract, including prompting the connected wallet to pay the origination fees. + +Parameters: + +- `completedCallback`: A callback method to run when the contract is deployed, which receives the address of the new contract + +Example: + +```csharp +public void HandleDeploy() +{ + TezosManager.Instance.Tezos.TokenContract.Deploy(OnContractDeployed); +} + +private void OnContractDeployed(string contractAddress) +{ + Debug.Log(contractAddress); +} +``` + +### `Mint()` + +```csharp +void Mint( + Action completedCallback, + TokenMetadata tokenMetadata, + string destination, + int amount) +``` + +Calls the `Mint` entrypoint of the contract to create a token type and mint tokens. + +Parameters: + +- `completedCallback`: A callback method to run when the token is minted, which receives a `TokenBalance` object with information about the new token +- `tokenMetadata`: A `TokenMetadata` object with information about the new token +- `destination`: The account that owns the new token, which can be a user account or a smart contract account +- `amount`: The number of tokens of the new type to create + +Example: + +```csharp +var initialOwner = TezosManager + .Instance + .Wallet + .GetActiveAddress(); + +const string imageAddress = "ipfs://QmX4t8ikQgjvLdqTtL51v6iVun9tNE7y7Txiw4piGQVNgK"; + +var tokenMetadata = new TokenMetadata +{ + Name = "My token", + Description = "Description for my token", + Symbol = "MYTOKEN", + Decimals = "0", + DisplayUri = imageAddress, + ArtifactUri = imageAddress, + ThumbnailUri = imageAddress +}; + +TezosManager + .Instance + .Tezos + .TokenContract + .Mint( + completedCallback: OnTokenMinted, + tokenMetadata: tokenMetadata, + destination: initialOwner, + amount: 100); + +private void OnTokenMinted(TokenBalance tokenBalance) +{ + Debug.Log($"Successfully minted token with Token ID {tokenBalance.TokenId}"); +} +``` + +### `Transfer()` + +```csharp +void Transfer( + Action completedCallback, + string destination, + int tokenId, + int amount) +``` + +Transfers tokens from the currently connected account to the destination account. + +Parameters: + +- `completedCallback`: A callback method to run when the token is minted, which receives the hash of the transfer transaction +- `destination`: The account to send the token to, which can be a user account or a smart contract account +- `tokenId`: The ID of the token to transfer +- `amount`: The number of tokens to transfer + +Example: + +```csharp +public void HandleTransfer() +{ + TezosManager + .Instance + .Tezos + .TokenContract + .Transfer( + completedCallback: TransferCompleted, + destination: address.text, + tokenId: int.Parse(id.text), + amount: int.Parse(amount.text)); +} + +private void TransferCompleted(string txHash) +{ + Logger.LogDebug($"Transfer complete with transaction hash {txHash}"); +} +``` diff --git a/docs/reference/unity/Wallet.md b/docs/reference/unity/Wallet.md new file mode 100644 index 000000000..4ef5d7f89 --- /dev/null +++ b/docs/reference/unity/Wallet.md @@ -0,0 +1,95 @@ +--- +title: Unity SDK Wallet object +sidebar_label: Wallet object +authors: Tim McMackin +last_update: + date: 6 December 2023 +--- + +The Unity SDK class `TezosSDK.Tezos.Wallet.WalletProvider`, which is available at runtime as `TezosManager.Instance.Wallet`, provides methods to connect to wallets and send transactions from the connected account. + +## `Connect()` + +```csharp +void Connect(WalletProviderType walletProvider, bool withRedirectToWallet) +``` + +Sends a request to a user's wallet to connect to the application. + +Parameters: + + - `walletProvider`: The type of wallet to connect to, including `WalletProviderType.beacon` for TZIP-7 wallets (most Tezos wallets) and `WalletProviderType.kukai` for Kukai wallets. + - `withRedirectToWallet`: Whether to open the connected mobile app after connecting to a wallet via another source, such as a desktop app. + +This method triggers the `AccountConnected` or `AccountConnectionFailed` events, depending on whether the connection was successful or not. + + + +## `Disconnect()` + +```csharp +void Disconnect() +``` + +Disconnects from the currently connected wallet. + +This method triggers the `AccountDisconnected` event. + +## `GetActiveAddress()` + +```csharp +void GetActiveAddress() +``` + +Returns the address (public key hash) of the currently connected account, or NULL if no wallet is connected. + +## `RequestSignPayload()` + +```csharp +public void Connect(WalletProviderType walletProvider, bool withRedirectToWallet) +``` + +Sends a request to the connected wallet to sign a payload string. +Signing a message proves that it came from a specific user's wallet because the wallet encrypts the message with the user's account's key. +You can prompt users to sign messages for several reasons, including: + +For example, this code prompts the user to sign the message "This message came from my account." + +```csharp +using Beacon.Sdk.Beacon.Sign; + +string payload = "This message came from my account."; + +TezosManager.Instance.MessageReceiver.PayloadSigned += OnPayloadSigned; +TezosManager.Instance.Wallet.RequestSignPayload(SignPayloadType.micheline, payload); +``` + +This method triggers the `PayloadSigned` event when the user signs the payload in their wallet app. + +## `VerifySignedPayload()` + +```csharp +bool VerifySignedPayload(SignPayloadType signingType, string payload) +``` + +Returns true if most recent response to `RequestSignPayload` matches the specified payload and is properly signed. + +## `CallContract()` + +```csharp +void CallContract( + string contractAddress, + string entryPoint, + string input, + ulong amount = 0); +``` + +Calls the specified entrypoint of the built-in FA2 contract. + +You can use this method as an alternative to calling convenience methods such as `TezosManager.Instance.Tezos.TokenContract.Mint()` directly or as a way to call the contract methods that do not have convenience methods in the `TokenContract` object. + +This method triggers the `ContractCallInjected` event if the call is successfully sent to Tezos. +Then it triggers `ContractCallCompleted` or `ContractCallFailed` events, depending on whether the call succeeded or failed. diff --git a/docs/reference/unity/prefabs.md b/docs/reference/unity/prefabs.md new file mode 100644 index 000000000..2f1d3b578 --- /dev/null +++ b/docs/reference/unity/prefabs.md @@ -0,0 +1,24 @@ +--- +title: Unity SDK prefabs +sidebar_label: Prefabs +authors: Tim McMackin +last_update: + date: 1 December 2023 +--- + +The Tezos SDK for Unity provides these prefabs: + +## MainThreadExecutor + +This prefab provides prerequisites for using the SDK in a scene. + +## TezosAuthenticator + +This prefab provides code to connect to different kinds of Tezos wallets. + + + +## TezosManager + +This prefab sets the metadata for the scene, such as the application name that users see in their wallet applications before connecting to the project. +It also creates an instance of the `TezosSDK.Tezos.Tezos` class, which provides access to the SDK objects such as the [Wallet](./Wallet) and [MessageReceiver](./MessageReceiver) objects. diff --git a/docusaurus.config.js b/docusaurus.config.js index d409fbe95..ad31bc939 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -84,6 +84,7 @@ const config = { }, prism: { theme: require('prism-react-renderer/themes/github'), + additionalLanguages: ['csharp'], }, // https://github.com/flexanalytics/plugin-image-zoom // Enable click to zoom in to large images diff --git a/sidebars.js b/sidebars.js index 5c7820330..5d2a23724 100644 --- a/sidebars.js +++ b/sidebars.js @@ -207,6 +207,28 @@ const sidebars = { // 'reference/encoding', // TODO // 'reference/merkle-formats', // TODO // 'reference/ocaml-apis', // TODO + { + type: 'category', + label: 'Unity SDK reference', + link: { + id: 'reference/unity', + type: 'doc', + }, + items: [ + 'reference/unity/prefabs', + { + type: "category", + label: "Objects", + items: [ + 'reference/unity/API', + 'reference/unity/DAppMetadata', + 'reference/unity/MessageReceiver', + 'reference/unity/TokenContract', + 'reference/unity/Wallet', + ], + }, + ], + }, { type: 'link', label: 'Whitepaper',