Cài đặt

Yêu cầu tiên quyết

  • Rust 1.91+
  • Solana CLI 3.1.13 (Agave): sh -c "$(curl -sSfL https://release.anza.xyz/v3.1.13/install)"
  • Node.js 24.7.0+
  • pnpm 10.15.1+: npm install -g pnpm@10.15.1

Sao chép Repository

git clone https://github.com/solana-foundation/solana-private-channels.git
cd solana-private-channels

Tạo TypeScript Client

Các TypeScript client không được xuất bản lên npm. Chúng phải được tạo từ IDL bằng cách sử dụng Codama.

# Escrow program client
cd private-channel-escrow-program
pnpm install --frozen-lockfile
pnpm run generate-clients
cd ..
# Withdraw program client
cd private-channel-withdraw-program
pnpm install --frozen-lockfile
pnpm run generate-clients
cd ..

Các client được tạo ra nằm tại:

  • private-channel-escrow-program/clients/typescript/src/generated/
  • private-channel-withdraw-program/clients/typescript/src/generated/

Hãy import từ các đường dẫn cục bộ này trong ứng dụng của bạn; không có gói @private-channels/client nào trên npm. Các đoạn code trong phần này sử dụng đường dẫn tương đối (../private-channel-escrow-program/...) với giả định rằng code của bạn nằm cùng thư mục với repository đã sao chép; hãy điều chỉnh cho phù hợp với vị trí bạn thực sự import trong dự án của mình.

Kết nối tới Devnet

solana config set --url devnet
solana airdrop 2
solana balance
  • ID chương trình Escrow: 9tgHa1DcnaSSUtmMsst8ovKTe1Gfxzezn27KnH9xXYeU
  • ID chương trình Withdraw: J231K9UEpS4y4KAPwGc4gsMNCjKFRMYcQBcjVW7vBhVi

Các bước tiếp theo

Nạp Token - thực hiện khoản nạp đầu tiên của bạn

Is this page helpful?

Mục lục

Chỉnh sửa trang