@@ -51,6 +51,47 @@ Notes:
51
51
- The Newtonsoft DLL is included as part of the Unity Package, feel free to deselect it if you already have it installed as a dependency to avoid conflicts.
52
52
- If using .NET Framework and encountering an error related to HttpUtility, create a file ` csc.rsp ` that includes ` -r:System.Web.dll ` and save it under ` Assets ` .
53
53
54
+ # Usage
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
+
58
+ ``` csharp
59
+ // Configure the connection
60
+ var connection = new WalletConnection (
61
+ provider : WalletProvider .EmbeddedWallet , // The wallet provider you want to connect to (Required)
62
+ chainId : 5 , // The chain you want to connect to (Required)
63
+ email : " email@email.com" // The email you want to authenticate with (Required for this provider)
64
+ );
65
+
66
+ // Connect the wallet
67
+ string address = await ThirdwebManager .Instance .SDK .Wallet .Connect (connection );
68
+
69
+ // Interact with the wallet
70
+ CurrencyValue balance = await ThirdwebManager .Instance .SDK .Wallet .GetBalance ();
71
+ var signature = await ThirdwebManager .Instance .SDK .Wallet .Sign (" message to sign" );
72
+
73
+ // Get an instance of a deployed contract (no ABI required!)
74
+ var contract = ThirdwebManager .Instance .SDK .GetContract (" 0x..." );
75
+
76
+ // Fetch data from any ERC20/721/1155 or Marketplace contract
77
+ CurrencyValue currencyValue = await contract .ERC20 .TotalSupply ();
78
+ NFT erc721NFT = await contract .ERC721 .Get (tokenId );
79
+ List < NFT > erc1155NFTs = await contract .ERC1155 .GetAll ();
80
+ List < Listing > listings = await contract .Marketplace .DirectListings .GetAllListings ();
81
+
82
+ // Execute transactions from the connected wallet
83
+ await contract .ERC20 .Mint (" 1.2" );
84
+ await contract .ERC721 .Signature .Mint (signedPayload );
85
+ await contract .ERC1155 .Claim (tokenId , quantity );
86
+ await contract .Marketplace .DirectListings .BuyListing (listingId , quantity );
87
+
88
+ // Custom interactions
89
+ var res = await contract .Read <string >(" myReadFunction" , arg1 , arg2 , .. .);
90
+ var txRes = await contract .Write (" myWriteFunction" , arg1 , arg2 , .. .);
91
+ ```
92
+
93
+
94
+
54
95
# Build
55
96
56
97
## General
@@ -94,46 +135,73 @@ Once again, please note that no action is needed for hosted builds.
94
135
## Mobile
95
136
96
137
- For Android , it is best to run Force Resolve from the `Assets ` menu > `External Dependency Manager ` > `Android Resolver ` > `Force Resolve ` before building your game .
97
- - ~~ For iOS , if you are missing a MetaMask package , you can double click on `main .unitypackage ` under `Assets \Thirdweb \Plugins \MetaMask \Installer \Packages ` and reimport the `iOS ` folder . ~~ Recent versions should no longer require this .
138
+ - For iOS , if you are missing a MetaMask package , you can double click on `main .unitypackage ` under `Assets \Thirdweb \Plugins \MetaMask \Installer \Packages ` and reimport the `iOS ` folder ( only ) .
98
139
- ~~ If you are having trouble building in XCode , make sure `ENABLE_BITCODE ` is disabled and that the `Embedded Frameworks ` in your `Build Phases ` contain potentially missing frameworks like `MetaMask ` or `Starscream `. You may also need to remove the `Thirdweb /Core /Plugins /MetaMask /Plugins /iOS /iphoneos /MetaMask_iOS .framework /Frameworks ` folder in some cases .~~ Recent versions should no longer require this .
99
140
100
- # Usage
101
-
102
- In order to access the SDK , you only need to have a [ThirdwebManager ](https :// portal.thirdweb.com/unity/thirdwebmanager) in your scene.
103
-
104
- ```csharp
105
- // Configure the connection
106
- var connection = new WalletConnection (
107
- provider : WalletProvider .EmbeddedWallet , // The wallet provider you want to connect to (Required)
108
- chainId : 5 , // The chain you want to connect to (Required)
109
- email : " email@email.com" // The email you want to authenticate with (Required for this provider)
110
- );
111
-
112
- // Connect the wallet
113
- string address = await ThirdwebManager .Instance .SDK .Wallet .Connect (connection );
114
-
115
- // Interact with the wallet
116
- CurrencyValue balance = await ThirdwebManager .Instance .SDK .Wallet .GetBalance ();
117
- var signature = await ThirdwebManager .Instance .SDK .Wallet .Sign (" message to sign" );
118
-
119
- // Get an instance of a deployed contract (no ABI required!)
120
- var contract = ThirdwebManager .Instance .SDK .GetContract (" 0x..." );
121
-
122
- // Fetch data from any ERC20/721/1155 or Marketplace contract
123
- CurrencyValue currencyValue = await contract .ERC20 .TotalSupply ();
124
- NFT erc721NFT = await contract .ERC721 .Get (tokenId );
125
- List < NFT > erc1155NFTs = await contract .ERC1155 .GetAll ();
126
- List < Listing > listings = await contract .Marketplace .DirectListings .GetAllListings ();
127
-
128
- // Execute transactions from the connected wallet
129
- await contract .ERC20 .Mint (" 1.2" );
130
- await contract .ERC721 .Signature .Mint (signedPayload );
131
- await contract .ERC1155 .Claim (tokenId , quantity );
132
- await contract .Marketplace .DirectListings .BuyListing (listingId , quantity );
133
-
134
- // Custom interactions
135
- var res = await contract .Read <string >(" myReadFunction" , arg1 , arg2 , .. .);
136
- var txRes = await contract .Write (" myWriteFunction" , arg1 , arg2 , .. .);
141
+ ## Miscellaneous
142
+ If you don 't want to use Minimal Stripping , you could instead create a `link .xml ` file under your Assets folder and include assemblies that must be preserved , for instance :
143
+ ```xml
144
+ < linker >
145
+ < ! -- Thirdweb -- >
146
+ < assembly fullname = " Amazon.Extensions.CognitoAuthentication" preserve = " all" / >
147
+ < assembly fullname = " AWSSDK.CognitoIdentity" preserve = " all" / >
148
+ < assembly fullname = " AWSSDK.CognitoIdentityProvider" preserve = " all" / >
149
+ < assembly fullname = " AWSSDK.Core" preserve = " all" / >
150
+ < assembly fullname = " AWSSDK.Lambda" preserve = " all" / >
151
+ < assembly fullname = " AWSSDK.SecurityToken" preserve = " all" / >
152
+ < assembly fullname = " embedded-wallet" preserve = " all" / >
153
+
154
+ < ! -- Other -- >
155
+ < assembly fullname = " System.Runtime.Serialization" preserve = " all" / >
156
+ < assembly fullname = " Newtonsoft.Json" preserve = " all" / >
157
+ < assembly fullname = " System" preserve = " all" >
158
+ < type fullname = " System.ComponentModel.TypeConverter" preserve = " all" / >
159
+ < type fullname = " System.ComponentModel.ArrayConverter" preserve = " all" / >
160
+ < type fullname = " System.ComponentModel.BaseNumberConverter" preserve = " all" / >
161
+ < type fullname = " System.ComponentModel.BooleanConverter" preserve = " all" / >
162
+ < type fullname = " System.ComponentModel.ByteConverter" preserve = " all" / >
163
+ < type fullname = " System.ComponentModel.CharConverter" preserve = " all" / >
164
+ < type fullname = " System.ComponentModel.CollectionConverter" preserve = " all" / >
165
+ < type fullname = " System.ComponentModel.ComponentConverter" preserve = " all" / >
166
+ < type fullname = " System.ComponentModel.CultureInfoConverter" preserve = " all" / >
167
+ < type fullname = " System.ComponentModel.DateTimeConverter" preserve = " all" / >
168
+ < type fullname = " System.ComponentModel.DecimalConverter" preserve = " all" / >
169
+ < type fullname = " System.ComponentModel.DoubleConverter" preserve = " all" / >
170
+ < type fullname = " System.ComponentModel.EnumConverter" preserve = " all" / >
171
+ < type fullname = " System.ComponentModel.ExpandableObjectConverter" preserve = " all" / >
172
+ < type fullname = " System.ComponentModel.Int16Converter" preserve = " all" / >
173
+ < type fullname = " System.ComponentModel.Int32Converter" preserve = " all" / >
174
+ < type fullname = " System.ComponentModel.Int64Converter" preserve = " all" / >
175
+ < type fullname = " System.ComponentModel.NullableConverter" preserve = " all" / >
176
+ < type fullname = " System.ComponentModel.SByteConverter" preserve = " all" / >
177
+ < type fullname = " System.ComponentModel.SingleConverter" preserve = " all" / >
178
+ < type fullname = " System.ComponentModel.StringConverter" preserve = " all" / >
179
+ < type fullname = " System.ComponentModel.TimeSpanConverter" preserve = " all" / >
180
+ < type fullname = " System.ComponentModel.UInt16Converter" preserve = " all" / >
181
+ < type fullname = " System.ComponentModel.UInt32Converter" preserve = " all" / >
182
+ < type fullname = " System.ComponentModel.UInt64Converter" preserve = " all" / >
183
+ < / assembly >
184
+ < assembly fullname = " Nethereum.ABI" preserve = " all" / >
185
+ < assembly fullname = " Nethereum.Accounts" preserve = " all" / >
186
+ < assembly fullname = " Nethereum.BlockchainProcessing" preserve = " all" / >
187
+ < assembly fullname = " Nethereum.Contracts" preserve = " all" / >
188
+ < assembly fullname = " Nethereum.HdWallet" preserve = " all" / >
189
+ < assembly fullname = " Nethereum.Hex" preserve = " all" / >
190
+ < assembly fullname = " Nethereum.JsonRpc.Client" preserve = " all" / >
191
+ < assembly fullname = " Nethereum.JsonRpc.RpcClient" preserve = " all" / >
192
+ < assembly fullname = " Nethereum.Keystore" preserve = " all" / >
193
+ < assembly fullname = " Nethereum.Merkle" preserve = " all" / >
194
+ < assembly fullname = " Nethereum.Merkle.Patricia" preserve = " all" / >
195
+ < assembly fullname = " Nethereum.Model" preserve = " all" / >
196
+ < assembly fullname = " Nethereum.RLP" preserve = " all" / >
197
+ < assembly fullname = " Nethereum.RPC" preserve = " all" / >
198
+ < assembly fullname = " Nethereum.Signer" preserve = " all" / >
199
+ < assembly fullname = " Nethereum.Signer.EIP712" preserve = " all" / >
200
+ < assembly fullname = " Nethereum.Siwe" preserve = " all" / >
201
+ < assembly fullname = " Nethereum.Siwe.Core" preserve = " all" / >
202
+ < assembly fullname = " Nethereum.Util" preserve = " all" / >
203
+ < assembly fullname = " Nethereum.Web3" preserve = " all" / >
204
+ < / linker >
137
205
```
138
206
139
207
# Additional Links
0 commit comments