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..347d2d66 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/Thirdweb.Api/GeneratedClient.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,9 @@ dotnet_diagnostic.CA1822.severity = suggestion
# IDE0290: Use primary constructor
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/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..4e289c5f 100644
--- a/Thirdweb.Console/Program.cs
+++ b/Thirdweb.Console/Program.cs
@@ -1,41 +1,28 @@
#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);
+#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}");
+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();
@@ -43,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
@@ -325,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.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..b8c1579e
--- /dev/null
+++ b/Thirdweb/Thirdweb.Api/GeneratedClient.cs
@@ -0,0 +1,9366 @@
+//----------------------
+//
+// 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)."
+
+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 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(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";
+ _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(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
+ ///
+ ///
+ /// 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
+ ///
+ ///
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.
+ /// 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
+ ///
+ ///
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.
+ /// 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 (JWT, auth-payload)** - 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 (JWT, auth-payload)** - 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 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, string tokenAddress)
+ {
+ 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.
+ ///
+ /// Get Balance
+ ///
+ ///
+ /// 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, string tokenAddress, 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("&");
+ 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_);
+
+ 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