Skip to content

Commit 2312475

Browse files
authored
Update README.md
1 parent 74711b2 commit 2312475

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,37 +53,44 @@ Note that in order to communicate with the SDK on WebGL, you need to `Build and
5353

5454
# Usage
5555

56+
In order to access the SDK, you only need to have a [ThirdwebManager](https://portal.thirdweb.com/unity/thirdwebmanager) in your scene.
57+
5658
```csharp
57-
// instantiate a read only SDK on any EVM chain
58-
var sdk = new ThirdwebSDK("goerli");
59+
// Reference to your Thirdweb SDK
60+
var sdk = ThirdwebManager.Instance.SDK;
61+
62+
// Configure the connection
63+
var connection = new WalletConnection(
64+
provider: WalletProvider.Paper, // The wallet provider you want to connect to (Required)
65+
chainId: 1, // The chain you want to connect to (Required)
66+
email: "email@email.com" // The email you want to authenticate with (Required for this provider)
67+
);
5968

60-
// connect the user's wallet - supports Metamask, Coinbase Wallet, WalletConnect and more
61-
var walletAddress = await sdk.wallet.Connect();
69+
// Connect the wallet
70+
string address = await sdk.wallet.Connect(connection);
6271

63-
// interact with the wallet
72+
// Interact with the wallet
6473
CurrencyValue balance = await sdk.wallet.GetBalance();
6574
var signature = await sdk.wallet.Sign("message to sign");
6675

67-
// get an instance of a deployed contract (no ABI required!)
76+
// Get an instance of a deployed contract (no ABI required!)
6877
var contract = sdk.GetContract("0x...");
6978

70-
// fetch data from any ERC20/721/1155 or marketplace contract
79+
// Fetch data from any ERC20/721/1155 or marketplace contract
7180
CurrencyValue currencyValue = await contract.ERC20.TotalSupply();
7281
NFT erc721NFT = await contract.ERC721.Get(tokenId);
7382
List<NFT> erc1155NFTs = await contract.ERC1155.GetAll();
7483
List<Listing> listings = await marketplace.GetAllListings();
7584

76-
// execute transactions from the connected wallet
85+
// Execute transactions from the connected wallet
7786
await contract.ERC20.Mint("1.2");
7887
await contract.ERC721.signature.Mint(signedPayload);
7988
await contract.ERC1155.Claim(tokenId, quantity);
8089
await marketplace.BuyListing(listingId, quantity);
8190

82-
// deploy contracts from the connected wallet
83-
var address = await sdk.deployer.DeployNFTCollection(new NFTContractDeployMetadata {
84-
name = "My Personal Unity Collection",
85-
primary_sale_recipient = await sdk.wallet.GetAddress(),
86-
});
91+
// Custom interactions
92+
var res = await contract.Read<string>("myReadFunction", arg1, arg2, ...);
93+
var txRes = await contract.Write("myWriteFunction", arg1, arg2, ...);
8794
```
8895

8996
# Prefabs

0 commit comments

Comments
 (0)