diff --git a/Runtime/Scripts/API/TezosAPI.cs b/Runtime/Scripts/API/TezosAPI.cs
index 269c6157..e6745ac1 100644
--- a/Runtime/Scripts/API/TezosAPI.cs
+++ b/Runtime/Scripts/API/TezosAPI.cs
@@ -161,8 +161,6 @@ await UnityMainThreadDispatcher.Instance().EnqueueAsync(
return result;
}
- public static UniTask DeployContract(DeployContractRequest deployContractRequest) => ProviderFactory.GetConnectedProviderController().DeployContract(deployContractRequest);
-
///
/// Fetches the XTZ balance of a given wallet address asynchronously.
///
@@ -173,155 +171,11 @@ public static UniTask GetBalance()
return ProviderFactory.GetConnectedProviderController().GetBalance();
}
- public static UniTask ReadView(string contractAddress, string view, string input) => _rpc.PostRequest(EndPoints.GetRunViewEndPoint(contractAddress, view), input);
-
- public static UniTask> GetTokensForOwner(
- string owner,
- bool withMetadata,
- long maxItems,
- TokensForOwnerOrder orderBy
- )
- {
- var sort = orderBy switch
- {
- TokensForOwnerOrder.Default byDefault => $"sort.asc=id&offset.cr={byDefault.lastId}",
- TokensForOwnerOrder.ByLastTimeAsc byLastTimeAsc =>
- $"sort.asc=lastLevel&offset.pg={byLastTimeAsc.page}",
- TokensForOwnerOrder.ByLastTimeDesc byLastTimeDesc =>
- $"sort.desc=lastLevel&offset.pg={byLastTimeDesc.page}",
- _ => string.Empty
- };
- return _rpc.GetRequest>(
- EndPoints.GetTokensForOwnerEndPoint(
- owner, withMetadata,
- maxItems, sort
- )
- );
- }
-
- public static UniTask> GetOwnersForToken(
- string contractAddress,
- uint tokenId,
- long maxItems,
- OwnersForTokenOrder orderBy
- )
- {
- var sort = orderBy switch
- {
- OwnersForTokenOrder.Default byDefault => $"sort.asc=id&offset.cr={byDefault.lastId}",
- OwnersForTokenOrder.ByBalanceAsc byBalanceAsc =>
- $"sort.asc=balance&offset.pg={byBalanceAsc.page}",
- OwnersForTokenOrder.ByBalanceDesc byBalanceDesc =>
- $"sort.desc=balance&offset.pg={byBalanceDesc.page}",
- OwnersForTokenOrder.ByLastTimeAsc byLastTimeAsc =>
- $"sort.asc=lastLevel&offset.pg={byLastTimeAsc.page}",
- OwnersForTokenOrder.ByLastTimeDesc byLastTimeDesc =>
- $"sort.desc=lastLevel&offset.pg={byLastTimeDesc.page}",
- _ => string.Empty
- };
- return _rpc.GetRequest>(
- EndPoints.GetOwnersForTokenEndPoint(
- contractAddress,
- tokenId, maxItems,
- sort
- )
- );
- }
-
- public static UniTask> GetOwnersForContract(
- string contractAddress,
- long maxItems,
- OwnersForContractOrder orderBy
- )
- {
- var sort = orderBy switch
- {
- OwnersForContractOrder.Default byDefault => $"sort.asc=id&offset.cr={byDefault.lastId}",
- OwnersForContractOrder.ByLastTimeAsc byLastTimeAsc =>
- $"sort.asc=lastLevel&offset.pg={byLastTimeAsc.page}",
- OwnersForContractOrder.ByLastTimeDesc byLastTimeDesc =>
- $"sort.desc=lastLevel&offset.pg={byLastTimeDesc.page}",
- _ => string.Empty
- };
- return _rpc.GetRequest>(
- EndPoints.GetOwnersForContractEndPoint(
- contractAddress,
- maxItems, sort
- )
- );
- }
-
- public static UniTask IsHolderOfContract(string wallet, string contractAddress) => _rpc.GetRequest(EndPoints.GetIsHolderOfContractEndPoint(wallet, contractAddress));
-
- public static UniTask IsHolderOfToken(string wallet, string contractAddress, uint tokenId) => _rpc.GetRequest(EndPoints.GetIsHolderOfTokenEndPoint(wallet, contractAddress, tokenId));
-
- public static UniTask GetTokenMetadata(
- string contractAddress,
- uint tokenId
- ) => _rpc.GetRequest(EndPoints.GetTokenMetadataEndPoint(contractAddress, tokenId));
-
- public static UniTask GetContractMetadata(
- string contractAddress
- ) => _rpc.GetRequest(EndPoints.GetContractMetadataEndPoint(contractAddress));
-
- public static UniTask> GetTokensForContract(
- string contractAddress,
- bool withMetadata,
- long maxItems,
- TokensForContractOrder orderBy
- )
- {
- TezosLogger.LogDebug($"Getting tokens for contract: {contractAddress}");
- var sort = orderBy switch
- {
- TokensForContractOrder.Default byDefault => $"sort.asc=id&offset.cr={byDefault.lastId}",
- TokensForContractOrder.ByLastTimeAsc byLastTimeAsc =>
- $"sort.asc=lastLevel&offset.pg={byLastTimeAsc.page}",
- TokensForContractOrder.ByLastTimeDesc byLastTimeDesc =>
- $"sort.desc=lastLevel&offset.pg={byLastTimeDesc.page}",
- TokensForContractOrder.ByHoldersCountAsc byHoldersCountAsc =>
- $"sort.asc=holdersCount&offset.pg={byHoldersCountAsc.page}",
- TokensForContractOrder.ByHoldersCountDesc byHoldersCountDesc =>
- $"sort.desc=holdersCount&offset.pg={byHoldersCountDesc.page}",
- _ => string.Empty
- };
- return _rpc.GetRequest>(
- EndPoints.GetTokensForContractEndPoint(
- contractAddress,
- withMetadata,
- maxItems, sort
- )
- );
- }
-
- public static UniTask GetOperationStatus(string operationHash) => _rpc.GetRequest(EndPoints.GetOperationStatusEndPoint(operationHash));
-
- public static UniTask GetLatestBlockLevel() => _rpc.GetRequest(EndPoints.GetLatestBlockLevelEndPoint());
-
- public static UniTask GetAccountCounter(string address) => _rpc.GetRequest(EndPoints.GetAccountCounterEndPoint(address));
-
- public static UniTask> GetOriginatedContractsForOwner(
- string creator,
- string codeHash,
- long maxItems,
- OriginatedContractsForOwnerOrder orderBy
- )
- {
- TezosLogger.LogDebug($"API.GetOriginatedContractsForOwner: creator={creator}, codeHash={codeHash}");
-
- var sort = orderBy switch
- {
- OriginatedContractsForOwnerOrder.Default byDefault => $"sort.asc=id&offset.cr={byDefault.lastId}",
- OriginatedContractsForOwnerOrder.ByLastActivityTimeAsc byLastTimeAsc => $"sort.asc=lastActivity&offset.pg={byLastTimeAsc.page}",
- OriginatedContractsForOwnerOrder.ByLastActivityTimeDesc byLastTimeDesc => $"sort.desc=lastActivity&offset.pg={byLastTimeDesc.page}",
- _ => string.Empty
- };
-
- var url = $"contracts?creator={creator}&tzips.any=fa2&codeHash={codeHash}&" +
- $"select=address,tokensCount as tokens_count,lastActivity,lastActivityTime as last_activity_time,id&{sort}&limit={maxItems}";
-
- return _rpc.GetRequest>(url);
- }
+ public static UniTask DeployContract(DeployContractRequest deployContractRequest) => ProviderFactory.GetConnectedProviderController().DeployContract(deployContractRequest);
+ public static UniTask ReadView(string contractAddress, string view, string input) => _rpc.PostRequest(EndPoints.GetRunViewEndPoint(contractAddress, view), input);
+ public static UniTask GetTokens(string address, int limit = 100) => _rpc.GetRequest(EndPoints.GetTokensEndPoint(address, limit));
+ public static UniTask GetTokenMetadata(string tokenId) => _rpc.GetRequest(EndPoints.GetTokenMetadataEndPoint(tokenId));
+ public static UniTask GetOperationStatus(string operationHash) => _rpc.GetRequest(EndPoints.GetOperationStatusEndPoint(operationHash));
#endregion
}
diff --git a/Runtime/Scripts/API/TokenAPI.cs b/Runtime/Scripts/API/TokenAPI.cs
deleted file mode 100644
index f45bde31..00000000
--- a/Runtime/Scripts/API/TokenAPI.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Netezos.Contracts;
-using Netezos.Encoding;
-using Newtonsoft.Json.Linq;
-using Tezos.Cysharp.Threading.Tasks;
-using Tezos.Logger;
-using Tezos.Operation;
-using Tezos.Token;
-using UnityEngine;
-using OperationRequest = Tezos.Operation.OperationRequest;
-using OperationResponse = Tezos.Operation.OperationResponse;
-
-namespace Tezos.API
-{
- public static partial class TezosAPI
- {
- public static async UniTask Mint(TokenMetadata tokenMetadata, string destination, int amount, string address)
- {
- TezosLogger.LogDebug($"Minting {amount} tokens to {destination} with metadata {tokenMetadata}");
-
- var tokens = (await GetTokensForContract(address, false, 10_000, new TokensForContractOrder.Default(0))).ToList();
-
- TezosLogger.LogDebug("Got tokens for contract");
- var tokenId = tokens.Count;
- const string entrypoint = "mint";
-
- var mintParameters = GetContractScript().BuildParameter(entrypoint, new { address = destination, amount = amount.ToString(), metadata = tokenMetadata.GetMetadataDict(), token_id = tokenId.ToString() }).ToJson();
-
- var walletOperationRequest = new OperationRequest { Destination = address, EntryPoint = entrypoint, Arg = mintParameters };
- var result = await RequestOperation(walletOperationRequest);
-
- TezosLogger.LogDebug($"Mint completed with operation ID: {result.Id}");
-
- var owner = GetWalletConnectionData().WalletAddress;
-
- var getOwnerTokensCoroutine = await GetTokensForOwner(owner, true, 10_000, new TokensForOwnerOrder.Default(0));
-
- return getOwnerTokensCoroutine.Last();
- }
-
- public static async UniTask Transfer(string destination, int tokenId, int amount)
- {
- var activeAddress = GetWalletConnectionData().WalletAddress;
- const string entryPoint = "transfer";
-
- var param = GetContractScript().BuildParameter(entryPoint, new List