https://github.com/secretshardul/kaiak-mobile-number-backend
https://github.com/secretshardul/kaiak-mobile-number-backend
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/secretshardul/kaiak-mobile-number-backend
- Owner: secretshardul
- Created: 2021-03-13T14:55:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-14T12:07:52.000Z (over 5 years ago)
- Last Synced: 2025-01-19T07:24:42.245Z (over 1 year ago)
- Language: TypeScript
- Size: 164 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Near setup
- Compile and deploy contract
```sh
cd contract
node compile.js --debug
near dev-deploy build/debug/greeter.wasm
```
- Initialize contract in frontend
```js
const contractName = 'mycontract.testnet' // contract or account name
window.contract = await new Contract(window.walletConnection.account(), contractName, {
viewMethods: ['getGreeting'],
changeMethods: ['setGreeting'],
})
```
- Write to contract
```js
await window.contract.setGreeting({
message: 'hello world'
})
```
- Read from contract
```js
currentGreeting = await contract.getGreeting({ accountId: window.accountId })
```
# Twilio verification
1. Send OTP
```sh
curl 'https://verify.twilio.com/v2/Services/VA4777f711dc9cf933c305e3fb223d7bae/Verifications' -X POST \
--data-urlencode 'To=+919619477301' \
--data-urlencode 'Channel=sms' \
-u key:key
```
2. Verify on server
```sh
curl 'https://verify.twilio.com/v2/Services/VA4777f711dc9cf933c305e3fb223d7bae/VerificationCheck' -X POST \
--data-urlencode 'To=+919619477301' \
--data-urlencode 'Channel=sms' \
--data-urlencode 'Code=703356' \
-u key:key
```