Application Isolation and Context (appId
)
Sage Protocol isolates content and interactions per application by using a unique identifier (appId
). Each application maintains distinct channels and posts, while user identities and social graphs remain global across all Sage-compatible apps.
What this means for you:
- Users have a single, global identity and consistent social relationships everywhere.
- Each application provides tailored content and distinct community interactions..
Example Direct Javascript Integration using appId
Example Direct Javascript Integration using appId
appId
) to maintain content isolation while benefiting from universal user identities.
Invite-Based User Creation (Temporary)
Currently, Sage Protocol requires invite codes and keys for user creation. This temporary mechanism allows applications to control growth and maintain initial engagement quality.- Invite Code: Unique code authorizing user creation.
- Invite Key: Secure key accompanying the invite code.
Example Direct JavaScript Integration for Creating Users with Invites
Example Direct JavaScript Integration for Creating Users with Invites
Transaction Patterns
Sage SDK operations involving blockchain transactions follow a two-step pattern:- Construct Transaction: SDK methods return transaction objects to be signed.
- Sign and Execute Transaction: Your React app securely handles wallet interactions for transaction execution.
Example transaction workflow using direct JavaScript integration
Example transaction workflow using direct JavaScript integration
someAction
with the specific method name you’re invoking from sageClient
. This accurately represents the direct JavaScript integration pattern documented in your SDK.Error Handling
The Sage SDK consistently provides structured results indicating success or errors. Every SDK call returns an object with:ok
: Boolean indicating success (true
) or failure (false
).err
: Error details if the call fails.
ok
property before proceeding.
Recommended Direct JavaScript Error Handling Pattern
Recommended Direct JavaScript Error Handling Pattern
someAction
with the specific method you’re using from the sageClient
.Event Monitoring and Querying
The Sage SDK provides explicit event-monitoring capabilities. Events (e.g., user creation, posts, channel updates) are emitted on-chain, enabling your application to:- React to user actions in real-time.
- Gather precise analytics and track activity.
Example: Querying new user creation events using direct JavaScript integration
Example: Querying new user creation events using direct JavaScript integration
React Context and Hooks
For React apps, the Sage SDK provides built-in context (SageProvider
) and custom hooks (useUser
, useChannel
, usePost
) to simplify state management and interactions with blockchain primitives.
Example: Following a channel using React hooks:
Next Steps
With these key concepts clarified, you’re now well-equipped to explore Sage SDK’s core primitives and fully utilize its powerful decentralized social functionalities. Proceed to:- Learn detailed management of the core primitives:
- Advanced Guides: See complete examples for building sophisticated decentralized social apps.
- API Reference: Explore comprehensive details on SDK methods and capabilities.