From b5e6f491b651e4ac5ebe6df20238ade7dab10f3d Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Sat, 16 Aug 2025 04:25:16 +0700 Subject: [PATCH 1/9] Add ThirdwebContract.Deploy via new Thirdweb.Api Adds the auto-generated Thirdweb.Api/GeneratedClient.cs (https://api.thirdweb.com/reference integration) and supporting nswag.json. Updates .editorconfig to exclude generated API files from linting. Removes Directory.Build.props, Directory.Packages.props, and Makefile. Updates project files to specify explicit package versions and build settings. Refactors and cleans up test and console code for consistency and style. --- .csharpierrc | 10 - .editorconfig | 42 +- Directory.Build.props | 17 - Directory.Packages.props | 26 - Makefile | 4 - Thirdweb.Console/Program.cs | 49 +- Thirdweb.Console/Thirdweb.Console.csproj | 12 +- .../Thirdweb.Contracts.Tests.cs | 8 +- .../Thirdweb.Extensions.Tests.cs | 56 +- .../Thirdweb.MarketplaceExtensions.Tests.cs | 8 +- .../Thirdweb.Http/Thirdweb.Http.Tests.cs | 6 +- Thirdweb.Tests/Thirdweb.Tests.csproj | 25 +- .../Thirdweb.Transactions.Tests.cs | 8 +- .../Thirdweb.ZkSmartWallet.Tests.cs | 25 +- .../Thirdweb.Utils/Thirdweb.Utils.Tests.cs | 18 +- .../Thirdweb.PrivateKeyWallet.Tests.cs | 4 +- .../Thirdweb.SmartWallet.Tests.cs | 14 +- .../Thirdweb.Wallets.Tests.cs | 10 +- Thirdweb/Thirdweb.AI/ThirdwebNebula.cs | 6 +- Thirdweb/Thirdweb.Api/GeneratedClient.cs | 9351 +++++++++++++++++ .../Thirdweb.Bridge/ThirdwebBridge.Types.cs | 8 +- Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs | 12 +- Thirdweb/Thirdweb.Client/ThirdwebClient.cs | 18 + .../Thirdweb.Contracts/ThirdwebContract.cs | 63 + .../ThirdwebApiExtensions.cs | 0 .../ThirdwebExtensions.Types.cs | 2 +- .../Thirdweb.Extensions/ThirdwebExtensions.cs | 24 +- .../ThirdwebMarketplaceExtensions.Types.cs | 4 +- .../ThirdwebInsight.Extensions.cs | 4 +- Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs | 4 +- .../Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs | 11 +- .../ThirdwebPay.GetBuyWithCryptoQuote.cs | 4 +- .../ThirdwebPay.GetBuyWithCryptoStatus.cs | 8 +- .../ThirdwebPay.GetBuyWithFiatCurrencies.cs | 8 +- .../ThirdwebPay.GetBuyWithFiatQuote.cs | 4 +- .../ThirdwebPay.GetBuyWithFiatStatus.cs | 8 +- .../Types.GetBuyWithCryptoQuote.cs | 2 +- .../Types.GetBuyWithCryptoStatus.cs | 4 +- .../Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs | 2 +- Thirdweb/Thirdweb.Pay/Types.Shared.cs | 2 +- Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs | 2 +- .../ThirdwebTransaction.cs | 50 +- Thirdweb/Thirdweb.Utils/Constants.cs | 6 - Thirdweb/Thirdweb.Utils/Utils.Types.cs | 4 +- Thirdweb/Thirdweb.Utils/Utils.cs | 8 +- Thirdweb/Thirdweb.Wallets/EIP712.cs | 2 +- Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs | 12 +- Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs | 2 +- .../EcosystemWallet/EcosystemWallet.cs | 67 +- .../EmbeddedWallet.Authentication/AWS.cs | 2 +- .../EmbeddedWallet.Authentication/Server.cs | 19 +- .../EmbeddedWallet.Cryptography.cs | 18 +- .../EmbeddedWallet.Encryption/Secrets.cs | 12 +- .../VerificationException.cs | 3 +- .../EmbeddedWallet.AccountLinking.cs | 4 +- .../PrivateKeyWallet/PrivateKeyWallet.cs | 4 +- .../SmartWallet/SmartWallet.cs | 109 +- .../Thirdweb.AccountAbstraction/AATypes.cs | 2 +- .../BundlerClient.cs | 2 +- Thirdweb/Thirdweb.csproj | 35 +- nswag.json | 70 + thirdweb.sln | 2 - tw.bat | 146 + 63 files changed, 10054 insertions(+), 418 deletions(-) delete mode 100644 .csharpierrc delete mode 100644 Directory.Build.props delete mode 100644 Directory.Packages.props delete mode 100644 Makefile create mode 100644 Thirdweb/Thirdweb.Api/GeneratedClient.cs create mode 100644 Thirdweb/Thirdweb.Extensions/ThirdwebApiExtensions.cs create mode 100644 nswag.json create mode 100644 tw.bat diff --git a/.csharpierrc b/.csharpierrc deleted file mode 100644 index 74f82b53..00000000 --- a/.csharpierrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "printWidth": 200, - "useTabs": false, - "tabWidth": 4, - "preprocessorSymbolSets": [ - "", - "DEBUG", - "RELEASE" - ] -} diff --git a/.editorconfig b/.editorconfig index 06d538c5..491fbbf1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,46 @@ ############################### -# Core EditorConfig Options # +# Core EditorConfig Options # ############################### root = true ############################### -# .NET Coding Conventions # +# Generated Code Exclusions # +############################### + +# Exclude Thirdweb.Api generated files from all linting and formatting rules +[Thirdweb.Api/**/*.cs] +generated_code = true +dotnet_analyzer_diagnostic.severity = none +dotnet_style_qualification_for_field = false +dotnet_style_qualification_for_property = false +dotnet_style_qualification_for_method = false +dotnet_style_qualification_for_event = false +csharp_style_namespace_declarations = block_scoped +dotnet_diagnostic.IDE0130.severity = none +dotnet_diagnostic.IDE0046.severity = none +dotnet_diagnostic.IDE0045.severity = none +dotnet_diagnostic.IDE0066.severity = none +dotnet_diagnostic.IDE0028.severity = none +dotnet_diagnostic.CA1822.severity = none +dotnet_diagnostic.IDE0290.severity = none +# Disable all naming convention rules for generated code +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = none +dotnet_naming_rule.public_members_should_be_pascal_case.severity = none +dotnet_naming_rule.private_fields_should_have_underscore_prefix.severity = none + +############################### +# Configurable behaviors # +############################### + +[*.{cs,csx}] +end_of_line = crlf +indent_style = space +indent_size = 4 +max_line_length = 200 + +############################### +# .NET Coding Conventions # ############################### [*.{cs,vb}] @@ -148,3 +183,6 @@ dotnet_diagnostic.CA1822.severity = suggestion # IDE0290: Use primary constructor dotnet_diagnostic.IDE0290.severity = silent + +# JSON002: Probable JSON string detected +dotnet_diagnostic.JSON002.severity = silent diff --git a/Directory.Build.props b/Directory.Build.props deleted file mode 100644 index 3bce433b..00000000 --- a/Directory.Build.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - 2.24.1 - netstandard2.1;net6.0;net7.0;net8.0 - - - latest - true - enable - - - $(DefaultVersion) - $(DefaultVersion) - $(DefaultVersion) - - diff --git a/Directory.Packages.props b/Directory.Packages.props deleted file mode 100644 index c1be8cd6..00000000 --- a/Directory.Packages.props +++ /dev/null @@ -1,26 +0,0 @@ - - - true - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 7c185962..00000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -.PHONY: run - -run: - dotnet run --project Thirdweb.Console diff --git a/Thirdweb.Console/Program.cs b/Thirdweb.Console/Program.cs index a796ffc4..58384ba3 100644 --- a/Thirdweb.Console/Program.cs +++ b/Thirdweb.Console/Program.cs @@ -1,41 +1,50 @@ #pragma warning disable IDE0005 #pragma warning disable IDE0059 -using System.Diagnostics; -using System.Numerics; -using System.Text; using dotenv.net; -using Nethereum.ABI; -using Nethereum.Hex.HexConvertors.Extensions; -using Nethereum.Hex.HexTypes; -using Nethereum.Util; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Thirdweb; -using Thirdweb.AccountAbstraction; -using Thirdweb.AI; -using Thirdweb.Bridge; -using Thirdweb.Indexer; -using Thirdweb.Pay; DotEnv.Load(); // Do not use secret keys client side, use client id/bundle id instead var secretKey = Environment.GetEnvironmentVariable("THIRDWEB_SECRET_KEY"); -// Do not use private keys client side, use InAppWallet/SmartWallet instead -var privateKey = Environment.GetEnvironmentVariable("PRIVATE_KEY"); - // Fetch timeout options are optional, default is 120000ms var client = ThirdwebClient.Create(secretKey: secretKey); -// Create a private key wallet -var privateKeyWallet = await PrivateKeyWallet.Generate(client); +#region Deploy Contract + +// var serverWallet = await ServerWallet.Create(client: client, label: "TestFromDotnet"); + +// var abi = +// "[ { \"inputs\": [], \"name\": \"welcome\", \"outputs\": [ { \"internalType\": \"string\", \"name\": \"\", \"type\": \"string\" } ], \"stateMutability\": \"pure\", \"type\": \"function\" } ]"; + +// var contractAddress = await ThirdwebContract.Deploy( +// client: client, +// chainId: 421614, +// serverWalletAddress: await serverWallet.GetAddress(), +// bytecode: "6080604052348015600e575f5ffd5b5061014e8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063b627cf3b1461002d575b5f5ffd5b61003561004b565b60405161004291906100f8565b60405180910390f35b60606040518060400160405280601481526020017f57656c636f6d6520746f20746869726477656221000000000000000000000000815250905090565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6100ca82610088565b6100d48185610092565b93506100e48185602086016100a2565b6100ed816100b0565b840191505092915050565b5f6020820190508181035f83015261011081846100c0565b90509291505056fea264697066735822122001498e9d7d6125ce22613ef32fdb7e8e03bf11ad361d7b00e210b82d7b7e0d4464736f6c634300081e0033", +// abi: abi +// ); +// Console.WriteLine($"Contract deployed at: {contractAddress}"); + +// var contract = await ThirdwebContract.Create(client: client, address: contractAddress, chain: 421614, abi: abi); +// var welcomeMessage = await contract.Read("welcome"); +// Console.WriteLine($"Welcome message from deployed contract: {welcomeMessage}"); + +#endregion + +#region Basic Wallet Interaction + +// // Create a private key wallet +// var privateKeyWallet = await PrivateKeyWallet.Generate(client); // var walletAddress = await privateKeyWallet.GetAddress(); // Console.WriteLine($"PK Wallet address: {walletAddress}"); -#region Contract Interaction +#endregion + +#region Basic Contract Interaction // var contract = await ThirdwebContract.Create(client: client, address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", chain: 1); // var nfts = await contract.ERC721_GetAllNFTs(); diff --git a/Thirdweb.Console/Thirdweb.Console.csproj b/Thirdweb.Console/Thirdweb.Console.csproj index 2acaa4b5..899409eb 100644 --- a/Thirdweb.Console/Thirdweb.Console.csproj +++ b/Thirdweb.Console/Thirdweb.Console.csproj @@ -1,26 +1,22 @@ - - Exe net8.0 + latest + true enable enable false - - - + - PreserveNewest - - \ No newline at end of file + diff --git a/Thirdweb.Tests/Thirdweb.Contracts/Thirdweb.Contracts.Tests.cs b/Thirdweb.Tests/Thirdweb.Contracts/Thirdweb.Contracts.Tests.cs index e8a8314d..844a4b77 100644 --- a/Thirdweb.Tests/Thirdweb.Contracts/Thirdweb.Contracts.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Contracts/Thirdweb.Contracts.Tests.cs @@ -228,7 +228,7 @@ public async Task SignatureMint_Generate() Value = BigInteger.Zero, Gas = BigInteger.Zero, Nonce = BigInteger.Zero, - Data = "0x" + Data = "0x", }; var signature = await EIP712.GenerateSignature_MinimalForwarder(randomDomain, randomVersion, randomChainId, randomContractAddress, forwardRequest, signer); Assert.NotNull(signature); @@ -243,7 +243,7 @@ public async Task SignatureMint_Generate() Currency = Constants.ADDRESS_ZERO, ValidityEndTimestamp = 0, ValidityStartTimestamp = Utils.GetUnixTimeStampIn10Years(), - Uid = new byte[] { 0x01 } + Uid = new byte[] { 0x01 }, }; var signature20 = await EIP712.GenerateSignature_TokenERC20(randomDomain, randomVersion, randomChainId, randomContractAddress, mintRequest20, signer); Assert.NotNull(signature20); @@ -261,7 +261,7 @@ public async Task SignatureMint_Generate() Currency = Constants.ADDRESS_ZERO, ValidityEndTimestamp = 0, ValidityStartTimestamp = Utils.GetUnixTimeStampIn10Years(), - Uid = new byte[] { 0x01 } + Uid = new byte[] { 0x01 }, }; var signature721 = await EIP712.GenerateSignature_TokenERC721(randomDomain, randomVersion, randomChainId, randomContractAddress, mintRequest721, signer); Assert.NotNull(signature721); @@ -281,7 +281,7 @@ public async Task SignatureMint_Generate() Currency = Constants.ADDRESS_ZERO, ValidityEndTimestamp = 0, ValidityStartTimestamp = Utils.GetUnixTimeStampIn10Years(), - Uid = new byte[] { 0x01 } + Uid = new byte[] { 0x01 }, }; var signature1155 = await EIP712.GenerateSignature_TokenERC1155(randomDomain, randomVersion, randomChainId, randomContractAddress, mintRequest1155, signer); Assert.NotNull(signature1155); diff --git a/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs b/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs index a5c7d8e9..43447cc4 100644 --- a/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs @@ -716,26 +716,26 @@ public async Task ERC1155_NullChecks() _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_SafeTransferFrom(wallet, validAddress, validAddress, BigInteger.MinusOne, validAmount, validData)); // ERC1155_SafeBatchTransferFrom - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(null, null, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(null, null, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) ); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, null, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, null, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) ); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, string.Empty, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, string.Empty, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) ); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, null, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) ); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, string.Empty, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, string.Empty, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) ); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, null, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, null, new BigInteger[] { validAmount }, validData) ); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, new BigInteger[] { validTokenId }, null, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, new BigInteger[] { validTokenId }, null, validData) ); // ERC1155_URI @@ -749,8 +749,8 @@ public async Task ERC1155_NullChecks() _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_SetApprovalForAll(wallet, validAddress, false)); _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_SafeTransferFrom(wallet, validAddress, validAddress, validTokenId, validAmount, validData)); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) ); // Null contract checks @@ -761,8 +761,8 @@ public async Task ERC1155_NullChecks() _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_SetApprovalForAll(wallet, validAddress, false)); _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_IsApprovedForAll(validAddress, validAddress)); _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_SafeTransferFrom(wallet, validAddress, validAddress, validTokenId, validAmount, validData)); - _ = await Assert.ThrowsAsync( - async () => await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) + _ = await Assert.ThrowsAsync(async () => + await contract.ERC1155_SafeBatchTransferFrom(wallet, validAddress, validAddress, new BigInteger[] { validTokenId }, new BigInteger[] { validAmount }, validData) ); _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_URI(validTokenId)); _ = await Assert.ThrowsAsync(async () => await contract.ERC1155_TotalSupply(validTokenId)); @@ -1375,7 +1375,7 @@ public async Task TokenERC20_NullChecks() Currency = Constants.NATIVE_TOKEN_ADDRESS, ValidityStartTimestamp = 0, ValidityEndTimestamp = 0, - Uid = Guid.NewGuid().ToByteArray().PadTo32Bytes() + Uid = Guid.NewGuid().ToByteArray().PadTo32Bytes(), }; // TokenERC20_MintTo null checks @@ -1422,7 +1422,7 @@ public async Task TokenERC20_GenerateMintSignature_WithVerify() var contract = await this.GetTokenERC20Contract(); var fakeAuthorizedSigner = await PrivateKeyWallet.Generate(this.Client); var randomReceiver = await PrivateKeyWallet.Generate(this.Client); - var mintRequest = new TokenERC20_MintRequest { To = await randomReceiver.GetAddress(), Quantity = BigInteger.Parse("1.5".ToWei()), }; + var mintRequest = new TokenERC20_MintRequest { To = await randomReceiver.GetAddress(), Quantity = BigInteger.Parse("1.5".ToWei()) }; (var payload, var signature) = await contract.TokenERC20_GenerateMintSignature(fakeAuthorizedSigner, mintRequest); @@ -1477,7 +1477,7 @@ public async Task TokenERC721_NullChecks() Currency = Constants.NATIVE_TOKEN_ADDRESS, ValidityStartTimestamp = 0, ValidityEndTimestamp = 0, - Uid = Guid.NewGuid().ToByteArray().PadTo32Bytes() + Uid = Guid.NewGuid().ToByteArray().PadTo32Bytes(), }; // TokenERC721_MintTo (with URI) null checks @@ -1530,7 +1530,7 @@ public async Task TokenERC721_GenerateMintSignature_WithUri_WithVerify() var contract = await this.GetTokenERC721Contract(); var fakeAuthorizedSigner = await PrivateKeyWallet.Generate(this.Client); var randomReceiver = await PrivateKeyWallet.Generate(this.Client); - var mintRequest = new TokenERC721_MintRequest { To = await randomReceiver.GetAddress(), Uri = "", }; + var mintRequest = new TokenERC721_MintRequest { To = await randomReceiver.GetAddress(), Uri = "" }; (var payload, var signature) = await contract.TokenERC721_GenerateMintSignature(fakeAuthorizedSigner, mintRequest); @@ -1637,7 +1637,7 @@ public async Task TokenERC1155_NullChecks() Currency = Constants.NATIVE_TOKEN_ADDRESS, ValidityStartTimestamp = 0, ValidityEndTimestamp = 0, - Uid = Guid.NewGuid().ToByteArray().PadTo32Bytes() + Uid = Guid.NewGuid().ToByteArray().PadTo32Bytes(), }; // TokenERC1155_MintTo (with URI) null checks @@ -1654,11 +1654,11 @@ public async Task TokenERC1155_NullChecks() _ = await Assert.ThrowsAsync(async () => await ThirdwebExtensions.TokenERC1155_MintTo(contract, null, validAddress, validTokenId, validQuantity, new NFTMetadata())); _ = await Assert.ThrowsAsync(async () => await ThirdwebExtensions.TokenERC1155_MintTo(contract, wallet, null, validTokenId, validQuantity, new NFTMetadata())); _ = await Assert.ThrowsAsync(async () => await ThirdwebExtensions.TokenERC1155_MintTo(contract, wallet, string.Empty, validTokenId, validQuantity, new NFTMetadata())); - _ = await Assert.ThrowsAsync( - async () => await ThirdwebExtensions.TokenERC1155_MintTo(contract, wallet, validAddress, invalidTokenId, validQuantity, new NFTMetadata()) + _ = await Assert.ThrowsAsync(async () => + await ThirdwebExtensions.TokenERC1155_MintTo(contract, wallet, validAddress, invalidTokenId, validQuantity, new NFTMetadata()) ); - _ = await Assert.ThrowsAsync( - async () => await ThirdwebExtensions.TokenERC1155_MintTo(contract, wallet, validAddress, validTokenId, invalidQuantity, new NFTMetadata()) + _ = await Assert.ThrowsAsync(async () => + await ThirdwebExtensions.TokenERC1155_MintTo(contract, wallet, validAddress, validTokenId, invalidQuantity, new NFTMetadata()) ); // TokenERC1155_MintWithSignature null checks @@ -1698,7 +1698,7 @@ public async Task TokenERC1155_GenerateMintSignature_WithUri_WithVerify() var contract = await this.GetTokenERC1155Contract(); var fakeAuthorizedSigner = await PrivateKeyWallet.Generate(this.Client); var randomReceiver = await PrivateKeyWallet.Generate(this.Client); - var mintRequest = new TokenERC1155_MintRequest { To = await randomReceiver.GetAddress(), Uri = "", }; + var mintRequest = new TokenERC1155_MintRequest { To = await randomReceiver.GetAddress(), Uri = "" }; (var payload, var signature) = await contract.TokenERC1155_GenerateMintSignature(fakeAuthorizedSigner, mintRequest); diff --git a/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.MarketplaceExtensions.Tests.cs b/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.MarketplaceExtensions.Tests.cs index e30f63b5..c13f62ab 100644 --- a/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.MarketplaceExtensions.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.MarketplaceExtensions.Tests.cs @@ -49,7 +49,7 @@ public async Task Marketplace_DirectListings_CreateListing_Success() PricePerToken = 1, StartTimestamp = Utils.GetUnixTimeStampNow(), EndTimestamp = Utils.GetUnixTimeStampNow() + 3600, - Reserved = false + Reserved = false, }; var receipt = await contract.Marketplace_DirectListings_CreateListing(wallet, listingParams, true); @@ -92,7 +92,7 @@ public async Task Marketplace_DirectListings_UpdateListing_Success() PricePerToken = 1, StartTimestamp = Utils.GetUnixTimeStampNow() + 1800, EndTimestamp = Utils.GetUnixTimeStampNow() + 3600, - Reserved = false + Reserved = false, }; var receipt = await contract.Marketplace_DirectListings_CreateListing(wallet, originalListing, true); @@ -130,7 +130,7 @@ public async Task Marketplace_DirectListings_CancelListing_Success() PricePerToken = 1, StartTimestamp = Utils.GetUnixTimeStampNow() + 1800, EndTimestamp = Utils.GetUnixTimeStampNow() + 3600, - Reserved = false + Reserved = false, }; var receipt = await contract.Marketplace_DirectListings_CreateListing(wallet, originalListing, true); @@ -159,7 +159,7 @@ public async Task Marketplace_DirectListings_ApproveBuyerForListing() PricePerToken = 1, StartTimestamp = Utils.GetUnixTimeStampNow(), EndTimestamp = Utils.GetUnixTimeStampNow() + 3600, - Reserved = true + Reserved = true, }; var receipt = await contract.Marketplace_DirectListings_CreateListing(wallet, reservedListing, true); diff --git a/Thirdweb.Tests/Thirdweb.Http/Thirdweb.Http.Tests.cs b/Thirdweb.Tests/Thirdweb.Http/Thirdweb.Http.Tests.cs index 9f27e597..d0ed13d6 100644 --- a/Thirdweb.Tests/Thirdweb.Http/Thirdweb.Http.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Http/Thirdweb.Http.Tests.cs @@ -324,7 +324,7 @@ public void StatusCode_ShouldSetAndGet() var responseMessage = new ThirdwebHttpResponseMessage(200, new ThirdwebHttpContent("Test Content"), true) { // Act - StatusCode = 404 + StatusCode = 404, }; // Assert @@ -340,7 +340,7 @@ public void Content_ShouldSetAndGet() var responseMessage = new ThirdwebHttpResponseMessage(200, initialContent, true) { // Act - Content = newContent + Content = newContent, }; // Assert @@ -354,7 +354,7 @@ public void IsSuccessStatusCode_ShouldSetAndGet() var responseMessage = new ThirdwebHttpResponseMessage(200, new ThirdwebHttpContent("Test Content"), true) { // Act - IsSuccessStatusCode = false + IsSuccessStatusCode = false, }; // Assert diff --git a/Thirdweb.Tests/Thirdweb.Tests.csproj b/Thirdweb.Tests/Thirdweb.Tests.csproj index 5ad03d1c..465551a0 100644 --- a/Thirdweb.Tests/Thirdweb.Tests.csproj +++ b/Thirdweb.Tests/Thirdweb.Tests.csproj @@ -1,43 +1,40 @@ - net8.0 + latest + true enable enable false true - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - + + + all - + all - - + + - - PreserveNewest - PreserveNewest - - \ No newline at end of file + diff --git a/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.Transactions.Tests.cs b/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.Transactions.Tests.cs index 83895fe7..3d3bce7a 100644 --- a/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.Transactions.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.Transactions.Tests.cs @@ -11,7 +11,7 @@ public TransactionTests(ITestOutputHelper output) private async Task CreateSampleTransaction() { var wallet = await PrivateKeyWallet.Generate(this.Client); - var transaction = await ThirdwebTransaction.Create(wallet, new ThirdwebTransactionInput(421614) { To = await wallet.GetAddress(), }); + var transaction = await ThirdwebTransaction.Create(wallet, new ThirdwebTransactionInput(421614) { To = await wallet.GetAddress() }); return transaction; } @@ -164,7 +164,7 @@ public async Task Sign_SmartWallet_SignsTransaction() var client = this.Client; var privateKeyAccount = await PrivateKeyWallet.Generate(client); var smartAccount = await SmartWallet.Create(personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); - var transaction = await ThirdwebTransaction.Create(smartAccount, new ThirdwebTransactionInput(421614) { To = Constants.ADDRESS_ZERO, }); + var transaction = await ThirdwebTransaction.Create(smartAccount, new ThirdwebTransactionInput(421614) { To = Constants.ADDRESS_ZERO }); var signed = await ThirdwebTransaction.Sign(transaction); Assert.NotNull(signed); } @@ -329,7 +329,7 @@ public async Task EstimateTotalCosts_HigherThanGasCostsByValue() [Fact(Timeout = 120000)] public async Task EstimateGasFees_ReturnsCorrectly() { - var transaction = await ThirdwebTransaction.Create(await PrivateKeyWallet.Generate(this.Client), new ThirdwebTransactionInput(250) { To = Constants.ADDRESS_ZERO, }); + var transaction = await ThirdwebTransaction.Create(await PrivateKeyWallet.Generate(this.Client), new ThirdwebTransactionInput(250) { To = Constants.ADDRESS_ZERO }); (var maxFee, var maxPrio) = await ThirdwebTransaction.EstimateGasFees(transaction); @@ -365,7 +365,7 @@ public async Task Simulate_ReturnsDataOrThrowsIntrinsic() var client = this.Client; var privateKeyAccount = await PrivateKeyWallet.Generate(client); var smartAccount = await SmartWallet.Create(personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); - var transaction = await ThirdwebTransaction.Create(smartAccount, new ThirdwebTransactionInput(421614) { To = Constants.ADDRESS_ZERO, Gas = new HexBigInteger(250000), }); + var transaction = await ThirdwebTransaction.Create(smartAccount, new ThirdwebTransactionInput(421614) { To = Constants.ADDRESS_ZERO, Gas = new HexBigInteger(250000) }); try { diff --git a/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.ZkSmartWallet.Tests.cs b/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.ZkSmartWallet.Tests.cs index 3bc6452c..5aad82db 100644 --- a/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.ZkSmartWallet.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.ZkSmartWallet.Tests.cs @@ -33,17 +33,16 @@ public async Task PersonalSign_Success() public async Task CreateSessionKey_Throws() { var account = await this.GetSmartAccount(); - _ = await Assert.ThrowsAsync( - async () => - await account.CreateSessionKey( - signerAddress: await account.GetAddress(), - approvedTargets: new List() { Constants.ADDRESS_ZERO }, - nativeTokenLimitPerTransactionInWei: "0", - permissionStartTimestamp: "0", - permissionEndTimestamp: (Utils.GetUnixTimeStampNow() + 86400).ToString(), - reqValidityStartTimestamp: "0", - reqValidityEndTimestamp: Utils.GetUnixTimeStampIn10Years().ToString() - ) + _ = await Assert.ThrowsAsync(async () => + await account.CreateSessionKey( + signerAddress: await account.GetAddress(), + approvedTargets: new List() { Constants.ADDRESS_ZERO }, + nativeTokenLimitPerTransactionInWei: "0", + permissionStartTimestamp: "0", + permissionEndTimestamp: (Utils.GetUnixTimeStampNow() + 86400).ToString(), + reqValidityStartTimestamp: "0", + reqValidityEndTimestamp: Utils.GetUnixTimeStampIn10Years().ToString() + ) ); } @@ -78,7 +77,7 @@ public async Task SendGaslessZkTx_Success() From = await account.GetAddress(), To = await account.GetAddress(), Value = new Nethereum.Hex.HexTypes.HexBigInteger(0), - Data = "0x" + Data = "0x", } ); Assert.NotNull(hash); @@ -146,7 +145,7 @@ public async Task ZkSync_Switch() From = await account.GetAddress(), To = await account.GetAddress(), Value = new Nethereum.Hex.HexTypes.HexBigInteger(0), - Data = "0x" + Data = "0x", } ); } diff --git a/Thirdweb.Tests/Thirdweb.Utils/Thirdweb.Utils.Tests.cs b/Thirdweb.Tests/Thirdweb.Utils/Thirdweb.Utils.Tests.cs index f1802b95..e151052a 100644 --- a/Thirdweb.Tests/Thirdweb.Utils/Thirdweb.Utils.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Utils/Thirdweb.Utils.Tests.cs @@ -229,7 +229,7 @@ public void GenerateSIWE_ReturnsCorrectValue() Domain = "thirdweb.com", IssuedAt = "0", ExpirationTime = "0", - InvalidBefore = "0" + InvalidBefore = "0", }; var expectedSIWE = "thirdweb.com wants you to sign in with your Ethereum account:\n0x0000000000000000000000000000000000000000\n\n\nVersion: 1\nChain ID: 421614\nNonce: 0\nIssued At: 0\nExpiration Time: 0\nNot Before: 0"; @@ -252,7 +252,7 @@ public void GenerateSIWE_WithAllOptional_ReturnsCorrectValue() InvalidBefore = "0", Statement = "This is a statement", Uri = "https://thirdweb.com", - Resources = new List() { "resource1", "resource2" } + Resources = new List() { "resource1", "resource2" }, }; var expectedSIWE = "thirdweb.com wants you to sign in with your Ethereum account:\n0x0000000000000000000000000000000000000000\n\nThis is a statement\n\nURI: https://thirdweb.com\nVersion: 1\nChain ID: 421614\nNonce: 0\nIssued At: 0\nExpiration Time: 0\nNot Before: 0\nResources:\n- resource1\n- resource2"; @@ -273,7 +273,7 @@ public void GenerateSIWE_WithResources_ReturnsCorrectValue() IssuedAt = "0", ExpirationTime = "0", InvalidBefore = "0", - Resources = new List() { "resource1", "resource2" } + Resources = new List() { "resource1", "resource2" }, }; var expectedSIWE = "thirdweb.com wants you to sign in with your Ethereum account:\n0x0000000000000000000000000000000000000000\n\n\nVersion: 1\nChain ID: 421614\nNonce: 0\nIssued At: 0\nExpiration Time: 0\nNot Before: 0\nResources:\n- resource1\n- resource2"; @@ -300,7 +300,7 @@ public void GenerateSIWE_ThrowsOnNullDomain() Domain = null!, IssuedAt = "0", ExpirationTime = "0", - InvalidBefore = "0" + InvalidBefore = "0", }; _ = Assert.Throws(() => Utils.GenerateSIWE(loginPayloadData)); } @@ -317,7 +317,7 @@ public void GenerateSIWE_ThrowsOnNullAddress() Domain = "thirdweb.com", IssuedAt = "0", ExpirationTime = "0", - InvalidBefore = "0" + InvalidBefore = "0", }; _ = Assert.Throws(() => Utils.GenerateSIWE(loginPayloadData)); } @@ -334,7 +334,7 @@ public void GenerateSIWE_ThrowsOnNullVersion() Domain = "thirdweb.com", IssuedAt = "0", ExpirationTime = "0", - InvalidBefore = "0" + InvalidBefore = "0", }; _ = Assert.Throws(() => Utils.GenerateSIWE(loginPayloadData)); } @@ -351,7 +351,7 @@ public void GenerateSIWE_ThrowsOnNullChainId() Domain = "thirdweb.com", IssuedAt = "0", ExpirationTime = "0", - InvalidBefore = "0" + InvalidBefore = "0", }; _ = Assert.Throws(() => Utils.GenerateSIWE(loginPayloadData)); } @@ -368,7 +368,7 @@ public void GenerateSIWE_ThrowsOnNullNonce() Domain = "thirdweb.com", IssuedAt = "0", ExpirationTime = "0", - InvalidBefore = "0" + InvalidBefore = "0", }; _ = Assert.Throws(() => Utils.GenerateSIWE(loginPayloadData)); } @@ -385,7 +385,7 @@ public void GenerateSIWE_ThrowsOnNullIssuedAt() Domain = "thirdweb.com", IssuedAt = null!, ExpirationTime = "0", - InvalidBefore = "0" + InvalidBefore = "0", }; _ = Assert.Throws(() => Utils.GenerateSIWE(loginPayloadData)); } diff --git a/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.PrivateKeyWallet.Tests.cs b/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.PrivateKeyWallet.Tests.cs index 145c6c7a..fe33ed02 100644 --- a/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.PrivateKeyWallet.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.PrivateKeyWallet.Tests.cs @@ -270,7 +270,7 @@ public async Task SignTransaction_NoNonce() To = Constants.ADDRESS_ZERO, Value = new HexBigInteger(0), Gas = new HexBigInteger(21000), - Data = "0x" + Data = "0x", }; var ex = await Assert.ThrowsAsync(() => account.SignTransaction(transaction)); Assert.Equal("Transaction nonce has not been set (Parameter 'transaction')", ex.Message); @@ -288,7 +288,7 @@ public async Task SignTransaction_NoGasPrice() Gas = new HexBigInteger(21000), Data = "0x", Nonce = new HexBigInteger(99999999999), - ChainId = new HexBigInteger(421614) + ChainId = new HexBigInteger(421614), }; var ex = await Assert.ThrowsAsync(() => account.SignTransaction(transaction)); Assert.Equal("Transaction MaxPriorityFeePerGas and MaxFeePerGas must be set for EIP-1559 transactions", ex.Message); diff --git a/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.SmartWallet.Tests.cs b/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.SmartWallet.Tests.cs index c6c10816..ce299687 100644 --- a/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.SmartWallet.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.SmartWallet.Tests.cs @@ -34,8 +34,8 @@ public async Task Initialization_Fail() var client = this.Client; var privateKeyAccount = await PrivateKeyWallet.Generate(client); await privateKeyAccount.Disconnect(); - var ex = await Assert.ThrowsAsync( - async () => await SmartWallet.Create(personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614) + var ex = await Assert.ThrowsAsync(async () => + await SmartWallet.Create(personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614) ); Assert.Equal("SmartAccount.Connect: Personal account must be connected.", ex.Message); } @@ -85,7 +85,7 @@ public async Task ExecuteTransaction_Success() public async Task SendTransaction_Success() { var account = await this.GetSmartAccount(); - var tx = await account.SendTransaction(new ThirdwebTransactionInput(421614) { To = await account.GetAddress(), }); + var tx = await account.SendTransaction(new ThirdwebTransactionInput(421614) { To = await account.GetAddress() }); Assert.NotNull(tx); } @@ -95,7 +95,7 @@ public async Task SendTransaction_ClientBundleId_Success() var client = ThirdwebClient.Create(clientId: this.ClientIdBundleIdOnly, bundleId: this.BundleIdBundleIdOnly); var privateKeyAccount = await PrivateKeyWallet.Generate(client); var smartAccount = await SmartWallet.Create(personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); - var tx = await smartAccount.SendTransaction(new ThirdwebTransactionInput(421614) { To = await smartAccount.GetAddress(), }); + var tx = await smartAccount.SendTransaction(new ThirdwebTransactionInput(421614) { To = await smartAccount.GetAddress() }); Assert.NotNull(tx); } @@ -289,7 +289,7 @@ public async Task SendTransaction_07_Success() entryPoint: Constants.ENTRYPOINT_ADDRESS_V07 ); - var hash07 = await smartWallet07.SendTransaction(new ThirdwebTransactionInput(11155111) { To = await smartWallet07.GetAddress(), }); + var hash07 = await smartWallet07.SendTransaction(new ThirdwebTransactionInput(11155111) { To = await smartWallet07.GetAddress() }); Assert.NotNull(hash07); Assert.True(hash07.Length == 66); @@ -306,8 +306,8 @@ public async Task ExecuteTransaction_07_WhenAll_Success() entryPoint: Constants.ENTRYPOINT_ADDRESS_V07 ); - var hash07 = smartWallet07.ExecuteTransaction(new ThirdwebTransactionInput(11155111) { To = await smartWallet07.GetAddress(), }); - var hash07_2 = smartWallet07.ExecuteTransaction(new ThirdwebTransactionInput(11155111) { To = await smartWallet07.GetAddress(), }); + var hash07 = smartWallet07.ExecuteTransaction(new ThirdwebTransactionInput(11155111) { To = await smartWallet07.GetAddress() }); + var hash07_2 = smartWallet07.ExecuteTransaction(new ThirdwebTransactionInput(11155111) { To = await smartWallet07.GetAddress() }); var hashes = await Task.WhenAll(hash07, hash07_2); diff --git a/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs b/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs index 517c11e9..cbe822a8 100644 --- a/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Wallets/Thirdweb.Wallets.Tests.cs @@ -102,7 +102,7 @@ await wallet.GetAddress(), PermissionStartTimestamp = 0, ReqValidityStartTimestamp = 0, PermissionEndTimestamp = 0, - Uid = new byte[32] + Uid = new byte[32], }; var typedData2 = EIP712.GetTypedDefinition_SmartAccount("Account", "1", 421614, await wallet.GetAddress()); @@ -221,12 +221,12 @@ public async Task RecoverAddress_AllVariants_NullTests() var nullData = null as AccountAbstraction.SignerPermissionRequest; var nullTypedData = null as Nethereum.ABI.EIP712.TypedData; var nullSig = null as string; - _ = await Assert.ThrowsAsync( - async () => await wallet.RecoverAddressFromTypedDataV4(nullData, nullTypedData, nullSig) + _ = await Assert.ThrowsAsync(async () => + await wallet.RecoverAddressFromTypedDataV4(nullData, nullTypedData, nullSig) ); _ = await Assert.ThrowsAsync(async () => await wallet.RecoverAddressFromTypedDataV4(new AccountAbstraction.SignerPermissionRequest(), nullTypedData, nullSig)); - _ = await Assert.ThrowsAsync( - async () => await wallet.RecoverAddressFromTypedDataV4(new AccountAbstraction.SignerPermissionRequest(), new Nethereum.ABI.EIP712.TypedData(), nullSig) + _ = await Assert.ThrowsAsync(async () => + await wallet.RecoverAddressFromTypedDataV4(new AccountAbstraction.SignerPermissionRequest(), new Nethereum.ABI.EIP712.TypedData(), nullSig) ); #nullable restore } diff --git a/Thirdweb/Thirdweb.AI/ThirdwebNebula.cs b/Thirdweb/Thirdweb.AI/ThirdwebNebula.cs index 86b1c199..c30f6538 100644 --- a/Thirdweb/Thirdweb.AI/ThirdwebNebula.cs +++ b/Thirdweb/Thirdweb.AI/ThirdwebNebula.cs @@ -6,7 +6,7 @@ namespace Thirdweb.AI; public enum NebulaChatRole { User, - Assistant + Assistant, } public class NebulaChatMessage @@ -82,7 +82,7 @@ public static async Task Create(ThirdwebClient client, string se { ModelName = model, Title = $"Thirdweb .NET SDK (v{Constants.VERSION}) | Nebula {model} Session | Client ID: {client.ClientId}", - IsPublic = false + IsPublic = false, } ); nebula.SessionId = session.Id; @@ -225,7 +225,7 @@ private async Task PrepareContextFilter(IThirdwebWallet walle { SessionId = this.SessionId, ChainIds = context?.ChainIds?.Select(id => id).ToList(), - WalletAddress = context?.WalletAddress + WalletAddress = context?.WalletAddress, }; } diff --git a/Thirdweb/Thirdweb.Api/GeneratedClient.cs b/Thirdweb/Thirdweb.Api/GeneratedClient.cs new file mode 100644 index 00000000..a6f3041f --- /dev/null +++ b/Thirdweb/Thirdweb.Api/GeneratedClient.cs @@ -0,0 +1,9351 @@ +//---------------------- +// +// Generated using the NSwag toolchain v14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8600 // Disable "CS8600 Converting null literal or possible null value to non-nullable type" +#pragma warning disable 8602 // Disable "CS8602 Dereference of a possibly null reference" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" +#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" +#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" +#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." +#pragma warning disable 8981 // Disable "CS8981 The type name only contains lower-cased ascii characters." + +namespace Thirdweb.Api +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + internal partial class ThirdwebApiClient + { + #pragma warning disable 8618 + private string _baseUrl; + #pragma warning restore 8618 + + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private Newtonsoft.Json.JsonSerializerSettings _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public ThirdwebApiClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + BaseUrl = "https://api.thirdweb.com"; + _httpClient = httpClient; + Initialize(); + } + + private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set + { + _baseUrl = value; + if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/")) + _baseUrl += '/'; + } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// + /// Initiate Auth + /// + /// + /// Start any authentication flow in one unified endpoint. This endpoint supports all authentication methods including SMS, email, OAuth, passkey, and SIWE (Sign-In with Ethereum). + ///
+ ///
**Supported Methods:** + ///
- **SMS** - Send verification code to phone number + ///
- **Email** - Send verification code to email address + ///
- **OAuth** - Generate redirect link (Google, Apple, Facebook, Discord, GitHub, X, Coinbase, Farcaster, Telegram, LINE, Twitch, Steam) + ///
- **Passkey** - Generate WebAuthn challenge for biometric authentication + ///
- **SIWE** - Generate Sign-In with Ethereum payload + ///
+ ///
**Flow:** + ///
1. Choose your authentication method + ///
2. Provide method-specific parameters + ///
3. Receive challenge data to complete authentication + ///
4. Use the `/complete` endpoint to finish the process + ///
+ ///
**Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. + ///
+ /// Authentication initiated successfully. Use the returned challenge data to complete authentication. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task InitiateAuthenticationAsync(Body body) + { + return InitiateAuthenticationAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Initiate Auth + /// + /// + /// Start any authentication flow in one unified endpoint. This endpoint supports all authentication methods including SMS, email, OAuth, passkey, and SIWE (Sign-In with Ethereum). + ///
+ ///
**Supported Methods:** + ///
- **SMS** - Send verification code to phone number + ///
- **Email** - Send verification code to email address + ///
- **OAuth** - Generate redirect link (Google, Apple, Facebook, Discord, GitHub, X, Coinbase, Farcaster, Telegram, LINE, Twitch, Steam) + ///
- **Passkey** - Generate WebAuthn challenge for biometric authentication + ///
- **SIWE** - Generate Sign-In with Ethereum payload + ///
+ ///
**Flow:** + ///
1. Choose your authentication method + ///
2. Provide method-specific parameters + ///
3. Receive challenge data to complete authentication + ///
4. Use the `/complete` endpoint to finish the process + ///
+ ///
**Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. + ///
+ /// Authentication initiated successfully. Use the returned challenge data to complete authentication. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task InitiateAuthenticationAsync(Body body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/auth/initiate" + urlBuilder_.Append("v1/auth/initiate"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request - Check your method and parameters", status_, responseText_, headers_, null); + } + else + if (status_ == 429) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Rate limit exceeded - Please wait before trying again", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Complete Auth + /// + /// + /// Complete the authentication flow and receive your wallet credentials. After initiating authentication, use this endpoint to submit the required verification data. + ///
+ ///
**Completion Methods:** + ///
- **SMS/Email** - Submit the verification code you received + ///
- **Passkey** - Provide the WebAuthn signature response + ///
- **SIWE** - Submit your signed Ethereum message + ///
- **Guest** - Create an ephemeral guest wallet + ///
- **Custom** - Send your JWT token or custom payload + ///
+ ///
**Response:** + ///
- `isNewUser` - Whether this is a new wallet creation + ///
- `token` - JWT token for authenticated API requests + ///
- `type` - The authentication method used + ///
- `walletAddress` - Your new or existing wallet address + ///
+ ///
**Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. + ///
+ /// Authentication completed successfully. You now have wallet access. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task CompleteAuthenticationAsync(Body2 body) + { + return CompleteAuthenticationAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Complete Auth + /// + /// + /// Complete the authentication flow and receive your wallet credentials. After initiating authentication, use this endpoint to submit the required verification data. + ///
+ ///
**Completion Methods:** + ///
- **SMS/Email** - Submit the verification code you received + ///
- **Passkey** - Provide the WebAuthn signature response + ///
- **SIWE** - Submit your signed Ethereum message + ///
- **Guest** - Create an ephemeral guest wallet + ///
- **Custom** - Send your JWT token or custom payload + ///
+ ///
**Response:** + ///
- `isNewUser` - Whether this is a new wallet creation + ///
- `token` - JWT token for authenticated API requests + ///
- `type` - The authentication method used + ///
- `walletAddress` - Your new or existing wallet address + ///
+ ///
**Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. + ///
+ /// Authentication completed successfully. You now have wallet access. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CompleteAuthenticationAsync(Body2 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/auth/complete" + urlBuilder_.Append("v1/auth/complete"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid credentials or request - Check your challenge ID and verification data", status_, responseText_, headers_, null); + } + else + if (status_ == 429) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Rate limit exceeded - Please wait before trying again", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get My Wallet + /// + /// + /// Retrieve the authenticated user's wallet information including wallet addresses and linked authentication wallets. This endpoint provides comprehensive user data for the currently authenticated session. + ///
+ ///
**Returns:** + ///
- Primary wallet address + ///
- Smart wallet address (if available) + ///
- Wallet creation timestamp + ///
- Public key in hexadecimal format (if available) + ///
- All linked authentication profiles (email, phone, OAuth providers) + ///
+ ///
**Authentication:** Requires `Authorization: Bearer <jwt>` header with a valid user authentication token. + ///
+ /// Wallet retrieved successfully. Returns comprehensive user information including wallet addresses, public key, and linked wallets. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetMyWalletAsync() + { + return GetMyWalletAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get My Wallet + /// + /// + /// Retrieve the authenticated user's wallet information including wallet addresses and linked authentication wallets. This endpoint provides comprehensive user data for the currently authenticated session. + ///
+ ///
**Returns:** + ///
- Primary wallet address + ///
- Smart wallet address (if available) + ///
- Wallet creation timestamp + ///
- Public key in hexadecimal format (if available) + ///
- All linked authentication profiles (email, phone, OAuth providers) + ///
+ ///
**Authentication:** Requires `Authorization: Bearer <jwt>` header with a valid user authentication token. + ///
+ /// Wallet retrieved successfully. Returns comprehensive user information including wallet addresses, public key, and linked wallets. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetMyWalletAsync(System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/me" + urlBuilder_.Append("v1/wallets/me"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `Authorization: Bearer ` header.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Wallet not found. The authenticated user does not exist in the system.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to service unavailability or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List User Wallets + /// + /// + /// Get all user wallet details with filtering and pagination for your project. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Returns a list of user wallet addresses, smart wallet addresses, and auth details. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ListUserWalletsAsync(double? limit, double? page, string email, string phone, string address, string externalWalletAddress, string id) + { + return ListUserWalletsAsync(limit, page, email, phone, address, externalWalletAddress, id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List User Wallets + /// + /// + /// Get all user wallet details with filtering and pagination for your project. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Returns a list of user wallet addresses, smart wallet addresses, and auth details. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ListUserWalletsAsync(double? limit, double? page, string email, string phone, string address, string externalWalletAddress, string id, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/user" + urlBuilder_.Append("v1/wallets/user"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (email != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("email")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(email, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (phone != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("phone")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(phone, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (address != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("address")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (externalWalletAddress != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("externalWalletAddress")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(externalWalletAddress, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (id != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-secret-key` header for backend authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to service unavailability or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create User Wallet + /// + /// + /// Create a user wallet with a wallet based on their authentication strategy. This endpoint creates a wallet in advance that can be claimed later when the user authenticates. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Successfully created a user wallet with wallet. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task CreateUserWalletAsync(Body3 body) + { + return CreateUserWalletAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create User Wallet + /// + /// + /// Create a user wallet with a wallet based on their authentication strategy. This endpoint creates a wallet in advance that can be claimed later when the user authenticates. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Successfully created a user wallet with wallet. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CreateUserWalletAsync(Body3 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/user" + urlBuilder_.Append("v1/wallets/user"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request. This may occur due to missing required fields based on the authentication strategy, invalid strategy, or malformed request data.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-secret-key` header for backend authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to service unavailability or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List Server Wallets + /// + /// + /// Get all server wallet details with pagination for your project. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Returns a list of server wallet addresses, smart wallet addresses, and auth details. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ListServerWalletsAsync(double? limit, double? page) + { + return ListServerWalletsAsync(limit, page, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List Server Wallets + /// + /// + /// Get all server wallet details with pagination for your project. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Returns a list of server wallet addresses, smart wallet addresses, and auth details. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ListServerWalletsAsync(double? limit, double? page, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/server" + urlBuilder_.Append("v1/wallets/server"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-secret-key` header for backend authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to service unavailability or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create Server Wallet + /// + /// + /// Creates a server wallet from a unique identifier. If the wallet already exists, it will return the existing wallet. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Server wallet created or connected successfully. Returns wallet addresses for subsequent operations. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task CreateServerWalletAsync(Body4 body) + { + return CreateServerWalletAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create Server Wallet + /// + /// + /// Creates a server wallet from a unique identifier. If the wallet already exists, it will return the existing wallet. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Server wallet created or connected successfully. Returns wallet addresses for subsequent operations. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CreateServerWalletAsync(Body4 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/server" + urlBuilder_.Append("v1/wallets/server"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the identifier format is invalid or required parameters are missing.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to wallet service unavailability, smart wallet deployment issues, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Balance + /// + /// + /// Get native token balance for a wallet address across multiple blockchain networks. This endpoint retrieves native token balances (ETH, MATIC, BNB, etc.) for a given wallet address on multiple chains simultaneously, making it efficient for cross-chain native balance checking. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Chain ID(s) to request balance data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// Wallet native balances retrieved successfully. Returns detailed native token balance information for each chain including token metadata and formatted values. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetWalletBalanceAsync(string address, System.Collections.Generic.IEnumerable chainId) + { + return GetWalletBalanceAsync(address, chainId, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Balance + /// + /// + /// Get native token balance for a wallet address across multiple blockchain networks. This endpoint retrieves native token balances (ETH, MATIC, BNB, etc.) for a given wallet address on multiple chains simultaneously, making it efficient for cross-chain native balance checking. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Chain ID(s) to request balance data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// Wallet native balances retrieved successfully. Returns detailed native token balance information for each chain including token metadata and formatted values. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetWalletBalanceAsync(string address, System.Collections.Generic.IEnumerable chainId, System.Threading.CancellationToken cancellationToken) + { + if (address == null) + throw new System.ArgumentNullException("address"); + + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/{address}/balance" + urlBuilder_.Append("v1/wallets/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/balance"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("chainId") + "="); + foreach (var item_ in chainId) + { + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(","); + } + urlBuilder_.Length--; + urlBuilder_.Append("&"); + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the wallet address format is invalid, chainId array is empty or exceeds the maximum limit of 50, or chain IDs are invalid.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to blockchain connectivity issues, RPC service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Transactions + /// + /// + /// Retrieves transactions for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive transaction data including both incoming and outgoing transactions, with block information, gas details, transaction status, and function calls. Results can be filtered, paginated, and sorted to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Filter by block timestamp (Unix timestamp) greater than or equal to this value + /// Filter by block timestamp (Unix timestamp) less than or equal to this value + /// Filter by block number greater than or equal to this value + /// Filter by block number less than or equal to this value + /// Filter by transaction value (in wei) greater than this value + /// Filter by function selector (4-byte method ID), e.g., '0xa9059cbb' for ERC-20 transfer + /// Current page number + /// Number of items per page + /// Sort order: 'asc' for ascending, 'desc' for descending + /// Chain ID(s) to request transaction data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// Wallet transactions retrieved successfully. Returns transaction data with metadata including pagination information and chain details. Includes decoded function calls when ABI is available. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetWalletTransactionsAsync(string address, int? filterBlockTimestampGte, int? filterBlockTimestampLte, int? filterBlockNumberGte, int? filterBlockNumberLte, string filterValueGt, string filterFunctionSelector, double? page, double? limit, SortOrder? sortOrder, System.Collections.Generic.IEnumerable chainId) + { + return GetWalletTransactionsAsync(address, filterBlockTimestampGte, filterBlockTimestampLte, filterBlockNumberGte, filterBlockNumberLte, filterValueGt, filterFunctionSelector, page, limit, sortOrder, chainId, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Transactions + /// + /// + /// Retrieves transactions for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive transaction data including both incoming and outgoing transactions, with block information, gas details, transaction status, and function calls. Results can be filtered, paginated, and sorted to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Filter by block timestamp (Unix timestamp) greater than or equal to this value + /// Filter by block timestamp (Unix timestamp) less than or equal to this value + /// Filter by block number greater than or equal to this value + /// Filter by block number less than or equal to this value + /// Filter by transaction value (in wei) greater than this value + /// Filter by function selector (4-byte method ID), e.g., '0xa9059cbb' for ERC-20 transfer + /// Current page number + /// Number of items per page + /// Sort order: 'asc' for ascending, 'desc' for descending + /// Chain ID(s) to request transaction data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// Wallet transactions retrieved successfully. Returns transaction data with metadata including pagination information and chain details. Includes decoded function calls when ABI is available. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetWalletTransactionsAsync(string address, int? filterBlockTimestampGte, int? filterBlockTimestampLte, int? filterBlockNumberGte, int? filterBlockNumberLte, string filterValueGt, string filterFunctionSelector, double? page, double? limit, SortOrder? sortOrder, System.Collections.Generic.IEnumerable chainId, System.Threading.CancellationToken cancellationToken) + { + if (address == null) + throw new System.ArgumentNullException("address"); + + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/{address}/transactions" + urlBuilder_.Append("v1/wallets/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/transactions"); + urlBuilder_.Append('?'); + if (filterBlockTimestampGte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockTimestampGte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockTimestampGte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockTimestampLte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockTimestampLte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockTimestampLte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockNumberGte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockNumberGte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockNumberGte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockNumberLte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockNumberLte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockNumberLte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterValueGt != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterValueGt")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterValueGt, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterFunctionSelector != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterFunctionSelector")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterFunctionSelector, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (sortOrder != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sortOrder")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sortOrder, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Append(System.Uri.EscapeDataString("chainId") + "="); + foreach (var item_ in chainId) + { + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(","); + } + urlBuilder_.Length--; + urlBuilder_.Append("&"); + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the wallet address format is invalid, chainId array is empty or exceeds the maximum limit of 50, or pagination parameters are out of range.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Wallet not found or no transactions available for the specified wallet address on the given blockchain networks.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Tokens + /// + /// + /// Retrieves token balances for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive token data including ERC-20 tokens with their balances, metadata, and price information. Results can be filtered by chain and paginated to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Chain ID(s) to request token data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// Token addresses to filter by. If provided, only tokens with these addresses will be returned. + /// The number of tokens to return per chain (default: 20, max: 500). + /// The page number for pagination (default: 1, max: 20). + /// Wallet tokens retrieved successfully. Returns token data with metadata including pagination information and chain details. Includes token balances, metadata, and price information when available. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetWalletTokensAsync(string address, System.Collections.Generic.IEnumerable chainId, System.Collections.Generic.IEnumerable tokenAddresses, int? limit, int? page) + { + return GetWalletTokensAsync(address, chainId, tokenAddresses, limit, page, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Tokens + /// + /// + /// Retrieves token balances for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive token data including ERC-20 tokens with their balances, metadata, and price information. Results can be filtered by chain and paginated to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Chain ID(s) to request token data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// Token addresses to filter by. If provided, only tokens with these addresses will be returned. + /// The number of tokens to return per chain (default: 20, max: 500). + /// The page number for pagination (default: 1, max: 20). + /// Wallet tokens retrieved successfully. Returns token data with metadata including pagination information and chain details. Includes token balances, metadata, and price information when available. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetWalletTokensAsync(string address, System.Collections.Generic.IEnumerable chainId, System.Collections.Generic.IEnumerable tokenAddresses, int? limit, int? page, System.Threading.CancellationToken cancellationToken) + { + if (address == null) + throw new System.ArgumentNullException("address"); + + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/{address}/tokens" + urlBuilder_.Append("v1/wallets/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/tokens"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("chainId") + "="); + foreach (var item_ in chainId) + { + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(","); + } + urlBuilder_.Length--; + urlBuilder_.Append("&"); + if (tokenAddresses != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tokenAddresses") + "="); + foreach (var item_ in tokenAddresses) + { + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(","); + } + urlBuilder_.Length--; + urlBuilder_.Append("&"); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the wallet address format is invalid, chainId array is empty or exceeds the maximum limit of 50, or pagination parameters are out of range.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Wallet not found or no tokens available for the specified wallet address on the given blockchain networks.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get NFTs + /// + /// + /// Retrieves NFTs for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive NFT data including metadata, attributes, and collection information. Results can be filtered by chain and paginated to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Chain ID(s) to request NFT data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// NFT contract addresses to filter by. If provided, only NFTs with these addresses will be returned. + /// The number of NFTs to return per chain (default: 20, max: 500). + /// The page number for pagination (default: 1, max: 20). + /// Wallet NFTs retrieved successfully. Returns NFT data with metadata including pagination information and chain details. Includes NFT metadata, attributes, and collection information when available. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetWalletNFTsAsync(string address, System.Collections.Generic.IEnumerable chainId, System.Collections.Generic.IEnumerable contractAddresses, int? limit, int? page) + { + return GetWalletNFTsAsync(address, chainId, contractAddresses, limit, page, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get NFTs + /// + /// + /// Retrieves NFTs for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive NFT data including metadata, attributes, and collection information. Results can be filtered by chain and paginated to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Chain ID(s) to request NFT data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// NFT contract addresses to filter by. If provided, only NFTs with these addresses will be returned. + /// The number of NFTs to return per chain (default: 20, max: 500). + /// The page number for pagination (default: 1, max: 20). + /// Wallet NFTs retrieved successfully. Returns NFT data with metadata including pagination information and chain details. Includes NFT metadata, attributes, and collection information when available. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetWalletNFTsAsync(string address, System.Collections.Generic.IEnumerable chainId, System.Collections.Generic.IEnumerable contractAddresses, int? limit, int? page, System.Threading.CancellationToken cancellationToken) + { + if (address == null) + throw new System.ArgumentNullException("address"); + + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/{address}/nfts" + urlBuilder_.Append("v1/wallets/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/nfts"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("chainId") + "="); + foreach (var item_ in chainId) + { + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(","); + } + urlBuilder_.Length--; + urlBuilder_.Append("&"); + if (contractAddresses != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("contractAddresses") + "="); + foreach (var item_ in contractAddresses) + { + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(","); + } + urlBuilder_.Length--; + urlBuilder_.Append("&"); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the wallet address format is invalid, chainId array is empty or exceeds the maximum limit of 50, or pagination parameters are out of range.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Wallet not found or no NFTs available for the specified wallet address on the given blockchain networks.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Sign Message + /// + /// + /// Signs an arbitrary message using the specified wallet. This endpoint supports both text and hexadecimal message formats. The signing is performed using thirdweb Engine with smart wallet support for gasless transactions. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Message signed successfully. Returns the cryptographic signature that can be used for verification. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SignMessageAsync(Body5 body) + { + return SignMessageAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Sign Message + /// + /// + /// Signs an arbitrary message using the specified wallet. This endpoint supports both text and hexadecimal message formats. The signing is performed using thirdweb Engine with smart wallet support for gasless transactions. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Message signed successfully. Returns the cryptographic signature that can be used for verification. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SignMessageAsync(Body5 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/sign-message" + urlBuilder_.Append("v1/wallets/sign-message"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the wallet address format is invalid, chainId is not supported, or the message format is incorrect.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to wallet connectivity issues, signing service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Sign Typed Data + /// + /// + /// Signs structured data according to the EIP-712 standard using the specified wallet. This is commonly used for secure message signing in DeFi protocols, NFT marketplaces, and other dApps that require structured data verification. The typed data includes domain separation and type definitions for enhanced security. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Typed data signed successfully. Returns the EIP-712 compliant signature that can be used for on-chain verification. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SignTypedDataAsync(Body6 body) + { + return SignTypedDataAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Sign Typed Data + /// + /// + /// Signs structured data according to the EIP-712 standard using the specified wallet. This is commonly used for secure message signing in DeFi protocols, NFT marketplaces, and other dApps that require structured data verification. The typed data includes domain separation and type definitions for enhanced security. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Typed data signed successfully. Returns the EIP-712 compliant signature that can be used for on-chain verification. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SignTypedDataAsync(Body6 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/sign-typed-data" + urlBuilder_.Append("v1/wallets/sign-typed-data"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the typed data structure is malformed, domain parameters are incorrect, or wallet address format is invalid.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include valid `x-wallet-access-token` headers for accessing the wallet, as well as a x-client-id (frontend) or x-secret-key (backend) for project authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to wallet connectivity issues, signing service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Send Tokens + /// + /// + /// Send tokens to multiple recipients in a single transaction batch. Supports native tokens (ETH, MATIC, etc.), ERC20 tokens, ERC721 NFTs, and ERC1155 tokens. The token type is automatically determined based on the provided parameters and ERC165 interface detection: + ///
+ ///
- **Native Token**: No `tokenAddress` provided + ///
- **ERC20**: `tokenAddress` provided, no `tokenId` + ///
- **ERC721/ERC1155**: `tokenAddress` and `tokenId` provided. Auto detects contract type: + ///
- ERC721: quantity must be '1' + ///
- ERC1155: any quantity allowed (including '1') + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Tokens sent successfully. Returns transaction IDs for tracking and monitoring. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SendTokensAsync(Body7 body) + { + return SendTokensAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Send Tokens + /// + /// + /// Send tokens to multiple recipients in a single transaction batch. Supports native tokens (ETH, MATIC, etc.), ERC20 tokens, ERC721 NFTs, and ERC1155 tokens. The token type is automatically determined based on the provided parameters and ERC165 interface detection: + ///
+ ///
- **Native Token**: No `tokenAddress` provided + ///
- **ERC20**: `tokenAddress` provided, no `tokenId` + ///
- **ERC721/ERC1155**: `tokenAddress` and `tokenId` provided. Auto detects contract type: + ///
- ERC721: quantity must be '1' + ///
- ERC1155: any quantity allowed (including '1') + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Tokens sent successfully. Returns transaction IDs for tracking and monitoring. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SendTokensAsync(Body7 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/wallets/send" + urlBuilder_.Append("v1/wallets/send"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when token parameters are malformed, insufficient balance, invalid contract data, or unsupported token type.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, contract execution errors, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List Contracts + /// + /// + /// Retrieves a list of all smart contracts imported by the authenticated client on the thirdweb dashboard. This endpoint provides access to contracts that have been added to your dashboard for management and interaction. Results include contract metadata, deployment information, and import timestamps. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ ///
**Note**: For detailed contract metadata including compilation information, ABI, and source code, use the dedicated metadata endpoint: `GET /v1/contracts/{chainId}/{address}/metadata`. + ///
+ /// The number of contracts to return (default: 20, max: 100). + /// The page number for pagination (default: 1). + /// Successfully retrieved list of contracts + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ListContractsAsync(int? limit, int? page) + { + return ListContractsAsync(limit, page, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List Contracts + /// + /// + /// Retrieves a list of all smart contracts imported by the authenticated client on the thirdweb dashboard. This endpoint provides access to contracts that have been added to your dashboard for management and interaction. Results include contract metadata, deployment information, and import timestamps. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ ///
**Note**: For detailed contract metadata including compilation information, ABI, and source code, use the dedicated metadata endpoint: `GET /v1/contracts/{chainId}/{address}/metadata`. + ///
+ /// The number of contracts to return (default: 20, max: 100). + /// The page number for pagination (default: 1). + /// Successfully retrieved list of contracts + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ListContractsAsync(int? limit, int? page, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts" + urlBuilder_.Append("v1/contracts"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-secret-key` header for backend authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 429) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Rate limit exceeded", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Deploy Contract + /// + /// + /// Deploy a new smart contract to a blockchain network using raw bytecode. This endpoint allows you to deploy contracts by providing the contract bytecode, ABI, constructor parameters, and optional salt for deterministic deployment. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Contract deployed successfully + /// A server side error occurred. + public virtual System.Threading.Tasks.Task DeployContractAsync(Body8 body) + { + return DeployContractAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Deploy Contract + /// + /// + /// Deploy a new smart contract to a blockchain network using raw bytecode. This endpoint allows you to deploy contracts by providing the contract bytecode, ABI, constructor parameters, and optional salt for deterministic deployment. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ /// Contract deployed successfully + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task DeployContractAsync(Body8 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts" + urlBuilder_.Append("v1/contracts"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-secret-key` header for backend authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 429) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Rate limit exceeded", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Read Contract + /// + /// + /// Executes multiple read-only contract method calls in a single batch request. This endpoint allows efficient batch reading from multiple contracts on the same chain, significantly reducing the number of HTTP requests needed. Each call specifies the contract address, method signature, and optional parameters. Results are returned in the same order as the input calls, with individual success/failure status for each operation. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Contract read operations completed successfully. Returns an array of results corresponding to each input call, including both successful and failed operations. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ReadContractAsync(Body9 body) + { + return ReadContractAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Read Contract + /// + /// + /// Executes multiple read-only contract method calls in a single batch request. This endpoint allows efficient batch reading from multiple contracts on the same chain, significantly reducing the number of HTTP requests needed. Each call specifies the contract address, method signature, and optional parameters. Results are returned in the same order as the input calls, with individual success/failure status for each operation. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Contract read operations completed successfully. Returns an array of results corresponding to each input call, including both successful and failed operations. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ReadContractAsync(Body9 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts/read" + urlBuilder_.Append("v1/contracts/read"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the chainId is not supported, contract addresses are invalid, function signatures are malformed, or the calls array is empty.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to engine connectivity issues, RPC node unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Write Contract + /// + /// + /// Executes write operations (transactions) on smart contracts. This is a convenience endpoint that simplifies contract interaction by accepting method signatures and parameters directly, without requiring manual transaction encoding. All calls are executed against the same contract address and chain, making it ideal for batch operations. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Contract write operations submitted successfully. Returns transaction IDs for tracking and monitoring. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task WriteContractAsync(Body10 body) + { + return WriteContractAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Write Contract + /// + /// + /// Executes write operations (transactions) on smart contracts. This is a convenience endpoint that simplifies contract interaction by accepting method signatures and parameters directly, without requiring manual transaction encoding. All calls are executed against the same contract address and chain, making it ideal for batch operations. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Contract write operations submitted successfully. Returns transaction IDs for tracking and monitoring. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task WriteContractAsync(Body10 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts/write" + urlBuilder_.Append("v1/contracts/write"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when contract parameters are malformed, method signatures are invalid, insufficient balance, or unsupported contract methods.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Contract not found. The specified contract address does not exist on the given blockchain network or is not accessible.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, contract execution errors, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Transactions + /// + /// + /// Retrieves transactions for a specific smart contract address on a specific blockchain network. This endpoint provides comprehensive transaction data including block information, gas details, transaction status, and function calls. Results can be filtered, paginated, and sorted to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Filter by transaction sender address + /// Filter by transaction recipient address + /// Filter by block timestamp (Unix timestamp) greater than or equal to this value + /// Filter by block timestamp (Unix timestamp) less than or equal to this value + /// Filter by block number greater than or equal to this value + /// Filter by block number less than or equal to this value + /// Filter by transaction value (in wei) greater than this value + /// Filter by function selector (4-byte method ID), e.g., '0xa9059cbb' for ERC-20 transfer + /// Current page number + /// Number of items per page + /// Sort order: 'asc' for ascending, 'desc' for descending + /// Contract transactions retrieved successfully. Returns transaction data with metadata including pagination information. Includes decoded function calls when ABI is available. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetContractTransactionsAsync(int chainId, string address, string filterFromAddress, string filterToAddress, int? filterBlockTimestampGte, int? filterBlockTimestampLte, int? filterBlockNumberGte, int? filterBlockNumberLte, string filterValueGt, string filterFunctionSelector, double? page, double? limit, SortOrder2? sortOrder) + { + return GetContractTransactionsAsync(chainId, address, filterFromAddress, filterToAddress, filterBlockTimestampGte, filterBlockTimestampLte, filterBlockNumberGte, filterBlockNumberLte, filterValueGt, filterFunctionSelector, page, limit, sortOrder, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Transactions + /// + /// + /// Retrieves transactions for a specific smart contract address on a specific blockchain network. This endpoint provides comprehensive transaction data including block information, gas details, transaction status, and function calls. Results can be filtered, paginated, and sorted to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Filter by transaction sender address + /// Filter by transaction recipient address + /// Filter by block timestamp (Unix timestamp) greater than or equal to this value + /// Filter by block timestamp (Unix timestamp) less than or equal to this value + /// Filter by block number greater than or equal to this value + /// Filter by block number less than or equal to this value + /// Filter by transaction value (in wei) greater than this value + /// Filter by function selector (4-byte method ID), e.g., '0xa9059cbb' for ERC-20 transfer + /// Current page number + /// Number of items per page + /// Sort order: 'asc' for ascending, 'desc' for descending + /// Contract transactions retrieved successfully. Returns transaction data with metadata including pagination information. Includes decoded function calls when ABI is available. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetContractTransactionsAsync(int chainId, string address, string filterFromAddress, string filterToAddress, int? filterBlockTimestampGte, int? filterBlockTimestampLte, int? filterBlockNumberGte, int? filterBlockNumberLte, string filterValueGt, string filterFunctionSelector, double? page, double? limit, SortOrder2? sortOrder, System.Threading.CancellationToken cancellationToken) + { + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + if (address == null) + throw new System.ArgumentNullException("address"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts/{chainId}/{address}/transactions" + urlBuilder_.Append("v1/contracts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(chainId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('/'); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/transactions"); + urlBuilder_.Append('?'); + if (filterFromAddress != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterFromAddress")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterFromAddress, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterToAddress != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterToAddress")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterToAddress, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockTimestampGte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockTimestampGte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockTimestampGte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockTimestampLte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockTimestampLte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockTimestampLte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockNumberGte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockNumberGte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockNumberGte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockNumberLte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockNumberLte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockNumberLte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterValueGt != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterValueGt")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterValueGt, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterFunctionSelector != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterFunctionSelector")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterFunctionSelector, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (sortOrder != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sortOrder")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sortOrder, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the contract address or chainId format is invalid, or pagination parameters are out of range.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Contract not found or no transactions available for the specified contract address on the given blockchain network.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Events + /// + /// + /// Retrieves events emitted by a specific smart contract address on a specific blockchain network. This endpoint provides comprehensive event data including block information, transaction details, event topics, and optional ABI decoding. Results can be filtered, paginated, and sorted to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Filter by event signature hash, e.g., '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' for Transfer event + /// Filter by event topic 0 (event signature hash) + /// Filter by event topic 1 + /// Filter by event topic 2 + /// Filter by event topic 3 + /// Filter by block timestamp (Unix timestamp) greater than or equal to this value + /// Filter by block timestamp (Unix timestamp) less than or equal to this value + /// Filter by block number greater than or equal to this value + /// Filter by block number less than or equal to this value + /// Current page number + /// Number of items per page + /// Sort order: 'asc' for ascending, 'desc' for descending + /// Contract events retrieved successfully. Returns event data with metadata including pagination information. Includes decoded event parameters when ABI is available. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetContractEventsAsync(int chainId, string address, string signature, string filterTopic0, string filterTopic1, string filterTopic2, string filterTopic3, int? filterBlockTimestampGte, int? filterBlockTimestampLte, int? filterBlockNumberGte, int? filterBlockNumberLte, double? page, double? limit, SortOrder3? sortOrder) + { + return GetContractEventsAsync(chainId, address, signature, filterTopic0, filterTopic1, filterTopic2, filterTopic3, filterBlockTimestampGte, filterBlockTimestampLte, filterBlockNumberGte, filterBlockNumberLte, page, limit, sortOrder, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Events + /// + /// + /// Retrieves events emitted by a specific smart contract address on a specific blockchain network. This endpoint provides comprehensive event data including block information, transaction details, event topics, and optional ABI decoding. Results can be filtered, paginated, and sorted to meet specific requirements. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Filter by event signature hash, e.g., '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' for Transfer event + /// Filter by event topic 0 (event signature hash) + /// Filter by event topic 1 + /// Filter by event topic 2 + /// Filter by event topic 3 + /// Filter by block timestamp (Unix timestamp) greater than or equal to this value + /// Filter by block timestamp (Unix timestamp) less than or equal to this value + /// Filter by block number greater than or equal to this value + /// Filter by block number less than or equal to this value + /// Current page number + /// Number of items per page + /// Sort order: 'asc' for ascending, 'desc' for descending + /// Contract events retrieved successfully. Returns event data with metadata including pagination information. Includes decoded event parameters when ABI is available. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetContractEventsAsync(int chainId, string address, string signature, string filterTopic0, string filterTopic1, string filterTopic2, string filterTopic3, int? filterBlockTimestampGte, int? filterBlockTimestampLte, int? filterBlockNumberGte, int? filterBlockNumberLte, double? page, double? limit, SortOrder3? sortOrder, System.Threading.CancellationToken cancellationToken) + { + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + if (address == null) + throw new System.ArgumentNullException("address"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts/{chainId}/{address}/events" + urlBuilder_.Append("v1/contracts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(chainId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('/'); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/events"); + urlBuilder_.Append('?'); + if (signature != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("signature")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(signature, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterTopic0 != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterTopic0")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterTopic0, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterTopic1 != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterTopic1")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterTopic1, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterTopic2 != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterTopic2")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterTopic2, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterTopic3 != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterTopic3")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterTopic3, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockTimestampGte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockTimestampGte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockTimestampGte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockTimestampLte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockTimestampLte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockTimestampLte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockNumberGte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockNumberGte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockNumberGte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (filterBlockNumberLte != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filterBlockNumberLte")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(filterBlockNumberLte, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (sortOrder != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sortOrder")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sortOrder, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the contract address or chainId format is invalid, or pagination parameters are out of range.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Contract not found or no events available for the specified contract address on the given blockchain network.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Metadata + /// + /// + /// Retrieves detailed metadata for a specific smart contract from the thirdweb contract metadata service. This includes compilation information, ABI, documentation, and other contract-related metadata. Note: Source code is excluded from the response to keep it lightweight and suitable for programmatic access. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ ///
**Metadata Source**: The metadata is fetched from the thirdweb contract metadata service and includes detailed Solidity compilation information, contract ABI, and developer documentation. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Successfully retrieved contract metadata + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetContractMetadataAsync(int chainId, string address) + { + return GetContractMetadataAsync(chainId, address, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Metadata + /// + /// + /// Retrieves detailed metadata for a specific smart contract from the thirdweb contract metadata service. This includes compilation information, ABI, documentation, and other contract-related metadata. Note: Source code is excluded from the response to keep it lightweight and suitable for programmatic access. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ ///
**Metadata Source**: The metadata is fetched from the thirdweb contract metadata service and includes detailed Solidity compilation information, contract ABI, and developer documentation. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Successfully retrieved contract metadata + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetContractMetadataAsync(int chainId, string address, System.Threading.CancellationToken cancellationToken) + { + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + if (address == null) + throw new System.ArgumentNullException("address"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts/{chainId}/{address}/metadata" + urlBuilder_.Append("v1/contracts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(chainId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('/'); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/metadata"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-secret-key` header for backend authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Contract metadata not found", status_, responseText_, headers_, null); + } + else + if (status_ == 429) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Rate limit exceeded", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Signatures + /// + /// + /// Retrieves human-readable ABI signatures for a specific smart contract. This endpoint fetches the contract metadata from the thirdweb service, extracts the ABI, and converts it into an array of human-readable function and event signatures that can be used directly with contract interaction methods. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ ///
**Usage**: The returned signatures can be used directly in contract read/write operations or event filtering. Each signature follows the standard Solidity format and includes function parameters, return types, state mutability, and event indexing information. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Successfully retrieved contract signatures + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetContractSignaturesAsync(int chainId, string address) + { + return GetContractSignaturesAsync(chainId, address, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Signatures + /// + /// + /// Retrieves human-readable ABI signatures for a specific smart contract. This endpoint fetches the contract metadata from the thirdweb service, extracts the ABI, and converts it into an array of human-readable function and event signatures that can be used directly with contract interaction methods. + ///
+ ///
**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + ///
+ ///
**Usage**: The returned signatures can be used directly in contract read/write operations or event filtering. Each signature follows the standard Solidity format and includes function parameters, return types, state mutability, and event indexing information. + ///
+ /// The blockchain network identifier where the contract is deployed. + /// The smart contract address or ENS name. + /// Successfully retrieved contract signatures + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetContractSignaturesAsync(int chainId, string address, System.Threading.CancellationToken cancellationToken) + { + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + if (address == null) + throw new System.ArgumentNullException("address"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/contracts/{chainId}/{address}/signatures" + urlBuilder_.Append("v1/contracts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(chainId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('/'); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/signatures"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-secret-key` header for backend authentication.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Contract metadata not found or ABI is not available", status_, responseText_, headers_, null); + } + else + if (status_ == 429) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Rate limit exceeded", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Transaction + /// + /// + /// Retrieves detailed information about a specific transaction using its unique identifier. Returns comprehensive transaction data including execution status, blockchain details, and any associated metadata. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Unique identifier of the transaction to retrieve. + /// Transaction details retrieved successfully. Returns comprehensive transaction information including status, blockchain details, and execution metadata. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetTransactionByIdAsync(string transactionId) + { + return GetTransactionByIdAsync(transactionId, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Transaction + /// + /// + /// Retrieves detailed information about a specific transaction using its unique identifier. Returns comprehensive transaction data including execution status, blockchain details, and any associated metadata. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Unique identifier of the transaction to retrieve. + /// Transaction details retrieved successfully. Returns comprehensive transaction information including status, blockchain details, and execution metadata. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetTransactionByIdAsync(string transactionId, System.Threading.CancellationToken cancellationToken) + { + if (transactionId == null) + throw new System.ArgumentNullException("transactionId"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/transactions/{transactionId}" + urlBuilder_.Append("v1/transactions/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(transactionId, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when the transaction ID format is invalid or malformed.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Transaction not found. The specified transaction ID does not exist or is not associated with the authenticated client.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to engine connectivity issues, database unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List Transactions + /// + /// + /// Retrieves a paginated list of transactions associated with the authenticated client. Results are sorted by creation date in descending order (most recent first). Supports filtering by wallet address and pagination controls. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Filter transactions by sender wallet address or ENS name. + /// Number of transactions to return per page (1-100). + /// Page number for pagination, starting from 1. + /// Transactions retrieved successfully. Returns a paginated list of transactions with metadata including creation and confirmation timestamps. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ListTransactionsAsync(string from, int? limit, int? page) + { + return ListTransactionsAsync(from, limit, page, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List Transactions + /// + /// + /// Retrieves a paginated list of transactions associated with the authenticated client. Results are sorted by creation date in descending order (most recent first). Supports filtering by wallet address and pagination controls. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Filter transactions by sender wallet address or ENS name. + /// Number of transactions to return per page (1-100). + /// Page number for pagination, starting from 1. + /// Transactions retrieved successfully. Returns a paginated list of transactions with metadata including creation and confirmation timestamps. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ListTransactionsAsync(string from, int? limit, int? page, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/transactions" + urlBuilder_.Append("v1/transactions"); + urlBuilder_.Append('?'); + if (from != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("from")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(from, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when pagination parameters are out of range or wallet address format is invalid.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to engine connectivity issues, database unavailability, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Send Transactions + /// + /// + /// Submits pre-encoded blockchain transactions with custom data payloads. This endpoint is for low-level transaction submission where you have already encoded the transaction data. For smart contract method calls, use /v1/contracts/write. For native token transfers, use /v1/wallets/send. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Encoded transactions submitted successfully. Returns the transaction IDs for tracking and monitoring. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SendTransactionsAsync(Body11 body) + { + return SendTransactionsAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Send Transactions + /// + /// + /// Submits pre-encoded blockchain transactions with custom data payloads. This endpoint is for low-level transaction submission where you have already encoded the transaction data. For smart contract method calls, use /v1/contracts/write. For native token transfers, use /v1/wallets/send. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Encoded transactions submitted successfully. Returns the transaction IDs for tracking and monitoring. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SendTransactionsAsync(Body11 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/transactions" + urlBuilder_.Append("v1/transactions"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters. This occurs when transaction data is malformed, insufficient balance, or invalid encoded data.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, or unexpected server errors.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Swap Tokens + /// + /// + /// Swap one token for another using the optimal route available. You can specify a tokenIn amount (if exact='input') or tokenOut amount (if exact='output'), but not both. The corresponding output or input amount will be returned as the quote. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Swap completed successfully. Returns the transaction used for the swap. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PaymentsSwapAsync(Body12 body) + { + return PaymentsSwapAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Swap Tokens + /// + /// + /// Swap one token for another using the optimal route available. You can specify a tokenIn amount (if exact='input') or tokenOut amount (if exact='output'), but not both. The corresponding output or input amount will be returned as the quote. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Swap completed successfully. Returns the transaction used for the swap. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PaymentsSwapAsync(Body12 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/payments/swap" + urlBuilder_.Append("v1/payments/swap"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 402) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Payment required. Insufficient wallet balance to complete the purchase.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create Payment + /// + /// + /// Create a payment to be executed. Users can complete the payment via hosted UI (link is returned), a transaction execution referencing the product ID, or embedded widgets with the product ID. + ///
+ ///
**Authentication**: This endpoint requires project authentication. + ///
+ /// Payment created successfully. Returns the ID and link to complete the payment. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task CreatePaymentAsync(Body13 body) + { + return CreatePaymentAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create Payment + /// + /// + /// Create a payment to be executed. Users can complete the payment via hosted UI (link is returned), a transaction execution referencing the product ID, or embedded widgets with the product ID. + ///
+ ///
**Authentication**: This endpoint requires project authentication. + ///
+ /// Payment created successfully. Returns the ID and link to complete the payment. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CreatePaymentAsync(Body13 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/payments" + urlBuilder_.Append("v1/payments"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 402) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Payment required. Insufficient wallet balance to complete the purchase.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Complete Payment + /// + /// + /// Completes a payment using its default token and amount. If the user does not have sufficient funds in the product's default payment token a 402 status will be returned containing a link and raw quote for purchase fulfillment. + ///
+ ///
**Authentication**: This endpoint requires project authentication. + ///
+ /// Product purchased successfully. Returns the transaction used for the purchase. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PaymentsPurchaseAsync(string id, Body14 body) + { + return PaymentsPurchaseAsync(id, body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Complete Payment + /// + /// + /// Completes a payment using its default token and amount. If the user does not have sufficient funds in the product's default payment token a 402 status will be returned containing a link and raw quote for purchase fulfillment. + ///
+ ///
**Authentication**: This endpoint requires project authentication. + ///
+ /// Product purchased successfully. Returns the transaction used for the purchase. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PaymentsPurchaseAsync(string id, Body14 body, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/payments/{id}" + urlBuilder_.Append("v1/payments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 402) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Payment required. Insufficient wallet balance to complete the purchase.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create Token + /// + /// + /// Create a new ERC20 token with the provided metadata and starting price. The token is immediately available for purchase using thirdweb Payments. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Token deployed successfully. The chain ID and contract address are returned. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task CreateTokenAsync(Body15 body) + { + return CreateTokenAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create Token + /// + /// + /// Create a new ERC20 token with the provided metadata and starting price. The token is immediately available for purchase using thirdweb Payments. + ///
+ ///
**Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer <jwt>` headers. + ///
+ /// Token deployed successfully. The chain ID and contract address are returned. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CreateTokenAsync(Body15 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/tokens" + urlBuilder_.Append("v1/tokens"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 402) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Payment required. Insufficient wallet balance to deploy the contract.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List Tokens + /// + /// + /// Lists or search existing tokens based on the provided filters. Supports querying by chain ID, token address, symbol, and/or name. + ///
+ ///
+ ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Number of tokens to return per page (1-100). + /// Page number for pagination, starting from 1. + /// Limit tokens to a specific chain. + /// Get a specific token by contract address + /// Limit tokens to a specific symbol. + /// Limit tokens to a specific name. + /// Tokens returned successfully. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ListTokensAsync(int? limit, int? page, int? chainId, string tokenAddress, string symbol, string name) + { + return ListTokensAsync(limit, page, chainId, tokenAddress, symbol, name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List Tokens + /// + /// + /// Lists or search existing tokens based on the provided filters. Supports querying by chain ID, token address, symbol, and/or name. + ///
+ ///
+ ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// Number of tokens to return per page (1-100). + /// Page number for pagination, starting from 1. + /// Limit tokens to a specific chain. + /// Get a specific token by contract address + /// Limit tokens to a specific symbol. + /// Limit tokens to a specific name. + /// Tokens returned successfully. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ListTokensAsync(int? limit, int? page, int? chainId, string tokenAddress, string symbol, string name, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/tokens" + urlBuilder_.Append("v1/tokens"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (chainId != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("chainId")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(chainId, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (tokenAddress != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tokenAddress")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(tokenAddress, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (symbol != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("symbol")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(symbol, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (name != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("name")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get Owners + /// + /// + /// Retrieves a paginated list of owners for a given ERC-20 token contract on a specific chain. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Number of owners to return per page (1-100). + /// Page number for pagination, starting from 1. + /// Token owners retrieved successfully. Returns owners with pagination information. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetTokenOwnersAsync(int chainId, string address, int? limit, int? page) + { + return GetTokenOwnersAsync(chainId, address, limit, page, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get Owners + /// + /// + /// Retrieves a paginated list of owners for a given ERC-20 token contract on a specific chain. + ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// Number of owners to return per page (1-100). + /// Page number for pagination, starting from 1. + /// Token owners retrieved successfully. Returns owners with pagination information. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetTokenOwnersAsync(int chainId, string address, int? limit, int? page, System.Threading.CancellationToken cancellationToken) + { + if (chainId == null) + throw new System.ArgumentNullException("chainId"); + + if (address == null) + throw new System.ArgumentNullException("address"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "v1/tokens/{chainId}/{address}/owners" + urlBuilder_.Append("v1/tokens/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(chainId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('/'); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(address, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/owners"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Invalid request parameters.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage.", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Token not found or no owners available.", status_, responseText_, headers_, null); + } + else + if (status_ == 500) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("Internal server error.", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Chat + /// + /// + /// Thirdweb AI chat completion API (BETA). + ///
+ ///
Send natural language queries to interact with any EVM chain, read data, prepare transactions, swap tokens, deploy contracts, payments and more. + ///
+ ///
+ ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// AI assistant response or SSE stream when stream=true + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ChatAsync(Body16 body) + { + return ChatAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Chat + /// + /// + /// Thirdweb AI chat completion API (BETA). + ///
+ ///
Send natural language queries to interact with any EVM chain, read data, prepare transactions, swap tokens, deploy contracts, payments and more. + ///
+ ///
+ ///
+ ///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + ///
+ /// AI assistant response or SSE stream when stream=true + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ChatAsync(Body16 body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "ai/chat" + urlBuilder_.Append("ai/chat"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ThirdwebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// MCP Server + /// + /// + /// Model Context Protocol (MCP) server endpoint that exposes all thirdweb API endpoints as MCP tools. This allows LLMs and AI assistants to interact with the thirdweb API through the standardized MCP protocol. + ///
+ ///
Authentication via x-secret-key is required for all requests. + ///
+ /// MCP response + /// A server side error occurred. + public virtual System.Threading.Tasks.Task McpServerAsync(object body) + { + return McpServerAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// MCP Server + /// + /// + /// Model Context Protocol (MCP) server endpoint that exposes all thirdweb API endpoints as MCP tools. This allows LLMs and AI assistants to interact with the thirdweb API through the standardized MCP protocol. + ///
+ ///
Authentication via x-secret-key is required for all requests. + ///
+ /// MCP response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task McpServerAsync(object body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "mcp" + urlBuilder_.Append("mcp"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// llms.txt + /// + /// + /// The full openAPI reference for the thirdweb API in LLMs.txt format. Useful for AI assistants to understand the API and its capabilities. No authentication is required. + /// + /// LLMs.txt + /// A server side error occurred. + public virtual System.Threading.Tasks.Task LlmsTxtAsync() + { + return LlmsTxtAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// llms.txt + /// + /// + /// The full openAPI reference for the thirdweb API in LLMs.txt format. Useful for AI assistants to understand the API and its capabilities. No authentication is required. + /// + /// LLMs.txt + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task LlmsTxtAsync(System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "llms.txt" + urlBuilder_.Append("llms.txt"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + return result_; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ThirdwebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ThirdwebApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ThirdwebApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body + { + /// + /// Authentication method: SMS + /// + [Newtonsoft.Json.JsonProperty("method", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public BodyMethod Method { get; set; } + + /// + /// Phone number in E.164 format (e.g., +1234567890) + /// + [Newtonsoft.Json.JsonProperty("phone", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Phone { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body2 + { + /// + /// Authentication method: SMS + /// + [Newtonsoft.Json.JsonProperty("method", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public Body2Method Method { get; set; } + + /// + /// Phone number that received the code + /// + [Newtonsoft.Json.JsonProperty("phone", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Phone { get; set; } + + /// + /// Verification code received via SMS + /// + [Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Code { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request body for pre-generating a wallet + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body3 + { + [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public Body3Type Type { get; set; } + + [Newtonsoft.Json.JsonProperty("walletAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WalletAddress { get; set; } + + [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Email { get; set; } + + [Newtonsoft.Json.JsonProperty("phone", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Phone { get; set; } + + [Newtonsoft.Json.JsonProperty("userId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UserId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request body for creating a wallet + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body4 + { + /// + /// Unique identifier for wallet creation or retrieval. Can be user ID, email, or any unique string. The same identifier will always return the same wallet. + /// + [Newtonsoft.Json.JsonProperty("identifier", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public string Identifier { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Sort order: 'asc' for ascending, 'desc' for descending + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SortOrder + { + + [System.Runtime.Serialization.EnumMember(Value = @"asc")] + Asc = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"desc")] + Desc = 1, + + } + + /// + /// Request body for signing a message + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body5 + { + /// + /// The wallet address or ENS name that will sign the message. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + /// + /// The blockchain network identifier where the signing will occur. Common values include: 1 (Ethereum), 137 (Polygon), 56 (BSC). + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The message to be signed. Can be plain text or hexadecimal format (starting with 0x). The format is automatically detected. + /// + [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Message { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request body for signing typed data + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body6 + { + /// + /// The wallet address or ENS name that will sign the typed data. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + /// + /// The blockchain network identifier for EIP-712 domain separation. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// EIP-712 domain separator containing contract and chain information for signature verification. + /// + [Newtonsoft.Json.JsonProperty("domain", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Domain Domain { get; set; } = new Domain(); + + /// + /// The structured data to be signed, matching the defined types schema. + /// + [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.Dictionary Message { get; set; } = new System.Collections.Generic.Dictionary(); + + /// + /// The primary type name from the types object that defines the main structure being signed. + /// + [Newtonsoft.Json.JsonProperty("primaryType", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string PrimaryType { get; set; } + + /// + /// Type definitions for the structured data, following EIP-712 specifications. + /// + [Newtonsoft.Json.JsonProperty("types", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.Dictionary> Types { get; set; } = new System.Collections.Generic.Dictionary>(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request body for sending tokens to multiple recipients. Supports native tokens, ERC20, ERC721, and ERC1155 transfers based on the provided parameters. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body7 + { + /// + /// The wallet address or ENS name that will send the tokens. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + /// + /// The blockchain network identifier where the transfer will be executed. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// Array of recipients and quantities. Maximum 100 recipients per request. + /// + [Newtonsoft.Json.JsonProperty("recipients", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.MinLength(1)] + [System.ComponentModel.DataAnnotations.MaxLength(100)] + public System.Collections.Generic.List Recipients { get; set; } = new System.Collections.Generic.List(); + + /// + /// The token contract address. Omit for native token (ETH, MATIC, etc.) transfers. + /// + [Newtonsoft.Json.JsonProperty("tokenAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TokenAddress { get; set; } + + /// + /// The token ID for NFT transfers (ERC721/ERC1155). Required for NFT transfers. + /// + [Newtonsoft.Json.JsonProperty("tokenId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TokenId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Contract deployment specification for raw bytecode deployment. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body8 + { + /// + /// The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The wallet address or ENS name that will deploy the contract. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + /// + /// The contract bytecode as a hex string. + /// + [Newtonsoft.Json.JsonProperty("bytecode", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Bytecode { get; set; } + + /// + /// The contract ABI array. + /// + [Newtonsoft.Json.JsonProperty("abi", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Abi { get; set; } = new System.Collections.Generic.List(); + + /// + /// Object containing constructor parameters for the contract deployment (e.g., { param1: 'value1', param2: 123 }). + /// + [Newtonsoft.Json.JsonProperty("constructorParams", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.Dictionary ConstructorParams { get; set; } + + /// + /// Optional salt value for deterministic contract deployment. + /// + [Newtonsoft.Json.JsonProperty("salt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Salt { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body9 + { + /// + /// Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. + /// + [Newtonsoft.Json.JsonProperty("calls", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.MinLength(1)] + public System.Collections.Generic.List Calls { get; set; } = new System.Collections.Generic.List(); + + /// + /// The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body10 + { + /// + /// Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. + /// + [Newtonsoft.Json.JsonProperty("calls", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.MinLength(1)] + public System.Collections.Generic.List Calls { get; set; } = new System.Collections.Generic.List(); + + /// + /// The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The wallet address or ENS name that will send the transaction. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Sort order: 'asc' for ascending, 'desc' for descending + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SortOrder2 + { + + [System.Runtime.Serialization.EnumMember(Value = @"asc")] + Asc = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"desc")] + Desc = 1, + + } + + /// + /// Sort order: 'asc' for ascending, 'desc' for descending + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SortOrder3 + { + + [System.Runtime.Serialization.EnumMember(Value = @"asc")] + Asc = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"desc")] + Desc = 1, + + } + + /// + /// Request object containing an array of encoded blockchain transactions to execute. All transactions must use the same from address and chainId. For contract calls, use /v1/contracts/write. For native token transfers, use /v1/wallets/send. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body11 + { + /// + /// The blockchain network identifier where all transactions will be executed. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The wallet address or ENS name that will send the transaction. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + /// + /// Array of encoded blockchain transactions to execute. All transactions will use the same from address and chainId. + /// + [Newtonsoft.Json.JsonProperty("transactions", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.MinLength(1)] + public System.Collections.Generic.List Transactions { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request to swap tokens using the optimal route available. You can specify a tokenIn amount (if exact='input') or tokenOut amount (if exact='output'), but not both. The corresponding output or input amount will be returned as the quote. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body12 + { + /// + /// Whether to swap the exact input or output amount + /// + [Newtonsoft.Json.JsonProperty("exact", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public Body12Exact Exact { get; set; } = Thirdweb.Api.Body12Exact.Input; + + [Newtonsoft.Json.JsonProperty("tokenIn", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public TokenIn TokenIn { get; set; } = new TokenIn(); + + [Newtonsoft.Json.JsonProperty("tokenOut", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public TokenOut TokenOut { get; set; } = new TokenOut(); + + /// + /// The wallet address or ENS name that will execute the swap. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request to create a product to be purchased. Users can purchase the product via hosted UI (link is returned), a transaction execution referencing the product ID, or embedded widgets with the product ID. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body13 + { + /// + /// The name of the product + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// The description of the product + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + /// + /// The URL of the product image + /// + [Newtonsoft.Json.JsonProperty("imageUrl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ImageUrl { get; set; } + + /// + /// The token to purchase + /// + [Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Token Token { get; set; } = new Token(); + + /// + /// The wallet address or ENS name that will receive the payment for the product + /// + [Newtonsoft.Json.JsonProperty("recipient", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Recipient { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request to purchase a product. The system will automatically use your wallet balance to purchase the specified product. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body14 + { + /// + /// The wallet address or ENS name that will purchase the product. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Request schema for creating a new ERC20 token + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body15 + { + /// + /// The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// Token name + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.StringLength(100, MinimumLength = 1)] + public string Name { get; set; } + + /// + /// Token symbol + /// + [Newtonsoft.Json.JsonProperty("symbol", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.StringLength(20, MinimumLength = 1)] + public string Symbol { get; set; } + + /// + /// Token description + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.StringLength(500, MinimumLength = 1)] + public string Description { get; set; } + + /// + /// Token image URL + /// + [Newtonsoft.Json.JsonProperty("imageUrl", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.Uri ImageUrl { get; set; } + + /// + /// Wallet address or ENS that will deploy the token. + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string From { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Chat request + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body16 + { + /// + /// Natural language query for the AI assistant + /// + [Newtonsoft.Json.JsonProperty("messages", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + [System.ComponentModel.DataAnnotations.MinLength(1)] + public System.Collections.Generic.List Messages { get; set; } = new System.Collections.Generic.List(); + + [Newtonsoft.Json.JsonProperty("context", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Context Context { get; set; } = new Context(); + + /// + /// Enable server streaming of the AI response + /// + [Newtonsoft.Json.JsonProperty("stream", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Stream { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response + { + /// + /// Authentication method: SMS + /// + [Newtonsoft.Json.JsonProperty("method", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public ResponseMethod Method { get; set; } + + /// + /// Whether the SMS code was sent successfully + /// + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.Always)] + public bool Success { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Successful authentication response. Returns wallet address plus authentication tokens. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response2 + { + /// + /// Whether this is a newly created user/wallet + /// + [Newtonsoft.Json.JsonProperty("isNewUser", Required = Newtonsoft.Json.Required.Always)] + public bool IsNewUser { get; set; } + + /// + /// JWT authentication token for API access + /// + [Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Token { get; set; } + + /// + /// Type of authentication completed + /// + [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Type { get; set; } + + /// + /// The wallet address + /// + [Newtonsoft.Json.JsonProperty("walletAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string WalletAddress { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response3 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result Result { get; set; } = new Result(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response4 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result2 Result { get; set; } = new Result2(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response5 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result3 Result { get; set; } = new Result3(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response6 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result4 Result { get; set; } = new Result4(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response7 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result5 Result { get; set; } = new Result5(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response8 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Result { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response9 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result6 Result { get; set; } = new Result6(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response10 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result7 Result { get; set; } = new Result7(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response11 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result8 Result { get; set; } = new Result8(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response12 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result9 Result { get; set; } = new Result9(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response13 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result10 Result { get; set; } = new Result10(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response14 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result11 Result { get; set; } = new Result11(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response15 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result12 Result { get; set; } = new Result12(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response16 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result13 Result { get; set; } = new Result13(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response17 + { + /// + /// Array of results corresponding to each contract read call. Results are returned in the same order as the input calls. + /// + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Result { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response18 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result15 Result { get; set; } = new Result15(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response19 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result16 Result { get; set; } = new Result16(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response20 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result17 Result { get; set; } = new Result17(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Contract metadata from the thirdweb contract metadata service. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response21 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result18 Result { get; set; } = new Result18(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Contract ABI signatures in human-readable format. These signatures can be used directly with contract interaction methods. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response22 + { + /// + /// Array of human-readable ABI signatures including functions and events. Each signature is formatted as a string that can be used directly in contract read/write operations or event filtering. + /// + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Result { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response23 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result19 Result { get; set; } = new Result19(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response24 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result20 Result { get; set; } = new Result20(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response25 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result21 Result { get; set; } = new Result21(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Successful token swap response containing executed transaction IDs + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response26 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result22 Result { get; set; } = new Result22(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Successful product creation response containing the product ID and link to purchase the product + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response27 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result23 Result { get; set; } = new Result23(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response28 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result24 Result { get; set; } = new Result24(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response29 + { + /// + /// The chain the token was deployed on. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The address the token was deployed at + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response30 + { + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination Pagination { get; set; } = new Pagination(); + + [Newtonsoft.Json.JsonProperty("tokens", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Tokens { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response31 + { + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Result25 Result { get; set; } = new Result25(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Chat response + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response32 + { + /// + /// The AI assistant's response + /// + [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Message { get; set; } + + [Newtonsoft.Json.JsonProperty("actions", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Actions { get; set; } = new System.Collections.Generic.List(); + + [Newtonsoft.Json.JsonProperty("session_id", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Session_id { get; set; } + + [Newtonsoft.Json.JsonProperty("request_id", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Request_id { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum BodyMethod + { + + [System.Runtime.Serialization.EnumMember(Value = @"sms")] + Sms = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Body2Method + { + + [System.Runtime.Serialization.EnumMember(Value = @"sms")] + Sms = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Body3Type + { + + [System.Runtime.Serialization.EnumMember(Value = @"google")] + Google = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"apple")] + Apple = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"facebook")] + Facebook = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"discord")] + Discord = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"email")] + Email = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"phone")] + Phone = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"custom_auth_endpoint")] + Custom_auth_endpoint = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"custom_jwt")] + Custom_jwt = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"siwe")] + Siwe = 8, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Domain + { + /// + /// Chain ID as string for domain separation + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ChainId { get; set; } + + /// + /// The domain name (e.g., token name) + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + /// + /// Optional salt for additional entropy + /// + [Newtonsoft.Json.JsonProperty("salt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Salt { get; set; } + + /// + /// The contract address that will verify this signature + /// + [Newtonsoft.Json.JsonProperty("verifyingContract", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string VerifyingContract { get; set; } + + /// + /// Domain version for signature compatibility + /// + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Version { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Anonymous + { + /// + /// The field name + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// The Solidity type (e.g., 'address', 'uint256') + /// + [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Type { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Recipients + { + /// + /// The recipient wallet address or ENS name + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The amount to send. For native tokens and ERC20: amount in wei/smallest unit. For ERC721: should be '1'. For ERC1155: the number of tokens to transfer. + /// + [Newtonsoft.Json.JsonProperty("quantity", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Quantity { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Calls + { + /// + /// The smart contract address or ENS name. + /// + [Newtonsoft.Json.JsonProperty("contractAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ContractAddress { get; set; } + + /// + /// The contract function signature to call (e.g., 'function approve(address spender, uint256 amount)' or `function balanceOf(address)`). Must start with 'function' followed by the function name and parameters as defined in the contract ABI. + /// + [Newtonsoft.Json.JsonProperty("method", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.ComponentModel.DataAnnotations.RegularExpression(@"^function\s+\w+")] + public string Method { get; set; } + + /// + /// Array of parameters to pass to the contract method, in the correct order and format. + /// + [Newtonsoft.Json.JsonProperty("params", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.List Params { get; set; } + + /// + /// Amount of native token to send with the transaction in wei. Required for payable methods. + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class calls + { + /// + /// The smart contract address or ENS name. + /// + [Newtonsoft.Json.JsonProperty("contractAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ContractAddress { get; set; } + + /// + /// The contract function signature to call (e.g., 'function approve(address spender, uint256 amount)' or `function balanceOf(address)`). Must start with 'function' followed by the function name and parameters as defined in the contract ABI. + /// + [Newtonsoft.Json.JsonProperty("method", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.ComponentModel.DataAnnotations.RegularExpression(@"^function\s+\w+")] + public string Method { get; set; } + + /// + /// Array of parameters to pass to the contract method, in the correct order and format. + /// + [Newtonsoft.Json.JsonProperty("params", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.List Params { get; set; } + + /// + /// Amount of native token to send with the transaction in wei. Required for payable methods. + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// A blockchain transaction with pre-encoded data payload. For contract calls, use /v1/contracts/write. For native token transfers, use /v1/wallets/send. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Transactions + { + /// + /// Transaction data in hexadecimal format for contract interactions or custom payloads. + /// + [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Data { get; set; } + + /// + /// The target address or ENS name for the transaction. + /// + [Newtonsoft.Json.JsonProperty("to", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string To { get; set; } + + /// + /// Amount of native token to send in wei (smallest unit). Use '0' or omit for non-value transactions. + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Body12Exact + { + + [System.Runtime.Serialization.EnumMember(Value = @"input")] + Input = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"output")] + Output = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TokenIn + { + /// + /// The input token address to swap (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The blockchain network where the token is located + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The amount of the input token to swap in wei. + /// + [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Amount { get; set; } + + /// + /// The maximum amount of the input token to swap in wei. + /// + [Newtonsoft.Json.JsonProperty("maxAmount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MaxAmount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TokenOut + { + /// + /// The output token address to swap (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The blockchain network where the token is located + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The amount of the output token to receive in wei. + /// + [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Amount { get; set; } + + /// + /// The minimum amount of the output token to receive in wei. + /// + [Newtonsoft.Json.JsonProperty("minAmount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MinAmount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Token + { + /// + /// The token address to purchase (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The blockchain network where the token is located + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// The amount of the token to purchase in wei. + /// + [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Amount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Messages + { + [Newtonsoft.Json.JsonProperty("role", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public MessagesRole Role { get; set; } + + [Newtonsoft.Json.JsonProperty("content", Required = Newtonsoft.Json.Required.Always)] + public Content Content { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Context + { + /// + /// Optional wallet address that will execute transactions + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string From { get; set; } + + /// + /// Optional chain IDs for context + /// + [Newtonsoft.Json.JsonProperty("chain_ids", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.List Chain_ids { get; set; } + + /// + /// Optional session ID for conversation continuity. If not provided, a new session will be created + /// + [Newtonsoft.Json.JsonProperty("session_id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Session_id { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ResponseMethod + { + + [System.Runtime.Serialization.EnumMember(Value = @"sms")] + Sms = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result + { + /// + /// The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The date and time the wallet was created + /// + [Newtonsoft.Json.JsonProperty("createdAt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedAt { get; set; } + + /// + /// The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets + /// + [Newtonsoft.Json.JsonProperty("profiles", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Profiles { get; set; } = new System.Collections.Generic.List(); + + /// + /// The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + /// + [Newtonsoft.Json.JsonProperty("smartWalletAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SmartWalletAddress { get; set; } + + /// + /// The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + /// + [Newtonsoft.Json.JsonProperty("publicKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PublicKey { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result2 + { + /// + /// Pagination information + /// + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination2 Pagination { get; set; } = new Pagination2(); + + /// + /// Array of user wallets + /// + [Newtonsoft.Json.JsonProperty("wallets", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Wallets { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result3 + { + /// + /// The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The date and time the wallet was created + /// + [Newtonsoft.Json.JsonProperty("createdAt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedAt { get; set; } + + /// + /// The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets + /// + [Newtonsoft.Json.JsonProperty("profiles", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Profiles { get; set; } = new System.Collections.Generic.List(); + + /// + /// The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + /// + [Newtonsoft.Json.JsonProperty("smartWalletAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SmartWalletAddress { get; set; } + + /// + /// The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + /// + [Newtonsoft.Json.JsonProperty("publicKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PublicKey { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result4 + { + /// + /// Pagination information + /// + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination3 Pagination { get; set; } = new Pagination3(); + + /// + /// Array of server wallets + /// + [Newtonsoft.Json.JsonProperty("wallets", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Wallets { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result5 + { + /// + /// The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The date and time the wallet was created + /// + [Newtonsoft.Json.JsonProperty("createdAt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedAt { get; set; } + + /// + /// The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets + /// + [Newtonsoft.Json.JsonProperty("profiles", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Profiles { get; set; } = new System.Collections.Generic.List(); + + /// + /// The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + /// + [Newtonsoft.Json.JsonProperty("smartWalletAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SmartWalletAddress { get; set; } + + /// + /// The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + /// + [Newtonsoft.Json.JsonProperty("publicKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PublicKey { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class result + { + /// + /// The blockchain network ID + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + public double ChainId { get; set; } + + /// + /// Number of decimal places for the token + /// + [Newtonsoft.Json.JsonProperty("decimals", Required = Newtonsoft.Json.Required.Always)] + public double Decimals { get; set; } + + /// + /// Human-readable balance formatted with appropriate decimal places + /// + [Newtonsoft.Json.JsonProperty("displayValue", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string DisplayValue { get; set; } + + /// + /// The token name (e.g., 'Ether', 'USD Coin') + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// The token symbol (e.g., 'ETH', 'USDC') + /// + [Newtonsoft.Json.JsonProperty("symbol", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Symbol { get; set; } + + /// + /// The token contract address. Returns zero address (0x0...0) for native tokens. + /// + [Newtonsoft.Json.JsonProperty("tokenAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string TokenAddress { get; set; } + + /// + /// Raw balance value as string in smallest unit (wei for ETH, etc.) + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result6 + { + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination4 Pagination { get; set; } = new Pagination4(); + + /// + /// Array of wallet transactions. + /// + [Newtonsoft.Json.JsonProperty("transactions", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Transactions { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result7 + { + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination5 Pagination { get; set; } = new Pagination5(); + + /// + /// Array of wallet tokens. + /// + [Newtonsoft.Json.JsonProperty("tokens", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Tokens { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result8 + { + /// + /// Array of wallet NFTs. + /// + [Newtonsoft.Json.JsonProperty("nfts", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Nfts { get; set; } = new System.Collections.Generic.List(); + + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination6 Pagination { get; set; } = new Pagination6(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result9 + { + /// + /// The cryptographic signature in hexadecimal format. This can be used for verification and authentication purposes. + /// + [Newtonsoft.Json.JsonProperty("signature", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Signature { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result10 + { + /// + /// The cryptographic signature in hexadecimal format. This can be used for verification and authentication purposes. + /// + [Newtonsoft.Json.JsonProperty("signature", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Signature { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result11 + { + /// + /// Array of transaction IDs for the submitted transfers. One ID per recipient. + /// + [Newtonsoft.Json.JsonProperty("transactionIds", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List TransactionIds { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result12 + { + /// + /// Array of contracts imported by the client. + /// + [Newtonsoft.Json.JsonProperty("contracts", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Contracts { get; set; } = new System.Collections.Generic.List(); + + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination7 Pagination { get; set; } = new Pagination7(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result13 + { + /// + /// The deployed contract address. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The chain ID where the contract was deployed. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + public double ChainId { get; set; } + + /// + /// The unique identifier for the transaction that deployed the contract. Will not be returned if the contract was already deployed at the predicted address. + /// + [Newtonsoft.Json.JsonProperty("transactionId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TransactionId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result14 + { + /// + /// The result of the contract read operation. The type and format depend on the method's return value as defined in the contract ABI. + /// + [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object Data { get; set; } + + /// + /// Error message if the contract read operation failed. + /// + [Newtonsoft.Json.JsonProperty("error", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Error { get; set; } + + /// + /// Indicates whether the contract read operation was successful. + /// + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.Always)] + public bool Success { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result15 + { + /// + /// Array of unique identifiers for the submitted transactions. Use these to track transaction status. + /// + [Newtonsoft.Json.JsonProperty("transactionIds", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List TransactionIds { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result16 + { + /// + /// Array of contract transactions. + /// + [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Data { get; set; } = new System.Collections.Generic.List(); + + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination8 Pagination { get; set; } = new Pagination8(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result17 + { + /// + /// Array of contract events. + /// + [Newtonsoft.Json.JsonProperty("events", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Events { get; set; } = new System.Collections.Generic.List(); + + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination9 Pagination { get; set; } = new Pagination9(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result18 + { + /// + /// Compiler information including version. + /// + [Newtonsoft.Json.JsonProperty("compiler", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Compiler Compiler { get; set; } + + /// + /// Programming language of the contract (e.g., 'Solidity'). + /// + [Newtonsoft.Json.JsonProperty("language", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Language { get; set; } + + /// + /// Compilation output including ABI and documentation. + /// + [Newtonsoft.Json.JsonProperty("output", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Output Output { get; set; } + + /// + /// Compilation settings including optimization and target configuration. + /// + [Newtonsoft.Json.JsonProperty("settings", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Settings Settings { get; set; } + + /// + /// Metadata format version. + /// + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Version { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result19 + { + /// + /// Index within transaction batch + /// + [Newtonsoft.Json.JsonProperty("batchIndex", Required = Newtonsoft.Json.Required.Always)] + public int BatchIndex { get; set; } + + /// + /// ISO timestamp when transaction was cancelled, if applicable + /// + [Newtonsoft.Json.JsonProperty("cancelledAt", Required = Newtonsoft.Json.Required.AllowNull)] + public string CancelledAt { get; set; } + + /// + /// Blockchain network identifier as string + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ChainId { get; set; } + + /// + /// Client identifier that initiated the transaction + /// + [Newtonsoft.Json.JsonProperty("clientId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ClientId { get; set; } + + /// + /// ISO timestamp when transaction was confirmed on-chain + /// + [Newtonsoft.Json.JsonProperty("confirmedAt", Required = Newtonsoft.Json.Required.AllowNull)] + public string ConfirmedAt { get; set; } + + /// + /// Block number where transaction was confirmed + /// + [Newtonsoft.Json.JsonProperty("confirmedAtBlockNumber", Required = Newtonsoft.Json.Required.AllowNull)] + public string ConfirmedAtBlockNumber { get; set; } + + /// + /// ISO timestamp when transaction was created + /// + [Newtonsoft.Json.JsonProperty("createdAt", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string CreatedAt { get; set; } + + /// + /// Additional metadata and enriched transaction information + /// + [Newtonsoft.Json.JsonProperty("enrichedData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object EnrichedData { get; set; } + + /// + /// Error message if transaction failed + /// + [Newtonsoft.Json.JsonProperty("errorMessage", Required = Newtonsoft.Json.Required.AllowNull)] + public string ErrorMessage { get; set; } + + /// + /// Parameters used for transaction execution + /// + [Newtonsoft.Json.JsonProperty("executionParams", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object ExecutionParams { get; set; } + + /// + /// Result data from transaction execution + /// + [Newtonsoft.Json.JsonProperty("executionResult", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object ExecutionResult { get; set; } + + /// + /// Sender wallet address + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.AllowNull)] + public string From { get; set; } + + /// + /// Unique transaction identifier + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + /// + /// On-chain transaction hash once confirmed + /// + [Newtonsoft.Json.JsonProperty("transactionHash", Required = Newtonsoft.Json.Required.AllowNull)] + public string TransactionHash { get; set; } + + /// + /// Original transaction parameters and data + /// + [Newtonsoft.Json.JsonProperty("transactionParams", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object TransactionParams { get; set; } + + /// + /// Transaction status + /// + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.AllowNull)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public Result19Status? Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result20 + { + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination10 Pagination { get; set; } = new Pagination10(); + + [Newtonsoft.Json.JsonProperty("transactions", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Transactions { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result21 + { + /// + /// Array of unique identifiers for the submitted transactions. Use these to track transaction status. + /// + [Newtonsoft.Json.JsonProperty("transactionIds", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List TransactionIds { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result22 + { + /// + /// Payment transaction IDs that were executed + /// + [Newtonsoft.Json.JsonProperty("transactionIds", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List TransactionIds { get; set; } = new System.Collections.Generic.List(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result23 + { + /// + /// The product ID + /// + [Newtonsoft.Json.JsonProperty("productId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ProductId { get; set; } + + /// + /// The link to purchase the product + /// + [Newtonsoft.Json.JsonProperty("link", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Link { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result24 + { + /// + /// Transaction ID that was executed for your product purchase + /// + [Newtonsoft.Json.JsonProperty("transactionId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string TransactionId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Tokens + { + /// + /// The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] + public int ChainId { get; set; } + + /// + /// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + [Newtonsoft.Json.JsonProperty("decimals", Required = Newtonsoft.Json.Required.Always)] + public double Decimals { get; set; } + + [Newtonsoft.Json.JsonProperty("symbol", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Symbol { get; set; } + + [Newtonsoft.Json.JsonProperty("iconUri", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string IconUri { get; set; } + + /// + /// Token price in different FIAT currencies. + /// + [Newtonsoft.Json.JsonProperty("prices", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.Dictionary Prices { get; set; } = new System.Collections.Generic.Dictionary(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Result25 + { + /// + /// Array of token owners with amounts. + /// + [Newtonsoft.Json.JsonProperty("owners", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Owners { get; set; } = new System.Collections.Generic.List(); + + [Newtonsoft.Json.JsonProperty("pagination", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public Pagination11 Pagination { get; set; } = new Pagination11(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Initialize the agent + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Actions + { + [Newtonsoft.Json.JsonProperty("session_id", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Session_id { get; set; } + + [Newtonsoft.Json.JsonProperty("request_id", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Request_id { get; set; } + + [Newtonsoft.Json.JsonProperty("source", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Source { get; set; } = "model"; + + [Newtonsoft.Json.JsonProperty("tool_name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Tool_name { get; set; } + + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + [Newtonsoft.Json.JsonProperty("kwargs", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.Dictionary Kwargs { get; set; } + + [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public ActionsType Type { get; set; } + + [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.AllowNull)] + public object Data { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum MessagesRole + { + + [System.Runtime.Serialization.EnumMember(Value = @"user")] + User = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"assistant")] + Assistant = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"system")] + System = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Content + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Authentication provider details with type-based discrimination + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Profiles + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination2 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Wallets + { + /// + /// The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The date and time the wallet was created + /// + [Newtonsoft.Json.JsonProperty("createdAt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedAt { get; set; } + + /// + /// The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets + /// + [Newtonsoft.Json.JsonProperty("profiles", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Profiles { get; set; } = new System.Collections.Generic.List(); + + /// + /// The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + /// + [Newtonsoft.Json.JsonProperty("smartWalletAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SmartWalletAddress { get; set; } + + /// + /// The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + /// + [Newtonsoft.Json.JsonProperty("publicKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PublicKey { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Authentication provider details with type-based discrimination + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class profiles + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination3 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class wallets + { + /// + /// The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The date and time the wallet was created + /// + [Newtonsoft.Json.JsonProperty("createdAt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CreatedAt { get; set; } + + /// + /// The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets + /// + [Newtonsoft.Json.JsonProperty("profiles", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Profiles { get; set; } = new System.Collections.Generic.List(); + + /// + /// The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + /// + [Newtonsoft.Json.JsonProperty("smartWalletAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SmartWalletAddress { get; set; } + + /// + /// The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + /// + [Newtonsoft.Json.JsonProperty("publicKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PublicKey { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Authentication provider details with type-based discrimination + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Profiles2 + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination4 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class transactions + { + /// + /// The hash of the block containing this transaction. + /// + [Newtonsoft.Json.JsonProperty("blockHash", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string BlockHash { get; set; } + + /// + /// The block number containing this transaction. + /// + [Newtonsoft.Json.JsonProperty("blockNumber", Required = Newtonsoft.Json.Required.Always)] + public double BlockNumber { get; set; } + + /// + /// The timestamp of the block (Unix timestamp). + /// + [Newtonsoft.Json.JsonProperty("blockTimestamp", Required = Newtonsoft.Json.Required.Always)] + public double BlockTimestamp { get; set; } + + /// + /// The chain ID where the transaction occurred. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ChainId { get; set; } + + /// + /// Contract address created if this was a contract creation transaction. + /// + [Newtonsoft.Json.JsonProperty("contractAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ContractAddress { get; set; } + + /// + /// Total gas used by all transactions in this block up to and including this one. + /// + [Newtonsoft.Json.JsonProperty("cumulativeGasUsed", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double CumulativeGasUsed { get; set; } + + /// + /// The transaction input data. + /// + [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Data { get; set; } + + /// + /// Decoded transaction data (included when ABI is available). + /// + [Newtonsoft.Json.JsonProperty("decoded", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Decoded Decoded { get; set; } + + /// + /// The effective gas price paid (in wei as string). + /// + [Newtonsoft.Json.JsonProperty("effectiveGasPrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EffectiveGasPrice { get; set; } + + /// + /// The address that initiated the transaction. + /// + [Newtonsoft.Json.JsonProperty("fromAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FromAddress { get; set; } + + /// + /// The function selector (first 4 bytes of the transaction data). + /// + [Newtonsoft.Json.JsonProperty("functionSelector", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FunctionSelector { get; set; } + + /// + /// The gas limit for the transaction. + /// + [Newtonsoft.Json.JsonProperty("gas", Required = Newtonsoft.Json.Required.Always)] + public double Gas { get; set; } + + /// + /// The gas price used for the transaction (in wei as string). + /// + [Newtonsoft.Json.JsonProperty("gasPrice", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string GasPrice { get; set; } + + /// + /// The amount of gas used by the transaction. + /// + [Newtonsoft.Json.JsonProperty("gasUsed", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double GasUsed { get; set; } + + /// + /// The transaction hash. + /// + [Newtonsoft.Json.JsonProperty("hash", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Hash { get; set; } + + /// + /// Maximum fee per gas (EIP-1559). + /// + [Newtonsoft.Json.JsonProperty("maxFeePerGas", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MaxFeePerGas { get; set; } + + /// + /// Maximum priority fee per gas (EIP-1559). + /// + [Newtonsoft.Json.JsonProperty("maxPriorityFeePerGas", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MaxPriorityFeePerGas { get; set; } + + /// + /// The transaction nonce. + /// + [Newtonsoft.Json.JsonProperty("nonce", Required = Newtonsoft.Json.Required.Always)] + public double Nonce { get; set; } + + /// + /// The transaction status (1 for success, 0 for failure). + /// + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Always)] + public double Status { get; set; } + + /// + /// The address that received the transaction. + /// + [Newtonsoft.Json.JsonProperty("toAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ToAddress { get; set; } + + /// + /// The index of the transaction within the block. + /// + [Newtonsoft.Json.JsonProperty("transactionIndex", Required = Newtonsoft.Json.Required.Always)] + public double TransactionIndex { get; set; } + + /// + /// The transaction type (0=legacy, 1=EIP-2930, 2=EIP-1559). + /// + [Newtonsoft.Json.JsonProperty("transactionType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double TransactionType { get; set; } + + /// + /// The value transferred in the transaction (in wei as string). + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination5 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class tokens + { + /// + /// The token balance as a string + /// + [Newtonsoft.Json.JsonProperty("balance", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Balance { get; set; } + + /// + /// The chain ID of the token + /// + [Newtonsoft.Json.JsonProperty("chain_id", Required = Newtonsoft.Json.Required.Always)] + public double Chain_id { get; set; } + + /// + /// The number of decimal places + /// + [Newtonsoft.Json.JsonProperty("decimals", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Decimals { get; set; } + + /// + /// The token name + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + /// + /// Price data for the token + /// + [Newtonsoft.Json.JsonProperty("price_data", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Price_data Price_data { get; set; } + + /// + /// The token symbol + /// + [Newtonsoft.Json.JsonProperty("symbol", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Symbol { get; set; } + + /// + /// The contract address of the token + /// + [Newtonsoft.Json.JsonProperty("token_address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Token_address { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Nfts + { + /// + /// The animation URL of the NFT + /// + [Newtonsoft.Json.JsonProperty("animation_url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Animation_url { get; set; } + + /// + /// The attributes/traits of the NFT + /// + [Newtonsoft.Json.JsonProperty("attributes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.List Attributes { get; set; } + + /// + /// The chain ID of the NFT + /// + [Newtonsoft.Json.JsonProperty("chain_id", Required = Newtonsoft.Json.Required.Always)] + public double Chain_id { get; set; } + + /// + /// Collection information + /// + [Newtonsoft.Json.JsonProperty("collection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Collection Collection { get; set; } + + /// + /// The description of the NFT + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + /// + /// The external URL of the NFT + /// + [Newtonsoft.Json.JsonProperty("external_url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string External_url { get; set; } + + /// + /// The image URL of the NFT + /// + [Newtonsoft.Json.JsonProperty("image_url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Image_url { get; set; } + + /// + /// Additional metadata for the NFT + /// + [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.Dictionary Metadata { get; set; } + + /// + /// The name of the NFT + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + /// + /// The contract address of the NFT collection + /// + [Newtonsoft.Json.JsonProperty("token_address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Token_address { get; set; } + + /// + /// The token ID of the NFT + /// + [Newtonsoft.Json.JsonProperty("token_id", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Token_id { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination6 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Contract details enriched with additional project information from the API server. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Contracts + { + /// + /// The contract address. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The chain ID where the contract is deployed. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ChainId { get; set; } + + /// + /// The date when the contract was deployed. + /// + [Newtonsoft.Json.JsonProperty("deployedAt", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DeployedAt { get; set; } + + /// + /// The contract ID. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Id { get; set; } + + /// + /// The date when the contract was imported to the dashboard. + /// + [Newtonsoft.Json.JsonProperty("importedAt", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ImportedAt { get; set; } + + /// + /// The contract name, if available. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + /// + /// The contract symbol, if available. + /// + [Newtonsoft.Json.JsonProperty("symbol", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Symbol { get; set; } + + /// + /// The contract type (e.g., ERC20, ERC721, etc.). + /// + [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Type { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination7 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Data + { + /// + /// The hash of the block containing this transaction. + /// + [Newtonsoft.Json.JsonProperty("blockHash", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string BlockHash { get; set; } + + /// + /// The block number containing this transaction. + /// + [Newtonsoft.Json.JsonProperty("blockNumber", Required = Newtonsoft.Json.Required.Always)] + public double BlockNumber { get; set; } + + /// + /// The timestamp of the block (Unix timestamp). + /// + [Newtonsoft.Json.JsonProperty("blockTimestamp", Required = Newtonsoft.Json.Required.Always)] + public double BlockTimestamp { get; set; } + + /// + /// The chain ID where the transaction occurred. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ChainId { get; set; } + + /// + /// Contract address created if this was a contract creation transaction. + /// + [Newtonsoft.Json.JsonProperty("contractAddress", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ContractAddress { get; set; } + + /// + /// Total gas used by all transactions in this block up to and including this one. + /// + [Newtonsoft.Json.JsonProperty("cumulativeGasUsed", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double CumulativeGasUsed { get; set; } + + /// + /// The transaction input data. + /// + [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Data1 { get; set; } + + /// + /// Decoded transaction data (included when ABI is available). + /// + [Newtonsoft.Json.JsonProperty("decoded", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Decoded2 Decoded { get; set; } + + /// + /// The effective gas price paid (in wei as string). + /// + [Newtonsoft.Json.JsonProperty("effectiveGasPrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EffectiveGasPrice { get; set; } + + /// + /// The address that initiated the transaction. + /// + [Newtonsoft.Json.JsonProperty("fromAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FromAddress { get; set; } + + /// + /// The function selector (first 4 bytes of the transaction data). + /// + [Newtonsoft.Json.JsonProperty("functionSelector", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FunctionSelector { get; set; } + + /// + /// The gas limit for the transaction. + /// + [Newtonsoft.Json.JsonProperty("gas", Required = Newtonsoft.Json.Required.Always)] + public double Gas { get; set; } + + /// + /// The gas price used for the transaction (in wei as string). + /// + [Newtonsoft.Json.JsonProperty("gasPrice", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string GasPrice { get; set; } + + /// + /// The amount of gas used by the transaction. + /// + [Newtonsoft.Json.JsonProperty("gasUsed", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double GasUsed { get; set; } + + /// + /// The transaction hash. + /// + [Newtonsoft.Json.JsonProperty("hash", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Hash { get; set; } + + /// + /// Maximum fee per gas (EIP-1559). + /// + [Newtonsoft.Json.JsonProperty("maxFeePerGas", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MaxFeePerGas { get; set; } + + /// + /// Maximum priority fee per gas (EIP-1559). + /// + [Newtonsoft.Json.JsonProperty("maxPriorityFeePerGas", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MaxPriorityFeePerGas { get; set; } + + /// + /// The transaction nonce. + /// + [Newtonsoft.Json.JsonProperty("nonce", Required = Newtonsoft.Json.Required.Always)] + public double Nonce { get; set; } + + /// + /// The transaction status (1 for success, 0 for failure). + /// + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Always)] + public double Status { get; set; } + + /// + /// The address that received the transaction. + /// + [Newtonsoft.Json.JsonProperty("toAddress", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ToAddress { get; set; } + + /// + /// The index of the transaction within the block. + /// + [Newtonsoft.Json.JsonProperty("transactionIndex", Required = Newtonsoft.Json.Required.Always)] + public double TransactionIndex { get; set; } + + /// + /// The transaction type (0=legacy, 1=EIP-2930, 2=EIP-1559). + /// + [Newtonsoft.Json.JsonProperty("transactionType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double TransactionType { get; set; } + + /// + /// The value transferred in the transaction (in wei as string). + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination8 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Events + { + /// + /// The contract address that emitted the event. + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// The hash of the block containing this event. + /// + [Newtonsoft.Json.JsonProperty("blockHash", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string BlockHash { get; set; } + + /// + /// The block number where the event was emitted. + /// + [Newtonsoft.Json.JsonProperty("blockNumber", Required = Newtonsoft.Json.Required.Always)] + public double BlockNumber { get; set; } + + /// + /// The timestamp of the block (Unix timestamp). + /// + [Newtonsoft.Json.JsonProperty("blockTimestamp", Required = Newtonsoft.Json.Required.Always)] + public double BlockTimestamp { get; set; } + + /// + /// The chain ID where the event occurred. + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ChainId { get; set; } + + /// + /// The non-indexed event data as a hex string. + /// + [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Data { get; set; } + + /// + /// Decoded event data (included when ABI is available). + /// + [Newtonsoft.Json.JsonProperty("decoded", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Decoded3 Decoded { get; set; } + + /// + /// The index of the log within the transaction. + /// + [Newtonsoft.Json.JsonProperty("logIndex", Required = Newtonsoft.Json.Required.Always)] + public double LogIndex { get; set; } + + /// + /// Array of indexed event topics (including event signature). + /// + [Newtonsoft.Json.JsonProperty("topics", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.List Topics { get; set; } = new System.Collections.Generic.List(); + + /// + /// The hash of the transaction containing this event. + /// + [Newtonsoft.Json.JsonProperty("transactionHash", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string TransactionHash { get; set; } + + /// + /// The index of the transaction within the block. + /// + [Newtonsoft.Json.JsonProperty("transactionIndex", Required = Newtonsoft.Json.Required.Always)] + public double TransactionIndex { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination9 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Compiler + { + /// + /// Solidity compiler version used to compile the contract. + /// + [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Version { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Output + { + /// + /// Contract ABI (Application Binary Interface) as an array of function/event/error definitions. + /// + [Newtonsoft.Json.JsonProperty("abi", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.List Abi { get; set; } + + /// + /// Developer documentation extracted from contract comments. + /// + [Newtonsoft.Json.JsonProperty("devdoc", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.Dictionary Devdoc { get; set; } + + /// + /// User documentation extracted from contract comments. + /// + [Newtonsoft.Json.JsonProperty("userdoc", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.Dictionary Userdoc { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Settings + { + /// + /// Compilation target mapping source file names to contract names. + /// + [Newtonsoft.Json.JsonProperty("compilationTarget", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.Dictionary CompilationTarget { get; set; } + + /// + /// EVM version target for compilation. + /// + [Newtonsoft.Json.JsonProperty("evmVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EvmVersion { get; set; } + + /// + /// Library addresses for linking. + /// + [Newtonsoft.Json.JsonProperty("libraries", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.Dictionary Libraries { get; set; } + + /// + /// Metadata settings for compilation. + /// + [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Metadata Metadata { get; set; } + + /// + /// Optimizer settings used during compilation. + /// + [Newtonsoft.Json.JsonProperty("optimizer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Optimizer Optimizer { get; set; } + + /// + /// Import remappings used during compilation. + /// + [Newtonsoft.Json.JsonProperty("remappings", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.List Remappings { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Result19Status + { + + [System.Runtime.Serialization.EnumMember(Value = @"QUEUED")] + QUEUED = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"SUBMITTED")] + SUBMITTED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"CONFIRMED")] + CONFIRMED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination10 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Transactions2 + { + /// + /// Index within transaction batch + /// + [Newtonsoft.Json.JsonProperty("batchIndex", Required = Newtonsoft.Json.Required.Always)] + public int BatchIndex { get; set; } + + /// + /// ISO timestamp when transaction was cancelled, if applicable + /// + [Newtonsoft.Json.JsonProperty("cancelledAt", Required = Newtonsoft.Json.Required.AllowNull)] + public string CancelledAt { get; set; } + + /// + /// Blockchain network identifier as string + /// + [Newtonsoft.Json.JsonProperty("chainId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ChainId { get; set; } + + /// + /// Client identifier that initiated the transaction + /// + [Newtonsoft.Json.JsonProperty("clientId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ClientId { get; set; } + + /// + /// ISO timestamp when transaction was confirmed on-chain + /// + [Newtonsoft.Json.JsonProperty("confirmedAt", Required = Newtonsoft.Json.Required.AllowNull)] + public string ConfirmedAt { get; set; } + + /// + /// Block number where transaction was confirmed + /// + [Newtonsoft.Json.JsonProperty("confirmedAtBlockNumber", Required = Newtonsoft.Json.Required.AllowNull)] + public string ConfirmedAtBlockNumber { get; set; } + + /// + /// ISO timestamp when transaction was created + /// + [Newtonsoft.Json.JsonProperty("createdAt", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string CreatedAt { get; set; } + + /// + /// Additional metadata and enriched transaction information + /// + [Newtonsoft.Json.JsonProperty("enrichedData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object EnrichedData { get; set; } + + /// + /// Error message if transaction failed + /// + [Newtonsoft.Json.JsonProperty("errorMessage", Required = Newtonsoft.Json.Required.AllowNull)] + public string ErrorMessage { get; set; } + + /// + /// Parameters used for transaction execution + /// + [Newtonsoft.Json.JsonProperty("executionParams", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object ExecutionParams { get; set; } + + /// + /// Result data from transaction execution + /// + [Newtonsoft.Json.JsonProperty("executionResult", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object ExecutionResult { get; set; } + + /// + /// Sender wallet address + /// + [Newtonsoft.Json.JsonProperty("from", Required = Newtonsoft.Json.Required.AllowNull)] + public string From { get; set; } + + /// + /// Unique transaction identifier + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + /// + /// On-chain transaction hash once confirmed + /// + [Newtonsoft.Json.JsonProperty("transactionHash", Required = Newtonsoft.Json.Required.AllowNull)] + public string TransactionHash { get; set; } + + /// + /// Original transaction parameters and data + /// + [Newtonsoft.Json.JsonProperty("transactionParams", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object TransactionParams { get; set; } + + /// + /// Transaction status + /// + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.AllowNull)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public Transactions2Status? Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Owners + { + /// + /// Owner wallet address + /// + [Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Address { get; set; } + + /// + /// Token amount owned as a string + /// + [Newtonsoft.Json.JsonProperty("amount", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Amount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Pagination11 + { + /// + /// Whether there are more items available + /// + [Newtonsoft.Json.JsonProperty("hasMore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMore { get; set; } + + /// + /// Number of items per page + /// + [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Limit { get; set; } = 20D; + + /// + /// Current page number + /// + [Newtonsoft.Json.JsonProperty("page", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Page { get; set; } = 1D; + + /// + /// Total number of items available + /// + [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ActionsType + { + + [System.Runtime.Serialization.EnumMember(Value = @"init")] + Init = 0, + + } + + /// + /// Authentication provider details with type-based discrimination + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Profiles3 + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Authentication provider details with type-based discrimination + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Profiles4 + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Decoded + { + /// + /// Object containing decoded function parameters. + /// + [Newtonsoft.Json.JsonProperty("inputs", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.Dictionary Inputs { get; set; } = new System.Collections.Generic.Dictionary(); + + /// + /// The function name. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// The function signature. + /// + [Newtonsoft.Json.JsonProperty("signature", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Signature { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Price_data + { + /// + /// The circulating supply of the token + /// + [Newtonsoft.Json.JsonProperty("circulating_supply", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Circulating_supply { get; set; } + + /// + /// The market cap of the token in USD + /// + [Newtonsoft.Json.JsonProperty("market_cap_usd", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Market_cap_usd { get; set; } + + /// + /// The percentage change of the token in the last 24 hours + /// + [Newtonsoft.Json.JsonProperty("percent_change_24h", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Percent_change_24h { get; set; } + + /// + /// The timestamp of the latest price update + /// + [Newtonsoft.Json.JsonProperty("price_timestamp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Price_timestamp { get; set; } + + /// + /// The price of the token in USD + /// + [Newtonsoft.Json.JsonProperty("price_usd", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Price_usd { get; set; } + + /// + /// The total supply of the token + /// + [Newtonsoft.Json.JsonProperty("total_supply", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Total_supply { get; set; } + + /// + /// The volume of the token in USD + /// + [Newtonsoft.Json.JsonProperty("volume_24h_usd", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Volume_24h_usd { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Attributes + { + /// + /// The display type + /// + [Newtonsoft.Json.JsonProperty("display_type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Display_type { get; set; } + + /// + /// The trait type + /// + [Newtonsoft.Json.JsonProperty("trait_type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Trait_type { get; set; } + + /// + /// The trait value + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Value Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Collection + { + /// + /// The collection description + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + /// + /// The collection external URL + /// + [Newtonsoft.Json.JsonProperty("external_url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string External_url { get; set; } + + /// + /// The collection image URL + /// + [Newtonsoft.Json.JsonProperty("image", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Image { get; set; } + + /// + /// The collection name + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Decoded2 + { + /// + /// Object containing decoded function parameters. + /// + [Newtonsoft.Json.JsonProperty("inputs", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.Dictionary Inputs { get; set; } = new System.Collections.Generic.Dictionary(); + + /// + /// The function name. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// The function signature. + /// + [Newtonsoft.Json.JsonProperty("signature", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Signature { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Decoded3 + { + /// + /// The event name. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// Object containing decoded parameters. + /// + [Newtonsoft.Json.JsonProperty("params", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.Dictionary Params { get; set; } = new System.Collections.Generic.Dictionary(); + + /// + /// The event signature. + /// + [Newtonsoft.Json.JsonProperty("signature", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Signature { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Metadata + { + /// + /// Hash method used for bytecode metadata. + /// + [Newtonsoft.Json.JsonProperty("bytecodeHash", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string BytecodeHash { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Optimizer + { + /// + /// Whether optimizer is enabled. + /// + [Newtonsoft.Json.JsonProperty("enabled", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Enabled { get; set; } + + /// + /// Number of optimizer runs. + /// + [Newtonsoft.Json.JsonProperty("runs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double Runs { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Transactions2Status + { + + [System.Runtime.Serialization.EnumMember(Value = @"QUEUED")] + QUEUED = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"SUBMITTED")] + SUBMITTED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"CONFIRMED")] + CONFIRMED = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"FAILED")] + FAILED = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Value + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ThirdwebApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public ThirdwebApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ThirdwebApiException : ThirdwebApiException + { + public TResult Result { get; private set; } + + public ThirdwebApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 108 +#pragma warning restore 114 +#pragma warning restore 472 +#pragma warning restore 612 +#pragma warning restore 1573 +#pragma warning restore 1591 +#pragma warning restore 8073 +#pragma warning restore 3016 +#pragma warning restore 8600 +#pragma warning restore 8602 +#pragma warning restore 8603 +#pragma warning restore 8604 +#pragma warning restore 8625 \ No newline at end of file diff --git a/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs b/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs index 368bef60..9bfeb4da 100644 --- a/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs +++ b/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.Types.cs @@ -381,7 +381,7 @@ public enum StatusType NOT_FOUND, PROCESSING, CREATED, - UNKNOWN + UNKNOWN, } /// @@ -400,7 +400,7 @@ public class StatusData "PENDING" => StatusType.PENDING, "COMPLETED" => StatusType.COMPLETED, "NOT_FOUND" => StatusType.NOT_FOUND, - _ => StatusType.UNKNOWN + _ => StatusType.UNKNOWN, }; /// @@ -496,7 +496,7 @@ public enum OnrampProvider { Stripe, Coinbase, - Transak + Transak, } /// @@ -585,7 +585,7 @@ public class OnrampStatusData "COMPLETED" => StatusType.COMPLETED, "PROCESSING" => StatusType.PROCESSING, "CREATED" => StatusType.CREATED, - _ => StatusType.UNKNOWN + _ => StatusType.UNKNOWN, }; [JsonProperty("status")] diff --git a/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs b/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs index 733cbc61..00960be2 100644 --- a/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs +++ b/Thirdweb/Thirdweb.Bridge/ThirdwebBridge.cs @@ -73,7 +73,7 @@ public async Task Buy_Quote( { "destinationChainId", destinationChainId.ToString() }, { "destinationTokenAddress", destinationTokenAddress }, { "buyAmountWei", buyAmountWei.ToString() }, - { "maxSteps", maxSteps.ToString() } + { "maxSteps", maxSteps.ToString() }, }; url = AppendQueryParams(url, queryParams); @@ -150,7 +150,7 @@ public async Task Buy_Prepare( sender, receiver, maxSteps, - purchaseData + purchaseData, }; var url = $"{Constants.BRIDGE_API_URL}/v1/buy/prepare"; @@ -219,7 +219,7 @@ public async Task Sell_Quote( { "destinationChainId", destinationChainId.ToString() }, { "destinationTokenAddress", destinationTokenAddress }, { "sellAmountWei", sellAmountWei.ToString() }, - { "maxSteps", maxSteps.ToString() } + { "maxSteps", maxSteps.ToString() }, }; url = AppendQueryParams(url, queryParams); @@ -296,7 +296,7 @@ public async Task Sell_Prepare( sender, receiver, maxSteps, - purchaseData + purchaseData, }; var url = $"{Constants.BRIDGE_API_URL}/v1/sell/prepare"; @@ -372,7 +372,7 @@ public async Task Transfer_Prepare( sender, receiver, feePayer, - purchaseData + purchaseData, }; var url = $"{Constants.BRIDGE_API_URL}/v1/transfer/prepare"; @@ -439,7 +439,7 @@ public async Task Onramp_Prepare( currency, maxSteps, excludeChainIds = excludeChainIds != null && excludeChainIds.Count > 0 ? excludeChainIds.Select(id => id.ToString()).ToList() : null, - purchaseData + purchaseData, }; var url = $"{Constants.BRIDGE_API_URL}/v1/onramp/prepare"; diff --git a/Thirdweb/Thirdweb.Client/ThirdwebClient.cs b/Thirdweb/Thirdweb.Client/ThirdwebClient.cs index 094641c8..f3f3ac5c 100644 --- a/Thirdweb/Thirdweb.Client/ThirdwebClient.cs +++ b/Thirdweb/Thirdweb.Client/ThirdwebClient.cs @@ -1,4 +1,5 @@ using System.Numerics; +using Thirdweb.Api; [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Thirdweb.Tests")] @@ -19,6 +20,12 @@ public class ThirdwebClient /// public string ClientId { get; } + /// + /// Interactiton with https://api.thirdweb.com + /// Used in some places to enhance the core SDK functionality, or even extend it + /// + internal ThirdwebApiClient Api { get; } + internal string SecretKey { get; } internal string BundleId { get; } internal ITimeoutOptions FetchTimeoutOptions { get; } @@ -70,6 +77,17 @@ private ThirdwebClient( this.HttpClient.SetHeaders(defaultHeaders); this.RpcOverrides = rpcOverrides; + + // Initialize the API client + var apiHttpClient = new HttpClient { BaseAddress = new Uri("https://api.thirdweb.com") }; + + // Copy headers from ThirdwebClient to API client + foreach (var header in defaultHeaders) + { + _ = apiHttpClient.DefaultRequestHeaders.TryAddWithoutValidation(header.Key, header.Value); + } + + this.Api = new ThirdwebApiClient(apiHttpClient); } /// diff --git a/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs b/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs index 90bc8623..040934ac 100644 --- a/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs +++ b/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs @@ -28,6 +28,69 @@ private ThirdwebContract(ThirdwebClient client, string address, BigInteger chain this.Abi = abi; } + /// + /// Deploys a new contract on the specified chain. + /// + /// The Thirdweb client. + /// The chain ID. + /// The server wallet address. + /// The bytecode of the contract. + /// The ABI of the contract. + /// The constructor parameters (optional). + /// The salt for the contract deployment (optional). + /// The cancellation token. + /// The contract address of the fully deployed contract. + /// + /// This method deploys a new contract using a server wallet, create one via the ServerWallet class or api.thirdweb.com, or the dashboard. + /// + public static async Task Deploy( + ThirdwebClient client, + BigInteger chainId, + string serverWalletAddress, + string bytecode, + string abi, + Dictionary constructorParams = null, + string salt = null, + CancellationToken cancellationToken = default + ) + { + var response = await client + .Api.DeployContractAsync( + new Api.Body8() + { + ChainId = (int)chainId, + From = serverWalletAddress, + Bytecode = bytecode, + Abi = JsonConvert.DeserializeObject>(abi), + ConstructorParams = constructorParams, + Salt = salt, + }, + cancellationToken + ) + .ConfigureAwait(false); + + var contractAddress = response.Result.Address; + if (string.IsNullOrEmpty(contractAddress)) + { + throw new InvalidOperationException("Failed to deploy contract: Could not compute contract address."); + } + + var transactionId = response.Result.TransactionId; + if (string.IsNullOrEmpty(transactionId)) + { + throw new InvalidOperationException("Failed to deploy contract: Transaction ID is empty."); + } + + var hash = await ThirdwebTransaction.WaitForTransactionHash(client, transactionId, cancellationToken).ConfigureAwait(false); + if (string.IsNullOrEmpty(hash)) + { + throw new InvalidOperationException("Failed to deploy contract: Transaction hash is empty."); + } + + _ = await ThirdwebTransaction.WaitForTransactionReceipt(client, chainId, hash, cancellationToken).ConfigureAwait(false); + return contractAddress; + } + /// /// Creates a new instance of . /// diff --git a/Thirdweb/Thirdweb.Extensions/ThirdwebApiExtensions.cs b/Thirdweb/Thirdweb.Extensions/ThirdwebApiExtensions.cs new file mode 100644 index 00000000..e69de29b diff --git a/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.Types.cs b/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.Types.cs index 0fedf798..197cf08c 100644 --- a/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.Types.cs +++ b/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.Types.cs @@ -142,7 +142,7 @@ public class Forwarder_ForwardRequest public enum NFTType { ERC721, - ERC1155 + ERC1155, } /// diff --git a/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs b/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs index 4324e1f0..c706ef13 100644 --- a/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs +++ b/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs @@ -107,11 +107,9 @@ public static async Task GetMetadata(this ThirdwebContract con /// Thrown when the client is null. public static async Task GetNFTImageBytes(this NFT nft, ThirdwebClient client) { - return client == null - ? throw new ArgumentNullException(nameof(client)) - : string.IsNullOrEmpty(nft.Metadata.Image) - ? Array.Empty() - : await ThirdwebStorage.Download(client, nft.Metadata.Image).ConfigureAwait(false); + return client == null ? throw new ArgumentNullException(nameof(client)) + : string.IsNullOrEmpty(nft.Metadata.Image) ? Array.Empty() + : await ThirdwebStorage.Download(client, nft.Metadata.Image).ConfigureAwait(false); } /// @@ -1238,7 +1236,7 @@ public static async Task ERC721_GetNFT(this ThirdwebContract contract, BigI Owner = Constants.ADDRESS_ZERO, Type = NFTType.ERC721, Supply = 1, - QuantityOwned = 1 + QuantityOwned = 1, }; if (fillOwner) @@ -1272,7 +1270,7 @@ public static async Task ERC721_GetNFT(this ThirdwebContract contract, BigI return nft with { - Metadata = nftMetadata + Metadata = nftMetadata, }; } @@ -1594,7 +1592,7 @@ public static async Task DropERC20_Claim(this Thirdw activeClaimCondition.Currency, // currency activeClaimCondition.PricePerToken, // pricePerToken allowlistProof, // allowlistProof - Array.Empty() // data + Array.Empty(), // data }; return await ThirdwebContract.Write(wallet, contract, "claim", payableAmount, fnArgs); @@ -1732,7 +1730,7 @@ public static async Task DropERC721_Claim(this Third activeClaimCondition.Currency, // currency activeClaimCondition.PricePerToken, // pricePerToken allowlistProof, // allowlistProof - Array.Empty() // data + Array.Empty(), // data }; return await ThirdwebContract.Write(wallet, contract, "claim", payableAmount, fnArgs); @@ -1896,7 +1894,7 @@ public static async Task DropERC1155_Claim(this Thir activeClaimCondition.Currency, // currency activeClaimCondition.PricePerToken, // pricePerToken allowlistProof, // allowlistProof - Array.Empty() // data + Array.Empty(), // data }; return await ThirdwebContract.Write(wallet, contract, "claim", payableAmount, fnArgs); @@ -2088,7 +2086,7 @@ public static async Task TokenERC20_MintWithSignatur Currency = mintRequest.Currency ?? Constants.NATIVE_TOKEN_ADDRESS, ValidityStartTimestamp = mintRequest.ValidityStartTimestamp, ValidityEndTimestamp = mintRequest.ValidityEndTimestamp > 0 ? mintRequest.ValidityEndTimestamp : Utils.GetUnixTimeStampIn10Years(), - Uid = mintRequest.Uid ?? Guid.NewGuid().ToByteArray().PadTo32Bytes() + Uid = mintRequest.Uid ?? Guid.NewGuid().ToByteArray().PadTo32Bytes(), }; var contractMetadata = await contract.GetMetadata(); @@ -2335,7 +2333,7 @@ public static async Task TokenERC721_MintWithSignatu Currency = mintRequest.Currency ?? Constants.NATIVE_TOKEN_ADDRESS, ValidityStartTimestamp = mintRequest.ValidityStartTimestamp, ValidityEndTimestamp = mintRequest.ValidityEndTimestamp > 0 ? mintRequest.ValidityEndTimestamp : Utils.GetUnixTimeStampIn10Years(), - Uid = mintRequest.Uid ?? Guid.NewGuid().ToByteArray().PadTo32Bytes() + Uid = mintRequest.Uid ?? Guid.NewGuid().ToByteArray().PadTo32Bytes(), }; var signature = await EIP712.GenerateSignature_TokenERC721( @@ -2682,7 +2680,7 @@ public static async Task TokenERC1155_MintWithSignat Currency = mintRequest.Currency ?? Constants.NATIVE_TOKEN_ADDRESS, ValidityStartTimestamp = mintRequest.ValidityStartTimestamp, ValidityEndTimestamp = mintRequest.ValidityEndTimestamp > 0 ? mintRequest.ValidityEndTimestamp : Utils.GetUnixTimeStampIn10Years(), - Uid = mintRequest.Uid ?? Guid.NewGuid().ToByteArray().PadTo32Bytes() + Uid = mintRequest.Uid ?? Guid.NewGuid().ToByteArray().PadTo32Bytes(), }; var signature = await EIP712.GenerateSignature_TokenERC1155( diff --git a/Thirdweb/Thirdweb.Extensions/ThirdwebMarketplaceExtensions.Types.cs b/Thirdweb/Thirdweb.Extensions/ThirdwebMarketplaceExtensions.Types.cs index 01ccf9c9..453590da 100644 --- a/Thirdweb/Thirdweb.Extensions/ThirdwebMarketplaceExtensions.Types.cs +++ b/Thirdweb/Thirdweb.Extensions/ThirdwebMarketplaceExtensions.Types.cs @@ -23,7 +23,7 @@ public enum TokenType : byte /// /// Represents an ERC20 token. /// - ERC20 = 2 + ERC20 = 2, } /// @@ -49,7 +49,7 @@ public enum Status : byte /// /// The entity is cancelled. /// - CANCELLED = 3 + CANCELLED = 3, } #endregion diff --git a/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs b/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs index 127d0d65..5d20d3fc 100644 --- a/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs +++ b/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.Extensions.cs @@ -17,7 +17,7 @@ public static NFT ToNFT(this Token_NFT token) "ERC1155" => NFTType.ERC1155, "erc721" => NFTType.ERC721, "erc1155" => NFTType.ERC1155, - _ => throw new Exception($"Unknown NFT type: {token.Contract.Type}") + _ => throw new Exception($"Unknown NFT type: {token.Contract.Type}"), }, Metadata = new NFTMetadata() { @@ -31,7 +31,7 @@ public static NFT ToNFT(this Token_NFT token) BackgroundColor = token.BackgroundColor, Attributes = token.ExtraMetadata?.Attributes, Properties = token.ExtraMetadata?.Properties, - } + }, }; } diff --git a/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs b/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs index a49ea1ec..b232cca5 100644 --- a/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs +++ b/Thirdweb/Thirdweb.Indexer/ThirdwebInsight.cs @@ -292,7 +292,7 @@ public async Task GetEvents( _ = response.EnsureSuccessStatusCode(); var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var result = JsonConvert.DeserializeObject>(responseContent); - return new InsightEvents { Events = result.Data, Meta = result.Meta, }; + return new InsightEvents { Events = result.Data, Meta = result.Meta }; } /// @@ -378,7 +378,7 @@ public async Task GetTransactions( _ = response.EnsureSuccessStatusCode(); var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var result = JsonConvert.DeserializeObject>(responseContent); - return new InsightTransactions { Transactions = result.Data, Meta = result.Meta, }; + return new InsightTransactions { Transactions = result.Data, Meta = result.Meta }; } private static string AppendChains(string url, BigInteger[] chainIds) diff --git a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs index 75cb1fe1..a2db51dc 100644 --- a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs +++ b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyHistory.cs @@ -26,7 +26,7 @@ public static async Task GetBuyHistory(ThirdwebClient client, { "start", start.ToString() }, { "count", count.ToString() }, { "cursor", cursor }, - { "pageSize", pageSize?.ToString() } + { "pageSize", pageSize?.ToString() }, }; var queryStringFormatted = string.Join("&", queryString.Where(kv => kv.Value != null).Select(kv => $"{Uri.EscapeDataString(kv.Key)}={Uri.EscapeDataString(kv.Value)}")); @@ -41,7 +41,6 @@ public static async Task GetBuyHistory(ThirdwebClient client, ErrorResponse error; try - { error = JsonConvert.DeserializeObject(content); } @@ -55,14 +54,12 @@ public static async Task GetBuyHistory(ThirdwebClient client, Reason = "Unknown", Code = "Unknown", Stack = "Unknown", - StatusCode = (int)getResponse.StatusCode - } + StatusCode = (int)getResponse.StatusCode, + }, }; } - throw new Exception( - $"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}" - ); + throw new Exception($"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}"); } var data = JsonConvert.DeserializeObject(content); diff --git a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs index 2db716fe..544b5763 100644 --- a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs +++ b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoQuote.cs @@ -44,8 +44,8 @@ public static async Task GetBuyWithCryptoQuote(Thirdwe Reason = "Unknown", Code = "Unknown", Stack = "Unknown", - StatusCode = (int)response.StatusCode - } + StatusCode = (int)response.StatusCode, + }, }; } diff --git a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs index eab0331c..f8123241 100644 --- a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs +++ b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithCryptoStatus.cs @@ -48,14 +48,12 @@ public static async Task GetBuyWithCryptoStatus(Third Reason = "Unknown", Code = "Unknown", Stack = "Unknown", - StatusCode = (int)getResponse.StatusCode - } + StatusCode = (int)getResponse.StatusCode, + }, }; } - throw new Exception( - $"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}" - ); + throw new Exception($"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}"); } var data = JsonConvert.DeserializeObject(content); diff --git a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs index 6acfcd39..a2865d7b 100644 --- a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs +++ b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatCurrencies.cs @@ -38,14 +38,12 @@ public static async Task> GetBuyWithFiatCurrencies(ThirdwebClient c Reason = "Unknown", Code = "Unknown", Stack = "Unknown", - StatusCode = (int)getResponse.StatusCode - } + StatusCode = (int)getResponse.StatusCode, + }, }; } - throw new Exception( - $"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}" - ); + throw new Exception($"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}"); } var data = JsonConvert.DeserializeObject(content); diff --git a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs index 57bb2075..ae0ff05b 100644 --- a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs +++ b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs @@ -44,8 +44,8 @@ public static async Task GetBuyWithFiatQuote(ThirdwebCli Reason = "Unknown", Code = "Unknown", Stack = "Unknown", - StatusCode = (int)response.StatusCode - } + StatusCode = (int)response.StatusCode, + }, }; } diff --git a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatStatus.cs b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatStatus.cs index 14cbd01c..00fbbf27 100644 --- a/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatStatus.cs +++ b/Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatStatus.cs @@ -48,14 +48,12 @@ public static async Task GetBuyWithFiatStatus(ThirdwebC Reason = "Unknown", Code = "Unknown", Stack = "Unknown", - StatusCode = (int)getResponse.StatusCode - } + StatusCode = (int)getResponse.StatusCode, + }, }; } - throw new Exception( - $"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}" - ); + throw new Exception($"HTTP error! Code: {error.Error.Code} Message: {error.Error.Message} Reason: {error.Error.Reason} StatusCode: {error.Error.StatusCode} Stack: {error.Error.Stack}"); } var data = JsonConvert.DeserializeObject(content); diff --git a/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoQuote.cs b/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoQuote.cs index 31800907..1cb75f21 100644 --- a/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoQuote.cs +++ b/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoQuote.cs @@ -23,7 +23,7 @@ public class BuyWithCryptoQuoteParams( double? maxSlippageBPS = null, string intentId = null, object purchaseData = null - ) +) { /// /// The address from which the payment is made. diff --git a/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoStatus.cs b/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoStatus.cs index 10a1c2f9..5778cc44 100644 --- a/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoStatus.cs +++ b/Thirdweb/Thirdweb.Pay/Types.GetBuyWithCryptoStatus.cs @@ -228,7 +228,7 @@ public enum SwapStatus /// /// Status when the swap is completed. /// - COMPLETED + COMPLETED, } /// @@ -264,5 +264,5 @@ public enum SwapSubStatus /// /// Sub-status when there is an unknown error. /// - UNKNOWN_ERROR + UNKNOWN_ERROR, } diff --git a/Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs b/Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs index 2b07e2d2..8d3f343e 100644 --- a/Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs +++ b/Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs @@ -21,7 +21,7 @@ public class BuyWithFiatQuoteParams( bool isTestMode = false, string preferredProvider = null, object purchaseData = null - ) +) { /// /// The symbol of the currency to be used for the purchase. diff --git a/Thirdweb/Thirdweb.Pay/Types.Shared.cs b/Thirdweb/Thirdweb.Pay/Types.Shared.cs index 7d0a9ed9..43310b96 100644 --- a/Thirdweb/Thirdweb.Pay/Types.Shared.cs +++ b/Thirdweb/Thirdweb.Pay/Types.Shared.cs @@ -189,5 +189,5 @@ public enum SwapType /// /// On-ramp swap. /// - ON_RAMP + ON_RAMP, } diff --git a/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs b/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs index 88884a74..a3449566 100644 --- a/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs +++ b/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs @@ -117,7 +117,7 @@ public async Task SendRequestAsync(string method, params o { Method = method, Params = parameters, - Id = requestId + Id = requestId, }; lock (this._responseLock) diff --git a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs index 17f0a1a0..2ade66e7 100644 --- a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs +++ b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs @@ -262,11 +262,10 @@ public static async Task EstimateGasLimit(ThirdwebTransaction transa { var rpc = ThirdwebRPC.GetRpcInstance(transaction.Wallet.Client, transaction.Input.ChainId.Value); var isZkSync = await Utils.IsZkSync(transaction.Wallet.Client, transaction.Input.ChainId.Value).ConfigureAwait(false); - BigInteger divider = isZkSync - ? 7 - : transaction.Input.AuthorizationList == null - ? 5 - : 3; + BigInteger divider = + isZkSync ? 7 + : transaction.Input.AuthorizationList == null ? 5 + : 3; BigInteger baseGas; if (isZkSync) { @@ -470,6 +469,45 @@ public static async Task WaitForTransactionReceipt(T return receipt; } + /// + /// Waits for the transaction hash given a thirdweb transaction id. Use WaitForTransactionReceipt if you have a transaction hash. + /// + /// The Thirdweb client. + /// The thirdweb transaction id. + /// The cancellation token. + /// The transaction hash. + public static async Task WaitForTransactionHash(ThirdwebClient client, string txId, CancellationToken cancellationToken = default) + { + using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + cts.CancelAfter(client.FetchTimeoutOptions.GetTimeout(TimeoutType.Other)); + + var api = client.Api; + string hash = null; + + try + { + do + { + hash = (await api.GetTransactionByIdAsync(txId, cts.Token).ConfigureAwait(false)).Result.TransactionHash; + if (hash == null) + { + await ThirdwebTask.Delay(100, cancellationToken).ConfigureAwait(false); + } + } while (hash == null && !cts.Token.IsCancellationRequested); + + if (hash == null) + { + throw new Exception($"Transaction {txId} not found within the timeout period."); + } + } + catch (OperationCanceledException) + { + throw new Exception($"Transaction hash polling for id {txId} was cancelled."); + } + + return hash; + } + /// /// Converts the transaction to a zkSync transaction. /// @@ -491,7 +529,7 @@ public static async Task WaitForTransactionReceipt(T Value = transaction.Input.Value?.Value ?? 0, Data = transaction.Input.Data?.HexToByteArray() ?? Array.Empty(), FactoryDeps = transaction.Input.ZkSync.Value.FactoryDeps, - PaymasterInput = transaction.Input.ZkSync.Value.PaymasterInput + PaymasterInput = transaction.Input.ZkSync.Value.PaymasterInput, }; } } diff --git a/Thirdweb/Thirdweb.Utils/Constants.cs b/Thirdweb/Thirdweb.Utils/Constants.cs index 8f9bf31c..9dda7cb3 100644 --- a/Thirdweb/Thirdweb.Utils/Constants.cs +++ b/Thirdweb/Thirdweb.Utils/Constants.cs @@ -38,29 +38,23 @@ public static class Constants public const string MINIMAL_ACCOUNT_7702 = "0xD6999651Fc0964B9c6B444307a0ab20534a66560"; public const string MINIMAL_ACCOUNT_7702_ABI = - /*lang=json,strict*/ "[{\"inputs\": [{\"internalType\": \"uint256\",\"name\": \"allowanceUsage\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint64\",\"name\": \"period\",\"type\": \"uint64\"}],\"name\": \"AllowanceExceeded\",\"type\": \"error\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"bytes4\",\"name\": \"selector\",\"type\": \"bytes4\"}],\"name\": \"CallPolicyViolated\",\"type\": \"error\"},{\"inputs\": [],\"name\": \"CallReverted\",\"type\": \"error\"},{\"inputs\": [{\"internalType\": \"bytes32\",\"name\": \"param\",\"type\": \"bytes32\"},{\"internalType\": \"bytes32\",\"name\": \"refValue\",\"type\": \"bytes32\"},{\"internalType\": \"uint8\",\"name\": \"condition\",\"type\": \"uint8\"}],\"name\": \"ConditionFailed\",\"type\": \"error\"},{\"inputs\": [{\"internalType\": \"uint256\",\"name\": \"actualLength\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"expectedLength\",\"type\": \"uint256\"}],\"name\": \"InvalidDataLength\",\"type\": \"error\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"msgSender\",\"type\": \"address\"},{\"internalType\": \"address\",\"name\": \"thisAddress\",\"type\": \"address\"}],\"name\": \"InvalidSignature\",\"type\": \"error\"},{\"inputs\": [{\"internalType\": \"uint256\",\"name\": \"lifetimeUsage\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"}],\"name\": \"LifetimeUsageExceeded\",\"type\": \"error\"},{\"inputs\": [{\"internalType\": \"uint256\",\"name\": \"value\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"maxValuePerUse\",\"type\": \"uint256\"}],\"name\": \"MaxValueExceeded\",\"type\": \"error\"},{\"inputs\": [],\"name\": \"NoCallsToExecute\",\"type\": \"error\"},{\"inputs\": [],\"name\": \"SessionExpired\",\"type\": \"error\"},{\"inputs\": [],\"name\": \"SessionExpiresTooSoon\",\"type\": \"error\"},{\"inputs\": [],\"name\": \"SessionZeroSigner\",\"type\": \"error\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"}],\"name\": \"TransferPolicyViolated\",\"type\": \"error\"},{\"inputs\": [],\"name\": \"UIDAlreadyProcessed\",\"type\": \"error\"},{\"anonymous\": false,\"inputs\": [{\"indexed\": true,\"internalType\": \"address\",\"name\": \"to\",\"type\": \"address\"},{\"indexed\": false,\"internalType\": \"uint256\",\"name\": \"value\",\"type\": \"uint256\"},{\"indexed\": false,\"internalType\": \"bytes\",\"name\": \"data\",\"type\": \"bytes\"}],\"name\": \"Executed\",\"type\": \"event\"},{\"anonymous\": false,\"inputs\": [{\"indexed\": true,\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"},{\"components\": [{\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"},{\"internalType\": \"bool\",\"name\": \"isWildcard\",\"type\": \"bool\"},{\"internalType\": \"uint256\",\"name\": \"expiresAt\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"bytes4\",\"name\": \"selector\",\"type\": \"bytes4\"},{\"internalType\": \"uint256\",\"name\": \"maxValuePerUse\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"valueLimit\",\"type\": \"tuple\"},{\"components\": [{\"internalType\": \"enum SessionLib.Condition\",\"name\": \"condition\",\"type\": \"uint8\"},{\"internalType\": \"uint64\",\"name\": \"index\",\"type\": \"uint64\"},{\"internalType\": \"bytes32\",\"name\": \"refValue\",\"type\": \"bytes32\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"limit\",\"type\": \"tuple\"}],\"internalType\": \"struct SessionLib.Constraint[]\",\"name\": \"constraints\",\"type\": \"tuple[]\"}],\"internalType\": \"struct SessionLib.CallSpec[]\",\"name\": \"callPolicies\",\"type\": \"tuple[]\"},{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"maxValuePerUse\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"valueLimit\",\"type\": \"tuple\"}],\"internalType\": \"struct SessionLib.TransferSpec[]\",\"name\": \"transferPolicies\",\"type\": \"tuple[]\"},{\"internalType\": \"bytes32\",\"name\": \"uid\",\"type\": \"bytes32\"}],\"indexed\": false,\"internalType\": \"struct SessionLib.SessionSpec\",\"name\": \"sessionSpec\",\"type\": \"tuple\"}],\"name\": \"SessionCreated\",\"type\": \"event\"},{\"anonymous\": false,\"inputs\": [{\"indexed\": true,\"internalType\": \"address\",\"name\": \"from\",\"type\": \"address\"},{\"indexed\": false,\"internalType\": \"uint256\",\"name\": \"value\",\"type\": \"uint256\"}],\"name\": \"ValueReceived\",\"type\": \"event\"},{\"inputs\": [{\"components\": [{\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"},{\"internalType\": \"bool\",\"name\": \"isWildcard\",\"type\": \"bool\"},{\"internalType\": \"uint256\",\"name\": \"expiresAt\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"bytes4\",\"name\": \"selector\",\"type\": \"bytes4\"},{\"internalType\": \"uint256\",\"name\": \"maxValuePerUse\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"valueLimit\",\"type\": \"tuple\"},{\"components\": [{\"internalType\": \"enum SessionLib.Condition\",\"name\": \"condition\",\"type\": \"uint8\"},{\"internalType\": \"uint64\",\"name\": \"index\",\"type\": \"uint64\"},{\"internalType\": \"bytes32\",\"name\": \"refValue\",\"type\": \"bytes32\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"limit\",\"type\": \"tuple\"}],\"internalType\": \"struct SessionLib.Constraint[]\",\"name\": \"constraints\",\"type\": \"tuple[]\"}],\"internalType\": \"struct SessionLib.CallSpec[]\",\"name\": \"callPolicies\",\"type\": \"tuple[]\"},{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"maxValuePerUse\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"valueLimit\",\"type\": \"tuple\"}],\"internalType\": \"struct SessionLib.TransferSpec[]\",\"name\": \"transferPolicies\",\"type\": \"tuple[]\"},{\"internalType\": \"bytes32\",\"name\": \"uid\",\"type\": \"bytes32\"}],\"internalType\": \"struct SessionLib.SessionSpec\",\"name\": \"sessionSpec\",\"type\": \"tuple\"},{\"internalType\": \"bytes\",\"name\": \"signature\",\"type\": \"bytes\"}],\"name\": \"createSessionWithSig\",\"outputs\": [],\"stateMutability\": \"nonpayable\",\"type\": \"function\"},{\"inputs\": [],\"name\": \"eip712Domain\",\"outputs\": [{\"internalType\": \"bytes1\",\"name\": \"fields\",\"type\": \"bytes1\"},{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"version\",\"type\": \"string\"},{\"internalType\": \"uint256\",\"name\": \"chainId\",\"type\": \"uint256\"},{\"internalType\": \"address\",\"name\": \"verifyingContract\",\"type\": \"address\"},{\"internalType\": \"bytes32\",\"name\": \"salt\",\"type\": \"bytes32\"},{\"internalType\": \"uint256[]\",\"name\": \"extensions\",\"type\": \"uint256[]\"}],\"stateMutability\": \"view\",\"type\": \"function\"},{\"inputs\": [{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"value\",\"type\": \"uint256\"},{\"internalType\": \"bytes\",\"name\": \"data\",\"type\": \"bytes\"}],\"internalType\": \"struct Call[]\",\"name\": \"calls\",\"type\": \"tuple[]\"}],\"name\": \"execute\",\"outputs\": [],\"stateMutability\": \"payable\",\"type\": \"function\"},{\"inputs\": [{\"components\": [{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"value\",\"type\": \"uint256\"},{\"internalType\": \"bytes\",\"name\": \"data\",\"type\": \"bytes\"}],\"internalType\": \"struct Call[]\",\"name\": \"calls\",\"type\": \"tuple[]\"},{\"internalType\": \"bytes32\",\"name\": \"uid\",\"type\": \"bytes32\"}],\"internalType\": \"struct WrappedCalls\",\"name\": \"wrappedCalls\",\"type\": \"tuple\"},{\"internalType\": \"bytes\",\"name\": \"signature\",\"type\": \"bytes\"}],\"name\": \"executeWithSig\",\"outputs\": [],\"stateMutability\": \"payable\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"}],\"name\": \"getCallPoliciesForSigner\",\"outputs\": [{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"bytes4\",\"name\": \"selector\",\"type\": \"bytes4\"},{\"internalType\": \"uint256\",\"name\": \"maxValuePerUse\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"valueLimit\",\"type\": \"tuple\"},{\"components\": [{\"internalType\": \"enum SessionLib.Condition\",\"name\": \"condition\",\"type\": \"uint8\"},{\"internalType\": \"uint64\",\"name\": \"index\",\"type\": \"uint64\"},{\"internalType\": \"bytes32\",\"name\": \"refValue\",\"type\": \"bytes32\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"limit\",\"type\": \"tuple\"}],\"internalType\": \"struct SessionLib.Constraint[]\",\"name\": \"constraints\",\"type\": \"tuple[]\"}],\"internalType\": \"struct SessionLib.CallSpec[]\",\"name\": \"\",\"type\": \"tuple[]\"}],\"stateMutability\": \"view\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"}],\"name\": \"getSessionExpirationForSigner\",\"outputs\": [{\"internalType\": \"uint256\",\"name\": \"\",\"type\": \"uint256\"}],\"stateMutability\": \"view\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"}],\"name\": \"getSessionStateForSigner\",\"outputs\": [{\"components\": [{\"components\": [{\"internalType\": \"uint256\",\"name\": \"remaining\",\"type\": \"uint256\"},{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"bytes4\",\"name\": \"selector\",\"type\": \"bytes4\"},{\"internalType\": \"uint256\",\"name\": \"index\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.LimitState[]\",\"name\": \"transferValue\",\"type\": \"tuple[]\"},{\"components\": [{\"internalType\": \"uint256\",\"name\": \"remaining\",\"type\": \"uint256\"},{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"bytes4\",\"name\": \"selector\",\"type\": \"bytes4\"},{\"internalType\": \"uint256\",\"name\": \"index\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.LimitState[]\",\"name\": \"callValue\",\"type\": \"tuple[]\"},{\"components\": [{\"internalType\": \"uint256\",\"name\": \"remaining\",\"type\": \"uint256\"},{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"bytes4\",\"name\": \"selector\",\"type\": \"bytes4\"},{\"internalType\": \"uint256\",\"name\": \"index\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.LimitState[]\",\"name\": \"callParams\",\"type\": \"tuple[]\"}],\"internalType\": \"struct SessionLib.SessionState\",\"name\": \"\",\"type\": \"tuple\"}],\"stateMutability\": \"view\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"}],\"name\": \"getTransferPoliciesForSigner\",\"outputs\": [{\"components\": [{\"internalType\": \"address\",\"name\": \"target\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"maxValuePerUse\",\"type\": \"uint256\"},{\"components\": [{\"internalType\": \"enum SessionLib.LimitType\",\"name\": \"limitType\",\"type\": \"uint8\"},{\"internalType\": \"uint256\",\"name\": \"limit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"period\",\"type\": \"uint256\"}],\"internalType\": \"struct SessionLib.UsageLimit\",\"name\": \"valueLimit\",\"type\": \"tuple\"}],\"internalType\": \"struct SessionLib.TransferSpec[]\",\"name\": \"\",\"type\": \"tuple[]\"}],\"stateMutability\": \"view\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"signer\",\"type\": \"address\"}],\"name\": \"isWildcardSigner\",\"outputs\": [{\"internalType\": \"bool\",\"name\": \"\",\"type\": \"bool\"}],\"stateMutability\": \"view\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"},{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"},{\"internalType\": \"uint256[]\",\"name\": \"\",\"type\": \"uint256[]\"},{\"internalType\": \"uint256[]\",\"name\": \"\",\"type\": \"uint256[]\"},{\"internalType\": \"bytes\",\"name\": \"\",\"type\": \"bytes\"}],\"name\": \"onERC1155BatchReceived\",\"outputs\": [{\"internalType\": \"bytes4\",\"name\": \"\",\"type\": \"bytes4\"}],\"stateMutability\": \"nonpayable\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"},{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"\",\"type\": \"uint256\"},{\"internalType\": \"bytes\",\"name\": \"\",\"type\": \"bytes\"}],\"name\": \"onERC1155Received\",\"outputs\": [{\"internalType\": \"bytes4\",\"name\": \"\",\"type\": \"bytes4\"}],\"stateMutability\": \"nonpayable\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"},{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"\",\"type\": \"uint256\"},{\"internalType\": \"bytes\",\"name\": \"\",\"type\": \"bytes\"}],\"name\": \"onERC721Received\",\"outputs\": [{\"internalType\": \"bytes4\",\"name\": \"\",\"type\": \"bytes4\"}],\"stateMutability\": \"nonpayable\",\"type\": \"function\"},{\"inputs\": [{\"internalType\": \"bytes4\",\"name\": \"interfaceId\",\"type\": \"bytes4\"}],\"name\": \"supportsInterface\",\"outputs\": [{\"internalType\": \"bool\",\"name\": \"\",\"type\": \"bool\"}],\"stateMutability\": \"view\",\"type\": \"function\"},{\"stateMutability\": \"payable\",\"type\": \"receive\"}]"; public const string MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11"; public const string MULTICALL3_ABI = - /*lang=json,strict*/ "[{\"type\":\"function\",\"stateMutability\":\"payable\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"blockNumber\",\"internalType\":\"uint256\"},{\"type\":\"bytes[]\",\"name\":\"returnData\",\"internalType\":\"bytes[]\"}],\"name\":\"aggregate\",\"inputs\":[{\"type\":\"tuple[]\",\"name\":\"calls\",\"internalType\":\"struct Multicall3.Call[]\",\"components\":[{\"type\":\"address\",\"name\":\"target\",\"internalType\":\"address\"},{\"type\":\"bytes\",\"name\":\"callData\",\"internalType\":\"bytes\"}]}]},{\"type\":\"function\",\"stateMutability\":\"payable\",\"outputs\":[{\"type\":\"tuple[]\",\"name\":\"returnData\",\"internalType\":\"struct Multicall3.Result[]\",\"components\":[{\"type\":\"bool\",\"name\":\"success\",\"internalType\":\"bool\"},{\"type\":\"bytes\",\"name\":\"returnData\",\"internalType\":\"bytes\"}]}],\"name\":\"aggregate3\",\"inputs\":[{\"type\":\"tuple[]\",\"name\":\"calls\",\"internalType\":\"struct Multicall3.Call3[]\",\"components\":[{\"type\":\"address\",\"name\":\"target\",\"internalType\":\"address\"},{\"type\":\"bool\",\"name\":\"allowFailure\",\"internalType\":\"bool\"},{\"type\":\"bytes\",\"name\":\"callData\",\"internalType\":\"bytes\"}]}]},{\"type\":\"function\",\"stateMutability\":\"payable\",\"outputs\":[{\"type\":\"tuple[]\",\"name\":\"returnData\",\"internalType\":\"struct Multicall3.Result[]\",\"components\":[{\"type\":\"bool\",\"name\":\"success\",\"internalType\":\"bool\"},{\"type\":\"bytes\",\"name\":\"returnData\",\"internalType\":\"bytes\"}]}],\"name\":\"aggregate3Value\",\"inputs\":[{\"type\":\"tuple[]\",\"name\":\"calls\",\"internalType\":\"struct Multicall3.Call3Value[]\",\"components\":[{\"type\":\"address\",\"name\":\"target\",\"internalType\":\"address\"},{\"type\":\"bool\",\"name\":\"allowFailure\",\"internalType\":\"bool\"},{\"type\":\"uint256\",\"name\":\"value\",\"internalType\":\"uint256\"},{\"type\":\"bytes\",\"name\":\"callData\",\"internalType\":\"bytes\"}]}]},{\"type\":\"function\",\"stateMutability\":\"payable\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"blockNumber\",\"internalType\":\"uint256\"},{\"type\":\"bytes32\",\"name\":\"blockHash\",\"internalType\":\"bytes32\"},{\"type\":\"tuple[]\",\"name\":\"returnData\",\"internalType\":\"struct Multicall3.Result[]\",\"components\":[{\"type\":\"bool\",\"name\":\"success\",\"internalType\":\"bool\"},{\"type\":\"bytes\",\"name\":\"returnData\",\"internalType\":\"bytes\"}]}],\"name\":\"blockAndAggregate\",\"inputs\":[{\"type\":\"tuple[]\",\"name\":\"calls\",\"internalType\":\"struct Multicall3.Call[]\",\"components\":[{\"type\":\"address\",\"name\":\"target\",\"internalType\":\"address\"},{\"type\":\"bytes\",\"name\":\"callData\",\"internalType\":\"bytes\"}]}]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"basefee\",\"internalType\":\"uint256\"}],\"name\":\"getBasefee\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"bytes32\",\"name\":\"blockHash\",\"internalType\":\"bytes32\"}],\"name\":\"getBlockHash\",\"inputs\":[{\"type\":\"uint256\",\"name\":\"blockNumber\",\"internalType\":\"uint256\"}]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"blockNumber\",\"internalType\":\"uint256\"}],\"name\":\"getBlockNumber\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"chainid\",\"internalType\":\"uint256\"}],\"name\":\"getChainId\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"address\",\"name\":\"coinbase\",\"internalType\":\"address\"}],\"name\":\"getCurrentBlockCoinbase\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"difficulty\",\"internalType\":\"uint256\"}],\"name\":\"getCurrentBlockDifficulty\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"gaslimit\",\"internalType\":\"uint256\"}],\"name\":\"getCurrentBlockGasLimit\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"timestamp\",\"internalType\":\"uint256\"}],\"name\":\"getCurrentBlockTimestamp\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"balance\",\"internalType\":\"uint256\"}],\"name\":\"getEthBalance\",\"inputs\":[{\"type\":\"address\",\"name\":\"addr\",\"internalType\":\"address\"}]},{\"type\":\"function\",\"stateMutability\":\"view\",\"outputs\":[{\"type\":\"bytes32\",\"name\":\"blockHash\",\"internalType\":\"bytes32\"}],\"name\":\"getLastBlockHash\",\"inputs\":[]},{\"type\":\"function\",\"stateMutability\":\"payable\",\"outputs\":[{\"type\":\"tuple[]\",\"name\":\"returnData\",\"internalType\":\"struct Multicall3.Result[]\",\"components\":[{\"type\":\"bool\",\"name\":\"success\",\"internalType\":\"bool\"},{\"type\":\"bytes\",\"name\":\"returnData\",\"internalType\":\"bytes\"}]}],\"name\":\"tryAggregate\",\"inputs\":[{\"type\":\"bool\",\"name\":\"requireSuccess\",\"internalType\":\"bool\"},{\"type\":\"tuple[]\",\"name\":\"calls\",\"internalType\":\"struct Multicall3.Call[]\",\"components\":[{\"type\":\"address\",\"name\":\"target\",\"internalType\":\"address\"},{\"type\":\"bytes\",\"name\":\"callData\",\"internalType\":\"bytes\"}]}]},{\"type\":\"function\",\"stateMutability\":\"payable\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"blockNumber\",\"internalType\":\"uint256\"},{\"type\":\"bytes32\",\"name\":\"blockHash\",\"internalType\":\"bytes32\"},{\"type\":\"tuple[]\",\"name\":\"returnData\",\"internalType\":\"struct Multicall3.Result[]\",\"components\":[{\"type\":\"bool\",\"name\":\"success\",\"internalType\":\"bool\"},{\"type\":\"bytes\",\"name\":\"returnData\",\"internalType\":\"bytes\"}]}],\"name\":\"tryBlockAndAggregate\",\"inputs\":[{\"type\":\"bool\",\"name\":\"requireSuccess\",\"internalType\":\"bool\"},{\"type\":\"tuple[]\",\"name\":\"calls\",\"internalType\":\"struct Multicall3.Call[]\",\"components\":[{\"type\":\"address\",\"name\":\"target\",\"internalType\":\"address\"},{\"type\":\"bytes\",\"name\":\"callData\",\"internalType\":\"bytes\"}]}]}]"; public const string REDIRECT_HTML = "

Authentication Complete!

You may close this tab now and return to the game

"; internal const string ENTRYPOINT_V06_ABI = - /*lang=json,strict*/ "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paid\",\"type\":\"uint256\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bool\",\"name\":\"targetSuccess\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"targetResult\",\"type\":\"bytes\"}],\"name\":\"ExecutionResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"opIndex\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"FailedOp\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SenderAddressResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureValidationFailed\",\"type\":\"error\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sigFailed\",\"type\":\"bool\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"paymasterContext\",\"type\":\"bytes\"}],\"internalType\":\"struct IEntryPoint.ReturnInfo\",\"name\":\"returnInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakeManager.StakeInfo\",\"name\":\"senderInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakeManager.StakeInfo\",\"name\":\"factoryInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakeManager.StakeInfo\",\"name\":\"paymasterInfo\",\"type\":\"tuple\"}],\"name\":\"ValidationResult\",\"type\":\"error\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sigFailed\",\"type\":\"bool\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"paymasterContext\",\"type\":\"bytes\"}],\"internalType\":\"struct IEntryPoint.ReturnInfo\",\"name\":\"returnInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakeManager.StakeInfo\",\"name\":\"senderInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakeManager.StakeInfo\",\"name\":\"factoryInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakeManager.StakeInfo\",\"name\":\"paymasterInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"struct IStakeManager.StakeInfo\",\"name\":\"stakeInfo\",\"type\":\"tuple\"}],\"internalType\":\"struct IEntryPoint.AggregatorStakeInfo\",\"name\":\"aggregatorInfo\",\"type\":\"tuple\"}],\"name\":\"ValidationResultWithAggregation\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"}],\"name\":\"AccountDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"BeforeExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalDeposit\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureAggregatorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalStaked\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"name\":\"StakeLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawTime\",\"type\":\"uint256\"}],\"name\":\"StakeUnlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StakeWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasUsed\",\"type\":\"uint256\"}],\"name\":\"UserOperationEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"revertReason\",\"type\":\"bytes\"}],\"name\":\"UserOperationRevertReason\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"SIG_VALIDATION_FAILED\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"}],\"name\":\"_validateSenderAndPaymaster\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"depositTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint112\",\"name\":\"deposit\",\"type\":\"uint112\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getDepositInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint112\",\"name\":\"deposit\",\"type\":\"uint112\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"internalType\":\"struct IStakeManager.DepositInfo\",\"name\":\"info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"getNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"name\":\"getSenderAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"getUserOpHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation[]\",\"name\":\"userOps\",\"type\":\"tuple[]\"},{\"internalType\":\"contract IAggregator\",\"name\":\"aggregator\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct IEntryPoint.UserOpsPerAggregator[]\",\"name\":\"opsPerAggregator\",\"type\":\"tuple[]\"},{\"internalType\":\"address payable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleAggregatedOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation[]\",\"name\":\"ops\",\"type\":\"tuple[]\"},{\"internalType\":\"address payable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"incrementNonce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"}],\"internalType\":\"struct EntryPoint.MemoryUserOp\",\"name\":\"mUserOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"contextOffset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"}],\"internalType\":\"struct EntryPoint.UserOpInfo\",\"name\":\"opInfo\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"innerHandleOp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"}],\"name\":\"nonceSequenceNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"targetCallData\",\"type\":\"bytes\"}],\"name\":\"simulateHandleOp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"simulateValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"withdrawAddress\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]"; internal const string ENTRYPOINT_V07_ABI = - /*lang=json,strict*/ "[{\"type\": \"error\",\"name\": \"DelegateAndRevert\",\"inputs\": [{\"type\": \"bool\",\"name\": \"success\",\"internalType\": \"bool\"},{\"type\": \"bytes\",\"name\": \"ret\",\"internalType\": \"bytes\"}],\"outputs\": []},{\"type\": \"error\",\"name\": \"FailedOp\",\"inputs\": [{\"type\": \"uint256\",\"name\": \"opIndex\",\"internalType\": \"uint256\"},{\"type\": \"string\",\"name\": \"reason\",\"internalType\": \"string\"}],\"outputs\": []},{\"type\": \"error\",\"name\": \"FailedOpWithRevert\",\"inputs\": [{\"type\": \"uint256\",\"name\": \"opIndex\",\"internalType\": \"uint256\"},{\"type\": \"string\",\"name\": \"reason\",\"internalType\": \"string\"},{\"type\": \"bytes\",\"name\": \"inner\",\"internalType\": \"bytes\"}],\"outputs\": []},{\"type\": \"error\",\"name\": \"PostOpReverted\",\"inputs\": [{\"type\": \"bytes\",\"name\": \"returnData\",\"internalType\": \"bytes\"}],\"outputs\": []},{\"type\": \"error\",\"name\": \"ReentrancyGuardReentrantCall\",\"inputs\": [],\"outputs\": []},{\"type\": \"error\",\"name\": \"SenderAddressResult\",\"inputs\": [{\"type\": \"address\",\"name\": \"sender\",\"internalType\": \"address\"}],\"outputs\": []},{\"type\": \"error\",\"name\": \"SignatureValidationFailed\",\"inputs\": [{\"type\": \"address\",\"name\": \"aggregator\",\"internalType\": \"address\"}],\"outputs\": []},{\"type\": \"event\",\"name\": \"AccountDeployed\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"userOpHash\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"factory\",\"indexed\": false,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"paymaster\",\"indexed\": false,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"BeforeExecution\",\"inputs\": [],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"Deposited\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"totalDeposit\",\"indexed\": false,\"internalType\": \"uint256\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"PostOpRevertReason\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"userOpHash\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"nonce\",\"indexed\": false,\"internalType\": \"uint256\"},{\"type\": \"bytes\",\"name\": \"revertReason\",\"indexed\": false,\"internalType\": \"bytes\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"SignatureAggregatorChanged\",\"inputs\": [{\"type\": \"address\",\"name\": \"aggregator\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"StakeLocked\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"totalStaked\",\"indexed\": false,\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"unstakeDelaySec\",\"indexed\": false,\"internalType\": \"uint256\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"StakeUnlocked\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"withdrawTime\",\"indexed\": false,\"internalType\": \"uint256\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"StakeWithdrawn\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"withdrawAddress\",\"indexed\": false,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"amount\",\"indexed\": false,\"internalType\": \"uint256\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"UserOperationEvent\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"userOpHash\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"paymaster\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"nonce\",\"indexed\": false,\"internalType\": \"uint256\"},{\"type\": \"bool\",\"name\": \"success\",\"indexed\": false,\"internalType\": \"bool\"},{\"type\": \"uint256\",\"name\": \"actualGasCost\",\"indexed\": false,\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"actualGasUsed\",\"indexed\": false,\"internalType\": \"uint256\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"UserOperationPrefundTooLow\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"userOpHash\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"nonce\",\"indexed\": false,\"internalType\": \"uint256\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"UserOperationRevertReason\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"userOpHash\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"nonce\",\"indexed\": false,\"internalType\": \"uint256\"},{\"type\": \"bytes\",\"name\": \"revertReason\",\"indexed\": false,\"internalType\": \"bytes\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"Withdrawn\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"withdrawAddress\",\"indexed\": false,\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"amount\",\"indexed\": false,\"internalType\": \"uint256\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"function\",\"name\": \"addStake\",\"inputs\": [{\"type\": \"uint32\",\"name\": \"unstakeDelaySec\",\"internalType\": \"uint32\"}],\"outputs\": [],\"stateMutability\": \"payable\"},{\"type\": \"function\",\"name\": \"balanceOf\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"uint256\",\"name\": \"\",\"internalType\": \"uint256\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"delegateAndRevert\",\"inputs\": [{\"type\": \"address\",\"name\": \"target\",\"internalType\": \"address\"},{\"type\": \"bytes\",\"name\": \"data\",\"internalType\": \"bytes\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"depositTo\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [],\"stateMutability\": \"payable\"},{\"type\": \"function\",\"name\": \"deposits\",\"inputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"uint256\",\"name\": \"deposit\",\"internalType\": \"uint256\"},{\"type\": \"bool\",\"name\": \"staked\",\"internalType\": \"bool\"},{\"type\": \"uint112\",\"name\": \"stake\",\"internalType\": \"uint112\"},{\"type\": \"uint32\",\"name\": \"unstakeDelaySec\",\"internalType\": \"uint32\"},{\"type\": \"uint48\",\"name\": \"withdrawTime\",\"internalType\": \"uint48\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getDepositInfo\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"tuple\",\"name\": \"info\",\"components\": [{\"type\": \"uint256\",\"name\": \"deposit\",\"internalType\": \"uint256\"},{\"type\": \"bool\",\"name\": \"staked\",\"internalType\": \"bool\"},{\"type\": \"uint112\",\"name\": \"stake\",\"internalType\": \"uint112\"},{\"type\": \"uint32\",\"name\": \"unstakeDelaySec\",\"internalType\": \"uint32\"},{\"type\": \"uint48\",\"name\": \"withdrawTime\",\"internalType\": \"uint48\"}],\"internalType\": \"struct IStakeManager.DepositInfo\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getNonce\",\"inputs\": [{\"type\": \"address\",\"name\": \"sender\",\"internalType\": \"address\"},{\"type\": \"uint192\",\"name\": \"key\",\"internalType\": \"uint192\"}],\"outputs\": [{\"type\": \"uint256\",\"name\": \"nonce\",\"internalType\": \"uint256\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getSenderAddress\",\"inputs\": [{\"type\": \"bytes\",\"name\": \"initCode\",\"internalType\": \"bytes\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"getUserOpHash\",\"inputs\": [{\"type\": \"tuple\",\"name\": \"userOp\",\"components\": [{\"type\": \"address\",\"name\": \"sender\",\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"nonce\",\"internalType\": \"uint256\"},{\"type\": \"bytes\",\"name\": \"initCode\",\"internalType\": \"bytes\"},{\"type\": \"bytes\",\"name\": \"callData\",\"internalType\": \"bytes\"},{\"type\": \"bytes32\",\"name\": \"accountGasLimits\",\"internalType\": \"bytes32\"},{\"type\": \"uint256\",\"name\": \"preVerificationGas\",\"internalType\": \"uint256\"},{\"type\": \"bytes32\",\"name\": \"gasFees\",\"internalType\": \"bytes32\"},{\"type\": \"bytes\",\"name\": \"paymasterAndData\",\"internalType\": \"bytes\"},{\"type\": \"bytes\",\"name\": \"signature\",\"internalType\": \"bytes\"}],\"internalType\": \"struct PackedUserOperation\"}],\"outputs\": [{\"type\": \"bytes32\",\"name\": \"\",\"internalType\": \"bytes32\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"handleAggregatedOps\",\"inputs\": [{\"type\": \"tuple[]\",\"name\": \"opsPerAggregator\",\"components\": [{\"type\": \"tuple[]\",\"name\": \"userOps\",\"components\": [{\"internalType\": \"address\",\"name\": \"sender\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"nonce\",\"type\": \"uint256\"},{\"internalType\": \"bytes\",\"name\": \"initCode\",\"type\": \"bytes\"},{\"internalType\": \"bytes\",\"name\": \"callData\",\"type\": \"bytes\"},{\"internalType\": \"bytes32\",\"name\": \"accountGasLimits\",\"type\": \"bytes32\"},{\"internalType\": \"uint256\",\"name\": \"preVerificationGas\",\"type\": \"uint256\"},{\"internalType\": \"bytes32\",\"name\": \"gasFees\",\"type\": \"bytes32\"},{\"internalType\": \"bytes\",\"name\": \"paymasterAndData\",\"type\": \"bytes\"},{\"internalType\": \"bytes\",\"name\": \"signature\",\"type\": \"bytes\"}],\"internalType\": \"struct PackedUserOperation[]\"},{\"type\": \"address\",\"name\": \"aggregator\",\"internalType\": \"contract IAggregator\"},{\"type\": \"bytes\",\"name\": \"signature\",\"internalType\": \"bytes\"}],\"internalType\": \"struct IEntryPoint.UserOpsPerAggregator[]\"},{\"type\": \"address\",\"name\": \"beneficiary\",\"internalType\": \"address payable\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"handleOps\",\"inputs\": [{\"type\": \"tuple[]\",\"name\": \"ops\",\"components\": [{\"type\": \"address\",\"name\": \"sender\",\"internalType\": \"address\"},{\"type\": \"uint256\",\"name\": \"nonce\",\"internalType\": \"uint256\"},{\"type\": \"bytes\",\"name\": \"initCode\",\"internalType\": \"bytes\"},{\"type\": \"bytes\",\"name\": \"callData\",\"internalType\": \"bytes\"},{\"type\": \"bytes32\",\"name\": \"accountGasLimits\",\"internalType\": \"bytes32\"},{\"type\": \"uint256\",\"name\": \"preVerificationGas\",\"internalType\": \"uint256\"},{\"type\": \"bytes32\",\"name\": \"gasFees\",\"internalType\": \"bytes32\"},{\"type\": \"bytes\",\"name\": \"paymasterAndData\",\"internalType\": \"bytes\"},{\"type\": \"bytes\",\"name\": \"signature\",\"internalType\": \"bytes\"}],\"internalType\": \"struct PackedUserOperation[]\"},{\"type\": \"address\",\"name\": \"beneficiary\",\"internalType\": \"address payable\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"incrementNonce\",\"inputs\": [{\"type\": \"uint192\",\"name\": \"key\",\"internalType\": \"uint192\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"innerHandleOp\",\"inputs\": [{\"type\": \"bytes\",\"name\": \"callData\",\"internalType\": \"bytes\"},{\"type\": \"tuple\",\"name\": \"opInfo\",\"components\": [{\"type\": \"tuple\",\"name\": \"mUserOp\",\"components\": [{\"internalType\": \"address\",\"name\": \"sender\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"nonce\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"verificationGasLimit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"callGasLimit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"paymasterVerificationGasLimit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"paymasterPostOpGasLimit\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"preVerificationGas\",\"type\": \"uint256\"},{\"internalType\": \"address\",\"name\": \"paymaster\",\"type\": \"address\"},{\"internalType\": \"uint256\",\"name\": \"maxFeePerGas\",\"type\": \"uint256\"},{\"internalType\": \"uint256\",\"name\": \"maxPriorityFeePerGas\",\"type\": \"uint256\"}],\"internalType\": \"struct EntryPoint.MemoryUserOp\"},{\"type\": \"bytes32\",\"name\": \"userOpHash\",\"internalType\": \"bytes32\"},{\"type\": \"uint256\",\"name\": \"prefund\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"contextOffset\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"preOpGas\",\"internalType\": \"uint256\"}],\"internalType\": \"struct EntryPoint.UserOpInfo\"},{\"type\": \"bytes\",\"name\": \"context\",\"internalType\": \"bytes\"}],\"outputs\": [{\"type\": \"uint256\",\"name\": \"actualGasCost\",\"internalType\": \"uint256\"}],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"nonceSequenceNumber\",\"inputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"},{\"type\": \"uint192\",\"name\": \"\",\"internalType\": \"uint192\"}],\"outputs\": [{\"type\": \"uint256\",\"name\": \"\",\"internalType\": \"uint256\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"supportsInterface\",\"inputs\": [{\"type\": \"bytes4\",\"name\": \"interfaceId\",\"internalType\": \"bytes4\"}],\"outputs\": [{\"type\": \"bool\",\"name\": \"\",\"internalType\": \"bool\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"unlockStake\",\"inputs\": [],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"withdrawStake\",\"inputs\": [{\"type\": \"address\",\"name\": \"withdrawAddress\",\"internalType\": \"address payable\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"withdrawTo\",\"inputs\": [{\"type\": \"address\",\"name\": \"withdrawAddress\",\"internalType\": \"address payable\"},{\"type\": \"uint256\",\"name\": \"withdrawAmount\",\"internalType\": \"uint256\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"receive\",\"name\": \"\",\"inputs\": [],\"outputs\": [],\"stateMutability\": \"payable\"}]"; internal const string FACTORY_V06_ABI = - /*lang=json,strict*/ "[{\"type\": \"constructor\",\"name\": \"\",\"inputs\": [{\"type\": \"address\",\"name\": \"_defaultAdmin\",\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"_entrypoint\",\"internalType\": \"contract IEntryPoint\"},{\"type\": \"tuple[]\",\"name\": \"_defaultExtensions\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension[]\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"error\",\"name\": \"InvalidCodeAtRange\",\"inputs\": [{\"type\": \"uint256\",\"name\": \"_size\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"_start\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"_end\",\"internalType\": \"uint256\"}],\"outputs\": []},{\"type\": \"error\",\"name\": \"WriteError\",\"inputs\": [],\"outputs\": []},{\"type\": \"event\",\"name\": \"AccountCreated\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"accountAdmin\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ContractURIUpdated\",\"inputs\": [{\"type\": \"string\",\"name\": \"prevURI\",\"indexed\": false,\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"newURI\",\"indexed\": false,\"internalType\": \"string\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ExtensionAdded\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"tuple\",\"name\": \"extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"indexed\": false,\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ExtensionRemoved\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"tuple\",\"name\": \"extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"indexed\": false,\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ExtensionReplaced\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"tuple\",\"name\": \"extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"indexed\": false,\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"FunctionDisabled\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"indexed\": true,\"internalType\": \"bytes4\"},{\"type\": \"tuple\",\"name\": \"extMetadata\",\"components\": [{\"type\": \"string\",\"name\": \"name\",\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"metadataURI\",\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"internalType\": \"address\"}],\"indexed\": false,\"internalType\": \"struct IExtension.ExtensionMetadata\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"FunctionEnabled\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"indexed\": true,\"internalType\": \"bytes4\"},{\"type\": \"tuple\",\"name\": \"extFunction\",\"components\": [{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"internalType\": \"bytes4\"},{\"type\": \"string\",\"name\": \"functionSignature\",\"internalType\": \"string\"}],\"indexed\": false,\"internalType\": \"struct IExtension.ExtensionFunction\"},{\"type\": \"tuple\",\"name\": \"extMetadata\",\"components\": [{\"type\": \"string\",\"name\": \"name\",\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"metadataURI\",\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"internalType\": \"address\"}],\"indexed\": false,\"internalType\": \"struct IExtension.ExtensionMetadata\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"RoleAdminChanged\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"bytes32\",\"name\": \"previousAdminRole\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"bytes32\",\"name\": \"newAdminRole\",\"indexed\": true,\"internalType\": \"bytes32\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"RoleGranted\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"RoleRevoked\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"SignerAdded\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"signer\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"SignerRemoved\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"signer\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"fallback\",\"name\": \"\",\"inputs\": [],\"outputs\": [],\"stateMutability\": \"payable\"},{\"type\": \"function\",\"name\": \"DEFAULT_ADMIN_ROLE\",\"inputs\": [],\"outputs\": [{\"type\": \"bytes32\",\"name\": \"\",\"internalType\": \"bytes32\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"_disableFunctionInExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"_functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"accountImplementation\",\"inputs\": [],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"addExtension\",\"inputs\": [{\"type\": \"tuple\",\"name\": \"_extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"contractURI\",\"inputs\": [],\"outputs\": [{\"type\": \"string\",\"name\": \"\",\"internalType\": \"string\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"createAccount\",\"inputs\": [{\"type\": \"address\",\"name\": \"_admin\",\"internalType\": \"address\"},{\"type\": \"bytes\",\"name\": \"_data\",\"internalType\": \"bytes\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"defaultExtensions\",\"inputs\": [],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"disableFunctionInExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"_functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"enableFunctionInExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"},{\"type\": \"tuple\",\"name\": \"_function\",\"components\": [{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"internalType\": \"bytes4\"},{\"type\": \"string\",\"name\": \"functionSignature\",\"internalType\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"entrypoint\",\"inputs\": [],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAccounts\",\"inputs\": [{\"type\": \"uint256\",\"name\": \"_start\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"_end\",\"internalType\": \"uint256\"}],\"outputs\": [{\"type\": \"address[]\",\"name\": \"accounts\",\"internalType\": \"address[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAccountsOfSigner\",\"inputs\": [{\"type\": \"address\",\"name\": \"signer\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"address[]\",\"name\": \"accounts\",\"internalType\": \"address[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAddress\",\"inputs\": [{\"type\": \"address\",\"name\": \"_adminSigner\",\"internalType\": \"address\"},{\"type\": \"bytes\",\"name\": \"_data\",\"internalType\": \"bytes\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAllAccounts\",\"inputs\": [],\"outputs\": [{\"type\": \"address[]\",\"name\": \"\",\"internalType\": \"address[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAllExtensions\",\"inputs\": [],\"outputs\": [{\"type\": \"tuple[]\",\"name\": \"allExtensions\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"extensionName\",\"internalType\": \"string\"}],\"outputs\": [{\"type\": \"tuple\",\"name\": \"\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getImplementationForFunction\",\"inputs\": [{\"type\": \"bytes4\",\"name\": \"_functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getMetadataForFunction\",\"inputs\": [{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [{\"type\": \"tuple\",\"name\": \"\",\"components\": [{\"type\": \"string\",\"name\": \"name\",\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"metadataURI\",\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"internalType\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getRoleAdmin\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"}],\"outputs\": [{\"type\": \"bytes32\",\"name\": \"\",\"internalType\": \"bytes32\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getRoleMember\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"uint256\",\"name\": \"index\",\"internalType\": \"uint256\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"member\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getRoleMemberCount\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"}],\"outputs\": [{\"type\": \"uint256\",\"name\": \"count\",\"internalType\": \"uint256\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"grantRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"hasRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"bool\",\"name\": \"\",\"internalType\": \"bool\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"hasRoleWithSwitch\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"bool\",\"name\": \"\",\"internalType\": \"bool\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"isRegistered\",\"inputs\": [{\"type\": \"address\",\"name\": \"_account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"bool\",\"name\": \"\",\"internalType\": \"bool\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"multicall\",\"inputs\": [{\"type\": \"bytes[]\",\"name\": \"data\",\"internalType\": \"bytes[]\"}],\"outputs\": [{\"type\": \"bytes[]\",\"name\": \"results\",\"internalType\": \"bytes[]\"}],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"onRegister\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"_salt\",\"internalType\": \"bytes32\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"onSignerAdded\",\"inputs\": [{\"type\": \"address\",\"name\": \"_signer\",\"internalType\": \"address\"},{\"type\": \"bytes32\",\"name\": \"_salt\",\"internalType\": \"bytes32\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"onSignerRemoved\",\"inputs\": [{\"type\": \"address\",\"name\": \"_signer\",\"internalType\": \"address\"},{\"type\": \"bytes32\",\"name\": \"_salt\",\"internalType\": \"bytes32\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"removeExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"renounceRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"replaceExtension\",\"inputs\": [{\"type\": \"tuple\",\"name\": \"_extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"revokeRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"setContractURI\",\"inputs\": [{\"type\": \"string\",\"name\": \"_uri\",\"internalType\": \"string\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"totalAccounts\",\"inputs\": [],\"outputs\": [{\"type\": \"uint256\",\"name\": \"\",\"internalType\": \"uint256\"}],\"stateMutability\": \"view\"}]"; internal const string FACTORY_V07_ABI = FACTORY_V06_ABI; internal const string ACCOUNT_V06_ABI = - /*lang=json*/ "[{type: \"constructor\",inputs: [{name: \"_entrypoint\",type: \"address\",internalType: \"contract IEntryPoint\",},{ name: \"_factory\", type: \"address\", internalType: \"address\" },],stateMutability: \"nonpayable\",},{ type: \"receive\", stateMutability: \"payable\" },{type: \"function\",name: \"addDeposit\",inputs: [],outputs: [],stateMutability: \"payable\",},{type: \"function\",name: \"contractURI\",inputs: [],outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],stateMutability: \"view\",},{type: \"function\",name: \"entryPoint\",inputs: [],outputs: [{ name: \"\", type: \"address\", internalType: \"contract IEntryPoint\" },],stateMutability: \"view\",},{type: \"function\",name: \"execute\",inputs: [{ name: \"_target\", type: \"address\", internalType: \"address\" },{ name: \"_value\", type: \"uint256\", internalType: \"uint256\" },{ name: \"_calldata\", type: \"bytes\", internalType: \"bytes\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"executeBatch\",inputs: [{ name: \"_target\", type: \"address[]\", internalType: \"address[]\" },{ name: \"_value\", type: \"uint256[]\", internalType: \"uint256[]\" },{ name: \"_calldata\", type: \"bytes[]\", internalType: \"bytes[]\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"factory\",inputs: [],outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],stateMutability: \"view\",},{type: \"function\",name: \"getAllActiveSigners\",inputs: [],outputs: [{name: \"signers\",type: \"tuple[]\",internalType: \"struct IAccountPermissions.SignerPermissions[]\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{ name: \"startTimestamp\", type: \"uint128\", internalType: \"uint128\" },{ name: \"endTimestamp\", type: \"uint128\", internalType: \"uint128\" },],},],stateMutability: \"view\",},{type: \"function\",name: \"getAllAdmins\",inputs: [],outputs: [{ name: \"\", type: \"address[]\", internalType: \"address[]\" }],stateMutability: \"view\",},{type: \"function\",name: \"getAllSigners\",inputs: [],outputs: [{name: \"signers\",type: \"tuple[]\",internalType: \"struct IAccountPermissions.SignerPermissions[]\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{ name: \"startTimestamp\", type: \"uint128\", internalType: \"uint128\" },{ name: \"endTimestamp\", type: \"uint128\", internalType: \"uint128\" },],},],stateMutability: \"view\",},{type: \"function\",name: \"getMessageHash\",inputs: [{ name: \"_hash\", type: \"bytes32\", internalType: \"bytes32\" }],outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],stateMutability: \"view\",},{type: \"function\",name: \"getNonce\",inputs: [],outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],stateMutability: \"view\",},{type: \"function\",name: \"getPermissionsForSigner\",inputs: [{ name: \"signer\", type: \"address\", internalType: \"address\" }],outputs: [{name: \"\",type: \"tuple\",internalType: \"struct IAccountPermissions.SignerPermissions\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{ name: \"startTimestamp\", type: \"uint128\", internalType: \"uint128\" },{ name: \"endTimestamp\", type: \"uint128\", internalType: \"uint128\" },],},],stateMutability: \"view\",},{type: \"function\",name: \"initialize\",inputs: [{ name: \"_defaultAdmin\", type: \"address\", internalType: \"address\" },{ name: \"_data\", type: \"bytes\", internalType: \"bytes\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"isActiveSigner\",inputs: [{ name: \"signer\", type: \"address\", internalType: \"address\" }],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"isAdmin\",inputs: [{ name: \"_account\", type: \"address\", internalType: \"address\" }],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"isValidSignature\",inputs: [{ name: \"_hash\", type: \"bytes32\", internalType: \"bytes32\" },{ name: \"_signature\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"magicValue\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"view\",},{type: \"function\",name: \"isValidSigner\",inputs: [{ name: \"_signer\", type: \"address\", internalType: \"address\" },{name: \"_userOp\",type: \"tuple\",internalType: \"struct UserOperation\",components: [{ name: \"sender\", type: \"address\", internalType: \"address\" },{ name: \"nonce\", type: \"uint256\", internalType: \"uint256\" },{ name: \"initCode\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callGasLimit\", type: \"uint256\", internalType: \"uint256\" },{name: \"verificationGasLimit\",type: \"uint256\",internalType: \"uint256\",},{name: \"preVerificationGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"maxFeePerGas\", type: \"uint256\", internalType: \"uint256\" },{name: \"maxPriorityFeePerGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"paymasterAndData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"signature\", type: \"bytes\", internalType: \"bytes\" },],},],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"multicall\",inputs: [{ name: \"data\", type: \"bytes[]\", internalType: \"bytes[]\" }],outputs: [{ name: \"results\", type: \"bytes[]\", internalType: \"bytes[]\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"onERC1155BatchReceived\",inputs: [{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"uint256[]\", internalType: \"uint256[]\" },{ name: \"\", type: \"uint256[]\", internalType: \"uint256[]\" },{ name: \"\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"onERC1155Received\",inputs: [{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"uint256\", internalType: \"uint256\" },{ name: \"\", type: \"uint256\", internalType: \"uint256\" },{ name: \"\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"onERC721Received\",inputs: [{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"uint256\", internalType: \"uint256\" },{ name: \"\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"setContractURI\",inputs: [{ name: \"_uri\", type: \"string\", internalType: \"string\" }],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"setEntrypointOverride\",inputs: [{name: \"_entrypointOverride\",type: \"address\",internalType: \"contract IEntryPoint\",},],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"setPermissionsForSigner\",inputs: [{name: \"_req\",type: \"tuple\",internalType: \"struct IAccountPermissions.SignerPermissionRequest\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{ name: \"isAdmin\", type: \"uint8\", internalType: \"uint8\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{name: \"permissionStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"permissionEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{ name: \"uid\", type: \"bytes32\", internalType: \"bytes32\" },],},{ name: \"_signature\", type: \"bytes\", internalType: \"bytes\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"supportsInterface\",inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"validateUserOp\",inputs: [{name: \"userOp\",type: \"tuple\",internalType: \"struct UserOperation\",components: [{ name: \"sender\", type: \"address\", internalType: \"address\" },{ name: \"nonce\", type: \"uint256\", internalType: \"uint256\" },{ name: \"initCode\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callGasLimit\", type: \"uint256\", internalType: \"uint256\" },{name: \"verificationGasLimit\",type: \"uint256\",internalType: \"uint256\",},{name: \"preVerificationGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"maxFeePerGas\", type: \"uint256\", internalType: \"uint256\" },{name: \"maxPriorityFeePerGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"paymasterAndData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"signature\", type: \"bytes\", internalType: \"bytes\" },],},{ name: \"userOpHash\", type: \"bytes32\", internalType: \"bytes32\" },{ name: \"missingAccountFunds\", type: \"uint256\", internalType: \"uint256\" },],outputs: [{ name: \"validationData\", type: \"uint256\", internalType: \"uint256\" },],stateMutability: \"nonpayable\",},{type: \"function\",name: \"verifySignerPermissionRequest\",inputs: [{name: \"req\",type: \"tuple\",internalType: \"struct IAccountPermissions.SignerPermissionRequest\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{ name: \"isAdmin\", type: \"uint8\", internalType: \"uint8\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{name: \"permissionStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"permissionEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{ name: \"uid\", type: \"bytes32\", internalType: \"bytes32\" },],},{ name: \"signature\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"success\", type: \"bool\", internalType: \"bool\" },{ name: \"signer\", type: \"address\", internalType: \"address\" },],stateMutability: \"view\",},{type: \"function\",name: \"withdrawDepositTo\",inputs: [{name: \"withdrawAddress\",type: \"address\",internalType: \"address payable\",},{ name: \"amount\", type: \"uint256\", internalType: \"uint256\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"event\",name: \"AdminUpdated\",inputs: [{name: \"signer\",type: \"address\",indexed: true,internalType: \"address\",},{ name: \"isAdmin\", type: \"bool\", indexed: false, internalType: \"bool\" },],anonymous: false,},{type: \"event\",name: \"ContractURIUpdated\",inputs: [{name: \"prevURI\",type: \"string\",indexed: false,internalType: \"string\",},{name: \"newURI\",type: \"string\",indexed: false,internalType: \"string\",},],anonymous: false,},{type: \"event\",name: \"Initialized\",inputs: [{ name: \"version\", type: \"uint8\", indexed: false, internalType: \"uint8\" },],anonymous: false,},{type: \"event\",name: \"SignerPermissionsUpdated\",inputs: [{name: \"authorizingSigner\",type: \"address\",indexed: true,internalType: \"address\",},{name: \"targetSigner\",type: \"address\",indexed: true,internalType: \"address\",},{name: \"permissions\",type: \"tuple\",indexed: false,internalType: \"struct IAccountPermissions.SignerPermissionRequest\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{ name: \"isAdmin\", type: \"uint8\", internalType: \"uint8\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{name: \"permissionStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"permissionEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{ name: \"uid\", type: \"bytes32\", internalType: \"bytes32\" },],},],anonymous: false,},]"; internal const string ACCOUNT_V07_ABI = ACCOUNT_V06_ABI; } diff --git a/Thirdweb/Thirdweb.Utils/Utils.Types.cs b/Thirdweb/Thirdweb.Utils/Utils.Types.cs index 6933018e..817dda06 100644 --- a/Thirdweb/Thirdweb.Utils/Utils.Types.cs +++ b/Thirdweb/Thirdweb.Utils/Utils.Types.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using System.Numerics; +using System.Numerics; +using Newtonsoft.Json; namespace Thirdweb; diff --git a/Thirdweb/Thirdweb.Utils/Utils.cs b/Thirdweb/Thirdweb.Utils/Utils.cs index efd33154..cec2c9ef 100644 --- a/Thirdweb/Thirdweb.Utils/Utils.cs +++ b/Thirdweb/Thirdweb.Utils/Utils.cs @@ -712,7 +712,7 @@ public static async Task IsEip155Enforced(ThirdwebClient client, BigIntege "chainid no support", "chainid (0)", "chainid(0)", - "invalid sender" + "invalid sender", }; if (errorSubstrings.Any(errorMsg.Contains)) @@ -1156,7 +1156,7 @@ public static (ThirdwebTransactionInput transactionInput, string signature) Deco maxPriorityFeePerGas: maxPriorityFeePerGas ) { - AuthorizationList = authorizations + AuthorizationList = authorizations, }, signature.CreateStringSignature() ); @@ -1186,7 +1186,7 @@ public static List DecodeAutorizationList(byte[] authoriza Nonce = new HexBigInteger(decodedItem[2].RLPData.ToBigIntegerFromRLPDecoded()).HexValue, YParity = signature.V.BytesToHex(), R = signature.R.BytesToHex(), - S = signature.S.BytesToHex() + S = signature.S.BytesToHex(), }; authorizationLists.Add(authorizationListItem); } @@ -1221,7 +1221,7 @@ public static async void TrackTransaction(ThirdwebTransaction transaction, strin walletAddress = await wallet.GetAddress().ConfigureAwait(false), walletType = wallet.WalletId, contractAddress = transaction.Input.To, - gasPrice = transaction.Input.GasPrice?.Value ?? transaction.Input.MaxFeePerGas?.Value + gasPrice = transaction.Input.GasPrice?.Value ?? transaction.Input.MaxFeePerGas?.Value, } ), Encoding.UTF8, diff --git a/Thirdweb/Thirdweb.Wallets/EIP712.cs b/Thirdweb/Thirdweb.Wallets/EIP712.cs index 8588ecc9..0867bd43 100644 --- a/Thirdweb/Thirdweb.Wallets/EIP712.cs +++ b/Thirdweb/Thirdweb.Wallets/EIP712.cs @@ -487,7 +487,7 @@ private static string SerializeEip712(AccountAbstraction.ZkSyncAATransaction tra // add array of rlp encoded paymaster/paymasterinput transaction.Paymaster != 0 ? RLP.EncodeElement(transaction.Paymaster.ToByteArray(isUnsigned: true, isBigEndian: true)).Concat(RLP.EncodeElement(transaction.PaymasterInput)).ToArray() - : new byte[] { 0xc0 } + : new byte[] { 0xc0 }, }; return "0x71" + RLP.EncodeDataItemsAsElementOrListAndCombineAsList(fields.ToArray(), _indexOfListDataItems).ToHex(); diff --git a/Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs b/Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs index c9520d58..c9b04059 100644 --- a/Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs +++ b/Thirdweb/Thirdweb.Wallets/EIP712Encoder.cs @@ -1,11 +1,11 @@ +using System.Collections; +using System.Numerics; using System.Text; -using Nethereum.Hex.HexConvertors.Extensions; using Nethereum.ABI; +using Nethereum.ABI.EIP712; using Nethereum.ABI.FunctionEncoding; +using Nethereum.Hex.HexConvertors.Extensions; using Nethereum.Util; -using System.Collections; -using System.Numerics; -using Nethereum.ABI.EIP712; namespace Thirdweb; @@ -268,10 +268,10 @@ public TypedData GenerateTypedData(T data, TDomain domain, Types = new Dictionary { [primaryTypeName] = typeMembers.ToArray(), - ["EIP712Domain"] = MemberDescriptionFactory.GetTypesMemberDescription(typeof(TDomain))["EIP712Domain"] + ["EIP712Domain"] = MemberDescriptionFactory.GetTypesMemberDescription(typeof(TDomain))["EIP712Domain"], }, Message = typeValues.ToArray(), - Domain = domain + Domain = domain, }; return result; diff --git a/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs b/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs index 78cfdd52..44663513 100644 --- a/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs @@ -200,7 +200,7 @@ public enum ThirdwebAccountType { PrivateKeyAccount, SmartAccount, - ExternalAccount + ExternalAccount, } /// diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs index 53c5ae59..8e2b00de 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs @@ -16,7 +16,7 @@ public enum ExecutionMode { EOA, EIP7702, - EIP7702Sponsored + EIP7702Sponsored, } /// @@ -195,7 +195,7 @@ public static async Task Create( executionMode ) { - Address = userAddress + Address = userAddress, }; } catch @@ -216,7 +216,7 @@ public static async Task Create( executionMode ) { - Address = null + Address = null, }; } } @@ -316,8 +316,8 @@ private async Task PostAuth(Server.VerifyResult result) private async Task MigrateShardToEnclave(Server.VerifyResult authResult) { - var (address, encryptedPrivateKeyB64, ivB64, kmsCiphertextB64) = await this.EmbeddedWallet - .GenerateEncryptionDataAsync(authResult.AuthToken, this.LegacyEncryptionKey ?? authResult.RecoveryCode) + var (address, encryptedPrivateKeyB64, ivB64, kmsCiphertextB64) = await this + .EmbeddedWallet.GenerateEncryptionDataAsync(authResult.AuthToken, this.LegacyEncryptionKey ?? authResult.RecoveryCode) .ConfigureAwait(false); var url = $"{ENCLAVE_PATH}/migrate"; @@ -326,7 +326,7 @@ private async Task MigrateShardToEnclave(Server.VerifyResult authResult) address, encryptedPrivateKeyB64, ivB64, - kmsCiphertextB64 + kmsCiphertextB64, }; var requestContent = new StringContent(JsonConvert.SerializeObject(payload), Encoding.UTF8, "application/json"); @@ -492,7 +492,7 @@ public async Task CreateSessionKey( ExpiresAt = Utils.GetUnixTimeStampNow() + durationInSeconds, CallPolicies = callPolicies ?? new List(), TransferPolicies = transferPolicies ?? new List(), - Uid = uid ?? Guid.NewGuid().ToByteArray() + Uid = uid ?? Guid.NewGuid().ToByteArray(), }; var userWalletAddress = await this.GetAddress(); @@ -643,8 +643,8 @@ public async Task> UnlinkAccount(LinkedAccount accountToUnli Email = linkedAccount.Details?.Email, Address = linkedAccount.Details?.Address, Phone = linkedAccount.Details?.Phone, - Id = linkedAccount.Details?.Id - } + Id = linkedAccount.Details?.Id, + }, } ); } @@ -770,8 +770,8 @@ public async Task> LinkAccount( Email = linkedAccount.Details?.Email, Address = linkedAccount.Details?.Address, Phone = linkedAccount.Details?.Phone, - Id = linkedAccount.Details?.Id - } + Id = linkedAccount.Details?.Id, + }, } ); } @@ -794,8 +794,8 @@ public async Task> GetLinkedAccounts() Email = linkedAccount.Details?.Email, Address = linkedAccount.Details?.Address, Phone = linkedAccount.Details?.Phone, - Id = linkedAccount.Details?.Id - } + Id = linkedAccount.Details?.Id, + }, } ); } @@ -838,11 +838,9 @@ public async Task SendOTP() } var serverRes = - string.IsNullOrEmpty(this.Email) && string.IsNullOrEmpty(this.PhoneNumber) - ? throw new Exception("Email or Phone Number is required for OTP login") - : this.Email == null - ? await this.EmbeddedWallet.VerifyPhoneOtpAsync(this.PhoneNumber, otp).ConfigureAwait(false) - : await this.EmbeddedWallet.VerifyEmailOtpAsync(this.Email, otp).ConfigureAwait(false); + string.IsNullOrEmpty(this.Email) && string.IsNullOrEmpty(this.PhoneNumber) ? throw new Exception("Email or Phone Number is required for OTP login") + : this.Email == null ? await this.EmbeddedWallet.VerifyPhoneOtpAsync(this.PhoneNumber, otp).ConfigureAwait(false) + : await this.EmbeddedWallet.VerifyEmailOtpAsync(this.Email, otp).ConfigureAwait(false); return serverRes; } @@ -1258,22 +1256,19 @@ public async Task SignTransaction(ThirdwebTransactionInput transaction) maxPriorityFeePerGas = transaction.MaxPriorityFeePerGas, chainId = transaction.ChainId, authorizationList = transaction.AuthorizationList != null && transaction.AuthorizationList.Count > 0 - ? transaction.AuthorizationList - .Select( - authorization => - new - { - chainId = authorization.ChainId.HexToNumber(), - address = authorization.Address, - nonce = authorization.Nonce.HexToNumber().ToString(), - yParity = authorization.YParity.HexToNumber(), - r = authorization.R.HexToNumber().ToString(), - s = authorization.S.HexToNumber().ToString() - } - ) + ? transaction + .AuthorizationList.Select(authorization => new + { + chainId = authorization.ChainId.HexToNumber(), + address = authorization.Address, + nonce = authorization.Nonce.HexToNumber().ToString(), + yParity = authorization.YParity.HexToNumber(), + r = authorization.R.HexToNumber().ToString(), + s = authorization.S.HexToNumber().ToString(), + }) .ToArray() - : null - } + : null, + }, }; var url = $"{ENCLAVE_PATH}/sign-transaction"; @@ -1308,8 +1303,8 @@ public async Task SendTransaction(ThirdwebTransactionInput transaction) { Target = transaction.To, Value = transaction.Value?.Value ?? BigInteger.Zero, - Data = transaction.Data.HexToBytes() - } + Data = transaction.Data.HexToBytes(), + }, }; switch (this.ExecutionMode) @@ -1441,7 +1436,7 @@ public async Task SignAuthorization(BigInteger chainId, st { address = contractAddress, chainId, - nonce + nonce, }; var requestContent = new StringContent(JsonConvert.SerializeObject(payload), Encoding.UTF8, "application/json"); diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs index 6444660e..5662f71b 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs @@ -49,7 +49,7 @@ private static async Task GetTemporaryCredentialsAsync(string id { AccessKeyId = credentialsResponse.Credentials.AccessKeyId, SecretAccessKey = credentialsResponse.Credentials.SecretKey, - SessionToken = credentialsResponse.Credentials.SessionToken + SessionToken = credentialsResponse.Credentials.SessionToken, }; } diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs index 8c750ca1..a2623840 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs @@ -108,13 +108,12 @@ internal override async Task FetchAuthShareAsync(string authToken) // embedded-wallet/embedded-wallet-shares GET private async Task FetchRemoteSharesAsync(string authToken, bool wantsRecoveryShare) { - Dictionary queryParams = - new() - { - { "getEncryptedAuthShare", "true" }, - { "getEncryptedRecoveryShare", wantsRecoveryShare ? "true" : "false" }, - { "useSealedSecret", "false" } - }; + Dictionary queryParams = new() + { + { "getEncryptedAuthShare", "true" }, + { "getEncryptedRecoveryShare", wantsRecoveryShare ? "true" : "false" }, + { "useSealedSecret", "false" }, + }; var uri = MakeUri2023("/embedded-wallet/embedded-wallet-shares", queryParams); var response = await this.SendHttpWithAuthAsync(uri, authToken).ConfigureAwait(false); await CheckStatusCodeAsync(response).ConfigureAwait(false); @@ -389,7 +388,7 @@ private static async Task DeserializeAsync(ThirdwebHttpResponseMessage res private static Uri MakeUri2024(string path, IDictionary parameters = null) { - UriBuilder b = new(ROOT_URL) { Path = API_ROOT_PATH_2024 + path, }; + UriBuilder b = new(ROOT_URL) { Path = API_ROOT_PATH_2024 + path }; if (parameters != null && parameters.Any()) { var queryString = string.Join('&', parameters.Select((p) => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); @@ -400,7 +399,7 @@ private static Uri MakeUri2024(string path, IDictionary paramete private static Uri MakeUri2023(string path, IDictionary parameters = null) { - UriBuilder b = new(ROOT_URL) { Path = API_ROOT_PATH_2023 + path, }; + UriBuilder b = new(ROOT_URL) { Path = API_ROOT_PATH_2023 + path }; if (parameters != null && parameters.Any()) { var queryString = string.Join('&', parameters.Select((p) => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); @@ -418,7 +417,7 @@ private static StringContent MakeHttpContent(object data) private static string Serialize(object data) { - JsonSerializer jsonSerializer = new() { NullValueHandling = NullValueHandling.Ignore, }; + JsonSerializer jsonSerializer = new() { NullValueHandling = NullValueHandling.Ignore }; StringWriter stringWriter = new(); jsonSerializer.Serialize(stringWriter, data); var rv = stringWriter.ToString(); diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs index b90fbb84..075d9ae4 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs @@ -107,13 +107,13 @@ private static (string deviceShare, string recoveryShare, string authShare) Crea private static async Task GetEncryptionKeyAsync(string password, byte[] salt, int iterationCount) { return await Task.Run(() => - { - var generator = new Pkcs5S2ParametersGenerator(new Sha256Digest()); - var keyLength = KEY_SIZE * 8; // will be redivided by 8 internally - generator.Init(Encoding.UTF8.GetBytes(password), salt, iterationCount); - var keyParam = (KeyParameter)generator.GenerateDerivedMacParameters(keyLength); - return keyParam.GetKey(); - }) + { + var generator = new Pkcs5S2ParametersGenerator(new Sha256Digest()); + var keyLength = KEY_SIZE * 8; // will be redivided by 8 internally + generator.Init(Encoding.UTF8.GetBytes(password), salt, iterationCount); + var keyParam = (KeyParameter)generator.GenerateDerivedMacParameters(keyLength); + return keyParam.GetKey(); + }) .ConfigureAwait(false); } @@ -123,8 +123,6 @@ private static Account MakeAccountFromShares(params string[] shares) var encodedSecret = secrets.Combine(shares); var secret = Encoding.ASCII.GetString(Secrets.GetBytes(encodedSecret)); - return !secret.StartsWith(WALLET_PRIVATE_KEY_PREFIX) - ? throw new InvalidOperationException($"Corrupted share encountered {secret}") - : new Account(secret.Split(WALLET_PRIVATE_KEY_PREFIX)[1]); + return !secret.StartsWith(WALLET_PRIVATE_KEY_PREFIX) ? throw new InvalidOperationException($"Corrupted share encountered {secret}") : new Account(secret.Split(WALLET_PRIVATE_KEY_PREFIX)[1]); } } diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs index 8fc0d55c..a55c0868 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs @@ -11,7 +11,7 @@ internal class Secrets private const int NHexDigitBits = 4; private readonly Func _getRandomInt32 = (nBits) => RandomNumberGenerator.GetInt32(1, 1 << nBits); private static readonly string _padding = string.Join("", Enumerable.Repeat("0", Defaults.MaxPaddingMultiple)); - private static readonly string[] _nybbles = { "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111", }; + private static readonly string[] _nybbles = { "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" }; /// /// Reconsitute a secret from . @@ -305,11 +305,9 @@ private static ShareComponents ExtractShareComponents(string share) private static int GetLargeBaseValue(char ch) { var rv = - ch >= 'a' - ? ch - 'a' + 10 - : ch >= 'A' - ? ch - 'A' + 10 - : ch - '0'; + ch >= 'a' ? ch - 'a' + 10 + : ch >= 'A' ? ch - 'A' + 10 + : ch - '0'; return rv; } @@ -453,7 +451,7 @@ private class Defaults // These are primitive polynomial coefficients for Galois Fields GF(2^n) for 2 <= n <= 20. The index of each term in the // array corresponds to the n for that polynomial. - internal static readonly int[] PrimitivePolynomialCoefficients = { -1, -1, 1, 3, 3, 5, 3, 3, 29, 17, 9, 5, 83, 27, 43, 3, 45, 9, 39, 39, 9, }; + internal static readonly int[] PrimitivePolynomialCoefficients = { -1, -1, 1, 3, 3, 5, 3, 3, 29, 17, 9, 5, 83, 27, 43, 3, 45, 9, 39, 39, 9 }; } private class ShareComponents diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs index ccbb7cbc..4aee8932 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs @@ -1,7 +1,6 @@ namespace Thirdweb.EWS; -internal class VerificationException -(bool canRetry) : Exception +internal class VerificationException(bool canRetry) : Exception { internal bool CanRetry { get; } = canRetry; } diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AccountLinking.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AccountLinking.cs index 0e1335aa..4cf9917c 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AccountLinking.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AccountLinking.cs @@ -12,8 +12,8 @@ internal partial class EmbeddedWallet Email = linkedAccount.Details.Email, Address = linkedAccount.Details.Address, Phone = linkedAccount.Details.Phone, - Id = linkedAccount.Details.Id - } + Id = linkedAccount.Details.Id, + }, }; return await this._server.UnlinkAccountAsync(currentAccountToken, serverLinkedAccount).ConfigureAwait(false); } diff --git a/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs b/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs index 1529d492..d249044d 100644 --- a/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs @@ -358,7 +358,7 @@ public virtual Task SignTransaction(ThirdwebTransactionInput transaction RLP.EncodeElement(authorizationList.Nonce.HexToNumber().ToByteArrayForRLPEncoding()), RLP.EncodeElement(authorizationList.YParity is "0x00" or "0x0" or "0x" ? Array.Empty() : authorizationList.YParity.HexToBytes()), RLP.EncodeElement(authorizationList.R.HexToBytes().TrimZeroes()), - RLP.EncodeElement(authorizationList.S.HexToBytes().TrimZeroes()) + RLP.EncodeElement(authorizationList.S.HexToBytes().TrimZeroes()), }; encodedAuthorizationList.Add(RLP.EncodeList(encodedItem.ToArray())); } @@ -467,7 +467,7 @@ public async Task SignAuthorization(BigInteger chainId, st { RLP.EncodeElement(chainId.ToByteArrayForRLPEncoding()), RLP.EncodeElement(contractAddress.HexToBytes()), - RLP.EncodeElement(nonce.ToByteArrayForRLPEncoding()) + RLP.EncodeElement(nonce.ToByteArrayForRLPEncoding()), }; var encodedBytes = RLP.EncodeList(encodedData.ToArray()); var returnElements = new byte[encodedBytes.Length + 1]; diff --git a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs index 8f36b9b4..717952df 100644 --- a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs @@ -16,7 +16,7 @@ public enum TokenPaymaster NONE, BASE_USDC, CELO_CUSD, - LISK_LSK + LISK_LSK, } public class SmartWallet : IThirdwebWallet @@ -53,50 +53,49 @@ private struct TokenPaymasterConfig public BigInteger BalanceStorageSlot; } - private static readonly Dictionary _tokenPaymasterConfig = - new() + private static readonly Dictionary _tokenPaymasterConfig = new() + { { + TokenPaymaster.NONE, + new TokenPaymasterConfig() { - TokenPaymaster.NONE, - new TokenPaymasterConfig() - { - ChainId = 0, - PaymasterAddress = null, - TokenAddress = null, - BalanceStorageSlot = 0 - } - }, + ChainId = 0, + PaymasterAddress = null, + TokenAddress = null, + BalanceStorageSlot = 0, + } + }, + { + TokenPaymaster.BASE_USDC, + new TokenPaymasterConfig() { - TokenPaymaster.BASE_USDC, - new TokenPaymasterConfig() - { - ChainId = 8453, - PaymasterAddress = "0x2222f2738BE6bB7aA0Bfe4AEeAf2908172CF5539", - TokenAddress = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - BalanceStorageSlot = 9 - } - }, + ChainId = 8453, + PaymasterAddress = "0x2222f2738BE6bB7aA0Bfe4AEeAf2908172CF5539", + TokenAddress = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", + BalanceStorageSlot = 9, + } + }, + { + TokenPaymaster.CELO_CUSD, + new TokenPaymasterConfig() { - TokenPaymaster.CELO_CUSD, - new TokenPaymasterConfig() - { - ChainId = 42220, - PaymasterAddress = "0x3feA3c5744D715ff46e91C4e5C9a94426DfF2aF9", - TokenAddress = "0x765DE816845861e75A25fCA122bb6898B8B1282a", - BalanceStorageSlot = 9 - } - }, + ChainId = 42220, + PaymasterAddress = "0x3feA3c5744D715ff46e91C4e5C9a94426DfF2aF9", + TokenAddress = "0x765DE816845861e75A25fCA122bb6898B8B1282a", + BalanceStorageSlot = 9, + } + }, + { + TokenPaymaster.LISK_LSK, + new TokenPaymasterConfig() { - TokenPaymaster.LISK_LSK, - new TokenPaymasterConfig() - { - ChainId = 1135, - PaymasterAddress = "0x9eb8cf7fBa5ed9EeDCC97a0d52254cc0e9B1AC25", - TokenAddress = "0xac485391EB2d7D88253a7F1eF18C37f4242D1A24", - BalanceStorageSlot = 9 - } + ChainId = 1135, + PaymasterAddress = "0x9eb8cf7fBa5ed9EeDCC97a0d52254cc0e9B1AC25", + TokenAddress = "0xac485391EB2d7D88253a7F1eF18C37f4242D1A24", + BalanceStorageSlot = 9, } - }; + }, + }; private bool UseERC20Paymaster => !string.IsNullOrEmpty(this._erc20PaymasterAddress) && !string.IsNullOrEmpty(this._erc20PaymasterToken); @@ -286,7 +285,7 @@ public async Task ForceDeploy() { Data = "0x", To = this._accountContract.Address, - Value = new HexBigInteger(0) + Value = new HexBigInteger(0), }; var txHash = await this.SendTransaction(input).ConfigureAwait(false); _ = await ThirdwebTransaction.WaitForTransactionReceipt(this.Client, this.ActiveChainId, txHash).ConfigureAwait(false); @@ -321,15 +320,15 @@ public async Task IsValidSignature(string message, string signature) { Target = erc6492Sig.Create2Factory, AllowFailure = true, - CallData = erc6492Sig.FactoryCalldata + CallData = erc6492Sig.FactoryCalldata, }, new() { Target = this._accountContract.Address, AllowFailure = true, - CallData = this._accountContract.CreateCallData("isValidSignature", message.HashPrefixedMessage().HexToBytes(), erc6492Sig.SigToValidate).HexToBytes() - } - } + CallData = this._accountContract.CreateCallData("isValidSignature", message.HashPrefixedMessage().HexToBytes(), erc6492Sig.SigToValidate).HexToBytes(), + }, + }, } ) .ConfigureAwait(false); @@ -433,7 +432,7 @@ string reqValidityEndTimestamp PermissionEndTimestamp = BigInteger.Parse(permissionEndTimestamp), ReqValidityStartTimestamp = BigInteger.Parse(reqValidityStartTimestamp), ReqValidityEndTimestamp = BigInteger.Parse(reqValidityEndTimestamp), - Uid = Guid.NewGuid().ToByteArray() + Uid = Guid.NewGuid().ToByteArray(), }; var signature = await EIP712 @@ -445,7 +444,7 @@ string reqValidityEndTimestamp { To = this._accountContract.Address, Value = new HexBigInteger(0), - Data = data + Data = data, }; var txHash = await this.SendTransaction(txInput).ConfigureAwait(false); return await ThirdwebTransaction.WaitForTransactionReceipt(this.Client, this.ActiveChainId, txHash).ConfigureAwait(false); @@ -485,7 +484,7 @@ public async Task AddAdmin(string admin) PermissionEndTimestamp = Utils.GetUnixTimeStampIn10Years(), ReqValidityStartTimestamp = Utils.GetUnixTimeStampNow() - 3600, ReqValidityEndTimestamp = Utils.GetUnixTimeStampIn10Years(), - Uid = Guid.NewGuid().ToByteArray() + Uid = Guid.NewGuid().ToByteArray(), }; var signature = await EIP712.GenerateSignature_SmartAccount("Account", "1", this.ActiveChainId, await this.GetAddress(), request, this._personalAccount).ConfigureAwait(false); @@ -494,7 +493,7 @@ public async Task AddAdmin(string admin) { To = this._accountContract.Address, Value = new HexBigInteger(0), - Data = data + Data = data, }; var txHash = await this.SendTransaction(txInput).ConfigureAwait(false); return await ThirdwebTransaction.WaitForTransactionReceipt(this.Client, this.ActiveChainId, txHash).ConfigureAwait(false); @@ -522,7 +521,7 @@ public async Task RemoveAdmin(string admin) PermissionEndTimestamp = Utils.GetUnixTimeStampIn10Years(), ReqValidityStartTimestamp = Utils.GetUnixTimeStampNow() - 3600, ReqValidityEndTimestamp = Utils.GetUnixTimeStampIn10Years(), - Uid = Guid.NewGuid().ToByteArray() + Uid = Guid.NewGuid().ToByteArray(), }; var signature = await EIP712 @@ -533,7 +532,7 @@ public async Task RemoveAdmin(string admin) { To = this._accountContract.Address, Value = new HexBigInteger(0), - Data = data + Data = data, }; var txHash = await this.SendTransaction(txInput).ConfigureAwait(false); return await ThirdwebTransaction.WaitForTransactionReceipt(this.Client, this.ActiveChainId, txHash).ConfigureAwait(false); @@ -914,7 +913,7 @@ private async Task HashAndSignUserOp(UserOperationV7 userOp, ThirdwebCon PreVerificationGas = userOp.PreVerificationGas, GasFees = gasFeesBuffer, PaymasterAndData = Array.Empty(), - Signature = userOp.Signature + Signature = userOp.Signature, }; } else @@ -939,7 +938,7 @@ private async Task HashAndSignUserOp(UserOperationV7 userOp, ThirdwebCon PreVerificationGas = userOp.PreVerificationGas, GasFees = gasFeesBuffer, PaymasterAndData = paymasterAndDataBuffer, - Signature = userOp.Signature + Signature = userOp.Signature, }; } @@ -967,7 +966,7 @@ private static UserOperationHexifiedV6 EncodeUserOperation(UserOperationV6 userO MaxFeePerGas = userOperation.MaxFeePerGas.ToHexBigInteger().HexValue, MaxPriorityFeePerGas = userOperation.MaxPriorityFeePerGas.ToHexBigInteger().HexValue, PaymasterAndData = userOperation.PaymasterAndData.BytesToHex(), - Signature = userOperation.Signature.BytesToHex() + Signature = userOperation.Signature.BytesToHex(), }; } @@ -989,7 +988,7 @@ private static UserOperationHexifiedV7 EncodeUserOperation(UserOperationV7 userO PaymasterVerificationGasLimit = userOperation.PaymasterVerificationGasLimit.ToHexBigInteger().HexValue, PaymasterPostOpGasLimit = userOperation.PaymasterPostOpGasLimit.ToHexBigInteger().HexValue, PaymasterData = userOperation.PaymasterData.BytesToHex(), - Signature = userOperation.Signature.BytesToHex() + Signature = userOperation.Signature.BytesToHex(), }; } @@ -1035,7 +1034,7 @@ public async Task SendTransaction(ThirdwebTransactionInput transactionIn maxPriorityFeePerGas = zkTx.MaxPriorityFeePerGas.ToString(), chainId = this.ActiveChainId.ToString(), signedTransaction = zkTxSigned, - paymaster + paymaster, } ) .ConfigureAwait(false); diff --git a/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs index 748d4b2e..c7cdc037 100644 --- a/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs +++ b/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs @@ -625,7 +625,7 @@ public object EncodeForHttp() { target = this.Target, value = this.Value, - data = this.Data != null ? this.Data.BytesToHex() : "0x" + data = this.Data != null ? this.Data.BytesToHex() : "0x", }; } } diff --git a/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs index eb58d9f5..d8ab8c74 100644 --- a/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs +++ b/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs @@ -33,7 +33,7 @@ public static async Task TwExecute( nonce = authorization?.Nonce.HexToNumber().ToString(), yParity = authorization?.YParity.HexToNumber(), r = authorization?.R.HexToNumber().ToString(), - s = authorization?.S.HexToNumber().ToString() + s = authorization?.S.HexToNumber().ToString(), } ) .ConfigureAwait(false); diff --git a/Thirdweb/Thirdweb.csproj b/Thirdweb/Thirdweb.csproj index 20461857..f457c592 100644 --- a/Thirdweb/Thirdweb.csproj +++ b/Thirdweb/Thirdweb.csproj @@ -1,10 +1,12 @@ - - $(DefaultTargetFrameworks) - $(DefaultVersion) - $(DefaultVersion) - $(DefaultVersion) + netstandard2.1;net6.0;net7.0;net8.0 + 2.24.1 + 2.24.1 + 2.24.1 + latest + true + enable Thirdweb Thirdweb 0xfirekeeper @@ -18,27 +20,24 @@ true Apache-2.0 - README.md true $(NoWarn);1591 - - - - - - - - - + + + + + + + + + - - - \ No newline at end of file + diff --git a/nswag.json b/nswag.json new file mode 100644 index 00000000..ef8f4823 --- /dev/null +++ b/nswag.json @@ -0,0 +1,70 @@ +{ + "runtime": "Net80", + "defaultVariables": null, + "documentGenerator": { + "fromDocument": { + "url": "https://api.thirdweb.com/openapi.json", + "output": null + } + }, + "codeGenerators": { + "openApiToCSharpClient": { + "clientBaseClass": null, + "generateClientClasses": true, + "generateClientInterfaces": false, + "generateDtoTypes": true, + "injectHttpClient": true, + "disposeHttpClient": false, + "generateExceptionClasses": true, + "exceptionClass": "ThirdwebApiException", + "wrapDtoExceptions": true, + "useHttpClientCreationMethod": false, + "httpClientType": "System.Net.Http.HttpClient", + "useHttpRequestMessageCreationMethod": false, + "useBaseUrl": true, + "generateBaseUrlProperty": true, + "generateSyncMethods": false, + "exposeJsonSerializerSettings": false, + "clientClassAccessModifier": "internal", + "typeAccessModifier": "public", + "generateContractsOutput": false, + "parameterDateTimeFormat": "s", + "generateUpdateJsonSerializerSettingsMethod": true, + "serializeTypeInformation": false, + "queryNullValue": "", + "className": "ThirdwebApiClient", + "operationGenerationMode": "SingleClientFromOperationId", + "generateOptionalParameters": false, + "generateJsonMethods": false, + "parameterArrayType": "System.Collections.Generic.IEnumerable", + "parameterDictionaryType": "System.Collections.Generic.IDictionary", + "responseArrayType": "System.Collections.Generic.List", + "responseDictionaryType": "System.Collections.Generic.Dictionary", + "wrapResponses": false, + "generateResponseClasses": true, + "responseClass": "ApiResponse", + "namespace": "Thirdweb.Api", + "requiredPropertiesMustBeDefined": true, + "dateType": "System.DateTime", + "dateTimeType": "System.DateTime", + "timeType": "System.TimeSpan", + "timeSpanType": "System.TimeSpan", + "arrayType": "System.Collections.Generic.List", + "arrayInstanceType": "System.Collections.Generic.List", + "dictionaryType": "System.Collections.Generic.Dictionary", + "dictionaryInstanceType": "System.Collections.Generic.Dictionary", + "arrayBaseType": "System.Collections.Generic.List", + "dictionaryBaseType": "System.Collections.Generic.Dictionary", + "classStyle": "Poco", + "generateDefaultValues": true, + "generateDataAnnotations": true, + "excludedTypeNames": [], + "handleReferences": false, + "generateImmutableArrayProperties": false, + "generateImmutableDictionaryProperties": false, + "jsonConverters": null, + "anyType": "object", + "output": "Thirdweb/Thirdweb.Api/GeneratedClient.cs" + } + } +} diff --git a/thirdweb.sln b/thirdweb.sln index ae00ee2e..d2de2199 100644 --- a/thirdweb.sln +++ b/thirdweb.sln @@ -33,7 +33,6 @@ Global {98BA8071-A8BF-44A5-9DDC-7BBDE4E732E8}.Release|x64.Build.0 = Release|Any CPU {98BA8071-A8BF-44A5-9DDC-7BBDE4E732E8}.Release|x86.ActiveCfg = Release|Any CPU {98BA8071-A8BF-44A5-9DDC-7BBDE4E732E8}.Release|x86.Build.0 = Release|Any CPU - {D78B4271-7DE9-4C54-BB97-31FBBD25A093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D78B4271-7DE9-4C54-BB97-31FBBD25A093}.Debug|Any CPU.Build.0 = Debug|Any CPU {D78B4271-7DE9-4C54-BB97-31FBBD25A093}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -46,7 +45,6 @@ Global {D78B4271-7DE9-4C54-BB97-31FBBD25A093}.Release|x64.Build.0 = Release|Any CPU {D78B4271-7DE9-4C54-BB97-31FBBD25A093}.Release|x86.ActiveCfg = Release|Any CPU {D78B4271-7DE9-4C54-BB97-31FBBD25A093}.Release|x86.Build.0 = Release|Any CPU - {7CEBE316-4F2E-433B-8B1D-CBE8F8EE328F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7CEBE316-4F2E-433B-8B1D-CBE8F8EE328F}.Debug|Any CPU.Build.0 = Debug|Any CPU {7CEBE316-4F2E-433B-8B1D-CBE8F8EE328F}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/tw.bat b/tw.bat new file mode 100644 index 00000000..675ad8b7 --- /dev/null +++ b/tw.bat @@ -0,0 +1,146 @@ +@echo off +REM Thirdweb Build Script +REM Usage: tw.bat [command] + +REM Check if command was provided +if "%1"=="" goto help +if "%1"=="help" goto help +if "%1"=="clean-api" goto clean-api +if "%1"=="generate-api" goto generate-api +if "%1"=="build" goto build +if "%1"=="clean" goto clean +if "%1"=="restore" goto restore +if "%1"=="test" goto test +if "%1"=="pack" goto pack +if "%1"=="run" goto run +if "%1"=="lint" goto lint +if "%1"=="fix" goto fix +goto help + +:clean-api +echo Cleaning generated API files... +if exist "Thirdweb\Thirdweb.Api\GeneratedClient.cs" ( + echo Removing generated client file... + del /q "Thirdweb\Thirdweb.Api\GeneratedClient.cs" +) else ( + echo No generated client file to clean +) +echo Clean completed! +goto end + +:generate-api +echo Generating Thirdweb API client with NSwag... + +REM Check if NSwag is installed +nswag version >nul 2>&1 +if errorlevel 1 ( + echo NSwag CLI is not installed. Installing via dotnet tool... + dotnet tool install --global NSwag.ConsoleCore + if errorlevel 1 ( + echo Failed to install NSwag CLI + goto end + ) +) + +REM Generate API client using NSwag +echo Running NSwag to generate client... +nswag run nswag.json +if errorlevel 1 ( + echo Failed to generate API client + goto end +) + +echo API client generation complete! +goto end + +:build +echo Building solution... +REM First generate the API if it doesn't exist +if not exist "Thirdweb\Thirdweb.Api\GeneratedClient.cs" ( + echo API client not found, generating it first... + call :generate-api + if errorlevel 1 goto end +) +dotnet build +goto end + +:clean +echo Cleaning solution... +dotnet clean +goto end + +:restore +echo Restoring packages... +dotnet restore +goto end + +:test +echo Running tests... +dotnet test +goto end + +:pack +echo Creating NuGet packages... +REM Ensure API is generated before packing +if not exist "Thirdweb\Thirdweb.Api\GeneratedClient.cs" ( + echo API client not found, generating it first... + call :generate-api + if errorlevel 1 goto end +) +dotnet build --configuration Release +dotnet pack --configuration Release +goto end + +:run +echo Running console application... +dotnet run --project Thirdweb.Console +goto end + +:lint +echo Checking code formatting with CSharpier... +csharpier --help >nul 2>&1 +if errorlevel 1 ( + echo CSharpier is not installed. Install it with: dotnet tool install -g csharpier + goto end +) +csharpier check . +if errorlevel 1 ( + echo Code formatting issues found! Run 'tw fix' to automatically fix them. + goto end +) +echo Code formatting is correct! +goto end + +:fix +echo Fixing code formatting with CSharpier... +csharpier --help >nul 2>&1 +if errorlevel 1 ( + echo CSharpier is not installed. Install it with: dotnet tool install -g csharpier + goto end +) +csharpier format . +if errorlevel 1 ( + echo CSharpier formatting failed! + goto end +) +echo Code formatting completed! +goto end + +:help +echo Available commands: +echo build - Generate API (if needed) and build the solution +echo clean - Clean build artifacts +echo restore - Restore NuGet packages +echo test - Run tests +echo pack - Generate API (if needed) and create NuGet package +echo run - Run the console application +echo generate-api - Generate API client from OpenAPI spec +echo clean-api - Clean generated API files +echo lint - Check code formatting (dry run) +echo fix - Fix code formatting issues +echo help - Show this help message +echo. +echo Usage: tw.bat [command] +goto end + +:end From 961bb02c28444238c1c17d2c1653b965edaa14b2 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 03:54:12 +0700 Subject: [PATCH 2/9] Integrate custom HTTP client wrapper for API requests Introduced ThirdwebHttpClientWrapper to adapt IThirdwebHttpClient for use with the generated API client, replacing direct usage of System.Net.Http.HttpClient. Updated the API client, client initialization, and NSwag config to use the wrapper. Also improved API documentation, added support for ERC20 token balance queries, and made minor fixes to comments and method signatures. --- .editorconfig | 3 ++ Thirdweb.Console/Program.cs | 34 ++++++------- Thirdweb/Thirdweb.Api/GeneratedClient.cs | 49 +++++++++++------- .../Thirdweb.Api/ThirdwebHttpClientWrapper.cs | 50 +++++++++++++++++++ Thirdweb/Thirdweb.Client/ThirdwebClient.cs | 13 ++--- Thirdweb/Thirdweb.Http/IThirdwebHttpClient.cs | 18 +++---- Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs | 8 +-- nswag.json | 2 +- 8 files changed, 117 insertions(+), 60 deletions(-) create mode 100644 Thirdweb/Thirdweb.Api/ThirdwebHttpClientWrapper.cs diff --git a/.editorconfig b/.editorconfig index 491fbbf1..dd12d0d9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -186,3 +186,6 @@ dotnet_diagnostic.IDE0290.severity = silent # JSON002: Probable JSON string detected dotnet_diagnostic.JSON002.severity = silent + +# CS8981: The type name only contains lower-cased ascii characters. Such names may become reserved for the language. +dotnet_diagnostic.CS8981.severity = suggestion diff --git a/Thirdweb.Console/Program.cs b/Thirdweb.Console/Program.cs index 58384ba3..051c8de5 100644 --- a/Thirdweb.Console/Program.cs +++ b/Thirdweb.Console/Program.cs @@ -14,23 +14,23 @@ #region Deploy Contract -// var serverWallet = await ServerWallet.Create(client: client, label: "TestFromDotnet"); - -// var abi = -// "[ { \"inputs\": [], \"name\": \"welcome\", \"outputs\": [ { \"internalType\": \"string\", \"name\": \"\", \"type\": \"string\" } ], \"stateMutability\": \"pure\", \"type\": \"function\" } ]"; - -// var contractAddress = await ThirdwebContract.Deploy( -// client: client, -// chainId: 421614, -// serverWalletAddress: await serverWallet.GetAddress(), -// bytecode: "6080604052348015600e575f5ffd5b5061014e8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063b627cf3b1461002d575b5f5ffd5b61003561004b565b60405161004291906100f8565b60405180910390f35b60606040518060400160405280601481526020017f57656c636f6d6520746f20746869726477656221000000000000000000000000815250905090565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6100ca82610088565b6100d48185610092565b93506100e48185602086016100a2565b6100ed816100b0565b840191505092915050565b5f6020820190508181035f83015261011081846100c0565b90509291505056fea264697066735822122001498e9d7d6125ce22613ef32fdb7e8e03bf11ad361d7b00e210b82d7b7e0d4464736f6c634300081e0033", -// abi: abi -// ); -// Console.WriteLine($"Contract deployed at: {contractAddress}"); - -// var contract = await ThirdwebContract.Create(client: client, address: contractAddress, chain: 421614, abi: abi); -// var welcomeMessage = await contract.Read("welcome"); -// Console.WriteLine($"Welcome message from deployed contract: {welcomeMessage}"); +var serverWallet = await ServerWallet.Create(client: client, label: "TestFromDotnet"); + +var abi = + "[ { \"inputs\": [], \"name\": \"welcome\", \"outputs\": [ { \"internalType\": \"string\", \"name\": \"\", \"type\": \"string\" } ], \"stateMutability\": \"pure\", \"type\": \"function\" } ]"; + +var contractAddress = await ThirdwebContract.Deploy( + client: client, + chainId: 11155111, + serverWalletAddress: await serverWallet.GetAddress(), + bytecode: "6080604052348015600e575f5ffd5b5061014e8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063b627cf3b1461002d575b5f5ffd5b61003561004b565b60405161004291906100f8565b60405180910390f35b60606040518060400160405280601481526020017f57656c636f6d6520746f20746869726477656221000000000000000000000000815250905090565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6100ca82610088565b6100d48185610092565b93506100e48185602086016100a2565b6100ed816100b0565b840191505092915050565b5f6020820190508181035f83015261011081846100c0565b90509291505056fea264697066735822122001498e9d7d6125ce22613ef32fdb7e8e03bf11ad361d7b00e210b82d7b7e0d4464736f6c634300081e0033", + abi: abi +); +Console.WriteLine($"Contract deployed at: {contractAddress}"); + +var contract = await ThirdwebContract.Create(client: client, address: contractAddress, chain: 11155111, abi: abi); +var welcomeMessage = await contract.Read("welcome"); +Console.WriteLine($"Welcome message from deployed contract: {welcomeMessage}"); #endregion diff --git a/Thirdweb/Thirdweb.Api/GeneratedClient.cs b/Thirdweb/Thirdweb.Api/GeneratedClient.cs index a6f3041f..b8c1579e 100644 --- a/Thirdweb/Thirdweb.Api/GeneratedClient.cs +++ b/Thirdweb/Thirdweb.Api/GeneratedClient.cs @@ -19,7 +19,6 @@ #pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" #pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" #pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." -#pragma warning disable 8981 // Disable "CS8981 The type name only contains lower-cased ascii characters." namespace Thirdweb.Api { @@ -32,12 +31,12 @@ internal partial class ThirdwebApiClient private string _baseUrl; #pragma warning restore 8618 - private System.Net.Http.HttpClient _httpClient; + private ThirdwebHttpClientWrapper _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); private Newtonsoft.Json.JsonSerializerSettings _instanceSettings; #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public ThirdwebApiClient(System.Net.Http.HttpClient httpClient) + public ThirdwebApiClient(ThirdwebHttpClientWrapper httpClient) #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. { BaseUrl = "https://api.thirdweb.com"; @@ -69,9 +68,9 @@ public string BaseUrl partial void Initialize(); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + partial void PrepareRequest(ThirdwebHttpClientWrapper client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(ThirdwebHttpClientWrapper client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(ThirdwebHttpClientWrapper client, System.Net.Http.HttpResponseMessage response); /// /// Initiate Auth @@ -92,6 +91,8 @@ public string BaseUrl ///
3. Receive challenge data to complete authentication ///
4. Use the `/complete` endpoint to finish the process ///
+ ///
NOTE: for custom authentication (JWT, auth-payload) and for guest authentication, you can skip this step and use the `/complete` endpoint directly. + ///
///
**Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. /// /// Authentication initiated successfully. Use the returned challenge data to complete authentication. @@ -121,6 +122,8 @@ public virtual System.Threading.Tasks.Task InitiateAuthenticationAsync ///
3. Receive challenge data to complete authentication ///
4. Use the `/complete` endpoint to finish the process ///
+ ///
NOTE: for custom authentication (JWT, auth-payload) and for guest authentication, you can skip this step and use the `/complete` endpoint directly. + ///
///
**Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. /// /// Authentication initiated successfully. Use the returned challenge data to complete authentication. @@ -220,7 +223,7 @@ public virtual async System.Threading.Tasks.Task InitiateAuthenticatio ///
- **Passkey** - Provide the WebAuthn signature response ///
- **SIWE** - Submit your signed Ethereum message ///
- **Guest** - Create an ephemeral guest wallet - ///
- **Custom** - Send your JWT token or custom payload + ///
- **Custom (JWT, auth-payload)** - Send your JWT token or custom payload ///
///
**Response:** ///
- `isNewUser` - Whether this is a new wallet creation @@ -249,7 +252,7 @@ public virtual System.Threading.Tasks.Task CompleteAuthenticationAsyn ///
- **Passkey** - Provide the WebAuthn signature response ///
- **SIWE** - Submit your signed Ethereum message ///
- **Guest** - Create an ephemeral guest wallet - ///
- **Custom** - Send your JWT token or custom payload + ///
- **Custom (JWT, auth-payload)** - Send your JWT token or custom payload ///
///
**Response:** ///
- `isNewUser` - Whether this is a new wallet creation @@ -959,17 +962,18 @@ public virtual async System.Threading.Tasks.Task CreateServerWalletAs /// Get Balance ///
/// - /// Get native token balance for a wallet address across multiple blockchain networks. This endpoint retrieves native token balances (ETH, MATIC, BNB, etc.) for a given wallet address on multiple chains simultaneously, making it efficient for cross-chain native balance checking. + /// Get native or ERC20 token balance for a wallet address. Can retrieve live balances for any ERC20 token on a signle chain, or native token balances across multiple chains. ///
///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. ///
/// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). /// Chain ID(s) to request balance data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// The token contract address. Omit for native token (ETH, MATIC, etc.). /// Wallet native balances retrieved successfully. Returns detailed native token balance information for each chain including token metadata and formatted values. /// A server side error occurred. - public virtual System.Threading.Tasks.Task GetWalletBalanceAsync(string address, System.Collections.Generic.IEnumerable chainId) + public virtual System.Threading.Tasks.Task GetWalletBalanceAsync(string address, System.Collections.Generic.IEnumerable chainId, string tokenAddress) { - return GetWalletBalanceAsync(address, chainId, System.Threading.CancellationToken.None); + return GetWalletBalanceAsync(address, chainId, tokenAddress, System.Threading.CancellationToken.None); } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. @@ -977,15 +981,16 @@ public virtual System.Threading.Tasks.Task GetWalletBalanceAsync(stri /// Get Balance ///
/// - /// Get native token balance for a wallet address across multiple blockchain networks. This endpoint retrieves native token balances (ETH, MATIC, BNB, etc.) for a given wallet address on multiple chains simultaneously, making it efficient for cross-chain native balance checking. + /// Get native or ERC20 token balance for a wallet address. Can retrieve live balances for any ERC20 token on a signle chain, or native token balances across multiple chains. ///
///
**Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. ///
/// A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). /// Chain ID(s) to request balance data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + /// The token contract address. Omit for native token (ETH, MATIC, etc.). /// Wallet native balances retrieved successfully. Returns detailed native token balance information for each chain including token metadata and formatted values. /// A server side error occurred. - public virtual async System.Threading.Tasks.Task GetWalletBalanceAsync(string address, System.Collections.Generic.IEnumerable chainId, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task GetWalletBalanceAsync(string address, System.Collections.Generic.IEnumerable chainId, string tokenAddress, System.Threading.CancellationToken cancellationToken) { if (address == null) throw new System.ArgumentNullException("address"); @@ -1016,6 +1021,10 @@ public virtual async System.Threading.Tasks.Task GetWalletBalanceAsyn } urlBuilder_.Length--; urlBuilder_.Append("&"); + if (tokenAddress != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tokenAddress")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(tokenAddress, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -5273,6 +5282,12 @@ public partial class Body13 [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Recipient { get; set; } + /// + /// App specific purchase data for this payment + /// + [Newtonsoft.Json.JsonProperty("purchaseData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object PurchaseData { get; set; } + private System.Collections.Generic.IDictionary _additionalProperties; [Newtonsoft.Json.JsonExtensionData] @@ -5925,7 +5940,7 @@ public System.Collections.Generic.IDictionary AdditionalProperti } /// - /// Successful product creation response containing the product ID and link to purchase the product + /// Successful payment creation response containing the payment ID and link to purchase the product /// [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class Response27 @@ -7308,11 +7323,11 @@ public System.Collections.Generic.IDictionary AdditionalProperti public partial class Result23 { /// - /// The product ID + /// The payment ID /// - [Newtonsoft.Json.JsonProperty("productId", Required = Newtonsoft.Json.Required.Always)] + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string ProductId { get; set; } + public string Id { get; set; } /// /// The link to purchase the product diff --git a/Thirdweb/Thirdweb.Api/ThirdwebHttpClientWrapper.cs b/Thirdweb/Thirdweb.Api/ThirdwebHttpClientWrapper.cs new file mode 100644 index 00000000..3fe8d91b --- /dev/null +++ b/Thirdweb/Thirdweb.Api/ThirdwebHttpClientWrapper.cs @@ -0,0 +1,50 @@ +namespace Thirdweb.Api; + +/// +/// Wrapper class that adapts IThirdwebHttpClient to work with System.Net.Http.HttpClient expectations +/// +internal class ThirdwebHttpClientWrapper : HttpClient +{ + private readonly IThirdwebHttpClient _thirdwebClient; + + public ThirdwebHttpClientWrapper(IThirdwebHttpClient thirdwebClient) + { + this._thirdwebClient = thirdwebClient ?? throw new ArgumentNullException(nameof(thirdwebClient)); + } + + public override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + return await this.SendAsync(request, HttpCompletionOption.ResponseContentRead, cancellationToken); + } + + public new async Task SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) + { + _ = completionOption; + + var content = request.Content; + + ThirdwebHttpResponseMessage thirdwebResponse; + + switch (request.Method.Method.ToUpperInvariant()) + { + case "GET": + thirdwebResponse = await this._thirdwebClient.GetAsync(request.RequestUri.ToString(), cancellationToken); + break; + case "POST": + thirdwebResponse = await this._thirdwebClient.PostAsync(request.RequestUri.ToString(), content, cancellationToken); + break; + case "PUT": + thirdwebResponse = await this._thirdwebClient.PutAsync(request.RequestUri.ToString(), content, cancellationToken); + break; + case "DELETE": + thirdwebResponse = await this._thirdwebClient.DeleteAsync(request.RequestUri.ToString(), cancellationToken); + break; + default: + throw new NotSupportedException($"HTTP method {request.Method} is not supported"); + } + + var response = new HttpResponseMessage((System.Net.HttpStatusCode)thirdwebResponse.StatusCode) { Content = new StringContent(await thirdwebResponse.Content.ReadAsStringAsync()) }; + + return response; + } +} diff --git a/Thirdweb/Thirdweb.Client/ThirdwebClient.cs b/Thirdweb/Thirdweb.Client/ThirdwebClient.cs index f3f3ac5c..ffc99cbe 100644 --- a/Thirdweb/Thirdweb.Client/ThirdwebClient.cs +++ b/Thirdweb/Thirdweb.Client/ThirdwebClient.cs @@ -78,16 +78,9 @@ private ThirdwebClient( this.RpcOverrides = rpcOverrides; - // Initialize the API client - var apiHttpClient = new HttpClient { BaseAddress = new Uri("https://api.thirdweb.com") }; - - // Copy headers from ThirdwebClient to API client - foreach (var header in defaultHeaders) - { - _ = apiHttpClient.DefaultRequestHeaders.TryAddWithoutValidation(header.Key, header.Value); - } - - this.Api = new ThirdwebApiClient(apiHttpClient); + // Initialize the API client with the wrapped HTTP client + var wrappedHttpClient = new ThirdwebHttpClientWrapper(this.HttpClient); + this.Api = new ThirdwebApiClient(wrappedHttpClient); } /// diff --git a/Thirdweb/Thirdweb.Http/IThirdwebHttpClient.cs b/Thirdweb/Thirdweb.Http/IThirdwebHttpClient.cs index 6fdf1d81..fd8b8654 100644 --- a/Thirdweb/Thirdweb.Http/IThirdwebHttpClient.cs +++ b/Thirdweb/Thirdweb.Http/IThirdwebHttpClient.cs @@ -8,31 +8,31 @@ public interface IThirdwebHttpClient : IDisposable /// /// Gets the headers for the HTTP client. /// - Dictionary Headers { get; } + public Dictionary Headers { get; } /// /// Sets the headers for the HTTP client. /// /// The headers to set. - void SetHeaders(Dictionary headers); + public void SetHeaders(Dictionary headers); /// /// Clears all headers from the HTTP client. /// - void ClearHeaders(); + public void ClearHeaders(); /// /// Adds a header to the HTTP client. /// /// The header key. /// The header value. - void AddHeader(string key, string value); + public void AddHeader(string key, string value); /// /// Removes a header from the HTTP client. /// /// The header key. - void RemoveHeader(string key); + public void RemoveHeader(string key); /// /// Sends a GET request to the specified URI. @@ -40,7 +40,7 @@ public interface IThirdwebHttpClient : IDisposable /// The request URI. /// The cancellation token. /// A task that represents the asynchronous operation. The task result contains the HTTP response message. - Task GetAsync(string requestUri, CancellationToken cancellationToken = default); + public Task GetAsync(string requestUri, CancellationToken cancellationToken = default); /// /// Sends a POST request to the specified URI. @@ -49,7 +49,7 @@ public interface IThirdwebHttpClient : IDisposable /// The HTTP content to send. /// The cancellation token. /// A task that represents the asynchronous operation. The task result contains the HTTP response message. - Task PostAsync(string requestUri, HttpContent content, CancellationToken cancellationToken = default); + public Task PostAsync(string requestUri, HttpContent content, CancellationToken cancellationToken = default); /// /// Sends a PUT request to the specified URI. @@ -58,7 +58,7 @@ public interface IThirdwebHttpClient : IDisposable /// The HTTP content to send. /// The cancellation token. /// A task that represents the asynchronous operation. The task result contains the HTTP response message. - Task PutAsync(string requestUri, HttpContent content, CancellationToken cancellationToken = default); + public Task PutAsync(string requestUri, HttpContent content, CancellationToken cancellationToken = default); /// /// Sends a DELETE request to the specified URI. @@ -66,5 +66,5 @@ public interface IThirdwebHttpClient : IDisposable /// The request URI. /// The cancellation token. /// A task that represents the asynchronous operation. The task result contains the HTTP response message. - Task DeleteAsync(string requestUri, CancellationToken cancellationToken = default); + public Task DeleteAsync(string requestUri, CancellationToken cancellationToken = default); } diff --git a/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs b/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs index dbfd9224..e698061e 100644 --- a/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs +++ b/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs @@ -77,9 +77,7 @@ public async Task GetAsync(string requestUri, Cance var request = new HttpRequestMessage(HttpMethod.Get, requestUri); this.AddHeaders(request); var result = await this._httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false); -#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods - var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync().ConfigureAwait(false)); -#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods + var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false)); return new ThirdwebHttpResponseMessage((long)result.StatusCode, resultContent, result.IsSuccessStatusCode); } @@ -95,9 +93,7 @@ public async Task PostAsync(string requestUri, Http var request = new HttpRequestMessage(HttpMethod.Post, requestUri) { Content = content }; this.AddHeaders(request); var result = await this._httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false); -#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods - var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync().ConfigureAwait(false)); -#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods + var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false)); return new ThirdwebHttpResponseMessage((long)result.StatusCode, resultContent, result.IsSuccessStatusCode); } diff --git a/nswag.json b/nswag.json index ef8f4823..765308fc 100644 --- a/nswag.json +++ b/nswag.json @@ -10,6 +10,7 @@ "codeGenerators": { "openApiToCSharpClient": { "clientBaseClass": null, + "httpClientType": "ThirdwebHttpClientWrapper", "generateClientClasses": true, "generateClientInterfaces": false, "generateDtoTypes": true, @@ -19,7 +20,6 @@ "exceptionClass": "ThirdwebApiException", "wrapDtoExceptions": true, "useHttpClientCreationMethod": false, - "httpClientType": "System.Net.Http.HttpClient", "useHttpRequestMessageCreationMethod": false, "useBaseUrl": true, "generateBaseUrlProperty": true, From 3bcb0eeb2a66aae00afb9a15c1d4910f4fad3b99 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 04:02:11 +0700 Subject: [PATCH 3/9] Avoid CS1501 on netstandard2.1 --- Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs b/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs index e698061e..1d53daea 100644 --- a/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs +++ b/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs @@ -77,7 +77,9 @@ public async Task GetAsync(string requestUri, Cance var request = new HttpRequestMessage(HttpMethod.Get, requestUri); this.AddHeaders(request); var result = await this._httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false); +#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false)); +#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods return new ThirdwebHttpResponseMessage((long)result.StatusCode, resultContent, result.IsSuccessStatusCode); } @@ -93,7 +95,9 @@ public async Task PostAsync(string requestUri, Http var request = new HttpRequestMessage(HttpMethod.Post, requestUri) { Content = content }; this.AddHeaders(request); var result = await this._httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false); - var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false)); +#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods + var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync().ConfigureAwait(false)); +#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods return new ThirdwebHttpResponseMessage((long)result.StatusCode, resultContent, result.IsSuccessStatusCode); } From 12a68eee701706fd13481f44c2dddb418fd2b810 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 04:02:40 +0700 Subject: [PATCH 4/9] . --- Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs b/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs index 1d53daea..dbfd9224 100644 --- a/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs +++ b/Thirdweb/Thirdweb.Http/ThirdwebHttpClient.cs @@ -78,7 +78,7 @@ public async Task GetAsync(string requestUri, Cance this.AddHeaders(request); var result = await this._httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false); #pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods - var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false)); + var resultContent = new ThirdwebHttpContent(await result.Content.ReadAsByteArrayAsync().ConfigureAwait(false)); #pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods return new ThirdwebHttpResponseMessage((long)result.StatusCode, resultContent, result.IsSuccessStatusCode); } From 7b1849a42a7b71617a2851a170a7088f335c9e63 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 04:22:54 +0700 Subject: [PATCH 5/9] Check Arachnid deployment before sending raw transaction Added a check to verify if the Arachnid contract is deployed before attempting to send a pre-EIP-155 raw transaction. This prevents unnecessary transaction attempts and error handling when the contract is not present. --- Thirdweb/Thirdweb.Utils/Utils.cs | 68 +++++++++++++++++--------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/Thirdweb/Thirdweb.Utils/Utils.cs b/Thirdweb/Thirdweb.Utils/Utils.cs index cec2c9ef..9e840592 100644 --- a/Thirdweb/Thirdweb.Utils/Utils.cs +++ b/Thirdweb/Thirdweb.Utils/Utils.cs @@ -686,43 +686,47 @@ public static async Task IsEip155Enforced(ThirdwebClient client, BigIntege } var result = false; - var rpc = ThirdwebRPC.GetRpcInstance(client, chainId); - try + var isArachnidDeployed = await IsDeployed(client, chainId, "0x4e59b44847b379578588920ca78fbf26c0b4956c").ConfigureAwait(false); + if (!isArachnidDeployed) { - // Pre-155 tx that will fail - var rawTransaction = - "0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222"; - _ = await rpc.SendRequestAsync("eth_sendRawTransaction", rawTransaction); - } - catch (Exception e) - { - var errorMsg = e.Message.ToLower(); - - var errorSubstrings = new List - { - "eip-155", - "eip155", - "protected", - "invalid chain id for signer", - "chain id none", - "chain_id mismatch", - "recovered sender mismatch", - "transaction hash mismatch", - "chainid no support", - "chainid (0)", - "chainid(0)", - "invalid sender", - }; - - if (errorSubstrings.Any(errorMsg.Contains)) + try { - result = true; + // Pre-155 tx that will fail + var rpc = ThirdwebRPC.GetRpcInstance(client, chainId); + var rawTransaction = + "0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222"; + _ = await rpc.SendRequestAsync("eth_sendRawTransaction", rawTransaction).ConfigureAwait(false); } - else + catch (Exception e) { - // Check if all substrings in any of the composite substrings are present - result = _errorSubstringsComposite.Any(arr => arr.All(substring => errorMsg.Contains(substring))); + var errorMsg = e.Message.ToLower(); + + var errorSubstrings = new List + { + "eip-155", + "eip155", + "protected", + "invalid chain id for signer", + "chain id none", + "chain_id mismatch", + "recovered sender mismatch", + "transaction hash mismatch", + "chainid no support", + "chainid (0)", + "chainid(0)", + "invalid sender", + }; + + if (errorSubstrings.Any(errorMsg.Contains)) + { + result = true; + } + else + { + // Check if all substrings in any of the composite substrings are present + result = _errorSubstringsComposite.Any(arr => arr.All(substring => errorMsg.Contains(substring))); + } } } From 7dcf31b71c1ac2e5bd96141e83a379d7e7348719 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 04:23:49 +0700 Subject: [PATCH 6/9] Fix parenthesis should be added for clarity --- Thirdweb/Thirdweb.Utils/Utils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Thirdweb/Thirdweb.Utils/Utils.cs b/Thirdweb/Thirdweb.Utils/Utils.cs index 9e840592..1a3f5d80 100644 --- a/Thirdweb/Thirdweb.Utils/Utils.cs +++ b/Thirdweb/Thirdweb.Utils/Utils.cs @@ -964,7 +964,7 @@ public static async Task FetchGasPrice(ThirdwebClient client, BigInt var block = await rpc.SendRequestAsync("eth_getBlockByNumber", "latest", true).ConfigureAwait(false); var baseBlockFee = block["baseFeePerGas"]?.ToObject(); var maxFeePerGas = baseBlockFee.Value * 2; - var maxPriorityFeePerGas = ((await rpc.SendRequestAsync("eth_maxPriorityFeePerGas").ConfigureAwait(false))?.Value) ?? maxFeePerGas / 2; + var maxPriorityFeePerGas = ((await rpc.SendRequestAsync("eth_maxPriorityFeePerGas").ConfigureAwait(false))?.Value) ?? (maxFeePerGas / 2); if (maxPriorityFeePerGas > maxFeePerGas) { From 27b8325910dbb899eb8956b26209fa65fdd36632 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 04:52:41 +0700 Subject: [PATCH 7/9] Add input validation and improve error handling Added comprehensive input validation and detailed exception handling to ThirdwebContract.Deploy and ThirdwebTransaction.WaitForTransactionHash methods. Updated .editorconfig to refine generated file exclusion. Reordered and uncommented wallet interaction and ZkSync AA code in Program.cs for clarity. Improved error handling and exit codes in tw.bat for better script reliability. --- .editorconfig | 2 +- Thirdweb.Console/Program.cs | 65 ++++++------- .../Thirdweb.Contracts/ThirdwebContract.cs | 92 ++++++++++++++++--- .../ThirdwebTransaction.cs | 14 ++- tw.bat | 6 +- 5 files changed, 123 insertions(+), 56 deletions(-) diff --git a/.editorconfig b/.editorconfig index dd12d0d9..347d2d66 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,7 @@ root = true ############################### # Exclude Thirdweb.Api generated files from all linting and formatting rules -[Thirdweb.Api/**/*.cs] +[Thirdweb/Thirdweb.Api/GeneratedClient.cs] generated_code = true dotnet_analyzer_diagnostic.severity = none dotnet_style_qualification_for_field = false diff --git a/Thirdweb.Console/Program.cs b/Thirdweb.Console/Program.cs index 051c8de5..4e289c5f 100644 --- a/Thirdweb.Console/Program.cs +++ b/Thirdweb.Console/Program.cs @@ -12,35 +12,13 @@ // Fetch timeout options are optional, default is 120000ms var client = ThirdwebClient.Create(secretKey: secretKey); -#region Deploy Contract - -var serverWallet = await ServerWallet.Create(client: client, label: "TestFromDotnet"); - -var abi = - "[ { \"inputs\": [], \"name\": \"welcome\", \"outputs\": [ { \"internalType\": \"string\", \"name\": \"\", \"type\": \"string\" } ], \"stateMutability\": \"pure\", \"type\": \"function\" } ]"; - -var contractAddress = await ThirdwebContract.Deploy( - client: client, - chainId: 11155111, - serverWalletAddress: await serverWallet.GetAddress(), - bytecode: "6080604052348015600e575f5ffd5b5061014e8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063b627cf3b1461002d575b5f5ffd5b61003561004b565b60405161004291906100f8565b60405180910390f35b60606040518060400160405280601481526020017f57656c636f6d6520746f20746869726477656221000000000000000000000000815250905090565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6100ca82610088565b6100d48185610092565b93506100e48185602086016100a2565b6100ed816100b0565b840191505092915050565b5f6020820190508181035f83015261011081846100c0565b90509291505056fea264697066735822122001498e9d7d6125ce22613ef32fdb7e8e03bf11ad361d7b00e210b82d7b7e0d4464736f6c634300081e0033", - abi: abi -); -Console.WriteLine($"Contract deployed at: {contractAddress}"); - -var contract = await ThirdwebContract.Create(client: client, address: contractAddress, chain: 11155111, abi: abi); -var welcomeMessage = await contract.Read("welcome"); -Console.WriteLine($"Welcome message from deployed contract: {welcomeMessage}"); - -#endregion - #region Basic Wallet Interaction -// // Create a private key wallet -// var privateKeyWallet = await PrivateKeyWallet.Generate(client); +// Create a private key wallet +var privateKeyWallet = await PrivateKeyWallet.Generate(client); -// var walletAddress = await privateKeyWallet.GetAddress(); -// Console.WriteLine($"PK Wallet address: {walletAddress}"); +var walletAddress = await privateKeyWallet.GetAddress(); +Console.WriteLine($"PK Wallet address: {walletAddress}"); #endregion @@ -52,6 +30,28 @@ #endregion +#region Deploy Contract + +// var serverWallet = await ServerWallet.Create(client: client, label: "TestFromDotnet"); + +// var abi = +// "[ { \"inputs\": [], \"name\": \"welcome\", \"outputs\": [ { \"internalType\": \"string\", \"name\": \"\", \"type\": \"string\" } ], \"stateMutability\": \"pure\", \"type\": \"function\" } ]"; + +// var contractAddress = await ThirdwebContract.Deploy( +// client: client, +// chainId: 11155111, +// serverWalletAddress: await serverWallet.GetAddress(), +// bytecode: "6080604052348015600e575f5ffd5b5061014e8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063b627cf3b1461002d575b5f5ffd5b61003561004b565b60405161004291906100f8565b60405180910390f35b60606040518060400160405280601481526020017f57656c636f6d6520746f20746869726477656221000000000000000000000000815250905090565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6100ca82610088565b6100d48185610092565b93506100e48185602086016100a2565b6100ed816100b0565b840191505092915050565b5f6020820190508181035f83015261011081846100c0565b90509291505056fea264697066735822122001498e9d7d6125ce22613ef32fdb7e8e03bf11ad361d7b00e210b82d7b7e0d4464736f6c634300081e0033", +// abi: abi +// ); +// Console.WriteLine($"Contract deployed at: {contractAddress}"); + +// var contract = await ThirdwebContract.Create(client: client, address: contractAddress, chain: 11155111, abi: abi); +// var welcomeMessage = await contract.Read("welcome"); +// Console.WriteLine($"Welcome message from deployed contract: {welcomeMessage}"); + +#endregion + #region Bridge // // Create a ThirdwebBridge instance @@ -334,18 +334,11 @@ #region AA ZkSync -// var zkSmartWallet = await SmartWallet.Create(personalWallet: privateKeyWallet, chainId: 4654, gasless: true); +var zkSmartWallet = await SmartWallet.Create(personalWallet: privateKeyWallet, chainId: 11124, gasless: true); -// var hash = await zkSmartWallet.SendTransaction( -// new ThirdwebTransactionInput(4654) -// { -// To = await zkSmartWallet.GetAddress(), -// Value = new HexBigInteger(BigInteger.Zero), -// Data = "0x", -// } -// ); +var hash = await zkSmartWallet.SendTransaction(new ThirdwebTransactionInput(chainId: 11124, to: await zkSmartWallet.GetAddress(), value: 0, data: "0x")); -// Console.WriteLine($"Transaction hash: {hash}"); +Console.WriteLine($"Transaction hash: {hash}"); #endregion diff --git a/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs b/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs index 040934ac..d980bd16 100644 --- a/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs +++ b/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs @@ -43,6 +43,11 @@ private ThirdwebContract(ThirdwebClient client, string address, BigInteger chain /// /// This method deploys a new contract using a server wallet, create one via the ServerWallet class or api.thirdweb.com, or the dashboard. /// + /// Thrown if any of the required parameters are null. + /// Thrown if any of the required parameters are invalid. + /// Thrown if the chain ID is too large. + /// Thrown if the deployment fails or the API response is invalid. + /// Thrown if the ABI JSON cannot be parsed. public static async Task Deploy( ThirdwebClient client, BigInteger chainId, @@ -54,20 +59,79 @@ public static async Task Deploy( CancellationToken cancellationToken = default ) { - var response = await client - .Api.DeployContractAsync( - new Api.Body8() - { - ChainId = (int)chainId, - From = serverWalletAddress, - Bytecode = bytecode, - Abi = JsonConvert.DeserializeObject>(abi), - ConstructorParams = constructorParams, - Salt = salt, - }, - cancellationToken - ) - .ConfigureAwait(false); + // Input validation + if (client == null) + { + throw new ArgumentNullException(nameof(client)); + } + + if (chainId <= 0) + { + throw new ArgumentException("Chain ID must be greater than 0.", nameof(chainId)); + } + + if (string.IsNullOrEmpty(serverWalletAddress)) + { + throw new ArgumentException("Server wallet address cannot be null or empty.", nameof(serverWalletAddress)); + } + + if (string.IsNullOrEmpty(bytecode)) + { + throw new ArgumentException("Bytecode cannot be null or empty.", nameof(bytecode)); + } + + if (string.IsNullOrEmpty(abi)) + { + throw new ArgumentException("ABI cannot be null or empty.", nameof(abi)); + } + + // Perform checked cast to int + // TODO: Remove this when generated client supports BigInteger for chainId + int chainIdInt; + try + { + chainIdInt = checked((int)chainId); + } + catch (OverflowException) + { + throw new OverflowException($"Chain ID {chainId} is too large; ThirdwebContract.Deploy currently only supports chain IDs up to {int.MaxValue}."); + } + + // Parse ABI with error handling + List parsedAbi; + try + { + parsedAbi = JsonConvert.DeserializeObject>(abi); + if (parsedAbi == null) + { + throw new InvalidOperationException("ABI deserialization returned null."); + } + } + catch (JsonException ex) + { + throw new ArgumentException($"Failed to parse ABI JSON: {ex.Message}", nameof(abi), ex); + } + + var response = + await client + .Api.DeployContractAsync( + new Api.Body8() + { + ChainId = chainIdInt, + From = serverWalletAddress, + Bytecode = bytecode, + Abi = parsedAbi, + ConstructorParams = constructorParams, + Salt = salt, + }, + cancellationToken + ) + .ConfigureAwait(false) ?? throw new InvalidOperationException("Failed to deploy contract: API response was null."); + + if (response.Result is null) + { + throw new InvalidOperationException("Failed to deploy contract: API response result was null."); + } var contractAddress = response.Result.Address; if (string.IsNullOrEmpty(contractAddress)) diff --git a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs index 2ade66e7..7ff90266 100644 --- a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs +++ b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs @@ -478,6 +478,15 @@ public static async Task WaitForTransactionReceipt(T /// The transaction hash. public static async Task WaitForTransactionHash(ThirdwebClient client, string txId, CancellationToken cancellationToken = default) { + if (client == null) + { + throw new ArgumentNullException(nameof(client)); + } + + if (string.IsNullOrEmpty(txId)) + { + throw new ArgumentException("Transaction id cannot be null or empty.", nameof(txId)); + } using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); cts.CancelAfter(client.FetchTimeoutOptions.GetTimeout(TimeoutType.Other)); @@ -488,10 +497,11 @@ public static async Task WaitForTransactionHash(ThirdwebClient client, s { do { - hash = (await api.GetTransactionByIdAsync(txId, cts.Token).ConfigureAwait(false)).Result.TransactionHash; + var resp = await api.GetTransactionByIdAsync(txId, cts.Token).ConfigureAwait(false); + hash = resp?.Result?.TransactionHash; if (hash == null) { - await ThirdwebTask.Delay(100, cancellationToken).ConfigureAwait(false); + await ThirdwebTask.Delay(100, cts.Token).ConfigureAwait(false); } } while (hash == null && !cts.Token.IsCancellationRequested); diff --git a/tw.bat b/tw.bat index 675ad8b7..2c867827 100644 --- a/tw.bat +++ b/tw.bat @@ -38,7 +38,7 @@ if errorlevel 1 ( dotnet tool install --global NSwag.ConsoleCore if errorlevel 1 ( echo Failed to install NSwag CLI - goto end + exit /b 1 ) ) @@ -47,11 +47,11 @@ echo Running NSwag to generate client... nswag run nswag.json if errorlevel 1 ( echo Failed to generate API client - goto end + exit /b 1 ) echo API client generation complete! -goto end +exit /b 0 :build echo Building solution... From 722300127d336309344b785a17c1c407feea33db Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 04:53:22 +0700 Subject: [PATCH 8/9] fix lint --- Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs index 7ff90266..40089fe8 100644 --- a/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs +++ b/Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs @@ -482,7 +482,7 @@ public static async Task WaitForTransactionHash(ThirdwebClient client, s { throw new ArgumentNullException(nameof(client)); } - + if (string.IsNullOrEmpty(txId)) { throw new ArgumentException("Transaction id cannot be null or empty.", nameof(txId)); From 7652112ca53d469821fbb3f88fd428f7570d86f7 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Tue, 19 Aug 2025 05:03:22 +0700 Subject: [PATCH 9/9] Update codecov ignore paths Added 'Thirdweb/Thirdweb.Api/GeneratedClient.cs' to the list of ignored files in codecov.yml to exclude it from coverage reports. --- codecov.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index bd2adf1b..c63bf629 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,4 @@ ignore: - "Thirdweb/Thirdweb.Wallets/InAppWallet" - - "Thirdweb/Thirdweb.Pay" \ No newline at end of file + - "Thirdweb/Thirdweb.Pay" + - "Thirdweb/Thirdweb.Api/GeneratedClient.cs" \ No newline at end of file