Skip to content

sleet-zig/.github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

NEAR Zig SDK Examples

This directory contains organized examples from the NEAR Zig SDK. Each example has been placed in its own project directory with proper build configurations.

Projects

1. Counter Project (counter_project)

  • A simple stateful counter contract on NEAR
  • Demonstrates state storage with Borsh serialization, public methods, and owner-only access control
  • Exported functions: new, increment, decrement, get_count, reset, get_owner

2. Fungible Token Project (fungible_token_project)

  • A minimal fungible token implementation following the NEP-141 standard
  • Features: ft_transfer, ft_balance_of, ft_total_supply, ft_metadata
  • Exported functions: new, ft_transfer, ft_balance_of, ft_total_supply, ft_metadata

3. Status Message Project (status_message_project)

  • Store status messages per account
  • Demonstrates using storage for key-value pairs and account-based data isolation
  • Exported functions: set_status, get_status

Building

Each project can be built independently:

# Build WASM contract
cd counter_project
zig build wasm

# Run tests
zig build test

Same commands work for the other projects (fungible_token_project and status_message_project).

Output

After building with zig build wasm, the compiled WASM contract will be available at:

  • zig-out/lib/contract.wasm

This structure allows for easy deployment to NEAR using the NEAR CLI:

near deploy --accountId your_contract.testnet --wasmFile zig-out/lib/contract.wasm

Dependencies

Each project depends on the near-sdk-zig library located in the parent directory. The build system is configured to reference this dependency via the build.zig.zon file in each project.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors