Skip to content

Commit 48d463b

Browse files
authored
v3 (#157)
1 parent a701896 commit 48d463b

File tree

109 files changed

+8514
-13742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+8514
-13742
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ root = true
99
###############################
1010

1111
# Exclude Thirdweb.Api generated files from all linting and formatting rules
12-
[Thirdweb/Thirdweb.Api/GeneratedClient.cs]
12+
[Thirdweb/Thirdweb.Api/ThirdwebApi.cs]
1313
generated_code = true
1414
dotnet_analyzer_diagnostic.severity = none
1515
dotnet_style_qualification_for_field = false

Makefile

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Thirdweb Makefile
2+
# Cross-platform targets to mirror tw.bat functionality
3+
# Requires: GNU Make, dotnet SDK, optional CSharpier
4+
5+
# Use bash for consistent behavior across platforms (Git Bash/MSYS2/WSL/macOS/Linux)
6+
SHELL := bash
7+
.SHELLFLAGS := -o pipefail -c
8+
9+
# Default target
10+
.DEFAULT_GOAL := help
11+
12+
# Tools and paths
13+
DOTNET := dotnet
14+
API_CLIENT := Thirdweb/Thirdweb.Api/ThirdwebApi.cs
15+
CONSOLE_PROJ := Thirdweb.Console
16+
GENERATOR_PROJ := Thirdweb.Generator
17+
LIB_PROJ := Thirdweb/Thirdweb.csproj
18+
19+
# Defaults for publishing/building
20+
CONFIG ?= Release
21+
TFM ?= netstandard2.1
22+
RID ?=
23+
OUT ?=
24+
25+
# Colors (best effort; will be empty if tput is unavailable)
26+
C_RST := $(shell tput sgr0 2>/dev/null || echo "")
27+
C_BOLD := $(shell tput bold 2>/dev/null || echo "")
28+
C_DIM := $(shell tput dim 2>/dev/null || echo "")
29+
C_RED := $(shell tput setaf 1 2>/dev/null || echo "")
30+
C_GRN := $(shell tput setaf 2 2>/dev/null || echo "")
31+
C_YEL := $(shell tput setaf 3 2>/dev/null || echo "")
32+
C_BLU := $(shell tput setaf 4 2>/dev/null || echo "")
33+
C_MAG := $(shell tput setaf 5 2>/dev/null || echo "")
34+
C_CYN := $(shell tput setaf 6 2>/dev/null || echo "")
35+
36+
# Icons
37+
IC_BUILD := BUILD
38+
IC_CLEAN := CLEAN
39+
IC_RESTORE := RESTORE
40+
IC_TEST := TEST
41+
IC_PACK := PACK
42+
IC_RUN := RUN
43+
IC_GEN := GEN
44+
IC_INFO := INFO
45+
IC_OK := OK
46+
IC_WARN := WARN
47+
IC_ERR := ERR
48+
IC_FMT := FMT
49+
IC_PUB := PUBLISH
50+
51+
hr = printf '$(C_DIM)%s$(C_RST)\n' '--------------------------------------------------------------------'
52+
msg = printf '%s[%s]%s %s\n' '$(1)' '$(2)' '$(C_RST)' '$(3)'
53+
54+
.PHONY: help
55+
help:
56+
@printf '\n$(C_CYN)$(C_BOLD)%s$(C_RST)\n' 'Thirdweb Tools'
57+
@$(hr)
58+
@printf 'Usage: $(C_BOLD)make$(C_RST) $(C_CYN)[target]$(C_RST)\n\n'
59+
@printf '$(C_BOLD)Targets:$(C_RST)\n'
60+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'build' 'Generate API and build the solution'
61+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'clean' 'Clean build artifacts'
62+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'restore' 'Restore NuGet packages'
63+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'test' 'Run tests'
64+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'pack' 'Generate API (if needed) and create NuGet package'
65+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'publish' 'Publish the Thirdweb project (dotnet publish)'
66+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'run' 'Run the console application'
67+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'generate' 'Generate API client from OpenAPI spec'
68+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'lint' 'Check code formatting (dry run)'
69+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'fix' 'Fix code formatting issues'
70+
@printf ' $(C_CYN)%-12s$(C_RST) - %s\n' 'help' 'Show this help message'
71+
@$(hr)
72+
73+
.PHONY: publish
74+
# Publish the Thirdweb library project
75+
# Usage examples:
76+
# make publish # Release publish
77+
# make publish CONFIG=Debug # Debug config
78+
# make publish RID=win-x64 # Target runtime
79+
# make publish OUT=artifacts/publish # Custom output dir
80+
publish:
81+
@if [ ! -f '$(API_CLIENT)' ]; then \
82+
$(call msg,$(C_YEL),$(IC_WARN),API client not found, generating it first) ; \
83+
$(MAKE) --no-print-directory generate ; \
84+
fi
85+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_PUB) Publishing Thirdweb project)
86+
@CMD="$(DOTNET) publish '$(LIB_PROJ)' -c '$(CONFIG)' -f '$(TFM)'"; \
87+
if [ -n "$(RID)" ]; then CMD="$$CMD -r '$(RID)'"; fi; \
88+
if [ -n "$(OUT)" ]; then CMD="$$CMD -o '$(OUT)'"; fi; \
89+
echo $$CMD; eval $$CMD && \
90+
$(call msg,$(C_GRN),$(IC_OK),Publish succeeded) || \
91+
$(call msg,$(C_RED),$(IC_ERR),Publish failed)
92+
93+
.PHONY: generate
94+
# Clean previous file and generate API client
95+
generate:
96+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_GEN) Cleaning generated API files)
97+
@rm -f '$(API_CLIENT)' 2>/dev/null || true
98+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_GEN) Generating Thirdweb API client with custom generator)
99+
@$(DOTNET) run --project '$(GENERATOR_PROJ)' --no-build >/dev/null 2>&1 \
100+
|| ( \
101+
$(call msg,$(C_MAG),>> ,Building generator) ; \
102+
$(DOTNET) build '$(GENERATOR_PROJ)' ; \
103+
$(call msg,$(C_MAG),>> ,Running generator) ; \
104+
$(DOTNET) run --project '$(GENERATOR_PROJ)' \
105+
)
106+
@$(call msg,$(C_GRN),$(IC_OK),API client generation complete)
107+
108+
.PHONY: build
109+
build:
110+
@$(MAKE) --no-print-directory generate
111+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_BUILD) Building with dotnet build)
112+
@$(DOTNET) build && \
113+
$(call msg,$(C_GRN),$(IC_OK),Build succeeded) || \
114+
$(call msg,$(C_RED),$(IC_ERR),Build failed)
115+
116+
.PHONY: clean
117+
clean:
118+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_CLEAN) Cleaning with dotnet clean)
119+
@$(DOTNET) clean && \
120+
$(call msg,$(C_GRN),$(IC_OK),Clean completed) || \
121+
$(call msg,$(C_RED),$(IC_ERR),Clean failed)
122+
123+
.PHONY: restore
124+
restore:
125+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_RESTORE) Restoring with dotnet restore)
126+
@$(DOTNET) restore && \
127+
$(call msg,$(C_GRN),$(IC_OK),Restore completed) || \
128+
$(call msg,$(C_RED),$(IC_ERR),Restore failed)
129+
130+
.PHONY: test
131+
test:
132+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_TEST) Running dotnet test)
133+
@$(DOTNET) test && \
134+
$(call msg,$(C_GRN),$(IC_OK),All tests passed) || \
135+
$(call msg,$(C_RED),$(IC_ERR),Some tests failed)
136+
137+
.PHONY: pack
138+
pack:
139+
@if [ ! -f '$(API_CLIENT)' ]; then \
140+
$(call msg,$(C_YEL),$(IC_WARN),API client not found, generating it first) ; \
141+
$(MAKE) --no-print-directory generate ; \
142+
fi
143+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_BUILD) Building Release)
144+
@$(DOTNET) build --configuration Release || { $(call msg,$(C_RED),$(IC_ERR),Build (Release) failed); exit 1; }
145+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_PACK) Packing NuGet package(s))
146+
@$(DOTNET) pack --configuration Release && \
147+
$(call msg,$(C_GRN),$(IC_OK),Pack completed) || \
148+
$(call msg,$(C_RED),$(IC_ERR),Packing failed)
149+
150+
.PHONY: run
151+
run:
152+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_RUN) dotnet run --project $(CONSOLE_PROJ))
153+
@$(DOTNET) run --project '$(CONSOLE_PROJ)' && \
154+
$(call msg,$(C_GRN),$(IC_OK),Application exited) || \
155+
$(call msg,$(C_RED),$(IC_ERR),Application exited with errors)
156+
157+
.PHONY: lint
158+
lint:
159+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_FMT) Checking code formatting with CSharpier)
160+
@csharpier --help >/dev/null 2>&1 || { \
161+
$(call msg,$(C_YEL),$(IC_WARN),CSharpier is not installed) ; \
162+
printf ' Install it with: dotnet tool install -g csharpier\n' ; \
163+
exit 0 ; \
164+
}
165+
@csharpier check . >/dev/null 2>&1 || { \
166+
$(call msg,$(C_YEL),$(IC_WARN),Formatting issues found) ; \
167+
printf ' Run "make fix" to automatically fix them.\n' ; \
168+
exit 0 ; \
169+
}
170+
@$(call msg,$(C_GRN),$(IC_OK),Code formatting is correct)
171+
172+
.PHONY: fix
173+
fix:
174+
@$(call msg,$(C_BLU),$(IC_INFO),$(IC_FMT) Running CSharpier formatter)
175+
@csharpier --help >/dev/null 2>&1 || { \
176+
$(call msg,$(C_YEL),$(IC_WARN),CSharpier is not installed) ; \
177+
printf ' Install it with: dotnet tool install -g csharpier\n' ; \
178+
exit 0 ; \
179+
}
180+
@csharpier format . >/dev/null 2>&1 || { \
181+
$(call msg,$(C_RED),$(IC_ERR),CSharpier formatting failed) ; \
182+
exit 1 ; \
183+
}
184+
@$(call msg,$(C_GRN),$(IC_OK),Code formatting completed)

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,21 @@
99

1010
The Thirdweb .NET SDK is a comprehensive and easy to use library that allows developers to interact with the blockchain using the .NET framework. It simplifies the integration of all [thirdweb](https://thirdweb.com/) functionality with a minimal set of dependencies.
1111

12-
## Features
12+
## Core Features
1313

14-
- **Connect to any EVM network:** Easily connect to Ethereum and other EVM-compatible networks.
15-
- **Query blockchain data:** Use Thirdweb RPC to fetch blockchain data efficiently.
14+
- **Connect to any EVM network:** Easily connect to blockchain network with its chain id alone.
1615
- **Interact with smart contracts:** Simplified read and write operations for smart contracts, with various out-of-the-box extensions provided.
17-
- **In-App Wallets:** Integrate user-friendly wallets within your applications, supporting email, phone, and OAuth login.
16+
- **In-App Wallets:** Integrate user-friendly wallets within your applications, supporting email, phone, OAuth login or plug your own auth in.
1817
- **Ecosystem Wallets:** Basically In-App Wallets functionality wise, with the added benefit of being able to securely share your wallets with third party partners.
19-
- **Account Abstraction:** Simplify complex account management tasks with smart wallets.
20-
- **Gasless Transactions:** Enable transactions without requiring users to pay gas fees.
21-
- **Storage Solutions:** Download and upload files using IPFS.
18+
- **Account Abstraction:** Turn any wallet into a programmable smart wallet (EIP-4337 or EIP-7702) with built-in gas sponsorship and granular session key features.
19+
- **Storage Solutions:** Download and upload files using IPFS or HTTPS.
2220
- **Transaction Builder:** Create, manipulate and send low level transactions.
2321
- **Session Keys:** Advanced control for smart wallets to manage permissions and session durations.
2422
- **Thirdweb Bridge:** Universal interface to use any asset onchain.
2523
- **Thirdweb Nebula:** Create blockchain-powered AI Agents.
2624
- **Thirdweb Insight:** Query blockchain data at the speed of light.
2725
- **Thirdweb Engine:** Interact in creative ways from your backend.
28-
- **Unity Compatibility**: This SDK has been tested successfully in [Unity 2021.3+](https://portal.thirdweb.com/unity/v5) (Standalone, Mobile and WebGL).
26+
- **Unity Compatibility**: This SDK has been tested successfully in [Unity 2022.3+](https://portal.thirdweb.com/unity/v5) (All build targets).
2927
- **Godot Compatibility**: This SDK has been tested successfully in [Godot .NET](https://portal.thirdweb.com/dotnet/godot)
3028
- **MAUI Compatibility**: This SDK has been tested successfully in [MAUI](https://portal.thirdweb.com/dotnet/maui)
3129

0 commit comments

Comments
 (0)