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!
Practice
Join the project workspace to share your solution and receive feedback.
Lesson discussion
Swap insights and ask questions about NEAR Developer Course
Be the first to start the discussion
Ask a question or share your thoughts about this lesson.