{"id":13288209,"url":"https://github.com/Learn-NEAR/NCD.L1.sample--thanks","last_synced_at":"2025-03-10T05:32:20.991Z","repository":{"id":39990792,"uuid":"354479633","full_name":"Learn-NEAR/NCD.L1.sample--thanks","owner":"Learn-NEAR","description":"Say \"thanks!\" to other students of the NCD by calling their instance of this contract.  You can optionally attach tokens to your message, or even leave an anonymous tip.","archived":false,"fork":false,"pushed_at":"2022-08-30T10:41:28.000Z","size":409,"stargazers_count":10,"open_issues_count":1,"forks_count":20,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-29T16:58:26.053Z","etag":null,"topics":["assemblyscript","blockchain","near-protocol"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Learn-NEAR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-04T07:09:54.000Z","updated_at":"2023-05-10T20:59:50.000Z","dependencies_parsed_at":"2022-08-25T18:21:54.000Z","dependency_job_id":null,"html_url":"https://github.com/Learn-NEAR/NCD.L1.sample--thanks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Learn-NEAR%2FNCD.L1.sample--thanks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Learn-NEAR%2FNCD.L1.sample--thanks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Learn-NEAR%2FNCD.L1.sample--thanks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Learn-NEAR%2FNCD.L1.sample--thanks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Learn-NEAR","download_url":"https://codeload.github.com/Learn-NEAR/NCD.L1.sample--thanks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221151746,"owners_count":16764913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assemblyscript","blockchain","near-protocol"],"created_at":"2024-07-29T16:55:00.661Z","updated_at":"2024-10-23T03:31:42.521Z","avatar_url":"https://github.com/Learn-NEAR.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thanks\n\nSay \"thanks!\" to other students of the NCD by calling _their_ instance of this contract.\n\nYou can optionally attach tokens to your message, or even leave an anonymous tip.\n\nOf course keep in mind that your signing account will be visible on the blockchain via NEAR Explorer even if you send an anonymous message.\n\n## ⚠️ Warning\n\nAny content produced by NEAR, or developer resources that NEAR provides, are for educational and inspiration purposes only.  NEAR does not encourage, induce or sanction the deployment of any such applications in violation of applicable laws or regulations.\n\n## Contract\n\n```ts\n// ------------------------------------\n// contract initialization\n// ------------------------------------\n\n/**\n * initialize contract with owner ID and other config data\n *\n * (note: this method is called \"constructor\" in the singleton contract code)\n */\nfunction init(owner: AccountId, allow_anonymous: bool = true): void\n\n// ------------------------------------\n// public methods\n// ------------------------------------\n\n/**\n * give thanks to the owner of the contract\n * and optionally attach tokens\n */\nfunction say(message: string, anonymous: bool): bool\n\n// ------------------------------------\n// owner methods\n// ------------------------------------\n\n/**\n * show all messages and users\n */\nfunction list(): Array\u003cMessage\u003e\n\n/**\n * generate a summary report\n */\nfunction summarize(): Contract\n\n/**\n * transfer received funds to owner account\n */\nfunction transfer(): void\n```\n\n\n## Usage\n\n### Development\n\nTo deploy the contract for development, follow these steps:\n\n1. clone this repo locally\n2. run `yarn` to install dependencies\n3. run `./scripts/1.dev-deploy.sh` to deploy the contract (this uses `near dev-deploy`)\n\n**Your contract is now ready to use.**\n\nTo use the contract you can do any of the following:\n\n_Public scripts_\n\n```sh\n2.say-thanks.sh         # post a message saying thank you, optionally attaching NEAR tokens\n2.say-anon-thanks.sh    # post an anonymous message (otherwise same as above)\n```\n\n_Owner scripts_\n\n```sh\no-report.sh             # generate a summary report of the contract state\no-transfer.sh           # transfer received funds to the owner account\n```\n\n### Production\n\nIt is recommended that you deploy the contract to a subaccount under your MainNet account to make it easier to identify you as the owner\n\n1. clone this repo locally\n2. run `./scripts/x-deploy.sh` to rebuild, deploy and initialize the contract to a target account\n\n   requires the following environment variables\n   - `NEAR_ENV`: Either `testnet` or `mainnet`\n   - `OWNER`: The owner of the contract and the parent account.  The contract will be deployed to `thanks.$OWNER`\n\n3. run `./scripts/x-remove.sh` to delete the account\n\n   requires the following environment variables\n   - `NEAR_ENV`: Either `testnet` or `mainnet`\n   - `OWNER`: The owner of the contract and the parent account.  The contract will be deployed to `thanks.$OWNER`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLearn-NEAR%2FNCD.L1.sample--thanks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLearn-NEAR%2FNCD.L1.sample--thanks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLearn-NEAR%2FNCD.L1.sample--thanks/lists"}