Odak modu

NEAR Developer Course

Practice

This is the second part of the practice that we have done before. You can either work on your practice I repo or clone it again. Working with your previous repo is a better idea to understand changes.

In this part, you need to change the smart contract while using a predecessor. After that, please build and deploy your smart contract and share with us your GitHub link which includes Task 4.


Task 4

cd starter--near-sdk-as

In src/simple/assembly/index.ts

export function helloWorld(names: Array<string>): string {
  return names.map<string>(name => 'hello ' + name).join(`\n`)
}


Change to,

export function helloWorld(): string {
  const predecessor = Context.predecessor
  return 'hello ' + predecessor
}

yarn build:release

near dev-deploy ./build/release/simple.wasm

near call $CONTRACT helloWorld --accountId <YOUR_ACCOUNT>.testnet


Output,

hello <YOUR_ACCOUNT>.testnet

At this point, upload your repo to GitHub, and please share your new repo link with us. 

Congrats! You have a smart contract on web3!

left-disk

Yazılım Kariyerinde İlerlemeni Hızlandıracak Programlar

Patika+ programlarımız ile 4-8 aylık yoğun yazılım kamplarına katıl, temel bilgilerden başlayarak kapsamlı bilgiler edin, yazılım kariyerine başla!

right-cube

Ödev

Yorumlar

Yorum yapabilmek için derse kayıt olmalısın!