Focus mode

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!

Yazılım Kariyerinde İlerlemeni Hızlandıracak Eğitimler

Kendi kendine yazılım öğrenirken zorlanıyor, takıldığın noktalarda bir mentore mi ihtiyaç duyuyorsun? Patika+ programlarımız ile 4-8 aylık yoğun eğitim kamplarına katıl, proje tabanlı canlı dersler ve sana özel hazırlanmış eğitimlerle gereken tüm yetenekleri kazan, iş hayatına başla!

Project

Comments

You need to enroll in the course to be able to comment!