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!

left-disk

Programs to Accelerate Your Progress in a Software Career

Join our 4-8 month intensive Patika+ bootcamps, start with the fundamentals and gain comprehensive knowledge to kickstart your software career!

right-cube

Project

Comments

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