Skip to content

UIT ecommerce payment contract for learn develop blockchain

Notifications You must be signed in to change notification settings

nearvndev/uit-ecommerce-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIT Payment Smart contract

Application Design: Ecommerce Payment user flow

Prerequires

  • NodeJS
  • Near CLI
  • Rust/Rustup and Wasm

Actions

  1. Create new account in testnet
export CONTRACT_ID=uit-payment-contract.vbidev.testnet
export ACCOUNT_ID=vbidev.testnet
near create $CONTRACT_ID --masterAccount $ACCOUNT_ID --initialBalance 5
  1. Build contract
cargo test & build.sh
  1. Deploy and init contract
near deploy --wasmFile out/contract.wasm --accountId $CONTRACT_ID--initFunction new '{"owner_id": "$ACCOUNT_ID"}'
  1. Pay order
near call $CONTRACT_ID pay_order '{"order_id": "order_1", "order_amount": "1000000000000000000000000"}' --accountId $ACCOUNT_ID --deposit 1
  1. Get order
near view $CONTRACT_ID get_order '{"order_id": "order_1"}'

Ex response:

{
  order_id: 'order_1',
  payer_id: 'vbidev.testnet',
  amount: 1e+24,
  received_amount: 2e+24,
  is_completed: true,
  is_refund: false,
  created_at: 1661439327890786600
}

About

UIT ecommerce payment contract for learn develop blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published