blocto / solana-go-sdk

Solana Golang SDK
https://blocto.github.io/solana-go-sdk/
MIT License
385 stars 101 forks source link

Can I call the smart contract directly? How should I call it #35

Closed E0001 closed 1 year ago

E0001 commented 2 years ago

Can I call the smart contract directly? How should I call it

yihau commented 2 years ago

sure. It depends which program you are interacting with. The main idea is to compose transaction if you want to call smart contract (in solana we called it program). FYI

A transaction = many signatures + a message
A message = many instructions + recent blockhash

you can treat every instruction equals a function in the program.

you can take a look at

https://github.com/solana-labs/example-helloworld https://dev.to/cogoo/solana-how-to-send-custom-instructions-via-instruction-data-4g9g

to learn how to compose your own instruciton.

panchuprodhan commented 2 years ago

How do I call the Hello World function in rust from go-client? https://github.com/solana-labs/example-helloworld

yihau commented 2 years ago

Oh. I think I should add some examples for interacting with custom program!

panchuprodhan commented 2 years ago

Yes, that should be helpful!

leecarney commented 2 years ago

Oh. I think I should add some examples for interacting with custom program!

That would be amazing thanks.

KunPengRen commented 1 year ago

Hi, is there anyone example to call a custom program available now? Or can I call a smart contract directly developed by anchor framework?

yihau commented 1 year ago

added three pages for basic concept

https://portto.github.io/solana-go-sdk/programs/101/hello.html https://portto.github.io/solana-go-sdk/programs/101/accounts.html https://portto.github.io/solana-go-sdk/programs/101/data.html