You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# 0.1.0 (2026-06-26)
1
+
# 0.1.0 (2026-06-27)
2
2
3
3
4
4
### Bug Fixes
@@ -356,6 +356,7 @@
356
356
***subscriptions:** GET fan–creator subscription state with auth ([2fec38f](https://github.com/MyFanss/MyFans/commit/2fec38f7d73e046ce497399ec412220b12fd8044))
357
357
***subscriptions:** map query status string to SubscriptionStatus enum ([0661159](https://github.com/MyFanss/MyFans/commit/0661159312d2cc5051c8c91e5b9a8b398c24b314))
Shared typesand enums for MyFans Soroban contracts.
3
+
Shared types, enums, and error codes for MyFans Soroban contracts. This library provides common definitions used across all MyFans smart contracts, ensuring type safety and consistency.
4
4
5
-
## Types
5
+
## Public API
6
6
7
-
### SubscriptionStatus
7
+
### Enums
8
+
9
+
#### SubscriptionStatus
8
10
9
11
Represents the lifecycle status of a subscription.
10
12
@@ -17,9 +19,15 @@ pub enum SubscriptionStatus {
17
19
}
18
20
```
19
21
20
-
### ContentType
22
+
**Properties:**
23
+
- Soroban-compatible (decorated with `#[contracttype]`)
24
+
- Copy, Clone, Debug, Eq, PartialEq
25
+
- Serializable/deserializable
26
+
- Represented as `u32` for efficient storage
21
27
22
-
Represents content access type.
28
+
#### ContentType
29
+
30
+
Represents content access type classification.
23
31
24
32
```rust
25
33
pubenumContentType {
@@ -28,7 +36,89 @@ pub enum ContentType {
28
36
}
29
37
```
30
38
31
-
## Usage
39
+
**Properties:**
40
+
- Soroban-compatible (decorated with `#[contracttype]`)
41
+
- Copy, Clone, Debug, Eq, PartialEq
42
+
- Serializable/deserializable
43
+
- Represented as `u32` for efficient storage
44
+
45
+
#### MyfansError
46
+
47
+
Shared error enum across all MyFans contracts. Error codes are preserved exactly for test snapshot compatibility.
48
+
49
+
```rust
50
+
pubenumMyfansError {
51
+
// Common init/admin errors
52
+
AlreadyInitialized=1,
53
+
NotInitialized=2,
54
+
NotAuthorized=3,
55
+
// Balance/transfer errors
56
+
InsufficientBalance=4,
57
+
// Fee/config errors
58
+
InvalidFeeBps=5,
59
+
// Spam/security
60
+
RateLimited=6,
61
+
AlreadyRegistered=7,
62
+
NotLiked=8,
63
+
// State control
64
+
Paused=9,
65
+
// content-access specific
66
+
ContentPriceNotSet=101,
67
+
// subscription specific
68
+
SubscriptionNotFound=102,
69
+
SubscriptionExpired=103,
70
+
AdminNotInitialized=104,
71
+
// treasury specific
72
+
NegativeMinBalance=105,
73
+
MinBalanceViolation=106,
74
+
}
75
+
```
76
+
77
+
**Properties:**
78
+
- Decorated with `#[contracterror]` for Soroban error handling
79
+
- Copy, Clone, Debug, Eq, PartialEq
80
+
- Numeric discriminants are stable and fixed for compatibility
81
+
82
+
### Modules
83
+
84
+
#### error_codes
85
+
86
+
Provides stable numeric error code constants for each contract, enabling clients (TypeScript SDK, backend, frontend) to inspect Soroban error results without hard-coding magic numbers.
87
+
88
+
**Usage:**
89
+
```rust
90
+
usemyfans_lib::error_codes::subscription as sub_err;
91
+
92
+
// Check whether a Soroban invocation failed with SubscriptionNotFound:
93
+
// if result.err() == Some(sub_err::SUBSCRIPTION_NOT_FOUND) { ... }
94
+
```
95
+
96
+
**Available sub-modules:**
97
+
-`subscription` - Error codes for the subscription contract
98
+
-`content_access` - Error codes for the content-access contract
99
+
-`content_likes` - Error codes for the content-likes contract
100
+
-`creator_registry` - Error codes for the creator-registry contract
101
+
-`treasury` - Error codes for the treasury contract
102
+
-`earnings` - Error codes for the earnings contract
103
+
-`creator_earnings` - Error codes for the creator-earnings contract
104
+
-`creator_deposits` - Error codes for the creator-deposits contract
105
+
-`myfans_contract` - Error codes for the main myfans-contract
106
+
107
+
**Note:** Error codes in each sub-module **must** match the `#[contracterror]` discriminants in the corresponding contract's `Error` enum. The `test-consumer` contract enforces this invariant through tests.
108
+
109
+
#### test_fixtures
110
+
111
+
Provides shared test fixtures for cross-contract integration tests. Only available when the `testutils` feature is enabled.
0 commit comments