@@ -53,37 +53,44 @@ Note that in order to communicate with the SDK on WebGL, you need to `Build and
53
53
54
54
# Usage
55
55
56
+ In order to access the SDK, you only need to have a [ ThirdwebManager] ( https://portal.thirdweb.com/unity/thirdwebmanager ) in your scene.
57
+
56
58
``` 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
+ );
59
68
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 );
62
71
63
- // interact with the wallet
72
+ // Interact with the wallet
64
73
CurrencyValue balance = await sdk .wallet .GetBalance ();
65
74
var signature = await sdk .wallet .Sign (" message to sign" );
66
75
67
- // get an instance of a deployed contract (no ABI required!)
76
+ // Get an instance of a deployed contract (no ABI required!)
68
77
var contract = sdk .GetContract (" 0x..." );
69
78
70
- // fetch data from any ERC20/721/1155 or marketplace contract
79
+ // Fetch data from any ERC20/721/1155 or marketplace contract
71
80
CurrencyValue currencyValue = await contract .ERC20 .TotalSupply ();
72
81
NFT erc721NFT = await contract .ERC721 .Get (tokenId );
73
82
List < NFT > erc1155NFTs = await contract .ERC1155 .GetAll ();
74
83
List < Listing > listings = await marketplace .GetAllListings ();
75
84
76
- // execute transactions from the connected wallet
85
+ // Execute transactions from the connected wallet
77
86
await contract .ERC20 .Mint (" 1.2" );
78
87
await contract .ERC721 .signature .Mint (signedPayload );
79
88
await contract .ERC1155 .Claim (tokenId , quantity );
80
89
await marketplace .BuyListing (listingId , quantity );
81
90
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 , .. .);
87
94
```
88
95
89
96
# Prefabs
0 commit comments