Releases: thirdweb-dev/dotnet
v2.16.0
What's Changed
AuthProvider.SiweExternal - SIWE, OAuth style
Depending on the framework, or on the external wallet platform support, you may not have direct access to every single wallet out there.
This new AuthProvider allows you to login to otherwise native-unavailable wallets such as Abstract Wallet & Coinbase Smart Wallet through a flow similar to OAuth, using SIWE.
It'll redirect you to static.thirdweb.com and use our React SDK and other wallet SDKs as needed, unlocking the ability to login (or link) with any wallet thirdweb supports on web, from runtime platforms that would otherwise be unsupported by said wallet, and create an In-App or Ecosystem Wallet out of it.
Windows Console Example:
var inAppWalletSiweExternal = await InAppWallet.Create(client: client, authProvider: AuthProvider.SiweExternal);
var address = await inAppWalletSiweExternal.LoginWithSiweExternal(
isMobile: false,
browserOpenAction: (url) =>
{
var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true };
_ = Process.Start(psi);
},
forceWalletIds: new List<string> { "io.metamask", "com.coinbase.wallet", "xyz.abs" }
);
You can now override the default session id used with Guest authentication
This is useful when you want your guest mode to be tied to a unique device identifier, and depending on your framework there may be various APIs to fetch such identifiers that you may want to use.
Example:
var guestWallet = await EcosystemWallet.Create(
ecosystemId: "ecosystem.the-bonfire",
client: client,
authProvider: AuthProvider.Guest
);
var address = await guestWallet.LoginWithGuest(SomeSystemInfoAPI.deviceUniqueIdentifier);
v2.15.0
v2.14.0
What's Changed
- Added
AuthProvider.Backend
as a server-side way to create In-App or Ecosystem Wallets. Simply pass awalletSecret
identifier.
var inAppWalletBackend = await InAppWallet.Create(
client: client,
authProvider: AuthProvider.Backend,
walletSecret: "very-secret"
);
var address = await inAppWalletBackend.LoginWithBackend();
v2.13.0
What's Changed
- Added
DropER721_Burn
,DropERC1155_BurnBatch
,TokenERC721_Burn
,TokenERC1155_Burn
,TokenERC1155_BurnBatch
contract extensions. - Overriding default RPCs is now allowed through a new
ThirdwebClient
creation parameterrpcOverrides
.
var client = ThirdwebClient.Create(
clientId: "myepicclientid",
bundleId: "my.bundle.id", // for native apps
rpcOverrides: new()
{
{ 1, "https://eth.llamarpc.com" },
{ 42161, "https://arbitrum.llamarpc.com" }
}
);
- Removed some leftover unnecessary logging.
v2.12.1
What's Changed
- Patch exposing
GetUserDetails
fields when using Ecosystem or In-App Wallets.
v2.12.0
IThirdwebWallet.UnlinkAccount
Adds the ability to Unlink a LinkedAccount
from your In-App or Ecosystem Wallet in #107
List<LinkedAccount> linkedAccounts = await inAppWallet.GetLinkedAccounts();
List<LinkedAccount> linkedAccountsAfterUnlinking = await inAppWallet.UnlinkAccount(linkedAccounts[0]);
EIP-7702 Integration (Experimental)
Integrates authorizationList
for any transactions in #108
This EIP essentially allows you to set code to an EOA, unlocking a world of possibilities to enhance their functionality.
The best way to understand it outside of reading the EIP is looking at the example below; to preface it: we sign an authorization using the wallet we want to set code to. Another wallet sends a transaction with said authorization passed in, essentially activating it. The authority wallet now has code set to it pointing to an (insecure) Delegation contract in this case, which allows any wallet to execute any call through it on behalf of the authority. In this example, we call the wallet executing both the authorization and the claim transaction afterwards, the exectuor.
An authority may execute its own authorization, the only difference is internal whereby the authorization nonce is incremented by 1.
// Chain and contract addresses
var chainWith7702 = 911867;
var erc20ContractAddress = "0xAA462a5BE0fc5214507FDB4fB2474a7d5c69065b"; // Fake ERC20
var delegationContractAddress = "0x654F42b74885EE6803F403f077bc0409f1066c58"; // BatchCallDelegation
// Initialize contracts normally
var erc20Contract = await ThirdwebContract.Create(client: client, address: erc20ContractAddress, chain: chainWith7702);
var delegationContract = await ThirdwebContract.Create(client: client, address: delegationContractAddress, chain: chainWith7702);
// Initialize a (to-be) 7702 EOA
var eoaWallet = await PrivateKeyWallet.Generate(client);
var eoaWalletAddress = await eoaWallet.GetAddress();
Console.WriteLine($"EOA address: {eoaWalletAddress}");
// Initialize another wallet, the "executor" that will hit the eoa's (to-be) execute function
var executorWallet = await PrivateKeyWallet.Generate(client);
var executorWalletAddress = await executorWallet.GetAddress();
Console.WriteLine($"Executor address: {executorWalletAddress}");
// Fund the executor wallet
var fundingWallet = await PrivateKeyWallet.Create(client, privateKey);
var fundingHash = (await fundingWallet.Transfer(chainWith7702, executorWalletAddress, BigInteger.Parse("0.001".ToWei()))).TransactionHash;
Console.WriteLine($"Funded Executor Wallet: {fundingHash}");
// Sign the authorization to make it point to the delegation contract
var authorization = await eoaWallet.SignAuthorization(chainId: chainWith7702, contractAddress: delegationContractAddress, willSelfExecute: false);
Console.WriteLine($"Authorization: {JsonConvert.SerializeObject(authorization, Formatting.Indented)}");
// Execute the delegation
var tx = await ThirdwebTransaction.Create(executorWallet, new ThirdwebTransactionInput(chainId: chainWith7702, to: executorWalletAddress, authorization: authorization));
var hash = (await ThirdwebTransaction.SendAndWaitForTransactionReceipt(tx)).TransactionHash;
Console.WriteLine($"Authorization execution transaction hash: {hash}");
// Prove that code has been deployed to the eoa
var rpc = ThirdwebRPC.GetRpcInstance(client, chainWith7702);
var code = await rpc.SendRequestAsync<string>("eth_getCode", eoaWalletAddress, "latest");
Console.WriteLine($"EOA code: {code}");
// Log erc20 balance of executor before the claim
var executorBalanceBefore = await erc20Contract.ERC20_BalanceOf(executorWalletAddress);
Console.WriteLine($"Executor balance before: {executorBalanceBefore}");
// Prepare the claim call
var claimCallData = erc20Contract.CreateCallData(
"claim",
new object[]
{
executorWalletAddress, // receiver
100, // quantity
Constants.NATIVE_TOKEN_ADDRESS, // currency
0, // pricePerToken
new object[] { Array.Empty<byte>(), BigInteger.Zero, BigInteger.Zero, Constants.ADDRESS_ZERO }, // allowlistProof
Array.Empty<byte>() // data
}
);
// Embed the claim call in the execute call
var executeCallData = delegationContract.CreateCallData(
method: "execute",
parameters: new object[]
{
new List<Thirdweb.Console.Call>
{
new()
{
Data = claimCallData.HexToBytes(),
To = erc20ContractAddress,
Value = BigInteger.Zero
}
}
}
);
// Execute from the executor wallet targeting the eoa which is pointing to the delegation contract
var tx2 = await ThirdwebTransaction.Create(executorWallet, new ThirdwebTransactionInput(chainId: chainWith7702, to: eoaWalletAddress, data: executeCallData));
var hash2 = (await ThirdwebTransaction.SendAndWaitForTransactionReceipt(tx2)).TransactionHash;
Console.WriteLine($"Token claim transaction hash: {hash2}");
// Log erc20 balance of executor after the claim
var executorBalanceAfter = await erc20Contract.ERC20_BalanceOf(executorWalletAddress);
Console.WriteLine($"Executor balance after: {executorBalanceAfter}");
Note that for the time being this only works on 7702-enabled chains such as Odyssey and the feature has only been integrated with PrivateKeyWallet
.
EcosystemWallet.GetUserAuthDetails
Adds the ability to retrieve auth provider specific user information from In-App and Ecosystem Wallets in #110
Other additions
SwitchNetwork
is now part of the mainIThirdwebWallet
interface. Smart Wallets now attempt to switch the underlying admin network automatically as well.ERC721_TotalSupply
extension now includes burned NFTs when using thirdweb contracts, allowing forERC721_GetAll
andERC721_GetOwned
functions to return said NFTs as well.- Various new utilities for conversions and transaction decoding, including decoding
authorizationList
.
Full Changelog: v2.11.1...v2.12.0
v2.11.1
What's Changed
- [SmartWallet] Fix SwitchNetwork from zksync stack to non zksync by @0xFirekeeper in #106
Full Changelog: v2.11.0...v2.11.1
v2.11.0
What's Changed
- [Pay] Allow passing purchaseData with quotes by @0xFirekeeper in #104
- ERC-6492 Predeploy Signature Verification by @0xFirekeeper in #105
- Adds ThirdwebContract.CreateCallData extension.
Full Changelog: v2.10.1...v2.11.0
v2.10.1
v2.10.0
What's Changed
- Added
AuthProvider.Steam
as a login option for In-App or Ecosystem Wallets.
var steamWallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Steam);
if (!await steamWallet.IsConnected())
{
_ = await steamWallet.LoginWithOauth(...);
}
var steamWalletAddy = await steamWallet.GetAddress();
- Added the ability to pay for gas with ERC20 tokens when using Smart Wallet.
- Currently supports Base USDC, Celo CUSD, and Lisk LSK tokens.
- Simply select a
TokenPaymaster
when creating aSmartWallet
and all transactions will be paid for with the corresponding ERC20 from the user's Smart Wallet. - Useful on L2s where the native token is ETH and you want to enshrine another coin or onramp your users directly to that coin.
- These TokenPaymasters entirely operate onchain, leveraging popular DEXes and decentralized price feeds from Uniswap & Chainlink.
- This product is in beta, and only compatible with EntryPoint v0.7.0, which we auto select for you if not overriden when configurin your wallet.
// Example of paying for a transaction using Lisk's LSK Stablecoin instead of native ETH
var chainId = 1135; // lisk
var erc20SmartWallet = await SmartWallet.Create(
personalWallet: privateKeyWallet,
chainId: chainId,
tokenPaymaster: TokenPaymaster.LISK_LSK
);
var erc20SmartWalletAddress = await erc20SmartWallet.GetAddress();
Console.WriteLine($"ERC20 Smart Wallet address: {erc20SmartWalletAddress}");
var receipt = await erc20SmartWallet.Transfer(chainId: chainId, toAddress: erc20SmartWalletAddress, weiAmount: 0);
Console.WriteLine($"Receipt: {JsonConvert.SerializeObject(receipt, Formatting.Indented)}");